@treeseed/core 0.10.22 → 0.11.0

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 (108) hide show
  1. package/README.md +69 -125
  2. package/dist/dev-watch.js +2 -1
  3. package/dist/dev.d.ts +1 -1
  4. package/dist/dev.js +51 -35
  5. package/dist/pages/404.astro +1 -1
  6. package/dist/pages/[slug].astro +4 -4
  7. package/dist/pages/agents/[slug].astro +3 -3
  8. package/dist/pages/agents/index.astro +3 -3
  9. package/dist/pages/books/[slug].astro +3 -3
  10. package/dist/pages/books/index.astro +3 -3
  11. package/dist/pages/contact.astro +2 -2
  12. package/dist/pages/decisions/[slug].astro +3 -3
  13. package/dist/pages/decisions/index.astro +3 -3
  14. package/dist/pages/docs-runtime/[...slug].astro +3 -3
  15. package/dist/pages/docs-runtime/index.astro +3 -3
  16. package/dist/pages/index.astro +11 -11
  17. package/dist/pages/notes/[slug].astro +3 -3
  18. package/dist/pages/notes/index.astro +3 -3
  19. package/dist/pages/objectives/[slug].astro +3 -3
  20. package/dist/pages/objectives/index.astro +3 -3
  21. package/dist/pages/people/[slug].astro +3 -3
  22. package/dist/pages/people/index.astro +3 -3
  23. package/dist/pages/proposals/[slug].astro +3 -3
  24. package/dist/pages/proposals/index.astro +3 -3
  25. package/dist/pages/questions/[slug].astro +3 -3
  26. package/dist/pages/questions/index.astro +3 -3
  27. package/dist/pages/ui/index.astro +23 -23
  28. package/dist/platform-resources.js +5 -1
  29. package/dist/scripts/build-dist.js +2 -0
  30. package/dist/scripts/release-verify.js +24 -2
  31. package/dist/scripts/workspace-bootstrap.js +3 -0
  32. package/dist/site.js +49 -11
  33. package/dist/styles/global.css +5 -5
  34. package/package.json +3 -45
  35. package/templates/github/deploy-web.workflow.yml +36 -2
  36. package/dist/components/DevWatchReload.astro +0 -45
  37. package/dist/components/SiteTitle.astro +0 -51
  38. package/dist/components/content/ContentStatusLegend.astro +0 -18
  39. package/dist/components/content/StatusBadge.astro +0 -11
  40. package/dist/components/docs/BookFontControls.astro +0 -180
  41. package/dist/components/docs/DesktopSidebarToggle.astro +0 -88
  42. package/dist/components/docs/DownloadBook.astro +0 -34
  43. package/dist/components/docs/Footer.astro +0 -112
  44. package/dist/components/docs/Header.astro +0 -157
  45. package/dist/components/docs/PageFrame.astro +0 -260
  46. package/dist/components/docs/PageSidebar.astro +0 -63
  47. package/dist/components/docs/PageTitle.astro +0 -39
  48. package/dist/components/docs/Sidebar.astro +0 -41
  49. package/dist/components/docs/ThemeSelect.astro +0 -5
  50. package/dist/components/forms/ContactForm.astro +0 -233
  51. package/dist/components/forms/FooterSubscribeForm.astro +0 -188
  52. package/dist/components/site/BookList.astro +0 -27
  53. package/dist/components/site/CTASection.astro +0 -24
  54. package/dist/components/site/ChronicleList.astro +0 -33
  55. package/dist/components/site/Hero.astro +0 -18
  56. package/dist/components/site/NotesList.astro +0 -29
  57. package/dist/components/site/PathCard.astro +0 -16
  58. package/dist/components/site/ProfileList.astro +0 -30
  59. package/dist/components/site/PublishedContentBody.astro +0 -5
  60. package/dist/components/site/RouteNotFound.astro +0 -25
  61. package/dist/components/site/SectionIntro.astro +0 -9
  62. package/dist/components/site/StageBanner.astro +0 -8
  63. package/dist/components/site/TrustCallout.astro +0 -9
  64. package/dist/components/starlight.js +0 -6
  65. package/dist/components/ui/data/ActionList.astro +0 -51
  66. package/dist/components/ui/data/Badge.astro +0 -19
  67. package/dist/components/ui/data/DataTable.astro +0 -51
  68. package/dist/components/ui/data/KeyValueList.astro +0 -28
  69. package/dist/components/ui/data/MetricCard.astro +0 -25
  70. package/dist/components/ui/data/MetricGrid.astro +0 -27
  71. package/dist/components/ui/data/StatusPill.astro +0 -20
  72. package/dist/components/ui/forms/Button.astro +0 -59
  73. package/dist/components/ui/forms/Field.astro +0 -39
  74. package/dist/components/ui/forms/FormActions.astro +0 -12
  75. package/dist/components/ui/forms/PasswordMeter.astro +0 -80
  76. package/dist/components/ui/forms/RadioGroup.astro +0 -55
  77. package/dist/components/ui/forms/Select.astro +0 -47
  78. package/dist/components/ui/forms/TextInput.astro +0 -58
  79. package/dist/components/ui/forms/Textarea.astro +0 -45
  80. package/dist/components/ui/layout/PageHeader.astro +0 -45
  81. package/dist/components/ui/shell/AppShell.astro +0 -130
  82. package/dist/components/ui/shell/BottomNav.astro +0 -42
  83. package/dist/components/ui/shell/ProjectHeader.astro +0 -66
  84. package/dist/components/ui/shell/PublicFooter.astro +0 -39
  85. package/dist/components/ui/shell/PublicShell.astro +0 -184
  86. package/dist/components/ui/shell/RailNav.astro +0 -42
  87. package/dist/components/ui/shell/ShellIconLink.astro +0 -30
  88. package/dist/components/ui/shell/TopBar.astro +0 -52
  89. package/dist/components/ui/surface/Card.astro +0 -46
  90. package/dist/components/ui/surface/EmptyState.astro +0 -45
  91. package/dist/components/ui/surface/Panel.astro +0 -54
  92. package/dist/components/ui/theme/ThemeMenu.astro +0 -58
  93. package/dist/components/ui/theme/ThemePreviewSwatch.astro +0 -18
  94. package/dist/components/ui/theme/ThemeScript.astro +0 -112
  95. package/dist/components/ui/theme/ThemeSelector.astro +0 -202
  96. package/dist/components/ui/types.js +0 -0
  97. package/dist/layouts/AuthoredEntryLayout.astro +0 -195
  98. package/dist/layouts/BookLayout.astro +0 -35
  99. package/dist/layouts/BridgeLayout.astro +0 -11
  100. package/dist/layouts/ContentLayout.astro +0 -24
  101. package/dist/layouts/MainLayout.astro +0 -76
  102. package/dist/layouts/NoteLayout.astro +0 -26
  103. package/dist/layouts/ProfileLayout.astro +0 -85
  104. package/dist/styles/app-shell.css +0 -626
  105. package/dist/styles/forms.css +0 -274
  106. package/dist/styles/theme.css +0 -198
  107. package/dist/styles/tokens.css +0 -65
  108. package/dist/styles/ui.css +0 -551
