Skip to content

Bare park parks the estate around the cwd and ASKS before sweeping; park --all / -a is the sweep unasked - #8

Merged
brettheap merged 2 commits into
mainfrom
feat/park-all-flag
Sep 11, 2026
Merged

brettheap merged 2 commits into
mainfrom
feat/park-all-flag

Conversation

@brettheap

@brettheap brettheap commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

Ruling: Brett Heap, 2026-09-10, in the session that opened this PR, verbatim: "lets change that so it parks the current repo. if not in a repo, then asks if want to park all. and park all should be park -a or park --all"

It supersedes his openRepoShape #91 ruling of the same day ("so just park will do park-all"), under which bare park with no estate around the cwd PARKED EVERY ESTATE unasked. #91 had itself superseded ruling 3 of openRepoShape #82 (refuse and list). The sweep #91 and #7 built is unchanged; how it is reached is what changes here.

Why

Since #91, a park typed in the wrong folder swept the whole workstation with no confirmation. The one flag-less command that commits and pushes in every estate you own should not be one keystroke away from a cd mistake — and a script or an assistant that WANTS the sweep should have to say so, rather than get it as the fallback for standing nowhere.

What it does now

Inside an estate, bare park parks that estate. The walk-up is exactly as it was under #82.

Outside every estate, at a terminal, it lists and ASKS:

park: no estate around /home/b, and no <Name> was given. Every estate under /home/b/projects:

  project  Atlas                /home/b/projects/Atlas
  project  MedxEHR              /home/b/projects/MedxEHR
  family   TestFam              /home/b/projects/TestFam

park every estate above? [y/N]

Only y / yes (any case) runs #91's sweep. Enter, n, or anything else exits 2: REFUSED: nothing was parked: the answer was not yes. — naming park <Name>, park --all, and standing inside an estate as the three ways forward. The question goes to stderr, where a prompt belongs, so park > log still shows it.

Outside every estate, with no terminal on stdin — a pipe, /dev/null, cron, an assistant's tool call — nothing can be asked, so nothing is parked. It refuses with ruling 3's list and names --all. It never hangs on a question nobody can see.

park --all / park -a is the sweep from anywhere, unasked, under its own park --all: parking every estate under … heading. Standing inside an estate does not narrow it. It is refused alongside <Name> or --repo ("both … and --all"), and when there is no estate under the projects directory at all.

  • The sweep is Crash-consistent lane worktree recovery: canonical inventory and RUNNING → SWAPPING → SWAPPED lifecycle #91's and The no-estate sweep skips a root without the Speckit git overlay instead of counting it as a refusal #7's, untouched: name order, continue past a refusal, skip a standalone root without the Speckit git overlay (with main's = "standalone" positive match), one summary. park_every_estate now takes its rows from the caller that listed them, so what was listed — or asked about — is exactly what runs, and nothing prints twice.
  • resume --all / -a refuses by name and says why resume has no sweep, instead of the generic "put it after --" hint, which would have handed the extension a flag nobody meant. resume's bare form keeps ruling 3's refusal, as before.
  • The shared estate resolver is not touched — test_the_two_verbs_carry_the_same_estate_resolver_byte_for_byte still passes and no hunk falls inside the block.
  • AGENTS.md rule 1 now tells an assistant its stdin is not a terminal, so in its hands a bare park outside every estate is a refusal naming --all: run park --all when the person wants everything parked, and never reach for it when they named one estate.

Tests

147 -> 160. A run_at_a_terminal helper puts a real pseudo-terminal (pty.openpty) on stdin, so [ -t 0 ] answers yes and the question is actually asked; stdout and stderr stay pipes so the question and the report are captured apart. New: the question answered y/Y/yes/YES (sweep, name order, summary); answered Enter/n/no/other (exit 2, nothing ran); the no-terminal refusal naming --all; --all and -a; --all from inside an estate; --all with <Name> or --repo; --all and bare park with no estate anywhere. The #7 sweep tests are driven with --all. Hygiene: the bare-form document test now asserts --all, -a, ASKS, the #91 citation and name order in README, AGENTS.md and park's header.

