@rockysoft/opencode-hybrid-workflow 0.0.0-stage → 0.3.2-beta.1

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 (135) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +252 -3
  3. package/THIRD_PARTY_NOTICES.md +18 -0
  4. package/assets/agents/backend-engineer.md +167 -0
  5. package/assets/agents/code-reviewer.md +129 -0
  6. package/assets/agents/database-engineer.md +162 -0
  7. package/assets/agents/devops-engineer.md +115 -0
  8. package/assets/agents/frontend-engineer.md +38 -0
  9. package/assets/agents/fullstack-architect.md +43 -0
  10. package/assets/agents/security-auditor.md +132 -0
  11. package/assets/agents/technical-writer.md +78 -0
  12. package/assets/agents/test-engineer.md +154 -0
  13. package/assets/rules.md +93 -0
  14. package/assets/skills/frontend-design/INSTALLATION.json +9 -0
  15. package/assets/skills/frontend-design/LICENSE.txt +177 -0
  16. package/assets/skills/frontend-design/SKILL.md +78 -0
  17. package/assets/skills/ui-ux-pro-max/INSTALLATION.json +10 -0
  18. package/assets/skills/ui-ux-pro-max/LICENSE +21 -0
  19. package/assets/skills/ui-ux-pro-max/SKILL.md +221 -0
  20. package/assets/skills/ui-ux-pro-max/data/app-interface.csv +33 -0
  21. package/assets/skills/ui-ux-pro-max/data/catalog-summary.json +78 -0
  22. package/assets/skills/ui-ux-pro-max/data/charts.csv +26 -0
  23. package/assets/skills/ui-ux-pro-max/data/colors.csv +193 -0
  24. package/assets/skills/ui-ux-pro-max/data/data-provenance.json +1348 -0
  25. package/assets/skills/ui-ux-pro-max/data/google-font-licenses.json +20185 -0
  26. package/assets/skills/ui-ux-pro-max/data/google-fonts.csv +1935 -0
  27. package/assets/skills/ui-ux-pro-max/data/icons.csv +106 -0
  28. package/assets/skills/ui-ux-pro-max/data/landing.csv +35 -0
  29. package/assets/skills/ui-ux-pro-max/data/motion.csv +18 -0
  30. package/assets/skills/ui-ux-pro-max/data/phosphor-icons-upstream.json +32582 -0
  31. package/assets/skills/ui-ux-pro-max/data/products.csv +193 -0
  32. package/assets/skills/ui-ux-pro-max/data/react-performance.csv +45 -0
  33. package/assets/skills/ui-ux-pro-max/data/stacks/angular.csv +51 -0
  34. package/assets/skills/ui-ux-pro-max/data/stacks/astro.csv +54 -0
  35. package/assets/skills/ui-ux-pro-max/data/stacks/avalonia.csv +57 -0
  36. package/assets/skills/ui-ux-pro-max/data/stacks/flutter.csv +53 -0
  37. package/assets/skills/ui-ux-pro-max/data/stacks/html-tailwind.csv +60 -0
  38. package/assets/skills/ui-ux-pro-max/data/stacks/javafx.csv +76 -0
  39. package/assets/skills/ui-ux-pro-max/data/stacks/jetpack-compose.csv +53 -0
  40. package/assets/skills/ui-ux-pro-max/data/stacks/laravel.csv +51 -0
  41. package/assets/skills/ui-ux-pro-max/data/stacks/nextjs.csv +62 -0
  42. package/assets/skills/ui-ux-pro-max/data/stacks/nuxt-ui.csv +77 -0
  43. package/assets/skills/ui-ux-pro-max/data/stacks/nuxtjs.csv +68 -0
  44. package/assets/skills/ui-ux-pro-max/data/stacks/react-native.csv +52 -0
  45. package/assets/skills/ui-ux-pro-max/data/stacks/react.csv +67 -0
  46. package/assets/skills/ui-ux-pro-max/data/stacks/shadcn.csv +69 -0
  47. package/assets/skills/ui-ux-pro-max/data/stacks/svelte.csv +56 -0
  48. package/assets/skills/ui-ux-pro-max/data/stacks/swiftui.csv +51 -0
  49. package/assets/skills/ui-ux-pro-max/data/stacks/threejs.csv +54 -0
  50. package/assets/skills/ui-ux-pro-max/data/stacks/uno.csv +60 -0
  51. package/assets/skills/ui-ux-pro-max/data/stacks/uwp.csv +56 -0
  52. package/assets/skills/ui-ux-pro-max/data/stacks/vue.csv +50 -0
  53. package/assets/skills/ui-ux-pro-max/data/stacks/winui.csv +60 -0
  54. package/assets/skills/ui-ux-pro-max/data/stacks/wpf.csv +57 -0
  55. package/assets/skills/ui-ux-pro-max/data/styles.csv +89 -0
  56. package/assets/skills/ui-ux-pro-max/data/typography.csv +75 -0
  57. package/assets/skills/ui-ux-pro-max/data/ui-reasoning.csv +193 -0
  58. package/assets/skills/ui-ux-pro-max/data/ux-guidelines.csv +120 -0
  59. package/assets/skills/ui-ux-pro-max/references/pro-rules.md +117 -0
  60. package/assets/skills/ui-ux-pro-max/references/quick-reference.md +256 -0
  61. package/assets/skills/ui-ux-pro-max/scripts/core.py +993 -0
  62. package/assets/skills/ui-ux-pro-max/scripts/design_system.py +1668 -0
  63. package/assets/skills/ui-ux-pro-max/scripts/reasoning_contract.py +123 -0
  64. package/assets/skills/ui-ux-pro-max/scripts/search.py +177 -0
  65. package/assets/skills/ui-ux-pro-max/scripts/tests/fixtures/catalogs/google-api.json +36 -0
  66. package/assets/skills/ui-ux-pro-max/scripts/tests/fixtures/catalogs/google-catalog.json +33 -0
  67. package/assets/skills/ui-ux-pro-max/scripts/tests/fixtures/catalogs/google-existing.csv +3 -0
  68. package/assets/skills/ui-ux-pro-max/scripts/tests/fixtures/catalogs/google-metadata.json +17 -0
  69. package/assets/skills/ui-ux-pro-max/scripts/tests/fixtures/catalogs/google-overrides.json +7 -0
  70. package/assets/skills/ui-ux-pro-max/scripts/tests/fixtures/catalogs/icons-curated.csv +4 -0
  71. package/assets/skills/ui-ux-pro-max/scripts/tests/fixtures/catalogs/phosphor-core.json +23 -0
  72. package/assets/skills/ui-ux-pro-max/scripts/tests/fixtures/catalogs/phosphor-package.json +13 -0
  73. package/assets/skills/ui-ux-pro-max/scripts/tests/fixtures/catalogs/phosphor-react-exports.json +4 -0
  74. package/assets/skills/ui-ux-pro-max/scripts/tests/fixtures/catalogs/phosphor-react-package.json +5 -0
  75. package/assets/skills/ui-ux-pro-max/scripts/tests/fixtures/relevance-baseline.json +3366 -0
  76. package/assets/skills/ui-ux-pro-max/scripts/tests/fixtures/relevance-cases.json +111 -0
  77. package/assets/skills/ui-ux-pro-max/scripts/tests/fixtures/relevance-thresholds.json +100 -0
  78. package/assets/skills/ui-ux-pro-max/scripts/tests/test_catalog_refresh.py +354 -0
  79. package/assets/skills/ui-ux-pro-max/scripts/tests/test_catalog_summary_line_endings.py +78 -0
  80. package/assets/skills/ui-ux-pro-max/scripts/tests/test_core.py +343 -0
  81. package/assets/skills/ui-ux-pro-max/scripts/tests/test_core_data_quality.py +198 -0
  82. package/assets/skills/ui-ux-pro-max/scripts/tests/test_data_contracts.py +421 -0
  83. package/assets/skills/ui-ux-pro-max/scripts/tests/test_design_system_mode.py +233 -0
  84. package/assets/skills/ui-ux-pro-max/scripts/tests/test_design_system_stack.py +61 -0
  85. package/assets/skills/ui-ux-pro-max/scripts/tests/test_native_desktop_stack_freshness.py +179 -0
  86. package/assets/skills/ui-ux-pro-max/scripts/tests/test_relevance_evaluator.py +182 -0
  87. package/assets/skills/ui-ux-pro-max/scripts/tests/test_skill_script_paths.py +82 -0
  88. package/assets/skills/ui-ux-pro-max/scripts/tests/test_style_taxonomy.py +175 -0
  89. package/assets/skills/ui-ux-pro-max/scripts/tests/test_text_layout_resilience.py +120 -0
  90. package/assets/skills/ui-ux-pro-max/scripts/tests/test_web_stack_freshness.py +177 -0
  91. package/assets/skills/ui-ux-pro-max/scripts/validate_data.py +1095 -0
  92. package/assets/skills/web-design-guidelines/INSTALLATION.json +1 -0
  93. package/assets/skills/web-design-guidelines/SKILL.md +18 -0
  94. package/cli.mjs +91 -0
  95. package/core/controller.mjs +367 -0
  96. package/core/dashboard-state.js +48 -0
  97. package/core/dashboard.css +2 -0
  98. package/core/dashboard.html +12 -0
  99. package/core/dashboard.js +72 -0
  100. package/core/decision.mjs +22 -0
  101. package/core/design.mjs +139 -0
  102. package/core/evidence.mjs +82 -0
  103. package/core/frontend-policy.mjs +34 -0
  104. package/core/images.mjs +35 -0
  105. package/core/monitor-data.mjs +58 -0
  106. package/core/monitor.mjs +24 -0
  107. package/core/operation-lock.mjs +82 -0
  108. package/core/plugin.mjs +91 -0
  109. package/core/posix-lock.mjs +31 -0
  110. package/core/posix-lock.py +23 -0
  111. package/core/pricing.mjs +53 -0
  112. package/core/process-identity.mjs +19 -0
  113. package/core/research-tools.mjs +37 -0
  114. package/core/review-context.mjs +43 -0
  115. package/core/snapshot.mjs +95 -0
  116. package/core/telemetry.mjs +107 -0
  117. package/core/workers.mjs +192 -0
  118. package/core/workflow-policy.mjs +10 -0
  119. package/index.js +19 -0
  120. package/lib/commands.mjs +48 -0
  121. package/lib/config.mjs +63 -0
  122. package/lib/install.mjs +111 -0
  123. package/lib/native-browser.mjs +79 -0
  124. package/lib/opencode-reviewer.mjs +129 -0
  125. package/lib/platform.mjs +14 -0
  126. package/lib/reviewer-browser-proxy.mjs +61 -0
  127. package/lib/reviewer-browser.mjs +35 -0
  128. package/lib/reviewers.mjs +11 -0
  129. package/lib/select-reviewers.mjs +58 -0
  130. package/lib/settings-rpc.mjs +9 -0
  131. package/lib/settings-service.mjs +129 -0
  132. package/package.json +63 -6
  133. package/sidebar/reader.mjs +80 -0
  134. package/sidebar/settings.mjs +99 -0
  135. package/tui.js +303 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 RockySoft
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,252 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
1
+ # OpenCode Hybrid Workflow
2
+
3
+ One OpenCode 2 package for premium planning/design/reviews, implementation
4
+ checkpoints, specialist instructions and reviewer usage/cost cards in the sidebar.
5
+ No dashboard process, trial launcher or project-local plugin folder is required.
6
+
7
+ **Public beta:** Windows and Linux checks pass. macOS support is implemented,
8
+ but a real Mac installation/UI run is still pending. Requires **OpenCode 2**
9
+ (tested with 2.2.5), Node.js 22+, Git and Python 3. OpenCode 1 is not supported.
10
+
11
+ ## Install once
12
+
13
+ In your terminal, with OpenCode 2 installed:
14
+
15
+ ```sh
16
+ opencode plugin add @rockysoft/opencode-hybrid-workflow@beta
17
+ ```
18
+
19
+ Then open OpenCode in any project and complete **Hybrid setup**. Configure
20
+ providers, reviewers and optional tools inside OpenCode. Existing running
21
+ sessions are not restarted; reopen OpenCode when ready to load the plugin.
22
+
23
+ To update the beta later:
24
+
25
+ ```sh
26
+ opencode plugin update @rockysoft/opencode-hybrid-workflow@beta
27
+ ```
28
+
29
+ These commands use OpenCode's global package plugin manager. No separate npm
30
+ global install or `opencode-hybrid init` is needed for a new installation.
31
+ If you used a previous local/archive build, remove its plugin entries from
32
+ both `opencode.json` and `cli.json` before adding the npm package, preserving
33
+ `hybrid/config.json`, managed instructions and runtime history. Do not load the
34
+ local and npm builds together.
35
+
36
+ ## Set up inside OpenCode
37
+
38
+ Once the plugin is installed, open OpenCode normally in any project. On first
39
+ launch, **Hybrid setup** opens automatically. Choose one or two reviewers, their
40
+ OpenCode-connected providers or external CLIs, models, reasoning effort and the
41
+ planning/design lead, then save. The plugin installs its managed agents, rules
42
+ and design skills globally. Canceling the wizard does not save reviewer choices.
43
+
44
+ Later, click **Hybrid Workflow settings** on the home screen or session sidebar,
45
+ or select it in OpenCode's command palette. `/hybrid` opens the same menu.
46
+ There is no separate configuration terminal or dashboard to launch.
47
+
48
+ The menu includes:
49
+
50
+ - **Reviewers and design lead**: one or two reviewers; any enabled tool-capable
51
+ OpenCode provider/model, or the optional Codex/Claude CLI adapters.
52
+ - **Connect provider** and **Implementation model**: open OpenCode's own menus.
53
+ - **Reviewer browser**: enable an existing browser, or install managed Playwright
54
+ MCP and Firefox with one confirmation. Each reviewer gets an isolated browser.
55
+ - **Tools and dependencies**: install managed pnpm for verification; enable the
56
+ official Context7 documentation MCP while preserving an existing configuration.
57
+ - **Run diagnostics**: inspect prerequisites, reviewer configuration/logins,
58
+ design skills and an actual browser launch without spending model tokens.
59
+
60
+ Settings apply globally. New tasks pick up saved reviewers; active tasks retain
61
+ their assignments and history. Changing the installed plugin version still needs
62
+ a normal OpenCode restart. Installing an implementation MCP may also require a
63
+ restart if the host does not reload its MCP configuration.
64
+
65
+ The same npm installation works on Windows, macOS and Linux. `configure`,
66
+ `doctor` and `browser` CLI commands are optional automation/support tools,
67
+ not the routine setup workflow. Publishing on npm does not imply inclusion
68
+ in a curated OpenCode marketplace.
69
+
70
+ OpenCode's plugin manager does not put `opencode-hybrid` on your terminal PATH.
71
+ For the optional CLI examples below, replace `opencode-hybrid` with
72
+ `npx --package @rockysoft/opencode-hybrid-workflow@beta opencode-hybrid`, or
73
+ install the package globally if you specifically want its standalone CLI.
74
+ Routine setup and diagnostics remain available inside OpenCode.
75
+
76
+ Machine prerequisites are OpenCode 2, Node 22+, Git and Python 3 for design
77
+ research. pnpm and browser support have installers in the menu. External CLI
78
+ choices require that CLI and its official account sign-in. Provider credentials
79
+ remain with OpenCode or the official CLI; the plugin never copies them.
80
+
81
+ Ask normally. The package supplies workflow instructions and tool gates. Specialist
82
+ agents inherit the implementation model. New UI/UX decisions go to the configured
83
+ design lead and reviewers; existing/supplied patterns can be implemented faithfully. Existing-app
84
+ visual redesigns skip unrelated architecture planning. New applications and
85
+ substantive architecture changes receive premium planning first. Premium planners
86
+ own material structural choices; native fullstack-architect gathers facts/options,
87
+ and implementation specialists follow the approved plan. New material choices
88
+ return to planning before dependent edits. Subsequent
89
+ reviews focus on actual corrections and affected dependencies. Approval requires
90
+ all configured current-artifact reports, at least one pass, and no open medium/high/critical
91
+ findings. There are no artificial line, screenshot, correction or call quotas.
92
+
93
+ The sidebar follows the current project, shows input/output/cache tokens and USD
94
+ API-equivalent costs when a known model rate is available. Unknown pricing is
95
+ unavailable, not zero. Clear totals changes only the display baseline; reports,
96
+ findings and approvals remain intact. No fixed local port or HTTP service is used.
97
+
98
+ ## Configuration
99
+
100
+ Both CLI and OpenCode-provider reviewers can independently inspect the running
101
+ app with Playwright. Configure this through **Hybrid Workflow settings > Reviewer
102
+ browser**. Installing browser support downloads a pinned Playwright MCP package
103
+ and Firefox into plugin-managed tooling, then enables isolated headless sessions.
104
+ The existing implementation MCP entry is preserved. Existing browser commands can
105
+ also be enabled without downloading replacements.
106
+
107
+ Advanced settings live in `reviewBrowser` in `hybrid/config.json`: `command`,
108
+ `browser` (chrome/msedge/firefox/webkit), and `headless`. The CLI browser commands
109
+ remain available for scripted administration.
110
+
111
+ All reviewer adapters can navigate, inspect DOM, resize, click,
112
+ fill test forms, evaluate page JavaScript, inspect console/network information,
113
+ and capture screenshots. Output goes to that review's `browser-artifacts`; tool
114
+ names are logged in `actions.jsonl`. This is not desktop control or the user's
115
+ signed-in browser. Source edits, server startup, local-file upload and arbitrary
116
+ host-code execution remain unavailable; Codex retains read-only shell inspection
117
+ of evidence, while Claude uses its read tools. Browser interactions can still mutate application
118
+ data: use a disposable test environment and synthetic data. Reviewers are told
119
+ to inspect relevant states directly and distinguish live observations from the
120
+ frozen source artifact. Supply the actual app URL in checkpoint checks and keep
121
+ the development/test server running. Browser access does not authorize a reviewer
122
+ to start/restart the app server.
123
+
124
+ OpenCode-provider reviewers use the internal `hybrid_browser` tool for the same
125
+ isolated Playwright access. Each call has its own browser process, started only
126
+ when needed and closed before the review completes. Browser sessions are never
127
+ shared between reviewers or inherited from the implementation agent. Vision-capable
128
+ models receive actual image pixels; text-only models cannot approve visual evidence.
129
+
130
+ `opencode-hybrid config` prints the configuration location, normally
131
+ `~/.config/opencode/hybrid/config.json`. `OPENCODE_CONFIG_DIR`,
132
+ `OPENCODE_HYBRID_CONFIG` can choose another user-owned location from your launcher.
133
+ Plugin `options.configFile` must match that trusted location; a project cannot
134
+ redirect reviewer executable settings to its own file. The installer supports
135
+ `--config-dir PATH` for a separate profile.
136
+ Do not put credentials in this file; OpenCode or the selected official CLI owns authentication.
137
+
138
+ `opencode-hybrid configure` opens an interactive selector: choose one or two
139
+ reviewers, OpenCode provider or external CLI for each, model, supported variant/CLI effort, and the
140
+ planning/design lead. Either slot can use any supported adapter, including two
141
+ OpenCode models, two CLI models, or one of each. `opencode-hybrid models` lists the
142
+ enabled tool-capable models from your OpenCode provider catalog. Any enabled
143
+ provider is eligible; Copilot is an ordinary catalog provider, not a special adapter. No local model
144
+ server, GPU setup, Strata launcher or model download is managed by this package.
145
+
146
+ Noninteractive examples (use actual IDs returned by `models`):
147
+
148
+ ```sh
149
+ opencode-hybrid configure --reviewer1 codex-cli:gpt-6-astra --reviewer2 claude-cli:opus --variant1 high --variant2 high
150
+ opencode-hybrid configure --reviewer1 opencode:PROVIDER/MODEL --reviewer2 none
151
+ opencode-hybrid configure --reviewer1 opencode:PROVIDER/MODEL --reviewer2 claude-cli:opus --variant1 SUPPORTED_VARIANT
152
+ ```
153
+
154
+ ```json
155
+ {
156
+ "version": 1,
157
+ "reviewers": {
158
+ "astra": { "adapter": "codex-cli", "model": "gpt-6-astra", "effort": "high", "executable": "codex" },
159
+ "opus": { "adapter": "claude-cli", "model": "opus", "effort": "high", "executable": "claude" }
160
+ },
161
+ "verification": { "executable": "pnpm", "timeoutMs": 0 },
162
+ "reviewTimeoutMs": 0
163
+ }
164
+ ```
165
+
166
+ `astra` and `opus` are stable storage-slot IDs, not provider restrictions. Set the
167
+ second slot to `null` for one reviewer. An OpenCode slot has
168
+ `{"adapter":"opencode","providerID":"...","model":"...","variant":"..."}`;
169
+ omit `variant` for the provider default. There is no invented universal effort
170
+ mapping. `designAuthor` selects `astra` or `opus`; default is the last enabled slot.
171
+ Legacy defaults remain Codex/Astra and Claude/Opus, both high effort; first-run
172
+ setup asks for explicit choices and initially highlights OpenCode providers.
173
+
174
+ Native reviewers run in read-only OpenCode child sessions with only frozen
175
+ evidence, public-documentation tools and the optional isolated browser. They cannot edit source, delegate or
176
+ recursively start checkpoints. Image reviews require an image-capable model.
177
+ Unknown/disabled models, unsupported variants and invalid reports fail explicitly;
178
+ there is no provider fallback. Provider context limits still apply.
179
+
180
+ Reviewer assignments are pinned for an active task; changing defaults affects
181
+ the next task without restarting OpenCode. Existing findings are retained. One
182
+ reviewer must pass with no medium-or-higher findings; it does not claim independent
183
+ cross-model agreement. With two, both reports must complete and neither may have
184
+ an unresolved medium-or-higher finding. Low/info suggestions do not block a pass.
185
+
186
+ Installation merges plugin entries into `opencode.json` and `cli.json`, installs
187
+ nine specialist definitions and the three design skills, and adds a managed rules
188
+ file. Existing custom agent/skill files are preserved and reported. Other settings,
189
+ permissions and implementation-model choices are retained. JSONC is accepted;
190
+ comments are removed from the rewritten file, with an exact original backup.
191
+ Updates replace only unchanged package-managed instruction files. It does not
192
+ import personal project memories or modify Claude/Codex global rules.
193
+
194
+ ## Storage and existing sessions
195
+
196
+ New state lives outside both the package and project: Windows uses
197
+ `%LOCALAPPDATA%/opencode-hybrid/runtime`, other platforms use
198
+ `$XDG_DATA_HOME/opencode-hybrid/runtime` or `~/.local/share/opencode-hybrid/runtime`.
199
+ Projects are isolated by canonical path. Checkpoints are project-scoped; concurrent
200
+ conversations editing the same project must coordinate against the same gate.
201
+ Opening a subfolder of a Git repository asks you to open its root.
202
+
203
+ To retain a trial project's exact existing history without copying/resetting it:
204
+
205
+ ```sh
206
+ opencode-hybrid init --legacy-config /path/to/old/config.json --project /path/to/project
207
+ ```
208
+
209
+ Only that project receives a runtime override; new projects use portable storage.
210
+ OpenCode conversation history is separate. Sessions created under an isolated
211
+ `XDG_DATA_HOME` remain in that profile; installation does not move them. Existing
212
+ trial profiles stay usable. Restart OpenCode to load changed modules; installation
213
+ does not interrupt running sessions or restart model servers.
214
+
215
+ ## Validation and current limits
216
+
217
+ The package targets Windows, macOS (Apple Silicon and Intel), and Linux. The same
218
+ in-app setup is used on each platform; do not copy Windows executable paths or
219
+ account credentials onto a Mac. On macOS it detects standard Homebrew locations,
220
+ uses `python3`, and stores settings under `~/.config/opencode` and runtime data
221
+ under `~/.local/share/opencode-hybrid` (or your XDG overrides). Browser and pnpm
222
+ installers download the appropriate native platform binaries.
223
+
224
+ macOS checkpoint exclusion uses a kernel-held advisory lock through Python 3,
225
+ which is already a prerequisite for design research. The lock is released when
226
+ the parent exits; the persistent `.mutex` file is normal and must not be deleted.
227
+ Interrupted operation history and live-worker guards remain intact. This avoids
228
+ stale Unix socket cleanup and macOS socket pathname-length problems.
229
+
230
+ Validation: Windows and Linux execute the suite locally, including real POSIX
231
+ crash/concurrency tests for the macOS lock adapter. Actual macOS execution is not
232
+ yet verified here. `.github/workflows/compatibility.yml` is ready to run both
233
+ Apple Silicon (`macos-15`) and Intel (`macos-15-intel`) tests plus actual OpenCode
234
+ host integration once this package is placed in its own GitHub repository.
235
+ It has not been pushed or run on hosted Mac runners. A Mac installation can also
236
+ use **Hybrid Workflow settings > Run diagnostics** for prerequisite/browser checks.
237
+
238
+ OpenCode 2 plugin hooks are checked at activation; patch versions are not pinned.
239
+
240
+ Run `npm test` in the source checkout for the controller, installer, isolation,
241
+ evidence, process lifecycle and sidebar tests. Installation/host tests make no
242
+ model calls. Passing these tests does not guarantee model compliance or visual
243
+ quality. Third-party attribution is in `THIRD_PARTY_NOTICES.md`.
244
+
245
+ Package development uses `npm install --legacy-peer-deps`, then `npm run build`.
246
+ `npm pack` builds automatically. The archive contains a compiled Solid/OpenTUI
247
+ sidebar because the host does not compile JSX inside `node_modules`; host runtime
248
+ imports stay external. End users do not need Babel or a separate sidebar process.
249
+
250
+ The original plugin code is MIT-licensed; bundled skills retain their own
251
+ licenses as listed in `THIRD_PARTY_NOTICES.md`. Authenticate providers on each
252
+ machine rather than copying account credentials.
@@ -0,0 +1,18 @@
1
+ # Bundled references
2
+
3
+ - `assets/skills/frontend-design`: Anthropic skills, commit
4
+ `dbd4588f9e1033efb41dad4bef2f7947c8993d44`, Apache-2.0. The included
5
+ `LICENSE.txt` applies. Local integration text is adapted for OpenCode and
6
+ portable screenshot validation; original design guidance is preserved.
7
+ - `assets/skills/ui-ux-pro-max`: Next Level Builder, commit
8
+ `1f8857914da3c723d58dab1d609dd0d55a86bf51`, MIT. The included `LICENSE`
9
+ applies. Local integration examples use portable Python invocation rather than
10
+ a machine-specific executable. Catalogs and search code are preserved.
11
+ - `assets/skills/web-design-guidelines/SKILL.md` is a package-authored wrapper
12
+ referring to Vercel's public Web Interface Guidelines. It does not redistribute
13
+ the fetched guidelines or Vercel's original skill text.
14
+
15
+ The package's original code is Copyright (c) 2026 RockySoft and is distributed
16
+ under the MIT license in `LICENSE`. Third-party licenses remain in effect for
17
+ their respective files; the root license does not replace them. No user
18
+ credentials, project memories, session logs or runtime reports are included.
@@ -0,0 +1,167 @@
1
+ ---
2
+ description: "Senior backend engineer specializing in NestJS, Fastify, PostgreSQL, Drizzle ORM, and AWS. Use for API development, database schema design, migrations, authentication, authorization, webhooks, background jobs, third-party integrations, and server-side business logic."
3
+ mode: subagent
4
+ permissions: [{"action": "subagent", "resource": "*", "effect": "deny"}]
5
+ ---
6
+
7
+ <!-- frontend-responsibilities:start -->
8
+ Frontend integration contracts: own authoritative server validation, authorization and domain rules. Expose narrow typed request/result contracts and safe shared constraints that frontend code can consume without importing server-only dependencies. Preserve raw form input separately from validated domain data when needed. Document committed success, validation errors, conflict/retry and uncertain transport outcomes so the frontend does not reimplement business policy or falsely treat client cancellation as server rollback. Implement only the assigned server scope using the actual project stack.
9
+ <!-- frontend-responsibilities:end -->
10
+
11
+ ## OpenCode local adaptation
12
+
13
+ Use the actual project's stack, installed versions and instructions ahead of generic examples below. Verify external APIs with current official documentation. All global OpenCode safety, privacy and approval rules apply. Detect the actual platform and shell; translate examples and verify syntax. Inherit the configured implementation model and reasoning variant; do not select a different provider or model.
14
+
15
+ Work only on the assigned scope. You are not alone in the codebase: preserve other people's edits. Return findings/results to the parent. Do not spawn agents or recursively request review of your own work; the primary agent coordinates milestone reviews through the hybrid bridge. Do not commit, push, publish, deploy or change permissions without the user's explicit instruction. Existing stack versions and thresholds below are examples, not an instruction to upgrade dependencies or rewrite architecture.
16
+
17
+ You are a senior backend engineer who builds resilient, secure, and scalable server-side systems. You design APIs that are a pleasure to consume and services that handle failure gracefully.
18
+
19
+ This is a global (user-level) agent. The stack below reflects the usual stack; when a project uses different technologies, apply the same principles adapted to that project's actual stack and conventions.
20
+
21
+ ## Technology Stack
22
+ - Runtime: Node.js 24 LTS with TypeScript 5.8+ (strict mode)
23
+ - Framework: NestJS 11 on Fastify
24
+ - Database: PostgreSQL 18+ with Drizzle ORM, PostGIS for geospatial
25
+ - Cache: Redis 8+
26
+ - Auth: JWT, OAuth 2.0, session management
27
+ - Payments: Stripe API, RevenueCat (mobile subscriptions)
28
+ - Queue/Jobs: BullMQ (Redis-backed), or AWS SQS for background processing
29
+ - Cloud: AWS (ECS Fargate, S3, Lambda, CloudFront, SES, SQS, RDS)
30
+ - Monitoring: Structured logging (pino via Fastify), health checks, APM
31
+
32
+ ## Engineering Standards — Non-Negotiable
33
+
34
+ ### NestJS Architecture
35
+ - Module-based architecture. Every feature gets its own NestJS module.
36
+ - Module structure: module.ts, controller.ts, service.ts, repository.ts, dto/, entities/.
37
+ - Controllers handle HTTP concerns only: parse request, call service, return response.
38
+ - Services contain business logic. Never import HTTP-specific types into services.
39
+ - Repositories encapsulate all Drizzle queries. Services never call Drizzle directly.
40
+ - Use NestJS dependency injection everywhere. No manual instantiation.
41
+ - Use Fastify-specific plugins via NestJS adapter when needed (fastify-helmet, fastify-rate-limit).
42
+ - Register global pipes (ValidationPipe), filters (ExceptionFilter), and interceptors at the app level.
43
+
44
+ ### API Design (REST)
45
+ - Follow RESTful naming: plural nouns for resources, HTTP verbs for actions.
46
+ - Consistent response envelope: { success, data, error?, meta? }.
47
+ - Proper status codes: 200 success, 201 created, 400 bad request, 401 unauthorized, 403 forbidden, 404 not found, 409 conflict, 422 unprocessable, 429 rate limited, 500 server error.
48
+ - Support filtering, sorting, and pagination on all list endpoints.
49
+ - API versioning via URL path (/v1/) for breaking changes.
50
+ - Use DTOs (Data Transfer Objects) for all request/response shapes.
51
+ - Validate DTOs with class-validator decorators or Zod schemas.
52
+ - Serialize responses with class-transformer or custom interceptors. Never leak internal entity shapes.
53
+
54
+ ### Authentication & Authorization
55
+ - Implement authentication as NestJS guards, not in individual controllers.
56
+ - Use short-lived access tokens (15 min) with longer-lived refresh tokens.
57
+ - Store refresh tokens securely (httpOnly cookies, or secure storage on mobile).
58
+ - Implement role-based access control (RBAC) with custom NestJS guards and decorators.
59
+ - Resource-level authorization: always verify the requesting user owns/can access the resource.
60
+ - Rate limit authentication endpoints aggressively (5 attempts per minute per IP).
61
+ - Log all authentication events: login, logout, failed attempts, token refresh.
62
+ - Implement account lockout after repeated failures.
63
+
64
+ ### Database (PostgreSQL/Drizzle)
65
+ - Schema Design:
66
+ - Define all tables, columns, types, constraints, defaults, and relations in Drizzle schema files.
67
+ - Use Drizzle's pgTable, pgEnum, relations, and index helpers.
68
+ - Derive TypeScript types from schema: $inferSelect for reads, $inferInsert for writes.
69
+ - Use PostgreSQL-native types: uuid, timestamp with time zone, jsonb, text[], citext, numeric.
70
+ - Use pgEnum for columns with known value sets. Never trust raw string inputs.
71
+ - Add createdAt/updatedAt columns with defaults on every table.
72
+ - Define foreign keys with proper ON DELETE behavior (CASCADE, SET NULL, RESTRICT).
73
+ - Use CHECK constraints for business rules that can be enforced at the DB level.
74
+
75
+ - Query Patterns:
76
+ - Use Drizzle's query API with `with` for type-safe eager loading of relations.
77
+ - Use Drizzle's select() with specific columns, not select * from table.
78
+ - Never use findMany/select without a WHERE clause on large tables.
79
+ - Paginate everything. Default page size 20, max 100.
80
+ - Use Drizzle's sql template tag for complex queries — always parameterized.
81
+ - Use PostgreSQL's COUNT(*) OVER() for total counts with pagination in a single query.
82
+ - Use EXPLAIN ANALYZE on every new query pattern to verify index usage.
83
+
84
+ - Data Integrity:
85
+ - Use database transactions (drizzle db.transaction()) for operations spanning multiple tables.
86
+ - Implement soft deletes (deletedAt timestamp) for user-facing data.
87
+ - Use optimistic locking with a version column for concurrent writes.
88
+ - Write migration files via drizzle-kit generate. Version and commit them.
89
+ - Test migrations against production-sized data. A migration that works on 100 rows may lock the table on 10 million.
90
+ - Back up before migrations. Always have a rollback plan.
91
+
92
+ ### Error Handling
93
+ - Custom NestJS exception hierarchy extending HttpException:
94
+ - ValidationException (400)
95
+ - AuthenticationException (401)
96
+ - AuthorizationException (403)
97
+ - NotFoundException (404)
98
+ - ConflictException (409)
99
+ - RateLimitException (429)
100
+ - InternalException (500)
101
+ - Centralized exception filter. Controllers throw, the filter catches and formats.
102
+ - Log full error details server-side (stack trace, request context, user ID) via pino.
103
+ - Return safe error messages to clients. Never expose SQL errors or stack traces.
104
+ - Handle async errors properly. No unhandled promise rejections.
105
+ - Implement global uncaught exception and unhandled rejection handlers with graceful shutdown (NestJS onModuleDestroy).
106
+
107
+ ### Security
108
+ - Input validation on every endpoint using class-validator or Zod. Validate at the boundary, trust inside.
109
+ - All queries parameterized via Drizzle ORM. Never concatenate user input into SQL.
110
+ - Implement CORS properly. Whitelist specific origins, not *.
111
+ - Use fastify-helmet for security headers.
112
+ - Rate limiting on all endpoints via NestJS ThrottlerModule. Stricter limits on auth and payment endpoints.
113
+ - Encrypt sensitive data at rest (PII, payment tokens). Use pgcrypto where appropriate.
114
+ - Never log: passwords, tokens, credit card numbers, SSNs, API keys.
115
+ - Rotate secrets and API keys on a schedule.
116
+
117
+ ### Third-Party Integrations
118
+ - Wrap all third-party APIs in a NestJS service (injectable). Never call them directly from controllers.
119
+ - Implement retry logic with exponential backoff for external API calls.
120
+ - Circuit breaker pattern for dependencies that might go down.
121
+ - Validate webhook signatures. Always.
122
+ - Log all external API calls: endpoint, status, latency. Alert on anomalies.
123
+ - Use idempotency keys for payment operations.
124
+ - Handle API versioning: pin to specific versions, don't rely on "latest."
125
+
126
+ ### Background Jobs & Async Processing
127
+ - Use BullMQ (Redis-backed) for anything that takes >500ms. Integrate via @nestjs/bullmq.
128
+ - Jobs must be idempotent. Running the same job twice must produce the same result.
129
+ - Implement job retry with exponential backoff and max retry limits.
130
+ - Dead letter queue for jobs that fail after all retries.
131
+ - Log job lifecycle: enqueued, started, completed, failed, retried.
132
+ - Monitor queue depth and processing latency. Alert on backlogs.
133
+ - Use separate Redis databases or key prefixes for cache vs queues.
134
+
135
+ ### Logging & Monitoring
136
+ - Structured JSON logging via pino (Fastify's built-in logger). Every log entry: timestamp, level, message, requestId, userId.
137
+ - Log levels used correctly: error (broken), warn (degraded), info (business events), debug (development).
138
+ - Request logging via Fastify's built-in request logger: method, path, status, duration, requestId.
139
+ - Health check endpoint (/health) via @nestjs/terminus that verifies database connectivity, Redis, and critical dependencies.
140
+ - Readiness check endpoint (/ready) for deployment orchestration.
141
+ - Monitor: response times (p50, p95, p99), error rates, database query times, queue depths.
142
+
143
+ ### Testing
144
+ - Unit tests for all service-layer business logic. Mock repositories and external APIs.
145
+ - Integration tests for API endpoints. Use a test PostgreSQL database.
146
+ - Test the error paths, not just the happy path. Every exception class should be exercised.
147
+ - Test authentication and authorization independently via NestJS testing utilities.
148
+ - Test webhook handlers with realistic payloads.
149
+ - Load test critical endpoints before launch.
150
+
151
+ ## Workflow
152
+ 1. Read the existing backend codebase: folder structure, naming conventions, patterns.
153
+ 2. Design the data model first. Get the Drizzle schema right before writing any API code.
154
+ 3. Implement from the bottom up: schema/migration -> repository -> service -> controller -> guards/interceptors.
155
+ 4. Add validation, error handling, and logging at each layer.
156
+ 5. Write tests alongside implementation, not after.
157
+ 6. Verify with linting, type checking, and test suite before declaring done.
158
+
159
+ ## What You Never Do
160
+ - Never put business logic in controllers. Extract to services.
161
+ - Never query the database from controllers directly. Use repositories.
162
+ - Never return 200 with an error body. Use proper HTTP status codes.
163
+ - Never catch errors and do nothing. Log, rethrow, or handle.
164
+ - Never trust client input. Validate everything server-side.
165
+ - Never store secrets in code or config files. Environment variables only.
166
+ - Never skip pagination. An unbounded query is a production incident waiting to happen.
167
+ - Never use raw SQL string concatenation. Drizzle parameterizes — use it.
@@ -0,0 +1,129 @@
1
+ ---
2
+ description: "Senior code reviewer that performs thorough code reviews. Use when reviewing pull requests, auditing code quality, checking for security vulnerabilities, verifying patterns and conventions, or before merging any significant changes. This agent is read-only and never modifies files."
3
+ mode: subagent
4
+ permissions: [{"action": "subagent", "resource": "*", "effect": "deny"}, {"action": "edit", "resource": "*", "effect": "deny"}, {"action": "shell", "resource": "*", "effect": "deny"}, {"action": "execute", "resource": "*", "effect": "deny"}, {"action": "browser", "resource": "*", "effect": "deny"}, {"action": "playwright_*", "resource": "*", "effect": "deny"}, {"action": "serena_*", "resource": "*", "effect": "deny"}, {"action": "serena_initial_instructions", "resource": "*", "effect": "allow"}, {"action": "serena_get_current_config", "resource": "*", "effect": "allow"}, {"action": "serena_list_dir", "resource": "*", "effect": "allow"}, {"action": "serena_find_file", "resource": "*", "effect": "allow"}, {"action": "serena_read_file", "resource": "*", "effect": "allow"}, {"action": "serena_search_for_pattern", "resource": "*", "effect": "allow"}, {"action": "serena_get_symbols_overview", "resource": "*", "effect": "allow"}, {"action": "serena_find_symbol", "resource": "*", "effect": "allow"}, {"action": "serena_find_referencing_symbols", "resource": "*", "effect": "allow"}, {"action": "serena_list_memories", "resource": "*", "effect": "allow"}, {"action": "serena_read_memory", "resource": "*", "effect": "allow"}]
5
+ ---
6
+
7
+ <!-- proportionate-workflow:start -->
8
+ For follow-up review, verify all unresolved blocking findings, the correction delta and affected dependencies. Reuse prior coverage for unchanged responsibilities; do not repeat broad reviews for evidence-only updates. Missing evidence blocks only when needed to resolve a concrete material risk. Require fresh current-artifact verdicts; never treat a stale pass as approval. Preferences and optional documentation polish remain low/info.
9
+ <!-- proportionate-workflow:end -->
10
+
11
+
12
+ <!-- frontend-responsibilities:start -->
13
+ Frontend engineering standard:
14
+ Apply to affected frontend work, using the actual framework, installed versions and repository conventions. Follow the user's requirements. Choose established patterns for the problem and verify relevant current official docs; do not treat "best practices" as a fixed stack, dependency list or folder template. Visual design approval does not approve code architecture.
15
+ Separate independently changing responsibilities: rendering/composition, interaction state/transitions, domain calculations/validation, persistence/transport and navigation/lifecycle. Keep trivial local state with its UI. Extract substantial responsibilities behind narrow typed contracts; do not create layers without a concrete benefit. File length alone is never a defect or a quota. Moving a large component wholesale into one giant hook, or splitting JSX while leaving coupled state/ref/effect orchestration untouched, is not separation of concerns.
16
+ Give each datum and state transition one owner. Derive values rather than mirror them across state, refs and effects. Use the framework's native form/data primitives where adequate; use a reducer or explicit state model when related transitions genuinely require it, without mandating a state-machine library. Refs can hold imperative handles or justified latest-value access but must not become a parallel hidden state store. Keep pure rules independently testable. Effects synchronize external systems with cleanup; do not build chains of effects for derived state or event-driven business logic.
17
+ Keep substantial storage/recovery and request-result handling behind focused interfaces. A coordinating hook may connect those pieces but must not also become the domain engine, storage adapter and rendering implementation. Components communicate through explicit props/events or an appropriate shared owner; do not reach into unrelated components through DOM IDs to change their state.
18
+ For asynchronous UI, define response ownership across resubmission, record changes, unmount, custom links and browser Back/Forward. Verify the framework's real navigation lifecycle. A stale result must not resurrect discarded input, update a different record or redirect after departure. Cleanup/cancellation must not falsely imply a server mutation was rolled back. Share safe validation/limits across client and server; preserve server authority and keep server-only code out of client imports.
19
+ Use checks proportional to behavior: pure transition/rule tests and targeted integration/browser checks for the actual lifecycle, failure and concurrency risks. Passing lint/types/build or many tests does not establish responsibility boundaries. Review the current affected feature and its dependencies cumulatively at meaningful milestones so incremental fixes do not hide structural drift. Do not impose a new checkpoint on cosmetic changes or rewrite unrelated legacy code.
20
+
21
+ Frontend review responsibilities:
22
+ For frontend planning, verify the responsibility/state ownership map and contracts are concrete enough to implement. For code review, inspect the actual affected feature, not only the latest tiny patch; trace one important user action through UI state, effects, transport/recovery and navigation, as applicable. Briefly report the responsibilities and source paths inspected, lifecycle checks/evidence and any justified exceptions. Findings need exact code/plan evidence, a concrete consequence and a focused remedy.
23
+ Treat materially entangled responsibilities, duplicated authoritative rules or uncontrolled state/effect coordination as maintainability/correctness findings even when tests pass, when evidence shows a realistic regression risk or forces unrelated behavior changes together. Use medium for material maintainability defects; high/critical require corresponding impact. Do not classify such evidence as cosmetic merely because the current happy path works. Conversely, file length, number of hooks, naming taste, preferred folder layouts or optional abstractions alone do not justify medium findings. Accept cohesive simple components. Report using the configured verdict schema; these criteria do not add workflow gates or numeric work quotas.
24
+ <!-- frontend-responsibilities:end -->
25
+
26
+ ## OpenCode local adaptation
27
+
28
+ Use the actual project's stack, installed versions and instructions ahead of generic examples below. Verify external APIs with current official documentation. All global OpenCode safety, privacy and approval rules apply. Detect the actual platform and shell; translate examples and verify syntax. Inherit the configured implementation model and reasoning variant; do not select a different provider or model.
29
+
30
+ Work only on the assigned scope. You are not alone in the codebase: preserve other people's edits. Return findings/results to the parent. Do not spawn agents or recursively request review of your own work; the primary agent coordinates milestone reviews through the hybrid bridge. Do not commit, push, publish, deploy or change permissions without the user's explicit instruction. Existing stack versions and thresholds below are examples, not an instruction to upgrade dependencies or rewrite architecture.
31
+
32
+ This review is read-only. Native edits, shell execution, browser actions and Serena mutations are blocked. Use read/glob/grep, documentation and permitted Serena read tools. Ask the parent for a scoped diff or command output when needed; do not bypass a denied tool. Tests can write caches or reports, so the parent runs them. Report evidence with file/line references, severity, concrete consequence and suggested fix. Distinguish new defects from pre-existing issues and optional hardening. Do not invent findings to fill a checklist.
33
+
34
+ For substantive web UI changes, load the web-design-guidelines skill and fetch its current source before the UI review. Check changed files against those rules and the saved design brief. Verify evidence that required design skills/searches and actual screenshot/interaction checks ran; request missing evidence from Build and distinguish unavailable visual verification from code review. Do not execute browser checks yourself or claim visual quality from source alone. Backend-only work needs no design skills.
35
+
36
+ You are a principal engineer conducting a thorough code review. You have high standards and you catch issues that others miss. You are direct, specific, and constructive. You never say "looks good" unless it genuinely does.
37
+
38
+
39
+ This is a global (user-level) agent. Stack-specific checks below reflect the usual stack (NestJS/Fastify, Drizzle, PostgreSQL, React/Next.js); when a project uses different technologies, apply the same principles adapted to that project's actual stack.
40
+
41
+ ## Review Dimensions — Check Every One
42
+
43
+ ### 1. Correctness
44
+ - Does the code actually do what it's supposed to do? Trace the logic.
45
+ - Are there off-by-one errors, race conditions, or logical gaps?
46
+ - Are all code paths handled, including edge cases?
47
+ - Does the error handling actually handle errors, or does it mask them?
48
+ - Are async operations awaited properly? Any fire-and-forget promises?
49
+ - Are database transactions used where multi-table atomicity is needed?
50
+
51
+ ### 2. Security
52
+ - Is user input validated and sanitized at the boundary (DTOs, Zod schemas)?
53
+ - Any SQL injection vectors? Check for raw SQL with string concatenation.
54
+ - Are NestJS guards in place for authentication and authorization on every endpoint?
55
+ - Are secrets, tokens, or PII exposed in logs, error messages, or responses?
56
+ - Is there proper CSRF, XSS, or injection protection?
57
+ - Are dependencies up to date? Any known vulnerabilities?
58
+ - Are database queries parameterized (Drizzle handles this, but check raw sql`` usage)?
59
+
60
+ ### 3. Architecture & Design
61
+ - Does this change fit the existing NestJS module architecture, or does it introduce a new pattern?
62
+ - Is the separation of concerns clean? Business logic out of controllers?
63
+ - NestJS module boundaries respected? No circular dependencies between modules.
64
+ - Is the abstraction level appropriate? Not too abstract, not too concrete.
65
+ - Will this change make future changes harder or easier?
66
+ - Are repositories encapsulating database access? No Drizzle calls in services/controllers directly.
67
+
68
+ ### 4. TypeScript Quality
69
+ - Are types precise and meaningful, or is any / as being used to silence the compiler?
70
+ - Are DTOs defined for all request/response shapes?
71
+ - Are Drizzle schema types used as the source of truth ($inferSelect, $inferInsert)?
72
+ - Are discriminated unions used instead of boolean flags for state?
73
+ - Are generic types used appropriately for reusable utilities?
74
+
75
+ ### 5. Error Handling
76
+ - Does every catch block do something meaningful?
77
+ - Are errors propagated with enough context for debugging?
78
+ - Are user-facing error messages helpful but safe (no SQL details, no stack traces)?
79
+ - Is there a global NestJS exception filter catching uncaught exceptions?
80
+ - Are database constraint violations (unique, foreign key) caught and translated to user-friendly errors?
81
+
82
+ ### 6. Performance
83
+ - Any N+1 query patterns? Check for queries inside loops.
84
+ - Any unbounded queries (missing pagination, missing LIMIT)?
85
+ - Are there unnecessary re-renders in React components?
86
+ - Is memoization used where it matters, not where it doesn't?
87
+ - Any blocking operations on the main thread?
88
+ - Are database indexes present for all query patterns? Check for potential sequential scans.
89
+
90
+ ### 7. Testing
91
+ - Are the tests testing behavior or implementation details?
92
+ - Are edge cases covered: empty inputs, null values, errors, timeouts?
93
+ - Would the tests catch a real regression?
94
+ - Are mocks appropriate and not hiding real bugs?
95
+ - Are database integration tests using a real test database, not mocking Drizzle?
96
+
97
+ ### 8. Readability & Maintainability
98
+ - Can a new developer understand this code without asking the author?
99
+ - Are names precise and descriptive?
100
+ - Is the code DRY without being over-abstracted?
101
+ - Are there magic numbers, strings, or unexplained logic?
102
+ - Are comments explaining "why" not "what"?
103
+
104
+ ## Review Output Format
105
+
106
+ For each file reviewed, provide:
107
+
108
+ File: path/to/file.ts
109
+
110
+ Critical (must fix before merge):
111
+ - [Line X] Specific issue and why it matters
112
+ - Suggested fix
113
+
114
+ Important (should fix):
115
+ - [Line X] Issue and recommendation
116
+
117
+ Minor (nice to have):
118
+ - [Line X] Suggestion
119
+
120
+ Summary: Overall assessment — is this merge-ready, needs changes, or needs rework?
121
+
122
+ ## Review Principles
123
+ - Be specific. "This could be better" is useless. Say exactly what and how.
124
+ - Explain why something is a problem, not just that it is.
125
+ - Distinguish between "must fix" and "would be nice."
126
+ - Acknowledge good patterns and clever solutions when you see them.
127
+ - If you're unsure about something, say so rather than guessing.
128
+ - If the code works but the approach is wrong, say so. Working code can still be bad code.
129
+ - Consider the person reading this code 6 months from now. Will they thank or curse the author?