intentdna 1.8.7 → 1.9.0-rc.2

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.
Files changed (69) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/dist/cli/commands/candidate-promotion.d.ts +15 -0
  4. package/dist/cli/commands/candidate-promotion.js +197 -0
  5. package/dist/cli/commands/run-lifecycle.js +1 -0
  6. package/dist/cli/commands/run.js +76 -42
  7. package/dist/cli/commands/setup.d.ts +10 -0
  8. package/dist/cli/commands/setup.js +129 -36
  9. package/dist/cli/commands/source-assets.d.ts +32 -0
  10. package/dist/cli/commands/source-assets.js +154 -0
  11. package/dist/cli/commands/sync.js +52 -12
  12. package/dist/cli/commands/templates.js +59 -37
  13. package/dist/cli/index.js +161 -5
  14. package/dist/compiler/cascade.js +1 -1
  15. package/dist/hooks/cli.d.ts +6 -0
  16. package/dist/hooks/cli.js +118 -10
  17. package/dist/hooks/enforcement-boundary.d.ts +1 -1
  18. package/dist/hooks/protocol.d.ts +1 -1
  19. package/dist/hooks/state.d.ts +5 -0
  20. package/dist/hooks/state.js +21 -6
  21. package/dist/mcp/tools-state.js +251 -15
  22. package/dist/runtime/claude-sync-target.d.ts +2 -0
  23. package/dist/runtime/claude-sync-target.js +1 -1
  24. package/dist/runtime/evaluator.d.ts +13 -0
  25. package/dist/runtime/evaluator.js +46 -0
  26. package/dist/runtime/index.d.ts +8 -4
  27. package/dist/runtime/index.js +4 -2
  28. package/dist/runtime/plugin-adapter.d.ts +14 -1
  29. package/dist/runtime/plugin-adapter.js +23 -9
  30. package/dist/runtime/run-contracts.d.ts +5 -3
  31. package/dist/runtime/run-contracts.js +11 -1
  32. package/dist/runtime/run-controller.d.ts +15 -1
  33. package/dist/runtime/run-controller.js +235 -94
  34. package/dist/runtime/skill-adapter.js +24 -53
  35. package/dist/runtime/verifier.js +101 -2
  36. package/dist/runtime/workflow-plan-adapter.d.ts +2 -1
  37. package/dist/runtime/workflow-plan-adapter.js +78 -11
  38. package/dist/runtime/workflow-runtime-manifest.d.ts +48 -0
  39. package/dist/runtime/workflow-runtime-manifest.js +196 -0
  40. package/dist/runtime/workflow-variable-scopes.d.ts +12 -0
  41. package/dist/runtime/workflow-variable-scopes.js +55 -0
  42. package/dist/schema/types.d.ts +9 -0
  43. package/dist/schema/validate.js +29 -1
  44. package/dist/sources/authoring-packet.d.ts +8 -0
  45. package/dist/sources/authoring-packet.js +85 -0
  46. package/dist/sources/discovery.d.ts +7 -0
  47. package/dist/sources/discovery.js +150 -0
  48. package/dist/sources/license.d.ts +5 -0
  49. package/dist/sources/license.js +94 -0
  50. package/dist/sources/manifest.d.ts +11 -0
  51. package/dist/sources/manifest.js +84 -0
  52. package/dist/sources/skill-markdown.d.ts +6 -0
  53. package/dist/sources/skill-markdown.js +174 -0
  54. package/dist/sources/types.d.ts +125 -0
  55. package/dist/sources/types.js +1 -0
  56. package/dist/templates/asset-refinery.dna.yaml +192 -0
  57. package/dist/templates/flutter-behavior-lock.dna.yaml +17 -0
  58. package/dist/templates/flutter-refactoring-rescue.dna.yaml +11 -0
  59. package/dist/templates/flutter-rewrite.dna.yaml +154 -28
  60. package/dist/templates/metadata.js +2 -0
  61. package/dist/templates/multi-agent-handoff-coordination.dna.yaml +102 -37
  62. package/dist/templates/persistent-executor.dna.yaml +61 -3
  63. package/dist/templates/research-improvement.dna.yaml +295 -0
  64. package/dist/templates/subagent-parallel.dna.yaml +90 -17
  65. package/dist/templates/workflow-evidence-review.dna.yaml +8 -0
  66. package/dist/workflow/candidate-projection.d.ts +33 -0
  67. package/dist/workflow/candidate-projection.js +70 -0
  68. package/package.json +3 -1
  69. package/scripts/sync-release-plugin.cjs +87 -0
