@tailor-platform/sdk 2.36.0 → 2.37.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (131) hide show
  1. package/CHANGELOG.md +72 -0
  2. package/dist/{application-DaJbleMi.mjs → application-83WVdH85.mjs} +1 -1
  3. package/dist/{application-BbORWCj-.mjs → application-Cida-j1g.mjs} +36 -36
  4. package/dist/application-Cida-j1g.mjs.map +1 -0
  5. package/dist/cli/commands/deploy/deploy.d.mts +6 -1
  6. package/dist/cli/commands/deploy/tailordb/migration-validation.d.mts +1 -0
  7. package/dist/cli/commands/executor/jobs.d.mts +3 -0
  8. package/dist/cli/commands/tailordb/migrate/bundler.d.mts +3 -0
  9. package/dist/cli/commands/tailordb/migrate/config.d.mts +4 -0
  10. package/dist/cli/commands/tailordb/migrate/diff-calculator.d.mts +10 -0
  11. package/dist/cli/commands/tailordb/migrate/generate.d.mts +28 -2
  12. package/dist/cli/commands/tailordb/migrate/hints.d.mts +1 -0
  13. package/dist/cli/commands/tailordb/migrate/remote-state.d.mts +3 -0
  14. package/dist/cli/commands/tailordb/migrate/schema-checks.d.mts +3 -1
  15. package/dist/cli/commands/tailordb/migrate/snapshot-comparison.d.mts +4 -0
  16. package/dist/cli/commands/tailordb/migrate/snapshot-files.d.mts +44 -6
  17. package/dist/cli/commands/tailordb/migrate/snapshot-local.d.mts +2 -0
  18. package/dist/cli/commands/tailordb/migrate/snapshot-migrations.d.mts +2 -0
  19. package/dist/cli/commands/tailordb/migrate/snapshot-types.d.mts +8 -0
  20. package/dist/cli/commands/tailordb/migrate/types.d.mts +2 -0
  21. package/dist/cli/commands/workspace/create.d.mts +1 -1
  22. package/dist/cli/lib.d.mts +2 -2
  23. package/dist/cli/lib.mjs +1 -1
  24. package/dist/cli/lib.mjs.map +1 -1
  25. package/dist/cli/main.mjs +52 -51
  26. package/dist/cli/main.mjs.map +1 -1
  27. package/dist/cli/shared/client.d.mts +26 -0
  28. package/dist/cli/shared/function-execution.d.mts +2 -0
  29. package/dist/cli/shared/prompt.d.mts +9 -4
  30. package/dist/completion/zsh-worker.zsh +21 -13
  31. package/dist/configure/config/index.d.mts +2 -0
  32. package/dist/configure/config/types.d.mts +2 -0
  33. package/dist/configure/index.mjs.map +1 -1
  34. package/dist/configure/services/tailordb/schema.d.mts +1 -0
  35. package/dist/configure/services/tailordb/types.d.mts +3 -0
  36. package/dist/crashreport-C2AcQNTe.mjs +1 -0
  37. package/dist/{crashreport-DGU6lwiX.mjs → crashreport-D_wf4GZh.mjs} +4 -4
  38. package/dist/{crashreport-DGU6lwiX.mjs.map → crashreport-D_wf4GZh.mjs.map} +1 -1
  39. package/dist/date-representation-Cr7W7Pn2.mjs.map +1 -1
  40. package/dist/{errors-BXmGBX-7.mjs → errors-Dmdnq0zi.mjs} +2 -2
  41. package/dist/errors-Dmdnq0zi.mjs.map +1 -0
  42. package/dist/{kysely-type-B0ri1-Xs.mjs → kysely-type-DVL90_oX.mjs} +6 -6
  43. package/dist/kysely-type-DVL90_oX.mjs.map +1 -0
  44. package/dist/plugin/builtin/kysely-type/index.mjs +1 -1
  45. package/dist/plugin/builtin/seed/seed-type-processor.d.mts +4 -3
  46. package/dist/plugin/get-generated-table.d.mts +4 -0
  47. package/dist/plugin/index.mjs.map +1 -1
  48. package/dist/plugin/types.d.mts +55 -3
  49. package/dist/plugin/with-context.d.mts +16 -0
  50. package/dist/register-ts-hook-Ht4zCseV.mjs +1115 -0
  51. package/dist/register-ts-hook-Ht4zCseV.mjs.map +1 -0
  52. package/dist/schema-BU1aIQ63.mjs.map +1 -1
  53. package/dist/{secret-file-BxZ-J_Nz.mjs → secret-file-DiuEcLFP.mjs} +2 -2
  54. package/dist/{secret-file-BxZ-J_Nz.mjs.map → secret-file-DiuEcLFP.mjs.map} +1 -1
  55. package/dist/service-CZ0EdD2-.mjs +10 -0
  56. package/dist/service-CZ0EdD2-.mjs.map +1 -0
  57. package/dist/service-DDrbdyd-.mjs +2 -0
  58. package/dist/{service-CaGmqg0r.mjs.map → service-DDrbdyd-.mjs.map} +1 -1
  59. package/dist/service-WhSyhaho.mjs +1 -0
  60. package/dist/service_pb-BMHhVot2.mjs +1 -0
  61. package/dist/service_pb-BxMSK0gg.mjs +2 -0
  62. package/dist/service_pb-BxMSK0gg.mjs.map +1 -0
  63. package/dist/tailor-proto/src/tailor/v1/function_pb.d.mts +3 -3
  64. package/dist/tailor-proto/src/tailor/v1/function_resource_pb.d.mts +92 -0
  65. package/dist/tailor-proto/src/tailor/v1/notification_pb.d.mts +176 -0
  66. package/dist/tailor-proto/src/tailor/v1/notification_resource_pb.d.mts +172 -0
  67. package/dist/tailor-proto/src/tailor/v1/service_pb.d.mts +78 -0
  68. package/dist/types/app-config.generated.d.mts +1 -1
  69. package/dist/types/auth-connection.generated.d.mts +2 -2
  70. package/dist/types/auth.generated.d.mts +13 -13
  71. package/dist/types/executor.generated.d.mts +25 -25
  72. package/dist/types/field.generated.d.mts +2 -2
  73. package/dist/types/http-adapter.generated.d.mts +4 -4
  74. package/dist/types/idp.generated.d.mts +272 -272
  75. package/dist/types/resolver.generated.d.mts +10 -10
  76. package/dist/types/tailordb.generated.d.mts +84 -80
  77. package/dist/types/workflow.generated.d.mts +2 -2
  78. package/dist/vitest/date-representation.d.mts +2 -0
  79. package/dist/vitest/environment.d.mts +1 -0
  80. package/dist/vitest/environment.mjs.map +1 -1
  81. package/dist/vitest/index.mjs.map +1 -1
  82. package/dist/vitest/migration-steps.d.mts +13 -2
  83. package/dist/vitest/mock-kysely.d.mts +12 -2
  84. package/dist/vitest/mocks/aigateway.d.mts +7 -1
  85. package/dist/vitest/mocks/authconnection.d.mts +7 -1
  86. package/dist/vitest/mocks/file.d.mts +8 -2
  87. package/dist/vitest/mocks/iconv.d.mts +7 -1
  88. package/dist/vitest/mocks/idp.d.mts +7 -1
  89. package/dist/vitest/mocks/logger.d.mts +7 -1
  90. package/dist/vitest/mocks/secretmanager.d.mts +7 -1
  91. package/dist/vitest/mocks/tailordb-pglite.d.mts +12 -2
  92. package/dist/vitest/mocks/tailordb.d.mts +22 -4
  93. package/dist/vitest/mocks/workflow.d.mts +2 -1
  94. package/dist/vitest/pglite-kysely.d.mts +18 -2
  95. package/dist/vitest/pglite-temporal.d.mts +5 -1
  96. package/dist/vitest/workflow-local.d.mts +7 -0
  97. package/dist/{workspace_resource_pb-C4CkoYww.mjs → workspace_resource_pb-7smKERdZ.mjs} +2 -2
  98. package/dist/workspace_resource_pb-7smKERdZ.mjs.map +1 -0
  99. package/docs/cli/application.md +51 -21
  100. package/docs/cli/executor.md +2 -0
  101. package/docs/cli/function.md +3 -1
  102. package/docs/cli/tailordb.md +30 -22
  103. package/docs/cli/workflow.md +2 -0
  104. package/docs/cli/workspace.md +19 -17
  105. package/docs/cli-reference.md +5 -4
  106. package/docs/configuration.md +2 -2
  107. package/docs/data-clone.md +1 -1
  108. package/docs/github-actions.md +104 -15
  109. package/docs/plugin/custom.md +4 -4
  110. package/docs/runtime.md +1 -1
  111. package/docs/services/auth.md +2 -0
  112. package/docs/services/idp.md +2 -0
  113. package/docs/services/tailordb/index.md +7 -2
  114. package/docs/services/tailordb/migration.md +71 -30
  115. package/docs/services/workflow.md +1 -1
  116. package/docs/testing.md +9 -9
  117. package/package.json +13 -13
  118. package/dist/application-BbORWCj-.mjs.map +0 -1
  119. package/dist/crashreport-WsYAWARW.mjs +0 -1
  120. package/dist/errors-BXmGBX-7.mjs.map +0 -1
  121. package/dist/kysely-type-B0ri1-Xs.mjs.map +0 -1
  122. package/dist/register-ts-hook-iAcG1dfz.mjs +0 -1057
  123. package/dist/register-ts-hook-iAcG1dfz.mjs.map +0 -1
  124. package/dist/service-CaGmqg0r.mjs +0 -2
  125. package/dist/service-DTrVVaDJ.mjs +0 -1
  126. package/dist/service-hIarp2Gl.mjs +0 -8
  127. package/dist/service-hIarp2Gl.mjs.map +0 -1
  128. package/dist/service_pb-6EkMfdOb.mjs +0 -2
  129. package/dist/service_pb-6EkMfdOb.mjs.map +0 -1
  130. package/dist/service_pb-CsJKokDl.mjs +0 -1
  131. package/dist/workspace_resource_pb-C4CkoYww.mjs.map +0 -1
