@tailor-platform/sdk 2.0.0-next.5 → 2.0.0-next.7

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 (129) hide show
  1. package/CHANGELOG.md +85 -0
  2. package/dist/{application-Bf8wxOi6.mjs → application-GzW98_Xr.mjs} +377 -1418
  3. package/dist/application-GzW98_Xr.mjs.map +1 -0
  4. package/dist/application-OM0taSPn.mjs +3 -0
  5. package/dist/cli/commands/deploy/deploy.d.mts +8 -3
  6. package/dist/cli/commands/generate/options.d.mts +0 -1
  7. package/dist/cli/commands/generate/service.d.mts +1 -1
  8. package/dist/cli/commands/staticwebsite/deploy.d.mts +19 -0
  9. package/dist/cli/commands/workspace/create.d.mts +3 -0
  10. package/dist/cli/commands/workspace/list.d.mts +1 -0
  11. package/dist/cli/commands/workspace/transform.d.mts +2 -0
  12. package/dist/cli/index.mjs +781 -1553
  13. package/dist/cli/index.mjs.map +1 -1
  14. package/dist/cli/lib.d.mts +7 -3
  15. package/dist/cli/lib.mjs +49 -3
  16. package/dist/cli/lib.mjs.map +1 -1
  17. package/dist/cli/shared/config-loader.d.mts +1 -1
  18. package/dist/cli/shared/readonly-guard.d.mts +25 -0
  19. package/dist/cli/shared/tailordb-namespaces.d.mts +37 -0
  20. package/dist/cli/shared/workspace-name.d.mts +1 -0
  21. package/dist/completion/zsh-worker.zsh +15 -303
  22. package/dist/configure/config/types.d.mts +5 -1
  23. package/dist/configure/index.mjs +20 -19
  24. package/dist/configure/index.mjs.map +1 -1
  25. package/dist/configure/services/auth/types.d.mts +18 -23
  26. package/dist/configure/services/executor/executor.d.mts +2 -13
  27. package/dist/configure/services/executor/operation.d.mts +8 -3
  28. package/dist/configure/services/tailordb/schema.d.mts +1 -7
  29. package/dist/configure/services/tailordb/types.d.mts +1 -1
  30. package/dist/configure/services/workflow/execution-policy.d.mts +2 -2
  31. package/dist/configure/services/workflow/job.d.mts +10 -10
  32. package/dist/configure/services/workflow/workflow.d.mts +6 -4
  33. package/dist/configure/types/type.d.mts +1 -9
  34. package/dist/{crashreport-D3RjuSYb.mjs → crashreport-0ioNRZ4K.mjs} +1 -1
  35. package/dist/{crashreport-Cg-pqRJV.mjs → crashreport-CxHne11E.mjs} +4 -3
  36. package/dist/{crashreport-Cg-pqRJV.mjs.map → crashreport-CxHne11E.mjs.map} +1 -1
  37. package/dist/errors-DfnF4ibq.mjs +100 -0
  38. package/dist/errors-DfnF4ibq.mjs.map +1 -0
  39. package/dist/{globals-BjhJJ2dN.mjs → globals-CBZ0egXT.mjs} +13 -10
  40. package/dist/globals-CBZ0egXT.mjs.map +1 -0
  41. package/dist/{logger-BEiZZ3qT.mjs → logger-BwS4ppwO.mjs} +3 -3
  42. package/dist/logger-BwS4ppwO.mjs.map +1 -0
  43. package/dist/parser/service/tailordb/type-source.d.mts +10 -0
  44. package/dist/{register-ts-hook-BhzVkej0.mjs → register-ts-hook-DvEs6YsL.mjs} +2571 -1636
  45. package/dist/register-ts-hook-DvEs6YsL.mjs.map +1 -0
  46. package/dist/{registry-BSbq6SPo.mjs → registry-i7EdJ-D5.mjs} +10 -10
  47. package/dist/registry-i7EdJ-D5.mjs.map +1 -0
  48. package/dist/runtime/field-parse.d.mts +10 -0
  49. package/dist/runtime/globals.d.mts +3 -3
  50. package/dist/runtime/index.mjs +1 -1
  51. package/dist/runtime/workflow.d.mts +18 -33
  52. package/dist/runtime/workflow.mjs +1 -1
  53. package/dist/{schema-iCd1ugGp.mjs → schema--xYWRGfe.mjs} +42 -24
  54. package/dist/schema--xYWRGfe.mjs.map +1 -0
  55. package/dist/{secret-file-aoNXJmKa.mjs → secret-file-C3J4Gy8r.mjs} +2 -27
  56. package/dist/secret-file-C3J4Gy8r.mjs.map +1 -0
  57. package/dist/{secretmanager-Bd45j7an.mjs → secretmanager-IY4UvinW.mjs} +42 -9
  58. package/dist/secretmanager-IY4UvinW.mjs.map +1 -0
  59. package/dist/service-BJAQ70e5.mjs +3 -0
  60. package/dist/{service-DeZeYa06.mjs → service-DaeJlBoH.mjs} +3 -3
  61. package/dist/{service-DeZeYa06.mjs.map → service-DaeJlBoH.mjs.map} +1 -1
  62. package/dist/{service-CzZEVrp9.mjs → service-Dmxa2I4i.mjs} +64 -28
  63. package/dist/service-Dmxa2I4i.mjs.map +1 -0
  64. package/dist/service_pb-BoLM0X4K.mjs +167 -0
  65. package/dist/service_pb-BoLM0X4K.mjs.map +1 -0
  66. package/dist/{service_pb-DZkfjB_6.mjs → service_pb-r1T7kpJc.mjs} +1 -1
  67. package/dist/types/executor.generated.d.mts +60 -42
  68. package/dist/user-agent-Bgsszb5I.mjs +28 -0
  69. package/dist/user-agent-Bgsszb5I.mjs.map +1 -0
  70. package/dist/utils/test/index.mjs +11 -11
  71. package/dist/utils/test/index.mjs.map +1 -1
  72. package/dist/utils/test/mock.d.mts +6 -6
  73. package/dist/vitest/environment.mjs +1 -1
  74. package/dist/vitest/index.d.mts +8 -8
  75. package/dist/vitest/index.mjs +613 -227
  76. package/dist/vitest/index.mjs.map +1 -1
  77. package/dist/vitest/mock.d.mts +8 -8
  78. package/dist/vitest/mocks/aigateway.d.mts +14 -4
  79. package/dist/vitest/mocks/authconnection.d.mts +14 -4
  80. package/dist/vitest/mocks/file.d.mts +23 -6
  81. package/dist/vitest/mocks/iconv.d.mts +28 -4
  82. package/dist/vitest/mocks/idp.d.mts +25 -9
  83. package/dist/vitest/mocks/secretmanager.d.mts +13 -4
  84. package/dist/vitest/mocks/tailordb.d.mts +48 -7
  85. package/dist/vitest/mocks/workflow.d.mts +59 -33
  86. package/dist/vitest/setup.mjs +2 -2
  87. package/dist/vitest/workflow-local.d.mts +2 -2
  88. package/dist/workflow-CsBvRE3g.mjs +34 -0
  89. package/dist/workflow-CsBvRE3g.mjs.map +1 -0
  90. package/dist/{service_pb-Bk7dL-yT.mjs → workspace_resource_pb-Db3fv68L.mjs} +47 -165
  91. package/dist/workspace_resource_pb-Db3fv68L.mjs.map +1 -0
  92. package/docs/cli/application.md +63 -15
  93. package/docs/cli/function.md +2 -2
  94. package/docs/cli/tailordb.md +8 -140
  95. package/docs/cli/workspace.md +6 -4
  96. package/docs/cli-reference.md +11 -8
  97. package/docs/configuration.md +2 -0
  98. package/docs/github-actions.md +8 -0
  99. package/docs/migration/v2.md +169 -11
  100. package/docs/runtime.md +5 -6
  101. package/docs/services/auth.md +7 -7
  102. package/docs/services/executor.md +5 -0
  103. package/docs/services/tailordb.md +44 -0
  104. package/docs/services/workflow.md +43 -43
  105. package/docs/testing.md +112 -96
  106. package/package.json +2 -5
  107. package/dist/application-Bf8wxOi6.mjs.map +0 -1
  108. package/dist/application-CUkjzfij.mjs +0 -3
  109. package/dist/cli/erd-viewer-assets/app.js +0 -1424
  110. package/dist/cli/erd-viewer-assets/index.html +0 -77
  111. package/dist/cli/erd-viewer-assets/serve.json +0 -13
  112. package/dist/cli/erd-viewer-assets/styles.css +0 -1036
  113. package/dist/configure/types/field-runtime.d.mts +0 -16
  114. package/dist/errors-118wUDRr.mjs +0 -42
  115. package/dist/errors-118wUDRr.mjs.map +0 -1
  116. package/dist/globals-BjhJJ2dN.mjs.map +0 -1
  117. package/dist/logger-BEiZZ3qT.mjs.map +0 -1
  118. package/dist/register-ts-hook-BhzVkej0.mjs.map +0 -1
  119. package/dist/registry-BSbq6SPo.mjs.map +0 -1
  120. package/dist/resource_pb-BRv7AMXK.mjs +0 -49
  121. package/dist/resource_pb-BRv7AMXK.mjs.map +0 -1
  122. package/dist/schema-iCd1ugGp.mjs.map +0 -1
  123. package/dist/secret-file-aoNXJmKa.mjs.map +0 -1
  124. package/dist/secretmanager-Bd45j7an.mjs.map +0 -1
  125. package/dist/service-BT0GPd01.mjs +0 -3
  126. package/dist/service-CzZEVrp9.mjs.map +0 -1
  127. package/dist/service_pb-Bk7dL-yT.mjs.map +0 -1
  128. package/dist/workflow-GNuSnsTx.mjs +0 -22
  129. package/dist/workflow-GNuSnsTx.mjs.map +0 -1
