claude-code-autoconfig 1.0.82 → 1.0.83

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.
@@ -0,0 +1,142 @@
1
+ <!-- @description Manages and installs updates to Claude Code configuration. -->
2
+
3
+ <!-- @applied
4
+ -->
5
+
6
+ # Autoconfig Update
7
+
8
+ Check for and install pending updates to your Claude Code configuration.
9
+
10
+ ## Step 1: Pull Latest Updates
11
+
12
+ Run this command via Bash to pull new update files from the latest package:
13
+
14
+ ```bash
15
+ npx claude-code-autoconfig@latest --pull-updates
16
+ ```
17
+
18
+ This copies any new update `.md` files into `.claude/updates/` and refreshes this command file (preserving the `@applied` block above).
19
+
20
+ After the command completes, check `.claude/updates/` directory. If it doesn't exist or is empty, output:
21
+
22
+ ```
23
+ No new updates available. You're up to date.
24
+ ```
25
+
26
+ Then stop — do not continue to further steps.
27
+
28
+ ## Step 2: Parse Update Files
29
+
30
+ Read all `.md` files in `.claude/updates/` matching the pattern `NNN-*.md` (e.g., `001-debug-methodology.md`).
31
+
32
+ For each file, extract metadata from the HTML comment headers at the top:
33
+
34
+ | Header | Pattern | Required |
35
+ |--------|---------|----------|
36
+ | `@title` | `<!-- @title (.+?) -->` | Yes |
37
+ | `@type` | `<!-- @type (.+?) -->` | Yes |
38
+ | `@description` | `<!-- @description (.+?) -->` | Yes |
39
+ | `@files` | `<!-- @files (.+?) -->` | Yes |
40
+
41
+ Extract the numeric ID from the filename prefix (e.g., `001` from `001-debug-methodology.md`).
42
+
43
+ Skip any files that are malformed (missing required headers) with a warning.
44
+
45
+ ## Step 3: Filter Already Applied
46
+
47
+ Parse the `<!-- @applied -->` block in THIS file (`.claude/commands/autoconfig-update.md`) to get the list of already-applied update IDs. Extract the three-digit ID from the start of each line.
48
+
49
+ Filter out any updates whose ID appears in the applied list. If no pending updates remain, output:
50
+
51
+ ```
52
+ All updates are already installed. You're up to date.
53
+ ```
54
+
55
+ Then stop.
56
+
57
+ ## Step 4: Display Summary
58
+
59
+ Output the pending updates as a numbered list:
60
+
61
+ ```
62
+ These are the latest updates to claude-code-autoconfig:
63
+
64
+ 001 - Debug Methodology
65
+ 002 - Some other feature
66
+ 003 - Another update
67
+
68
+ Press 1 to install all updates
69
+ Press 2 to review each update before install
70
+ ```
71
+
72
+ Wait for the user to respond with 1 or 2.
73
+
74
+ ## Step 5a: Install All (User picked 1)
75
+
76
+ For each pending update (in ID order):
77
+ 1. Read the update `.md` file body (everything below the metadata comments)
78
+ 2. Follow the instructions in the body to apply the update
79
+ 3. After successful application, append to the `@applied` block in THIS file:
80
+ ```
81
+ {id} - {title}
82
+ ```
83
+
84
+ After all updates are applied, go to Step 6.
85
+
86
+ ## Step 5b: Review Each (User picked 2)
87
+
88
+ For each pending update (in ID order), display a box:
89
+
90
+ ```
91
+ ╔══════════════════════════════════════════════════════════╗
92
+ ║ UPDATE {n} of {total} ⬡ {type} ║
93
+ ╠══════════════════════════════════════════════════════════╣
94
+ ║ ║
95
+ ║ {title} ║
96
+ ║ ║
97
+ ║ {description — wrap to fit within box borders} ║
98
+ ║ ║
99
+ ║ Files: {comma-separated list of files touched} ║
100
+ ║ ║
101
+ ╠══════════════════════════════════════════════════════════╣
102
+ ║ [y] Install [s] Skip [a] Install all remaining ║
103
+ ╚══════════════════════════════════════════════════════════╝
104
+ ```
105
+
106
+ **Box rendering rules:**
107
+ - Box width: 58 visible characters (including border chars)
108
+ - Use Unicode box-drawing characters: `╔ ═ ╗ ║ ╠ ╣ ╚ ╝`
109
+ - Pad content lines with spaces so right `║` aligns at column 58
110
+ - Wrap description text to fit within the borders (54 chars of content)
111
+ - `{n}` is the position in the pending list (1, 2, 3...), `{total}` is count of pending
112
+
113
+ **User actions:**
114
+ - `y` → Apply this update (follow body instructions), append to `@applied`, show next
115
+ - `s` → Skip this update (do NOT add to `@applied` — it will appear again next run)
116
+ - `a` → Apply this update AND all remaining updates without further prompts
117
+
118
+ After all updates are reviewed, go to Step 6.
119
+
120
+ ## Step 6: Summary and Cleanup
121
+
122
+ Show a summary of what happened:
123
+
124
+ ```
125
+ ✅ Installed: 001, 003
126
+ ⏭️ Skipped: 002
127
+
128
+ Run /autoconfig-update again anytime to install skipped updates.
129
+ ```
130
+
131
+ If all were installed:
132
+ ```
133
+ ✅ All updates installed.
134
+ ```
135
+
136
+ Then delete the `.claude/updates/` directory (it's ephemeral — updates are tracked in the @applied block above).
137
+
138
+ If the user installed any updates that modified `.claude/commands/autoconfig.md`, suggest:
139
+
140
+ ```
141
+ Run /sync-claude-md to apply these changes to your current project's CLAUDE.md.
142
+ ```
@@ -287,7 +287,29 @@ Set session-level env vars:
287
287
  - Optimize for Claude's efficiency, not human documentation
288
288
  - When uncertain, leave it out — Claude can ask or explore
289
289
 
290
- ## Step 7: Update the Docs
290
+ ## Step 7: Configure MEMORY.md
291
+
292
+ Claude Code has a persistent auto memory file (`MEMORY.md`) that loads into the system prompt at the start of every session. Write the debugging methodology to this file so Claude always follows evidence-based troubleshooting.
293
+
294
+ **Locate the MEMORY.md file:**
295
+
296
+ The file lives at `~/.claude/projects/{encoded-project-path}/memory/MEMORY.md` where the project path is encoded by replacing path separators with dashes and removing colons (e.g., `C:\CODE\my-project` becomes `C--CODE-my-project`).
297
+
298
+ **Write this content** (append if file already exists, create if it doesn't):
299
+
300
+ ```markdown
301
+ ## Debugging — Evidence Before Solutions
302
+ NEVER guess the root cause and jump to coding a fix. Always:
303
+ 1. Add logging / check actual data first
304
+ 2. Confirm root cause with evidence
305
+ 3. Only then propose and implement a fix
306
+ If you can't determine the cause from code alone, add diagnostic logging and verify with runtime data.
307
+ CRITICAL: A plausible-looking cause from code reading is NOT confirmed evidence. Even if a mismatch looks obvious across multiple files, verify with runtime data before implementing. The more "obvious" the cause looks, the more important it is to verify — that's when the temptation to skip evidence gathering is strongest.
308
+ ```
309
+
310
+ **Important**: Use the Write tool (or Edit to append). Do not skip this step — it ensures Claude investigates root causes before making changes in every future session.
311
+
312
+ ## Step 8: Update the Docs
291
313
 
292
314
  After populating CLAUDE.md, update the docs file preview to show the actual content:
293
315
 
@@ -306,7 +328,7 @@ This ensures double-clicking CLAUDE.md in the docs shows the real generated cont
306
328
 
307
329
  - macOS: `open .claude/docs/autoconfig.docs.html`
308
330
  - Linux: `xdg-open .claude/docs/autoconfig.docs.html`
309
- - Windows: `start .claude/docs/autoconfig.docs.html`
331
+ - Windows: `powershell -NoProfile -Command "Start-Process '.claude/docs/autoconfig.docs.html'"`
310
332
 
311
333
  If the docs file exists, output:
312
334
 
@@ -0,0 +1,24 @@
1
+ <!-- @description Runs tests, bumps version, commits, and publishes to npm. -->
2
+
3
+ # Publish
4
+
5
+ Run tests, bump the patch version, commit, push, and publish to npm.
6
+
7
+ ## Steps
8
+
9
+ 1. Run the project's test suite (`npm test`)
10
+ 2. **If tests fail, stop here.** Do not publish broken code.
11
+ 3. Check for uncommitted changes. If there are any:
12
+ a. Stage all changes (`git add -A`)
13
+ b. Generate a conventional commit message based on the diff
14
+ c. Commit the changes
15
+ 4. Bump the version: `npm version patch`
16
+ 5. Push the commit and tag: `git push && git push --tags`
17
+ 6. Publish to npm: `npm publish`
18
+ 7. Output the new version number on success
19
+
20
+ ## Important
21
+
22
+ - Always run tests before publishing — never skip this step
23
+ - If any step fails, stop immediately and report the error
24
+ - Do not use `--force` on publish unless the user explicitly asks
@@ -38,15 +38,10 @@ For each file in `.claude/` that is newer than the docs HTML:
38
38
 
39
39
  ## Step 3: Open Docs
40
40
 
41
- Open the docs in the default browser using the appropriate command for the OS:
41
+ Open the docs in the default browser. Use the command matching the current OS:
42
42
 
43
- ```bash
44
- # macOS
45
- open .claude/docs/autoconfig.docs.html
43
+ - **macOS:** `open .claude/docs/autoconfig.docs.html`
44
+ - **Linux:** `xdg-open .claude/docs/autoconfig.docs.html`
45
+ - **Windows:** `powershell -NoProfile -Command "Start-Process '.claude/docs/autoconfig.docs.html'"`
46
46
 
47
- # Linux
48
- xdg-open .claude/docs/autoconfig.docs.html
49
-
50
- # Windows
51
- start .claude/docs/autoconfig.docs.html
52
- ```
47
+ **Important:** If the command exits with a non-zero exit code or produces an error, tell the user the file failed to open and suggest they open it manually. Do NOT report success unless the command completed without error.
@@ -378,21 +378,38 @@
378
378
  background: var(--bg-secondary);
379
379
  border-radius: 8px;
380
380
  overflow: hidden;
381
- height: 375px;
381
+ height: 480px;
382
382
  position: relative;
383
383
  }
384
384
 
385
385
  .tree-side {
386
- padding: 16px;
386
+ display: flex;
387
+ flex-direction: column;
387
388
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Ubuntu', 'Roboto', 'Noto Sans', sans-serif;
388
389
  font-size: 13px;
389
390
  line-height: 1.4;
390
391
  border-right: 1px solid var(--bg-elevated);
391
- overflow-y: auto;
392
392
  flex-shrink: 0;
393
393
  height: 100%;
394
394
  }
395
395
 
396
+ .tree-content {
397
+ padding: 16px 16px 8px 16px;
398
+ overflow-y: auto;
399
+ overflow-x: hidden;
400
+ flex: 1;
401
+ min-height: 0;
402
+ }
403
+
404
+ .tree-footer-hint {
405
+ padding: 6px 16px;
406
+ font-size: 12px;
407
+ color: var(--text-secondary);
408
+ opacity: 0.5;
409
+ border-top: 1px solid var(--bg-elevated);
410
+ flex-shrink: 0;
411
+ }
412
+
396
413
  .tree-item {
397
414
  padding: 4px 8px;
398
415
  margin: 1px 0;
@@ -466,8 +483,11 @@
466
483
 
467
484
  .info-side {
468
485
  flex: 1;
469
- min-width: 200px;
486
+ min-width: 0;
487
+ height: 100%;
470
488
  overflow-y: auto;
489
+ overflow-x: hidden;
490
+ word-wrap: break-word;
471
491
  }
472
492
 
473
493
  .info-panel {
@@ -500,6 +520,13 @@
500
520
  color: var(--accent-cyan);
501
521
  }
502
522
 
523
+ .info-panel-hint {
524
+ margin-top: 20px;
525
+ font-size: 12px;
526
+ color: var(--text-secondary);
527
+ opacity: 0.5;
528
+ }
529
+
503
530
  /* Navigation */
504
531
  .nav-container {
505
532
  display: flex;
@@ -815,6 +842,12 @@
815
842
  <div class="slide-content">
816
843
  <div class="tree-panel">
817
844
  <div class="tree-side">
845
+ <div class="tree-content">
846
+ <div class="tree-item" data-info="memory-md">
847
+ <span class="tree-spacer"></span>
848
+ <span class="tree-file-icon">📄</span>
849
+ <span class="file">MEMORY.md</span>
850
+ </div>
818
851
  <div class="tree-item folder-row" data-info="root" data-folder="root">
819
852
  <span class="tree-chevron">›</span>
820
853
  <span class="tree-folder-icon">📁</span>
@@ -925,6 +958,8 @@
925
958
  <span class="tree-file-icon">📄</span>
926
959
  <span class="file">CLAUDE.md</span>
927
960
  </div>
961
+ </div>
962
+ <div class="tree-footer-hint">Double-click any file to preview contents</div>
928
963
  </div>
929
964
  <div class="info-side">
930
965
  <div class="info-panel" id="infoPanel">
@@ -1007,7 +1042,7 @@
1007
1042
 
1008
1043
  // Select CLAUDE.md by default when entering slide 0 (tree view)
1009
1044
  if (currentSlide === 0) {
1010
- setTimeout(() => selectTreeItemByKey('claude-md'), 100);
1045
+ setTimeout(() => selectTreeItemByKey('memory-md'), 100);
1011
1046
  }
1012
1047
  }
1013
1048
 
@@ -1037,7 +1072,7 @@
1037
1072
  });
1038
1073
 
1039
1074
  // Select CLAUDE.md on initial page load
1040
- setTimeout(() => selectTreeItemByKey('claude-md'), 300);
1075
+ setTimeout(() => selectTreeItemByKey('memory-md'), 300);
1041
1076
 
1042
1077
  // Keyboard navigation for slides
1043
1078
  document.addEventListener('keydown', (e) => {
@@ -1091,6 +1126,24 @@
1091
1126
  rootItem.querySelector('.folder').textContent = projectName + '/';
1092
1127
  }
1093
1128
 
1129
+ // Build full MEMORY.md path from project location
1130
+ function getMemoryPath() {
1131
+ try {
1132
+ const path = window.location.pathname;
1133
+ // Extract drive + full path up to .claude, then convert to Claude's encoding
1134
+ const claudeIdx = path.indexOf('.claude');
1135
+ if (claudeIdx > 0) {
1136
+ const projectPath = path.substring(0, claudeIdx - 1);
1137
+ // Claude encodes the path: C:\CODE\proj → C--CODE-proj
1138
+ const parts = projectPath.split('/').filter(p => p);
1139
+ const encoded = parts.join('-').replace(/:/g, '');
1140
+ return '~/.claude/projects/' + encoded + '/memory/MEMORY.md';
1141
+ }
1142
+ } catch (e) {}
1143
+ return '~/.claude/projects/' + projectName + '/memory/MEMORY.md';
1144
+ }
1145
+ const memoryPath = getMemoryPath();
1146
+
1094
1147
  // Calculate tree side width dynamically
1095
1148
  function setTreeWidth() {
1096
1149
  const treeSide = document.querySelector('.tree-side');
@@ -1120,7 +1173,8 @@
1120
1173
  });
