@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
@@ -1,46 +1,51 @@
1
1
  ---
2
2
  name: spec-to-project-html
3
3
  description: >-
4
- Sync HTML architecture pages to active planning specs. **MUST** preserve the two-layer rule: macro `index.html` stays ONE SVG showing both feature-module and sub-module interactions (multi-edge, producer/consumer loops, cross-feature data-row); each sub-module page stays self-only (function I/O + variables-with-business-purpose + internal data flow + local errors). Feature `index.html` stays lightweight (story + submodule-nav). Read strategy mirrors `init-project-html`: list affected feature modules first; with subagents, dispatch one read-only subagent per affected feature to return summaries before patching; without subagents, patch one feature's pages plus its macro slice before moving to the next never load every affected feature's code into the main context at once. Ground in repo evidence; mark `TBD` when code is missing.
4
+ Sync the project HTML architecture atlas to active planning specs by driving `apltk architecture --spec <spec_dir>`. The CLI writes overlay YAML under `<spec_dir>/architecture_diff/atlas/` and re-renders only the affected proposed-after HTML pages macro SVG and per-sub-module internal-dataflow diagrams stay zoomable just like the base atlas so `apltk architecture diff` can pair before/after by path. Preserve the two-layer rule and the responsibility split: when subagents are available, each subagent reads ONE affected feature and declares EVERY intra-feature change itself (sub-modules, function / variable / dataflow / error rows, intra-feature edges including error and rollback flows); the main agent only aggregates outbound-boundary summaries and declares cross-feature edges. Without subagents, process features sequentially with the same split. Ground every declaration in repo evidence; mark `TBD` when code is missing.
5
5
  ---
6
6
 
7
7
  # Spec To Project HTML
8
8
 
9
9
  ## Dependencies
10
10
 
11
- - Required: **`init-project-html`** — its `SKILL.md` is the binding rulebook for page contracts (Rules 1–7), and its `references/architecture.css` is the shared asset to copy. Local cheat sheet (same vocabulary + class hooks + DOM snippets) lives in this skill's own `references/TEMPLATE_SPEC.md`.
11
+ - Required: **`init-project-html`** — its `SKILL.md` is the rulebook for what each component declaration means and which verbs to call. Reuse the same CLI here with `--spec`.
12
12
  - Conditional: **`recover-missing-plan`** if a spec pointer is missing.
13
13
  - Conditional: **`generate-spec`** / **`implement-specs*`** terminology for requirement IDs.
14
14
  - Optional: **`review-spec-related-changes`** when verifying diagram updates against specs.
15
- - Fallback: spec demands components that are absent from code → label **planned / gap** in macro summary and on affected nodes; **MUST NOT** mark them as implemented.
15
+ - Fallback: spec demands components that are absent from code → declare them but use `TBD` strings or a `gap` token in the role/purpose/dataflow fields; **MUST NOT** mark them as implemented.
16
16
 
17
17
  ## Non-negotiables
18
18
 
19
19
  - **MUST** read specs in order unless the user directs otherwise: `spec.md` → `design.md` → `contract.md` → coordination notes.
