Skip to content

feat(cli): add init-remote command for github repository creation#409

Open
arielshad wants to merge 11 commits intomainfrom
feat/github-remote-init
Open

feat(cli): add init-remote command for github repository creation#409
arielshad wants to merge 11 commits intomainfrom
feat/github-remote-init

Conversation

@arielshad
Copy link
Contributor

Summary

Add a new shep repo init-remote CLI command that creates a GitHub repository via gh repo create and configures the local git remote for repositories that don't yet have one. This bridges the gap between local-only repos and GitHub-dependent shep workflows (PRs, CI, push).

Changes across Clean Architecture layers:

  • Domain/Interface: Extended IGitPrService with createGitHubRepo() and addRemote() methods; added new GitPrErrorCode values (GH_NOT_FOUND, AUTH_FAILURE, REPO_CREATE_FAILED)
  • Infrastructure: Implemented service methods in GitPrService using gh repo create and git remote add subprocess calls with the existing ExecFunction injection pattern
  • Application: New InitRemoteRepositoryUseCase orchestrating the full flow — validate gh CLI availability, check hasRemote() guard, create repo, add remote, auto-push current branch
  • Presentation/CLI: New init-remote subcommand under repo command group with [name] positional arg, --public flag, and --org <name> option
  • DI: Registered new use case in the container
  • Specs: Full spec-driven workflow artifacts (spec, research, plan, tasks, feature YAML, evidence)

Evidence

Evidence Task
GitPrService.addRemote unit tests — 3 tests passing task-3
GitPrService.createGitHubRepo unit tests — 7 tests passing task-4
InitRemoteRepositoryUseCase unit tests — 12 tests passing task-6
CLI integration tests — 17 tests passing task-10
CLI help output confirms command registration task-9
TypeScript build — zero errors task-1
Full suite — 4087 unit + 501 integration tests passing, lint clean task-7

Test plan

  • Unit tests for addRemote() (correct args, void return, error wrapping)
  • Unit tests for createGitHubRepo() (private/public/org, URL return, ENOENT→GH_NOT_FOUND, auth→AUTH_FAILURE, generic→REPO_CREATE_FAILED)
  • Unit tests for InitRemoteRepositoryUseCase (happy path, guards, error propagation, name derivation, org support, visibility, Windows paths, actionable messages)
  • Integration tests for CLI command (registration, arg/option parsing, success output, error handling for all error codes)
  • Full test suite regression check (4087 unit + 501 integration — all green)
  • Build verification (tsc compiles with zero errors)
  • Lint verification (eslint clean)

🤖 Generated with Claude Code

arielshad and others added 10 commits March 17, 2026 18:35
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… remote init

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ervice

Extend IGitPrService interface with createGitHubRepo() and addRemote()
method signatures for GitHub remote initialization. Add
REMOTE_ALREADY_EXISTS and REPO_CREATE_FAILED to GitPrErrorCode enum.
Add stub implementations in GitPrService and update all test mocks.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…o git-pr service

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Implements InitRemoteRepositoryUseCase that orchestrates the full flow:
validates gh CLI availability via IToolInstallerService, guards against
existing remotes, derives repo name from cwd basename, and delegates to
IGitPrService.createGitHubRepo() for atomic create+remote+push.

Includes comprehensive unit tests covering happy path, gh not installed,
remote already exists, error propagation, custom name, org support,
public/private visibility, and Windows path handling.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@arielshad arielshad force-pushed the feat/github-remote-init branch from 493a883 to 5bdd852 Compare March 17, 2026 16:36
Add createGitHubRepo and addRemote mock methods to IGitPrService mock
to satisfy the interface contract after new methods were added.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions
Copy link

Dev Release Published

Artifact Version Install
npm 1.129.2-pr409.8d19a07 npm install -g @shepai/cli@1.129.2-pr409.8d19a07

Published from commit a33d37f | View CI

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