nightytidy 0.3.7 → 0.3.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/nightytidy.js +1 -1
- package/package.json +1 -1
- package/src/agent/git-integration.js +4 -1
- package/src/claude.js +1 -1
- package/src/prompts/manifest.json +138 -138
- package/src/prompts/steps/02-test-coverage.md +181 -181
- package/src/prompts/steps/03-test-hardening.md +181 -181
- package/src/prompts/steps/04-test-architecture.md +130 -130
- package/src/prompts/steps/05-test-consolidation.md +165 -165
- package/src/prompts/steps/06-test-quality.md +211 -211
- package/src/prompts/steps/07-api-design.md +165 -165
- package/src/prompts/steps/08-security-sweep.md +207 -207
- package/src/prompts/steps/09-dependency-health.md +217 -217
- package/src/prompts/steps/10-codebase-cleanup.md +189 -189
- package/src/prompts/steps/11-crosscutting-concerns.md +196 -196
- package/src/prompts/steps/12-file-decomposition.md +263 -263
- package/src/prompts/steps/13-code-elegance.md +329 -329
- package/src/prompts/steps/14-architectural-complexity.md +297 -297
- package/src/prompts/steps/15-type-safety.md +192 -192
- package/src/prompts/steps/16-logging-error-message.md +173 -173
- package/src/prompts/steps/17-data-integrity.md +139 -139
- package/src/prompts/steps/18-performance.md +183 -183
- package/src/prompts/steps/19-cost-resource-optimization.md +136 -136
- package/src/prompts/steps/20-error-recovery.md +145 -145
- package/src/prompts/steps/21-race-condition-audit.md +178 -178
- package/src/prompts/steps/22-bug-hunt.md +229 -229
- package/src/prompts/steps/23-frontend-quality.md +210 -210
- package/src/prompts/steps/24-uiux-audit.md +284 -284
- package/src/prompts/steps/25-state-management.md +170 -170
- package/src/prompts/steps/26-perceived-performance.md +190 -190
- package/src/prompts/steps/27-devops.md +165 -165
- package/src/prompts/steps/28-scheduled-job-chron-jobs.md +141 -141
- package/src/prompts/steps/29-observability.md +152 -152
- package/src/prompts/steps/30-backup-check.md +155 -155
- package/src/prompts/steps/31-product-polish-ux-friction.md +122 -122
- package/src/prompts/steps/32-feature-discovery-opportunity.md +128 -128
- package/src/prompts/steps/33-strategic-opportunities.md +217 -217
|
@@ -1,217 +1,217 @@
|
|
|
1
|
-
# Dependency Health & Upgrade Pass
|
|
2
|
-
|
|
3
|
-
## Prompt
|
|
4
|
-
|
|
5
|
-
```
|
|
6
|
-
You are running an overnight dependency health audit and upgrade pass. You have several hours. Your job is to assess the health, risk, and maintainability of every external dependency in the project — then upgrade what's safe and document the rest.
|
|
7
|
-
|
|
8
|
-
Work on a branch called `dependency-health-[date]`.
|
|
9
|
-
|
|
10
|
-
## Your Mission
|
|
11
|
-
|
|
12
|
-
### Phase 1: Dependency Inventory
|
|
13
|
-
|
|
14
|
-
**Step 1: Catalog every dependency**
|
|
15
|
-
Read all dependency manifests (package.json, requirements.txt, Cargo.toml, go.mod, Gemfile, pom.xml, etc.) and create a complete inventory:
|
|
16
|
-
|
|
17
|
-
For each dependency:
|
|
18
|
-
- Name and current version
|
|
19
|
-
- Latest available version
|
|
20
|
-
- How far behind the project is (patch / minor / major versions behind)
|
|
21
|
-
- What it's used for in this project (read the code, don't guess)
|
|
22
|
-
- How widely it's imported (used in 1 file or 50?)
|
|
23
|
-
- Whether it's a direct dependency or transitive
|
|
24
|
-
- Whether it's a runtime dependency or dev-only
|
|
25
|
-
|
|
26
|
-
**Step 2: Catalog lock file status**
|
|
27
|
-
- Is there a lock file (package-lock.json, yarn.lock, poetry.lock, Cargo.lock, etc.)?
|
|
28
|
-
- Is it committed to the repo?
|
|
29
|
-
- Is it consistent with the manifest? (Run install and check for drift)
|
|
30
|
-
- Are there duplicate packages at different versions in the dependency tree?
|
|
31
|
-
|
|
32
|
-
### Phase 2: Health Assessment
|
|
33
|
-
|
|
34
|
-
**Step 1: Identify abandoned or risky dependencies**
|
|
35
|
-
For each dependency, assess its health:
|
|
36
|
-
|
|
37
|
-
- **Last published**: When was the last release? Dependencies with no release in 2+ years are a risk.
|
|
38
|
-
- **Maintenance signals**: Open issue count, unmerged PRs, maintainer activity (use web search to check npm/PyPI/crates.io pages and GitHub repos)
|
|
39
|
-
- **Known vulnerabilities**: Run `npm audit` / `pip audit` / `cargo audit` / equivalent. For each CVE:
|
|
40
|
-
- Severity (critical/high/medium/low)
|
|
41
|
-
- Is the vulnerable code path actually used in this project?
|
|
42
|
-
- Is there a patched version available?
|
|
43
|
-
- Is the fix a simple version bump or a breaking change?
|
|
44
|
-
- **Bus factor**: Is this maintained by one person? Is it a critical dependency maintained by an unfunded individual? (This is a real supply chain risk)
|
|
45
|
-
|
|
46
|
-
**Step 2: License compliance scan**
|
|
47
|
-
For every dependency (including transitive dependencies):
|
|
48
|
-
- What license does it use?
|
|
49
|
-
- Flag any that are:
|
|
50
|
-
- **GPL/AGPL** in a proprietary or non-GPL project (potential copyleft risk)
|
|
51
|
-
- **SSPL** or **BSL** (may restrict commercial use)
|
|
52
|
-
- **No license specified** (legally risky — no license means no permission to use)
|
|
53
|
-
- **Custom or unusual licenses** that need legal review
|
|
54
|
-
- Generate a complete license inventory table
|
|
55
|
-
- If the project has a declared license, flag any dependency license that's incompatible with it
|
|
56
|
-
|
|
57
|
-
**Step 3: Dependency weight analysis**
|
|
58
|
-
Identify dependencies that are disproportionately heavy:
|
|
59
|
-
- Packages that pull in massive transitive dependency trees for minimal functionality
|
|
60
|
-
- Packages where only a small fraction of the library is actually used (e.g., importing all of lodash for `_.get`)
|
|
61
|
-
- Multiple packages that do similar things (two date libraries, two HTTP clients, two validation libraries)
|
|
62
|
-
- Packages that could be replaced with native language features (e.g., `is-odd`, `left-pad` style micro-packages, or libraries superseded by modern language features)
|
|
63
|
-
|
|
64
|
-
For each heavy/redundant dependency:
|
|
65
|
-
- What is it and what's it used for?
|
|
66
|
-
- How much of it is actually used?
|
|
67
|
-
- What's the lighter alternative? (native feature, smaller package, or inline implementation)
|
|
68
|
-
- Estimated effort to replace it
|
|
69
|
-
|
|
70
|
-
### Phase 3: Safe Upgrades
|
|
71
|
-
|
|
72
|
-
**Step 1: Upgrade patch versions**
|
|
73
|
-
- Bump all dependencies to their latest patch version (X.Y.Z → X.Y.latest)
|
|
74
|
-
- Run the full test suite after each batch of upgrades
|
|
75
|
-
- These should be safe — patch versions are supposed to be backward compatible
|
|
76
|
-
- If any tests fail, revert that specific upgrade and document the failure
|
|
77
|
-
- Commit: `chore: bump patch versions for [scope]`
|
|
78
|
-
|
|
79
|
-
**Step 2: Upgrade minor versions**
|
|
80
|
-
- Bump dependencies to their latest minor version one at a time (X.Y → X.latest.latest)
|
|
81
|
-
- Run tests after each upgrade
|
|
82
|
-
- Minor versions may introduce new features but should be backward compatible
|
|
83
|
-
- If tests fail, revert and document
|
|
84
|
-
- Commit: `chore: bump [package] to [version]`
|
|
85
|
-
|
|
86
|
-
**Step 3: Document major version upgrades**
|
|
87
|
-
Major version upgrades are too risky for an overnight pass. For each dependency that's one or more major versions behind:
|
|
88
|
-
- What breaking changes were introduced? (Read the changelog/migration guide)
|
|
89
|
-
- What code in this project would need to change?
|
|
90
|
-
- Estimated effort: trivial / moderate / significant
|
|
91
|
-
- Priority: how important is this upgrade? (Security fix? Performance improvement? Just new features?)
|
|
92
|
-
- Dependencies on other upgrades (does upgrading X require also upgrading Y?)
|
|
93
|
-
|
|
94
|
-
**Step 4: Attempt low-risk major upgrades**
|
|
95
|
-
If any major upgrades look trivial (changelog says "renamed one function" or "dropped Node 12 support"):
|
|
96
|
-
- Attempt the upgrade
|
|
97
|
-
- Run tests
|
|
98
|
-
- If they pass, commit: `chore: upgrade [package] from [old] to [new]`
|
|
99
|
-
- If they fail, revert and add to the documentation with notes on what broke
|
|
100
|
-
|
|
101
|
-
### Phase 4: Dependency Reduction Opportunities
|
|
102
|
-
|
|
103
|
-
**Step 1: Find removable dependencies**
|
|
104
|
-
- Scan for dependencies that are imported in the manifest but never actually used in the source code
|
|
105
|
-
- Scan for dependencies that are only used in commented-out or dead code
|
|
106
|
-
- Check for dependencies that duplicate built-in functionality (e.g., a polyfill for something the minimum supported runtime already supports)
|
|
107
|
-
|
|
108
|
-
**Step 2: Find replaceable dependencies**
|
|
109
|
-
- Identify packages that can be replaced with a few lines of utility code (especially micro-packages)
|
|
110
|
-
- Identify packages where only one function/feature is used and that function could be inlined
|
|
111
|
-
- Identify packages with lighter, actively maintained alternatives
|
|
112
|
-
|
|
113
|
-
**Step 3: Implement safe removals**
|
|
114
|
-
- Remove clearly unused dependencies
|
|
115
|
-
- Run tests
|
|
116
|
-
- Commit: `chore: remove unused dependency [package]`
|
|
117
|
-
|
|
118
|
-
DO NOT replace or inline dependencies in this pass unless it's trivially simple. Document replacement opportunities for the team.
|
|
119
|
-
|
|
120
|
-
## Output Requirements
|
|
121
|
-
|
|
122
|
-
Create the `audit-reports/` directory in the project root if it doesn't already exist. Save the report as `audit-reports/09_DEPENDENCY_HEALTH_REPORT_[run-number]_[date]_[time in user's local time].md` (e.g., `09_DEPENDENCY_HEALTH_REPORT_01_2026-02-16_2129.md`). Increment the run number based on any existing reports with the same name prefix in that folder.
|
|
123
|
-
|
|
124
|
-
### Report Structure
|
|
125
|
-
|
|
126
|
-
1. **Executive Summary**
|
|
127
|
-
- Total dependencies: X (Y direct, Z transitive)
|
|
128
|
-
- Dependencies with known vulnerabilities: X
|
|
129
|
-
- Dependencies 1+ major versions behind: X
|
|
130
|
-
- Potentially abandoned dependencies: X
|
|
131
|
-
- License risks found: X
|
|
132
|
-
- Upgrades applied: X
|
|
133
|
-
- Dependencies removed: X
|
|
134
|
-
|
|
135
|
-
2. **Vulnerability Report**
|
|
136
|
-
- Table: | Package | CVE | Severity | Used in Project? | Fix Available? | Fix Applied? |
|
|
137
|
-
- Vulnerabilities that couldn't be fixed and why
|
|
138
|
-
|
|
139
|
-
3. **License Compliance**
|
|
140
|
-
- Complete license inventory: table with | Package | License | Risk Level | Notes |
|
|
141
|
-
- Flagged licenses that need legal review
|
|
142
|
-
- Recommendation for ongoing license monitoring
|
|
143
|
-
|
|
144
|
-
4. **Staleness Report**
|
|
145
|
-
- Table: | Package | Current | Latest | Versions Behind | Last Published | Health |
|
|
146
|
-
- Sorted by risk (most behind + least maintained first)
|
|
147
|
-
|
|
148
|
-
5. **Upgrades Applied**
|
|
149
|
-
- Table: | Package | From | To | Tests Pass? |
|
|
150
|
-
- Any issues encountered during upgrades
|
|
151
|
-
|
|
152
|
-
6. **Major Upgrades Needed (Not Applied)**
|
|
153
|
-
- Table: | Package | Current | Target | Breaking Changes | Effort | Priority |
|
|
154
|
-
- Suggested upgrade order (accounting for dependencies between upgrades)
|
|
155
|
-
|
|
156
|
-
7. **Dependency Weight & Reduction**
|
|
157
|
-
- Heavy dependencies: table with | Package | Size/Impact | Usage | Alternative | Effort |
|
|
158
|
-
- Unused dependencies removed
|
|
159
|
-
- Replacement opportunities for team review
|
|
160
|
-
|
|
161
|
-
8. **Abandoned/At-Risk Dependencies**
|
|
162
|
-
- Table: | Package | Last Release | Maintainer Activity | Risk | Recommendation |
|
|
163
|
-
|
|
164
|
-
9. **Recommendations**
|
|
165
|
-
- Priority-ordered action items
|
|
166
|
-
- Suggested tooling for ongoing dependency health (Dependabot, Renovate, Snyk, etc.)
|
|
167
|
-
- Suggested policy for dependency additions (criteria for adopting new dependencies)
|
|
168
|
-
|
|
169
|
-
## Rules
|
|
170
|
-
- Branch: `dependency-health-[date]`
|
|
171
|
-
- Run full test suite after every upgrade attempt
|
|
172
|
-
- If tests fail after an upgrade, revert IMMEDIATELY — don't debug the upgrade, just document it
|
|
173
|
-
- DO NOT attempt major version upgrades unless the changelog clearly indicates the change is trivial for this project
|
|
174
|
-
- DO NOT replace or rewrite dependencies overnight — only remove unused ones
|
|
175
|
-
- For license assessment: flag risks, don't make legal determinations. The team needs to decide acceptable license policy.
|
|
176
|
-
- Use web search to check dependency health (npm page, GitHub repo, last release date, open issues)
|
|
177
|
-
- Be conservative. A working codebase with old dependencies is better than a broken codebase with new ones.
|
|
178
|
-
- You have all night. Be thorough. Check every dependency.
|
|
179
|
-
```
|
|
180
|
-
|
|
181
|
-
## Chat Output Requirement
|
|
182
|
-
|
|
183
|
-
In addition to writing the full report file, you MUST print a summary directly in the conversation when you finish. Do not make the user open the report to get the highlights. The chat summary should include:
|
|
184
|
-
|
|
185
|
-
### 1. Status Line
|
|
186
|
-
One sentence: what you did, how long it took, and whether all tests still pass.
|
|
187
|
-
|
|
188
|
-
### 2. Key Findings
|
|
189
|
-
The most important things discovered — bugs, risks, wins, or surprises. Each bullet should be specific and actionable, not vague. Lead with severity or impact.
|
|
190
|
-
|
|
191
|
-
**Good:** "CRITICAL: No backup configuration found for the primary Postgres database — total data loss risk."
|
|
192
|
-
**Bad:** "Found some issues with backups."
|
|
193
|
-
|
|
194
|
-
### 3. Changes Made (if applicable)
|
|
195
|
-
Bullet list of what was actually modified, added, or removed. Skip this section for read-only analysis runs.
|
|
196
|
-
|
|
197
|
-
### 4. Recommendations
|
|
198
|
-
|
|
199
|
-
If there are legitimately beneficial recommendations worth pursuing right now, present them in a table. Do **not** force recommendations — if the audit surfaced no actionable improvements, simply state that no recommendations are warranted at this time and move on.
|
|
200
|
-
|
|
201
|
-
When recommendations exist, use this table format:
|
|
202
|
-
|
|
203
|
-
| # | Recommendation | Impact | Risk if Ignored | Worth Doing? | Details |
|
|
204
|
-
|---|---|---|---|---|---|
|
|
205
|
-
| *Sequential number* | *Short description (≤10 words)* | *What improves if addressed* | *Low / Medium / High / Critical* | *Yes / Probably / Only if time allows* | *1–3 sentences explaining the reasoning, context, or implementation guidance* |
|
|
206
|
-
|
|
207
|
-
Order rows by risk descending (Critical → High → Medium → Low). Be honest in the "Worth Doing?" column — not everything flagged is worth the engineering time. If a recommendation is marginal, say so.
|
|
208
|
-
|
|
209
|
-
### 5. Report Location
|
|
210
|
-
State the full path to the detailed report file for deeper review.
|
|
211
|
-
|
|
212
|
-
---
|
|
213
|
-
|
|
214
|
-
**Formatting rules for chat output:**
|
|
215
|
-
- Use markdown headers, bold for severity labels, and bullet points for scannability.
|
|
216
|
-
- Do not duplicate the full report contents — just the highlights and recommendations.
|
|
217
|
-
- If you made zero findings in a phase, say so in one line rather than omitting it silently.
|
|
1
|
+
# Dependency Health & Upgrade Pass
|
|
2
|
+
|
|
3
|
+
## Prompt
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
You are running an overnight dependency health audit and upgrade pass. You have several hours. Your job is to assess the health, risk, and maintainability of every external dependency in the project — then upgrade what's safe and document the rest.
|
|
7
|
+
|
|
8
|
+
Work on a branch called `dependency-health-[date]`.
|
|
9
|
+
|
|
10
|
+
## Your Mission
|
|
11
|
+
|
|
12
|
+
### Phase 1: Dependency Inventory
|
|
13
|
+
|
|
14
|
+
**Step 1: Catalog every dependency**
|
|
15
|
+
Read all dependency manifests (package.json, requirements.txt, Cargo.toml, go.mod, Gemfile, pom.xml, etc.) and create a complete inventory:
|
|
16
|
+
|
|
17
|
+
For each dependency:
|
|
18
|
+
- Name and current version
|
|
19
|
+
- Latest available version
|
|
20
|
+
- How far behind the project is (patch / minor / major versions behind)
|
|
21
|
+
- What it's used for in this project (read the code, don't guess)
|
|
22
|
+
- How widely it's imported (used in 1 file or 50?)
|
|
23
|
+
- Whether it's a direct dependency or transitive
|
|
24
|
+
- Whether it's a runtime dependency or dev-only
|
|
25
|
+
|
|
26
|
+
**Step 2: Catalog lock file status**
|
|
27
|
+
- Is there a lock file (package-lock.json, yarn.lock, poetry.lock, Cargo.lock, etc.)?
|
|
28
|
+
- Is it committed to the repo?
|
|
29
|
+
- Is it consistent with the manifest? (Run install and check for drift)
|
|
30
|
+
- Are there duplicate packages at different versions in the dependency tree?
|
|
31
|
+
|
|
32
|
+
### Phase 2: Health Assessment
|
|
33
|
+
|
|
34
|
+
**Step 1: Identify abandoned or risky dependencies**
|
|
35
|
+
For each dependency, assess its health:
|
|
36
|
+
|
|
37
|
+
- **Last published**: When was the last release? Dependencies with no release in 2+ years are a risk.
|
|
38
|
+
- **Maintenance signals**: Open issue count, unmerged PRs, maintainer activity (use web search to check npm/PyPI/crates.io pages and GitHub repos)
|
|
39
|
+
- **Known vulnerabilities**: Run `npm audit` / `pip audit` / `cargo audit` / equivalent. For each CVE:
|
|
40
|
+
- Severity (critical/high/medium/low)
|
|
41
|
+
- Is the vulnerable code path actually used in this project?
|
|
42
|
+
- Is there a patched version available?
|
|
43
|
+
- Is the fix a simple version bump or a breaking change?
|
|
44
|
+
- **Bus factor**: Is this maintained by one person? Is it a critical dependency maintained by an unfunded individual? (This is a real supply chain risk)
|
|
45
|
+
|
|
46
|
+
**Step 2: License compliance scan**
|
|
47
|
+
For every dependency (including transitive dependencies):
|
|
48
|
+
- What license does it use?
|
|
49
|
+
- Flag any that are:
|
|
50
|
+
- **GPL/AGPL** in a proprietary or non-GPL project (potential copyleft risk)
|
|
51
|
+
- **SSPL** or **BSL** (may restrict commercial use)
|
|
52
|
+
- **No license specified** (legally risky — no license means no permission to use)
|
|
53
|
+
- **Custom or unusual licenses** that need legal review
|
|
54
|
+
- Generate a complete license inventory table
|
|
55
|
+
- If the project has a declared license, flag any dependency license that's incompatible with it
|
|
56
|
+
|
|
57
|
+
**Step 3: Dependency weight analysis**
|
|
58
|
+
Identify dependencies that are disproportionately heavy:
|
|
59
|
+
- Packages that pull in massive transitive dependency trees for minimal functionality
|
|
60
|
+
- Packages where only a small fraction of the library is actually used (e.g., importing all of lodash for `_.get`)
|
|
61
|
+
- Multiple packages that do similar things (two date libraries, two HTTP clients, two validation libraries)
|
|
62
|
+
- Packages that could be replaced with native language features (e.g., `is-odd`, `left-pad` style micro-packages, or libraries superseded by modern language features)
|
|
63
|
+
|
|
64
|
+
For each heavy/redundant dependency:
|
|
65
|
+
- What is it and what's it used for?
|
|
66
|
+
- How much of it is actually used?
|
|
67
|
+
- What's the lighter alternative? (native feature, smaller package, or inline implementation)
|
|
68
|
+
- Estimated effort to replace it
|
|
69
|
+
|
|
70
|
+
### Phase 3: Safe Upgrades
|
|
71
|
+
|
|
72
|
+
**Step 1: Upgrade patch versions**
|
|
73
|
+
- Bump all dependencies to their latest patch version (X.Y.Z → X.Y.latest)
|
|
74
|
+
- Run the full test suite after each batch of upgrades
|
|
75
|
+
- These should be safe — patch versions are supposed to be backward compatible
|
|
76
|
+
- If any tests fail, revert that specific upgrade and document the failure
|
|
77
|
+
- Commit: `chore: bump patch versions for [scope]`
|
|
78
|
+
|
|
79
|
+
**Step 2: Upgrade minor versions**
|
|
80
|
+
- Bump dependencies to their latest minor version one at a time (X.Y → X.latest.latest)
|
|
81
|
+
- Run tests after each upgrade
|
|
82
|
+
- Minor versions may introduce new features but should be backward compatible
|
|
83
|
+
- If tests fail, revert and document
|
|
84
|
+
- Commit: `chore: bump [package] to [version]`
|
|
85
|
+
|
|
86
|
+
**Step 3: Document major version upgrades**
|
|
87
|
+
Major version upgrades are too risky for an overnight pass. For each dependency that's one or more major versions behind:
|
|
88
|
+
- What breaking changes were introduced? (Read the changelog/migration guide)
|
|
89
|
+
- What code in this project would need to change?
|
|
90
|
+
- Estimated effort: trivial / moderate / significant
|
|
91
|
+
- Priority: how important is this upgrade? (Security fix? Performance improvement? Just new features?)
|
|
92
|
+
- Dependencies on other upgrades (does upgrading X require also upgrading Y?)
|
|
93
|
+
|
|
94
|
+
**Step 4: Attempt low-risk major upgrades**
|
|
95
|
+
If any major upgrades look trivial (changelog says "renamed one function" or "dropped Node 12 support"):
|
|
96
|
+
- Attempt the upgrade
|
|
97
|
+
- Run tests
|
|
98
|
+
- If they pass, commit: `chore: upgrade [package] from [old] to [new]`
|
|
99
|
+
- If they fail, revert and add to the documentation with notes on what broke
|
|
100
|
+
|
|
101
|
+
### Phase 4: Dependency Reduction Opportunities
|
|
102
|
+
|
|
103
|
+
**Step 1: Find removable dependencies**
|
|
104
|
+
- Scan for dependencies that are imported in the manifest but never actually used in the source code
|
|
105
|
+
- Scan for dependencies that are only used in commented-out or dead code
|
|
106
|
+
- Check for dependencies that duplicate built-in functionality (e.g., a polyfill for something the minimum supported runtime already supports)
|
|
107
|
+
|
|
108
|
+
**Step 2: Find replaceable dependencies**
|
|
109
|
+
- Identify packages that can be replaced with a few lines of utility code (especially micro-packages)
|
|
110
|
+
- Identify packages where only one function/feature is used and that function could be inlined
|
|
111
|
+
- Identify packages with lighter, actively maintained alternatives
|
|
112
|
+
|
|
113
|
+
**Step 3: Implement safe removals**
|
|
114
|
+
- Remove clearly unused dependencies
|
|
115
|
+
- Run tests
|
|
116
|
+
- Commit: `chore: remove unused dependency [package]`
|
|
117
|
+
|
|
118
|
+
DO NOT replace or inline dependencies in this pass unless it's trivially simple. Document replacement opportunities for the team.
|
|
119
|
+
|
|
120
|
+
## Output Requirements
|
|
121
|
+
|
|
122
|
+
Create the `audit-reports/` directory in the project root if it doesn't already exist. Save the report as `audit-reports/09_DEPENDENCY_HEALTH_REPORT_[run-number]_[date]_[time in user's local time].md` (e.g., `09_DEPENDENCY_HEALTH_REPORT_01_2026-02-16_2129.md`). Increment the run number based on any existing reports with the same name prefix in that folder.
|
|
123
|
+
|
|
124
|
+
### Report Structure
|
|
125
|
+
|
|
126
|
+
1. **Executive Summary**
|
|
127
|
+
- Total dependencies: X (Y direct, Z transitive)
|
|
128
|
+
- Dependencies with known vulnerabilities: X
|
|
129
|
+
- Dependencies 1+ major versions behind: X
|
|
130
|
+
- Potentially abandoned dependencies: X
|
|
131
|
+
- License risks found: X
|
|
132
|
+
- Upgrades applied: X
|
|
133
|
+
- Dependencies removed: X
|
|
134
|
+
|
|
135
|
+
2. **Vulnerability Report**
|
|
136
|
+
- Table: | Package | CVE | Severity | Used in Project? | Fix Available? | Fix Applied? |
|
|
137
|
+
- Vulnerabilities that couldn't be fixed and why
|
|
138
|
+
|
|
139
|
+
3. **License Compliance**
|
|
140
|
+
- Complete license inventory: table with | Package | License | Risk Level | Notes |
|
|
141
|
+
- Flagged licenses that need legal review
|
|
142
|
+
- Recommendation for ongoing license monitoring
|
|
143
|
+
|
|
144
|
+
4. **Staleness Report**
|
|
145
|
+
- Table: | Package | Current | Latest | Versions Behind | Last Published | Health |
|
|
146
|
+
- Sorted by risk (most behind + least maintained first)
|
|
147
|
+
|
|
148
|
+
5. **Upgrades Applied**
|
|
149
|
+
- Table: | Package | From | To | Tests Pass? |
|
|
150
|
+
- Any issues encountered during upgrades
|
|
151
|
+
|
|
152
|
+
6. **Major Upgrades Needed (Not Applied)**
|
|
153
|
+
- Table: | Package | Current | Target | Breaking Changes | Effort | Priority |
|
|
154
|
+
- Suggested upgrade order (accounting for dependencies between upgrades)
|
|
155
|
+
|
|
156
|
+
7. **Dependency Weight & Reduction**
|
|
157
|
+
- Heavy dependencies: table with | Package | Size/Impact | Usage | Alternative | Effort |
|
|
158
|
+
- Unused dependencies removed
|
|
159
|
+
- Replacement opportunities for team review
|
|
160
|
+
|
|
161
|
+
8. **Abandoned/At-Risk Dependencies**
|
|
162
|
+
- Table: | Package | Last Release | Maintainer Activity | Risk | Recommendation |
|
|
163
|
+
|
|
164
|
+
9. **Recommendations**
|
|
165
|
+
- Priority-ordered action items
|
|
166
|
+
- Suggested tooling for ongoing dependency health (Dependabot, Renovate, Snyk, etc.)
|
|
167
|
+
- Suggested policy for dependency additions (criteria for adopting new dependencies)
|
|
168
|
+
|
|
169
|
+
## Rules
|
|
170
|
+
- Branch: `dependency-health-[date]`
|
|
171
|
+
- Run full test suite after every upgrade attempt
|
|
172
|
+
- If tests fail after an upgrade, revert IMMEDIATELY — don't debug the upgrade, just document it
|
|
173
|
+
- DO NOT attempt major version upgrades unless the changelog clearly indicates the change is trivial for this project
|
|
174
|
+
- DO NOT replace or rewrite dependencies overnight — only remove unused ones
|
|
175
|
+
- For license assessment: flag risks, don't make legal determinations. The team needs to decide acceptable license policy.
|
|
176
|
+
- Use web search to check dependency health (npm page, GitHub repo, last release date, open issues)
|
|
177
|
+
- Be conservative. A working codebase with old dependencies is better than a broken codebase with new ones.
|
|
178
|
+
- You have all night. Be thorough. Check every dependency.
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
## Chat Output Requirement
|
|
182
|
+
|
|
183
|
+
In addition to writing the full report file, you MUST print a summary directly in the conversation when you finish. Do not make the user open the report to get the highlights. The chat summary should include:
|
|
184
|
+
|
|
185
|
+
### 1. Status Line
|
|
186
|
+
One sentence: what you did, how long it took, and whether all tests still pass.
|
|
187
|
+
|
|
188
|
+
### 2. Key Findings
|
|
189
|
+
The most important things discovered — bugs, risks, wins, or surprises. Each bullet should be specific and actionable, not vague. Lead with severity or impact.
|
|
190
|
+
|
|
191
|
+
**Good:** "CRITICAL: No backup configuration found for the primary Postgres database — total data loss risk."
|
|
192
|
+
**Bad:** "Found some issues with backups."
|
|
193
|
+
|
|
194
|
+
### 3. Changes Made (if applicable)
|
|
195
|
+
Bullet list of what was actually modified, added, or removed. Skip this section for read-only analysis runs.
|
|
196
|
+
|
|
197
|
+
### 4. Recommendations
|
|
198
|
+
|
|
199
|
+
If there are legitimately beneficial recommendations worth pursuing right now, present them in a table. Do **not** force recommendations — if the audit surfaced no actionable improvements, simply state that no recommendations are warranted at this time and move on.
|
|
200
|
+
|
|
201
|
+
When recommendations exist, use this table format:
|
|
202
|
+
|
|
203
|
+
| # | Recommendation | Impact | Risk if Ignored | Worth Doing? | Details |
|
|
204
|
+
|---|---|---|---|---|---|
|
|
205
|
+
| *Sequential number* | *Short description (≤10 words)* | *What improves if addressed* | *Low / Medium / High / Critical* | *Yes / Probably / Only if time allows* | *1–3 sentences explaining the reasoning, context, or implementation guidance* |
|
|
206
|
+
|
|
207
|
+
Order rows by risk descending (Critical → High → Medium → Low). Be honest in the "Worth Doing?" column — not everything flagged is worth the engineering time. If a recommendation is marginal, say so.
|
|
208
|
+
|
|
209
|
+
### 5. Report Location
|
|
210
|
+
State the full path to the detailed report file for deeper review.
|
|
211
|
+
|
|
212
|
+
---
|
|
213
|
+
|
|
214
|
+
**Formatting rules for chat output:**
|
|
215
|
+
- Use markdown headers, bold for severity labels, and bullet points for scannability.
|
|
216
|
+
- Do not duplicate the full report contents — just the highlights and recommendations.
|
|
217
|
+
- If you made zero findings in a phase, say so in one line rather than omitting it silently.
|