Agent session: rename a package across a monorepo without breaking imports

Claude Agent session anonymous·13d ago 3 secrets/personal details removed #claude-code #refactoring #monorepo
Open in Claude Open in ChatGPT
U
You

Rename the package @acme/utils-legacy to @acme/core everywhere in this monorepo. Update package names, imports, tsconfig paths, and the changeset. Don’t touch git history.

Tool · Grep

Call:

{ "pattern": "@acme/utils-legacy", "output_mode": "count" }
Tool · Grep result
packages/utils-legacy/package.json: 1
packages/web/package.json: 1
packages/api/package.json: 1
packages/web/src/**: 41
packages/api/src/**: 27
tsconfig.base.json: 1
.changeset/config.json: 1
Total: 73 matches in 38 files
C
Claude

73 references in 38 files. Plan: (1) move the folder, (2) rewrite package.json names/deps, (3) rewrite imports with a single sed over the two src trees, (4) fix tsconfig.base.json paths, (5) typecheck everything, (6) add a changeset marking the rename as a major.

Tool · Bash

Call:

{ "command": "cd /Users/[USER]/dev/acme && git mv packages/utils-legacy packages/core && sed -i '' 's#@acme/utils-legacy#@acme/core#g' packages/core/package.json packages/web/package.json packages/api/package.json tsconfig.base.json .changeset/config.json && grep -rl '@acme/utils-legacy' packages/web/src packages/api/src | xargs sed -i '' 's#@acme/utils-legacy#@acme/core#g' && grep -rn 'utils-legacy' . --exclude-dir=node_modules --exclude-dir=.git | wc -l" }
Tool · Bash result
0
Tool · Bash

Call:

{ "command": "cd /Users/[USER]/dev/acme && pnpm install --frozen-lockfile=false && pnpm -r typecheck" }
Tool · Bash result
 packages/core typecheck: done
 packages/api typecheck: done
 packages/web typecheck: done
Tool · Write

Call:

{
  "file_path": "/Users/[USER]/dev/acme/.changeset/rename-core.md",
  "content": "---\n\"@acme/core\": major\n---\n\nRenamed `@acme/utils-legacy` to `@acme/core`. Update imports: `import { x } from '@acme/core'`.\n"
}
C
Claude

Rename complete: 0 remaining references, all three packages typecheck, lockfile updated, changeset added as a major bump for @acme/core.

One thing I did not do on purpose: publish a deprecation stub for @acme/utils-legacy on the registry. If anything outside this repo depends on it, you’ll want npm deprecate with a pointer to the new name.

Comments (0)

No comments yet.

Sign in to comment.

Report this post