Metadata-Version: 2.5
Name: scriptit-cli
Version: 0.2.2
Summary: Run and manage your Script.it automations from the terminal, or from a coding agent
Project-URL: Homepage, https://script.it
Project-URL: Source, https://github.com/script-it/cli
Project-URL: Issues, https://github.com/script-it/cli/issues
Project-URL: Changelog, https://github.com/script-it/cli/releases
Author: Script.it
License: 
                                         Apache License
                                   Version 2.0, January 2004
                                http://www.apache.org/licenses/
        
           TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
        
           1. Definitions.
        
              "License" shall mean the terms and conditions for use, reproduction,
              and distribution as defined by Sections 1 through 9 of this document.
        
              "Licensor" shall mean the copyright owner or entity authorized by
              the copyright owner that is granting the License.
        
              "Legal Entity" shall mean the union of the acting entity and all
              other entities that control, are controlled by, or are under common
              control with that entity. For the purposes of this definition,
              "control" means (i) the power, direct or indirect, to cause the
              direction or management of such entity, whether by contract or
              otherwise, or (ii) ownership of fifty percent (50%) or more of the
              outstanding shares, or (iii) beneficial ownership of such entity.
        
              "You" (or "Your") shall mean an individual or Legal Entity
              exercising permissions granted by this License.
        
              "Source" form shall mean the preferred form for making modifications,
              including but not limited to software source code, documentation
              source, and configuration files.
        
              "Object" form shall mean any form resulting from mechanical
              transformation or translation of a Source form, including but
              not limited to compiled object code, generated documentation,
              and conversions to other media types.
        
              "Work" shall mean the work of authorship, whether in Source or
              Object form, made available under the License, as indicated by a
              copyright notice that is included in or attached to the work
              (an example is provided in the Appendix below).
        
              "Derivative Works" shall mean any work, whether in Source or Object
              form, that is based on (or derived from) the Work and for which the
              editorial revisions, annotations, elaborations, or other modifications
              represent, as a whole, an original work of authorship. For the purposes
              of this License, Derivative Works shall not include works that remain
              separable from, or merely link (or bind by name) to the interfaces of,
              the Work and Derivative Works thereof.
        
              "Contribution" shall mean any work of authorship, including
              the original version of the Work and any modifications or additions
              to that Work or Derivative Works thereof, that is intentionally
              submitted to Licensor for inclusion in the Work by the copyright owner
              or by an individual or Legal Entity authorized to submit on behalf of
              the copyright owner. For the purposes of this definition, "submitted"
              means any form of electronic, verbal, or written communication sent
              to the Licensor or its representatives, including but not limited to
              communication on electronic mailing lists, source code control systems,
              and issue tracking systems that are managed by, or on behalf of, the
              Licensor for the purpose of discussing and improving the Work, but
              excluding communication that is conspicuously marked or otherwise
              designated in writing by the copyright owner as "Not a Contribution."
        
              "Contributor" shall mean Licensor and any individual or Legal Entity
              on behalf of whom a Contribution has been received by Licensor and
              subsequently incorporated within the Work.
        
           2. Grant of Copyright License. Subject to the terms and conditions of
              this License, each Contributor hereby grants to You a perpetual,
              worldwide, non-exclusive, no-charge, royalty-free, irrevocable
              copyright license to reproduce, prepare Derivative Works of,
              publicly display, publicly perform, sublicense, and distribute the
              Work and such Derivative Works in Source or Object form.
        
           3. Grant of Patent License. Subject to the terms and conditions of
              this License, each Contributor hereby grants to You a perpetual,
              worldwide, non-exclusive, no-charge, royalty-free, irrevocable
              (except as stated in this section) patent license to make, have made,
              use, offer to sell, sell, import, and otherwise transfer the Work,
              where such license applies only to those patent claims licensable
              by such Contributor that are necessarily infringed by their
              Contribution(s) alone or by combination of their Contribution(s)
              with the Work to which such Contribution(s) was submitted. If You
              institute patent litigation against any entity (including a
              cross-claim or counterclaim in a lawsuit) alleging that the Work
              or a Contribution incorporated within the Work constitutes direct
              or contributory patent infringement, then any patent licenses
              granted to You under this License for that Work shall terminate
              as of the date such litigation is filed.
        
           4. Redistribution. You may reproduce and distribute copies of the
              Work or Derivative Works thereof in any medium, with or without
              modifications, and in Source or Object form, provided that You
              meet the following conditions:
        
              (a) You must give any other recipients of the Work or
                  Derivative Works a copy of this License; and
        
              (b) You must cause any modified files to carry prominent notices
                  stating that You changed the files; and
        
              (c) You must retain, in the Source form of any Derivative Works
                  that You distribute, all copyright, patent, trademark, and
                  attribution notices from the Source form of the Work,
                  excluding those notices that do not pertain to any part of
                  the Derivative Works; and
        
              (d) If the Work includes a "NOTICE" text file as part of its
                  distribution, then any Derivative Works that You distribute must
                  include a readable copy of the attribution notices contained
                  within such NOTICE file, excluding those notices that do not
                  pertain to any part of the Derivative Works, in at least one
                  of the following places: within a NOTICE text file distributed
                  as part of the Derivative Works; within the Source form or
                  documentation, if provided along with the Derivative Works; or,
                  within a display generated by the Derivative Works, if and
                  wherever such third-party notices normally appear. The contents
                  of the NOTICE file are for informational purposes only and
                  do not modify the License. You may add Your own attribution
                  notices within Derivative Works that You distribute, alongside
                  or as an addendum to the NOTICE text from the Work, provided
                  that such additional attribution notices cannot be construed
                  as modifying the License.
        
              You may add Your own copyright statement to Your modifications and
              may provide additional or different license terms and conditions
              for use, reproduction, or distribution of Your modifications, or
              for any such Derivative Works as a whole, provided Your use,
              reproduction, and distribution of the Work otherwise complies with
              the conditions stated in this License.
        
           5. Submission of Contributions. Unless You explicitly state otherwise,
              any Contribution intentionally submitted for inclusion in the Work
              by You to the Licensor shall be under the terms and conditions of
              this License, without any additional terms or conditions.
              Notwithstanding the above, nothing herein shall supersede or modify
              the terms of any separate license agreement you may have executed
              with Licensor regarding such Contributions.
        
           6. Trademarks. This License does not grant permission to use the trade
              names, trademarks, service marks, or product names of the Licensor,
              except as required for reasonable and customary use in describing the
              origin of the Work and reproducing the content of the NOTICE file.
        
           7. Disclaimer of Warranty. Unless required by applicable law or
              agreed to in writing, Licensor provides the Work (and each
              Contributor provides its Contributions) on an "AS IS" BASIS,
              WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
              implied, including, without limitation, any warranties or conditions
              of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
              PARTICULAR PURPOSE. You are solely responsible for determining the
              appropriateness of using or redistributing the Work and assume any
              risks associated with Your exercise of permissions under this License.
        
           8. Limitation of Liability. In no event and under no legal theory,
              whether in tort (including negligence), contract, or otherwise,
              unless required by applicable law (such as deliberate and grossly
              negligent acts) or agreed to in writing, shall any Contributor be
              liable to You for damages, including any direct, indirect, special,
              incidental, or consequential damages of any character arising as a
              result of this License or out of the use or inability to use the
              Work (including but not limited to damages for loss of goodwill,
              work stoppage, computer failure or malfunction, or any and all
              other commercial damages or losses), even if such Contributor
              has been advised of the possibility of such damages.
        
           9. Accepting Warranty or Additional Liability. While redistributing
              the Work or Derivative Works thereof, You may choose to offer,
              and charge a fee for, acceptance of support, warranty, indemnity,
              or other liability obligations and/or rights consistent with this
              License. However, in accepting such obligations, You may act only
              on Your own behalf and on Your sole responsibility, not on behalf
              of any other Contributor, and only if You agree to indemnify,
              defend, and hold each Contributor harmless for any liability
              incurred by, or claims asserted against, such Contributor by reason
              of your accepting any such warranty or additional liability.
        
           END OF TERMS AND CONDITIONS
        
           APPENDIX: How to apply the Apache License to your work.
        
              To apply the Apache License to your work, attach the following
              boilerplate notice, with the fields enclosed by brackets "[]"
              replaced with your own identifying information. (Don't include
              the brackets!)  The text should be enclosed in the appropriate
              comment syntax for the file format. We also recommend that a
              file or class name and description of purpose be included on the
              same "printed page" as the copyright notice for easier
              identification within third-party archives.
        
           Copyright [yyyy] [name of copyright owner]
        
           Licensed under the Apache License, Version 2.0 (the "License");
           you may not use this file except in compliance with the License.
           You may obtain a copy of the License at
        
               http://www.apache.org/licenses/LICENSE-2.0
        
           Unless required by applicable law or agreed to in writing, software
           distributed under the License is distributed on an "AS IS" BASIS,
           WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
           See the License for the specific language governing permissions and
           limitations under the License.
