Skip to content

Commit 422cfa1

Browse files
committed
Plan Stage 5 web-channel source grouping
1 parent 3b89c1c commit 422cfa1

7 files changed

+505
-1
lines changed

docs/broad-filesystem-reorg-map-2026-03-28.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,15 @@ Avoid indefinite dual-path support.
359359
- kept `.pi/extensions/`, `.pi/skills/`, and `.pi/agent/extensions/` stable as compatibility-sensitive convention paths
360360
- updated loader, build, vendor, docs, and test references to the grouped packaged-runtime layout
361361

362+
### Stage 5 preparation update — 2026-03-28
363+
364+
- refreshed the current `runtime/src/channels/web/` flat-root count to 73 files, so the older 56-file snapshot is no longer the planning baseline
365+
- captured the current grouping inventory in `docs/stage5-web-channel-grouping-inventory-2026-03-28.md`
366+
- prepared the execution order in `docs/stage5-web-channel-grouping-steplist-2026-03-28.md`
367+
- prepared an execution brief in `docs/stage5-web-channel-grouping-autoresearch-prompt-2026-03-28.md`
368+
- opened `workitems/20-doing/execute-stage5-web-channel-grouping.md` as the active next batch
369+
- current recommendation is to group the clearest semantic clusters first (`auth`, `sse`, `cards`, `media`, `theming`, `messaging`) rather than forcing the entire flat root into one move sweep
370+
362371
## First-batch recommendation
363372

