claude-code-autoconfig 1.0.7 → 1.0.9

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.
@@ -65,7 +65,86 @@ If CLAUDE.md mentions MCP servers or tool integrations:
65
65
  2. Add to `.claude/.mcp.json` in the mcpServers object
66
66
  3. Notify: "Migrated MCP config to .claude/.mcp.json"
67
67
 
68
- ## Step 1: Detect Environment
68
+ ## Step 1: Create Scaffold Files
69
+
70
+ Create these files if they don't already exist:
71
+
72
+ ### .claude/settings.json
73
+ ```json
74
+ {
75
+ "permissions": {
76
+ "allow": [
77
+ "Read(./**)",
78
+ "Edit(./**)",
79
+ "Write(./**)",
80
+ "WebSearch",
81
+ "WebFetch",
82
+ "Bash(npm run dev)",
83
+ "Bash(npm run build)",
84
+ "Bash(npm run lint)",
85
+ "Bash(npm run lint:fix)",
86
+ "Bash(npm run typecheck)",
87
+ "Bash(npm run test)",
88
+ "Bash(npm run test:*)",
89
+ "Bash(npm run validate)",
90
+ "Bash(git status)",
91
+ "Bash(git diff:*)",
92
+ "Bash(git add:*)",
93
+ "Bash(git commit:*)",
94
+ "Bash(git push:*)",
95
+ "Bash(git pull)",
96
+ "Bash(git checkout:*)",
97
+ "Bash(git branch:*)"
98
+ ],
99
+ "deny": [
100
+ "Read(./.env)",
101
+ "Read(./.env.*)",
102
+ "Read(./secrets/**)",
103
+ "Read(./**/credentials.*)",
104
+ "Read(./**/*.pem)",
105
+ "Read(./**/*.key)",
106
+ "Bash(rm -rf:*)",
107
+ "Bash(curl:*)",
108
+ "Bash(wget:*)"
109
+ ]
110
+ }
111
+ }
112
+ ```
113
+
114
+ ### .claude/.mcp.json
115
+ ```json
116
+ {
117
+ "mcpServers": {}
118
+ }
119
+ ```
120
+
121
+ ### .claude/feedback/FEEDBACK.md
122
+ ```markdown
123
+ <!-- @description Team-maintained corrections and guidance for Claude. Add notes here when Claude does something wrong — it learns for next time. This directory persists across /autoconfig runs. -->
124
+
125
+ # Team Feedback
126
+
127
+ Add corrections and guidance here when Claude does something wrong.
128
+ Claude reads this directory and learns for next time.
129
+
130
+ ## YYYY-MM-DD: Brief title
131
+
132
+ Describe what Claude did wrong and what to do instead.
133
+ Keep entries brief and actionable.
134
+ ```
135
+
136
+ ### .claude/rules/ (empty directory)
137
+ Create the directory if it doesn't exist.
138
+
139
+ ### CLAUDE.md (template)
140
+ If no CLAUDE.md exists, create it with this template:
141
+ ```markdown
142
+ # Project Name
143
+
144
+ > Run `/autoconfig` to populate this based on your project.
145
+ ```
146
+
147
+ ## Step 2: Detect Environment
69
148
 
70
149
  **Operating System:**
71
150
  Check the platform and note it for command syntax:
@@ -74,7 +153,7 @@ Check the platform and note it for command syntax:
74
153
 
75
154
  Include this in CLAUDE.md so all commands use the correct syntax.
76
155
 
77
- ## Step 2: Scan the Project
156
+ ## Step 3: Scan the Project
78
157
 
79
158
  Look for these indicators to understand the project:
80
159
 
@@ -117,7 +196,7 @@ Look for these indicators to understand the project:
117
196
  - `.github/workflows/` → GitHub Actions
118
197
  - `serverless.yml` → Serverless Framework
119
198
 
120
- ## Step 3: Populate CLAUDE.md
199
+ ## Step 4: Populate CLAUDE.md
121
200
 
122
201
  Focus on what Claude Code actually needs to work effectively. Claude can explore the codebase itself — don't document what it can discover.
123
202
 
@@ -158,60 +237,6 @@ See `.claude/feedback/` for corrections and guidance from the team.
158
237
 
159
238
  This pointer persists across autoconfig runs and directs Claude to team-maintained content.
160
239
 
