@tailor-platform/sdk 2.29.2 → 2.32.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 (95) hide show
  1. package/CHANGELOG.md +70 -0
  2. package/dist/ai/index.d.mts +112 -0
  3. package/dist/ai/index.mjs +2 -0
  4. package/dist/ai/index.mjs.map +1 -0
  5. package/dist/{application-Dm_21z-i.mjs → application-C2bPmmbh.mjs} +1 -1
  6. package/dist/{application-D8jruzwo.mjs → application-D0xNJbag.mjs} +32 -32
  7. package/dist/{application-D8jruzwo.mjs.map → application-D0xNJbag.mjs.map} +1 -1
  8. package/dist/cli/commands/machineuser/list.d.mts +2 -1
  9. package/dist/cli/lib.mjs +1 -1
  10. package/dist/cli/main.mjs +17 -17
  11. package/dist/cli/main.mjs.map +1 -1
  12. package/dist/cli/shared/error-json.d.mts +2 -0
  13. package/dist/completion/zsh-worker.zsh +6 -2
  14. package/dist/{crashreport-BAG8c7hB.mjs → crashreport-BCIy33Cz.mjs} +2 -2
  15. package/dist/{crashreport-BAG8c7hB.mjs.map → crashreport-BCIy33Cz.mjs.map} +1 -1
  16. package/dist/crashreport-IN6H7GX3.mjs +1 -0
  17. package/dist/errors-BOF68LJ5.mjs +5 -0
  18. package/dist/errors-BOF68LJ5.mjs.map +1 -0
  19. package/dist/{kysely-type-BWMfV301.mjs → kysely-type-CBwsdx16.mjs} +6 -3
  20. package/dist/kysely-type-CBwsdx16.mjs.map +1 -0
  21. package/dist/{logger-DuaT2zY3.mjs → logger-RgtbhJ83.mjs} +3 -3
  22. package/dist/logger-RgtbhJ83.mjs.map +1 -0
  23. package/dist/plugin/builtin/kysely-type/index.mjs +1 -1
  24. package/dist/plugin/builtin/seed/index.mjs +1 -1
  25. package/dist/register-ts-hook-_dHIREtU.mjs +1050 -0
  26. package/dist/register-ts-hook-_dHIREtU.mjs.map +1 -0
  27. package/dist/seed/idp-user-password.d.mts +15 -0
  28. package/dist/seed/index.d.mts +19 -1
  29. package/dist/seed/index.mjs +6 -6
  30. package/dist/seed/index.mjs.map +1 -1
  31. package/dist/{seed-C3P_T_Eh.mjs → seed-Cn-3JApy.mjs} +12 -8
  32. package/dist/seed-Cn-3JApy.mjs.map +1 -0
  33. package/dist/{service-l_tEI8sS.mjs → service-9SBPNpK8.mjs} +2 -2
  34. package/dist/{service-l_tEI8sS.mjs.map → service-9SBPNpK8.mjs.map} +1 -1
  35. package/dist/{service-b1g22NN9.mjs → service-9rwi_I4d.mjs} +2 -2
  36. package/dist/{service-b1g22NN9.mjs.map → service-9rwi_I4d.mjs.map} +1 -1
  37. package/dist/service-Ca1WwyIt.mjs +1 -0
  38. package/dist/telemetry-DfT2UfI4.mjs +2 -0
  39. package/dist/telemetry-DfT2UfI4.mjs.map +1 -0
  40. package/dist/{telemetry-DpkFGBmu.mjs → telemetry-nqOtDWNO.mjs} +1 -1
  41. package/docs/ai.md +92 -0
  42. package/docs/cli/application.md +4 -0
  43. package/docs/cli/auth.md +4 -0
  44. package/docs/cli/completion.md +4 -0
  45. package/docs/cli/crashreport.md +4 -0
  46. package/docs/cli/data.md +4 -0
  47. package/docs/cli/executor.md +4 -0
  48. package/docs/cli/function.md +4 -0
  49. package/docs/cli/organization.md +4 -0
  50. package/docs/cli/plugin.md +4 -0
  51. package/docs/cli/query.md +4 -0
  52. package/docs/cli/secret.md +4 -0
  53. package/docs/cli/skills.md +4 -0
  54. package/docs/cli/staticwebsite.md +4 -0
  55. package/docs/cli/tailordb.md +21 -15
  56. package/docs/cli/upgrade.md +4 -0
  57. package/docs/cli/user.md +4 -0
  58. package/docs/cli/workflow.md +4 -0
  59. package/docs/cli/workspace.md +5 -1
  60. package/docs/cli-reference.md +4 -0
  61. package/docs/configuration.md +4 -0
  62. package/docs/data-clone.md +4 -0
  63. package/docs/github-actions.md +108 -11
  64. package/docs/migration/v2.md +4 -0
  65. package/docs/multi-environment.md +4 -0
  66. package/docs/plugin/custom.md +4 -0
  67. package/docs/plugin/frontend.md +4 -0
  68. package/docs/plugin/index.md +4 -0
  69. package/docs/quickstart.md +4 -0
  70. package/docs/runtime.md +4 -0
  71. package/docs/services/aigateway.md +4 -0
  72. package/docs/services/auth.md +4 -0
  73. package/docs/services/executor.md +4 -0
  74. package/docs/services/http-adapter.md +4 -0
  75. package/docs/services/idp.md +4 -0
  76. package/docs/services/resolver.md +4 -0
  77. package/docs/services/secret.md +4 -0
  78. package/docs/services/staticwebsite.md +4 -0
  79. package/docs/services/tailordb/index.md +4 -0
  80. package/docs/services/tailordb/migration.md +49 -31
  81. package/docs/services/workflow.md +4 -0
  82. package/docs/testing.md +6 -1
  83. package/package.json +16 -9
  84. package/dist/crashreport-BcXuocwI.mjs +0 -1
  85. package/dist/errors-D3qpNHR6.mjs +0 -7
  86. package/dist/errors-D3qpNHR6.mjs.map +0 -1
  87. package/dist/kysely-type-BWMfV301.mjs.map +0 -1
  88. package/dist/logger-DuaT2zY3.mjs.map +0 -1
  89. package/dist/register-ts-hook-B5ZbbJwS.mjs +0 -1012
  90. package/dist/register-ts-hook-B5ZbbJwS.mjs.map +0 -1
  91. package/dist/seed-C3P_T_Eh.mjs.map +0 -1
  92. package/dist/service-C_CogLQr.mjs +0 -1
  93. package/dist/telemetry-Xk7J829P.mjs +0 -2
  94. package/dist/telemetry-Xk7J829P.mjs.map +0 -1
  95. package/docs/migration/v3.md +0 -277
