opencodekit 0.15.21 → 0.16.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.
- package/dist/index.js +5 -7
- package/dist/template/.opencode/AGENTS.md +21 -20
- package/dist/template/.opencode/agent/build.md +88 -7
- package/dist/template/.opencode/agent/explore.md +1 -1
- package/dist/template/.opencode/agent/general.md +54 -4
- package/dist/template/.opencode/agent/looker.md +1 -1
- package/dist/template/.opencode/agent/painter.md +1 -1
- package/dist/template/.opencode/agent/plan.md +52 -0
- package/dist/template/.opencode/agent/review.md +1 -1
- package/dist/template/.opencode/agent/scout.md +3 -3
- package/dist/template/.opencode/agent/vision.md +1 -1
- package/dist/template/.opencode/command/create.md +201 -95
- package/dist/template/.opencode/command/design.md +5 -7
- package/dist/template/.opencode/command/handoff.md +7 -0
- package/dist/template/.opencode/command/init.md +25 -47
- package/dist/template/.opencode/command/plan.md +35 -16
- package/dist/template/.opencode/command/resume.md +7 -18
- package/dist/template/.opencode/command/ship.md +156 -0
- package/dist/template/.opencode/command/start.md +315 -28
- package/dist/template/.opencode/command/ui-review.md +5 -7
- package/dist/template/.opencode/command/verify.md +279 -0
- package/dist/template/.opencode/memory/_templates/README.md +57 -19
- package/dist/template/.opencode/memory/_templates/prd.md +29 -0
- package/dist/template/.opencode/memory/_templates/project/tech-stack.md +50 -0
- package/dist/template/.opencode/memory/_templates/proposal.md +38 -0
- package/dist/template/.opencode/memory/_templates/spec.md +66 -0
- package/dist/template/.opencode/memory/_templates/tasks.md +198 -0
- package/dist/template/.opencode/memory/observations/2026-02-01-decision-add-skills-vs-commands-to-global-agents-.md +15 -0
- package/dist/template/.opencode/memory/observations/2026-02-01-decision-build-agent-auto-loads-skills-contextual.md +31 -0
- package/dist/template/.opencode/memory/observations/2026-02-01-decision-fixed-agent-configuration-for-opencodeki.md +25 -0
- package/dist/template/.opencode/memory/observations/2026-02-01-decision-focused-agents-md-upgrade-for-opencode-k.md +14 -0
- package/dist/template/.opencode/memory/observations/2026-02-01-decision-implement-tier-1-permission-upgrades.md +15 -0
- package/dist/template/.opencode/memory/observations/2026-02-01-decision-instructions-config-explicit-paths-not-w.md +40 -0
- package/dist/template/.opencode/memory/observations/2026-02-01-decision-merged-context-into-memory-project-singl.md +42 -0
- package/dist/template/.opencode/memory/observations/2026-02-01-decision-oracle-tool-should-use-review-agent-not-.md +14 -0
- package/dist/template/.opencode/memory/observations/2026-02-01-decision-plan-agent-auto-loads-skills-contextuall.md +31 -0
- package/dist/template/.opencode/memory/observations/2026-02-01-decision-plan-phased-oracle-command-merge-into-ne.md +14 -0
- package/dist/template/.opencode/memory/observations/2026-02-01-decision-prd-workflow-uses-prd-and-prd-task-skill.md +23 -0
- package/dist/template/.opencode/memory/observations/2026-02-01-decision-prefer-review-agent-via-opencode-cli-ove.md +14 -0
- package/dist/template/.opencode/memory/observations/2026-02-01-decision-remove-oracle-tool-add-ship-command-with.md +14 -0
- package/dist/template/.opencode/memory/observations/2026-02-01-decision-remove-oracle-tool-and-add-ship-command-.md +14 -0
- package/dist/template/.opencode/memory/observations/2026-02-01-decision-remove-oracle-tool-and-add-ship-command.md +14 -0
- package/dist/template/.opencode/memory/observations/2026-02-01-decision-remove-skills-vs-commands-section-from-a.md +14 -0
- package/dist/template/.opencode/memory/observations/2026-02-01-decision-replace-oracle-tool-with-ship-command-fl.md +14 -0
- package/dist/template/.opencode/memory/observations/2026-02-01-decision-replace-oracle-with-ship-command-workflo.md +14 -0
- package/dist/template/.opencode/memory/observations/2026-02-01-decision-replace-proxypal-oracle-with-cli-review-.md +14 -0
- package/dist/template/.opencode/memory/observations/2026-02-01-decision-simplified-dist-template-only-tech-stack.md +50 -0
- package/dist/template/.opencode/memory/observations/2026-02-01-decision-simplified-templates-only-tech-stack-md.md +26 -0
- package/dist/template/.opencode/memory/observations/2026-02-01-decision-subagents-load-minimal-skills-stay-lean.md +29 -0
- package/dist/template/.opencode/memory/observations/2026-02-01-decision-user-approved-permission-upgrades-in-ope.md +15 -0
- package/dist/template/.opencode/memory/observations/2026-02-01-discovery-verify-command-already-implemented.md +28 -0
- package/dist/template/.opencode/memory/observations/2026-02-01-feature-openspec-phase-b-complete-template-upgra.md +43 -0
- package/dist/template/.opencode/memory/observations/2026-02-01-learning-build-agent-should-use-dynamic-lsp-not-f.md +14 -0
- package/dist/template/.opencode/memory/observations/2026-02-01-learning-kimi-k2-5-model-requires-temperature-1-0.md +22 -0
- package/dist/template/.opencode/memory/observations/2026-02-01-learning-opencode-context-injection-already-imple.md +27 -0
- package/dist/template/.opencode/memory/observations/2026-02-01-learning-opencode-context-injection-uses-instruct.md +35 -0
- package/dist/template/.opencode/memory/observations/2026-02-01-learning-update-build-agent-prompt-to-use-context.md +14 -0
- package/dist/template/.opencode/memory/observations/2026-02-01-learning-upgrade-agents-md-using-opencode-expert-.md +14 -0
- package/dist/template/.opencode/memory/observations/2026-02-01-learning-upgrade-agents-md-with-opencode-expert-g.md +14 -0
- package/dist/template/.opencode/memory/observations/2026-02-01-learning-upgrade-agents-md-with-opencode-expert-r.md +14 -0
- package/dist/template/.opencode/memory/observations/2026-02-01-learning-user-prefers-copilot-gpt-5-2-codex-mediu.md +14 -0
- package/dist/template/.opencode/memory/observations/2026-02-01-learning-user-wants-general-agent-prompt-contextu.md +15 -0
- package/dist/template/.opencode/memory/observations/2026-02-01-learning-user-wants-general-agent-prompt-reviewed.md +15 -0
- package/dist/template/.opencode/memory/project/command-rules.md +122 -0
- package/dist/template/.opencode/memory/project/tech-stack.md +50 -0
- package/dist/template/.opencode/memory/research/ccpm-analysis.md +334 -0
- package/dist/template/.opencode/memory/research/openspec-analysis.md +226 -0
- package/dist/template/.opencode/opencode.json +916 -803
- package/dist/template/.opencode/skill/tool-priority/SKILL.md +2 -2
- package/package.json +1 -1
- package/dist/template/.opencode/command/accessibility-check.md +0 -331
- package/dist/template/.opencode/command/agent-browser.md +0 -21
- package/dist/template/.opencode/command/analyze-mockup.md +0 -423
- package/dist/template/.opencode/command/analyze-project.md +0 -295
- package/dist/template/.opencode/command/brainstorm.md +0 -373
- package/dist/template/.opencode/command/cloudflare.md +0 -70
- package/dist/template/.opencode/command/commit.md +0 -245
- package/dist/template/.opencode/command/complete-next-task.md +0 -77
- package/dist/template/.opencode/command/design-audit.md +0 -480
- package/dist/template/.opencode/command/edit-image.md +0 -242
- package/dist/template/.opencode/command/finish.md +0 -255
- package/dist/template/.opencode/command/fix-ci.md +0 -109
- package/dist/template/.opencode/command/fix-types.md +0 -104
- package/dist/template/.opencode/command/fix-ui.md +0 -117
- package/dist/template/.opencode/command/fix.md +0 -168
- package/dist/template/.opencode/command/frontend-design.md +0 -21
- package/dist/template/.opencode/command/generate-diagram.md +0 -349
- package/dist/template/.opencode/command/generate-icon.md +0 -283
- package/dist/template/.opencode/command/generate-image.md +0 -246
- package/dist/template/.opencode/command/generate-pattern.md +0 -247
- package/dist/template/.opencode/command/generate-storyboard.md +0 -250
- package/dist/template/.opencode/command/implement.md +0 -609
- package/dist/template/.opencode/command/import-plan.md +0 -406
- package/dist/template/.opencode/command/index-knowledge.md +0 -25
- package/dist/template/.opencode/command/integration-test.md +0 -424
- package/dist/template/.opencode/command/issue.md +0 -102
- package/dist/template/.opencode/command/new-feature.md +0 -651
- package/dist/template/.opencode/command/opensrc.md +0 -58
- package/dist/template/.opencode/command/quick-build.md +0 -238
- package/dist/template/.opencode/command/ralph.md +0 -41
- package/dist/template/.opencode/command/research-and-implement.md +0 -148
- package/dist/template/.opencode/command/research-ui.md +0 -466
- package/dist/template/.opencode/command/restore-image.md +0 -424
- package/dist/template/.opencode/command/revert-feature.md +0 -386
- package/dist/template/.opencode/command/skill-create.md +0 -517
- package/dist/template/.opencode/command/skill-optimize.md +0 -556
- package/dist/template/.opencode/command/summarize.md +0 -412
- package/dist/template/.opencode/command/triage.md +0 -398
- package/dist/template/.opencode/memory/_templates/project/architecture.md +0 -60
- package/dist/template/.opencode/memory/_templates/project/commands.md +0 -72
- package/dist/template/.opencode/memory/_templates/project/conventions.md +0 -68
- package/dist/template/.opencode/memory/_templates/project/gotchas.md +0 -41
- package/dist/template/.opencode/skill/notebooklm/SKILL.md +0 -272
- package/dist/template/.opencode/skill/notebooklm/references/setup.md +0 -353
- package/dist/template/.opencode/tool/notebooklm.ts +0 -488
- package/dist/template/.opencode/tool/oracle.ts +0 -240
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: Fix UI issues with visual verification
|
|
3
|
-
argument-hint: "<issue or bead-id> [--a11y]"
|
|
4
|
-
agent: build
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# Fix UI: $ARGUMENTS
|
|
8
|
-
|
|
9
|
-
Fix visual issues. Capture before/after, verify responsiveness.
|
|
10
|
-
|
|
11
|
-
## Load Context
|
|
12
|
-
|
|
13
|
-
!`bd show $ARGUMENTS`
|
|
14
|
-
!`cat .beads/artifacts/$ARGUMENTS/spec.md 2>/dev/null`
|
|
15
|
-
|
|
16
|
-
## Capture Before State
|
|
17
|
-
|
|
18
|
-
Take screenshot before changes. Save to `.beads/artifacts/$ARGUMENTS/before.png`.
|
|
19
|
-
|
|
20
|
-
```typescript
|
|
21
|
-
skill({ name: "playwright" });
|
|
22
|
-
skill_mcp({
|
|
23
|
-
skill_name: "playwright",
|
|
24
|
-
tool_name: "browser_screenshot",
|
|
25
|
-
arguments: '{"name": "before-fix"}',
|
|
26
|
-
});
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
## Analyze
|
|
30
|
-
|
|
31
|
-
Delegate to @vision:
|
|
32
|
-
|
|
33
|
-
```typescript
|
|
34
|
-
task({
|
|
35
|
-
subagent_type: "vision",
|
|
36
|
-
description: "Analyze UI issue",
|
|
37
|
-
prompt:
|
|
38
|
-
"Analyze UI issue: $ARGUMENTS\n\nIdentify:\n- The visual problem\n- Affected components\n- Suggested fix approach",
|
|
39
|
-
});
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
## Check Design System
|
|
43
|
-
|
|
44
|
-
!`grep -r "var(--" src/styles/ | head -10`
|
|
45
|
-
!`grep -r "theme\." src/components/ | head -10`
|
|
46
|
-
|
|
47
|
-
Use existing tokens, not hardcoded values:
|
|
48
|
-
|
|
49
|
-
- ✅ Existing color tokens
|
|
50
|
-
- ✅ Existing spacing scale
|
|
51
|
-
- ✅ Existing typography scale
|
|
52
|
-
- ❌ Hardcoded colors/px values
|
|
53
|
-
|
|
54
|
-
## Avoid AI Slop
|
|
55
|
-
|
|
56
|
-
| Avoid | Use Instead |
|
|
57
|
-
| -------------------------- | ----------------------- |
|
|
58
|
-
| Inter/system-ui everywhere | Distinctive fonts |
|
|
59
|
-
| Purple/blue gradients | Project color palette |
|
|
60
|
-
| Flat backgrounds | Subtle depth/texture |
|
|
61
|
-
| Generic rounded corners | Consistent radius scale |
|
|
62
|
-
|
|
63
|
-
## Implement Fix
|
|
64
|
-
|
|
65
|
-
1. Identify affected files
|
|
66
|
-
2. Make minimal CSS/component changes
|
|
67
|
-
3. Use design tokens
|
|
68
|
-
4. Test in browser
|
|
69
|
-
|
|
70
|
-
## Capture After State
|
|
71
|
-
|
|
72
|
-
Save to `.beads/artifacts/$ARGUMENTS/after.png`.
|
|
73
|
-
|
|
74
|
-
## Verify
|
|
75
|
-
|
|
76
|
-
**Visual:** Compare before/after screenshots
|
|
77
|
-
|
|
78
|
-
**Responsive:** Test at 375px, 768px, 1280px
|
|
79
|
-
|
|
80
|
-
**A11y (if --a11y):**
|
|
81
|
-
|
|
82
|
-
- Color contrast (4.5:1 for text)
|
|
83
|
-
- Keyboard navigation
|
|
84
|
-
- Focus states visible
|
|
85
|
-
|
|
86
|
-
**Tests:**
|
|
87
|
-
|
|
88
|
-
```bash
|
|
89
|
-
npm test -- --grep "component-name"
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
## Commit
|
|
93
|
-
|
|
94
|
-
```bash
|
|
95
|
-
git add <files>
|
|
96
|
-
git commit -m "fix(ui): [description]"
|
|
97
|
-
|
|
98
|
-
bd sync
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
## Output
|
|
102
|
-
|
|
103
|
-
```
|
|
104
|
-
UI Fixed: $ARGUMENTS
|
|
105
|
-
|
|
106
|
-
Before: .beads/artifacts/$ARGUMENTS/before.png
|
|
107
|
-
After: .beads/artifacts/$ARGUMENTS/after.png
|
|
108
|
-
|
|
109
|
-
Verification:
|
|
110
|
-
- Visual: ✓
|
|
111
|
-
- Responsive: ✓
|
|
112
|
-
- A11y: [✓/⚠️]
|
|
113
|
-
- Tests: ✓
|
|
114
|
-
|
|
115
|
-
Design tokens: Used ✓
|
|
116
|
-
AI slop: None ✓
|
|
117
|
-
```
|
|
@@ -1,168 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: Debug and fix an issue
|
|
3
|
-
argument-hint: "<issue or bead-id> [--quick]"
|
|
4
|
-
agent: build
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# Fix: $ARGUMENTS
|
|
8
|
-
|
|
9
|
-
You're debugging and fixing an issue. Understand before you fix.
|
|
10
|
-
|
|
11
|
-
## Load Context
|
|
12
|
-
|
|
13
|
-
If `$ARGUMENTS` is a bead ID:
|
|
14
|
-
|
|
15
|
-
!`bd show $ARGUMENTS`
|
|
16
|
-
!`cat .beads/artifacts/$ARGUMENTS/spec.md 2>/dev/null`
|
|
17
|
-
|
|
18
|
-
## Parse The Error
|
|
19
|
-
|
|
20
|
-
Extract from the issue:
|
|
21
|
-
|
|
22
|
-
- **Error message** - exact text
|
|
23
|
-
- **Stack trace** - file:line references
|
|
24
|
-
- **Reproduction** - steps to trigger
|
|
25
|
-
- **Expected vs Actual** - what should happen vs what happens
|
|
26
|
-
|
|
27
|
-
## Estimate Complexity
|
|
28
|
-
|
|
29
|
-
- **S** (~10 calls): Error points to exact line, obvious fix
|
|
30
|
-
- **M** (~30 calls): Clear reproduction, known area
|
|
31
|
-
- **L** (~100 calls): Intermittent, multiple files, needs investigation
|
|
32
|
-
- **XL**: Should be decomposed or researched first
|
|
33
|
-
|
|
34
|
-
If `--quick` flag: Skip deep analysis, fix directly.
|
|
35
|
-
|
|
36
|
-
## Quick Fix (S or --quick)
|
|
37
|
-
|
|
38
|
-
1. Go to error location
|
|
39
|
-
2. Identify obvious cause
|
|
40
|
-
3. Make minimal fix
|
|
41
|
-
4. Run targeted test
|
|
42
|
-
5. Commit
|
|
43
|
-
|
|
44
|
-
## Systematic Debug (M/L)
|
|
45
|
-
|
|
46
|
-
Load the debugging skill:
|
|
47
|
-
|
|
48
|
-
```typescript
|
|
49
|
-
skill({ name: "systematic-debugging" });
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
**Phase 1: Root Cause (NO fixes yet)**
|
|
53
|
-
|
|
54
|
-
Read error location. Trace data flow backward. Check recent changes:
|
|
55
|
-
|
|
56
|
-
!`git log -p --since="1 week ago" -- <file>`
|
|
57
|
-
|
|
58
|
-
Form a hypothesis. Write it down before fixing anything.
|
|
59
|
-
|
|
60
|
-
**Phase 2: Reproduce**
|
|
61
|
-
|
|
62
|
-
Write a failing test that reproduces the bug:
|
|
63
|
-
|
|
64
|
-
```bash
|
|
65
|
-
npm test -- --grep "<bug-related>"
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
Verify it fails for the right reason.
|
|
69
|
-
|
|
70
|
-
**Phase 3: Fix**
|
|
71
|
-
|
|
72
|
-
Make the fix. Verify test passes. Run full suite:
|
|
73
|
-
|
|
74
|
-
```bash
|
|
75
|
-
npm test
|
|
76
|
-
npm run type-check
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
## Rollback Strategy
|
|
80
|
-
|
|
81
|
-
Before making changes:
|
|
82
|
-
|
|
83
|
-
```bash
|
|
84
|
-
git stash # or note current commit
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
If fix makes things worse:
|
|
88
|
-
|
|
89
|
-
```bash
|
|
90
|
-
git checkout -- <file>
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
## Document Root Cause
|
|
94
|
-
|
|
95
|
-
Create observation:
|
|
96
|
-
|
|
97
|
-
```typescript
|
|
98
|
-
observation({
|
|
99
|
-
type: "bugfix",
|
|
100
|
-
title: "[brief description]",
|
|
101
|
-
content: "Root cause: [what]\nFix: [how]\nPrevention: [future]",
|
|
102
|
-
bead_id: "$ARGUMENTS",
|
|
103
|
-
});
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
If it's a gotcha worth remembering, update `project/gotchas.md`.
|
|
107
|
-
|
|
108
|
-
## Complete
|
|
109
|
-
|
|
110
|
-
If all verifications pass:
|
|
111
|
-
|
|
112
|
-
```bash
|
|
113
|
-
git add <files>
|
|
114
|
-
git status
|
|
115
|
-
git diff --cached --stat
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
**Use question tool to get commit decision:**
|
|
119
|
-
|
|
120
|
-
```typescript
|
|
121
|
-
question({
|
|
122
|
-
questions: [
|
|
123
|
-
{
|
|
124
|
-
header: "Commit",
|
|
125
|
-
question: "Fix Complete: $ARGUMENTS. What should I do next?",
|
|
126
|
-
options: [
|
|
127
|
-
{
|
|
128
|
-
label: "Commit changes (Recommended)",
|
|
129
|
-
description: "Git commit and bd sync",
|
|
130
|
-
},
|
|
131
|
-
{
|
|
132
|
-
label: "Show diff first",
|
|
133
|
-
description: "Review changes before committing",
|
|
134
|
-
},
|
|
135
|
-
{
|
|
136
|
-
label: "Skip commit",
|
|
137
|
-
description: "I'll review and commit manually",
|
|
138
|
-
},
|
|
139
|
-
],
|
|
140
|
-
},
|
|
141
|
-
],
|
|
142
|
-
});
|
|
143
|
-
```
|
|
144
|
-
|
|
145
|
-
If user confirms:
|
|
146
|
-
|
|
147
|
-
```bash
|
|
148
|
-
git commit -m "fix: [description]
|
|
149
|
-
|
|
150
|
-
Root cause: [brief]
|
|
151
|
-
$ARGUMENTS"
|
|
152
|
-
|
|
153
|
-
bd sync
|
|
154
|
-
```
|
|
155
|
-
|
|
156
|
-
## Output
|
|
157
|
-
|
|
158
|
-
```
|
|
159
|
-
Fixed: $ARGUMENTS
|
|
160
|
-
|
|
161
|
-
Root cause: [brief]
|
|
162
|
-
Changes: [files]
|
|
163
|
-
Tests: Pass
|
|
164
|
-
|
|
165
|
-
Next:
|
|
166
|
-
- /finish $ARGUMENTS # Close the bead
|
|
167
|
-
- /pr $ARGUMENTS # Create PR
|
|
168
|
-
```
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: Create distinctive, production-grade frontend interfaces
|
|
3
|
-
argument-hint: "[component/page description]"
|
|
4
|
-
agent: build
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# Frontend Design: $ARGUMENTS
|
|
8
|
-
|
|
9
|
-
Create UI components, pages, or applications with React, Tailwind CSS v4, shadcn/ui, and Motion.
|
|
10
|
-
|
|
11
|
-
## Load Skill
|
|
12
|
-
|
|
13
|
-
```typescript
|
|
14
|
-
skill({ name: "frontend-design" });
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
Then follow the skill instructions to create the interface.
|
|
18
|
-
|
|
19
|
-
<user-request>
|
|
20
|
-
$ARGUMENTS
|
|
21
|
-
</user-request>
|
|
@@ -1,349 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: Generate technical diagrams, flowcharts, and visual documentation
|
|
3
|
-
argument-hint: "<description> [--type=<type>] [--style=<style>] [--format=<format>] [--from-code]"
|
|
4
|
-
agent: vision
|
|
5
|
-
model: proxypal/gemini-3-flash-preview
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
# Generate Diagram: $ARGUMENTS
|
|
9
|
-
|
|
10
|
-
Generate technical diagrams and visual documentation with Mermaid code output.
|
|
11
|
-
|
|
12
|
-
## Parse Arguments
|
|
13
|
-
|
|
14
|
-
| Argument | Default | Options |
|
|
15
|
-
| ------------- | --------- | ------------------------------- |
|
|
16
|
-
| Description | required | What the diagram shows |
|
|
17
|
-
| `--type` | flowchart | See diagram types below |
|
|
18
|
-
| `--style` | clean | clean, sketch, formal, colorful |
|
|
19
|
-
| `--format` | both | png, svg, mermaid, both |
|
|
20
|
-
| `--size` | medium | simple, medium, complex |
|
|
21
|
-
| `--from-code` | false | Analyze codebase to generate |
|
|
22
|
-
| `--colors` | default | Brand colors or preset |
|
|
23
|
-
|
|
24
|
-
---
|
|
25
|
-
|
|
26
|
-
## Diagram Types
|
|
27
|
-
|
|
28
|
-
| Type | Description | Best For |
|
|
29
|
-
| -------------- | ---------------------------------------- | ----------------------- |
|
|
30
|
-
| `flowchart` | Process flows, decision trees | Workflows, algorithms |
|
|
31
|
-
| `sequence` | Interaction sequences, API calls | System interactions |
|
|
32
|
-
| `architecture` | System components, infrastructure | High-level design |
|
|
33
|
-
| `erd` | Entity relationship diagrams | Database design |
|
|
34
|
-
| `class` | Class diagrams, inheritance | OOP design |
|
|
35
|
-
| `state` | State machines, transitions | UI states, workflows |
|
|
36
|
-
| `mindmap` | Hierarchical concepts | Brainstorming, planning |
|
|
37
|
-
| `gantt` | Timeline, project schedule | Project planning |
|
|
38
|
-
| `wireframe` | UI layouts, screen mockups | UX design |
|
|
39
|
-
| `network` | Network topology | Infrastructure |
|
|
40
|
-
| `c4` | C4 model (context, container, component) | Architecture docs |
|
|
41
|
-
|
|
42
|
-
---
|
|
43
|
-
|
|
44
|
-
## Workflow: AI vs Mermaid-First
|
|
45
|
-
|
|
46
|
-
### Use AI Generation When:
|
|
47
|
-
|
|
48
|
-
- Creating wireframes or visual mockups
|
|
49
|
-
- Need artistic/sketch style
|
|
50
|
-
- Complex visual that Mermaid can't express
|
|
51
|
-
|
|
52
|
-
### Use Mermaid-First When:
|
|
53
|
-
|
|
54
|
-
- Technical diagrams (flowchart, sequence, erd, class)
|
|
55
|
-
- Need precise control over structure
|
|
56
|
-
- Will iterate on the diagram
|
|
57
|
-
- Need version-controlled diagrams
|
|
58
|
-
|
|
59
|
-
**Recommendation:** For technical diagrams, this command generates Mermaid code that you can edit and render.
|
|
60
|
-
|
|
61
|
-
---
|
|
62
|
-
|
|
63
|
-
## Mermaid Syntax Reference
|
|
64
|
-
|
|
65
|
-
### Flowchart
|
|
66
|
-
|
|
67
|
-
```mermaid
|
|
68
|
-
flowchart TD
|
|
69
|
-
A[Start] --> B{Decision?}
|
|
70
|
-
B -->|Yes| C[Action 1]
|
|
71
|
-
B -->|No| D[Action 2]
|
|
72
|
-
C --> E[End]
|
|
73
|
-
D --> E
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
**Shapes:** `[Rectangle]` `(Rounded)` `{Diamond}` `([Stadium])` `[[Subroutine]]`
|
|
77
|
-
**Directions:** `TD` (top-down), `LR` (left-right), `BT`, `RL`
|
|
78
|
-
|
|
79
|
-
### Sequence Diagram
|
|
80
|
-
|
|
81
|
-
```mermaid
|
|
82
|
-
sequenceDiagram
|
|
83
|
-
participant U as User
|
|
84
|
-
participant A as API
|
|
85
|
-
participant D as Database
|
|
86
|
-
|
|
87
|
-
U->>A: POST /login
|
|
88
|
-
A->>D: Query user
|
|
89
|
-
D-->>A: User data
|
|
90
|
-
A-->>U: JWT token
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
**Arrows:** `->>` (solid), `-->>` (dashed), `-x` (cross), `-)` (async)
|
|
94
|
-
|
|
95
|
-
### Entity Relationship
|
|
96
|
-
|
|
97
|
-
```mermaid
|
|
98
|
-
erDiagram
|
|
99
|
-
USER ||--o{ ORDER : places
|
|
100
|
-
ORDER ||--|{ LINE_ITEM : contains
|
|
101
|
-
PRODUCT ||--o{ LINE_ITEM : includes
|
|
102
|
-
|
|
103
|
-
USER {
|
|
104
|
-
int id PK
|
|
105
|
-
string email
|
|
106
|
-
string name
|
|
107
|
-
}
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
**Cardinality:** `||` (one), `o{` (zero or more), `|{` (one or more)
|
|
111
|
-
|
|
112
|
-
### Class Diagram
|
|
113
|
-
|
|
114
|
-
```mermaid
|
|
115
|
-
classDiagram
|
|
116
|
-
class User {
|
|
117
|
-
+String email
|
|
118
|
-
+String name
|
|
119
|
-
+login()
|
|
120
|
-
+logout()
|
|
121
|
-
}
|
|
122
|
-
class Admin {
|
|
123
|
-
+deleteUser()
|
|
124
|
-
}
|
|
125
|
-
User <|-- Admin
|
|
126
|
-
```
|
|
127
|
-
|
|
128
|
-
**Relationships:** `<|--` (inheritance), `*--` (composition), `o--` (aggregation)
|
|
129
|
-
|
|
130
|
-
### State Diagram
|
|
131
|
-
|
|
132
|
-
```mermaid
|
|
133
|
-
stateDiagram-v2
|
|
134
|
-
[*] --> Idle
|
|
135
|
-
Idle --> Loading : fetch
|
|
136
|
-
Loading --> Success : resolve
|
|
137
|
-
Loading --> Error : reject
|
|
138
|
-
Success --> Idle : reset
|
|
139
|
-
Error --> Idle : retry
|
|
140
|
-
```
|
|
141
|
-
|
|
142
|
-
### Gantt Chart
|
|
143
|
-
|
|
144
|
-
```mermaid
|
|
145
|
-
gantt
|
|
146
|
-
title Project Timeline
|
|
147
|
-
dateFormat YYYY-MM-DD
|
|
148
|
-
section Phase 1
|
|
149
|
-
Design :a1, 2024-01-01, 2w
|
|
150
|
-
Development :a2, after a1, 4w
|
|
151
|
-
section Phase 2
|
|
152
|
-
Testing :a3, after a2, 2w
|
|
153
|
-
```
|
|
154
|
-
|
|
155
|
-
### Mindmap
|
|
156
|
-
|
|
157
|
-
```mermaid
|
|
158
|
-
mindmap
|
|
159
|
-
root((Project))
|
|
160
|
-
Frontend
|
|
161
|
-
React
|
|
162
|
-
Tailwind
|
|
163
|
-
Backend
|
|
164
|
-
Node.js
|
|
165
|
-
PostgreSQL
|
|
166
|
-
DevOps
|
|
167
|
-
Docker
|
|
168
|
-
AWS
|
|
169
|
-
```
|
|
170
|
-
|
|
171
|
-
---
|
|
172
|
-
|
|
173
|
-
## Style Options
|
|
174
|
-
|
|
175
|
-
| Style | Description | Use Case |
|
|
176
|
-
| ---------- | ----------------------- | ---------------------------- |
|
|
177
|
-
| `clean` | Minimal, professional | Documentation, presentations |
|
|
178
|
-
| `sketch` | Hand-drawn appearance | Informal, brainstorming |
|
|
179
|
-
| `formal` | Box borders, structured | Enterprise, technical docs |
|
|
180
|
-
| `colorful` | Vibrant, color-coded | Marketing, education |
|
|
181
|
-
|
|
182
|
-
---
|
|
183
|
-
|
|
184
|
-
## Codebase Integration (--from-code)
|
|
185
|
-
|
|
186
|
-
Analyze actual code to generate diagrams:
|
|
187
|
-
|
|
188
|
-
```bash
|
|
189
|
-
# Generate architecture from imports
|
|
190
|
-
/generate-diagram system architecture --from-code --type=architecture
|
|
191
|
-
|
|
192
|
-
# Generate ERD from models
|
|
193
|
-
/generate-diagram database schema --from-code --type=erd
|
|
194
|
-
|
|
195
|
-
# Generate class diagram from TypeScript
|
|
196
|
-
/generate-diagram class relationships --from-code --type=class
|
|
197
|
-
```
|
|
198
|
-
|
|
199
|
-
**How it works:**
|
|
200
|
-
|
|
201
|
-
1. Scans relevant source files
|
|
202
|
-
2. Extracts structure (classes, functions, imports)
|
|
203
|
-
3. Generates Mermaid code representing actual codebase
|
|
204
|
-
4. Renders as diagram
|
|
205
|
-
|
|
206
|
-
---
|
|
207
|
-
|
|
208
|
-
## Examples by Type
|
|
209
|
-
|
|
210
|
-
### Flowchart
|
|
211
|
-
|
|
212
|
-
```bash
|
|
213
|
-
# User authentication flow
|
|
214
|
-
/generate-diagram user login process with email verification --type=flowchart
|
|
215
|
-
|
|
216
|
-
# Algorithm
|
|
217
|
-
/generate-diagram binary search algorithm --type=flowchart --style=clean
|
|
218
|
-
```
|
|
219
|
-
|
|
220
|
-
### Sequence Diagram
|
|
221
|
-
|
|
222
|
-
```bash
|
|
223
|
-
# API flow
|
|
224
|
-
/generate-diagram OAuth2 authentication flow between client, auth server, and resource server --type=sequence
|
|
225
|
-
|
|
226
|
-
# Microservice communication
|
|
227
|
-
/generate-diagram order processing across payment, inventory, and shipping services --type=sequence
|
|
228
|
-
```
|
|
229
|
-
|
|
230
|
-
### Architecture
|
|
231
|
-
|
|
232
|
-
```bash
|
|
233
|
-
# System overview
|
|
234
|
-
/generate-diagram e-commerce platform with React frontend, Node API, and PostgreSQL --type=architecture
|
|
235
|
-
|
|
236
|
-
# Cloud infrastructure
|
|
237
|
-
/generate-diagram AWS deployment with ECS, RDS, and CloudFront --type=architecture --style=formal
|
|
238
|
-
```
|
|
239
|
-
|
|
240
|
-
### ERD
|
|
241
|
-
|
|
242
|
-
```bash
|
|
243
|
-
# Database schema
|
|
244
|
-
/generate-diagram user management system with users, roles, and permissions --type=erd
|
|
245
|
-
|
|
246
|
-
# E-commerce
|
|
247
|
-
/generate-diagram product catalog with categories, variants, and inventory --type=erd
|
|
248
|
-
```
|
|
249
|
-
|
|
250
|
-
### State Diagram
|
|
251
|
-
|
|
252
|
-
```bash
|
|
253
|
-
# UI states
|
|
254
|
-
/generate-diagram form submission states from idle to loading to success or error --type=state
|
|
255
|
-
|
|
256
|
-
# Order lifecycle
|
|
257
|
-
/generate-diagram order status from pending through processing, shipped, delivered --type=state
|
|
258
|
-
```
|
|
259
|
-
|
|
260
|
-
---
|
|
261
|
-
|
|
262
|
-
## Size/Complexity Guidance
|
|
263
|
-
|
|
264
|
-
| Size | Elements | Description |
|
|
265
|
-
| --------- | ---------- | ---------------------------- |
|
|
266
|
-
| `simple` | 3-5 nodes | Quick sketch, single concept |
|
|
267
|
-
| `medium` | 6-12 nodes | Standard documentation |
|
|
268
|
-
| `complex` | 13+ nodes | Comprehensive system view |
|
|
269
|
-
|
|
270
|
-
**Tip:** Start simple, iterate to add detail.
|
|
271
|
-
|
|
272
|
-
---
|
|
273
|
-
|
|
274
|
-
## Output
|
|
275
|
-
|
|
276
|
-
### File Structure
|
|
277
|
-
|
|
278
|
-
```
|
|
279
|
-
.opencode/memory/design/diagrams/[name]/
|
|
280
|
-
├── diagram.png # Rendered image
|
|
281
|
-
├── diagram.svg # Vector version
|
|
282
|
-
├── diagram.mmd # Mermaid source code
|
|
283
|
-
└── README.md # Usage notes
|
|
284
|
-
```
|
|
285
|
-
|
|
286
|
-
### Inline Output
|
|
287
|
-
|
|
288
|
-
```markdown
|
|
289
|
-
## Generated Diagram
|
|
290
|
-
|
|
291
|
-
**Type:** sequence
|
|
292
|
-
**Description:** User authentication flow
|
|
293
|
-
|
|
294
|
-
### Mermaid Code
|
|
295
|
-
|
|
296
|
-
\`\`\`mermaid
|
|
297
|
-
sequenceDiagram
|
|
298
|
-
User->>Auth: Login request
|
|
299
|
-
Auth->>DB: Validate credentials
|
|
300
|
-
DB-->>Auth: User data
|
|
301
|
-
Auth-->>User: JWT token
|
|
302
|
-
\`\`\`
|
|
303
|
-
|
|
304
|
-
### Rendered
|
|
305
|
-
|
|
306
|
-
[PNG/SVG image displayed]
|
|
307
|
-
|
|
308
|
-
### Usage
|
|
309
|
-
|
|
310
|
-
- Embed in GitHub markdown (supports Mermaid natively)
|
|
311
|
-
- Use Mermaid Live Editor for modifications
|
|
312
|
-
- Export to PNG/SVG for presentations
|
|
313
|
-
```
|
|
314
|
-
|
|
315
|
-
---
|
|
316
|
-
|
|
317
|
-
## Rendering Options
|
|
318
|
-
|
|
319
|
-
| Platform | Mermaid Support |
|
|
320
|
-
| ------------ | -------------------- |
|
|
321
|
-
| GitHub | Native in markdown |
|
|
322
|
-
| GitLab | Native in markdown |
|
|
323
|
-
| Notion | Via code block |
|
|
324
|
-
| Confluence | Via plugin |
|
|
325
|
-
| VS Code | Via extension |
|
|
326
|
-
| Mermaid Live | https://mermaid.live |
|
|
327
|
-
|
|
328
|
-
---
|
|
329
|
-
|
|
330
|
-
## Limitations
|
|
331
|
-
|
|
332
|
-
| Limitation | Workaround |
|
|
333
|
-
| ------------------- | --------------------------------------------------- |
|
|
334
|
-
| Very large diagrams | Break into multiple smaller diagrams |
|
|
335
|
-
| Custom icons | Use external tool, embed as image |
|
|
336
|
-
| Precise positioning | Mermaid auto-layouts; use external tool for control |
|
|
337
|
-
| Complex styling | Basic theming only; export SVG for advanced styling |
|
|
338
|
-
| Wireframes | AI-generated image better than Mermaid |
|
|
339
|
-
|
|
340
|
-
---
|
|
341
|
-
|
|
342
|
-
## Related Commands
|
|
343
|
-
|
|
344
|
-
| Need | Command |
|
|
345
|
-
| -------------------- | ------------------ |
|
|
346
|
-
| Analyze mockup | `/analyze-mockup` |
|
|
347
|
-
| Generate image | `/generate-image` |
|
|
348
|
-
| Review architecture | `/review-codebase` |
|
|
349
|
-
| Create documentation | `/summarize` |
|