@@ -1,4 +1,4 @@
1
- # subagent-parallel: 多 Agent 并行 + 两阶段审查
1
+ # subagent-parallel: 有界并行执行 + 集成审查
2
2
  # 参考 Superpowers: subagent-driven-development + dispatching-parallel-agents
3
3
  # 参考 Cline KanBan: worktree isolation + dependency chain
4
4
  # 适用: 大型任务需要并行拆分执行
@@ -6,7 +6,7 @@
6
6
  version: "0.1.0"
7
7
  id: template_subagent_parallel
8
8
  name: Subagent Parallel Development
9
- purpose: Split large work into isolated subagent lanes with two-phase review before integration.
9
+ purpose: Split one bounded task into two isolated implementation lanes and review both committed results before any integration decision.
10
10
  maturity: reviewed
11
11
  fit:
12
12
  - Large tasks with independent subtasks and clear write-scope boundaries.
@@ -19,9 +19,9 @@ inputs:
19
19
  - lane ownership and write scopes
20
20
  - per-lane acceptance criteria
21
21
  outputs:
22
- - subtask implementation outputs
23
- - two-phase review evidence
24
- - integrated result plan
22
+ - two isolated lane commits
23
+ - integration review evidence
24
+ - explicit GO/NO-GO integration verdict
25
25
  lineage:
26
26
  source: subagent-driven development and parallel-agent workflow shape
27
27
  reference: docs/archive/2026H1/references/branch-consolidation-handoff-20260709.md
@@ -75,7 +75,7 @@ contexts: {}
75
75
 
76
76
  roles:
77
77
  architect:
78
- description: Decomposes tasks and reviews results
78
+ description: Decomposes a task into two non-overlapping lanes and reviews their committed results
79
79
  tool_permissions:
80
80
  allow: [Read, Grep, Glob, Bash]
81
81
  deny: [Edit, Write, NotebookEdit]
@@ -83,10 +83,10 @@ roles:
83
83
  read: ["**/*"]
84
84
  write: []
85
85
  instructions:
86
- - Break the task into independent subtasks that can run in parallel
87
- - Define clear inputs and outputs for each subtask
88
- - Review each subtask result for spec compliance first, then code quality
89
- - Reject and re-dispatch any subtask that fails review
86
+ - Define exactly two implementation lanes with non-overlapping file ownership
87
+ - Give each lane standalone acceptance criteria and verification commands
88
+ - Review both committed lane results for spec compliance first, then code quality
89
+ - Return a GO or NO-GO integration verdict without merging or promoting changes
90
90
 
91
91
  worker:
92
92
  description: Executes a single subtask in isolation
@@ -96,10 +96,10 @@ roles:
96
96
  read: ["**/*"]
97
97
  write: ["src/**", "test/**"]
98
98
  instructions:
99
- - Execute only the assigned subtask, nothing more
99
+ - Execute only the assigned lane from the declared plan, nothing more
100
100
  - Write tests for your changes
101
101
  - Do not modify files outside your assigned scope
102
- - Report completion with a summary of changes
102
+ - Commit the completed lane and return only its declared commit reference
103
103
 
104
104
 
105
105
  workflows:
@@ -108,12 +108,85 @@ workflows:
108
108
  steps:
109
109
  - id: plan
110
110
  role: architect
111
- description: Decompose task into parallel subtasks
112
- - id: execute
111
+ description: Decompose the task into exactly two independent lanes
112
+ prompt: |
113
+ Decompose task {{task_id}} into exactly two implementation lanes.
114
+ Name them Lane A and Lane B. For each lane, declare:
115
+ - exclusive file ownership with no cross-lane overlap;
116
+ - a standalone bounded task;
117
+ - acceptance criteria;
118
+ - verification commands.
119
+ Return the complete lane plan as your final response.
120
+ handoff:
121
+ produces:
122
+ - type: summary
123
+ name: lane_plan
124
+ description: Exact two-lane implementation plan
125
+
126
+ - id: execute-lane-a
113
127
  role: worker
114
128
  depends_on: [plan]
