compass-st 1.1.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 (118) hide show
  1. package/README.md +105 -0
  2. package/VERSION +1 -0
  3. package/bin/install +174 -0
  4. package/bootstrap.sh +95 -0
  5. package/cli/Cargo.lock +270 -0
  6. package/cli/Cargo.toml +24 -0
  7. package/cli/src/cmd/context.rs +59 -0
  8. package/cli/src/cmd/dag.rs +133 -0
  9. package/cli/src/cmd/git.rs +148 -0
  10. package/cli/src/cmd/hook.rs +51 -0
  11. package/cli/src/cmd/index.rs +363 -0
  12. package/cli/src/cmd/manifest.rs +34 -0
  13. package/cli/src/cmd/memory.rs +680 -0
  14. package/cli/src/cmd/migrate.rs +790 -0
  15. package/cli/src/cmd/mod.rs +14 -0
  16. package/cli/src/cmd/progress.rs +107 -0
  17. package/cli/src/cmd/project.rs +1700 -0
  18. package/cli/src/cmd/session.rs +64 -0
  19. package/cli/src/cmd/state.rs +317 -0
  20. package/cli/src/cmd/validate/mod.rs +506 -0
  21. package/cli/src/cmd/validate/prd.rs +472 -0
  22. package/cli/src/cmd/version.rs +89 -0
  23. package/cli/src/helpers.rs +40 -0
  24. package/cli/src/main.rs +75 -0
  25. package/cli/tests/fixtures/plan_empty_pointers.json +60 -0
  26. package/cli/tests/fixtures/plan_missing_pointers.json +59 -0
  27. package/cli/tests/fixtures/plan_too_many_pointers.json +92 -0
  28. package/cli/tests/fixtures/plan_v1_valid.json +64 -0
  29. package/cli/tests/fixtures/prd_bad_flow_bullet.md +37 -0
  30. package/cli/tests/fixtures/prd_bad_flow_prose.md +33 -0
  31. package/cli/tests/fixtures/prd_good_flow.md +41 -0
  32. package/cli/tests/fixtures/prd_xref_dangling.md +38 -0
  33. package/cli/tests/fixtures/prd_xref_valid.md +53 -0
  34. package/cli/tests/fixtures/projects/proj_a/.compass/.state/config.json +12 -0
  35. package/cli/tests/fixtures/projects/proj_b/.compass/.state/config.json +12 -0
  36. package/cli/tests/fixtures/projects/proj_c/.compass/.state/config.json +12 -0
  37. package/cli/tests/fixtures/registry/all_dead.json +18 -0
  38. package/cli/tests/fixtures/registry/corrupt.json +1 -0
  39. package/cli/tests/fixtures/registry/empty.json +1 -0
  40. package/cli/tests/fixtures/registry/last_active_dead.json +24 -0
  41. package/cli/tests/fixtures/registry/multi_alive.json +24 -0
  42. package/cli/tests/fixtures/registry/one_alive.json +12 -0
  43. package/cli/tests/fixtures/v0_project/.compass/.state/config.json +5 -0
  44. package/cli/tests/fixtures/v0_project/.compass/.state/sessions/onboarding-redesign/plan.json +29 -0
  45. package/cli/tests/fixtures/v0_project/.compass/.state/sessions/sample-feature/context.json +11 -0
  46. package/cli/tests/fixtures/v0_project/.compass/.state/sessions/sample-feature/plan.json +49 -0
  47. package/core/colleagues/base-rules.md +112 -0
  48. package/core/colleagues/manifest.json +85 -0
  49. package/core/colleagues/market-analyst.md +50 -0
  50. package/core/colleagues/prioritizer.md +53 -0
  51. package/core/colleagues/researcher.md +54 -0
  52. package/core/colleagues/reviewer.md +55 -0
  53. package/core/colleagues/stakeholder-comm.md +59 -0
  54. package/core/colleagues/story-breaker.md +57 -0
  55. package/core/colleagues/ux-reviewer.md +54 -0
  56. package/core/colleagues/writer.md +55 -0
  57. package/core/commands/compass/brief.md +28 -0
  58. package/core/commands/compass/check.md +27 -0
  59. package/core/commands/compass/epic.md +32 -0
  60. package/core/commands/compass/feedback.md +32 -0
  61. package/core/commands/compass/help.md +24 -0
  62. package/core/commands/compass/ideate.md +32 -0
  63. package/core/commands/compass/init.md +30 -0
  64. package/core/commands/compass/plan.md +27 -0
  65. package/core/commands/compass/prd.md +39 -0
  66. package/core/commands/compass/prioritize.md +36 -0
  67. package/core/commands/compass/prototype.md +28 -0
  68. package/core/commands/compass/release.md +32 -0
  69. package/core/commands/compass/research.md +31 -0
  70. package/core/commands/compass/roadmap.md +32 -0
  71. package/core/commands/compass/run.md +28 -0
  72. package/core/commands/compass/setup.md +32 -0
  73. package/core/commands/compass/sprint.md +32 -0
  74. package/core/commands/compass/status.md +32 -0
  75. package/core/commands/compass/story.md +37 -0
  76. package/core/commands/compass/undo.md +33 -0
  77. package/core/commands/compass/update.md +29 -0
  78. package/core/hooks/context-monitor.sh +5 -0
  79. package/core/hooks/manifest-tracker.sh +62 -0
  80. package/core/hooks/statusline.sh +12 -0
  81. package/core/hooks/update-checker.sh +24 -0
  82. package/core/integrations/confluence.md +267 -0
  83. package/core/integrations/figma.md +277 -0
  84. package/core/integrations/jira.md +436 -0
  85. package/core/integrations/vercel.md +170 -0
  86. package/core/manifest.json +172 -0
  87. package/core/shared/SCHEMAS-v1.md +404 -0
  88. package/core/shared/progress.md +145 -0
  89. package/core/shared/project-scan.md +293 -0
  90. package/core/shared/resolve-project.md +136 -0
  91. package/core/shared/ux-rules.md +52 -0
  92. package/core/shared/version-backup.md +38 -0
  93. package/core/templates/prd-template.md +145 -0
  94. package/core/templates/story-template.md +99 -0
  95. package/core/workflows/brief.md +184 -0
  96. package/core/workflows/check.md +436 -0
  97. package/core/workflows/epic.md +177 -0
  98. package/core/workflows/feedback.md +164 -0
  99. package/core/workflows/help.md +79 -0
  100. package/core/workflows/ideate.md +320 -0
  101. package/core/workflows/init.md +524 -0
  102. package/core/workflows/migrate.md +136 -0
  103. package/core/workflows/plan.md +320 -0
  104. package/core/workflows/prd.md +632 -0
  105. package/core/workflows/prioritize.md +301 -0
  106. package/core/workflows/project.md +177 -0
  107. package/core/workflows/prototype.md +174 -0
  108. package/core/workflows/release.md +179 -0
  109. package/core/workflows/research.md +613 -0
  110. package/core/workflows/roadmap.md +152 -0
  111. package/core/workflows/run.md +367 -0
  112. package/core/workflows/setup.md +294 -0
  113. package/core/workflows/sprint.md +187 -0
  114. package/core/workflows/status.md +185 -0
  115. package/core/workflows/story.md +477 -0
  116. package/core/workflows/undo.md +42 -0
  117. package/core/workflows/update.md +127 -0
  118. package/package.json +37 -0
