@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
@@ -31,12 +31,12 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
31
31
  ));
32
32
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
33
33
 
34
- // node_modules/.pnpm/tsup@8.5.0_postcss@8.5.6_typescript@5.9.3/node_modules/tsup/assets/cjs_shims.js
34
+ // node_modules/.pnpm/tsup@8.5.1_postcss@8.5.6_typescript@5.9.3/node_modules/tsup/assets/cjs_shims.js
35
35
  var getImportMetaUrl, importMetaUrl;
36
36
  var init_cjs_shims = __esm({
37
- "node_modules/.pnpm/tsup@8.5.0_postcss@8.5.6_typescript@5.9.3/node_modules/tsup/assets/cjs_shims.js"() {
37
+ "node_modules/.pnpm/tsup@8.5.1_postcss@8.5.6_typescript@5.9.3/node_modules/tsup/assets/cjs_shims.js"() {
38
38
  "use strict";
39
- getImportMetaUrl = () => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.src || new URL("main.js", document.baseURI).href;
39
+ getImportMetaUrl = () => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.tagName.toUpperCase() === "SCRIPT" ? document.currentScript.src : new URL("main.js", document.baseURI).href;
40
40
  importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
41
41
  }
42
42
  });
@@ -89,6 +89,7 @@ var init_constants = __esm({
89
89
  RUN_TESTS: "run-tests",
90
90
  VERIFY_CHANGES: "verify-changes",
91
91
  TRIAGE_RESULTS: "triage-results",
92
+ EXPLORE_TEST_CODEBASE: "explore-test-codebase",
92
93
  /** @deprecated Use ONBOARD_TESTING instead */
93
94
  FULL_TEST_COVERAGE: "onboard-testing"
94
95
  };
@@ -793,7 +794,29 @@ Read \`.bugzy/runtime/memory/event-history.md\` to:
793
794
  - List \`./test-cases/\` for existing tests
794
795
  - Check \`.bugzy/runtime/knowledge-base.md\` for past insights
795
796
 
796
- #### 2.4 Event-Action Reference Patterns
797
+ #### 2.4 Knowledge Base: Drafted vs Real Tests (BYOT)
798
+
799
+ When the project uses an external test repository, maintain two sections in \`.bugzy/runtime/knowledge-base.md\`:
800
+
801
+ **Drafted Tests** (Open PRs \u2014 tests not yet merged):
802
+ \`\`\`markdown
803
+ ### Drafted Tests
804
+ | PR | Branch | Tests Added | Status | Date |
805
+ |----|--------|-------------|--------|------|
806
+ | #12 | bugzy/verify-changes-a1b2c3d4 | login.spec.ts, checkout.spec.ts | Open | 2026-02-13 |
807
+ \`\`\`
808
+
809
+ **Active Tests** (Merged \u2014 tests are part of the test suite):
810
+ \`\`\`markdown
811
+ ### Active Tests
812
+ | File | What it tests | Source PR | Merged |
813
+ |------|---------------|-----------|--------|
814
+ | login.spec.ts | Login flow with valid/invalid credentials | #12 | 2026-02-13 |
815
+ \`\`\`
816
+
817
+ Move entries from Drafted \u2192 Active Tests when PRs are merged. Remove entries when PRs are closed without merge.
818
+
819
+ #### 2.5 Event-Action Reference Patterns
797
820
 
798
821
  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.
799
822
 
@@ -812,6 +835,23 @@ Use these as reference patterns for common events. The webhook routing system al
812
835
  - **QA-relevant content found**: Propose appropriate follow-up tasks (e.g., \`/generate-test-cases\`, \`/verify-changes\`)
813
836
  - **No QA content** (HR meeting, offsite planning, etc.): Skip \u2014 log to event history only
814
837
 
838
+ **External Test Repo Events** (BYOT - events from the customer's external test repository):
839
+ - **PR opened by Bugzy** (\`com.github.external_repo.pull_request\`, \`action: "opened"\`, branch starts with \`bugzy/\`):
840
+ Log to Knowledge Base under "Drafted Tests". No action task needed \u2014 just record the PR number, branch, and what tests were added.
841
+ - **PR review submitted** (\`com.github.external_repo.pull_request_review\`):
842
+ If changes were requested \u2192 queue \`/verify-changes\` with \`{"existingPrBranch": "{head.ref}", "context": "PR review feedback: {review.body}"}\`.
843
+ The execution will iterate on the existing branch, push fixes, and skip PR creation.
844
+ - **PR comment** (\`com.github.external_repo.pull_request_comment\`):
845
+ Read the comment. If it contains actionable feedback, queue \`/verify-changes\`
846
+ with \`{"existingPrBranch": "{issue.pull_request.head.ref}"}\`.
847
+ - **PR merged** (\`com.github.external_repo.pull_request\`, \`action: "closed"\`, \`merged: true\`):
848
+ Update Knowledge Base: move entries from "Drafted Tests" to "Active Tests". Notify team of new test coverage.
849
+ The submodule pointer update happens automatically via the container (\`updateSubmoduleToLatest\`).
850
+ - **PR closed without merge** (\`com.github.external_repo.pull_request\`, \`action: "closed"\`, \`merged: false\`):
851
+ Remove from Knowledge Base "Drafted Tests". Notify team that tests were rejected.
852
+ - **Direct push to main** (\`com.github.external_repo.push\`, ref is main/master):
853
+ Update Knowledge Base if test files were affected. Submodule pointer update is automatic.
854
+
815
855
  **Other Events:**
816
856
  - Analyze for QA relevance based on knowledge base and project context
817
857
  - If action needed, propose appropriate task. If not, log and skip.
@@ -2013,6 +2053,101 @@ Output this JSON as the final result of the task.`
2013
2053
  }
2014
2054
  });
