@treeseed/cli 0.1.1
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 +115 -0
- package/dist/cli/handlers/close.js +60 -0
- package/dist/cli/handlers/config.js +76 -0
- package/dist/cli/handlers/continue.js +23 -0
- package/dist/cli/handlers/deploy.js +139 -0
- package/dist/cli/handlers/destroy.js +94 -0
- package/dist/cli/handlers/doctor.js +48 -0
- package/dist/cli/handlers/init.js +30 -0
- package/dist/cli/handlers/next.js +27 -0
- package/dist/cli/handlers/prepare.js +8 -0
- package/dist/cli/handlers/promote.js +8 -0
- package/dist/cli/handlers/publish.js +8 -0
- package/dist/cli/handlers/release.js +60 -0
- package/dist/cli/handlers/rollback.js +163 -0
- package/dist/cli/handlers/save.js +87 -0
- package/dist/cli/handlers/setup.js +48 -0
- package/dist/cli/handlers/ship.js +49 -0
- package/dist/cli/handlers/start.js +97 -0
- package/dist/cli/handlers/status.js +31 -0
- package/dist/cli/handlers/teardown.js +50 -0
- package/dist/cli/handlers/utils.js +59 -0
- package/dist/cli/handlers/work.js +85 -0
- package/dist/cli/help.js +143 -0
- package/dist/cli/main.js +27 -0
- package/dist/cli/parser.js +96 -0
- package/dist/cli/registry.js +445 -0
- package/dist/cli/repair.js +89 -0
- package/dist/cli/runtime.js +165 -0
- package/dist/cli/types.js +0 -0
- package/dist/cli/workflow-state.js +171 -0
- package/dist/index.js +1 -0
- package/dist/scripts/aggregate-book.d.ts +1 -0
- package/dist/scripts/aggregate-book.js +121 -0
- package/dist/scripts/assert-release-tag-version.d.ts +1 -0
- package/dist/scripts/assert-release-tag-version.js +21 -0
- package/dist/scripts/build-dist.d.ts +1 -0
- package/dist/scripts/build-dist.js +108 -0
- package/dist/scripts/build-tenant-worker.d.ts +1 -0
- package/dist/scripts/build-tenant-worker.js +36 -0
- package/dist/scripts/cleanup-markdown.d.ts +2 -0
- package/dist/scripts/cleanup-markdown.js +373 -0
- package/dist/scripts/config-runtime-lib.d.ts +122 -0
- package/dist/scripts/config-runtime-lib.js +505 -0
- package/dist/scripts/config-treeseed.d.ts +2 -0
- package/dist/scripts/config-treeseed.js +81 -0
- package/dist/scripts/d1-migration-lib.d.ts +6 -0
- package/dist/scripts/d1-migration-lib.js +90 -0
- package/dist/scripts/deploy-lib.d.ts +127 -0
- package/dist/scripts/deploy-lib.js +841 -0
- package/dist/scripts/ensure-mailpit.d.ts +1 -0
- package/dist/scripts/ensure-mailpit.js +29 -0
- package/dist/scripts/git-workflow-lib.d.ts +25 -0
- package/dist/scripts/git-workflow-lib.js +136 -0
- package/dist/scripts/github-automation-lib.d.ts +156 -0
- package/dist/scripts/github-automation-lib.js +242 -0
- package/dist/scripts/local-dev-lib.d.ts +9 -0
- package/dist/scripts/local-dev-lib.js +84 -0
- package/dist/scripts/local-dev.d.ts +1 -0
- package/dist/scripts/local-dev.js +129 -0
- package/dist/scripts/logs-mailpit.d.ts +1 -0
- package/dist/scripts/logs-mailpit.js +2 -0
- package/dist/scripts/mailpit-runtime.d.ts +4 -0
- package/dist/scripts/mailpit-runtime.js +57 -0
- package/dist/scripts/package-tools.d.ts +22 -0
- package/dist/scripts/package-tools.js +255 -0
- package/dist/scripts/patch-starlight-content-path.d.ts +1 -0
- package/dist/scripts/patch-starlight-content-path.js +172 -0
- package/dist/scripts/paths.d.ts +17 -0
- package/dist/scripts/paths.js +26 -0
- package/dist/scripts/publish-package.d.ts +1 -0
- package/dist/scripts/publish-package.js +19 -0
- package/dist/scripts/release-verify.d.ts +1 -0
- package/dist/scripts/release-verify.js +136 -0
- package/dist/scripts/run-fixture-astro-command.d.ts +1 -0
- package/dist/scripts/run-fixture-astro-command.js +18 -0
- package/dist/scripts/save-deploy-preflight-lib.d.ts +34 -0
- package/dist/scripts/save-deploy-preflight-lib.js +69 -0
- package/dist/scripts/scaffold-site.d.ts +2 -0
- package/dist/scripts/scaffold-site.js +92 -0
- package/dist/scripts/stop-mailpit.d.ts +1 -0
- package/dist/scripts/stop-mailpit.js +5 -0
- package/dist/scripts/sync-dev-vars.d.ts +1 -0
- package/dist/scripts/sync-dev-vars.js +6 -0
- package/dist/scripts/template-registry-lib.d.ts +47 -0
- package/dist/scripts/template-registry-lib.js +137 -0
- package/dist/scripts/tenant-astro-command.d.ts +1 -0
- package/dist/scripts/tenant-astro-command.js +3 -0
- package/dist/scripts/tenant-build.d.ts +1 -0
- package/dist/scripts/tenant-build.js +16 -0
- package/dist/scripts/tenant-check.d.ts +1 -0
- package/dist/scripts/tenant-check.js +7 -0
- package/dist/scripts/tenant-d1-migrate-local.d.ts +1 -0
- package/dist/scripts/tenant-d1-migrate-local.js +11 -0
- package/dist/scripts/tenant-deploy.d.ts +2 -0
- package/dist/scripts/tenant-deploy.js +180 -0
- package/dist/scripts/tenant-destroy.d.ts +2 -0
- package/dist/scripts/tenant-destroy.js +104 -0
- package/dist/scripts/tenant-dev.d.ts +1 -0
- package/dist/scripts/tenant-dev.js +171 -0
- package/dist/scripts/tenant-lint.d.ts +1 -0
- package/dist/scripts/tenant-lint.js +4 -0
- package/dist/scripts/tenant-test.d.ts +1 -0
- package/dist/scripts/tenant-test.js +4 -0
- package/dist/scripts/test-cloudflare-local.d.ts +1 -0
- package/dist/scripts/test-cloudflare-local.js +212 -0
- package/dist/scripts/test-scaffold.d.ts +2 -0
- package/dist/scripts/test-scaffold.js +297 -0
- package/dist/scripts/treeseed.d.ts +2 -0
- package/dist/scripts/treeseed.js +4 -0
- package/dist/scripts/validate-templates.d.ts +2 -0
- package/dist/scripts/validate-templates.js +4 -0
- package/dist/scripts/watch-dev-lib.d.ts +21 -0
- package/dist/scripts/watch-dev-lib.js +277 -0
- package/dist/scripts/workspace-close.d.ts +2 -0
- package/dist/scripts/workspace-close.js +24 -0
- package/dist/scripts/workspace-command-e2e.d.ts +2 -0
- package/dist/scripts/workspace-command-e2e.js +718 -0
- package/dist/scripts/workspace-lint.d.ts +1 -0
- package/dist/scripts/workspace-lint.js +9 -0
- package/dist/scripts/workspace-preflight-lib.d.ts +36 -0
- package/dist/scripts/workspace-preflight-lib.js +179 -0
- package/dist/scripts/workspace-preflight.d.ts +2 -0
- package/dist/scripts/workspace-preflight.js +22 -0
- package/dist/scripts/workspace-publish-changed-packages.d.ts +1 -0
- package/dist/scripts/workspace-publish-changed-packages.js +16 -0
- package/dist/scripts/workspace-release-verify.d.ts +1 -0
- package/dist/scripts/workspace-release-verify.js +81 -0
- package/dist/scripts/workspace-release.d.ts +2 -0
- package/dist/scripts/workspace-release.js +42 -0
- package/dist/scripts/workspace-save-lib.d.ts +42 -0
- package/dist/scripts/workspace-save-lib.js +220 -0
- package/dist/scripts/workspace-save.d.ts +2 -0
- package/dist/scripts/workspace-save.js +124 -0
- package/dist/scripts/workspace-start-warning.d.ts +0 -0
- package/dist/scripts/workspace-start-warning.js +3 -0
- package/dist/scripts/workspace-start.d.ts +2 -0
- package/dist/scripts/workspace-start.js +71 -0
- package/dist/scripts/workspace-test-unit.d.ts +1 -0
- package/dist/scripts/workspace-test-unit.js +4 -0
- package/dist/scripts/workspace-test.d.ts +1 -0
- package/dist/scripts/workspace-test.js +11 -0
- package/dist/scripts/workspace-tools.d.ts +13 -0
- package/dist/scripts/workspace-tools.js +226 -0
- package/dist/src/cli/handlers/close.d.ts +2 -0
- package/dist/src/cli/handlers/config.d.ts +2 -0
- package/dist/src/cli/handlers/continue.d.ts +2 -0
- package/dist/src/cli/handlers/deploy.d.ts +2 -0
- package/dist/src/cli/handlers/destroy.d.ts +2 -0
- package/dist/src/cli/handlers/doctor.d.ts +2 -0
- package/dist/src/cli/handlers/init.d.ts +2 -0
- package/dist/src/cli/handlers/next.d.ts +2 -0
- package/dist/src/cli/handlers/prepare.d.ts +2 -0
- package/dist/src/cli/handlers/promote.d.ts +2 -0
- package/dist/src/cli/handlers/publish.d.ts +2 -0
- package/dist/src/cli/handlers/release.d.ts +2 -0
- package/dist/src/cli/handlers/rollback.d.ts +2 -0
- package/dist/src/cli/handlers/save.d.ts +2 -0
- package/dist/src/cli/handlers/setup.d.ts +2 -0
- package/dist/src/cli/handlers/ship.d.ts +2 -0
- package/dist/src/cli/handlers/start.d.ts +3 -0
- package/dist/src/cli/handlers/status.d.ts +2 -0
- package/dist/src/cli/handlers/teardown.d.ts +2 -0
- package/dist/src/cli/handlers/utils.d.ts +18 -0
- package/dist/src/cli/handlers/work.d.ts +2 -0
- package/dist/src/cli/help.d.ts +4 -0
- package/dist/src/cli/main.d.ts +6 -0
- package/dist/src/cli/parser.d.ts +3 -0
- package/dist/src/cli/registry.d.ts +27 -0
- package/dist/src/cli/repair.d.ts +6 -0
- package/dist/src/cli/runtime.d.ts +4 -0
- package/dist/src/cli/types.d.ts +71 -0
- package/dist/src/cli/workflow-state.d.ts +49 -0
- package/dist/src/index.d.ts +1 -0
- package/package.json +57 -0
|
@@ -0,0 +1,445 @@
|
|
|
1
|
+
import { handleInit } from "./handlers/init.js";
|
|
2
|
+
import { handleConfig } from "./handlers/config.js";
|
|
3
|
+
import { handleStart } from "./handlers/start.js";
|
|
4
|
+
import { handleClose } from "./handlers/close.js";
|
|
5
|
+
import { handleDeploy } from "./handlers/deploy.js";
|
|
6
|
+
import { handleSave } from "./handlers/save.js";
|
|
7
|
+
import { handleRelease } from "./handlers/release.js";
|
|
8
|
+
import { handleDestroy } from "./handlers/destroy.js";
|
|
9
|
+
import { handleStatus } from "./handlers/status.js";
|
|
10
|
+
import { handleNext } from "./handlers/next.js";
|
|
11
|
+
import { handleDoctor } from "./handlers/doctor.js";
|
|
12
|
+
import { handleSetup } from "./handlers/setup.js";
|
|
13
|
+
import { handleWork } from "./handlers/work.js";
|
|
14
|
+
import { handleShip } from "./handlers/ship.js";
|
|
15
|
+
import { handlePrepare } from "./handlers/prepare.js";
|
|
16
|
+
import { handlePublish } from "./handlers/publish.js";
|
|
17
|
+
import { handlePromote } from "./handlers/promote.js";
|
|
18
|
+
import { handleTeardown } from "./handlers/teardown.js";
|
|
19
|
+
import { handleContinue } from "./handlers/continue.js";
|
|
20
|
+
import { handleRollback } from "./handlers/rollback.js";
|
|
21
|
+
const COMMAND_HANDLERS = {
|
|
22
|
+
init: handleInit,
|
|
23
|
+
config: handleConfig,
|
|
24
|
+
start: handleStart,
|
|
25
|
+
close: handleClose,
|
|
26
|
+
deploy: handleDeploy,
|
|
27
|
+
save: handleSave,
|
|
28
|
+
release: handleRelease,
|
|
29
|
+
destroy: handleDestroy,
|
|
30
|
+
status: handleStatus,
|
|
31
|
+
next: handleNext,
|
|
32
|
+
doctor: handleDoctor,
|
|
33
|
+
setup: handleSetup,
|
|
34
|
+
work: handleWork,
|
|
35
|
+
ship: handleShip,
|
|
36
|
+
prepare: handlePrepare,
|
|
37
|
+
publish: handlePublish,
|
|
38
|
+
promote: handlePromote,
|
|
39
|
+
teardown: handleTeardown,
|
|
40
|
+
continue: handleContinue,
|
|
41
|
+
rollback: handleRollback
|
|
42
|
+
};
|
|
43
|
+
function command(spec) {
|
|
44
|
+
return spec;
|
|
45
|
+
}
|
|
46
|
+
const TRESEED_COMMAND_SPECS = [
|
|
47
|
+
command({
|
|
48
|
+
name: "setup",
|
|
49
|
+
aliases: [],
|
|
50
|
+
group: "Workflow",
|
|
51
|
+
summary: "Bootstrap the local Treeseed workspace and environments.",
|
|
52
|
+
description: "Run safe local repairs, initialize local configuration, and prepare the selected environments for development and release work.",
|
|
53
|
+
usage: "treeseed setup [--environment <local|staging|prod>]... [--sync <none|github|cloudflare|all>] [--json]",
|
|
54
|
+
options: [
|
|
55
|
+
{ name: "environment", flags: "--environment <scope>", description: "Limit setup to local, staging, or prod.", kind: "enum", repeatable: true, values: ["local", "staging", "prod"] },
|
|
56
|
+
{ name: "sync", flags: "--sync <mode>", description: "Optionally sync GitHub or Cloudflare settings.", kind: "enum", values: ["none", "github", "cloudflare", "all"] },
|
|
57
|
+
{ name: "json", flags: "--json", description: "Emit machine-readable JSON instead of human-readable text.", kind: "boolean" }
|
|
58
|
+
],
|
|
59
|
+
examples: ["treeseed setup", "treeseed setup --environment local --environment staging"],
|
|
60
|
+
related: ["doctor", "prepare", "dev"],
|
|
61
|
+
executionMode: "handler",
|
|
62
|
+
handlerName: "setup"
|
|
63
|
+
}),
|
|
64
|
+
command({
|
|
65
|
+
name: "work",
|
|
66
|
+
aliases: [],
|
|
67
|
+
group: "Workflow",
|
|
68
|
+
summary: "Create or resume a feature branch from the workflow state.",
|
|
69
|
+
description: "Create a new feature branch from staging or resume an existing branch, optionally provisioning a preview deployment.",
|
|
70
|
+
usage: "treeseed work <branch-name> [--preview] [--json]",
|
|
71
|
+
arguments: [{ name: "branch-name", description: "Feature branch to create or resume.", required: true }],
|
|
72
|
+
options: [
|
|
73
|
+
{ name: "preview", flags: "--preview", description: "Provision or refresh a branch-scoped Cloudflare preview environment.", kind: "boolean" },
|
|
74
|
+
{ name: "json", flags: "--json", description: "Emit machine-readable JSON instead of human-readable text.", kind: "boolean" }
|
|
75
|
+
],
|
|
76
|
+
examples: ["treeseed work feature/search-improvements", "treeseed work feature/search-improvements --preview"],
|
|
77
|
+
related: ["ship", "publish", "teardown"],
|
|
78
|
+
executionMode: "handler",
|
|
79
|
+
handlerName: "work"
|
|
80
|
+
}),
|
|
81
|
+
command({
|
|
82
|
+
name: "ship",
|
|
83
|
+
aliases: [],
|
|
84
|
+
group: "Workflow",
|
|
85
|
+
summary: "Persist and publish the current branch at the intent level.",
|
|
86
|
+
description: "Commit and push the current branch, refreshing a branch preview when one is enabled.",
|
|
87
|
+
usage: "treeseed ship [--hotfix] <message> [--json]",
|
|
88
|
+
arguments: [{ name: "message", description: "Git commit message for the ship operation.", required: true, kind: "message_tail" }],
|
|
89
|
+
options: [
|
|
90
|
+
{ name: "hotfix", flags: "--hotfix", description: "Allow ship on main for an explicit hotfix.", kind: "boolean" },
|
|
91
|
+
{ name: "json", flags: "--json", description: "Emit machine-readable JSON instead of human-readable text.", kind: "boolean" }
|
|
92
|
+
],
|
|
93
|
+
examples: ['treeseed ship "feat: add search filters"'],
|
|
94
|
+
related: ["work", "publish", "promote"],
|
|
95
|
+
executionMode: "handler",
|
|
96
|
+
handlerName: "ship"
|
|
97
|
+
}),
|
|
98
|
+
command({
|
|
99
|
+
name: "prepare",
|
|
100
|
+
aliases: [],
|
|
101
|
+
group: "Workflow",
|
|
102
|
+
summary: "Prepare persistent environments for later publication.",
|
|
103
|
+
description: "Alias for persistent environment setup and validation.",
|
|
104
|
+
usage: "treeseed prepare [--environment <local|staging|prod>]... [--sync <none|github|cloudflare|all>] [--json]",
|
|
105
|
+
options: [
|
|
106
|
+
{ name: "environment", flags: "--environment <scope>", description: "Limit preparation to local, staging, or prod.", kind: "enum", repeatable: true, values: ["local", "staging", "prod"] },
|
|
107
|
+
{ name: "sync", flags: "--sync <mode>", description: "Optionally sync GitHub or Cloudflare settings.", kind: "enum", values: ["none", "github", "cloudflare", "all"] },
|
|
108
|
+
{ name: "json", flags: "--json", description: "Emit machine-readable JSON instead of human-readable text.", kind: "boolean" }
|
|
109
|
+
],
|
|
110
|
+
examples: ["treeseed prepare --environment staging --environment prod"],
|
|
111
|
+
related: ["setup", "publish", "config"],
|
|
112
|
+
executionMode: "handler",
|
|
113
|
+
handlerName: "prepare"
|
|
114
|
+
}),
|
|
115
|
+
command({
|
|
116
|
+
name: "publish",
|
|
117
|
+
aliases: [],
|
|
118
|
+
group: "Workflow",
|
|
119
|
+
summary: "Publish the current site or preview target.",
|
|
120
|
+
description: "Alias for environment or branch publication using an already initialized target.",
|
|
121
|
+
usage: "treeseed publish --environment <local|staging|prod> [--dry-run] [--only <migrate|build|publish>] [--json]\n treeseed publish --target-branch <branch> [--dry-run] [--only <migrate|build|publish>] [--json]",
|
|
122
|
+
options: [
|
|
123
|
+
{ name: "environment", flags: "--environment <scope>", description: "Publish to local, staging, or prod.", kind: "enum", values: ["local", "staging", "prod"] },
|
|
124
|
+
{ name: "targetBranch", flags: "--target-branch <branch>", description: "Publish a branch preview target.", kind: "string" },
|
|
125
|
+
{ name: "dryRun", flags: "--dry-run", description: "Show what would run without publishing changes.", kind: "boolean" },
|
|
126
|
+
{ name: "only", flags: "--only <step>", description: "Limit execution to migrate, build, or publish.", kind: "enum", values: ["migrate", "build", "publish"] },
|
|
127
|
+
{ name: "name", flags: "--name <label>", description: "Attach a friendly label to the publish run.", kind: "string" },
|
|
128
|
+
{ name: "json", flags: "--json", description: "Emit machine-readable JSON instead of human-readable text.", kind: "boolean" }
|
|
129
|
+
],
|
|
130
|
+
examples: ["treeseed publish --environment staging", "treeseed publish --target-branch feature/search-improvements"],
|
|
131
|
+
related: ["prepare", "ship", "rollback"],
|
|
132
|
+
executionMode: "handler",
|
|
133
|
+
handlerName: "publish"
|
|
134
|
+
}),
|
|
135
|
+
command({
|
|
136
|
+
name: "promote",
|
|
137
|
+
aliases: [],
|
|
138
|
+
group: "Workflow",
|
|
139
|
+
summary: "Promote staging to production with a version bump.",
|
|
140
|
+
description: "Alias for the production promotion workflow built on top of Treeseed release.",
|
|
141
|
+
usage: "treeseed promote --major|--minor|--patch [--json]",
|
|
142
|
+
options: [
|
|
143
|
+
{ name: "major", flags: "--major", description: "Bump to the next major version.", kind: "boolean" },
|
|
144
|
+
{ name: "minor", flags: "--minor", description: "Bump to the next minor version.", kind: "boolean" },
|
|
145
|
+
{ name: "patch", flags: "--patch", description: "Bump to the next patch version.", kind: "boolean" },
|
|
146
|
+
{ name: "json", flags: "--json", description: "Emit machine-readable JSON instead of human-readable text.", kind: "boolean" }
|
|
147
|
+
],
|
|
148
|
+
examples: ["treeseed promote --patch"],
|
|
149
|
+
related: ["publish", "rollback", "release"],
|
|
150
|
+
executionMode: "handler",
|
|
151
|
+
handlerName: "promote"
|
|
152
|
+
}),
|
|
153
|
+
command({
|
|
154
|
+
name: "rollback",
|
|
155
|
+
aliases: [],
|
|
156
|
+
group: "Workflow",
|
|
157
|
+
summary: "Roll back staging or production to a recorded deployment.",
|
|
158
|
+
description: "Redeploy a previously recorded staging or production commit using a temporary checkout of that revision.",
|
|
159
|
+
usage: "treeseed rollback <staging|prod> [--to <deploy-id|commit>] [--json]",
|
|
160
|
+
arguments: [{ name: "environment", description: "The persistent environment to roll back.", required: true }],
|
|
161
|
+
options: [
|
|
162
|
+
{ name: "to", flags: "--to <deploy-id|commit>", description: "Explicit commit to roll back to. Defaults to the previous recorded deployment when omitted.", kind: "string" },
|
|
163
|
+
{ name: "json", flags: "--json", description: "Emit machine-readable JSON instead of human-readable text.", kind: "boolean" }
|
|
164
|
+
],
|
|
165
|
+
examples: ["treeseed rollback staging", "treeseed rollback prod --to abc1234"],
|
|
166
|
+
related: ["publish", "promote", "status"],
|
|
167
|
+
executionMode: "handler",
|
|
168
|
+
handlerName: "rollback"
|
|
169
|
+
}),
|
|
170
|
+
command({
|
|
171
|
+
name: "teardown",
|
|
172
|
+
aliases: [],
|
|
173
|
+
group: "Workflow",
|
|
174
|
+
summary: "Clean up a feature branch or destroy a persistent environment.",
|
|
175
|
+
description: "Close the current feature branch or destroy a selected persistent environment when `--environment` is provided.",
|
|
176
|
+
usage: "treeseed teardown [--environment <local|staging|prod>] [--dry-run] [--json]",
|
|
177
|
+
options: [
|
|
178
|
+
{ name: "environment", flags: "--environment <scope>", description: "Destroy a persistent environment instead of closing the current feature branch.", kind: "enum", values: ["local", "staging", "prod"] },
|
|
179
|
+
{ name: "dryRun", flags: "--dry-run", description: "Preview the teardown operation without mutating state.", kind: "boolean" },
|
|
180
|
+
{ name: "force", flags: "--force", description: "Force worker deletion when supported.", kind: "boolean" },
|
|
181
|
+
{ name: "skipConfirmation", flags: "--skip-confirmation", description: "Skip the interactive confirmation prompt for persistent destroys.", kind: "boolean" },
|
|
182
|
+
{ name: "confirm", flags: "--confirm <slug>", description: "Provide the expected slug confirmation non-interactively.", kind: "string" },
|
|
183
|
+
{ name: "removeBuildArtifacts", flags: "--remove-build-artifacts", description: "Also remove local build artifacts after destroy.", kind: "boolean" },
|
|
184
|
+
{ name: "json", flags: "--json", description: "Emit machine-readable JSON instead of human-readable text.", kind: "boolean" }
|
|
185
|
+
],
|
|
186
|
+
examples: ["treeseed teardown", "treeseed teardown --environment staging --dry-run"],
|
|
187
|
+
related: ["work", "rollback", "destroy"],
|
|
188
|
+
executionMode: "handler",
|
|
189
|
+
handlerName: "teardown"
|
|
190
|
+
}),
|
|
191
|
+
command({
|
|
192
|
+
name: "continue",
|
|
193
|
+
aliases: [],
|
|
194
|
+
group: "Workflow",
|
|
195
|
+
summary: "Show the safest next Treeseed step from the current state.",
|
|
196
|
+
description: "Use the workflow-state resolver to return the top recommended next action.",
|
|
197
|
+
usage: "treeseed continue [--json]",
|
|
198
|
+
options: [{ name: "json", flags: "--json", description: "Emit machine-readable JSON instead of human-readable text.", kind: "boolean" }],
|
|
199
|
+
examples: ["treeseed continue"],
|
|
200
|
+
related: ["status", "next", "doctor"],
|
|
201
|
+
executionMode: "handler",
|
|
202
|
+
handlerName: "continue"
|
|
203
|
+
}),
|
|
204
|
+
command({
|
|
205
|
+
name: "status",
|
|
206
|
+
aliases: [],
|
|
207
|
+
group: "Workflow",
|
|
208
|
+
summary: "Show the current Treeseed workflow state.",
|
|
209
|
+
description: "Report the current branch, environment mapping, initialization state, preview state, and auth readiness.",
|
|
210
|
+
usage: "treeseed status [--json]",
|
|
211
|
+
options: [{ name: "json", flags: "--json", description: "Emit machine-readable JSON instead of human-readable text.", kind: "boolean" }],
|
|
212
|
+
examples: ["treeseed status", "treeseed status --json"],
|
|
213
|
+
related: ["next", "continue", "doctor"],
|
|
214
|
+
executionMode: "handler",
|
|
215
|
+
handlerName: "status"
|
|
216
|
+
}),
|
|
217
|
+
command({
|
|
218
|
+
name: "next",
|
|
219
|
+
aliases: [],
|
|
220
|
+
group: "Workflow",
|
|
221
|
+
summary: "Recommend the next Treeseed commands for the current state.",
|
|
222
|
+
description: "Inspect the current branch and environment state, then suggest the most likely next commands.",
|
|
223
|
+
usage: "treeseed next [--json]",
|
|
224
|
+
options: [{ name: "json", flags: "--json", description: "Emit machine-readable JSON instead of human-readable text.", kind: "boolean" }],
|
|
225
|
+
examples: ["treeseed next", "treeseed next --json"],
|
|
226
|
+
related: ["status", "continue", "work"],
|
|
227
|
+
executionMode: "handler",
|
|
228
|
+
handlerName: "next"
|
|
229
|
+
}),
|
|
230
|
+
command({
|
|
231
|
+
name: "doctor",
|
|
232
|
+
aliases: [],
|
|
233
|
+
group: "Validation",
|
|
234
|
+
summary: "Diagnose Treeseed tooling, auth, and workflow readiness.",
|
|
235
|
+
description: "Validate local prerequisites, auth state, repository shape, and generated Treeseed files needed for development and release work.",
|
|
236
|
+
usage: "treeseed doctor [--fix] [--json]",
|
|
237
|
+
options: [
|
|
238
|
+
{ name: "fix", flags: "--fix", description: "Apply safe local repairs before rerunning diagnostics.", kind: "boolean" },
|
|
239
|
+
{ name: "json", flags: "--json", description: "Emit machine-readable JSON instead of human-readable text.", kind: "boolean" }
|
|
240
|
+
],
|
|
241
|
+
examples: ["treeseed doctor", "treeseed doctor --fix --json"],
|
|
242
|
+
related: ["status", "next", "setup"],
|
|
243
|
+
executionMode: "handler",
|
|
244
|
+
handlerName: "doctor"
|
|
245
|
+
}),
|
|
246
|
+
command({
|
|
247
|
+
name: "init",
|
|
248
|
+
aliases: [],
|
|
249
|
+
group: "Workflow",
|
|
250
|
+
summary: "Scaffold a new Treeseed tenant project.",
|
|
251
|
+
description: "Create a new Treeseed tenant directory with starter files and recommended next steps.",
|
|
252
|
+
usage: "treeseed init <directory> [--template <starter-id>] [--name <site-name>] [--slug <slug>] [--site-url <url>] [--contact-email <email>] [--repo <url>] [--discord <url>]",
|
|
253
|
+
arguments: [{ name: "directory", description: "Target directory for the new tenant.", required: true }],
|
|
254
|
+
options: [
|
|
255
|
+
{ name: "template", flags: "--template <starter-id>", description: "Select the starter template id to generate. Defaults to starter-basic.", kind: "string" },
|
|
256
|
+
{ name: "name", flags: "--name <site-name>", description: "Override the generated site name.", kind: "string" },
|
|
257
|
+
{ name: "slug", flags: "--slug <slug>", description: "Override the generated package and tenant slug.", kind: "string" },
|
|
258
|
+
{ name: "siteUrl", flags: "--site-url <url>", description: "Set the initial public site URL.", kind: "string" },
|
|
259
|
+
{ name: "contactEmail", flags: "--contact-email <email>", description: "Set the site contact address.", kind: "string" },
|
|
260
|
+
{ name: "repo", flags: "--repo <url>", description: "Set the repository URL.", kind: "string" },
|
|
261
|
+
{ name: "discord", flags: "--discord <url>", description: "Set the Discord/community URL.", kind: "string" }
|
|
262
|
+
],
|
|
263
|
+
examples: ['treeseed init docs-site --template starter-basic --name "Docs Site" --site-url https://docs.example.com'],
|
|
264
|
+
notes: ["Runs outside an existing repo or from any branch."],
|
|
265
|
+
related: ["config", "start", "deploy"],
|
|
266
|
+
executionMode: "handler",
|
|
267
|
+
handlerName: "init"
|
|
268
|
+
}),
|
|
269
|
+
command({
|
|
270
|
+
name: "config",
|
|
271
|
+
aliases: [],
|
|
272
|
+
group: "Workflow",
|
|
273
|
+
summary: "Validate and initialize persistent environments.",
|
|
274
|
+
description: "Collect environment values, write local machine config, generate local env files, and perform phase-1 initialization.",
|
|
275
|
+
usage: "treeseed config [--environment <local|staging|prod>]... [--sync <none|github|cloudflare|all>]",
|
|
276
|
+
options: [
|
|
277
|
+
{ name: "environment", flags: "--environment <scope>", description: "Limit configuration to local, staging, or prod.", kind: "enum", repeatable: true, values: ["local", "staging", "prod"] },
|
|
278
|
+
{ name: "sync", flags: "--sync <mode>", description: "Optionally sync GitHub or Cloudflare settings.", kind: "enum", values: ["none", "github", "cloudflare", "all"] },
|
|
279
|
+
{ name: "json", flags: "--json", description: "Emit machine-readable JSON instead of human-readable text.", kind: "boolean" }
|
|
280
|
+
],
|
|
281
|
+
examples: ["treeseed config --environment local", "treeseed config --environment staging --environment prod", "treeseed config --environment prod --sync all"],
|
|
282
|
+
notes: ["Compatibility command. Prefer `treeseed prepare` or `treeseed setup` for the simplified workflow.", "Does not create branch preview deployments."],
|
|
283
|
+
related: ["prepare", "setup", "publish"],
|
|
284
|
+
executionMode: "handler",
|
|
285
|
+
handlerName: "config"
|
|
286
|
+
}),
|
|
287
|
+
command({
|
|
288
|
+
name: "start",
|
|
289
|
+
aliases: [],
|
|
290
|
+
group: "Workflow",
|
|
291
|
+
summary: "Create a feature branch from the latest staging commit.",
|
|
292
|
+
description: "Switch to the latest staging branch, create a feature branch, and optionally provision a preview deployment.",
|
|
293
|
+
usage: "treeseed start <branch-name> [--preview]",
|
|
294
|
+
arguments: [{ name: "branch-name", description: "Feature branch to create from staging.", required: true }],
|
|
295
|
+
options: [
|
|
296
|
+
{ name: "preview", flags: "--preview", description: "Create and publish a branch-scoped Cloudflare preview environment.", kind: "boolean" },
|
|
297
|
+
{ name: "json", flags: "--json", description: "Emit machine-readable JSON instead of human-readable text.", kind: "boolean" }
|
|
298
|
+
],
|
|
299
|
+
examples: ["treeseed start feature/search-improvements", "treeseed start feature/search-improvements --preview"],
|
|
300
|
+
notes: ["Compatibility command. Prefer `treeseed work` for the simplified workflow.", "Refuses to run with a dirty worktree or if the branch already exists."],
|
|
301
|
+
related: ["work", "ship", "publish"],
|
|
302
|
+
executionMode: "handler",
|
|
303
|
+
handlerName: "start"
|
|
304
|
+
}),
|
|
305
|
+
command({
|
|
306
|
+
name: "close",
|
|
307
|
+
aliases: [],
|
|
308
|
+
group: "Workflow",
|
|
309
|
+
summary: "Merge the current feature branch into staging and clean it up.",
|
|
310
|
+
description: "Validate the current feature branch, merge it into staging, and remove any preview artifacts for that branch.",
|
|
311
|
+
usage: "treeseed close",
|
|
312
|
+
options: [{ name: "json", flags: "--json", description: "Emit machine-readable JSON instead of human-readable text.", kind: "boolean" }],
|
|
313
|
+
examples: ["treeseed close"],
|
|
314
|
+
notes: ["Compatibility command. Prefer `treeseed teardown` for the simplified workflow.", "Only works on feature branches.", "Refuses to run on staging or main."],
|
|
315
|
+
related: ["work", "ship", "teardown"],
|
|
316
|
+
executionMode: "handler",
|
|
317
|
+
handlerName: "close"
|
|
318
|
+
}),
|
|
319
|
+
command({
|
|
320
|
+
name: "deploy",
|
|
321
|
+
aliases: [],
|
|
322
|
+
group: "Workflow",
|
|
323
|
+
summary: "Run phase-2 deploy for an initialized target.",
|
|
324
|
+
description: "Validate readiness, run migrations, build, and publish to an initialized persistent environment or branch preview.",
|
|
325
|
+
usage: "treeseed deploy --environment <local|staging|prod> [--dry-run] [--only <migrate|build|publish>] [--name <label>]\n treeseed deploy --target-branch <branch> [--dry-run] [--only <migrate|build|publish>]",
|
|
326
|
+
options: [
|
|
327
|
+
{ name: "environment", flags: "--environment <scope>", description: "Deploy to local, staging, or prod.", kind: "enum", values: ["local", "staging", "prod"] },
|
|
328
|
+
{ name: "targetBranch", flags: "--target-branch <branch>", description: "Deploy a previously initialized branch preview target.", kind: "string" },
|
|
329
|
+
{ name: "dryRun", flags: "--dry-run", description: "Show what would run without publishing changes.", kind: "boolean" },
|
|
330
|
+
{ name: "only", flags: "--only <step>", description: "Limit execution to migrate, build, or publish.", kind: "enum", values: ["migrate", "build", "publish"] },
|
|
331
|
+
{ name: "name", flags: "--name <label>", description: "Attach a friendly label to the deploy run.", kind: "string" },
|
|
332
|
+
{ name: "json", flags: "--json", description: "Emit machine-readable JSON instead of human-readable text.", kind: "boolean" }
|
|
333
|
+
],
|
|
334
|
+
examples: ["treeseed deploy --environment staging", "treeseed deploy --environment prod --dry-run", "treeseed deploy --target-branch feature/search-improvements"],
|
|
335
|
+
notes: ["Compatibility command. Prefer `treeseed publish` for the simplified workflow.", "Persistent environments must already be initialized by treeseed config.", "CI may infer staging from `staging` and production from `main`."],
|
|
336
|
+
related: ["publish", "prepare", "rollback"],
|
|
337
|
+
executionMode: "handler",
|
|
338
|
+
handlerName: "deploy"
|
|
339
|
+
}),
|
|
340
|
+
command({
|
|
341
|
+
name: "save",
|
|
342
|
+
aliases: [],
|
|
343
|
+
group: "Workflow",
|
|
344
|
+
summary: "Commit and push the current branch.",
|
|
345
|
+
description: "Run validation, create a git commit from the current branch, and push that branch without performing merges or releases.",
|
|
346
|
+
usage: "treeseed save [--hotfix] <message>",
|
|
347
|
+
arguments: [{ name: "message", description: "Git commit message for the save operation.", required: true, kind: "message_tail" }],
|
|
348
|
+
options: [
|
|
349
|
+
{ name: "hotfix", flags: "--hotfix", description: "Allow save on main for an explicit hotfix.", kind: "boolean" },
|
|
350
|
+
{ name: "json", flags: "--json", description: "Emit machine-readable JSON instead of human-readable text.", kind: "boolean" }
|
|
351
|
+
],
|
|
352
|
+
examples: ['treeseed save "feat: add search filters"', 'treeseed save --hotfix "fix: unblock production form submit"'],
|
|
353
|
+
notes: ["Compatibility command. Prefer `treeseed ship` for the simplified workflow.", "Blocked on main unless --hotfix is provided."],
|
|
354
|
+
related: ["ship", "work", "promote"],
|
|
355
|
+
executionMode: "handler",
|
|
356
|
+
handlerName: "save"
|
|
357
|
+
}),
|
|
358
|
+
command({
|
|
359
|
+
name: "release",
|
|
360
|
+
aliases: [],
|
|
361
|
+
group: "Workflow",
|
|
362
|
+
summary: "Promote staging to production with a version bump.",
|
|
363
|
+
description: "Validate staging, apply exactly one version bump, merge staging into main, and rely on CI to deploy production.",
|
|
364
|
+
usage: "treeseed release --major|--minor|--patch",
|
|
365
|
+
options: [
|
|
366
|
+
{ name: "major", flags: "--major", description: "Bump to the next major version.", kind: "boolean" },
|
|
367
|
+
{ name: "minor", flags: "--minor", description: "Bump to the next minor version.", kind: "boolean" },
|
|
368
|
+
{ name: "patch", flags: "--patch", description: "Bump to the next patch version.", kind: "boolean" },
|
|
369
|
+
{ name: "json", flags: "--json", description: "Emit machine-readable JSON instead of human-readable text.", kind: "boolean" }
|
|
370
|
+
],
|
|
371
|
+
examples: ["treeseed release --patch", "treeseed release --minor"],
|
|
372
|
+
notes: ["Compatibility command. Prefer `treeseed promote` for the simplified workflow.", "Requires exactly one bump flag."],
|
|
373
|
+
related: ["promote", "publish", "rollback"],
|
|
374
|
+
executionMode: "handler",
|
|
375
|
+
handlerName: "release"
|
|
376
|
+
}),
|
|
377
|
+
command({
|
|
378
|
+
name: "destroy",
|
|
379
|
+
aliases: [],
|
|
380
|
+
group: "Workflow",
|
|
381
|
+
summary: "Destroy a persistent environment and its local state.",
|
|
382
|
+
description: "Delete the selected persistent environment resources and remove the local deploy state after confirmation.",
|
|
383
|
+
usage: "treeseed destroy --environment <local|staging|prod> [--dry-run] [--force] [--skip-confirmation] [--confirm <slug>] [--remove-build-artifacts]",
|
|
384
|
+
options: [
|
|
385
|
+
{ name: "environment", flags: "--environment <scope>", description: "Select the persistent environment to destroy.", kind: "enum", values: ["local", "staging", "prod"] },
|
|
386
|
+
{ name: "dryRun", flags: "--dry-run", description: "Preview the destroy operation.", kind: "boolean" },
|
|
387
|
+
{ name: "force", flags: "--force", description: "Force worker deletion when supported.", kind: "boolean" },
|
|
388
|
+
{ name: "skipConfirmation", flags: "--skip-confirmation", description: "Skip the interactive confirmation prompt.", kind: "boolean" },
|
|
389
|
+
{ name: "confirm", flags: "--confirm <slug>", description: "Provide the expected slug confirmation non-interactively.", kind: "string" },
|
|
390
|
+
{ name: "removeBuildArtifacts", flags: "--remove-build-artifacts", description: "Also remove local build artifacts after destroy.", kind: "boolean" },
|
|
391
|
+
{ name: "json", flags: "--json", description: "Emit machine-readable JSON instead of human-readable text.", kind: "boolean" }
|
|
392
|
+
],
|
|
393
|
+
examples: ["treeseed destroy --environment staging --dry-run", "treeseed destroy --environment prod --confirm example --skip-confirmation"],
|
|
394
|
+
notes: ["Compatibility command. Prefer `treeseed teardown --environment ...` for the simplified workflow.", "Only for persistent environments. Branch cleanup belongs to treeseed close.", "This command is destructive and requires explicit confirmation."],
|
|
395
|
+
related: ["teardown", "prepare", "publish"],
|
|
396
|
+
executionMode: "handler",
|
|
397
|
+
handlerName: "destroy"
|
|
398
|
+
}),
|
|
399
|
+
command({ name: "dev", aliases: [], group: "Local Development", summary: "Start the unified local Treeseed development environment.", description: "Start the unified local Treeseed development environment.", examples: ["treeseed dev"], executionMode: "adapter", adapter: { script: "tenant-dev" } }),
|
|
400
|
+
command({ name: "dev:watch", aliases: [], group: "Local Development", summary: "Start local development with rebuild/watch mode.", description: "Start local development with rebuild/watch mode.", examples: ["treeseed dev:watch"], executionMode: "adapter", adapter: { script: "tenant-dev", rewriteArgs: (args) => ["--watch", ...args] } }),
|
|
401
|
+
command({ name: "build", aliases: [], group: "Local Development", summary: "Build the tenant site and generated worker artifacts.", description: "Build the tenant site and generated worker artifacts.", examples: ["treeseed build"], executionMode: "adapter", adapter: { script: "tenant-build" } }),
|
|
402
|
+
command({ name: "check", aliases: [], group: "Local Development", summary: "Run the tenant check flow.", description: "Run the tenant check flow.", examples: ["treeseed check"], executionMode: "adapter", adapter: { script: "tenant-check" } }),
|
|
403
|
+
command({ name: "preview", aliases: [], group: "Local Development", summary: "Preview the built tenant site locally.", description: "Preview the built tenant site locally.", examples: ["treeseed preview"], executionMode: "adapter", adapter: { script: "tenant-astro-command", passthroughArgs: true } }),
|
|
404
|
+
command({ name: "lint", aliases: [], group: "Validation", summary: "Run Treeseed lint checks.", description: "Run Treeseed lint checks.", examples: ["treeseed lint"], executionMode: "adapter", adapter: { directScript: "tenant-lint", workspaceScript: "workspace-lint" } }),
|
|
405
|
+
command({ name: "test", aliases: [], group: "Validation", summary: "Run Treeseed tests.", description: "Run Treeseed tests.", examples: ["treeseed test"], executionMode: "adapter", adapter: { directScript: "tenant-test", workspaceScript: "workspace-test" } }),
|
|
406
|
+
command({ name: "test:unit", aliases: [], group: "Validation", summary: "Run workspace unit tests in dependency order.", description: "Run workspace unit tests in dependency order.", examples: ["treeseed test:unit"], executionMode: "adapter", adapter: { script: "workspace-test-unit", requireWorkspaceRoot: true } }),
|
|
407
|
+
command({ name: "preflight", aliases: [], group: "Validation", summary: "Check local CLI prerequisites and authentication state.", description: "Check local CLI prerequisites and authentication state.", examples: ["treeseed preflight"], executionMode: "adapter", adapter: { script: "workspace-preflight", requireWorkspaceRoot: true } }),
|
|
408
|
+
command({ name: "auth:check", aliases: [], group: "Validation", summary: "Check CLI prerequisites and require authenticated tooling.", description: "Check CLI prerequisites and require authenticated tooling.", examples: ["treeseed auth:check"], executionMode: "adapter", adapter: { script: "workspace-preflight", extraArgs: ["--require-auth"], requireWorkspaceRoot: true } }),
|
|
409
|
+
command({ name: "test:e2e", aliases: [], group: "Release Utilities", summary: "Run Treeseed end-to-end command tests.", description: "Run Treeseed end-to-end command tests.", examples: ["treeseed test:e2e"], executionMode: "adapter", adapter: { script: "workspace-command-e2e", requireWorkspaceRoot: true } }),
|
|
410
|
+
command({ name: "test:e2e:local", aliases: [], group: "Release Utilities", summary: "Run local-mode Treeseed end-to-end command tests.", description: "Run local-mode Treeseed end-to-end command tests.", examples: ["treeseed test:e2e:local"], executionMode: "adapter", adapter: { script: "workspace-command-e2e", extraArgs: ["--mode=local"], requireWorkspaceRoot: true } }),
|
|
411
|
+
command({ name: "test:e2e:staging", aliases: [], group: "Release Utilities", summary: "Run staging-mode Treeseed end-to-end command tests.", description: "Run staging-mode Treeseed end-to-end command tests.", examples: ["treeseed test:e2e:staging"], executionMode: "adapter", adapter: { script: "workspace-command-e2e", extraArgs: ["--mode=staging"], requireWorkspaceRoot: true } }),
|
|
412
|
+
command({ name: "test:e2e:full", aliases: [], group: "Release Utilities", summary: "Run the full Treeseed end-to-end command suite.", description: "Run the full Treeseed end-to-end command suite.", examples: ["treeseed test:e2e:full"], executionMode: "adapter", adapter: { script: "workspace-command-e2e", extraArgs: ["--mode=full"], requireWorkspaceRoot: true } }),
|
|
413
|
+
command({ name: "test:release", aliases: [], group: "Release Utilities", summary: "Run the fast release verification path.", description: "Run the fast release verification path.", examples: ["treeseed test:release"], executionMode: "adapter", adapter: { script: "workspace-release-verify", requireWorkspaceRoot: true } }),
|
|
414
|
+
command({ name: "test:release:full", aliases: [], group: "Release Utilities", summary: "Run the full release verification path.", description: "Run the full release verification path.", examples: ["treeseed test:release:full"], executionMode: "adapter", adapter: { script: "workspace-release-verify", extraArgs: ["--full-smoke"], requireWorkspaceRoot: true } }),
|
|
415
|
+
command({ name: "release:verify", aliases: [], group: "Release Utilities", summary: "Run the release verification workflow.", description: "Run the release verification workflow.", examples: ["treeseed release:verify"], executionMode: "adapter", adapter: { script: "workspace-release-verify", extraArgs: ["--full-smoke"], requireWorkspaceRoot: true } }),
|
|
416
|
+
command({ name: "release:publish:changed", aliases: [], group: "Release Utilities", summary: "Publish changed Treeseed workspace packages.", description: "Publish changed Treeseed workspace packages.", examples: ["treeseed release:publish:changed"], executionMode: "adapter", adapter: { script: "workspace-publish-changed-packages", requireWorkspaceRoot: true } }),
|
|
417
|
+
command({ name: "astro", aliases: [], group: "Passthrough", summary: "Pass through to the packaged Astro CLI wrapper.", description: "Pass through to the packaged Astro CLI wrapper.", examples: ["treeseed astro -- --help"], executionMode: "adapter", adapter: { script: "tenant-astro-command", passthroughArgs: true } }),
|
|
418
|
+
command({ name: "sync:devvars", aliases: [], group: "Utilities", summary: "Regenerate .dev.vars from local configuration.", description: "Regenerate .dev.vars from local configuration.", examples: ["treeseed sync:devvars"], executionMode: "adapter", adapter: { script: "sync-dev-vars" } }),
|
|
419
|
+
command({ name: "mailpit:up", aliases: [], group: "Utilities", summary: "Start the package-managed Mailpit service.", description: "Start the package-managed Mailpit service.", examples: ["treeseed mailpit:up"], executionMode: "adapter", adapter: { script: "ensure-mailpit" } }),
|
|
420
|
+
command({ name: "mailpit:down", aliases: [], group: "Utilities", summary: "Stop the package-managed Mailpit service.", description: "Stop the package-managed Mailpit service.", examples: ["treeseed mailpit:down"], executionMode: "adapter", adapter: { script: "stop-mailpit" } }),
|
|
421
|
+
command({ name: "mailpit:logs", aliases: [], group: "Utilities", summary: "Show Mailpit logs.", description: "Show Mailpit logs.", examples: ["treeseed mailpit:logs"], executionMode: "adapter", adapter: { script: "logs-mailpit" } }),
|
|
422
|
+
command({ name: "d1:migrate:local", aliases: [], group: "Utilities", summary: "Apply local D1 migrations.", description: "Apply local D1 migrations.", examples: ["treeseed d1:migrate:local"], executionMode: "adapter", adapter: { script: "tenant-d1-migrate-local" } }),
|
|
423
|
+
command({ name: "cleanup:markdown", aliases: [], group: "Utilities", summary: "Normalize Markdown and MDX files.", description: "Normalize Markdown and MDX files.", examples: ["treeseed cleanup:markdown docs/README.md"], executionMode: "adapter", adapter: { script: "cleanup-markdown", rewriteArgs: (args) => ["--write", ...args] } }),
|
|
424
|
+
command({ name: "cleanup:markdown:check", aliases: [], group: "Utilities", summary: "Check Markdown and MDX formatting without rewriting files.", description: "Check Markdown and MDX formatting without rewriting files.", examples: ["treeseed cleanup:markdown:check docs/README.md"], executionMode: "adapter", adapter: { script: "cleanup-markdown", rewriteArgs: (args) => ["--check", ...args] } }),
|
|
425
|
+
command({ name: "starlight:patch", aliases: [], group: "Utilities", summary: "Apply the Starlight content path patch.", description: "Apply the Starlight content path patch.", examples: ["treeseed starlight:patch"], executionMode: "adapter", adapter: { script: "patch-starlight-content-path" } })
|
|
426
|
+
];
|
|
427
|
+
const TRESEED_COMMAND_INDEX = /* @__PURE__ */ new Map();
|
|
428
|
+
for (const spec of TRESEED_COMMAND_SPECS) {
|
|
429
|
+
TRESEED_COMMAND_INDEX.set(spec.name, spec);
|
|
430
|
+
for (const alias of spec.aliases) TRESEED_COMMAND_INDEX.set(alias, spec);
|
|
431
|
+
}
|
|
432
|
+
function findCommandSpec(name) {
|
|
433
|
+
if (!name) return null;
|
|
434
|
+
return TRESEED_COMMAND_INDEX.get(name) ?? null;
|
|
435
|
+
}
|
|
436
|
+
function listCommandNames() {
|
|
437
|
+
return [...new Set(TRESEED_COMMAND_SPECS.map((spec) => spec.name))];
|
|
438
|
+
}
|
|
439
|
+
export {
|
|
440
|
+
COMMAND_HANDLERS,
|
|
441
|
+
TRESEED_COMMAND_INDEX,
|
|
442
|
+
TRESEED_COMMAND_SPECS,
|
|
443
|
+
findCommandSpec,
|
|
444
|
+
listCommandNames
|
|
445
|
+
};
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { copyFileSync, existsSync, mkdirSync, readFileSync, readdirSync, writeFileSync } from "node:fs";
|
|
2
|
+
import { resolve } from "node:path";
|
|
3
|
+
import {
|
|
4
|
+
createDefaultTreeseedMachineConfig,
|
|
5
|
+
ensureTreeseedGitignoreEntries,
|
|
6
|
+
getTreeseedMachineConfigPaths,
|
|
7
|
+
loadTreeseedMachineConfig,
|
|
8
|
+
resolveTreeseedMachineEnvironmentValues,
|
|
9
|
+
writeTreeseedLocalEnvironmentFiles,
|
|
10
|
+
writeTreeseedMachineConfig
|
|
11
|
+
} from "../scripts/config-runtime-lib.js";
|
|
12
|
+
import { createPersistentDeployTarget, ensureGeneratedWranglerConfig, loadDeployState } from "../scripts/deploy-lib.js";
|
|
13
|
+
import { loadCliDeployConfig } from "../scripts/package-tools.js";
|
|
14
|
+
function applyTreeseedSafeRepairs(tenantRoot) {
|
|
15
|
+
const actions = [];
|
|
16
|
+
ensureTreeseedGitignoreEntries(tenantRoot);
|
|
17
|
+
actions.push({ id: "gitignore", detail: "Ensured Treeseed gitignore entries are present." });
|
|
18
|
+
const envLocalPath = resolve(tenantRoot, ".env.local");
|
|
19
|
+
const envLocalExamplePath = resolve(tenantRoot, ".env.local.example");
|
|
20
|
+
if (!existsSync(envLocalPath) && existsSync(envLocalExamplePath)) {
|
|
21
|
+
copyFileSync(envLocalExamplePath, envLocalPath);
|
|
22
|
+
actions.push({ id: "env-local", detail: "Created .env.local from .env.local.example." });
|
|
23
|
+
}
|
|
24
|
+
const deployConfig = loadCliDeployConfig(tenantRoot);
|
|
25
|
+
const { configPath } = getTreeseedMachineConfigPaths(tenantRoot);
|
|
26
|
+
if (!existsSync(configPath)) {
|
|
27
|
+
const machineConfig2 = createDefaultTreeseedMachineConfig({
|
|
28
|
+
tenantRoot,
|
|
29
|
+
deployConfig,
|
|
30
|
+
tenantConfig: void 0
|
|
31
|
+
});
|
|
32
|
+
writeTreeseedMachineConfig(tenantRoot, machineConfig2);
|
|
33
|
+
actions.push({ id: "machine-config", detail: "Created the default Treeseed machine config." });
|
|
34
|
+
}
|
|
35
|
+
resolveTreeseedMachineEnvironmentValues(tenantRoot, "local");
|
|
36
|
+
actions.push({ id: "machine-key", detail: "Ensured the Treeseed machine key exists." });
|
|
37
|
+
const machineConfig = loadTreeseedMachineConfig(tenantRoot);
|
|
38
|
+
writeTreeseedMachineConfig(tenantRoot, machineConfig);
|
|
39
|
+
writeTreeseedLocalEnvironmentFiles(tenantRoot);
|
|
40
|
+
actions.push({ id: "local-env", detail: "Regenerated .env.local and .dev.vars from the current machine config." });
|
|
41
|
+
const stateRoot = resolve(tenantRoot, ".treeseed", "state", "environments");
|
|
42
|
+
if (existsSync(stateRoot)) {
|
|
43
|
+
for (const scope of ["local", "staging", "prod"]) {
|
|
44
|
+
const target = createPersistentDeployTarget(scope);
|
|
45
|
+
const state = loadDeployState(tenantRoot, deployConfig, { target });
|
|
46
|
+
if (state.readiness?.initialized || scope === "local") {
|
|
47
|
+
ensureGeneratedWranglerConfig(tenantRoot, { target });
|
|
48
|
+
actions.push({ id: `wrangler-${scope}`, detail: `Regenerated the ${scope} generated Wrangler config.` });
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return dedupeRepairActions(actions);
|
|
53
|
+
}
|
|
54
|
+
function dedupeRepairActions(actions) {
|
|
55
|
+
const seen = /* @__PURE__ */ new Set();
|
|
56
|
+
return actions.filter((action) => {
|
|
57
|
+
if (seen.has(action.id)) return false;
|
|
58
|
+
seen.add(action.id);
|
|
59
|
+
return true;
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
function copyTreeseedOperationalState(sourceRoot, targetRoot) {
|
|
63
|
+
const sourceTreeseedRoot = resolve(sourceRoot, ".treeseed");
|
|
64
|
+
if (!existsSync(sourceTreeseedRoot)) {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
const targetTreeseedRoot = resolve(targetRoot, ".treeseed");
|
|
68
|
+
mkdirSync(targetTreeseedRoot, { recursive: true });
|
|
69
|
+
copyDirectory(sourceTreeseedRoot, targetTreeseedRoot);
|
|
70
|
+
}
|
|
71
|
+
function copyDirectory(sourceDir, targetDir) {
|
|
72
|
+
mkdirSync(targetDir, { recursive: true });
|
|
73
|
+
for (const entry of readdirSafe(sourceDir)) {
|
|
74
|
+
const sourcePath = resolve(sourceDir, entry.name);
|
|
75
|
+
const targetPath = resolve(targetDir, entry.name);
|
|
76
|
+
if (entry.isDirectory()) {
|
|
77
|
+
copyDirectory(sourcePath, targetPath);
|
|
78
|
+
continue;
|
|
79
|
+
}
|
|
80
|
+
writeFileSync(targetPath, readFileSync(sourcePath));
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
function readdirSafe(sourceDir) {
|
|
84
|
+
return existsSync(sourceDir) ? readdirSync(sourceDir, { withFileTypes: true }) : [];
|
|
85
|
+
}
|
|
86
|
+
export {
|
|
87
|
+
applyTreeseedSafeRepairs,
|
|
88
|
+
copyTreeseedOperationalState
|
|
89
|
+
};
|