20
- - **MUST** open and parse the existing macro `index.html`, every `features/<slug>/index.html`, **and every sub-module HTML** before editing preserve `data-feature-id` / `data-submodule-id` / `data-edge-id` unless a rename is explicit and propagated everywhere (including the macro SVG nav and the macro manifest).
21
- - **MUST** obey `init-project-html/SKILL.md` Rules 1–7 (page contracts, naming, assets, accessibility, forbidden shortcuts). Two reminders that this skill violates most often:
22
- - **Rule 1** — cross-submodule interactions live only in the macro SVG (multi-edge, producer/consumer, cross-feature data-row); the macro **MUST** index every sub-module page.
23
- - **Rule 2**sub-module pages contain only `sub-io` + `sub-vars` (variables-with-business-purpose) + `sub-dataflow` + `sub-errors`; no cross-boundary narrative.
24
- - **MUST** reconcile new requirements and design deltas:
25
- - In the macro SVG, add/remove/relabel sub-module nodes and edges; every new node also gets a sub-module HTML and a manifest row.
26
- - On sub-module pages, add/remove/update function I/O and internal data flow; **never** describe cross-boundary interactions here update the macro edges instead.
27
- - **MUST** migrate any leftover legacy structure during the same edit pass:
28
- - feature index `flow-chart--submodules` / `flow-edge-manifest` / `flow-return-row` move to the macro; feature index reverts to lightweight.
29
- - sub-module page `submodule-role` cross-boundary prose or cross-boundary manifests delete or compress into a single "see macro" link.
30
- - legacy single-file `features/<slug>.html` migrate to the directory layout.
31
- - **MUST NOT** shrink the macro into prose-only or feature-only diagrams: the multi-edge + sub-module layer must remain visible in the SVG.
32
- - **MUST NOT** drop modules that are still present in code just because the spec omits them keep them, or annotate as "out of spec scope" with a reason.
33
- - **MUST** scope reads to the **affected feature modules** identified from the spec/design diff (plus any feature owning a cross-feature edge into an affected one). Apply the same context-safe read strategy as `init-project-html` Rule 3:
34
- - **With subagents** main agent lists affected features first, then dispatches **one read-only subagent per affected feature** to deep-read and return a structured change summary (affected sub-modules, variable / I/O / boundary deltas). Main agent **only** receives summaries, and only after every subagent reports does it patch the macro and pages in one pass.
35
- - **Without subagents** — process features one at a time: read one affected feature, **immediately** patch its `features/<slug>/` tree plus the macro cluster/nodes/edges (mark edges pointing at unread affected features with `data-edge-target-pending`). Drop function-level details from memory before reading the next feature. After all features are patched, resolve every pending edge in a final pass.
36
- - **Forbidden**: loading every affected feature's source into the main agent's context before patching — early details get pushed out and macro/sub-module pages contradict each other.
20
+ - **MUST** declare every change through the CLI with `--spec <spec_dir>`. The CLI writes overlay YAML to `<spec_dir>/architecture_diff/atlas/` and re-renders only the affected proposed-after HTML pages there. **MUST NOT** hand-edit `architecture_diff/**/*.html` the renderer owns those files.
21
+ - **MUST** obey the semantic rules from `init-project-html/SKILL.md`:
22
+ - Sub-module pages stay self-only express cross-boundary interactions via `edge add` (cross-feature) or intra-feature `edge add`, never as sub-module page prose.
23
+ - Feature pages stay lightweight declare cross-submodule choreography through edges, not through sub-module-internal `dataflow` steps that wander outside the sub-module.
24
+ - **MUST** reconcile new requirements and design deltas through CLI verbs:
25
+ - Add a sub-module `submodule add --spec ...`. Removing `submodule remove --spec ...` (the CLI lists the removed page in `_removed.txt` automatically).
26
+ - Rename a sub-module `submodule remove` then `submodule add` with the new slug; the CLI emits both the removal entry and the new HTML page so `apltk architecture diff` classifies it as remove + add.
27
+ - Function / variable / dataflow / error deltas corresponding `add` or `remove` verbs scoped to the sub-module.
28
+ - Edge changes `edge add` or `edge remove` (use the stable `--id` when available to make the remove unambiguous).
29
+ - **MUST NOT** drop modules that are still present in code just because the spec omits them — keep them, or rewrite their role/purpose strings to flag "out of spec scope".
30
+ - **MUST** scope reads to the **affected feature modules** identified from the spec/design diff (plus any feature owning a cross-feature edge into an affected one). Apply the same context-safe read strategy as `init-project-html` Rule 3 **subagents own intra-feature overlay changes; the main agent owns cross-feature seams**:
31
+ - **With subagents (preferred)** main agent lists affected features first, then dispatches **one write-capable subagent per affected feature**. Each subagent deep-reads its feature and applies every intra-feature overlay mutation itself via `apltk architecture ... --spec <spec_dir> --feature <slug>` (add/remove sub-modules, function / variable / dataflow / error deltas, intra-feature edges — including error / rollback edges and ordered dataflow steps that capture variable state transitions). It returns ONLY a structured change summary of outbound boundaries (cross-feature edges added / changed / removed, with direction and proposed labels) plus its sub-module change list. The main agent never re-reads the feature source; it batches **only cross-feature** `edge add|remove` verbs from the aggregated summaries, then runs `apltk architecture render --spec ...` and `apltk architecture validate --spec ...`.
32
+ - **Without subagents** process features one at a time: read one affected feature, **immediately** drive the CLI verbs for that feature (with `--spec ...`). Drop function-level details from memory before reading the next feature.
33
+ - **Forbidden**: loading every affected feature's source into the main agent's context before declaring early details get pushed out and overlay declarations contradict each other.
34
+ - **MUST** run `apltk architecture validate --spec <spec_dir>` after the final mutation. Resolve every reported error before reporting completion.
37
35
 
38
36
  ## Standards (summary)
39
37
 
