declare-cc 1.0.4 → 1.0.5

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/README.md CHANGED
@@ -37,7 +37,7 @@ Run it:
37
37
  npm run plan
38
38
  ```
39
39
 
40
- This auto-initializes a `.planning/` directory if one doesn't exist, starts the Declare server, writes the port to `.planning/server.port`, and opens the dashboard in your browser.
40
+ This auto-initializes a `.planning/` directory if one doesn't exist, starts the Declare server on a random free port, writes the port to `.planning/server.port`, and prints the dashboard URL.
41
41
 
42
42
  Or run directly:
43
43
 
@@ -59,7 +59,7 @@ You declare present-tense statements of fact about your project's future. The sy
59
59
 
60
60
  ## How It Works
61
61
 
62
- Everything happens through the dashboard. `dcl` opens it, and you drive the workflow with keyboard shortcuts and card-based UI.
62
+ Everything happens through the dashboard. `dcl` starts the server and prints the URL click it to open.
63
63
 
64
64
  ### 1. Declare Futures
65
65
 
@@ -125,9 +125,94 @@ Cards are grouped into stages at each level:
125
125
  | **Ctrl+Shift+A** | Approve all visible |
126
126
  | **C** | Command bar |
127
127
 
128
- ### Server Discovery
128
+ ---
129
+
130
+ ## Server & Port Discovery
131
+
132
+ The Declare server uses OS-assigned ports so multiple projects can run simultaneously without collisions.
133
+
134
+ ### How it works
135
+
136
+ 1. `dcl` (or `dcl serve`) starts the server on **port 0** — the OS assigns a random free port
137
+ 2. After the server is listening, it writes the port number to `.planning/server.port` (plain text, e.g. `62964`)
138
+ 3. On shutdown (SIGINT, SIGTERM, process exit), the file is deleted
139
+ 4. Next time `dcl` runs, it reads the port file. If the server is still alive, it reuses it. If the file is stale (server crashed), it cleans up and starts fresh.
140
+
141
+ ### For external tools
142
+
143
+ To discover a running Declare server for a project:
144
+
145
+ ```js
146
+ const port = fs.readFileSync('<project>/.planning/server.port', 'utf8').trim();
147
+ // Verify it's alive:
148
+ // GET http://localhost:<port>/api/graph → 200 = running
149
+ // Embed dashboard:
150
+ // <iframe src="http://localhost:<port>/" />
151
+ ```
152
+
153
+ If the file doesn't exist, the server isn't running. Start it:
154
+
155
+ ```bash
156
+ cd <project> && npx dcl serve
157
+ ```
158
+
159
+ Then poll for `.planning/server.port` to appear (~1 second).
160
+
161
+ ### Explicit port
162
+
163
+ If you need a specific port:
164
+
165
+ ```bash
166
+ dcl serve --port 4000
167
+ ```
168
+
169
+ ---
170
+
171
+ ## For Agents
172
+
173
+ If you're an AI agent (Claude Code, Cursor, etc.) working in a project that uses Declare, here's what you need to know:
174
+
175
+ ### Project state lives in `.planning/`
176
+
177
+ - **`FUTURE.md`** — Declared futures (present-tense statements about what's true when the project succeeds)
178
+ - **`MILESTONES.md`** — Milestones derived backward from futures
179
+ - **`.planning/milestones/M-XX-slug/PLAN.md`** — Actions for each milestone (title, produces, causes)
180
+ - **`.planning/STATE.md`** — Current project state and decisions
181
+ - **`.planning/PROJECT.md`** — Project context and background
182
+
183
+ ### The DAG structure
184
+
185
+ Declarations (D-XX) → Milestones (M-XX) → Actions (A-XX). Each layer links to the one above via `realizes` (milestones → declarations) and `causes` (actions → milestones). Read the graph with:
186
+
187
+ ```bash
188
+ node_modules/.bin/declare-cc load-graph
189
+ ```
190
+
191
+ Returns JSON with `declarations`, `milestones`, `actions` arrays.
192
+
193
+ ### Slash commands available to you
194
+
195
+ If you're running inside Claude Code with declare-cc installed, these slash commands are available:
196
+
197
+ - `/declare:status` — See where the project stands
198
+ - `/declare:execute M-XX` — Execute actions for a milestone
199
+ - `/declare:verify M-XX` — Validate deliverables
200
+ - `/declare:trace A-XX` — Understand why an action exists (walk the why-chain)
201
+ - `/declare:progress` — Find the next thing to work on
202
+ - `/declare:help` — See all commands
203
+
204
+ ### Dashboard API
205
+
206
+ If the server is running (check `.planning/server.port`), you can use the HTTP API:
129
207
 
130
- On startup, the server writes the port number to `.planning/server.port` (plain text, e.g. `3847`). On shutdown, it deletes this file. External tools can read this file to embed the dashboard in an iframe.
208
+ | Method | Path | Returns |
209
+ |--------|------|---------|
210
+ | GET | `/api/graph` | Full DAG (declarations, milestones, actions) |
211
+ | GET | `/api/status` | Integrity/alignment metrics |
212
+ | GET | `/api/agents` | Running/completed agents |
213
+ | GET | `/api/events` | SSE stream (real-time updates) |
214
+ | POST | `/api/review` | Approve/reject a node |
215
+ | POST | `/api/action/:id/execute` | Execute an action |
131
216
 
132
217
  ---
133
218
 
@@ -145,7 +230,7 @@ The dashboard is the primary interface. All operations are also available as sla
145
230
  | `/declare:audit M-XX` | Cross-reference against declarations |
146
231
  | `/declare:trace A-XX` | Walk the why-chain to its declaration |
147
232
  | `/declare:status` | Graph health and layer counts |
148
- | `/declare:dashboard` | Open the dashboard |
233
+ | `/declare:dashboard` | Start server and print URL |
149
234
  | `/declare:help` | Show all commands |
150
235
 
151
236
  ---
@@ -1552,7 +1552,7 @@ var require_help = __commonJS({
1552
1552
  usage: "/declare:help"
1553
1553
  }
1554
1554
  ],
1555
- version: "1.0.4"
1555
+ version: "1.0.5"
1556
1556
  };
1557
1557
  }
1558
1558
  module2.exports = { runHelp: runHelp2 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "declare-cc",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
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",