To rename a function, class, or constant across your NestJS repository in 2026, Atlas combines the `lsp` tool's precise reference finding with `grep` for comprehensive coverage, then applies changes with `edit` and validates them using `jest` and `prettier`.
How does Atlas rename symbols in a NestJS project?
Atlas renames symbols across NestJS projects by first using the `lsp` tool to find all 100% accurate references from the language server, then supplementing this with `grep` to catch string literals and comments. This hybrid approach ensures no usage of a function, class, or constant is missed, even in a complex NestJS application.
Renaming a symbol in a NestJS codebase with Atlas begins by leveraging the `lsp` tool's `findReferences` operation. This connects to your language server to retrieve an authoritative, AST-based list of all true references to the target function, class, or constant. This is crucial for NestJS, where symbols can be used across `@Module` imports, provider injections, and DTO definitions. Following this, Atlas employs its `grep` tool to scan for occurrences outside the type system, such as string literals in configuration files like `nest-cli.json`, comments in `main.ts`, or documentation that the compiler would not see. The mechanical application of these renames is handled by the `edit` tool, which uses `replaceAll` to apply changes. A key safety feature of `edit` is its refusal to perform ambiguous single replacements; if it finds multiple matches for an old string in a file where only one change is intended, it will throw an error rather than silently corrupting your NestJS code.
What NestJS commands and files are involved in an Atlas symbol rename?
When renaming a symbol in a NestJS application, Atlas interacts directly with your project's `nest-cli.json` and `app.module.ts` files, ensuring changes are reflected correctly across modules and providers. The process concludes with running `pnpm test` to execute `jest` and `pnpm format` for `prettier` to maintain code quality, typically involving 2 to 3 distinct `bash` commands.
Atlas is designed to integrate direct with the NestJS toolchain. During a symbol rename, Atlas will read your project's structure, including `@Module` imports and exports, provider scopes, and DTOs wired to your `ValidationPipe`, by analyzing files like `app.module.ts` and other module definitions. The validation phase is critical: Atlas uses its `bash` tool to execute `pnpm test`, which in turn runs `jest`, the standard NestJS test runner. Atlas can even build a `Test.createTestingModule` harness to ensure your unit and integration tests accurately reflect the refactored code. After successful testing, Atlas can then use `bash` to run `pnpm format`, applying `prettier` across all touched NestJS providers and modules to maintain consistent code style. This ensures that the refactoring not only works functionally but also adheres to your team's formatting standards, leaving your `nest-cli.json` and other configuration files untouched unless explicitly part of the rename.
How does Atlas ensure safe refactoring and review for NestJS symbol renames?
Atlas prioritizes safety in NestJS refactoring by presenting a unified diff for every file edit, allowing developers to approve changes before they are written. Each tool call, including `lsp` and `edit`, is permission-gated, requiring explicit `allow` or `ask` rules to proceed, preventing unintended modifications. This robust system provides 100% control over your NestJS codebase.
Safety and developer control are paramount when refactoring a NestJS application. Atlas implements several mechanisms to ensure a secure and reviewable symbol rename. Firstly, every Atlas tool call, whether it's `lsp` for finding references or `edit` for applying changes, is permission-gated. This means operations are only executed based on `allow`, `ask`, or `deny` rules, giving you granular control over what Atlas can do. Before any changes are written to your NestJS files, Atlas computes and surfaces a unified diff for every proposed edit, allowing you to review and approve each modification. This visual diff, rendered with SolidJS through the OpenTUI renderer, ensures transparency. Furthermore, Atlas drafts its plan in a read-only plan agent and asks for approval before switching to a build agent that can make changes. Atlas also snapshots file changes as git patches, enabling easy diffing and rollback of edits. For version control, Atlas reads git branches, status, and diffs, and can stage and create commits on your behalf, ensuring your NestJS project's history remains clean and accurate.
Step by step
- 01Run `lsp findReferences` on the NestJS symbol: Initiate the rename by asking Atlas to use its `lsp` tool to execute `findReferences` on the target function, class, or constant within your NestJS codebase. This leverages the language server to get an authoritative list of all type-aware usages across your `app.module.ts` and other NestJS modules.
- 02Execute `grep` for non-code occurrences: Instruct Atlas to run its `grep` tool for the old symbol name. This step catches instances outside the type system, such as string literals in DTOs, comments in `main.ts`, documentation, or configuration within `nest-cli.json` that the language server might miss.
- 03Apply mechanical renames with `edit replaceAll`: Direct Atlas to use its `edit` tool with the `replaceAll` operation. Atlas will apply the mechanical renames across the identified files, ensuring that each match is unambiguous per file. If `edit` finds multiple ambiguous matches for a single replacement, it will error rather than corrupting your NestJS code.
- 04Compile and test the NestJS application: Ask Atlas to use its `bash` tool to run your NestJS tests. This typically involves `pnpm test` which executes `jest`. Atlas can build a `Test.createTestingModule` harness if needed, and will surface the `jest` output for review, ensuring the refactor has not introduced regressions.
- 05Format code with `prettier` and re-grep for validation: After successful tests, instruct Atlas to run `pnpm format` using its `bash` tool to apply `prettier` across touched NestJS providers and modules. Finally, run `grep` once more for the old name to confirm zero remaining hits, proving the rename is complete and clean.
- 06Review and commit changes: Atlas will present a unified diff of all changes. Review the modifications to your NestJS files, including `app.module.ts` and any DTOs. Once satisfied, approve the changes, and Atlas can stage and create a commit on your behalf, documenting the symbol rename.
Frequently asked questions
- How does Atlas handle NestJS dependency injection during a rename?
- Atlas leverages the `lsp` tool's understanding of your NestJS project's AST, including `@Module` imports/exports and provider scopes, to accurately identify and rename symbols used in dependency injection, ensuring the container remains functional.
- Can Atlas rename a NestJS DTO property used in a `ValidationPipe`?
- Yes, Atlas can rename DTO properties. It uses `lsp` to find references within your NestJS code and `grep` to catch string literals, ensuring that usages wired to your `ValidationPipe` or other decorators are updated correctly.
- What if Atlas finds multiple matches for a symbol in a NestJS file?
- If Atlas's `edit` tool finds multiple ambiguous matches for a single replacement operation within a NestJS file, it will throw an error rather than proceeding, preventing unintended code corruption. You would then need to provide more context or explicitly opt into `replaceAll`.
- How does Atlas ensure my NestJS tests still pass after a rename?
- Atlas integrates with your NestJS test runner. After applying renames, it uses the `bash` tool to execute `pnpm test`, which runs `jest`. Atlas can even build a `Test.createTestingModule` harness to validate the refactor.
- Does Atlas support renaming symbols across multiple NestJS modules?
- Absolutely. Atlas's `lsp` tool builds its code index using AST declarations, allowing it to accurately trace symbol usage across all your NestJS modules, providers, and even across different `app.module.ts` configurations.
- How does Atlas prevent accidental changes to my NestJS codebase?
- Atlas employs several safety measures: every tool call is permission-gated, it drafts a plan in a read-only agent, presents a unified diff for approval before writing, and `edit` refuses ambiguous single replacements.
- Can Atlas update `prettier` formatting after a NestJS symbol rename?
- Yes, Atlas can integrate with your NestJS formatter. After completing the symbol rename and validating tests, you can instruct Atlas to use its `bash` tool to run `pnpm format`, applying `prettier` across all touched files.
Try Atlas in your terminal
The terminal-native AI coding agent. Free core, single binary.
Install AtlasRelated guides
Rename a Symbol Across the Repo with Atlas in 2026
How to rename a symbol across a repo with Atlas in 2026: findReferences gets the true reference set, grep catches strings and docs, and edit refuses ambiguous matches.
Onboard to an unfamiliar codebase in NestJS with Atlas in 2026
Quickly build a mental model of any NestJS codebase using Atlas. Leverage semantic search, AST indexing, and permission-gated tools to understand modules, providers, and DTOs without reading every file.
Research a Third-Party API Before Integrating it in NestJS with Atlas in 2026
Streamline third-party API research for NestJS projects in 2026 with Atlas. Discover how Atlas uses websearch and webfetch to get current API shapes, ensuring your NestJS integration is accurate and secure, then
Upgrade a Dependency and Fix Breakage in NestJS with Atlas in 2026
In 2026, Atlas helps NestJS developers upgrade dependencies and resolve compile and test failures. It drives `pnpm`, interprets `jest` output, and applies fixes with precision.
Audit a NestJS Repository with Parallel Subagents in 2026
Audit your NestJS codebase efficiently in 2026 using Atlas's parallel subagents. Sweep for problems across modules, providers, and DTOs without blowing your context window, leveraging `jest` and `prettier`.
Run the Test Suite and Triage Failures in NestJS with Atlas in 2026
Streamline NestJS test triage in 2026 with Atlas. Turn walls of red `jest` output into prioritized, distinct root causes using `pnpm`, `grep`, and `todowrite`.
Plan a Multi-File Change Before Editing in NestJS with Atlas in 2026
Design and review complex, multi-file changes in your NestJS project using Atlas's plan agent. Get feedback on your strategy before modifying a single line of code, integrating with `jest`, `pnpm`, and `prettier`.
Debug a single failing test in NestJS with Atlas in 2026
Pinpoint and fix failing NestJS tests efficiently with Atlas. Leverage `jest` filters, LSP navigation, and AI-driven code edits for rapid debugging in 2026.