@nemus-cli/nemus 0.8.0 → 0.10.0

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.
Files changed (65) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/README.md +29 -5
  3. package/bin/workspace.js +12 -0
  4. package/dist/commands/analyze-deps.js +5 -12
  5. package/dist/commands/archive.js +13 -18
  6. package/dist/commands/branch/create.js +5 -12
  7. package/dist/commands/branch/switch.js +14 -25
  8. package/dist/commands/cache/manager.js +13 -24
  9. package/dist/commands/cleanup.js +14 -26
  10. package/dist/commands/config.js +82 -0
  11. package/dist/commands/configure-claude.js +4 -8
  12. package/dist/commands/configure.js +38 -32
  13. package/dist/commands/dashboard/session-picker.js +19 -26
  14. package/dist/commands/dashboard/workspace-picker.js +19 -26
  15. package/dist/commands/delete.js +15 -30
  16. package/dist/commands/ghq-status.js +7 -12
  17. package/dist/commands/go.js +18 -27
  18. package/dist/commands/history.js +6 -13
  19. package/dist/commands/list.js +20 -29
  20. package/dist/commands/remove-repo.js +21 -29
  21. package/dist/commands/save-context.js +5 -10
  22. package/dist/commands/sessions.js +19 -25
  23. package/dist/commands/suite/create.js +27 -53
  24. package/dist/commands/suite/delete.js +13 -25
  25. package/dist/commands/suite/export.js +20 -36
  26. package/dist/commands/suite/import.js +9 -20
  27. package/dist/commands/suite/use.js +9 -17
  28. package/dist/utils/config-schema.js +57 -0
  29. package/dist/utils/editor.js +35 -0
  30. package/dist/utils/prompt.js +26 -0
  31. package/dist/utils/prompts.js +86 -118
  32. package/package.json +3 -6
  33. package/src/commands/analyze-deps.ts +5 -9
  34. package/src/commands/archive.ts +5 -7
  35. package/src/commands/branch/create.ts +5 -9
  36. package/src/commands/branch/switch.ts +14 -22
  37. package/src/commands/cache/manager.ts +13 -21
  38. package/src/commands/cleanup.ts +14 -23
  39. package/src/commands/config.ts +52 -1
  40. package/src/commands/configure-claude.ts +4 -5
  41. package/src/commands/configure.ts +35 -29
  42. package/src/commands/dashboard/session-picker.ts +6 -11
  43. package/src/commands/dashboard/workspace-picker.ts +6 -11
  44. package/src/commands/delete.test.ts +36 -42
  45. package/src/commands/delete.ts +15 -27
  46. package/src/commands/ghq-status.ts +5 -7
  47. package/src/commands/go.ts +18 -25
  48. package/src/commands/history.ts +6 -10
  49. package/src/commands/list.test.ts +19 -26
  50. package/src/commands/list.ts +24 -31
  51. package/src/commands/remove-repo.ts +11 -17
  52. package/src/commands/save-context.ts +3 -5
  53. package/src/commands/sessions.ts +6 -10
  54. package/src/commands/suite/create.ts +28 -50
  55. package/src/commands/suite/delete.ts +14 -23
  56. package/src/commands/suite/export.ts +20 -33
  57. package/src/commands/suite/import.ts +9 -17
  58. package/src/commands/suite/use.ts +9 -14
  59. package/src/utils/config-schema.test.ts +49 -0
  60. package/src/utils/config-schema.ts +65 -0
  61. package/src/utils/editor.test.ts +37 -0
  62. package/src/utils/editor.ts +48 -0
  63. package/src/utils/prompt.ts +16 -0
  64. package/src/utils/prompts.test.ts +70 -41
  65. package/src/utils/prompts.ts +98 -128