package/README.md CHANGED
@@ -1,79 +1,45 @@
1
1
  # @treeseed/core
2
2
 
3
- `@treeseed/core` is the Treeseed web framework package for Astro/Starlight sites. It contains the published web runtime, tenant site configuration, shared components and styles, the knowledge-factory content model, and the forms stack used by Treeseed tenants.
3
+ `@treeseed/core` is the Treeseed web runtime for Astro/Starlight sites. Use it when you want a Treeseed-compatible site that can load tenant configuration, compose package plugins, render content, run local development, and participate in Treeseed web hosting workflows.
4
4
 
5
- Backend API, agent runtime, manager, worker, and workday processing services are owned by `@treeseed/agent`.
5
+ Core is not the admin portal and is not the reusable component library. `@treeseed/admin` contributes admin routes, and `@treeseed/ui` contributes layout-down components and styles.
6
6
 
7
- This repository is the package root. Run package commands from [`core`](./), not from the top-level `treeseed` workspace.
7
+ ## What You Can Build With Core
8
8
 
9
- ## Requirements
10
-
11
- - Node `>=22`
12
- - npm `>=10`
9
+ - Treeseed-compatible Astro/Starlight sites
10
+ - host applications that layer packages through `treeseed.site.yaml`
11
+ - local development sessions through `trsd dev`
12
+ - web-only Cloudflare hosting surfaces
13
+ - content and site runtime integration for Treeseed tenants
13
14
 
14
15
  ## Install
15
16
 
16
- For package contributors:
17
-
18
17
  ```bash
19
- git submodule update --init --recursive
20
- npm install
18
+ npm install @treeseed/core @treeseed/sdk @treeseed/ui
21
19
  ```
22
20
 
23
- This creates `package-lock.json`, installs dependencies, and runs the package `prepare` step to build `dist/`.
24
-
25
- For CI or any fresh reproducible checkout:
21
+ For package development from this repository:
26
22
 
27
23
  ```bash
28
- npm ci
24
+ npm install
25
+ npm run verify:local
29
26
  ```
30
27
 
31
- ## Package Layout
32
-
33
- - `src/`: package source
34
- - `scripts/`: build, release, and verification scripts
35
- - `test/`: unit tests run by Vitest
36
- - `.fixtures/treeseed-fixtures/`: pinned shared fixtures submodule
37
- - `.github/workflows/`: CI and publish workflows for this package repo
38
- - `templates/github/deploy-web.workflow.yml`: downstream tenant web deploy workflow template
39
-
40
- The package builds directly against the canonical shared working-site fixture in `treeseed-fixtures`.
41
-
42
- ## Shared Fixture Usage
43
-
44
- `@treeseed/core` validates itself against the integrated shared fixture, not a Core-specific fork.
45
-
46
- That means the fixture may reference package surfaces owned by `sdk`, `core`, and `cli`, and isolated Core verification links the real local `core` package into the shared fixture instead of maintaining a separate agent package boundary.
47
-
48
- ## Commands
28
+ ## Use Core In A Site
49
29
 
50
- ### Core development
30
+ A host site declares plugins in `treeseed.site.yaml`:
51
31
 
52
- ```bash
53
- npm run dev
54
- npm run dev:web
55
- npm run fixtures:check
56
- npm run build:dist
57
- npm run test:unit
58
- npm run check
59
- npm run build
60
- npm run test:smoke
32
+ ```yaml
33
+ plugins:
34
+ - package: "@treeseed/core/plugin-default"
35
+ - package: "@treeseed/admin/plugin"
61
36
  ```
62
37
 
63
- What they do:
64
-
65
- - `dev`: starts the Astro UI local runtime from `core`
66
- - `dev:web`: starts only the Astro UI dev surface through the `core` runtime
67
- - `fixtures:check`: verifies that the pinned shared fixture is initialized and usable
68
- - `build:dist`: builds the publishable `dist/` package output
69
- - `test:unit`: runs package unit tests with Vitest
70
- - `check`: runs `astro check` against the internal fixture app
71
- - `build`: builds the internal fixture app in production-like mode
72
- - `test:smoke`: runs the packed-install smoke test
38
+ Core loads site layers, resolves routes, merges plugin hooks, and builds the Astro config used by the host app. The host app still owns deployment, tenant config, content, and branding.
73
39
 
74
- ### Integrated managed dev
40
+ ## Local Development
75
41
 
76
- The published Core runtime also owns the integrated Treeseed dev supervisor used by the installable CLI:
42
+ The installable CLI delegates local web runtime orchestration to Core:
77
43
 
78
44
  ```bash
