opencode-sdlc-plugin 0.1.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 (42) hide show
  1. package/README.md +60 -0
  2. package/agents/design-facilitator.md +8 -0
  3. package/agents/domain.md +9 -0
  4. package/agents/exploration.md +8 -0
  5. package/agents/green.md +9 -0
  6. package/agents/marvin.md +15 -0
  7. package/agents/model-checker.md +9 -0
  8. package/agents/red.md +9 -0
  9. package/commands/sdlc-adr.md +37 -0
  10. package/commands/sdlc-design.md +88 -0
  11. package/commands/sdlc-domain-audit.md +32 -0
  12. package/commands/sdlc-plan.md +63 -0
  13. package/commands/sdlc-pr.md +43 -0
  14. package/commands/sdlc-recall.md +18 -0
  15. package/commands/sdlc-remember.md +19 -0
  16. package/commands/sdlc-review.md +192 -0
  17. package/commands/sdlc-setup.md +50 -0
  18. package/commands/sdlc-start.md +34 -0
  19. package/commands/sdlc-work.md +118 -0
  20. package/config/presets/event-modeling.json +12 -0
  21. package/config/presets/traditional.json +12 -0
  22. package/config/schemas/sdlc.schema.json +48 -0
  23. package/dist/cli/index.d.ts +1 -0
  24. package/dist/cli/index.js +703 -0
  25. package/dist/cli/index.js.map +1 -0
  26. package/dist/index.d.ts +2 -0
  27. package/dist/index.js +474 -0
  28. package/dist/index.js.map +1 -0
  29. package/dist/plugin/index.d.ts +5 -0
  30. package/dist/plugin/index.js +476 -0
  31. package/dist/plugin/index.js.map +1 -0
  32. package/package.json +56 -0
  33. package/skills/adr-policy.md +21 -0
  34. package/skills/atomic-design.md +39 -0
  35. package/skills/debugging-protocol.md +47 -0
  36. package/skills/event-modeling.md +40 -0
  37. package/skills/git-spice.md +44 -0
  38. package/skills/github-issues.md +44 -0
  39. package/skills/memory-protocol.md +41 -0
  40. package/skills/orchestration.md +118 -0
  41. package/skills/skill-enforcement.md +56 -0
  42. package/skills/tdd-constraints.md +63 -0