package/CHANGELOG.md CHANGED
@@ -7,6 +7,36 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.10.0] - 2026-09-01
11
+
12
+ ### Changed
13
+
14
+ - **Migrated from the unmaintained classic `inquirer` (v8) + `inquirer-autocomplete-prompt`
15
+ to the modular, maintained `@inquirer/prompts`.** All interactive prompts now
16
+ go through a single `src/utils/prompt.ts` wrapper. The ESM-only package loads
17
+ from the CommonJS build via Node 22's stable `require(esm)` (the CLI already
18
+ requires Node ≥ 22). Autocomplete pickers use `@inquirer/prompts`' own
19
+ `search()` instead of the third-party plugin. No user-facing behavior change.
20
+ Net deps: **−`inquirer` −`inquirer-autocomplete-prompt` −`@types/inquirer`
21
+ −`@types/inquirer-autocomplete-prompt` +`@inquirer/prompts`** (ships its own types).
22
+ - **Raised the minimum Node.js to `22.13.0`** (was `22`). `require(esm)` is only
23
+ unflagged from Node 22.12, and the `@inquirer/*` packages themselves require
24
+ `^22.13` on the 22.x line — below that, interactive commands would throw
25
+ `ERR_REQUIRE_ESM`. The CLI now also fails early with a clear message on older
26
+ Node instead of a cryptic stack trace.
27
+
28
+ ## [0.9.0] - 2026-09-01
29
+
30
+ ### Added
31
+
32
+ - **`nemus config edit`** opens the config file in `$VISUAL`/`$EDITOR` (seeding
33
+ it with the current resolved config on first run) and re-validates the JSON
34
+ afterward, warning about unrecognized keys. Refuses to run without an
35
+ interactive terminal.
36
+ - **Environment-variable reference** in the README documenting every variable
37
+ Nemus reads (`NEMUS_*`, `WORKSPACE_*`, `NO_COLOR`/`FORCE_COLOR`,
38
+ `VISUAL`/`EDITOR`).
39
+
10
40
  ## [0.8.0] - 2026-09-01
11
41
 
12
42
  ### Added
package/README.md CHANGED
@@ -14,7 +14,7 @@
14
14
  <a href="https://www.npmjs.com/package/@nemus-cli/nemus"><img src="https://img.shields.io/npm/v/@nemus-cli/nemus.svg" alt="npm" /></a>
15
15
  <a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="License: MIT" /></a>
16
16
  <a href="https://www.npmjs.com/package/@nemus-cli/nemus"><img src="https://img.shields.io/npm/dm/@nemus-cli/nemus.svg" alt="npm downloads" /></a>
17
- <img src="https://img.shields.io/badge/node-%3E%3D22-brightgreen.svg" alt="Node >= 22" />
17
+ <img src="https://img.shields.io/badge/node-%3E%3D22.13-brightgreen.svg" alt="Node >= 22.13" />
18
18
  <a href="https://x.com/nemus_cli"><img src="https://img.shields.io/badge/follow-%40nemus__cli-000000.svg?logo=x&logoColor=white" alt="Follow @nemus_cli on X" /></a>
19
19
  </p>
20
20
 
@@ -152,7 +152,7 @@ npm link # makes `nemus` / `nem` available on your PATH
152
152
 
153
153
  ### Prerequisites
154
154
 
155
- - **Node.js 22+**
155
+ - **Node.js 22.13+** (the prompt library loads via `require(esm)`)
156
156
  - Git
