Refactoring a legacy SolidJS module without introducing regressions is a critical task in 2026, and Atlas streamlines this process by mapping public surfaces, pinning behavior with `vitest (@solidjs/testing-library)`, applying structural changes with `apply_patch`, and ensuring code quality with `prettier` and `pnpm` commands, all while providing transparent diffs for approval.
How does Atlas map a SolidJS module's public surface?
Atlas maps a SolidJS module's public surface by leveraging its `lsp` tool's `documentSymbol` operation, providing a comprehensive overview of all exported symbols. This initial step is crucial for understanding the module's external contract before any refactoring begins, ensuring that all 0 potential callers are identified.
Before modifying any SolidJS code, Atlas first establishes a complete understanding of the module's external API. It uses the `lsp` tool's `documentSymbol` operation to parse the Abstract Syntax Tree (AST) of your SolidJS `.tsx` files. This allows Atlas to identify every `export` declaration within a given module, such as `export function MyComponent` or `export const mySignal = createSignal(0)`. Once the public symbols are mapped, Atlas then performs a `findReferences` operation on each identified symbol. This enumerates every single callsite across your entire SolidJS project, providing a robust list of all locations that depend on the legacy module. This meticulous mapping prevents silent breakage at unknown callsites, a common risk in refactoring efforts, by giving you a complete picture of the module's dependencies.
How does Atlas pin SolidJS module behavior with tests?
Atlas pins the behavior of a SolidJS module by first running your existing `vitest (@solidjs/testing-library)` tests to establish a green baseline. This crucial step ensures that any subsequent structural changes do not alter the module's functionality, providing a 1:1 guarantee of behavior preservation.
Preserving existing behavior is paramount when refactoring. Atlas integrates directly with your SolidJS project's testing setup. Before any code modification, Atlas uses its `bash` tool to execute your project's test suite. For SolidJS projects, this typically involves running `pnpm test` which invokes `vitest (@solidjs/testing-library)`. Atlas records the output, ensuring all tests pass and establishing a 'green baseline.' This baseline serves as a contract: any changes made during the refactor must result in the same passing test suite. If a test fails after a change, Atlas immediately flags it, indicating a behavioral regression. This iterative testing approach, running tests after each small change, is far safer than a single test run at the end, especially when dealing with SolidJS's unique reactivity model where component bodies run exactly once.
How does Atlas apply structural changes to SolidJS components safely?
Atlas applies structural changes to SolidJS components using its `apply_patch` tool, which anchors on context lines and refuses to apply against a drifted file. This ensures that modifications are precise and prevents accidental changes to unintended code, providing a robust safety mechanism for your `.tsx` files in 2026.
When it's time to restructure the SolidJS module, Atlas employs the `apply_patch` tool. This tool is designed for structural changes, operating on unified diffs. A key safety feature of `apply_patch` is its reliance on context lines: each hunk of the patch includes surrounding lines of code. If the target file has drifted,meaning the context lines no longer match,`apply_patch` will fail with a 'Failed to find context' error. This prevents Atlas from applying changes to a file that has been modified externally, ensuring that every edit is applied against the expected codebase. For SolidJS, this means refactoring a `createSignal` declaration or moving a component function within a `.tsx` file is done with high precision. After each successful `apply_patch` operation, Atlas immediately re-runs the `pnpm test` command to verify that the module's behavior remains unchanged, catching any regressions early.
How does Atlas ensure reactivity and code quality in SolidJS refactors?
Atlas ensures reactivity and code quality in SolidJS refactors by integrating with your existing toolchain, including `prettier` for formatting and `vitest` for testing. It can even help fix common SolidJS reactivity bugs, such as those arising from destructured props, which account for a significant portion of issues in 2026.
SolidJS's reactivity model, centered around signals, memos, and effects, requires careful handling during refactoring. Atlas is aware of these SolidJS idioms. It can read your `createSignal`, `createMemo`, and `createEffect` graphs, understanding the flow of reactivity. A common SolidJS pitfall is breaking reactivity when destructured props are used incorrectly; Atlas can be asked to fix such issues. Beyond functional correctness, code quality is maintained through integration with `prettier`. After Atlas makes edits to `.tsx` files, it can run `pnpm prettier --write .` to ensure all touched files conform to your project's formatting standards. Every file edit is presented as a unified diff for your approval, and Atlas can even stage and create `git` commits on your behalf, providing a transparent and auditable refactoring process.
How does Atlas track progress and manage commits for SolidJS refactors?
Atlas tracks progress and manages commits for SolidJS refactors by maintaining a `todowrite` list for remaining callsites and leveraging `git` for version control. This ensures that partially migrated modules are never mistaken for finished ones, providing a clear roadmap for completing the refactor in 2026.
Refactoring a large SolidJS module often involves migrating callsites incrementally. Atlas helps manage this complexity with its `todowrite` tool. As callsites are identified and then migrated, they can be marked off the `todowrite` list, providing a clear, persistent record of remaining work. This prevents the common issue of losing track of dependencies or mistakenly considering a refactor complete when outstanding callsites still exist. For version control, Atlas reads `git` branches, status, and diffs. It can stage changes with `git add .` and create commits with `git commit -m "Refactor: ..."` on your behalf, after you approve the unified diffs. Atlas also snapshots file changes as `git` patches, allowing for easy diffing and rolling back of edits if necessary, providing robust safety and auditability throughout the SolidJS refactoring process.
Step by step
- 01Initialize Atlas in your SolidJS project with `vite.config.ts` using `vite-plugin-solid`.
- 02Map the legacy SolidJS module's public surface: Run `atlas lsp documentSymbol src/components/LegacyModule.tsx` to list exports, then `atlas lsp findReferences src/components/LegacyModule.tsx <SYMBOL_NAME>` for each exported symbol to enumerate all callers.
- 03Pin existing behavior: Execute `atlas bash pnpm test` to run `vitest (@solidjs/testing-library)` and record the green baseline before any changes.
- 04Restructure the SolidJS module incrementally: Use `atlas apply_patch` with a generated diff to make structural changes to `.tsx` files. Atlas will refuse to apply if the file has drifted.
- 05Verify behavior after each change: Immediately re-run `atlas bash pnpm test` after each `apply_patch` operation to ensure no regressions are introduced to your SolidJS components.
- 06Track remaining callsites: Update the `todowrite` list with `atlas todowrite add "Migrate callsite in src/pages/Dashboard.tsx"` for any unmigrated dependencies, and mark them complete as you go.
- 07Review and format: Approve unified diffs presented by Atlas. After edits, ask Atlas to run `atlas bash pnpm prettier --write src/components/LegacyModule.tsx` to format touched SolidJS files.
- 08Commit changes: Allow Atlas to stage and commit the refactored SolidJS code with `git add .` and `git commit -m "Refactor: Legacy SolidJS Module"`.
Frequently asked questions
- How does Atlas handle SolidJS reactivity during refactoring?
- Atlas understands SolidJS's reactivity model by indexing `createSignal`, `createMemo`, and `createEffect` declarations via AST. This allows it to identify potential reactivity issues, such as those caused by incorrect destructured props, and suggest fixes to maintain the module's reactive integrity during refactoring.
- Can Atlas refactor SolidJS components that use JSX?
- Yes, Atlas is designed to work with SolidJS components that use JSX. Its AST-based indexing and `lsp` tool can parse and understand the structure of `.tsx` files, allowing it to identify symbols, find references, and apply structural changes within JSX-based SolidJS components effectively.
- What if my SolidJS project uses a different package manager than pnpm?
- While the examples use `pnpm`, Atlas's `bash` tool is flexible. You can instruct Atlas to use `npm test` or `yarn test` if your SolidJS project is configured with `npm` or `yarn` respectively. Atlas adapts to your project's specific `package.json` and lockfile setup.
- How does Atlas ensure my SolidJS code stays formatted after refactoring?
- Atlas integrates with your existing `prettier` setup. After making changes to SolidJS `.tsx` files, you can instruct Atlas to run `atlas bash pnpm prettier --write .` (or your equivalent `prettier` command) to automatically format the touched files according to your project's configuration, ensuring consistent code style.
- Does Atlas support SolidStart routes and server components?
- Yes, Atlas is designed to read your SolidStart routes and associated components. Its AST-based indexing can understand the structure of SolidStart projects, allowing it to map dependencies and apply refactoring changes across both client-side SolidJS components and server-side logic within a SolidStart application.
- How does Atlas prevent breaking changes to SolidJS callers?
- Atlas prevents breaking changes by first using `lsp findReferences` on every exported symbol of the SolidJS module to identify all callers. It then requires you to pin behavior with `vitest` tests. Any structural change applied with `apply_patch` is immediately followed by a test run, ensuring that no callsite behavior is inadvertently altered.
- Can I review Atlas's changes before they are applied to my SolidJS files?
- Absolutely. Every file edit proposed by Atlas is presented as a unified diff for your explicit approval before it is written to disk. This permission-gated workflow ensures you have full control and visibility over all changes made to your SolidJS codebase, allowing you to review and accept or reject them.
Try Atlas in your terminal
The terminal-native AI coding agent. Free core, single binary.
Install AtlasRelated guides
Refactor a Legacy Module with Atlas in 2026
How to refactor a legacy module with Atlas in 2026: findReferences maps every callsite, apply_patch refuses to apply against a drifted file, and bash proves behavior.
Atlas for SolidJS: A Terminal-Native AI Coding Agent Built on Solid, for Solid, in 2026
Atlas is a terminal-native AI coding agent for SolidJS in 2026. It reads your createSignal and createMemo graph, fixes destructured props that break reactivity, and runs vitest.
Run the test suite and triage failures in SolidJS with Atlas in 2026
Streamline SolidJS test failure triage in 2026 with Atlas. Quickly turn `vitest` output into a prioritized list of distinct root causes, leveraging `pnpm` and `prettier` for efficient debugging and fixes.
Automate GitHub Issue and Pull Request Triage in SolidJS with Atlas in 2026
Streamline GitHub issue and pull request triage in your SolidJS projects using Atlas. Configure workflows to safely automate responses, enforce trusted user permissions, and integrate with your `pnpm` and `vitest`
Diagnose a hanging or long-running command in SolidJS with Atlas in 2026
Pinpoint why your SolidJS builds or scripts are stuck or slow in 2026. Atlas, the terminal-native AI agent, uses its bash tool to diagnose interactive input blocks or genuine performance bottlenecks in your pnpm
Rename a symbol across the repo in SolidJS with Atlas in 2026
In 2026, rename functions, classes, or constants across your SolidJS codebase with Atlas. Leverage lsp, grep, and edit for precise, verified refactoring.
Upgrade a Dependency and Fix Breakage in SolidJS with Atlas in 2026
SolidJS developers in 2026 can use Atlas to efficiently upgrade major dependencies, automatically fixing compile and test failures. Atlas integrates with pnpm, vitest, and prettier to streamline your workflow.
Run Atlas Headless in CI for SolidJS Projects in 2026
Automate Atlas in your SolidJS CI pipeline for machine-readable output. Leverage pnpm, vitest, and prettier to integrate AI-driven code changes and testing direct in 2026.