@@ -60,23 +60,23 @@ tailor deploy [options]
60
60
 
61
61
  **Options**
62
62
 
63
- | Option | Alias | Description | Required | Default | Env |
64
- | ----------------------------------------------- | ----- | ---------------------------------------------------------------------------------------------------------------------- | -------- | -------------------- | --------------------------------- |
65
- | `--workspace-id <WORKSPACE_ID>` | `-w` | Workspace ID | No | - | `TAILOR_PLATFORM_WORKSPACE_ID` |
66
- | `--profile <PROFILE>` | `-p` | Workspace profile | No | - | `TAILOR_PLATFORM_PROFILE` |
67
- | `--config <CONFIG>` | `-c` | Path to SDK config file. Use comma-separated paths to deploy multiple apps together. | No | `"tailor.config.ts"` | `TAILOR_PLATFORM_SDK_CONFIG_PATH` |
68
- | `--yes` | `-y` | Skip confirmation prompts | No | `false` | - |
69
- | `--create-workspace` | - | Create a workspace when the account has none | No | - | - |
70
- | `--workspace-name <WORKSPACE_NAME>` | - | Name for a workspace created during deploy | No | - | - |
71
- | `--workspace-region <WORKSPACE_REGION>` | - | Region for a workspace created during deploy | No | - | - |
72
- | `--organization-id <ORGANIZATION_ID>` | - | Organization ID for a workspace created during deploy | No | - | `TAILOR_PLATFORM_ORGANIZATION_ID` |
73
- | `--folder-id <FOLDER_ID>` | - | Folder ID for a workspace created during deploy | No | - | `TAILOR_PLATFORM_FOLDER_ID` |
74
- | `--dry-run` | `-d` | Run the command without making any changes | No | - | - |
75
- | `--no-schema-check` | - | Skip schema diff check against migration snapshots | No | - | - |
76
- | `--migration-skip-steps <MIGRATION_SKIP_STEPS>` | - | Skip steps of a partially applied multi-step migration that already succeeded (comma-separated namespace/step entries) | No | - | - |
77
- | `--no-validate` | - | Skip client-side validation against platform resource constraints | No | - | - |
78
- | `--no-cache` | - | Disable bundle caching for this run | No | - | - |
79
- | `--clean-cache` | - | Clean the bundle cache before building | No | - | - |
63
+ | Option | Alias | Description | Required | Default | Env |
64
+ | ----------------------------------------------- | ----- | ------------------------------------------------------------------------------------------------------------------------------- | -------- | -------------------- | --------------------------------- |
65
+ | `--workspace-id <WORKSPACE_ID>` | `-w` | Workspace ID | No | - | `TAILOR_PLATFORM_WORKSPACE_ID` |
66
+ | `--profile <PROFILE>` | `-p` | Workspace profile | No | - | `TAILOR_PLATFORM_PROFILE` |
67
+ | `--config <CONFIG>` | `-c` | Path to SDK config file. Use comma-separated paths to deploy multiple apps together. | No | `"tailor.config.ts"` | `TAILOR_CONFIG_PATH` |
68
+ | `--yes` | `-y` | Skip confirmation prompts | No | `false` | - |
69
+ | `--create-workspace` | - | Create a workspace when the account has none | No | - | - |
70
+ | `--workspace-name <WORKSPACE_NAME>` | - | Name for a workspace created during deploy | No | - | - |
71
+ | `--workspace-region <WORKSPACE_REGION>` | - | Region for a workspace created during deploy | No | - | - |
72
+ | `--organization-id <ORGANIZATION_ID>` | - | Organization ID for a workspace created during deploy | No | - | `TAILOR_PLATFORM_ORGANIZATION_ID` |
73
+ | `--folder-id <FOLDER_ID>` | - | Folder ID for a workspace created during deploy | No | - | `TAILOR_PLATFORM_FOLDER_ID` |
74
+ | `--dry-run` | `-d` | Run the command without making any changes | No | - | - |
75
+ | `--no-schema-check` | - | Skip schema diff check against migration snapshots (beta) | No | - | - |
76
+ | `--migration-skip-steps <MIGRATION_SKIP_STEPS>` | - | Skip steps of a partially applied multi-step migration that already succeeded, as comma-separated namespace/step entries (beta) | No | - | - |
77
+ | `--no-validate` | - | Skip client-side validation against platform resource constraints | No | - | - |
78
+ | `--no-cache` | - | Disable bundle caching for this run | No | - | - |
79
+ | `--clean-cache` | - | Clean the bundle cache before building | No | - | - |
80
80
 
