Skip to content

init commits the scaffold it wrote: the last commit before the protocol starts #183

Closed

Description

@radiusred-cody

Goal

init commits the scaffold it wrote, so the scaffold is the last commit before the protocol starts instead of a change the operator must gather, commit and — where the default branch requires pull requests — merge by hand with no task behind it (#164 findings 51 and 68; #172, adopted by the operator on 2026-08-30 on the assessed shape). Only the files init wrote go into the commit; the operator's staged and unstaged work is untouched; nothing is pushed.

Requirements

None directly (a cycle-4 fold-back; it serves M7-R9's "a clean repo at the close").

Plan

  1. The commit (internal/cli/init.go): after the scaffold, when the directory is a git repository and at least one file was written, init runs git add -- <written> and git commit --only -m "chore: scaffold codecrew" -- <written> — a pathspec commit, which takes exactly those paths and leaves everything else in the index and the working tree as it was (no stash, no -A). A rerun that wrote nothing commits nothing. The operator's own git identity signs it; a commit that fails (no identity configured, hooks) is a note with the command to run by hand, never an error that hides the scaffold. Spoke mode commits its pointer the same way.
  2. Which branch: the current branch, unless the repository's default branch requires pull requests — asked through gh (repo view for the default branch, GET /repos/{o}/{r}/rules/branches/{default} for a pull_request rule) — in which case init creates codecrew-bootstrap from HEAD, commits there, and prints the PR instruction: that PR is the one merge the operator does by hand, recorded as the pre-milestone gate on it (M7-R1), and the branch is cleaned by delete-on-merge, which status already nags about. A repository with no remote (a fresh git init) or an unborn HEAD commits on the current branch — the root commit. When the question cannot be asked (no gh auth, offline) the branch is assumed: a commit stranded on a protected main is the worse outcome, and the note says why.
  3. Never: push; git init (the note for a non-repository stays as it is — a stray repository around the wrong directory is worse than a note); stash.
  4. Tests, same PR (temp repositories, git on the runner): a fresh repository gets a root commit containing exactly the scaffold files; a repository with a modified tracked file and a staged unrelated file keeps both exactly as they were after init; a rerun commits nothing; the protected case (the rule query injected) commits on codecrew-bootstrap with the original branch untouched; a non-repository writes files and commits nothing; a failing commit is a note and the files remain.
  5. Docs: SPEC §6's init row; the quickstart (docs/first-milestone.md) — the "Commit and push" step becomes "push" and the protected-branch paragraph names the branch init made; README's four-line start comment; the introduction's init line if it enumerates; init's own output. CHANGELOG.md [Unreleased]. Backlog capture: the scaffold PR lands outside the protocol — init as a protocol act, or task finish --bootstrap #172 closes with this task.
  6. Not here: repository creation (gh repo create stays the operator's — the crew Apps lack Administration and the visibility is a decision); a task finish --bootstrap path (rejected on Backlog capture: the scaffold PR lands outside the protocol — init as a protocol act, or task finish --bootstrap #172).
  7. go test ./... green; subjects ≤ 100 characters, lowercase after the type, gated before committing; PR as the implementer with Closes #183 and Closes #172; the reviewer seat by dispatch under harness: codex; task finish 183 is the merge.

Ask-the-human points

None — the shape was decided by the operator on #172 (2026-08-30); the plan applies it.

Activity

  1. added
    cc:task
    on Aug 30, 2026
  2. radiusred-cody commented on Aug 30, 2026

    @radiusred-cody
    ContributorAuthor

    Started by @radiusred-cody[bot].

  3. radiusred-cody commented on Aug 30, 2026

    @radiusred-cody
    ContributorAuthor

    Deviation: the plan said codecrew-bootstrap is cut from HEAD; as merged it is cut from the default branch — refs/remotes/origin/<default>, else the local branch, HEAD only when neither exists (with a note). Why: the reviewer found that from a feature branch the scaffold PR would have carried the feature commits (PR #184, round 1, finding 3); the scaffold PR must be scaffold-only for the one hand merge it needs to be safe. Second deviation, same source: the quickstart pushes HEAD, not main — init commits on whatever branch the operator is on, and prints the exact command.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    cc:task

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions