@laitszkin/apollo-toolkit 3.11.2 → 3.11.3

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.
@@ -69,10 +69,18 @@
69
69
  return { x: state.x + xRatio * state.w, y: state.y + yRatio * state.h };
70
70
  }
71
71
 
72
+ // The diagram viewport owns the wheel gesture entirely: ANY wheel
73
+ // event that lands inside the viewport is consumed so the host page
74
+ // never scrolls underneath the user. The wheel zooms the SVG around
75
+ // the cursor; trackpad pinch-zoom (which arrives as ctrlKey wheel
76
+ // on macOS) is treated the same way for a single predictable model.
72
77
  viewport.addEventListener('wheel', function (evt) {
73
- if (!evt.ctrlKey && !evt.metaKey && Math.abs(evt.deltaY) < 4 && Math.abs(evt.deltaX) < 4) return;
74
78
  evt.preventDefault();
75
- const factor = evt.deltaY > 0 ? 1.1 : 1 / 1.1;
79
+ evt.stopPropagation();
80
+ const absX = Math.abs(evt.deltaX);
81
+ const absY = Math.abs(evt.deltaY);
82
+ if (absX < 0.5 && absY < 0.5) return;
83
+ const factor = evt.deltaY > 0 ? 1.08 : 1 / 1.08;
76
84
  const pt = clientToSvg(evt);
77
85
  zoom(factor, pt.x, pt.y);
78
86
  }, { passive: false });
@@ -55,6 +55,10 @@ function head({ title, assetRel, pageKind }) {
55
55
  ' <meta charset="utf-8">',
56
56
  ` <title>${htmlEscape(title)}</title>`,
57
57
  ' <meta name="viewport" content="width=device-width, initial-scale=1">',
58
+ ' <meta name="color-scheme" content="dark">',
59
+ ' <link rel="preconnect" href="https://fonts.googleapis.com">',
60
+ ' <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>',
61
+ ' <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,300..600;1,9..144,300..500&family=Geist:wght@300..700&family=JetBrains+Mono:wght@400..600&display=swap">',
58
62
  ` <link rel="stylesheet" href="${assetRel}/architecture.css">`,
59
63
  '</head>',
60
64
  ].join('\n');
