@treeseed/core 0.6.9 → 0.6.10

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.
@@ -21,15 +21,10 @@ export declare class CopilotExecutionAdapter implements AgentExecutionAdapter {
21
21
  };
22
22
  prompt: string;
23
23
  }): Promise<{
24
- status: "completed";
25
- summary: string;
26
- stdout: string;
27
24
  stderr: string;
28
- } | {
29
- status: "failed";
25
+ status: "completed" | "failed";
30
26
  summary: string;
31
27
  stdout: string;
32
- stderr: string;
33
28
  }>;
34
29
  }
35
30
  export declare class ManualExecutionAdapter implements AgentExecutionAdapter {
@@ -1,8 +1,6 @@
1
- import { execFile } from "node:child_process";
2
- import { promisify } from "node:util";
3
- import { normalizeAgentCliOptions, buildCopilotAllowToolArgs } from "../cli-tools.js";
1
+ import { normalizeAgentCliOptions } from "../cli-tools.js";
4
2
  import { getTreeseedAgentProviderSelections } from "@treeseed/sdk/platform/deploy-runtime";
5
- const execFileAsync = promisify(execFile);
3
+ import { runTreeseedCopilotTask } from "@treeseed/sdk/copilot";
6
4
  class StubExecutionAdapter {
7
5
  async runTask(input) {
8
6
  return {
@@ -24,33 +22,18 @@ class StubExecutionAdapter {
24
22
  class CopilotExecutionAdapter {
25
23
  async runTask(input) {
26
24
  const cli = normalizeAgentCliOptions(input.agent.cli);
27
- const args = ["copilot", "-p", input.prompt];
28
- if (cli.model) {
29
- args.push("--model", cli.model);
30
- }
31
- args.push(...buildCopilotAllowToolArgs(cli.allowTools));
32
- args.push(...cli.additionalArgs ?? []);
33
- try {
34
- const { stdout, stderr } = await execFileAsync("gh", args, {
35
- cwd: process.cwd(),
36
- env: process.env,
37
- maxBuffer: 10 * 1024 * 1024
38
- });
39
- return {
40
- status: "completed",
41
- summary: "Copilot task completed.",
42
- stdout,
43
- stderr
44
- };
45
- } catch (error) {
46
- const stderr = error && typeof error === "object" && "stderr" in error ? String(error.stderr ?? "") : error instanceof Error ? error.message : String(error);
47
- return {
48
- status: "failed",
49
- summary: "Copilot task failed.",
50
- stdout: "",
51
- stderr
52
- };
53
- }
25
+ const result = await runTreeseedCopilotTask({
26
+ prompt: input.prompt,
27
+ cwd: process.cwd(),
28
+ model: cli.model,
29
+ allowTools: cli.allowTools,
30
+ env: process.env
31
+ });
32
+ const ignoredArgs = cli.additionalArgs?.length ? `Ignored Copilot CLI-only arguments because Treeseed uses @github/copilot-sdk internally: ${cli.additionalArgs.join(" ")}` : "";
33
+ return {
34
+ ...result,
35
+ stderr: [result.stderr, ignoredArgs].filter(Boolean).join("\n")
36
+ };
54
37
  }
55
38
  }
56
39
  class ManualExecutionAdapter {
package/dist/env.yaml CHANGED
@@ -89,15 +89,17 @@ entries:
89
89
  CLOUDFLARE_API_TOKEN:
90
90
  label: Cloudflare API token
91
91
  group: auth
92
- description: Account-level Cloudflare API token used by Wrangler and CI to manage Pages, Workers, Workers KV, D1, Queues, DNS, secrets, and deploys.
93
- howToGet: "Create a Cloudflare account-level API token scoped to the target domain and account. Required permissions: Account Cloudflare Pages edit, Account Workers Scripts edit, Account Workers KV Storage edit, Account D1 edit, Account Queues edit, Zone DNS edit. Then paste it here as CLOUDFLARE_API_TOKEN."
92
+ description: Account-level Cloudflare API token used by Wrangler, Workers AI, and CI to manage Pages, Workers, Workers KV, D1, Queues, DNS, secrets, and deploys.
93
+ howToGet: "Create a Cloudflare account-level API token scoped to the target domain and account. Required permissions: Account Cloudflare Pages edit, Account Workers Scripts edit, Account Workers KV Storage edit, Account D1 edit, Account Queues edit, Zone DNS edit, Workers AI Read, and Workers AI Edit for model execution. If TREESEED_COMMIT_AI_GATEWAY_ID is configured, also grant AI Gateway Read/Run access for the gateway. Then paste it here as CLOUDFLARE_API_TOKEN."
94
94
  sensitivity: secret
95
95
  targets:
96
96
  - local-runtime
97
97
  - github-secret
98
98
  scopes:
99
+ - local
99
100
  - staging
100
101
  - prod
102
+ storage: shared
101
103
  requirement: required
102
104
  purposes:
103
105
  - save
@@ -163,7 +165,7 @@ entries:
163
165
  CLOUDFLARE_ACCOUNT_ID:
164
166
  label: Cloudflare account ID
165
167
  group: cloudflare
166
- description: Identifies the Cloudflare account Treeseed should provision and deploy into.
168
+ description: Identifies the Cloudflare account Treeseed should provision, deploy into, and use for Workers AI commit message generation.
167
169
  howToGet: In the Cloudflare dashboard, open Workers & Pages or Account Home and copy the account ID.
168
170
  sensitivity: plain
169
171
  targets:
@@ -171,8 +173,10 @@ entries:
171
173
  - github-variable
172
174
  - config-file
173
175
  scopes:
176
+ - local
174
177
  - staging
175
178
  - prod
179
+ storage: shared
176
180
  requirement: required
177
181
  purposes:
178
182
  - save
@@ -5,17 +5,17 @@ const packageRoot = resolve(fileURLToPath(new URL('..', import.meta.url)));
5
5
  const packageJsonPath = resolve(packageRoot, 'package.json');
6
6
  const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf8'));
7
7
  const packageVersion = packageJson.version;
8
- const legacyPrefix = 'treeseed-core-v';
9
8
  const tagName = process.argv[2] || process.env.GITHUB_REF_NAME;
10
9
  if (!tagName) {
11
10
  console.error('Release tag validation requires a tag name argument or GITHUB_REF_NAME.');
12
11
  process.exit(1);
13
12
  }
14
- const taggedVersion = tagName.startsWith(legacyPrefix)
15
- ? tagName.slice(legacyPrefix.length)
16
- : tagName;
17
- if (taggedVersion !== packageVersion) {
18
- console.error(`Release tag version "${taggedVersion}" does not match @treeseed/core version "${packageVersion}".`);
13
+ if (!/^\d+\.\d+\.\d+$/.test(tagName)) {
14
+ console.error(`Release tag "${tagName}" must use plain semver format "x.y.z".`);
15
+ process.exit(1);
16
+ }
17
+ if (tagName !== packageVersion) {
18
+ console.error(`Release tag version "${tagName}" does not match @treeseed/core version "${packageVersion}".`);
19
19
  process.exit(1);
20
20
  }
21
21
  console.log(`Release tag "${tagName}" matches @treeseed/core version "${packageVersion}".`);
@@ -3,6 +3,11 @@ import { resolve } from 'node:path';
3
3
  import { fileURLToPath } from 'node:url';
4
4
  const packageRoot = resolve(fileURLToPath(new URL('..', import.meta.url)));
5
5
  const extraArgs = process.argv.slice(2);
6
+ const tagName = process.env.GITHUB_REF_NAME;
7
+ if (tagName && !/^\d+\.\d+\.\d+$/.test(tagName)) {
8
+ console.error(`Refusing to publish @treeseed/core from non-stable tag "${tagName}".`);
9
+ process.exit(1);
10
+ }
6
11
  const npmArgs = ['publish', '.', '--access', 'public'];
7
12
  if (process.env.GITHUB_ACTIONS === 'true') {
8
13
  npmArgs.push('--provenance');
@@ -2,6 +2,7 @@ import { existsSync, mkdirSync, rmSync, symlinkSync } from 'node:fs';
2
2
  import { spawnSync } from 'node:child_process';
3
3
  import { dirname, resolve } from 'node:path';
4
4
  import { createRequire } from 'node:module';
5
+ import { tmpdir } from 'node:os';
5
6
  import { fixtureRoot, packageRoot } from './paths.js';
6
7
  const [command, ...rest] = process.argv.slice(2);
7
8
  const require = createRequire(import.meta.url);
@@ -61,7 +62,9 @@ const result = spawnSync('npx', ['astro', command, '--root', fixtureRoot, ...res
61
62
  stdio: 'inherit',
62
63
  env: {
63
64
  ...process.env,
65
+ ASTRO_TELEMETRY_DISABLED: process.env.ASTRO_TELEMETRY_DISABLED ?? '1',
64
66
  TREESEED_TENANT_ROOT: fixtureRoot,
67
+ XDG_CONFIG_HOME: process.env.XDG_CONFIG_HOME ?? resolve(tmpdir(), 'treeseed-core-xdg-config'),
65
68
  },
66
69
  shell: process.platform === 'win32',
67
70
  });
@@ -79,7 +79,22 @@ function resolveTreeseedRuntimeDependencyRoot(packageName, searchRoots = [packag
79
79
  }
80
80
  }
81
81
  function resolveInstalledPackageRoot(packageName, searchRoots) {
82
- let resolvedEntry = require.resolve(packageName, { paths: searchRoots });
82
+ const packageParts = packageName.split('/');
83
+ for (const searchRoot of searchRoots) {
84
+ let current = searchRoot;
85
+ while (true) {
86
+ const candidate = resolve(current, 'node_modules', ...packageParts, 'package.json');
87
+ if (existsSync(candidate)) {
88
+ return dirname(candidate);
89
+ }
90
+ const parent = dirname(current);
91
+ if (parent === current) {
92
+ break;
93
+ }
94
+ current = parent;
95
+ }
96
+ }
97
+ const resolvedEntry = require.resolve(packageName, { paths: searchRoots });
83
98
  let current = dirname(resolvedEntry);
84
99
  while (true) {
85
100
  const packageJsonPath = resolve(current, 'package.json');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@treeseed/core",
3
- "version": "0.6.9",
3
+ "version": "0.6.10",
4
4
  "description": "Treeseed integrated platform starter for Astro/Starlight web runtimes and Hono API runtimes.",
5
5
  "license": "AGPL-3.0-only",
6
6
  "repository": {
@@ -37,6 +37,7 @@
37
37
  "setup": "npm install",
38
38
  "setup:ci": "npm ci",
39
39
  "build:dist": "node ./scripts/run-ts.mjs ./scripts/build-dist.ts",
40
+ "prepare": "node ./scripts/prepare.mjs",
40
41
  "prepack": "npm run build:dist",
41
42
  "dev": "node ./scripts/run-ts.mjs ./scripts/dev-platform.ts",
42
43
  "dev:web": "node ./scripts/run-ts.mjs ./scripts/dev-platform.ts --surface web",
@@ -75,7 +76,7 @@
75
76
  "@astrojs/sitemap": "3.7.0",
76
77
  "@astrojs/starlight": "0.37.6",
77
78
  "@tailwindcss/vite": "^4.1.4",
78
- "@treeseed/sdk": "^0.6.7",
79
+ "@treeseed/sdk": "0.6.8",
79
80
  "astro": "^5.6.1",
80
81
  "esbuild": "^0.28.0",
81
82
  "hono": "^4.8.2",
@@ -142,8 +142,13 @@ jobs:
142
142
  cache: npm
143
143
  cache-dependency-path: __CACHE_DEPENDENCY_PATH__
144
144
 
145
+ - name: Prepare deployment install manifest
146
+ shell: bash
147
+ run: |
148
+ node --input-type=module -e "import { readFileSync, writeFileSync } from 'node:fs'; const path = 'package.json'; const pkg = JSON.parse(readFileSync(path, 'utf8')); if (pkg.workspaces) { delete pkg.workspaces; writeFileSync(path, JSON.stringify(pkg, null, 2) + '\n'); console.log('Suppressed root workspaces for deployment install.'); }"
149
+
145
150
  - name: Install dependencies
146
- run: npm ci
151
+ run: npm ci --ignore-scripts
147
152
 
148
153
  - name: Verify workspace
149
154
  shell: bash
@@ -228,8 +233,13 @@ __WORKING_DIRECTORY_BLOCK__
228
233
  cache: npm
229
234
  cache-dependency-path: __CACHE_DEPENDENCY_PATH__
230
235
 
236
+ - name: Prepare deployment install manifest
237
+ shell: bash
238
+ run: |
239
+ node --input-type=module -e "import { readFileSync, writeFileSync } from 'node:fs'; const path = 'package.json'; const pkg = JSON.parse(readFileSync(path, 'utf8')); if (pkg.workspaces) { delete pkg.workspaces; writeFileSync(path, JSON.stringify(pkg, null, 2) + '\n'); console.log('Suppressed root workspaces for deployment install.'); }"
240
+
231
241
  - name: Install dependencies
232
- run: npm ci
242
+ run: npm ci --ignore-scripts
233
243
 
234
244
  - name: Provision Treeseed platform
235
245
  shell: bash
@@ -312,8 +322,13 @@ __WORKING_DIRECTORY_BLOCK__
312
322
  cache: npm
313
323
  cache-dependency-path: __CACHE_DEPENDENCY_PATH__
314
324
 
325
+ - name: Prepare deployment install manifest
326
+ shell: bash
327
+ run: |
328
+ node --input-type=module -e "import { readFileSync, writeFileSync } from 'node:fs'; const path = 'package.json'; const pkg = JSON.parse(readFileSync(path, 'utf8')); if (pkg.workspaces) { delete pkg.workspaces; writeFileSync(path, JSON.stringify(pkg, null, 2) + '\n'); console.log('Suppressed root workspaces for deployment install.'); }"
329
+
315
330
  - name: Install dependencies
316
- run: npm ci
331
+ run: npm ci --ignore-scripts
317
332
 
318
333
  - name: Deploy Treeseed platform
319
334
  shell: bash
@@ -387,8 +402,13 @@ __WORKING_DIRECTORY_BLOCK__
387
402
  cache: npm
388
403
  cache-dependency-path: __CACHE_DEPENDENCY_PATH__
389
404
 
405
+ - name: Prepare deployment install manifest
406
+ shell: bash
407
+ run: |
408
+ node --input-type=module -e "import { readFileSync, writeFileSync } from 'node:fs'; const path = 'package.json'; const pkg = JSON.parse(readFileSync(path, 'utf8')); if (pkg.workspaces) { delete pkg.workspaces; writeFileSync(path, JSON.stringify(pkg, null, 2) + '\n'); console.log('Suppressed root workspaces for deployment install.'); }"
409
+
390
410
  - name: Install dependencies
391
- run: npm ci
411
+ run: npm ci --ignore-scripts
392
412
 
393
413
  - name: Publish Treeseed content
394
414
  shell: bash
@@ -442,8 +462,13 @@ __WORKING_DIRECTORY_BLOCK__
442
462
  cache: npm
443
463
  cache-dependency-path: __CACHE_DEPENDENCY_PATH__
444
464
 
465
+ - name: Prepare deployment install manifest
466
+ shell: bash
467
+ run: |
468
+ node --input-type=module -e "import { readFileSync, writeFileSync } from 'node:fs'; const path = 'package.json'; const pkg = JSON.parse(readFileSync(path, 'utf8')); if (pkg.workspaces) { delete pkg.workspaces; writeFileSync(path, JSON.stringify(pkg, null, 2) + '\n'); console.log('Suppressed root workspaces for deployment install.'); }"
469
+
445
470
  - name: Install dependencies
446
- run: npm ci
471
+ run: npm ci --ignore-scripts
447
472
 
448
473
  - name: Report Treeseed deployment state
449
474
  shell: bash