@treeseed/sdk 0.6.7 → 0.6.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.
Files changed (49) hide show
  1. package/dist/copilot.d.ts +15 -0
  2. package/dist/copilot.js +75 -0
  3. package/dist/index.d.ts +2 -0
  4. package/dist/index.js +18 -0
  5. package/dist/managed-dependencies.d.ts +56 -0
  6. package/dist/managed-dependencies.js +668 -0
  7. package/dist/operations/providers/default.js +30 -1
  8. package/dist/operations/services/commit-message-provider.d.ts +33 -0
  9. package/dist/operations/services/commit-message-provider.js +319 -0
  10. package/dist/operations/services/config-runtime.js +50 -23
  11. package/dist/operations/services/git-remote-policy.d.ts +9 -0
  12. package/dist/operations/services/git-remote-policy.js +55 -0
  13. package/dist/operations/services/git-workflow.js +22 -3
  14. package/dist/operations/services/github-api.js +9 -4
  15. package/dist/operations/services/knowledge-coop-launch.js +4 -0
  16. package/dist/operations/services/local-dev.js +7 -2
  17. package/dist/operations/services/package-reference-policy.d.ts +70 -0
  18. package/dist/operations/services/package-reference-policy.js +330 -0
  19. package/dist/operations/services/project-platform.d.ts +4 -0
  20. package/dist/operations/services/project-platform.js +28 -4
  21. package/dist/operations/services/railway-deploy.d.ts +4 -1
  22. package/dist/operations/services/railway-deploy.js +76 -38
  23. package/dist/operations/services/repository-save-orchestrator.d.ts +172 -0
  24. package/dist/operations/services/repository-save-orchestrator.js +1462 -0
  25. package/dist/operations/services/workspace-dependency-mode.d.ts +70 -0
  26. package/dist/operations/services/workspace-dependency-mode.js +404 -0
  27. package/dist/operations/services/workspace-preflight.js +5 -0
  28. package/dist/operations/services/workspace-save.js +10 -6
  29. package/dist/operations-registry.js +5 -0
  30. package/dist/operations-types.d.ts +1 -0
  31. package/dist/platform/books-data.js +4 -1
  32. package/dist/platform/env.yaml +6 -3
  33. package/dist/reconcile/builtin-adapters.js +37 -7
  34. package/dist/scripts/cleanup-markdown.js +4 -0
  35. package/dist/scripts/prepare.js +14 -0
  36. package/dist/scripts/publish-package.js +5 -0
  37. package/dist/scripts/tenant-workflow-action.js +11 -2
  38. package/dist/verification.js +46 -13
  39. package/dist/workflow/operations.d.ts +381 -55
  40. package/dist/workflow/operations.js +725 -261
  41. package/dist/workflow-state.d.ts +40 -1
  42. package/dist/workflow-state.js +220 -17
  43. package/dist/workflow-support.d.ts +3 -0
  44. package/dist/workflow-support.js +34 -0
  45. package/dist/workflow.d.ts +19 -3
  46. package/dist/workflow.js +3 -3
  47. package/dist/wrangler-d1.js +6 -1
  48. package/package.json +17 -1
  49. package/templates/github/deploy.workflow.yml +59 -14
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@treeseed/sdk",
3
- "version": "0.6.7",
3
+ "version": "0.6.9",
4
4
  "description": "Shared Treeseed SDK for content-backed and D1-backed object models.",
5
5
  "license": "AGPL-3.0-only",
6
6
  "repository": {
@@ -34,6 +34,7 @@
34
34
  "setup:ci": "npm ci",
35
35
  "build": "npm run build:dist",
36
36
  "build:dist": "node ./scripts/run-ts.mjs ./scripts/build-dist.ts",
37
+ "prepare": "node ./scripts/prepare.mjs",
37
38
  "prepack": "npm run build:dist",
38
39
  "test": "npm run test:unit",
39
40
  "test:unit": "vitest run --config ./vitest.config.ts",
@@ -51,7 +52,12 @@
51
52
  "release:publish": "node ./scripts/run-ts.mjs ./scripts/publish-package.ts"
52
53
  },