2015
2055
 
2056
+ // src/tasks/library/explore-test-codebase.ts
2057
+ var exploreTestCodebaseTask;
2058
+ var init_explore_test_codebase = __esm({
2059
+ "src/tasks/library/explore-test-codebase.ts"() {
2060
+ "use strict";
2061
+ init_cjs_shims();
2062
+ init_constants();
2063
+ exploreTestCodebaseTask = {
2064
+ slug: TASK_SLUGS.EXPLORE_TEST_CODEBASE,
2065
+ name: "Explore Test Codebase",
2066
+ description: "Analyze external test repository to understand framework, coverage, and conventions",
2067
+ frontmatter: {
2068
+ description: "Analyze external test codebase for BYOT onboarding",
2069
+ "argument-hint": "--focus [area]"
2070
+ },
2071
+ steps: [
2072
+ // Step 1: Overview (inline)
2073
+ {
2074
+ inline: true,
2075
+ title: "Explore Test Codebase Overview",
2076
+ 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.`
2077
+ },
2078
+ // Step 2: Security Notice
2079
+ "security-notice",
2080
+ // Step 3: Arguments (inline)
2081
+ {
2082
+ inline: true,
2083
+ title: "Arguments",
2084
+ content: `**Arguments**: $ARGUMENTS
2085
+
2086
+ **Parse:**
2087
+ - **focus**: specific area to analyze (default: comprehensive)`
2088
+ },
2089
+ // Setup
2090
+ "load-project-context",
2091
+ "read-knowledge-base",
2092
+ // Core analysis
2093
+ "analyze-test-codebase",
2094
+ // Generate results parser for normalizing test output
2095
+ "create-results-parser",
2096
+ // Optional: explore the app itself if URL is available
2097
+ {
2098
+ inline: true,
2099
+ title: "App Exploration (Optional)",
2100
+ 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:
2101
+
2102
+ 1. Navigate to the app URL
2103
+ 2. Identify main navigation and key pages
2104
+ 3. Map discovered features to test coverage from the codebase analysis
2105
+ 4. Note any features that appear untested
2106
+
2107
+ This step helps correlate what the tests cover with what the application actually contains. Skip if no app URL is available.`,
2108
+ conditionalOnSubagent: "browser-automation"
2109
+ },
2110
+ // Generate output
2111
+ {
2112
+ inline: true,
2113
+ title: "Commit Analysis Results",
2114
+ content: `Commit all analysis artifacts to the project repository:
2115
+
2116
+ 1. The test codebase analysis report (\`.bugzy/runtime/test-codebase-analysis.md\`)
2117
+ 2. Any generated CLAUDE.md draft (if the external repo was missing one)
2118
+
2119
+ Use a clear commit message: "chore: analyze external test codebase"
2120
+
2121
+ These artifacts will be available to all future task executions for this project.`
2122
+ },
2123
+ // Team Communication (conditional)
2124
+ {
2125
+ inline: true,
2126
+ title: "Team Communication",
2127
+ content: `{{INVOKE_TEAM_COMMUNICATOR}} to notify the team about the test codebase analysis:
2128
+
2129
+ \`\`\`
2130
+ 1. Post a summary of the analysis findings
2131
+ 2. Include key information:
2132
+ - Test framework and runner identified
2133
+ - Number of test files and estimated test cases
2134
+ - Feature areas covered by existing tests
2135
+ - Any gaps or areas without test coverage
2136
+ 3. Ask if the analysis looks accurate
2137
+ 4. Use appropriate channel and threading
2138
+ \`\`\``,
2139
+ conditionalOnSubagent: "team-communicator"
2140
+ },
2141
+ // Maintenance
2142
+ "update-knowledge-base"
2143
+ ],
2144
+ requiredSubagents: ["browser-automation"],
2145
+ optionalSubagents: ["team-communicator"],
2146
+ dependentTasks: []
2147
+ };
2148
+ }
2149
+ });
2150
+
2016
2151
  // src/tasks/index.ts
