@laitszkin/apollo-toolkit 3.10.0 → 3.11.1

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 (47) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/analyse-app-logs/scripts/__pycache__/filter_logs_by_time.cpython-312.pyc +0 -0
  3. package/analyse-app-logs/scripts/__pycache__/log_cli_utils.cpython-312.pyc +0 -0
  4. package/analyse-app-logs/scripts/__pycache__/search_logs.cpython-312.pyc +0 -0
  5. package/docs-to-voice/scripts/__pycache__/docs_to_voice.cpython-312.pyc +0 -0
  6. package/generate-spec/SKILL.md +17 -15
  7. package/generate-spec/agents/openai.yaml +1 -1
  8. package/generate-spec/references/TEMPLATE_SPEC.md +103 -84
  9. package/generate-spec/scripts/__pycache__/create-specscpython-312.pyc +0 -0
  10. package/init-project-html/SKILL.md +117 -125
  11. package/init-project-html/agents/openai.yaml +18 -9
  12. package/init-project-html/lib/atlas/assets/architecture.css +161 -0
  13. package/init-project-html/lib/atlas/assets/viewer.client.js +136 -0
  14. package/init-project-html/lib/atlas/cli.js +1023 -0
  15. package/init-project-html/lib/atlas/layout.js +330 -0
  16. package/init-project-html/lib/atlas/render.js +583 -0
  17. package/init-project-html/lib/atlas/schema.js +347 -0
  18. package/init-project-html/lib/atlas/state.js +402 -0
  19. package/init-project-html/references/TEMPLATE_SPEC.md +140 -83
  20. package/init-project-html/sample-demo/resources/project-architecture/assets/architecture.css +160 -1058
  21. package/init-project-html/sample-demo/resources/project-architecture/assets/viewer.client.js +136 -0
  22. package/init-project-html/sample-demo/resources/project-architecture/atlas/atlas.index.yaml +34 -0
  23. package/init-project-html/sample-demo/resources/project-architecture/atlas/features/get-invite-codes.yaml +172 -0
  24. package/init-project-html/sample-demo/resources/project-architecture/atlas/features/invite-code-registration.yaml +160 -0
  25. package/init-project-html/sample-demo/resources/project-architecture/features/get-invite-codes/index.html +67 -52
  26. package/init-project-html/sample-demo/resources/project-architecture/features/get-invite-codes/invite-code-generator.html +64 -163
  27. package/init-project-html/sample-demo/resources/project-architecture/features/get-invite-codes/invite-issuance-service.html +102 -196
  28. package/init-project-html/sample-demo/resources/project-architecture/features/get-invite-codes/postgresql.html +82 -163
  29. package/init-project-html/sample-demo/resources/project-architecture/features/get-invite-codes/public-api.html +88 -150
  30. package/init-project-html/sample-demo/resources/project-architecture/features/get-invite-codes/web-get-invite-ui.html +83 -138
  31. package/init-project-html/sample-demo/resources/project-architecture/features/invite-code-registration/index.html +61 -51
  32. package/init-project-html/sample-demo/resources/project-architecture/features/invite-code-registration/postgresql.html +84 -159
  33. package/init-project-html/sample-demo/resources/project-architecture/features/invite-code-registration/public-api.html +81 -143
  34. package/init-project-html/sample-demo/resources/project-architecture/features/invite-code-registration/registration-service.html +98 -188
  35. package/init-project-html/sample-demo/resources/project-architecture/features/invite-code-registration/web-register-ui.html +83 -138
  36. package/init-project-html/sample-demo/resources/project-architecture/index.html +256 -335
  37. package/init-project-html/scripts/architecture.js +65 -247
  38. package/katex/scripts/__pycache__/render_katex.cpython-312.pyc +0 -0
  39. package/open-github-issue/scripts/__pycache__/open_github_issue.cpython-312.pyc +0 -0
  40. package/package.json +6 -2
  41. package/read-github-issue/scripts/__pycache__/find_issues.cpython-312.pyc +0 -0
  42. package/read-github-issue/scripts/__pycache__/read_issue.cpython-312.pyc +0 -0
  43. package/resolve-review-comments/scripts/__pycache__/review_threads.cpython-312.pyc +0 -0
  44. package/spec-to-project-html/SKILL.md +74 -67
  45. package/spec-to-project-html/agents/openai.yaml +14 -8
  46. package/spec-to-project-html/references/TEMPLATE_SPEC.md +98 -83
  47. package/text-to-short-video/scripts/__pycache__/enforce_video_aspect_ratio.cpython-312.pyc +0 -0
