@treeseed/cli 0.4.7 → 0.4.9

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.
@@ -1,110 +1,480 @@
1
1
  import {
2
2
  findTreeseedOperation as findSdkOperation,
3
- listTreeseedOperationNames as listSdkOperationNames,
4
3
  TRESEED_OPERATION_SPECS as SDK_OPERATION_SPECS
5
4
  } from "@treeseed/sdk/operations";
6
5
  function command(overlay) {
7
6
  return overlay;
8
7
  }
8
+ function example(commandLine, title, description, extras = {}) {
9
+ return {
10
+ command: commandLine,
11
+ title,
12
+ description,
13
+ ...extras
14
+ };
15
+ }
16
+ function detail(name, detailText) {
17
+ return { name, detail: detailText };
18
+ }
19
+ function related(name, why) {
20
+ return { name, why };
21
+ }
22
+ function genericWorkflowPosition(spec) {
23
+ if (spec.group === "Workflow") {
24
+ if (spec.name === "switch") return "start work";
25
+ if (spec.name === "save") return "checkpoint work";
26
+ if (spec.name === "close") return "abandon task";
27
+ if (spec.name === "stage") return "merge to staging";
28
+ if (spec.name === "release") return "promote to production";
29
+ if (spec.name === "rollback") return "restore deployment";
30
+ if (spec.name === "destroy") return "tear down environment";
31
+ return "workflow";
32
+ }
33
+ if (spec.group === "Validation") return "validate";
34
+ if (spec.group === "Local Development") return "local runtime";
35
+ if (spec.group === "Release Utilities") return "release utility";
36
+ if (spec.group === "Passthrough") return "passthrough";
37
+ return "utility";
38
+ }
39
+ function genericExamples(spec, overlay) {
40
+ const overlayExamples = (overlay.examples ?? []).map((commandLine) => example(
41
+ commandLine,
42
+ "Example",
43
+ `Run ${spec.name} with a representative argument set.`
44
+ ));
45
+ if (overlayExamples.length > 0) {
46
+ return overlayExamples;
47
+ }
48
+ return [
49
+ example(`treeseed ${spec.name}`, "Basic invocation", `Run ${spec.name} with its default behavior.`)
50
+ ];
51
+ }
52
+ function genericLongSummary(spec) {
53
+ return [
54
+ spec.description || spec.summary,
55
+ `This command belongs to the ${spec.group.toLowerCase()} surface and is exposed through the same registry that drives parsing, runtime dispatch, and help rendering.`
56
+ ];
57
+ }
58
+ function genericWhenToUse(spec) {
59
+ return [
60
+ `Use this command when you need the ${spec.summary.replace(/\.$/u, "").toLowerCase()} workflow directly from the Treeseed CLI.`,
61
+ `Reach for \`treeseed ${spec.name}\` when the command name matches the next action you want to take, and then move to related commands for the next stage of the workflow.`
62
+ ];
63
+ }
64
+ function genericBeforeYouRun(spec) {
65
+ const lines = ["Run this command from a Treeseed workspace unless the command documentation explicitly says it can run outside a workspace."];
66
+ if ((spec.options ?? []).some((option) => option.name === "json")) {
67
+ lines.push("Decide up front whether you want human-readable output or machine-readable `--json` output so downstream automation and shell usage stay predictable.");
68
+ }
69
+ if (spec.executionMode === "delegate") {
70
+ lines.push("This command delegates to another runtime surface, so make sure the delegated runtime package is installed and available.");
71
+ }
72
+ return lines;
73
+ }
74
+ function genericOutcomes(spec) {
75
+ const relatedCommands = spec.related ?? [];
76
+ return [
77
+ `Running this command executes the ${spec.executionMode} path for \`${spec.name}\` and prints the result through the standard Treeseed CLI surface.`,
78
+ ...relatedCommands.length > 0 ? [`After it completes, the most common next commands are ${relatedCommands.map((name) => `\`${name}\``).join(", ")}.`] : []
79
+ ];
80
+ }
81
+ function genericAutomationNotes(spec) {
82
+ const lines = [
83
+ spec.executionMode === "adapter" ? "This command runs through an adapter path, so argument forwarding should be treated as package-script semantics rather than a handwritten workflow handler." : "This command runs through a CLI-owned workflow handler or delegate path and follows the Treeseed command parsing model directly."
84
+ ];
85
+ if ((spec.options ?? []).some((option) => option.name === "json")) {
86
+ lines.push("Use `--json` for scripts, agents, or other machine consumers that need stable structured output instead of human-formatted text.");
87
+ } else {
88
+ lines.push("This command does not expose a dedicated JSON output mode, so treat it as a human-facing command unless you are invoking the underlying package runtime directly.");
89
+ }
90
+ return lines;
91
+ }
92
+ function genericWarnings(spec) {
93
+ const warnings = [];
94
+ if (spec.name === "destroy" || spec.name === "rollback") {
95
+ warnings.push("This command can affect live or persistent environments. Confirm the target scope and the intended rollback or destroy boundary before running it.");
96
+ }
97
+ if (spec.name === "release") {
98
+ warnings.push("Release operations assume staging is the source of truth for what should move to production. Treat version bumps and promotion as deliberate release events.");
99
+ }
100
+ if (spec.executionMode === "passthrough") {
101
+ warnings.push("This command forwards to another CLI surface. Flags after `--` or positional forwarding may follow the target tool semantics rather than Treeseed-specific semantics.");
102
+ }
103
+ return warnings;
104
+ }
105
+ function genericRelatedDetails(spec) {
106
+ return (spec.related ?? []).map((name) => related(name, `Use \`${name}\` next when you want to continue the workflow immediately after \`${spec.name}\`.`));
107
+ }
108
+ function mergeHelpSpec(metadata, overlay, spec) {
109
+ const base = {
110
+ workflowPosition: genericWorkflowPosition(metadata),
111
+ longSummary: genericLongSummary(metadata),
112
+ whenToUse: genericWhenToUse(metadata),
113
+ beforeYouRun: genericBeforeYouRun(spec),
114
+ outcomes: genericOutcomes(spec),
115
+ examples: genericExamples(metadata, overlay),
116
+ optionDetails: [],
117
+ argumentDetails: [],
118
+ automationNotes: genericAutomationNotes(spec),
119
+ warnings: genericWarnings(spec),
120
+ relatedDetails: genericRelatedDetails(spec),
121
+ seeAlso: spec.related
122
+ };
123
+ return {
124
+ ...base,
125
+ ...overlay.help ?? {},
126
+ examples: overlay.help?.examples ?? base.examples,
127
+ optionDetails: overlay.help?.optionDetails ?? base.optionDetails,
128
+ argumentDetails: overlay.help?.argumentDetails ?? base.argumentDetails,
129
+ relatedDetails: overlay.help?.relatedDetails ?? base.relatedDetails,
130
+ seeAlso: overlay.help?.seeAlso ?? base.seeAlso
131
+ };
132
+ }
9
133
  const PASS_THROUGH_ARGS = (invocation) => ({ args: invocation.rawArgs });
