mcp-subagents-opencode 1.0.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 (219) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +602 -0
  3. package/build/config/timeouts.d.ts +9 -0
  4. package/build/config/timeouts.d.ts.map +1 -0
  5. package/build/config/timeouts.js +18 -0
  6. package/build/config/timeouts.js.map +1 -0
  7. package/build/helpers.d.ts +6 -0
  8. package/build/helpers.d.ts.map +1 -0
  9. package/build/helpers.js +47 -0
  10. package/build/helpers.js.map +1 -0
  11. package/build/index.d.ts +3 -0
  12. package/build/index.d.ts.map +1 -0
  13. package/build/index.js +245 -0
  14. package/build/index.js.map +1 -0
  15. package/build/models.d.ts +32 -0
  16. package/build/models.d.ts.map +1 -0
  17. package/build/models.js +58 -0
  18. package/build/models.js.map +1 -0
  19. package/build/server/register-notifications.d.ts +3 -0
  20. package/build/server/register-notifications.d.ts.map +1 -0
  21. package/build/server/register-notifications.js +77 -0
  22. package/build/server/register-notifications.js.map +1 -0
  23. package/build/server/register-resources.d.ts +3 -0
  24. package/build/server/register-resources.d.ts.map +1 -0
  25. package/build/server/register-resources.js +210 -0
  26. package/build/server/register-resources.js.map +1 -0
  27. package/build/server/register-retry-execution.d.ts +2 -0
  28. package/build/server/register-retry-execution.d.ts.map +1 -0
  29. package/build/server/register-retry-execution.js +28 -0
  30. package/build/server/register-retry-execution.js.map +1 -0
  31. package/build/server/register-tasks.d.ts +3 -0
  32. package/build/server/register-tasks.d.ts.map +1 -0
  33. package/build/server/register-tasks.js +52 -0
  34. package/build/server/register-tasks.js.map +1 -0
  35. package/build/server/register-tools.d.ts +3 -0
  36. package/build/server/register-tools.d.ts.map +1 -0
  37. package/build/server/register-tools.js +32 -0
  38. package/build/server/register-tools.js.map +1 -0
  39. package/build/server/resource-helpers.d.ts +21 -0
  40. package/build/server/resource-helpers.d.ts.map +1 -0
  41. package/build/server/resource-helpers.js +84 -0
  42. package/build/server/resource-helpers.js.map +1 -0
  43. package/build/services/account-manager.d.ts +88 -0
  44. package/build/services/account-manager.d.ts.map +1 -0
  45. package/build/services/account-manager.js +239 -0
  46. package/build/services/account-manager.js.map +1 -0
  47. package/build/services/claude-code-runner.d.ts +15 -0
  48. package/build/services/claude-code-runner.d.ts.map +1 -0
  49. package/build/services/claude-code-runner.js +475 -0
  50. package/build/services/claude-code-runner.js.map +1 -0
  51. package/build/services/client-context.d.ts +31 -0
  52. package/build/services/client-context.d.ts.map +1 -0
  53. package/build/services/client-context.js +44 -0
  54. package/build/services/client-context.js.map +1 -0
  55. package/build/services/exhaustion-fallback.d.ts +27 -0
  56. package/build/services/exhaustion-fallback.d.ts.map +1 -0
  57. package/build/services/exhaustion-fallback.js +30 -0
  58. package/build/services/exhaustion-fallback.js.map +1 -0
  59. package/build/services/fallback-orchestrator.d.ts +16 -0
  60. package/build/services/fallback-orchestrator.d.ts.map +1 -0
  61. package/build/services/fallback-orchestrator.js +48 -0
  62. package/build/services/fallback-orchestrator.js.map +1 -0
  63. package/build/services/opencode-client.d.ts +40 -0
  64. package/build/services/opencode-client.d.ts.map +1 -0
  65. package/build/services/opencode-client.js +147 -0
  66. package/build/services/opencode-client.js.map +1 -0
  67. package/build/services/opencode-spawner.d.ts +56 -0
  68. package/build/services/opencode-spawner.d.ts.map +1 -0
  69. package/build/services/opencode-spawner.js +426 -0
  70. package/build/services/opencode-spawner.js.map +1 -0
  71. package/build/services/output-file.d.ts +24 -0
  72. package/build/services/output-file.d.ts.map +1 -0
  73. package/build/services/output-file.js +90 -0
  74. package/build/services/output-file.js.map +1 -0
  75. package/build/services/progress-registry.d.ts +12 -0
  76. package/build/services/progress-registry.d.ts.map +1 -0
  77. package/build/services/progress-registry.js +97 -0
  78. package/build/services/progress-registry.js.map +1 -0
  79. package/build/services/question-registry.d.ts +79 -0
  80. package/build/services/question-registry.d.ts.map +1 -0
  81. package/build/services/question-registry.js +249 -0
  82. package/build/services/question-registry.js.map +1 -0
  83. package/build/services/retry-queue.d.ts +41 -0
  84. package/build/services/retry-queue.d.ts.map +1 -0
  85. package/build/services/retry-queue.js +195 -0
  86. package/build/services/retry-queue.js.map +1 -0
  87. package/build/services/sdk-client-manager.d.ts +149 -0
  88. package/build/services/sdk-client-manager.d.ts.map +1 -0
  89. package/build/services/sdk-client-manager.js +632 -0
  90. package/build/services/sdk-client-manager.js.map +1 -0
  91. package/build/services/sdk-session-adapter.d.ts +203 -0
  92. package/build/services/sdk-session-adapter.d.ts.map +1 -0
  93. package/build/services/sdk-session-adapter.js +1088 -0
  94. package/build/services/sdk-session-adapter.js.map +1 -0
  95. package/build/services/sdk-spawner.d.ts +42 -0
  96. package/build/services/sdk-spawner.d.ts.map +1 -0
  97. package/build/services/sdk-spawner.js +488 -0
  98. package/build/services/sdk-spawner.js.map +1 -0
  99. package/build/services/session-hooks.d.ts +24 -0
  100. package/build/services/session-hooks.d.ts.map +1 -0
  101. package/build/services/session-hooks.js +130 -0
  102. package/build/services/session-hooks.js.map +1 -0
  103. package/build/services/session-snapshot.d.ts +19 -0
  104. package/build/services/session-snapshot.d.ts.map +1 -0
  105. package/build/services/session-snapshot.js +203 -0
  106. package/build/services/session-snapshot.js.map +1 -0
  107. package/build/services/subscription-registry.d.ts +12 -0
  108. package/build/services/subscription-registry.d.ts.map +1 -0
  109. package/build/services/subscription-registry.js +27 -0
  110. package/build/services/subscription-registry.js.map +1 -0
  111. package/build/services/task-manager.d.ts +150 -0
  112. package/build/services/task-manager.d.ts.map +1 -0
  113. package/build/services/task-manager.js +765 -0
  114. package/build/services/task-manager.js.map +1 -0
  115. package/build/services/task-persistence.d.ts +29 -0
  116. package/build/services/task-persistence.d.ts.map +1 -0
  117. package/build/services/task-persistence.js +159 -0
  118. package/build/services/task-persistence.js.map +1 -0
  119. package/build/services/task-status-mapper.d.ts +21 -0
  120. package/build/services/task-status-mapper.d.ts.map +1 -0
  121. package/build/services/task-status-mapper.js +171 -0
  122. package/build/services/task-status-mapper.js.map +1 -0
  123. package/build/templates/index.d.ts +22 -0
  124. package/build/templates/index.d.ts.map +1 -0
  125. package/build/templates/index.js +147 -0
  126. package/build/templates/index.js.map +1 -0
  127. package/build/templates/overlays/coder-csharp.mdx +58 -0
  128. package/build/templates/overlays/coder-go.mdx +53 -0
  129. package/build/templates/overlays/coder-java.mdx +54 -0
  130. package/build/templates/overlays/coder-kotlin.mdx +56 -0
  131. package/build/templates/overlays/coder-nextjs.mdx +65 -0
  132. package/build/templates/overlays/coder-python.mdx +53 -0
  133. package/build/templates/overlays/coder-react.mdx +55 -0
  134. package/build/templates/overlays/coder-ruby.mdx +59 -0
  135. package/build/templates/overlays/coder-rust.mdx +48 -0
  136. package/build/templates/overlays/coder-supabase.mdx +268 -0
  137. package/build/templates/overlays/coder-supastarter.mdx +313 -0
  138. package/build/templates/overlays/coder-swift.mdx +56 -0
  139. package/build/templates/overlays/coder-tauri.mdx +566 -0
  140. package/build/templates/overlays/coder-triggerdev.mdx +296 -0
  141. package/build/templates/overlays/coder-typescript.mdx +45 -0
  142. package/build/templates/overlays/coder-vue.mdx +62 -0
  143. package/build/templates/overlays/planner-architecture.mdx +78 -0
  144. package/build/templates/overlays/planner-bugfix.mdx +36 -0
  145. package/build/templates/overlays/planner-feature.mdx +38 -0
  146. package/build/templates/overlays/planner-migration.mdx +50 -0
  147. package/build/templates/overlays/planner-refactor.mdx +57 -0
  148. package/build/templates/overlays/researcher-library.mdx +59 -0
  149. package/build/templates/overlays/researcher-performance.mdx +68 -0
  150. package/build/templates/overlays/researcher-security.mdx +86 -0
  151. package/build/templates/overlays/tester-graphql.mdx +191 -0
  152. package/build/templates/overlays/tester-playwright.mdx +621 -0
  153. package/build/templates/overlays/tester-rest.mdx +101 -0
  154. package/build/templates/overlays/tester-suite.mdx +177 -0
  155. package/build/templates/super-coder.mdx +529 -0
  156. package/build/templates/super-planner.mdx +568 -0
  157. package/build/templates/super-researcher.mdx +406 -0
  158. package/build/templates/super-tester.mdx +243 -0
  159. package/build/tools/answer-question.d.ts +30 -0
  160. package/build/tools/answer-question.d.ts.map +1 -0
  161. package/build/tools/answer-question.js +108 -0
  162. package/build/tools/answer-question.js.map +1 -0
  163. package/build/tools/cancel-task.d.ts +44 -0
  164. package/build/tools/cancel-task.d.ts.map +1 -0
  165. package/build/tools/cancel-task.js +144 -0
  166. package/build/tools/cancel-task.js.map +1 -0
  167. package/build/tools/send-message.d.ts +39 -0
  168. package/build/tools/send-message.d.ts.map +1 -0
  169. package/build/tools/send-message.js +124 -0
  170. package/build/tools/send-message.js.map +1 -0
  171. package/build/tools/shared-spawn.d.ts +56 -0
  172. package/build/tools/shared-spawn.d.ts.map +1 -0
  173. package/build/tools/shared-spawn.js +114 -0
  174. package/build/tools/shared-spawn.js.map +1 -0
  175. package/build/tools/spawn-agent.d.ts +85 -0
  176. package/build/tools/spawn-agent.d.ts.map +1 -0
  177. package/build/tools/spawn-agent.js +133 -0
  178. package/build/tools/spawn-agent.js.map +1 -0
  179. package/build/tools/spawn-coder.d.ts +70 -0
  180. package/build/tools/spawn-coder.d.ts.map +1 -0
  181. package/build/tools/spawn-coder.js +71 -0
  182. package/build/tools/spawn-coder.js.map +1 -0
  183. package/build/tools/spawn-planner.d.ts +70 -0
  184. package/build/tools/spawn-planner.d.ts.map +1 -0
  185. package/build/tools/spawn-planner.js +71 -0
  186. package/build/tools/spawn-planner.js.map +1 -0
  187. package/build/tools/spawn-researcher.d.ts +70 -0
  188. package/build/tools/spawn-researcher.d.ts.map +1 -0
  189. package/build/tools/spawn-researcher.js +70 -0
  190. package/build/tools/spawn-researcher.js.map +1 -0
  191. package/build/tools/spawn-task.d.ts +74 -0
  192. package/build/tools/spawn-task.d.ts.map +1 -0
  193. package/build/tools/spawn-task.js +107 -0
  194. package/build/tools/spawn-task.js.map +1 -0
  195. package/build/tools/spawn-tester.d.ts +70 -0
  196. package/build/tools/spawn-tester.d.ts.map +1 -0
  197. package/build/tools/spawn-tester.js +69 -0
  198. package/build/tools/spawn-tester.js.map +1 -0
  199. package/build/types.d.ts +101 -0
  200. package/build/types.d.ts.map +1 -0
  201. package/build/types.js +28 -0
  202. package/build/types.js.map +1 -0
  203. package/build/utils/brief-validator.d.ts +30 -0
  204. package/build/utils/brief-validator.d.ts.map +1 -0
  205. package/build/utils/brief-validator.js +254 -0
  206. package/build/utils/brief-validator.js.map +1 -0
  207. package/build/utils/format.d.ts +34 -0
  208. package/build/utils/format.d.ts.map +1 -0
  209. package/build/utils/format.js +55 -0
  210. package/build/utils/format.js.map +1 -0
  211. package/build/utils/sanitize.d.ts +240 -0
  212. package/build/utils/sanitize.d.ts.map +1 -0
  213. package/build/utils/sanitize.js +89 -0
  214. package/build/utils/sanitize.js.map +1 -0
  215. package/build/utils/task-id-generator.d.ts +10 -0
  216. package/build/utils/task-id-generator.d.ts.map +1 -0
  217. package/build/utils/task-id-generator.js +22 -0
  218. package/build/utils/task-id-generator.js.map +1 -0
  219. package/package.json +62 -0
