@bugzy-ai/bugzy 1.18.0 → 1.18.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +273 -273
  3. package/dist/cli/index.cjs +227 -5
  4. package/dist/cli/index.cjs.map +1 -1
  5. package/dist/cli/index.js +226 -4
  6. package/dist/cli/index.js.map +1 -1
  7. package/dist/index.cjs +214 -2
  8. package/dist/index.cjs.map +1 -1
  9. package/dist/index.js +214 -2
  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 +130 -2
  16. package/dist/tasks/index.cjs.map +1 -1
  17. package/dist/tasks/index.d.cts +1 -0
  18. package/dist/tasks/index.d.ts +1 -0
  19. package/dist/tasks/index.js +130 -2
  20. package/dist/tasks/index.js.map +1 -1
  21. package/package.json +95 -95
  22. package/templates/init/.bugzy/runtime/handlers/messages/feedback.md +178 -178
  23. package/templates/init/.bugzy/runtime/handlers/messages/question.md +122 -122
  24. package/templates/init/.bugzy/runtime/handlers/messages/status.md +146 -146
  25. package/templates/init/.bugzy/runtime/knowledge-base.md +61 -61
  26. package/templates/init/.bugzy/runtime/knowledge-maintenance-guide.md +97 -97
  27. package/templates/init/.bugzy/runtime/project-context.md +35 -35
  28. package/templates/init/.bugzy/runtime/subagent-memory-guide.md +87 -87
  29. package/templates/init/.bugzy/runtime/templates/event-examples.md +194 -194
  30. package/templates/init/.bugzy/runtime/templates/test-plan-template.md +50 -50
  31. package/templates/init/.bugzy/runtime/templates/test-result-schema.md +498 -498
  32. package/templates/init/.claude/settings.json +28 -28
  33. package/templates/init/.env.testdata +18 -18
  34. package/templates/init/.gitignore-template +24 -24
  35. package/templates/init/AGENTS.md +155 -155
  36. package/templates/init/CLAUDE.md +157 -157
  37. package/templates/init/test-runs/README.md +45 -45
  38. package/templates/init/tests/CLAUDE.md +193 -193
  39. package/templates/init/tests/docs/test-execution-strategy.md +535 -535
  40. package/templates/init/tests/docs/testing-best-practices.md +724 -724
  41. package/templates/playwright/BasePage.template.ts +190 -190
  42. package/templates/playwright/auth.setup.template.ts +89 -89
  43. package/templates/playwright/dataGenerators.helper.template.ts +148 -148
  44. package/templates/playwright/dateUtils.helper.template.ts +96 -96
  45. package/templates/playwright/pages.fixture.template.ts +50 -50
  46. package/templates/playwright/playwright.config.template.ts +97 -97
  47. package/templates/playwright/reporters/__tests__/bugzy-reporter-failure-classification.test.ts +299 -299
  48. package/templates/playwright/reporters/__tests__/bugzy-reporter-manifest-merge.test.ts +329 -329
  49. package/templates/playwright/reporters/__tests__/playwright.config.ts +5 -5
  50. package/templates/playwright/reporters/bugzy-reporter.ts +784 -784
  51. package/dist/templates/init/.bugzy/runtime/knowledge-base.md +0 -61
  52. package/dist/templates/init/.bugzy/runtime/knowledge-maintenance-guide.md +0 -97
  53. package/dist/templates/init/.bugzy/runtime/project-context.md +0 -35
  54. package/dist/templates/init/.bugzy/runtime/subagent-memory-guide.md +0 -87
  55. package/dist/templates/init/.bugzy/runtime/templates/test-plan-template.md +0 -50
  56. package/dist/templates/init/.bugzy/runtime/templates/test-result-schema.md +0 -498
  57. package/dist/templates/init/.bugzy/runtime/test-execution-strategy.md +0 -535
  58. package/dist/templates/init/.bugzy/runtime/testing-best-practices.md +0 -632
  59. package/dist/templates/init/.gitignore-template +0 -25
package/dist/index.js CHANGED
@@ -221,6 +221,7 @@ var TASK_SLUGS = {
221
221
  RUN_TESTS: "run-tests",
222
222
  VERIFY_CHANGES: "verify-changes",
223
223
  TRIAGE_RESULTS: "triage-results",
224
+ EXPLORE_TEST_CODEBASE: "explore-test-codebase",
224
225
  /** @deprecated Use ONBOARD_TESTING instead */
225
226
  FULL_TEST_COVERAGE: "onboard-testing"
226
227
  };