License-File: LICENSE
Keywords: agents,automation,cli,scriptit
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Requires-Python: >=3.9
Requires-Dist: filelock>=3.12
Requires-Dist: fire>=0.5
Requires-Dist: packaging>=23.0
Requires-Dist: requests>=2.28
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == 'dev'
Requires-Dist: ruff>=0.6; extra == 'dev'
Description-Content-Type: text/markdown

# <img src="assets/logo.png" alt="" height="30" align="top"> Script.it

<!-- PyPI badges are held back until the package is published; shields.io
     renders "package or version not found" for an unpublished name.
[![PyPI](https://img.shields.io/pypi/v/scriptit-cli.svg)](https://pypi.org/project/scriptit-cli/)
[![Python](https://img.shields.io/pypi/pyversions/scriptit-cli.svg)](https://pypi.org/project/scriptit-cli/)
-->
[![CI](https://github.com/script-it/cli/actions/workflows/ci.yml/badge.svg)](https://github.com/script-it/cli/actions/workflows/ci.yml)
[![Python](https://img.shields.io/badge/python-3.9%2B-blue.svg)](pyproject.toml)
[![License](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](LICENSE)

<img src="assets/squiggle.png" alt="" width="100%">

Your [Script.it](https://script.it) workspace, from the terminal — and from any
coding agent.

Script.it turns a knowledge-work task into a script you can read, edit and
depend on: describe what you want, connect the apps it needs, then run it on
demand, on a schedule, or from a webhook. Your scripts run in an isolated cloud
environment with your integrations already connected.

This CLI drives that environment from your machine.

## Using this with a coding agent?

Give the agent the bundled [Script.it skill](agent-skills/scriptit/SKILL.md)
first. It tells the agent how to authenticate, create a session, fetch its live
instructions, and use every client-side command without copying product rules
that can go stale.

Install the CLI and skill using the steps below, then tell the agent: **Use
Script.it.**

## Install

**Before you start.** Python 3.9 or newer, and a Script.it account — create one
at [script.it](https://script.it), or point the CLI at a self-hosted deployment
with `--api-url`.

**1. Install the CLI.** It goes in its own isolated environment, so its
dependencies never mix with a project's:

```bash
uv tool install git+https://github.com/script-it/cli.git
```

Installing from git while the package is pre-release; a `pip install
scriptit-cli` will replace this once it is published.

<details>
<summary>Other installers</summary>

```bash
# pipx — same isolation as uv tool
pipx install git+https://github.com/script-it/cli.git

# plain pip, into whatever environment is active
pip install git+https://github.com/script-it/cli.git
```

Prefer `uv tool` or `pipx`: they keep the CLI and its dependencies out of
whatever environment happens to be active.

No `uv`? `curl -LsSf https://astral.sh/uv/install.sh | sh`, or use `pipx`.
</details>

**2. Check it landed.**

```bash
scriptit version
```

**3. Sign in.** This opens your browser on an approval page: check it shows the
same short code the CLI printed, approve, and the CLI finishes on its own. Your
password never reaches the CLI — it stores a refresh token, plus the
short-lived token it trades that for, at `~/.config/scriptit/credentials.json`
(mode 0600):

```bash
scriptit auth login
```

The browser never has to reach the machine the CLI runs on, so the same
command works over SSH, in a container or in a hosted agent's terminal: where
no window can open, open the printed link wherever you're signed in. The link
carries nothing anyone else can sign in with, so it is safe to pass through a
chat, and if the command is interrupted before you approve, running it again
resumes the same link. When a coding agent runs this, the CLI prints the URL
instead of opening a window — the agent's browser is not the one that would
have opened. `--no-browser` forces that anywhere. For an on-prem deployment,
add `--api-url https://<your-deployment>` — the CLI reads the auth mode from it
and switches to a device-code flow by itself.

**4. See what you have, then run one.** `skills list` is the index of your
scripts (alongside the platform's own skills); `start` takes a bare name from
it and resolves it across your workspaces:

```bash
scriptit skills list
scriptit start <name-from-that-list>
```

**5. Set up your coding agent.**

Install the entry-point skill once, and any agent that reads skills knows how
to drive your workspace.

In Claude Code, install it as a plugin — this repository is its marketplace:

```
/plugin marketplace add script-it/cli
/plugin install scriptit@script-it
```

`claude plugin update scriptit@script-it` brings it up to date, or turn on
auto-update for the `script-it` marketplace under `/plugin`.

Codex installs the same plugin from the same marketplace:

```bash
codex plugin marketplace add script-it/cli
codex plugin add scriptit@script-it
```

Any other host that reads skills from a folder takes the file directly:

```bash
mkdir -p ~/.claude/skills/scriptit
curl -sSL https://raw.githubusercontent.com/script-it/cli/main/agent-skills/scriptit/SKILL.md \
  -o ~/.claude/skills/scriptit/SKILL.md
```

A host that reads only an `AGENTS.md` takes the file's contents pasted there.
[Use it from a coding agent](#use-it-from-a-coding-agent) explains what the
skill does and why it stays this small.

### Keeping it current, and removing it

```bash
uv tool upgrade scriptit-cli
uv tool uninstall scriptit-cli
```

Logging out forgets the stored credential without uninstalling anything:

```bash
scriptit auth logout
```

## Why you might want it

- **Work on your automations with a coding agent.** Point Claude Code, Codex or
  Cursor at your Script.it workspace and let it read, write and run your
  scripts. That is what this CLI was built for — see
  [Use it from a coding agent](#use-it-from-a-coding-agent).
- **Stay in the terminal.** Run a script, tail its logs, check a trigger, move a
  file, without switching to the browser.
- **Let an agent show you its work, not just describe it.**
  `scriptit auth browser-url --next <path>` prints a one-time link that opens
  straight to a script or run in the app, already signed in. An agent with a
  browser you can see opens it there itself — so when it finishes something you
  watch the block tree and its outputs come up instead of reading a paragraph
  about them. The link lends this machine's login, lives 60 seconds and works
  once; you get an email whenever one is used from somewhere new.
- **Script your scripts.** The commands this client answers speak `--json`, so
  you can wire Script.it into whatever you already automate with.

## How it works

The CLI is a thin remote client. Commands you type run **in your Script.it
environment**, not on your machine:

```
scriptit (your machine)
  │  Bearer <token>                     (scriptit auth login)
  ▼
Script.it  ──►  your isolated environment  ──►  your script, your integrations
```

Nothing automation-related runs locally. No scripts execute on your machine, and
your integration credentials are never copied to it. Everything you run lands in
a real session you can watch live in the Script.it app — the same view your
teammates see.

## Connect

[Install](#install) covers signing in. Beyond that, keep several accounts or
deployments side by side as named profiles:

```bash
scriptit auth login --api-url https://scriptit.internal.example --profile work
scriptit auth use work
scriptit auth status
```

## Use

```bash
scriptit start weekly-report          # run a script
scriptit logs <run-id>                # ...and read what it did
scriptit trigger list                 # what fires it, and when
scriptit integrations list            # what it can reach
scriptit describe --concepts          # the full platform reference
scriptit describe --system            # agent-ready runtime context
```

Run any shell command in your environment:

```bash
scriptit exec -- ls /workspaces
scriptit exec --timeout 300 -- pytest -q
scriptit exec --cwd /workspaces/<workspace-id> -- ls
```

`--timeout` is enforced **where the command runs**, so it exits `124` there
rather than outliving a client that stopped waiting.

Move files both ways:

```bash
scriptit exec -- ls /workspaces/<workspace-id>
scriptit fs push ./report.csv /workspaces/<workspace-id>/assets/report.csv
scriptit fs pull /workspaces/<workspace-id>/logs/run.log .
scriptit fs read data_files/report/output.html
```

A relative remote path starts where `exec` runs, in the session's directory,
so a path that works in `exec` names the same file in `fs`.

### Sessions

Every command runs inside a **session** — the same kind of conversation the
in-app agent works in, and you can watch it live in the app. A session is
sticky: it persists across commands and across shells until you start another.

```bash
scriptit session current              # which session am I on, and why
scriptit session new                  # start a fresh one
scriptit context                      # fetch this session's agent instructions
scriptit session use ses_abc123       # reattach to an earlier one
scriptit session list                 # recent sessions
```

The session has its own directory, and that directory is the working directory
for every command you run. Your workspaces are mounted inside it, so a script at
`/workspaces/<wid>/my-script` is also `workspaces/<wid>/my-script` from where
commands land. It is a mount, not a copy — anything you change is immediately
visible in the app and to every other session. `data_files/` is the session's
own scratch space.

To run one command in a different session without disturbing the sticky one:

```bash
SCRIPTIT_SESSION=ses_abc123 scriptit exec -- ls
```

That is also how an agent harness gives each task its own transcript.

### Machine-readable output

Add `--json` to any of `auth`, `context`, `fs`, `session`, `sandbox` or
`version`.
**stdout becomes exactly one JSON document, and everything else — progress,
prompts, warnings, errors — goes to stderr**, so you can pipe stdout straight
into a parser:

```bash
scriptit sandbox status --json | jq -r '.sandboxes[].state'
scriptit context --json | jq -r '.skills'
```

On failure the document is `{"error": "..."}` and the exit code is non-zero —
including when the argument parser is the thing that rejected the command, so
there is no case where stdout comes back empty.

`auth login --json` still opens a browser and prints its progress, but to
stderr; the document it returns is the resulting login. `fs read` is the one
exception: it writes the file's bytes unmodified, so `--json` is accepted and
ignored rather than promising a document it will not produce. `exec` likewise
streams the command's own output. Forwarded commands pass `--json` through to
Script.it, which decides what it means.

### Which commands are which

This client answers `auth`, `context`, `exec`, `fs`, `session`, `sandbox` and
`version` itself. **Everything else is forwarded** — `start`, `status`, `logs`,
`wait`, `validate`, `describe`, `trigger *`, `integrations *`, `skills *`, … —
and answered by Script.it.

That is deliberate: the platform stays the single source of behavior, so a
feature added there works through the client you already have. No upgrade
needed, and no command list here to fall out of date.

`scriptit --help` covers the local commands; `scriptit describe --concepts`
covers the structured platform reference, and `scriptit describe --system`
renders that runtime knowledge for agent context.

## Use it from a coding agent

One file — [`agent-skills/scriptit/`](agent-skills/scriptit/SKILL.md) — installed
into the agent host once, as the Claude Code or Codex plugin or as a plain
skill file;
[Set up your coding agent](#set-up-your-coding-agent) above has the commands.

The skill carries almost no platform knowledge on purpose. It creates a fresh
session, then runs `scriptit context` to fetch one complete live bundle of
runtime guidance, product behavior, external-agent workflow, authoritative app
links, connected integrations, and current skills. The workstation client only
transports and prints that bundle, so agent behavior is updated with the
platform instead of being copied into each CLI release.

## Good to know

- **Sessions run one command at a time.** A second command queues rather than
  interleaving; the client waits for you.
- **Paused environments wake automatically.** Any command resumes yours and
  waits until it is ready, so there is nothing to start by hand.
- **V2 output is read in full, in pages.** Commands stay readable in the app,
  and their actual exit codes reach your terminal. The saved transcript preview
  can be shorter than the output returned to the CLI. Older v1 environments use
  a separate compatibility path that recovers output beyond their SSE text cap.
- **V2 event connections can reconnect.** The client resumes from its last
  event cursor without submitting the command again. Missing output or an
  unconfirmed result is reported as an error, never success.
- **No interactive shell.** Commands are dispatched fire-and-forget and their
  lifecycle is observed through an event stream, with no channel for stdin — so
  `scriptit exec -- vim` cannot work. Use one-shot commands, or the app.
- **Update notices, not auto-update.** The client checks at most once a day, in
  the background, and prints one line to stderr when a newer release exists.
  `SCRIPTIT_NO_UPDATE_CHECK=1` silences it.
- **Anonymous usage analytics, opt-out.** Command names and exit codes, never
  their contents or arguments. `DO_NOT_TRACK=1` turns it off.

### Exit codes

| Code | Meaning |
|---|---|
| the command's own | forwarded verbatim, exactly as it exited |
| `2` | not connected — run `scriptit auth login` |
| `124` | `--timeout` expired; the command was stopped |
| `125` | it ran, but its status could not be recovered. **Not success.** |
| `130` | you interrupted the client; the command may still be running |

## Environment variables

| Variable | What it does |
|---|---|
| `SCRIPTIT_PROFILE` | use a named profile for one invocation |
| `SCRIPTIT_SESSION` | run in a named session for one invocation |
| `SCRIPTIT_CLIENT` | label the session with the agent driving it (`claude-code`, `codex`, …) |
| `XDG_CONFIG_HOME` | where credentials and state live (default `~/.config`) |

## Contributing

Issues and pull requests are welcome — see [CONTRIBUTING.md](CONTRIBUTING.md)
for setup and the one architectural rule this repo keeps.

## Security

Found a vulnerability? Please report it privately through GitHub's
[**Report a vulnerability**](https://github.com/script-it/cli/security/advisories/new)
form rather than opening an issue — see [SECURITY.md](SECURITY.md).

## License

[Apache-2.0](LICENSE)
