claude-everything-workflow 0.1.9 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (135) hide show
  1. package/AGENTS.md +19 -20
  2. package/README.md +112 -104
  3. package/agents/code-reviewer.md +15 -44
  4. package/agents/harness-optimizer.md +3 -2
  5. package/agents/planner.md +23 -107
  6. package/commands/code-review.md +25 -9
  7. package/commands/learn.md +97 -0
  8. package/commands/pr.md +4 -0
  9. package/commands/to-spec.md +11 -0
  10. package/hooks/check-code-size.js +33 -12
  11. package/hooks/check-console-log.js +72 -24
  12. package/package.json +5 -2
  13. package/rules/01-base.md +19 -42
  14. package/rules/02-code-size.md +6 -17
  15. package/rules/03-architecture.md +16 -54
  16. package/rules/04-error-handling.md +4 -25
  17. package/rules/05-git-workflow.md +9 -37
  18. package/rules/06-comments.md +3 -37
  19. package/rules/07-forbidden.md +6 -30
  20. package/rules/08-specialty-rules-index.md +18 -0
  21. package/rules/09-first-principles-adversarial-testing.md +6 -18
  22. package/rules/common/agent-orchestration.md +10 -47
  23. package/rules/common/context-hygiene.md +9 -72
  24. package/rules/common/harness-engineering.md +11 -38
  25. package/rules/common/hooks.md +11 -82
  26. package/rules/common/performance.md +8 -71
  27. package/rules/common/pr-automation.md +7 -68
  28. package/rules/common/skills-learning.md +12 -36
  29. package/rules/common/testing.md +15 -59
  30. package/scripts/cleanup-retired-skills.js +214 -0
  31. package/scripts/install.ps1 +73 -85
  32. package/scripts/install.sh +54 -77
  33. package/scripts/learning/review-confidence.js +1 -4
  34. package/scripts/merge-claude-settings.cjs +75 -0
  35. package/scripts/retired-skill-files.json +37 -0
  36. package/scripts/upstream-capability-baseline.json +27 -0
  37. package/scripts/upstream-capability-map.json +150 -0
  38. package/scripts/verify/core.js +91 -0
  39. package/scripts/verify/grilling-spec-gate-checks.js +260 -0
  40. package/scripts/verify/metadata-checks.js +724 -0
  41. package/scripts/verify/repository-checks.js +435 -0
  42. package/scripts/verify/runtime-checks.js +593 -0
  43. package/scripts/verify/workflow-checks.js +741 -0
  44. package/scripts/verify/workflow-ownership-fixtures.js +371 -0
  45. package/scripts/verify/workflow-ownership.js +780 -0
  46. package/scripts/verify-harness.js +16 -1075
  47. package/scripts/verify-upstream-capability-map.js +117 -0
  48. package/skills/README.md +24 -11
  49. package/skills/code-review/SKILL.md +50 -0
  50. package/skills/code-review/references/spec-reviewer-prompt.md +24 -0
  51. package/skills/code-review/references/standards-reviewer-prompt.md +35 -0
  52. package/skills/codebase-design/SKILL.md +63 -0
  53. package/skills/codebase-design/references/deepening.md +27 -0
  54. package/skills/codebase-design/references/design-it-twice.md +17 -0
  55. package/skills/continuous-learning-v2/SKILL.md +7 -7
  56. package/skills/continuous-learning-v2/config.json +0 -4
  57. package/skills/domain-modeling/SKILL.md +100 -0
  58. package/skills/feature-acceptance/SKILL.md +89 -0
  59. package/skills/grilling/SKILL.md +83 -0
  60. package/skills/handoff/SKILL.md +56 -0
  61. package/skills/implement/SKILL.md +97 -0
  62. package/skills/improve-codebase-architecture/SKILL.md +48 -0
  63. package/skills/iterative-retrieval/SKILL.md +10 -1
  64. package/skills/learn/README.md +2 -2
  65. package/skills/project-context/SKILL.md +94 -0
  66. package/skills/project-context/agents/openai.yaml +6 -0
  67. package/skills/project-context/references/project-context-template.md +61 -0
  68. package/skills/prototype/SKILL.md +50 -0
  69. package/skills/prototype/references/logic.md +28 -0
  70. package/skills/prototype/references/ui.md +30 -0
  71. package/skills/research/SKILL.md +48 -0
  72. package/skills/resolving-merge-conflicts/SKILL.md +27 -0
  73. package/skills/spec-gate/SKILL.md +149 -0
  74. package/skills/spec-gate/agents/openai.yaml +4 -0
  75. package/skills/spec-gate/references/spec-document-reviewer-prompt.md +31 -0
  76. package/skills/subagent-driven-development/SKILL.md +95 -414
  77. package/skills/systematic-debugging/SKILL.md +7 -51
  78. package/skills/systematic-debugging/references/diagnosing-bugs.upstream.md +129 -0
  79. package/skills/systematic-debugging/scripts/hitl-loop.template.js +75 -0
  80. package/skills/systematic-debugging/scripts/hitl-loop.template.sh +41 -0
  81. package/skills/test-driven-development/SKILL.md +18 -2
  82. package/skills/to-tickets/SKILL.md +94 -0
  83. package/skills/triage/SKILL.md +53 -0
  84. package/skills/triage/references/agent-brief.md +32 -0
  85. package/skills/triage/references/out-of-scope.md +14 -0
  86. package/skills/using-superpowers/SKILL.md +140 -40
  87. package/skills/visual-companion/SKILL.md +62 -0
  88. package/skills/visual-companion/agents/openai.yaml +4 -0
  89. package/skills/{brainstorming/visual-companion.md → visual-companion/references/guide.md} +1 -1
  90. package/skills/{brainstorming → visual-companion}/scripts/frame-template.html +42 -12
  91. package/skills/visual-companion/scripts/pages.cjs +28 -0
  92. package/skills/visual-companion/scripts/server-utils.cjs +82 -0
  93. package/skills/{brainstorming → visual-companion}/scripts/server.cjs +108 -248
  94. package/skills/{brainstorming → visual-companion}/scripts/start-server.sh +18 -4
  95. package/skills/visual-companion/scripts/websocket.cjs +86 -0
  96. package/skills/wayfinder/SKILL.md +57 -0
  97. package/commands/e2e.md +0 -28
  98. package/commands/evolve.md +0 -42
  99. package/commands/harness-audit.md +0 -27
  100. package/commands/instinct-status.md +0 -38
  101. package/commands/learn-eval.md +0 -91
  102. package/commands/projects.md +0 -27
  103. package/commands/promote.md +0 -29
  104. package/commands/prune.md +0 -46
  105. package/commands/tdd.md +0 -27
  106. package/homunculus/instincts/personal/always-test-first.md +0 -28
  107. package/homunculus/instincts/personal/pr-ci-quality-gate.md +0 -30
  108. package/rules/08-ecc-integration.md +0 -46
  109. package/rules/common/implementation.md +0 -25
  110. package/rules/common/security.md +0 -19
  111. package/skills/brainstorming/SKILL.md +0 -185
  112. package/skills/brainstorming/agents/openai.yaml +0 -3
  113. package/skills/brainstorming/spec-document-reviewer-prompt.md +0 -49
  114. package/skills/context-budget/SKILL.md +0 -59
  115. package/skills/discover-unknowns-zh/SKILL.md +0 -112
  116. package/skills/discover-unknowns-zh/agents/openai.yaml +0 -4
  117. package/skills/discover-unknowns-zh/references/prompt-patterns.md +0 -144
  118. package/skills/documentation-lookup/SKILL.md +0 -90
  119. package/skills/executing-plans/SKILL.md +0 -66
  120. package/skills/skill-creator/LICENSE.txt +0 -202
  121. package/skills/skill-creator/SKILL.md +0 -356
  122. package/skills/skill-creator/references/output-patterns.md +0 -82
  123. package/skills/skill-creator/references/workflows.md +0 -28
  124. package/skills/skill-creator/scripts/init_skill.py +0 -303
  125. package/skills/skill-creator/scripts/package_skill.py +0 -110
  126. package/skills/skill-creator/scripts/quick_validate.py +0 -95
  127. package/skills/subagent-driven-development/implementer-prompt.md +0 -139
  128. package/skills/subagent-driven-development/scripts/review-package +0 -44
  129. package/skills/subagent-driven-development/scripts/sdd-workspace +0 -22
  130. package/skills/subagent-driven-development/scripts/task-brief +0 -40
  131. package/skills/subagent-driven-development/task-reviewer-prompt.md +0 -188
  132. package/skills/writing-plans/SKILL.md +0 -206
  133. package/skills/writing-plans/plan-document-reviewer-prompt.md +0 -49
  134. /package/skills/{brainstorming → visual-companion}/scripts/helper.js +0 -0
  135. /package/skills/{brainstorming → visual-companion}/scripts/stop-server.sh +0 -0
