@vibe-agent-toolkit/cli 0.1.36 → 0.1.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/bin/vat +10 -5
- package/dist/bin/vat.js +10 -5
- package/dist/bin/vat.js.map +1 -1
- package/dist/commands/agent/build.d.ts.map +1 -1
- package/dist/commands/agent/build.js +3 -0
- package/dist/commands/agent/build.js.map +1 -1
- package/dist/commands/agent/index.d.ts.map +1 -1
- package/dist/commands/agent/index.js +25 -1
- package/dist/commands/agent/index.js.map +1 -1
- package/dist/commands/agent/run.d.ts.map +1 -1
- package/dist/commands/agent/run.js +5 -0
- package/dist/commands/agent/run.js.map +1 -1
- package/dist/commands/agent/validate.d.ts.map +1 -1
- package/dist/commands/agent/validate.js +3 -0
- package/dist/commands/agent/validate.js.map +1 -1
- package/dist/commands/audit.d.ts.map +1 -1
- package/dist/commands/audit.js +24 -11
- package/dist/commands/audit.js.map +1 -1
- package/dist/commands/build.d.ts.map +1 -1
- package/dist/commands/build.js +9 -0
- package/dist/commands/build.js.map +1 -1
- package/dist/commands/claude/claude-config.d.ts.map +1 -1
- package/dist/commands/claude/claude-config.js +4 -2
- package/dist/commands/claude/claude-config.js.map +1 -1
- package/dist/commands/claude/plugin/install.js +2 -2
- package/dist/commands/claude/plugin/install.js.map +1 -1
- package/dist/commands/corpus/index.d.ts.map +1 -1
- package/dist/commands/corpus/index.js +6 -0
- package/dist/commands/corpus/index.js.map +1 -1
- package/dist/commands/corpus/report.js +2 -2
- package/dist/commands/corpus/report.js.map +1 -1
- package/dist/commands/corpus/runner.js +3 -3
- package/dist/commands/corpus/runner.js.map +1 -1
- package/dist/commands/corpus/scan.d.ts.map +1 -1
- package/dist/commands/corpus/scan.js +4 -0
- package/dist/commands/corpus/scan.js.map +1 -1
- package/dist/commands/corpus/seed.js +2 -2
- package/dist/commands/corpus/seed.js.map +1 -1
- package/dist/commands/doctor.d.ts +4 -2
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +24 -34
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/rag/command-helpers.d.ts +7 -2
- package/dist/commands/rag/command-helpers.d.ts.map +1 -1
- package/dist/commands/rag/command-helpers.js +10 -5
- package/dist/commands/rag/command-helpers.js.map +1 -1
- package/dist/commands/rag/index-command.d.ts.map +1 -1
- package/dist/commands/rag/index-command.js +11 -3
- package/dist/commands/rag/index-command.js.map +1 -1
- package/dist/commands/rag/index.d.ts.map +1 -1
- package/dist/commands/rag/index.js +24 -0
- package/dist/commands/rag/index.js.map +1 -1
- package/dist/commands/resources/index.d.ts.map +1 -1
- package/dist/commands/resources/index.js +12 -0
- package/dist/commands/resources/index.js.map +1 -1
- package/dist/commands/resources/scan.d.ts.map +1 -1
- package/dist/commands/resources/scan.js +4 -1
- package/dist/commands/resources/scan.js.map +1 -1
- package/dist/commands/resources/validate.d.ts.map +1 -1
- package/dist/commands/resources/validate.js +7 -4
- package/dist/commands/resources/validate.js.map +1 -1
- package/dist/commands/skill/review.d.ts.map +1 -1
- package/dist/commands/skill/review.js +14 -2
- package/dist/commands/skill/review.js.map +1 -1
- package/dist/commands/skills/build.d.ts.map +1 -1
- package/dist/commands/skills/build.js +12 -0
- package/dist/commands/skills/build.js.map +1 -1
- package/dist/commands/skills/index.js +6 -0
- package/dist/commands/skills/index.js.map +1 -1
- package/dist/commands/skills/package.d.ts.map +1 -1
- package/dist/commands/skills/package.js +10 -0
- package/dist/commands/skills/package.js.map +1 -1
- package/dist/commands/skills/validate-command.d.ts.map +1 -1
- package/dist/commands/skills/validate-command.js +6 -0
- package/dist/commands/skills/validate-command.js.map +1 -1
- package/dist/commands/skills/validate.d.ts.map +1 -1
- package/dist/commands/skills/validate.js +15 -3
- package/dist/commands/skills/validate.js.map +1 -1
- package/dist/commands/verify.d.ts.map +1 -1
- package/dist/commands/verify.js +9 -0
- package/dist/commands/verify.js.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -1
- package/dist/index.js.map +1 -1
- package/dist/utils/agent-discovery.js +2 -2
- package/dist/utils/agent-discovery.js.map +1 -1
- package/dist/utils/config-loader.d.ts +11 -24
- package/dist/utils/config-loader.d.ts.map +1 -1
- package/dist/utils/config-loader.js +34 -65
- package/dist/utils/config-loader.js.map +1 -1
- package/dist/utils/logger.d.ts +1 -0
- package/dist/utils/logger.d.ts.map +1 -1
- package/dist/utils/logger.js +3 -0
- package/dist/utils/logger.js.map +1 -1
- package/dist/utils/output.js +3 -3
- package/dist/utils/output.js.map +1 -1
- package/dist/utils/project-root-policy.d.ts +33 -0
- package/dist/utils/project-root-policy.d.ts.map +1 -0
- package/dist/utils/project-root-policy.js +49 -0
- package/dist/utils/project-root-policy.js.map +1 -0
- package/dist/utils/resource-loader.d.ts +9 -4
- package/dist/utils/resource-loader.d.ts.map +1 -1
- package/dist/utils/resource-loader.js +24 -28
- package/dist/utils/resource-loader.js.map +1 -1
- package/dist/utils/validate-help-files.js +2 -2
- package/dist/utils/validate-help-files.js.map +1 -1
- package/docs/agent.md +25 -0
- package/docs/audit.md +25 -0
- package/docs/doctor.md +13 -0
- package/docs/index.md +19 -0
- package/docs/mcp.md +16 -0
- package/docs/rag.md +18 -0
- package/docs/resources.md +38 -0
- package/docs/skills.md +61 -3
- package/package.json +12 -13
- package/dist/utils/project-root.d.ts +0 -30
- package/dist/utils/project-root.d.ts.map +0 -1
- package/dist/utils/project-root.js +0 -59
- package/dist/utils/project-root.js.map +0 -1
package/docs/rag.md
CHANGED
|
@@ -441,6 +441,24 @@ vat rag index docs/
|
|
|
441
441
|
2. Query too broad/vague → Be more specific
|
|
442
442
|
3. Chunk boundaries split relevant content → Adjust chunk size (future feature)
|
|
443
443
|
|
|
444
|
+
## Requirements
|
|
445
|
+
|
|
446
|
+
| Subcommand | `projectRoot` | Config |
|
|
447
|
+
|---|---|---|
|
|
448
|
+
| `vat rag index [path]` | optional (tolerates absence — `--db` supplies the path directly) | required fields (`rag.*`) when `--db` is not supplied; otherwise unused |
|
|
449
|
+
| `vat rag query <text>` | optional (`--db` overrides) | required file with `rag.*` for default db lookup |
|
|
450
|
+
| `vat rag stats` | optional (`--db` overrides) | required file with `rag.*` for default db lookup |
|
|
451
|
+
| `vat rag clear` | optional (`--db` overrides) | required file with `rag.*` for default db lookup |
|
|
452
|
+
|
|
453
|
+
RAG commands are unusual: they tolerate a missing `projectRoot` because the
|
|
454
|
+
caller can always specify `--db <path>` explicitly. But when `--db` is omitted,
|
|
455
|
+
VAT needs `rag.*` config fields to locate the configured store. The two
|
|
456
|
+
mechanisms are complementary — `--db` is for one-off use, `rag.*` config is for
|
|
457
|
+
project-default behavior.
|
|
458
|
+
|
|
459
|
+
See [Roots and Config — Canonical Concepts](../../../docs/concepts/roots-and-config.md)
|
|
460
|
+
for terminology.
|
|
461
|
+
|
|
444
462
|
## More Information
|
|
445
463
|
|
|
446
464
|
- **GitHub:** https://github.com/jdutton/vibe-agent-toolkit
|
package/docs/resources.md
CHANGED
|
@@ -53,6 +53,20 @@ vat resources scan docs/
|
|
|
53
53
|
# ---
|
|
54
54
|
```
|
|
55
55
|
|
|
56
|
+
**Requirements:**
|
|
57
|
+
|
|
58
|
+
- **`projectRoot`**: optional with **loud-cwd fallback**. When invoked with an
|
|
59
|
+
explicit `[path]`, that path is the effective base. Without a path, VAT walks
|
|
60
|
+
up from `cwd` for `vibe-agent-toolkit.config.yaml` then `.git/`; if neither is
|
|
61
|
+
found, the command falls back to `cwd` and emits a single stderr warning
|
|
62
|
+
identifying the fallback. The scan still completes — the warning is the
|
|
63
|
+
contract that prevents silent surprise.
|
|
64
|
+
- **Config**: optional. Uses built-in include/exclude defaults if no config file
|
|
65
|
+
is present.
|
|
66
|
+
|
|
67
|
+
See [Roots and Config — Canonical Concepts](../../../docs/concepts/roots-and-config.md)
|
|
68
|
+
for the loud-cwd fallback policy and the projectRoot discovery ladder.
|
|
69
|
+
|
|
56
70
|
### vat resources validate [path]
|
|
57
71
|
|
|
58
72
|
**Purpose:** Validate markdown resources with strict error reporting
|
|
@@ -121,6 +135,30 @@ vat resources validate docs/
|
|
|
121
135
|
# ---
|
|
122
136
|
```
|
|
123
137
|
|
|
138
|
+
**Requirements:**
|
|
139
|
+
|
|
140
|
+
- **`projectRoot`**: optional with **loud-cwd fallback**. With an explicit
|
|
141
|
+
`[path]` the path is used as the base directory; without it VAT walks for a
|
|
142
|
+
`vibe-agent-toolkit.config.yaml` then `.git/` ancestor, and falls back to
|
|
143
|
+
`cwd` with a stderr warning if neither is found.
|
|
144
|
+
- **Config**: optional. Defaults are applied when no config file is present;
|
|
145
|
+
`--frontmatter-schema` is independent of config.
|
|
146
|
+
|
|
147
|
+
**Leading-`/` URI-reference resolution.** Markdown body links and frontmatter
|
|
148
|
+
URI-references whose path component starts with `/` (e.g.
|
|
149
|
+
`[See](/docs/foo.md)`, `parent_spec: /docs/foo.md`) are RFC 3986 §4.2
|
|
150
|
+
absolute-path references and are resolved against the discovered `projectRoot`.
|
|
151
|
+
Once cwd-fallback has fired, the effective `projectRoot` is `cwd` and leading-`/`
|
|
152
|
+
links resolve against `cwd` — consistent with the loud-cwd contract. The
|
|
153
|
+
`absolute_no_root` failure mode fires only when `projectRoot` is genuinely
|
|
154
|
+
undefined (e.g. a programmatic embedder that did not supply one); leading-`/`
|
|
155
|
+
links that escape `projectRoot` via path traversal surface as
|
|
156
|
+
`absolute_escapes_root`. Both surface as `broken_file` issues.
|
|
157
|
+
|
|
158
|
+
See [Roots and Config — Canonical Concepts](../../../docs/concepts/roots-and-config.md)
|
|
159
|
+
for the projectRoot ladder, the loud-cwd fallback policy, and the rationale
|
|
160
|
+
behind RFC-3986-compliant leading-`/` resolution.
|
|
161
|
+
|
|
124
162
|
## Configuration
|
|
125
163
|
|
|
126
164
|
Place `vibe-agent-toolkit.config.yaml` at project root:
|
package/docs/skills.md
CHANGED
|
@@ -128,6 +128,19 @@ vat skills validate --user
|
|
|
128
128
|
vat skills validate packages/my-agent/resources/skills
|
|
129
129
|
```
|
|
130
130
|
|
|
131
|
+
**Requirements:**
|
|
132
|
+
|
|
133
|
+
- **`projectRoot`**: required. `vat skills validate` refuses to run if no
|
|
134
|
+
`vibe-agent-toolkit.config.yaml` or `.git/` ancestor is found. Source-mode
|
|
135
|
+
validation always runs against a real authoring boundary.
|
|
136
|
+
- **Config**: optional. Falls back to built-in defaults if no config file is
|
|
137
|
+
present, but a `projectRoot` is still required to anchor link resolution and
|
|
138
|
+
the gitignore-safety gate.
|
|
139
|
+
|
|
140
|
+
See [Roots and Config — Canonical Concepts](../../../docs/concepts/roots-and-config.md)
|
|
141
|
+
for the discovery ladder, the loud-cwd fallback policy, and the CLI-boundary
|
|
142
|
+
discovery rule that this command participates in.
|
|
143
|
+
|
|
131
144
|
---
|
|
132
145
|
|
|
133
146
|
### vat skills build
|
|
@@ -203,6 +216,18 @@ vat skills build --skill my-skill
|
|
|
203
216
|
vat skills build --dry-run
|
|
204
217
|
```
|
|
205
218
|
|
|
219
|
+
**Requirements:**
|
|
220
|
+
|
|
221
|
+
- **`projectRoot`**: required. `vat skills build` refuses to run if no
|
|
222
|
+
`vibe-agent-toolkit.config.yaml` or `.git/` ancestor is found. This guards
|
|
223
|
+
against accidental builds outside a VAT project.
|
|
224
|
+
- **Config**: required file with `skills.*` fields populated. The build
|
|
225
|
+
pipeline reads `skills.discovery` and `skills.config.*` directly — there are
|
|
226
|
+
no useful defaults for these.
|
|
227
|
+
|
|
228
|
+
See [Roots and Config — Canonical Concepts](../../../docs/concepts/roots-and-config.md)
|
|
229
|
+
for terminology.
|
|
230
|
+
|
|
206
231
|
---
|
|
207
232
|
|
|
208
233
|
### vat skills package <skill-path>
|
|
@@ -270,6 +295,18 @@ vat skills package SKILL.md -o dist --no-rewrite-links
|
|
|
270
295
|
vat skills package SKILL.md -o dist -b /custom/base
|
|
271
296
|
```
|
|
272
297
|
|
|
298
|
+
**Requirements:**
|
|
299
|
+
|
|
300
|
+
- **`projectRoot`**: required. Packaging is an explicit-adoption operation and
|
|
301
|
+
is refused outside a discovered VAT project (no `vibe-agent-toolkit.config.yaml`
|
|
302
|
+
or `.git/` ancestor).
|
|
303
|
+
- **Config**: required file with `skills.*` fields populated. Per-skill packaging
|
|
304
|
+
options (`skills.config.<name>`) drive link rewriting, bundle inclusion, and
|
|
305
|
+
validation overrides.
|
|
306
|
+
|
|
307
|
+
See [Roots and Config — Canonical Concepts](../../../docs/concepts/roots-and-config.md)
|
|
308
|
+
for terminology.
|
|
309
|
+
|
|
273
310
|
---
|
|
274
311
|
|
|
275
312
|
### vat skills install \<source\>
|
|
@@ -378,7 +415,17 @@ vat skills install ./dist/skills/my-skill --target claude --scope project
|
|
|
378
415
|
**Post-Installation:**
|
|
379
416
|
After installation, you need to:
|
|
380
417
|
1. Restart Claude Code (or the target agent), or
|
|
381
|
-
2. Run `/reload-
|
|
418
|
+
2. Run `/reload-plugins` in Claude Code to load the new skill
|
|
419
|
+
|
|
420
|
+
**Requirements:**
|
|
421
|
+
|
|
422
|
+
- **`projectRoot`**: N/A. `vat skills install` is a user-level operation that
|
|
423
|
+
installs into platform target directories (`~/.claude/skills/`,
|
|
424
|
+
`.claude/skills/`, etc.) regardless of where it is invoked.
|
|
425
|
+
- **Config**: not used.
|
|
426
|
+
|
|
427
|
+
See [Roots and Config — Canonical Concepts](../../../docs/concepts/roots-and-config.md)
|
|
428
|
+
for terminology.
|
|
382
429
|
|
|
383
430
|
---
|
|
384
431
|
|
|
@@ -453,6 +500,17 @@ vat skills list packages/my-agent
|
|
|
453
500
|
vat skills list --verbose
|
|
454
501
|
```
|
|
455
502
|
|
|
503
|
+
**Requirements:**
|
|
504
|
+
|
|
505
|
+
- **`projectRoot`**: optional. `vat skills list` tolerates a missing
|
|
506
|
+
`projectRoot`. With `--user` it scans user installation directories directly
|
|
507
|
+
and skips project-root discovery entirely.
|
|
508
|
+
- **Config**: optional. Project mode honors config-defined include/exclude
|
|
509
|
+
patterns when present; defaults are used otherwise.
|
|
510
|
+
|
|
511
|
+
See [Roots and Config — Canonical Concepts](../../../docs/concepts/roots-and-config.md)
|
|
512
|
+
for terminology.
|
|
513
|
+
|
|
456
514
|
---
|
|
457
515
|
|
|
458
516
|
## Distribution Workflow
|
|
@@ -580,7 +638,7 @@ User: /my-skill
|
|
|
580
638
|
- Use `--dry-run` to preview what will be installed before committing
|
|
581
639
|
- Use `--force` flag carefully (overwrites existing skills)
|
|
582
640
|
- Verify installation: `vat skills list --user`
|
|
583
|
-
- Remember to restart the target agent or run `/reload-
|
|
641
|
+
- Remember to restart the target agent or run `/reload-plugins` in Claude Code
|
|
584
642
|
|
|
585
643
|
---
|
|
586
644
|
|
|
@@ -660,7 +718,7 @@ name: my-help # Instead of "help"
|
|
|
660
718
|
**Solution:**
|
|
661
719
|
1. Verify installation: `vat skills list --user`
|
|
662
720
|
2. Check location: Should be in `~/.claude/skills/` not `~/.claude/plugins/`
|
|
663
|
-
3. Restart Claude Code or run `/reload-
|
|
721
|
+
3. Restart Claude Code or run `/reload-plugins`
|
|
664
722
|
|
|
665
723
|
### "Windows-style backslashes"
|
|
666
724
|
**Problem:** Links use backslashes: `resources\SKILL.md`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vibe-agent-toolkit/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.38",
|
|
4
4
|
"description": "Command-line interface for vibe-agent-toolkit",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -41,27 +41,26 @@
|
|
|
41
41
|
"//dependencies-note": "DO NOT add example agent packages or adopter packages here. Adopter packages (like vat-development-agents) depend on the CLI binary at build time — declaring them as deps creates a circular build dependency. They are built in a second turbo pass via package#task overrides in turbo.json.",
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@anthropic-ai/sdk": "^0.71.2",
|
|
44
|
-
"@vibe-agent-toolkit/agent-config": "0.1.
|
|
45
|
-
"@vibe-agent-toolkit/agent-schema": "0.1.
|
|
46
|
-
"@vibe-agent-toolkit/agent-skills": "0.1.
|
|
47
|
-
"@vibe-agent-toolkit/claude-marketplace": "0.1.
|
|
48
|
-
"@vibe-agent-toolkit/discovery": "0.1.
|
|
49
|
-
"@vibe-agent-toolkit/gateway-mcp": "0.1.
|
|
50
|
-
"@vibe-agent-toolkit/rag": "0.1.
|
|
51
|
-
"@vibe-agent-toolkit/rag-lancedb": "0.1.
|
|
52
|
-
"@vibe-agent-toolkit/resources": "0.1.
|
|
53
|
-
"@vibe-agent-toolkit/utils": "0.1.
|
|
44
|
+
"@vibe-agent-toolkit/agent-config": "0.1.38",
|
|
45
|
+
"@vibe-agent-toolkit/agent-schema": "0.1.38",
|
|
46
|
+
"@vibe-agent-toolkit/agent-skills": "0.1.38",
|
|
47
|
+
"@vibe-agent-toolkit/claude-marketplace": "0.1.38",
|
|
48
|
+
"@vibe-agent-toolkit/discovery": "0.1.38",
|
|
49
|
+
"@vibe-agent-toolkit/gateway-mcp": "0.1.38",
|
|
50
|
+
"@vibe-agent-toolkit/rag": "0.1.38",
|
|
51
|
+
"@vibe-agent-toolkit/rag-lancedb": "0.1.38",
|
|
52
|
+
"@vibe-agent-toolkit/resources": "0.1.38",
|
|
53
|
+
"@vibe-agent-toolkit/utils": "0.1.38",
|
|
54
54
|
"adm-zip": "^0.5.16",
|
|
55
55
|
"commander": "^12.1.0",
|
|
56
|
-
"js-yaml": "^4.1.0",
|
|
57
56
|
"picomatch": "^4.0.3",
|
|
58
57
|
"semver": "^7.7.3",
|
|
59
58
|
"tar": "^7.5.7",
|
|
59
|
+
"yaml": "^2.6.1",
|
|
60
60
|
"zod": "^3.24.1"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
63
|
"@types/adm-zip": "^0.5.7",
|
|
64
|
-
"@types/js-yaml": "^4.0.9",
|
|
65
64
|
"@types/node": "^22.10.5",
|
|
66
65
|
"@types/picomatch": "^4.0.2",
|
|
67
66
|
"@types/semver": "^7.7.1",
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Project root detection utility
|
|
3
|
-
* Walks up directory tree to find .git or vibe-agent-toolkit.config.yaml
|
|
4
|
-
*
|
|
5
|
-
* Environment Variables:
|
|
6
|
-
* - VAT_TEST_ROOT: Override project root for testing (bypasses detection)
|
|
7
|
-
*/
|
|
8
|
-
/**
|
|
9
|
-
* Find project root by walking up directory tree
|
|
10
|
-
*
|
|
11
|
-
* @param startDir - Directory to start search from
|
|
12
|
-
* @returns Project root path or null if not found
|
|
13
|
-
*
|
|
14
|
-
* @remarks
|
|
15
|
-
* Can be overridden with VAT_TEST_ROOT environment variable for testing.
|
|
16
|
-
* This allows tests to specify an exact project root without relying on
|
|
17
|
-
* directory structure (.git or config file presence).
|
|
18
|
-
*
|
|
19
|
-
* @example
|
|
20
|
-
* ```typescript
|
|
21
|
-
* // Normal usage
|
|
22
|
-
* const root = findProjectRoot(process.cwd());
|
|
23
|
-
*
|
|
24
|
-
* // Test usage with override
|
|
25
|
-
* process.env.VAT_TEST_ROOT = '/path/to/test/fixtures';
|
|
26
|
-
* const root = findProjectRoot(process.cwd()); // Returns /path/to/test/fixtures
|
|
27
|
-
* ```
|
|
28
|
-
*/
|
|
29
|
-
export declare function findProjectRoot(startDir: string): string | null;
|
|
30
|
-
//# sourceMappingURL=project-root.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"project-root.d.ts","sourceRoot":"","sources":["../../src/utils/project-root.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAOH;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CA+B/D"}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Project root detection utility
|
|
3
|
-
* Walks up directory tree to find .git or vibe-agent-toolkit.config.yaml
|
|
4
|
-
*
|
|
5
|
-
* Environment Variables:
|
|
6
|
-
* - VAT_TEST_ROOT: Override project root for testing (bypasses detection)
|
|
7
|
-
*/
|
|
8
|
-
import * as fs from 'node:fs';
|
|
9
|
-
import * as path from 'node:path';
|
|
10
|
-
import { safePath } from '@vibe-agent-toolkit/utils';
|
|
11
|
-
/**
|
|
12
|
-
* Find project root by walking up directory tree
|
|
13
|
-
*
|
|
14
|
-
* @param startDir - Directory to start search from
|
|
15
|
-
* @returns Project root path or null if not found
|
|
16
|
-
*
|
|
17
|
-
* @remarks
|
|
18
|
-
* Can be overridden with VAT_TEST_ROOT environment variable for testing.
|
|
19
|
-
* This allows tests to specify an exact project root without relying on
|
|
20
|
-
* directory structure (.git or config file presence).
|
|
21
|
-
*
|
|
22
|
-
* @example
|
|
23
|
-
* ```typescript
|
|
24
|
-
* // Normal usage
|
|
25
|
-
* const root = findProjectRoot(process.cwd());
|
|
26
|
-
*
|
|
27
|
-
* // Test usage with override
|
|
28
|
-
* process.env.VAT_TEST_ROOT = '/path/to/test/fixtures';
|
|
29
|
-
* const root = findProjectRoot(process.cwd()); // Returns /path/to/test/fixtures
|
|
30
|
-
* ```
|
|
31
|
-
*/
|
|
32
|
-
export function findProjectRoot(startDir) {
|
|
33
|
-
// Override for testing: VAT_TEST_ROOT bypasses detection
|
|
34
|
-
if (process.env['VAT_TEST_ROOT']) {
|
|
35
|
-
return process.env['VAT_TEST_ROOT'];
|
|
36
|
-
}
|
|
37
|
-
let current = safePath.resolve(startDir);
|
|
38
|
-
const root = path.parse(current).root;
|
|
39
|
-
while (current !== root) {
|
|
40
|
-
// Check for .git directory
|
|
41
|
-
// eslint-disable-next-line security/detect-non-literal-fs-filename -- path walking is intentional
|
|
42
|
-
if (fs.existsSync(safePath.join(current, '.git'))) {
|
|
43
|
-
return current;
|
|
44
|
-
}
|
|
45
|
-
// Check for config file
|
|
46
|
-
// eslint-disable-next-line security/detect-non-literal-fs-filename -- path walking is intentional
|
|
47
|
-
if (fs.existsSync(safePath.join(current, 'vibe-agent-toolkit.config.yaml'))) {
|
|
48
|
-
return current;
|
|
49
|
-
}
|
|
50
|
-
// Move up one directory
|
|
51
|
-
const parent = path.dirname(current);
|
|
52
|
-
if (parent === current) {
|
|
53
|
-
break; // Reached root
|
|
54
|
-
}
|
|
55
|
-
current = parent;
|
|
56
|
-
}
|
|
57
|
-
return null;
|
|
58
|
-
}
|
|
59
|
-
//# sourceMappingURL=project-root.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"project-root.js","sourceRoot":"","sources":["../../src/utils/project-root.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAErD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,eAAe,CAAC,QAAgB;IAC9C,yDAAyD;IACzD,IAAI,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,EAAE,CAAC;QACjC,OAAO,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;IACtC,CAAC;IAED,IAAI,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IACzC,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC;IAEtC,OAAO,OAAO,KAAK,IAAI,EAAE,CAAC;QACxB,2BAA2B;QAC3B,kGAAkG;QAClG,IAAI,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC;YAClD,OAAO,OAAO,CAAC;QACjB,CAAC;QAED,wBAAwB;QACxB,kGAAkG;QAClG,IAAI,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,EAAE,gCAAgC,CAAC,CAAC,EAAE,CAAC;YAC5E,OAAO,OAAO,CAAC;QACjB,CAAC;QAED,wBAAwB;QACxB,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QACrC,IAAI,MAAM,KAAK,OAAO,EAAE,CAAC;YACvB,MAAM,CAAC,eAAe;QACxB,CAAC;QACD,OAAO,GAAG,MAAM,CAAC;IACnB,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
|