Skip to content

Add runpane panes archive command#342

Merged
parsakhaz merged 1 commit into
dcouple:mainfrom
frarredondo:runpane-panes-archive
Jul 21, 2026
Merged

Add runpane panes archive command#342
parsakhaz merged 1 commit into
dcouple:mainfrom
frarredondo:runpane-panes-archive

Conversation

@frarredondo

Copy link
Copy Markdown
Contributor

Summary

Closes #339.

  • Adds runpane panes archive --pane <id> [--force] [--source user|agent] --yes [--json]
  • Archives a pane the same way the UI Archive action does, including worktree removal
  • Refuses to archive (unless --force) if the pane has uncommitted, untracked, or unpushed-to-remote commits, so agents can't silently blow away work
  • Waits for worktree cleanup to actually finish and reports it via worktreeCleanup: completed|failed|timeout|not-applicable
  • Wired into both npm and Python CLI wrappers through the contract

Test plan

  • pnpm --filter main test runpane (41 tests, some hit real temp git repos for dirty/unpushed/merged cases)
  • pnpm run check:runpane-contract and pnpm run test:runpane-contract
  • typecheck + lint on main and packages/runpane
  • smoke tested against an isolated headless daemon: dirty refusal, unpushed refusal, combined refusal, --force archive with real worktree removal, already-archived rejection

Closes dcouple#339. Lets agents archive a pane from the CLI same as the UI
Archive action, including safe worktree removal.

Refuses to archive (unless --force) when the pane has uncommitted,
untracked, or unpushed-to-remote changes, so an agent can't
accidentally nuke work. Waits for worktree cleanup to actually finish
before returning and reports the outcome in worktreeCleanup.

Wired into both the npm and Python CLI wrappers via the contract.

@parsakhaz parsakhaz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved based on completed implementation review against issue #339.

Evidence checked:

  • Contract and generated artifacts include runpane panes archive, and pnpm run test:runpane-contract passes.
  • npm and Python wrappers both parse, dispatch, confirm, and print archive results consistently.
  • Daemon registers runpane:panes:archive and delegates to the existing UI archive path after a live safety preflight.
  • Archive safety refuses uncommitted, untracked, unpushed, and unknown-status panes unless --force is supplied. The preflight bypasses cached git status and uses live git plumbing/upstream comparison.
  • Cleanup semantics are explicit via worktreeCleanup: completed|failed|timeout|not-applicable, using ArchiveProgressManager when available and polling as fallback.
  • Focused RunPane IPC tests cover clean archive, already archived/unknown pane rejection, dirty refusal, forced dirty archive, unpushed refusal, merged/pushed archive, main-repo not-applicable cleanup, status-unknown refusal, cleanup failure, and polling fallback.

Intentional tradeoffs noted: main-repo panes skip the worktree safety gate because there is no Pane-managed worktree to remove; branches without upstream use comparison-branch ahead count as a conservative proxy for unpushed work; cleanup waits are bounded and can report timeout rather than blocking indefinitely.

Recommendation: approve and merge after current-main integration checks.

@parsakhaz
parsakhaz merged commit 6e9b539 into dcouple:main Jul 21, 2026
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.

RunPane CLI: add panes archive so agents can archive completed panes

2 participants