@@ -1,33 +1,58 @@
1
1
  ---
2
2
  name: using-superpowers
3
- description: "Use when starting or routing a non-trivial task in this workflow harness, when the user references Superpowers, or when deciding which skill, command, rule, or agent should govern the work. Establishes skill invocation discipline: check relevant process skills before acting, follow user/project instructions first, and verify before completion."
3
+ description: "Route delivery work through an agent-selected direct, serial-ticket, or safe SDD topology; use grilling for unresolved user-owned decisions and Spec Gate for explicitly requested or costly-to-reverse work. Use at task start, after a process Skill returns an outcome, and whenever continuation ownership is unclear."
4
4
  ---
5
5
 
6
6
  # Using Superpowers
7
7
 
8
- This is the workflow router for the local Superpowers-inspired harness. It keeps action disciplined while respecting this repository's Chinese communication rules and Git boundaries.
8
+ Own routing and continuation for the workflow harness. Skills return outcomes here instead of directly invoking one another.
9
9
 
10
10
  ## Priority
11
11
 
12
12
  Follow instructions in this order:
13
13
 
14
- 1. User instructions, including direct requests, `AGENTS.md`, `CLAUDE.md`, and repo-local rules.
15
- 2. Applicable skills, commands, agents, and hooks from this repository.
16
- 3. Default agent behavior.
14
+ 1. User instructions, `AGENTS.md`, `CLAUDE.md`, and repository rules.
15
+ 2. Applicable process Skills, commands, agents, and hooks.
16
+ 3. Implementation Skills and default agent behavior.
17
17
 
