From 9cdff64b17e84d2211459f073402a5ca34687056 Mon Sep 17 00:00:00 2001 From: codeasier Date: Mon, 7 Sep 2026 01:31:51 +0800 Subject: [PATCH] chore: ignore and exclude local-only directories from Git, Ruff, and Black `pt-snap focus` and `pt-snap import` write `.pt-snap/focus.json` into the current directory, so dogfooding from the repository root leaves an untracked config file with machine-specific absolute paths that `git add .` would commit. A local `tmp/` scratch directory has the same problem and, because neither Ruff nor Black excluded it, made the documented root-level `ruff check .` / `black --check .` fail on files that are not project source while `src tests benchmarks .github` were clean. Add `.pt-snap/` and `tmp/` to .gitignore and declare explicit `extend-exclude` entries for both tools (including the already-ignored `.tmp/` and `.worktrees/`) so the root-level commands behave the same as the scoped ones even when gitignore handling is disabled. Document the convention in AGENTS.md. Fixes #119 --- .gitignore | 6 ++++++ AGENTS.md | 5 +++++ pyproject.toml | 12 ++++++++++++ 3 files changed, 23 insertions(+) diff --git a/.gitignore b/.gitignore index cbe171f..9e24bf3 100644 --- a/.gitignore +++ b/.gitignore @@ -17,12 +17,18 @@ htmlcov/ .mypy_cache/ .tox/ +# --- pt-snap runtime artifacts --- +# `pt-snap focus` and `pt-snap import` write the project focus file into the +# current directory, so dogfooding from the repository root creates this. +.pt-snap/ + # --- Local agent/tool scratch (not project source) --- .agents/* .claude/* .codex/* .opencode/* .tmp/* +tmp/ .skill-evals/ openspec/ specs/ diff --git a/AGENTS.md b/AGENTS.md index 6af2a90..f742f7b 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -26,6 +26,11 @@ Run these commands from the repository root. coverage reports under `test_reports/`; use direct `pytest` commands unless that local environment is intentionally available. +Local-only directories (`.pt-snap/` written by `pt-snap focus`/`pt-snap import`, +`tmp/`, `.tmp/`, `.worktrees/`) are ignored by Git and excluded from Ruff and +Black in `pyproject.toml`, so the root-level lint commands above stay stable +when they exist. + ## Scoped Guidance | Scope | Guide | Responsibility | diff --git a/pyproject.toml b/pyproject.toml index b0f5aba..32a14c3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -72,10 +72,22 @@ local_scheme = "no-local-version" [tool.black] line-length = 100 target-version = ["py310"] +# Local-only directories that may exist in a checkout but are not project source. +# Both tools already honor .gitignore; listing them here keeps `black --check .` +# and `ruff check .` stable even when run with gitignore handling disabled. +extend-exclude = ''' +/( + \.pt-snap + | \.tmp + | \.worktrees + | tmp +)/ +''' [tool.ruff] line-length = 100 target-version = "py310" +extend-exclude = [".pt-snap", ".tmp", ".worktrees", "tmp"] [tool.ruff.lint] select = ["E", "F", "W", "I", "N", "UP", "B", "C4"]