intentdna 1.2.0 → 1.2.1

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 (58) hide show
  1. package/dist/cli/commands/init.d.ts +2 -0
  2. package/dist/cli/commands/init.d.ts.map +1 -1
  3. package/dist/cli/commands/init.js +206 -13
  4. package/dist/cli/commands/init.js.map +1 -1
  5. package/dist/cli/commands/run.d.ts.map +1 -1
  6. package/dist/cli/commands/run.js +81 -0
  7. package/dist/cli/commands/run.js.map +1 -1
  8. package/dist/cli/index.js +6 -0
  9. package/dist/cli/index.js.map +1 -1
  10. package/dist/compiler/cascade.d.ts +8 -1
  11. package/dist/compiler/cascade.d.ts.map +1 -1
  12. package/dist/compiler/cascade.js +40 -4
  13. package/dist/compiler/cascade.js.map +1 -1
  14. package/dist/compiler/compile.d.ts.map +1 -1
  15. package/dist/compiler/compile.js +28 -0
  16. package/dist/compiler/compile.js.map +1 -1
  17. package/dist/compiler/workflow.d.ts.map +1 -1
  18. package/dist/compiler/workflow.js +2 -0
  19. package/dist/compiler/workflow.js.map +1 -1
  20. package/dist/runtime/hooks.d.ts.map +1 -1
  21. package/dist/runtime/hooks.js +141 -1
  22. package/dist/runtime/hooks.js.map +1 -1
  23. package/dist/runtime/skill-adapter.d.ts.map +1 -1
  24. package/dist/runtime/skill-adapter.js +5 -1
  25. package/dist/runtime/skill-adapter.js.map +1 -1
  26. package/dist/runtime/workflow-runner.d.ts.map +1 -1
  27. package/dist/runtime/workflow-runner.js +13 -0
  28. package/dist/runtime/workflow-runner.js.map +1 -1
  29. package/dist/schema/types.d.ts +36 -0
  30. package/dist/schema/types.d.ts.map +1 -1
  31. package/dist/schema/validate.d.ts +1 -0
  32. package/dist/schema/validate.d.ts.map +1 -1
  33. package/dist/schema/validate.js +57 -4
  34. package/dist/schema/validate.js.map +1 -1
  35. package/dist/templates/api-backend.dna.yaml +1 -0
  36. package/dist/templates/brainstorming-first.dna.yaml +1 -0
  37. package/dist/templates/branch-finishing.dna.yaml +1 -0
  38. package/dist/templates/code-review-pipeline.dna.yaml +13 -0
  39. package/dist/templates/devops-cicd.dna.yaml +1 -0
  40. package/dist/templates/documentation-writer.dna.yaml +1 -0
  41. package/dist/templates/enterprise-baseline.dna.yaml +1 -0
  42. package/dist/templates/flutter-behavior-lock.dna.yaml +18 -0
  43. package/dist/templates/flutter-refactoring-rescue.dna.yaml +14 -0
  44. package/dist/templates/flutter-rewrite.dna.yaml +55 -16
  45. package/dist/templates/frontend-quality.dna.yaml +1 -0
  46. package/dist/templates/full-pipeline.dna.yaml +27 -0
  47. package/dist/templates/mobile-dev.dna.yaml +1 -0
  48. package/dist/templates/monorepo-governance.dna.yaml +1 -0
  49. package/dist/templates/multi-perspective-review.dna.yaml +14 -0
  50. package/dist/templates/pr-submitter.dna.yaml +1 -0
  51. package/dist/templates/safe-refactoring.dna.yaml +1 -0
  52. package/dist/templates/secure-dev.dna.yaml +1 -0
  53. package/dist/templates/subagent-parallel.dna.yaml +18 -0
  54. package/dist/templates/systematic-debugging.dna.yaml +1 -0
  55. package/dist/templates/tdd-strict.dna.yaml +1 -0
  56. package/dist/templates/verification-loop.dna.yaml +1 -0
  57. package/dist/templates/yolo-with-guardrails.dna.yaml +1 -0
  58. package/package.json +1 -1
@@ -6,6 +6,7 @@ version: "0.1.0"
6
6
  id: template_flutter_rewrite
7
7
  name: Flutter Rewrite (Unified)
8
8
  type: project
9
+ namespace: frw
9
10
 