@@ -0,0 +1,277 @@
1
+ # Integration: Figma
2
+
3
+ **Purpose**: Set up (or verify) Figma integration for Compass. Figma gives Compass read-access to design files so PRDs and stories can reference real design context, component names, and screenshots.
4
+
5
+ **Caller**: `/compass:setup figma`, `/compass:setup verify-figma`, or the integrations wizard inside `/compass:init` (Phase C).
6
+
7
+ **Output**:
8
+ - Updates `~/.config/compass/integrations.json` — `integrations.figma`
9
+ - May add a server entry to `~/.claude/mcp.json` or `~/.config/opencode/opencode.jsonc`
10
+ - Never stores the Figma token in Compass files. Token lives only in the host MCP config as an env var.
11
+
12
+ ---
13
+
14
+ ## Step 0 — Language
15
+
16
+ Read `.compass/.state/config.json` if it exists and load `lang` (default `en`).
17
+
18
+ **Language enforcement**: all user-facing chat text below uses `lang`. JSON keys stay in English.
19
+
20
+ ## Step 1 — Detect host
21
+
22
+ Same procedure as Jira workflow Step 1 — detect RUNNING host (check `claude` CLI for Claude Code, check opencode directory for OpenCode). Do NOT assume Claude Code just because `~/.claude/` exists — that directory may exist from Compass adapter install only.
23
+
24
+ ## Step 2 — Parse mode
25
+
26
+ | Mode | Trigger |
27
+ |---|---|
28
+ | `setup` | `/compass:setup figma` or init wizard |
29
+ | `verify` | `/compass:setup verify-figma` |
30
+ | `reset` | `/compass:setup reset figma` |
31
+
32
+ ## Step 3 — Probe for the Figma MCP tool
33
+
34
+ The official Figma MCP from claude.ai exposes `mcp__claude_ai_Figma__whoami`. Community alternatives (e.g. `figma-developer-mcp`) expose `mcp__figma__get_me` or similar. Try each known tool name in order:
35
+
36
+ 1. `mcp__claude_ai_Figma__whoami`
37
+ 2. `mcp__figma__whoami` / `mcp__figma__get_me`
38
+
39
+ - If NONE of these tools exist in the tool list → Figma MCP is not loaded. Jump to **Step 5 (install from scratch)**.
40
+ - If a tool exists → call it with no arguments. On success, the integration is live. Jump to **Step 4**.
41
+ - On failure (401, network, bad token) → show error, ask the PO: "Re-configure now? (Yes / Skip)".
42
+
43
+ ## Step 4 — Already configured path
44
+
45
+ 1. Display (in `lang`):
46
+ ```
47
+ ✓ Figma is already configured
48
+ User: <display_name>
49
+ Email: <email>
50
+ Host: <HOST>
51
+ ```
52
+
53
+ 2. Ask the PO (optional, skip-able):
54
+ ```
55
+ Default Figma team URL for this repo? (optional, press Enter to skip)
56
+ ```
57
+
58
+ 3. Update `integrations.figma`:
59
+ ```json
60
+ {
61
+ "status": "configured",
62
+ "configured_at": "<existing or now>",
63
+ "verified_at": "<now ISO>",
64
+ "host": "<HOST>",
65
+ "user": "<email>",
66
+ "team": "<team URL or null>",
67
+ "mcp_package": "<existing or unknown>",
68
+ "notes": ""
69
+ }
70
+ ```
71
+
72
+ 4. Atomically write.
73
+
74
+ 5. Stop.
75
+
76
+ ## Step 5 — Install from scratch (5 sub-steps)
77
+
78
+ ### 5.1 — Explain why (1/5)
79
+
80
+ ```
81
+ Compass wants Figma for:
82
+ • Reading design file context when writing PRDs (component names, screenshots)
83
+ • Linking stories to specific frames and nodes
84
+ • Pulling design tokens and rules into spec files
85
+
86
+ Read-only. Compass will not modify your Figma files.
87
+ Setup takes about 2 minutes.
88
+
89
+ Continue? (Yes / Skip)
90
+ ```
91
+
92
+ If Skip → save status `skipped`, return to caller.
93
+
94
+ ### 5.2 — Create Personal Access Token (2/5)
95
+
96
+ Try to auto-open the settings page:
97
+
98
+ ```bash
99
+ open "https://www.figma.com/settings" 2>/dev/null || xdg-open "https://www.figma.com/settings" 2>/dev/null || start "https://www.figma.com/settings" 2>/dev/null || true
100
+ ```
101
+
102
+ Then show the instructions in a formatted block (same style as the integration summary table — indented, clean, with visual markers):
103
+
104
+ - en:
105
+ ```
106
+ Figma Personal Access Token
107
+
108
+ ① Open figma.com → click your Avatar (top-right)
109
+ ② Settings → Security
110
+ ③ "Personal access tokens" → Generate new token
111
+ ④ Name: compass-figma
112
+ ⑤ Expiration: No expiration (recommended)
113
+ ⑥ Scopes: Enable ALL scopes (full access)
114
+ ⑦ Click "Generate token"
115
+ ⑧ Copy the token NOW — Figma only shows it once!
116
+
117
+ Can't find it? Go to: https://www.figma.com/settings
118
+ Then scroll to Security → Personal access tokens
119
+ ```
120
+
121
+ - vi:
122
+ ```
123
+ Tạo Figma Personal Access Token
124
+
125
+ ① Mở figma.com → click Avatar (góc phải trên)
126
+ ② Settings → Security
127
+ ③ "Personal access tokens" → Generate new token
128
+ ④ Tên: compass-figma
129
+ ⑤ Hết hạn: No expiration (khuyến nghị)
130
+ ⑥ Scopes: Bật TẤT CẢ scopes (full access)
131
+ ⑦ Click "Generate token"
132
+ ⑧ Copy token NGAY — Figma chỉ hiện 1 lần!
133
+
134
+ Không tìm thấy? Vào: https://www.figma.com/settings
135
+ Rồi cuộn tới Security → Personal access tokens
136
+ ```
137
+
138
+ Wait for PO to confirm they have the token before continuing.
139
+
140
+ Wait for the PO to confirm they have the token.
141
+
142
+ ### 5.3 — Collect metadata (3/5)
143
+
144
+ Ask:
145
+
146
+ 1. `Figma account email? (e.g. you@company.com)`
147
+ 2. `Personal Access Token? (will NOT be stored in Compass, only in the host MCP config)`
148
+ 3. `Default team URL? (optional, e.g. https://www.figma.com/files/team/123456/Acme)`
149
+
150
+ Validate:
151
+ - Email contains `@`.
152
+ - Token is non-empty and looks like a Figma token (starts with `figd_` or is a long alphanumeric string; don't hard-fail on format, just warn if it's < 20 chars). Token must have been created with full scopes enabled.
153
+
154
+ ### 5.4 — Install the MCP server (4/5)
155
+
156
+ Two common options:
157
+
158
+ 1. **Official claude.ai Figma MCP** — may already ship with Claude Code. If the tool list contained `mcp__claude_ai_Figma__*` earlier but auth failed, the server is present; only the token is missing. In that case, the PO needs to add the token to the existing entry instead of a new package install.
159
+ 2. **Community `figma-developer-mcp`** — npm package, works on any host.
160
+
161
+ Ask:
162
+
163
+ ```
164
+ Step 4/5 — Install the MCP server
165
+
166
+ Recommended: figma-developer-mcp (community, works on all hosts)
167
+ Alternative: skip install — I already have the claude.ai Figma MCP
168
+
169
+ Install figma-developer-mcp via npm? (Yes / Skip install)
170
+ ```
171
+
172
+ If Yes:
173
+
174
+ ```bash
175
+ npm install -g figma-developer-mcp 2>&1
176
+ ```
177
+
178
+ Handle errors the same way as the Jira workflow (npm missing, EACCES, network, 404).
179
+
180
+ If Skip install, ask for the package name the PO wants Compass to reference (e.g. `claude_ai_Figma`) and use that string as `mcp_package`.
181
+
182
+ ### 5.5 — Edit the host MCP config (5/5)
183
+
184
+ Locate file (Claude Code: `~/.claude/mcp.json`, OpenCode: `~/.config/opencode/opencode.jsonc`).
185
+
186
+ 1. Back up before editing.
187
+ 2. Parse.
188
+ 3. Merge entry keyed `figma`:
189
+
190
+ ```json
191
+ "figma": {
192
+ "command": "npx",
193
+ "args": ["-y", "figma-developer-mcp"],
194
+ "env": {
195
+ "FIGMA_API_KEY": "<token>"
196
+ }
197
+ }
198
+ ```
199
+
200
+ If a key `figma` already exists, ask: "Overwrite? / Rename to figma-compass / Cancel".
201
+
202
+ 4. Write back.
203
+ 5. `chmod 600 <config file>`.
204
+ 6. Show the PO a redacted preview:
205
+
206
+ ```json
207
+ "figma": {
208
+ "command": "npx",
209
+ "args": ["-y", "figma-developer-mcp"],
210
+ "env": { "FIGMA_API_KEY": "<REDACTED>" }
211
+ }
212
+ ```
213
+
214
+ If edit fails, save status `error`, tell the PO to edit manually, give them the raw block.
215
+
216
+ ## Step 6 — Save status + handle restart
217
+
218
+ Write `integrations.figma`:
219
+
220
+ ```json
221
+ {
222
+ "status": "configured",
223
+ "configured_at": "<now ISO>",
224
+ "verified_at": null,
225
+ "host": "<HOST>",
226
+ "user": "<email>",
227
+ "team": "<team URL or null>",
228
+ "mcp_package": "figma-developer-mcp",
229
+ "notes": ""
230
+ }
231
+ ```
232
+
233
+ **Try to verify immediately** — call the Figma MCP tool. If it works → set `verified_at`, show `"✓ Figma connected and verified!"`. Continue flow.
234
+
235
+ If verify fails (needs restart):
236
+
237
+ ```
238
+ ✓ Figma MCP configured.
239
+
240
+ Note: MCP server will be available after you restart <HOST_NAME>.
241
+ Run /compass:setup verify-figma after restart to confirm.
242
+ ```
243
+
244
+ Use ACTUAL host name ("Claude Code" or "OpenCode"). Do NOT break the init flow — PO finishes init first, restarts later.
245
+
246
+ ## Step 7 — Verify mode
247
+
248
+ 1. Re-probe the Figma tool (Step 3).
249
+ 2. On success: update `status` = `configured`, `verified_at` = now ISO, `user` = profile user. Show confirmation.
250
+ 3. On failure: show error + troubleshooting:
251
+
252
+ | Symptom | Fix |
253
+ |---|---|
254
+ | Tool not in tool list | Restart your AI host (close and reopen). |
255
+ | 403 / invalid token | Token expired or revoked. Re-run `/compass:setup figma`. |
256
+ | Timeout | Network issue — retry. |
257
+
258
+ Mark status `error`.
259
+
260
+ ## Step 8 — Status file shape
261
+
262
+ Same file as Jira: `~/.config/compass/integrations.json`. Only touch the `figma` sub-object. Preserve everything else. Atomic write (tmp + mv). Update `updated_at`.
263
+
264
+ Valid `status` values: `configured`, `configured-pending-verify`, `skipped`, `not-configured`, `error`.
265
+
266
+ ## Save session
267
+
268
+ Same as Jira — only if invoked via `/compass:setup`, write to `.compass/.state/sessions/<timestamp>-setup-figma/transcript.md`. Never log the token.
269
+
270
+ ## Edge cases
271
+
272
+ - **Figma free account**: API tokens work on free accounts with read-only scopes — no paid plan required.
273
+ - **Token works but file access fails later**: Figma tokens are user-scoped. The PO must have access to the files they want Compass to read. Note this in the final confirmation.
274
+ - **No "default project" concept**: Figma work is file-by-file; Compass does not store a single default. The `team` field is optional and only used to suggest starting points.
275
+ - **Claude Code bundled Figma MCP already present**: the tool `mcp__claude_ai_Figma__whoami` will work without any install. Compass should detect it and skip the install step entirely.
276
+ - **Both MCPs installed at the same time**: that's fine — Compass uses whichever tool responds first. Record the one that succeeded as `mcp_package`.
277
+ - **chmod fails**: warn the PO that the file contains a token but permissions could not be locked.