claude-code-autoconfig 1.0.176 โ†’ 1.0.178

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.
@@ -1268,7 +1268,7 @@
1268
1268
  title: '.claude/ Directory',
1269
1269
  desc: 'Commands, rules, settings, and these docs. Keeps configuration organized as your project grows.'
1270
1270
  },
1271
- 'rules': {
1271
+ 'rules': {
1272
1272
  title: 'rules/',
1273
1273
  desc: 'Path-scoped context that loads when Claude works on matching files.'
1274
1274
  },
@@ -1579,7 +1579,7 @@ CRITICAL: A plausible-looking cause from code reading is NOT confirmed evidence.
1579
1579
 
1580
1580
  > Run \`/autoconfig\` to populate this based on your project.`
1581
1581
  },
1582
- 'autoconfig-update': {
1582
+ 'autoconfig-update': {
1583
1583
  filename: 'autoconfig-update.md',
1584
1584
  content: `<!-- @applied
1585
1585
  -->
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## v1.0.178
4
+ - fix: move insideClaude check before file copying
5
+
6
+ ## v1.0.177
7
+ - feat: add pre-install diagnostic logging and fix AUTOCONFIG_FILES
8
+
3
9
  ## v1.0.176
4
10
  - fix: add feedback to AUTOCONFIG_FILES to prevent false upgrade detection
5
11
 
@@ -141,9 +147,3 @@
141
147
  ## v1.0.129
142
148
  - fix: tighten /recover-context confirmation to single line
143
149
 
144
- ## v1.0.128
145
- - fix: show estimated tokens instead of bytes in /recover-context
146
-
147
- ## v1.0.127
148
- - feat: SessionStart hook for feedback migration, merge hooks on upgrade
149
-
package/bin/cli.js CHANGED
@@ -27,7 +27,7 @@ const WINDOWS_RESERVED = ['CON', 'PRN', 'AUX', 'NUL', 'COM1', 'COM2', 'COM3', 'C
27
27
  'LPT6', 'LPT7', 'LPT8', 'LPT9'];
28
28
 
29
29
  // Files/folders installed by autoconfig - don't backup these
30
- const AUTOCONFIG_FILES = ['commands', 'docs', 'agents', 'migration', 'hooks', 'updates', 'scripts', 'rules', 'feedback'];
30
+ const AUTOCONFIG_FILES = ['commands', 'docs', 'agents', 'migration', 'hooks', 'updates', 'scripts', 'rules', 'feedback', 'settings.json', '.mcp.json', '.autoconfig-version'];
31
31
 
32
32
  function isReservedName(name) {
33
33
  const baseName = name.replace(/\.[^.]*$/, '').toUpperCase();
@@ -160,6 +160,17 @@ const insideClaude = process.env.CLAUDECODE === '1';
160
160
  console.log('\x1b[36m%s\x1b[0m', '๐Ÿš€ Claude Code Autoconfig');
161
161
  console.log();
162
162
 
163
+ // Block early if running inside Claude Code (unless --bootstrap)
164
+ if (insideClaude && !process.argv.includes('--bootstrap')) {
165
+ console.log('\x1b[31m%s\x1b[0m', 'โ— The tool needs to be run from a regular terminal, not from within Claude Code.');
166
+ console.log();
167
+ console.log(' Open a separate terminal window and run:');
168
+ console.log();
169
+ console.log(' \x1b[36mnpx claude-code-autoconfig@latest\x1b[0m');
170
+ console.log();
171
+ process.exit(0);
172
+ }
173
+
163
174
  // Step 1: Check if Claude Code is installed
164
175
  function isClaudeInstalled() {
165
176
  try {
@@ -198,6 +209,32 @@ const claudeDest = path.join(cwd, '.claude');
198
209
  const SKIP_BACKUP = ['migration']; // Don't backup the migration folder itself
199
210
  let migrationPath = null;
200
211
 
212
+ // Diagnostic: log pre-install state
213
+ console.log();
214
+ console.log('\x1b[90m%s\x1b[0m', 'โ”€โ”€ Pre-install state โ”€โ”€');
215
+ console.log('\x1b[90m%s\x1b[0m', ` Working dir: ${cwd}`);
216
+ const claudeMdExists = fs.existsSync(path.join(cwd, 'CLAUDE.md'));
217
+ console.log('\x1b[90m%s\x1b[0m', ` CLAUDE.md: ${claudeMdExists ? 'exists' : 'not found'}`);
218
+ if (claudeMdExists) {
219
+ const claudeMdContent = fs.readFileSync(path.join(cwd, 'CLAUDE.md'), 'utf8');
220
+ const hasMarker = claudeMdContent.includes('AUTO-GENERATED BY /autoconfig');
221
+ console.log('\x1b[90m%s\x1b[0m', ` CLAUDE.md autoconfig marker: ${hasMarker ? 'yes' : 'no'}`);
222
+ }
223
+ if (fs.existsSync(claudeDest)) {
224
+ const entries = fs.readdirSync(claudeDest);
225
+ console.log('\x1b[90m%s\x1b[0m', ` .claude/ exists: yes (${entries.length} entries)`);
226
+ for (const e of entries) {
227
+ const isAutoconfig = AUTOCONFIG_FILES.includes(e);
228
+ console.log('\x1b[90m%s\x1b[0m', ` ${isAutoconfig ? 'ยท' : 'โ–ธ'} ${e}${isAutoconfig ? '' : ' (user content)'}`);
229
+ }
230
+ const docsHtml = path.join(claudeDest, 'docs', 'autoconfig.docs.html');
231
+ console.log('\x1b[90m%s\x1b[0m', ` autoconfig.docs.html: ${fs.existsSync(docsHtml) ? 'exists' : 'not found'}`);
232
+ } else {
233
+ console.log('\x1b[90m%s\x1b[0m', ' .claude/ exists: no');
234
+ }
235
+ console.log('\x1b[90m%s\x1b[0m', 'โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€');
236
+ console.log();
237
+
201
238
  function copyDirForBackup(src, dest) {
202
239
  fs.mkdirSync(dest, { recursive: true });
203
240
  const entries = fs.readdirSync(src, { withFileTypes: true });
@@ -233,6 +270,11 @@ function collectFiles(dir, prefix = '') {
233
270
  }
234
271
 
235
272
  if (fs.existsSync(claudeDest) && hasUserContent(claudeDest)) {
273
+ const userEntries = fs.readdirSync(claudeDest).filter(e =>
274
+ e !== 'migration' && !AUTOCONFIG_FILES.includes(e)
275
+ );
276
+ console.log('\x1b[90m%s\x1b[0m', ` Backup triggered by user content: ${userEntries.join(', ')}`);
277
+
236
278
  const timestamp = formatTimestamp();
237
279
  const migrationDir = path.join(claudeDest, 'migration');
238
280
  migrationPath = path.join(migrationDir, timestamp);
@@ -240,11 +282,7 @@ if (fs.existsSync(claudeDest) && hasUserContent(claudeDest)) {
240
282
  fs.mkdirSync(migrationPath, { recursive: true });
241
283
 
242
284
  // Copy user files to backup (excluding autoconfig-installed files)
243
- const existingEntries = fs.readdirSync(claudeDest).filter(e =>
244
- e !== 'migration' && !AUTOCONFIG_FILES.includes(e)
245
- );
246
-
247
- for (const entry of existingEntries) {
285
+ for (const entry of userEntries) {
248
286
  const srcPath = path.join(claudeDest, entry);
249
287
  const destPath = path.join(migrationPath, entry);
250
288
 
@@ -310,11 +348,18 @@ const isUpgrade = (() => {
310
348
  const claudeMdPath = path.join(cwd, 'CLAUDE.md');
311
349
  if (fs.existsSync(claudeMdPath)) {
312
350
  const content = fs.readFileSync(claudeMdPath, 'utf8');
313
- if (content.includes('AUTO-GENERATED BY /autoconfig')) return true;
351
+ if (content.includes('AUTO-GENERATED BY /autoconfig')) {
352
+ console.log('\x1b[90m%s\x1b[0m', ' Upgrade detected: CLAUDE.md has autoconfig marker');
353
+ return true;
354
+ }
314
355
  }
315
356
  // Indicator 2: docs HTML exists (unique autoconfig artifact)
316
357
  const docsPath = path.join(claudeDest, 'docs', 'autoconfig.docs.html');
317
- if (fs.existsSync(docsPath)) return true;
358
+ if (fs.existsSync(docsPath)) {
359
+ console.log('\x1b[90m%s\x1b[0m', ' Upgrade detected: autoconfig.docs.html exists');
360
+ return true;
361
+ }
362
+ console.log('\x1b[90m%s\x1b[0m', ' Install type: fresh (no previous autoconfig found)');
318
363
  return false;
319
364
  })();
320
365
 
@@ -625,14 +670,7 @@ const launchCommand = isUpgrade ? '/autoconfig-update' : '/autoconfig';
625
670
 
626
671
  // --bootstrap: copy files only, exit silently (used by /autoconfig inside Claude)
627
672
  const bootstrapMode = process.argv.includes('--bootstrap');
628
- if (bootstrapMode || insideClaude) {
629
- if (!bootstrapMode) {
630
- // insideClaude without --bootstrap: block with clear message
631
- console.log();
632
- console.log('\x1b[31m%s\x1b[0m', `โŒ npx claude-code-autoconfig must be run from a regular terminal.`);
633
- console.log('\x1b[32m%s\x1b[0m', `โœ… Open a terminal outside Claude Code and run ๐Ÿ‘‰ npx claude-code-autoconfig@latest`);
634
- console.log();
635
- }
673
+ if (bootstrapMode) {
636
674
  process.exit(0);
637
675
  }
638
676
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-code-autoconfig",
3
- "version": "1.0.176",
3
+ "version": "1.0.178",
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",