@tailor-platform/sdk 2.21.0 → 2.22.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.
- package/CHANGELOG.md +34 -0
- package/agent-skills/tailor/SKILL.md +3 -1
- package/dist/application-BE4vehXW.mjs +1 -0
- package/dist/{application-D4913edS.mjs → application-BzO9ywXQ.mjs} +29 -29
- package/dist/application-BzO9ywXQ.mjs.map +1 -0
- package/dist/cli/commands/deploy/app-id-lock.d.mts +31 -0
- package/dist/cli/lib.d.mts +2 -2
- package/dist/cli/lib.mjs +1 -1
- package/dist/cli/lib.mjs.map +1 -1
- package/dist/cli/main.mjs +39 -39
- package/dist/cli/main.mjs.map +1 -1
- package/dist/cli/shared/logger.d.mts +9 -0
- package/dist/cli/shared/tailordb-namespaces.d.mts +1 -1
- package/dist/completion/zsh-worker.zsh +1 -1
- package/dist/configure/config/index.d.mts +2 -0
- package/dist/configure/index.mjs.map +1 -1
- package/dist/crashreport-CBaRJl5h.mjs +1 -0
- package/dist/{crashreport-BAz-ph5O.mjs → crashreport-DFpRn-LS.mjs} +4 -4
- package/dist/{crashreport-BAz-ph5O.mjs.map → crashreport-DFpRn-LS.mjs.map} +1 -1
- package/dist/{errors-sNtg2Mv3.mjs → errors-C9zGf4nz.mjs} +2 -2
- package/dist/{errors-sNtg2Mv3.mjs.map → errors-C9zGf4nz.mjs.map} +1 -1
- package/dist/guards-yDXyKC9F.mjs +2 -0
- package/dist/{guards-DsX7dJCP.mjs.map → guards-yDXyKC9F.mjs.map} +1 -1
- package/dist/logger-Db-YRTwK.mjs +9 -0
- package/dist/logger-Db-YRTwK.mjs.map +1 -0
- package/dist/{manager-C0dE7pd0.mjs → manager-8-JOvuLl.mjs} +2 -2
- package/dist/{manager-C0dE7pd0.mjs.map → manager-8-JOvuLl.mjs.map} +1 -1
- package/dist/plugin/index.mjs +1 -1
- package/dist/plugin/index.mjs.map +1 -1
- package/dist/{register-ts-hook-YtsAGTMD.mjs → register-ts-hook-z7ggXQy4.mjs} +71 -70
- package/dist/register-ts-hook-z7ggXQy4.mjs.map +1 -0
- package/dist/seed/index.mjs +7 -6
- package/dist/seed/index.mjs.map +1 -1
- package/dist/service-Bx-7Lz06.mjs +1 -0
- package/dist/{service-BrGSi2IQ.mjs → service-CL1Bp4It.mjs} +3 -3
- package/dist/{service-BrGSi2IQ.mjs.map → service-CL1Bp4It.mjs.map} +1 -1
- package/dist/{service-8xznUrPU.mjs → service-DHVuH7-X.mjs} +2 -2
- package/dist/{service-8xznUrPU.mjs.map → service-DHVuH7-X.mjs.map} +1 -1
- package/dist/vitest/mocks/file.d.mts +1 -1
- package/docs/cli-reference.md +22 -12
- package/docs/configuration.md +1 -1
- package/docs/github-actions.md +90 -24
- package/docs/migration/v2.md +70 -5
- package/docs/plugin/index.md +1 -1
- package/package.json +8 -8
- package/dist/application-D4913edS.mjs.map +0 -1
- package/dist/application-DBHaxmJE.mjs +0 -1
- package/dist/crashreport-BfOkOFgc.mjs +0 -1
- package/dist/guards-DsX7dJCP.mjs +0 -2
- package/dist/logger-Cp5U2IDI.mjs +0 -9
- package/dist/logger-Cp5U2IDI.mjs.map +0 -1
- package/dist/register-ts-hook-YtsAGTMD.mjs.map +0 -1
- package/dist/service-DWMm-4Vm.mjs +0 -1
package/docs/github-actions.md
CHANGED
|
@@ -68,7 +68,9 @@ What it does:
|
|
|
68
68
|
applies the config; it does not re-run the PR plan.
|
|
69
69
|
- On **`workflow_dispatch`** with `dry-run: true`: runs plan only (useful for
|
|
70
70
|
rollback verification — see [Rollback](#rollback)). With `dry-run: false`
|
|
71
|
-
(default) it deploys, like a push.
|
|
71
|
+
(default) it deploys the selected branch, like a push. Pass
|
|
72
|
+
`--restrict-dispatch` to deploy only the target branch this way (see
|
|
73
|
+
[Restricting manual deploys](#restricting-manual-deploys)).
|
|
72
74
|
|
|
73
75
|
Fork pull requests cannot read repository secrets. For forks, the plan step is
|
|
74
76
|
automatically skipped; `generate-check` and other non-secret checks still run.
|
|
@@ -129,7 +131,9 @@ What it does:
|
|
|
129
131
|
before the deploy job starts.
|
|
130
132
|
- On **`workflow_dispatch`**: the `tailor-tag-guard` result is ignored — the
|
|
131
133
|
plan job runs regardless of branch reachability (useful for rolling back to
|
|
132
|
-
any tag). `dry-run: true` stops before the deploy job.
|
|
134
|
+
any tag). `dry-run: true` stops before the deploy job. With
|
|
135
|
+
`--restrict-dispatch`, the deploy job runs only for a tag that passes the
|
|
136
|
+
guard (see [Restricting manual deploys](#restricting-manual-deploys)).
|
|
133
137
|
|
|
134
138
|
### Choosing `--branch` for the tag target
|
|
135
139
|
|
|
@@ -190,20 +194,53 @@ Running a workflow setup subcommand creates or updates:
|
|
|
190
194
|
The workflow file. The `name:` field is set to `Tailor (<workspace-name>)` so
|
|
191
195
|
you can distinguish multiple workspaces in the Actions UI.
|
|
192
196
|
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
197
|
+
See [Customizing the generated workflow](#customizing-the-generated-workflow)
|
|
198
|
+
for what you can edit.
|
|
199
|
+
|
|
200
|
+
### Customizing the generated workflow
|
|
201
|
+
|
|
202
|
+
The SDK owns the jobs and steps whose `id` starts with `tailor-`, and the
|
|
203
|
+
top-level keys it writes (`name:`, `on:`, and `permissions:` in a workflow; the
|
|
204
|
+
metadata, inputs, and outputs of a composite action). Do not edit or rename
|
|
205
|
+
them. Everything else is yours, and re-running `setup` keeps it:
|
|
206
|
+
|
|
207
|
+
- **Your own jobs and steps.** Add them anywhere, without the `tailor-` prefix.
|
|
208
|
+
A step you add inside a managed job stays right after the managed step it
|
|
209
|
+
followed. For example, add private registry authentication or a system
|
|
210
|
+
dependency _before_ the managed `tailor-setup` step, and post-install extras
|
|
211
|
+
(such as `playwright install`) _after_ it. A job of your own can depend on a
|
|
212
|
+
managed job with `needs: tailor-deploy`.
|
|
213
|
+
- **Your own top-level keys**, such as a workflow-level `env:` or `defaults:`.
|
|
214
|
+
- **Runtime settings of managed jobs:** `runs-on`, `timeout-minutes`,
|
|
215
|
+
`container`, and `env`.
|
|
216
|
+
- **These inputs of managed steps:** `ignore` on `tailor-generate-check` and
|
|
217
|
+
`tailor-drift-check`, `fail-on-drift` on `tailor-drift-check`,
|
|
218
|
+
`install-command` on `tailor-install`, `node-version-file` on
|
|
219
|
+
`tailor-setup`, `label` on `tailor-plan`, and `user-mapping` on
|
|
220
|
+
`tailor-notify` and on a coordinator's steps that call an app action.
|
|
221
|
+
- **The `run:` command of the `build-site` step** in a composite action.
|
|
222
|
+
|
|
223
|
+
Comments above your own jobs and steps and at the end of the file are kept too.
|
|
224
|
+
Comments inside managed jobs and steps, and edits to the header comment, are
|
|
225
|
+
not kept.
|
|
226
|
+
|
|
227
|
+
`setup check` reports an edit to a managed part, and re-running `setup` stops
|
|
228
|
+
on it. Revert the edit, or pass `--force` to reset the managed parts to the
|
|
229
|
+
current template; `--force` still keeps your own jobs, steps, and settings.
|
|
230
|
+
A managed job or step you renamed counts as your own, so `--force` adds the
|
|
231
|
+
managed one back next to it; rename it back instead of forcing. To start over
|
|
232
|
+
from a clean template, delete the file and re-run `setup`.
|
|
233
|
+
|
|
234
|
+
When a template update removes a managed job that contains steps of yours, or
|
|
235
|
+
a job of yours `needs` a removed job, `setup` stops and names them. Move those
|
|
236
|
+
steps into a job of your own (or update the `needs`) and re-run. `--force` drops
|
|
237
|
+
steps left inside a removed job. It also stops when a new template version adds
|
|
238
|
+
a managed job or step whose id you already use; rename yours, or pass `--force`
|
|
239
|
+
to let the managed one replace it.
|
|
240
|
+
|
|
241
|
+
Files generated by an older SDK version are compared as a whole, so the first
|
|
242
|
+
re-run after upgrading stops if you edited the file in any way. Re-run once with
|
|
243
|
+
`--force` to switch it to this model; your own jobs and steps are kept.
|
|
207
244
|
|
|
208
245
|
### `.github/tailor.lock`
|
|
209
246
|
|
|
@@ -277,7 +314,8 @@ gh secret set TAILOR_PLATFORM_MACHINE_USER_CLIENT_SECRET --env my-app-stg
|
|
|
277
314
|
Setting them at the environment level isolates each target's credentials and
|
|
278
315
|
keeps them alongside that environment's `TAILOR_PLATFORM_WORKSPACE_ID`
|
|
279
316
|
variable. You can also set them as repository-level secrets if every target
|
|
280
|
-
shares one machine user
|
|
317
|
+
shares one machine user, but then any workflow on any branch can read them, so
|
|
318
|
+
the environment's protection rules no longer guard your deploys.
|
|
281
319
|
|
|
282
320
|
## GitHub Environments (approval gate)
|
|
283
321
|
|
|
@@ -309,8 +347,32 @@ or an out-of-band deploy. With `dry-run` off, a branch-target dispatch goes
|
|
|
309
347
|
straight to deploy (like a push), while a tag-target dispatch runs plan first
|
|
310
348
|
and then deploys.
|
|
311
349
|
|
|
312
|
-
|
|
313
|
-
|
|
350
|
+
By default you can select any branch or tag when dispatching manually, and it
|
|
351
|
+
deploys that ref. For tag targets, the tag-guard check is skipped for manual
|
|
352
|
+
dispatches, so you can deploy any commit regardless of branch membership.
|
|
353
|
+
|
|
354
|
+
### Restricting manual deploys
|
|
355
|
+
|
|
356
|
+
Pass `--restrict-dispatch` to `setup ci branch`, `setup ci tag`, or
|
|
357
|
+
`setup ci coordinate` to limit what a manual dispatch with `dry-run` off can
|
|
358
|
+
deploy:
|
|
359
|
+
|
|
360
|
+
- **Branch target:** only the target branch. Dispatching another branch skips
|
|
361
|
+
the deploy job.
|
|
362
|
+
- **Tag target:** only a tag. With `--branch`, the tag must also pass the
|
|
363
|
+
reachability guard. The tag does not have to match `--tag-pattern`.
|
|
364
|
+
|
|
365
|
+
Dry runs stay available from any ref. Re-run `setup` with the flag each time you
|
|
366
|
+
regenerate the workflow; it is not carried over from the previous run.
|
|
367
|
+
|
|
368
|
+
The flag guards against deploying the wrong ref by mistake. It is not an access
|
|
369
|
+
control: a manual dispatch runs the workflow file from the selected ref, so
|
|
370
|
+
anyone who can push a branch can remove the check there. To enforce which refs
|
|
371
|
+
can deploy, configure **Deployment branches and tags** on the target's GitHub
|
|
372
|
+
Environment and keep the machine-user secrets on that environment. Because the
|
|
373
|
+
plan job also enters the environment, allow `refs/pull/*/merge` as well so pull
|
|
374
|
+
request plans keep running, and note that dry runs from other branches are then
|
|
375
|
+
rejected too.
|
|
314
376
|
|
|
315
377
|
## Monorepo setup
|
|
316
378
|
|
|
@@ -365,6 +427,8 @@ git push origin v1.2.4
|
|
|
365
427
|
|
|
366
428
|
For tag targets, the tag-guard step is bypassed on manual dispatch, so you can
|
|
367
429
|
dispatch from any ref. Environment approval (if configured) applies as usual.
|
|
430
|
+
With `--restrict-dispatch`, step 4 deploys only a tag that passes the guard, and
|
|
431
|
+
a branch target deploys only its target branch, so use Option 1 there.
|
|
368
432
|
|
|
369
433
|
### Rollback limitations
|
|
370
434
|
|
|
@@ -445,7 +509,8 @@ subcommand.
|
|
|
445
509
|
|
|
446
510
|
`tailor setup check` audits the workflows recorded in
|
|
447
511
|
`.github/tailor.lock` against your current config and repository, without
|
|
448
|
-
writing anything. It reports when a workflow file is missing or
|
|
512
|
+
writing anything. It reports when a workflow file is missing or its SDK-managed
|
|
513
|
+
parts were edited by hand, a
|
|
449
514
|
newer template is available, `tailor.config.ts` is no longer under the recorded
|
|
450
515
|
`--dir`, or the repository default branch no longer matches a branch target's
|
|
451
516
|
trigger. It exits non-zero when it finds drift, so you can run it in CI. Each
|
|
@@ -474,10 +539,11 @@ itself at runtime.
|
|
|
474
539
|
## Updating the generated workflow
|
|
475
540
|
|
|
476
541
|
When you upgrade the SDK, re-run the relevant workflow setup subcommand with
|
|
477
|
-
the same flags to pick up template improvements.
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
542
|
+
the same flags to pick up template improvements. Your own jobs, steps, and
|
|
543
|
+
settings are kept (see
|
|
544
|
+
[Customizing the generated workflow](#customizing-the-generated-workflow)). If
|
|
545
|
+
you edited a managed part, the command stops; revert the edit or pass `--force`
|
|
546
|
+
to reset it.
|
|
481
547
|
|
|
482
548
|
The `.github/tailor.lock` file records the flags used at generation time,
|
|
483
549
|
so you can check what arguments were used previously.
|
package/docs/migration/v2.md
CHANGED
|
@@ -84,18 +84,83 @@ After:
|
|
|
84
84
|
import { definePlugins } from "@tailor-platform/sdk";
|
|
85
85
|
import { kyselyTypePlugin } from "@tailor-platform/sdk/plugin/kysely-type";
|
|
86
86
|
|
|
87
|
-
export const
|
|
87
|
+
export const plugins = definePlugins(kyselyTypePlugin({ distPath: "db.ts" }));
|
|
88
88
|
```
|
|
89
89
|
|
|
90
90
|
<details>
|
|
91
91
|
<summary>Prompt for an AI agent (to finish the cases the codemod could not migrate)</summary>
|
|
92
92
|
|
|
93
93
|
```text
|
|
94
|
-
defineGenerators() is replaced by definePlugins() in v2
|
|
95
|
-
|
|
96
|
-
|
|
94
|
+
defineGenerators() is replaced by definePlugins() in v2, exported as `plugins` — the
|
|
95
|
+
only export name the SDK reads plugins from. The codemod rewrites the known plugin
|
|
96
|
+
tuples (kysely-type, enum-constants, file-utils, seed) and renames the export variable
|
|
97
|
+
to `plugins` (left alone when the file already binds `plugins` to something else). For
|
|
98
|
+
any remaining defineGenerators([...]) the codemod left in place — a plugin it does not
|
|
97
99
|
know, or a non-tuple/spread form — convert it to definePlugins(pluginFn(config)),
|
|
98
|
-
importing the matching plugin from its @tailor-platform/sdk/plugin/<name> subpath
|
|
100
|
+
importing the matching plugin from its @tailor-platform/sdk/plugin/<name> subpath, and
|
|
101
|
+
assign the result to `export const plugins`.
|
|
102
|
+
Merge any remaining exported plugin arrays into `plugins`, including bindings
|
|
103
|
+
exported separately with `export { ... }`, and update their importing files.
|
|
104
|
+
Only tailor.config module exports are renamed automatically; preserve helper-module
|
|
105
|
+
exports and expose their plugins under the canonical config export manually.
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
</details>
|
|
109
|
+
|
|
110
|
+
## generator/generators → plugins export rename
|
|
111
|
+
|
|
112
|
+
**Migration:** Partially automatic
|
|
113
|
+
|
|
114
|
+
Rename the plugin config export (and its imports) from generator/generators to plugins
|
|
115
|
+
|
|
116
|
+
Before:
|
|
117
|
+
|
|
118
|
+
```ts
|
|
119
|
+
import { definePlugins } from "@tailor-platform/sdk";
|
|
120
|
+
import myPlugin from "./plugins/my-plugin";
|
|
121
|
+
|
|
122
|
+
export const generators = definePlugins(myPlugin());
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
After:
|
|
126
|
+
|
|
127
|
+
```ts
|
|
128
|
+
import { definePlugins } from "@tailor-platform/sdk";
|
|
129
|
+
import myPlugin from "./plugins/my-plugin";
|
|
130
|
+
|
|
131
|
+
export const plugins = definePlugins(myPlugin());
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
Also updates other files that import the export by its old name.
|
|
135
|
+
|
|
136
|
+
Before:
|
|
137
|
+
|
|
138
|
+
```ts
|
|
139
|
+
import { generator } from "./tailor.config";
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
After:
|
|
143
|
+
|
|
144
|
+
```ts
|
|
145
|
+
import { plugins } from "./tailor.config";
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
<details>
|
|
149
|
+
<summary>Prompt for an AI agent (to finish the cases the codemod could not migrate)</summary>
|
|
150
|
+
|
|
151
|
+
```text
|
|
152
|
+
The SDK only reads plugins from an export named `plugins`; `generator`/`generators` is
|
|
153
|
+
already `definePlugins()` but under the old name. This codemod renames the export (and
|
|
154
|
+
any `import { generator[s] } from ".../tailor.config"` elsewhere) to `plugins`. It
|
|
155
|
+
leaves a file untouched when it already binds `plugins` to something else, or when a
|
|
156
|
+
bare (unaliased) import's local usages cannot be safely told apart from an unrelated
|
|
157
|
+
same-named binding in that file — rename those by hand to `plugins`.
|
|
158
|
+
Multiple arrays or bindings exported separately with `export { ... }` need manual
|
|
159
|
+
consolidation into the `plugins` export; update their importing files as well.
|
|
160
|
+
Only tailor.config module exports are renamed automatically. Review aliased SDK
|
|
161
|
+
factory calls and helper-module re-exports manually, preserving the helper API.
|
|
162
|
+
Indirect config exports, namespace/dynamic imports, and wildcard re-exports are
|
|
163
|
+
conservatively reported for review; keep unrelated values and canonical references unchanged.
|
|
99
164
|
```
|
|
100
165
|
|
|
101
166
|
</details>
|
package/docs/plugin/index.md
CHANGED
|
@@ -33,7 +33,7 @@ export default defineConfig({
|
|
|
33
33
|
});
|
|
34
34
|
```
|
|
35
35
|
|
|
36
|
-
**Important**:
|
|
36
|
+
**Important**: `definePlugins()` must be assigned to a named export called exactly `plugins` (not default, and not any other name).
|
|
37
37
|
|
|
38
38
|
### Attaching Plugins to Tables
|
|
39
39
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tailor-platform/sdk",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.22.0",
|
|
4
4
|
"description": "Tailor Platform SDK - The SDK to work with Tailor Platform",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -164,13 +164,13 @@
|
|
|
164
164
|
"@opentelemetry/resources": "2.11.0",
|
|
165
165
|
"@opentelemetry/sdk-trace-node": "2.11.0",
|
|
166
166
|
"@opentelemetry/semantic-conventions": "1.43.0",
|
|
167
|
-
"@oxc-project/types": "0.
|
|
167
|
+
"@oxc-project/types": "0.151.0",
|
|
168
168
|
"@politty/zod": "0.3.0",
|
|
169
169
|
"@secretlint/core": "13.0.5",
|
|
170
170
|
"@secretlint/secretlint-rule-preset-recommend": "13.0.5",
|
|
171
171
|
"@standard-schema/spec": "1.1.0",
|
|
172
172
|
"@tailor-platform/function-kysely-tailordb": "0.1.3",
|
|
173
|
-
"@toiroakr/lines-db": "0.
|
|
173
|
+
"@toiroakr/lines-db": "0.13.0",
|
|
174
174
|
"@toiroakr/read-multiline": "0.4.1",
|
|
175
175
|
"@urql/core": "6.0.3",
|
|
176
176
|
"amaro": "1.2.1",
|
|
@@ -178,7 +178,7 @@
|
|
|
178
178
|
"date-fns": "4.4.0",
|
|
179
179
|
"es-toolkit": "1.52.0",
|
|
180
180
|
"find-up-simple": "1.0.1",
|
|
181
|
-
"get-east-asian-width": "1.
|
|
181
|
+
"get-east-asian-width": "1.7.0",
|
|
182
182
|
"get-tsconfig": "4.14.3",
|
|
183
183
|
"globals": "17.12.0",
|
|
184
184
|
"graphql": "17.0.2",
|
|
@@ -186,7 +186,7 @@
|
|
|
186
186
|
"kysely": "0.29.6",
|
|
187
187
|
"mime-types": "3.0.2",
|
|
188
188
|
"open": "11.0.4",
|
|
189
|
-
"oxc-parser": "0.
|
|
189
|
+
"oxc-parser": "0.151.0",
|
|
190
190
|
"p-limit": "7.3.3",
|
|
191
191
|
"pathe": "2.0.3",
|
|
192
192
|
"pgsql-ast-parser": "12.0.2",
|
|
@@ -198,7 +198,7 @@
|
|
|
198
198
|
"temporal-polyfill": "1.0.5",
|
|
199
199
|
"temporal-spec": "1.0.1",
|
|
200
200
|
"ts-cron-validator": "1.1.5",
|
|
201
|
-
"type-fest": "5.
|
|
201
|
+
"type-fest": "5.10.0",
|
|
202
202
|
"xdg-basedir": "5.1.0",
|
|
203
203
|
"zod": "4.6.5"
|
|
204
204
|
},
|
|
@@ -213,8 +213,8 @@
|
|
|
213
213
|
"@typescript/native-preview": "7.0.0-dev.20260707.2",
|
|
214
214
|
"@vitest/coverage-v8": "5.0.1",
|
|
215
215
|
"eslint-plugin-zod": "4.14.2",
|
|
216
|
-
"oxfmt": "0.
|
|
217
|
-
"oxlint": "1.
|
|
216
|
+
"oxfmt": "0.70.0",
|
|
217
|
+
"oxlint": "1.85.0",
|
|
218
218
|
"oxlint-tsgolint": "7.0.2002",
|
|
219
219
|
"sonda": "0.14.0",
|
|
220
220
|
"tsdown": "0.23.0",
|