18
- If a skill conflicts with explicit User instructions or project instructions, follow the user/project instruction and state the conflict if it affects the outcome.
18
+ If a Skill conflicts with an explicit higher-priority instruction, follow the higher-priority instruction and explain any material impact.
19
19
 
20
20
  ## Skill Invocation Rule
21
21
 
22
- Before taking action on a non-trivial task:
22
+ Before acting on a non-trivial task:
23
23
 
24
- 1. Decide whether a process skill applies.
25
- 2. Load the applicable skill before exploration, implementation, clarification, or final claims.
26
- 3. Announce briefly which skill is being used and why.
27
- 4. Follow the skill's gate, checklist, and verification requirements.
28
- 5. If the skill is not a fit after reading it, say so briefly and continue with the smallest suitable workflow.
24
+ 1. Classify explicit intent, high-risk boundaries, discoverable facts, and unresolved user-owned decisions.
25
+ 2. Load the narrowest applicable process Skill before exploration, implementation, clarification, or a final claim.
26
+ 3. Announce briefly which Skill is being used and why.
27
+ 4. Follow its gates, outcome contract, and verification requirements.
28
+ 5. Return here whenever continuation needs another Skill or path.
29
29
 
30
- Do not rely on memory of a skill. Skills evolve; use the current `SKILL.md` content.
30
+ Do not rely on memory of a Skill. Skills evolve; read the current `SKILL.md`.
31
+
32
+ Primary process definitions include `skills/grilling/SKILL.md`, `skills/spec-gate/SKILL.md`, `skills/systematic-debugging/SKILL.md`, and `skills/verification-before-completion/SKILL.md`.
33
+
34
+ ## Three Lanes
35
+
36
+ The workflow has three lanes:
37
+
38
+ ```text
39
+ direct
40
+ clear low-risk task -> implement -> proportionate verification
41
+
42
+ needs-decision
43
+ unresolved user-owned decision -> grilling inline -> route again
44
+
45
+ formal-spec
46
+ explicit formal Spec or high-risk boundary
47
+ -> grilling inline first only when a consequential decision is unresolved
48
+ -> spec-gate -> user review -> approved Spec
49
+ -> router selects delivery topology
50
+ -> durable ticket graph -> to-tickets -> user approves ticket contract
51
+ -> one coherent scope -> implement
52
+ -> independent frontier tickets without write overlap -> subagent-driven-development
53
+ ```
54
+
55
+ File count, a new-feature label, ordinary behavior change, and normal code complexity do not upgrade a task. They affect implementation and verification intensity only.
31
56
 
32
57
  ## Routing
33
58
 
@@ -35,40 +60,115 @@ Use process skills before implementation skills:
35
60
 