package/package.json ADDED
@@ -0,0 +1,56 @@
1
+ {
2
+ "name": "opencode-sdlc-plugin",
3
+ "version": "0.1.0",
4
+ "description": "OpenCode SDLC workflow plugin with event modeling, ADRs, and TDD orchestration",
5
+ "type": "module",
6
+ "bin": {
7
+ "opencode-sdlc-plugin": "dist/cli/index.js"
8
+ },
9
+ "exports": {
10
+ ".": "./dist/index.js",
11
+ "./plugin": "./dist/plugin/index.js"
12
+ },
13
+ "publishConfig": {
14
+ "access": "public"
15
+ },
16
+ "files": [
17
+ "dist",
18
+ "commands",
19
+ "skills",
20
+ "agents",
21
+ "config"
22
+ ],
23
+ "scripts": {
24
+ "build": "tsup",
25
+ "dev": "tsup --watch",
26
+ "lint": "eslint .",
27
+ "typecheck": "tsc --noEmit",
28
+ "test": "vitest run",
29
+ "test:watch": "vitest",
30
+ "test:coverage": "vitest run --coverage",
31
+ "test:integration": "vitest run --config vitest.integration.config.ts",
32
+ "test:coverage:integration": "vitest run --coverage --config vitest.integration.config.ts"
33
+ },
34
+ "dependencies": {
35
+ "@inquirer/prompts": "^7.1.0",
36
+ "@opencode-ai/plugin": "^1.1.24",
37
+ "commander": "^12.1.0",
38
+ "fs-extra": "^11.2.0",
39
+ "kleur": "^4.1.5",
40
+ "ora": "^8.0.1",
41
+ "picomatch": "^4.0.2",
42
+ "zod": "^3.23.8"
43
+ },
44
+ "devDependencies": {
45
+ "@eslint/js": "^9.39.2",
46
+ "@types/fs-extra": "^11.0.4",
47
+ "@types/node": "^20.11.30",
48
+ "@types/picomatch": "^4.0.2",
49
+ "@vitest/coverage-v8": "^4.0.17",
50
+ "eslint": "^9.9.0",
51
+ "tsup": "^8.2.4",
52
+ "typescript": "^5.6.3",
53
+ "typescript-eslint": "^8.53.0",
54
+ "vitest": "^4.0.17"
55
+ }
56
+ }
@@ -0,0 +1,21 @@
1
+ ---
2
+ description: ADR policy and ARCHITECTURE synthesis
3
+ ---
4
+
5
+ # ADR Policy
6
+
7
+ ## ADR Isolation (CRITICAL)
8
+
9
+ ADRs are archival only. Never reference ADRs in issues, PRs, reviews, or code. Use `docs/ARCHITECTURE.md`.
10
+
11
+ ## ADR Format
12
+
13
+ - Context
14
+ - Decision
15
+ - Consequences
16
+
17
+ ## ARCHITECTURE.md
18
+
19
+ - Synthesizes all accepted ADRs
20
+ - Treated as the current state projection
21
+ - Regenerated when ADRs change
@@ -0,0 +1,39 @@
1
+ ---
2
+ description: Atomic Design UI methodology
3
+ ---
4
+
5
+ # Atomic Design
6
+
7
+ Use for UI systems; skip for CLI tools, libraries, or API-only services.
8
+
9
+ ## Prerequisites
10
+
11
+ - `docs/ARCHITECTURE.md` exists
12
+ - Event model workflows include wireframes (if applicable)
13
+
14
+ ## Hierarchy
15
+
16
+ | Level | Description | Examples |
17
+ |-------|-------------|----------|
18
+ | Atoms | Basic elements | Buttons, inputs, labels, icons |
19
+ | Molecules | Small combinations | Form fields, cards |
20
+ | Organisms | Complex components | Navigation, forms |
21
+ | Templates | Page layouts | Dashboard, list view |
22
+ | Pages | Assembled screens | Full flows |
23
+
24
+ ## Process
25
+
26
+ 1. Analyze wireframes for common patterns.
27
+ 2. Capture visual style preferences.
28
+ 3. Create design tokens (color, typography, spacing).
29
+ 4. Build hierarchy from atoms → molecules → organisms → templates.
30
+ 5. Map read models to component data requirements.
31
+
32
+ ## Artifacts Location
33
+
34
+ - `docs/design-system/`
35
+
36
+ ## Integration
37
+
38
+ - Uses event model wireframes.
39
+ - Reviewed by `@ux`.
@@ -0,0 +1,47 @@
1
+ ---
2
+ description: Debugging protocol for investigation
3
+ ---
4
+
5
+ # Debugging Protocol (MANDATORY)
6
+
7
+ No fixes without root-cause investigation.
8
+
9
+ ## Before Debugging
10
+
11
+ Always search memento:
12
+ ```
13
+ /sdlc-recall "<error message> fix"
14
+ ```
15
+
16
+ ## Phase 1: Root Cause Investigation
17
+
18
+ - Read full error output.
19
+ - Reproduce consistently.
20
+ - Trace failing data flow.
21
+ - Check recent changes.
22
+
23
+ ## Phase 2: Pattern Analysis
24
+
25
+ - Find working examples.
26
+ - Compare line-by-line differences.
27
+ - Identify dependencies.
28
+
29
+ ## Phase 3: Hypothesis and Testing
30
+
31
+ - Form ONE hypothesis.
32
+ - Test with ONE minimal change.
33
+ - Confirm or refute before proceeding.
34
+
35
+ ## Phase 4: Implementation
36
+
37
+ - Add/confirm failing test.
38
+ - Fix root cause, not symptoms.
39
+ - Verify with tests.
40
+
41
+ ## Escalation Rule
42
+
43
+ After 3 failed fixes: stop and re-examine architecture.
44
+
45
+ ## Defense in Depth
46
+
47
+ Add validation across layers (entry, business, environment, diagnostics).
@@ -0,0 +1,40 @@
1
+ ---
2
+ description: Event modeling methodology
3
+ ---
4
+
5
+ # Event Modeling
6
+
7
+ Follow Martin Dilger’s event sourcing methodology.
8
+
9
+ ## Core Principles
10
+
11
+ - Events are immutable facts in past tense using business language.
12
+ - Do not lose information; store what happened, not just current state.
13
+ - Every read model attribute must trace back to an event.
14
+
15
+ ## Four Patterns
16
+
17
+ 1. **State Change**: Command → Event (state mutation)
18
+ 2. **State View**: Events → Read Model (query projection)
19
+ 3. **Automation**: Event → Process → Command → Event (background work)
20
+ 4. **Translation**: External data → Internal event (anti-corruption layer)
21
+
22
+ ## Mapping to Work Tracking (Non-Negotiable)
23
+
24
+ | Event Modeling | GitHub Tracking |
25
+ |---------------|-----------------|
26
+ | Workflow | Epic (parent issue) |
27
+ | Vertical Slice | Story issue (1:1) |
28
+ | GWT scenarios | Acceptance criteria |
29
+
30
+ ## Artifacts Location
31
+
32
+ - `docs/event_model/domain/overview.md`
33
+ - `docs/event_model/workflows/<workflow>/overview.md`
34
+ - `docs/event_model/workflows/<workflow>/slices/*.md`
35
+
36
+ ## Story Review Perspectives
37
+
38
+ - `@story` for business value and slice thinness
39
+ - `@architect` for feasibility and risks
40
+ - `@ux` for user journey coherence
@@ -0,0 +1,44 @@
1
+ ---
2
+ description: git-spice stacked PR workflow
3
+ ---
4
+
5
+ # git-spice Workflow
6
+
7
+ Use only if `features.gitSpice` is enabled.
8
+
9
+ ## When to Use
10
+
11
+ - Dependent, stacked changes
12
+ - Already on a gs-managed branch
13
+
14
+ ## When to Skip
15
+
16
+ - Fresh work from main
17
+ - Standalone changes
18
+
19
+ ## Detection
20
+
21
+ ```
22
+ command -v gs && gs branch checkout 2>/dev/null
23
+ ```
24
+
25
+ ## Common Commands
26
+
27
+ ```
28
+ gs branch create <branch-name>
29
+ gs stack submit
30
+ gs repo sync
31
+ gs up
32
+ gs down
33
+ gs stack
34
+ ```
35
+
36
+ ## Decision Tree
37
+
38
+ 1. Is git-spice installed? If not, use regular git.
39
+ 2. Is branch gs-managed? If not, start with `gs branch create`.
40
+ 3. Ready to submit? Use `gs stack submit`.
41
+
42
+ ## Error Handling
43
+
44
+ If gs fails: run `gs repo sync`, then fall back to regular git.
@@ -0,0 +1,44 @@
1
+ ---
2
+ description: GitHub CLI extensions usage
3
+ ---
4
+
5
+ # GitHub CLI Extensions (MANDATORY)
6
+
7
+ Always prefer extensions over `gh api`.
8
+
9
+ ## Priority Order
10
+
11
+ 1. Extension commands
12
+ 2. Native `gh` commands
13
+ 3. `gh api` (last resort)
14
+
15
+ ## Extensions
16
+
17
+ ### gh-issue-ext
18
+ - `gh issue-ext sub list <issue>`
19
+ - `gh issue-ext sub add <parent> <child>`
20
+ - `gh issue-ext blocking add <blocked> <blocker>`
21
+ - `gh issue-ext blocking list <issue>`
22
+ - `gh issue-ext branch create <issue>`
23
+
24
+ ### gh-project-ext
25
+ - `gh project-ext ready`
26
+ - `gh project-ext move <issue> "In Progress"`
27
+ - `gh project-ext claim <issue>`
28
+
29
+ ### gh-pr-review
30
+ - `gh pr-review review view --pr <id> --unresolved`
31
+ - `gh pr-review comments reply --thread-id <id> --body "..."`
32
+ - `gh pr-review threads resolve --thread-id <id>`
33
+
34
+ ## `gh api` Is a Last Resort
35
+
36
+ Before using `gh api`:
37
+ 1. Check native `gh` commands
38
+ 2. Check installed extensions: `gh extension list`
39
+ 3. Search for extensions: `gh extension search <keywords>`
40
+ 4. Ask user whether to install or proceed
41
+
42
+ ## Task Management
43
+
44
+ GitHub Issues/Projects are the source of truth. Local todos are session-only.
@@ -0,0 +1,41 @@
1
+ ---
2
+ description: Memento MCP memory protocol
3
+ ---
4
+
5
+ # Memory Protocol (MANDATORY)
6
+
7
+ Knowledge capture and retrieval are prime directives.
8
+
9
+ ## Memory Skills
10
+
11
+ | Skill | Purpose | When to Use |
12
+ |-------|---------|-------------|
13
+ | `/sdlc-recall <query>` | Retrieve knowledge | Before ANY task, when errors occur |
14
+ | `/sdlc-remember <what>` | Store discoveries | After solving problems or learning conventions |
15
+
16
+ ## Before Any Task
17
+
18
+ Always run `/sdlc-recall` first. If you skip this, you are out of compliance.
19
+
20
+ ## When Commands Fail
21
+
22
+ Search first, debug second:
23
+ 1. `/sdlc-recall "<error message> fix"`
24
+ 2. Apply known solution
25
+ 3. Store new solution with `/sdlc-remember`
26
+
27
+ ## During and After Work
28
+
29
+ Store non-obvious insights:
30
+ - Solutions found through trial and error
31
+ - Project conventions or patterns
32
+ - User preferences and workflow choices
33
+ - Root-cause debugging insights
34
+
35
+ ## Subagent Responsibilities
36
+
37
+ Subagents should use `mcp__memento__*` tools directly and record discoveries.
38
+
39
+ ## Before Session End
40
+
41
+ Store unsaved discoveries prior to context compaction.
@@ -0,0 +1,118 @@
1
+ ---
2
+ description: SDLC orchestration and delegation rules
3
+ ---
4
+
5
+ # SDLC Orchestration Rules
6
+
7
+ The main conversation is an orchestrator only. It coordinates work but never edits files directly.
8
+
9
+ ## Core Protocol: Skill Enforcement
10
+
11
+ Before ANY task, invoke skill enforcement (1% rule, mandatory invocations, rationalization red flags).
12
+
13
+ ## ADR Isolation Principle (CRITICAL)
14
+
15
+ ADRs are archival documents. NEVER reference ADRs in issues, PRs, code comments, reviews, or slice docs. Always reference `docs/ARCHITECTURE.md` instead. Only consult ADRs when reconsidering architecture decisions.
16
+
17
+ ## File Operations (Mandatory Delegation)
18
+
19
+ The orchestrator MUST NEVER use Write/Edit. Delegate all file changes to agents.
20
+
21
+ ### Agent Selection Hierarchy
22
+
23
+ | File Type | Agent | Notes |
24
+ |-----------|-------|-------|
25
+ | Test files | `@red` | All test code, fixtures, helpers |
26
+ | Production code | `@green` | Minimal implementation only |
27
+ | Domain types | `@domain` | Value objects, types, invariants |
28
+ | ADRs | `@adr` | `docs/adr/*.md` |
29
+ | Architecture | `@architect` | `docs/ARCHITECTURE.md` |
30
+ | Event model docs | `@exploration`, `@discovery`, `@workflowDesigner`, `@gwt`, `@modelChecker` | `docs/event_model/**/*` |
31
+ | Everything else | `@fileUpdater` | Config, docs, scripts |
32
+
33
+ ### Update Request Detection
34
+
35
+ | Request Pattern | Agent |
36
+ |-----------------|-------|
37
+ | "Add a test" | `@red` |
38
+ | "Make the test pass" | `@green` |
39
+ | "Add a domain type" | `@domain` |
40
+ | "Write ADR" | `@adr` |
41
+ | "Update architecture" | `@architect` |
42
+ | "Update docs/config" | `@fileUpdater` |
43
+
44
+ ## TDD Workflow (Mandatory)
45
+
46
+ ```
47
+ RED → DOMAIN → GREEN → DOMAIN → REFACTOR
48
+ ```
49
+
50
+ - One failing test per RED cycle.
51
+ - DOMAIN review is mandatory after RED and after GREEN.
52
+ - No exceptions for “trivial” changes.
53
+
54
+ ### Anti-Patterns (Violations)
55
+
56
+ - “Quick fix” → violates TDD.
57
+ - “Just a UI tweak” → still requires domain review.
58
+ - “One-line change” → still requires full cycle.
59
+
60
+ ### Pre-Edit Checklist
61
+
62
+ - Is this a test file? → `@red`
63
+ - Is this production code? → `@green`
64
+ - Is this a domain type? → `@domain`
65
+ - Has domain review happened before GREEN?
66
+
67
+ ## Fresh Context Protocol (CRITICAL)
68
+
69
+ Agents have ZERO context. Always provide:
70
+ - File paths and excerpts
71
+ - Current test name
72
+ - Failure output
73
+ - Acceptance criteria
74
+ - Relevant domain types
75
+
76
+ ## Invocation Gate Protocol
77
+
78
+ ### Red Agent
79
+ ```
80
+ RED_CONTEXT: FIRST_TEST | CONTINUING
81
+ ACCEPTANCE_CRITERIA:
82
+ - <criterion>
83
+ ```
84
+
85
+ ### Domain Agent
86
+ ```
87
+ DOMAIN_CONTEXT: AFTER_RED | AFTER_GREEN
88
+ PHASE_COMPLETE:
89
+ - Test: <name>
90
+ - Failure/Result: <details>
91
+ ```
92
+
93
+ ### Green Agent
94
+ ```
95
+ RED_PHASE_COMPLETE:
96
+ - Test: <name>
97
+ - Failure: <error>
98
+ DOMAIN_CHECK_PASSED:
99
+ - Types: <list> OR "None"
100
+ ```
101
+
102
+ ## Agent Debate Protocol
103
+
104
+ - Domain agent has veto power.
105
+ - If dispute persists for 2 rounds, escalate to user.
106
+
107
+ ## Parallel Development (Worktrees)
108
+
109
+ If `config.git.worktrees` is true:
110
+ - Use `git worktree list` to choose context.
111
+ - Only run parallel slices with defined interfaces.
112
+
113
+ ## Code Review Gate
114
+
115
+ Three-stage review before PR:
116
+ 1. Spec compliance
117
+ 2. Code quality
118
+ 3. Domain integrity (compile-time enforcement audit)
@@ -0,0 +1,56 @@
1
+ ---
2
+ description: Skill invocation enforcement rules
3
+ ---
4
+
5
+ # Skill Invocation Enforcement (MANDATORY)
6
+
7
+ ## The 1% Rule
8
+
9
+ If there is even a 1% chance a skill applies, you MUST invoke it.
10
+
11
+ ## Mandatory Invocations
12
+
13
+ | Before... | ALWAYS invoke... | Even if... |
14
+ |-----------|------------------|-----------|
15
+ | ANY task | `/sdlc-recall` | "It's a simple change" |
16
+ | Writing ANY test | `@red` | "Just one test" |
17
+ | Writing ANY production code | `@green` | "One line" |
18
+ | Creating ANY type | `@domain` | "It's just a struct" |
19
+ | After RED | `@domain` | "Not a domain concern" |
20
+ | After GREEN | `@domain` | "Just UI" |
21
+ | Debugging | `debugging-protocol` | "I know the fix" |
22
+ | Finishing work | `/sdlc-remember` | "Not interesting" |
23
+
24
+ ## Rationalization Red Flags
25
+
26
+ - "This is simple"
27
+ - "Overkill"
28
+ - "Just this once"
29
+ - "No need for domain review"
30
+ - "I'll check memory after"
31
+
32
+ ## Skill Priority Order
33
+
34
+ 1. Memory (`/sdlc-recall`)
35
+ 2. Process (debugging protocol, orchestration)
36
+ 3. Implementation (red/green/domain)
37
+ 4. Documentation (ADR, GWT)
38
+
39
+ ## Non-Negotiables
40
+
41
+ - Memory recall before tasks
42
+ - TDD delegation via agents
43
+ - Domain review after RED and GREEN
44
+ - Verification before completion
45
+ - Memory storage after discoveries
46
+ - ADR isolation
47
+
48
+ ## ADR Isolation (CRITICAL)
49
+
50
+ Never reference ADRs in issues, PRs, reviews, or code. Use `docs/ARCHITECTURE.md`.
51
+
52
+ ## Self-Check Questions
53
+
54
+ - Did I search memento first?
55
+ - Am I delegating to the right agent?
56
+ - Am I skipping a step due to time pressure?
@@ -0,0 +1,63 @@
1
+ ---
2
+ description: File ownership and TDD constraints
3
+ ---
4
+
5
+ # Agent File Ownership Constraints
6
+
7
+ Each SDLC agent has strict file boundaries. These are ABSOLUTE.
8
+
9
+ ## Ownership Matrix
10
+
11
+ | File Pattern | Authorized Agent(s) | Others Blocked |
12
+ |--------------|---------------------|----------------|
13
+ | Test files (`*_test.*`, `*.test.*`, `tests/`, `__tests__/`, `spec/`) | `@red` | ✅ |
14
+ | Production code (`src/`, `lib/`, `app/`) | `@green` | ✅ |
15
+ | Domain types/models | `@domain` | ✅ |
16
+ | ADRs (`docs/adr/*.md`) | `@adr` | ✅ |
17
+ | `docs/ARCHITECTURE.md` | `@architect`, `@designFacilitator` | ✅ |
18
+ | Event model docs (`docs/event_model/**/*`) | `@exploration`, `@discovery`, `@workflowDesigner`, `@gwt`, `@modelChecker` | ✅ |
19
+ | Config/docs/scripts | `@fileUpdater` | - |
20
+
21
+ ## TDD Agents
22
+
23
+ ### `@red`
24
+ CAN edit: test files, fixtures, helpers.
25
+ CANNOT edit: production code, domain types, architecture.
26
+
27
+ ### `@green`
28
+ CAN edit: production implementation only.
29
+ CANNOT edit: test files, type definitions, event model docs.
30
+
31
+ ### `@domain`
32
+ CAN edit: domain types, value objects, invariants.
33
+ CANNOT edit: tests, implementation bodies, ADRs.
34
+
35
+ ## Architecture Agents
36
+
37
+ ### `@adr`
38
+ CAN edit: `docs/adr/*.md` only.
39
+ CANNOT edit: `docs/ARCHITECTURE.md` directly.
40
+
41
+ ### `@architect`
42
+ CAN edit: `docs/ARCHITECTURE.md` only.
43
+ CANNOT edit: ADRs, event model docs, code.
44
+
45
+ ### `@designFacilitator`
46
+ CAN edit: `docs/ARCHITECTURE.md` only.
47
+ CANNOT edit: ADRs, event model docs, code.
48
+
49
+ ## Event Modeling Agents
50
+
51
+ ### `@exploration`, `@discovery`, `@workflowDesigner`, `@gwt`, `@modelChecker`
52
+ CAN edit: `docs/event_model/**/*`.
53
+ CANNOT edit: ADRs, architecture, code.
54
+
55
+ ## Utility Agent
56
+
57
+ ### `@fileUpdater`
58
+ CAN edit: config, scripts, general docs not owned by other agents.
59
+ CANNOT edit: tests, production code, domain types, ADRs, architecture, event model docs.
60
+
61
+ ## If Blocked
62
+
63
+ Stop immediately, return to the orchestrator, and request the proper agent.