@theokit/codemod-sdk-2-0
v1.0.0
Published
Downstream consumer migration tool for the @theokit/sdk → @theokit/sdk-core rename (SDK 2.0). Walks the project + rewrites package.json + source imports.
Downloads
106
Maintainers
Readme
@theokit/codemod-sdk-2-0
Migration codemod for the @theokit/sdk → @theokit/sdk-core
rename (SDK 2.0 cohort cutover).
What it does
Walks your project + rewrites:
package.json: renames
@theokit/sdkkey independencies/devDependencies/peerDependencies/optionalDependencies(preserves the version constraint). Also renamespeerDependenciesMetakey when present. If the package.json's ownnamefield is@theokit/sdk, renames that too.Source imports: rewrites
@theokit/sdk→@theokit/sdk-corein*.ts,*.tsx,*.mts,*.cts,*.js,*.mjs,*.cjsfiles. Uses negative-lookahead so sub-packages (@theokit/sdk-memory,-budget,-cache,-handoff,-tools) are NEVER touched.Documentation: rewrites
@theokit/sdkin*.mdfiles with the same negative-lookahead invariant.
Skips: node_modules, dist, build, .next, .git, coverage,
.turbo, .vitest-cache, .pnpm-store. Files > 1 MB skipped.
Usage
# Dry-run (default) — reports what would change without modifying
npx @theokit/codemod-sdk-2-0
# Apply changes
npx @theokit/codemod-sdk-2-0 --write
# Apply + preserve .bak per modified file
npx @theokit/codemod-sdk-2-0 --write --backup
# Target a different directory
npx @theokit/codemod-sdk-2-0 --root path/to/projectRecommended flow
- Commit any uncommitted work.
- Run dry-run + inspect the report:
npx @theokit/codemod-sdk-2-0 - Apply with backup:
npx @theokit/codemod-sdk-2-0 --write --backup - Update your peerDep version constraint manually if you pinned
@theokit/sdkto a1.xversion:- "@theokit/sdk-core": ">=1.7.0" + "@theokit/sdk-core": "^2.0.0" - Reinstall:
pnpm install # or npm install / yarn install - Run your test suite. If everything passes, commit + drop the
.bakfiles:find . -name "*.bak" -delete git add -A git commit -m "migrate to @theokit/sdk-core (SDK 2.0)"
What changed in SDK 2.0
- Package renamed
@theokit/sdk→@theokit/sdk-core. - Major bumped to 2.0.0.
- Memory subsystem extracted to
@theokit/sdk-memory(Stage 3 source-move). sdk-core's publicMemoryclass +migrateSqliteToLancewrapper routes through it when installed; falls back to legacy internal copy when absent (Stage 4 optional-peer routing). - Budget / cache / handoff / tools subsystems were extracted earlier (Phases 2-5) — no code change needed in this rename.
Behavioral invariants the codemod preserves
The codemod does not:
- Touch sub-package specifiers (
@theokit/sdk-memory, etc.). - Modify lockfiles (run your package manager's install command after migration).
- Bump the version constraint (operator step — needed only if
you previously pinned
@theokit/sdk@^1.x.x). - Run tests (you run them after).
License
MIT.
