Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/daily-file-diet.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ gh aw compile

The Daily File Diet workflow runs on weekdays and:

1. **Scans Source Files** - Finds all non-test source files in your repository, excluding generated directories like `node_modules`, `vendor`, `dist`, and `target`
1. **Scans Source Files** - Finds all tracked non-test source files in your repository using `git ls-tree`, which automatically respects `.gitignore` and avoids scanning generated directories like `node_modules`, `vendor`, `dist`, and `target`
2. **Identifies Oversized Files** - Detects files exceeding 500 lines (the healthy size threshold)
3. **Analyzes Structure** - Examines what the file contains: functions, classes, modules, and their relationships
4. **Creates Refactoring Issues** - Proposes concrete split strategies with specific file names, responsibilities, and implementation guidance
Expand Down Expand Up @@ -80,7 +80,7 @@ gh aw edit daily-file-diet

Common customizations:
- **Adjust the threshold** - Change the 500-line limit to suit your team's preferences
- **Focus on specific languages** - Restrict `find` commands to your repository's primary language
- **Focus on specific languages** - Restrict the `grep` pattern in the `git ls-tree` pipeline to your repository's primary language
- **Add labels** - Apply team-specific labels to generated issues
- **Change the schedule** - Run less frequently if your codebase changes slowly

Expand Down
28 changes: 10 additions & 18 deletions workflows/daily-file-diet.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,13 @@ tools:
github:
toolsets: [default]
bash:
- "find . -type f -not -path '*/.git/*' -not -path '*/node_modules/*' -not -path '*/vendor/*' -not -path '*/dist/*' -not -path '*/build/*' -not -path '*/.next/*' -not -path '*/target/*' -not -path '*/__pycache__/*' -not -path '*/coverage/*' -not -path '*/venv/*' -not -path '*/.tox/*' -not -path '*/.mypy_cache/*' -name '*' -exec wc -l {} \\; 2>/dev/null"
- "git ls-tree -r --name-only HEAD"
- "git ls-tree -r -l --full-name HEAD"
- "git ls-tree -r --name-only HEAD | grep -E * | grep -vE * | xargs wc -l 2>/dev/null"
- "git ls-tree -r --name-only HEAD | grep -E * | xargs wc -l 2>/dev/null"
- "wc -l *"
- "head -n * *"
- "grep -n * *"
- "find . -type f -name '*.go' -not -path '*_test.go' -not -path '*/vendor/*'"
- "find . -type f -name '*.py' -not -path '*/__pycache__/*' -not -path '*/venv/*'"
- "find . -type f -name '*.ts' -not -path '*/node_modules/*' -not -path '*/dist/*'"
- "find . -type f -name '*.js' -not -path '*/node_modules/*' -not -path '*/dist/*'"
- "find . -type f -name '*.rb' -not -path '*/vendor/*'"
- "find . -type f -name '*.java' -not -path '*/target/*'"
- "find . -type f -name '*.rs' -not -path '*/target/*'"
- "find . -type f -name '*.cs'"
- "find . -type f \\( -name '*.go' -o -name '*.py' -o -name '*.ts' -o -name '*.js' -o -name '*.rb' -o -name '*.java' -o -name '*.rs' -o -name '*.cs' -o -name '*.cpp' -o -name '*.c' \\) -not -path '*/node_modules/*' -not -path '*/vendor/*' -not -path '*/dist/*' -not -path '*/build/*' -not -path '*/target/*' -not -path '*/__pycache__/*' -exec wc -l {} \\; 2>/dev/null"
- "sort *"
- "cat *"

Expand Down Expand Up @@ -67,14 +61,12 @@ First, determine the primary programming language(s) used in this repository. Th

**For polyglot or unknown repos:**
```bash
find . -type f \( -name "*.go" -o -name "*.py" -o -name "*.ts" -o -name "*.js" -o -name "*.rb" -o -name "*.java" -o -name "*.rs" -o -name "*.cs" -o -name "*.cpp" -o -name "*.c" \) \
-not -path "*/node_modules/*" \
-not -path "*/vendor/*" \
-not -path "*/dist/*" \
-not -path "*/build/*" \
-not -path "*/target/*" \
-not -path "*/__pycache__/*" \
-exec wc -l {} \; 2>/dev/null | sort -rn | head -20
git ls-tree -r --name-only HEAD \
| grep -E '\.(go|py|ts|tsx|js|jsx|rb|java|rs|cs|cpp|c|h|hpp)$' \
| grep -vE '(_test\.go|\.test\.(ts|js)|\.spec\.(ts|js)|test_[^/]*\.py|[^/]*_test\.py)$' \
| xargs wc -l 2>/dev/null \
| sort -rn \
| head -20
```

Also skip test files (files ending in `_test.go`, `.test.ts`, `.spec.ts`, `.test.js`, `.spec.js`, `_test.py`, `test_*.py`, etc.) — focus on non-test production code.
Expand Down
Loading