Scripts and Versioning API
Last validated: 2026-05-14
This page covers script lifecycle APIs:
- Script metadata CRUD
- Draft save/compile/test
- Publish and rollback
- Version inspection and code retrieval
1) Script Metadata APIs
| RPC | HTTP annotation | Status | Primary use case |
|---|---|---|---|
CreateScript | POST /v1/scriptum/scripts | Implemented | Create a new script shell (optionally from template) |
ListScripts | GET /v1/scriptum/scripts | Partial | Browse scripts by tag/label filters |
GetScript | GET /v1/scriptum/scripts/{name} | Implemented | Fetch script metadata + active version summary |
DeleteScript | DELETE /v1/scriptum/scripts/{name} | Implemented | Remove script and all related data |
CreateScript arguments and behavior
Request fields:
name(required): tenant-unique script identifier.description: human-readable purpose.tags[]: free-form categorization for filtering.from_template: template ID to bootstrap draft content.labels[]: structured key-to-values metadata.env{}: initial per-script env overlay map.
Use cases:
- Start an empty script and author draft manually.
- Bootstrap from a trusted template and customize.
- Attach ownership labels for ops and governance.
Behavior notes:
- When
from_templateis provided, runtime creates the script and seeds draft DSL from the template. - Initial
envmap becomes script overlay state.
ListScripts arguments and behavior
Request fields:
page_size,page_tokentags[]: all listed tags must match.labels[]: any matching key/value pair passes.
Behavior notes:
- Filtering works.
- Pagination token progression is currently limited (partial status).
2) Draft and Version APIs
| RPC | HTTP annotation | Status | Primary use case |
|---|---|---|---|
SaveScriptDraft | POST /v1/scriptum/scripts/{name}/draft | Implemented | Save mutable draft source |
CompileScriptDraft | POST /v1/scriptum/scripts/{name}/draft/compile | Implemented | Validate/compile draft and produce AST+IR |
TestScriptDraft | POST /v1/scriptum/scripts/{name}/draft/test | Implemented | Execute draft as version 0 thread |
PublishScriptDraft | POST /v1/scriptum/scripts/{name}/draft/publish | Implemented | Promote compiled draft to immutable active version |
RollbackScript | POST /v1/scriptum/scripts/{name}/rollback | Implemented | Revert active pointer to earlier version |
ListScriptVersions | GET /v1/scriptum/scripts/{name}/versions | Partial | Enumerate versions and status timeline |
GetScriptVersion | GET /v1/scriptum/scripts/{name}/versions/{version} | Implemented | Inspect one immutable version |
GetScriptCode | GET /v1/scriptum/scripts/{name}/code[...] | Implemented | Read DSL/YAML for a version or draft |
GetDraftInfo | GET /v1/scriptum/scripts/{name}/draft | Implemented | Get draft content/status/errors/tools |
SaveScriptDraft
Request fields:
name(required)dsl_contentoryaml_content
Use cases:
- Save
.scriptumsource while authoring. - Upload pre-compiled YAML IR (advanced pipelines).
CompileScriptDraft
Request fields:
name(required)
Response highlights:
success,errordiagnostics[]: line, column, severity, hint, source linetools_required[]ast_json,ir_yaml
Use cases:
- CI compile gate before publishing.
- Tool dependency validation (
tools_required). - AST/IR debugging and generation pipelines.
TestScriptDraft
Request fields:
nameinput_json: execution input payload as JSON stringload_env: include merged env resolution
Use cases:
- Fast iteration without publishing.
- Integration checks on draft changes.
PublishScriptDraft
Request fields:
name
Response:
version: newly published immutable version number.
Use cases:
- Promote known-good draft to production.
- Release automation after compile/test pass.
RollbackScript
Request fields:
nametarget_version
Rules:
target_version=0means rollback to previous superseded version.
Use cases:
- Rapid recovery from production regressions.
- Controlled revert in incident runbook.
GetScriptCode
Request fields:
nameversion
Rules:
version=0returns current draft code.
Use cases:
- Build source browser UI.
- Verify exactly what version was executed.
3) End-to-End Examples
gRPC lifecycle example
# 1) Create script
grpcurl \
-H "authorization: Bearer $DODIL_TOKEN" \
-H "x-organization-id: $SCRIPTUM_ORG_ID" \
-d '{"name":"invoice-parser","description":"Parse invoices","tags":["invoice","etl"]}' \
rpc.dev.dodil.io:443 dodil.scriptum.v1.ScriptumService/CreateScript
# 2) Save draft
grpcurl \
-H "authorization: Bearer $DODIL_TOKEN" \
-H "x-organization-id: $SCRIPTUM_ORG_ID" \
-d '{"name":"invoice-parser","dsl_content":"script invoice-parser { ... }"}' \
rpc.dev.dodil.io:443 dodil.scriptum.v1.ScriptumService/SaveScriptDraft
# 3) Compile
grpcurl \
-H "authorization: Bearer $DODIL_TOKEN" \
-H "x-organization-id: $SCRIPTUM_ORG_ID" \
-d '{"name":"invoice-parser"}' \
rpc.dev.dodil.io:443 dodil.scriptum.v1.ScriptumService/CompileScriptDraft
# 4) Publish
grpcurl \
-H "authorization: Bearer $DODIL_TOKEN" \
-H "x-organization-id: $SCRIPTUM_ORG_ID" \
-d '{"name":"invoice-parser"}' \
rpc.dev.dodil.io:443 dodil.scriptum.v1.ScriptumService/PublishScriptDraftHTTP contract example (gateway deployment)
# Compile draft
curl -sS -X POST "https://api.dev.dodil.io:443/v1/scriptum/scripts/invoice-parser/draft/compile" \
-H "Authorization: Bearer $DODIL_TOKEN" \
-H "x-organization-id: $SCRIPTUM_ORG_ID" \
-H "Content-Type: application/json" \
-d '{}'4) Client Guardrails
- Always compile before publish.
- Parse and surface
diagnostics[]to users; avoid hiding compile detail. - Prefer explicit version pinning (
GetScriptVersion, threadversion) for reproducibility. - Treat rollback and delete as audited operations with change ticket metadata.