@@ -38,10 +38,9 @@ tailor generate [options]
38
38
 
39
39
  **Options**
40
40
 
41
- | Option | Alias | Description | Required | Default |
42
- | ------------------- | ----- | ---------------------------------------------- | -------- | -------------------- |
43
- | `--config <CONFIG>` | `-c` | Path to SDK config file | No | `"tailor.config.ts"` |
44
- | `--watch` | `-W` | Watch for type/resolver changes and regenerate | No | `false` |
41
+ | Option | Alias | Description | Required | Default |
42
+ | ------------------- | ----- | ----------------------- | -------- | -------------------- |
43
+ | `--config <CONFIG>` | `-c` | Path to SDK config file | No | `"tailor.config.ts"` |
45
44
 
46
45
  See [Global Options](../cli-reference.md#global-options) for options available to all commands.
47
46
 
@@ -57,19 +56,66 @@ tailor deploy [options]
57
56
 
58
57
  **Options**
59
58
 
60
- | Option | Alias | Description | Required | Default | Env |
61
- | ------------------------------- | ----- | ------------------------------------------------------------------------------------ | -------- | -------------------- | --------------------------------- |
62
- | `--workspace-id <WORKSPACE_ID>` | `-w` | Workspace ID | No | - | `TAILOR_PLATFORM_WORKSPACE_ID` |
63
- | `--profile <PROFILE>` | `-p` | Workspace profile | No | - | `TAILOR_PLATFORM_PROFILE` |
64
- | `--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` |
65
- | `--yes` | `-y` | Skip confirmation prompts | No | `false` | - |
66
- | `--dry-run` | `-d` | Run the command without making any changes | No | - | - |
67
- | `--no-schema-check` | - | Skip schema diff check against migration snapshots | No | - | - |
68
- | `--no-validate` | - | Skip client-side validation against platform resource constraints | No | - | - |
69
- | `--no-cache` | - | Disable bundle caching for this run | No | - | - |
70
- | `--clean-cache` | - | Clean the bundle cache before building | No | - | - |
59
+ | Option | Alias | Description | Required | Default | Env |
60
+ | --------------------------------------- | ----- | ------------------------------------------------------------------------------------ | -------- | -------------------- | --------------------------------- |
61
+ | `--workspace-id <WORKSPACE_ID>` | `-w` | Workspace ID | No | - | `TAILOR_PLATFORM_WORKSPACE_ID` |
62
+ | `--profile <PROFILE>` | `-p` | Workspace profile | No | - | `TAILOR_PLATFORM_PROFILE` |
63
+ | `--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` |
64
+ | `--yes` | `-y` | Skip confirmation prompts | No | `false` | - |
65
+ | `--create-workspace` | - | Create a workspace when the account has none | No | - | - |
66
+ | `--workspace-name <WORKSPACE_NAME>` | - | Name for a workspace created during deploy | No | - | - |
67
+ | `--workspace-region <WORKSPACE_REGION>` | - | Region for a workspace created during deploy | No | - | - |
68
+ | `--organization-id <ORGANIZATION_ID>` | - | Organization ID for a workspace created during deploy | No | - | `TAILOR_PLATFORM_ORGANIZATION_ID` |
69
+ | `--folder-id <FOLDER_ID>` | - | Folder ID for a workspace created during deploy | No | - | `TAILOR_PLATFORM_FOLDER_ID` |
70
+ | `--dry-run` | `-d` | Run the command without making any changes | No | - | - |
71
+ | `--no-schema-check` | - | Skip schema diff check against migration snapshots | No | - | - |
72
+ | `--no-validate` | - | Skip client-side validation against platform resource constraints | No | - | - |
73
+ | `--no-cache` | - | Disable bundle caching for this run | No | - | - |
74
+ | `--clean-cache` | - | Clean the bundle cache before building | No | - | - |
71
75
 
72
76
  See [Global Options](../cli-reference.md#global-options) for options available to all commands.
77
+ **Workspace Selection:**
78
+
79
+ After validating the configuration file, `deploy` resolves a workspace before bundling the
80
+ application. Explicit configuration takes precedence in this order: `--workspace-id`,
81
+ `TAILOR_PLATFORM_WORKSPACE_ID`, and the selected profile. Otherwise, `deploy` reuses the workspace
82
+ previously selected for that configuration from project-local state. Each config file keeps an
83
+ independent selection, including when multiple configs share a directory. An explicit workspace also
84
+ updates this selection. Saved selections are verified against the workspaces currently visible to
85
+ the authenticated user before reuse, and `deploy` warns when it uses one.
86
+
87
+ When the project has no saved selection, `deploy` discovers the account's workspaces:
88
+
89
+ - One or more workspaces open a selection prompt in an interactive terminal, with an option to
90
+ create a new workspace. With one workspace in non-interactive or JSON mode, it is selected
91
+ automatically. With multiple workspaces, pass `--workspace-id` instead.
92
+ - No workspaces open a guided creation flow in an interactive terminal. The flow asks for a name,
93
+ fetches the available regions from the Platform, and confirms before creating anything. After
94
+ creation, the output shows how to reuse the workspace with `--workspace-id` or
95
+ `TAILOR_PLATFORM_WORKSPACE_ID` from CI or another machine.
96
+
97
+ In CI and other non-interactive environments, workspace creation must be explicit:
98
+
99
+ ```bash
100
+ tailor-sdk deploy \
101
+ --create-workspace \
102
+ --workspace-name example-workspace \
103
+ --workspace-region us-west
104
+ ```
105
+
106
+ `--create-workspace` only creates when the account has no workspace. If the existing workspace
107
+ matches the requested name, region, organization, and folder, `deploy` reuses it so the same command
108
+ is safe to rerun. If multiple workspaces exist, the flag never creates another one or guesses which
109
+ workspace to use. `--yes` skips deployment confirmation but does not authorize workspace creation.
110
+
111
+ If a saved workspace has been deleted or is no longer accessible, interactive terminals return to
112
+ workspace selection. Non-interactive environments stop with `WORKSPACE_CONTEXT_STALE` instead of
113
+ silently switching to another workspace. Automatically selected targets are printed with their
114
+ region, organization, and workspace ID.
115
+
116
+ `--dry-run` never creates a workspace or writes project context. When an account has no workspace,
117
+ create one explicitly before requesting a deployment plan.
118
+
73
119
  **Config File Modification:**
74
120
 
75
121
  On first run, `deploy` automatically injects a stable `id: "<uuid>"` field into your `defineConfig({...})` call in `tailor.config.ts`. This UUID is used to track your application across renames so the SDK can recognize ownership across renames. Commit the generated id to version control. See [Configuration](../configuration.md#application-settings) for details.
@@ -84,6 +130,8 @@ tailor deploy --config apps/buyer/tailor.config.ts,apps/supplier/tailor.config.t
84
130
 
85
131
  When multiple configs are provided, `deploy` creates or updates all configured services first, then updates the applications. This lets one application reference resources owned by another config with `external: true` during the same deploy.
86
132
 
133
+ Each config's `files` and `ignores` patterns (see [Service Configuration](../configuration.md#service-configuration)) resolve relative to that config's own directory, not the directory you ran `deploy` from. For example, `apps/buyer/tailor.config.ts` declaring `files: ["db/**/*.ts"]` loads files from `apps/buyer/db/`, independent of where `apps/supplier/tailor.config.ts`'s patterns resolve. If a config's relative patterns match nothing under its own directory, the SDK falls back to the invocation directory and logs a warning (see [Service Configuration](../configuration.md#service-configuration) for details).
134
+
87
135
  **Migration Handling:**
88
136
 
89
137
  When migrations are configured (`db.tailordb.migration` in config), the `deploy` command automatically:
@@ -178,5 +178,5 @@ You can pass either a source file (`.ts`) or a pre-bundled file (`.js`).
178
178
  When a `.js` file is provided, detection and bundling are skipped and the file is executed as-is.
179
179
 
180
180
  > [!WARNING]
181
- > Workflow job `.trigger()` calls do not work in test-run mode.
182
- > Triggered jobs are not executed; only the target job's `body` function runs in isolation.
181
+ > Workflow job `.start()` calls do not work in test-run mode.
182
+ > Started jobs are not executed; only the target job's `body` function runs in isolation.
@@ -16,11 +16,10 @@ See [Global Options](../cli-reference.md#global-options) for options available t
16
16
 
17
17
  **Commands**
18
18
 
19
- | Command | Description |
20
- | ------------------------------------------- | ------------------------------------------------------------------------- |
21
- | [`tailordb truncate`](#tailordb-truncate) | Truncate (delete all records from) TailorDB tables. |
22
- | [`tailordb migration`](#tailordb-migration) | Manage TailorDB schema migrations. |
23
- | [`tailordb erd`](#tailordb-erd) | Generate TailorDB ERD viewer artifacts from local TailorDB schema. (beta) |
19
+ | Command | Description |
20
+ | ------------------------------------------- | --------------------------------------------------- |
21
+ | [`tailordb truncate`](#tailordb-truncate) | Truncate (delete all records from) TailorDB tables. |
22
+ | [`tailordb migration`](#tailordb-migration) | Manage TailorDB schema migrations. |
24
23
 
25
24
  ### tailordb truncate
26
25
 
@@ -232,142 +231,11 @@ See [Global Options](../cli-reference.md#global-options) for options available t
232
231
 
233
232
  ### tailordb erd
234
233
 
235
- Generate TailorDB ERD viewer artifacts from local TailorDB schema. (beta)
236
-
237
- **Usage**
238
-
239
- ```
240
- tailor tailordb erd <command>
241
- ```
242
-
243
- See [Global Options](../cli-reference.md#global-options) for options available to all commands.
244
-
245
- **Commands**
246
-
247
- | Command | Description |
248
- | --------------------------------------------- | ----------------------------------------------------------------- |
249
- | [`tailordb erd export`](#tailordb-erd-export) | Export TailorDB ERD static viewer from local TailorDB schema. |
250
- | [`tailordb erd diff`](#tailordb-erd-diff) | Render TailorDB ERD schema diff HTML from exported ERD viewers. |
251
- | [`tailordb erd serve`](#tailordb-erd-serve) | Generate and serve TailorDB ERD locally with watch reload. (beta) |
252
- | [`tailordb erd deploy`](#tailordb-erd-deploy) | Deploy ERD static website for TailorDB namespace(s). |
253
-
254
- #### tailordb erd export
255
-
256
- Export TailorDB ERD static viewer from local TailorDB schema.
257
-
258
- **Usage**
259
-
260
- ```
261
- tailor tailordb erd export [options]
262
- ```
263
-
264
- **Options**
265
-
266
- | Option | Alias | Description | Required | Default | Env |
267
- | ------------------------- | ----- | ---------------------------------------------------------------------------------------------- | -------- | -------------------- | -------------------- |
268
- | `--config <CONFIG>` | `-c` | Path to Tailor config file | No | `"tailor.config.ts"` | `TAILOR_CONFIG_PATH` |
269
- | `--namespace <NAMESPACE>` | `-n` | TailorDB namespace name (optional if only one namespace is defined in config) | No | - | - |
270
- | `--output <OUTPUT>` | `-o` | Output directory path for TailorDB ERD viewer files (writes to `<outputDir>/<namespace>/dist`) | No | `".tailor/erd"` | - |
271
-
272
- See [Global Options](../cli-reference.md#global-options) for options available to all commands.
273
-
274
- #### tailordb erd diff
275
-
276
- Render TailorDB ERD schema diff HTML from exported ERD viewers.
277
-
278
- **Usage**
279
-
280
- ```
281
- tailor tailordb erd diff [options]
282
- ```
283
-
284
- **Options**
285
-
286
- | Option | Alias | Description | Required | Default |
287
- | ----------------------------- | ----- | ----------------------------------------------------------------------- | -------- | ------- |
288
- | `--base-html <BASE_HTML>` | - | Base ERD viewer HTML file | No | - |
289
- | `--head-html <HEAD_HTML>` | - | Head ERD viewer HTML file | No | - |
290
- | `--namespace <NAMESPACE>` | `-n` | TailorDB namespace name (defaults to the provided ERD schema namespace) | No | - |
291
- | `--output <OUTPUT>` | `-o` | Output ERD diff HTML file | Yes | - |
292
- | `--output-json <OUTPUT_JSON>` | - | Optional output JSON file for the computed diff | No | - |
293
-
294
- See [Global Options](../cli-reference.md#global-options) for options available to all commands.
295
-
296
- #### tailordb erd serve
297
-
298
- Generate and serve TailorDB ERD locally with watch reload. (beta)
299
-
300
- **Usage**
301
-
302
- ```
303
- tailor tailordb erd serve [options]
304
- ```
305
-
306
- **Options**
307
-
308
- | Option | Alias | Description | Required | Default | Env |
309
- | ------------------------- | ----- | ------------------------------------------------------------------------- | -------- | -------------------- | -------------------- |
310
- | `--config <CONFIG>` | `-c` | Path to Tailor config file | No | `"tailor.config.ts"` | `TAILOR_CONFIG_PATH` |
311
- | `--namespace <NAMESPACE>` | `-n` | TailorDB namespace name (uses first namespace in config if not specified) | No | - | - |
312
- | `--port <PORT>` | - | Local server port (0 selects a free port) | No | `0` | - |
313
- | `--open` | - | Open the ERD viewer in the default browser | No | `false` | - |
314
-
315
- See [Global Options](../cli-reference.md#global-options) for options available to all commands.
316
-
317
- #### tailordb erd deploy
318
-
319
- Deploy ERD static website for TailorDB namespace(s).
320
-
321
- **Usage**
322
-
323
- ```
324
- tailor tailordb erd deploy [options]
325
- ```
326
-
327
- **Options**
328
-
329
- | Option | Alias | Description | Required | Default | Env |
330
- | ------------------------------- | ----- | ----------------------------------------------------------------------------------- | -------- | -------------------- | ------------------------------ |
331
- | `--workspace-id <WORKSPACE_ID>` | `-w` | Workspace ID | No | - | `TAILOR_PLATFORM_WORKSPACE_ID` |
332
- | `--profile <PROFILE>` | `-p` | Workspace profile | No | - | `TAILOR_PLATFORM_PROFILE` |
333
- | `--config <CONFIG>` | `-c` | Path to Tailor config file | No | `"tailor.config.ts"` | `TAILOR_CONFIG_PATH` |
334
- | `--namespace <NAMESPACE>` | `-n` | TailorDB namespace name (optional - deploys all namespaces with erdSite if omitted) | No | - | - |
335
-
336
- See [Global Options](../cli-reference.md#global-options) for options available to all commands.
337
-
338
- **Notes:**
339
-
340
- - ERD commands build from the local TailorDB schema, including plugin-generated TailorDB types.
341
- - `tailordb erd export` writes a self-contained `index.html` viewer to `<output>/<namespace>/dist`.
342
- - `tailordb erd diff` compares exported self-contained viewer HTML files and writes a visual ERD viewer that can switch between the current schema and the highlighted diff.
343
- - `tailordb erd serve` watches the config file and TailorDB type files, then reloads the browser viewer when the rebuilt `index.html` reports a new embedded schema revision.
344
- - `tailordb erd deploy` still requires `erdSite` in `tailor.config.ts` because it uploads the generated viewer to a configured Static Website.
345
-
346
- **Usage Examples:**
234
+ 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:
347
235
 
348
236
  ```bash
349
- # Deploy ERD for all namespaces with erdSite configured
350
- tailor tailordb erd deploy
351
-
352
- # Deploy ERD for a specific namespace
353
- tailor tailordb erd deploy --namespace myNamespace
354
-
355
- # Deploy ERD with JSON output
356
- tailor tailordb erd deploy --json
237
+ npm install -D @tailor-platform/sdk-plugin-tailordb-erd@next
238
+ tailor tailordb erd export --namespace myNamespace
357
239
  ```
358
240
 
359
- **Notes:**
360
-
361
- - This command is a beta feature and may introduce breaking changes in future releases
362
- - Requires `erdSite` to be configured in `tailor.config.ts` for each namespace you want to deploy
363
- - Example config:
364
- ```typescript
365
- export default defineConfig({
366
- db: {
367
- myNamespace: {
368
- // ... table definitions
369
- erdSite: "my-erd-site-name",
370
- },
371
- },
372
- });
373
- ```
241
+ See the plugin's README for the full command reference.
@@ -106,6 +106,7 @@ tailor workspace create [options]
106
106
  | `--organization-id <ORGANIZATION_ID>` | `-o` | Organization ID to workspace associate with | No | - | `TAILOR_PLATFORM_ORGANIZATION_ID` |
107
107
  | `--folder-id <FOLDER_ID>` | `-f` | Folder ID to workspace associate with | No | - | `TAILOR_PLATFORM_FOLDER_ID` |
108
108
  | `--profile-name <PROFILE_NAME>` | `-p` | Profile name to create | No | - | - |
109
+ | `--profile <PROFILE>` | - | Workspace profile used for authentication and Platform selection | No | - | `TAILOR_PLATFORM_PROFILE` |
109
110
  | `--profile-user <PROFILE_USER>` | - | User email address or machine user client ID for the profile (defaults to current user) | No | - | - |
110
111
  | `--permission <PERMISSION>` | - | Profile permission (requires --profile-name). 'read' blocks all write commands while the profile is active. | No | `"write"` | - |
111
112
 
@@ -161,10 +162,11 @@ tailor workspace list [options]
161
162
 
162
163
  **Options**
163
164
 
164
- | Option | Alias | Description | Required | Default |
165
- | ----------------- | ----- | -------------------------------------------------------- | -------- | -------- |
166
- | `--order <ORDER>` | - | Sort order (asc or desc) | No | `"desc"` |
167
- | `--limit <LIMIT>` | `-l` | Maximum number of items to return (0 or omit: unlimited) | No | - |
165
+ | Option | Alias | Description | Required | Default | Env |
166
+ | --------------------- | ----- | ---------------------------------------------------------------- | -------- | -------- | ------------------------- |
167
+ | `--order <ORDER>` | - | Sort order (asc or desc) | No | `"desc"` | - |
168
+ | `--limit <LIMIT>` | `-l` | Maximum number of items to return (0 or omit: unlimited) | No | - | - |
169
+ | `--profile <PROFILE>` | - | Workspace profile used for authentication and Platform selection | No | - | `TAILOR_PLATFORM_PROFILE` |
168
170
 
169
171
  See [Global Options](../cli-reference.md#global-options) for options available to all commands.
170
172
 
@@ -28,8 +28,11 @@ human-readable text or empty stdout.
28
28
  Commands that only perform side effects and do not define a structured result may leave stdout empty
29
29
  even when `--json` is passed.
30
30
 
31
- Errors, warnings, progress, and diagnostic messages are written to stderr. On failure, check the
32
- non-zero exit code and read stderr; stdout is not guaranteed to contain a JSON error object.
31
+ Errors, warnings, progress, and diagnostic messages are written to stderr. After argument parsing,
32
+ a command failure under `--json` emits a JSON error envelope to stderr. CLI errors include a stable
33
+ `error.code` and may include structured `error.next` and `error.context` fields for automated
34
+ recovery. Diagnostic lines may precede the error envelope, and stdout is not guaranteed to contain
35
+ an error object.
33
36
 
34
37
  ## Common Options
35
38
 
@@ -117,7 +120,9 @@ tailor hello world --loud
117
120
  ```
118
121
 
119
122
  This also works under a built-in command group. The command path is joined with hyphens, so a plugin
120
- nested under `tailordb` is named `tailor-tailordb-erd`:
123
+ nested under `tailordb` is named `tailor-tailordb-erd`. This is how the
124
+ `@tailor-platform/sdk-plugin-tailordb-erd`
125
+ package provides the `tailordb erd` commands:
121
126
 
122
127
  ```bash
123
128
  # Runs `tailor-tailordb-erd` with: export
@@ -133,6 +138,9 @@ Resolution rules:
133
138
  - **Lookup order:** the project's `node_modules/.bin` (nearest first, walking up from the current
134
139
  directory), then your `PATH`. So a plugin installed as a project dev-dependency takes precedence over a
135
140
  globally installed one.
141
+ - **Place global flags after the plugin command.** Only the arguments following the plugin name are
142
+ forwarded; a global flag placed before it (e.g. `tailor --json tailordb erd export`) is consumed by
143
+ the host CLI and does not reach the plugin. Write `tailor tailordb erd export --json` instead.
136
144
 
137
145
  Because resolution is based on `node_modules/.bin` and `PATH`, any package manager that populates
138
146
  `node_modules/.bin` works for project-local plugins — npm, pnpm (its content-addressable store is
@@ -195,11 +203,6 @@ Commands for managing TailorDB tables, data, and schema migrations.
195
203
  | [tailordb migration set](./cli/tailordb.md#tailordb-migration-set) | Set migration checkpoint to a specific number. |
196
204
  | [tailordb migration status](./cli/tailordb.md#tailordb-migration-status) | Show the current migration status for TailorDB namespaces, including applied and pending migrations. |
197
205
  | [tailordb migration sync](./cli/tailordb.md#tailordb-migration-sync) | Sync remote TailorDB schema to a specific migration snapshot (recovery from --no-schema-check drift). |
198
- | [tailordb erd](./cli/tailordb.md#tailordb-erd) | Generate TailorDB ERD viewer artifacts from local TailorDB schema. (beta) |
199
- | [tailordb erd export](./cli/tailordb.md#tailordb-erd-export) | Export TailorDB ERD static viewer from local TailorDB schema. |
200
- | [tailordb erd diff](./cli/tailordb.md#tailordb-erd-diff) | Render TailorDB ERD schema diff HTML from exported ERD viewers. |
201
- | [tailordb erd serve](./cli/tailordb.md#tailordb-erd-serve) | Generate and serve TailorDB ERD locally with watch reload. (beta) |
202
- | [tailordb erd deploy](./cli/tailordb.md#tailordb-erd-deploy) | Deploy ERD static website for TailorDB namespace(s). |
203
206
 
204
207
  ### [Query Commands](./cli/query.md)
205
208
 
@@ -82,6 +82,8 @@ export default defineConfig({
82
82
 
83
83
  **ignores**: Glob patterns to exclude files. Optional. By default, `**/*.test.ts` and `**/*.spec.ts` are automatically ignored. If you explicitly specify `ignores`, the default patterns will not be applied. Use `ignores: []` to include all files including test files.
84
84
 
85
+ **Pattern resolution**: `files` and `ignores` patterns are resolved relative to the directory of the `tailor.config.ts` file that declares them, not the directory you run the command from. This matters when deploying [multiple configs](./cli/application.md#deploy) together — each config's patterns only match files under its own directory. If a config's _relative_ patterns match nothing under its own directory, the SDK falls back to resolving them from the directory you ran the command from and logs a warning (this fallback doesn't apply to already-absolute patterns, since their resolution can't change). Update such patterns to be relative to the config's own directory — this fallback will be removed in v2.
86
+
85
87
  ### External Resources
86
88
 
87
89
  You can reference resources managed by Terraform or other SDK projects to include them in your application's subgraph. External resources are not deployed by this project but can be used for shared access across multiple applications.
@@ -72,6 +72,14 @@ to pull requests:
72
72
  tailor setup -n my-app-stg --erd-preview
73
73
  ```
74
74
 
75
+ The generated workflow runs `tailor tailordb erd`, which is provided by the
76
+ `@tailor-platform/sdk-plugin-tailordb-erd` CLI plugin — install it as a
77
+ dev-dependency in your project:
78
+
79
+ ```bash
80
+ npm install -D @tailor-platform/sdk-plugin-tailordb-erd@next
81
+ ```
82
+
75
83
  The generated workflow builds one self-contained ERD viewer HTML file for each
76
84
  owned TailorDB namespace in `tailor.config.ts`. The viewer compares the pull
77
85
  request merge result with the base branch, can switch between the current schema
@@ -350,7 +350,7 @@ Do not change behavior beyond the auth.invoker() removal.
350
350
 
351
351
  **Migration:** Partially automatic
352
352
 
353
- Rename statically identified SDK `authInvoker` options to `invoker`, replace `auth.invoker("name")` there with the bare `"name"` string, and drop the `auth` import when no other reference remains. Ambiguous workflow `.trigger()` calls are left for manual review. The `auth.invoker()` helper is removed in v2 because importing `auth` from `tailor.config.ts` into runtime files pulls Node-only modules into the bundle.
353
+ Rename statically identified SDK `authInvoker` options to `invoker`, replace `auth.invoker("name")` there with the bare `"name"` string, and drop the `auth` import when no other reference remains. Ambiguous workflow `.start()` calls are left for manual review. The `auth.invoker()` helper is removed in v2 because importing `auth` from `tailor.config.ts` into runtime files pulls Node-only modules into the bundle.
354
354
 
355
355
  Before:
356
356
 
@@ -378,8 +378,8 @@ For each remaining auth.invoker(<expr>) call:
378
378
  machine user name string; platform/runtime authInvoker payloads still expect
379
379
  the object form.
380
380
  2. Rename remaining authInvoker option keys to invoker only for SDK resolver,
381
- executor, workflow.trigger(), or startWorkflow() options. Keep platform/runtime
382
- payload keys such as tailor.workflow.triggerWorkflow(..., { authInvoker: ... }).
381
+ executor, workflow.start(), or startWorkflow() options. Keep platform/runtime
382
+ payload keys such as tailor.workflow.startWorkflow(..., { authInvoker: ... }).
383
383
  3. After removing every auth.invoker usage in a file, delete the now-unused auth
384
384
  import (keeping it pulls Node-only config modules into runtime bundles); leave
385
385
  the import if auth is still referenced elsewhere.
@@ -694,6 +694,73 @@ export const { approval } = createWaitPoints((define) => ({
694
694
  }));
695
695
  ```
696
696
 
697
+ ## workflow.triggerWorkflow/triggerJobFunction/resumeWorkflow → startWorkflow/startJobFunction/resumeWorkflowExecution
698
+
699
+ **Migration:** Partially automatic
700
+
701
+ Rename tailor.workflow call sites from the pre-alignment triggerWorkflow/triggerJobFunction/resumeWorkflow names to the canonical startWorkflow/startJobFunction/resumeWorkflowExecution names, on both the ambient tailor.workflow global and a workflow value imported from @tailor-platform/sdk/runtime(/workflow). For a renamed triggerWorkflow call, also renames a literal `invoker` option key to `authInvoker` — startWorkflow's options expect the platform shape directly, unlike the removed triggerWorkflow wrapper, which converted invoker to authInvoker internally.
702
+
703
+ Before:
704
+
705
+ ```ts
706
+ import { workflow } from "@tailor-platform/sdk/runtime";
707
+
708
+ await workflow.triggerWorkflow("myWorkflow", { data: "value" });
709
+ ```
710
+
711
+ After:
712
+
713
+ ```ts
714
+ import { workflow } from "@tailor-platform/sdk/runtime";
715
+
716
+ await workflow.startWorkflow("myWorkflow", { data: "value" });
717
+ ```
718
+
719
+ A literal invoker option is renamed to authInvoker:
720
+
721
+ Before:
722
+
723
+ ```ts
724
+ await workflow.triggerWorkflow("myWorkflow", { data: "value" }, { invoker: myInvoker });
725
+ ```
726
+
727
+ After:
728
+
729
+ ```ts
730
+ await workflow.startWorkflow("myWorkflow", { data: "value" }, { authInvoker: myInvoker });
731
+ ```
732
+
733
+ <details>
734
+ <summary>Prompt for an AI agent (to finish the cases the codemod could not migrate)</summary>
735
+
736
+ ```text
737
+ The pre-alignment tailor.workflow names triggerWorkflow, triggerJobFunction, and
738
+ resumeWorkflow are removed from the SDK's type surface in v2; use the canonical
739
+ startWorkflow, startJobFunction, and resumeWorkflowExecution names instead. The
740
+ codemod rewrites direct member-access call sites on the ambient tailor.workflow
741
+ global and on a workflow value imported from @tailor-platform/sdk/runtime or
742
+ @tailor-platform/sdk/runtime/workflow (including aliased imports). It skips a
743
+ file entirely when a local declaration shadows the workflow import or the
744
+ ambient tailor name, to avoid rewriting an unrelated same-named value — review
745
+ those manually.
746
+
747
+ For a renamed triggerWorkflow call, the codemod also renames a literal invoker
748
+ option key (including shorthand { invoker }) to authInvoker, since startWorkflow
749
+ expects the platform's authInvoker shape directly while triggerWorkflow's removed
750
+ wrapper converted invoker to authInvoker internally.
751
+
752
+ Also review, and migrate by hand:
753
+ - Destructured references (e.g. const { triggerWorkflow } = workflow) — the
754
+ codemod only rewrites direct member-access calls.
755
+ - Imported TriggerWorkflowOptions / TriggerJobFunctionOptions types — rename
756
+ them to StartWorkflowOptions / StartJobFunctionOptions.
757
+ - An invoker option passed via a variable or spread (not a literal object) —
758
+ the codemod only inspects literal object arguments; rename the invoker key
759
+ to authInvoker in the options object's own definition.
760
+ ```
761
+
762
+ </details>
763
+
697
764
  ## openDownloadStream → downloadStream
698
765
 
699
766
  **Migration:** Manual
@@ -787,18 +854,18 @@ string literals.
787
854
 
788
855
  </details>
789
856
 
790
- ## Workflow .trigger() and trigger tests
857
+ ## Workflow job start() and start tests
791
858
 
792
859
  **Migration:** Manual
793
860
 
794
- Workflow job `.trigger()` now aligns with the platform runtime: it returns the job result directly instead of a Promise wrapper, and tests no longer run job bodies locally. Mock trigger responses with `mockWorkflow()` (`setJobHandler` / `enqueueResult`, assert via `triggeredJobs`), or use `runWorkflowLocally()` for a full-chain local run.
861
+ Workflow job `.start()` (previously `.trigger()`) now aligns with the platform runtime: it returns the job result directly instead of a Promise wrapper, and tests no longer run job bodies locally. Mock start responses with `mockWorkflow()` (`setJobHandler` / `enqueueResult`, assert via `startedJobs`), or use `runWorkflowLocally()` for a full-chain local run.
795
862
 
796
863
  Tests must mock the workflow runtime instead of running bodies locally:
797
864
 
798
865
  Before:
799
866
 
800
867
  ```ts
801
- const result = await orderJob.trigger({ id });
868
+ const result = await orderJob.start({ id });
802
869
  expect(result.status).toBe("done");
803
870
  ```
804
871
 
@@ -807,7 +874,7 @@ After:
807
874
  ```ts
808
875
  using wf = mockWorkflow();
809
876
  wf.setJobHandler((jobName) => (jobName === "order-job" ? { status: "done" } : null));
810
- const result = await orderJob.trigger({ id });
877
+ const result = await orderJob.start({ id });
811
878
  expect(result.status).toBe("done");
812
879
  ```
813
880
 
@@ -815,11 +882,57 @@ expect(result.status).toBe("done");
815
882
  <summary>Prompt for an AI agent (to perform this migration)</summary>
816
883
 
817
884
  ```text
818
- Workflow job .trigger() now uses the platform workflow runtime instead of running
885
+ Workflow job .start() now uses the platform workflow runtime instead of running
819
886
  the job body locally. In tests, acquire `using wf = mockWorkflow()` and provide
820
- trigger responses (setJobHandler / enqueueResult), or use runWorkflowLocally() for a
821
- full-chain local run; an unmocked trigger now throws. Outside tests, treat the
822
- trigger result as the job output directly (no Promise wrapper to unwrap).
887
+ start responses (setJobHandler / enqueueResult), or use runWorkflowLocally() for a
888
+ full-chain local run; an unmocked start now throws. Outside tests, treat the
889
+ start result as the job output directly (no Promise wrapper to unwrap).
890
+ ```
891
+
892
+ </details>
893
+
894
+ ## Workflow.trigger()/WorkflowJob.trigger() → .start()
895
+
896
+ **Migration:** Manual
897
+
898
+ Rename `Workflow.trigger()` (returned by `createWorkflow()`) and `WorkflowJob.trigger()` (returned by `createWorkflowJob()`) to `.start()`, aligning the SDK's ergonomic verb with the platform's `start*` RPC vocabulary. No codemod ships for this rename: distinguishing a workflow/job `.trigger()` call from an unrelated object's own `.trigger()` method requires resolving the receiver back to a `createWorkflow`/`createWorkflowJob` result across files, which the SDK's own CLI bundler already does for build-time rewriting. Reusing that logic in a standalone script is a nontrivial lift, and — unlike the bundler, which fails loudly when it cannot rewrite a call — a codemod false positive would silently rewrite an unrelated `.trigger()` call with no error. For the call-site volume this rename typically involves, manual review guided by the prompt below is the safer trade-off.
899
+
900
+ Before:
901
+
902
+ ```ts
903
+ const inventory = checkInventory.trigger({ orderId: input.orderId });
904
+ const workflowRunId = await orderProcessingWorkflow.trigger(args, { invoker: "manager" });
905
+ ```
906
+
907
+ After:
908
+
909
+ ```ts
910
+ const inventory = checkInventory.start({ orderId: input.orderId });
911
+ const workflowRunId = await orderProcessingWorkflow.start(args, { invoker: "manager" });
912
+ ```
913
+
914
+ <details>
915
+ <summary>Prompt for an AI agent (to perform this migration)</summary>
916
+
917
+ ```text
918
+ In Tailor SDK v2, the ergonomic .trigger() method on a createWorkflow() or
919
+ createWorkflowJob() result is renamed to .start(). This is unrelated to the
920
+ separate tailor.workflow.triggerWorkflow/triggerJobFunction/resumeWorkflow removal
921
+ (see the workflow-trigger-rename codemod) — this rename targets the SDK's own
922
+ ergonomic wrapper, not the low-level platform call.
923
+
924
+ For each flagged `.trigger(` call in these files:
925
+ 1. Confirm the receiver is a workflow or job object — typically a local const
926
+ assigned from createWorkflow(...)/createWorkflowJob(...), a named import of one,
927
+ or the default import of a workflow module. Skip receivers that are unrelated
928
+ objects with their own .trigger() method (state machines, event emitters, etc.).
929
+ 2. Rename the call from .trigger(...) to .start(...); the argument list is unchanged.
930
+ 3. Update any mock/test code that reads WorkflowJob['trigger'] / Workflow['trigger']
931
+ as a type, or that mocks the ergonomic method via a wrapper — for example,
932
+ `wf.job(definition)` / `wf.workflow(definition)` from mockWorkflow() now return a
933
+ mock of the `.start` method.
934
+ 4. Update prose/docs/comments that say "trigger the workflow/job" to "start" only
935
+ where they describe this SDK verb specifically, not unrelated event terminology.
823
936
  ```
824
937
 
825
938
  </details>
@@ -1031,6 +1144,47 @@ Migration steps for each `.hooks()` call on a `db.type()`:
1031
1144
 
1032
1145
  </details>
1033
1146
 
1147
+ ## generate --watch flag removed
1148
+
1149
+ **Migration:** Manual
1150
+
1151
+ Review and remove `tailor generate --watch` / `-W` invocations and the `watch` option on `GenerateOptions`. The flag, its dependency watcher, and the self-restart-on-change logic are removed; `generate` now always performs a single generation pass.
1152
+
1153
+ The --watch/-W flag no longer exists; re-run generate after each change:
1154
+
1155
+ Before:
1156
+
1157
+ ```sh
1158
+ tailor generate --watch
1159
+ ```
1160
+
1161
+ After:
1162
+
1163
+ ```sh
1164
+ tailor generate
1165
+ ```
1166
+
1167
+ <details>
1168
+ <summary>Prompt for an AI agent (to perform this migration)</summary>
1169
+
1170
+ ```text
1171
+ Tailor SDK v2 removes the `generate --watch` (`-W`) flag along with the
1172
+ dependency watcher and self-restart logic that powered it. `tailor generate`
1173
+ now always runs a single generation pass and exits.
1174
+
1175
+ For each flagged `tailor generate ... --watch` / `-W` invocation (package.json
1176
+ scripts, shell scripts, CI configs, or docs), drop the flag and re-run
1177
+ `tailor generate` after each change instead. If automatic regeneration on file
1178
+ change is still needed, wrap the command with a general-purpose file watcher
1179
+ (e.g. `chokidar-cli`, `nodemon`) at the project level.
1180
+
1181
+ For programmatic use of `generate()` from `@tailor-platform/sdk/cli`, remove the
1182
+ `watch` field from the `GenerateOptions` argument — the function now performs a
1183
+ single generation pass and resolves once it completes.
1184
+ ```
1185
+
1186
+ </details>
1187
+
1034
1188
  ## Behavioral changes (no migration required)
1035
1189
 
1036
1190
  These v2 changes alter runtime or CLI behavior; no source change is needed.
@@ -1050,3 +1204,7 @@ The CLI stores human users by their stable subject ID instead of email (email is
1050
1204
  ### Node.js minimum version raised to 22.15.0
1051
1205
 
1052
1206
  v2 requires Node.js **22.15.0** or later. This is the first version that includes `module.registerHooks()`, which the SDK uses to register its TypeScript loader hook synchronously in the main thread. No source change is required; ensure your environment runs Node.js 22.15.0+.
1207
+
1208
+ ### Legacy bundle artifact cleanup removed from deploy
1209
+
1210
+ `tailor deploy` no longer deletes on-disk bundle artifacts (`.entry.js` files, workflow-job bundles, and the `hooks-validate-scripts/` directory) left in the SDK output directory (`.tailor` by default) by SDK versions that predate the current in-memory bundling approach. Current bundlers no longer write these files. No source change is required; if such stale files remain from a very old SDK version, delete only those specific files/directories manually — do not delete the output directory itself, since it also holds deploy state (e.g. `secrets-state/`, `*.context.json`) that existing secrets and Auth Connections depend on.