fraim-framework 2.0.67 → 2.0.68
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/package.json +1 -2
- package/dist/registry/ai-manager-rules/customer-development-phases/phase1-customer-profiling.md +0 -101
- package/dist/registry/ai-manager-rules/customer-development-phases/phase2-platform-discovery.md +0 -235
- package/dist/registry/ai-manager-rules/customer-development-phases/phase3-prospect-qualification.md +0 -243
- package/dist/registry/ai-manager-rules/customer-development-phases/phase4-inventory-compilation.md +0 -206
- package/dist/registry/ai-manager-rules/design-phases/design-completeness-review.md +0 -73
- package/dist/registry/ai-manager-rules/design-phases/design-design.md +0 -145
- package/dist/registry/ai-manager-rules/design-phases/design.md +0 -108
- package/dist/registry/ai-manager-rules/design-phases/finalize.md +0 -60
- package/dist/registry/ai-manager-rules/design-phases/validate.md +0 -125
- package/dist/registry/ai-manager-rules/design.json +0 -97
- package/dist/registry/ai-manager-rules/implement-phases/code.md +0 -323
- package/dist/registry/ai-manager-rules/implement-phases/completeness-review.md +0 -94
- package/dist/registry/ai-manager-rules/implement-phases/finalize.md +0 -177
- package/dist/registry/ai-manager-rules/implement-phases/implement-code.md +0 -283
- package/dist/registry/ai-manager-rules/implement-phases/implement-completeness-review.md +0 -120
- package/dist/registry/ai-manager-rules/implement-phases/implement-regression.md +0 -173
- package/dist/registry/ai-manager-rules/implement-phases/implement-repro.md +0 -104
- package/dist/registry/ai-manager-rules/implement-phases/implement-scoping.md +0 -100
- package/dist/registry/ai-manager-rules/implement-phases/implement-smoke.md +0 -237
- package/dist/registry/ai-manager-rules/implement-phases/implement-spike.md +0 -121
- package/dist/registry/ai-manager-rules/implement-phases/implement-validate.md +0 -375
- package/dist/registry/ai-manager-rules/implement-phases/quality-review.md +0 -304
- package/dist/registry/ai-manager-rules/implement-phases/regression.md +0 -159
- package/dist/registry/ai-manager-rules/implement-phases/repro.md +0 -101
- package/dist/registry/ai-manager-rules/implement-phases/scoping.md +0 -93
- package/dist/registry/ai-manager-rules/implement-phases/smoke.md +0 -225
- package/dist/registry/ai-manager-rules/implement-phases/spike.md +0 -118
- package/dist/registry/ai-manager-rules/implement-phases/validate.md +0 -347
- package/dist/registry/ai-manager-rules/implement.json +0 -153
- package/dist/registry/ai-manager-rules/retrospective.md +0 -116
- package/dist/registry/ai-manager-rules/shared-phases/address-pr-feedback.md +0 -188
- package/dist/registry/ai-manager-rules/shared-phases/finalize.md +0 -169
- package/dist/registry/ai-manager-rules/shared-phases/submit-pr.md +0 -202
- package/dist/registry/ai-manager-rules/shared-phases/wait-for-pr-review.md +0 -170
- package/dist/registry/ai-manager-rules/spec-phases/finalize.md +0 -60
- package/dist/registry/ai-manager-rules/spec-phases/spec-competitor-analysis.md +0 -105
- package/dist/registry/ai-manager-rules/spec-phases/spec-completeness-review.md +0 -66
- package/dist/registry/ai-manager-rules/spec-phases/spec-spec.md +0 -139
- package/dist/registry/ai-manager-rules/spec-phases/spec.md +0 -102
- package/dist/registry/ai-manager-rules/spec-phases/validate.md +0 -118
- package/dist/registry/ai-manager-rules/spec.json +0 -112
- package/dist/registry/ai-manager-rules/test.json +0 -98
- package/dist/registry/ai-manager-rules/user-survey-phases/phase1-survey-scoping.md +0 -60
- package/dist/registry/ai-manager-rules/user-survey-phases/phase2-survey-build-linkedin.md +0 -23
- package/dist/registry/ai-manager-rules/user-survey-phases/phase3-survey-build-reddit.md +0 -22
- package/dist/registry/ai-manager-rules/user-survey-phases/phase4-survey-build-x.md +0 -21
- package/dist/registry/ai-manager-rules/user-survey-phases/phase5-survey-build-facebook.md +0 -19
- package/dist/registry/ai-manager-rules/user-survey-phases/phase6-survey-build-custom.md +0 -15
- package/dist/registry/ai-manager-rules/user-survey-phases/phase7-survey-dispatch.md +0 -45
- package/dist/registry/delivery/address-feedback.md +0 -83
- package/dist/registry/delivery/retrospective.md +0 -78
- package/dist/registry/delivery/submit.md +0 -79
- package/dist/registry/providers/ado.json +0 -19
- package/dist/registry/providers/delivery-conversation.json +0 -9
- package/dist/registry/providers/delivery-pr.json +0 -9
- package/dist/registry/providers/github.json +0 -19
- package/dist/registry/rules/agent-success-criteria.md +0 -101
- package/dist/registry/rules/agent-testing-guidelines.md +0 -502
- package/dist/registry/rules/architecture.md +0 -126
- package/dist/registry/rules/communication.md +0 -122
- package/dist/registry/rules/continuous-learning.md +0 -55
- package/dist/registry/rules/debugging-multitenancy-issues.md +0 -85
- package/dist/registry/rules/ephemeral-execution.md +0 -54
- package/dist/registry/rules/git-safe-commands.md +0 -34
- package/dist/registry/rules/hitl-ppe-record-analysis.md +0 -302
- package/dist/registry/rules/integrity-and-test-ethics.md +0 -275
- package/dist/registry/rules/local-development.md +0 -275
- package/dist/registry/rules/mandatory-pre-completion-reflection.md +0 -193
- package/dist/registry/rules/merge-requirements.md +0 -238
- package/dist/registry/rules/simplicity.md +0 -118
- package/dist/registry/rules/software-development-lifecycle.md +0 -105
- package/dist/registry/rules/spike-first-development.md +0 -205
- package/dist/registry/rules/successful-debugging-patterns.md +0 -488
- package/dist/registry/scripts/build-scripts-generator.js +0 -205
- package/dist/registry/scripts/cleanup-branch.js +0 -287
- package/dist/registry/scripts/evaluate-code-quality.js +0 -66
- package/dist/registry/scripts/exec-with-timeout.js +0 -142
- package/dist/registry/scripts/fraim-config.js +0 -61
- package/dist/registry/scripts/generate-engagement-emails.js +0 -705
- package/dist/registry/scripts/generic-issues-api.js +0 -100
- package/dist/registry/scripts/newsletter-helpers.js +0 -671
- package/dist/registry/scripts/openapi-generator.js +0 -664
- package/dist/registry/scripts/performance/profile-server.js +0 -390
- package/dist/registry/scripts/profile-server.js +0 -389
- package/dist/registry/scripts/run-thank-you-workflow.js +0 -92
- package/dist/registry/scripts/send-newsletter-simple.js +0 -85
- package/dist/registry/scripts/send-thank-you-emails.js +0 -54
- package/dist/registry/scripts/validate-openapi-limits.js +0 -311
- package/dist/registry/scripts/validate-test-coverage.js +0 -262
- package/dist/registry/scripts/verify-test-coverage.js +0 -66
- package/dist/registry/stubs/workflows/azure/cost-optimization.md +0 -11
- package/dist/registry/stubs/workflows/bootstrap/create-architecture.md +0 -11
- package/dist/registry/stubs/workflows/bootstrap/detect-broken-windows.md +0 -11
- package/dist/registry/stubs/workflows/bootstrap/evaluate-code-quality.md +0 -11
- package/dist/registry/stubs/workflows/bootstrap/verify-test-coverage.md +0 -11
- package/dist/registry/stubs/workflows/brainstorming/blue-sky-brainstorming.md +0 -11
- package/dist/registry/stubs/workflows/brainstorming/codebase-brainstorming.md +0 -11
- package/dist/registry/stubs/workflows/business-development/create-business-plan.md +0 -11
- package/dist/registry/stubs/workflows/business-development/ideate-business-opportunity.md +0 -11
- package/dist/registry/stubs/workflows/business-development/price-product.md +0 -18
- package/dist/registry/stubs/workflows/compliance/detect-compliance-requirements.md +0 -11
- package/dist/registry/stubs/workflows/compliance/generate-audit-evidence.md +0 -11
- package/dist/registry/stubs/workflows/compliance/soc2-evidence-generator.md +0 -11
- package/dist/registry/stubs/workflows/customer-development/insight-analysis.md +0 -11
- package/dist/registry/stubs/workflows/customer-development/insight-triage.md +0 -11
- package/dist/registry/stubs/workflows/customer-development/interview-preparation.md +0 -11
- package/dist/registry/stubs/workflows/customer-development/linkedin-outreach.md +0 -11
- package/dist/registry/stubs/workflows/customer-development/strategic-brainstorming.md +0 -11
- package/dist/registry/stubs/workflows/customer-development/thank-customers.md +0 -11
- package/dist/registry/stubs/workflows/customer-development/user-survey-dispatch.md +0 -11
- package/dist/registry/stubs/workflows/customer-development/users-to-target.md +0 -11
- package/dist/registry/stubs/workflows/customer-development/weekly-newsletter.md +0 -11
- package/dist/registry/stubs/workflows/deploy/cloud-deployment.md +0 -11
- package/dist/registry/stubs/workflows/improve-fraim/contribute.md +0 -11
- package/dist/registry/stubs/workflows/improve-fraim/file-issue.md +0 -11
- package/dist/registry/stubs/workflows/learning/build-skillset.md +0 -11
- package/dist/registry/stubs/workflows/learning/synthesize-learnings.md +0 -11
- package/dist/registry/stubs/workflows/legal/contract-review-analysis.md +0 -11
- package/dist/registry/stubs/workflows/legal/nda.md +0 -11
- package/dist/registry/stubs/workflows/legal/patent-filing.md +0 -11
- package/dist/registry/stubs/workflows/legal/saas-contract-development.md +0 -11
- package/dist/registry/stubs/workflows/legal/trademark-filing.md +0 -11
- package/dist/registry/stubs/workflows/marketing/content-creation.md +0 -11
- package/dist/registry/stubs/workflows/marketing/convert-to-pdf.md +0 -11
- package/dist/registry/stubs/workflows/marketing/create-modern-website.md +0 -11
- package/dist/registry/stubs/workflows/marketing/domain-registration.md +0 -11
- package/dist/registry/stubs/workflows/marketing/evangelize.md +0 -11
- package/dist/registry/stubs/workflows/marketing/hbr-article.md +0 -11
- package/dist/registry/stubs/workflows/marketing/launch-checklist.md +0 -11
- package/dist/registry/stubs/workflows/marketing/marketing-strategy.md +0 -11
- package/dist/registry/stubs/workflows/marketing/storytelling.md +0 -11
- package/dist/registry/stubs/workflows/performance/analyze-performance.md +0 -11
- package/dist/registry/stubs/workflows/product-building/design.md +0 -11
- package/dist/registry/stubs/workflows/product-building/implement.md +0 -11
- package/dist/registry/stubs/workflows/product-building/iterate-on-pr-comments.md +0 -11
- package/dist/registry/stubs/workflows/product-building/prep-issue.md +0 -11
- package/dist/registry/stubs/workflows/product-building/prototype.md +0 -11
- package/dist/registry/stubs/workflows/product-building/resolve.md +0 -11
- package/dist/registry/stubs/workflows/product-building/retrospect.md +0 -11
- package/dist/registry/stubs/workflows/product-building/spec.md +0 -11
- package/dist/registry/stubs/workflows/product-building/test.md +0 -11
- package/dist/registry/stubs/workflows/productivity-report/productivity-report.md +0 -11
- package/dist/registry/stubs/workflows/quality-assurance/browser-validation.md +0 -11
- package/dist/registry/stubs/workflows/quality-assurance/iterative-improvement-cycle.md +0 -11
- package/dist/registry/stubs/workflows/replicate/replicate-discovery.md +0 -11
- package/dist/registry/stubs/workflows/replicate/replicate-to-issues.md +0 -11
- package/dist/registry/stubs/workflows/reviewer/review-implementation-vs-design-spec.md +0 -11
- package/dist/registry/stubs/workflows/reviewer/review-implementation-vs-feature-spec.md +0 -11
- package/dist/registry/stubs/workflows/startup-credits/aws-activate-application.md +0 -11
- package/dist/registry/stubs/workflows/startup-credits/google-cloud-application.md +0 -11
- package/dist/registry/stubs/workflows/startup-credits/microsoft-azure-application.md +0 -11
- package/dist/registry/templates/bootstrap/ARCHITECTURE-TEMPLATE.md +0 -53
- package/dist/registry/templates/bootstrap/CODE-QUALITY-REPORT-TEMPLATE.md +0 -37
- package/dist/registry/templates/bootstrap/TEST-COVERAGE-REPORT-TEMPLATE.md +0 -35
- package/dist/registry/templates/business-development/IDEATION-REPORT-TEMPLATE.md +0 -29
- package/dist/registry/templates/business-development/PRICING-STRATEGY-TEMPLATE.md +0 -126
- package/dist/registry/templates/customer-development/customer-interview-template.md +0 -99
- package/dist/registry/templates/customer-development/customer-persona-template.md +0 -69
- package/dist/registry/templates/customer-development/follow-up-email-templates.md +0 -132
- package/dist/registry/templates/customer-development/insight-analysis-template.md +0 -74
- package/dist/registry/templates/customer-development/prospect-inventory-template.csv +0 -3
- package/dist/registry/templates/customer-development/search-strategy-template.md +0 -123
- package/dist/registry/templates/customer-development/strategic-recommendations-template.md +0 -53
- package/dist/registry/templates/customer-development/thank-you-email-template.html +0 -124
- package/dist/registry/templates/customer-development/thank-you-note-template.md +0 -16
- package/dist/registry/templates/customer-development/triage-log-template.md +0 -278
- package/dist/registry/templates/customer-development/weekly-newsletter-template.html +0 -204
- package/dist/registry/templates/evidence/Design-Evidence.md +0 -30
- package/dist/registry/templates/evidence/Implementation-BugEvidence.md +0 -122
- package/dist/registry/templates/evidence/Implementation-FeatureEvidence.md +0 -160
- package/dist/registry/templates/evidence/Spec-Evidence.md +0 -19
- package/dist/registry/templates/help/HelpNeeded.md +0 -14
- package/dist/registry/templates/legal/NDA-TEMPLATE.md +0 -170
- package/dist/registry/templates/legal/PATENT-TEMPLATE.md +0 -372
- package/dist/registry/templates/legal/TRADEMARK-TEMPLATE.md +0 -339
- package/dist/registry/templates/legal/contract-review-checklist.md +0 -193
- package/dist/registry/templates/legal/review-report-template.md +0 -198
- package/dist/registry/templates/legal/saas-terms-template.md +0 -174
- package/dist/registry/templates/legal/sow-template.md +0 -117
- package/dist/registry/templates/legal/template-variables.md +0 -131
- package/dist/registry/templates/marketing/DOMAIN-REGISTRATION-TEMPLATE.md +0 -194
- package/dist/registry/templates/marketing/EVANGELIZE-TEMPLATE.md +0 -102
- package/dist/registry/templates/marketing/HBR-ARTICLE-TEMPLATE.md +0 -66
- package/dist/registry/templates/marketing/STORYTELLING-TEMPLATE.md +0 -130
- package/dist/registry/templates/marketing/WEBSITE-TEMPLATE.md +0 -262
- package/dist/registry/templates/marketing/github-pages-workflow.yml +0 -64
- package/dist/registry/templates/replicate/implementation-checklist.md +0 -39
- package/dist/registry/templates/replicate/use-cases-template.md +0 -88
- package/dist/registry/templates/retrospective/RETROSPECTIVE-TEMPLATE.md +0 -55
- package/dist/registry/templates/specs/BUGSPEC-TEMPLATE.md +0 -37
- package/dist/registry/templates/specs/FEATURESPEC-TEMPLATE.md +0 -66
- package/dist/registry/templates/specs/TECHSPEC-TEMPLATE.md +0 -39
- package/dist/registry/workflows/azure/cost-optimization.md +0 -772
- package/dist/registry/workflows/bootstrap/create-architecture.md +0 -37
- package/dist/registry/workflows/bootstrap/detect-broken-windows.md +0 -300
- package/dist/registry/workflows/bootstrap/evaluate-code-quality.md +0 -35
- package/dist/registry/workflows/bootstrap/verify-test-coverage.md +0 -36
- package/dist/registry/workflows/brainstorming/blue-sky-brainstorming.md +0 -211
- package/dist/registry/workflows/brainstorming/codebase-brainstorming.md +0 -159
- package/dist/registry/workflows/business-development/create-business-plan.md +0 -737
- package/dist/registry/workflows/business-development/ideate-business-opportunity.md +0 -55
- package/dist/registry/workflows/business-development/price-product.md +0 -325
- package/dist/registry/workflows/compliance/detect-compliance-requirements.md +0 -80
- package/dist/registry/workflows/compliance/generate-audit-evidence.md +0 -80
- package/dist/registry/workflows/compliance/soc2-evidence-generator.md +0 -332
- package/dist/registry/workflows/customer-development/insight-analysis.md +0 -156
- package/dist/registry/workflows/customer-development/insight-triage.md +0 -933
- package/dist/registry/workflows/customer-development/interview-preparation.md +0 -452
- package/dist/registry/workflows/customer-development/linkedin-outreach.md +0 -599
- package/dist/registry/workflows/customer-development/strategic-brainstorming.md +0 -146
- package/dist/registry/workflows/customer-development/thank-customers.md +0 -203
- package/dist/registry/workflows/customer-development/user-survey-dispatch.md +0 -312
- package/dist/registry/workflows/customer-development/users-to-target.md +0 -427
- package/dist/registry/workflows/customer-development/weekly-newsletter.md +0 -366
- package/dist/registry/workflows/deploy/cloud-deployment.md +0 -310
- package/dist/registry/workflows/improve-fraim/contribute.md +0 -32
- package/dist/registry/workflows/improve-fraim/file-issue.md +0 -32
- package/dist/registry/workflows/learning/build-skillset.md +0 -212
- package/dist/registry/workflows/learning/synthesize-learnings.md +0 -369
- package/dist/registry/workflows/legal/contract-review-analysis.md +0 -382
- package/dist/registry/workflows/legal/nda.md +0 -69
- package/dist/registry/workflows/legal/patent-filing.md +0 -76
- package/dist/registry/workflows/legal/saas-contract-development.md +0 -204
- package/dist/registry/workflows/legal/trademark-filing.md +0 -77
- package/dist/registry/workflows/marketing/content-creation.md +0 -40
- package/dist/registry/workflows/marketing/convert-to-pdf.md +0 -265
- package/dist/registry/workflows/marketing/create-modern-website.md +0 -456
- package/dist/registry/workflows/marketing/domain-registration.md +0 -323
- package/dist/registry/workflows/marketing/evangelize.md +0 -426
- package/dist/registry/workflows/marketing/hbr-article.md +0 -73
- package/dist/registry/workflows/marketing/launch-checklist.md +0 -37
- package/dist/registry/workflows/marketing/marketing-strategy.md +0 -45
- package/dist/registry/workflows/marketing/storytelling.md +0 -65
- package/dist/registry/workflows/performance/analyze-performance.md +0 -65
- package/dist/registry/workflows/product-building/design.md +0 -263
- package/dist/registry/workflows/product-building/implement.md +0 -771
- package/dist/registry/workflows/product-building/iterate-on-pr-comments.md +0 -70
- package/dist/registry/workflows/product-building/prep-issue.md +0 -41
- package/dist/registry/workflows/product-building/prototype.md +0 -60
- package/dist/registry/workflows/product-building/resolve.md +0 -175
- package/dist/registry/workflows/product-building/retrospect.md +0 -86
- package/dist/registry/workflows/product-building/spec.md +0 -303
- package/dist/registry/workflows/product-building/test.md +0 -125
- package/dist/registry/workflows/productivity-report/productivity-report.md +0 -263
- package/dist/registry/workflows/quality-assurance/browser-validation.md +0 -221
- package/dist/registry/workflows/quality-assurance/iterative-improvement-cycle.md +0 -562
- package/dist/registry/workflows/replicate/replicate-discovery.md +0 -336
- package/dist/registry/workflows/replicate/replicate-to-issues.md +0 -319
- package/dist/registry/workflows/reviewer/review-implementation-vs-design-spec.md +0 -694
- package/dist/registry/workflows/reviewer/review-implementation-vs-feature-spec.md +0 -734
- package/dist/registry/workflows/startup-credits/aws-activate-application.md +0 -535
- package/dist/registry/workflows/startup-credits/google-cloud-application.md +0 -647
- package/dist/registry/workflows/startup-credits/microsoft-azure-application.md +0 -538
|
@@ -1,205 +0,0 @@
|
|
|
1
|
-
# Rule: spike-first-development
|
|
2
|
-
|
|
3
|
-
**Path:** `rules/spike-first-development.md`
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# Spike-First Development Pattern
|
|
8
|
-
|
|
9
|
-
## INTENT
|
|
10
|
-
Prevent the "Build First, Integrate Later" anti-pattern that leads to wasted work, technical debt, and incomplete implementations. Ensure agents validate technology compatibility and requirements understanding before building complex solutions.
|
|
11
|
-
|
|
12
|
-
## PRINCIPLES
|
|
13
|
-
**"Validate Early, Validate Often"** - Always prove that your approach works with the smallest possible test before building anything complex.
|
|
14
|
-
|
|
15
|
-
## THE ANTI-PATTERN: "Build First, Integrate Later" ❌
|
|
16
|
-
|
|
17
|
-
### What It Looks Like
|
|
18
|
-
1. **Build Infrastructure First**: Create complex modular systems, frameworks, or architectures
|
|
19
|
-
2. **Assume Technology Support**: Assume unfamiliar technologies will support your approach
|
|
20
|
-
3. **Attempt Integration**: Discover incompatibilities or limitations late in the process
|
|
21
|
-
4. **Panic Implementation**: Rush to salvage work, often missing original requirements
|
|
22
|
-
|
|
23
|
-
### Why It's Dangerous
|
|
24
|
-
- **Wasted Work**: Build incompatible solutions that must be thrown away
|
|
25
|
-
- **Rushed Integration**: Leads to incomplete implementations and missed requirements
|
|
26
|
-
- **Technical Debt**: Creates bloat and confusion in the codebase
|
|
27
|
-
- **False Progress**: Appears productive while actually going backwards
|
|
28
|
-
- **Missed Requirements**: Focus on infrastructure instead of actual goals
|
|
29
|
-
|
|
30
|
-
## THE CORRECT PATTERN: "Spike, Analyze, Implement Incrementally" ✅
|
|
31
|
-
|
|
32
|
-
### 1. SPIKE/PROOF-OF-CONCEPT FIRST (5-15 minutes)
|
|
33
|
-
**Goal**: Validate the basic technology works with minimal effort
|
|
34
|
-
|
|
35
|
-
**Examples**:
|
|
36
|
-
- Testing Jinja in BAML: Add `{% if true %}Hello{% endif %}` to a prompt
|
|
37
|
-
- Testing API integration: Make one simple API call
|
|
38
|
-
- Testing database connection: Execute one basic query
|
|
39
|
-
- Testing new library: Import and call one function
|
|
40
|
-
|
|
41
|
-
**Questions to Answer**:
|
|
42
|
-
- Does the technology support what I need?
|
|
43
|
-
- What are the syntax requirements?
|
|
44
|
-
- What are the limitations?
|
|
45
|
-
- Does it integrate with existing systems?
|
|
46
|
-
|
|
47
|
-
### 2. ANALYZE DATA STRUCTURES (10-20 minutes)
|
|
48
|
-
**Goal**: Understand what data is available for your implementation
|
|
49
|
-
|
|
50
|
-
**Examples**:
|
|
51
|
-
- Examine input/output classes and their fields
|
|
52
|
-
- Review existing data flows and transformations
|
|
53
|
-
- Identify what fields are available for conditional logic
|
|
54
|
-
- Map data relationships and dependencies
|
|
55
|
-
|
|
56
|
-
**Questions to Answer**:
|
|
57
|
-
- What fields can I use for conditionals?
|
|
58
|
-
- What data is available at runtime?
|
|
59
|
-
- How does data flow through the system?
|
|
60
|
-
- What are the data constraints?
|
|
61
|
-
|
|
62
|
-
### 3. IDENTIFY OPPORTUNITIES (15-30 minutes)
|
|
63
|
-
**Goal**: Map requirements to implementation opportunities
|
|
64
|
-
|
|
65
|
-
**Examples**:
|
|
66
|
-
- Identify large code sections that should be conditional
|
|
67
|
-
- Find repetitive patterns that can be optimized
|
|
68
|
-
- Locate areas where data-driven logic would help
|
|
69
|
-
- Spot opportunities for code reduction or simplification
|
|
70
|
-
|
|
71
|
-
**Questions to Answer**:
|
|
72
|
-
- Where should conditional logic be applied?
|
|
73
|
-
- What sections are candidates for optimization?
|
|
74
|
-
- How can I reduce complexity or bloat?
|
|
75
|
-
- What are the highest-impact changes?
|
|
76
|
-
|
|
77
|
-
### 4. IMPLEMENT INCREMENTALLY (Variable time)
|
|
78
|
-
**Goal**: Build one small piece at a time with continuous validation
|
|
79
|
-
|
|
80
|
-
**Process**:
|
|
81
|
-
- Add ONE conditional/feature at a time
|
|
82
|
-
- Test after each change
|
|
83
|
-
- Ensure existing functionality is preserved
|
|
84
|
-
- Validate requirements are being met
|
|
85
|
-
- Only proceed to next change after current one works
|
|
86
|
-
|
|
87
|
-
**Examples**:
|
|
88
|
-
- Add one `{% if %}` conditional, test, then add next
|
|
89
|
-
- Implement one API endpoint, test, then add next
|
|
90
|
-
- Add one database operation, test, then add next
|
|
91
|
-
|
|
92
|
-
### 5. VALIDATE CONTINUOUSLY (Throughout)
|
|
93
|
-
**Goal**: Ensure each step works before proceeding
|
|
94
|
-
|
|
95
|
-
**Validation Steps**:
|
|
96
|
-
- Run tests after each change
|
|
97
|
-
- Verify compilation/generation works
|
|
98
|
-
- Check that existing functionality is preserved
|
|
99
|
-
- Confirm requirements are being addressed
|
|
100
|
-
- Get feedback early and often
|
|
101
|
-
|
|
102
|
-
## GOOD vs BAD EXAMPLES
|
|
103
|
-
|
|
104
|
-
### ❌ BAD: Jinja Templating Implementation
|
|
105
|
-
```
|
|
106
|
-
1. Create 15 modular Jinja template files
|
|
107
|
-
2. Build complex include system
|
|
108
|
-
3. Assume BAML supports {% include %}
|
|
109
|
-
4. Discover BAML doesn't support includes
|
|
110
|
-
5. Panic and rush minimal implementation
|
|
111
|
-
6. Miss obvious conditional opportunities
|
|
112
|
-
7. Break existing functionality
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
### ✅ GOOD: Jinja Templating Implementation
|
|
116
|
-
```
|
|
117
|
-
1. SPIKE: Test {% if true %}Hello{% endif %} in BAML (5 min)
|
|
118
|
-
2. ANALYZE: Examine CalendarIntent/AccountabilityInfo classes (10 min)
|
|
119
|
-
3. IDENTIFY: Map prompt sections to conditional opportunities (15 min)
|
|
120
|
-
4. IMPLEMENT: Add {% if accountability.accountable_party == "@me" %} around booking logic (20 min)
|
|
121
|
-
5. VALIDATE: Run tests, ensure functionality preserved (10 min)
|
|
122
|
-
6. REPEAT: Add next conditional incrementally
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
### ❌ BAD: API Integration
|
|
126
|
-
```
|
|
127
|
-
1. Build complex API client framework
|
|
128
|
-
2. Create elaborate error handling system
|
|
129
|
-
3. Design sophisticated caching layer
|
|
130
|
-
4. Discover API has rate limits that break the design
|
|
131
|
-
5. Rush to add rate limiting as afterthought
|
|
132
|
-
6. End up with over-engineered, fragile system
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
### ✅ GOOD: API Integration
|
|
136
|
-
```
|
|
137
|
-
1. SPIKE: Make one simple API call (5 min)
|
|
138
|
-
2. ANALYZE: Read API documentation for limits/constraints (15 min)
|
|
139
|
-
3. IDENTIFY: Determine what endpoints are needed (10 min)
|
|
140
|
-
4. IMPLEMENT: Add one endpoint call with basic error handling (30 min)
|
|
141
|
-
5. VALIDATE: Test the call works reliably (10 min)
|
|
142
|
-
6. REPEAT: Add next endpoint incrementally
|
|
143
|
-
```
|
|
144
|
-
|
|
145
|
-
### ❌ BAD: Database Schema Changes
|
|
146
|
-
```
|
|
147
|
-
1. Design complete new schema
|
|
148
|
-
2. Write migration scripts for all tables
|
|
149
|
-
3. Update all model classes
|
|
150
|
-
4. Discover performance issues with new design
|
|
151
|
-
5. Rush to add indexes and optimize queries
|
|
152
|
-
6. Break existing functionality in multiple places
|
|
153
|
-
```
|
|
154
|
-
|
|
155
|
-
### ✅ GOOD: Database Schema Changes
|
|
156
|
-
```
|
|
157
|
-
1. SPIKE: Test schema change on one small table (10 min)
|
|
158
|
-
2. ANALYZE: Review existing queries and performance (20 min)
|
|
159
|
-
3. IDENTIFY: Plan migration strategy and rollback plan (15 min)
|
|
160
|
-
4. IMPLEMENT: Change one table with migration (45 min)
|
|
161
|
-
5. VALIDATE: Test performance and functionality (15 min)
|
|
162
|
-
6. REPEAT: Migrate next table incrementally
|
|
163
|
-
```
|
|
164
|
-
|
|
165
|
-
## ENFORCEMENT RULES
|
|
166
|
-
|
|
167
|
-
### MANDATORY SPIKE REQUIREMENTS
|
|
168
|
-
- **Any unfamiliar technology**: Must spike basic functionality first
|
|
169
|
-
- **Any complex integration**: Must test simplest case first
|
|
170
|
-
- **Any architectural changes**: Must validate approach with minimal example
|
|
171
|
-
- **Any new libraries/frameworks**: Must test basic usage first
|
|
172
|
-
|
|
173
|
-
### VALIDATION CHECKPOINTS
|
|
174
|
-
- After spike: Technology compatibility confirmed
|
|
175
|
-
- After analysis: Data structures and constraints understood
|
|
176
|
-
- After identification: Implementation plan is clear and achievable
|
|
177
|
-
- After each increment: Functionality works and tests pass
|
|
178
|
-
- Before completion: All requirements met and validated
|
|
179
|
-
|
|
180
|
-
### RED FLAGS (Stop and Spike)
|
|
181
|
-
- Building complex systems without testing basic functionality
|
|
182
|
-
- Making assumptions about unfamiliar technology capabilities
|
|
183
|
-
- Creating elaborate architectures before validating core concepts
|
|
184
|
-
- Spending significant time on infrastructure before proving it works
|
|
185
|
-
- Claiming progress without demonstrable working functionality
|
|
186
|
-
|
|
187
|
-
## BENEFITS OF SPIKE-FIRST DEVELOPMENT
|
|
188
|
-
|
|
189
|
-
1. **Reduced Risk**: Discover incompatibilities early when they're cheap to fix
|
|
190
|
-
2. **Faster Delivery**: Avoid wasted work on incompatible approaches
|
|
191
|
-
3. **Better Quality**: Continuous validation ensures functionality is preserved
|
|
192
|
-
4. **Clearer Requirements**: Understanding constraints leads to better solutions
|
|
193
|
-
5. **Increased Confidence**: Each step is validated before proceeding
|
|
194
|
-
6. **Easier Debugging**: Problems are isolated to small, recent changes
|
|
195
|
-
|
|
196
|
-
## SUMMARY
|
|
197
|
-
|
|
198
|
-
The spike-first development pattern prevents catastrophic failures by ensuring agents:
|
|
199
|
-
- Validate technology compatibility before building
|
|
200
|
-
- Understand data structures and constraints upfront
|
|
201
|
-
- Implement incrementally with continuous validation
|
|
202
|
-
- Focus on requirements rather than infrastructure
|
|
203
|
-
- Avoid the dangerous "Build First, Integrate Later" anti-pattern
|
|
204
|
-
|
|
205
|
-
**Remember**: It's always faster to spike first than to rebuild later.
|
|
@@ -1,488 +0,0 @@
|
|
|
1
|
-
# Successful Debugging Patterns for Complex Integrations
|
|
2
|
-
|
|
3
|
-
## INTENT
|
|
4
|
-
To provide agents with proven patterns for debugging complex integrations, especially OAuth flows, API integrations, and multi-layer systems that require both UI automation and backend validation.
|
|
5
|
-
|
|
6
|
-
## PRINCIPLES
|
|
7
|
-
- **Multi-Layer Validation**: Always validate at UI, API, and Database layers
|
|
8
|
-
- **Iterative Enhancement**: Continuously refine approaches based on real-time feedback
|
|
9
|
-
- **Appropriate Timeout Management**: Use different timeouts for different operation types
|
|
10
|
-
- **Real-Time Monitoring**: Monitor logs and database state during complex operations
|
|
11
|
-
- **Visual Debugging**: Use screenshots and visual feedback to understand UI state
|
|
12
|
-
- **Prefer User-Visible Truth**: For UI flows, validate what the user sees/does (DOM + persisted state), not the order/timing of background requests
|
|
13
|
-
|
|
14
|
-
## CORE DEBUGGING PATTERN
|
|
15
|
-
|
|
16
|
-
### The "Repro -> Analyze → Implement → Test → Validate → Document → VERIFY COMPLETENESS" Pattern
|
|
17
|
-
|
|
18
|
-
```
|
|
19
|
-
1. REPRO: Reproduce the issue in a controlled environment. This can be manual using Playwright for UI issues, Curl for API issues, etc; or it can be through existing test cases. Run only the test case that fails. Mark it with tag `failing`, then run `npm run test-failing <test-suite>`
|
|
20
|
-
2. ANALYZE: Use tools to examine actual codebase (grep_search, Read)
|
|
21
|
-
3. IMPLEMENT: Make targeted changes based on real code analysis
|
|
22
|
-
4. TEST: Run the single test and ensure it passes. Then run comprehensive tests for evidence
|
|
23
|
-
5. VALIDATE: Verify functionality works end-to-end
|
|
24
|
-
6. DOCUMENT: Create test cases that replicate the flow and validate end state
|
|
25
|
-
7. VERIFY COMPLETENESS: Run comprehensive verification checklist (NEW CRITICAL STEP)
|
|
26
|
-
8. ITERATE: Refine based on real feedback and evidence
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
### **NEW: Mandatory Completeness Verification Pattern**
|
|
30
|
-
|
|
31
|
-
Before declaring ANY work complete, **MUST** follow this systematic verification:
|
|
32
|
-
|
|
33
|
-
```bash
|
|
34
|
-
# Step 1: Compilation Verification
|
|
35
|
-
timeout 30s npx tsc --noEmit --skipLibCheck
|
|
36
|
-
# MUST show 0 errors - fix any errors before proceeding
|
|
37
|
-
|
|
38
|
-
# Step 2: Build Verification (if build script exists)
|
|
39
|
-
timeout 60s npm run build
|
|
40
|
-
# MUST complete successfully
|
|
41
|
-
|
|
42
|
-
# Step 3: Comprehensive Search Verification
|
|
43
|
-
# Search for ALL possible references using multiple patterns:
|
|
44
|
-
grep_search --SearchPath . --Query "OldClassName" --MatchPerLine true
|
|
45
|
-
grep_search --SearchPath . --Query "import.*OldClassName" --IsRegex true --MatchPerLine true
|
|
46
|
-
grep_search --SearchPath . --Query "old-filename" --MatchPerLine true
|
|
47
|
-
grep_search --SearchPath . --Query "oldMethodName" --MatchPerLine true
|
|
48
|
-
|
|
49
|
-
# Step 4: Test Execution with Timeout
|
|
50
|
-
timeout 30s npx tsx --test --test-reporter tap test-relevant-file.ts
|
|
51
|
-
|
|
52
|
-
# Step 5: End-to-End Functionality Check
|
|
53
|
-
# Verify main application workflows still work
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
### Enhanced Multi-Layer Debugging Pattern
|
|
57
|
-
|
|
58
|
-
```
|
|
59
|
-
1. Code Analysis (grep_search, find_by_name to understand current state)
|
|
60
|
-
2. UI Action (Playwright automation with screenshots)
|
|
61
|
-
3. Database Check (verify persistence and state changes)
|
|
62
|
-
4. Log Analysis (check server logs for errors/success)
|
|
63
|
-
5. API Testing (verify endpoints work correctly)
|
|
64
|
-
6. Integration Testing (test full workflows)
|
|
65
|
-
7. Evidence Collection (screenshots, logs, test results)
|
|
66
|
-
8. Refine Approach (improve based on findings)
|
|
67
|
-
9. Repeat (iterate until success with evidence)
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
## UI DEBUGGING WITH PLAYWRIGHT (AND PLAYWRIGHT MCP)
|
|
71
|
-
|
|
72
|
-
When the bug is user-visible (empty UI, wrong modal opens, buttons do nothing), treat the browser as the source of truth.
|
|
73
|
-
|
|
74
|
-
### Evidence-first UI debugging loop
|
|
75
|
-
1. **Reproduce in the browser** (manual or Playwright).
|
|
76
|
-
2. **Capture evidence**:
|
|
77
|
-
- Browser console output (errors + warnings)
|
|
78
|
-
- DOM snapshot (preferred) and/or screenshot
|
|
79
|
-
- The exact URL + the exact click sequence
|
|
80
|
-
3. **Instrument to make failures obvious**:
|
|
81
|
-
- Log `requestfailed` URLs and error text
|
|
82
|
-
- Log HTTP >= 400 responses (method + URL)
|
|
83
|
-
4. **Fix the root cause** (DOM wiring, event binding, auth headers, data mapping).
|
|
84
|
-
5. **Re-run the same click path** to prove the UI behaves correctly.
|
|
85
|
-
|
|
86
|
-
### Playwright MCP usage (required when asked to "pop the browser")
|
|
87
|
-
If you are asked to confirm a fix visually:
|
|
88
|
-
- Use Playwright MCP tools to `navigate`, `click`, and capture a `browser_snapshot`.
|
|
89
|
-
- Validate the specific UI element/state changed (e.g., form opens, list renders, “No meetings” disappears).
|
|
90
|
-
|
|
91
|
-
### E2E test stabilization checklist (when tests time out)
|
|
92
|
-
- Prefer waiting on UI state (`waitForSelector`, text visible, DOM class changes) over `waitForResponse` predicates.
|
|
93
|
-
- Avoid coupling to background requests that can vary (telemetry, analysis triggers, service worker, polling).
|
|
94
|
-
- If UI is optional/feature-flagged, **do not re-enable product UI just to satisfy tests**; gate the test sub-flow or validate via API/DB.
|
|
95
|
-
- Ensure the server is up (or auto-start it) and clean up reliably (use `after()` hooks).
|
|
96
|
-
|
|
97
|
-
## SPECIFIC SCRIPTS AND COMMANDS
|
|
98
|
-
|
|
99
|
-
> [!NOTE]
|
|
100
|
-
> Self-contained scripts are available directly from `~/.fraim/scripts/` (synced during `fraim init`).
|
|
101
|
-
> Scripts with FRAIM dependencies require ephemeral execution via `get_fraim_file`.
|
|
102
|
-
>
|
|
103
|
-
> **Self-contained scripts** (direct execution):
|
|
104
|
-
> - `prep-issue.sh`, `code-quality-check.sh`, `evaluate-code-quality.ts`, `exec-with-timeout.ts`
|
|
105
|
-
>
|
|
106
|
-
> **Dependent scripts** (ephemeral execution):
|
|
107
|
-
> - `fraim-config.ts`, `build-scripts-generator.ts`, `cleanup-branch.ts`
|
|
108
|
-
|
|
109
|
-
### 1. Long-Running Server Management
|
|
110
|
-
|
|
111
|
-
**Start Server with Proper Timeout:**
|
|
112
|
-
```bash
|
|
113
|
-
# Use exec-with-timeout.ts directly from synced location
|
|
114
|
-
npx tsx ~/.fraim/scripts/exec-with-timeout.ts --timeout 3600 -- npm run dev &
|
|
115
|
-
```
|
|
116
|
-
|
|
117
|
-
**Monitor Server Logs in Real-Time:**
|
|
118
|
-
```bash
|
|
119
|
-
# Real-time monitoring
|
|
120
|
-
npx tsx ~/.fraim/scripts/exec-with-timeout.ts --timeout 30 -- tail -f server.log
|
|
121
|
-
|
|
122
|
-
# Historical log analysis
|
|
123
|
-
npx tsx ~/.fraim/scripts/exec-with-timeout.ts --timeout 30 -- tail -100 server.log
|
|
124
|
-
|
|
125
|
-
# Look for errors in logs
|
|
126
|
-
npx tsx ~/.fraim/scripts/exec-with-timeout.ts --timeout 30 -- grep error server.log
|
|
127
|
-
```
|
|
128
|
-
|
|
129
|
-
**Check Server Status:**
|
|
130
|
-
```bash
|
|
131
|
-
# Verify server is running on correct port
|
|
132
|
-
npx tsx ~/.fraim/scripts/exec-with-timeout.ts --timeout 30 -- netstat -ano | findstr :<port>
|
|
133
|
-
|
|
134
|
-
# Test API endpoints
|
|
135
|
-
npx tsx ~/.fraim/scripts/exec-with-timeout.ts --timeout 30 -- curl -s "http://localhost:<port>/<endpoint>"
|
|
136
|
-
```
|
|
137
|
-
|
|
138
|
-
### 2. Code Analysis and Understanding
|
|
139
|
-
|
|
140
|
-
**CRITICAL: Always Analyze Before Implementing**
|
|
141
|
-
Before making any changes, use tools to understand the current codebase:
|
|
142
|
-
|
|
143
|
-
```bash
|
|
144
|
-
# Find all files that import a specific module
|
|
145
|
-
grep_search --SearchPath src --Query "import.*GmailService" --IsRegex true --MatchPerLine true
|
|
146
|
-
|
|
147
|
-
# Find files by pattern
|
|
148
|
-
find_by_name --SearchDirectory src --Pattern "*email*" --Type file
|
|
149
|
-
|
|
150
|
-
# Read specific files to understand implementation
|
|
151
|
-
Read --file_path src/email/email-service.ts
|
|
152
|
-
```
|
|
153
|
-
|
|
154
|
-
**Pattern Analysis Requirements:**
|
|
155
|
-
1. **Examine existing patterns** in the codebase (e.g., CalendarService pattern)
|
|
156
|
-
2. **Use grep_search** to find all dependencies and usage
|
|
157
|
-
3. **Read actual implementations** to understand current architecture
|
|
158
|
-
4. **Document findings** with real code examples and line numbers
|
|
159
|
-
|
|
160
|
-
### 3. Playwright UI Automation with Visual Debugging
|
|
161
|
-
|
|
162
|
-
**IMPORTANT: Tool Troubleshooting Pattern**
|
|
163
|
-
When MCP Playwright tools fail with errors like `TypeError: (0 , import_server2.firstRootPath) is not a function`:
|
|
164
|
-
|
|
165
|
-
1. **Check for existing working Playwright tests** in the project
|
|
166
|
-
2. **Use direct Playwright library** instead of MCP tools
|
|
167
|
-
3. **Look for test files** like `test-dashboard-ui.ts`, `test-hitl-ui.ts` as templates
|
|
168
|
-
4. **Create custom test scripts** using the direct library approach
|
|
169
|
-
|
|
170
|
-
**Basic Playwright Script Template:**
|
|
171
|
-
```typescript
|
|
172
|
-
import { chromium } from 'playwright';
|
|
173
|
-
|
|
174
|
-
async function debugUIFlow() {
|
|
175
|
-
const browser = await chromium.launch({
|
|
176
|
-
headless: false,
|
|
177
|
-
slowMo: 2000 // Human-like delays
|
|
178
|
-
});
|
|
179
|
-
|
|
180
|
-
try {
|
|
181
|
-
const page = await browser.newPage();
|
|
182
|
-
|
|
183
|
-
// Step 1: Navigate
|
|
184
|
-
await page.goto(targetUrl);
|
|
185
|
-
await page.waitForLoadState('networkidle');
|
|
186
|
-
|
|
187
|
-
// Step 2: Take screenshot for debugging
|
|
188
|
-
await page.screenshot({ path: 'debug-step-1.png' });
|
|
189
|
-
console.log('📸 Screenshot saved: debug-step-1.png');
|
|
190
|
-
|
|
191
|
-
// Step 3: Perform action
|
|
192
|
-
await page.fill('input[type="email"]', 'test@example.com');
|
|
193
|
-
await page.click('button:has-text("Next")');
|
|
194
|
-
|
|
195
|
-
// Step 4: Take another screenshot
|
|
196
|
-
await page.screenshot({ path: 'debug-step-2.png' });
|
|
197
|
-
console.log('📸 Screenshot saved: debug-step-2.png');
|
|
198
|
-
|
|
199
|
-
// Step 5-N: Iterate on above until scenario is fully validated
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
} catch (error) {
|
|
203
|
-
console.error('❌ UI flow failed:', error);
|
|
204
|
-
await page.screenshot({ path: 'error-state.png' });
|
|
205
|
-
} finally {
|
|
206
|
-
await browser.close();
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
```
|
|
210
|
-
|
|
211
|
-
**Advanced Playwright with Multiple Button Selectors:**
|
|
212
|
-
```typescript
|
|
213
|
-
// Look for multiple possible button selectors
|
|
214
|
-
const buttonSelectors = [
|
|
215
|
-
'button:has-text("Continue")',
|
|
216
|
-
'button:has-text("Allow")',
|
|
217
|
-
'button:has-text("Accept")',
|
|
218
|
-
'button:has-text("Authorize")',
|
|
219
|
-
'button[type="submit"]',
|
|
220
|
-
'button[jsname="LgbsSe"]:has-text("Continue")'
|
|
221
|
-
];
|
|
222
|
-
|
|
223
|
-
let buttonClicked = false;
|
|
224
|
-
for (const selector of buttonSelectors) {
|
|
225
|
-
try {
|
|
226
|
-
const button = await page.waitForSelector(selector, { timeout: 3000 });
|
|
227
|
-
if (button && await button.isVisible()) {
|
|
228
|
-
console.log(`🎯 Clicking button: ${selector}`);
|
|
229
|
-
await button.click();
|
|
230
|
-
buttonClicked = true;
|
|
231
|
-
break;
|
|
232
|
-
}
|
|
233
|
-
} catch (e) {
|
|
234
|
-
// Continue to next selector
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
```
|
|
238
|
-
|
|
239
|
-
### 3. Database Validation Scripts
|
|
240
|
-
|
|
241
|
-
**MongoDB Token Validation:**
|
|
242
|
-
```typescript
|
|
243
|
-
const { DatabaseFactory } = require('./src/databases/database-factory');
|
|
244
|
-
|
|
245
|
-
async function checkDatabaseState() {
|
|
246
|
-
console.log('🔍 Checking database state...');
|
|
247
|
-
const dbService = await DatabaseFactory.createCalendarDatabaseService();
|
|
248
|
-
await dbService.initialize();
|
|
249
|
-
|
|
250
|
-
try {
|
|
251
|
-
// Check for tokens
|
|
252
|
-
const tokens = await dbService.loadCalendarTokens('primary');
|
|
253
|
-
console.log('📋 Tokens found:', !!tokens);
|
|
254
|
-
|
|
255
|
-
// Check for calendars
|
|
256
|
-
const calendars = await dbService.getAllCalendars();
|
|
257
|
-
console.log('📅 Calendars found:', calendars.length);
|
|
258
|
-
|
|
259
|
-
// Check for specific data
|
|
260
|
-
const credentials = await dbService.loadCredential('APP_CLIENT_ID');
|
|
261
|
-
console.log('🔑 Credentials found:', !!credentials);
|
|
262
|
-
|
|
263
|
-
} catch (error) {
|
|
264
|
-
console.error('❌ Database check failed:', error);
|
|
265
|
-
} finally {
|
|
266
|
-
await dbService.close();
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
```
|
|
270
|
-
|
|
271
|
-
**API Endpoint Testing:**
|
|
272
|
-
```typescript
|
|
273
|
-
async function testAPIEndpoints() {
|
|
274
|
-
const baseUrl = 'http://localhost:8333';
|
|
275
|
-
|
|
276
|
-
// Test calendar API
|
|
277
|
-
try {
|
|
278
|
-
const response = await fetch(`${baseUrl}/calendar/events?timerange_start=2024-01-01T00:00:00.000Z&timerange_end=2024-01-02T00:00:00.000Z`);
|
|
279
|
-
const data = await response.json();
|
|
280
|
-
console.log('📅 Calendar API:', response.status, data);
|
|
281
|
-
} catch (error) {
|
|
282
|
-
console.error('❌ Calendar API failed:', error);
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
// Test conversation API
|
|
286
|
-
try {
|
|
287
|
-
const response = await fetch(`${baseUrl}/conversation/threads`);
|
|
288
|
-
const data = await response.json();
|
|
289
|
-
console.log('💬 Conversation API:', response.status, data);
|
|
290
|
-
} catch (error) {
|
|
291
|
-
console.error('❌ Conversation API failed:', error);
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
```
|
|
295
|
-
|
|
296
|
-
### 4. OAuth Flow Debugging Scripts
|
|
297
|
-
|
|
298
|
-
**Complete OAuth Flow with Debugging:**
|
|
299
|
-
```typescript
|
|
300
|
-
async function debugOAuthFlow() {
|
|
301
|
-
const browser = await chromium.launch({ headless: false, slowMo: 3000 });
|
|
302
|
-
|
|
303
|
-
try {
|
|
304
|
-
const page = await browser.newPage();
|
|
305
|
-
const oauthUrl = 'https://accounts.google.com/o/oauth2/v2/auth?client_id=...';
|
|
306
|
-
|
|
307
|
-
// Step 1: Navigate and take screenshot
|
|
308
|
-
await page.goto(oauthUrl);
|
|
309
|
-
await page.waitForLoadState('networkidle');
|
|
310
|
-
await page.screenshot({ path: 'oauth-step-1.png' });
|
|
311
|
-
|
|
312
|
-
// Step 2: Email
|
|
313
|
-
await page.fill('input[type="email"]', 'test@example.com');
|
|
314
|
-
await page.click('button:has-text("Next")');
|
|
315
|
-
await page.screenshot({ path: 'oauth-step-2.png' });
|
|
316
|
-
|
|
317
|
-
// Step 3: Password
|
|
318
|
-
await page.waitForSelector('input[type="password"]');
|
|
319
|
-
await page.fill('input[type="password"]', 'password');
|
|
320
|
-
await page.click('button:has-text("Next")');
|
|
321
|
-
await page.screenshot({ path: 'oauth-step-3.png' });
|
|
322
|
-
|
|
323
|
-
// Step 4: Consent page
|
|
324
|
-
await page.waitForLoadState('networkidle');
|
|
325
|
-
await page.screenshot({ path: 'consent-page.png' });
|
|
326
|
-
|
|
327
|
-
// Step 5: Click continue with multiple selectors
|
|
328
|
-
const continueSelectors = [
|
|
329
|
-
'button:has-text("Continue")',
|
|
330
|
-
'button:has-text("Allow")',
|
|
331
|
-
'button[type="submit"]'
|
|
332
|
-
];
|
|
333
|
-
|
|
334
|
-
for (const selector of continueSelectors) {
|
|
335
|
-
try {
|
|
336
|
-
const button = await page.waitForSelector(selector, { timeout: 3000 });
|
|
337
|
-
if (button && await button.isVisible()) {
|
|
338
|
-
await button.click();
|
|
339
|
-
break;
|
|
340
|
-
}
|
|
341
|
-
} catch (e) {}
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
// Step 6: Wait for callback
|
|
345
|
-
await page.waitForURL('**/oauth/callback**', { timeout: 20000 });
|
|
346
|
-
console.log('✅ OAuth flow completed!');
|
|
347
|
-
|
|
348
|
-
} catch (error) {
|
|
349
|
-
console.error('❌ OAuth flow failed:', error);
|
|
350
|
-
await page.screenshot({ path: 'oauth-error.png' });
|
|
351
|
-
} finally {
|
|
352
|
-
await browser.close();
|
|
353
|
-
}
|
|
354
|
-
}
|
|
355
|
-
```
|
|
356
|
-
|
|
357
|
-
### 5. Timeout Management Commands
|
|
358
|
-
|
|
359
|
-
**CRITICAL: Always Use Timeouts for Test Execution**
|
|
360
|
-
Following the established pattern from memory, ALWAYS use timeout commands to prevent hanging:
|
|
361
|
-
|
|
362
|
-
**Quick Operations (30s timeout):**
|
|
363
|
-
```bash
|
|
364
|
-
npx tsx ~/.fraim/scripts/exec-with-timeout.ts --timeout 30 -- <command>
|
|
365
|
-
```
|
|
366
|
-
|
|
367
|
-
**Medium Operations (120s timeout):**
|
|
368
|
-
```bash
|
|
369
|
-
npx tsx ~/.fraim/scripts/exec-with-timeout.ts --timeout 120 -- <command>
|
|
370
|
-
```
|
|
371
|
-
|
|
372
|
-
**Always run tests with timeout**
|
|
373
|
-
```
|
|
374
|
-
npx tsx ~/.fraim/scripts/exec-with-timeout.ts --timeout 30 -- npm run test <test-suite>
|
|
375
|
-
```
|
|
376
|
-
|
|
377
|
-
**Always examine test results after running tests**
|
|
378
|
-
```
|
|
379
|
-
npx tsx ~/.fraim/scripts/exec-with-timeout.ts --timeout 30 -- cat test.log
|
|
380
|
-
```
|
|
381
|
-
|
|
382
|
-
## DEBUGGING WORKFLOW
|
|
383
|
-
|
|
384
|
-
### 1. **Initial Setup**
|
|
385
|
-
```bash
|
|
386
|
-
# Start server with long timeout
|
|
387
|
-
npx tsx ~/.fraim/scripts/exec-with-timeout.ts --timeout 3600 -- npm run dev &
|
|
388
|
-
|
|
389
|
-
# Wait for startup
|
|
390
|
-
sleep 3
|
|
391
|
-
|
|
392
|
-
# Check server logs
|
|
393
|
-
tail -20 server.log
|
|
394
|
-
```
|
|
395
|
-
|
|
396
|
-
### 2. **UI Automation with Visual Debugging**
|
|
397
|
-
```bash
|
|
398
|
-
# Run Playwright script with medium timeout
|
|
399
|
-
npx tsx ~/.fraim/scripts/exec-with-timeout.ts --timeout 120 -- npx tsx debug-ui-flow.ts
|
|
400
|
-
```
|
|
401
|
-
|
|
402
|
-
### 3. **Database Validation**
|
|
403
|
-
```bash
|
|
404
|
-
# Check database state
|
|
405
|
-
npx tsx ~/.fraim/scripts/exec-with-timeout.ts --timeout 30 -- npx tsx check-database-state.ts
|
|
406
|
-
```
|
|
407
|
-
|
|
408
|
-
### 4. **API Testing**
|
|
409
|
-
```bash
|
|
410
|
-
# Test API endpoints
|
|
411
|
-
npx tsx ~/.fraim/scripts/exec-with-timeout.ts --timeout 30 -- npx tsx test-api-endpoints.ts
|
|
412
|
-
```
|
|
413
|
-
|
|
414
|
-
### 5. **Log Analysis**
|
|
415
|
-
```bash
|
|
416
|
-
# Check recent logs
|
|
417
|
-
npx tsx ~/.fraim/scripts/exec-with-timeout.ts --timeout 30 -- tail -30 server.log
|
|
418
|
-
```
|
|
419
|
-
|
|
420
|
-
## COMMON PATTERNS
|
|
421
|
-
|
|
422
|
-
### Pattern 1: OAuth Flow Debugging
|
|
423
|
-
1. Start server with long timeout
|
|
424
|
-
2. Create Playwright script with screenshots
|
|
425
|
-
3. Run OAuth flow with visual debugging
|
|
426
|
-
4. Check database for token storage
|
|
427
|
-
5. Test API with stored tokens
|
|
428
|
-
6. Analyze logs for any errors
|
|
429
|
-
|
|
430
|
-
### Pattern 2: API Integration Debugging
|
|
431
|
-
1. Start server and verify it's running
|
|
432
|
-
2. Test API endpoints with curl
|
|
433
|
-
3. Check database for data persistence
|
|
434
|
-
4. Monitor server logs for errors
|
|
435
|
-
5. Fix issues and retest
|
|
436
|
-
|
|
437
|
-
### Pattern 3: UI Feature Debugging
|
|
438
|
-
1. Navigate to feature in browser
|
|
439
|
-
2. Take screenshots at each step
|
|
440
|
-
3. Perform actions and capture results
|
|
441
|
-
4. Check backend state changes
|
|
442
|
-
5. Verify end-to-end functionality
|
|
443
|
-
|
|
444
|
-
## ERROR DETECTION
|
|
445
|
-
|
|
446
|
-
### Server Log Errors to Watch For:
|
|
447
|
-
- `OAuth callback error:`
|
|
448
|
-
- `Database connection failed`
|
|
449
|
-
- `Missing credentials`
|
|
450
|
-
- `Port conflict errors`
|
|
451
|
-
- `TypeScript compilation errors`
|
|
452
|
-
- `API endpoint errors`
|
|
453
|
-
|
|
454
|
-
### Database State Validation:
|
|
455
|
-
- Check for expected data after operations
|
|
456
|
-
- Verify token storage and expiration
|
|
457
|
-
- Confirm calendar/thread creation
|
|
458
|
-
- Validate credential loading
|
|
459
|
-
|
|
460
|
-
### API Response Validation:
|
|
461
|
-
- Check HTTP status codes
|
|
462
|
-
- Verify response data structure
|
|
463
|
-
- Test error handling
|
|
464
|
-
- Confirm authentication
|
|
465
|
-
|
|
466
|
-
## SUCCESS INDICATORS
|
|
467
|
-
|
|
468
|
-
### OAuth Flow Success:
|
|
469
|
-
- Screenshots show successful page transitions
|
|
470
|
-
- Database contains valid tokens
|
|
471
|
-
- API calls return 200 OK with real data
|
|
472
|
-
- Server logs show successful token exchange
|
|
473
|
-
|
|
474
|
-
### API Integration Success:
|
|
475
|
-
- All endpoints return expected status codes
|
|
476
|
-
- Database contains persisted data
|
|
477
|
-
- No errors in server logs
|
|
478
|
-
- End-to-end functionality works
|
|
479
|
-
|
|
480
|
-
### UI Feature Success:
|
|
481
|
-
- Screenshots show correct UI state
|
|
482
|
-
- Actions produce expected results
|
|
483
|
-
- Backend state changes correctly
|
|
484
|
-
- No JavaScript errors in browser console
|
|
485
|
-
|
|
486
|
-
## CONCLUSION
|
|
487
|
-
|
|
488
|
-
These patterns provide a systematic approach to debugging complex integrations. The key is combining multiple validation layers (UI, API, Database) with appropriate timeout management and real-time monitoring. Always take screenshots, check database state, and monitor logs to get a complete picture of what's happening.
|