declare-cc 0.5.3 → 0.5.6

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.
@@ -24,12 +24,24 @@ If no declarations exist in the graph, tell the user to run `/declare:future` fi
24
24
 
25
25
  Note all declarations and milestones from the graph -- the workflow needs full context.
26
26
 
27
- **Step 2: Determine scope.**
27
+ **Step 2: Scope review (first-time derivation only).**
28
+
29
+ Skip this step if `$ARGUMENTS` contains a specific declaration ID (e.g., `D-01`) — targeted re-derivation skips scope review.
30
+
31
+ Otherwise, check if any milestones already exist in the graph. If milestones already exist, this is a re-derivation — skip scope review and proceed to Step 3.
32
+
33
+ If this is the first time deriving milestones (no milestones in the graph yet), run the scope review workflow before deriving anything:
34
+
35
+ @workflows/scope.md
36
+
37
+ Pass all declarations from the loaded graph into the scope workflow. After the scope is confirmed, continue to Step 3.
38
+
39
+ **Step 3: Determine derivation scope.**
28
40
 
29
41
  - If `$ARGUMENTS` contains a declaration ID (e.g., `D-01`), derive only for that specific declaration.
30
42
  - Otherwise, derive for all declarations that have no milestones yet (declarations with empty milestones arrays in the graph).
31
43
 
32
- **Step 3: Follow the milestone derivation workflow.**
44
+ **Step 4: Follow the milestone derivation workflow.**
33
45
 
34
46
  Read and follow the full workflow instructions:
35
47
 
@@ -37,7 +49,7 @@ Read and follow the full workflow instructions:
37
49
 
38
50
  Pass the loaded graph state into the workflow so it knows about existing declarations and milestones.
39
51
 
40
- **Step 4: Per-declaration milestone confirmation with checkboxes.**
52
+ **Step 5: Per-declaration milestone confirmation with checkboxes.**
41
53
 
42
54
  After the workflow proposes milestones for a declaration, present them using AskUserQuestion with multi-select checkboxes:
43
55
 
@@ -50,7 +62,7 @@ Which of these milestones should we create for D-XX?
50
62
  - [ ] Milestone C -- because [reason]
51
63
  ```
52
64
 
53
- **Step 5: Persist all accepted milestones in one batch call.**
65
+ **Step 6: Persist all accepted milestones in one batch call.**
54
66
 
55
67
  Build a JSON array of the checked milestones, then create them all at once:
56
68
 
@@ -60,7 +72,7 @@ node dist/declare-tools.cjs add-milestones --json '[{"title":"Milestone A","real
60
72
 
61
73
  This creates all milestones and makes a single git commit. Parse the JSON output — it returns `{ milestones: [{ id, title, realizes, status }], committed, hash }`.
62
74
 
63
- **Step 6: Inconsistency flagging.**
75
+ **Step 7: Inconsistency flagging.**
64
76
 
65
77
  If milestones already exist for a declaration being processed (re-derivation case):
66
78
  - Show existing milestones for that declaration
@@ -68,7 +80,7 @@ If milestones already exist for a declaration being processed (re-derivation cas
68
80
  - Offer to keep, re-derive, or adjust
69
81
  - Do NOT auto-reconcile -- the user decides what to update
70
82
 
71
- **Step 7: Show summary and suggest next step.**
83
+ **Step 8: Show summary and suggest next step.**
72
84
 
73
85
  After all declarations processed:
74
86
 
@@ -60,7 +60,37 @@ If no actions found, display: "No actions found for M-XX. Run `/declare:actions
60
60
 
61
61
  If all actions already have EXEC-PLANs and status is not PENDING, display: "All actions for M-XX already have EXEC-PLANs. Use `/declare:execute M-XX` to run them." and exit.
62
62
 
