Impact Analysis
Target: $1 $2
- Find all direct consumers:
grep -rn "from.*$1\|require.*$1\|import.*$1" src/ --include="*.ts" --include="*.tsx" | grep -v "node_modules"
- For each consumer, find their consumers (2 levels deep):
# For each file found above, repeat the grep
- Check for indirect usage:
- Dynamic imports:
import() - Re-exports: files that
export * from - Type-only imports that might break at runtime
- Check test coverage of the target:
grep -rn "$2\|$(basename $1 .ts)" src/ --include="*.test.*" --include="*.spec.*"
- Produce impact map:
src/auth/token.ts → changing this affects:
DIRECT (3 files):
src/middleware/auth.ts ← critical path
src/api/users.ts ← medium risk
src/utils/session.ts ← low risk
INDIRECT (7 files via middleware/auth.ts):
src/api/*.ts ← all protected routes
TESTS (2 files):
src/auth/token.test.ts
src/middleware/auth.test.ts
- Recommend: what tests to run, what to manually verify.