codex-copilot-dx 1.2.32 → 1.3.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 (48) hide show
  1. package/README.md +65 -113
  2. package/bin/cli.mjs +61 -103
  3. package/docs/ARCHITECTURE.md +51 -3
  4. package/docs/README.md +9 -76
  5. package/docs/REFERENCE.md +137 -1827
  6. package/package.json +11 -4
  7. package/src/access-settings.mjs +2 -2
  8. package/src/adapter.mjs +1 -1
  9. package/src/auth-credentials.mjs +1 -1
  10. package/src/auto-review-model.mjs +2 -2
  11. package/src/cli-animation.mjs +2 -2
  12. package/src/cli-auth.mjs +3 -3
  13. package/src/cli-cache.mjs +2 -2
  14. package/src/cli-command-spec.mjs +325 -0
  15. package/src/cli-image.mjs +4 -4
  16. package/src/cli-limits.mjs +2 -2
  17. package/src/cli-m365.mjs +1 -1
  18. package/src/cli-management.mjs +344 -0
  19. package/src/cli-options.mjs +73 -443
  20. package/src/cli-status.mjs +7 -7
  21. package/src/cli-tools.mjs +3 -2
  22. package/src/client-integration.mjs +7 -3
  23. package/src/config.mjs +4 -3
  24. package/src/connection-runtime.mjs +1414 -350
  25. package/src/copilot-token-session.mjs +1 -1
  26. package/src/dashboard/connections.js +23 -4
  27. package/src/dashboard/ui.css +9 -2
  28. package/src/dashboard-api.mjs +5 -5
  29. package/src/doctor.mjs +4 -4
  30. package/src/image-mcp.mjs +2 -2
  31. package/src/native-prediction-fix.mjs +1 -1
  32. package/src/native-prediction-profile.mjs +1 -1
  33. package/src/native-prediction-windows.mjs +1 -1
  34. package/src/native-prediction.mjs +6 -6
  35. package/src/nightly-update.mjs +2 -2
  36. package/src/provider-runtime.mjs +1 -1
  37. package/src/providers/m365-accounts.mjs +1 -1
  38. package/src/release-install.mjs +11 -15
  39. package/src/service-control.mjs +1 -1
  40. package/src/settings-preferences.mjs +6 -4
  41. package/src/startup-ui.mjs +34 -2
  42. package/src/terminal-console.mjs +32 -30
  43. package/src/terminal-state.mjs +69 -0
  44. package/src/usage.mjs +5 -5
  45. package/src/windows-command.mjs +2 -2
  46. package/bin/codex-copilot-dx.mjs +0 -11
  47. package/src/cli-models.mjs +0 -94
  48. package/src/legacy-command-warning.mjs +0 -38
package/package.json CHANGED
@@ -1,12 +1,11 @@
1
1
  {
2
2
  "name": "codex-copilot-dx",
3
- "version": "1.2.32",
3
+ "version": "1.3.0",
4
4
  "description": "Local gateway for Codex and Claude with Copilot, Microsoft 365 and custom APIs",
5
5
  "author": "Dale Xiao",
6
6
  "type": "module",
7
7
  "bin": {
8
- "ccdx": "bin/cli.mjs",
9
- "codex-copilot-dx": "bin/codex-copilot-dx.mjs"
8
+ "ccdx": "bin/cli.mjs"
10
9
  },
11
10
  "files": [
12
11
  "bin/",
@@ -60,5 +59,13 @@
60
59
  },
61
60
  "optionalDependencies": {
62
61
  "@azure/msal-node-runtime": "0.20.6"
63
- }
62
+ },
63
+ "os": [
64
+ "darwin",
65
+ "win32"
66
+ ],
67
+ "cpu": [
68
+ "x64",
69
+ "arm64"
70
+ ]
64
71
  }
@@ -2,7 +2,7 @@ import fs from "node:fs";
2
2
  import path from "node:path";
3
3
  import { userSettingsPath } from "./user-settings.mjs";
4
4
  import { readBoundedFileSync } from "./bounded-file.mjs";
5
- import { atomicWriteFileSync } from "./atomic-file.mjs";
5
+ import { atomicWriteFileSync, atomicWriteFileIfChangedSync } from "./atomic-file.mjs";
6
6
  import { withFileLockSync } from "./lock.mjs";
