rc-shepherd 0.6.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.
- rc_shepherd-0.6.1/.github/ISSUE_TEMPLATE/bug_report.yml +37 -0
- rc_shepherd-0.6.1/.github/ISSUE_TEMPLATE/config.yml +8 -0
- rc_shepherd-0.6.1/.github/ISSUE_TEMPLATE/feature_request.yml +15 -0
- rc_shepherd-0.6.1/.github/dependabot.yml +9 -0
- rc_shepherd-0.6.1/.github/pull_request_template.md +8 -0
- rc_shepherd-0.6.1/.github/workflows/ci.yml +79 -0
- rc_shepherd-0.6.1/.github/workflows/codeql.yml +31 -0
- rc_shepherd-0.6.1/.github/workflows/release.yml +68 -0
- rc_shepherd-0.6.1/.gitignore +9 -0
- rc_shepherd-0.6.1/CHANGELOG.md +59 -0
- rc_shepherd-0.6.1/CONTRIBUTING.md +25 -0
- rc_shepherd-0.6.1/LICENSE +21 -0
- rc_shepherd-0.6.1/PKG-INFO +225 -0
- rc_shepherd-0.6.1/README.md +194 -0
- rc_shepherd-0.6.1/SECURITY.md +17 -0
- rc_shepherd-0.6.1/install.sh +218 -0
- rc_shepherd-0.6.1/pyproject.toml +71 -0
- rc_shepherd-0.6.1/src/rc_shepherd/__init__.py +3 -0
- rc_shepherd-0.6.1/src/rc_shepherd/__main__.py +5 -0
- rc_shepherd-0.6.1/src/rc_shepherd/cli.py +313 -0
- rc_shepherd-0.6.1/src/rc_shepherd/completion.py +109 -0
- rc_shepherd-0.6.1/src/rc_shepherd/config.example.toml +88 -0
- rc_shepherd-0.6.1/src/rc_shepherd/config.py +387 -0
- rc_shepherd-0.6.1/src/rc_shepherd/discovery.py +155 -0
- rc_shepherd-0.6.1/src/rc_shepherd/doctor.py +128 -0
- rc_shepherd-0.6.1/src/rc_shepherd/procscan.py +104 -0
- rc_shepherd-0.6.1/src/rc_shepherd/projects_edit.py +69 -0
- rc_shepherd-0.6.1/src/rc_shepherd/service.py +141 -0
- rc_shepherd-0.6.1/src/rc_shepherd/supervisor.py +442 -0
- rc_shepherd-0.6.1/src/rc_shepherd/units.py +47 -0
- rc_shepherd-0.6.1/tests/conftest.py +162 -0
- rc_shepherd-0.6.1/tests/test_cli.py +297 -0
- rc_shepherd-0.6.1/tests/test_completion.py +57 -0
- rc_shepherd-0.6.1/tests/test_config.py +214 -0
- rc_shepherd-0.6.1/tests/test_discovery.py +278 -0
- rc_shepherd-0.6.1/tests/test_install_script.py +225 -0
- rc_shepherd-0.6.1/tests/test_projects_edit.py +49 -0
- rc_shepherd-0.6.1/tests/test_service_doctor.py +277 -0
- rc_shepherd-0.6.1/tests/test_supervisor.py +450 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
name: Bug report
|
|
2
|
+
description: Something does not work as documented.
|
|
3
|
+
labels: [bug]
|
|
4
|
+
body:
|
|
5
|
+
- type: markdown
|
|
6
|
+
attributes:
|
|
7
|
+
value: |
|
|
8
|
+
Thanks for the report. Please remove any Remote Control link, session id or token from logs before posting.
|
|
9
|
+
For a security issue, use **Security → Report a vulnerability** instead of an issue.
|
|
10
|
+
- type: textarea
|
|
11
|
+
id: what
|
|
12
|
+
attributes:
|
|
13
|
+
label: What happened, and what did you expect?
|
|
14
|
+
validations:
|
|
15
|
+
required: true
|
|
16
|
+
- type: textarea
|
|
17
|
+
id: steps
|
|
18
|
+
attributes:
|
|
19
|
+
label: Steps to reproduce
|
|
20
|
+
placeholder: "1. ...\n2. ..."
|
|
21
|
+
- type: textarea
|
|
22
|
+
id: doctor
|
|
23
|
+
attributes:
|
|
24
|
+
label: Output of `rc-shepherd doctor` and `rc-shepherd status`
|
|
25
|
+
render: text
|
|
26
|
+
- type: textarea
|
|
27
|
+
id: logs
|
|
28
|
+
attributes:
|
|
29
|
+
label: Relevant lines from `rc-shepherd service logs`
|
|
30
|
+
render: text
|
|
31
|
+
- type: input
|
|
32
|
+
id: versions
|
|
33
|
+
attributes:
|
|
34
|
+
label: Versions
|
|
35
|
+
placeholder: "rc-shepherd 0.6.0, Claude Code 2.1.334, Ubuntu 24.04"
|
|
36
|
+
validations:
|
|
37
|
+
required: true
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
blank_issues_enabled: true
|
|
2
|
+
contact_links:
|
|
3
|
+
- name: Security vulnerability
|
|
4
|
+
url: https://github.com/herbalizer404/rc-shepherd/security/advisories/new
|
|
5
|
+
about: Report it privately, not in a public issue.
|
|
6
|
+
- name: Claude Code itself
|
|
7
|
+
url: https://github.com/anthropics/claude-code/issues
|
|
8
|
+
about: Problems with `claude remote-control` itself (not with rc-shepherd) belong there.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
name: Feature request
|
|
2
|
+
description: Suggest an improvement.
|
|
3
|
+
labels: [enhancement]
|
|
4
|
+
body:
|
|
5
|
+
- type: textarea
|
|
6
|
+
id: problem
|
|
7
|
+
attributes:
|
|
8
|
+
label: What are you trying to do?
|
|
9
|
+
description: The situation or problem, before any solution.
|
|
10
|
+
validations:
|
|
11
|
+
required: true
|
|
12
|
+
- type: textarea
|
|
13
|
+
id: idea
|
|
14
|
+
attributes:
|
|
15
|
+
label: What would help?
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
## What and why
|
|
2
|
+
|
|
3
|
+
## Checks
|
|
4
|
+
|
|
5
|
+
- [ ] `ruff check src tests`
|
|
6
|
+
- [ ] `coverage run -m pytest && coverage report` (100% lines and branches)
|
|
7
|
+
- [ ] `CHANGELOG.md` updated for user-visible changes
|
|
8
|
+
- [ ] No secrets, personal paths or Remote Control links in code, tests or logs
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
workflow_call:
|
|
8
|
+
|
|
9
|
+
permissions:
|
|
10
|
+
contents: read
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
test:
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
strategy:
|
|
16
|
+
fail-fast: false
|
|
17
|
+
matrix:
|
|
18
|
+
python: ["3.11", "3.12", "3.13", "3.14"]
|
|
19
|
+
steps:
|
|
20
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
21
|
+
- uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
|
|
22
|
+
with:
|
|
23
|
+
python-version: ${{ matrix.python }}
|
|
24
|
+
- run: pip install -e '.[dev]'
|
|
25
|
+
- run: ruff check src tests
|
|
26
|
+
- run: coverage run -m pytest
|
|
27
|
+
env:
|
|
28
|
+
PYTHONSAFEPATH: "1"
|
|
29
|
+
- run: coverage report
|
|
30
|
+
|
|
31
|
+
install:
|
|
32
|
+
runs-on: ubuntu-latest
|
|
33
|
+
steps:
|
|
34
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
35
|
+
- uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
|
|
36
|
+
with:
|
|
37
|
+
python-version: "3.13"
|
|
38
|
+
- run: shellcheck --shell=sh install.sh
|
|
39
|
+
- run: sudo apt-get update -q && sudo apt-get install -y -q kcov dash
|
|
40
|
+
- run: pip install pytest uv -e .
|
|
41
|
+
# Every install.sh run happens under kcov; a second pass runs the same tests under dash.
|
|
42
|
+
- run: mkdir -p coverage && python -m pytest tests/test_install_script.py
|
|
43
|
+
env:
|
|
44
|
+
RC_SHEPHERD_INTEGRATION: "1"
|
|
45
|
+
INSTALL_SH_RUNNER: >-
|
|
46
|
+
kcov --include-path=${{ github.workspace }}/install.sh ${{ github.workspace }}/coverage/install-sh
|
|
47
|
+
- name: install.sh line coverage must stay at 100%
|
|
48
|
+
shell: python
|
|
49
|
+
run: |
|
|
50
|
+
import glob, sys, xml.etree.ElementTree as ET
|
|
51
|
+
report = ET.parse(glob.glob("coverage/install-sh/install.sh.*/cov.xml")[0]).getroot()
|
|
52
|
+
classes = [c for c in report.iter("class") if c.get("filename", "").endswith("/install.sh")]
|
|
53
|
+
missed = [line.get("number") for c in classes for line in c.iter("line") if line.get("hits") == "0"]
|
|
54
|
+
print(f"install.sh measured: {bool(classes)}, missed lines: {missed or 'none'}")
|
|
55
|
+
sys.exit(1 if missed or not classes else 0)
|
|
56
|
+
- run: python -m pytest tests/test_install_script.py
|
|
57
|
+
env:
|
|
58
|
+
RC_SHEPHERD_INTEGRATION: "1"
|
|
59
|
+
|
|
60
|
+
security:
|
|
61
|
+
runs-on: ubuntu-latest
|
|
62
|
+
steps:
|
|
63
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
64
|
+
with:
|
|
65
|
+
fetch-depth: 0
|
|
66
|
+
- name: gitleaks (full history)
|
|
67
|
+
env:
|
|
68
|
+
GITLEAKS_VERSION: 8.24.3
|
|
69
|
+
run: |
|
|
70
|
+
base="https://github.com/gitleaks/gitleaks/releases/download/v${GITLEAKS_VERSION}"
|
|
71
|
+
archive="gitleaks_${GITLEAKS_VERSION}_linux_x64.tar.gz"
|
|
72
|
+
curl -sSfLO "$base/$archive"
|
|
73
|
+
curl -sSfL "$base/gitleaks_${GITLEAKS_VERSION}_checksums.txt" | grep " $archive\$" | sha256sum -c -
|
|
74
|
+
tar xzf "$archive" gitleaks
|
|
75
|
+
./gitleaks git --redact --verbose --exit-code 1 .
|
|
76
|
+
- uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
|
|
77
|
+
with:
|
|
78
|
+
python-version: "3.13"
|
|
79
|
+
- run: pip install pip-audit && pip install -e '.[dev]' && pip-audit --skip-editable
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
name: CodeQL
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
schedule:
|
|
8
|
+
- cron: "27 4 * * 1"
|
|
9
|
+
|
|
10
|
+
permissions:
|
|
11
|
+
contents: read
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
analyze:
|
|
15
|
+
# Code scanning is free on public repositories only.
|
|
16
|
+
if: ${{ !github.event.repository.private }}
|
|
17
|
+
runs-on: ubuntu-latest
|
|
18
|
+
permissions:
|
|
19
|
+
contents: read
|
|
20
|
+
security-events: write
|
|
21
|
+
strategy:
|
|
22
|
+
fail-fast: false
|
|
23
|
+
matrix:
|
|
24
|
+
language: [python, actions]
|
|
25
|
+
steps:
|
|
26
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
27
|
+
- uses: github/codeql-action/init@915412ff23e8b7659517e607487dbeae018f2934 # v4.39.5
|
|
28
|
+
with:
|
|
29
|
+
languages: ${{ matrix.language }}
|
|
30
|
+
queries: security-extended
|
|
31
|
+
- uses: github/codeql-action/analyze@915412ff23e8b7659517e607487dbeae018f2934 # v4.39.5
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags: ["v*"]
|
|
6
|
+
|
|
7
|
+
permissions:
|
|
8
|
+
contents: read
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
ci:
|
|
12
|
+
uses: ./.github/workflows/ci.yml
|
|
13
|
+
|
|
14
|
+
build:
|
|
15
|
+
needs: ci
|
|
16
|
+
runs-on: ubuntu-latest
|
|
17
|
+
steps:
|
|
18
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
19
|
+
- uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
|
|
20
|
+
with:
|
|
21
|
+
python-version: "3.13"
|
|
22
|
+
- name: the tag matches the package version
|
|
23
|
+
run: |
|
|
24
|
+
version=$(sed -n 's/^__version__ = "\(.*\)"$/\1/p' src/rc_shepherd/__init__.py)
|
|
25
|
+
[ "v$version" = "$GITHUB_REF_NAME" ] || { echo "tag $GITHUB_REF_NAME does not match version $version"; exit 1; }
|
|
26
|
+
- run: pip install build twine && python -m build && twine check --strict dist/*
|
|
27
|
+
- run: cd dist && sha256sum -- * > SHA256SUMS && cat SHA256SUMS
|
|
28
|
+
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
|
29
|
+
with:
|
|
30
|
+
name: dist
|
|
31
|
+
path: dist/
|
|
32
|
+
|
|
33
|
+
github-release:
|
|
34
|
+
needs: build
|
|
35
|
+
runs-on: ubuntu-latest
|
|
36
|
+
permissions:
|
|
37
|
+
contents: write
|
|
38
|
+
steps:
|
|
39
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
40
|
+
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
|
|
41
|
+
with:
|
|
42
|
+
name: dist
|
|
43
|
+
path: dist/
|
|
44
|
+
- name: release notes from the changelog
|
|
45
|
+
run: |
|
|
46
|
+
awk -v head="## ${GITHUB_REF_NAME#v}" '$0 == head {found = 1; next} /^## / && found {exit} found' \
|
|
47
|
+
CHANGELOG.md > notes.md
|
|
48
|
+
[ -s notes.md ] || { echo "no CHANGELOG.md section for ${GITHUB_REF_NAME#v}"; exit 1; }
|
|
49
|
+
- run: gh release create "$GITHUB_REF_NAME" dist/* install.sh --verify-tag --title "rc-shepherd ${GITHUB_REF_NAME#v}" --notes-file notes.md
|
|
50
|
+
env:
|
|
51
|
+
GH_TOKEN: ${{ github.token }}
|
|
52
|
+
|
|
53
|
+
# Trusted publishing: set the repository variable PYPI_PUBLISH to "true" once the PyPI
|
|
54
|
+
# project has this workflow (release.yml, environment "pypi") as its trusted publisher.
|
|
55
|
+
pypi:
|
|
56
|
+
needs: build
|
|
57
|
+
if: vars.PYPI_PUBLISH == 'true'
|
|
58
|
+
runs-on: ubuntu-latest
|
|
59
|
+
environment: pypi
|
|
60
|
+
permissions:
|
|
61
|
+
id-token: write
|
|
62
|
+
steps:
|
|
63
|
+
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
|
|
64
|
+
with:
|
|
65
|
+
name: dist
|
|
66
|
+
path: dist/
|
|
67
|
+
- run: rm dist/SHA256SUMS
|
|
68
|
+
- uses: pypa/gh-action-pypi-publish@7245906fb61fa33a13554f9d5fb856fe61758086 # v1.14.3
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.6.1
|
|
4
|
+
|
|
5
|
+
- Published on PyPI: `pipx install rc-shepherd` or `uv tool install rc-shepherd`.
|
|
6
|
+
- README: clearer introduction, badges, and absolute links so that it renders on PyPI; PyPI metadata (project links, classifiers); issue and pull request templates.
|
|
7
|
+
|
|
8
|
+
## 0.6.0
|
|
9
|
+
|
|
10
|
+
- Claude Code updates: a server restarts on the new version once its sessions are idle (no running command, no transcript change for `idle_after`, default 30 minutes). Before, it waited for a server without sessions, which never happens: every server keeps a session open in its folder.
|
|
11
|
+
- `service logs` shows only rc-shepherd's own lines; `--all` adds what the sessions' programs log (`sudo`, `docker`…). New units log as `rc-shepherd`.
|
|
12
|
+
|
|
13
|
+
## 0.5.3
|
|
14
|
+
|
|
15
|
+
- A root folder (such as `~/projects`) is served like any project when Claude Code trusts it and it has sessions; the option that controlled it in 0.5.0 to 0.5.2 is gone.
|
|
16
|
+
|
|
17
|
+
## 0.5.2
|
|
18
|
+
|
|
19
|
+
- The home folder is never served, and `list` says why: Claude Code never saves the trust of the home folder, so `claude remote-control` refuses to run there. 0.5.1 wrongly documented that it would be served. For sessions not tied to one project, use a trusted folder such as `~/hub`.
|
|
20
|
+
|
|
21
|
+
## 0.5.1
|
|
22
|
+
|
|
23
|
+
- Tried to serve the home folder by default (see 0.5.2).
|
|
24
|
+
|
|
25
|
+
## 0.5.0
|
|
26
|
+
|
|
27
|
+
- Discovery follows Claude Code by default: every trusted project with sessions anywhere in the home folder is served (`roots = ["~"]`, `depth = 0` for any depth). `roots` and `depth` are now optional filters; folders inside hidden ones (such as `.claude/worktrees`) are never served. **Behaviour change**: with the default settings, projects outside `~/projects` or deeper than one level are now served too; set `roots = ["~/projects"]` and `depth = 1` to keep the previous behaviour.
|
|
28
|
+
- With the default `depth = 0`, roots are no longer walked every minute: only Claude's own project list is read.
|
|
29
|
+
|
|
30
|
+
## 0.4.1
|
|
31
|
+
|
|
32
|
+
- `install.sh` always reinstalls: running it again, or with `--ref`, now installs that commit even when the version number did not change (pip kept the installed copy).
|
|
33
|
+
|
|
34
|
+
## 0.4.0
|
|
35
|
+
|
|
36
|
+
- `install.sh`: one-line install (`curl ... | sh`) into a dedicated virtual environment, with upgrade, `--uninstall` and `--purge`; installs bash completion and offers to install or restart the service.
|
|
37
|
+
- Missing or expired Claude login: detected from the server output, reported in `status` and `doctor`, retried at the longest delay, and `on_failure` runs at once (`{reason}` is `login`).
|
|
38
|
+
- Claude Code updates: servers still on the previous version are flagged in `status` and `doctor`; with `restart_on_update = "idle"` (default) each one restarts on the new version once it has no session.
|
|
39
|
+
- `service uninstall --purge [--yes]` also removes the configuration and the runtime state.
|
|
40
|
+
- `completion bash|zsh` prints a shell completion script (project names for `restart`).
|
|
41
|
+
- Tagged releases on GitHub (wheel, sdist, `SHA256SUMS`, `install.sh`), ready for PyPI trusted publishing.
|
|
42
|
+
- Security: the state folder must be a private folder owned by you (without `XDG_RUNTIME_DIR` it is now `/tmp/rc-shepherd-<uid>`, one level only), the CLI only signals a live rc-shepherd pid, `%` and `$` are escaped in the systemd unit, bash completion never expands project names, and `install.sh` does nothing if its download is cut short. CodeQL and `SECURITY.md` added.
|
|
43
|
+
|
|
44
|
+
## 0.3.0
|
|
45
|
+
|
|
46
|
+
- Project named rc-shepherd (command, package, service, config and state paths); not affiliated with Anthropic.
|
|
47
|
+
|
|
48
|
+
## 0.2.0
|
|
49
|
+
|
|
50
|
+
- Package with an `rc-shepherd` entry point (no runtime dependencies).
|
|
51
|
+
- Configuration: discovery modes (`auto` / `list`), several roots and depth, allow/deny globs, recent activity filter, `max_servers`, per-project options (`permission_mode`, `spawn`, `capacity`, `settings`, `chrome`, `name_template`, `extra_args`, `env`), memory guard, `on_failure` hook, JSON logs.
|
|
52
|
+
- `bypassPermissions` requires `allow_bypass = true`.
|
|
53
|
+
- Hot reload with `reload`; option changes apply on the next restart, or immediately with `reload --apply`.
|
|
54
|
+
- New commands: `enable`, `disable`, `config show|check|init`, `doctor`, `service install|uninstall|status|logs`, `restart --all`, `run --dry-run`, `--json` output.
|
|
55
|
+
- An invalid configuration exits with code 78 so systemd does not restart in a loop.
|
|
56
|
+
|
|
57
|
+
## 0.1.0
|
|
58
|
+
|
|
59
|
+
- First supervisor: one `claude remote-control` per project with Claude sessions, restart with backoff, manual servers left alone.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Contributing
|
|
2
|
+
|
|
3
|
+
- Keep the runtime free of third-party dependencies (standard library only, Python 3.11+).
|
|
4
|
+
- Every change comes with tests; coverage must stay at 100% of lines and branches.
|
|
5
|
+
- Tests must never start a real `claude` process: use the fake executable from `tests/conftest.py`.
|
|
6
|
+
- `install.sh` is POSIX sh (it runs under dash with `curl | sh`) and must pass `shellcheck --shell=sh`.
|
|
7
|
+
- Run before opening a pull request:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
.venv/bin/ruff check src tests
|
|
11
|
+
PYTHONSAFEPATH=1 .venv/bin/coverage run -m pytest && .venv/bin/coverage report
|
|
12
|
+
RC_SHEPHERD_INTEGRATION=1 .venv/bin/pytest tests/test_install_script.py
|
|
13
|
+
# install.sh line coverage (must stay at 100%, checked in CI):
|
|
14
|
+
mkdir -p coverage && INSTALL_SH_RUNNER="kcov --include-path=$PWD/install.sh $PWD/coverage/install-sh" \
|
|
15
|
+
RC_SHEPHERD_INTEGRATION=1 .venv/bin/pytest tests/test_install_script.py
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
- Do not commit secrets, personal paths or logs containing session URLs.
|
|
19
|
+
|
|
20
|
+
## Releases
|
|
21
|
+
|
|
22
|
+
1. Set `__version__` in `src/rc_shepherd/__init__.py` and add its `## X.Y.Z` section to `CHANGELOG.md`.
|
|
23
|
+
2. Tag and push: `git tag -a vX.Y.Z -m "rc-shepherd X.Y.Z" && git push origin vX.Y.Z`.
|
|
24
|
+
3. `release.yml` runs the CI, checks that the tag matches the version, builds the wheel and sdist, and publishes a GitHub release with `SHA256SUMS`, `install.sh` and the changelog section.
|
|
25
|
+
4. PyPI (optional): once the PyPI project trusts `release.yml` (environment `pypi`), set the repository variable `PYPI_PUBLISH=true`; later tags are uploaded with trusted publishing, no token stored.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 rc-shepherd contributors
|
|
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,225 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: rc-shepherd
|
|
3
|
+
Version: 0.6.1
|
|
4
|
+
Summary: Keep Claude Code Remote Control servers running for your projects (unofficial), so you can pick them up from the Claude app at any time.
|
|
5
|
+
Project-URL: Homepage, https://github.com/herbalizer404/rc-shepherd
|
|
6
|
+
Project-URL: Changelog, https://github.com/herbalizer404/rc-shepherd/blob/main/CHANGELOG.md
|
|
7
|
+
Project-URL: Issues, https://github.com/herbalizer404/rc-shepherd/issues
|
|
8
|
+
Project-URL: Security, https://github.com/herbalizer404/rc-shepherd/security/policy
|
|
9
|
+
License-Expression: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: claude,claude-code,remote-control,self-hosted,supervisor,systemd
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Environment :: Console
|
|
14
|
+
Classifier: Environment :: No Input/Output (Daemon)
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
23
|
+
Classifier: Topic :: Software Development
|
|
24
|
+
Classifier: Topic :: System :: Monitoring
|
|
25
|
+
Requires-Python: >=3.11
|
|
26
|
+
Provides-Extra: dev
|
|
27
|
+
Requires-Dist: coverage>=7.5; extra == 'dev'
|
|
28
|
+
Requires-Dist: pytest>=8; extra == 'dev'
|
|
29
|
+
Requires-Dist: ruff>=0.6; extra == 'dev'
|
|
30
|
+
Description-Content-Type: text/markdown
|
|
31
|
+
|
|
32
|
+
# rc-shepherd
|
|
33
|
+
|
|
34
|
+
**Keep your Claude Code projects one tap away on your phone.** rc-shepherd keeps a [Remote Control](https://code.claude.com/docs/en/remote-control) server running for every project you work on, so you can start or resume sessions from the Claude mobile app, Claude desktop or claude.ai/code at any time, without SSH-ing into the machine to type `claude rc` in tmux.
|
|
35
|
+
|
|
36
|
+
[](https://github.com/herbalizer404/rc-shepherd/actions/workflows/ci.yml)
|
|
37
|
+
[](https://github.com/herbalizer404/rc-shepherd/releases)
|
|
38
|
+

|
|
39
|
+

|
|
40
|
+

|
|
41
|
+
[](https://github.com/herbalizer404/rc-shepherd/blob/main/LICENSE)
|
|
42
|
+
|
|
43
|
+
> **Unofficial.** rc-shepherd is an independent community project. It is not affiliated with, endorsed by or supported by Anthropic. It runs the official, unmodified Claude Code CLI; "Claude" and "Claude Code" are trademarks of Anthropic.
|
|
44
|
+
|
|
45
|
+
It is meant for people who work on their own headless Linux machines (a home server, a VPS, a workstation you reach over SSH). One small supervisor, a single systemd user service with no dependencies, follows Claude Code itself: every project you trusted and used with `claude` gets its own `claude remote-control` server, kept alive across crashes, reboots, logouts and Claude Code updates.
|
|
46
|
+
|
|
47
|
+
- **Zero setup per project**: open a folder with `claude` once, and it shows up in the app within a minute.
|
|
48
|
+
- **Self-healing**: crashed servers restart with backoff; an expired login is reported instead of retried every few seconds.
|
|
49
|
+
- **Update-aware**: after a Claude Code update, each server moves to the new version once its sessions are idle.
|
|
50
|
+
- **Stays out of your way**: servers you start by hand are left alone, and option changes never interrupt a session unless you ask for it.
|
|
51
|
+
- **Tunable**: permission mode, spawn mode (`same-dir` or one git worktree per session), capacity and filters, globally or per project.
|
|
52
|
+
|
|
53
|
+
```
|
|
54
|
+
$ rc-shepherd status
|
|
55
|
+
supervisor pid 272732 · config ~/.config/rc-shepherd/config.toml
|
|
56
|
+
api · running · pid 275126 · up 3h 12m · 0 restart(s)
|
|
57
|
+
web · running · pid 272734 · up 3h 12m · 1 restart(s)
|
|
58
|
+
|
|
59
|
+
$ rc-shepherd list
|
|
60
|
+
skip /home/me (home folder: Claude Code never saves its trust, so Remote Control cannot run there)
|
|
61
|
+
serve /home/me/code/api (has Claude sessions)
|
|
62
|
+
serve /home/me/code/web (has Claude sessions)
|
|
63
|
+
skip /home/me/code/demo (untrusted: run `claude` there once)
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Requirements
|
|
67
|
+
|
|
68
|
+
- Linux with systemd (user services), Python 3.11+
|
|
69
|
+
- [Claude Code](https://code.claude.com) logged in with a Claude subscription that includes Remote Control
|
|
70
|
+
- Lingering enabled so the service survives logouts: `sudo loginctl enable-linger "$USER"`
|
|
71
|
+
|
|
72
|
+
## Install
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
curl -fsSL https://raw.githubusercontent.com/herbalizer404/rc-shepherd/main/install.sh | sh
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
The script installs rc-shepherd into its own virtual environment (`~/.local/share/rc-shepherd/venv`), links `rc-shepherd` into `~/.local/bin`, installs bash completion, asks before installing the user service, then runs `rc-shepherd doctor`. [Read it](https://github.com/herbalizer404/rc-shepherd/blob/main/install.sh) first if you prefer, or run it from a checkout:
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
git clone https://github.com/herbalizer404/rc-shepherd && sh rc-shepherd/install.sh
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
- Run it again to upgrade. It asks before restarting the service (that interrupts work in progress in its sessions); without a terminal it leaves the service running.
|
|
85
|
+
- Options: `--yes` (no questions), `--no-service`, `--ref TAG` (e.g. `--ref v0.4.1`, see [releases](https://github.com/herbalizer404/rc-shepherd/releases)), `--source SPEC` (any pip requirement: a checkout, a wheel, `git+ssh://git@github.com/herbalizer404/rc-shepherd.git` for a private copy).
|
|
86
|
+
- Uninstall: `sh install.sh --uninstall`, or `--uninstall --purge` to also remove the configuration and state.
|
|
87
|
+
- Without the script, from [PyPI](https://pypi.org/project/rc-shepherd/): `pipx install rc-shepherd` (or `uv tool install rc-shepherd`), then `rc-shepherd service install`.
|
|
88
|
+
|
|
89
|
+
## Quick start
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
rc-shepherd config init # optional: writes a commented config file
|
|
93
|
+
rc-shepherd doctor # checks claude, login, lingering, projects
|
|
94
|
+
rc-shepherd service install # writes, enables and starts the user service (the installer offers it)
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
By default rc-shepherd follows Claude Code itself: every project anywhere in your home folder that Claude Code lists as **trusted** (`~/.claude.json`) and that already has **Claude sessions** is served, at any depth. Nothing else is: a folder you never opened with `claude` is ignored, and so are projects outside your home folder and folders inside hidden ones (such as the worktrees Claude Code keeps in `.claude/worktrees`). To add a project, open it once:
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
cd ~/code/my-app && claude # accept the trust prompt, send a message, quit
|
|
101
|
+
rc-shepherd reload # or wait up to a minute
|
|
102
|
+
rc-shepherd list # every candidate and why it is served or skipped
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
To serve fewer projects, narrow `roots` (e.g. `["~/projects"]`), set a `depth`, or use `allow`, `deny`, `active_within` and `max_servers`. To serve one outside your home folder, declare it: `rc-shepherd enable /srv/app`. The home folder itself is never served: Claude Code never saves its trust, so Remote Control refuses to run there. For sessions that are not tied to one project, open `claude` once in a folder such as `~/hub`: it is then served like any project.
|
|
106
|
+
|
|
107
|
+
Then open the Claude app: the project shows up as a Remote Control environment where you can start new sessions.
|
|
108
|
+
|
|
109
|
+
## Commands
|
|
110
|
+
|
|
111
|
+
| Command | Description |
|
|
112
|
+
| --- | --- |
|
|
113
|
+
| `status [--json]` | Servers run by the supervisor: pid, uptime, restarts, last error, pending option changes |
|
|
114
|
+
| `list [--json]` | Every candidate project and why it is served or skipped |
|
|
115
|
+
| `enable <path>` / `disable <path>` | Declare a project in the config (comments are kept, a `.bak` is written) |
|
|
116
|
+
| `restart <name\|path>` / `restart --all` | Restart servers, for example after updating Claude Code |
|
|
117
|
+
| `reload [--apply]` | Reload the config; `--apply` also restarts servers whose options changed |
|
|
118
|
+
| `config show\|check\|init` | Effective config as JSON, validation, example file |
|
|
119
|
+
| `doctor` | Checks the binary, login, lingering, service, projects, settings files and memory |
|
|
120
|
+
| `service install\|uninstall\|status\|logs [-f] [--all]` | Manage the systemd user service; `uninstall --purge` also removes the configuration and state |
|
|
121
|
+
| `completion bash\|zsh` | Print a shell completion script (the installer sets up bash) |
|
|
122
|
+
| `run [--dry-run]` | Run the supervisor in the foreground; `--dry-run` prints the server commands |
|
|
123
|
+
|
|
124
|
+
`--config FILE` works with every command (`service install --config FILE` bakes it into the unit).
|
|
125
|
+
|
|
126
|
+
## Configuration
|
|
127
|
+
|
|
128
|
+
`~/.config/rc-shepherd/config.toml`: every key is optional, unknown keys are rejected. See [`config.example.toml`](https://github.com/herbalizer404/rc-shepherd/blob/main/src/rc_shepherd/config.example.toml) for the full reference.
|
|
129
|
+
|
|
130
|
+
```toml
|
|
131
|
+
[discovery]
|
|
132
|
+
mode = "auto" # "auto" (Claude's projects below roots + [[project]]) or "list" ([[project]] only)
|
|
133
|
+
roots = ["~/projects", "~/work"] # default ["~"]: the whole home folder
|
|
134
|
+
depth = 1 # levels below each root (default 0 = any); also lists unknown folders
|
|
135
|
+
active_within = "30d" # skip projects without a recent session (default: no limit)
|
|
136
|
+
allow = [] # globs on the folder name, or the path if they contain "/"
|
|
137
|
+
deny = ["*-archive", "~/projects/sandbox"]
|
|
138
|
+
max_servers = 10 # the most recently active projects win
|
|
139
|
+
|
|
140
|
+
[defaults]
|
|
141
|
+
permission_mode = "" # "" = this machine's Claude Code settings
|
|
142
|
+
spawn = "same-dir" # or "worktree": one git worktree per new session
|
|
143
|
+
capacity = 32
|
|
144
|
+
|
|
145
|
+
[[project]] # served even outside roots and filters
|
|
146
|
+
path = "~/projects/api"
|
|
147
|
+
spawn = "worktree"
|
|
148
|
+
permission_mode = "acceptEdits"
|
|
149
|
+
|
|
150
|
+
[[project]]
|
|
151
|
+
path = "~/projects/legacy"
|
|
152
|
+
enabled = false # declared but not served
|
|
153
|
+
|
|
154
|
+
[supervisor]
|
|
155
|
+
min_free_memory = "1GiB"
|
|
156
|
+
on_failure = "notify-send 'rc-shepherd' '{name}: {reason}'"
|
|
157
|
+
restart_on_update = "idle" # or "off"
|
|
158
|
+
idle_after = "30m" # how long sessions must be idle before that restart
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
Per-server options (`[defaults]`, overridable per `[[project]]`): `permission_mode`, `spawn`, `capacity`, `settings`, `chrome` (`""`, `"on"`, `"off"`), `name_template` (`{name}`, `{parent}`, `{host}`), `extra_args`, `env`, `allow_bypass`.
|
|
162
|
+
|
|
163
|
+
Option changes are applied when a server next starts, so a reload never interrupts your sessions unless you pass `--apply`.
|
|
164
|
+
|
|
165
|
+
## Permissions and security
|
|
166
|
+
|
|
167
|
+
- Leaving `permission_mode` empty keeps whatever your Claude Code settings say, exactly as if you had typed `claude rc` yourself. Approval prompts appear in the Claude app.
|
|
168
|
+
- `bypassPermissions` is refused unless the same table also sets `allow_bypass = true`, and `doctor` reports it.
|
|
169
|
+
- `settings` files are passed with `--settings`. Keep them outside the projects (sessions could edit them) and not writable by other users; `doctor` checks both.
|
|
170
|
+
- Sessions run on this machine with your user's rights. Anyone who can use your Claude account can use them.
|
|
171
|
+
- Servers run with the service's `PATH`, captured when you run `service install` (`--path` to override).
|
|
172
|
+
- See [SECURITY.md](https://github.com/herbalizer404/rc-shepherd/blob/main/SECURITY.md) for the security design and how to report a vulnerability.
|
|
173
|
+
|
|
174
|
+
## How it works
|
|
175
|
+
|
|
176
|
+
- Every `interval` (default 60s) and on `reload`, the projects listed in `~/.claude.json` below the roots are checked for trust there and for history in `~/.claude/projects/*/*.jsonl`. With a `depth` above 0, the folders found under the roots are listed too, so `list` can explain why they are skipped.
|
|
177
|
+
- Each served project gets `claude remote-control --spawn <mode> --capacity <n> --name <name> [...]` in its own process group. Output goes to the journal, once per line (the CLI redraws its screen in place).
|
|
178
|
+
- A server that exits is restarted after 5s, then 10s, 20s… up to 5 minutes. The delay resets after 10 minutes of healthy run. After `on_failure_after` failures in a row, `on_failure` runs once.
|
|
179
|
+
- A server that stops because the Claude login is missing or expired shows `login required` in `status` and `doctor`, is retried at the longest delay, and `on_failure` runs at once with `{reason}` = `login`.
|
|
180
|
+
- Each server remembers the Claude Code version it started with. After an update, `status` and `doctor` flag the servers still on the old one; with `restart_on_update = "idle"` (the default), each one restarts on the new version once its sessions are idle: none of them runs a command (a child process of the session) and none of their transcripts changed for `idle_after` (default 30 minutes). Idle sessions reattach on their own after the restart, so work in progress is never interrupted.
|
|
181
|
+
- If you run `claude rc` by hand in a served folder, the supervisor leaves it alone and takes over when it exits.
|
|
182
|
+
- Stopping the service stops every server (SIGTERM, then SIGKILL after `stop_timeout`). An invalid config at startup exits with code 78 and systemd does not loop.
|
|
183
|
+
|
|
184
|
+
## Limitations
|
|
185
|
+
|
|
186
|
+
- The machine must stay on: sessions run here, the apps only display them.
|
|
187
|
+
- Restarting a server interrupts the work in progress in its sessions. Remote Control keeps its environment, so existing sessions reattach on their own after the restart.
|
|
188
|
+
- An old session may refuse to reattach after a restart ("Session failed" in the logs): start a new session from the app.
|
|
189
|
+
- Running `service install`, `service uninstall` or `systemctl --user restart rc-shepherd` from a session served by the service ends that session too (it runs inside the unit). The CLI detects it, prints its report first and queues the restart without waiting.
|
|
190
|
+
- After a Claude Code update, a server whose sessions keep working keeps the old version until they pause for `idle_after`, or until you run `restart` (always with `restart_on_update = "off"`).
|
|
191
|
+
- Sessions run inside the service, so what their own programs log (`sudo`, `docker`…) lands in its journal too: `service logs` shows only rc-shepherd's lines, `service logs --all` everything.
|
|
192
|
+
- In `same-dir` mode, sessions of a project share one checkout; use `spawn = "worktree"` to isolate them.
|
|
193
|
+
- An idle server uses about 120-200 MB of RAM.
|
|
194
|
+
- If the Claude login expires, servers stay down (retried every `max` delay) until you log in again (`claude auth login`).
|
|
195
|
+
- Linux only for now (systemd and `/proc`). launchd support is welcome.
|
|
196
|
+
|
|
197
|
+
## Alternatives
|
|
198
|
+
|
|
199
|
+
- A few projects only: `claude rc` in tmux, or a hand-written systemd unit per project, may be enough.
|
|
200
|
+
- No need for your own machine, tools or network: Claude Code cloud sessions run on Anthropic's infrastructure and need no server at all.
|
|
201
|
+
- Claude Code may offer a native background service in the future; this tool would then become unnecessary.
|
|
202
|
+
|
|
203
|
+
## Usage and terms
|
|
204
|
+
|
|
205
|
+
You remain bound by Anthropic's terms ([Claude Code legal and compliance](https://code.claude.com/docs/en/legal-and-compliance), Consumer or Commercial Terms, Usage Policy). This tool is designed to stay within ordinary, individual use:
|
|
206
|
+
|
|
207
|
+
- It runs the official `claude` binary unmodified, signed in with **your own** account. It never reads, stores or forwards credentials or session tokens.
|
|
208
|
+
- It only keeps Remote Control available. It never sends prompts or drives sessions by itself: a person types every message from a Claude app.
|
|
209
|
+
- Do not use it to share your account, to serve other people through your subscription, or to run unattended agents on a Pro/Max plan (use an API key for automation).
|
|
210
|
+
- Subscription usage limits assume ordinary individual use of Claude Code.
|
|
211
|
+
|
|
212
|
+
## Development
|
|
213
|
+
|
|
214
|
+
```bash
|
|
215
|
+
python3 -m venv .venv && .venv/bin/pip install -e '.[dev]'
|
|
216
|
+
.venv/bin/ruff check src tests
|
|
217
|
+
PYTHONSAFEPATH=1 .venv/bin/coverage run -m pytest && .venv/bin/coverage report # 100% lines and branches
|
|
218
|
+
RC_SHEPHERD_INTEGRATION=1 .venv/bin/pytest tests/test_install_script.py # full install.sh run (uses PyPI)
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
Tests use a fake `claude` executable and never start a real Remote Control server. See [CONTRIBUTING.md](https://github.com/herbalizer404/rc-shepherd/blob/main/CONTRIBUTING.md).
|
|
222
|
+
|
|
223
|
+
## License
|
|
224
|
+
|
|
225
|
+
[MIT](https://github.com/herbalizer404/rc-shepherd/blob/main/LICENSE)
|