@paradigma-inc/flywheel 0.1.84 → 0.1.85

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
@@ -71,8 +71,34 @@ cargo binstall usage-cli
71
71
  pacman -S usage
72
72
  ```
73
73
 
74
- Generate the script for your shell and redirect it wherever your shell setup
75
- loads completions:
74
+ Install generated completions into user-level locations:
75
+
76
+ ```bash
77
+ flywheel completion install bash
78
+ flywheel completion install zsh --update-profile --yes
79
+ flywheel completion install fish
80
+ flywheel completion install powershell --update-profile --yes
81
+ flywheel completion install nu
82
+ flywheel completion install nushell
83
+ ```
84
+
85
+ Remove Flywheel-managed completion files and profile blocks with the matching
86
+ uninstall command:
87
+
88
+ ```bash
89
+ flywheel completion uninstall bash
90
+ flywheel completion uninstall zsh --update-profile --yes
91
+ flywheel completion uninstall fish
92
+ flywheel completion uninstall powershell --update-profile --yes
93
+ flywheel completion uninstall nu
94
+ ```
95
+
96
+ Profile/startup file edits are opt-in. Without `--update-profile`, installation
97
+ writes only the generated completion file. Use `--dry-run` to inspect planned
98
+ changes, `--dir <path>` to choose a destination directory, and `--force` only
99
+ when replacing an existing unmarked completion file.
100
+
101
+ You can also generate the script for your shell and redirect it yourself:
76
102
 
77
103
  ```bash
78
104
  flywheel completion bash --include-bash-completion-lib > ~/.local/share/bash-completion/completions/flywheel
@@ -83,8 +109,10 @@ flywheel completion nu > ~/.config/nushell/autoload/flywheel.nu
83
109
  flywheel completion nushell > ~/.config/nushell/autoload/flywheel.nu
84
110
  ```
85
111
 
86
- This command generates scripts only. It does not install completions. It does
87
- nothing to shell startup files and does not edit shell profiles.
112
+ `flywheel completion <shell>` generates scripts only. It does not install
113
+ completions, touch shell startup files, or edit shell profiles. `flywheel setup`
114
+ also does not install completions; completion installation remains an explicit
115
+ `flywheel completion install <shell>` action.
88
116
 
89
117
  ## Uninstall
90
118
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paradigma-inc/flywheel",
3
- "version": "0.1.84",
3
+ "version": "0.1.85",
4
4
  "description": "One-command setup for Flywheel MCP hosts",
5
5
  "type": "module",
6
6
  "files": [
package/src/cli.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Command } from "commander";
2
- import { checkbox, select } from "@inquirer/prompts";
2
+ import { checkbox, confirm, select } from "@inquirer/prompts";
3
3
  import ora from "ora";
4
4
  import pc from "picocolors";
5
5
  import { access, readFile, rm } from "node:fs/promises";
@@ -16,6 +16,10 @@ import {
16
16
  normalizeHosts,
17
17
  } from "./agents.mjs";
18
18
  import { generateCompletionScript } from "./completion.mjs";
19
+ import {
20
+ installCompletion,
21
+ uninstallCompletion,
22
+ } from "./completion-install.mjs";
19
23
  import {
20
24
  readEntryServerUrl,
21
25
  readNamedConfigEntry,
@@ -491,6 +495,52 @@ async function runCompletionCommand(shell, options) {
491
495
  }
492
496
  }
493
497
 
498
+ async function runCompletionInstallCommand(shell, options) {
499
+ try {
500
+ await installCompletion({
501
+ shell,
502
+ dir: options.dir,
503
+ force: options.force === true,
504
+ dryRun: options.dryRun === true,
505
+ updateProfile: options.updateProfile === true,
506
+ yes: options.yes === true,
507
+ isInteractive:
508
+ process.stdin.isTTY === true && process.stdout.isTTY === true,
509
+ stdout: (chunk) => process.stdout.write(chunk),
510
+ stderr: (chunk) => process.stderr.write(chunk),
511
+ confirmProfileUpdate: async ({ message, default: defaultValue }) =>
512
+ await confirm({ message, default: defaultValue }),
513
+ generateCompletionScript,
514
+ });
515
+ } catch (error) {
516
+ const message = error instanceof Error ? error.message : String(error);
517
+ process.stderr.write(`${message}\n`);
518
+ process.exitCode = 1;
519
+ }
520
+ }
521
+
522
+ async function runCompletionUninstallCommand(shell, options) {
523
+ try {
524
+ await uninstallCompletion({
525
+ shell,
526
+ dir: options.dir,
527
+ dryRun: options.dryRun === true,
528
+ updateProfile: options.updateProfile === true,
529
+ yes: options.yes === true,
530
+ isInteractive:
531
+ process.stdin.isTTY === true && process.stdout.isTTY === true,
532
+ stdout: (chunk) => process.stdout.write(chunk),
533
+ stderr: (chunk) => process.stderr.write(chunk),
534
+ confirmProfileUpdate: async ({ message, default: defaultValue }) =>
535
+ await confirm({ message, default: defaultValue }),
536
+ });
537
+ } catch (error) {
538
+ const message = error instanceof Error ? error.message : String(error);
539
+ process.stderr.write(`${message}\n`);
540
+ process.exitCode = 1;
541
+ }
542
+ }
543
+
494
544
  function parseUninstallScope(value) {
495
545
  const normalized = String(value || "")
496
546
  .trim()
@@ -1162,9 +1212,10 @@ Examples:
1162
1212
  `,