bash -n passes for all three shipped files; shellcheck park resume reports the same 30 + 3 info-level notes as before this change, all in untouched code. python3 -m pytest tests -q is 160 passed locally with the submodule initialised, on the tree rebased onto main after #7 merged.

Docs: README.md 178 -> 182 lines, AGENTS.md 95 -> 99, both caps raised in a dated docstring entry naming the rule the lines bought.

Not merged

Opened for review. workBenches re-vendors park and resume after this lands.

🤖 Generated with Claude Code

Summary by Sourcery

Make bare park target the current estate or request confirmation before sweeping, while requiring --all or -a for an unprompted estate-wide operation.

New Features:

  • Add interactive confirmation for bare park when run outside an estate and introduce park --all/-a for explicitly requesting the estate-wide sweep.

Bug Fixes:

  • Prevent accidental estate-wide parking from an unqualified park invocation outside an estate, including non-interactive executions.

Enhancements:

  • Keep bare park focused on the estate surrounding the current directory and make resume --all explicitly invalid.
  • Ensure estate sweeps use the displayed estate list consistently and preserve existing ordering, continuation, skipping, and summary behavior.

Documentation:

  • Update README.md, AGENTS.md, and the command documentation to describe the new bare-command confirmation, explicit sweep flags, and assistant stdin behavior.

Tests:

  • Expand command coverage for interactive confirmations, refusals, explicit sweep flags, argument conflicts, empty estates, and sweep behavior.

… `park --all` / `-a` is the sweep unasked

Brett Heap's RULING of 2026-09-10, verbatim: "lets change that so it parks
the current repo. if not in a repo, then asks if want to park all. and park
all should be park -a or park --all." It supersedes his openRepoShape #91
ruling of the same day, under which bare `park` with no estate around the
cwd parked every estate unasked.

- The walk-up is unchanged: inside an estate, bare `park` parks that one.
- Outside every estate, at a terminal: list, then `park every estate
  above? [y/N]` on stderr. Only y/yes runs #91's sweep; anything else
  exits 2 with "nothing was parked".
- Outside every estate, with no terminal on stdin: refuse, list, and name
  `--all`. Never hang on a question nobody can see.
- `park --all` / `park -a`: the sweep from anywhere, unasked. Refused
  alongside <Name> or --repo, and when no estate exists at all.
- `resume --all` / `-a` refuses by name and says why `resume` has no
  sweep, instead of the generic "put it after `--`".
- The sweep itself (name order, continue past a refusal, skip roots
  without the overlay, one summary) is untouched; it now takes its rows
  from the caller that listed them.

Tests 147 -> 160: the question under a real pseudo-terminal (y/Y/yes/YES,
Enter/n/no/other), the no-terminal refusal, --all and -a, --all from
inside an estate, the flag conflicts, and the sweep tests now driven by
--all. README 178 -> 182 and AGENTS.md 95 -> 99, caps raised in dated
docstring entries.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Copilot AI lite review requested due to automatic review settings September 10, 2026 22:05

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Sorry @brettheap, you've used your own review budget of 250,000 diff characters for the last 7 days.

You can request another review in 2 hours and 55 minutes by commenting @sourcery-ai review. Upgrade to get a review now.

@sourcery-ai

sourcery-ai Bot commented Sep 10, 2026

Copy link
Copy Markdown

Reviewer's Guide

Changes park from an unasked fallback sweep to cwd-first behavior with an interactive confirmation outside estates, introduces explicit unasked --all/-a sweep modes, clarifies resume rejects sweeping, and updates tests and documentation accordingly.

Sequence diagram for interactive park confirmation

sequenceDiagram
    actor User
    participant Park
    participant Terminal
    participant EstateList
    participant Estates

    User->>Park: park
    Park->>EstateList: list estates under projects directory
    Park->>Terminal: write confirmation question to stderr
    User->>Terminal: enter y, yes, or another answer
    alt answer is y or yes
        Terminal-->>Park: affirmative answer
        Park->>Estates: park_every_estate(listed estates)
        Estates-->>Park: one summary
    else answer is not yes
        Terminal-->>Park: non-affirmative answer
        Park-->>User: exit 2, nothing was parked
    end
