@tenonhq/dovetail-servicenow 0.0.26 → 0.0.28

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 CHANGED
@@ -201,8 +201,62 @@ npx dove-sn edit-action --sys-id <action_type_sys_id> --scope <scope_sys_id> \
201
201
  --patch-script "grabHashData::grabRecipients" # dry-run (diff)
202
202
  npx dove-sn edit-action --sys-id <id> --scope <scope> --set-script ./script.js \
203
203
  --merge-outputs ./output-var.json --apply --update-set <id> # persist + publish
204
+
205
+ # Edit it STRUCTURALLY — several steps' scripts, step-level IO, pill wiring — in one publish
206
+ npx dove-sn edit-action --sys-id <id> --scope <scope> --from-json ops.json # dry-run
207
+ npx dove-sn edit-action --sys-id <id> --scope <scope> --from-json ops.json \
208
+ --apply --update-set <id> # publish + verify
209
+ ```
210
+
211
+ ### Editing an action type's steps (`--from-json`)
212
+
213
+ The flag form above patches the one auto-detected script. When you need to touch
214
+ more than one step — or the step's own inputs and outputs — pass an ops file:
215
+
216
+ ```json
217
+ {
218
+ "patchStepScripts": [
219
+ { "step": "Parse Response", "scriptFile": "./parse-response.js" },
220
+ { "step": "Handle Error", "patchScript": { "find": "gs.error", "replace": "gs.warn" } }
221
+ ],
222
+ "addStepOutputs": [
223
+ { "step": "Parse Response", "name": "isRetryable", "label": "Is Retryable", "type": "boolean" }
224
+ ],
225
+ "addStepInputs": [
226
+ {
227
+ "step": "Handle Error",
228
+ "name": "isRetryable",
229
+ "type": "boolean",
230
+ "pillFrom": { "step": "Parse Response", "output": "isRetryable" }
231
+ }
232
+ ]
233
+ }
204
234
  ```
205
235
 
236
+ - **`step`** is a step's `cid` **or** its label — an unknown ref fails with the list of steps that do exist.
237
+ - **`scriptFile`** is sugar for `setScript`, resolved **relative to the ops file**, so scripts can live beside it.
238
+ - **`addStepInputs[].pillFrom`** wires the input to another step's output. You never write the pill
239
+ yourself — the correct format is `{{step[<source_cid>].<output>}}`, and getting it wrong does not
240
+ fail the publish, it compiles a dead reference that reads `undefined` at runtime.
241
+ - Ops are **order-independent**: an input may pill from an output added in the same call. Everything
242
+ lands in a **single** `/snapshot` POST.
243
+ - Adding IO is **idempotent** — a name that is already present is skipped with a warning, not duplicated.
244
+
245
+ Two behaviours worth knowing before you rely on this:
246
+
247
+ **It refuses to guess an entry shape.** A new `extended_inputs` / `extended_outputs` entry is built by
248
+ mirroring an existing sibling entry on the same step, because those entries carry more keys than the
249
+ four you supply and some are wrapped as `{value: x}` inconsistently. If the step has *no* existing
250
+ entry in that list, there is nothing to mirror and the command **errors out** rather than hand-author
251
+ an object that would corrupt the action. Author one entry in the Designer first, then re-run.
252
+
253
+ **It verifies the publish.** A `201` from `/snapshot` means the snapshot compiled — not that your edit
254
+ landed as intended. With `--apply`, the steps are read back from the instance and compared against what
255
+ was sent: script **content** (hashed, so a same-length-but-different script can't pass) and each IO
256
+ entry's **name, type and value** — so an entry that landed with a mis-wired pill is caught, not just a
257
+ missing one. A mismatch prints the diff and exits **2**. When every op was a no-op, there is nothing to
258
+ read back and the round-trip is skipped.
259
+
206
260
  `copy-flow` calls the Designer's own `POST /processflow/flow/{id}/copy` — a
207
261
  complete, faithful clone created as an **inactive draft**. (Don't publish +
208
262
  activate a copy of a triggered production flow unless you intend it to fire.)
@@ -427,7 +481,9 @@ Claude Code and agents: `create_view`, `set_list_layout`, `set_form_layout`,
427
481
  existing record) and `create_record` (insert one record) — both update-set-captured
428
482
  and read-back-verified — `host_assets` (deploy a built dist/), plus the Flow Designer
429
483
  tools `flow_view` (read a flow/subflow's step graph), `action_view` (read an action
430
- type's model), `flow_publish` (compile a flow/subflow snapshot), `flow_copy`
484
+ type's model), `action_edit` (structurally edit a published action type — per-step
485
+ scripts, step-level inputs/outputs, data-pill wiring — dry-run by default, and the
486
+ publish is read back and verified), `flow_publish` (compile a flow/subflow snapshot), `flow_copy`
431
487
  (copy a flow as an inactive draft), `flow_create` (create a NEW flow from scratch +
432
488
  publish, grafting a template), `flow_test` (validate or run a flow), and
433
489
  `flow_edit` (patch a flow), plus `invoke_rest` (invoke an arbitrary authenticated
package/dist/cli.d.ts CHANGED
@@ -1,16 +1,16 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
- * sinc-sn — thin CLI adapter for @tenonhq/dovetail-servicenow.
3
+ * dove-sn — thin CLI adapter for @tenonhq/dovetail-servicenow.
4
4
  *
5
5
  * Usage:
6
- * sinc-sn add-choices \
6
+ * dove-sn add-choices \
7
7
  * --table x_cadso_core_event \
8
8
  * --column state \
9
9
  * --update-set <sys_id> \
10
10
  * --choices 'delivered=Delivered,failed=Failed,...' \
11
11
  * [--choice-type 3] [--json]
12
12
  *
13
- * sinc-sn add-choices --from-json path/to/choices.json
13
+ * dove-sn add-choices --from-json path/to/choices.json
14
14
  *
15
15
  * JSON payload shape:
16
16
  * {