36
61
  ```text
37
62
  Task arrives
38
- -> unclear / high-risk / multi-file? -> brainstorming
39
- -> approved spec, no plan? -> writing-plans
40
- -> approved plan + SDD/commit approved? -> subagent-driven-development
41
- -> approved plan, no commit approval? -> executing-plans
42
- -> bug / failing test / unexpected result -> systematic-debugging
43
- -> behavior change with test path? -> test-driven-development
44
- -> dirty worktree / risky branch work? -> using-git-worktrees
45
- -> completion / fixed / ready claim? -> verification-before-completion
46
- -> external skill learning or edit? -> skill-creator + skills-learning
63
+ -> explicit workflow advice? -> workflow advice mode
64
+ -> explicit project-context setup request? -> project-context
65
+ -> explicit documented grilling request? -> grilling explicit + domain-modeling persistent mode
66
+ -> explicit grilling request? -> grilling explicit
67
+ -> explicit handoff or fresh session or prototype branch?
68
+ -> skills/handoff/SKILL.md
69
+ -> explicit triage request? -> skills/triage/SKILL.md
70
+ -> explicit TDD request? -> skills/test-driven-development/SKILL.md + agents/tdd-guide.md
71
+ -> explicit E2E or Playwright request? -> skills/e2e-testing/SKILL.md + agents/e2e-runner.md
72
+ -> explicit harness audit? -> agents/harness-optimizer.md
73
+ -> huge effort beyond one session? -> skills/wayfinder/SKILL.md
74
+ -> explicit architecture-health audit? -> skills/improve-codebase-architecture/SKILL.md
75
+ -> merge or rebase conflict? -> skills/resolving-merge-conflicts/SKILL.md
76
+ -> bug, failing test, or unexpected result? -> systematic-debugging
77
+ -> discoverable fact? -> inspect it; do not ask
78
+ -> primary-source research or cited research artifact? -> skills/research/SKILL.md
79
+ -> systematic evidence or blind-spot gap? -> iterative-retrieval
80
+ -> explicit prototype or runnable design question? -> skills/prototype/SKILL.md
81
+ -> unresolved user-owned decision? -> grilling inline
82
+ high-risk or explicit formal Spec context? -> resume_target: spec-gate
83
+ -> explicit formal Spec or high-risk boundary? -> spec-gate
84
+ -> delivery request in defined scope? -> select delivery topology
85
+ -> durable multi-session/tracker graph? -> skills/to-tickets/SKILL.md
86
+ -> independent frontier tickets with no overlapping write surface?
87
+ -> skills/subagent-driven-development/SKILL.md
88
+ -> otherwise -> skills/implement/SKILL.md
89
+ -> behavior change with a test path? -> test-driven-development
90
+ -> dirty worktree or risky branch work? -> consider using-git-worktrees
91
+ -> completion, fixed, or ready claim? -> verification-before-completion
92
+ -> skill discovery or install request? -> find-skills
93
+ -> external skill learning or edit? -> rules/common/skills-learning.md
94
+ -> otherwise -> shortest applicable loop
47
95
  ```
48
96
 
49
- - Complex, ambiguous, architectural, integration, high-risk, cross-file, or behavior-changing work: use `skills/brainstorming/SKILL.md` first.
50
- - Approved spec that needs an implementation plan: use `skills/writing-plans/SKILL.md`.
51
- - Approved plan with independent tasks and approved commit/PR/SDD handling: use `skills/subagent-driven-development/SKILL.md`.
52
- - Approved plan without commit handling or with tightly coupled tasks: use `skills/executing-plans/SKILL.md`.
53
- - Bug, failing test, flaky behavior, or unexpected result: use `skills/systematic-debugging/SKILL.md` before proposing a fix.
54
- - Behavior-changing implementation with a viable test path: use `skills/test-driven-development/SKILL.md`.
55
- - Risky branch work, dirty worktree, parallel effort, or PR cleanup: consider `skills/using-git-worktrees/SKILL.md`.
56
- - Completion, fixed, passing, ready, or PR-readiness claims: use `skills/verification-before-completion/SKILL.md`.
57
- - External skill learning or skill edits: use `skills/skill-creator/SKILL.md` and `rules/common/skills-learning.md`.
97
+ A high-risk boundary is a costly-to-reverse architecture or service boundary, public-contract compatibility, authentication or authorization boundary, persistent data/schema migration, or irreversible external side effect. Record this classification before grilling so its handoff can resume `spec-gate`.
58
98
 
59
- Then apply domain skills such as documentation lookup, E2E testing, or workflow engineering as needed.
99
+ ## Process Outcomes
60
100
 