@@ -1 +1 @@
1
- export{t as initTelemetry,n as shutdownTelemetry}from"./telemetry-Xk7J829P.mjs";
1
+ export{t as initTelemetry,n as shutdownTelemetry}from"./telemetry-DfT2UfI4.mjs";
package/docs/ai.md ADDED
@@ -0,0 +1,92 @@
1
+ ---
2
+ description: "Make choice, boolean, and ordered score decisions from application state through AI Gateway with the System One client from @tailor-platform/sdk/ai."
3
+ ---
4
+
5
+ # System One
6
+
7
+ System One makes semantic decisions from application state, a question, and a fixed answer space. It returns the selected answer and its probability without requiring prompt construction or structured-output parsing.
8
+
9
+ Create a client with the URL the platform assigns to your deployed [AI Gateway](services/aigateway.md). Inside a Tailor Function, `aigateway.get()` returns it as `url`. Omit `token`; the platform authenticates the request:
10
+
11
+ ```typescript
12
+ import { createSystemOne } from "@tailor-platform/sdk/ai";
13
+ import { aigateway } from "@tailor-platform/sdk/runtime";
14
+
15
+ const { url } = await aigateway.get("my-aigateway");
16
+ const systemOne = createSystemOne({ baseURL: url });
17
+ ```
18
+
19
+ External clients pass the same URL, which `tailor show` lists, directly with an access token issued by the AI Gateway's auth namespace:
20
+
21
+ ```typescript
22
+ import { createSystemOne } from "@tailor-platform/sdk/ai";
23
+
24
+ const systemOne = createSystemOne({
25
+ baseURL: "https://my-aigateway-{WORKSPACE_HASH}.ai.erp.dev",
26
+ token: accessToken,
27
+ });
28
+ ```
29
+
30
+ ## Choice decisions
31
+
32
+ Use `choice()` to select one value from an answer space. Literal types are inferred without `as const`:
33
+
34
+ ```typescript
35
+ const result = await systemOne.choice({
36
+ state: { ticket, customer },
37
+ question: "Which department should handle this ticket?",
38
+ choices: ["billing", "sales", "support"],
39
+ });
40
+
41
+ // result.value: "billing" | "sales" | "support"
42
+ // result.probabilities: Record<"billing" | "sales" | "support", number>
43
+ ```
44
+
45
+ ## Boolean decisions
46
+
47
+ Use `boolean()` for a binary decision. `value` is `true` when the probability of "yes" is at least `0.5`, and `probability` is the probability of the selected answer:
48
+
49
+ ```typescript
50
+ const result = await systemOne.boolean({
51
+ state: invoice,
52
+ question: "Is this invoice a duplicate?",
53
+ });
54
+
55
+ if (result.value && result.probability > 0.95) {
56
+ // Apply the appropriate business rule.
57
+ }
58
+ ```
59
+
60
+ ## Ordered scores
61
+
62
+ Use `score()` when the answer space has a meaningful order. Levels are ordered from lowest to highest, and `value` is the level with the highest probability:
63
+
64
+ ```typescript
65
+ const result = await systemOne.score({
66
+ state: transaction,
67
+ question: "Assess the risk of this transaction.",
68
+ levels: ["low", "medium", "high"],
69
+ });
70
+ ```
71
+
72
+ ## Models
73
+
74
+ Decisions use `jev-1.13.0` unless a call passes `model`. `jev-latest` always points to the newest model, so its probabilities can shift when a new model is released. Use it only when your logic does not compare probabilities against fixed thresholds:
75
+
76
+ ```typescript
77
+ const result = await systemOne.boolean({
78
+ state: invoice,
79
+ question: "Is this invoice a duplicate?",
80
+ model: "jev-latest",
81
+ });
82
+ ```
83
+
84
+ ## Errors
85
+
86
+ Failures throw `SystemOneError` with a provider-independent `code`. Applications can handle stable codes such as `UNAUTHORIZED`, `RATE_LIMITED`, `PROVIDER_TIMEOUT`, and `PROVIDER_UNAVAILABLE` without depending on a model provider.
87
+
88
+ A decision waits until AI Gateway responds. To fail with `PROVIDER_TIMEOUT` instead, pass `timeoutMs`:
89
+
90
+ ```typescript
91
+ const systemOne = createSystemOne({ baseURL: url, timeoutMs: 10_000 });
92
+ ```
@@ -1,3 +1,7 @@
1
+ ---
2
+ description: "Create, generate, deploy, inspect, and remove the application defined in tailor.config.ts, and call Tailor Platform APIs directly with tailor api."
3
+ ---
4
+
1
5
  # Application Commands
