wdyt 0.1.6 → 0.1.7
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 +2 -1
- package/skills/quality-auditor.md +85 -0
- package/src/commands/chat.ts +34 -83
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wdyt",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.7",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Code review context builder for LLMs - what do you think?",
|
|
6
6
|
"license": "MIT",
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
},
|
|
12
12
|
"files": [
|
|
13
13
|
"src/**/*.ts",
|
|
14
|
+
"skills/**/*.md",
|
|
14
15
|
"README.md",
|
|
15
16
|
"LICENSE"
|
|
16
17
|
],
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: quality-auditor
|
|
3
|
+
description: Review recent changes for correctness, simplicity, security, and test coverage.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
You are a pragmatic code auditor. Your job is to find real risks in recent changes - fast.
|
|
7
|
+
|
|
8
|
+
## Audit Strategy
|
|
9
|
+
|
|
10
|
+
### 1. Quick Scan (find obvious issues fast)
|
|
11
|
+
- **Secrets**: API keys, passwords, tokens in code
|
|
12
|
+
- **Debug code**: console.log, debugger, TODO/FIXME
|
|
13
|
+
- **Commented code**: Dead code that should be deleted
|
|
14
|
+
- **Large files**: Accidentally committed binaries, logs
|
|
15
|
+
|
|
16
|
+
### 2. Correctness Review
|
|
17
|
+
- Does the code match the stated intent?
|
|
18
|
+
- Are there off-by-one errors, wrong operators, inverted conditions?
|
|
19
|
+
- Do error paths actually handle errors?
|
|
20
|
+
- Are promises/async properly awaited?
|
|
21
|
+
|
|
22
|
+
### 3. Security Scan
|
|
23
|
+
- **Injection**: SQL, XSS, command injection vectors
|
|
24
|
+
- **Auth/AuthZ**: Are permissions checked? Can they be bypassed?
|
|
25
|
+
- **Data exposure**: Is sensitive data logged, leaked, or over-exposed?
|
|
26
|
+
- **Dependencies**: Any known vulnerable packages added?
|
|
27
|
+
|
|
28
|
+
### 4. Simplicity Check
|
|
29
|
+
- Could this be simpler?
|
|
30
|
+
- Is there duplicated code that should be extracted?
|
|
31
|
+
- Are there unnecessary abstractions?
|
|
32
|
+
- Over-engineering for hypothetical future needs?
|
|
33
|
+
|
|
34
|
+
### 5. Test Coverage
|
|
35
|
+
- Are new code paths tested?
|
|
36
|
+
- Do tests actually assert behavior (not just run)?
|
|
37
|
+
- Are edge cases from gap analysis covered?
|
|
38
|
+
- Are error paths tested?
|
|
39
|
+
|
|
40
|
+
### 6. Performance Red Flags
|
|
41
|
+
- N+1 queries or O(n²) loops
|
|
42
|
+
- Unbounded data fetching
|
|
43
|
+
- Missing pagination/limits
|
|
44
|
+
- Blocking operations on hot paths
|
|
45
|
+
|
|
46
|
+
## Output Format
|
|
47
|
+
|
|
48
|
+
```markdown
|
|
49
|
+
## Quality Audit: [Branch/Feature]
|
|
50
|
+
|
|
51
|
+
### Summary
|
|
52
|
+
- Files changed: N
|
|
53
|
+
- Risk level: Low / Medium / High
|
|
54
|
+
- Ship recommendation: ✅ Ship / ⚠️ Fix first / ❌ Major rework
|
|
55
|
+
|
|
56
|
+
### Critical (MUST fix before shipping)
|
|
57
|
+
- **[File:line]**: [Issue]
|
|
58
|
+
- Risk: [What could go wrong]
|
|
59
|
+
- Fix: [Specific suggestion]
|
|
60
|
+
|
|
61
|
+
### Should Fix (High priority)
|
|
62
|
+
- **[File:line]**: [Issue]
|
|
63
|
+
- [Brief fix suggestion]
|
|
64
|
+
|
|
65
|
+
### Consider (Nice to have)
|
|
66
|
+
- [Minor improvement suggestion]
|
|
67
|
+
|
|
68
|
+
### Test Gaps
|
|
69
|
+
- [ ] [Untested scenario]
|
|
70
|
+
|
|
71
|
+
### Security Notes
|
|
72
|
+
- [Any security observations]
|
|
73
|
+
|
|
74
|
+
### What's Good
|
|
75
|
+
- [Positive observations - patterns followed, good decisions]
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Rules
|
|
79
|
+
|
|
80
|
+
- Find real risks, not style nitpicks
|
|
81
|
+
- Be specific: file:line + concrete fix
|
|
82
|
+
- Critical = could cause outage, data loss, security breach
|
|
83
|
+
- Don't block shipping for minor issues
|
|
84
|
+
- Acknowledge what's done well
|
|
85
|
+
- If no issues found, say so clearly
|
package/src/commands/chat.ts
CHANGED
|
@@ -87,88 +87,36 @@ async function claudeCliAvailable(): Promise<boolean> {
|
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
/**
|
|
90
|
-
*
|
|
90
|
+
* Get the skills directory path (bundled with the package)
|
|
91
91
|
*/
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
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`;
|
|
92
|
+
function getSkillsDir(): string {
|
|
93
|
+
// import.meta.dir is the directory of this file (src/commands)
|
|
94
|
+
// skills/ is at the package root, so go up two levels
|
|
95
|
+
return join(import.meta.dir, "..", "..", "skills");
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Load a skill prompt from a .md file
|
|
100
|
+
* Strips YAML frontmatter (---...---) and returns the content
|
|
101
|
+
*/
|
|
102
|
+
async function loadSkillPrompt(skillName: string): Promise<string> {
|
|
103
|
+
const skillPath = join(getSkillsDir(), `${skillName}.md`);
|
|
104
|
+
const file = Bun.file(skillPath);
|
|
105
|
+
|
|
106
|
+
if (!(await file.exists())) {
|
|
107
|
+
throw new Error(`Skill not found: ${skillPath}`);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
const content = await file.text();
|
|
111
|
+
|
|
112
|
+
// Strip YAML frontmatter if present
|
|
113
|
+
const frontmatterMatch = content.match(/^---\n[\s\S]*?\n---\n/);
|
|
114
|
+
if (frontmatterMatch) {
|
|
115
|
+
return content.slice(frontmatterMatch[0].length).trim();
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
return content.trim();
|
|
119
|
+
}
|
|
172
120
|
|
|
173
121
|
/**
|
|
174
122
|
* Run a chat using Claude CLI
|
|
@@ -179,8 +127,11 @@ async function runClaudeChat(contextPath: string, prompt: string): Promise<strin
|
|
|
179
127
|
const contextFile = Bun.file(contextPath);
|
|
180
128
|
const contextContent = await contextFile.text();
|
|
181
129
|
|
|
182
|
-
//
|
|
183
|
-
const
|
|
130
|
+
// Load the quality auditor skill prompt
|
|
131
|
+
const skillPrompt = await loadSkillPrompt("quality-auditor");
|
|
132
|
+
|
|
133
|
+
// Build the full prompt with skill prompt + user prompt + context
|
|
134
|
+
const fullPrompt = `${skillPrompt}
|
|
184
135
|
|
|
185
136
|
## User Request
|
|
186
137
|
|