storymapper 0.1.0

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 (61) hide show
  1. package/ARCHITECTURE.md +334 -0
  2. package/LICENSE +201 -0
  3. package/NOTICE +6 -0
  4. package/README.md +239 -0
  5. package/frontend/css/storymap.css +4637 -0
  6. package/frontend/js/adapters.js +423 -0
  7. package/frontend/js/card-animate.js +384 -0
  8. package/frontend/js/core/graph.js +825 -0
  9. package/frontend/js/core.js +3908 -0
  10. package/frontend/js/dialog-ticket-import.js +506 -0
  11. package/frontend/js/dnd.js +322 -0
  12. package/frontend/js/filter.js +215 -0
  13. package/frontend/js/main.js +2499 -0
  14. package/frontend/js/project-io.js +109 -0
  15. package/frontend/js/query-autocomplete.js +196 -0
  16. package/frontend/js/query-engine.js +339 -0
  17. package/frontend/js/query.js +280 -0
  18. package/frontend/js/renderer-card.js +639 -0
  19. package/frontend/js/renderer-dependencies.js +974 -0
  20. package/frontend/js/renderer-kanban.js +505 -0
  21. package/frontend/js/renderer-storymap.js +2530 -0
  22. package/frontend/js/renderer-ticket-editor.js +455 -0
  23. package/frontend/js/renderer-ticket-modal.js +758 -0
  24. package/frontend/js/save-pipeline.js +170 -0
  25. package/frontend/js/smartbar-autocomplete.js +162 -0
  26. package/frontend/js/store.js +197 -0
  27. package/frontend/js/ticket-editor-boot.js +24 -0
  28. package/frontend/js/ticket-form.js +2095 -0
  29. package/frontend/js/ticket-import.js +477 -0
  30. package/frontend/js/ui-shell.js +441 -0
  31. package/frontend/js/view-process-steps.js +233 -0
  32. package/frontend/js/view-requirements.js +361 -0
  33. package/frontend/js/view-settings.js +1864 -0
  34. package/frontend/js/view-table.js +659 -0
  35. package/frontend/js/wheel-pan.js +65 -0
  36. package/frontend/storymap.html +87 -0
  37. package/frontend/ticket-editor.html +29 -0
  38. package/package.json +76 -0
  39. package/server/bus.js +16 -0
  40. package/server/core/graph.js +10 -0
  41. package/server/core.js +10 -0
  42. package/server/identity.js +134 -0
  43. package/server/index.js +283 -0
  44. package/server/ingest.js +212 -0
  45. package/server/mcp.js +2510 -0
  46. package/server/server.js +1599 -0
  47. package/server/slice.js +103 -0
  48. package/server/storage.js +571 -0
  49. package/server/validation.js +225 -0
  50. package/shared/core/graph.js +825 -0
  51. package/shared/core.js +3908 -0
  52. package/shared/project-io.js +109 -0
  53. package/shared/query-autocomplete.js +196 -0
  54. package/shared/query-engine.js +339 -0
  55. package/shared/query.js +280 -0
  56. package/shared/ticket-import.js +477 -0
  57. package/skill/SKILL.md +458 -0
  58. package/skill/reference/anatomy.md +196 -0
  59. package/skill/reference/spec-evolution.md +52 -0
  60. package/skill/reference/tools.md +156 -0
  61. package/skill/reference/workflows.md +203 -0