79
45
  npx trsd dev
@@ -83,95 +49,73 @@ npx trsd dev logs --follow
83
49
  npx trsd dev stop --json
84
50
  ```
85
51
 
86
- `trsd dev` delegates to Core and runs the foreground supervisor. `trsd dev start` launches the same runtime as a worktree-scoped managed background instance, writing authoritative instance state under `.treeseed/dev/instances`, PID files under `.treeseed/dev/pids`, and logs under `.treeseed/logs`. The repository-family index under the git common dir is discovery-only and points back to those worktree-local records.
87
-
88
- Core should keep this runtime reusable by the CLI and by the root Market workspace. Do not duplicate process, port, PID, or log management in package-local callers.
89
-
90
- ### Full verification
91
-
92
- ```bash
93
- npm run verify
94
- npm run verify:local
95
- npm run verify:action
96
- ```
52
+ In the Treeseed market workspace, the web process runs from the root repo, while API and operations-runner processes run from `packages/api`.
97
53
 
98
- `npm run verify` uses the shared Treeseed SDK verify driver in auto mode.
54
+ ## How Core Fits With Other Packages
99
55
 
100
- - `npm run verify` auto-selects between local direct verification and the `gh act` workflow path
101
- - `npm run verify:local` forces local direct verification against the current repo state
102
- - `npm run verify:action` forces the isolated workflow path through `gh act`
103
- - `npm run verify:direct` is the raw package verification chain used by the driver
56
+ - `@treeseed/ui` owns reusable components and styles.
57
+ - `@treeseed/admin` owns admin routes, middleware, view models, and admin behavior.
58
+ - `@treeseed/market` hosts the concrete Treeseed public site and future ecommerce.
59
+ - `@treeseed/api` owns backend API, PostgreSQL, migrations, and operations runner.
60
+ - `@treeseed/sdk` owns reconciliation, config, workflow, graph, and shared platform contracts.
61
+ - `@treeseed/agent` owns capacity-provider runtime.
62
+ - TreeDX is consumed through SDK/API integration when repository intelligence is configured.
104
63
 
105
- The direct verification chain is:
64
+ Core should stay reusable as a web runtime package and should not duplicate admin, API, agent, or market business logic.
106
65
 
107
- 1. `npm run build:dist`
108
- 2. `npm run test:unit`
109
- 3. `npm run check`
110
- 4. `npm run build`
111
- 5. `npm run test:smoke`
66
+ ## Package Layout
112
67
 
113
- If this command passes, the package is in the same state expected by CI and the publish workflow.
68
+ - `src/`: package source
69
+ - `scripts/`: build, release, and verification scripts
70
+ - `test/`: package tests
71
+ - `.fixtures/treeseed-fixtures/`: shared integrated fixture
72
+ - `.github/workflows/`: package CI and publish workflows
73
+ - `templates/github/deploy-web.workflow.yml`: downstream tenant web deploy workflow template
114
74
 
115
- ### Release commands
75
+ ## Commands
116
76
 
117
77
  ```bash
118
- npm run release:check-tag -- 0.0.1
119
- npm run release:publish
78
+ npm run dev
79
+ npm run dev:web
80
+ npm run fixtures:check
81
+ npm run build:dist
82
+ npm run test:unit
83
+ npm run check
84
+ npm run build
85
+ npm run test:smoke
86
+ npm run verify:local
120
87
  ```
121
88
 
122
- - `release:check-tag` validates that a git tag matches the version in [`package.json`](./package.json)
123
- - `release:publish` publishes the package to npm
124
-
125
- ## GitHub Actions
126
-
127
- This repo ships two package workflows:
128
-
129
- - [`ci.yml`](./.github/workflows/ci.yml): runs on push and pull request, installs with `npm ci`, then runs `npm run verify`
130
- - [`publish.yml`](./.github/workflows/publish.yml): runs on `workflow_dispatch` and on plain semver tags like `0.1.0`; it installs with `npm ci`, validates the tag with `release:check-tag`, runs `npm run verify`, and publishes with `NPM_TOKEN`
131
-
132
- The deploy workflow template at [`templates/github/deploy-web.workflow.yml`](./templates/github/deploy-web.workflow.yml) is for downstream Treeseed web repositories, not for publishing this package. Processing host deploy assets are owned by `@treeseed/agent`.
133
-
134
- ## Consumer Contract
135
-
136
- The package publishes built artifacts from `dist/` and exposes runtime entrypoints through [`package.json`](./package.json) `exports`.
137
-
138
- The published package includes:
139
-
140
- - `dist/`
141
- - `tsconfigs/`
142
- - `templates/`
143
- - `style/`
144
- - `utils/`
145
- - `README.md`
89
+ The direct verification chain is:
146
90
 
147
- The package currently depends on `@treeseed/sdk` plus the runtime packages needed for its web surfaces. It does not depend on `@treeseed/cli` or `@treeseed/agent`.
91
+ 1. build distributable `dist/`
92
+ 2. run unit tests
93
+ 3. run Astro check against the shared fixture
94
+ 4. build the fixture app
95
+ 5. run packed-install smoke tests
148
96
 
149
- ## Contributor Workflow
97
+ ## Shared Fixture
150
98
 
151
- Typical local workflow:
99
+ Core validates itself against the integrated shared fixture rather than a Core-specific fork. The fixture may reference SDK, Core, Admin, UI, API, CLI, and Agent surfaces where the canonical integrated project genuinely uses them. Package verification adapts to the fixture; it must not rewrite the fixture to satisfy one package.
152
100
 
153
- ```bash
154
- npm install
155
- npm run verify
156
- ```
101
+ ## GitHub Actions And Release
157
102
 
158
- If you only need one stage:
103
+ Package workflows verify and publish the package from this repository. The downstream web deploy workflow template is for host applications, not for publishing Core.
159
104
 
160
105
  ```bash
