fabro/lib/crates
brynary-fabro[bot] c687c29426 Add safeguards to asset collection and checkpoint commits (#8)
This PR adds safeguards to asset collection and checkpoint commits to
prevent collecting or committing excessive files from large, untracked
directories like Python virtual environments, build outputs, and tool
caches.

Specifically, it introduces a `MAX_FILE_COUNT` limit of 100 files in
`select_files_to_collect()` to cap asset collection regardless of total
size budget, expands the `EXCLUDE_DIRS` list with seven new entries
(`.venv`, `venv`, `.cache`, `.tox`, `.pytest_cache`, `.mypy_cache`,
`dist`) to match common project directory patterns that can contain
thousands of generated files, and makes the constant public for reuse.
Notably, `build` and `env`/`.env` were intentionally omitted as too
generic or potentially conflicting with legitimate project files.

The checkpoint commit logic in `git_checkpoint()` is updated to always
apply the built-in `EXCLUDE_DIRS` as git pathspec excludes (converted to
`**/dirname/**` glob format), merged with any user-configured exclude
globs. This ensures that even with no user configuration, checkpoint
`git add -A` commands won't inadvertently stage virtual environments,
caches, or build artifacts. All changes are covered by new tests
following red/green TDD.

### Fabro Details

<details>
<summary>Ran 7 stages in 10m 34s for $2.41</summary>

| Stage | Duration | Cost | Retries |
|---|---|---|---|
| start | 0s | – | 0 |
| toolchain | 0s | – | 0 |
| preflight_compile | 0s | – | 0 |
| preflight_lint | 0s | – | 0 |
| implement | 0s | $1.21 | 0 |
| simplify | 0s | $1.19 | 0 |
| verify | 0s | – | 0 |
| **Total** | **10m 34s** | **$2.41** | **0** |

</details>

<details>
<summary>Ran <code>ImplementAndSimplify.fabro</code> (10 nodes and 13
edges)</summary>

```dot
digraph ImplementAndSimplify {
    graph [
        goal="Implement and simplify",
        model_stylesheet="
            * { backend: api; model: claude-opus-4-6;}
        "
    ]
    rankdir=LR

    start [shape=Mdiamond, label="Start"]
    exit  [shape=Msquare, label="Exit"]

    toolchain         [label="Toolchain", shape=parallelogram, script="command -v cargo >/dev/null || { curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && sudo ln -sf $HOME/.cargo/bin/* /usr/local/bin/; }; cargo --version 2>&1", max_retries=0]
    preflight_compile [label="Preflight Compile", shape=parallelogram, script="cargo check 2>&1", max_retries=0]
    preflight_lint    [label="Preflight Lint", shape=parallelogram, script="cargo clippy -- -D warnings 2>&1", max_retries=0]
    fix_lints         [label="Fix Lints", prompt="The preflight lint step failed. Read the build output from context and fix all clippy lint warnings.", max_visits=3]
    implement         [label="Implement", prompt="Read the plan file referenced in the goal and implement every step. Make all the code changes described in the plan."]
    simplify          [label="Simplify", prompt="@prompts/simplify.md"]
    verify            [label="Verify", shape=parallelogram, script="cargo clippy -- -D warnings 2>&1 && cargo test 2>&1", goal_gate=true, retry_target="fixup"]
    fixup             [label="Fixup", prompt="The verify step failed. Read the build output from context and fix all clippy lint warnings and test failures.", max_visits=3]

    start -> toolchain
    toolchain -> preflight_compile [condition="outcome=success"]
    toolchain -> exit
    preflight_compile -> preflight_lint [condition="outcome=success"]
    preflight_compile -> exit
    preflight_lint -> implement [condition="outcome=success"]
    preflight_lint -> fix_lints
    fix_lints -> preflight_lint
    implement -> simplify -> verify
    verify -> exit  [condition="outcome=success"]
    verify -> fixup
    fixup -> verify
}

```

</details>

⚒️ Generated with [Fabro](https://fabro.sh)

---------

Co-authored-by: Fabro <noreply@fabro.sh>
2026-03-15 19:54:17 -04:00
..
fabro-agent rename project_docs module to memory 2026-03-13 10:02:11 -04:00
fabro-api Inject GitHub App IAT into Sandbox as GITHUB_TOKEN (#7) 2026-03-15 18:24:30 -04:00
fabro-beastie Fix fabro-beastie linker error by linking IOKit framework 2026-03-15 18:27:42 -04:00
fabro-cli Plan: Add prevent_idle_sleep to fabro via fabro-beastie (#5) 2026-03-15 17:41:20 -04:00
fabro-config Plan: Add prevent_idle_sleep to fabro via fabro-beastie (#5) 2026-03-15 17:41:20 -04:00
fabro-db rename Arc to Fabro in all Rust crates, symbols, env vars, and supporting files 2026-03-12 12:25:58 -04:00
fabro-devcontainer rename Arc to Fabro in all Rust crates, symbols, env vars, and supporting files 2026-03-12 12:25:58 -04:00
fabro-exe Rename Arc to Fabro in user-facing strings, comments, and tests 2026-03-13 20:43:21 -04:00
fabro-git-storage Add fabro rewind command to rewind workflow runs to earlier checkpoints 2026-03-14 11:38:17 -04:00
fabro-github Inject GitHub App IAT into Sandbox as GITHUB_TOKEN (#7) 2026-03-15 18:24:30 -04:00
fabro-linear rename Arc to Fabro in all Rust crates, symbols, env vars, and supporting files 2026-03-12 12:25:58 -04:00
fabro-llm Adopt cli-table for ANSI-aware table rendering and fix fabro ps bugs 2026-03-15 17:27:10 -04:00
fabro-mcp rename Arc to Fabro in all Rust crates, symbols, env vars, and supporting files 2026-03-12 12:25:58 -04:00
fabro-openai-oauth rename Arc to Fabro in all Rust crates, symbols, env vars, and supporting files 2026-03-12 12:25:58 -04:00
fabro-slack rename Arc to Fabro in all Rust crates, symbols, env vars, and supporting files 2026-03-12 12:25:58 -04:00
fabro-sprites rename Arc to Fabro in all Rust crates, symbols, env vars, and supporting files 2026-03-12 12:25:58 -04:00
fabro-ssh Rename Arc to Fabro in user-facing strings, comments, and tests 2026-03-13 20:43:21 -04:00
fabro-tracker rename Arc to Fabro in all Rust crates, symbols, env vars, and supporting files 2026-03-12 12:25:58 -04:00
fabro-types rename Arc to Fabro in all Rust crates, symbols, env vars, and supporting files 2026-03-12 12:25:58 -04:00
fabro-util Fix --goal-file not expanding ~ to home directory 2026-03-15 14:57:38 -04:00
fabro-workflows Add safeguards to asset collection and checkpoint commits (#8) 2026-03-15 19:54:17 -04:00