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 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
- ANTHROPIC_API_KEY=sk-ant-... npx claudex-setup deep-review
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claudex-setup",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "Audit and optimize any project for Claude Code. Powered by 1107 verified techniques.",
5
5
  "main": "src/index.js",
6
6
  "bin": {
@@ -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
- if (!apiKey) {
195
- console.log('');
196
- console.log(c(' Deep Review requires an Anthropic API key.', 'bold'));
213
+ const hasClaude = hasClaudeCode();
214
+
215
+ if (!apiKey && !hasClaude) {
197
216
  console.log('');
198
- console.log(' Set it with:');
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(c(' Or on Windows:', 'dim'));
202
- console.log(c(' set ANTHROPIC_API_KEY=sk-ant-...', 'green'));
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(c(' Your key is sent directly to Anthropic API. We never see or store it.', 'dim'));
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
- const review = await callClaude(apiKey, prompt);
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(' Reviewed by Claude Sonnet 4.6 via Anthropic API', 'dim'));
268
- console.log(c(' Your config was sent to api.anthropic.com only. We never see it.', 'dim'));
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'));