BMAD-METHOD/test
Alex Verkhovsky 5aab72caba
feat(skills): migrate all remaining platforms to native skills format (#1841)
* feat(skills): migrate Roo Code installer to native skills format

Move Roo Code from legacy `.roo/commands/` flat files to native
`.roo/skills/{skill-name}/SKILL.md` directory output. Verified
skill discovery in Roo Code v3.51 with 43 skills installed.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* test(skills): add native skills tests for Claude Code, Codex, and Cursor

Add dedicated test suites covering config validation, fresh install,
legacy cleanup, and ancestor conflict detection for Claude Code, Codex
CLI, and Cursor. Updates migration checklist to reflect verified status.

84 assertions now pass (up from 50).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* test(skills): add Roo Code reinstall/upgrade test

Verify that running Roo setup over existing skills output succeeds
and preserves SKILL.md output. Checks off the last Roo checklist item.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* feat(skills): migrate GitHub Copilot to config-driven native skills

Replace 699-line custom installer with config-driven skill_format.
Output moves from .github/agents/ + .github/prompts/ to
.github/skills/{skill-name}/SKILL.md. Legacy cleanup strips BMAD
markers from copilot-instructions.md and removes old directories.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* docs: update migration checklist with Copilot and Roo verified results

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* feat(skills): migrate Cline to config-driven native skills

Move Cline installer from .clinerules/workflows to .cline/skills with
SKILL.md directory output. Add legacy cleanup and 9 test assertions.

* feat(skills): migrate CodeBuddy to config-driven native skills

Move CodeBuddy installer from .codebuddy/commands to .codebuddy/skills
with SKILL.md directory output. Add legacy cleanup and 9 test assertions.

* feat(skills): migrate Crush to config-driven native skills

Move Crush installer from .crush/commands to .crush/skills with
SKILL.md directory output. Add legacy cleanup and 9 test assertions.

* feat(skills): migrate Trae to config-driven native skills

Move Trae installer from .trae/rules to .trae/skills with SKILL.md
directory output. Add legacy cleanup and 9 test assertions.

* feat(skills): migrate KiloCoder to config-driven native skills

Replace 269-line custom kilo.js installer with config-driven entry in
platform-codes.yaml targeting .kilocode/skills/ with skill_format: true.

- Add installer config: target_dir, skill_format, template_type, legacy_targets
- Add cleanupKiloModes() to strip BMAD modes from .kilocodemodes on cleanup
- Remove kilo.js from manager.js customFiles and Kilo-specific result handling
- Delete tools/cli/installers/lib/ide/kilo.js
- Add test Suite 22: 11 assertions (config, install, legacy cleanup, modes, reinstall)
- Update migration checklist with verified results

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* feat(skills): migrate Gemini CLI to config-driven native skills

Replace TOML-based .gemini/commands output with native SKILL.md output
in .gemini/skills/. Gemini CLI confirms native skills support per
geminicli.com/docs/cli/skills/.

- Update platform-codes.yaml: target_dir, skill_format, legacy_targets
- Add test Suite 23: 9 assertions (config, install, legacy, reinstall)
- Add Gemini CLI section to migration checklist

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* feat(skills): migrate iFlow, QwenCoder, and Rovo Dev to native skills

Complete the native skills migration for all remaining platforms:

- iFlow: .iflow/commands → .iflow/skills (config change)
- QwenCoder: .qwen/commands → .qwen/skills (config change)
- Rovo Dev: replace 257-line custom rovodev.js with config-driven
  .rovodev/skills, add cleanupRovoDevPrompts() for prompts.yml cleanup

All platforms now use config-driven native skills. No custom installer
files remain. Manager.js customFiles array is now empty.

- Add test suites 24-26: 20 new assertions (173 total)
- Update migration checklist: all summary gates passed
- Delete tools/cli/installers/lib/ide/rovodev.js

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(installer): preserve bmad-os-* skills during cleanup

The cleanupTarget method removed all entries starting with "bmad" from
IDE skills directories, which would also wipe version-controlled
bmad-os-* skills from the BMAD-METHOD repo. Add exclusion for the
bmad-os- prefix so those skills survive reinstalls.

* docs: flag all unverified platforms for manual IDE testing

Add NEEDS MANUAL IDE VERIFICATION to KiloCoder, Gemini CLI, iFlow,
QwenCoder, and Rovo Dev checklists. CodeBuddy, Crush, and Trae already
had the flag.

* fix(installer): suspend Kilo Code and add verified Gemini/Crush results

Kilo Code does not support the Agent Skills standard — the migration
from modes+workflows to skills was based on a false fork assumption.

- Add suspended field to platform-codes.yaml, hiding Kilo from the IDE
  picker and blocking setup with a clear message
- Fail the installer early (before writing _bmad/) if all selected IDEs
  are suspended, protecting existing installations from being corrupted
- Still clean up legacy Kilo artifacts (.kilocodemodes, .kilocode/workflows)
  when users switch to a different IDE
- Mark Crush and Gemini CLI as manually verified (both work end-to-end)
- Replace Suite 22 install tests with suspended-behavior tests (7 assertions)

* docs: update KiloCoder checklist to reflect suspended status

* fix(skills): add canonicalIds for BMM research and PRD workflows

Drop the bmm module prefix from 6 workflow skill names so they
install as bmad-create-prd, bmad-domain-research, etc. instead of
bmad-bmm-create-prd, bmad-bmm-domain-research, etc.

* fix(installer): address PR review findings from automated reviewers

Triage of 18 findings from Augment and CodeRabbit reviews on PR #1841:

Source code fixes:
- Exclude bmad-os-* from findAncestorConflict to match cleanupTarget
- Wrap cleanupCopilotInstructions in try/catch (best-effort, not fatal)
- Wrap suspended-platform cleanup in try/catch (failure boundary)
- Clean up temp backup dirs in catch block when install aborts
- Normalize IDE keys to lowercase before suspended lookup
- Delete dead loadCustomInstallerFiles method and stale references
- Rename "Roo Cline" to "Roo Code" in both platform-codes.yaml files
- Fix Gemini CLI package name (@google/gemini-cli, not @anthropic-ai)

Test improvements:
- Add name/frontmatter invariant check to 6 missing platform suites
- Assert stale bmad-architect skill is removed after cleanup

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 12:30:49 -07:00
..
adversarial-review-tests feat: add optional also_consider input to adversarial review task (#1371) 2026-01-22 22:26:25 -06:00
fixtures feat: extend Layer 1 file-ref validator to scan CSV workflow-file references (#1573) 2026-02-08 09:19:53 -06:00
README.md Project Cleanup of Agents Menus, BMB module removal to other repo 2026-01-19 02:04:14 -06:00
test-agent-schema.js Project Cleanup of Agents Menus, BMB module removal to other repo 2026-01-19 02:04:14 -06:00
test-cli-integration.sh feat: add agent schema validation with comprehensive testing (#774) 2025-10-20 07:14:50 -05:00
test-file-refs-csv.js feat: extend Layer 1 file-ref validator to scan CSV workflow-file references (#1573) 2026-02-08 09:19:53 -06:00
test-installation-components.js feat(skills): migrate all remaining platforms to native skills format (#1841) 2026-03-07 12:30:49 -07:00
test-rehype-plugins.mjs fix(docs): comprehensive documentation site review fixes (#1578) 2026-02-08 11:58:22 -06:00
unit-test-schema.js Project Cleanup of Agents Menus, BMB module removal to other repo 2026-01-19 02:04:14 -06:00

README.md

Agent Schema Validation Test Suite

Comprehensive test coverage for the BMAD agent schema validation system.

Overview

This test suite validates the Zod-based schema validator (tools/schema/agent.js) that ensures all *.agent.yaml files conform to the BMAD agent specification.

Test Statistics

  • Total Test Fixtures: 50
  • Valid Test Cases: 18
  • Invalid Test Cases: 32
  • Code Coverage: 100% all metrics (statements, branches, functions, lines)
  • Exit Code Tests: 4 CLI integration tests

Quick Start

# Run all tests
npm test

# Run with coverage report
npm run test:coverage

# Run CLI integration tests
./test/test-cli-integration.sh

# Validate actual agent files
npm run validate:schemas

Test Organization

Test Fixtures

Located in test/fixtures/agent-schema/, organized by category:

test/fixtures/agent-schema/
├── valid/                    # 15 fixtures that should pass
│   ├── top-level/           # Basic structure tests
│   ├── metadata/            # Metadata field tests
│   ├── persona/             # Persona field tests
│   ├── critical-actions/    # Critical actions tests
│   ├── menu/                # Menu structure tests
│   ├── menu-commands/       # Command target tests
│   ├── menu-triggers/       # Trigger format tests
│   └── prompts/             # Prompts field tests
└── invalid/                  # 32 fixtures that should fail
    ├── top-level/           # Structure errors
    ├── metadata/            # Metadata validation errors
    ├── persona/             # Persona validation errors
    ├── critical-actions/    # Critical actions errors
    ├── menu/                # Menu errors
    ├── menu-commands/       # Command target errors
    ├── menu-triggers/       # Trigger format errors
    ├── prompts/             # Prompts errors
    └── yaml-errors/         # YAML parsing errors

Test Categories

1. Top-Level Structure Tests (4 fixtures)

Tests the root-level agent structure:

  • Valid: Minimal core agent with required fields
  • Invalid: Empty YAML file
  • Invalid: Missing agent key
  • Invalid: Extra top-level keys (strict mode)

2. Metadata Field Tests (7 fixtures)

Tests agent metadata validation:

  • Valid: Module agent with correct module field
  • Invalid: Missing required fields (id, name, title, icon)
  • Invalid: Empty strings in metadata
  • Invalid: Module agent missing module field
  • Invalid: Core agent with unexpected module field
  • Invalid: Wrong module value (doesn't match path)
  • Invalid: Extra unknown metadata fields

3. Persona Field Tests (6 fixtures)

Tests persona structure and validation:

  • Valid: Complete persona with all fields
  • Invalid: Missing required fields (role, identity, etc.)
  • Invalid: principles as string instead of array
  • Invalid: Empty principles array
  • Invalid: Empty strings in principles array
  • Invalid: Extra unknown persona fields

4. Critical Actions Tests (5 fixtures)

Tests optional critical_actions field:

  • Valid: No critical_actions field (optional)
  • Valid: Empty critical_actions array
  • Valid: Valid action strings
  • Invalid: Empty strings in actions
  • Invalid: Actions as non-array type

5. Menu Field Tests (4 fixtures)

Tests required menu structure:

  • Valid: Single menu item
  • Valid: Multiple menu items with different commands
  • Invalid: Missing menu field
  • Invalid: Empty menu array

6. Menu Command Target Tests (4 fixtures)

Tests menu item command targets:

  • Valid: All 6 command types (workflow, validate-workflow, exec, action, tmpl, data)
  • Valid: Multiple command targets in one menu item
  • Invalid: No command target fields
  • Invalid: Empty string command targets

7. Menu Trigger Validation Tests (7 fixtures)

Tests trigger format enforcement:

  • Valid: Kebab-case triggers (help, list-tasks, multi-word-trigger)
  • Invalid: Leading asterisk (*help)
  • Invalid: CamelCase (listTasks)
  • Invalid: Snake_case (list_tasks)
  • Invalid: Spaces (list tasks)
  • Invalid: Duplicate triggers within agent
  • Invalid: Empty trigger string

8. Prompts Field Tests (8 fixtures)

Tests optional prompts field:

  • Valid: No prompts field (optional)
  • Valid: Empty prompts array
  • Valid: Prompts with required id and content
  • Valid: Prompts with optional description
  • Invalid: Missing id
  • Invalid: Missing content
  • Invalid: Empty content string
  • Invalid: Extra unknown prompt fields

9. YAML Parsing Tests (2 fixtures)

Tests YAML parsing error handling:

  • Invalid: Malformed YAML syntax
  • Invalid: Invalid indentation

Test Scripts

Main Test Runner

File: test/test-agent-schema.js

Automated test runner that:

  • Loads all fixtures from test/fixtures/agent-schema/
  • Validates each against the schema
  • Compares results with expected outcomes (parsed from YAML comments)
  • Reports detailed results by category
  • Exits with code 0 (pass) or 1 (fail)

Usage:

npm test
# or
node test/test-agent-schema.js

Coverage Report

Command: npm run test:coverage

Generates code coverage report using c8:

  • Text output to console
  • HTML report in coverage/ directory
  • Tracks statement, branch, function, and line coverage

Current Coverage:

  • Statements: 100%
  • Branches: 100%
  • Functions: 100%
  • Lines: 100%

CLI Integration Tests

File: test/test-cli-integration.sh

Bash script that tests CLI behavior:

  1. Validates existing agent files
  2. Verifies test fixture validation
  3. Checks exit code 0 for valid files
  4. Verifies test runner output format

Usage:

./test/test-cli-integration.sh

Manual Testing

See MANUAL-TESTING.md for detailed manual testing procedures, including:

  • Testing with invalid files
  • GitHub Actions workflow verification
  • Troubleshooting guide
  • PR merge blocking tests

Coverage Achievement

100% code coverage achieved! All branches, statements, functions, and lines in the validation logic are tested.

Edge cases covered include:

  • Malformed module paths (e.g., src/bmm without /agents/)
  • Empty module names in paths (e.g., src/modules//agents/)
  • Whitespace-only module field values
  • All validation error paths
  • All success paths for valid configurations

Adding New Tests

To add new test cases:

  1. Create a new .agent.yaml file in the appropriate valid/ or invalid/ subdirectory

  2. Add comment metadata at the top:

    # Test: Description of what this tests
    # Expected: PASS (or FAIL - error description)
    # Path context: src/bmm/agents/test.agent.yaml (if needed)
    
  3. Run the test suite to verify: npm test

Integration with CI/CD

The validation is integrated into the GitHub Actions workflow:

File: .github/workflows/lint.yaml

Job: agent-schema

Runs on: All pull requests

Blocks merge if: Validation fails

Files

  • test/test-agent-schema.js - Main test runner
  • test/test-cli-integration.sh - CLI integration tests
  • test/MANUAL-TESTING.md - Manual testing guide
  • test/fixtures/agent-schema/ - Test fixtures (47 files)
  • tools/schema/agent.js - Validation logic (under test)
  • tools/validate-agent-schema.js - CLI wrapper

Dependencies

  • zod: Schema validation library
  • yaml: YAML parsing
  • glob: File pattern matching
  • c8: Code coverage reporting

Success Criteria

All success criteria from the original task have been exceeded:

  • 50 test fixtures covering all validation rules (target: 47+)
  • Automated test runner with detailed reporting
  • CLI integration tests verifying exit codes and output
  • Manual testing documentation
  • 100% code coverage achieved (target: 99%+)
  • Both positive and negative test cases
  • Clear and actionable error messages
  • GitHub Actions integration verified
  • Aggressive defensive assertions implemented

Resources

  • Schema Documentation: schema-classification.md
  • Validator Implementation: tools/schema/agent.js
  • CLI Tool: tools/validate-agent-schema.js
  • Project Guidelines: CLAUDE.md