codingbuddy-rules 2.4.2 → 3.0.2

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.
Files changed (53) hide show
  1. package/.ai-rules/CHANGELOG.md +122 -0
  2. package/.ai-rules/agents/README.md +527 -11
  3. package/.ai-rules/agents/accessibility-specialist.json +0 -1
  4. package/.ai-rules/agents/act-mode.json +0 -1
  5. package/.ai-rules/agents/agent-architect.json +0 -1
  6. package/.ai-rules/agents/ai-ml-engineer.json +0 -1
  7. package/.ai-rules/agents/architecture-specialist.json +14 -2
  8. package/.ai-rules/agents/backend-developer.json +14 -2
  9. package/.ai-rules/agents/code-quality-specialist.json +0 -1
  10. package/.ai-rules/agents/data-engineer.json +0 -1
  11. package/.ai-rules/agents/devops-engineer.json +24 -2
  12. package/.ai-rules/agents/documentation-specialist.json +0 -1
  13. package/.ai-rules/agents/eval-mode.json +0 -1
  14. package/.ai-rules/agents/event-architecture-specialist.json +719 -0
  15. package/.ai-rules/agents/frontend-developer.json +14 -2
  16. package/.ai-rules/agents/i18n-specialist.json +0 -1
  17. package/.ai-rules/agents/integration-specialist.json +11 -1
  18. package/.ai-rules/agents/migration-specialist.json +676 -0
  19. package/.ai-rules/agents/mobile-developer.json +0 -1
  20. package/.ai-rules/agents/observability-specialist.json +747 -0
  21. package/.ai-rules/agents/performance-specialist.json +24 -2
  22. package/.ai-rules/agents/plan-mode.json +0 -1
  23. package/.ai-rules/agents/platform-engineer.json +0 -1
  24. package/.ai-rules/agents/security-specialist.json +27 -16
  25. package/.ai-rules/agents/seo-specialist.json +0 -1
  26. package/.ai-rules/agents/solution-architect.json +0 -1
  27. package/.ai-rules/agents/technical-planner.json +0 -1
  28. package/.ai-rules/agents/test-strategy-specialist.json +14 -2
  29. package/.ai-rules/agents/ui-ux-designer.json +0 -1
  30. package/.ai-rules/rules/core.md +25 -0
  31. package/.ai-rules/skills/README.md +35 -0
  32. package/.ai-rules/skills/database-migration/SKILL.md +531 -0
  33. package/.ai-rules/skills/database-migration/expand-contract-patterns.md +314 -0
  34. package/.ai-rules/skills/database-migration/large-scale-migration.md +414 -0
  35. package/.ai-rules/skills/database-migration/rollback-strategies.md +359 -0
  36. package/.ai-rules/skills/database-migration/validation-procedures.md +428 -0
  37. package/.ai-rules/skills/dependency-management/SKILL.md +381 -0
  38. package/.ai-rules/skills/dependency-management/license-compliance.md +282 -0
  39. package/.ai-rules/skills/dependency-management/lock-file-management.md +437 -0
  40. package/.ai-rules/skills/dependency-management/major-upgrade-guide.md +292 -0
  41. package/.ai-rules/skills/dependency-management/security-vulnerability-response.md +230 -0
  42. package/.ai-rules/skills/incident-response/SKILL.md +373 -0
  43. package/.ai-rules/skills/incident-response/communication-templates.md +322 -0
  44. package/.ai-rules/skills/incident-response/escalation-matrix.md +347 -0
  45. package/.ai-rules/skills/incident-response/postmortem-template.md +351 -0
  46. package/.ai-rules/skills/incident-response/severity-classification.md +256 -0
  47. package/.ai-rules/skills/performance-optimization/CREATION-LOG.md +87 -0
  48. package/.ai-rules/skills/performance-optimization/SKILL.md +76 -0
  49. package/.ai-rules/skills/performance-optimization/documentation-template.md +70 -0
  50. package/.ai-rules/skills/pr-review/SKILL.md +768 -0
  51. package/.ai-rules/skills/refactoring/SKILL.md +192 -0
  52. package/.ai-rules/skills/refactoring/refactoring-catalog.md +1377 -0
  53. package/package.json +1 -1