Loading

Sequence diagram for explicit park all sweep

sequenceDiagram
    actor Caller
    participant Park
    participant EstateList
    participant Estates

    Caller->>Park: park --all or park -a
    Park->>EstateList: list estates under projects directory
    Park->>Estates: park_every_estate(listed estates)
    Estates-->>Park: continue past refusals and report one summary
    Park-->>Caller: sweep result
Loading

Flow diagram for park command routing

flowchart TD
    Start["park invocation"] --> Mode{"--all or -a?"}
    Mode -->|yes| List["List estates under projects directory"]
    Mode -->|no| Estate{"Estate around cwd?"}
    Estate -->|yes| One["Park cwd estate"]
    Estate -->|no| TTY{"stdin is a terminal?"}
    TTY -->|no| Refuse["Refuse and name --all"]
    TTY -->|yes| Ask["Ask whether to park every listed estate"]
    Ask --> Answer{"Answer is y or yes?"}
    Answer -->|yes| List
    Answer -->|no| Exit["Exit 2; park nothing"]
    List --> Sweep["Sweep listed estates in name order"]
Loading

File-Level Changes

Change Details Files
Redefine bare park routing to prefer the estate around the cwd, otherwise list estates and require an interactive confirmation before sweeping.
  • Park only the current estate when invoked inside one.
  • At a terminal outside estates, print the discovered list and ask on stderr; only case-insensitive y/yes proceeds.
  • Refuse with exit 2 and actionable guidance when stdin is not a terminal or the answer is not affirmative.
  • Avoid prompting when no estates exist and preserve the existing single-estate resolver behavior.
park
tests/test_park_resume_commands.py
Add explicit --all/-a sweep modes and preserve the existing sweep semantics independently of cwd or interactivity.
  • Run the existing name-ordered, continue-on-refusal sweep unasked from anywhere, including inside an estate.
  • Feed the sweep the rows already discovered by the caller to prevent mismatches or duplicate listing.
  • Reject combining --all with a name or --repo, and reject it when no estates are available.
  • Move sweep, skip, refusal, dry-run, and passthrough coverage to the explicit --all path.
park
tests/test_park_resume_commands.py
Make resume explicitly reject --all while retaining its existing bare-form refusal.
  • Add a named error explaining that resume has no sweep mode.
  • Prevent the generic extension-argument handling from consuming or suggesting the unsupported flag.
  • Add regression coverage for the distinction between park and resume.
resume
tests/test_park_resume_commands.py
Update operator and user documentation to describe the confirmed bare behavior, explicit sweep flag, and non-interactive assistant behavior. README.md
AGENTS.md
tests/test_repo_hygiene.py

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sonarqubecloud

Copy link
Copy Markdown

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

Moderate findings remain in sweep ordering and PTY test reliability, alongside documentation and regression-test updates.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Updates park to target the current estate, prompt before an unqualified sweep, and require --all/-a for unprompted sweeps. resume now rejects those flags.

Changes:

  • Adds interactive confirmation and explicit sweep handling.
  • Expands command and PTY test coverage.
  • Updates README.md, AGENTS.md, and command help.
File summaries
File Summary and final review findings
tests/test_repo_hygiene.py Updates documentation assertions and limits. No final review comments.
tests/test_park_resume_commands.py Adds interactive and sweep coverage. Moderate (2 votes): PTY helper may fail with EIO when the child exits before input is written.
resume Rejects -a/--all. Nit (2 votes): add regression coverage for both spellings and the dedicated refusal.
README.md Documents the new invocation behavior. Nits (1 vote each): qualify the no-estate exception and document acceptance of y/yes in any case.
park Implements confirmation and explicit sweep handling. Moderate (2 votes): display the captured estate rows to preserve sweep ordering. Nits (1 vote each): qualify the no-estate exception and document y/yes acceptance.
AGENTS.md Updates assistant guidance. Nit (1 vote): qualify the bare non-terminal refusal for cases where estates were found.
Review details