364373
If we start executing immediately, the best first batch is:
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# Autoresearch prompt — Stage 5 web-channel source-tree grouping cleanup
2+
3+
Use this as the execution brief for an autoresearch run working Stage 5 of the
4+
broad filesystem reorg.
5+
6+
## Prompt
7+
8+
Work the Stage 5 web-channel grouping batch from:
9+
10+
- `workitems/20-doing/execute-stage5-web-channel-grouping.md`
11+
- `workitems/10-next/group-web-channel-flat-files.md`
12+
- `docs/stage5-web-channel-grouping-inventory-2026-03-28.md`
13+
- `docs/stage5-web-channel-grouping-steplist-2026-03-28.md`
14+
- `docs/broad-filesystem-reorg-map-2026-03-28.md`
15+
16+
Your objective is to land a reviewable Stage 5 cleanup that:
17+
18+
1. materially reduces the flat root under `runtime/src/channels/web/`
19+
2. moves the clearest semantic clusters first (`auth`, `sse`, `cards`, `media`, `theming`, `messaging`)
20+
3. keeps already-grouped subtrees (`http`, `handlers`, `workspace`, `terminal`, `vnc`, `remote-display`) structurally intact unless a specific move is necessary
21+
4. updates imports, tests, and docs consistently
22+
5. avoids behavior refactors beyond what path rewrites strictly require
23+
24+
## Scope guardrails
25+
26+
In scope:
27+
28+
- file moves under `runtime/src/channels/web/`
29+
- import rewrites caused by those moves
30+
- matching test-path updates
31+
- docs/workitem path updates where needed
32+
33+
Out of scope:
34+
35+
- broad WebChannel behavior refactors
36+
- `runtime/generated/` work
37+
- extension/skill namespacing work
38+
- board/workitems path work
39+
- opportunistic logic rewrites inside moved services
40+
41+
## Constraints
42+
43+
- use `/workspace/piclaw` as the canonical repo
44+
- work from a clean branch based on `origin/main`
45+
- prefer the obvious grouping tranche first
46+
- stop and report if the remaining flat files require a second batch rather than forcing the whole root into one pass
47+
48+
## Required validation order
49+
50+
1. search for stale old web-channel paths/imports
51+
2. run directly affected focused tests
52+
3. run `bun run lint`
53+
4. run `bun run typecheck`
54+
5. run any import-boundary checks affected by the move
55+
56+
## Expected outputs
57+
58+
- obvious `web/` capability slices get dedicated subdirectories
59+
- imports/tests/docs are updated consistently
60+
- the flat root is materially smaller
61+
- Stage 5 ticket records what moved and what intentionally remained
62+
63+
## Stop conditions
64+
65+
Stop and report rather than widening scope if:
66+
67+
- grouping starts to require behavior refactors rather than path rewrites
68+
- the remaining root files are too ambiguous for the same batch
69+
- validation failures indicate the work should be split into smaller child tranches
Lines changed: 171 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,171 @@
1+
# Stage 5 web-channel grouping inventory — 2026-03-28
2+
3+
## Purpose
4+
5+
Capture the current `runtime/src/channels/web/` surface so Stage 5 of the broad
6+
filesystem reorg can work from current counts instead of the older 56-file
7+
snapshot.
8+
9+
## Current structure
10+
11+
Measured on 2026-03-28:
12+
13+
- `runtime/src/channels/web/`**73 flat files**
14+
- `runtime/src/channels/web/http/`**21 files**
15+
- `runtime/src/channels/web/handlers/`**5 files**
16+
- `runtime/src/channels/web/workspace/`**9 files**
17+
- `runtime/src/channels/web/terminal/`**1 file**
18+
- `runtime/src/channels/web/vnc/`**1 file**
19+
- `runtime/src/channels/web/remote-display/`**1 file**
20+
21+
This means the existing `group-web-channel-flat-files` ticket is still valid,
22+
but its older 56-file number is stale.
23+
24+
## Stable existing grouped areas
25+
26+
Already-grouped subtrees that should remain conceptually separate from the flat
27+
root cleanup:
28+
29+
- `http/`
30+
- `handlers/`
31+
- `workspace/`
32+
- `terminal/`
33+
- `vnc/`
34+
- `remote-display/`
35+
36+
Stage 5 is primarily about shrinking the remaining flat root surface.
37+
38+
## Candidate grouping clusters from the flat root
39+
40+
### 1. `auth/`
41+
42+
Likely auth-focused files:
43+
44+
- `auth-endpoints.ts`
45+
- `auth-gateway.ts`
46+
- `auth-runtime.ts`
47+
- `auth.ts`
48+
- `login-command.ts`
49+
- `totp-auth.ts`
50+
- `webauthn-auth.ts`
51+
- `webauthn-enrol-page.ts`
52+
53+
Why this cluster is attractive:
54+
55+
- semantically cohesive
56+
- path intent is obvious
57+
- mostly pure import-rewrite risk
58+
59+
### 2. `sse/`
60+
61+
Likely SSE/event-stream files:
62+
63+
- `sse.ts`
64+
- `sse-hub.ts`
65+
- `agent-events.ts`
66+
- `session-broadcast-service.ts`
67+
68+
Why this cluster is attractive:
69+
70+
- clear event-stream boundary
71+
- low ambiguity relative to other root files
72+
73+
### 3. `cards/`
74+
75+
Likely adaptive-card / interaction files:
76+
77+
- `adaptive-card-actions.ts`
78+
- `adaptive-card-side-prompt-service.ts`
79+
- `interaction-service.ts`
80+
81+
Why this cluster is attractive:
82+
83+
- already reads like a focused capability slice
84+
- aligns with the broad reorg map’s earlier `cards/` direction
85+
86+
### 4. `media/`
87+
88+
Likely media/preview files:
89+
90+
- `avatar-service.ts`
91+
- `link-previews.ts`
92+
- `media-service.ts`
93+
94+
Why this cluster is attractive:
95+
96+
- focused capability surface
97+
- low naming ambiguity
98+
99+
### 5. `theming/`
100+
101+
Likely theme/UI bridge files:
102+
103+
- `ui-bridge.ts`
104+
- `ui-theme-commands.ts`
105+
- `ui-theme-data.ts`
106+
107+
Why this cluster is attractive:
108+
109+
- small, coherent grouping
110+
- clearly not part of auth/messaging/workspace
111+
112+
### 6. `messaging/`
113+
114+
Likely message-flow files:
115+
116+
- `agent-message-entry-service.ts`
117+
- `agent-message-service.ts`
118+
- `agent-message-store.ts`
119+
- `message-store.ts`
120+
- `message-write-flows.ts`
121+
- `message-processing-storage-service.ts`
122+
- `peer-message-service.ts`
123+
124+
Why this cluster is attractive:
125+
126+
- high semantic cohesion
127+
- likely to pay off quickly in navigation clarity
128+
129+
## High-ambiguity remainder after the obvious clusters
130+
131+
After the clusters above, the remaining flat files are more mixed and likely
132+
need a second pass or narrower child batches. These likely include:
133+
134+
- control-plane / session orchestration
135+
- follow-up / queue / special wrapper services
136+
- channel endpoint context helpers
137+
- request routing adjuncts that are not already under `http/`
138+
- runtime lifecycle glue that still belongs at the web root
139+
140+
Stage 5 should assume the obvious clusters can land first without requiring the
141+
entire remainder to move in one shot.
142+
143+
## Recommended Stage 5 posture
144+
145+
### Safe first tranche
146+
147+
Prefer moving these first:
148+
149+
- `auth/`
150+
- `sse/`
151+
- `cards/`
152+
- `media/`
153+
- `theming/`
154+
- `messaging/`
155+
156+
### Deliberate second tranche
157+
158+
Re-evaluate the remaining root files after the first tranche lands, then decide
159+
whether additional directories are justified.
160+
161+
## Success signal for Stage 5
162+
163+
A good Stage 5 landing should materially reduce the flat root count and leave
164+
`runtime/src/channels/web/` easier to scan, even if the final root count is
165+
reached in more than one commit.
166+
167+
## Related files
168+
169+
- `docs/broad-filesystem-reorg-map-2026-03-28.md`
170+
- `workitems/10-next/group-web-channel-flat-files.md`
171+
- `workitems/20-doing/plan-broad-filesystem-reorg-from-audit.md`

0 commit comments

Comments
 (0)