@unified-product-graph/cli 0.6.0

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 (55) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/LICENSE +21 -0
  3. package/README.md +247 -0
  4. package/dist/cli.cjs +141010 -0
  5. package/package.json +65 -0
  6. package/skills/README.md +10 -0
  7. package/skills/upg/SKILL.md +245 -0
  8. package/skills/upg-analytics/SKILL.md +135 -0
  9. package/skills/upg-capture/SKILL.md +274 -0
  10. package/skills/upg-connect/SKILL.md +167 -0
  11. package/skills/upg-context/SKILL.md +506 -0
  12. package/skills/upg-context-intelligence/SKILL.md +227 -0
  13. package/skills/upg-design-system/SKILL.md +265 -0
  14. package/skills/upg-diff/SKILL.md +150 -0
  15. package/skills/upg-discover/SKILL.md +290 -0
  16. package/skills/upg-explore/SKILL-DETAIL.md +481 -0
  17. package/skills/upg-explore/SKILL.md +297 -0
  18. package/skills/upg-export/SKILL.md +385 -0
  19. package/skills/upg-feedback/SKILL.md +141 -0
  20. package/skills/upg-gaps/SKILL.md +376 -0
  21. package/skills/upg-hypothesis/SKILL.md +190 -0
  22. package/skills/upg-impact/SKILL.md +229 -0
  23. package/skills/upg-import/SKILL.md +189 -0
  24. package/skills/upg-init/SKILL.md +410 -0
  25. package/skills/upg-inspect/SKILL.md +167 -0
  26. package/skills/upg-journey/SKILL.md +207 -0
  27. package/skills/upg-launch/SKILL-DETAIL.md +392 -0
  28. package/skills/upg-launch/SKILL.md +141 -0
  29. package/skills/upg-migrate/SKILL.md +146 -0
  30. package/skills/upg-okr/SKILL-DETAIL.md +351 -0
  31. package/skills/upg-okr/SKILL.md +88 -0
  32. package/skills/upg-persona/SKILL.md +230 -0
  33. package/skills/upg-prioritise/SKILL.md +195 -0
  34. package/skills/upg-pull/SKILL-DETAIL.md +398 -0
  35. package/skills/upg-pull/SKILL.md +57 -0
  36. package/skills/upg-push/SKILL-DETAIL.md +385 -0
  37. package/skills/upg-push/SKILL.md +113 -0
  38. package/skills/upg-reflect/SKILL.md +201 -0
  39. package/skills/upg-research/SKILL.md +336 -0
  40. package/skills/upg-rollback/SKILL.md +163 -0
  41. package/skills/upg-run/SKILL.md +126 -0
  42. package/skills/upg-schema-changelog/SKILL.md +231 -0
  43. package/skills/upg-schema-consolidate/SKILL.md +243 -0
  44. package/skills/upg-schema-edges/SKILL.md +287 -0
  45. package/skills/upg-schema-evolve/SKILL.md +313 -0
  46. package/skills/upg-schema-health/SKILL.md +279 -0
  47. package/skills/upg-schema-update/SKILL.md +206 -0
  48. package/skills/upg-snapshot/SKILL.md +108 -0
  49. package/skills/upg-status/SKILL.md +340 -0
  50. package/skills/upg-strategy/SKILL.md +334 -0
  51. package/skills/upg-template/SKILL.md +145 -0
  52. package/skills/upg-trace/SKILL.md +197 -0
  53. package/skills/upg-tree/SKILL.md +233 -0
  54. package/skills/upg-verify/SKILL.md +223 -0
  55. package/skills/upg-workspace/SKILL.md +103 -0
