claude-code-autoconfig 1.0.116 → 1.0.117
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
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claude-code-autoconfig",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.117",
|
|
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",
|