@diagonal-hq/cli 0.7.0 → 0.8.1
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/README.md +14 -1
- package/dist/cli.mjs +156 -34
- package/dist/index.d.ts +20 -0
- package/dist/sdk-contract.d.ts +4 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@ This package is the authoring SDK for file-based workspaces. A workspace reposit
|
|
|
5
5
|
- The configuration helpers: `defineConfig`, `defineResource`, `definePage`, `defineNavigation`, `defineAssets`, `asset.version`, `defineNotificationType`, `defineNotificationTemplate`, `defineEmailLayout`, `defineNotificationSchedule`, and the `field` builders. Each `define*` function returns its first argument. Each `field.<type>(options)` call returns `{ $field, ...options }`, where `$field` is the stored field type. The package root exports them as ESM JavaScript with declarations, so a Vite build or a Node script can import a configuration file.
|
|
6
6
|
- Types for the helpers, `WorkflowConfig`, and the `Sdk` and `React` globals.
|
|
7
7
|
- Editor types for the workflow script SDK: `@diagonal/workflow`, `@diagonal/workflow/testing`, and `@diagonal/workflow/workspace`.
|
|
8
|
-
- The `diagonal check` command. It runs the same build and checks that a platform deploy runs, including the workflow tests.
|
|
8
|
+
- The `diagonal check` command. It runs the same build and checks that a platform deploy runs, including the workflow tests. It also writes `generated/resources.ts` and the missing definition uids.
|
|
9
9
|
- The `diagonal workflows` and `diagonal run` commands. They list the deployed workflows and run a manual workflow by its file path.
|
|
10
10
|
|
|
11
11
|
## Check a workspace
|
|
@@ -61,6 +61,19 @@ The build reads each file with a parser. It runs only the workflow tests.
|
|
|
61
61
|
|
|
62
62
|
- The build does not read `notifications/` or `email-layouts/` yet. The editor type-checks the shape of their definitions. See [Notifications](#notifications).
|
|
63
63
|
|
|
64
|
+
## Definition uids and slugs
|
|
65
|
+
|
|
66
|
+
A definition can have two identity options. No definition uses them yet.
|
|
67
|
+
|
|
68
|
+
- `uid` is the stable identity of the definition. Its value is a lowercase UUID string literal, such as `uid: '3f2b8c1e-7d4a-4e9b-a6c5-1d0e9f8a7b6c'`. A file move, a file rename, or a name change keeps the uid. Do not change a uid.
|
|
69
|
+
- `slug` is the editable, user-facing name of the definition. It is kebab-case: lowercase letters and digits in groups that one `-` joins, such as `job-postings`. A slug change keeps the uid.
|
|
70
|
+
|
|
71
|
+
`diagonal check` writes a new uid into each definition that has none. It adds `uid: '<uuid>'` as the first option of the `defineX()` object and leaves the rest of the file unchanged. Commit the change.
|
|
72
|
+
|
|
73
|
+
A platform deploy does not write source. A definition without a uid fails the deploy, and the error tells you to run `diagonal check`.
|
|
74
|
+
|
|
75
|
+
A uid is unique among the definitions of one type. Two definitions of one type with one uid are an error at the second file, and the error names the first file. The check does not replace a duplicate uid. When you copy a definition file, delete its `uid` and run `diagonal check`. A uid that is not a lowercase UUID string literal is an error.
|
|
76
|
+
|
|
64
77
|
## Resource references
|
|
65
78
|
|
|
66
79
|
The file name is the resource slug: `resources/job-postings.ts` declares the resource `job-postings`. A file name must start with a lowercase letter and contain only a-z, 0-9, `_`, and `-`. A resource has no `id` in source. The platform derives the stored id from the workspace and the slug, so each branch and environment has its own ids.
|