intentdna 1.7.4 → 1.8.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/.claude-plugin/marketplace.json +2 -2
- package/.claude-plugin/plugin.json +1 -1
- package/LICENSE +201 -0
- package/README.md +143 -194
- package/dist/assets/candidates.d.ts +124 -0
- package/dist/assets/candidates.js +1249 -0
- package/dist/assets/catalog.d.ts +101 -0
- package/dist/assets/catalog.js +311 -0
- package/dist/assets/evidence.d.ts +93 -0
- package/dist/assets/evidence.js +391 -0
- package/dist/assets/index.d.ts +4 -0
- package/dist/assets/index.js +4 -0
- package/dist/assets/metadata.d.ts +19 -0
- package/dist/assets/metadata.js +227 -0
- package/dist/cli/commands/assets.d.ts +65 -0
- package/dist/cli/commands/assets.js +2871 -0
- package/dist/cli/commands/auth.d.ts +322 -0
- package/dist/cli/commands/auth.js +1592 -0
- package/dist/cli/commands/cloud-auth-guidance.d.ts +2 -0
- package/dist/cli/commands/cloud-auth-guidance.js +4 -0
- package/dist/cli/commands/cloud.d.ts +1359 -0
- package/dist/cli/commands/cloud.js +8364 -0
- package/dist/cli/commands/evolve.js +18 -2
- package/dist/cli/commands/generate.js +25 -2
- package/dist/cli/commands/guard.d.ts +1 -1
- package/dist/cli/commands/guard.js +1 -1
- package/dist/cli/commands/guide.d.ts +15 -0
- package/dist/cli/commands/guide.js +1747 -0
- package/dist/cli/commands/init.d.ts +12 -0
- package/dist/cli/commands/init.js +95 -60
- package/dist/cli/commands/org.d.ts +16 -0
- package/dist/cli/commands/org.js +2393 -0
- package/dist/cli/commands/release.d.ts +59 -0
- package/dist/cli/commands/release.js +716 -0
- package/dist/cli/commands/report.d.ts +82 -0
- package/dist/cli/commands/report.js +1516 -0
- package/dist/cli/commands/run.d.ts +6 -1
- package/dist/cli/commands/run.js +95 -26
- package/dist/cli/commands/sync.d.ts +8 -1
- package/dist/cli/commands/sync.js +436 -141
- package/dist/cli/commands/templates.d.ts +64 -0
- package/dist/cli/commands/templates.js +2151 -1
- package/dist/cli/commands/workflow.d.ts +26 -0
- package/dist/cli/commands/workflow.js +3053 -0
- package/dist/cli/index.js +719 -42
- package/dist/compiler/cascade.js +4 -9
- package/dist/compiler/compile.js +1 -0
- package/dist/governance/evidence-capture-attribution.d.ts +12 -0
- package/dist/governance/evidence-capture-attribution.js +46 -0
- package/dist/governance/index.d.ts +2 -0
- package/dist/governance/index.js +1 -0
- package/dist/hooks/cli.d.ts +6 -0
- package/dist/hooks/cli.js +168 -12
- package/dist/hooks/enforce.d.ts +1 -0
- package/dist/hooks/protocol.d.ts +1 -1
- package/dist/hooks/protocol.js +1 -1
- package/dist/hooks/state.d.ts +41 -0
- package/dist/hooks/state.js +126 -2
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/mcp/tools-state.js +2 -0
- package/dist/organization/index.d.ts +121 -0
- package/dist/organization/index.js +413 -0
- package/dist/runtime/claude-sync-target.d.ts +49 -0
- package/dist/runtime/claude-sync-target.js +280 -0
- package/dist/runtime/codex-adapter.d.ts +254 -0
- package/dist/runtime/codex-adapter.js +1204 -0
- package/dist/runtime/codex-sync-target.d.ts +33 -0
- package/dist/runtime/codex-sync-target.js +241 -0
- package/dist/runtime/index.d.ts +8 -0
- package/dist/runtime/index.js +4 -0
- package/dist/runtime/output-artifact-registry.d.ts +1 -1
- package/dist/runtime/output-artifact-registry.js +2 -0
- package/dist/runtime/settings-adapter.d.ts +1 -1
- package/dist/runtime/settings-adapter.js +1 -1
- package/dist/runtime/skill-adapter.d.ts +5 -1
- package/dist/runtime/skill-adapter.js +120 -34
- package/dist/runtime/sync-artifact-registry.d.ts +99 -0
- package/dist/runtime/sync-artifact-registry.js +194 -0
- package/dist/runtime/sync-target-plan.d.ts +45 -0
- package/dist/runtime/sync-target-plan.js +19 -0
- package/dist/schema/controller-registry.d.ts +8 -1
- package/dist/schema/controller-registry.js +8 -0
- package/dist/schema/types.d.ts +35 -23
- package/dist/schema/types.js +10 -1
- package/dist/schema/validate.js +22 -22
- package/dist/schema/validators/controllers.js +38 -20
- package/dist/schema/workflow-authoring-contract.d.ts +29 -0
- package/dist/schema/workflow-authoring-contract.js +109 -0
- package/dist/schema/yaml-parser.js +18 -0
- package/dist/templates/api-backend.dna.yaml +19 -0
- package/dist/templates/brainstorming-first.dna.yaml +19 -0
- package/dist/templates/code-cleanup.dna.yaml +19 -0
- package/dist/templates/code-review-pipeline.dna.yaml +18 -0
- package/dist/templates/documentation-writer.dna.yaml +19 -0
- package/dist/templates/flutter-behavior-lock.dna.yaml +19 -0
- package/dist/templates/flutter-refactoring-rescue.dna.yaml +19 -0
- package/dist/templates/flutter-rewrite-diagnosis-review.dna.yaml +210 -0
- package/dist/templates/flutter-rewrite-fix-review-loop.dna.yaml +260 -0
- package/dist/templates/flutter-rewrite-new.dna.yaml +506 -0
- package/dist/templates/flutter-rewrite.dna.yaml +20 -0
- package/dist/templates/frontend-quality.dna.yaml +19 -0
- package/dist/templates/full-pipeline.dna.yaml +20 -0
- package/dist/templates/marketplace.d.ts +92 -0
- package/dist/templates/marketplace.js +502 -0
- package/dist/templates/metadata.d.ts +25 -0
- package/dist/templates/metadata.js +136 -3
- package/dist/templates/mobile-dev.dna.yaml +19 -0
- package/dist/templates/multi-agent-handoff-coordination.dna.yaml +156 -0
- package/dist/templates/multi-perspective-review.dna.yaml +19 -0
- package/dist/templates/persistent-executor.dna.yaml +19 -0
- package/dist/templates/qa-loop.dna.yaml +18 -0
- package/dist/templates/release-evidence-gate.dna.yaml +131 -0
- package/dist/templates/requirements-gate.dna.yaml +19 -0
- package/dist/templates/research-orchestration.dna.yaml +19 -0
- package/dist/templates/root-cause-analysis.dna.yaml +19 -0
- package/dist/templates/safe-refactoring.dna.yaml +321 -0
- package/dist/templates/secure-dev.dna.yaml +19 -0
- package/dist/templates/subagent-parallel.dna.yaml +19 -0
- package/dist/templates/systematic-debugging.dna.yaml +19 -0
- package/dist/templates/tdd-strict.dna.yaml +19 -0
- package/dist/templates/ui-visual-regression-qa.dna.yaml +133 -0
- package/dist/templates/workflow-author.dna.yaml +302 -0
- package/dist/templates/workflow-blocked-scope-triage.dna.yaml +242 -0
- package/dist/templates/workflow-completion-audit.dna.yaml +254 -0
- package/dist/templates/workflow-cross-boundary-resource-approval.dna.yaml +249 -0
- package/dist/templates/workflow-evidence-review.dna.yaml +198 -0
- package/dist/templates/workflow-module-inventory.dna.yaml +257 -0
- package/dist/templates/workflow-runtime-smoke-review.dna.yaml +252 -0
- package/dist/templates/workflow-verification-command-routing.dna.yaml +278 -0
- package/dist/workflow/authoring-packet.d.ts +67 -0
- package/dist/workflow/authoring-packet.js +218 -0
- package/dist/workflow/draft.d.ts +159 -0
- package/dist/workflow/draft.js +800 -0
- package/dist/workflow/index.d.ts +3 -0
- package/dist/workflow/index.js +3 -0
- package/dist/workflow/suggestion-review.d.ts +65 -0
- package/dist/workflow/suggestion-review.js +245 -0
- package/package.json +1 -1
- package/spec/README.md +15 -48
- package/spec/codex-adapter-contract.md +176 -0
- package/spec/sync-target-plan.md +158 -0
- package/spec/workflow-capability-ir.md +153 -0
- package/spec/agent-dispatch-fix.md +0 -116
- package/spec/control-plane-convergence-handoff-2026-04-24.md +0 -432
- package/spec/flutter-rewrite-template-optimization.md +0 -301
- package/spec/foundation-hardening.md +0 -178
- package/spec/hooks-infra-harness-hardening.md +0 -741
- package/spec/multi-config.md +0 -172
- package/spec/parallel-isolation.md +0 -268
- package/spec/template-version-namespace-fix.md +0 -653
- package/spec/workflow-pipeline.md +0 -101
|
@@ -18,6 +18,7 @@ export interface RunOptions {
|
|
|
18
18
|
permissionMode?: string;
|
|
19
19
|
agentsDir?: string;
|
|
20
20
|
hooksDir?: string;
|
|
21
|
+
projectDir?: string;
|
|
21
22
|
}
|
|
22
23
|
export interface StepResult {
|
|
23
24
|
stepId: string;
|
|
@@ -30,6 +31,10 @@ interface StepExecOptions {
|
|
|
30
31
|
maxBudget: number;
|
|
31
32
|
permissionMode: string;
|
|
32
33
|
logDir: string;
|
|
34
|
+
projectDir: string;
|
|
35
|
+
workflowName: string;
|
|
36
|
+
workflowAsset?: string;
|
|
37
|
+
inputs: Record<string, string>;
|
|
33
38
|
}
|
|
34
39
|
/**
|
|
35
40
|
* Replace {{var}} placeholders in a template string.
|
|
@@ -45,7 +50,7 @@ export declare function evaluateRunIf(condition: string | null, round: number):
|
|
|
45
50
|
* Execute a single workflow step via `claude -p --agent`.
|
|
46
51
|
* Returns StepResult with pass/fail status.
|
|
47
52
|
*/
|
|
48
|
-
export declare function executeStep(step: WorkflowStep, vars: Record<string, string>, opts: StepExecOptions): Promise<StepResult>;
|
|
53
|
+
export declare function executeStep(step: WorkflowStep, vars: Record<string, string>, opts: StepExecOptions, iteration?: number): Promise<StepResult>;
|
|
49
54
|
/**
|
|
50
55
|
* Execute a parallel group of steps.
|
|
51
56
|
*/
|
package/dist/cli/commands/run.js
CHANGED
|
@@ -6,14 +6,17 @@
|
|
|
6
6
|
* via `claude -p --agent` child processes.
|
|
7
7
|
*/
|
|
8
8
|
import { spawn } from "node:child_process";
|
|
9
|
-
import { mkdir, writeFile } from "node:fs/promises";
|
|
10
|
-
import { join } from "node:path";
|
|
9
|
+
import { mkdir, writeFile, readFile } from "node:fs/promises";
|
|
10
|
+
import { join, resolve } from "node:path";
|
|
11
11
|
import { randomUUID } from "node:crypto";
|
|
12
12
|
import { loadDNA, compileFromFiles, expandDNAInputFiles } 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
16
|
import { createCompiledIR, writeCompiledIR } from "../../runtime/plugin-adapter.js";
|
|
17
|
+
import { trustedEvidenceCaptureAttribution } from "../../governance/index.js";
|
|
18
|
+
import { DNAStateManager } from "../../hooks/state-manager.js";
|
|
19
|
+
import { appendEvidenceCaptureEvent, EVIDENCE_CAPTURE_SCHEMA_VERSION, } from "../../hooks/state.js";
|
|
17
20
|
// ── Template & Condition Helpers ───────────────────────────
|
|
18
21
|
/**
|
|
19
22
|
* Replace {{var}} placeholders in a template string.
|
|
@@ -53,7 +56,7 @@ export function evaluateRunIf(condition, round) {
|
|
|
53
56
|
* Run checkpoint assertions for a completed step.
|
|
54
57
|
* Returns true if all checkpoints pass, false if any fail.
|
|
55
58
|
*/
|
|
56
|
-
async function runCheckpoints(step) {
|
|
59
|
+
async function runCheckpoints(step, projectDir) {
|
|
57
60
|
if (!step.checkpoints)
|
|
58
61
|
return true;
|
|
59
62
|
const assertCommands = {
|
|
@@ -67,22 +70,21 @@ async function runCheckpoints(step) {
|
|
|
67
70
|
try {
|
|
68
71
|
if (cp.command) {
|
|
69
72
|
// Custom command — must exit 0
|
|
70
|
-
await spawnAsync("bash", ["-c", cp.command], "");
|
|
73
|
+
await spawnAsync("bash", ["-c", cp.command], "", projectDir);
|
|
71
74
|
passed = true;
|
|
72
75
|
}
|
|
73
76
|
else if (cp.assert === "clean_working_tree") {
|
|
74
|
-
const output = await spawnAsync("git", ["status", "--porcelain"], "");
|
|
77
|
+
const output = await spawnAsync("git", ["status", "--porcelain"], "", projectDir);
|
|
75
78
|
passed = output.trim() === "";
|
|
76
79
|
}
|
|
77
80
|
else if (cp.assert === "no_test_regression") {
|
|
78
81
|
// Read baselines from .dna/
|
|
79
|
-
const
|
|
80
|
-
const
|
|
81
|
-
const current = parseInt(await rf(".dna/test-current", "utf-8").catch(() => "0"), 10);
|
|
82
|
+
const baseline = parseInt(await readFile(join(projectDir, ".dna", "test-baseline"), "utf-8").catch(() => "0"), 10);
|
|
83
|
+
const current = parseInt(await readFile(join(projectDir, ".dna", "test-current"), "utf-8").catch(() => "0"), 10);
|
|
82
84
|
passed = current <= baseline;
|
|
83
85
|
}
|
|
84
86
|
else if (assertCommands[cp.assert]) {
|
|
85
|
-
await spawnAsync("bash", ["-c", assertCommands[cp.assert]], "");
|
|
87
|
+
await spawnAsync("bash", ["-c", assertCommands[cp.assert]], "", projectDir);
|
|
86
88
|
passed = true;
|
|
87
89
|
}
|
|
88
90
|
else {
|
|
@@ -102,16 +104,36 @@ async function runCheckpoints(step) {
|
|
|
102
104
|
return true;
|
|
103
105
|
}
|
|
104
106
|
// ── Step Execution ─────────────────────────────────────────
|
|
107
|
+
async function recordStepResultEvidence(step, opts, sessionId, status, durationMs) {
|
|
108
|
+
const result = status === "pass" ? "success" : "failure";
|
|
109
|
+
await appendEvidenceCaptureEvent(opts.projectDir, {
|
|
110
|
+
schema_version: EVIDENCE_CAPTURE_SCHEMA_VERSION,
|
|
111
|
+
event_id: `c5:${randomUUID()}`,
|
|
112
|
+
captured_at: new Date().toISOString(),
|
|
113
|
+
project_root: opts.projectDir,
|
|
114
|
+
source: "dna_cli",
|
|
115
|
+
workflow_asset: opts.workflowAsset ?? "unknown",
|
|
116
|
+
workflow_id: opts.workflowName,
|
|
117
|
+
run_id: sessionId,
|
|
118
|
+
step_id: step.id,
|
|
119
|
+
fact: "result",
|
|
120
|
+
summary: `dna run recorded ${result} for workflow step ${step.id}`,
|
|
121
|
+
result,
|
|
122
|
+
duration_ms: durationMs,
|
|
123
|
+
});
|
|
124
|
+
}
|
|
105
125
|
/**
|
|
106
126
|
* Execute a single workflow step via `claude -p --agent`.
|
|
107
127
|
* Returns StepResult with pass/fail status.
|
|
108
128
|
*/
|
|
109
|
-
export async function executeStep(step, vars, opts) {
|
|
129
|
+
export async function executeStep(step, vars, opts, iteration = 1) {
|
|
110
130
|
const start = Date.now();
|
|
111
131
|
const prompt = substituteTemplate(step.prompt ?? step.description, vars);
|
|
112
132
|
const agentName = `${opts.agentPrefix}${toKebabCase(step.role)}`;
|
|
113
133
|
const sessionId = randomUUID();
|
|
114
134
|
const resultFile = join(opts.logDir, `${step.id}-result.json`);
|
|
135
|
+
const stateManager = new DNAStateManager(opts.projectDir, sessionId);
|
|
136
|
+
let stateWritten = false;
|
|
115
137
|
const args = [
|
|
116
138
|
"-p",
|
|
117
139
|
"--agent",
|
|
@@ -128,7 +150,25 @@ export async function executeStep(step, vars, opts) {
|
|
|
128
150
|
];
|
|
129
151
|
log(`Running step: ${step.id} (agent: ${agentName})`);
|
|
130
152
|
try {
|
|
131
|
-
|
|
153
|
+
try {
|
|
154
|
+
await stateManager.writeWorkflowState({
|
|
155
|
+
active: true,
|
|
156
|
+
workflow_asset: opts.workflowAsset,
|
|
157
|
+
workflow: opts.workflowName,
|
|
158
|
+
current_step: step.id,
|
|
159
|
+
current_role: step.role,
|
|
160
|
+
iteration,
|
|
161
|
+
session_id: sessionId,
|
|
162
|
+
started_at: new Date(start).toISOString(),
|
|
163
|
+
inputs: opts.inputs,
|
|
164
|
+
resolved_variables: vars,
|
|
165
|
+
});
|
|
166
|
+
stateWritten = true;
|
|
167
|
+
}
|
|
168
|
+
catch (error) {
|
|
169
|
+
log(`Workflow evidence state unavailable for ${step.id}; continuing fail-open: ${error instanceof Error ? error.message : String(error)}`);
|
|
170
|
+
}
|
|
171
|
+
const output = await spawnAsync("claude", args, prompt, opts.projectDir);
|
|
132
172
|
await writeFile(resultFile, output, "utf-8");
|
|
133
173
|
// Check for error in JSON output
|
|
134
174
|
let isError = false;
|
|
@@ -142,18 +182,34 @@ export async function executeStep(step, vars, opts) {
|
|
|
142
182
|
const status = isError ? "fail" : "pass";
|
|
143
183
|
// Run checkpoints if step passed and has checkpoints defined
|
|
144
184
|
if (status === "pass" && step.checkpoints && step.checkpoints.length > 0) {
|
|
145
|
-
const checkpointsPassed = await runCheckpoints(step);
|
|
185
|
+
const checkpointsPassed = await runCheckpoints(step, opts.projectDir);
|
|
146
186
|
if (!checkpointsPassed) {
|
|
147
|
-
|
|
148
|
-
|
|
187
|
+
const durationMs = Date.now() - start;
|
|
188
|
+
await recordStepResultEvidence(step, opts, sessionId, "fail", durationMs);
|
|
189
|
+
log(`Step ${step.id} CHECKPOINT_FAIL (${durationMs}ms)`);
|
|
190
|
+
return { stepId: step.id, status: "fail", durationMs, resultFile };
|
|
149
191
|
}
|
|
150
192
|
}
|
|
151
|
-
|
|
152
|
-
|
|
193
|
+
const durationMs = Date.now() - start;
|
|
194
|
+
await recordStepResultEvidence(step, opts, sessionId, status, durationMs);
|
|
195
|
+
log(`Step ${step.id} ${status.toUpperCase()} (${durationMs}ms)`);
|
|
196
|
+
return { stepId: step.id, status, durationMs, resultFile };
|
|
153
197
|
}
|
|
154
198
|
catch {
|
|
155
|
-
|
|
156
|
-
|
|
199
|
+
const durationMs = Date.now() - start;
|
|
200
|
+
await recordStepResultEvidence(step, opts, sessionId, "fail", durationMs);
|
|
201
|
+
log(`Step ${step.id} FAIL (process error, ${durationMs}ms)`);
|
|
202
|
+
return { stepId: step.id, status: "fail", durationMs };
|
|
203
|
+
}
|
|
204
|
+
finally {
|
|
205
|
+
if (stateWritten) {
|
|
206
|
+
try {
|
|
207
|
+
await stateManager.clearWorkflowState();
|
|
208
|
+
}
|
|
209
|
+
catch (error) {
|
|
210
|
+
log(`Workflow evidence state cleanup failed for ${step.id}; continuing fail-open: ${error instanceof Error ? error.message : String(error)}`);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
157
213
|
}
|
|
158
214
|
}
|
|
159
215
|
/**
|
|
@@ -180,13 +236,13 @@ export async function executeGroup(group, allSteps, round, vars, opts) {
|
|
|
180
236
|
return results.filter((r) => r.status === "skipped");
|
|
181
237
|
// Single step: sequential
|
|
182
238
|
if (executable.length === 1) {
|
|
183
|
-
const result = await executeStep(executable[0], vars, opts);
|
|
239
|
+
const result = await executeStep(executable[0], vars, opts, round);
|
|
184
240
|
const skipped = results.filter((r) => r.status === "skipped");
|
|
185
241
|
return [...skipped, result];
|
|
186
242
|
}
|
|
187
243
|
// Multiple steps: parallel
|
|
188
244
|
log(`Running ${executable.length} steps in parallel`);
|
|
189
|
-
const parallelResults = await Promise.all(executable.map((step) => executeStep(step, vars, opts)));
|
|
245
|
+
const parallelResults = await Promise.all(executable.map((step) => executeStep(step, vars, opts, round)));
|
|
190
246
|
const skipped = results.filter((r) => r.status === "skipped");
|
|
191
247
|
return [...skipped, ...parallelResults];
|
|
192
248
|
}
|
|
@@ -205,10 +261,11 @@ export function checkRetryNeeded(stepResults, transitions) {
|
|
|
205
261
|
return false;
|
|
206
262
|
}
|
|
207
263
|
// ── Spawn Helper ───────────────────────────────────────────
|
|
208
|
-
function spawnAsync(command, args, stdinData) {
|
|
264
|
+
function spawnAsync(command, args, stdinData, cwd) {
|
|
209
265
|
return new Promise((resolve, reject) => {
|
|
210
266
|
const child = spawn(command, args, {
|
|
211
267
|
stdio: ["pipe", "pipe", "pipe"],
|
|
268
|
+
cwd,
|
|
212
269
|
});
|
|
213
270
|
let stdout = "";
|
|
214
271
|
let stderr = "";
|
|
@@ -255,11 +312,12 @@ export async function runRun(opts) {
|
|
|
255
312
|
}
|
|
256
313
|
const maxBudget = opts.maxBudget ?? 5;
|
|
257
314
|
const permissionMode = opts.permissionMode ?? "default";
|
|
258
|
-
const
|
|
315
|
+
const projectDir = resolve(opts.projectDir ?? process.cwd());
|
|
316
|
+
const agentsDir = opts.agentsDir ? resolve(projectDir, opts.agentsDir) : join(projectDir, ".claude", "agents");
|
|
259
317
|
try {
|
|
260
318
|
// ── Step 1: Load & compile DNA ───────────────────────
|
|
261
319
|
log("Loading DNA files...");
|
|
262
|
-
const expandedDNAFiles = await expandDNAInputFiles(opts.dnaFiles);
|
|
320
|
+
const expandedDNAFiles = await expandDNAInputFiles(opts.dnaFiles, { cwd: projectDir });
|
|
263
321
|
const dnas = await Promise.all(expandedDNAFiles.map(loadDNA));
|
|
264
322
|
const cascaded = cascadeDNA(dnas);
|
|
265
323
|
const ir = await compileFromFiles(expandedDNAFiles, {
|
|
@@ -283,9 +341,9 @@ export async function runRun(opts) {
|
|
|
283
341
|
log(`Compiled workflow: ${plan.name} (${plan.steps.length} steps, ${plan.parallel_groups.length} groups)`);
|
|
284
342
|
// ── Step 3: Build template variables ─────────────────
|
|
285
343
|
const vars = {
|
|
344
|
+
...(opts.vars ?? {}),
|
|
286
345
|
task_id: opts.taskId,
|
|
287
346
|
workflow: opts.workflowName,
|
|
288
|
-
...(opts.vars ?? {}),
|
|
289
347
|
};
|
|
290
348
|
// ── Dry-run mode ─────────────────────────────────────
|
|
291
349
|
if (opts.dryRun) {
|
|
@@ -297,17 +355,28 @@ export async function runRun(opts) {
|
|
|
297
355
|
await writeAgentMDFiles(agentResults, agentsDir);
|
|
298
356
|
log(`Generated ${agentResults.length} agent file(s) in ${agentsDir}`);
|
|
299
357
|
const hookScripts = createCompiledIR(ir, cascaded.roles);
|
|
300
|
-
await writeCompiledIR(
|
|
358
|
+
await writeCompiledIR(projectDir, hookScripts);
|
|
301
359
|
log("Synced compiled IR for dna-hook enforcement");
|
|
302
360
|
// ── Step 5: Prepare log directory ────────────────────
|
|
303
361
|
const timestamp = new Date().toISOString().replace(/[:.]/g, "-");
|
|
304
|
-
const logDir = opts.logDir
|
|
362
|
+
const logDir = opts.logDir
|
|
363
|
+
? resolve(projectDir, opts.logDir)
|
|
364
|
+
: join(projectDir, ".intentdna", "runs", `${opts.workflowName}-${timestamp}`);
|
|
305
365
|
await mkdir(logDir, { recursive: true });
|
|
366
|
+
const attribution = trustedEvidenceCaptureAttribution(ir, { workflowId: opts.workflowName });
|
|
306
367
|
const execOpts = {
|
|
307
368
|
agentPrefix: "dna-",
|
|
308
369
|
maxBudget,
|
|
309
370
|
permissionMode,
|
|
310
371
|
logDir,
|
|
372
|
+
projectDir,
|
|
373
|
+
workflowName: opts.workflowName,
|
|
374
|
+
workflowAsset: attribution.workflowAsset === "unknown" ? undefined : attribution.workflowAsset,
|
|
375
|
+
inputs: {
|
|
376
|
+
...(opts.vars ?? {}),
|
|
377
|
+
task_id: opts.taskId,
|
|
378
|
+
workflow: opts.workflowName,
|
|
379
|
+
},
|
|
311
380
|
};
|
|
312
381
|
// ── Step 6: Execute workflow ──────────────────────────
|
|
313
382
|
const maxRetries = plan.retry.max_retries;
|
|
@@ -10,9 +10,11 @@
|
|
|
10
10
|
*
|
|
11
11
|
* Targets: claude-md, soul-md, cursorrules, system-prompt
|
|
12
12
|
*/
|
|
13
|
+
import type { CodexHookInstallMode } from "../../runtime/codex-adapter.js";
|
|
13
14
|
export type SyncMode = "auto" | "plugin" | "bin";
|
|
14
15
|
export interface SyncOptions {
|
|
15
16
|
files: string[];
|
|
17
|
+
action?: "run" | "status" | "doctor" | "remove-registry";
|
|
16
18
|
target: string;
|
|
17
19
|
inject: string;
|
|
18
20
|
context?: string;
|
|
@@ -26,11 +28,16 @@ export interface SyncOptions {
|
|
|
26
28
|
skillsDir?: string;
|
|
27
29
|
settingsPath?: string;
|
|
28
30
|
lockFile?: string;
|
|
31
|
+
codex?: boolean;
|
|
32
|
+
codexInstallMode?: CodexHookInstallMode;
|
|
33
|
+
codexDogfood?: boolean;
|
|
29
34
|
remove: boolean;
|
|
30
35
|
mode?: SyncMode;
|
|
31
36
|
plugin?: boolean;
|
|
32
37
|
dryRun?: boolean;
|
|
33
38
|
postSummary?: boolean;
|
|
39
|
+
json?: boolean;
|
|
40
|
+
projectDir?: string;
|
|
34
41
|
}
|
|
35
42
|
/**
|
|
36
43
|
* Detect whether intentdna is running as a Claude Code plugin or standalone binary.
|
|
@@ -54,7 +61,7 @@ export declare function cleanStaleDNAFiles(dir: string, type: "agents" | "skills
|
|
|
54
61
|
* Auto-detect DNA config file in current directory (legacy single-config).
|
|
55
62
|
* Priority: .dna/config.yaml > .dna/config.yml > .dna/config.json > .dna.yaml > .dna.yml > .dna.json
|
|
56
63
|
*/
|
|
57
|
-
export declare function autoDetectConfigs(): Promise<string[]>;
|
|
64
|
+
export declare function autoDetectConfigs(projectDir?: string): Promise<string[]>;
|
|
58
65
|
/**
|
|
59
66
|
* Read the current package version from package.json.
|
|
60
67
|
*/
|