Skip to content

feat(sdk): add band-register-agent command bundling register-agent.sh#367

Draft
nir-singher-band wants to merge 1 commit into
mainfrom
band-register-agent-cli
Draft

feat(sdk): add band-register-agent command bundling register-agent.sh#367
nir-singher-band wants to merge 1 commit into
mainfrom
band-register-agent-cli

Conversation

@nir-singher-band

Copy link
Copy Markdown
Collaborator

Summary

Share the agent-registration setup script across integration repos by shipping it inside the SDK as the band-register-agent console entry point — instead of vendoring it or piping curl | bash. Because the script now rides along with band-sdk, consumers pin it by pinning the SDK version, so it can't drift from the API version they install. Sharing collapses to: uv add band-sdk then band-register-agent.

This mirrors the existing band-acp / band-trigger entry-point pattern.

Changes

  • Add band-register-agent console entry point (band.cli.register_agent:main) in pyproject.toml.
  • Bundle register-agent.sh verbatim as package data ([tool.setuptools.package-data] "band.cli" = ["*.sh"]).
  • Thin Python wrapper (src/band/cli/register_agent.py) resolves the script via importlib.resources and runs it with bash, mirroring its exit code (127 if bash is missing). stdout is passed through so the output stays eval-able.
  • Optional positional api_key populates BAND_USER_API_KEY for the script; omitting it falls back to the env var. The bundled script's own argv-free key handling is unchanged.
  • Add unit tests in tests/cli/test_register_agent.py.

Related Issues

None.

Testing

  • Unit tests pass (uv run pytest tests/ --ignore=tests/integration/ --ignore=tests/e2e/) — 7 new tests added. Full suite green except pre-existing, unrelated failures: Codex-ACP @pytest.mark.e2e tests that spawn npx @zed-industries/codex-acp, and live-credential tests/integration/ tests.
  • Pre-commit checks pass — ran the project checklist directly: ruff check, ruff format --check, and pyrefly check all clean.
  • Integration tests pass (if applicable) — N/A (require live credentials).

Additional verification:

  • Built the wheel and confirmed band/cli/register-agent.sh is bundled in the artifact (the real proof that "bundle as is" survives distribution).
  • band-register-agent --help works; a no-key run exits 1 via the script's own BAND_USER_API_KEY guard.

Reviewer notes

⚠️ Intentional security tradeoff. The bundled script deliberately reads the key only from $BAND_USER_API_KEY (never argv) so it never appears in ps. The optional CLI arg is a convenience implemented in the wrapper — when used, the key is visible in the wrapper's process list. The env var stays the documented default, and --help spells out the tradeoff. The .sh itself is unchanged, so its stdin-only handling is preserved on the env path.

Checklist

  • PR title follows Conventional Commits format
  • Code follows project style guidelines
  • Tests added/updated as needed
  • Documentation updated as needed — follow-up: document band-register-agent in CLAUDE.md alongside band-acp / band-trigger.

✌️

Share the agent-registration setup script across integration repos by shipping it inside the SDK as the `band-register-agent` console entry point, instead of vendoring or curl|bash. Consumers pin the script by pinning band-sdk, so it can't drift from the API version installed.

The shell script is bundled verbatim as package data; a thin Python wrapper resolves it via importlib.resources and runs it with bash, mirroring its exit code. An optional positional API key populates BAND_USER_API_KEY for the script; omitting it falls back to the env var (preferred, keeps the key out of the process list). The script's own argv-free key handling is unchanged.

✌️
@nir-singher-band nir-singher-band force-pushed the band-register-agent-cli branch from 12ca0b5 to 05717ad Compare June 18, 2026 21:22
@nir-singher-band nir-singher-band changed the title feat(cli): add band-register-agent command bundling register-agent.sh feat(sdk): add band-register-agent command bundling register-agent.sh Jun 18, 2026
@nir-singher-band

Copy link
Copy Markdown
Collaborator Author

Heads-up: a downstream consumer is waiting on this command.

band-ai/hermes-band-platform PR #5 switches the Band Hermes plugin's add-band install flow to use band-register-agent (band.cli.register_agent) instead of a bundled temporary helper. It's parked as a draft until this PR merges and band-sdk publishes a release that includes the command.

When this lands + publishes, please ping so we can: bump the plugin's band-sdk floor (its cap is currently <2.0.0), retarget PR #5 to dev, un-draft, and merge.

Base automatically changed from dev to main June 22, 2026 10:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant