Dependency Update Until Green
Automated loop to safely upgrade project dependencies while ensuring all tests pass after each update. The agent incrementally updates out-of-date packages and runs test checks to prevent breaking changes.
Goal
Upgrade dependencies safely with test coverage validation
How to Run
Run this loop in your preferred AI coding agent by providing the kickoff prompt. The agent will automatically iterate through dependency updates until tests pass or max attempts are reached.
- 01
Open Your IDE/Agent Environment
Launch Cursor, Claude Code, Codex, OpenCode, or Gemini CLI.
- 02
Start New Session or File
Create a new session or open the relevant project folder.
- 03
Provide Kickoff Prompt
Paste the kickoff prompt into the agent and initiate the loop.
- 04
Monitor Progress
Observe the agent's actions in the terminal/output panel as it updates dependencies and runs tests.
Workflow Steps
- 01
Check for outdated dependencies
Identify which packages require updating
- 02
Update one or two outdated packages
Perform incremental update to minimize risk
- 03
Run test suite
Validate that the update didn't break existing functionality
- 04
Evaluate test results
If tests fail
- 05
Repeat or exit
If max iterations exceeded without success
Kickoff Prompt
Start the "Dependency Update Until Green" loop. Goal: Upgrade dependencies safely with test coverage validation Max iterations: 10 Between iterations run: npm test Exit when: All tests pass successfully (exit code 0) Begin the 'Dependency Update Until Green' process. First, check which packages are outdated using 'npm outdated'. Then, update one or two packages at a time, preferring minor/patch updates over major ones. After each update, run 'npm test' to validate functionality. If tests fail, revert the changes and try updating fewer packages. Continue this cycle until all dependencies are updated and tests pass, or until 10 iterations have been completed. Ensure you back up package-lock.json before making changes and prioritize development dependencies first. Self-pace this loop. After each iteration, run `npm test` and evaluate the output, and only continue if the exit condition is not met (All tests pass successfully (exit code 0)). Stop when the exit condition passes or 10 iterations are reached. Give a short status update each pass.
Guardrails
hardcoded- ·Always check for breaking changes before updating major versions
- ·Backup package-lock.json before any changes
- ·If more than 30% of tests fail after an update, immediately revert and reduce update scope
- ·Prioritize updating development dependencies over production ones first
- ·Use --save-dev flag for devDependencies and --save for regular dependencies
- ·Do not proceed with updates if current git branch has uncommitted changes
Flow Diagram
Related loops — Maintenance
Maintenance
Package Audit Fixer
Automatically identifies and fixes package vulnerabilities in your Node.js project by running `npm audit` and applying recommended fixes until the audit is clean.
Maintenance
Upgrade Framework Version
This loop automates the process of upgrading a project's framework to a newer version. It systematically analyzes the current framework, plans the upgrade path, updates dependencies, resolves breaking changes, and ensures all tests pass before completion.
Maintenance
Monorepo Health Check
This loop performs a comprehensive health check of a monorepo by validating its structure, dependencies, code quality, and consistency. It iteratively identifies and resolves issues related to missing dependencies, outdated packages, lint errors, and architectural inconsistencies until the repository passes validation.