commit_slx
Commit a tested script to a workspace Git repo as an SLX, creating a task runbook or SLI with configurable script sources and scheduling.
Instructions
Commit a tested script as an SLX to the workspace Git repo.
Skills:
runwhen-skill://build-runwhen-task (authoring workflow)
runwhen-skill://discover-secrets (secret_vars mapping)
runwhen-skill://discover-locations (location selection)
runwhen-skill://configure-hierarchy (hierarchy/resource_path)
Creates a new SLX with the script as a Task (runbook) and/or SLI. The script should already be tested via run_script or run_script_and_wait.
This writes slx.yaml + runbook.yaml (for tasks) or slx.yaml + sli.yaml (for SLIs) to the workspace repository.
Script-source parameter matrix (provide exactly one task variant; SLI variants mirror the names):
Variant | Best for | Mode |
script | Small scripts <~5KB, readable | any |
script_base64 | Any size; safe JSON escaping | any |
script_gzip_base64 | >5KB; 3-5x denser than b64 | any |
script_path | Local file, raw text | stdio only |
script_base64_path | Local file with base64 blob | stdio only |
For very large scripts (combined task+SLI >~50KB) prefer publishing as a registry codebundle and using deploy_registry_codebundle.
To commit BOTH a task AND an SLI on the same SLX:
Custom SLI script (preferred): set task_type="task" and provide a separate lightweight sli_script that emits ONE float between 0 and 1 (e.g. failing_pods / total_pods). The SLI script MUST be its own small probe — DO NOT duplicate the task body. The server rejects identical task+SLI content.
Cron-scheduler SLI: set task_type="task" and provide cron_schedule with a cron expression (e.g. "0 */2 * * *"). The SLI will trigger the task's runbook on that schedule. No sli_script needed.
Output contracts (the two scripts are NOT interchangeable):
Task (interpreter, task_type='task'): returns/writes a List[Dict] of issues with keys 'issue title', 'issue description', 'issue severity' (1-4), 'issue next steps'.
SLI (sli_interpreter, implied task_type='sli'): returns/writes ONE float between 0 and 1.
Script-content footguns:
Bash scripts must NOT include
main "$@"at the bottom. The runner sources the script and invokesmain()itself with FD 3 wired to a run_output.json file. A trailingmain "$@"triggers a preflight invocation with FD 3 read-only, producing misleading "Bad file descriptor" errors. Just definemain()and stop there.secret_varsentries are injected at runtime as env vars whose VALUE is a FILE PATH on the runner — not the secret value itself. Tools that read paths natively (kubectl/KUBECONFIG, gcloud/ GOOGLE_APPLICATION_CREDENTIALS) work unchanged. For tokens/passwords the script mustcat "$VAR"(bash) oropen(os.environ["VAR"]).read()(python) to get the actual value.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| data | No | 'logs-bulk', 'config', or 'logs-stacktrace'. | logs-bulk |
| tags | No | Resource tags ({name, value} dicts). | |
| alias | Yes | Human-readable display name (e.g. 'Pod Health Check'). | |
| access | No | 'read-write' or 'read-only'. | read-write |
| branch | No | Git branch to commit to. | main |
| owners | No | Owner emails (defaults to current user). | |
| script | No | The full script source code (not base64). | |
| env_vars | No | Environment variables baked into the SLX config. | |
| location | No | Runner location (use get_workspace_locations). | |
| slx_name | Yes | Short SLX name (lowercase-kebab-case, e.g. 'k8s-pod-health'). | |
| hierarchy | No | Tag names for hierarchical grouping. | |
| image_url | No | Icon URL for the SLX. | |
| statement | Yes | SLX statement (e.g. 'All pods should be running'). | |
| task_type | No | 'task' (runbook) or 'sli' (indicator). | task |
| sli_script | No | Optional SLI script (returns float 0-1). | |
| task_title | No | Human-readable task title. | |
| interpreter | No | 'bash' or 'python'. | bash |
| script_path | No | Local file path for main script. **stdio mode only.** Mutually exclusive with the other script_* params. | |
| secret_vars | No | Secret mappings baked into the SLX config. | |
| runtime_vars | No | Per-run task parameters that the END USER fills in when invoking the committed task (e.g. log queries, time windows, filters). Distinct from env_vars (set once by the task author — cluster, namespace, context) and secret_vars (credentials injected as file paths). Task-only — never valid for SLIs. Each entry requires: name (str), description (str), default (str), validation (dict with type='regex'+'pattern' or type='enum'+'values'). Names must be unique and must not overlap with env_vars or secret_vars. | |
| cron_schedule | No | Cron expression to schedule the task (e.g. '0 */2 * * *'). | |
| resource_path | No | Resource path for search indexing. | |
| script_base64 | No | UTF-8 main script as standard base64. | |
| codebundle_ref | No | Git ref for the codebundle (auto-resolved if omitted). | |
| commit_message | No | Custom commit message. | |
| workspace_name | Yes | The workspace to commit to (e.g. 't-oncall'). | |
| sli_interpreter | No | Interpreter for the SLI script. | |
| sli_script_path | No | Local file path for SLI script. **stdio mode only.** Mutually exclusive with the other sli_script_* params. | |
| interval_seconds | No | For SLIs, how often to run in seconds. | |
| sli_script_base64 | No | UTF-8 SLI script as standard base64. | |
| script_base64_path | No | Local file path to a file containing the base64-encoded main script. **stdio mode only.** | |
| script_gzip_base64 | No | UTF-8 main script as base64(gzip(...)). Best inline option for scripts >5KB — 3-5x denser than 'script_base64'. | |
| sli_interval_seconds | No | How often the SLI runs in seconds. | |
| sli_script_base64_path | No | Local file path to a file containing the base64-encoded SLI script. **stdio mode only.** | |
| sli_script_gzip_base64 | No | UTF-8 SLI script as base64(gzip(...)). Best inline option for SLI scripts that exceed simple-metric size. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |