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.
- package/ARCHITECTURE.md +334 -0
- package/LICENSE +201 -0
- package/NOTICE +6 -0
- package/README.md +239 -0
- package/frontend/css/storymap.css +4637 -0
- package/frontend/js/adapters.js +423 -0
- package/frontend/js/card-animate.js +384 -0
- package/frontend/js/core/graph.js +825 -0
- package/frontend/js/core.js +3908 -0
- package/frontend/js/dialog-ticket-import.js +506 -0
- package/frontend/js/dnd.js +322 -0
- package/frontend/js/filter.js +215 -0
- package/frontend/js/main.js +2499 -0
- package/frontend/js/project-io.js +109 -0
- package/frontend/js/query-autocomplete.js +196 -0
- package/frontend/js/query-engine.js +339 -0
- package/frontend/js/query.js +280 -0
- package/frontend/js/renderer-card.js +639 -0
- package/frontend/js/renderer-dependencies.js +974 -0
- package/frontend/js/renderer-kanban.js +505 -0
- package/frontend/js/renderer-storymap.js +2530 -0
- package/frontend/js/renderer-ticket-editor.js +455 -0
- package/frontend/js/renderer-ticket-modal.js +758 -0
- package/frontend/js/save-pipeline.js +170 -0
- package/frontend/js/smartbar-autocomplete.js +162 -0
- package/frontend/js/store.js +197 -0
- package/frontend/js/ticket-editor-boot.js +24 -0
- package/frontend/js/ticket-form.js +2095 -0
- package/frontend/js/ticket-import.js +477 -0
- package/frontend/js/ui-shell.js +441 -0
- package/frontend/js/view-process-steps.js +233 -0
- package/frontend/js/view-requirements.js +361 -0
- package/frontend/js/view-settings.js +1864 -0
- package/frontend/js/view-table.js +659 -0
- package/frontend/js/wheel-pan.js +65 -0
- package/frontend/storymap.html +87 -0
- package/frontend/ticket-editor.html +29 -0
- package/package.json +76 -0
- package/server/bus.js +16 -0
- package/server/core/graph.js +10 -0
- package/server/core.js +10 -0
- package/server/identity.js +134 -0
- package/server/index.js +283 -0
- package/server/ingest.js +212 -0
- package/server/mcp.js +2510 -0
- package/server/server.js +1599 -0
- package/server/slice.js +103 -0
- package/server/storage.js +571 -0
- package/server/validation.js +225 -0
- package/shared/core/graph.js +825 -0
- package/shared/core.js +3908 -0
- package/shared/project-io.js +109 -0
- package/shared/query-autocomplete.js +196 -0
- package/shared/query-engine.js +339 -0
- package/shared/query.js +280 -0
- package/shared/ticket-import.js +477 -0
- package/skill/SKILL.md +458 -0
- package/skill/reference/anatomy.md +196 -0
- package/skill/reference/spec-evolution.md +52 -0
- package/skill/reference/tools.md +156 -0
- package/skill/reference/workflows.md +203 -0
package/ARCHITECTURE.md
ADDED
|
@@ -0,0 +1,334 @@
|
|
|
1
|
+
# Storymapper — Architecture
|
|
2
|
+
|
|
3
|
+
This document is the map for anyone reading or contributing to the code. It
|
|
4
|
+
covers the shape of the system, the deliberate design decisions, the data model,
|
|
5
|
+
and the few non-obvious mechanisms that make the whole thing work. For install
|
|
6
|
+
and usage, see [README.md](README.md).
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## 1. The three surfaces
|
|
11
|
+
|
|
12
|
+
One package exposes the same data three ways:
|
|
13
|
+
|
|
14
|
+
```
|
|
15
|
+
┌───────────────────────────┐
|
|
16
|
+
Browser ── HTTP ───▶ │ │
|
|
17
|
+
UI ◀─ WebSocket │ HTTP + WS server │──▶ SQLite
|
|
18
|
+
│ (server/*.js) │ (revisions,
|
|
19
|
+
Claude ── stdio ───▶ │ MCP server │ snapshots,
|
|
20
|
+
(agent) MCP │ (server/mcp.js) │ attachments)
|
|
21
|
+
└───────────────────────────┘
|
|
22
|
+
│
|
|
23
|
+
shared/core.js
|
|
24
|
+
(pure domain logic, one copy)
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
- **HTTP + WebSocket server** (`server/server.js`) — serves the frontend, exposes
|
|
28
|
+
a REST surface, and pushes live changes to subscribed browsers.
|
|
29
|
+
- **MCP server** (`server/mcp.js`) — ~70 stdio tools wrapping the same operations,
|
|
30
|
+
so an AI agent edits the same projects.
|
|
31
|
+
- **SQLite storage** (`server/storage.js`) — the single persistence layer both
|
|
32
|
+
servers write through.
|
|
33
|
+
|
|
34
|
+
A **process bus** (`server/bus.js`, a plain `EventEmitter`) decouples writes from
|
|
35
|
+
push: storage emits `change`, the WebSocket layer relays it.
|
|
36
|
+
|
|
37
|
+
## 2. Principles & deliberate non-goals
|
|
38
|
+
|
|
39
|
+
These are load-bearing constraints, not preferences. Please honour them in PRs.
|
|
40
|
+
|
|
41
|
+
- **No build step.** No bundler, transpiler or TypeScript. If you find yourself
|
|
42
|
+
wanting one, stop.
|
|
43
|
+
- **No frontend framework, no ES modules in the browser.** Classical
|
|
44
|
+
`<script src>` tags loading UMD modules that attach to a `window.STORYMAP`
|
|
45
|
+
namespace. This keeps the page trivially serveable and debuggable.
|
|
46
|
+
- **No HTTP framework.** Raw `http.createServer` with manual routing. It stays
|
|
47
|
+
small and dependency-light on purpose (Express, Fastify, etc. are out).
|
|
48
|
+
- **Pure logic lives in exactly one file.** See §4.
|
|
49
|
+
- **Single-user, local-first.** No auth layer yet; the seam exists (§13) but RBAC
|
|
50
|
+
is a later stage. The server is meant for loopback only.
|
|
51
|
+
- **Constants, not magic numbers.** Layout sizes, limits, timeouts and debounce
|
|
52
|
+
windows live in a named constants block at the top of each module (e.g.
|
|
53
|
+
`STORY_MAP_LAYOUT`, `KANBAN_LAYOUT`, `LIMITS`, `RETENTION`). Tests reference the
|
|
54
|
+
constant, never the literal.
|
|
55
|
+
|
|
56
|
+
## 3. Directory layout
|
|
57
|
+
|
|
58
|
+
```
|
|
59
|
+
shared/ Single source of truth for pure logic.
|
|
60
|
+
core.js normalize*, ops, resolveDefinitions, workflow +
|
|
61
|
+
governance engines, diff, view-helpers. No I/O, no DOM.
|
|
62
|
+
core/graph.js Pure graph algorithms (critical path, impact set, …).
|
|
63
|
+
ticket-import.js CSV / JSON import parsing + value mapping.
|
|
64
|
+
project-io.js Export / import of a whole project.
|
|
65
|
+
query*.js The ticket query language + autocomplete.
|
|
66
|
+
|
|
67
|
+
server/
|
|
68
|
+
core.js Thin re-export of shared/core.js (legacy require path).
|
|
69
|
+
core/graph.js Thin re-export of shared/core/graph.js.
|
|
70
|
+
storage.js better-sqlite3 wrapper: per-project mutex, atomic
|
|
71
|
+
transactional writes, monotonic revision IDs,
|
|
72
|
+
count-based retention, attachments on disk.
|
|
73
|
+
validation.js Per-op validators; delegates status-transition + limit
|
|
74
|
+
rules to shared/core (no duplicated rules).
|
|
75
|
+
bus.js Process-wide EventEmitter ('change', 'switch_request', …).
|
|
76
|
+
identity.js Actor resolution + the pluggable authorize() choke-point.
|
|
77
|
+
server.js HTTP routing + WebSocket layer. Exports startServer().
|
|
78
|
+
mcp.js MCP tool definitions (~70) wrapping ops + storage.
|
|
79
|
+
mcp-native/ Dependency-free MCP layer (replaces the MCP SDK):
|
|
80
|
+
registry.js Transport-agnostic tool registry: register/listTools/dispatch.
|
|
81
|
+
stdio.js JSON-RPC 2.0 stdio frontend over the registry.
|
|
82
|
+
index.js CLI entry: `storymapper server|mcp`. Shutdown handling.
|
|
83
|
+
ingest.js PDF/DOCX slice-candidate extraction (import pipeline).
|
|
84
|
+
|
|
85
|
+
frontend/
|
|
86
|
+
storymap.html The shell: structure + CSS link + script tags + bootstrap.
|
|
87
|
+
css/storymap.css Paperlike theme.
|
|
88
|
+
js/
|
|
89
|
+
core.js Symlink → ../../shared/core.js (the single source).
|
|
90
|
+
core/graph.js Symlink → ../../../shared/core/graph.js.
|
|
91
|
+
store.js ProjectStore: local ops, undo/redo, applyRemote, hydrate.
|
|
92
|
+
adapters.js Http / LocalStorage / Memory adapters + WS subscribe.
|
|
93
|
+
renderer-card.js Shared ticket-card component (used by every view).
|
|
94
|
+
renderer-storymap.js SVG/DOM Story Map (process steps × releases × epics).
|
|
95
|
+
renderer-kanban.js Kanban board (status/board-column lanes).
|
|
96
|
+
renderer-ticket-modal.js / ticket-form.js Ticket editor (modal + full page).
|
|
97
|
+
renderer-dependencies.js Typed-link dependency graph view.
|
|
98
|
+
view-table.js / view-requirements.js / view-process-steps.js / view-settings.js
|
|
99
|
+
dnd.js Pointer-event drag-and-drop engine.
|
|
100
|
+
card-animate.js FLIP + pulse animations for external (live-sync) commits.
|
|
101
|
+
main.js Bootstrap: pick adapter → store → views → menus.
|
|
102
|
+
|
|
103
|
+
skill/SKILL.md The agent-facing skill: how Claude should use the board.
|
|
104
|
+
tests/ Plain-Node test scripts + run.js loader (see §14).
|
|
105
|
+
fixtures/ Seed snapshots for demos/smoke.
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## 4. Single source for pure logic (the symlink pattern)
|
|
109
|
+
|
|
110
|
+
Domain logic must run in three contexts — the browser, the HTTP server and the
|
|
111
|
+
MCP server — without a build step and without hand-mirroring.
|
|
112
|
+
|
|
113
|
+
- `shared/core.js` is the **only** copy. It is **UMD-wrapped**: `require()`d in
|
|
114
|
+
Node, and `<script src>`'d in the browser where it attaches to
|
|
115
|
+
`window.STORYMAP.core`.
|
|
116
|
+
- `frontend/js/core.js` is a **symlink** to `shared/core.js`. The browser loads
|
|
117
|
+
the real file through it.
|
|
118
|
+
- `server/core.js` is a **3-line re-export shim** (`module.exports =
|
|
119
|
+
require("../shared/core.js")`), so historical `require("./core.js")` paths keep
|
|
120
|
+
working.
|
|
121
|
+
|
|
122
|
+
The same applies to `core/graph.js`, `ticket-import.js`, `project-io.js` and the
|
|
123
|
+
query modules.
|
|
124
|
+
|
|
125
|
+
> **Edit only `shared/…`.** Never edit `server/core.js` (a shim) or
|
|
126
|
+
> `frontend/js/core.js` (a symlink). There is no mirror step and no parity test —
|
|
127
|
+
> because there is only one file.
|
|
128
|
+
|
|
129
|
+
## 5. Data model
|
|
130
|
+
|
|
131
|
+
Everything is stored as **one JSON snapshot per project** (the canonical form),
|
|
132
|
+
plus append-only revision rows and on-disk attachments.
|
|
133
|
+
|
|
134
|
+
| Table | Purpose |
|
|
135
|
+
| --- | --- |
|
|
136
|
+
| `projects` | `id`, the full `snapshot` JSON, `saved_at`, current `revision`, soft-delete flags. |
|
|
137
|
+
| `revisions` | `(project_id, revision)` PK, the full snapshot at that point, `op`, `actor`. Append-only, count-retained. |
|
|
138
|
+
| `attachments` | Metadata + on-disk relative path (files live next to the DB, never as blobs). |
|
|
139
|
+
|
|
140
|
+
Inside a snapshot, the domain entities are:
|
|
141
|
+
|
|
142
|
+
- **Project** — name, ticket prefix + counter, `definitions` (DoR/DoD),
|
|
143
|
+
`workflow` (statuses/transitions), `boards.kanban.columns`, `ticketTypes`,
|
|
144
|
+
`entityTypeConfig`, labels.
|
|
145
|
+
- **Ticket** — type (`epic` / `user-story` / `bug` / `task` / …), key, title,
|
|
146
|
+
description, status, `position` (`{epicId, processStepId, releaseId,
|
|
147
|
+
sortOrder}`), **frozen** `definitionOfReady` / `definitionOfDone`,
|
|
148
|
+
`acceptanceCriteria`, comments, labels, typed `links`.
|
|
149
|
+
- **Release** — a shippable product version that bundles many features.
|
|
150
|
+
- **ProcessStep** — a phase of the user journey; the columns of the story map.
|
|
151
|
+
|
|
152
|
+
Every entity carries **audit** columns: `createdAt/By`, `updatedAt/By` (actor is
|
|
153
|
+
`{type, id, name, sessionId?}`), and a monotonic `version` for optimistic locking.
|
|
154
|
+
|
|
155
|
+
## 6. Definition of Ready / Definition of Done (first-class)
|
|
156
|
+
|
|
157
|
+
Each project owns a `definitions` object with a `ready` and a `done` block. Each
|
|
158
|
+
block has `global` items plus per-ticket-type `appended` or `overridden` items.
|
|
159
|
+
The pure function `resolveDefinitions(definitions, ticketType)` produces the
|
|
160
|
+
effective list for a type.
|
|
161
|
+
|
|
162
|
+
- **Freeze on create.** When a ticket is created, the resolved checklist is
|
|
163
|
+
copied onto the ticket. Later project-level changes do **not** retroactively
|
|
164
|
+
alter open tickets.
|
|
165
|
+
- **Gated transitions.** The workflow marks which transitions require a gate.
|
|
166
|
+
Moving into a `requireGate: "DoR"` status while a required DoR item is unchecked
|
|
167
|
+
throws `{ statusCode: 422, missing: [...] }`; likewise DoD on the way to `done`.
|
|
168
|
+
- The MCP layer translates that 422 into a structured tool error, so the agent
|
|
169
|
+
gets a machine-readable list of what's still missing. **A conforming agent
|
|
170
|
+
never forces `done` — it checks the items off first.**
|
|
171
|
+
|
|
172
|
+
## 7. The workflow engine
|
|
173
|
+
|
|
174
|
+
`project.workflow` is fully configurable (Jira-style):
|
|
175
|
+
|
|
176
|
+
- **Statuses** are objects `{id, name, category}` with `category ∈
|
|
177
|
+
todo | doing | blocked | done`.
|
|
178
|
+
- **Transitions** are a named list: `{id, name, fromStatuses[], toStatus,
|
|
179
|
+
requireGate, allowFromAny}`. A transition matches when `toStatus` fits and
|
|
180
|
+
either `allowFromAny` is set or `fromStatuses` includes the current status.
|
|
181
|
+
Specific transitions win over generic ones.
|
|
182
|
+
- `validateStatusTransition` (pure, in `shared/core.js`) is the single gate
|
|
183
|
+
checkpoint; the REST route, the store, and every MCP status tool go through it.
|
|
184
|
+
No matching transition → `422 { kind: "TRANSITION" }`.
|
|
185
|
+
- Per-type overrides merge over the base workflow via `getWorkflowForType`.
|
|
186
|
+
|
|
187
|
+
Legacy string-array workflows migrate automatically on load.
|
|
188
|
+
|
|
189
|
+
## 8. Derived epic status (roll-up)
|
|
190
|
+
|
|
191
|
+
An **epic has no manual status**. `deriveEpicStatus(snapshot, epicId)` rolls it up
|
|
192
|
+
from its contained stories (resolved via `contains` links) over the status
|
|
193
|
+
categories: no children → first `todo`; all children `done` → first `done`; any
|
|
194
|
+
child in progress → first `doing`; else `todo`. `recomputeEpicStatuses` runs at
|
|
195
|
+
the end of every mutating op that can change a child's status or containment, and
|
|
196
|
+
as the last pass of `normalizeSnapshot` (which doubles as the migration for
|
|
197
|
+
legacy data). It sets only `ticket.status` — never bumps `version` (it is a
|
|
198
|
+
derivation, not an actor action). Every manual status path rejects epics with
|
|
199
|
+
`{ statusCode: 422, kind: "EPIC_STATUS_DERIVED" }`.
|
|
200
|
+
|
|
201
|
+
## 9. Kanban board mapping
|
|
202
|
+
|
|
203
|
+
`project.boards.kanban.columns` is a list of `{id, name, statusIds[]}`. The board
|
|
204
|
+
maps **N statuses → 1 column** (like Jira). The default is 1:1 with the workflow.
|
|
205
|
+
`computeKanbanLayout` builds lanes from the columns; a status that maps to no
|
|
206
|
+
column surfaces in a synthetic trailing lane so tickets are never invisible.
|
|
207
|
+
Dropping a card into a column that already contains its status is a pure reorder;
|
|
208
|
+
otherwise the card's status changes to the column's first status.
|
|
209
|
+
|
|
210
|
+
## 10. Live sync
|
|
211
|
+
|
|
212
|
+
The path from a write to a browser repaint:
|
|
213
|
+
|
|
214
|
+
1. A write lands in `storage._writeLocked`, which — after the transaction commits
|
|
215
|
+
— calls `bus.emit("change", { projectId, revision, savedAt, op, actor,
|
|
216
|
+
originId })`.
|
|
217
|
+
2. The WebSocket layer subscribes to `change` and **broadcasts** to every client
|
|
218
|
+
subscribed to that `projectId`.
|
|
219
|
+
3. An **origin-id echo filter** suppresses the echo back to the client that
|
|
220
|
+
caused the change (each mutating client registers an `originId`; the browser
|
|
221
|
+
already applied its own change optimistically via the store).
|
|
222
|
+
4. The browser's `ProjectStore.applyRemote(snapshot)` commits the incoming state
|
|
223
|
+
as a regular undo entry (a no-op if structurally identical), and the renderer
|
|
224
|
+
plays a **FLIP + pulse** animation (`card-animate.js`) so external changes are
|
|
225
|
+
visually obvious.
|
|
226
|
+
|
|
227
|
+
**Cross-process** live sync (the MCP server writing while the HTTP server serves
|
|
228
|
+
the browser): the two processes share the SQLite file but have separate buses.
|
|
229
|
+
The MCP process forwards its `change` events to the HTTP server via
|
|
230
|
+
`POST /api/internal/notify-change`, which re-emits them on the HTTP server's bus —
|
|
231
|
+
from there the normal broadcast + echo-filter path runs unchanged. A browser sees
|
|
232
|
+
an MCP write within ~50 ms, exactly as if another browser had made it.
|
|
233
|
+
|
|
234
|
+
The same bridge also powers `request_switch_project`: an agent can ask the human's
|
|
235
|
+
browser to switch to a project it just created, resolved through a WebSocket
|
|
236
|
+
prompt and a long-poll.
|
|
237
|
+
|
|
238
|
+
## 11. Storage internals
|
|
239
|
+
|
|
240
|
+
- **Atomic writes.** Each save is one `better-sqlite3` transaction: upsert the
|
|
241
|
+
project row + insert the revision row + (periodically) prune. A mid-write throw
|
|
242
|
+
rolls the whole thing back; `bus.emit` fires only after commit.
|
|
243
|
+
- **Per-project mutex.** An in-memory keyed promise chain serialises writes to a
|
|
244
|
+
project within the process, closing the lost-update window of a separate
|
|
245
|
+
load→save pair (`storage.mutate` does load-modify-write under one acquisition).
|
|
246
|
+
- **Monotonic revision IDs.** `YYYYMMDD-HHmmss-mmm[-NNNN]` (UTC), minted by a
|
|
247
|
+
high-water-mark counter so IDs are strictly increasing and string-sortable.
|
|
248
|
+
Across two processes sharing a data dir, a same-millisecond collision on the
|
|
249
|
+
revisions PK is caught and the id re-minted (bounded retry); `busy_timeout`
|
|
250
|
+
makes the second writer wait rather than fail.
|
|
251
|
+
- **Bounded retention.** Retention is purely count-based (newest N per project,
|
|
252
|
+
default 150), pruned inside the write transaction every Nth save. (An unbounded
|
|
253
|
+
history once grew a DB to ~1.8 GB — hence a hard cap, not an age window.)
|
|
254
|
+
- **Attachments** live on disk next to the DB with size caps and path-containment
|
|
255
|
+
checks; the DB stores only metadata + a relative path.
|
|
256
|
+
|
|
257
|
+
## 12. HTTP + WebSocket layer
|
|
258
|
+
|
|
259
|
+
- Raw routing in `server/server.js#buildRouter`; handlers delegate to
|
|
260
|
+
`core.ops` + `validation` + `storage` and never contain domain logic.
|
|
261
|
+
- A central JSON body reader enforces size caps, rejects invalid JSON, and strips
|
|
262
|
+
`__proto__` / `constructor` / `prototype` (prototype-pollution guard).
|
|
263
|
+
- Static file serving resolves within `FRONTEND_DIR`, rejects `..`, and
|
|
264
|
+
re-checks `realpath` against the root (symlink-escape guard).
|
|
265
|
+
- The WebSocket layer runs a **ping/pong heartbeat** that terminates
|
|
266
|
+
unresponsive clients so dead subscriptions don't leak.
|
|
267
|
+
- Everything is loopback-gated (see the security model in the README).
|
|
268
|
+
|
|
269
|
+
## 13. MCP layer
|
|
270
|
+
|
|
271
|
+
- **Dependency-free.** The MCP server is served over stdio by
|
|
272
|
+
`server/mcp-native/` — a transport-agnostic tool registry (`registry.js`:
|
|
273
|
+
register / listTools / dispatch) plus a JSON-RPC 2.0 stdio frontend
|
|
274
|
+
(`stdio.js`) — with **no external dependency**. It replaced
|
|
275
|
+
`@modelcontextprotocol/sdk`, which pulled an entire Express 5 + Hono transport
|
|
276
|
+
tree that was never executed (MCP is stdio-only; the HTTP layer is raw `http`).
|
|
277
|
+
Zod v4 emits the `tools/list` JSON Schemas natively (`z.toJSONSchema`), so no
|
|
278
|
+
schema-converter dependency is needed. `tools/call` failures (unknown tool,
|
|
279
|
+
invalid args, a throwing handler) come back as `isError` tool results, not
|
|
280
|
+
JSON-RPC errors — matching prior behaviour.
|
|
281
|
+
- ~70 tools, each defined with a Zod input schema and delegating to the shared
|
|
282
|
+
ops. Responses are **compact by default** (the changed entity + `revision` +
|
|
283
|
+
`savedAt`, not the whole snapshot).
|
|
284
|
+
- A shared `persist()` helper wraps load-mutate-write and translates thrown
|
|
285
|
+
`{statusCode, kind, missing}` into a uniform structured tool error, so agents
|
|
286
|
+
get machine-readable failures (e.g. a DoD gate).
|
|
287
|
+
- `tolerateJsonString` preprocesses nested arguments (position, patch, workflow,
|
|
288
|
+
board columns) that some MCP bridges serialise as JSON strings, so object and
|
|
289
|
+
string inputs both validate.
|
|
290
|
+
- `server/identity.js` is the authorization seam: `resolveActor` /
|
|
291
|
+
`resolveAiActor` never mint an "unknown" actor on a write path, and a single
|
|
292
|
+
`authorize(actor, op, entity)` choke-point (no-op allow-all today) is where RBAC
|
|
293
|
+
will plug in.
|
|
294
|
+
|
|
295
|
+
## 14. Frontend architecture
|
|
296
|
+
|
|
297
|
+
- **Store-centric.** `ProjectStore` (`store.js`) is the source of truth in the
|
|
298
|
+
browser. All mutations run locally through `core.ops` and commit via
|
|
299
|
+
`_commit(next, reason)`; a debounced subscriber persists the whole snapshot via
|
|
300
|
+
`PUT /api/projects/:id`. This gives real **undo/redo** (Cmd-Z / Cmd-Shift-Z)
|
|
301
|
+
even over HTTP. `applyRemote` folds WebSocket pushes in as ordinary undo
|
|
302
|
+
entries. The accepted trade-off is last-write-wins at the browser level.
|
|
303
|
+
- **Adapters** (`adapters.js`) abstract the backend: `HttpAdapter` (REST + WS
|
|
304
|
+
subscribe), `LocalStorageAdapter`, `MemoryAdapter`, chosen by `pickAdapter`.
|
|
305
|
+
- **Shared card component** (`renderer-card.js`) renders the identical ticket card
|
|
306
|
+
in every view (DRY).
|
|
307
|
+
- **Views** each mount/unmount against the store and re-render on commit: Story
|
|
308
|
+
Map, Kanban, Table, Dependencies, Requirements, Settings.
|
|
309
|
+
- **Drag and drop** is a custom pointer-event engine (`dnd.js`) — HTML5 DnD was
|
|
310
|
+
unreliable across browsers — with live insertion-index previews.
|
|
311
|
+
|
|
312
|
+
## 15. Testing
|
|
313
|
+
|
|
314
|
+
- **Plain Node scripts.** `tests/test-*.js` with a tiny `test(name, fn)` helper;
|
|
315
|
+
`tests/run.js` loads them sequentially. No mocha/jest/vitest. `jsdom` in tests
|
|
316
|
+
only. Run with `npm test` (≈1800 assertions); CI runs it on Node 20 and 22.
|
|
317
|
+
- **Layered coverage:** pure ops + normalize + workflow/governance;
|
|
318
|
+
storage atomicity/mutex/revisions; validation gates; REST + WebSocket
|
|
319
|
+
live-sync; MCP tools both in-process (`reg.handler`) **and** via a stdio
|
|
320
|
+
JSON-RPC subprocess; JSDOM renderer tests; and a **real-server end-to-end test**
|
|
321
|
+
(`tests/test-e2e.js`) that drives bootstrap → click → server round-trip → DOM
|
|
322
|
+
state, because only the composed test proves the pieces fit.
|
|
323
|
+
- **Data safety:** tests only ever use `os.tmpdir()` — the suite never touches a
|
|
324
|
+
user data directory. This is a hard rule for any new test or script.
|
|
325
|
+
|
|
326
|
+
New behaviour is written test-first; a bug gets a regression test before the fix;
|
|
327
|
+
pure-logic changes go in `shared/core.js` and are covered there.
|
|
328
|
+
|
|
329
|
+
## 16. Security model
|
|
330
|
+
|
|
331
|
+
Summarised in the README. In short: loopback-only, CORS/CSP/WS-origin locked to
|
|
332
|
+
local origins, prototype-pollution and path-traversal guards, body-size caps, and
|
|
333
|
+
an authorization seam ready for a future auth stage. Do not expose the server
|
|
334
|
+
beyond `127.0.0.1` without adding your own authentication in front.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or Derivative
|
|
95
|
+
Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work, excluding
|
|
103
|
+
those notices that do not pertain to any part of the Derivative
|
|
104
|
+
Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and do
|
|
117
|
+
not modify the License. You may add Your own attribution notices
|
|
118
|
+
within Derivative Works that You distribute, alongside or as an
|
|
119
|
+
addendum to the NOTICE text from the Work, provided that such
|
|
120
|
+
additional attribution notices cannot be construed as modifying
|
|
121
|
+
the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 Thomas Schwenger
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|