@vibe-agent-toolkit/cli 0.1.41-rc.7 → 0.1.41
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/dist/bin/vat +24 -1
- package/dist/bin/vat.js +24 -1
- package/dist/bin/vat.js.map +1 -1
- package/dist/bin.js +23 -2
- package/dist/bin.js.map +1 -1
- package/dist/commands/agent/list.d.ts +11 -0
- package/dist/commands/agent/list.d.ts.map +1 -1
- package/dist/commands/agent/list.js +30 -11
- package/dist/commands/agent/list.js.map +1 -1
- package/dist/commands/audit/distributed-tree.d.ts +172 -0
- package/dist/commands/audit/distributed-tree.d.ts.map +1 -0
- package/dist/commands/audit/distributed-tree.js +319 -0
- package/dist/commands/audit/distributed-tree.js.map +1 -0
- package/dist/commands/audit.d.ts +69 -1
- package/dist/commands/audit.d.ts.map +1 -1
- package/dist/commands/audit.js +525 -174
- package/dist/commands/audit.js.map +1 -1
- package/dist/commands/build.d.ts +14 -0
- package/dist/commands/build.d.ts.map +1 -1
- package/dist/commands/build.js +103 -26
- package/dist/commands/build.js.map +1 -1
- package/dist/commands/claude/marketplace/git-publish.d.ts.map +1 -1
- package/dist/commands/claude/marketplace/git-publish.js +21 -3
- package/dist/commands/claude/marketplace/git-publish.js.map +1 -1
- package/dist/commands/claude/marketplace/validate.d.ts +125 -0
- package/dist/commands/claude/marketplace/validate.d.ts.map +1 -1
- package/dist/commands/claude/marketplace/validate.js +251 -44
- package/dist/commands/claude/marketplace/validate.js.map +1 -1
- package/dist/commands/claude/org/stubs.d.ts +9 -1
- package/dist/commands/claude/org/stubs.d.ts.map +1 -1
- package/dist/commands/claude/org/stubs.js +11 -3
- package/dist/commands/claude/org/stubs.js.map +1 -1
- package/dist/commands/claude/plugin/build.d.ts +34 -4
- package/dist/commands/claude/plugin/build.d.ts.map +1 -1
- package/dist/commands/claude/plugin/build.js +187 -16
- package/dist/commands/claude/plugin/build.js.map +1 -1
- package/dist/commands/claude/plugin/plugin-files.d.ts.map +1 -1
- package/dist/commands/claude/plugin/plugin-files.js +6 -2
- package/dist/commands/claude/plugin/plugin-files.js.map +1 -1
- package/dist/commands/claude/plugin/plugin-json-merge.d.ts.map +1 -1
- package/dist/commands/claude/plugin/plugin-json-merge.js +15 -0
- package/dist/commands/claude/plugin/plugin-json-merge.js.map +1 -1
- package/dist/commands/claude/plugin/tree-copy.d.ts +40 -0
- package/dist/commands/claude/plugin/tree-copy.d.ts.map +1 -1
- package/dist/commands/claude/plugin/tree-copy.js +100 -4
- package/dist/commands/claude/plugin/tree-copy.js.map +1 -1
- package/dist/commands/corpus/report.d.ts +22 -4
- package/dist/commands/corpus/report.d.ts.map +1 -1
- package/dist/commands/corpus/report.js +1 -0
- package/dist/commands/corpus/report.js.map +1 -1
- package/dist/commands/corpus/runner.d.ts +16 -1
- package/dist/commands/corpus/runner.d.ts.map +1 -1
- package/dist/commands/corpus/runner.js +40 -22
- package/dist/commands/corpus/runner.js.map +1 -1
- package/dist/commands/doctor.js +1 -1
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/inventory.d.ts +2 -0
- package/dist/commands/inventory.d.ts.map +1 -1
- package/dist/commands/inventory.js +45 -4
- package/dist/commands/inventory.js.map +1 -1
- package/dist/commands/phase-utils.d.ts +183 -14
- package/dist/commands/phase-utils.d.ts.map +1 -1
- package/dist/commands/phase-utils.js +294 -29
- package/dist/commands/phase-utils.js.map +1 -1
- package/dist/commands/positional-args.d.ts +36 -0
- package/dist/commands/positional-args.d.ts.map +1 -0
- package/dist/commands/positional-args.js +52 -0
- package/dist/commands/positional-args.js.map +1 -0
- package/dist/commands/rag/query-command.d.ts +40 -0
- package/dist/commands/rag/query-command.d.ts.map +1 -1
- package/dist/commands/rag/query-command.js +47 -20
- package/dist/commands/rag/query-command.js.map +1 -1
- package/dist/commands/resources/index.d.ts.map +1 -1
- package/dist/commands/resources/index.js +27 -9
- package/dist/commands/resources/index.js.map +1 -1
- package/dist/commands/resources/scan.d.ts +37 -0
- package/dist/commands/resources/scan.d.ts.map +1 -1
- package/dist/commands/resources/scan.js +47 -32
- package/dist/commands/resources/scan.js.map +1 -1
- package/dist/commands/resources/validate.d.ts +136 -1
- package/dist/commands/resources/validate.d.ts.map +1 -1
- package/dist/commands/resources/validate.js +105 -66
- package/dist/commands/resources/validate.js.map +1 -1
- package/dist/commands/skill/review-checklist.d.ts.map +1 -1
- package/dist/commands/skill/review-checklist.js +5 -0
- package/dist/commands/skill/review-checklist.js.map +1 -1
- package/dist/commands/skill/review.d.ts.map +1 -1
- package/dist/commands/skill/review.js +7 -3
- package/dist/commands/skill/review.js.map +1 -1
- package/dist/commands/skill/test/run.d.ts +1 -1
- package/dist/commands/skill/test/run.d.ts.map +1 -1
- package/dist/commands/skill/test/run.js +8 -6
- package/dist/commands/skill/test/run.js.map +1 -1
- package/dist/commands/skills/build.d.ts +349 -11
- package/dist/commands/skills/build.d.ts.map +1 -1
- package/dist/commands/skills/build.js +901 -97
- package/dist/commands/skills/build.js.map +1 -1
- package/dist/commands/skills/command-helpers.d.ts +6 -10
- package/dist/commands/skills/command-helpers.d.ts.map +1 -1
- package/dist/commands/skills/command-helpers.js +6 -22
- package/dist/commands/skills/command-helpers.js.map +1 -1
- package/dist/commands/skills/list.d.ts +18 -0
- package/dist/commands/skills/list.d.ts.map +1 -1
- package/dist/commands/skills/list.js +41 -15
- package/dist/commands/skills/list.js.map +1 -1
- package/dist/commands/skills/package.d.ts +15 -0
- package/dist/commands/skills/package.d.ts.map +1 -1
- package/dist/commands/skills/package.js +30 -20
- package/dist/commands/skills/package.js.map +1 -1
- package/dist/commands/skills/scope-guard.d.ts +64 -0
- package/dist/commands/skills/scope-guard.d.ts.map +1 -0
- package/dist/commands/skills/scope-guard.js +86 -0
- package/dist/commands/skills/scope-guard.js.map +1 -0
- package/dist/commands/skills/validate-command.d.ts.map +1 -1
- package/dist/commands/skills/validate-command.js +41 -7
- package/dist/commands/skills/validate-command.js.map +1 -1
- package/dist/commands/skills/validate.d.ts +44 -3
- package/dist/commands/skills/validate.d.ts.map +1 -1
- package/dist/commands/skills/validate.js +217 -53
- package/dist/commands/skills/validate.js.map +1 -1
- package/dist/commands/validate.d.ts +18 -0
- package/dist/commands/validate.d.ts.map +1 -1
- package/dist/commands/validate.js +89 -68
- package/dist/commands/validate.js.map +1 -1
- package/dist/commands/verify.d.ts +113 -6
- package/dist/commands/verify.d.ts.map +1 -1
- package/dist/commands/verify.js +440 -123
- package/dist/commands/verify.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -1
- package/dist/index.js.map +1 -1
- package/dist/skill-resolution/index.d.ts +1 -1
- package/dist/skill-resolution/index.d.ts.map +1 -1
- package/dist/skill-resolution/index.js +1 -1
- package/dist/skill-resolution/index.js.map +1 -1
- package/dist/skill-resolution/packaging-config.d.ts +15 -2
- package/dist/skill-resolution/packaging-config.d.ts.map +1 -1
- package/dist/skill-resolution/packaging-config.js +39 -2
- package/dist/skill-resolution/packaging-config.js.map +1 -1
- package/dist/utils/command-error.d.ts +34 -1
- package/dist/utils/command-error.d.ts.map +1 -1
- package/dist/utils/command-error.js +32 -1
- package/dist/utils/command-error.js.map +1 -1
- package/dist/utils/help-loader.d.ts +6 -2
- package/dist/utils/help-loader.d.ts.map +1 -1
- package/dist/utils/help-loader.js +9 -16
- package/dist/utils/help-loader.js.map +1 -1
- package/dist/utils/issue-rendering.d.ts +130 -0
- package/dist/utils/issue-rendering.d.ts.map +1 -1
- package/dist/utils/issue-rendering.js +147 -0
- package/dist/utils/issue-rendering.js.map +1 -1
- package/dist/utils/issue-severity.d.ts +51 -0
- package/dist/utils/issue-severity.d.ts.map +1 -0
- package/dist/utils/issue-severity.js +63 -0
- package/dist/utils/issue-severity.js.map +1 -0
- package/dist/utils/output.d.ts +54 -5
- package/dist/utils/output.d.ts.map +1 -1
- package/dist/utils/output.js +111 -17
- package/dist/utils/output.js.map +1 -1
- package/dist/utils/relativize-paths.d.ts +45 -0
- package/dist/utils/relativize-paths.d.ts.map +1 -0
- package/dist/utils/relativize-paths.js +67 -0
- package/dist/utils/relativize-paths.js.map +1 -0
- package/dist/utils/resource-loader.d.ts +21 -2
- package/dist/utils/resource-loader.d.ts.map +1 -1
- package/dist/utils/resource-loader.js +85 -11
- package/dist/utils/resource-loader.js.map +1 -1
- package/dist/utils/skill-packaging-config.d.ts +22 -1
- package/dist/utils/skill-packaging-config.d.ts.map +1 -1
- package/dist/utils/skill-packaging-config.js +26 -0
- package/dist/utils/skill-packaging-config.js.map +1 -1
- package/dist/utils/verdict-helpers.d.ts +4 -3
- package/dist/utils/verdict-helpers.d.ts.map +1 -1
- package/dist/utils/verdict-helpers.js +6 -13
- package/dist/utils/verdict-helpers.js.map +1 -1
- package/dist/version.d.ts +22 -2
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +31 -2
- package/dist/version.js.map +1 -1
- package/docs/index.md +12 -0
- package/docs/rag.md +9 -4
- package/docs/resources.md +30 -14
- package/docs/skills.md +25 -7
- package/package.json +12 -12
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query-command.js","sourceRoot":"","sources":["../../../src/commands/rag/query-command.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"query-command.js","sourceRoot":"","sources":["../../../src/commands/rag/query-command.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAErD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AACvE,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAEjE,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAsC3E;;;;;;;;;;GAUG;AACH,MAAM,UAAU,oBAAoB,CAAC,KAAwB;IAC3D,MAAM,EAAE,S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AAO,WAAW,CAAC;IACrB,CAAC,EACD,OAAO,CACR,CAAC;IAEF,6EAA6E;IAC7E,6EAA6E;IAC7E,sDAAsD;IACtD,MAAM,IAAI,GAAG,iBAAiB,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,IAAI,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IAEjF,eAAe,CACb,oBAAoB,CAAC;QACnB,SAAS;QACT,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,KAAK,EAAE,MAAM,CAAC,KAAK;QACnB,UAAU,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS;QAClC,IAAI;KACL,CAAC,CACH,CAAC;IAEF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/resources/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKpC,wBAAgB,sBAAsB,IAAI,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/resources/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKpC,wBAAgB,sBAAsB,IAAI,OAAO,CAgPhD;AAED,OAAO,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC"}
|
|
@@ -28,8 +28,9 @@ Description:
|
|
|
28
28
|
Scans for markdown files and reports statistics. Outputs YAML to stdout.
|
|
29
29
|
|
|
30
30
|
Path Argument Behavior:
|
|
31
|
-
WITH path: Scans all *.md recursively under path
|
|
32
|
-
|
|
31
|
+
WITH path: Scans all *.md/*.html recursively under path, still applying the
|
|
32
|
+
config's resources.exclude patterns
|
|
33
|
+
WITHOUT path: Uses vibe-agent-toolkit.config.yaml include + exclude patterns
|
|
33
34
|
|
|
34
35
|
Filtering:
|
|
35
36
|
--collection <id>: Only scan files in specified collection
|
|
@@ -55,6 +56,7 @@ Examples:
|
|
|
55
56
|
.command('validate [path]')
|
|
56
57
|
.description('Validate markdown resources (link integrity, anchors)')
|
|
57
58
|
.option('--debug', 'Enable debug logging')
|
|
59
|
+
.option('-v, --verbose', 'Show all scanned resources, including those without issues')
|
|
58
60
|
.option('--frontmatter-schema <path>', 'Validate frontmatter against JSON Schema file (.json or .yaml)')
|
|
59
61
|
.option('--validation-mode <mode>', 'Validation mode for schemas: strict (default) or permissive', 'strict')
|
|
60
62
|
.option('--format <format>', 'Output format: yaml (default), json, or text', 'yaml')
|
|
@@ -72,19 +74,21 @@ Path Argument Behavior:
|
|
|
72
74
|
|
|
73
75
|
WITH path argument (e.g., "vat resources validate docs/"):
|
|
74
76
|
• Scans all *.md files recursively under the specified directory
|
|
75
|
-
•
|
|
76
|
-
•
|
|
77
|
+
• The path REPLACES the config's resources.include patterns...
|
|
78
|
+
• ...but resources.exclude STILL APPLIES, so a path run never scans
|
|
79
|
+
build output, vendored trees, or test fixtures the project excluded
|
|
77
80
|
• Use for: Quick validation of a specific directory tree
|
|
78
81
|
|
|
79
82
|
WITHOUT path argument (e.g., "vat resources validate"):
|
|
80
83
|
• Uses vibe-agent-toolkit.config.yaml to determine files to scan
|
|
81
|
-
• Applies include
|
|
84
|
+
• Applies include AND exclude patterns from config
|
|
82
85
|
• SHOWS collection statistics and per-collection validation rules
|
|
83
86
|
• Validates frontmatter against collection-specific schemas (if configured)
|
|
84
87
|
• Use for: Full project validation with collection-aware rules
|
|
85
88
|
|
|
86
|
-
|
|
87
|
-
|
|
89
|
+
Collections apply in both modes — membership is decided per file against the
|
|
90
|
+
collection's own patterns, so a path run still gets collection-specific
|
|
91
|
+
schemas for whatever it scanned.
|
|
88
92
|
|
|
89
93
|
Filtering:
|
|
90
94
|
--collection <id>: Only validate files in specified collection
|
|
@@ -109,13 +113,27 @@ Output Fields (issues found):
|
|
|
109
113
|
A field named error* counts ERROR-severity issues only — the ones that fail
|
|
110
114
|
the run. A field named issue* counts issues of every severity.
|
|
111
115
|
|
|
112
|
-
status
|
|
116
|
+
status: success | warning | error — the worst ACTIONABLE severity found, the
|
|
117
|
+
same vocabulary every other vat validation lane reports. An info-only
|
|
118
|
+
run is success; issueCounts below says what was actually seen.
|
|
119
|
+
filesScanned, durationSecs
|
|
113
120
|
errorsFound: Count of error-severity issues (drives the exit code)
|
|
114
121
|
filesWithErrors: Files carrying at least one error-severity issue
|
|
115
122
|
issueCounts: {errors, warnings, info} — every issue, split by severity
|
|
116
123
|
issueSummary: Count of each issue code, ALL severities
|
|
117
124
|
collections: Per-collection stats including filesWithErrors, errorCount
|
|
118
|
-
issues:
|
|
125
|
+
issues: One row per file with findings, carrying only that file's counts
|
|
126
|
+
({file, errors?, warnings?, info?, codes}). A zero bucket is omitted,
|
|
127
|
+
and a file that emitted nothing has no row — filesScanned above stays
|
|
128
|
+
the true denominator.
|
|
129
|
+
|
|
130
|
+
Verbosity:
|
|
131
|
+
-v, --verbose
|
|
132
|
+
Replaces each file's counts row with its per-issue detail (line, column,
|
|
133
|
+
code, severity, message) — the pre-summary shape. That form is for
|
|
134
|
+
'> file' then grep, not for reading. Every other field above is a total
|
|
135
|
+
about the run and is identical in both modes.
|
|
136
|
+
--format text is unaffected: it already prints one line per issue.
|
|
119
137
|
|
|
120
138
|
Validation Checks:
|
|
121
139
|
- Internal file links (relative paths)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/resources/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAEhD,MAAM,UAAU,sBAAsB;IACpC,MAAM,SAAS,GAAG,IAAI,OAAO,C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OAAO,CAAC,iBAAiB,CAAC;SAC1B,WAAW,CAAC,uDAAuD,CAAC;SACpE,MAAM,CAAC,SAAS,EAAE,sBAAsB,CAAC;SACzC,MAAM,CAAC,eAAe,EAAE,4DAA4D,CAAC;SACrF,MAAM,CAAC,6BAA6B,EAAE,gEAAgE,CAAC;SACvG,MAAM,CAAC,0BAA0B,EAAE,6DAA6D,EAAE,QAAQ,CAAC;SAC3G,MAAM,CAAC,mBAAmB,EAAE,8CAA8C,EAAE,MAAM,CAAC;SACnF,MAAM,CAAC,mBAAmB,EAAE,yBAAyB,CAAC;SACtD,MAAM,CAAC,uBAAuB,EAAE,yDAAyD,CAAC;SAC1F,MAAM,CAAC,sBAAsB,EAAE,8HAA8H,CAAC;SAC9J,MAAM,CAAC,YAAY,EAAE,iEAAiE,CAAC;SACvF,MAAM,CAAC,8BAA8B,EAAE,0FAA0F,CAAC;SAClI,MAAM,CAAC,eAAe,CAAC;SACvB,WAAW,CACV,OAAO,EACP;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmKL,CACI,CAAC;IAEJ,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,OAAO,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC"}
|
|
@@ -6,6 +6,43 @@ interface ScanOptions {
|
|
|
6
6
|
verbose?: boolean;
|
|
7
7
|
collection?: string;
|
|
8
8
|
}
|
|
9
|
+
/** A heading node, which may nest further headings beneath it. */
|
|
10
|
+
type HeadingWithChildren = {
|
|
11
|
+
children?: HeadingWithChildren[] | undefined;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* The slice of a registry resource this payload reports on.
|
|
15
|
+
*
|
|
16
|
+
* Structural rather than the full `ResourceMetadata` so the builder can be
|
|
17
|
+
* exercised with a literal, which is what keeps the payload's shape — field
|
|
18
|
+
* names included — under unit test rather than only under a CLI spawn.
|
|
19
|
+
*/
|
|
20
|
+
interface ScanResource {
|
|
21
|
+
filePath: string;
|
|
22
|
+
links: readonly unknown[];
|
|
23
|
+
headings: HeadingWithChildren[];
|
|
24
|
+
checksum: string;
|
|
25
|
+
}
|
|
26
|
+
export interface ScanPayloadInput {
|
|
27
|
+
resources: readonly ScanResource[];
|
|
28
|
+
/** The stated root: the ONE base every reported `path` is relative to. */
|
|
29
|
+
root: string;
|
|
30
|
+
durationMs: number;
|
|
31
|
+
collections: Record<string, {
|
|
32
|
+
resourceCount: number;
|
|
33
|
+
}> | undefined;
|
|
34
|
+
verbose: boolean;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Build the scan payload.
|
|
38
|
+
*
|
|
39
|
+
* Pure: no file system, no clock, no `process.exit`. The registry keeps
|
|
40
|
+
* absolute `filePath`s because that is the identity it keys on; re-basing onto
|
|
41
|
+
* the stated root happens exactly once, here, at the document boundary — the
|
|
42
|
+
* same contract `vat audit` follows. A payload of `$HOME`-absolute paths names
|
|
43
|
+
* the machine it ran on and cannot be diffed across two checkouts.
|
|
44
|
+
*/
|
|
45
|
+
export declare function buildScanOutputData(input: ScanPayloadInput): Record<string, unknown>;
|
|
9
46
|
export declare function scanCommand(pathArg: string | undefined, options: ScanOptions): Promise<void>;
|
|
10
47
|
export {};
|
|
11
48
|
//# sourceMappingURL=scan.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scan.d.ts","sourceRoot":"","sources":["../../../src/commands/resources/scan.ts"],"names":[],"mappings":"AAAA;;GAEG;
|
|
1
|
+
{"version":3,"file":"scan.d.ts","sourceRoot":"","sources":["../../../src/commands/resources/scan.ts"],"names":[],"mappings":"AAAA;;GAEG;AAWH,UAAU,WAAW;IACnB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,kEAAkE;AAClE,KAAK,mBAAmB,GAAG;IAAE,QAAQ,CAAC,EAAE,mBAAmB,EAAE,GAAG,SAAS,CAAA;CAAE,CAAC;AAE5E;;;;;;GAMG;AACH,UAAU,YAAY;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,SAAS,OAAO,EAAE,CAAC;IAC1B,QAAQ,EAAE,mBAAmB,EAAE,CAAC;IAChC,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,SAAS,YAAY,EAAE,CAAC;IACnC,0EAA0E;IAC1E,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,aAAa,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG,SAAS,CAAC;IACnE,OAAO,EAAE,OAAO,CAAC;CAClB;AAaD;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAqBpF;AAED,wBAAsB,WAAW,CAC/B,OAAO,EAAE,MAAM,GAAG,SAAS,EAC3B,OAAO,EAAE,WAAW,GACnB,OAAO,CAAC,IAAI,CAAC,CAoDf"}
|
|
@@ -5,8 +5,48 @@ import { formatDurationSecs } from '../../utils/duration.js';
|
|
|
5
5
|
import { createLogger } from '../../utils/logger.js';
|
|
6
6
|
import { writeYamlOutput } from '../../utils/output.js';
|
|
7
7
|
import { projectRootOrLoudCwd } from '../../utils/project-root-policy.js';
|
|
8
|
+
import { relativizePathEntries } from '../../utils/relativize-paths.js';
|
|
8
9
|
import { loadResourcesWithConfig } from '../../utils/resource-loader.js';
|
|
9
10
|
import { handleCommandError } from './command-helpers.js';
|
|
11
|
+
/** Total headings in a tree, counting every nested level. */
|
|
12
|
+
function countHeadings(headings) {
|
|
13
|
+
let count = headings.length;
|
|
14
|
+
for (const heading of headings) {
|
|
15
|
+
if (heading.children) {
|
|
16
|
+
count += countHeadings(heading.children);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return count;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Build the scan payload.
|
|
23
|
+
*
|
|
24
|
+
* Pure: no file system, no clock, no `process.exit`. The registry keeps
|
|
25
|
+
* absolute `filePath`s because that is the identity it keys on; re-basing onto
|
|
26
|
+
* the stated root happens exactly once, here, at the document boundary — the
|
|
27
|
+
* same contract `vat audit` follows. A payload of `$HOME`-absolute paths names
|
|
28
|
+
* the machine it ran on and cannot be diffed across two checkouts.
|
|
29
|
+
*/
|
|
30
|
+
export function buildScanOutputData(input) {
|
|
31
|
+
const { resources, root, durationMs, collections, verbose } = input;
|
|
32
|
+
const files = resources.map((resource) => ({
|
|
33
|
+
path: resource.filePath,
|
|
34
|
+
links: resource.links.length,
|
|
35
|
+
anchors: countHeadings(resource.headings),
|
|
36
|
+
checksum: resource.checksum,
|
|
37
|
+
}));
|
|
38
|
+
return {
|
|
39
|
+
status: 'success',
|
|
40
|
+
// Stated once, and the only absolute path in the document.
|
|
41
|
+
root,
|
|
42
|
+
filesScanned: resources.length,
|
|
43
|
+
linksFound: resources.reduce((sum, r) => sum + r.links.length, 0),
|
|
44
|
+
anchorsFound: files.reduce((sum, f) => sum + f.anchors, 0),
|
|
45
|
+
durationSecs: formatDurationSecs(durationMs),
|
|
46
|
+
...(collections ? { collections } : {}),
|
|
47
|
+
...(verbose ? { files: relativizePathEntries(files, root) } : {}),
|
|
48
|
+
};
|
|
49
|
+
}
|
|
10
50
|
export async function scanCommand(pathArg, options) {
|
|
11
51
|
const logger = createLogger({ debug: options.debug ?? false });
|
|
12
52
|
const startTime = Date.now();
|
|
@@ -23,19 +63,6 @@ export async function scanCommand(pathArg, options) {
|
|
|
23
63
|
return collection ? r.collections?.includes(collection) ?? false : false;
|
|
24
64
|
});
|
|
25
65
|
}
|
|
26
|
-
// Calculate stats from filtered resources
|
|
27
|
-
const totalLinks = allResources.reduce((sum, r) => sum + r.links.length, 0);
|
|
28
|
-
const duration = Date.now() - startTime;
|
|
29
|
-
const countHeadings = (headings) => {
|
|
30
|
-
let count = headings.length;
|
|
31
|
-
for (const heading of headings) {
|
|
32
|
-
if (heading.children) {
|
|
33
|
-
count += countHeadings(heading.children);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
return count;
|
|
37
|
-
};
|
|
38
|
-
const totalHeadings = allResources.reduce((sum, resource) => sum + countHeadings(resource.headings), 0);
|
|
39
66
|
// Build collection stats (filtered or all)
|
|
40
67
|
let collectionsOutput;
|
|
41
68
|
if (options.collection) {
|
|
@@ -52,25 +79,13 @@ export async function scanCommand(pathArg, options) {
|
|
|
52
79
|
]))
|
|
53
80
|
: undefined;
|
|
54
81
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
...(collectionsOutput ? { collections: collectionsOutput } : {}),
|
|
63
|
-
};
|
|
64
|
-
// Add verbose file details if requested
|
|
65
|
-
if (options.verbose) {
|
|
66
|
-
outputData['files'] = allResources.map(resource => ({
|
|
67
|
-
path: resource.filePath,
|
|
68
|
-
links: resource.links.length,
|
|
69
|
-
anchors: countHeadings(resource.headings),
|
|
70
|
-
checksum: resource.checksum,
|
|
71
|
-
}));
|
|
72
|
-
}
|
|
73
|
-
writeYamlOutput(outputData);
|
|
82
|
+
writeYamlOutput(buildScanOutputData({
|
|
83
|
+
resources: allResources,
|
|
84
|
+
root: projectRoot,
|
|
85
|
+
durationMs: Date.now() - startTime,
|
|
86
|
+
collections: collectionsOutput,
|
|
87
|
+
verbose: options.verbose ?? false,
|
|
88
|
+
}));
|
|
74
89
|
process.exit(0);
|
|
75
90
|
}
|
|
76
91
|
catch (error) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scan.js","sourceRoot":"","sources":["../../../src/commands/resources/scan.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAEzE,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"scan.js","sourceRoot":"","sources":["../../../src/commands/resources/scan.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AACxE,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAEzE,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAkC1D,6DAA6D;AAC7D,SAAS,aAAa,CAAC,QAAwC;IAC7D,IAAI,KAAK,GAAG,QAAQ,CAAC,MAAM,CAAC;IAC5B,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;QAC/B,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;YACrB,KAAK,IAAI,aAAa,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QAC3C,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,mBAAmB,CAAC,KAA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,EAAE,IAAI,CAAC,aAAa,EAAE;iBACtC,CAAC,CACH;gBACH,CAAC,CAAC,SAAS,CAAC;QAChB,CAAC;QAED,eAAe,CACb,mBAAmB,CAAC;YAClB,SAAS,EAAE,YAAY;YACvB,IAAI,EAAE,WAAW;YACjB,UAAU,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS;YAClC,WAAW,EAAE,iBAAiB;YAC9B,OAAO,EAAE,OAAO,CAAC,OAAO,IAAI,KAAK;SAClC,CAAC,CACH,CAAC;QAEF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,kBAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;IACvD,CAAC;AACH,CAAC"}
|
|
@@ -1,13 +1,148 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Resources validate command - strict validation with error reporting
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import { calculateValidationStatus, type IssueSeverity, type SeverityCounts, type ValidationIssueCode } from '@vibe-agent-toolkit/agent-schema';
|
|
5
|
+
import { DeferredArtifacts, type CollectionStats, type ProjectConfig, type RegistryStats } from '@vibe-agent-toolkit/resources';
|
|
6
|
+
import { type FindingCountSummary } from '../../utils/issue-rendering.js';
|
|
7
|
+
/**
|
|
8
|
+
* Collection statistics with error tracking.
|
|
9
|
+
*/
|
|
10
|
+
interface CollectionStatWithErrors {
|
|
11
|
+
resourceCount: number;
|
|
12
|
+
hasSchema: boolean;
|
|
13
|
+
validationMode?: 'strict' | 'permissive';
|
|
14
|
+
filesWithErrors?: number;
|
|
15
|
+
errorCount?: number;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Issues grouped by file — the `--verbose` row.
|
|
19
|
+
*
|
|
20
|
+
* Each entry carries the validation `code` and resolved `severity` so the
|
|
21
|
+
* serialized output is honest about what fired and at what level. Warning- and
|
|
22
|
+
* info-severity issues appear here too (so users see them); only error-severity
|
|
23
|
+
* issues drive the exit code, which the library decides via `hasErrors`.
|
|
24
|
+
*
|
|
25
|
+
* This shape is optimized for `> file` then `grep`, not for reading.
|
|
26
|
+
*/
|
|
27
|
+
interface FileIssues {
|
|
28
|
+
file: string;
|
|
29
|
+
issues: Array<{
|
|
30
|
+
line: number;
|
|
31
|
+
column: number;
|
|
32
|
+
code: string;
|
|
33
|
+
severity: string;
|
|
34
|
+
message: string;
|
|
35
|
+
}>;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* One file's DEFAULT row: which file has problems, how many, of what code — and
|
|
39
|
+
* nothing else.
|
|
40
|
+
*
|
|
41
|
+
* The unit is the file because the file is what a reader opens to act. Zero
|
|
42
|
+
* severity buckets are ABSENT keys rather than `0` (see {@link summarizeFindings}):
|
|
43
|
+
* three zero columns per file is what makes a listing unreadable at corpus
|
|
44
|
+
* scale, and `errors: 0` beside a red exit code reads as a contradiction.
|
|
45
|
+
*/
|
|
46
|
+
type FileIssueSummary = FindingCountSummary & {
|
|
47
|
+
file: string;
|
|
48
|
+
};
|
|
49
|
+
/** A file's row in the reported listing — counts by default, detail under `--verbose`. */
|
|
50
|
+
type FileIssueRow = FileIssues | FileIssueSummary;
|
|
51
|
+
/**
|
|
52
|
+
* The verdict vocabulary, taken from the shared collapse rather than restated —
|
|
53
|
+
* so this command cannot drift into a private vocabulary again. Every other
|
|
54
|
+
* validation lane answers "issues → status" with these same three values.
|
|
55
|
+
*/
|
|
56
|
+
type ValidationStatus = ReturnType<typeof calculateValidationStatus>;
|
|
57
|
+
/**
|
|
58
|
+
* Output data structure for validation results.
|
|
59
|
+
*
|
|
60
|
+
* Naming contract, and it is load-bearing: a field named `error*` counts
|
|
61
|
+
* ERROR-severity issues only — the ones that fail the run. A field named
|
|
62
|
+
* `issue*` counts issues of every severity. Mixing the two is what made an
|
|
63
|
+
* earlier shape of this object contradict itself (`status: success` beside
|
|
64
|
+
* `filesWithErrors: 1` beside `errorsFound: 0`).
|
|
65
|
+
*/
|
|
66
|
+
interface ValidationOutputData {
|
|
67
|
+
/** Worst ACTIONABLE severity over the reported issues; info-only is `success`. */
|
|
68
|
+
status: ValidationStatus;
|
|
69
|
+
filesScanned: number;
|
|
70
|
+
/** Files carrying at least one ERROR-severity issue. */
|
|
71
|
+
filesWithErrors?: number;
|
|
72
|
+
linksChecked?: number;
|
|
73
|
+
/** ERROR-severity issues only; this is what drives the exit code. */
|
|
74
|
+
errorsFound?: number;
|
|
75
|
+
/** Every issue, split by severity. Only `errors` is fatal. */
|
|
76
|
+
issueCounts?: SeverityCounts;
|
|
77
|
+
/** Count per validation code, ALL severities. */
|
|
78
|
+
issueSummary?: Record<string, number>;
|
|
79
|
+
validationMode: 'strict' | 'permissive';
|
|
80
|
+
frontmatterSchema?: string;
|
|
81
|
+
collections?: Record<string, CollectionStatWithErrors>;
|
|
82
|
+
/**
|
|
83
|
+
* Per-file rows, ALL severities. Counts-only by default; per-issue detail
|
|
84
|
+
* under `--verbose`. A file that emitted nothing has no row in either mode —
|
|
85
|
+
* `filesScanned` above stays the true denominator.
|
|
86
|
+
*/
|
|
87
|
+
issues?: FileIssueRow[];
|
|
88
|
+
durationSecs: number;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Issue data for a single validation issue, flattened for display.
|
|
92
|
+
*
|
|
93
|
+
* - `file` is RELATIVE to projectRoot (matches `issue.location`), used for display.
|
|
94
|
+
* - `absPath` is the ABSOLUTE resource path, used for registry/collection lookups.
|
|
95
|
+
* - `code` / `severity` come straight from the unified `ValidationIssue`, and stay
|
|
96
|
+
* typed as such: that makes an `ErrorData` a structural `ValidationIssue`, so the
|
|
97
|
+
* shared `calculateValidationStatus`/`countBySeverity` consume this list directly
|
|
98
|
+
* instead of a local re-implementation counting severities its own way.
|
|
99
|
+
*/
|
|
100
|
+
type ErrorData = {
|
|
101
|
+
file: string;
|
|
102
|
+
absPath: string;
|
|
103
|
+
line: number;
|
|
104
|
+
column: number;
|
|
105
|
+
code: ValidationIssueCode;
|
|
106
|
+
severity: IssueSeverity;
|
|
107
|
+
message: string;
|
|
108
|
+
};
|
|
5
109
|
/**
|
|
6
110
|
* Output format options.
|
|
7
111
|
*/
|
|
8
112
|
type OutputFormat = 'yaml' | 'json' | 'text';
|
|
113
|
+
/**
|
|
114
|
+
* Context for validation output.
|
|
115
|
+
*/
|
|
116
|
+
interface ValidationContext {
|
|
117
|
+
stats: RegistryStats;
|
|
118
|
+
validationMetadata: Pick<ValidationOutputData, 'validationMode' | 'frontmatterSchema'>;
|
|
119
|
+
collectionStats: CollectionStats | undefined;
|
|
120
|
+
duration: number;
|
|
121
|
+
}
|
|
122
|
+
/** The only thing the output layer needs from the registry: collection lookup by ABSOLUTE path. */
|
|
123
|
+
type RegistryLookup = {
|
|
124
|
+
getResource: (path: string) => {
|
|
125
|
+
collections?: (string[] | undefined);
|
|
126
|
+
} | undefined;
|
|
127
|
+
};
|
|
128
|
+
/**
|
|
129
|
+
* Build the structured (yaml/json) payload for a run that surfaced issues.
|
|
130
|
+
*
|
|
131
|
+
* Surfaces ALL severity-resolved issues (errors AND warnings/info) so users see
|
|
132
|
+
* them; only the `error*`-named counts are error-severity. Exported so the
|
|
133
|
+
* reported vocabulary is unit-testable without spawning the CLI.
|
|
134
|
+
*
|
|
135
|
+
* `verbose` picks the UNIT of the `issues` listing, not the content: one
|
|
136
|
+
* counts-only row per file by default, one entry per issue when asked. Every
|
|
137
|
+
* other field is a total about the run and is byte-identical in both modes.
|
|
138
|
+
* It defaults to the summary, so a caller that has no opinion gets the readable
|
|
139
|
+
* form rather than the 90-skill-scale one.
|
|
140
|
+
*/
|
|
141
|
+
export declare function buildIssuesOutputData(issueData: ErrorData[], context: ValidationContext, registry: RegistryLookup, verbose?: boolean): ValidationOutputData;
|
|
9
142
|
interface ValidateOptions {
|
|
10
143
|
debug?: boolean;
|
|
144
|
+
/** Show all scanned resources, including those without issues (per-issue detail). */
|
|
145
|
+
verbose?: boolean;
|
|
11
146
|
frontmatterSchema?: string;
|
|
12
147
|
validationMode?: 'strict' | 'permissive';
|
|
13
148
|
format?: OutputFormat;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../../src/commands/resources/validate.ts"],"names":[],"mappings":"AAAA;;GAEG;
|
|
1
|
+
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../../src/commands/resources/validate.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,OAAO,EACL,yBAAyB,EAEzB,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,mBAAmB,EACzB,MAAM,kCAAkC,CAAC;AAE1C,OAAO,EACL,iBAAiB,EACjB,KAAK,eAAe,EAEpB,KAAK,aAAa,EAClB,KAAK,aAAa,EAEnB,MAAM,+BAA+B,CAAC;AAMvC,OAAO,EAAqB,KAAK,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAU7F;;GAEG;AACH,UAAU,wBAAwB;IAChC,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,OAAO,CAAC;IACnB,cAAc,CAAC,EAAE,QAAQ,GAAG,YAAY,CAAC;IACzC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAsBD;;;;;;;;;GASG;AACH,UAAU,UAAU;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,KAAK,CAAC;QACZ,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,EAAE,MAAM,CAAC;QACf,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,EAAE,MAAM,CAAC;QACjB,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC,CAAC;CACJ;AAED;;;;;;;;GAQG;AACH,KAAK,gBAAgB,GAAG,mBAAmB,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAE/D,0FAA0F;AAC1F,KAAK,YAAY,GAAG,UAAU,GAA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