10
11
  cascade:
11
12
  inherits: ["species:default"]
@@ -99,6 +100,28 @@ genes:
99
100
 
100
101
  contexts: {}
101
102
 
103
+ modes:
104
+ scan:
105
+ description: "Read v1 source, generate behavior docs. No code modification."
106
+ tool_permissions:
107
+ deny: [Edit, Write, NotebookEdit]
108
+ test:
109
+ description: "Write behavior tests for v2. Only write to test/ and docs/."
110
+ scope:
111
+ write: ["test/**", "docs/behavior/**"]
112
+ investigate:
113
+ description: "Trace broken call chains. Read-only analysis."
114
+ tool_permissions:
115
+ deny: [Edit, Write, NotebookEdit]
116
+ fix:
117
+ description: "Fix identified breakpoints. Write to lib/ and v2/ only."
118
+ scope:
119
+ write: ["lib/**", "v2/**"]
120
+ align:
121
+ description: "Align v2 core with v1 infrastructure. Write to core only."
122
+ scope:
123
+ write: ["v2/packages/core/**"]
124
+
102
125
  roles:
103
126
  # ── Phase 0/3: behavior-lock 角色 ──
104
127
  scanner:
@@ -116,7 +139,7 @@ roles:
116
139
  - Do NOT read v2 code — only v1
117
140
 
118
141
  test_writer:
119
- description: Reads behavior document, writes unit tests for v2.
142
+ description: Reads behavior document, writes tests for all layers (logic + widget).
120
143
  tool_permissions:
121
144
  allow: [Read, Edit, Write, Grep, Glob, Bash]
122
145
  scope:
@@ -126,9 +149,10 @@ roles:
126
149
  - Read the behavior document for the module
127
150
  - Write one test file per page/screen
128
151
  - Each user action = one test case
129
- - Test service/repository layer, not UI
152
+ - "Test ALL layers: state/notifier logic, widget rendering, navigation"
153
+ - "Widget tests: use WidgetTester, wrap with ProviderScope, mock dependencies"
130
154
  - Run tests after writing — record baseline