@@ -0,0 +1,101 @@
1
+ ## REST API TESTING GUIDELINES
2
+
3
+ You are testing **REST APIs** using `curl`, `jq`, and shell tools. Your evidence is raw HTTP — status codes, headers, response bodies, timing.
4
+
5
+ ---
6
+
7
+ ### TOOLKIT PATTERN
8
+
9
+ ```bash
10
+ curl -X METHOD http://host/path \
11
+ -H "Content-Type: application/json" \
12
+ -H "Authorization: Bearer $TOKEN" \
13
+ -d '{"key":"value"}' \
14
+ -w "\n\nHTTP_CODE: %{http_code}\nTIME: %{time_total}s\nSIZE: %{size_download} bytes" \
15
+ -s -S 2>&1 | tee .agent-workspace/qa/evidence/curl/NN-description.txt
16
+ ```
17
+
18
+ Always: `-w` for diagnostics, `tee` to evidence files, `-s -S` (silent but show errors).
19
+
20
+ ---
21
+
22
+ ### AUTH FLOW TESTING
23
+
24
+ ```
25
+ 1. ACQUIRE TOKEN POST /auth/login → extract access_token + refresh_token → verify 200, JWT structure
26
+ 2. PROTECTED ENDPOINT GET /api/resource with Bearer token → verify 200, correct body
27
+ 3. MISSING/INVALID AUTH No header → 401, invalid token → 401, expired → 401
28
+ 4. TOKEN REFRESH POST /auth/refresh → verify new tokens, old token behavior
29
+ 5. LOGOUT POST /auth/logout → verify token invalidated → old token → 401
30
+ ```
31
+
32
+ ---
33
+
34
+ ### REST CRUD LIFECYCLE
35
+
36
+ Test the full resource lifecycle in sequence:
37
+
38
+ ```
39
+ 1. CREATE POST /api/resource → 201, capture ID
40
+ 2. READ GET /api/resource/ID → 200, body matches
41
+ 3. LIST GET /api/resource → 200, item in list
42
+ 4. UPDATE PUT /api/resource/ID → 200, verify persisted
43
+ 5. RE-READ GET /api/resource/ID → 200, reflects update
44
+ 6. DELETE DELETE /api/resource/ID → 200 or 204
45
+ 7. VERIFY GET /api/resource/ID → 404 (confirmed deleted)
46
+ ```
47
+
48
+ Capture ID dynamically: `ID=$(curl -s -X POST ... | jq -r '.id')`
49
+
50
+ ---
51
+
52
+ ### RESPONSE VALIDATION
53
+
54
+ For every response, verify:
55
+
56
+ | Check | How |
57
+ |-------|-----|
58
+ | Status code | `-w "%{http_code}"` |
59
+ | Content-Type | Header matches expected |
60
+ | Body schema | `jq` to validate required fields |
61
+ | Timing | `-w "%{time_total}"` — flag >2s |
62
+ | Error format | Consistent format (message, code) |
63
+ | Pagination | total, page, limit, next/prev links |
64
+
65
+ ---
66
+
67
+ ### WEBHOOK TESTING
68
+
69
+ ```bash
70
+ nc -l -p 9999 > evidence/webhook-payload.txt &
71
+ LISTENER_PID=$!
72
+ curl -X POST http://localhost:3000/api/trigger-webhook \
73
+ -H "Content-Type: application/json" \
74
+ -d '{"callback_url":"http://localhost:9999/webhook"}'
75
+ sleep 3 && kill $LISTENER_PID 2>/dev/null
76
+ ```
77
+
78
+ Verify: payload format, required fields, signature header, retry behavior.
79
+
80
+ ---
81
+
82
+ ### RATE LIMIT TESTING
83
+
84
+ ```bash
85
+ for i in $(seq 1 20); do
86
+ STATUS=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:3000/api/endpoint)
87
+ echo "Request $i: HTTP $STATUS"
88
+ done
89
+ ```
90
+
91
+ Verify: 429 response, Retry-After header.
92
+
93
+ ---
94
+
95
+ ### MCP SERVER TESTING
96
+
97
+ ```bash
98
+ echo '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"test","version":"1.0"}}}' | node server.js
99
+ echo '{"jsonrpc":"2.0","id":2,"method":"tools/list","params":{}}' | node server.js
100
+ echo '{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"tool","arguments":{}}}' | node server.js
101
+ ```
@@ -0,0 +1,177 @@
1
+ ## EXISTING TEST SUITE GUIDELINES
2
+
3
+ You are running and analyzing **existing test suites**. Your job is to execute them, interpret results, identify real failures vs flaky tests, and report coverage.
4
+
5
+ ---
6
+
7
+ ### DISCOVERY
8
+
9
+ Find what test infrastructure exists before running anything:
10
+
11
+ ```bash
12
+ # Node.js projects
13
+ cat package.json | grep -A 20 '"scripts"' # Find test commands
14
+ ls jest.config* vitest.config* playwright.config* .mocharc* 2>/dev/null
15
+ ls cypress.config* karma.conf* 2>/dev/null
16
+
17
+ # Python projects
18
+ ls pytest.ini pyproject.toml setup.cfg tox.ini 2>/dev/null
19
+ cat pyproject.toml | grep -A 10 '\[tool.pytest'
20
+
21
+ # Go projects
22
+ find . -name "*_test.go" -type f | head -20
23
+
24
+ # General
25
+ ls Makefile 2>/dev/null && grep -E "^test" Makefile
26
+ ls .github/workflows/*.yml 2>/dev/null # CI configs show test commands
27
+ ```
28
+
29
+ **Read the CI configuration** — it shows exactly how tests are run in production. Match that.
30
+
31
+ ---
32
+
33
+ ### EXECUTION ORDER
34
+
35
+ Run tests in this order, stopping if critical failures cascade:
36
+
37
+ ```
38
+ 1. UNIT TESTS (fastest, most isolated)
39
+ npm test / pytest tests/unit/ / go test ./...
40
+
41
+ 2. INTEGRATION TESTS (service-level, may need setup)
42
+ npm run test:integration / pytest tests/integration/
43
+
44
+ 3. E2E TESTS (slowest, most realistic)
45
+ npm run test:e2e / pytest tests/e2e/
46
+ ```
47
+
48
+ **Always capture output:**
49
+ ```bash
50
+ npm test 2>&1 | tee .agent-workspace/qa/evidence/logs/unit-tests.txt
51
+ npm run test:integration 2>&1 | tee .agent-workspace/qa/evidence/logs/integration-tests.txt
52
+ npm run test:e2e 2>&1 | tee .agent-workspace/qa/evidence/logs/e2e-tests.txt
53
+ ```
54
+
55
+ ---
56
+
57
+ ### FRAMEWORK PATTERNS
58
+
59
+ #### Jest / Vitest
60
+ ```bash
61
+ # Run all tests
62
+ npx jest --verbose 2>&1 | tee evidence.txt
63
+ npx vitest run --reporter=verbose 2>&1 | tee evidence.txt
64
+
65
+ # Run specific test file
66
+ npx jest path/to/test.ts --verbose
67
+ npx vitest run path/to/test.ts
68
+
69
+ # Run tests matching pattern
70
+ npx jest --testNamePattern="should handle auth"
71
+ npx vitest run -t "should handle auth"
72
+
73
+ # With coverage
74
+ npx jest --coverage --verbose
75
+ npx vitest run --coverage
76
+ ```
77
+
78
+ #### Pytest
79
+ ```bash
80
+ # Run all tests with verbose output
81
+ pytest -v 2>&1 | tee evidence.txt
82
+
83
+ # Run specific file or directory
84
+ pytest tests/unit/test_auth.py -v
85
+
86
+ # Run tests matching pattern
87
+ pytest -k "test_login or test_refresh" -v
88
+
89
+ # With coverage
90
+ pytest --cov=src --cov-report=term-missing -v
91
+ ```
92
+
93
+ #### Playwright Test
94
+ ```bash
95
+ # Run all tests
96
+ npx playwright test 2>&1 | tee evidence.txt
97
+
98
+ # Run specific file
99
+ npx playwright test tests/auth.spec.ts
100
+
101
+ # With specific browser
102
+ npx playwright test --project=chromium
103
+ ```
104
+
105
+ #### Go Test
106
+ ```bash
107
+ # Run all tests
108
+ go test ./... -v 2>&1 | tee evidence.txt
109
+
110
+ # Run specific package
111
+ go test ./pkg/auth/ -v
112
+
113
+ # With coverage
114
+ go test ./... -cover -coverprofile=coverage.out
115
+ go tool cover -func=coverage.out
116
+ ```
117
+
118
+ ---
119
+
120
+ ### INTERPRETING RESULTS
121
+
122
+ Parse test output for these key metrics:
123
+
124
+ | Metric | What to Look For |
125
+ |--------|-----------------|
126
+ | Total tests | Total count of test cases executed |
127
+ | Passed | Tests that completed successfully |
128
+ | Failed | Tests that assertion-failed — these are real findings |
129
+ | Skipped | Tests marked skip/pending — note WHY they're skipped |
130
+ | Errored | Tests that crashed (different from assertion failure) — may indicate setup issues |
131
+ | Coverage | Line/branch coverage percentage if reported |
132
+ | Duration | Total run time — flag if unusually slow |
133
+
134
+ **For each failure, capture:**
135
+ 1. Test name and file location
136
+ 2. Expected vs actual values
137
+ 3. Stack trace / error message
138
+ 4. Whether this is a NEW failure (from the recent changes) or PRE-EXISTING
139
+
140
+ ---
141
+
142
+ ### FLAKY TEST DETECTION
143
+
144
+ If a test fails, determine if it's a real failure or flaky:
145
+
146
+ ```bash
147
+ # Re-run the specific failing test 3 times in isolation
148
+ for i in 1 2 3; do
149
+ echo "=== Run $i ==="
150
+ npx jest path/to/test.ts --testNamePattern="failing test name" 2>&1
151
+ echo "Exit code: $?"
152
+ done
153
+ ```
154
+
155
+ **Classification:**
156
+ - **Fails 3/3** → Real failure. Report it.
157
+ - **Fails 1-2/3** → Flaky test. Report as flaky with evidence of inconsistency.
158
+ - **Passes 3/3** → Likely environment or ordering issue. Note the original failure context.
159
+
160
+ **Common flake causes:** timing/race conditions, shared state between tests, network dependencies, date/time sensitivity.
161
+
162
+ ---
163
+
164
+ ### SUITE-SPECIFIC RULES
165
+
166
+ #### ALWAYS
167
+ - Capture full test output to evidence files
168
+ - Distinguish pre-existing failures from new ones caused by recent changes
169
+ - Run flaky detection (3x re-run) on any failing test before reporting
170
+ - Note test coverage if available
171
+ - Check CI config for the canonical test commands
172
+
173
+ #### NEVER
174
+ - Report a test failure without re-running it at least once
175
+ - Modify test files to make tests pass (report the failure instead)
176
+ - Skip running tests because "they should work"
177
+ - Ignore skipped tests — document why they're skipped