Suppressed comments (5)

AGENTS.md:34

  • This rule says a bare invocation outside an estate refuses and names --all, but with no estate under the projects directory the implementation exits earlier with nothing to park and deliberately omits --all (the new no-estate test asserts that exception). Qualify the rule to the case where at least one estate was found, and keep the exception consistent in README.md and the command help.
   under which the bare form swept unasked). YOUR STDIN IS NOT A TERMINAL, so
   in your hands a bare `park` outside every estate refuses and names `--all`:
   when the person wants everything parked, run `park --all`; when they named

README.md:88

  • This paragraph says a bare non-terminal invocation refuses and names --all, but when no estate exists the implementation exits earlier with nothing to park and deliberately omits --all (the new no-estate test asserts that exception). Qualify the sentence to the case where at least one estate was found, and keep the exception consistent in the command help and AGENTS.md.
parked. With no estate around it either, `park` lists every estate it finds
under your projects directory and ASKS whether to park them all — `y` runs the
sweep, anything else parks nothing, and where stdin is not a terminal nothing
is asked: it refuses and names `--all`. `park --all` (or `park -a`) is that

README.md:87

  • This user-facing description only says that the literal y runs the sweep, but the implementation accepts y or yes in any combination of case (park:866-867), and the new tests exercise yes. Please document both accepted answers so the prompt contract does not contradict the command.
under your projects directory and ASKS whether to park them all — `y` runs the
sweep, anything else parks nothing, and where stdin is not a terminal nothing

park:87

  • This help text says a non-terminal bare invocation always refuses and names --all, but the no-estate path exits earlier with nothing to park and deliberately omits --all (covered by test_no_name_and_no_estate_anywhere_refuses_without_asking). Qualify this sentence to the case where at least one estate was found, and keep the exception consistent in README.md and AGENTS.md.
park`, then one summary. Where stdin is not a terminal the bare form cannot
ask, so it refuses and names `--all` - a script that wants the sweep says so.

park:83

  • The park --help text has the same mismatch: it says anything but y is rejected, although yes and mixed-case yes are accepted by the implementation. Since this is the installed command's contract, mention both accepted forms here.
directory and ASKS whether to park them all; anything but `y` parks nothing.
  • Files reviewed: 6/6 changed files
  • Comments generated: 3
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread park
Comment on lines +856 to +858
say "park: no estate around $PWD, and no <Name> was given. Every estate under ${PROJECTS_DIRS[*]}:"
say ""
say "$(estates_or_none)"
slave = -1
# Typed before `park` reads it: the line discipline holds the line,
# exactly as a terminal holds one typed ahead of the prompt.
os.write(master, (answer + "\n").encode())
Comment thread resume
Comment on lines +769 to +771
-a | --all) die "\`$SELF_NAME\` has no \`--all\`, deliberately: rebuilding every estate on this
machine from one command is the accident its own bare-form refusal exists
to prevent. Name the one you want: \`$SELF_NAME <Name>\`." ;;
@brettheap
brettheap merged commit 5c8b598 into main Sep 11, 2026
6 checks passed
@brettheap
brettheap deleted the feat/park-all-flag branch September 11, 2026 02:36
brettheap added a commit that referenced this pull request Sep 11, 2026
…s diff is its own change

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@brettheap
brettheap restored the feat/park-all-flag branch September 11, 2026 02:38
@brettheap
brettheap deleted the feat/park-all-flag branch September 11, 2026 02:38
brettheap added a commit that referenced this pull request Sep 11, 2026
…R's diff is its own change

Co-Authored-By: Claude Fable 5.1 <[email protected]>
brettheap added a commit that referenced this pull request Sep 11, 2026
…am, so this PR's diff is its own change

Co-Authored-By: Claude Fable 5.1 <[email protected]>
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.

2 participants