@bugzy-ai/bugzy 1.17.0 → 1.18.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +273 -273
  3. package/dist/cli/index.cjs +95 -10
  4. package/dist/cli/index.cjs.map +1 -1
  5. package/dist/cli/index.js +94 -9
  6. package/dist/cli/index.js.map +1 -1
  7. package/dist/index.cjs +92 -7
  8. package/dist/index.cjs.map +1 -1
  9. package/dist/index.js +92 -7
  10. package/dist/index.js.map +1 -1
  11. package/dist/subagents/index.cjs.map +1 -1
  12. package/dist/subagents/index.js.map +1 -1
  13. package/dist/subagents/metadata.cjs.map +1 -1
  14. package/dist/subagents/metadata.js.map +1 -1
  15. package/dist/tasks/index.cjs +40 -1
  16. package/dist/tasks/index.cjs.map +1 -1
  17. package/dist/tasks/index.js +40 -1
  18. package/dist/tasks/index.js.map +1 -1
  19. package/package.json +95 -95
  20. package/templates/init/.bugzy/runtime/handlers/messages/feedback.md +178 -178
  21. package/templates/init/.bugzy/runtime/handlers/messages/question.md +122 -122
  22. package/templates/init/.bugzy/runtime/handlers/messages/status.md +146 -146
  23. package/templates/init/.bugzy/runtime/knowledge-base.md +61 -61
  24. package/templates/init/.bugzy/runtime/knowledge-maintenance-guide.md +97 -97
  25. package/templates/init/.bugzy/runtime/project-context.md +35 -35
  26. package/templates/init/.bugzy/runtime/subagent-memory-guide.md +87 -87
  27. package/templates/init/.bugzy/runtime/templates/event-examples.md +194 -194
  28. package/templates/init/.bugzy/runtime/templates/test-plan-template.md +50 -50
  29. package/templates/init/.bugzy/runtime/templates/test-result-schema.md +498 -498
  30. package/templates/init/.claude/settings.json +28 -28
  31. package/templates/init/.env.testdata +18 -18
  32. package/templates/init/.gitignore-template +24 -24
  33. package/templates/init/AGENTS.md +155 -155
  34. package/templates/init/CLAUDE.md +157 -157
  35. package/templates/init/test-runs/README.md +45 -45
  36. package/templates/init/tests/CLAUDE.md +193 -193
  37. package/templates/init/tests/docs/test-execution-strategy.md +535 -535
  38. package/templates/init/tests/docs/testing-best-practices.md +724 -724
  39. package/templates/playwright/BasePage.template.ts +190 -190
  40. package/templates/playwright/auth.setup.template.ts +89 -89
  41. package/templates/playwright/dataGenerators.helper.template.ts +148 -148
  42. package/templates/playwright/dateUtils.helper.template.ts +96 -96
  43. package/templates/playwright/pages.fixture.template.ts +50 -50
  44. package/templates/playwright/playwright.config.template.ts +97 -97
  45. package/templates/playwright/reporters/__tests__/bugzy-reporter-failure-classification.test.ts +299 -0
  46. package/templates/playwright/reporters/__tests__/bugzy-reporter-manifest-merge.test.ts +329 -329
  47. package/templates/playwright/reporters/__tests__/playwright.config.ts +5 -5
  48. package/templates/playwright/reporters/bugzy-reporter.ts +784 -613
  49. package/dist/templates/init/.bugzy/runtime/knowledge-base.md +0 -61
  50. package/dist/templates/init/.bugzy/runtime/knowledge-maintenance-guide.md +0 -97
  51. package/dist/templates/init/.bugzy/runtime/project-context.md +0 -35
  52. package/dist/templates/init/.bugzy/runtime/subagent-memory-guide.md +0 -87
  53. package/dist/templates/init/.bugzy/runtime/templates/test-plan-template.md +0 -50
  54. package/dist/templates/init/.bugzy/runtime/templates/test-result-schema.md +0 -498
  55. package/dist/templates/init/.bugzy/runtime/test-execution-strategy.md +0 -535
  56. package/dist/templates/init/.bugzy/runtime/testing-best-practices.md +0 -632
  57. package/dist/templates/init/.gitignore-template +0 -25
