@yunhozz/arc 0.2.2 → 0.2.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.
- package/MANIFEST.sha256 +52 -27
- package/README.md +4 -6
- package/claude/agents/arc-implementer.md +1 -1
- package/claude/agents/arc-planner.md +1 -1
- package/claude/skill/SKILL.md +1 -1
- package/claude/skill/references/arc-visual-companion.md +33 -0
- package/claude/skill/references/coordination.md +3 -3
- package/claude/skill/references/planning.md +3 -3
- package/claude/skill/references/verification.md +1 -1
- package/claude/skill/references/visual-companion.md +293 -15
- package/codex/agents/arc-implementer.toml +1 -1
- package/codex/agents/arc-planner.toml +2 -2
- package/codex/skill/SKILL.md +1 -1
- package/codex/skill/references/arc-visual-companion.md +39 -0
- package/codex/skill/references/coordination.md +2 -2
- package/codex/skill/references/planning.md +3 -3
- package/codex/skill/references/verification.md +1 -1
- package/codex/skill/references/visual-companion.md +290 -18
- package/lib/installer/install.mjs +5 -7
- package/lib/installer/manifest.mjs +22 -7
- package/lib/installer/package-references.mjs +10 -5
- package/lib/installer/plan.mjs +1 -1
- package/lib/installer/superpowers.mjs +26 -1
- package/lib/installer/transaction.mjs +3 -3
- package/lib/installer/upgrade.mjs +2 -9
- package/lib/management/operations.mjs +2 -6
- package/lib/release/artifact.mjs +6 -4
- package/package.json +12 -2
- package/scripts/update-manifest.mjs +7 -9
- package/claude/skill/references/superpowers/brainstorming/visual-companion.md +0 -299
- package/codex/skill/references/superpowers/brainstorming/visual-companion.md +0 -299
- package/scripts/update-superpowers-local.sh +0 -4
- /package/claude/skill/references/{superpowers/brainstorming/SKILL.md → brainstorming.md} +0 -0
- /package/claude/skill/references/{superpowers/brainstorming/builder-check-prompt.md → builder-check-prompt.md} +0 -0
- /package/claude/skill/references/{superpowers/brainstorming/scripts → scripts}/frame-template.html +0 -0
- /package/claude/skill/references/{superpowers/brainstorming/scripts → scripts}/helper.js +0 -0
- /package/claude/skill/references/{superpowers/brainstorming/scripts → scripts}/server.cjs +0 -0
- /package/claude/skill/references/{superpowers/brainstorming/scripts → scripts}/start-server.sh +0 -0
- /package/claude/skill/references/{superpowers/brainstorming/scripts → scripts}/stop-server.sh +0 -0
- /package/claude/skill/references/{superpowers/LICENSE → superpowers-LICENSE} +0 -0
- /package/claude/skill/references/{superpowers/provenance.json → superpowers-provenance.json} +0 -0
- /package/claude/skill/references/{superpowers/test-driven-development/SKILL.md → test-driven-development.md} +0 -0
- /package/claude/skill/references/{superpowers/test-driven-development/writing-good-tests.md → writing-good-tests.md} +0 -0
- /package/claude/skill/references/{superpowers/writing-plans/SKILL.md → writing-plans.md} +0 -0
- /package/codex/skill/references/{superpowers/brainstorming/SKILL.md → brainstorming.md} +0 -0
- /package/codex/skill/references/{superpowers/brainstorming/builder-check-prompt.md → builder-check-prompt.md} +0 -0
- /package/codex/skill/references/{superpowers/brainstorming/scripts → scripts}/frame-template.html +0 -0
- /package/codex/skill/references/{superpowers/brainstorming/scripts → scripts}/helper.js +0 -0
- /package/codex/skill/references/{superpowers/brainstorming/scripts → scripts}/server.cjs +0 -0
- /package/codex/skill/references/{superpowers/brainstorming/scripts → scripts}/start-server.sh +0 -0
- /package/codex/skill/references/{superpowers/brainstorming/scripts → scripts}/stop-server.sh +0 -0
- /package/codex/skill/references/{superpowers/LICENSE → superpowers-LICENSE} +0 -0
- /package/codex/skill/references/{superpowers/provenance.json → superpowers-provenance.json} +0 -0
- /package/codex/skill/references/{superpowers/test-driven-development/SKILL.md → test-driven-development.md} +0 -0
- /package/codex/skill/references/{superpowers/test-driven-development/writing-good-tests.md → writing-good-tests.md} +0 -0
- /package/codex/skill/references/{superpowers/writing-plans/SKILL.md → writing-plans.md} +0 -0
|
@@ -26,10 +26,10 @@ choice and preparation evidence, and absolute document paths in the selected tar
|
|
|
26
26
|
inaccessible or mismatched evidence to Orchestrator and stop dependent drafting; never prepare or switch the target.
|
|
27
27
|
Written-spec approval precedes dependent plan drafting. Return drafts only; Orchestrator saves them and requests approval.
|
|
28
28
|
Stay in your role: ONLY draft designs, specs, and plans for Orchestrator; NEVER implement, verify, review, or save documents. Read-only prompt-level guard: MUST NOT edit files; NEVER run commands that change state; do not request user approval or spawn agents. Use the supplied brief/prior evidence. For shared assignments, return findings, relevant questions, next actions, and workspace/path issues to Orchestrator. Route shared questions, decisions, and visual-companion requests through Orchestrator; stop at applicable gates until Orchestrator supplies required answers or decisions. Development approval and completion duties remain with Orchestrator.
|
|
29
|
-
For feature/design/behavior work assigned by Orchestrator, read brief-cited `references/
|
|
29
|
+
For feature/design/behavior work assigned by Orchestrator, read brief-cited `references/brainstorming.md`. Return context, spike/bounded/architectural path, design/options, trade-offs, criteria, assumptions, and focused questions to Orchestrator, who integrates findings, routes user answers/revisions, and obtains development approvals. After architectural design approval, return complete spec draft and self-review findings; Orchestrator integrates/saves/self-reviews and obtains written-spec approval.
|
|
30
30
|
|
|
31
31
|
|
|
32
|
-
After written-spec approval, architectural work always reads brief-cited `references/
|
|
32
|
+
After written-spec approval, architectural work always reads brief-cited `references/writing-plans.md`, regardless of locality, risk, or size. For bounded work, follow Orchestrator's separate plan-depth assessment: skip only for one local change with no dependent stages, cross-component shared state, lifecycle, or integration-order concerns and one focused verification path. When required, return the complete proportional plan, dependencies, assumptions/open decisions, verification requirements, and self-review findings. Orchestrator integrates/saves/reviews and obtains plan approval before Implementer. A bounded or no-plan label does not waive requirements. If a called skill requires writes, approval, or implementation, return the draft and next actions instead; skills add no agents. Other assignments return concise actionable scope, dependencies, risks, criteria, and smallest meaningful verification. Preserve full requested drafts; cite evidence and omit unrelated history.
|
|
33
33
|
|
|
34
34
|
For each top-level task, include ID and title, implementation goal/scope and target files, preceding tasks and dependencies, acceptance criteria, required QA/focused checks and evidence before acceptance, and hold conditions. Changes that cannot be independently verified belong in one top-level task from the outset; do not combine different approved tasks during execution. Substeps and checkboxes are progress records, not separate commit units. One approved top-level task is one focused implementation commit: Orchestrator verifies criteria, required checks and findings, accepts it, then commits without additional user commit approval. Reports and passing checks do not replace Orchestrator acceptance. Never list Reviewer as a per-task required check. Distinguish final overall plan verification from task acceptance prerequisites with scope/timing; for significant/high-risk work, final plan verification lists the single independent Reviewer review of the final full change after all tasks are accepted with their risk-scaled checks. Preserve required checks and risk/dependency QA gates without adding QA solely for a task boundary. Later final verification alone does not delay an independently acceptable task. Existing plan-omission paths gain no new plan obligation. Route scope changes, hold conditions and required decisions to Orchestrator.
|
|
35
35
|
|
package/codex/skill/SKILL.md
CHANGED
|
@@ -64,7 +64,7 @@ Do not load all references on every task.
|
|
|
64
64
|
| [commit](references/commit.md) | Plan-task acceptance and its focused commit, resuming a task with an unclear commit result |
|
|
65
65
|
| [verification](references/verification.md) | Orchestrator's verification design, QA/Reviewer assignment, correction rechecks, UI acceptance checks, risk classification, acceptance and completion; QA and Reviewer use their profiles and only brief-cited sections |
|
|
66
66
|
| [git-recovery](references/git-recovery.md) | Branch collision, Git preparation failure, partial completion, metadata write denial, handoff record write denial recovery |
|
|
67
|
-
| [visual-companion](references/visual-companion.md) | Visual companion offer or operation |
|
|
67
|
+
| [visual-companion](references/arc-visual-companion.md) | Visual companion offer or operation |
|
|
68
68
|
|
|
69
69
|
Before deciding eligibility for a small-task, plan-omission, or TDD exception, read the full conditions in [handoff](references/handoff.md), including Implementer TDD and constraints and Orchestrator direct path for small tasks; read [planning](references/planning.md) for design/plan-depth judgments and [verification](references/verification.md) for the full risk criteria before deciding eligibility. An exception name or this index alone never proves eligibility.
|
|
70
70
|
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Visual companion contract
|
|
2
|
+
|
|
3
|
+
Read before offering or operating a visual companion.
|
|
4
|
+
|
|
5
|
+
## Visual companion
|
|
6
|
+
|
|
7
|
+
Visual companion design discussion is distinct from QA UI acceptance checks under the approved test brief.
|
|
8
|
+
|
|
9
|
+
Planner identifies a genuinely visual question, explains why a visual helps, and returns options, the user decision,
|
|
10
|
+
and a complete content draft; Planner does not write screens, start a server, operate a browser, or request approval.
|
|
11
|
+
Orchestrator makes a just-in-time offer as its own message only when a question is clearer visually, then waits for
|
|
12
|
+
acceptance. If declined, continue in text and do not offer again unless the user raises it. If accepted, decide per
|
|
13
|
+
question whether to use the companion. Orchestrator owns its guide, server/browser, workspace paths, live-session
|
|
14
|
+
checks, complete keyed URL, screens, session state, feedback/events, stale-screen clearing when returning to text, and
|
|
15
|
+
cleanup. Check the server before showing a screen; after the user's reply, treat terminal text as primary and events as
|
|
16
|
+
supplemental. A UI topic or companion acceptance alone does not route every question through a browser.
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
Upstream guide/scripts: `<installed ARC>/references/visual-companion.md` and adjacent `scripts/`.
|
|
20
|
+
ARC guide: `references/arc-visual-companion.md`; Orchestrator briefs absolute paths and retains approval/server/browser
|
|
21
|
+
ownership. Missing files stop dependent work. MUST NOT use a global fallback.
|
|
22
|
+
|
|
23
|
+
Run the upstream relative commands from the installed ARC `references/` directory. Orchestrator supplies that
|
|
24
|
+
absolute working directory and records `screen_dir`, `state_dir`, and the complete keyed URL returned by the server
|
|
25
|
+
or this session's `state/server-info`; do not guess another session path.
|
|
26
|
+
|
|
27
|
+
An A/B highlight proves only the browser selection display. Check the recorded session's exact `state_dir/events`
|
|
28
|
+
file separately for saved choice events. Clicking does not start a chat turn or an automatic assistant response.
|
|
29
|
+
Tell the user to return to chat and send a follow-up message after selecting. On that actual next user turn, read
|
|
30
|
+
the same session's events file again and combine it with the current message. Treat terminal text as primary and
|
|
31
|
+
events as supplemental; current chat text wins on conflict, and missing or ambiguous feedback needs clarification.
|
|
32
|
+
Do not claim event storage from a highlight or next-turn consumption from an earlier QA parse. Preserve the imported
|
|
33
|
+
guide and scripts unchanged.
|
|
34
|
+
|
|
35
|
+
## Follow-up Verification of Approved Visual Sources
|
|
36
|
+
|
|
37
|
+
Each visual criterion requires the exact location, version, approval, and access state of the approved visual source; criterion IDs, properties, and comparison method; and evidence linking the actual output to its revision. An Implementer report does not replace fresh QA's direct comparison. Record results as pass, mismatch, or unverified and connect them to the existing proven/unmet/unverified criterion verdicts. Use pass only when accessible evidence meets the visual criterion; keep unsupported claims unverified. Missing output-to-revision linkage is unverified; a visible difference is a mismatch. Record these separately; do not infer the current branch UI state. Hold the comparison if the approved source or actual output is inaccessible or interpretation approval is missing.
|
|
38
|
+
|
|
39
|
+
Static policy, generated-file, and manifest checks are structural evidence. They do not prove actual role behavior, an installed build, Claude Code CLI runtime compliance, or visual fidelity. Reports include actual changes, exclusion rationale, checks run and omitted, each criterion's evidence and limits, and platform availability. Keep baseline failures separate; progress on independent work does not relax required checks or acceptance criteria.
|
|
@@ -48,8 +48,8 @@ missing required local references before dependent work.
|
|
|
48
48
|
### Local superpowers references
|
|
49
49
|
|
|
50
50
|
Orchestrator briefs absolute paths under the selected installed ARC directory: Planner reads
|
|
51
|
-
`references/
|
|
52
|
-
Implementer reads `references/
|
|
51
|
+
`references/brainstorming.md` and `references/writing-plans.md`;
|
|
52
|
+
Implementer reads `references/test-driven-development.md`, including required relative references.
|
|
53
53
|
Resolve paths within each skill directory. Runtime needs no global discovery, external Skill invocation, or automatic download.
|
|
54
54
|
Missing/damaged local files stop dependent work: report exact paths to Orchestrator, without global fallback.
|
|
55
55
|
ARC approval, ownership, TDD exceptions and executor adapters still apply.
|
|
@@ -301,9 +301,9 @@ See [handoff-worktree.md](handoff-worktree.md) for the managed worktree contract
|
|
|
301
301
|
|
|
302
302
|
## Local planning references
|
|
303
303
|
|
|
304
|
-
Orchestrator briefs absolute ARC paths `references/
|
|
305
|
-
`references/
|
|
306
|
-
|
|
304
|
+
Orchestrator briefs absolute ARC paths `references/brainstorming.md` and
|
|
305
|
+
`references/writing-plans.md`. Planner reads them directly; resolve relative references from the installed
|
|
306
|
+
`references/` directory. Missing files stop the stage; report paths without global fallback. Keep ARC approval and ownership gates.
|
|
307
307
|
|
|
308
308
|
|
|
309
309
|
|
|
@@ -184,7 +184,7 @@ Explicit disposition does not turn unverified into proven; completion reports pr
|
|
|
184
184
|
For low-risk work without QA, Orchestrator's focused checks likewise connect each criterion to evidence.
|
|
185
185
|
|
|
186
186
|
|
|
187
|
-
Read brief-cited `references/
|
|
187
|
+
Read brief-cited `references/test-driven-development.md`; retain ARC exceptions.
|
|
188
188
|
|
|
189
189
|
|
|
190
190
|
## Completion continuity
|
|
@@ -1,27 +1,299 @@
|
|
|
1
|
-
# Visual
|
|
1
|
+
# Visual Companion Guide
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Browser-based visual brainstorming companion for showing mockups, diagrams, and options.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## When to Use
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Decide per-question, not per-session. The test: **would the user understand this better by seeing it than reading it?**
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
and a complete content draft; Planner does not write screens, start a server, operate a browser, or request approval.
|
|
11
|
-
Orchestrator makes a just-in-time offer as its own message only when a question is clearer visually, then waits for
|
|
12
|
-
acceptance. If declined, continue in text and do not offer again unless the user raises it. If accepted, decide per
|
|
13
|
-
question whether to use the companion. Orchestrator owns its guide, server/browser, workspace paths, live-session
|
|
14
|
-
checks, complete keyed URL, screens, session state, feedback/events, stale-screen clearing when returning to text, and
|
|
15
|
-
cleanup. Check the server before showing a screen; after the user's reply, treat terminal text as primary and events as
|
|
16
|
-
supplemental. A UI topic or companion acceptance alone does not route every question through a browser.
|
|
9
|
+
**Use the browser** when the content itself is visual:
|
|
17
10
|
|
|
11
|
+
- **UI mockups** — wireframes, layouts, navigation structures, component designs
|
|
12
|
+
- **Architecture diagrams** — system components, data flow, relationship maps
|
|
13
|
+
- **Side-by-side visual comparisons** — comparing two layouts, two color schemes, two design directions
|
|
14
|
+
- **Design polish** — when the question is about look and feel, spacing, visual hierarchy
|
|
15
|
+
- **Spatial relationships** — state machines, flowcharts, entity relationships rendered as diagrams
|
|
18
16
|
|
|
19
|
-
|
|
20
|
-
ARC guide: `references/visual-companion.md`; Orchestrator briefs absolute paths and retains approval/server/browser
|
|
21
|
-
ownership. Missing files stop dependent work. MUST NOT use a global fallback.
|
|
17
|
+
**Use the terminal** when the content is text or tabular:
|
|
22
18
|
|
|
23
|
-
|
|
19
|
+
- **Requirements and scope questions** — "what does X mean?", "which features are in scope?"
|
|
20
|
+
- **Conceptual A/B/C choices** — picking between approaches described in words
|
|
21
|
+
- **Tradeoff lists** — pros/cons, comparison tables
|
|
22
|
+
- **Technical decisions** — API design, data modeling, architectural approach selection
|
|
23
|
+
- **Clarifying questions** — anything where the answer is words, not a visual preference
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
A question *about* a UI topic is not automatically a visual question. "What kind of wizard do you want?" is conceptual — use the terminal. "Which of these wizard layouts feels right?" is visual — use the browser.
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
## How It Works
|
|
28
|
+
|
|
29
|
+
The server watches a directory for HTML files and serves the newest one to the browser. You write HTML content to `screen_dir`, the user sees it in their browser and can click to select options. Selections are recorded to `state_dir/events` that you read on your next turn.
|
|
30
|
+
|
|
31
|
+
**Content fragments vs full documents:** If your HTML file starts with `<!DOCTYPE` or `<html`, the server serves it as-is (just injects the helper script). Otherwise, the server automatically wraps your content in the frame template — adding the header, CSS theme, connection status, and all interactive infrastructure. **Write content fragments by default.** Only write full documents when you need complete control over the page.
|
|
32
|
+
|
|
33
|
+
## Starting a Session
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
# Start AFTER the user approves the companion. --open auto-opens their browser on
|
|
37
|
+
# the first screen; --project-dir persists mockups and enables same-port restart.
|
|
38
|
+
bash scripts/start-server.sh --project-dir /path/to/project --open
|
|
39
|
+
|
|
40
|
+
# Returns: {"type":"server-started","port":52341,
|
|
41
|
+
# "url":"http://localhost:52341/?key=ab12…",
|
|
42
|
+
# "screen_dir":"/path/to/project/.superpowers/brainstorm/12345-1706000000/content",
|
|
43
|
+
# "state_dir":"/path/to/project/.superpowers/brainstorm/12345-1706000000/state"}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Save `screen_dir` and `state_dir` from the response. With `--open`, the browser opens itself when you push the first screen — you don't need to ask the user to open it, but still share the URL as a fallback (headless/remote setups won't auto-open).
|
|
47
|
+
|
|
48
|
+
**The URL contains a session key (`?key=…`).** The server rejects any request
|
|
49
|
+
without it, so always give the user the **complete** URL from the `url` field —
|
|
50
|
+
never strip the query string, and never hand out a bare `http://host:port`. The
|
|
51
|
+
key gates HTTP and WebSocket access so a stray browser tab or another machine on
|
|
52
|
+
the network can't read the screens or inject events. After the first load the
|
|
53
|
+
browser remembers the key via a cookie, so reloads and `/files/*` assets work
|
|
54
|
+
without repeating it.
|
|
55
|
+
|
|
56
|
+
**Finding connection info:** The server writes its startup JSON to `$STATE_DIR/server-info`. If you launched the server in the background and didn't capture stdout, read that file to get the URL and port. When using `--project-dir`, check `<project>/.superpowers/brainstorm/` for the session directory.
|
|
57
|
+
|
|
58
|
+
**Note:** Pass the project root as `--project-dir` so mockups persist in `.superpowers/brainstorm/` and survive server restarts. Without it, files go to `/tmp` and get cleaned up. Remind the user to add `.superpowers/` to `.gitignore` if it's not already there.
|
|
59
|
+
|
|
60
|
+
**Launching the server by platform:**
|
|
61
|
+
|
|
62
|
+
**Claude Code:**
|
|
63
|
+
```bash
|
|
64
|
+
# Default mode works — the script backgrounds the server itself.
|
|
65
|
+
bash scripts/start-server.sh --project-dir /path/to/project --open
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
On Windows, the script auto-detects and switches to foreground mode (which blocks the tool call). Use `run_in_background: true` on the Bash tool call so the server survives across conversation turns, then read `$STATE_DIR/server-info` on the next turn to get the URL and port.
|
|
69
|
+
|
|
70
|
+
**Codex:**
|
|
71
|
+
```bash
|
|
72
|
+
# Codex reaps background processes. The script auto-detects CODEX_CI and
|
|
73
|
+
# switches to foreground mode. Run it normally — no extra flags needed.
|
|
74
|
+
bash scripts/start-server.sh --project-dir /path/to/project --open
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
**Gemini CLI:**
|
|
78
|
+
```bash
|
|
79
|
+
# Use --foreground and set is_background: true on your shell tool call
|
|
80
|
+
# so the process survives across turns
|
|
81
|
+
bash scripts/start-server.sh --project-dir /path/to/project --open --foreground
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
**Copilot CLI:**
|
|
85
|
+
```bash
|
|
86
|
+
# Start it with Copilot CLI's non-blocking/background shell mechanism so the
|
|
87
|
+
# server survives across turns. Keep --foreground so the harness, not the
|
|
88
|
+
# script, owns backgrounding. The launcher is a .sh, so invoke it via bash
|
|
89
|
+
# (on Windows, call Git Bash's bash.exe from the PowerShell tool).
|
|
90
|
+
bash scripts/start-server.sh --project-dir /path/to/project --open --foreground
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
**Other environments:** The server must keep running in the background across conversation turns. If your environment reaps detached processes, use `--foreground` and launch the command with your platform's background execution mechanism.
|
|
94
|
+
|
|
95
|
+
If the URL is unreachable from your browser (common in remote/containerized setups), bind a non-loopback host:
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
bash scripts/start-server.sh \
|
|
99
|
+
--project-dir /path/to/project \
|
|
100
|
+
--host 0.0.0.0 \
|
|
101
|
+
--url-host localhost
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Use `--url-host` to control what hostname is printed in the returned URL JSON.
|
|
105
|
+
|
|
106
|
+
## The Loop
|
|
107
|
+
|
|
108
|
+
1. **Check server is alive**, then **write HTML** to a new file in `screen_dir`:
|
|
109
|
+
- **Required: confirm the server is alive before referring to the URL or pushing a screen.** Check that `$STATE_DIR/server-info` exists and `$STATE_DIR/server-stopped` does not. If it has shut down, restart it with `start-server.sh` using the **same `--project-dir`** — it reuses the same port, so the user's open tab reconnects on its own (it shows a "paused" overlay while the server is down) and you don't need to send a new URL. The server auto-exits after 4 hours idle (configurable with `--idle-timeout-minutes`).
|
|
110
|
+
- Use semantic filenames: `platform.html`, `visual-style.html`, `layout.html`
|
|
111
|
+
- **Never reuse filenames** — each screen gets a fresh file
|
|
112
|
+
- Use your file-creation tool — **never use cat/heredoc** (dumps noise into terminal)
|
|
113
|
+
- Server automatically serves the newest file
|
|
114
|
+
|
|
115
|
+
2. **Tell user what to expect and end your turn:**
|
|
116
|
+
- Remind them of the URL (every step, not just first)
|
|
117
|
+
- Give a brief text summary of what's on screen (e.g., "Showing 3 layout options for the homepage")
|
|
118
|
+
- Ask them to respond in the terminal: "Take a look and let me know what you think. Click to select an option if you'd like."
|
|
119
|
+
|
|
120
|
+
3. **On your next turn** — after the user responds in the terminal:
|
|
121
|
+
- Read `$STATE_DIR/events` if it exists — this contains the user's browser interactions (clicks, selections) as JSON lines
|
|
122
|
+
- Merge with the user's terminal text to get the full picture
|
|
123
|
+
- The terminal message is the primary feedback; `state_dir/events` provides structured interaction data
|
|
124
|
+
|
|
125
|
+
4. **Iterate or advance** — if feedback changes current screen, write a new file (e.g., `layout-v2.html`). Only move to the next question when the current step is validated.
|
|
126
|
+
|
|
127
|
+
5. **Unload when returning to terminal** — when the next step doesn't need the browser (e.g., a clarifying question, a tradeoff discussion), push a waiting screen to clear the stale content:
|
|
128
|
+
|
|
129
|
+
```html
|
|
130
|
+
<!-- filename: waiting.html (or waiting-2.html, etc.) -->
|
|
131
|
+
<div style="display:flex;align-items:center;justify-content:center;min-height:60vh">
|
|
132
|
+
<p class="subtitle">Continuing in terminal...</p>
|
|
133
|
+
</div>
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
This prevents the user from staring at a resolved choice while the conversation has moved on. When the next visual question comes up, push a new content file as usual.
|
|
137
|
+
|
|
138
|
+
6. Repeat until done.
|
|
139
|
+
|
|
140
|
+
## Writing Content Fragments
|
|
141
|
+
|
|
142
|
+
Write just the content that goes inside the page. The server wraps it in the frame template automatically (header, theme CSS, connection status, and all interactive infrastructure).
|
|
143
|
+
|
|
144
|
+
**Minimal example:**
|
|
145
|
+
|
|
146
|
+
```html
|
|
147
|
+
<h2>Which layout works better?</h2>
|
|
148
|
+
<p class="subtitle">Consider readability and visual hierarchy</p>
|
|
149
|
+
|
|
150
|
+
<div class="options">
|
|
151
|
+
<div class="option" data-choice="a" onclick="toggleSelect(this)">
|
|
152
|
+
<div class="letter">A</div>
|
|
153
|
+
<div class="content">
|
|
154
|
+
<h3>Single Column</h3>
|
|
155
|
+
<p>Clean, focused reading experience</p>
|
|
156
|
+
</div>
|
|
157
|
+
</div>
|
|
158
|
+
<div class="option" data-choice="b" onclick="toggleSelect(this)">
|
|
159
|
+
<div class="letter">B</div>
|
|
160
|
+
<div class="content">
|
|
161
|
+
<h3>Two Column</h3>
|
|
162
|
+
<p>Sidebar navigation with main content</p>
|
|
163
|
+
</div>
|
|
164
|
+
</div>
|
|
165
|
+
</div>
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
That's it. No `<html>`, no CSS, no `<script>` tags needed. The server provides all of that.
|
|
169
|
+
|
|
170
|
+
## CSS Classes Available
|
|
171
|
+
|
|
172
|
+
The frame template provides these CSS classes for your content:
|
|
173
|
+
|
|
174
|
+
### Options (A/B/C choices)
|
|
175
|
+
|
|
176
|
+
```html
|
|
177
|
+
<div class="options">
|
|
178
|
+
<div class="option" data-choice="a" onclick="toggleSelect(this)">
|
|
179
|
+
<div class="letter">A</div>
|
|
180
|
+
<div class="content">
|
|
181
|
+
<h3>Title</h3>
|
|
182
|
+
<p>Description</p>
|
|
183
|
+
</div>
|
|
184
|
+
</div>
|
|
185
|
+
</div>
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
**Multi-select:** Add `data-multiselect` to the container to let users select multiple options. Each click toggles the item's selected styling.
|
|
189
|
+
|
|
190
|
+
```html
|
|
191
|
+
<div class="options" data-multiselect>
|
|
192
|
+
<!-- same option markup — users can select/deselect multiple -->
|
|
193
|
+
</div>
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
### Cards (visual designs)
|
|
197
|
+
|
|
198
|
+
```html
|
|
199
|
+
<div class="cards">
|
|
200
|
+
<div class="card" data-choice="design1" onclick="toggleSelect(this)">
|
|
201
|
+
<div class="card-image"><!-- mockup content --></div>
|
|
202
|
+
<div class="card-body">
|
|
203
|
+
<h3>Name</h3>
|
|
204
|
+
<p>Description</p>
|
|
205
|
+
</div>
|
|
206
|
+
</div>
|
|
207
|
+
</div>
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
### Mockup container
|
|
211
|
+
|
|
212
|
+
```html
|
|
213
|
+
<div class="mockup">
|
|
214
|
+
<div class="mockup-header">Preview: Dashboard Layout</div>
|
|
215
|
+
<div class="mockup-body"><!-- your mockup HTML --></div>
|
|
216
|
+
</div>
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
### Split view (side-by-side)
|
|
220
|
+
|
|
221
|
+
```html
|
|
222
|
+
<div class="split">
|
|
223
|
+
<div class="mockup"><!-- left --></div>
|
|
224
|
+
<div class="mockup"><!-- right --></div>
|
|
225
|
+
</div>
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
### Pros/Cons
|
|
229
|
+
|
|
230
|
+
```html
|
|
231
|
+
<div class="pros-cons">
|
|
232
|
+
<div class="pros"><h4>Pros</h4><ul><li>Benefit</li></ul></div>
|
|
233
|
+
<div class="cons"><h4>Cons</h4><ul><li>Drawback</li></ul></div>
|
|
234
|
+
</div>
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
### Mock elements (wireframe building blocks)
|
|
238
|
+
|
|
239
|
+
```html
|
|
240
|
+
<div class="mock-nav">Logo | Home | About | Contact</div>
|
|
241
|
+
<div style="display: flex;">
|
|
242
|
+
<div class="mock-sidebar">Navigation</div>
|
|
243
|
+
<div class="mock-content">Main content area</div>
|
|
244
|
+
</div>
|
|
245
|
+
<button class="mock-button">Action Button</button>
|
|
246
|
+
<input class="mock-input" placeholder="Input field">
|
|
247
|
+
<div class="placeholder">Placeholder area</div>
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
### Typography and sections
|
|
251
|
+
|
|
252
|
+
- `h2` — page title
|
|
253
|
+
- `h3` — section heading
|
|
254
|
+
- `.subtitle` — secondary text below title
|
|
255
|
+
- `.section` — content block with bottom margin
|
|
256
|
+
- `.label` — small uppercase label text
|
|
257
|
+
|
|
258
|
+
## Browser Events Format
|
|
259
|
+
|
|
260
|
+
When the user clicks options in the browser, their interactions are recorded to `$STATE_DIR/events` (one JSON object per line). The file is cleared automatically when you push a new screen.
|
|
261
|
+
|
|
262
|
+
```jsonl
|
|
263
|
+
{"type":"click","choice":"a","text":"Option A - Simple Layout","timestamp":1706000101}
|
|
264
|
+
{"type":"click","choice":"c","text":"Option C - Complex Grid","timestamp":1706000108}
|
|
265
|
+
{"type":"click","choice":"b","text":"Option B - Hybrid","timestamp":1706000115}
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
The full event stream shows the user's exploration path — they may click multiple options before settling. The last `choice` event is typically the final selection, but the pattern of clicks can reveal hesitation or preferences worth asking about.
|
|
269
|
+
|
|
270
|
+
If `$STATE_DIR/events` doesn't exist, the user didn't interact with the browser — use only their terminal text.
|
|
271
|
+
|
|
272
|
+
## Design Tips
|
|
273
|
+
|
|
274
|
+
- **Scale fidelity to the question** — wireframes for layout, polish for polish questions
|
|
275
|
+
- **Explain the question on each page** — "Which layout feels more professional?" not just "Pick one"
|
|
276
|
+
- **Iterate before advancing** — if feedback changes current screen, write a new version
|
|
277
|
+
- **2-4 options max** per screen
|
|
278
|
+
- **Use real content when it matters** — for a photography portfolio, use actual images (Unsplash). Placeholder content obscures design issues.
|
|
279
|
+
- **Keep mockups simple** — focus on layout and structure, not pixel-perfect design
|
|
280
|
+
|
|
281
|
+
## File Naming
|
|
282
|
+
|
|
283
|
+
- Use semantic names: `platform.html`, `visual-style.html`, `layout.html`
|
|
284
|
+
- Never reuse filenames — each screen must be a new file
|
|
285
|
+
- For iterations: append version suffix like `layout-v2.html`, `layout-v3.html`
|
|
286
|
+
- Server serves newest file by modification time
|
|
287
|
+
|
|
288
|
+
## Cleaning Up
|
|
289
|
+
|
|
290
|
+
```bash
|
|
291
|
+
bash scripts/stop-server.sh $SESSION_DIR
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
If the session used `--project-dir`, mockup files persist in `.superpowers/brainstorm/` for later reference. Only `/tmp` sessions get deleted on stop.
|
|
295
|
+
|
|
296
|
+
## Reference
|
|
297
|
+
|
|
298
|
+
- Frame template (CSS reference): `scripts/frame-template.html`
|
|
299
|
+
- Helper script (client-side): `scripts/helper.js`
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {validatePlanSet} from './plan.mjs';
|
|
2
2
|
import {assertPlanSnapshot,applyTransaction} from './transaction.mjs';
|
|
3
3
|
function pending(plan){return{platform:plan.target.platform,status:'not-started',rollback:'not-needed',residualPaths:[],error:null};}
|
|
4
|
-
export async function installTargets(plans,{safeFs,
|
|
4
|
+
export async function installTargets(plans,{safeFs,signal,hooks={}}){
|
|
5
5
|
const ordered=[...plans].sort((a,b)=>(a.target.platform==='codex'?0:1)-(b.target.platform==='codex'?0:1));const results=ordered.map(pending);let interrupted=false;
|
|
6
6
|
let invalid=false;
|
|
7
7
|
for(let index=0;index<ordered.length;index++){
|
|
@@ -14,14 +14,12 @@ export async function installTargets(plans,{safeFs,acquisition,signal,hooks={}})
|
|
|
14
14
|
if(invalid)return{results,interrupted};
|
|
15
15
|
for(let index=0;index<ordered.length;index++){
|
|
16
16
|
const plan=ordered[index];if(signal?.aborted){interrupted=true;break;}
|
|
17
|
-
let
|
|
17
|
+
let failed=false;
|
|
18
18
|
try{
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
hooks.fault?.({phase:'after-acquisition',plan});assertPlanSnapshot(plan,{safeFs});
|
|
22
|
-
const installed=applyTransaction(plan,{safeFs,acquired,signal,hooks});
|
|
19
|
+
assertPlanSnapshot(plan,{safeFs});
|
|
20
|
+
const installed=applyTransaction(plan,{safeFs,signal,hooks});
|
|
23
21
|
results[index]={...results[index],status:'installed',error:installed.cleanupError??null,residualPaths:[...results[index].residualPaths,...(installed.residualPaths??[])]};if(installed.cleanupError)failed=true;
|
|
24
|
-
}catch(error){const cancelled=signal?.aborted||error.code==='
|
|
22
|
+
}catch(error){const cancelled=signal?.aborted||error.code==='ARC_INSTALL_CANCELLED';interrupted=Boolean(cancelled);results[index]={...results[index],status:'failed',rollback:error.rollback??'not-needed',residualPaths:[...results[index].residualPaths,...(error.residualPaths??[])],error};failed=true;}
|
|
25
23
|
if(failed)break;
|
|
26
24
|
}
|
|
27
25
|
return{results,interrupted};
|
|
@@ -1,29 +1,44 @@
|
|
|
1
1
|
import {COOPERATIVE_RUNTIME_MODULES} from '../runtime/bootstrap.mjs';
|
|
2
2
|
import {RUNTIME_MODULE_PATHS} from './runtime-assets.mjs';
|
|
3
3
|
import {POLICY_TARGETS,buildPolicyOutputs} from '../policy/render.mjs';
|
|
4
|
-
import {
|
|
4
|
+
import {validateFlatReferenceFiles,REFERENCE_PATH_MAP} from './superpowers.mjs';
|
|
5
5
|
import path from 'node:path';import crypto from 'node:crypto';import{loadModelConfig,resolveModelSettings,renderProfiles}from '../models/index.mjs';import{readCheckedFile,typeOf,sameIdentity,metadataOf}from './targets.mjs';
|
|
6
6
|
export class PayloadValidationError extends Error{constructor(message,options){super(message,options);this.name='PayloadValidationError';this.code='ARC_PAYLOAD_VALIDATION';}}
|
|
7
7
|
const MUTABLE=new Set(['codex/skill/models.toml','claude/skill/models.toml']);
|
|
8
|
+
export const LOCAL_UPDATER_PATH='scripts/update-superpowers-local.sh';
|
|
8
9
|
const ROOTS=['bin','lib','scripts','vendor','prebuilds','codex/skill','codex/agents','claude/skill','claude/agents'];
|
|
9
10
|
const FIXED=['README.md','install.command','package.json','native/binding.c','native/binding.gyp'];
|
|
10
11
|
function safeName(name){return typeof name==='string'&&name.length>0&&!name.includes('\\')&&!name.includes('\0')&&!name.startsWith('/')&&name.split('/').every(p=>p&&p!=='.'&&p!=='..')&&path.posix.normalize(name)===name;}
|
|
11
12
|
function allowed(name){return FIXED.includes(name)||ROOTS.some(root=>name.startsWith(root+'/'));}
|
|
12
|
-
export function
|
|
13
|
+
export function renderManifest(files){return Buffer.from([...files].filter(([name])=>!MUTABLE.has(name)&&name!==LOCAL_UPDATER_PATH&&!name.split('/').includes('.DS_Store')).sort(([a],[b])=>a<b?-1:a>b?1:0).map(([name,bytes])=>{if(!safeName(name)||!allowed(name)||!Buffer.isBuffer(bytes))throw Error('Invalid protected manifest file');return crypto.createHash('sha256').update(bytes).digest('hex')+' '+name+'\n';}).join(''));}
|
|
14
|
+
const LIFECYCLE_HOOKS=['preinstall','install','postinstall','prepublish','prepare','prepublishOnly','prepack','postpack','publish','postpublish','preuninstall','uninstall','postuninstall'];
|
|
15
|
+
function sourcePayload(root,mode){
|
|
16
|
+
if(!['auto','source','package'].includes(mode))throw Error('Invalid payload mode');if(mode==='package')return false;
|
|
17
|
+
if(mode==='auto'){let marker;try{marker=root.lstat('.git');}catch(error){if(error.code==='ENOENT')return false;throw error;}
|
|
18
|
+
if(typeOf(marker)===0o040000){const directory=root.openDir('.git');try{if(!sameIdentity(marker,directory.stat()))throw Error('Source marker changed');}finally{directory.close();}}
|
|
19
|
+
else if(typeOf(marker)===0o100000){const bytes=readCheckedFile(root,'.git',marker).bytes;let text;try{text=new TextDecoder('utf-8',{fatal:true}).decode(bytes);}catch{throw Error('Invalid source Git marker');}if(!/^gitdir: [^\0\r\n]+\r?\n?$/.test(text))throw Error('Invalid source Git marker');}
|
|
20
|
+
else throw Error('Unsafe source Git marker');
|
|
21
|
+
}
|
|
22
|
+
let pkg,lock;try{pkg=JSON.parse(readCheckedFile(root,'package.json').bytes);lock=JSON.parse(readCheckedFile(root,'package-lock.json').bytes);}catch{throw Error('Source package identity or lock is invalid');}
|
|
23
|
+
const recorded=lock?.packages?.[''];if(pkg?.name!=='@yunhozz/arc'||!/^\d+\.\d+\.\d+$/.test(pkg.version)||lock.name!==pkg.name||lock.version!==pkg.version||recorded?.name!==pkg.name||recorded?.version!==pkg.version||LIFECYCLE_HOOKS.some(name=>Object.hasOwn(pkg.scripts??{},name))||Object.hasOwn(pkg.scripts??{},'build')||Object.hasOwn(pkg,'workspaces')||Object.hasOwn(recorded,'hasInstallScript'))throw Error('Source package identity or lifecycle contract is invalid');return true;
|
|
24
|
+
}
|
|
25
|
+
export function verifyPayload({packageRoot,safeFs,payloadMode='auto'}){
|
|
13
26
|
let root;try{
|
|
14
|
-
root=safeFs.openRoot(packageRoot);const manifest=readCheckedFile(root,'MANIFEST.sha256').bytes;let text;try{text=new TextDecoder('utf-8',{fatal:true}).decode(manifest);}catch{throw Error('Manifest is not UTF-8');}
|
|
15
|
-
const listed=new Map();for(const line of text.split(/\r?\n/)){if(!line)continue;const m=/^([a-fA-F0-9]{64}) (.+)$/.exec(line);if(!m||!safeName(m[2]))throw Error('Malformed or escaping manifest path');const name=m[2];if(MUTABLE.has(name)||
|
|
27
|
+
root=safeFs.openRoot(packageRoot);const source=sourcePayload(root,payloadMode),manifest=readCheckedFile(root,'MANIFEST.sha256').bytes;let text;try{text=new TextDecoder('utf-8',{fatal:true}).decode(manifest);}catch{throw Error('Manifest is not UTF-8');}
|
|
28
|
+
const listed=new Map();for(const line of text.split(/\r?\n/)){if(!line)continue;const m=/^([a-fA-F0-9]{64}) (.+)$/.exec(line);if(!m||!safeName(m[2]))throw Error('Malformed or escaping manifest path');const name=m[2];if(MUTABLE.has(name)||name===LOCAL_UPDATER_PATH||!allowed(name)||name.split('/').includes('.DS_Store')||listed.has(name))throw Error(`Duplicate, mutable or unexpected manifest entry: ${name}`);listed.set(name,m[1].toLowerCase());}
|
|
16
29
|
const files=new Map(),snapshot=new Map(),referenceTrees={};
|
|
17
30
|
function walk(directory,prefix){const before=directory.stat();for(const name of directory.readDir()){
|
|
18
31
|
const relative=prefix?prefix+'/'+name:name;const stat=directory.lstat(name),type=typeOf(stat);
|
|
32
|
+
if(relative===LOCAL_UPDATER_PATH){if(!source)throw Error('Local updater wrapper is forbidden in package payload');if(type!==0o100000||!sameIdentity(stat,directory.lstat(name)))throw Error('Local updater wrapper must be a stable regular file');continue;}
|
|
19
33
|
if(name==='.DS_Store'){if(type!==0o100000)throw Error('DS_Store must be a regular file');continue;}
|
|
20
|
-
if(type===0o040000){const sub=directory.openDir(name);try{if(!sameIdentity(stat,sub.stat()))throw Error('Payload directory changed');snapshot.set(relative,{...metadataOf(stat),type:'directory'});
|
|
34
|
+
if(type===0o040000){const sub=directory.openDir(name);try{if(!sameIdentity(stat,sub.stat()))throw Error('Payload directory changed');snapshot.set(relative,{...metadataOf(stat),type:'directory'});walk(sub,relative);}finally{sub.close();}}
|
|
21
35
|
else if(type===0o100000){const item=readCheckedFile(directory,name,stat);if(!MUTABLE.has(relative)&&(!listed.has(relative)||crypto.createHash('sha256').update(item.bytes).digest('hex')!==listed.get(relative)))throw Error(`Missing entry or hash mismatch: ${relative}`);files.set(relative,item.bytes);snapshot.set(relative,item.metadata);}
|
|
22
36
|
else throw Error(`Unsafe payload type: ${relative}`);
|
|
23
37
|
}if(!sameIdentity(before,directory.stat()))throw Error('Payload directory changed while reading');}
|
|
24
|
-
function select(relative,isTree){const parts=relative.split('/');let parent=root;const opened=[];try{for(const component of parts.slice(0,-1)){let st;try{st=parent.lstat(component);}catch(e){if(e.code==='ENOENT')return;throw e;}if(typeOf(st)!==0o040000)throw Error('Unsafe payload parent');const next=parent.openDir(component);if(!sameIdentity(st,next.stat())){next.close();throw Error('Payload parent changed');}opened.push(next);parent=next;}const name=parts.at(-1);let st;try{st=parent.lstat(name);}catch(e){if(e.code==='ENOENT')return;throw e;}if(isTree){if(typeOf(st)!==0o040000)throw Error('Payload root is not a directory');const sub=parent.openDir(name);try{if(!sameIdentity(st,sub.stat()))throw Error('Payload root changed');snapshot.set(relative,{...metadataOf(st),type:'directory'});
|
|
38
|
+
function select(relative,isTree){const parts=relative.split('/');let parent=root;const opened=[];try{for(const component of parts.slice(0,-1)){let st;try{st=parent.lstat(component);}catch(e){if(e.code==='ENOENT')return;throw e;}if(typeOf(st)!==0o040000)throw Error('Unsafe payload parent');const next=parent.openDir(component);if(!sameIdentity(st,next.stat())){next.close();throw Error('Payload parent changed');}opened.push(next);parent=next;}const name=parts.at(-1);let st;try{st=parent.lstat(name);}catch(e){if(e.code==='ENOENT')return;throw e;}if(isTree){if(typeOf(st)!==0o040000)throw Error('Payload root is not a directory');const sub=parent.openDir(name);try{if(!sameIdentity(st,sub.stat()))throw Error('Payload root changed');snapshot.set(relative,{...metadataOf(st),type:'directory'});walk(sub,relative);}finally{sub.close();}}else{if(typeOf(st)!==0o100000)throw Error('Payload file is not regular');const item=readCheckedFile(parent,name,st);if(!listed.has(relative)||crypto.createHash('sha256').update(item.bytes).digest('hex')!==listed.get(relative))throw Error(`Missing entry or hash mismatch: ${relative}`);files.set(relative,item.bytes);snapshot.set(relative,item.metadata);}}finally{for(const h of opened.reverse())h.close();}}
|
|
25
39
|
for(const item of FIXED)select(item,false);for(const item of ROOTS)select(item,true);
|
|
26
|
-
for(const platform of ['codex','claude'])
|
|
40
|
+
for(const platform of ['codex','claude'])referenceTrees[platform]=validateFlatReferenceFiles(files,platform);
|
|
41
|
+
for(const{destination}of REFERENCE_PATH_MAP)if(!referenceTrees.codex.entries.get(destination).bytes.equals(referenceTrees.claude.entries.get(destination).bytes))throw Error('Imported platform parity mismatch: '+destination);
|
|
27
42
|
for(const name of listed.keys())if(!files.has(name))throw Error(`Manifest entry is missing: ${name}`);
|
|
28
43
|
const required=['claude/skill/hooks/role-git-guard.mjs','claude/skill/hooks/git-policy.json','lib/policy/claude-hook.mjs','lib/policy/role-policy.json','lib/policy/render.mjs','scripts/update-role-policy.mjs','lib/limits.mjs','lib/installer/limits.mjs','lib/installer/runtime-config.mjs','README.md','install.command','package.json','bin/arc.mjs','lib/cli/root.mjs','lib/tui/app.mjs','lib/tui/terminal.mjs','lib/tui/render.mjs','lib/tui/setup.mjs','lib/management/operations.mjs','lib/management/status.mjs','lib/management/update.mjs','lib/management/workflow.mjs','lib/cli/postinstall.mjs','scripts/postinstall.mjs','lib/cli/upgrade.mjs','bin/arc-upgrade.mjs','lib/installer/shell-completion.mjs','lib/installer/manifest.mjs','lib/installer/targets.mjs','lib/installer/global-config.mjs','lib/installer/plan.mjs','lib/safe-fs/index.mjs','lib/safe-fs/native.mjs','lib/models/index.mjs','lib/models/config.mjs','lib/models/profiles.mjs','vendor/toml/LICENSE','vendor/toml/package.json','vendor/toml/provenance.json','vendor/toml/dist/index.js','prebuilds/index.json'];
|
|
29
44
|
required.push('lib/installer/runtime-assets.mjs',...RUNTIME_MODULE_PATHS);
|
|
@@ -4,14 +4,17 @@ import path from 'node:path';
|
|
|
4
4
|
import {openRoot} from '../safe-fs/index.mjs';
|
|
5
5
|
import {loadNative} from '../safe-fs/native.mjs';
|
|
6
6
|
import {acquireExternalSkills} from './acquisition.mjs';
|
|
7
|
-
import {
|
|
7
|
+
import {REFERENCE_PATH_MAP,flattenReferenceBundle} from './superpowers.mjs';
|
|
8
|
+
import {verifyPayload,renderManifest} from './manifest.mjs';
|
|
8
9
|
import {inspectPath} from './targets.mjs';
|
|
9
10
|
import {applyTransaction} from './transaction.mjs';
|
|
10
11
|
|
|
11
12
|
export async function refreshPackageReferences({packageRoot,safeFs,acquisition,signal,hooks={}}){
|
|
12
13
|
if(!safeFs){const native=loadNative({root:packageRoot});safeFs={openRoot:p=>openRoot(p,{native})};}
|
|
13
|
-
const paths=
|
|
14
|
-
|
|
14
|
+
const payload=verifyPayload({packageRoot,safeFs,payloadMode:'source'}),paths=['codex','claude'].flatMap(platform=>REFERENCE_PATH_MAP.map(({destination})=>path.join(packageRoot,platform,'skill/references',destination)));
|
|
15
|
+
paths.push(path.join(packageRoot,'MANIFEST.sha256'));
|
|
16
|
+
const snapshot=new Map([...payload.snapshot].map(([name,item])=>[path.join(packageRoot,name),item]));
|
|
17
|
+
for(const name of ['MANIFEST.sha256','package-lock.json'])inspectPath(safeFs,path.join(packageRoot,name),{kind:'file',snapshot});
|
|
15
18
|
let acquired;
|
|
16
19
|
try{
|
|
17
20
|
if(acquisition)acquired=await acquisition({signal});
|
|
@@ -20,9 +23,11 @@ export async function refreshPackageReferences({packageRoot,safeFs,acquisition,s
|
|
|
20
23
|
try{acquired=await acquireExternalSkills({work,safeFs,signal});}catch(error){if(!error.residualPaths?.length)fs.rmdirSync(work);throw error;}
|
|
21
24
|
const dispose=acquired.dispose;acquired.dispose=async()=>{await dispose();fs.rmdirSync(work);};
|
|
22
25
|
}
|
|
23
|
-
|
|
26
|
+
const flat=flattenReferenceBundle(acquired.references),candidate=new Map(payload.files),specs=[];
|
|
27
|
+
for(const platform of ['codex','claude'])for(const[destination,entry]of flat){const name=platform+'/skill/references/'+destination;candidate.set(name,entry.bytes);specs.push({path:path.join(packageRoot,name),bytes:entry.bytes});}
|
|
28
|
+
specs.push({path:path.join(packageRoot,'MANIFEST.sha256'),bytes:renderManifest(candidate)});
|
|
24
29
|
const plan={target:{home:packageRoot},managedPaths:paths,externalPaths:[],snapshot};
|
|
25
|
-
const result=applyTransaction(plan,{safeFs,signal,hooks,specs
|
|
30
|
+
const result=applyTransaction(plan,{safeFs,signal,hooks,specs});
|
|
26
31
|
if(result.cleanupError)throw result.cleanupError;
|
|
27
32
|
return{...result,provenance:acquired.references.provenance};
|
|
28
33
|
}catch(error){
|
package/lib/installer/plan.mjs
CHANGED
|
@@ -61,7 +61,7 @@ export function buildInstallPlan({payload,target,preset,skipGlobal=false,safeFs,
|
|
|
61
61
|
for(const name of [home,skills,agents])inspectPath(safeFs,name,{kind:'directory',snapshot});
|
|
62
62
|
inspectPath(safeFs,arc,{kind:'directory',tree:true,allowLinks:true,snapshot});
|
|
63
63
|
const profilePaths=target.profileNames.map(name=>path.join(agents,name));for(const name of profilePaths)inspectPath(safeFs,name,{kind:'file',snapshot});
|
|
64
|
-
const externalPaths=[],summary=['
|
|
64
|
+
const externalPaths=[],summary=['Verified packaged Superpowers references will be installed inside ARC'];
|
|
65
65
|
summary.push(`ARC limits: total ${limits.max_total_subagents}; concurrent ${limits.max_concurrent_subagents} (policy: ${arc}/limits.toml)`);
|
|
66
66
|
const globalChanges=renderNativeChanges({target,safeFs,snapshot,skipGlobal,preview,concurrentExplicit,limits,summary,language});
|
|
67
67
|
const managedPaths=[arc,...profilePaths,...(skipGlobal?[]:target.globalPaths)];
|