sandboxa 0.1.0__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,12 @@
1
+ [bumpversion]
2
+ current_version = 0.1.0
3
+ tag = True
4
+ commit = True
5
+
6
+ [bumpversion:file:VERSION]
7
+
8
+ [bumpversion:file:pyproject.toml]
9
+
10
+ [bumpversion:file:sandboxa/__init__.py]
11
+ search = VERSION = "{current_version}"
12
+ replace = VERSION = "{new_version}"
sandboxa-0.1.0/.flake8 ADDED
@@ -0,0 +1,2 @@
1
+ [flake8]
2
+ max-line-length = 88
@@ -0,0 +1,3 @@
1
+ .*.sw[op]
2
+ __pycache__/
3
+ /session-ses_*.md
@@ -0,0 +1,54 @@
1
+ image: debian:trixie-slim
2
+ variables:
3
+ PIPX_BIN_DIR: /usr/local/bin
4
+
5
+ stages:
6
+ - lint
7
+ - test
8
+ - build
9
+ - smoke
10
+
11
+ default:
12
+ before_script:
13
+ - apt-get update
14
+ - apt-get install --yes --no-install-recommends ca-certificates just pipx python3 python3-build python3-flake8 python3-hatchling python3-pip python3-venv
15
+ - pipx install --global hatch
16
+
17
+ lint:
18
+ stage: lint
19
+ script:
20
+ - just lint
21
+
22
+ test:
23
+ stage: test
24
+ script:
25
+ - just test
26
+
27
+ build:
28
+ stage: build
29
+ script:
30
+ - just build
31
+ artifacts:
32
+ paths:
33
+ - dist/*.whl
34
+ - dist/*.tar.gz
35
+ expire_in: 1 week
36
+
37
+ build-tagged:
38
+ extends: build
39
+ rules:
40
+ - if: $CI_COMMIT_TAG
41
+ artifacts:
42
+ paths:
43
+ - dist/*.whl
44
+ - dist/*.tar.gz
45
+ expire_in: never
46
+
47
+ smoke:
48
+ stage: smoke
49
+ needs:
50
+ - job: build
51
+ artifacts: true
52
+ script:
53
+ - python3 -m pip install --break-system-packages dist/*.whl
54
+ - sandboxa --version
@@ -0,0 +1,10 @@
1
+ allow_settings:
2
+ - opencode
3
+
4
+ extra_data_paths: []
5
+
6
+ excluded_paths:
7
+ - build/
8
+ - secrets/
9
+
10
+ refuse_if_exists: .profile
@@ -0,0 +1,26 @@
1
+ # AGENTS
2
+
3
+ ## Repository shape
4
+ - This repo is a tiny single-package utility: main logic is in `sandboxa/__main__.py`.
5
+ - User config is read from `~/.config/sandboxa.yaml`; project-local config is read from `.sandboxa.yaml` (or `--config-file` override).
6
+
7
+ ## Core behavior to preserve
8
+ - `sandboxa` launches `systemd-run --user --pty` with strict isolation (`ProtectHome=tmpfs`, `PrivateTmp=true`, `PrivateDevices=true`).
9
+ - It binds the chosen project path and optional `--extra-data-path` mounts; OpenCode state/config/cache paths are additionally bound only when `allow_settings` includes `opencode` in project-local `.sandboxa.yaml`.
10
+ - It refuses to run if `"$PROJECT_PATH/.profile"` exists; keep this guard unless intentionally changing the safety model.
11
+
12
+ ## Invocation and env contract
13
+ - Default command is `opencode`; override with first positional `RUN_COMMAND`.
14
+ - Target directory is set with `--project-path` (defaults to current working directory).
15
+ - Extra bind mounts are passed via repeated `--extra-data-path` options (or `extra_data_paths` in project-local YAML).
16
+ - Exclusions are passed via repeated `--excluded-path` options (or `excluded_paths` in project-local YAML); absolute/out-of-project entries fail, and non-existing paths are ignored.
17
+ - YAML config supports `allow_settings`, `extra_data_paths`, `excluded_paths`, and `refuse_if_exists`; project YAML overrides user YAML except `allow_settings` and `excluded_paths` which are merged; CLI args take precedence over YAML values.
18
+ - `--config-file` accepts an absolute path or a project-relative filename.
19
+ - `--no-reconnect` skip reusing an existing session (e.g. OpenCode) for the project directory
20
+ - Use `--dry-run` to print the generated `systemd-run` command without executing.
21
+
22
+ ## Practical verification
23
+ - Run `just lint` after edits.
24
+ - Ensure `ruamel.yaml` and `pydantic` are installed before smoke tests.
25
+ - Run `just test` for core behavior coverage.
26
+ - Smoke test with `python3 -m sandboxa bash --project-path . -- -lc "echo smoke-ok"` to confirm argument handling and launch path.
@@ -0,0 +1,37 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+
9
+ ## ## [0.1.0] - 2026-06-02
10
+
11
+ ### Added
12
+ - Python launcher script `sandboxa` to run commands in a restricted `systemd-run --user --pty` sandbox.
13
+ - YAML configuration support via `.sandboxa.yaml`.
14
+ - User-level configuration support from `~/.config/sandboxa.yaml`.
15
+ - CLI options for project path, extra bind paths, excluded paths, reconnect control, and dry-run output.
16
+ - `allow_settings` templates for `opencode`, `podman`, `ssh`, and `vim`.
17
+ - SSH support that allows `~/.ssh`, optionally binds `SSH_AUTH_SOCK`, and forwards `SSH_AUTH_SOCK` into the sandbox environment.
18
+ - Reconnect support for OpenCode sessions in the same project directory.
19
+ - Test suite under `tests/` with `unittest`.
20
+ - `just` targets for formatting, linting, and tests.
21
+ - Flake8 configuration compatible with Black line wrapping.
22
+ - `--version` output.
23
+ - Simple release workflow via `just release patch|minor|major`.
24
+ - `VERSION` file and `bumpversion` configuration for synchronized version bumps.
25
+ - `LICENSE` file with GNU GPL v3 text.
26
+ - Python package metadata for pip installation using Hatch.
27
+ - CI workflow for GitLab
28
+
29
+ ### Security
30
+ - Restricted `vim` template to `~/.vimrc` only (no `~/.vim` bind).
31
+ - Excluded paths are validated to reject absolute/out-of-project entries.
32
+ - Excluded paths that do not exist are ignored to avoid `systemd-run` failures.
33
+ - Home-like project directories are refused by marker check (`.profile` by default).
34
+
35
+ ### Changed
36
+ - Project license changed to GNU GPL v3 or later (`GPL-3.0-or-later`).
37
+ - Added SPDX license headers to Python source files.
@@ -0,0 +1,7 @@
1
+ # Release workflow
2
+
3
+ 1. Update `CHANGELOG.md` by moving relevant entries from `Unreleased` into a
4
+ new version section.
5
+ 1. Run the *just* target "release" with a version part, e.g. `just release minor`
6
+ 1. Push commit and tags manually: `git push && git push --tags`
7
+ 1. Upload to [pypi](https://pypi.org/): `just publish`