81
81
  See [Global Options](../cli-reference.md#global-options) for options available to all commands.
82
82
 
@@ -154,7 +154,8 @@ tailor deploy \
154
154
  `--create-workspace` only creates when the account has no workspace. If the existing workspace
155
155
  matches the requested name, region, organization, and folder, `deploy` reuses it so the same command
156
156
  is safe to rerun. If multiple workspaces exist, the flag never creates another one or guesses which
157
- workspace to use. `--yes` skips deployment confirmation but does not authorize workspace creation.
157
+ workspace to use. `--yes` accepts the deployment confirmations described under Confirmation below
158
+ but does not authorize workspace creation.
158
159
 
159
160
  If a saved workspace has been deleted or is no longer accessible, interactive terminals return to
160
161
  workspace selection. Non-interactive environments stop with `WORKSPACE_CONTEXT_STALE` instead of
@@ -195,7 +196,7 @@ See [Automatic Migration Execution](../services/tailordb/migration.md#automatic-
195
196
 
196
197
  **Concurrent Deploys:**
197
198
 
198
- Deploys that target the same workspace and application from the same project directory are serialized while secrets and auth connections are updated: one deploy proceeds and the other waits for it to finish. A deploy that cannot proceed within 5 minutes fails with an error, which normally means another deploy is still running. If a previous deploy was interrupted, the next deploy recovers automatically within about a minute. Deploys to different workspaces or applications are not affected.
199
+ Deploys that target the same workspace and application from the same project directory are serialized while secrets and auth connections are updated: one deploy proceeds and the other waits for it to finish. A deploy that cannot proceed within 5 minutes fails with an error, which normally means another deploy is still running. If a previous deploy was interrupted, the next deploy recovers automatically within about a minute. If the error persists, stop any `tailor deploy` still running from the project directory, then delete the lock directory that the error names and retry. Deploys to different workspaces or applications are not affected.
199
200
 
200
201
  **Schema Check:**
201
202
 
@@ -206,7 +207,7 @@ By default, `deploy` performs two verification steps:
206
207
 
207
208
  If remote schema drift is detected, the deploy will fail with an error showing the differences. This helps prevent applying migrations to an inconsistent state.
208
209
 
209
- Use `--no-schema-check` to skip both verifications (not recommended for production).
210
+ Use `--no-schema-check` to skip both verifications (not recommended for production). It does not skip the check that the remote migration checkpoint is in the local migration history: when the deployed checkpoint is ahead of the local migration files or belongs to another migration history, the deploy stops before changing anything. Pull the latest migration files, or move the checkpoint on purpose with `tailor tailordb migration sync` or `tailor tailordb migration set`, adding `--force` when the checkpoint belongs to another migration history or has a history label that cannot be read, then deploy again.
210
211
 
211
212
  **Plan Output:**
212
213
 
@@ -239,6 +240,22 @@ tailor deploy --dry-run > plan.txt
239
240
 
240
241
  In apply mode, the plan is printed to stderr so it does not interfere with piped output.
241
242
 
243
+ **Confirmation:**
244
+
245
+ After printing the plan, `deploy` asks for confirmation before applying when the plan includes any of the following:
246
+
247
+ - TailorDB migration checkpoints that must be reset before deploying (Beta)
248
+ - Applications recorded as depending on this deploy that are missing from it
249
+ - Resources owned by another application, or tagged with a different application id
250
+ - Existing resources that `tailor` does not manage yet
251
+ - Deletion of TailorDB tables, static websites, AI gateways, OAuth2 clients (including a client type change), Auth connections, Secret Manager vaults, or Secret Manager secrets
252
+
253
+ Declining cancels the deploy. When the plan includes none of these, `deploy` applies it without asking.
254
+
255
+ `--yes` accepts these confirmations without asking. In a non-interactive environment or with `--json`, a deploy that needs one of them fails unless `--yes` is passed. `--dry-run` lists them as warnings without asking.
256
+
257
+ When [`env`](../configuration.md#environment-variables) references the URL of a static website that the same deploy creates, `deploy` first applies static websites and the other resources that cannot reference that URL, then plans the rest again with the real URL and prints that plan as well. It asks again only about what the new plan adds; declining at that point leaves the resources applied first in place.
258
+
242
259
  **JSON Output:**
243
260
 
244
261
  Pass the global `--json` / `-j` flag to get machine-readable output.
@@ -280,10 +297,23 @@ Pass the global `--json` / `-j` flag to get machine-readable output.
280
297
  ```json
281
298
  {
282
299
  "summary": { "create": 1, "update": 2, "delete": 0, "replace": 0, "forcedBySdkVersion": 0 },
283
- "status": "applied"
300
+ "status": "applied",
301
+ "workspaceId": "ws_abc123",
302
+ "applications": [
303
+ {
304
+ "name": "my-app",
305
+ "configPath": "/path/to/my-app/tailor.config.ts",
306
+ "url": "https://my-app.example.com",
307
+ "domain": "my-app.example.com",
308
+ "aiGateways": [],
309
+ "staticWebsites": {}
310
+ }
311
+ ]
284
312
  }
285
313
  ```
286
314
 
315
+ Some deploys also add `tailordbMaintenance` or `deployedHooks`, as described under **JSON result** above.
316
+
287
317
  ## remove
288
318
 
289
319
  Remove all resources managed by the application from the workspace.
@@ -6,6 +6,8 @@ description: "List and inspect executors, view executor jobs, and trigger execut
6
6
 
7
7
  Commands for managing executors and executor jobs.
8
8
 
9
+ In the human-readable output of `executor jobs --logs` and `executor trigger --logs`, `[PLATFORM]` marks log lines the Platform added. See [`function logs`](./function.md#function-logs) for the `source` that `--json` reports for each log entry.
10
+
9
11
  ## executor
10
12
 
11
13
  Manage executors
@@ -135,7 +135,9 @@ $ tailor function logs <execution-id> --follow
135
135
 
136
136
  Each execution includes `errorKind`, which tells you where a failure came from: `USER_RUNTIME` (your code threw while running, or exceeded its time, memory, or CPU limit), `USER_NON_RUNTIME` (your script failed while loading, before your function was called, such as when its top-level code threw), `PLATFORM` (a failure on the Platform side, or the Platform aborting the run because of its own deadline or cancellation), `NONE` (no error), or `UNSPECIFIED` (not recorded, or a kind this CLI version does not recognize). A workflow job waiting on another job also reports `USER_NON_RUNTIME` when that job fails or is canceled. `errorName` and `errorMessage` hold the error's name and message, or `null` when none was recorded. The list table omits `errorMessage`; use `--json` or the execution details to read it.
137
137
 
138
- Execution details include `logEntries`, the structured log lines (message, severity, timestamp) recorded while the function ran. They are available while the execution is still running. The `logs` string joins their messages with newlines.
138
+ Each execution also includes `hasPlatformLogs`, which is `true` when the Platform added log lines of its own to the execution. The flag is best-effort: `false` does not guarantee there are none, so read the `logEntries` of the execution details to be sure. The list table shows a `hasPlatformLogs` column, marking flagged executions with `yes`, only when at least one listed execution is flagged.
139
+
140
+ Execution details include `logEntries`, the structured log lines (message, severity, timestamp, source) recorded while the function ran. They are available while the execution is still running. `source` is `USER` for your function's own output, `PLATFORM` for a line the Platform added, or `UNSPECIFIED` (not recorded, or a source this CLI version does not recognize); the human-readable output marks Platform lines with `[PLATFORM]`. The `logs` string joins their messages with newlines.
139
141
 
140
142
  Use `--follow` to keep polling a running execution and print new log entries as they arrive until it completes. Polling continues while the execution is suspended at a wait point, and indefinitely unless `--timeout` is set. With `--json`, `--follow` waits for completion and then emits the final execution details once.
141
143
 
@@ -23,7 +23,7 @@ See [Global Options](../cli-reference.md#global-options) for options available t
23
23
  | Command | Description |
24
24
  | ------------------------------------------- | --------------------------------------------------- |
25
25
  | [`tailordb truncate`](#tailordb-truncate) | Truncate (delete all records from) TailorDB tables. |
26
- | [`tailordb migration`](#tailordb-migration) | Manage TailorDB schema migrations. |
26
+ | [`tailordb migration`](#tailordb-migration) | Manage TailorDB schema migrations (beta). |
27
27
 
28
28
  ### tailordb truncate
29
29
 
@@ -86,7 +86,7 @@ tailor tailordb truncate User Post --yes
86
86
 
87
87
  ### tailordb migration
88
88
 
89
- Manage TailorDB schema migrations.
89
+ Manage TailorDB schema migrations (beta).
90
90
 
91
91
  Note: Migration scripts are automatically executed during `tailor deploy`. See [Automatic Migration Execution](../services/tailordb/migration.md#automatic-migration-execution) for details.
92
92
 
@@ -106,7 +106,7 @@ tailor tailordb migration <command>
106
106
  | [`tailordb migration script`](#tailordb-migration-script) | Add a migration script (migrate.ts) template to an existing migration directory, or record with --no-script that a migration intentionally has none. |
107
107
  | [`tailordb migration set`](#tailordb-migration-set) | Set migration checkpoint to a specific number. |
108
108
  | [`tailordb migration status`](#tailordb-migration-status) | Show the current migration status for TailorDB namespaces, including applied and pending migrations. |
109
- | [`tailordb migration sync`](#tailordb-migration-sync) | Sync remote TailorDB schema to a specific migration snapshot (recovery from --no-schema-check drift). |
109
+ | [`tailordb migration sync`](#tailordb-migration-sync) | Sync remote TailorDB schema and checkpoint to a local migration snapshot to recover from schema drift or a checkpoint outside the local history. |
110
110
  | [`tailordb migration test`](#tailordb-migration-test) | Test pending migrations with seed fixtures or cloned data in a temporary workspace. |
111
111
  | [`tailordb migration validate`](#tailordb-migration-validate) | Validate the full migration history, unreviewed generated migration scripts, and schema drift (local tables vs. migration snapshot, remote schema vs. migration checkpoint) without deploying. This includes the migration and schema-drift checks used by 'deploy' and exits with a non-zero code when issues are found. |
112
112
 
@@ -190,7 +190,7 @@ See [Global Options](../cli-reference.md#global-options) for options available t
190
190
 
191
191
  **Notes**
192
192
 
193
- Use this after a deploy failed partway through a migration whose `migrate.ts` exports `steps`, or after a deploy could not confirm whether the script of a migration ran (`MIGRATION_OUTCOME_UNKNOWN`). The migration stays in progress: when `maintenanceMode` is on in your config, the tables of its namespace stay in maintenance mode, and `sync` and `rebaseline` are refused, while `set` accepts only the number of the in-progress migration. A deploy stops before changing anything while a run it could not confirm is not settled.
193
+ Use this after a deploy failed partway through a migration whose `migrate.ts` exports `steps`, or after a deploy could not confirm whether the script of a migration ran (`MIGRATION_OUTCOME_UNKNOWN`). The migration stays in progress: when `maintenanceMode` is on in your config, the tables of its namespace stay in maintenance mode, and the other migration commands that move the checkpoint are refused. A deploy stops before changing anything while a run it could not confirm is not settled.
194
194
 
195
195
  - `--rollback` sends the schema of the migration before the failed one. The next deploy runs the failed migration again, from its first step for a script that exports `steps`. Data changes the script already made are not undone.
196
196
  - `--complete` sends the schema of the failed migration itself and records it as completed, without running its `migrate.ts` again. Fix the data first (for example with `tailor query`), and make sure no record lacks a value for a field that becomes required.
@@ -249,13 +249,14 @@ tailor tailordb migration set [options] <number>
249
249
 
250
250
  **Options**
251
251
 
252
- | Option | Alias | Description | Required | Default | Env |
253
- | ------------------------------- | ----- | ----------------------------------------------------------------- | -------- | -------------------- | ------------------------------ |
254
- | `--workspace-id <WORKSPACE_ID>` | `-w` | Workspace ID | No | - | `TAILOR_PLATFORM_WORKSPACE_ID` |
255
- | `--profile <PROFILE>` | `-p` | Workspace profile | No | - | `TAILOR_PLATFORM_PROFILE` |
256
- | `--config <CONFIG>` | `-c` | Path to Tailor config file | No | `"tailor.config.ts"` | `TAILOR_CONFIG_PATH` |
257
- | `--yes` | `-y` | Skip confirmation prompts | No | `false` | - |
258
- | `--namespace <NAMESPACE>` | `-n` | Target TailorDB namespace (required if multiple namespaces exist) | No | - | - |
252
+ | Option | Alias | Description | Required | Default | Env |
253
+ | ------------------------------- | ----- | --------------------------------------------------------------------------------------- | -------- | -------------------- | ------------------------------ |
254
+ | `--workspace-id <WORKSPACE_ID>` | `-w` | Workspace ID | No | - | `TAILOR_PLATFORM_WORKSPACE_ID` |
255
+ | `--profile <PROFILE>` | `-p` | Workspace profile | No | - | `TAILOR_PLATFORM_PROFILE` |
256
+ | `--config <CONFIG>` | `-c` | Path to Tailor config file | No | `"tailor.config.ts"` | `TAILOR_CONFIG_PATH` |
257
+ | `--yes` | `-y` | Skip confirmation prompts | No | `false` | - |
258
+ | `--namespace <NAMESPACE>` | `-n` | Target TailorDB namespace (required if multiple namespaces exist) | No | - | - |
259
+ | `--force` | - | Proceed even when the namespace records a migration history ID other than the local one | No | `false` | - |
259
260
 
260
261
  See [Global Options](../cli-reference.md#global-options) for options available to all commands.
261
262
 
@@ -263,6 +264,8 @@ See [Global Options](../cli-reference.md#global-options) for options available t
263
264
 
264
265
  The migration number must be a 4-digit value (e.g. `0001`) or a bare integer (e.g. `1`) within 0–9999, and must exist in the local migration history; `0` is always accepted as the baseline, provided the local history passes validation. A gapped history is rejected.
265
266
 
267
+ The command refuses to run when the namespace records a migration history ID other than the local one, or one that cannot be read, unless the namespace has neither a checkpoint nor a history ID yet. `--force` replaces that history ID with the local one, or removes it when the local history has none, and still asks for confirmation unless `--yes` is given.
268
+
266
269
  Metadata lookup failures (authentication, permission, or network errors) are reported as errors; only a not-yet-deployed namespace is treated as having no checkpoint.
267
270
 
268
271
  #### tailordb migration status
@@ -292,7 +295,7 @@ Local migration files are checked for a valid layout (numbering and required fil
292
295
 
293
296
  #### tailordb migration sync
294
297
 
295
- Sync remote TailorDB schema to a specific migration snapshot (recovery from --no-schema-check drift).
298
+ Sync remote TailorDB schema and checkpoint to a local migration snapshot to recover from schema drift or a checkpoint outside the local history.
296
299
 
297
300
  **Usage**
298
301
 
@@ -308,16 +311,21 @@ tailor tailordb migration sync [options] <number>
308
311
 
309
312
  **Options**
310
313
 
311
- | Option | Alias | Description | Required | Default | Env |
312
- | ------------------------------- | ----- | ----------------------------------------------------------------- | -------- | -------------------- | ------------------------------ |
313
- | `--workspace-id <WORKSPACE_ID>` | `-w` | Workspace ID | No | - | `TAILOR_PLATFORM_WORKSPACE_ID` |
314
- | `--profile <PROFILE>` | `-p` | Workspace profile | No | - | `TAILOR_PLATFORM_PROFILE` |
315
- | `--config <CONFIG>` | `-c` | Path to Tailor config file | No | `"tailor.config.ts"` | `TAILOR_CONFIG_PATH` |
316
- | `--yes` | `-y` | Skip confirmation prompts | No | `false` | - |
317
- | `--namespace <NAMESPACE>` | `-n` | Target TailorDB namespace (required if multiple namespaces exist) | No | - | - |
314
+ | Option | Alias | Description | Required | Default | Env |
315
+ | ------------------------------- | ----- | --------------------------------------------------------------------------------------- | -------- | -------------------- | ------------------------------ |
316
+ | `--workspace-id <WORKSPACE_ID>` | `-w` | Workspace ID | No | - | `TAILOR_PLATFORM_WORKSPACE_ID` |
317
+ | `--profile <PROFILE>` | `-p` | Workspace profile | No | - | `TAILOR_PLATFORM_PROFILE` |
318
+ | `--config <CONFIG>` | `-c` | Path to Tailor config file | No | `"tailor.config.ts"` | `TAILOR_CONFIG_PATH` |
319
+ | `--yes` | `-y` | Skip confirmation prompts | No | `false` | - |
320
+ | `--namespace <NAMESPACE>` | `-n` | Target TailorDB namespace (required if multiple namespaces exist) | No | - | - |
321
+ | `--force` | - | Proceed even when the namespace records a migration history ID other than the local one | No | `false` | - |
318
322
 
319
323
  See [Global Options](../cli-reference.md#global-options) for options available to all commands.
320
324
 
325
+ **Notes**
326
+
327
+ The command refuses to run when the namespace records a migration history ID other than the local one, or one that cannot be read, unless the namespace has neither a checkpoint nor a history ID yet. `--force` overwrites the tables and that history ID with those of the local history, and still asks for confirmation unless `--yes` is given.
328
+
321
329
  #### tailordb migration test
322
330
 
323
331
  Test pending migrations with seed fixtures or cloned data in a temporary workspace.
@@ -343,9 +351,9 @@ tailor tailordb migration test [options]
343
351
  | `--folder-id <FOLDER_ID>` | - | Folder to create the temporary workspace in (default: the source workspace's folder). Requires --organization-id when the source workspace is not in an organization. With --target-workspace-id, must match the target's folder | No | - | `TAILOR_PLATFORM_FOLDER_ID` |
344
352
  | `--assert <ASSERT>` | - | Path to a TypeScript assertion script to run after migrations | No | - | - |
345
353
  | `--assert-namespace <ASSERT_NAMESPACE>` | - | TailorDB namespace exposed to the assertion script | No | - | - |
346
- | `--keep-ttl <KEEP_TTL>` | - | Record an expiry on the kept workspace, e.g. 24h or 7d, so workspace prune --expired can delete it (requires --keep) | No | - | - |
354
+ | `--keep-ttl <KEEP_TTL>` | - | Record an expiry on the kept workspace, e.g. 24h or 7d (less than 50,000,000 days), so workspace prune --expired can delete it (requires --keep) | No | - | - |
347
355
  | `--clone-timeout <CLONE_TIMEOUT>` | - | How long to wait for the clone to finish with --data clone, e.g. 30s or 10m (default: 30m) | No | - | - |
348
- | `--machine-user <MACHINE_USER>` | - | Machine user for seed and assertion script execution | No | - | - |
356
+ | `--machine-user <MACHINE_USER>` | - | Machine user for seed, migration, and assertion script execution | No | - | - |
349
357
 
350
358
  See [Global Options](../cli-reference.md#global-options) for options available to all commands.
351
359
 
@@ -377,7 +385,7 @@ See [Global Options](../cli-reference.md#global-options) for options available t
377
385
 
378
386
  **See also:** For migration concepts, configuration, workflow, and troubleshooting, see the [TailorDB Migrations guide](../services/tailordb/migration.md).
379
387
 
380
- ### tailordb erd
388
+ ### tailordb erd (Beta)
381
389
 
382
390
  The `tailordb erd` commands (export, diff, serve, deploy) are provided by the `@tailor-platform/sdk-plugin-tailordb-erd` CLI plugin. Install it next to the SDK and keep running `tailor tailordb erd <command>` as before:
383
391
 
@@ -6,6 +6,8 @@ description: "List and inspect workflows, start and wait for workflow runs, and
6
6
 
7
7
  Commands for managing workflows and workflow executions.
8
8
 
9
+ In the human-readable output of `--logs` on `workflow start`, `workflow wait`, `workflow executions`, and `workflow resume`, `[PLATFORM]` marks log lines the Platform added. See [`function logs`](./function.md#function-logs) for the `source` that `--json` reports for each log entry.
10
+
9
11
  ## workflow
10
12
 
11
13
  Manage workflows and workflow executions.
@@ -104,18 +104,18 @@ tailor workspace create [options]
104
104
 
105
105
  **Options**
106
106
 
107
- | Option | Alias | Description | Required | Default | Env |
108
- | ------------------------------------- | ----- | --------------------------------------------------------------------------------------------------------------------------------------------- | -------- | --------- | --------------------------------- |
109
- | `--name <NAME>` | `-n` | Workspace name | Yes | - | - |
110
- | `--region <REGION>` | `-r` | Workspace region (asia-northeast, us-west, europe-west) | Yes | - | - |
111
- | `--delete-protection` | `-d` | Enable delete protection | No | `false` | - |
112
- | `--organization-id <ORGANIZATION_ID>` | `-o` | Organization ID to workspace associate with | No | - | `TAILOR_PLATFORM_ORGANIZATION_ID` |
113
- | `--folder-id <FOLDER_ID>` | `-f` | Folder ID to workspace associate with | No | - | `TAILOR_PLATFORM_FOLDER_ID` |
114
- | `--ttl <TTL>` | - | Record on the workspace itself when it becomes prunable, such as 30m, 24h, or 7d. `workspace prune --expired` deletes it once that has passed | No | - | - |
115
- | `--profile-name <PROFILE_NAME>` | `-p` | Profile name to create | No | - | - |
116
- | `--profile <PROFILE>` | - | Workspace profile used for authentication and Platform selection | No | - | `TAILOR_PLATFORM_PROFILE` |
117
- | `--profile-user <PROFILE_USER>` | - | User email address or machine user client ID for the profile (defaults to current user) | No | - | - |
118
- | `--permission <PERMISSION>` | - | Profile permission (requires --profile-name). 'read' blocks all write commands while the profile is active. | No | `"write"` | - |
107
+ | Option | Alias | Description | Required | Default | Env |
108
+ | ------------------------------------- | ----- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | --------- | --------------------------------- |
109
+ | `--name <NAME>` | `-n` | Workspace name | Yes | - | - |
110
+ | `--region <REGION>` | `-r` | Workspace region (asia-northeast, us-west, europe-west) | Yes | - | - |
111
+ | `--delete-protection` | `-d` | Enable delete protection | No | `false` | - |
112
+ | `--organization-id <ORGANIZATION_ID>` | `-o` | Organization ID to workspace associate with | No | - | `TAILOR_PLATFORM_ORGANIZATION_ID` |
113
+ | `--folder-id <FOLDER_ID>` | `-f` | Folder ID to workspace associate with | No | - | `TAILOR_PLATFORM_FOLDER_ID` |
114
+ | `--ttl <TTL>` | - | Record on the workspace itself when it becomes prunable, such as 30m, 24h, or 7d (less than 50,000,000 days). `workspace prune --expired` deletes it once that has passed | No | - | - |
115
+ | `--profile-name <PROFILE_NAME>` | `-p` | Profile name to create | No | - | - |
116
+ | `--profile <PROFILE>` | - | Workspace profile used for authentication and Platform selection | No | - | `TAILOR_PLATFORM_PROFILE` |
117
+ | `--profile-user <PROFILE_USER>` | - | User email address or machine user client ID for the profile (defaults to current user) | No | - | - |
118
+ | `--permission <PERMISSION>` | - | Profile permission (requires --profile-name). 'read' blocks all write commands while the profile is active. | No | `"write"` | - |
119
119
 
120
120
  See [Global Options](../cli-reference.md#global-options) for options available to all commands.
121
121
 
@@ -125,6 +125,8 @@ Every workspace belongs to an organization. Without --organization-id and --fold
125
125
 
126
126
  TAILOR_PLATFORM_ORGANIZATION_ID and TAILOR_PLATFORM_FOLDER_ID are also read from --env-file. Command-line options take precedence over the corresponding environment variables. Empty values in the env file are treated as not given.
127
127
 
128
+ When --ttl is given but the expiry cannot be confirmed, the command still prints the created workspace, then fails with WORKSPACE_TTL_WRITE_FAILED. With --json, the printed `ttl.state` is then `unconfirmed` instead of `written`, so a script can read the workspace ID and record the expiry again with `workspace ttl set`.
129
+
128
130
  ### workspace delete
129
131
 
130
132
  Delete a Tailor Platform workspace.
@@ -300,11 +302,11 @@ tailor workspace ttl set [options]
300
302
 
301
303
  **Options**
302
304
 
303
- | Option | Alias | Description | Required | Default | Env |
304
- | ------------------------------- | ----- | --------------------------------------------------------------------------- | -------- | ------- | ------------------------------ |
305
- | `--workspace-id <WORKSPACE_ID>` | `-w` | Workspace ID | No | - | `TAILOR_PLATFORM_WORKSPACE_ID` |
306
- | `--profile <PROFILE>` | `-p` | Workspace profile | No | - | `TAILOR_PLATFORM_PROFILE` |
307
- | `--ttl <TTL>` | - | Time from now until the workspace becomes prunable, such as 30m, 24h, or 7d | Yes | - | - |
305
+ | Option | Alias | Description | Required | Default | Env |
306
+ | ------------------------------- | ----- | ------------------------------------------------------------------------------------------------------- | -------- | ------- | ------------------------------ |
307
+ | `--workspace-id <WORKSPACE_ID>` | `-w` | Workspace ID | No | - | `TAILOR_PLATFORM_WORKSPACE_ID` |
308
+ | `--profile <PROFILE>` | `-p` | Workspace profile | No | - | `TAILOR_PLATFORM_PROFILE` |
309
+ | `--ttl <TTL>` | - | Time from now until the workspace becomes prunable, such as 30m, 24h, or 7d (less than 50,000,000 days) | Yes | - | - |
308
310
 
309
311
  See [Global Options](../cli-reference.md#global-options) for options available to all commands.
310
312
 
@@ -52,7 +52,8 @@ flag always wins, so `--json=false` forces table output even when the variable i
52
52
  `true`, `True`, `TRUE`, `t`, `T`, and `1` enable JSON; `false`, `False`, `FALSE`, `f`, `F`, and `0`
53
53
  keep table output. Other values are rejected. JSON mode also disables interactive prompts, so set the
54
54
  variable per invocation or per job rather than exporting it from a shell profile; a command that
55
- needed a prompt names what selected JSON when it refuses.
55
+ needed a prompt names what selected JSON when it refuses. In JSON mode, pass `--yes` to commands that
56
+ ask for confirmation, and pass the options that a command would otherwise prompt for.
56
57
 
57
58
  When an AI coding agent such as Claude Code, Codex, Cursor, or Gemini CLI runs the CLI, every
58
59
  command defaults to JSON as if `TAILOR_JSON_OUTPUT=true` were set, and `--help` starts with a short
@@ -226,7 +227,7 @@ Workspace ID resolution follows this priority order:
226
227
  2. `TAILOR_PLATFORM_WORKSPACE_ID` environment variable
227
228
  3. Profile specified via `--profile` option or `TAILOR_PLATFORM_PROFILE`
228
229
 
229
- ## CLI Plugins
230
+ ## CLI Plugins (Beta)
230
231
 
231
232
  > [!WARNING]
232
233
  > CLI plugins are a **beta** feature. The dispatch behavior and the set of injected environment
@@ -331,14 +332,14 @@ Commands for managing TailorDB tables, data, and schema migrations.
331
332
  | -------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
332
333
  | [tailordb](./cli/tailordb.md#tailordb) | Manage TailorDB tables and data. |
333
334
  | [tailordb truncate](./cli/tailordb.md#tailordb-truncate) | Truncate (delete all records from) TailorDB tables. |
334
- | [tailordb migration](./cli/tailordb.md#tailordb-migration) | Manage TailorDB schema migrations. |
335
+ | [tailordb migration](./cli/tailordb.md#tailordb-migration) | Manage TailorDB schema migrations (beta). |
335
336
  | [tailordb migration generate](./cli/tailordb.md#tailordb-migration-generate) | Generate migration files by detecting schema differences between current local tables and the previous migration snapshot. |
336
337
  | [tailordb migration rebaseline](./cli/tailordb.md#tailordb-migration-rebaseline) | Collapse the full migration history into a new 0000 baseline. |
337
338
  | [tailordb migration resolve](./cli/tailordb.md#tailordb-migration-resolve) | Settle a migration that a failed deploy left partially applied, or whose run a deploy could not confirm. |
338
339
  | [tailordb migration script](./cli/tailordb.md#tailordb-migration-script) | Add a migration script (migrate.ts) template to an existing migration directory, or record with --no-script that a migration intentionally has none. |
339
340
  | [tailordb migration set](./cli/tailordb.md#tailordb-migration-set) | Set migration checkpoint to a specific number. |
340
341
  | [tailordb migration status](./cli/tailordb.md#tailordb-migration-status) | Show the current migration status for TailorDB namespaces, including applied and pending migrations. |
341
- | [tailordb migration sync](./cli/tailordb.md#tailordb-migration-sync) | Sync remote TailorDB schema to a specific migration snapshot (recovery from --no-schema-check drift). |
342
+ | [tailordb migration sync](./cli/tailordb.md#tailordb-migration-sync) | Sync remote TailorDB schema and checkpoint to a local migration snapshot to recover from schema drift or a checkpoint outside the local history. |
342
343
  | [tailordb migration test](./cli/tailordb.md#tailordb-migration-test) | Test pending migrations with seed fixtures or cloned data in a temporary workspace. |
343
344
  | [tailordb migration validate](./cli/tailordb.md#tailordb-migration-validate) | Validate the full migration history, unreviewed generated migration scripts, and schema drift (local tables vs. migration snapshot, remote schema vs. migration checkpoint) without deploying. This includes the migration and schema-drift checks used by 'deploy' and exits with a non-zero code when issues are found. |
344
345
 
@@ -118,7 +118,7 @@ The default applies wherever the SDK parses or serializes `t` fields on your beh
118
118
 
119
119
  The setting is per `tailor.config.ts`, but the field types are declared through `tailor.d.ts`, which TypeScript merges across every file in a program. If one `tsconfig.json` includes the `tailor.d.ts` of several applications, they must agree on `defaultDateRepresentation`. When they differ, `t.date()`, `t.datetime()`, and `t.time()` called without `as` fail to type-check in that program until the configs are aligned or each application gets its own `tsconfig.json`.
120
120
 
121
- **Maintenance Mode** (`maintenanceMode`): Whether `deploy` restricts the TailorDB namespaces it migrates while it applies pending migrations: `"migration"` (the default) restricts them until the migrations complete, `"deploy"` until the whole deploy completes, and `false` does not restrict them. See [Maintenance mode](./services/tailordb/migration.md#maintenance-mode) for what is restricted and what concurrent requests can observe without it.
121
+ **Maintenance Mode** (`maintenanceMode`, Beta): Whether `deploy` restricts the TailorDB namespaces it migrates while it applies pending migrations: `"migration"` (the default) restricts them until the migrations complete, `"deploy"` until the whole deploy completes, and `false` does not restrict them. See [Maintenance mode](./services/tailordb/migration.md#maintenance-mode) for what is restricted and what concurrent requests can observe without it.
122
122
 
123
123
  ```typescript
124
124
  export default defineConfig({
@@ -516,7 +516,7 @@ export default defineConfig({
516
516
  });
517
517
  ```
518
518
 
519
- ### Plugins
519
+ ### Plugins (Beta)
520
520
 
521
521
  Configure plugins using `definePlugins()`, exported as `export const plugins`.
522
522
 
@@ -70,6 +70,6 @@ tailor data operation get --from <source-workspace-id> --to <target-workspace-id
70
70
 
71
71
  With `--json`, `data clone` reports `status: "completed"` once the clone has finished, or `status: "started"` with `--no-wait`.
72
72
 
73
- ## Rehearsing migrations with cloned data
73
+ ## Rehearsing migrations with cloned data (Beta)
74
74
 
75
75
  To test pending TailorDB migrations against a copy of real records, use `tailor tailordb migration test --data clone` instead of cloning by hand. It creates a temporary workspace, deploys the pre-migration schema, clones the records, and runs the pending migrations. That command copies TailorDB records only; see [Clone mode](./services/tailordb/migration.md#clone-mode).