2
6
 
3
7
  Commands for managing Tailor Platform applications. These commands work with `tailor.config.ts`.
package/docs/cli/auth.md CHANGED
@@ -1,3 +1,7 @@
1
+ ---
2
+ description: "Manage Auth service resources from the tailor CLI: authorize and revoke auth connections, get machine user tokens, and inspect OAuth2 clients."
3
+ ---
4
+
1
5
  # Auth Resource Commands
2
6
 
3
7
  Commands for managing Auth service resources (auth connections, machine users, and OAuth2 clients).
@@ -1,3 +1,7 @@
1
+ ---
2
+ description: "Generate shell completion scripts for the tailor CLI in bash, zsh, and fish."
3
+ ---
4
+
1
5
  # Completion
2
6
 
3
7
  ## completion
@@ -1,3 +1,7 @@
1
+ ---
2
+ description: "List local crash report files and submit crash reports to help improve the Tailor Platform SDK."
3
+ ---
4
+
1
5
  # Crash Report Commands
2
6
 
3
7
  Commands for managing crash reports.
package/docs/cli/data.md CHANGED
@@ -1,3 +1,7 @@
1
+ ---
2
+ description: "Clone application data from one workspace to another and inspect asynchronous data operations with the tailor CLI."
3
+ ---
4
+
1
5
  # Data Commands
2
6
 
3
7
  Commands for managing application data across workspaces.
@@ -1,3 +1,7 @@
1
+ ---
2
+ description: "List and inspect executors, view executor jobs, and trigger executors manually with the tailor CLI."
3
+ ---
4
+
1
5
  # Executor Commands
2
6
 
3
7
  Commands for managing executors and executor jobs.
@@ -1,3 +1,7 @@
1
+ ---
2
+ description: "Inspect function registries, view function execution logs, and run one-off functions on the Tailor Platform without deploying."
3
+ ---
4
+
1
5
  # Function Commands
2
6
 
3
7
  Commands for managing function registries and viewing function execution logs.
@@ -1,3 +1,7 @@
1
+ ---
2
+ description: "View and update organizations, and manage and display organization folder hierarchies with the tailor CLI."
3
+ ---
4
+
1
5
  ## organization
2
6
 
3
7
  Manage Tailor Platform organizations.
@@ -1,3 +1,7 @@
1
+ ---
2
+ description: "Discover and list tailor CLI plugins, the external tailor-<name> executables found on your PATH or in node_modules/.bin."
3
+ ---
4
+
1
5
  ## plugin
2
6
 
3
7
  Manage and inspect CLI plugins (beta).
package/docs/cli/query.md CHANGED
@@ -1,3 +1,7 @@
1
+ ---
2
+ description: "Run ad-hoc SQL or GraphQL queries from the tailor CLI, or explore data interactively in the query REPL."
3
+ ---
4
+
1
5
  ## query
2
6
 
3
7
  Run SQL/GraphQL query.
@@ -1,3 +1,7 @@
1
+ ---
2
+ description: "Create and manage Secret Manager vaults and secrets from the tailor CLI."
3
+ ---
4
+
1
5
  # Secret Commands
2
6
 
3
7
  Commands for managing Secret Manager vaults and secrets.
@@ -1,3 +1,7 @@
1
+ ---
2
+ description: "Install, sync, list, and remove Tailor SDK agent skills for AI coding assistants."
3
+ ---
4
+
1
5
  ## skills
2
6
 
3
7
  Manage Tailor SDK agent skills.
@@ -1,3 +1,7 @@
1
+ ---
2
+ description: "Deploy static website files and manage static websites with the tailor CLI."
3
+ ---
4
+
1
5
  # Static Website Commands
2
6
 
3
7
  Commands for managing and deploying static websites.
