@cotal-ai/cli 0.109.22 → 0.109.25

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/dist/index.js CHANGED
@@ -68,7 +68,7 @@ const baseCommands = [
68
68
  flags: setupFlags,
69
69
  validate: validateSetupArguments,
70
70
  outputs: ["json", "plain"],
71
- examples: ["cotal setup", "cotal setup --destination local -H claude --project ~/research -s research -y", "cotal setup --runtime tmux", "cotal setup --destination self-hosted --connection-file team.json", "cotal setup --destination local -H claude --project . -s demo --start -d", "cotal setup --skills"],
71
+ examples: [{ command: "cotal setup", note: "choose your application and prepare a space" }, { command: "cotal setup --destination local -H claude --project <dir> -s <name> -y", note: "prepare a local space without questions" }, { command: "cotal setup --destination self-hosted --connection-file <bundle.json>", note: "connect to a space that runs elsewhere" }],
72
72
  run: setup,
73
73
  },
74
74
  {
@@ -76,6 +76,7 @@ const baseCommands = [
76
76
  name: "help",
77
77
  group: "Setup",
78
78
  summary: "list the commands, or show one command's help",
79
+ examples: [{ command: "cotal help", note: "list every command by group" }, { command: "cotal help spawn", note: "show one command's options and examples" }, { command: "cotal help service start", note: "show one subcommand's help" }],
79
80
  usage: "cotal help [command…]",
80
81
  positionals: "[command…]",
81
82
  flags: helpFlags,
@@ -89,7 +90,7 @@ const baseCommands = [
89
90
  summary: "print this binary's version and each installed extension's",
90
91
  flags: versionFlags,
91
92
  outputs: ["json"],
92
- examples: ["cotal version", "cotal version --json"],
93
+ examples: [{ command: "cotal version", note: "print the version of cotal and each extension" }, { command: "cotal version --json", note: "the same as one JSON document" }],
93
94
  run: version,
94
95
  },
95
96
  {
@@ -101,16 +102,16 @@ const baseCommands = [
101
102
  usage: "cotal ext [list] [--json|--plain] | ext add <npm-package> | ext remove <name> | ext root | ext seed [--repair|--reset|--force]",
102
103
  positionals: "[add <npm-package> | remove <name> | list | root | seed]",
103
104
  subcommands: [
104
- { name: "add", flagNames: [], summary: "install an extension package and register what it provides", usage: "cotal ext add <npm-package>" },
105
- { name: "remove", aliases: ["rm"], flagNames: [], summary: "uninstall an extension", usage: "cotal ext remove <name>" },
106
- { name: "list", flagNames: ["json", "plain"], summary: "list installed extensions (what bare `cotal ext` does)", usage: "cotal ext list [--json|--plain]", outputs: ["json", "plain"], reads: true },
107
- { name: "root", flagNames: [], summary: "print the extension root directory", usage: "cotal ext root", reads: true },
108
- { name: "seed", flagNames: ["repair", "reset", "force"], summary: "reconcile the built-in connectors", usage: "cotal ext seed [--repair|--reset|--force]" },
105
+ { name: "add", flagNames: [], summary: "install an extension package and register what it provides", examples: [{ command: "cotal ext add @cotal-ai/tmux", note: "add the tmux runtime" }, { command: "cotal ext add <npm-package>", note: "install any extension package from npm" }], usage: "cotal ext add <npm-package>" },
106
+ { name: "remove", aliases: ["rm"], flagNames: [], summary: "uninstall an extension", examples: [{ command: "cotal ext remove <name>", note: "uninstall an extension and what it registered" }], usage: "cotal ext remove <name>" },
107
+ { name: "list", flagNames: ["json", "plain"], summary: "list installed extensions (what bare `cotal ext` does)", examples: [{ command: "cotal ext list", note: "list installed extensions and their versions" }, { command: "cotal ext list --json", note: "the same as one JSON document" }], usage: "cotal ext list [--json|--plain]", outputs: ["json", "plain"], reads: true },
108
+ { name: "root", flagNames: [], summary: "print the extension root directory", examples: [{ command: "cotal ext root", note: "print the folder extensions are installed in" }], usage: "cotal ext root", reads: true },
109
+ { name: "seed", flagNames: ["repair", "reset", "force"], summary: "reconcile the built-in connectors", examples: [{ command: "cotal ext seed", note: "install or update the built-in connectors" }, { command: "cotal ext seed --repair", note: "recover the seed record from its backup" }], usage: "cotal ext seed [--repair|--reset|--force]" },
109
110
  { name: "__update-add", summary: "re-add one extension for a running update", hidden: true },
110
111
  ],
111
112
  flags: extFlags,
112
113
  outputs: ["json", "plain"],
113
- examples: ["cotal ext", "cotal ext --json", "cotal ext add @cotal-ai/orca", "cotal ext root"],
114
+ examples: [{ command: "cotal ext", note: "list installed extensions" }, { command: "cotal ext add @cotal-ai/tmux", note: "add the tmux runtime" }, { command: "cotal ext remove <name>", note: "uninstall an extension" }],
114
115
  reads: true,
115
116
  run: ext,
116
117
  },
@@ -125,7 +126,7 @@ const baseCommands = [
125
126
  subcommands: configSubcommands,
126
127
  flags: configFlags,
127
128
  outputs: ["json", "plain"],
128
- examples: ["cotal config", "cotal config get harness", "cotal config set harness opencode", "cotal config set persona reviewer --space demo", "cotal config unset color"],
129
+ examples: [{ command: "cotal config", note: "show your preferences and their sources" }, { command: "cotal config set harness opencode", note: "make OpenCode your default application" }, { command: "cotal config get harness", note: "show one preference and its source" }],
129
130
  reads: true,
130
131
  run: config,
131
132
  complete: configComplete,
@@ -138,14 +139,14 @@ const baseCommands = [
138
139
  usage: "cotal telemetry [off|minimal|regular] [--json|--plain]",
139
140
  positionals: "[off | minimal | regular]",
140
141
  subcommands: [
141
- { name: "off", flagNames: ["json", "plain"], summary: "send nothing", usage: "cotal telemetry off [--json|--plain]", outputs: ["json", "plain"] },
142
- { name: "minimal", flagNames: ["json", "plain"], summary: "send the command name, outcome, version and platform only", usage: "cotal telemetry minimal [--json|--plain]", outputs: ["json", "plain"] },
143
- { name: "regular", aliases: ["on"], flagNames: ["json", "plain"], summary: "also send the subcommand, flag names, error code and masked error text, terminal kind and a daily install summary", usage: "cotal telemetry regular [--json|--plain]", outputs: ["json", "plain"] },
142
+ { name: "off", flagNames: ["json", "plain"], summary: "send nothing", examples: [{ command: "cotal telemetry off", note: "turn usage telemetry off" }], usage: "cotal telemetry off [--json|--plain]", outputs: ["json", "plain"] },
143
+ { name: "minimal", flagNames: ["json", "plain"], summary: "send the command name, outcome, version and platform only", examples: [{ command: "cotal telemetry minimal", note: "send only the command, outcome and version" }], usage: "cotal telemetry minimal [--json|--plain]", outputs: ["json", "plain"] },
144
+ { name: "regular", aliases: ["on"], flagNames: ["json", "plain"], summary: "also send the subcommand, flag names, error code and masked error text, terminal kind and a daily install summary", examples: [{ command: "cotal telemetry regular", note: "send the regular anonymous usage data" }], usage: "cotal telemetry regular [--json|--plain]", outputs: ["json", "plain"] },
144
145
  ],
145
146
  flags: telemetryFlags,
146
147
  outputs: ["json", "plain"],
147
148
  prepareMeshTarget: false,
148
- examples: ["cotal telemetry", "cotal telemetry off", "cotal telemetry minimal", "cotal telemetry --json"],
149
+ examples: [{ command: "cotal telemetry", note: "show the telemetry level in force" }, { command: "cotal telemetry off", note: "send no usage data" }, { command: "cotal telemetry minimal", note: "send only the command, outcome and version" }],
149
150
  validate: validateTelemetryArguments,
150
151
  run: telemetry,
151
152
  },
@@ -158,7 +159,7 @@ const baseCommands = [
158
159
  prepareMeshTarget: false,
159
160
  outputs: ["json", "plain"],
160
161
  validate: validateUpdateArguments,
161
- examples: ["cotal update --check", "cotal update --check --json", "cotal update", "cotal update --self"],
162
+ examples: [{ command: "cotal update --check", note: "see whether a newer cotal-ai is available" }, { command: "cotal update", note: "bring the installed extensions up to date" }, { command: "cotal update --self", note: "install the latest cotal-ai, then update" }],
162
163
  run: update,
163
164
  },
164
165
  {
@@ -171,13 +172,13 @@ const baseCommands = [
171
172
  flags: completionFlags,
172
173
  outputs: ["json", "plain"],
173
174
  subcommands: [
174
- { name: "script", flagNames: [], summary: "print a shell's completion stub as raw shell code", usage: "cotal completion script <bash|zsh|fish|powershell>" },
175
- { name: "install", flagNames: ["json", "plain", "force"], summary: "install or refresh unchanged owned files (detects $SHELL)", usage: "cotal completion install [shell] [--force]", outputs: ["json", "plain"] },
176
- { name: "uninstall", flagNames: ["json", "plain", "force"], summary: "remove only unchanged owned files and startup blocks", usage: "cotal completion uninstall [shell] [--force]", outputs: ["json", "plain"] },
175
+ { name: "script", flagNames: [], summary: "print a shell's completion stub as raw shell code", examples: [{ command: "cotal completion script bash", note: "print the bash completion code" }, { command: "cotal completion script zsh", note: "print the zsh completion code" }], usage: "cotal completion script <bash|zsh|fish|powershell>" },
176
+ { name: "install", flagNames: ["json", "plain", "force"], summary: "install or refresh unchanged owned files (detects $SHELL)", examples: [{ command: "cotal completion install", note: "install completion for the shell in $SHELL" }, { command: "cotal completion install zsh", note: "install zsh completion" }], usage: "cotal completion install [shell] [--force]", outputs: ["json", "plain"] },
177
+ { name: "uninstall", flagNames: ["json", "plain", "force"], summary: "remove only unchanged owned files and startup blocks", examples: [{ command: "cotal completion uninstall", note: "remove the completion files cotal installed" }, { command: "cotal completion uninstall bash", note: "remove bash completion only" }], usage: "cotal completion uninstall [shell] [--force]", outputs: ["json", "plain"] },
177
178
  ...["bash", "zsh", "fish", "powershell"].map((name) => ({ name, summary: `replaced by completion script ${name}`, hidden: true })),
178
179
  ],
179
180
  validate: validateCompletionArguments,
180
- examples: ["cotal completion", "source <(cotal completion script bash)", "cotal completion install", "cotal completion uninstall bash --json"],
181
+ examples: [{ command: "cotal completion install", note: "set up tab completion for your shell" }, { command: "cotal completion", note: "show whether completion is installed" }, { command: "cotal completion script bash", note: "print the bash completion code" }],
181
182
  run: completion,
182
183
  complete: completionComplete,
183
184
  },
@@ -199,7 +200,7 @@ const baseCommands = [
199
200
  summary: "start a local space in the background; --foreground keeps the native stack in this terminal",
200
201
  flags: upFlags,
201
202
  outputs: ["json", "plain"],
202
- examples: ["cotal up", "cotal up --root <prepared-project> --space <space>", "cotal up --foreground", "cotal up -f cotal.yaml --dry-run"],
203
+ examples: [{ command: "cotal up", note: "start this folder's space in the background" }, { command: "cotal up --root <dir>", note: "start a space prepared in another folder" }, { command: "cotal up --foreground", note: "keep the space in this terminal until Ctrl-C" }],
203
204
  validate: validateUpArguments,
204
205
  prepareMeshTarget: false,
205
206
  keepsStartupNotice: true,
@@ -214,7 +215,7 @@ const baseCommands = [
214
215
  usage: "cotal runtimes [--json|--plain]",
215
216
  flags: runtimesFlags,
216
217
  outputs: ["json", "plain"],
217
- examples: ["cotal runtimes", "cotal runtimes --json"],
218
+ examples: [{ command: "cotal runtimes", note: "list runtimes and whether each is reachable" }, { command: "cotal runtimes --json", note: "the same as one JSON document" }],
218
219
  reads: true,
219
220
  run: runtimes,
220
221
  },
@@ -224,6 +225,7 @@ const baseCommands = [
224
225
  aliases: ["svc", "services"],
225
226
  group: "Services",
226
227
  summary: "run Cotal's built-in services and your own programs: list, add, start, stop, status, logs",
228
+ examples: [{ command: "cotal service", note: "list services and their state" }, { command: "cotal service start <name>", note: "start one in the background" }, { command: "cotal service add <name> --exec \"<command>\"", note: "save a program as a service" }],
227
229
  positionals: "[show | add | remove | start | stop | restart | status | logs | install | uninstall] [name]",
228
230
  flagNames: ["space", "json", "plain"],
229
231
  flags: serviceFlags,
@@ -231,16 +233,16 @@ const baseCommands = [
231
233
  reads: true,
232
234
  subcommands: [
233
235
  { name: "list", flagNames: ["space", "json", "plain"], summary: "list the built-in services and the ones you saved, with their state", hidden: true, reads: true, prepareMeshTarget: false },
234
- { name: "show", flagNames: ["space", "json", "plain"], summary: "read a saved definition without exposing argument or credential contents", usage: "cotal service show <name>", reads: true, prepareMeshTarget: false },
235
- { name: "add", flagNames: ["space", "exec", "cwd", "file", "preset", "json", "plain"], summary: "save your own program (--exec), a preset or a definition file; starts nothing", usage: "cotal service add <name> --exec \"<command>\" [--cwd <dir>] | --preset <preset> [<options>] | --file <definition.json>", prepareMeshTarget: false },
236
- { name: "remove", flagNames: ["space", "instance", "yes", "json", "plain"], aliases: ["rm"], summary: "forget a stopped, unsupervised owned definition", usage: "cotal service remove <name> [--instance <full-id>] [--yes]", prepareMeshTarget: false },
237
- { name: "start", flagNames: ["space", "instance", "new-instance", "foreground", "dry-run", "json", "plain"], summary: "start a service; a built-in one is saved from its defaults first, and nothing else is started for it", usage: "cotal service start <name> [<preset options>] [--instance <id>|--new-instance] [--foreground|--dry-run]", prepareMeshTarget: false },
238
- { name: "stop", flagNames: ["space", "instance", "yes", "with-agents", "dry-run", "json", "plain"], summary: "stop the exact owned process through its declared native policy", usage: "cotal service stop <name> [--instance <id>] [--with-agents] [--yes|--dry-run]", prepareMeshTarget: false },
239
- { name: "restart", flagNames: ["space", "instance", "yes", "with-agents", "dry-run", "json", "plain"], summary: "confirm an exact owned stop before one replacement launch", usage: "cotal service restart <name> [--instance <id>] [--with-agents] [--yes|--dry-run]", prepareMeshTarget: false },
240
- { name: "status", flagNames: ["space", "instance", "json", "plain"], summary: "read instance identity and process observations without repair", usage: "cotal service status <name> [--instance <id>]", reads: true, prepareMeshTarget: false },
241
- { name: "logs", flagNames: ["space", "instance", "tail", "follow", "json", "plain"], summary: "read the selected instance's private file or original-invocation journal", usage: "cotal service logs <name> [--instance <id>] [--tail <n>] [--follow]", reads: true, prepareMeshTarget: false },
242
- { name: "install", flagNames: ["space", "instance", "dry-run", "json", "plain"], summary: "install an inactive owned Linux user unit and enable autostart", usage: "cotal service install <name> [--instance <id>] [--dry-run]", prepareMeshTarget: false },
243
- { name: "uninstall", flagNames: ["space", "instance", "yes", "dry-run", "json", "plain"], summary: "remove a stopped unchanged owned Linux user unit and private store", usage: "cotal service uninstall <name> [--instance <id>] [--yes|--dry-run]", prepareMeshTarget: false },
236
+ { name: "show", flagNames: ["space", "json", "plain"], summary: "read a saved definition without exposing argument or credential contents", examples: [{ command: "cotal service show <name>", note: "read a saved service definition" }], usage: "cotal service show <name>", reads: true, prepareMeshTarget: false },
237
+ { name: "add", flagNames: ["space", "exec", "cwd", "file", "preset", "json", "plain"], summary: "save your own program (--exec), a preset or a definition file; starts nothing", examples: [{ command: "cotal service add <name> --exec \"<command>\"", note: "save a program as a service" }, { command: "cotal service add <name> --file <definition.json>", note: "save one from a definition file" }], usage: "cotal service add <name> --exec \"<command>\" [--cwd <dir>] | --preset <preset> [<options>] | --file <definition.json>", prepareMeshTarget: false },
238
+ { name: "remove", flagNames: ["space", "instance", "yes", "json", "plain"], aliases: ["rm"], summary: "forget a stopped, unsupervised owned definition", examples: [{ command: "cotal service remove <name>", note: "forget a stopped service" }], usage: "cotal service remove <name> [--instance <full-id>] [--yes]", prepareMeshTarget: false },
239
+ { name: "start", flagNames: ["space", "instance", "new-instance", "foreground", "dry-run", "json", "plain"], summary: "start a service; a built-in one is saved from its defaults first, and nothing else is started for it", examples: [{ command: "cotal service start <name>", note: "start a service in the background" }, { command: "cotal service start <name> --foreground", note: "run it in this terminal" }], usage: "cotal service start <name> [<preset options>] [--instance <id>|--new-instance] [--foreground|--dry-run]", prepareMeshTarget: false },
240
+ { name: "stop", flagNames: ["space", "instance", "yes", "with-agents", "dry-run", "json", "plain"], summary: "stop the exact owned process through its declared native policy", examples: [{ command: "cotal service stop <name>", note: "stop a service" }, { command: "cotal service stop <name> --dry-run", note: "show what stopping it affects" }], usage: "cotal service stop <name> [--instance <id>] [--with-agents] [--yes|--dry-run]", prepareMeshTarget: false },
241
+ { name: "restart", flagNames: ["space", "instance", "yes", "with-agents", "dry-run", "json", "plain"], summary: "confirm an exact owned stop before one replacement launch", examples: [{ command: "cotal service restart <name>", note: "stop a service, then start it again" }], usage: "cotal service restart <name> [--instance <id>] [--with-agents] [--yes|--dry-run]", prepareMeshTarget: false },
242
+ { name: "status", flagNames: ["space", "instance", "json", "plain"], summary: "read instance identity and process observations without repair", examples: [{ command: "cotal service status <name>", note: "check whether a service runs" }], usage: "cotal service status <name> [--instance <id>]", reads: true, prepareMeshTarget: false },
243
+ { name: "logs", flagNames: ["space", "instance", "tail", "follow", "json", "plain"], summary: "read the selected instance's private file or original-invocation journal", examples: [{ command: "cotal service logs <name>", note: "read a service's log" }, { command: "cotal service logs <name> --follow", note: "keep following it" }], usage: "cotal service logs <name> [--instance <id>] [--tail <n>] [--follow]", reads: true, prepareMeshTarget: false },
244
+ { name: "install", flagNames: ["space", "instance", "dry-run", "json", "plain"], summary: "install an inactive owned Linux user unit and enable autostart", examples: [{ command: "cotal service install <name>", note: "start it at login with a systemd unit" }, { command: "cotal service install <name> --dry-run", note: "show the unit it would install" }], usage: "cotal service install <name> [--instance <id>] [--dry-run]", prepareMeshTarget: false },
245
+ { name: "uninstall", flagNames: ["space", "instance", "yes", "dry-run", "json", "plain"], summary: "remove a stopped unchanged owned Linux user unit and private store", examples: [{ command: "cotal service uninstall <name>", note: "remove a service's login unit" }], usage: "cotal service uninstall <name> [--instance <id>] [--yes|--dry-run]", prepareMeshTarget: false },
244
246
  ].map((sub) => ({ ...sub, outputs: sub.name === "logs" ? ["json", "ndjson", "plain"] : ["json", "plain"] })),
245
247
  validate: validateServiceArguments,
246
248
  run: service,
@@ -251,6 +253,7 @@ const baseCommands = [
251
253
  name: "down",
252
254
  group: "Mesh",
253
255
  summary: "stop named owned services or this root's recorded controller stack",
256
+ examples: [{ command: "cotal down", note: "stop this folder's space" }, { command: "cotal down --dry-run", note: "show what would stop, and stop nothing" }, { command: "cotal down --with-agents", note: "also stop every managed agent" }],
254
257
  positionals: "[<service-name> …]",
255
258
  usage: "cotal down [<service-name>] [--instance <full-id>] [--yes|--dry-run] [--space <space>] [--json|--plain]",
256
259
  outputs: ["json", "plain"], prepareMeshTarget: false,
@@ -277,18 +280,19 @@ const baseCommands = [
277
280
  name: "backup",
278
281
  group: "Mesh",
279
282
  summary: "create from a preserved cut, inspect or verify it offline, or restore it into the preserved root",
283
+ examples: [{ command: "cotal backup create <dir>", note: "back up a stopped, preserved space" }, { command: "cotal backup verify <dir>", note: "check a backup's files against its manifest" }, { command: "cotal backup restore <dir>", note: "restore a backup into this root" }],
280
284
  usage: "cotal backup create|inspect|verify|restore <directory> | recover|cleanup-fallback <full-attempt-id> [--yes|--dry-run] [--json|--plain]",
281
285
  positionals: "<create|inspect|verify|restore|recover|cleanup-fallback> <directory-or-full-attempt-id>",
282
286
  flagNames: ["json", "plain"],
283
287
  outputs: ["json", "plain"],
284
288
  prepareMeshTarget: false,
285
289
  subcommands: [
286
- { name: "recover", flagNames: ["yes", "dry-run", "json", "plain"], summary: "roll back a stale pre-commit restore, or release an interrupted backup create, under native guards", usage: "cotal backup recover <full-attempt-id> [--yes|--dry-run] [--json|--plain]", outputs: ["json", "plain"], prepareMeshTarget: false },
287
- { name: "cleanup-fallback", flagNames: ["yes", "dry-run", "discard-history", "json", "plain"], summary: "clean only the unchanged old source of a healthy active restore", usage: "cotal backup cleanup-fallback <restore-attempt-id> [--yes|--dry-run] [--discard-history] [--json|--plain]", outputs: ["json", "plain"], prepareMeshTarget: false },
288
- { name: "create", flagNames: ["only", "store-dir", "json", "plain"], summary: "create a private artifact from the native stopped preservation cut", usage: "cotal backup create <directory> [--only full|registry] [--store-dir <dir>] [--json|--plain]", outputs: ["json", "plain"], prepareMeshTarget: false },
289
- { name: "inspect", flagNames: ["json", "plain"], summary: "read manifest and exact file inventory; integrity is not checked", usage: "cotal backup inspect <directory> [--json|--plain]", reads: true, outputs: ["json", "plain"], prepareMeshTarget: false },
290
- { name: "verify", flagNames: ["json", "plain"], summary: "read and hash files against the manifest; restore is not tested", usage: "cotal backup verify <directory> [--json|--plain]", reads: true, outputs: ["json", "plain"], prepareMeshTarget: false },
291
- { name: "restore", flagNames: ["only", "store-dir", "accept-missing-source", "json", "plain"], summary: "restore an artifact into this root's stopped preserved cut under the native guards, then resume it", usage: "cotal backup restore <directory> [--only registry] [--store-dir <dir>] [--accept-missing-source] [--json|--plain]", outputs: ["json", "plain"], prepareMeshTarget: false },
290
+ { name: "recover", flagNames: ["yes", "dry-run", "json", "plain"], summary: "roll back a stale pre-commit restore, or release an interrupted backup create, under native guards", examples: [{ command: "cotal backup recover <full-attempt-id> --dry-run", note: "preview recovering an interrupted attempt" }, { command: "cotal backup recover <full-attempt-id> --yes", note: "recover it" }], usage: "cotal backup recover <full-attempt-id> [--yes|--dry-run] [--json|--plain]", outputs: ["json", "plain"], prepareMeshTarget: false },
291
+ { name: "cleanup-fallback", flagNames: ["yes", "dry-run", "discard-history", "json", "plain"], summary: "clean only the unchanged old source of a healthy active restore", examples: [{ command: "cotal backup cleanup-fallback <restore-attempt-id> --dry-run", note: "preview removing the store a restore kept" }, { command: "cotal backup cleanup-fallback <restore-attempt-id> --yes", note: "remove it" }], usage: "cotal backup cleanup-fallback <restore-attempt-id> [--yes|--dry-run] [--discard-history] [--json|--plain]", outputs: ["json", "plain"], prepareMeshTarget: false },
292
+ { name: "create", flagNames: ["only", "store-dir", "json", "plain"], summary: "create a private artifact from the native stopped preservation cut", examples: [{ command: "cotal backup create <dir>", note: "back up a stopped, preserved space" }, { command: "cotal backup create <dir> --only registry", note: "back up only its registry" }], usage: "cotal backup create <directory> [--only full|registry] [--store-dir <dir>] [--json|--plain]", outputs: ["json", "plain"], prepareMeshTarget: false },
293
+ { name: "inspect", flagNames: ["json", "plain"], summary: "read manifest and exact file inventory; integrity is not checked", examples: [{ command: "cotal backup inspect <dir>", note: "list a backup's manifest and files" }], usage: "cotal backup inspect <directory> [--json|--plain]", reads: true, outputs: ["json", "plain"], prepareMeshTarget: false },
294
+ { name: "verify", flagNames: ["json", "plain"], summary: "read and hash files against the manifest; restore is not tested", examples: [{ command: "cotal backup verify <dir>", note: "hash a backup's files against its manifest" }], usage: "cotal backup verify <directory> [--json|--plain]", reads: true, outputs: ["json", "plain"], prepareMeshTarget: false },
295
+ { name: "restore", flagNames: ["only", "store-dir", "accept-missing-source", "json", "plain"], summary: "restore an artifact into this root's stopped preserved cut under the native guards, then resume it", examples: [{ command: "cotal backup restore <dir>", note: "restore a backup into this root" }, { command: "cotal backup restore <dir> --only registry", note: "restore only its registry" }], usage: "cotal backup restore <directory> [--only registry] [--store-dir <dir>] [--accept-missing-source] [--json|--plain]", outputs: ["json", "plain"], prepareMeshTarget: false },
292
296
  ],
293
297
  validate: validateBackupArguments,
294
298
  flags: backupFlags,
@@ -325,11 +329,11 @@ const baseCommands = [
325
329
  flags: resetFlags,
326
330
  outputs: ["json", "plain"], prepareMeshTarget: false,
327
331
  subcommands: [
328
- { name: "store", flagNames: ["dry-run", "yes", "json", "plain"], outputs: ["json", "plain"], summary: "preview or remove an exact stopped store; preserve identity and registration", usage: "cotal reset store <space> [--dry-run] [-y|--yes] [--json|--plain]", prepareMeshTarget: false },
329
- { name: "space", flagNames: ["dry-run", "yes", "json", "plain"], outputs: ["json", "plain"], summary: "reset the stopped local store, identity and eligible local registration", usage: "cotal reset space <space> [--dry-run] [-y|--yes] [--json|--plain]", prepareMeshTarget: false },
332
+ { name: "store", flagNames: ["dry-run", "yes", "json", "plain"], outputs: ["json", "plain"], summary: "preview or remove an exact stopped store; preserve identity and registration", examples: [{ command: "cotal reset store <space> --dry-run", note: "show what a store reset would remove" }, { command: "cotal reset store <space>", note: "remove the store after you confirm" }], usage: "cotal reset store <space> [--dry-run] [-y|--yes] [--json|--plain]", prepareMeshTarget: false },
333
+ { name: "space", flagNames: ["dry-run", "yes", "json", "plain"], outputs: ["json", "plain"], summary: "reset the stopped local store, identity and eligible local registration", examples: [{ command: "cotal reset space <space> --dry-run", note: "show what a full space reset would remove" }, { command: "cotal reset space <space>", note: "reset the stopped space after you confirm" }], usage: "cotal reset space <space> [--dry-run] [-y|--yes] [--json|--plain]", prepareMeshTarget: false },
330
334
  ],
331
335
  validate: validateResetArguments,
332
- examples: ["cotal reset store demo --dry-run", "cotal reset space demo --dry-run --json"],
336
+ examples: [{ command: "cotal reset store <space> --dry-run", note: "show what a store reset would remove" }, { command: "cotal reset space <space> --dry-run", note: "show what a full space reset would remove" }],
333
337
  run: reset, complete: resetComplete,
334
338
  },
335
339
  {
@@ -352,21 +356,21 @@ const baseCommands = [
352
356
  usage: "cotal space [--json|--plain] | space show [<name>] | space add [<name>] | space create <name> | space forget <name> | space delete <name> [--dry-run|-y]",
353
357
  positionals: "[show [<name>] | add [<name>] | create <name> | forget <name> | delete <name> [--dry-run|-y]]",
354
358
  subcommands: [
355
- { name: "show", flagNames: ["json", "plain"], summary: "one space in full: broker, mode, root, origin and login; the selected one when no name is given", usage: "cotal space show [<name>] [--json|--plain]", outputs: ["json", "plain"], reads: true },
359
+ { name: "show", flagNames: ["json", "plain"], summary: "one space in full: broker, mode, root, origin and login; the selected one when no name is given", examples: [{ command: "cotal space show", note: "show the selected space in full" }, { command: "cotal space show <name> --json", note: "one space as a JSON document" }], usage: "cotal space show [<name>] [--json|--plain]", outputs: ["json", "plain"], reads: true },
356
360
  {
357
361
  name: "add",
358
362
  flagNames: ["server", "root", "mode", "file", "from", "tls", "allow-unencrypted-overlay", "force", "yes", "json", "plain"],
359
- summary: "register a space that runs elsewhere, after checking its broker and trust; the selection is unchanged",
363
+ summary: "register a space that runs elsewhere, after checking its broker and trust; the selection is unchanged", examples: [{ command: "cotal space add <name> --server <url>", note: "register a space that runs elsewhere" }, { command: "cotal space add --file <bundle.json>", note: "register one from a connection file" }],
360
364
  usage: "cotal space add <name> --server <url> [--root <dir>] [--mode auth|open] [--tls] [--allow-unencrypted-overlay] [--force] [-y|--yes] [--json|--plain] | space add [<name>] (-f|--file <bundle.json> | --from <https url>) [--root <dir>] [--server <url>] [--force] [-y|--yes]",
361
365
  outputs: ["json", "plain"],
362
366
  },
363
- { name: "create", flagNames: ["root", "json", "plain"], summary: "prepare a space to start here: records its name and root, and `cotal up` in the root starts it", usage: "cotal space create <name> [--root <dir>] [--json|--plain]", outputs: ["json", "plain"] },
364
- { name: "forget", flagNames: ["json", "plain"], summary: "remove a registration or a prepared space; stops nothing and keeps the root's files", usage: "cotal space forget <name> [--json|--plain]", outputs: ["json", "plain"] },
365
- { name: "delete", flagNames: ["dry-run", "yes", "json", "plain"], summary: "preview native impact or delete the exact space after confirmation; local records stay", usage: "cotal space delete <name> [--dry-run] [-y|--yes] [--json|--plain]", outputs: ["json", "plain"], prepareMeshTarget: false },
367
+ { name: "create", flagNames: ["root", "json", "plain"], summary: "prepare a space to start here: records its name and root, and `cotal up` in the root starts it", examples: [{ command: "cotal space create <name>", note: "prepare a space in this folder" }, { command: "cotal space create <name> --root <dir>", note: "prepare one in another folder" }], usage: "cotal space create <name> [--root <dir>] [--json|--plain]", outputs: ["json", "plain"] },
368
+ { name: "forget", flagNames: ["json", "plain"], summary: "remove a registration or a prepared space; stops nothing and keeps the root's files", examples: [{ command: "cotal space forget <name>", note: "drop a space from this machine's list" }], usage: "cotal space forget <name> [--json|--plain]", outputs: ["json", "plain"] },
369
+ { name: "delete", flagNames: ["dry-run", "yes", "json", "plain"], summary: "preview native impact or delete the exact space after confirmation; local records stay", examples: [{ command: "cotal space delete <name> --dry-run", note: "show what deleting a space would remove" }, { command: "cotal space delete <name>", note: "delete it after you type its name" }], usage: "cotal space delete <name> [--dry-run] [-y|--yes] [--json|--plain]", outputs: ["json", "plain"], prepareMeshTarget: false },
366
370
  ],
367
371
  flags: spaceFlags,
368
372
  outputs: ["json", "plain"],
369
- examples: ["cotal space", "cotal space show research --json", "cotal space add research --server nats://100.90.12.34:4222 --root ~/research", "cotal space add --file hosted.json", "cotal space create demo --root ~/demo", "cotal space forget research", "cotal space delete research --dry-run"],
373
+ examples: [{ command: "cotal space", note: "list the spaces on this machine" }, { command: "cotal space show <name>", note: "show one space in full" }, { command: "cotal space add <name> --server <url>", note: "register a space that runs elsewhere" }],
370
374
  reads: true,
371
375
  run: space,
372
376
  complete: spaceComplete,
@@ -376,6 +380,7 @@ const baseCommands = [
376
380
  name: "sync",
377
381
  group: "Mesh",
378
382
  summary: "refresh signed-in space catalogs and report registry changes",
383
+ examples: [{ command: "cotal sync", note: "refresh the spaces your sign-in gives you" }, { command: "cotal sync --json", note: "the same, as one JSON document" }],
379
384
  usage: "cotal sync [--idp <auth base URL>] [--json|--plain]",
380
385
  flags: syncFlags,
381
386
  outputs: ["json", "plain"],
@@ -392,7 +397,7 @@ const baseCommands = [
392
397
  flags: statusFlags,
393
398
  validate: validateStatusArguments,
394
399
  outputs: ["json", "plain"],
395
- examples: ["cotal status", "cotal status --all", "cotal status --json", "cotal status --components"],
400
+ examples: [{ command: "cotal status", note: "see this machine and the selected space" }, { command: "cotal status <agent>", note: "check one agent" }, { command: "cotal status --all", note: "check every recorded space" }],
396
401
  reads: true,
397
402
  run: status,
398
403
  },
@@ -401,13 +406,14 @@ const baseCommands = [
401
406
  name: "doctor",
402
407
  group: "Mesh",
403
408
  summary: "credential-health diagnosis + repair - `doctor auth [--fix]` lists every local cred's state (healthy, near-expiry, expired or unbounded) and the native guidance for each finding",
409
+ examples: [{ command: "cotal doctor auth", note: "check the health of every local credential" }, { command: "cotal doctor auth --fix", note: "also ask the daemon to repair what it can" }],
404
410
  positionals: "auth",
405
411
  flagNames: ["space", "json", "plain"],
406
412
  flags: doctorFlags,
407
413
  outputs: ["json", "plain"],
408
414
  reads: true,
409
415
  prepareMeshTarget: false,
410
- subcommands: [{ name: "auth", flagNames: ["space", "fix", "json", "plain"], summary: "inspect local credential claims; --fix requests guarded native daemon repair", usage: "cotal doctor auth [--fix] [--space <s>] [--json|--plain]", reads: true, outputs: ["json", "plain"], prepareMeshTarget: false }],
416
+ subcommands: [{ name: "auth", flagNames: ["space", "fix", "json", "plain"], summary: "inspect local credential claims; --fix requests guarded native daemon repair", examples: [{ command: "cotal doctor auth", note: "check the health of every local credential" }, { command: "cotal doctor auth --fix", note: "also ask the daemon to repair what it can" }], usage: "cotal doctor auth [--fix] [--space <s>] [--json|--plain]", reads: true, outputs: ["json", "plain"], prepareMeshTarget: false }],
411
417
  validate: validateDoctorArguments,
412
418
  run: doctor,
413
419
  },
@@ -420,7 +426,7 @@ const baseCommands = [
420
426
  positionals: "[<space>]",
421
427
  flags: useFlags,
422
428
  outputs: ["json", "plain"],
423
- examples: ["cotal use", "cotal use research", "cotal use --clear"],
429
+ examples: [{ command: "cotal use <space>", note: "select the space commands use" }, { command: "cotal use", note: "show the selected space" }, { command: "cotal use --clear", note: "clear the selection" }],
424
430
  run: use,
425
431
  complete: useComplete,
426
432
  },
@@ -463,14 +469,14 @@ const baseCommands = [
463
469
  usage: "cotal team [show <deployment-id> | check <file> [--graph] | boot <file> [--dry-run] | deploy <file> [--dry-run] | remove <deployment-id> [--dry-run]] [--space <s>] [--json|--plain]",
464
470
  flags: teamFlags, reads: true, prepareMeshTarget: false, outputs: ["json", "plain"],
465
471
  subcommands: [
466
- { name: "show", flagNames: ["space", "json", "plain"], outputs: ["json", "plain"], summary: "read one fresh boot summary or additive ownership ledger, not live state", usage: "cotal team show <deployment-id>", reads: true, prepareMeshTarget: false },
467
- { name: "check", flagNames: ["space", "graph", "json", "plain"], outputs: ["json", "plain"], summary: "resolve a manifest and referenced personas offline", usage: "cotal team check <file> [--graph]", reads: true, prepareMeshTarget: false },
468
- { name: "boot", flagNames: ["space", "foreground", "dry-run", "json", "plain"], outputs: ["json", "plain"], summary: "boot a fresh controller-owned stack; --foreground holds its terminal lifetime", usage: "cotal team boot <file> [--dry-run | --foreground]", prepareMeshTarget: false },
469
- { name: "deploy", flagNames: ["space", "runtime", "allow-stale", "dry-run", "json", "plain"], outputs: ["json", "plain"], summary: "add all-new live channels and static/open teams through one native manager", usage: "cotal team deploy <file> [--dry-run]", prepareMeshTarget: false },
470
- { name: "remove", flagNames: ["space", "dry-run", "yes", "json", "plain"], outputs: ["json", "plain"], summary: "retire a recorded static agent-only team; --dry-run reads native impact", usage: "cotal team remove <deployment-id> [--dry-run] [--yes]", prepareMeshTarget: false },
472
+ { name: "show", flagNames: ["space", "json", "plain"], outputs: ["json", "plain"], summary: "read one fresh boot summary or additive ownership ledger, not live state", examples: [{ command: "cotal team show <deployment-id>", note: "read one recorded deployment" }], usage: "cotal team show <deployment-id>", reads: true, prepareMeshTarget: false },
473
+ { name: "check", flagNames: ["space", "graph", "json", "plain"], outputs: ["json", "plain"], summary: "resolve a manifest and referenced personas offline", examples: [{ command: "cotal team check <file>", note: "check a manifest and its personas offline" }, { command: "cotal team check <file> --graph", note: "also show who can read and post where" }], usage: "cotal team check <file> [--graph]", reads: true, prepareMeshTarget: false },
474
+ { name: "boot", flagNames: ["space", "foreground", "dry-run", "json", "plain"], outputs: ["json", "plain"], summary: "boot a fresh controller-owned stack; --foreground holds its terminal lifetime", examples: [{ command: "cotal team boot <file> --dry-run", note: "preview booting a new space from a manifest" }, { command: "cotal team boot <file>", note: "boot it in the background" }], usage: "cotal team boot <file> [--dry-run | --foreground]", prepareMeshTarget: false },
475
+ { name: "deploy", flagNames: ["space", "runtime", "allow-stale", "dry-run", "json", "plain"], outputs: ["json", "plain"], summary: "add all-new live channels and static/open teams through one native manager", examples: [{ command: "cotal team deploy <file> --dry-run", note: "preview what a deploy would add" }, { command: "cotal team deploy <file>", note: "add its new channels and agents" }], usage: "cotal team deploy <file> [--dry-run]", prepareMeshTarget: false },
476
+ { name: "remove", flagNames: ["space", "dry-run", "yes", "json", "plain"], outputs: ["json", "plain"], summary: "retire a recorded static agent-only team; --dry-run reads native impact", examples: [{ command: "cotal team remove <deployment-id> --dry-run", note: "preview retiring a deployed team" }, { command: "cotal team remove <deployment-id>", note: "retire it after you confirm" }], usage: "cotal team remove <deployment-id> [--dry-run] [--yes]", prepareMeshTarget: false },
471
477
  { name: "list", flagNames: ["space", "json", "plain"], outputs: ["json", "plain"], hidden: true, summary: "read available local fresh and additive deployment records", reads: true, prepareMeshTarget: false },
472
478
  ],
473
- examples: ["cotal t", "cotal t check cotal.yaml --graph", "cotal t boot cotal.yaml --dry-run", "cotal t boot cotal.yaml", "cotal t deploy cotal.yaml --dry-run", "cotal t deploy channels.yaml", "cotal t show <deployment-id>", "cotal t remove <deployment-id> [--dry-run]"],
479
+ examples: [{ command: "cotal team", note: "list the recorded team deployments" }, { command: "cotal team check <file>", note: "check a team manifest offline" }, { command: "cotal team deploy <file>", note: "add a manifest's channels and agents" }],
474
480
  validate: validateTeamArguments, run: team, complete: teamComplete,
475
481
  },
476
482
  {
@@ -494,7 +500,7 @@ const baseCommands = [
494
500
  flags: sendFlags,
495
501
  outputs: ["json", "plain"],
496
502
  validate: (args) => { sendArguments(args); },
497
- examples: ['cotal send -t reviewer "Please inspect the patch"', 'cotal send -c review "The patch is ready"', 'cotal send -r reviewer "Please inspect the patch"'],
503
+ examples: [{ command: "cotal send -t <agent> \"Please review the patch\"", note: "message one agent" }, { command: "cotal send -c <channel> \"The build is green\"", note: "post to a channel" }, { command: "cotal send -r <role> \"Who can take this?\"", note: "ask whichever agent holds a role" }],
498
504
  run: send,
499
505
  complete: sendComplete,
500
506
  },
@@ -508,7 +514,7 @@ const baseCommands = [
508
514
  flags: chatFlags,
509
515
  outputs: ["plain"],
510
516
  validate: (args) => { chatArguments(args); },
511
- examples: ["cotal chat", "cotal chat review", "cotal chat review --name alice --plain", "cotal chat review --stdio"],
517
+ examples: [{ command: "cotal chat", note: "open the live conversation view" }, { command: "cotal chat <channel>", note: "join one channel's conversation" }, { command: "cotal chat <channel> --plain", note: "read and write it as plain lines" }],
512
518
  run: chat,
513
519
  complete: chatComplete,
514
520
  },
@@ -524,14 +530,14 @@ const baseCommands = [
524
530
  outputs: ["json", "ndjson", "plain"],
525
531
  reads: true,
526
532
  subcommands: [
527
- { name: "show", flagNames: ["space", "server", "creds", "json", "plain"], summary: "read one channel's metadata and effective policy", usage: "cotal channel show <name> [--json|--plain]", reads: true, outputs: ["json", "plain"] },
528
- { name: "members", flagNames: ["space", "server", "creds", "follow", "json", "plain"], summary: "read broker-derived membership, or follow with --follow", usage: "cotal channel members <name> [--follow] [--json|--plain]", reads: true, outputs: ["json", "ndjson", "plain"] },
529
- { name: "set", flagNames: ["space", "server", "creds", "desc", "instructions", "replay", "no-replay", "window", "delivery", "json", "plain"], summary: "save metadata, replay or delivery policy without changing access", usage: "cotal channel set <name> [--desc <text>] [--instructions <text>] [--replay|--no-replay] [--window <duration>] [--delivery <live|durable>] [--json|--plain]", outputs: ["json", "plain"] },
530
- { name: "defaults", flagNames: ["space", "server", "creds", "replay", "no-replay", "window", "delivery", "json", "plain"], summary: "read or update space-wide replay and delivery defaults", usage: "cotal channel defaults [--replay|--no-replay] [--window <duration>] [--delivery <live|durable>] [--json|--plain]", outputs: ["json", "plain"] },
531
- { name: "remove", aliases: ["rm"], flagNames: ["space", "server", "creds", "purge", "yes", "json", "plain"], summary: "remove saved metadata; --purge also deletes this channel's retained history", usage: "cotal channel remove <name> [--purge] [-y|--yes] [--json|--plain]", outputs: ["json", "plain"] },
533
+ { name: "show", flagNames: ["space", "server", "creds", "json", "plain"], summary: "read one channel's metadata and effective policy", examples: [{ command: "cotal channel show <name>", note: "read a channel's description and policy" }], usage: "cotal channel show <name> [--json|--plain]", reads: true, outputs: ["json", "plain"] },
534
+ { name: "members", flagNames: ["space", "server", "creds", "follow", "json", "plain"], summary: "read broker-derived membership, or follow with --follow", examples: [{ command: "cotal channel members <name>", note: "list who is in a channel" }, { command: "cotal channel members <name> --follow", note: "keep following who joins and leaves" }], usage: "cotal channel members <name> [--follow] [--json|--plain]", reads: true, outputs: ["json", "ndjson", "plain"] },
535
+ { name: "set", flagNames: ["space", "server", "creds", "desc", "instructions", "replay", "no-replay", "window", "delivery", "json", "plain"], summary: "save metadata, replay or delivery policy without changing access", examples: [{ command: "cotal channel set <name> --desc \"Code review\"", note: "describe what a channel is for" }, { command: "cotal channel set <name> --replay --window 24h", note: "show new joiners the last day" }], usage: "cotal channel set <name> [--desc <text>] [--instructions <text>] [--replay|--no-replay] [--window <duration>] [--delivery <live|durable>] [--json|--plain]", outputs: ["json", "plain"] },
536
+ { name: "defaults", flagNames: ["space", "server", "creds", "replay", "no-replay", "window", "delivery", "json", "plain"], summary: "read or update space-wide replay and delivery defaults", examples: [{ command: "cotal channel defaults", note: "show the space-wide defaults" }, { command: "cotal channel defaults --replay --window 24h", note: "replay the last day everywhere" }], usage: "cotal channel defaults [--replay|--no-replay] [--window <duration>] [--delivery <live|durable>] [--json|--plain]", outputs: ["json", "plain"] },
537
+ { name: "remove", aliases: ["rm"], flagNames: ["space", "server", "creds", "purge", "yes", "json", "plain"], summary: "remove saved metadata; --purge also deletes this channel's retained history", examples: [{ command: "cotal channel remove <name>", note: "remove a channel's saved settings" }, { command: "cotal channel remove <name> --purge", note: "also delete its retained history" }], usage: "cotal channel remove <name> [--purge] [-y|--yes] [--json|--plain]", outputs: ["json", "plain"] },
532
538
  ],
533
539
  validate: (args) => { channelArguments(args); },
534
- examples: ["cotal ch", "cotal ch show review", "cotal ch members review --follow", 'cotal ch set review --desc "Review coordination"', "cotal ch defaults --replay --window 24h --delivery durable", "cotal ch rm review --purge --yes"],
540
+ examples: [{ command: "cotal channel", note: "list the channels and their saved settings" }, { command: "cotal channel show <name>", note: "read one channel's settings" }, { command: "cotal channel members <name>", note: "see who is in a channel" }],
535
541
  run: channels,
536
542
  complete: channelComplete,
537
543
  },
@@ -545,7 +551,7 @@ const baseCommands = [
545
551
  positionals: "[<channel> | clear]",
546
552
  flags: historyFlags,
547
553
  outputs: ["json", "ndjson", "plain"],
548
- examples: ["cotal history general", "cotal history --since 2h --grep deploy", "cotal history general --follow --json", "cotal history clear --yes"],
554
+ examples: [{ command: "cotal history <channel>", note: "read a channel's newest messages" }, { command: "cotal history <channel> --follow", note: "keep printing new ones as they arrive" }, { command: "cotal history --since 2h --grep <text>", note: "search the last two hours" }],
549
555
  reads: true,
550
556
  subcommands: historySubcommands,
551
557
  validate: validateHistoryArguments,
@@ -557,6 +563,7 @@ const baseCommands = [
557
563
  name: "feedback",
558
564
  group: "Messaging",
559
565
  summary: 'send feedback to the Cotal developers - feedback "<summary>" [--type <t>] [--email <e>]',
566
+ examples: [{ command: "cotal feedback \"The spawn prompt is unclear\"", note: "send a note to the Cotal developers" }, { command: "cotal feedback \"<summary>\" --type bug --email <email>", note: "report a bug with a contact address" }],
560
567
  positionals: '"<summary>"',
561
568
  flagNames: ["type", "details", "severity", "area", "email", "name", "url", "key-file", "json", "plain"],
562
569
  flags: feedbackFlags,
@@ -572,6 +579,7 @@ const baseCommands = [
572
579
  aliases: ["sp"],
573
580
  group: "Agents",
574
581
  summary: "run an agent in this terminal; -d launches it through a manager and returns once it joins, --on <instance> launches through that manager and attaches",
582
+ examples: [{ command: "cotal spawn", note: "run an agent in this terminal" }, { command: "cotal spawn -d", note: "launch through a manager and return" }, { command: "cotal spawn <persona> -p \"review PR 12\"", note: "start a persona with a task" }],
575
583
  usage: "cotal spawn [<persona>] [--file <persona-file>] [-d | --foreground] [--dry-run] [options]",
576
584
  positionals: "[<persona>]",
577
585
  flags: spawnFlags,
@@ -589,7 +597,7 @@ const baseCommands = [
589
597
  usage: "cotal models [--json|--plain] [-H|--harness <connector>] [--refresh] [--on <manager-instance>]",
590
598
  flags: modelsFlags,
591
599
  outputs: ["json", "plain"],
592
- examples: ["cotal models", "cotal models -H claude --refresh", "cotal models --on <manager-instance> --json"],
600
+ examples: [{ command: "cotal models", note: "list the models each application offers" }, { command: "cotal models -H claude", note: "list one application's models" }, { command: "cotal models --refresh", note: "ask the applications to read their catalogs again" }],
593
601
  reads: true,
594
602
  run: models,
595
603
  complete: modelsComplete,
@@ -625,6 +633,7 @@ const baseCommands = [
625
633
  name: "stop",
626
634
  group: "Agents",
627
635
  summary: "stop one managed agent",
636
+ examples: [{ command: "cotal stop <name>", note: "stop one managed agent" }, { command: "cotal stop <name> --force", note: "stop it without a graceful shutdown" }],
628
637
  usage: "cotal stop <name> [--force] | cotal stop --self [--force] [--json|--plain]",
629
638
  positionals: "[<name>] | --self",
630
639
  flags: stopFlags,
@@ -642,7 +651,7 @@ const baseCommands = [
642
651
  usage: "cotal ps [--json|--plain] [--wide | --slots] [--on <instance>]",
643
652
  flags: psFlags,
644
653
  outputs: ["json", "plain"],
645
- examples: ["cotal ps", "cotal ps --wide", "cotal ps --json", "cotal ps --on <instance>"],
654
+ examples: [{ command: "cotal ps", note: "list your managed agents" }, { command: "cotal ps --wide", note: "add each agent's folder, process and host" }, { command: "cotal ps --json", note: "the same as one JSON document" }],
646
655
  reads: true,
647
656
  run: ps,
648
657
  },
@@ -652,6 +661,7 @@ const baseCommands = [
652
661
  aliases: ["a"],
653
662
  group: "Agents",
654
663
  summary: "return to an agent's terminal; detaching leaves it running",
664
+ examples: [{ command: "cotal attach <name>", note: "return to an agent's terminal" }, { command: "cotal attach <name> --on <instance>", note: "ask only one manager for it" }],
655
665
  usage: "cotal attach [<name>] [--on <instance>] [--space <space>]",
656
666
  positionals: "[<name>]",
657
667
  flags: attachFlags,
@@ -664,6 +674,7 @@ const baseCommands = [
664
674
  name: "input",
665
675
  group: "Agents",
666
676
  summary: "write native terminal input without attaching; this is not a chat message",
677
+ examples: [{ command: "cotal input <agent> \"/compact\"", note: "type a slash command into it" }, { command: "cotal input <agent> \"<text>\" --no-enter", note: "type text without pressing Enter" }],
667
678
  usage: "cotal input <agent> <text> [--no-enter] [--on <instance>] [--json|--plain]",
668
679
  positionals: "<agent> <text>",
669
680
  flags: inputFlags,
@@ -678,14 +689,15 @@ const baseCommands = [
678
689
  aliases: ["p"],
679
690
  group: "Agents",
680
691
  summary: "manage local definitions or an exact manager's caller-owned persona catalog",
692
+ examples: [{ command: "cotal persona", note: "list your personas" }, { command: "cotal persona create <name> --prompt \"<text>\"", note: "save a persona from a prompt" }, { command: "cotal persona show <name>", note: "read one persona" }],
681
693
  usage: "cotal persona [--json|--plain] | persona show <name> | persona create <name> (--file <persona.md>|--prompt <text>|--from <path>) | persona edit <name> | persona remove <name> [--yes]; list/show/create support --on <manager-instance>",
682
694
  positionals: "[show <name> | create <name> | edit <name> | remove <name>]",
683
695
  flagNames: ["space", "server", "on", "json", "plain"],
684
696
  subcommands: [
685
- { name: "show", flagNames: ["space", "server", "on", "json", "plain"], summary: "read a local definition or an authorized exact-manager card", usage: "cotal persona show <name> [--on <manager-instance>] [--json|--plain]", reads: true, outputs: ["json", "plain"] },
686
- { name: "create", flagNames: ["space", "server", "on", "file", "prompt", "from", "role", "model", "harness", "subscribe", "allow-subscribe", "allow-publish", "announce", "json", "plain"], summary: "save a local definition or define a caller-owned remote persona", usage: "cotal persona create <name> (--file <persona.md> | --prompt <text> | --from <path>) [--role <role>] [--model <model>] [--harness <application>] [--subscribe <a,b|\"\">] [--on <manager-instance>] [--json|--plain]", outputs: ["json", "plain"] },
687
- { name: "edit", flagNames: ["space", "server", "json", "plain"], summary: "validate a private editor draft before saving", usage: "cotal persona edit <name> [--json|--plain]", outputs: ["json", "plain"] },
688
- { name: "remove", flagNames: ["space", "server", "yes", "json", "plain"], aliases: ["rm"], summary: "remove a named local definition after confirmation", usage: "cotal persona remove <name> [-y|--yes] [--json|--plain]", outputs: ["json", "plain"] },
697
+ { name: "show", flagNames: ["space", "server", "on", "json", "plain"], summary: "read a local definition or an authorized exact-manager card", examples: [{ command: "cotal persona show <name>", note: "read a persona's definition" }], usage: "cotal persona show <name> [--on <manager-instance>] [--json|--plain]", reads: true, outputs: ["json", "plain"] },
698
+ { name: "create", flagNames: ["space", "server", "on", "file", "prompt", "from", "role", "model", "harness", "subscribe", "allow-subscribe", "allow-publish", "announce", "json", "plain"], summary: "save a local definition or define a caller-owned remote persona", examples: [{ command: "cotal persona create <name> --prompt \"<text>\"", note: "save a persona from a prompt" }, { command: "cotal persona create <name> --file <persona.md>", note: "save one from a file" }], usage: "cotal persona create <name> (--file <persona.md> | --prompt <text> | --from <path>) [--role <role>] [--model <model>] [--harness <application>] [--subscribe <a,b|\"\">] [--on <manager-instance>] [--json|--plain]", outputs: ["json", "plain"] },
699
+ { name: "edit", flagNames: ["space", "server", "json", "plain"], summary: "validate a private editor draft before saving", examples: [{ command: "cotal persona edit <name>", note: "edit a persona in your editor" }], usage: "cotal persona edit <name> [--json|--plain]", outputs: ["json", "plain"] },
700
+ { name: "remove", flagNames: ["space", "server", "yes", "json", "plain"], aliases: ["rm"], summary: "remove a named local definition after confirmation", examples: [{ command: "cotal persona remove <name>", note: "remove a persona after you confirm" }], usage: "cotal persona remove <name> [-y|--yes] [--json|--plain]", outputs: ["json", "plain"] },
689
701
  ],
690
702
  flags: personaFlags,
691
703
  outputs: ["json", "plain"],
@@ -728,24 +740,25 @@ const baseCommands = [
728
740
  kind: "command", name: "endpoint", aliases: ["ep"], group: "Endpoints",
729
741
  positionals: "[show|add|remove|describe|invoke|watch|session|work|init|check|deregister] [target] [command-or-instance]",
730
742
  summary: "save references, author contracts offline, and inspect or invoke native endpoints",
743
+ examples: [{ command: "cotal endpoint", note: "list the saved endpoint references" }, { command: "cotal endpoint describe <target>", note: "read an endpoint's commands" }, { command: "cotal endpoint invoke <target> <command>", note: "call one of its commands" }],
731
744
  usage: "cotal endpoint [show | add | remove | describe | invoke | watch | session | work | init | check | deregister] [target] [command-or-instance] [options]",
732
745
  flagNames: ["space", "live", "server", "creds", "json", "plain"],
733
746
  flags: endpointFlags, outputs: ["json", "ndjson", "plain"], reads: true, prepareMeshTarget: false,
734
747
  subcommands: [
735
- { name: "deregister", flagNames: ["space", "server", "yes", "dry-run", "json", "plain"], summary: "remove one broker-affirmed-gone registration through the native guarded provider", usage: "cotal endpoint deregister <class> <full-instance-id> [--yes|--dry-run]" },
736
- { name: "init", flagNames: ["dir", "json", "plain"], summary: "create a contract and handler template without launching anything", usage: "cotal endpoint init <name> [--dir <directory>]" },
737
- { name: "check", flagNames: ["json", "plain"], summary: "compile a local endpoint contract offline; never execute its handler", reads: true, usage: "cotal endpoint check <contract-file>" },
738
- { name: "show", flagNames: ["space", "json", "plain"], summary: "read a local reference and its revision", reads: true, usage: "cotal endpoint show <name>" },
739
- { name: "describe", flagNames: ["space", "server", "creds", "on", "refresh", "json", "plain"], summary: "read the selected native endpoint's digest-verified contracts", reads: true, usage: "cotal endpoint describe <ref:name | ep:class | target>" },
740
- { name: "invoke", flagNames: ["space", "server", "creds", "on", "args", "name", "self", "admin", "timeout", "handle", "wait", "cast", "all", "json", "plain"], summary: "invoke one declared command under the existing caller authority", usage: "cotal endpoint invoke <target> <command> [--args '<json>']" },
741
- { name: "watch", flagNames: ["space", "server", "creds", "on", "since", "json", "plain"], summary: "declared record/event watch; native declaration adapter unavailable in this author", usage: "cotal endpoint watch <target> <record-key-or-topic> [--since <native-sequence>]", reads: true },
742
- { name: "session", flagNames: ["space", "server", "creds", "on", "json", "plain"], summary: "declared interactive session; native declaration adapter unavailable in this author", usage: "cotal endpoint session <target> <command>" },
743
- { name: "work", flagNames: ["space", "server", "creds", "on", "lease", "result", "json", "plain"], summary: "declared work pools; native declaration adapter unavailable in this author", usage: "cotal endpoint work lease <target> <pool> | work commit <target> <pool> --lease <private-file> --result <JSON>", subcommands: [
744
- { name: "lease", flagNames: ["space", "server", "creds", "on", "json", "plain"], summary: "lease from a declared pool; no lease is created on refusal", usage: "cotal endpoint work lease <target> <pool>" },
745
- { name: "commit", flagNames: ["space", "server", "creds", "on", "lease", "result", "json", "plain"], summary: "commit an original native lease tuple; unsupported routes read or consume nothing", usage: "cotal endpoint work commit <target> <pool> --lease <private-file> --result <JSON>" },
748
+ { name: "deregister", flagNames: ["space", "server", "yes", "dry-run", "json", "plain"], summary: "remove one broker-affirmed-gone registration through the native guarded provider", examples: [{ command: "cotal endpoint deregister <class> <full-instance-id> --dry-run", note: "preview removing a registration that is gone" }, { command: "cotal endpoint deregister <class> <full-instance-id> --yes", note: "remove it" }], usage: "cotal endpoint deregister <class> <full-instance-id> [--yes|--dry-run]" },
749
+ { name: "init", flagNames: ["dir", "json", "plain"], summary: "create a contract and handler template without launching anything", examples: [{ command: "cotal endpoint init <name>", note: "write a starter contract here" }, { command: "cotal endpoint init <name> --dir <directory>", note: "write them into another folder" }], usage: "cotal endpoint init <name> [--dir <directory>]" },
750
+ { name: "check", flagNames: ["json", "plain"], summary: "compile a local endpoint contract offline; never execute its handler", examples: [{ command: "cotal endpoint check <contract-file>", note: "compile a contract offline" }], reads: true, usage: "cotal endpoint check <contract-file>" },
751
+ { name: "show", flagNames: ["space", "json", "plain"], summary: "read a local reference and its revision", examples: [{ command: "cotal endpoint show <name>", note: "read a saved reference" }], reads: true, usage: "cotal endpoint show <name>" },
752
+ { name: "describe", flagNames: ["space", "server", "creds", "on", "refresh", "json", "plain"], summary: "read the selected native endpoint's digest-verified contracts", examples: [{ command: "cotal endpoint describe <target>", note: "read an endpoint's commands and schemas" }, { command: "cotal endpoint describe ep:<class>", note: "read them by endpoint class" }], reads: true, usage: "cotal endpoint describe <ref:name | ep:class | target>" },
753
+ { name: "invoke", flagNames: ["space", "server", "creds", "on", "args", "name", "self", "admin", "timeout", "handle", "wait", "cast", "all", "json", "plain"], summary: "invoke one declared command under the existing caller authority", examples: [{ command: "cotal endpoint invoke <target> <command>", note: "call one command" }, { command: "cotal endpoint invoke <target> <command> --args '<json>'", note: "call it with arguments" }], usage: "cotal endpoint invoke <target> <command> [--args '<json>']" },
754
+ { name: "watch", flagNames: ["space", "server", "creds", "on", "since", "json", "plain"], summary: "declared record/event watch; native declaration adapter unavailable in this author", examples: [{ command: "cotal endpoint watch <target> <record-key-or-topic>", note: "watch a declared record or topic" }], usage: "cotal endpoint watch <target> <record-key-or-topic> [--since <native-sequence>]", reads: true },
755
+ { name: "session", flagNames: ["space", "server", "creds", "on", "json", "plain"], summary: "declared interactive session; native declaration adapter unavailable in this author", examples: [{ command: "cotal endpoint session <target> <command>", note: "open a declared interactive session" }], usage: "cotal endpoint session <target> <command>" },
756
+ { name: "work", flagNames: ["space", "server", "creds", "on", "lease", "result", "json", "plain"], summary: "declared work pools; native declaration adapter unavailable in this author", examples: [{ command: "cotal endpoint work lease <target> <pool>", note: "lease an item from a work pool" }, { command: "cotal endpoint work commit <target> <pool> --lease <file> --result <json>", note: "commit the leased item's result" }], usage: "cotal endpoint work lease <target> <pool> | work commit <target> <pool> --lease <private-file> --result <JSON>", subcommands: [
757
+ { name: "lease", flagNames: ["space", "server", "creds", "on", "json", "plain"], summary: "lease from a declared pool; no lease is created on refusal", examples: [{ command: "cotal endpoint work lease <target> <pool>", note: "lease an item from a work pool" }], usage: "cotal endpoint work lease <target> <pool>" },
758
+ { name: "commit", flagNames: ["space", "server", "creds", "on", "lease", "result", "json", "plain"], summary: "commit an original native lease tuple; unsupported routes read or consume nothing", examples: [{ command: "cotal endpoint work commit <target> <pool> --lease <file> --result <json>", note: "commit the leased item's result" }], usage: "cotal endpoint work commit <target> <pool> --lease <private-file> --result <JSON>" },
746
759
  ] },
747
- { name: "add", flagNames: ["space", "file", "json", "plain"], summary: "save a validated local reference; launch and invoke nothing", usage: "cotal endpoint add [name] [--file <reference.json>]" },
748
- { name: "remove", flagNames: ["space", "yes", "json", "plain"], aliases: ["rm"], summary: "forget only a pinned local reference", usage: "cotal endpoint remove <name> [--yes]" },
760
+ { name: "add", flagNames: ["space", "file", "json", "plain"], summary: "save a validated local reference; launch and invoke nothing", examples: [{ command: "cotal endpoint add <name> --file <reference.json>", note: "save a reference from a file" }], usage: "cotal endpoint add [name] [--file <reference.json>]" },
761
+ { name: "remove", flagNames: ["space", "yes", "json", "plain"], aliases: ["rm"], summary: "forget only a pinned local reference", examples: [{ command: "cotal endpoint remove <name>", note: "forget a saved reference" }], usage: "cotal endpoint remove <name> [--yes]" },
749
762
  { name: "list", flagNames: ["space", "server", "creds", "live", "json", "plain"], hidden: true, summary: "read only the selected space's local references", reads: true },
750
763
  ].map((sub) => ({ ...sub, outputs: sub.name === "invoke" ? ["json", "ndjson", "plain"] : ["json", "plain"] })),
751
764
  validate: validateEndpointReferenceArguments, run: endpoint,
@@ -770,7 +783,7 @@ const baseCommands = [
770
783
  usage: "cotal who [--waiting] [--all] [--json|--plain] [--space <s>] [--server <url>] [--creds <path>]",
771
784
  flags: whoFlags,
772
785
  outputs: ["json", "plain"],
773
- examples: ["cotal who", "cotal who --waiting", "cotal who --all --json"],
786
+ examples: [{ command: "cotal who", note: "see who is in the space and what each is doing" }, { command: "cotal who --waiting", note: "only those waiting or reporting a problem" }, { command: "cotal who --all", note: "also list the manager and other services" }],
774
787
  reads: true,
775
788
  run: who,
776
789
  },
@@ -783,7 +796,7 @@ const baseCommands = [
783
796
  flags: whoamiFlags,
784
797
  prepareMeshTarget: false,
785
798
  outputs: ["json", "plain"],
786
- examples: ["cotal whoami", "cotal whoami --json", "cotal whoami --creds ./agent.creds"],
799
+ examples: [{ command: "cotal whoami", note: "see who this CLI acts as and what it may do" }, { command: "cotal whoami --creds <file>", note: "read what a credential file allows" }],
787
800
  reads: true,
788
801
  run: whoami,
789
802
  },
@@ -827,7 +840,7 @@ const baseCommands = [
827
840
  outputs: ["ndjson", "plain"],
828
841
  validate: validateWatchArguments,
829
842
  reads: true,
830
- examples: ["cotal watch", "cotal watch --view events", "cotal watch --plain"],
843
+ examples: [{ command: "cotal watch", note: "follow activity in the space live" }, { command: "cotal watch --view messages", note: "follow only the messages" }, { command: "cotal watch --plain", note: "print activity as plain lines" }],
831
844
  run: watch,
832
845
  complete: watchComplete,
833
846
  },