7
7
  import { isProviderId } from "./provider-metadata.mjs";
8
8
  import { CODEX_AUTO_REVIEW_MODEL } from "./models.mjs";
@@ -114,6 +114,6 @@ export function updateAccessSettings(change, options = {}) {
114
114
  const original = readBoundedFileSync(file, { maxBytes: 8 * 1024 * 1024, encoding: "utf8" });
115
115
  if (JSON.parse(original).version === 1 && !fs.existsSync(`${file}.v1-backup`)) atomicWriteFileSync(`${file}.v1-backup`, original, { mode: 0o600 });
116
116
  } catch (error) { if (error.code !== "ENOENT") throw error; }
117
- atomicWriteFileSync(file, text, { mode: 0o600 });return next;
117
+ atomicWriteFileIfChangedSync(file, text, { mode: 0o600 });return next;
118
118
  });
119
119
  }
package/src/adapter.mjs CHANGED
@@ -77,7 +77,7 @@ function sendRetiredClaudeSurface(res) {
77
77
  error: {
78
78
  type: "not_found_error",
79
79
  code: "ccdx_claude_retired",
80
- message: "The GitHub Claude endpoint was retired in ccdx 0.7.0. Microsoft 365 Claude uses the separate gateway; run ccdx m365 status.",
80
+ message: "The GitHub Claude endpoint was retired in ccdx 0.7.0. Microsoft 365 Claude uses the separate gateway; run ccdx source m365 status.",
81
81
  },
82
82
  }));
83
83
  }