package/README.md ADDED
@@ -0,0 +1,239 @@
1
+ # Storymapper
2
+
3
+ ![Story Map view](docs/images/map.png)
4
+
5
+ **A User Story Map + Kanban board that a product owner and an AI coding agent
6
+ plan together — the same backlog, live, from a browser and from an MCP client —
7
+ with the quality method built in.**
8
+
9
+ Storymapper is one Node.js package that ships three things:
10
+
11
+ 1. **A browser UI** — a User Story Map (process steps × releases, with epics and
12
+ stories in the cells), a Kanban board, plus table, dependency-graph,
13
+ requirements and settings views. Plain HTML + modular JavaScript, no build step.
14
+ 2. **An HTTP + WebSocket server** — persists every project in SQLite with a full
15
+ per-project revision history, and pushes changes to connected browsers within
16
+ ~100 ms.
17
+ 3. **An MCP server** (stdio) **plus a pass-through CLI** — the same ~70 tools,
18
+ for Claude Desktop / Claude Code via MCP and for scripts or other harnesses
19
+ as one-shot commands. Anything the agent does appears live in the product
20
+ owner's browser with a highlight-and-move animation; anything edited by hand
21
+ flows back to the agent on its next read.
22
+
23
+ The result is a **shared planning surface**: the agent isn't writing to a
24
+ database the human can't see — the two work the same board in real time.
25
+
26
+ ---
27
+
28
+ ## Why it exists
29
+
30
+ Planning AI-assisted development breaks down when the plan lives in one place and
31
+ the work in another. Storymapper makes the plan a live, bidirectional artifact:
32
+
33
+ - You bring the product idea and a rough shape of what to build; the agent lays
34
+ it out on the board — epics, stories, releases, dependencies — and you watch
35
+ it appear and rearrange it by hand.
36
+ - You reprioritize, split, annotate — and the agent picks it up on its next
37
+ read and continues from the current state of the board.
38
+ - Every change is a **revision** you can inspect and restore.
39
+
40
+ ## Quality steering at the product level
41
+
42
+ When an agent does the building, the human contribution moves up a level: you
43
+ describe the product, review its behavior, and steer the work through the
44
+ process. That
45
+ process is Storymapper's real substance — a complete quality method the engine
46
+ enforces as tool-level rules: a ticket is **specified before it is built**
47
+ (Definition of Ready) and **proven before it counts as done** (Definition of
48
+ Done plus a published test plan with recorded runs), and your requirements stay
49
+ traceably linked to the stories that implement them and the tests that verify
50
+ them. An agent that tries to skip a step gets a structured error naming exactly
51
+ what is missing — and fixes it. This puts professional-grade quality assurance
52
+ into the hands of everyone who thinks in products — founders, domain experts,
53
+ product owners: the method speaks the language of the product and lets you
54
+ hold an agent's work to a standard you can verify. The workflow itself
55
+ (statuses, transitions, gates, board columns) is configurable per project, and
56
+ the companion skill teaches the agent the discipline, not just the tools.
57
+
58
+ ![Ticket detail — acceptance criteria, Definition of Ready / Definition of Done checklists, and typed links](docs/images/Ticket.png)
59
+
60
+ ## Design principles
61
+
62
+ - **Zero build.** No bundler, no transpiler, no TypeScript. The browser loads
63
+ classical `<script src>` modules; the server runs the same files under Node via
64
+ a UMD wrapper. Clone and run.
65
+ - **One source of truth for pure logic.** All domain logic (normalization,
66
+ operations, the workflow/governance engines, graph algorithms) lives in
67
+ `shared/core.js` and is *symlinked* into the frontend and *re-exported* by the
68
+ server — the same code runs in the browser, the HTTP server and the MCP server,
69
+ with no mirror step to drift.
70
+ - **Raw HTTP, no framework.** `http.createServer` + manual routing. Small,
71
+ readable, dependency-light.
72
+ - **Synchronous SQLite** via `better-sqlite3`, atomic per-save transactions, a
73
+ per-project mutex, and count-bounded revision retention.
74
+ - **Single-user, local-first.** One human plus their agent on one machine. See
75
+ the security model below.
76
+
77
+ For the full picture — layering, data model, live-sync mechanism, testing
78
+ approach and deliberate non-goals — see **[ARCHITECTURE.md](ARCHITECTURE.md)**.
79
+
80
+ ---
81
+
82
+ ## Requirements
83
+
84
+ - **Node.js ≥ 20** (developed and tested on 20 and 22; Node 18 is end-of-life).
85
+ - `better-sqlite3` is a native module. Prebuilt binaries cover mainstream
86
+ platforms (macOS / Linux / Windows on x64 + arm64 for supported Node
87
+ versions), so `npm install` usually just works. On an unsupported
88
+ platform/Node combination it compiles from source and needs a C/C++ toolchain
89
+ (Xcode Command Line Tools, `build-essential`, or the Windows build tools).
90
+
91
+ ## Install
92
+
93
+ ```sh
94
+ git clone <your-fork-url> storymapper
95
+ cd storymapper
96
+ npm install
97
+ ```
98
+
99
+ ## Run the browser UI
100
+
101
+ ```sh
102
+ npm start
103
+ # → http://localhost:8770/ (data in ./.storymap-data)
104
+ # → Ctrl-C to stop
105
+ ```
106
+
107
+ ![Kanban view](docs/images/kanban.png)
108
+
109
+ Open <http://localhost:8770/> — that's all. The page connects to the server it
110
+ was loaded from and stores every project there (SQLite, with full revision
111
+ history).
112
+
113
+ > **Hosting the page somewhere else?** Served from a different origin, the UI
114
+ > runs on browser `localStorage` instead; point it at a running server with
115
+ > `?api=<url>`. The page must be loaded from `localhost` / `127.0.0.1` — opening
116
+ > the HTML directly as a `file://` page is not supported (see the security
117
+ > model).
118
+
119
+ ![Dependency graph view](docs/images/dependency-graph.png)
120
+
121
+ ## Connect it to your Claude (one command per surface)
122
+
123
+ Storymapper reaches an agent through two parts: the **MCP server** (the tools)
124
+ and the companion **skill** (the working method — the DoR/DoD contract, the
125
+ workflow discipline, when to read the board and when to write to it).
126
+ Installing one does **not** install the
127
+ other, so the setup commands below always install **both**:
128
+
129
+ | Surface | Command | What remains |
130
+ |---|---|---|
131
+ | **Claude Code** (CLI) | `npm run install-code` | restart your Claude Code session |
132
+ | **Claude Desktop** | `npm run install-desktop` | upload `dist/storymap-skill.zip` under **Settings → Capabilities → Skills**, then fully restart the app — and use a **Chat** (see below) |
133
+ | **claude.ai in the browser** | — | works with remote connectors only; it cannot reach a local server. Use Claude Code or Claude Desktop. |
134
+
135
+ `npm run install-code` copies the skill to `~/.claude/skills/storymap` and
136
+ registers the MCP server via `claude mcp add` (user scope). If the `claude`
137
+ CLI is unavailable it prints the ready-made command instead.
138
+
139
+ `npm run install-desktop` writes the server entry into the platform's
140
+ `claude_desktop_config.json` (existing entries survive, a `.bak` backup is
141
+ kept) and builds the skill zip. The skill store in Claude Desktop is managed
142
+ by the app, so the one upload in the UI is the single step no script can do
143
+ for you.
144
+
145
+ > **Chat, not Cowork.** Claude Desktop reaches local MCP servers from **Chat**
146
+ > conversations only — in **Cowork** mode the Storymapper tools are not
147
+ > available. If Cowork is your default surface, switch to a Chat; when the
148
+ > tools don't show up, this is the first thing to check.
149
+
150
+ Both commands are idempotent — re-run them after pulling a new Storymapper
151
+ version. `--data-dir=DIR` overrides the data directory (default:
152
+ `<repo>/.storymap-data`).
153
+
154
+ ### Manual setup (other MCP clients, other harnesses)
155
+
156
+ Any stdio MCP client can run the server with this shape:
157
+
158
+ ```json
159
+ {
160
+ "mcpServers": {
161
+ "storymapper": {
162
+ "command": "node",
163
+ "args": [
164
+ "/absolute/path/to/storymapper/server/index.js", "mcp",
165
+ "--data-dir=/absolute/path/to/storymapper/.storymap-data"
166
+ ]
167
+ }
168
+ }
169
+ }
170
+ ```
171
+
172
+ The skill package (`npm run package-skill` → `dist/storymap-skill.zip`) is
173
+ plain Markdown — `storymap/SKILL.md` plus its `reference/` files. For
174
+ harnesses like Codex, unpack it wherever instructions live and point the
175
+ harness at it, e.g. from an `AGENTS.md`:
176
+
177
+ ```md
178
+ Before planning work on the Storymapper board, read storymap/SKILL.md
179
+ (and the reference/ files it names) and follow that working method.
180
+ ```
181
+
182
+ Point `--data-dir` at the **same** directory the HTTP server uses. Both processes
183
+ can run concurrently against one SQLite file (WAL mode + a busy-timeout);
184
+ the HTTP server relays every MCP write to connected browsers over WebSocket.
185
+
186
+ ### Scripting without MCP: the CLI
187
+
188
+ Every tool is also a one-shot CLI command running over the same tool core:
189
+
190
+ ```sh
191
+ node server/index.js tool list_projects
192
+ node server/index.js tool ticket_create '{"projectId": "…", "title": "…"}'
193
+ ```
194
+
195
+ The result JSON goes to stdout (exit codes: `0` ok, `1` tool error, `2` unknown
196
+ tool / bad arguments); arguments come from the positional JSON string,
197
+ `--json=<json>`, or piped stdin. This opens the full tool surface to shell
198
+ scripts, CI jobs and harnesses that don't speak MCP.
199
+
200
+ > Only one `storymapper server` may run per data directory (a PID lock refuses a
201
+ > second; `--force` takes over a stale lock after a crash). The MCP process is
202
+ > exempt and may always share the data dir.
203
+
204
+ ## Security model (single-user, local)
205
+
206
+ Storymapper is a **local single-user tool** — one human plus their agent on one
207
+ machine. There is deliberately no authentication layer:
208
+
209
+ - The server binds to `localhost` by default. **Do not expose it on a
210
+ non-loopback interface** (`--host=0.0.0.0`, a reverse proxy, a Docker port map)
211
+ without putting your own authentication in front — anyone who can reach the
212
+ port can read and write every project.
213
+ - CORS is locked to loopback origins: cross-origin browser requests get no
214
+ `Access-Control-Allow-Origin` and mutating methods are rejected — this stops a
215
+ random website you visit from driving your local API. WebSocket upgrades are
216
+ origin-checked the same way.
217
+ - Served HTML carries a Content-Security-Policy; all responses send
218
+ `X-Content-Type-Options: nosniff`.
219
+ - `X-Actor-*` headers are **attribution, not authentication** — they label who
220
+ did what in the revision history and are not verified.
221
+ - Verified identity, token-gated remote access and RBAC are a deliberate later
222
+ stage; the authorization seam (`server/identity.js`) is already in place.
223
+
224
+ ## Testing
225
+
226
+ ```sh
227
+ npm test # ≈1800 assertions, plain Node scripts, no test framework
228
+ ```
229
+
230
+ The suite is a homegrown runner (`tests/run.js`) over `tests/test-*.js`: pure
231
+ unit tests, storage/mutex/revision tests, in-process and stdio MCP round-trips,
232
+ JSDOM renderer tests, and a real-server end-to-end test. CI runs it on Node 20
233
+ and 22. Tests only ever touch temporary directories — running them never
234
+ touches your data.
235
+
236
+ ## License
237
+
238
+ Licensed under the **Apache License 2.0** — see [LICENSE](LICENSE) and
239
+ [NOTICE](NOTICE).