@tudeorangbiasa/sdd-multiagent-opencode 0.2.2 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.opencode/commands/sdd-construct.md +693 -0
- package/.opencode/commands/sdd-quick.md +136 -105
- package/.opencode/plugins/sdd-register.js +869 -3
- package/.sdd/templates/model-profile-template.json +4 -2
- package/.sdd/templates/reasoning-profile-template.json +4 -2
- package/GUIDE.md +141 -4
- package/README.md +100 -33
- package/bin/sdd-opencode.js +476 -164
- package/bin/sdd-quick.js +607 -0
- package/opencode.json +1 -2
- package/package.json +7 -4
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
---
|
|
2
|
-
description: Quick one-shot fix for cosmetic/config changes with
|
|
2
|
+
description: Quick one-shot fix for cosmetic/config changes with CLI wrapper for deterministic checks
|
|
3
3
|
agent: sdd-implementer
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
Execute a small, safe change with minimal overhead.
|
|
6
|
+
Execute a small, safe change with minimal overhead. Uses CLI wrapper for Phase 1-2 (classification, pre-flight) and Phase 4-5 (verification, ledger). LLM is only used for Phase 3 (the actual edit).
|
|
7
7
|
|
|
8
8
|
## Usage
|
|
9
9
|
|
|
@@ -12,138 +12,169 @@ Execute a small, safe change with minimal overhead. No full spec artifacts requi
|
|
|
12
12
|
/sdd-quick "rename isLoading to isFetching in auth.ts"
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
-
##
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
-
|
|
41
|
-
-
|
|
42
|
-
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
15
|
+
## Architecture: Hybrid CLI + LLM
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
CLI (0 tokens) → Phase 1a: Keyword scan → PASS/FAIL
|
|
19
|
+
↓ (if ambiguous)
|
|
20
|
+
LLM (~50 tokens) → Phase 1b: Context-aware classification
|
|
21
|
+
↓
|
|
22
|
+
CLI (0 tokens) → Phase 2: Pre-flight (lock, grep, string delta)
|
|
23
|
+
↓
|
|
24
|
+
LLM (~150 tokens) → Phase 3: Edit (full file return for < 500 lines)
|
|
25
|
+
↓
|
|
26
|
+
CLI (0 tokens) → Phase 4: Post-flight (actual diff, lint, typecheck, auto-revert)
|
|
27
|
+
↓
|
|
28
|
+
CLI (0 tokens) → Phase 5: Atomic ledger append
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Total token cost: ~200 tokens (vs ~1000 for all-LLM approach).
|
|
32
|
+
|
|
33
|
+
## Phase 1: Classification
|
|
34
|
+
|
|
35
|
+
### Step 1a: CLI Keyword Scan (0 tokens)
|
|
36
|
+
|
|
37
|
+
Run: `sdd-quick classify "<request>"`
|
|
38
|
+
|
|
39
|
+
The CLI checks for:
|
|
40
|
+
- Operators: `>`, `<`, `>=`, `<=`, `==`, `===`, `!=`, `!==`, `&&`, `||`, `!`, `?:`
|
|
41
|
+
- Control flow keywords: `if`, `else`, `switch`, `case`, `for`, `while`, `return`, `throw`, `try`, `catch`, `finally`
|
|
42
|
+
- Contract path patterns: `**/api/**`, `**/dto/**`, `**/schema/**`, `**/types/public-api.ts`
|
|
43
|
+
|
|
44
|
+
**If CLI detects blocking keywords → FAIL immediately.** Output:
|
|
45
|
+
```
|
|
46
|
+
aborted: Quick fix rejected — <slug>
|
|
47
|
+
reason: Request contains <operator/keyword> which indicates a logic change.
|
|
48
|
+
suggestion: Run `/sdd-propose "<request>"` for full workflow.
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
**If CLI detects no blocking keywords → proceed to Step 1b only if a file path was provided and the file exists.**
|
|
52
|
+
|
|
53
|
+
### Step 1b: Context-Aware Classification (~50 tokens, only if needed)
|
|
54
|
+
|
|
55
|
+
If the CLI found ambiguous keywords but a file path was provided, run:
|
|
56
|
+
```
|
|
57
|
+
sdd-quick classify "<request>" <file-path>
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
The CLI returns a prompt. Send this prompt to the LLM and get back a classification result.
|
|
61
|
+
|
|
62
|
+
**If LLM says `{"safe": false}` → FAIL.** Report reason and suggest `/sdd-propose`.
|
|
63
|
+
**If LLM says `{"safe": true}` → proceed to Phase 2.**
|
|
64
|
+
|
|
65
|
+
## Phase 2: Pre-Flight Checks (CLI, 0 tokens)
|
|
66
|
+
|
|
67
|
+
Run: `sdd-quick preflight "<request>" [file-path] [old-string] [new-string]`
|
|
68
|
+
|
|
69
|
+
The CLI checks:
|
|
70
|
+
1. **Lock file**: Is another SDD process active? If yes → FAIL.
|
|
71
|
+
2. **Cross-file scan**: How many files reference the pattern? If > 5 → WARN (show user, ask confirmation).
|
|
72
|
+
3. **String length delta**: If old/new strings provided, check delta > 20 chars or > 50% increase → WARN (UI layout risk).
|
|
73
|
+
|
|
74
|
+
**If preflight FAILS → abort.**
|
|
75
|
+
**If preflight PASSES → proceed to Phase 3.**
|
|
76
|
+
**If preflight WARNS → show user, ask "Proceed? (yes/no)".**
|
|
77
|
+
|
|
78
|
+
Before proceeding, acquire lock:
|
|
79
|
+
```
|
|
80
|
+
sdd-quick lock acquire "sdd-quick" "<slug>"
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## Phase 3: Edit (LLM, ~150 tokens)
|
|
84
|
+
|
|
85
|
+
### Step 3a: Generate Edit Prompt
|
|
86
|
+
|
|
87
|
+
Run: `sdd-quick edit-prompt "<request>" <file-path>`
|
|
88
|
+
|
|
89
|
+
The CLI reads the file and generates an optimized prompt:
|
|
90
|
+
- If file < 500 lines → "Return the ENTIRE file content with the change applied."
|
|
91
|
+
- If file >= 500 lines → "Use search-replace blocks: <<<SEARCH ... >>> <<<REPLACE ... >>>"
|
|
92
|
+
|
|
93
|
+
### Step 3b: Apply Edit
|
|
94
|
+
|
|
95
|
+
1. **Backup the file**: Copy to `<file>.sdd-quick-backup`
|
|
96
|
+
2. **Send the prompt to LLM** and get the response.
|
|
97
|
+
3. **Write the response** to the target file.
|
|
98
|
+
- For full-file return: write directly.
|
|
99
|
+
- For search-replace blocks: parse and apply each block.
|
|
100
|
+
4. **If write fails** (parse error, etc.) → restore from backup, FAIL.
|
|
101
|
+
|
|
102
|
+
## Phase 4: Post-Flight Verification (CLI, 0 tokens)
|
|
103
|
+
|
|
104
|
+
### Step 4a: Verify Actual Changes
|
|
105
|
+
|
|
106
|
+
Run: `sdd-quick postflight <backup-path> <target-path>`
|
|
107
|
+
|
|
108
|
+
The CLI checks:
|
|
109
|
+
- Was the file actually changed? If no → FAIL (nothing to commit).
|
|
110
|
+
- Did the LLM add extra lines beyond the request? If > 3 extra lines → AUTO-REVERT, FAIL.
|
|
111
|
+
|
|
112
|
+
### Step 4b: Run Lint and Typecheck
|
|
113
|
+
|
|
114
|
+
Run: `sdd-quick lint`
|
|
115
|
+
Run: `sdd-quick typecheck`
|
|
116
|
+
|
|
117
|
+
**Decision table:**
|
|
118
|
+
|
|
91
119
|
| Result | Action |
|
|
92
120
|
|--------|--------|
|
|
93
|
-
| Both pass |
|
|
94
|
-
| Lint fails |
|
|
95
|
-
| Typecheck fails |
|
|
96
|
-
|
|
|
97
|
-
|
|
98
|
-
If the project has NO lint or typecheck script → ❌ Reject, suggest `/sdd-propose` (project lacks safety net for quick changes).
|
|
121
|
+
| Both pass | Continue to Phase 5 |
|
|
122
|
+
| Lint fails | Auto-revert from backup, FAIL |
|
|
123
|
+
| Typecheck fails | Auto-revert from backup, FAIL |
|
|
124
|
+
| Neither available | WARN (project lacks safety net), continue |
|
|
99
125
|
|
|
100
|
-
|
|
126
|
+
### Step 4c: Cleanup
|
|
101
127
|
|
|
102
|
-
|
|
128
|
+
- Remove backup file.
|
|
129
|
+
- Release lock: `sdd-quick lock release`
|
|
103
130
|
|
|
104
|
-
|
|
131
|
+
## Phase 5: Ledger Append (CLI, 0 tokens)
|
|
105
132
|
|
|
106
|
-
|
|
133
|
+
Run: `sdd-quick ledger append "<entry>"`
|
|
107
134
|
|
|
135
|
+
Entry format:
|
|
108
136
|
```markdown
|
|
109
137
|
## YYYY-MM-DD HH:MM — <kebab-case-slug>
|
|
110
138
|
|
|
111
139
|
- **Trigger:** `/sdd-quick "<original request>"`
|
|
112
140
|
- **Files:** `<file-path>` (L<line>, L<line>)
|
|
113
141
|
- **Type:** Cosmetic | Config
|
|
114
|
-
- **Verification:**
|
|
115
|
-
- **Cross-file refs:** <count> files affected
|
|
142
|
+
- **Verification:** lint passed, typecheck passed
|
|
143
|
+
- **Cross-file refs:** <count> files affected
|
|
116
144
|
- **Status:** ✅ Applied | ❌ Reverted (reason)
|
|
117
145
|
```
|
|
118
146
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
147
|
+
The CLI handles atomic write (via temp file + rename) and automatic archiving if ledger exceeds 50 entries.
|
|
148
|
+
|
|
149
|
+
## Execution Mode: Silent
|
|
150
|
+
|
|
151
|
+
Do NOT report intermediate steps. Do NOT narrate your process.
|
|
152
|
+
All Phase 1-4 checks must be performed silently via CLI calls.
|
|
153
|
+
|
|
154
|
+
Output ONLY the final result in the format below.
|
|
155
|
+
No chain of thought. No step-by-step. No "I'm now checking X".
|
|
125
156
|
|
|
126
|
-
|
|
127
|
-
If
|
|
128
|
-
- Move the oldest 25 entries to `specs/QUICKFIX_LOG_ARCHIVE.md`
|
|
129
|
-
- Keep only the most recent 25 entries in the main ledger
|
|
157
|
+
If a gate fails → output ONLY the abort message.
|
|
158
|
+
If all gates pass → output ONLY the success message.
|
|
130
159
|
|
|
131
160
|
## Anti-Generic Gate
|
|
132
161
|
|
|
133
162
|
Before final output, verify:
|
|
134
163
|
|
|
135
|
-
- [ ]
|
|
164
|
+
- [ ] Classification was done via CLI (not AI judgment).
|
|
136
165
|
- [ ] Lock file was checked and cleaned up.
|
|
137
|
-
- [ ]
|
|
138
|
-
- [ ]
|
|
139
|
-
- [ ]
|
|
166
|
+
- [ ] Pre-flight checks passed (or user confirmed warnings).
|
|
167
|
+
- [ ] Edit was applied and post-flight verification passed.
|
|
168
|
+
- [ ] Lint and typecheck were run (or project lacks them).
|
|
169
|
+
- [ ] Ledger was updated atomically via CLI.
|
|
140
170
|
- [ ] No logic, contract, or new files were touched.
|
|
171
|
+
- [ ] No extra lines were added beyond the requested change.
|
|
141
172
|
|
|
142
173
|
If any item fails, report the failure and do not claim success.
|
|
143
174
|
|
|
144
175
|
## Output
|
|
145
176
|
|
|
146
|
-
|
|
177
|
+
If successful:
|
|
147
178
|
|
|
148
179
|
```markdown
|
|
149
180
|
changed: Quick fix applied — <slug>
|