What the agent does
The store itself is usually the small part. In an app like bezkoder/vue-3-authentication-jwt there is one namespaced module, src/store/auth.module.js, with three actions and five mutations, registered in src/store/index.js, and seven uses of this.$store across App.vue, Login.vue, Register.vue and Profile.vue: four state reads and three dispatch calls. The agent maps each one. Mutations fold into the actions that commit them, this.$store.state.auth.status.loggedIn becomes a read on useAuthStore(), and dispatch("auth/login", user) becomes a method call that returns the same promise, so the .then handlers in the components keep working. The components use the Options API, so the agent wires stores in with Pinia's mapState and mapActions helpers and does not rewrite them to <script setup>.
What decides the plan is the manifest and the lockfile. package.json asks for vue ^3.0.0 and package-lock.json resolves it to 3.0.11, with vuex 4.0.0, on @vue/cli-service ~4.5.0, which resolves to 4.5.12 and bundles with webpack 4.46. The agent tries the obvious command and reads the refusal: npm install pinia ends in ERESOLVE, because the current Pinia declares a peer of vue ^3.5.11. Every Pinia line needs a newer Vue than the lockfile holds, so Vue and @vue/compiler-sfc move together in the same change, and the agent says that this pull request is also a Vue upgrade.
Then it finds out which Pinia the bundler accepts, by building. At the time of writing the newest Pinia ships a package.json with an exports map and no main or module field; webpack 4 does not read exports, and vue-cli-service build reports that the dependency pinia was not found. Pinia 3 resolves but fails to compile: webpack 4 rejects named imports from its .mjs file, and one of its devtools dependencies uses optional chaining that webpack 4's parser cannot read. Pinia 2.3 fails with the same .mjs complaint about vue-demi exports, and that one has a known cure: a rule in vue.config.js under configureWebpack that marks .mjs files in node_modules as javascript/auto. With it the production build completes. The agent reports this ladder with the error text from each rung and recommends one of two paths: Pinia 2.3 now with the one webpack rule, or move the build off Vue CLI 4 first and take current Pinia after.
Around the store it keeps the diff narrow. The module computes its initial state from localStorage at import time; Pinia wants state as a function, so the read moves inside it and behaves the same on first load. vue-cli-service build on Node 17 or later needs NODE_OPTIONS=--openssl-legacy-provider, which the agent sets on the command only. vue-cli-service lint rewrites files by default, so it runs lint with --no-fix to keep unrelated formatting out of the pull request.
Start it with one API call
POST https://api.phoenix.so/o/{org}/sessions with this body:
{
"agent": "claude",
"input": "An issue labelled pinia asks to migrate this Vue 3 app from Vuex to Pinia. Read package.json, the lockfile, the build config, every file under src/store, and every component that uses this.$store, mapState, mapGetters, mapActions or useStore, and list each use with its file and line. Report the resolved versions of vue, vuex, the compiler package and the build tool. Try installing the latest pinia and quote what the package manager says. If Pinia needs a newer Vue than the lockfile has, upgrade vue and its compiler package together and say that the pull request includes a Vue upgrade. Then determine by actually running the production build which Pinia major this project's bundler can bundle: start from the latest and step down one major at a time, recording the exact error for each one that fails, and try a documented bundler setting before giving up on a version. Do not replace the build tool. Rewrite each Vuex module as a Pinia store with the same state shape and action names, folding mutations into actions, and make sure every action returns what the Vuex action returned so component promise handlers still work. Keep components on the Options API and use Pinia's map helpers. Remove vuex from the app and the manifest. Run lint without auto-fix and run the build, both before and after. Open a pull request with the usage table, the version ladder with its errors, the build output, and a recommendation on whether to stay on the Pinia version you landed on or migrate the build tool first.",
"resources": [
{
"url": "https://github.com/your-org/your-app"
}
]
}- Get an API key. In the console, open Settings, then API keys, and create a key for your org. Send it in the Authorization header as a Bearer token.
- Send the request. POST the body in request.json to https://api.phoenix.so/o/{org}/sessions, with your repository as the resources URL. The run starts in its own cloud sandbox.
- Read what came back. Follow the run on its live stream or wait for the run.completed webhook, then read the result and its trajectory.
What comes back
The pull request adds src/stores/auth.js, removes src/store/, swaps .use(store) for .use(createPinia()) in src/main.js, edits the four components that touched $store, adds the .mjs rule to vue.config.js if the chosen Pinia needs it, and updates package.json and package-lock.json. Its description starts with the table of the seven former $store uses and what each became, so a reviewer can tick them off against the diff.
Next comes the version ladder: for each Pinia major the agent tried, the command, the first lines of the build error or the line that says the build completed, and the Vue version it was built against. This is the part to read before merging, because it explains why the lockfile now holds a Pinia that is not the newest, and it names what would have to change for the newest to work. The Vue upgrade is called out separately with the old and new resolved versions.
Before merging, a reviewer should load the built app and sign in once. The agent builds and lints, but the repository has no tests and the app talks to an API at http://localhost:8080 that is not part of it, so sign-in against a real backend is the check left to a person. The pull request says so plainly and lists the three flows to try: sign in, register, and sign out from the navbar.
Run it on every Linear issue labelled pinia
Larger apps migrate module by module, and a label is a convenient unit. Add an automation to the Project in the console with a linear trigger on linear.issue.labeled and pinia in its labels. The saved prompt holds the method above; the issue, placed after the prompt as the event, names the module to move. Vuex and Pinia can be installed side by side while the migration is in progress, so each pull request can convert one module and leave the rest on $store.
The trigger needs a Linear connection for the member who last changed the automation, made in the console under Settings → Connections. Because every one of these runs edits src/main.js and the lockfile, merge them one at a time; the automation's max_runs_per_hour limits how many labelled issues start in the same hour.
The use case this job follows, with its automation and trigger: Turn a Linear label into a PR.
Why run it on Rush?
Which Pinia works with an old bundler is not something to reason out from release notes. It is found by installing a version and running the build, several times over, and each attempt rewrites node_modules and the lockfile. In a sandbox the agent can do that without leaving a half-upgraded tree on anyone's machine, and the error from every failed attempt is kept in the session's transcript, so the recommendation in the pull request can be checked against what the tools printed.
The run also separates two changes that tend to get tangled: the store rewrite and the Vue upgrade it forces. Because the agent builds before and after on the same machine, it can say which warnings are new and which were already there. If the team decides to migrate the build tool first after reading the ladder, a follow-up message to the same session picks up from the installed state; a parked sandbox is kept for 7 idle days.
Frequently asked questions
Can Vuex and Pinia run in the same app during the migration?
Yes. They are separate plugins, and an app can call both .use(store) and .use(createPinia()). That is how a large app moves one module per pull request. The agent removes vuex from the manifest only when no component uses $store any more.
Do I have to rewrite components to the Composition API?
No. Pinia stores work in Options API components through mapState, mapActions and mapStores. The agent keeps each component's style as it found it, which keeps the diff to the lines that touched the store.
Why did the pull request also upgrade Vue?
Because Pinia declares a minimum Vue version as a peer dependency, and a lockfile that resolves vue to an early 3.0 release is below it for every Pinia line. The agent upgrades vue and @vue/compiler-sfc together, states the old and new versions, and rebuilds to show the rest of the app still compiles.
Where do mutations go?
Pinia has no mutations. Each action assigns to this directly, so a loginSuccess mutation becomes two assignments inside the login action. Action names and return values stay the same, which is what the components depend on.
More Vuex jobs
More jobs like this: Turn a Linear label into a PR
- Migrate From Winston to Pino in a Node.js Service (Winston)
- Move JWTs From localStorage to httpOnly Cookies in an Express API (jsonwebtoken)
- Remember Window Size and Position Between Launches in a Tauri App (Tauri)
- Plan a Linear Issue Against a Django Codebase (Django)
- Plan a Linear Issue Against a Go Codebase (Go)