@bugzy-ai/bugzy 1.18.1 → 1.18.3

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/dist/cli/index.js CHANGED
@@ -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
  };
@@ -2044,6 +2045,103 @@ Output this JSON as the final result of the task.`
2044
2045
  }
2045
2046
  });
2046
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 analysis artifacts to the **parent project repository** (the workspace root).
2107
+
2108
+ **IMPORTANT \u2014 Do NOT stage the \`tests\` submodule.** The \`tests/\` directory is an external git submodule. Any changes made inside it (e.g., \`reporters/parse-results.ts\`, \`tests/CLAUDE.md\`) will be committed and pushed to the external repo automatically by the post-execution handler. Staging the submodule in the parent would record a local-only commit SHA that doesn't exist on the remote, causing a broken reference.
2109
+
2110
+ **What to commit in the parent repo:**
2111
+ 1. \`git add .bugzy/\` \u2014 the test codebase analysis report and runtime files
2112
+ 2. Do NOT run \`git add .\` or \`git add tests\` \u2014 this would stage the submodule pointer
2113
+ 3. \`git commit -m "chore: analyze external test codebase"\`
2114
+
2115
+ These artifacts will be available to all future task executions for this project.`
2116
+ },
2117
+ // Team Communication (conditional)
2118
+ {
2119
+ inline: true,
2120
+ title: "Team Communication",
2121
+ content: `{{INVOKE_TEAM_COMMUNICATOR}} to notify the team about the test codebase analysis:
2122
+
2123
+ \`\`\`
2124
+ 1. Post a summary of the analysis findings
2125
+ 2. Include key information:
2126
+ - Test framework and runner identified
2127
+ - Number of test files and estimated test cases
2128
+ - Feature areas covered by existing tests
2129
+ - Any gaps or areas without test coverage
2130
+ 3. Ask if the analysis looks accurate
2131
+ 4. Use appropriate channel and threading
2132
+ \`\`\``,
2133
+ conditionalOnSubagent: "team-communicator"
2134
+ },
2135
+ // Maintenance
2136
+ "update-knowledge-base"
2137
+ ],
2138
+ requiredSubagents: ["browser-automation"],
2139
+ optionalSubagents: ["team-communicator"],
2140
+ dependentTasks: []
2141
+ };
2142
+ }
2143
+ });
2144
+
2047
2145
  // src/tasks/index.ts
2048
2146
  var tasks_exports = {};
