basectl repo Ownership Map

August 25, 2026 ยท View on GitHub

Status: maintained implementation boundary map Last reviewed: 2026-08-25

basectl repo has grown from local baseline generation into a mixed local and GitHub workflow surface. This page maps the current responsibilities so future refactors can reduce repo.sh safely without changing public command behavior.

Current Responsibility Map

ResponsibilityCurrent public commandsCurrent ownerDirection
Command dispatch and usage routingbasectl repo ...BashKeep in Bash as the thin public front-end.
repo init option parsing and orchestrationrepo initrepo_init.shKeep the coordinator command-owned; reuse shared path, Git, dry-run, baseline-writer, and PR primitives from repo.sh.
Local path, config, and dry-run plumbingall repo commandsBashKeep small shared Bash helpers until a broader repo command parser exists.
Local baseline file generationrepo init, repo checkBashKeep file writes in Bash for now; extract stable writer groups only when the file set is already well-covered by BATS.
Agent guidance generationrepo agent-guidanceBash helperExtracted to repo_agent_guidance.sh; it still uses shared repo path, write, and PR helpers from repo.sh.
Installer template generationrepo installer-templateBash helperExtracted to repo_installer_template.sh; it still uses shared repo path, write, and PR helpers from repo.sh.
GitHub repository settings and labelsrepo init, repo configureBash helperExtracted to repo_github_settings.sh; keep gh orchestration in Bash short-term and move structured payload construction behind Python only when behavior needs richer validation or reusable JSON construction.
Default branch protectionrepo configureBash helper calling gh apiExtracted to repo_github_settings.sh; still a Python candidate if ruleset payloads grow or need deeper schema tests.
GitHub Project metadatarepo init, repo configureBash helper delegating to Python Project enginerepo_github_settings.sh owns wrapper handoff and messaging. Continue moving Project semantics into base_github_projects; Bash should only collect flags, locate repo config, and report wrapper output.
PR branch and generated PR creationrepo init --pr, repo agent-guidance --pr, repo installer-template --prBashKeep shared PR worktree and branch mechanics in Bash while Git remains the underlying tool. Extract generated PR body helpers by command as each command moves out.
Clone planning and gh repo clone handoffrepo cloneBashKeep in Bash unless clone config parsing moves into a general repo config parser.

Extraction Rules

  • Preserve the existing basectl repo command surface and exit statuses.
  • Prefer one command-specific extraction at a time.
  • Leave shared path, Git, dry-run, logging, and PR worktree primitives in repo.sh until multiple extracted commands need a smaller common helper.
  • Move structured GitHub Project behavior to Python, not to another Bash file.
  • Add or keep focused BATS coverage for each extracted command before moving code.

Completed Extractions

The first split moves repo installer-template implementation into cli/bash/commands/basectl/subcommands/repo_installer_template.sh.

This is intentionally a Bash helper, not a Python rewrite. The command mostly copies a maintained shell template, parses repo-specific flags, and optionally uses the existing generated-PR helper path. Keeping it in Bash avoids changing runtime behavior while proving that repo.sh can source command-owned helpers.

The second split moves repo agent-guidance generation into cli/bash/commands/basectl/subcommands/repo_agent_guidance.sh. The helper owns the generated guidance file content, command parsing, generated PR body, and agent-guidance PR finish path while still reusing shared repo path, Git, dry-run, logging, and PR worktree primitives from repo.sh.

The third split moves GitHub repository settings, labels, Base-managed default branch protection ruleset handling, repository creation, and Project metadata delegation into cli/bash/commands/basectl/subcommands/repo_github_settings.sh. The helper still reuses shared repo formatting, gh readiness, path, and project-support file helpers from repo.sh; this keeps repo init and repo configure behavior unchanged while separating GitHub-side configuration from local baseline generation.

The fourth split moves repo init option parsing and orchestration into cli/bash/commands/basectl/subcommands/repo_init.sh. The helper keeps the existing public base_repo_init() function and lazy-loads only for the init command. Its coordinator now separates argument parsing, validation, PR planning, baseline writing, PR finishing, and GitHub configuration. Local baseline writers, GitHub settings, shared path handling, and PR worktree primitives remain in their existing owners.

Follow-up candidates:

  • Continue reducing Project-specific logic in Bash by delegating schema and field behavior to the Python Project engine.