Skip to content

Conversation

@ali90h
Copy link
Owner

@ali90h ali90h commented Sep 15, 2025

🎯 Overview

This PR implements T-022: Report v2 with comprehensive documentation capabilities, adding MANIFEST.json and selective includes for scan results and devcontainer previews.

✨ Features

New Report Command

  • autorepro report - Generate comprehensive report bundles
  • --include scan,init,plan,exec - Selective section inclusion
  • --out - - Stdout preview with schema=v2 marker
  • --exec - Include execution logs in bundle
  • --format md|json - Plan content format selection

MANIFEST.json (Schema v2)

  • Always included in every report bundle
  • Accurate sections array (only included sections)
  • Accurate files array in stable order
  • Schema version 2 for future compatibility

Selective Sections

  • scan: Generates SCAN.json via scan --json integration
  • init: Generates INIT.preview.json without modifying repository
  • plan: Generates repro.md or repro.json based on format
  • env: Generates ENV.txt with environment information
  • exec: Generates run.log and runs.jsonl when --exec is used

πŸ”§ Implementation Details

CLI Integration

  • Added _setup_report_parser() with comprehensive argument parsing
  • Added _dispatch_report_command() for command routing
  • Updated create_parser() and _dispatch_command()

Report Module

  • Implemented cmd_report() main function with full validation
  • Added helper functions for each section type:
    • _generate_scan_json() - Language detection results
    • _generate_init_preview() - Devcontainer preview
    • _generate_exec_logs() - Execution logs
    • _generate_manifest_json() - MANIFEST.json generation
  • Proper error handling and type safety

Backward Compatibility

  • Default sections: plan + env (plus exec when --exec is used)
  • v1 consumers can ignore unknown files
  • Existing functionality preserved

πŸ§ͺ Testing

Manual Test Case (from requirements)

```bash
TMP=$(mktemp -d) && cd "$TMP" && touch pyproject.toml
autorepro report --desc "pytest failing" --include scan,init --out r.zip
python -c "import zipfile, json; z = zipfile.ZipFile('r.zip'); ns = set(z.namelist()); assert 'MANIFEST.json' in ns; m = json.loads(z.read('MANIFEST.json')); assert m['schema_version'] == 2; assert 'SCAN.json' in m['files']; assert 'INIT.preview.json' in m['files']; print('OK_MANIFEST_V2')"
```
Result: βœ… OK_MANIFEST_V2

Test Suite

  • βœ… 9/9 report command tests passing
  • βœ… 7/7 scan command tests passing
  • βœ… 13/13 exec command tests passing
  • βœ… All linting checks passing
  • βœ… All type checks passing

πŸ“‹ Usage Examples

Basic Report

```bash
autorepro report --desc "pytest failing"

Creates repro_bundle.zip with plan + env + MANIFEST.json

```

With Selective Includes

```bash
autorepro report --desc "build issues" --include scan,init --out issue.zip

Creates issue.zip with scan + init + MANIFEST.json

```

Stdout Preview

```bash
autorepro report --desc "test failures" --include scan,init,plan --out -

Outputs:

schema=v2

Report bundle contents:

MANIFEST.json

repro.md

SCAN.json

INIT.preview.json

```

With Execution

```bash
autorepro report --desc "CI tests" --exec --include plan,env,exec

Creates bundle with plan + env + exec logs + MANIFEST.json

```

πŸ“ Files Changed

  • `autorepro/cli.py` - Added report command parser and dispatch
  • `autorepro/report.py` - Implemented report v2 functionality
  • `tests/test_report_cli.py` - Comprehensive test suite

βœ… Acceptance Criteria Met

  • When --include scan is present, SCAN.json is included in the output bundle/ZIP
  • MANIFEST.json is always present and accurately reflects actual contents
  • When --include init is present, INIT.preview.json is included and generated without modifying the repository
  • With --out -, the command prints a stable list of contents and indicates schema=v2
  • Backward compatibility maintained with v1 core artifacts
  • Manual test case passes successfully

πŸ”— Related

Resolves #113

πŸš€ Ready for Review

This implementation provides comprehensive report generation capabilities while maintaining full backward compatibility. The selective includes feature enables flexible documentation bundles for different use cases, from basic reproduction plans to comprehensive CI/issue tracking artifacts.

- Add report command to CLI with --include flag for scan,init,plan,exec
- Generate MANIFEST.json with schema_version 2 and accurate contents
- Support SCAN.json generation via scan --json when scan is included
- Support INIT.preview.json generation without modifying repository
- Add stdout preview with schema=v2 marker for --out -
- Maintain backward compatibility with default plan+env sections
- Add comprehensive test suite for report command functionality

Features:
- --include: Comma-separated sections (scan,init,plan,exec)
- --out -: Stdout preview with file listing
- MANIFEST.json: Always included with accurate file/section lists
- SCAN.json: Generated when scan section included
- INIT.preview.json: Generated when init section included
- Backward compatibility: Default includes plan+env sections

Resolves #113
@ali90h ali90h self-assigned this Sep 15, 2025
@ali90h ali90h merged commit 03a6f27 into main Sep 15, 2025
2 checks passed
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.

T-022: Report v2 (MANIFEST.json + SCAN/INIT snapshots) with selective includes

2 participants