package/dist/index.js CHANGED
@@ -893,7 +893,29 @@ Read \`.bugzy/runtime/memory/event-history.md\` to:
893
893
  - List \`./test-cases/\` for existing tests
894
894
  - Check \`.bugzy/runtime/knowledge-base.md\` for past insights
895
895
 
896
- #### 2.4 Event-Action Reference Patterns
896
+ #### 2.4 Knowledge Base: Drafted vs Real Tests (BYOT)
897
+
898
+ When the project uses an external test repository, maintain two sections in \`.bugzy/runtime/knowledge-base.md\`:
899
+
900
+ **Drafted Tests** (Open PRs \u2014 tests not yet merged):
901
+ \`\`\`markdown
902
+ ### Drafted Tests
903
+ | PR | Branch | Tests Added | Status | Date |
904
+ |----|--------|-------------|--------|------|
905
+ | #12 | bugzy/verify-changes-a1b2c3d4 | login.spec.ts, checkout.spec.ts | Open | 2026-02-13 |
906
+ \`\`\`
907
+
908
+ **Active Tests** (Merged \u2014 tests are part of the test suite):
909
+ \`\`\`markdown
910
+ ### Active Tests
911
+ | File | What it tests | Source PR | Merged |
912
+ |------|---------------|-----------|--------|
913
+ | login.spec.ts | Login flow with valid/invalid credentials | #12 | 2026-02-13 |
914
+ \`\`\`
915
+
916
+ Move entries from Drafted \u2192 Active Tests when PRs are merged. Remove entries when PRs are closed without merge.
917
+
918
+ #### 2.5 Event-Action Reference Patterns
897
919
 
898
920
  Use these as reference patterns for common events. The webhook routing system already handles events with specific default tasks (e.g., deployment_status \u2192 /run-tests). Process-event receives events that need analysis.
899
921
 
@@ -912,6 +934,23 @@ Use these as reference patterns for common events. The webhook routing system al
912
934
  - **QA-relevant content found**: Propose appropriate follow-up tasks (e.g., \`/generate-test-cases\`, \`/verify-changes\`)
913
935
  - **No QA content** (HR meeting, offsite planning, etc.): Skip \u2014 log to event history only
914
936
 
937
+ **External Test Repo Events** (BYOT - events from the customer's external test repository):
938
+ - **PR opened by Bugzy** (\`com.github.external_repo.pull_request\`, \`action: "opened"\`, branch starts with \`bugzy/\`):
939
+ Log to Knowledge Base under "Drafted Tests". No action task needed \u2014 just record the PR number, branch, and what tests were added.
940
+ - **PR review submitted** (\`com.github.external_repo.pull_request_review\`):
941
+ If changes were requested \u2192 queue \`/verify-changes\` with \`{"existingPrBranch": "{head.ref}", "context": "PR review feedback: {review.body}"}\`.
942
+ The execution will iterate on the existing branch, push fixes, and skip PR creation.
943
+ - **PR comment** (\`com.github.external_repo.pull_request_comment\`):
944
+ Read the comment. If it contains actionable feedback, queue \`/verify-changes\`
945
+ with \`{"existingPrBranch": "{issue.pull_request.head.ref}"}\`.
946
+ - **PR merged** (\`com.github.external_repo.pull_request\`, \`action: "closed"\`, \`merged: true\`):
947
+ Update Knowledge Base: move entries from "Drafted Tests" to "Active Tests". Notify team of new test coverage.
948
+ The submodule pointer update happens automatically via the container (\`updateSubmoduleToLatest\`).
949
+ - **PR closed without merge** (\`com.github.external_repo.pull_request\`, \`action: "closed"\`, \`merged: false\`):
950
+ Remove from Knowledge Base "Drafted Tests". Notify team that tests were rejected.
951
+ - **Direct push to main** (\`com.github.external_repo.push\`, ref is main/master):
952
+ Update Knowledge Base if test files were affected. Submodule pointer update is automatic.
953
+
915
954
  **Other Events:**
916
955
  - Analyze for QA relevance based on knowledge base and project context
917
956
  - If action needed, propose appropriate task. If not, log and skip.
@@ -5626,7 +5665,19 @@ After analyzing test results, triage each failure to determine if it's a product
5626
5665
 
5627
5666
  **IMPORTANT: Do NOT report bugs without triaging first.**
5628
5667
 
5629
- For each failed test:
5668
+ ### 1. Check Failure Classification
5669
+
5670
+ **Before triaging any failure**, read \`new_failures\` from the latest \`test-runs/*/manifest.json\`:
5671
+
5672
+ | \`new_failures\` State | Action |
5673
+ |------------------------|--------|
5674
+ | Non-empty array | Only triage failures listed in \`new_failures\`. Do not investigate, fix, or create issues for \`known_failures\`. |
5675
+ | Empty array | No new failures to triage. Output "0 new failures to triage" and skip the rest of this step. |
5676
+ | Field missing | Fall back: triage all failed tests (backward compatibility with older reporter versions). |
5677
+
5678
+ ### 2. Triage Each Failure
5679
+
5680
+ For each failed test (from \`new_failures\` or all failures if field is missing):
5630
5681
 
5631
5682
  1. **Read failure details** from JSON report (error message, stack trace)
5632
5683
  2. **Classify the failure:**
@@ -5655,14 +5706,22 @@ For each failed test:
5655
5706
  - Broken navigation flows
5656
5707
  - Validation not working as expected
5657
5708
 
5658
- **Document Classification:**
5709
+ ### 3. Document Results
5710
+
5659
5711
  \`\`\`markdown
5660
- ### Failure Triage
5712
+ ### Failure Triage Summary
5713
+
5714
+ **New failures triaged: N** | **Known failures skipped: M**
5661
5715
 
5662
5716
  | Test ID | Test Name | Classification | Reason |
5663
5717
  |---------|-----------|---------------|--------|
5664
5718
  | TC-001 | Login test | TEST ISSUE | Selector brittle - uses CSS instead of role |
5665
5719
  | TC-002 | Checkout | PRODUCT BUG | 500 error on form submit |
5720
+
5721
+ #### Skipped Known Failures
5722
+ | Test ID | Test Name | Last Passed Run |
5723
+ |---------|-----------|-----------------|
5724
+ | TC-003 | Search | 20260210-103045 |
5666
5725
  \`\`\``,
