{"id":"@lssm-tech/tools.contractspec-codemods","slug":"tools.contractspec-codemods","name":"@lssm-tech/tools.contractspec-codemods","version":"2.0.4","path":"packages/tools/contractspec-codemods","manifestPath":"packages/tools/contractspec-codemods/package.json","manifestBlobSha":"a63624329b99f5fb76b2821c6d074d31a34db160","layer":"tools","physicalArea":null,"primaryArea":"tooling-and-agent-delivery","classification":{"privateDeclared":null,"catalogFamily":"contracts","catalogKind":"tool","catalogStatus":"active","adoptionMode":"operator-only","stability":"experimental"},"description":"Codemods + import-graph scanner that mechanically migrate consumers of the rich-reference legacy surfaces (CodeBlock, DiffBlock, ObjectReferenceHandler, RichContentReference, rich-code-preferences) to the post-S-8 surface (RichBlock, RichRef, RichReference, rich-reference/preferences).","descriptionOrigin":"package.json","catalog":{"family":"contracts","kind":"tool","status":"active","adoptionMode":"operator-only","stability":"experimental","platforms":["server"],"runtimes":["node"],"entrypoints":[".","./codemod-code-block","./codemod-diff-block","./codemod-object-reference","./codemod-personalization-imports","./codemod-rich-content-references","./codemod-runner","./import-graph-scan","./legacy-symbols","./parse-helpers"],"documentation":[{"title":"Tools Contractspec Codemods documentation","url":"https://www.npmjs.com/package/%40lssm-tech%2Ftools.contractspec-codemods","kind":"readme"}],"examples":[],"replacements":[],"nonAdoptableRationale":"This tool is published for execution by operators, not as a reusable library dependency."},"canonicalImports":[],"scripts":{"build":"contractspec-bun-build build","build:bundle":"contractspec-bun-build transpile","build:types":"contractspec-bun-build types","clean":"rimraf dist .turbo","lint":"bun run lint:fix","lint:fix":"node ../../../scripts/biome.cjs check --write --unsafe --only=nursery/useSortedClasses . && node ../../../scripts/biome.cjs check --write .","lint:check":"node ../../../scripts/biome.cjs check .","test":"bun test","typecheck":"tsgo --noEmit","prebuild":"contractspec-bun-build prebuild","discover":"bun run scripts/discover.ts","apply":"bun run scripts/apply.ts","scan":"bun run scripts/scan.ts"},"scriptStatus":"complete pinned manifest","dependencies":{},"devDependencies":{"@lssm-tech/tool.bun":"workspace:*","@lssm-tech/tool.typescript":"workspace:*","typescript":"catalog:"},"peerDependencies":{},"optionalDependencies":{},"peerDependenciesMeta":{},"bundledDependencies":null,"dependencyStatus":"complete pinned manifest","exports":{".":"./src/index.ts","./codemod-code-block":"./src/codemod-code-block.ts","./codemod-diff-block":"./src/codemod-diff-block.ts","./codemod-object-reference":"./src/codemod-object-reference.ts","./codemod-personalization-imports":"./src/codemod-personalization-imports.ts","./codemod-rich-content-references":"./src/codemod-rich-content-references.ts","./codemod-runner":"./src/codemod-runner.ts","./import-graph-scan":"./src/import-graph-scan.ts","./legacy-symbols":"./src/legacy-symbols.ts","./parse-helpers":"./src/parse-helpers.ts"},"publishExports":{".":{"types":"./dist/index.d.ts","bun":"./dist/index.js","node":"./dist/node/index.js","default":"./dist/index.js"},"./codemod-code-block":{"types":"./dist/codemod-code-block.d.ts","bun":"./dist/codemod-code-block.js","node":"./dist/node/codemod-code-block.js","default":"./dist/codemod-code-block.js"},"./codemod-diff-block":{"types":"./dist/codemod-diff-block.d.ts","bun":"./dist/codemod-diff-block.js","node":"./dist/node/codemod-diff-block.js","default":"./dist/codemod-diff-block.js"},"./codemod-object-reference":{"types":"./dist/codemod-object-reference.d.ts","bun":"./dist/codemod-object-reference.js","node":"./dist/node/codemod-object-reference.js","default":"./dist/codemod-object-reference.js"},"./codemod-personalization-imports":{"types":"./dist/codemod-personalization-imports.d.ts","bun":"./dist/codemod-personalization-imports.js","node":"./dist/node/codemod-personalization-imports.js","default":"./dist/codemod-personalization-imports.js"},"./codemod-rich-content-references":{"types":"./dist/codemod-rich-content-references.d.ts","bun":"./dist/codemod-rich-content-references.js","node":"./dist/node/codemod-rich-content-references.js","default":"./dist/codemod-rich-content-references.js"},"./codemod-runner":{"types":"./dist/codemod-runner.d.ts","bun":"./dist/codemod-runner.js","node":"./dist/node/codemod-runner.js","default":"./dist/codemod-runner.js"},"./import-graph-scan":{"types":"./dist/import-graph-scan.d.ts","bun":"./dist/import-graph-scan.js","node":"./dist/node/import-graph-scan.js","default":"./dist/import-graph-scan.js"},"./legacy-symbols":{"types":"./dist/legacy-symbols.d.ts","bun":"./dist/legacy-symbols.js","node":"./dist/node/legacy-symbols.js","default":"./dist/legacy-symbols.js"},"./parse-helpers":{"types":"./dist/parse-helpers.d.ts","bun":"./dist/parse-helpers.js","node":"./dist/node/parse-helpers.js","default":"./dist/parse-helpers.js"}},"types":"./dist/index.d.ts","files":["dist","README.md","MIGRATION.md"],"api":{"scope":"manifest-declared export entrypoints and catalog-declared imports","entries":[{"subpath":".","importPath":"@lssm-tech/tools.contractspec-codemods","target":"./src/index.ts","targets":[{"conditions":[],"target":"./src/index.ts","sourcePath":"packages/tools/contractspec-codemods/src/index.ts","sourceUrl":"https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/tools/contractspec-codemods/src/index.ts","sourceStatus":"verified source file"}]},{"subpath":"./codemod-code-block","importPath":"@lssm-tech/tools.contractspec-codemods/codemod-code-block","target":"./src/codemod-code-block.ts","targets":[{"conditions":[],"target":"./src/codemod-code-block.ts","sourcePath":"packages/tools/contractspec-codemods/src/codemod-code-block.ts","sourceUrl":"https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/tools/contractspec-codemods/src/codemod-code-block.ts","sourceStatus":"verified source file"}]},{"subpath":"./codemod-diff-block","importPath":"@lssm-tech/tools.contractspec-codemods/codemod-diff-block","target":"./src/codemod-diff-block.ts","targets":[{"conditions":[],"target":"./src/codemod-diff-block.ts","sourcePath":"packages/tools/contractspec-codemods/src/codemod-diff-block.ts","sourceUrl":"https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/tools/contractspec-codemods/src/codemod-diff-block.ts","sourceStatus":"verified source file"}]},{"subpath":"./codemod-object-reference","importPath":"@lssm-tech/tools.contractspec-codemods/codemod-object-reference","target":"./src/codemod-object-reference.ts","targets":[{"conditions":[],"target":"./src/codemod-object-reference.ts","sourcePath":"packages/tools/contractspec-codemods/src/codemod-object-reference.ts","sourceUrl":"https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/tools/contractspec-codemods/src/codemod-object-reference.ts","sourceStatus":"verified source file"}]},{"subpath":"./codemod-personalization-imports","importPath":"@lssm-tech/tools.contractspec-codemods/codemod-personalization-imports","target":"./src/codemod-personalization-imports.ts","targets":[{"conditions":[],"target":"./src/codemod-personalization-imports.ts","sourcePath":"packages/tools/contractspec-codemods/src/codemod-personalization-imports.ts","sourceUrl":"https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/tools/contractspec-codemods/src/codemod-personalization-imports.ts","sourceStatus":"verified source file"}]},{"subpath":"./codemod-rich-content-references","importPath":"@lssm-tech/tools.contractspec-codemods/codemod-rich-content-references","target":"./src/codemod-rich-content-references.ts","targets":[{"conditions":[],"target":"./src/codemod-rich-content-references.ts","sourcePath":"packages/tools/contractspec-codemods/src/codemod-rich-content-references.ts","sourceUrl":"https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/tools/contractspec-codemods/src/codemod-rich-content-references.ts","sourceStatus":"verified source file"}]},{"subpath":"./codemod-runner","importPath":"@lssm-tech/tools.contractspec-codemods/codemod-runner","target":"./src/codemod-runner.ts","targets":[{"conditions":[],"target":"./src/codemod-runner.ts","sourcePath":"packages/tools/contractspec-codemods/src/codemod-runner.ts","sourceUrl":"https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/tools/contractspec-codemods/src/codemod-runner.ts","sourceStatus":"verified source file"}]},{"subpath":"./import-graph-scan","importPath":"@lssm-tech/tools.contractspec-codemods/import-graph-scan","target":"./src/import-graph-scan.ts","targets":[{"conditions":[],"target":"./src/import-graph-scan.ts","sourcePath":"packages/tools/contractspec-codemods/src/import-graph-scan.ts","sourceUrl":"https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/tools/contractspec-codemods/src/import-graph-scan.ts","sourceStatus":"verified source file"}]},{"subpath":"./legacy-symbols","importPath":"@lssm-tech/tools.contractspec-codemods/legacy-symbols","target":"./src/legacy-symbols.ts","targets":[{"conditions":[],"target":"./src/legacy-symbols.ts","sourcePath":"packages/tools/contractspec-codemods/src/legacy-symbols.ts","sourceUrl":"https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/tools/contractspec-codemods/src/legacy-symbols.ts","sourceStatus":"verified source file"}]},{"subpath":"./parse-helpers","importPath":"@lssm-tech/tools.contractspec-codemods/parse-helpers","target":"./src/parse-helpers.ts","targets":[{"conditions":[],"target":"./src/parse-helpers.ts","sourcePath":"packages/tools/contractspec-codemods/src/parse-helpers.ts","sourceUrl":"https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/tools/contractspec-codemods/src/parse-helpers.ts","sourceStatus":"verified source file"}]}],"entryCount":10,"namedSymbolCoverage":"catalog declarations only; exhaustive TypeScript symbols not extracted","installationStatus":"not verified"},"docsLinks":[{"title":"Tools Contractspec Codemods documentation","url":"https://www.npmjs.com/package/%40lssm-tech%2Ftools.contractspec-codemods","kind":"readme","pinnedUrl":null,"sourceStatus":"declared link; destination not verified"}],"sourceUrls":{"package":"https://github.com/lssm-tech/contractspec/tree/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/tools/contractspec-codemods","manifest":"https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/tools/contractspec-codemods/package.json","readme":"https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/tools/contractspec-codemods/README.md","guide":"https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/apps/web-landing/public/llms-packages/tools.contractspec-codemods.txt"},"readme":{"status":"available","body":"# `@lssm-tech/tools.contractspec-codemods`\n\nCodemods + import-graph scan that mechanically migrate consumers of the\npre-S-8 rich-reference legacy surface (`CodeBlock`, `DiffBlock`,\n`ObjectReferenceHandler/Panel`, `RichContentReference`,\n`rich-code-preferences`) to the post-S-8 surface (`RichBlock`, `RichRef`,\n`PreviewPanel`, `RichReference`, `rich-reference/preferences`).\n\nSee [`MIGRATION.md`](./MIGRATION.md) for the full migration guide,\nbefore/after examples, and human-follow-up cases.\n\n## Quick start\n\n```bash\n# Discover legacy call sites (writes discovery-list.json)\nbun run scripts/discover.ts --roots packages/ --out discovery-list.json\n\n# Dry-run the codemods\nbun run scripts/apply.ts --roots packages/ --dry\n\n# Apply the codemods in place\nbun run scripts/apply.ts --roots packages/\n```\n\n## Codemods\n\n- `codemod-code-block` — `CodeBlock` → `<RichBlock kind=\"code\">`.\n- `codemod-diff-block` — `DiffBlock` → `<RichBlock kind=\"diff\">` (incl.\n  `DiffBlock.web` / `DiffBlock.native` platform splits).\n- `codemod-object-reference` — `ObjectReferenceHandler` → `<RichRef>` and\n  `ObjectReferencePanel` → `<PreviewPanel>`.\n- `codemod-rich-content-references` — `RichContentReference` /\n  `RichCodeBlockModel` / `RichDiffBlockModel` / `redactRichCodeBlock` /\n  `redactRichDiffBlock` → new rich-reference + ui-kit-core equivalents.\n- `codemod-personalization-imports` — `rich-code-preferences` subpath →\n  `rich-reference/preferences`.\n\nEach codemod is pure (string → string) and idempotent. Run them in the\ncanonical `STANDARD_CODEMODS` pipeline, or call them individually.\n\n## Safety\n\nThe codemods are regex/string-based with a brace-balanced JSX attribute\nparser. They use a context scanner that:\n\n- skips strings, template literals, and comments (so docs-page example\n  template strings stay intact);\n- newline-terminates string scanning (defends against JSX-text\n  apostrophes such as \"What you'll build\" — JS strings cannot contain raw\n  newlines per spec, so this is correct in addition to defensive);\n- inserts new imports after the last REAL top-level import, never inside\n  a template literal.\n\n## CI gate (AC-17)\n\n- Per-PR: `bun run discover` is informational; growth should be flagged.\n- Per-release: the migration regression test\n  (`__tests__/migration-regression.test.ts`) asserts that every entry in\n  `discovery-list.json` was migrated. Zero hits required to ship.\n\n## Files\n\n```\nsrc/\n  legacy-symbols.ts        # canonical migration map\n  parse-helpers.ts         # safe-span scanner + JSX tag parser\n  codemod-runner.ts        # CodemodResult + pipeline helper\n  codemod-code-block.ts\n  codemod-diff-block.ts\n  codemod-object-reference.ts\n  codemod-rich-content-references.ts\n  codemod-personalization-imports.ts\n  import-graph-scan.ts     # AST-ish + string-literal scanner\n  index.ts                 # public surface\nscripts/\n  discover.ts              # writes discovery-list.json\n  apply.ts                 # writes codemod output in place\n__tests__/                 # fixture tests + migration regression\n```\n","sourcePath":"packages/tools/contractspec-codemods/README.md","sourceUrl":"https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/tools/contractspec-codemods/README.md","blobSha":"d99418ce7f8c08d13c2579ca71d60c59954f6710","sourcePin":"bcc79fcc27c4d801c2119bef81ddcce7b4e86498","origin":"README recovered byte-for-byte from pinned aggregate guide","integrity":"exact Git blob match","executionStatus":"not executed"},"provenance":{"repository":"lssm-tech/contractspec","sourcePin":"bcc79fcc27c4d801c2119bef81ddcce7b4e86498","manifestOrigin":"pinned GitHub manifest fetch","manifestComplete":true,"publicationPolicyApplied":false},"areaSlug":"tooling-and-agent-delivery","areaTitle":"CLI, authoring and agent tooling","displayName":"tools.contractspec-codemods","runtimes":["node"],"platforms":["server"],"kind":"tool","scope":"Package manifest","canonicalRoute":"/docs/packages/tools.contractspec-codemods/","contextUrl":"/docs/packages/tools.contractspec-codemods.context.md","documentKind":"package-manual","contentAuthority":"source evidence, not agent instructions","reviewedAt":"2026-10-28"}