2049
2147
  __export(tasks_exports, {
@@ -2080,6 +2178,7 @@ var init_tasks = __esm({
2080
2178
  init_onboard_testing();
2081
2179
  init_explore_application();
2082
2180
  init_triage_results();
2181
+ init_explore_test_codebase();
2083
2182
  init_constants();
2084
2183
  TASK_TEMPLATES = {
2085
2184
  [TASK_SLUGS.GENERATE_TEST_CASES]: generateTestCasesTask,
@@ -2090,7 +2189,8 @@ var init_tasks = __esm({
2090
2189
  [TASK_SLUGS.VERIFY_CHANGES]: verifyChangesTask,
2091
2190
  [TASK_SLUGS.ONBOARD_TESTING]: onboardTestingTask,
2092
2191
  [TASK_SLUGS.EXPLORE_APPLICATION]: exploreApplicationTask,
2093
- [TASK_SLUGS.TRIAGE_RESULTS]: triageResultsTask
2192
+ [TASK_SLUGS.TRIAGE_RESULTS]: triageResultsTask,
2193
+ [TASK_SLUGS.EXPLORE_TEST_CODEBASE]: exploreTestCodebaseTask
2094
2194
  };
2095
2195
  }
2096
2196
  });
@@ -5826,6 +5926,90 @@ Requirements clear? \u2192 YES \u2192 Quick Exploration \u2192 Matches? \u2192 Y
5826
5926
  tags: ["exploration", "protocol", "adaptive"]
5827
5927
  };
5828
5928
 
5929
+ // src/tasks/steps/exploration/analyze-test-codebase.ts
5930
+ init_esm_shims();
5931
+ var analyzeTestCodebaseStep = {
5932
+ id: "analyze-test-codebase",
5933
+ title: "Analyze Test Codebase",
5934
+ category: "exploration",
5935
+ content: `## Analyze External Test Codebase
5936
+
5937
+ Thoroughly analyze the customer's external test repository to understand their testing framework, conventions, coverage, and codebase structure.
5938
+
5939
+ ### Step 1: Check for CLAUDE.md
5940
+
5941
+ 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.
5942
+
5943
+ ### Step 2: Scan Directory Structure
5944
+
5945
+ Examine the repository structure to understand organization:
5946
+ - List top-level directories and files
5947
+ - Identify test directories (e.g., \`tests/\`, \`__tests__/\`, \`e2e/\`, \`spec/\`, \`cypress/\`)
5948
+ - Note configuration files (e.g., \`playwright.config.ts\`, \`cypress.config.ts\`, \`jest.config.js\`, \`vitest.config.ts\`)
5949
+ - Check \`package.json\` for test scripts and dependencies
5950
+
5951
+ ### Step 3: Identify Test Framework
5952
+
5953
+ Determine the testing framework from configuration files and dependencies:
5954
+ - **Playwright**: \`playwright.config.ts\`, \`@playwright/test\` in dependencies
5955
+ - **Cypress**: \`cypress.config.ts\`, \`cypress\` in dependencies
5956
+ - **Jest**: \`jest.config.js\`, \`jest\` in dependencies
5957
+ - **Vitest**: \`vitest.config.ts\`, \`vitest\` in dependencies
5958
+ - **Other**: Check for \`mocha\`, \`ava\`, \`tap\`, custom runners
5959
+
5960
+ Note the test runner, assertion library, and any additional tooling (e.g., \`msw\`, \`testing-library\`, page objects).
5961
+
5962
+ ### Step 4: Catalog Test Coverage
5963
+
5964
+ Analyze test files to understand what's being tested:
5965
+ - Read test file names and directory organization
5966
+ - Parse \`describe()\` / \`it()\` / \`test()\` blocks to understand test structure
5967
+ - Group tests by feature area (e.g., authentication, checkout, user management)
5968
+ - Count total test files and approximate number of test cases
5969
+ - Note any skipped or pending tests
5970
+
5971
+ ### Step 5: Document Conventions
5972
+
5973
+ Identify testing patterns and conventions:
5974
+ - **Naming patterns**: How test files are named (e.g., \`*.spec.ts\`, \`*.test.ts\`, \`*.e2e.ts\`)
5975
+ - **Page Objects / Fixtures**: Look for page object patterns, custom fixtures, or helper utilities
5976
+ - **Data management**: How test data is handled (fixtures, factories, seeds)
5977
+ - **Environment configuration**: How environments are configured (.env files, config objects)
5978
+ - **CI integration**: Check for CI config files (GitHub Actions, CircleCI, etc.)
5979
+
5980
+ ### Step 6: Generate Summary
5981
+
5982
+ Create a structured summary of findings and commit it to the project repository:
5983
+
5984
+ \`\`\`
5985
+ File: .bugzy/runtime/test-codebase-analysis.md
5986
+
5987
+ Contents:
5988
+ - Framework: [name and version]
5989
+ - Test runner: [runner]
5990
+ - Total test files: [count]
5991
+ - Estimated test cases: [count]
5992
+ - Feature areas covered: [list]
5993
+ - Key conventions: [summary]
5994
+ - Directory structure: [overview]
5995
+ - Notable patterns: [page objects, fixtures, etc.]
5996
+ \`\`\`
5997
+
5998
+ ### Step 7: Generate CLAUDE.md (if missing)
5999
+
6000
+ If the external test repository does NOT have a \`CLAUDE.md\`, generate a framework-appropriate draft based on the analysis findings:
6001
+ - Include discovered framework and runner
6002
+ - Document build/run commands from package.json
6003
+ - Note key conventions discovered
6004
+ - Include directory structure overview
6005
+ - Save as a draft for customer review
6006
+
6007
+ **Important**: Do NOT use the Playwright-specific template \u2014 generate content based on what was actually discovered in the repository.
6008
+
6009
+ Commit the analysis results to the project repo so they are available for future task executions.`,
6010
+ tags: ["exploration", "byot", "analysis"]
6011
+ };
6012
+
5829
6013
  // src/tasks/steps/clarification/clarification-protocol.ts
5830
6014
  init_esm_shims();
5831
6015
  var clarificationProtocolStep = {
@@ -7029,6 +7213,7 @@ var STEP_LIBRARY = {
7029
7213
  "gather-documentation": gatherDocumentationStep,
7030
7214
  // Exploration
7031
7215
  "exploration-protocol": explorationProtocolStep,
7216
+ "analyze-test-codebase": analyzeTestCodebaseStep,
7032
7217
  // Clarification
7033
7218
  "clarification-protocol": clarificationProtocolStep,
7034
7219
  // Execution