my-opencode 1.2.1 → 1.3.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 (39) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +259 -180
  3. package/agents/architect.md +30 -30
  4. package/agents/code-reviewer.md +29 -29
  5. package/agents/executor.md +30 -30
  6. package/agents/fullstack-dev.md +57 -57
  7. package/agents/spec-writer.md +37 -37
  8. package/agents/team-lead.md +60 -60
  9. package/agents/tech-writer.md +30 -30
  10. package/agents/test-engineer.md +30 -30
  11. package/agents/verifier.md +33 -33
  12. package/bin/cli.js +341 -311
  13. package/bin/moc +199 -0
  14. package/opencode.json +170 -167
  15. package/package.json +50 -48
  16. package/plugins/README.md +64 -0
  17. package/plugins/provider-profile.mjs +139 -0
  18. package/scripts/postinstall.js +202 -182
  19. package/skills/adr/SKILL.md +91 -91
  20. package/skills/adr/references/templates.md +100 -100
  21. package/skills/adr/scripts/README.md +5 -5
  22. package/skills/dev-flow/SKILL.md +188 -188
  23. package/skills/dev-flow/references/code-phase.md +72 -72
  24. package/skills/dev-flow/references/contract-phase.md +81 -81
  25. package/skills/dev-flow/references/verify-phase.md +129 -129
  26. package/skills/dev-flow/scripts/README.md +3 -3
  27. package/skills/docs-gen/SKILL.md +162 -162
  28. package/skills/docs-gen/references/doc-styles.md +216 -216
  29. package/skills/docs-gen/scripts/README.md +5 -5
  30. package/skills/orchestrate/SKILL.md +112 -112
  31. package/skills/orchestrate/references/orchestration-patterns.md +56 -56
  32. package/skills/pr-review/SKILL.md +110 -110
  33. package/skills/pr-review/references/review-dimensions.md +117 -117
  34. package/skills/pr-review/references/security-checklist.md +122 -122
  35. package/skills/pr-review/scripts/README.md +5 -5
  36. package/skills/test-gen/SKILL.md +143 -143
  37. package/skills/test-gen/references/framework-detection.md +105 -105
  38. package/skills/test-gen/references/test-patterns.md +260 -260
  39. package/skills/test-gen/scripts/README.md +5 -5
