Skip to content

refactor(scripts): segregate repo-owned script dirs - #309

Closed
John-David Dalton (jdalton) wants to merge 3 commits into
mainfrom
jdalton/segregate-repo-scripts
Closed

refactor(scripts): segregate repo-owned script dirs#309
John-David Dalton (jdalton) wants to merge 3 commits into
mainfrom
jdalton/segregate-repo-scripts

Conversation

@jdalton

@jdalton John-David Dalton (jdalton) commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

Root scripts/ is meant to hold exactly two tiers: scripts/fleet/ for cascaded machinery the template owns, and scripts/repo/ for tooling this repo owns. Seven directories sat loose at the root instead, so nothing in the tree said which side of that line they were on. This moves all seven under scripts/repo/, each keeping its own name.

Moves

Before After Files
scripts/ci/ scripts/repo/ci/ 3
scripts/constants/ scripts/repo/constants/ 8
scripts/maintenance/ scripts/repo/maintenance/ 4
scripts/npm/ scripts/repo/npm/ 42
scripts/templates/ scripts/repo/templates/ 59
scripts/testing/ scripts/repo/testing/ 4
scripts/validation/ scripts/repo/validation/ 3

Every move is a git mv, so blame and history follow the files.

What had to change with them

Imports between the seven directories are untouched, because they all moved together and their relative distance never changed. What did change:

Reference sites updated, by kind
  • 26 files inside the moved tree, for imports that crossed the boundary. Reaching out to scripts/fleet/ gained a level (../fleet/ to ../../fleet/); reaching into scripts/repo/ lost one (../repo/util/ to ../util/).
  • 10 files already under scripts/repo/ that imported the old locations, mostly scripts/repo/util/* pulling constants.
  • 13 package.json script entries, plus the run: step in .github/workflows/npm-publish-packages.yml.
  • 23 test files and 1 perf fixture, for imports and for the source paths a few tests read off disk.
  • 4 docs: CLAUDE.md, two files under docs/agents.md/repo/, and a pnpm-workspace.yaml comment.

Two lookups built their path one segment at a time rather than as a single string, so searching for the old text did not find them: the weekly update chain resolving update-manifest.mts in scripts/repo/update.mts, and three publish tests reading their own source. floor-node-smoke.mts also walks one more directory up to reach the repo root.

The pnpm-workspace.yaml comment pointed at scripts/constants/socket-scopes.mts, which never existed — the file is scripts/fleet/constants/socket-scopes.mts. Rather than carry the mistake forward under a new prefix, it now names the real file.

Six file-doc headers switch from /** to /*. They carry markdown that the formatter strips out of a JSDoc block, and markdown-doc-headers-are-plain only scans scripts/repo/, so the move is what brought them into view.

Verification

pnpm run lint --all, pnpm run type, and pnpm test --all are all green (2790 passing). pnpm run check fails 11 checks, the same 11 that fail on a clean origin/main worktree, with the same findings.

Not yet resolved, and both belong upstream in the wheelhouse rather than here. entry-scripts-are-fail-soft counts 5 unguarded entrypoints on main and 28 here — the check reads only scripts/fleet/ and scripts/repo/, so the 23 extra are pre-existing violations the move made visible, not new ones. Separately, the markdownlint ignore glob **/scripts/templates/** in .config/fleet/.markdownlint-cli2.jsonc no longer matches, which adds 6 MD041 findings on the package-README templates; that config is template-owned, so the glob wants widening at the source.

#308 touches scripts/npm/configure-staged-publishing-browser.mts and will need a path rebase once this lands.


Note

Low Risk
Path-only relocation with broad reference updates; no publish or runtime behavior change intended. Residual risk is a missed stale path or a markdownlint glob still targeting the old scripts/templates/ location.

Overview
Moves seven repo-owned script trees from loose scripts/<name>/ paths into scripts/repo/<name>/ (ci, constants, maintenance, npm, templates, testing, validation), so scripts/ only exposes fleet/ (cascaded) vs repo/ (this registry).

Updates every caller of those entrypoints: root package.json scripts, the npm-publish-packages.yml stage step, imports across moved files (extra ../ for scripts/fleet/, shorter paths for repo util/), tests/perf fixtures, and agent docs (CLAUDE.md, architecture.md, override-impact-analysis.md). pnpm-workspace.yaml now points Socket-scope soak bypass comments at scripts/fleet/constants/socket-scopes.mts instead of a non-existent scripts/constants/ path.

Small follow-on fixes inside the moved tree: scripts/repo/update.mts resolves update-manifest.mts under scripts/repo/npm/; floor-node-smoke.mts walks one more level to the repo root; six file headers switch from /** to /* so markdown in headers survives formatting under repo-owned lint rules.

Reviewed by Cursor Bugbot for commit abf28dc. Configure here.

The fleet script layout gives root scripts/ exactly two tiers:
scripts/fleet/ for cascaded, template-owned machinery and
scripts/repo/ for this repo's own tooling. Seven directories sat
loose at the root instead, so nothing said whether a cascade owned
them: ci, constants, maintenance, npm, templates, testing, and
validation.

Each directory keeps its name and moves down one level, so
scripts/npm/publish-npm-packages.mts is now
scripts/repo/npm/publish-npm-packages.mts. Imports between the
moved directories are unchanged because they moved together.
Imports that reached out to scripts/fleet gained a level, imports
that reached into scripts/repo lost one, and floor-node-smoke.mts
walks up one more directory to find the repo root.

Six file-doc headers switch from /** to /*. They carry markdown
that the formatter strips out of a JSDoc block, and the fleet check
that catches this only reads scripts/repo, so the move brought them
into view.
Everything that named a moved script now names its new home: the
13 package.json script entries, the npm-publish workflow step, the
perf fixture import, and the test suite's imports and read paths.

Two path lookups were built segment by segment rather than as one
string, so a search for the old text missed them. The weekly update
chain resolved update-manifest.mts by joining 'scripts' and 'npm',
and three publish tests read their source files the same way. Both
now include the repo segment.
CLAUDE.md and the two repo agent docs pointed at the old script
locations. The workspace catalog comment pointed at a path that
never existed: socket-scopes.mts lives under scripts/fleet/
constants, not scripts/constants, so the move would have carried
the mistake forward. It now names the real file.
@jdalton

Copy link
Copy Markdown
Collaborator Author

[agent] Closing: fleet members land directly on main rather than through PRs. The work stands unchanged and lands as commits.

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