package/CHANGELOG.md CHANGED
@@ -10,6 +10,43 @@ All notable changes to this repository are documented in this file.
10
10
 
11
11
  ### Fixed
12
12
 
13
+ ## [v3.11.1] - 2026-05-11
14
+
15
+ ### Added
16
+
17
+ - `dataflow add` optional `--fn`, `--reads`, and `--writes` (comma-separated variable names): each internal step can reference a declared function and read/write declared variables in the same sub-module; `validate` rejects unknown names. The renderer draws a function pill plus reads/writes chips on sub-module internal flow diagrams.
18
+ - `init-project-html` / `spec-to-project-html`: **Acceptance criteria** for macro edges (call/return/data-row/failure) and for sub-module diagrams (function flow + variable state); Rule 2 and CLI verb table updated; `TEMPLATE_SPEC.md` documents object-shaped `dataflow` steps and new CSS hooks.
19
+ - Macro atlas UX: each sub-module rectangle is an `<a href="features/<feature>/<sub>.html">` with `aria-label`, nested SVG `<title>` tooltip, `cursor: pointer`, and clearer hover/focus styles.
20
+
21
+ ### Changed
22
+
23
+ - `layout.js`: `measureSubmodule()` computes per-node width/height from slug, kind label, and `role` so elkjs lays out boxes that fit wrapped role text (replaces fixed 240×92 and the old single-line truncation).
24
+ - `render.js`: macro SVG draws slug, kind, and multi-line role using the same `measureSubmodule()` output as layout; sub-dataflow SVG renders enriched steps with fn pill and reads/writes chips (from prior work in this release train, now validated and documented).
25
+
26
+ ### Fixed
27
+
28
+ - `viewer.client.js`: defer pointer capture until the pointer moves past a small drag threshold so clicks on macro sub-module links navigate; swallow the synthetic click after an actual drag so pan does not accidentally open a page.
29
+
30
+ ## [v3.11.0] - 2026-05-11
31
+
32
+ ### Added
33
+
34
+ - Declarative atlas CLI: every component (feature, sub-module, function, variable, dataflow step, error, edge, actor, meta) is now declared through `apltk architecture <verb> ...`. The CLI persists per-feature YAML under `resources/project-architecture/atlas/`, runs deterministic layout via `elkjs`, and re-renders HTML/SVG (with built-in pan/zoom) on every mutation.
35
+ - `--spec <spec_dir>` flag: spec-mode mutations write the overlay snapshot under `<spec_dir>/architecture_diff/atlas/` and render only the affected proposed-after HTML pages there; `apltk architecture diff` continues to pair pages by relative path.
36
+ - `apltk architecture` new verbs: `render`, `validate`, `undo`, plus per-component `add` / `set` / `remove` actions for features, sub-modules, functions, variables, dataflow steps, errors, and edges.
37
+ - Built-in pan/zoom client for the macro atlas (mouse wheel, drag, +/-/Fit toolbar, keyboard arrows) shipped as `lib/atlas/assets/viewer.client.js`.
38
+ - New test suites: `test/atlas-state.test.js`, `test/atlas-render.test.js`, `test/atlas-cli.test.js` covering YAML round-trip, overlay merge, layout no-overlap, rendering scope, and every CLI verb.
39
+ - New runtime dependencies: `elkjs` (layered layout) and `js-yaml` (YAML state).
40
+
41
+ ### Changed
42
+
43
+ - `init-project-html`, `spec-to-project-html`, and `generate-spec` SKILL.md / agents/openai.yaml / `references/TEMPLATE_SPEC.md`: rewritten around CLI verbs and the declarative atlas; binding rules now forbid hand-authoring HTML under `resources/project-architecture/**` or `architecture_diff/**` (the renderer owns layout, no-overlap, DOM, CSS, ARIA, pan/zoom).
44
+ - `init-project-html/sample-demo/`: converted to YAML source (`atlas/atlas.index.yaml` + `atlas/features/*.yaml`) and regenerated via the new CLI.
45
+ - `init-project-html/scripts/architecture.js`: now a thin shim — the legacy `open` / `diff` verbs stay sync for backward-compatible tests, while new declarative verbs (`feature add`, `submodule add`, etc.) route through `lib/atlas/cli.js`.
46
+ - `.gitignore`: ignore `node_modules/` for local development; document that `package-lock.json` must remain committed so `npm ci` installs and published installs resolve the same dependency tree (`elkjs`, `js-yaml`).
47
+
48
+ ### Fixed
49
+
13
50
  ## [v3.10.0] - 2026-05-11
