claude-code-autoconfig 1.0.2 → 1.0.4
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/guide/autoconfig.guide.html +173 -0
- package/bin/cli.js +107 -7
- package/package.json +1 -1
|
@@ -787,9 +787,106 @@
|
|
|
787
787
|
text-align: center;
|
|
788
788
|
padding: 40px;
|
|
789
789
|
}
|
|
790
|
+
|
|
791
|
+
/* Migration link */
|
|
792
|
+
.migration-link {
|
|
793
|
+
margin: 10px 0 20px 0;
|
|
794
|
+
}
|
|
795
|
+
|
|
796
|
+
.migration-link a {
|
|
797
|
+
color: var(--accent-orange);
|
|
798
|
+
text-decoration: none;
|
|
799
|
+
font-size: 14px;
|
|
800
|
+
padding: 8px 16px;
|
|
801
|
+
background: rgba(255, 153, 51, 0.1);
|
|
802
|
+
border: 1px solid rgba(255, 153, 51, 0.3);
|
|
803
|
+
border-radius: 6px;
|
|
804
|
+
display: inline-block;
|
|
805
|
+
transition: all 0.2s ease;
|
|
806
|
+
}
|
|
807
|
+
|
|
808
|
+
.migration-link a:hover {
|
|
809
|
+
background: rgba(255, 153, 51, 0.2);
|
|
810
|
+
transform: translateY(-1px);
|
|
811
|
+
}
|
|
812
|
+
|
|
813
|
+
/* Migration modal content */
|
|
814
|
+
.migration-content {
|
|
815
|
+
display: flex;
|
|
816
|
+
gap: 20px;
|
|
817
|
+
}
|
|
818
|
+
|
|
819
|
+
.migration-column {
|
|
820
|
+
flex: 1;
|
|
821
|
+
}
|
|
822
|
+
|
|
823
|
+
.migration-column h4 {
|
|
824
|
+
font-size: 14px;
|
|
825
|
+
color: var(--accent-orange);
|
|
826
|
+
margin-bottom: 12px;
|
|
827
|
+
text-transform: uppercase;
|
|
828
|
+
letter-spacing: 1px;
|
|
829
|
+
}
|
|
830
|
+
|
|
831
|
+
.migration-column.new h4 {
|
|
832
|
+
color: var(--accent-green);
|
|
833
|
+
}
|
|
834
|
+
|
|
835
|
+
.migration-list {
|
|
836
|
+
list-style: none;
|
|
837
|
+
font-family: 'SF Mono', 'Fira Code', monospace;
|
|
838
|
+
font-size: 13px;
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
.migration-list li {
|
|
842
|
+
padding: 6px 0;
|
|
843
|
+
color: var(--text-secondary);
|
|
844
|
+
border-bottom: 1px solid var(--bg-elevated);
|
|
845
|
+
}
|
|
846
|
+
|
|
847
|
+
.migration-list li:last-child {
|
|
848
|
+
border-bottom: none;
|
|
849
|
+
}
|
|
850
|
+
|
|
851
|
+
.migration-arrow {
|
|
852
|
+
color: var(--text-dim);
|
|
853
|
+
font-size: 24px;
|
|
854
|
+
display: flex;
|
|
855
|
+
align-items: center;
|
|
856
|
+
padding: 0 10px;
|
|
857
|
+
}
|
|
790
858
|
</style>
|
|
791
859
|
</head>
|
|
792
860
|
<body>
|
|
861
|
+
<!-- Migration Modal -->
|
|
862
|
+
<div class="modal-overlay" id="migrationModal">
|
|
863
|
+
<div class="modal-content" style="max-width: 700px;">
|
|
864
|
+
<div class="modal-header">
|
|
865
|
+
<span class="modal-title">📦 Migration Summary</span>
|
|
866
|
+
<button class="modal-close" id="migrationModalClose">×</button>
|
|
867
|
+
</div>
|
|
868
|
+
<div class="modal-body">
|
|
869
|
+
<p style="color: var(--text-secondary); margin-bottom: 20px;">
|
|
870
|
+
Your previous configuration was backed up before installing the new autoconfig files.
|
|
871
|
+
</p>
|
|
872
|
+
<div class="migration-content">
|
|
873
|
+
<div class="migration-column">
|
|
874
|
+
<h4>⬅️ Backed Up</h4>
|
|
875
|
+
<ul class="migration-list" id="backedUpList"></ul>
|
|
876
|
+
</div>
|
|
877
|
+
<div class="migration-arrow">→</div>
|
|
878
|
+
<div class="migration-column new">
|
|
879
|
+
<h4>➡️ New Files</h4>
|
|
880
|
+
<ul class="migration-list" id="newFilesList"></ul>
|
|
881
|
+
</div>
|
|
882
|
+
</div>
|
|
883
|
+
<p style="color: var(--text-dim); margin-top: 20px; font-size: 13px;">
|
|
884
|
+
Backups are stored in <code style="background: var(--bg-elevated); padding: 2px 6px; border-radius: 4px;">.claude/migration/</code>
|
|
885
|
+
</p>
|
|
886
|
+
</div>
|
|
887
|
+
</div>
|
|
888
|
+
</div>
|
|
889
|
+
|
|
793
890
|
<!-- File Preview Modal -->
|
|
794
891
|
<div class="modal-overlay" id="fileModal">
|
|
795
892
|
<div class="modal-content">
|
|
@@ -812,6 +909,9 @@
|
|
|
812
909
|
<div class="slide-number">01 / Overview</div>
|
|
813
910
|
<h1>✨ Autoconfig Complete</h1>
|
|
814
911
|
<h2 class="typewriter" data-text="Here's what got installed. Hover over any file or folder to learn what it does."></h2>
|
|
912
|
+
<div class="migration-link" id="migrationLink" style="display: none;">
|
|
913
|
+
<a href="#" id="showMigration">📦 View migrated files</a>
|
|
914
|
+
</div>
|
|
815
915
|
<div class="slide-content">
|
|
816
916
|
<div class="tree-panel">
|
|
817
917
|
<div class="tree-side">
|
|
@@ -1735,6 +1835,79 @@ Use \`test_\` prefix for test databases, not \`dev_\`.`
|
|
|
1735
1835
|
}
|
|
1736
1836
|
});
|
|
1737
1837
|
});
|
|
1838
|
+
|
|
1839
|
+
// Migration detection and modal
|
|
1840
|
+
const migrationModal = document.getElementById('migrationModal');
|
|
1841
|
+
const migrationModalClose = document.getElementById('migrationModalClose');
|
|
1842
|
+
const migrationLink = document.getElementById('migrationLink');
|
|
1843
|
+
const showMigrationBtn = document.getElementById('showMigration');
|
|
1844
|
+
const backedUpList = document.getElementById('backedUpList');
|
|
1845
|
+
const newFilesList = document.getElementById('newFilesList');
|
|
1846
|
+
|
|
1847
|
+
// New files that autoconfig installs
|
|
1848
|
+
const newAutoconfigFiles = [
|
|
1849
|
+
'commands/autoconfig.md',
|
|
1850
|
+
'commands/commit-and-push.md',
|
|
1851
|
+
'commands/enable-retro.md',
|
|
1852
|
+
'commands/show-guide.md',
|
|
1853
|
+
'commands/sync-claude-md.md',
|
|
1854
|
+
'commands/test.md',
|
|
1855
|
+
'feedback/FEEDBACK.md',
|
|
1856
|
+
'guide/autoconfig.guide.html',
|
|
1857
|
+
'settings.json',
|
|
1858
|
+
'.mcp.json'
|
|
1859
|
+
];
|
|
1860
|
+
|
|
1861
|
+
// Check for migration
|
|
1862
|
+
async function checkMigration() {
|
|
1863
|
+
try {
|
|
1864
|
+
// Try to fetch migration/latest.json relative to guide location
|
|
1865
|
+
const guidePath = window.location.pathname;
|
|
1866
|
+
const claudeDir = guidePath.substring(0, guidePath.lastIndexOf('/guide/'));
|
|
1867
|
+
const migrationPath = claudeDir + '/migration/latest.json';
|
|
1868
|
+
|
|
1869
|
+
const response = await fetch(migrationPath);
|
|
1870
|
+
if (response.ok) {
|
|
1871
|
+
const migration = await response.json();
|
|
1872
|
+
|
|
1873
|
+
// Show migration link
|
|
1874
|
+
migrationLink.style.display = 'block';
|
|
1875
|
+
|
|
1876
|
+
// Populate backed up files
|
|
1877
|
+
backedUpList.innerHTML = migration.backedUpFiles
|
|
1878
|
+
.map(f => `<li>${f}</li>`)
|
|
1879
|
+
.join('');
|
|
1880
|
+
|
|
1881
|
+
// Populate new files
|
|
1882
|
+
newFilesList.innerHTML = newAutoconfigFiles
|
|
1883
|
+
.map(f => `<li>${f}</li>`)
|
|
1884
|
+
.join('');
|
|
1885
|
+
}
|
|
1886
|
+
} catch (e) {
|
|
1887
|
+
// No migration or can't read file - that's fine
|
|
1888
|
+
}
|
|
1889
|
+
}
|
|
1890
|
+
|
|
1891
|
+
function openMigrationModal() {
|
|
1892
|
+
migrationModal.classList.add('visible');
|
|
1893
|
+
}
|
|
1894
|
+
|
|
1895
|
+
function closeMigrationModal() {
|
|
1896
|
+
migrationModal.classList.remove('visible');
|
|
1897
|
+
}
|
|
1898
|
+
|
|
1899
|
+
showMigrationBtn?.addEventListener('click', (e) => {
|
|
1900
|
+
e.preventDefault();
|
|
1901
|
+
openMigrationModal();
|
|
1902
|
+
});
|
|
1903
|
+
|
|
1904
|
+
migrationModalClose?.addEventListener('click', closeMigrationModal);
|
|
1905
|
+
migrationModal?.addEventListener('click', (e) => {
|
|
1906
|
+
if (e.target === migrationModal) closeMigrationModal();
|
|
1907
|
+
});
|
|
1908
|
+
|
|
1909
|
+
// Check for migration on load
|
|
1910
|
+
checkMigration();
|
|
1738
1911
|
</script>
|
|
1739
1912
|
</body>
|
|
1740
1913
|
</html>
|
package/bin/cli.js
CHANGED
|
@@ -43,10 +43,12 @@ if (!isClaudeInstalled()) {
|
|
|
43
43
|
|
|
44
44
|
console.log('\x1b[32m%s\x1b[0m', '✅ Claude Code detected');
|
|
45
45
|
|
|
46
|
-
// Step 2:
|
|
47
|
-
const
|
|
46
|
+
// Step 2: Backup existing .claude/ if present
|
|
47
|
+
const claudeDest = path.join(cwd, '.claude');
|
|
48
|
+
const SKIP_FILES = ['settings.local.json', 'retro', 'migration'];
|
|
49
|
+
let migrationPath = null;
|
|
48
50
|
|
|
49
|
-
function
|
|
51
|
+
function copyDirForBackup(src, dest) {
|
|
50
52
|
fs.mkdirSync(dest, { recursive: true });
|
|
51
53
|
const entries = fs.readdirSync(src, { withFileTypes: true });
|
|
52
54
|
|
|
@@ -57,16 +59,110 @@ function copyDir(src, dest) {
|
|
|
57
59
|
const destPath = path.join(dest, entry.name);
|
|
58
60
|
|
|
59
61
|
if (entry.isDirectory()) {
|
|
60
|
-
|
|
62
|
+
copyDirForBackup(srcPath, destPath);
|
|
61
63
|
} else {
|
|
62
64
|
fs.copyFileSync(srcPath, destPath);
|
|
63
65
|
}
|
|
64
66
|
}
|
|
65
67
|
}
|
|
66
68
|
|
|
67
|
-
|
|
69
|
+
if (fs.existsSync(claudeDest)) {
|
|
70
|
+
// Create timestamped backup
|
|
71
|
+
const timestamp = new Date().toISOString().replace(/[:.]/g, '-').slice(0, 19);
|
|
72
|
+
const migrationDir = path.join(claudeDest, 'migration');
|
|
73
|
+
migrationPath = path.join(migrationDir, timestamp);
|
|
74
|
+
|
|
75
|
+
fs.mkdirSync(migrationPath, { recursive: true });
|
|
76
|
+
|
|
77
|
+
// Copy existing files to backup (excluding migration folder itself)
|
|
78
|
+
const entries = fs.readdirSync(claudeDest, { withFileTypes: true });
|
|
79
|
+
for (const entry of entries) {
|
|
80
|
+
if (entry.name === 'migration') continue;
|
|
81
|
+
|
|
82
|
+
const srcPath = path.join(claudeDest, entry.name);
|
|
83
|
+
const destPath = path.join(migrationPath, entry.name);
|
|
84
|
+
|
|
85
|
+
if (entry.isDirectory()) {
|
|
86
|
+
copyDirForBackup(srcPath, destPath);
|
|
87
|
+
} else {
|
|
88
|
+
fs.copyFileSync(srcPath, destPath);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// Write migration metadata for the guide to read
|
|
93
|
+
const latestPath = path.join(migrationDir, 'latest.json');
|
|
94
|
+
const backedUpFiles = [];
|
|
95
|
+
|
|
96
|
+
function collectFiles(dir, prefix = '') {
|
|
97
|
+
const entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
98
|
+
for (const entry of entries) {
|
|
99
|
+
const relPath = prefix ? `${prefix}/${entry.name}` : entry.name;
|
|
100
|
+
if (entry.isDirectory()) {
|
|
101
|
+
collectFiles(path.join(dir, entry.name), relPath);
|
|
102
|
+
} else {
|
|
103
|
+
backedUpFiles.push(relPath);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
collectFiles(migrationPath);
|
|
108
|
+
|
|
109
|
+
fs.writeFileSync(latestPath, JSON.stringify({
|
|
110
|
+
timestamp: timestamp,
|
|
111
|
+
backedUpFiles: backedUpFiles
|
|
112
|
+
}, null, 2));
|
|
113
|
+
|
|
114
|
+
// Create/update migration README
|
|
115
|
+
const readmePath = path.join(migrationDir, 'README.md');
|
|
116
|
+
const readmeContent = `# Migration Backups
|
|
117
|
+
|
|
118
|
+
This folder contains backups of previous .claude/ configurations created during autoconfig upgrades.
|
|
119
|
+
|
|
120
|
+
Each timestamped folder contains the files that existed before that migration.
|
|
121
|
+
|
|
122
|
+
## Backups
|
|
123
|
+
|
|
124
|
+
- \`${timestamp}/\` - Backup created during autoconfig install
|
|
125
|
+
|
|
126
|
+
## Restoring
|
|
127
|
+
|
|
128
|
+
To restore a previous configuration, copy files from the backup folder back to \`.claude/\`.
|
|
129
|
+
`;
|
|
130
|
+
|
|
131
|
+
// Append to existing README or create new
|
|
132
|
+
if (fs.existsSync(readmePath)) {
|
|
133
|
+
const existing = fs.readFileSync(readmePath, 'utf8');
|
|
134
|
+
const newEntry = `- \`${timestamp}/\` - Backup created during autoconfig install\n`;
|
|
135
|
+
if (!existing.includes(timestamp)) {
|
|
136
|
+
const updated = existing.replace('## Backups\n\n', `## Backups\n\n${newEntry}`);
|
|
137
|
+
fs.writeFileSync(readmePath, updated);
|
|
138
|
+
}
|
|
139
|
+
} else {
|
|
140
|
+
fs.writeFileSync(readmePath, readmeContent);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
console.log('\x1b[33m%s\x1b[0m', `⚠️ Existing .claude/ backed up to migration/${timestamp}/`);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// Step 3: Copy new files
|
|
68
147
|
const claudeSrc = path.join(packageDir, '.claude');
|
|
69
|
-
|
|
148
|
+
|
|
149
|
+
function copyDir(src, dest) {
|
|
150
|
+
fs.mkdirSync(dest, { recursive: true });
|
|
151
|
+
const entries = fs.readdirSync(src, { withFileTypes: true });
|
|
152
|
+
|
|
153
|
+
for (const entry of entries) {
|
|
154
|
+
if (SKIP_FILES.includes(entry.name)) continue;
|
|
155
|
+
|
|
156
|
+
const srcPath = path.join(src, entry.name);
|
|
157
|
+
const destPath = path.join(dest, entry.name);
|
|
158
|
+
|
|
159
|
+
if (entry.isDirectory()) {
|
|
160
|
+
copyDir(srcPath, destPath);
|
|
161
|
+
} else {
|
|
162
|
+
fs.copyFileSync(srcPath, destPath);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
70
166
|
|
|
71
167
|
if (fs.existsSync(claudeSrc)) {
|
|
72
168
|
copyDir(claudeSrc, claudeDest);
|
|
@@ -81,6 +177,10 @@ const claudeMdSrc = path.join(packageDir, 'CLAUDE.md');
|
|
|
81
177
|
const claudeMdDest = path.join(cwd, 'CLAUDE.md');
|
|
82
178
|
|
|
83
179
|
if (fs.existsSync(claudeMdDest)) {
|
|
180
|
+
// Backup existing CLAUDE.md to migration folder if we have one
|
|
181
|
+
if (migrationPath) {
|
|
182
|
+
fs.copyFileSync(claudeMdDest, path.join(migrationPath, 'CLAUDE.md'));
|
|
183
|
+
}
|
|
84
184
|
console.log('\x1b[33m%s\x1b[0m', '⚠️ CLAUDE.md exists, saved template as CLAUDE.md.template');
|
|
85
185
|
fs.copyFileSync(claudeMdSrc, path.join(cwd, 'CLAUDE.md.template'));
|
|
86
186
|
} else if (fs.existsSync(claudeMdSrc)) {
|
|
@@ -88,7 +188,7 @@ if (fs.existsSync(claudeMdDest)) {
|
|
|
88
188
|
console.log('\x1b[32m%s\x1b[0m', '✅ Created CLAUDE.md');
|
|
89
189
|
}
|
|
90
190
|
|
|
91
|
-
// Step
|
|
191
|
+
// Step 4: Launch Claude Code
|
|
92
192
|
console.log();
|
|
93
193
|
console.log('\x1b[36m%s\x1b[0m', '🚀 Launching Claude Code...');
|
|
94
194
|
console.log('\x1b[33m%s\x1b[0m', ' Run /autoconfig to complete setup');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claude-code-autoconfig",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
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",
|