61
- ## Red Flags
101
+ ### Workflow advice mode
102
+
103
+ 只返回推荐入口与原因、前置条件、需要补齐的用户决策或 Spec/tickets/map/handoff,以及直到
104
+ 审查和验证的闭环路径。不要调用下一 Skill、写文件或修改 tracker。
105
+
106
+ ### Agent-selected Delivery Topology
107
+
108
+ 用户要求完成一个定义明确的交付范围后,router 自行选择 `implement`、`to-tickets` 或
109
+ `subagent-driven-development`;选择依据是持续性、依赖图、写入面和验证成本,而不是用户是否记得某个
110
+ Skill 名称。开始时用一行说明所选拓扑及理由,然后继续执行。
111
+
112
+ - 一个可在当前上下文完成的连贯范围,使用 `implement`。
113
+ - 需要跨会话、tracker 或可恢复依赖图时,使用 `to-tickets`。这仍必须展示 ticket 的行为、验收标准与
114
+ blocker,并在发布前获得用户对 ticket contract 的批准。
115
+ - 只有至少两张已批准、无 blocker、写入面不重叠的 frontier tickets,才使用 SDD。不能安全并行时选择
116
+ 串行 `implement`,不要为了使用 subagent 人为拆票。
117
+
118
+ 用户的交付授权覆盖已批准范围内的本地实现与拓扑选择,不覆盖新的产品范围、未决用户决策、外部 tracker
119
+ mutation、commit、push、PR 或不可逆副作用。新的 frontier 只有仍在该授权范围内时才能由 router 再次选择
120
+ 执行拓扑。
121
+
122
+ ### Grilling handoff
62
123
 
63
- Stop and check skills before continuing if you think:
124
+ Read `Risk classification` and `Resume target`. A non-formal task returns to direct or another narrow process. A high-risk/formal task with `resume_target: spec-gate` enters a fresh Spec Gate call.
64
125
 
65
- - "This is just a quick code change."
66
- - "I need to inspect files before deciding."
67
- - "I remember what this skill says."
68
- - "The user asked for the outcome, so the workflow gate can be skipped."
69
- - "The verification should pass."
126
+ ### Spec Gate ready
127
+
128
+ `READY_FOR_USER_REVIEW` means the local artifact passed self-review but is not approved. Present the
129
+ path and wait for explicit approval. Approval returns control here; the router then selects a delivery
130
+ topology from the approved scope instead of waiting for the user to name the next Skill.
131
+
132
+ ### Cross-session handoff
133
+
134
+ When a prototype detour needs isolation or the current context is leaving its reliable reasoning zone,
135
+ recommend the `handoff` Skill and wait for explicit approval before creating the temporary document.
136
+ The handoff ends the current flow; a fresh session references the returned path and enters this router
137
+ again. Do not use handoff as a substitute for durable Specs, ADRs, tickets, or verification evidence.
138
+
139
+ ### Spec Gate blocked
140
+
141
+ `BLOCKED_BY_UNRESOLVED_DECISION` is terminal for the current call chain:
142
+
143
+ 1. Stop without drafting, guessing, or automatically invoking another Skill.
144
+ 2. Present a decision map: confirmed decisions, unresolved decision, and blocking point.
145
+ 3. Let the user choose to continue clarification, reduce scope, or exit the formal flow.
146
+ 4. Only an explicit choice to continue starts a new grilling session.
147
+ 5. After that session completes, route again into a new Spec Gate; do not resume the old call stack.
148
+
149
+ If the same confirmed `decision_id` blocks again with unchanged evidence, report a `Spec Gate contract conflict`. Do not repeat the question. Only reversal evidence or an invalidated premise can reopen the decision.
150
+
151
+ ### Spec Gate not applicable
152
+
153
+ `NOT_APPLICABLE` returns control here. Select the shortest applicable path without asking the originating Skill to recommend a successor.
154
+
155
+ ## Compatibility Alias
156
+
157
+ For one release cycle, interpret a user explicitly asking for the old name `brainstorming` as a formal Spec request. Explain that the entry moved to `/to-spec`; route through the same optional grilling and `spec-gate` path. Do not expose an old Skill shim or a second protocol source.
158
+
159
+ ## Red Flags
70
160
 
71
- These are usually signs that a process skill should shape the next step.
161
+ Stop and reassess if you are about to:
162
+
163
+ - ask for a fact that tools can discover;
164
+ - add grilling because a task is merely complex or multi-file;
165
+ - enter formal Spec Gate for an ordinary reversible change;
166
+ - let Spec Gate interview the user;
167
+ - automatically bounce from a blocked Spec Gate to grilling;
168
+ - select SDD without at least two safe, independent frontier tickets;
169
+ - treat a topology choice as approval for a ticket contract or an external mutation;
170
+ - continue implementation without an approved required Spec;
171
+ - claim completion without fresh verification evidence.
72
172
 
73
173
  ## Completion
74
174
 
