Skip to content

Walking skeleton: a fresh run on the happy path - #13

Merged
JacobStephens2 merged 4 commits into
mainfrom
issue-3
Sep 25, 2026
Merged

JacobStephens2 merged 4 commits into
mainfrom
issue-3

Conversation

@JacobStephens2

Copy link
Copy Markdown
Owner

Summary

The walking skeleton: thirdshift <Issue URL> takes an open issue to a PR on the happy path.

run(Issue URL)
  parse Issue URL; Origin match on raw remote.origin.url
  Base branch = checked-out branch
  Worktree::create_fresh          # ../<repo>-issue-<n>, new issue-<n> from origin/<base>
  Plugin::write                   # embedded skills/ + .claude-plugin/plugin.json (name: thirdshift) in a temp dir
  session::run                    # claude -p --permission-mode auto --plugin-dir <tmp>
                                  #   --output-format stream-json --verbose <fresh prompt>
                                  #   stream → ~/.thirdshift/logs/<owner>-<repo>-issue-<n>-<ts>-implement.jsonl
  git push origin issue-<n>       # even if the agent already pushed
  gh pr view issue-<n>            # exists, OPEN, targets the Base branch
  print PR URL                    # the only stdout
  drop: worktree removed, local issue-<n> deleted, temp dir removed
src/          main, run (orchestration), issue (Issue URL + Origin match), worktree,
              plugin, session (claude + log path), prompt, github (gh), git
tests/
├── support/  harness: real git (bare origin via insteadOf), HOME/TMPDIR per test
├── fakes/    gh (JSON state file), claude (scripted per test, records argv/prompt/cwd/plugin dir)
└── fresh_run.rs
.github/workflows/ci.yml   fmt --check, clippy -D warnings, cargo test

Tested seam: the thirdshift CLI only. Tests run the compiled binary and assert on stdout, exit code, the origin repo, the fake GitHub state, and what the fake claude was asked to do.

Evidence

  • Before: prints_only_the_pr_url_and_exits_zero fails, left: "Hello, world!\n", right: "https://github.com/acme/widgets/pull/1\n"
    After: cargo test: 8 passed
    prints_only_the_pr_url_and_exits_zero
    runs_claude_headless_in_auto_mode_in_a_sibling_worktree_on_the_issue_branch
    gives_the_agent_the_fresh_prompt
    loads_every_factory_skill_as_the_thirdshift_plugin
    logs_the_session_stream_under_the_home_directory
    pushes_the_issue_branch_when_the_agent_did_not
    succeeds_when_the_agent_pushed_the_branch_itself
    leaves_no_worktree_local_issue_branch_or_temp_directory_behind
    
  • The generated plugin layout passes claude plugin validate.

Unaddressed findings

Standards

  • Primitive Obsession (PR state as String, Issue branch built with format!): left for Continuation of an existing Issue branch #6/Numbered Issue branches after a merged or closed PR #7, which reshape branch selection and PR handling.
  • Data Clumps (issue, base, branch travelling together): a Run context type is better shaped once Continuation and Repairs add their fields.
  • Duplicated Command + status-check shape in git, github, session: three small call sites with different output handling; not worth a shared helper yet.
  • Feature Envy (log_path, prompt::fresh read IssueUrl fields), generic run names, Worktree::path() alongside git(): minor, kept for readability.
  • Dependencies (current_dir, clock, HOME) created rather than injected: the only seam is the CLI, so they are covered end to end.

Spec

Merge Danger

Door: two-way

First code in the repo; nothing depends on it yet. Revert is clean.

Blast Radius: none

Not safe for unattended use until #4 and #5: with no Failed run path, a failed session's unpushed work is deleted in cleanup.

Closes #3

🤖 Generated with Claude Code

JacobStephens2 and others added 4 commits September 25, 2026 03:50
thirdshift <Issue URL> creates a sibling worktree on issue-<n> from
origin/<base>, writes the embedded Factory skills as the thirdshift
plugin, runs a headless auto-mode claude session with the fresh prompt
and a per-session log, pushes the branch, checks the PR through gh,
prints its URL and cleans up.

Tests run the compiled binary against real git (bare origin via
insteadOf) and fake gh and claude executables.

Refs #3

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Also drop dev-dependencies that duplicate normal dependencies.

Refs #3

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Refs #3

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Refs #3

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@JacobStephens2
JacobStephens2 merged commit 3aa869b into main Sep 25, 2026
1 check passed
@JacobStephens2
JacobStephens2 deleted the issue-3 branch September 25, 2026 04:27
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.

Walking skeleton: a fresh run on the happy path

1 participant