1121
1174
 
1122
1175
  treeSide.style.width = (maxWidth + 32) + 'px';
1123
- treeSide.style.padding = '16px 8px';
1176
+ treeSide.style.paddingLeft = '8px';
1177
+ treeSide.style.paddingRight = '8px';
1124
1178
  }
1125
1179
 
1126
1180
  if (document.fonts && document.fonts.ready) {
@@ -1167,6 +1221,11 @@
1167
1221
 
1168
1222
  // Tree panel info data - UPDATED
1169
1223
  const treeInfo = {
1224
+ 'memory-md': {
1225
+ title: 'MEMORY.md',
1226
+ desc: 'Native Claude Code file — loaded into the system prompt at the start of every session. Autoconfig appends debugging methodology instructions here so Claude always follows evidence-based troubleshooting.<br><br><span style="color: var(--accent-orange);">Location: ' + memoryPath + '</span>',
1227
+ trigger: 'Loaded into system prompt automatically'
1228
+ },
1170
1229
  'root': {
1171
1230
  title: projectName,
1172
1231
  desc: 'The autoconfig adds CLAUDE.md at your project root and configuration files inside a .claude/ directory. Nothing else is touched.'
@@ -1267,7 +1326,7 @@
1267
1326
  const infoPanel = document.getElementById('infoPanel');
1268
1327
  const treeItems = document.querySelectorAll('.tree-item');
1269
1328
 
1270
- let selectedInfoKey = 'claude-md'; // Default selection
1329
+ let selectedInfoKey = 'memory-md'; // Default selection
1271
1330
 
1272
1331
  function showInfo(key) {
1273
1332
  const info = treeInfo[key];
@@ -1429,6 +1488,22 @@
1429
1488
 
1430
1489
  // File Preview Modal
1431
1490
  const fileContents = {
1491
+ 'memory-md': {
1492
+ filename: 'MEMORY.md',
1493
+ content: `# Native Claude Code File — Debugging instructions appended by autoconfig
1494
+
1495
+ Location: ` + memoryPath + `
1496
+
1497
+ ---
1498
+
1499
+ ## Debugging — Evidence Before Solutions
1500
+ NEVER guess the root cause and jump to coding a fix. Always:
1501
+ 1. Add logging / check actual data first
1502
+ 2. Confirm root cause with evidence
1503
+ 3. Only then propose and implement a fix
1504
+ If you can't determine the cause from code alone, add diagnostic logging and verify with runtime data.
1505
+ CRITICAL: A plausible-looking cause from code reading is NOT confirmed evidence. Even if a mismatch looks obvious across multiple files, verify with runtime data before implementing. The more "obvious" the cause looks, the more important it is to verify — that's when the temptation to skip evidence gathering is strongest.`
1506
+ },
1432
1507
  'claude-md': {
1433
1508
  filename: 'CLAUDE.md',
1434
1509
  content: `# Project Name
@@ -1443,29 +1518,50 @@
1443
1518
  "Read(./**)",
1444
1519
  "Edit(./**)",
1445
1520
  "Write(./**)",
1521
+ "Glob",
1522
+ "Grep",
1523
+ "WebSearch",
1524
+ "WebFetch",
1446
1525
  "Bash(npm run dev)",
1447
1526
  "Bash(npm run build)",
1527
+ "Bash(npm run lint)",
1528
+ "Bash(npm run lint:fix)",
1529
+ "Bash(npm run typecheck)",
1448
1530
  "Bash(npm run test)",
1531
+ "Bash(npm run test:*)",
1532
+ "Bash(npm run validate)",
1449
1533
  "Bash(git status)",
1450
1534
  "Bash(git diff:*)",
1451
1535
  "Bash(git add:*)",
1452
1536
  "Bash(git commit:*)",
1453
- "Bash(git push:*)"
1537
+ "Bash(git push:*)",
1538
+ "Bash(git pull)",
1539
+ "Bash(git checkout:*)",
1540
+ "Bash(git branch:*)",
1541
+ "Bash(ls:*)",
1542
+ "Bash(dir:*)",
1543
+ "Bash(mkdir:*)",
1544
+ "Bash(mkdir -p:*)",
1545
+ "Bash(start:*)",
1546
+ "Bash(start .claude:*)",
1547
+ "Bash(open:*)",
1548
+ "Bash(open .claude:*)",
1549
+ "Bash(xdg-open:*)",
1550
+ "Bash(xdg-open .claude:*)"
1454
1551
  ],
1455
1552
  "deny": [
1456
1553
  "Read(./.env)",
1457
1554
  "Read(./.env.*)",
1458
- "Read(./secrets/**)"
1555
+ "Read(./secrets/**)",
1556
+ "Read(./**/credentials.*)",
1557
+ "Read(./**/*.pem)",
1558
+ "Read(./**/*.key)",
1559
+ "Write(./nul)",
1560
+ "Edit(./nul)",
1561
+ "Bash(rm -rf:*)",
1562
+ "Bash(curl:*)",
1563
+ "Bash(wget:*)"
1459
1564
  ]
1460
- },
1461
- "hooks": {
1462
- "PostToolUse": [{
1463
- "matcher": "Edit|Write",
1464
- "hooks": [{
1465
- "type": "command",
1466
- "command": "// Auto-refresh docs when .claude/ changes"
1467
- }]
1468
- }]
1469
1565
  }
1470
1566
  }`
1471
1567
  },
@@ -1552,7 +1648,16 @@ Incrementally update the docs's treeInfo when \`.claude/\` files are added or mo
1552
1648
 
1553
1649
  Analyze this project and configure Claude Code with real context.
1554
1650
 
1555
- ## Step 1: Scan the Project
1651
+ **Setup Note**: During autoconfig, prefer Glob/Read/Write tools over Bash commands. This ensures smooth setup without permission prompts. Only use Bash for opening the guide at the end.
1652
+
1653
+ ## Step 1: Detect Environment
1654
+
1655
+ **Operating System:**
1656
+ Check the platform and note it for command syntax:
1657
+ - Windows → use \\\`del\\\`, \\\`rmdir\\\`, backslashes, \\\`.cmd\\\`/\\\`.ps1\\\` scripts
1658
+ - macOS/Linux → use \\\`rm\\\`, \\\`mkdir -p\\\`, forward slashes, \\\`.sh\\\` scripts
1659
+
1660
+ ## Step 2: Scan the Project
1556
1661
 
1557
1662
  Look for these indicators to understand the project:
1558
1663
 
@@ -1566,122 +1671,27 @@ Look for these indicators to understand the project:
1566
1671
  - \`*.csproj\` / \`*.sln\` → .NET
1567
1672
  - \`composer.json\` → PHP
1568
1673
 
1569
- **Framework Indicators:**
1570
- - \`next.config.*\` / \`app/\` directory → Next.js
1571
- - \`vite.config.*\` → Vite
1572
- - \`angular.json\` → Angular
1573
- - \`svelte.config.*\` → Svelte
1574
- - \`remix.config.*\` → Remix
1575
- - \`nuxt.config.*\` → Nuxt
1576
- - \`django\` in imports → Django
1577
- - \`flask\` in imports → Flask
1578
- - \`fastapi\` in imports → FastAPI
1579
- - \`express\` in dependencies → Express
1580
- - \`rails\` / \`Gemfile\` with rails → Rails
1581
- - \`laravel\` → Laravel
1582
-
1583
- **Testing Frameworks:**
1584
- - \`jest.config.*\` / \`@jest\` in deps → Jest
1585
- - \`vitest.config.*\` → Vitest
1586
- - \`pytest.ini\` / \`conftest.py\` → Pytest
1587
- - \`*_test.go\` files → Go testing
1588
- - \`*_spec.rb\` files → RSpec
1589
- - \`cypress/\` or \`playwright/\` → E2E testing
1590
-
1591
- **Infrastructure:**
1592
- - \`Dockerfile\` / \`docker-compose.*\` → Docker
1593
- - \`*.tf\` files → Terraform
1594
- - \`k8s/\` or \`kubernetes/\` → Kubernetes
1595
- - \`.github/workflows/\` → GitHub Actions
1596
- - \`serverless.yml\` → Serverless Framework
1597
-
1598
- ## Step 2: Populate CLAUDE.md
1599
-
1600
- Focus on what Claude Code actually needs to work effectively. Claude can explore the codebase itself — don't document what it can discover.
1601
-
1602
- **Always include:**
1603
- - **Project name + one-liner**: What is this thing?
1604
- - **Tech stack**: Runtime, framework, database, key services (so Claude uses correct patterns)
1605
- - **Commands**: How to run, test, build, deploy — Claude needs these to execute tasks
1606
- - **Non-obvious conventions**: Multi-schema databases, monorepo structure, unusual patterns Claude wouldn't infer
1607
-
1608
- **Include if relevant:**
1609
- - **Deployment flow**: If non-standard or involves multiple steps
1610
-
1611
- **Skip these — Claude can discover them:**
1612
- - Detailed project structure trees (Claude can run \`ls\` or \`tree\`)
1613
- - Exhaustive route/endpoint lists (Claude can grep)
1614
- - File-by-file descriptions (Claude can read files)
1615
- - Database model lists (Claude can read schema files)
1616
-
1617
- **Keep it tight.** A 30-line CLAUDE.md that hits the essentials beats a 200-line doc Claude has to parse every session.
1618
-
1619
- ## Step 3: Create Rules Directory
1620
-
1621
- Create an empty \`.claude/rules/\` directory. Do not create any subdirectories or rule files.
1622
-
1623
- 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.
1624
-
1625
- ## Step 4: Configure Settings
1626
-
1627
- Update \`.claude/settings.json\` using the official schema.
1628
-
1629
- ### Deny Patterns (files Claude shouldn't read/write)
1630
-
1631
- Use \`Read()\` for blocking reads, \`Edit()\` for blocking writes:
1674
+ **Framework/Testing/Infrastructure** indicators also scanned.
1632
1675
 
1633
- **Always deny (security):**
1634
- \`\`\`
1635
- Read(./.env)
1636
- Read(./.env.*)
1637
- Read(./secrets/**)
1638
- Edit(./.env)
1639
- Edit(./.env.*)
1640
- \`\`\`
1676
+ ## Step 2b: Detect Version Divergence
1641
1677
 
1642
- **Often deny (generated/vendor):**
1643
- \`\`\`
1644
- Edit(./node_modules/**)
1645
- Edit(./dist/**)
1646
- Edit(./.git/**)
1647
- \`\`\`
1678
+ Scans for version declarations across the project. Flags mismatches between package.json, hardcoded constants, manifest files, etc.
1648
1679
 
1649
- ### Allow Patterns (auto-approve without prompting)
1680
+ ## Step 3: Populate CLAUDE.md
1650
1681
 
1651
- Use \`Bash()\` patterns with prefix matching:
1682
+ Focus on what Claude Code actually needs. Keep it tight — 30 lines beats 200.
1652
1683
 
1653
- \`\`\`
1654
- Bash(npm run test:*)
1655
- Bash(npm run lint:*)
1656
- Bash(npm run build)
1657
- \`\`\`
1684
+ **Always include:** Project name, tech stack, commands, non-obvious conventions.
1685
+ **Skip:** File trees, endpoint lists, model lists — Claude discovers these.
1658
1686
 
1659
- ### Environment Variables
1660
-
1661
- Set session-level env vars:
1662
-
1663
- \`\`\`json
1664
- {
1665
- "env": {
1666
- "NODE_ENV": "development"
1667
- }
1668
- }
1669
- \`\`\`
1670
-
1671
- **Keep it minimal** — only include patterns that actually exist in this project.
1672
-
1673
- ## Guidelines
1674
-
1675
- - Replace ALL placeholder content with real values from THIS project
1676
- - Delete sections that don't apply — no empty stubs
1677
- - Optimize for Claude's efficiency, not human documentation
1678
- - When uncertain, leave it out — Claude can ask or explore
1687
+ ## Step 4: Create Rules Directory
1688
+ ## Step 5: Configure Formatter (JS/Node Projects)
1689
+ ## Step 6: Configure Settings
1690
+ ## Step 7: Update the Docs
1679
1691
 
1680
1692
  ## After Completion
1681
1693
 
1682
- Once autoconfig is complete, prompt the user:
1683
-
1684
- **Run \`/show-docs\` for an interactive walkthrough of your new Claude Code project setup.**`
1694
+ Opens interactive docs in browser. Clean finale message.`
1685
1695
  },
1686
1696
  'commit-and-push': {
1687
1697
  filename: 'commit-and-push.md',
@@ -1778,19 +1788,35 @@ Work through items: "Fix retro #001"`
1778
1788
  Add corrections and guidance here when Claude does something wrong.
1779
1789
  Claude reads this directory and learns for next time.
1780
1790
 
1781
- ## YYYY-MM-DD: Brief title
1791
+ ---
1792
+
1793
+ ## Debugging Methodology — Evidence Before Solutions
1794
+
1795
+ **NEVER jump to a fix based on assumptions.** When investigating a bug:
1796
+
1797
+ 1. **Gather evidence first** — add logging, check server logs, inspect actual data
1798
+ 2. **Confirm the root cause** — present findings to the user with evidence
1799
+ 3. **Only then propose a fix** — based on what you observed, not what you guessed
1800
+
1801
+ ---
1802
+
1803
+ ## Design Principles
1804
+
1805
+ - Each file should have a single responsibility
1806
+ - If a file exceeds 500 LOC, look for decomposition opportunities
1807
+ - Keep cyclomatic complexity under 10 per function
1808
+
1809
+ ## Development Rules
1782
1810
 
1783
- Describe what Claude did wrong and what to do instead.
1784
- Keep entries brief and actionable.
1811
+ ### Testing Requirements
1785
1812
 
1786
- Example:
1813
+ **CRITICAL: Before committing changes to bin/cli.js, run tests:**
1814
+ \\\`npm test\\\`
1787
1815
 
1788
- ## 2026-01-06: Don't use deprecated API
1789
- Claude used \`oldFunction()\` instead of \`newFunction()\`.
1790
- Always use the v2 API for user endpoints.
1816
+ ### Box Drawing Guidelines
1791
1817
 
1792
- ## 2026-01-07: Test database naming
1793
- Use \`test_\` prefix for test databases, not \`dev_\`.`
1818
+ All lines must be exactly 46 visible characters wide (including borders).
1819
+ ANSI escape codes don't count toward visible width.`
1794
1820
  },
1795
1821
  'hooks': {
1796
1822
  filename: 'hooks/',
@@ -7,6 +7,23 @@ Claude reads this directory and learns for next time.
7
7
 
8
8
  ---
9
9
 
10
+ ## Debugging Methodology — Evidence Before Solutions
11
+
12
+ **NEVER jump to a fix based on assumptions.** When investigating a bug:
13
+
14
+ 1. **Gather evidence first** — add logging, check server logs, inspect actual data
15
+ 2. **Confirm the root cause** — present findings to the user with evidence
16
+ 3. **Only then propose a fix** — based on what you observed, not what you guessed
17
+
18
+ If you can't determine the root cause from code reading alone, **add diagnostic logging** and ask the user to reproduce. Do NOT:
19
+ - Guess the root cause and immediately start coding a fix
20
+ - Assume data mismatches without checking the actual data
21
+ - Rewrite logic because you think values "might" differ
22
+
23
+ The cost of a wrong fix is high: wasted time, unnecessary code complexity, and potentially masking the real issue.
24
+
25
+ ---
26
+
10
27
  ## Design Principles
11
28
 
12
29
  - Each file should have a single responsibility (one reason to change)
@@ -0,0 +1,24 @@
1
+ <!-- @title Debug Methodology -->
2
+ <!-- @type feature -->
3
+ <!-- @description Ensures Claude investigates root cause before making changes instead of guessing -->
4
+ <!-- @files MEMORY.md -->
5
+
6
+ # Apply Debug Methodology Update
7
+
8
+ Add the following to the user's `MEMORY.md` file (Claude's persistent auto memory). This ensures the debugging methodology is always loaded into Claude's system prompt for every session.
9
+
10
+ ## Content to Add
11
+
12
+ ```markdown
13
+ ## Debugging — Evidence Before Solutions
14
+ NEVER guess the root cause and jump to coding a fix. Always:
15
+ 1. Add logging / check actual data first
16
+ 2. Confirm root cause with evidence
17
+ 3. Only then propose and implement a fix
18
+ If you can't determine the cause from code alone, add diagnostic logging and verify with runtime data.
19
+ CRITICAL: A plausible-looking cause from code reading is NOT confirmed evidence. Even if a mismatch looks obvious across multiple files, verify with runtime data before implementing. The more "obvious" the cause looks, the more important it is to verify — that's when the temptation to skip evidence gathering is strongest.
20
+ ```
21
+
22
+ ## After Applying
23
+
24
+ Inform the user: "Debug methodology added to MEMORY.md. It will be active in every future Claude session for this project."
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', 'guide', 'agents', 'migration', 'hooks'];
30
+ const AUTOCONFIG_FILES = ['commands', 'guide', 'agents', 'migration', 'hooks', 'updates'];
31
31
 
32
32
  function isReservedName(name) {
33
33
  const baseName = name.replace(/\.[^.]*$/, '').toUpperCase();
@@ -63,6 +63,95 @@ function formatTimestamp() {
63
63
  return `${month}-${day}-${year}_${hour12}-${min}${ampm}`;
64
64
  }
65
65
 
66
+ // --pull-updates: Copy new update files from package to user's project
67
+ function parseAppliedUpdates(filePath) {
68
+ if (!fs.existsSync(filePath)) return [];
69
+ const content = fs.readFileSync(filePath, 'utf8');
70
+ const match = content.match(/<!-- @applied\n([\s\S]*?)-->/);
71
+ if (!match) return [];
72
+
73
+ return match[1].trim().split('\n')
74
+ .filter(line => line.trim())
75
+ .map(line => {
76
+ const idMatch = line.match(/^(\d{3})/);
77
+ return idMatch ? parseInt(idMatch[1], 10) : 0;
78
+ })
79
+ .filter(id => id > 0);
80
+ }
81
+
82
+ function getHighestAppliedId(appliedIds) {
83
+ return appliedIds.length > 0 ? Math.max(...appliedIds) : 0;
84
+ }
85
+
86
+ function pullUpdates() {
87
+ console.log('\x1b[36m%s\x1b[0m', '🔄 Checking for updates...');
88
+ console.log();
89
+
90
+ const userCmdPath = path.join(cwd, '.claude', 'commands', 'autoconfig-update.md');
91
+ const packageCmdPath = path.join(packageDir, '.claude', 'commands', 'autoconfig-update.md');
92
+ const packageUpdatesDir = path.join(packageDir, '.claude', 'updates');
93
+ const userUpdatesDir = path.join(cwd, '.claude', 'updates');
94
+
95
+ // Ensure .claude/commands/ exists
96
+ fs.mkdirSync(path.join(cwd, '.claude', 'commands'), { recursive: true });
97
+
98
+ // Refresh autoconfig-update.md (preserve user's @applied block)
99
+ if (fs.existsSync(packageCmdPath)) {
100
+ if (fs.existsSync(userCmdPath)) {
101
+ const userContent = fs.readFileSync(userCmdPath, 'utf8');
102
+ const packageContent = fs.readFileSync(packageCmdPath, 'utf8');
103
+ const userApplied = userContent.match(/<!-- @applied[\s\S]*?-->/);
104
+ if (userApplied) {
105
+ const merged = packageContent.replace(/<!-- @applied[\s\S]*?-->/, userApplied[0]);
106
+ fs.writeFileSync(userCmdPath, merged);
107
+ } else {
108
+ fs.copyFileSync(packageCmdPath, userCmdPath);
109
+ }
110
+ } else {
111
+ fs.copyFileSync(packageCmdPath, userCmdPath);
112
+ }
113
+ }
114
+
115
+ // Check for available updates in package
116
+ if (!fs.existsSync(packageUpdatesDir)) {
117
+ console.log('\x1b[32m%s\x1b[0m', '✅ Already up to date');
118
+ return;
119
+ }
120
+
121
+ const appliedIds = parseAppliedUpdates(userCmdPath);
122
+ const highestApplied = getHighestAppliedId(appliedIds);
123
+
124
+ const updateFiles = fs.readdirSync(packageUpdatesDir).filter(f => f.endsWith('.md'));
125
+ const newUpdates = updateFiles.filter(file => {
126
+ const match = file.match(/^(\d{3})-/);
127
+ if (!match) return false;
128
+ return parseInt(match[1], 10) > highestApplied;
129
+ });
130
+
131
+ if (newUpdates.length === 0) {
132
+ console.log('\x1b[32m%s\x1b[0m', '✅ Already up to date');
133
+ return;
134
+ }
135
+
136
+ // Copy new update files
137
+ fs.mkdirSync(userUpdatesDir, { recursive: true });
138
+ for (const file of newUpdates) {
139
+ fs.copyFileSync(
140
+ path.join(packageUpdatesDir, file),
141
+ path.join(userUpdatesDir, file)
142
+ );
143
+ }
144
+
145
+ console.log('\x1b[32m%s\x1b[0m', `✅ Copied ${newUpdates.length} new update${newUpdates.length > 1 ? 's' : ''} to .claude/updates/`);
146
+ console.log();
147
+ console.log('Run \x1b[36mclaude /autoconfig-update\x1b[0m to review and install updates.');
148
+ }
149
+
150
+ if (process.argv.includes('--pull-updates')) {
151
+ pullUpdates();
152
+ process.exit(0);
153
+ }
154
+
66
155
  console.log('\x1b[36m%s\x1b[0m', '🚀 Claude Code Autoconfig');
67
156
  console.log();
68
157
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-code-autoconfig",
3
- "version": "1.0.82",
3
+ "version": "1.0.83",
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",
@@ -22,9 +22,10 @@
22
22
  "cli"
23
23
  ],
24
24
  "scripts": {
25
- "test": "node test/box-alignment.test.js && node test/cli-install.test.js",
25
+ "test": "node test/box-alignment.test.js && node test/cli-install.test.js && node test/update-system.test.js",
26
26
  "test:box": "node test/box-alignment.test.js",
27
- "test:install": "node test/cli-install.test.js"
27
+ "test:install": "node test/cli-install.test.js",
28
+ "test:update": "node test/update-system.test.js"
28
29
  },
29
30
  "bin": {
30
31
  "claude-code-autoconfig": "./bin/cli.js"