@@ -0,0 +1,62 @@
1
+ ---
2
+ name: visual-companion
3
+ description: "Present mockups, diagrams, spatial relationships, and side-by-side visual options in a secured local browser companion. Use only when seeing the content materially improves understanding; require explicit user consent before starting the server or opening a URL, and combine with grilling when visual feedback represents a consequential user decision."
4
+ ---
5
+
6
+ # Visual Companion
7
+
8
+ Use the browser as a visual aid, not as a workflow mode or a second requirements engine.
9
+
10
+ ## Boundary
11
+
12
+ Use this Skill for UI mockups, architecture diagrams, visual hierarchy, spatial relationships, and side-by-side visual comparisons. Keep requirements, scope, technical trade-offs, text options, and discoverable facts in the terminal.
13
+
14
+ A task being visual, complex, or design-related is not sufficient. Use the companion only when seeing the content materially improves understanding over concise text.
15
+
16
+ ## Consent Gate
17
+
18
+ Obtain explicit user consent before starting the local server or opening a browser URL. The consent request must state what will be shown and that a local authenticated URL will open.
19
+
20
+ Without user consent, continue with text or static in-conversation visuals. Do not treat prior use in another task as current consent.
21
+
22
+ ## Ownership
23
+
24
+ - `grilling owns the decision loop` when browser feedback selects a consequential user-owned option.
25
+ - Spec Gate may show an already resolved design, support artifact review, or render a diagram with no new decision.
26
+ - Visual Companion does not own continuation, routing, requirements interviews, or approval gates.
27
+ - Return browser events and terminal feedback to the currently routed Skill.
28
+
29
+ ## Workflow
30
+
31
+ 1. Decide whether the next item is materially clearer when seen.
32
+ 2. Obtain user consent if the server is not already approved for this task.
33
+ 3. Read `references/guide.md` completely before starting or operating the companion.
34
+ 4. Start the server with `scripts/start-server.sh`, preserving the returned complete URL and state paths.
35
+ 5. Write one fresh visual screen, describe it briefly in the terminal, and wait for user feedback.
36
+ 6. Merge terminal feedback with authenticated browser events.
37
+ 7. Return the result to grilling, Spec Gate, or the current caller.
38
+ 8. Stop or leave a waiting screen when visual work ends.
39
+
40
+ ## Safety Invariants
41
+
42
+ - Always share the complete URL including `?key=`; never expose a bare host and port.
43
+ - Keep session key, HTTP/WebSocket authorization, restrictive response headers, owner-only state files, and same-origin checks enabled.
44
+ - Preserve the default four-hour idle timeout and same-port restart behavior.
45
+ - Do not bind a non-loopback host unless the user needs remote access and understands the exposure.
46
+ - Treat `.superpowers/brainstorm/` as local runtime state; do not stage or commit it.
47
+ - Fall back to the terminal when the server or browser is unavailable.
48
+
49
+ ## Outputs
50
+
51
+ Return only:
52
+
53
+ ```text
54
+ Visual result:
55
+ - screen shown
56
+ - terminal feedback
57
+ - relevant browser events
58
+ - confirmed visual choice, if any
59
+ - unresolved decision owner
60
+ ```
61
+
62
+ Do not infer approval from a click without reconciling it with the user's terminal response.
@@ -0,0 +1,4 @@
1
+ interface:
2
+ display_name: "Visual Companion"
3
+ short_description: "在本地安全浏览器中展示视觉方案与图示"
4
+ default_prompt: "使用 $visual-companion 展示适合视觉比较的方案,并在启动前征得同意。"
@@ -1,6 +1,6 @@
1
1
  # Visual Companion Guide
2
2
 
3
- Browser-based visual brainstorming companion for showing mockups, diagrams, and options.
3
+ Browser-based Visual Companion for showing mockups, diagrams, and options after explicit user consent.
4
4
 
5
5
  ## When to Use
6
6
 
@@ -2,10 +2,10 @@
2
2
  <html>
3
3
  <head>
4
4
  <meta charset="utf-8">
5
- <title>Superpowers Brainstorming</title>
5
+ <title>Superpowers Visual Companion</title>
6
6
  <style>
7
7
  /*
8
- * BRAINSTORM COMPANION FRAME TEMPLATE
8
+ * VISUAL COMPANION FRAME TEMPLATE
9
9
  *
10
10
  * This template provides a consistent frame with:
11
11
  * - OS-aware light/dark theming
@@ -63,15 +63,30 @@
63
63
  }
64
64
 
65
65
  /* ===== FRAME STRUCTURE ===== */