5667
5726
  tags: ["execution", "triage", "analysis"]
5668
5727
  };
@@ -6220,10 +6279,36 @@ npx tsx reporters/parse-results.ts --input <file-or-url> [--timestamp <existing>
6220
6279
  }
6221
6280
  ]
6222
6281
  }
6282
+ ],
6283
+ "new_failures": [
6284
+ {
6285
+ "id": "<test case id>",
6286
+ "name": "<test name>",
6287
+ "error": "<error message or null>",
6288
+ "lastPassedRun": "<timestamp of last passing run or null>"
6289
+ }
6290
+ ],
6291
+ "known_failures": [
6292
+ {
6293
+ "id": "<test case id>",
6294
+ "name": "<test name>",
6295
+ "error": "<error message or null>",
6296
+ "lastPassedRun": null
6297
+ }
6223
6298
  ]
6224
6299
  }
6225
6300
  \`\`\`
6226
- 4. For each failed test, create:
6301
+ 4. **Classify failures** \u2014 after building the manifest, classify each failed test as new or known:
6302
+ - Read \`BUGZY_FAILURE_LOOKBACK\` env var (default: 5)
6303
+ - List previous \`test-runs/*/manifest.json\` files sorted by timestamp descending (skip current run)
6304
+ - For each failed test in the manifest:
6305
+ - If it passed in any of the last N runs \u2192 \`new_failures\` (include the timestamp of the last passing run in \`lastPassedRun\`)
6306
+ - If it failed in ALL of the last N runs \u2192 \`known_failures\`
6307
+ - If the test doesn't exist in any previous run \u2192 \`new_failures\` (new test)
6308
+ - If no previous runs exist at all (first run) \u2192 all failures go to \`new_failures\`
6309
+ - Write the \`new_failures\` and \`known_failures\` arrays into the manifest
6310
+
6311
+ 5. For each failed test, create:
6227
6312
  - Directory: \`test-runs/{timestamp}/{testCaseId}/exec-1/\`
6228
6313
  - File: \`test-runs/{timestamp}/{testCaseId}/exec-1/result.json\` containing:
6229
6314
  \`\`\`json
@@ -6235,8 +6320,8 @@ npx tsx reporters/parse-results.ts --input <file-or-url> [--timestamp <existing>
6235
6320
  "testFile": "<file path if available>"
6236
6321
  }
6237
6322
  \`\`\`
6238
- 5. Print the manifest path to stdout
6239
- 6. Exit code 0 on success, non-zero on failure
6323
+ 6. Print the manifest path to stdout
6324
+ 7. Exit code 0 on success, non-zero on failure
6240
6325
 
6241
6326
  **Incremental mode** (\`--timestamp\` + \`--test-id\` provided):
6242
6327
  1. Read existing \`test-runs/{timestamp}/manifest.json\`