@@ -1,3 +1,7 @@
1
+ ---
2
+ description: "Truncate TailorDB table data and generate, test, validate, and apply TailorDB schema migrations with the tailor CLI."
3
+ ---
4
+
1
5
  # TailorDB Commands
2
6
 
3
7
  Commands for managing TailorDB tables, data, and schema migrations.
@@ -324,26 +328,28 @@ tailor tailordb migration test [options]
324
328
 
325
329
  **Options**
326
330
 
327
- | Option | Alias | Description | Required | Default | Env |
328
- | --------------------------------------------- | ----- | -------------------------------------------------------------------------------------------------------------------- | -------- | -------------------- | ------------------------------ |
329
- | `--workspace-id <WORKSPACE_ID>` | `-w` | Workspace ID | No | - | `TAILOR_PLATFORM_WORKSPACE_ID` |
330
- | `--profile <PROFILE>` | `-p` | Workspace profile | No | - | `TAILOR_PLATFORM_PROFILE` |
331
- | `--config <CONFIG>` | `-c` | Path to Tailor config file | No | `"tailor.config.ts"` | `TAILOR_CONFIG_PATH` |
332
- | `--yes` | `-y` | Acknowledge that a designated target workspace may be overwritten | No | `false` | - |
333
- | `--data <DATA>` | - | Data source for the migration test (seed or clone) | No | `"seed"` | - |
334
- | `--target-workspace-id <TARGET_WORKSPACE_ID>` | - | Existing throwaway workspace to retain after the test (requires --yes) | No | - | - |
335
- | `--keep` | - | Keep the automatically created workspace after the test | No | `false` | - |
336
- | `--assert <ASSERT>` | - | Path to a TypeScript assertion script to run after migrations | No | - | - |
337
- | `--assert-namespace <ASSERT_NAMESPACE>` | - | TailorDB namespace exposed to the assertion script | No | - | - |
338
- | `--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 | - | - |
339
- | `--clone-timeout <CLONE_TIMEOUT>` | - | How long to wait for the clone to finish with --data clone, e.g. 30s or 10m (default: 30m) | No | - | - |
340
- | `--machine-user <MACHINE_USER>` | - | Machine user for seed and assertion script execution | No | - | - |
331
+ | Option | Alias | Description | Required | Default | Env |
332
+ | --------------------------------------------- | ----- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | -------------------- | --------------------------------- |
333
+ | `--workspace-id <WORKSPACE_ID>` | `-w` | Workspace ID | No | - | `TAILOR_PLATFORM_WORKSPACE_ID` |
334
+ | `--profile <PROFILE>` | `-p` | Workspace profile | No | - | `TAILOR_PLATFORM_PROFILE` |
335
+ | `--config <CONFIG>` | `-c` | Path to Tailor config file | No | `"tailor.config.ts"` | `TAILOR_CONFIG_PATH` |
336
+ | `--yes` | `-y` | Acknowledge that a designated target workspace may be overwritten | No | `false` | - |
337
+ | `--data <DATA>` | - | Data source for the migration test (seed or clone) | No | `"seed"` | - |
338
+ | `--target-workspace-id <TARGET_WORKSPACE_ID>` | - | Existing throwaway workspace to retain after the test (requires --yes) | No | - | - |
339
+ | `--keep` | - | Keep the automatically created workspace after the test | No | `false` | - |
340
+ | `--organization-id <ORGANIZATION_ID>` | - | Organization to create the temporary workspace in, at its root unless --folder-id is given (default: the source workspace's organization and folder). With --target-workspace-id, must match the target's organization | No | - | `TAILOR_PLATFORM_ORGANIZATION_ID` |
341
+ | `--folder-id <FOLDER_ID>` | - | Folder to create the temporary workspace in (default: the source workspace's folder). Requires --organization-id when the source workspace is not in an organization. With --target-workspace-id, must match the target's folder | No | - | `TAILOR_PLATFORM_FOLDER_ID` |
342
+ | `--assert <ASSERT>` | - | Path to a TypeScript assertion script to run after migrations | No | - | - |
343
+ | `--assert-namespace <ASSERT_NAMESPACE>` | - | TailorDB namespace exposed to the assertion script | No | - | - |
344
+ | `--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 | - | - |
345
+ | `--clone-timeout <CLONE_TIMEOUT>` | - | How long to wait for the clone to finish with --data clone, e.g. 30s or 10m (default: 30m) | No | - | - |
346
+ | `--machine-user <MACHINE_USER>` | - | Machine user for seed and assertion script execution | No | - | - |
341
347
 
