@funara/wevr 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +397 -0
- package/bin/wevr.js +4 -0
- package/package.json +48 -0
- package/src/cli/commands/doctor.js +137 -0
- package/src/cli/commands/init.js +156 -0
- package/src/cli/commands/launch.js +122 -0
- package/src/cli/commands/theme.js +67 -0
- package/src/cli/commands/theme.test.js +28 -0
- package/src/cli/commands/uninstall.js +103 -0
- package/src/cli/commands/update.js +9 -0
- package/src/cli/index.js +63 -0
- package/src/cli/wizard/selectModelTier.js +40 -0
- package/src/core/agentPromptWriter.js +45 -0
- package/src/core/agentPromptWriter.test.js +56 -0
- package/src/core/backup.js +46 -0
- package/src/core/backup.test.js +51 -0
- package/src/core/commandsWriter.js +26 -0
- package/src/core/commandsWriter.test.js +29 -0
- package/src/core/configBuilder.js +32 -0
- package/src/core/configBuilder.test.js +93 -0
- package/src/core/configWriter.js +10 -0
- package/src/core/configWriter.test.js +26 -0
- package/src/core/identityHeader.js +8 -0
- package/src/core/identityHeader.test.js +15 -0
- package/src/core/paths.js +13 -0
- package/src/core/paths.test.js +33 -0
- package/src/core/pluginWriter.js +29 -0
- package/src/core/pluginWriter.test.js +41 -0
- package/src/core/skillsWriter.js +13 -0
- package/src/core/skillsWriter.test.js +30 -0
- package/src/core/themeWriter.js +26 -0
- package/src/core/themeWriter.test.js +29 -0
- package/src/core/tuiConfigWriter.js +22 -0
- package/src/core/tuiConfigWriter.test.js +38 -0
- package/src/core/version.js +8 -0
- package/src/core/versionCheck.js +44 -0
- package/src/core/versionCheck.test.js +34 -0
- package/src/plugins/README.md +57 -0
- package/src/plugins/wevr-flow.js +137 -0
- package/src/plugins/wevr-squeeze.js +3630 -0
- package/src/templates/agent-prompts/analyze.txt +43 -0
- package/src/templates/agent-prompts/builder.txt +10 -0
- package/src/templates/agent-prompts/compose.txt +45 -0
- package/src/templates/agent-prompts/debug.txt +43 -0
- package/src/templates/agent-prompts/explorer.txt +10 -0
- package/src/templates/agent-prompts/hierarchy.txt +95 -0
- package/src/templates/agent-prompts/reporter.txt +10 -0
- package/src/templates/agent-prompts/verifier.txt +10 -0
- package/src/templates/commands/squeeze-dashboard.md +5 -0
- package/src/templates/commands/squeeze-health.md +10 -0
- package/src/templates/commands/squeeze-quick.md +10 -0
- package/src/templates/model-defaults.json +59 -0
- package/src/templates/opencode.config.json +243 -0
- package/src/templates/skills/brooks-lint-rca/SKILL.md +48 -0
- package/src/templates/skills/codebase-fact-finding/SKILL.md +39 -0
- package/src/templates/skills/diff-review/SKILL.md +42 -0
- package/src/templates/skills/general-coding/SKILL.md +43 -0
- package/src/templates/skills/minimal-fixing/SKILL.md +25 -0
- package/src/templates/skills/plan-checking/SKILL.md +33 -0
- package/src/templates/skills/ponytail-patching/SKILL.md +20 -0
- package/src/templates/skills/prd-formatting/SKILL.md +45 -0
- package/src/templates/skills/refactoring-patterns/SKILL.md +37 -0
- package/src/templates/skills/security-auditing/SKILL.md +35 -0
- package/src/templates/skills/security-remediation/SKILL.md +37 -0
- package/src/templates/skills/summary-reporting/SKILL.md +83 -0
- package/src/templates/skills/test-assurance/SKILL.md +44 -0
- package/src/templates/skills/test-mocking-strategy/SKILL.md +18 -0
- package/src/templates/skills/ui-design-audit/SKILL.md +23 -0
- package/src/templates/skills/ui-design-system/SKILL.md +37 -0
- package/src/templates/skills/wstg-recon/SKILL.md +33 -0
- package/src/templates/themes/wevr-colorful.json +241 -0
- package/src/templates/themes/wevr-dark.json +177 -0
- package/src/templates/themes/wevr-light.json +241 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Adhi Rahmadian
|
|
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
ADDED
|
@@ -0,0 +1,397 @@
|
|
|
1
|
+
# Wevr
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/wevr)
|
|
4
|
+
[](https://www.npmjs.com/package/wevr)
|
|
5
|
+
[](https://github.com/funara/wevr/blob/main/LICENSE)
|
|
6
|
+
|
|
7
|
+
** Plan - Build - Review ** -- opinionated engineering workflow installer for [OpenCode](https://opencode.ai).
|
|
8
|
+
|
|
9
|
+
## TL;DR
|
|
10
|
+
|
|
11
|
+
Wevr installs an opinionated, strict AI-agent workflow (Compose, Debug, and Analyze) with 14 specialized subagents into **OpenCode**. It enforces structured phases (Explore -> Plan -> Build), interactive guardrail gates, and test verification without ad-hoc delegation.
|
|
12
|
+
|
|
13
|
+
## Quick Start
|
|
14
|
+
|
|
15
|
+
Get up and running in 3 simple steps:
|
|
16
|
+
|
|
17
|
+
1. **Install globally:**
|
|
18
|
+
```bash
|
|
19
|
+
npm install -g wevr
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
2. **Initialize and configure agents:**
|
|
23
|
+
```bash
|
|
24
|
+
wevr init
|
|
25
|
+
```
|
|
26
|
+
*(Select LLM models for reasoning, precision, and fast tiers when prompted)*
|
|
27
|
+
|
|
28
|
+
3. **Launch OpenCode with Wevr:**
|
|
29
|
+
```bash
|
|
30
|
+
wevr
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## What is Wevr?
|
|
36
|
+
|
|
37
|
+
Wevr installs **3 primary agents + 14 subagents** into OpenCode -- each primary agent owns its exclusive subagents, scoped permissions, and enforced workflow rules. No shared subagents. No ad-hoc delegation.
|
|
38
|
+
|
|
39
|
+
| Primary Agent | Purpose | Subagents |
|
|
40
|
+
|---|---|---|
|
|
41
|
+
| **Compose** | Feature work -- Explore -> Plan -> Build | Researcher, Plan-Writer, Plan-Checker, Coder, Tester, Reviewer, Compose-Reporter |
|
|
42
|
+
| **Debug** | Bug investigation -- Investigate -> Fix -> Report | Inspector, Fixer, Debug-Reporter |
|
|
43
|
+
| **Analyze** | Security audit -- Trace -> Patch -> Audit | Tracer, Patcher, Auditor, Analyze-Reporter |
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
### Parallel Subagent Swarming
|
|
48
|
+
|
|
49
|
+
To optimize wall-clock execution time, Wevr's primary agents are empowered to **swarm multiple subagents concurrently** (e.g. running multiple researchers, inspectors, tracers, coders, fixers, patchers, testers, or auditors in parallel) for independent directories, files, or API endpoints. This enables non-linear workflow execution and leverages OpenCode's concurrent process engine.
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## Agent Workflows
|
|
54
|
+
|
|
55
|
+
### Compose -- Feature Work
|
|
56
|
+
|
|
57
|
+
Compose is the **single entry point for all feature work**. It runs 3 strict, one-directional phases. Phase direction is one-way -- no going back without explicit user instruction.
|
|
58
|
+
|
|
59
|
+
```
|
|
60
|
+
You describe a feature / idea
|
|
61
|
+
|
|
|
62
|
+
v
|
|
63
|
+
+-----------------------------------------+
|
|
64
|
+
| EXPLORE PHASE (mandatory start) |
|
|
65
|
+
| |
|
|
66
|
+
| Delegate: Researcher |
|
|
67
|
+
| -> deep codebase + web fact-finding |
|
|
68
|
+
| -> confirmed-inferred facts / risks |
|
|
69
|
+
| |
|
|
70
|
+
| Compose internally assesses: |
|
|
71
|
+
| Is this feature simple or complex? |
|
|
72
|
+
+----------+------------------------------+
|
|
73
|
+
|
|
|
74
|
+
+--------+---------------+
|
|
75
|
+
| Simple feature | Complex feature
|
|
76
|
+
v v
|
|
77
|
+
GUARDRAIL GATE 1a GUARDRAIL GATE 1b
|
|
78
|
+
"Build directly?" "Write a PRD?"
|
|
79
|
+
| |
|
|
80
|
+
| Yes | Yes
|
|
81
|
+
| v
|
|
82
|
+
| +------------------------------+
|
|
83
|
+
| | PLAN PHASE |
|
|
84
|
+
| | |
|
|
85
|
+
| | Plan-Writer -> docs/plans/ |
|
|
86
|
+
| | Plan-Checker validates PRD |
|
|
87
|
+
| | PASS/FAIL + gap list only |
|
|
88
|
+
| | |
|
|
89
|
+
| | FAIL -> surface gaps to you |
|
|
90
|
+
| | (max 5 loops) |
|
|
91
|
+
| | |
|
|
92
|
+
| | PASS -> GUARDRAIL GATE 2 |
|
|
93
|
+
| | "Build from this PRD?" |
|
|
94
|
+
| +-------------+----------------+
|
|
95
|
+
| | Yes
|
|
96
|
+
+----------+-------------+
|
|
97
|
+
v
|
|
98
|
+
+--------------------------------------------+
|
|
99
|
+
| BUILD PHASE |
|
|
100
|
+
| |
|
|
101
|
+
| Coder -> implements from PRD / request |
|
|
102
|
+
| | |
|
|
103
|
+
| v |
|
|
104
|
+
| Tester -> PASS/FAIL/BLOCKED |
|
|
105
|
+
| | FAIL -> back to Coder (max 5 loops) |
|
|
106
|
+
| | PASS v |
|
|
107
|
+
| v |
|
|
108
|
+
| Reviewer -> PASS/FAIL + gap list |
|
|
109
|
+
| | FAIL -> back to Coder (max 5 loops) |
|
|
110
|
+
| | PASS v |
|
|
111
|
+
| v |
|
|
112
|
+
| Compose-Reporter -> docs/reports/ |
|
|
113
|
+
+--------------------------------------------+
|
|
114
|
+
|
|
|
115
|
+
v
|
|
116
|
+
You review result
|
|
117
|
+
|
|
|
118
|
+
Compose resets -> asks: New feature? Debug? Iterate?
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
**Key rules:**
|
|
122
|
+
- Compose has **no read/write/bash permissions** -- all work delegated to subagents
|
|
123
|
+
- Phase transition only via guardrail gates -- no skipping
|
|
124
|
+
- `Coder -> Coder` loops without Tester verification are forbidden
|
|
125
|
+
- 5 consecutive FAILs from Tester or Reviewer -> surfaces to you
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
### Debug -- Bug Investigation
|
|
130
|
+
|
|
131
|
+
Debug is a **standalone primary agent** -- does not depend on Compose. Trigger it directly from the Debug tab whenever you find a bug.
|
|
132
|
+
|
|
133
|
+
```
|
|
134
|
+
You report a bug / defect
|
|
135
|
+
|
|
|
136
|
+
v
|
|
137
|
+
GUARDRAIL GATE 1 (question tool):
|
|
138
|
+
"Ready to investigate?"
|
|
139
|
+
| Yes
|
|
140
|
+
v
|
|
141
|
+
+---------------------------------------------+
|
|
142
|
+
| INVESTIGATE PHASE (Inspector subagent) |
|
|
143
|
+
| |
|
|
144
|
+
| Review mode (Debug selects): |
|
|
145
|
+
| - PR Review -> classify R1-R6 |
|
|
146
|
+
| - Architecture -> dependency analysis |
|
|
147
|
+
| - Tech Debt -> Pain x Spread score |
|
|
148
|
+
| - Test Quality -> classify T1-T6 |
|
|
149
|
+
| |
|
|
150
|
+
| Output: Iron Law chain per finding |
|
|
151
|
+
| Symptom -> Source -> Consequence -> Remedy |
|
|
152
|
+
+----------+----------------------------------+
|
|
153
|
+
|
|
|
154
|
+
Root cause identified?
|
|
155
|
+
+--------+--------+
|
|
156
|
+
| Yes | No / unknowns remain
|
|
157
|
+
v v
|
|
158
|
+
GUARDRAIL GATE 2 (question tool):
|
|
159
|
+
"Ready to apply fix?"
|
|
160
|
+
| Yes Halt -- surface to you
|
|
161
|
+
v with specific questions
|
|
162
|
+
+-------------+
|
|
163
|
+
| FIX PHASE | (Fixer subagent)
|
|
164
|
+
+------+------+
|
|
165
|
+
|
|
|
166
|
+
v
|
|
167
|
+
+--------------------------------------+
|
|
168
|
+
| REPORT PHASE |
|
|
169
|
+
| |
|
|
170
|
+
| Delegate: Debug-Reporter |
|
|
171
|
+
| -> Iron Law diagnosis report |
|
|
172
|
+
| -> saved to docs/reports/ |
|
|
173
|
+
+--------------------------------------+
|
|
174
|
+
|
|
|
175
|
+
v
|
|
176
|
+
You review the diagnosis + fix
|
|
177
|
+
|
|
|
178
|
+
Debug resets -> asks (question tool): Finished? Iterate?
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
**Key rules:**
|
|
182
|
+
- Debug has **no read/write/bash permissions** -- all delegated to subagents
|
|
183
|
+
- Executes only after Gate 1 (Investigation) and Gate 2 (Fix) user confirmations
|
|
184
|
+
- Never delegates Fixer without Inspector confirming root cause first
|
|
185
|
+
- If unknowns remain after investigation -> halts and prompts you, does not guess
|
|
186
|
+
|
|
187
|
+
---
|
|
188
|
+
|
|
189
|
+
### Analyze -- Security Audit
|
|
190
|
+
|
|
191
|
+
Analyze is a **standalone primary agent** -- does not depend on Compose or Debug. Trigger it directly from the Analyze tab to audit any codebase for security vulnerabilities and quality decay.
|
|
192
|
+
|
|
193
|
+
```
|
|
194
|
+
You trigger a security audit
|
|
195
|
+
|
|
|
196
|
+
v
|
|
197
|
+
GUARDRAIL GATE 1 (question tool):
|
|
198
|
+
"Ready to start scan?"
|
|
199
|
+
| Yes
|
|
200
|
+
v
|
|
201
|
+
+---------------------------------------------------+
|
|
202
|
+
| TRACE PHASE (Tracer subagent) |
|
|
203
|
+
| |
|
|
204
|
+
| -> WSTG-guided breadth-first recon |
|
|
205
|
+
| -> trace data flows: input -> path -> sink |
|
|
206
|
+
| |
|
|
207
|
+
| Output: |
|
|
208
|
+
| - Confirmed Vulnerabilities (OWASP category, |
|
|
209
|
+
| location, data flow) |
|
|
210
|
+
| - Suspected Vulnerabilities (manual verify) |
|
|
211
|
+
| - Quality & Decay Risks (e.g. hardcoded |
|
|
212
|
+
| secrets, missing input validation) |
|
|
213
|
+
+----------+----------------------------------------+
|
|
214
|
+
|
|
|
215
|
+
v
|
|
216
|
+
GUARDRAIL GATE 2 (question tool):
|
|
217
|
+
"Audit findings ready. How to proceed?"
|
|
218
|
+
+-- "Patch all confirmed findings" -> PATCH PHASE
|
|
219
|
+
+-- "Select specific findings" -> PATCH PHASE (you pick)
|
|
220
|
+
+-- "Audit only -- no patches" -> AUDIT PHASE (skip PATCH)
|
|
221
|
+
+-- "Re-investigate attack surface" -> re-delegate Tracer
|
|
222
|
+
|
|
|
223
|
+
v
|
|
224
|
+
+--------------------------------------------------+
|
|
225
|
+
| PATCH PHASE (skipped if audit-only) |
|
|
226
|
+
| |
|
|
227
|
+
| Delegate: Patcher |
|
|
228
|
+
| -> Ponytail mindset: smallest correct diff |
|
|
229
|
+
| -> prefer deleting the cause over wrapping it |
|
|
230
|
+
| -> escalates to you if patch > 10 lines |
|
|
231
|
+
+----------+---------------------------------------+
|
|
232
|
+
|
|
|
233
|
+
v
|
|
234
|
+
+--------------------------------------------------+
|
|
235
|
+
| AUDIT PHASE (max 5 loops) |
|
|
236
|
+
| |
|
|
237
|
+
| Delegate: Auditor |
|
|
238
|
+
| -> verify patch resolved vulnerabilities |
|
|
239
|
+
| -> security regression check |
|
|
240
|
+
| | (Auditor subagent) |
|
|
241
|
+
| |
|
|
242
|
+
| PASS -> proceed to report |
|
|
243
|
+
| FAIL -> re-delegate Patcher with Gap + BLOAT |
|
|
244
|
+
| lists verbatim (max 5 loops, then you) |
|
|
245
|
+
| |
|
|
246
|
+
| Delegate: Analyze-Reporter |
|
|
247
|
+
| -> security audit report -> docs/reports/ |
|
|
248
|
+
+--------------------------------------------------+
|
|
249
|
+
|
|
|
250
|
+
v
|
|
251
|
+
You review the audit report
|
|
252
|
+
|
|
|
253
|
+
Analyze resets -> asks (question tool): Finished? Iterate?
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
**Key rules:**
|
|
257
|
+
- Analyze has **no read/write/bash permissions** -- all delegated to subagents
|
|
258
|
+
- Never starts scanning/tracing without Gate 1 user confirmation
|
|
259
|
+
- Never patches without a GUARDRAIL GATE 2 user confirmation after TRACE
|
|
260
|
+
- 5 consecutive AUDIT FAILs -> surfaces to you
|
|
261
|
+
|
|
262
|
+
---
|
|
263
|
+
|
|
264
|
+
## Subagent Reference
|
|
265
|
+
|
|
266
|
+
Each subagent belongs to exactly one primary agent and cannot be invoked by anyone else:
|
|
267
|
+
|
|
268
|
+
| Primary | Phase | Subagent | Model Tier | Role |
|
|
269
|
+
|---------|-------|----------|------------|------|
|
|
270
|
+
| Compose | EXPLORE | Researcher | Reasoning | Fact-finding: confirmed_facts / inferred_facts / unknowns / risks |
|
|
271
|
+
| Compose | PLAN | Plan-Writer | Fast | **Formatter** -- writes PRD to `docs/plans/`, missing input = TBD |
|
|
272
|
+
| Compose | PLAN | Plan-Checker | Reasoning | **Gate** -- PASS/FAIL + gap list only, no suggestions |
|
|
273
|
+
| Compose | BUILD | Coder | Fast | Implements code from PRD |
|
|
274
|
+
| Compose | BUILD | Tester | Precision | PASS/FAIL/BLOCKED + coverage gaps only |
|
|
275
|
+
| Compose | BUILD | Reviewer | Precision | **Gate** -- PASS/FAIL + gap list only, no suggestions |
|
|
276
|
+
| Compose | BUILD | Compose-Reporter | Fast | **Formatter** -- completion report to `docs/reports/` |
|
|
277
|
+
| Debug | INVESTIGATE | Inspector | Reasoning | Brooks-Lint RCA (Iron Law + 6 decay risks + 4 review modes) |
|
|
278
|
+
| Debug | FIX | Fixer | Fast | Minimal, root-cause-targeted fix |
|
|
279
|
+
| Debug | REPORT | Debug-Reporter | Fast | **Formatter** -- Iron Law diagnosis report to `docs/reports/` |
|
|
280
|
+
| Analyze | TRACE | Tracer | Precision | WSTG recon + vuln path tracing, no remedies |
|
|
281
|
+
| Analyze | PATCH | Patcher | Fast | Minimal, security-targeted fix (Ponytail, max 10 lines) |
|
|
282
|
+
| Analyze | AUDIT | Auditor | Precision | **Gate** -- PASS/FAIL + Gap List + BLOAT List only |
|
|
283
|
+
| Analyze | AUDIT | Analyze-Reporter | Fast | **Formatter** -- security audit report to `docs/reports/` |
|
|
284
|
+
|
|
285
|
+
---
|
|
286
|
+
|
|
287
|
+
## Flow Rules
|
|
288
|
+
|
|
289
|
+
| Rule | Detail |
|
|
290
|
+
|------|--------|
|
|
291
|
+
| **Mandatory starts** | Compose always starts in EXPLORE. Analyze always starts in TRACE. No skipping. |
|
|
292
|
+
| **Guardrail gates** | Compose: Gate 1 (EXPLORE->PLAN/BUILD), Gate 2 (PLAN->BUILD). Analyze: Gate after TRACE. All require user confirmation. |
|
|
293
|
+
| **Gate agents** | Plan-Checker, Reviewer, Auditor -- PASS/FAIL + gap list only. No suggestions, no decisions. |
|
|
294
|
+
| **Formatter agents** | Plan-Writer, Compose-Reporter, Debug-Reporter, Analyze-Reporter -- stateless. Missing input = TBD/NA. Never invent content. |
|
|
295
|
+
| **Fact-finding agents** | Researcher, Inspector, Tracer -- facts/inferences/risks only. No recommendations. |
|
|
296
|
+
| **Build gate order** | Coder -> Tester -> Reviewer -> Compose-Reporter. No skipping. No Coder->Coder without verification. |
|
|
297
|
+
| **FAIL loops** | Plan-Checker FAIL: max 5 loops. Build FAIL (Tester/Reviewer): max 5 loops. Analyze AUDIT FAIL: max 5 loops. All surface to you after limit. |
|
|
298
|
+
| **Output directories** | PRDs -> `docs/plans/`. Reports (Compose-Reporter, Debug-Reporter, Analyze-Reporter) -> `docs/reports/`. Enforced by permissions. |
|
|
299
|
+
| **Independence** | Debug and Analyze are fully standalone -- triggered directly, do not flow through Compose. |
|
|
300
|
+
|
|
301
|
+
---
|
|
302
|
+
|
|
303
|
+
## Brooks-Lint Methodology (Debug)
|
|
304
|
+
|
|
305
|
+
The Debug pipeline uses the [Brooks-Lint](https://hyhmrright.github.io/brooks-lint/guide.html) framework:
|
|
306
|
+
|
|
307
|
+
- **Iron Law** per finding: Symptom -> Source -> Consequence -> Remedy
|
|
308
|
+
- **6 Decay Risks (R1-R6)**: Cognitive Overload, Change Propagation, Knowledge Duplication, Accidental Complexity, Dependency Disorder, Domain Model Distortion
|
|
309
|
+
- **4 Review Modes**: PR Review (R1-R6), Architecture Audit, Tech Debt Assessment (Pain x Spread), Test Quality (T1-T6)
|
|
310
|
+
- **T1-T6 Test Risks**: Test Obscurity, Brittleness, Duplication, Mock Abuse, Coverage Illusion, Architecture Mismatch
|
|
311
|
+
|
|
312
|
+
## Principle Hierarchy
|
|
313
|
+
|
|
314
|
+
All agents resolve conflicts using this priority order (defined in `hierarchy.txt`):
|
|
315
|
+
|
|
316
|
+
1. **PRD / Spec** -- explicit requirement text
|
|
317
|
+
2. **Verdict** -- Reviewer / Plan-Checker / Auditor PASS/FAIL
|
|
318
|
+
3. **Engineering principles** -- Fail Fast, Single Responsibility
|
|
319
|
+
4. **Heuristics** -- KISS, DRY, SOLID, Law of Demeter
|
|
320
|
+
5. **Local optimization** -- style preference
|
|
321
|
+
|
|
322
|
+
---
|
|
323
|
+
|
|
324
|
+
## Install
|
|
325
|
+
|
|
326
|
+
```sh
|
|
327
|
+
npm install -g wevr
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
## Usage
|
|
331
|
+
|
|
332
|
+
### `wevr`
|
|
333
|
+
|
|
334
|
+
The everyday command. Runs three steps in sequence:
|
|
335
|
+
|
|
336
|
+
1. **Update check** -- compares local version against npm registry; prompts to `npm install -g wevr` if a new version is available
|
|
337
|
+
2. **Doctor check** -- verifies installation health; prompts to repair with `wevr init` if any checks fail
|
|
338
|
+
3. **Launch** -- spawns `opencode`
|
|
339
|
+
|
|
340
|
+
### `wevr init`
|
|
341
|
+
|
|
342
|
+
Prompts you to select models for three agent tiers (reasoning, precision, and fast), then:
|
|
343
|
+
|
|
344
|
+
- Builds a complete `opencode.jsonc` config with the chosen models injected into the right agents
|
|
345
|
+
- Backs up any existing config to `opencode.jsonc.bak.*`
|
|
346
|
+
- Writes the new config to `~/.config/opencode/opencode.jsonc`
|
|
347
|
+
- Copies all 8 agent prompt files into `~/.config/opencode/prompts/`
|
|
348
|
+
- Copies `wevr-flow` and `wevr-squeeze` plugins into `~/.config/opencode/plugins/`
|
|
349
|
+
- Writes a `package.json` declaring `@opencode-ai/plugin` as a dependency
|
|
350
|
+
|
|
351
|
+
### `wevr doctor`
|
|
352
|
+
|
|
353
|
+
Checks installation health and reports pass/fail for each component:
|
|
354
|
+
|
|
355
|
+
- `opencode.jsonc` exists
|
|
356
|
+
- All 8 prompt files present
|
|
357
|
+
- Both plugin files present
|
|
358
|
+
- Theme configured
|
|
359
|
+
- `package.json` with `@opencode-ai/plugin` dependency
|
|
360
|
+
- Config is valid JSON
|
|
361
|
+
|
|
362
|
+
Exits with code `0` if all pass, `1` if any fail.
|
|
363
|
+
|
|
364
|
+
### `wevr update`
|
|
365
|
+
|
|
366
|
+
Checks the npm registry for a newer version of wevr and prompts to automatically install the upgrade globally. If an update is successfully completed, the running CLI process exits to let you start fresh on the new version.
|
|
367
|
+
|
|
368
|
+
### `wevr uninstall`
|
|
369
|
+
|
|
370
|
+
Restores your previous configuration:
|
|
371
|
+
|
|
372
|
+
- Finds the latest timestamped backup and restores it to `opencode.jsonc`
|
|
373
|
+
- Restores `tui.json` from the latest backup (returning the TUI theme to its pre-Wevr state)
|
|
374
|
+
- Removes `prompts/`, `plugins/`, `bin/`, and `themes/wevr-contrast.json` directories and files
|
|
375
|
+
- Preserves `opencode.jsonc` and `package.json`
|
|
376
|
+
|
|
377
|
+
---
|
|
378
|
+
|
|
379
|
+
## Bundled Package
|
|
380
|
+
|
|
381
|
+
### `wevr-flow`
|
|
382
|
+
|
|
383
|
+
Provides subagents with cross-session context access:
|
|
384
|
+
|
|
385
|
+
- `parent_session_messages` -- read the parent session's transcript
|
|
386
|
+
- `session_messages(sessionId)` -- read any session by ID
|
|
387
|
+
- `session_messages_batch(sessionIds)` -- read multiple sessions in one call
|
|
388
|
+
|
|
389
|
+
### `wevr-squeeze`
|
|
390
|
+
|
|
391
|
+
Monitors context fill limits and session health, calculates ResourceHealth and SessionEfficiency metrics, alerts on loop/retry patterns, and enables seamless session continuity/restores for same-project tasks.
|
|
392
|
+
|
|
393
|
+
Both plugins and their dependency declaration are installed automatically by `wevr init` -- no extra user action required. On OpenCode's first launch, the bundled Bun runtime installs `@opencode-ai/plugin` from the generated `package.json`.
|
|
394
|
+
|
|
395
|
+
### Themes & Colors
|
|
396
|
+
|
|
397
|
+
Wevr comes with a pre-configured OLED high-contrast dark theme called **`wevr-contrast`** that is automatically applied to your OpenCode terminal interface.
|
package/bin/wevr.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@funara/wevr",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"publishConfig": {
|
|
5
|
+
"access": "public"
|
|
6
|
+
},
|
|
7
|
+
"description": "Opinionated Engineering Workflow for OpenCode — Plan, Build, Review.",
|
|
8
|
+
"keywords": [
|
|
9
|
+
"opencode",
|
|
10
|
+
"workflow",
|
|
11
|
+
"engineering",
|
|
12
|
+
"pipeline",
|
|
13
|
+
"ai-agents",
|
|
14
|
+
"code-review",
|
|
15
|
+
"debugging",
|
|
16
|
+
"security-audit",
|
|
17
|
+
"security",
|
|
18
|
+
"planner",
|
|
19
|
+
"builder",
|
|
20
|
+
"cli"
|
|
21
|
+
],
|
|
22
|
+
"license": "MIT",
|
|
23
|
+
"type": "module",
|
|
24
|
+
"scripts": {
|
|
25
|
+
"test": "node --test"
|
|
26
|
+
},
|
|
27
|
+
"bin": {
|
|
28
|
+
"wevr": "bin/wevr.js"
|
|
29
|
+
},
|
|
30
|
+
"repository": {
|
|
31
|
+
"type": "git",
|
|
32
|
+
"url": "git+https://github.com/funara/wevr.git"
|
|
33
|
+
},
|
|
34
|
+
"homepage": "https://github.com/funara/wevr#readme",
|
|
35
|
+
"bugs": {
|
|
36
|
+
"url": "https://github.com/funara/wevr/issues"
|
|
37
|
+
},
|
|
38
|
+
"engines": {
|
|
39
|
+
"node": ">=18"
|
|
40
|
+
},
|
|
41
|
+
"files": [
|
|
42
|
+
"bin",
|
|
43
|
+
"src"
|
|
44
|
+
],
|
|
45
|
+
"dependencies": {
|
|
46
|
+
"@clack/prompts": "^0.9"
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { existsSync, readFileSync, readdirSync } from "node:fs"
|
|
2
|
+
import { join } from "node:path"
|
|
3
|
+
import { getConfigDir, getConfigPath, getPromptsDir, getThemesDir, getTuiConfigPath, getCommandsDir } from "../../core/paths.js"
|
|
4
|
+
|
|
5
|
+
const EXPECTED_PROMPT_COUNT = 8
|
|
6
|
+
const PLUGIN_FILES = ["wevr-flow.js", "wevr-squeeze.js"]
|
|
7
|
+
const EXPECTED_COMMAND_FILES = ["squeeze-quick.md", "squeeze-health.md", "squeeze-dashboard.md"]
|
|
8
|
+
|
|
9
|
+
export function cleanJsonc(content) {
|
|
10
|
+
return content.replace(
|
|
11
|
+
/\\"|"(?:\\"|[^"])*"|(\/\/.*|\/\*[\s\S]*?\*\/)|(,\s*(?=[\]}]))/g,
|
|
12
|
+
(m, g1, g2) => g1 ? "" : g2 ? "" : m
|
|
13
|
+
)
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function collectChecks() {
|
|
17
|
+
const configDir = getConfigDir()
|
|
18
|
+
const configPath = getConfigPath()
|
|
19
|
+
const promptsDir = getPromptsDir()
|
|
20
|
+
const pluginsDir = join(configDir, "plugins")
|
|
21
|
+
const packageJsonPath = join(configDir, "package.json")
|
|
22
|
+
const binDir = join(configDir, "bin")
|
|
23
|
+
const themesDir = getThemesDir()
|
|
24
|
+
|
|
25
|
+
const checks = []
|
|
26
|
+
|
|
27
|
+
// 1. opencode.jsonc exists
|
|
28
|
+
const configExists = existsSync(configPath)
|
|
29
|
+
checks.push({ component: "opencode.jsonc", pass: configExists })
|
|
30
|
+
|
|
31
|
+
// 2. All 8 prompt files exist
|
|
32
|
+
let promptCount = 0
|
|
33
|
+
if (existsSync(promptsDir)) {
|
|
34
|
+
try {
|
|
35
|
+
const files = readdirSync(promptsDir).filter((f) => f.endsWith(".txt"))
|
|
36
|
+
promptCount = files.length
|
|
37
|
+
} catch {
|
|
38
|
+
promptCount = 0
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
checks.push({ component: "8 prompt files", pass: promptCount === EXPECTED_PROMPT_COUNT, detail: `${promptCount}/${EXPECTED_PROMPT_COUNT}` })
|
|
42
|
+
|
|
43
|
+
// 3. Both plugin files exist
|
|
44
|
+
let pluginsFound = 0
|
|
45
|
+
for (const f of PLUGIN_FILES) {
|
|
46
|
+
if (existsSync(join(pluginsDir, f))) pluginsFound++
|
|
47
|
+
}
|
|
48
|
+
checks.push({ component: "plugin files", pass: pluginsFound === PLUGIN_FILES.length, detail: `${pluginsFound}/${PLUGIN_FILES.length}` })
|
|
49
|
+
|
|
50
|
+
// 3a. Slash command files exist
|
|
51
|
+
let commandsFound = 0
|
|
52
|
+
const commandsDir = getCommandsDir()
|
|
53
|
+
for (const f of EXPECTED_COMMAND_FILES) {
|
|
54
|
+
if (existsSync(join(commandsDir, f))) commandsFound++
|
|
55
|
+
}
|
|
56
|
+
checks.push({ component: "slash command files", pass: commandsFound === EXPECTED_COMMAND_FILES.length, detail: `${commandsFound}/${EXPECTED_COMMAND_FILES.length}` })
|
|
57
|
+
|
|
58
|
+
// 3b. Theme configuration verification (accepts any valid wevr theme)
|
|
59
|
+
const ALLOWED_THEMES = new Set(["wevr-dark", "wevr-light", "wevr-colorful"])
|
|
60
|
+
const tuiConfigPath = getTuiConfigPath()
|
|
61
|
+
let activeTheme = "wevr-dark" // default fallback
|
|
62
|
+
let tuiConfigValid = false
|
|
63
|
+
let tuiDetail = "missing mapping"
|
|
64
|
+
|
|
65
|
+
if (existsSync(tuiConfigPath)) {
|
|
66
|
+
try {
|
|
67
|
+
const content = readFileSync(tuiConfigPath, "utf-8")
|
|
68
|
+
const parsed = JSON.parse(content)
|
|
69
|
+
if (parsed.theme && ALLOWED_THEMES.has(parsed.theme)) {
|
|
70
|
+
activeTheme = parsed.theme
|
|
71
|
+
tuiConfigValid = true
|
|
72
|
+
tuiDetail = ""
|
|
73
|
+
} else {
|
|
74
|
+
tuiDetail = `theme: ${parsed.theme || "none"}`
|
|
75
|
+
}
|
|
76
|
+
} catch {
|
|
77
|
+
tuiDetail = "corrupted tui.json"
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const themeExists = existsSync(join(themesDir, `${activeTheme}.json`))
|
|
82
|
+
checks.push({
|
|
83
|
+
component: themeExists && tuiConfigValid ? `${activeTheme} theme configured` : "theme not configured",
|
|
84
|
+
pass: themeExists && tuiConfigValid,
|
|
85
|
+
detail: !themeExists ? `missing theme file ${activeTheme}.json` : tuiDetail
|
|
86
|
+
})
|
|
87
|
+
|
|
88
|
+
// 4. package.json with @opencode-ai/plugin dependency
|
|
89
|
+
let pkgValid = false
|
|
90
|
+
if (existsSync(packageJsonPath)) {
|
|
91
|
+
try {
|
|
92
|
+
const pkg = JSON.parse(readFileSync(packageJsonPath, "utf-8"))
|
|
93
|
+
pkgValid = !!(pkg.dependencies && pkg.dependencies["@opencode-ai/plugin"])
|
|
94
|
+
} catch {
|
|
95
|
+
pkgValid = false
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
checks.push({ component: "package.json + plugin dep", pass: pkgValid })
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
// 6. Config is valid JSON/JSONC
|
|
102
|
+
let configValid = false
|
|
103
|
+
if (configExists) {
|
|
104
|
+
try {
|
|
105
|
+
const content = readFileSync(configPath, "utf-8")
|
|
106
|
+
const cleaned = cleanJsonc(content)
|
|
107
|
+
JSON.parse(cleaned)
|
|
108
|
+
configValid = true
|
|
109
|
+
} catch {
|
|
110
|
+
configValid = false
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
checks.push({ component: "config JSON validity", pass: configValid })
|
|
114
|
+
|
|
115
|
+
return checks
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export async function runDoctor() {
|
|
119
|
+
const checks = collectChecks()
|
|
120
|
+
const allPass = checks.every((c) => c.pass)
|
|
121
|
+
|
|
122
|
+
console.log("\nWevr Doctor — Installation Health Check\n")
|
|
123
|
+
for (const c of checks) {
|
|
124
|
+
const icon = c.pass ? "\u2713" : "\u2717"
|
|
125
|
+
const detail = c.detail ? ` (${c.detail})` : ""
|
|
126
|
+
console.log(` ${icon} ${c.component}${detail}`)
|
|
127
|
+
}
|
|
128
|
+
console.log("")
|
|
129
|
+
|
|
130
|
+
if (allPass) {
|
|
131
|
+
console.log("All checks passed.")
|
|
132
|
+
} else {
|
|
133
|
+
console.log("Some checks failed. Re-run `wevr init` to repair.")
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
process.exit(allPass ? 0 : 1)
|
|
137
|
+
}
|