161
- npm run test:unit
162
- npm run check
163
- npm run build
106
+ npm run release:check-tag -- 0.1.0
107
+ npm run release:publish
164
108
  ```
165
109
 
166
- When changing exported package code, rerun `npm run build:dist` and then `npm run verify`.
167
-
168
- ## Publishing
110
+ The publish workflow expects `NPM_TOKEN` in the package repository GitHub `production` environment.
169
111
 
170
- Release flow for this repo:
112
+ ## What Core Does Not Own
171
113
 
172
- 1. Update the package version in [`package.json`](./package.json).
173
- 2. Run `npm run verify`.
174
- 3. Create a matching tag: `<version>` such as `0.1.0`.
175
- 4. Push the tag or run the publish workflow manually.
114
+ - reusable layout-down UI primitives; use `@treeseed/ui`
115
+ - admin routes, auth/session UI, admin middleware, or admin view models; use `@treeseed/admin`
116
+ - backend API implementation, PostgreSQL, operations runner, or migrations; use `@treeseed/api`
117
+ - capacity provider runtime; use `@treeseed/agent`
118
+ - checkout, billing, licensing, or marketplace policy; use root market/future commerce plugin
119
+ - TreeDX service implementation
176
120
 
177
- The publish workflow expects the npm auth token in `NPM_TOKEN`.
121
+ See the root [Package Ownership](../../docs/package-ownership.md) guide for the full package map.
package/dist/dev-watch.js CHANGED
@@ -85,7 +85,8 @@ function classifyChanges(changedPaths, watchEntries) {
85
85
  }
86
86
  function isTenantApiInput(filePath) {
87
87
  const normalized = filePath.split(sep).join("/");
88
- return normalized.endsWith("/treeseed.site.yaml") || normalized.endsWith("/treeseed.config.ts") || normalized.endsWith("/package.json") || normalized.endsWith("/tsconfig.json") || normalized.includes("/src/api/") || normalized.includes("/src/market-operations-runner/");
88
+ const apiPackageSource = ["", "packages", "api", "src"].join("/");
89
+ return normalized.endsWith("/treeseed.site.yaml") || normalized.endsWith("/treeseed.config.ts") || normalized.endsWith("/package.json") || normalized.endsWith("/tsconfig.json") || normalized.includes(`${apiPackageSource}/api/`) || normalized.includes(`${apiPackageSource}/operations-runner/`);
89
90
  }
90
91
  const tenantChanged = changedPaths.some(
91
92
  (filePath) => watchEntries.some((entry) => entry.kind === "tenant" && matchesEntry(filePath, entry))
package/dist/dev.d.ts CHANGED
@@ -18,7 +18,7 @@ export type TreeseedIntegratedDevFeedbackMode = 'live' | 'restart' | 'off';
18
18
  export type TreeseedIntegratedDevOpenMode = 'auto' | 'on' | 'off';
19
19
  export type TreeseedLocalRuntimeMode = 'auto' | 'provider' | 'local';
20
20
  export type TreeseedSelectedLocalRuntime = 'astro-local' | 'cloudflare-wrangler-local' | 'node-local';
21
- export type TreeseedIntegratedDevCommandId = 'web' | 'api' | 'manager' | 'worker' | 'agents' | 'market-runner';
21
+ export type TreeseedIntegratedDevCommandId = 'web' | 'api' | 'manager' | 'worker' | 'agents' | 'operations-runner';
22
22
  export type TreeseedLocalRuntimeSelection = {
23
23
  requested: TreeseedLocalRuntimeMode;
24
24
  selected: TreeseedSelectedLocalRuntime;
package/dist/dev.js CHANGED
@@ -20,6 +20,7 @@ import {
20
20
  resolveWranglerBin,
21
21
  stopKnownMailpitContainers
22
22
  } from "@treeseed/sdk/workflow-support";
23
+ import { discoverTreeseedApplications } from "@treeseed/sdk/hosting";
23
24
  import { loadTreeseedDeployConfig } from "@treeseed/sdk/platform/deploy-config";
24
25
  import {
25
26
  startPollingWatch
@@ -181,12 +182,13 @@ function webUrlFor(host, port) {
181
182
  return `http://${browserHost(host)}:${port}`;
182
183
  }
183
184
  const CANONICAL_COMMAND_IDS = ["web", "api", "manager", "worker", "agents"];
184
- const ALL_COMMAND_IDS = ["web", "api", "manager", "worker", "agents", "market-runner"];
185
- const MARKET_DEV_COMMAND_IDS = ["web", "api", "market-runner"];
185
+ const ALL_COMMAND_IDS = ["web", "api", "manager", "worker", "agents", "operations-runner"];
186
+ const MARKET_DEV_COMMAND_IDS = ["web", "api", "operations-runner"];
186
187
  function isMarketWorkspace(tenantRoot) {
187
188
  try {
188
189
  const pkg = JSON.parse(readFileSync(resolve(tenantRoot, "package.json"), "utf8"));
189
- return pkg.name === "@treeseed/market" && existsSync(resolve(tenantRoot, "src/api/server.js")) && existsSync(resolve(tenantRoot, "src/market-operations-runner/entrypoint.js"));
190
+ const apiPackageRoot = resolve(tenantRoot, "packages/api");
191
+ return pkg.name === "@treeseed/market" && existsSync(resolve(apiPackageRoot, "package.json")) && existsSync(resolve(apiPackageRoot, "src/api/server.js")) && existsSync(resolve(apiPackageRoot, "src/operations-runner/entrypoint.js"));
190
192
  } catch {
191
193
  return false;
192
194
  }
@@ -472,6 +474,13 @@ function createWatchEntries(tenantRoot, roots) {
472
474
  { kind: "cli", root: resolve(roots.cliPackageRoot, "dist", "cli", "handlers", "dev.js"), restartRequired: true }
473
475
  );
474
476
  }