@@ -893,7 +894,29 @@ Read \`.bugzy/runtime/memory/event-history.md\` to:
893
894
  - List \`./test-cases/\` for existing tests
894
895
  - Check \`.bugzy/runtime/knowledge-base.md\` for past insights
895
896
 
896
- #### 2.4 Event-Action Reference Patterns
897
+ #### 2.4 Knowledge Base: Drafted vs Real Tests (BYOT)
898
+
899
+ When the project uses an external test repository, maintain two sections in \`.bugzy/runtime/knowledge-base.md\`:
900
+
901
+ **Drafted Tests** (Open PRs \u2014 tests not yet merged):
902
+ \`\`\`markdown
903
+ ### Drafted Tests
904
+ | PR | Branch | Tests Added | Status | Date |
905
+ |----|--------|-------------|--------|------|
906
+ | #12 | bugzy/verify-changes-a1b2c3d4 | login.spec.ts, checkout.spec.ts | Open | 2026-02-13 |
907
+ \`\`\`
908
+
909
+ **Active Tests** (Merged \u2014 tests are part of the test suite):
910
+ \`\`\`markdown
911
+ ### Active Tests
912
+ | File | What it tests | Source PR | Merged |
913
+ |------|---------------|-----------|--------|
914
+ | login.spec.ts | Login flow with valid/invalid credentials | #12 | 2026-02-13 |
915
+ \`\`\`
916
+
917
+ Move entries from Drafted \u2192 Active Tests when PRs are merged. Remove entries when PRs are closed without merge.
918
+
919
+ #### 2.5 Event-Action Reference Patterns
897
920
 
898
921
  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
922
 
@@ -912,6 +935,23 @@ Use these as reference patterns for common events. The webhook routing system al
912
935
  - **QA-relevant content found**: Propose appropriate follow-up tasks (e.g., \`/generate-test-cases\`, \`/verify-changes\`)
913
936
  - **No QA content** (HR meeting, offsite planning, etc.): Skip \u2014 log to event history only
914
937
 
938
+ **External Test Repo Events** (BYOT - events from the customer's external test repository):
939
+ - **PR opened by Bugzy** (\`com.github.external_repo.pull_request\`, \`action: "opened"\`, branch starts with \`bugzy/\`):
940
+ Log to Knowledge Base under "Drafted Tests". No action task needed \u2014 just record the PR number, branch, and what tests were added.
941
+ - **PR review submitted** (\`com.github.external_repo.pull_request_review\`):
942
+ If changes were requested \u2192 queue \`/verify-changes\` with \`{"existingPrBranch": "{head.ref}", "context": "PR review feedback: {review.body}"}\`.
943
+ The execution will iterate on the existing branch, push fixes, and skip PR creation.
944
+ - **PR comment** (\`com.github.external_repo.pull_request_comment\`):
945
+ Read the comment. If it contains actionable feedback, queue \`/verify-changes\`
946
+ with \`{"existingPrBranch": "{issue.pull_request.head.ref}"}\`.
947
+ - **PR merged** (\`com.github.external_repo.pull_request\`, \`action: "closed"\`, \`merged: true\`):
948
+ Update Knowledge Base: move entries from "Drafted Tests" to "Active Tests". Notify team of new test coverage.
949
+ The submodule pointer update happens automatically via the container (\`updateSubmoduleToLatest\`).
950
+ - **PR closed without merge** (\`com.github.external_repo.pull_request\`, \`action: "closed"\`, \`merged: false\`):
951
+ Remove from Knowledge Base "Drafted Tests". Notify team that tests were rejected.
952
+ - **Direct push to main** (\`com.github.external_repo.push\`, ref is main/master):
953
+ Update Knowledge Base if test files were affected. Submodule pointer update is automatic.
954
+
915
955
  **Other Events:**
916
956
  - Analyze for QA relevance based on knowledge base and project context
917
957
  - If action needed, propose appropriate task. If not, log and skip.
@@ -2071,6 +2111,93 @@ Output this JSON as the final result of the task.`
2071
2111
  dependentTasks: []
2072
2112
  };
2073
2113
 