40
- - **Evidence**: cite the spec passage (design subsystem entry) alongside the code path.
41
- - **Execution**: locate the plan set → read the existing HTML tree → list affected feature modules → branch by environment (subagent fan-out OR sequential read-patch-write; resolve macro pending edges last)link check.
42
- - **Quality**: the macro SVG keeps "≥2 edges on one node pair", "at least one producer/consumer loop", and "at least one cross-feature data-row" (when the spec still requires it); sub-module pages stay self-only; CSS paths correct; no pending edges left.
43
- - **Output**: touches only `resources/project-architecture/**`. If files are missing, scaffold via `init-project-html` first, then merge spec deltas.
38
+ - **Evidence**: cite the spec passage (design subsystem entry) alongside the code path; record the citation in `meta.summary` or in sub-module purposes when relevant.
39
+ - **Execution**: locate the plan set → list affected feature modules → branch by environment (subagent fan-out OR sequential read-declare) `apltk architecture validate --spec ...` handover.
40
+ - **Quality**: macro overlay still shows every cross-feature data-row the spec requires; sub-module declarations stay self-only; `apltk architecture diff` opens cleanly with no orphan pages; no dangling edges.
41
+ - **Output**: touches only `<spec_dir>/architecture_diff/atlas/**` (overlay state) and `<spec_dir>/architecture_diff/**/*.html` (renderer output). Base `resources/project-architecture/` is **NEVER** mutated.
42
+
43
+ ## Acceptance criteria (mirrors `init-project-html`)
44
+
45
+ Open the proposed-after viewer (`apltk architecture diff`) and verify both criteria on the overlay pages before reporting completion:
46
+
47
+ 1. **The macro overlay clearly shows the proposed-after feature × sub-module relationships**, including data flow (`--kind data-row`), interaction logic (`--kind call` + `--kind return`), error handling and rollback (`--kind failure`). Any new / changed / removed cross-boundary path the spec implies MUST exist as an edge mutation in the overlay — not as sub-module prose.
48
+ 2. **Each touched sub-module's internal overlay diagram clearly shows the function-level interactions inside it**, including function-to-function flow (`dataflow add --fn <declared-fn>`), variable state transitions (`--reads` / `--writes` referencing declared variables), and the resulting local data flow. If the spec introduces a new function or variable that participates in the flow, declare it via `function add` / `variable add` first, then reference it from the new `dataflow` step so `validate --spec` passes.
44
49
 
45
50
  ## Workflow
46
51
 
