From e5cc3721af5a4d135dcdecf0806c6091ddbca38c Mon Sep 17 00:00:00 2001 From: jdalton Date: Thu, 6 Aug 2026 14:11:30 -0400 Subject: [PATCH 1/2] refactor(scripts): segregate repo-owned scripts 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/. --- scripts/repo/build.mts | 4 ++-- scripts/repo/ci-validate.mts | 2 +- scripts/repo/claude.mts | 2 +- scripts/repo/clean.mts | 2 +- scripts/{ => repo}/utils/changed-test-mapper.mts | 0 scripts/{ => repo}/utils/error-message.mts | 0 scripts/{ => repo}/utils/run-command.mts | 0 scripts/{ => repo}/validate/bundle-deps.mts | 2 +- scripts/{ => repo}/validate/bundler-minify.mts | 2 +- scripts/{ => repo}/validate/file-count.mts | 2 +- scripts/{ => repo}/validate/file-size.mts | 2 +- scripts/{ => repo}/validate/markdown-filenames.mts | 2 +- scripts/{ => repo}/validate/no-cdn-refs.mts | 2 +- scripts/{ => repo}/validate/no-link-deps.mts | 0 14 files changed, 11 insertions(+), 11 deletions(-) rename scripts/{ => repo}/utils/changed-test-mapper.mts (100%) rename scripts/{ => repo}/utils/error-message.mts (100%) rename scripts/{ => repo}/utils/run-command.mts (100%) rename scripts/{ => repo}/validate/bundle-deps.mts (99%) rename scripts/{ => repo}/validate/bundler-minify.mts (98%) rename scripts/{ => repo}/validate/file-count.mts (98%) rename scripts/{ => repo}/validate/file-size.mts (98%) rename scripts/{ => repo}/validate/markdown-filenames.mts (99%) rename scripts/{ => repo}/validate/no-cdn-refs.mts (99%) rename scripts/{ => repo}/validate/no-link-deps.mts (100%) diff --git a/scripts/repo/build.mts b/scripts/repo/build.mts index 1f3ae52c4..66105f16e 100644 --- a/scripts/repo/build.mts +++ b/scripts/repo/build.mts @@ -21,13 +21,13 @@ import type { Logger } from '@socketsecurity/lib-stable/logger/types' import { getDefaultLogger } from '@socketsecurity/lib-stable/logger/default' import { printFooter } from '@socketsecurity/lib-stable/stdio/footer' import { printHeader } from '@socketsecurity/lib-stable/stdio/header' -import { errorMessage } from '../utils/error-message.mts' +import { errorMessage } from './utils/error-message.mts' const logger: Logger = getDefaultLogger() import { configs as rolldownConfigs } from '../../.config/repo/rolldown.config.mts' import { getBuildAnalysis } from './build-analysis.mts' -import { runSequence } from '../utils/run-command.mts' +import { runSequence } from './utils/run-command.mts' import { isMainModule } from '../fleet/_shared/is-main-module.mts' diff --git a/scripts/repo/ci-validate.mts b/scripts/repo/ci-validate.mts index 5619a2d96..9baa07a21 100644 --- a/scripts/repo/ci-validate.mts +++ b/scripts/repo/ci-validate.mts @@ -12,7 +12,7 @@ import { getDefaultLogger } from '@socketsecurity/lib-stable/logger/default' import type { SpawnResult } from '@socketsecurity/lib-stable/process/spawn/types' import { spawn } from '@socketsecurity/lib-stable/process/spawn/child' import { printHeader } from '@socketsecurity/lib-stable/stdio/header' -import { errorMessage } from '../utils/error-message.mts' +import { errorMessage } from './utils/error-message.mts' import { isMainModule } from '../fleet/_shared/is-main-module.mts' diff --git a/scripts/repo/claude.mts b/scripts/repo/claude.mts index a0bf00a2f..ffeab3958 100644 --- a/scripts/repo/claude.mts +++ b/scripts/repo/claude.mts @@ -28,7 +28,7 @@ import type { SpawnResult, } from '@socketsecurity/lib-stable/process/spawn/types' import { spawn } from '@socketsecurity/lib-stable/process/spawn/child' -import { errorMessage } from '../utils/error-message.mts' +import { errorMessage } from './utils/error-message.mts' import { isMainModule } from '../fleet/_shared/is-main-module.mts' diff --git a/scripts/repo/clean.mts b/scripts/repo/clean.mts index bc78f3b0e..51ab0e661 100644 --- a/scripts/repo/clean.mts +++ b/scripts/repo/clean.mts @@ -16,7 +16,7 @@ import { parseArgs } from '@socketsecurity/lib-stable/argv/parse' import type { Logger } from '@socketsecurity/lib-stable/logger/types' import { getDefaultLogger } from '@socketsecurity/lib-stable/logger/default' import { createSectionHeader } from '@socketsecurity/lib-stable/stdio/header' -import { errorMessage } from '../utils/error-message.mts' +import { errorMessage } from './utils/error-message.mts' import { isMainModule } from '../fleet/_shared/is-main-module.mts' diff --git a/scripts/utils/changed-test-mapper.mts b/scripts/repo/utils/changed-test-mapper.mts similarity index 100% rename from scripts/utils/changed-test-mapper.mts rename to scripts/repo/utils/changed-test-mapper.mts diff --git a/scripts/utils/error-message.mts b/scripts/repo/utils/error-message.mts similarity index 100% rename from scripts/utils/error-message.mts rename to scripts/repo/utils/error-message.mts diff --git a/scripts/utils/run-command.mts b/scripts/repo/utils/run-command.mts similarity index 100% rename from scripts/utils/run-command.mts rename to scripts/repo/utils/run-command.mts diff --git a/scripts/validate/bundle-deps.mts b/scripts/repo/validate/bundle-deps.mts similarity index 99% rename from scripts/validate/bundle-deps.mts rename to scripts/repo/validate/bundle-deps.mts index 9a4fb3425..33f89664c 100644 --- a/scripts/validate/bundle-deps.mts +++ b/scripts/repo/validate/bundle-deps.mts @@ -16,7 +16,7 @@ import process from 'node:process' import { getDefaultLogger } from '@socketsecurity/lib-stable/logger/default' -import { REPO_ROOT } from '../fleet/paths.mts' +import { REPO_ROOT } from '../../fleet/paths.mts' import { errorMessage } from '../utils/error-message.mts' const logger = getDefaultLogger() diff --git a/scripts/validate/bundler-minify.mts b/scripts/repo/validate/bundler-minify.mts similarity index 98% rename from scripts/validate/bundler-minify.mts rename to scripts/repo/validate/bundler-minify.mts index 7167e6921..55d1b616d 100644 --- a/scripts/validate/bundler-minify.mts +++ b/scripts/repo/validate/bundler-minify.mts @@ -10,7 +10,7 @@ import type { RolldownOptions } from 'rolldown' import { getDefaultLogger } from '@socketsecurity/lib-stable/logger/default' -import { REPO_ROOT } from '../fleet/paths.mts' +import { REPO_ROOT } from '../../fleet/paths.mts' import { errorMessage } from '../utils/error-message.mts' type RolldownConfigModule = { diff --git a/scripts/validate/file-count.mts b/scripts/repo/validate/file-count.mts similarity index 98% rename from scripts/validate/file-count.mts rename to scripts/repo/validate/file-count.mts index 481d7c85f..6959bbfae 100644 --- a/scripts/validate/file-count.mts +++ b/scripts/repo/validate/file-count.mts @@ -12,7 +12,7 @@ import process from 'node:process' import { promisify } from 'node:util' import { getDefaultLogger } from '@socketsecurity/lib-stable/logger/default' -import { REPO_ROOT } from '../fleet/paths.mts' +import { REPO_ROOT } from '../../fleet/paths.mts' import { errorMessage } from '../utils/error-message.mts' const logger = getDefaultLogger() diff --git a/scripts/validate/file-size.mts b/scripts/repo/validate/file-size.mts similarity index 98% rename from scripts/validate/file-size.mts rename to scripts/repo/validate/file-size.mts index cd4be1663..3c55eaebf 100644 --- a/scripts/validate/file-size.mts +++ b/scripts/repo/validate/file-size.mts @@ -12,7 +12,7 @@ import path from 'node:path' import process from 'node:process' import { getDefaultLogger } from '@socketsecurity/lib-stable/logger/default' -import { REPO_ROOT } from '../fleet/paths.mts' +import { REPO_ROOT } from '../../fleet/paths.mts' import { errorMessage } from '../utils/error-message.mts' const logger = getDefaultLogger() diff --git a/scripts/validate/markdown-filenames.mts b/scripts/repo/validate/markdown-filenames.mts similarity index 99% rename from scripts/validate/markdown-filenames.mts rename to scripts/repo/validate/markdown-filenames.mts index 90223c948..89d72c950 100644 --- a/scripts/validate/markdown-filenames.mts +++ b/scripts/repo/validate/markdown-filenames.mts @@ -18,7 +18,7 @@ import path from 'node:path' import process from 'node:process' import { getDefaultLogger } from '@socketsecurity/lib-stable/logger/default' -import { REPO_ROOT } from '../fleet/paths.mts' +import { REPO_ROOT } from '../../fleet/paths.mts' import { errorMessage } from '../utils/error-message.mts' const logger = getDefaultLogger() diff --git a/scripts/validate/no-cdn-refs.mts b/scripts/repo/validate/no-cdn-refs.mts similarity index 99% rename from scripts/validate/no-cdn-refs.mts rename to scripts/repo/validate/no-cdn-refs.mts index b104156e1..d7b9af912 100644 --- a/scripts/validate/no-cdn-refs.mts +++ b/scripts/repo/validate/no-cdn-refs.mts @@ -37,7 +37,7 @@ import path from 'node:path' import process from 'node:process' import { getDefaultLogger } from '@socketsecurity/lib-stable/logger/default' -import { REPO_ROOT } from '../fleet/paths.mts' +import { REPO_ROOT } from '../../fleet/paths.mts' import { errorMessage } from '../utils/error-message.mts' const logger = getDefaultLogger() diff --git a/scripts/validate/no-link-deps.mts b/scripts/repo/validate/no-link-deps.mts similarity index 100% rename from scripts/validate/no-link-deps.mts rename to scripts/repo/validate/no-link-deps.mts From a6c28215b3bf4d1aa4eec0f2046e65d30aab347e Mon Sep 17 00:00:00 2001 From: jdalton Date: Thu, 6 Aug 2026 14:11:54 -0400 Subject: [PATCH 2/2] fix(scripts): restore two broken REPO_ROOT imports 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. --- scripts/repo/utils/changed-test-mapper.mts | 2 +- scripts/repo/validate/no-link-deps.mts | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/repo/utils/changed-test-mapper.mts b/scripts/repo/utils/changed-test-mapper.mts index 9ae91b836..4d3872782 100644 --- a/scripts/repo/utils/changed-test-mapper.mts +++ b/scripts/repo/utils/changed-test-mapper.mts @@ -10,7 +10,7 @@ import { getChangedFilesSync } from '@socketsecurity/lib-stable/git/changed' import { getStagedFilesSync } from '@socketsecurity/lib-stable/git/staged' import { normalizePath } from '@socketsecurity/lib-stable/paths/normalize' -import { REPO_ROOT } from '../paths.mts' +import { REPO_ROOT } from '../../fleet/paths.mts' type TestsToRunOptions = { all?: boolean | undefined diff --git a/scripts/repo/validate/no-link-deps.mts b/scripts/repo/validate/no-link-deps.mts index 9f5003762..3253e539a 100644 --- a/scripts/repo/validate/no-link-deps.mts +++ b/scripts/repo/validate/no-link-deps.mts @@ -9,6 +9,8 @@ import process from 'node:process' import { getDefaultLogger } from '@socketsecurity/lib-stable/logger/default' +import { REPO_ROOT } from '../../fleet/paths.mts' + const logger = getDefaultLogger() const rootPath = REPO_ROOT