This directory contains the test suite for Intent v2.6.0. The tests are written using Bats (Bash Automated Testing System).
tests/
├── unit/ # Unit tests for individual commands
│ ├── agent_commands.bats # AGENTS.md management tests
│ ├── audit_commands.bats # Audit command tests
│ ├── basic.bats # Basic infrastructure tests
│ ├── learn_commands.bats # Learn command tests
│ ├── modules_commands.bats # Modules command tests
│ ├── bootstrap.bats # Bootstrap command tests
│ ├── config.bats # Configuration and PROJECT_ROOT tests
│ ├── fileindex_commands.bats # Fileindex command tests
│ ├── global_commands.bats # Tests for global commands
│ ├── help_commands.bats # Help system tests
│ ├── init_commands.bats # Init command tests
│ ├── project_commands.bats # Tests for project-specific commands
│ ├── skills_commands.bats # Skills management command tests
│ ├── st_commands.bats # Steel thread command tests
│ ├── st_zero_commands.bats # ST Zero retrofit command tests
│ ├── test_autopsy.bats # Autopsy skill + directory install tests
│ ├── test_diogenes.bats # Diogenes subagent + testing skill tests
│ └── treeindex_commands.bats # Treeindex command tests
├── integration/ # Integration tests
│ └── end_to_end.bats # Full workflow tests
├── fixtures/ # Test fixtures (sample files, etc.)
├── lib/ # Test libraries
│ └── test_helper.bash # Common test functions
├── run_tests.sh # Main test runner
└── README.md # This file
Install Bats:
# macOS with Homebrew
brew install bats-core
# Or from source
git clone https://github.com/bats-core/bats-core.git
cd bats-core
./install.sh /usr/local./tests/run_tests.sh./tests/run_tests.sh tests/unit/global_commands.bats./tests/run_tests.sh tests/unit/./tests/run_tests.sh tests/integration/#!/usr/bin/env bats
load "../lib/test_helper.bash"
@test "description of what you're testing" {
# Setup
project_dir=$(create_test_project "Test Project")
cd "$project_dir"
# Run command
run run_intent <command> <args>
# Assert results
assert_success # or assert_failure
assert_output_contains "expected text"
}create_test_project "name"- Creates a test Intent projectrun_intent <args>- Runs the intent commandassert_success- Asserts command succeeded (exit 0)assert_failure- Asserts command failed (exit non-zero)assert_output_contains "text"- Checks if output contains textassert_file_exists "path"- Checks if file existsassert_directory_exists "path"- Checks if directory existsassert_file_contains "file" "text"- Checks if file contains text
Unit tests focus on individual commands and features:
- agent_commands.bats - Tests for AGENTS.md management (
intent agents init/generate/sync/validate) - audit_commands.bats - Tests for the audit command (
intent audit quick,intent audit health) - basic.bats - Tests for basic infrastructure and environment setup
- learn_commands.bats - Tests for the learn command (
intent learn) - modules_commands.bats - Tests for the modules command (
intent modules check,intent modules find) - bootstrap.bats - Tests for the bootstrap command
- config.bats - Tests configuration loading and PROJECT_ROOT detection
- fileindex_commands.bats - Tests for the fileindex command (file tracking and checkbox states)
- global_commands.bats - Tests commands that work without a project (help, doctor, info, etc.)
- help_commands.bats - Tests for the help system
- init_commands.bats - Tests for the init command
- project_commands.bats - Tests commands that require a project context
- st_commands.bats - Tests for steel thread management commands
- st_zero_commands.bats - Tests for ST Zero retrofit command (
intent st zero install) - skills_commands.bats - Tests for skills management (
intent claude skills install/list/sync/uninstall/show) - test_diogenes.bats - Tests for Diogenes subagent and in-elixir-testing skill (install/list/sync/show/uninstall)
- treeindex_commands.bats - Tests for the treeindex command (directory summaries)
Integration tests verify complete workflows:
- end_to_end.bats - Tests full user workflows like creating a project and managing steel threads
-
Global vs Project Commands
- Global commands work anywhere
- Project commands show helpful error outside projects
-
Configuration
- PROJECT_ROOT detected from subdirectories
- Config files loaded correctly
- Legacy projects detected
-
Error Handling
- No silent failures
- Clear error messages
- Helpful suggestions
-
Migration
- Backup directories use
.backup_*prefix - Version fields use
intent_version - Legacy projects can be upgraded
- Backup directories use
To see more output when debugging:
# Run with verbose output
bats -v tests/unit/config.bats
# Run with tap output
bats -t tests/unit/config.batsTests run automatically via GitHub Actions on:
- Every push to
main - Every pull request targeting
main - Both Ubuntu and macOS environments
See .github/workflows/tests.yml for the CI configuration.