161
- ## Step 4: Create Rules Directory
162
-
163
- Create an empty `.claude/rules/` directory. Do not create any subdirectories or rule files.
164
-
165
- Rules are path-scoped context files that load automatically when Claude works on matching files. Effective rules require deep understanding of your codebase patterns, team conventions, and quality goals — they should be crafted intentionally, not auto-generated.
166
-
167
- ## Step 5: Configure Settings
168
-
169
- Update `.claude/settings.json` using the official schema.
170
-
171
- ### Deny Patterns (files Claude shouldn't read/write)
172
-
173
- Use `Read()` for blocking reads, `Edit()` for blocking writes:
174
-
175
- **Always deny (security):**
176
- ```
177
- Read(./.env)
178
- Read(./.env.*)
179
- Read(./secrets/**)
180
- Edit(./.env)
181
- Edit(./.env.*)
182
- ```
183
-
184
- **Often deny (generated/vendor):**
185
- ```
186
- Edit(./node_modules/**)
187
- Edit(./dist/**)
188
- Edit(./.git/**)
189
- ```
190
-
191
- ### Allow Patterns (auto-approve without prompting)
192
-
193
- Use `Bash()` patterns with prefix matching:
194
-
195
- ```
196
- Bash(npm run test:*)
197
- Bash(npm run lint:*)
198
- Bash(npm run build)
199
- ```
200
-
201
- ### Environment Variables
202
-
203
- Set session-level env vars:
204
-
205
- ```json
206
- {
207
- "env": {
208
- "NODE_ENV": "development"
209
- }
210
- }
211
- ```
212
-
213
- **Keep it minimal** — only include patterns that actually exist in this project.
214
-
215
240
  ## Guidelines
216
241
 
217
242
  - Replace ALL placeholder content with real values from THIS project
@@ -219,7 +244,7 @@ Set session-level env vars:
219
244
  - Optimize for Claude's efficiency, not human documentation
220
245
  - When uncertain, leave it out — Claude can ask or explore
221
246
 
222
- ## Step 6: Update the Guide
247
+ ## Step 5: Update the Guide
223
248
 
224
249
  After populating CLAUDE.md, update the guide's file preview to show the actual content:
225
250
 
package/bin/cli.js CHANGED
@@ -2,11 +2,22 @@
2
2
 
3
3
  const fs = require('fs');
4
4
  const path = require('path');
5
+ const readline = require('readline');
5
6
  const { execSync, spawn } = require('child_process');
6
7
 
7
8
  const cwd = process.cwd();
8
9
  const packageDir = path.dirname(__dirname);
9
10
 
11
+ // Reserved Windows device names - never create files with these names
12
+ const WINDOWS_RESERVED = ['CON', 'PRN', 'AUX', 'NUL', 'COM1', 'COM2', 'COM3', 'COM4',
13
+ 'COM5', 'COM6', 'COM7', 'COM8', 'COM9', 'LPT1', 'LPT2', 'LPT3', 'LPT4', 'LPT5',
14
+ 'LPT6', 'LPT7', 'LPT8', 'LPT9'];
15
+
16
+ function isReservedName(name) {
17
+ const baseName = name.replace(/\.[^.]*$/, '').toUpperCase();
18
+ return WINDOWS_RESERVED.includes(baseName);
19
+ }
20
+
10
21
  console.log('\x1b[36m%s\x1b[0m', '🚀 Claude Code Autoconfig');
11
22
  console.log();
12
23
 
