@hanzlaa/rcode 2.5.0 → 2.5.1
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/cli/uninstall.js +62 -2
- package/dist/rcode.js +37 -2
- package/package.json +1 -1
package/cli/uninstall.js
CHANGED
|
@@ -17,6 +17,10 @@
|
|
|
17
17
|
* --editor=claude|cursor|windsurf|antigravity|all Limit scope
|
|
18
18
|
* --keep-state Never touch .rihal/
|
|
19
19
|
* --delete-state Also delete .rihal/ (skip prompt)
|
|
20
|
+
* --purge / --all Wipe everything — editor files,
|
|
21
|
+
* .rihal/, .planning/, gitignore block.
|
|
22
|
+
* Use when you want /rihal:init to
|
|
23
|
+
* report "fresh" on next install.
|
|
20
24
|
* --yes / -y Skip the main confirmation
|
|
21
25
|
*/
|
|
22
26
|
|
|
@@ -32,6 +36,7 @@ function parseArgs(args) {
|
|
|
32
36
|
keepState: false, // if true, never delete .rihal/
|
|
33
37
|
deleteState: false, // if true, delete .rihal/ without prompting
|
|
34
38
|
yes: false, // skip the main confirmation
|
|
39
|
+
purge: false, // wipe everything: editor files + .rihal/ + .planning/ + gitignore block
|
|
35
40
|
};
|
|
36
41
|
for (const arg of args) {
|
|
37
42
|
if (arg.startsWith('--editor=')) {
|
|
@@ -42,6 +47,11 @@ function parseArgs(args) {
|
|
|
42
47
|
opts.deleteState = true;
|
|
43
48
|
} else if (arg === '--yes' || arg === '-y') {
|
|
44
49
|
opts.yes = true;
|
|
50
|
+
} else if (arg === '--purge' || arg === '--all') {
|
|
51
|
+
// --purge implies --delete-state and removes .planning/ + gitignore block.
|
|
52
|
+
// Use this when you want a clean slate so /rihal:init reports "fresh" next time.
|
|
53
|
+
opts.purge = true;
|
|
54
|
+
opts.deleteState = true;
|
|
45
55
|
}
|
|
46
56
|
}
|
|
47
57
|
return opts;
|
|
@@ -365,9 +375,14 @@ async function runUninstall(args) {
|
|
|
365
375
|
console.log();
|
|
366
376
|
|
|
367
377
|
// Fast path: is Rihal Code installed here at all? Check our own marker
|
|
368
|
-
// (.rihal/config.
|
|
378
|
+
// (.rihal/config.yaml) + any editor install trace. If nothing, exit cleanly
|
|
369
379
|
// with a clear message so users don't wonder "did it work?"
|
|
370
|
-
|
|
380
|
+
// (Was checking config.json — a long-standing typo since the installer
|
|
381
|
+
// writes config.yaml. The check still worked thanks to the editor-files
|
|
382
|
+
// fallback, but a project with .rihal/ and no editor files would falsely
|
|
383
|
+
// report "not installed".)
|
|
384
|
+
const hasConfig = fs.existsSync(path.join(cwd, '.rihal/config.yaml'))
|
|
385
|
+
|| fs.existsSync(path.join(cwd, '.rihal/config.json'));
|
|
371
386
|
const hasAnyEditorFiles =
|
|
372
387
|
fs.existsSync(path.join(cwd, '.claude/skills')) ||
|
|
373
388
|
fs.existsSync(path.join(cwd, '.cursor/rules')) ||
|
|
@@ -565,9 +580,14 @@ async function runUninstall(args) {
|
|
|
565
580
|
if (!opts.deleteState && !opts.keepState && !opts.yes) {
|
|
566
581
|
console.log();
|
|
567
582
|
console.log(`⚠️ The .rihal/ state directory contains your project data:`);
|
|
583
|
+
console.log(` - config.yaml, state.json, RIHLA.md`);
|
|
568
584
|
console.log(` - phases, decisions, progress, artifacts, context`);
|
|
569
585
|
console.log(` - ${plan.stateDir.files} files total`);
|
|
570
586
|
console.log();
|
|
587
|
+
console.log(` If you keep it: /rihal:init will report "already configured"`);
|
|
588
|
+
console.log(` and reuse your existing config + history on next install.`);
|
|
589
|
+
console.log(` If you delete it: next install starts fresh — no carry-over.`);
|
|
590
|
+
console.log();
|
|
571
591
|
shouldDeleteState = await askConfirm(
|
|
572
592
|
`Also delete .rihal/ state? This is destructive and cannot be undone. [y/N] `,
|
|
573
593
|
{ default: 'n' },
|
|
@@ -582,11 +602,51 @@ async function runUninstall(args) {
|
|
|
582
602
|
}
|
|
583
603
|
}
|
|
584
604
|
|
|
605
|
+
// --purge: also wipe .planning/ artifacts and the rcode .gitignore block.
|
|
606
|
+
// Without this, "uninstall + reinstall" carries forward stale phases /
|
|
607
|
+
// sprints / SUMMARY files even after .rihal/ is gone.
|
|
608
|
+
if (opts.purge) {
|
|
609
|
+
const planningDir = path.join(cwd, '.planning');
|
|
610
|
+
if (fs.existsSync(planningDir)) {
|
|
611
|
+
fs.rmSync(planningDir, { recursive: true, force: true });
|
|
612
|
+
console.log(` ✓ removed .planning/ (--purge)`);
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
// Strip the rcode-managed block from .gitignore. The installer writes
|
|
616
|
+
// a fenced block; we remove it cleanly without touching user lines.
|
|
617
|
+
const gitignorePath = path.join(cwd, '.gitignore');
|
|
618
|
+
if (fs.existsSync(gitignorePath)) {
|
|
619
|
+
try {
|
|
620
|
+
const before = fs.readFileSync(gitignorePath, 'utf8');
|
|
621
|
+
// Match either fenced markers or the legacy "# rcode" header through to
|
|
622
|
+
// the next blank line — both shapes the installer has used historically.
|
|
623
|
+
const stripped = before
|
|
624
|
+
.replace(/\n?# >>> rihal-code >>>[\s\S]*?# <<< rihal-code <<<\n?/g, '\n')
|
|
625
|
+
.replace(/\n?# rcode[\s\S]*?(?=\n\n|\n$|$)/g, '\n')
|
|
626
|
+
.replace(/\n{3,}/g, '\n\n');
|
|
627
|
+
if (stripped !== before) {
|
|
628
|
+
fs.writeFileSync(gitignorePath, stripped);
|
|
629
|
+
console.log(` ✓ stripped rcode block from .gitignore (--purge)`);
|
|
630
|
+
}
|
|
631
|
+
} catch (err) {
|
|
632
|
+
console.log(` ⚠ could not strip .gitignore block: ${err.message}`);
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
|
|
585
637
|
console.log(`\n✅ Uninstall complete. Removed ${removed} files.`);
|
|
586
638
|
if (backup.ok) {
|
|
587
639
|
console.log(` Backup: ${backup.path} (restore with: tar -xzf ${backup.path})`);
|
|
588
640
|
}
|
|
589
641
|
|
|
642
|
+
// Hint about the purge flag if the user kept state — closes the user's
|
|
643
|
+
// most common confusion: "I uninstalled but /rihal:init still says configured."
|
|
644
|
+
if (plan.stateDir && fs.existsSync(path.join(cwd, '.rihal'))) {
|
|
645
|
+
console.log();
|
|
646
|
+
console.log(`ℹ .rihal/ state was preserved. /rihal:init will detect this on reinstall.`);
|
|
647
|
+
console.log(` For a fully clean slate next time, use: rcode uninstall --purge`);
|
|
648
|
+
}
|
|
649
|
+
|
|
590
650
|
// Hint about reinstalling
|
|
591
651
|
console.log(`\nTo reinstall later:`);
|
|
592
652
|
console.log(` rcode install`);
|
package/dist/rcode.js
CHANGED
|
@@ -17865,8 +17865,10 @@ var require_uninstall = __commonJS({
|
|
|
17865
17865
|
// if true, never delete .rihal/
|
|
17866
17866
|
deleteState: false,
|
|
17867
17867
|
// if true, delete .rihal/ without prompting
|
|
17868
|
-
yes: false
|
|
17868
|
+
yes: false,
|
|
17869
17869
|
// skip the main confirmation
|
|
17870
|
+
purge: false
|
|
17871
|
+
// wipe everything: editor files + .rihal/ + .planning/ + gitignore block
|
|
17870
17872
|
};
|
|
17871
17873
|
for (const arg of args) {
|
|
17872
17874
|
if (arg.startsWith("--editor=")) {
|
|
@@ -17877,6 +17879,9 @@ var require_uninstall = __commonJS({
|
|
|
17877
17879
|
opts.deleteState = true;
|
|
17878
17880
|
} else if (arg === "--yes" || arg === "-y") {
|
|
17879
17881
|
opts.yes = true;
|
|
17882
|
+
} else if (arg === "--purge" || arg === "--all") {
|
|
17883
|
+
opts.purge = true;
|
|
17884
|
+
opts.deleteState = true;
|
|
17880
17885
|
}
|
|
17881
17886
|
}
|
|
17882
17887
|
return opts;
|
|
@@ -18109,7 +18114,7 @@ var require_uninstall = __commonJS({
|
|
|
18109
18114
|
console.log(` Project: ${cwd}`);
|
|
18110
18115
|
console.log(` Scope: ${editors.join(", ")}`);
|
|
18111
18116
|
console.log();
|
|
18112
|
-
const hasConfig = fs2.existsSync(path2.join(cwd, ".rihal/config.json"));
|
|
18117
|
+
const hasConfig = fs2.existsSync(path2.join(cwd, ".rihal/config.yaml")) || fs2.existsSync(path2.join(cwd, ".rihal/config.json"));
|
|
18113
18118
|
const hasAnyEditorFiles = fs2.existsSync(path2.join(cwd, ".claude/skills")) || fs2.existsSync(path2.join(cwd, ".cursor/rules")) || fs2.existsSync(path2.join(cwd, ".windsurf/rules")) || fs2.existsSync(path2.join(cwd, ".antigravity/agents"));
|
|
18114
18119
|
if (!hasConfig && !hasAnyEditorFiles) {
|
|
18115
18120
|
console.log(`
|
|
@@ -18274,9 +18279,14 @@ var require_uninstall = __commonJS({
|
|
|
18274
18279
|
if (!opts.deleteState && !opts.keepState && !opts.yes) {
|
|
18275
18280
|
console.log();
|
|
18276
18281
|
console.log(`\u26A0\uFE0F The .rihal/ state directory contains your project data:`);
|
|
18282
|
+
console.log(` - config.yaml, state.json, RIHLA.md`);
|
|
18277
18283
|
console.log(` - phases, decisions, progress, artifacts, context`);
|
|
18278
18284
|
console.log(` - ${plan.stateDir.files} files total`);
|
|
18279
18285
|
console.log();
|
|
18286
|
+
console.log(` If you keep it: /rihal:init will report "already configured"`);
|
|
18287
|
+
console.log(` and reuse your existing config + history on next install.`);
|
|
18288
|
+
console.log(` If you delete it: next install starts fresh \u2014 no carry-over.`);
|
|
18289
|
+
console.log();
|
|
18280
18290
|
shouldDeleteState = await askConfirm(
|
|
18281
18291
|
`Also delete .rihal/ state? This is destructive and cannot be undone. [y/N] `,
|
|
18282
18292
|
{ default: "n" }
|
|
@@ -18289,11 +18299,36 @@ var require_uninstall = __commonJS({
|
|
|
18289
18299
|
console.log(` \u2139 kept .rihal/ state directory (your project data is preserved)`);
|
|
18290
18300
|
}
|
|
18291
18301
|
}
|
|
18302
|
+
if (opts.purge) {
|
|
18303
|
+
const planningDir = path2.join(cwd, ".planning");
|
|
18304
|
+
if (fs2.existsSync(planningDir)) {
|
|
18305
|
+
fs2.rmSync(planningDir, { recursive: true, force: true });
|
|
18306
|
+
console.log(` \u2713 removed .planning/ (--purge)`);
|
|
18307
|
+
}
|
|
18308
|
+
const gitignorePath = path2.join(cwd, ".gitignore");
|
|
18309
|
+
if (fs2.existsSync(gitignorePath)) {
|
|
18310
|
+
try {
|
|
18311
|
+
const before = fs2.readFileSync(gitignorePath, "utf8");
|
|
18312
|
+
const stripped = before.replace(/\n?# >>> rihal-code >>>[\s\S]*?# <<< rihal-code <<<\n?/g, "\n").replace(/\n?# rcode[\s\S]*?(?=\n\n|\n$|$)/g, "\n").replace(/\n{3,}/g, "\n\n");
|
|
18313
|
+
if (stripped !== before) {
|
|
18314
|
+
fs2.writeFileSync(gitignorePath, stripped);
|
|
18315
|
+
console.log(` \u2713 stripped rcode block from .gitignore (--purge)`);
|
|
18316
|
+
}
|
|
18317
|
+
} catch (err) {
|
|
18318
|
+
console.log(` \u26A0 could not strip .gitignore block: ${err.message}`);
|
|
18319
|
+
}
|
|
18320
|
+
}
|
|
18321
|
+
}
|
|
18292
18322
|
console.log(`
|
|
18293
18323
|
\u2705 Uninstall complete. Removed ${removed} files.`);
|
|
18294
18324
|
if (backup.ok) {
|
|
18295
18325
|
console.log(` Backup: ${backup.path} (restore with: tar -xzf ${backup.path})`);
|
|
18296
18326
|
}
|
|
18327
|
+
if (plan.stateDir && fs2.existsSync(path2.join(cwd, ".rihal"))) {
|
|
18328
|
+
console.log();
|
|
18329
|
+
console.log(`\u2139 .rihal/ state was preserved. /rihal:init will detect this on reinstall.`);
|
|
18330
|
+
console.log(` For a fully clean slate next time, use: rcode uninstall --purge`);
|
|
18331
|
+
}
|
|
18297
18332
|
console.log(`
|
|
18298
18333
|
To reinstall later:`);
|
|
18299
18334
|
console.log(` rcode install`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hanzlaa/rcode",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.1",
|
|
4
4
|
"description": "Rihal Code (rcode) — installable context-brain for Rihalians. 43 agents, 99 slash commands, 56 skills, pullable Rihal standards. Unified install for Claude Code, Cursor, and Gemini.",
|
|
5
5
|
"main": "cli/index.js",
|
|
6
6
|
"bin": {
|