@@ -1,122 +1,122 @@
1
- # Security Checklist — Language-Specific Patterns
2
-
3
- ## TypeScript / JavaScript
4
-
5
- ### Injection
6
- ```
7
- // ❌ DANGEROUS
8
- eval(userInput)
9
- innerHTML = userInput
10
- new Function(userInput)
11
- require(`./${userInput}`)
12
- child_process.exec(`command ${userInput}`)
13
-
14
- // ✅ SAFE
15
- textContent = userInput
16
- child_process.execFile('command', [userInput])
17
- DOMPurify.sanitize(userInput)
18
- ```
19
-
20
- ### SQL
21
- ```
22
- // ❌ DANGEROUS
23
- `SELECT * FROM users WHERE id = ${userId}`
24
-
25
- // ✅ SAFE
26
- db.query('SELECT * FROM users WHERE id = ?', [userId])
27
- ```
28
-
29
- ### Auth
30
- - [ ] JWT verified with proper library (jsonwebtoken.verify)
31
- - [ ] No hardcoded tokens or API keys
32
- - [ ] Rate limiting on auth endpoints
33
-
34
- ---
35
-
36
- ## Python
37
-
38
- ### Injection
39
- ```python
40
- # ❌ DANGEROUS
41
- os.system(f"command {user_input}")
42
- subprocess.run(f"command {user_input}", shell=True)
43
- eval(user_input)
44
-
45
- # ✅ SAFE
46
- subprocess.run(["command", user_input])
47
- ```
48
-
49
- ### SQL
50
- ```python
51
- # ❌ DANGEROUS
52
- cursor.execute(f"SELECT * FROM users WHERE id = {user_id}")
53
-
54
- # ✅ SAFE
55
- cursor.execute("SELECT * FROM users WHERE id = ?", (user_id,))
56
- ```
57
-
58
- ### Pickle
59
- ```python
60
- # ❌ DANGEROUS (arbitrary code execution)
61
- data = pickle.loads(untrusted_input)
62
-
63
- # ✅ SAFE
64
- data = json.loads(untrusted_input)
65
- ```
66
-
67
- ---
68
-
69
- ## Go
70
-
71
- ### Injection
72
- ```go
73
- // ❌ DANGEROUS
74
- cmd := exec.Command("bash", "-c", userInput)
75
-
76
- // ✅ SAFE
77
- cmd := exec.Command("command", userInput)
78
- ```
79
-
80
- ### SQL
81
- ```go
82
- // ❌ DANGEROUS
83
- db.Query(fmt.Sprintf("SELECT * FROM users WHERE id = %s", userID))
84
-
85
- // ✅ SAFE
86
- db.Query("SELECT * FROM users WHERE id = ?", userID)
87
- ```
88
-
89
- ---
90
-
91
- ## Rust
92
-
93
- ### Unsafe
94
- ```rust
95
- // ❌ DANGEROUS - verify necessity and safety invariants
96
- unsafe { ... }
97
-
98
- // ✅ SAFE - prefer safe abstractions
99
- safe_api()
100
- ```
101
-
102
- ### Injection
103
- ```rust
104
- // ❌ DANGEROUS
105
- Command::new("sh").arg("-c").arg(user_input)
106
-
107
- // ✅ SAFE
108
- Command::new("command").arg(user_input)
109
- ```
110
-
111
- ---
112
-
113
- ## General Security Rules
114
-
115
- 1. **Never trust input** — validate type, range, format, length
116
- 2. **Least privilege** — minimal permissions, minimal scope
117
- 3. **Defense in depth** — don't rely on a single security measure
118
- 4. **Fail securely** — errors should default to denied/closed
119
- 5. **No secrets in code** — use env vars, secret managers, or vaults
120
- 6. **Log securely** — no secrets in logs, no user data in error messages
121
- 7. **Dependencies** — check for known CVEs, prefer maintained libraries
122
- 8. **Cryptography** — use established libraries, don't roll your own
1
+ # Security Checklist — Language-Specific Patterns
2
+
3
+ ## TypeScript / JavaScript
4
+
5
+ ### Injection
6
+ ```
7
+ // ❌ DANGEROUS
8
+ eval(userInput)
9
+ innerHTML = userInput
10
+ new Function(userInput)
11
+ require(`./${userInput}`)
12
+ child_process.exec(`command ${userInput}`)
13
+
14
+ // ✅ SAFE
15
+ textContent = userInput
16
+ child_process.execFile('command', [userInput])
17
+ DOMPurify.sanitize(userInput)
18
+ ```
19
+
20
+ ### SQL
21
+ ```
22
+ // ❌ DANGEROUS
23
+ `SELECT * FROM users WHERE id = ${userId}`
24
+
25
+ // ✅ SAFE
26
+ db.query('SELECT * FROM users WHERE id = ?', [userId])
27
+ ```
28
+
29
+ ### Auth
30
+ - [ ] JWT verified with proper library (jsonwebtoken.verify)
31
+ - [ ] No hardcoded tokens or API keys
32
+ - [ ] Rate limiting on auth endpoints
33
+
34
+ ---
35
+
36
+ ## Python
37
+
38
+ ### Injection
39
+ ```python
40
+ # ❌ DANGEROUS
41
+ os.system(f"command {user_input}")
42
+ subprocess.run(f"command {user_input}", shell=True)
43
+ eval(user_input)
44
+
45
+ # ✅ SAFE
46
+ subprocess.run(["command", user_input])
47
+ ```
48
+
49
+ ### SQL
50
+ ```python
51
+ # ❌ DANGEROUS
52
+ cursor.execute(f"SELECT * FROM users WHERE id = {user_id}")
53
+
54
+ # ✅ SAFE
55
+ cursor.execute("SELECT * FROM users WHERE id = ?", (user_id,))
56
+ ```
57
+
58
+ ### Pickle
59
+ ```python
60
+ # ❌ DANGEROUS (arbitrary code execution)
61
+ data = pickle.loads(untrusted_input)
62
+
63
+ # ✅ SAFE
64
+ data = json.loads(untrusted_input)
65
+ ```
66
+
67
+ ---
68
+
69
+ ## Go
70
+
71
+ ### Injection
72
+ ```go
73
+ // ❌ DANGEROUS
74
+ cmd := exec.Command("bash", "-c", userInput)
75
+
76
+ // ✅ SAFE
77
+ cmd := exec.Command("command", userInput)
78
+ ```
79
+
80
+ ### SQL
81
+ ```go
82
+ // ❌ DANGEROUS
83
+ db.Query(fmt.Sprintf("SELECT * FROM users WHERE id = %s", userID))
84
+
85
+ // ✅ SAFE
86
+ db.Query("SELECT * FROM users WHERE id = ?", userID)
87
+ ```
88
+
89
+ ---
90
+
91
+ ## Rust
92
+
93
+ ### Unsafe
94
+ ```rust
95
+ // ❌ DANGEROUS - verify necessity and safety invariants
96
+ unsafe { ... }
97
+
98
+ // ✅ SAFE - prefer safe abstractions
99
+ safe_api()
100
+ ```
101
+
102
+ ### Injection
103
+ ```rust
104
+ // ❌ DANGEROUS
105
+ Command::new("sh").arg("-c").arg(user_input)
106
+
107
+ // ✅ SAFE
108
+ Command::new("command").arg(user_input)
109
+ ```
110
+
111
+ ---
112
+
113
+ ## General Security Rules
114
+
115
+ 1. **Never trust input** — validate type, range, format, length
116
+ 2. **Least privilege** — minimal permissions, minimal scope
117
+ 3. **Defense in depth** — don't rely on a single security measure
118
+ 4. **Fail securely** — errors should default to denied/closed
119
+ 5. **No secrets in code** — use env vars, secret managers, or vaults
120
+ 6. **Log securely** — no secrets in logs, no user data in error messages
121
+ 7. **Dependencies** — check for known CVEs, prefer maintained libraries
122
+ 8. **Cryptography** — use established libraries, don't roll your own
@@ -1,5 +1,5 @@
1
- # pr-review Scripts
2
-
3
- Placeholder for PR review utility scripts. Future candidates:
4
- - `fetch-pr-diff.py` — Fetch PR diff from GitHub/GitLab via CLI
5
- - `classify-findings.py` — Classify review findings by severity
1
+ # pr-review Scripts
2
+
3
+ Placeholder for PR review utility scripts. Future candidates:
4
+ - `fetch-pr-diff.py` — Fetch PR diff from GitHub/GitLab via CLI
5
+ - `classify-findings.py` — Classify review findings by severity
@@ -1,143 +1,143 @@
1
- ---
2
- name: test-gen
3
- description: |
4
- Analyze source code and generate meaningful tests — unit, integration, and E2E.
5
- Detects project test framework, conventions, and existing test patterns automatically.
6
- Use PROACTIVELY when asked to "add tests", "write tests", "test this", "cover with tests", "increase coverage".
7
- Triggers on: "test", "coverage", "unit test", "integration test", "spec"
8
- ---
9
-
10
- # Test Generation
11
-
12
- Analyze source code, detect test framework, and generate meaningful tests following project conventions.
13
-
14
- ## When to Use
15
-
16
- - Adding tests for new code
17
- - Backfilling tests for existing code
18
- - Converting manual test plans to automated tests
19
- - Increasing test coverage in specific modules
20
-
21
- ## Workflow
22
-
23
- ```
24
- Code Input → Framework Detection → Pattern Analysis → Test Generation → Verification
25
- ```
26
-
27
- ### Step 1: Framework Detection
28
-
29
- Determine the test framework and runner:
30
-
31
- #### Node.js (check `package.json` devDependencies)
32
- | Detected | Framework | Runner |
33
- |----------|-----------|--------|
34
- | vitest | Vitest | `vitest` |
35
- | jest | Jest | `jest` |
36
- | mocha + chai | Mocha | `mocha` |
37
- | ava | Ava | `ava` |
38
-
39
- #### Python (check `pyproject.toml`, `requirements*.txt`, or installed tools)
40
- | Detected | Framework | Runner |
41
- |----------|-----------|--------|
42
- | pytest | Pytest | `pytest` |
43
- | unittest | unittest | `python -m unittest` |
44
-
45
- #### Rust (check `Cargo.toml`)
46
- | Detected | Framework | Runner |
47
- |----------|-----------|--------|
48
- | cargo | built-in test | `cargo test` |
49
-
50
- #### Go
51
- | Detected | Framework | Runner |
52
- |----------|-----------|--------|
53
- | testing | built-in test | `go test` |
54
-
55
- If unclear, check for `test/` or `__tests__` directories, `*.test.*` or `*.spec.*` files, and examine one existing test to infer conventions.
56
-
57
- See `references/framework-detection.md` for detailed detection logic.
58
-
59
- ### Step 2: Pattern Analysis
60
-
61
- Read 2-3 existing tests in the project to understand:
62
-
63
- - **File naming:** `*.test.ts`, `*.spec.ts`, `test_*.py`?
64
- - **Directory structure:** co-located or `tests/` directory?
65
- - **Setup patterns:** `beforeEach`/`setup_method`? Fixtures? Factories?
66
- - **Mocking style:** jest.mock, unittest.mock, monkeypatch, dependency injection?
67
- - **Assertion style:** `expect().toBe()`, `assertEqual`, `assert!`?
68
- - **Naming conventions:** `describe/it`, `def test_`, `func Test`?
69
-
70
- ### Step 3: Test Generation
71
-
72
- For each unit/module under test:
73
-
74
- #### Unit Tests
75
- - Happy path — expected inputs produce expected outputs
76
- - Edge cases — empty, null, boundary values
77
- - Error paths — invalid input, failure modes, exceptions
78
- - State transitions — if applicable
79
- - Focus on public API, not implementation details
80
-
81
- #### Integration Tests (when applicable)
82
- - Module interactions
83
- - Database/file system round-trips
84
- - API endpoint behavior
85
-
86
- #### Test Structure Template
87
- ```typescript
88
- describe('Module/Function', () => {
89
- beforeEach(() => {
90
- // setup
91
- })
92
-
93
- it('should handle happy path', () => {
94
- // arrange
95
- // act
96
- // assert
97
- })
98
-
99
- it('should handle edge case: <description>', () => {
100
- // ...
101
- })
102
-
103
- it('should handle error: <description>', () => {
104
- // ...
105
- })
106
- })
107
- ```
108
-
109
- ### Step 4: Verification
110
-
111
- Run the generated tests to confirm they pass:
112
-
113
- ```bash
114
- # Framework detected in step 1
115
- npm test -- --run # vitest
116
- npx jest # jest
117
- pytest -v # pytest
118
- python -m unittest -v # unittest
119
- cargo test # Rust
120
- go test ./... # Go
121
- ```
122
-
123
- ## Test Quality Guidelines
124
-
125
- | Quality | Criteria |
126
- |---------|----------|
127
- | ✅ Great | Tests behavior, covers edge cases, deterministic, fast |
128
- | ⚠️ Adequate | Tests happy path only, some duplication |
129
- | ❌ Poor | Tests implementation, brittle, flaky, no assertions |
130
-
131
- ## Anti-Patterns
132
-
133
- - ❌ Testing implementation details (private methods, internal state)
134
- - ❌ Snapshot testing without review (giant snapshots)
135
- - ❌ Mocking everything (tests lose meaning)
136
- - ❌ Flaky tests (time, random, network dependencies)
137
- - ❌ No assertions (tests that can't fail)
138
- - ❌ Copy-paste test patterns without adapting to context
139
-
140
- ## Related Skills
141
-
142
- - `dev-flow` — Verify phase runs generated tests
143
- - `pr-review` — Reviews test quality as part of code review
1
+ ---
2
+ name: test-gen
3
+ description: |
4
+ Analyze source code and generate meaningful tests — unit, integration, and E2E.
5
+ Detects project test framework, conventions, and existing test patterns automatically.
6
+ Use PROACTIVELY when asked to "add tests", "write tests", "test this", "cover with tests", "increase coverage".
7
+ Triggers on: "test", "coverage", "unit test", "integration test", "spec"
8
+ ---
9
+
10
+ # Test Generation
11
+
12
+ Analyze source code, detect test framework, and generate meaningful tests following project conventions.
13
+
14
+ ## When to Use
15
+
16
+ - Adding tests for new code
17
+ - Backfilling tests for existing code
18
+ - Converting manual test plans to automated tests
19
+ - Increasing test coverage in specific modules
20
+
21
+ ## Workflow
22
+
23
+ ```
24
+ Code Input → Framework Detection → Pattern Analysis → Test Generation → Verification
25
+ ```
26
+
27
+ ### Step 1: Framework Detection
28
+
29
+ Determine the test framework and runner:
30
+
31
+ #### Node.js (check `package.json` devDependencies)
32
+ | Detected | Framework | Runner |
33
+ |----------|-----------|--------|
34
+ | vitest | Vitest | `vitest` |
35
+ | jest | Jest | `jest` |
36
+ | mocha + chai | Mocha | `mocha` |
37
+ | ava | Ava | `ava` |
38
+
39
+ #### Python (check `pyproject.toml`, `requirements*.txt`, or installed tools)
40
+ | Detected | Framework | Runner |
41
+ |----------|-----------|--------|
42
+ | pytest | Pytest | `pytest` |
43
+ | unittest | unittest | `python -m unittest` |
44
+
45
+ #### Rust (check `Cargo.toml`)
46
+ | Detected | Framework | Runner |
47
+ |----------|-----------|--------|
48
+ | cargo | built-in test | `cargo test` |
49
+
50
+ #### Go
51
+ | Detected | Framework | Runner |
52
+ |----------|-----------|--------|
53
+ | testing | built-in test | `go test` |
54
+
55
+ If unclear, check for `test/` or `__tests__` directories, `*.test.*` or `*.spec.*` files, and examine one existing test to infer conventions.
56
+
57
+ See `references/framework-detection.md` for detailed detection logic.
58
+
59
+ ### Step 2: Pattern Analysis
60
+
61
+ Read 2-3 existing tests in the project to understand:
62
+
63
+ - **File naming:** `*.test.ts`, `*.spec.ts`, `test_*.py`?
64
+ - **Directory structure:** co-located or `tests/` directory?
65
+ - **Setup patterns:** `beforeEach`/`setup_method`? Fixtures? Factories?
66
+ - **Mocking style:** jest.mock, unittest.mock, monkeypatch, dependency injection?
67
+ - **Assertion style:** `expect().toBe()`, `assertEqual`, `assert!`?
68
+ - **Naming conventions:** `describe/it`, `def test_`, `func Test`?
69
+
70
+ ### Step 3: Test Generation
71
+
72
+ For each unit/module under test:
73
+
74
+ #### Unit Tests
75
+ - Happy path — expected inputs produce expected outputs
76
+ - Edge cases — empty, null, boundary values
77
+ - Error paths — invalid input, failure modes, exceptions
78
+ - State transitions — if applicable
79
+ - Focus on public API, not implementation details
80
+
81
+ #### Integration Tests (when applicable)
82
+ - Module interactions
83
+ - Database/file system round-trips
84
+ - API endpoint behavior
85
+
86
+ #### Test Structure Template
87
+ ```typescript
88
+ describe('Module/Function', () => {
89
+ beforeEach(() => {
90
+ // setup
91
+ })
92
+
93
+ it('should handle happy path', () => {
94
+ // arrange
95
+ // act
96
+ // assert
97
+ })
98
+
99
+ it('should handle edge case: <description>', () => {
100
+ // ...
101
+ })
102
+
103
+ it('should handle error: <description>', () => {
104
+ // ...
105
+ })
106
+ })
107
+ ```
108
+
109
+ ### Step 4: Verification
110
+
111
+ Run the generated tests to confirm they pass:
112
+
113
+ ```bash
114
+ # Framework detected in step 1
115
+ npm test -- --run # vitest
116
+ npx jest # jest
117
+ pytest -v # pytest
118
+ python -m unittest -v # unittest
119
+ cargo test # Rust
120
+ go test ./... # Go
121
+ ```
122
+
123
+ ## Test Quality Guidelines
124
+
125
+ | Quality | Criteria |
126
+ |---------|----------|
127
+ | ✅ Great | Tests behavior, covers edge cases, deterministic, fast |
128
+ | ⚠️ Adequate | Tests happy path only, some duplication |
129
+ | ❌ Poor | Tests implementation, brittle, flaky, no assertions |
130
+
131
+ ## Anti-Patterns
132
+
133
+ - ❌ Testing implementation details (private methods, internal state)
134
+ - ❌ Snapshot testing without review (giant snapshots)
135
+ - ❌ Mocking everything (tests lose meaning)
136
+ - ❌ Flaky tests (time, random, network dependencies)
137
+ - ❌ No assertions (tests that can't fail)
138
+ - ❌ Copy-paste test patterns without adapting to context
139
+
140
+ ## Related Skills
141
+
142
+ - `dev-flow` — Verify phase runs generated tests
143
+ - `pr-review` — Reviews test quality as part of code review