@treeseed/sdk 0.1.1 → 0.3.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 +97 -494
- package/dist/{src/cli-tools.d.ts → cli-tools.d.ts} +1 -1
- package/dist/cli-tools.js +5 -3
- package/dist/{src/content-store.d.ts → content-store.d.ts} +3 -2
- package/dist/content-store.js +52 -20
- package/dist/{src/d1-store.d.ts → d1-store.d.ts} +62 -1
- package/dist/d1-store.js +625 -65
- package/dist/field-aliases.d.ts +11 -0
- package/dist/field-aliases.js +41 -0
- package/dist/graph/build.d.ts +19 -0
- package/dist/graph/build.js +949 -0
- package/dist/graph/dsl.d.ts +2 -0
- package/dist/graph/dsl.js +243 -0
- package/dist/graph/query.d.ts +47 -0
- package/dist/graph/query.js +447 -0
- package/dist/graph/ranking.d.ts +3 -0
- package/dist/graph/ranking.js +483 -0
- package/dist/graph/schema.d.ts +142 -0
- package/dist/graph/schema.js +133 -0
- package/dist/graph.d.ts +52 -0
- package/dist/graph.js +133 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.js +90 -2
- package/dist/model-registry.d.ts +8 -0
- package/dist/model-registry.js +351 -25
- package/dist/operations/providers/default.d.ts +10 -0
- package/dist/operations/providers/default.js +514 -0
- package/dist/operations/runtime.d.ts +7 -0
- package/dist/operations/runtime.js +60 -0
- package/dist/operations/services/config-runtime.d.ts +269 -0
- package/dist/operations/services/config-runtime.js +1397 -0
- package/dist/operations/services/d1-migration.d.ts +6 -0
- package/dist/operations/services/d1-migration.js +89 -0
- package/dist/operations/services/deploy.d.ts +371 -0
- package/dist/operations/services/deploy.js +981 -0
- package/dist/operations/services/git-workflow.d.ts +49 -0
- package/dist/operations/services/git-workflow.js +218 -0
- package/dist/operations/services/github-automation.d.ts +156 -0
- package/dist/operations/services/github-automation.js +256 -0
- package/dist/operations/services/local-dev.d.ts +9 -0
- package/dist/operations/services/local-dev.js +106 -0
- package/dist/operations/services/mailpit-runtime.d.ts +4 -0
- package/dist/operations/services/mailpit-runtime.js +59 -0
- package/dist/operations/services/railway-deploy.d.ts +53 -0
- package/dist/operations/services/railway-deploy.js +123 -0
- package/dist/operations/services/runtime-paths.d.ts +19 -0
- package/dist/operations/services/runtime-paths.js +54 -0
- package/dist/operations/services/runtime-tools.d.ts +117 -0
- package/dist/operations/services/runtime-tools.js +358 -0
- package/dist/operations/services/save-deploy-preflight.d.ts +34 -0
- package/dist/operations/services/save-deploy-preflight.js +76 -0
- package/dist/operations/services/template-registry.d.ts +88 -0
- package/dist/operations/services/template-registry.js +407 -0
- package/dist/operations/services/watch-dev.d.ts +21 -0
- package/dist/operations/services/watch-dev.js +284 -0
- package/dist/operations/services/workspace-preflight.d.ts +40 -0
- package/dist/operations/services/workspace-preflight.js +165 -0
- package/dist/operations/services/workspace-save.d.ts +42 -0
- package/dist/operations/services/workspace-save.js +235 -0
- package/dist/operations/services/workspace-tools.d.ts +16 -0
- package/dist/operations/services/workspace-tools.js +270 -0
- package/dist/operations-registry.d.ts +5 -0
- package/dist/operations-registry.js +68 -0
- package/dist/operations-types.d.ts +71 -0
- package/dist/operations-types.js +17 -0
- package/dist/operations.d.ts +6 -0
- package/dist/operations.js +16 -0
- package/dist/platform/books-data.d.ts +1 -0
- package/dist/platform/books-data.js +1 -0
- package/dist/platform/contracts.d.ts +158 -0
- package/dist/platform/contracts.js +0 -0
- package/dist/platform/deploy/config.d.ts +4 -0
- package/dist/platform/deploy/config.js +222 -0
- package/dist/platform/deploy-config.d.ts +1 -0
- package/dist/platform/deploy-config.js +1 -0
- package/dist/platform/env.yaml +394 -0
- package/dist/platform/environment.d.ts +130 -0
- package/dist/platform/environment.js +331 -0
- package/dist/platform/plugin.d.ts +2 -0
- package/dist/platform/plugin.js +4 -0
- package/dist/platform/plugins/constants.d.ts +22 -0
- package/dist/platform/plugins/constants.js +29 -0
- package/dist/platform/plugins/plugin.d.ts +51 -0
- package/dist/platform/plugins/plugin.js +6 -0
- package/dist/platform/plugins/runtime.d.ts +35 -0
- package/dist/platform/plugins/runtime.js +142 -0
- package/dist/platform/plugins.d.ts +5 -0
- package/dist/platform/plugins.js +16 -0
- package/dist/platform/site-config-schema.js +1 -0
- package/dist/platform/tenant/config.d.ts +9 -0
- package/dist/platform/tenant/config.js +154 -0
- package/dist/platform/tenant/runtime-config.d.ts +4 -0
- package/dist/platform/tenant/runtime-config.js +20 -0
- package/dist/platform/tenant-config.d.ts +1 -0
- package/dist/platform/tenant-config.js +1 -0
- package/dist/platform/utils/books-data.d.ts +29 -0
- package/dist/platform/utils/books-data.js +82 -0
- package/dist/platform/utils/site-config-schema.js +321 -0
- package/dist/remote.d.ts +175 -0
- package/dist/remote.js +202 -0
- package/dist/runtime.js +50 -3
- package/dist/scripts/aggregate-book.js +121 -0
- package/dist/scripts/build-dist.js +57 -13
- package/dist/scripts/build-tenant-worker.js +36 -0
- package/dist/scripts/cleanup-markdown.js +373 -0
- package/dist/scripts/cli-test-fixtures.js +48 -0
- package/dist/scripts/config-treeseed.js +95 -0
- package/dist/scripts/ensure-mailpit.js +29 -0
- package/dist/scripts/local-dev.js +129 -0
- package/dist/scripts/logs-mailpit.js +2 -0
- package/dist/scripts/patch-starlight-content-path.js +172 -0
- package/dist/scripts/release-verify.js +34 -5
- package/dist/scripts/run-fixture-astro-command.js +18 -0
- package/dist/scripts/scaffold-site.js +65 -0
- package/dist/scripts/stop-mailpit.js +5 -0
- package/dist/scripts/sync-dev-vars.js +6 -0
- package/dist/scripts/sync-template.js +20 -0
- package/dist/scripts/template-catalog.test.js +100 -0
- package/dist/scripts/template-command.js +31 -0
- package/dist/scripts/tenant-astro-command.js +3 -0
- package/dist/scripts/tenant-build.js +16 -0
- package/dist/scripts/tenant-check.js +7 -0
- package/dist/scripts/tenant-d1-migrate-local.js +11 -0
- package/dist/scripts/tenant-deploy.js +180 -0
- package/dist/scripts/tenant-destroy.js +104 -0
- package/dist/scripts/tenant-dev.js +171 -0
- package/dist/scripts/tenant-lint.js +4 -0
- package/dist/scripts/tenant-test.js +4 -0
- package/dist/scripts/test-cloudflare-local.js +212 -0
- package/dist/scripts/test-scaffold.js +314 -0
- package/dist/scripts/test-smoke.js +71 -13
- package/dist/scripts/treeseed-assert-release-tag-version.js +21 -0
- package/dist/scripts/treeseed-build-dist.js +134 -0
- package/dist/scripts/treeseed-publish-package.js +19 -0
- package/dist/scripts/treeseed-release-verify.js +131 -0
- package/dist/scripts/treeseed-run-ts.js +45 -0
- package/dist/scripts/validate-templates.js +6 -0
- package/dist/scripts/verify-driver.js +29 -0
- package/dist/scripts/workflow-commands.test.js +39 -0
- package/dist/scripts/workspace-close.js +24 -0
- package/dist/scripts/workspace-command-e2e.js +718 -0
- package/dist/scripts/workspace-lint.js +9 -0
- package/dist/scripts/workspace-preflight.js +22 -0
- package/dist/scripts/workspace-publish-changed-packages.js +16 -0
- package/dist/scripts/workspace-release-verify.js +81 -0
- package/dist/scripts/workspace-release.js +42 -0
- package/dist/scripts/workspace-save.js +124 -0
- package/dist/scripts/workspace-start-warning.js +3 -0
- package/dist/scripts/workspace-start.js +71 -0
- package/dist/scripts/workspace-test-unit.js +4 -0
- package/dist/scripts/workspace-test.js +11 -0
- package/dist/sdk-fields.d.ts +11 -0
- package/dist/sdk-fields.js +169 -0
- package/dist/sdk-filters.d.ts +4 -0
- package/dist/sdk-filters.js +12 -15
- package/dist/sdk-types.d.ts +796 -0
- package/dist/sdk-types.js +7 -1
- package/dist/sdk-version.d.ts +2 -0
- package/dist/sdk-version.js +42 -0
- package/dist/sdk.d.ts +215 -0
- package/dist/sdk.js +235 -11
- package/dist/stores/cursor-store.js +9 -3
- package/dist/stores/lease-store.js +8 -2
- package/dist/{src/stores → stores}/message-store.d.ts +1 -1
- package/dist/stores/message-store.js +27 -3
- package/dist/stores/operational-store.d.ts +24 -0
- package/dist/stores/operational-store.js +279 -0
- package/dist/stores/run-store.js +8 -1
- package/dist/stores/subscription-store.js +7 -5
- package/dist/template-catalog.d.ts +13 -0
- package/dist/template-catalog.js +141 -0
- package/dist/treeseed/services/compose.yml +7 -0
- package/dist/treeseed/template-catalog/catalog.fixture.json +55 -0
- package/dist/treeseed/template-catalog/templates/starter-basic/template/astro.config.d.ts +2 -0
- package/dist/treeseed/template-catalog/templates/starter-basic/template/astro.config.ts +3 -0
- package/dist/treeseed/template-catalog/templates/starter-basic/template/package.json +32 -0
- package/dist/treeseed/template-catalog/templates/starter-basic/template/src/config.yaml +40 -0
- package/dist/treeseed/template-catalog/templates/starter-basic/template/src/content/empty/.gitkeep +1 -0
- package/dist/treeseed/template-catalog/templates/starter-basic/template/src/content/knowledge/handbook/index.mdx +11 -0
- package/dist/treeseed/template-catalog/templates/starter-basic/template/src/content/pages/welcome.mdx +11 -0
- package/dist/treeseed/template-catalog/templates/starter-basic/template/src/content.config.d.ts +1 -0
- package/dist/treeseed/template-catalog/templates/starter-basic/template/src/content.config.ts +3 -0
- package/dist/treeseed/template-catalog/templates/starter-basic/template/src/env.yaml +1 -0
- package/dist/treeseed/template-catalog/templates/starter-basic/template/src/manifest.yaml +19 -0
- package/dist/treeseed/template-catalog/templates/starter-basic/template/treeseed.site.yaml +26 -0
- package/dist/treeseed/template-catalog/templates/starter-basic/template/tsconfig.json +9 -0
- package/dist/treeseed/template-catalog/templates/starter-basic/template.config.json +90 -0
- package/dist/verification.d.ts +20 -0
- package/dist/verification.js +98 -0
- package/dist/workflow/operations.d.ts +396 -0
- package/dist/workflow/operations.js +841 -0
- package/dist/workflow-state.d.ts +56 -0
- package/dist/workflow-state.js +195 -0
- package/dist/workflow-support.d.ts +9 -0
- package/dist/workflow-support.js +176 -0
- package/dist/workflow.d.ts +111 -0
- package/dist/workflow.js +97 -0
- package/package.json +97 -5
- package/scripts/verify-driver.mjs +29 -0
- package/dist/scripts/.ts-run-1775616845195-odh4xzphk3l.js +0 -22
- package/dist/scripts/.ts-run-1775616848931-9386s6kwrl.js +0 -126
- package/dist/scripts/assert-release-tag-version.d.ts +0 -1
- package/dist/scripts/build-dist.d.ts +0 -1
- package/dist/scripts/package-tools.d.ts +0 -15
- package/dist/scripts/publish-package.d.ts +0 -1
- package/dist/scripts/release-verify.d.ts +0 -1
- package/dist/scripts/test-smoke.d.ts +0 -1
- package/dist/src/index.d.ts +0 -6
- package/dist/src/model-registry.d.ts +0 -4
- package/dist/src/sdk-filters.d.ts +0 -4
- package/dist/src/sdk-types.d.ts +0 -285
- package/dist/src/sdk.d.ts +0 -109
- package/dist/test/test-fixture.d.ts +0 -1
- package/dist/test/utils/envelopes.test.d.ts +0 -1
- package/dist/test/utils/sdk.test.d.ts +0 -1
- package/dist/vitest.config.d.ts +0 -2
- /package/dist/{src/frontmatter.d.ts → frontmatter.d.ts} +0 -0
- /package/dist/{src/git-runtime.d.ts → git-runtime.d.ts} +0 -0
- /package/dist/{src/runtime.d.ts → runtime.d.ts} +0 -0
- /package/dist/{src/stores → stores}/cursor-store.d.ts +0 -0
- /package/dist/{src/stores → stores}/envelopes.d.ts +0 -0
- /package/dist/{src/stores → stores}/helpers.d.ts +0 -0
- /package/dist/{src/stores → stores}/lease-store.d.ts +0 -0
- /package/dist/{src/stores → stores}/run-store.d.ts +0 -0
- /package/dist/{src/stores → stores}/subscription-store.d.ts +0 -0
- /package/dist/{src/types → types}/agents.d.ts +0 -0
- /package/dist/{src/types → types}/cloudflare.d.ts +0 -0
- /package/dist/{src/wrangler-d1.d.ts → wrangler-d1.d.ts} +0 -0
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
export type TreeseedOperationGroup = 'Workflow' | 'Local Development' | 'Validation' | 'Release Utilities' | 'Utilities' | 'Passthrough';
|
|
2
|
+
export type TreeseedOperationId = 'workspace.status' | 'workspace.doctor' | 'branch.tasks' | 'branch.switch' | 'branch.save' | 'branch.close' | 'branch.stage' | 'deploy.release' | 'deploy.rollback' | 'deploy.destroy' | 'template.list' | 'template.show' | 'template.validate' | 'template.sync' | 'project.init' | 'project.config' | 'local.dev' | 'local.devWatch' | 'local.build' | 'local.check' | 'local.preview' | 'local.lint' | 'local.test' | 'validation.testUnit' | 'validation.preflight' | 'validation.authCheck' | 'auth.login' | 'auth.logout' | 'auth.whoami' | 'release.testE2e' | 'release.testE2eLocal' | 'release.testE2eStaging' | 'release.testE2eFull' | 'release.testFast' | 'release.verify' | 'release.publishChanged' | 'services.mailpitUp' | 'services.mailpitDown' | 'services.mailpitLogs' | 'data.d1MigrateLocal' | 'content.cleanupMarkdown' | 'content.cleanupMarkdownCheck' | 'tools.astro' | 'tools.syncDevvars' | 'tools.starlightPatch' | 'agents.run';
|
|
3
|
+
export type TreeseedOperationProviderId = 'default';
|
|
4
|
+
export type TreeseedOperationMetadata = {
|
|
5
|
+
id: TreeseedOperationId;
|
|
6
|
+
name: string;
|
|
7
|
+
aliases: string[];
|
|
8
|
+
group: TreeseedOperationGroup;
|
|
9
|
+
summary: string;
|
|
10
|
+
description: string;
|
|
11
|
+
provider: TreeseedOperationProviderId;
|
|
12
|
+
related?: string[];
|
|
13
|
+
};
|
|
14
|
+
export type TreeseedOperationRequest = {
|
|
15
|
+
operationName: string;
|
|
16
|
+
input?: Record<string, unknown>;
|
|
17
|
+
};
|
|
18
|
+
export type TreeseedOperationResult<TPayload = Record<string, unknown>> = {
|
|
19
|
+
operation: TreeseedOperationId;
|
|
20
|
+
ok: boolean;
|
|
21
|
+
payload?: TPayload | null;
|
|
22
|
+
meta?: Record<string, unknown>;
|
|
23
|
+
nextSteps?: Array<{
|
|
24
|
+
operation: string;
|
|
25
|
+
reason?: string;
|
|
26
|
+
input?: Record<string, unknown>;
|
|
27
|
+
}>;
|
|
28
|
+
exitCode?: number;
|
|
29
|
+
stdout?: string[];
|
|
30
|
+
stderr?: string[];
|
|
31
|
+
};
|
|
32
|
+
export type TreeseedOperationWriter = (output: string, stream?: 'stdout' | 'stderr') => void;
|
|
33
|
+
export type TreeseedOperationPrompt = (message: string) => Promise<string> | string;
|
|
34
|
+
export type TreeseedOperationConfirm = (message: string, expected: string) => Promise<boolean> | boolean;
|
|
35
|
+
export type TreeseedOperationSpawn = (command: string, args: string[], options: {
|
|
36
|
+
cwd: string;
|
|
37
|
+
env: NodeJS.ProcessEnv;
|
|
38
|
+
stdio?: 'inherit';
|
|
39
|
+
}) => {
|
|
40
|
+
status?: number | null;
|
|
41
|
+
};
|
|
42
|
+
export type TreeseedOperationContext = {
|
|
43
|
+
cwd: string;
|
|
44
|
+
env: NodeJS.ProcessEnv;
|
|
45
|
+
write?: TreeseedOperationWriter;
|
|
46
|
+
spawn?: TreeseedOperationSpawn;
|
|
47
|
+
outputFormat?: 'human' | 'json';
|
|
48
|
+
prompt?: TreeseedOperationPrompt;
|
|
49
|
+
confirm?: TreeseedOperationConfirm;
|
|
50
|
+
transport?: 'sdk' | 'cli' | 'api';
|
|
51
|
+
};
|
|
52
|
+
export type TreeseedOperationFailureCode = 'validation_failed' | 'merge_conflict' | 'missing_runtime_auth' | 'deployment_timeout' | 'confirmation_required' | 'unsupported_transport' | 'unsupported_state' | 'provider_resolution_failed';
|
|
53
|
+
export declare class TreeseedOperationError extends Error {
|
|
54
|
+
code: TreeseedOperationFailureCode;
|
|
55
|
+
operation: string;
|
|
56
|
+
details?: Record<string, unknown>;
|
|
57
|
+
exitCode?: number;
|
|
58
|
+
constructor(operation: string, code: TreeseedOperationFailureCode, message: string, options?: {
|
|
59
|
+
details?: Record<string, unknown>;
|
|
60
|
+
exitCode?: number;
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
export interface TreeseedOperationImplementation<TInput extends Record<string, unknown> = Record<string, unknown>, TPayload = Record<string, unknown>> {
|
|
64
|
+
readonly metadata: TreeseedOperationMetadata;
|
|
65
|
+
execute(input: TInput, context: TreeseedOperationContext): Promise<TreeseedOperationResult<TPayload>>;
|
|
66
|
+
}
|
|
67
|
+
export interface TreeseedOperationProvider {
|
|
68
|
+
readonly id: TreeseedOperationProviderId | string;
|
|
69
|
+
listOperations(): TreeseedOperationImplementation[];
|
|
70
|
+
findOperation(name: string | null | undefined): TreeseedOperationImplementation | null;
|
|
71
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
class TreeseedOperationError extends Error {
|
|
2
|
+
code;
|
|
3
|
+
operation;
|
|
4
|
+
details;
|
|
5
|
+
exitCode;
|
|
6
|
+
constructor(operation, code, message, options = {}) {
|
|
7
|
+
super(message);
|
|
8
|
+
this.name = "TreeseedOperationError";
|
|
9
|
+
this.operation = operation;
|
|
10
|
+
this.code = code;
|
|
11
|
+
this.details = options.details;
|
|
12
|
+
this.exitCode = options.exitCode;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
export {
|
|
16
|
+
TreeseedOperationError
|
|
17
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { TRESEED_OPERATION_SPECS, findTreeseedOperation, listTreeseedOperationNames, } from './operations-registry.ts';
|
|
2
|
+
export { TreeseedOperationsSdk } from './operations/runtime.ts';
|
|
3
|
+
export type { TreeseedOperationContext, TreeseedOperationImplementation, TreeseedOperationId, TreeseedOperationMetadata, TreeseedOperationProvider, TreeseedOperationProviderId, TreeseedOperationRequest, TreeseedOperationResult, TreeseedOperationGroup, } from './operations-types.ts';
|
|
4
|
+
export { TreeseedOperationError } from './operations-types.ts';
|
|
5
|
+
export { TreeseedWorkflowSdk } from './workflow.ts';
|
|
6
|
+
export type * from './workflow.ts';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import {
|
|
2
|
+
TRESEED_OPERATION_SPECS,
|
|
3
|
+
findTreeseedOperation,
|
|
4
|
+
listTreeseedOperationNames
|
|
5
|
+
} from "./operations-registry.js";
|
|
6
|
+
import { TreeseedOperationsSdk } from "./operations/runtime.js";
|
|
7
|
+
import { TreeseedOperationError } from "./operations-types.js";
|
|
8
|
+
import { TreeseedWorkflowSdk } from "./workflow.js";
|
|
9
|
+
export {
|
|
10
|
+
TRESEED_OPERATION_SPECS,
|
|
11
|
+
TreeseedOperationError,
|
|
12
|
+
TreeseedOperationsSdk,
|
|
13
|
+
TreeseedWorkflowSdk,
|
|
14
|
+
findTreeseedOperation,
|
|
15
|
+
listTreeseedOperationNames
|
|
16
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './utils/books-data.ts';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./utils/books-data.js";
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
export type TreeseedFeatureName = 'docs' | 'books' | 'notes' | 'questions' | 'objectives' | 'agents' | 'forms';
|
|
2
|
+
export type TreeseedContentCollection = 'pages' | 'notes' | 'questions' | 'objectives' | 'people' | 'agents' | 'books' | 'docs';
|
|
3
|
+
export interface TreeseedFeatureModules {
|
|
4
|
+
docs?: boolean;
|
|
5
|
+
books?: boolean;
|
|
6
|
+
notes?: boolean;
|
|
7
|
+
questions?: boolean;
|
|
8
|
+
objectives?: boolean;
|
|
9
|
+
agents?: boolean;
|
|
10
|
+
forms?: boolean;
|
|
11
|
+
[key: string]: boolean | undefined;
|
|
12
|
+
}
|
|
13
|
+
export interface TreeseedContentMap {
|
|
14
|
+
pages: string;
|
|
15
|
+
notes: string;
|
|
16
|
+
questions: string;
|
|
17
|
+
objectives: string;
|
|
18
|
+
people: string;
|
|
19
|
+
agents: string;
|
|
20
|
+
books: string;
|
|
21
|
+
docs: string;
|
|
22
|
+
}
|
|
23
|
+
export interface TreeseedBookDefinition {
|
|
24
|
+
order: number;
|
|
25
|
+
slug: string;
|
|
26
|
+
title: string;
|
|
27
|
+
description: string;
|
|
28
|
+
summary: string;
|
|
29
|
+
sectionLabel: string;
|
|
30
|
+
basePath: string;
|
|
31
|
+
landingPath: string;
|
|
32
|
+
outlinePath?: string;
|
|
33
|
+
downloadFileName: string;
|
|
34
|
+
downloadHref: string;
|
|
35
|
+
downloadTitle: string;
|
|
36
|
+
exportRoots?: string[];
|
|
37
|
+
sidebarItems: Array<{
|
|
38
|
+
label: string;
|
|
39
|
+
link?: string;
|
|
40
|
+
autogenerate?: {
|
|
41
|
+
directory: string;
|
|
42
|
+
};
|
|
43
|
+
items?: TreeseedBookDefinition['sidebarItems'];
|
|
44
|
+
}>;
|
|
45
|
+
tags?: string[];
|
|
46
|
+
id?: string;
|
|
47
|
+
}
|
|
48
|
+
export interface TreeseedThemeConfig {
|
|
49
|
+
surfaces?: {
|
|
50
|
+
background?: string;
|
|
51
|
+
backgroundElevated?: string;
|
|
52
|
+
backgroundSoft?: string;
|
|
53
|
+
panel?: string;
|
|
54
|
+
panelStrong?: string;
|
|
55
|
+
};
|
|
56
|
+
text?: {
|
|
57
|
+
body?: string;
|
|
58
|
+
muted?: string;
|
|
59
|
+
soft?: string;
|
|
60
|
+
};
|
|
61
|
+
border?: {
|
|
62
|
+
base?: string;
|
|
63
|
+
strong?: string;
|
|
64
|
+
grid?: string;
|
|
65
|
+
};
|
|
66
|
+
accent?: {
|
|
67
|
+
base?: string;
|
|
68
|
+
strong?: string;
|
|
69
|
+
soft?: string;
|
|
70
|
+
};
|
|
71
|
+
info?: {
|
|
72
|
+
base?: string;
|
|
73
|
+
strong?: string;
|
|
74
|
+
soft?: string;
|
|
75
|
+
};
|
|
76
|
+
warm?: {
|
|
77
|
+
base?: string;
|
|
78
|
+
strong?: string;
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
export interface TreeseedPluginReference {
|
|
82
|
+
package: string;
|
|
83
|
+
enabled?: boolean;
|
|
84
|
+
config?: Record<string, unknown>;
|
|
85
|
+
}
|
|
86
|
+
export interface TreeseedManagedServiceEnvironmentConfig {
|
|
87
|
+
baseUrl?: string;
|
|
88
|
+
domain?: string;
|
|
89
|
+
railwayEnvironment?: string;
|
|
90
|
+
}
|
|
91
|
+
export interface TreeseedManagedServiceRailwayConfig {
|
|
92
|
+
projectId?: string;
|
|
93
|
+
projectName?: string;
|
|
94
|
+
serviceId?: string;
|
|
95
|
+
serviceName?: string;
|
|
96
|
+
rootDir?: string;
|
|
97
|
+
buildCommand?: string;
|
|
98
|
+
startCommand?: string;
|
|
99
|
+
}
|
|
100
|
+
export interface TreeseedManagedServiceConfig {
|
|
101
|
+
enabled?: boolean;
|
|
102
|
+
provider?: string;
|
|
103
|
+
rootDir?: string;
|
|
104
|
+
publicBaseUrl?: string;
|
|
105
|
+
railway?: TreeseedManagedServiceRailwayConfig;
|
|
106
|
+
environments?: Partial<Record<'local' | 'staging' | 'prod', TreeseedManagedServiceEnvironmentConfig>>;
|
|
107
|
+
}
|
|
108
|
+
export interface TreeseedManagedServicesConfig {
|
|
109
|
+
api?: TreeseedManagedServiceConfig;
|
|
110
|
+
agents?: TreeseedManagedServiceConfig;
|
|
111
|
+
}
|
|
112
|
+
export interface TreeseedProviderSelections {
|
|
113
|
+
forms: string;
|
|
114
|
+
operations: string;
|
|
115
|
+
agents: {
|
|
116
|
+
execution: string;
|
|
117
|
+
mutation: string;
|
|
118
|
+
repository: string;
|
|
119
|
+
verification: string;
|
|
120
|
+
notification: string;
|
|
121
|
+
research: string;
|
|
122
|
+
};
|
|
123
|
+
deploy: string;
|
|
124
|
+
content?: {
|
|
125
|
+
docs: string;
|
|
126
|
+
};
|
|
127
|
+
site?: string;
|
|
128
|
+
}
|
|
129
|
+
export interface TreeseedDeployConfig {
|
|
130
|
+
name: string;
|
|
131
|
+
slug: string;
|
|
132
|
+
siteUrl: string;
|
|
133
|
+
contactEmail: string;
|
|
134
|
+
cloudflare: {
|
|
135
|
+
accountId: string;
|
|
136
|
+
workerName?: string;
|
|
137
|
+
};
|
|
138
|
+
plugins: TreeseedPluginReference[];
|
|
139
|
+
providers: TreeseedProviderSelections;
|
|
140
|
+
services?: TreeseedManagedServicesConfig;
|
|
141
|
+
smtp?: {
|
|
142
|
+
enabled?: boolean;
|
|
143
|
+
};
|
|
144
|
+
turnstile?: {
|
|
145
|
+
enabled?: boolean;
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
export interface TreeseedTenantConfig {
|
|
149
|
+
id: string;
|
|
150
|
+
siteConfigPath: string;
|
|
151
|
+
content: TreeseedContentMap;
|
|
152
|
+
features: TreeseedFeatureModules;
|
|
153
|
+
overrides?: {
|
|
154
|
+
pagesRoot?: string;
|
|
155
|
+
stylesRoot?: string;
|
|
156
|
+
componentsRoot?: string;
|
|
157
|
+
};
|
|
158
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { TreeseedDeployConfig } from '../contracts.ts';
|
|
2
|
+
export declare function resolveTreeseedDeployConfigPath(configPath?: string): string;
|
|
3
|
+
export declare function deriveCloudflareWorkerName(config: TreeseedDeployConfig): string;
|
|
4
|
+
export declare function loadTreeseedDeployConfig(configPath?: string): TreeseedDeployConfig;
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
2
|
+
import { dirname, resolve } from "node:path";
|
|
3
|
+
import { parse as parseYaml } from "yaml";
|
|
4
|
+
import { normalizeAliasedRecord } from "../../field-aliases.js";
|
|
5
|
+
import { resolveTreeseedTenantRoot } from "../tenant/config.js";
|
|
6
|
+
import {
|
|
7
|
+
TREESEED_DEFAULT_PLUGIN_REFERENCES,
|
|
8
|
+
TREESEED_DEFAULT_PROVIDER_SELECTIONS
|
|
9
|
+
} from "../plugins/constants.js";
|
|
10
|
+
const deployConfigFieldAliases = {
|
|
11
|
+
siteUrl: { key: "siteUrl", aliases: ["site_url"] },
|
|
12
|
+
contactEmail: { key: "contactEmail", aliases: ["contact_email"] }
|
|
13
|
+
};
|
|
14
|
+
const cloudflareFieldAliases = {
|
|
15
|
+
accountId: { key: "accountId", aliases: ["account_id"] },
|
|
16
|
+
workerName: { key: "workerName", aliases: ["worker_name"] }
|
|
17
|
+
};
|
|
18
|
+
const CLOUDFLARE_ACCOUNT_ID_PLACEHOLDER = "replace-with-cloudflare-account-id";
|
|
19
|
+
function expectString(value, label) {
|
|
20
|
+
if (typeof value !== "string" || !value.trim()) {
|
|
21
|
+
throw new Error(`Invalid deploy config: expected ${label} to be a non-empty string.`);
|
|
22
|
+
}
|
|
23
|
+
return value.trim();
|
|
24
|
+
}
|
|
25
|
+
function optionalString(value) {
|
|
26
|
+
if (typeof value !== "string" || !value.trim()) {
|
|
27
|
+
return void 0;
|
|
28
|
+
}
|
|
29
|
+
return value.trim();
|
|
30
|
+
}
|
|
31
|
+
function optionalCloudflareAccountId(value) {
|
|
32
|
+
const accountId = optionalString(value);
|
|
33
|
+
return accountId === CLOUDFLARE_ACCOUNT_ID_PLACEHOLDER ? void 0 : accountId;
|
|
34
|
+
}
|
|
35
|
+
function optionalBoolean(value, label) {
|
|
36
|
+
if (value === void 0) {
|
|
37
|
+
return void 0;
|
|
38
|
+
}
|
|
39
|
+
if (typeof value !== "boolean") {
|
|
40
|
+
throw new Error(`Invalid deploy config: expected ${label} to be a boolean when provided.`);
|
|
41
|
+
}
|
|
42
|
+
return value;
|
|
43
|
+
}
|
|
44
|
+
function optionalRecord(value, label) {
|
|
45
|
+
if (value === void 0 || value === null) {
|
|
46
|
+
return void 0;
|
|
47
|
+
}
|
|
48
|
+
if (typeof value !== "object" || Array.isArray(value)) {
|
|
49
|
+
throw new Error(`Invalid deploy config: expected ${label} to be an object when provided.`);
|
|
50
|
+
}
|
|
51
|
+
return value;
|
|
52
|
+
}
|
|
53
|
+
function parsePluginReferences(value) {
|
|
54
|
+
if (value === void 0) {
|
|
55
|
+
return [...TREESEED_DEFAULT_PLUGIN_REFERENCES];
|
|
56
|
+
}
|
|
57
|
+
if (!Array.isArray(value)) {
|
|
58
|
+
throw new Error("Invalid deploy config: expected plugins to be an array.");
|
|
59
|
+
}
|
|
60
|
+
return value.map((entry, index) => {
|
|
61
|
+
const record = optionalRecord(entry, `plugins[${index}]`);
|
|
62
|
+
return {
|
|
63
|
+
package: expectString(record?.package, `plugins[${index}].package`),
|
|
64
|
+
enabled: record?.enabled === void 0 ? true : optionalBoolean(record.enabled, `plugins[${index}].enabled`),
|
|
65
|
+
config: record?.config === void 0 ? {} : optionalRecord(record.config, `plugins[${index}].config`)
|
|
66
|
+
};
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
function parseProviderSelections(value) {
|
|
70
|
+
const record = optionalRecord(value, "providers");
|
|
71
|
+
if (!record) {
|
|
72
|
+
return structuredClone(TREESEED_DEFAULT_PROVIDER_SELECTIONS);
|
|
73
|
+
}
|
|
74
|
+
const agentProviders = optionalRecord(record.agents, "providers.agents") ?? {};
|
|
75
|
+
const contentProviders = optionalRecord(record.content, "providers.content") ?? {};
|
|
76
|
+
return {
|
|
77
|
+
forms: expectString(record.forms ?? TREESEED_DEFAULT_PROVIDER_SELECTIONS.forms, "providers.forms"),
|
|
78
|
+
operations: expectString(record.operations ?? TREESEED_DEFAULT_PROVIDER_SELECTIONS.operations, "providers.operations"),
|
|
79
|
+
agents: {
|
|
80
|
+
execution: expectString(
|
|
81
|
+
agentProviders.execution ?? TREESEED_DEFAULT_PROVIDER_SELECTIONS.agents.execution,
|
|
82
|
+
"providers.agents.execution"
|
|
83
|
+
),
|
|
84
|
+
mutation: expectString(
|
|
85
|
+
agentProviders.mutation ?? TREESEED_DEFAULT_PROVIDER_SELECTIONS.agents.mutation,
|
|
86
|
+
"providers.agents.mutation"
|
|
87
|
+
),
|
|
88
|
+
repository: expectString(
|
|
89
|
+
agentProviders.repository ?? TREESEED_DEFAULT_PROVIDER_SELECTIONS.agents.repository,
|
|
90
|
+
"providers.agents.repository"
|
|
91
|
+
),
|
|
92
|
+
verification: expectString(
|
|
93
|
+
agentProviders.verification ?? TREESEED_DEFAULT_PROVIDER_SELECTIONS.agents.verification,
|
|
94
|
+
"providers.agents.verification"
|
|
95
|
+
),
|
|
96
|
+
notification: expectString(
|
|
97
|
+
agentProviders.notification ?? TREESEED_DEFAULT_PROVIDER_SELECTIONS.agents.notification,
|
|
98
|
+
"providers.agents.notification"
|
|
99
|
+
),
|
|
100
|
+
research: expectString(
|
|
101
|
+
agentProviders.research ?? TREESEED_DEFAULT_PROVIDER_SELECTIONS.agents.research,
|
|
102
|
+
"providers.agents.research"
|
|
103
|
+
)
|
|
104
|
+
},
|
|
105
|
+
deploy: expectString(record.deploy ?? TREESEED_DEFAULT_PROVIDER_SELECTIONS.deploy, "providers.deploy"),
|
|
106
|
+
content: {
|
|
107
|
+
docs: expectString(
|
|
108
|
+
contentProviders.docs ?? TREESEED_DEFAULT_PROVIDER_SELECTIONS.content.docs,
|
|
109
|
+
"providers.content.docs"
|
|
110
|
+
)
|
|
111
|
+
},
|
|
112
|
+
site: expectString(record.site ?? TREESEED_DEFAULT_PROVIDER_SELECTIONS.site, "providers.site")
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
function parseServiceEnvironmentConfig(value, label) {
|
|
116
|
+
const record = optionalRecord(value, label) ?? {};
|
|
117
|
+
return {
|
|
118
|
+
baseUrl: optionalString(record.baseUrl),
|
|
119
|
+
domain: optionalString(record.domain),
|
|
120
|
+
railwayEnvironment: optionalString(record.railwayEnvironment)
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
function parseManagedServiceConfig(value, label) {
|
|
124
|
+
const record = optionalRecord(value, label);
|
|
125
|
+
if (!record) {
|
|
126
|
+
return void 0;
|
|
127
|
+
}
|
|
128
|
+
const railway = optionalRecord(record.railway, `${label}.railway`) ?? {};
|
|
129
|
+
const environments = optionalRecord(record.environments, `${label}.environments`) ?? {};
|
|
130
|
+
return {
|
|
131
|
+
enabled: record.enabled === void 0 ? void 0 : optionalBoolean(record.enabled, `${label}.enabled`),
|
|
132
|
+
provider: optionalString(record.provider),
|
|
133
|
+
rootDir: optionalString(record.rootDir),
|
|
134
|
+
publicBaseUrl: optionalString(record.publicBaseUrl),
|
|
135
|
+
railway: {
|
|
136
|
+
projectId: optionalString(railway.projectId),
|
|
137
|
+
projectName: optionalString(railway.projectName),
|
|
138
|
+
serviceId: optionalString(railway.serviceId),
|
|
139
|
+
serviceName: optionalString(railway.serviceName),
|
|
140
|
+
rootDir: optionalString(railway.rootDir),
|
|
141
|
+
buildCommand: optionalString(railway.buildCommand),
|
|
142
|
+
startCommand: optionalString(railway.startCommand)
|
|
143
|
+
},
|
|
144
|
+
environments: {
|
|
145
|
+
local: parseServiceEnvironmentConfig(environments.local, `${label}.environments.local`),
|
|
146
|
+
staging: parseServiceEnvironmentConfig(environments.staging, `${label}.environments.staging`),
|
|
147
|
+
prod: parseServiceEnvironmentConfig(environments.prod, `${label}.environments.prod`)
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
function parseManagedServicesConfig(value) {
|
|
152
|
+
const record = optionalRecord(value, "services");
|
|
153
|
+
if (!record) {
|
|
154
|
+
return void 0;
|
|
155
|
+
}
|
|
156
|
+
return {
|
|
157
|
+
api: parseManagedServiceConfig(record.api, "services.api"),
|
|
158
|
+
agents: parseManagedServiceConfig(record.agents, "services.agents")
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
function parseDeployConfig(raw) {
|
|
162
|
+
const parsed = normalizeAliasedRecord(
|
|
163
|
+
deployConfigFieldAliases,
|
|
164
|
+
parseYaml(raw) ?? {}
|
|
165
|
+
);
|
|
166
|
+
const cloudflare = normalizeAliasedRecord(
|
|
167
|
+
cloudflareFieldAliases,
|
|
168
|
+
optionalRecord(parsed.cloudflare, "cloudflare") ?? {}
|
|
169
|
+
);
|
|
170
|
+
const smtp = optionalRecord(parsed.smtp, "smtp") ?? {};
|
|
171
|
+
const turnstile = optionalRecord(parsed.turnstile, "turnstile") ?? {};
|
|
172
|
+
optionalBoolean(turnstile.enabled, "turnstile.enabled");
|
|
173
|
+
return {
|
|
174
|
+
name: expectString(parsed.name, "name"),
|
|
175
|
+
slug: expectString(parsed.slug, "slug"),
|
|
176
|
+
siteUrl: expectString(parsed.siteUrl, "siteUrl"),
|
|
177
|
+
contactEmail: expectString(parsed.contactEmail, "contactEmail"),
|
|
178
|
+
cloudflare: {
|
|
179
|
+
accountId: optionalCloudflareAccountId(cloudflare.accountId) ?? optionalCloudflareAccountId(process.env.CLOUDFLARE_ACCOUNT_ID) ?? CLOUDFLARE_ACCOUNT_ID_PLACEHOLDER,
|
|
180
|
+
workerName: optionalString(cloudflare.workerName)
|
|
181
|
+
},
|
|
182
|
+
plugins: parsePluginReferences(parsed.plugins),
|
|
183
|
+
providers: parseProviderSelections(parsed.providers),
|
|
184
|
+
services: parseManagedServicesConfig(parsed.services),
|
|
185
|
+
smtp: {
|
|
186
|
+
enabled: optionalBoolean(smtp.enabled, "smtp.enabled")
|
|
187
|
+
},
|
|
188
|
+
turnstile: {
|
|
189
|
+
enabled: true
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
function resolveTreeseedDeployConfigPath(configPath = "treeseed.site.yaml") {
|
|
194
|
+
const tenantRoot = resolveTreeseedTenantRoot();
|
|
195
|
+
const candidate = resolve(tenantRoot, configPath);
|
|
196
|
+
if (!existsSync(candidate)) {
|
|
197
|
+
throw new Error(`Unable to resolve Treeseed deploy config at "${candidate}".`);
|
|
198
|
+
}
|
|
199
|
+
return candidate;
|
|
200
|
+
}
|
|
201
|
+
function deriveCloudflareWorkerName(config) {
|
|
202
|
+
return config.cloudflare.workerName?.trim() || config.slug;
|
|
203
|
+
}
|
|
204
|
+
function loadTreeseedDeployConfig(configPath = "treeseed.site.yaml") {
|
|
205
|
+
const resolvedConfigPath = resolveTreeseedDeployConfigPath(configPath);
|
|
206
|
+
const tenantRoot = dirname(resolvedConfigPath);
|
|
207
|
+
const parsed = parseDeployConfig(readFileSync(resolvedConfigPath, "utf8"));
|
|
208
|
+
Object.defineProperty(parsed, "__tenantRoot", {
|
|
209
|
+
value: tenantRoot,
|
|
210
|
+
enumerable: false
|
|
211
|
+
});
|
|
212
|
+
Object.defineProperty(parsed, "__configPath", {
|
|
213
|
+
value: resolvedConfigPath,
|
|
214
|
+
enumerable: false
|
|
215
|
+
});
|
|
216
|
+
return parsed;
|
|
217
|
+
}
|
|
218
|
+
export {
|
|
219
|
+
deriveCloudflareWorkerName,
|
|
220
|
+
loadTreeseedDeployConfig,
|
|
221
|
+
resolveTreeseedDeployConfigPath
|
|
222
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './deploy/config.ts';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./deploy/config.js";
|