2017
2152
  var tasks_exports = {};
2018
2153
  __export(tasks_exports, {
@@ -2049,6 +2184,7 @@ var init_tasks = __esm({
2049
2184
  init_onboard_testing();
2050
2185
  init_explore_application();
2051
2186
  init_triage_results();
2187
+ init_explore_test_codebase();
2052
2188
  init_constants();
2053
2189
  TASK_TEMPLATES = {
2054
2190
  [TASK_SLUGS.GENERATE_TEST_CASES]: generateTestCasesTask,
@@ -2059,7 +2195,8 @@ var init_tasks = __esm({
2059
2195
  [TASK_SLUGS.VERIFY_CHANGES]: verifyChangesTask,
2060
2196
  [TASK_SLUGS.ONBOARD_TESTING]: onboardTestingTask,
2061
2197
  [TASK_SLUGS.EXPLORE_APPLICATION]: exploreApplicationTask,
2062
- [TASK_SLUGS.TRIAGE_RESULTS]: triageResultsTask
2198
+ [TASK_SLUGS.TRIAGE_RESULTS]: triageResultsTask,
2199
+ [TASK_SLUGS.EXPLORE_TEST_CODEBASE]: exploreTestCodebaseTask
2063
2200
  };
2064
2201
  }
2065
2202
  });
@@ -5795,6 +5932,90 @@ Requirements clear? \u2192 YES \u2192 Quick Exploration \u2192 Matches? \u2192 Y
5795
5932
  tags: ["exploration", "protocol", "adaptive"]
5796
5933
  };
5797
5934
 
5935
+ // src/tasks/steps/exploration/analyze-test-codebase.ts
5936
+ init_cjs_shims();
5937
+ var analyzeTestCodebaseStep = {
5938
+ id: "analyze-test-codebase",
5939
+ title: "Analyze Test Codebase",
5940
+ category: "exploration",
5941
+ content: `## Analyze External Test Codebase
5942
+
5943
+ Thoroughly analyze the customer's external test repository to understand their testing framework, conventions, coverage, and codebase structure.
5944
+
5945
+ ### Step 1: Check for CLAUDE.md
5946
+
5947
+ 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.
5948
+
5949
+ ### Step 2: Scan Directory Structure
5950
+
5951
+ Examine the repository structure to understand organization:
5952
+ - List top-level directories and files
5953
+ - Identify test directories (e.g., \`tests/\`, \`__tests__/\`, \`e2e/\`, \`spec/\`, \`cypress/\`)
5954
+ - Note configuration files (e.g., \`playwright.config.ts\`, \`cypress.config.ts\`, \`jest.config.js\`, \`vitest.config.ts\`)
5955
+ - Check \`package.json\` for test scripts and dependencies
5956
+
5957
+ ### Step 3: Identify Test Framework
5958
+
5959
+ Determine the testing framework from configuration files and dependencies:
5960
+ - **Playwright**: \`playwright.config.ts\`, \`@playwright/test\` in dependencies
5961
+ - **Cypress**: \`cypress.config.ts\`, \`cypress\` in dependencies
5962
+ - **Jest**: \`jest.config.js\`, \`jest\` in dependencies
5963
+ - **Vitest**: \`vitest.config.ts\`, \`vitest\` in dependencies
5964
+ - **Other**: Check for \`mocha\`, \`ava\`, \`tap\`, custom runners
5965
+
5966
+ Note the test runner, assertion library, and any additional tooling (e.g., \`msw\`, \`testing-library\`, page objects).
5967
+
5968
+ ### Step 4: Catalog Test Coverage
5969
+
5970
+ Analyze test files to understand what's being tested:
5971
+ - Read test file names and directory organization
5972
+ - Parse \`describe()\` / \`it()\` / \`test()\` blocks to understand test structure
5973
+ - Group tests by feature area (e.g., authentication, checkout, user management)
5974
+ - Count total test files and approximate number of test cases
5975
+ - Note any skipped or pending tests
5976
+
5977
+ ### Step 5: Document Conventions
5978
+
5979
+ Identify testing patterns and conventions:
5980
+ - **Naming patterns**: How test files are named (e.g., \`*.spec.ts\`, \`*.test.ts\`, \`*.e2e.ts\`)
5981
+ - **Page Objects / Fixtures**: Look for page object patterns, custom fixtures, or helper utilities
5982
+ - **Data management**: How test data is handled (fixtures, factories, seeds)
5983
+ - **Environment configuration**: How environments are configured (.env files, config objects)
5984
+ - **CI integration**: Check for CI config files (GitHub Actions, CircleCI, etc.)
5985
+
5986
+ ### Step 6: Generate Summary
5987
+
5988
+ Create a structured summary of findings and commit it to the project repository:
5989
+
5990
+ \`\`\`
5991
+ File: .bugzy/runtime/test-codebase-analysis.md
5992
+
5993
+ Contents:
5994
+ - Framework: [name and version]
5995
+ - Test runner: [runner]
5996
+ - Total test files: [count]
5997
+ - Estimated test cases: [count]
5998
+ - Feature areas covered: [list]
5999
+ - Key conventions: [summary]
6000
+ - Directory structure: [overview]
6001
+ - Notable patterns: [page objects, fixtures, etc.]
6002
+ \`\`\`
6003
+
6004
+ ### Step 7: Generate CLAUDE.md (if missing)
6005
+
6006
+ If the external test repository does NOT have a \`CLAUDE.md\`, generate a framework-appropriate draft based on the analysis findings:
6007
+ - Include discovered framework and runner
6008
+ - Document build/run commands from package.json
6009
+ - Note key conventions discovered
6010
+ - Include directory structure overview
6011
+ - Save as a draft for customer review
6012
+
6013
+ **Important**: Do NOT use the Playwright-specific template \u2014 generate content based on what was actually discovered in the repository.
6014
+
6015
+ Commit the analysis results to the project repo so they are available for future task executions.`,
6016
+ tags: ["exploration", "byot", "analysis"]
6017
+ };
6018
+
5798
6019
  // src/tasks/steps/clarification/clarification-protocol.ts
5799
6020
  init_cjs_shims();
5800
6021
  var clarificationProtocolStep = {
@@ -6998,6 +7219,7 @@ var STEP_LIBRARY = {
6998
7219
  "gather-documentation": gatherDocumentationStep,
6999
7220
  // Exploration
7000
7221
  "exploration-protocol": explorationProtocolStep,
7222
+ "analyze-test-codebase": analyzeTestCodebaseStep,
7001
7223
  // Clarification
7002
7224
  "clarification-protocol": clarificationProtocolStep,
7003
7225
  // Execution