fuzzrunx 0.1.6 → 0.1.7

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/README.md CHANGED
@@ -19,6 +19,7 @@ On install, FuzzRun auto-enables shell hooks and will print:
19
19
 
20
20
  If you want to skip auto-enable, set `FUZZRUN_SKIP_ENABLE=1` during install.
21
21
  If auto-enable didn't run (scripts disabled or local install), running any command with `fuzzrun` will attempt a one-time auto-enable unless `FUZZRUN_SKIP_ENABLE=1` is set.
22
+ On uninstall, FuzzRun automatically removes its shell hooks.
22
23
 
23
24
  ### Bash/Zsh hook (auto-run on typos)
24
25
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fuzzrunx",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "description": "Auto-correct mistyped commands and subcommands and re-run them safely.",
5
5
  "bin": {
6
6
  "fuzzrun": "bin/fuzzrun.js"
@@ -9,6 +9,7 @@
9
9
  "license": "MIT",
10
10
  "scripts": {
11
11
  "start": "node bin/fuzzrun.js",
12
- "postinstall": "node scripts/postinstall.js"
12
+ "postinstall": "node scripts/postinstall.js",
13
+ "postuninstall": "node scripts/postuninstall.js"
13
14
  }
14
15
  }
@@ -0,0 +1,10 @@
1
+ 'use strict';
2
+
3
+ const installer = require('../src/installer');
4
+
5
+ try {
6
+ installer.disable();
7
+ process.stderr.write('FuzzRun hooks removed. Restart your terminal if needed.\n');
8
+ } catch (err) {
9
+ process.stderr.write(`fuzzrun: postuninstall cleanup failed: ${err.message}\n`);
10
+ }
package/src/cli.js CHANGED
@@ -231,9 +231,16 @@ function writeState(next) {
231
231
  }
232
232
  }
233
233
 
234
+ function updateState(patch) {
235
+ const state = readState() || {};
236
+ const next = { ...state, ...patch };
237
+ writeState(next);
238
+ return next;
239
+ }
240
+
234
241
  function showInstallBannerOnce() {
235
242
  const state = readState() || {};
236
- if (state.bannerShown) return;
243
+ if (state.bannerShown || state.disabled) return;
237
244
  const message =
238
245
  state.enableSucceeded === false
239
246
  ? 'FuzzRun auto-enable failed during install. Run "fuzzrun enable" to activate.\n'
@@ -503,19 +510,21 @@ function main() {
503
510
  showInstallBannerOnce();
504
511
 
505
512
  const action = argv[0];
506
- if (action === 'enable') {
507
- const results = installer.enable({});
508
- const updated = results.some((item) => item.updated);
509
- process.stdout.write(updated ? 'FuzzRun enabled. Restart your shell to apply changes.\n' : 'FuzzRun already enabled.\n');
510
- process.exit(0);
511
- }
512
- if (action === 'disable') {
513
- const results = installer.disable();
514
- const updated = results.some((item) => item.updated);
515
- process.stdout.write(updated ? 'FuzzRun disabled. Restart your shell to apply changes.\n' : 'FuzzRun already disabled.\n');
516
- process.exit(0);
517
- }
518
- if (action === 'status') {
513
+ if (action === 'enable') {
514
+ const results = installer.enable({});
515
+ const updated = results.some((item) => item.updated);
516
+ process.stdout.write(updated ? 'FuzzRun enabled. Restart your shell to apply changes.\n' : 'FuzzRun already enabled.\n');
517
+ updateState({ disabled: false, enableSucceeded: true });
518
+ process.exit(0);
519
+ }
520
+ if (action === 'disable') {
521
+ const results = installer.disable();
522
+ const updated = results.some((item) => item.updated);
523
+ process.stdout.write(updated ? 'FuzzRun disabled. Restart your shell to apply changes.\n' : 'FuzzRun already disabled.\n');
524
+ updateState({ disabled: true });
525
+ process.exit(0);
526
+ }
527
+ if (action === 'status') {
519
528
  const results = installer.status();
520
529
  for (const item of results) {
521
530
  process.stdout.write(`${item.enabled ? 'enabled' : 'disabled'}: ${item.path}\n`);
@@ -523,13 +532,14 @@ function main() {
523
532
  process.exit(0);
524
533
  }
525
534
 
526
- if (process.env.FUZZRUN_SKIP_ENABLE !== '1') {
527
- try {
528
- const status = installer.status();
529
- const anyEnabled = status.some((item) => item.enabled);
530
- if (!anyEnabled) {
531
- const results = installer.enable({});
532
- const updated = results.some((item) => item.updated);
535
+ const state = readState() || {};
536
+ if (!state.disabled && process.env.FUZZRUN_SKIP_ENABLE !== '1') {
537
+ try {
538
+ const status = installer.status();
539
+ const anyEnabled = status.some((item) => item.enabled);
540
+ if (!anyEnabled) {
541
+ const results = installer.enable({});
542
+ const updated = results.some((item) => item.updated);
533
543
  if (updated) {
534
544
  process.stdout.write('FuzzRun auto-enabled. Restart your shell to apply changes.\n');
535
545
  }