Skip to content

feat: run the repository's .workflows/setup in each new run worktree - #86

Merged
Vzlentin merged 1 commit into
mainfrom
feat/run-the-repository-s-workflows-setup-in-each-new
Nov 1, 2026
Merged

Vzlentin merged 1 commit into
mainfrom
feat/run-the-repository-s-workflows-setup-in-each-new

Conversation

@Vzlentin

@Vzlentin Vzlentin commented Nov 1, 2026 •

Copy link
Copy Markdown
Owner

A run worktree is a fresh checkout with no dependencies, so almost every implementer session started with npm ci. Now the repository declares its setup step, and the run runs it once before the first session.

# .workflows/setup (executable, from the start commit)
#!/bin/sh
set -e
npm ci --no-audit --no-fund --loglevel=error
  • The script task runs <worktree>/.workflows/setup in the worktree right after it creates it (Git, Herdr or inCheckout). Output goes to <runDir>/setup.log, and the progress shows a setup step.
  • Non-zero exit fails the run: setup failed (exit N): <last line>; see <runDir>/setup.log. A file that is not executable gets a chmod +x error.
  • Completion is saved per run (src/setup.ts), so a resume runs it again only when it did not finish. Child runs that share their caller's worktree never run it.
  • No file means no setup, as before. workflows does not guess a setup from lockfiles.
  • This repository gets its own .workflows/setup with npm ci.

BEGIN_COMMIT_OVERRIDE
chore: run the repository's .workflows/setup in each new run worktree, reverted by #87
END_COMMIT_OVERRIDE

A run worktree is a fresh checkout with no dependencies, so almost
every implementer session spent its first turn on `npm ci`. A session
that forgot it failed its first check.

- The new module src/setup.ts runs `<worktree>/.workflows/setup` with
  no shell, in the worktree, after the script task creates the
  worktree (Git or Herdr) and before the script starts. Its stdout
  and stderr go to `<runDir>/setup.log`.
- A setup file that is not executable fails the run and says to
  `chmod +x` it. A non-zero exit fails the run with
  `setup failed (exit <code>): <last line>; see <log>`.
- The session document `workflows.setup`, keyed by the run ID,
  records a finished setup. A resume runs the setup again only when
  it did not finish. A child run in the worktree of its caller has no
  worktree of its own, so it runs no setup.
- The progress shows a `setup` step. The new `done` progress event
  ends the step when the setup finishes. `Progress.stepped` now looks
  for any step, because the run can have no current step after
  `done`.
- This repository gets `.workflows/setup` with a quiet `npm ci`.
- docs/spec.md describes `.workflows/setup`, `setup.log` and the
  `setup` step. The README gives one sentence on it.
- New tests cover a setup that fails and then passes at a resume,
  with its log and a marker file that the script reads before its
  first session. They also cover a file that is not executable, and
  a ship whose child runs do not run the setup again.
@Vzlentin
Vzlentin merged commit 92801f1 into main Nov 1, 2026
3 checks passed
@Vzlentin
Vzlentin deleted the feat/run-the-repository-s-workflows-setup-in-each-new branch November 1, 2026 01:57
@vzlentin-release vzlentin-release Bot mentioned this pull request Nov 1, 2026
Vzlentin added a commit that referenced this pull request Nov 1, 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.

1 participant