CLI tool for collective action
Find a file
The Intern e055c42c91
All checks were successful
Auto-Release on Version Change / check-version (push) Successful in 17s
Merge pull request 'docs: update README for v0.1.0 release' (#6) from docs/v0.1.0-readme-update into main
2026-02-25 18:48:57 -08:00
.forgejo/workflows add workflow_dispatch for testing 2026-02-25 18:46:20 -08:00
src/bloc feat: add governance commands (check-threshold, check-stale, can-review) 2026-02-23 22:24:36 -08:00
tests feat: add governance commands (check-threshold, check-stale, can-review) 2026-02-23 22:24:36 -08:00
.gitignore feat: implement bloc MVP with PR operations 2026-02-23 20:16:10 -08:00
CLAUDE.md docs: add sandbox environment details to CLAUDE.md 2026-02-23 20:21:35 -08:00
plan.md feat: add governance commands (check-threshold, check-stale, can-review) 2026-02-23 22:24:36 -08:00
pyproject.toml feat: implement bloc MVP with PR operations 2026-02-23 20:16:10 -08:00
README.md docs: update README for v0.1.0 release 2026-02-26 02:48:45 +00:00
uv.lock feat: implement bloc MVP with PR operations 2026-02-23 20:16:10 -08:00

bloc

Version: v0.1.0

CLI tool for Forgejo operations. Replaces scattered curl commands across commune agent skills with a unified interface.

Install

uv pip install -e .

Quick start

# Set token directly (testing/CI)
export BLOC_TOKEN=<your-forgejo-token>

# Or inside the sandbox container, FORGEJO_TOKEN is already set as an rbw entry name
# bloc resolves it automatically via: rbw get "$FORGEJO_TOKEN"

# List open PRs (infers repo from git remote)
bloc pr list

# Target a specific repo
bloc pr list --repo commune/skills

# Get PR details with reviews
bloc pr get 42 --repo commune/skills

# Create a PR
bloc pr create feature-branch --title "Add new feature" --repo commune/skills

# Approve a PR
bloc pr review 42 approve "LGTM" --repo commune/skills

# Check merge readiness
bloc pr checks 42 --repo commune/skills

# Merge
bloc pr merge 42 --repo commune/skills

# List open issues
bloc issue list --repo commune/skills

# Create an issue
bloc issue create "Bug report" --body "Details here" --repo commune/skills

# Comment on an issue or PR
bloc comment post 42 "Working on this" --repo commune/skills

# List labels for a repo
bloc label list --repo commune/skills

# Apply labels to an issue or PR
bloc label apply 10 "status:claimed" --repo commune/skills

# Remove labels
bloc label remove 10 "status:claimed" --repo commune/skills

# Check governance requirements (approval thresholds, stale reviews)
bloc governance check-threshold 42 --repo commune/skills

Global flags

These flags work at any position in the command — before or after the subcommand:

bloc --json pr list --repo commune/skills
bloc pr list --repo commune/skills --json
Flag Short Description
--repo OWNER/REPO -r Target repository (default: infer from git remote)
--json -j Output as JSON for scripting
--debug Show HTTP request/response details
--dry-run Show what would happen without making changes

Auth chain

Token is resolved in this order:

  1. BLOC_TOKEN env var — used directly (for testing/CI)
  2. rbw get "$FORGEJO_TOKEN" — if FORGEJO_TOKEN is set, it's treated as an rbw entry name
  3. rbw get "Forgejo API Token (agent)" — default fallback
  4. Error with diagnostic message

Commands

Pull requests

Command Description
bloc pr list List PRs. Use --state closed or --state all to include merged/closed PRs
bloc pr get NUMBER Show PR details including description, labels, and all reviews
bloc pr create BRANCH Create a PR from BRANCH into --base (default: main). Set --title and --body
bloc pr review NUMBER ACTION MSG Submit a review. ACTION: approve, request-changes, comment
bloc pr merge NUMBER Merge a PR. Use --method (merge/squash/rebase), --no-delete-branch to keep branch
bloc pr checks NUMBER Show merge readiness: conflicts, approvals, and review states

Issues

Command Description
bloc issue list List issues. Use --state closed or --state all to include resolved issues. Filter with --labels
bloc issue get NUMBER Show issue details including labels and assignees
bloc issue create TITLE Create an issue. Set --body, --labels (IDs), --assignees (usernames)
bloc issue close NUMBER Close an issue

Comments

Command Description
bloc comment list NUMBER List comments on an issue or PR
bloc comment post NUMBER MESSAGE Post a comment on an issue or PR

Labels

Command Description
bloc label list List labels for a repo. Use --org ORG for org-level labels
bloc label apply NUMBER LABEL... Add labels to an issue/PR by name (resolves names to IDs)
bloc label remove NUMBER LABEL... Remove labels from an issue/PR by name

Governance

Command Description
bloc governance check-threshold NUMBER Verify PR has minimum approval threshold (2 approvals, or Brad approval during testing)
bloc governance check-stale NUMBER Check if PR has stale approvals (approvals submitted before the latest commit)
bloc governance can-review NUMBER Check if caller can review a PR (not author, not already reviewed)

Development

# Run CLI
uv run bloc --help

# Run tests (69 tests, respx-mocked)
uv run --extra dev pytest tests/ -v

# Lint
uv run --extra dev ruff check src/ tests/