> For the complete documentation index, see [llms.txt](https://developer.celigo.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.celigo.com/cli/commands/scripts.md).

# scripts

JavaScript hooks that run inside flow execution — `_id`-addressable, versioned resources that exports, imports, and flows reference by `_scriptId`.

**REST API**: [Scripts](https://developer.celigo.com/api/api-reference/scripts-and-stacks/scripts)

```
celigo scripts <subcommand> [args] [flags]
```

Supports all [global flags](https://developer.celigo.com/cli/getting-started/global-flags.md).

***

## Subcommands

| Subcommand                            | Purpose                                                                                                  |
| ------------------------------------- | -------------------------------------------------------------------------------------------------------- |
| `list`                                | List all scripts.                                                                                        |
| `get <id>`                            | Fetch one script.                                                                                        |
| `create`                              | Create a script from a JSON body (`--file <path>` or stdin).                                             |
| `update <id>`                         | Full replace from a JSON body (`--file <path>` or stdin); destructive `PUT`.                             |
| `set <id> key=value …`                | Safe field edit: `debugUntil` via atomic PATCH, others GET → modify → PUT. Supports `key=file://<path>`. |
| `delete <id>`                         | Delete a script.                                                                                         |
| `dependencies <id>` (alias `used-by`) | List resources that depend on this script.                                                               |
| `enable-debug <id>`                   | Turn on debug logging (sets `debugUntil`).                                                               |
| `disable-debug <id>`                  | Turn off debug logging (clears `debugUntil`).                                                            |
| `debug-logs <id>`                     | Fetch the script's execution log — what its `console.*` calls wrote during real runs, newest first.      |
| `delete-debug-logs <id>`              | Delete the script's execution log — every entry `debug-logs` reads.                                      |
| `audit <id>`                          | Show the script's audit trail (change history).                                                          |

***

## `celigo scripts list`

List every script in the account. Rows are projected to `_id`, `name`, and the table columns by default; `--fields all` returns complete documents.

**Signature**

```bash
celigo scripts list [--fields <spec>] [--limit <n>]
```

**Flags**

| Flag              | Type    | Default   | Description                                                                                                                                                                                                                                                                                  |
| ----------------- | ------- | --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `--fields <spec>` | string  | `default` | Fields to request per row: `default` (`_id`, `name`, and the table columns), `all` (complete documents), or a comma-separated field list (dot notation allowed). See [field projection](https://developer.celigo.com/cli/getting-started/global-flags.md#field-projection-on-list-commands). |
| `--limit <n>`     | integer | —         | Return at most `<n>` rows, fetching a single page.                                                                                                                                                                                                                                           |

Default table columns: `_id`, `name`, `lastModified`. Since celigo-cli 2026.10.1, `--fields a,b,…` with `--format table` draws `_id`, `name`, and the fields you name instead.

**Example**

```bash
celigo scripts list --format table
```

**Corresponds to**: [`GET /v1/scripts`](https://developer.celigo.com/api/api-reference/scripts-and-stacks/scripts#get-v1-scripts) → Scripts API reference.

***

## `celigo scripts get`

Fetch one script by ID.

**Signature**

```bash
celigo scripts get <id>
```

**Arguments**

| Argument | Type   | Required | Description   |
| -------- | ------ | -------- | ------------- |
| `<id>`   | string | Yes      | Script `_id`. |

**Example**

```bash
celigo scripts get 5f83a9b2c7d3e8f1a2b3c4d5
```

**Corresponds to**: [`GET /v1/scripts/{_id}`](https://developer.celigo.com/api/api-reference/scripts-and-stacks/scripts#get-v1-scripts-_id) → Scripts API reference.

***

## `celigo scripts create`

Create a script from a JSON body. Read the body from a file with `-f, --file` (recommended), or pipe it on stdin.

Since celigo-cli 2026.10.1, the body is checked before it is sent. It is validated against the published API schemas — the pack [`celigo lint`](https://developer.celigo.com/cli/local-tree/lint-and-resolve.md#celigo-lint) uses: a field the spec does not document, a wrong JSON type, or a value outside an enum prints a `warning` line on stderr, and the script is still created. Refused before any request, with no override: a body that is not a JSON object and masked `"******"` credential placeholders.

**Signature**

```bash
celigo scripts create --file <path>
celigo scripts create < body.json     # or pipe on stdin
```

**Flags**

| Flag                | Type   | Default | Description                                                                                                  |
| ------------------- | ------ | ------- | ------------------------------------------------------------------------------------------------------------ |
| `-f, --file <path>` | string | —       | Read the JSON body from a file instead of stdin (`--file -` also means stdin). Added in celigo-cli 2026.6.1. |

**Request body**

A JSON object matching the `POST /v1/scripts` request schema (see the Scripts API reference). The script body goes in the `content` field, which must be a **JSON-encoded** string — see [Gotchas](#gotchas).

**Example**

```bash
# From a checked-in JSON file — no shell escaping, works in bash and PowerShell
celigo scripts create --file ./script.json
```

**Power-user** (requires `jq` installed on your `PATH`): build the body inline, JSON-encoding the script source with `jq --rawfile`, so you don't need a separate file.

```bash
jq --rawfile src ./filter-cancelled.js \
  '{name: "Filter cancelled orders", content: $src}' \
  | celigo scripts create
```

**Corresponds to**: [`POST /v1/scripts`](https://developer.celigo.com/api/api-reference/scripts-and-stacks/scripts#post-v1-scripts) → Scripts API reference.

***

## `celigo scripts update`

Full replace of a script from a JSON body (`--file <path>` or stdin). Omitted fields are erased — prefer `set` for targeted edits.

> ⚠️ **`update` replaces the entire script.** Any field you omit is erased, including `content`. GET the current script first, or use `set content=file://…` to swap only the body.

Send `name` with every update, even one that only changes the content. A body whose `name` is missing or empty is refused (`422 invalid_script`, field `name`), and nothing is saved. A body built from `scripts get <id>` has it. Since celigo-cli 2026.10.2, the error names the field the platform refused, which its own message leaves out:

```
(422): Validation error: Script fields are invalid. (field: name)
```

Since celigo-cli 2026.10.1, the body is checked against the published API schemas before the PUT (when it has findings, the current script is read first, so only what the update adds or changes is reported); findings are stderr warnings and never block. A body that is not a JSON object is refused before any request. On an Integration App's script (`_connectorId` set), the platform answers `200` and keeps its own value for every field the app locks: each field the update changed whose reply still holds the previous value is named on stderr, and the command exits `1`.

**Signature**

```bash
celigo scripts update <id> --file <path>
celigo scripts update <id> < body.json     # or pipe on stdin
```

**Arguments**

| Argument | Type   | Required | Description   |
| -------- | ------ | -------- | ------------- |
| `<id>`   | string | Yes      | Script `_id`. |

**Flags**

| Flag                | Type    | Default | Description                                                                                                                                                                                                                                                |
| ------------------- | ------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `-f, --file <path>` | string  | —       | Read the JSON body from a file instead of stdin (`--file -` also means stdin). Added in celigo-cli 2026.6.1.                                                                                                                                               |
| `--force`           | boolean | `false` | Submit even if the body contains masked credential values (`"******"`) copied from a `GET`. Since celigo-cli 2026.10.1, a masked value is four or more asterisks and nothing else: a lone `*` (a wildcard, for example) is a value and needs no `--force`. |

**Request body**

A JSON object matching the `PUT /v1/scripts/{_id}` request schema (see the Scripts API reference). The `content` field must be a **JSON-encoded** string — see [Gotchas](#gotchas).

**Example**

```bash
# Replace the whole script from a file
celigo scripts update 5f83a9b2c7d3e8f1a2b3c4d5 --file ./script.json
```

To swap only the script body while keeping every other field, prefer `set <id> content=file://…` below.

**Power-user** (requires `jq` installed on your `PATH`): round-trip the current resource through `jq`, replacing `content` with the JSON-encoded file.

```bash
celigo scripts get 5f83a9b2c7d3e8f1a2b3c4d5 \
  | jq --rawfile src ./filter-cancelled.js '.content = $src' \
  | celigo scripts update 5f83a9b2c7d3e8f1a2b3c4d5
```

**Corresponds to**: [`PUT /v1/scripts/{_id}`](https://developer.celigo.com/api/api-reference/scripts-and-stacks/scripts#put-v1-scripts-_id) → Scripts API reference.

***

## `celigo scripts set`

Safe field edit: GET the current resource, apply `key=value` assignments, then `PUT` the complete object back. `debugUntil` — the scripts PATCH whitelist — is the exception: an assignment that touches only it is sent as one atomic `PATCH`. Values are auto-parsed as JSON (`disabled=false` is a boolean, `debugUntil=null` removes the field), with a fallback to the literal string when the value isn't valid JSON. Dot notation and array indexing are supported.

A `key=file://<path>` value loads that field's value from a file instead of the command line — ideal for the multi-line `content` of a script, which is painful to quote and escape inline. A JSON file parses to an object; anything else (including JS source) is read as a literal string. A leading `~` and paths relative to the current directory are supported. Added in celigo-cli 2026.6.1.

Since celigo-cli 2026.11.2, the file is read in its encoding: UTF-8, with or without a byte-order mark, or UTF-16 by its byte-order mark, which is what `>` and `Out-File` write in Windows PowerShell 5.1. A file in any other encoding, such as Windows-1252, is refused before any request. Earlier releases read every file as UTF-8 and sent such a file as damaged text.

In `operate` mode, `set` takes only `debugUntil`. Since celigo-cli 2026.10.1, another operational field name such as `disabled` is refused in `operate` mode instead of opening a GET + PUT of the whole script. See [permission modes](https://developer.celigo.com/cli/getting-started/profiles.md#permission-modes).

Since celigo-cli 2026.10.1, `set` also checks what it sends and what landed:

* The assigned value (PATCH) or the document it would PUT is checked against the published API schemas; findings are stderr warnings and never block.
* After a GET + PUT, a field the server's reply still holds at its previous value prints `not stored <field> the server answered the PUT but still holds its previous value …` on stderr, and the command exits `1` — the platform answers `200` for a change it ignores.
* On an Integration App's script (`_connectorId` set), one stderr line names the fields the app kept — `celigo: scripts set: the platform kept its own value for <fields> — the Integration App locks them` — and the command exits `1`.

**Signature**

```bash
celigo scripts set <id> key=value [key2=value2 ...]
```

**Arguments**

| Argument                 | Type   | Required | Description                                                                   |
| ------------------------ | ------ | -------- | ----------------------------------------------------------------------------- |
| `<id>`                   | string | Yes      | Script `_id`.                                                                 |
| `key=value` (repeatable) | string | Yes      | One or more assignments. Use `key=file://<path>` to load a value from a file. |

**Example**

```bash
# Update just the script body from a checked-in file — no jq, no escaping, cross-platform
celigo scripts set 5f83a9b2c7d3e8f1a2b3c4d5 content=file://./hooks/filter-cancelled.js

# Rename (inline scalar)
celigo scripts set 5f83a9b2c7d3e8f1a2b3c4d5 'name=Filter cancelled orders (v2)'
```

**Power-user** (requires `jq` installed on your `PATH`): you can JSON-encode the source inline instead of using `file://`. The `file://` form above avoids the external `jq` dependency and the shell differences entirely.

```bash
# bash
celigo scripts set 5f83a9b2c7d3e8f1a2b3c4d5 "content=$(jq -Rs . < ./filter-cancelled.js)"

# PowerShell — '<' input redirection isn't supported, so pipe instead
celigo scripts set 5f83a9b2c7d3e8f1a2b3c4d5 "content=$(Get-Content -Raw ./filter-cancelled.js | jq -Rs .)"
```

**Corresponds to**: [`GET /v1/scripts/{_id}`](https://developer.celigo.com/api/api-reference/scripts-and-stacks/scripts#get-v1-scripts-_id) then [`PUT /v1/scripts/{_id}`](https://developer.celigo.com/api/api-reference/scripts-and-stacks/scripts#put-v1-scripts-_id) → Scripts API reference; an assignment of `debugUntil` alone is one [`PATCH /v1/scripts/{_id}`](https://developer.celigo.com/api/api-reference/scripts-and-stacks/scripts).

***

## `celigo scripts delete`

Delete a script. Prompts for confirmation unless `-y` is passed.

> ⚠️ **Deleting a script cannot be undone.** Run `dependencies` first — exports, imports, and flows that reference it by `_scriptId` will break.

**Signature**

```bash
celigo scripts delete <id> [flags]
```

**Arguments**

| Argument | Type   | Required | Description   |
| -------- | ------ | -------- | ------------- |
| `<id>`   | string | Yes      | Script `_id`. |

**Flags**

| Flag        | Type    | Default | Description                   |
| ----------- | ------- | ------- | ----------------------------- |
| `-y, --yes` | boolean | `false` | Skip the confirmation prompt. |

**Example**

```bash
celigo scripts delete 5f83a9b2c7d3e8f1a2b3c4d5 -y
```

**Corresponds to**: [`DELETE /v1/scripts/{_id}`](https://developer.celigo.com/api/api-reference/scripts-and-stacks/scripts#delete-v1-scripts-_id) → Scripts API reference.

***

## `celigo scripts dependencies`

List resources that depend on this script (alias: `used-by`). Use it to check whether a script is safe to delete — an empty result means nothing references it. Since celigo-cli 2026.10.1, an id that matches no script answers with the script's `404` instead of an empty result, so a typo never reads as safe to delete.

**Signature**

```bash
celigo scripts dependencies <id>
```

**Arguments**

| Argument | Type   | Required | Description   |
| -------- | ------ | -------- | ------------- |
| `<id>`   | string | Yes      | Script `_id`. |

**Example**

```bash
celigo scripts dependencies 5f83a9b2c7d3e8f1a2b3c4d5
```

**Corresponds to**: `GET /v1/scripts/{_id}/dependencies` → Scripts API reference.

***

## `celigo scripts enable-debug`

Enable debug logging on a script by setting `debugUntil` via `PATCH`. Debug adds `console.debug` output to the script's log; `console.log`, `console.info`, `console.warn`, and `console.error` are recorded without it.

**Signature**

```bash
celigo scripts enable-debug <id> [flags]
```

**Arguments**

| Argument | Type   | Required | Description   |
| -------- | ------ | -------- | ------------- |
| `<id>`   | string | Yes      | Script `_id`. |

**Flags**

| Flag                   | Type    | Default | Description                                                                                                                                                                                                                                                                            |
| ---------------------- | ------- | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `--duration <minutes>` | integer | `60`    | Debug window length in whole minutes. Max 60 minutes; larger values are clamped. Since celigo-cli 2026.10.1, a zero, negative, or non-numeric value is refused — `Invalid --duration '<value>'. Use whole minutes from 1 to 60.` — instead of setting a window that has already ended. |

**Example**

```bash
celigo scripts enable-debug 5f83a9b2c7d3e8f1a2b3c4d5 --duration 30
```

**Corresponds to**: [`PATCH /v1/scripts/{_id}`](https://developer.celigo.com/api/api-reference/scripts-and-stacks/scripts#patch-v1-scripts-_id) (JSON-Patch `replace /debugUntil`) → Scripts API reference.

***

## `celigo scripts disable-debug`

Disable debug logging on a script by clearing `debugUntil` via `PATCH`.

**Signature**

```bash
celigo scripts disable-debug <id>
```

**Arguments**

| Argument | Type   | Required | Description   |
| -------- | ------ | -------- | ------------- |
| `<id>`   | string | Yes      | Script `_id`. |

**Example**

```bash
celigo scripts disable-debug 5f83a9b2c7d3e8f1a2b3c4d5
```

**Corresponds to**: [`PATCH /v1/scripts/{_id}`](https://developer.celigo.com/api/api-reference/scripts-and-stacks/scripts#patch-v1-scripts-_id) (JSON-Patch `remove /debugUntil`) → Scripts API reference.

***

## `celigo scripts debug-logs`

Fetch a script's execution log — what its `console.*` calls wrote during real runs of the flows, APIs, and tools whose steps use it — newest first. `console.log`, `console.info`, `console.warn`, and `console.error` are recorded on every real run; only `console.debug` needs debug enabled (`debugUntil`, via `enable-debug`). Test runs write no entries. Table columns: `time`, `logLevel`, `functionType`, `_resourceId`, `message`.

Since celigo-cli 2026.10.1, the command follows the log's cursor; it used to read one page, which the API filters after listing, so a filter could print nothing while matching entries sat further back. The API returns the log one time slice per call, and a slice that held nothing still carries the cursor to the next, so the command follows `nextPageURL` until the window ends — up to 100 pages, with a stderr note when it stops short: `Note: stopped after 100 pages with more of the log unread (read back to <time>). Narrow the window with --since or --time-gte/--time-lte.` The window is sent as the API's epoch-millisecond `time_gt`/`time_lte`, and `--flow-id`, `--resource-id`, and `--function-type` as filters. The API has no level, limit, or offset parameter, so the CLI applies `--level`, `--limit`, and `--offset` to the entries as they arrive and stops reading once they are met.

Since celigo-cli 2026.11.2, a blank `--flow-id`, `--resource-id`, or `--function-type` (an unset shell variable) is refused before any request.

**Signature**

```bash
celigo scripts debug-logs <id> [flags]
```

**Arguments**

| Argument | Type   | Required | Description   |
| -------- | ------ | -------- | ------------- |
| `<id>`   | string | Yes      | Script `_id`. |

**Flags**

| Flag                     | Type                       | Default | Description                                                                                                             |
| ------------------------ | -------------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------- |
| `--level <level>`        | `INFO\|WARN\|ERROR\|DEBUG` | —       | Keep one level. Applied by the CLI.                                                                                     |
| `--limit <n>`            | integer                    | `100`   | Stop after this many matching entries. Applied by the CLI.                                                              |
| `--offset <n>`           | integer                    | —       | Skip this many matching entries first. Applied by the CLI.                                                              |
| `--since <minutes>`      | integer                    | —       | Only entries from the last N minutes (sets `time_gt`). Cannot be combined with `--time-gte`.                            |
| `--flow-id <id>`         | string                     | —       | Only entries from hooks that ran in this flow, API, or tool. Sent as `_flowId`.                                         |
| `--resource-id <id>`     | string                     | —       | Only entries from hooks that ran on this export or import. Sent as `_resourceId`. Added in celigo-cli 2026.10.1.        |
| `--function-type <type>` | string                     | —       | Only entries from one hook type, for example `preMap`. Sent as `functionType`. Added in celigo-cli 2026.10.1.           |
| `--time-gte <iso>`       | ISO 8601                   | —       | Return entries at or after this timestamp.                                                                              |
| `--time-lte <iso>`       | ISO 8601                   | —       | Return entries at or before this timestamp. Needs `--time-gte` or `--since`: the API reads the window backward from it. |

> **These flags were renamed in celigo-cli 2026.8.1.** They were `--start-date` and `--end-date`. The new names match the `--*-gte` / `--*-lte` pattern used for every date bound in the CLI.

**Example**

```bash
# Errors the script logged in the last 30 minutes — no debug window needed
celigo scripts debug-logs 5f83a9b2c7d3e8f1a2b3c4d5 --since 30 --level ERROR

# console.debug output is recorded only during a debug window
celigo scripts enable-debug 5f83a9b2c7d3e8f1a2b3c4d5 --duration 30
# ...trigger the flow that runs the script...
celigo scripts debug-logs 5f83a9b2c7d3e8f1a2b3c4d5 --since 30 --level DEBUG

# One hook type on one import, in a fixed window
celigo scripts debug-logs 5f83a9b2c7d3e8f1a2b3c4d5 \
  --resource-id 60a1b2c3d4e5f6a7b8c9d0e1 --function-type preMap \
  --time-gte 2026-08-01T00:00:00Z --time-lte 2026-08-01T06:00:00Z
```

**Corresponds to**: [`GET /v1/scripts/{_id}/logs`](https://developer.celigo.com/api/api-reference/scripts-and-stacks/scripts#get-v1-scripts-_id-logs) → Scripts API reference — with `time_gt`, `time_lte`, `_flowId`, `_resourceId`, and `functionType` as query parameters, then each page's `nextPageURL`.

***

## `celigo scripts delete-debug-logs`

Delete a script's execution log — every entry `scripts debug-logs` reads, debug or not. Prompts for confirmation unless `-y` is passed. Requires `operate` mode.

**Signature**

```bash
celigo scripts delete-debug-logs <id> [flags]
```

**Arguments**

| Argument | Type   | Required | Description   |
| -------- | ------ | -------- | ------------- |
| `<id>`   | string | Yes      | Script `_id`. |

**Flags**

| Flag        | Type    | Default | Description                   |
| ----------- | ------- | ------- | ----------------------------- |
| `-y, --yes` | boolean | `false` | Skip the confirmation prompt. |

**Example**

```bash
celigo scripts delete-debug-logs 5f83a9b2c7d3e8f1a2b3c4d5 -y
```

**Corresponds to**: `DELETE /v1/scripts/{_id}/logs` → Scripts API reference.

***

## `celigo scripts audit`

Get a script's audit trail (change history). Since celigo-cli 2026.10.1, every page of the log is read (the endpoint pages at 1,000 entries), and the table columns are `_id`, `resourceType`, `event`, `source`, `byUser.email`, and `time` — the table used to show `_id` alone.

**Signature**

```bash
celigo scripts audit <id>
```

**Arguments**

| Argument | Type   | Required | Description   |
| -------- | ------ | -------- | ------------- |
| `<id>`   | string | Yes      | Script `_id`. |

**Example**

```bash
celigo scripts audit 5f83a9b2c7d3e8f1a2b3c4d5
```

**Corresponds to**: `GET /v1/scripts/{_id}/audit` → Scripts API reference.

***

## Hook types

The entry-function name in your script body determines which hook point it runs at:

| Entry function    | When it runs                                               |
| ----------------- | ---------------------------------------------------------- |
| `preSavePage`     | Before a page of records is saved to the import queue.     |
| `preMap`          | Before import mapping transforms records.                  |
| `postMap`         | After mapping, before the HTTP call to the destination.    |
| `postSubmit`      | After the destination returns.                             |
| `postResponseMap` | After response mapping extracts data from the destination. |
| `handleRequest`   | For Celigo APIs — handle the incoming request body.        |
| `transform`       | Standalone transform within Transformation 2.0.            |
| `branching`       | Router decision function for flow branching.               |
| `filter`          | Boolean return — include or exclude records.               |

## Gotchas

* **`content` is freeform JavaScript — let the CLI encode it, don't hand-escape.** With `create`/`update` the script source lives inside a JSON body, so pasting raw multi-line JS makes the body **invalid JSON** and the command fails with `Invalid JSON input.` *before any API call* — which is why script writes can look like a broken CLI when they're really a local parse error. With `set content=…` the value is taken literally (no JSON escaping needed), but multi-line source is still painful to quote safely on one command line. Avoid both traps: pass the file with `set content=file://<path>` or `create/update --file <path>` and the CLI handles the encoding.
* **`update` needs `name`, even for a content-only change.** A body without `name`, or with an empty one, is refused with `422` and nothing is saved. Build the body from `scripts get <id>`, or change only the content with `set content=file://<path>`. Since celigo-cli 2026.10.2, an API error whose message doesn't name the field it refused prints the field after it (see [`scripts update`](#celigo-scripts-update)).
* **Writing script `content` requires `full` mode.** `create`, `update`, and `delete` are full-mode-only, and `set` may only touch `content` in `full` mode (`operate` mode limits `set` to `debugUntil`; `read` mode blocks all writes). A rejected write reports the required mode. Since celigo-cli 2026.10.1, raising a profile's mode needs a person at a terminal: `celigo config set mode full` asks for the new mode to be typed back (see [config](https://developer.celigo.com/cli/commands/config.md)), or use a full-mode [profile](https://developer.celigo.com/cli/commands/profile.md).
* **The debug toggles and `delete-debug-logs` are operational.** They run in `operate` mode; since celigo-cli 2026.10.1 `read` mode refuses them before any request. `debug-logs` works in `read` mode.
* **AFE 2.0 uses the `record.` prefix** (`record.customerId`). AFE 1.0 uses bare `customerId` / `data.customerId`. New scripts should always be AFE 2.0.
* **`console.log` appears in the script's execution log**, not your terminal — inspect it with `scripts debug-logs <id>`. Only `console.debug` output needs a debug window (`enable-debug`); the other levels are recorded on every real run.
* **Sandboxed V8, not Node.js.** No `Buffer`, `require`, `fetch`, or outbound network. Use `sjcl` for base64, `dayjs` for dates.
* **`preSavePage` is an export-only hook.** Attaching it to an import silently produces no logs.
* **No `scripts test` subcommand.** Run the script inside a flow via `flows test-run`.

## Related

* [flows](https://developer.celigo.com/cli/commands/flows.md) — where scripts are referenced via `_scriptId`.
* [exports](https://developer.celigo.com/cli/commands/exports.md), [imports](https://developer.celigo.com/cli/commands/imports.md) — resources that attach scripts at specific hook points.
* [audit](https://developer.celigo.com/cli/commands/audit.md) — per-script change history.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://developer.celigo.com/cli/commands/scripts.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