10
134
  const CLI_COMMAND_OVERLAYS = /* @__PURE__ */ new Map([
11
135
  ["status", command({
12
- usage: "treeseed status [--json]",
13
136
  options: [{ name: "json", flags: "--json", description: "Emit machine-readable JSON instead of human-readable text.", kind: "boolean" }],
14
137
  examples: ["treeseed status", "treeseed status --json"],
138
+ help: {
139
+ workflowPosition: "inspect",
140
+ longSummary: [
141
+ "Status is the fastest orientation command in the Treeseed workflow. It tells you where you are, what branch role you are on, and whether the current workspace is in a state where other workflow commands make sense.",
142
+ "Use it as the first command when you enter a project or return to a task after some time away."
143
+ ],
144
+ whenToUse: [
145
+ "Use this before `switch`, `save`, `stage`, or `release` when you need to confirm the current branch role and workspace state.",
146
+ "Use it when debugging workflow confusion and you need the CLI to summarize the current project health quickly."
147
+ ],
148
+ beforeYouRun: [
149
+ "Run from the workspace you want to inspect.",
150
+ "Choose `--json` when another tool or agent needs to read the status programmatically."
151
+ ],
152
+ outcomes: [
153
+ "Prints the current branch role, project health, and related state without mutating the workspace.",
154
+ "Gives you the orientation you need before choosing the next workflow command."
155
+ ],
156
+ examples: [
157
+ example("treeseed status", "Check the current task state", "Show the current branch role and project health in human-readable form."),
158
+ example("treeseed status --json", "Feed an agent or script", "Emit structured status data for automation and external tooling."),
159
+ example("trsd status", "Use the short alias", "Run the same status inspection path through the shorter CLI entrypoint.")
160
+ ],
161
+ automationNotes: [
162
+ "`--json` is the preferred mode for automation because it preserves branch-role and health information in structured form.",
163
+ "This command is safe to call repeatedly because it is read-only."
164
+ ],
165
+ relatedDetails: [
166
+ related("tasks", "Move to `tasks` when status tells you there are multiple task branches and you need the list."),
167
+ related("switch", "Move to `switch` when status shows you are not on the task branch you want to resume.")
168
+ ]
169
+ },
15
170
  executionMode: "handler",
16
171
  handlerName: "status"
17
172
  })],
18
173
  ["tasks", command({
19
- usage: "treeseed tasks [--json]",
20
174
  options: [{ name: "json", flags: "--json", description: "Emit machine-readable JSON instead of human-readable text.", kind: "boolean" }],
21
175
  examples: ["treeseed tasks", "treeseed tasks --json"],
176
+ help: {
177
+ workflowPosition: "inspect",
178
+ longSummary: [
179
+ "Tasks lists the current task branches and related preview metadata so you can see what active work exists before choosing a branch to resume or close."
180
+ ],
181
+ whenToUse: [
182
+ "Use this when you know there are multiple task branches and you need a quick inventory.",
183
+ "Use it before `switch` if you want to confirm the exact branch name to resume."
184
+ ],
185
+ outcomes: [
186
+ "Prints the task inventory and any surfaced preview metadata without changing the repo state."
187
+ ],
188
+ examples: [
189
+ example("treeseed tasks", "List task branches", "Show active task branches in the current workspace."),
190
+ example("treeseed tasks --json", "Machine-readable task inventory", "Emit the task list in JSON for scripts or agent tooling."),
191
+ example("trsd tasks", "Use the short alias", "Run the same task listing flow through the shorter CLI entrypoint.")
192
+ ],
193
+ relatedDetails: [
194
+ related("status", "Use `status` when you want one branch summary instead of the full task inventory."),
195
+ related("switch", "Use `switch` after identifying the task branch you want to enter or resume.")
196
+ ]
197
+ },
22
198
  executionMode: "handler",
23
199
  handlerName: "tasks"
24
200
  })],
25
201
  ["switch", command({
26
- usage: "treeseed switch <branch-name> [--preview] [--json]",
27
202
  arguments: [{ name: "branch-name", description: "Task branch to create or resume.", required: true }],
28
203
  options: [
29
204
  { name: "preview", flags: "--preview", description: "Provision or refresh a branch-scoped Cloudflare preview environment.", kind: "boolean" },
30
205
  { name: "json", flags: "--json", description: "Emit machine-readable JSON instead of human-readable text.", kind: "boolean" }
31
206
  ],
32
207
  examples: ["treeseed switch feature/search-improvements", "treeseed switch feature/search-improvements --preview"],
208
+ help: {
209
+ workflowPosition: "start work",
210
+ longSummary: [
211
+ "Switch is the entry point into task work. It creates or resumes a task branch, aligns the workspace to that branch, and optionally provisions the branch preview when you want environment feedback immediately.",
212
+ "This is the command to use when the next thing you want is a task-shaped working branch with Treeseed semantics around branch role and preview handling."
213
+ ],
214
+ whenToUse: [
215
+ "Use this when starting a new task or resuming an existing task branch.",
216
+ "Use `--preview` when you need branch-scoped environment feedback as part of the task lifecycle."
217
+ ],
218
+ beforeYouRun: [
219
+ "Run from the target Treeseed workspace.",
220
+ "Choose a branch name that reflects the task and fits the repo branch naming conventions.",
221
+ "If you request `--preview`, make sure the project has the necessary provider configuration for branch previews."
222
+ ],
223
+ outcomes: [
224
+ "Creates or checks out the requested task branch.",
225
+ "Optionally provisions or refreshes the branch preview environment.",
226
+ "Sets up the branch state expected by later commands such as `save`, `close`, and `stage`."
227
+ ],
228
+ examples: [
229
+ example("treeseed switch feature/search-improvements", "Resume or create a task branch", "Enter the task branch for a feature or work item."),
230
+ example("treeseed switch feature/search-improvements --preview", "Attach preview provisioning", "Create or refresh the branch preview while switching into the task."),
231
+ example("treeseed switch bugfix/auth-header --json", "Automate branch entry", "Emit structured output so another tool can react to the branch state and preview metadata.", { why: "Useful for scripted workflow orchestration." })
232
+ ],
233
+ optionDetails: [
234
+ detail("--preview", "Use this when the task should immediately have a branch-scoped preview deployment or refresh."),
235
+ detail("--json", "Prefer this when another tool needs the branch and preview result in structured form.")
236
+ ],
237
+ warnings: [
238
+ "`switch` is the task-lifecycle entrypoint. Do not use it as a generic git checkout replacement for arbitrary non-task branches."
239
+ ],
240
+ relatedDetails: [
241
+ related("status", "Use `status` first if you are unsure what branch role you are on before switching."),
242
+ related("save", "Use `save` after making meaningful progress on the task branch."),
243
+ related("close", "Use `close` when the task should be abandoned or superseded instead of merged."),
244
+ related("stage", "Use `stage` when the task is ready to merge into staging.")
245
+ ]
246
+ },
33
247
  executionMode: "handler",
34
248
  handlerName: "switch"
35
249
  })],
36
250
  ["save", command({
37
- usage: "treeseed save [--hotfix] <message> [--json]",
38
251
  arguments: [{ name: "message", description: "Git commit message for the save operation.", required: true, kind: "message_tail" }],
39
252
  options: [
40
253
  { name: "hotfix", flags: "--hotfix", description: "Allow save on main for an explicit hotfix.", kind: "boolean" },
254
+ { name: "preview", flags: "--preview", description: "Create or refresh the branch preview during save.", kind: "boolean" },
41
255
  { name: "json", flags: "--json", description: "Emit machine-readable JSON instead of human-readable text.", kind: "boolean" }
42
256
  ],
43
- examples: ['treeseed save "feat: add search filters"', 'treeseed save --hotfix "fix: unblock production form submit"'],
257
+ examples: ['treeseed save "feat: add search filters"', 'treeseed save --preview "feat: add search filters"', 'treeseed save --hotfix "fix: unblock production form submit"'],
258
+ help: {
259
+ workflowPosition: "checkpoint work",
260
+ longSummary: [
261
+ "Save is the main task-branch checkpoint command. It verifies, commits, syncs, pushes, and can refresh the task preview so the branch remains in a clean, reviewable state.",
262
+ "Use it instead of ad hoc manual git-and-preview sequences when you want the standard Treeseed task-save behavior."
263
+ ],
264
+ whenToUse: [
265
+ "Use this after a meaningful unit of work on a task branch.",
266
+ "Use `--preview` when the branch preview should be refreshed as part of the save operation.",
267
+ "Use `--hotfix` only when you are intentionally saving from `main` for an explicit production hotfix flow."
268
+ ],
269
+ beforeYouRun: [
270
+ "Run from a task branch unless you intentionally mean to use the hotfix path.",
271
+ "Provide a commit message that captures the checkpoint clearly because Treeseed will use it for the save commit."
272
+ ],
273
+ outcomes: [
274
+ "Verifies and commits current work using the provided message.",
275
+ "Syncs and pushes branch state.",
276
+ "Optionally refreshes preview infrastructure if requested."
277
+ ],
278
+ examples: [
279
+ example('treeseed save "feat: add search filters"', "Standard task checkpoint", "Verify, commit, and push the current task branch with a descriptive message."),
280
+ example('treeseed save --preview "feat: add search filters"', "Checkpoint plus preview refresh", "Include preview refresh when the save should update the branch environment."),
281
+ example('treeseed save --hotfix "fix: unblock production form submit"', "Explicit hotfix save", "Allow a save from main when the work is a deliberate hotfix path.", { why: "Use sparingly and only when the workflow intentionally bypasses the usual task-branch rule." })
282
+ ],
283
+ warnings: [
284
+ "`--hotfix` deliberately loosens the normal task-branch safety model. Keep it exceptional."
285
+ ],
286
+ relatedDetails: [
287
+ related("switch", "Use `switch` to enter the task branch before saving work."),
288
+ related("stage", "Use `stage` when the saved task is ready to merge to staging."),
289
+ related("close", "Use `close` when the task should be archived instead of staged.")
290
+ ]
291
+ },
44
292
  executionMode: "handler",
45
293
  handlerName: "save"
46
294
  })],
47
295
  ["close", command({
48
- usage: "treeseed close <message> [--json]",
49
296
  arguments: [{ name: "message", description: "Reason for closing the task without staging it.", required: true, kind: "message_tail" }],
50
297
  options: [{ name: "json", flags: "--json", description: "Emit machine-readable JSON instead of human-readable text.", kind: "boolean" }],
51
298
  examples: ['treeseed close "superseded by feature/search-v2"'],
299
+ notes: ["Auto-saves meaningful uncommitted task-branch changes before cleanup unless disabled in the workflow API."],
300
+ help: {
301
+ workflowPosition: "abandon task",
302
+ longSummary: [
303
+ "Close archives a task branch without merging it. It is the workflow path for superseded, abandoned, or no-longer-needed task work."
304
+ ],
305
+ whenToUse: [
306
+ "Use this when a task branch should be cleaned up rather than merged.",
307
+ "Use it when the work moved elsewhere or the task turned out to be unnecessary."
308
+ ],
309
+ outcomes: [
310
+ "Archives the task branch workflow state.",
311
+ "Auto-saves meaningful uncommitted task work before cleanup unless disabled deeper in the workflow layer."
312
+ ],
313
+ examples: [
314
+ example('treeseed close "superseded by feature/search-v2"', "Archive superseded work", "Close a task branch that is no longer the active line of work."),
315
+ example('treeseed close "duplicate of feature/new-auth"', "Close a duplicate task", "Record the reason a task was abandoned so later auditing remains understandable."),
316
+ example('treeseed close --json "no longer needed"', "Automate task cleanup", "Emit structured workflow results while closing the task branch.")
317
+ ],
318
+ warnings: [
319
+ "Closing does not merge the task. Use `stage` instead when the work should move forward into staging."
320
+ ],
321
+ relatedDetails: [
322
+ related("save", "Use `save` if the task should remain active and you only need a checkpoint."),
323
+ related("stage", "Use `stage` if the branch is complete and should be merged into staging.")
324
+ ]
325
+ },
52
326
  executionMode: "handler",
53
327
  handlerName: "close"
54
328
  })],
55
329
  ["stage", command({
56
- usage: "treeseed stage <message> [--json]",
57
330
  arguments: [{ name: "message", description: "Resolution message for the staged task.", required: true, kind: "message_tail" }],
58
331
  options: [{ name: "json", flags: "--json", description: "Emit machine-readable JSON instead of human-readable text.", kind: "boolean" }],
59
332
  examples: ['treeseed stage "feat: add search filters"'],
333
+ notes: ["Auto-saves meaningful uncommitted task-branch changes before merging into staging."],
334
+ help: {
335
+ workflowPosition: "merge to staging",
336
+ longSummary: [
337
+ "Stage is the task completion command for the normal promotion path. It merges the current task into staging and then cleans up the task branch."
338
+ ],
339
+ whenToUse: [
340
+ "Use this when a task branch is ready for the staging environment.",
341
+ "Use it instead of manual merge steps when you want the standard Treeseed task promotion workflow."
342
+ ],
343
+ outcomes: [
344
+ "Merges the task branch into staging.",
345
+ "Performs task cleanup after the merge succeeds.",
346
+ "Auto-saves meaningful uncommitted changes before the merge when necessary."
347
+ ],
348
+ examples: [
349
+ example('treeseed stage "feat: add search filters"', "Promote a completed task", "Merge the current task branch into staging with a resolution message."),
350
+ example('treeseed stage "fix: stabilize staging deploy"', "Stage a fix branch", "Advance a staging-targeted fix into the shared staging branch."),
351
+ example('treeseed stage --json "feat: add search filters"', "Automate staging promotion", "Emit structured workflow output during task promotion.")
352
+ ],
353
+ relatedDetails: [
354
+ related("save", "Use `save` while the task is still in progress."),
355
+ related("release", "Use `release` after staging is in the state you want to promote to production.")
356
+ ]
357
+ },
60
358
  executionMode: "handler",
61
359
  handlerName: "stage"
62
360
  })],
63
361
  ["rollback", command({
64
- usage: "treeseed rollback <staging|prod> [--to <deploy-id|commit>] [--json]",
65
362
  arguments: [{ name: "environment", description: "The persistent environment to roll back.", required: true }],
66
363
  options: [
67
364
  { name: "to", flags: "--to <deploy-id|commit>", description: "Explicit commit to roll back to. Defaults to the previous recorded deployment when omitted.", kind: "string" },
68
365
  { name: "json", flags: "--json", description: "Emit machine-readable JSON instead of human-readable text.", kind: "boolean" }
69
366
  ],
70
367
  examples: ["treeseed rollback staging", "treeseed rollback prod --to abc1234"],
368
+ help: {
369
+ workflowPosition: "restore deployment",
370
+ longSummary: [
371
+ "Rollback restores a persistent environment to a previous deployment state. It is the fast recovery path when the latest staging or production deploy is not the version you want to keep live."
372
+ ],
373
+ whenToUse: [
374
+ "Use this when a staging or production deployment must be reverted quickly.",
375
+ "Use `--to` when the exact deploy or commit target is known and you do not want the default \u201Cprevious deployment\u201D behavior."
376
+ ],
377
+ beforeYouRun: [
378
+ "Confirm the target environment carefully. Rollback acts on persistent environments only.",
379
+ "If you know the exact deployment target, pass it explicitly with `--to` to avoid ambiguity."
380
+ ],
381
+ outcomes: [
382
+ "Repoints the selected environment to an earlier deployment target.",
383
+ "Returns structured rollback metadata when `--json` is requested."
384
+ ],
385
+ examples: [
386
+ example("treeseed rollback staging", "Rollback to the previous staging deployment", "Use the default previous-deployment fallback when staging should revert one step."),
387
+ example("treeseed rollback prod --to abc1234", "Rollback production to an explicit target", "Pin the rollback to the exact deployment or commit you want to restore."),
388
+ example("treeseed rollback staging --json", "Automate rollback tracking", "Emit machine-readable rollback output for incident tooling or follow-up automation.")
389
+ ],
390
+ warnings: [
391
+ "Rollback changes a persistent environment. Treat the target environment and deploy id as incident-response inputs, not casual experimentation."
392
+ ],
393
+ relatedDetails: [
394
+ related("release", "Use `release` for forward promotion when staging is healthy and should move to production."),
395
+ related("status", "Use `status` to inspect the workspace before or after a rollback-driven response workflow.")
396
+ ]
397
+ },
71
398
  executionMode: "handler",
72
399
  handlerName: "rollback"
73
400
  })],
74
401
  ["doctor", command({
75
- usage: "treeseed doctor [--fix] [--json]",
76
402
  options: [
77
403
  { name: "fix", flags: "--fix", description: "Apply safe local repairs before rerunning diagnostics.", kind: "boolean" },
78
404
  { name: "json", flags: "--json", description: "Emit machine-readable JSON instead of human-readable text.", kind: "boolean" }
79
405
  ],
80
406
  examples: ["treeseed doctor", "treeseed doctor --fix --json"],
407
+ help: {
408
+ workflowPosition: "validate",
409
+ longSummary: [
410
+ "Doctor diagnoses workflow blockers across tooling, auth, workspace state, and local configuration. It is the command to run when Treeseed feels broken and you want a prioritized explanation of what is wrong."
411
+ ],
412
+ whenToUse: [
413
+ "Use this when other commands are failing or when onboarding a machine and you want a readiness report.",
414
+ "Use `--fix` when you want Treeseed to apply safe local repairs before rerunning diagnostics."
415
+ ],
416
+ outcomes: [
417
+ "Reports readiness issues and what must be fixed immediately.",
418
+ "Optionally applies safe local fixes before re-checking."
419
+ ],
420
+ examples: [
421
+ example("treeseed doctor", "Run diagnostics only", "Inspect the current machine and workspace without making repairs."),
422
+ example("treeseed doctor --fix", "Repair safe local issues", "Apply safe fixes first and then rerun diagnostics."),
423
+ example("treeseed doctor --fix --json", "Integrate diagnostics with automation", "Emit structured diagnostics and repair results for scripts or agents.")
424
+ ],
425
+ relatedDetails: [
426
+ related("auth:check", "Use `auth:check` when you only want a focused auth and prerequisite check."),
427
+ related("config", "Use `config` when doctor points to missing environment or provider configuration.")
428
+ ]
429
+ },
81
430
  executionMode: "handler",
82
431
  handlerName: "doctor"
83
432
  })],
84
433
  ["auth:login", command({
85
- usage: "treeseed auth:login [--host <id>] [--json]",
86
434
  options: [
87
435
  { name: "host", flags: "--host <id>", description: "Override the configured remote host id for this login.", kind: "string" },
88
436
  { name: "json", flags: "--json", description: "Emit machine-readable JSON instead of human-readable text.", kind: "boolean" }
89
437
  ],
90
438
  examples: ["treeseed auth:login"],
439
+ help: {
440
+ longSummary: ["Auth:login authenticates the CLI against the configured Treeseed API so later provider-aware and remote-aware workflows can run without missing-credential failures."],
441
+ examples: [
442
+ example("treeseed auth:login", "Log in with the default host", "Authenticate the CLI against the configured default Treeseed API host."),
443
+ example("treeseed auth:login --host production", "Target a specific host id", "Override the configured default host for this login session."),
444
+ example("treeseed auth:login --json", "Automate auth workflows", "Emit structured auth results where supported for scripts and agents.")
445
+ ]
446
+ },
91
447
  executionMode: "handler",
92
448
  handlerName: "auth:login"
93
449
  })],
94
450
  ["auth:logout", command({
95
- usage: "treeseed auth:logout [--host <id>] [--json]",
96
451
  options: [
97
452
  { name: "host", flags: "--host <id>", description: "Override the configured remote host id to clear.", kind: "string" },
98
453
  { name: "json", flags: "--json", description: "Emit machine-readable JSON instead of human-readable text.", kind: "boolean" }
99
454
  ],
100
455
  examples: ["treeseed auth:logout"],
456
+ help: {
457
+ longSummary: ["Auth:logout clears the locally stored Treeseed API credentials for the selected host."],
458
+ examples: [
459
+ example("treeseed auth:logout", "Log out from the default host", "Clear the current local Treeseed API session."),
460
+ example("treeseed auth:logout --host production", "Clear a specific host session", "Target a named host id rather than the default configured host."),
461
+ example("treeseed auth:logout --json", "Track logout in automation", "Emit structured auth-logout results when a script needs confirmation.")
462
+ ]
463
+ },
101
464
  executionMode: "handler",
102
465
  handlerName: "auth:logout"
103
466
  })],
104
467
  ["auth:whoami", command({
105
- usage: "treeseed auth:whoami [--json]",
106
468
  options: [{ name: "json", flags: "--json", description: "Emit machine-readable JSON instead of human-readable text.", kind: "boolean" }],
107
469
  examples: ["treeseed auth:whoami"],
470
+ help: {
471
+ longSummary: ["Auth:whoami shows the currently active Treeseed API identity so you can verify which account and host context the CLI is using."],
472
+ examples: [
473
+ example("treeseed auth:whoami", "Inspect the active identity", "Show the currently authenticated Treeseed API identity."),
474
+ example("treeseed auth:whoami --json", "Read auth identity programmatically", "Emit structured identity information for scripts and agents."),
475
+ example("treeseed auth:whoami && treeseed config", "Check identity before configuration sync", "Confirm the current account before running provider-backed config flows.")
476
+ ]
477
+ },
108
478
  executionMode: "handler",
109
479
  handlerName: "auth:whoami"
110
480
  })],
@@ -115,18 +485,36 @@ const CLI_COMMAND_OVERLAYS = /* @__PURE__ */ new Map([
115
485
  { name: "id", description: "Template id for show or validate.", required: false }
116
486
  ],
117
487
  examples: ["treeseed template", "treeseed template list", "treeseed template show starter-basic", "treeseed template validate"],
488
+ help: {
489
+ longSummary: [
490
+ "Template exposes the Treeseed starter catalog so you can list, inspect, and validate starter definitions before using them for initialization or distribution work."
491
+ ],
492
+ examples: [
493
+ example("treeseed template", "Default to the catalog list", "Show the available starters without specifying an action."),
494
+ example("treeseed template show starter-basic", "Inspect a single starter", "View the details of one starter template."),
495
+ example("treeseed template validate", "Validate the current template set", "Run template validation to confirm the catalog is internally consistent.")
496
+ ]
497
+ },
118
498
  executionMode: "handler",
119
499
  handlerName: "template"
120
500
  })],
