@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/index.cjs CHANGED
@@ -277,6 +277,7 @@ var TASK_SLUGS = {
277
277
  RUN_TESTS: "run-tests",
278
278
  VERIFY_CHANGES: "verify-changes",
279
279
  TRIAGE_RESULTS: "triage-results",
280
+ EXPLORE_TEST_CODEBASE: "explore-test-codebase",
280
281
  /** @deprecated Use ONBOARD_TESTING instead */
281
282
  FULL_TEST_COVERAGE: "onboard-testing"
282
283
  };
@@ -2166,6 +2167,95 @@ Output this JSON as the final result of the task.`
2166
2167
  dependentTasks: []
2167
2168
  };
2168
2169
 
2170
+ // src/tasks/library/explore-test-codebase.ts
2171
+ var exploreTestCodebaseTask = {
2172
+ slug: TASK_SLUGS.EXPLORE_TEST_CODEBASE,
2173
+ name: "Explore Test Codebase",
2174
+ description: "Analyze external test repository to understand framework, coverage, and conventions",
2175
+ frontmatter: {
2176
+ description: "Analyze external test codebase for BYOT onboarding",
2177
+ "argument-hint": "--focus [area]"
2178
+ },
2179
+ steps: [
2180
+ // Step 1: Overview (inline)
2181
+ {
2182
+ inline: true,
2183
+ title: "Explore Test Codebase Overview",
2184
+ 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.`
2185
+ },
2186
+ // Step 2: Security Notice
2187
+ "security-notice",
2188
+ // Step 3: Arguments (inline)
2189
+ {
2190
+ inline: true,
2191
+ title: "Arguments",
2192
+ content: `**Arguments**: $ARGUMENTS
2193
+
2194
+ **Parse:**
2195
+ - **focus**: specific area to analyze (default: comprehensive)`
2196
+ },
2197
+ // Setup
2198
+ "load-project-context",
2199
+ "read-knowledge-base",
2200
+ // Core analysis
2201
+ "analyze-test-codebase",
2202
+ // Generate results parser for normalizing test output
2203
+ "create-results-parser",
2204
+ // Optional: explore the app itself if URL is available
2205
+ {
2206
+ inline: true,
2207
+ title: "App Exploration (Optional)",
2208
+ 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:
2209
+
2210
+ 1. Navigate to the app URL
2211
+ 2. Identify main navigation and key pages
2212
+ 3. Map discovered features to test coverage from the codebase analysis
2213
+ 4. Note any features that appear untested
2214
+
2215
+ This step helps correlate what the tests cover with what the application actually contains. Skip if no app URL is available.`,
2216
+ conditionalOnSubagent: "browser-automation"
2217
+ },
2218
+ // Generate output
2219
+ {
2220
+ inline: true,
2221
+ title: "Commit Analysis Results",
2222
+ content: `Commit analysis artifacts to the **parent project repository** (the workspace root).
2223
+
2224
+ **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.
2225
+
2226
+ **What to commit in the parent repo:**
2227
+ 1. \`git add .bugzy/\` \u2014 the test codebase analysis report and runtime files
2228
+ 2. Do NOT run \`git add .\` or \`git add tests\` \u2014 this would stage the submodule pointer
2229
+ 3. \`git commit -m "chore: analyze external test codebase"\`
2230
+
2231
+ These artifacts will be available to all future task executions for this project.`
2232
+ },
2233
+ // Team Communication (conditional)
2234
+ {
2235
+ inline: true,
2236
+ title: "Team Communication",
2237
+ content: `{{INVOKE_TEAM_COMMUNICATOR}} to notify the team about the test codebase analysis:
2238
+
2239
+ \`\`\`
2240
+ 1. Post a summary of the analysis findings
2241
+ 2. Include key information:
2242
+ - Test framework and runner identified
2243
+ - Number of test files and estimated test cases
2244
+ - Feature areas covered by existing tests
2245
+ - Any gaps or areas without test coverage
2246
+ 3. Ask if the analysis looks accurate
2247
+ 4. Use appropriate channel and threading
2248
+ \`\`\``,
2249
+ conditionalOnSubagent: "team-communicator"
2250
+ },
2251
+ // Maintenance
2252
+ "update-knowledge-base"
2253
+ ],
2254
+ requiredSubagents: ["browser-automation"],
2255
+ optionalSubagents: ["team-communicator"],
2256
+ dependentTasks: []
2257
+ };
2258
+
2169
2259
  // src/tasks/index.ts