53
54
  "dependencies": {
55
+ "@github/copilot": "1.0.39",
56
+ "@github/copilot-language-server": "1.480.0",
57
+ "@github/copilot-sdk": "0.3.0",
58
+ "@railway/cli": "4.44.0",
54
59
  "esbuild": "^0.28.0",
60
+ "extract-zip": "2.0.1",
55
61
  "github-slugger": "^2.0.0",
56
62
  "ink": "^7.0.0",
57
63
  "libsodium-wrappers": "^0.7.15",
@@ -62,8 +68,10 @@
62
68
  "remark-mdx": "^3.1.1",
63
69
  "remark-parse": "^11.0.0",
64
70
  "repomix": "^1.13.1",
71
+ "tar": "7.5.13",
65
72
  "typescript": "^5.9.3",
66
73
  "unified": "^11.0.5",
74
+ "wrangler": "4.86.0",
67
75
  "yaml": "^2.8.1"
68
76
  },
69
77
  "devDependencies": {
@@ -188,6 +196,14 @@
188
196
  "types": "./dist/cli-tools.d.ts",
189
197
  "default": "./dist/cli-tools.js"
190
198
  },
199
+ "./managed-dependencies": {
200
+ "types": "./dist/managed-dependencies.d.ts",
201
+ "default": "./dist/managed-dependencies.js"
202
+ },
203
+ "./copilot": {
204
+ "types": "./dist/copilot.d.ts",
205
+ "default": "./dist/copilot.js"
206
+ },
191
207
  "./types": {
192
208
  "types": "./dist/sdk-types.d.ts",
193
209
  "default": "./dist/sdk-types.js"
@@ -139,6 +139,8 @@ jobs:
139
139
  steps:
140
140
  - name: Checkout
141
141
  uses: actions/checkout@v4
142
+ with:
143
+ submodules: recursive
142
144
 
143
145
  - name: Setup Node
144
146
  uses: actions/setup-node@v4
@@ -148,7 +150,14 @@ jobs:
148
150
  cache-dependency-path: __CACHE_DEPENDENCY_PATH__
149
151
 
150
152
  - name: Install dependencies
151
- run: npm ci
153
+ run: |
154
+ node -e "const fs = require('fs'); for (const file of ['packages/sdk/package.json', 'packages/core/package.json', 'packages/cli/package.json']) { if (!fs.existsSync(file)) continue; const p = JSON.parse(fs.readFileSync(file, 'utf8')); if (p.scripts) delete p.scripts.prepare; fs.writeFileSync(file, JSON.stringify(p, null, '\t') + '\n'); }"
155
+ npm ci
156
+ for dir in packages/sdk packages/core packages/cli; do
157
+ if test -d "${dir}/.git" || git -C "${dir}" rev-parse --git-dir >/dev/null 2>&1; then
158
+ git -C "${dir}" checkout -- package.json
159
+ fi
160
+ done
152
161
 
153
162
  - name: Verify workspace
154
163
  shell: bash
@@ -250,6 +259,8 @@ __WORKING_DIRECTORY_BLOCK__
250
259
  steps:
251
260
  - name: Checkout
252
261
  uses: actions/checkout@v4
262
+ with:
263
+ submodules: recursive
253
264
 
254
265
  - name: Setup Node
255
266
  uses: actions/setup-node@v4
@@ -259,7 +270,17 @@ __WORKING_DIRECTORY_BLOCK__
259
270
  cache-dependency-path: __CACHE_DEPENDENCY_PATH__
260
271
 
261
272
  - name: Install dependencies
262
- run: npm ci
273
+ run: |
274
+ node -e "const fs = require('fs'); for (const file of ['packages/sdk/package.json', 'packages/core/package.json', 'packages/cli/package.json']) { if (!fs.existsSync(file)) continue; const p = JSON.parse(fs.readFileSync(file, 'utf8')); if (p.scripts) delete p.scripts.prepare; fs.writeFileSync(file, JSON.stringify(p, null, '\t') + '\n'); }"
275
+ npm ci
276
+ for dir in packages/sdk packages/core packages/cli; do
277
+ if test -d "${dir}/.git" || git -C "${dir}" rev-parse --git-dir >/dev/null 2>&1; then
278
+ git -C "${dir}" checkout -- package.json
279
+ fi
280
+ done
281
+
282
+ - name: Install Railway CLI
283
+ run: npm install -g @railway/cli
263
284
 
264
285
  - name: Provision Treeseed platform
265
286
  shell: bash
@@ -269,7 +290,7 @@ __TENANT_WORKFLOW_ACTION_COMMAND_BLOCK__
269
290
  - name: Ensure Treeseed deployment state
270
291
  shell: bash
271
292
  run: |
272
- node --input-type=module -e "import { dirname } from 'node:path'; import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs'; const scope = process.env.TREESEED_WORKFLOW_ENVIRONMENT || 'staging'; const filePath = '.treeseed/state/' + scope + '/deploy.json'; const now = new Date().toISOString(); let state = {}; if (existsSync(filePath)) { state = JSON.parse(readFileSync(filePath, 'utf8')); } state.target = state.target || { kind: 'persistent', scope }; state.readiness = { ...(state.readiness || {}), initialized: true, configured: true, phase: state.readiness?.phase || 'config_complete', initializedAt: state.readiness?.initializedAt || now, lastValidatedAt: now, blockers: state.readiness?.blockers || [], warnings: state.readiness?.warnings || [] }; mkdirSync(dirname(filePath), { recursive: true }); writeFileSync(filePath, JSON.stringify(state, null, 2) + '\n');"
293
+ node --input-type=module -e "import { existsSync, readFileSync, writeFileSync } from 'node:fs'; const scope = process.env.TREESEED_WORKFLOW_ENVIRONMENT || 'staging'; const filePath = '.treeseed/state/environments/' + scope + '/deploy.json'; if (!existsSync(filePath)) { throw new Error('Provision did not write deployment state at ' + filePath); } const state = JSON.parse(readFileSync(filePath, 'utf8')); const dbId = state?.d1Databases?.SITE_DATA_DB?.databaseId; if (!dbId || String(dbId).startsWith('dryrun-')) { throw new Error('Provision deployment state is missing a live D1 database id.'); } const now = new Date().toISOString(); state.target = state.target || { kind: 'persistent', scope }; state.readiness = { ...(state.readiness || {}), initialized: true, configured: true, phase: state.readiness?.phase || 'config_complete', initializedAt: state.readiness?.initializedAt || now, lastValidatedAt: now, blockers: state.readiness?.blockers || [], warnings: state.readiness?.warnings || [] }; writeFileSync(filePath, JSON.stringify(state, null, 2) + '\n');"
273
294
 
274
295
  - name: Upload Treeseed deployment state
275
296
  if: always()
@@ -367,14 +388,7 @@ __WORKING_DIRECTORY_BLOCK__
367
388
  - name: Checkout
368
389
  uses: actions/checkout@v4
369
390
  with:
370
- submodules: false
371
- sparse-checkout: |
372
- /*
373
- !/src/content/
374
- !/src/content/**
375
- !/public/books/
376
- !/public/books/**
377
- sparse-checkout-cone-mode: false
391
+ submodules: recursive
378
392
 
379
393
  - name: Setup Node
380
394
  uses: actions/setup-node@v4
@@ -384,7 +398,17 @@ __WORKING_DIRECTORY_BLOCK__
384
398
  cache-dependency-path: __CACHE_DEPENDENCY_PATH__
385
399
 
386
400
  - name: Install dependencies
387
- run: npm ci
401
+ run: |
402
+ node -e "const fs = require('fs'); for (const file of ['packages/sdk/package.json', 'packages/core/package.json', 'packages/cli/package.json']) { if (!fs.existsSync(file)) continue; const p = JSON.parse(fs.readFileSync(file, 'utf8')); if (p.scripts) delete p.scripts.prepare; fs.writeFileSync(file, JSON.stringify(p, null, '\t') + '\n'); }"
403
+ npm ci
404
+ for dir in packages/sdk packages/core packages/cli; do
405
+ if test -d "${dir}/.git" || git -C "${dir}" rev-parse --git-dir >/dev/null 2>&1; then
406
+ git -C "${dir}" checkout -- package.json
407
+ fi
408
+ done
409
+
410
+ - name: Install Railway CLI
411
+ run: npm install -g @railway/cli
388
412
 
389
413
  - name: Download Treeseed deployment state
390
414
  uses: actions/download-artifact@v4
@@ -483,6 +507,8 @@ __WORKING_DIRECTORY_BLOCK__
483
507
  steps:
484
508
  - name: Checkout
485
509
  uses: actions/checkout@v4
510
+ with:
511
+ submodules: recursive
486
512
 
487
513
  - name: Setup Node
488
514
  uses: actions/setup-node@v4
@@ -492,7 +518,17 @@ __WORKING_DIRECTORY_BLOCK__
492
518
  cache-dependency-path: __CACHE_DEPENDENCY_PATH__
493
519
 
494
520
  - name: Install dependencies
495
- run: npm ci
521
+ run: |
522
+ node -e "const fs = require('fs'); for (const file of ['packages/sdk/package.json', 'packages/core/package.json', 'packages/cli/package.json']) { if (!fs.existsSync(file)) continue; const p = JSON.parse(fs.readFileSync(file, 'utf8')); if (p.scripts) delete p.scripts.prepare; fs.writeFileSync(file, JSON.stringify(p, null, '\t') + '\n'); }"
523
+ npm ci
524
+ for dir in packages/sdk packages/core packages/cli; do
525
+ if test -d "${dir}/.git" || git -C "${dir}" rev-parse --git-dir >/dev/null 2>&1; then
526
+ git -C "${dir}" checkout -- package.json
527
+ fi
528
+ done
529
+
530
+ - name: Install Railway CLI
531
+ run: npm install -g @railway/cli
496
532
 
497
533
  - name: Download Treeseed deployment state
498
534
  uses: actions/download-artifact@v4
@@ -571,6 +607,8 @@ __WORKING_DIRECTORY_BLOCK__
571
607
  steps:
572
608
  - name: Checkout
573
609
  uses: actions/checkout@v4
610
+ with:
611
+ submodules: recursive
574
612
 
575
613
  - name: Setup Node
576
614
  uses: actions/setup-node@v4
@@ -580,7 +618,14 @@ __WORKING_DIRECTORY_BLOCK__
580
618
  cache-dependency-path: __CACHE_DEPENDENCY_PATH__
581
619
 
582
620
  - name: Install dependencies
583
- run: npm ci
621
+ run: |
622
+ node -e "const fs = require('fs'); for (const file of ['packages/sdk/package.json', 'packages/core/package.json', 'packages/cli/package.json']) { if (!fs.existsSync(file)) continue; const p = JSON.parse(fs.readFileSync(file, 'utf8')); if (p.scripts) delete p.scripts.prepare; fs.writeFileSync(file, JSON.stringify(p, null, '\t') + '\n'); }"
623
+ npm ci
624
+ for dir in packages/sdk packages/core packages/cli; do
625
+ if test -d "${dir}/.git" || git -C "${dir}" rev-parse --git-dir >/dev/null 2>&1; then
626
+ git -C "${dir}" checkout -- package.json
627
+ fi
628
+ done
584
629
 
585
630
  - name: Download Treeseed deployment state
586
631
  uses: actions/download-artifact@v4