wdyt 0.1.5 → 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wdyt",
3
- "version": "0.1.5",
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
@@ -86,6 +86,38 @@ async function claudeCliAvailable(): Promise<boolean> {
86
86
  }
87
87
  }
88
88
 
89
+ /**
90
+ * Get the skills directory path (bundled with the package)
91
+ */
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
+ }
120
+
89
121
  /**
90
122
  * Run a chat using Claude CLI
91
123
  * Sends the prompt + context to Claude and returns the response
@@ -95,8 +127,15 @@ async function runClaudeChat(contextPath: string, prompt: string): Promise<strin
95
127
  const contextFile = Bun.file(contextPath);
96
128
  const contextContent = await contextFile.text();
97
129
 
98
- // Build the full prompt with context
99
- const fullPrompt = `${prompt}
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}
135
+
136
+ ## User Request
137
+
138
+ ${prompt}
100
139
 
101
140
  <context>
102
141
  ${contextContent}