Skip to content

Pr refs pull 142 head#144

Closed
skulidropek wants to merge 6 commits intoProverCoderAI:mainfrom
skulidropek:pr-refs-pull-142-head
Closed

Pr refs pull 142 head#144
skulidropek wants to merge 6 commits intoProverCoderAI:mainfrom
skulidropek:pr-refs-pull-142-head

Conversation

@skulidropek
Copy link
Copy Markdown
Member

No description provided.

skulidropek and others added 5 commits March 16, 2026 07:37
When docker-git auth github login is called, immediately ensure the
user's .docker-git state repository exists on GitHub:
- Resolve the authenticated user's login via gh api /user
- Check if <login>/.docker-git exists; create it if missing
- Initialise the local ~/.docker-git directory via stateInit

Shared gh API helpers extracted to github-api-helpers.ts to eliminate
code duplication between github-fork and state-repo-github.

Closes ProverCoderAI#141

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…-less (issue-141)

- Add `adoptRemoteHistoryIfOrphan` in state-repo.ts called between
  `ensureOriginRemote` and `checkoutBranchBestEffort` in `stateInit`;
  when the repo is on an orphan branch (no commits) it fetches remote
  history and soft-resets to it so that local files appear as staged
  changes on top of the existing remote tree — preventing a divergent
  root commit that would force a new branch on push.
- Add integration tests in state-repo-init.test.ts covering: clone from
  empty dir, orphan-adoption from pre-populated dir, and idempotency.
- Add unit tests in github-api-helpers.test.ts documenting the
  `runGhApiNullable` invariants (CommandFailedError → null, empty → null).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… ancestor

Previously adoptRemoteHistoryIfOrphan only handled orphan branches
(no local commits). If stateInit was called a second time, the local
repo already had a divergent root commit (from a prior git-init run),
so rev-parse HEAD succeeded and the function returned early — leaving
the histories unrelated and forcing a new branch on every sync.

Now the function also covers Case 2: local commits exist but
`git merge-base HEAD origin/<ref>` finds no common ancestor.
In that case a `git reset --soft origin/<ref>` aligns the local HEAD
with the remote, keeping all local file changes as staged, so
`stateSync` can commit and push to main without conflict.

INVARIANT: ∀ local ∈ Repos: ¬∃ancestor(local, remote) → reset_soft(remote)
         ∧ ∃ancestor(local, remote) → rebase_sync(local, remote)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ve local history

Using git reset --soft discards local commits. Replace with
git merge --allow-unrelated-histories -X ours so both the local
and remote root commits are preserved in the graph. Local files
win on conflict, which is the correct default for a state repo.

INVARIANT: ∀ local ∈ Repos:
  ¬∃ancestor(local, remote) → merge_unrelated(local, remote, ours)
  ∧ ∃ancestor(local, remote) → rebase_sync(local, remote)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Remove -X ours: conflicts are not auto-resolved. Instead, on a failed
merge the repo is restored via --abort and stateSync handles the rest —
it will push a branch and log a PR URL for manual resolution.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- git init now uses --initial-branch=main to avoid creating master
- gitBaseEnv sets GIT_AUTHOR/COMMITTER_NAME/EMAIL to prevent
  "Author identity unknown" errors on commit and merge
- Extract adoptRemoteHistoryIfOrphan to state-repo/adopt-remote.ts
  to satisfy max-lines lint rule

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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