63
- **Step 3: Research check (unless --skip-research).**
63
+ **Step 3: Ensure milestone context exists.**
64
+
65
+ Check if CONTEXT.md exists at `milestoneFolderPath/CONTEXT.md`.
66
+
67
+ If CONTEXT.md does **not** exist, use AskUserQuestion:
68
+ - header: "Context"
69
+ - question: "Milestone [M-XX] has no implementation context yet. Discussing decisions now gives the planner the information it needs to create better EXEC-PLANs."
70
+ - options:
71
+ - "Discuss first (Recommended)" — Run discuss workflow, then proceed to planning
72
+ - "Plan without context" — Skip; planner will use its own judgment
73
+
74
+ If "Discuss first":
75
+
76
+ Display: `Running /declare:discuss [M-XX]...`
77
+
78
+ Spawn a Task agent:
79
+ - subagent_type: `general-purpose`
80
+ - description: `Discuss M-XX implementation decisions`
81
+ - prompt:
82
+ ```
83
+ Run /declare:discuss [M-XX] for the Declare project.
84
+ Working directory: [absolute cwd]
85
+ Follow all instructions in commands/declare/discuss.md.
86
+ After capturing context, return DONE.
87
+ ```
88
+
89
+ Wait for the task to complete. Then reload `contextPath` — CONTEXT.md should now exist.
90
+
91
+ If "Plan without context": continue to Step 4.
92
+
93
+ **Step 4: Research check (unless --skip-research).**
64
94
 
65
95
  If `researchPath` exists, display:
66
96
  ```
@@ -79,7 +109,7 @@ If `researchPath` does not exist, assess whether research is needed:
79
109
 
80
110
  - If actions are purely internal (refactoring, adding features to existing patterns, docs) → skip silently.
81
111
 
82
- **Step 4: Load context files.**
112
+ **Step 5: Load context files.**
83
113
 
84
114
  ```bash
85
115
  cat [contextPath] 2>/dev/null # CONTEXT.md if exists
@@ -91,7 +121,7 @@ cat .planning/STATE.md 2>/dev/null # Current position and decisions
91
121
 
92
122
  Also read the milestone's PLAN.md (at `milestoneFolderPath/PLAN.md`) for action details.
93
123
 
94
- **Step 5: Spawn declare-planner.**
124
+ **Step 6: Spawn declare-planner.**
95
125
 
96
126
  Spawn a Task agent using `agents/declare-planner.md` with the following prompt:
97
127
 
@@ -118,7 +148,7 @@ Return: PLANNING COMPLETE with wave structure and EXEC-PLANs created.
118
148
 
119
149
  Wait for the planner to complete.
120
150
 
121
- **Step 6: Spawn declare-plan-checker.**
151
+ **Step 7: Spawn declare-plan-checker.**
122
152
 
123
153
  After planner completes, spawn a Task agent using `agents/declare-plan-checker.md` with the following prompt:
124
154
 
@@ -141,15 +171,15 @@ Return: VERIFICATION PASSED or ISSUES FOUND with structured issues YAML.
141
171
 
142
172
  Wait for the checker to complete.
143
173
 
144
- **Step 7: Evaluate checker result.**
174
+ **Step 8: Evaluate checker result.**
145
175
 
146
176
  Parse the checker's return.
147
177
 
148
- If **VERIFICATION PASSED**: proceed to Step 9.
178
+ If **VERIFICATION PASSED**: proceed to Step 10.
149
179
 
150
- If **ISSUES FOUND**: proceed to Step 8 (revision loop).
180
+ If **ISSUES FOUND**: proceed to Step 9 (revision loop).
151
181
 
152
- **Step 8: Revision loop (max 3 iterations).**
182
+ **Step 9: Revision loop (max 3 iterations).**
153
183
 
154
184
  Track revision count. If revision count >= 3, skip to Step 9 with a warning.
155
185
 
@@ -175,11 +205,11 @@ Make targeted fixes only — do not rewrite working plans.
175
205
  Return: REVISION COMPLETE with changes made.