1163
1213
  );
1164
1214
 
1165
- program
1166
- .command("completion <shell>")
1215
+ const completionCommand = program
1216
+ .command("completion")
1167
1217
  .description("Generate a shell completion script")
1218
+ .argument("[shell]", "Shell to generate completions for")
1168
1219
  .addHelpText(
1169
1220
  "before",
1170
1221
  `${pc.bold(pc.cyan("✻ Flywheel Completion"))}
@@ -1198,9 +1249,74 @@ Examples:
1198
1249
  `,
1199
1250
  )
1200
1251
  .action(async (shell, options) => {
1252
+ if (!shell) {
1253
+ completionCommand.help();
1254
+ return;
1255
+ }
1201
1256
  await runCompletionCommand(shell, options);
1202
1257
  });
1203
1258
 
1259
+ completionCommand
1260
+ .command("install <shell>")
1261
+ .description("Install generated shell completion scripts")
1262
+ .option("--dir <path>", "Override completion script destination directory")
1263
+ .option("--force", "Replace an existing unmarked destination file")
1264
+ .option("--dry-run", "Print planned changes without writing files")
1265
+ .option("--update-profile", "Allow shell startup/profile file updates")
1266
+ .option("-y, --yes", "Skip confirmation prompts")
1267
+ .addHelpText(
1268
+ "before",
1269
+ `${pc.bold(pc.cyan("✻ Flywheel Completion Install"))}
1270
+
1271
+ Install generated Flywheel shell completions to user-level locations.
1272
+ Supported shells: ${COMPLETION_SHELL_CHOICES.join(", ")}.
1273
+ `,
1274
+ )
1275
+ .addHelpText(
1276
+ "after",
1277
+ `
1278
+ Examples:
1279
+ ${pc.green("flywheel completion install bash")}
1280
+ ${pc.green("flywheel completion install zsh --update-profile --yes")}
1281
+ ${pc.green("flywheel completion install fish")}
1282
+ ${pc.green("flywheel completion install powershell --update-profile --yes")}
1283
+ ${pc.green("flywheel completion install nu")}
1284
+ `,
1285
+ )
1286
+ .action(async (shell, options) => {
1287
+ await runCompletionInstallCommand(shell, options);
1288
+ });
1289
+
1290
+ completionCommand
1291
+ .command("uninstall <shell>")
1292
+ .description("Uninstall Flywheel-managed shell completion scripts")
1293
+ .option("--dir <path>", "Override completion script destination directory")
1294
+ .option("--dry-run", "Print planned removals without writing files")
1295
+ .option("--update-profile", "Allow shell startup/profile file updates")
1296
+ .option("-y, --yes", "Skip confirmation prompts")
1297
+ .addHelpText(
1298
+ "before",
1299
+ `${pc.bold(pc.cyan("✻ Flywheel Completion Uninstall"))}
1300
+
1301
+ Remove only Flywheel-managed shell completion files and profile blocks.
1302
+ Supported shells: ${COMPLETION_SHELL_CHOICES.join(", ")}.
1303
+ `,
1304
+ )
1305
+ .addHelpText(
1306
+ "after",
1307
+ `
1308
+ Examples:
1309
+ ${pc.green("flywheel completion uninstall bash")}
1310
+ ${pc.green("flywheel completion uninstall zsh --update-profile --yes")}
1311
+ ${pc.green("flywheel completion uninstall fish")}
1312
+ ${pc.green("flywheel completion uninstall powershell --update-profile --yes")}
1313
+ ${pc.green("flywheel completion uninstall nu")}
1314
+ `,
1315
+ )
1316
+ .action(async (shell, options) => {
1317
+ await runCompletionUninstallCommand(shell, options);
1318
+ });
1319
+
1204
1320
  program
1205
1321
  .command("setup")
1206
1322
  .description("Set up Flywheel for your AI coding host")