@@ -0,0 +1,381 @@
1
+ ---
2
+ name: dependency-management
3
+ description: Use when CVE discovered, major version upgrade needed, lock file conflicts occur, or license compliance audit required - guides systematic dependency health management
4
+ ---
5
+
6
+ # Dependency Management
7
+
8
+ ## Overview
9
+
10
+ Dependencies rot silently. Unmanaged packages become security liabilities, compatibility nightmares, and legal risks.
11
+
12
+ **Core principle:** ALWAYS assess, prioritize, and plan before updating. Rushed upgrades break production; ignored vulnerabilities enable breaches.
13
+
14
+ **Violating the letter of this process is violating the spirit of dependency management.**
15
+
16
+ ## First 5 Minutes Checklist (Security Vulnerability)
17
+
18
+ **Use this when CVE alert arrives. Don't think, follow the list.**
19
+
20
+ | Minute | Action | Output |
21
+ |--------|--------|--------|
22
+ | 0-1 | Identify affected package and version | `package@version` confirmed |
23
+ | 1-2 | Check CVE severity (CVSS score) | Severity (Critical/High/Medium/Low) |
24
+ | 2-3 | Verify if your app is affected | `affected` or `not_affected` |
25
+ | 3-4 | Check if patch available | `patch_available` or `no_patch` |
26
+ | 4-5 | If Critical/High: Create incident ticket | Stakeholders aware |
27
+
28
+ **After 5 minutes:** Proceed to Phase 2 (Assess Impact) - you've completed Detect.
29
+
30
+ ## The Iron Law
31
+
32
+ ```
33
+ NO UPGRADES WITHOUT IMPACT ASSESSMENT FIRST
34
+ ```
35
+
36
+ If you haven't assessed breaking changes and tested compatibility, you cannot merge dependency updates.
37
+
38
+ ## When to Use
39
+
40
+ Use for ANY dependency management task:
41
+ - Security vulnerability (CVE) response
42
+ - Major version upgrades
43
+ - Lock file merge conflicts
44
+ - License compliance audits
45
+ - Dependency health reviews
46
+ - Outdated package remediation
47
+
48
+ **Use this ESPECIALLY when:**
49
+ - Critical CVE discovered (pressure to "just update")
50
+ - Major version jump required (2.x to 3.x)
51
+ - Multiple conflicting lock file changes
52
+ - Preparing for compliance audit
53
+ - Inheriting legacy project with outdated deps
54
+
55
+ **Don't skip when:**
56
+ - "It's just a patch version" (patches can break too)
57
+ - "We're in a hurry" (systematic is faster than hotfix loops)
58
+ - "Everyone else uses this version" (your context differs)
59
+
60
+ ## When NOT to Use
61
+
62
+ This skill is for **systematic dependency management**. Don't use it for:
63
+
64
+ - **Adding new dependencies** - Evaluate need first, then use normal PR process
65
+ - **Development-only tools** - devDependencies with no prod impact
66
+ - **Automatic security patches** - Dependabot/Renovate auto-merge for patch versions
67
+ - **Learning/prototyping** - Experimental projects without production constraints
68
+
69
+ **Key distinction:** This skill manages systematic upgrade and security response. For simple package additions, use standard code review.
70
+
71
+ ## The Six Phases
72
+
73
+ You MUST complete each phase before proceeding to the next.
74
+
75
+ ```dot
76
+ digraph dependency_management {
77
+ rankdir=TB;
78
+ node [shape=box];
79
+
80
+ "1. Detect" -> "2. Assess Impact";
81
+ "2. Assess Impact" -> "3. Plan Upgrade";
82
+ "3. Plan Upgrade" -> "4. Execute";
83
+ "4. Execute" -> "5. Verify";
84
+ "5. Verify" -> "6. Document";
85
+
86
+ "Skip Phase?" [shape=diamond];
87
+ "2. Assess Impact" -> "Skip Phase?" [style=dashed, label="tempted?"];
88
+ "Skip Phase?" -> "STOP" [label="NO"];
89
+ "STOP" [shape=doublecircle, color=red];
90
+ }
91
+ ```
92
+
93
+ ### Phase 1: Detect
94
+
95
+ **Identify the dependency issue:**
96
+
97
+ 1. **For Security Vulnerabilities:**
98
+ - Run `npm audit` / `yarn audit` / `pnpm audit`
99
+ - Check CVE databases (NVD, GitHub Advisory)
100
+ - Note CVSS score and attack vector
101
+ - Identify affected versions
102
+
103
+ 2. **For Outdated Packages:**
104
+ - Run `npm outdated` / `yarn outdated`
105
+ - Identify major version gaps
106
+ - Check changelog for breaking changes
107
+ - Note last update date (maintenance status)
108
+
109
+ 3. **For License Issues:**
110
+ - Run license audit tool
111
+ - Identify copyleft licenses (GPL, AGPL)
112
+ - Check commercial restrictions
113
+ - Note transitive dependencies
114
+
115
+ **Completion criteria:**
116
+ - [ ] `issue_identified` - Package, version, and issue type documented
117
+ - [ ] `severity_classified` - Critical/High/Medium/Low assigned
118
+
119
+ ### Phase 2: Assess Impact
120
+
121
+ **Understand the blast radius BEFORE planning:**
122
+
123
+ See `security-vulnerability-response.md` for CVE-specific assessment.
124
+
125
+ 1. **Usage Analysis**
126
+ - Where is this package used in codebase?
127
+ - How many files/modules import it?
128
+ - Is it in critical path?
129
+
130
+ 2. **Breaking Change Analysis**
131
+ - Read CHANGELOG completely
132
+ - Identify API changes
133
+ - Check migration guide if available
134
+ - List incompatible changes
135
+
136
+ 3. **Dependency Chain**
137
+ - What depends on this package?
138
+ - Are there peer dependency conflicts?
139
+ - Will upgrading cascade to other packages?
140
+
141
+ 4. **Risk Assessment**
142
+ - Business impact if upgrade fails?
143
+ - Rollback complexity?
144
+ - Testing coverage for affected areas?
145
+
146
+ **Completion criteria:**
147
+ - [ ] `usage_mapped` - All import locations identified
148
+ - [ ] `breaking_changes_listed` - API changes documented
149
+ - [ ] `risk_assessed` - Impact level determined
150
+
151
+ ### Phase 3: Plan Upgrade
152
+
153
+ **Design the upgrade strategy:**
154
+
155
+ See `major-upgrade-guide.md` for staged upgrade patterns.
156
+
157
+ 1. **Choose Upgrade Path**
158
+ - Direct upgrade (minor/patch)
159
+ - Staged upgrade (major versions)
160
+ - Alternative package (if unmaintained)
161
+
162
+ 2. **For Major Upgrades:**
163
+ - Plan intermediate versions if needed
164
+ - Identify code changes required
165
+ - Estimate effort per change
166
+
167
+ 3. **For Security Patches:**
168
+ - Check if patch version available
169
+ - If not, evaluate workarounds
170
+ - Consider temporary mitigations
171
+
172
+ 4. **Create Upgrade Ticket**
173
+ - Document the plan
174
+ - Assign owner
175
+ - Set timeline based on severity
176
+
177
+ **Completion criteria:**
178
+ - [ ] `upgrade_path_defined` - Strategy documented
179
+ - [ ] `changes_estimated` - Code modifications listed
180
+ - [ ] `timeline_set` - Deadline based on severity
181
+
182
+ ### Phase 4: Execute
183
+
184
+ **Implement the upgrade:**
185
+
186
+ See `lock-file-management.md` for conflict resolution.
187
+
188
+ 1. **Create Feature Branch**
189
+ - Branch from main
190
+ - Clear naming: `deps/upgrade-package-v3`
191
+
192
+ 2. **Update Package**
193
+ - Update package.json
194
+ - Run install to update lock file
195
+ - Commit lock file changes separately
196
+
197
+ 3. **Make Required Code Changes**
198
+ - Apply API changes
199
+ - Update deprecated usages
200
+ - Add any new configurations
201
+
202
+ 4. **Run Tests**
203
+ - Full test suite
204
+ - Manual testing for critical paths
205
+ - Integration tests if applicable
206
+
207
+ **Completion criteria:**
208
+ - [ ] `package_updated` - Version bumped in package.json
209
+ - [ ] `lock_file_clean` - No merge conflicts
210
+ - [ ] `tests_passing` - All tests green
211
+
212
+ ### Phase 5: Verify
213
+
214
+ **Confirm the upgrade works:**
215
+
216
+ 1. **Build Verification**
217
+ - Production build succeeds
218
+ - No new warnings
219
+ - Bundle size acceptable
220
+
221
+ 2. **Runtime Verification**
222
+ - Application starts
223
+ - Critical paths work
224
+ - No console errors
225
+
226
+ 3. **Security Verification (if CVE)**
227
+ - Re-run audit tool
228
+ - Vulnerability resolved
229
+ - No new vulnerabilities introduced
230
+
231
+ **Completion criteria:**
232
+ - [ ] `build_verified` - Production build succeeds
233
+ - [ ] `runtime_verified` - Application works correctly
234
+ - [ ] `security_verified` - Audit passes (if CVE)
235
+
236
+ ### Phase 6: Document
237
+
238
+ **The upgrade is NOT complete until documented:**
239
+
240
+ 1. **Update Changelog**
241
+ - Note the upgrade
242
+ - List any breaking changes handled
243
+ - Reference CVE if security-related
244
+
245
+ 2. **Update Documentation**
246
+ - Update any version-specific docs
247
+ - Note configuration changes
248
+ - Update README if relevant
249
+
250
+ 3. **Close Tickets**
251
+ - Link PR to issue
252
+ - Close vulnerability ticket
253
+ - Update audit tracking
254
+
255
+ **Completion criteria:**
256
+ - [ ] `changelog_updated` - Upgrade documented
257
+ - [ ] `ticket_closed` - Issue resolved and linked
258
+
259
+ ## Red Flags - STOP and Follow Process
260
+
261
+ If you catch yourself thinking:
262
+ - "Just bump the version and see if it works"
263
+ - "It's only a patch, won't break anything"
264
+ - "We'll fix breaking changes as we find them"
265
+ - "Skip the audit, we need this deployed"
266
+ - "License doesn't matter for internal tools"
267
+ - "Lock file conflicts are fine to auto-resolve"
268
+ - "Dependabot will handle security"
269
+ - "We can deal with deprecation warnings later"
270
+
271
+ **ALL of these mean: STOP. Return to Phase 2.**
272
+
273
+ ## Common Rationalizations
274
+
275
+ | Excuse | Reality |
276
+ |--------|---------|
277
+ | "It's just a patch version" | Patch versions can contain breaking changes. Semantic versioning is a promise, not a guarantee. |
278
+ | "We're behind, need to catch up" | Rushed upgrades cause production incidents. Systematic upgrades are faster long-term. |
279
+ | "Everyone else uses this version" | Your codebase has unique usage patterns. Test YOUR code. |
280
+ | "Lock file changes are noise" | Lock file integrity prevents "works on my machine." Treat it as source code. |
281
+ | "License is fine, it's open source" | Open source has obligations. GPL can require code disclosure. Check ALWAYS. |
282
+ | "CVE doesn't affect us" | Verify with evidence, don't assume. Attack vectors are creative. |
283
+ | "We'll handle deprecations later" | Deprecation warnings become errors. Address when upgrading. |
284
+ | "Auto-merge is safe for patches" | Auto-merge is safe for MONITORED patches. Set up failure alerts. |
285
+
286
+ ## Quick Reference
287
+
288
+ | Phase | Key Activities | Verification Key |
289
+ |-------|---------------|------------------|
290
+ | **1. Detect** | Audit, identify, classify severity | `issue_identified` |
291
+ | **2. Assess** | Usage mapping, breaking changes, risk | `risk_assessed` |
292
+ | **3. Plan** | Upgrade path, code changes, timeline | `upgrade_path_defined` |
293
+ | **4. Execute** | Branch, update, test | `tests_passing` |
294
+ | **5. Verify** | Build, runtime, security audit | `build_verified` |
295
+ | **6. Document** | Changelog, docs, close tickets | `ticket_closed` |
296
+
297
+ ## Severity Response Times
298
+
299
+ | Severity | CVSS Score | Response Time | Action |
300
+ |----------|------------|---------------|--------|
301
+ | **Critical** | 9.0-10.0 | 24 hours | Immediate patch or mitigation |
302
+ | **High** | 7.0-8.9 | 7 days | Prioritized upgrade |
303
+ | **Medium** | 4.0-6.9 | 30 days | Scheduled upgrade |
304
+ | **Low** | 0.1-3.9 | 90 days | Next maintenance cycle |
305
+
306
+ ## Monorepo Considerations
307
+
308
+ When managing dependencies in monorepos (multiple package.json files):
309
+
310
+ ### Workspace Tools
311
+
312
+ | Tool | Command | Purpose |
313
+ |------|---------|---------|
314
+ | npm workspaces | `npm audit --workspaces` | Audit all workspaces |
315
+ | Yarn workspaces | `yarn workspaces foreach npm audit` | Audit each workspace |
316
+ | pnpm | `pnpm -r audit` | Recursive audit |
317
+ | Lerna | `lerna exec -- npm audit` | Execute in each package |
318
+ | Turborepo | `turbo run audit` | Run audit task |
319
+ | Nx | `nx run-many --target=audit` | Parallel audit |
320
+
321
+ ### Monorepo-Specific Workflow
322
+
323
+ 1. **Detect (Modified)**
324
+ - Audit ALL packages: `npm audit --workspaces`
325
+ - Check shared dependencies in root
326
+ - Identify which packages are affected
327
+
328
+ 2. **Assess Impact (Critical)**
329
+ - Map internal package dependencies
330
+ - Check if upgrade affects shared packages
331
+ - Consider publish order for internal packages
332
+
333
+ 3. **Execute (Coordinated)**
334
+ - Update root and workspace packages together
335
+ - Use `--workspace=<name>` for targeted updates
336
+ - Regenerate root lock file after all changes
337
+
338
+ ### Shared vs Package-Specific Dependencies
339
+
340
+ | Location | Use For | Example |
341
+ |----------|---------|---------|
342
+ | Root `package.json` | Shared tooling, workspace-wide deps | TypeScript, ESLint, build tools |
343
+ | Package `package.json` | Package-specific runtime deps | React (if only some packages need it) |
344
+
345
+ ### Version Synchronization
346
+
347
+ ```bash
348
+ # Ensure consistent versions across workspaces
349
+ npx syncpack list-mismatches
350
+ npx syncpack fix-mismatches
351
+ ```
352
+
353
+ ### CI Considerations
354
+
355
+ - Run audit in each workspace
356
+ - Verify all lock files are in sync
357
+ - Test affected packages after dependency changes
358
+
359
+ ## Supporting Files
360
+
361
+ These files provide detailed guidance for specific phases:
362
+
363
+ - **`security-vulnerability-response.md`** - CVE severity handling, patch assessment, temporary mitigations
364
+ - **`major-upgrade-guide.md`** - Breaking change analysis, staged upgrades, compatibility testing
365
+ - **`lock-file-management.md`** - Merge conflict resolution, CI validation, automation
366
+ - **`license-compliance.md`** - License obligations, compatibility matrices, audit procedures
367
+
368
+ ## Related Skills
369
+
370
+ - **superpowers:systematic-debugging** - For diagnosing upgrade-related failures
371
+ - **superpowers:test-driven-development** - For adding tests before risky upgrades
372
+ - **superpowers:incident-response** - If security upgrade causes production incident
373
+
374
+ ## Real-World Impact
375
+
376
+ From dependency management data:
377
+ - Systematic upgrades: 95% success rate, avg 30 min per package
378
+ - Ad-hoc upgrades: 60% success rate, avg 2 hours debugging
379
+ - CVE response with process: 4 hour average resolution
380
+ - CVE response without process: 48+ hour average resolution
381
+ - License audit findings: 70% caught by automated tooling
@@ -0,0 +1,282 @@
1
+ # License Compliance
2
+
3
+ Guide to open-source license obligations and compliance procedures.
4
+
5
+ ## Why License Compliance Matters
6
+
7
+ - **Legal risk:** License violations can result in lawsuits
8
+ - **Copyleft exposure:** GPL can require source disclosure
9
+ - **Commercial restrictions:** Some licenses prohibit commercial use
10
+ - **Attribution requirements:** Many licenses require credits
11
+
12
+ **Ignorance is not a defense.** Every dependency introduces license obligations.
13
+
14
+ ## License Categories
15
+
16
+ ### Permissive Licenses
17
+
18
+ Low risk, minimal obligations:
19
+
20
+ | License | Attribution | Modification | Commercial | Copyleft |
21
+ |---------|-------------|--------------|------------|----------|
22
+ | MIT | Required | Allowed | Allowed | No |
23
+ | Apache 2.0 | Required | Allowed | Allowed | No |
24
+ | BSD-2 | Required | Allowed | Allowed | No |
25
+ | BSD-3 | Required | Allowed | Allowed | No |
26
+ | ISC | Required | Allowed | Allowed | No |
27
+
28
+ **Safe for:** Most projects, including commercial and proprietary
29
+
30
+ ### Weak Copyleft
31
+
32
+ Medium risk, modifications must be shared:
33
+
34
+ | License | Attribution | Modification | Commercial | Copyleft |
35
+ |---------|-------------|--------------|------------|----------|
36
+ | LGPL-2.1 | Required | Share changes | Allowed | Library only |
37
+ | LGPL-3.0 | Required | Share changes | Allowed | Library only |
38
+ | MPL-2.0 | Required | Share changes | Allowed | File-level |
39
+
40
+ **Safe for:** Using as library, NOT modifying
41
+ **Requires attention:** If you modify the library code
42
+
43
+ ### Strong Copyleft
44
+
45
+ High risk, entire project may need to be open:
46
+
47
+ | License | Attribution | Modification | Commercial | Copyleft |
48
+ |---------|-------------|--------------|------------|----------|
49
+ | GPL-2.0 | Required | Share all | Allowed* | Full project |
50
+ | GPL-3.0 | Required | Share all | Allowed* | Full project |
51
+ | AGPL-3.0 | Required | Share all | Allowed* | Network use |
52
+
53
+ *Commercial allowed, but must open source entire work
54
+
55
+ **Warning:** Including GPL code in proprietary software may require open-sourcing your entire project.
56
+
57
+ ### Restrictive/Proprietary
58
+
59
+ High risk, limited or no use rights:
60
+
61
+ | License | Risk Level | Typical Restrictions |
62
+ |---------|------------|----------------------|
63
+ | SSPL | Very High | Network use requires full stack disclosure |
64
+ | BSL | High | Production use may require commercial license |
65
+ | Proprietary | Varies | Check specific terms |
66
+
67
+ ## License Compatibility Matrix
68
+
69
+ Can these licenses coexist in the same project?
70
+
71
+ | Base License | MIT | Apache | LGPL | GPL | AGPL |
72
+ |--------------|-----|--------|------|-----|------|
73
+ | **MIT** | Yes | Yes | Yes | Yes* | Yes* |
74
+ | **Apache 2.0** | Yes | Yes | Yes | No** | No |
75
+ | **LGPL** | Yes | Yes | Yes | Yes | Yes |
76
+ | **GPL** | Yes* | No** | Yes | Yes | Yes |
77
+ | **AGPL** | Yes* | No | Yes | Yes | Yes |
78
+
79
+ *Resulting work becomes GPL/AGPL
80
+ **Apache 2.0 is incompatible with GPL-2.0 (compatible with GPL-3.0)
81
+
82
+ ## Audit Procedures
83
+
84
+ ### Automated License Scanning
85
+
86
+ ```bash
87
+ # Using license-checker (npm)
88
+ npx license-checker --summary
89
+
90
+ # Detailed report
91
+ npx license-checker --json > licenses.json
92
+
93
+ # Check for problematic licenses
94
+ npx license-checker --failOn "GPL;AGPL;SSPL"
95
+ ```
96
+
97
+ ### CI Integration
98
+
99
+ ```yaml
100
+ # GitHub Actions
101
+ - name: License check
102
+ run: |
103
+ npx license-checker --failOn "GPL-3.0;AGPL-3.0;SSPL" --excludePrivatePackages
104
+ ```
105
+
106
+ ### Quarterly Audit Checklist
107
+
108
+ - [ ] Run license scanner on all projects
109
+ - [ ] Review any new licenses added
110
+ - [ ] Verify attribution files are current
111
+ - [ ] Check for license changes in updated packages
112
+ - [ ] Review transitive dependencies
113
+ - [ ] Document any approved exceptions
114
+
115
+ ## Attribution Requirements
116
+
117
+ ### NOTICE File
118
+
119
+ Create and maintain `NOTICE` or `THIRD_PARTY_LICENSES`:
120
+
121
+ ```markdown
122
+ # Third-Party Licenses
123
+
124
+ This software includes the following third-party components:
125
+
126
+ ## lodash
127
+ - License: MIT
128
+ - Copyright (c) JS Foundation and other contributors
129
+ - https://github.com/lodash/lodash/blob/master/LICENSE
130
+
131
+ ## axios
132
+ - License: MIT
133
+ - Copyright (c) 2014-present Matt Zabriskie
134
+ - https://github.com/axios/axios/blob/master/LICENSE
135
+ ```
136
+
137
+ ### Automated Attribution Generation
138
+
139
+ ```bash
140
+ # Generate license report
141
+ npx license-checker --customPath customFormat.json --out THIRD_PARTY_LICENSES.md
142
+ ```
143
+
144
+ ## Handling Problematic Licenses
145
+
146
+ ### GPL in JavaScript/Node.js
147
+
148
+ **Common misconception:** "GPL doesn't apply to npm packages"
149
+
150
+ **Reality:** If your code imports/requires GPL code, your code may become GPL.
151
+
152
+ **Mitigation options:**
153
+ 1. Find MIT/Apache alternative
154
+ 2. Use as separate service (not linked)
155
+ 3. Get commercial license from author
156
+ 4. Open source your project
157
+
158
+ ### AGPL Implications
159
+
160
+ AGPL extends GPL to network use. If your AGPL-licensed code runs on a server, users can request source code.
161
+
162
+ **Implications:**
163
+ - SaaS using AGPL must provide source
164
+ - Internal tools may be exempt
165
+ - Check with legal for specific cases
166
+
167
+ ### License Change After Adoption
168
+
169
+ If a dependency changes license:
170
+ 1. You can continue using the old version (old license applies)
171
+ 2. New versions require new license compliance
172
+ 3. Document the version/license you're using
173
+
174
+ ## Compliance Workflow
175
+
176
+ ### New Dependency Check
177
+
178
+ Before adding any dependency:
179
+
180
+ ```bash
181
+ # Check license
182
+ npm view <package> license
183
+
184
+ # Check for problematic transitive deps
185
+ npx license-checker --production --packages <package>
186
+ ```
187
+
188
+ Decision tree:
189
+
190
+ ```dot
191
+ digraph license_check {
192
+ "New dependency" -> "Check license";
193
+ "Check license" -> "Permissive?" [label="MIT/Apache/BSD"];
194
+ "Permissive?" -> "Approved" [label="yes"];
195
+ "Permissive?" -> "Weak copyleft?" [label="no"];
196
+ "Weak copyleft?" -> "Review modifications" [label="LGPL/MPL"];
197
+ "Weak copyleft?" -> "Strong copyleft?" [label="no"];
198
+ "Strong copyleft?" -> "Legal review" [label="GPL/AGPL"];
199
+ "Strong copyleft?" -> "Check restrictions" [label="other"];
200
+ }
201
+ ```
202
+
203
+ ### Approval Workflow
204
+
205
+ For non-permissive licenses:
206
+
207
+ 1. **Document the request**
208
+ - Package name and version
209
+ - License type
210
+ - Business justification
211
+
212
+ 2. **Legal/compliance review**
213
+ - Impact assessment
214
+ - Alternative evaluation
215
+ - Risk acceptance
216
+
217
+ 3. **Approval tracking**
218
+ - Record approval in decision log
219
+ - Add to approved exceptions list
220
+ - Set review date
221
+
222
+ ## Exception Tracking
223
+
224
+ ### Approved Exceptions Log
225
+
226
+ ```markdown
227
+ # License Exceptions
228
+
229
+ | Package | License | Approved By | Date | Reason | Review Date |
230
+ |---------|---------|-------------|------|--------|-------------|
231
+ | example-pkg | LGPL-2.1 | Legal Team | 2024-01-15 | No modification needed | 2025-01-15 |
232
+ ```
233
+
234
+ ### Exception Review Triggers
235
+
236
+ Review exceptions when:
237
+ - Package is updated
238
+ - Package license changes
239
+ - Usage pattern changes
240
+ - Compliance audit scheduled
241
+
242
+ ## Tools and Resources
243
+
244
+ ### License Scanning Tools
245
+
246
+ | Tool | Free Tier | CI Integration | Transitive Deps |
247
+ |------|-----------|----------------|-----------------|
248
+ | license-checker | Yes | Yes | Yes |
249
+ | FOSSA | Yes | Yes | Yes |
250
+ | Snyk | Yes | Yes | Yes |
251
+ | WhiteSource | No | Yes | Yes |
252
+
253
+ ### License Databases
254
+
255
+ - [SPDX License List](https://spdx.org/licenses/) - Standard identifiers
256
+ - [choosealicense.com](https://choosealicense.com/) - Plain language summaries
257
+ - [TLDRLegal](https://tldrlegal.com/) - License explanations
258
+
259
+ ### Legal Resources
260
+
261
+ - Open Source Initiative (OSI) - Official license definitions
262
+ - Software Freedom Conservancy - GPL compliance guidance
263
+ - Linux Foundation - Open source legal resources
264
+
265
+ ## Emergency Procedures
266
+
267
+ ### License Violation Discovered
268
+
269
+ 1. **Stop distribution** - Don't deploy updates with violation
270
+ 2. **Document scope** - What's affected, how long, where
271
+ 3. **Legal consultation** - Get professional advice
272
+ 4. **Remediation plan** - Remove, replace, or comply
273
+ 5. **Communication** - If public exposure, prepare response
274
+
275
+ ### GPL Compliance Request
276
+
277
+ If someone requests source under GPL:
278
+
279
+ 1. Verify the claim (is GPL code actually included?)
280
+ 2. Prepare the source code
281
+ 3. Provide within reasonable time (30 days typical)
282
+ 4. Review how to prevent future issues