declare-cc 0.4.3 → 0.4.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/bin/install.js CHANGED
@@ -1465,8 +1465,9 @@ function install(isGlobal, runtime = 'claude') {
1465
1465
  console.log(` ${green}✓${reset} Installed workflows/`);
1466
1466
  }
1467
1467
 
1468
- // Copy dashboard static files (src/server/public/) → .claude/server/public/
1469
- const publicSrc = path.join(src, 'src', 'server', 'public');
1468
+ // Copy dashboard static files (dist/public/) → .claude/server/public/
1469
+ // dist/public/ ships in the npm package (built by esbuild.config.js)
1470
+ const publicSrc = path.join(src, 'dist', 'public');
1470
1471
  if (fs.existsSync(publicSrc)) {
1471
1472
  const publicDest = path.join(targetDir, 'server', 'public');
1472
1473
  fs.mkdirSync(publicDest, { recursive: true });
@@ -95,11 +95,16 @@ After all milestones processed:
95
95
  node dist/declare-tools.cjs load-graph
96
96
  ```
97
97
 
98
- 2. Show summary: milestones processed, plans created, total actions derived.
99
- 3. Suggest the next step clearly:
98
+ 2. Start the dashboard if not already running:
99
+ ```bash
100
+ curl -sf http://localhost:3847/api/graph -o /dev/null || (node dist/declare-tools.cjs serve --port 3847 > /tmp/declare-dashboard.log 2>&1 & sleep 1 && open http://localhost:3847 2>/dev/null || true)
101
+ ```
102
+
103
+ 3. Show summary: milestones processed, plans created, total actions derived.
104
+ 4. Suggest the next step clearly:
100
105
 
101
106
  ```
102
- Actions defined. Next: create executable plans.
107
+ Actions and edges are live in the dashboard → http://localhost:3847
103
108
 
104
109
  /declare:plan M-XX — research + planner + checker loop → EXEC-PLAN files
105
110
  /declare:execute M-XX — once plans exist, execute with wave scheduling
@@ -44,9 +44,29 @@ node dist/declare-tools.cjs add-declaration --title "Short Title" --statement "F
44
44
 
45
45
  Parse the JSON output to confirm the declaration was created and note its assigned ID (e.g., D-01).
46
46
 
47
- **Step 5: Show summary and suggest next step.**
47
+ **Step 5: Launch dashboard and show summary.**
48
48
 
49
49
  After all declarations are captured:
50
50
 
51
- 1. List all declarations with their IDs and statements.
52
- 2. Suggest: "Run `/declare:milestones` to work backward from these declarations to milestones and actions."
51
+ 1. Start the dashboard server (if not already running):
52
+
53
+ ```bash
54
+ node dist/declare-tools.cjs serve --port 3847 > /tmp/declare-dashboard.log 2>&1 &
55
+ sleep 1 && curl -sf http://localhost:3847/api/graph -o /dev/null && echo "RUNNING" || echo "FAILED"
56
+ ```
57
+
58
+ If RUNNING, open it:
59
+ ```bash
60
+ open http://localhost:3847 2>/dev/null || true
61
+ ```
62
+
63
+ 2. List all declarations with their IDs and statements.
64
+
65
+ 3. Suggest next step:
66
+
67
+ ```
68
+ Your declarations are live in the dashboard → http://localhost:3847
69
+ The graph updates every 5 seconds as you add milestones and actions.
70
+
71
+ Run /declare:milestones to work backward from these declarations.
72
+ ```
@@ -77,5 +77,10 @@ After all declarations processed:
77
77
  node dist/declare-tools.cjs load-graph
78
78
  ```
79
79
 
80
- 2. Show summary: declarations processed, milestones derived.
81
- 3. Suggest: "Run `/declare:actions` to derive action plans for each milestone."
80
+ 2. Start the dashboard if not already running (dashboard updates live when files change):
81
+ ```bash
82
+ curl -sf http://localhost:3847/api/graph -o /dev/null || (node dist/declare-tools.cjs serve --port 3847 > /tmp/declare-dashboard.log 2>&1 & sleep 1 && open http://localhost:3847 2>/dev/null || true)
83
+ ```
84
+
85
+ 3. Show summary: declarations processed, milestones derived.
86
+ 4. Suggest: "Milestones are live in the dashboard → http://localhost:3847 — Run `/declare:actions` to derive action plans."
@@ -1329,7 +1329,7 @@ var require_help = __commonJS({
1329
1329
  usage: "/declare:help"
1330
1330
  }
1331
1331
  ],
1332
- version: "0.4.0"
1332
+ version: "0.4.4"
1333
1333
  };
1334
1334
  }
1335
1335
  module2.exports = { runHelp: runHelp2 };
@@ -3677,7 +3677,9 @@ var require_server = __commonJS({
3677
3677
  };
3678
3678
  function getPublicDir(cwd) {
3679
3679
  const installed = path.join(cwd, ".claude", "server", "public");
3680
- if (require("fs").existsSync(installed)) return installed;
3680
+ if (fs.existsSync(installed)) return installed;
3681
+ const bundled = path.join(__dirname, "public");
3682
+ if (fs.existsSync(bundled)) return bundled;
3681
3683
  return path.join(cwd, "src", "server", "public");
3682
3684
  }
3683
3685
  function sendJson(res, statusCode, data) {
@@ -3760,6 +3762,31 @@ var require_server = __commonJS({
3760
3762
  sendJson(res, 500, { error: String(err) });
3761
3763
  }
3762
3764
  }
3765
+ var sseClients = /* @__PURE__ */ new Set();
3766
+ function broadcastChange() {
3767
+ for (const client of sseClients) {
3768
+ try {
3769
+ client.write("event: change\ndata: {}\n\n");
3770
+ } catch (_) {
3771
+ sseClients.delete(client);
3772
+ }
3773
+ }
3774
+ }
3775
+ function watchPlanning(cwd) {
3776
+ const planningDir = path.join(cwd, ".planning");
3777
+ if (!fs.existsSync(planningDir)) return;
3778
+ let debounceTimer = null;
3779
+ try {
3780
+ fs.watch(planningDir, { recursive: true }, () => {
3781
+ if (debounceTimer) clearTimeout(debounceTimer);
3782
+ debounceTimer = setTimeout(() => {
3783
+ broadcastChange();
3784
+ debounceTimer = null;
3785
+ }, 200);
3786
+ });
3787
+ } catch (_) {
3788
+ }
3789
+ }
3763
3790
  function route(req, res, cwd) {
3764
3791
  const method = req.method || "GET";
3765
3792
  const url = req.url || "/";
@@ -3777,6 +3804,18 @@ var require_server = __commonJS({
3777
3804
  sendJson(res, 405, { error: "Method Not Allowed" });
3778
3805
  return;
3779
3806
  }
3807
+ if (urlPath === "/events") {
3808
+ res.writeHead(200, {
3809
+ "Content-Type": "text/event-stream",
3810
+ "Cache-Control": "no-cache",
3811
+ "Connection": "keep-alive",
3812
+ "Access-Control-Allow-Origin": "*"
3813
+ });
3814
+ res.write("retry: 3000\n\n");
3815
+ sseClients.add(res);
3816
+ req.on("close", () => sseClients.delete(res));
3817
+ return;
3818
+ }
3780
3819
  if (urlPath === "/api/graph") {
3781
3820
  handleGraph(res, cwd);
3782
3821
  return;
@@ -3818,6 +3857,7 @@ var require_server = __commonJS({
3818
3857
  const resolvedPort = port || parseInt(process.env.PORT || "", 10) || 3847;
3819
3858
  const server = createServer(cwd, resolvedPort);
3820
3859
  server.listen(resolvedPort, "127.0.0.1", () => {
3860
+ watchPlanning(cwd);
3821
3861
  });
3822
3862
  const url = `http://localhost:${resolvedPort}`;
3823
3863
  return { server, port: resolvedPort, url };