115
- description: Execute assigned subtask
129
+ isolation: worktree
130
+ max_attempts: 2
131
+ description: Execute only Lane A in an isolated worktree
132
+ prompt: |
133
+ Execute only Lane A from the declared lane plan.
134
+ Stay within Lane A ownership, run its verification commands, commit the
135
+ completed result, and stop. Do not start Lane B or merge another lane.
136
+ handoff:
137
+ consumes:
138
+ - type: summary
139
+ from: plan
140
+ name: lane_plan
141
+ description: Exact two-lane implementation plan
142
+ produces:
143
+ - type: git_commit
144
+ name: lane_a_commit
145
+ description: Verified Lane A implementation commit
146
+
147
+ - id: execute-lane-b
148
+ role: worker
149
+ depends_on: [plan]
150
+ isolation: worktree
151
+ max_attempts: 2
152
+ description: Execute only Lane B in an isolated worktree
153
+ prompt: |
154
+ Execute only Lane B from the declared lane plan.
155
+ Stay within Lane B ownership, run its verification commands, commit the
156
+ completed result, and stop. Do not start Lane A or merge another lane.
157
+ handoff:
158
+ consumes:
159
+ - type: summary
160
+ from: plan
161
+ name: lane_plan
162
+ description: Exact two-lane implementation plan
163
+ produces:
164
+ - type: git_commit
165
+ name: lane_b_commit
166
+ description: Verified Lane B implementation commit
167
+
116
168
  - id: review
117
169
  role: architect
118
- depends_on: [execute]
119
- description: Two-phase review (spec + quality)
170
+ depends_on: [execute-lane-a, execute-lane-b]
171
+ description: Review both lane commits after the parallel barrier
172
+ prompt: |
173
+ Review both declared lane commits against the exact lane plan.
174
+ First check each lane for specification compliance, then review code
175
+ quality, verification evidence, ownership overlap, and integration risk.
176
+ Return GO only when both lanes are acceptable and their integration order
177
+ is clear. Otherwise return NO-GO with bounded corrective actions.
178
+ Do not merge, promote, or start another worker.
179
+ handoff:
180
+ consumes:
181
+ - type: git_commit
182
+ from: execute-lane-a
183
+ name: lane_a_commit
184
+ description: Verified Lane A implementation commit
185
+ - type: git_commit
186
+ from: execute-lane-b
187
+ name: lane_b_commit
188
+ description: Verified Lane B implementation commit
189
+ produces:
190
+ - type: summary
191
+ name: integration_verdict
192
+ description: GO/NO-GO integration verdict with rationale
@@ -31,6 +31,14 @@ cascade:
31
31
  inherits: ["species:default"]
32
32
  priority: 100
33
33
 
34
+ variables:
35
+ asset:
36
+ description: "Workflow asset or module under review"
37
+ default: "$ARGUMENTS"
38
+ evidence_path:
39
+ description: "Primary evidence artifact"
40
+ default: ".dna/fix-progress/$ARGUMENTS.json"
41
+
34
42
  evidence:
35
43
  - label: Flutter rewrite dogfood progress JSON
36
44
  kind: reference
