@rasensio/aidlc 1.66.0 → 1.72.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/README.md +2 -1
- package/dist/autopilot/driver.d.ts +35 -2
- package/dist/autopilot/driver.d.ts.map +1 -1
- package/dist/autopilot/driver.js +650 -27
- package/dist/autopilot/driver.js.map +1 -1
- package/dist/autopilot/presets.d.ts.map +1 -1
- package/dist/autopilot/presets.js +5 -0
- package/dist/autopilot/presets.js.map +1 -1
- package/dist/autopilot/result.d.ts +133 -0
- package/dist/autopilot/result.d.ts.map +1 -0
- package/dist/autopilot/result.js +431 -0
- package/dist/autopilot/result.js.map +1 -0
- package/dist/autopilot/run.d.ts +2 -0
- package/dist/autopilot/run.d.ts.map +1 -1
- package/dist/autopilot/run.js +33 -6
- package/dist/autopilot/run.js.map +1 -1
- package/dist/autopilot/state.d.ts +51 -0
- package/dist/autopilot/state.d.ts.map +1 -1
- package/dist/autopilot/state.js.map +1 -1
- package/dist/autopilot/typed.d.ts +98 -0
- package/dist/autopilot/typed.d.ts.map +1 -0
- package/dist/autopilot/typed.js +122 -0
- package/dist/autopilot/typed.js.map +1 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +2 -0
- package/dist/cli.js.map +1 -1
- package/dist/commands/hook.d.ts +37 -0
- package/dist/commands/hook.d.ts.map +1 -0
- package/dist/commands/hook.js +208 -0
- package/dist/commands/hook.js.map +1 -0
- package/dist/commands/init.d.ts +18 -0
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +66 -3
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/knowledge.d.ts.map +1 -1
- package/dist/commands/knowledge.js +8 -4
- package/dist/commands/knowledge.js.map +1 -1
- package/dist/commands/roadmap.d.ts +20 -3
- package/dist/commands/roadmap.d.ts.map +1 -1
- package/dist/commands/roadmap.js +60 -15
- package/dist/commands/roadmap.js.map +1 -1
- package/dist/commands/update.d.ts.map +1 -1
- package/dist/commands/update.js +8 -2
- package/dist/commands/update.js.map +1 -1
- package/dist/compile/adapters/claude-code.d.ts.map +1 -1
- package/dist/compile/adapters/claude-code.js +35 -4
- package/dist/compile/adapters/claude-code.js.map +1 -1
- package/dist/compile/adapters/codex.d.ts +12 -0
- package/dist/compile/adapters/codex.d.ts.map +1 -1
- package/dist/compile/adapters/codex.js +58 -8
- package/dist/compile/adapters/codex.js.map +1 -1
- package/dist/compile/loaders.d.ts.map +1 -1
- package/dist/compile/loaders.js +2 -0
- package/dist/compile/loaders.js.map +1 -1
- package/dist/compile/skill-metadata.d.ts +82 -0
- package/dist/compile/skill-metadata.d.ts.map +1 -0
- package/dist/compile/skill-metadata.js +156 -0
- package/dist/compile/skill-metadata.js.map +1 -0
- package/dist/concurrency/claim-store.d.ts +17 -0
- package/dist/concurrency/claim-store.d.ts.map +1 -1
- package/dist/concurrency/claim-store.js +42 -2
- package/dist/concurrency/claim-store.js.map +1 -1
- package/dist/concurrency/common-dir.d.ts +15 -0
- package/dist/concurrency/common-dir.d.ts.map +1 -1
- package/dist/concurrency/common-dir.js +39 -0
- package/dist/concurrency/common-dir.js.map +1 -1
- package/dist/core/types.d.ts +17 -0
- package/dist/core/types.d.ts.map +1 -1
- package/dist/cost/hooks/arm.d.ts +9 -1
- package/dist/cost/hooks/arm.d.ts.map +1 -1
- package/dist/cost/hooks/arm.js +16 -2
- package/dist/cost/hooks/arm.js.map +1 -1
- package/dist/cost/providers/codex.d.ts +13 -0
- package/dist/cost/providers/codex.d.ts.map +1 -1
- package/dist/cost/providers/codex.js +74 -2
- package/dist/cost/providers/codex.js.map +1 -1
- package/dist/doctor/migrations/index.d.ts.map +1 -1
- package/dist/doctor/migrations/index.js +5 -0
- package/dist/doctor/migrations/index.js.map +1 -1
- package/dist/doctor/migrations/roadmap-mermaid-graphs.d.ts +22 -0
- package/dist/doctor/migrations/roadmap-mermaid-graphs.d.ts.map +1 -0
- package/dist/doctor/migrations/roadmap-mermaid-graphs.js +74 -0
- package/dist/doctor/migrations/roadmap-mermaid-graphs.js.map +1 -0
- package/dist/hooks/guard.d.ts +41 -0
- package/dist/hooks/guard.d.ts.map +1 -0
- package/dist/hooks/guard.js +108 -0
- package/dist/hooks/guard.js.map +1 -0
- package/dist/hooks/install.d.ts +78 -0
- package/dist/hooks/install.d.ts.map +1 -0
- package/dist/hooks/install.js +207 -0
- package/dist/hooks/install.js.map +1 -0
- package/dist/hooks/lifecycle-context.d.ts +65 -0
- package/dist/hooks/lifecycle-context.d.ts.map +1 -0
- package/dist/hooks/lifecycle-context.js +212 -0
- package/dist/hooks/lifecycle-context.js.map +1 -0
- package/dist/knowledge/engine.d.ts +19 -2
- package/dist/knowledge/engine.d.ts.map +1 -1
- package/dist/knowledge/engine.js +35 -11
- package/dist/knowledge/engine.js.map +1 -1
- package/dist/knowledge/index/knowledge-index.d.ts +28 -2
- package/dist/knowledge/index/knowledge-index.d.ts.map +1 -1
- package/dist/knowledge/index/sqlite-index.d.ts +19 -1
- package/dist/knowledge/index/sqlite-index.d.ts.map +1 -1
- package/dist/knowledge/index/sqlite-index.js +66 -5
- package/dist/knowledge/index/sqlite-index.js.map +1 -1
- package/dist/knowledge/source-fingerprint.d.ts +71 -0
- package/dist/knowledge/source-fingerprint.d.ts.map +1 -0
- package/dist/knowledge/source-fingerprint.js +105 -0
- package/dist/knowledge/source-fingerprint.js.map +1 -0
- package/dist/knowledge/sync.d.ts +12 -1
- package/dist/knowledge/sync.d.ts.map +1 -1
- package/dist/knowledge/sync.js +23 -3
- package/dist/knowledge/sync.js.map +1 -1
- package/dist/knowledge/types.d.ts +10 -1
- package/dist/knowledge/types.d.ts.map +1 -1
- package/dist/knowledge/types.js +10 -1
- package/dist/knowledge/types.js.map +1 -1
- package/dist/menu/roster.d.ts.map +1 -1
- package/dist/menu/roster.js +2 -0
- package/dist/menu/roster.js.map +1 -1
- package/dist/roadmap/graph.d.ts +73 -28
- package/dist/roadmap/graph.d.ts.map +1 -1
- package/dist/roadmap/graph.js +184 -125
- package/dist/roadmap/graph.js.map +1 -1
- package/dist/roadmap/next.d.ts +5 -0
- package/dist/roadmap/next.d.ts.map +1 -1
- package/dist/roadmap/next.js +7 -1
- package/dist/roadmap/next.js.map +1 -1
- package/dist/roadmap/open-browser.d.ts +34 -0
- package/dist/roadmap/open-browser.d.ts.map +1 -0
- package/dist/roadmap/open-browser.js +40 -0
- package/dist/roadmap/open-browser.js.map +1 -0
- package/dist/roadmap/paths.d.ts +5 -1
- package/dist/roadmap/paths.d.ts.map +1 -1
- package/dist/roadmap/paths.js +5 -9
- package/dist/roadmap/paths.js.map +1 -1
- package/dist/roadmap/view-assets.d.ts +18 -0
- package/dist/roadmap/view-assets.d.ts.map +1 -0
- package/dist/roadmap/view-assets.js +301 -0
- package/dist/roadmap/view-assets.js.map +1 -0
- package/dist/roadmap/view-html.d.ts +37 -0
- package/dist/roadmap/view-html.d.ts.map +1 -0
- package/dist/roadmap/view-html.js +317 -0
- package/dist/roadmap/view-html.js.map +1 -0
- package/dist/roadmap/view-model.d.ts +93 -0
- package/dist/roadmap/view-model.d.ts.map +1 -0
- package/dist/roadmap/view-model.js +194 -0
- package/dist/roadmap/view-model.js.map +1 -0
- package/package.json +2 -2
|
@@ -8,7 +8,9 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @module
|
|
10
10
|
*/
|
|
11
|
+
import type { CodexProgress, SessionEnd } from './result.js';
|
|
11
12
|
import type { PausePhase, StopAt, Stops } from './stops.js';
|
|
13
|
+
import type { Harness } from './typed.js';
|
|
12
14
|
/** A lock older than this belongs to a pass that died. */
|
|
13
15
|
export declare const STALE_LOCK_MS: number;
|
|
14
16
|
export interface AutopilotPaths {
|
|
@@ -31,6 +33,46 @@ export type ItemStep = 'building' | 'pr-open' | 'queued' | 'awaiting-review' | '
|
|
|
31
33
|
export type ResumeStep = Exclude<ItemStep, 'error'>;
|
|
32
34
|
/** The checks on an item's pull request, as the driver last read them (autopilot-live-progress/AC-13). */
|
|
33
35
|
export type CiState = 'waiting' | 'pending' | 'passed' | 'failed';
|
|
36
|
+
/**
|
|
37
|
+
* A launch that asked for a typed result, recorded on the item so that a pass in any
|
|
38
|
+
* process reads that launch's result — not only the one that spawned it
|
|
39
|
+
* (autopilot-reads-agent-result/AC-32).
|
|
40
|
+
*/
|
|
41
|
+
export interface TypedLaunch {
|
|
42
|
+
harness: Harness;
|
|
43
|
+
/** When it was launched. */
|
|
44
|
+
at: string;
|
|
45
|
+
/** The cap its budget was worked out from; absent when none was set (AC-7, AC-17). */
|
|
46
|
+
cap_usd?: number;
|
|
47
|
+
/** Where this launch's output starts in `logs/<item>.log`. */
|
|
48
|
+
log_offset: number;
|
|
49
|
+
/** Codex: the `-o` file, emptied before the launch so an earlier result cannot be read as this one's (AC-6). */
|
|
50
|
+
outcome_file?: string;
|
|
51
|
+
/** Codex: the next byte of the log no pass has folded yet, and what was folded. */
|
|
52
|
+
read_offset?: number;
|
|
53
|
+
progress?: CodexProgress;
|
|
54
|
+
/** Codex: the model once read, and when to look for the thread's rollout — its first launch. */
|
|
55
|
+
model?: string;
|
|
56
|
+
rollout_at?: string;
|
|
57
|
+
/** Codex: rollout lookups so far; three, then the launch is unpriced (design D10). */
|
|
58
|
+
model_lookups?: number;
|
|
59
|
+
/** The session id this launch resumed (AC-27). */
|
|
60
|
+
resumes?: string;
|
|
61
|
+
/** Absent: not read yet. null: read, and nothing readable (AC-15). */
|
|
62
|
+
end?: SessionEnd | null;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* A session waiting to be resumed (autopilot-reads-agent-result/AC-23, AC-24, AC-26). An
|
|
66
|
+
* `ended-early` session ended before the release boundary with no stop autopilot honours
|
|
67
|
+
* (unattended-agent-ends-turn-to-wait/AC-3).
|
|
68
|
+
*/
|
|
69
|
+
export interface ResumeWait {
|
|
70
|
+
kind: 'session-limit' | 'connection' | 'ended-early';
|
|
71
|
+
/** For a dropped connection or an early ending, the pass that decided it: the resume is the next pass. */
|
|
72
|
+
until: string;
|
|
73
|
+
/** Checked against UUID_RE again where it is used: this file can be edited by hand. */
|
|
74
|
+
session: string;
|
|
75
|
+
}
|
|
34
76
|
export interface AutopilotItem {
|
|
35
77
|
name: string;
|
|
36
78
|
file: string;
|
|
@@ -81,6 +123,15 @@ export interface AutopilotItem {
|
|
|
81
123
|
ci?: CiState;
|
|
82
124
|
bump?: string;
|
|
83
125
|
version?: string;
|
|
126
|
+
/** The last launch, while its result can still decide. Absent: handled as before (AC-31). */
|
|
127
|
+
launch?: TypedLaunch;
|
|
128
|
+
/** What the item's typed sessions cost, in micro-USD; absent is 0 (AC-19). */
|
|
129
|
+
spent_micro_usd?: number;
|
|
130
|
+
/** Each session's last recorded cost, so a resumed session adds only its increase (AC-19). */
|
|
131
|
+
session_costs?: Record<string, number>;
|
|
132
|
+
resume_wait?: ResumeWait;
|
|
133
|
+
/** Said once for the item that its Codex usage cannot be priced (AC-21). */
|
|
134
|
+
unpriced_noted?: boolean;
|
|
84
135
|
}
|
|
85
136
|
export interface AutopilotState {
|
|
86
137
|
items: AutopilotItem[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../src/autopilot/state.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAOH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../src/autopilot/state.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAOH,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC7D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAC5D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE1C,0DAA0D;AAC1D,eAAO,MAAM,aAAa,QAAiB,CAAC;AAE5C,MAAM,WAAW,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
|
-
{"version":3,"file":"state.js","sourceRoot":"","sources":["../../src/autopilot/state.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC3G,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"state.js","sourceRoot":"","sources":["../../src/autopilot/state.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC3G,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAK9C,0DAA0D;AAC1D,MAAM,CAAC,MAAM,aAAa,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAqK5C,MAAM,UAAU,YAAY,CAAC,GAAW;IACtC,MAAM,IAAI,GAAG,gBAAgB,CAAC,GAAG,CAAC,CAAC;IACnC,OAAO,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;AACxD,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,GAAW;IACxC,OAAO;QACL,GAAG;QACH,KAAK,EAAE,IAAI,CAAC,GAAG,EAAE,YAAY,CAAC;QAC9B,MAAM,EAAE,IAAI,CAAC,GAAG,EAAE,aAAa,CAAC;QAChC,IAAI,EAAE,IAA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ACZ,IAAI,CAAC;YACH,GAAG,GAAG,GAAG,EAAE,GAAG,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC;QACzC,CAAC;QAAC,MAAM,CAAC;YACP,yEAAyE;QAC3E,CAAC;QACD,IAAI,GAAG,GAAG,aAAa;YAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;QACjD,MAAM,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;QACjD,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IACpB,CAAC;IACD,IAAI,CAAC;QACH,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,CAAC;IACxC,CAAC;YAAS,CAAC;QACT,MAAM,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IACnD,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What autopilot sends a preset agent so that it can read back how the session ended
|
|
3
|
+
* (autopilot-reads-agent-result/AC-1..AC-5, AC-17, AC-18, AC-23, AC-33).
|
|
4
|
+
*
|
|
5
|
+
* The read side is `result.ts`. Both are pure; the driver sequences them. Nothing here
|
|
6
|
+
* is saved to the machine config: the flags are added at launch, so a machine set up
|
|
7
|
+
* before this change gets them without running setup again.
|
|
8
|
+
*
|
|
9
|
+
* @module
|
|
10
|
+
*/
|
|
11
|
+
export type Harness = 'claude' | 'codex';
|
|
12
|
+
export declare const OUTCOMES: readonly ["shipped", "paused", "parked", "blocked"];
|
|
13
|
+
export type Outcome = (typeof OUTCOMES)[number];
|
|
14
|
+
export interface AgentOutcome {
|
|
15
|
+
outcome: Outcome;
|
|
16
|
+
reason: string;
|
|
17
|
+
instance: string;
|
|
18
|
+
phase: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* The outcome the agent ends with: exactly these four keys, each a required string
|
|
22
|
+
* (autopilot-reads-agent-result/AC-4). `additionalProperties: false` with every key
|
|
23
|
+
* required is also what Codex's `--output-schema` insists on.
|
|
24
|
+
*/
|
|
25
|
+
export declare const OUTCOME_SCHEMA: {
|
|
26
|
+
readonly type: "object";
|
|
27
|
+
readonly properties: {
|
|
28
|
+
readonly outcome: {
|
|
29
|
+
readonly type: "string";
|
|
30
|
+
readonly enum: readonly ["shipped", "paused", "parked", "blocked"];
|
|
31
|
+
};
|
|
32
|
+
readonly reason: {
|
|
33
|
+
readonly type: "string";
|
|
34
|
+
};
|
|
35
|
+
readonly instance: {
|
|
36
|
+
readonly type: "string";
|
|
37
|
+
};
|
|
38
|
+
readonly phase: {
|
|
39
|
+
readonly type: "string";
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
readonly required: readonly ["outcome", "reason", "instance", "phase"];
|
|
43
|
+
readonly additionalProperties: false;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* 8, 4, 4, 4 and 12 hexadecimal digits. The only session id that reaches an argv or a
|
|
47
|
+
* park reason: the cost providers' `SESSION_ID_RE` accepts `--dangerously-skip-permissions`,
|
|
48
|
+
* which `--resume` would read as a flag (autopilot-reads-agent-result/AC-33).
|
|
49
|
+
*/
|
|
50
|
+
export declare const UUID_RE: RegExp;
|
|
51
|
+
/**
|
|
52
|
+
* The harness whose preset this exact argv is, or null for a custom command, which is
|
|
53
|
+
* launched as configured (autopilot-reads-agent-result/AC-1..AC-3). Exact, not "starts
|
|
54
|
+
* with `claude`": a custom command may be a wrapper that rejects the flags.
|
|
55
|
+
*/
|
|
56
|
+
export declare function typedHarness(command: readonly string[]): Harness | null;
|
|
57
|
+
export interface TypedArgs {
|
|
58
|
+
harness: Harness;
|
|
59
|
+
prompt: string;
|
|
60
|
+
/** Codex only: both under `<git-common-dir>/aidlc/autopilot/` (autopilot-reads-agent-result/AC-2). */
|
|
61
|
+
schemaFile: string;
|
|
62
|
+
outcomeFile: string;
|
|
63
|
+
/** Claude only: `--max-budget-usd` in whole cents; null adds no flag (autopilot-reads-agent-result/AC-17). */
|
|
64
|
+
maxBudgetCents: number | null;
|
|
65
|
+
/** The session to resume; null for a fresh launch (autopilot-reads-agent-result/AC-23). */
|
|
66
|
+
resume: string | null;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* The preset argv with `{prompt}` substituted and the typed flags added; null when
|
|
70
|
+
* `resume` is not a UUID. Checked here, where the id enters the argv, and not only where
|
|
71
|
+
* it was read: it reaches this call through `state.json`, which a person or a scoped
|
|
72
|
+
* agent can edit (autopilot-reads-agent-result/AC-33).
|
|
73
|
+
*
|
|
74
|
+
* Codex's flags go before the prompt so that a resume is a splice — `resume <id>` where
|
|
75
|
+
* the prompt was, after every option `codex exec` defines (design D4).
|
|
76
|
+
*/
|
|
77
|
+
export declare function typedArgv(command: readonly string[], args: TypedArgs): string[] | null;
|
|
78
|
+
export declare function withOutcomeContract(prompt: string): string;
|
|
79
|
+
export type StopLabel = 'connection dropped' | 'session limit' | 'ended before the release boundary';
|
|
80
|
+
/**
|
|
81
|
+
* Autopilot's own words for a resumed session, never text from the agent: the session
|
|
82
|
+
* already holds its original instructions (autopilot-reads-agent-result/AC-23). A session
|
|
83
|
+
* that ended early is told why it most likely did — it ended its turn to wait for a
|
|
84
|
+
* command, which the end of the turn killed (unattended-agent-ends-turn-to-wait/AC-4).
|
|
85
|
+
*/
|
|
86
|
+
export declare function resumePrompt(item: {
|
|
87
|
+
name: string;
|
|
88
|
+
}, why: StopLabel): string;
|
|
89
|
+
/**
|
|
90
|
+
* Whole cents of budget left: the cap, less what the item spent, less 10% of the cap,
|
|
91
|
+
* rounded down (autopilot-reads-agent-result/AC-17). In integer micro-dollars, as the
|
|
92
|
+
* rate table prices: in dollars, 4.50 can come out as 449 cents. Negative when the item
|
|
93
|
+
* is past the cap less the margin.
|
|
94
|
+
*/
|
|
95
|
+
export declare function budgetCents(capUsd: number, spentMicro: number): number;
|
|
96
|
+
/** '13.50' for 1350. */
|
|
97
|
+
export declare function centsText(cents: number): string;
|
|
98
|
+
//# sourceMappingURL=typed.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typed.d.ts","sourceRoot":"","sources":["../../src/autopilot/typed.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,MAAM,MAAM,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;AAEzC,eAAO,MAAM,QAAQ,qDAAsD,CAAC;AAC5E,MAAM,MAAM,OAAO,GAAG,CAAC,OAAO,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC;AAEhD,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;GAIG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;CAUjB,CAAC;AAEX;;;;GAIG;AACH,eAAO,MAAM,OAAO,QAAoE,CAAC;AAKzF;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,GAAG,IAAI,CAIvE;AAED,MAAM,WAAW,SAAS;IACxB,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,sGAAsG;IACtG,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,8GAA8G;IAC9G,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,2FAA2F;IAC3F,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB;AAED;;;;;;;;GAQG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,EAAE,IAAI,EAAE,SAAS,GAAG,MAAM,EAAE,GAAG,IAAI,CAoBtF;AAUD,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAE1D;AAED,MAAM,MAAM,SAAS,GAAG,oBAAoB,GAAG,eAAe,GAAG,mCAAmC,CAAC;AAErG;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,EAAE,GAAG,EAAE,SAAS,GAAG,MAAM,CAa3E;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAGtE;AAED,wBAAwB;AACxB,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE/C"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What autopilot sends a preset agent so that it can read back how the session ended
|
|
3
|
+
* (autopilot-reads-agent-result/AC-1..AC-5, AC-17, AC-18, AC-23, AC-33).
|
|
4
|
+
*
|
|
5
|
+
* The read side is `result.ts`. Both are pure; the driver sequences them. Nothing here
|
|
6
|
+
* is saved to the machine config: the flags are added at launch, so a machine set up
|
|
7
|
+
* before this change gets them without running setup again.
|
|
8
|
+
*
|
|
9
|
+
* @module
|
|
10
|
+
*/
|
|
11
|
+
import { AGENT_PRESETS } from './presets.js';
|
|
12
|
+
export const OUTCOMES = ['shipped', 'paused', 'parked', 'blocked'];
|
|
13
|
+
/**
|
|
14
|
+
* The outcome the agent ends with: exactly these four keys, each a required string
|
|
15
|
+
* (autopilot-reads-agent-result/AC-4). `additionalProperties: false` with every key
|
|
16
|
+
* required is also what Codex's `--output-schema` insists on.
|
|
17
|
+
*/
|
|
18
|
+
export const OUTCOME_SCHEMA = {
|
|
19
|
+
type: 'object',
|
|
20
|
+
properties: {
|
|
21
|
+
outcome: { type: 'string', enum: [...OUTCOMES] },
|
|
22
|
+
reason: { type: 'string' },
|
|
23
|
+
instance: { type: 'string' },
|
|
24
|
+
phase: { type: 'string' },
|
|
25
|
+
},
|
|
26
|
+
required: ['outcome', 'reason', 'instance', 'phase'],
|
|
27
|
+
additionalProperties: false,
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* 8, 4, 4, 4 and 12 hexadecimal digits. The only session id that reaches an argv or a
|
|
31
|
+
* park reason: the cost providers' `SESSION_ID_RE` accepts `--dangerously-skip-permissions`,
|
|
32
|
+
* which `--resume` would read as a flag (autopilot-reads-agent-result/AC-33).
|
|
33
|
+
*/
|
|
34
|
+
export const UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
35
|
+
const sameArgv = (a, b) => a.length === b.length && a.every((x, i) => x === b[i]);
|
|
36
|
+
/**
|
|
37
|
+
* The harness whose preset this exact argv is, or null for a custom command, which is
|
|
38
|
+
* launched as configured (autopilot-reads-agent-result/AC-1..AC-3). Exact, not "starts
|
|
39
|
+
* with `claude`": a custom command may be a wrapper that rejects the flags.
|
|
40
|
+
*/
|
|
41
|
+
export function typedHarness(command) {
|
|
42
|
+
const preset = AGENT_PRESETS.find((p) => sameArgv(p.command, command));
|
|
43
|
+
if (preset === undefined)
|
|
44
|
+
return null;
|
|
45
|
+
return preset.platform === 'codex' ? 'codex' : 'claude';
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* The preset argv with `{prompt}` substituted and the typed flags added; null when
|
|
49
|
+
* `resume` is not a UUID. Checked here, where the id enters the argv, and not only where
|
|
50
|
+
* it was read: it reaches this call through `state.json`, which a person or a scoped
|
|
51
|
+
* agent can edit (autopilot-reads-agent-result/AC-33).
|
|
52
|
+
*
|
|
53
|
+
* Codex's flags go before the prompt so that a resume is a splice — `resume <id>` where
|
|
54
|
+
* the prompt was, after every option `codex exec` defines (design D4).
|
|
55
|
+
*/
|
|
56
|
+
export function typedArgv(command, args) {
|
|
57
|
+
if (args.resume !== null && !UUID_RE.test(args.resume))
|
|
58
|
+
return null;
|
|
59
|
+
if (args.harness === 'claude') {
|
|
60
|
+
const argv = command.map((a) => (a === '{prompt}' ? args.prompt : a));
|
|
61
|
+
argv.push('--output-format', 'json', '--json-schema', JSON.stringify(OUTCOME_SCHEMA));
|
|
62
|
+
if (args.maxBudgetCents !== null)
|
|
63
|
+
argv.push('--max-budget-usd', centsText(args.maxBudgetCents));
|
|
64
|
+
if (args.resume !== null)
|
|
65
|
+
argv.push('--resume', args.resume);
|
|
66
|
+
return argv;
|
|
67
|
+
}
|
|
68
|
+
const at = command.indexOf('{prompt}');
|
|
69
|
+
if (at === -1)
|
|
70
|
+
return null;
|
|
71
|
+
return [
|
|
72
|
+
...command.slice(0, at),
|
|
73
|
+
'--json',
|
|
74
|
+
'--output-schema', args.schemaFile,
|
|
75
|
+
'-o', args.outcomeFile,
|
|
76
|
+
...(args.resume === null ? [] : ['resume', args.resume]),
|
|
77
|
+
args.prompt,
|
|
78
|
+
...command.slice(at + 1),
|
|
79
|
+
];
|
|
80
|
+
}
|
|
81
|
+
/** What each outcome means, told to every typed launch (autopilot-reads-agent-result/AC-5). */
|
|
82
|
+
const OUTCOME_CONTRACT = ' When you stop, end with the JSON object the output schema asks for. Its "outcome" is ' +
|
|
83
|
+
'"shipped" when what this prompt asked for is done and committed; "paused" when you stopped ' +
|
|
84
|
+
'at a review boundary; "parked" when you parked the item; "blocked" when you stopped for any ' +
|
|
85
|
+
'other reason, which "reason" gives. Its "instance" and "phase" name the instance and its ' +
|
|
86
|
+
'current phase.';
|
|
87
|
+
export function withOutcomeContract(prompt) {
|
|
88
|
+
return prompt + OUTCOME_CONTRACT;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Autopilot's own words for a resumed session, never text from the agent: the session
|
|
92
|
+
* already holds its original instructions (autopilot-reads-agent-result/AC-23). A session
|
|
93
|
+
* that ended early is told why it most likely did — it ended its turn to wait for a
|
|
94
|
+
* command, which the end of the turn killed (unattended-agent-ends-turn-to-wait/AC-4).
|
|
95
|
+
*/
|
|
96
|
+
export function resumePrompt(item, why) {
|
|
97
|
+
const lead = `You are running unattended (AIDLC_UNATTENDED=1). Follow .aidlc/resources/rules/unattended.md. `;
|
|
98
|
+
const carryOn = `Carry on from where it stopped, with the same instructions as before.`;
|
|
99
|
+
if (why === 'ended before the release boundary') {
|
|
100
|
+
return (lead +
|
|
101
|
+
`Your session for the AIDLC instance "${item.name}" ended before the release boundary. ` +
|
|
102
|
+
`In this mode the end of a turn is the end of the session, and a command still running when it ends dies with it. ` +
|
|
103
|
+
`Run any such command again in the foreground and wait for it inside the turn. ` +
|
|
104
|
+
carryOn);
|
|
105
|
+
}
|
|
106
|
+
return lead + `Your session for the AIDLC instance "${item.name}" stopped before it finished (${why}). ` + carryOn;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Whole cents of budget left: the cap, less what the item spent, less 10% of the cap,
|
|
110
|
+
* rounded down (autopilot-reads-agent-result/AC-17). In integer micro-dollars, as the
|
|
111
|
+
* rate table prices: in dollars, 4.50 can come out as 449 cents. Negative when the item
|
|
112
|
+
* is past the cap less the margin.
|
|
113
|
+
*/
|
|
114
|
+
export function budgetCents(capUsd, spentMicro) {
|
|
115
|
+
const cents = Math.floor((Math.round(capUsd * 1e6) - spentMicro - Math.round(capUsd * 1e5)) / 1e4);
|
|
116
|
+
return Number.isFinite(cents) ? cents : 0;
|
|
117
|
+
}
|
|
118
|
+
/** '13.50' for 1350. */
|
|
119
|
+
export function centsText(cents) {
|
|
120
|
+
return (cents / 100).toFixed(2);
|
|
121
|
+
}
|
|
122
|
+
//# sourceMappingURL=typed.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typed.js","sourceRoot":"","sources":["../../src/autopilot/typed.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAI7C,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,SAAS,EAAE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
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA;;;;;;;GAOG;AAcH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA;;;;;;;GAOG;AAcH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAkCpC;;;;;;GAMG;AACH,wBAAgB,YAAY,IAAI,OAAO,CA0CtC;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAC1B,OAAO,EAAE,MAAM,EACf,KAAK,GAAE,MAAM,GAAG,SAA2B,GAC1C,OAAO,CAQT"}
|
package/dist/cli.js
CHANGED
|
@@ -48,6 +48,7 @@ import { registerConstitution } from './commands/constitution.js';
|
|
|
48
48
|
import { registerRoadmap } from './commands/roadmap.js';
|
|
49
49
|
import { registerAutopilot } from './commands/autopilot.js';
|
|
50
50
|
import { registerSpec } from './commands/spec.js';
|
|
51
|
+
import { registerHook } from './commands/hook.js';
|
|
51
52
|
import { registerMenu } from './commands/menu.js';
|
|
52
53
|
import { isBareInvocation } from './menu/invocation.js';
|
|
53
54
|
import { openMenu } from './menu/index.js';
|
|
@@ -92,6 +93,7 @@ export function buildProgram() {
|
|
|
92
93
|
registerRoadmap(program);
|
|
93
94
|
registerAutopilot(program);
|
|
94
95
|
registerSpec(program);
|
|
96
|
+
registerHook(program);
|
|
95
97
|
// Last, so `menu` renders last in `aidlc --help` (interactive-cli-menu/AC-5).
|
|
96
98
|
// Takes the factory, not `program`: the menu dispatches on a throwaway copy so
|
|
97
99
|
// the caller's program never carries an `exitOverride` it cannot undo.
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA;;;;;;;GAOG;AAEH,6E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AM,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;IACvC,CAAC;SAAM,CAAC;QACN,0EAA0E;QAC1E,qEAAqE;QACrE,MAAM,YAAY,EAAE,CAAC,UAAU,EAAE,CAAC;IACpC,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `aidlc hook` — lifecycle hooks for agent harnesses.
|
|
3
|
+
*
|
|
4
|
+
* Two subcommands run inside a harness hook and two install them:
|
|
5
|
+
*
|
|
6
|
+
* - `session-start` prints the claimed instance, its phase and its next step,
|
|
7
|
+
* for a `SessionStart` hook to add to the agent's context after startup,
|
|
8
|
+
* resume, `/clear` or compaction.
|
|
9
|
+
* - `guard` answers a Claude Code `PreToolUse` call with `ask` while the claimed
|
|
10
|
+
* instance is being planned, and with silence otherwise.
|
|
11
|
+
* - `install` / `remove` write those into `.claude/settings.json`, and the
|
|
12
|
+
* session-start hook into `.codex/hooks.json` only when asked by name.
|
|
13
|
+
*
|
|
14
|
+
* The two hook-mode subcommands exit 0 on every path and print nothing when they
|
|
15
|
+
* have nothing to say: a hook that fails must never stop a session starting or a
|
|
16
|
+
* file being edited (hooks-carry-lifecycle-state/AC-7, AC-12, AC-13).
|
|
17
|
+
*
|
|
18
|
+
* Design: design.md C5
|
|
19
|
+
*
|
|
20
|
+
* @module
|
|
21
|
+
*/
|
|
22
|
+
import { Command } from 'commander';
|
|
23
|
+
/**
|
|
24
|
+
* Hook mode. stdin is never read (AC-8): the output does not depend on why the
|
|
25
|
+
* session started, so the payload cannot steer it and a manual run cannot hang.
|
|
26
|
+
*/
|
|
27
|
+
export declare function runSessionStart(from?: string): void;
|
|
28
|
+
export declare function runGuard(from?: string): Promise<void>;
|
|
29
|
+
interface InstallOpts {
|
|
30
|
+
platform?: string;
|
|
31
|
+
guard?: boolean;
|
|
32
|
+
}
|
|
33
|
+
export declare function runInstall(opts: InstallOpts): void;
|
|
34
|
+
export declare function runRemove(opts: InstallOpts): void;
|
|
35
|
+
export declare function registerHook(program: Command): void;
|
|
36
|
+
export {};
|
|
37
|
+
//# sourceMappingURL=hook.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hook.d.ts","sourceRoot":"","sources":["../../src/commands/hook.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAqCpC;;;GAGG;AACH,wBAAgB,eAAe,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAUnD;AAED,wBAAsB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAU3D;AAwBD,UAAU,WAAW;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,CA6ClD;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,CA8BjD;AAED,wBAAgB,YAAY,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAoCnD"}
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `aidlc hook` — lifecycle hooks for agent harnesses.
|
|
3
|
+
*
|
|
4
|
+
* Two subcommands run inside a harness hook and two install them:
|
|
5
|
+
*
|
|
6
|
+
* - `session-start` prints the claimed instance, its phase and its next step,
|
|
7
|
+
* for a `SessionStart` hook to add to the agent's context after startup,
|
|
8
|
+
* resume, `/clear` or compaction.
|
|
9
|
+
* - `guard` answers a Claude Code `PreToolUse` call with `ask` while the claimed
|
|
10
|
+
* instance is being planned, and with silence otherwise.
|
|
11
|
+
* - `install` / `remove` write those into `.claude/settings.json`, and the
|
|
12
|
+
* session-start hook into `.codex/hooks.json` only when asked by name.
|
|
13
|
+
*
|
|
14
|
+
* The two hook-mode subcommands exit 0 on every path and print nothing when they
|
|
15
|
+
* have nothing to say: a hook that fails must never stop a session starting or a
|
|
16
|
+
* file being edited (hooks-carry-lifecycle-state/AC-7, AC-12, AC-13).
|
|
17
|
+
*
|
|
18
|
+
* Design: design.md C5
|
|
19
|
+
*
|
|
20
|
+
* @module
|
|
21
|
+
*/
|
|
22
|
+
import { Command } from 'commander';
|
|
23
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
24
|
+
import { join, relative } from 'node:path';
|
|
25
|
+
import { parse as parseYaml } from 'yaml';
|
|
26
|
+
import { findProjectRoot, resolveProjectRoot } from '../core/project-root.js';
|
|
27
|
+
import { sessionStartLines } from '../hooks/lifecycle-context.js';
|
|
28
|
+
import { guardDecision, guardOutput } from '../hooks/guard.js';
|
|
29
|
+
import { LIFECYCLE_PLATFORMS, installCommand, installLifecycleHooks, needsConsent, removeLifecycleHooks, supportsGuard, trustStep, } from '../hooks/install.js';
|
|
30
|
+
/**
|
|
31
|
+
* The whole of stdin. A TTY means a manual run with no payload, so it resolves
|
|
32
|
+
* empty rather than waiting — as `cost.ts` does for its hook-mode commands.
|
|
33
|
+
*/
|
|
34
|
+
function readStdin() {
|
|
35
|
+
return new Promise((resolveInput) => {
|
|
36
|
+
if (process.stdin.isTTY) {
|
|
37
|
+
resolveInput('');
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
let data = '';
|
|
41
|
+
process.stdin.setEncoding('utf8');
|
|
42
|
+
process.stdin.on('data', (chunk) => (data += chunk));
|
|
43
|
+
process.stdin.on('end', () => resolveInput(data));
|
|
44
|
+
process.stdin.on('error', () => resolveInput(''));
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Hook mode. stdin is never read (AC-8): the output does not depend on why the
|
|
49
|
+
* session started, so the payload cannot steer it and a manual run cannot hang.
|
|
50
|
+
*/
|
|
51
|
+
export function runSessionStart(from) {
|
|
52
|
+
try {
|
|
53
|
+
const root = findProjectRoot(from);
|
|
54
|
+
if (root === null)
|
|
55
|
+
return;
|
|
56
|
+
const lines = sessionStartLines(root);
|
|
57
|
+
if (lines.length > 0)
|
|
58
|
+
process.stdout.write(`${lines.join('\n')}\n`);
|
|
59
|
+
}
|
|
60
|
+
catch {
|
|
61
|
+
// Silence is the failure mode: no context is today's behaviour, a failed
|
|
62
|
+
// session start is not (AC-7).
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
export async function runGuard(from) {
|
|
66
|
+
try {
|
|
67
|
+
const raw = await readStdin();
|
|
68
|
+
const root = findProjectRoot(from);
|
|
69
|
+
if (root === null)
|
|
70
|
+
return;
|
|
71
|
+
const decision = guardDecision(root, raw);
|
|
72
|
+
if (decision !== null)
|
|
73
|
+
process.stdout.write(`${guardOutput(decision)}\n`);
|
|
74
|
+
}
|
|
75
|
+
catch {
|
|
76
|
+
// Fail open: the normal permission flow decides (AC-12, design D5).
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
/** Platforms listed in `.aidlc/config.yaml`, or none when it cannot be read. */
|
|
80
|
+
function configuredPlatforms(root) {
|
|
81
|
+
const path = join(root, '.aidlc', 'config.yaml');
|
|
82
|
+
if (!existsSync(path))
|
|
83
|
+
return [];
|
|
84
|
+
try {
|
|
85
|
+
const config = parseYaml(readFileSync(path, 'utf8'));
|
|
86
|
+
return Array.isArray(config?.platforms) ? config.platforms.filter((p) => typeof p === 'string') : [];
|
|
87
|
+
}
|
|
88
|
+
catch {
|
|
89
|
+
return [];
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
function parsePlatform(value) {
|
|
93
|
+
if (value === undefined)
|
|
94
|
+
return null;
|
|
95
|
+
return LIFECYCLE_PLATFORMS.includes(value) ? value : 'invalid';
|
|
96
|
+
}
|
|
97
|
+
function refuse(message) {
|
|
98
|
+
process.stderr.write(`Error: ${message}\n`);
|
|
99
|
+
process.exitCode = 2;
|
|
100
|
+
}
|
|
101
|
+
export function runInstall(opts) {
|
|
102
|
+
const root = resolveProjectRoot();
|
|
103
|
+
const platform = parsePlatform(opts.platform);
|
|
104
|
+
if (platform === 'invalid') {
|
|
105
|
+
refuse(`no lifecycle hooks for '${opts.platform}' — supported: ${LIFECYCLE_PLATFORMS.join(', ')}`);
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
if (platform !== null && opts.guard && !supportsGuard(platform)) {
|
|
109
|
+
refuse(`the phase guard is Claude Code only — ${platform} hooks can deny or rewrite a call, not ask`);
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
const target = platform ?? 'claude-code';
|
|
113
|
+
let result;
|
|
114
|
+
try {
|
|
115
|
+
result = installLifecycleHooks(root, { platform: target, guard: opts.guard });
|
|
116
|
+
}
|
|
117
|
+
catch (err) {
|
|
118
|
+
// An unparsable hook file is left as it is rather than overwritten.
|
|
119
|
+
process.stderr.write(`Error: could not install the lifecycle hooks: ${err.message}\n`);
|
|
120
|
+
process.exitCode = 1;
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
const file = relative(root, result.path);
|
|
124
|
+
const what = opts.guard ? 'session-start hook and phase guard' : 'session-start hook';
|
|
125
|
+
process.stdout.write(result.written ? `Installed the ${what} in ${file}\n` : `The ${what} is already installed in ${file}\n`);
|
|
126
|
+
if (opts.guard) {
|
|
127
|
+
process.stdout.write('The guard asks before a project file outside .aidlc/ is edited during ideation, requirements or design. ' +
|
|
128
|
+
'Remove it with `aidlc hook remove --guard`.\n');
|
|
129
|
+
}
|
|
130
|
+
const step = trustStep(target);
|
|
131
|
+
if (step !== null)
|
|
132
|
+
process.stdout.write(`${step}\n`);
|
|
133
|
+
if (platform === null) {
|
|
134
|
+
// A consent-gated platform needs the user's say-so by name; a bare install
|
|
135
|
+
// never writes it, only names the command that does (AC-20).
|
|
136
|
+
const configured = configuredPlatforms(root);
|
|
137
|
+
for (const other of LIFECYCLE_PLATFORMS.filter((p) => needsConsent(p) && configured.includes(p))) {
|
|
138
|
+
process.stdout.write(`${other} is configured too: add its session-start hook with \`${installCommand(other)}\`. ${trustStep(other)}\n`);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
export function runRemove(opts) {
|
|
143
|
+
const root = resolveProjectRoot();
|
|
144
|
+
const platform = parsePlatform(opts.platform);
|
|
145
|
+
if (platform === 'invalid') {
|
|
146
|
+
refuse(`no lifecycle hooks for '${opts.platform}' — supported: ${LIFECYCLE_PLATFORMS.join(', ')}`);
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
if (platform !== null && opts.guard && !supportsGuard(platform)) {
|
|
150
|
+
refuse(`the phase guard is Claude Code only — ${platform} has none to remove`);
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
const all = platform ? [platform] : [...LIFECYCLE_PLATFORMS];
|
|
154
|
+
const targets = opts.guard ? all.filter(supportsGuard) : all;
|
|
155
|
+
let removed = 0;
|
|
156
|
+
for (const target of targets) {
|
|
157
|
+
let result;
|
|
158
|
+
try {
|
|
159
|
+
result = removeLifecycleHooks(root, { platform: target, guardOnly: opts.guard });
|
|
160
|
+
}
|
|
161
|
+
catch (err) {
|
|
162
|
+
// An unparsable hook file is left as it is, as install leaves it.
|
|
163
|
+
process.stderr.write(`Error: could not remove the lifecycle hooks: ${err.message}\n`);
|
|
164
|
+
process.exitCode = 1;
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
if (result.written) {
|
|
168
|
+
removed += 1;
|
|
169
|
+
process.stdout.write(`Removed the ${opts.guard ? 'phase guard' : 'lifecycle hooks'} from ${relative(root, result.path)}\n`);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
if (removed === 0)
|
|
173
|
+
process.stdout.write('No lifecycle hooks to remove\n');
|
|
174
|
+
}
|
|
175
|
+
export function registerHook(program) {
|
|
176
|
+
const hook = program
|
|
177
|
+
.command('hook')
|
|
178
|
+
.description('Lifecycle hooks: session-start context and the opt-in phase guard');
|
|
179
|
+
hook
|
|
180
|
+
.command('session-start')
|
|
181
|
+
.description('Print the claimed instance, its phase and next step (SessionStart hook mode)')
|
|
182
|
+
.action(() => {
|
|
183
|
+
runSessionStart();
|
|
184
|
+
});
|
|
185
|
+
hook
|
|
186
|
+
.command('guard')
|
|
187
|
+
.description('Ask before code is edited during planning (PreToolUse hook mode)')
|
|
188
|
+
.action(async () => {
|
|
189
|
+
await runGuard();
|
|
190
|
+
});
|
|
191
|
+
hook
|
|
192
|
+
.command('install')
|
|
193
|
+
.description('Install the session-start hook (and, with --guard, the phase guard)')
|
|
194
|
+
.option('--platform <name>', `Platform to install for (${LIFECYCLE_PLATFORMS.join(', ')}; default claude-code)`)
|
|
195
|
+
.option('--guard', 'Also install the phase guard (Claude Code only; off by default)')
|
|
196
|
+
.action((opts) => {
|
|
197
|
+
runInstall(opts);
|
|
198
|
+
});
|
|
199
|
+
hook
|
|
200
|
+
.command('remove')
|
|
201
|
+
.description('Remove the lifecycle hooks, or only the phase guard with --guard')
|
|
202
|
+
.option('--platform <name>', `Limit to one platform (${LIFECYCLE_PLATFORMS.join(', ')})`)
|
|
203
|
+
.option('--guard', 'Remove only the phase guard')
|
|
204
|
+
.action((opts) => {
|
|
205
|
+
runRemove(opts);
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
//# sourceMappingURL=hook.js.map
|