66
- .brand { display: flex; align-items: center; min-width: 0; overflow: hidden; color: var(--text-secondary); line-height: 1; }
67
- .brand a { color: inherit; text-decoration: none; display: flex; align-items: center; gap: 0.5rem; min-width: 0; max-width: 100%; line-height: 1; }
68
- .brand-copy { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1; transform: translateY(-1px); }
66
+ .brand {
67
+ display: flex; align-items: center; min-width: 0; overflow: hidden;
68
+ color: var(--text-secondary); line-height: 1;
69
+ }
70
+ .brand a {
71
+ color: inherit; text-decoration: none; display: flex; align-items: center;
72
+ gap: 0.5rem; min-width: 0; max-width: 100%; line-height: 1;
73
+ }
74
+ .brand-copy {
75
+ display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis;
76
+ white-space: nowrap; line-height: 1; transform: translateY(-1px);
77
+ }
69
78
  .brand-logo { display: block; height: 1em; width: auto; max-width: 180px; flex-shrink: 0; filter: invert(1); }
70
79
  @media (prefers-color-scheme: dark) {
71
80
  .brand-logo { filter: none; }
72
81
  }
73
- .status { font-size: 0.7rem; color: var(--status-color, var(--success)); display: flex; align-items: center; gap: 0.4rem; justify-self: end; white-space: nowrap; line-height: 1; }
74
- .status::before { content: ''; width: 6px; height: 6px; background: var(--status-color, var(--success)); border-radius: 50%; }
82
+ .status {
83
+ font-size: 0.7rem; color: var(--status-color, var(--success)); display: flex;
84
+ align-items: center; gap: 0.4rem; justify-self: end; white-space: nowrap; line-height: 1;
85
+ }
86
+ .status::before {
87
+ content: ''; width: 6px; height: 6px;
88
+ background: var(--status-color, var(--success)); border-radius: 50%;
89
+ }
75
90
 
76
91
  .main { flex: 1; overflow-y: auto; }
77
92
  #frame-content { padding: 2rem; min-height: 100%; }
@@ -103,7 +118,10 @@
103
118
  h3 { font-size: 1.1rem; font-weight: 600; margin-bottom: 0.25rem; }
104
119
  .subtitle { color: var(--text-secondary); margin-bottom: 1.5rem; }
105
120
  .section { margin-bottom: 2rem; }
106
- .label { font-size: 0.7rem; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.5rem; }
121
+ .label {
122
+ font-size: 0.7rem; color: var(--text-secondary); text-transform: uppercase;
123
+ letter-spacing: 0.05em; margin-bottom: 0.5rem;
124
+ }
107
125
 
108
126
  /* ===== OPTIONS (for A/B/C choices) ===== */
109
127
  .options { display: flex; flex-direction: column; gap: 0.75rem; }
@@ -145,7 +163,10 @@
145
163
  }
146
164
  .card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
147
165
  .card.selected { border-color: var(--selected-border); border-width: 2px; }
148
- .card-image { background: var(--bg-tertiary); aspect-ratio: 16/10; display: flex; align-items: center; justify-content: center; }
166
+ .card-image {
167
+ background: var(--bg-tertiary); aspect-ratio: 16/10;
168
+ display: flex; align-items: center; justify-content: center;
169
+ }
149
170
  .card-body { padding: 1rem; }
150
171
  .card-body h3 { margin-bottom: 0.25rem; }
151
172
  .card-body p { color: var(--text-secondary); font-size: 0.85rem; }
@@ -190,11 +211,20 @@
190
211
  }
191
212
 
192
213
  /* ===== INLINE MOCKUP ELEMENTS ===== */
193
- .mock-nav { background: var(--accent); color: white; padding: 0.75rem 1rem; display: flex; gap: 1.5rem; font-size: 0.9rem; }
214
+ .mock-nav {
215
+ background: var(--accent); color: white; padding: 0.75rem 1rem;
216
+ display: flex; gap: 1.5rem; font-size: 0.9rem;
217
+ }
194
218
  .mock-sidebar { background: var(--bg-tertiary); padding: 1rem; min-width: 180px; }
195
219
  .mock-content { padding: 1.5rem; flex: 1; }
196
- .mock-button { background: var(--accent); color: white; border: none; padding: 0.5rem 1rem; border-radius: 6px; font-size: 0.85rem; }
197
- .mock-input { background: var(--bg-primary); border: 1px solid var(--border); border-radius: 6px; padding: 0.5rem; width: 100%; }
220
+ .mock-button {
221
+ background: var(--accent); color: white; border: none;
222
+ padding: 0.5rem 1rem; border-radius: 6px; font-size: 0.85rem;
223
+ }
224
+ .mock-input {
225
+ background: var(--bg-primary); border: 1px solid var(--border);
226
+ border-radius: 6px; padding: 0.5rem; width: 100%;
227
+ }
198
228
  </style>
199
229
  </head>
200
230
  <body>
