@uniqbit/mate-core 0.15.5 → 0.16.0-canary.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 (183) hide show
  1. package/claude-plugin/.claude-plugin/plugin.json +2 -2
  2. package/claude-plugin/hooks/hooks.json +3 -6
  3. package/claude-plugin/hooks/session-guidance.mjs +8 -0
  4. package/claude-plugin/hooks/ts-loader.mjs +19 -0
  5. package/package.json +6 -4
  6. package/src/cli/commands/artifact/artifact.ts +19 -3
  7. package/src/cli/commands/artifact/finish/command.ts +183 -57
  8. package/src/cli/commands/artifact/finish/engine.ts +80 -91
  9. package/src/cli/commands/artifact/finish/finisher.ts +26 -33
  10. package/src/cli/commands/artifact/finish/git.ts +34 -23
  11. package/src/cli/commands/artifact/finish/index.ts +9 -3
  12. package/src/cli/commands/artifact/finish/openspec.ts +225 -97
  13. package/src/cli/commands/artifact/pending/command.ts +175 -0
  14. package/src/cli/commands/artifact/pending/discovery.ts +249 -0
  15. package/src/cli/commands/artifact/pending/index.ts +17 -0
  16. package/src/cli/commands/cap/index-cmd.ts +9 -1
  17. package/src/cli/commands/cap/index.ts +2 -6
  18. package/src/cli/commands/companion/companion.ts +5 -1
  19. package/src/cli/commands/companion/link.ts +2 -2
  20. package/src/cli/commands/companion/sync.ts +92 -0
  21. package/src/cli/commands/doctor.ts +0 -3
  22. package/src/cli/commands/launch/shared.ts +23 -5
  23. package/src/cli/commands/report/collector.ts +72 -78
  24. package/src/cli/commands/report/contract.ts +40 -1
  25. package/src/cli/commands/report/highlight.ts +27 -0
  26. package/src/cli/commands/report/index.ts +11 -18
  27. package/src/cli/commands/report/renderer.ts +199 -2
  28. package/src/cli/commands/report/types.ts +26 -1
  29. package/src/cli/commands/shared/companion-selection.ts +107 -10
  30. package/src/cli/commands/studio/areas.ts +68 -0
  31. package/src/cli/commands/studio/index.ts +69 -0
  32. package/src/cli/commands/studio/inventory.ts +55 -0
  33. package/src/cli/commands/studio/mate-inventory.ts +43 -0
  34. package/src/cli/commands/studio/openspec-cli.ts +198 -0
  35. package/src/cli/commands/studio/payload.ts +184 -0
  36. package/src/cli/commands/studio/routes.ts +2 -0
  37. package/src/cli/commands/studio/selection.ts +61 -0
  38. package/src/cli/commands/studio/server.ts +201 -0
  39. package/src/cli/commands/studio/snapshot.ts +63 -0
  40. package/src/cli/commands/studio/topology.ts +199 -0
  41. package/src/cli/commands/studio/views/client.ts +197 -0
  42. package/src/cli/commands/studio/views/companion-picker.tsx +91 -0
  43. package/src/cli/commands/studio/views/companion-selector.tsx +90 -0
  44. package/src/cli/commands/studio/views/dashboard/changes.tsx +107 -0
  45. package/src/cli/commands/studio/views/dashboard/index.tsx +19 -0
  46. package/src/cli/commands/studio/views/document.tsx +256 -0
  47. package/src/cli/commands/studio/views/error.tsx +20 -0
  48. package/src/cli/commands/studio/views/model.ts +34 -0
  49. package/src/cli/commands/studio/views/pairings.tsx +38 -0
  50. package/src/cli/commands/studio/views/skills/index.tsx +87 -0
  51. package/src/cli/commands/studio/views/specs/index.tsx +101 -0
  52. package/src/cli/commands/studio/views/styles.ts +389 -0
  53. package/src/cli/commands/studio/views/warnings.tsx +21 -0
  54. package/src/cli/commands/studio/views/workflow/index.tsx +21 -0
  55. package/src/cli/commands/studio/views/workflow/steps.ts +329 -0
  56. package/src/cli/commands/studio/views/workflow/transcript.tsx +190 -0
  57. package/src/cli/commands/unwrap.ts +70 -0
  58. package/src/cli/commands/wrap.ts +164 -0
  59. package/src/cli/main.ts +68 -19
  60. package/src/cli/parse-flags.ts +36 -11
  61. package/src/cli/usage.ts +12 -3
  62. package/src/framework.ts +1 -7
  63. package/src/hooks/session-banner.ts +64 -11
  64. package/src/hooks/session-guidance.ts +40 -0
  65. package/src/hooks/validate-artifact-path.ts +108 -35
  66. package/src/lib/fs-utils.ts +9 -0
  67. package/src/lib/install.ts +33 -0
  68. package/src/lib/orchestrator/adapters/base.ts +14 -125
  69. package/src/lib/orchestrator/adapters/claude.ts +0 -11
  70. package/src/lib/orchestrator/adapters/opencode.ts +2 -32
  71. package/src/lib/orchestrator/companion-git-sync.ts +94 -84
  72. package/src/lib/orchestrator/config-store.ts +2 -21
  73. package/src/lib/orchestrator/editor.ts +12 -22
  74. package/src/lib/orchestrator/framework-context.ts +17 -6
  75. package/src/lib/orchestrator/global-config-store.ts +1 -1
  76. package/src/lib/orchestrator/launcher.ts +97 -7
  77. package/src/lib/orchestrator/opencode-guidance.ts +4 -56
  78. package/src/lib/orchestrator/projection-claude-entry.ts +198 -0
  79. package/src/lib/orchestrator/projection-claude-skills.ts +120 -0
  80. package/src/lib/orchestrator/projection-companion-link.ts +62 -0
  81. package/src/lib/orchestrator/projection-entries.ts +377 -0
  82. package/src/lib/orchestrator/projection-record.ts +56 -0
  83. package/src/lib/orchestrator/projection-runtime-documents.ts +424 -0
  84. package/src/lib/orchestrator/projection-types.ts +169 -0
  85. package/src/lib/orchestrator/repo-local-registry.ts +37 -133
  86. package/src/lib/orchestrator/repo-local-store.ts +96 -0
  87. package/src/lib/orchestrator/setup-compatibilities.ts +1 -9
  88. package/src/lib/orchestrator/types.ts +1 -0
  89. package/src/lib/orchestrator/working-repo-projection.ts +366 -0
  90. package/src/lib/orchestrator/workspace-inventory.ts +1 -1
  91. package/src/lib/package-paths.ts +11 -1
  92. package/src/opencode/companion-hooks.ts +89 -245
  93. package/src/opencode/companion-policy.ts +35 -10
  94. package/src/opencode/index.ts +1 -0
  95. package/src/opencode/projected-guidance.ts +56 -0
  96. package/src/opencode/tui.tsx +13 -4
  97. package/src/playbooks/companion-guidance.ts +32 -116
  98. package/src/plugins.ts +0 -1
  99. package/src/runtime/companion-git-state.ts +156 -0
  100. package/src/runtime/companion-git.ts +203 -0
  101. package/src/runtime/companion-guidance.ts +222 -0
  102. package/src/runtime/companion-sync.ts +298 -0
  103. package/src/runtime/env-names.ts +30 -0
  104. package/src/runtime/env.ts +67 -35
  105. package/src/runtime/framework.ts +10 -0
  106. package/src/runtime/freshness.ts +58 -0
  107. package/src/runtime/index.ts +104 -0
  108. package/src/runtime/install.ts +30 -0
  109. package/src/runtime/policy.ts +66 -0
  110. package/src/runtime/projected-guidance.ts +45 -0
  111. package/src/runtime/projection.ts +224 -0
  112. package/src/runtime/repo-local.ts +64 -0
  113. package/src/templates/capabilities/openspec-cap/mate-minimal/schema.yaml +56 -0
  114. package/src/templates/capabilities/openspec-cap/mate-minimal/templates/spec.md +48 -0
  115. package/src/templates/capabilities/openspec-cap/mate-minimal/templates/tasks.md +22 -0
  116. package/src/templates/capabilities/openspec-cap/mate-v1/schema.yaml +31 -90
  117. package/src/templates/capabilities/openspec-cap/mate-v1/templates/design.md +3 -0
  118. package/src/templates/capabilities/openspec-cap/mate-v1/templates/explore-brief.md +6 -6
  119. package/src/templates/capabilities/openspec-cap/mate-v1/templates/spec.md +3 -5
  120. package/src/templates/capabilities/openspec-cap/mate-v1/templates/tasks.md +3 -0
  121. package/src/templates/capabilities/openspec-cap/openspec-conventions.yaml +30 -0
  122. package/src/templates/capabilities/react-doctor/claude/hooks/react-doctor.sh +2 -2
  123. package/src/templates/mate-skills/agents/mate-artifact-publish/SKILL.md +185 -0
  124. package/src/templates/mate-skills/agents/mate-artifact-publish/references/openspec.md +227 -0
  125. package/src/templates/mate-skills/agents/mate-domain-modeling/SKILL.md +68 -0
  126. package/src/templates/mate-skills/agents/mate-domain-modeling/references/ADR-FORMAT.md +9 -0
  127. package/src/templates/mate-skills/agents/mate-domain-modeling/references/CONTEXT-FORMAT.md +18 -0
  128. package/src/templates/mate-skills/agents/mate-grill-me/SKILL.md +14 -0
  129. package/src/templates/mate-skills/agents/mate-grill-with-docs/SKILL.md +29 -0
  130. package/src/templates/mate-skills/agents/mate-grilling/SKILL.md +49 -0
  131. package/src/templates/mate-skills/agents/mate-interview-me/SKILL.md +147 -0
  132. package/src/templates/{capabilities/openspec-cap/mate-skills → mate-skills}/agents/mate-openspec-backfill/SKILL.md +4 -2
  133. package/src/templates/mate-skills/agents/mate-show-me/SKILL.md +139 -0
  134. package/src/templates/mate-skills/agents/mate-simplify-code/SKILL.md +503 -0
  135. package/src/templates/mate-skills/claude/mate-artifact-publish/SKILL.md +185 -0
  136. package/src/templates/mate-skills/claude/mate-artifact-publish/references/openspec.md +227 -0
  137. package/src/templates/mate-skills/claude/mate-domain-modeling/SKILL.md +68 -0
  138. package/src/templates/mate-skills/claude/mate-domain-modeling/references/ADR-FORMAT.md +9 -0
  139. package/src/templates/mate-skills/claude/mate-domain-modeling/references/CONTEXT-FORMAT.md +18 -0
  140. package/src/templates/mate-skills/claude/mate-grill-me/SKILL.md +14 -0
  141. package/src/templates/mate-skills/claude/mate-grill-with-docs/SKILL.md +29 -0
  142. package/src/templates/mate-skills/claude/mate-grilling/SKILL.md +49 -0
  143. package/src/templates/mate-skills/claude/mate-interview-me/SKILL.md +147 -0
  144. package/src/templates/mate-skills/claude/mate-openspec-backfill/SKILL.md +67 -0
  145. package/src/templates/mate-skills/claude/mate-show-me/SKILL.md +139 -0
  146. package/src/templates/mate-skills/claude/mate-simplify-code/SKILL.md +503 -0
  147. package/src/templates/report-assets/README.md +32 -0
  148. package/src/templates/report-assets/mermaid.LICENSE +21 -0
  149. package/src/templates/report-assets/mermaid.min.js +4376 -0
  150. package/src/templates/root/TEMPLATE_CLAUDE.md +1 -9
  151. package/src/tools/setup/__snapshots__/runtime-surface-golden.test.ts.snap +1476 -197
  152. package/src/tools/setup/capabilities/graphify.ts +16 -7
  153. package/src/tools/setup/capabilities/openspec.ts +63 -56
  154. package/src/tools/setup/capabilities/tokensave.ts +47 -0
  155. package/src/tools/setup/engine.ts +34 -6
  156. package/src/tools/setup/mate.ts +42 -13
  157. package/src/tools/setup/plugin.ts +9 -0
  158. package/src/tools/setup/plugins/guidance.ts +11 -1
  159. package/src/tools/setup/providers/claude-format.ts +49 -4
  160. package/src/tools/setup/providers/claude-plugin-hooks.ts +117 -0
  161. package/src/tools/setup/providers/claude.ts +55 -220
  162. package/src/tools/setup/providers/opencode.ts +41 -14
  163. package/src/tools/setup/runtime-documents.ts +174 -0
  164. package/src/tools/setup/surface-target.ts +50 -0
  165. package/src/tools/setup/working-repo-cleanup.ts +33 -26
  166. package/src/tools/setup/working-repo-local-state.ts +21 -1
  167. package/src/tools/setup.ts +25 -3
  168. package/wrappers/bin/graphify +57 -8
  169. package/wrappers/bin/openspec +50 -3
  170. package/claude-plugin/hooks/artifact-finish-nudge.mjs +0 -8
  171. package/src/cli/commands/cap/headroom.ts +0 -52
  172. package/src/cli/commands/workspace/list.ts +0 -25
  173. package/src/cli/commands/workspace/materialize.ts +0 -46
  174. package/src/cli/commands/workspace/workspace.ts +0 -22
  175. package/src/hooks/artifact-finish-nudge.ts +0 -244
  176. package/src/lib/orchestrator/headroom/proxy.ts +0 -116
  177. package/src/lib/orchestrator/workspace-materialize.ts +0 -80
  178. package/src/templates/capabilities/openspec-cap/mate-skills/agents/mate-artifact-finish/SKILL.md +0 -51
  179. package/src/templates/capabilities/openspec-cap/mate-skills/agents/mate-artifact-finish/references/openspec.md +0 -134
  180. package/src/templates/capabilities/openspec-cap/mate-skills/claude/mate-artifact-finish/SKILL.md +0 -58
  181. package/src/templates/capabilities/openspec-cap/mate-skills/claude/mate-artifact-finish/references/openspec.md +0 -139
  182. package/src/tools/setup/capabilities/headroom.ts +0 -57
  183. /package/src/cli/commands/{workspace → companion}/open.ts +0 -0
