claude-code-autoconfig 1.0.6 → 1.0.8
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/autoconfig.md +43 -14
- package/bin/cli.js +36 -0
- package/package.json +1 -1
|
@@ -4,37 +4,66 @@
|
|
|
4
4
|
|
|
5
5
|
Analyze this project and configure Claude Code with real context.
|
|
6
6
|
|
|
7
|
-
## Step 0: Migrate Existing
|
|
7
|
+
## Step 0: Migrate Existing Configuration
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Check for existing Claude Code configuration and migrate to the new structure.
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
### 0a. AGENTS.md → .claude/agents/
|
|
12
|
+
|
|
13
|
+
If an `AGENTS.md` file exists (at root or in `.claude/`):
|
|
14
|
+
1. Parse each agent definition (usually separated by headings)
|
|
15
|
+
2. Create individual files in `.claude/agents/` named after the agent (kebab-case)
|
|
16
|
+
3. Each file should contain that agent's prompt/instructions
|
|
17
|
+
4. Delete or rename the original AGENTS.md to AGENTS.md.migrated
|
|
18
|
+
5. Notify: "Migrated X agents from AGENTS.md to .claude/agents/"
|
|
19
|
+
|
|
20
|
+
### 0b. RULES.md → .claude/rules/
|
|
21
|
+
|
|
22
|
+
If a `RULES.md` file exists or CLAUDE.md contains a "Rules" section:
|
|
23
|
+
1. Extract rule definitions
|
|
24
|
+
2. Create appropriate rule files in `.claude/rules/` based on path patterns
|
|
25
|
+
3. Notify: "Migrated rules to .claude/rules/"
|
|
26
|
+
|
|
27
|
+
### 0c. Custom Commands → .claude/commands/
|
|
28
|
+
|
|
29
|
+
If CLAUDE.md contains custom slash command definitions:
|
|
30
|
+
1. Extract each command definition
|
|
31
|
+
2. Create `.claude/commands/[command-name].md` for each
|
|
32
|
+
3. Notify: "Migrated X custom commands to .claude/commands/"
|
|
33
|
+
|
|
34
|
+
### 0d. Team Feedback → .claude/feedback/
|
|
35
|
+
|
|
36
|
+
If CLAUDE.md contains **team feedback** (corrections, preferences, warnings):
|
|
37
|
+
|
|
38
|
+
**Feedback patterns:**
|
|
12
39
|
- Corrections: "Don't use X", "Always use Y instead", "Never do Z"
|
|
13
40
|
- Preferences: "We prefer...", "Team convention is...", "Boris's setup uses..."
|
|
14
41
|
- Warnings: "Be careful with...", "Watch out for...", "This is deprecated"
|
|
15
|
-
- Custom guidance:
|
|
16
|
-
- Notes about past mistakes
|
|
42
|
+
- Custom guidance: Learned behavior or team-specific knowledge
|
|
43
|
+
- Notes about past mistakes
|
|
17
44
|
|
|
18
45
|
**NOT feedback (standard config - will be regenerated):**
|
|
19
46
|
- Project name and description
|
|
20
47
|
- Tech stack listing
|
|
21
48
|
- Build/test/run commands
|
|
22
49
|
- File structure descriptions
|
|
23
|
-
- Standard conventions from frameworks
|
|
24
50
|
|
|
25
|
-
**If feedback
|
|
26
|
-
1. Extract
|
|
27
|
-
2. Append
|
|
51
|
+
**If feedback found:**
|
|
52
|
+
1. Extract feedback sections
|
|
53
|
+
2. Append to `.claude/feedback/FEEDBACK.md` with header:
|
|
28
54
|
```markdown
|
|
29
55
|
## [Date]: Migrated from CLAUDE.md
|
|
30
56
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
[extracted feedback here]
|
|
57
|
+
[extracted feedback]
|
|
34
58
|
```
|
|
35
|
-
3. Notify
|
|
59
|
+
3. Notify: "Migrated team feedback to .claude/feedback/FEEDBACK.md"
|
|
60
|
+
|
|
61
|
+
### 0e. MCP Configs
|
|
36
62
|
|
|
37
|
-
|
|
63
|
+
If CLAUDE.md mentions MCP servers or tool integrations:
|
|
64
|
+
1. Extract server configurations
|
|
65
|
+
2. Add to `.claude/.mcp.json` in the mcpServers object
|
|
66
|
+
3. Notify: "Migrated MCP config to .claude/.mcp.json"
|
|
38
67
|
|
|
39
68
|
## Step 1: Detect Environment
|
|
40
69
|
|
package/bin/cli.js
CHANGED
|
@@ -7,9 +7,43 @@ const { execSync, spawn } = require('child_process');
|
|
|
7
7
|
const cwd = process.cwd();
|
|
8
8
|
const packageDir = path.dirname(__dirname);
|
|
9
9
|
|
|
10
|
+
// Reserved Windows device names - never create files with these names
|
|
11
|
+
const WINDOWS_RESERVED = ['CON', 'PRN', 'AUX', 'NUL', 'COM1', 'COM2', 'COM3', 'COM4',
|
|
12
|
+
'COM5', 'COM6', 'COM7', 'COM8', 'COM9', 'LPT1', 'LPT2', 'LPT3', 'LPT4', 'LPT5',
|
|
13
|
+
'LPT6', 'LPT7', 'LPT8', 'LPT9'];
|
|
14
|
+
|
|
15
|
+
function isReservedName(name) {
|
|
16
|
+
const baseName = name.replace(/\.[^.]*$/, '').toUpperCase();
|
|
17
|
+
return WINDOWS_RESERVED.includes(baseName);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// Clean up any accidentally created reserved files
|
|
21
|
+
function cleanupReservedFiles(dir) {
|
|
22
|
+
if (!fs.existsSync(dir)) return;
|
|
23
|
+
try {
|
|
24
|
+
const entries = fs.readdirSync(dir);
|
|
25
|
+
for (const entry of entries) {
|
|
26
|
+
if (isReservedName(entry)) {
|
|
27
|
+
const filePath = path.join(dir, entry);
|
|
28
|
+
try {
|
|
29
|
+
fs.unlinkSync(filePath);
|
|
30
|
+
console.log('\x1b[33m%s\x1b[0m', `⚠️ Removed invalid file: ${entry}`);
|
|
31
|
+
} catch (e) {
|
|
32
|
+
// May fail on Windows - that's ok
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
} catch (e) {
|
|
37
|
+
// Ignore errors
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
10
41
|
console.log('\x1b[36m%s\x1b[0m', '🚀 Claude Code Autoconfig');
|
|
11
42
|
console.log();
|
|
12
43
|
|
|
44
|
+
// Clean up any reserved files from previous installs
|
|
45
|
+
cleanupReservedFiles(cwd);
|
|
46
|
+
|
|
13
47
|
// Step 1: Check if Claude Code is installed
|
|
14
48
|
function isClaudeInstalled() {
|
|
15
49
|
try {
|
|
@@ -54,6 +88,7 @@ function copyDirForBackup(src, dest) {
|
|
|
54
88
|
|
|
55
89
|
for (const entry of entries) {
|
|
56
90
|
if (SKIP_FILES.includes(entry.name)) continue;
|
|
91
|
+
if (isReservedName(entry.name)) continue;
|
|
57
92
|
|
|
58
93
|
const srcPath = path.join(src, entry.name);
|
|
59
94
|
const destPath = path.join(dest, entry.name);
|
|
@@ -152,6 +187,7 @@ function copyDir(src, dest) {
|
|
|
152
187
|
|
|
153
188
|
for (const entry of entries) {
|
|
154
189
|
if (SKIP_FILES.includes(entry.name)) continue;
|
|
190
|
+
if (isReservedName(entry.name)) continue;
|
|
155
191
|
|
|
156
192
|
const srcPath = path.join(src, entry.name);
|
|
157
193
|
const destPath = path.join(dest, entry.name);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claude-code-autoconfig",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.8",
|
|
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",
|