# Upgrade Bootstrap 4 to Bootstrap 5 and Remove jQuery

Yes. An agent upgrades Bootstrap 4 to 5, finds every class the new stylesheet no longer has, drops jQuery, and opens a PR with before and after screenshots.

[Run this on Rush](https://cloud.getrush.ai/run/upgrade-bootstrap/bootstrap/). Opens the console with this prompt ready to send, in a Project that has your repository.

## What the agent does

The agent begins with what the application actually uses from Bootstrap, which is usually less than what it loads. In an app like bezkoder/vue-3-crud, `package.json` lists `bootstrap` `^4.6.0`, `jquery` `^3.6.0` and `popper.js` `^1.16.1`, and `src/main.js` imports both `bootstrap` and `bootstrap/dist/css/bootstrap.min.css`. The first import is Bootstrap's JavaScript, the only reason jQuery and Popper are installed. The agent searches the four `.vue` files for anything that needs it, `data-toggle` attributes, `$(` calls, modals, dropdowns, collapses, and finds none. The built vendor chunk contains jQuery all the same.

The version change itself is quiet, and that is the trap. `npm install bootstrap@5` succeeds, npm adds the `@popperjs/core` peer by itself, `jquery` and `popper.js` uninstall cleanly, the build compiles and the linter reports nothing. No tool complains, because a class name that no stylesheet defines is not an error anywhere. So the agent checks the templates against the CSS on disk. It collects every class used in `src`, then tests each against `node_modules/bootstrap/dist/css/bootstrap.css` before and after the upgrade. Eight exist in 4.6.0 and are absent from 5.3: `mr-auto`, `mr-2`, `form-group`, `input-group-append` and the four `badge-*` colour classes.

Each of the eight gets a specific replacement. The margin utilities become `me-auto` and `me-2`. `form-group` becomes `mb-3`, and the labels inside gain `form-label`, because the base `label` rule in version 5 no longer carries a bottom margin. The `input-group-append` wrapper in `TutorialsList.vue` is removed so the search button is a direct child of `.input-group`. The badges matter most: version 5's `.badge` sets white text and leaves the background to a second class, so the `Edit` link with a dead `badge-warning` would render as white text on a white page, present in the DOM and invisible. It becomes `text-bg-warning`. The agent also wraps the navbar's contents in `container-fluid`, since the new navbar has no horizontal padding of its own and the brand would sit against the window edge.

Because none of this shows up in a build log, the agent proves it in a browser. The app reads from `http://localhost:8080/api` in `src/http-common.js`, so it starts a small stub that serves a few tutorials on that address, runs the app, and captures the list, the add form and the edit form at one viewport size, before the upgrade and after its fixes. It then removes the unused `import 'bootstrap'`, rebuilds, and reports the vendor chunk sizes. One environment note goes in the report: Vue CLI 4's webpack fails on a current Node with a `digital envelope routines` error, so both builds are made with `NODE_OPTIONS=--openssl-legacy-provider`, and fixing that is left out of scope.

## Start it with one API call

`POST https://api.phoenix.so/o/{org}/sessions`

```json
{
  "agent": "claude",
  "input": "Upgrade Bootstrap in this repository from version 4 to the latest version 5 and remove jQuery if nothing needs it. First report what is used: every Bootstrap class in the templates, and every use of Bootstrap's JavaScript (data-toggle or data-bs attributes, jQuery calls, modal, dropdown, collapse, tooltip, popover). Build the app before changing anything; if the build fails for a reason unrelated to Bootstrap, apply the smallest workaround, use it for both builds, and say so. The app needs its API to render data, so write a small stub server on the address the HTTP client uses and take screenshots of every route at a 1280 pixel wide viewport as the baseline. Upgrade, then check every class from your list against node_modules/bootstrap/dist/css/bootstrap.css from version 4 and from version 5, and list the ones that no longer exist. Replace each with its version 5 equivalent, reading the installed stylesheet to confirm the replacement exists and what it sets; pay attention to labels, input groups, badges and the navbar container. Remove jquery and popper.js from package.json, and remove the Bootstrap JavaScript import if nothing uses it; otherwise keep it and rename the data attributes. Take the screenshots again after the upgrade alone and after your fixes, so the pull request shows three states. Report the vendor JavaScript and CSS sizes before and after. Do not restyle anything beyond restoring the previous appearance. Open a pull request with the class table, the screenshots and the output of every command.",
  "resources": [
    {
      "url": "https://github.com/your-org/your-app"
    }
  ]
}
```

1. **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.
2. **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.
3. **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

A pull request that raises `bootstrap` in `package.json`, removes `jquery` and `popper.js`, updates the lockfile, edits the templates that used a removed class, and drops the JavaScript import from `src/main.js` when nothing needs it. The description leads with a table: each class the agent found, whether it exists in the old stylesheet and the new one, and what replaced it. A reviewer can check any row with one search in `node_modules`.

Below the table are the screenshots in three columns for each route: Bootstrap 4, Bootstrap 5 with no template changes, and Bootstrap 5 after the fixes. The middle column is what makes the case for the template edits, since it shows the collapsed form spacing and the missing badge that an upgrade without them would ship. The first and third columns should look alike. Where they do not, for instance in link underlines or gutter widths, the description names the difference as Bootstrap's new default and leaves it alone.

The size report closes it. Removing jQuery and Popper 1 shrinks the vendor JavaScript, while the version 5 stylesheet is larger than version 4's, so the two move in opposite directions and both numbers are given. Before merging, the reviewer opens the screenshots at full size, confirms that no class from the removed list is left in `src`, and checks that the stub server and the legacy OpenSSL flag stayed out of the commit.

## Run it on every issue labelled bootstrap-5

A major upgrade of a CSS framework is planned work, so start it from the tracker. Create an automation in the Project that holds the repository, with this prompt and a `github` trigger on `issues.labeled`, and put the label your team uses in `labels`. When a maintainer adds that label to an issue, one run starts. The issue is placed after the prompt as event text and fills in nothing, so anything specific to the repository, such as pages that need a signed-in session, belongs in the saved prompt.

For several front ends, a script on your server sends the body to `POST /o/{org}/sessions` once for each repository, with a `request_id` that is a UUID v5 of the repository's full name, so a second pass of the script returns the runs already started. Each run takes its own screenshots in its own sandbox, and each pull request can be reviewed without checking out a branch.

## Why run it on Rush?

This upgrade cannot be verified from a terminal. The compiler, the bundler and the linter all pass on markup that no longer has styles, and the only instrument that shows the damage is a rendered page. The agent's sandbox has a browser, so it serves the app, feeds it data from a stub, and captures each route in each state. Those images, with the commands that produced them recorded in the transcript at `GET /o/{org}/sessions/{id}/messages`, are evidence a reviewer can assess in a minute.

It is also work that grows with the number of templates and needs no judgement for most of them. Checking each class against two stylesheets is exact and dull. A run does it for every file, in a clean install where the version on disk is known, and returns the complete table. People then spend their time on the few rows where the new default looks different and someone has to decide whether that is acceptable.

## Frequently asked questions

### Does Bootstrap 5 still need jQuery?

No. Its JavaScript components are written without it, and its only runtime peer is `@popperjs/core`, which replaces the old `popper.js` package. If your own code calls jQuery for other things, the agent lists those call sites and keeps the dependency; it is removed only when the search finds no use.

### Why does my layout break when the build passes?

Because removed classes fail silently. An element with `class="form-group"` still renders, without the margin the class used to add. Bundlers and linters do not compare class names with stylesheets. Checking the names against the installed CSS file, and looking at screenshots, are the two ways to find the losses, and the agent does both.

### What happens to data-toggle attributes?

Version 5 namespaces them: `data-toggle` becomes `data-bs-toggle`, `data-target` becomes `data-bs-target`, and so on. An app that uses modals, dropdowns or collapses needs each attribute renamed and each component clicked through in the browser. The fixture this page was written against has none, which is why its JavaScript import can be deleted.

### Will it look exactly the same afterwards?

The structure will; some defaults will not. Version 5 changes details such as link decoration and gutter sizes, and the agent does not override the framework to imitate the old release. The three-column screenshots show where the defaults moved, so the team can decide case by case.

### Can it handle Sass variables and a custom theme?

Yes, with more to check. A project that compiles Bootstrap from Sass has variable overrides and mixin calls that were renamed or removed, and those do fail the build, which makes them easier to find than dead classes. The agent compiles, fixes each error against the installed `scss` directory, and then runs the same class and screenshot comparison.

## More jobs like this: Upgrade dependencies weekly

- [Upgrade CakePHP to the Next Minor Version](https://getrush.ai/run/upgrade-cakephp/cakephp/)
- [Upgrade Cargo Dependencies Weekly for an Actix Web API](https://getrush.ai/run/upgrade-cargo-dependencies/actix/)
- [Upgrade Axum and Cargo Dependencies](https://getrush.ai/run/upgrade-cargo-dependencies/axum/)
- [Upgrade a Rocket App's Cargo Dependencies Every Week](https://getrush.ai/run/upgrade-cargo-dependencies/rocket/)
- [Upgrade Cargo Dependencies in a Rust CLI](https://getrush.ai/run/upgrade-cargo-dependencies/rust-cli/)
- [Upgrade Cargo Dependencies Weekly for a Tokio Service](https://getrush.ai/run/upgrade-cargo-dependencies/tokio/)

## Keep reading

- [How a Rush run works on your repository, from request to pull request](https://getrush.ai/cloud/)
- [Compare cloud agents, agent sandboxes and AI code review](https://getrush.ai/compare/)
- [Rush pricing: Free, Pro and Max](https://getrush.ai/pricing/)
