claudex-setup 0.5.0 → 0.5.1
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/README.md +1 -1
- package/package.json +1 -1
- package/src/deep-review.js +43 -11
package/README.md
CHANGED
|
@@ -145,7 +145,7 @@ Already have a solid CLAUDE.md and hooks? Two things for you:
|
|
|
145
145
|
### Deep Review (AI-powered)
|
|
146
146
|
|
|
147
147
|
```bash
|
|
148
|
-
|
|
148
|
+
npx claudex-setup deep-review
|
|
149
149
|
```
|
|
150
150
|
|
|
151
151
|
Claude reads your actual config and gives specific feedback: what's strong, what has issues, what's missing for your stack. Not pattern matching — real analysis. Your config goes to Anthropic API only, we never see it.
|
package/package.json
CHANGED
package/src/deep-review.js
CHANGED
|
@@ -189,19 +189,38 @@ function callClaude(apiKey, prompt) {
|
|
|
189
189
|
});
|
|
190
190
|
}
|
|
191
191
|
|
|
192
|
+
function hasClaudeCode() {
|
|
193
|
+
try {
|
|
194
|
+
require('child_process').execSync('claude --version', { stdio: 'ignore' });
|
|
195
|
+
return true;
|
|
196
|
+
} catch { return false; }
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
async function callClaudeCode(prompt) {
|
|
200
|
+
const { execSync } = require('child_process');
|
|
201
|
+
// Use claude -p (headless/print mode) - uses the user's existing Claude Code auth
|
|
202
|
+
const escaped = prompt.replace(/'/g, "'\\''");
|
|
203
|
+
const result = execSync(`claude -p '${escaped}' --output-format text`, {
|
|
204
|
+
encoding: 'utf8',
|
|
205
|
+
maxBuffer: 1024 * 1024,
|
|
206
|
+
timeout: 120000,
|
|
207
|
+
});
|
|
208
|
+
return result;
|
|
209
|
+
}
|
|
210
|
+
|
|
192
211
|
async function deepReview(options) {
|
|
193
212
|
const apiKey = process.env.ANTHROPIC_API_KEY;
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
213
|
+
const hasClaude = hasClaudeCode();
|
|
214
|
+
|
|
215
|
+
if (!apiKey && !hasClaude) {
|
|
197
216
|
console.log('');
|
|
198
|
-
console.log('
|
|
199
|
-
console.log(c(' export ANTHROPIC_API_KEY=sk-ant-...', 'green'));
|
|
217
|
+
console.log(c(' Deep Review needs Claude Code or an API key.', 'bold'));
|
|
200
218
|
console.log('');
|
|
201
|
-
console.log(
|
|
202
|
-
console.log(c('
|
|
219
|
+
console.log(' Option A (recommended): Install Claude Code, then run this command.');
|
|
220
|
+
console.log(c(' npm install -g @anthropic-ai/claude-code', 'green'));
|
|
203
221
|
console.log('');
|
|
204
|
-
console.log(
|
|
222
|
+
console.log(' Option B: Set an API key:');
|
|
223
|
+
console.log(c(' export ANTHROPIC_API_KEY=sk-ant-...', 'green'));
|
|
205
224
|
console.log('');
|
|
206
225
|
process.exit(1);
|
|
207
226
|
}
|
|
@@ -236,7 +255,20 @@ async function deepReview(options) {
|
|
|
236
255
|
|
|
237
256
|
try {
|
|
238
257
|
const prompt = buildPrompt(config);
|
|
239
|
-
|
|
258
|
+
let review;
|
|
259
|
+
let method;
|
|
260
|
+
|
|
261
|
+
if (hasClaude) {
|
|
262
|
+
method = 'Claude Code (your existing subscription)';
|
|
263
|
+
console.log(c(' Using: Claude Code (no API key needed)', 'green'));
|
|
264
|
+
console.log('');
|
|
265
|
+
review = await callClaudeCode(prompt);
|
|
266
|
+
} else {
|
|
267
|
+
method = 'Anthropic API (your key)';
|
|
268
|
+
console.log(c(' Using: Anthropic API', 'dim'));
|
|
269
|
+
console.log('');
|
|
270
|
+
review = await callClaude(apiKey, prompt);
|
|
271
|
+
}
|
|
240
272
|
|
|
241
273
|
// Format output
|
|
242
274
|
const lines = review.split('\n');
|
|
@@ -264,8 +296,8 @@ async function deepReview(options) {
|
|
|
264
296
|
|
|
265
297
|
console.log('');
|
|
266
298
|
console.log(c(' ─────────────────────────────────────', 'dim'));
|
|
267
|
-
console.log(c(
|
|
268
|
-
console.log(c(' Your config
|
|
299
|
+
console.log(c(` Reviewed via ${method}`, 'dim'));
|
|
300
|
+
console.log(c(' Your config stays between you and Anthropic. We never see it.', 'dim'));
|
|
269
301
|
console.log('');
|
|
270
302
|
} catch (err) {
|
|
271
303
|
console.log(c(` Error: ${err.message}`, 'red'));
|