Commit 0e6bb70
feat(dbt-tools): auto-discover config with Windows compatibility (#464)
* feat(dbt-tools): auto-discover config, expose ALTIMATE_CODE_* env vars for vscode integration
- config.ts: add findProjectRoot() and discoverPython() (exported), update read() to auto-discover
projectRoot and pythonPath at runtime when no config file exists — removes requirement to run
`altimate-dbt init` before using any command
- discoverPython() prioritises ALTIMATE_CODE_VIRTUAL_ENV (injected by vscode-altimate-mcp-server)
over project-local venvs; tries python3 before python in each candidate location
- dbt-resolve.ts: add tier 2 (ALTIMATE_CODE_PYTHON_PATH sibling) and tier 6 (ALTIMATE_CODE_VIRTUAL_ENV)
so the dbt binary is found when altimate serve is spawned with a vscode-activated Python environment
- init.ts: remove duplicated find()/python() helpers; import from config.ts
- tests: add config.test.ts coverage for auto-discovery, findProjectRoot, discoverPython; add
dbt-resolve.test.ts scenarios for ALTIMATE_CODE_PYTHON_PATH and ALTIMATE_CODE_VIRTUAL_ENV priority
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix(dbt-tools): address code review findings for config auto-discovery
- Add `ALTIMATE_CODE_PYTHON_PATH` as highest priority in `discoverPython()`
so VS Code's explicit Python selection is not silently ignored
- Align `ALTIMATE_CODE_VIRTUAL_ENV` priority: move to tier 4 in `resolveDbt()`
(before project-local `.venv`) to match `discoverPython()` priority and
prevent Python/dbt resolving from different environments
- Add `JSON.parse` error handling in `read()` — malformed config file now
falls back to auto-discovery instead of crashing
- Fix stale inline comment numbering in `dbt-resolve.ts` (1-11)
- Fix environment-dependent `read returns null` test by setting CWD to temp dir
- Add tests: `ALTIMATE_CODE_PYTHON_PATH` priority, malformed config fallback
- Run prettier on `dbt-resolve.ts` and `dbt-resolve.test.ts`
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix(dbt-tools): remove ALTIMATE_CODE_* env vars and add Windows compatibility
Drop ALTIMATE_CODE_PYTHON_PATH and ALTIMATE_CODE_VIRTUAL_ENV — dbt and
Python will be on PATH anyway. Add Windows support: use Scripts/ instead
of bin/, .exe suffix for binaries, where instead of which, skip Unix-only
pyenv/asdf resolution, and add Windows-specific known fallback paths.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix(dbt-tools): handle undefined from array index in discoverPython
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix(dbt-tools): fix PATH separator and Conda discovery for Windows
- Use `path.delimiter` instead of hardcoded `:` in `validateDbt()` and
`buildDbtEnv()` so PATH injection works on Windows (`;` separator)
- Fix Conda Python discovery on Windows: check env root directly since
Conda places `python.exe` at `%CONDA_PREFIX%\python.exe`, not in `Scripts/`
- Add `timeout: 5_000` to `execFileSync` in `discoverPython()` to match
the same pattern used in `dbt-resolve.ts`
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: anandgupta42 <anand@altimate.ai>1 parent 79c34c5 commit 0e6bb70
5 files changed
Lines changed: 330 additions & 129 deletions
File tree
- packages/dbt-tools
- src
- commands
- test
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | | - | |
4 | | - | |
| 3 | + | |
5 | 4 | | |
6 | 5 | | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | 6 | | |
60 | 7 | | |
61 | 8 | | |
62 | 9 | | |
63 | 10 | | |
64 | 11 | | |
65 | | - | |
| 12 | + | |
66 | 13 | | |
67 | 14 | | |
68 | 15 | | |
69 | 16 | | |
70 | 17 | | |
71 | | - | |
| 18 | + | |
72 | 19 | | |
73 | 20 | | |
74 | 21 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
21 | 89 | | |
22 | 90 | | |
23 | | - | |
24 | | - | |
25 | | - | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
26 | 108 | | |
27 | 109 | | |
28 | 110 | | |
| |||
0 commit comments