What the agent does
The agent reads the stylesheet and the toolchain around it. In a web client like readthedocs/ethical-ad-client, one file, styles.scss (635 lines), is compiled through webpack's style-loader, css-loader and sass-loader chain; package.json declares sass ^1.59.3 and sass-loader ^10.4.1, package-lock.json resolves them to 1.99.0 and 10.5.2, and CI in .github/workflows/main.yml runs npm ci then lint, build and web-test-runner tests on Node 24.16. The file has no @import or @use; its legacy calls are lighten() at lines 25, 29, 66, 72 and 80, darken() at 28, 65, 71 and 81, most of them inside #{...} interpolation that fills CSS custom properties like --ea-color-link-active, and opacify() three times inside the theme-bordered mixin at lines 120, 126 and 132, which the @include at line 279 pulls in.
Then it compiles and counts. A fresh install of ^1.59.3 gives the current Dart Sass, and sass styles.scss prints two warnings per call: DEPRECATION WARNING [global-builtin]: Global built-in functions are deprecated and will be removed in Dart Sass 3.0.0. Use color.adjust instead. and DEPRECATION WARNING [color-functions]: lighten() is deprecated. Suggestions: color.scale($color, $lightness: 14.5714285714%) color.adjust($color, $lightness: 10%), each with the file and line. Sass shows five of each kind and omits the rest; with --verbose the count is 12 global-builtin, 5 lighten, 4 darken and 3 opacify. The agent runs older releases to date the change: 1.78.0 prints nothing, 1.79.6 prints the colour-function warnings only, and 1.80.0 prints both kinds, so the lock's 1.99.0 has been printing all of them on every build.
The rewrite picks the suggestion that keeps the output identical. Each warning offers two: color.scale changes lightness relative to the room left in the channel, and color.adjust adds the same fixed amount lighten and darken did. The agent adds @use "sass:color"; at the top of the file and rewrites lighten($c, 10%) to color.adjust($c, $lightness: 10%), darken($c, 10%) to color.adjust($c, $lightness: -10%) and opacify($c, 0.02) to color.adjust($c, $alpha: 0.02), including the one lighten( call that spans lines 72 to 75. It then compiles both versions with --verbose and compares the CSS files: zero warnings, and cmp reports the two outputs identical. It notes that the official migrator, sass-migrator color, performs the same rewrite, and that the interpolated custom properties need no other change.
It leaves the build alone and says what else it saw: the global-builtin warning text points at the module-system guide because the same removal covers map-get and friends, none of which this file uses, and sass-loader 10 is the bridge between webpack and the compiler, which the agent does not upgrade in this change.
Start it with one API call
POST https://api.phoenix.so/o/{org}/sessions with this body:
{
"agent": "claude",
"input": "Our Sass build prints \"Global built-in functions are deprecated and will be removed in Dart Sass 3.0.0\" and \"lighten() is deprecated\" on every compile. List every legacy colour function call with its file and line, add the sass:color module, and rewrite each call to the color.adjust form that produces the same value, including calls inside interpolation and mixins. Compile before and after with verbose warnings on, compare the generated CSS byte for byte, say which Dart Sass release started printing each warning, and open a pull request with the counts and the comparison.",
"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
A pull request that changes styles.scss only: one @use "sass:color"; line at the top and twelve rewritten calls. The description lists each call with its line and its replacement, shows the warning counts with --verbose before (12 global-builtin, 5 lighten, 4 darken, 3 opacify) and after (none), quotes the cmp result on the two compiled CSS files, and shows the releases it tried, 1.78.0 with no warnings, 1.79.6 with the colour-function ones and 1.80.0 with both kinds.
A reviewer checks that every replacement is color.adjust rather than color.scale, which would shift the colours, that the interpolated custom properties still compile to the same values, and decides whether to move the sass pin or sass-loader in a separate change.
Run it on every Dependabot pull request that bumps sass
The warnings arrive with the bump past 1.78, so the trigger is the pull request that moves sass. An automation with a github trigger on pull_request.opened and pull_request.synchronize runs this prompt on each one, with the event appended after the prompt, and pushes the rewrite onto the bump's branch when the compile prints global-builtin or color-functions warnings.
For many sites with their own stylesheets, your server sends this request once per repository, each with its own UUID as request_id so a retry returns the run already started, and reads each run.completed webhook; a key starts at most max_concurrent runs at once and queues the rest.
The use case this job follows, with its automation and trigger: Fix a bug from an alert.
Why run it on Rush?
A deprecation that offers two replacements is a chance to change every colour on the site by accident. In a Rush sandbox the agent compiles the stylesheet under several Dart Sass releases, applies the rewrite, and proves with a byte comparison of the CSS that nothing visible moved, with every command and count kept in the run.
Twelve calls in one file is small; the same job across a design system is not. The sandbox installs each release, runs --verbose to get full counts, and records them, so the pull request shows the whole set rather than the five warnings Sass prints by default.
Frequently asked questions
Should I use color.adjust or color.scale?
color.adjust adds a fixed amount to a channel, which is what lighten, darken and opacify did, so it keeps the output identical. color.scale moves a channel by a fraction of the room left, which is a different colour. The pull request uses adjust and proves the CSS did not change.
Why does Sass only show five warnings when I have more calls?
Dart Sass prints the first five of each deprecation kind and omits the rest unless you pass --verbose. The agent uses the flag so the pull request can list every call, twelve here, rather than the first five.
Can the sass-migrator do this for me?
Yes. sass-migrator color rewrites the legacy colour functions and sass-migrator module moves a file to the module system. The agent produces the same edit and adds the compile comparison, which the migrator does not do for you.
Does the global-builtin warning mean I also need @use for other functions?
Only for the functions you call. The warning covers every global built-in, such as map-get, but this stylesheet uses only the colour functions, so @use "sass:color" is the one module it needs. The agent lists what it found so the next file can be checked the same way.