Uploaded files
This commit is contained in:
9
scripts/bootstrap.ps1
Normal file
9
scripts/bootstrap.ps1
Normal file
@@ -0,0 +1,9 @@
|
||||
python -m venv .venv
|
||||
.\.venv\Scripts\Activate.ps1
|
||||
|
||||
python -m pip install --upgrade pip
|
||||
python -m pip install -e ".[dev]"
|
||||
|
||||
pre-commit install
|
||||
|
||||
Write-Host "✅ Bootstrapped (.venv created, dev deps installed)"
|
||||
15
scripts/bootstrap.sh
Normal file
15
scripts/bootstrap.sh
Normal file
@@ -0,0 +1,15 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
PY=python
|
||||
command -v python >/dev/null 2>&1 || PY=python3
|
||||
|
||||
$PY -m venv .venv
|
||||
source .venv/bin/activate
|
||||
|
||||
python -m pip install --upgrade pip
|
||||
python -m pip install -e ".[dev]"
|
||||
|
||||
pre-commit install || true
|
||||
|
||||
echo "✅ Bootstrapped (.venv created, dev deps installed)"
|
||||
7
scripts/check.ps1
Normal file
7
scripts/check.ps1
Normal file
@@ -0,0 +1,7 @@
|
||||
.\.venv\Scripts\Activate.ps1
|
||||
|
||||
ruff check .
|
||||
ruff format --check .
|
||||
pytest -q
|
||||
|
||||
Write-Host "✅ Checks passed"
|
||||
10
scripts/check.sh
Normal file
10
scripts/check.sh
Normal file
@@ -0,0 +1,10 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
source .venv/bin/activate
|
||||
|
||||
ruff check .
|
||||
ruff format --check .
|
||||
pytest -q
|
||||
|
||||
echo "✅ Checks passed"
|
||||
86
scripts/contextpack.py
Normal file
86
scripts/contextpack.py
Normal file
@@ -0,0 +1,86 @@
|
||||
#!/usr/bin/env python3
|
||||
from __future__ import annotations
|
||||
|
||||
import subprocess
|
||||
from pathlib import Path
|
||||
from datetime import datetime
|
||||
|
||||
ROOT = Path(".").resolve()
|
||||
OUT = ROOT / ".planning" / "CONTEXTPACK.md"
|
||||
|
||||
IGNORE_DIRS = {
|
||||
".git",
|
||||
".venv",
|
||||
"venv",
|
||||
"__pycache__",
|
||||
".pytest_cache",
|
||||
".ruff_cache",
|
||||
"dist",
|
||||
"build",
|
||||
"node_modules",
|
||||
}
|
||||
|
||||
KEY_FILES = [
|
||||
"CLAUDE.md",
|
||||
"PROJECT.md",
|
||||
"REQUIREMENTS.md",
|
||||
"ROADMAP.md",
|
||||
"STATE.md",
|
||||
"pyproject.toml",
|
||||
".pre-commit-config.yaml",
|
||||
]
|
||||
|
||||
def run(cmd: list[str]) -> str:
|
||||
try:
|
||||
return subprocess.check_output(cmd, cwd=ROOT, stderr=subprocess.STDOUT, text=True).strip()
|
||||
except Exception as e:
|
||||
return f"(failed: {' '.join(cmd)}): {e}"
|
||||
|
||||
def tree(max_depth: int = 3) -> str:
|
||||
lines: list[str] = []
|
||||
|
||||
def walk(path: Path, depth: int) -> None:
|
||||
if depth > max_depth:
|
||||
return
|
||||
for p in sorted(path.iterdir(), key=lambda x: (x.is_file(), x.name.lower())):
|
||||
if p.name in IGNORE_DIRS:
|
||||
continue
|
||||
rel = p.relative_to(ROOT)
|
||||
indent = " " * depth
|
||||
if p.is_dir():
|
||||
lines.append(f"{indent}📁 {rel}/")
|
||||
walk(p, depth + 1)
|
||||
else:
|
||||
lines.append(f"{indent}📄 {rel}")
|
||||
|
||||
walk(ROOT, 0)
|
||||
return "\n".join(lines)
|
||||
|
||||
def head(path: Path, n: int = 160) -> str:
|
||||
try:
|
||||
return "\n".join(path.read_text(encoding="utf-8", errors="replace").splitlines()[:n])
|
||||
except Exception as e:
|
||||
return f"(failed reading {path}): {e}"
|
||||
|
||||
def main() -> None:
|
||||
OUT.parent.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
parts: list[str] = []
|
||||
parts.append("# Context Pack")
|
||||
parts.append(f"_Generated: {datetime.now().isoformat(timespec='seconds')}_\n")
|
||||
|
||||
parts.append("## Repo tree\n```text\n" + tree() + "\n```")
|
||||
parts.append("## Git status\n```text\n" + run(["git", "status"]) + "\n```")
|
||||
parts.append("## Recent commits\n```text\n" + run(["git", "--no-pager", "log", "-10", "--oneline"]) + "\n```")
|
||||
|
||||
parts.append("## Key files (head)")
|
||||
for f in KEY_FILES:
|
||||
p = ROOT / f
|
||||
if p.exists():
|
||||
parts.append(f"### {f}\n```text\n{head(p)}\n```")
|
||||
|
||||
OUT.write_text("\n\n".join(parts) + "\n", encoding="utf-8")
|
||||
print(f"✅ Wrote {OUT.relative_to(ROOT)}")
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user