@@ -0,0 +1,33 @@
1
+ import type { CapabilitySupportStatus, SyncTarget } from "../runtime/sync-target-plan.js";
2
+ export declare const CANDIDATE_PROJECTION_SCHEMA_VERSION: "intentdna.candidate_projection.v1";
3
+ export type CandidateProjectionTarget = "claude" | "codex";
4
+ export interface CandidateProjectionOptions {
5
+ candidatePath: string;
6
+ projectDir: string;
7
+ target: CandidateProjectionTarget;
8
+ packageVersion: string;
9
+ }
10
+ export interface CandidateProjectionCapability {
11
+ capability: string;
12
+ status: CapabilitySupportStatus;
13
+ surfaces: string[];
14
+ evidence_refs: string[];
15
+ notes: string[];
16
+ }
17
+ export interface CandidateProjectionLoss {
18
+ capability: string;
19
+ status: Exclude<CapabilitySupportStatus, "supported">;
20
+ reason: string;
21
+ }
22
+ export interface CandidateProjectionReport {
23
+ schema_version: typeof CANDIDATE_PROJECTION_SCHEMA_VERSION;
24
+ mode: "dry_run";
25
+ candidate_path: string;
26
+ target: CandidateProjectionTarget;
27
+ adapter_target: SyncTarget;
28
+ summary: string;
29
+ capabilities: CandidateProjectionCapability[];
30
+ losses: CandidateProjectionLoss[];
31
+ unsupported: string[];
32
+ }
33
+ export declare function projectCandidateDryRun(options: CandidateProjectionOptions): Promise<CandidateProjectionReport>;
@@ -0,0 +1,70 @@
1
+ import { compileFromFiles } from "../compiler/index.js";
2
+ import { createClaudeCoreSyncTargetPlan, formatClaudeCoreSyncTargetPlanDryRun, } from "../runtime/claude-sync-target.js";
3
+ import { createCodexSyncTargetPlan, formatCodexSyncTargetPlanSummary, } from "../runtime/codex-sync-target.js";
4
+ export const CANDIDATE_PROJECTION_SCHEMA_VERSION = "intentdna.candidate_projection.v1";
5
+ function normalizeCapabilities(report) {
6
+ return Object.entries(report.capabilities)
7
+ .sort(([left], [right]) => left.localeCompare(right))
8
+ .map(([capability, entry]) => ({
9
+ capability,
10
+ status: entry.status,
11
+ surfaces: [...entry.surfaces],
12
+ evidence_refs: [...entry.evidenceRefs],
13
+ notes: [...entry.notes],
14
+ }));
15
+ }
16
+ function lossReason(capability) {
17
+ if (capability.notes.length > 0)
18
+ return capability.notes.join(" ");
19
+ if (capability.surfaces.length > 0) {
20
+ return `${capability.capability} is ${capability.status} on ${capability.surfaces.join(", ")}.`;
21
+ }
22
+ return `${capability.capability} is ${capability.status} for this projection target.`;
23
+ }
24
+ function projectionLosses(capabilities) {
25
+ return capabilities
26
+ .filter((capability) => capability.status !== "supported")
27
+ .map((capability) => ({
28
+ capability: capability.capability,
29
+ status: capability.status,
30
+ reason: lossReason(capability),
31
+ }));
32
+ }
33
+ function unsupportedGaps(report, planUnsupported) {
34
+ return [...new Set([...report.unsupported, ...planUnsupported])].sort((left, right) => left.localeCompare(right));
35
+ }
36
+ export async function projectCandidateDryRun(options) {
37
+ const ir = await compileFromFiles([options.candidatePath], { cwd: options.projectDir });
38
+ if (options.target === "claude") {
39
+ const plan = createClaudeCoreSyncTargetPlan({
40
+ projectDir: options.projectDir,
41
+ ir,
42
+ mode: "bin",
43
+ });
44
+ const capabilities = normalizeCapabilities(plan.capabilityReport);
45
+ return {
46
+ schema_version: CANDIDATE_PROJECTION_SCHEMA_VERSION,
47
+ mode: "dry_run",
48
+ candidate_path: options.candidatePath,
49
+ target: options.target,
50
+ adapter_target: plan.target,
51
+ summary: formatClaudeCoreSyncTargetPlanDryRun(plan),
52
+ capabilities,
53
+ losses: projectionLosses(capabilities),
54
+ unsupported: unsupportedGaps(plan.capabilityReport, plan.unsupported),
55
+ };
56
+ }
57
+ const plan = createCodexSyncTargetPlan(ir, { packageVersion: options.packageVersion });
58
+ const capabilities = normalizeCapabilities(plan.capabilityReport);
59
+ return {
60
+ schema_version: CANDIDATE_PROJECTION_SCHEMA_VERSION,
61
+ mode: "dry_run",
62
+ candidate_path: options.candidatePath,
63
+ target: options.target,
64
+ adapter_target: plan.target,
65
+ summary: formatCodexSyncTargetPlanSummary(plan),
66
+ capabilities,
67
+ losses: projectionLosses(capabilities),
68
+ unsupported: unsupportedGaps(plan.capabilityReport, plan.unsupported),
69
+ };
70
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "intentdna",
3
- "version": "1.8.7",
3
+ "version": "1.9.0-rc.2",
4
4
  "description": "Intent DNA — Declarative policy layer for AI agent behavior",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -13,6 +13,7 @@
13
13
  "scripts": {
14
14
  "build": "tsc && mkdir -p dist/species dist/templates && cp src/species/*.json dist/species/ && cp src/templates/*.yaml dist/templates/ && node scripts/sync-plugin-version.cjs",
15
15
  "dev": "tsc --watch",
16
+ "release:sync-plugin": "node scripts/sync-release-plugin.cjs",
16
17
  "test": "node --experimental-vm-modules node_modules/.bin/vitest run",
17
18
  "test:watch": "node --experimental-vm-modules node_modules/.bin/vitest"
18
19
  },
@@ -37,6 +38,7 @@
37
38
  "spec",
38
39
  ".claude-plugin",
39
40
  "hooks",
41
+ "scripts/sync-release-plugin.cjs",
40
42
  "README.md",
41
43
  "LICENSE"
42
44
  ],