@@ -35,7 +35,7 @@ export function githubTokenMetadataPath(home = os.homedir()) {
35
35
 
36
36
  export function githubReauthMessage(reason, home = os.homedir()) {
37
37
  return `${reason}
38
- Run ccdx auth reauth to sign in again.
38
+ Run ccdx source github reauth to sign in again.
39
39
  The saved sign-in is kept until verification succeeds.`;
40
40
  }
41
41
 
@@ -93,7 +93,7 @@ export async function runAutoReviewModelCommand({
93
93
  followClientLabel = "follow client (low when omitted)",
94
94
  } = {}) {
95
95
  if (!prompt && (!input.isTTY || !output.isTTY)) {
96
- throw new Error(`${commandName} auto-review-model requires an interactive terminal`);
96
+ throw new Error(`${commandName} app codex review select requires an interactive terminal`);
97
97
  }
98
98
 
99
99
  readUserSettings({ env, home, strict: true });
@@ -102,7 +102,7 @@ export async function runAutoReviewModelCommand({
102
102
  const modelIds = sortedModelIds(catalog.modelIds, current.model);
103
103
  if (!modelIds.length) throw new Error("No selectable Responses models are available");
104
104
 
105
- output.write(`${commandName} auto-review-model\n`);
105
+ output.write(`${commandName} app codex review select\n`);
106
106
  output.write(`Current: ${current.model} (${current.source})\n`);
107
107
  output.write(`Reasoning: ${current.reasoningEffort || followClientLabel}\n`);
108
108
  output.write(`Responses models from ${catalog.source}:\n`);
@@ -38,14 +38,14 @@ export async function runAnimationCommand({
38
38
  gallery = startTerminalAnimationGallery,
39
39
  } = {}) {
40
40
  if (!prompt && (!input.isTTY || !output.isTTY)) {
41
- throw new Error(`${commandName} animation requires an interactive terminal`);
41
+ throw new Error(`${commandName} config animation requires an interactive terminal`);
42
42
  }
43
43
 
44
44
  readUserSettings({ env, home, strict: true });
45
45
  const current = terminalAnimationPreference({ env, home });
46
46
  const currentIndex = TERMINAL_ANIMATION_THEMES.findIndex(({ id }) => id === current.theme);
47
47
 
48
- output.write(`${commandName} animation\n`);
48
+ output.write(`${commandName} config animation\n`);
49
49
  output.write(`Current: ${TERMINAL_ANIMATION_THEMES[currentIndex].label} (${current.source})\n\n`);
50
50
  const labels = TERMINAL_ANIMATION_THEMES.map((theme, index) => ` ${index + 1}. ${theme.label}${markers(theme, current.theme)}`);
51
51
  const prefixWidth = Math.max(...labels.map((label) => label.length)) + 2;
package/src/cli-auth.mjs CHANGED
@@ -31,7 +31,7 @@ function onlineStatusLine(profile) {
31
31
 
32
32
  function authStatusPlainLines(snapshot, { commandName }) {
33
33
  return [
34
- `${commandName} auth status`,
34
+ `${commandName} source github status`,
35
35
  status(snapshot.profiles.codex.valid ? "ok" : "warn", `Codex: ${accountLabel(snapshot.profiles.codex)} [${snapshot.profiles.codex.source === "ccdx" ? "CCDX store" : "legacy path"}]`),
36
36
  onlineStatusLine(snapshot.profiles.codex),
37
37
  status("info", `Routing: responses -> ${snapshot.routing.responses}`),
@@ -90,7 +90,7 @@ export function formatAuthStatus(snapshot = authStatus(), {
90
90
  if (format === "auto" && table.overflow) {
91
91
  return plainLines.map((line) => terminalCell(line, { fallback: "" })).join("\n");
92
92
  }
93
- const lines = [`${commandName} auth status`, "", table.output];
93
+ const lines = [`${commandName} source github status`, "", table.output];
94
94
  if (table.compact) {
95
95
  lines.push("", "Details:", ...plainLines.slice(1, -1).map((line) => terminalCell(line, { fallback: "" })));
96
96
  }
@@ -137,7 +137,7 @@ export async function runAuthCommand({
137
137
  if (result.operation?.state === "failed") throw new Error(`Sign-in failed: ${safeCell(result.operation.reason)}. Saved sign-in kept.`);
138
138
  return { action, output: result.operation?.state === "cancelled" ? "Sign-in cancelled. Saved sign-in kept."
139
139
  : result.operation?.state === "complete" ? "Signed in and verified. Use a new conversation; restart CCDX to change accounts."
140
- : "A sign-in is saved. Run ccdx auth check to verify it, or ccdx auth reauth to replace it." };
140
+ : "A sign-in is saved. Run ccdx source github check to verify it, or ccdx source github reauth to replace it." };
141
141
  } finally { process.removeListener("SIGINT", cancel);tools.dispose(); }
142
142
  }
143
143
  if (action !== "status") throw new Error(`Unsupported auth action: ${action}`);
package/src/cli-cache.mjs CHANGED
@@ -61,7 +61,7 @@ async function confirmHistoryCleanup({ input, output, prompt, yes }) {
61
61
  }
62
62
 
63
63
  function formatStatus(preference, runtime) {
64
- const lines = ["ccdx cache", `Saved buffer limit: ${mib(preference.bytes)} (${preference.source})`];
64
+ const lines = ["ccdx doctor cache", `Saved buffer limit: ${mib(preference.bytes)} (${preference.source})`];
65
65
  if (!runtime?.supported) {
66
66
  lines.push(runtime?.offline
67
67
  ? "Runtime cache: adapter is not running"
@@ -104,7 +104,7 @@ export async function runCacheCommand({
104
104
  }
105
105
  if (action === "limit") {
106
106
  if (String(env.CCDX_RESPONSE_HISTORY_MAX_BYTES || "").trim()) {
107
- throw new Error("CCDX_RESPONSE_HISTORY_MAX_BYTES overrides saved cache settings; unset it before using ccdx cache --limit");
107
+ throw new Error("CCDX_RESPONSE_HISTORY_MAX_BYTES overrides saved cache settings; unset it before using ccdx doctor cache --limit");
108
108
  }
109
109
  const targetMib = resetLimit ? RESPONSE_HISTORY_DEFAULT_MIB : Number(limitMib);
110
110
  const targetBytes = targetMib * MIB;
@@ -0,0 +1,325 @@
1
+ import { isProviderId } from "./provider-metadata.mjs";
2
+
3
+ export const CLI_CLIENTS = Object.freeze({
4
+ codex: "codex",
5
+ "claude-app": "claude_app",
6
+ "claude-code": "claude_code",
7
+ });
8
+ const read = { "--format": "format" },
9
+ confirm = { "--yes": "flag", "--preview": "flag" };
10
+ const command = (path, description, options = {}, dispatch) => ({
11
+ path: path.split(" "),
12
+ description,
13
+ options,
14
+ dispatch,
15
+ });
16
+ // Commands, option validation and nearby help share one public grammar.
17
+ export const MANAGED_COMMANDS = [
18
+ command(
19
+ "start",
20
+ "Start the local gateway",
21
+ { "--show-request-id": "flag", "--no-browser": "flag", "--verbose": "flag" },
22
+ flags => ({
23
+ command: "start",
24
+ showRequestId: !!flags.show_request_id,
25
+ noBrowser: !!flags.no_browser,
26
+ verbose: !!flags.verbose,
27
+ })
28
+ ),
29
+ command("version", "Show the installed version", {}, () => ({ command: "version" })),
30
+ command("web", "Open the local Web UI", {}, () => ({ command: "web" })),
31
+ command(
32
+ "doctor",
33
+ "Check local setup",
34
+ { "--online": "flag", "--compat": "flag", "--fix": "flag", "--json": "flag" },
35
+ flags => ({
36
+ command: "doctor",
37
+ online: !!flags.online,
38
+ compat: !!flags.compat,
39
+ fix: !!flags.fix,
40
+ json: !!flags.json,
41
+ })
42
+ ),
43
+ command("doctor config", "Check client configuration without changes", {}, () => ({
44
+ command: "doctor",
45
+ configOnly: true,
46
+ })),
47
+ ...["network", "report"].map(tool =>
48
+ command(`doctor ${tool}`, "Inspect local diagnostics", {}, () => ({ command: "doctor", tool }))
49
+ ),
50
+ ...["", "github", "npm"].map(source =>
51
+ command(
52
+ `update${source ? " " + source : ""}`,
53
+ "Install an update; restart normally afterward",
54
+ { "--allow-remote": "flag" },
55
+ flags => ({ command: "update", updateSource: source || undefined, allowRemote: !!flags.allow_remote })
56
+ )
57
+ ),
58
+ command("source list", "List registered model sources", read),
59
+ command("source add", "Save an API and read its model catalog", {
60
+ "--file": "value",
61
+ "--key-stdin": "flag",
62
+ ...confirm,
63
+ }),
64
+ command("source <source> status", "Show saved sign-in and catalog evidence", read),
65
+ command("source <source> models", "Show the source catalog; refresh explicitly", {
66
+ ...read,
67
+ "--refresh": "flag",
68
+ }),
69
+ command("source <source> check", "Check source access without inference", read),
70
+ command("source <source> edit", "Edit API configuration and model selection", {
71
+ "--file": "value",
72
+ "--key-stdin": "flag",
73
+ ...confirm,
74
+ }),
75
+ command("source <source> access", "Show or edit client authorization", {
76
+ ...read,
77
+ "--edit": "flag",
78
+ "--apps": "value",
79
+ ...confirm,
80
+ }),
81
+ command("source <source> enable", "Enable a source without selecting client models", confirm),
82
+ command("source <source> disable", "Review affected clients before disabling", {
83
+ ...confirm,
84
+ "--replacements": "value",
85
+ }),
86
+ command("source <source> remove", "Remove a disabled, unbound API source", confirm),
87
+ ...["login", "reauth", "logout"].map(action =>
88
+ command(
89
+ `source github ${action}`,
90
+ "Manage GitHub sign-in",
91
+ action === "logout" ? { "--yes": "flag" } : { "--login": "value" },
92
+ flags => ({
93
+ command: "auth",
94
+ action,
95
+ yes: !!flags.yes,
96
+ ...(flags.login ? { expectedLogin: flags.login } : {}),
97
+ })
98
+ )
99
+ ),
100
+ ...["accounts", "account"].map(action =>
101
+ command(
102
+ `source m365 ${action}`,
103
+ "Read or select a company account",
104
+ action === "account" ? { "--id": "value" } : {},
105
+ flags => ({ command: "m365", action, ...(flags.id ? { accountId: flags.id } : {}) })
106
+ )
107
+ ),
108
+ command("app list", "List client configuration and observed activity", read),
109
+ command("app <app> status", "Show configuration, not process liveness", { ...read, "--details": "flag" }),
110
+ command("app <app> models", "Show or edit the client's selected model plan", {
111
+ ...read,
112
+ "--edit": "flag",
113
+ "--file": "value",
114
+ ...confirm,
115
+ }),
116
+ command("app <app> sync", "Preview or write CCDX-owned client configuration", confirm),
117
+ command("app <app> enable", "Enable client access with its saved selection", confirm),
118
+ command("app <app> disable", "Disable access without quitting the app", confirm),
119
+ command(
120
+ "app codex prediction status",
121
+ "Show local Codex prediction setup and observation",
122
+ read,
123
+ flags => ({
124
+ command: "prediction",
125
+ action: "status",
126
+ outputFormat: flags.format,
127
+ })
128
+ ),
129
+ ...["setup", "remove", "pause", "resume", "repair"].map(action =>
130
+ command(`app codex prediction ${action}`, "Manage the optional Codex prediction integration", {}, () => ({
131
+ command: "prediction",
132
+ action: { setup: "on", remove: "off", repair: "fix" }[action] || action,
133
+ }))
134
+ ),
135
+ command("app codex image status", "Show local Codex image setup; do not generate", read, flags => ({
136
+ command: "image",
137
+ action: "status",
138
+ outputFormat: flags.format,
139
+ })),
140
+ ...["setup", "remove", "pause", "resume"].map(action =>
141
+ command(`app codex image ${action}`, "Manage the Codex image integration", {}, () => ({
142
+ command: "image",
143
+ action: { setup: "enable", remove: "disable" }[action] || action,
144
+ }))
145
+ ),
146
+ command("app codex review status", "Show the Codex Auto-review selection", read),
147
+ command("app codex review select", "Choose the Codex Auto-review model", {}, () => ({
148
+ command: "auto-review-model",
149
+ })),
150
+ command("config show", "Show service and terminal preferences", { ...read, "--effective": "flag" }),
151
+ command("config set <key> <value>", "Save a validated service preference", confirm),
152
+ command("config terminal", "Choose terminal color", {}),
153
+ command("config animation", "Choose terminal animation", {}, () => ({ command: "animation" })),
154
+ command("config limits", "Show or set decoded-body limits", { "--decoded": "value" }, flags => ({
155
+ command: "limits",
156
+ action: flags.decoded ? "set" : "status",
157
+ resetLimit: flags.decoded === "default",
158
+ limitMib: flags.decoded && flags.decoded !== "default" ? Number(flags.decoded) : undefined,
159
+ })),
160
+ command("config reset", "Back up and restore service preferences to defaults", confirm),
161
+ command("config restore", "Restore the current service preference backup", confirm),
162
+ command(
163
+ "doctor cache",
164
+ "Inspect or clear runtime buffers",
165
+ { "--limit": "value", "--clean": "flag", "--history": "flag", "--yes": "flag" },
166
+ flags => ({
167
+ command: "cache",
168
+ action: flags.limit ? "limit" : flags.clean ? "clean" : "status",
169
+ resetLimit: flags.limit === "default",
170
+ limitMib: flags.limit && flags.limit !== "default" ? Number(flags.limit) : undefined,
171
+ history: !!flags.history,
172
+ yes: !!flags.yes,
173
+ })
174
+ ),
175
+ command("requests", "Show bounded recent model requests", {
176
+ ...read,
177
+ "--active": "flag",
178
+ "--failed": "flag",
179
+ "--app": "value",
180
+ "--source": "value",
181
+ "--limit": "integer",
182
+ }),
183
+ command("requests show <request>", "Show a retained request and its original diagnostic fields", read),
184
+ command("status", "Show service state; expand diagnostics explicitly", { ...read, "--details": "flag" }),
185
+ command("usage", "Show all recorded usage or this service run", {
186
+ ...read,
187
+ "--scope": "scope",
188
+ "--provider": "value",
189
+ }),
190
+ command("update check", "Check a stable release without installing", read),
191
+ ];
192
+
193
+ function pathMatch(pattern, values, partial = false) {
194
+ if ((!partial && pattern.length !== values.length) || (partial && pattern.length < values.length))
195
+ return null;
196
+ const found = {};
197
+ for (let index = 0; index < values.length; index++) {
198
+ const token = pattern[index],
199
+ value = values[index];
200
+ if (token.startsWith("<")) {
201
+ const key = token.slice(1, -1);
202
+ if ((key === "source" && !isProviderId(value)) || (key === "app" && !Object.hasOwn(CLI_CLIENTS, value)))
203
+ return null;
204
+ found[key] = value;
205
+ } else if (token !== value) return null;
206
+ }
207
+ return found;
208
+ }
209
+ function optionsFor(args, definition) {
210
+ const values = {};
211
+ for (let index = 0; index < args.length; index++) {
212
+ const option = args[index],
213
+ type = definition.options[option],
214
+ key = option.replace(/^--/, "").replaceAll("-", "_");
215
+ if (!type || Object.hasOwn(values, key)) throw new Error(`Unexpected or repeated option: ${option}`);
216
+ if (type === "flag") {
217
+ values[key] = true;
218
+ continue;
219
+ }
220
+ const value = args[++index];
221
+ if (!value || value.startsWith("--")) throw new Error(`Enter a value for ${option}`);
222
+ if (type === "format" && !["table", "plain", "json"].includes(value))
223
+ throw new Error("Format must be table, plain or json");
224
+ if (type === "scope" && !["run", "all"].includes(value)) throw new Error("Scope must be run or all");
225
+ if (type === "integer" && (!/^\d+$/.test(value) || Number(value) < 1 || Number(value) > 100))
226
+ throw new Error("Limit must be an integer from 1 to 100");
227
+ values[key] = type === "integer" ? Number(value) : value;
228
+ }
229
+ if (values.app && !Object.hasOwn(CLI_CLIENTS, values.app))
230
+ throw new Error("Choose codex, claude-app or claude-code");
231
+ if (values.provider && !isProviderId(values.provider)) throw new Error("Enter a valid usage source ID");
232
+ if (values.source && !isProviderId(values.source)) throw new Error("Enter a listed source ID");
233
+ if (values.active && values.failed) throw new Error("Choose --active or --failed");
234
+ if (values.apps !== undefined && !values.edit) throw new Error("--apps requires --edit");
235
+ if (values.file && definition.path[0] === "app" && !values.edit) throw new Error("--file requires --edit");
236
+ if (
237
+ (values.active || values.failed || values.edit || values.preview) &&
238
+ values.format === "json" &&
239
+ values.edit
240
+ )
241
+ throw new Error("Interactive edits do not use JSON output");
242
+ return values;
243
+ }
244
+ export function parseManagedCommand(args) {
245
+ const root = args[0];
246
+ const optionAt = args.findIndex(value => value.startsWith("--")),
247
+ words = optionAt < 0 ? args : args.slice(0, optionAt);
248
+ const candidates = MANAGED_COMMANDS.filter(item => pathMatch(item.path, words));
249
+ const definition = candidates.sort(
250
+ (a, b) =>
251
+ a.path.filter(token => token.startsWith("<")).length -
252
+ b.path.filter(token => token.startsWith("<")).length
253
+ )[0];
254
+ if (!definition) throw new Error(`Unknown command path: ${words.join(" ")}. Use ccdx ${root} --help`);
255
+ const values = optionsFor(optionAt < 0 ? [] : args.slice(optionAt), definition),
256
+ ids = pathMatch(definition.path, words);
257
+ if (values.login && !/^[a-z\d_-]{1,39}$/i.test(values.login))
258
+ throw new Error("Enter a GitHub account name");
259
+ if (values.id && !/^[a-f0-9]{64}$/.test(values.id))
260
+ throw new Error("Use an account ID from source m365 accounts");
261
+ if (
262
+ words.join(" ") === "doctor cache" &&
263
+ ((values.limit && values.clean) || ((values.history || values.yes) && !values.clean))
264
+ )
265
+ throw new Error("Use --limit alone or --clean [--history] [--yes]");
266
+ for (const key of ["limit", "decoded"])
267
+ if (values[key] && values[key] !== "default" && !/^\d+$/.test(values[key]))
268
+ throw new Error("Enter an integer MiB value or default");
269
+ if (definition.dispatch) return { dispatch: definition.dispatch(values, ids) };
270
+ return { command: "manage", group: root, path: words, ids, flags: values };
271
+ }
272
+
273
+ const extras = {
274
+ source:
275
+ "Status reads local/cached evidence. check/--refresh may contact the source; no inference.\nSource access grants do not select client models. Disable previews affected clients.\nGitHub login and company-account selection are source-specific.\nChoose visible models and defaults with app <app> models --edit.",
276
+ app: "Configured is not App adoption or process liveness. Unknown stays unknown.\nmodels shows the selected plan; source <id> models shows the upstream catalog.\nsetup/remove changes integration setup; pause/resume retains credentials.\nsync --preview shows the model/configuration plan, not a byte-level file diff.\nNo client program is force-restarted.",
277
+ config:
278
+ "Only service and terminal preferences are in scope. Browser appearance stays in WebUI.\nReset keeps accounts, keys, model plans and chats and stores a pre-reset backup.\nSaved and effective values can differ; restart requirements remain explicit.",
279
+ requests:
280
+ "Only retained records are available. Unknown clients are not guessed from an API route.\n--failed filters failed model outcomes and structured HTTP/model errors.\nUsage records, HTTP calls and model outcomes are distinct counters.",
281
+ status:
282
+ "Default interactive status is brief; --details retains the complete diagnostic view.\nThe installed package version can differ from the running service.\nA listening gateway does not prove upstream model access.",
283
+ usage:
284
+ "Default usage includes all recorded usage. --scope run reads the running service.\nUsage records are not billed request counts. Cache hit is a token-reuse estimate.",
285
+ doctor:
286
+ "Default checks are read-only. Explicit online/compatibility checks and owned repairs have separate options.",
287
+ update:
288
+ "check does not install. Updates preserve npm policy. --allow-remote permits URL downloads for the entire dependency tree for this installation only.\nFinish tasks before changing the active installation; restart normally afterward.",
289
+ };
290
+ export function managedCommandHelp(parts) {
291
+ if (!MANAGED_COMMANDS.some(item => item.path[0] === parts[0])) return null;
292
+ const entries = MANAGED_COMMANDS.filter(
293
+ item =>
294
+ pathMatch(item.path, parts, true) &&
295
+ !(
296
+ parts[0] === "source" &&
297
+ ["github", "m365"].includes(parts[1]) &&
298
+ ["edit", "remove"].includes(item.path.at(-1))
299
+ )
300
+ );
301
+ if (!entries.length) throw new Error(`Unknown help path: ${parts.join(" ")}`);
302
+ return (
303
+ "Usage:\n" +
304
+ entries
305
+ .map(
306
+ item =>
307
+ ` ccdx ${item.path.map((token, index) => parts[index] || token).join(" ")}${Object.entries(
308
+ item.options
309
+ )
310
+ .map(
311
+ ([name, type]) =>
312
+ ` [${name}${type === "flag" ? "" : type === "format" ? " table|plain|json" : " VALUE"}]`
313
+ )
314
+ .join("")}\n ${item.description}`
315
+ )
316
+ .join("\n") +
317
+ (extras[parts[0]] ? "\n\n" + extras[parts[0]] : "") +
318
+ (parts.join(" ") === "doctor cache"
319
+ ? "\nHistory cleanup requires confirmation or --yes. --history may break chat continuation."
320
+ : "")
321
+ );
322
+ }
323
+ export function rootCommandHelp() {
324
+ return `Usage:\n ccdx [start] [--show-request-id] [--no-browser] [--verbose]\n\nCommon:\n status Show service state; --details expands diagnostics\n web Open local management tools\n requests Show retained model requests and failures\n usage Show recorded token usage\n doctor Check local setup; deeper checks are explicit\n\nManage:\n source Accounts, APIs, catalogs and client authorization\n app Client model plans, sync and app-specific features\n config Service and terminal preferences\n\nUpdate:\n update check Check without installing\n update github|npm Install; restart the service normally afterward\n version Show installed package version\n\nHelp:\n ccdx <command> --help\n ccdx help app codex prediction\n\nStart keeps the existing configured-client setup and launch behavior.\nCLI output stays in English. Read-only commands do not start a service.`;
325
+ }
package/src/cli-image.mjs CHANGED
@@ -23,7 +23,7 @@ async function visibleQuestion(input, output, question) {
23
23
  finally { prompt.close(); }
24
24
  }
25
25
 
26
- export function hiddenQuestion(input, output, question) {
26
+ export function hiddenQuestion(input, output, question, { cancelMessage = "Image provider setup cancelled" } = {}) {
27
27
  if (!input?.isTTY || !output?.isTTY || typeof input.setRawMode !== "function") {
28
28
  return Promise.reject(new Error("Hidden API key input requires an interactive terminal"));
29
29
  }
@@ -43,7 +43,7 @@ export function hiddenQuestion(input, output, question) {
43
43
  const onKeypress = (text, key = {}) => {
44
44
  if (key.ctrl && key.name === "c") {
45
45
  cleanup();
46
- reject(new Error("Image provider setup cancelled"));
46
+ reject(new Error(cancelMessage));
47
47
  return;
48
48
  }
49
49
  if (key.name === "return" || key.name === "enter") {
@@ -211,13 +211,13 @@ export async function runImageCommand({
211
211
  }
212
212
  if (action !== "enable") throw new Error(`Unknown image command action: ${action}`);
213
213
  if (!prompt && (!input.isTTY || !output.isTTY)) {
214
- throw new Error(`${commandName} enable-image requires an interactive terminal`);
214
+ throw new Error(`${commandName} app codex image setup requires an interactive terminal`);
215
215
  }
216
216
 
217
217
  const current = readImageProviderConfig({ env, home });
218
218
  const ask = prompt || ((question) => visibleQuestion(input, output, question));
219
219
  const askSecret = promptSecret || ((question) => hiddenQuestion(input, output, question));
220
- output.write(`${commandName} enable-image\n`);
220
+ output.write(`${commandName} app codex image setup\n`);
221
221
  output.write("Enter an HTTPS base URL (for example, https://api.example/v1) or a full /images/generations endpoint.\n");
222
222
  const endpointAnswer = String(await ask(`Image service URL${current ? ` [${current.endpoint}]` : ""}: `) || "").trim();
223
223
  if (!endpointAnswer && !current?.endpoint) throw new Error("Image API base URL or endpoint is required");
@@ -23,7 +23,7 @@ export async function runLimitsCommand({
23
23
  } = {}) {
24
24
  if (action === "set") {
25
25
  if (String(env.CCDX_MAX_DECODED_BODY_BYTES || "").trim()) {
26
- throw new Error("CCDX_MAX_DECODED_BODY_BYTES overrides saved limits; unset it before using ccdx limits --decoded");
26
+ throw new Error("CCDX_MAX_DECODED_BODY_BYTES overrides saved limits; unset it before using ccdx config limits --decoded");
27
27
  }
28
28
  writeDecodedBodyLimitMib(resetLimit ? null : limitMib, { env, home });
29
29
  } else if (action !== "status") {
@@ -40,7 +40,7 @@ export async function runLimitsCommand({
40
40
  const activeDecoded = Number(runtime?.data?.limits?.max_decoded_body_bytes);
41
41
  const activeRaw = Number(runtime?.data?.limits?.max_body_bytes);
42
42
  const lines = [
43
- "ccdx limits",
43
+ "ccdx config limits",
44
44
  `Configured decoded request body: ${mib(preference.bytes)} (${preference.source})`,
45
45
  runtime && Number.isFinite(activeDecoded) && activeDecoded > 0
46
46
  ? `Running decoded request body: ${mib(activeDecoded)}`
package/src/cli-m365.mjs CHANGED
@@ -122,7 +122,7 @@ export async function runM365Command({ action = "status", provider, model, autoR
122
122
  return result;
123
123
  }
124
124
  if (!accountId) {
125
- if (!prompt && (!input.isTTY || !output.isTTY)) throw new Error("Use ccdx m365 account --id ID from ccdx m365 accounts.");
125
+ if (!prompt && (!input.isTTY || !output.isTTY)) throw new Error("Use ccdx source m365 account --id ID from ccdx source m365 accounts.");
126
126
  output.write(accounts.map((value, index) => ` ${index + 1}. ${terminalCell(value.login)} / ${terminalCell(value.tenant)}${value.selected ? " [selected]" : value.current_windows ? " [Windows sign-in]" : ""}`).join("\n") + "\n");
127
127
  const answer = String(await ask("Choose an account, or q to cancel: ")).trim();
128
128
  if (answer === "q") return { cancelled: true };