turbosnail 0.0.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,54 @@
1
+ name: ci
2
+
3
+ on:
4
+ pull_request:
5
+ push:
6
+ branches:
7
+ - main
8
+
9
+ permissions:
10
+ contents: read
11
+
12
+ concurrency:
13
+ group: ${{ github.workflow }}-${{ github.ref }}
14
+ cancel-in-progress: true
15
+
16
+ jobs:
17
+ test:
18
+ runs-on: ubuntu-latest
19
+ strategy:
20
+ fail-fast: false
21
+ matrix:
22
+ python-version: ["3.11", "3.12", "3.13"]
23
+ env:
24
+ UV_PYTHON: ${{ matrix.python-version }}
25
+ UV_PYTHON_DOWNLOADS: never
26
+ steps:
27
+ - uses: actions/checkout@v6
28
+ - uses: actions/setup-python@v6
29
+ with:
30
+ python-version: ${{ matrix.python-version }}
31
+ - name: Install uv
32
+ run: python -m pip install uv==0.11.32
33
+ - name: Sync
34
+ run: uv sync --locked
35
+ - name: Lint
36
+ run: uv run --no-sync ruff check .
37
+ - name: Format check
38
+ run: uv run --no-sync ruff format --check .
39
+ - name: Test
40
+ run: uv run --no-sync pytest -q
41
+ - name: Build
42
+ run: uv build
43
+ - name: Check distributions
44
+ run: uv run --no-sync twine check dist/*
45
+
46
+ no_comments:
47
+ runs-on: ubuntu-latest
48
+ steps:
49
+ - uses: actions/checkout@v6
50
+ - name: Reject comments in source and config files
51
+ run: |
52
+ if git grep -nE '(^|[[:space:]])#' -- '*.py' '*.toml' '*.yml' '.gitignore'; then
53
+ exit 1
54
+ fi
@@ -0,0 +1,55 @@
1
+ name: release
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - "v*"
7
+
8
+ permissions:
9
+ contents: read
10
+
11
+ jobs:
12
+ build:
13
+ runs-on: ubuntu-latest
14
+ env:
15
+ UV_PYTHON: "3.13"
16
+ UV_PYTHON_DOWNLOADS: never
17
+ steps:
18
+ - uses: actions/checkout@v6
19
+ - uses: actions/setup-python@v6
20
+ with:
21
+ python-version: "3.13"
22
+ - name: Install uv
23
+ run: python -m pip install uv==0.11.32
24
+ - name: Sync
25
+ run: uv sync --locked
26
+ - name: Build
27
+ run: uv build
28
+ - name: Check distributions
29
+ run: uv run --no-sync twine check dist/*
30
+ - name: Verify tag matches package version
31
+ if: github.ref_type == 'tag'
32
+ run: |
33
+ version="$(uv run --no-sync python -c "import turbosnail; print(turbosnail.__version__)")"
34
+ if [ "${version}" != "${GITHUB_REF_NAME#v}" ]; then
35
+ echo "Tag ${GITHUB_REF_NAME} does not match package version ${version}"
36
+ exit 1
37
+ fi
38
+ - uses: actions/upload-artifact@v7
39
+ with:
40
+ name: dist
41
+ path: dist/
42
+
43
+ publish_pypi:
44
+ needs: build
45
+ if: github.event_name == 'push' && github.ref_type == 'tag'
46
+ runs-on: ubuntu-latest
47
+ environment: pypi
48
+ permissions:
49
+ id-token: write
50
+ steps:
51
+ - uses: actions/download-artifact@v8
52
+ with:
53
+ name: dist
54
+ path: dist/
55
+ - uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,9 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ *.egg-info/
4
+ dist/
5
+ build/
6
+ .venv/
7
+ .pytest_cache/
8
+ .ruff_cache/
9
+ .DS_Store
@@ -0,0 +1,24 @@
1
+ # AGENTS.md
2
+
3
+ This is the single agent instruction file for this repository. Do not add AGENTS.md files to subdirectories.
4
+
5
+ ## Where things are
6
+
7
+ - `README.md`: usage and development commands.
8
+ - `src/turbosnail/`: the package.
9
+ - `tests/`: tests.
10
+ - `.github/workflows/`: CI and release.
11
+
12
+ ## Rules
13
+
14
+ - No comments in any file type. Docstrings may describe how something works, never why.
15
+ - Runtime dependencies are `takumai` and the standard library only.
16
+ - turbosnail depends on takumai. takumai never depends on turbosnail.
17
+ - Do not leave ticket ids or design notes in code or in the repository.
18
+ - Before opening a PR, run `uv run ruff check .`, `uv run ruff format --check .`, and `uv run pytest`.
19
+ - Dependencies are managed with uv. Run `uv lock` and commit `uv.lock` whenever `pyproject.toml` dependencies change.
20
+
21
+ ## Releasing
22
+
23
+ - Bump `__version__` in `src/turbosnail/__init__.py`, merge, then tag `vX.Y.Z`.
24
+ - The release workflow publishes to PyPI via trusted publishing.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 kobuilt
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,85 @@
1
+ Metadata-Version: 2.5
2
+ Name: turbosnail
3
+ Version: 0.0.1
4
+ Summary: Runtime for takumai packs
5
+ Author: kobuilt
6
+ License-Expression: MIT
7
+ License-File: LICENSE
8
+ Keywords: agents,harness,runtime,takumai
9
+ Classifier: Development Status :: 2 - Pre-Alpha
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Programming Language :: Python :: 3.11
12
+ Classifier: Programming Language :: Python :: 3.12
13
+ Classifier: Programming Language :: Python :: 3.13
14
+ Classifier: Typing :: Typed
15
+ Requires-Python: >=3.11
16
+ Requires-Dist: takumai>=0.0.1
17
+ Description-Content-Type: text/markdown
18
+
19
+ # turbosnail
20
+
21
+ turbosnail is the runtime for [takumai](https://pypi.org/project/takumai/) packs. takumai defines a pack. turbosnail runs it.
22
+
23
+ ## Status
24
+
25
+ Pre-alpha (0.0.1).
26
+
27
+ ## Install
28
+
29
+ turbosnail is published on PyPI. Install the command with uv:
30
+
31
+ ```sh
32
+ uv tool install turbosnail
33
+ ```
34
+
35
+ To run it once without installing, use `uvx`:
36
+
37
+ ```sh
38
+ uvx turbosnail plan path/to/pack
39
+ ```
40
+
41
+ To use turbosnail as a library in a project, add it with uv:
42
+
43
+ ```sh
44
+ uv add turbosnail
45
+ ```
46
+
47
+ Requires Python 3.11 or newer.
48
+
49
+ ## Usage
50
+
51
+ `turbosnail plan PATH` reads a takumai pack and prints its blueprints in execution order:
52
+
53
+ ```sh
54
+ turbosnail plan examples/devops
55
+ ```
56
+
57
+ ```text
58
+ blueprint infra_change
59
+ 1. scope agentic scoper
60
+ 2. approve gate high
61
+ 3. implement agentic iac_author
62
+ 4. static_checks deterministic checks/static.sh
63
+ 5. verify agentic verifier
64
+ ```
65
+
66
+ `PATH` can be a pack directory or a manifest file. Each node line shows its position, id, kind and detail. The detail is the specialist for agentic nodes, the run script for deterministic nodes, and the risk tier for gate nodes.
67
+
68
+ `plan` executes nothing. It only reads and checks the manifest.
69
+
70
+ Exit codes:
71
+
72
+ - `0`: the plan printed.
73
+ - `1`: the pack has issues. The issues print to stdout.
74
+ - `2`: the manifest could not be loaded. The error prints to stderr.
75
+
76
+ ## Development
77
+
78
+ ```sh
79
+ uv sync
80
+ uv run ruff check . && uv run ruff format --check . && uv run pytest
81
+ ```
82
+
83
+ ## License
84
+
85
+ MIT. See `LICENSE`.
@@ -0,0 +1,67 @@
1
+ # turbosnail
2
+
3
+ turbosnail is the runtime for [takumai](https://pypi.org/project/takumai/) packs. takumai defines a pack. turbosnail runs it.
4
+
5
+ ## Status
6
+
7
+ Pre-alpha (0.0.1).
8
+
9
+ ## Install
10
+
11
+ turbosnail is published on PyPI. Install the command with uv:
12
+
13
+ ```sh
14
+ uv tool install turbosnail
15
+ ```
16
+
17
+ To run it once without installing, use `uvx`:
18
+
19
+ ```sh
20
+ uvx turbosnail plan path/to/pack
21
+ ```
22
+
23
+ To use turbosnail as a library in a project, add it with uv:
24
+
25
+ ```sh
26
+ uv add turbosnail
27
+ ```
28
+
29
+ Requires Python 3.11 or newer.
30
+
31
+ ## Usage
32
+
33
+ `turbosnail plan PATH` reads a takumai pack and prints its blueprints in execution order:
34
+
35
+ ```sh
36
+ turbosnail plan examples/devops
37
+ ```
38
+
39
+ ```text
40
+ blueprint infra_change
41
+ 1. scope agentic scoper
42
+ 2. approve gate high
43
+ 3. implement agentic iac_author
44
+ 4. static_checks deterministic checks/static.sh
45
+ 5. verify agentic verifier
46
+ ```
47
+
48
+ `PATH` can be a pack directory or a manifest file. Each node line shows its position, id, kind and detail. The detail is the specialist for agentic nodes, the run script for deterministic nodes, and the risk tier for gate nodes.
49
+
50
+ `plan` executes nothing. It only reads and checks the manifest.
51
+
52
+ Exit codes:
53
+
54
+ - `0`: the plan printed.
55
+ - `1`: the pack has issues. The issues print to stdout.
56
+ - `2`: the manifest could not be loaded. The error prints to stderr.
57
+
58
+ ## Development
59
+
60
+ ```sh
61
+ uv sync
62
+ uv run ruff check . && uv run ruff format --check . && uv run pytest
63
+ ```
64
+
65
+ ## License
66
+
67
+ MIT. See `LICENSE`.
@@ -0,0 +1,78 @@
1
+ [pack]
2
+ name = "devops"
3
+ version = "0.1.0"
4
+ description = "Infrastructure changes and incident response"
5
+
6
+ [[specialists]]
7
+ name = "scoper"
8
+ role = "reader"
9
+ description = "Turns a ticket into a change plan with a risk tier and write allowlist"
10
+ skills = ["skills/scoping"]
11
+ tools = ["read_file", "search_code"]
12
+ input = "contracts/ticket.json"
13
+ output = "contracts/change_plan.json"
14
+
15
+ [[specialists]]
16
+ name = "iac_author"
17
+ role = "builder"
18
+ description = "Writes infrastructure-as-code changes that satisfy a change plan"
19
+ skills = ["skills/terraform"]
20
+ tools = ["read_file", "write_file", "terraform_validate", "terraform_plan"]
21
+ input = "contracts/change_plan.json"
22
+ output = "contracts/change_set.json"
23
+
24
+ [[specialists]]
25
+ name = "verifier"
26
+ role = "verifier"
27
+ description = "Checks that a change holds after restart and under load"
28
+ skills = ["skills/verification"]
29
+ tools = ["read_file", "run_check"]
30
+ input = "contracts/change_set.json"
31
+ output = "contracts/verdict.json"
32
+
33
+ [[blueprints]]
34
+ name = "infra_change"
35
+
36
+ [[blueprints.nodes]]
37
+ id = "scope"
38
+ kind = "agentic"
39
+ specialist = "scoper"
40
+ next = ["approve"]
41
+
42
+ [[blueprints.nodes]]
43
+ id = "approve"
44
+ kind = "gate"
45
+ tier = "high"
46
+ next = ["implement"]
47
+
48
+ [[blueprints.nodes]]
49
+ id = "implement"
50
+ kind = "agentic"
51
+ specialist = "iac_author"
52
+ next = ["static_checks"]
53
+
54
+ [[blueprints.nodes]]
55
+ id = "static_checks"
56
+ kind = "deterministic"
57
+ run = "checks/static.sh"
58
+ next = ["verify"]
59
+
60
+ [[blueprints.nodes]]
61
+ id = "verify"
62
+ kind = "agentic"
63
+ specialist = "verifier"
64
+
65
+ [policy]
66
+ risk_tiers = ["low", "medium", "high"]
67
+ human_gate_at = "high"
68
+ write_allowlist = ["infra/**"]
69
+
70
+ [scenarios]
71
+ path = "scenarios"
72
+ visible_to = ["verifier"]
73
+
74
+ [verifier]
75
+ checks = ["checks/restart.sh", "checks/soak.sh"]
76
+
77
+ [twin]
78
+ kind = "ephemeral_stack"
@@ -0,0 +1,44 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "turbosnail"
7
+ dynamic = ["version"]
8
+ description = "Runtime for takumai packs"
9
+ readme = "README.md"
10
+ requires-python = ">=3.11"
11
+ license = "MIT"
12
+ authors = [{ name = "kobuilt" }]
13
+ dependencies = ["takumai>=0.0.1"]
14
+ keywords = ["agents", "harness", "runtime", "takumai"]
15
+ classifiers = [
16
+ "Development Status :: 2 - Pre-Alpha",
17
+ "Programming Language :: Python :: 3",
18
+ "Programming Language :: Python :: 3.11",
19
+ "Programming Language :: Python :: 3.12",
20
+ "Programming Language :: Python :: 3.13",
21
+ "Typing :: Typed",
22
+ ]
23
+
24
+ [project.scripts]
25
+ turbosnail = "turbosnail.cli:main"
26
+
27
+ [dependency-groups]
28
+ dev = ["pytest", "ruff", "twine"]
29
+
30
+ [tool.hatch.version]
31
+ path = "src/turbosnail/__init__.py"
32
+
33
+ [tool.hatch.build.targets.wheel]
34
+ packages = ["src/turbosnail"]
35
+
36
+ [tool.ruff]
37
+ line-length = 100
38
+ target-version = "py311"
39
+
40
+ [tool.ruff.lint]
41
+ select = ["E", "F", "I", "B", "UP"]
42
+
43
+ [tool.pytest.ini_options]
44
+ testpaths = ["tests"]
@@ -0,0 +1,5 @@
1
+ from turbosnail.plan import order
2
+
3
+ __version__ = "0.0.1"
4
+
5
+ __all__ = ["__version__", "order"]
@@ -0,0 +1,69 @@
1
+ from __future__ import annotations
2
+
3
+ import argparse
4
+ import sys
5
+ from pathlib import Path
6
+ from typing import Any
7
+
8
+ from takumai import Issue, ManifestError, load, validate
9
+
10
+ from turbosnail import __version__
11
+ from turbosnail.plan import order
12
+
13
+
14
+ def _build_parser() -> argparse.ArgumentParser:
15
+ parser = argparse.ArgumentParser(prog="turbosnail", description="Runtime for takumai packs")
16
+ parser.add_argument("--version", action="version", version=f"turbosnail {__version__}")
17
+ subparsers = parser.add_subparsers(dest="command")
18
+ plan_parser = subparsers.add_parser("plan", help="print the execution plan of a pack")
19
+ plan_parser.add_argument("path", type=Path)
20
+ return parser
21
+
22
+
23
+ def _run_plan(args: argparse.Namespace) -> int:
24
+ path: Path = args.path
25
+ try:
26
+ data = load(path)
27
+ except ManifestError as exc:
28
+ print(exc, file=sys.stderr)
29
+ return 2
30
+ issues = validate(data)
31
+ if issues:
32
+ _print_issues(issues)
33
+ return 1
34
+ for blueprint in data["blueprints"]:
35
+ _print_blueprint(blueprint)
36
+ return 0
37
+
38
+
39
+ def _print_issues(issues: list[Issue]) -> None:
40
+ for issue in issues:
41
+ print(f"{issue.path}: {issue.message}")
42
+ print(f"{len(issues)} issue(s)")
43
+
44
+
45
+ def _print_blueprint(blueprint: dict[str, Any]) -> None:
46
+ print(f"blueprint {blueprint['name']}")
47
+ for index, node in enumerate(order(blueprint), start=1):
48
+ print(f" {index}. {node['id']} {node['kind']} {_detail(node)}")
49
+
50
+
51
+ def _detail(node: dict[str, Any]) -> str:
52
+ if node["kind"] == "agentic":
53
+ return str(node["specialist"])
54
+ if node["kind"] == "deterministic":
55
+ return str(node["run"])
56
+ return str(node["tier"])
57
+
58
+
59
+ def main(argv: list[str] | None = None) -> int:
60
+ parser = _build_parser()
61
+ args = parser.parse_args(argv)
62
+ if args.command != "plan":
63
+ parser.print_help()
64
+ return 2
65
+ return _run_plan(args)
66
+
67
+
68
+ if __name__ == "__main__":
69
+ raise SystemExit(main())
@@ -0,0 +1,20 @@
1
+ from __future__ import annotations
2
+
3
+ from collections import deque
4
+ from typing import Any
5
+
6
+
7
+ def order(blueprint: dict[str, Any]) -> list[dict[str, Any]]:
8
+ by_id = {node["id"]: node for node in blueprint["nodes"]}
9
+ start = blueprint["nodes"][0]["id"]
10
+ seen = {start}
11
+ queue = deque([start])
12
+ ordered: list[dict[str, Any]] = []
13
+ while queue:
14
+ node = by_id[queue.popleft()]
15
+ ordered.append(node)
16
+ for target in node.get("next", []):
17
+ if target not in seen:
18
+ seen.add(target)
19
+ queue.append(target)
20
+ return ordered
File without changes
@@ -0,0 +1,55 @@
1
+ from __future__ import annotations
2
+
3
+ from pathlib import Path
4
+
5
+ import pytest
6
+
7
+ from turbosnail.cli import main
8
+
9
+ ROOT = Path(__file__).resolve().parent.parent
10
+ DEVOPS = ROOT / "examples" / "devops"
11
+
12
+
13
+ def test_plan_example_directory(capsys: pytest.CaptureFixture[str]) -> None:
14
+ assert main(["plan", str(DEVOPS)]) == 0
15
+ output = capsys.readouterr().out
16
+ assert "blueprint infra_change" in output.splitlines()
17
+ assert " 1. scope agentic scoper" in output.splitlines()
18
+ assert " 4. static_checks deterministic checks/static.sh" in output.splitlines()
19
+
20
+
21
+ def test_plan_lists_nodes_in_order(capsys: pytest.CaptureFixture[str]) -> None:
22
+ assert main(["plan", str(DEVOPS)]) == 0
23
+ assert capsys.readouterr().out.splitlines() == [
24
+ "blueprint infra_change",
25
+ " 1. scope agentic scoper",
26
+ " 2. approve gate high",
27
+ " 3. implement agentic iac_author",
28
+ " 4. static_checks deterministic checks/static.sh",
29
+ " 5. verify agentic verifier",
30
+ ]
31
+
32
+
33
+ def test_invalid_manifest_returns_one(tmp_path: Path, capsys: pytest.CaptureFixture[str]) -> None:
34
+ (tmp_path / "pack.toml").write_text('[pack]\nname = "Bad"\n', encoding="utf-8")
35
+ assert main(["plan", str(tmp_path)]) == 1
36
+ output = capsys.readouterr().out
37
+ assert "pack.name" in output
38
+ assert "issue(s)" in output
39
+
40
+
41
+ def test_missing_path_returns_two(tmp_path: Path, capsys: pytest.CaptureFixture[str]) -> None:
42
+ assert main(["plan", str(tmp_path / "absent")]) == 2
43
+ assert "manifest not found" in capsys.readouterr().err
44
+
45
+
46
+ def test_version_flag(capsys: pytest.CaptureFixture[str]) -> None:
47
+ with pytest.raises(SystemExit) as exc:
48
+ main(["--version"])
49
+ assert exc.value.code == 0
50
+ assert "turbosnail 0.0.1" in capsys.readouterr().out
51
+
52
+
53
+ def test_no_subcommand_returns_two(capsys: pytest.CaptureFixture[str]) -> None:
54
+ assert main([]) == 2
55
+ assert "usage" in capsys.readouterr().out
@@ -0,0 +1,48 @@
1
+ from __future__ import annotations
2
+
3
+ from typing import Any
4
+
5
+ from turbosnail import order
6
+
7
+
8
+ def _ids(nodes: list[dict[str, Any]]) -> list[str]:
9
+ return [node["id"] for node in nodes]
10
+
11
+
12
+ def test_linear_chain_keeps_listed_order() -> None:
13
+ blueprint = {
14
+ "nodes": [
15
+ {"id": "a", "kind": "agentic", "next": ["b"]},
16
+ {"id": "b", "kind": "gate", "next": ["c"]},
17
+ {"id": "c", "kind": "deterministic"},
18
+ ]
19
+ }
20
+ assert _ids(order(blueprint)) == ["a", "b", "c"]
21
+
22
+
23
+ def test_branch_visits_each_target_once_breadth_first() -> None:
24
+ blueprint = {
25
+ "nodes": [
26
+ {"id": "a", "kind": "agentic", "next": ["b", "c"]},
27
+ {"id": "b", "kind": "deterministic", "next": ["d"]},
28
+ {"id": "c", "kind": "deterministic", "next": ["d"]},
29
+ {"id": "d", "kind": "agentic"},
30
+ ]
31
+ }
32
+ assert _ids(order(blueprint)) == ["a", "b", "c", "d"]
33
+
34
+
35
+ def test_cycle_back_to_earlier_node_terminates() -> None:
36
+ blueprint = {
37
+ "nodes": [
38
+ {"id": "a", "kind": "agentic", "next": ["b"]},
39
+ {"id": "b", "kind": "deterministic", "next": ["a", "c"]},
40
+ {"id": "c", "kind": "agentic"},
41
+ ]
42
+ }
43
+ assert _ids(order(blueprint)) == ["a", "b", "c"]
44
+
45
+
46
+ def test_returns_the_node_tables() -> None:
47
+ node = {"id": "only", "kind": "agentic", "specialist": "scoper"}
48
+ assert order({"nodes": [node]}) == [node]
@@ -0,0 +1,9 @@
1
+ from __future__ import annotations
2
+
3
+ import re
4
+
5
+ import turbosnail
6
+
7
+
8
+ def test_version_is_semver() -> None:
9
+ assert re.fullmatch(r"\d+\.\d+\.\d+", turbosnail.__version__)