@@ -0,0 +1,28 @@
1
+ 'use strict';
2
+
3
+ const FORBIDDEN_PAGE = `<!DOCTYPE html>
4
+ <html>
5
+ <head><meta charset="utf-8"><title>Session key required</title>
6
+ <style>body { font-family: system-ui, sans-serif; padding: 2rem; max-width: 800px; margin: 0 auto; }
7
+ h1 { color: #333; } p { color: #666; } code { background: #f0f0f0; padding: 0.1em 0.3em;
8
+ border-radius: 4px; }</style>
9
+ </head>
10
+ <body><h1>Session key required</h1>
11
+ <p>This page needs the full URL your coding agent gave you, including the
12
+ <code>?key=&hellip;</code> part. Copy the complete URL and open it again.</p></body></html>`;
13
+
14
+ function bootstrapPage(key) {
15
+ const jsonKey = JSON.stringify(String(key));
16
+ return `<!DOCTYPE html>
17
+ <html>
18
+ <head><meta charset="utf-8"><title>Opening Brainstorm Companion</title></head>
19
+ <body>
20
+ <script>
21
+ try { sessionStorage.setItem('brainstorm-session-key', ${jsonKey}); } catch (e) {}
22
+ location.replace('/');
23
+ </script>
24
+ </body>
25
+ </html>`;
26
+ }
27
+
28
+ module.exports = { FORBIDDEN_PAGE, bootstrapPage };
@@ -0,0 +1,82 @@
1
+ 'use strict';
2
+
3
+ const crypto = require('crypto');
4
+
5
+ function urlHostForHttp(host) {
6
+ const normalized = String(host);
7
+ if (normalized.startsWith('[') && normalized.endsWith(']')) return normalized;
8
+ return normalized.includes(':') ? '[' + normalized + ']' : normalized;
9
+ }
10
+
11
+ function browserLauncherForPlatform(url, options = {}) {
12
+ const platform = options.platform || process.platform;
13
+ const osRelease = options.osRelease || require('os').release();
14
+ const env = options.env || process.env;
15
+ const isWSL = platform === 'linux' && /microsoft/i.test(osRelease);
16
+
17
+ if (platform === 'darwin') return { bin: 'open', args: [url] };
18
+ if (platform === 'win32' || isWSL) {
19
+ return { bin: 'rundll32.exe', args: ['url.dll,FileProtocolHandler', url] };
20
+ }
21
+ if (env.DISPLAY || env.WAYLAND_DISPLAY) return { bin: 'xdg-open', args: [url] };
22
+ return null;
23
+ }
24
+
25
+ function timingSafeEqualStr(left, right) {
26
+ const leftBuffer = Buffer.from(String(left));
27
+ const rightBuffer = Buffer.from(String(right));
28
+ if (leftBuffer.length !== rightBuffer.length) return false;
29
+ return crypto.timingSafeEqual(leftBuffer, rightBuffer);
30
+ }
31
+
32
+ function parseCookies(header) {
33
+ const output = {};
34
+ if (!header) return output;
35
+ for (const part of header.split(';')) {
36
+ const separator = part.indexOf('=');
37
+ if (separator < 0) continue;
38
+ output[part.slice(0, separator).trim()] = part.slice(separator + 1).trim();
39
+ }
40
+ return output;
41
+ }
42
+
43
+ function pathnameOf(url) {
44
+ const queryIndex = url.indexOf('?');
45
+ return queryIndex >= 0 ? url.slice(0, queryIndex) : url;
46
+ }
47
+
48
+ function queryKey(url) {
49
+ const queryIndex = url.indexOf('?');
50
+ if (queryIndex < 0) return null;
51
+ return new URLSearchParams(url.slice(queryIndex + 1)).get('key');
52
+ }
53
+
54
+ function securityHeaders(headers = {}) {
55
+ return {
56
+ 'Referrer-Policy': 'no-referrer',
57
+ 'Cache-Control': 'no-store',
58
+ 'X-Frame-Options': 'DENY',
59
+ 'Content-Security-Policy': "frame-ancestors 'none'",
60
+ 'Cross-Origin-Resource-Policy': 'same-origin',
61
+ ...headers,
62
+ };
63
+ }
64
+
65
+ function isAllowedWebSocketOrigin(req) {
66
+ const origin = req.headers.origin;
67
+ if (!origin) return true;
68
+ const host = req.headers.host;
69
+ if (!host) return false;
70
+ return origin === 'http://' + host;
71
+ }
72
+
73
+ module.exports = {
74
+ urlHostForHttp,
75
+ browserLauncherForPlatform,
76
+ timingSafeEqualStr,
77
+ parseCookies,
78
+ pathnameOf,
79
+ queryKey,
80
+ securityHeaders,
81
+ isAllowedWebSocketOrigin,
82
+ };