477
+ try {
478
+ for (const app of discoverTreeseedApplications(tenantRoot)) {
479
+ if (app.relativeRoot === ".") continue;
480
+ entries.push({ kind: "tenant", root: app.configPath, restartRequired: true });
481
+ }
482
+ } catch {
483
+ }
475
484
  return entries;
476
485
  }
477
486
  function createSetupSteps(tenantRoot, setupMode, sdkPackageRoot, planLike, env, mailpitEnabled, usesCloudflareWebRuntime) {
@@ -488,9 +497,9 @@ function createSetupSteps(tenantRoot, setupMode, sdkPackageRoot, planLike, env,
488
497
  }
489
498
  const hasWebCommand = planLike.commands.some((command) => command.id === "web");
490
499
  const hasLocalRuntimeCommand = planLike.commands.some(
491
- (command) => command.id !== "web" && command.id !== "market-runner" && command.label !== "Treeseed Market API"
500
+ (command) => command.id !== "web" && command.id !== "operations-runner" && command.label !== "Treeseed API"
492
501
  );
493
- const hasMarketApiCommand = planLike.commands.some((command) => command.label === "Treeseed Market API");
502
+ const hasApiCommand = planLike.commands.some((command) => command.label === "Treeseed API");
494
503
  const managedMarketPostgres = env.TREESEED_MARKET_LOCAL_POSTGRES_MANAGED === "true";
495
504
  const needsCloudflareLocalRuntime = usesCloudflareWebRuntime || hasLocalRuntimeCommand;
496
505
  const coreScripts = [
@@ -508,9 +517,10 @@ function createSetupSteps(tenantRoot, setupMode, sdkPackageRoot, planLike, env,
508
517
  "dist/scripts/ensure-mailpit.js"
509
518
  );
510
519
  const dockerReady = dockerIsAvailable(env);
511
- const marketMigrateScript = existsSync(resolve(tenantRoot, "scripts/migrate-market-db.mjs")) ? {
520
+ const apiPackageRoot = resolve(tenantRoot, "packages/api");
521
+ const marketMigrateScript = existsSync(resolve(apiPackageRoot, "scripts/migrate-market-db.mjs")) ? {
512
522
  command: process.execPath,
513
- args: [resolve(tenantRoot, "scripts/migrate-market-db.mjs")]
523
+ args: [resolve(apiPackageRoot, "scripts/migrate-market-db.mjs")]
514
524
  } : null;
515
525
  const steps = [
516
526
  {
@@ -519,16 +529,16 @@ function createSetupSteps(tenantRoot, setupMode, sdkPackageRoot, planLike, env,
519
529
  required: setupMode === "auto",
520
530
  status: "planned"
521
531
  },
522
- ...hasMarketApiCommand && managedMarketPostgres ? [
532
+ ...hasApiCommand && managedMarketPostgres ? [
523
533
  {
524
534
  id: "market-postgres",
525
535
  label: "Start local Market PostgreSQL",
526
536
  required: true,
527
537
  status: dockerReady ? "planned" : "failed",
528
- detail: dockerReady ? "Treeseed will manage the local Market PostgreSQL container automatically." : "Docker daemon is unavailable; local Market API requires managed PostgreSQL."
538
+ detail: dockerReady ? "Treeseed will manage the local Market PostgreSQL container automatically." : "Docker daemon is unavailable; local API requires managed PostgreSQL."
529
539
  }
530
540
  ] : [],
531
- ...hasMarketApiCommand ? [
541
+ ...hasApiCommand ? [
532
542
  {
533
543
  id: "market-migrations",
534
544
  label: "Apply local Market database migrations",
@@ -536,7 +546,7 @@ function createSetupSteps(tenantRoot, setupMode, sdkPackageRoot, planLike, env,
536
546
  command: marketMigrateScript?.command,
537
547
  args: marketMigrateScript?.args,
538
548
  status: marketMigrateScript ? "planned" : "failed",
539
- detail: marketMigrateScript ? void 0 : "Unable to resolve scripts/migrate-market-db.mjs."
549
+ detail: marketMigrateScript ? void 0 : "Unable to resolve packages/api/scripts/migrate-market-db.mjs."
540
550
  }
541
551
  ] : [],
542
552
  {
@@ -659,13 +669,14 @@ function createAgentCommand(id, tenantRoot, agentPackageRoot, sharedEnv, apiHost
659
669
  localRuntime: nodeLocalRuntime(config.label)
660
670
  };
661
671
  }
662
- function createMarketApiCommand(tenantRoot, sharedEnv, apiHost, apiPort) {
672
+ function createApiCommand(tenantRoot, sharedEnv, apiHost, apiPort) {
673
+ const apiPackageRoot = resolve(tenantRoot, "packages/api");
663
674
  return {
664
675
  id: "api",
665
- label: "Treeseed Market API",
676
+ label: "Treeseed API",
666
677
  command: process.execPath,
667
- args: [resolve(tenantRoot, "src/api/server.js")],
668
- cwd: tenantRoot,
678
+ args: [resolve(apiPackageRoot, "src/api/server.js")],
679
+ cwd: apiPackageRoot,
669
680
  env: {
670
681
  ...sharedEnv,
671
682
  HOST: apiHost,
@@ -674,31 +685,32 @@ function createMarketApiCommand(tenantRoot, sharedEnv, apiHost, apiPort) {
674
685
  TREESEED_API_ENVIRONMENT: sharedEnv.TREESEED_API_ENVIRONMENT ?? "local",
675
686
  TREESEED_API_REQUEST_LOGS: sharedEnv.TREESEED_API_REQUEST_LOGS ?? "true"
676
687
  },
677
- localRuntime: nodeLocalRuntime("Treeseed Market API")
688
+ localRuntime: nodeLocalRuntime("Treeseed API")
678
689
  };
679
690
  }
680
691
  function createMarketOperationsRunnerCommand(tenantRoot, sharedEnv) {
692
+ const apiPackageRoot = resolve(tenantRoot, "packages/api");
681
693
  return {
682
- id: "market-runner",
683
- label: "Market Operations Runner",
694
+ id: "operations-runner",
695
+ label: "Treeseed Operations Runner",
684
696
  command: process.execPath,
685
697
  args: [
686
- "--experimental-transform-types",
687
- resolve(tenantRoot, "src/market-operations-runner/entrypoint.js"),
698
+ resolve(apiPackageRoot, "src/operations-runner/entrypoint.js"),
699
+ "run",
700
+ "--watch",
688
701
  "--market",
689
702
  "local",
690
- "--watch",
691
703
  "--operation",
692
704
  "project:web_deployment",
693
705
  "--poll-interval-ms",
694
706
  "5000"
695
707
  ],
696
- cwd: tenantRoot,
708
+ cwd: apiPackageRoot,
697
709
  env: {
698
710
  ...sharedEnv,
699
711
  TREESEED_PLATFORM_RUNNER_ENVIRONMENT: sharedEnv.TREESEED_PLATFORM_RUNNER_ENVIRONMENT ?? "local"
700
712
  },
701
- localRuntime: nodeLocalRuntime("Market Operations Runner")
713
+ localRuntime: nodeLocalRuntime("Treeseed Operations Runner")
702
714
  };
703
715
  }
704
716
  function createTreeseedIntegratedDevPlan(options = {}) {
@@ -718,7 +730,7 @@ function createTreeseedIntegratedDevPlan(options = {}) {
718
730
  const apiBaseUrl = options.apiHost != null || options.apiPort != null ? `http://${apiHost}:${apiPort}` : mergedEnv.TREESEED_API_BASE_URL?.trim() || `http://${apiHost}:${apiPort}`;
719
731
  const selectedCommandIds = selectedSurfaceCommandIds(options);
720
732
  const marketWorkspace = isMarketWorkspace(tenantRoot);
721
- const effectiveCommandIds = marketWorkspace ? MARKET_DEV_COMMAND_IDS.filter((id) => selectedCommandIds.includes(id) || id === "market-runner" && selectedCommandIds.includes("api")) : selectedCommandIds;
733
+ const effectiveCommandIds = marketWorkspace ? MARKET_DEV_COMMAND_IDS.filter((id) => selectedCommandIds.includes(id) || id === "operations-runner" && selectedCommandIds.includes("api")) : selectedCommandIds;
722
734
  const devResetId = options.reset ? String(Date.now()) : void 0;
723
735
  const webUrl = effectiveCommandIds.includes("web") ? webUrlFor(webHost, webPort) : null;
724
736
  const sdkPackageRoot = resolvePackageRoot("@treeseed/sdk", tenantRoot);
@@ -733,8 +745,8 @@ function createTreeseedIntegratedDevPlan(options = {}) {
733
745
  const resolvedHostingTeamId = teamId ?? mergedEnv.TREESEED_HOSTING_TEAM_ID;
734
746
  const resolvedTeamId = mergedEnv.TREESEED_TEAM_ID ?? resolvedHostingTeamId ?? resolveSeededLocalTeamId(localD1PersistTo, projectId ?? null);
735
747
  const marketPostgresPort = mergedEnv.TREESEED_MARKET_LOCAL_POSTGRES_PORT ?? String(TREESEED_DEFAULT_MARKET_POSTGRES_PORT);
736
- const marketDatabaseUrl = mergedEnv.TREESEED_MARKET_DATABASE_URL ?? `postgres://treeseed:treeseed@127.0.0.1:${marketPostgresPort}/market_local`;
737
- const managedMarketPostgres = marketWorkspace && isTreeseedManagedMarketPostgresUrl(marketDatabaseUrl);
748
+ const apiDatabaseUrl = mergedEnv.TREESEED_MARKET_DATABASE_URL ?? `postgres://treeseed:treeseed@127.0.0.1:${marketPostgresPort}/market_local`;
749
+ const managedMarketPostgres = marketWorkspace && isTreeseedManagedMarketPostgresUrl(apiDatabaseUrl);
738
750
  const mailpitSmtpPort = mergedEnv.TREESEED_MAILPIT_SMTP_PORT ?? String(TREESEED_DEFAULT_LOCAL_SMTP_PORT);
739
751
  const mailpitUiPort = mergedEnv.TREESEED_MAILPIT_UI_PORT ?? String(TREESEED_DEFAULT_MAILPIT_UI_PORT);
740
752
  const webEntrypoint = resolveNodeEntrypoint(
@@ -768,7 +780,7 @@ function createTreeseedIntegratedDevPlan(options = {}) {
768
780
  TREESEED_MARKET_API_BASE_URL: mergedEnv.TREESEED_MARKET_API_BASE_URL ?? apiBaseUrl,
769
781
  TREESEED_API_REQUEST_LOGS: mergedEnv.TREESEED_API_REQUEST_LOGS ?? "true",
770
782
  ...marketWorkspace ? {
771
- TREESEED_MARKET_DATABASE_URL: marketDatabaseUrl,
783
+ TREESEED_MARKET_DATABASE_URL: apiDatabaseUrl,
772
784
  TREESEED_MARKET_LOCAL_POSTGRES_CONTAINER: mergedEnv.TREESEED_MARKET_LOCAL_POSTGRES_CONTAINER ?? TREESEED_DEFAULT_MARKET_POSTGRES_CONTAINER,
773
785
  TREESEED_MARKET_LOCAL_POSTGRES_VOLUME: mergedEnv.TREESEED_MARKET_LOCAL_POSTGRES_VOLUME ?? TREESEED_DEFAULT_MARKET_POSTGRES_VOLUME,
774
786
  TREESEED_MARKET_LOCAL_POSTGRES_PORT: marketPostgresPort,
@@ -825,10 +837,10 @@ function createTreeseedIntegratedDevPlan(options = {}) {
825
837
  for (const id of effectiveCommandIds) {
826
838
  if (id === "web") continue;
827
839
  if (marketWorkspace && id === "api") {
828
- commands.push(createMarketApiCommand(tenantRoot, sharedEnv, apiHost, apiPort));
840
+ commands.push(createApiCommand(tenantRoot, sharedEnv, apiHost, apiPort));
829
841
  continue;
830
842
  }
831
- if (marketWorkspace && id === "market-runner") {
843
+ if (marketWorkspace && id === "operations-runner") {
832
844
  commands.push(createMarketOperationsRunnerCommand(tenantRoot, sharedEnv));
833
845
  continue;
834
846
  }
@@ -847,7 +859,7 @@ function createTreeseedIntegratedDevPlan(options = {}) {
847
859
  return {
848
860
  id: command.id,
849
861
  label: command.label,
850
- required: command.id === "market-runner",
862
+ required: command.id === "operations-runner",
851
863
  strategy: "process"
852
864
  };
853
865
  });
@@ -880,7 +892,7 @@ function createTreeseedIntegratedDevPlan(options = {}) {
880
892
  ...commands.some((command) => command.id === "manager") ? { manager: nodeLocalRuntime("Manager") } : {},
881
893
  ...commands.some((command) => command.id === "worker") ? { worker: nodeLocalRuntime("Worker Runner") } : {},
882
894
  ...commands.some((command) => command.id === "agents") ? { agents: nodeLocalRuntime("Agents Loop") } : {},
883
- ...commands.some((command) => command.id === "market-runner") ? { marketRunner: nodeLocalRuntime("Market Operations Runner") } : {}
895
+ ...commands.some((command) => command.id === "operations-runner") ? { marketRunner: nodeLocalRuntime("Treeseed Operations Runner") } : {}
884
896
  },
885
897
  restartPolicy: {
886
898
  initialBackoffMs: INITIAL_RESTART_BACKOFF_MS,
@@ -1324,7 +1336,7 @@ function renderDevLogJsonEventForHuman(parsed) {
1324
1336
  if (!message) {
1325
1337
  return null;
1326
1338
  }
1327
- if (surface === "[market-runner]") {
1339
+ if (surface === "[operations-runner]") {
1328
1340
  try {
1329
1341
  const runner = JSON.parse(message);
1330
1342
  if (runner.ok === true && runner.claimed === false && runner.operation == null) {
@@ -1483,6 +1495,10 @@ async function runTreeseedManagedDev(options, deps = {}) {
1483
1495
  const runtimeScope = instanceRuntimeScope(plan);
1484
1496
  const instancePath = devInstancePath(tenantRoot, runtimeScope);
1485
1497
  const logPath = plan.logPath;
1498
+ if (options.plan) {
1499
+ writePlan(plan, options, write);
1500
+ return 0;
1501
+ }
1486
1502
  const existing = readDevInstanceFile(instancePath);
1487
1503
  if (existing && evaluateDevInstance(existing, { processIsAlive }).status !== "stale" && options.force !== true) {
1488
1504
  return managedDevResult("treeseed.dev.start", true, evaluateDevInstance(existing, { processIsAlive }), options, write);
@@ -2001,7 +2017,7 @@ function attachPrefixedLogReader(child, surface, options, write) {
2001
2017
  stderr: { suppressWorkerdBrokenPipeBlock: false }
2002
2018
  };
2003
2019
  function shouldSuppressLogLine(line, name) {
2004
- if (!options.json && surface === "market-runner" && name === "stdout") {
2020
+ if (!options.json && surface === "operations-runner" && name === "stdout") {
2005
2021
  try {
2006
2022
  const parsed = JSON.parse(line);
2007
2023
  if (parsed.ok === true && parsed.claimed === false && parsed.operation == null) {
@@ -2665,8 +2681,8 @@ async function runTreeseedIntegratedDev(options = {}, deps = {}) {
2665
2681
  restartIds.add(id);
2666
2682
  }
2667
2683
  }
2668
- if ((change.tenantApiChanged || change.sdkChanged) && commandsById.has("market-runner")) {
2669
- restartIds.add("market-runner");
2684
+ if ((change.tenantApiChanged || change.sdkChanged) && commandsById.has("operations-runner")) {
2685
+ restartIds.add("operations-runner");
2670
2686
  }
2671
2687
  for (const id of restartIds) {
2672
2688
  await restartCommand(id);
@@ -1,5 +1,5 @@
1
1
  ---
2
- import MainLayout from '../layouts/MainLayout.astro';
2
+ import MainLayout from '@treeseed/ui/components/astro/layouts/MainLayout.astro';
3
3
  ---
4
4
 
5
5
  <MainLayout
@@ -1,8 +1,8 @@
1
1
  ---
2
- import ContentLayout from '../layouts/ContentLayout.astro';
3
- import BridgeLayout from '../layouts/BridgeLayout.astro';
4
- import PublishedContentBody from '../components/site/PublishedContentBody.astro';
5
- import RouteNotFound from '../components/site/RouteNotFound.astro';
2
+ import ContentLayout from '@treeseed/ui/components/astro/layouts/ContentLayout.astro';
3
+ import BridgeLayout from '@treeseed/ui/components/astro/layouts/BridgeLayout.astro';
4
+ import PublishedContentBody from '@treeseed/ui/components/astro/site/PublishedContentBody.astro';
5
+ import RouteNotFound from '@treeseed/ui/components/astro/site/RouteNotFound.astro';
6
6
  import { isPublishedRuntimeContentMode, loadPublishedEntry } from '../utils/site-content-runtime';
7
7
 
8
8
  export const prerender = false;
@@ -1,8 +1,8 @@
1
1
  ---
2
- import ProfileLayout from '../../layouts/ProfileLayout.astro';
2
+ import ProfileLayout from '@treeseed/ui/components/astro/layouts/ProfileLayout.astro';
3
3
  import { resolveReferences } from '../../utils/hub-content';
4
- import PublishedContentBody from '../../components/site/PublishedContentBody.astro';
5
- import RouteNotFound from '../../components/site/RouteNotFound.astro';
4
+ import PublishedContentBody from '@treeseed/ui/components/astro/site/PublishedContentBody.astro';
5
+ import RouteNotFound from '@treeseed/ui/components/astro/site/RouteNotFound.astro';
6
6
  import { isPublishedRuntimeContentMode, loadPublishedEntry, metadataFromPublishedContent, resolvePublishedReferences } from '../../utils/site-content-runtime';
7
7
 
8
8
  export const prerender = false;
@@ -1,7 +1,7 @@
1
1
  ---
2
- import MainLayout from '../../layouts/MainLayout.astro';
3
- import SectionIntro from '../../components/site/SectionIntro.astro';
4
- import ProfileList from '../../components/site/ProfileList.astro';
2
+ import MainLayout from '@treeseed/ui/components/astro/layouts/MainLayout.astro';
3
+ import SectionIntro from '@treeseed/ui/components/astro/site/SectionIntro.astro';
4
+ import ProfileList from '@treeseed/ui/components/astro/site/ProfileList.astro';
5
5
  import { isPublishedRuntimeContentMode, loadPublishedCollection } from '../../utils/site-content-runtime';
6
6
 
7
7
  const publishedRuntime = isPublishedRuntimeContentMode();
@@ -1,7 +1,7 @@
1
1
  ---
2
- import BookLayout from '../../layouts/BookLayout.astro';
3
- import PublishedContentBody from '../../components/site/PublishedContentBody.astro';
4
- import RouteNotFound from '../../components/site/RouteNotFound.astro';
2
+ import BookLayout from '@treeseed/ui/components/astro/layouts/BookLayout.astro';
3
+ import PublishedContentBody from '@treeseed/ui/components/astro/site/PublishedContentBody.astro';
4
+ import RouteNotFound from '@treeseed/ui/components/astro/site/RouteNotFound.astro';
5
5
  import { isPublishedRuntimeContentMode, loadPublishedEntry } from '../../utils/site-content-runtime';
6
6
 
7
7
  export const prerender = false;
@@ -1,7 +1,7 @@
1
1
  ---
2
- import MainLayout from '../../layouts/MainLayout.astro';
3
- import SectionIntro from '../../components/site/SectionIntro.astro';
4
- import BookList from '../../components/site/BookList.astro';
2
+ import MainLayout from '@treeseed/ui/components/astro/layouts/MainLayout.astro';
3
+ import SectionIntro from '@treeseed/ui/components/astro/site/SectionIntro.astro';
4
+ import BookList from '@treeseed/ui/components/astro/site/BookList.astro';
5
5
  import { isPublishedRuntimeContentMode, loadPublishedCollection } from '../../utils/site-content-runtime';
6
6
 
7
7
  const publishedRuntime = isPublishedRuntimeContentMode();
@@ -1,6 +1,6 @@
1
1
  ---
2
- import MainLayout from '../layouts/MainLayout.astro';
3
- import ContactForm from '../components/forms/ContactForm.astro';
2
+ import MainLayout from '@treeseed/ui/components/astro/layouts/MainLayout.astro';
3
+ import ContactForm from '@treeseed/ui/components/astro/forms/ContactForm.astro';
4
4
 
5
5
  const status = Astro.url.searchParams.get('formStatus');
6
6
  const code = Astro.url.searchParams.get('formCode');
@@ -1,8 +1,8 @@
1
1
  ---
2
- import AuthoredEntryLayout from '../../layouts/AuthoredEntryLayout.astro';
2
+ import AuthoredEntryLayout from '@treeseed/ui/components/astro/layouts/AuthoredEntryLayout.astro';
3
3
  import { resolveContributor, resolveReferences } from '../../utils/hub-content';
4
- import PublishedContentBody from '../../components/site/PublishedContentBody.astro';
5
- import RouteNotFound from '../../components/site/RouteNotFound.astro';
4
+ import PublishedContentBody from '@treeseed/ui/components/astro/site/PublishedContentBody.astro';
5
+ import RouteNotFound from '@treeseed/ui/components/astro/site/RouteNotFound.astro';
6
6
  import {
7
7
  isPublishedRuntimeContentMode,
8
8
  loadPublishedEntry,
@@ -1,7 +1,7 @@
1
1
  ---
2
- import MainLayout from '../../layouts/MainLayout.astro';
3
- import SectionIntro from '../../components/site/SectionIntro.astro';
4
- import ChronicleList from '../../components/site/ChronicleList.astro';
2
+ import MainLayout from '@treeseed/ui/components/astro/layouts/MainLayout.astro';
3
+ import SectionIntro from '@treeseed/ui/components/astro/site/SectionIntro.astro';
4
+ import ChronicleList from '@treeseed/ui/components/astro/site/ChronicleList.astro';
5
5
  import { getPublishedDecisions, resolveContributorsForEntries } from '../../utils/hub-content';
6
6
  import { isPublishedRuntimeContentMode, loadPublishedCollection, resolvePublishedContributor, metadataFromPublishedContent, loadPublishedEntry } from '../../utils/site-content-runtime';
7
7