claude-code-autoconfig 1.0.0 → 1.0.2
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/.claude/commands/autoconfig.md +6 -2
- package/bin/cli.js +53 -10
- package/package.json +1 -1
|
@@ -171,6 +171,10 @@ This ensures double-clicking CLAUDE.md in the guide shows the real generated con
|
|
|
171
171
|
|
|
172
172
|
## After Completion
|
|
173
173
|
|
|
174
|
-
Once autoconfig is complete,
|
|
174
|
+
Once autoconfig is complete, open the interactive guide in the user's browser:
|
|
175
175
|
|
|
176
|
-
|
|
176
|
+
- macOS: `open .claude/guide/autoconfig.guide.html`
|
|
177
|
+
- Linux: `xdg-open .claude/guide/autoconfig.guide.html`
|
|
178
|
+
- Windows: `start .claude/guide/autoconfig.guide.html`
|
|
179
|
+
|
|
180
|
+
This shows the user what got installed and how to use it.
|
package/bin/cli.js
CHANGED
|
@@ -2,17 +2,50 @@
|
|
|
2
2
|
|
|
3
3
|
const fs = require('fs');
|
|
4
4
|
const path = require('path');
|
|
5
|
+
const { execSync, spawn } = require('child_process');
|
|
5
6
|
|
|
6
7
|
const cwd = process.cwd();
|
|
7
8
|
const packageDir = path.dirname(__dirname);
|
|
8
9
|
|
|
9
|
-
console.log('\x1b[36m%s\x1b[0m', '🚀
|
|
10
|
+
console.log('\x1b[36m%s\x1b[0m', '🚀 Claude Code Autoconfig');
|
|
10
11
|
console.log();
|
|
11
12
|
|
|
12
|
-
//
|
|
13
|
+
// Step 1: Check if Claude Code is installed
|
|
14
|
+
function isClaudeInstalled() {
|
|
15
|
+
try {
|
|
16
|
+
execSync('claude --version', { stdio: 'ignore' });
|
|
17
|
+
return true;
|
|
18
|
+
} catch {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function installClaude() {
|
|
24
|
+
console.log('\x1b[33m%s\x1b[0m', '⚠️ Claude Code not found. Installing...');
|
|
25
|
+
console.log();
|
|
26
|
+
try {
|
|
27
|
+
execSync('npm install -g @anthropic-ai/claude-code', { stdio: 'inherit' });
|
|
28
|
+
console.log();
|
|
29
|
+
console.log('\x1b[32m%s\x1b[0m', '✅ Claude Code installed');
|
|
30
|
+
return true;
|
|
31
|
+
} catch (err) {
|
|
32
|
+
console.log('\x1b[31m%s\x1b[0m', '❌ Failed to install Claude Code');
|
|
33
|
+
console.log(' Install manually: npm install -g @anthropic-ai/claude-code');
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if (!isClaudeInstalled()) {
|
|
39
|
+
if (!installClaude()) {
|
|
40
|
+
process.exit(1);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
console.log('\x1b[32m%s\x1b[0m', '✅ Claude Code detected');
|
|
45
|
+
|
|
46
|
+
// Step 2: Copy files
|
|
13
47
|
const SKIP_FILES = ['settings.local.json', 'retro'];
|
|
14
48
|
|
|
15
|
-
// Helper to copy directory recursively
|
|
16
49
|
function copyDir(src, dest) {
|
|
17
50
|
fs.mkdirSync(dest, { recursive: true });
|
|
18
51
|
const entries = fs.readdirSync(src, { withFileTypes: true });
|
|
@@ -37,7 +70,7 @@ const claudeDest = path.join(cwd, '.claude');
|
|
|
37
70
|
|
|
38
71
|
if (fs.existsSync(claudeSrc)) {
|
|
39
72
|
copyDir(claudeSrc, claudeDest);
|
|
40
|
-
console.log('\x1b[32m%s\x1b[0m', '✅ Created .claude/ directory
|
|
73
|
+
console.log('\x1b[32m%s\x1b[0m', '✅ Created .claude/ directory');
|
|
41
74
|
} else {
|
|
42
75
|
console.log('\x1b[31m%s\x1b[0m', '❌ Error: .claude directory not found in package');
|
|
43
76
|
process.exit(1);
|
|
@@ -48,17 +81,27 @@ const claudeMdSrc = path.join(packageDir, 'CLAUDE.md');
|
|
|
48
81
|
const claudeMdDest = path.join(cwd, 'CLAUDE.md');
|
|
49
82
|
|
|
50
83
|
if (fs.existsSync(claudeMdDest)) {
|
|
51
|
-
console.log('\x1b[33m%s\x1b[0m', '⚠️ CLAUDE.md
|
|
84
|
+
console.log('\x1b[33m%s\x1b[0m', '⚠️ CLAUDE.md exists, saved template as CLAUDE.md.template');
|
|
52
85
|
fs.copyFileSync(claudeMdSrc, path.join(cwd, 'CLAUDE.md.template'));
|
|
53
86
|
} else if (fs.existsSync(claudeMdSrc)) {
|
|
54
87
|
fs.copyFileSync(claudeMdSrc, claudeMdDest);
|
|
55
88
|
console.log('\x1b[32m%s\x1b[0m', '✅ Created CLAUDE.md');
|
|
56
89
|
}
|
|
57
90
|
|
|
91
|
+
// Step 3: Launch Claude Code
|
|
58
92
|
console.log();
|
|
59
|
-
console.log('\x1b[36m%s\x1b[0m', '
|
|
60
|
-
console.log();
|
|
61
|
-
console.log('Once Claude Code is open:');
|
|
62
|
-
console.log(' 1. Run \x1b[33m/autoconfig\x1b[0m to configure for your project');
|
|
63
|
-
console.log(' 2. Run \x1b[33m/show-guide\x1b[0m to open the interactive guide');
|
|
93
|
+
console.log('\x1b[36m%s\x1b[0m', '🚀 Launching Claude Code...');
|
|
94
|
+
console.log('\x1b[33m%s\x1b[0m', ' Run /autoconfig to complete setup');
|
|
64
95
|
console.log();
|
|
96
|
+
|
|
97
|
+
// Spawn claude in the current directory, inheriting stdio for interactive use
|
|
98
|
+
const claude = spawn('claude', [], {
|
|
99
|
+
cwd: cwd,
|
|
100
|
+
stdio: 'inherit',
|
|
101
|
+
shell: true
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
claude.on('error', (err) => {
|
|
105
|
+
console.log('\x1b[31m%s\x1b[0m', '❌ Failed to launch Claude Code');
|
|
106
|
+
console.log(' Run "claude" manually, then run /autoconfig');
|
|
107
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claude-code-autoconfig",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "Intelligent, self-configuring setup for Claude Code. One command analyzes your project, configures Claude, and shows you what it did.",
|
|
5
5
|
"author": "ADAC 1001 <info@adac1001.com>",
|
|
6
6
|
"license": "MIT",
|