Home for temporary, one-off codemodification scripts for the Bitcode
repository. This directory lives at the repo root (.codemods/), not under
apps/uapi or any single app package.
Use .codemods/ for ephemeral, mechanical refactors that:
- rename identifiers, paths, or import prefixes across many files
- apply a bounded AST transform (e.g. jscodeshift) once or a few times
- are safe to delete after the migration lands and is verified
Do not put durable repo automation here. Ongoing gate checkers, promotion
verifiers, CI helpers, and long-lived maintenance tools belong under
scripts/ (see scripts/check-bitcode-*.mjs, gate scripts, etc.).
| Location | Purpose |
|---|---|
.codemods/ (this folder) |
Temporary / one-off codemods for Bitcode |
scripts/ |
Durable automation: gates, canon checks, promotion, tooling |
- One concern per script — name it for the transform, e.g.
migrate-ui-imports-to-base-shadcn.js. - Document usage at the top of the file — dry-run vs apply, target globs,
required tools (
node,npx jscodeshift, …). - Prefer dry-run first — never apply on a dirty tree without review.
- Delete when done — after the migration is merged and verified, remove the
script (or leave only historical notes in this README if useful). Do not let
.codemods/become a secondscripts/tree. - No product runtime — nothing under
.codemods/is imported by apps, packages, or CI required paths unless a human intentionally runs it.
.codemods/
├── README.md # this file
└── <transform-name>.js|.mjs|.ts # one-off scripts (add as needed)
jscodeshift transform: @/components/ui/<mod> → @/components/shadcn/<mod>.
# Dry-run
npx jscodeshift -d -p -t .codemods/migrate-ui-imports-to-base-shadcn.js \
'apps/uapi/app/**/*.tsx' 'apps/uapi/components/**/*.tsx'
# Apply
npx jscodeshift -t .codemods/migrate-ui-imports-to-base-shadcn.js \
'apps/uapi/app/**/*.tsx' 'apps/uapi/components/**/*.tsx'After --apply / non-dry runs: git diff, then lint/typecheck/tests for the
touched apps.
- Create
.codemods/<name>.js(or.mjs) with a short header comment and usage. - List it under Current scripts in this README (or remove the entry when you delete the script after the migration).
- Run dry-run → apply → review → test → commit the result of the codemod with product/source changes; keep the script only while still useful.
- Repo layout contract:
.docs/BITCODE_SOURCE_LAYOUT.md(§ monorepo roots and tooling homes). - Agents: temporary codemods are implementation tooling, not product
surface; do not version-prefix them (
v48-codemod-*).