intentdna 1.2.2 → 1.2.3
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/audit/index.d.ts +0 -1
- package/dist/audit/index.js +0 -1
- package/dist/cli/commands/compile.d.ts +0 -1
- package/dist/cli/commands/compile.js +0 -1
- package/dist/cli/commands/epigenetic.d.ts +0 -1
- package/dist/cli/commands/epigenetic.js +0 -1
- package/dist/cli/commands/evolve.d.ts +0 -1
- package/dist/cli/commands/evolve.js +0 -1
- package/dist/cli/commands/guard.d.ts +0 -1
- package/dist/cli/commands/guard.js +0 -3
- package/dist/cli/commands/import.d.ts +0 -1
- package/dist/cli/commands/import.js +0 -1
- package/dist/cli/commands/init.d.ts +0 -1
- package/dist/cli/commands/init.js +0 -1
- package/dist/cli/commands/run.d.ts +0 -1
- package/dist/cli/commands/run.js +4 -27
- package/dist/cli/commands/show.d.ts +0 -1
- package/dist/cli/commands/show.js +0 -1
- package/dist/cli/commands/sync.d.ts +1 -1
- package/dist/cli/commands/sync.js +57 -32
- package/dist/cli/commands/validate.d.ts +0 -1
- package/dist/cli/commands/validate.js +0 -1
- package/dist/cli/commands/verify.d.ts +0 -1
- package/dist/cli/commands/verify.js +0 -1
- package/dist/cli/index.d.ts +0 -1
- package/dist/cli/index.js +2 -1
- package/dist/cli/util/format.d.ts +0 -1
- package/dist/cli/util/format.js +0 -1
- package/dist/cli/util/prompt.d.ts +0 -1
- package/dist/cli/util/prompt.js +0 -1
- package/dist/compiler/activate.d.ts +0 -1
- package/dist/compiler/activate.js +0 -1
- package/dist/compiler/cascade.d.ts +1 -3
- package/dist/compiler/cascade.js +1 -10
- package/dist/compiler/compile.d.ts +0 -1
- package/dist/compiler/compile.js +3 -17
- package/dist/compiler/index.d.ts +0 -1
- package/dist/compiler/index.js +0 -1
- package/dist/compiler/workflow.d.ts +0 -1
- package/dist/compiler/workflow.js +0 -2
- package/dist/evolution/collector.d.ts +0 -1
- package/dist/evolution/collector.js +0 -1
- package/dist/evolution/fitness.d.ts +0 -1
- package/dist/evolution/fitness.js +0 -1
- package/dist/evolution/index.d.ts +0 -1
- package/dist/evolution/index.js +0 -1
- package/dist/evolution/marker-gen.d.ts +0 -1
- package/dist/evolution/marker-gen.js +0 -1
- package/dist/evolution/store.d.ts +0 -1
- package/dist/evolution/store.js +0 -1
- package/dist/evolution/types.d.ts +0 -1
- package/dist/evolution/types.js +0 -1
- package/dist/hooks/cli.d.ts +17 -0
- package/dist/hooks/cli.js +134 -0
- package/dist/hooks/enforce.d.ts +68 -0
- package/dist/hooks/enforce.js +332 -0
- package/dist/hooks/index.d.ts +9 -0
- package/dist/hooks/index.js +12 -0
- package/dist/hooks/protocol.d.ts +70 -0
- package/dist/hooks/protocol.js +91 -0
- package/dist/hooks/state.d.ts +53 -0
- package/dist/hooks/state.js +93 -0
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/log/logger.d.ts +0 -1
- package/dist/log/logger.js +0 -1
- package/dist/runtime/agent-md.d.ts +0 -1
- package/dist/runtime/agent-md.js +95 -105
- package/dist/runtime/claude-sdk.d.ts +0 -1
- package/dist/runtime/claude-sdk.js +0 -1
- package/dist/runtime/index.d.ts +3 -3
- package/dist/runtime/index.js +2 -2
- package/dist/runtime/markdown.d.ts +0 -1
- package/dist/runtime/markdown.js +0 -1
- package/dist/runtime/plugin-adapter.d.ts +42 -0
- package/dist/runtime/plugin-adapter.js +77 -0
- package/dist/runtime/settings-adapter.d.ts +8 -9
- package/dist/runtime/settings-adapter.js +57 -46
- package/dist/runtime/skill-adapter.d.ts +0 -1
- package/dist/runtime/skill-adapter.js +94 -71
- package/dist/runtime/workflow-runner.d.ts +0 -1
- package/dist/runtime/workflow-runner.js +0 -14
- package/dist/schema/index.d.ts +0 -1
- package/dist/schema/index.js +0 -1
- package/dist/schema/types.d.ts +14 -20
- package/dist/schema/types.js +0 -1
- package/dist/schema/validate.d.ts +0 -1
- package/dist/schema/validate.js +3 -19
- package/dist/schema/yaml-parser.d.ts +0 -1
- package/dist/schema/yaml-parser.js +0 -1
- package/dist/templates/code-review-pipeline.dna.yaml +0 -11
- package/dist/templates/flutter-behavior-lock.dna.yaml +0 -16
- package/dist/templates/flutter-refactoring-rescue.dna.yaml +0 -12
- package/dist/templates/flutter-rewrite.dna.yaml +0 -27
- package/dist/templates/full-pipeline.dna.yaml +0 -25
- package/dist/templates/multi-perspective-review.dna.yaml +0 -12
- package/dist/templates/subagent-parallel.dna.yaml +0 -16
- package/package.json +3 -2
- package/dist/audit/index.d.ts.map +0 -1
- package/dist/audit/index.js.map +0 -1
- package/dist/cli/commands/compile.d.ts.map +0 -1
- package/dist/cli/commands/compile.js.map +0 -1
- package/dist/cli/commands/epigenetic.d.ts.map +0 -1
- package/dist/cli/commands/epigenetic.js.map +0 -1
- package/dist/cli/commands/evolve.d.ts.map +0 -1
- package/dist/cli/commands/evolve.js.map +0 -1
- package/dist/cli/commands/guard.d.ts.map +0 -1
- package/dist/cli/commands/guard.js.map +0 -1
- package/dist/cli/commands/import.d.ts.map +0 -1
- package/dist/cli/commands/import.js.map +0 -1
- package/dist/cli/commands/init.d.ts.map +0 -1
- package/dist/cli/commands/init.js.map +0 -1
- package/dist/cli/commands/run.d.ts.map +0 -1
- package/dist/cli/commands/run.js.map +0 -1
- package/dist/cli/commands/show.d.ts.map +0 -1
- package/dist/cli/commands/show.js.map +0 -1
- package/dist/cli/commands/sync.d.ts.map +0 -1
- package/dist/cli/commands/sync.js.map +0 -1
- package/dist/cli/commands/validate.d.ts.map +0 -1
- package/dist/cli/commands/validate.js.map +0 -1
- package/dist/cli/commands/verify.d.ts.map +0 -1
- package/dist/cli/commands/verify.js.map +0 -1
- package/dist/cli/index.d.ts.map +0 -1
- package/dist/cli/index.js.map +0 -1
- package/dist/cli/util/format.d.ts.map +0 -1
- package/dist/cli/util/format.js.map +0 -1
- package/dist/cli/util/prompt.d.ts.map +0 -1
- package/dist/cli/util/prompt.js.map +0 -1
- package/dist/compiler/activate.d.ts.map +0 -1
- package/dist/compiler/activate.js.map +0 -1
- package/dist/compiler/cascade.d.ts.map +0 -1
- package/dist/compiler/cascade.js.map +0 -1
- package/dist/compiler/compile.d.ts.map +0 -1
- package/dist/compiler/compile.js.map +0 -1
- package/dist/compiler/index.d.ts.map +0 -1
- package/dist/compiler/index.js.map +0 -1
- package/dist/compiler/workflow.d.ts.map +0 -1
- package/dist/compiler/workflow.js.map +0 -1
- package/dist/evolution/collector.d.ts.map +0 -1
- package/dist/evolution/collector.js.map +0 -1
- package/dist/evolution/fitness.d.ts.map +0 -1
- package/dist/evolution/fitness.js.map +0 -1
- package/dist/evolution/index.d.ts.map +0 -1
- package/dist/evolution/index.js.map +0 -1
- package/dist/evolution/marker-gen.d.ts.map +0 -1
- package/dist/evolution/marker-gen.js.map +0 -1
- package/dist/evolution/store.d.ts.map +0 -1
- package/dist/evolution/store.js.map +0 -1
- package/dist/evolution/types.d.ts.map +0 -1
- package/dist/evolution/types.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/log/logger.d.ts.map +0 -1
- package/dist/log/logger.js.map +0 -1
- package/dist/runtime/agent-md.d.ts.map +0 -1
- package/dist/runtime/agent-md.js.map +0 -1
- package/dist/runtime/claude-sdk.d.ts.map +0 -1
- package/dist/runtime/claude-sdk.js.map +0 -1
- package/dist/runtime/hooks.d.ts +0 -67
- package/dist/runtime/hooks.d.ts.map +0 -1
- package/dist/runtime/hooks.js +0 -785
- package/dist/runtime/hooks.js.map +0 -1
- package/dist/runtime/index.d.ts.map +0 -1
- package/dist/runtime/index.js.map +0 -1
- package/dist/runtime/markdown.d.ts.map +0 -1
- package/dist/runtime/markdown.js.map +0 -1
- package/dist/runtime/settings-adapter.d.ts.map +0 -1
- package/dist/runtime/settings-adapter.js.map +0 -1
- package/dist/runtime/skill-adapter.d.ts.map +0 -1
- package/dist/runtime/skill-adapter.js.map +0 -1
- package/dist/runtime/workflow-runner.d.ts.map +0 -1
- package/dist/runtime/workflow-runner.js.map +0 -1
- package/dist/schema/index.d.ts.map +0 -1
- package/dist/schema/index.js.map +0 -1
- package/dist/schema/types.d.ts.map +0 -1
- package/dist/schema/types.js.map +0 -1
- package/dist/schema/validate.d.ts.map +0 -1
- package/dist/schema/validate.js.map +0 -1
- package/dist/schema/yaml-parser.d.ts.map +0 -1
- package/dist/schema/yaml-parser.js.map +0 -1
package/dist/audit/index.d.ts
CHANGED
package/dist/audit/index.js
CHANGED
|
@@ -177,7 +177,6 @@ export async function runGuard(opts) {
|
|
|
177
177
|
const r = await runSync({
|
|
178
178
|
files: [], target: "claude-md",
|
|
179
179
|
inject: join(cwd, "CLAUDE.md"),
|
|
180
|
-
hooksDir: join(cwd, ".claude", "hooks"),
|
|
181
180
|
evolve: false, remove: true,
|
|
182
181
|
});
|
|
183
182
|
if (r !== 0)
|
|
@@ -215,7 +214,6 @@ export async function runGuard(opts) {
|
|
|
215
214
|
files: [tmpFile],
|
|
216
215
|
target: "claude-md",
|
|
217
216
|
inject: join(cwd, "CLAUDE.md"),
|
|
218
|
-
hooksDir: join(cwd, ".claude", "hooks"),
|
|
219
217
|
evolve: false, remove: false,
|
|
220
218
|
});
|
|
221
219
|
if (r !== 0)
|
|
@@ -254,4 +252,3 @@ export async function runGuard(opts) {
|
|
|
254
252
|
await rm(tmpFile, { force: true });
|
|
255
253
|
}
|
|
256
254
|
}
|
|
257
|
-
//# sourceMappingURL=guard.js.map
|
|
@@ -68,4 +68,3 @@ export declare function parseClaudeMD(content: string): {
|
|
|
68
68
|
export declare function importHarness(dir: string): Promise<ImportResult>;
|
|
69
69
|
export declare function generateDNAYaml(result: ImportResult, projectName?: string): string;
|
|
70
70
|
export declare function runImport(opts: ImportOptions): Promise<number>;
|
|
71
|
-
//# sourceMappingURL=import.d.ts.map
|
|
@@ -56,4 +56,3 @@ export declare function executeGroup(group: ParallelGroup, allSteps: WorkflowSte
|
|
|
56
56
|
export declare function checkRetryNeeded(stepResults: Map<string, StepResult>, transitions: TransitionRule[]): boolean;
|
|
57
57
|
export declare function runRun(opts: RunOptions): Promise<number>;
|
|
58
58
|
export {};
|
|
59
|
-
//# sourceMappingURL=run.d.ts.map
|
package/dist/cli/commands/run.js
CHANGED
|
@@ -13,7 +13,7 @@ import { loadDNA, compileFromFiles } from "../../compiler/index.js";
|
|
|
13
13
|
import { cascadeDNA } from "../../compiler/cascade.js";
|
|
14
14
|
import { compileWorkflow } from "../../compiler/workflow.js";
|
|
15
15
|
import { compileAllRolesToAgentMD, writeAgentMDFiles, toKebabCase, } from "../../runtime/agent-md.js";
|
|
16
|
-
import {
|
|
16
|
+
import { createCompiledIR, writeCompiledIR } from "../../runtime/plugin-adapter.js";
|
|
17
17
|
// ── Template & Condition Helpers ───────────────────────────
|
|
18
18
|
/**
|
|
19
19
|
* Replace {{var}} placeholders in a template string.
|
|
@@ -127,21 +127,6 @@ export async function executeStep(step, vars, opts) {
|
|
|
127
127
|
"--no-session-persistence",
|
|
128
128
|
];
|
|
129
129
|
log(`Running step: ${step.id} (agent: ${agentName})`);
|
|
130
|
-
// Write mode file if step declares a mode
|
|
131
|
-
if (step.mode) {
|
|
132
|
-
const modeData = JSON.stringify({
|
|
133
|
-
active_mode: step.mode,
|
|
134
|
-
set_at: new Date().toISOString(),
|
|
135
|
-
set_by: `run:${step.id}`,
|
|
136
|
-
});
|
|
137
|
-
try {
|
|
138
|
-
const { mkdir: mkdirAsync, writeFile: writeFileAsync } = await import("node:fs/promises");
|
|
139
|
-
await mkdirAsync(".dna", { recursive: true });
|
|
140
|
-
await writeFileAsync(".dna/mode", modeData, "utf-8");
|
|
141
|
-
log(`Mode set: ${step.mode}`);
|
|
142
|
-
}
|
|
143
|
-
catch { /* best effort */ }
|
|
144
|
-
}
|
|
145
130
|
try {
|
|
146
131
|
const output = await spawnAsync("claude", args, prompt);
|
|
147
132
|
await writeFile(resultFile, output, "utf-8");
|
|
@@ -271,7 +256,6 @@ export async function runRun(opts) {
|
|
|
271
256
|
const maxBudget = opts.maxBudget ?? 5;
|
|
272
257
|
const permissionMode = opts.permissionMode ?? "bypassPermissions";
|
|
273
258
|
const agentsDir = opts.agentsDir ?? ".claude/agents";
|
|
274
|
-
const hooksDir = opts.hooksDir ?? ".claude/hooks";
|
|
275
259
|
try {
|
|
276
260
|
// ── Step 1: Load & compile DNA ───────────────────────
|
|
277
261
|
log("Loading DNA files...");
|
|
@@ -311,9 +295,9 @@ export async function runRun(opts) {
|
|
|
311
295
|
const agentResults = compileAllRolesToAgentMD(cascaded.roles, ir);
|
|
312
296
|
await writeAgentMDFiles(agentResults, agentsDir);
|
|
313
297
|
log(`Generated ${agentResults.length} agent file(s) in ${agentsDir}`);
|
|
314
|
-
const hookScripts =
|
|
315
|
-
await
|
|
316
|
-
log(
|
|
298
|
+
const hookScripts = createCompiledIR(ir, cascaded.roles);
|
|
299
|
+
await writeCompiledIR(process.cwd(), hookScripts);
|
|
300
|
+
log("Synced compiled IR for dna-hook enforcement");
|
|
317
301
|
// ── Step 5: Prepare log directory ────────────────────
|
|
318
302
|
const timestamp = new Date().toISOString().replace(/[:.]/g, "-");
|
|
319
303
|
const logDir = opts.logDir ?? join(".intentdna", "runs", `${opts.workflowName}-${timestamp}`);
|
|
@@ -367,12 +351,6 @@ export async function runRun(opts) {
|
|
|
367
351
|
// All passed
|
|
368
352
|
break;
|
|
369
353
|
}
|
|
370
|
-
// Clean up mode file after workflow completes
|
|
371
|
-
try {
|
|
372
|
-
const { rm: rmAsync } = await import("node:fs/promises");
|
|
373
|
-
await rmAsync(".dna/mode", { force: true });
|
|
374
|
-
}
|
|
375
|
-
catch { /* best effort */ }
|
|
376
354
|
return printSummary(stepResults, round, logDir, 0);
|
|
377
355
|
}
|
|
378
356
|
catch (err) {
|
|
@@ -428,4 +406,3 @@ function printSummary(results, rounds, logDir, exitCode) {
|
|
|
428
406
|
process.stderr.write(`\nTotal: ${passed} passed, ${failed} failed, ${skipped} skipped\n`);
|
|
429
407
|
return exitCode;
|
|
430
408
|
}
|
|
431
|
-
//# sourceMappingURL=run.js.map
|
|
@@ -17,11 +17,11 @@ import { fileURLToPath } from "node:url";
|
|
|
17
17
|
import { createInterface } from "node:readline";
|
|
18
18
|
import { loadDNA, compileFromFiles } from "../../compiler/index.js";
|
|
19
19
|
import { compileToMarkdown, injectIntoFile, removeFromFile } from "../../runtime/markdown.js";
|
|
20
|
-
import { compileToHooks, writeHookScripts, removeHookScripts } from "../../runtime/hooks.js";
|
|
21
20
|
import { compileAllRolesToAgentMD, writeAgentMDFiles, removeAgentMDFiles } from "../../runtime/agent-md.js";
|
|
22
21
|
import { removeWorkflowScripts } from "../../runtime/workflow-runner.js";
|
|
23
22
|
import { compileWorkflowToSkill, writeSkillFiles } from "../../runtime/skill-adapter.js";
|
|
24
|
-
import {
|
|
23
|
+
import { compilePluginSettings, detectEnabledEvents, mergeSettingsFile } from "../../runtime/settings-adapter.js";
|
|
24
|
+
import { createCompiledIR, writeCompiledIR } from "../../runtime/plugin-adapter.js";
|
|
25
25
|
import { cascadeDNA } from "../../compiler/cascade.js";
|
|
26
26
|
import { EvolutionEngine } from "../../evolution/index.js";
|
|
27
27
|
const VALID_TARGETS = ["claude-md", "soul-md", "cursorrules", "system-prompt"];
|
|
@@ -35,6 +35,33 @@ async function fileExists(path) {
|
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
const DNA_SENTINEL = "intentdna:managed";
|
|
38
|
+
const LEGACY_BASH_HOOKS = [
|
|
39
|
+
"dna-pre-tool-use.sh",
|
|
40
|
+
"dna-post-tool-use.sh",
|
|
41
|
+
"dna-user-prompt-submit.sh",
|
|
42
|
+
"dna-subagent-stop.sh",
|
|
43
|
+
"dna-pre-compact.sh",
|
|
44
|
+
"dna-notification.sh",
|
|
45
|
+
];
|
|
46
|
+
/**
|
|
47
|
+
* Remove legacy bash hook scripts written by previous Intent DNA versions.
|
|
48
|
+
* Only removes files that contain the sentinel comment.
|
|
49
|
+
*/
|
|
50
|
+
async function removeLegacyBashHooks(hooksDir) {
|
|
51
|
+
let removed = 0;
|
|
52
|
+
for (const file of LEGACY_BASH_HOOKS) {
|
|
53
|
+
const path = resolve(hooksDir, file);
|
|
54
|
+
try {
|
|
55
|
+
const content = await readFile(path, "utf-8");
|
|
56
|
+
if (content.includes("intentdna:managed")) {
|
|
57
|
+
await unlink(path);
|
|
58
|
+
removed++;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
catch { /* File doesn't exist, skip */ }
|
|
62
|
+
}
|
|
63
|
+
return removed;
|
|
64
|
+
}
|
|
38
65
|
/**
|
|
39
66
|
* Remove stale DNA-managed files from a directory.
|
|
40
67
|
* Scans for files/dirs containing the sentinel marker and deletes them.
|
|
@@ -212,11 +239,10 @@ export async function runSync(opts) {
|
|
|
212
239
|
const hasClaudeMd = await fileExists(resolve(cwd, "CLAUDE.md"));
|
|
213
240
|
if (hasClaudeDir || hasClaudeMd || opts.files.length > 0) {
|
|
214
241
|
opts.inject = resolve(cwd, "CLAUDE.md");
|
|
215
|
-
opts.hooksDir = resolve(cwd, ".claude", "hooks");
|
|
216
242
|
opts.agentsDir = resolve(cwd, ".claude", "agents");
|
|
217
243
|
opts.skillsDir = resolve(cwd, ".claude", "skills");
|
|
218
244
|
opts.settingsPath = resolve(cwd, ".claude", "settings.json");
|
|
219
|
-
process.stderr.write(`Auto-detect: Claude Code → CLAUDE.md +
|
|
245
|
+
process.stderr.write(`Auto-detect: Claude Code → CLAUDE.md + agents + skills + settings\n`);
|
|
220
246
|
}
|
|
221
247
|
}
|
|
222
248
|
// Handle --remove
|
|
@@ -235,12 +261,12 @@ export async function runSync(opts) {
|
|
|
235
261
|
}
|
|
236
262
|
}
|
|
237
263
|
if (opts.hooksDir) {
|
|
238
|
-
const count = await
|
|
264
|
+
const count = await removeLegacyBashHooks(opts.hooksDir);
|
|
239
265
|
if (count > 0) {
|
|
240
|
-
process.stderr.write(`Removed ${count}
|
|
266
|
+
process.stderr.write(`Removed ${count} legacy bash hook(s) from ${opts.hooksDir}\n`);
|
|
241
267
|
}
|
|
242
268
|
else {
|
|
243
|
-
process.stderr.write(`No
|
|
269
|
+
process.stderr.write(`No legacy bash hooks found in ${opts.hooksDir}\n`);
|
|
244
270
|
}
|
|
245
271
|
}
|
|
246
272
|
if (opts.agentsDir) {
|
|
@@ -314,24 +340,32 @@ export async function runSync(opts) {
|
|
|
314
340
|
}
|
|
315
341
|
trackedOutputs.push(resolve(opts.inject));
|
|
316
342
|
}
|
|
317
|
-
// Step
|
|
318
|
-
if (opts.
|
|
319
|
-
const
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
343
|
+
// Step 3.5: Plugin mode — write IR + register dna-hook
|
|
344
|
+
if (opts.plugin) {
|
|
345
|
+
const cwd = process.cwd();
|
|
346
|
+
// Write compiled IR
|
|
347
|
+
const dnas = await Promise.all(expandedFiles.map(loadDNA));
|
|
348
|
+
const cascadedForIR = cascadeDNA(dnas);
|
|
349
|
+
const roles = cascadedForIR.roles;
|
|
350
|
+
const compiled = createCompiledIR(ir, roles);
|
|
351
|
+
const irPath = await writeCompiledIR(cwd, compiled);
|
|
352
|
+
process.stderr.write(`Plugin: wrote ${irPath}\n`);
|
|
353
|
+
trackedOutputs.push(resolve(irPath));
|
|
354
|
+
// Register dna-hook events in settings.json
|
|
355
|
+
if (opts.settingsPath) {
|
|
356
|
+
const enabledEvents = detectEnabledEvents(ir);
|
|
357
|
+
if (enabledEvents.length > 0) {
|
|
358
|
+
const pluginSettings = compilePluginSettings(enabledEvents);
|
|
359
|
+
await mergeSettingsFile(pluginSettings, opts.settingsPath);
|
|
360
|
+
process.stderr.write(`Plugin: registered ${enabledEvents.length} dna-hook event(s) in ${opts.settingsPath}\n`);
|
|
361
|
+
trackedOutputs.push(resolve(opts.settingsPath));
|
|
331
362
|
}
|
|
332
363
|
}
|
|
333
|
-
|
|
334
|
-
|
|
364
|
+
// Clean up old bash hooks if they exist
|
|
365
|
+
const oldHooksDir = resolve(cwd, ".claude", "hooks");
|
|
366
|
+
const removed = await removeLegacyBashHooks(oldHooksDir);
|
|
367
|
+
if (removed > 0) {
|
|
368
|
+
process.stderr.write(`Plugin: cleaned ${removed} legacy bash hook(s) from ${oldHooksDir}\n`);
|
|
335
369
|
}
|
|
336
370
|
}
|
|
337
371
|
// Step 5: Generate agent MD files
|
|
@@ -436,14 +470,6 @@ export async function runSync(opts) {
|
|
|
436
470
|
}
|
|
437
471
|
}
|
|
438
472
|
}
|
|
439
|
-
// Step 8: Generate/merge settings file
|
|
440
|
-
if (opts.settingsPath && opts.hooksDir) {
|
|
441
|
-
const hookScripts = compileToHooks(ir);
|
|
442
|
-
const dnaSettings = compileSettingsFromHooks(opts.hooksDir, hookScripts);
|
|
443
|
-
await mergeSettingsFile(dnaSettings, opts.settingsPath);
|
|
444
|
-
process.stderr.write(`Merged DNA hook config into ${opts.settingsPath}\n`);
|
|
445
|
-
trackedOutputs.push(resolve(opts.settingsPath));
|
|
446
|
-
}
|
|
447
473
|
// Also output the compiled content to stderr for visibility
|
|
448
474
|
const directiveCount = ir.prompt_directives.length;
|
|
449
475
|
const gateCount = ir.pre_execution_gates.length;
|
|
@@ -462,4 +488,3 @@ export async function runSync(opts) {
|
|
|
462
488
|
return 1;
|
|
463
489
|
}
|
|
464
490
|
}
|
|
465
|
-
//# sourceMappingURL=sync.js.map
|
|
@@ -30,4 +30,3 @@ export declare function sha256(content: string): string;
|
|
|
30
30
|
export declare function parseLockFile(raw: string): LockFile;
|
|
31
31
|
export declare function verifyLock(lock: LockFile): Promise<VerifyResult[]>;
|
|
32
32
|
export declare function runVerify(opts: VerifyOptions): Promise<number>;
|
|
33
|
-
//# sourceMappingURL=verify.d.ts.map
|
package/dist/cli/index.d.ts
CHANGED
package/dist/cli/index.js
CHANGED
|
@@ -87,6 +87,7 @@ async function main() {
|
|
|
87
87
|
settings: { type: "string" },
|
|
88
88
|
lock: { type: "string", default: ".dna/lock" },
|
|
89
89
|
remove: { type: "boolean", default: false },
|
|
90
|
+
plugin: { type: "boolean", default: false },
|
|
90
91
|
},
|
|
91
92
|
allowPositionals: true,
|
|
92
93
|
strict: false,
|
|
@@ -108,6 +109,7 @@ async function main() {
|
|
|
108
109
|
settingsPath: values.settings,
|
|
109
110
|
lockFile: values.lock,
|
|
110
111
|
remove: values.remove,
|
|
112
|
+
plugin: values.plugin,
|
|
111
113
|
});
|
|
112
114
|
process.exit(code);
|
|
113
115
|
break;
|
|
@@ -363,4 +365,3 @@ main().catch((err) => {
|
|
|
363
365
|
process.stderr.write(`Fatal: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
364
366
|
process.exit(1);
|
|
365
367
|
});
|
|
366
|
-
//# sourceMappingURL=index.js.map
|
package/dist/cli/util/format.js
CHANGED
|
@@ -8,4 +8,3 @@ export declare function askString(question: string, defaultVal?: string): Promis
|
|
|
8
8
|
export declare function askNumber(question: string, defaultVal: number): Promise<number>;
|
|
9
9
|
export declare function askChoice(question: string, choices: string[], defaultVal?: string): Promise<string>;
|
|
10
10
|
export declare function askYesNo(question: string, defaultVal: boolean): Promise<boolean>;
|
|
11
|
-
//# sourceMappingURL=prompt.d.ts.map
|
package/dist/cli/util/prompt.js
CHANGED
|
@@ -26,4 +26,3 @@ export interface ActivatedGene {
|
|
|
26
26
|
* Returns the final gene expression state ready for compilation to IR.
|
|
27
27
|
*/
|
|
28
28
|
export declare function activateDNA(cascaded: CascadedDNA, contextName?: string | null, activeRole?: string | null): ActivatedDNA;
|
|
29
|
-
//# sourceMappingURL=activate.d.ts.map
|
|
@@ -10,12 +10,11 @@
|
|
|
10
10
|
* - attract/repel: same target accumulates, different targets independent
|
|
11
11
|
* - amplify/suppress: factors multiply (1.5x × 2.0x = 3.0x)
|
|
12
12
|
*/
|
|
13
|
-
import type { IntentDNA, Gene, ContextRegion, EpigeneticMarker, RoleDef, WorkflowDef
|
|
13
|
+
import type { IntentDNA, Gene, ContextRegion, EpigeneticMarker, RoleDef, WorkflowDef } from "../schema/types.js";
|
|
14
14
|
export interface CascadedDNA {
|
|
15
15
|
genes: Record<string, Gene>;
|
|
16
16
|
contexts: Record<string, ContextRegion>;
|
|
17
17
|
roles: Record<string, RoleDef>;
|
|
18
|
-
modes: Record<string, ModeDef>;
|
|
19
18
|
workflows: Record<string, WorkflowDef>;
|
|
20
19
|
epigenetic_markers: EpigeneticMarker[];
|
|
21
20
|
source_ids: string[];
|
|
@@ -31,4 +30,3 @@ export interface CascadedDNA {
|
|
|
31
30
|
* - Same namespace: higher priority replaces (expected cascade behavior)
|
|
32
31
|
*/
|
|
33
32
|
export declare function cascadeDNA(layers: IntentDNA[]): CascadedDNA;
|
|
34
|
-
//# sourceMappingURL=cascade.d.ts.map
|
package/dist/compiler/cascade.js
CHANGED
|
@@ -81,7 +81,6 @@ function prefixWorkflowRoles(wf, ns) {
|
|
|
81
81
|
steps: wf.steps.map((step) => ({
|
|
82
82
|
...step,
|
|
83
83
|
role: `${ns}_${step.role}`,
|
|
84
|
-
mode: step.mode ? `${ns}_${step.mode}` : undefined,
|
|
85
84
|
})),
|
|
86
85
|
};
|
|
87
86
|
}
|
|
@@ -101,7 +100,6 @@ export function cascadeDNA(layers) {
|
|
|
101
100
|
const mergedGenes = {};
|
|
102
101
|
const mergedContexts = {};
|
|
103
102
|
const mergedRoles = {};
|
|
104
|
-
const mergedModes = {};
|
|
105
103
|
const mergedWorkflows = {};
|
|
106
104
|
const allMarkers = [];
|
|
107
105
|
const sourceIds = [];
|
|
@@ -126,12 +124,7 @@ export function cascadeDNA(layers) {
|
|
|
126
124
|
const key = ns ? `${ns}_${name}` : name;
|
|
127
125
|
mergedRoles[key] = role;
|
|
128
126
|
}
|
|
129
|
-
// Merge
|
|
130
|
-
for (const [name, mode] of Object.entries(dna.modes ?? {})) {
|
|
131
|
-
const key = ns ? `${ns}_${name}` : name;
|
|
132
|
-
mergedModes[key] = mode;
|
|
133
|
-
}
|
|
134
|
-
// Merge workflows: namespace-prefixed keys + step role/mode references
|
|
127
|
+
// Merge workflows: namespace-prefixed keys + step role references
|
|
135
128
|
const normalized = normalizeWorkflowsFromDNA(dna);
|
|
136
129
|
for (const [name, wf] of Object.entries(normalized)) {
|
|
137
130
|
if (ns) {
|
|
@@ -151,10 +144,8 @@ export function cascadeDNA(layers) {
|
|
|
151
144
|
genes: mergedGenes,
|
|
152
145
|
contexts: mergedContexts,
|
|
153
146
|
roles: mergedRoles,
|
|
154
|
-
modes: mergedModes,
|
|
155
147
|
workflows: mergedWorkflows,
|
|
156
148
|
epigenetic_markers: allMarkers,
|
|
157
149
|
source_ids: sourceIds,
|
|
158
150
|
};
|
|
159
151
|
}
|
|
160
|
-
//# sourceMappingURL=cascade.js.map
|
package/dist/compiler/compile.js
CHANGED
|
@@ -198,26 +198,14 @@ export function compileDNA(activated, cascaded) {
|
|
|
198
198
|
}
|
|
199
199
|
}
|
|
200
200
|
}
|
|
201
|
-
// Build
|
|
202
|
-
const modeConstraints = [];
|
|
203
|
-
if (cascaded?.modes) {
|
|
204
|
-
for (const [name, mode] of Object.entries(cascaded.modes)) {
|
|
205
|
-
modeConstraints.push({
|
|
206
|
-
mode_name: name,
|
|
207
|
-
description: mode.description,
|
|
208
|
-
tool_deny: mode.tool_permissions?.deny,
|
|
209
|
-
scope_write: mode.scope?.write,
|
|
210
|
-
});
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
// Build step_checkpoints from all workflow steps that have checkpoints + a mode
|
|
201
|
+
// Build step_checkpoints from all workflow steps that have checkpoints
|
|
214
202
|
const stepCheckpoints = [];
|
|
215
203
|
const allWorkflows = Object.values(cascaded?.workflows ?? {});
|
|
216
204
|
for (const wf of allWorkflows) {
|
|
217
205
|
for (const step of wf.steps ?? []) {
|
|
218
|
-
if (step.checkpoints && step.checkpoints.length > 0
|
|
206
|
+
if (step.checkpoints && step.checkpoints.length > 0) {
|
|
219
207
|
stepCheckpoints.push({
|
|
220
|
-
|
|
208
|
+
step_role: step.role,
|
|
221
209
|
step_id: step.id,
|
|
222
210
|
checkpoints: [...step.checkpoints],
|
|
223
211
|
});
|
|
@@ -240,8 +228,6 @@ export function compileDNA(activated, cascaded) {
|
|
|
240
228
|
role_tool_permissions: roleToolPermissions,
|
|
241
229
|
role_scope: roleScope,
|
|
242
230
|
roles_scope_map: rolesScopeMap.length > 0 ? rolesScopeMap : undefined,
|
|
243
|
-
mode_constraints: modeConstraints.length > 0 ? modeConstraints : undefined,
|
|
244
231
|
step_checkpoints: stepCheckpoints.length > 0 ? stepCheckpoints : undefined,
|
|
245
232
|
};
|
|
246
233
|
}
|
|
247
|
-
//# sourceMappingURL=compile.js.map
|
package/dist/compiler/index.d.ts
CHANGED
|
@@ -25,4 +25,3 @@ export interface CompileOptions {
|
|
|
25
25
|
* Optionally injects stored epigenetic markers from the evolution engine.
|
|
26
26
|
*/
|
|
27
27
|
export declare function compileFromFiles(filePaths: string[], contextOrOptions?: string | CompileOptions): Promise<ConstraintIR>;
|
|
28
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/compiler/index.js
CHANGED
|
@@ -34,4 +34,3 @@ export interface CompileWorkflowResult {
|
|
|
34
34
|
* Returns a result object with either a plan or errors.
|
|
35
35
|
*/
|
|
36
36
|
export declare function compileWorkflow(workflow: WorkflowDef, options?: CompileWorkflowOptions): CompileWorkflowResult;
|
|
37
|
-
//# sourceMappingURL=workflow.d.ts.map
|
|
@@ -166,7 +166,6 @@ function toWorkflowStep(def) {
|
|
|
166
166
|
return {
|
|
167
167
|
id: def.id,
|
|
168
168
|
role: def.role,
|
|
169
|
-
mode: def.mode ?? null,
|
|
170
169
|
description: def.description ?? def.id,
|
|
171
170
|
optional: def.optional ?? false,
|
|
172
171
|
run_if: resolveRunIf(def.run_if),
|
|
@@ -273,4 +272,3 @@ export function compileWorkflow(workflow, options) {
|
|
|
273
272
|
}
|
|
274
273
|
return { ok: true, plan, errors: [] };
|
|
275
274
|
}
|
|
276
|
-
//# sourceMappingURL=workflow.js.map
|
package/dist/evolution/index.js
CHANGED
package/dist/evolution/store.js
CHANGED