@@ -50,67 +55,69 @@ User-pointed path wins; otherwise use the batch `coordination.md` or `recover-mi
50
55
 
51
56
  ### 2) List the affected feature modules (no function bodies yet)
52
57
 
53
- Derive from the spec/design diff which feature modules change: new nodes, edge changes, variable changes, error changes, retired sub-modules… **Also** include any feature that owns the other end of a cross-feature edge that is being changed (even if that feature's own spec is untouched). Record only `slug + change-kind`; do not enter function bodies yet.
54
-
55
- ### 3) Read the current HTML atlas (scoped to affected features)
58
+ Derive from the spec/design diff which feature modules change: new sub-modules, edge changes, variable changes, error changes, retired sub-modules… **Also** include any feature owning the other end of a cross-feature edge that is being changed (even if that feature's own spec is untouched). Record only `slug + change-kind`; do not enter function bodies yet.
56
59
 
57
- Load the macro `index.html` + every affected feature directory + that directory's sub-module pages; list existing node/edge IDs; lock the IDs to preserve (so steps 4/5 do not silently rename).
60
+ ### 3) Branch the deep-read + declare by environment (mirrors `init-project-html` Rule 3)
58
61
 
59
- ### 4) Branch the deep-read + patch by environment (mirrors `init-project-html` Rule 3)
62
+ #### 3A) With subagents (preferred) workers patch their feature; main agent patches only cross-feature edges
60
63
 
61
- #### 4A) With subagents (preferred)
64
+ Dispatch one **write-capable subagent per affected feature**, plus the main agent for the macro seams. Each subagent owns every intra-feature overlay write and reports outbound boundaries upward:
62
65
 
63
- Dispatch one **read-only subagent per affected feature**, requiring this summary:
66
+ > **Feature `<slug>` subagent contract (overlay)**
67
+ > - Read this feature's affected sub-modules and the cited spec passages / requirement IDs.
68
+ > - Apply every intra-feature overlay mutation via `apltk architecture ... --spec <spec_dir>`:
69
+ > - `submodule add|set|remove` for added / renamed / retired / kind-or-role-changed sub-modules.
70
+ > - `function add|remove`, `variable add|remove`, `dataflow add|remove|reorder`, `error add|remove` for per-sub-module deltas. Order `dataflow` steps so the **variable state transitions** through the new path are visible end-to-end.
71
+ > - Intra-feature `edge add|remove` for every changed function-call / return / data-row / failure / rollback edge between the feature's own sub-modules.
72
+ > - Run `apltk architecture validate --spec <spec_dir>` (scoped check) before returning.
73
+ > - **Return ONLY**: (i) the sub-module change list (slug + change-kind + new kind/role when relevant), (ii) outbound boundary changes (cross-feature edges added / changed / removed, with the other-end `feature/sub` and the suggested `--kind` / `--label`), (iii) any `planned` / `gap` flags so the main agent can mirror them in `meta.summary` if needed.
64
74
 
65
- > **Feature `<slug>` change summary**
66
- > - Matching spec passages / requirement IDs.
67
- > - Affected sub-modules (added / renamed / retired / I/O changed).
68
- > - Per sub-module: function I/O, variables-with-business-purpose (additions / removals / renames), internal flow, errors raised.
69
- > - Boundary changes: new / changed / removed call edges and data-row edges (name the other-end feature / sub-module).
70
- > - Spec items the code does not yet scaffold: mark as `planned` / `gap`.
75
+ Main agent — after every subagent returns — declares **only** the cross-feature seams and renders once:
71
76
 
72
- Main agent collects summaries and patches in one pass:
77
+ ```bash
78
+ # one verb per cross-feature edge reported by the subagents
79
+ apltk architecture edge add --spec <spec_dir> --from <featA>/<subA> --to <featB>/<subB> --kind call|return|data-row|failure --label "..." --no-render
80
+ apltk architecture edge remove --spec <spec_dir> --id <stable_id> --no-render
81
+ apltk architecture render --spec <spec_dir>
82
+ apltk architecture validate --spec <spec_dir>
83
+ ```
73
84
 
74
- 1. Patch the macro `index.html`: add/change/remove `<a><g class="m-sub">` nodes; add/change/remove `<path class="m-edge ...">`; mirror in `flow-edge-manifest--macro`; preserve multi-edge, call/return pairs, cross-feature data-row.
75
- 2. Patch each affected `features/<slug>/index.html` (still lightweight) and each affected sub-module page (self-only: `sub-io`, `sub-vars`, `sub-dataflow`, `sub-errors` all in sync).
76
- 3. Update `<nav class="atlas-submodule-index">`: link new pages; remove retired pages.
85
+ - **Pause →** Do every `planned` / `gap` declaration appear consistently across affected sub-modules (e.g. role text + variable purpose strings)? Inconsistency would mislead reviewers.
86
+ - The main agent **MUST NOT** re-declare a subagent's intra-feature components, and **MUST NOT** open source files for any feature it delegated.
77
87
 
78
- - **Pause →** Do `planned` / `gap` nodes appear consistently in both the macro and `atlas-summary` as "not yet implemented"? Inconsistency would mislead readers.
88
+ #### 3B) Without subagents feature-by-feature read-declare loop
79
89
 
80
- #### 4B) Without subagents feature-by-feature read-patch-write
90
+ Process the step-2 list one feature at a time. Per feature:
81
91
 
82
- Process the step-2 list one feature at a time. Per feature, run the full inner loop:
83
-
84
- 1. **Deep-read** this feature's affected sub-modules (functions, variables, boundaries).
85
- 2. **Patch immediately**:
86
- - `features/<slug>/index.html` (refresh user story; add/remove rows in `submodule-nav`; do NOT re-introduce a cross-submodule flowchart).
87
- - Each affected sub-module page:
88
- - Function I/O table updated (additions / renames / signature changes).
89
- - `sub-vars`: add, remove, or rename variables (including DB columns, config knobs, counters, time anchors) introduced by the spec/design; rewrite the business-purpose column to match the new branches.
90
- - `sub-dataflow` steps + small SVG refreshed.
91
- - `sub-errors` updated with any new error types.
92
- - Any leftover "who I talk to" text → move into a macro edge, or delete.
93
- 3. **Incremental macro patch**: sync this feature's nodes/edges/manifest rows; mark edges pointing at **unread** affected features as `data-edge-target-pending="<future-slug>"`.
94
- 4. **Drop function-level memory** of this feature; keep only cluster id and pending-edge notes.
95
- 5. Return to step 1 for the next feature.
92
+ 1. **Deep-read** this feature's affected sub-modules.
93
+ 2. **Run CLI verbs immediately** with `--spec ...`: `submodule add|set|remove`, `function add|remove`, `variable add|remove`, `dataflow add|remove|reorder`, `error add|remove`, intra-feature `edge add|remove`.
94
+ 3. **Cross-feature edges**: if the target feature has not been overlaid yet, add the edge anyway — the CLI accepts edges into features that exist in the base atlas without re-declaring them in the overlay.
95
+ 4. **Drop function-level memory** of this feature; keep only cluster id + edge notes.
96
+ 5. Move to the next feature.
96
97
 
97
98
  Final pass after every feature is patched:
98
99
 
99
- - Resolve every macro `pending` edge; none may remain.
100
- - Verify `<nav class="atlas-submodule-index">` matches the final set of sub-module pages.
100
+ - `apltk architecture render --spec <spec_dir>` (if you used `--no-render`).
101
+ - `apltk architecture validate --spec <spec_dir>`.
101
102
 
102
- - **Pause →** Pending edges left? Step 2 missed an affected feature re-read and patch.
103
+ - **Pause →** Did `apltk architecture diff` pair every changed page correctly? If a page shows up as add + remove instead of modified, you renamed a slug somewhere. Re-check.
103
104
 
104
- ### 5) Traceability (suggested)
105
+ ### 4) Traceability (suggested)
105
106
 
106
- Use `feature-trace` to map spec IDs to implementation status: `met` / `partial` / `planned` / `gap`.
107
+ Use `feature-trace` (or in `meta.summary` for spec-only changes) to map spec IDs to implementation status: `met` / `partial` / `planned` / `gap`.
107
108
 
108
- ### 6) Report
109
+ ### 5) Report
109
110
 
110
- List touched files, new edges / nodes, the read strategy used (4A or 4B), unresolved spec-vs-code gaps, and any follow-ups.
111
+ List touched verbs (or the generated YAML files), the resulting diff counts (modified / added / removed) from `apltk architecture diff`, the read strategy used (3A or 3B), unresolved spec-vs-code gaps, and any follow-ups.
111
112
 
112
113
  ## Sample hints
113
114
 
114
- - **Batch merge**: when one domain has multiple specs, decide first whether sub-modules merge; keep node IDs unique.
115
- - **Spec shrinks scope**: soften or remove nodes, but keep a `figcaption` footnote in the macro explaining the retired requirement.
116
- - **Design-only change**: still re-review macro edges — interaction order shifts even when no module is added.
115
+ - **Batch merge**: when one domain has multiple specs, each member's `--spec <member_dir>` writes its own overlay; `apltk architecture diff` shows them as separate sections in the paginated viewer.
116
+ - **Spec shrinks scope**: prefer `submodule set --role "deprecated: ..."` so reviewers see the planned retirement before issuing `submodule remove`.
117
+ - **Design-only change**: still review edges — interaction order shifts even when no sub-module is added; verify with `apltk architecture validate` to surface dangling references.
118
+
119
+ ## References
120
+
121
+ - `init-project-html/SKILL.md` — authoritative verb-by-verb rulebook.
122
+ - `init-project-html/references/TEMPLATE_SPEC.md` — component schema cheat sheet (also linked from this skill's `references/TEMPLATE_SPEC.md`).
123
+ - `apltk architecture --help` — live CLI reference.
@@ -1,12 +1,18 @@
1
1
  interface:
2
2
  display_name: "spec-to-project-html"
3
- short_description: "Sync HTML architecture pages with active planning specs"
3
+ short_description: "Sync the project HTML architecture atlas with active planning specs via `apltk architecture --spec`"
4
4
  default_prompt: >-
5
- Use $spec-to-project-html to read docs/plans (spec.md → design.md → contract.md), diff against `resources/project-architecture/` produced by $init-project-html, and patch HTML per `init-project-html/SKILL.md` Rules 1–7 (the authoritative rulebook). Local vocabulary + class-hook + DOM cheat sheet lives in this skill's own `references/TEMPLATE_SPEC.md`. Preserve the two-layer rule throughout.
6
- The macro `index.html` stays ONE SVG with feature-module clusters AND every sub-module node drawn together, including many-to-many edges, producer/consumer loops, and cross-feature `m-edge--cross` data-row edges; the macro `flow-edge-manifest--macro` mirrors every SVG edge.
7
- Read strategy (mirrors $init-project-html Rule 3 to avoid context loss). STEP 1: list AFFECTED feature modules from the spec/design diff, plus any feature owning a cross-feature edge into an affected one — without diving into function bodies.
5
+ Use $spec-to-project-html to read `docs/plans` (spec.md → design.md → contract.md), translate the spec/design delta into `apltk architecture --spec <spec_dir>` CLI verbs, and let the CLI write the overlay YAML under `<spec_dir>/architecture_diff/atlas/` plus the affected proposed-after HTML under `<spec_dir>/architecture_diff/`. The macro SVG and every sub-module's internal-dataflow diagram in the overlay output stay zoomable, just like the base atlas. NEVER hand-edit files under `architecture_diff/**` the renderer (owned by $init-project-html) is the only writer. The base atlas under `resources/project-architecture/` is read-only in spec mode.
6
+ Read strategy (mirrors $init-project-html Rule 3 to avoid context loss AND to enforce a hard responsibility split). STEP 1: list AFFECTED feature modules from the spec/design diff (plus any feature owning a cross-feature edge into an affected one) without diving into function bodies.
8
7
  STEP 2: branch by environment.
9
- (4A, preferred) with subagents, dispatch ONE read-only subagent per affected feature; each returns a structured CHANGE summary (added/renamed/retired sub-modules, function I/O deltas, variables-with-business-purpose deltas, error deltas, outbound edge changes, `planned` / `gap` markers). The main agent collects every summary first, then patches the macro and pages in one pass.
10
- (4B, no subagents) handle affected features ONE AT A TIME — deep-read feature A, IMMEDIATELY patch `features/A/index.html` + affected sub-module pages, incrementally patch the macro for A's cluster / nodes / edges (mark edges pointing at unread affected features with `data-edge-target-pending="<future-slug>"`), drop A's function-level details from memory, then move on. After every affected feature is patched, resolve every pending placeholder in a final macro pass. NEVER load every affected feature's source into the main agent context at once.
11
- Each `features/<slug>/<sub-module>.html` stays self-only: update `sub-io` function table + `sub-vars` variables-with-business-purpose table (sync every renamed / added / removed parameter, local state, struct field, DB column, config knob, counter, or time anchor that influences a business branch, using scope chips `sub-vars__scope--call|tx|persist|instance|loop`) + `sub-dataflow` internal value flow + `sub-errors`. FORBIDDEN on sub-module pages: cross-submodule narrative, `flow-return-row`, or cross-boundary `flow-edge-manifest`.
12
- Feature `index.html` stays lightweight (story + submodule-nav). Migrate legacy `arch-diagram` or feature-level cross-submodule flowcharts onto the macro when you touch them; keep CSS paths (`assets/` for root, `../../assets/` under features); scaffold via $init-project-html if files are missing. Report which read strategy (4A or 4B) was actually used.
8
+ (3A, preferred) with subagents, dispatch ONE write-capable subagent per affected feature. Each subagent deep-reads its own feature and applies every intra-feature overlay mutation itself via `apltk architecture ... --spec <spec_dir> --feature <slug>`: `submodule add|set|remove`, `function add|remove`, `variable add|remove`, `dataflow add|remove|reorder` (order the steps so the variable state transitions through the new path are visible end-to-end), `error add|remove`, and EVERY intra-feature `edge add|remove` (including failure / rollback edges between the feature's own sub-modules). The subagent returns ONLY a structured CHANGE summary of (i) sub-module changes (slug + change-kind + new kind/role when relevant), (ii) outbound boundary changes (cross-feature edges added / changed / removed with the other-end `feature/sub` and suggested `--kind` / `--label`), and (iii) any `planned` / `gap` flags. The main agent never re-reads source for a delegated feature and never re-declares its intra-feature components — it batches ONLY cross-feature `edge add|remove` from the aggregated summaries, then runs a single `apltk architecture render --spec <spec_dir>` and `apltk architecture validate --spec <spec_dir>`.
9
+ (3B, no subagents) handle affected features ONE AT A TIME — deep-read feature A, IMMEDIATELY drive the CLI verbs for A with `--spec ...`, drop A's function-level details from memory before moving on.
10
+ CLI verbs (always pass `--spec <spec_dir>`; kebab-case slugs):
11
+ `submodule add|set|remove --feature X --slug Y --kind ui|api|service|db|pure-fn|queue|external --role "..."`,
12
+ `function add|remove --feature X --submodule Y --name fn --in "..." --out "..." --side pure|io|write|tx|lock|network --purpose "..."`,
13
+ `variable add|remove --feature X --submodule Y --name v --type T --scope call|tx|persist|instance|loop --purpose "..."`,
14
+ `dataflow add|remove|reorder --feature X --submodule Y --step "..." [--fn <declared-fn>] [--reads "v1,v2"] [--writes "v3,v4"] [--at N]` (or `--from i --to j` for reorder; every `--fn` / `--reads` / `--writes` value MUST reference a function/variable declared in the merged state for the same sub-module or `validate --spec` fails),
15
+ `error add|remove --feature X --submodule Y --name ErrCode --when "..." --means "..."`,
16
+ `edge add|remove --from <feature>[/sub] --to <feature>[/sub] --kind call|return|data-row|failure --label "..." [--id <stable>]`.
17
+ Removals: `submodule remove` / `feature remove` writes `_removed.yaml`; the renderer emits `_removed.txt` and `apltk architecture diff` classifies the missing pages as `removed`. Rename = remove old slug + add new slug. After the final mutation run `apltk architecture validate --spec <spec_dir>` (must return OK) and `apltk architecture diff` to verify pairing.
18
+ Each sub-module page stays self-only — express any cross-boundary interaction as an edge via `edge add`, NEVER as sub-module page prose. For `planned` / `gap` items the spec mandates but code does not yet implement, surface the marker in the relevant field (e.g. `--role "planned: TOTP service"`, `--purpose "gap: not wired"`). Anchor every declaration to a concrete spec passage + code path. Report the read strategy used (3A or 3B), the resulting diff counts (`modified` / `added` / `removed`), and any unresolved spec-vs-code gaps.
@@ -1,98 +1,113 @@
1
- # HTML architecture atlas — reference cheat sheet (spec-to-project-html copy)
1
+ # Atlas component schema — reference cheat sheet (spec-to-project-html copy)
2
2
 
3
- > Reference material only. The **binding rules** (page contracts, naming, assets, accessibility, forbidden shortcuts) live in `init-project-html/SKILL.md` (the atlas authority). `spec-to-project-html/SKILL.md` follows those same Rules 1–7 when patching pages to match active specs. This file is a local glossary + class-hook table + DOM snippets so this skill can stay self-contained when installed alone.
3
+ > Reference material only. The binding rules (read strategy, evidence requirements, what each verb means) live in `init-project-html/SKILL.md` (atlas authority) and this skill's `SKILL.md` (spec-overlay variant). This file lists the exact fields and enum values that `apltk architecture --spec <spec_dir>` accepts; the renderer produces consistent DOM/CSS/ARIA hooks under `<spec_dir>/architecture_diff/` so agents never need to touch HTML.
4
4
 
5
- ## Vocabulary
5
+ ## State files on disk
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
+ Base atlas (read-only from this skill's perspective):
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
+ <project>/resources/project-architecture/atlas/
11
+ ├── atlas.index.yaml
12
+ ├── features/<slug>.yaml
13
+ ├── atlas.history.log
14
+ └── atlas.history.undo.json
55
15
  ```
56
16
 
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>
17
+ Overlay (where this skill writes via `--spec`):
18
+
77
19
  ```
20
+ <spec_dir>/architecture_diff/
21
+ ├── atlas/
22
+ │ ├── atlas.index.yaml # optional partial override (meta / actors / cross-feature edges / feature order)
23
+ │ ├── features/<slug>.yaml # full proposed state of any changed feature
24
+ │ ├── _removed.yaml # {features: [...], submodules: [{feature, submodule}]}
25
+ │ ├── atlas.history.log
26
+ │ └── atlas.history.undo.json
27
+ ├── index.html # rendered (re-emit only when macro visibly changes)
28
+ ├── features/<slug>/index.html # rendered (re-emit when the feature page would visibly change)
29
+ ├── features/<slug>/<sub>.html # rendered (re-emit when the sub-module's tables/dataflow change)
30
+ ├── _removed.txt # auto-written by the renderer; lists removed HTML paths
31
+ └── assets/ # architecture.css + viewer.client.js (copied by the renderer)
32
+ ```
33
+
34
+ ## Components (mirrors `init-project-html/references/TEMPLATE_SPEC.md`)
35
+
36
+ ### `meta`
37
+
38
+ | Field | Type | Required | Notes |
39
+ | ------- | ------ | -------- | ----- |
40
+ | title | string | yes | Macro page H1; the spec overlay typically keeps the base title. |
41
+ | summary | string | no | Update if the spec changes scanned roots or known omissions. |
42
+
43
+ CLI: `apltk architecture meta set --spec <spec_dir> --title "..." --summary "..."`
44
+
45
+ ### `actor`
46
+
47
+ | Field | Type | Required | Notes |
48
+ | ----- | ---- | -------- | ----- |
49
+ | id | kebab-case | yes | Stable identity. |
50
+ | label | string | yes | Display name. |
51
+
52
+ CLI: `apltk architecture actor add --spec <spec_dir> --id ... --label "..."`
53
+
54
+ ### `feature`
78
55
 
79
- Scope chip vocabulary: `sub-vars__scope--call` (single call), `--tx` (transaction-bound), `--persist` (persisted), `--instance` (fixed at construction; lifetime-shared), `--loop` (retry/loop).
56
+ Same shape as base mode (`slug`, `title`, `story`, `dependsOn`, `submodules`, `edges`). `submodule add|remove`, `function add|remove`, etc. mutate the feature's full overlay snapshot under the hood — declare what you would have declared in base mode, but pass `--spec <spec_dir>`.
80
57
 
81
- ### `sub-dataflow` small SVG sizing
58
+ CLI: `apltk architecture feature add --spec <spec_dir> --slug <kebab> --title "..." --story "..."`
82
59
 
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.
60
+ ### `submodule`
86
61
 
87
- ## Edge-kind vocabulary (for macro `flow-edge-manifest`)
62
+ | Field | Type | Required | Notes |
63
+ | ----- | ---- | -------- | ----- |
64
+ | slug | kebab-case | yes | The HTML filename. |
65
+ | kind | enum `ui` `api` `service` `db` `pure-fn` `queue` `external` | yes | Drives node colour + chip. |
66
+ | role | string | no | Own responsibility in one sentence. Use `planned: ...` or `gap: ...` to mark spec items the code does not yet implement. |
67
+ | functions / variables / dataflow / errors | arrays | no | Edited through their own CLI verbs. |
88
68
 
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 |
69
+ CLI: `apltk architecture submodule add|set|remove --spec <spec_dir> --feature X --slug Y --kind ... --role "..."`
95
70
 
96
- ## Typography hint
71
+ ### `function`, `variable`, `dataflow`, `error`
72
+
73
+ Each row uses the same fields documented in `init-project-html/references/TEMPLATE_SPEC.md`. Always pass `--spec <spec_dir>` so the write lands in the overlay.
74
+
75
+ `dataflow` steps accept the same structured fields in overlay mode — `--fn` must reference a function declared in this overlay (or inherited from base) for the same sub-module; `--reads` / `--writes` must reference variables declared there. `validate --spec <spec_dir>` enforces these references against the **merged** state, so adding a step that names a function/variable the spec also introduces is fine as long as both land in the same overlay.
76
+
77
+ ### `edge`
78
+
79
+ | Field | Type | Required | Notes |
80
+ | ----- | ---- | -------- | ----- |
81
+ | id | kebab-case | recommended | Pass `--id <stable>` when adding or removing so the CLI matches unambiguously. |
82
+ | from | `feature/submodule` or (intra-feature) `submodule` | yes | |
83
+ | to | same shape | yes | |
84
+ | kind | enum `call` `return` `data-row` `failure` | yes | |
85
+ | label | string | no | |
86
+
87
+ CLI: `apltk architecture edge add|remove --spec <spec_dir> --from <feature>[/sub] --to <feature>[/sub] --kind ... --label "..."`
88
+
89
+ ## Diff classification (how `apltk architecture diff` pairs pages)
90
+
91
+ `apltk architecture diff` scans every `docs/plans/**/architecture_diff/**/*.html` (skipping `assets/` and `atlas/`) and pairs by path against `resources/project-architecture/`:
92
+
93
+ | Base exists? | Overlay HTML exists? | Listed in `_removed.txt`? | Classification |
94
+ | ------------ | -------------------- | ------------------------- | -------------- |
95
+ | yes | yes | no | **modified** (split before/after view) |
96
+ | no | yes | no | **added** (single after view) |
97
+ | yes | no | yes | **removed** (single before view) |
98
+
99
+ The renderer writes `_removed.txt` automatically from `_removed.yaml`; agents only set the YAML through `feature remove` / `submodule remove`.
100
+
101
+ ## Quick example: add a 2FA sub-module to an existing feature
102
+
103
+ ```bash
104
+ apltk architecture --spec docs/plans/2026-05-11/add-2fa \
105
+ submodule add --feature register --slug 2fa --kind service \
106
+ --role "TOTP verification (planned: not yet implemented)"
107
+ apltk architecture --spec docs/plans/2026-05-11/add-2fa \
108
+ edge add --from register/api --to register/2fa --kind call --label "verify TOTP" --id e-api-2fa
109
+ apltk architecture --spec docs/plans/2026-05-11/add-2fa validate
110
+ apltk architecture diff
111
+ ```
97
112
 
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.
113
+ The CLI writes only the affected HTML pages (`features/register/2fa.html` plus any page whose visible state changed) into `architecture_diff/`, and the diff viewer pairs them with the base atlas.