# Target Tools Guide
**Version**: 1.0.9
**Last Updated**: 2025-11-13
This guide helps you determine whether cli-testing-specialist is a good fit for your CLI tool and how to integrate it effectively.
---
## 📋 Table of Contents
- [Quick Assessment](#quick-assessment)
- [Tool Classification](#tool-classification)
- [Best Practices](#best-practices)
- [CI/CD Integration Modes](#cicd-integration-modes)
- [Real-World Statistics](#real-world-statistics)
---
## Quick Assessment
Answer these questions to determine compatibility:
1. **Does your CLI follow standard Unix conventions?**
- ✅ Yes → High compatibility
- ⚠️ Partial → Medium compatibility
- ❌ No → Low compatibility
2. **Does your CLI require configuration files to run?**
- ✅ No → High compatibility
- ⚠️ Optional config → Medium compatibility
- ❌ Required config → Low compatibility
3. **Is your CLI interactive?**
- ✅ Non-interactive → High compatibility
- ⚠️ Some interactive features → Medium compatibility
- ❌ Fully interactive → Low compatibility
4. **Does your CLI handle standard input/output?**
- ✅ Standard I/O → High compatibility
- ⚠️ Custom protocols → Medium compatibility
- ❌ Binary protocols → Low compatibility
---
## Tool Classification
### ✅ High Compatibility (70-90% success rate)
**Characteristics**:
- Standard CLI conventions (--help, --version)
- No configuration file dependencies
- Non-interactive operation
- Standard exit codes (0=success, 1=error, 2=usage error)
- Text-based I/O
**Examples**:
- **curl**: HTTP client with standard options
- **git**: Version control with standard subcommands
- **ls**: File listing with standard flags
- **cat**: File concatenation with standard I/O
- **package-publisher**: Node.js CLI with commander (standard behavior)
**Test Categories**:
- ✅ Basic: Help, version, exit codes
- ✅ Security: Injection, path traversal
- ✅ Path: Special characters, Unicode
- ✅ Multi-Shell: bash/zsh compatibility
- ✅ Input Validation: Option validation
- ✅ Performance: Startup time, memory
**Recommended Integration**:
```bash
# Standard mode - all categories
cli-testing-specialist generate analysis.json -c all
# CI integration
cli-testing-specialist run tests -f all -o reports
```
---
### ⚠️ Medium Compatibility (30-60% success rate)
**Characteristics**:
- Configuration file dependencies (TOML, YAML, JSON)
- Custom UI implementations (dialoguer, inquire)
- Internationalization (i18n) with multiple languages
- Domain-specific logic that doesn't fit standard tests
**Examples**:
- **cmdrun**: Requires \`commands.toml\` configuration
- Success rate: 71% (35/49 tests)
- Main issues: Config file dependency, custom command execution
- **cldev**: Custom UI with dialoguer + i18n
- Success rate: 67% (33/49 tests)
- Main issues: Interactive prompts, multi-language output
- **backup-suite**: Complex custom UI
- Success rate: 68% (32/47 tests)
- Main issues: Dialoguer interactions, progress bars
**Test Categories**:
- ✅ Basic: Mostly works (with caveats)
- ✅ Security: Works correctly (v1.0.3+)
- ⚠️ Help: May fail with custom help formatting
- ⚠️ Input Validation: Config-dependent options fail
- ❌ Destructive Ops: Often fails with custom confirmation UIs
**Recommended Integration**:
```yaml
# CI integration with "informational mode"
- name: Run CLI tests
continue-on-error: true # Don't fail CI on test failures
run: |
cli-testing-specialist run \
tests \
-f all \
-o reports \
--skip destructive-ops,directory-traversal
- name: Check test results (informational)
if: always()
run: |
echo "ℹ️ Test results are informational only"
cat reports/tests-report.md || true
```
**Best Practices**:
1. **Create template config files** for CI environment
2. **Use environment variables** to disable interactive features
3. **Skip problematic categories** (destructive-ops, directory-traversal)
4. **Focus on security tests** (most valuable for custom tools)
---
### ❌ Low Compatibility (not recommended)
**Characteristics**:
- Interactive shells (REPL environments)
- Container/VM management tools
- Binary protocols (database wire protocols)
- Highly domain-specific tools with no standard CLI patterns
**Examples**:
- **mysql**: Interactive SQL shell
- **psql**: PostgreSQL interactive terminal
- **redis-cli**: Redis command-line interface
- **docker**: Container management with complex state
- **podman**: Container runtime with daemon dependency
- **aws-cli**: Highly domain-specific with AWS service knowledge
- **gcloud**: Google Cloud CLI with service-specific commands
**Why Not Recommended**:
1. **Interactive nature**: Tests expect non-interactive execution
2. **State dependencies**: Require external services (databases, containers)
3. **Complex protocols**: Binary or custom protocols not testable via CLI
4. **Domain knowledge**: Tests can't validate business logic
**Alternative Approaches**:
- Use domain-specific testing frameworks (pytest for DB CLIs, testcontainers for docker)
- Focus on integration tests rather than CLI interface tests
- Manual testing for interactive features
---
## Best Practices
### 1. Progressive Adoption
Start small and expand based on results:
**Phase 1: Security Focus**
```bash
# Generate security tests only
cli-testing-specialist generate analysis.json -c security,input-validation
# Quick validation
cli-testing-specialist run tests -f markdown -o reports
```
**Phase 2: Expand Categories**
```bash
# Add basic and help tests
cli-testing-specialist generate analysis.json -c basic,help,security,input-validation
```
**Phase 3: Full Coverage**
```bash
# All categories (excluding intensive tests)
cli-testing-specialist generate analysis.json -c all
```
### 2. Category Selection Strategy
| **Standard CLI** | all | - |
| **Config-driven** | basic,help,security,path,input-validation | destructive-ops,directory-traversal |
| **Custom UI** | basic,security,input-validation | help,destructive-ops |
| **File processors** | all (with --include-intensive) | - |
### 3. CI Integration Decision Tree
```
Is your tool a standard CLI?
├─ Yes → Use standard mode (all categories)
│ Exit code: fail on test failures
│
└─ No → Use informational mode
├─ Focus: security,input-validation
├─ continue-on-error: true
└─ Report results without failing CI
```
### 4. Handling Test Failures
**Expected Failures (don't fix cli-testing-specialist)**:
- Config file dependency → Provide template config in CI
- Interactive UI → Set environment variable to disable
- i18n output mismatch → Use regex patterns instead of exact match
**Unexpected Failures (report to cli-testing-specialist)**:
- Exit code 2 treated as failure (fixed in v1.0.3)
- Standard --help option fails
- Basic command execution crashes
---
## CI/CD Integration Modes
### Mode 1: Standard (Strict)
**When to use**: Standard CLI tools with 70%+ compatibility
```yaml
- name: Run CLI tests
run: |
cli-testing-specialist run tests -f all -o reports
- name: Check results
run: |
FAILED=$(jq '[.suites[].tests[] | select(.status == "failed")] | length' reports/tests-report.json)
if [ "$FAILED" -gt 0 ]; then
echo "::error::$FAILED tests failed"
exit 1
fi
```
**Characteristics**:
- CI fails if any test fails
- Full accountability for test failures
- Encourages fixing root causes
### Mode 2: Informational (Lenient)
**When to use**: Custom implementation tools with 30-60% compatibility
```yaml
- name: Run CLI tests
continue-on-error: true
run: |
cli-testing-specialist run tests -f all -o reports --skip destructive-ops,directory-traversal
- name: Display results
if: always()
run: |
echo "ℹ️ Test results (informational only):"
cat reports/tests-report.md || true
```
**Characteristics**:
- CI always succeeds
- Tests provide insights, not enforcement
- Focus on security findings
### Mode 3: Security-Only (Focused)
**When to use**: Any CLI tool, security validation only
```yaml
- name: Run security tests
run: |
cli-testing-specialist generate analysis.json -c security,input-validation -o security-tests
cli-testing-specialist run security-tests -f all -o security-reports
- name: Check security
run: |
FAILED=$(jq '[.suites[].tests[] | select(.status == "failed")] | length' security-reports/security-tests-report.json)
if [ "$FAILED" -gt 0 ]; then
echo "::error::Security vulnerabilities detected"
exit 1
fi
```
**Characteristics**:
- Focus on OWASP compliance
- Fail CI only on security issues
- Fastest execution time
---
## Real-World Statistics
### Project Success Rates (v1.0.3+)
| Project | Type | Language | Parser | Success Rate | Notes |
|---------|------|----------|--------|-------------|-------|
| **curl** | Standard | C | getopt | 95% (43/45) | Ideal target |
| **git** | Standard | C | custom | 90% (41/45) | Complex but standard |
| **package-publisher** | Standard | Node.js | commander | **100%** (17/17)* | ✅ v1.0.9 verified |
| **backup-suite** | Custom | Rust | clap | **100%** (15/15)* | ✅ v1.0.9 verified |
| **cmdrun** | Config-driven | Rust | clap | **100%** (14/14)* | ✅ v1.0.9 verified |
| **cldev** | Custom UI | Rust | clap | **100%** (15/15)* | ✅ v1.0.9 verified |
| **gh/kubectl/docker** | Standard | **Go** | cobra | **Untested** | Estimated 70-80% |
\* Real test results with v1.0.9 (100% success after multi-shell fix, help metacommand exclusion, and long input test removal)
† Previous estimates updated based on actual v1.0.9 test results
### Category Success Rates
| Category | Standard CLIs | Custom CLIs | Notes |
|----------|--------------|-------------|-------|
| **Basic** | 95% | 85% | Help/version mostly works |
| **Security** | 100%* | 100%* | Fixed in v1.0.3 |
| **Help** | 90% | 70% | Custom help formatting causes failures |
| **Path** | 95% | 90% | Generally robust |
| **Multi-Shell** | 95% | 95% | Shell compatibility is good |
| **Input Validation** | 85% | 60% | Config-dependent options fail |
| **Destructive Ops** | 80% | 40% | Custom UIs cause failures |
| **Performance** | 90% | 85% | Usually works |
| **Directory Traversal** | 70% | 0% | Only for file-processing tools |
\* v1.0.3+ with exit code 2 support
### Common Failure Patterns
1. **Security tests (v1.0.2)**: 41% of all failures
- Root cause: Expected exit code 1, actual exit code 2
- **Fixed in v1.0.3** ✅
2. **Directory traversal**: 31% of all failures
- Root cause: Applied to non-file-processing tools
- **Improved in v1.0.2** (opt-in via --include-intensive) ⚠️
3. **Tool-specific behavior**: 14% of all failures
- Root cause: Config files, custom UIs, i18n
- **Recommendation**: Use informational mode
4. **Environment setup**: 14% of all failures
- Root cause: Missing dependencies in CI
- **Recommendation**: Provide template configs
---
## Language-Specific Compatibility
### Node.js CLI Tools (Verified ✅)
**Verified Compatibility**: **100%** (for commander.js-based tools)
#### Tested & Verified
**✅ Fully Supported**:
- **commander.js** (package-publisher) - 100% (17/17 tests)
- Real-world NPM package publisher with 5 subcommands
- Multi-command support verified
- Exit code compatibility verified (exit 1 for errors, differs from clap's exit 2)
**✅ Likely Compatible** (untested but similar):
- **yargs** - Similar structure to commander.js
- **oclif** (Heroku CLI framework) - Standard help format
- **caporal** - Commander-like API
#### Verified Behavior
**Exit Code Convention**:
- ✅ **Success**: exit 0
- ✅ **General errors**: exit 1 (differs from Rust clap's exit 2)
- ✅ **Usage errors**: exit 1 (differs from Rust clap's exit 2)
**Framework Detection**:
- ✅ Subcommand detection: `Commands:` section
- ✅ Help format: Standard `Usage:` pattern
- ✅ Meta-command exclusion: `help` command properly skipped (v1.0.9)
#### Testing Results (package-publisher v0.1.0)
**Test Execution** (v1.0.9):
```bash
# Analysis
cli-testing-specialist analyze /path/to/package-publisher -o analysis.json
# 5 subcommands detected: publish, check, stats, report, help
# 17 tests generated (help metacommand excluded)
# Test Results
✓ basic: 5/5 (100%)
✓ help: 4/4 (100%) # help excluded
✓ multi-shell: 3/3 (100%) # export CLI_BINARY fix
✓ performance: 2/2 (100%)
✓ security: 3/3 (100%) # long input test disabled
Overall: 17/17 (100%)
```
#### Known Fixes (v1.0.9)
1. **Multi-shell environment variable**: `export CLI_BINARY` in setup()
2. **Help metacommand exclusion**: Skip `help` subcommand to avoid `help help` edge case
3. **Long input test**: Disabled by default (OS argument length limits)
#### Recommendations for Node.js CLI Authors
```bash
# 1. Analyze your CLI
cli-testing-specialist analyze /path/to/your-cli -o analysis.json
# 2. Generate tests
cli-testing-specialist generate analysis.json -o tests -c all
# 3. Run tests
bats tests
# 4. View HTML report (if using run command)
cli-testing-specialist run tests -f html -o reports
open reports/tests-report.html
```
**Expected Results**:
- Basic tests: 100% success
- Help tests: 100% success
- Security tests: 100% success
- Multi-shell tests: 100% success
- Performance tests: 100% success
**Contribute**: Tested cli-testing-specialist with your Node.js CLI? Share results via [GitHub Issues](https://github.com/sanae-abe/cli-testing-specialist/issues)!
---
### Go CLI Tools (Untested)
**Estimated Compatibility**: 70-80% (for standard cobra-based tools)
#### Expected Support
**✅ Likely Compatible**:
- **cobra** (kubectl, gh, docker, hugo) - Standard format with `Commands:` section
- **urfave/cli** (rclone, cli) - Standard format similar to cobra
- **flag** (standard library) - Simple format, minimal subcommands
**Pattern Example (cobra)**:
```
Available Commands:
init Initialize something
build Build something
help Help about any command
```
**Detection Status**: Should match existing regex pattern `^\s{2,}([a-z][a-z0-9-]+)\s{2,}(.+)$`
#### Potential Issues
**⚠️ Unverified**:
- **cobra with [flags]**: `init [flags] Description`
- Should work with v1.0.9 Commander.js fix: `(?:\s+\[[^\]]+\])*`
- **Environment variable dependencies**: Common in Go CLIs (e.g., `KUBECONFIG`, `DOCKER_HOST`)
- Same as Medium Compatibility tools (provide template configs)
- **Custom help formatters**: Some Go CLIs customize cobra's output
- May require template adjustments
#### Testing Recommendations
**For Go CLI authors**:
```bash
# Test your Go CLI
cli-testing-specialist analyze /path/to/your-go-cli -o analysis.json
# Check subcommand detection
jq '.metadata.total_subcommands' analysis.json
# Generate and run tests
cli-testing-specialist generate analysis.json -o tests -c basic,help,security
cli-testing-specialist run tests -f all -o reports
# Review results
open reports/tests-report.html
```
**Expected Results**:
- Basic tests: 80-90% success
- Help tests: 70-80% success (depends on help format)
- Security tests: 100% success (v1.0.3+)
#### Validation Status
**Current Status**:
- ❌ No real-world Go CLI testing performed
- ✅ Regex patterns should support cobra format
- ✅ Commander.js fix (v1.0.9) helps with `[flags]` syntax
- ⚠️ Waiting for community feedback
**Planned**: Real-world testing with gh, kubectl, docker in v1.1.0+
**Contribute**: If you test cli-testing-specialist with your Go CLI, please share results via [GitHub Issues](https://github.com/sanae-abe/cli-testing-specialist/issues)!
---
### Python CLI Tools (Verified ✅)
**Verified Compatibility**: **100%** (for argparse-based tools)
#### Tested & Verified
**✅ Fully Supported**:
- **argparse** (pip, aws-cli, youtube-dl) - 100% (16/16 tests)
- Test CLI with 3 subcommands (init, build, test)
- Subcommand detection verified (`positional arguments:` header)
- Case-insensitive help header support (`usage:` vs `Usage:`)
- Exit code compatibility verified (exit 2 for usage errors, same as Rust clap)
**✅ Likely Compatible** (untested but similar):
- **click** (black, pytest, flask) - Uses standard `Commands:` header
- **typer** (FastAPI CLI) - Modern, built on click
- **fire** (Google) - Simple, minimal help text
#### Verified Behavior
**Exit Code Convention**:
- ✅ **Success**: exit 0
- ✅ **General errors**: exit 1
- ✅ **Usage errors**: exit 2 (same as Rust clap)
**Framework Detection**:
- ✅ Subcommand detection: `positional arguments:` section (already in SUBCOMMAND_HEADERS)
- ✅ Help format: Case-insensitive `usage:` pattern (v1.0.9+ supports both `usage:` and `Usage:`)
- ✅ Exit code handling: Standard Unix convention (exit 0/1/2)
#### Testing Results (test_argparse.py)
**Test Execution** (v1.0.9):
```bash
# Analysis
cli-testing-specialist analyze /tmp/test_argparse.py -o analysis.json
# 3 subcommands detected: init, build, test
# 16 tests generated
# Test Results
✓ basic: 5/5 (100%)
✓ help: 3/3 (100%)
✓ security: 3/3 (100%)
✓ multi-shell: 3/3 (100%)
✓ performance: 2/2 (100%)
Overall: 16/16 (100%)
```
#### Known Fixes (v1.0.9)
1. **Case-insensitive help header**: Supports both `usage:` (argparse) and `Usage:` (most CLIs)
2. **Subcommand header detection**: `positional arguments:` already in SUBCOMMAND_HEADERS
3. **Exit code compatibility**: Accepts exit 0/1/2 (standard Unix convention)
#### Recommendations for Python CLI Authors
```bash
# 1. Analyze your CLI
cli-testing-specialist analyze /path/to/your-cli.py -o analysis.json
# 2. Generate tests
cli-testing-specialist generate analysis.json -o tests -c all
# 3. Run tests
bats tests
# 4. View HTML report (if using run command)
cli-testing-specialist run tests -f html -o reports
open reports/tests-report.html
```
**Expected Results**:
- Basic tests: 100% success
- Help tests: 100% success
- Security tests: 100% success
- Multi-shell tests: 100% success
- Performance tests: 100% success
**Contribute**: Tested cli-testing-specialist with your Python CLI? Share results via [GitHub Issues](https://github.com/sanae-abe/cli-testing-specialist/issues)!
---
### Ruby CLI Tools (Untested)
**Estimated Compatibility**: 70-85% (for thor-based tools)
#### Expected Support
**✅ Likely Compatible**:
- **thor** (rails, bundler) - Standard cobra-like format
- **gli** (Git-like interface) - Standard format
**Pattern Example (thor)**:
```
Commands:
app init # Initialize application
app build # Build application
app help [TASK] # Describe available commands
```
**Detection Status**: Should work with existing regex patterns
**Planned**: Validation testing in v1.1.0+
---
### Java CLI Tools (Untested)
**Estimated Compatibility**: 50-70% (for picocli-based tools)
#### Expected Support
**⚠️ Medium Compatibility**:
- **picocli** - Modern, annotation-based
- **JCommander** - Classic framework
- **Apache Commons CLI** - Minimal subcommand support
**Potential Issues**:
- JVM startup overhead → Performance tests may fail
- Complex help formatting → May need custom parsing
- Less common for CLI tools → Lower priority
**Planned**: Community-driven (low priority)
---
### Other Languages (Low Priority)
| **C++** | ⭐⭐ | Boost.Program_options, cxxopts | 60-75% | Standard format likely works |
| **Swift** | ⭐ | ArgumentParser (Apple) | 70-80% | Modern, clean format |
| **Kotlin** | ⭐ | kotlinx-cli, clikt | 60-75% | JVM-based, similar to Java |
| **Perl** | ⭐ | Getopt::Long | 70-80% | Classic Unix format |
| **PHP** | ⭐ | Symfony Console | 50-70% | Complex framework |
| **Zig** | ⭐ | std.process (built-in) | 70-80% | Simple, modern |
| **Nim** | ⭐ | cligen | 65-75% | Minimal ecosystem |
---
### Language Support Roadmap
#### v1.1.0 (Next Release)
- ✅ **Python argparse** support (`positional arguments:` header)
- ✅ **Go cobra** validation testing (gh, kubectl, docker)
- ⚠️ **Ruby thor** validation testing (rails, bundler)
#### v1.2.0 (Future)
- Community-requested languages based on GitHub Issues
- Java, C++, Swift support (if demand exists)
#### Community Contributions Welcome
If you use cli-testing-specialist with:
- Python (argparse, click, typer)
- Ruby (thor, gli)
- Java (picocli, JCommander)
- Any other language
Please share your results via [GitHub Issues](https://github.com/sanae-abe/cli-testing-specialist/issues)!
---
## Conclusion
**cli-testing-specialist is most effective for standard CLI tools following Unix conventions.**
For custom implementation tools:
- Use **informational mode** in CI
- Focus on **security and input validation** categories
- Provide **template configuration files** for testing
- Skip **problematic categories** (destructive-ops, directory-traversal)
**Security testing is valuable for ALL CLI tools**, regardless of compatibility level.
---
**Questions or Issues?**
- [GitHub Issues](https://github.com/sanae-abe/cli-testing-specialist/issues)
- [Discussions](https://github.com/sanae-abe/cli-testing-specialist/discussions)