@@ -0,0 +1,147 @@
1
+ ---
2
+ name: mate-interview-me
3
+ description: Clarify intent through a focused, one-question-at-a-time conversation before planning.
4
+ disable-model-invocation: true
5
+ ---
6
+
7
+ # Mate Interview Me
8
+
9
+ > Inspired by [Addy Osmani's interview-me skill](https://github.com/addyosmani/agent-skills/tree/main/skills/interview-me) and adapted here as a Mate process-driven skill.
10
+
11
+ ## Overview
12
+
13
+ What people ask for and what they actually want are different things. They ask
14
+ for a "dashboard" because that is what one asks for, not because a dashboard
15
+ solves their problem. They say "make it faster" without a number to hit.
16
+
17
+ The cheapest moment to find this gap is before any plan, spec, or code exists.
18
+ Once implementation has started, switching costs are real and the user may
19
+ rationalize the wrong thing into "good enough." This skill closes the gap before
20
+ it costs anything.
21
+
22
+ ## When to Use
23
+
24
+ Apply this skill when:
25
+
26
+ - The ask is missing at least one of: who the user is, why they want it, what
27
+ success looks like, or the binding constraint.
28
+ - The request is conventional rather than specific and cannot be unpacked
29
+ without guessing.
30
+ - You are tempted to start with assumptions that have not been surfaced.
31
+ - The user has not said which value they are optimizing for when reasonable
32
+ values are in tension, such as simplicity versus flexibility.
33
+ - The user explicitly invokes "interview me", "grill me", "are we sure?", or
34
+ "stress-test my thinking".
35
+
36
+ **When NOT to use:**
37
+
38
+ - The ask is unambiguous and self-contained.
39
+ - The user explicitly asked for speed over verification.
40
+ - The request is purely informational.
41
+ - The operation is mechanical, such as a rename, format, or file move.
42
+ - You already have >=95% confidence; reread the stop condition before assuming
43
+ you do not.
44
+
45
+ ## Loading Constraints
46
+
47
+ This skill needs a live, responsive user. Do not use it in non-interactive
48
+ contexts such as CI pipelines, scheduled runs, loops, or autonomous runs. If an
49
+ underspecified ask arrives there, report the blocker instead of guessing.
50
+
51
+ ## The Process
52
+
53
+ ### Step 1: Hypothesize, with a confidence number
54
+
55
+ Before asking anything, write the current best read of what the user wants in one
56
+ sentence, followed by an honest confidence number from 0 to 100 percent. When
57
+ confidence is below 70 percent, state what is missing on the same line.
58
+
59
+ ```text
60
+ HYPOTHESIS: You want <the underlying outcome>, and <the user's wording> was the convention that came to mind. CONFIDENCE: ~30% - missing: <what is unresolved>
61
+ ```
62
+
63
+ The number forces honesty. If you wrote a high number but cannot predict the
64
+ user's reactions to the next three questions, the number is wrong.
65
+
66
+ ### Step 2: Ask one question at a time, each with a guess attached
67
+
68
+ Ask exactly one focused question that would most reduce uncertainty. Attach your
69
+ best guess about the answer and the reasoning behind it:
70
+
71
+ ```text
72
+ Q: <one focused question> GUESS: <your hypothesis for the answer and why>
73
+ ```
74
+
75
+ Wait for the answer before asking the next question. Never batch questions or
76
+ advance silently. The guess exposes assumptions and lets the user correct them
77
+ quickly.
78
+
79
+ ### Step 3: Listen for "want versus should want"
80
+
81
+ Watch for best-practice talk without specifics, deference to convention, phrases
82
+ such as "I should probably", and buzzwords used as goals instead of outcomes.
83
+ When you hear one, ask:
84
+
85
+ > _"If you did not have to justify this to anyone, what would you actually want?"_
86
+
87
+ ### Step 4: Restate intent in the user's own words
88
+
89
+ When confidence is high, write back a concise restatement using the user's
90
+ language and these fields:
91
+
92
+ ```text
93
+ Outcome: <one line>
94
+ User: <one line - who benefits>
95
+ Why now: <one line - what changed>
96
+ Success: <one line - how we know it worked>
97
+ Constraint: <one line - the binding limit>
98
+ Out of scope: <one line - what we are explicitly not doing>
99
+ ```
100
+
101
+ Ask: "Yes, no, or refine?" The out-of-scope line is mandatory; silent disagreement
102
+ about non-goals is a common source of misalignment.
103
+
104
+ ### Step 5: Confirm explicitly
105
+
106
+ The gate is an explicit yes. These are not confirmation:
107
+
108
+ - "Whatever you think is best." Ask again with two concrete options.
109
+ - "Sounds good." Ask what the user would refine.
110
+ - "Sure, let us go." Check whether anything was missed.
111
+ - Silence followed by "okay, let us start." Ask whether the user has confirmed
112
+ the restatement.
113
+
114
+ If the user corrects the restatement, fold in the correction and restate it again.
115
+
116
+ ### The 95% Confidence Stop
117
+
118
+ Stop only when you can predict the user's reaction to the next three questions.
119
+ This is a checkable condition, not a feeling. If the user names a blocker before
120
+ that point, stop and label the result unresolved rather than calling it confirmed.
121
+
122
+ ## Output
123
+
124
+ The deliverable is a confirmed statement of intent: the restatement above plus
125
+ an explicit yes. Specs, plans, and task lists are downstream and do not belong in
126
+ this skill. A blocked session returns its partial intent, blocker, and unresolved
127
+ questions instead.
128
+
129
+ ## Mate Boundary
130
+
131
+ This is a conversational-only skill. Do not create or modify code, context files,
132
+ ADRs, OpenSpec artifacts, intent documents, or any other files. Do not claim that
133
+ a file was written, and do not invoke another skill.
134
+
135
+ ## Verification
136
+
137
+ Before stopping, check that:
138
+
139
+ - An initial hypothesis and confidence number were stated.
140
+ - Every confidence number below 70 percent included its reason.
141
+ - Every question was asked one at a time with an attached guess.
142
+ - The want-versus-should-want probe ran when the user gave a convention or
143
+ sophistication-signaling answer.
144
+ - The restatement includes Outcome, User, Why now, Success, Constraint, and Out
145
+ of scope.
146
+ - The user explicitly confirmed the restatement, or the result is clearly marked
147
+ unresolved because of a blocker.
@@ -0,0 +1,67 @@
1
+ ---
2
+ name: mate-openspec-backfill
3
+ description: Reverse-engineer an OpenSpec spec for one existing feature and emit a ready-to-finish backfill change. Use when the user wants to backfill, document, or spec existing or legacy behavior that has no spec yet.
4
+ allowed-tools: Bash(openspec:*), Bash(mate:*)
5
+ license: MIT
6
+ compatibility: Requires the mate CLI and the openspec capability enabled.
7
+ metadata:
8
+ author: mate
9
+ version: "1.0"
10
+ ---
11
+
12
+ # Mate OpenSpec Backfill
13
+
14
+ Create a spec for one feature that already exists in the working repository. The run ends with a standard ready-to-finish change — it never edits main specs and never finishes.
15
+
16
+ ## Scope rules
17
+
18
+ - **One named feature per run.** Refuse Area-wide or repository-wide sweeps; ask the user to name a single feature and run the skill once per feature.
19
+ - **Interactive by design.** Every ambiguity and every suspected bug becomes a user question. Do not run this skill unattended.
20
+
21
+ ## Steps
22
+
23
+ 1. **Scope.** Map the named feature to code: entry points, callees, tests. Use whatever exploration tooling this project has enabled (code-graph or index tools when present, otherwise search and targeted reading) — assume no specific capability is installed. Then check `openspec/specs/` for an existing capability covering this domain — prefer extending it (`MODIFIED`/`ADDED` deltas) over minting a new capability id.
24
+
25
+ 2. **Sweep.** Extract candidate behaviors and tag each finding:
26
+ - `[test-backed]` — an existing test verifies it (strongest; scenarios translate almost directly from tests)
27
+ - `[code-only]` — observable in code but untested
28
+ - `[inferred]` — assumed intent without direct evidence
29
+
30
+ Every candidate requirement needs at least one citation: a test name or `file:line`. Docs and comments corroborate but never stand alone. `[inferred]` findings are not requirements — they become questions for step 3.
31
+
32
+ 3. **Ask.** Batch the open questions to the user:
33
+ - Behavior that looks unintended → the user rules **spec the actual behavior** or **spec the intent** (with a follow-up fix change). Suspected bugs never silently become requirements.
34
+ - `[inferred]` findings → confirm, demote to out-of-scope, or convert to a question the emitted proposal records as open.
35
+
36
+ 4. **Emit.** Create the change and build its artifacts in dependency order:
37
+
38
+ ```bash
39
+ openspec new change "backfill-spec-<capability>"
40
+ openspec status --change "backfill-spec-<capability>" --json
41
+ openspec instructions <artifact-id> --change "backfill-spec-<capability>" --json
42
+ ```
43
+
44
+ The artifact set comes from the active schema (`schemaName` in the status JSON) — never assume a fixed artifact list. Follow each artifact's returned instructions and template, and state the active schema in the proposal so reviewers know which workflow produced the change. Map the backfill roles onto whatever artifacts the schema defines:
45
+
46
+ | Backfill role | Typical artifact (mate-v1 example) |
47
+ | ---------------------------------------------------------------------------------------------- | ---------------------------------- |
48
+ | Scope decisions and rulings from step 3 | explore-brief.md |
49
+ | "Documents existing behavior, no code changes" + open questions | proposal.md |
50
+ | `ADDED`/`MODIFIED` requirements, behavior only, one citation each | specs/ |
51
+ | As-built evidence dossier: entry points, test inventory, `file:line` citations per requirement | design.md |
52
+ | Verification checklist: one task per requirement, "confirm behavior at <citation>" | tasks.md |
53
+
54
+ The verification task artifact MUST open with this rule, verbatim, so the applying agent sees it without knowing this skill: "These are verification tasks for a docs-only backfill change. If a requirement fails verification, update the delta spec (reword, drop, or re-cite the requirement) — never modify code in this change. A real bug found here becomes a separate fix change."
55
+
56
+ Requirements state observable contracts, never implementation detail ("propagates the child exit code", not "uses spawnSync").
57
+
58
+ 5. **Stop.** Report the change as ready-to-finish and hand off:
59
+ - Verify: `openspec-apply-change` works through tasks.md, checking each requirement against the code.
60
+ - Publish: `mate-artifact-publish` applies the deltas to main specs and anchors the change.
61
+
62
+ ## Guardrails
63
+
64
+ - Never write files under `openspec/specs/` — main specs change only through finished changes.
65
+ - Never invoke any finish flow (`mate artifact publish`, `openspec archive`); stop at ready-to-finish.
66
+ - Never emit a requirement without a citation, and never spec a suspected bug without the user's ruling.
67
+ - Keep capability ids opaque kebab-case; extend existing capabilities before creating new ones.
@@ -0,0 +1,139 @@
1
+ ---
2
+ name: mate-show-me
3
+ description: Explain the current topic or the applied change in a browser-rendered Mate report. Use only when the user explicitly invokes the skill to see how something works, what a change did, or wants a diagram, call tree, or rendered diff of the current work.
4
+ disable-model-invocation: true
5
+ allowed-tools: Bash(git:*), Bash(mate:*)
6
+ license: MIT
7
+ compatibility: Requires the mate CLI and the openspec capability enabled.
8
+ metadata:
9
+ author: mate
10
+ version: "1.0"
11
+ ---
12
+
13
+ # Mate Show Me
14
+
15
+ > Inspired by [humanlayer's show-me skill](https://github.com/humanlayer/skills/tree/main/plugins/show-me/skills/show-me) and adapted here as a Mate process-driven skill.
16
+
17
+ Explain the current topic visually in a browser-rendered Mate report. Skip the preamble, keep prose brief, and pick the smallest report view that makes the key point clear.
18
+
19
+ ## Mate Workflow
20
+
21
+ - Explanation only. Never write or edit source code, tests, documentation, OpenSpec artifacts, context files, or ADRs. The only file this skill produces is the report document handed to `mate report --input`, which the CLI writes into the operating system temporary directory.
22
+ - Draw from the repositories, not from memory. Every diagram and every diff line comes from the inspected repository state, never from recollection of the conversation. Use the available code-graph tools before broad source scans.
23
+ - Code lives in the Working Repository; the Companion Repository holds only artifacts. Run `git diff` in the Working Repository.
24
+ - Never put an absolute local path, home directory, username, machine name, temporary report path, Companion Repository path, or raw path-valued environment variable in the report. Use repository-relative paths or neutral labels such as `Working Repository` and `Companion Repository`.
25
+ - Never commit, push, or create a pull request.
26
+
27
+ ## Browser Report Required
28
+
29
+ Always assemble and open a Mate report, even when a small inline sketch would be sufficient. Do not answer with an inline-only visual or paste the complete diagram or diff into the conversation. The final response should briefly state what the browser report shows without repeating its temporary file path.
30
+
31
+ ## Report Contents
32
+
33
+ - Show logic or an algorithm as a `diagram` section. Use a `mermaid` payload when branches, stages, or relationships benefit from a rendered visual; reserve `text` for compact pseudocode:
34
+
35
+ ```text
36
+ on(save)
37
+ if content is unchanged
38
+ return cached result
39
+ write new content
40
+ return fresh result
41
+ ```
42
+
43
+ - Show runtime control flow as a `diagram` section with a `mermaid` payload. Use `flowchart TD` for a call tree or control flow and `sequenceDiagram` when ordering between components matters:
44
+
45
+ ```mermaid
46
+ flowchart TD
47
+ renderHTML[renderHTML] --> validate[validateReportDocument]
48
+ renderHTML --> section[renderHTMLSection]
49
+ section --> diagram[renderHTMLDiagram]
50
+ section --> diff[renderHTMLDiff]
51
+ ```
52
+
53
+ - Show UI structure as a `diagram` section with a `mermaid` payload when showing relationships between components or modules. Use a `text` payload only when exact component syntax is the point, including the state boundaries that matter:
54
+
55
+ ```tsx
56
+ <WorkflowView> (studio/views/workflow/index.tsx)
57
+ workflowPlan(availableSkills)
58
+ <StepList>
59
+ <StepRow optional>
60
+ ```
61
+
62
+ - Show file responsibility or a broad refactor as a `diagram` section with a `text` payload containing a shallow file tree:
63
+
64
+ ```text
65
+ src/
66
+ |-- commands/ # parses user actions
67
+ |-- report/ # owns the report contract and renderer
68
+ `-- templates/ # ships assets and skills
69
+ ```
70
+
71
+ - Show what changes as a `diff` section when the surrounding shape already exists. Match the diff shape to the topic - component tree, file layout, call tree, or control flow:
72
+
73
+ ```diff
74
+ on(save)
75
+ - write content
76
+ + if content is unchanged
77
+ + return cached result
78
+ + write new content
79
+ ```
80
+
81
+ - Show a whole block in the report when most of it is new, when omitted context would hide ownership or order, or when the user needs a copyable target shape.
82
+
83
+ ## Browser Delivery
84
+
85
+ The report is mandatory. Prefer `mate report --input <temporary-json-file>` without `--json` so the CLI reads the complete document reliably, writes self-contained HTML, and opens it in the default browser. The CLI also supports `mate report --input -` when JSON is piped to stdin; if stdin delivery reports empty or truncated JSON, switch to a temporary JSON file rather than retrying the same transport. If validation fails, fix the report document and retry; do not fall back to an inline explanation or JSON-only delivery.
86
+
87
+ Never hand-write an HTML file, never start a server, and never open a browser by any other means. `mate report` is the only browser surface.
88
+
89
+ ## Assembling The Report
90
+
91
+ Build a JSON document that conforms to the `mate-create-report` contract, then hand it over:
92
+
93
+ 1. Serialize the complete document to an OS temporary JSON file outside both repositories. Do not place the report input in the Working Repository or Companion Repository.
94
+ 2. Run `mate report --input <temporary-json-file>`.
95
+
96
+ A report assembled by this skill carries:
97
+
98
+ - `metadata` naming the subject and a neutral repository label, never a local path
99
+ - one `diagram` section for the structure or flow at issue, even when the visual is small
100
+ - use a `mermaid` payload for runtime control flow, call trees, data flow, or component relationships; use `text` only when a sketch or pseudocode is clearer
101
+ - one `diff` section carrying the unified diff, when there is something to diff
102
+ - a short `text` section next to each visual, saying what the reader should notice
103
+
104
+ A `diagram` section carries exactly one payload: `mermaid` for diagram source the report draws as a picture, or `text` for a monospace ASCII sketch or pseudocode block. A `diff` section carries a unified `patch` string.
105
+
106
+ ```json
107
+ {
108
+ "id": "structure",
109
+ "title": "Report rendering",
110
+ "type": "diagram",
111
+ "mermaid": "classDiagram\n Renderer --> Highlight : uses"
112
+ }
113
+ ```
114
+
115
+ ```json
116
+ {
117
+ "id": "changes",
118
+ "title": "What changed",
119
+ "type": "diff",
120
+ "patch": "diff --git a/src/acme.ts b/src/acme.ts\n..."
121
+ }
122
+ ```
123
+
124
+ If the document fails contract validation, report the diagnostic and correct the document. Do not fall back to hand-written HTML.
125
+
126
+ ## Mermaid Authoring Rules
127
+
128
+ - Use Mermaid whenever the user asks for a diagram or the subject has meaningful control flow, sequencing, lifecycle, or relationships. A `text` payload is a deliberate fallback, not the default for runtime flows.
129
+ - Pick the diagram type that matches the question: `classDiagram` for structure, `sequenceDiagram` for interaction between components, `stateDiagram-v2` for lifecycles, `flowchart TD` for control flow and call trees.
130
+ - Keep labels short enough to read at report width. A label that needs a sentence belongs in the neighbouring `text` section.
131
+ - Do not use ELK-only layouts or math labels. The report inlines the self-contained mermaid bundle, which may not carry those chunks.
132
+ - Pair each Mermaid visual with a short neighbouring `text` section that calls out the ownership boundary or invariant the reader should notice.
133
+ - Prefer the `text` payload for pseudocode, shallow file trees, or cases where a picture would genuinely obscure the point.
134
+
135
+ ## Reviewing An Applied Change
136
+
137
+ - Read the change scope before drawing it, then diagram the structure or flow the change establishes - not the structure it replaced.
138
+ - Take the diff from `git diff` in the Working Repository. Keep only repository-relative paths in the patch, default to the working tree, and ask the user when their intent is a committed range instead.
139
+ - When the inspected scope has no changes, say so and omit the `diff` section. Never invent a patch.