---
roadcrew_template_name: "tidy-up.md"
roadcrew_template_type: "command"
execution_mode: "auto-execute"
roadcrew_template_version: "v1.0"
roadcrew_last_updated: "2025-11-03"
roadcrew_min_version: "1.6.0"
roadcrew_license: "See LICENSE file in .roadcrew folder"
roadcrew_copyright: "Copyright (c) 2025 North Star Holdings, LLC"
spdx_license_identifier: "LicenseRef-RoadcrewLicense-1.0"
---

# tidy-up

Clean up repository artifacts and temporary work files while preserving essential project files.

## Overview

The `/tidy-up` command scans your repository root and categorizes temporary files into three buckets:

- **Archive** - Move completed analysis files to `context/archived/{YYYY-MM-DD}/`
- **Delete** - Remove known temporary patterns (PR scripts, temp test files, etc.)
- **Review** - Flag uncertain files for manual inspection

## Quick Start

```bash
# Dry run to preview what would be cleaned (no actual changes)
/tidy-up --dry-run

# Actually clean up the repository
/tidy-up

# Clean up and automatically commit changes
/tidy-up --commit
```

## What Gets Cleaned

**Archived Files:**
- ANALYSIS*.md - Analysis reports
- GAP-ANALYSIS*.md - Gap analysis files
- EPIC-*.md - Epic planning documents
- RELEASE*.md - Release notes

**Deleted Files:**
- PR-*.mjs - Temporary PR scripts
- check-*.ts - Temporary check scripts
- get-issue-*.ts - Temporary GitHub fetch scripts
- fix-*.ts - Temporary fix scripts
- add-*.ts - Temporary add scripts

**Preserved (Never Touched):**
- package.json - Project config
- tsconfig.json - TypeScript config
- jest.config* - Test config
- README.md - Documentation
- CONTRIBUTING.md - Guidelines
- LICENSE* - License files
- .gitignore - Git rules

## Dry Run Example

```bash
/tidy-up --dry-run
```

Output shows:
```
📋 Dry Run Report:
# Tidy-Up Report

**Generated:** 2025-11-03T15:30:00Z

## Summary
- **Files Processed:** 24
- **Archived:** 5
- **Deleted:** 8
- **Reviewed:** 2
- **Preserved:** 9
```

## Actual Cleanup

```bash
/tidy-up
```

This will:
1. Archive analysis files to `context/archived/2025-11-03/analysis/`
2. Delete temporary script files
3. Generate `.tidy-up-report.md` with details
4. Print summary to console

## With Auto-Commit

```bash
/tidy-up --commit
```

Automatically stages changes and commits with message:
```
chore: tidy-up repository (archived 5, deleted 8 files)
```

## Output Report

After cleanup, check `.tidy-up-report.md` for:
- Complete list of archived files (with paths)
- List of deleted files
- Files requiring review
- Preserved files (not touched)
- Execution timestamp

## Use Cases

**After analysis work:**
```bash
/tidy-up --commit
```
Cleans up temp analysis files and commits automatically.

**Before creating release PR:**
```bash
/tidy-up --dry-run
```
Preview cleanup before release to ensure nothing important is removed.

**Regular repository maintenance:**
```bash
/tidy-up
```
Run periodically to keep repo organized.

## Implementation

Calls `scripts/utils/roadcrew/tidy-up.ts` which:
- Scans repository root directory
- Pattern-matches files against configured patterns
- Generates reports for each category
- Creates archive directory structure by date
- Supports dry-run mode for safety

## Related Commands

- `/code-cleanup` - Deep analysis-based cleanup
- `/analyze-repo` - Full repository analysis
- `/update-roadcrew` - Update Roadcrew itself

## Notes

- Always run `--dry-run` first to preview changes
- Archived files are preserved in `context/archived/`
- Use `--commit` to automatically stage and commit
- Check `.tidy-up-report.md` for detailed results
- Customize patterns in `config/tidy-up-patterns.json` (future feature)
