claude-code-autoconfig 1.0.10 → 1.0.12
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/guide/autoconfig.guide.html +9 -0
- package/bin/cli.js +101 -3
- package/package.json +1 -1
|
@@ -899,6 +899,11 @@
|
|
|
899
899
|
<span class="tree-file-icon">📄</span>
|
|
900
900
|
<span class="file">FEEDBACK.md</span>
|
|
901
901
|
</div>
|
|
902
|
+
<div class="tree-item indent-2 hidden" data-info="agents" data-parent="claude-dir">
|
|
903
|
+
<span class="tree-spacer"></span>
|
|
904
|
+
<span class="tree-folder-icon">📁</span>
|
|
905
|
+
<span class="folder">agents</span>
|
|
906
|
+
</div>
|
|
902
907
|
<div class="tree-item indent-2 folder-row hidden collapsed" data-info="guide" data-folder="guide-folder" data-parent="claude-dir">
|
|
903
908
|
<span class="tree-chevron">›</span>
|
|
904
909
|
<span class="tree-folder-icon">📁</span>
|
|
@@ -1229,6 +1234,10 @@
|
|
|
1229
1234
|
title: 'feedback/',
|
|
1230
1235
|
desc: 'Team-maintained corrections and guidance for Claude. Add notes here when Claude does something wrong — it learns for next time. This directory persists across <code>/autoconfig</code> runs.'
|
|
1231
1236
|
},
|
|
1237
|
+
'agents': {
|
|
1238
|
+
title: 'agents/',
|
|
1239
|
+
desc: 'Custom AI agents for specialized tasks. Each <code>.md</code> file defines an agent that Claude can spawn for complex, multi-step operations. Use <code>/enable-retro</code> to add a retro item agent.'
|
|
1240
|
+
},
|
|
1232
1241
|
'feedback-template': {
|
|
1233
1242
|
title: 'FEEDBACK.md',
|
|
1234
1243
|
desc: 'Starter template for team feedback. Add dated entries when Claude makes mistakes — include what went wrong and the correct approach. Claude reads this on every session.'
|
package/bin/cli.js
CHANGED
|
@@ -54,8 +54,106 @@ if (!isClaudeInstalled()) {
|
|
|
54
54
|
|
|
55
55
|
console.log('\x1b[32m%s\x1b[0m', '✅ Claude Code detected');
|
|
56
56
|
|
|
57
|
-
// Step 2:
|
|
57
|
+
// Step 2: Backup existing .claude/ if present
|
|
58
58
|
const claudeDest = path.join(cwd, '.claude');
|
|
59
|
+
const SKIP_BACKUP = ['migration']; // Don't backup the migration folder itself
|
|
60
|
+
let migrationPath = null;
|
|
61
|
+
|
|
62
|
+
function copyDirForBackup(src, dest) {
|
|
63
|
+
fs.mkdirSync(dest, { recursive: true });
|
|
64
|
+
const entries = fs.readdirSync(src, { withFileTypes: true });
|
|
65
|
+
|
|
66
|
+
for (const entry of entries) {
|
|
67
|
+
if (SKIP_BACKUP.includes(entry.name)) continue;
|
|
68
|
+
if (isReservedName(entry.name)) continue;
|
|
69
|
+
|
|
70
|
+
const srcPath = path.join(src, entry.name);
|
|
71
|
+
const destPath = path.join(dest, entry.name);
|
|
72
|
+
|
|
73
|
+
if (entry.isDirectory()) {
|
|
74
|
+
copyDirForBackup(srcPath, destPath);
|
|
75
|
+
} else {
|
|
76
|
+
fs.copyFileSync(srcPath, destPath);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function collectFiles(dir, prefix = '') {
|
|
82
|
+
const files = [];
|
|
83
|
+
const entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
84
|
+
for (const entry of entries) {
|
|
85
|
+
const relPath = prefix ? `${prefix}/${entry.name}` : entry.name;
|
|
86
|
+
if (entry.isDirectory()) {
|
|
87
|
+
files.push(...collectFiles(path.join(dir, entry.name), relPath));
|
|
88
|
+
} else {
|
|
89
|
+
files.push(relPath);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
return files;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
if (fs.existsSync(claudeDest)) {
|
|
96
|
+
// Check if there are files worth backing up (not just empty dirs)
|
|
97
|
+
const existingEntries = fs.readdirSync(claudeDest).filter(e => e !== 'migration');
|
|
98
|
+
|
|
99
|
+
if (existingEntries.length > 0) {
|
|
100
|
+
const timestamp = new Date().toISOString().replace(/[:.]/g, '-').slice(0, 19);
|
|
101
|
+
const migrationDir = path.join(claudeDest, 'migration');
|
|
102
|
+
migrationPath = path.join(migrationDir, timestamp);
|
|
103
|
+
|
|
104
|
+
fs.mkdirSync(migrationPath, { recursive: true });
|
|
105
|
+
|
|
106
|
+
// Copy existing files to backup
|
|
107
|
+
for (const entry of existingEntries) {
|
|
108
|
+
const srcPath = path.join(claudeDest, entry);
|
|
109
|
+
const destPath = path.join(migrationPath, entry);
|
|
110
|
+
|
|
111
|
+
if (fs.statSync(srcPath).isDirectory()) {
|
|
112
|
+
copyDirForBackup(srcPath, destPath);
|
|
113
|
+
} else {
|
|
114
|
+
fs.copyFileSync(srcPath, destPath);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// Collect backed up files for metadata
|
|
119
|
+
const backedUpFiles = collectFiles(migrationPath);
|
|
120
|
+
|
|
121
|
+
// Write latest.json for the guide
|
|
122
|
+
fs.writeFileSync(path.join(migrationDir, 'latest.json'), JSON.stringify({
|
|
123
|
+
timestamp: timestamp,
|
|
124
|
+
backedUpFiles: backedUpFiles
|
|
125
|
+
}, null, 2));
|
|
126
|
+
|
|
127
|
+
// Create README inside the dated backup folder
|
|
128
|
+
const backupReadme = `# Migration Backup: ${timestamp}
|
|
129
|
+
|
|
130
|
+
This folder contains a backup of your previous .claude/ configuration.
|
|
131
|
+
|
|
132
|
+
## Why This Backup Exists
|
|
133
|
+
|
|
134
|
+
You ran \`npx claude-code-autoconfig\` on a project that already had Claude Code configured.
|
|
135
|
+
Your previous files were backed up here before the new configuration was applied.
|
|
136
|
+
|
|
137
|
+
## Backed Up Files
|
|
138
|
+
|
|
139
|
+
${backedUpFiles.map(f => `- ${f}`).join('\n')}
|
|
140
|
+
|
|
141
|
+
## Restoring Files
|
|
142
|
+
|
|
143
|
+
To restore any file, copy it from this folder back to \`.claude/\`.
|
|
144
|
+
|
|
145
|
+
For example:
|
|
146
|
+
\`\`\`bash
|
|
147
|
+
cp .claude/migration/${timestamp}/settings.json .claude/settings.json
|
|
148
|
+
\`\`\`
|
|
149
|
+
`;
|
|
150
|
+
fs.writeFileSync(path.join(migrationPath, 'README.md'), backupReadme);
|
|
151
|
+
|
|
152
|
+
console.log('\x1b[33m%s\x1b[0m', `⚠️ Backed up existing config to .claude/migration/${timestamp}/`);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
// Step 3: Copy minimal bootstrap (commands/, guide/, agents/)
|
|
59
157
|
const commandsSrc = path.join(packageDir, '.claude', 'commands');
|
|
60
158
|
const guideSrc = path.join(packageDir, '.claude', 'guide');
|
|
61
159
|
const agentsSrc = path.join(packageDir, '.claude', 'agents');
|
|
@@ -98,7 +196,7 @@ if (fs.existsSync(agentsSrc)) {
|
|
|
98
196
|
|
|
99
197
|
console.log('\x1b[32m%s\x1b[0m', '✅ Prepared /autoconfig command');
|
|
100
198
|
|
|
101
|
-
// Step
|
|
199
|
+
// Step 4: Show "ONE MORE STEP" message
|
|
102
200
|
console.log();
|
|
103
201
|
console.log('\x1b[33m╔══════════════════════════════════════════╗\x1b[0m');
|
|
104
202
|
console.log('\x1b[33m║ ║\x1b[0m');
|
|
@@ -110,7 +208,7 @@ console.log('\x1b[33m║ ║\x1b[0m');
|
|
|
110
208
|
console.log('\x1b[33m╚══════════════════════════════════════════╝\x1b[0m');
|
|
111
209
|
console.log();
|
|
112
210
|
|
|
113
|
-
// Step
|
|
211
|
+
// Step 5: Wait for Enter, then launch Claude Code
|
|
114
212
|
const rl = readline.createInterface({
|
|
115
213
|
input: process.stdin,
|
|
116
214
|
output: process.stdout
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claude-code-autoconfig",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.12",
|
|
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",
|