2114
+ // src/tasks/library/explore-test-codebase.ts
2115
+ var exploreTestCodebaseTask = {
2116
+ slug: TASK_SLUGS.EXPLORE_TEST_CODEBASE,
2117
+ name: "Explore Test Codebase",
2118
+ description: "Analyze external test repository to understand framework, coverage, and conventions",
2119
+ frontmatter: {
2120
+ description: "Analyze external test codebase for BYOT onboarding",
2121
+ "argument-hint": "--focus [area]"
2122
+ },
2123
+ steps: [
2124
+ // Step 1: Overview (inline)
2125
+ {
2126
+ inline: true,
2127
+ title: "Explore Test Codebase Overview",
2128
+ content: `Analyze the external test repository to understand the testing framework, test coverage, conventions, and codebase structure. This task is triggered during BYOT (Bring Your Own Tests) onboarding to help Bugzy understand the customer's existing test suite.`
2129
+ },
2130
+ // Step 2: Security Notice
2131
+ "security-notice",
2132
+ // Step 3: Arguments (inline)
2133
+ {
2134
+ inline: true,
2135
+ title: "Arguments",
2136
+ content: `**Arguments**: $ARGUMENTS
2137
+
2138
+ **Parse:**
2139
+ - **focus**: specific area to analyze (default: comprehensive)`
2140
+ },
2141
+ // Setup
2142
+ "load-project-context",
2143
+ "read-knowledge-base",
2144
+ // Core analysis
2145
+ "analyze-test-codebase",
2146
+ // Generate results parser for normalizing test output
2147
+ "create-results-parser",
2148
+ // Optional: explore the app itself if URL is available
2149
+ {
2150
+ inline: true,
2151
+ title: "App Exploration (Optional)",
2152
+ content: `If the project has an app URL configured (check \`.bugzy/runtime/project-context.md\` or env vars for TEST_APP_HOST), {{INVOKE_BROWSER_AUTOMATION}} to briefly explore the application:
2153
+
2154
+ 1. Navigate to the app URL
2155
+ 2. Identify main navigation and key pages
2156
+ 3. Map discovered features to test coverage from the codebase analysis
2157
+ 4. Note any features that appear untested
2158
+
2159
+ This step helps correlate what the tests cover with what the application actually contains. Skip if no app URL is available.`,
2160
+ conditionalOnSubagent: "browser-automation"
2161
+ },
2162
+ // Generate output
2163
+ {
2164
+ inline: true,
2165
+ title: "Commit Analysis Results",
2166
+ content: `Commit all analysis artifacts to the project repository:
2167
+
2168
+ 1. The test codebase analysis report (\`.bugzy/runtime/test-codebase-analysis.md\`)
2169
+ 2. Any generated CLAUDE.md draft (if the external repo was missing one)
2170
+
2171
+ Use a clear commit message: "chore: analyze external test codebase"
2172
+
2173
+ These artifacts will be available to all future task executions for this project.`
2174
+ },
2175
+ // Team Communication (conditional)
2176
+ {
2177
+ inline: true,
2178
+ title: "Team Communication",
2179
+ content: `{{INVOKE_TEAM_COMMUNICATOR}} to notify the team about the test codebase analysis:
2180
+
2181
+ \`\`\`
2182
+ 1. Post a summary of the analysis findings
2183
+ 2. Include key information:
2184
+ - Test framework and runner identified
2185
+ - Number of test files and estimated test cases
2186
+ - Feature areas covered by existing tests
2187
+ - Any gaps or areas without test coverage
2188
+ 3. Ask if the analysis looks accurate
2189
+ 4. Use appropriate channel and threading
2190
+ \`\`\``,
2191
+ conditionalOnSubagent: "team-communicator"
2192
+ },
2193
+ // Maintenance
2194
+ "update-knowledge-base"
2195
+ ],
2196
+ requiredSubagents: ["browser-automation"],
2197
+ optionalSubagents: ["team-communicator"],
2198
+ dependentTasks: []
2199
+ };
2200
+
2074
2201
  // src/tasks/index.ts
