@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/cli/index.js CHANGED
@@ -20,12 +20,12 @@ var __copyProps = (to, from, except, desc) => {
20
20
  };
21
21
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
22
22
 
23
- // node_modules/.pnpm/tsup@8.5.0_postcss@8.5.6_typescript@5.9.3/node_modules/tsup/assets/esm_shims.js
23
+ // node_modules/.pnpm/tsup@8.5.1_postcss@8.5.6_typescript@5.9.3/node_modules/tsup/assets/esm_shims.js
24
24
  import path from "path";
25
25
  import { fileURLToPath } from "url";
26
26
  var getFilename, getDirname, __dirname;
27
27
  var init_esm_shims = __esm({
28
- "node_modules/.pnpm/tsup@8.5.0_postcss@8.5.6_typescript@5.9.3/node_modules/tsup/assets/esm_shims.js"() {
28
+ "node_modules/.pnpm/tsup@8.5.1_postcss@8.5.6_typescript@5.9.3/node_modules/tsup/assets/esm_shims.js"() {
29
29
  "use strict";
30
30
  getFilename = () => fileURLToPath(import.meta.url);
31
31
  getDirname = () => path.dirname(getFilename());
@@ -81,6 +81,7 @@ var init_constants = __esm({
81
81
  RUN_TESTS: "run-tests",
82
82
  VERIFY_CHANGES: "verify-changes",
83
83
  TRIAGE_RESULTS: "triage-results",
84
+ EXPLORE_TEST_CODEBASE: "explore-test-codebase",
84
85
  /** @deprecated Use ONBOARD_TESTING instead */
85
86
  FULL_TEST_COVERAGE: "onboard-testing"
86
87
  };
@@ -785,7 +786,29 @@ Read \`.bugzy/runtime/memory/event-history.md\` to:
785
786
  - List \`./test-cases/\` for existing tests
786
787
  - Check \`.bugzy/runtime/knowledge-base.md\` for past insights
787
788
 
788
- #### 2.4 Event-Action Reference Patterns
789
+ #### 2.4 Knowledge Base: Drafted vs Real Tests (BYOT)
790
+
791
+ When the project uses an external test repository, maintain two sections in \`.bugzy/runtime/knowledge-base.md\`:
792
+
793
+ **Drafted Tests** (Open PRs \u2014 tests not yet merged):
794
+ \`\`\`markdown
795
+ ### Drafted Tests
796
+ | PR | Branch | Tests Added | Status | Date |
797
+ |----|--------|-------------|--------|------|
798
+ | #12 | bugzy/verify-changes-a1b2c3d4 | login.spec.ts, checkout.spec.ts | Open | 2026-02-13 |
799
+ \`\`\`
800
+
801
+ **Active Tests** (Merged \u2014 tests are part of the test suite):
802
+ \`\`\`markdown
803
+ ### Active Tests
804
+ | File | What it tests | Source PR | Merged |
805
+ |------|---------------|-----------|--------|
806
+ | login.spec.ts | Login flow with valid/invalid credentials | #12 | 2026-02-13 |
807
+ \`\`\`
808
+
809
+ Move entries from Drafted \u2192 Active Tests when PRs are merged. Remove entries when PRs are closed without merge.
810
+
811
+ #### 2.5 Event-Action Reference Patterns
789
812
 
790
813
  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.
791
814
 
@@ -804,6 +827,23 @@ Use these as reference patterns for common events. The webhook routing system al
804
827
  - **QA-relevant content found**: Propose appropriate follow-up tasks (e.g., \`/generate-test-cases\`, \`/verify-changes\`)
805
828
  - **No QA content** (HR meeting, offsite planning, etc.): Skip \u2014 log to event history only
806
829
 
830
+ **External Test Repo Events** (BYOT - events from the customer's external test repository):
831
+ - **PR opened by Bugzy** (\`com.github.external_repo.pull_request\`, \`action: "opened"\`, branch starts with \`bugzy/\`):
832
+ Log to Knowledge Base under "Drafted Tests". No action task needed \u2014 just record the PR number, branch, and what tests were added.
833
+ - **PR review submitted** (\`com.github.external_repo.pull_request_review\`):
834
+ If changes were requested \u2192 queue \`/verify-changes\` with \`{"existingPrBranch": "{head.ref}", "context": "PR review feedback: {review.body}"}\`.
835
+ The execution will iterate on the existing branch, push fixes, and skip PR creation.
836
+ - **PR comment** (\`com.github.external_repo.pull_request_comment\`):
837
+ Read the comment. If it contains actionable feedback, queue \`/verify-changes\`
838
+ with \`{"existingPrBranch": "{issue.pull_request.head.ref}"}\`.
839
+ - **PR merged** (\`com.github.external_repo.pull_request\`, \`action: "closed"\`, \`merged: true\`):
840
+ Update Knowledge Base: move entries from "Drafted Tests" to "Active Tests". Notify team of new test coverage.
841
+ The submodule pointer update happens automatically via the container (\`updateSubmoduleToLatest\`).
842
+ - **PR closed without merge** (\`com.github.external_repo.pull_request\`, \`action: "closed"\`, \`merged: false\`):
843
+ Remove from Knowledge Base "Drafted Tests". Notify team that tests were rejected.
844
+ - **Direct push to main** (\`com.github.external_repo.push\`, ref is main/master):
845
+ Update Knowledge Base if test files were affected. Submodule pointer update is automatic.
846
+
807
847
  **Other Events:**
808
848
  - Analyze for QA relevance based on knowledge base and project context
809
849
  - If action needed, propose appropriate task. If not, log and skip.
@@ -2005,6 +2045,101 @@ Output this JSON as the final result of the task.`
2005
2045
  }
2006
2046
  });
2007
2047
 
2048
+ // src/tasks/library/explore-test-codebase.ts
2049
+ var exploreTestCodebaseTask;
2050
+ var init_explore_test_codebase = __esm({
2051
+ "src/tasks/library/explore-test-codebase.ts"() {
2052
+ "use strict";
2053
+ init_esm_shims();
2054
+ init_constants();
2055
+ exploreTestCodebaseTask = {
2056
+ slug: TASK_SLUGS.EXPLORE_TEST_CODEBASE,
2057
+ name: "Explore Test Codebase",
2058
+ description: "Analyze external test repository to understand framework, coverage, and conventions",
2059
+ frontmatter: {
2060
+ description: "Analyze external test codebase for BYOT onboarding",
2061
+ "argument-hint": "--focus [area]"
2062
+ },
2063
+ steps: [
2064
+ // Step 1: Overview (inline)
2065
+ {
2066
+ inline: true,
2067
+ title: "Explore Test Codebase Overview",
2068
+ 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.`
2069
+ },
2070
+ // Step 2: Security Notice
2071
+ "security-notice",
2072
+ // Step 3: Arguments (inline)
2073
+ {
2074
+ inline: true,
2075
+ title: "Arguments",
2076
+ content: `**Arguments**: $ARGUMENTS
2077
+
2078
+ **Parse:**
2079
+ - **focus**: specific area to analyze (default: comprehensive)`
2080
+ },
2081
+ // Setup
2082
+ "load-project-context",
2083
+ "read-knowledge-base",
2084
+ // Core analysis
2085
+ "analyze-test-codebase",
2086
+ // Generate results parser for normalizing test output
2087
+ "create-results-parser",
2088
+ // Optional: explore the app itself if URL is available
2089
+ {
2090
+ inline: true,
2091
+ title: "App Exploration (Optional)",
2092
+ 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:
2093
+
2094
+ 1. Navigate to the app URL
2095
+ 2. Identify main navigation and key pages
2096
+ 3. Map discovered features to test coverage from the codebase analysis
2097
+ 4. Note any features that appear untested
2098
+
2099
+ This step helps correlate what the tests cover with what the application actually contains. Skip if no app URL is available.`,
2100
+ conditionalOnSubagent: "browser-automation"
2101
+ },
2102
+ // Generate output
2103
+ {
2104
+ inline: true,
2105
+ title: "Commit Analysis Results",
2106
+ content: `Commit all analysis artifacts to the project repository:
2107
+
2108
+ 1. The test codebase analysis report (\`.bugzy/runtime/test-codebase-analysis.md\`)
2109
+ 2. Any generated CLAUDE.md draft (if the external repo was missing one)
2110
+
2111
+ Use a clear commit message: "chore: analyze external test codebase"
2112
+
2113
+ These artifacts will be available to all future task executions for this project.`
2114
+ },
2115
+ // Team Communication (conditional)
2116
+ {
2117
+ inline: true,
2118
+ title: "Team Communication",
2119
+ content: `{{INVOKE_TEAM_COMMUNICATOR}} to notify the team about the test codebase analysis:
2120
+
2121
+ \`\`\`
2122
+ 1. Post a summary of the analysis findings
2123
+ 2. Include key information:
2124
+ - Test framework and runner identified
2125
+ - Number of test files and estimated test cases
2126
+ - Feature areas covered by existing tests
2127
+ - Any gaps or areas without test coverage
2128
+ 3. Ask if the analysis looks accurate
2129
+ 4. Use appropriate channel and threading
2130
+ \`\`\``,
2131
+ conditionalOnSubagent: "team-communicator"
2132
+ },
2133
+ // Maintenance
2134
+ "update-knowledge-base"
2135
+ ],
2136
+ requiredSubagents: ["browser-automation"],
2137
+ optionalSubagents: ["team-communicator"],
2138
+ dependentTasks: []
2139
+ };
2140
+ }
2141
+ });
2142
+
2008
2143
  // src/tasks/index.ts
2009
2144
  var tasks_exports = {};
2010
2145
  __export(tasks_exports, {
@@ -2041,6 +2176,7 @@ var init_tasks = __esm({
2041
2176
  init_onboard_testing();
2042
2177
  init_explore_application();
2043
2178
  init_triage_results();
2179
+ init_explore_test_codebase();
2044
2180
  init_constants();
2045
2181
  TASK_TEMPLATES = {
2046
2182
  [TASK_SLUGS.GENERATE_TEST_CASES]: generateTestCasesTask,
@@ -2051,7 +2187,8 @@ var init_tasks = __esm({
2051
2187
  [TASK_SLUGS.VERIFY_CHANGES]: verifyChangesTask,
2052
2188
  [TASK_SLUGS.ONBOARD_TESTING]: onboardTestingTask,
2053
2189
  [TASK_SLUGS.EXPLORE_APPLICATION]: exploreApplicationTask,
2054
- [TASK_SLUGS.TRIAGE_RESULTS]: triageResultsTask
2190
+ [TASK_SLUGS.TRIAGE_RESULTS]: triageResultsTask,
2191
+ [TASK_SLUGS.EXPLORE_TEST_CODEBASE]: exploreTestCodebaseTask
2055
2192
  };
2056
2193
  }
2057
2194
  });
@@ -5787,6 +5924,90 @@ Requirements clear? \u2192 YES \u2192 Quick Exploration \u2192 Matches? \u2192 Y
5787
5924
  tags: ["exploration", "protocol", "adaptive"]
5788
5925
  };
5789
5926
 
5927
+ // src/tasks/steps/exploration/analyze-test-codebase.ts
5928
+ init_esm_shims();
5929
+ var analyzeTestCodebaseStep = {
5930
+ id: "analyze-test-codebase",
5931
+ title: "Analyze Test Codebase",
5932
+ category: "exploration",
5933
+ content: `## Analyze External Test Codebase
5934
+
5935
+ Thoroughly analyze the customer's external test repository to understand their testing framework, conventions, coverage, and codebase structure.
5936
+
5937
+ ### Step 1: Check for CLAUDE.md
5938
+
5939
+ 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.
5940
+
5941
+ ### Step 2: Scan Directory Structure
5942
+
5943
+ Examine the repository structure to understand organization:
5944
+ - List top-level directories and files
5945
+ - Identify test directories (e.g., \`tests/\`, \`__tests__/\`, \`e2e/\`, \`spec/\`, \`cypress/\`)
5946
+ - Note configuration files (e.g., \`playwright.config.ts\`, \`cypress.config.ts\`, \`jest.config.js\`, \`vitest.config.ts\`)
5947
+ - Check \`package.json\` for test scripts and dependencies
5948
+
5949
+ ### Step 3: Identify Test Framework
5950
+
5951
+ Determine the testing framework from configuration files and dependencies:
5952
+ - **Playwright**: \`playwright.config.ts\`, \`@playwright/test\` in dependencies
5953
+ - **Cypress**: \`cypress.config.ts\`, \`cypress\` in dependencies
5954
+ - **Jest**: \`jest.config.js\`, \`jest\` in dependencies
5955
+ - **Vitest**: \`vitest.config.ts\`, \`vitest\` in dependencies
5956
+ - **Other**: Check for \`mocha\`, \`ava\`, \`tap\`, custom runners
5957
+
5958
+ Note the test runner, assertion library, and any additional tooling (e.g., \`msw\`, \`testing-library\`, page objects).
5959
+
5960
+ ### Step 4: Catalog Test Coverage
5961
+
5962
+ Analyze test files to understand what's being tested:
5963
+ - Read test file names and directory organization
5964
+ - Parse \`describe()\` / \`it()\` / \`test()\` blocks to understand test structure
5965
+ - Group tests by feature area (e.g., authentication, checkout, user management)
5966
+ - Count total test files and approximate number of test cases
5967
+ - Note any skipped or pending tests
5968
+
5969
+ ### Step 5: Document Conventions
5970
+
5971
+ Identify testing patterns and conventions:
5972
+ - **Naming patterns**: How test files are named (e.g., \`*.spec.ts\`, \`*.test.ts\`, \`*.e2e.ts\`)
5973
+ - **Page Objects / Fixtures**: Look for page object patterns, custom fixtures, or helper utilities
5974
+ - **Data management**: How test data is handled (fixtures, factories, seeds)
5975
+ - **Environment configuration**: How environments are configured (.env files, config objects)
5976
+ - **CI integration**: Check for CI config files (GitHub Actions, CircleCI, etc.)
5977
+
5978
+ ### Step 6: Generate Summary
5979
+
5980
+ Create a structured summary of findings and commit it to the project repository:
5981
+
5982
+ \`\`\`
5983
+ File: .bugzy/runtime/test-codebase-analysis.md
5984
+
5985
+ Contents:
5986
+ - Framework: [name and version]
5987
+ - Test runner: [runner]
5988
+ - Total test files: [count]
5989
+ - Estimated test cases: [count]
5990
+ - Feature areas covered: [list]
5991
+ - Key conventions: [summary]
5992
+ - Directory structure: [overview]
5993
+ - Notable patterns: [page objects, fixtures, etc.]
5994
+ \`\`\`
5995
+
5996
+ ### Step 7: Generate CLAUDE.md (if missing)
5997
+
5998
+ If the external test repository does NOT have a \`CLAUDE.md\`, generate a framework-appropriate draft based on the analysis findings:
5999
+ - Include discovered framework and runner
6000
+ - Document build/run commands from package.json
6001
+ - Note key conventions discovered
6002
+ - Include directory structure overview
6003
+ - Save as a draft for customer review
6004
+
6005
+ **Important**: Do NOT use the Playwright-specific template \u2014 generate content based on what was actually discovered in the repository.
6006
+
6007
+ Commit the analysis results to the project repo so they are available for future task executions.`,
6008
+ tags: ["exploration", "byot", "analysis"]
6009
+ };
6010
+
5790
6011
  // src/tasks/steps/clarification/clarification-protocol.ts
5791
6012
  init_esm_shims();
5792
6013
  var clarificationProtocolStep = {
@@ -6990,6 +7211,7 @@ var STEP_LIBRARY = {
6990
7211
  "gather-documentation": gatherDocumentationStep,
6991
7212
  // Exploration
6992
7213
  "exploration-protocol": explorationProtocolStep,
7214
+ "analyze-test-codebase": analyzeTestCodebaseStep,
6993
7215
  // Clarification
6994
7216
  "clarification-protocol": clarificationProtocolStep,
6995
7217
  // Execution