ardfw 0.1.2 → 0.1.3
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/package.json +1 -1
- package/tools/cli/lib/installer.js +32 -30
package/package.json
CHANGED
|
@@ -64,29 +64,20 @@ export default class Installer {
|
|
|
64
64
|
|
|
65
65
|
// Check for existing _ard directory
|
|
66
66
|
const ardPath = path.join(this.projectRoot, PATHS.ARD_DIR);
|
|
67
|
-
if (fs.existsSync(ardPath)) {
|
|
68
|
-
if
|
|
69
|
-
|
|
70
|
-
await fs.remove(ardPath);
|
|
71
|
-
// Also remove IDE directories if they exist
|
|
72
|
-
const claudePath = path.join(this.projectRoot, '.claude');
|
|
73
|
-
const opencodePath = path.join(this.projectRoot, '.opencode');
|
|
74
|
-
if (fs.existsSync(claudePath)) await fs.remove(claudePath);
|
|
75
|
-
if (fs.existsSync(opencodePath)) await fs.remove(opencodePath);
|
|
76
|
-
} else {
|
|
77
|
-
// Backup mode: create _ard_backup (with counter if needed)
|
|
78
|
-
await this._backupExistingArd();
|
|
79
|
-
}
|
|
67
|
+
if (fs.existsSync(ardPath) && !overwrite) {
|
|
68
|
+
// Backup mode: create _ard_backup (with counter if needed)
|
|
69
|
+
await this._backupExistingArd();
|
|
80
70
|
}
|
|
71
|
+
// If overwrite mode: we keep existing _ard and just overwrite overlapping files
|
|
81
72
|
|
|
82
73
|
// 1. Create _ard directory structure
|
|
83
74
|
await this._createArdDirectory();
|
|
84
75
|
|
|
85
|
-
// 2. Copy project_config template
|
|
86
|
-
await this._copyProjectConfig();
|
|
76
|
+
// 2. Copy project_config template (overwrite overlapping files if overwrite mode)
|
|
77
|
+
await this._copyProjectConfig({ overwrite });
|
|
87
78
|
|
|
88
|
-
// 3. Create config.yaml
|
|
89
|
-
await this._createConfigYaml(projectName, enableClaude, enableOpenCode);
|
|
79
|
+
// 3. Create config.yaml (overwrite if overwrite mode)
|
|
80
|
+
await this._createConfigYaml(projectName, enableClaude, enableOpenCode, overwrite);
|
|
90
81
|
|
|
91
82
|
// 4. Create artifacts directory
|
|
92
83
|
await this._createArtifactsDirectory();
|
|
@@ -97,11 +88,11 @@ export default class Installer {
|
|
|
97
88
|
|
|
98
89
|
// 6. Create IDE symlinks and workflow symlinks
|
|
99
90
|
if (enableClaude) {
|
|
100
|
-
await this._createIdeSymlinks('claude');
|
|
91
|
+
await this._createIdeSymlinks('claude', overwrite);
|
|
101
92
|
await this._createWorkflowSymlinks('claude');
|
|
102
93
|
}
|
|
103
94
|
if (enableOpenCode) {
|
|
104
|
-
await this._createIdeSymlinks('opencode');
|
|
95
|
+
await this._createIdeSymlinks('opencode', overwrite);
|
|
105
96
|
await this._createWorkflowSymlinks('opencode');
|
|
106
97
|
}
|
|
107
98
|
|
|
@@ -167,7 +158,7 @@ export default class Installer {
|
|
|
167
158
|
}
|
|
168
159
|
|
|
169
160
|
await fs.copy(srcPath, destPath, {
|
|
170
|
-
overwrite:
|
|
161
|
+
overwrite: options.overwrite || false, // Only overwrite if explicitly requested
|
|
171
162
|
errorOnExist: false,
|
|
172
163
|
});
|
|
173
164
|
}
|
|
@@ -210,11 +201,11 @@ export default class Installer {
|
|
|
210
201
|
await fs.writeFile(path.join(destPath, 'skills/.gitkeep'), '');
|
|
211
202
|
}
|
|
212
203
|
|
|
213
|
-
async _createConfigYaml(projectName, enableClaude, enableOpenCode) {
|
|
204
|
+
async _createConfigYaml(projectName, enableClaude, enableOpenCode, overwrite = false) {
|
|
214
205
|
const configPath = path.join(this.projectRoot, PATHS.CONFIG_YAML);
|
|
215
206
|
|
|
216
|
-
// Don't overwrite existing config
|
|
217
|
-
if (fs.existsSync(configPath)) {
|
|
207
|
+
// Don't overwrite existing config unless overwrite is set
|
|
208
|
+
if (fs.existsSync(configPath) && !overwrite) {
|
|
218
209
|
return;
|
|
219
210
|
}
|
|
220
211
|
|
|
@@ -406,7 +397,7 @@ export default class Installer {
|
|
|
406
397
|
}
|
|
407
398
|
}
|
|
408
399
|
|
|
409
|
-
async _createIdeSymlinks(ideId) {
|
|
400
|
+
async _createIdeSymlinks(ideId, overwrite = false) {
|
|
410
401
|
const ideConfig = IDE_CONFIGS[ideId];
|
|
411
402
|
const idePath = path.join(this.projectRoot, ideConfig.linkName);
|
|
412
403
|
|
|
@@ -414,13 +405,19 @@ export default class Installer {
|
|
|
414
405
|
if (fs.existsSync(idePath)) {
|
|
415
406
|
const stat = fs.lstatSync(idePath);
|
|
416
407
|
if (!stat.isSymbolicLink()) {
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
408
|
+
if (overwrite) {
|
|
409
|
+
// Overwrite mode: remove existing directory
|
|
410
|
+
await fs.remove(idePath);
|
|
411
|
+
} else {
|
|
412
|
+
throw new Error(
|
|
413
|
+
`${ideConfig.linkName} exists and is not a symlink. ` +
|
|
414
|
+
`Please remove or rename it before installing, or use --overwrite.`
|
|
415
|
+
);
|
|
416
|
+
}
|
|
417
|
+
} else {
|
|
418
|
+
// Remove existing symlink
|
|
419
|
+
await fs.remove(idePath);
|
|
421
420
|
}
|
|
422
|
-
// Remove existing symlink
|
|
423
|
-
await fs.remove(idePath);
|
|
424
421
|
}
|
|
425
422
|
|
|
426
423
|
// Create IDE directory
|
|
@@ -432,6 +429,11 @@ export default class Installer {
|
|
|
432
429
|
const targetName = mapping.targets[ideId];
|
|
433
430
|
const targetPath = path.join(idePath, targetName);
|
|
434
431
|
|
|
432
|
+
// Remove existing target if overwrite mode
|
|
433
|
+
if (overwrite && fs.existsSync(targetPath)) {
|
|
434
|
+
await fs.remove(targetPath);
|
|
435
|
+
}
|
|
436
|
+
|
|
435
437
|
// Create symlink
|
|
436
438
|
const symlinkType = mapping.isDir ? 'dir' : 'file';
|
|
437
439
|
await fs.symlink(sourcePath, targetPath, symlinkType);
|