Skip to content

Conversation

@houfu
Copy link
Owner

@houfu houfu commented Oct 23, 2025

Implement command-less CLI invocation to make redlines more agent-friendly. Users can now invoke redlines "source" "test" directly without specifying a command, and it automatically outputs JSON (the most agent-friendly format).

Key Changes

CLI Enhancements

  • Add compare command as the default command using click-default-group
  • Command-less invocation: redlines "source" "test" outputs JSON by default
  • Support --pretty flag for human-readable JSON formatting
  • Smart TTY detection: helpful tip shows only in interactive terminals
  • Maintains backward compatibility with all existing commands (text, json, markdown, stats, guide)

Dependencies

  • Add click-default-group (>=1.2.4) for robust default command handling

Documentation

  • Add comprehensive AGENT_GUIDE.md with:
    • Quick start examples for AI agents and automation
    • Complete JSON schema reference
    • Decision matrix for choosing output formats
    • Performance guidelines and benchmarks
    • Real-world integration examples (CI/CD, pre-commit hooks, batch processing)
    • Error handling patterns
  • Update README.md with:
    • New "For AI Agents & Automation" section
    • Command-less CLI usage examples
    • Reorganized CLI documentation
  • Add Agent Guide URL to project metadata in pyproject.toml

Examples

  • Add examples/ directory with runnable scripts:
    • compare_files.py: Basic file comparison
    • batch_diff.py: Batch processing multiple files
    • ci_check.py: CI/CD integration example
    • generate_report.py: HTML report generation
    • pre_commit_hook.sh: Git pre-commit hook

Tests

  • Add comprehensive test suite for command-less invocation (9 new tests)
  • All 46 CLI tests passing
  • Tests verify JSON output, exit codes, file handling, UTF-8 support

Benefits for AI Agents

  • Simpler invocation: redlines "a" "b" instead of redlines json "a" "b"
  • Structured JSON output by default (parseable, predictable)
  • Clean output when piped (tip message only appears in interactive terminals)
  • Comprehensive guide with copy-paste ready examples

🤖 Generated with Claude Code

…tion guide

Implement command-less CLI invocation to make redlines more agent-friendly.
Users can now invoke `redlines "source" "test"` directly without specifying
a command, and it automatically outputs JSON (the most agent-friendly format).

## Key Changes

### CLI Enhancements
- Add `compare` command as the default command using click-default-group
- Command-less invocation: `redlines "source" "test"` outputs JSON by default
- Support `--pretty` flag for human-readable JSON formatting
- Smart TTY detection: helpful tip shows only in interactive terminals
- Maintains backward compatibility with all existing commands (text, json, markdown, stats, guide)

### Dependencies
- Add click-default-group (>=1.2.4) for robust default command handling

### Documentation
- Add comprehensive AGENT_GUIDE.md with:
  - Quick start examples for AI agents and automation
  - Complete JSON schema reference
  - Decision matrix for choosing output formats
  - Performance guidelines and benchmarks
  - Real-world integration examples (CI/CD, pre-commit hooks, batch processing)
  - Error handling patterns
- Update README.md with:
  - New "For AI Agents & Automation" section
  - Command-less CLI usage examples
  - Reorganized CLI documentation
- Add Agent Guide URL to project metadata in pyproject.toml

### Examples
- Add examples/ directory with runnable scripts:
  - compare_files.py: Basic file comparison
  - batch_diff.py: Batch processing multiple files
  - ci_check.py: CI/CD integration example
  - generate_report.py: HTML report generation
  - pre_commit_hook.sh: Git pre-commit hook

### Tests
- Add comprehensive test suite for command-less invocation (9 new tests)
- All 46 CLI tests passing
- Tests verify JSON output, exit codes, file handling, UTF-8 support

## Benefits for AI Agents

- Simpler invocation: `redlines "a" "b"` instead of `redlines json "a" "b"`
- Structured JSON output by default (parseable, predictable)
- Clean output when piped (tip message only appears in interactive terminals)
- Comprehensive guide with copy-paste ready examples

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@houfu houfu linked an issue Oct 23, 2025 that may be closed by this pull request
8 tasks
Add type ignore comments to cli.command() decorators to fix mypy errors
caused by click-default-group not having type stubs. Also add mypy override
for the click_default_group module in pyproject.toml.

This maintains type safety for the rest of the codebase while allowing
the use of the untyped click-default-group library.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@houfu houfu merged commit b7a9cc3 into main Oct 23, 2025
10 checks passed
@houfu houfu deleted the 59-create-agent-integration-guide-documentation branch October 23, 2025 01:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create Agent Integration Guide documentation

2 participants