@tailor-platform/sdk 2.27.0 → 2.28.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 (177) hide show
  1. package/CHANGELOG.md +48 -0
  2. package/agent-skills/tailor/SKILL.md +4 -2
  3. package/dist/{application-DFeuELRo.mjs → application-CgJLyJaF.mjs} +20 -20
  4. package/dist/application-CgJLyJaF.mjs.map +1 -0
  5. package/dist/application-CvmKh5WT.mjs +1 -0
  6. package/dist/cli/commands/executor/get.d.mts +2 -1
  7. package/dist/cli/commands/executor/jobs.d.mts +2 -1
  8. package/dist/cli/commands/executor/trigger.d.mts +2 -1
  9. package/dist/cli/commands/function/get.d.mts +2 -1
  10. package/dist/cli/commands/function/list.d.mts +2 -1
  11. package/dist/cli/commands/organization/folder/create.d.mts +2 -1
  12. package/dist/cli/commands/organization/folder/delete.d.mts +2 -1
  13. package/dist/cli/commands/organization/folder/get.d.mts +2 -1
  14. package/dist/cli/commands/organization/folder/list.d.mts +2 -1
  15. package/dist/cli/commands/organization/folder/update.d.mts +2 -1
  16. package/dist/cli/commands/organization/get.d.mts +2 -1
  17. package/dist/cli/commands/organization/tree.d.mts +2 -1
  18. package/dist/cli/commands/organization/update.d.mts +2 -1
  19. package/dist/cli/commands/show.d.mts +2 -1
  20. package/dist/cli/commands/tailordb/migrate/diff-calculator.d.mts +2 -1
  21. package/dist/cli/commands/tailordb/migrate/snapshot-types.d.mts +3 -1
  22. package/dist/cli/commands/workflow/executions.d.mts +2 -1
  23. package/dist/cli/commands/workflow/get.d.mts +2 -1
  24. package/dist/cli/commands/workflow/start.d.mts +2 -1
  25. package/dist/cli/commands/workspace/app/health.d.mts +2 -1
  26. package/dist/cli/commands/workspace/app/list.d.mts +2 -1
  27. package/dist/cli/commands/workspace/create.d.mts +5 -2
  28. package/dist/cli/commands/workspace/delete.d.mts +2 -1
  29. package/dist/cli/commands/workspace/get.d.mts +2 -1
  30. package/dist/cli/commands/workspace/restore.d.mts +2 -1
  31. package/dist/cli/commands/workspace/user/invite.d.mts +2 -1
  32. package/dist/cli/commands/workspace/user/list.d.mts +2 -1
  33. package/dist/cli/commands/workspace/user/remove.d.mts +2 -1
  34. package/dist/cli/commands/workspace/user/update.d.mts +2 -1
  35. package/dist/cli/lib.d.mts +1 -1
  36. package/dist/cli/lib.mjs +1 -1
  37. package/dist/cli/lib.mjs.map +1 -1
  38. package/dist/cli/main.d.mts +2 -0
  39. package/dist/cli/main.mjs +44 -31
  40. package/dist/cli/main.mjs.map +1 -1
  41. package/dist/cli/query/index.d.mts +2 -1
  42. package/dist/cli/shared/args.d.mts +4 -2
  43. package/dist/cli/shared/client.d.mts +6 -1
  44. package/dist/cli/shared/context.d.mts +2 -1
  45. package/dist/cli/shared/logger.d.mts +5 -2
  46. package/dist/cli/shared/readonly-guard.d.mts +2 -1
  47. package/dist/cli/shared/seed-context.d.mts +5 -0
  48. package/dist/cli/shared/type-generator.d.mts +2 -1
  49. package/dist/completion/zsh-worker.zsh +217 -18
  50. package/dist/configure/config/types.d.mts +23 -1
  51. package/dist/configure/services/aigateway/types.d.mts +2 -1
  52. package/dist/configure/services/auth/types.d.mts +2 -1
  53. package/dist/configure/services/executor/executor.d.mts +2 -1
  54. package/dist/configure/services/executor/operation.d.mts +2 -1
  55. package/dist/configure/services/executor/trigger/event.d.mts +2 -1
  56. package/dist/configure/services/executor/trigger/schedule.d.mts +2 -1
  57. package/dist/configure/services/http-adapter/http-adapter.d.mts +2 -1
  58. package/dist/configure/services/idp/permission.d.mts +2 -1
  59. package/dist/configure/services/idp/types.d.mts +2 -1
  60. package/dist/configure/services/resolver/permission.d.mts +2 -1
  61. package/dist/configure/services/resolver/resolver.d.mts +2 -1
  62. package/dist/configure/services/secrets/types.d.mts +2 -1
  63. package/dist/configure/services/staticwebsite/types.d.mts +2 -1
  64. package/dist/configure/services/tailordb/permission.d.mts +2 -1
  65. package/dist/configure/services/tailordb/schema.d.mts +4 -3
  66. package/dist/configure/services/tailordb/types.d.mts +12 -1
  67. package/dist/configure/services/workflow/execution-policy.types.d.mts +2 -1
  68. package/dist/configure/services/workflow/job.d.mts +2 -1
  69. package/dist/configure/services/workflow/wait-point.d.mts +2 -1
  70. package/dist/configure/types/field.types.d.mts +2 -1
  71. package/dist/configure/types/permission-operand.types.d.mts +2 -1
  72. package/dist/configure/types/type.d.mts +2 -1
  73. package/dist/{crashreport-DFpRn-LS.mjs → crashreport-BAG8c7hB.mjs} +4 -4
  74. package/dist/{crashreport-DFpRn-LS.mjs.map → crashreport-BAG8c7hB.mjs.map} +1 -1
  75. package/dist/crashreport-BcXuocwI.mjs +1 -0
  76. package/dist/{errors-CpvSChyL.mjs → errors-D3qpNHR6.mjs} +2 -2
  77. package/dist/{errors-CpvSChyL.mjs.map → errors-D3qpNHR6.mjs.map} +1 -1
  78. package/dist/kysely-type-BWMfV301.mjs +48 -0
  79. package/dist/kysely-type-BWMfV301.mjs.map +1 -0
  80. package/dist/logger-DuaT2zY3.mjs +9 -0
  81. package/dist/logger-DuaT2zY3.mjs.map +1 -0
  82. package/dist/package-json-D1BRkjtr.mjs +1 -0
  83. package/dist/parser/service/tailordb/types.d.mts +3 -1
  84. package/dist/plugin/builtin/enum-constants/index.d.mts +2 -1
  85. package/dist/plugin/builtin/file-utils/index.d.mts +2 -1
  86. package/dist/plugin/builtin/kysely-type/index.d.mts +2 -1
  87. package/dist/plugin/builtin/kysely-type/index.mjs +1 -1
  88. package/dist/plugin/builtin/seed/index.d.mts +11 -1
  89. package/dist/plugin/builtin/seed/index.mjs +1 -1
  90. package/dist/register-ts-hook-yxshv0LV.mjs +1013 -0
  91. package/dist/register-ts-hook-yxshv0LV.mjs.map +1 -0
  92. package/dist/runtime/aigateway.mjs +1 -1
  93. package/dist/runtime/authconnection.mjs +1 -1
  94. package/dist/runtime/context.d.mts +2 -1
  95. package/dist/runtime/context.mjs +1 -1
  96. package/dist/runtime/date.d.mts +2 -1
  97. package/dist/runtime/field-parse.d.mts +2 -1
  98. package/dist/runtime/file.d.mts +2 -1
  99. package/dist/runtime/file.mjs +1 -1
  100. package/dist/runtime/globals.d.mts +2 -1
  101. package/dist/runtime/iconv.mjs +1 -1
  102. package/dist/runtime/idp.mjs +1 -1
  103. package/dist/runtime/logger.mjs +1 -1
  104. package/dist/runtime/secretmanager.mjs +1 -1
  105. package/dist/runtime/types.d.mts +2 -1
  106. package/dist/runtime/workflow.d.mts +2 -1
  107. package/dist/runtime/workflow.mjs +1 -1
  108. package/dist/schema-B6hJQWp6.mjs.map +1 -1
  109. package/dist/seed/index.d.mts +16 -3
  110. package/dist/seed/index.mjs +6 -6
  111. package/dist/seed/index.mjs.map +1 -1
  112. package/dist/seed-C3P_T_Eh.mjs.map +1 -1
  113. package/dist/{service-Cc7OY0Oh.mjs → service-CETr0AKY.mjs} +3 -3
  114. package/dist/service-CETr0AKY.mjs.map +1 -0
  115. package/dist/service-DREWLYxD.mjs +1 -0
  116. package/dist/{service-DFmt9UJP.mjs → service-b1g22NN9.mjs} +2 -2
  117. package/dist/{service-DFmt9UJP.mjs.map → service-b1g22NN9.mjs.map} +1 -1
  118. package/dist/service_pb-Bbu2QSIr.mjs +2 -0
  119. package/dist/service_pb-Bbu2QSIr.mjs.map +1 -0
  120. package/dist/service_pb-urxAIYHT.mjs +1 -0
  121. package/dist/tailor-proto/src/tailor/v1/events_pb.d.mts +53 -1
  122. package/dist/tailor-proto/src/tailor/v1/events_resource_pb.d.mts +33 -0
  123. package/dist/tailor-proto/src/tailor/v1/function_resource_pb.d.mts +0 -8
  124. package/dist/tailor-proto/src/tailor/v1/service_pb.d.mts +18 -1
  125. package/dist/tailor-proto/src/tailor/v1/tailordb_resource_pb.d.mts +4 -0
  126. package/dist/telemetry-DpkFGBmu.mjs +1 -0
  127. package/dist/{telemetry-Bklv9kQY.mjs → telemetry-Xk7J829P.mjs} +2 -2
  128. package/dist/{telemetry-Bklv9kQY.mjs.map → telemetry-Xk7J829P.mjs.map} +1 -1
  129. package/dist/types/tailordb.generated.d.mts +2 -0
  130. package/dist/vitest/index.mjs +1 -1
  131. package/dist/vitest/index.mjs.map +1 -1
  132. package/dist/vitest/mock-kysely.d.mts +2 -1
  133. package/dist/vitest/mocks/aigateway.d.mts +2 -1
  134. package/dist/vitest/mocks/authconnection.d.mts +2 -1
  135. package/dist/vitest/mocks/file.d.mts +3 -2
  136. package/dist/vitest/mocks/iconv.d.mts +2 -1
  137. package/dist/vitest/mocks/idp.d.mts +2 -1
  138. package/dist/vitest/mocks/logger.d.mts +2 -1
  139. package/dist/vitest/mocks/secretmanager.d.mts +2 -1
  140. package/dist/vitest/mocks/tailordb-pglite.d.mts +2 -1
  141. package/dist/vitest/mocks/tailordb.d.mts +2 -1
  142. package/dist/vitest/mocks/workflow.d.mts +3 -1
  143. package/dist/vitest/pglite-kysely.d.mts +2 -1
  144. package/dist/vitest/workflow-local.d.mts +2 -1
  145. package/dist/{workspace_resource_pb-ChWejcj0.mjs → workspace_resource_pb-CaoM2npP.mjs} +2 -2
  146. package/dist/{workspace_resource_pb-ChWejcj0.mjs.map → workspace_resource_pb-CaoM2npP.mjs.map} +1 -1
  147. package/docs/cli/application.md +13 -0
  148. package/docs/cli/data.md +105 -0
  149. package/docs/cli/secret.md +6 -6
  150. package/docs/cli/tailordb.md +18 -16
  151. package/docs/cli/user.md +37 -7
  152. package/docs/cli/workspace.md +9 -1
  153. package/docs/cli-reference.md +25 -3
  154. package/docs/configuration.md +9 -0
  155. package/docs/github-actions.md +89 -6
  156. package/docs/multi-environment.md +24 -0
  157. package/docs/services/idp.md +1 -1
  158. package/docs/services/tailordb-migration.md +68 -9
  159. package/docs/services/tailordb.md +17 -4
  160. package/docs/testing.md +1 -0
  161. package/package.json +8 -8
  162. package/dist/application-DFeuELRo.mjs.map +0 -1
  163. package/dist/application-nT_4a5HO.mjs +0 -1
  164. package/dist/crashreport-CBaRJl5h.mjs +0 -1
  165. package/dist/kysely-type-RDX59E1j.mjs +0 -48
  166. package/dist/kysely-type-RDX59E1j.mjs.map +0 -1
  167. package/dist/logger-Db-YRTwK.mjs +0 -9
  168. package/dist/logger-Db-YRTwK.mjs.map +0 -1
  169. package/dist/package-json-CmqhDJ__.mjs +0 -1
  170. package/dist/register-ts-hook-D6KXrGrB.mjs +0 -1009
  171. package/dist/register-ts-hook-D6KXrGrB.mjs.map +0 -1
  172. package/dist/service-Cc7OY0Oh.mjs.map +0 -1
  173. package/dist/service-sH2MZ4_W.mjs +0 -1
  174. package/dist/service_pb-Dw2ilc1O.mjs +0 -2
  175. package/dist/service_pb-Dw2ilc1O.mjs.map +0 -1
  176. package/dist/service_pb-GDOqfwb6.mjs +0 -1
  177. package/dist/telemetry-DXHP3VVi.mjs +0 -1
