@treeseed/sdk 0.10.27 → 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.
- package/README.md +207 -6
- package/dist/capacity-provider.d.ts +3 -1
- package/dist/capacity-provider.js +25 -5
- package/dist/control-plane.d.ts +1 -0
- package/dist/control-plane.js +38 -13
- package/dist/db/market-schema.d.ts +8860 -6172
- package/dist/db/market-schema.js +108 -0
- package/dist/db/node-sqlite.js +7 -2
- package/dist/hosting/apps.d.ts +12 -0
- package/dist/hosting/apps.js +107 -0
- package/dist/hosting/builtins.d.ts +25 -0
- package/dist/hosting/builtins.js +791 -0
- package/dist/hosting/contracts.d.ts +207 -0
- package/dist/hosting/contracts.js +0 -0
- package/dist/hosting/graph.d.ts +192 -0
- package/dist/hosting/graph.js +1106 -0
- package/dist/hosting/index.d.ts +4 -0
- package/dist/hosting/index.js +4 -0
- package/dist/index.d.ts +11 -4
- package/dist/index.js +71 -7
- package/dist/managed-dependencies.js +1 -2
- package/dist/market-client.d.ts +63 -3
- package/dist/market-client.js +83 -11
- package/dist/operations/services/bootstrap-runner.d.ts +3 -1
- package/dist/operations/services/bootstrap-runner.js +22 -2
- package/dist/operations/services/config-runtime.d.ts +10 -5
- package/dist/operations/services/config-runtime.js +209 -66
- package/dist/operations/services/deploy.d.ts +70 -7
- package/dist/operations/services/deploy.js +579 -64
- package/dist/operations/services/deployment-readiness.d.ts +30 -0
- package/dist/operations/services/deployment-readiness.js +175 -0
- package/dist/operations/services/git-workflow.d.ts +2 -1
- package/dist/operations/services/git-workflow.js +9 -3
- package/dist/operations/services/github-actions-verification.d.ts +1 -0
- package/dist/operations/services/github-actions-verification.js +1 -0
- package/dist/operations/services/github-api.js +1 -1
- package/dist/operations/services/github-automation.d.ts +1 -1
- package/dist/operations/services/github-automation.js +4 -3
- package/dist/operations/services/github-credentials.d.ts +13 -0
- package/dist/operations/services/github-credentials.js +58 -0
- package/dist/operations/services/hosted-service-checks.d.ts +63 -0
- package/dist/operations/services/hosted-service-checks.js +327 -0
- package/dist/operations/services/hub-provider-launch.js +3 -3
- package/dist/operations/services/live-hosted-service-checks.d.ts +25 -0
- package/dist/operations/services/live-hosted-service-checks.js +350 -0
- package/dist/operations/services/managed-host-security.js +1 -1
- package/dist/operations/services/operations-runner-smoke.d.ts +30 -0
- package/dist/operations/services/operations-runner-smoke.js +180 -0
- package/dist/operations/services/package-adapters.d.ts +95 -0
- package/dist/operations/services/package-adapters.js +288 -0
- package/dist/operations/services/package-reference-policy.d.ts +1 -0
- package/dist/operations/services/package-reference-policy.js +15 -2
- package/dist/operations/services/project-platform.d.ts +80 -22
- package/dist/operations/services/project-platform.js +49 -8
- package/dist/operations/services/project-web-monitor.js +26 -4
- package/dist/operations/services/railway-api.d.ts +88 -5
- package/dist/operations/services/railway-api.js +626 -35
- package/dist/operations/services/railway-deploy.d.ts +46 -40
- package/dist/operations/services/railway-deploy.js +261 -293
- package/dist/operations/services/release-candidate.d.ts +19 -0
- package/dist/operations/services/release-candidate.js +375 -38
- package/dist/operations/services/repository-save-orchestrator.d.ts +3 -1
- package/dist/operations/services/repository-save-orchestrator.js +279 -66
- package/dist/operations/services/runtime-tools.d.ts +1 -0
- package/dist/operations/services/runtime-tools.js +10 -9
- package/dist/operations/services/template-registry.js +14 -7
- package/dist/operations/services/verification-cache.d.ts +25 -0
- package/dist/operations/services/verification-cache.js +71 -0
- package/dist/operations/services/workspace-dependency-mode.js +9 -1
- package/dist/operations/services/workspace-save.js +1 -1
- package/dist/operations/services/workspace-tools.js +2 -1
- package/dist/platform/contracts.d.ts +32 -1
- package/dist/platform/deploy-config.js +73 -8
- package/dist/platform/env.yaml +163 -35
- package/dist/platform/environment.d.ts +1 -0
- package/dist/platform/environment.js +74 -5
- package/dist/platform/plugin.d.ts +9 -0
- package/dist/platform-operation-store.js +2 -2
- package/dist/platform-operations.js +1 -1
- package/dist/reconcile/bootstrap-systems.js +2 -2
- package/dist/reconcile/builtin-adapters.js +372 -189
- package/dist/reconcile/contracts.d.ts +9 -5
- package/dist/reconcile/desired-state.d.ts +1 -0
- package/dist/reconcile/desired-state.js +5 -5
- package/dist/reconcile/engine.d.ts +5 -2
- package/dist/reconcile/engine.js +53 -32
- package/dist/reconcile/index.d.ts +2 -0
- package/dist/reconcile/index.js +2 -0
- package/dist/reconcile/live-acceptance.d.ts +79 -0
- package/dist/reconcile/live-acceptance.js +1615 -0
- package/dist/reconcile/platform.d.ts +104 -0
- package/dist/reconcile/platform.js +100 -0
- package/dist/reconcile/state.js +4 -4
- package/dist/reconcile/units.js +2 -2
- package/dist/scripts/deployment-readiness.js +20 -0
- package/dist/scripts/generate-treedx-openapi-types.js +186 -0
- package/dist/scripts/operations-runner-smoke.js +16 -0
- package/dist/scripts/release-verify.js +4 -1
- package/dist/scripts/template-catalog.test.js +7 -7
- package/dist/scripts/tenant-workflow-action.js +10 -1
- package/dist/sdk-types.d.ts +172 -5
- package/dist/sdk-types.js +28 -3
- package/dist/sdk.d.ts +35 -24
- package/dist/sdk.js +186 -17
- package/dist/template-launch-requirements.js +9 -0
- package/dist/treedx/adapters.d.ts +6 -0
- package/dist/treedx/adapters.js +36 -0
- package/dist/treedx/client.d.ts +222 -0
- package/dist/treedx/client.js +871 -0
- package/dist/treedx/errors.d.ts +13 -0
- package/dist/treedx/errors.js +17 -0
- package/dist/treedx/federated-client.d.ts +27 -0
- package/dist/treedx/federated-client.js +158 -0
- package/dist/treedx/generated/openapi-types.d.ts +3558 -0
- package/dist/treedx/generated/openapi-types.js +0 -0
- package/dist/treedx/graph-adapter.d.ts +33 -0
- package/dist/treedx/graph-adapter.js +156 -0
- package/dist/treedx/index.d.ts +14 -0
- package/dist/treedx/index.js +48 -0
- package/dist/treedx/market-integration.d.ts +27 -0
- package/dist/treedx/market-integration.js +131 -0
- package/dist/treedx/ports.d.ts +166 -0
- package/dist/treedx/ports.js +231 -0
- package/dist/treedx/query-adapter.d.ts +19 -0
- package/dist/treedx/query-adapter.js +62 -0
- package/dist/treedx/registry-client.d.ts +11 -0
- package/dist/treedx/registry-client.js +19 -0
- package/dist/treedx/repository-adapter.d.ts +45 -0
- package/dist/treedx/repository-adapter.js +308 -0
- package/dist/treedx/sdk-integration.d.ts +27 -0
- package/dist/treedx/sdk-integration.js +63 -0
- package/dist/treedx/types.d.ts +1084 -0
- package/dist/treedx/types.js +8 -0
- package/dist/treedx/workspace-adapter.d.ts +27 -0
- package/dist/treedx/workspace-adapter.js +65 -0
- package/dist/treedx-backends.d.ts +218 -0
- package/dist/treedx-backends.js +632 -0
- package/dist/treedx-client.d.ts +86 -0
- package/dist/treedx-client.js +175 -0
- package/dist/treeseed/template-catalog/catalog.fixture.json +497 -138
- package/dist/workflow/operations.d.ts +119 -13
- package/dist/workflow/operations.js +309 -53
- package/dist/workflow-state.d.ts +13 -0
- package/dist/workflow-state.js +43 -26
- package/dist/workflow-support.d.ts +11 -3
- package/dist/workflow-support.js +67 -3
- package/dist/workflow.d.ts +5 -0
- package/drizzle/market/0004_treedx_market_integration.sql +99 -0
- package/package.json +34 -3
- package/templates/github/deploy-web.workflow.yml +39 -6
- package/dist/treeseed/template-catalog/templates/starter-basic/template/astro.config.d.ts +0 -3
- package/dist/treeseed/template-catalog/templates/starter-basic/template/astro.config.ts +0 -6
- package/dist/treeseed/template-catalog/templates/starter-basic/template/package.json +0 -35
- package/dist/treeseed/template-catalog/templates/starter-basic/template/src/api/server.js +0 -4
- package/dist/treeseed/template-catalog/templates/starter-basic/template/src/config.yaml +0 -65
- package/dist/treeseed/template-catalog/templates/starter-basic/template/src/content/decisions/adopt-initial-proposal-loop.mdx +0 -22
- package/dist/treeseed/template-catalog/templates/starter-basic/template/src/content/empty/.gitkeep +0 -1
- package/dist/treeseed/template-catalog/templates/starter-basic/template/src/content/knowledge/handbook/index.mdx +0 -11
- package/dist/treeseed/template-catalog/templates/starter-basic/template/src/content/pages/welcome.mdx +0 -11
- package/dist/treeseed/template-catalog/templates/starter-basic/template/src/content/people/starter-steward.mdx +0 -11
- package/dist/treeseed/template-catalog/templates/starter-basic/template/src/content/proposals/establish-initial-proposal-loop.mdx +0 -17
- package/dist/treeseed/template-catalog/templates/starter-basic/template/src/content.config.d.ts +0 -1
- package/dist/treeseed/template-catalog/templates/starter-basic/template/src/content.config.ts +0 -3
- package/dist/treeseed/template-catalog/templates/starter-basic/template/src/env.yaml +0 -1
- package/dist/treeseed/template-catalog/templates/starter-basic/template/src/manifest.yaml +0 -26
- package/dist/treeseed/template-catalog/templates/starter-basic/template/treeseed.site.yaml +0 -74
- package/dist/treeseed/template-catalog/templates/starter-basic/template/tsconfig.json +0 -9
- package/dist/treeseed/template-catalog/templates/starter-basic/template.config.json +0 -103
package/dist/db/market-schema.js
CHANGED
|
@@ -1236,6 +1236,104 @@ const hubContentSources = pgTable("hub_content_sources", {
|
|
|
1236
1236
|
createdAt: text("created_at").notNull(),
|
|
1237
1237
|
updatedAt: text("updated_at").notNull()
|
|
1238
1238
|
});
|
|
1239
|
+
const treeDxInstances = pgTable("treedx_instances", {
|
|
1240
|
+
id: text("id").primaryKey(),
|
|
1241
|
+
teamId: text("team_id").notNull(),
|
|
1242
|
+
kind: text("kind").notNull(),
|
|
1243
|
+
provider: text("provider").notNull(),
|
|
1244
|
+
name: text("name").notNull(),
|
|
1245
|
+
baseUrl: text("base_url"),
|
|
1246
|
+
registryUrl: text("registry_url"),
|
|
1247
|
+
publicRead: integer("public_read").notNull().default(0),
|
|
1248
|
+
primary: integer("primary").notNull().default(1),
|
|
1249
|
+
status: text("status").notNull().default("pending"),
|
|
1250
|
+
imageRef: text("image_ref"),
|
|
1251
|
+
railwayProjectId: text("railway_project_id"),
|
|
1252
|
+
railwayServiceId: text("railway_service_id"),
|
|
1253
|
+
railwayEnvironmentId: text("railway_environment_id"),
|
|
1254
|
+
volumeMountPath: text("volume_mount_path"),
|
|
1255
|
+
metadataJson: text("metadata_json").notNull().default("{}"),
|
|
1256
|
+
createdAt: text("created_at").notNull(),
|
|
1257
|
+
updatedAt: text("updated_at").notNull()
|
|
1258
|
+
}, (table) => [
|
|
1259
|
+
index("idx_treedx_instances_team_status").on(table.teamId, table.status)
|
|
1260
|
+
]);
|
|
1261
|
+
const treeDxProjectLibraries = pgTable("treedx_project_libraries", {
|
|
1262
|
+
id: text("id").primaryKey(),
|
|
1263
|
+
teamId: text("team_id").notNull(),
|
|
1264
|
+
projectId: text("project_id").notNull(),
|
|
1265
|
+
instanceId: text("instance_id").notNull(),
|
|
1266
|
+
libraryId: text("library_id").notNull(),
|
|
1267
|
+
repositoryId: text("repository_id"),
|
|
1268
|
+
contentPath: text("content_path").notNull().default("src/content"),
|
|
1269
|
+
contentRepositoryUrl: text("content_repository_url"),
|
|
1270
|
+
contentRepositoryDefaultBranch: text("content_repository_default_branch"),
|
|
1271
|
+
contentRepositoryRef: text("content_repository_ref"),
|
|
1272
|
+
r2BucketName: text("r2_bucket_name"),
|
|
1273
|
+
r2ManifestKey: text("r2_manifest_key"),
|
|
1274
|
+
topologyJson: text("topology_json").notNull().default("{}"),
|
|
1275
|
+
metadataJson: text("metadata_json").notNull().default("{}"),
|
|
1276
|
+
createdAt: text("created_at").notNull(),
|
|
1277
|
+
updatedAt: text("updated_at").notNull()
|
|
1278
|
+
}, (table) => [
|
|
1279
|
+
uniqueIndex("idx_treedx_project_libraries_project").on(table.projectId),
|
|
1280
|
+
index("idx_treedx_project_libraries_instance").on(table.instanceId)
|
|
1281
|
+
]);
|
|
1282
|
+
const treeDxMirrors = pgTable("treedx_mirrors", {
|
|
1283
|
+
id: text("id").primaryKey(),
|
|
1284
|
+
teamId: text("team_id").notNull(),
|
|
1285
|
+
instanceId: text("instance_id").notNull(),
|
|
1286
|
+
name: text("name").notNull(),
|
|
1287
|
+
direction: text("direction").notNull().default("bidirectional"),
|
|
1288
|
+
targetKind: text("target_kind").notNull(),
|
|
1289
|
+
targetUrl: text("target_url"),
|
|
1290
|
+
status: text("status").notNull().default("pending"),
|
|
1291
|
+
instructions: text("instructions"),
|
|
1292
|
+
lastSyncAt: text("last_sync_at"),
|
|
1293
|
+
lastSyncStatus: text("last_sync_status"),
|
|
1294
|
+
lastSyncMetadataJson: text("last_sync_metadata_json").notNull().default("{}"),
|
|
1295
|
+
metadataJson: text("metadata_json").notNull().default("{}"),
|
|
1296
|
+
createdAt: text("created_at").notNull(),
|
|
1297
|
+
updatedAt: text("updated_at").notNull()
|
|
1298
|
+
}, (table) => [
|
|
1299
|
+
index("idx_treedx_mirrors_team_instance").on(table.teamId, table.instanceId)
|
|
1300
|
+
]);
|
|
1301
|
+
const treeDxShares = pgTable("treedx_shares", {
|
|
1302
|
+
id: text("id").primaryKey(),
|
|
1303
|
+
teamId: text("team_id").notNull(),
|
|
1304
|
+
instanceId: text("instance_id"),
|
|
1305
|
+
projectId: text("project_id"),
|
|
1306
|
+
libraryId: text("library_id"),
|
|
1307
|
+
scope: text("scope").notNull(),
|
|
1308
|
+
targetTeamId: text("target_team_id"),
|
|
1309
|
+
trustGrantJson: text("trust_grant_json").notNull().default("{}"),
|
|
1310
|
+
publicRead: integer("public_read").notNull().default(0),
|
|
1311
|
+
status: text("status").notNull().default("active"),
|
|
1312
|
+
expiresAt: text("expires_at"),
|
|
1313
|
+
metadataJson: text("metadata_json").notNull().default("{}"),
|
|
1314
|
+
createdAt: text("created_at").notNull(),
|
|
1315
|
+
updatedAt: text("updated_at").notNull(),
|
|
1316
|
+
revokedAt: text("revoked_at")
|
|
1317
|
+
}, (table) => [
|
|
1318
|
+
index("idx_treedx_shares_team_scope").on(table.teamId, table.scope, table.status)
|
|
1319
|
+
]);
|
|
1320
|
+
const treeDxDeployments = pgTable("treedx_deployments", {
|
|
1321
|
+
id: text("id").primaryKey(),
|
|
1322
|
+
teamId: text("team_id").notNull(),
|
|
1323
|
+
instanceId: text("instance_id"),
|
|
1324
|
+
provider: text("provider").notNull(),
|
|
1325
|
+
status: text("status").notNull().default("queued"),
|
|
1326
|
+
imageRef: text("image_ref"),
|
|
1327
|
+
volumeMountPath: text("volume_mount_path"),
|
|
1328
|
+
serviceRefsJson: text("service_refs_json").notNull().default("{}"),
|
|
1329
|
+
resultJson: text("result_json").notNull().default("{}"),
|
|
1330
|
+
errorJson: text("error_json"),
|
|
1331
|
+
createdAt: text("created_at").notNull(),
|
|
1332
|
+
updatedAt: text("updated_at").notNull(),
|
|
1333
|
+
completedAt: text("completed_at")
|
|
1334
|
+
}, (table) => [
|
|
1335
|
+
index("idx_treedx_deployments_team_instance").on(table.teamId, table.instanceId, table.createdAt)
|
|
1336
|
+
]);
|
|
1239
1337
|
const hubLaunches = pgTable("hub_launches", {
|
|
1240
1338
|
id: text("id").primaryKey(),
|
|
1241
1339
|
hubId: text("hub_id").notNull(),
|
|
@@ -1743,6 +1841,11 @@ const treeseedMarketSchema = {
|
|
|
1743
1841
|
repositoryHosts,
|
|
1744
1842
|
hubRepositories,
|
|
1745
1843
|
hubContentSources,
|
|
1844
|
+
treeDxInstances,
|
|
1845
|
+
treeDxProjectLibraries,
|
|
1846
|
+
treeDxMirrors,
|
|
1847
|
+
treeDxShares,
|
|
1848
|
+
treeDxDeployments,
|
|
1746
1849
|
hubLaunches,
|
|
1747
1850
|
hubLaunchEvents,
|
|
1748
1851
|
hubWorkspaceLinks,
|
|
@@ -1864,6 +1967,11 @@ export {
|
|
|
1864
1967
|
teamStorageLocators,
|
|
1865
1968
|
teamWebHosts,
|
|
1866
1969
|
teams,
|
|
1970
|
+
treeDxDeployments,
|
|
1971
|
+
treeDxInstances,
|
|
1972
|
+
treeDxMirrors,
|
|
1973
|
+
treeDxProjectLibraries,
|
|
1974
|
+
treeDxShares,
|
|
1867
1975
|
treeseedMarketSchema,
|
|
1868
1976
|
userEmailAddresses,
|
|
1869
1977
|
userIdentities,
|
package/dist/db/node-sqlite.js
CHANGED
|
@@ -6,8 +6,12 @@ import { treeseedSchema } from "./schema.js";
|
|
|
6
6
|
function isDirectoryLike(path) {
|
|
7
7
|
return !/\.(sqlite|sqlite3|db)$/iu.test(path);
|
|
8
8
|
}
|
|
9
|
+
function isInMemorySqlitePath(path) {
|
|
10
|
+
return path === ":memory:";
|
|
11
|
+
}
|
|
9
12
|
function resolveTreeseedSqlitePath(input) {
|
|
10
13
|
const base = input?.trim() || ".treeseed/generated/environments/local/site-data.sqlite";
|
|
14
|
+
if (isInMemorySqlitePath(base)) return base;
|
|
11
15
|
if (!isDirectoryLike(base)) return resolve(base);
|
|
12
16
|
const miniflareRoot = resolve(base, "miniflare-D1DatabaseObject");
|
|
13
17
|
if (existsSync(miniflareRoot)) {
|
|
@@ -70,10 +74,11 @@ class NodeSqliteD1Database {
|
|
|
70
74
|
path;
|
|
71
75
|
constructor(path) {
|
|
72
76
|
this.path = resolveTreeseedSqlitePath(path);
|
|
73
|
-
|
|
77
|
+
const inMemory = isInMemorySqlitePath(this.path);
|
|
78
|
+
if (!inMemory) mkdirSync(dirname(this.path), { recursive: true });
|
|
74
79
|
this.client = new DatabaseSync(this.path);
|
|
75
80
|
this.client.exec("PRAGMA foreign_keys = ON;");
|
|
76
|
-
this.client.exec("PRAGMA journal_mode = WAL;");
|
|
81
|
+
if (!inMemory) this.client.exec("PRAGMA journal_mode = WAL;");
|
|
77
82
|
}
|
|
78
83
|
prepare(query) {
|
|
79
84
|
return new NodeSqliteD1PreparedStatement(this.client, query);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { TreeseedDeployConfig } from '../platform/contracts.ts';
|
|
2
|
+
export interface TreeseedDiscoveredApplication {
|
|
3
|
+
id: string;
|
|
4
|
+
label: string;
|
|
5
|
+
root: string;
|
|
6
|
+
configPath: string;
|
|
7
|
+
relativeRoot: string;
|
|
8
|
+
config: TreeseedDeployConfig;
|
|
9
|
+
roles: string[];
|
|
10
|
+
}
|
|
11
|
+
export declare function discoverTreeseedApplications(workspaceRootInput: string): TreeseedDiscoveredApplication[];
|
|
12
|
+
export declare function findTreeseedApplication(workspaceRoot: string, appId: string): TreeseedDiscoveredApplication | null;
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { existsSync, readdirSync, readFileSync } from "node:fs";
|
|
2
|
+
import { dirname, resolve } from "node:path";
|
|
3
|
+
import { loadTreeseedDeployConfigFromPath } from "../platform/deploy-config.js";
|
|
4
|
+
const IGNORED_DIRS = /* @__PURE__ */ new Set([
|
|
5
|
+
".git",
|
|
6
|
+
".treeseed",
|
|
7
|
+
".astro",
|
|
8
|
+
".cache",
|
|
9
|
+
"dist",
|
|
10
|
+
"node_modules",
|
|
11
|
+
"coverage",
|
|
12
|
+
"target"
|
|
13
|
+
]);
|
|
14
|
+
function readPackageJson(root) {
|
|
15
|
+
try {
|
|
16
|
+
return JSON.parse(readFileSync(resolve(root, "package.json"), "utf8"));
|
|
17
|
+
} catch {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
function workspacePackageRoots(root) {
|
|
22
|
+
const packageJson = readPackageJson(root);
|
|
23
|
+
const workspaces = Array.isArray(packageJson?.workspaces) ? packageJson.workspaces : packageJson?.workspaces && typeof packageJson.workspaces === "object" && Array.isArray(packageJson.workspaces.packages) ? packageJson.workspaces.packages : [];
|
|
24
|
+
const roots = /* @__PURE__ */ new Set();
|
|
25
|
+
for (const pattern of workspaces) {
|
|
26
|
+
if (typeof pattern !== "string") continue;
|
|
27
|
+
const normalized = pattern.trim();
|
|
28
|
+
if (!normalized.endsWith("/*")) continue;
|
|
29
|
+
const base = resolve(root, normalized.slice(0, -2));
|
|
30
|
+
if (!existsSync(base)) continue;
|
|
31
|
+
for (const entry of readdirSync(base, { withFileTypes: true })) {
|
|
32
|
+
if (!entry.isDirectory() || IGNORED_DIRS.has(entry.name)) continue;
|
|
33
|
+
roots.add(resolve(base, entry.name));
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return [...roots].sort();
|
|
37
|
+
}
|
|
38
|
+
function applicationRoles(config) {
|
|
39
|
+
const roles = [];
|
|
40
|
+
if (config.surfaces?.web?.enabled !== false && config.surfaces?.web) roles.push("web");
|
|
41
|
+
if (config.surfaces?.api?.enabled === true || config.services?.api?.enabled !== false && config.services?.api) roles.push("api");
|
|
42
|
+
if (config.services?.operationsRunner?.enabled !== false && config.services?.operationsRunner) roles.push("operations-runner");
|
|
43
|
+
if (config.hosting?.kind === "treeseed_control_plane") roles.push("treeseed-control-plane");
|
|
44
|
+
return [...new Set(roles)];
|
|
45
|
+
}
|
|
46
|
+
function inferApplicationId(config, root, workspaceRoot) {
|
|
47
|
+
const roles = applicationRoles(config);
|
|
48
|
+
const hasBackendServices = Boolean(config.services?.api || config.services?.operationsRunner || config.services?.treeseedDatabase);
|
|
49
|
+
if (config.hosting?.kind === "treeseed_control_plane" || roles.includes("api") || roles.includes("operations-runner")) {
|
|
50
|
+
return "api";
|
|
51
|
+
}
|
|
52
|
+
if (roles.includes("web") && !hasBackendServices && root === workspaceRoot) {
|
|
53
|
+
const configuredRootId = config.hosting?.projectId ?? config.runtime?.projectId ?? null;
|
|
54
|
+
if (configuredRootId && configuredRootId !== "market") {
|
|
55
|
+
return configuredRootId.replace(/^treeseed-/u, "").replace(/[^a-z0-9-]+/giu, "-").replace(/^-|-$/gu, "") || "web";
|
|
56
|
+
}
|
|
57
|
+
return "web";
|
|
58
|
+
}
|
|
59
|
+
const relative = root === workspaceRoot ? "." : root.slice(workspaceRoot.length + 1).replaceAll("\\", "/");
|
|
60
|
+
const configuredId = config.hosting?.projectId ?? config.runtime?.projectId ?? config.slug ?? relative;
|
|
61
|
+
return (configuredId || "app").replace(/^treeseed-/u, "").replace(/[^a-z0-9-]+/giu, "-").replace(/^-|-$/gu, "") || "app";
|
|
62
|
+
}
|
|
63
|
+
function appFromConfigPath(configPath, workspaceRoot) {
|
|
64
|
+
const root = dirname(configPath);
|
|
65
|
+
const config = loadTreeseedDeployConfigFromPath(configPath);
|
|
66
|
+
const roles = applicationRoles(config);
|
|
67
|
+
const id = inferApplicationId(config, root, workspaceRoot);
|
|
68
|
+
const relativeRoot = root === workspaceRoot ? "." : root.slice(workspaceRoot.length + 1).replaceAll("\\", "/");
|
|
69
|
+
return {
|
|
70
|
+
id,
|
|
71
|
+
label: config.name,
|
|
72
|
+
root,
|
|
73
|
+
configPath,
|
|
74
|
+
relativeRoot,
|
|
75
|
+
config,
|
|
76
|
+
roles
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
function discoverTreeseedApplications(workspaceRootInput) {
|
|
80
|
+
const workspaceRoot = resolve(workspaceRootInput);
|
|
81
|
+
const candidates = [
|
|
82
|
+
workspaceRoot,
|
|
83
|
+
...workspacePackageRoots(workspaceRoot)
|
|
84
|
+
];
|
|
85
|
+
const seenIds = /* @__PURE__ */ new Set();
|
|
86
|
+
const apps = [];
|
|
87
|
+
for (const root of candidates) {
|
|
88
|
+
const configPath = resolve(root, "treeseed.site.yaml");
|
|
89
|
+
if (!existsSync(configPath)) continue;
|
|
90
|
+
const app = appFromConfigPath(configPath, workspaceRoot);
|
|
91
|
+
let id = app.id;
|
|
92
|
+
let suffix = 2;
|
|
93
|
+
while (seenIds.has(id)) {
|
|
94
|
+
id = `${app.id}-${suffix++}`;
|
|
95
|
+
}
|
|
96
|
+
seenIds.add(id);
|
|
97
|
+
apps.push({ ...app, id });
|
|
98
|
+
}
|
|
99
|
+
return apps;
|
|
100
|
+
}
|
|
101
|
+
function findTreeseedApplication(workspaceRoot, appId) {
|
|
102
|
+
return discoverTreeseedApplications(workspaceRoot).find((app) => app.id === appId || app.relativeRoot === appId) ?? null;
|
|
103
|
+
}
|
|
104
|
+
export {
|
|
105
|
+
discoverTreeseedApplications,
|
|
106
|
+
findTreeseedApplication
|
|
107
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { TreeseedApplicationHostingProfile, TreeseedHostAdapter, TreeseedHostCapability, TreeseedHostingEnvironment, TreeseedHostingStatus, TreeseedHostingUnit, TreeseedServicePlacement, TreeseedServiceTypeAdapter } from './contracts.ts';
|
|
2
|
+
export declare function createDefaultHostAdapters(): Record<string, TreeseedHostAdapter>;
|
|
3
|
+
export declare function createDefaultServiceTypeAdapters(): Record<string, TreeseedServiceTypeAdapter>;
|
|
4
|
+
export declare function createDefaultHostingProfiles(): TreeseedApplicationHostingProfile[];
|
|
5
|
+
export declare function sanitizedUnitConfig(unit: TreeseedHostingUnit): {
|
|
6
|
+
id: string;
|
|
7
|
+
label: string;
|
|
8
|
+
serviceType: string;
|
|
9
|
+
placement: TreeseedServicePlacement;
|
|
10
|
+
hostId: string;
|
|
11
|
+
environment: TreeseedHostingEnvironment;
|
|
12
|
+
projectGroupId: string | null;
|
|
13
|
+
requiredCapabilities: TreeseedHostCapability[];
|
|
14
|
+
secretRefs: string[];
|
|
15
|
+
variableRefs: string[];
|
|
16
|
+
application: {
|
|
17
|
+
id: string;
|
|
18
|
+
relativeRoot: string;
|
|
19
|
+
roles: string[];
|
|
20
|
+
} | null;
|
|
21
|
+
config: unknown;
|
|
22
|
+
metadata: unknown;
|
|
23
|
+
};
|
|
24
|
+
export declare function redactSensitiveConfig(value: unknown): unknown;
|
|
25
|
+
export declare function summarizePlacementStatus(statuses: TreeseedHostingStatus[]): TreeseedHostingStatus;
|