@meistrari/tela-cli 1.4.0 → 1.6.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.
@@ -16,11 +16,13 @@ import {
16
16
  code,
17
17
  crop,
18
18
  docTemplate,
19
+ condition,
19
20
  input,
20
21
  llm,
21
22
  splitter,
22
23
  vault,
23
24
  remote,
25
+ stop,
24
26
  workflow,
25
27
  } from '@meistrari/workflow-code'
26
28
  import type { WorkflowCodeConfig } from '@meistrari/workflow-code'
@@ -43,6 +45,8 @@ import type { WorkflowCodeConfig } from '@meistrari/workflow-code'
43
45
  | [`canvas()`](#canvasremoteref-options) | Executable Canvas or Workflow refs from the remote catalog. |
44
46
  | [`agent(remoteRef, options)`](#agentremoteref-options) | Published-Agent calls from the remote catalog. |
45
47
  | [`code()`](#codeoptions) | Sandboxed runtime JavaScript/TypeScript execution. |
48
+ | [`condition()`](#conditionoptions) | Synchronous predicate branches with compiler-owned V3 branch ports. |
49
+ | [`stop()`](#stop) | Terminal leaf allowed only as the final direct node of a condition branch. |
46
50
  | [`ref()` / `paths()` / `formats()`](#references-ref-paths-and-formats) | References to workflow inputs or prior node output in prompt callbacks and code handlers. |
47
51
 
48
52
  A workflow file normally creates inputs, creates nodes, then default-exports `build(workflow(...), { inputs, nodes })`.
@@ -177,6 +181,7 @@ const normalizeInvoice = code({
177
181
  Reference rules:
178
182
 
179
183
  - References in node inputs may target workflow inputs or earlier nodes.
184
+ - `condition()` and `stop()` are compiler-owned topology nodes and do not produce output references.
180
185
  - `paths()` only accepts node declarations, not inputs.
181
186
  - Path tokens are branded; do not replace them with strings or arrays.
182
187
  - A path token must come from the same node used in `ref()`, or authoring throws `ref path source must match ref target`.
@@ -743,6 +748,38 @@ Avoid these patterns:
743
748
  - Forward references to later nodes.
744
749
  - Declaring generated-reserved names such as `execute` or `TelaInput` in extracted handler/helper/type code.
745
750
 
751
+ ### `condition(options)`
752
+
753
+ ```ts
754
+ const route = condition({
755
+ cases: {
756
+ approved: {
757
+ when: ({ ref, paths }) =>
758
+ ref(classify, paths(classify).status) === 'approved',
759
+ nodes: [approveInvoice],
760
+ },
761
+ },
762
+ default: { nodes: [manualReview] },
763
+ })
764
+ ```
765
+
766
+ Declares a Workflow V3 condition. `cases` are evaluated in authored object insertion order; array-index names like `"0"` are rejected. Each named case has a synchronous boolean `when` predicate and ordered branch `nodes`. The optional `default` has only `nodes`.
767
+
768
+ The compiler extracts predicate source without executing it, copies supported source-visible helpers and local imports, rewrites `ref()` reads to runtime inputs, and emits guarded JavaScript for the V3 condition action. V3 `steps`, branch `portId`s, node IDs, and graph edges are always compiler-owned.
769
+
770
+ ### `stop()`
771
+
772
+ ```ts
773
+ const route = condition({
774
+ cases: {
775
+ duplicate: { when: () => true, nodes: [stop()] },
776
+ },
777
+ default: { nodes: [continueProcessing] },
778
+ })
779
+ ```
780
+
781
+ Declares a terminal Workflow V3 stop node. It is valid only as the final direct node in a `condition()` case or default branch. A stopped branch does not converge to the next node; normal and empty sibling branches still converge. `stop()` at the workflow root, inside a map body, or before another direct branch node reports `compiler.stop.invalid_placement`.
782
+
746
783
  ### Config and shared types
747
784
 
748
785
  These types are exported for config files and integrations. See [Config](/docs/config) for full examples.
@@ -1,6 +1,6 @@
1
1
  ## CLI
2
2
 
3
- The workflow command group documents implemented `init`, `compile`, `docs`, `codegen`, `sync`, and `publish` workflows. Current MVP behavior is local-first until you run explicit remote lifecycle commands such as `sync` or `publish`.
3
+ The workflow command group documents implemented `init`, `create`, `compile`, `docs`, `codegen`, `sync`, and `publish` workflows. Current MVP behavior is local-first until you run an explicit remote lifecycle command such as `create`, `sync`, or `publish`.
4
4
 
5
5
  ### Command surface
6
6
 
@@ -10,12 +10,13 @@ The workflow command group documents implemented `init`, `compile`, `docs`, `cod
10
10
  | `compile [target] [--config <path>] [--env <path>] [--json]` | Implemented | No | Compile selected source into Workflow V3 output. |
11
11
  | `docs [page] [--json]` | Implemented | No | Read the version-matched Workflow Code documentation bundled with the installed CLI. |
12
12
  | `codegen [--json]` | Implemented | No | Refresh or reuse the active-context remote catalog and generate remote() TypeScript metadata. |
13
+ | `create <target> [--project <project-id>] [--config <path>] [--env <path>] [--json]` | Implemented | Yes | Provision a remote workflow, bind it to the active context, scaffold source, and sync when possible. |
13
14
  | `sync [target] [--config <path>] [--env <path>] [--yes] [--json]` | Implemented | Yes | Synchronize local compiled workflow(s) with configured Tela prompt(s). |
14
15
  | `publish [target] [--environment <name>] [--create-environment-if-missing] [--config <path>] [--env <path>] [--yes] [--json]` | Implemented | Yes | Publish local-matching workflow version(s) to the selected workflow environment. |
15
16
 
16
17
  ### Target selection
17
18
 
18
- The positional target is the key inside `workflow-code.config.ts` `workflows`. If `compile` sees exactly one configured workflow, the target may be omitted. If multiple workflows exist, `compile` requires a target. `sync` and `publish` use the same target key; when the target is omitted, they run every configured workflow. For publish, `--environment <name>` selects the workflow publication environment and is independent from the active Tela Local context. `--env <path>` remains a dotenv loader.
19
+ The positional target is the key inside `workflow-code.config.ts` `workflows`. `create` always requires exactly one target. If `compile` sees exactly one configured workflow, the target may be omitted; with multiple workflows it is required. `sync` and `publish` use the same target key and run every configured workflow when it is omitted. For publish, `--environment <name>` selects the workflow publication environment and is independent from the active Tela Local context. `--env <path>` remains scoped to dotenv-backed config/source evaluation and does not select the remote Tela context.
19
20
 
20
21
  ```bash
21
22
  tela workflow compile
@@ -23,6 +24,7 @@ tela workflow compile invoice-processing
23
24
  tela workflow compile invoice-processing --env .env.staging --json
24
25
  tela workflow docs cli
25
26
  tela workflow codegen --json
27
+ tela workflow create invoice-processing --project proj_123 --json
26
28
  tela workflow sync
27
29
  tela workflow sync invoice-processing --env .env.staging --json
28
30
  tela workflow publish
@@ -72,6 +74,8 @@ tela workflow init --workflow invoice-processing --yes --json
72
74
 
73
75
  **Description.** `tela workflow compile` loads config, loads dotenv files, evaluates the TypeScript entrypoint, validates declarations, and returns deterministic Workflow V3 graph, payload, hashes, and diagnostics. It does not require or validate remote `projectId`/`promptId`, write lockfiles, sync remote content, or publish.
74
76
 
77
+ `compile` stays offline. For a workflow that declares `vault.asset()`, it can lower the asset only when the active-context lockfile already contains the matching uploaded `vault://...` ref. Otherwise it reports `vault.asset.missing_lock`. Compile never reads the asset file, uploads it, refreshes the lock, or contacts Vault; run `sync` first to create or refresh that lock.
78
+
75
79
  | Prop | Type | Required | Description |
76
80
  |---|---|---:|---|
77
81
  | `target` | Positional | No | Config `workflows` key to compile. Required when more than one workflow is configured. |
@@ -132,6 +136,8 @@ tela workflow codegen --json
132
136
 
133
137
  **Description.** `tela workflow sync` compiles local source, resolves the active Tela Local context, selects the matching `projectId` and `promptId`, verifies remote content, and writes per-context lockfile state under `.tela/workflows/<workflowKey>/contexts/<context>/lock.json`.
134
138
 
139
+ For `vault.asset()` declarations, sync validates that each local path is a regular file within the project directory, hashes its content, and reuses a matching active-context asset lock when possible. New or changed assets are uploaded and recorded as `vault://...` refs before sync performs its final resolved compilation or any workflow lifecycle mutation. This makes later offline `compile` runs deterministic; a changed asset is uploaded again on the next sync.
140
+
135
141
  Sync uses a consolidated version strategy. The compiled workflow becomes the complete source of truth for the next remote version: source files, hashes, lifecycle payload, package metadata, and binding metadata are consolidated into one prompt version snapshot. When compiled content changed, sync creates a new non-draft version. The only exception is a verified no-op: if local hashes already match the active-context lockfile and fresh remote content confirms the same version, sync returns without creating a version.
136
142
 
137
143
  Consolidated versions make sync safe to repeat. A sync never edits an existing version in place, never mutates a draft, and never changes the previous consolidated version. If the workflow is currently pointing at a draft version, sync leaves that draft untouched and creates a new consolidated non-draft version for the compiled workflow instead.
@@ -158,7 +164,37 @@ tela workflow sync invoice-processing --env .env.staging --yes --json
158
164
 
159
165
  **Example: no local changes.** CI runs `tela workflow sync --yes --json` after a previous successful sync. If local hashes match the lockfile and the remote snapshot still matches, sync returns a no-op and does not create another version.
160
166
 
167
+ ### create
168
+
169
+ **Description.** `tela workflow create <target>` explicitly creates a remote Tela workflow, binds the returned prompt identity under `workflows[target]` for the active Tela Local context, scaffolds source, and runs the normal sync lifecycle when its prerequisites are available. It is never called by `init` and never publishes.
170
+
171
+ Create resolves credentials, API endpoint, workspace, and active context through shared Tela Local config/auth. The project is taken from the target's active context binding (or a legacy top-level target binding when no `contexts` map exists). For a new target or missing active binding, pass `--project <project-id>`; create deliberately does not infer a project from the workspace or another workflow.
172
+
173
+ The command preflights config/source safety and compilation, then performs changes in this order: remote creation, config binding, source scaffold, config-loader verification, and best-effort sync. Before `/prompt`, create reuses sync's context-bound remote-reference preparation: it refreshes and validates used `remote()` references, recompiles them to concrete resource IDs, and authenticates direct Vault references. Immediately before the POST, it reloads the source and transitive local imports, reapplies the prepared remote snapshot, and requires the same source and compiled hashes. Preparation failures, `create.source.snapshot_changed`, or unresolved `$workflowCodeRemote` markers stop without creating a workflow. A target already bound to a `promptId` also fails before remote creation; use `sync` for that workflow.
174
+
175
+ Create canonicalizes the config identity through symlinked parent directories without following a final config symlink. The stable remote idempotency key is derived from that canonical config, target, active context, workspace, and project, so path aliases and retries replay the same logical creation. Target selection, project, source entry, and config edits come from one immutable loader snapshot; a changed snapshot reports `create.config.snapshot_changed` before `/prompt`. Config object spreads, computed properties, or duplicate mutation-path properties that could make the edited syntax differ from the evaluated binding are rejected before remote creation.
176
+
177
+ The successful API response is untrusted: it must contain a non-empty prompt `id`, bootstrap `version.id`, `projectId`, and `workspaceId`, with project/workspace matching the request. Create validates those returned identities without additional prompt/version reads; complete representation validation is deferred until the create endpoint returns those fields. If Tela returns a valid prompt id but an absent or malformed bootstrap version identity, create exits non-zero before local writes/sync while preserving `promptId` and the create idempotency key; JSON reports `bootstrapVersionId: null`. If the POST outcome is unknown and no prompt identity was returned, JSON still reports the attempted idempotency key with `promptId: null`, no local writes, and non-zero exit status so the same logical create can be replayed safely.
178
+
179
+ Config binding uses an exclusive per-config lock, re-reads the preflight hash while holding that lock, and atomically replaces only the unchanged config. After the scaffold step, create reloads the config and verifies the effective target entry/workflow key plus the exact context/project/prompt binding; `create.config.postcondition_failed` stops before sync if evaluation diverges from what was written. Source paths must remain inside the config root without symlinked components both before remote creation and before writing. Source writes are exclusive: a file that appears after preflight or an existing source that disappears produces `create.source.write_conflict`; create neither overwrites/recreates that content nor syncs it automatically. Existing config entries and validated source files remain preserved by default.
180
+
181
+ If remote creation succeeds but local work fails, human and JSON output retain the recoverable remote identity plus written/skipped paths. Next actions follow the completed phase: request a manual binding only when the config write failed, describe source repair after a source-write failure, and describe loader or effective-binding repair after config/source were written or preserved. Follow-up sync is pinned to the provisioning context, workspace, project, prompt, and returned bootstrap version. It reads the remote snapshot before editing; if the remote advances past that bootstrap first, `create.sync.bootstrap_version_changed` skips the automatic edit and asks for an explicit sync after review. Only a failure before sync mutation (`preflight`) becomes `sync.status: "skipped"` with warnings; a failure after `mutation_attempted` remains an error, exits non-zero, and exposes pending-sync recovery with lockfile path, idempotency key, and target version id. `published` is always `false`.
161
182
 
183
+ | Prop | Type | Required | Description |
184
+ |---|---|---:|---|
185
+ | `target` | Positional | Yes | Config `workflows` key and local workflow target name to provision. Must not already have a prompt binding in the active context. |
186
+ | `--project <project-id>` | Flag | Conditional | Tela project for a new target or missing active binding. Must match a configured active-binding project when both are present. |
187
+ | `--config <path>` | Flag | No | Load and update a custom config instead of `workflow-code.config.ts`. |
188
+ | `--env <path>` | Flag | No | Load a custom dotenv file before evaluating config. |
189
+ | `--json` | Flag | No | Emit diagnostics, remote identity, active binding, written/skipped paths, sync status, and `published: false`. |
190
+
191
+ **Examples.**
192
+
193
+ ```bash
194
+ tela workflow create invoice-processing
195
+ tela workflow create invoice-processing --project proj_123
196
+ tela workflow create invoice-processing --project proj_123 --env .env.staging --json
197
+ ```
162
198
 
163
199
  ### publish
164
200
 
@@ -1,6 +1,6 @@
1
1
  ## Config
2
2
 
3
- `workflow-code.config.ts` selects workflow targets, TypeScript entrypoints used by `compile`, and remote prompt bindings used by `sync`. The config is evaluated after dotenv loading, so `process.env` is available.
3
+ `workflow-code.config.ts` selects workflow targets, TypeScript entrypoints used by `compile`, and active-context project/prompt bindings used by `create`, `sync`, and `publish`. The config is evaluated after dotenv loading, so `process.env` is available.
4
4
 
5
5
  ### Basic shape
6
6
 
@@ -57,11 +57,11 @@ TELA_DEV_PROJECT_ID=proj_development
57
57
  TELA_DEV_PROMPT_ID=prompt_development
58
58
  ```
59
59
 
60
- Use `tela workflow compile --env .env.staging --json` to validate local workflow source. `compile` does not require or validate `projectId`/`promptId`; use `tela workflow sync demo --env .env.staging --json` when remote bindings are available. Do not print secrets or store credentials in workflow source.
60
+ Use `tela workflow compile --env .env.staging --json` to validate local workflow source. `compile` does not require or validate `projectId`/`promptId`. Use `tela workflow create demo --project <project-id>` to provision and bind a new remote workflow, or `tela workflow sync demo --env .env.staging --json` when the prompt binding already exists. Do not print secrets or store credentials in workflow source.
61
61
 
62
62
  ### Contexts
63
63
 
64
- Contexts can mirror Tela Dock contexts for environment-specific ids. `compile` remains local validation. `sync` resolves the active Tela Local context, chooses the matching `contexts[...]` binding, requires both `projectId` and `promptId`, and writes state under `.tela/workflows/<workflowKey>/contexts/<context>/lock.json`.
64
+ Contexts can mirror Tela Dock contexts for environment-specific ids. `compile` remains local validation. `create` resolves the active Tela Local context through shared local state, uses that binding's `projectId` (or explicit `--project`), and writes the returned `promptId` into the same binding. `sync` requires both ids there and writes state under `.tela/workflows/<workflowKey>/contexts/<context>/lock.json`. A `TELA_CONTEXT` value loaded through `.env` or `--env` is scoped to config/source evaluation and cannot redirect these remote operations.
65
65
 
66
66
  ```bash
67
67
  tela context current --json
@@ -26,6 +26,17 @@ src/workflows/shared.ts
26
26
  | `src/workflows/prompts.ts` | Prompt strings and small prompt helpers. |
27
27
  | `src/workflows/shared.ts` | Pure utilities reused by declarations or code handlers. |
28
28
 
29
+ ### Generate remote authoring metadata
30
+
31
+ Run `codegen` before typechecking workflow source that uses named `remote()` catalog paths. It refreshes the active Tela Local context's catalog and writes the TypeScript augmentation used for remote authoring. `codegen` is workspace-scoped: it does not take a workflow target, load `workflow-code.config.ts`, compile a workflow, or mutate Tela resources.
32
+
33
+ ```bash
34
+ pnpm exec tela workflow codegen --json > .tela/codegen-result.json
35
+ node -e "const r=require('./.tela/codegen-result.json'); if (!r.success || r.diagnostics?.some(d => d.severity === 'error')) process.exit(1)"
36
+ ```
37
+
38
+ With credentials, codegen refreshes the catalog. When that refresh is unavailable, it can use only a complete cached snapshot for the same active context and workspace; inspect its warning diagnostics and `fetchedAt` before relying on the generated names.
39
+
29
40
  ### CI compile check
30
41
 
31
42
  Use `compile --json` in CI to validate source and fail on error diagnostics before any remote lifecycle command runs.
@@ -37,7 +48,9 @@ pnpm exec tela workflow compile demo --env .env.ci --json > .tela/compile-result
37
48
  node -e "const r=require('./.tela/compile-result.json'); if (r.diagnostics?.some(d => d.severity === 'error')) process.exit(1)"
38
49
  ```
39
50
 
40
- For trusted release jobs with Tela credentials, run sync after compile:
51
+ `compile` does not upload local `vault.asset()` files. An asset workflow needs an uploaded ref in the active-context lockfile or compile reports `vault.asset.missing_lock`. Do not use a compile-only job to bootstrap those locks.
52
+
53
+ For trusted release jobs with Tela credentials, run sync. It reuses unchanged asset hashes, uploads new or changed assets, records their Vault refs in the context lockfile, then performs final resolved compilation before the workflow lifecycle mutation:
41
54
 
42
55
  ```bash
43
56
  pnpm exec tela workflow sync --env .env.ci --yes --json > .tela/sync-result.json
@@ -48,9 +61,11 @@ Commit stable context lockfiles such as `.tela/workflows/*/contexts/*/lock.json`
48
61
 
49
62
  ### Troubleshooting diagnostics
50
63
 
51
- When `compile` or `sync` fails, read diagnostic `code` and `hint` first. Most failures point to config shape, missing env files, unresolved entry paths, invalid references, `workflowKey` mismatches, unsupported `code()` extraction patterns, missing `promptId`, active-context binding mismatches, or remote divergence.
64
+ When `codegen`, `compile`, or `sync` fails, read diagnostic `code` and `hint` first. Most failures point to config shape, missing env files, unresolved entry paths, invalid references, `workflowKey` mismatches, unsupported `code()` extraction patterns, missing `promptId`, active-context binding mismatches, Vault asset locks/uploads, or remote divergence.
52
65
 
66
+ - Use `tela workflow codegen --json` to refresh remote authoring metadata or inspect matching-context cached-fallback diagnostics.
53
67
  - Use `tela workflow compile --json` for declaration and graph diagnostics.
54
68
  - Use `tela context current --json` when `sync` selects an unexpected context binding.
69
+ - Run `tela workflow sync` when `compile` reports `vault.asset.missing_lock`; sync uploads and locks the local asset before its final resolved compile.
55
70
  - Pass `--yes` only in trusted non-interactive jobs where consolidating a newer remote version is expected.
56
71
  - Keep code handlers source-visible and avoid dynamic imports, runtime-created closure values, and reserved generated names.
@@ -8,31 +8,31 @@
8
8
  "slug": "overview",
9
9
  "title": "Documentation overview",
10
10
  "file": "overview.md",
11
- "sha256": "88c838262048260cee280cdd8d16e9987847bcf06b857ca6d2cf0b707c4b15fe"
11
+ "sha256": "6209c5b2d8b2d85ca8a084df932e0af9786ff88312f80c59625b47a1d246f307"
12
12
  },
13
13
  {
14
14
  "slug": "api-reference",
15
15
  "title": "API Reference",
16
16
  "file": "api-reference.md",
17
- "sha256": "380cf0c8543400f6fd311936f1b4fb984f12d27b0472213b8a2b431405f0755e"
17
+ "sha256": "f601e98f0c63812dc0979473c5476b35709f6c8ff70e6de131674503d9cfbe59"
18
18
  },
19
19
  {
20
20
  "slug": "cli",
21
21
  "title": "CLI",
22
22
  "file": "cli.md",
23
- "sha256": "759db330fd7b06859e55404f01feb0625a43bb579324fe011bc34cd92d517239"
23
+ "sha256": "aaa6b661a7adf7bebcb22a0881e604034886515440468fad7e20c7e5ce3a2e6d"
24
24
  },
25
25
  {
26
26
  "slug": "config",
27
27
  "title": "Config",
28
28
  "file": "config.md",
29
- "sha256": "b07b91f46b4ab9a3850df58a0dec388c670771be6de0a5cf3bafd989135fe306"
29
+ "sha256": "7a9a70422f2dc8aad5238d6aa0d09a4d635a18e08d264556a35eff5e9efe31f3"
30
30
  },
31
31
  {
32
32
  "slug": "guides",
33
33
  "title": "Guides",
34
34
  "file": "guides.md",
35
- "sha256": "b3f2ff1ac03f3829b6c5614ecc61229e181179dd2506684fae073075748359cb"
35
+ "sha256": "4109cef4376315b99cbee2d763c927c3148ed889b8602f958fb785faebaf8e03"
36
36
  },
37
37
  {
38
38
  "slug": "installation",
@@ -44,7 +44,7 @@
44
44
  "slug": "quick-start",
45
45
  "title": "Quick start",
46
46
  "file": "quick-start.md",
47
- "sha256": "15f4b45bd6292c4dd3f3ff5fc58f46e5e83e55f3a5e4ed9fee0df37fd12b2305"
47
+ "sha256": "fbb93a9d7ac137a565da232eb145ddab9178d988d6b7d6b218ddd4b735ccb2e2"
48
48
  }
49
49
  ]
50
50
  }
@@ -9,6 +9,6 @@ Workflow Code documentation is organized as a set of focused pages. Read the pag
9
9
  | [Quick start](/docs/quick-start) | You want the shortest path from `tela workflow init` to local compile and explicit sync. |
10
10
  | [Installation](/docs/installation) | You need to verify Tela Dock, the `tela` CLI, or the `@meistrari/workflow-code` package. |
11
11
  | [Config](/docs/config) | You are defining `workflow-code.config.ts`, dotenv files, target ids, or context-specific bindings. |
12
- | [CLI](/docs/cli) | You need implemented init/compile/docs/codegen/sync/publish behavior, target selection rules, generated catalog refresh, or JSON diagnostics. |
12
+ | [CLI](/docs/cli) | You need implemented init/create/compile/docs/codegen/sync/publish behavior, target selection rules, generated catalog refresh, or JSON diagnostics. |
13
13
  | [API Reference](/docs/api-reference) | You are authoring `workflow()`, `build()`, `input`, `llm`, `agent`, `code`, references, remote catalogs, and executable remote refs. |
14
14
  | [Guides](/docs/guides) | You want repository layout, CI compile checks, and troubleshooting patterns. |
@@ -9,7 +9,7 @@ tela whoami --pretty
9
9
  tela workflow help
10
10
  ```
11
11
 
12
- `compile` is a local validation step. It does not create, sync, publish, or run remote workflows. `sync` writes compiled versions to configured Tela prompts, while `publish` releases a local-matching version to a workflow publication environment.
12
+ `compile` is a local validation step. It does not create, sync, publish, or run remote workflows. Use the optional `create` command only when this project needs a new remote Tela workflow; an existing remote workflow can be configured and sent directly through `sync`. `publish` releases a local-matching version to a workflow publication environment.
13
13
 
14
14
  ### Initialize local scaffold
15
15
 
@@ -29,6 +29,7 @@ export default {
29
29
  workflows: {
30
30
  demo: {
31
31
  entry: './src/workflows/demo.workflow.ts',
32
+ workflowKey: 'first-workflow',
32
33
  projectId: process.env.TELA_PROJECT_ID,
33
34
  promptId: process.env.TELA_WORKFLOW_PROMPT_ID,
34
35
  contexts: {
@@ -107,6 +108,16 @@ tela workflow compile demo --json
107
108
 
108
109
  Use `compile` to validate source and inspect deterministic graph, compiler payload, hashes, and diagnostics.
109
110
 
111
+ ### Create a new remote workflow (optional)
112
+
113
+ If `demo` already points to an existing Tela workflow, keep its active-context `projectId`/`promptId` binding and continue to `sync`. To provision a new remote workflow instead, leave `promptId` unset and make the active binding's project available or pass it explicitly:
114
+
115
+ ```bash
116
+ tela workflow create demo --project proj_123 --json
117
+ ```
118
+
119
+ `create` contacts Tela intentionally, validates the prompt/bootstrap/project/workspace identities returned by the create response, records that identity in the active-context config binding, preserves the authored source, and attempts the normal sync lifecycle without publishing. It rejects an already prompt-bound target. If the POST outcome is unknown, `--json` retains the stable idempotency key even when `promptId` is `null`; replay the same command instead of choosing a new identity. If sync prerequisites are unavailable or the remote advanced beyond the bootstrap version, inspect the reported `sync.status`, phase, diagnostics, and recovery data before running `sync` yourself.
120
+
110
121
  ### Sync
111
122
 
112
123
  ```bash