131
- - Red tests are expected
155
+ - Red tests are expected (implementation doesn't exist yet)
132
156
 
133
157
  # ── Phase 4: rescue 角色 ──
134
158
  investigator:
@@ -146,21 +170,22 @@ roles:
146
170
  - Never suggest code changes
147
171
 
148
172
  surgeon:
149
- description: Fixes one breakpoint at a time by understanding v1 intent and rewriting in v2 style.
173
+ description: Fixes breakpoints and builds missing layers by understanding v1 intent and rewriting in v2 style.
150
174
  tool_permissions:
151
175
  allow: [Read, Edit, Write, Grep, Glob, Bash]
152
176
  scope:
153
177
  read: ["**/*"]
154
- write: ["lib/**", "v2/**"]
178
+ write: ["lib/**", "v2/**", "test/**"]
155
179
  instructions:
156
- - Fix only the identified breakpoint
180
+ - Fix only the identified breakpoint or missing implementation
157
181
  - Read v1 to understand intent, rewrite in v2 framework style
158
182
  - Do not copy v1 code verbatim — adapt to v2 architecture
159
- - Change at most one call chain (2-3 files) per round
183
+ - "Logic layer: implement notifier/state, make logic tests pass"
184
+ - "Widget layer: copy widget from v1, only change state binding (Obx→Consumer, Get.to→context.go)"
185
+ - "Widget test infra: set up ProviderScope + mock providers + GoRouter test config when needed"
160
186
  - After each change, run tests
161
187
  - If fix doesn't work, revert and re-analyze
162
188
  - Never "improve" code — preserve exact behavior
163
- - "UI files: copy from v1, only change state binding syntax (Obx→Consumer, Get.to→context.go)"
164
189
 
165
190
  # ── Core align 角色 ──
166
191
  core_aligner:
@@ -180,31 +205,44 @@ roles:
180
205
  workflows:
181
206
  behavior-lock:
182
207
  name: Behavior Lock
183
- description: "Scan v1 module $ARGUMENTS, generate behavior doc and tests for v2"
208
+ description: "Scan v1 module $ARGUMENTS, generate behavior doc and tests for v2, commit"
184
209
  steps:
185
210
  - id: scan
186
211
  role: scanner
212
+ mode: scan
187
213
  description: "Scan v1 module in {{v1_path}}/. Output behavior doc to {{behavior_docs}}/$ARGUMENTS.md. List all user actions with call chains."
188
214
  prompt: "Scan module '$ARGUMENTS' in {{v1_path}}/. For each page, list: action → function() → return value. Output to {{behavior_docs}}/$ARGUMENTS.md. Then immediately proceed to write_tests."
189
215
  - id: write_tests
190
216
  role: test_writer
217
+ mode: test
191
218
  depends_on: [scan]
192
- description: "Read {{behavior_docs}}/$ARGUMENTS.md, write tests in {{test_path}}/$ARGUMENTS/, run baseline."
193
- prompt: "Read {{behavior_docs}}/$ARGUMENTS.md. Write tests in {{test_path}}/$ARGUMENTS/. Run tests, record red/green baseline. Append baseline to behavior doc."
219
+ description: "Read {{behavior_docs}}/$ARGUMENTS.md, write tests in {{test_path}}/$ARGUMENTS/, run baseline, commit."
220
+ prompt: "Read {{behavior_docs}}/$ARGUMENTS.md. Write tests in {{test_path}}/$ARGUMENTS/. Test ALL layers: logic, widget, navigation. Run tests, record red/green baseline. Append baseline to behavior doc. Git commit: behavior-lock($ARGUMENTS): X tests (Y red, Z skipped)"
194
221
 
195
222
  rescue:
196
223
  name: Rescue
197
- description: "Fix v2 module $ARGUMENTS by making failing tests pass"
224
+ description: "Fix v2 module $ARGUMENTS logic layer first, then widget layer, commit when done"
198
225
  steps:
199
226
  - id: investigate
200
227
  role: investigator
201
- description: "Run tests, find first red test, trace the broken call chain in v1 and v2."
202
- prompt: "Run tests in {{test_path}}/$ARGUMENTS/. For the first red test, trace: what does v1 do vs what does v2 do? Find the breakpoint. Report and wait for user confirmation."
228
+ mode: investigate
229
+ description: "Run tests, assess current state, pick next targets."
230
+ prompt: "Run tests in {{test_path}}/$ARGUMENTS/. Categorize all non-passing tests: 1) RED (failing) — highest priority, fix first. 2) SKIPPED-logic — state/notifier/service tests, fix second. 3) SKIPPED-widget — widget/UI/navigation tests, fix after logic is done. For the highest priority category, pick a batch of related tests. Trace: what does v1 do vs what does v2 do? Find the breakpoints. Report findings and the plan for this round."
203
231
  - id: fix
204
232
  role: surgeon
233
+ mode: fix
205
234
  depends_on: [investigate]
206
- description: "Fix the breakpoint. Read v1 intent, rewrite in v2 style. Run tests after."
207
- prompt: "Fix the identified breakpoint. Read v1 in {{v1_path}}/. Rewrite in v2 style in {{v2_path}}/. Run tests. Red→green = done. Still red = revert and re-analyze."
235
+ description: "Fix the identified issues. Handle both logic and widget layers."
236
+ checkpoints:
237
+ - assert: clean_working_tree
238
+ message: "Commit all changes before proceeding to report step"
239
+ prompt: "Fix the identified breakpoints. Read v1 in {{v1_path}}/. Rewrite in v2 style in {{v2_path}}/. Logic tests: implement notifier/state/service code. Widget tests: copy widget from v1, change bindings (Obx→Consumer, Get.to→context.go), set up widget test infra (ProviderScope, mock providers, GoRouter) if needed. Run tests after each fix. Red→green or Skipped→green = done. Still failing = revert and re-analyze. Maximize test coverage per round. When done, commit all changes: rescue($ARGUMENTS): round N — X passed (+Y)"
240
+ - id: report
241
+ role: investigator
242
+ mode: investigate
243
+ depends_on: [fix]
244
+ description: "Summarize round, guide next steps."
245
+ prompt: "Run full test suite in {{test_path}}/$ARGUMENTS/. Report: 1) passed/skipped/failed delta vs last round. 2) List remaining skipped tests by category (logic vs widget vs platform). 3) If skipped tests remain, end with: Run /rescue $ARGUMENTS to continue. 4) If all tests pass, end with: Module $ARGUMENTS rescue complete."
208
246
 
209
247
  core-align:
210
248
  name: Core Align
@@ -212,5 +250,6 @@ workflows:
212
250
  steps:
213
251
  - id: align
214
252
  role: core_aligner
253
+ mode: align
215
254
  description: "Compare {{v1_path}}/ and {{v2_path}}/core/ module by module. Fix mismatches."
216
255
  prompt: "Compare v1 ({{v1_path}}/) and v2 core ({{v2_path}}/core/lib/). List mismatches. Fix by copying v1 logic, only changing DI (GetX→Riverpod). Run flutter analyze after each fix."
@@ -6,6 +6,7 @@ version: "0.1.0"
6
6
  id: template_frontend_quality
7
7
  name: Frontend Quality Standards
8
8
  type: project
9
+ namespace: fe
9
10
 
10
11
  cascade:
11
12
  inherits: ["species:default"]
@@ -6,6 +6,7 @@ version: "0.1.0"
6
6
  id: template_full_pipeline
7
7
  name: Full Development Pipeline
8
8
  type: project
9
+ namespace: fp
9
10
 
10
11
  cascade:
11
12
  inherits: ["species:default"]
@@ -99,25 +100,51 @@ roles:
99
100
 
100
101
  contexts: {}
101
102
 
103
+ modes:
104
+ plan:
105
+ description: "Read requirements, produce design docs. No source code edits."
106
+ tool_permissions:
107
+ deny: [Edit]
108
+ scope:
109
+ write: ["docs/tasks/**"]
110
+ implement:
111
+ description: "Implement features. Write to src/ and test/."
112
+ scope:
113
+ write: ["src/**", "test/**"]
114
+ test:
115
+ description: "Run and fix tests. Write to test/ only."
116
+ scope:
117
+ write: ["test/**"]
118
+ review:
119
+ description: "Review code. No source code edits."
120
+ tool_permissions:
121
+ deny: [Edit]
122
+ scope:
123
+ write: ["docs/reviews/**"]
124
+
102
125
  workflow:
103
126
  name: dev-pipeline
104
127
  description: Plan, implement, test, review cycle with retry
105
128
  steps:
106
129
  - id: plan
107
130
  role: planner
131
+ mode: plan
108
132
  description: Read task and produce design document
109
133
  run_if: "round == 1"
110
134
  prompt: "Read task {{task_id}} from BOARD.md. Produce a design document."
111
135
  - id: implement
112
136
  role: implementer
137
+ mode: implement
113
138
  description: Implement according to design
114
139
  prompt: "Implement task {{task_id}} following the design document."
115
140
  - id: test
116
141
  role: tester
142
+ mode: test
117
143
  description: Run tests and fix failures
118
144
  prompt: "Run tests. Fix failures. Add missing tests for {{task_id}}."
119
145
  - id: review
120
146
  role: reviewer
147
+ mode: review
121
148
  description: Review and output verdict
122
149
  prompt: "Review changes for {{task_id}}. Output PASS or FAIL."
123
150
  transitions:
@@ -5,6 +5,7 @@ version: "0.1.0"
5
5
  id: template_mobile_dev
6
6
  name: Mobile Development Standards
7
7
  type: project
8
+ namespace: mob
8
9
 
9
10
  cascade:
10
11
  inherits: ["species:default"]
@@ -7,6 +7,7 @@ version: "0.1.0"
7
7
  id: template_monorepo_governance
8
8
  name: Monorepo Governance
9
9
  type: project
10
+ namespace: mono
10
11
 
11
12
  cascade:
12
13
  inherits: ["species:default"]
@@ -7,6 +7,7 @@ version: "0.1.0"
7
7
  id: template_multi_perspective_review
8
8
  name: Multi-Perspective Review
9
9
  type: project
10
+ namespace: mpr
10
11
 
11
12
  cascade:
12
13
  inherits: ["species:default"]
@@ -93,17 +94,30 @@ roles:
93
94
  - Document trade-offs and accepted risks
94
95
  - If unclear, escalate to human
95
96
 
97
+ modes:
98
+ debate:
99
+ description: "Argue for or against proposed change. Read-only."
100
+ tool_permissions:
101
+ deny: [Edit, Write, NotebookEdit]
102
+ decide:
103
+ description: "Make final decision. Read-only."
104
+ tool_permissions:
105
+ deny: [Edit, Write, NotebookEdit]
106
+
96
107
  workflows:
97
108
  debate-review:
98
109
  name: Debate Review
99
110
  steps:
100
111
  - id: advocate
101
112
  role: advocate
113
+ mode: debate
102
114
  description: Argue for the proposed change
103
115
  - id: critique
104
116
  role: critic
117
+ mode: debate
105
118
  description: Argue against the proposed change
106
119
  - id: decide
107
120
  role: arbiter
121
+ mode: decide
108
122
  depends_on: [advocate, critique]
109
123
  description: Final decision with rationale
@@ -6,6 +6,7 @@ version: "0.1.0"
6
6
  id: template_pr_submitter
7
7
  name: PR Submitter Checklist
8
8
  type: project
9
+ namespace: pr
9
10
 
10
11
  cascade:
11
12
  inherits: ["species:default"]
@@ -7,6 +7,7 @@ version: "0.1.0"
7
7
  id: template_safe_refactoring
8
8
  name: Safe Refactoring
9
9
  type: project
10
+ namespace: sr
10
11
 
11
12
  cascade:
12
13
  inherits: ["species:default"]
@@ -6,6 +6,7 @@ version: "0.1.0"
6
6
  id: template_secure_dev
7
7
  name: Secure Development Baseline
8
8
  type: project
9
+ namespace: sd
9
10
 
10
11
  cascade:
11
12
  inherits: ["species:default"]
@@ -7,6 +7,7 @@ version: "0.1.0"
7
7
  id: template_subagent_parallel
8
8
  name: Subagent Parallel Development
9
9
  type: project
10
+ namespace: sap
10
11
 
11
12
  cascade:
12
13
  inherits: ["species:default"]
@@ -81,18 +82,35 @@ roles:
81
82
  - Do not modify files outside your assigned scope
82
83
  - Report completion with a summary of changes
83
84
 
85
+ modes:
86
+ plan:
87
+ description: "Decompose task into subtasks. Read-only."
88
+ tool_permissions:
89
+ deny: [Edit, Write, NotebookEdit]
90
+ execute:
91
+ description: "Execute subtask. Write to src/ and test/."
92
+ scope:
93
+ write: ["src/**", "test/**"]
94
+ review:
95
+ description: "Two-phase review. Read-only."
96
+ tool_permissions:
97
+ deny: [Edit, Write, NotebookEdit]
98
+
84
99
  workflows:
85
100
  parallel-dev:
86
101
  name: Parallel Development
87
102
  steps:
88
103
  - id: plan
89
104
  role: architect
105
+ mode: plan
90
106
  description: Decompose task into parallel subtasks
91
107
  - id: execute
92
108
  role: worker
109
+ mode: execute
93
110
  depends_on: [plan]
94
111
  description: Execute assigned subtask
95
112
  - id: review
96
113
  role: architect
114
+ mode: review
97
115
  depends_on: [execute]
98
116
  description: Two-phase review (spec + quality)
@@ -6,6 +6,7 @@ version: "0.1.0"
6
6
  id: template_systematic_debugging
7
7
  name: Systematic Debugging
8
8
  type: project
9
+ namespace: dbg
9
10
 
10
11
  cascade:
11
12
  inherits: ["species:default"]
@@ -6,6 +6,7 @@ version: "0.1.0"
6
6
  id: template_tdd_strict
7
7
  name: Strict Test-Driven Development
8
8
  type: project
9
+ namespace: tdd
9
10
 
10
11
  cascade:
11
12
  inherits: ["species:default"]
@@ -7,6 +7,7 @@ version: "0.1.0"
7
7
  id: template_verification_loop
8
8
  name: Verification Before Completion
9
9
  type: project
10
+ namespace: vl
10
11
 
11
12
  cascade:
12
13
  inherits: ["species:default"]
@@ -6,6 +6,7 @@ version: "0.1.0"
6
6
  id: template_yolo_guardrails
7
7
  name: YOLO with Guardrails
8
8
  type: personal
9
+ namespace: yolo
9
10
 
10
11
  cascade:
11
12
  inherits: ["species:default"]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "intentdna",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "Intent DNA — Declarative policy layer for AI agent behavior",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",