@wildorder/nightshift 0.1.0 → 0.3.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/dist/cli.js +252 -10
- package/dist/cli.js.map +1 -1
- package/dist/config.d.ts +4 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +7 -0
- package/dist/config.js.map +1 -1
- package/dist/decision-ledger.d.ts +68 -0
- package/dist/decision-ledger.d.ts.map +1 -0
- package/dist/decision-ledger.js +108 -0
- package/dist/decision-ledger.js.map +1 -0
- package/dist/decision.d.ts +59 -0
- package/dist/decision.d.ts.map +1 -0
- package/dist/decision.js +0 -0
- package/dist/decision.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -1
- package/dist/init-project.d.ts +18 -0
- package/dist/init-project.d.ts.map +1 -0
- package/dist/init-project.js +259 -0
- package/dist/init-project.js.map +1 -0
- package/dist/install-prefs.d.ts +17 -0
- package/dist/install-prefs.d.ts.map +1 -0
- package/dist/install-prefs.js +55 -0
- package/dist/install-prefs.js.map +1 -0
- package/dist/install-skills.d.ts +83 -0
- package/dist/install-skills.d.ts.map +1 -0
- package/dist/install-skills.js +311 -0
- package/dist/install-skills.js.map +1 -0
- package/dist/install-wizard.d.ts +56 -0
- package/dist/install-wizard.d.ts.map +1 -0
- package/dist/install-wizard.js +166 -0
- package/dist/install-wizard.js.map +1 -0
- package/dist/manifest.d.ts +76 -0
- package/dist/manifest.d.ts.map +1 -0
- package/dist/manifest.js +95 -0
- package/dist/manifest.js.map +1 -0
- package/dist/package-assets.d.ts +3 -0
- package/dist/package-assets.d.ts.map +1 -0
- package/dist/package-assets.js +13 -0
- package/dist/package-assets.js.map +1 -0
- package/dist/run-program.d.ts +72 -0
- package/dist/run-program.d.ts.map +1 -0
- package/dist/run-program.js +482 -0
- package/dist/run-program.js.map +1 -0
- package/dist/skill-roots.d.ts +51 -0
- package/dist/skill-roots.d.ts.map +1 -0
- package/dist/skill-roots.js +181 -0
- package/dist/skill-roots.js.map +1 -0
- package/package.json +3 -1
- package/skills/init-project/SKILL.md +196 -0
- package/skills/plan-program/SKILL.md +274 -0
- package/templates/AGENTS.md +29 -0
- package/templates/CLAUDE.md +7 -0
- package/templates/universal-directives.md +50 -0
- package/templates/vision.md +46 -0
package/dist/cli.js
CHANGED
|
@@ -1,18 +1,260 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { spawn } from "node:child_process";
|
|
3
|
+
import { existsSync } from "node:fs";
|
|
4
|
+
import { join, resolve } from "node:path";
|
|
5
5
|
import { Command } from "commander";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
import { addDevDependencyCommand, detectPackageManager, isPnpmWorkspaceRoot, PACKAGE_MANAGERS, parsePackageManager, } from "./detect-package-manager.js";
|
|
7
|
+
import { initProject } from "./init-project.js";
|
|
8
|
+
import { ALL_TARGETS, DEFAULT_TARGETS, detectTargets, doctor, installSkills, overrideEnvName, parseRootOverrides, parseTargets, } from "./install-skills.js";
|
|
9
|
+
import { installArgv, planSkillInstall } from "./install-wizard.js";
|
|
10
|
+
import { packageVersion } from "./package-assets.js";
|
|
11
|
+
import { createProjectManifest } from "./project-manifest.js";
|
|
12
|
+
import { loadConfig } from "./config.js";
|
|
13
|
+
import { runProgram } from "./run-program.js";
|
|
14
|
+
const SCOPES = ["user", "project", "both"];
|
|
15
|
+
function parseScope(value) {
|
|
16
|
+
const scope = value.trim().toLowerCase();
|
|
17
|
+
if (!SCOPES.includes(scope)) {
|
|
18
|
+
throw new Error(`Unknown scope "${value}". Expected: ${SCOPES.join(", ")}.`);
|
|
19
|
+
}
|
|
20
|
+
return scope;
|
|
10
21
|
}
|
|
11
|
-
|
|
12
|
-
|
|
22
|
+
function collect(value, previous) {
|
|
23
|
+
return [...previous, value];
|
|
24
|
+
}
|
|
25
|
+
/** Shared option surface for `install` and `setup`. */
|
|
26
|
+
function withSkillOptions(command) {
|
|
27
|
+
return command
|
|
28
|
+
.option("--cwd <path>", "Project directory", process.cwd())
|
|
29
|
+
.option("--targets <targets>", `Comma-separated targets: ${DEFAULT_TARGETS} (default: detected tools)`)
|
|
30
|
+
.option("--scope <scope>", `Install location: ${SCOPES.join(", ")} (default: user)`)
|
|
31
|
+
.option("--root <target=path>", "Override a target's skills root; repeatable", collect, [])
|
|
32
|
+
.option("--force", "Overwrite conflicting skill files", false)
|
|
33
|
+
.option("--yes", "Accept detected defaults without prompting", false)
|
|
34
|
+
.option("--prune", "Remove unmodified project-scope copies after a user-scope install")
|
|
35
|
+
.option("--no-prune", "Keep project-scope copies");
|
|
36
|
+
}
|
|
37
|
+
function localCliPath(root) {
|
|
38
|
+
return join(root, "node_modules", "@wildorder", "nightshift", "dist", "cli.js");
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Resolves the plan (prompting when a human is present), runs the install, and
|
|
42
|
+
* reports it. Returns undefined when the user cancelled or a conflict aborted
|
|
43
|
+
* the write.
|
|
44
|
+
*/
|
|
45
|
+
async function runSkillInstall(options, command) {
|
|
46
|
+
const roots = parseRootOverrides(options.root);
|
|
47
|
+
const plan = await planSkillInstall({
|
|
48
|
+
cwd: options.cwd,
|
|
49
|
+
...(options.targets === undefined
|
|
50
|
+
? {}
|
|
51
|
+
: { explicitTargets: parseTargets(options.targets) }),
|
|
52
|
+
...(options.scope === undefined
|
|
53
|
+
? {}
|
|
54
|
+
: { explicitScope: parseScope(options.scope) }),
|
|
55
|
+
// Commander gives --prune a value either way, so ask where it came from.
|
|
56
|
+
...(command.getOptionValueSource("prune") === "cli"
|
|
57
|
+
? { explicitPrune: options.prune ?? false }
|
|
58
|
+
: {}),
|
|
59
|
+
roots,
|
|
60
|
+
yes: options.yes,
|
|
61
|
+
});
|
|
62
|
+
if (plan.cancelled) {
|
|
63
|
+
console.log("cancelled; nothing was written");
|
|
64
|
+
process.exitCode = 130;
|
|
65
|
+
return undefined;
|
|
66
|
+
}
|
|
67
|
+
const result = await installSkills({
|
|
68
|
+
cwd: options.cwd,
|
|
69
|
+
targets: plan.targets,
|
|
70
|
+
scopes: plan.scopes,
|
|
71
|
+
force: options.force,
|
|
72
|
+
pruneProject: plan.pruneProject,
|
|
73
|
+
roots,
|
|
74
|
+
});
|
|
75
|
+
reportInstall(result);
|
|
76
|
+
return result.aborted ? undefined : result;
|
|
77
|
+
}
|
|
78
|
+
function reportInstall(result) {
|
|
79
|
+
for (const path of result.installed)
|
|
80
|
+
console.log(`installed ${path}`);
|
|
81
|
+
for (const path of result.updated)
|
|
82
|
+
console.log(`updated ${path}`);
|
|
83
|
+
for (const path of result.skipped)
|
|
84
|
+
console.log(`unchanged ${path}`);
|
|
85
|
+
for (const path of result.pruned)
|
|
86
|
+
console.log(`removed ${path}`);
|
|
87
|
+
for (const path of result.retired) {
|
|
88
|
+
console.log(`retired ${path}; its work is now a CLI command`);
|
|
89
|
+
}
|
|
90
|
+
for (const path of result.retiredKept) {
|
|
91
|
+
console.warn(`warning kept ${path}; this skill is retired but you edited it, so it was left alone — delete it when you have salvaged anything you need.`);
|
|
92
|
+
}
|
|
93
|
+
for (const path of result.pruneSkipped) {
|
|
94
|
+
console.warn(`warning kept ${path}; edited since generation, so it still shadows the user-scope skill`);
|
|
95
|
+
}
|
|
96
|
+
for (const warning of result.warnings) {
|
|
97
|
+
const ownership = warning.packageManaged ? "package-managed" : "external";
|
|
98
|
+
console.warn(`warning ${warning.scope} ${warning.target} ${warning.kind} (${ownership}) for ${warning.workflow}: ${warning.path}`);
|
|
99
|
+
}
|
|
100
|
+
for (const path of result.conflicts)
|
|
101
|
+
console.warn(`conflict ${path}`);
|
|
102
|
+
if (result.aborted) {
|
|
103
|
+
console.warn("installation aborted before writing files; resolve conflicts or re-run with --force");
|
|
104
|
+
}
|
|
105
|
+
if (result.conflicts.length > 0)
|
|
106
|
+
process.exitCode = 1;
|
|
107
|
+
}
|
|
108
|
+
const program = new Command()
|
|
13
109
|
.name("nightshift")
|
|
14
110
|
.description("The crew that builds while you're gone: walk-away engineering programs " +
|
|
15
111
|
"with a decision ledger instead of gates.")
|
|
16
112
|
.version(await packageVersion());
|
|
17
|
-
program
|
|
113
|
+
program
|
|
114
|
+
.command("init")
|
|
115
|
+
.description("Initialize or adopt a project with the nightshift structure")
|
|
116
|
+
.option("--name <name>", "Project name (default: package.json name)")
|
|
117
|
+
.option("--stack <stack>", "Primary language and technology stack (default: detected from the repository)")
|
|
118
|
+
.option("--description <description>", "One-line product description (default: package.json description)")
|
|
119
|
+
.option("--cwd <path>", "Project directory", process.cwd())
|
|
120
|
+
.option("--directives <path>", "Universal directives override file (defaults to ~/.nightshift/universal-directives.md, then the packaged template)")
|
|
121
|
+
.action(async (options) => {
|
|
122
|
+
const result = await initProject({
|
|
123
|
+
cwd: options.cwd,
|
|
124
|
+
...(options.name === undefined ? {} : { name: options.name }),
|
|
125
|
+
...(options.stack === undefined ? {} : { stack: options.stack }),
|
|
126
|
+
...(options.description === undefined
|
|
127
|
+
? {}
|
|
128
|
+
: { description: options.description }),
|
|
129
|
+
...(options.directives === undefined
|
|
130
|
+
? {}
|
|
131
|
+
: { directivesPath: options.directives }),
|
|
132
|
+
});
|
|
133
|
+
for (const path of result.created)
|
|
134
|
+
console.log(`created ${path}`);
|
|
135
|
+
for (const path of result.updated)
|
|
136
|
+
console.log(`updated ${path}`);
|
|
137
|
+
for (const path of result.skipped)
|
|
138
|
+
console.log(`skipped ${path}`);
|
|
139
|
+
for (const warning of result.warnings)
|
|
140
|
+
console.warn(`warning ${warning}`);
|
|
141
|
+
});
|
|
142
|
+
withSkillOptions(program
|
|
143
|
+
.command("install")
|
|
144
|
+
.description("Install portable workflow skills for the agent tools on this machine")).action(async (options, command) => {
|
|
145
|
+
await runSkillInstall(options, command);
|
|
146
|
+
});
|
|
147
|
+
withSkillOptions(program
|
|
148
|
+
.command("setup")
|
|
149
|
+
.description("One-step setup: add the package as a devDependency and install workflow skills"))
|
|
150
|
+
.option("--pm <manager>", `Package manager for the devDependency: ${PACKAGE_MANAGERS.join(", ")} (default: detected from the repository)`)
|
|
151
|
+
.option("--no-package-json", "Do not create a placeholder package.json when the directory has none")
|
|
152
|
+
.action(async (options, command) => {
|
|
153
|
+
const root = resolve(options.cwd);
|
|
154
|
+
if (options.packageJson && !existsSync(join(root, "package.json"))) {
|
|
155
|
+
const manifest = await createProjectManifest(root);
|
|
156
|
+
if (manifest.created) {
|
|
157
|
+
console.log(`created package.json (private placeholder, name "${manifest.name}")`);
|
|
158
|
+
}
|
|
159
|
+
else if (manifest.reason === "foreign manifest") {
|
|
160
|
+
console.warn(`warning ${manifest.foreignManifest} found; skipped creating a package.json for a non-Node project`);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
let addedDependency = false;
|
|
164
|
+
if (existsSync(join(root, "package.json"))) {
|
|
165
|
+
const manager = options.pm === undefined
|
|
166
|
+
? detectPackageManager(root)
|
|
167
|
+
: parsePackageManager(options.pm);
|
|
168
|
+
console.log(`adding @wildorder/nightshift as a devDependency with ${manager}`);
|
|
169
|
+
const exitCode = await new Promise((resolvePromise, rejectPromise) => {
|
|
170
|
+
const child = spawn(addDevDependencyCommand(manager, "@wildorder/nightshift", {
|
|
171
|
+
pnpmWorkspaceRoot: isPnpmWorkspaceRoot(root),
|
|
172
|
+
}), { cwd: root, shell: true, stdio: "inherit", windowsHide: true });
|
|
173
|
+
child.on("error", rejectPromise);
|
|
174
|
+
child.on("close", (code) => resolvePromise(code ?? 1));
|
|
175
|
+
});
|
|
176
|
+
if (exitCode !== 0) {
|
|
177
|
+
console.error(`${manager} install failed; skills were not installed. Fix the ${manager} error and re-run setup (use --pm to override the detected package manager).`);
|
|
178
|
+
process.exitCode = 1;
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
addedDependency = true;
|
|
182
|
+
}
|
|
183
|
+
else {
|
|
184
|
+
console.warn("warning no package.json found; skipped adding the devDependency (run the CLI via npx @wildorder/nightshift)");
|
|
185
|
+
}
|
|
186
|
+
// The dependency install just replaced this package's own files on
|
|
187
|
+
// disk, but this process is still running the code it loaded before
|
|
188
|
+
// that happened. Continuing in-process applies the *old* version's
|
|
189
|
+
// notion of which skills exist to the *new* version's files, which
|
|
190
|
+
// breaks outright the moment a release adds or retires one. Hand off to
|
|
191
|
+
// the CLI that was just installed.
|
|
192
|
+
const upgraded = localCliPath(root);
|
|
193
|
+
if (addedDependency && existsSync(upgraded)) {
|
|
194
|
+
const exitCode = await new Promise((resolvePromise, rejectPromise) => {
|
|
195
|
+
const child = spawn(process.execPath, [
|
|
196
|
+
upgraded,
|
|
197
|
+
...installArgv({ ...options, cwd: root }, command.getOptionValueSource("prune") === "cli"),
|
|
198
|
+
], { cwd: root, stdio: "inherit", windowsHide: true });
|
|
199
|
+
child.on("error", rejectPromise);
|
|
200
|
+
child.on("close", (code) => resolvePromise(code ?? 1));
|
|
201
|
+
});
|
|
202
|
+
if (exitCode !== 0) {
|
|
203
|
+
process.exitCode = exitCode;
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
console.log("setup complete; run /init-project from your agent to continue");
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
const result = await runSkillInstall({ ...options, cwd: root }, command);
|
|
210
|
+
if (result) {
|
|
211
|
+
console.log("setup complete; run /init-project from your agent to continue");
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
program
|
|
215
|
+
.command("run")
|
|
216
|
+
.description("Run a planned program to termination: build every workstream, journal " +
|
|
217
|
+
"every decision, park failures, and write the run report")
|
|
218
|
+
.argument("<program-id>", "Program ID from /plan-program")
|
|
219
|
+
.option("--cwd <path>", "Project directory", process.cwd())
|
|
220
|
+
.action(async (programId, options) => {
|
|
221
|
+
const { config } = await loadConfig(resolve(options.cwd));
|
|
222
|
+
const result = await runProgram({
|
|
223
|
+
cwd: options.cwd,
|
|
224
|
+
programId,
|
|
225
|
+
config,
|
|
226
|
+
});
|
|
227
|
+
const built = result.workstreams.filter((entry) => entry.outcome.status === "complete" ||
|
|
228
|
+
entry.outcome.status === "skipped").length;
|
|
229
|
+
console.log(`\n${built} of ${result.workstreams.length} workstreams built; ` +
|
|
230
|
+
`${result.escalations.length} decision(s) escalated for you.`);
|
|
231
|
+
console.log(`read the run report: ${result.reportPath}`);
|
|
232
|
+
if (!result.complete)
|
|
233
|
+
process.exitCode = 1;
|
|
234
|
+
});
|
|
235
|
+
program
|
|
236
|
+
.command("doctor")
|
|
237
|
+
.description("Verify packaged assets and print the resolved skills root for each target")
|
|
238
|
+
.option("--root <target=path>", "Override a target's skills root; repeatable", collect, [])
|
|
239
|
+
.action(async (options) => {
|
|
240
|
+
const detected = await detectTargets({
|
|
241
|
+
roots: parseRootOverrides(options.root),
|
|
242
|
+
});
|
|
243
|
+
const width = Math.max(...detected.map((entry) => entry.label.length));
|
|
244
|
+
console.log("skills roots");
|
|
245
|
+
for (const entry of detected) {
|
|
246
|
+
const state = entry.detected ? "detected" : "not detected";
|
|
247
|
+
console.log(` ${entry.label.padEnd(width)} ${entry.userRoot} [${state}, ${entry.source}]`);
|
|
248
|
+
}
|
|
249
|
+
console.log(`\noverride any row with --root <target>=<path> or ${overrideEnvName(ALL_TARGETS[0] ?? "claude")}-style environment variables\n`);
|
|
250
|
+
const problems = await doctor();
|
|
251
|
+
if (problems.length === 0) {
|
|
252
|
+
console.log("nightshift package is healthy.");
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
255
|
+
for (const problem of problems)
|
|
256
|
+
console.error(problem);
|
|
257
|
+
process.exitCode = 1;
|
|
258
|
+
});
|
|
259
|
+
await program.parseAsync();
|
|
18
260
|
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,QAAQ,E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AC5B,KAAK,MAAM,KAAK,IAAI,QAAQ,EAAE,CAAC;QAC7B,MAAM,KAAK,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,cAAc,CAAC;QAC3D,OAAO,CAAC,GAAG,CACT,KAAK,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,KAAK,CAAC,QAAQ,MAAM,KAAK,KAAK,KAAK,CAAC,MAAM,GAAG,CACjF,CAAC;IACJ,CAAC;IACD,OAAO,CAAC,GAAG,CACT,qDAAqD,eAAe,CAClE,WAAW,CAAC,CAAC,CAAC,IAAI,QAAQ,CAC3B,gCAAgC,CAClC,CAAC;IAEF,MAAM,QAAQ,GAAG,MAAM,MAAM,EAAE,CAAC;IAChC,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC1B,OAAO,CAAC,GAAG,CAAC,gCAAgC,CAAC,CAAC;QAC9C,OAAO;IACT,CAAC;IACD,KAAK,MAAM,OAAO,IAAI,QAAQ;QAAE,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACvD,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;AACvB,CAAC,CAAC,CAAC;AAEL,MAAM,OAAO,CAAC,UAAU,EAAE,CAAC"}
|
package/dist/config.d.ts
CHANGED
|
@@ -23,6 +23,8 @@ export type AgentConfig = z.infer<typeof agentSchema>;
|
|
|
23
23
|
* the runner recover from a primary token, quota, or session failure.
|
|
24
24
|
*/
|
|
25
25
|
declare const configSchema: z.ZodObject<{
|
|
26
|
+
schemaVersion: z.ZodOptional<z.ZodLiteral<1>>;
|
|
27
|
+
nightshiftVersion: z.ZodOptional<z.ZodString>;
|
|
26
28
|
agent: z.ZodOptional<z.ZodObject<{
|
|
27
29
|
command: z.ZodString;
|
|
28
30
|
args: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
@@ -56,6 +58,8 @@ declare const configSchema: z.ZodObject<{
|
|
|
56
58
|
}>>;
|
|
57
59
|
}, z.core.$strip>>;
|
|
58
60
|
verify: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
61
|
+
visionPath: z.ZodDefault<z.ZodString>;
|
|
62
|
+
contextDocs: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
59
63
|
}, z.core.$strip>;
|
|
60
64
|
export type NightshiftConfig = z.infer<typeof configSchema>;
|
|
61
65
|
export declare const DEFAULT_CONFIG: NightshiftConfig;
|
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,sBAAsB,2BAA2B,CAAC;AAE/D,QAAA,MAAM,WAAW;;;;;;;iBAIf,CAAC;AAEH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEtD;;;;;;;;;;;;GAYG;AACH,QAAA,MAAM,YAAY
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,sBAAsB,2BAA2B,CAAC;AAE/D,QAAA,MAAM,WAAW;;;;;;;iBAIf,CAAC;AAEH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEtD;;;;;;;;;;;;GAYG;AACH,QAAA,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAchB,CAAC;AAEH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAE5D,eAAO,MAAM,cAAc,EAAE,gBAAyC,CAAC;AAEvE,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,gBAAgB,CAAC;IACzB,iEAAiE;IACjE,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;;GAIG;AACH,wBAAsB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,CAyBnE"}
|
package/dist/config.js
CHANGED
|
@@ -21,12 +21,19 @@ const agentSchema = z.object({
|
|
|
21
21
|
* the runner recover from a primary token, quota, or session failure.
|
|
22
22
|
*/
|
|
23
23
|
const configSchema = z.object({
|
|
24
|
+
schemaVersion: z.literal(1).optional(),
|
|
25
|
+
/** The package version that scaffolded this project, for support triage. */
|
|
26
|
+
nightshiftVersion: z.string().optional(),
|
|
24
27
|
agent: agentSchema.optional(),
|
|
25
28
|
deciderAgent: agentSchema.optional(),
|
|
26
29
|
reviewerAgent: agentSchema.optional(),
|
|
27
30
|
recoveryAgent: agentSchema.optional(),
|
|
28
31
|
/** Named verification commands run by the runner itself, never by agents. */
|
|
29
32
|
verify: z.record(z.string(), z.string()).default({}),
|
|
33
|
+
/** The anchor product vision document, read by planning. */
|
|
34
|
+
visionPath: z.string().default("docs/vision.md"),
|
|
35
|
+
/** Extra human-authored documents planning should read. */
|
|
36
|
+
contextDocs: z.array(z.string()).default([]),
|
|
30
37
|
});
|
|
31
38
|
export const DEFAULT_CONFIG = configSchema.parse({});
|
|
32
39
|
/**
|
package/dist/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,sBAAsB,GAAG,wBAAwB,CAAC;AAE/D,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3B,OAAO,EAA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E,cAAc,EAAE,CAAC;IACpC,CAAC;IACD,IAAI,MAAe,CAAC;IACpB,IAAI,CAAC;QACH,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC3B,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CACb,GAAG,sBAAsB,uBAAwB,KAAe,CAAC,OAAO,EAAE,EAC1E,EAAE,KAAK,EAAE,KAAK,EAAE,CACjB,CAAC;IACJ,CAAC;IACD,MAAM,MAAM,GAAG,YAAY,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IAC9C,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACpB,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM;aAC/B,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,QAAQ,KAAK,KAAK,CAAC,OAAO,EAAE,CAAC;aACvE,IAAI,CAAC,IAAI,CAAC,CAAC;QACd,MAAM,IAAI,KAAK,CAAC,GAAG,sBAAsB,gBAAgB,MAAM,EAAE,CAAC,CAAC;IACrE,CAAC;IACD,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC;AACvC,CAAC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { DecisionBlock } from "./decision.js";
|
|
2
|
+
/**
|
|
3
|
+
* The decision ledger: an append-only JSONL journal per program, the durable
|
|
4
|
+
* record of every judgment call a run made, who reviewed it, and what a
|
|
5
|
+
* human overrode. Only the runner writes it; agents receive projections in
|
|
6
|
+
* their briefs and the human reads it through the run report.
|
|
7
|
+
*
|
|
8
|
+
* Authority is a chain, never a dialogue: human > decider > implementer
|
|
9
|
+
* default. A later event with more authority supersedes an earlier one; no
|
|
10
|
+
* event is ever rewritten or removed. Reads are fail-open — a missing or
|
|
11
|
+
* partially corrupt journal degrades to what could be read, never to a
|
|
12
|
+
* blocked run — because the ledger explains work, it does not gate it.
|
|
13
|
+
*/
|
|
14
|
+
export declare const LEDGER_SCHEMA_VERSION = 1;
|
|
15
|
+
interface EventBase {
|
|
16
|
+
at: string;
|
|
17
|
+
/** Stable decision identity from {@link decisionFingerprint}. */
|
|
18
|
+
id: string;
|
|
19
|
+
}
|
|
20
|
+
export type LedgerEvent = (EventBase & {
|
|
21
|
+
kind: "decision-recorded";
|
|
22
|
+
workstream: string;
|
|
23
|
+
decision: DecisionBlock;
|
|
24
|
+
/** Commit the tree was at before the deciding attempt started. */
|
|
25
|
+
baseCommit?: string;
|
|
26
|
+
decidedBy: "implementer";
|
|
27
|
+
}) | (EventBase & {
|
|
28
|
+
kind: "decision-reviewed";
|
|
29
|
+
verdict: "ratify" | "escalate";
|
|
30
|
+
rationale: string;
|
|
31
|
+
reviewedBy: "decider";
|
|
32
|
+
}) | (EventBase & {
|
|
33
|
+
kind: "decision-human";
|
|
34
|
+
/** The option label the human settled on. */
|
|
35
|
+
chosen: string;
|
|
36
|
+
reason: string;
|
|
37
|
+
});
|
|
38
|
+
export type DecisionStatus = "unratified" | "ratified" | "escalated" | "human-decided";
|
|
39
|
+
export interface DecisionRecord {
|
|
40
|
+
id: string;
|
|
41
|
+
workstream: string;
|
|
42
|
+
decision: DecisionBlock;
|
|
43
|
+
baseCommit?: string;
|
|
44
|
+
status: DecisionStatus;
|
|
45
|
+
/** Present when a decider reviewed it. */
|
|
46
|
+
reviewRationale?: string;
|
|
47
|
+
/** Present when a human decided; overrides the block's `chosen`. */
|
|
48
|
+
humanChosen?: string;
|
|
49
|
+
humanReason?: string;
|
|
50
|
+
/** True when the agent claimed the choice is costly to undo. */
|
|
51
|
+
oneWay: boolean;
|
|
52
|
+
}
|
|
53
|
+
export interface DecisionLedgerView {
|
|
54
|
+
decisions: DecisionRecord[];
|
|
55
|
+
/** Journal lines that could not be read; reported, never fatal. */
|
|
56
|
+
corrupt: number;
|
|
57
|
+
}
|
|
58
|
+
export declare function ledgerPath(root: string, programId: string): string;
|
|
59
|
+
export declare function appendLedgerEvents(root: string, programId: string, events: LedgerEvent[]): Promise<void>;
|
|
60
|
+
export declare function reduceLedgerEvents(events: LedgerEvent[]): DecisionLedgerView;
|
|
61
|
+
/**
|
|
62
|
+
* Read and reduce the journal. Fail-open: a missing file is an empty ledger,
|
|
63
|
+
* and an unreadable line is counted rather than thrown — the ledger explains
|
|
64
|
+
* work, it never blocks it.
|
|
65
|
+
*/
|
|
66
|
+
export declare function readDecisionLedger(root: string, programId: string): Promise<DecisionLedgerView>;
|
|
67
|
+
export {};
|
|
68
|
+
//# sourceMappingURL=decision-ledger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decision-ledger.d.ts","sourceRoot":"","sources":["../src/decision-ledger.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAEnD;;;;;;;;;;;GAWG;AAEH,eAAO,MAAM,qBAAqB,IAAI,CAAC;AAEvC,UAAU,SAAS;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,iEAAiE;IACjE,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,MAAM,MAAM,WAAW,GACnB,CAAC,SAAS,GAAG;IACX,IAAI,EAAE,mBAAmB,CAAC;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,aAAa,CAAC;IACxB,kEAAkE;IAClE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,aAAa,CAAC;CAC1B,CAAC,GACF,CAAC,SAAS,GAAG;IACX,IAAI,EAAE,mBAAmB,CAAC;IAC1B,OAAO,EAAE,QAAQ,GAAG,UAAU,CAAC;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,SAAS,CAAC;CACvB,CAAC,GACF,CAAC,SAAS,GAAG;IACX,IAAI,EAAE,gBAAgB,CAAC;IACvB,6CAA6C;IAC7C,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC,CAAC;AAEP,MAAM,MAAM,cAAc,GACtB,YAAY,GACZ,UAAU,GACV,WAAW,GACX,eAAe,CAAC;AAEpB,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,aAAa,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,cAAc,CAAC;IACvB,0CAA0C;IAC1C,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,oEAAoE;IACpE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gEAAgE;IAChE,MAAM,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,cAAc,EAAE,CAAC;IAC5B,mEAAmE;IACnE,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAOlE;AAED,wBAAsB,kBAAkB,CACtC,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,WAAW,EAAE,GACpB,OAAO,CAAC,IAAI,CAAC,CAUf;AAED,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,WAAW,EAAE,GAAG,kBAAkB,CA8C5E;AAED;;;;GAIG;AACH,wBAAsB,kBAAkB,CACtC,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,kBAAkB,CAAC,CA0B7B"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { appendFile, mkdir, readFile } from "node:fs/promises";
|
|
2
|
+
import { dirname, join, resolve } from "node:path";
|
|
3
|
+
/**
|
|
4
|
+
* The decision ledger: an append-only JSONL journal per program, the durable
|
|
5
|
+
* record of every judgment call a run made, who reviewed it, and what a
|
|
6
|
+
* human overrode. Only the runner writes it; agents receive projections in
|
|
7
|
+
* their briefs and the human reads it through the run report.
|
|
8
|
+
*
|
|
9
|
+
* Authority is a chain, never a dialogue: human > decider > implementer
|
|
10
|
+
* default. A later event with more authority supersedes an earlier one; no
|
|
11
|
+
* event is ever rewritten or removed. Reads are fail-open — a missing or
|
|
12
|
+
* partially corrupt journal degrades to what could be read, never to a
|
|
13
|
+
* blocked run — because the ledger explains work, it does not gate it.
|
|
14
|
+
*/
|
|
15
|
+
export const LEDGER_SCHEMA_VERSION = 1;
|
|
16
|
+
export function ledgerPath(root, programId) {
|
|
17
|
+
return join(resolve(root), "docs", "programs", `${programId}-decisions.jsonl`);
|
|
18
|
+
}
|
|
19
|
+
export async function appendLedgerEvents(root, programId, events) {
|
|
20
|
+
if (events.length === 0)
|
|
21
|
+
return;
|
|
22
|
+
const path = ledgerPath(root, programId);
|
|
23
|
+
await mkdir(dirname(path), { recursive: true });
|
|
24
|
+
const lines = events
|
|
25
|
+
.map((event) => JSON.stringify({ schemaVersion: LEDGER_SCHEMA_VERSION, ...event }))
|
|
26
|
+
.join("\n");
|
|
27
|
+
await appendFile(path, `${lines}\n`, "utf8");
|
|
28
|
+
}
|
|
29
|
+
export function reduceLedgerEvents(events) {
|
|
30
|
+
const byId = new Map();
|
|
31
|
+
for (const event of events) {
|
|
32
|
+
if (event.kind === "decision-recorded") {
|
|
33
|
+
const existing = byId.get(event.id);
|
|
34
|
+
// A re-recorded decision (retry, resumed run) refreshes the block but
|
|
35
|
+
// keeps any higher-authority outcome already on the record.
|
|
36
|
+
byId.set(event.id, {
|
|
37
|
+
id: event.id,
|
|
38
|
+
workstream: event.workstream,
|
|
39
|
+
decision: event.decision,
|
|
40
|
+
...(event.baseCommit === undefined
|
|
41
|
+
? {}
|
|
42
|
+
: { baseCommit: event.baseCommit }),
|
|
43
|
+
status: existing?.status ?? "unratified",
|
|
44
|
+
...(existing?.reviewRationale === undefined
|
|
45
|
+
? {}
|
|
46
|
+
: { reviewRationale: existing.reviewRationale }),
|
|
47
|
+
...(existing?.humanChosen === undefined
|
|
48
|
+
? {}
|
|
49
|
+
: { humanChosen: existing.humanChosen }),
|
|
50
|
+
...(existing?.humanReason === undefined
|
|
51
|
+
? {}
|
|
52
|
+
: { humanReason: existing.humanReason }),
|
|
53
|
+
oneWay: event.decision.reversible === false,
|
|
54
|
+
});
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
const record = byId.get(event.id);
|
|
58
|
+
if (!record)
|
|
59
|
+
continue;
|
|
60
|
+
if (event.kind === "decision-reviewed") {
|
|
61
|
+
// Human authority already on the record outranks a decider review.
|
|
62
|
+
if (record.status === "human-decided")
|
|
63
|
+
continue;
|
|
64
|
+
record.status = event.verdict === "ratify" ? "ratified" : "escalated";
|
|
65
|
+
record.reviewRationale = event.rationale;
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
record.status = "human-decided";
|
|
69
|
+
record.humanChosen = event.chosen;
|
|
70
|
+
record.humanReason = event.reason;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return { decisions: [...byId.values()], corrupt: 0 };
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Read and reduce the journal. Fail-open: a missing file is an empty ledger,
|
|
77
|
+
* and an unreadable line is counted rather than thrown — the ledger explains
|
|
78
|
+
* work, it never blocks it.
|
|
79
|
+
*/
|
|
80
|
+
export async function readDecisionLedger(root, programId) {
|
|
81
|
+
let raw;
|
|
82
|
+
try {
|
|
83
|
+
raw = await readFile(ledgerPath(root, programId), "utf8");
|
|
84
|
+
}
|
|
85
|
+
catch {
|
|
86
|
+
return { decisions: [], corrupt: 0 };
|
|
87
|
+
}
|
|
88
|
+
const events = [];
|
|
89
|
+
let corrupt = 0;
|
|
90
|
+
for (const line of raw.split(/\r?\n/u)) {
|
|
91
|
+
if (line.trim() === "")
|
|
92
|
+
continue;
|
|
93
|
+
try {
|
|
94
|
+
const parsed = JSON.parse(line);
|
|
95
|
+
if (typeof parsed.kind !== "string" || typeof parsed.id !== "string") {
|
|
96
|
+
corrupt += 1;
|
|
97
|
+
continue;
|
|
98
|
+
}
|
|
99
|
+
events.push(parsed);
|
|
100
|
+
}
|
|
101
|
+
catch {
|
|
102
|
+
corrupt += 1;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
const view = reduceLedgerEvents(events);
|
|
106
|
+
return { ...view, corrupt };
|
|
107
|
+
}
|
|
108
|
+
//# sourceMappingURL=decision-ledger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decision-ledger.js","sourceRoot":"","sources":["../src/decision-ledger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGnD;;;;;;;;;;;GAWG;AAEH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC;AAyDvC,MAAM,UAAU,UAAU,CAAC,IAAY,EAAE,SAAiB;IACxD,OAAO,IAAI,CACT,OAAO,CAAC,IAAI,CAAC,EACb,MAAM,EACN,UAAU,EACV,GAAG,SAAS,kBAAkB,CAC/B,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,IAAY,EACZ,SAAiB,EACjB,MAAqB;IAErB,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO;IAChC,MAAM,IAAI,GAAG,UAAU,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IACzC,MAAM,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAChD,MAAM,KAAK,GAAG,MAAM;SACjB,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CACb,IAAI,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AAC;IAED,MAAM,MAAM,GAAkB,EAAE,CAAC;IACjC,IAAI,OAAO,GAAG,CAAC,CAAC;IAChB,KAAK,MAAM,IAAI,IAAI,GAAG,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC;QACvC,IAAI,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE;YAAE,SAAS;QACjC,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAoC,CAAC;YACnE,IAAI,OAAO,MAAM,CAAC,IAAI,KAAK,QAAQ,IAAI,OAAO,MAAM,CAAC,EAAE,KAAK,QAAQ,EAAE,CAAC;gBACrE,OAAO,IAAI,CAAC,CAAC;gBACb,SAAS;YACX,CAAC;YACD,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACtB,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,IAAI,CAAC,CAAC;QACf,CAAC;IACH,CAAC;IAED,MAAM,IAAI,GAAG,kBAAkB,CAAC,MAAM,CAAC,CAAC;IACxC,OAAO,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,CAAC;AAC9B,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* The decision block: how an agent surfaces a judgment call it made while
|
|
4
|
+
* working. Decisions are the unit the whole system is organized around —
|
|
5
|
+
* they are journaled to the ledger with the commit that preceded them,
|
|
6
|
+
* reviewed by the decider, reported to the human, and reversible by replay.
|
|
7
|
+
*
|
|
8
|
+
* The agent CLAIMS reversibility; it does not get to classify the door.
|
|
9
|
+
* `reversible: false` is a signal that the runner treats as one-way (schema
|
|
10
|
+
* migrations, public API shapes, deletions), and the decider or a human can
|
|
11
|
+
* disagree in either direction. Absent means two-way, because most decisions
|
|
12
|
+
* are, and because the cost of misclassifying a two-way door as one-way is a
|
|
13
|
+
* needless escalation while the reverse is a journaled, replayable mistake.
|
|
14
|
+
*/
|
|
15
|
+
declare const decisionOptionSchema: z.ZodObject<{
|
|
16
|
+
label: z.ZodString;
|
|
17
|
+
description: z.ZodOptional<z.ZodString>;
|
|
18
|
+
}, z.core.$strip>;
|
|
19
|
+
declare const decisionBlockSchema: z.ZodObject<{
|
|
20
|
+
title: z.ZodString;
|
|
21
|
+
context: z.ZodString;
|
|
22
|
+
options: z.ZodArray<z.ZodObject<{
|
|
23
|
+
label: z.ZodString;
|
|
24
|
+
description: z.ZodOptional<z.ZodString>;
|
|
25
|
+
}, z.core.$strip>>;
|
|
26
|
+
chosen: z.ZodString;
|
|
27
|
+
rationale: z.ZodString;
|
|
28
|
+
reversible: z.ZodOptional<z.ZodBoolean>;
|
|
29
|
+
}, z.core.$strip>;
|
|
30
|
+
export type DecisionOption = z.infer<typeof decisionOptionSchema>;
|
|
31
|
+
export type DecisionBlock = z.infer<typeof decisionBlockSchema>;
|
|
32
|
+
export interface ParsedDecisions {
|
|
33
|
+
decisions: DecisionBlock[];
|
|
34
|
+
/**
|
|
35
|
+
* Malformed blocks, described. Never fatal: a decision an agent garbled is
|
|
36
|
+
* still visible here and in the raw log, and failing verified work over a
|
|
37
|
+
* formatting slip trades a real result for a cosmetic one. These land in
|
|
38
|
+
* the run report so a human sees what the machine could not read.
|
|
39
|
+
*/
|
|
40
|
+
errors: string[];
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Every fenced ```decision block in an agent's output, in order. A block
|
|
44
|
+
* whose JSON is malformed, whose shape is wrong, or whose `chosen` names no
|
|
45
|
+
* option is reported in `errors` rather than dropped silently.
|
|
46
|
+
*/
|
|
47
|
+
export declare function extractDecisions(output: string): ParsedDecisions;
|
|
48
|
+
/**
|
|
49
|
+
* Stable identity for a decision: the same judgment call re-surfaced by a
|
|
50
|
+
* retry or a resumed run lands on the same ledger entry instead of a
|
|
51
|
+
* duplicate. Chosen option is deliberately not part of the identity — a
|
|
52
|
+
* replay that picks the other option is the same decision, decided
|
|
53
|
+
* differently.
|
|
54
|
+
*/
|
|
55
|
+
export declare function decisionFingerprint(workstream: string, decision: Pick<DecisionBlock, "title">): string;
|
|
56
|
+
/** The contract text, composed into every implementer brief. */
|
|
57
|
+
export declare function decisionContract(): string;
|
|
58
|
+
export {};
|
|
59
|
+
//# sourceMappingURL=decision.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decision.d.ts","sourceRoot":"","sources":["../src/decision.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;;;;;;GAYG;AACH,QAAA,MAAM,oBAAoB;;;iBAGxB,CAAC;AAEH,QAAA,MAAM,mBAAmB;;;;;;;;;;iBAOvB,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAClE,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEhE,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,aAAa,EAAE,CAAC;IAC3B;;;;;OAKG;IACH,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAID;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,eAAe,CAsChE;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CACjC,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,IAAI,CAAC,aAAa,EAAE,OAAO,CAAC,GACrC,MAAM,CAKR;AAiCD,gEAAgE;AAChE,wBAAgB,gBAAgB,IAAI,MAAM,CAEzC"}
|
package/dist/decision.js
ADDED
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decision.js","sourceRoot":"","sources":["../src/decision.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;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,EAAE,EAAE,CAAC;SAC9D,MAAM,CAAC,KAAK,CAAC;SACb,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;AAClB,CAAC;AAED,MAAM,QAAQ,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6BhB,CAAC,IAAI,EAAE,CAAC;AAET,gEAAgE;AAChE,MAAM,UAAU,gBAAgB;IAC9B,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -7,4 +7,13 @@ export * from "./project-manifest.js";
|
|
|
7
7
|
export * from "./program-memory.js";
|
|
8
8
|
export * from "./worktree-guard.js";
|
|
9
9
|
export * from "./detect-package-manager.js";
|
|
10
|
+
export * from "./decision.js";
|
|
11
|
+
export * from "./decision-ledger.js";
|
|
12
|
+
export * from "./manifest.js";
|
|
13
|
+
export * from "./run-program.js";
|
|
14
|
+
export * from "./init-project.js";
|
|
15
|
+
export * from "./install-skills.js";
|
|
16
|
+
export * from "./install-prefs.js";
|
|
17
|
+
export * from "./install-wizard.js";
|
|
18
|
+
export * from "./package-assets.js";
|
|
10
19
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,6BAA6B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC"}
|