export_script
Exports a local script file into Customaise after validating syntax, AST, and security. Returns fix diagnostics if invalid, or updates an existing script via scriptId.
Instructions
Export a script from a local file into Customaise. The file will be validated through Customaise's sanitization pipeline (syntax checking, AST validation, security analysis). If valid, the script is installed and ready to execute on matching pages. If invalid, detailed diagnostics explain exactly what to fix. Pass scriptId to update an existing script instead of creating a new one. Pass expectedCodeHash from import_script to reject stale edits. Save progress includes an operation ID and stage. A timeout may leave the outcome unknown: query get_bridge_status with the scriptId and operationId from the error before retrying. The extension enforces a 90-second save deadline and cancels work that has not reached persistence. A storage write already submitted cannot be recalled; its commit receipt resolves that uncertainty. NOTE: You cannot overwrite a shared/subscribed script — they are read-only. If you need to edit a shared script, first call import_script with fork:true (creates an editable independent copy), then export to that copy's scriptId.
Reminder for UserScripts: Must use an IIFE with named functions for symbol-level editing, `// @namespace https://customaise.com`, and standard directives (@name, @match, @grant).
Reminder for AgentScripts: MUST use `// ==AgentScript==` block, MUST explicitly declare tools via `// @webmcp <toolName> <permission>` (e.g. `// @webmcp my_tool prompt`). Permissions: allow (autonomous), prompt (interactive), deny (blocked). Prefer `prompt`: in a script you write, `allow` resolves as `prompt` regardless. Must NOT use IIFEs. CAN use GM_* APIs for persistence, networking, and observability alongside `navigator.modelContext.registerTool()`.Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| filePath | Yes | Local file path containing the userscript source code | |
| scriptId | No | ID of an existing script to update. Omit to create a new script. | |
| expectedCodeHash | No | SHA-256 from import_script. Reject the save if the installed source has changed since that read. |