@@ -75,6 +75,11 @@ tailor deploy [options]
75
75
  | `--clean-cache` | - | Clean the bundle cache before building | No | - | - |
76
76
 
77
77
  See [Global Options](../cli-reference.md#global-options) for options available to all commands.
78
+
79
+ **Notes**
80
+
81
+ Workspace creation uses the selected user's default organization and folder set by `user update` when neither location is given and TAILOR_PLATFORM_TOKEN is not set. Giving --organization-id or --folder-id replaces both defaults. Organization and folder IDs loaded by --env-file also replace the defaults; command-line options take precedence, and empty env-file values are ignored. With --create-workspace, an existing workspace must match the resolved name, region, organization, and folder to be reused.
82
+
78
83
  **JSON result:**
79
84
 
80
85
  After a successful `tailor deploy --json`, stdout includes `status: "applied"`,
@@ -89,6 +94,14 @@ is registered or no resources changed.
89
94
  Plugins that return outputs add entries under `deployedHooks`. For example, the
90
95
  frontend plugin provides upload results in `deployedHooks[].outputs.frontends`.
91
96
 
97
+ When the deploy applied TailorDB migrations with maintenance mode enabled, `tailordbMaintenance` has one entry per
98
+ application whose migrations ran: its `application` name, `namespaces`, `maintenanceMs` (how
99
+ long their tables were in maintenance mode, equal to the sum of `phases`), `phases` in milliseconds
100
+ (`restrict`, `preMigration`, `jobSetup`, `waitingToStart`, `running`, `waitingOrRunning`,
101
+ `jobCleanup`, `postMigration`, `remainingDeploy`, `restore`), and `migrations` with each script's `namespace`,
102
+ `migrationNumber`, `startObserved`, `waitingToStartMs`, `runningMs`, and `waitingOrRunningMs`. See
103
+ [Time spent in maintenance mode](../services/tailordb-migration.md#time-spent-in-maintenance-mode).
104
+
92
105
  ```sh
93
106
  tailor deploy --json > deploy-result.json
94
107
  jq '.applications[] | {name, url, staticWebsites, auth}' deploy-result.json
@@ -0,0 +1,105 @@
1
+ # Data Commands
2
+
3
+ Commands for managing application data across workspaces.
4
+
5
+ ## data
6
+
7
+ Manage application data across workspaces.
8
+
9
+ **Usage**
10
+
11
+ ```
12
+ tailor data <command>
13
+ ```
14
+
15
+ See [Global Options](../cli-reference.md#global-options) for options available to all commands.
16
+
17
+ **Commands**
18
+
19
+ | Command | Description |
20
+ | ----------------------------------- | ---------------------------------------------------------------------------------------------------------------- |
21
+ | [`data clone`](#data-clone) | Clone the data of an application (TailorDB namespaces registered in its subgraph) from one workspace to another. |
22
+ | [`data operation`](#data-operation) | Inspect asynchronous application data operations. |
23
+
24
+ ### data clone
25
+
26
+ Clone the data of an application (TailorDB namespaces registered in its subgraph) from one workspace to another.
27
+
28
+ **Usage**
29
+
30
+ ```
31
+ tailor data clone [options]
32
+ ```
33
+
34
+ **Options**
35
+
36
+ | Option | Alias | Description | Required | Default | Env |
37
+ | --------------------- | ----- | -------------------------------------------------------------------------------------------------------- | -------- | -------------------- | ------------------------- |
38
+ | `--yes` | `-y` | Skip confirmation prompts | No | `false` | - |
39
+ | `--profile <PROFILE>` | `-p` | Workspace profile | No | - | `TAILOR_PLATFORM_PROFILE` |
40
+ | `--from <FROM>` | - | Workspace ID to copy data from | Yes | - | - |
41
+ | `--to <TO>` | - | Workspace ID to copy data to | Yes | - | - |
42
+ | `--name <NAME>` | `-n` | Application name, the same in the source and the target workspace (default: the name in the config file) | No | - | - |
43
+ | `--config <CONFIG>` | `-c` | Path to Tailor config file | No | `"tailor.config.ts"` | `TAILOR_CONFIG_PATH` |
44
+ | `--copy-files` | - | Also copy TailorDB file content | No | `false` | - |
45
+ | `--copy-idp-users` | - | Also copy IdP users, including their passwords | No | `false` | - |
46
+ | `--no-wait` | - | Start the clone and exit without waiting for it to finish | No | `false` | - |
47
+
48
+ See [Global Options](../cli-reference.md#global-options) for options available to all commands.
49
+
50
+ **Notes**
51
+
52
+ The platform rejects the clone with a failed precondition unless all of the following hold:
53
+
54
+ - The source and target workspaces are in the same region.
55
+ - The target workspace has the same namespaces as the source.
56
+ - The TailorDB schema of the target matches the source, so deploy the same version to the target first.
57
+ - The target is empty for every namespace and copy type in scope (TailorDB records, plus files and IdP users when `--copy-files` / `--copy-idp-users` are given).
58
+
59
+ The command waits until the clone finishes. Pressing Ctrl+C or passing --no-wait does not stop the clone, which keeps running on the platform. Use `tailor data operation get --wait` with the operation ID printed at the start to keep waiting, or without --wait to check the status once.
60
+
61
+ With --json, the result carries `status`: `completed` once the clone has finished, or `started` with --no-wait.
62
+
63
+ ### data operation
64
+
65
+ Inspect asynchronous application data operations.
66
+
67
+ **Usage**
68
+
69
+ ```
70
+ tailor data operation <command>
71
+ ```
72
+
73
+ See [Global Options](../cli-reference.md#global-options) for options available to all commands.
74
+
75
+ **Commands**
76
+
77
+ | Command | Description |
78
+ | ------------------------------------------- | ---------------------------------------------------------- |
79
+ | [`data operation get`](#data-operation-get) | Show the status of a data clone, or wait for it to finish. |
80
+
81
+ #### data operation get
82
+
83
+ Show the status of a data clone, or wait for it to finish.
84
+
85
+ **Usage**
86
+
87
+ ```
88
+ tailor data operation get [options]
89
+ ```
90
+
91
+ **Options**
92
+
93
+ | Option | Alias | Description | Required | Default | Env |
94
+ | ------------------------------- | ----- | ------------------------------------------- | -------- | ------- | ------------------------- |
95
+ | `--profile <PROFILE>` | `-p` | Workspace profile | No | - | `TAILOR_PLATFORM_PROFILE` |
96
+ | `--from <FROM>` | - | Workspace ID to copy data from | Yes | - | - |
97
+ | `--to <TO>` | - | Workspace ID to copy data to | Yes | - | - |
98
+ | `--operation-id <OPERATION_ID>` | - | Operation ID printed when the clone started | Yes | - | - |
99
+ | `--wait` | - | Wait until the clone completes or fails | No | `false` | - |
100
+
101
+ See [Global Options](../cli-reference.md#global-options) for options available to all commands.
102
+
103
+ **Notes**
104
+
105
+ Without --wait, the command prints the current status once and exits. With --wait, it waits until the clone completes or fails, and exits with an error if it fails. Pressing Ctrl+C stops waiting; the clone keeps running on the platform.
@@ -154,9 +154,9 @@ tailor secret vault create [options] <name>
154
154
 
155
155
  **Arguments**
156
156
 
157
- | Argument | Description | Required |
158
- | -------- | ----------- | -------- |
159
- | `name` | Vault name | Yes |
157
+ | Argument | Description | Required |
158
+ | ----------------------- | ----------- | -------- |
159
+ | `name`, `--name <NAME>` | Vault name | Yes |
160
160
 
161
161
  **Options**
162
162
 
@@ -179,9 +179,9 @@ tailor secret vault delete [options] <name>
179
179
 
180
180
  **Arguments**
181
181
 
182
- | Argument | Description | Required |
183
- | -------- | ----------- | -------- |
184
- | `name` | Vault name | Yes |
182
+ | Argument | Description | Required |
183
+ | ----------------------- | ----------- | -------- |
184
+ | `name`, `--name <NAME>` | Vault name | Yes |
185
185
 
186
186
  **Options**
187
187
 
@@ -33,9 +33,9 @@ tailor tailordb truncate [options] [tables]
33
33
 
34
34
  **Arguments**
35
35
 
36
- | Argument | Description | Required |
37
- | -------- | ----------------------- | -------- |
38
- | `tables` | Table names to truncate | No |
36
+ | Argument | Description | Required |
37
+ | ----------------------------- | ----------------------- | -------- |
38
+ | `tables`, `--tables <TABLES>` | Table names to truncate | No |
39
39
 
40
40
  **Options**
41
41
 
@@ -290,24 +290,26 @@ tailor tailordb migration test [options]
290
290
 
291
291
  **Options**
292
292
 
293
- | Option | Alias | Description | Required | Default | Env |
294
- | --------------------------------------------- | ----- | ---------------------------------------------------------------------- | -------- | -------------------- | ------------------------------ |
295
- | `--workspace-id <WORKSPACE_ID>` | `-w` | Workspace ID | No | - | `TAILOR_PLATFORM_WORKSPACE_ID` |
296
- | `--profile <PROFILE>` | `-p` | Workspace profile | No | - | `TAILOR_PLATFORM_PROFILE` |
297
- | `--config <CONFIG>` | `-c` | Path to Tailor config file | No | `"tailor.config.ts"` | `TAILOR_CONFIG_PATH` |
298
- | `--yes` | `-y` | Acknowledge that a designated target workspace may be overwritten | No | `false` | - |
299
- | `--data <DATA>` | - | Data source for the migration test (seed or clone) | No | `"seed"` | - |
300
- | `--target-workspace-id <TARGET_WORKSPACE_ID>` | - | Existing throwaway workspace to retain after the test (requires --yes) | No | - | - |
301
- | `--keep` | - | Keep the automatically created workspace after the test | No | `false` | - |
302
- | `--assert <ASSERT>` | - | Path to a TypeScript assertion script to run after migrations | No | - | - |
303
- | `--assert-namespace <ASSERT_NAMESPACE>` | - | TailorDB namespace exposed to the assertion script | No | - | - |
304
- | `--machine-user <MACHINE_USER>` | - | Machine user for seed and assertion script execution | No | - | - |
293
+ | Option | Alias | Description | Required | Default | Env |
294
+ | --------------------------------------------- | ----- | -------------------------------------------------------------------------------------------------------------------- | -------- | -------------------- | ------------------------------ |
295
+ | `--workspace-id <WORKSPACE_ID>` | `-w` | Workspace ID | No | - | `TAILOR_PLATFORM_WORKSPACE_ID` |
296
+ | `--profile <PROFILE>` | `-p` | Workspace profile | No | - | `TAILOR_PLATFORM_PROFILE` |
297
+ | `--config <CONFIG>` | `-c` | Path to Tailor config file | No | `"tailor.config.ts"` | `TAILOR_CONFIG_PATH` |
298
+ | `--yes` | `-y` | Acknowledge that a designated target workspace may be overwritten | No | `false` | - |
299
+ | `--data <DATA>` | - | Data source for the migration test (seed or clone) | No | `"seed"` | - |
300
+ | `--target-workspace-id <TARGET_WORKSPACE_ID>` | - | Existing throwaway workspace to retain after the test (requires --yes) | No | - | - |
301
+ | `--keep` | - | Keep the automatically created workspace after the test | No | `false` | - |
302
+ | `--assert <ASSERT>` | - | Path to a TypeScript assertion script to run after migrations | No | - | - |
303
+ | `--assert-namespace <ASSERT_NAMESPACE>` | - | TailorDB namespace exposed to the assertion script | No | - | - |
304
+ | `--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 | - | - |
305
+ | `--clone-timeout <CLONE_TIMEOUT>` | - | How long to wait for the clone to finish with --data clone, e.g. 30s or 10m (default: 30m) | No | - | - |
306
+ | `--machine-user <MACHINE_USER>` | - | Machine user for seed and assertion script execution | No | - | - |
305
307
 
306
308
  See [Global Options](../cli-reference.md#global-options) for options available to all commands.
307
309
 
308
310
  **Notes**
309
311
 
310
- The source workspace is read-only. Without --target-workspace-id, the command creates a workspace in the source workspace's region and deletes it after success or failure; pass --keep to retain it for inspection. A designated target is retained and requires --yes. Clone mode copies TailorDB records only; it does not copy IdP users or file blobs.
312
+ The source workspace is read-only. Without --target-workspace-id, the command creates a workspace in the source workspace's region and deletes it after success or failure; pass --keep to retain it for inspection. A designated target is retained and requires --yes. Clone mode copies TailorDB records only; it does not copy IdP users or file blobs. With --keep-ttl, the kept workspace records an expiry; it is not deleted automatically, but workspace prune --expired removes it once the expiry has passed.
311
313
 
312
314
  #### tailordb migration validate
313
315
 
package/docs/cli/user.md CHANGED
@@ -28,7 +28,7 @@ _no options_
28
28
 
29
29
  | Option | Alias | Description | Required | Default | Env |
30
30
  | --------------------------------- | ----- | --------------------------------- | -------- | ------- | -------------------------------------------- |
31
- | `--machine-user <MACHINE_USER>` | - | Login as a platform machine user. | Yes | - | - |
31
+ | `--machine-user` | - | Login as a platform machine user. | Yes | - | - |
32
32
  | `--client-id <CLIENT_ID>` | - | Client ID | Yes | - | `TAILOR_PLATFORM_MACHINE_USER_CLIENT_ID` |
33
33
  | `--client-secret <CLIENT_SECRET>` | - | Client secret | No | - | `TAILOR_PLATFORM_MACHINE_USER_CLIENT_SECRET` |
34
34
 
@@ -121,12 +121,13 @@ See [Global Options](../cli-reference.md#global-options) for options available t
121
121
 
122
122
  **Commands**
123
123
 
124
- | Command | Description |
125
- | ------------------------------- | ------------------------------ |
126
- | [`user current`](#user-current) | Show current user. |
127
- | [`user list`](#user-list) | List all users. |
128
- | [`user switch`](#user-switch) | Set current user. |
129
- | [`user pat`](#user-pat) | Manage personal access tokens. |
124
+ | Command | Description |
125
+ | ------------------------------- | -------------------------------------------------------------------------- |
126
+ | [`user current`](#user-current) | Show current user. |
127
+ | [`user list`](#user-list) | List all users. |
128
+ | [`user switch`](#user-switch) | Set current user. |
129
+ | [`user update`](#user-update) | Set the current user's default organization and folder for new workspaces. |
130
+ | [`user pat`](#user-pat) | Manage personal access tokens. |
130
131
 
131
132
  ### user current
132
133
 
@@ -302,6 +303,35 @@ tailor user switch [options] <user>
302
303
  | `--profile <PROFILE>` | `-p` | Workspace profile | No | - | `TAILOR_PLATFORM_PROFILE` |
303
304
 
304
305
  See [Global Options](../cli-reference.md#global-options) for options available to all commands.
306
+
307
+ ### user update
308
+
309
+ Set the current user's default organization and folder for new workspaces.
310
+
311
+ **Usage**
312
+
313
+ ```
314
+ tailor user update [options]
315
+ ```
316
+
317
+ **Options**
318
+
319
+ | Option | Alias | Description | Required | Default | Env |
320
+ | ----------------------------------------------------- | ----- | ---------------------------------------------------------------------------------------------------------------- | -------- | ------- | ------------------------- |
321
+ | `--default-organization-id <DEFAULT_ORGANIZATION_ID>` | `-o` | Organization that `workspace create` uses when no location is given. Pass an empty string to clear the defaults. | No | - | - |
322
+ | `--default-folder-id <DEFAULT_FOLDER_ID>` | `-f` | Folder in the default organization that `workspace create` uses (requires --default-organization-id) | No | - | - |
323
+ | `--profile <PROFILE>` | `-p` | Workspace profile | No | - | `TAILOR_PLATFORM_PROFILE` |
324
+
325
+ See [Global Options](../cli-reference.md#global-options) for options available to all commands.
326
+
327
+ **Notes**
328
+
329
+ `workspace create`, workspace creation during `deploy`, and the programmatic `createWorkspace()` use the default folder, or directly use the default organization when no folder is set. Giving either an organization or a folder replaces both defaults for that run. For the CLI, use --organization-id or --folder-id, or TAILOR_PLATFORM_ORGANIZATION_ID / TAILOR_PLATFORM_FOLDER_ID. The defaults are not used while TAILOR_PLATFORM_TOKEN is set, because that token does not belong to a user logged in here.
330
+
331
+ Each run replaces both defaults: --default-organization-id alone clears the default folder, --default-folder-id is accepted only together with --default-organization-id, and --default-organization-id "" clears both. The IDs are not checked against the Platform here; `workspace create` and `deploy` point back to them when the Platform cannot find them or denies access to them.
332
+
333
+ The defaults belong to this user's login on the selected platform, so `logout` removes them, and older SDK versions drop them when they rewrite the CLI config file.
334
+
305
335
  When no subcommand is provided, defaults to `list`.
306
336
 
307
337
  **Output (default):**
@@ -115,6 +115,12 @@ tailor workspace create [options]
115
115
 
116
116
  See [Global Options](../cli-reference.md#global-options) for options available to all commands.
117
117
 
118
+ **Notes**
119
+
120
+ Without --organization-id and --folder-id, on the command line or through TAILOR_PLATFORM_ORGANIZATION_ID / TAILOR_PLATFORM_FOLDER_ID, the workspace is created in the default organization and folder that the logged-in user set with `user update`, unless TAILOR_PLATFORM_TOKEN is set. Giving either option replaces both defaults, and --folder-id requires --organization-id.
121
+
122
+ 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.
123
+
118
124
  ### workspace delete
119
125
 
120
126
  Delete a Tailor Platform workspace.
@@ -207,7 +213,9 @@ Use this to reclaim workspaces left behind by CI runs, preview deployments, or i
207
213
 
208
214
  With --expired the workspaces select themselves instead: each one is deleted only once the --ttl expiry it recorded at creation has passed, so callers need no --name or --older-than. A workspace that records no expiry is never deleted this way, and neither is one whose recorded expiry cannot be read. Because that expiry is recorded on the workspace rather than derived from its name, anything able to write the workspace's metadata can bring its deletion forward -- and writing a workspace's metadata is a lesser permission than deleting it. --expired therefore requires at least one location, and --name still applies on top.
209
215
 
210
- Every workspace lives in exactly one location, and the location options name them explicitly: --organization-root selects the workspaces directly under an organization and none inside its folders, --folder-id selects the workspaces in one folder, and --personal selects the workspaces belonging to no organization and no folder. Each option can be given more than once, they combine as a union, and none of them is read from the environment -- a sweep covers exactly the locations spelled out on the command line. Selecting --personal is a deliberate choice to accept, for every organization-less workspace visible to this login, the expiry that anyone able to write a workspace's metadata may have recorded. Without any location option, a --name / --older-than sweep considers every visible workspace.
216
+ Every workspace lives in exactly one location, and the location options name them explicitly: --organization-root selects the workspaces directly under an organization and none inside its folders, --folder-id selects the workspaces in one folder, and --personal selects the workspaces belonging to no organization and no folder. Each option can be given more than once, they combine as a union, and none of them is read from the environment or from the default organization/folder set by `user update` -- a sweep covers exactly the locations spelled out on the command line. Selecting --personal is a deliberate choice to accept, for every organization-less workspace visible to this login, the expiry that anyone able to write a workspace's metadata may have recorded. Without any location option, a --name / --older-than sweep considers every visible workspace.
217
+
218
+ Without a location option, prune warns before listing workspaces that every workspace visible to this login is a candidate for the name and age filters, even with --yes or --dry-run. The default organization/folder set by `tailor user update` is not used.
211
219
 
212
220
  Restoring a workspace does not clear its recorded expiry, so a workspace restored after expiring is deleted again by the next --expired run. Restore it, then run `workspace ttl set` or `workspace ttl clear` before the next run — or keep it out of that run with --exclude.
213
221
 
@@ -50,6 +50,16 @@ keep table output. Other values are rejected. JSON mode also disables interactiv
50
50
  variable per invocation or per job rather than exporting it from a shell profile; a command that
51
51
  needed a prompt names what selected JSON when it refuses.
52
52
 
53
+ When an AI coding agent such as Claude Code, Codex, Cursor, or Gemini CLI runs the CLI, every
54
+ command defaults to JSON as if `TAILOR_JSON_OUTPUT=true` were set, and `--help` starts with a short
55
+ guide for the agent. The CLI recognizes an agent by the environment variables it sets for the
56
+ commands it runs; a non-blank `AI_AGENT` also counts as one. An explicit `--json` or
57
+ `TAILOR_JSON_OUTPUT` still wins, so `--json=false` or `TAILOR_JSON_OUTPUT=false` keeps table output
58
+ under an agent, and setting `POLITTY_NO_AGENT` to any non-empty value, such as `1`, turns agent
59
+ detection off. Set these variables in the environment itself: values loaded with `--env-file` do not
60
+ change the default. CLI plugins keep table output under an agent unless they receive `--json` or
61
+ `TAILOR_JSON_OUTPUT`, and their `--help` does not include the guide.
62
+
53
63
  Errors, warnings, progress, and diagnostic messages are written to stderr. A command failure under
54
64
  `--json` or `TAILOR_JSON_OUTPUT` emits a JSON error envelope to stderr, including a failure while
55
65
  parsing arguments: an unknown option or subcommand, or an option value that fails validation, is
@@ -107,9 +117,9 @@ without reporting through the CLI's error path, such as one relaying a failed re
107
117
  writes no annotation.
108
118
 
109
119
  Set `TAILOR_GITHUB_ACTIONS_ANNOTATIONS=false` (also `off`, `no`, or `0`) to turn annotations off.
110
- Passing `--json` or setting `TAILOR_JSON_OUTPUT` also suppresses them, so a workflow step that parses
111
- JSON output gets only the error envelope on stderr, even when the command fails during argument
112
- parsing.
120
+ Passing `--json`, setting `TAILOR_JSON_OUTPUT`, or the JSON default under an AI coding agent also
121
+ suppresses them, so a workflow step that parses JSON output gets only the error envelope on stderr,
122
+ even when the command fails during argument parsing.
113
123
 
114
124
  An annotation does not by itself fail a step: the step still fails on the CLI's exit code, which
115
125
  is unchanged. Workflows that already echo their own `::error::` around the CLI keep working;
@@ -314,6 +324,17 @@ Commands for managing TailorDB tables, data, and schema migrations.
314
324
  | [tailordb migration test](./cli/tailordb.md#tailordb-migration-test) | Test pending migrations with seed fixtures or cloned data in a temporary workspace. |
315
325
  | [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. |
316
326
 
327
+ ### [Data Commands](./cli/data.md)
328
+
329
+ Commands for managing application data across workspaces.
330
+
331
+ | Command | Description |
332
+ | ------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------- |
333
+ | [data](./cli/data.md#data) | Manage application data across workspaces. |
334
+ | [data clone](./cli/data.md#data-clone) | Clone the data of an application (TailorDB namespaces registered in its subgraph) from one workspace to another. |
335
+ | [data operation](./cli/data.md#data-operation) | Inspect asynchronous application data operations. |
336
+ | [data operation get](./cli/data.md#data-operation-get) | Show the status of a data clone, or wait for it to finish. |
337
+
317
338
  ### [Query Commands](./cli/query.md)
318
339
 
319
340
  Run ad-hoc SQL/GraphQL queries or enter the interactive REPL.
@@ -342,6 +363,7 @@ Commands for authentication and user management.
342
363
  | [user pat list](./cli/user.md#user-pat-list) | List all personal access tokens. |
343
364
  | [user pat update](./cli/user.md#user-pat-update) | Update a personal access token (delete and recreate). |
344
365
  | [user switch](./cli/user.md#user-switch) | Set current user. |
366
+ | [user update](./cli/user.md#user-update) | Set the current user's default organization and folder for new workspaces. |
345
367
 
346
368
  ### [Organization Commands](./cli/organization.md)
347
369
 
@@ -90,6 +90,15 @@ The default applies wherever the SDK parses or serializes `t` fields on your beh
90
90
 
91
91
  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`.
92
92
 
93
+ **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.
94
+
95
+ ```typescript
96
+ export default defineConfig({
97
+ name: "my-app",
98
+ maintenanceMode: "migration",
99
+ });
100
+ ```
101
+
93
102
  ### Service Configuration
94
103
 
95
104
  Specify glob patterns to load service files:
@@ -194,6 +194,26 @@ the `plan` job as well as `deploy`, because `plan` must enter the environment to
194
194
  read the variable. (A token-based read that lets `plan` run without entering the
195
195
  environment is planned.)
196
196
 
197
+ ## Package manager
198
+
199
+ The generated workflow sets up your package manager, installs dependencies with
200
+ it, and runs `tailor` through it. `setup ci` detects the package manager from the
201
+ lockfile at the repository root (`pnpm-lock.yaml`, `yarn.lock`, `bun.lock`,
202
+ `bun.lockb`, `package-lock.json`, or `npm-shrinkwrap.json`), or, when there is
203
+ none, from the `packageManager` or `devEngines.packageManager` field of the root
204
+ `package.json`. When neither names one, `setup ci` stops instead of guessing.
205
+
206
+ Pass `--package-manager` (`pnpm`, `npm`, `yarn`, or `bun`) to choose it
207
+ yourself, for example to generate the workflow before the lockfile exists:
208
+
209
+ ```bash
210
+ tailor setup ci branch --name my-app-stg --package-manager pnpm
211
+ ```
212
+
213
+ The workflow installs dependencies at the repository root, so commit the
214
+ lockfile there before it runs. `tailor setup update` keeps a package manager
215
+ chosen with `--package-manager` and detects it again otherwise.
216
+
197
217
  ## Generated files
198
218
 
199
219
  Running a workflow setup subcommand creates or updates:
@@ -553,6 +573,67 @@ plan job also enters the environment, allow `refs/pull/*/merge` as well so pull
553
573
  request plans keep running, and note that dry runs from other branches are then
554
574
  rejected too.
555
575
 
576
+ ## Seeding the workspace after deploy
577
+
578
+ Pass `--seed` to `setup ci branch`, `setup ci tag`, or `setup ci preview` to seed
579
+ the workspace with `tailor seed apply` right after each deploy. Add
580
+ `--seed-dataset <name>` (repeatable, implies `--seed`) to apply
581
+ [datasets](https://github.com/tailor-platform/sdk/tree/main/packages/sdk-plugin-seed#datasets)
582
+ on top of the base seed data:
583
+
584
+ ```bash
585
+ tailor setup ci branch --seed-dataset stg
586
+ tailor setup ci preview --region us-west --seed-dataset preview
587
+ ```
588
+
589
+ The deploy job gains a `tailor-seed` step after the deploy step. Branch targets
590
+ validate seed data before deploy and also in the PR or dry-run plan job; tag
591
+ targets validate it in the plan job before deploy. Both use
592
+ `tailor seed validate --upsert` with the selected datasets to check the `id`
593
+ and required fields that `seed apply --upsert` needs. Preview targets validate
594
+ and apply the data after deploy.
595
+
596
+ | Target | Seeds with | Effect |
597
+ | ----------- | ------------------------------------ | ----------------------------------------------------------------------------- |
598
+ | branch, tag | `tailor seed apply --upsert` | The fields of each committed seed row are written; other rows are kept |
599
+ | preview | `tailor seed apply --truncate --yes` | The preview workspace is emptied, IdP users included, and seeded from scratch |
600
+
601
+ Setup stops unless the config uses `seedPlugin` with `machineUserName`, which
602
+ names the machine user that seeds, and an existing `<distPath>/data/` directory.
603
+ Every `--seed-dataset` must name an entry of
604
+ the `seedPlugin` `datasets` option or a directory under `<distPath>/data/`.
605
+ Commit the dataset directories the workflow seeds: a gitignored dataset such as
606
+ a per-developer `local/` is not in the CI checkout.
607
+ Install `@tailor-platform/sdk-plugin-seed` so the `tailor seed` commands resolve
608
+ in CI. For branch and tag targets, use a version that supports
609
+ `tailor seed validate --upsert`; update the setup and seed plugins together.
610
+ Give every TailorDB seed row an `id` and
611
+ every field its table requires: `--upsert` matches rows by id, so run
612
+ `tailor seed fill` and commit the result.
613
+ Seeding is available for a target that deploys one app.
614
+
615
+ Before enabling it, note that:
616
+
617
+ - Every branch or tag deploy writes the fields of the committed seed rows over
618
+ the workspace, `_User` rows and their passwords included, so an edit to one of
619
+ those fields in the workspace is undone. Each row is updated like any other update: update hooks
620
+ and validation run, `updatedAt` changes, and executors with
621
+ `recordUpdatedTrigger` fire once per seeded row on every deploy.
622
+ - Every preview deploy deletes the data reviewers added to the preview
623
+ workspace. That is every push, and with `--require-preview-label` also every
624
+ label added to the pull request, since each one redeploys the preview.
625
+ - A seed failure fails the deploy job and its notification, although the deploy
626
+ itself went through.
627
+ - The step shares the deploy job's timeout. IdP users take about a second each.
628
+ - Steps you added after the deploy step stay right after it, so they run before
629
+ `tailor-seed`. Move a step below `tailor-seed` when it needs the seeded data,
630
+ and move it again if you regenerate without `--seed` and then with it.
631
+ - `tailor-seed` is an SDK-managed step. To seed another way (a different mode,
632
+ `--skip-idp`, a condition), leave `--seed` off and add your own step.
633
+
634
+ Re-run `setup ci` with the flags each time you regenerate the workflow; `setup
635
+ update` keeps them.
636
+
556
637
  ## Monorepo setup
557
638
 
558
639
  For a monorepo where your SDK app lives in a subdirectory, pass `--dir`:
@@ -673,8 +754,9 @@ a branch target deploys only its target branch, so use Option 1 there.
673
754
  - **Schema and data are not rolled back.** If the older config expects a schema
674
755
  state that no longer exists, the plan may show errors. In that case, review
675
756
  the diff carefully before proceeding.
676
- - **Seed data** is not part of the deployment pipeline and is unaffected by
677
- rollbacks.
757
+ - **Seed data** is not rolled back. Without `--seed`, the pipeline does not
758
+ touch it; with `--seed`, deploying an older commit seeds the rows committed
759
+ there on top of the current data.
678
760
  - **Static websites** are not yet integrated into the generated pipeline.
679
761
  Static asset rollbacks must be performed manually.
680
762
 
@@ -781,10 +863,11 @@ It regenerates every workflow recorded in
781
863
  have to re-type `setup ci branch`, `setup ci tag`, and the rest one by one.
782
864
  Your own jobs, steps, and settings are kept (see
783
865
  [Customizing the generated workflow](#customizing-the-generated-workflow)). A
784
- branch that was detected from the repository default branch is detected again,
785
- and the parts that follow your config — the migration drift check, seed
786
- validation, and ERD preview namespaces — are derived
787
- from the current `tailor.config.ts`.
866
+ branch that was detected from the repository default branch and a
867
+ [package manager](#package-manager) that was detected from the repository root
868
+ are detected again, and the parts that follow your config — the migration drift
869
+ check, seed validation, and ERD preview namespaces — are derived from the
870
+ current `tailor.config.ts`.
788
871
 
789
872
  A target that cannot be regenerated, for example because you edited a managed
790
873
  part, does not stop the others: `update` regenerates the rest, then lists the
@@ -96,3 +96,27 @@ defineStaticWebSite("my-website", {
96
96
  customDomains: process.env.APP_ENV === "production" ? ["app.example.com"] : undefined,
97
97
  });
98
98
  ```
99
+
100
+ ## Seed data per environment and per scenario
101
+
102
+ `seedPlugin` seeds every environment from the JSONL files in `<distPath>/data/`. Rows that only some environments or scenarios need go into **datasets** — directories under `<distPath>/data/` that hold JSONL files for some of the tables — and are applied on top of the base seed data with `tailor seed apply --dataset <name>`:
103
+
104
+ ```
105
+ seed/data/
106
+ *.schema.ts, *.jsonl # base seed data, applied everywhere
107
+ cogs/Item.jsonl # scenario: rows only a costing demo needs
108
+ dev/Account.jsonl # environment: the dev variant of a table
109
+ stg/Account.jsonl # environment: the staging variant of the same table
110
+ local/_User.jsonl # per developer, gitignored
111
+ ```
112
+
113
+ A table whose rows differ per environment lives only in the per-environment datasets, since a row may be defined in only one of the selected files. Name the combinations each environment uses in the `datasets` option of `seedPlugin`, so a deploy pipeline runs `tailor seed apply --dataset preview` instead of repeating the list:
114
+
115
+ ```typescript
116
+ seedPlugin({
117
+ distPath: "./seed",
118
+ datasets: { preview: ["cogs", "dev"] },
119
+ });
120
+ ```
121
+
122
+ The `tailor seed` commands come from the `@tailor-platform/sdk-plugin-seed` CLI plugin; see its [Datasets](https://github.com/tailor-platform/sdk/tree/main/packages/sdk-plugin-seed#datasets) guide for validating, filling, and dumping datasets.
@@ -106,7 +106,7 @@ defineIdp("my-idp", {
106
106
  **Operators:** `"="`, `"!="`, `"in"`, `"not in"`
107
107
 
108
108
  > [!WARNING]
109
- > A policy of `[{ user: "_loggedIn" }, "=", true]` permits every authenticated user to run the operation against any IdP user. For `read` and `update` this exposes and lets them change other users' login information (such as email addresses), and for `sendPasswordResetEmail` it lets them send reset emails to anyone. Use it only when every user who can sign in to the project is trusted. For an IdP used by external users (such as business partners), restrict each operation to an administrator role as shown above.
109
+ > A policy of `[{ user: "_loggedIn" }, "=", true]` permits every authenticated user to run the operation against any IdP user. For `read` and `update` this exposes and lets them change other users' login information (such as email addresses), and for `sendPasswordResetEmail` it lets them send reset emails to anyone. Use it only when every user who can sign in to the project is trusted. For an IdP used by external users (such as business partners), restrict each operation to an administrator role as shown above. `tailor deploy` warns about each rule whose only condition is `_loggedIn`.
110
110
 
111
111
  **Helper:** `unsafeAllowAllIdPPermission` grants full access without conditions. Intended only for development and testing.
112
112