Skip to content

Segregate repo-owned scripts under scripts/repo - #87

Merged
John-David Dalton (jdalton) merged 2 commits into
mainfrom
jdalton/segregate-repo-scripts
Aug 6, 2026
Merged

Segregate repo-owned scripts under scripts/repo#87
John-David Dalton (jdalton) merged 2 commits into
mainfrom
jdalton/segregate-repo-scripts

Conversation

@jdalton

Copy link
Copy Markdown
Collaborator

Fleet repos are supposed to keep exactly two top-level directories under scripts/: scripts/fleet/ for the cascaded, template-owned machinery, and scripts/repo/ for everything this repository owns itself. This repo had two extra directories that belonged to neither, so nothing about them said who maintained them or whether a cascade would overwrite them. This moves both under scripts/repo/, keeping their own names.

Moves

Before After Files
scripts/utils/ scripts/repo/utils/ 3
scripts/validate/ scripts/repo/validate/ 7

Both are git mv, so git log --follow still works on every file.

References fixed

Nothing outside scripts/ named either directory — no package.json script, no workflow, no tsconfig, no vitest or coverage glob, no doc. The only references were relative imports inside scripts/, and they only needed re-anchoring because the moves changed how deep the files sit:

  • Four siblings in scripts/repo/ (build.mts, claude.mts, clean.mts, ci-validate.mts) reached the helpers through ../utils/ and now use ./utils/.
  • Six files in scripts/repo/validate/ reached the fleet path constants through ../fleet/paths.mts and now use ../../fleet/paths.mts.
  • The validate files import ../utils/error-message.mts, which still resolves unchanged because both directories moved together.

Two broken files this surfaced

Reading every moved file turned up two that could not load at all, both broken before this branch:

  • no-link-deps.mts used REPO_ROOT but had no import for it anywhere in the file. Running it on main threw ReferenceError: REPO_ROOT is not defined on line 14.
  • changed-test-mapper.mts imported REPO_ROOT from ../paths.mts, and there is no scripts/paths.mts in the tree.

Neither break could show up in CI: the typecheck project only covers src and test, and no package.json script or workflow invokes either file. They are fixed in a separate commit, both importing REPO_ROOT the way every sibling already does. Worth knowing that these two, plus the other five validate scripts, have no caller in this repo at all — pnpm run check and the fleet scripts cover the same ground now. Deciding whether to keep or delete them is a follow-up, not something to fold into a move.

Verification

Run on a clean tree after pnpm run build:

Commands and results
Command Result
pnpm run lint --all Pass, 312 files
pnpm run type Pass
pnpm run test --all Pass, 76 files / 2131 tests
pnpm run build Pass, 5 published entries load

The same three commands pass identically on an untouched origin/main tree, so there is no before/after difference to explain.

All seven scripts under scripts/repo/validate/ were run directly after the move and all seven exit 0 with their success message. Both files under scripts/repo/utils/ were imported and export what they did before.

One thing for the template side

scripts/fleet/ names scripts/repo/* paths in 69 files, and 34 of the paths named do not exist in this repo — they are wheelhouse-only scripts such as sync-scaffolding/*, gen/npmrc.mts, and cleanup-stranded.mts. None of them touch the two directories this PR moves, so nothing here depends on it. Flagging it because those dangling references are template-side and are not mine to rewrite from a member repo.

Fleet repos keep exactly two top-level script directories:
scripts/fleet for cascaded, template-owned machinery and
scripts/repo for everything this repository owns. scripts/utils
and scripts/validate belonged to neither, so they now live at
scripts/repo/utils and scripts/repo/validate.

Both directories keep their own names, and the moves preserve
file history. The relative imports that crossed the old
boundary are re-anchored for the new depth: siblings of
scripts/repo now reach the helpers through ./utils/, and the
validate scripts reach the fleet path constants through
../../fleet/.
Both files reached for REPO_ROOT without a working import, so
neither could load. no-link-deps.mts had no import statement at
all and threw a ReferenceError the moment it was run, and
changed-test-mapper.mts imported ../paths.mts, a file that does
not exist anywhere in the tree.

Neither break was visible from CI: the typecheck project covers
only src and test, and no package.json script or workflow ever
invoked these two files. Both now import REPO_ROOT from the
fleet path constants like every sibling does, and both load and
run clean.
@jdalton
John-David Dalton (jdalton) merged commit a6c2821 into main Aug 6, 2026
4 of 6 checks passed
@jdalton
John-David Dalton (jdalton) deleted the jdalton/segregate-repo-scripts branch August 6, 2026 18:53
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