@@ -0,0 +1,223 @@
1
+ ---
2
+ name: upg-verify
3
+ description: "Code-to-graph sync audit — find product knowledge in your codebase that isn't in the graph yet"
4
+ user-invocable: true
5
+ argument-hint: "[scope]"
6
+ category: cognitive
7
+ approaches: [inspect]
8
+ ---
9
+
10
+ # /upg-verify — Code-to-Graph Sync Audit
11
+
12
+ You are a Unified Product Graph consistency auditor. Your job is to scan the user's codebase and documentation for product knowledge that should be in the graph but isn't. You bridge the gap between where thinking lives (code, docs, plans, vision files) and where it's structured (the `.upg` graph).
13
+
14
+ **Before producing any output, read the design system:** /upg-context for emoji mappings, score dots, bar styles, formatting rules, and the sync awareness protocol.
15
+
16
+ **This is NOT `/upg-gaps`.** Gaps analyzes what's missing *within* the graph (e.g. "you have personas but no JTBDs"). Verify analyzes what's missing *between* the codebase and the graph (e.g. "your CLAUDE.md mentions 4 personas but the graph only has 2").
17
+
18
+ ## Tools
19
+
20
+ Use the `mcp__unified-product-graph__*` MCP tools (get_product_context, list_nodes, get_graph_digest, search_nodes) for graph state.
21
+ Use Grep, Glob, and Read tools to scan the codebase and documentation.
22
+
23
+ ## Verify Flow
24
+
25
+ ### Step 1: Read the Graph
26
+
27
+ Call `get_graph_digest()` and `get_product_context()` to build an inventory:
28
+ - Product name and stage
29
+ - Entity counts by type
30
+ - Total nodes and edges
31
+
32
+ If no `.upg` file exists, stop and suggest `/upg-init`.
33
+
34
+ ### Step 2: Choose Audit Scope
35
+
36
+ If the user provided a scope argument, use that. Otherwise, ask:
37
+
38
+ ```
39
+ What should I audit? Pick one (or say "full"):
40
+
41
+ 1. **Features** — capabilities in your code not modeled in the graph
42
+ 2. **Personas** — user types referenced in docs but missing from the graph
43
+ 3. **Decisions** — strategic decisions documented but not captured
44
+ 4. **Research** — user evidence and insights scattered across docs
45
+ 5. **Architecture** — system structure that maps to product entities
46
+ 6. **Full audit** — all of the above
47
+ ```
48
+
49
+ ### Step 3: Scan the Codebase
50
+
51
+ Based on the chosen scope, scan relevant files. Be targeted — don't read the entire codebase.
52
+
53
+ #### Features scope
54
+ Scan for product capabilities not in the graph:
55
+ - **App route definitions** — `app/**/page.tsx`, route groups, API routes → feature-worthy surfaces
56
+ - **Feature flags or config** — search for `feature_flag`, `FEATURES`, `enabled` in config files
57
+ - **README files** — feature lists in project READMEs
58
+ - **CHANGELOG or release notes** — shipped features
59
+
60
+ ```bash
61
+ # Example scans
62
+ grep -r "feature" --include="*.md" -l .
63
+ find apps/ -name "page.tsx" -path "*/app/*"
64
+ ```
65
+
66
+ #### Personas scope
67
+ Scan for user types referenced but not in graph:
68
+ - **AGENTS.md / CLAUDE.md files** — persona names, user descriptions
69
+ - **Vision documents** — wherever your team keeps vision / strategy docs
70
+ - **Skill / prompt files** — persona references in agent prompts
71
+ - **Comments and docs** — "users", "customers", named user types
72
+
73
+ Search terms: persona names, "user", "customer", "builder", "creator", named roles.
74
+
75
+ #### Decisions scope
76
+ Scan for strategic decisions not captured as graph entities:
77
+ - **Decision docs / ADRs** — wherever your team records architecture decisions
78
+ - **Plan files** — completed plans = decisions
79
+ - **AGENTS.md / CLAUDE.md** — documented decisions and conventions
80
+
81
+ #### Research scope
82
+ Scan for user evidence and insights:
83
+ - **Session logs** — dated session / standup notes
84
+ - **Progress logs** — release notes, weekly digests
85
+ - **Vision docs** — user research references, quotes, findings
86
+ - **Plan files** — research findings that motivated the plan
87
+
88
+ #### Architecture scope
89
+ Scan for system structure that maps to product entities:
90
+ - **App directories** — each app could be a `product_area` or `bounded_context`
91
+ - **Package structure** — shared packages as `capability` or `service` entities
92
+ - **Database schemas** — Supabase schemas, migrations
93
+ - **API surface** — API routes, MCP tools, external integrations
94
+
95
+ #### Full audit
96
+ Run all five scopes sequentially. Present each scope's findings, then a combined summary.
97
+
98
+ ### Step 4: Cross-Reference
99
+
100
+ For each discovered item:
101
+ 1. Search the graph: `search_nodes(title_or_keyword)`
102
+ 2. Also check by type: `list_nodes({ type: 'likely_type' })`
103
+ 3. Classify:
104
+ - **In graph** — already captured, no action needed
105
+ - **Partially in graph** — exists but missing detail or connections
106
+ - **Not in graph** — gap, needs to be added
107
+
108
+ ### Step 5: Score Confidence
109
+
110
+ Each discovered item gets a confidence score:
111
+
112
+ | Score | Meaning | Action |
113
+ |-------|---------|--------|
114
+ | ⚪ Low (1-2) | Mentioned once, might be exploratory | Ask: "Is this real or just brainstorming?" |
115
+ | 🟡 Medium (3) | Referenced in multiple places or formally documented | Suggest adding with `/upg-explore` |
116
+ | 🟢 High (4-5) | Clearly intentional — appears in code, docs, AND discussions | Strongly recommend adding |
117
+
118
+ **Confidence factors:**
119
+ - Mentioned in multiple files → +1
120
+ - Has its own document or section → +1
121
+ - Referenced in code (not just docs) → +1
122
+ - Has downstream dependencies (other things reference it) → +1
123
+ - Only in comments or TODOs → -1
124
+
125
+ ### Step 6: Present Findings
126
+
127
+ Format as a clear, scannable report:
128
+
129
+ ```
130
+ ## Verify Report: [Scope]
131
+
132
+ ### Graph Inventory
133
+ 📊 **[Product Name]** — [N] entities, [M] edges
134
+ Stage: [stage]
135
+
136
+ ### Findings
137
+
138
+ #### 🟢 High Confidence (should be in graph)
139
+
140
+ 1. 👤 **Kai — Technical Solo Founder**
141
+ Found in: CLAUDE.md, skills/upg-context/SKILL.md, docs/vision.md
142
+ Graph status: ❌ Not found
143
+ Suggested type: persona
144
+ → `/upg-explore persona "Kai — Technical Solo Founder"`
145
+
146
+ 2. 📦 **Clean URL Routing**
147
+ Found in: PR #747, plans/2026-03-22-graph-clean-url-routing.md
148
+ Graph status: ❌ Not found
149
+ Suggested type: feature
150
+ → `/upg-explore feature "Clean URL Routing"`
151
+
152
+ #### 🟡 Medium Confidence (consider adding)
153
+
154
+ 3. 🎯 **Merge freeze for mobile release**
155
+ Found in: docs/STATUS.md
156
+ Graph status: ❌ Not found
157
+ Suggested type: decision
158
+ → Worth capturing? (y/n)
159
+
160
+ #### ⚪ Low Confidence (might be noise)
161
+
162
+ 4. 🔧 **Worktree isolation pattern**
163
+ Found in: CLAUDE.md (mentioned as a rule)
164
+ → Probably an internal process, not a product entity. Skip?
165
+
166
+ ### Summary
167
+ 🟢 High: [X] items — strongly recommend adding
168
+ 🟡 Medium: [Y] items — worth considering
169
+ ⚪ Low: [Z] items — probably not graph-worthy
170
+ ✅ Already in graph: [W] items — no action needed
171
+
172
+ Coverage: [%] of discovered items are in the graph
173
+ ```
174
+
175
+ ### Step 7: Offer to Create
176
+
177
+ For high-confidence items, offer batch creation:
178
+
179
+ ```
180
+ Want me to add the [X] high-confidence items to your graph?
181
+ I'll create them as individual entities with the suggested types.
182
+
183
+ 1. Yes — add all [X] items
184
+ 2. Let me pick which ones
185
+ 3. Not now — I'll do it manually later
186
+ ```
187
+
188
+ If the user picks option 1 or 2, use `mcp__unified-product-graph__create_node` for each, following the entity confirmation pattern from `/upg-context`.
189
+
190
+ ### Step 8: Smart Ending
191
+
192
+ Follow the smart ending pattern from `/upg-context`:
193
+ - One recommendation based on what was found
194
+ - Sync suggestion if entities were created and cloud MCP is available
195
+ - Footer
196
+
197
+ ```
198
+ ┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
199
+ Your .upg file is yours — open standard, portable, git-friendly.
200
+ unifiedproductgraph.org
201
+ ```
202
+
203
+ ## Key Principles
204
+
205
+ - **Scan smart, not wide.** Target known documentation patterns (CLAUDE.md, vision docs, plans, decisions). Don't grep the entire `node_modules` or build output.
206
+ - **Semantic, not syntactic.** "Your CLAUDE.md defines 4 personas but the graph has 2" is useful. A list of file matches is not.
207
+ - **Respect the graph boundary.** Internal code structure (components, hooks, CSS classes) is NOT graph-worthy. Only surface things that represent product decisions, user understanding, or business strategy.
208
+ - **One question per message.** Follow the interaction principles from `/upg-context`.
209
+ - **Don't overwhelm.** If the full audit finds 50+ items, group by scope and show counts first. Offer to drill into each scope.
210
+ - **Time estimate:** ~3 min for single scope, ~8 min for full audit.
211
+
212
+ ## What Is Graph-Worthy?
213
+
214
+ | Graph-worthy | NOT graph-worthy |
215
+ |-------------|-----------------|
216
+ | Features, capabilities, user-facing surfaces | Internal components, hooks, utilities |
217
+ | Personas, user types, customer segments | CSS classes, design tokens |
218
+ | Strategic decisions, business model choices | Code conventions, lint rules |
219
+ | Research findings, user evidence | Dependency versions, build config |
220
+ | Competitors, market positioning | Git workflow, CI/CD setup |
221
+ | Architecture decisions with product impact | File structure, import patterns |
222
+
223
+ **Rule of thumb:** If it would make sense as a card on a product strategy wall, it's graph-worthy. If it's an implementation detail, it's not.
@@ -0,0 +1,103 @@
1
+ ---
2
+ name: upg-workspace
3
+ description: "Manage your UPG workspace — list products, switch between them, add new ones"
4
+ user-invocable: true
5
+ argument-hint: "[list|switch|add|init]"
6
+ category: tooling
7
+ ---
8
+
9
+ # /upg-workspace — Manage Your Product Workspace
10
+
11
+ Manage multiple product graphs. Fast, direct, sub-commands keep it tight. Read `/upg-context` before producing output.
12
+
13
+ **Tools:** `mcp__unified-product-graph__list_local_products`, `mcp__unified-product-graph__switch_product`, `mcp__unified-product-graph__get_product_context`, Bash for file ops.
14
+
15
+ **Parse argument:** no arg or `list` → list. `switch <N|name>` → switch. `add` → add. `init` → init.
16
+
17
+ ---
18
+
19
+ ## `list` (default)
20
+
21
+ Check if `.upg/workspace.json` exists (Bash). Call `list_local_products` for entity counts.
22
+
23
+ **Workspace mode** (workspace.json exists) — read `default_product` to mark active:
24
+ ```
25
+ ## Your UPG Workspace
26
+ 📁 .upg/ (workspace mode)
27
+ 1. ● My SaaS (active) — 42 entities, mvp stage
28
+ 2. ○ Client Project — 12 entities, idea stage
29
+ 3. ○ Internal Tools — 8 entities, idea stage
30
+ Switch: /upg-workspace switch <number>
31
+ Add: /upg-workspace add
32
+ ```
33
+
34
+ **Single-file mode** (no workspace.json, 1+ files):
35
+ ```
36
+ ## Your UPG Workspace
37
+ 📄 Single-file mode (product.upg)
38
+ ● My SaaS — 42 entities, mvp stage
39
+ Want multiple products? Run /upg-workspace init
40
+ ```
41
+ If multiple loose files, number them and suggest `init`. If zero files, point to `/upg-init`.
42
+
43
+ ---
44
+
45
+ ## `switch <number|name>`
46
+
47
+ 1. Call `list_local_products`. Match by 1-indexed position (number) or case-insensitive partial title match (name). If no match, show the list.
48
+ 2. Call `switch_product` with the resolved file path.
49
+ 3. Confirm: `● Switched to **Client Project** (12 entities, idea stage)`
50
+
51
+ ---
52
+
53
+ ## `add`
54
+
55
+ 1. Ask: **"What's the name of the new product?"** — one question, STOP, wait.
56
+ 2. Create blank .upg file via Bash. Path: `.upg/<kebab-slug>.upg` if workspace mode, else `<kebab-slug>.upg` in cwd. Generate id: `node -e "import('nanoid').then(m => console.log(m.nanoid(16)))"`. File structure:
57
+ ```json
58
+ { "upg_version": "0.5.0", "exported_at": "<now>",
59
+ "source": { "tool": "upg-mcp-local", "tool_version": "0.5.0" },
60
+ "product": { "id": "<nanoid>", "title": "<title>", "stage": "idea" },
61
+ "nodes": [], "edges": [] }
62
+ ```
63
+ 3. If workspace mode, update workspace.json — add to `products` array.
64
+ 4. Confirm: `✓ Created **Client Project** (.upg/client-project.upg)` — then ask "Switch to it now? [Y/n]". If yes, run switch logic.
65
+
66
+ ---
67
+
68
+ ## `init`
69
+
70
+ Upgrades loose .upg files to `.upg/` workspace mode.
71
+
72
+ - If workspace.json already exists: "You're already in workspace mode. Run `/upg-workspace` to see your products." Done.
73
+ - If no .upg files exist: "No .upg files found. Run `/upg-init` first." Done.
74
+
75
+ Otherwise:
76
+ 1. `mkdir -p .upg` and `mv *.upg .upg/` for each file.
77
+ 2. Create `.upg/workspace.json` with `default_product` set to the currently loaded product (from `get_product_context`) and a `products` array listing each file + title.
78
+ 3. Call `switch_product` with the new path so the MCP server picks up the move.
79
+ 4. Confirm:
80
+ ```
81
+ ✓ Workspace initialized
82
+ 📁 .upg/
83
+ ├─ workspace.json
84
+ ├─ my-saas.upg (active)
85
+ └─ client-project.upg
86
+ Your .upg files are now organized in .upg/. Git paths updated.
87
+ ```
88
+
89
+ ---
90
+
91
+ ## Display Rules
92
+
93
+ - Active product = `●` filled dot. Others = `○` open dot.
94
+ - Number products starting at 1. Users switch by number, not file path.
95
+ - Show entity count (nodes) and stage for each product.
96
+ - No unnecessary questions — `list` and `switch` need zero extra input.
97
+ - Standard footer on every output:
98
+
99
+ ```
100
+ ┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
101
+ Your .upg file is yours — open standard, portable, git-friendly.
102
+ unifiedproductgraph.org
103
+ ```