claude-code-autoconfig 1.0.116 → 1.0.118
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.
|
@@ -2,33 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* @name Feedback Rule Migration Check
|
|
5
|
-
* @description After FEEDBACK.md is edited,
|
|
6
|
-
*
|
|
5
|
+
* @description After FEEDBACK.md is edited, notifies Claude to evaluate
|
|
6
|
+
* whether any entries would be more reliably delivered as
|
|
7
|
+
* .claude/rules/ files with glob patterns.
|
|
7
8
|
* @trigger PostToolUse on Write|Edit
|
|
8
9
|
*/
|
|
9
10
|
|
|
10
|
-
const fs = require('fs');
|
|
11
|
-
const path = require('path');
|
|
12
|
-
|
|
13
|
-
// File extension patterns that suggest rule-eligible content
|
|
14
|
-
const FILE_PATTERNS = [
|
|
15
|
-
{ regex: /\*\.py\b/i, ext: '*.py', lang: 'Python' },
|
|
16
|
-
{ regex: /\*\.js\b/i, ext: '*.js', lang: 'JavaScript' },
|
|
17
|
-
{ regex: /\*\.jsx\b/i, ext: '*.jsx', lang: 'JSX' },
|
|
18
|
-
{ regex: /\*\.ts\b/i, ext: '*.ts', lang: 'TypeScript' },
|
|
19
|
-
{ regex: /\*\.tsx\b/i, ext: '*.tsx', lang: 'TSX' },
|
|
20
|
-
{ regex: /\*\.go\b/i, ext: '*.go', lang: 'Go' },
|
|
21
|
-
{ regex: /\*\.rs\b/i, ext: '*.rs', lang: 'Rust' },
|
|
22
|
-
{ regex: /\*\.rb\b/i, ext: '*.rb', lang: 'Ruby' },
|
|
23
|
-
{ regex: /\*\.java\b/i, ext: '*.java', lang: 'Java' },
|
|
24
|
-
{ regex: /\*\.cpp\b|\.c\b|\.h\b/i, ext: '*.cpp', lang: 'C/C++' },
|
|
25
|
-
{ regex: /\*\.css\b|\.scss\b/i, ext: '*.css', lang: 'CSS' },
|
|
26
|
-
{ regex: /\*\.sql\b/i, ext: '*.sql', lang: 'SQL' },
|
|
27
|
-
{ regex: /\.vue\b/i, ext: '*.vue', lang: 'Vue' },
|
|
28
|
-
{ regex: /\.swift\b/i, ext: '*.swift', lang: 'Swift' },
|
|
29
|
-
{ regex: /\.kt\b|\.kotlin\b/i, ext: '*.kt', lang: 'Kotlin' },
|
|
30
|
-
];
|
|
31
|
-
|
|
32
11
|
// Read hook input from stdin
|
|
33
12
|
let input = '';
|
|
34
13
|
process.stdin.setEncoding('utf8');
|
|
@@ -36,76 +15,28 @@ process.stdin.on('data', chunk => input += chunk);
|
|
|
36
15
|
process.stdin.on('end', () => {
|
|
37
16
|
try {
|
|
38
17
|
const data = JSON.parse(input);
|
|
39
|
-
|
|
40
|
-
} catch (err) {
|
|
41
|
-
process.exit(0);
|
|
42
|
-
}
|
|
43
|
-
});
|
|
18
|
+
const filePath = data?.tool_input?.file_path || '';
|
|
44
19
|
|
|
45
|
-
|
|
46
|
-
|
|
20
|
+
// Only fire for FEEDBACK.md edits
|
|
21
|
+
if (!filePath.endsWith('FEEDBACK.md')) {
|
|
22
|
+
process.exit(0);
|
|
23
|
+
}
|
|
47
24
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
25
|
+
console.log([
|
|
26
|
+
'FEEDBACK.md was just modified.',
|
|
27
|
+
'Review the changes and evaluate whether any entries are tied to specific file types,',
|
|
28
|
+
'frameworks, or patterns that could be scoped with a glob (e.g., *.py, *.tsx, src/api/**).',
|
|
29
|
+
'',
|
|
30
|
+
'If any entries qualify, ask the user:',
|
|
31
|
+
'"Some of this guidance targets specific file types. Want me to migrate it to .claude/rules/',
|
|
32
|
+
'for more reliable delivery? Rules auto-inject when matching files are touched."',
|
|
33
|
+
'',
|
|
34
|
+
'If the user confirms, create the rule file with the appropriate glob and remove the entry from FEEDBACK.md.',
|
|
35
|
+
'If nothing qualifies, do nothing — not every FEEDBACK.md entry needs to be a rule.',
|
|
36
|
+
].join('\n'));
|
|
52
37
|
|
|
53
|
-
// Read the updated FEEDBACK.md
|
|
54
|
-
let content;
|
|
55
|
-
try {
|
|
56
|
-
content = fs.readFileSync(filePath, 'utf8');
|
|
57
|
-
} catch (err) {
|
|
58
38
|
process.exit(0);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
// Scan for file-type patterns
|
|
62
|
-
const candidates = [];
|
|
63
|
-
const lines = content.split('\n');
|
|
64
|
-
|
|
65
|
-
for (let i = 0; i < lines.length; i++) {
|
|
66
|
-
const line = lines[i];
|
|
67
|
-
for (const pattern of FILE_PATTERNS) {
|
|
68
|
-
if (pattern.regex.test(line)) {
|
|
69
|
-
// Get surrounding context (the section this line belongs to)
|
|
70
|
-
let sectionStart = i;
|
|
71
|
-
while (sectionStart > 0 && !lines[sectionStart - 1].startsWith('##')) {
|
|
72
|
-
sectionStart--;
|
|
73
|
-
}
|
|
74
|
-
const sectionHeader = lines[sectionStart].startsWith('##')
|
|
75
|
-
? lines[sectionStart].replace(/^#+\s*/, '')
|
|
76
|
-
: 'Unknown section';
|
|
77
|
-
|
|
78
|
-
candidates.push({
|
|
79
|
-
lang: pattern.lang,
|
|
80
|
-
ext: pattern.ext,
|
|
81
|
-
line: i + 1,
|
|
82
|
-
section: sectionHeader,
|
|
83
|
-
text: line.trim()
|
|
84
|
-
});
|
|
85
|
-
break; // One match per line is enough
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
if (candidates.length === 0) {
|
|
39
|
+
} catch (err) {
|
|
91
40
|
process.exit(0);
|
|
92
41
|
}
|
|
93
|
-
|
|
94
|
-
// Deduplicate by language
|
|
95
|
-
const uniqueLangs = [...new Set(candidates.map(c => c.lang))];
|
|
96
|
-
|
|
97
|
-
// Output suggestion for Claude to relay to user
|
|
98
|
-
const suggestions = uniqueLangs.map(lang => {
|
|
99
|
-
const matches = candidates.filter(c => c.lang === lang);
|
|
100
|
-
const ext = matches[0].ext;
|
|
101
|
-
return ` - ${lang} (${ext}): ${matches.length} mention${matches.length > 1 ? 's' : ''} found`;
|
|
102
|
-
}).join('\n');
|
|
103
|
-
|
|
104
|
-
console.log(`FEEDBACK.md contains guidance that references specific file types.`);
|
|
105
|
-
console.log(`These entries may be more reliably delivered as .claude/rules/ files:\n`);
|
|
106
|
-
console.log(suggestions);
|
|
107
|
-
console.log(`\nConsider asking the user if they'd like to migrate these to rules.`);
|
|
108
|
-
console.log(`Rules auto-inject when matching files are touched — more deterministic than FEEDBACK.md.`);
|
|
109
|
-
|
|
110
|
-
process.exit(0);
|
|
111
|
-
}
|
|
42
|
+
});
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
<!-- @title Feedback to Rules Migration -->
|
|
2
|
+
<!-- @type feature -->
|
|
3
|
+
<!-- @description Scans FEEDBACK.md for entries that would be more reliably delivered as .claude/rules/ files -->
|
|
4
|
+
<!-- @files .claude/feedback/FEEDBACK.md, .claude/rules/ -->
|
|
5
|
+
|
|
6
|
+
# Migrate Rule-Eligible Feedback Entries
|
|
7
|
+
|
|
8
|
+
## Step 1: Read FEEDBACK.md
|
|
9
|
+
|
|
10
|
+
Read `.claude/feedback/FEEDBACK.md` in its entirety.
|
|
11
|
+
|
|
12
|
+
## Step 2: Evaluate entries
|
|
13
|
+
|
|
14
|
+
Review each entry/section in FEEDBACK.md and determine whether it is tied to specific file types, frameworks, directories, or patterns that could be scoped with a glob.
|
|
15
|
+
|
|
16
|
+
**Rule-eligible examples:**
|
|
17
|
+
- "When editing Python files, always check imports" → `*.py`
|
|
18
|
+
- "React components should use functional style" → `*.tsx`
|
|
19
|
+
- "SQL migrations must include rollback" → `*.sql`
|
|
20
|
+
- "API route handlers need auth middleware" → `src/api/**`
|
|
21
|
+
- "CadQuery boolean unions need clearance gaps" → `*.py`
|
|
22
|
+
|
|
23
|
+
**NOT rule-eligible (keep in FEEDBACK.md):**
|
|
24
|
+
- Debugging methodology (applies to all investigation)
|
|
25
|
+
- Communication/process guidance ("confirm before coding")
|
|
26
|
+
- Meta-config guidelines (update system, versioning)
|
|
27
|
+
- Anything that applies regardless of which files are open
|
|
28
|
+
|
|
29
|
+
## Step 3: Present candidates
|
|
30
|
+
|
|
31
|
+
If no entries qualify, output:
|
|
32
|
+
|
|
33
|
+
> No rule-eligible entries found in FEEDBACK.md. Everything looks good where it is.
|
|
34
|
+
|
|
35
|
+
Then stop.
|
|
36
|
+
|
|
37
|
+
If candidates are found, present them:
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
FEEDBACK.md contains entries that could be more reliably delivered as .claude/rules/ files.
|
|
41
|
+
Rules auto-inject when matching files are touched — more deterministic than FEEDBACK.md.
|
|
42
|
+
|
|
43
|
+
Candidates:
|
|
44
|
+
|
|
45
|
+
1. "{entry summary}" → .claude/rules/{suggested-name}.md (glob: {pattern})
|
|
46
|
+
2. "{entry summary}" → .claude/rules/{suggested-name}.md (glob: {pattern})
|
|
47
|
+
|
|
48
|
+
Would you like me to migrate these? [y/n]
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Wait for the user to confirm.
|
|
52
|
+
|
|
53
|
+
## Step 4: Migrate (if confirmed)
|
|
54
|
+
|
|
55
|
+
For each confirmed candidate:
|
|
56
|
+
|
|
57
|
+
1. Create `.claude/rules/{name}.md` with this structure:
|
|
58
|
+
```markdown
|
|
59
|
+
---
|
|
60
|
+
globs: {glob-pattern}
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
{migrated content from FEEDBACK.md}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
2. Remove the migrated entry from FEEDBACK.md
|
|
67
|
+
|
|
68
|
+
3. Report each migration:
|
|
69
|
+
```
|
|
70
|
+
✅ Migrated "{entry}" → .claude/rules/{name}.md (glob: {pattern})
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
If the user declines, do nothing — the entries stay in FEEDBACK.md.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claude-code-autoconfig",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.118",
|
|
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",
|