176
206
  ```
177
207
 
178
- After revision, re-run checker (Step 6). Increment revision count.
208
+ After revision, re-run checker (Step 7). Increment revision count.
179
209
 
180
210
  Repeat until VERIFICATION PASSED or revision count reaches 3.
181
211
 
182
- **Step 9: Commit EXEC-PLANs.**
212
+ **Step 10: Commit EXEC-PLANs.**
183
213
 
184
214
  Pass each file as a separate `--files` argument (not space-separated in one argument):
185
215
 
@@ -189,7 +219,7 @@ node dist/declare-tools.cjs commit "docs(${MILESTONE}): create exec-plans for mi
189
219
 
190
220
  If the commit reports `nothing_to_commit`, the planner already committed the files — that is fine, continue.
191
221
 
192
- **Step 10: Present results.**
222
+ **Step 11: Present results.**
193
223
 
194
224
  Display final summary:
195
225
 
@@ -1329,7 +1329,7 @@ var require_help = __commonJS({
1329
1329
  usage: "/declare:help"
1330
1330
  }
1331
1331
  ],
1332
- version: "0.5.2"
1332
+ version: "0.5.6"
1333
1333
  };
1334
1334
  }
1335
1335
  module2.exports = { runHelp: runHelp2 };
@@ -86,17 +86,15 @@ function killPort(port) {
86
86
  * Start the dashboard server for this project in the background.
87
87
  */
88
88
  function startServer() {
89
+ // Write port file before spawning so /declare:dashboard always finds it
90
+ try { fs.writeFileSync(portFile, String(port)); } catch {}
91
+
89
92
  const child = cp.spawn(process.execPath, [bundle, 'serve', '--port', String(port)], {
90
93
  cwd,
91
94
  detached: true,
92
95
  stdio: 'ignore',
93
96
  });
94
97
  child.unref();
95
-
96
- // Write port file so /declare:dashboard knows where to open
97
- setTimeout(() => {
98
- try { fs.writeFileSync(portFile, String(port)); } catch {}
99
- }, 800);
100
98
  }
101
99
 
102
100
  // Check if something is already running on this port
@@ -111,6 +109,8 @@ checkRunningServer(port, status => {
111
109
 
112
110
  // Nothing running (or non-Declare process) — kill whatever is there and start fresh
113
111
  killPort(port);
114
- setTimeout(startServer, 300);
115
- process.exit(0);
112
+ setTimeout(() => {
113
+ startServer();
114
+ process.exit(0);
115
+ }, 300);
116
116
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "declare-cc",
3
- "version": "0.5.3",
3
+ "version": "0.5.6",
4
4
  "description": "A future-driven meta-prompting engine for agentic development, rooted in declared futures and causal graph structure.",
5
5
  "bin": {
6
6
  "declare-cc": "bin/install.js"
@@ -43,6 +43,7 @@
43
43
  },
44
44
  "scripts": {
45
45
  "test": "node --test src/graph/engine.test.js",
46
- "build": "node esbuild.config.js"
46
+ "build": "node esbuild.config.js",
47
+ "release": "node scripts/release.js"
47
48
  }
48
49
  }
@@ -0,0 +1,50 @@
1
+ #!/usr/bin/env node
2
+ // Release script: bump version, build, commit, tag.
3
+ // Usage: npm run release -- <version>
4
+ // Example: npm run release -- 0.5.6
5
+ //
6
+ // After this runs, publish manually:
7
+ // npm publish --otp=<your-2fa-code>
8
+ // git push && git push --tags
9
+
10
+ 'use strict';
11
+
12
+ const { execSync } = require('child_process');
13
+ const fs = require('fs');
14
+ const path = require('path');
15
+
16
+ const version = process.argv[2];
17
+ if (!version || !/^\d+\.\d+\.\d+$/.test(version)) {
18
+ console.error('Usage: npm run release -- <version> (e.g. 0.5.6)');
19
+ process.exit(1);
20
+ }
21
+
22
+ const root = path.join(__dirname, '..');
23
+ const pkgPath = path.join(root, 'package.json');
24
+
25
+ function run(cmd) {
26
+ console.log(`> ${cmd}`);
27
+ execSync(cmd, { cwd: root, stdio: 'inherit' });
28
+ }
29
+
30
+ // 1. Bump version in package.json
31
+ const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
32
+ const prev = pkg.version;
33
+ pkg.version = version;
34
+ fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + '\n');
35
+ console.log(`Bumped ${prev} → ${version}`);
36
+
37
+ // 2. Build
38
+ run('npm run build');
39
+
40
+ // 3. Commit + tag
41
+ run(`git add package.json package-lock.json dist/`);
42
+ run(`git commit -m "chore: bump version to ${version}"`);
43
+ run(`git tag v${version}`);
44
+
45
+ console.log(`
46
+ Done. To publish:
47
+
48
+ npm publish --otp=<your-2fa-code>
49
+ git push && git push --tags
50
+ `);
@@ -0,0 +1,94 @@
1
+ # Declaration Scope Review
2
+
3
+ You are reviewing the full set of declared futures with the user before deriving milestones. This is a synthesis checkpoint — confirm the foundation is solid so milestone derivation builds on the right ground.
4
+
5
+ ## Purpose
6
+
7
+ Before working backward to milestones, establish:
8
+ 1. The declarations collectively tell a coherent story
9
+ 2. The scope boundary is clear (what's in, what's out)
10
+ 3. No important futures are missing or redundant
11
+ 4. The framing reflects what the user actually intends to build
12
+
13
+ ## Opening
14
+
15
+ Synthesize all declarations into a scope statement. Do not simply list them — draw out what they *mean together*:
16
+
17
+ ```
18
+ Looking at your declarations as a whole:
19
+
20
+ [D-01]: [statement]
21
+ [D-02]: [statement]
22
+ ...
23
+
24
+ Here's the scope I see:
25
+
26
+ [2-3 sentence synthesis: what this project creates, who it serves, what fundamentally changes]
27
+
28
+ In scope: [concrete things the declarations cover]
29
+ Assumed out of scope: [what the declarations imply is NOT the focus]
30
+
31
+ Does this framing match your intent?
32
+ ```
33
+
34
+ Present this as text, then use AskUserQuestion:
35
+
36
+ - header: "Scope"
37
+ - question: "Does this framing capture what you're building?"
38
+ - options:
39
+ - "Yes, this is right — derive milestones" (Recommended)
40
+ - "A declaration needs adjusting"
41
+ - "Something important is missing"
42
+ - "The scope feels off"
43
+
44
+ ## If "A declaration needs adjusting"
45
+
46
+ Ask which declaration and what's off. Work through the refinement conversationally. If the updated statement is meaningfully different:
47
+
48
+ ```bash
49
+ node dist/declare-tools.cjs add-declaration --title "[revised title]" --statement "[revised statement]"
50
+ ```
51
+
52
+ Note: if removing the old version matters, flag it to the user — they can delete the old declaration or keep both if they serve different purposes.
53
+
54
+ After the change, re-synthesize and confirm once more.
55
+
56
+ ## If "Something important is missing"
57
+
58
+ Guide the user to state the missing future using the same language principles as in `/declare:future`: present-tense, stated as fact, not goal language. Validate and add:
59
+
60
+ ```bash
61
+ node dist/declare-tools.cjs add-declaration --title "[title]" --statement "[statement]"
62
+ ```
63
+
64
+ After adding, re-synthesize and confirm.
65
+
66
+ ## If "The scope feels off"
67
+
68
+ Probe what specifically feels wrong:
69
+
70
+ - Too broad? — Help identify which declarations to narrow or which to defer
71
+ - Too narrow? — Something missing (redirect to above)
72
+ - Wrong framing? — Rephrase the synthesis, not the declarations, and re-confirm
73
+
74
+ One pass of adjustment is enough. After a second confirmation attempt, proceed.
75
+
76
+ ## After Confirmation
77
+
78
+ Once framing is confirmed, briefly acknowledge it and move forward:
79
+
80
+ ```
81
+ Scope confirmed.
82
+
83
+ [N] declarations covering [core theme]. Deriving milestones by working backward from each.
84
+ ```
85
+
86
+ Then immediately proceed to milestone derivation — do not ask more questions here.
87
+
88
+ ## Design Principles
89
+
90
+ - **Synthesize, don't list.** The user already saw their declarations. Show what they mean together.
91
+ - **Name what's out.** Explicit scope exclusions prevent milestone sprawl during derivation.
92
+ - **One round of adjustment.** If the user modifies and re-confirms, proceed. Don't loop more than twice.
93
+ - **Be concrete.** Don't say "the project creates value" — say "the project gives developers a self-hosted AI coding workflow that runs without a cloud dependency."
94
+ - **No emojis.** Keep tone grounded.