@treeseed/cli 0.6.13 → 0.6.15

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.
@@ -43,14 +43,37 @@ function resolveCoreDevEntrypoint(cwd) {
43
43
  const handleDev = async (invocation, context) => {
44
44
  try {
45
45
  const watch = invocation.commandName === "dev:watch" || invocation.args.watch === true;
46
+ const passthroughArgs = [];
47
+ const forwardStringOption = (name, flag) => {
48
+ const value = invocation.args[name];
49
+ if (typeof value === "string" && value.trim().length > 0) {
50
+ passthroughArgs.push(flag, value);
51
+ }
52
+ };
53
+ const forwardBooleanOption = (name, flag) => {
54
+ if (invocation.args[name] === true) {
55
+ passthroughArgs.push(flag);
56
+ }
57
+ };
58
+ forwardStringOption("surface", "--surface");
59
+ forwardStringOption("host", "--host");
60
+ forwardStringOption("port", "--port");
61
+ forwardStringOption("apiHost", "--api-host");
62
+ forwardStringOption("apiPort", "--api-port");
63
+ forwardStringOption("managerPort", "--manager-port");
64
+ forwardStringOption("setup", "--setup");
65
+ forwardStringOption("feedback", "--feedback");
66
+ forwardStringOption("open", "--open");
67
+ forwardBooleanOption("plan", "--plan");
68
+ forwardBooleanOption("json", "--json");
46
69
  const workspaceRoot = findNearestTreeseedWorkspaceRoot(context.cwd);
47
70
  const workspaceLinksMode = typeof invocation.args.workspaceLinks === "string" ? invocation.args.workspaceLinks : void 0;
48
71
  const workspaceLinks = workspaceRoot ? ensureLocalWorkspaceLinks(workspaceRoot, { env: context.env, mode: workspaceLinksMode }) : null;
49
- if (workspaceLinks?.created.length) {
72
+ if (workspaceLinks?.created.length && invocation.args.json !== true) {
50
73
  context.write(`[workspace][link] Linked ${workspaceLinks.created.length} local workspace package paths.`, "stdout");
51
74
  }
52
75
  const resolved = resolveCoreDevEntrypoint(context.cwd);
53
- const args = watch ? [...resolved.args, "--watch"] : resolved.args;
76
+ const args = watch ? [...resolved.args, ...passthroughArgs, "--watch"] : [...resolved.args, ...passthroughArgs];
54
77
  const result = context.spawn(resolved.command, args, {
55
78
  cwd: context.cwd,
56
79
  env: resolveTreeseedLaunchEnvironment({
@@ -62,6 +85,7 @@ const handleDev = async (invocation, context) => {
62
85
  });
63
86
  return {
64
87
  exitCode: result.status ?? 1,
88
+ suppressJsonResult: invocation.args.json === true,
65
89
  report: {
66
90
  command: "dev",
67
91
  ok: (result.status ?? 1) === 0,
@@ -49,6 +49,9 @@ function guidedResult(options) {
49
49
  }
50
50
  function writeResult(result, context) {
51
51
  if (context.outputFormat === "json") {
52
+ if (result.suppressJsonResult === true) {
53
+ return result.exitCode ?? 0;
54
+ }
52
55
  const payload = result.report ?? {
53
56
  ok: (result.exitCode ?? 0) === 0,
54
57
  stdout: result.stdout ?? [],
@@ -20,6 +20,21 @@ function detail(name, detailText) {
20
20
  function related(name, why) {
21
21
  return { name, why };
22
22
  }
23
+ const DEV_RUNTIME_OPTIONS = [
24
+ { name: "surface", flags: "--surface <surface>", description: "Select the local dev surface to run.", kind: "enum", values: ["integrated", "web", "api", "manager", "worker", "services"] },
25
+ { name: "host", flags: "--host <host>", description: "Host for the web dev server.", kind: "string" },
26
+ { name: "port", flags: "--port <port>", description: "Port for the web dev server.", kind: "string" },
27
+ { name: "apiHost", flags: "--api-host <host>", description: "Host used to construct the local API URL.", kind: "string" },
28
+ { name: "apiPort", flags: "--api-port <port>", description: "Port for the local API server.", kind: "string" },
29
+ { name: "managerPort", flags: "--manager-port <port>", description: "Port used for the local manager service URL.", kind: "string" },
30
+ { name: "setup", flags: "--setup <mode>", description: "Control automatic local runtime setup.", kind: "enum", values: ["auto", "check", "off"] },
31
+ { name: "feedback", flags: "--feedback <mode>", description: "Control live feedback, service restarts, and browser reload stamps.", kind: "enum", values: ["live", "restart", "off"] },
32
+ { name: "open", flags: "--open <mode>", description: "Control whether dev opens the browser after readiness.", kind: "enum", values: ["auto", "on", "off"] },
33
+ { name: "plan", flags: "--plan", description: "Print the dev runtime plan and exit without starting services.", kind: "boolean" },
34
+ { name: "json", flags: "--json", description: "Emit structured JSON or newline-delimited dev events.", kind: "boolean" },
35
+ { name: "watch", flags: "--watch", description: "Enable live watch behavior. `dev` defaults to live feedback; this remains for compatibility.", kind: "boolean" },
36
+ { name: "workspaceLinks", flags: "--workspace-links <mode>", description: "Control local workspace package links.", kind: "enum", values: ["auto", "off"] }
37
+ ];
23
38
  function genericWorkflowPosition(spec) {
24
39
  if (spec.group === "Workflow") {
25
40
  if (spec.name === "switch") return "start work";
@@ -1036,31 +1051,45 @@ const CLI_COMMAND_OVERLAYS = /* @__PURE__ */ new Map([
1036
1051
  handlerName: "destroy"
1037
1052
  })],
1038
1053
  ["dev", command({
1039
- options: [
1040
- { name: "workspaceLinks", flags: "--workspace-links <mode>", description: "Control local workspace package links.", kind: "enum", values: ["auto", "off"] }
1041
- ],
1042
- examples: ["treeseed dev"],
1054
+ options: DEV_RUNTIME_OPTIONS,
1055
+ examples: ["treeseed dev", "treeseed dev --plan --json", "treeseed dev --surface web --port 4322 --open off"],
1043
1056
  help: {
1044
- longSummary: ["Dev starts the unified local Treeseed runtime so you can work against the integrated web, API, and supporting local surfaces."],
1057
+ longSummary: [
1058
+ "Dev starts the unified local Treeseed runtime as a foreground supervisor so you can work against the integrated web, API, and supporting local surfaces.",
1059
+ "The command keeps streaming logs and dev events until you press Ctrl+C, receive SIGTERM, or a required surface fails; shutdown stops every service process group it started."
1060
+ ],
1061
+ beforeYouRun: [
1062
+ "Run from the tenant or workspace root you want to develop.",
1063
+ "Use `--plan --json` when you want to inspect commands, setup steps, readiness checks, and watched paths without starting services.",
1064
+ "Keep the foreground process running while you test. Press Ctrl+C to stop the supervised stack and free the local ports."
1065
+ ],
1045
1066
  examples: [
1046
- example("treeseed dev", "Start integrated local development", "Run the default integrated local runtime."),
1067
+ example("treeseed dev", "Start integrated local development", "Run the default integrated local runtime and keep supervising it in the foreground."),
1068
+ example("treeseed dev --plan --json", "Inspect the runtime plan", "Emit a structured plan with setup steps, commands, ports, URLs, readiness checks, and watch entries."),
1069
+ example("treeseed dev --surface web --port 4322 --open off", "Run only the web surface", "Start the Astro UI on a specific port without opening a browser."),
1047
1070
  example("trsd dev", "Use the short alias", "Start the same local runtime through the shorter entrypoint."),
1048
- example("treeseed dev && treeseed status", "Pair runtime start with orientation", "Start the local runtime and then inspect workflow state in another shell.")
1071
+ example("treeseed dev --json", "Stream dev events", "Emit newline-delimited events while the long-running dev process supervises local services.")
1072
+ ],
1073
+ outcomes: [
1074
+ "Starts the selected local surfaces, waits for readiness, and then remains attached as the live supervisor.",
1075
+ "Stops watchers first and then terminates service process groups when the foreground command exits."
1049
1076
  ]
1050
1077
  },
1051
1078
  executionMode: "handler",
1052
1079
  handlerName: "dev"
1053
1080
  })],
1054
1081
  ["dev:watch", command({
1055
- options: [
1056
- { name: "workspaceLinks", flags: "--workspace-links <mode>", description: "Control local workspace package links.", kind: "enum", values: ["auto", "off"] }
1057
- ],
1058
- examples: ["treeseed dev:watch"],
1082
+ options: DEV_RUNTIME_OPTIONS,
1083
+ examples: ["treeseed dev:watch", "treeseed dev:watch --json"],
1059
1084
  help: {
1060
- longSummary: ["Dev:watch starts local development with rebuild and watch semantics so code changes are reflected continuously during active development."],
1085
+ longSummary: [
1086
+ "Dev:watch is a compatibility alias for foreground dev supervision with live feedback enabled.",
1087
+ "It stays attached to the terminal and cleans up supervised services on Ctrl+C just like `dev`."
1088
+ ],
1061
1089
  examples: [
1062
- example("treeseed dev:watch", "Start watch mode", "Run the local runtime with watch and rebuild behavior enabled."),
1090
+ example("treeseed dev:watch", "Start watch mode", "Run the local runtime with watch and rebuild behavior enabled in the foreground."),
1063
1091
  example("trsd dev:watch", "Use the short alias", "Start the same watch-mode runtime through the shorter entrypoint."),
1092
+ example("treeseed dev:watch --feedback restart", "Restart services without browser reload", "Use watcher-driven service restarts while leaving browser refresh to your own tooling."),
1064
1093
  example("treeseed dev:watch --help", "Inspect watch help", "Read the help surface before starting a longer watch session.")
1065
1094
  ]
1066
1095
  },
@@ -59,6 +59,7 @@ export type TreeseedCommandResult = {
59
59
  stdout?: string[];
60
60
  stderr?: string[];
61
61
  report?: Record<string, unknown> | null;
62
+ suppressJsonResult?: boolean;
62
63
  };
63
64
  export type TreeseedWriter = NonNullable<SdkOperationContext['write']>;
64
65
  export type TreeseedSpawner = NonNullable<SdkOperationContext['spawn']>;
@@ -6,6 +6,7 @@ export declare function writeTreeseedResult(result: TreeseedOperationResult | {
6
6
  stdout?: string[];
7
7
  stderr?: string[];
8
8
  report?: Record<string, unknown> | null;
9
+ suppressJsonResult?: boolean;
9
10
  }, context: TreeseedCommandContext): number;
10
11
  export type TreeseedOperationsSdkOptions = {
11
12
  resolveHandler?: TreeseedHandlerResolver;
@@ -137,6 +137,9 @@ function createTreeseedCommandContext(overrides = {}) {
137
137
  }
138
138
  function writeTreeseedResult(result, context) {
139
139
  if (context.outputFormat === "json") {
140
+ if (result.suppressJsonResult === true) {
141
+ return result.exitCode ?? 0;
142
+ }
140
143
  const payload = result.report ?? {
141
144
  ok: (result.exitCode ?? 0) === 0,
142
145
  stdout: result.stdout ?? [],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@treeseed/cli",
3
- "version": "0.6.13",
3
+ "version": "0.6.15",
4
4
  "description": "Operator-facing Treeseed CLI package.",
5
5
  "license": "AGPL-3.0-only",
6
6
  "repository": {
@@ -45,7 +45,7 @@
45
45
  "release:publish": "node ./scripts/run-ts.mjs ./scripts/publish-package.ts"
46
46
  },
47
47
  "dependencies": {
48
- "@treeseed/sdk": "0.6.13",
48
+ "@treeseed/sdk": "0.6.15",
49
49
  "ink": "^7.0.0",
50
50
  "react": "^19.2.5"
51
51
  },