@@ -0,0 +1,87 @@
1
+ #!/usr/bin/env node
2
+ const { execFileSync } = require("node:child_process");
3
+ const { readFileSync } = require("node:fs");
4
+ const { resolve } = require("node:path");
5
+
6
+ const MARKETPLACE = "intentdna";
7
+ const PLUGIN = "intentdna@intentdna";
8
+
9
+ function runClaude(claudeBin, args) {
10
+ try {
11
+ return execFileSync(claudeBin, args, {
12
+ encoding: "utf8",
13
+ stdio: ["ignore", "pipe", "pipe"],
14
+ timeout: 60_000,
15
+ });
16
+ } catch (error) {
17
+ const stderr = error && typeof error === "object" && "stderr" in error
18
+ ? String(error.stderr ?? "").trim()
19
+ : "";
20
+ const detail = stderr ? `: ${stderr}` : "";
21
+ throw new Error(`Claude command failed: ${claudeBin} ${args.join(" ")}${detail}`);
22
+ }
23
+ }
24
+
25
+ function installedPluginInfo(output) {
26
+ const pluginStart = output.indexOf(PLUGIN);
27
+ if (pluginStart === -1) return null;
28
+ const block = output.slice(pluginStart).split(/\n\s*\n/, 1)[0];
29
+ return {
30
+ version: block.match(/Version:\s*([^\s]+)/)?.[1] ?? null,
31
+ enabled: /Status:\s*.*\benabled\b/i.test(block),
32
+ };
33
+ }
34
+
35
+ function marketplacePluginVersion(output) {
36
+ return output.match(/^\s*intentdna\s+([^\s]+)\s*$/m)?.[1] ?? null;
37
+ }
38
+
39
+ function main() {
40
+ const pkg = JSON.parse(readFileSync(resolve(process.cwd(), "package.json"), "utf8"));
41
+ const expectedVersion = pkg.version;
42
+ if (typeof expectedVersion !== "string" || expectedVersion.trim() === "") {
43
+ throw new Error("package.json must contain a release version");
44
+ }
45
+
46
+ const claudeBin = process.env.INTENTDNA_CLAUDE_BIN || "claude";
47
+ runClaude(claudeBin, ["plugin", "marketplace", "update", MARKETPLACE]);
48
+ runClaude(claudeBin, ["plugin", "update", PLUGIN]);
49
+
50
+ const installedPlugin = installedPluginInfo(
51
+ runClaude(claudeBin, ["plugin", "list"]),
52
+ );
53
+ if (!installedPlugin?.version) {
54
+ throw new Error(`IntentDNA Claude plugin is not installed: ${PLUGIN}`);
55
+ }
56
+ if (installedPlugin.version !== expectedVersion) {
57
+ throw new Error(
58
+ `installed Claude plugin version ${installedPlugin.version} does not match release ${expectedVersion}`,
59
+ );
60
+ }
61
+ if (!installedPlugin.enabled) {
62
+ throw new Error(`IntentDNA Claude plugin is not enabled: ${PLUGIN}`);
63
+ }
64
+
65
+ const marketplaceVersion = marketplacePluginVersion(
66
+ runClaude(claudeBin, ["plugin", "details", PLUGIN]),
67
+ );
68
+ if (!marketplaceVersion) {
69
+ throw new Error(`IntentDNA marketplace version could not be resolved: ${PLUGIN}`);
70
+ }
71
+ if (marketplaceVersion !== expectedVersion) {
72
+ throw new Error(
73
+ `Claude marketplace version ${marketplaceVersion} does not match release ${expectedVersion}`,
74
+ );
75
+ }
76
+
77
+ process.stdout.write(`IntentDNA Claude plugin synchronized: ${expectedVersion}\n`);
78
+ process.stdout.write("Restart Claude Code before dogfood so the updated hooks are loaded.\n");
79
+ }
80
+
81
+ try {
82
+ main();
83
+ } catch (error) {
84
+ const message = error instanceof Error ? error.message : String(error);
85
+ process.stderr.write(`Release plugin synchronization failed: ${message}\n`);
86
+ process.exitCode = 1;
87
+ }