14
51
 
15
52
  ### Added
@@ -2,8 +2,8 @@
2
2
  name: generate-spec
3
3
  description: >-
4
4
  Author docs/plans trees: run `apltk create-specs`, hydrate `spec/tasks/checklist/contract/design` (+ `coordination.md`/`preparation.md` when parallel/prep dictates), cite official docs for external deps, plan tests via **`test-case-strategy`**, block code edits until explicit user approval.
5
- Architecture-touching specs also emit `architecture_diff/` next to `spec.md` (after-HTML for affected pages only): module-internal edits reuse the SAME path as `resources/project-architecture/<rel>.html` so `apltk architecture diff` aligns by path, additions use a new path, removals go in `_removed.txt`.
6
- Use when drafting/refreshing specs or restructuring batches—not when executing approved plans (use **`implement-specs*`** instead).
5
+ Architecture-touching specs declare the proposed-after atlas via `apltk architecture --spec <spec_dir> <verb> ...`; the CLI writes overlay YAML to `<spec_dir>/architecture_diff/atlas/` and re-renders only the affected proposed-after HTML pages never hand-author files under `architecture_diff/`.
6
+ Use when drafting/refreshing specs or restructuring batches not when executing approved plans (use **`implement-specs*`** instead).
7
7
  Reject vague `tasks.md` missing file/mutation/verifier; SPLIT >3-module scope; never overwrite a neighbor `{change}`.
8
8
  Bad: `- [ ] Add tests`… OK: `- [ ] src/auth/scope.rs — deny unknown scopes — Verify: cargo test scope::defaults`…
9
9
  ---
@@ -27,12 +27,7 @@ description: >-
27
27
  - **`tasks.md` checklist items**: **every** `- [ ]` **MUST** specify (a) concrete file/function target, (b) specific modification and expected outcome, (c) a verification hook—**no** vague rows (`Implement integration`, `Add tests`). Forbidden vague items **MUST** be rewritten before approval.
28
28
  - **MUST** use `test-case-strategy` when planning non-trivial logic tests and checklist mapping (test IDs, drift checks). Every **non-trivial** `tasks.md` implementation item **MUST** name a focused unit drift check, another concrete verification hook, or **`N/A`** with a concrete reason.
29
29
  - **MUST NOT** modify implementation code before **explicit user approval** of the spec set. Clarifications **MUST** sync across affected files and **MUST** re-trigger approval. If scope becomes a **different issue**, **MUST** stop editing the old set and create a **new** `change_name`.
