@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
|
@@ -5,32 +5,11 @@
|
|
|
5
5
|
* - VAT_TEST_CONFIG: Override config file path for testing (absolute path)
|
|
6
6
|
*/
|
|
7
7
|
import { readFileSync, existsSync } from 'node:fs';
|
|
8
|
-
import { dirname
|
|
8
|
+
import { dirname } from 'node:path';
|
|
9
9
|
import { ProjectConfigSchema } from '@vibe-agent-toolkit/resources';
|
|
10
10
|
import { safePath } from '@vibe-agent-toolkit/utils';
|
|
11
|
-
import * as yaml from '
|
|
11
|
+
import * as yaml from 'yaml';
|
|
12
12
|
const CONFIG_FILENAME = 'vibe-agent-toolkit.config.yaml';
|
|
13
|
-
/**
|
|
14
|
-
* Find configuration file by walking up directory tree
|
|
15
|
-
* @param startDir - Starting directory (defaults to cwd)
|
|
16
|
-
* @returns Path to config file, or null if not found
|
|
17
|
-
*/
|
|
18
|
-
export function findConfigPath(startDir) {
|
|
19
|
-
let currentDir = safePath.resolve(startDir ?? process.cwd());
|
|
20
|
-
const root = parse(currentDir).root;
|
|
21
|
-
while (currentDir !== root) {
|
|
22
|
-
const configPath = safePath.join(currentDir, CONFIG_FILENAME);
|
|
23
|
-
// eslint-disable-next-line security/detect-non-literal-fs-filename -- Dynamic path walking is required for config file search
|
|
24
|
-
if (existsSync(configPath)) {
|
|
25
|
-
return configPath;
|
|
26
|
-
}
|
|
27
|
-
const parent = dirname(currentDir);
|
|
28
|
-
if (parent === currentDir)
|
|
29
|
-
break; // safety: at filesystem root
|
|
30
|
-
currentDir = parent;
|
|
31
|
-
}
|
|
32
|
-
return null;
|
|
33
|
-
}
|
|
34
13
|
/**
|
|
35
14
|
* Load and validate project configuration
|
|
36
15
|
*
|
|
@@ -62,7 +41,7 @@ export function loadConfig(projectRoot) {
|
|
|
62
41
|
try {
|
|
63
42
|
// eslint-disable-next-line security/detect-non-literal-fs-filename -- configPath is derived from projectRoot parameter
|
|
64
43
|
const content = readFileSync(configPath, 'utf-8');
|
|
65
|
-
const parsed = yaml.
|
|
44
|
+
const parsed = yaml.parse(content);
|
|
66
45
|
// Validate with canonical schema from resources package
|
|
67
46
|
const result = ProjectConfigSchema.safeParse(parsed);
|
|
68
47
|
if (!result.success) {
|
|
@@ -84,58 +63,48 @@ export function getConfigDir(configPath) {
|
|
|
84
63
|
return dirname(configPath);
|
|
85
64
|
}
|
|
86
65
|
/**
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
*
|
|
66
|
+
* Layer 2 cache for {@link loadConfigCached}.
|
|
67
|
+
*
|
|
68
|
+
* Keyed by `projectRoot` → parsed {@link ProjectConfig} (or `null` if the
|
|
69
|
+
* file failed to load). Avoids re-parsing the same config yaml repeatedly
|
|
70
|
+
* when audit walks up from many sibling skills sharing one governing config.
|
|
71
|
+
*
|
|
72
|
+
* Tests that mutate fixtures between runs must call
|
|
73
|
+
* {@link resetLoadedConfigCache} to invalidate this cache.
|
|
90
74
|
*
|
|
91
|
-
*
|
|
92
|
-
* to invalidate this cache.
|
|
75
|
+
* See spec docs/superpowers/specs/2026-05-17-root-model-and-leading-slash-design.md §8.
|
|
93
76
|
*/
|
|
94
|
-
const
|
|
77
|
+
const loadedConfigCache = new Map();
|
|
95
78
|
/**
|
|
96
|
-
* Reset the
|
|
97
|
-
*
|
|
98
|
-
*
|
|
79
|
+
* Reset the cache used by {@link loadConfigCached}.
|
|
80
|
+
*
|
|
81
|
+
* Call at the start of each independent CLI invocation (e.g. `vat audit`) so
|
|
82
|
+
* in-process callers don't observe stale config data across runs.
|
|
99
83
|
*/
|
|
100
|
-
export function
|
|
101
|
-
|
|
84
|
+
export function resetLoadedConfigCache() {
|
|
85
|
+
loadedConfigCache.clear();
|
|
102
86
|
}
|
|
103
87
|
/**
|
|
104
|
-
*
|
|
105
|
-
* `vibe-agent-toolkit.config.yaml`. Loads and caches the config on first hit.
|
|
106
|
-
*
|
|
107
|
-
* Returns the parsed config plus the `configRoot` (directory that contained the
|
|
108
|
-
* yaml), or `null` if no config is found anywhere up the tree.
|
|
88
|
+
* Cached variant of {@link loadConfig} keyed by `projectRoot`.
|
|
109
89
|
*
|
|
110
|
-
*
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
-
*
|
|
114
|
-
* state — the audit CLI entrypoint already does this via `resetAuditCaches()`.
|
|
90
|
+
* Both successful loads and parse failures are cached (failures as `null`)
|
|
91
|
+
* so a broken config doesn't re-parse on every skill in the same scan. A
|
|
92
|
+
* test that edits a broken config into a good one between calls must invoke
|
|
93
|
+
* {@link resetLoadedConfigCache} (audit's `resetAuditCaches()` does this).
|
|
115
94
|
*/
|
|
116
|
-
export function
|
|
117
|
-
const
|
|
118
|
-
if (
|
|
119
|
-
return
|
|
120
|
-
}
|
|
121
|
-
const configRoot = dirname(configPath);
|
|
122
|
-
const cached = governingConfigCache.get(configRoot);
|
|
123
|
-
if (cached !== undefined) {
|
|
124
|
-
return cached === null ? null : { config: cached, configRoot };
|
|
125
|
-
}
|
|
95
|
+
export function loadConfigCached(projectRoot) {
|
|
96
|
+
const cached = loadedConfigCache.get(projectRoot);
|
|
97
|
+
if (cached !== undefined)
|
|
98
|
+
return cached ?? undefined;
|
|
126
99
|
try {
|
|
127
|
-
const config = loadConfig(
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
return null;
|
|
131
|
-
}
|
|
132
|
-
governingConfigCache.set(configRoot, config);
|
|
133
|
-
return { config, configRoot };
|
|
100
|
+
const config = loadConfig(projectRoot);
|
|
101
|
+
loadedConfigCache.set(projectRoot, config ?? null);
|
|
102
|
+
return config;
|
|
134
103
|
}
|
|
135
104
|
catch {
|
|
136
|
-
//
|
|
137
|
-
|
|
138
|
-
return
|
|
105
|
+
// Cache failures as null so a broken config doesn't re-parse per skill.
|
|
106
|
+
loadedConfigCache.set(projectRoot, null);
|
|
107
|
+
return undefined;
|
|
139
108
|
}
|
|
140
109
|
}
|
|
141
110
|
//# sourceMappingURL=config-loader.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-loader.js","sourceRoot":"","sources":["../../src/utils/config-loader.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,
|
|
1
|
+
{"version":3,"file":"config-loader.js","sourceRoot":"","sources":["../../src/utils/config-loader.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO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
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,MAAM;IACrB,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,KAAK,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACjC,KAAK,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CAClC;AAED,MAAM,WAAW,aAAa;IAC5B,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,wBAAgB,YAAY,CAAC,OAAO,GAAE,aAAkB,GAAG,MAAM,CAmBhE"}
|
package/dist/utils/logger.js
CHANGED
package/dist/utils/logger.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAaH,MAAM,UAAU,YAAY,CAAC,UAAyB,EAAE;IACtD,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,KAAK,CAAC;IAErC,OAAO;QACL,IAAI,EAAE,CAAC,OAAe,EAAE,EAAE;YACxB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,OAAO,IAAI,CAAC,CAAC;QACvC,CAAC;QACD,IAAI,EAAE,CAAC,OAAe,EAAE,EAAE;YACxB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,OAAO,IAAI,CAAC,CAAC;QACvC,CAAC;QACD,KAAK,EAAE,CAAC,OAAe,EAAE,EAAE;YACzB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,OAAO,IAAI,CAAC,CAAC;QACvC,CAAC;QACD,KAAK,EAAE,CAAC,OAAe,EAAE,EAAE;YACzB,IAAI,KAAK,EAAE,CAAC;gBACV,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,WAAW,OAAO,IAAI,CAAC,CAAC;YAC/C,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/dist/utils/output.js
CHANGED
|
@@ -2,17 +2,17 @@
|
|
|
2
2
|
* Output utilities for structured data
|
|
3
3
|
* YAML output on stdout, logs on stderr
|
|
4
4
|
*/
|
|
5
|
-
import * as yaml from '
|
|
5
|
+
import * as yaml from 'yaml';
|
|
6
6
|
/**
|
|
7
7
|
* Write YAML output to stdout with document markers
|
|
8
8
|
* @param data - Data to serialize as YAML
|
|
9
9
|
*/
|
|
10
10
|
export function writeYamlOutput(data) {
|
|
11
11
|
process.stdout.write('---\n');
|
|
12
|
-
process.stdout.write(yaml.
|
|
12
|
+
process.stdout.write(yaml.stringify(data, {
|
|
13
13
|
indent: 2,
|
|
14
14
|
lineWidth: 120,
|
|
15
|
-
|
|
15
|
+
aliasDuplicateObjects: false,
|
|
16
16
|
}));
|
|
17
17
|
process.stdout.write('---\n');
|
|
18
18
|
}
|
package/dist/utils/output.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"output.js","sourceRoot":"","sources":["../../src/utils/output.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,IAAI,MAAM,
|
|
1
|
+
{"version":3,"file":"output.js","sourceRoot":"","sources":["../../src/utils/output.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAE7B;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,IAAa;IAC3C,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAC9B,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE;QACxC,MAAM,EAAE,CAAC;QACT,SAAS,EAAE,GAAG;QACd,qBAAqB,EAAE,KAAK;KAC7B,CAAC,CAAC,CAAC;IACJ,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;AAChC,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW;IAC/B,OAAO,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE;QACnC,IAAI,OAAO,CAAC,MAAM,CAAC,iBAAiB,EAAE,CAAC;YACrC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACxC,CAAC;aAAM,CAAC;YACN,OAAO,EAAE,CAAC;QACZ,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,oBAAoB,CAClC,IAAY,EACZ,IAAY,EACZ,MAAc,EACd,OAAe;IAEf,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,IAAI,IAAI,IAAI,MAAM,KAAK,OAAO,IAAI,CAAC,CAAC;AAClE,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI-boundary policy helpers for projectRoot resolution.
|
|
3
|
+
*
|
|
4
|
+
* Per docs/superpowers/specs/2026-05-17-root-model-and-leading-slash-design.md §7,
|
|
5
|
+
* each command picks one of these to fulfill its declared policy:
|
|
6
|
+
*
|
|
7
|
+
* - `required` → {@link requireProjectRoot} — fails fast with a clear message.
|
|
8
|
+
* - `loud-cwd` → {@link projectRootOrLoudCwd} — falls back to cwd with a stderr warning.
|
|
9
|
+
* - `tolerate null`→ {@link projectRootOrNull} — returns null; caller handles it.
|
|
10
|
+
*
|
|
11
|
+
* These helpers MUST be invoked at the CLI dispatch boundary (top-level command
|
|
12
|
+
* `.action(...)` callbacks). Inner library functions should take the resolved
|
|
13
|
+
* root as a parameter — never call `findProjectRoot` themselves.
|
|
14
|
+
*/
|
|
15
|
+
import type { Logger } from './logger.js';
|
|
16
|
+
/**
|
|
17
|
+
* `required` policy — refuse to run if no projectRoot can be discovered.
|
|
18
|
+
*
|
|
19
|
+
* @throws Error with a clear "command requires a config or git ancestor" message.
|
|
20
|
+
*/
|
|
21
|
+
export declare function requireProjectRoot(startDir: string, commandName: string): string;
|
|
22
|
+
/**
|
|
23
|
+
* `loud-cwd` policy — fall back to cwd with an explicit stderr log message.
|
|
24
|
+
*
|
|
25
|
+
* The message format is documented in spec §7 and asserted by integration tests:
|
|
26
|
+
* `no vibe-agent-toolkit.config.yaml or .git/ ancestor found; using <cwd> as projectRoot`
|
|
27
|
+
*/
|
|
28
|
+
export declare function projectRootOrLoudCwd(startDir: string, logger: Logger): string;
|
|
29
|
+
/**
|
|
30
|
+
* `tolerate null` policy — return `string | null`; caller handles either case.
|
|
31
|
+
*/
|
|
32
|
+
export declare function projectRootOrNull(startDir: string): string | null;
|
|
33
|
+
//# sourceMappingURL=project-root-policy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project-root-policy.d.ts","sourceRoot":"","sources":["../../src/utils/project-root-policy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAIH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE1C;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,CAShF;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAQ7E;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAEjE"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI-boundary policy helpers for projectRoot resolution.
|
|
3
|
+
*
|
|
4
|
+
* Per docs/superpowers/specs/2026-05-17-root-model-and-leading-slash-design.md §7,
|
|
5
|
+
* each command picks one of these to fulfill its declared policy:
|
|
6
|
+
*
|
|
7
|
+
* - `required` → {@link requireProjectRoot} — fails fast with a clear message.
|
|
8
|
+
* - `loud-cwd` → {@link projectRootOrLoudCwd} — falls back to cwd with a stderr warning.
|
|
9
|
+
* - `tolerate null`→ {@link projectRootOrNull} — returns null; caller handles it.
|
|
10
|
+
*
|
|
11
|
+
* These helpers MUST be invoked at the CLI dispatch boundary (top-level command
|
|
12
|
+
* `.action(...)` callbacks). Inner library functions should take the resolved
|
|
13
|
+
* root as a parameter — never call `findProjectRoot` themselves.
|
|
14
|
+
*/
|
|
15
|
+
import { findProjectRoot, safePath } from '@vibe-agent-toolkit/utils';
|
|
16
|
+
/**
|
|
17
|
+
* `required` policy — refuse to run if no projectRoot can be discovered.
|
|
18
|
+
*
|
|
19
|
+
* @throws Error with a clear "command requires a config or git ancestor" message.
|
|
20
|
+
*/
|
|
21
|
+
export function requireProjectRoot(startDir, commandName) {
|
|
22
|
+
const root = findProjectRoot(startDir);
|
|
23
|
+
if (root === null) {
|
|
24
|
+
throw new Error(`${commandName} requires a vibe-agent-toolkit.config.yaml or .git/ ancestor. ` +
|
|
25
|
+
`Run from inside a VAT project or initialize one.`);
|
|
26
|
+
}
|
|
27
|
+
return root;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* `loud-cwd` policy — fall back to cwd with an explicit stderr log message.
|
|
31
|
+
*
|
|
32
|
+
* The message format is documented in spec §7 and asserted by integration tests:
|
|
33
|
+
* `no vibe-agent-toolkit.config.yaml or .git/ ancestor found; using <cwd> as projectRoot`
|
|
34
|
+
*/
|
|
35
|
+
export function projectRootOrLoudCwd(startDir, logger) {
|
|
36
|
+
const root = findProjectRoot(startDir);
|
|
37
|
+
if (root !== null)
|
|
38
|
+
return root;
|
|
39
|
+
const cwd = safePath.resolve(startDir);
|
|
40
|
+
logger.warn(`no vibe-agent-toolkit.config.yaml or .git/ ancestor found; using ${cwd} as projectRoot`);
|
|
41
|
+
return cwd;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* `tolerate null` policy — return `string | null`; caller handles either case.
|
|
45
|
+
*/
|
|
46
|
+
export function projectRootOrNull(startDir) {
|
|
47
|
+
return findProjectRoot(startDir);
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=project-root-policy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project-root-policy.js","sourceRoot":"","sources":["../../src/utils/project-root-policy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAItE;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAAC,QAAgB,EAAE,WAAmB;IACtE,MAAM,IAAI,GAAG,eAAe,CAAC,QAAQ,CAAC,CAAC;IACvC,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;QAClB,MAAM,IAAI,KAAK,CACb,GAAG,WAAW,gEAAgE;YAC5E,kDAAkD,CACrD,CAAC;IACJ,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,oBAAoB,CAAC,QAAgB,EAAE,MAAc;IACnE,MAAM,IAAI,GAAG,eAAe,CAAC,QAAQ,CAAC,CAAC;IACvC,IAAI,IAAI,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IAC/B,MAAM,GAAG,GAAG,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IACvC,MAAM,CAAC,IAAI,CACT,oEAAoE,GAAG,iBAAiB,CACzF,CAAC;IACF,OAAO,GAAG,CAAC;AACb,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAC,QAAgB;IAChD,OAAO,eAAe,CAAC,QAAQ,CAAC,CAAC;AACnC,CAAC"}
|
|
@@ -6,7 +6,7 @@ import { GitTracker } from '@vibe-agent-toolkit/utils';
|
|
|
6
6
|
import type { Logger } from './logger.js';
|
|
7
7
|
export interface ResourceLoadResult {
|
|
8
8
|
scanPath: string;
|
|
9
|
-
projectRoot: string
|
|
9
|
+
projectRoot: string;
|
|
10
10
|
config: ProjectConfig | undefined;
|
|
11
11
|
registry: ResourceRegistry;
|
|
12
12
|
gitTracker: GitTracker | undefined;
|
|
@@ -16,16 +16,21 @@ export interface ResourceLoadResult {
|
|
|
16
16
|
*
|
|
17
17
|
* Common pattern for CLI commands that need to:
|
|
18
18
|
* 1. Determine scan path
|
|
19
|
-
* 2.
|
|
19
|
+
* 2. Load config from the pre-resolved project root
|
|
20
20
|
* 3. Create registry and crawl
|
|
21
21
|
*
|
|
22
22
|
* Behavior:
|
|
23
23
|
* - When path argument provided: use as baseDir, ignore config patterns (use defaults)
|
|
24
|
-
* - When no path argument: use project root
|
|
24
|
+
* - When no path argument: use project root as baseDir, apply config patterns
|
|
25
|
+
*
|
|
26
|
+
* Per CLI-boundary rule (spec §5): `projectRoot` MUST be resolved by the
|
|
27
|
+
* caller using one of the policy helpers in `project-root-policy.ts`. This
|
|
28
|
+
* function does not call `findProjectRoot` itself.
|
|
25
29
|
*
|
|
26
30
|
* @param pathArg - Path argument from CLI (optional)
|
|
31
|
+
* @param projectRoot - Pre-resolved project root from the CLI boundary
|
|
27
32
|
* @param logger - Logger instance
|
|
28
33
|
* @returns Resource load result with registry and metadata
|
|
29
34
|
*/
|
|
30
|
-
export declare function loadResourcesWithConfig(pathArg: string | undefined, logger: Logger): Promise<ResourceLoadResult>;
|
|
35
|
+
export declare function loadResourcesWithConfig(pathArg: string | undefined, projectRoot: string, logger: Logger): Promise<ResourceLoadResult>;
|
|
31
36
|
//# sourceMappingURL=resource-loader.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resource-loader.d.ts","sourceRoot":"","sources":["../../src/utils/resource-loader.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACL,gBAAgB,EAChB,KAAK,aAAa,EAEnB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAGvD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"resource-loader.d.ts","sourceRoot":"","sources":["../../src/utils/resource-loader.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACL,gBAAgB,EAChB,KAAK,aAAa,EAEnB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAGvD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE1C,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,aAAa,GAAG,SAAS,CAAC;IAClC,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,UAAU,EAAE,UAAU,GAAG,SAAS,CAAC;CACpC;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAsB,uBAAuB,CAC3C,OAAO,EAAE,MAAM,GAAG,SAAS,EAC3B,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,kBAAkB,CAAC,CA2D7B"}
|
|
@@ -4,50 +4,47 @@
|
|
|
4
4
|
import { ResourceRegistry, } from '@vibe-agent-toolkit/resources';
|
|
5
5
|
import { GitTracker } from '@vibe-agent-toolkit/utils';
|
|
6
6
|
import { loadConfig } from './config-loader.js';
|
|
7
|
-
import { findProjectRoot } from './project-root.js';
|
|
8
7
|
/**
|
|
9
8
|
* Load resources from a path with config support
|
|
10
9
|
*
|
|
11
10
|
* Common pattern for CLI commands that need to:
|
|
12
11
|
* 1. Determine scan path
|
|
13
|
-
* 2.
|
|
12
|
+
* 2. Load config from the pre-resolved project root
|
|
14
13
|
* 3. Create registry and crawl
|
|
15
14
|
*
|
|
16
15
|
* Behavior:
|
|
17
16
|
* - When path argument provided: use as baseDir, ignore config patterns (use defaults)
|
|
18
|
-
* - When no path argument: use project root
|
|
17
|
+
* - When no path argument: use project root as baseDir, apply config patterns
|
|
18
|
+
*
|
|
19
|
+
* Per CLI-boundary rule (spec §5): `projectRoot` MUST be resolved by the
|
|
20
|
+
* caller using one of the policy helpers in `project-root-policy.ts`. This
|
|
21
|
+
* function does not call `findProjectRoot` itself.
|
|
19
22
|
*
|
|
20
23
|
* @param pathArg - Path argument from CLI (optional)
|
|
24
|
+
* @param projectRoot - Pre-resolved project root from the CLI boundary
|
|
21
25
|
* @param logger - Logger instance
|
|
22
26
|
* @returns Resource load result with registry and metadata
|
|
23
27
|
*/
|
|
24
|
-
export async function loadResourcesWithConfig(pathArg, logger) {
|
|
25
|
-
//
|
|
26
|
-
const
|
|
27
|
-
const config = projectRoot ? loadConfig(projectRoot) : undefined;
|
|
28
|
+
export async function loadResourcesWithConfig(pathArg, projectRoot, logger) {
|
|
29
|
+
// Config lookup is anchored at the resolved projectRoot.
|
|
30
|
+
const config = loadConfig(projectRoot);
|
|
28
31
|
if (config) {
|
|
29
|
-
logger.debug(`Loaded config from ${projectRoot
|
|
30
|
-
}
|
|
31
|
-
// Create and initialize GitTracker if we have a project root
|
|
32
|
-
let gitTracker;
|
|
33
|
-
if (projectRoot) {
|
|
34
|
-
gitTracker = new GitTracker(projectRoot);
|
|
35
|
-
await gitTracker.initialize();
|
|
36
|
-
const stats = gitTracker.getStats();
|
|
37
|
-
logger.debug(`GitTracker initialized with ${stats.cacheSize} tracked files`);
|
|
32
|
+
logger.debug(`Loaded config from ${projectRoot}`);
|
|
38
33
|
}
|
|
34
|
+
// Create and initialize GitTracker anchored at the resolved projectRoot.
|
|
35
|
+
const gitTracker = new GitTracker(projectRoot);
|
|
36
|
+
await gitTracker.initialize();
|
|
37
|
+
const stats = gitTracker.getStats();
|
|
38
|
+
logger.debug(`GitTracker initialized with ${stats.cacheSize} tracked files`);
|
|
39
39
|
// Create registry and crawl
|
|
40
40
|
// Build options conditionally to satisfy exactOptionalPropertyTypes
|
|
41
|
-
const registryOptions = {
|
|
41
|
+
const registryOptions = {
|
|
42
|
+
baseDir: projectRoot,
|
|
43
|
+
gitTracker,
|
|
44
|
+
};
|
|
42
45
|
if (config?.resources?.collections) {
|
|
43
46
|
registryOptions.config = config;
|
|
44
47
|
}
|
|
45
|
-
if (projectRoot) {
|
|
46
|
-
registryOptions.baseDir = projectRoot;
|
|
47
|
-
}
|
|
48
|
-
if (gitTracker) {
|
|
49
|
-
registryOptions.gitTracker = gitTracker;
|
|
50
|
-
}
|
|
51
48
|
const registry = new ResourceRegistry(registryOptions);
|
|
52
49
|
let crawlOptions;
|
|
53
50
|
if (pathArg) {
|
|
@@ -61,11 +58,10 @@ export async function loadResourcesWithConfig(pathArg, logger) {
|
|
|
61
58
|
};
|
|
62
59
|
}
|
|
63
60
|
else {
|
|
64
|
-
// No path argument: crawl from
|
|
65
|
-
|
|
66
|
-
logger.debug(`No path argument, using: ${scanPath}`);
|
|
61
|
+
// No path argument: crawl from projectRoot with config patterns
|
|
62
|
+
logger.debug(`No path argument, using: ${projectRoot}`);
|
|
67
63
|
crawlOptions = {
|
|
68
|
-
baseDir:
|
|
64
|
+
baseDir: projectRoot,
|
|
69
65
|
// Apply include patterns from config (if specified)
|
|
70
66
|
...(config?.resources?.include ? { include: config.resources.include } : {}),
|
|
71
67
|
// Apply exclude patterns from config (if specified)
|
|
@@ -74,7 +70,7 @@ export async function loadResourcesWithConfig(pathArg, logger) {
|
|
|
74
70
|
}
|
|
75
71
|
await registry.crawl(crawlOptions);
|
|
76
72
|
return {
|
|
77
|
-
scanPath: pathArg ??
|
|
73
|
+
scanPath: pathArg ?? projectRoot,
|
|
78
74
|
projectRoot,
|
|
79
75
|
config,
|
|
80
76
|
registry,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resource-loader.js","sourceRoot":"","sources":["../../src/utils/resource-loader.ts"],"names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,CAAC,CAAC;IAEvD,IAAI,YAAY,CAAC;IAEjB,IAAI,OAAO,EAAE,CAAC;QACZ,0EAA0E;QAC1E,kEAAkE;QAClE,MAAM,CAAC,KAAK,CAAC,2BAA2B,OAAO,EAAE,CAAC,CAAC;QACnD,MAAM,CAAC,KAAK,CAAC,0CAA0C,CAAC,CAAC;QAEzD,YAAY,GAAG;YACb,OAAO,EAAE,OAAO;YAChB,8DAA8D;SAC/D,CAAC;IACJ,CAAC;SAAM,CAAC;QACN,gEAAgE;QAChE,MAAM,CAAC,KAAK,CAAC,4BAA4B,WAAW,EAAE,CAAC,CAAC;QAExD,YAAY,GAAG;YACb,OAAO,EAAE,WAAW;YACpB,oDAAoD;YACpD,GAAG,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAC5E,oDAAoD;YACpD,GAAG,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAC7E,CAAC;IACJ,CAAC;IAED,MAAM,QAAQ,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;IAEnC,OAAO;QACL,QAAQ,EAAE,OAAO,IAAI,WAAW;QAChC,WAAW;QACX,MAAM;QACN,QAAQ;QACR,UAAU;KACX,CAAC;AACJ,CAAC"}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { existsSync } from 'node:fs';
|
|
9
9
|
import { dirname } from 'node:path';
|
|
10
|
-
import { fileURLToPath } from 'node:url';
|
|
10
|
+
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
11
11
|
import { safePath } from '@vibe-agent-toolkit/utils';
|
|
12
12
|
/**
|
|
13
13
|
* Required help documentation files
|
|
@@ -47,7 +47,7 @@ export function validateHelpFiles() {
|
|
|
47
47
|
* Run validation if this file is executed directly
|
|
48
48
|
* (via tsx or node during build process)
|
|
49
49
|
*/
|
|
50
|
-
if (import.meta.url ===
|
|
50
|
+
if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {
|
|
51
51
|
try {
|
|
52
52
|
validateHelpFiles();
|
|
53
53
|
console.log('✓ All required help documentation files exist');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate-help-files.js","sourceRoot":"","sources":["../../src/utils/validate-help-files.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"validate-help-files.js","sourceRoot":"","sources":["../../src/utils/validate-help-files.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAExD,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAErD;;;GAGG;AACH,MAAM,mBAAmB,GAAG;IAC1B,UAAU,EAAO,iDAAiD;IAClE,cAAc,EAAG,kEAAkE;IACnF,QAAQ,EAAS,sDAAsD;IACvE,UAAU,EAAO,0DAA0D;CACnE,CAAC;AAEX;;;;GAIG;AACH,MAAM,UAAU,iBAAiB;IAC/B,MAAM,SAAS,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IAC1D,MAAM,WAAW,GAAG,QAAQ,CAAC,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IACtD,MAAM,OAAO,G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
package/docs/agent.md
CHANGED
|
@@ -93,6 +93,31 @@ vat agent validate ./my-custom-agent/agent.yaml
|
|
|
93
93
|
- `OPENAI_API_KEY` - API key for OpenAI
|
|
94
94
|
- `GOOGLE_API_KEY` - API key for Google (Gemini)
|
|
95
95
|
|
|
96
|
+
## Requirements
|
|
97
|
+
|
|
98
|
+
Each `vat agent` subcommand declares its own `projectRoot` and config policy:
|
|
99
|
+
|
|
100
|
+
| Subcommand | `projectRoot` | Config |
|
|
101
|
+
|---|---|---|
|
|
102
|
+
| `vat agent list` | optional (tolerates absence) | not used |
|
|
103
|
+
| `vat agent installed` | N/A | not used |
|
|
104
|
+
| `vat agent build <pathOrName>` | required (errors without `vibe-agent-toolkit.config.yaml` or `.git/` ancestor) | required file with `agents.*` fields populated |
|
|
105
|
+
| `vat agent run <pathOrName> <input>` | optional (path-explicit; tolerates absence) | optional (uses defaults if absent) |
|
|
106
|
+
| `vat agent validate <pathOrName>` | required | optional (uses defaults if absent) |
|
|
107
|
+
| `vat agent import <skillPath>` | N/A | not used |
|
|
108
|
+
| `vat agent install <agentName>` | N/A | not used |
|
|
109
|
+
| `vat agent uninstall <agentName>` | N/A | not used |
|
|
110
|
+
|
|
111
|
+
**Why `build` and `validate` require `projectRoot`:** both are explicit-adoption
|
|
112
|
+
operations. Building or source-validating an agent without an authoring
|
|
113
|
+
boundary would silently accept arbitrary trees as "the project" and would not
|
|
114
|
+
participate in the unified validation framework. `vat agent run` is
|
|
115
|
+
path-explicit and runs from anywhere; `vat agent list` discovers without
|
|
116
|
+
needing a project context.
|
|
117
|
+
|
|
118
|
+
See [Roots and Config — Canonical Concepts](../../../docs/concepts/roots-and-config.md)
|
|
119
|
+
for terminology.
|
|
120
|
+
|
|
96
121
|
## See Also
|
|
97
122
|
|
|
98
123
|
- [@vibe-agent-toolkit/agent-schema](../../agent-schema/README.md) - Schema reference
|
package/docs/audit.md
CHANGED
|
@@ -555,6 +555,31 @@ Windows users: Use forward slashes even on Windows - they work correctly in Node
|
|
|
555
555
|
|
|
556
556
|
SKILL.md files can use any line ending (LF, CRLF) - the parser handles both.
|
|
557
557
|
|
|
558
|
+
## Requirements
|
|
559
|
+
|
|
560
|
+
`vat audit` has an unusual policy because it operates on per-skill
|
|
561
|
+
governing context rather than a single top-level `projectRoot`:
|
|
562
|
+
|
|
563
|
+
- **`projectRoot`**: per-skill walk-up. There is no single `projectRoot` for an
|
|
564
|
+
audit run. Each `SKILL.md` discovered during scanning walks up to its own
|
|
565
|
+
nearest `vibe-agent-toolkit.config.yaml`-or-`.git/` ancestor and uses that as
|
|
566
|
+
*its* `projectRoot`. Skills with no governing config or git ancestor are
|
|
567
|
+
reported as ungoverned (an audit finding, not a fatal error). This lets `vat
|
|
568
|
+
audit` work on external community trees, downloaded plugin bundles, and
|
|
569
|
+
monorepos with multiple sub-package configs.
|
|
570
|
+
- **Config**: accept defaults. Per-skill `validation.severity` and
|
|
571
|
+
`validation.allow` overrides come from whichever
|
|
572
|
+
`vibe-agent-toolkit.config.yaml` each skill walks up to. The audit itself
|
|
573
|
+
always exits 0 (advisory) regardless of severity outcomes.
|
|
574
|
+
|
|
575
|
+
The per-skill walk-up is cached via a module-level two-layer cache and pre-warmed
|
|
576
|
+
during top-down descent for efficiency on large trees.
|
|
577
|
+
|
|
578
|
+
See [Roots and Config — Canonical Concepts](../../../docs/concepts/roots-and-config.md)
|
|
579
|
+
for the `projectRoot` ladder and the audit walk-up model. See
|
|
580
|
+
[`docs/skill-quality-and-compatibility.md`](../../../docs/skill-quality-and-compatibility.md)
|
|
581
|
+
for VAT's advisory-audit stance.
|
|
582
|
+
|
|
558
583
|
## Related Commands
|
|
559
584
|
|
|
560
585
|
- `vat agent audit <path>` - Legacy skill-only audit (deprecated)
|
package/docs/doctor.md
CHANGED
|
@@ -260,6 +260,19 @@ fi
|
|
|
260
260
|
- **Skipped:** When running installed VAT globally
|
|
261
261
|
- **Fix:** Run `bun run build` in VAT source directory
|
|
262
262
|
|
|
263
|
+
## Requirements
|
|
264
|
+
|
|
265
|
+
- **`projectRoot`**: optional. `vat doctor` tolerates a missing `projectRoot`
|
|
266
|
+
and reports its absence as a diagnostic finding rather than refusing to run.
|
|
267
|
+
This is by design: doctor is the command users invoke when they suspect their
|
|
268
|
+
setup is wrong, so it must run anywhere.
|
|
269
|
+
- **Config**: not used as input. Doctor checks whether a config file *exists*
|
|
270
|
+
and parses as a finding, but it does not consume config fields to drive its
|
|
271
|
+
behavior.
|
|
272
|
+
|
|
273
|
+
See [Roots and Config — Canonical Concepts](../../../docs/concepts/roots-and-config.md)
|
|
274
|
+
for terminology.
|
|
275
|
+
|
|
263
276
|
## Tips
|
|
264
277
|
|
|
265
278
|
- Run `vat doctor` before reporting issues to verify environment
|
package/docs/index.md
CHANGED
|
@@ -332,6 +332,25 @@ The `vat` wrapper automatically detects your execution context:
|
|
|
332
332
|
When running global `vat` from within the toolkit repository, it automatically
|
|
333
333
|
switches to dev mode and shows the `-dev` suffix.
|
|
334
334
|
|
|
335
|
+
## Requirements
|
|
336
|
+
|
|
337
|
+
Every VAT command declares a `projectRoot` policy and a config policy. The
|
|
338
|
+
short version:
|
|
339
|
+
|
|
340
|
+
- **`projectRoot` = the VAT authoring boundary.** Discovered as: nearest
|
|
341
|
+
`vibe-agent-toolkit.config.yaml` → else nearest `.git/` → else `null`.
|
|
342
|
+
- **Per-command policy varies.** Some commands require it (`vat skills build`,
|
|
343
|
+
`vat agent build`, `vat build`, `vat verify`). Some tolerate its absence
|
|
344
|
+
(`vat skills validate --user`, `vat agent list`, `vat rag *` with `--db`).
|
|
345
|
+
Some have a **loud-cwd fallback** that warns to stderr and continues
|
|
346
|
+
(`vat resources scan`, `vat resources validate`).
|
|
347
|
+
- **`vat audit` is special:** there is no single `projectRoot`; each scanned
|
|
348
|
+
skill walks up to its own governing context.
|
|
349
|
+
|
|
350
|
+
Every command's `--help` output includes a `Requirements:` section declaring
|
|
351
|
+
its policy. The full matrix and rationale live in
|
|
352
|
+
[Roots and Config — Canonical Concepts](../../../docs/concepts/roots-and-config.md).
|
|
353
|
+
|
|
335
354
|
## Configuration
|
|
336
355
|
|
|
337
356
|
Place `vibe-agent-toolkit.config.yaml` at project root:
|
package/docs/mcp.md
CHANGED
|
@@ -310,6 +310,22 @@ All implementations must:
|
|
|
310
310
|
|
|
311
311
|
See [MCP Gateway README](../../gateway-mcp/README.md) for planned features.
|
|
312
312
|
|
|
313
|
+
## Requirements
|
|
314
|
+
|
|
315
|
+
Both MCP subcommands run as server / discovery operations and do not consume a
|
|
316
|
+
VAT authoring context:
|
|
317
|
+
|
|
318
|
+
- **`vat mcp list-collections`**
|
|
319
|
+
- **`projectRoot`**: N/A.
|
|
320
|
+
- **Config**: not used.
|
|
321
|
+
- **`vat mcp serve <package>`**
|
|
322
|
+
- **`projectRoot`**: N/A. The server resolves `<package>` from `node_modules`
|
|
323
|
+
or an explicit path; project context is not needed.
|
|
324
|
+
- **Config**: not used.
|
|
325
|
+
|
|
326
|
+
See [Roots and Config — Canonical Concepts](../../../docs/concepts/roots-and-config.md)
|
|
327
|
+
for terminology.
|
|
328
|
+
|
|
313
329
|
## See Also
|
|
314
330
|
|
|
315
331
|
- [MCP Gateway README](../../gateway-mcp/README.md)
|