@@ -43,115 +54,18 @@ if (!isClaudeInstalled()) {
43
54
 
44
55
  console.log('\x1b[32m%s\x1b[0m', '✅ Claude Code detected');
45
56
 
46
- // Step 2: Backup existing .claude/ if present
57
+ // Step 2: Copy minimal bootstrap (commands/ and guide/ only)
47
58
  const claudeDest = path.join(cwd, '.claude');
48
- const SKIP_FILES = ['settings.local.json', 'retro', 'migration'];
49
- let migrationPath = null;
50
-
51
- function copyDirForBackup(src, dest) {
52
- fs.mkdirSync(dest, { recursive: true });
53
- const entries = fs.readdirSync(src, { withFileTypes: true });
54
-
55
- for (const entry of entries) {
56
- if (SKIP_FILES.includes(entry.name)) continue;
57
-
58
- const srcPath = path.join(src, entry.name);
59
- const destPath = path.join(dest, entry.name);
60
-
61
- if (entry.isDirectory()) {
62
- copyDirForBackup(srcPath, destPath);
63
- } else {
64
- fs.copyFileSync(srcPath, destPath);
65
- }
66
- }
67
- }
68
-
69
- if (fs.existsSync(claudeDest)) {
70
- // Create timestamped backup
71
- const timestamp = new Date().toISOString().replace(/[:.]/g, '-').slice(0, 19);
72
- const migrationDir = path.join(claudeDest, 'migration');
73
- migrationPath = path.join(migrationDir, timestamp);
74
-
75
- fs.mkdirSync(migrationPath, { recursive: true });
76
-
77
- // Copy existing files to backup (excluding migration folder itself)
78
- const entries = fs.readdirSync(claudeDest, { withFileTypes: true });
79
- for (const entry of entries) {
80
- if (entry.name === 'migration') continue;
81
-
82
- const srcPath = path.join(claudeDest, entry.name);
83
- const destPath = path.join(migrationPath, entry.name);
84
-
85
- if (entry.isDirectory()) {
86
- copyDirForBackup(srcPath, destPath);
87
- } else {
88
- fs.copyFileSync(srcPath, destPath);
89
- }
90
- }
91
-
92
- // Write migration metadata for the guide to read
93
- const latestPath = path.join(migrationDir, 'latest.json');
94
- const backedUpFiles = [];
95
-
96
- function collectFiles(dir, prefix = '') {
97
- const entries = fs.readdirSync(dir, { withFileTypes: true });
98
- for (const entry of entries) {
99
- const relPath = prefix ? `${prefix}/${entry.name}` : entry.name;
100
- if (entry.isDirectory()) {
101
- collectFiles(path.join(dir, entry.name), relPath);
102
- } else {
103
- backedUpFiles.push(relPath);
104
- }
105
- }
106
- }
107
- collectFiles(migrationPath);
108
-
109
- fs.writeFileSync(latestPath, JSON.stringify({
110
- timestamp: timestamp,
111
- backedUpFiles: backedUpFiles
112
- }, null, 2));
113
-
114
- // Create/update migration README
115
- const readmePath = path.join(migrationDir, 'README.md');
116
- const readmeContent = `# Migration Backups
117
-
118
- This folder contains backups of previous .claude/ configurations created during autoconfig upgrades.
119
-
120
- Each timestamped folder contains the files that existed before that migration.
121
-
122
- ## Backups
123
-
124
- - \`${timestamp}/\` - Backup created during autoconfig install
125
-
126
- ## Restoring
127
-
128
- To restore a previous configuration, copy files from the backup folder back to \`.claude/\`.
129
- `;
130
-
131
- // Append to existing README or create new
132
- if (fs.existsSync(readmePath)) {
133
- const existing = fs.readFileSync(readmePath, 'utf8');
134
- const newEntry = `- \`${timestamp}/\` - Backup created during autoconfig install\n`;
135
- if (!existing.includes(timestamp)) {
136
- const updated = existing.replace('## Backups\n\n', `## Backups\n\n${newEntry}`);
137
- fs.writeFileSync(readmePath, updated);
138
- }
139
- } else {
140
- fs.writeFileSync(readmePath, readmeContent);
141
- }
142
-
143
- console.log('\x1b[33m%s\x1b[0m', `⚠️ Existing .claude/ backed up to migration/${timestamp}/`);
144
- }
145
-
146
- // Step 3: Copy new files
147
- const claudeSrc = path.join(packageDir, '.claude');
59
+ const commandsSrc = path.join(packageDir, '.claude', 'commands');
60
+ const guideSrc = path.join(packageDir, '.claude', 'guide');
61
+ const agentsSrc = path.join(packageDir, '.claude', 'agents');
148
62
 
149
63
  function copyDir(src, dest) {
150
64
  fs.mkdirSync(dest, { recursive: true });
151
65
  const entries = fs.readdirSync(src, { withFileTypes: true });
152
66
 
153
67
  for (const entry of entries) {
154
- if (SKIP_FILES.includes(entry.name)) continue;
68
+ if (isReservedName(entry.name)) continue;
155
69
 
156
70
  const srcPath = path.join(src, entry.name);
157
71
  const destPath = path.join(dest, entry.name);
@@ -164,44 +78,60 @@ function copyDir(src, dest) {
164
78
  }
165
79
  }
166
80
 
167
- if (fs.existsSync(claudeSrc)) {
168
- copyDir(claudeSrc, claudeDest);
169
- console.log('\x1b[32m%s\x1b[0m', '✅ Created .claude/ directory');
81
+ // Copy commands (required for /autoconfig to work)
82
+ if (fs.existsSync(commandsSrc)) {
83
+ copyDir(commandsSrc, path.join(claudeDest, 'commands'));
170
84
  } else {
171
- console.log('\x1b[31m%s\x1b[0m', '❌ Error: .claude directory not found in package');
85
+ console.log('\x1b[31m%s\x1b[0m', '❌ Error: commands directory not found');
172
86
  process.exit(1);
173
87
  }
174
88
 
175
- // Copy CLAUDE.md (don't overwrite if exists)
176
- const claudeMdSrc = path.join(packageDir, 'CLAUDE.md');
177
- const claudeMdDest = path.join(cwd, 'CLAUDE.md');
89
+ // Copy guide (too large to generate)
90
+ if (fs.existsSync(guideSrc)) {
91
+ copyDir(guideSrc, path.join(claudeDest, 'guide'));
92
+ }
178
93
 
179
- if (fs.existsSync(claudeMdDest)) {
180
- // Backup existing CLAUDE.md to migration folder if we have one
181
- if (migrationPath) {
182
- fs.copyFileSync(claudeMdDest, path.join(migrationPath, 'CLAUDE.md'));
183
- }
184
- console.log('\x1b[33m%s\x1b[0m', '⚠️ CLAUDE.md exists, saved template as CLAUDE.md.template');
185
- fs.copyFileSync(claudeMdSrc, path.join(cwd, 'CLAUDE.md.template'));
186
- } else if (fs.existsSync(claudeMdSrc)) {
187
- fs.copyFileSync(claudeMdSrc, claudeMdDest);
188
- console.log('\x1b[32m%s\x1b[0m', '✅ Created CLAUDE.md');
94
+ // Copy agents if exists
95
+ if (fs.existsSync(agentsSrc)) {
96
+ copyDir(agentsSrc, path.join(claudeDest, 'agents'));
189
97
  }
190
98
 
191
- // Step 4: Launch Claude Code
99
+ console.log('\x1b[32m%s\x1b[0m', '✅ Prepared /autoconfig command');
100
+
101
+ // Step 3: Show "ONE MORE STEP" message
192
102
  console.log();
193
- console.log('\x1b[36m%s\x1b[0m', '🚀 Launching Claude Code...');
194
- console.log('\x1b[33m%s\x1b[0m', ' Run /autoconfig to complete setup');
103
+ console.log('\x1b[33m%s\x1b[0m', '╔═══════════════════════════════════════════════════╗');
104
+ console.log('\x1b[33m%s\x1b[0m', '║ ║');
105
+ console.log('\x1b[33m%s\x1b[0m', '║ ⚡ ONE MORE STEP ║');
106
+ console.log('\x1b[33m%s\x1b[0m', '║ ║');
107
+ console.log('\x1b[33m%s\x1b[0m', '║ Run \x1b[36m/autoconfig\x1b[33m in Claude Code ║');
108
+ console.log('\x1b[33m%s\x1b[0m', '║ to complete setup ║');
109
+ console.log('\x1b[33m%s\x1b[0m', '║ ║');
110
+ console.log('\x1b[33m%s\x1b[0m', '╚═══════════════════════════════════════════════════╝');
195
111
  console.log();
196
112
 
197
- // Spawn claude in the current directory, inheriting stdio for interactive use
198
- const claude = spawn('claude', [], {
199
- cwd: cwd,
200
- stdio: 'inherit',
201
- shell: true
113
+ // Step 4: Wait for Enter, then launch Claude Code
114
+ const rl = readline.createInterface({
115
+ input: process.stdin,
116
+ output: process.stdout
202
117
  });
203
118
 
204
- claude.on('error', (err) => {
205
- console.log('\x1b[31m%s\x1b[0m', '❌ Failed to launch Claude Code');
206
- console.log(' Run "claude" manually, then run /autoconfig');
119
+ rl.question('\x1b[90mPress ENTER to open Claude Code...\x1b[0m', () => {
120
+ rl.close();
121
+
122
+ console.log();
123
+ console.log('\x1b[36m%s\x1b[0m', '🚀 Launching Claude Code...');
124
+ console.log();
125
+
126
+ // Spawn claude in the current directory
127
+ const claude = spawn('claude', [], {
128
+ cwd: cwd,
129
+ stdio: 'inherit',
130
+ shell: true
131
+ });
132
+
133
+ claude.on('error', (err) => {
134
+ console.log('\x1b[31m%s\x1b[0m', '❌ Failed to launch Claude Code');
135
+ console.log(' Run "claude" manually, then run /autoconfig');
136
+ });
207
137
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-code-autoconfig",
3
- "version": "1.0.7",
3
+ "version": "1.0.9",
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",