agileflow 4.0.0-alpha.2 → 4.0.0-alpha.21
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/CHANGELOG.md +51 -0
- package/content/plugins/accessibility/plugin.yaml +14 -0
- package/content/plugins/accessibility/skills/agileflow-accessibility/SKILL.md +392 -0
- package/content/plugins/accessibility/skills/agileflow-accessibility/references/aria-patterns.md +528 -0
- package/content/plugins/accessibility/skills/agileflow-accessibility/references/testing-checklist.md +457 -0
- package/content/plugins/accessibility/skills/agileflow-accessibility/references/wcag-guide.md +683 -0
- package/content/plugins/accessibility/skills/agileflow-accessibility/workflows/audit-page.md +310 -0
- package/content/plugins/accessibility/skills/agileflow-accessibility/workflows/implement-accessible-component.md +479 -0
- package/content/plugins/ads/agents/ads-audit-budget.md +185 -0
- package/content/plugins/ads/agents/ads-audit-compliance.md +171 -0
- package/content/plugins/ads/agents/ads-audit-creative.md +168 -0
- package/content/plugins/ads/agents/ads-audit-google.md +227 -0
- package/content/plugins/ads/agents/ads-audit-meta.md +184 -0
- package/content/plugins/ads/agents/ads-audit-tracking.md +205 -0
- package/content/plugins/ads/agents/ads-consensus.md +410 -0
- package/content/plugins/ads/agents/ads-generate.md +152 -0
- package/content/plugins/ads/agents/ads-performance-tracker.md +212 -0
- package/content/plugins/ads/plugin.yaml +23 -4
- package/content/plugins/ads/skills/agileflow-ads/SKILL.md +218 -0
- package/content/plugins/ads/skills/agileflow-ads/references/ad-copy-formula-guide.md +131 -0
- package/content/plugins/ads/skills/agileflow-ads/references/audience-targeting-guide.md +137 -0
- package/content/plugins/ads/skills/agileflow-ads/references/bid-strategy-guide.md +115 -0
- package/content/plugins/ads/skills/agileflow-ads/references/platform-benchmarks.md +100 -0
- package/content/plugins/ads/skills/agileflow-ads/workflows/audit.md +118 -0
- package/content/plugins/ads/skills/agileflow-ads/workflows/generate.md +84 -0
- package/content/plugins/audit/agents/a11y-analyzer-aria.md +173 -0
- package/content/plugins/audit/agents/a11y-analyzer-forms.md +173 -0
- package/content/plugins/audit/agents/a11y-analyzer-keyboard.md +183 -0
- package/content/plugins/audit/agents/a11y-analyzer-semantic.md +169 -0
- package/content/plugins/audit/agents/a11y-analyzer-visual.md +172 -0
- package/content/plugins/audit/agents/a11y-consensus.md +249 -0
- package/content/plugins/audit/agents/accessibility.md +558 -0
- package/content/plugins/audit/agents/api-quality-analyzer-conventions.md +156 -0
- package/content/plugins/audit/agents/api-quality-analyzer-docs.md +184 -0
- package/content/plugins/audit/agents/api-quality-analyzer-errors.md +191 -0
- package/content/plugins/audit/agents/api-quality-analyzer-pagination.md +179 -0
- package/content/plugins/audit/agents/api-quality-analyzer-versioning.md +150 -0
- package/content/plugins/audit/agents/api-quality-consensus.md +217 -0
- package/content/plugins/audit/agents/api-validator.md +191 -0
- package/content/plugins/audit/agents/arch-analyzer-circular.md +156 -0
- package/content/plugins/audit/agents/arch-analyzer-complexity.md +193 -0
- package/content/plugins/audit/agents/arch-analyzer-coupling.md +152 -0
- package/content/plugins/audit/agents/arch-analyzer-layering.md +160 -0
- package/content/plugins/audit/agents/arch-analyzer-patterns.md +210 -0
- package/content/plugins/audit/agents/arch-consensus.md +228 -0
- package/content/plugins/audit/agents/browser-qa.md +342 -0
- package/content/plugins/audit/agents/code-reviewer.md +298 -0
- package/content/plugins/audit/agents/completeness-analyzer-api.md +199 -0
- package/content/plugins/audit/agents/completeness-analyzer-conditional.md +211 -0
- package/content/plugins/audit/agents/completeness-analyzer-handlers.md +166 -0
- package/content/plugins/audit/agents/completeness-analyzer-imports.md +165 -0
- package/content/plugins/audit/agents/completeness-analyzer-routes.md +190 -0
- package/content/plugins/audit/agents/completeness-analyzer-state.md +196 -0
- package/content/plugins/audit/agents/completeness-analyzer-stubs.md +206 -0
- package/content/plugins/audit/agents/completeness-consensus.md +295 -0
- package/content/plugins/audit/agents/error-analyzer.md +213 -0
- package/content/plugins/audit/agents/flow-analyzer-authorization.md +182 -0
- package/content/plugins/audit/agents/flow-analyzer-discovery.md +174 -0
- package/content/plugins/audit/agents/flow-analyzer-errors.md +186 -0
- package/content/plugins/audit/agents/flow-analyzer-feedback.md +185 -0
- package/content/plugins/audit/agents/flow-analyzer-navigation.md +177 -0
- package/content/plugins/audit/agents/flow-analyzer-persistence.md +193 -0
- package/content/plugins/audit/agents/flow-analyzer-wiring.md +169 -0
- package/content/plugins/audit/agents/flow-consensus.md +237 -0
- package/content/plugins/audit/agents/legal-analyzer-a11y.md +114 -0
- package/content/plugins/audit/agents/legal-analyzer-ai.md +121 -0
- package/content/plugins/audit/agents/legal-analyzer-consumer.md +114 -0
- package/content/plugins/audit/agents/legal-analyzer-content.md +117 -0
- package/content/plugins/audit/agents/legal-analyzer-international.md +119 -0
- package/content/plugins/audit/agents/legal-analyzer-licensing.md +119 -0
- package/content/plugins/audit/agents/legal-analyzer-privacy.md +112 -0
- package/content/plugins/audit/agents/legal-analyzer-security.md +116 -0
- package/content/plugins/audit/agents/legal-analyzer-terms.md +115 -0
- package/content/plugins/audit/agents/legal-consensus.md +250 -0
- package/content/plugins/audit/agents/logic-analyzer-edge.md +179 -0
- package/content/plugins/audit/agents/logic-analyzer-flow.md +264 -0
- package/content/plugins/audit/agents/logic-analyzer-invariant.md +215 -0
- package/content/plugins/audit/agents/logic-analyzer-race.md +280 -0
- package/content/plugins/audit/agents/logic-analyzer-type.md +227 -0
- package/content/plugins/audit/agents/logic-consensus.md +259 -0
- package/content/plugins/audit/agents/perf-analyzer-assets.md +182 -0
- package/content/plugins/audit/agents/perf-analyzer-bundle.md +173 -0
- package/content/plugins/audit/agents/perf-analyzer-caching.md +170 -0
- package/content/plugins/audit/agents/perf-analyzer-compute.md +173 -0
- package/content/plugins/audit/agents/perf-analyzer-memory.md +193 -0
- package/content/plugins/audit/agents/perf-analyzer-network.md +165 -0
- package/content/plugins/audit/agents/perf-analyzer-queries.md +162 -0
- package/content/plugins/audit/agents/perf-analyzer-rendering.md +168 -0
- package/content/plugins/audit/agents/perf-consensus.md +287 -0
- package/content/plugins/audit/agents/qa.md +820 -0
- package/content/plugins/audit/agents/quality-analyzer-comments.md +159 -0
- package/content/plugins/audit/agents/quality-analyzer-duplication.md +184 -0
- package/content/plugins/audit/agents/quality-analyzer-naming.md +160 -0
- package/content/plugins/audit/agents/quality-consensus.md +241 -0
- package/content/plugins/audit/agents/schema-validator.md +473 -0
- package/content/plugins/audit/agents/security-analyzer-api.md +210 -0
- package/content/plugins/audit/agents/security-analyzer-auth.md +169 -0
- package/content/plugins/audit/agents/security-analyzer-authz.md +180 -0
- package/content/plugins/audit/agents/security-analyzer-deps.md +153 -0
- package/content/plugins/audit/agents/security-analyzer-infra.md +184 -0
- package/content/plugins/audit/agents/security-analyzer-injection.md +155 -0
- package/content/plugins/audit/agents/security-analyzer-input.md +201 -0
- package/content/plugins/audit/agents/security-analyzer-secrets.md +183 -0
- package/content/plugins/audit/agents/security-consensus.md +283 -0
- package/content/plugins/audit/agents/test-analyzer-assertions.md +188 -0
- package/content/plugins/audit/agents/test-analyzer-coverage.md +189 -0
- package/content/plugins/audit/agents/test-analyzer-fragility.md +193 -0
- package/content/plugins/audit/agents/test-analyzer-integration.md +161 -0
- package/content/plugins/audit/agents/test-analyzer-maintenance.md +180 -0
- package/content/plugins/audit/agents/test-analyzer-mocking.md +188 -0
- package/content/plugins/audit/agents/test-analyzer-patterns.md +196 -0
- package/content/plugins/audit/agents/test-analyzer-structure.md +184 -0
- package/content/plugins/audit/agents/test-consensus.md +301 -0
- package/content/plugins/audit/agents/testing.md +561 -0
- package/content/plugins/audit/agents/ui-validator.md +344 -0
- package/content/plugins/audit/plugin.yaml +186 -5
- package/content/plugins/audit/skills/agileflow-audit/SKILL.md +113 -0
- package/content/plugins/audit/skills/agileflow-audit/references/audit-depth-guide.md +151 -0
- package/content/plugins/audit/skills/agileflow-audit/references/dependency-risk-guide.md +139 -0
- package/content/plugins/audit/skills/agileflow-audit/references/owasp-top10.md +120 -0
- package/content/plugins/audit/skills/agileflow-audit/references/performance-budget-guide.md +143 -0
- package/content/plugins/audit/skills/agileflow-audit/references/wcag-criteria.md +117 -0
- package/content/plugins/audit/skills/agileflow-audit/workflows/run-audit.md +52 -0
- package/content/plugins/audit/skills/agileflow-audit/workflows/tdd.md +66 -0
- package/content/plugins/core/agents/adr-writer.md +521 -0
- package/content/plugins/core/agents/epic-planner.md +520 -0
- package/content/plugins/core/agents/mentor.md +709 -0
- package/content/plugins/core/agents/orchestrator.md +776 -0
- package/content/plugins/core/agents/team-coordinator.md +334 -0
- package/content/plugins/core/agents/team-lead.md +181 -0
- package/content/plugins/core/agents/workspace-orchestrator.md +146 -0
- package/content/plugins/core/hooks/context-loader.js +31 -4
- package/content/plugins/core/hooks/damage-control-bash.js +10 -2
- package/content/plugins/core/hooks/damage-control-edit.js +4 -1
- package/content/plugins/core/hooks/damage-control-patterns.yaml +1 -1
- package/content/plugins/core/hooks/damage-control-write.js +4 -1
- package/content/plugins/core/hooks/{pre-compact-state.js → post-compact-state.js} +25 -8
- package/content/plugins/core/hooks/preferences-injector.js +352 -0
- package/content/plugins/core/plugin.yaml +24 -28
- package/content/plugins/core/skills/agileflow-adr/SKILL.md +34 -8
- package/content/plugins/core/skills/agileflow-adr/references/madr-format-guide.md +86 -0
- package/content/plugins/core/skills/agileflow-adr/workflows/write-adr.md +57 -0
- package/content/plugins/core/skills/agileflow-babysit-mentor/SKILL.md +94 -27
- package/content/plugins/core/skills/agileflow-babysit-mentor/references/mentor-decision-guide.md +81 -0
- package/content/plugins/core/skills/agileflow-babysit-mentor/workflows/mentor-session.md +79 -0
- package/content/plugins/core/skills/agileflow-epic-planner/SKILL.md +37 -7
- package/content/plugins/core/skills/agileflow-epic-planner/references/epic-sizing-guide.md +81 -0
- package/content/plugins/core/skills/agileflow-epic-planner/workflows/plan-epic.md +55 -0
- package/content/plugins/core/skills/agileflow-status-updater/SKILL.md +36 -20
- package/content/plugins/core/skills/agileflow-status-updater/references/status-transitions.md +89 -0
- package/content/plugins/core/skills/agileflow-status-updater/workflows/update-status.md +56 -0
- package/content/plugins/core/skills/agileflow-story-writer/SKILL.md +39 -114
- package/content/plugins/core/skills/agileflow-story-writer/references/estimation-reference.md +36 -0
- package/content/plugins/core/skills/agileflow-story-writer/references/story-template.md +92 -0
- package/content/plugins/core/skills/agileflow-story-writer/workflows/write-story.md +138 -0
- package/content/plugins/council/agents/council-advocate.md +223 -0
- package/content/plugins/council/agents/council-analyst.md +278 -0
- package/content/plugins/council/agents/council-compounder.md +204 -0
- package/content/plugins/council/agents/council-contrarian.md +217 -0
- package/content/plugins/council/agents/council-moonshot.md +217 -0
- package/content/plugins/council/agents/council-optimist.md +185 -0
- package/content/plugins/council/agents/council-revenue.md +200 -0
- package/content/plugins/council/agents/council-technical.md +218 -0
- package/content/plugins/council/agents/multi-expert.md +334 -0
- package/content/plugins/council/plugin.yaml +23 -4
- package/content/plugins/council/skills/agileflow-council/SKILL.md +102 -0
- package/content/plugins/council/skills/agileflow-council/references/decision-log-template.md +109 -0
- package/content/plugins/council/skills/agileflow-council/references/perspective-guide.md +104 -0
- package/content/plugins/council/skills/agileflow-council/references/when-to-convene-guide.md +112 -0
- package/content/plugins/council/skills/agileflow-council/workflows/convene.md +73 -0
- package/content/plugins/council/skills/agileflow-council/workflows/multi-expert.md +75 -0
- package/content/plugins/database/plugin.yaml +14 -0
- package/content/plugins/database/skills/agileflow-database/SKILL.md +284 -0
- package/content/plugins/database/skills/agileflow-database/references/indexing-guide.md +313 -0
- package/content/plugins/database/skills/agileflow-database/references/migration-guide.md +328 -0
- package/content/plugins/database/skills/agileflow-database/references/schema-design-guide.md +467 -0
- package/content/plugins/database/skills/agileflow-database/workflows/design-schema.md +213 -0
- package/content/plugins/database/skills/agileflow-database/workflows/optimize-query.md +253 -0
- package/content/plugins/debugging/plugin.yaml +14 -0
- package/content/plugins/debugging/skills/agileflow-debug/SKILL.md +236 -0
- package/content/plugins/debugging/skills/agileflow-debug/references/common-patterns.md +350 -0
- package/content/plugins/debugging/skills/agileflow-debug/references/debugging-strategies.md +328 -0
- package/content/plugins/debugging/skills/agileflow-debug/workflows/debug-issue.md +187 -0
- package/content/plugins/debugging/skills/agileflow-debug/workflows/reproduce-bug.md +194 -0
- package/content/plugins/delivery/agents/ci.md +547 -0
- package/content/plugins/delivery/agents/devops.md +789 -0
- package/content/plugins/delivery/plugin.yaml +19 -0
- package/content/plugins/delivery/skills/agileflow-delivery/SKILL.md +111 -0
- package/content/plugins/delivery/skills/agileflow-delivery/references/changelog-format-guide.md +133 -0
- package/content/plugins/delivery/skills/agileflow-delivery/references/ci-pipeline-guide.md +158 -0
- package/content/plugins/delivery/skills/agileflow-delivery/references/pr-checklist-guide.md +133 -0
- package/content/plugins/delivery/skills/agileflow-delivery/references/release-checklist.md +142 -0
- package/content/plugins/delivery/skills/agileflow-delivery/workflows/changelog.md +72 -0
- package/content/plugins/delivery/skills/agileflow-delivery/workflows/deploy.md +74 -0
- package/content/plugins/delivery/skills/agileflow-delivery/workflows/pr.md +75 -0
- package/content/plugins/docs/agents/documentation.md +544 -0
- package/content/plugins/docs/agents/readme-updater.md +640 -0
- package/content/plugins/docs/plugin.yaml +19 -0
- package/content/plugins/docs/skills/agileflow-docs/SKILL.md +106 -0
- package/content/plugins/docs/skills/agileflow-docs/references/api-doc-template.md +167 -0
- package/content/plugins/docs/skills/agileflow-docs/references/doc-types-guide.md +141 -0
- package/content/plugins/docs/skills/agileflow-docs/references/readme-template.md +156 -0
- package/content/plugins/docs/skills/agileflow-docs/workflows/readme-sync.md +57 -0
- package/content/plugins/docs/skills/agileflow-docs/workflows/sync.md +64 -0
- package/content/plugins/engineering/agents/api.md +718 -0
- package/content/plugins/engineering/agents/codebase-query.md +285 -0
- package/content/plugins/engineering/agents/compliance.md +559 -0
- package/content/plugins/engineering/agents/database.md +644 -0
- package/content/plugins/engineering/agents/integrations.md +644 -0
- package/content/plugins/engineering/agents/mobile.md +552 -0
- package/content/plugins/engineering/agents/monitoring.md +585 -0
- package/content/plugins/engineering/agents/performance.md +529 -0
- package/content/plugins/engineering/agents/refactor.md +592 -0
- package/content/plugins/engineering/agents/security.md +524 -0
- package/content/plugins/engineering/agents/ui.md +1336 -0
- package/content/plugins/engineering/plugin.yaml +37 -0
- package/content/plugins/engineering/skills/agileflow-engineering/SKILL.md +127 -0
- package/content/plugins/engineering/skills/agileflow-engineering/references/code-review-guide.md +126 -0
- package/content/plugins/engineering/skills/agileflow-engineering/references/domain-routing-guide.md +89 -0
- package/content/plugins/engineering/skills/agileflow-engineering/references/refactoring-guide.md +136 -0
- package/content/plugins/engineering/skills/agileflow-engineering/workflows/diagnose.md +63 -0
- package/content/plugins/engineering/skills/agileflow-engineering/workflows/impact.md +60 -0
- package/content/plugins/ideation/agents/brainstorm-analyzer-features.md +179 -0
- package/content/plugins/ideation/agents/brainstorm-analyzer-growth.md +169 -0
- package/content/plugins/ideation/agents/brainstorm-analyzer-integration.md +181 -0
- package/content/plugins/ideation/agents/brainstorm-analyzer-market.md +150 -0
- package/content/plugins/ideation/agents/brainstorm-analyzer-ux.md +180 -0
- package/content/plugins/ideation/agents/brainstorm-consensus.md +245 -0
- package/content/plugins/ideation/agents/design.md +568 -0
- package/content/plugins/ideation/agents/product.md +582 -0
- package/content/plugins/ideation/plugin.yaml +31 -0
- package/content/plugins/ideation/skills/agileflow-ideation/SKILL.md +109 -0
- package/content/plugins/ideation/skills/agileflow-ideation/references/brainstorm-techniques.md +138 -0
- package/content/plugins/ideation/skills/agileflow-ideation/references/competitive-analysis-template.md +148 -0
- package/content/plugins/ideation/skills/agileflow-ideation/references/feature-prioritization-guide.md +147 -0
- package/content/plugins/ideation/skills/agileflow-ideation/references/user-story-patterns.md +152 -0
- package/content/plugins/ideation/skills/agileflow-ideation/workflows/features.md +65 -0
- package/content/plugins/ideation/skills/agileflow-ideation/workflows/ideate.md +54 -0
- package/content/plugins/migration/agents/datamigration.md +757 -0
- package/content/plugins/migration/plugin.yaml +17 -0
- package/content/plugins/migration/skills/agileflow-migration/SKILL.md +106 -0
- package/content/plugins/migration/skills/agileflow-migration/references/data-validation-checklist.md +154 -0
- package/content/plugins/migration/skills/agileflow-migration/references/migration-patterns.md +209 -0
- package/content/plugins/migration/skills/agileflow-migration/references/rollback-playbook.md +171 -0
- package/content/plugins/migration/skills/agileflow-migration/references/version-compatibility-matrix.md +155 -0
- package/content/plugins/migration/skills/agileflow-migration/workflows/plan.md +73 -0
- package/content/plugins/migration/skills/agileflow-migration/workflows/validate.md +71 -0
- package/content/plugins/performance/plugin.yaml +14 -0
- package/content/plugins/performance/skills/agileflow-performance/SKILL.md +224 -0
- package/content/plugins/performance/skills/agileflow-performance/references/optimization-patterns.md +554 -0
- package/content/plugins/performance/skills/agileflow-performance/references/profiling-guide.md +383 -0
- package/content/plugins/performance/skills/agileflow-performance/references/web-vitals-guide.md +360 -0
- package/content/plugins/performance/skills/agileflow-performance/workflows/improve-web-vitals.md +344 -0
- package/content/plugins/performance/skills/agileflow-performance/workflows/profile-and-fix.md +254 -0
- package/content/plugins/planning/agents/analytics.md +670 -0
- package/content/plugins/planning/agents/rlm-subcore.md +215 -0
- package/content/plugins/planning/plugin.yaml +19 -0
- package/content/plugins/planning/skills/agileflow-planning/SKILL.md +111 -0
- package/content/plugins/planning/skills/agileflow-planning/references/estimation-guide.md +114 -0
- package/content/plugins/planning/skills/agileflow-planning/references/rpi-workflow.md +119 -0
- package/content/plugins/planning/skills/agileflow-planning/references/sprint-planning-guide.md +145 -0
- package/content/plugins/planning/skills/agileflow-planning/workflows/impact.md +63 -0
- package/content/plugins/planning/skills/agileflow-planning/workflows/rpi.md +104 -0
- package/content/plugins/psychology/plugin.yaml +14 -0
- package/content/plugins/psychology/skills/agileflow-retention/SKILL.md +252 -0
- package/content/plugins/psychology/skills/agileflow-retention/references/competitor-analysis.md +240 -0
- package/content/plugins/psychology/skills/agileflow-retention/references/psychology-models.md +349 -0
- package/content/plugins/psychology/skills/agileflow-retention/references/retention-patterns.md +279 -0
- package/content/plugins/psychology/skills/agileflow-retention/workflows/design-retention-feature.md +287 -0
- package/content/plugins/psychology/skills/agileflow-retention/workflows/retention-audit.md +259 -0
- package/content/plugins/refactoring/plugin.yaml +14 -0
- package/content/plugins/refactoring/skills/agileflow-refactor/SKILL.md +235 -0
- package/content/plugins/refactoring/skills/agileflow-refactor/references/refactoring-patterns.md +405 -0
- package/content/plugins/refactoring/skills/agileflow-refactor/references/safety-checks.md +177 -0
- package/content/plugins/refactoring/skills/agileflow-refactor/workflows/extract-module.md +226 -0
- package/content/plugins/refactoring/skills/agileflow-refactor/workflows/safe-refactor.md +169 -0
- package/content/plugins/research/agents/research.md +503 -0
- package/content/plugins/research/plugin.yaml +17 -0
- package/content/plugins/research/skills/agileflow-research/SKILL.md +110 -0
- package/content/plugins/research/skills/agileflow-research/references/knowledge-decay-guide.md +121 -0
- package/content/plugins/research/skills/agileflow-research/references/research-prompt-guide.md +141 -0
- package/content/plugins/research/skills/agileflow-research/references/synthesis-template.md +154 -0
- package/content/plugins/research/skills/agileflow-research/workflows/analyze.md +60 -0
- package/content/plugins/research/skills/agileflow-research/workflows/ask.md +64 -0
- package/content/plugins/research/skills/agileflow-research/workflows/import.md +66 -0
- package/content/plugins/research/skills/agileflow-research/workflows/synthesize.md +66 -0
- package/content/plugins/reviews/plugin.yaml +14 -0
- package/content/plugins/reviews/skills/agileflow-pr-reviewer/SKILL.md +241 -0
- package/content/plugins/reviews/skills/agileflow-pr-reviewer/references/review-checklist.md +200 -0
- package/content/plugins/reviews/skills/agileflow-pr-reviewer/references/security-patterns.md +328 -0
- package/content/plugins/reviews/skills/agileflow-pr-reviewer/workflows/review-pr.md +153 -0
- package/content/plugins/reviews/skills/agileflow-pr-reviewer/workflows/security-review.md +177 -0
- package/content/plugins/seo/agents/seo-analyzer-content.md +169 -0
- package/content/plugins/seo/agents/seo-analyzer-images.md +198 -0
- package/content/plugins/seo/agents/seo-analyzer-performance.md +217 -0
- package/content/plugins/seo/agents/seo-analyzer-schema.md +184 -0
- package/content/plugins/seo/agents/seo-analyzer-sitemap.md +177 -0
- package/content/plugins/seo/agents/seo-analyzer-technical.md +151 -0
- package/content/plugins/seo/agents/seo-consensus.md +304 -0
- package/content/plugins/seo/plugin.yaml +19 -4
- package/content/plugins/seo/skills/agileflow-seo/SKILL.md +188 -0
- package/content/plugins/seo/skills/agileflow-seo/references/cwv-thresholds.md +110 -0
- package/content/plugins/seo/skills/agileflow-seo/references/eeat-framework.md +144 -0
- package/content/plugins/seo/skills/agileflow-seo/references/keyword-research-guide.md +125 -0
- package/content/plugins/seo/skills/agileflow-seo/references/schema-types.md +139 -0
- package/content/plugins/seo/skills/agileflow-seo/references/technical-seo-checklist.md +139 -0
- package/content/plugins/seo/skills/agileflow-seo/workflows/audit.md +98 -0
- package/content/plugins/seo/skills/agileflow-seo/workflows/page.md +118 -0
- package/content/plugins/testing/plugin.yaml +16 -0
- package/content/plugins/testing/skills/agileflow-test-writer/SKILL.md +260 -0
- package/content/plugins/testing/skills/agileflow-test-writer/references/coverage-targets.md +239 -0
- package/content/plugins/testing/skills/agileflow-test-writer/references/test-patterns.md +420 -0
- package/content/plugins/testing/skills/agileflow-test-writer/workflows/add-coverage.md +154 -0
- package/content/plugins/testing/skills/agileflow-test-writer/workflows/write-tests-from-ac.md +225 -0
- package/package.json +2 -2
- package/src/cli/commands/doctor.js +818 -30
- package/src/cli/commands/hook.js +17 -14
- package/src/cli/commands/launch.js +1454 -0
- package/src/cli/commands/learn.js +149 -0
- package/src/cli/commands/plugins.js +113 -0
- package/src/cli/commands/setup.js +455 -110
- package/src/cli/commands/skills.js +324 -0
- package/src/cli/commands/status.js +8 -10
- package/src/cli/commands/update.js +76 -15
- package/src/cli/index.js +90 -26
- package/src/cli/wizard/babysit-mode-picker.js +192 -0
- package/src/cli/wizard/behaviors-picker.js +208 -54
- package/src/cli/wizard/ide-picker.js +40 -28
- package/src/cli/wizard/install-scope-picker.js +57 -0
- package/src/cli/wizard/launch-alias-picker.js +50 -0
- package/src/cli/wizard/launch-cli-picker.js +129 -0
- package/src/cli/wizard/launch-tmux-picker.js +133 -0
- package/src/cli/wizard/learnings-picker.js +40 -0
- package/src/cli/wizard/plugin-picker.js +47 -16
- package/src/lib/brand.js +116 -0
- package/src/lib/errors.js +120 -0
- package/src/lib/path-check.js +39 -0
- package/src/runtime/config/defaults.js +22 -17
- package/src/runtime/config/loader.js +77 -8
- package/src/runtime/config/schema.json +43 -16
- package/src/runtime/config/writer.js +3 -1
- package/src/runtime/ide/babysit-skill.js +202 -0
- package/src/runtime/ide/capabilities.js +84 -29
- package/src/runtime/ide/claude-code-content.js +177 -0
- package/src/runtime/ide/claude-code-settings.js +67 -29
- package/src/runtime/ide/claude-code-skills.js +47 -32
- package/src/runtime/ide/codex-config.js +295 -0
- package/src/runtime/installer/install.js +252 -24
- package/src/runtime/launch/alias-installer.js +191 -0
- package/src/runtime/launch/cli-resume.js +244 -0
- package/src/runtime/launch/closed-windows.js +338 -0
- package/src/runtime/launch/defaults.js +66 -0
- package/src/runtime/launch/detect-clis.js +69 -0
- package/src/runtime/launch/doctor.js +464 -0
- package/src/runtime/launch/exec-wrapper.js +114 -0
- package/src/runtime/launch/parallel-session.js +247 -0
- package/src/runtime/launch/prefs.js +211 -0
- package/src/runtime/launch/project-prefs.js +234 -0
- package/src/runtime/launch/resolve-cli.js +56 -0
- package/src/runtime/launch/restore.js +152 -0
- package/src/runtime/launch/schema.json +75 -0
- package/src/runtime/launch/session-lifecycle.js +313 -0
- package/src/runtime/launch/session-registry.js +401 -0
- package/src/runtime/launch/spawn.js +103 -0
- package/src/runtime/launch/tabs.js +350 -0
- package/src/runtime/launch/tmux.js +764 -0
- package/src/runtime/launch/worktree.js +260 -0
- package/src/runtime/plugins/registry.js +16 -11
- package/src/runtime/plugins/validator.js +57 -43
- package/src/runtime/skills/learnings.js +308 -0
- package/content/plugins/core/hooks/babysit-mentor-injector.js +0 -55
- package/src/cli/wizard/personalization.js +0 -64
|
@@ -0,0 +1,350 @@
|
|
|
1
|
+
# Common Bug Patterns Reference
|
|
2
|
+
|
|
3
|
+
**Load this when:** you've isolated a bug to a general category and want to match it to known patterns, or when you want to check if the current bug is an instance of a recurring type.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Category 1: Null and undefined errors
|
|
8
|
+
|
|
9
|
+
The most common category. Almost always caused by an assumption that a value will exist.
|
|
10
|
+
|
|
11
|
+
### Pattern 1.1: DB query returning null unexpectedly
|
|
12
|
+
|
|
13
|
+
**Symptom:** `TypeError: Cannot read properties of null` on a field of a database result
|
|
14
|
+
|
|
15
|
+
**Cause:** The record doesn't exist in the database, but the code assumed it always would.
|
|
16
|
+
|
|
17
|
+
```js
|
|
18
|
+
// Bug
|
|
19
|
+
const user = await User.findById(req.params.id);
|
|
20
|
+
return res.json({ name: user.name }); // TypeError if user is null
|
|
21
|
+
|
|
22
|
+
// Fix
|
|
23
|
+
const user = await User.findById(req.params.id);
|
|
24
|
+
if (!user) return res.status(404).json({ error: "User not found" });
|
|
25
|
+
return res.json({ name: user.name });
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
**Root cause:** Missing null check after a database lookup that can return null.
|
|
29
|
+
|
|
30
|
+
### Pattern 1.2: Optional chaining pitfall
|
|
31
|
+
|
|
32
|
+
**Symptom:** Code with `?.` returns `undefined` but code downstream doesn't handle it.
|
|
33
|
+
|
|
34
|
+
```js
|
|
35
|
+
// Bug: silently returns undefined, downstream code crashes
|
|
36
|
+
const email = user?.profile?.contact?.email;
|
|
37
|
+
await sendWelcome(email); // email is undefined; sendWelcome crashes or sends to undefined
|
|
38
|
+
|
|
39
|
+
// Fix: guard before using the result
|
|
40
|
+
const email = user?.profile?.contact?.email;
|
|
41
|
+
if (!email) throw new Error(`User ${user.id} has no email address`);
|
|
42
|
+
await sendWelcome(email);
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Pattern 1.3: Array empty result not handled
|
|
46
|
+
|
|
47
|
+
```js
|
|
48
|
+
// Bug: assumes at least one result
|
|
49
|
+
const admins = await User.findAll({ where: { role: "admin" } });
|
|
50
|
+
const primaryAdmin = admins[0]; // undefined if admins is []
|
|
51
|
+
await notifyAdmin(primaryAdmin.email); // crash
|
|
52
|
+
|
|
53
|
+
// Fix
|
|
54
|
+
if (admins.length === 0) throw new Error("No admin users found");
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## Category 2: Async / Promise errors
|
|
60
|
+
|
|
61
|
+
### Pattern 2.1: Missing await
|
|
62
|
+
|
|
63
|
+
**Symptom:** Code behaves as if it's using a default/empty value, then later operations fail.
|
|
64
|
+
|
|
65
|
+
```js
|
|
66
|
+
// Bug: result is a Promise, not the actual value
|
|
67
|
+
const user = User.findById(id); // missing await
|
|
68
|
+
console.log(user.name); // Promise object doesn't have .name
|
|
69
|
+
|
|
70
|
+
// Fix
|
|
71
|
+
const user = await User.findById(id);
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
**How to spot it:** Look for property access on a variable that holds a Promise. TypeScript catches this if types are correct.
|
|
75
|
+
|
|
76
|
+
### Pattern 2.2: Fire and forget (unhandled rejection)
|
|
77
|
+
|
|
78
|
+
**Symptom:** Silent failure — something should happen but doesn't; sometimes shows as `UnhandledPromiseRejection` in logs.
|
|
79
|
+
|
|
80
|
+
```js
|
|
81
|
+
// Bug: if sendEmail rejects, nobody knows
|
|
82
|
+
emailService.sendWelcome(user.email);
|
|
83
|
+
|
|
84
|
+
// Fix option 1: await and handle
|
|
85
|
+
await emailService.sendWelcome(user.email);
|
|
86
|
+
|
|
87
|
+
// Fix option 2: intentional fire-and-forget with error logging
|
|
88
|
+
emailService.sendWelcome(user.email).catch((err) => {
|
|
89
|
+
logger.error("Failed to send welcome email", { userId: user.id, err });
|
|
90
|
+
});
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Pattern 2.3: Promise.all short-circuit
|
|
94
|
+
|
|
95
|
+
**Symptom:** One of several parallel operations fails, but the error is confusing because it mentions a different operation.
|
|
96
|
+
|
|
97
|
+
```js
|
|
98
|
+
// Bug: if any one fails, ALL results are lost; error message may reference the wrong one
|
|
99
|
+
const [orders, invoices, payments] = await Promise.all([
|
|
100
|
+
getOrders(userId),
|
|
101
|
+
getInvoices(userId),
|
|
102
|
+
getPayments(userId), // this one fails
|
|
103
|
+
]);
|
|
104
|
+
|
|
105
|
+
// Fix: if partial results are acceptable, use Promise.allSettled
|
|
106
|
+
const results = await Promise.allSettled(
|
|
107
|
+
[getOrders, getInvoices, getPayments].map((fn) => fn(userId)),
|
|
108
|
+
);
|
|
109
|
+
const [orders, invoices, payments] = results.map((r) =>
|
|
110
|
+
r.status === "fulfilled" ? r.value : null,
|
|
111
|
+
);
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
---
|
|
115
|
+
|
|
116
|
+
## Category 3: Race conditions
|
|
117
|
+
|
|
118
|
+
### Pattern 3.1: Check-then-act (TOCTOU)
|
|
119
|
+
|
|
120
|
+
**Symptom:** Intermittent duplicate records or constraint violation errors.
|
|
121
|
+
|
|
122
|
+
```js
|
|
123
|
+
// Bug: another request can insert between the check and the insert
|
|
124
|
+
const existing = await User.findByEmail(email);
|
|
125
|
+
if (existing) throw new Error("Email already taken");
|
|
126
|
+
await User.create({ email }); // another request may have inserted by now
|
|
127
|
+
|
|
128
|
+
// Fix: use a unique constraint in the database + catch the constraint error
|
|
129
|
+
try {
|
|
130
|
+
await User.create({ email });
|
|
131
|
+
} catch (err) {
|
|
132
|
+
if (err.code === "ER_DUP_ENTRY" || err.constraint === "users_email_key") {
|
|
133
|
+
throw new ConflictError("Email already taken");
|
|
134
|
+
}
|
|
135
|
+
throw err;
|
|
136
|
+
}
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### Pattern 3.2: Shared in-memory state across async operations
|
|
140
|
+
|
|
141
|
+
**Symptom:** Data from request A appears in request B's response.
|
|
142
|
+
|
|
143
|
+
```js
|
|
144
|
+
// Bug: object modified across async boundary — shared between requests
|
|
145
|
+
const cache = {}; // module-level — shared across ALL requests
|
|
146
|
+
|
|
147
|
+
app.get("/user/:id", async (req, res) => {
|
|
148
|
+
cache.currentUserId = req.params.id; // BUG: shared state
|
|
149
|
+
const user = await getUser(cache.currentUserId); // may get wrong ID
|
|
150
|
+
res.json(user);
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
// Fix: keep state per-request, not at module level
|
|
154
|
+
app.get("/user/:id", async (req, res) => {
|
|
155
|
+
const userId = req.params.id; // request-scoped variable
|
|
156
|
+
const user = await getUser(userId);
|
|
157
|
+
res.json(user);
|
|
158
|
+
});
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### Pattern 3.3: Increment / decrement race
|
|
162
|
+
|
|
163
|
+
**Symptom:** Counter or balance goes negative or to wrong value under concurrent load.
|
|
164
|
+
|
|
165
|
+
```sql
|
|
166
|
+
-- Bug: both requests read balance=100, both subtract 80, both update to 20
|
|
167
|
+
-- instead of one update failing
|
|
168
|
+
UPDATE accounts SET balance = balance - 80 WHERE id = 5;
|
|
169
|
+
|
|
170
|
+
-- Fix: use a conditional update and check rows affected
|
|
171
|
+
UPDATE accounts SET balance = balance - 80 WHERE id = 5 AND balance >= 80;
|
|
172
|
+
-- If 0 rows updated: insufficient balance
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
---
|
|
176
|
+
|
|
177
|
+
## Category 4: Type and coercion bugs
|
|
178
|
+
|
|
179
|
+
### Pattern 4.1: Loose equality causing incorrect branching
|
|
180
|
+
|
|
181
|
+
```js
|
|
182
|
+
// Bug: 0 is falsy — empty cart treated as "no cart found"
|
|
183
|
+
if (!cartCount) return res.json({ empty: true }); // fires when cartCount === 0
|
|
184
|
+
|
|
185
|
+
// Fix: explicit comparison
|
|
186
|
+
if (cartCount === null || cartCount === undefined)
|
|
187
|
+
return res.json({ empty: true });
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
### Pattern 4.2: String/number confusion from external input
|
|
191
|
+
|
|
192
|
+
```js
|
|
193
|
+
// Bug: URL param is always a string
|
|
194
|
+
app.get("/items/:page", (req, res) => {
|
|
195
|
+
const page = req.params.page; // "1" (string)
|
|
196
|
+
const offset = page * 10; // "1" * 10 = 10 (works, implicit coercion)
|
|
197
|
+
const nextPage = page + 1; // "11" (string concat!) ← bug
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
// Fix: always parse external inputs
|
|
201
|
+
const page = parseInt(req.params.page, 10);
|
|
202
|
+
if (isNaN(page) || page < 1)
|
|
203
|
+
return res.status(400).json({ error: "Invalid page" });
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
### Pattern 4.3: JSON parse / stringify precision loss
|
|
207
|
+
|
|
208
|
+
```js
|
|
209
|
+
// Bug: JavaScript numbers lose precision beyond 2^53
|
|
210
|
+
const id = JSON.parse('{ "id": 9007199254740993 }').id;
|
|
211
|
+
console.log(id); // 9007199254740992 — wrong!
|
|
212
|
+
|
|
213
|
+
// Fix: use a JSON bigint-aware parser, or return IDs as strings
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
---
|
|
217
|
+
|
|
218
|
+
## Category 5: State management bugs
|
|
219
|
+
|
|
220
|
+
### Pattern 5.1: Stale closure
|
|
221
|
+
|
|
222
|
+
**Symptom:** A variable in an event handler or callback has the wrong (old) value.
|
|
223
|
+
|
|
224
|
+
```js
|
|
225
|
+
// Bug: `count` in the closure is from when the handler was created
|
|
226
|
+
let count = 0;
|
|
227
|
+
button.addEventListener("click", () => {
|
|
228
|
+
count++;
|
|
229
|
+
setTimeout(() => {
|
|
230
|
+
console.log(count); // always logs the count from when setTimeout was called, not when it fires
|
|
231
|
+
}, 1000);
|
|
232
|
+
});
|
|
233
|
+
|
|
234
|
+
// Fix: use a ref (React), use useCallback/useRef, or read from state on every access
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
### Pattern 5.2: Mutating props / arguments
|
|
238
|
+
|
|
239
|
+
```js
|
|
240
|
+
// Bug: mutates the input object — caller's data is changed
|
|
241
|
+
function normalise(user) {
|
|
242
|
+
user.email = user.email.toLowerCase(); // ← modifies the original
|
|
243
|
+
return user;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
// Fix: return a new object
|
|
247
|
+
function normalise(user) {
|
|
248
|
+
return { ...user, email: user.email.toLowerCase() };
|
|
249
|
+
}
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
---
|
|
253
|
+
|
|
254
|
+
## Category 6: Date and time bugs
|
|
255
|
+
|
|
256
|
+
### Pattern 6.1: Timezone mismatch
|
|
257
|
+
|
|
258
|
+
**Symptom:** Timestamps off by hours; date comparisons fail in certain timezones.
|
|
259
|
+
|
|
260
|
+
```js
|
|
261
|
+
// Bug: new Date() uses local timezone; server and client may differ
|
|
262
|
+
const today = new Date().toISOString().slice(0, 10); // '2025-01-01' in UTC but not in UTC+10
|
|
263
|
+
|
|
264
|
+
// Fix: always work in UTC; use a library (date-fns, Temporal) for date arithmetic
|
|
265
|
+
import { format } from "date-fns";
|
|
266
|
+
import { utcToZonedTime } from "date-fns-tz";
|
|
267
|
+
const today = format(utcToZonedTime(new Date(), "UTC"), "yyyy-MM-dd");
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
### Pattern 6.2: DST boundary bugs
|
|
271
|
+
|
|
272
|
+
**Symptom:** Duration calculations off by 1 hour on daylight saving transition dates.
|
|
273
|
+
|
|
274
|
+
```js
|
|
275
|
+
// Bug: day duration calculation using milliseconds breaks at DST boundary
|
|
276
|
+
const msInDay = 24 * 60 * 60 * 1000;
|
|
277
|
+
const daysDiff = (end - start) / msInDay; // may be 22/23/25 hours on DST day
|
|
278
|
+
|
|
279
|
+
// Fix: use a date library that handles DST
|
|
280
|
+
import { differenceInDays } from "date-fns";
|
|
281
|
+
const daysDiff = differenceInDays(end, start);
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
---
|
|
285
|
+
|
|
286
|
+
## Category 7: Off-by-one errors
|
|
287
|
+
|
|
288
|
+
### Pattern 7.1: Loop boundary
|
|
289
|
+
|
|
290
|
+
```js
|
|
291
|
+
// Bug: should process items 0..9 (10 items), but < vs <= is wrong
|
|
292
|
+
for (let i = 0; i <= items.length; i++) { // ← goes one past the end
|
|
293
|
+
process(items[i]); // items[10] is undefined on 10-item array
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
// Fix
|
|
297
|
+
for (let i = 0; i < items.length; i++) {
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
### Pattern 7.2: Slice/substring index
|
|
301
|
+
|
|
302
|
+
```js
|
|
303
|
+
// Bug: slice(1, n) vs slice(0, n) vs slice(0, n-1) confusion
|
|
304
|
+
const first10 = str.slice(1, 10); // skips the first character!
|
|
305
|
+
|
|
306
|
+
// Fix
|
|
307
|
+
const first10 = str.slice(0, 10);
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
### Pattern 7.3: Pagination offset
|
|
311
|
+
|
|
312
|
+
```js
|
|
313
|
+
// Bug: page 1 returns items 1-10, page 2 returns 11-20... but item 1 is index 0
|
|
314
|
+
const offset = page * pageSize; // page 1 → offset 10 → skips first 10 items!
|
|
315
|
+
|
|
316
|
+
// Fix
|
|
317
|
+
const offset = (page - 1) * pageSize; // page 1 → offset 0
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
---
|
|
321
|
+
|
|
322
|
+
## Category 8: Import / module bugs
|
|
323
|
+
|
|
324
|
+
### Pattern 8.1: Circular dependency
|
|
325
|
+
|
|
326
|
+
**Symptom:** A module exports `undefined` or an incomplete object.
|
|
327
|
+
|
|
328
|
+
```js
|
|
329
|
+
// a.js imports b.js, b.js imports a.js
|
|
330
|
+
// One of them will receive an incomplete module at require time
|
|
331
|
+
// Symptom: SomeClass is undefined at runtime, no error at import time
|
|
332
|
+
|
|
333
|
+
// Fix: break the cycle by extracting shared code into a third module
|
|
334
|
+
// Or use lazy imports (import inside the function, not at the top)
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
### Pattern 8.2: Named vs default export confusion
|
|
338
|
+
|
|
339
|
+
```js
|
|
340
|
+
// module.js
|
|
341
|
+
export const foo = () => {}; // named export
|
|
342
|
+
export default function bar() {} // default export
|
|
343
|
+
|
|
344
|
+
// Bug: wrong import style
|
|
345
|
+
import foo from "./module"; // gets the default export (bar), not foo!
|
|
346
|
+
|
|
347
|
+
// Fix
|
|
348
|
+
import { foo } from "./module"; // named import
|
|
349
|
+
import bar from "./module"; // default import
|
|
350
|
+
```
|
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
# Debugging Strategies Reference
|
|
2
|
+
|
|
3
|
+
**Load this when:** choosing how to approach a specific type of bug, picking the right tools for the environment, or deciding between debugging strategies.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Strategy selection guide
|
|
8
|
+
|
|
9
|
+
| Symptom | Best strategy |
|
|
10
|
+
| -------------------------------------- | ------------------------------------------------------ |
|
|
11
|
+
| Clear error message with stack trace | Error analysis → trace the call stack |
|
|
12
|
+
| "Works on my machine" | Environment diff → compare configs, versions, env vars |
|
|
13
|
+
| Intermittent / flaky | Race condition analysis or timing investigation |
|
|
14
|
+
| Regression (worked before, broken now) | Git bisect / diff against last known good commit |
|
|
15
|
+
| Performance issue | Profiling → find the hot path |
|
|
16
|
+
| Failing test | Test isolation → run single test, add verbose output |
|
|
17
|
+
| Black box (no source access) | Network inspection, log analysis |
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Strategy 1: Stack trace analysis
|
|
22
|
+
|
|
23
|
+
**When:** You have an error message with a stack trace.
|
|
24
|
+
|
|
25
|
+
**Steps:**
|
|
26
|
+
|
|
27
|
+
1. Find the first frame that is YOUR code (not framework, not node_modules)
|
|
28
|
+
2. Open that file and go to that line
|
|
29
|
+
3. Read the error message literally — it tells you what was wrong at that point
|
|
30
|
+
4. Ask: "What should the value have been here?"
|
|
31
|
+
5. Trace backward through the call chain to find where the value became wrong
|
|
32
|
+
|
|
33
|
+
**Frame filtering guide:**
|
|
34
|
+
|
|
35
|
+
```
|
|
36
|
+
// Ignore these frames (they're framework internals):
|
|
37
|
+
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1217:10)
|
|
38
|
+
at Module.load (node:internal/modules/cjs/loader:1033:32)
|
|
39
|
+
at Router.handle (express/lib/router/index.js:284:7)
|
|
40
|
+
|
|
41
|
+
// This is YOUR code — start here:
|
|
42
|
+
at UserService.getUser (src/services/user-service.js:47:23)
|
|
43
|
+
at async UserController.handleGet (src/controllers/user.js:22:18)
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
**Error message translations:**
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
TypeError: Cannot read properties of undefined (reading 'id')
|
|
50
|
+
→ Some object you expected to exist is undefined.
|
|
51
|
+
→ Find the variable named just before .id — what should it have contained?
|
|
52
|
+
|
|
53
|
+
ReferenceError: X is not defined
|
|
54
|
+
→ Variable X is used before it was declared, or is out of scope
|
|
55
|
+
→ Check imports / const declarations
|
|
56
|
+
|
|
57
|
+
UnhandledPromiseRejection: ...
|
|
58
|
+
→ An async function threw and no .catch() or try/catch caught it
|
|
59
|
+
→ Find the Promise chain and add error handling
|
|
60
|
+
|
|
61
|
+
ENOENT: no such file or directory
|
|
62
|
+
→ File path is wrong — log the full path value and check if the file actually exists
|
|
63
|
+
→ Check working directory assumptions: paths may be relative to unexpected root
|
|
64
|
+
|
|
65
|
+
SyntaxError: Unexpected token '<'
|
|
66
|
+
→ Usually means the server returned HTML (error page) where JSON was expected
|
|
67
|
+
→ Check the HTTP response status and body before parsing as JSON
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## Strategy 2: Binary search (divide and conquer)
|
|
73
|
+
|
|
74
|
+
**When:** The bug is somewhere in a large code path and you don't know where.
|
|
75
|
+
|
|
76
|
+
**Steps:**
|
|
77
|
+
|
|
78
|
+
1. Mark the **start** — a point where the data is definitely correct
|
|
79
|
+
2. Mark the **end** — a point where the data is definitely wrong
|
|
80
|
+
3. Add a probe (log statement or assertion) at the **midpoint** of the path
|
|
81
|
+
4. Run and check: is the data correct at the midpoint?
|
|
82
|
+
- Correct → bug is in the second half (move start to midpoint)
|
|
83
|
+
- Wrong → bug is in the first half (move end to midpoint)
|
|
84
|
+
5. Repeat until the range narrows to 1–2 lines
|
|
85
|
+
|
|
86
|
+
**Example:**
|
|
87
|
+
|
|
88
|
+
```
|
|
89
|
+
Input: { userId: 5 } ← correct here
|
|
90
|
+
│
|
|
91
|
+
│ ← bug is somewhere in here
|
|
92
|
+
│
|
|
93
|
+
Output: { userId: null } ← wrong here
|
|
94
|
+
|
|
95
|
+
Binary search:
|
|
96
|
+
Step 1: Add log at middleware (middle of stack)
|
|
97
|
+
→ userId: 5 ← correct at midpoint
|
|
98
|
+
→ Bug is in the bottom half (controller/service layer)
|
|
99
|
+
|
|
100
|
+
Step 2: Add log at service entry
|
|
101
|
+
→ userId: 5 ← still correct
|
|
102
|
+
→ Bug is in the query or return path
|
|
103
|
+
|
|
104
|
+
Step 3: Log the DB query result
|
|
105
|
+
→ Row: { id: 5, name: 'Alice' } ← correct
|
|
106
|
+
→ Log the mapped output: { userId: null } ← wrong here
|
|
107
|
+
→ Bug is in the mapper function
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
## Strategy 3: Git bisect (regression isolation)
|
|
113
|
+
|
|
114
|
+
**When:** Something worked before and is broken now; you know the last good commit.
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
# Start bisect
|
|
118
|
+
git bisect start
|
|
119
|
+
|
|
120
|
+
# Mark current (broken) state
|
|
121
|
+
git bisect bad
|
|
122
|
+
|
|
123
|
+
# Mark the last known good commit
|
|
124
|
+
git bisect good v1.2.0 # or specific commit hash
|
|
125
|
+
|
|
126
|
+
# Git will checkout a midpoint commit
|
|
127
|
+
# Test whether the bug exists
|
|
128
|
+
npm test # or run the app and reproduce manually
|
|
129
|
+
|
|
130
|
+
# Tell git the result
|
|
131
|
+
git bisect bad # still broken
|
|
132
|
+
# or
|
|
133
|
+
git bisect good # works here
|
|
134
|
+
|
|
135
|
+
# Repeat until git identifies the commit
|
|
136
|
+
# Git will say: "abc123 is the first bad commit"
|
|
137
|
+
|
|
138
|
+
# When done
|
|
139
|
+
git bisect reset
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
**Once you have the commit:**
|
|
143
|
+
|
|
144
|
+
- Read the commit diff: `git show abc123`
|
|
145
|
+
- The bug is introduced by one of those changes
|
|
146
|
+
- If it's not obvious, read each changed file
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
## Strategy 4: Environment comparison
|
|
151
|
+
|
|
152
|
+
**When:** "Works on my machine" — local works, staging or production doesn't.
|
|
153
|
+
|
|
154
|
+
**Diff checklist:**
|
|
155
|
+
|
|
156
|
+
| Category | Check |
|
|
157
|
+
| -------------------------------- | ------------------------------------------------------------------- |
|
|
158
|
+
| Node / Python / language version | `node --version` on both environments |
|
|
159
|
+
| Dependencies | `npm ls` or `pip freeze` — are versions pinned? |
|
|
160
|
+
| Environment variables | Compare `.env` vs production env vars (without values) |
|
|
161
|
+
| Database state | Is the data different? Is there a migration that didn't run? |
|
|
162
|
+
| File permissions | Does the app have the right permissions in production? |
|
|
163
|
+
| Memory / CPU limits | Is the app hitting resource limits in production? |
|
|
164
|
+
| External services | Is the external API configured differently (sandbox vs production)? |
|
|
165
|
+
| Timezone | Server timezone may differ; check date calculations |
|
|
166
|
+
| Network | Is there a proxy or firewall in production? |
|
|
167
|
+
|
|
168
|
+
---
|
|
169
|
+
|
|
170
|
+
## Strategy 5: Rubber duck debugging
|
|
171
|
+
|
|
172
|
+
**When:** You're stuck and can't form a hypothesis.
|
|
173
|
+
|
|
174
|
+
Talk (or write) through the problem as if explaining it to someone who doesn't know the code:
|
|
175
|
+
|
|
176
|
+
1. "The function `getUserOrders` takes a `userId` and should return..."
|
|
177
|
+
2. "It works when the user has orders, but fails when..."
|
|
178
|
+
3. "Looking at line 47, it does X, which assumes Y..."
|
|
179
|
+
4. "Wait — it assumes Y, but Y might not be true if..."
|
|
180
|
+
|
|
181
|
+
The act of articulating the problem in full sentences often reveals the assumption that's wrong.
|
|
182
|
+
|
|
183
|
+
---
|
|
184
|
+
|
|
185
|
+
## Strategy 6: Logging strategy
|
|
186
|
+
|
|
187
|
+
**When:** You need to understand the state of the system at runtime without a debugger.
|
|
188
|
+
|
|
189
|
+
**The three-point log pattern:**
|
|
190
|
+
|
|
191
|
+
```js
|
|
192
|
+
// 1. Log at entry: what went in?
|
|
193
|
+
console.log("[getUser] input:", { userId, context });
|
|
194
|
+
|
|
195
|
+
// 2. Log at decision points: what path is being taken?
|
|
196
|
+
console.log("[getUser] cache_hit:", cacheHit, "cache_key:", cacheKey);
|
|
197
|
+
|
|
198
|
+
// 3. Log at exit: what came out?
|
|
199
|
+
console.log("[getUser] result:", result, "duration_ms:", Date.now() - start);
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
**Structured logging for easier grep:**
|
|
203
|
+
|
|
204
|
+
```js
|
|
205
|
+
// Add a prefix so you can grep just your debug lines
|
|
206
|
+
logger.debug({ event: "get_user", userId, hit: cacheHit });
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
**Remove debug logs before committing.** Add a `// DEBUG` comment if you're not sure — makes them easy to find and delete.
|
|
210
|
+
|
|
211
|
+
---
|
|
212
|
+
|
|
213
|
+
## Strategy 7: Profiling (performance bugs)
|
|
214
|
+
|
|
215
|
+
**When:** The app is slow and you need to find the bottleneck.
|
|
216
|
+
|
|
217
|
+
**Node.js profiling:**
|
|
218
|
+
|
|
219
|
+
```bash
|
|
220
|
+
# CPU profile
|
|
221
|
+
node --prof app.js # generates isolate-*.log
|
|
222
|
+
node --prof-process isolate-*.log > profile.txt
|
|
223
|
+
# Look for functions with high "self" time
|
|
224
|
+
|
|
225
|
+
# Or use clinic.js for easier output
|
|
226
|
+
npx clinic flame -- node app.js
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
**Database profiling:**
|
|
230
|
+
|
|
231
|
+
```sql
|
|
232
|
+
-- PostgreSQL: find slow queries
|
|
233
|
+
SELECT query, calls, mean_exec_time, total_exec_time
|
|
234
|
+
FROM pg_stat_statements
|
|
235
|
+
ORDER BY total_exec_time DESC
|
|
236
|
+
LIMIT 20;
|
|
237
|
+
|
|
238
|
+
-- Explain a specific query
|
|
239
|
+
EXPLAIN ANALYZE SELECT * FROM orders WHERE user_id = 5;
|
|
240
|
+
-- Look for: Seq Scan (missing index), high actual rows vs estimated rows
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
**Python profiling:**
|
|
244
|
+
|
|
245
|
+
```python
|
|
246
|
+
import cProfile
|
|
247
|
+
import pstats
|
|
248
|
+
|
|
249
|
+
with cProfile.Profile() as pr:
|
|
250
|
+
result = slow_function()
|
|
251
|
+
|
|
252
|
+
stats = pstats.Stats(pr)
|
|
253
|
+
stats.sort_stats('cumulative')
|
|
254
|
+
stats.print_stats(20) # top 20 by cumulative time
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
---
|
|
258
|
+
|
|
259
|
+
## Strategy 8: Network / HTTP debugging
|
|
260
|
+
|
|
261
|
+
**When:** The bug involves an API call or network request.
|
|
262
|
+
|
|
263
|
+
**Tools:**
|
|
264
|
+
|
|
265
|
+
```bash
|
|
266
|
+
# Inspect actual HTTP request/response
|
|
267
|
+
curl -v https://api.example.com/users/1 \
|
|
268
|
+
-H "Authorization: Bearer ${TOKEN}"
|
|
269
|
+
# -v shows request headers and response headers
|
|
270
|
+
|
|
271
|
+
# With timing breakdown
|
|
272
|
+
curl -w "@curl-format.txt" -o /dev/null -s https://api.example.com/
|
|
273
|
+
# curl-format.txt: time_namelookup, time_connect, time_appconnect, etc.
|
|
274
|
+
|
|
275
|
+
# Node: log HTTP requests with debug flag
|
|
276
|
+
DEBUG=axios* node app.js # for axios
|
|
277
|
+
NODE_DEBUG=http node app.js # for built-in http module
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
**In browser DevTools:**
|
|
281
|
+
|
|
282
|
+
1. Network tab → find the failing request
|
|
283
|
+
2. Click it → check: Status code, Response body, Request headers
|
|
284
|
+
3. Common: `401` (auth token expired or missing), `400` (request body malformed), `500` (server error — check server logs)
|
|
285
|
+
|
|
286
|
+
---
|
|
287
|
+
|
|
288
|
+
## Debugger usage (interactive)
|
|
289
|
+
|
|
290
|
+
**Node.js (built-in debugger):**
|
|
291
|
+
|
|
292
|
+
```bash
|
|
293
|
+
# Start with debugger
|
|
294
|
+
node --inspect-brk src/index.js
|
|
295
|
+
|
|
296
|
+
# Then open Chrome → chrome://inspect → click "Open dedicated DevTools for Node"
|
|
297
|
+
# Set breakpoints in source files
|
|
298
|
+
# Use the call stack panel to see the state at any point
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
**VS Code launch.json:**
|
|
302
|
+
|
|
303
|
+
```json
|
|
304
|
+
{
|
|
305
|
+
"type": "node",
|
|
306
|
+
"request": "launch",
|
|
307
|
+
"name": "Debug current file",
|
|
308
|
+
"program": "${file}",
|
|
309
|
+
"runtimeArgs": ["--inspect-brk"],
|
|
310
|
+
"skipFiles": ["<node_internals>/**", "node_modules/**"]
|
|
311
|
+
}
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
**Python pdb:**
|
|
315
|
+
|
|
316
|
+
```python
|
|
317
|
+
import pdb; pdb.set_trace() # drop into interactive debugger
|
|
318
|
+
# or in Python 3.7+:
|
|
319
|
+
breakpoint()
|
|
320
|
+
|
|
321
|
+
# pdb commands:
|
|
322
|
+
# n — next line
|
|
323
|
+
# s — step into function
|
|
324
|
+
# c — continue until next breakpoint
|
|
325
|
+
# p variable_name — print value
|
|
326
|
+
# l — list source around current line
|
|
327
|
+
# q — quit
|
|
328
|
+
```
|