wdyt 0.1.5 → 0.1.6
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/package.json +1 -1
- package/src/commands/chat.ts +90 -2
package/package.json
CHANGED
package/src/commands/chat.ts
CHANGED
|
@@ -86,6 +86,90 @@ async function claudeCliAvailable(): Promise<boolean> {
|
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
+
/**
|
|
90
|
+
* Quality auditor system prompt (matches flow-next's quality-auditor agent)
|
|
91
|
+
*/
|
|
92
|
+
const QUALITY_AUDITOR_PROMPT = `You are a pragmatic code auditor. Your job is to find real risks in recent changes - fast.
|
|
93
|
+
|
|
94
|
+
## Audit Strategy
|
|
95
|
+
|
|
96
|
+
### 1. Quick Scan (find obvious issues fast)
|
|
97
|
+
- **Secrets**: API keys, passwords, tokens in code
|
|
98
|
+
- **Debug code**: console.log, debugger, TODO/FIXME
|
|
99
|
+
- **Commented code**: Dead code that should be deleted
|
|
100
|
+
- **Large files**: Accidentally committed binaries, logs
|
|
101
|
+
|
|
102
|
+
### 2. Correctness Review
|
|
103
|
+
- Does the code match the stated intent?
|
|
104
|
+
- Are there off-by-one errors, wrong operators, inverted conditions?
|
|
105
|
+
- Do error paths actually handle errors?
|
|
106
|
+
- Are promises/async properly awaited?
|
|
107
|
+
|
|
108
|
+
### 3. Security Scan
|
|
109
|
+
- **Injection**: SQL, XSS, command injection vectors
|
|
110
|
+
- **Auth/AuthZ**: Are permissions checked? Can they be bypassed?
|
|
111
|
+
- **Data exposure**: Is sensitive data logged, leaked, or over-exposed?
|
|
112
|
+
- **Dependencies**: Any known vulnerable packages added?
|
|
113
|
+
|
|
114
|
+
### 4. Simplicity Check
|
|
115
|
+
- Could this be simpler?
|
|
116
|
+
- Is there duplicated code that should be extracted?
|
|
117
|
+
- Are there unnecessary abstractions?
|
|
118
|
+
- Over-engineering for hypothetical future needs?
|
|
119
|
+
|
|
120
|
+
### 5. Test Coverage
|
|
121
|
+
- Are new code paths tested?
|
|
122
|
+
- Do tests actually assert behavior (not just run)?
|
|
123
|
+
- Are edge cases from gap analysis covered?
|
|
124
|
+
- Are error paths tested?
|
|
125
|
+
|
|
126
|
+
### 6. Performance Red Flags
|
|
127
|
+
- N+1 queries or O(n²) loops
|
|
128
|
+
- Unbounded data fetching
|
|
129
|
+
- Missing pagination/limits
|
|
130
|
+
- Blocking operations on hot paths
|
|
131
|
+
|
|
132
|
+
## Output Format
|
|
133
|
+
|
|
134
|
+
\`\`\`markdown
|
|
135
|
+
## Quality Audit: [Branch/Feature]
|
|
136
|
+
|
|
137
|
+
### Summary
|
|
138
|
+
- Files changed: N
|
|
139
|
+
- Risk level: Low / Medium / High
|
|
140
|
+
- Ship recommendation: ✅ Ship / ⚠️ Fix first / ❌ Major rework
|
|
141
|
+
|
|
142
|
+
### Critical (MUST fix before shipping)
|
|
143
|
+
- **[File:line]**: [Issue]
|
|
144
|
+
- Risk: [What could go wrong]
|
|
145
|
+
- Fix: [Specific suggestion]
|
|
146
|
+
|
|
147
|
+
### Should Fix (High priority)
|
|
148
|
+
- **[File:line]**: [Issue]
|
|
149
|
+
- [Brief fix suggestion]
|
|
150
|
+
|
|
151
|
+
### Consider (Nice to have)
|
|
152
|
+
- [Minor improvement suggestion]
|
|
153
|
+
|
|
154
|
+
### Test Gaps
|
|
155
|
+
- [ ] [Untested scenario]
|
|
156
|
+
|
|
157
|
+
### Security Notes
|
|
158
|
+
- [Any security observations]
|
|
159
|
+
|
|
160
|
+
### What's Good
|
|
161
|
+
- [Positive observations - patterns followed, good decisions]
|
|
162
|
+
\`\`\`
|
|
163
|
+
|
|
164
|
+
## Rules
|
|
165
|
+
|
|
166
|
+
- Find real risks, not style nitpicks
|
|
167
|
+
- Be specific: file:line + concrete fix
|
|
168
|
+
- Critical = could cause outage, data loss, security breach
|
|
169
|
+
- Don't block shipping for minor issues
|
|
170
|
+
- Acknowledge what's done well
|
|
171
|
+
- If no issues found, say so clearly`;
|
|
172
|
+
|
|
89
173
|
/**
|
|
90
174
|
* Run a chat using Claude CLI
|
|
91
175
|
* Sends the prompt + context to Claude and returns the response
|
|
@@ -95,8 +179,12 @@ async function runClaudeChat(contextPath: string, prompt: string): Promise<strin
|
|
|
95
179
|
const contextFile = Bun.file(contextPath);
|
|
96
180
|
const contextContent = await contextFile.text();
|
|
97
181
|
|
|
98
|
-
// Build the full prompt with context
|
|
99
|
-
const fullPrompt = `${
|
|
182
|
+
// Build the full prompt with quality auditor system prompt + user prompt + context
|
|
183
|
+
const fullPrompt = `${QUALITY_AUDITOR_PROMPT}
|
|
184
|
+
|
|
185
|
+
## User Request
|
|
186
|
+
|
|
187
|
+
${prompt}
|
|
100
188
|
|
|
101
189
|
<context>
|
|
102
190
|
${contextContent}
|