342
348
  See [Global Options](../cli-reference.md#global-options) for options available to all commands.
343
349
 
344
350
  **Notes**
345
351
 
346
- 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.
352
+ 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. Right after creating the workspace it records a 24h expiry (unless --keep is given without --keep-ttl), so if the run is interrupted before the command can delete the workspace, workspace prune --expired removes it later. 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. Organization and folder IDs loaded by --env-file are used the same way as the options; command-line options take precedence, and empty env-file values are ignored.
347
353
 
348
354
  #### tailordb migration validate
349
355
 
@@ -1,3 +1,7 @@
1
+ ---
2
+ description: "Upgrade your project to a new SDK version by running codemods that update your code for breaking changes."
3
+ ---
4
+
1
5
  ## upgrade
2
6
 
3
7
  Run codemods to upgrade your project to a newer SDK version.
package/docs/cli/user.md CHANGED
@@ -1,3 +1,7 @@
1
+ ---
2
+ description: "Log in and out of the Tailor Platform, check authentication status, print access tokens, switch users, and manage personal access tokens."
3
+ ---
4
+
1
5
  # User & Auth Commands
2
6
 
3
7
  Commands for authentication and user management.
@@ -1,3 +1,7 @@
1
+ ---
2
+ description: "List and inspect workflows, start and wait for workflow runs, and view and resume workflow executions with the tailor CLI."
3
+ ---
4
+
1
5
  # Workflow Commands
2
6
 
3
7
  Commands for managing workflows and workflow executions.
@@ -1,3 +1,7 @@
1
+ ---
2
+ description: "Create, inspect, and delete workspaces, manage workspace users, apps, and expiry, and manage CLI profiles that pair a user with a workspace."
3
+ ---
4
+
1
5
  # Workspace Commands
2
6
 
3
7
  Commands for managing workspaces and profiles.
@@ -103,7 +107,7 @@ tailor workspace create [options]
103
107
  | Option | Alias | Description | Required | Default | Env |
104
108
  | ------------------------------------- | ----- | --------------------------------------------------------------------------------------------------------------------------------------------- | -------- | --------- | --------------------------------- |
105
109
  | `--name <NAME>` | `-n` | Workspace name | Yes | - | - |
106
- | `--region <REGION>` | `-r` | Workspace region (asia-northeast, us-west) | Yes | - | - |
110
+ | `--region <REGION>` | `-r` | Workspace region (asia-northeast, us-west, europe-west) | Yes | - | - |
107
111
  | `--delete-protection` | `-d` | Enable delete protection | No | `false` | - |
108
112
  | `--organization-id <ORGANIZATION_ID>` | `-o` | Organization ID to workspace associate with | No | - | `TAILOR_PLATFORM_ORGANIZATION_ID` |
109
113
  | `--folder-id <FOLDER_ID>` | `-f` | Folder ID to workspace associate with | No | - | `TAILOR_PLATFORM_FOLDER_ID` |
@@ -1,3 +1,7 @@
1
+ ---
2
+ description: "Reference for the tailor CLI, including usage, global options, JSON output, workspace selection, and an index of every command."
3
+ ---
4
+
1
5
  # tailor
2
6
 
3
7
  Tailor Platform SDK - The SDK to work with Tailor Platform
@@ -1,3 +1,7 @@
1
+ ---
2
+ description: "Configure your application in tailor.config.ts, including application settings, services, bundling, auth, static websites, secrets, environment variables, workflows, and plugins."
3
+ ---
4
+
1
5
  # Configuration
2
6
 
3
7
  The SDK uses TypeScript for configuration files. By default, it uses `tailor.config.ts` in the project root. You can specify a different path using the `--config` option.
@@ -1,3 +1,7 @@
1
+ ---
2
+ description: "Copy the TailorDB records, files, and IdP users of an application from one workspace to another with tailor data clone, and rehearse migrations against cloned data."
3
+ ---
4
+
1
5
  # Cloning Application Data
2
6
 
3
7
  `tailor data clone` copies the data of an application from one workspace to another, for example to fill a staging workspace with production records before testing a release against them. It copies the records of every TailorDB namespace registered in the application, and optionally TailorDB file content and IdP users.
@@ -1,3 +1,7 @@
1
+ ---
2
+ description: "Generate GitHub Actions deploy workflows and Renovate configuration for your app with tailor setup, including approval gates, secrets, monorepos, and rollback."
3
+ ---
4
+
1
5
  # GitHub Actions Integration
2
6
 
3
7
  `tailor setup` generates GitHub repository automation for your Tailor Platform
@@ -113,6 +117,92 @@ all-added or all-removed viewer artifacts. Re-run `setup ci branch` after adding
113
117
  removing TailorDB namespaces. `setup check` reports drift when the recorded ERD
114
118
  preview namespaces no longer match the current config.
115
119
 
120
+ #### Migration test on a labeled pull request
121
+
122
+ Pass `--migration-test` on a branch target to add a job that runs
123
+ [`tailor tailordb migration test`](./cli/tailordb.md) against a pull request on
124
+ demand. It is opt-in and requires a config with TailorDB migrations.
125
+
126
+ ```bash
127
+ tailor setup ci branch --name my-app-stg --migration-test
128
+ ```
129
+
130
+ The job runs only when someone adds the `tailor:migration-test` label to a pull
131
+ request from the same repository (change the label with
132
+ `--migration-test-label`). It runs the pending migrations in a temporary
133
+ workspace created next to the source workspace, writes the `--json` result to
134
+ the job summary, and removes the label as its last step, whether the test
135
+ succeeded, failed, or was cancelled while running. To run it again, add the label
136
+ again. If a run is cancelled before the job starts (for example, a reviewer
137
+ rejects the environment's approval), the label stays on the pull request: remove
138
+ it and add it again.
139
+ Anyone who can label pull requests in your repository can start the job, and
140
+ each run creates and deletes a workspace. Runs for one pull request never
141
+ cancel each other.
142
+
143
+ The generated workflow also lists `labeled` in its `pull_request` types. The
144
+ plan and ERD preview jobs skip label events, so adding an unrelated label does
145
+ not re-run them.
146
+
147
+ Runs started by a label report their result job as `tailor-result (<name>) [label]`
148
+ instead of `tailor-result (<name>)`. A label event therefore never replaces the
149
+ result of the check you require for branch protection. The migration test result
150
+ appears only under the `[label]` name, so it does not block merging through the
151
+ check you require.
152
+
153
+ The job clones the source workspace's TailorDB records and passes
154
+ `--clone-timeout 30m`, which bounds only the wait for the data clone. If the clone takes longer, the command
155
+ fails with the clone's operation ID in the error and removes its temporary
156
+ workspace, while the clone itself keeps running on the platform.
157
+
158
+ The migration test step is limited to 50 minutes and the job to 60, so the label
159
+ is still removed when the step times out. A step that is stopped at its limit
160
+ (or a job cancelled at the job limit) gives the command no chance to clean up:
161
+ delete the leftover temporary workspace with `tailor workspace delete`.
162
+
163
+ ##### Choosing the source workspace
164
+
165
+ `migration test` reads the source workspace (it is not modified), builds a
166
+ temporary workspace from it in the same organization and folder, and deletes
167
+ that workspace afterwards. Because the machine user creates and deletes that
168
+ workspace, it needs an editor or admin role on the organization or folder that
169
+ holds the source workspace; a viewer role is not enough. The clone also needs the
170
+ same role on the source side. The clone copies TailorDB records only: IdP users
171
+ and file blobs are not copied.
172
+
173
+ Two setups are supported:
174
+
175
+ - **Source is the plan/deploy workspace (default).** The job uses the same GitHub
176
+ Environment as the plan and deploy jobs, so it reads the same
177
+ `TAILOR_PLATFORM_WORKSPACE_ID` variable and machine-user secrets. Nothing
178
+ extra to configure. If that workspace holds too little data to be a useful
179
+ test, point the job at a workspace that does with the next setup.
180
+ - **Source is a different workspace, such as production.** Pass
181
+ `--migration-test-environment <env>`. The job then uses that GitHub
182
+ Environment and reads the source workspace from its
183
+ `TAILOR_PLATFORM_MIGRATION_TEST_SOURCE_WORKSPACE_ID` variable, together with the
184
+ machine-user secrets set on that same environment. Give this environment a
185
+ machine user whose role you are willing to hold on the source workspace's
186
+ organization or folder, since it needs the editor-or-admin role described
187
+ above. Pending migrations run from the source workspace's migration number up
188
+ to the latest, so a source that is behind the deploy target replays more
189
+ migrations, which is closer to what a production deploy will do.
190
+
191
+ A job can declare only one GitHub Environment, and a repository secret or
192
+ variable is read from that environment, which is why a different source needs its
193
+ own environment. `tailor setup ci env` prints what each environment needs,
194
+ including the dedicated one. Keep the dedicated environment separate from your
195
+ production deploy environment: a pull request job runs on the pull request merge
196
+ ref (`refs/pull/<number>/merge`), so if an environment restricts which branches
197
+ may deploy or requires reviewers, check how that affects the pull request job
198
+ before pointing the migration test at it. A required-reviewers rule makes the
199
+ job wait for approval before it can read the environment's secrets. The job runs
200
+ the pull request's own code with that environment's credentials, so add one when
201
+ the source workspace holds production data.
202
+
203
+ Fork pull requests cannot read secrets, so the job is skipped for them.
204
+ `--migration-test` is not available together with several `--dir` values.
205
+
116
206
  ### Tag target (recommended for production)
117
207
 
118
208
  The tag target fires when a tag matching `--tag-pattern` (default `v*`) is
@@ -497,17 +587,18 @@ tailor setup ci env --check # check what is registered in GitHu
497
587
 
498
588
  The list follows what each generated workflow actually reads:
499
589
 
500
- | Name | Kind | Targets | Required | Where the value comes from |
501
- | -------------------------------------------- | -------- | ----------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
502
- | `TAILOR_PLATFORM_MACHINE_USER_CLIENT_ID` | variable | all | yes | Client ID of the platform machine user CI signs in as (an existing secret of the same name still works as a deprecated fallback); it needs an editor or admin role on the organization or folder that holds the workspace. An organization or folder admin creates one in the Tailor Console and grants it a role; without the required permission you cannot view or create machine users |
503
- | `TAILOR_PLATFORM_MACHINE_USER_CLIENT_SECRET` | secret | all | yes | Client secret of the same platform machine user |
504
- | `TAILOR_PLATFORM_WORKSPACE_ID` | variable | branch, tag | yes | `id` printed by `tailor workspace create`, or listed by `tailor workspace list` |
505
- | `TAILOR_PLATFORM_ORGANIZATION_ID` | variable | preview | yes | Organization to create the per-PR workspaces in (a machine user cannot create a workspace without one): `organizationId` listed by `tailor organization list` |
506
- | `TAILOR_PLATFORM_FOLDER_ID` | variable | preview | no | Folder to create the per-PR workspaces in: `id` listed by `tailor organization folder list -o <organization id>`. When unset they go directly under the organization, which needs the machine user's role on the organization itself |
507
- | `TAILOR_PLATFORM_FAIL_ON_DRIFT` | variable | all | no | `true` to fail the drift check when it finds drift |
508
- | `TAILOR_SLACK_BOT_TOKEN` | secret | branch, tag | no | Bot User OAuth Token (`xoxb-...`) of a Slack app with the `chat:write` scope |
509
- | `TAILOR_SLACK_CHANNEL_ID` | variable | branch, tag | no | Channel ID (`C...`) from the channel details in Slack; invite the bot to the channel |
510
- | `TAILOR_SLACK_USER_MAPPING` | variable | branch, tag | no | JSON object mapping GitHub usernames to Slack member IDs (for example `{"alice":"U0123456"}`) so notifications mention the actor; read only after you uncomment the `user-mapping` input of the `tailor-notify` step |
590
+ | Name | Kind | Targets | Required | Where the value comes from |
591
+ | ---------------------------------------------------- | -------- | ----------------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
592
+ | `TAILOR_PLATFORM_MACHINE_USER_CLIENT_ID` | variable | all | yes | Client ID of the platform machine user CI signs in as (an existing secret of the same name still works as a deprecated fallback); it needs an editor or admin role on the organization or folder that holds the workspace. An organization or folder admin creates one in the Tailor Console and grants it a role; without the required permission you cannot view or create machine users |
593
+ | `TAILOR_PLATFORM_MACHINE_USER_CLIENT_SECRET` | secret | all | yes | Client secret of the same platform machine user |
594
+ | `TAILOR_PLATFORM_WORKSPACE_ID` | variable | branch, tag | yes | `id` printed by `tailor workspace create`, or listed by `tailor workspace list` |
595
+ | `TAILOR_PLATFORM_MIGRATION_TEST_SOURCE_WORKSPACE_ID` | variable | branch (migration test environment) | yes | ID of the workspace the migration test starts from, set on the environment passed to `--migration-test-environment`; it is only read to build the temporary workspace. Needs the machine user's editor or admin role on that workspace's organization or folder |
596
+ | `TAILOR_PLATFORM_ORGANIZATION_ID` | variable | preview | yes | Organization to create the per-PR workspaces in (a machine user cannot create a workspace without one): `organizationId` listed by `tailor organization list` |
597
+ | `TAILOR_PLATFORM_FOLDER_ID` | variable | preview | no | Folder to create the per-PR workspaces in: `id` listed by `tailor organization folder list -o <organization id>`. When unset they go directly under the organization, which needs the machine user's role on the organization itself |
598
+ | `TAILOR_PLATFORM_FAIL_ON_DRIFT` | variable | all | no | `true` to fail the drift check when it finds drift |
599
+ | `TAILOR_SLACK_BOT_TOKEN` | secret | branch, tag | no | Bot User OAuth Token (`xoxb-...`) of a Slack app with the `chat:write` scope |
600
+ | `TAILOR_SLACK_CHANNEL_ID` | variable | branch, tag | no | Channel ID (`C...`) from the channel details in Slack; invite the bot to the channel |
601
+ | `TAILOR_SLACK_USER_MAPPING` | variable | branch, tag | no | JSON object mapping GitHub usernames to Slack member IDs (for example `{"alice":"U0123456"}`) so notifications mention the actor; read only after you uncomment the `user-mapping` input of the `tailor-notify` step |
511
602
 
512
603
  See [Account management](https://docs.tailor.tech/administration/account-management)
513
604
  for how organizations, folders, workspaces, and machine users relate.
@@ -639,6 +730,12 @@ and apply the data after deploy.
639
730
  | branch, tag | `tailor seed apply --upsert` | The fields of each committed seed row are written; other rows are kept |
640
731
  | preview | `tailor seed apply --truncate --yes` | The preview workspace is emptied, IdP users included, and seeded from scratch |
641
732
 
733
+ The seed steps read the optional `SEED_USER_PASSWORD` secret of the GitHub
734
+ Environment and pass it to `tailor seed`, which uses it as the password of `_User`
735
+ rows that have none. Set it with `tailor setup ci env`. Validation on pull
736
+ requests gets a fixed placeholder instead of the secret, since it only checks that
737
+ a password exists.
738
+
642
739
  Setup stops unless the config uses `seedPlugin` with `machineUserName`, which
643
740
  names the machine user that seeds, and an existing `<distPath>/data/` directory.
644
741
  Every `--seed-dataset` must name an entry of
@@ -1,3 +1,7 @@
1
+ ---
2
+ description: "Upgrade your project to Tailor Platform SDK v2 by running the codemods and finishing the changes they report as not migrated automatically."
3
+ ---
4
+
1
5
  # Migrating to v2
2
6
 
3
7
  <!-- Generated from the sdk-codemod registry. Run `pnpm codemod:docs:update` and edit `packages/sdk-codemod/src/registry.ts` instead of this file. -->
@@ -1,3 +1,7 @@
1
+ ---
2
+ description: "Deploy one tailor.config.ts to development, staging, and production workspaces, and vary configuration values, secrets, and seed data per environment."
3
+ ---
4
+
1
5
  # Multi-Environment Configuration
2
6
 
3
7
  A project typically runs in more than one environment — for example, each developer's own workspace, a staging workspace, and a production workspace. The SDK has no separate "environment" concept: an environment is a workspace you deploy to, and all environments share the same `tailor.config.ts`. This guide shows how to switch the deployment target and how to vary configuration values per environment.
@@ -1,3 +1,7 @@
1
+ ---
2
+ description: "Build your own SDK plugin by implementing the Plugin interface and its definition-time and generation-time hooks."
3
+ ---
4
+
1
5
  # Custom Plugins (Beta)
2
6
 
3
7
  > **Beta Feature**: The custom plugin API is in beta and may change in future releases.
@@ -1,3 +1,7 @@
1
+ ---
2
+ description: "Build your frontend and upload it to a Static Website on every tailor deploy, with deployed URLs and OAuth client IDs passed in as build variables."
3
+ ---
4
+
1
5
  # Frontend Plugin
2
6
 
3
7
  `frontendPlugin` builds frontend assets and uploads them to Static Websites after
@@ -1,3 +1,7 @@
1
+ ---
2
+ description: "Extend TailorDB tables with plugins that generate additional tables, executors, and files, and learn how to register, attach, and configure them."
3
+ ---
4
+
1
5
  # Plugins (Beta)
2
6
 
3
7
  > **Beta Feature**: The plugin system is currently in beta. APIs may change in future releases.
@@ -1,3 +1,7 @@
1
+ ---
2
+ description: "Create an example app with the Tailor Platform SDK, set up a workspace, and deploy it in a few commands."
3
+ ---
4
+
1
5
  # Quickstart
2
6
 
3
7
  ## Getting Started
package/docs/runtime.md CHANGED
@@ -1,3 +1,7 @@
1
+ ---
2
+ description: "Call Tailor Platform runtime APIs such as secrets, IdP, workflows, file uploads, AI Gateway, and logging from your functions with typed imports from @tailor-platform/sdk/runtime."
3
+ ---
4
+
1
5
  # Runtime API
2
6
 
3
7
  `@tailor-platform/sdk/runtime` provides typed wrappers for the `tailor.*` and `tailordb.file` APIs that the Tailor Platform Function runtime injects into the global scope at execution time. The wrappers are thin and delegate to the platform-provided globals; they exist so that you can:
@@ -1,3 +1,7 @@
1
+ ---
2
+ description: "Define AI Gateways that give your app one OpenAI-compatible endpoint for multiple LLMs, with workspace authentication and platform-managed credentials."
3
+ ---
4
+
1
5
  # AI Gateway
2
6
 
3
7
  AI Gateway provides a unified endpoint for accessing a range of large language models through a single OpenAI-compatible API, with platform-managed credentials and workspace-scoped authentication.
@@ -1,3 +1,7 @@
1
+ ---
2
+ description: "Configure authentication and authorization with defineAuth, including user profiles, machine users, OAuth 2.0 clients, identity providers, auth connections, and before-login hooks."
3
+ ---
4
+
1
5
  # Auth
2
6
 
3
7
  Auth is a service for configuring authentication and authorization in your Tailor Platform application.
@@ -1,3 +1,7 @@
1
+ ---
2
+ description: "Create executors that run functions, webhooks, GraphQL operations, or workflows in response to record changes, schedules, incoming webhooks, and resolver events."
3
+ ---
4
+
1
5
  # Executor
2
6
 
3
7
  Executors are event-driven handlers that automatically trigger in response to data changes, schedules, or external events.
@@ -1,3 +1,7 @@
1
+ ---
2
+ description: "Expose REST-style HTTP endpoints that translate each request into a GraphQL operation and shape the response for HTTP clients."
3
+ ---
4
+
1
5
  # HTTP Adapter
2
6
 
3
7
  HTTP adapters expose REST-style HTTP endpoints on your application by translating each request into a GraphQL query and (optionally) reshaping the GraphQL response back into an HTTP response.
@@ -1,3 +1,7 @@
1
+ ---
2
+ description: "Set up the built-in identity provider with defineIdp to register and authenticate users and manage OAuth clients for your Auth service."
3
+ ---
4
+
1
5
  # IdP (Identity Provider)
2
6
 
3
7
  IdP is a built-in identity provider service for managing user authentication.