2170
2260
  var TASK_TEMPLATES = {
2171
2261
  [TASK_SLUGS.GENERATE_TEST_CASES]: generateTestCasesTask,
@@ -2176,7 +2266,8 @@ var TASK_TEMPLATES = {
2176
2266
  [TASK_SLUGS.VERIFY_CHANGES]: verifyChangesTask,
2177
2267
  [TASK_SLUGS.ONBOARD_TESTING]: onboardTestingTask,
2178
2268
  [TASK_SLUGS.EXPLORE_APPLICATION]: exploreApplicationTask,
2179
- [TASK_SLUGS.TRIAGE_RESULTS]: triageResultsTask
2269
+ [TASK_SLUGS.TRIAGE_RESULTS]: triageResultsTask,
2270
+ [TASK_SLUGS.EXPLORE_TEST_CODEBASE]: exploreTestCodebaseTask
2180
2271
  };
2181
2272
  function getTaskTemplate(slug) {
2182
2273
  return TASK_TEMPLATES[slug];
@@ -5459,6 +5550,89 @@ Requirements clear? \u2192 YES \u2192 Quick Exploration \u2192 Matches? \u2192 Y
5459
5550
  tags: ["exploration", "protocol", "adaptive"]
5460
5551
  };
5461
5552
 
5553
+ // src/tasks/steps/exploration/analyze-test-codebase.ts
5554
+ var analyzeTestCodebaseStep = {
5555
+ id: "analyze-test-codebase",
5556
+ title: "Analyze Test Codebase",
5557
+ category: "exploration",
5558
+ content: `## Analyze External Test Codebase
5559
+
5560
+ Thoroughly analyze the customer's external test repository to understand their testing framework, conventions, coverage, and codebase structure.
5561
+
5562
+ ### Step 1: Check for CLAUDE.md
5563
+
5564
+ 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.
5565
+
5566
+ ### Step 2: Scan Directory Structure
5567
+
5568
+ Examine the repository structure to understand organization:
5569
+ - List top-level directories and files
5570
+ - Identify test directories (e.g., \`tests/\`, \`__tests__/\`, \`e2e/\`, \`spec/\`, \`cypress/\`)
5571
+ - Note configuration files (e.g., \`playwright.config.ts\`, \`cypress.config.ts\`, \`jest.config.js\`, \`vitest.config.ts\`)
5572
+ - Check \`package.json\` for test scripts and dependencies
5573
+
5574
+ ### Step 3: Identify Test Framework
5575
+
5576
+ Determine the testing framework from configuration files and dependencies:
5577
+ - **Playwright**: \`playwright.config.ts\`, \`@playwright/test\` in dependencies
5578
+ - **Cypress**: \`cypress.config.ts\`, \`cypress\` in dependencies
5579
+ - **Jest**: \`jest.config.js\`, \`jest\` in dependencies
5580
+ - **Vitest**: \`vitest.config.ts\`, \`vitest\` in dependencies
5581
+ - **Other**: Check for \`mocha\`, \`ava\`, \`tap\`, custom runners
5582
+
5583
+ Note the test runner, assertion library, and any additional tooling (e.g., \`msw\`, \`testing-library\`, page objects).
5584
+
5585
+ ### Step 4: Catalog Test Coverage
5586
+
5587
+ Analyze test files to understand what's being tested:
5588
+ - Read test file names and directory organization
5589
+ - Parse \`describe()\` / \`it()\` / \`test()\` blocks to understand test structure
5590
+ - Group tests by feature area (e.g., authentication, checkout, user management)
5591
+ - Count total test files and approximate number of test cases
5592
+ - Note any skipped or pending tests
5593
+
5594
+ ### Step 5: Document Conventions
5595
+
5596
+ Identify testing patterns and conventions:
5597
+ - **Naming patterns**: How test files are named (e.g., \`*.spec.ts\`, \`*.test.ts\`, \`*.e2e.ts\`)
5598
+ - **Page Objects / Fixtures**: Look for page object patterns, custom fixtures, or helper utilities
5599
+ - **Data management**: How test data is handled (fixtures, factories, seeds)
5600
+ - **Environment configuration**: How environments are configured (.env files, config objects)
5601
+ - **CI integration**: Check for CI config files (GitHub Actions, CircleCI, etc.)
5602
+
5603
+ ### Step 6: Generate Summary
5604
+
5605
+ Create a structured summary of findings and commit it to the project repository:
5606
+
5607
+ \`\`\`
5608
+ File: .bugzy/runtime/test-codebase-analysis.md
5609
+
5610
+ Contents:
5611
+ - Framework: [name and version]
5612
+ - Test runner: [runner]
5613
+ - Total test files: [count]
5614
+ - Estimated test cases: [count]
5615
+ - Feature areas covered: [list]
5616
+ - Key conventions: [summary]
5617
+ - Directory structure: [overview]
5618
+ - Notable patterns: [page objects, fixtures, etc.]
5619
+ \`\`\`
5620
+
5621
+ ### Step 7: Generate CLAUDE.md (if missing)
5622
+
5623
+ If the external test repository does NOT have a \`CLAUDE.md\`, generate a framework-appropriate draft based on the analysis findings:
5624
+ - Include discovered framework and runner
5625
+ - Document build/run commands from package.json
5626
+ - Note key conventions discovered
5627
+ - Include directory structure overview
5628
+ - Save as a draft for customer review
5629
+
5630
+ **Important**: Do NOT use the Playwright-specific template \u2014 generate content based on what was actually discovered in the repository.
5631
+
5632
+ Commit the analysis results to the project repo so they are available for future task executions.`,
5633
+ tags: ["exploration", "byot", "analysis"]
5634
+ };
5635
+
5462
5636
  // src/tasks/steps/clarification/clarification-protocol.ts
5463
5637
  var clarificationProtocolStep = {
5464
5638
  id: "clarification-protocol",
@@ -6640,6 +6814,7 @@ var STEP_LIBRARY = {
6640
6814
  "gather-documentation": gatherDocumentationStep,
6641
6815
  // Exploration
6642
6816
  "exploration-protocol": explorationProtocolStep,
6817
+ "analyze-test-codebase": analyzeTestCodebaseStep,
6643
6818
  // Clarification
6644
6819
  "clarification-protocol": clarificationProtocolStep,
6645
6820
  // Execution