@webpresso/agent-kit 0.21.4 → 0.23.0
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/.claude-plugin/marketplace.json +2 -2
- package/.claude-plugin/plugin.json +1 -1
- package/README.md +93 -66
- package/bin/_run.js +143 -1
- package/bin/runtime-manifest.json +40 -0
- package/catalog/AGENTS.md.tpl +7 -6
- package/catalog/agent/commands/plan-refine.md +3 -3
- package/catalog/agent/commands/pll.md +2 -0
- package/catalog/agent/guides/parallel-execution.md +2 -0
- package/catalog/agent/rules/extraction-parity.md +27 -1
- package/catalog/agent/rules/public-package-safety.md +24 -1
- package/catalog/agent/skills/plan-refine/SKILL.md +5 -4
- package/catalog/agent/skills/pll/SKILL.md +1 -0
- package/catalog/base-kit/.github/workflows/ci.webpresso.yml.tmpl +33 -0
- package/catalog/base-kit/commitlint.config.ts.tmpl +1 -3
- package/catalog/base-kit/e2e/fixtures/smoke.html.tmpl +13 -0
- package/catalog/base-kit/e2e/smoke.spec.ts.tmpl +13 -0
- package/catalog/base-kit/oxlint.config.ts.tmpl +26 -0
- package/catalog/base-kit/playwright.config.ts.tmpl +10 -0
- package/catalog/base-kit/src/quality-sample.test.ts.tmpl +19 -0
- package/catalog/base-kit/src/quality-sample.ts.tmpl +11 -0
- package/catalog/base-kit/stryker.config.ts.tmpl +14 -0
- package/catalog/base-kit/tsconfig.json.tmpl +9 -0
- package/catalog/base-kit/vitest.config.ts.tmpl +10 -0
- package/catalog/docs/templates/adr.md +1 -1
- package/catalog/docs/templates/blueprint.md +2 -0
- package/catalog/docs/templates/blueprint.yaml +16 -15
- package/catalog/docs/templates/guide.md +1 -1
- package/catalog/docs/templates/postmortem.md +1 -1
- package/catalog/docs/templates/research.md +1 -1
- package/catalog/docs/templates/runbook.md +1 -1
- package/catalog/docs/templates/system.md +12 -3
- package/catalog/docs/templates/tech-debt.md +1 -0
- package/commands/blueprint.md +10 -12
- package/dist/esm/audit/blueprint-db-consistency.d.ts +1 -1
- package/dist/esm/audit/blueprint-db-consistency.js +6 -8
- package/dist/esm/audit/blueprint-lifecycle-sql.js +10 -3
- package/dist/esm/audit/cloudflare-deploy-contract.d.ts +3 -0
- package/dist/esm/audit/cloudflare-deploy-contract.js +64 -0
- package/dist/esm/audit/no-legacy-cli-bin.d.ts +3 -0
- package/dist/esm/audit/no-legacy-cli-bin.js +100 -0
- package/dist/esm/audit/package-surface.js +14 -1
- package/dist/esm/audit/repo-guardrails.js +40 -13
- package/dist/esm/audit/resolve-audit-script.d.ts +24 -0
- package/dist/esm/audit/resolve-audit-script.js +27 -0
- package/dist/esm/audit/roadmap-links.js +23 -10
- package/dist/esm/blueprint/core/schema.d.ts +8 -8
- package/dist/esm/blueprint/core/schema.js +2 -2
- package/dist/esm/blueprint/db/enums.d.ts +1 -1
- package/dist/esm/blueprint/db/ingester.js +18 -10
- package/dist/esm/blueprint/index.d.ts +0 -1
- package/dist/esm/blueprint/index.js +0 -2
- package/dist/esm/blueprint/lifecycle/audit.js +9 -2
- package/dist/esm/blueprint/lifecycle/local.js +15 -4
- package/dist/esm/blueprint/local.d.ts +0 -3
- package/dist/esm/blueprint/local.js +0 -2
- package/dist/esm/blueprint/service/BlueprintCreationService.js +16 -8
- package/dist/esm/blueprint/service/BlueprintService.js +37 -19
- package/dist/esm/blueprint/service/scanner.js +73 -9
- package/dist/esm/blueprint/tracked-document/schema.d.ts +2 -2
- package/dist/esm/blueprint/utils/document-paths.d.ts +23 -0
- package/dist/esm/blueprint/utils/document-paths.js +91 -0
- package/dist/esm/blueprint/utils/package-assets.d.ts +11 -0
- package/dist/esm/blueprint/utils/package-assets.js +33 -4
- package/dist/esm/build/package-manifest.js +7 -0
- package/dist/esm/build/release-policy.d.ts +27 -0
- package/dist/esm/build/release-policy.js +29 -0
- package/dist/esm/build/runtime-targets.d.ts +13 -0
- package/dist/esm/build/runtime-targets.js +48 -0
- package/dist/esm/build/sync-catalog-doc-templates.d.ts +23 -0
- package/dist/esm/build/sync-catalog-doc-templates.js +93 -0
- package/dist/esm/cli/auto-update/detect-pm.d.ts +15 -0
- package/dist/esm/cli/auto-update/detect-pm.js +24 -9
- package/dist/esm/cli/auto-update/skip.js +9 -1
- package/dist/esm/cli/bundle/agent-command-inventory.d.ts +120 -0
- package/dist/esm/cli/bundle/agent-command-inventory.js +100 -0
- package/dist/esm/cli/bundle/index.d.ts +17 -0
- package/dist/esm/cli/bundle/index.js +15 -0
- package/dist/esm/cli/cli.d.ts +1 -1
- package/dist/esm/cli/cli.js +49 -5
- package/dist/esm/cli/commands/audit-core.d.ts +1 -1
- package/dist/esm/cli/commands/audit.js +4 -7
- package/dist/esm/cli/commands/blueprint/router.js +16 -10
- package/dist/esm/cli/commands/blueprint/template-resolver.js +8 -4
- package/dist/esm/cli/commands/hook.d.ts +8 -0
- package/dist/esm/cli/commands/hook.js +47 -0
- package/dist/esm/cli/commands/init/host-visibility.js +4 -2
- package/dist/esm/cli/commands/init/index.js +80 -7
- package/dist/esm/cli/commands/init/scaffold-base-kit.d.ts +12 -0
- package/dist/esm/cli/commands/init/scaffold-base-kit.js +142 -7
- package/dist/esm/cli/commands/init/scaffolders/agent-hooks/codex-ownership.js +9 -1
- package/dist/esm/cli/commands/init/scaffolders/agent-hooks/index.js +130 -20
- package/dist/esm/cli/commands/init/scaffolders/agent-kit-global/index.d.ts +65 -0
- package/dist/esm/cli/commands/init/scaffolders/agent-kit-global/index.js +64 -0
- package/dist/esm/cli/commands/package-manager.d.ts +15 -0
- package/dist/esm/cli/commands/package-manager.js +42 -0
- package/dist/esm/cli/commands/test.d.ts +1 -0
- package/dist/esm/cli/commands/test.js +2 -1
- package/dist/esm/cli/commands/typecheck.js +10 -19
- package/dist/esm/cli/package-scripts.d.ts +12 -0
- package/dist/esm/cli/package-scripts.js +59 -0
- package/dist/esm/cli/utils.js +3 -22
- package/dist/esm/cli/wp-extensions.d.ts +14 -0
- package/dist/esm/cli/wp-extensions.js +34 -0
- package/dist/esm/config/docs-lint/schemas/common.d.ts +1 -1
- package/dist/esm/config/docs-lint/schemas/implementation-plan.d.ts +2 -2
- package/dist/esm/config/docs-lint/schemas/parent-roadmap.d.ts +1 -1
- package/dist/esm/config/stryker/index.d.ts +85 -0
- package/dist/esm/config/stryker/index.js +31 -0
- package/dist/esm/e2e/command-builder.js +35 -7
- package/dist/esm/e2e/config.d.ts +56 -0
- package/dist/esm/e2e/config.js +114 -0
- package/dist/esm/e2e/execution.js +8 -0
- package/dist/esm/e2e/run-planner.js +2 -0
- package/dist/esm/e2e/types.d.ts +3 -0
- package/dist/esm/format/index.js +5 -1
- package/dist/esm/hooks/guard-switch/index.d.ts +1 -1
- package/dist/esm/hooks/guard-switch/index.js +22 -14
- package/dist/esm/hooks/post-tool/lint-after-edit.d.ts +1 -0
- package/dist/esm/hooks/post-tool/lint-after-edit.js +5 -2
- package/dist/esm/hooks/pretool-guard/validators/file-conventions.js +1 -1
- package/dist/esm/hooks/pretool-guard/validators/forbidden-commands.d.ts +6 -0
- package/dist/esm/hooks/pretool-guard/validators/forbidden-commands.js +27 -2
- package/dist/esm/hooks/pretool-guard/validators/path-contract.d.ts +2 -1
- package/dist/esm/hooks/pretool-guard/validators/path-contract.js +59 -34
- package/dist/esm/hooks/pretool-guard/validators/plan-frontmatter.js +3 -3
- package/dist/esm/hooks/shared/routing-block.js +18 -4
- package/dist/esm/hooks/shared/validators/blueprint.js +3 -0
- package/dist/esm/hooks/stop/qa-changed-files.d.ts +1 -0
- package/dist/esm/hooks/stop/qa-changed-files.js +5 -2
- package/dist/esm/lint/index.js +3 -1
- package/dist/esm/mcp/auto-discover.d.ts +2 -0
- package/dist/esm/mcp/auto-discover.js +14 -6
- package/dist/esm/mcp/blueprint-server.js +379 -80
- package/dist/esm/mcp/cli.js +21 -0
- package/dist/esm/mcp/runners/test.js +15 -0
- package/dist/esm/mcp/server.d.ts +7 -0
- package/dist/esm/mcp/server.js +16 -27
- package/dist/esm/mcp/tools/_registry.d.ts +3 -0
- package/dist/esm/mcp/tools/_registry.js +21 -0
- package/dist/esm/mcp/tools/audit.d.ts +1 -0
- package/dist/esm/mcp/tools/audit.js +13 -8
- package/dist/esm/mcp/tools/typecheck.js +4 -2
- package/dist/esm/mutation/affected.d.ts +9 -0
- package/dist/esm/mutation/affected.js +36 -0
- package/dist/esm/package.json +8 -0
- package/dist/esm/runtime/package-version.d.ts +2 -0
- package/dist/esm/runtime/package-version.js +43 -0
- package/dist/esm/test/command-builder.d.ts +4 -0
- package/dist/esm/test/command-builder.js +28 -3
- package/dist/esm/test-helpers/hermetic-env.d.ts +25 -0
- package/dist/esm/test-helpers/hermetic-env.js +31 -0
- package/dist/esm/tool-runtime/index.d.ts +5 -0
- package/dist/esm/tool-runtime/index.js +24 -0
- package/dist/esm/tool-runtime/resolve-runner.d.ts +16 -0
- package/dist/esm/tool-runtime/resolve-runner.js +42 -0
- package/dist/esm/typecheck/index.js +4 -2
- package/dist/esm/wp-extension/index.d.ts +50 -0
- package/dist/esm/wp-extension/index.js +268 -0
- package/package.json +75 -46
- package/skills/plan-refine/SKILL.md +5 -4
- package/skills/pll/SKILL.md +1 -0
- package/dist/esm/blueprint/dag/cycle-detector.d.ts +0 -12
- package/dist/esm/blueprint/dag/cycle-detector.js +0 -46
- package/dist/esm/blueprint/dag/executor.d.ts +0 -140
- package/dist/esm/blueprint/dag/executor.js +0 -292
- package/dist/esm/blueprint/dag/index.d.ts +0 -20
- package/dist/esm/blueprint/dag/index.js +0 -17
- package/dist/esm/blueprint/dag/interfaces.d.ts +0 -56
- package/dist/esm/blueprint/dag/interfaces.js +0 -13
- package/dist/esm/blueprint/dag/local/independence.d.ts +0 -107
- package/dist/esm/blueprint/dag/local/independence.js +0 -231
- package/dist/esm/blueprint/dag/local/index.d.ts +0 -14
- package/dist/esm/blueprint/dag/local/index.js +0 -14
- package/dist/esm/blueprint/dag/local/package-graph.d.ts +0 -66
- package/dist/esm/blueprint/dag/local/package-graph.js +0 -148
- package/dist/esm/blueprint/dag/plan-parser.d.ts +0 -54
- package/dist/esm/blueprint/dag/plan-parser.js +0 -236
- package/dist/esm/blueprint/dag/task-graph-algorithms.d.ts +0 -13
- package/dist/esm/blueprint/dag/task-graph-algorithms.js +0 -236
- package/dist/esm/blueprint/dag/task-graph.d.ts +0 -171
- package/dist/esm/blueprint/dag/task-graph.js +0 -370
- package/dist/esm/blueprint/dag/types.d.ts +0 -17
- package/dist/esm/blueprint/dag/types.js +0 -2
- package/dist/esm/blueprint/graph/index.d.ts +0 -5
- package/dist/esm/blueprint/graph/index.js +0 -5
- package/dist/esm/blueprint/graph/mermaid-parser.d.ts +0 -3
- package/dist/esm/blueprint/graph/mermaid-parser.js +0 -93
- package/dist/esm/blueprint/graph/mermaid-serializer.d.ts +0 -3
- package/dist/esm/blueprint/graph/mermaid-serializer.js +0 -20
- package/dist/esm/blueprint/graph/schema.d.ts +0 -89
- package/dist/esm/blueprint/graph/schema.js +0 -104
- package/dist/esm/blueprint/graph/task-graph-adapter.d.ts +0 -6
- package/dist/esm/blueprint/graph/task-graph-adapter.js +0 -30
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
/**
|
|
3
|
+
* sync-catalog-doc-templates.ts
|
|
4
|
+
*
|
|
5
|
+
* `docs/templates/` (repo root) is the editable source of truth for the
|
|
6
|
+
* blueprint / doc templates. `catalog/docs/templates/` is the published +
|
|
7
|
+
* scaffolded mirror: the npm `files` list ships `catalog/` but NOT repo-root
|
|
8
|
+
* `docs/` (which holds internal docs that must stay private), and `wp init`
|
|
9
|
+
* scaffolds templates into a consumer from `catalog/docs/templates/`.
|
|
10
|
+
*
|
|
11
|
+
* The two MUST stay byte-identical. Nothing synced them before, so they
|
|
12
|
+
* drifted — this script regenerates the mirror from the source and is wired
|
|
13
|
+
* into the build. The colocated drift test fails CI if they ever diverge.
|
|
14
|
+
*
|
|
15
|
+
* Default: regenerate the mirror from the source.
|
|
16
|
+
* `--check`: exit non-zero and list drift without writing (CI / pre-publish).
|
|
17
|
+
*/
|
|
18
|
+
import { cpSync, existsSync, mkdirSync, readdirSync, readFileSync, rmSync } from 'node:fs';
|
|
19
|
+
import { dirname, join } from 'node:path';
|
|
20
|
+
import { argv, exit } from 'node:process';
|
|
21
|
+
import { fileURLToPath } from 'node:url';
|
|
22
|
+
const PACKAGE_ROOT = dirname(dirname(import.meta.dirname));
|
|
23
|
+
const SOURCE_DIR = join(PACKAGE_ROOT, 'docs', 'templates');
|
|
24
|
+
const MIRROR_DIR = join(PACKAGE_ROOT, 'catalog', 'docs', 'templates');
|
|
25
|
+
function listFiles(dir) {
|
|
26
|
+
if (!existsSync(dir))
|
|
27
|
+
return [];
|
|
28
|
+
return readdirSync(dir, { withFileTypes: true })
|
|
29
|
+
.filter((entry) => entry.isFile())
|
|
30
|
+
.map((entry) => entry.name)
|
|
31
|
+
.sort();
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Names that are out of sync between source and mirror: content mismatch,
|
|
35
|
+
* missing from the mirror, or orphaned in the mirror.
|
|
36
|
+
*/
|
|
37
|
+
export function diffDocTemplateMirror() {
|
|
38
|
+
const sourceFiles = listFiles(SOURCE_DIR);
|
|
39
|
+
const mirrorFiles = listFiles(MIRROR_DIR);
|
|
40
|
+
const names = [...new Set([...sourceFiles, ...mirrorFiles])].sort();
|
|
41
|
+
const drift = [];
|
|
42
|
+
for (const name of names) {
|
|
43
|
+
const inSource = sourceFiles.includes(name);
|
|
44
|
+
const inMirror = mirrorFiles.includes(name);
|
|
45
|
+
if (!inSource || !inMirror) {
|
|
46
|
+
drift.push(name);
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
if (readFileSync(join(SOURCE_DIR, name), 'utf8') !== readFileSync(join(MIRROR_DIR, name), 'utf8')) {
|
|
50
|
+
drift.push(name);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return drift;
|
|
54
|
+
}
|
|
55
|
+
/** Regenerate the mirror from the source: copy every file, drop orphans. */
|
|
56
|
+
function syncDocTemplateMirror() {
|
|
57
|
+
mkdirSync(MIRROR_DIR, { recursive: true });
|
|
58
|
+
const sourceFiles = listFiles(SOURCE_DIR);
|
|
59
|
+
for (const name of listFiles(MIRROR_DIR)) {
|
|
60
|
+
if (!sourceFiles.includes(name))
|
|
61
|
+
rmSync(join(MIRROR_DIR, name));
|
|
62
|
+
}
|
|
63
|
+
for (const name of sourceFiles) {
|
|
64
|
+
cpSync(join(SOURCE_DIR, name), join(MIRROR_DIR, name));
|
|
65
|
+
}
|
|
66
|
+
return sourceFiles.length;
|
|
67
|
+
}
|
|
68
|
+
function main() {
|
|
69
|
+
if (!existsSync(SOURCE_DIR)) {
|
|
70
|
+
console.error(`doc templates source not found: ${SOURCE_DIR}`);
|
|
71
|
+
exit(1);
|
|
72
|
+
}
|
|
73
|
+
if (argv.includes('--check')) {
|
|
74
|
+
const drift = diffDocTemplateMirror();
|
|
75
|
+
if (drift.length > 0) {
|
|
76
|
+
console.error([
|
|
77
|
+
'catalog/docs/templates/ is out of sync with docs/templates/:',
|
|
78
|
+
...drift.map((name) => ` - ${name}`),
|
|
79
|
+
'Run `bun src/build/sync-catalog-doc-templates.ts` and commit the result.',
|
|
80
|
+
].join('\n'));
|
|
81
|
+
exit(1);
|
|
82
|
+
}
|
|
83
|
+
console.log('catalog/docs/templates/ is in sync with docs/templates/');
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
const count = syncDocTemplateMirror();
|
|
87
|
+
console.log(`Synced ${count} template(s) → catalog/docs/templates/`);
|
|
88
|
+
}
|
|
89
|
+
// Run as a script, but stay side-effect-free when imported (e.g. by the test).
|
|
90
|
+
if (fileURLToPath(import.meta.url) === argv[1]) {
|
|
91
|
+
main();
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=sync-catalog-doc-templates.js.map
|
|
@@ -28,6 +28,21 @@ export interface DetectAbort {
|
|
|
28
28
|
export type DetectResult = DetectSuccess | DetectAbort;
|
|
29
29
|
export declare const PUBLIC_PACKAGE_NAME = "@webpresso/agent-kit";
|
|
30
30
|
export declare const PUBLIC_NPM_REGISTRY = "https://registry.npmjs.org";
|
|
31
|
+
/**
|
|
32
|
+
* Canonical global-install command for the public agent-kit.
|
|
33
|
+
*
|
|
34
|
+
* No `--registry` flag: npmjs.org is already the default registry, and a global
|
|
35
|
+
* `--registry` does NOT override a scoped `@webpresso:registry` mapping
|
|
36
|
+
* (npm/pnpm resolve the scope first). The flag was therefore redundant when no
|
|
37
|
+
* scope override exists and ineffective when one does. To force-public inside a
|
|
38
|
+
* repo that scopes `@webpresso` to a private registry, use the scoped form
|
|
39
|
+
* `--@webpresso:registry=${PUBLIC_NPM_REGISTRY}` instead.
|
|
40
|
+
*
|
|
41
|
+
* Exported so the `wp setup` self-update scaffolder reuses the exact same
|
|
42
|
+
* command (single source of truth — see `ensureAgentKitGlobal`).
|
|
43
|
+
*/
|
|
44
|
+
export declare function buildVpGlobalInstallCommand(): [string, ...string[]];
|
|
45
|
+
export declare function formatLegacyCommandReplacementMessage(legacyCommand: string): string | null;
|
|
31
46
|
/**
|
|
32
47
|
* Detect whether argv1 is a symlink pointing into a supported source clone.
|
|
33
48
|
* Returns the git worktree root if so, null otherwise.
|
|
@@ -20,17 +20,26 @@
|
|
|
20
20
|
import { execFileSync } from 'node:child_process';
|
|
21
21
|
import { realpathSync } from 'node:fs';
|
|
22
22
|
import { delimiter, dirname, sep } from 'node:path';
|
|
23
|
+
import { getLegacyAgentCommandReplacement } from '#cli/bundle/agent-command-inventory.js';
|
|
23
24
|
export const PUBLIC_PACKAGE_NAME = '@webpresso/agent-kit';
|
|
24
25
|
export const PUBLIC_NPM_REGISTRY = 'https://registry.npmjs.org';
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
26
|
+
/**
|
|
27
|
+
* Canonical global-install command for the public agent-kit.
|
|
28
|
+
*
|
|
29
|
+
* No `--registry` flag: npmjs.org is already the default registry, and a global
|
|
30
|
+
* `--registry` does NOT override a scoped `@webpresso:registry` mapping
|
|
31
|
+
* (npm/pnpm resolve the scope first). The flag was therefore redundant when no
|
|
32
|
+
* scope override exists and ineffective when one does. To force-public inside a
|
|
33
|
+
* repo that scopes `@webpresso` to a private registry, use the scoped form
|
|
34
|
+
* `--@webpresso:registry=${PUBLIC_NPM_REGISTRY}` instead.
|
|
35
|
+
*
|
|
36
|
+
* Exported so the `wp setup` self-update scaffolder reuses the exact same
|
|
37
|
+
* command (single source of truth — see `ensureAgentKitGlobal`).
|
|
38
|
+
*/
|
|
39
|
+
export function buildVpGlobalInstallCommand() {
|
|
40
|
+
return ['vp', 'install', '-g', PUBLIC_PACKAGE_NAME];
|
|
41
|
+
}
|
|
42
|
+
const VP_INSTALL_COMMAND = buildVpGlobalInstallCommand();
|
|
34
43
|
const INSTALL_COMMANDS = {
|
|
35
44
|
npm: VP_INSTALL_COMMAND,
|
|
36
45
|
pnpm: VP_INSTALL_COMMAND,
|
|
@@ -38,6 +47,12 @@ const INSTALL_COMMANDS = {
|
|
|
38
47
|
bun: VP_INSTALL_COMMAND,
|
|
39
48
|
vp: VP_INSTALL_COMMAND,
|
|
40
49
|
};
|
|
50
|
+
export function formatLegacyCommandReplacementMessage(legacyCommand) {
|
|
51
|
+
const replacement = getLegacyAgentCommandReplacement(legacyCommand);
|
|
52
|
+
if (replacement === null)
|
|
53
|
+
return null;
|
|
54
|
+
return `Legacy agent-kit command \`${legacyCommand}\` has a future replacement: \`${replacement}\`.`;
|
|
55
|
+
}
|
|
41
56
|
/**
|
|
42
57
|
* Detect whether argv1 is a symlink pointing into a supported source clone.
|
|
43
58
|
* Returns the git worktree root if so, null otherwise.
|
|
@@ -37,7 +37,7 @@ export const CI_ENV_KEYS = [
|
|
|
37
37
|
'DRONE',
|
|
38
38
|
'JENKINS_URL',
|
|
39
39
|
];
|
|
40
|
-
const SKIP_SUBCOMMANDS = new Set(['mcp']);
|
|
40
|
+
const SKIP_SUBCOMMANDS = new Set(['mcp', 'hook']);
|
|
41
41
|
export function shouldSkipUpdateCheck(env, argv) {
|
|
42
42
|
if (hasInformationalFlag(argv))
|
|
43
43
|
return true;
|
|
@@ -45,6 +45,8 @@ export function shouldSkipUpdateCheck(env, argv) {
|
|
|
45
45
|
return true;
|
|
46
46
|
if (env.WP_SKIP_UPDATE_CHECK === '1')
|
|
47
47
|
return true;
|
|
48
|
+
if (isPackageLifecycleEnvironment(env))
|
|
49
|
+
return true;
|
|
48
50
|
if (isCiEnvironment(env))
|
|
49
51
|
return true;
|
|
50
52
|
return false;
|
|
@@ -81,4 +83,10 @@ function isCiEnvironment(env) {
|
|
|
81
83
|
}
|
|
82
84
|
return false;
|
|
83
85
|
}
|
|
86
|
+
function isPackageLifecycleEnvironment(env) {
|
|
87
|
+
const lifecycleEvent = env.npm_lifecycle_event;
|
|
88
|
+
const packageJsonPath = env.npm_package_json;
|
|
89
|
+
return Boolean((lifecycleEvent && lifecycleEvent.trim().length > 0) ||
|
|
90
|
+
(packageJsonPath && packageJsonPath.trim().length > 0));
|
|
91
|
+
}
|
|
84
92
|
//# sourceMappingURL=skip.js.map
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
export type AgentCommandVisibility = 'public' | 'internal';
|
|
2
|
+
export interface LegacyAgentCommandAlias {
|
|
3
|
+
legacyCommand: string;
|
|
4
|
+
replacementCommand: string;
|
|
5
|
+
}
|
|
6
|
+
export interface AgentCommandInventoryEntry {
|
|
7
|
+
id: string;
|
|
8
|
+
namespace: 'agent';
|
|
9
|
+
visibility: AgentCommandVisibility;
|
|
10
|
+
replacementCommand: string;
|
|
11
|
+
legacyAliases: readonly LegacyAgentCommandAlias[];
|
|
12
|
+
}
|
|
13
|
+
export declare const AGENT_COMMAND_INVENTORY: readonly [{
|
|
14
|
+
readonly id: "agent setup";
|
|
15
|
+
readonly namespace: "agent";
|
|
16
|
+
readonly visibility: "public";
|
|
17
|
+
readonly replacementCommand: "webpresso agent setup";
|
|
18
|
+
readonly legacyAliases: readonly [{
|
|
19
|
+
readonly legacyCommand: "wp setup";
|
|
20
|
+
readonly replacementCommand: "webpresso agent setup";
|
|
21
|
+
}, {
|
|
22
|
+
readonly legacyCommand: "wp init";
|
|
23
|
+
readonly replacementCommand: "webpresso agent setup";
|
|
24
|
+
}];
|
|
25
|
+
}, {
|
|
26
|
+
readonly id: "agent sync";
|
|
27
|
+
readonly namespace: "agent";
|
|
28
|
+
readonly visibility: "public";
|
|
29
|
+
readonly replacementCommand: "webpresso agent sync";
|
|
30
|
+
readonly legacyAliases: readonly [{
|
|
31
|
+
readonly legacyCommand: "wp sync";
|
|
32
|
+
readonly replacementCommand: "webpresso agent sync";
|
|
33
|
+
}];
|
|
34
|
+
}, {
|
|
35
|
+
readonly id: "agent audit";
|
|
36
|
+
readonly namespace: "agent";
|
|
37
|
+
readonly visibility: "public";
|
|
38
|
+
readonly replacementCommand: "webpresso agent audit";
|
|
39
|
+
readonly legacyAliases: readonly [{
|
|
40
|
+
readonly legacyCommand: "wp audit";
|
|
41
|
+
readonly replacementCommand: "webpresso agent audit";
|
|
42
|
+
}];
|
|
43
|
+
}, {
|
|
44
|
+
readonly id: "agent skills";
|
|
45
|
+
readonly namespace: "agent";
|
|
46
|
+
readonly visibility: "public";
|
|
47
|
+
readonly replacementCommand: "webpresso agent skills";
|
|
48
|
+
readonly legacyAliases: readonly [{
|
|
49
|
+
readonly legacyCommand: "wp skill";
|
|
50
|
+
readonly replacementCommand: "webpresso agent skills";
|
|
51
|
+
}, {
|
|
52
|
+
readonly legacyCommand: "wp skills";
|
|
53
|
+
readonly replacementCommand: "webpresso agent skills";
|
|
54
|
+
}];
|
|
55
|
+
}, {
|
|
56
|
+
readonly id: "agent docs lint";
|
|
57
|
+
readonly namespace: "agent";
|
|
58
|
+
readonly visibility: "public";
|
|
59
|
+
readonly replacementCommand: "webpresso agent docs lint";
|
|
60
|
+
readonly legacyAliases: readonly [{
|
|
61
|
+
readonly legacyCommand: "wp docs";
|
|
62
|
+
readonly replacementCommand: "webpresso agent docs lint";
|
|
63
|
+
}, {
|
|
64
|
+
readonly legacyCommand: "wp docs lint";
|
|
65
|
+
readonly replacementCommand: "webpresso agent docs lint";
|
|
66
|
+
}];
|
|
67
|
+
}, {
|
|
68
|
+
readonly id: "agent hooks doctor";
|
|
69
|
+
readonly namespace: "agent";
|
|
70
|
+
readonly visibility: "public";
|
|
71
|
+
readonly replacementCommand: "webpresso agent hooks doctor";
|
|
72
|
+
readonly legacyAliases: readonly [{
|
|
73
|
+
readonly legacyCommand: "wp hooks";
|
|
74
|
+
readonly replacementCommand: "webpresso agent hooks doctor";
|
|
75
|
+
}, {
|
|
76
|
+
readonly legacyCommand: "wp hooks doctor";
|
|
77
|
+
readonly replacementCommand: "webpresso agent hooks doctor";
|
|
78
|
+
}, {
|
|
79
|
+
readonly legacyCommand: "wp doctor";
|
|
80
|
+
readonly replacementCommand: "webpresso agent hooks doctor";
|
|
81
|
+
}];
|
|
82
|
+
}, {
|
|
83
|
+
readonly id: "agent blueprint";
|
|
84
|
+
readonly namespace: "agent";
|
|
85
|
+
readonly visibility: "public";
|
|
86
|
+
readonly replacementCommand: "webpresso agent blueprint";
|
|
87
|
+
readonly legacyAliases: readonly [{
|
|
88
|
+
readonly legacyCommand: "wp blueprint";
|
|
89
|
+
readonly replacementCommand: "webpresso agent blueprint";
|
|
90
|
+
}];
|
|
91
|
+
}, {
|
|
92
|
+
readonly id: "agent test";
|
|
93
|
+
readonly namespace: "agent";
|
|
94
|
+
readonly visibility: "public";
|
|
95
|
+
readonly replacementCommand: "webpresso agent test";
|
|
96
|
+
readonly legacyAliases: readonly [{
|
|
97
|
+
readonly legacyCommand: "wp test";
|
|
98
|
+
readonly replacementCommand: "webpresso agent test";
|
|
99
|
+
}];
|
|
100
|
+
}, {
|
|
101
|
+
readonly id: "agent e2e";
|
|
102
|
+
readonly namespace: "agent";
|
|
103
|
+
readonly visibility: "public";
|
|
104
|
+
readonly replacementCommand: "webpresso agent e2e";
|
|
105
|
+
readonly legacyAliases: readonly [{
|
|
106
|
+
readonly legacyCommand: "wp e2e";
|
|
107
|
+
readonly replacementCommand: "webpresso agent e2e";
|
|
108
|
+
}];
|
|
109
|
+
}, {
|
|
110
|
+
readonly id: "agent tech-debt";
|
|
111
|
+
readonly namespace: "agent";
|
|
112
|
+
readonly visibility: "public";
|
|
113
|
+
readonly replacementCommand: "webpresso agent tech-debt";
|
|
114
|
+
readonly legacyAliases: readonly [{
|
|
115
|
+
readonly legacyCommand: "wp tech-debt";
|
|
116
|
+
readonly replacementCommand: "webpresso agent tech-debt";
|
|
117
|
+
}];
|
|
118
|
+
}];
|
|
119
|
+
export declare function getLegacyAgentCommandReplacement(legacyCommand: string): string | null;
|
|
120
|
+
//# sourceMappingURL=agent-command-inventory.d.ts.map
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
export const AGENT_COMMAND_INVENTORY = [
|
|
2
|
+
{
|
|
3
|
+
id: 'agent setup',
|
|
4
|
+
namespace: 'agent',
|
|
5
|
+
visibility: 'public',
|
|
6
|
+
replacementCommand: 'webpresso agent setup',
|
|
7
|
+
legacyAliases: [
|
|
8
|
+
{ legacyCommand: 'wp setup', replacementCommand: 'webpresso agent setup' },
|
|
9
|
+
{ legacyCommand: 'wp init', replacementCommand: 'webpresso agent setup' },
|
|
10
|
+
],
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
id: 'agent sync',
|
|
14
|
+
namespace: 'agent',
|
|
15
|
+
visibility: 'public',
|
|
16
|
+
replacementCommand: 'webpresso agent sync',
|
|
17
|
+
legacyAliases: [{ legacyCommand: 'wp sync', replacementCommand: 'webpresso agent sync' }],
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
id: 'agent audit',
|
|
21
|
+
namespace: 'agent',
|
|
22
|
+
visibility: 'public',
|
|
23
|
+
replacementCommand: 'webpresso agent audit',
|
|
24
|
+
legacyAliases: [{ legacyCommand: 'wp audit', replacementCommand: 'webpresso agent audit' }],
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
id: 'agent skills',
|
|
28
|
+
namespace: 'agent',
|
|
29
|
+
visibility: 'public',
|
|
30
|
+
replacementCommand: 'webpresso agent skills',
|
|
31
|
+
legacyAliases: [
|
|
32
|
+
{ legacyCommand: 'wp skill', replacementCommand: 'webpresso agent skills' },
|
|
33
|
+
{ legacyCommand: 'wp skills', replacementCommand: 'webpresso agent skills' },
|
|
34
|
+
],
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
id: 'agent docs lint',
|
|
38
|
+
namespace: 'agent',
|
|
39
|
+
visibility: 'public',
|
|
40
|
+
replacementCommand: 'webpresso agent docs lint',
|
|
41
|
+
legacyAliases: [
|
|
42
|
+
{ legacyCommand: 'wp docs', replacementCommand: 'webpresso agent docs lint' },
|
|
43
|
+
{ legacyCommand: 'wp docs lint', replacementCommand: 'webpresso agent docs lint' },
|
|
44
|
+
],
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
id: 'agent hooks doctor',
|
|
48
|
+
namespace: 'agent',
|
|
49
|
+
visibility: 'public',
|
|
50
|
+
replacementCommand: 'webpresso agent hooks doctor',
|
|
51
|
+
legacyAliases: [
|
|
52
|
+
{ legacyCommand: 'wp hooks', replacementCommand: 'webpresso agent hooks doctor' },
|
|
53
|
+
{ legacyCommand: 'wp hooks doctor', replacementCommand: 'webpresso agent hooks doctor' },
|
|
54
|
+
{ legacyCommand: 'wp doctor', replacementCommand: 'webpresso agent hooks doctor' },
|
|
55
|
+
],
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
id: 'agent blueprint',
|
|
59
|
+
namespace: 'agent',
|
|
60
|
+
visibility: 'public',
|
|
61
|
+
replacementCommand: 'webpresso agent blueprint',
|
|
62
|
+
legacyAliases: [
|
|
63
|
+
{ legacyCommand: 'wp blueprint', replacementCommand: 'webpresso agent blueprint' },
|
|
64
|
+
],
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
id: 'agent test',
|
|
68
|
+
namespace: 'agent',
|
|
69
|
+
visibility: 'public',
|
|
70
|
+
replacementCommand: 'webpresso agent test',
|
|
71
|
+
legacyAliases: [{ legacyCommand: 'wp test', replacementCommand: 'webpresso agent test' }],
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
id: 'agent e2e',
|
|
75
|
+
namespace: 'agent',
|
|
76
|
+
visibility: 'public',
|
|
77
|
+
replacementCommand: 'webpresso agent e2e',
|
|
78
|
+
legacyAliases: [{ legacyCommand: 'wp e2e', replacementCommand: 'webpresso agent e2e' }],
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
id: 'agent tech-debt',
|
|
82
|
+
namespace: 'agent',
|
|
83
|
+
visibility: 'public',
|
|
84
|
+
replacementCommand: 'webpresso agent tech-debt',
|
|
85
|
+
legacyAliases: [
|
|
86
|
+
{ legacyCommand: 'wp tech-debt', replacementCommand: 'webpresso agent tech-debt' },
|
|
87
|
+
],
|
|
88
|
+
},
|
|
89
|
+
];
|
|
90
|
+
export function getLegacyAgentCommandReplacement(legacyCommand) {
|
|
91
|
+
const normalized = legacyCommand.trim().replace(/\s+/gu, ' ').toLowerCase();
|
|
92
|
+
for (const entry of AGENT_COMMAND_INVENTORY) {
|
|
93
|
+
for (const alias of entry.legacyAliases) {
|
|
94
|
+
if (alias.legacyCommand.toLowerCase() === normalized)
|
|
95
|
+
return alias.replacementCommand;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return null;
|
|
99
|
+
}
|
|
100
|
+
//# sourceMappingURL=agent-command-inventory.js.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type AgentCommandInventoryEntry } from '#cli/bundle/agent-command-inventory.js';
|
|
2
|
+
export interface AgentBundleCommandDefinition {
|
|
3
|
+
readonly id: AgentCommandInventoryEntry['id'];
|
|
4
|
+
readonly namespace: AgentCommandInventoryEntry['namespace'];
|
|
5
|
+
readonly visibility: AgentCommandInventoryEntry['visibility'];
|
|
6
|
+
readonly replacementCommand: AgentCommandInventoryEntry['replacementCommand'];
|
|
7
|
+
readonly legacyAliases: AgentCommandInventoryEntry['legacyAliases'];
|
|
8
|
+
}
|
|
9
|
+
export interface AgentBundleDefinition {
|
|
10
|
+
readonly bundleId: 'agent-kit';
|
|
11
|
+
readonly commandRoot: 'agent';
|
|
12
|
+
readonly sourcePackage: '@webpresso/agent-kit';
|
|
13
|
+
readonly intendedHostPackage: '@repo/cli';
|
|
14
|
+
readonly commands: readonly AgentBundleCommandDefinition[];
|
|
15
|
+
}
|
|
16
|
+
export declare const AGENT_BUNDLE: AgentBundleDefinition;
|
|
17
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { AGENT_COMMAND_INVENTORY, } from '#cli/bundle/agent-command-inventory.js';
|
|
2
|
+
export const AGENT_BUNDLE = {
|
|
3
|
+
bundleId: 'agent-kit',
|
|
4
|
+
commandRoot: 'agent',
|
|
5
|
+
sourcePackage: '@webpresso/agent-kit',
|
|
6
|
+
intendedHostPackage: '@repo/cli',
|
|
7
|
+
commands: AGENT_COMMAND_INVENTORY.map((entry) => ({
|
|
8
|
+
id: entry.id,
|
|
9
|
+
namespace: entry.namespace,
|
|
10
|
+
visibility: entry.visibility,
|
|
11
|
+
replacementCommand: entry.replacementCommand,
|
|
12
|
+
legacyAliases: entry.legacyAliases,
|
|
13
|
+
})),
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
package/dist/esm/cli/cli.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Lazy-loads subcommand modules based on the first argv to keep startup
|
|
6
6
|
* cheap. Modeled on apps/cli-wp/src/cli.ts.
|
|
7
7
|
*/
|
|
8
|
-
declare const SUPPORTED_COMMANDS: readonly ["blueprint", "config", "roadmap", "sync", "audit", "compile", "rule", "skill", "skills", "docs", "setup", "init", "dev", "doctor", "err", "test", "e2e", "ci", "typecheck", "lint", "format", "tech-debt", "worktree", "mcp", "hooks", "gain", "bench"];
|
|
8
|
+
declare const SUPPORTED_COMMANDS: readonly ["blueprint", "config", "roadmap", "sync", "audit", "compile", "rule", "skill", "skills", "docs", "setup", "init", "dev", "doctor", "err", "test", "e2e", "ci", "typecheck", "lint", "format", "tech-debt", "worktree", "mcp", "hook", "hooks", "gain", "bench", "install", "add", "remove", "update", "exec", "run"];
|
|
9
9
|
export { SUPPORTED_COMMANDS };
|
|
10
10
|
export declare function main(): Promise<number>;
|
|
11
11
|
//# sourceMappingURL=cli.d.ts.map
|
package/dist/esm/cli/cli.js
CHANGED
|
@@ -11,6 +11,7 @@ import { resolve as pathResolve } from 'node:path';
|
|
|
11
11
|
import { fileURLToPath } from 'node:url';
|
|
12
12
|
import { bootstrapAk } from './bootstrap.js';
|
|
13
13
|
import { formatUnknownCommandError, normalizeArgv, readPackageVersion } from './utils.js';
|
|
14
|
+
import { registerWpExtensions, resolveWpCommandAlias } from './wp-extensions.js';
|
|
14
15
|
const VERSION = readPackageVersion(import.meta.url);
|
|
15
16
|
const SUPPORTED_COMMANDS = [
|
|
16
17
|
'blueprint',
|
|
@@ -37,9 +38,16 @@ const SUPPORTED_COMMANDS = [
|
|
|
37
38
|
'tech-debt',
|
|
38
39
|
'worktree',
|
|
39
40
|
'mcp',
|
|
41
|
+
'hook',
|
|
40
42
|
'hooks',
|
|
41
43
|
'gain',
|
|
42
44
|
'bench',
|
|
45
|
+
'install',
|
|
46
|
+
'add',
|
|
47
|
+
'remove',
|
|
48
|
+
'update',
|
|
49
|
+
'exec',
|
|
50
|
+
'run',
|
|
43
51
|
];
|
|
44
52
|
const ROOT_HELP = [
|
|
45
53
|
'Usage: wp [command] [options]',
|
|
@@ -52,6 +60,12 @@ const ROOT_HELP = [
|
|
|
52
60
|
' gain Show token savings from RTK — run after any AI session',
|
|
53
61
|
' sync Sync agent rules + skills across IDE surfaces (--kind, --check)',
|
|
54
62
|
' bench Run the session-memory benchmark harness',
|
|
63
|
+
' install Install dependencies through the managed vp facade',
|
|
64
|
+
' add Add dependencies through the managed vp facade',
|
|
65
|
+
' remove Remove dependencies through the managed vp facade',
|
|
66
|
+
' update Update dependencies through the managed vp facade',
|
|
67
|
+
' exec Run a binary through the managed vp facade',
|
|
68
|
+
' run Run a package script through the managed vp facade',
|
|
55
69
|
'',
|
|
56
70
|
'Quality:',
|
|
57
71
|
' audit Run packaged audits (bundle budgets, repo guardrails, TPH, tech-debt)',
|
|
@@ -123,7 +137,17 @@ export async function main() {
|
|
|
123
137
|
return 0;
|
|
124
138
|
}
|
|
125
139
|
await bootstrapAk(VERSION, argv);
|
|
126
|
-
|
|
140
|
+
const extensionRuntime = await registerWpExtensions({
|
|
141
|
+
cli,
|
|
142
|
+
cwd: process.cwd(),
|
|
143
|
+
env: process.env,
|
|
144
|
+
hostVersion: VERSION,
|
|
145
|
+
baseCommands: [...SUPPORTED_COMMANDS],
|
|
146
|
+
});
|
|
147
|
+
for (const warning of extensionRuntime.warnings)
|
|
148
|
+
console.error(warning);
|
|
149
|
+
const resolvedCommand = resolveWpCommandAlias(command, extensionRuntime.aliasMap);
|
|
150
|
+
switch (resolvedCommand) {
|
|
127
151
|
case 'blueprint': {
|
|
128
152
|
const { registerBlueprintRouter } = await import('./commands/blueprint/router.js');
|
|
129
153
|
registerBlueprintRouter(cli);
|
|
@@ -177,7 +201,7 @@ export async function main() {
|
|
|
177
201
|
case 'setup':
|
|
178
202
|
case 'init': {
|
|
179
203
|
const { registerInitCommand } = await import('./commands/init/index.js');
|
|
180
|
-
registerInitCommand(cli,
|
|
204
|
+
registerInitCommand(cli, resolvedCommand);
|
|
181
205
|
break;
|
|
182
206
|
}
|
|
183
207
|
case 'dev': {
|
|
@@ -235,6 +259,11 @@ export async function main() {
|
|
|
235
259
|
registerMcpCommand(cli);
|
|
236
260
|
break;
|
|
237
261
|
}
|
|
262
|
+
case 'hook': {
|
|
263
|
+
const { registerHookCommand } = await import('./commands/hook.js');
|
|
264
|
+
registerHookCommand(cli);
|
|
265
|
+
break;
|
|
266
|
+
}
|
|
238
267
|
case 'hooks': {
|
|
239
268
|
const { registerHooksCommand } = await import('./commands/hooks.js');
|
|
240
269
|
registerHooksCommand(cli);
|
|
@@ -250,20 +279,35 @@ export async function main() {
|
|
|
250
279
|
registerBenchCommand(cli);
|
|
251
280
|
break;
|
|
252
281
|
}
|
|
282
|
+
case 'install':
|
|
283
|
+
case 'add':
|
|
284
|
+
case 'remove':
|
|
285
|
+
case 'update':
|
|
286
|
+
case 'exec':
|
|
287
|
+
case 'run': {
|
|
288
|
+
const { registerPackageManagerCommand } = await import('./commands/package-manager.js');
|
|
289
|
+
registerPackageManagerCommand(cli, resolvedCommand);
|
|
290
|
+
break;
|
|
291
|
+
}
|
|
253
292
|
case 'worktree': {
|
|
254
293
|
const { registerWorktreeRouter } = await import('./commands/worktree/router.js');
|
|
255
294
|
registerWorktreeRouter(cli);
|
|
256
295
|
break;
|
|
257
296
|
}
|
|
258
297
|
default: {
|
|
259
|
-
|
|
260
|
-
|
|
298
|
+
if (!resolvedCommand || !extensionRuntime.commandNames.includes(resolvedCommand)) {
|
|
299
|
+
console.error(formatUnknownCommandError(command, SUPPORTED_COMMANDS));
|
|
300
|
+
return 1;
|
|
301
|
+
}
|
|
261
302
|
}
|
|
262
303
|
}
|
|
263
304
|
cli.help();
|
|
264
305
|
cli.version(VERSION);
|
|
265
306
|
try {
|
|
266
|
-
|
|
307
|
+
const effectiveArgv = resolvedCommand && resolvedCommand !== command
|
|
308
|
+
? [argv[0] ?? 'node', argv[1] ?? 'wp', resolvedCommand, ...argv.slice(3)]
|
|
309
|
+
: argv;
|
|
310
|
+
cli.parse(effectiveArgv, { run: false });
|
|
267
311
|
const result = await cli.runMatchedCommand();
|
|
268
312
|
return typeof result === 'number' ? result : 0;
|
|
269
313
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { RepoAuditResult } from '#audit/repo-guardrails';
|
|
2
|
-
export type AuditKind = 'tph' | 'tph-e2e' | 'bundle-budget' | 'commit-message' | 'blueprint-lifecycle' | 'roadmap-links' | 'docs-frontmatter' | 'catalog-drift' | 'package-surface' | 'agents' | 'tech-debt' | 'no-relative-parent-imports' | 'no-link-protocol' | 'vision' | 'bucket-boundary' | 'skill-sizes' | 'broken-refs' | 'memory-rotation' | 'gitignore-agent-surfaces' | 'memory-unified' | 'compile-drift' | 'architecture-drift' | 'absolute-path-policy' | 'agent-cost' | 'blueprint-db-consistency' | 'blueprint-lifecycle-sql' | 'tech-debt-cadence' | 'cross-repo-correlation' | 'ai-contracts' | 'mutation' | 'quality' | 'guardrails' | 'hook-surface' | 'no-relative-package-scripts';
|
|
2
|
+
export type AuditKind = 'tph' | 'tph-e2e' | 'bundle-budget' | 'commit-message' | 'blueprint-lifecycle' | 'roadmap-links' | 'docs-frontmatter' | 'catalog-drift' | 'package-surface' | 'agents' | 'tech-debt' | 'no-relative-parent-imports' | 'no-link-protocol' | 'vision' | 'bucket-boundary' | 'skill-sizes' | 'broken-refs' | 'memory-rotation' | 'gitignore-agent-surfaces' | 'memory-unified' | 'compile-drift' | 'architecture-drift' | 'cloudflare-deploy-contract' | 'absolute-path-policy' | 'agent-cost' | 'blueprint-db-consistency' | 'blueprint-lifecycle-sql' | 'tech-debt-cadence' | 'cross-repo-correlation' | 'ai-contracts' | 'mutation' | 'quality' | 'guardrails' | 'hook-surface' | 'no-relative-package-scripts';
|
|
3
3
|
export type AuditOutcome = {
|
|
4
4
|
kind: 'invalid-usage';
|
|
5
5
|
message: string;
|
|
@@ -9,6 +9,7 @@ import { existsSync, readFileSync } from 'node:fs';
|
|
|
9
9
|
import path from 'node:path';
|
|
10
10
|
import { runAuditDispatch } from './audit-core.js';
|
|
11
11
|
import { runStryker } from '#audit/run-stryker';
|
|
12
|
+
import { resolveAuditScriptPath } from '#audit/resolve-audit-script';
|
|
12
13
|
const REPO_AUDIT_REGISTRY = {
|
|
13
14
|
'catalog-drift': async (root) => (await import('#audit/repo-guardrails')).auditCatalogDrift(root),
|
|
14
15
|
'package-surface': async (root) => (await import('#audit/package-surface')).auditPackageSurface(root),
|
|
@@ -55,7 +56,9 @@ const REPO_AUDIT_REGISTRY = {
|
|
|
55
56
|
'gitignore-agent-surfaces': async (root) => (await import('#audit/gitignore-agent-surfaces')).auditGitignoreAgentSurfaces(root),
|
|
56
57
|
'memory-unified': async (root) => (await import('#audit/memory-unified')).auditMemoryUnified(root),
|
|
57
58
|
'compile-drift': async (root) => (await import('#audit/compile-drift')).auditCompileDrift(root),
|
|
59
|
+
'no-legacy-cli-bin': async (root) => (await import('#audit/no-legacy-cli-bin')).auditNoLegacyCliBin(root),
|
|
58
60
|
'architecture-drift': async (root) => (await import('#audit/architecture-drift')).auditArchitectureDrift(root),
|
|
61
|
+
'cloudflare-deploy-contract': async (root) => (await import('#audit/cloudflare-deploy-contract')).auditCloudflareDeployContract(root),
|
|
59
62
|
'absolute-path-policy': async (root) => (await import('#audit/absolute-path-policy')).auditAbsolutePathPolicy(root),
|
|
60
63
|
'agent-cost': async (root) => (await import('#audit/agent-cost')).auditAgentCost(root),
|
|
61
64
|
'blueprint-db-consistency': async (root) => (await import('#audit/blueprint-db-consistency')).auditBlueprintDbConsistency(root),
|
|
@@ -119,13 +122,7 @@ const AUDIT_KINDS = [
|
|
|
119
122
|
];
|
|
120
123
|
const AUDIT_KIND_LIST = AUDIT_KINDS.join(', ');
|
|
121
124
|
function resolveAuditScript(name) {
|
|
122
|
-
|
|
123
|
-
if (existsSync(fromSource)) {
|
|
124
|
-
return fromSource.pathname;
|
|
125
|
-
}
|
|
126
|
-
const bundleDir = path.dirname(new URL(import.meta.url).pathname);
|
|
127
|
-
const packageRoot = path.resolve(bundleDir, '..');
|
|
128
|
-
return path.join(packageRoot, 'src', 'audit', name);
|
|
125
|
+
return resolveAuditScriptPath(name, { moduleUrl: import.meta.url });
|
|
129
126
|
}
|
|
130
127
|
async function runAuditScript(script, extraArgs) {
|
|
131
128
|
const runtime = process.env.BUN_INSTALL ? 'bun' : 'bun';
|