@shrkcrft/cli 0.1.0-alpha.17 → 0.1.0-alpha.19
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 +10 -0
- package/dist/command-registry.d.ts.map +1 -1
- package/dist/command-registry.js +7 -1
- package/dist/commands/command-catalog.d.ts.map +1 -1
- package/dist/commands/command-catalog.js +12 -0
- package/dist/commands/compress.command.d.ts +0 -7
- package/dist/commands/compress.command.d.ts.map +1 -1
- package/dist/commands/compress.command.js +7 -0
- package/dist/commands/delegate.command.d.ts +65 -0
- package/dist/commands/delegate.command.d.ts.map +1 -0
- package/dist/commands/delegate.command.js +657 -0
- package/dist/commands/deps-audit.command.js +1 -1
- package/dist/commands/doctor.command.d.ts.map +1 -1
- package/dist/commands/doctor.command.js +24 -3
- package/dist/commands/gen.command.d.ts.map +1 -1
- package/dist/commands/gen.command.js +13 -1
- package/dist/commands/graph-code-subverbs.d.ts +22 -0
- package/dist/commands/graph-code-subverbs.d.ts.map +1 -1
- package/dist/commands/graph-code-subverbs.js +476 -55
- package/dist/commands/graph.command.d.ts.map +1 -1
- package/dist/commands/graph.command.js +9 -3
- package/dist/commands/help.command.d.ts.map +1 -1
- package/dist/commands/help.command.js +7 -18
- package/dist/commands/knowledge-author.command.d.ts.map +1 -1
- package/dist/commands/knowledge-author.command.js +9 -0
- package/dist/commands/knowledge-propose.command.d.ts.map +1 -1
- package/dist/commands/knowledge-propose.command.js +4 -2
- package/dist/commands/knowledge.command.d.ts.map +1 -1
- package/dist/commands/knowledge.command.js +22 -2
- package/dist/commands/move-plan.command.js +1 -1
- package/dist/commands/preflight.command.d.ts.map +1 -1
- package/dist/commands/preflight.command.js +15 -0
- package/dist/commands/recommend.command.d.ts +6 -0
- package/dist/commands/recommend.command.d.ts.map +1 -1
- package/dist/commands/recommend.command.js +72 -0
- package/dist/commands/rules.command.d.ts.map +1 -1
- package/dist/commands/rules.command.js +20 -3
- package/dist/commands/smart-context.command.d.ts +26 -17
- package/dist/commands/smart-context.command.d.ts.map +1 -1
- package/dist/commands/smart-context.command.js +113 -16
- package/dist/commands/tests.command.d.ts.map +1 -1
- package/dist/commands/tests.command.js +13 -2
- package/dist/dashboard/code-intelligence-data.d.ts.map +1 -1
- package/dist/dashboard/code-intelligence-data.js +25 -3
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +3 -1
- package/dist/output/ccr-store-config.d.ts +1 -1
- package/dist/output/ccr-store-config.d.ts.map +1 -1
- package/dist/output/ccr-store-config.js +21 -2
- package/package.json +33 -33
|
@@ -10,6 +10,14 @@ export interface ICommandHandler {
|
|
|
10
10
|
name: string;
|
|
11
11
|
description: string;
|
|
12
12
|
usage: string;
|
|
13
|
+
/**
|
|
14
|
+
* Flags that take NO value (e.g. `json`, `no-enhance`). Listed here so the
|
|
15
|
+
* parser doesn't greedily swallow the following token as the flag's value —
|
|
16
|
+
* `compress --json <file>` / `smart-context --no-enhance "<task>"` keep the
|
|
17
|
+
* token as a positional regardless of argument order (the order an LLM
|
|
18
|
+
* naturally emits). Optional; commands without it parse exactly as before.
|
|
19
|
+
*/
|
|
20
|
+
booleanFlags?: ReadonlySet<string>;
|
|
13
21
|
run(args: ParsedArgs): Promise<number> | number;
|
|
14
22
|
}
|
|
15
23
|
/**
|
|
@@ -101,6 +109,8 @@ export declare class CommandRegistry {
|
|
|
101
109
|
export interface ParseArgsOptions {
|
|
102
110
|
/** Global cwd resolved during pre-parse, propagated to the command. */
|
|
103
111
|
globalCwd?: string;
|
|
112
|
+
/** Flags that take no value — they never consume the following token. */
|
|
113
|
+
booleanFlags?: ReadonlySet<string>;
|
|
104
114
|
}
|
|
105
115
|
export declare function parseArgs(argv: readonly string[], options?: ParseArgsOptions): ParsedArgs;
|
|
106
116
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-registry.d.ts","sourceRoot":"","sources":["../src/command-registry.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,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MAAM,EAAE,GAAG;IAC9D,SAAS,CAAC,EAAE,wBAAwB,CAAC;IACrC,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB,CAkEA;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,CAKnD;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAG7E;AAED,wBAAgB,QAAQ,CAAC,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAGhE;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAK7E;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,gBAAgB;IAC/B,0EAA0E;IAC1E,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,qEAAqE;IACrE,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1B;;;;;;;;;OASG;IACH,KAAK,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,MAAM,CAAC;CACrC;AAED,wBAAgB,QAAQ,CACtB,IAAI,EAAE,UAAU,EAChB,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,gBAAqB,GAC7B,MAAM,EAAE,CAkCV;AAED,wBAAgB,QAAQ,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAQjE"}
|
package/dist/command-registry.js
CHANGED
|
@@ -222,7 +222,13 @@ export function parseArgs(argv, options = {}) {
|
|
|
222
222
|
else {
|
|
223
223
|
key = arg.slice(2);
|
|
224
224
|
const next = argv[i + 1];
|
|
225
|
-
|
|
225
|
+
// A known boolean flag never consumes the following token, so
|
|
226
|
+
// flag-first ordering (`--json <file>`, `--no-enhance "<task>"`) keeps
|
|
227
|
+
// the token as a positional instead of swallowing it as the value.
|
|
228
|
+
if (options.booleanFlags?.has(key)) {
|
|
229
|
+
value = true;
|
|
230
|
+
}
|
|
231
|
+
else if (next !== undefined && !next.startsWith('-')) {
|
|
226
232
|
value = next;
|
|
227
233
|
i += 1;
|
|
228
234
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-catalog.d.ts","sourceRoot":"","sources":["../../src/commands/command-catalog.ts"],"names":[],"mappings":"AAAA,oBAAY,WAAW;IACrB,QAAQ,cAAc;IACtB,iBAAiB,mBAAmB;IACpC,gBAAgB,kBAAkB;IAClC,YAAY,kBAAkB;IAC9B,SAAS,eAAe;IACxB,cAAc,oBAAoB;CACnC;AAED;;;;;;GAMG;AACH,oBAAY,cAAc;IACxB,OAAO,YAAY;IACnB,MAAM,WAAW;IACjB,QAAQ,aAAa;IACrB,OAAO,YAAY;IACnB,QAAQ,aAAa;IACrB,MAAM,WAAW;CAClB;AAED,8BAA8B;AAC9B,oBAAY,eAAe;IACzB,KAAK,UAAU;IACf,KAAK,UAAU;IACf,EAAE,OAAO;IACT,UAAU,gBAAgB;IAC1B,UAAU,eAAe;CAC1B;AAED;;;;;;GAMG;AACH,oBAAY,eAAe;IACzB,KAAK,UAAU;IACf,OAAO,YAAY;IACnB,MAAM,WAAW;IACjB,OAAO,YAAY;IACnB,QAAQ,aAAa;IACrB,MAAM,WAAW;IACjB,QAAQ,aAAa;IACrB,OAAO,YAAY;IACnB,QAAQ,aAAa;IACrB,OAAO,YAAY;IACnB,KAAK,UAAU;IACf,MAAM,WAAW;CAClB;AAED;;;;;;GAMG;AACH,oBAAY,gBAAgB;IAC1B,MAAM,WAAW;IACjB,SAAS,cAAc;IACvB,KAAK,UAAU;IACf,UAAU,eAAe;IACzB,OAAO,YAAY;CACpB;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,oBAAY,WAAW;IACrB,IAAI,SAAS;IACb,QAAQ,aAAa;IACrB,YAAY,iBAAiB;CAC9B;AAED,MAAM,WAAW,oBAAoB;IACnC,OAAO,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
|
|
440
440
|
}),
|
|
441
|
+
entry({
|
|
442
|
+
command: 'delegate',
|
|
443
|
+
description: 'Hand a mechanical edit to a local-LLM worker; the engine verifies the result and auto-reverts on failure (run|brief). Writes source only via --apply through the signed-plan + verify gate.',
|
|
444
|
+
category: 'core',
|
|
445
|
+
safetyLevel: SafetyLevel.WritesSource,
|
|
446
|
+
writesFiles: true,
|
|
447
|
+
writesSource: true,
|
|
448
|
+
requiresReview: true,
|
|
449
|
+
surface: CommandSurface.Advanced,
|
|
450
|
+
intendedAudience: [CommandAudience.Human, CommandAudience.Agent],
|
|
451
|
+
taskRole: CommandTaskRole.Apply,
|
|
452
|
+
}),
|
|
441
453
|
// `shrk spec` intent artifact over plan/review/apply.
|
|
442
454
|
entry({
|
|
443
455
|
command: 'spec',
|
|
@@ -1,11 +1,4 @@
|
|
|
1
1
|
import { type ICommandHandler } from '../command-registry.js';
|
|
2
|
-
/**
|
|
3
|
-
* `shrk compress` — deterministically compress a blob (file or stdin) before
|
|
4
|
-
* it re-enters an agent prompt. Same information, fewer tokens. Lossy passes
|
|
5
|
-
* cache the original under `.sharkcraft/ccr/` so `shrk expand <key>` can get
|
|
6
|
-
* it back. The compressed text goes to stdout (pipeable); the savings summary
|
|
7
|
-
* goes to stderr unless `--json` is set.
|
|
8
|
-
*/
|
|
9
2
|
export declare const compressCommand: ICommandHandler;
|
|
10
3
|
/**
|
|
11
4
|
* `shrk expand` — the retrieve half of CCR. Print the full original that
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compress.command.d.ts","sourceRoot":"","sources":["../../src/commands/compress.command.ts"],"names":[],"mappings":"AAQA,OAAO,EAKL,KAAK,eAAe,EAErB,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"compress.command.d.ts","sourceRoot":"","sources":["../../src/commands/compress.command.ts"],"names":[],"mappings":"AAQA,OAAO,EAKL,KAAK,eAAe,EAErB,MAAM,wBAAwB,CAAC;AA2BhC,eAAO,MAAM,eAAe,EAAE,eAgF7B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,aAAa,EAAE,eA4B3B,CAAC"}
|
|
@@ -19,10 +19,17 @@ function readInput(args) {
|
|
|
19
19
|
* it back. The compressed text goes to stdout (pipeable); the savings summary
|
|
20
20
|
* goes to stderr unless `--json` is set.
|
|
21
21
|
*/
|
|
22
|
+
const COMPRESS_BOOLEAN_FLAGS = new Set([
|
|
23
|
+
'stdin',
|
|
24
|
+
'lossless',
|
|
25
|
+
'no-cache',
|
|
26
|
+
'json',
|
|
27
|
+
]);
|
|
22
28
|
export const compressCommand = {
|
|
23
29
|
name: 'compress',
|
|
24
30
|
description: 'Compress a blob (file or stdin) deterministically to cut tokens — JSON→table, logs/search/diffs→signal. Reversible via `shrk expand`.',
|
|
25
31
|
usage: 'shrk [--cwd <dir>] compress [<file>|-] [--stdin] [--type <content-type>] [--query <text>] [--max <n>] [--lossless] [--no-cache] [--json]',
|
|
32
|
+
booleanFlags: COMPRESS_BOOLEAN_FLAGS,
|
|
26
33
|
run(args) {
|
|
27
34
|
const cwd = resolveCwd(args);
|
|
28
35
|
let content;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { type IAiProvider } from '@shrkcrft/ai';
|
|
2
|
+
import { type IDelegateRecipe } from '@shrkcrft/config';
|
|
3
|
+
import { type IDroppedOp } from '@shrkcrft/generator';
|
|
4
|
+
import { type ICommandHandler } from '../command-registry.js';
|
|
5
|
+
export type DelegateRunStatus = 'no-provider' | 'generate-failed' | 'guardrail-refused' | 'package-error' | 'conflicts' | 'sign-failed' | 'no-verification' | 'generated' | 'applied' | 'apply-failed' | 'verify-failed';
|
|
6
|
+
export interface IExecuteDelegateRunInput {
|
|
7
|
+
task: string;
|
|
8
|
+
recipe: IDelegateRecipe;
|
|
9
|
+
projectRoot: string;
|
|
10
|
+
/** Injectable for tests; `null` means no local LLM is reachable. */
|
|
11
|
+
provider: IAiProvider | null;
|
|
12
|
+
apply: boolean;
|
|
13
|
+
/** Where to write the signed plan. Default `.sharkcraft/delegate/<id>.plan.json`. */
|
|
14
|
+
planPath?: string;
|
|
15
|
+
/** Explicit HMAC secret. Falls back to `SHARKCRAFT_PLAN_SECRET`. */
|
|
16
|
+
planSecret?: string;
|
|
17
|
+
/** Validation report dir. Default `.sharkcraft/delegate/reports`. */
|
|
18
|
+
reportDir?: string;
|
|
19
|
+
}
|
|
20
|
+
export interface IExecuteDelegateRunResult {
|
|
21
|
+
status: DelegateRunStatus;
|
|
22
|
+
recipeId: string;
|
|
23
|
+
message: string;
|
|
24
|
+
planPath?: string;
|
|
25
|
+
ops?: number;
|
|
26
|
+
droppedOps?: readonly IDroppedOp[];
|
|
27
|
+
refused?: readonly string[];
|
|
28
|
+
conflicts?: readonly string[];
|
|
29
|
+
written?: readonly string[];
|
|
30
|
+
reverted?: boolean;
|
|
31
|
+
verification?: {
|
|
32
|
+
passed: boolean;
|
|
33
|
+
commandsFailed: readonly string[];
|
|
34
|
+
};
|
|
35
|
+
usage?: {
|
|
36
|
+
inputTokens?: number;
|
|
37
|
+
outputTokens?: number;
|
|
38
|
+
};
|
|
39
|
+
retried?: boolean;
|
|
40
|
+
/** How many generate→verify attempts ran before this result (1-based). */
|
|
41
|
+
attempts?: number;
|
|
42
|
+
/** Compressed unified diff of what the edit changed (compact result hand-back). */
|
|
43
|
+
diff?: string;
|
|
44
|
+
/** CCR key when the diff was lossily compressed (recover via `shrk expand`). */
|
|
45
|
+
diffCcrKey?: string;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* The in-scope files (current contents, compressed to signatures via the
|
|
49
|
+
* code-outline pass) handed to the LOCAL worker so it can pick the right
|
|
50
|
+
* targetPath, check idempotency, and find exact text to replace — instead of
|
|
51
|
+
* guessing. This goes in the WORKER's prompt, read locally, so it costs the
|
|
52
|
+
* orchestrator (Claude) NOTHING. Bounded to keep a small local model's context
|
|
53
|
+
* focused. Returns '' when there's nothing in scope / on any error.
|
|
54
|
+
*/
|
|
55
|
+
export declare function gatherRecipeContext(projectRoot: string, recipe: IDelegateRecipe): string;
|
|
56
|
+
/**
|
|
57
|
+
* The testable orchestration core: a bounded GENERATE→VERIFY retry loop. On a
|
|
58
|
+
* retryable failure (parse / guardrail / bad-op / conflict / verification) the
|
|
59
|
+
* worker is re-prompted with the failure injected, up to `recipe.maxAttempts`,
|
|
60
|
+
* then the run escalates. A provider / signing / environment failure is NOT
|
|
61
|
+
* retried. Takes an already-resolved recipe + provider so tests inject a fake.
|
|
62
|
+
*/
|
|
63
|
+
export declare function executeDelegateRun(input: IExecuteDelegateRunInput): Promise<IExecuteDelegateRunResult>;
|
|
64
|
+
export declare const delegateCommand: ICommandHandler;
|
|
65
|
+
//# sourceMappingURL=delegate.command.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delegate.command.d.ts","sourceRoot":"","sources":["../../src/commands/delegate.command.ts"],"names":[],"mappings":"AAgBA,OAAO,EAML,KAAK,WAAW,EACjB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAqB,KAAK,eAAe,EAA0B,MAAM,kBAAkB,CAAC;AASnG,OAAO,EAOL,KAAK,UAAU,EAChB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAIL,KAAK,eAAe,EAErB,MAAM,wBAAwB,CAAC;AAMhC,MAAM,MAAM,iBAAiB,GACzB,aAAa,GACb,iBAAiB,GACjB,mBAAmB,GACnB,eAAe,GACf,WAAW,GACX,aAAa,GACb,iBAAiB,GACjB,WAAW,GACX,SAAS,GACT,cAAc,GACd,eAAe,CAAC;AAEpB,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,eAAe,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,oEAAoE;IACpE,QAAQ,EAAE,WAAW,GAAG,IAAI,CAAC;IAC7B,KAAK,EAAE,OAAO,CAAC;IACf,qFAAqF;IACrF,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,oE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