157
157
  - [GitHub CLI](https://cli.github.com/) (`gh`), authenticated via `gh auth login`
158
158
  - SSH keys configured for GitHub (recommended; HTTPS also supported)
@@ -259,6 +259,25 @@ nemus config path # print the config file location
259
259
 
260
260
  `get`/`list` also accept `--json`. An unknown key or an invalid value exits
261
261
  non-zero with a clear message (e.g. `cloneProtocol must be one of: ssh, https`).
262
+ `config edit` opens the file in `$VISUAL`/`$EDITOR` (seeding it with the current
263
+ resolved config first) and re-validates the JSON afterward.
264
+
265
+ ### Environment variables
266
+
267
+ Everything Nemus reads from the environment (all optional):
268
+
269
+ | Variable | Effect |
270
+ | --- | --- |
271
+ | `NEMUS_DIR` | Override where workspaces are created (also `WORKSPACE_MANAGER_DIR`). |
272
+ | `NEMUS_CACHE_DIR` | Override the cache/config/state dir, default `~/.nemus` (also `WORKSPACE_MANAGER_CACHE_DIR`). |
273
+ | `NEMUS_JUDGE_MODEL` | Model for the `reflect` judge (overrides `--model`'s default). |
274
+ | `NEMUS_JUDGE_THINKING` | Thinking level for the `reflect` judge on pi (`off`…`max`). |
275
+ | `NEMUS_JUDGE_TIMEOUT_MS` | Timeout for the `reflect` judge call. |
276
+ | `NEMUS_BUG_REPORT_REPO` | Repo that `report-bug` files issues against. |
277
+ | `NEMUS_SKIP_CONFIGURE` | Skip the one-time post-install `configure` prompt. |
278
+ | `WORKSPACE_CLONE_TIMEOUT_MS` | Git clone timeout (default 15 min). |
279
+ | `NO_COLOR` / `FORCE_COLOR` | Disable / force ANSI color (see [Global flags](#global-flags)). |
280
+ | `VISUAL` / `EDITOR` | Editor launched by `nemus config edit`. |
262
281
 
263
282
  ### Global flags
264
283
 
@@ -370,9 +389,14 @@ there's an **optional, opt-in** package: [`@nemus-cli/cloud`](./packages/cloud).
370
389
  It's a separate, vendor-neutral package built from swappable seams — runners
371
390
  (`docker`, `aws-fargate`, `kubernetes`), IaC provisioners (OpenTofu/Terraform
372
391
  modules), git forges (GitHub/GitLab), a bounded CI-fix loop, and notifiers — with
373
- no cloud SDK in the core CLI. It is **not published to npm**; it lives in this
374
- repo for you to build and run yourself. See
375
- [`packages/cloud/README.md`](./packages/cloud/README.md) to get started.
392
+ no cloud SDK in the core CLI. It's published separately as **experimental**
393
+ (`0.x`), so installing the core CLI pulls in none of it:
394
+
395
+ ```bash
396
+ npm install -g @nemus-cli/cloud
397
+ ```
398
+
399
+ See [`packages/cloud/README.md`](./packages/cloud/README.md) to get started.
376
400
 
377
401
  ## Configuration
378
402
 
package/bin/workspace.js CHANGED
@@ -10,6 +10,18 @@ if (command === '--version' || command === '-V') {
10
10
  process.exit(0);
11
11
  }
12
12
 
13
+ // Require Node >= 22.13.0. The interactive prompt library (@inquirer/prompts) is
14
+ // ESM-only and loaded from this CommonJS build via `require(esm)`, which is only
15
+ // unflagged from Node 22.12 (and @inquirer itself needs ^22.13). Below that,
16
+ // even loading a command throws ERR_REQUIRE_ESM, so fail early with a clear
17
+ // message instead of a cryptic stack trace. (--version above needs no modules.)
18
+ const [nodeMajor, nodeMinor] = process.versions.node.split('.').map(Number);
19
+ if (nodeMajor < 22 || (nodeMajor === 22 && nodeMinor < 13)) {
20
+ console.error(`nemus requires Node.js >= 22.13.0 (you are running ${process.versions.node}).`);
21
+ console.error(`Its interactive prompt library loads via require(esm), which isn't available on older Node.`);
22
+ process.exit(1);
23
+ }
24
+
13
25
  // Pre-check: if dist/ doesn't exist, show fallback help and exit.
14
26
  // If dist/ exists, the module is cached and the else block below handles execution.
15
27
  if (!command || command === '--help' || command === '-h' || command === 'help') {
@@ -32,9 +32,6 @@ var __importStar = (this && this.__importStar) || (function () {
32
32
  return result;
33
33
  };
34
34
  })();
35
- var __importDefault = (this && this.__importDefault) || function (mod) {
36
- return (mod && mod.__esModule) ? mod : { "default": mod };
37
- };
38
35
  Object.defineProperty(exports, "__esModule", { value: true });
39
36
  exports.registerAnalyzeDepsCommand = registerAnalyzeDepsCommand;
40
37
  const path = __importStar(require("path"));
@@ -44,7 +41,7 @@ const dependency_analyzer_1 = require("../utils/dependency-analyzer");
44
41
  const logger_1 = require("../utils/logger");
45
42
  const output_1 = require("../utils/output");
46
43
  const colors_1 = require("../utils/colors");
47
- const inquirer_1 = __importDefault(require("inquirer"));
44
+ const prompt_1 = require("../utils/prompt");
48
45
  const command_helpers_1 = require("../utils/command-helpers");
49
46
  const displayDependencyAnalysis = (analyses) => {
50
47
  console.log('\n' + (0, colors_1.colorize)('Dependency Analysis', 'bright'));
@@ -143,14 +140,10 @@ async function handleAnalyzeDeps(workspaceArg, opts = {}) {
143
140
  (0, logger_1.logInfo)(`Consider adding these repositories with: workspace update ${selectedWorkspace}`);
144
141
  }
145
142
  if (process.stdout.isTTY) {
146
- const { saveToMetadata } = await inquirer_1.default.prompt([
147
- {
148
- type: 'confirm',
149
- name: 'saveToMetadata',
150
- message: 'Save dependency analysis to workspace metadata?',
151
- default: true,
152
- },
153
- ]);
143
+ const saveToMetadata = await (0, prompt_1.confirm)({
144
+ message: 'Save dependency analysis to workspace metadata?',
145
+ default: true,
146
+ });
154
147
  if (saveToMetadata) {
155
148
  const updatedMetadata = (0, dependency_analyzer_1.updateWorkspaceMetadata)(metadata, analyses);
156
149
  await (0, workspace_meta_1.saveMetadata)(workspacePath, updatedMetadata);
@@ -1,14 +1,11 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.registerArchiveCommand = registerArchiveCommand;
7
4
  const workspace_meta_1 = require("../utils/workspace-meta");
8
5
  const prompts_1 = require("../utils/prompts");
9
6
  const logger_1 = require("../utils/logger");
10
7
  const colors_1 = require("../utils/colors");
11
- const inquirer_1 = __importDefault(require("inquirer"));
8
+ const prompt_1 = require("../utils/prompt");
12
9
  const command_helpers_1 = require("../utils/command-helpers");
13
10
  function registerArchiveCommand(parent) {
14
11
  parent
@@ -44,13 +41,12 @@ async function handleArchive(opts) {
44
41
  selectedNames = await (0, prompts_1.promptMultiWorkspaceSelection)(archivedWorkspaces);
45
42
  }
46
43
  if (!opts.yes) {
47
- const { confirmed } = await inquirer_1.default.prompt([{
48
- type: 'confirm', name: 'confirmed',
49
- message: selectedNames.length === 1
50
- ? `Unarchive workspace ${selectedNames[0]}?`
51
- : `Unarchive these ${selectedNames.length} workspaces?`,
52
- default: true,
53
- }]);
44
+ const confirmed = await (0, prompt_1.confirm)({
45
+ message: selectedNames.length === 1
46
+ ? `Unarchive workspace ${selectedNames[0]}?`
47
+ : `Unarchive these ${selectedNames.length} workspaces?`,
48
+ default: true,
49
+ });
54
50
  if (!confirmed)
55
51
  return;
56
52
  }
@@ -80,13 +76,12 @@ async function handleArchive(opts) {
80
76
  selectedNames = await (0, prompts_1.promptMultiWorkspaceSelection)(workspaces);
81
77
  }
82
78
  if (!opts.yes) {
83
- const { confirmed } = await inquirer_1.default.prompt([{
84
- type: 'confirm', name: 'confirmed',
85
- message: selectedNames.length === 1
86
- ? `Archive workspace ${selectedNames[0]}? It will be auto-deleted in 30 days.`
87
- : `Archive these ${selectedNames.length} workspaces? They will be auto-deleted in 30 days.`,
88
- default: true,
89
- }]);
79
+ const confirmed = await (0, prompt_1.confirm)({
80
+ message: selectedNames.length === 1
81
+ ? `Archive workspace ${selectedNames[0]}? It will be auto-deleted in 30 days.`
82
+ : `Archive these ${selectedNames.length} workspaces? They will be auto-deleted in 30 days.`,
83
+ default: true,
84
+ });
90
85
  if (!confirmed)
91
86
  return;
92
87
  }
@@ -33,9 +33,6 @@ var __importStar = (this && this.__importStar) || (function () {
33
33
  return result;
34
34
  };
35
35
  })();
36
- var __importDefault = (this && this.__importDefault) || function (mod) {
37
- return (mod && mod.__esModule) ? mod : { "default": mod };
38
- };
39
36
  Object.defineProperty(exports, "__esModule", { value: true });
40
37
  exports.main = void 0;
41
38
  const path = __importStar(require("path"));
@@ -45,7 +42,7 @@ const branch_operations_1 = require("../../utils/branch-operations");
45
42
  const logger_1 = require("../../utils/logger");
46
43
  const colors_1 = require("../../utils/colors");
47
44
  const config_1 = require("../../utils/config");
48
- const inquirer_1 = __importDefault(require("inquirer"));
45
+ const prompt_1 = require("../../utils/prompt");
49
46
  const main = async (opts) => {
50
47
  try {
51
48
  let workspaceName = opts?.workspace;
@@ -69,14 +66,10 @@ const main = async (opts) => {
69
66
  (0, logger_1.logError)('Usage: w branch create --workspace <name> --branch <branch>');
70
67
  process.exit(1);
71
68
  }
72
- const { branch } = await inquirer_1.default.prompt([
73
- {
74
- type: 'input',
75
- name: 'branch',
76
- message: 'New branch name:',
77
- validate: (input) => input.trim() ? true : 'Branch name cannot be empty',
78
- },
79
- ]);
69
+ const branch = await (0, prompt_1.input)({
70
+ message: 'New branch name:',
71
+ validate: (input) => input.trim() ? true : 'Branch name cannot be empty',
72
+ });
80
73
  branchName = branch;
81
74
  }
82
75
  const workspacePath = path.join(config_1.WORKSPACES_DIR, workspaceName);
@@ -33,9 +33,6 @@ var __importStar = (this && this.__importStar) || (function () {
33
33
  return result;
34
34
  };
35
35
  })();
36
- var __importDefault = (this && this.__importDefault) || function (mod) {
37
- return (mod && mod.__esModule) ? mod : { "default": mod };
38
- };
39
36
  Object.defineProperty(exports, "__esModule", { value: true });
40
37
  exports.main = main;
41
38
  const config_1 = require("../../utils/config");
@@ -45,7 +42,7 @@ const prompts_1 = require("../../utils/prompts");
45
42
  const logger_1 = require("../../utils/logger");
46
43
  const colors_1 = require("../../utils/colors");
47
44
  const branch_operations_1 = require("../../utils/branch-operations");
48
- const inquirer_1 = __importDefault(require("inquirer"));
45
+ const prompt_1 = require("../../utils/prompt");
49
46
  async function main(opts) {
50
47
  console.log('\n' + '='.repeat(60));
51
48
  console.log((0, colors_1.colorize)('Bulk Branch Switch', 'bright'));
@@ -86,33 +83,25 @@ async function main(opts) {
86
83
  (0, logger_1.logError)('Usage: w branch switch --workspace <name> --branch <branch>');
87
84
  process.exit(1);
88
85
  }
89
- const { branch } = await inquirer_1.default.prompt([
90
- {
91
- type: 'input',
92
- name: 'branch',
93
- message: 'Target branch name:',
94
- default: 'main',
95
- validate: (input) => {
96
- if (!input || input.trim().length === 0) {
97
- return 'Branch name cannot be empty';
98
- }
99
- return true;
100
- },
86
+ const branch = await (0, prompt_1.input)({
87
+ message: 'Target branch name:',
88
+ default: 'main',
89
+ validate: (input) => {
90
+ if (!input || input.trim().length === 0) {
91
+ return 'Branch name cannot be empty';
92
+ }
93
+ return true;
101
94
  },
102
- ]);
95
+ });
103
96
  targetBranch = branch;
104
97
  }
105
98
  (0, logger_1.logWarning)(`This will switch all repositories to branch: ${(0, colors_1.colorize)(targetBranch, 'cyan')}`);
106
99
  // Skip confirmation when --yes flag is provided
107
100
  if (!yes && process.stdout.isTTY) {
108
- const { confirmed } = await inquirer_1.default.prompt([
109
- {
110
- type: 'confirm',
111
- name: 'confirmed',
112
- message: 'Proceed with bulk branch switch?',
113
- default: true,
114
- },
115
- ]);
101
+ const confirmed = await (0, prompt_1.confirm)({
102
+ message: 'Proceed with bulk branch switch?',
103
+ default: true,
104
+ });
116
105
  if (!confirmed) {
117
106
  (0, logger_1.logInfo)('Branch switch cancelled');
118
107
  process.exit(0);
@@ -33,9 +33,6 @@ var __importStar = (this && this.__importStar) || (function () {
33
33
  return result;
34
34
  };
35
35
  })();
36
- var __importDefault = (this && this.__importDefault) || function (mod) {
37
- return (mod && mod.__esModule) ? mod : { "default": mod };
38
- };
39
36
  Object.defineProperty(exports, "__esModule", { value: true });
40
37
  exports.cacheInfo = cacheInfo;
41
38
  exports.cacheRefresh = cacheRefresh;
@@ -47,7 +44,7 @@ const cache_1 = require("../../utils/cache");
47
44
  const github_1 = require("../../utils/github");
48
45
  const logger_1 = require("../../utils/logger");
49
46
  const colors_1 = require("../../utils/colors");
50
- const inquirer_1 = __importDefault(require("inquirer"));
47
+ const prompt_1 = require("../../utils/prompt");
51
48
  const fuzzy = __importStar(require("fuzzy"));
52
49
  async function cacheInfo() {
53
50
  const stats = await (0, cache_1.getCacheStats)();
@@ -151,18 +148,14 @@ async function main() {
151
148
  return;
152
149
  }
153
150
  // Interactive mode (original behavior)
154
- const { selectedAction } = await inquirer_1.default.prompt([
155
- {
156
- type: 'list',
157
- name: 'selectedAction',
158
- message: 'Select action:',
159
- choices: [
160
- { name: 'View cache info', value: 'info' },
161
- { name: 'Refresh cache (force fetch from GitHub)', value: 'refresh' },
162
- { name: 'Clear cache', value: 'clear' },
163
- ],
164
- },
165
- ]);
151
+ const selectedAction = await (0, prompt_1.select)({
152
+ message: 'Select action:',
153
+ choices: [
154
+ { name: 'View cache info', value: 'info' },
155
+ { name: 'Refresh cache (force fetch from GitHub)', value: 'refresh' },
156
+ { name: 'Clear cache', value: 'clear' },
157
+ ],
158
+ });
166
159
  if (selectedAction === 'info') {
167
160
  await cacheInfo();
168
161
  }
@@ -170,14 +163,10 @@ async function main() {
170
163
  await cacheRefresh();
171
164
  }
172
165
  else if (selectedAction === 'clear') {
173
- const { confirmed } = await inquirer_1.default.prompt([
174
- {
175
- type: 'confirm',
176
- name: 'confirmed',
177
- message: 'Are you sure you want to clear the cache?',
178
- default: false,
179
- },
180
- ]);
166
+ const confirmed = await (0, prompt_1.confirm)({
167
+ message: 'Are you sure you want to clear the cache?',
168
+ default: false,
169
+ });
181
170
  if (confirmed) {
182
171
  await cacheClear();
183
172
  }
@@ -32,9 +32,6 @@ var __importStar = (this && this.__importStar) || (function () {
32
32
  return result;
33
33
  };
34
34
  })();
35
- var __importDefault = (this && this.__importDefault) || function (mod) {
36
- return (mod && mod.__esModule) ? mod : { "default": mod };
37
- };
38
35
  Object.defineProperty(exports, "__esModule", { value: true });
39
36
  exports.registerCleanupCommand = registerCleanupCommand;
40
37
  const path = __importStar(require("path"));
@@ -43,7 +40,7 @@ const workspace_meta_1 = require("../utils/workspace-meta");
43
40
  const cleanup_operations_1 = require("../utils/cleanup-operations");
44
41
  const logger_1 = require("../utils/logger");
45
42
  const colors_1 = require("../utils/colors");
46
- const inquirer_1 = __importDefault(require("inquirer"));
43
+ const prompt_1 = require("../utils/prompt");
47
44
  const command_helpers_1 = require("../utils/command-helpers");
48
45
  function registerCleanupCommand(parent) {
49
46
  parent
@@ -83,34 +80,25 @@ async function handleCleanup(workspaceArg, opts) {
83
80
  operations.push('git_clean');
84
81
  }
85
82
  else {
86
- const result = await inquirer_1.default.prompt([
87
- {
88
- type: 'checkbox',
89
- name: 'operations',
90
- message: 'Select cleanup operations:',
91
- choices: [
92
- { name: 'Remove node_modules (all repos)', value: 'node_modules' },
93
- { name: 'Remove build artifacts (dist, build, .next, coverage)', value: 'build' },
94
- { name: 'Git clean (remove untracked files)', value: 'git_clean' },
95
- ],
96
- },
97
- ]);
98
- operations = result.operations;
83
+ operations = await (0, prompt_1.checkbox)({
84
+ message: 'Select cleanup operations:',
85
+ choices: [
86
+ { name: 'Remove node_modules (all repos)', value: 'node_modules' },
87
+ { name: 'Remove build artifacts (dist, build, .next, coverage)', value: 'build' },
88
+ { name: 'Git clean (remove untracked files)', value: 'git_clean' },
89
+ ],
90
+ });
99
91
  }
100
92
  if (operations.length === 0) {
101
93
  (0, logger_1.logInfo)('No operations selected');
102
94
  return;
103
95
  }
104
96
  if (!opts.yes) {
105
- const { confirm } = await inquirer_1.default.prompt([
106
- {
107
- type: 'confirm',
108
- name: 'confirm',
109
- message: `Proceed with cleanup? This cannot be undone.`,
110
- default: false,
111
- },
112
- ]);
113
- if (!confirm) {
97
+ const confirmed = await (0, prompt_1.confirm)({
98
+ message: `Proceed with cleanup? This cannot be undone.`,
99
+ default: false,
100
+ });
101
+ if (!confirmed) {
114
102
  (0, logger_1.logInfo)('Cleanup cancelled');
115
103
  return;
116
104
  }
@@ -1,7 +1,42 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
2
35
  Object.defineProperty(exports, "__esModule", { value: true });
3
36
  exports.registerConfigCommand = registerConfigCommand;
37
+ const fs = __importStar(require("fs"));
4
38
  const config_1 = require("../utils/config");
39
+ const editor_1 = require("../utils/editor");
5
40
  const config_schema_1 = require("../utils/config-schema");
6
41
  const output_1 = require("../utils/output");
7
42
  const logger_1 = require("../utils/logger");
@@ -94,6 +129,53 @@ function registerConfigCommand(parent) {
94
129
  .action(() => {
95
130
  process.stdout.write(config_1.CONFIG_PATH + '\n');
96
131
  });
132
+ config
133
+ .command('edit')
134
+ .description('Open the config file in $EDITOR (or $VISUAL)')
135
+ .action(() => {
136
+ handleEdit();
137
+ });
138
+ }
139
+ function handleEdit() {
140
+ if (!process.stdout.isTTY) {
141
+ (0, logger_1.logError)('`config edit` needs an interactive terminal. Use `config set <key> <value>` in scripts.');
142
+ process.exitCode = 1;
143
+ return;
144
+ }
145
+ // Seed the file with the fully-resolved config so there's something complete
146
+ // to edit on a first run (getUserConfig merges defaults + any overrides).
147
+ if (!fs.existsSync(config_1.CONFIG_PATH))
148
+ (0, config_1.saveUserConfig)((0, config_1.getUserConfig)());
149
+ const result = (0, editor_1.openInEditor)(config_1.CONFIG_PATH);
150
+ if (!result.ok) {
151
+ (0, logger_1.logError)(result.error ?? `editor exited with code ${result.code}`);
152
+ process.exitCode = 1;
153
+ return;
154
+ }
155
+ // Re-validate: a hand-edit can produce invalid JSON or invalid values, which
156
+ // getUserConfig would silently ignore (falling back to defaults). Surface that
157
+ // instead, using the SAME schema `config set` uses so both write paths agree.
158
+ const review = (0, config_schema_1.reviewConfigFileText)(fs.readFileSync(config_1.CONFIG_PATH, 'utf-8'));
159
+ if (review.parseError) {
160
+ (0, logger_1.logError)(`${config_1.CONFIG_PATH} is not valid JSON after editing — changes are kept, but Nemus will use defaults until it parses.`);
161
+ process.exitCode = 1;
162
+ return;
163
+ }
164
+ if (review.notObject) {
165
+ (0, logger_1.logError)(`${config_1.CONFIG_PATH} must contain a JSON object — changes are kept, but Nemus will use defaults until it does.`);
166
+ process.exitCode = 1;
167
+ return;
168
+ }
169
+ if (review.unknownKeys.length > 0)
170
+ (0, logger_1.logWarning)(`Ignoring unrecognized key(s): ${review.unknownKeys.join(', ')}`);
171
+ if (!review.ok) {
172
+ for (const e of review.invalid)
173
+ (0, logger_1.logWarning)(e);
174
+ (0, logger_1.logError)('Some values are invalid and will fall back to their defaults until fixed.');
175
+ process.exitCode = 1;
176
+ return;
177
+ }
178
+ (0, logger_1.logSuccess)('Config saved.');
97
179
  }
98
180
  function printAll(cfg, json) {
99
181
  if (json) {
@@ -1,13 +1,10 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.registerConfigureClaudeCommand = registerConfigureClaudeCommand;
7
4
  const claude_integration_1 = require("../utils/claude-integration");
8
5
  const logger_1 = require("../utils/logger");
9
6
  const colors_1 = require("../utils/colors");
10
- const inquirer_1 = __importDefault(require("inquirer"));
7
+ const prompt_1 = require("../utils/prompt");
11
8
  function registerConfigureClaudeCommand(parent) {
12
9
  parent
13
10
  .command('configure-claude')
@@ -27,10 +24,9 @@ async function handleConfigureClaude() {
27
24
  console.log(` Auto-launch Claude: ${currentConfig.autoLaunch ? (0, colors_1.colorize)('Enabled', 'green') : (0, colors_1.colorize)('Disabled', 'red')}`);
28
25
  console.log(` Generate context: ${currentConfig.generateContext ? (0, colors_1.colorize)('Enabled', 'green') : (0, colors_1.colorize)('Disabled', 'red')}`);
29
26
  console.log('');
30
- const answers = await inquirer_1.default.prompt([
31
- { type: 'confirm', name: 'autoLaunch', message: 'Auto-launch Claude Code after workspace creation?', default: currentConfig.autoLaunch },
32
- { type: 'confirm', name: 'generateContext', message: 'Generate CLAUDE.md context file in workspaces?', default: currentConfig.generateContext },
33
- ]);
27
+ const autoLaunch = await (0, prompt_1.confirm)({ message: 'Auto-launch Claude Code after workspace creation?', default: currentConfig.autoLaunch });
28
+ const generateContext = await (0, prompt_1.confirm)({ message: 'Generate CLAUDE.md context file in workspaces?', default: currentConfig.generateContext });
29
+ const answers = { autoLaunch, generateContext };
34
30
  await (0, claude_integration_1.saveClaudeConfig)(answers);
35
31
  console.log('');
36
32
  (0, logger_1.logSuccess)('Claude Code integration configured!');