@shrkcrft/cli 0.1.0-alpha.26 → 0.1.0-alpha.28
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/command-registry.d.ts +12 -0
- package/dist/command-registry.d.ts.map +1 -1
- package/dist/command-registry.js +25 -0
- package/dist/commands/baseline.command.d.ts +8 -0
- package/dist/commands/baseline.command.d.ts.map +1 -0
- package/dist/commands/baseline.command.js +511 -0
- package/dist/commands/changelog-data.d.ts.map +1 -1
- package/dist/commands/changelog-data.js +43 -0
- package/dist/commands/check.command.d.ts.map +1 -1
- package/dist/commands/check.command.js +28 -1
- package/dist/commands/command-catalog.d.ts.map +1 -1
- package/dist/commands/command-catalog.js +112 -0
- package/dist/commands/delegate.command.d.ts +76 -1
- package/dist/commands/delegate.command.d.ts.map +1 -1
- package/dist/commands/delegate.command.js +585 -25
- package/dist/commands/finish.command.js +4 -4
- package/dist/commands/gates.command.d.ts +6 -0
- package/dist/commands/gates.command.d.ts.map +1 -0
- package/dist/commands/gates.command.js +334 -0
- package/dist/commands/generated.command.d.ts +6 -0
- package/dist/commands/generated.command.d.ts.map +1 -0
- package/dist/commands/generated.command.js +514 -0
- package/dist/commands/help.command.d.ts.map +1 -1
- package/dist/commands/help.command.js +73 -0
- package/dist/commands/ingest.command.d.ts +11 -0
- package/dist/commands/ingest.command.d.ts.map +1 -1
- package/dist/commands/ingest.command.js +49 -23
- package/dist/commands/policy-lint.command.d.ts +37 -0
- package/dist/commands/policy-lint.command.d.ts.map +1 -1
- package/dist/commands/policy-lint.command.js +119 -2
- package/dist/commands/registry-resolve.d.ts +11 -4
- package/dist/commands/registry-resolve.d.ts.map +1 -1
- package/dist/commands/registry-resolve.js +50 -24
- package/dist/commands/registry.command.d.ts.map +1 -1
- package/dist/commands/registry.command.js +36 -4
- package/dist/commands/trace.command.d.ts.map +1 -1
- package/dist/commands/trace.command.js +7 -1
- package/dist/commands/wiring.command.d.ts.map +1 -1
- package/dist/commands/wiring.command.js +113 -14
- package/dist/exit-codes.d.ts +41 -0
- package/dist/exit-codes.d.ts.map +1 -1
- package/dist/exit-codes.js +85 -0
- package/dist/finish/run-finish.d.ts +22 -3
- package/dist/finish/run-finish.d.ts.map +1 -1
- package/dist/finish/run-finish.js +194 -18
- package/dist/gates/gate-rule-view.d.ts +35 -0
- package/dist/gates/gate-rule-view.d.ts.map +1 -0
- package/dist/gates/gate-rule-view.js +80 -0
- package/dist/gates/rule-coverage.d.ts +53 -0
- package/dist/gates/rule-coverage.d.ts.map +1 -0
- package/dist/gates/rule-coverage.js +165 -0
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +46 -6
- package/dist/output/output-compression.d.ts.map +1 -1
- package/dist/output/output-compression.js +4 -1
- package/package.json +33 -33
package/dist/main.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { loadDotenv } from "./env/load-dotenv.js";
|
|
3
|
-
import { CommandRegistry, extractGlobalCompress, extractGlobalCwd, parseArgs, } from "./command-registry.js";
|
|
4
|
-
import { argvHasStrict, promoteForStrict } from "./exit-codes.js";
|
|
3
|
+
import { CommandRegistry, extractGlobalCompress, extractGlobalCwd, extractGlobalExitTrailer, parseArgs, } from "./command-registry.js";
|
|
4
|
+
import { argvHasExitTrailer, argvHasStrict, emitPipeExitSignal, promoteForStrict } from "./exit-codes.js";
|
|
5
5
|
import { runCommandWithCompression } from "./output/output-compression.js";
|
|
6
6
|
import { initCommand } from "./commands/init.command.js";
|
|
7
7
|
import { inspectCommand } from "./commands/inspect.command.js";
|
|
@@ -34,7 +34,10 @@ import { archCommand } from "./commands/arch.command.js";
|
|
|
34
34
|
import { frameworkCommand } from "./commands/framework.command.js";
|
|
35
35
|
import { apiDiffCommand } from "./commands/api-diff.command.js";
|
|
36
36
|
import { gateCommand } from "./commands/gate.command.js";
|
|
37
|
-
import { policyLintCommand } from "./commands/policy-lint.command.js";
|
|
37
|
+
import { policyLintCommand, policyLintExplainCommand } from "./commands/policy-lint.command.js";
|
|
38
|
+
import { baselineCheckCommand, baselineCommand, baselineDiffCommand, baselineExplainCommand, baselineListCommand, baselineUpdateCommand, } from "./commands/baseline.command.js";
|
|
39
|
+
import { generatedCheckCommand, generatedExplainCommand, generatedListCommand, generatedUpdateCommand, } from "./commands/generated.command.js";
|
|
40
|
+
import { gatesCommand, gatesCoverageCommand, gatesExplainCommand, gatesListCommand, } from "./commands/gates.command.js";
|
|
38
41
|
import { wiringCommand } from "./commands/wiring.command.js";
|
|
39
42
|
import { reuseCommand } from "./commands/reuse.command.js";
|
|
40
43
|
import { migrateCommand } from "./commands/migrate.command.js";
|
|
@@ -44,7 +47,7 @@ import { compressCommand, expandCommand } from "./commands/compress.command.js";
|
|
|
44
47
|
import { alignCommand, unalignCommand } from "./commands/cache-align.command.js";
|
|
45
48
|
import { reviewCommand } from "./commands/review.command.js";
|
|
46
49
|
import { onboardCommand } from "./commands/onboard.command.js";
|
|
47
|
-
import { contradictionsCommand, generatedCommand, ingestCommand, } from "./commands/ingest.command.js";
|
|
50
|
+
import { contradictionsCommand, generatedCommand, generatedProtectCommand, generatedReportCommand, ingestCommand, } from "./commands/ingest.command.js";
|
|
48
51
|
import { contextBuildCommand, contextRefreshCommand, contextStatusCommand, understandTaskCommand, validateChangeCommand, } from "./commands/task-context.command.js";
|
|
49
52
|
import { testCommand } from "./commands/test.command.js";
|
|
50
53
|
import { planParentCommand, planReviewCommand } from "./commands/plan.command.js";
|
|
@@ -206,6 +209,26 @@ export function buildRegistry() {
|
|
|
206
209
|
registry.register(apiDiffCommand);
|
|
207
210
|
registry.register(gateCommand);
|
|
208
211
|
registry.register(policyLintCommand);
|
|
212
|
+
registry.registerSubcommand('policy-lint', policyLintExplainCommand);
|
|
213
|
+
// The two shell-executing planes (baseline/generated) + the trust layer.
|
|
214
|
+
registry.register(baselineCommand);
|
|
215
|
+
registry.registerSubcommand('baseline', baselineListCommand);
|
|
216
|
+
registry.registerSubcommand('baseline', baselineCheckCommand);
|
|
217
|
+
registry.registerSubcommand('baseline', baselineDiffCommand);
|
|
218
|
+
registry.registerSubcommand('baseline', baselineUpdateCommand);
|
|
219
|
+
registry.registerSubcommand('baseline', baselineExplainCommand);
|
|
220
|
+
// `generated` already exists as the generated-code CLASSIFIER (report /
|
|
221
|
+
// protect). These add the drift GATE under the same noun.
|
|
222
|
+
registry.registerSubcommand('generated', generatedReportCommand);
|
|
223
|
+
registry.registerSubcommand('generated', generatedProtectCommand);
|
|
224
|
+
registry.registerSubcommand('generated', generatedListCommand);
|
|
225
|
+
registry.registerSubcommand('generated', generatedCheckCommand);
|
|
226
|
+
registry.registerSubcommand('generated', generatedUpdateCommand);
|
|
227
|
+
registry.registerSubcommand('generated', generatedExplainCommand);
|
|
228
|
+
registry.register(gatesCommand);
|
|
229
|
+
registry.registerSubcommand('gates', gatesListCommand);
|
|
230
|
+
registry.registerSubcommand('gates', gatesCoverageCommand);
|
|
231
|
+
registry.registerSubcommand('gates', gatesExplainCommand);
|
|
209
232
|
registry.register(wiringCommand);
|
|
210
233
|
registry.register(reuseCommand);
|
|
211
234
|
registry.register(migrateCommand);
|
|
@@ -516,15 +539,29 @@ export async function runCli(argv) {
|
|
|
516
539
|
// and each command's own `--strict` semantics (e.g. `check --strict`) still
|
|
517
540
|
// apply beneath this (a25 §1.1).
|
|
518
541
|
const strict = argvHasStrict(argv);
|
|
542
|
+
// Derive the command path from an argv with the global --exit-trailer stripped:
|
|
543
|
+
// otherwise a LEADING `--exit-trailer` makes extractCommandPath break on the '-'
|
|
544
|
+
// and return "" — zeroing out both the pipe-exit signal and the usage record.
|
|
545
|
+
const command = extractCommandPath(extractGlobalExitTrailer(probeArgv).rest);
|
|
519
546
|
let exitCode = 0;
|
|
520
547
|
try {
|
|
521
548
|
exitCode = promoteForStrict(await runCliInner(argv), strict);
|
|
549
|
+
// Keep the honest 0/1/2 verdict readable through a trailing pipe (the shape
|
|
550
|
+
// an agent reaches for first). A no-op for non-gate verbs. Skipped inside the
|
|
551
|
+
// smart-context worker child and the --compress re-run child, whose stdout is
|
|
552
|
+
// a pipe by construction — a spurious "stdout is piped" note there (the user
|
|
553
|
+
// never piped) would be noise, not signal.
|
|
554
|
+
if (!process.env.SHRK_WORKER_EXITCODE_FILE && !process.env.SHRK_COMPRESS_CHILD) {
|
|
555
|
+
emitPipeExitSignal(command, exitCode, {
|
|
556
|
+
piped: !process.stdout.isTTY,
|
|
557
|
+
trailer: argvHasExitTrailer(argv),
|
|
558
|
+
});
|
|
559
|
+
}
|
|
522
560
|
return exitCode;
|
|
523
561
|
}
|
|
524
562
|
finally {
|
|
525
563
|
// append one local usage entry. Failure is silent.
|
|
526
564
|
try {
|
|
527
|
-
const command = extractCommandPath(probeArgv);
|
|
528
565
|
if (command.length > 0) {
|
|
529
566
|
const flags = sanitizeFlagNames(probeArgv);
|
|
530
567
|
const enabled = await isUsageEnabled(probeCwd ?? process.cwd());
|
|
@@ -566,8 +603,11 @@ async function runCliInner(argv) {
|
|
|
566
603
|
const registry = buildRegistry();
|
|
567
604
|
// Pre-parse the global --cwd so it can appear anywhere (incl. before the command).
|
|
568
605
|
const { cwd: globalCwd, rest: cwdCleanArgv } = extractGlobalCwd(argv);
|
|
606
|
+
// Strip the global --exit-trailer here so no per-command flag-guard sees it;
|
|
607
|
+
// runCli reads it off the raw argv to decide whether to print the trailer.
|
|
608
|
+
const { rest: trailerCleanArgv } = extractGlobalExitTrailer(cwdCleanArgv);
|
|
569
609
|
// Pre-parse the global --compress / --ccr output-compression flags.
|
|
570
|
-
const { directive: compressDirective, rest: cleanArgv } = extractGlobalCompress(
|
|
610
|
+
const { directive: compressDirective, rest: cleanArgv } = extractGlobalCompress(trailerCleanArgv);
|
|
571
611
|
const [first] = cleanArgv;
|
|
572
612
|
// `--compress` / `--ccr` on a real command: re-run it and compress its stdout.
|
|
573
613
|
// (Meta verbs like --help/--version and bare invocations are left untouched.)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"output-compression.d.ts","sourceRoot":"","sources":["../../src/output/output-compression.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAQvE;;;;;;;;;;;GAWG;AACH,wBAAgB,yBAAyB,CACvC,SAAS,EAAE,SAAS,MAAM,EAAE,EAC5B,SAAS,EAAE,wBAAwB,EACnC,GAAG,EAAE,MAAM,GACV,MAAM,
|
|
1
|
+
{"version":3,"file":"output-compression.d.ts","sourceRoot":"","sources":["../../src/output/output-compression.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAQvE;;;;;;;;;;;GAWG;AACH,wBAAgB,yBAAyB,CACvC,SAAS,EAAE,SAAS,MAAM,EAAE,EAC5B,SAAS,EAAE,wBAAwB,EACnC,GAAG,EAAE,MAAM,GACV,MAAM,CAmDR"}
|
|
@@ -32,7 +32,10 @@ export function runCommandWithCompression(childArgv, directive, cwd) {
|
|
|
32
32
|
const res = spawnSync(runtime, [entry, ...childArgv], {
|
|
33
33
|
encoding: 'utf8',
|
|
34
34
|
maxBuffer: MAX_BUFFER,
|
|
35
|
-
|
|
35
|
+
// Mark the child so it suppresses the piped-stdout exit note: its stdout is
|
|
36
|
+
// captured here (always "piped") but the USER may not have piped anything —
|
|
37
|
+
// the parent decides the note from the real user-facing stdout instead.
|
|
38
|
+
env: { ...process.env, SHRK_COMPRESS_CHILD: '1' },
|
|
36
39
|
});
|
|
37
40
|
if (res.error) {
|
|
38
41
|
process.stderr.write(`--compress: failed to run the command (${res.error.message}); emitting nothing.\n`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shrkcrft/cli",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.28",
|
|
4
4
|
"description": "SharkCraft CLI (`shrk`): structured project intelligence for AI coding agents.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "SharkCraft contributors",
|
|
@@ -47,38 +47,38 @@
|
|
|
47
47
|
"typecheck": "tsc --noEmit -p tsconfig.json"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@shrkcrft/core": "^0.1.0-alpha.
|
|
51
|
-
"@shrkcrft/compress": "^0.1.0-alpha.
|
|
52
|
-
"@shrkcrft/config": "^0.1.0-alpha.
|
|
53
|
-
"@shrkcrft/workspace": "^0.1.0-alpha.
|
|
54
|
-
"@shrkcrft/knowledge": "^0.1.0-alpha.
|
|
55
|
-
"@shrkcrft/context": "^0.1.0-alpha.
|
|
56
|
-
"@shrkcrft/rules": "^0.1.0-alpha.
|
|
57
|
-
"@shrkcrft/paths": "^0.1.0-alpha.
|
|
58
|
-
"@shrkcrft/templates": "^0.1.0-alpha.
|
|
59
|
-
"@shrkcrft/plugin-api": "^0.1.0-alpha.
|
|
60
|
-
"@shrkcrft/dashboard": "^0.1.0-alpha.
|
|
61
|
-
"@shrkcrft/dashboard-api": "^0.1.0-alpha.
|
|
62
|
-
"@shrkcrft/pipelines": "^0.1.0-alpha.
|
|
63
|
-
"@shrkcrft/presets": "^0.1.0-alpha.
|
|
64
|
-
"@shrkcrft/boundaries": "^0.1.0-alpha.
|
|
65
|
-
"@shrkcrft/graph": "^0.1.0-alpha.
|
|
66
|
-
"@shrkcrft/rule-graph": "^0.1.0-alpha.
|
|
67
|
-
"@shrkcrft/structural-search": "^0.1.0-alpha.
|
|
68
|
-
"@shrkcrft/impact-engine": "^0.1.0-alpha.
|
|
69
|
-
"@shrkcrft/context-planner": "^0.1.0-alpha.
|
|
70
|
-
"@shrkcrft/architecture-guard": "^0.1.0-alpha.
|
|
71
|
-
"@shrkcrft/framework-scanners": "^0.1.0-alpha.
|
|
72
|
-
"@shrkcrft/api-surface-diff": "^0.1.0-alpha.
|
|
73
|
-
"@shrkcrft/quality-gates": "^0.1.0-alpha.
|
|
74
|
-
"@shrkcrft/migrate": "^0.1.0-alpha.
|
|
75
|
-
"@shrkcrft/generator": "^0.1.0-alpha.
|
|
76
|
-
"@shrkcrft/importer": "^0.1.0-alpha.
|
|
77
|
-
"@shrkcrft/inspector": "^0.1.0-alpha.
|
|
78
|
-
"@shrkcrft/ai": "^0.1.0-alpha.
|
|
79
|
-
"@shrkcrft/embeddings": "^0.1.0-alpha.
|
|
80
|
-
"@shrkcrft/shared": "^0.1.0-alpha.
|
|
81
|
-
"@shrkcrft/mcp-server": "^0.1.0-alpha.
|
|
50
|
+
"@shrkcrft/core": "^0.1.0-alpha.28",
|
|
51
|
+
"@shrkcrft/compress": "^0.1.0-alpha.28",
|
|
52
|
+
"@shrkcrft/config": "^0.1.0-alpha.28",
|
|
53
|
+
"@shrkcrft/workspace": "^0.1.0-alpha.28",
|
|
54
|
+
"@shrkcrft/knowledge": "^0.1.0-alpha.28",
|
|
55
|
+
"@shrkcrft/context": "^0.1.0-alpha.28",
|
|
56
|
+
"@shrkcrft/rules": "^0.1.0-alpha.28",
|
|
57
|
+
"@shrkcrft/paths": "^0.1.0-alpha.28",
|
|
58
|
+
"@shrkcrft/templates": "^0.1.0-alpha.28",
|
|
59
|
+
"@shrkcrft/plugin-api": "^0.1.0-alpha.28",
|
|
60
|
+
"@shrkcrft/dashboard": "^0.1.0-alpha.28",
|
|
61
|
+
"@shrkcrft/dashboard-api": "^0.1.0-alpha.28",
|
|
62
|
+
"@shrkcrft/pipelines": "^0.1.0-alpha.28",
|
|
63
|
+
"@shrkcrft/presets": "^0.1.0-alpha.28",
|
|
64
|
+
"@shrkcrft/boundaries": "^0.1.0-alpha.28",
|
|
65
|
+
"@shrkcrft/graph": "^0.1.0-alpha.28",
|
|
66
|
+
"@shrkcrft/rule-graph": "^0.1.0-alpha.28",
|
|
67
|
+
"@shrkcrft/structural-search": "^0.1.0-alpha.28",
|
|
68
|
+
"@shrkcrft/impact-engine": "^0.1.0-alpha.28",
|
|
69
|
+
"@shrkcrft/context-planner": "^0.1.0-alpha.28",
|
|
70
|
+
"@shrkcrft/architecture-guard": "^0.1.0-alpha.28",
|
|
71
|
+
"@shrkcrft/framework-scanners": "^0.1.0-alpha.28",
|
|
72
|
+
"@shrkcrft/api-surface-diff": "^0.1.0-alpha.28",
|
|
73
|
+
"@shrkcrft/quality-gates": "^0.1.0-alpha.28",
|
|
74
|
+
"@shrkcrft/migrate": "^0.1.0-alpha.28",
|
|
75
|
+
"@shrkcrft/generator": "^0.1.0-alpha.28",
|
|
76
|
+
"@shrkcrft/importer": "^0.1.0-alpha.28",
|
|
77
|
+
"@shrkcrft/inspector": "^0.1.0-alpha.28",
|
|
78
|
+
"@shrkcrft/ai": "^0.1.0-alpha.28",
|
|
79
|
+
"@shrkcrft/embeddings": "^0.1.0-alpha.28",
|
|
80
|
+
"@shrkcrft/shared": "^0.1.0-alpha.28",
|
|
81
|
+
"@shrkcrft/mcp-server": "^0.1.0-alpha.28",
|
|
82
82
|
"@huggingface/transformers": "^3.7.5"
|
|
83
83
|
},
|
|
84
84
|
"publishConfig": {
|