@treeseed/cli 0.4.2 → 0.4.4

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/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Operator-facing Treeseed CLI package.
4
4
 
5
- This package publishes the `treeseed` binary. `@treeseed/sdk` owns the reusable workflow and runtime capabilities; `@treeseed/cli` owns argv parsing, command help, terminal formatting, command handlers, and the installable executable surface.
5
+ This package publishes the `treeseed` binary. `@treeseed/sdk` owns the reusable workflow and runtime capabilities, `@treeseed/core` owns integrated local platform orchestration, and `@treeseed/cli` owns argv parsing, command help, terminal formatting, command handlers, and the installable executable surface.
6
6
 
7
7
  ## Requirements
8
8
 
@@ -14,10 +14,10 @@ This package publishes the `treeseed` binary. `@treeseed/sdk` owns the reusable
14
14
  Install the CLI with its runtime dependencies:
15
15
 
16
16
  ```bash
17
- npm install @treeseed/cli @treeseed/sdk @treeseed/agent
17
+ npm install @treeseed/cli @treeseed/core @treeseed/sdk @treeseed/agent
18
18
  ```
19
19
 
20
- `@treeseed/cli` is a thin installable wrapper over `@treeseed/sdk` workflow and operations interfaces plus the `@treeseed/agent` command namespace. In normal consumer installs, npm resolves the runtime dependencies automatically.
20
+ `@treeseed/cli` is a thin installable wrapper over `@treeseed/sdk` workflow and operations interfaces plus the `@treeseed/agent` command namespace. `treeseed dev` resolves and delegates to the tenant-installed `@treeseed/core` runtime. In normal consumer installs, npm resolves the runtime dependencies automatically.
21
21
 
22
22
  After installation, the published binary is available as:
23
23
 
@@ -1,14 +1,63 @@
1
- import { createWorkflowSdk, workflowErrorResult } from "./workflow.js";
1
+ import { existsSync, readFileSync } from "node:fs";
2
+ import { createRequire } from "node:module";
3
+ import { dirname, resolve } from "node:path";
4
+ import { workflowErrorResult } from "./workflow.js";
5
+ const require2 = createRequire(import.meta.url);
6
+ function resolveCoreDevEntrypoint(cwd) {
7
+ const workspacePackageJsonPath = resolve(cwd, "packages", "core", "package.json");
8
+ const installedPackageJsonPath = resolve(cwd, "node_modules", "@treeseed", "core", "package.json");
9
+ let packageJsonPath = workspacePackageJsonPath;
10
+ if (!existsSync(packageJsonPath)) {
11
+ packageJsonPath = installedPackageJsonPath;
12
+ }
13
+ if (!existsSync(packageJsonPath)) {
14
+ const resolvedPath = require2.resolve("@treeseed/core", { paths: [cwd, process.cwd()] });
15
+ let currentDir = dirname(resolvedPath);
16
+ while (!existsSync(resolve(currentDir, "package.json"))) {
17
+ const parentDir = dirname(currentDir);
18
+ if (parentDir === currentDir) {
19
+ throw new Error("Unable to resolve the installed @treeseed/core package root.");
20
+ }
21
+ currentDir = parentDir;
22
+ }
23
+ packageJsonPath = resolve(currentDir, "package.json");
24
+ }
25
+ const packageRoot = dirname(packageJsonPath);
26
+ const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf8"));
27
+ const exportedScript = packageJson.exports?.["./scripts/dev-platform"];
28
+ const distRelativePath = typeof exportedScript === "string" ? exportedScript : exportedScript?.default ?? "./dist/scripts/dev-platform.js";
29
+ const sourceEntrypoint = resolve(packageRoot, "scripts", "dev-platform.ts");
30
+ const sourceRunner = resolve(packageRoot, "scripts", "run-ts.mjs");
31
+ if (existsSync(sourceEntrypoint) && existsSync(sourceRunner)) {
32
+ return {
33
+ command: process.execPath,
34
+ args: [sourceRunner, sourceEntrypoint]
35
+ };
36
+ }
37
+ return {
38
+ command: process.execPath,
39
+ args: [resolve(packageRoot, distRelativePath)]
40
+ };
41
+ }
2
42
  const handleDev = async (invocation, context) => {
3
43
  try {
4
- const result = await createWorkflowSdk(context).dev({
5
- watch: invocation.commandName === "dev:watch" || invocation.args.watch === true,
6
- background: false,
44
+ const watch = invocation.commandName === "dev:watch" || invocation.args.watch === true;
45
+ const resolved = resolveCoreDevEntrypoint(context.cwd);
46
+ const args = watch ? [...resolved.args, "--watch"] : resolved.args;
47
+ const result = context.spawn(resolved.command, args, {
48
+ cwd: context.cwd,
49
+ env: context.env,
7
50
  stdio: "inherit"
8
51
  });
9
52
  return {
10
- exitCode: result.ok ? 0 : 1,
11
- report: result.payload
53
+ exitCode: result.status ?? 1,
54
+ report: {
55
+ command: "dev",
56
+ ok: (result.status ?? 1) === 0,
57
+ watch,
58
+ executable: resolved.command,
59
+ args
60
+ }
12
61
  };
13
62
  } catch (error) {
14
63
  return workflowErrorResult(error);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@treeseed/cli",
3
- "version": "0.4.2",
3
+ "version": "0.4.4",
4
4
  "description": "Operator-facing Treeseed CLI package.",
5
5
  "license": "AGPL-3.0-only",
6
6
  "repository": {
@@ -44,7 +44,7 @@
44
44
  },
45
45
  "dependencies": {
46
46
  "@treeseed/agent": "^0.4.1",
47
- "@treeseed/sdk": "^0.4.2"
47
+ "@treeseed/sdk": "^0.4.4"
48
48
  },
49
49
  "devDependencies": {
50
50
  "@types/node": "^24.6.0",