121
501
  ["sync", command({
122
- usage: "treeseed sync [--check]",
123
502
  options: [{ name: "check", flags: "--check", description: "Report managed-surface drift without changing files.", kind: "boolean" }],
124
503
  examples: ["treeseed sync --check", "treeseed sync"],
504
+ help: {
505
+ longSummary: [
506
+ "Sync reconciles the managed template surface for the current site. It is the command to use when you want to check or restore generated/managed Treeseed surfaces."
507
+ ],
508
+ examples: [
509
+ example("treeseed sync --check", "Detect managed-surface drift", "Report what would change without mutating files."),
510
+ example("treeseed sync", "Apply managed-surface reconciliation", "Bring managed surfaces back into sync with the current template model."),
511
+ example("trsd sync --check", "Use the short alias", "Run the same sync drift check through the short CLI entrypoint.")
512
+ ]
513
+ },
125
514
  executionMode: "handler",
126
515
  handlerName: "sync"
127
516
  })],
128
517
  ["init", command({
129
- usage: "treeseed init <directory> [--template <starter-id>] [--name <site-name>] [--slug <slug>] [--site-url <url>] [--contact-email <email>] [--repo <url>] [--discord <url>]",
130
518
  arguments: [{ name: "directory", description: "Target directory for the new tenant.", required: true }],
131
519
  options: [
132
520
  { name: "template", flags: "--template <starter-id>", description: "Select the starter template id to generate. Defaults to starter-basic.", kind: "string" },
@@ -139,12 +527,39 @@ const CLI_COMMAND_OVERLAYS = /* @__PURE__ */ new Map([
139
527
  ],
140
528
  examples: ['treeseed init docs-site --template starter-basic --name "Docs Site" --site-url https://docs.example.com'],
141
529
  notes: ["Runs outside an existing repo or from any branch."],
530
+ help: {
531
+ workflowPosition: "create workspace",
532
+ longSummary: [
533
+ "Init scaffolds a new Treeseed tenant from the starter catalog. It is the entry point for creating a new project directory with the expected manifest, content layout, and runtime scaffolding."
534
+ ],
535
+ whenToUse: [
536
+ "Use this when creating a brand-new Treeseed tenant.",
537
+ "Use it outside an existing repo or from any branch because initialization targets a directory rather than the current branch lifecycle."
538
+ ],
539
+ beforeYouRun: [
540
+ "Choose the target directory and starter template before running the command.",
541
+ "Decide which identity fields you want to override at scaffold time, such as site name, slug, and public URL."
542
+ ],
543
+ outcomes: [
544
+ "Creates the requested tenant directory and starter structure.",
545
+ "Seeds the project metadata fields requested through the CLI flags."
546
+ ],
547
+ examples: [
548
+ example('treeseed init docs-site --template starter-basic --name "Docs Site" --site-url https://docs.example.com', "Create a starter site", "Scaffold a new tenant using the basic starter and explicit branding metadata."),
549
+ example("treeseed init workbench --slug workbench --contact-email ops@example.com", "Control project identity fields", "Initialize a tenant while overriding slug and contact metadata at creation time."),
550
+ example("treeseed init docs-site --repo https://github.com/example/docs-site --discord https://discord.gg/example", "Seed community and repository metadata", "Attach repository and community URLs during project initialization.")
551
+ ],
552
+ relatedDetails: [
553
+ related("config", "Run `config` after init to set up environment variables, auth, and provider sync."),
554
+ related("dev", "Run `dev` after init when you are ready to start the integrated local runtime.")
555
+ ]
556
+ },
142
557
  executionMode: "handler",
143
558
  handlerName: "init"
144
559
  })],
145
560
  ["config", command({
146
- usage: "treeseed config [--environment <all|local|staging|prod>]... [--sync <none|github|cloudflare|railway|all>] [--print-env] [--print-env-only] [--show-secrets] [--rotate-machine-key]",
147
561
  options: [
562
+ { name: "full", flags: "--full", description: "Open the advanced full editor directly in human interactive mode.", kind: "boolean" },
148
563
  { name: "environment", flags: "--environment <scope>", description: "Select all environments or limit configuration to local, staging, or prod. Defaults to all.", kind: "enum", repeatable: true, values: ["all", "local", "staging", "prod"] },
149
564
  { name: "sync", flags: "--sync <mode>", description: "Sync hosted secrets/variables to GitHub, Cloudflare, Railway, or all providers. Defaults to all.", kind: "enum", values: ["none", "github", "cloudflare", "railway", "all"] },
150
565
  { name: "printEnv", flags: "--print-env", description: "Print resolved environment values before remote initialization.", kind: "boolean" },
@@ -153,11 +568,100 @@ const CLI_COMMAND_OVERLAYS = /* @__PURE__ */ new Map([
153
568
  { name: "rotateMachineKey", flags: "--rotate-machine-key", description: "Regenerate the local home machine key and re-encrypt stored Treeseed secrets and remote auth sessions.", kind: "boolean" },
154
569
  { name: "json", flags: "--json", description: "Emit machine-readable JSON instead of human-readable text.", kind: "boolean" }
155
570
  ],
156
- examples: ["treeseed config", "treeseed config --environment all", "treeseed config --environment local --sync none", "treeseed config --environment staging --print-env-only --show-secrets", "treeseed config --rotate-machine-key"],
571
+ examples: ["treeseed config", "treeseed config --full", "treeseed config --environment all", "treeseed config --environment local --sync none", "treeseed config --environment staging --print-env-only --show-secrets", "treeseed config --rotate-machine-key"],
157
572
  notes: ["Does not create branch preview deployments. Use `treeseed switch <branch> --preview` for that."],
573
+ help: {
574
+ workflowPosition: "configure runtime",
575
+ longSummary: [
576
+ "Config is the runtime foundation command for Treeseed. It resolves local and hosted environment values, captures missing values, runs the startup wizard or full editor for human use, and can synchronize provider-backed secrets and variables.",
577
+ "Use it whenever environment configuration, provider auth, shared defaults, or machine-local secret state need to be inspected or updated."
578
+ ],
579
+ whenToUse: [
580
+ "Use this during first-run setup, after new required environment variables are introduced, or when provider-backed configuration drift must be repaired.",
581
+ "Use the startup wizard for onboarding and the full editor when you need complete per-variable control."
582
+ ],
583
+ beforeYouRun: [
584
+ "Decide whether you want human interactive mode or machine-readable `--json` output before invoking the command.",
585
+ "Choose the environment scope you care about: all, local, staging, or prod.",
586
+ "If you plan to sync hosted state, make sure GitHub, Cloudflare, and Railway authentication is already configured or be ready to log in first."
587
+ ],
588
+ outcomes: [
589
+ "Collects current, suggested, shared, and scoped environment values.",
590
+ "Allows interactive editing for humans or structured application for automation.",
591
+ "Optionally synchronizes hosted provider state and rotates the local machine key."
592
+ ],
593
+ examples: [
594
+ example("treeseed config", "Run the startup wizard", "Open the newcomer-friendly configuration wizard in human TTY mode."),
595
+ example("treeseed config --full", "Open the advanced editor directly", "Skip the startup wizard and go straight to the full configuration surface."),
596
+ example("treeseed config --environment local --sync none", "Edit local values without provider sync", "Limit the session to local values and avoid hosted synchronization while iterating locally."),
597
+ example("treeseed config --environment staging --print-env-only --show-secrets", "Inspect a resolved environment report", "Print the resolved staging environment with full secret visibility and exit."),
598
+ example("treeseed config --rotate-machine-key", "Rotate the local secret encryption key", "Regenerate the machine key and re-encrypt locally stored Treeseed secrets.")
599
+ ],
600
+ optionDetails: [
601
+ detail("--full", "Enter the advanced editor directly instead of the startup wizard."),
602
+ detail("--environment <scope>", "Filter configuration to `all`, `local`, `staging`, or `prod`."),
603
+ detail("--sync <mode>", "Choose which provider surfaces should receive synchronized values after local updates are applied."),
604
+ detail("--print-env", "Print the resolved environment values before remote initialization continues."),
605
+ detail("--print-env-only", "Print the environment report and exit without interactive editing or remote initialization."),
606
+ detail("--rotate-machine-key", "Rotate the local machine key used for encrypted Treeseed secret storage.")
607
+ ],
608
+ automationNotes: [
609
+ "Use `--json` for non-interactive flows. Human TTY mode is where the startup wizard and full editor appear.",
610
+ "`--print-env-only` and `--rotate-machine-key` are operational paths that bypass the interactive UI.",
611
+ "Shared versus scoped environment semantics are resolved inside the SDK; the CLI help should be treated as the operator-facing explanation layer."
612
+ ],
613
+ warnings: [
614
+ "This command does not create branch preview deployments. Use `switch --preview` for task-preview lifecycle work.",
615
+ "When `--show-secrets` is enabled, output is intentionally unmasked. Avoid using it in logs or shared terminals unless that disclosure is acceptable."
616
+ ],
617
+ relatedDetails: [
618
+ related("doctor", "Use `doctor` when the problem is diagnostic uncertainty rather than direct environment editing."),
619
+ related("auth:login", "Use `auth:login` when provider-backed operations fail because the CLI is not authenticated."),
620
+ related("switch", "Use `switch --preview` for branch preview lifecycle work, which is intentionally separate from config.")
621
+ ]
622
+ },
158
623
  executionMode: "handler",
159
624
  handlerName: "config"
160
625
  })],
626
+ ["export", command({
627
+ arguments: [{ name: "directory", description: "Directory subtree to export. Defaults to the current shell directory.", required: false }],
628
+ options: [
629
+ { name: "json", flags: "--json", description: "Emit machine-readable JSON instead of human-readable text.", kind: "boolean" }
630
+ ],
631
+ examples: ["treeseed export", "treeseed export src", "treeseed export packages/sdk --json"],
632
+ help: {
633
+ workflowPosition: "package codebase",
634
+ longSummary: [
635
+ "Export generates a Markdown codebase snapshot for the selected directory using the SDK-owned Repomix integration. It is designed for AI context bundling and archival of the current project tree."
636
+ ],
637
+ whenToUse: [
638
+ "Use this when you need a portable Markdown snapshot of a project subtree for AI context, review, or archival.",
639
+ "Use the positional directory when you want to export a subtree instead of the current shell directory."
640
+ ],
641
+ beforeYouRun: [
642
+ "Run from somewhere inside the Treeseed project you want to export, or pass the exact subtree explicitly.",
643
+ "Remember that `.treeseed/exports` is always ignored so exports do not recursively contain older exports."
644
+ ],
645
+ outcomes: [
646
+ "Writes a Markdown package under `.treeseed/exports` relative to the exported directory.",
647
+ "Reports branch, timestamp, ignore patterns, and summary metadata."
648
+ ],
649
+ examples: [
650
+ example("treeseed export", "Export from the current shell directory", "Generate a codebase snapshot rooted at the directory you are currently in."),
651
+ example("treeseed export src", "Export a source subtree", "Limit the snapshot to the `src` subtree relative to the current workspace."),
652
+ example("treeseed export packages/sdk --json", "Use export in automation", "Emit structured metadata about the generated Markdown snapshot.")
653
+ ],
654
+ warnings: [
655
+ "The export output directory is always relative to the directory being exported, not necessarily the tenant root."
656
+ ],
657
+ relatedDetails: [
658
+ related("config", "Use `config` when you need runtime configuration context rather than a code snapshot."),
659
+ related("status", "Use `status` to understand workflow state before capturing a code export for external analysis.")
660
+ ]
661
+ },
662
+ executionMode: "handler",
663
+ handlerName: "export"
664
+ })],
161
665
  ["release", command({
162
666
  usage: "treeseed release --major|--minor|--patch",
163
667
  options: [
@@ -168,6 +672,37 @@ const CLI_COMMAND_OVERLAYS = /* @__PURE__ */ new Map([
168
672
  ],
169
673
  examples: ["treeseed release --patch", "treeseed release --minor"],
170
674
  notes: ["Requires exactly one bump flag."],
675
+ help: {
676
+ workflowPosition: "promote to production",
677
+ longSummary: [
678
+ "Release promotes the staging state to production while applying a version bump. It is the forward promotion command once staging reflects the exact state you intend to publish."
679
+ ],
680
+ whenToUse: [
681
+ "Use this only when staging is the approved source for production promotion.",
682
+ "Choose exactly one bump flag so the release version reflects the intended change size."
683
+ ],
684
+ beforeYouRun: [
685
+ "Confirm staging is in the state you want to promote.",
686
+ "Choose one of `--major`, `--minor`, or `--patch` before running the command."
687
+ ],
688
+ outcomes: [
689
+ "Promotes the release forward and records the version bump.",
690
+ "Returns release metadata in JSON mode when requested."
691
+ ],
692
+ examples: [
693
+ example("treeseed release --patch", "Patch release", "Promote staging to production with the next patch version."),
694
+ example("treeseed release --minor", "Minor release", "Promote staging with the next minor version bump."),
695
+ example("treeseed release --patch --json", "Automate release tracking", "Emit structured release output for tooling that records deployments and version changes.")
696
+ ],
697
+ warnings: [
698
+ "Exactly one bump flag is required.",
699
+ "This is a production-facing promotion command, not a dry local build operation."
700
+ ],
701
+ relatedDetails: [
702
+ related("stage", "Use `stage` first to move completed task work into staging before releasing."),
703
+ related("rollback", "Use `rollback` when a staging or production deployment must be restored to an earlier state.")
704
+ ]
705
+ },
171
706
  executionMode: "handler",
172
707
  handlerName: "release"
173
708
  })],
@@ -184,18 +719,73 @@ const CLI_COMMAND_OVERLAYS = /* @__PURE__ */ new Map([
184
719
  ],
185
720
  examples: ["treeseed destroy --environment staging --dry-run", "treeseed destroy --environment prod --confirm example --skip-confirmation"],
186
721
  notes: ["Only for persistent environments. Task cleanup belongs to treeseed close.", "This command is destructive and requires explicit confirmation."],
722
+ help: {
723
+ workflowPosition: "tear down environment",
724
+ longSummary: [
725
+ "Destroy tears down a persistent environment and, optionally, related local build artifacts. It is the destructive environment cleanup command and should be treated as an explicit operator workflow."
726
+ ],
727
+ whenToUse: [
728
+ "Use this when a persistent environment should be intentionally removed rather than rolled back or updated.",
729
+ "Use `--dry-run` first when you want to inspect the destroy plan without committing to it."
730
+ ],
731
+ beforeYouRun: [
732
+ "Confirm the environment scope exactly. This command does not target task-branch cleanup; it targets persistent environments only.",
733
+ "Plan your confirmation strategy: interactive prompt, `--skip-confirmation`, or explicit `--confirm <slug>`."
734
+ ],
735
+ outcomes: [
736
+ "Destroys the selected persistent environment resources according to provider support.",
737
+ "Optionally removes local build artifacts if requested."
738
+ ],
739
+ examples: [
740
+ example("treeseed destroy --environment staging --dry-run", "Preview the destroy plan", "Inspect what would be removed from staging without actually performing the destroy."),
741
+ example("treeseed destroy --environment prod --confirm example --skip-confirmation", "Run a deliberate non-interactive destroy", "Provide the expected slug explicitly when operating in a scripted or no-prompt environment."),
742
+ example("treeseed destroy --environment local --remove-build-artifacts", "Remove a local environment and its artifacts", "Destroy the local environment and also delete local build outputs.")
743
+ ],
744
+ warnings: [
745
+ "This command is destructive.",
746
+ "Persistent environment destroy is not the same thing as task cleanup. Use `close` for task-branch archival."
747
+ ],
748
+ relatedDetails: [
749
+ related("rollback", "Use `rollback` when the environment should remain but move back to an earlier deployment."),
750
+ related("close", "Use `close` when the thing you want to clean up is a task branch, not a persistent environment.")
751
+ ]
752
+ },
187
753
  executionMode: "handler",
188
754
  handlerName: "destroy"
189
755
  })],
190
- ["dev", command({ examples: ["treeseed dev"], executionMode: "handler", handlerName: "dev" })],
191
- ["dev:watch", command({ examples: ["treeseed dev:watch"], executionMode: "handler", handlerName: "dev" })],
192
- ["build", command({ examples: ["treeseed build"], executionMode: "adapter" })],
193
- ["check", command({ examples: ["treeseed check"], executionMode: "adapter" })],
194
- ["preview", command({ examples: ["treeseed preview"], executionMode: "adapter", buildAdapterInput: PASS_THROUGH_ARGS })],
195
- ["lint", command({ examples: ["treeseed lint"], executionMode: "adapter" })],
196
- ["test", command({ examples: ["treeseed test"], executionMode: "adapter" })],
197
- ["test:unit", command({ examples: ["treeseed test:unit"], executionMode: "adapter" })],
198
- ["preflight", command({ examples: ["treeseed preflight"], executionMode: "adapter" })],
756
+ ["dev", command({
757
+ examples: ["treeseed dev"],
758
+ help: {
759
+ longSummary: ["Dev starts the unified local Treeseed runtime so you can work against the integrated web, API, and supporting local surfaces."],
760
+ examples: [
761
+ example("treeseed dev", "Start integrated local development", "Run the default integrated local runtime."),
762
+ example("trsd dev", "Use the short alias", "Start the same local runtime through the shorter entrypoint."),
763
+ example("treeseed dev && treeseed status", "Pair runtime start with orientation", "Start the local runtime and then inspect workflow state in another shell.")
764
+ ]
765
+ },
766
+ executionMode: "handler",
767
+ handlerName: "dev"
768
+ })],
769
+ ["dev:watch", command({
770
+ examples: ["treeseed dev:watch"],
771
+ help: {
772
+ longSummary: ["Dev:watch starts local development with rebuild and watch semantics so code changes are reflected continuously during active development."],
773
+ examples: [
774
+ example("treeseed dev:watch", "Start watch mode", "Run the local runtime with watch and rebuild behavior enabled."),
775
+ example("trsd dev:watch", "Use the short alias", "Start the same watch-mode runtime through the shorter entrypoint."),
776
+ example("treeseed dev:watch --help", "Inspect watch help", "Read the help surface before starting a longer watch session.")
777
+ ]
778
+ },
779
+ executionMode: "handler",
780
+ handlerName: "dev"
781
+ })],
782
+ ["build", command({ examples: ["treeseed build"], help: { longSummary: ["Build runs the tenant build path and produces the generated output for the current project."], examples: [example("treeseed build", "Build the tenant", "Run the packaged build flow for the current project."), example("trsd build", "Use the short alias", "Run the same build through the shorter entrypoint."), example("treeseed build && treeseed export", "Build before packaging context", "Produce build artifacts first and then capture a code export if needed.")] }, executionMode: "adapter" })],
783
+ ["check", command({ examples: ["treeseed check"], help: { longSummary: ["Check runs the project validation path against the current tenant and shared fixture model."], examples: [example("treeseed check", "Validate the tenant", "Run the project check flow."), example("trsd check", "Use the short alias", "Run the same validation via the short entrypoint."), example("treeseed check && treeseed doctor", "Pair validation with diagnostics", "Follow failed checks with the broader doctor surface.")] }, executionMode: "adapter" })],
784
+ ["preview", command({ examples: ["treeseed preview"], help: { longSummary: ["Preview serves the built tenant output locally so you can inspect the built site rather than the live dev runtime."], examples: [example("treeseed preview", "Preview the built site", "Run the packaged preview flow for the built tenant."), example("treeseed preview -- --help", "Forward preview help", "Pass through additional args when the preview runtime supports them."), example("treeseed build && treeseed preview", "Build then preview", "Generate the build output first and then serve it locally.")] }, executionMode: "adapter", buildAdapterInput: PASS_THROUGH_ARGS })],
785
+ ["lint", command({ examples: ["treeseed lint"], help: { longSummary: ["Lint runs the project linting and related surface checks for the current tenant."], examples: [example("treeseed lint", "Run lint", "Execute the lint checks for the current project."), example("trsd lint", "Use the short alias", "Run the same lint checks through the shorter entrypoint."), example("treeseed lint && treeseed test:unit", "Lint before unit tests", "Use lint as a first local verification step.")] }, executionMode: "adapter" })],
786
+ ["test", command({ examples: ["treeseed test"], help: { longSummary: ["Test runs the default Treeseed test surface for the current project."], examples: [example("treeseed test", "Run the default test suite", "Execute the standard project test flow."), example("trsd test", "Use the short alias", "Run the same test surface with the shorter entrypoint."), example("treeseed test && treeseed build", "Verify before building", "Run tests before the build step in a local verification loop.")] }, executionMode: "adapter" })],
787
+ ["test:unit", command({ examples: ["treeseed test:unit"], help: { longSummary: ["Test:unit runs workspace unit tests in dependency order."], examples: [example("treeseed test:unit", "Run unit tests", "Execute the package unit test flow."), example("trsd test:unit", "Use the short alias", "Run the same unit tests via the short entrypoint."), example("treeseed test:unit && treeseed check", "Unit tests then validation", "Combine focused tests with broader tenant validation.")] }, executionMode: "adapter" })],
788
+ ["preflight", command({ examples: ["treeseed preflight"], help: { longSummary: ["Preflight checks local prerequisites and authentication state before heavier workflows run."], examples: [example("treeseed preflight", "Run the preflight checklist", "Inspect local prerequisites and auth readiness."), example("trsd preflight", "Use the short alias", "Run the same readiness check via the short entrypoint."), example("treeseed preflight && treeseed dev", "Validate before starting local runtime", "Confirm readiness before launching the integrated dev surface.")] }, executionMode: "adapter" })],
199
789
  ["auth:check", command({ examples: ["treeseed auth:check"], executionMode: "adapter", buildAdapterInput: () => ({ requireAuth: true }) })],
200
790
  ["test:e2e", command({ examples: ["treeseed test:e2e"], executionMode: "adapter" })],
201
791
  ["test:e2e:local", command({ examples: ["treeseed test:e2e:local"], executionMode: "adapter" })],
@@ -222,21 +812,80 @@ const CLI_COMMAND_OVERLAYS = /* @__PURE__ */ new Map([
222
812
  })],
223
813
  ["starlight:patch", command({ examples: ["treeseed starlight:patch"], executionMode: "adapter" })]
224
814
  ]);
815
+ const CLI_ONLY_OPERATION_SPECS = [
816
+ {
817
+ id: "agents.run",
818
+ name: "agents",
819
+ aliases: [],
820
+ group: "Utilities",
821
+ summary: "Run the Treeseed agent runtime namespace.",
822
+ description: "Delegate to the integrated `@treeseed/core` agent runtime namespace and forward the remaining subcommand arguments.",
823
+ provider: "default",
824
+ related: ["status", "config"],
825
+ usage: "treeseed agents <command>",
826
+ arguments: [{ name: "command", description: "Agent subcommand and its remaining arguments.", required: false }],
827
+ examples: ["treeseed agents --help"],
828
+ help: {
829
+ longSummary: [
830
+ "Agents is the CLI entrypoint into the integrated Treeseed agent runtime namespace. It forwards the remaining subcommand arguments to the runtime owned by `@treeseed/core`."
831
+ ],
832
+ whenToUse: [
833
+ "Use this when the thing you want is inside the agent runtime namespace rather than the main Treeseed command set."
834
+ ],
835
+ beforeYouRun: [
836
+ "Make sure the integrated `@treeseed/core` runtime is installed and available because this command delegates rather than handling the work locally."
837
+ ],
838
+ outcomes: [
839
+ "Passes control to the agent runtime and forwards the remaining arguments unchanged."
840
+ ],
841
+ examples: [
842
+ example("treeseed agents --help", "List available agent subcommands", "Inspect the delegated agent namespace before invoking a specific subcommand."),
843
+ example("trsd agents --help", "Use the short alias", "Reach the same agent namespace through the shorter CLI entrypoint."),
844
+ example("treeseed agents <command>", "Delegate a specific agent action", "Forward an agent subcommand and its arguments to the integrated runtime.")
845
+ ],
846
+ automationNotes: [
847
+ "This command delegates directly to another runtime surface, so downstream semantics come from the agent namespace after the handoff."
848
+ ],
849
+ relatedDetails: [
850
+ related("status", "Use `status` when you need the main Treeseed workflow state rather than the delegated agent namespace."),
851
+ related("config", "Use `config` when agent work depends on missing environment or auth setup.")
852
+ ]
853
+ },
854
+ notes: [
855
+ "Delegates to the integrated `@treeseed/core` agent runtime.",
856
+ "Use `treeseed agents --help` to list supported agent subcommands."
857
+ ],
858
+ helpVisible: true,
859
+ helpFeatured: false,
860
+ executionMode: "delegate",
861
+ delegateTo: "agents"
862
+ }
863
+ ];
225
864
  function mergeOperationSpec(metadata) {
226
865
  const overlay = CLI_COMMAND_OVERLAYS.get(metadata.name) ?? {};
227
- return {
866
+ const specWithoutHelp = {
228
867
  ...metadata,
229
868
  usage: overlay.usage,
230
869
  arguments: overlay.arguments,
231
870
  options: overlay.options,
232
871
  examples: overlay.examples,
233
872
  notes: overlay.notes,
873
+ helpVisible: overlay.helpVisible ?? true,
874
+ helpFeatured: overlay.helpFeatured ?? metadata.group === "Workflow",
234
875
  executionMode: overlay.executionMode ?? "adapter",
235
876
  handlerName: overlay.handlerName,
877
+ delegateTo: overlay.delegateTo,
236
878
  buildAdapterInput: overlay.buildAdapterInput
237
879
  };
880
+ return {
881
+ ...specWithoutHelp,
882
+ help: mergeHelpSpec(metadata, overlay, specWithoutHelp)
883
+ };
238
884
  }
239
- const TRESEED_OPERATION_SPECS = SDK_OPERATION_SPECS.map(mergeOperationSpec);
885
+ const TRESEED_OPERATION_SPECS = [
886
+ ...SDK_OPERATION_SPECS.map(mergeOperationSpec),
887
+ ...CLI_ONLY_OPERATION_SPECS
888
+ ];
240
889
  const TRESEED_OPERATION_INDEX = /* @__PURE__ */ new Map();
241
890
  for (const spec of TRESEED_OPERATION_SPECS) {
242
891
  TRESEED_OPERATION_INDEX.set(spec.name, spec);
@@ -246,11 +895,15 @@ for (const spec of TRESEED_OPERATION_SPECS) {
246
895
  }
247
896
  function findTreeseedOperation(name) {
248
897
  if (!name) return null;
898
+ const directMatch = TRESEED_OPERATION_INDEX.get(name);
899
+ if (directMatch) {
900
+ return directMatch;
901
+ }
249
902
  const metadata = findSdkOperation(name);
250
903
  return metadata ? TRESEED_OPERATION_INDEX.get(metadata.name) ?? mergeOperationSpec(metadata) : null;
251
904
  }
252
905
  function listTreeseedOperationNames() {
253
- return listSdkOperationNames();
906
+ return [...new Set(TRESEED_OPERATION_SPECS.map((spec) => spec.name))];
254
907
  }
255
908
  export {
256
909
  TRESEED_OPERATION_INDEX,