30
- - **MUST** when the proposed change touches the architecture surface (feature/sub-module add/rename/remove, edge add/remove, `sub-vars` or `sub-io` deltas), generate an `architecture_diff/` directory **next to `spec.md`** containing the proposed **after** HTML for **only the affected pages**, mirroring `resources/project-architecture/` paths produced by `init-project-html`. Use this skill's own `references/TEMPLATE_SPEC.md` for the vocabulary, macro SVG class hooks, and ready-to-copy `sub-io` / `sub-vars` / `sub-dataflow` DOM snippetspage-contract rules still come from `init-project-html/SKILL.md`. The CLI `apltk architecture diff` identifies diffs **by path alone**, so deviating from the three alignment rules below breaks the viewer:
31
- - **Module-internal change** (same sub-module: function I/O, variables, internal flow, errors; or small in-place edits on `macro` / feature index pages): write the proposed-after HTML at the **SAME path** as `resources/project-architecture/<rel>.html`. This is the common case — never invent a new filename for an in-place edit, or the CLI mis-classifies it as add + remove.
32
- - **Addition**: write at a new `architecture_diff/<new-rel>.html` whose mirror under `resources/project-architecture/` does not yet exist.
33
- - **Removal**: list the removed `<rel>` in `architecture_diff/_removed.txt` (one relative path per line). Do not create an empty placeholder HTML for removals.
34
- - **Rename = removal + addition**: list the old path in `_removed.txt` AND write proposed-after HTML at the new path.
35
- Always copy `architecture.css` into `architecture_diff/assets/` so every page renders standalone via relative paths (`../../assets/architecture.css`). For batch specs the diff lives inside each member spec's directory only — **MUST NOT** duplicate at batch root. **MUST** keep all paths relative for portability.
30
+ - **MUST** when the proposed change touches the architecture surface (feature / sub-module add / rename / remove, edge add / remove, `sub-vars` or function I/O deltas, internal dataflow / error deltas), declare the proposed-after state through `apltk architecture --spec <spec_dir> <verb> ...`. The CLI writes overlay YAML to `<spec_dir>/architecture_diff/atlas/` and renders only the affected proposed-after HTML pages under `<spec_dir>/architecture_diff/`; `apltk architecture diff` then pairs them with the base atlas by path. **MUST NOT** hand-author files under `architecture_diff/**` the renderer owns layout, no-overlap, DOM, CSS, ARIA, and pan/zoom. For batch specs the overlay lives in each member spec's own directory only **MUST NOT** duplicate at batch root. See this skill's own `references/TEMPLATE_SPEC.md` for the component schema cheat sheet and a quick worked example; the binding verbs and semantic rules live in `init-project-html/SKILL.md`.
36
31
  - Write prose in the **user’s language** by default; keep requirement/task/test IDs traceable across `spec.md`, `tasks.md`, and `checklist.md`.
37
32
  - **MUST** use **kebab-case** `change_name`; **MUST NOT** use spaces or arbitrary special characters in names.
38
33
 