2075
2202
  var TASK_TEMPLATES = {
2076
2203
  [TASK_SLUGS.GENERATE_TEST_CASES]: generateTestCasesTask,
@@ -2081,7 +2208,8 @@ var TASK_TEMPLATES = {
2081
2208
  [TASK_SLUGS.VERIFY_CHANGES]: verifyChangesTask,
2082
2209
  [TASK_SLUGS.ONBOARD_TESTING]: onboardTestingTask,
2083
2210
  [TASK_SLUGS.EXPLORE_APPLICATION]: exploreApplicationTask,
2084
- [TASK_SLUGS.TRIAGE_RESULTS]: triageResultsTask
2211
+ [TASK_SLUGS.TRIAGE_RESULTS]: triageResultsTask,
2212
+ [TASK_SLUGS.EXPLORE_TEST_CODEBASE]: exploreTestCodebaseTask
2085
2213
  };
2086
2214
  function getTaskTemplate(slug) {
2087
2215
  return TASK_TEMPLATES[slug];
@@ -5364,6 +5492,89 @@ Requirements clear? \u2192 YES \u2192 Quick Exploration \u2192 Matches? \u2192 Y
5364
5492
  tags: ["exploration", "protocol", "adaptive"]
5365
5493
  };
5366
5494
 
5495
+ // src/tasks/steps/exploration/analyze-test-codebase.ts
5496
+ var analyzeTestCodebaseStep = {
5497
+ id: "analyze-test-codebase",
5498
+ title: "Analyze Test Codebase",
5499
+ category: "exploration",
5500
+ content: `## Analyze External Test Codebase
5501
+
5502
+ Thoroughly analyze the customer's external test repository to understand their testing framework, conventions, coverage, and codebase structure.
5503
+
5504
+ ### Step 1: Check for CLAUDE.md
5505
+
5506
+ Look for a \`CLAUDE.md\` file in the test repository root (\`./tests/CLAUDE.md\` or \`./CLAUDE.md\`). If it exists, read it to understand the project's documented conventions, setup instructions, and testing patterns.
5507
+
5508
+ ### Step 2: Scan Directory Structure
5509
+
5510
+ Examine the repository structure to understand organization:
5511
+ - List top-level directories and files
5512
+ - Identify test directories (e.g., \`tests/\`, \`__tests__/\`, \`e2e/\`, \`spec/\`, \`cypress/\`)
5513
+ - Note configuration files (e.g., \`playwright.config.ts\`, \`cypress.config.ts\`, \`jest.config.js\`, \`vitest.config.ts\`)
5514
+ - Check \`package.json\` for test scripts and dependencies
5515
+
5516
+ ### Step 3: Identify Test Framework
5517
+
5518
+ Determine the testing framework from configuration files and dependencies:
5519
+ - **Playwright**: \`playwright.config.ts\`, \`@playwright/test\` in dependencies
5520
+ - **Cypress**: \`cypress.config.ts\`, \`cypress\` in dependencies
5521
+ - **Jest**: \`jest.config.js\`, \`jest\` in dependencies
5522
+ - **Vitest**: \`vitest.config.ts\`, \`vitest\` in dependencies
5523
+ - **Other**: Check for \`mocha\`, \`ava\`, \`tap\`, custom runners
5524
+
5525
+ Note the test runner, assertion library, and any additional tooling (e.g., \`msw\`, \`testing-library\`, page objects).
5526
+
5527
+ ### Step 4: Catalog Test Coverage
5528
+
5529
+ Analyze test files to understand what's being tested:
5530
+ - Read test file names and directory organization
5531
+ - Parse \`describe()\` / \`it()\` / \`test()\` blocks to understand test structure
5532
+ - Group tests by feature area (e.g., authentication, checkout, user management)
5533
+ - Count total test files and approximate number of test cases
5534
+ - Note any skipped or pending tests
5535
+
5536
+ ### Step 5: Document Conventions
5537
+
5538
+ Identify testing patterns and conventions:
5539
+ - **Naming patterns**: How test files are named (e.g., \`*.spec.ts\`, \`*.test.ts\`, \`*.e2e.ts\`)
5540
+ - **Page Objects / Fixtures**: Look for page object patterns, custom fixtures, or helper utilities
5541
+ - **Data management**: How test data is handled (fixtures, factories, seeds)
5542
+ - **Environment configuration**: How environments are configured (.env files, config objects)
5543
+ - **CI integration**: Check for CI config files (GitHub Actions, CircleCI, etc.)
5544
+
5545
+ ### Step 6: Generate Summary
5546
+
5547
+ Create a structured summary of findings and commit it to the project repository:
5548
+
5549
+ \`\`\`
5550
+ File: .bugzy/runtime/test-codebase-analysis.md
5551
+
5552
+ Contents:
5553
+ - Framework: [name and version]
5554
+ - Test runner: [runner]
5555
+ - Total test files: [count]
5556
+ - Estimated test cases: [count]
5557
+ - Feature areas covered: [list]
5558
+ - Key conventions: [summary]
5559
+ - Directory structure: [overview]
5560
+ - Notable patterns: [page objects, fixtures, etc.]
5561
+ \`\`\`
5562
+
5563
+ ### Step 7: Generate CLAUDE.md (if missing)
5564
+
5565
+ If the external test repository does NOT have a \`CLAUDE.md\`, generate a framework-appropriate draft based on the analysis findings:
5566
+ - Include discovered framework and runner
5567
+ - Document build/run commands from package.json
5568
+ - Note key conventions discovered
5569
+ - Include directory structure overview
5570
+ - Save as a draft for customer review
5571
+
5572
+ **Important**: Do NOT use the Playwright-specific template \u2014 generate content based on what was actually discovered in the repository.
5573
+
5574
+ Commit the analysis results to the project repo so they are available for future task executions.`,
5575
+ tags: ["exploration", "byot", "analysis"]
5576
+ };
5577
+
5367
5578
  // src/tasks/steps/clarification/clarification-protocol.ts
5368
5579
  var clarificationProtocolStep = {
5369
5580
  id: "clarification-protocol",
@@ -6545,6 +6756,7 @@ var STEP_LIBRARY = {
6545
6756
  "gather-documentation": gatherDocumentationStep,
6546
6757
  // Exploration
6547
6758
  "exploration-protocol": explorationProtocolStep,
6759
+ "analyze-test-codebase": analyzeTestCodebaseStep,
6548
6760
  // Clarification
6549
6761
  "clarification-protocol": clarificationProtocolStep,
6550
6762
  // Execution