Skip to content

feat(domain): add fork-and-pr workflow for upstream contributions#452

Merged
arielshad merged 15 commits intomainfrom
feat/fork-and-pr
Mar 23, 2026
Merged

feat(domain): add fork-and-pr workflow for upstream contributions#452
arielshad merged 15 commits intomainfrom
feat/fork-and-pr

Conversation

@arielshad
Copy link
Contributor

Summary

  • Fork & PR workflow: When a user imports a GitHub repo they don't own, shep can now fork the repo, push to the fork, and create a PR to upstream — enabling contributions back to repos without write access
  • Domain layer: Added GitForkService (fork, push-to-fork, create-upstream-PR, get-PR-status), PollUpstreamPrUseCase (lifecycle transitions for upstream PRs), and extended PrSyncWatcherService with upstream PR polling and mergeable tracking
  • TypeSpec models: Extended Feature entity with forkAndPr and commitSpecs fields, added PullRequest value object, added awaiting-upstream lifecycle phase
  • Web UI: Feature create drawer now shows a Fork & PR toggle (with Push/PR implicitly locked on and Commit Specs auto-disabled), plus awaiting-upstream polling state in the feature node
  • Infrastructure: Added SQLite migration for fork-and-pr columns, DI container wiring, feature agent state channels, and merge node fork logic

Evidence

Evidence Screenshot
Feature create drawer with Fork & PR toggle enabled Fork enabled
Feature create drawer full view Full view
Storybook: ForkAndPrEnabled story Storybook fork
Storybook: ForkAndPrWithCommitSpecs story Storybook commit specs

Test Results

  • GitForkService: 14/14 passing (forkRepository, pushToFork, createUpstreamPr, getUpstreamPrStatus)
  • PollUpstreamPrUseCase: 8/8 passing (lifecycle transitions, edge cases, URL parsing)
  • PrSyncWatcherService: 55/55 passing (upstream PR polling, lifecycle transitions, mergeable tracking)
  • Full unit test suite: 346 files, 4695 tests, all passing with zero failures

Test plan

  • All 4695 unit tests pass (346 files)
  • Build compiles without errors
  • Lint passes with zero warnings
  • Pre-commit hooks pass (typecheck, format, lint)
  • CI pipeline passes on push
  • Verify fork workflow end-to-end with a non-owned repo

🤖 Generated with Claude Code

@github-actions
Copy link

Dev Release Published

Artifact Version Install
npm 1.141.0-pr452.1d8e904 npm install -g @shepai/cli@1.141.0-pr452.1d8e904

Published from commit 52f24f7 | View CI

arielshad and others added 14 commits March 23, 2026 16:34
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Add explicit TypeSpec model changes (feature.tsp, lifecycle.tsp, pull-request.tsp)
- Move upstreamPrUrl to PullRequest value object for cohesion
- Add lifecycle state impact analysis across all consumers
- Add fork error handling matrix (idempotent fork, already-a-fork detection)
- Define PollUpstreamPrUseCase interface with input/output DTOs
- Extend PrSyncWatcherService instead of creating parallel poller
- Add spec initializer changes for commitSpecs=false path
- Add database migration details
- Add TDD test scenarios and Storybook story requirements
- Add commitSpecs immutability enforcement
- Add feature agent state channel requirements

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Corrected to reflect actual blocklist pattern (NON_ARCHIVABLE_STATES)
instead of incorrectly describing an allowlist.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add the new required fields to all Feature object constructions in
source code and test files. Update feature mapper with fork_and_pr,
commit_specs, and upstream PR columns. Add AwaitingUpstream to
lifecycle-to-node mapping.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Implement IGitForkService interface and GitForkService for GitHub fork
operations. Add PollUpstreamPrUseCase for upstream PR status polling.
Extend merge node with fork-and-PR flow branch. Add forkAndPr and
commitSpecs channels to feature agent state. Create database migration
045 for new columns.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add forkAndPr/commitSpecs toggles to feature creation drawer with auto-flip
logic. Extend PrSyncWatcherService to poll AwaitingUpstream features via
IGitForkService. Add AwaitingUpstream visual treatment to feature node state
config. Wire IGitForkService into ui command and dev server. Fix spec yaml.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add unit tests for GitForkService, PollUpstreamPrUseCase, and
AwaitingUpstream polling in PrSyncWatcherService. Update existing
tests for new forkAndPr/commitSpecs channels and args.

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>
…rkflow fields

- restructure create drawer: merge fork row into git row with separator
- rename fork section to contribute, update tooltips
- add ciWatchEnabled, enableEvidence, commitEvidence to feature entity
- add migration 046 for per-feature workflow columns
- wire new fields through all layers: tsp, mapper, use case, agent, ui
- fix server action to pass forkAndPr and commitSpecs to use case
- show all per-feature settings in overview tab

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ling

- fix sqlite repository INSERT/UPDATE to include all feature columns
- update merge prompt to respect commitSpecs flag (git reset -- specs/)
- move lessons.md to project root, update CLAUDE.md and AGENTS.md refs

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…pr with fork

- Add requireInteger helper to spec validation
- Validate number (integer) and branch (string) in validateBaseSpec
- Clarify number field type in analyze and requirements prompts
- Fix "Add to PR" switch disabled when forkAndPr is enabled

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add commitSpecs guard to research and plan prompt builders, safety net
to undo spec commits when flag is false, deploy bar padding fix, and
unit tests for the commit-specs flag across all spec-phase prompts.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Spec schema now requires integer 'number' and string 'branch' fields.
Update all integration test fixtures to include these fields.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The create form requires a repository to be selected before the submit
button is enabled. Pass ?repo=/test/repo to match the mocked repo.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions
Copy link

Dev Release Published

Artifact Version Install
npm 1.145.0-pr452.8b628a7 npm install -g @shepai/cli@1.145.0-pr452.8b628a7

Published from commit f29b4e6 | View CI

@github-actions
Copy link

Dev Release Published

Artifact Version Install
npm 1.145.0-pr452.ae7b9df npm install -g @shepai/cli@1.145.0-pr452.ae7b9df

Published from commit a925a8e | View CI

@arielshad arielshad merged commit b8a6a2c into main Mar 23, 2026
18 checks passed
@arielshad arielshad deleted the feat/fork-and-pr branch March 23, 2026 15:09
blackpc pushed a commit that referenced this pull request Mar 23, 2026
# [1.146.0](v1.145.0...v1.146.0) (2026-03-23)

### Features

* **domain:** add fork-and-pr workflow for upstream contributions ([#452](#452)) ([b8a6a2c](b8a6a2c))
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