@@ -88,16 +83,23 @@ Always materialize: `spec.md`, `tasks.md`, `checklist.md`, `contract.md`, `desig
88
83
 
89
84
  ### 3.5) Architecture diff (only when the proposal touches the architecture surface)
90
85
 
91
- When the spec changes a feature module, sub-module, edge, variable, or function I/O, create `architecture_diff/` **inside the spec directory** and write proposed-after HTML following the three alignment rules:
86
+ When the spec changes a feature module, sub-module, edge, variable, or function I/O, declare the proposed-after state through the CLI scoped to this spec directory:
92
87
 
93
- - Module-internal change → write at the **SAME path** as `resources/project-architecture/<rel>.html`.
94
- - Addition → write at a new path.
95
- - Removal list the `<rel>` in `architecture_diff/_removed.txt`; do not write an HTML placeholder.
88
+ ```bash
89
+ SPEC_DIR=docs/plans/<date>/<change_name>
90
+ apltk architecture --spec "$SPEC_DIR" feature add --slug ... --title "..." --story "..." --no-render
91
+ apltk architecture --spec "$SPEC_DIR" submodule add|set|remove --feature ... --slug ... --kind ... --role "..." --no-render
92
+ apltk architecture --spec "$SPEC_DIR" function|variable|dataflow|error add|remove ... --no-render
93
+ apltk architecture --spec "$SPEC_DIR" edge add|remove --from <feat>[/sub] --to <feat>[/sub] --kind ... --label "..." --no-render
94
+ apltk architecture --spec "$SPEC_DIR" render
95
+ apltk architecture --spec "$SPEC_DIR" validate
96
+ ```
96
97
 
97
- Copy `architecture.css` into `architecture_diff/assets/`; keep every path relative. For batch specs the diff stays inside the member spec's own directory. `apltk architecture diff` pairs `architecture_diff/` with `resources/project-architecture/` for a paginated before/after viewer.
98
+ The CLI writes overlay YAML under `$SPEC_DIR/architecture_diff/atlas/` and re-renders only the affected HTML pages under `$SPEC_DIR/architecture_diff/`. Cross-feature edges into features that are not declared in the overlay still resolve against the base atlas. For batch specs, scope each member spec's overlay to its own directory never duplicate at the batch root. **Do not hand-edit** any file under `architecture_diff/`.
98
99
 
99
- - **Pause →** Did an in-place sub-module edit get written at a new path? Move it back to the same path — otherwise the CLI registers it as add + remove.
100
- - **Pause →** Does every `_removed.txt` entry actually exist under `resources/project-architecture/`? Drop entries that do not.
100
+ - **Pause →** Did I touch any file under `architecture_diff/` by hand? Revert and re-run the CLI verb instead.
101
+ - **Pause →** Does `apltk architecture --spec "$SPEC_DIR" validate` return OK? Resolve dangling edges and unknown enums before approval.
102
+ - **Pause →** Does `apltk architecture diff` pair the spec's pages correctly (modified / added / removed)? A page that shows as remove + add means a slug was renamed inadvertently.
101
103
 
102
104
  ### 4) Clarifications and approval
103
105
 
@@ -4,4 +4,4 @@ interface:
4
4
  default_prompt: >-
5
5
  Use $generate-spec to create or update single-spec plans under docs/plans/<date>/<change_name>/ or parallel batches under docs/plans/<date>/<batch_name>/<change_name>/ with shared coordination.md and, only when specs cannot be parallel-safe without prior shared work, minimal non-business preparation.md; treat references/templates/*.md as binding format; member specs assume preparation finished—do not duplicate preparation tasks; surface collisions early and resolve ownership via coordination.md; fill BDD in spec.md; integrate $test-case-strategy into tasks/checklists.
6
6
  **Critical layering:** design.md + contract.md are higher-level guiding context only (architecture + cite-backed external truth; coarse INT-### / EXT-### anchors). tasks.md MUST be the ONLY enumerated runnable queue with path-level edits and verification hooks—derive tasks FROM spec + design + contract WITHOUT mirroring checklist rows into design/contract; optionally cite INT/EXT on task lines for traceability—never duplicate task choreography inside design.md or contract.md.
7
- **Architecture diff:** When the spec touches the architecture surface (feature/sub-module add/rename/remove, edge changes, sub-vars / sub-io deltas), generate an `architecture_diff/` directory next to `spec.md` with proposed-after HTML for affected pages only, mirroring `resources/project-architecture/` paths produced by $init-project-html. Use this skill's own `references/TEMPLATE_SPEC.md` for vocabulary, class hooks, and DOM snippets page-contract rules come from `init-project-html/SKILL.md`. Three hard rules so `apltk architecture diff` can pair before/after by PATH alone(1) module-internal changes MUST be written at the SAME relative path as `resources/project-architecture/<rel>.html` (never invent a new filename for in-place edits, or the CLI will mis-classify it as add+remove); (2) additions go to a new path; (3) removals are listed in `architecture_diff/_removed.txt` (one relative path per line, no placeholder HTML). Rename = removed + added. Copy `architecture.css` into `architecture_diff/assets/`; keep every path relative; for batch specs the diff folder lives in each member spec's directory only, never duplicated at batch root.
7
+ **Architecture diff:** When the spec touches the architecture surface (feature/sub-module add/rename/remove, edge changes, sub-vars / sub-io / dataflow / error deltas), declare the proposed-after state through `apltk architecture --spec <spec_dir> <verb> ...`. The CLI writes overlay YAML under `<spec_dir>/architecture_diff/atlas/` and renders only the affected HTML pages under `<spec_dir>/architecture_diff/`; `apltk architecture diff` then pairs them with the base atlas by path. NEVER hand-author files under `architecture_diff/**` the renderer owns layout, no-overlap, DOM, CSS, ARIA, and pan/zoom. Use $init-project-html `SKILL.md` and `references/TEMPLATE_SPEC.md` for the verb cheat sheet (`feature`, `submodule`, `function`, `variable`, `dataflow`, `error`, `edge` add/remove/set + `meta set`, `actor add`, plus `render`, `validate`, `undo`). For batch specs scope each member's overlay to that member's directory only never duplicate at the batch root. Always run `apltk architecture --spec <spec_dir> validate` after the final mutation and ensure `apltk architecture diff` pairs every changed page (modified / added / removed) correctly.
@@ -1,98 +1,117 @@
1
- # HTML architecture atlas — reference cheat sheet (generate-spec copy)
1
+ # Atlas component schema — reference cheat sheet (generate-spec copy)
2
2
 
3
- > Reference material only. The **binding rules for atlas pages** (page contracts, naming, assets, accessibility, forbidden shortcuts) live in `init-project-html/SKILL.md`. The **binding rules for `architecture_diff/`** (the three-rule path-alignment contract used by `apltk architecture diff`) live in this skill's own `generate-spec/SKILL.md`. This file is a local glossary + class-hook table + DOM snippets so `generate-spec` can author proposed-after pages without re-deriving the markup, and stay self-contained when installed alone.
3
+ > Reference material only. The binding rules for atlas pages (verbs, semantic contracts, evidence) live in `init-project-html/SKILL.md`. The binding rule for spec-time atlas changes (declare via CLI, never hand-author HTML) lives in this skill's own `generate-spec/SKILL.md`. This file lists the exact fields and enum values that `apltk architecture --spec <spec_dir>` accepts.
4
4
 
5
- ## Vocabulary
5
+ ## Where the overlay lands
6
6
 
7
- - **Feature module** one **user-visible end-to-end capability** (e.g. "invite-code registration", "get-invite-codes"). One directory `features/<feature-slug>/`. It is **not** a single web layer or a single database.
8
- - **Sub-module** — an implementation boundary inside that capability (front-end page, public API, domain service, PostgreSQL, pure helpers, message queues…). One HTML page per sub-module, sibling to the feature's `index.html`.
7
+ When you run any `apltk architecture --spec <spec_dir> <verb> ...`, the CLI writes:
9
8
 
10
- ## Directory layout (target output)
11
-
12
- ```text
13
- resources/project-architecture/
14
- index.html # macro: feature × sub-module in one SVG with multi-edge + data-row flow
15
- assets/
16
- architecture.css
17
- features/
18
- <feature-slug>/ # one feature module = one directory
19
- index.html # lightweight overview (story + submodule nav)
20
- <sub-module-slug>.html # one HTML per sub-module (own I/O + internal flow)
21
9
  ```
22
-
23
- ## Macro SVG — CSS class hooks
24
-
25
- | Element | class |
26
- |---|---|
27
- | Actor block | `m-actor` |
28
- | Feature cluster frame | `m-cluster` / `m-cluster__rect` / `m-cluster__title` |
29
- | Sub-module node | `m-sub` (add `m-sub--db` for databases) |
30
- | Edge | `m-edge` + modifier `m-edge--call` / `m-edge--return` / `m-edge--cross` |
31
- | Edge label | `m-edge__label` (cross-feature labels add `m-edge__label--cross`) |
32
-
33
- ## DOM snippets
34
-
35
- ### `sub-io` function I/O table
36
-
37
- ```html
38
- <section class="sub-io">
39
- <h2>Function I/O</h2>
40
- <table>
41
- <thead><tr><th>Function</th><th>Signature</th><th>Side effects</th><th>Purpose</th></tr></thead>
42
- <tbody>
43
- <tr>
44
- <td><code>FunctionName</code></td>
45
- <td class="sub-io__signature">
46
- <strong>in:</strong> <code>T1</code>, <code>T2</code><br>
47
- <strong>out:</strong> <code>R</code> | <code>ErrX</code>
48
- </td>
49
- <td><span class="sub-io__side sub-io__side--pure">pure</span></td>
50
- <td>One-line purpose.</td>
51
- </tr>
52
- </tbody>
53
- </table>
54
- </section>
10
+ <spec_dir>/architecture_diff/
11
+ ├── atlas/
12
+ │ ├── atlas.index.yaml # optional partial override of meta / actors / cross-feature edges / feature ordering
13
+ │ ├── features/<slug>.yaml # full proposed state of any changed feature
14
+ │ ├── _removed.yaml # {features: [...], submodules: [{feature, submodule}]}
15
+ │ ├── atlas.history.log
16
+ │ └── atlas.history.undo.json
17
+ ├── index.html # rendered when macro visibly changes
18
+ ├── features/<slug>/index.html # rendered when feature page visibly changes
19
+ ├── features/<slug>/<sub>.html # rendered when sub-module visibly changes
20
+ ├── _removed.txt # auto-written from _removed.yaml; consumed by `apltk architecture diff`
21
+ └── assets/ # architecture.css + viewer.client.js (copied by the renderer)
55
22
  ```
56
23
 
57
- ### `sub-vars` variables-with-business-purpose table
58
-
59
- ```html
60
- <section class="sub-vars">
61
- <h2>Variables &amp; business purpose</h2>
62
- <p class="sub-vars__intro">Identifiers this sub-module holds or threads through. Types align readers; business purpose comes first.</p>
63
- <table>
64
- <thead>
65
- <tr><th>Variable</th><th>Type</th><th>Scope</th><th>Business purpose</th></tr>
66
- </thead>
67
- <tbody>
68
- <tr>
69
- <td class="sub-vars__name">someVar</td>
70
- <td class="sub-vars__type">SomeType</td>
71
- <td><span class="sub-vars__scope sub-vars__scope--call">call</span></td>
72
- <td>One line: this value decides branch X; without it Y breaks.</td>
73
- </tr>
74
- </tbody>
75
- </table>
76
- </section>
24
+ `apltk architecture diff` scans every `docs/plans/**/architecture_diff/**/*.html`, pairs them with `resources/project-architecture/` by relative path, and classifies each as **modified**, **added**, or **removed**. The CLI's overlay path layout guarantees correct pairing — agents do not need to manage paths manually.
25
+
26
+ ## Components (mirrors `init-project-html/references/TEMPLATE_SPEC.md`)
27
+
28
+ The same component fields and enums apply in spec mode:
29
+
30
+ | Component | Required fields | Enum values |
31
+ | --------- | --------------- | ----------- |
32
+ | `meta` | `title` | — (`summary` optional) |
33
+ | `actor` | `id` (kebab-case), `label` | — |
34
+ | `feature` | `slug` (kebab-case), `title` | — (`story`, `dependsOn` optional) |
35
+ | `submodule` | `slug` (kebab-case), `kind` | `ui` `api` `service` `db` `pure-fn` `queue` `external` |
36
+ | `function` | `name` | `side`: `pure` `io` `write` `tx` `lock` `network` |
37
+ | `variable` | `name` | `scope`: `call` `tx` `persist` `instance` `loop` |
38
+ | `dataflow` step | string | — |
39
+ | `error` | `name` | (`when`, `means` optional) |
40
+ | `edge` | `from`, `to`, `kind` | `kind`: `call` `return` `data-row` `failure` |
41
+
42
+ ## Verb cheat sheet (spec mode)
43
+
44
+ Always pass `--spec <spec_dir>`. Common patterns:
45
+
46
+ ```bash
47
+ # Open the spec directory once as a shell variable for readability:
48
+ SPEC_DIR=docs/plans/2026-05-11/add-2fa
49
+
50
+ # Add a new sub-module to an existing feature in the base atlas:
51
+ apltk architecture --spec "$SPEC_DIR" submodule add \
52
+ --feature register --slug 2fa --kind service \
53
+ --role "TOTP verification (planned: not yet implemented)" --no-render
54
+
55
+ # Adjust an existing sub-module's role / kind:
56
+ apltk architecture --spec "$SPEC_DIR" submodule set \
57
+ --feature register --slug api --role "Endpoint with 2FA gate" --no-render
58
+
59
+ # Add functions / variables / dataflow / errors:
60
+ apltk architecture --spec "$SPEC_DIR" function add \
61
+ --feature register --submodule 2fa --name VerifyTotp \
62
+ --in "ctx, code" --out "ok | ErrInvalidTotp" --side network \
63
+ --purpose "Checks the TOTP code against the user's seed." --no-render
64
+
65
+ apltk architecture --spec "$SPEC_DIR" variable add \
66
+ --feature register --submodule 2fa --name totp_seed \
67
+ --type "bytes[20]" --scope persist \
68
+ --purpose "Seed material for TOTP verification (per user)." --no-render
69
+
70
+ apltk architecture --spec "$SPEC_DIR" dataflow add \
71
+ --feature register --submodule 2fa --step "Load seed for userId" --no-render
72
+ apltk architecture --spec "$SPEC_DIR" dataflow add \
73
+ --feature register --submodule 2fa --step "Validate TOTP code window" --no-render
74
+
75
+ apltk architecture --spec "$SPEC_DIR" error add \
76
+ --feature register --submodule 2fa --name ErrInvalidTotp \
77
+ --when "Code mismatch within accepted window." \
78
+ --means "422 response with totp reason." --no-render
79
+
80
+ # Add intra-feature edge:
81
+ apltk architecture --spec "$SPEC_DIR" edge add \
82
+ --from register/api --to register/2fa --kind call \
83
+ --label "verify TOTP" --id e-api-2fa --no-render
84
+
85
+ # Removals (overlay records them in _removed.yaml; the renderer emits _removed.txt):
86
+ apltk architecture --spec "$SPEC_DIR" feature remove --slug legacy --no-render
87
+ apltk architecture --spec "$SPEC_DIR" submodule remove --feature register --slug v0-shim --no-render
88
+
89
+ # Render + validate once at the end (sed for batched mutations):
90
+ apltk architecture --spec "$SPEC_DIR" render
91
+ apltk architecture --spec "$SPEC_DIR" validate
77
92
  ```
78
93
 
79
- Scope chip vocabulary: `sub-vars__scope--call` (single call), `--tx` (transaction-bound), `--persist` (persisted), `--instance` (fixed at construction; lifetime-shared), `--loop` (retry/loop).
80
-
81
- ### `sub-dataflow` small SVG sizing
94
+ ## Important constraints (binding)
82
95
 
83
- - Node class: `d-node`; edge class: `d-edge` (side-effect edges use `d-edge--side`).
84
- - Recommended viewBox: height 240, width 720.
85
- - Nodes are this sub-module's internal variables/functions only.
96
+ - **Never** hand-edit any file under `architecture_diff/` the renderer rewrites them on every `apltk architecture --spec ... render` call.
97
+ - The base atlas under `resources/project-architecture/` is **read-only** in spec mode; CLI writes never touch it.
98
+ - Cross-feature edges into features that are not overlaid still resolve against the base atlas without re-declaring those features.
99
+ - For batch specs, scope each member's overlay to its own member directory; never duplicate at the batch root.
86
100
 
87
- ## Edge-kind vocabulary (for macro `flow-edge-manifest`)
101
+ ## Worked example: end-to-end overlay for a new "add 2FA" spec
88
102
 
89
- | `data-edge-kind` | meaning | typical visual |
90
- |---|---|---|
91
- | `call` | function call / HTTP request | solid arrow |
92
- | `return` | return value / response | thin dashed arrow |
93
- | `data-row` | cross-feature hand-off via data rows (not a function call) | warm-tone heavy dashed |
94
- | `failure` | failure branch | red solid arrow with `failure` chip in the manifest row |
103
+ The CLI invocation above produces this overlay tree (rendered HTML omitted for brevity):
95
104
 
96
- ## Typography hint
105
+ ```
106
+ docs/plans/2026-05-11/add-2fa/architecture_diff/
107
+ ├── atlas/
108
+ │ ├── atlas.index.yaml
109
+ │ └── features/register.yaml
110
+ ├── index.html
111
+ ├── features/register/index.html
112
+ ├── features/register/api.html
113
+ ├── features/register/2fa.html
114
+ └── assets/architecture.css
115
+ ```
97
116
 
98
- Pair a recognisable display face (e.g. `Fraunces`) with `Plus Jakarta Sans`. Avoid the "AI-default purple gradient" and Inter look-alike. Detailed rules live in `init-project-html/SKILL.md` § Rule 6.
117
+ Running `apltk architecture diff` then pairs `register/2fa.html` (added) and `register/api.html` + `register/index.html` + `index.html` (modified) with their base counterparts.