@@ -88,13 +92,13 @@ function findEdgeMeta(state, edgeId) {
88
92
 
89
93
  function renderMacroSvg(layout, state) {
90
94
  if (layout.empty) {
91
- return '<svg class="atlas-svg" viewBox="0 0 320 160" role="img" aria-label="Atlas is empty"><text x="160" y="80" text-anchor="middle" fill="currentColor">Atlas has no features yet</text></svg>';
95
+ return '<svg class="atlas-svg" viewBox="0 0 320 160" preserveAspectRatio="xMidYMid meet" role="img" aria-label="Atlas is empty"><text x="160" y="80" text-anchor="middle" fill="currentColor">Atlas has no features yet</text></svg>';
92
96
  }
93
97
  const pad = 24;
94
98
  const vbW = Math.max(320, Math.ceil(layout.width + pad * 2));
95
99
  const vbH = Math.max(160, Math.ceil(layout.height + pad * 2));
96
100
  const parts = [];
97
- parts.push(`<svg class="atlas-svg" viewBox="0 0 ${vbW} ${vbH}" role="img" aria-label="Project architecture atlas" data-atlas-svg="macro">`);
101
+ parts.push(`<svg class="atlas-svg" viewBox="0 0 ${vbW} ${vbH}" preserveAspectRatio="xMidYMid meet" role="img" aria-label="Project architecture atlas" data-atlas-svg="macro">`);
98
102
  parts.push(' <defs>');
99
103
  for (const kind of ['call', 'return', 'data-row', 'failure']) {
100
104
  parts.push(` <marker id="arrow-${kind}" class="m-arrow m-arrow--${kind}" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="8" markerHeight="8" orient="auto-start-reverse"><path d="M0,0 L10,5 L0,10 Z" /></marker>`);
@@ -339,7 +343,7 @@ function renderInternalDataflowSvg(steps) {
339
343
  const totalW = padLeft + boxW + padRight;
340
344
 
341
345
  const parts = [];
342
- parts.push(`<svg class="sub-dataflow__svg" data-atlas-svg="sub-dataflow" viewBox="0 0 ${totalW} ${totalH}" role="img" aria-label="Internal dataflow">`);
346
+ parts.push(`<svg class="sub-dataflow__svg" data-atlas-svg="sub-dataflow" viewBox="0 0 ${totalW} ${totalH}" preserveAspectRatio="xMidYMid meet" role="img" aria-label="Internal dataflow">`);
343
347
  parts.push(' <defs>');
344
348
  parts.push(' <marker id="sub-arrow" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="9" markerHeight="9" orient="auto-start-reverse"><path d="M0,0 L10,5 L0,10 Z" /></marker>');
345
349
  parts.push(' </defs>');
@@ -539,9 +543,46 @@ async function renderAll({ outDir, state, scope = null, removedPaths = [] }) {
539
543
  if (fs.existsSync(file)) fs.rmSync(file);
540
544
  }
541
545
 
546
+ // Full base render (no scope): sweep stale HTML so `apltk architecture
547
+ // render` is a true refresh — old feature folders or renamed sub-modules
548
+ // do not linger with the previous (broken) markup or styling.
549
+ if (!scope) {
550
+ sweepOrphanFeaturePages(outDir, state);
551
+ }
552
+
542
553
  return { written, layout };
543
554
  }
544
555
 
556
+ function sweepOrphanFeaturePages(outDir, state) {
557
+ const featuresRoot = path.join(outDir, 'features');
558
+ if (!fs.existsSync(featuresRoot)) return;
559
+ const validFeatures = new Map();
560
+ for (const f of state.features || []) {
561
+ validFeatures.set(f.slug, new Set((f.submodules || []).map((s) => s.slug)));
562
+ }
563
+ let entries;
564
+ try { entries = fs.readdirSync(featuresRoot, { withFileTypes: true }); } catch (_e) { return; }
565
+ for (const entry of entries) {
566
+ if (!entry.isDirectory()) continue;
567
+ const featDir = path.join(featuresRoot, entry.name);
568
+ if (!validFeatures.has(entry.name)) {
569
+ fs.rmSync(featDir, { recursive: true, force: true });
570
+ continue;
571
+ }
572
+ const wantedSubs = validFeatures.get(entry.name);
573
+ let files;
574
+ try { files = fs.readdirSync(featDir); } catch (_e) { continue; }
575
+ for (const file of files) {
576
+ if (!file.toLowerCase().endsWith('.html')) continue;
577
+ if (file === 'index.html') continue;
578
+ const slug = file.slice(0, -5);
579
+ if (!wantedSubs.has(slug)) {
580
+ fs.rmSync(path.join(featDir, file), { force: true });
581
+ }
582
+ }
583
+ }
584
+ }
585
+
545
586
  function scopeFromDiff(diff) {
546
587
  const submodules = [];
547
588
  for (const item of diff.modifiedSubmodules || []) submodules.push(item);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@laitszkin/apollo-toolkit",
3
- "version": "3.11.2",
3
+ "version": "3.11.3",
4
4
  "description": "Apollo Toolkit npm installer for managed skill copying across Codex, OpenClaw, and Trae.",
5
5
  "license": "MIT",
6
6
  "author": "LaiTszKin",
@@ -1,14 +1,14 @@
1
1
  ---
2
2
  name: spec-to-project-html
3
3
  description: >-
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.
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 like the base atlas — so `apltk architecture diff` pairs before/after by path under `docs/plans/**/architecture_diff/`. Preserve the two-layer rule and the responsibility split: **subagents only** each subagent reads ONE affected feature and declares EVERY intra-feature overlay change; the main agent **waits until all subagents finish**, then aggregates outbound summaries and declares **only** cross-feature edges. **Exact CLI spelling:** always `apltk architecture --help`. 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 rulebook for what each component declaration means and which verbs to call. Reuse the same CLI here with `--spec`.
11
+ - Required: **`init-project-html`** — its `SKILL.md` is the semantic rulebook; **`apltk architecture --help`** is the verb/flag source of truth. 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.
@@ -17,26 +17,26 @@ description: >-
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** 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.
20
+ - **MUST** declare every change through the CLI with `--spec <spec_dir>` (exact verbs/flags: **`apltk architecture --help`**). 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
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 declaringearly details get pushed out and overlay declarations contradict each other.
22
+ - Sub-module pages stay self-only — express cross-boundary interactions via **edges** (cross-feature or intra-feature), never as sub-module page prose.
23
+ - Feature pages stay lightweight — cross-sub-module choreography belongs in **edges**, not in `dataflow` prose that pretends to cross features.
24
+ - **MUST** reconcile deltas through the CLI families described in **`--help`**:
25
+ - Structural changes → `feature` / `submodule` (**add** / **set** / **remove** as appropriate).
26
+ - Per-sub-module rows → `function`, `variable`, `dataflow`, `error` (**add** / **remove** / **reorder** for dataflow where supported).
27
+ - Seams `edge` **add** / **remove** (prefer stable **`--id`** when you may remove the same edge later).
28
+ - **`submodule remove`** / **`feature remove`** in spec mode populate removal manifests so `diff` can show **removed** pages; renames are usually **remove old slug + add new slug** so the viewer shows remove + add rather than a silent overwrite.
29
+ - **MUST NOT** drop modules that are still present in code just because the spec omits them — keep them, or rewrite role/purpose to flag out of spec scope”.
30
+ - **MUST** scope reads to the **affected feature modules** from the spec/design diff (plus any feature owning the other end of a cross-feature edge into an affected one). **Subagents own intra-feature overlay writes; the main agent owns cross-feature seams — after all subagents finish:**
31
+ - Dispatch **one write-capable subagent per affected feature**. Each applies every intra-feature overlay mutation via `apltk architecture ... --spec <spec_dir>` (exact flags: **`--help`**). Each returns **ONLY** a structured summary: sub-module change list, outbound boundary changes (cross-feature edges to add/change/remove), and any `planned` / `gap` markers.
32
+ - **MUST** wait until **every** dispatched subagent has completed before running any cross-feature **`edge`** mutation, overlay-wide **`meta`** that stitches multiple features, or shared **`actor`** that exists only for cross-feature context.
33
+ - **Forbidden:** loading every affected features source into the main agent before delegatingthat explodes context and produces contradictory overlays.
34
34
  - **MUST** run `apltk architecture validate --spec <spec_dir>` after the final mutation. Resolve every reported error before reporting completion.
35
35
 
36
36
  ## Standards (summary)
37
37
 
38
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.
39
+ - **Execution**: locate the plan set → list affected feature modules → subagent fan-out **all complete** → cross-feature edges → `render --spec` if batched → `validate --spec` `diff` check → handover.
40
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
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
42
 
@@ -44,8 +44,8 @@ description: >-
44
44
 
45
45
  Open the proposed-after viewer (`apltk architecture diff`) and verify both criteria on the overlay pages before reporting completion:
46
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.
47
+ 1. **The macro overlay clearly shows the proposed-after feature × sub-module relationships**, including data flow (**`data-row`**), interaction logic (**`call`** + **`return`**), error handling and rollback (**`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-modules internal overlay diagram clearly shows the function-level interactions inside it**, including function references and variable reads/writes on `dataflow` steps. Declare `function` / `variable` before referencing them so `validate --spec` passes.
49
49
 
50
50
  ## Workflow
51
51
 
@@ -55,69 +55,49 @@ User-pointed path wins; otherwise use the batch `coordination.md` or `recover-mi
55
55
 
56
56
  ### 2) List the affected feature modules (no function bodies yet)
57
57
 
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.
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 features own spec is untouched). Record only `slug + change-kind`; do not enter function bodies yet.
59
59
 
60
- ### 3) Branch the deep-read + declare by environment (mirrors `init-project-html` Rule 3)
60
+ ### 3) Subagents patch features; orchestrator patches cross-feature seams **after** all workers finish
61
61
 
62
- #### 3A) With subagents (preferred) workers patch their feature; main agent patches only cross-feature edges
63
-
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
+ Dispatch one **write-capable subagent per affected feature**. Each subagent owns every intra-feature overlay write and reports outbound boundaries upward. Use **`apltk architecture --help`** for exact `add|set|remove|reorder` spelling.
65
63
 
66
64
  > **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.
65
+ > - Read this features affected sub-modules and the cited spec passages / requirement IDs.
66
+ > - Apply every intra-feature overlay mutation with `--spec <spec_dir>`: structural (`feature` / `submodule`), rows (`function`, `variable`, `dataflow`, `error`), and intra-feature **`edge`** changes (including failure / rollback between this feature’s own sub-modules). Order `dataflow` so **variable state** reads end-to-end.
67
+ > - Run `apltk architecture validate --spec <spec_dir>` before returning.
68
+ > - **Return ONLY**: (i) sub-module change list, (ii) outbound boundary changes (cross-feature edges add/change/remove with endpoints and suggested kind/label), (iii) any `planned` / `gap` flags for `meta.summary`.
74
69
 
75
- Main agent after every subagent returns declares **only** the cross-feature seams and renders once:
70
+ **After every subagent has completed**, the main agent declares **only** cross-feature seams, then renders and validates:
76
71
 
77
72
  ```bash
78
- # one verb per cross-feature edge reported by the subagents
73
+ # exact flags per edge: see --help
79
74
  apltk architecture edge add --spec <spec_dir> --from <featA>/<subA> --to <featB>/<subB> --kind call|return|data-row|failure --label "..." --no-render
80
75
  apltk architecture edge remove --spec <spec_dir> --id <stable_id> --no-render
81
76
  apltk architecture render --spec <spec_dir>
82
77
  apltk architecture validate --spec <spec_dir>
83
78
  ```
84
79
 
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.
87
-
88
- #### 3B) Without subagents — feature-by-feature read-declare loop
89
-
90
- Process the step-2 list one feature at a time. Per feature:
91
-
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.
97
-
98
- Final pass after every feature is patched:
99
-
100
- - `apltk architecture render --spec <spec_dir>` (if you used `--no-render`).
101
- - `apltk architecture validate --spec <spec_dir>`.
80
+ - **Pause →** Do `planned` / `gap` markers read consistently across affected sub-modules?
81
+ - The main agent **MUST NOT** re-declare a subagents intra-feature components, and **MUST NOT** open source files for any feature it delegated.
102
82
 
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.
83
+ - **Pause →** Does `apltk architecture diff` pair every changed page correctly? If a page shows as add + remove instead of modified, you renamed a slug somewhere — re-check.
104
84
 
105
85
  ### 4) Traceability (suggested)
106
86
 
107
- Use `feature-trace` (or in `meta.summary` for spec-only changes) to map spec IDs to implementation status: `met` / `partial` / `planned` / `gap`.
87
+ Use `feature-trace` (or `meta.summary` for spec-only changes) to map spec IDs to implementation status: `met` / `partial` / `planned` / `gap`.
108
88
 
109
89
  ### 5) Report
110
90
 
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.
91
+ List overlay files touched (or verb families used), the diff counts (`modified` / `added` / `removed`) from `apltk architecture diff`, confirmation that **all subagents finished before cross-feature wiring**, unresolved spec-vs-code gaps, and any follow-ups.
112
92
 
113
93
  ## Sample hints
114
94
 
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.
95
+ - **Batch merge**: each member spec’s `--spec <member_dir>` writes its own overlay; `diff` lists each spec’s section in the paginated viewer.
96
+ - **Spec shrinks scope**: prefer `submodule set --role "deprecated: ..."` before `submodule remove` so reviewers see intent.
97
+ - **Design-only change**: still review edges — order shifts surface as edge mutations; `validate --spec` catches dangling references.
118
98
 
119
99
  ## References
120
100
 
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.
101
+ - `init-project-html/SKILL.md` — semantic contracts and acceptance criteria.
102
+ - `init-project-html/references/TEMPLATE_SPEC.md` — schema cheat sheet (fields/enums), not a command list.
103
+ - **`apltk architecture --help`** — live CLI reference.
@@ -2,17 +2,10 @@ interface:
2
2
  display_name: "spec-to-project-html"
3
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), 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.
7
- STEP 2: branch by environment.
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.
5
+ Use $spec-to-project-html. Read docs/plans (spec → design → contract). Every overlay mutation: `apltk architecture --spec <spec_dir> …`. **Exact commands: `apltk architecture --help`**do not trust long command lists in docs.
6
+ CLI writes `<spec_dir>/architecture_diff/atlas/*.yaml` + affected HTML under `<spec_dir>/architecture_diff/`. Base `resources/project-architecture/` is read-only here. NEVER hand-edit `architecture_diff/**`.
7
+ **`apltk architecture diff`** builds a paginated viewer: scans all `docs/plans/**/architecture_diff/`, pairs overlay paths with base atlas HTML by relative path, labels modified/added/removed — use it to verify the architecture delta before hand-off.
8
+ **Subagents only:** dispatch ONE write-capable subagent per AFFECTED feature; each applies ALL intra-feature overlay mutations (`submodule`/`function`/`variable`/`dataflow`/`error`/`edge` within that feature). Each returns ONLY change summary + outbound boundary deltas for OTHER features.
9
+ **HARD GATE:** main agent MUST wait until ALL subagents finish before ANY cross-feature `edge add|remove`, overlay `meta` that stitches multiple features, or shared `actor` for cross-feature context. Then `render --spec`, `validate --spec`.
10
+ Sub-module pages stay self-only — cross-boundary = `edge`. For removals/renames in overlay, follow SKILL.md (`submodule remove` / remove+add pattern) so `diff` classifies correctly.
11
+ After work: `validate --spec` MUST be OK; run `diff` and report modified/added/removed counts. Semantic rules: $init-project-html SKILL.md.