claude-code-autoconfig 1.0.168 → 1.0.169
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/extract-rules.md +128 -0
- package/.claude/docs/autoconfig.docs.html +44 -2
- package/CHANGELOG.md +3 -3
- package/README.md +2 -0
- package/package.json +1 -1
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
<!-- @description Scan Claude artifacts and propose structured rules for .claude/rules/ -->
|
|
2
|
+
<!-- @version 1 -->
|
|
3
|
+
<!-- @param mode | string | optional | "preview" (default) shows proposals, "apply" writes and cleans sources -->
|
|
4
|
+
<!-- @response success | Rules extracted and optionally applied with source cleanup. -->
|
|
5
|
+
<!-- @response no-rules | No extractable rules found in scanned sources. -->
|
|
6
|
+
<!-- @sideeffect May create .claude/rules/ files and remove extracted content from source files -->
|
|
7
|
+
<!-- @example /extract-rules | Preview proposed rules without writing -->
|
|
8
|
+
<!-- @example /extract-rules --apply | Write rules and clean up sources -->
|
|
9
|
+
|
|
10
|
+
# Extract Rules
|
|
11
|
+
|
|
12
|
+
Scan all Claude configuration artifacts and propose structured rules for `.claude/rules/`.
|
|
13
|
+
|
|
14
|
+
## Step 0: Git safety check
|
|
15
|
+
|
|
16
|
+
Before doing anything else, check for uncommitted changes:
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
git status --porcelain
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
If there are uncommitted changes, show this warning and wait for confirmation:
|
|
23
|
+
|
|
24
|
+
> **Warning:** This command will modify files (extract rules from sources and optionally clean up originals). You have uncommitted changes.
|
|
25
|
+
>
|
|
26
|
+
> Commit your work before proceeding, or type "continue" to proceed anyway.
|
|
27
|
+
|
|
28
|
+
If the working tree is clean, proceed silently.
|
|
29
|
+
|
|
30
|
+
## Step 1: Discover sources
|
|
31
|
+
|
|
32
|
+
Scan these locations for `.md` files containing potential rules. **Skip any that don't exist** — not all projects have all of these:
|
|
33
|
+
|
|
34
|
+
1. `CLAUDE.md` (project root)
|
|
35
|
+
2. `CLAUDE.local.md` (project root, if present)
|
|
36
|
+
3. All `.md` files in `.claude/` recursively (feedback, commands, etc.) — **excluding** `.claude/rules/` and `.claude/commands/extract-rules.md`
|
|
37
|
+
4. Any nested `CLAUDE.md` files in subdirectories (e.g., `src/CLAUDE.md`)
|
|
38
|
+
5. `.claude/settings.json` (hooks section — behavioral rules implied by hooks)
|
|
39
|
+
|
|
40
|
+
Also read all existing `.claude/rules/` files to avoid proposing duplicates.
|
|
41
|
+
|
|
42
|
+
## Step 2: Extract candidate rules
|
|
43
|
+
|
|
44
|
+
A rule is a **deterministic behavioral instruction** that Claude should follow when working on specific files or file patterns. Good rules are:
|
|
45
|
+
|
|
46
|
+
- **Actionable**: "Do X" or "Never do Y" — not background context
|
|
47
|
+
- **Scoped**: Applies to specific files, directories, or file patterns
|
|
48
|
+
- **Not already enforced**: Skip anything already handled by hooks, settings, or linting
|
|
49
|
+
- **Not ephemeral**: Skip project status, session notes, debugging histories
|
|
50
|
+
|
|
51
|
+
**Skip these** (they belong in other artifacts):
|
|
52
|
+
- Domain knowledge / business logic explanations → stay in their source doc
|
|
53
|
+
- Slash command definitions → stay in `commands/`
|
|
54
|
+
- Session-specific debugging notes → stay in memory
|
|
55
|
+
- Deployment / operational procedures → stay in their source doc
|
|
56
|
+
|
|
57
|
+
## Step 3: Deduplicate
|
|
58
|
+
|
|
59
|
+
- If a candidate rule already exists in `.claude/rules/` (same intent, even if worded differently), skip it
|
|
60
|
+
- If the same guidance appears in multiple sources, note all sources but propose one rule
|
|
61
|
+
- Group related rules into single files when they share the same `paths` scope. If two imperatives apply to the same files, they belong in one rule file. If they target different files, keep them separate — even if topically related.
|
|
62
|
+
|
|
63
|
+
## Step 4: Rate confidence
|
|
64
|
+
|
|
65
|
+
For each proposed rule, assign a confidence level:
|
|
66
|
+
|
|
67
|
+
- **HIGH** — Explicit imperative instruction ("never do X", "always do Y", "must use Z", "prefer X over Y"). The source text literally contains an imperative. Extract these.
|
|
68
|
+
- **SKIP** — Everything else: inferred conventions, contextual guidance, implementation details derivable from the code. Do not propose these.
|
|
69
|
+
|
|
70
|
+
## Step 5: Output proposals
|
|
71
|
+
|
|
72
|
+
For each HIGH-confidence rule, output:
|
|
73
|
+
|
|
74
|
+
```
|
|
75
|
+
### Rule: <short name>
|
|
76
|
+
**Source**: <file(s) it was extracted from>
|
|
77
|
+
**Paths**: <e.g., `src/background.ts`, `src/**/*.ts`, `*.ts`>
|
|
78
|
+
**File name**: <proposed .claude/rules/ filename, e.g., `linkedin-selectors.md`>
|
|
79
|
+
|
|
80
|
+
--- file content ---
|
|
81
|
+
---
|
|
82
|
+
paths:
|
|
83
|
+
- "src/background.ts"
|
|
84
|
+
- "src/**/*.ts"
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
<rule content here>
|
|
88
|
+
--- end file content ---
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
The file content block must include proper YAML frontmatter with `paths` as an array. This is the exact format Claude Code expects.
|
|
92
|
+
|
|
93
|
+
**Validate paths**: Before proposing a rule, use Glob to verify that at least one `paths` pattern matches existing files in the project. If no files match, flag it with `⚠️ no matching files` and exclude it from the proposal. Dead rules erode trust.
|
|
94
|
+
|
|
95
|
+
At the end, show a summary table:
|
|
96
|
+
|
|
97
|
+
| # | Rule file | Paths | Source(s) | Status |
|
|
98
|
+
|---|-----------|-------|-----------|--------|
|
|
99
|
+
|
|
100
|
+
Status column: `NEW` if no prior rule exists, `UPDATE` if it would merge with/extend an existing rule, `SKIP` if already covered.
|
|
101
|
+
|
|
102
|
+
After the table, show a stats line:
|
|
103
|
+
|
|
104
|
+
> Scanned **N** sources · Extracted **X** rules · Skipped **Y** candidates
|
|
105
|
+
|
|
106
|
+
## Step 6: Apply or wait
|
|
107
|
+
|
|
108
|
+
- **Default (preview mode)**: Do NOT create any files. Wait for user approval.
|
|
109
|
+
- **If `--apply` argument is passed**: Write all proposed rules directly, then proceed to Step 7.
|
|
110
|
+
|
|
111
|
+
After user approves in preview mode, write the rule files and proceed to Step 7.
|
|
112
|
+
|
|
113
|
+
## Step 7: Source cleanup
|
|
114
|
+
|
|
115
|
+
After writing rules, remove the extracted content from the original source files:
|
|
116
|
+
|
|
117
|
+
1. For each written rule, locate the original text in the source file(s)
|
|
118
|
+
2. Remove the extracted lines from the source — do not leave comments or placeholders
|
|
119
|
+
3. If removing content leaves an empty section (e.g., a `## Discoveries` section with no remaining entries), remove the section heading too
|
|
120
|
+
4. Preserve all non-extracted content in the source file
|
|
121
|
+
|
|
122
|
+
Show what was cleaned:
|
|
123
|
+
|
|
124
|
+
```
|
|
125
|
+
Cleaned sources:
|
|
126
|
+
CLAUDE.md — removed 3 lines (2 rules extracted)
|
|
127
|
+
.claude/feedback/FEEDBACK.md — removed 1 line (1 rule extracted)
|
|
128
|
+
```
|
|
@@ -883,6 +883,11 @@
|
|
|
883
883
|
<span class="tree-file-icon">📄</span>
|
|
884
884
|
<span class="file">enable-retro.md</span>
|
|
885
885
|
</div>
|
|
886
|
+
<div class="tree-item indent-3 hidden" data-info="extract-rules" data-parent="commands">
|
|
887
|
+
<span class="tree-spacer"></span>
|
|
888
|
+
<span class="tree-file-icon">📄</span>
|
|
889
|
+
<span class="file">extract-rules.md</span>
|
|
890
|
+
</div>
|
|
886
891
|
<div class="tree-item indent-3 hidden" data-info="gls" data-parent="commands">
|
|
887
892
|
<span class="tree-spacer"></span>
|
|
888
893
|
<span class="tree-file-icon">📄</span>
|
|
@@ -1263,7 +1268,7 @@
|
|
|
1263
1268
|
title: '.claude/ Directory',
|
|
1264
1269
|
desc: 'Commands, rules, settings, and these docs. Keeps configuration organized as your project grows.'
|
|
1265
1270
|
},
|
|
1266
|
-
|
|
1271
|
+
'rules': {
|
|
1267
1272
|
title: 'rules/',
|
|
1268
1273
|
desc: 'Path-scoped context that loads when Claude works on matching files.'
|
|
1269
1274
|
},
|
|
@@ -1303,6 +1308,11 @@
|
|
|
1303
1308
|
desc: '(Experimental) Enable Claude to log tech debt it encounters into .claude/retro.<div style="margin-top: 12px;"><strong>Parameters</strong><div style="margin-top: 4px; opacity: 0.6;">None</div></div><div style="margin-top: 12px;"><strong>Responses</strong><table style="width: 100%; margin-top: 6px; border-collapse: collapse; font-size: 0.9em; text-align: left;"><tr style="text-align: left; border-bottom: 1px solid var(--border);"><th style="padding: 4px 8px 4px 0;">Status</th><th style="padding: 4px 8px 4px 0;">Description</th></tr><tr style="border-bottom: 1px solid var(--border);"><td style="padding: 4px 8px 4px 0; vertical-align: top; white-space: nowrap;"><code>success</code></td><td style="padding: 4px 8px 4px 0; vertical-align: top;">Retro enabled — Claude will log tech debt to .claude/retro/ when encountered.</td></tr></table></div><div style="margin-top: 12px;"><strong>Side Effects</strong><div style="margin-top: 4px; font-size: 0.9em;">Creates .claude/retro/README.md, adds agent, updates CLAUDE.md</div></div><div style="margin-top: 12px;"><strong>Examples</strong><div style="margin-top: 6px; background: var(--bg-elevated); border-radius: 6px; padding: 8px 12px; font-family: monospace; font-size: 0.85em;"><div><code>/enable-retro</code> <span style="opacity: 0.6;">— Activate tech debt tracking</span></div></div></div>',
|
|
1304
1309
|
trigger: '/enable-retro'
|
|
1305
1310
|
},
|
|
1311
|
+
'extract-rules': {
|
|
1312
|
+
title: 'extract-rules.md',
|
|
1313
|
+
desc: 'Scan Claude artifacts and propose structured rules for .claude/rules/<div style="margin-top: 12px;"><strong>Parameters</strong><table style="width: 100%; margin-top: 6px; border-collapse: collapse; font-size: 0.9em; text-align: left;"><tr style="text-align: left; border-bottom: 1px solid var(--border);"><th style="padding: 4px 8px 4px 0;">Name</th><th style="padding: 4px 8px 4px 0;">Type</th><th style="padding: 4px 8px 4px 0;">Required</th><th style="padding: 4px 8px 4px 0;">Description</th></tr><tr style="border-bottom: 1px solid var(--border);"><td style="padding: 4px 8px 4px 0; vertical-align: top; white-space: nowrap;"><code>mode</code></td><td style="padding: 4px 8px 4px 0; vertical-align: top;"><code>string</code></td><td style="padding: 4px 8px 4px 0; vertical-align: top;">optional</td><td style="padding: 4px 8px 4px 0; vertical-align: top;">"preview" (default) shows proposals, "apply" writes and cleans sources</td></tr></table></div><div style="margin-top: 12px;"><strong>Responses</strong><table style="width: 100%; margin-top: 6px; border-collapse: collapse; font-size: 0.9em; text-align: left;"><tr style="text-align: left; border-bottom: 1px solid var(--border);"><th style="padding: 4px 8px 4px 0;">Status</th><th style="padding: 4px 8px 4px 0;">Description</th></tr><tr style="border-bottom: 1px solid var(--border);"><td style="padding: 4px 8px 4px 0; vertical-align: top; white-space: nowrap;"><code>success</code></td><td style="padding: 4px 8px 4px 0; vertical-align: top;">Rules extracted and optionally applied with source cleanup.</td></tr><tr style="border-bottom: 1px solid var(--border);"><td style="padding: 4px 8px 4px 0; vertical-align: top; white-space: nowrap;"><code>no-rules</code></td><td style="padding: 4px 8px 4px 0; vertical-align: top;">No extractable rules found in scanned sources.</td></tr></table></div><div style="margin-top: 12px;"><strong>Side Effects</strong><div style="margin-top: 4px; font-size: 0.9em;">May create .claude/rules/ files and remove extracted content from source files</div></div><div style="margin-top: 12px;"><strong>Examples</strong><div style="margin-top: 6px; background: var(--bg-elevated); border-radius: 6px; padding: 8px 12px; font-family: monospace; font-size: 0.85em;"><div><code>/extract-rules</code> <span style="opacity: 0.6;">— Preview proposed rules without writing</span></div><div><code>/extract-rules --apply</code> <span style="opacity: 0.6;">— Write rules and clean up sources</span></div></div></div>',
|
|
1314
|
+
trigger: '/extract-rules'
|
|
1315
|
+
},
|
|
1306
1316
|
'gls': {
|
|
1307
1317
|
title: 'gls.md',
|
|
1308
1318
|
desc: 'Get the latest screenshot(s) and display them.<div style="margin-top: 12px;"><strong>Parameters</strong><table style="width: 100%; margin-top: 6px; border-collapse: collapse; font-size: 0.9em; text-align: left;"><tr style="text-align: left; border-bottom: 1px solid var(--border);"><th style="padding: 4px 8px 4px 0;">Name</th><th style="padding: 4px 8px 4px 0;">Type</th><th style="padding: 4px 8px 4px 0;">Required</th><th style="padding: 4px 8px 4px 0;">Description</th></tr><tr style="border-bottom: 1px solid var(--border);"><td style="padding: 4px 8px 4px 0; vertical-align: top; white-space: nowrap;"><code>count</code></td><td style="padding: 4px 8px 4px 0; vertical-align: top;"><code>integer</code></td><td style="padding: 4px 8px 4px 0; vertical-align: top;">optional</td><td style="padding: 4px 8px 4px 0; vertical-align: top;">Number of screenshots to display. Use /gls-N syntax. Default: 1. Min: 1.</td></tr><tr style="border-bottom: 1px solid var(--border);"><td style="padding: 4px 8px 4px 0; vertical-align: top; white-space: nowrap;"><code>path</code></td><td style="padding: 4px 8px 4px 0; vertical-align: top;"><code>string</code></td><td style="padding: 4px 8px 4px 0; vertical-align: top;">optional</td><td style="padding: 4px 8px 4px 0; vertical-align: top;">Screenshot directory path. Saved for future use. Auto-detected if omitted.</td></tr></table></div><div style="margin-top: 12px;"><strong>Responses</strong><table style="width: 100%; margin-top: 6px; border-collapse: collapse; font-size: 0.9em; text-align: left;"><tr style="text-align: left; border-bottom: 1px solid var(--border);"><th style="padding: 4px 8px 4px 0;">Status</th><th style="padding: 4px 8px 4px 0;">Description</th></tr><tr style="border-bottom: 1px solid var(--border);"><td style="padding: 4px 8px 4px 0; vertical-align: top; white-space: nowrap;"><code>success</code></td><td style="padding: 4px 8px 4px 0; vertical-align: top;">Displays requested screenshot(s) from newest to oldest.</td></tr><tr style="border-bottom: 1px solid var(--border);"><td style="padding: 4px 8px 4px 0; vertical-align: top; white-space: nowrap;"><code>no-screenshots</code></td><td style="padding: 4px 8px 4px 0; vertical-align: top;">Directory exists but contains no image files.</td></tr><tr style="border-bottom: 1px solid var(--border);"><td style="padding: 4px 8px 4px 0; vertical-align: top; white-space: nowrap;"><code>no-directory</code></td><td style="padding: 4px 8px 4px 0; vertical-align: top;">Unable to detect screenshot directory — prompts for path.</td></tr></table></div><div style="margin-top: 12px;"><strong>Side Effects</strong><div style="margin-top: 4px; font-size: 0.9em;">Saves detected screenshot path to .claude/cca.config.json on first run</div></div><div style="margin-top: 12px;"><strong>Examples</strong><div style="margin-top: 6px; background: var(--bg-elevated); border-radius: 6px; padding: 8px 12px; font-family: monospace; font-size: 0.85em;"><div><code>/gls</code> <span style="opacity: 0.6;">— Display the most recent screenshot</span></div><div><code>/gls-3</code> <span style="opacity: 0.6;">— Display the 3 most recent screenshots</span></div><div><code>/gls /path/to/dir</code> <span style="opacity: 0.6;">— Use a specific screenshot directory</span></div></div></div>',
|
|
@@ -1569,7 +1579,7 @@ CRITICAL: A plausible-looking cause from code reading is NOT confirmed evidence.
|
|
|
1569
1579
|
|
|
1570
1580
|
> Run \`/autoconfig\` to populate this based on your project.`
|
|
1571
1581
|
},
|
|
1572
|
-
|
|
1582
|
+
'autoconfig-update': {
|
|
1573
1583
|
filename: 'autoconfig-update.md',
|
|
1574
1584
|
content: `<!-- @applied
|
|
1575
1585
|
-->
|
|
@@ -1689,6 +1699,38 @@ Each item is a structured story file with:
|
|
|
1689
1699
|
|
|
1690
1700
|
- "Fix retro #001" — Work on a specific item
|
|
1691
1701
|
- "What's in the retro backlog?" — List pending items`
|
|
1702
|
+
},
|
|
1703
|
+
'extract-rules': {
|
|
1704
|
+
filename: 'extract-rules.md',
|
|
1705
|
+
content: `# Extract Rules
|
|
1706
|
+
|
|
1707
|
+
Scan all Claude configuration artifacts and propose structured rules for \`.claude/rules/\`.
|
|
1708
|
+
|
|
1709
|
+
## Step 0: Git safety check
|
|
1710
|
+
|
|
1711
|
+
Before doing anything else, check for uncommitted changes:
|
|
1712
|
+
|
|
1713
|
+
\`\`\`bash
|
|
1714
|
+
git status --porcelain
|
|
1715
|
+
\`\`\`
|
|
1716
|
+
|
|
1717
|
+
If there are uncommitted changes, show this warning and wait for confirmation:
|
|
1718
|
+
|
|
1719
|
+
> **Warning:** This command will modify files (extract rules from sources and optionally clean up originals). You have uncommitted changes.
|
|
1720
|
+
>
|
|
1721
|
+
> Commit your work before proceeding, or type "continue" to proceed anyway.
|
|
1722
|
+
|
|
1723
|
+
If the working tree is clean, proceed silently.
|
|
1724
|
+
|
|
1725
|
+
## Step 1: Discover sources
|
|
1726
|
+
|
|
1727
|
+
Scan these locations for \`.md\` files containing potential rules. **Skip any that don't exist** — not all projects have all of these:
|
|
1728
|
+
|
|
1729
|
+
1. \`CLAUDE.md\` (project root)
|
|
1730
|
+
2. \`CLAUDE.local.md\` (project root, if present)
|
|
1731
|
+
3. All \`.md\` files in \`.claude/\` recursively (feedback, commands, etc.) — **excluding** \`.claude/rules/\` and \`.claude/commands/extract-rules.md\`
|
|
1732
|
+
4. Any nested \`CLAUDE.md\` files in subdirectories (e.g., \`src/CLAUDE.md\`)
|
|
1733
|
+
5. \`.claude/settings.json\` (hooks section — behavioral rules implied by hooks)`
|
|
1692
1734
|
},
|
|
1693
1735
|
'gls': {
|
|
1694
1736
|
filename: 'gls.md',
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## v1.0.169
|
|
4
|
+
- feat: add /extract-rules command
|
|
5
|
+
|
|
3
6
|
## v1.0.168
|
|
4
7
|
- feat: remove /sync-claude-md command
|
|
5
8
|
|
|
@@ -144,6 +147,3 @@
|
|
|
144
147
|
## v1.0.120
|
|
145
148
|
- feat: separate Claude discoveries from human feedback
|
|
146
149
|
|
|
147
|
-
## v1.0.119
|
|
148
|
-
- fix: remove nul deny rules that block Windows bash redirections
|
|
149
|
-
|
package/README.md
CHANGED
|
@@ -49,6 +49,7 @@ your-project/
|
|
|
49
49
|
│ ├── autoconfig-update.md # /autoconfig-update - install updates
|
|
50
50
|
│ ├── commit-and-push.md # /commit-and-push - git workflow
|
|
51
51
|
│ ├── enable-retro.md # /enable-retro - opt-in tech debt tracking
|
|
52
|
+
│ ├── extract-rules.md # /extract-rules - extract rules from artifacts
|
|
52
53
|
│ ├── gls.md # /gls - view latest screenshot
|
|
53
54
|
│ ├── recover-context.md # /recover-context - restore context after compaction
|
|
54
55
|
│ ├── show-docs.md # /show-docs - interactive walkthrough
|
|
@@ -101,6 +102,7 @@ Autoconfig is **self-configuring**. Run `/autoconfig` and Claude:
|
|
|
101
102
|
| `/show-docs` | Opens interactive docs in browser |
|
|
102
103
|
| `/test` | Runs your test suite (auto-detects framework) |
|
|
103
104
|
| `/commit-and-push` | Stages, commits with good message, and pushes |
|
|
105
|
+
| `/extract-rules` | Scan artifacts and propose structured rules for `.claude/rules/` |
|
|
104
106
|
| `/recover-context` | Recovers conversation context after compaction |
|
|
105
107
|
| `/gls` | Views latest screenshot for visual context |
|
|
106
108
|
| `/validate-cca-install` | Validates installation against latest published version |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claude-code-autoconfig",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.169",
|
|
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",
|