refacil-sdd-ai 5.0.8 → 5.0.10
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/bin/cli.js +0 -14
- package/lib/hooks.js +14 -2
- package/lib/installer.js +36 -0
- package/package.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -645,7 +645,6 @@ async function init() {
|
|
|
645
645
|
}
|
|
646
646
|
|
|
647
647
|
writeGlobalVersion(getPackageVersion(packageRoot));
|
|
648
|
-
writeRepoVersion(projectRoot, getPackageVersion(packageRoot));
|
|
649
648
|
|
|
650
649
|
if (installClaude) {
|
|
651
650
|
if (createClaudeMd(packageRoot, projectRoot)) console.log(' CLAUDE.md OK');
|
|
@@ -662,12 +661,6 @@ async function init() {
|
|
|
662
661
|
}
|
|
663
662
|
|
|
664
663
|
if (installOpenCode) {
|
|
665
|
-
try {
|
|
666
|
-
installOpenCodeJson(projectRoot);
|
|
667
|
-
console.log(' .opencode/opencode.json created/updated');
|
|
668
|
-
} catch (err) {
|
|
669
|
-
console.error(` Warning: could not create opencode.json: ${err.message}`);
|
|
670
|
-
}
|
|
671
664
|
if (installHooks('.opencode', homeDir, projectRoot)) {
|
|
672
665
|
console.log(' OpenCode plugin installed to global plugins directory');
|
|
673
666
|
}
|
|
@@ -776,8 +769,6 @@ function update() {
|
|
|
776
769
|
}
|
|
777
770
|
|
|
778
771
|
writeGlobalVersion(getPackageVersion(packageRoot));
|
|
779
|
-
writeRepoVersion(projectRoot, getPackageVersion(packageRoot));
|
|
780
|
-
|
|
781
772
|
if (hasClaudeDir) {
|
|
782
773
|
createClaudeMd(packageRoot, projectRoot);
|
|
783
774
|
if (installHooks('.claude', homeDir, projectRoot)) {
|
|
@@ -793,11 +784,6 @@ function update() {
|
|
|
793
784
|
}
|
|
794
785
|
|
|
795
786
|
if (hasOpenCodeDir) {
|
|
796
|
-
try {
|
|
797
|
-
installOpenCodeJson(projectRoot);
|
|
798
|
-
} catch (err) {
|
|
799
|
-
console.error(` Warning: could not update opencode.json: ${err.message}`);
|
|
800
|
-
}
|
|
801
787
|
if (installHooks('.opencode', homeDir, projectRoot)) {
|
|
802
788
|
console.log(' OpenCode plugin updated in global config directory');
|
|
803
789
|
}
|
package/lib/hooks.js
CHANGED
|
@@ -361,7 +361,12 @@ function removeProjectLevelHooks(projectRoot) {
|
|
|
361
361
|
try {
|
|
362
362
|
const config = JSON.parse(fs.readFileSync(cursorPath, 'utf8'));
|
|
363
363
|
const hooksObj = config.hooks;
|
|
364
|
-
if (!hooksObj)
|
|
364
|
+
if (!hooksObj) {
|
|
365
|
+
// No hooks key — delete if only a meaningless stub (version-only or empty)
|
|
366
|
+
const meaningfulKeys = Object.keys(config).filter(k => k !== 'version');
|
|
367
|
+
if (meaningfulKeys.length === 0) fs.unlinkSync(cursorPath);
|
|
368
|
+
continue;
|
|
369
|
+
}
|
|
365
370
|
let changed = false;
|
|
366
371
|
for (const evt of evts) {
|
|
367
372
|
if (!Array.isArray(hooksObj[evt])) continue;
|
|
@@ -371,7 +376,14 @@ function removeProjectLevelHooks(projectRoot) {
|
|
|
371
376
|
if (hooksObj[evt].length === 0) delete hooksObj[evt];
|
|
372
377
|
}
|
|
373
378
|
if (Object.keys(hooksObj).length === 0) delete config.hooks;
|
|
374
|
-
if (changed)
|
|
379
|
+
if (changed) {
|
|
380
|
+
const remainingKeys = Object.keys(config).filter(k => k !== 'version');
|
|
381
|
+
if (remainingKeys.length === 0) {
|
|
382
|
+
fs.unlinkSync(cursorPath);
|
|
383
|
+
} else {
|
|
384
|
+
fs.writeFileSync(cursorPath, JSON.stringify(config, null, 2) + '\n');
|
|
385
|
+
}
|
|
386
|
+
}
|
|
375
387
|
} catch (_) {}
|
|
376
388
|
}
|
|
377
389
|
}
|
package/lib/installer.js
CHANGED
|
@@ -328,6 +328,42 @@ function removeProjectLevelArtifacts(projectRoot) {
|
|
|
328
328
|
try { fs.unlinkSync(versionFile); removed++; } catch (_) {}
|
|
329
329
|
}
|
|
330
330
|
}
|
|
331
|
+
|
|
332
|
+
// Clean .opencode/opencode.json — strip SDD-managed $schema key; delete file if no user keys remain
|
|
333
|
+
const ocJsonPath = path.join(projectRoot, '.opencode', 'opencode.json');
|
|
334
|
+
if (fs.existsSync(ocJsonPath)) {
|
|
335
|
+
try {
|
|
336
|
+
const json = JSON.parse(fs.readFileSync(ocJsonPath, 'utf8'));
|
|
337
|
+
delete json['$schema'];
|
|
338
|
+
if (Object.keys(json).length === 0) {
|
|
339
|
+
fs.unlinkSync(ocJsonPath);
|
|
340
|
+
removed++;
|
|
341
|
+
} else {
|
|
342
|
+
fs.writeFileSync(ocJsonPath, JSON.stringify(json, null, 2) + '\n');
|
|
343
|
+
}
|
|
344
|
+
} catch (_) {}
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
// Remove .opencode/plugins/refacil-hooks.js if present
|
|
348
|
+
const ocPlugin = path.join(projectRoot, '.opencode', 'plugins', 'refacil-hooks.js');
|
|
349
|
+
if (fs.existsSync(ocPlugin)) {
|
|
350
|
+
try { fs.unlinkSync(ocPlugin); removed++; } catch (_) {}
|
|
351
|
+
}
|
|
352
|
+
// Remove .opencode/plugins/ if now empty
|
|
353
|
+
const ocPluginsDir = path.join(projectRoot, '.opencode', 'plugins');
|
|
354
|
+
try {
|
|
355
|
+
if (fs.existsSync(ocPluginsDir) && fs.readdirSync(ocPluginsDir).length === 0) {
|
|
356
|
+
fs.rmdirSync(ocPluginsDir);
|
|
357
|
+
}
|
|
358
|
+
} catch (_) {}
|
|
359
|
+
// Remove .opencode/ itself if now empty
|
|
360
|
+
const ocDir = path.join(projectRoot, '.opencode');
|
|
361
|
+
try {
|
|
362
|
+
if (fs.existsSync(ocDir) && fs.readdirSync(ocDir).length === 0) {
|
|
363
|
+
fs.rmdirSync(ocDir);
|
|
364
|
+
}
|
|
365
|
+
} catch (_) {}
|
|
366
|
+
|
|
331
367
|
return removed;
|
|
332
368
|
}
|
|
333
369
|
|
package/package.json
CHANGED