From a8c8ff3a23e697d7e03d7529b40c0ca75ff07024 Mon Sep 17 00:00:00 2001 From: Levon Becker Date: Wed, 29 Jul 2026 19:34:59 -0700 Subject: [PATCH] Remove unused repo.log / session-log feature log.py wasn't wired into the /repo slash-command router (only reachable via the bare invoke task), and the feature isn't used. Removes modules/repo/log.py, the repo.log invoke task, create_slug() (only used by log.py), the logs/ gitignore entry, and doc references. Co-Authored-By: Claude Sonnet 5 --- .github/instructions/index.instructions.md | 5 +- .github/instructions/modules.instructions.md | 2 +- .gitignore | 3 -- README.md | 9 ++-- modules/common/README.md | 2 +- modules/common/utils.py | 20 -------- modules/repo/README.md | 3 +- modules/repo/log.py | 52 -------------------- tasks/repo.py | 9 +--- 9 files changed, 10 insertions(+), 95 deletions(-) delete mode 100644 modules/repo/log.py diff --git a/.github/instructions/index.instructions.md b/.github/instructions/index.instructions.md index e564736..5bf0224 100644 --- a/.github/instructions/index.instructions.md +++ b/.github/instructions/index.instructions.md @@ -34,7 +34,7 @@ tests/ test_check_agents.py # Verify .github/prompts/ mirrors are in sync, called by tests.check_agents modules/ common/ # cli.py, properties.py, route_utils.py, utils.py — shared helpers - repo/ # pull.py, push.py, log.py, squash.py, rebase.py, pr_*.py — git/PR workflow modules + repo/ # pull.py, push.py, squash.py, rebase.py, pr_*.py — git/PR workflow modules setup/ # properties.py — creates/stamps properties.yml, called by setup.sh/setup.ps1 template/ # ignore.py, naming.py, pull.py, push.py, resolve.py, route.py, scope.py — sync shared tooling with the parent template repo for /template versioning/ # libs.py, python.py, workflows.py, upgrade.py, project.py — check pyproject.toml deps & workflow action refs vs. latest releases, bump the repo's VERSION file @@ -42,7 +42,7 @@ tasks/ __init__.py # Wires the invoke Collection (debug, repo, ruff, setup, template, tests, upgrade, uv, versioning) plus top-level aliases (fix, test, update) combos.py # Top-level aliases: fix, test, update debug.py # debug.env — print cwd + sorted env vars - repo.py # repo.pull, repo.push, repo.log, repo.squash, repo.rebase, repo.pr_diff, repo.pr_notes_save, repo.pr_create, repo.pr_cleanup + repo.py # repo.pull, repo.push, repo.squash, repo.rebase, repo.pr_diff, repo.pr_notes_save, repo.pr_create, repo.pr_cleanup ruff.py # ruff.fix, ruff.format setup.py # setup.properties — creates/stamps properties.yml template.py # template.pull, template.pull_copy, template.push_diff, template.push_apply, template.push_create_pr @@ -99,7 +99,6 @@ uv run --no-sync invoke test # ruff + pylint + pytest + yamllint + actionlin uv run --no-sync invoke fix # Ruff autocorrect + format uv run --no-sync invoke repo.pull # Pull from git remote (stash → pull --rebase → restore) uv run --no-sync invoke repo.push # Push to git remote (fix → test → commit → push) -uv run --no-sync invoke repo.log # Save a session log to logs/ uv run --no-sync invoke repo.squash # Anchored squash all commits to root + optional force push uv run --no-sync invoke repo.rebase # Rebase onto remote default branch (optionally squash first) uv run --no-sync invoke repo.pr_diff # Print current branch's commit log/diff vs. its base branch diff --git a/.github/instructions/modules.instructions.md b/.github/instructions/modules.instructions.md index b744518..d0bc147 100644 --- a/.github/instructions/modules.instructions.md +++ b/.github/instructions/modules.instructions.md @@ -55,7 +55,7 @@ def main() -> None: | `cli.py` | Click-like `echo`, `prompt`, `confirm`, `is_tty`, `command`/`option` decorators | | `properties.py` | Read `properties.yml` — `get_repo_local()`, `get_repo_remote()`, `get_template_local()`, `get_template_remote()` | | `route_utils.py` | AI-tool command routers (`modules/*/route.py`) — `find_repo_root()` (`properties.yml`-anchored, falls back to `cwd()`, no exception), `build_env()` | -| `utils.py` | `success()`, `error()`, `warning()`, `info()`, `create_slug()` | +| `utils.py` | `success()`, `error()`, `warning()`, `info()` | ## Guidelines - Keep functions focused and single-purpose; extract private helpers instead of writing long functions diff --git a/.gitignore b/.gitignore index 4d8f0b6..3b71899 100644 --- a/.gitignore +++ b/.gitignore @@ -58,9 +58,6 @@ uv.lock.bak .pylint.d/ .mypy_cache/ -# Logs generated by repo:log task -logs/*.md - # Linux **/.directory **/.Trash-* diff --git a/README.md b/README.md index 58c9a72..6e39642 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ Skeleton setup for a repository that uses Python invoke tasks, reusable modules, uv for environment/dependency management, and AI Copilot prompts and instructions. Drop this into any -project to get a consistent git workflow, linting, and session logging out of the box. +project to get a consistent git workflow and linting out of the box. ## Setup ```bash @@ -25,7 +25,7 @@ tests/ test_check_agents.py # Verify .github/prompts/ mirrors are in sync, called by tests.check_agents modules/ common/ # cli.py, properties.py, route_utils.py, utils.py — shared helpers - repo/ # pull.py, push.py, log.py, squash.py, rebase.py, pr_*.py — git/PR workflow modules + repo/ # pull.py, push.py, squash.py, rebase.py, pr_*.py — git/PR workflow modules setup/ # properties.py — creates/stamps properties.yml, called by setup.sh/setup.ps1 template/ # ignore.py, naming.py, pull.py, push.py, resolve.py, route.py, scope.py — sync shared tooling with the parent template repo for /template versioning/ # libs.py, python.py, workflows.py, upgrade.py, project.py — check pyproject.toml deps & workflow action refs vs. latest releases, bump the repo's VERSION file @@ -33,7 +33,7 @@ tasks/ __init__.py # Wires the invoke Collection (debug, repo, ruff, setup, template, tests, upgrade, uv, versioning) plus top-level aliases (fix, test, update) combos.py # Top-level aliases: fix, test, update debug.py # debug.env — print cwd + sorted env vars - repo.py # repo.pull, repo.push, repo.log, repo.squash, repo.rebase, repo.pr_diff, repo.pr_notes_save, repo.pr_create, repo.pr_cleanup + repo.py # repo.pull, repo.push, repo.squash, repo.rebase, repo.pr_diff, repo.pr_notes_save, repo.pr_create, repo.pr_cleanup ruff.py # ruff.fix, ruff.format setup.py # setup.properties — creates/stamps properties.yml template.py # template.pull, template.pull_copy, template.push_diff, template.push_apply, template.push_create_pr @@ -67,7 +67,6 @@ uv run --no-sync invoke fix # Ruff autocorrect + format uv run --no-sync invoke update # Run every version check (libs, python, workflows) — top-level alias for ver.update uv run --no-sync invoke repo.pull # Pull from git remote (stash → pull --rebase → restore) uv run --no-sync invoke repo.push # Push to git remote (fix → test → commit → push) -uv run --no-sync invoke repo.log # Save a session log to logs/ uv run --no-sync invoke repo.squash # Anchored squash all commits to root + optional force push uv run --no-sync invoke repo.rebase # Rebase onto remote default branch (optionally squash first) uv run --no-sync invoke repo.pr_diff # Print current branch's commit log/diff vs. its base branch @@ -119,7 +118,7 @@ uv run --no-sync invoke setup.properties # Create/stamp properties.yml | Module | Purpose | |--------|---------| | [`modules/common/`](modules/common/README.md) | CLI helpers, `properties.yml` config reader, output/utility helpers | -| [`modules/repo/`](modules/repo/README.md) | Git workflow and session logging | +| [`modules/repo/`](modules/repo/README.md) | Git workflow (pull, push, squash, rebase, PR) | | [`modules/setup/`](modules/setup/README.md) | Creates/stamps `properties.yml`, called by `setup.sh`/`setup.ps1` | | [`modules/template/`](modules/template/README.md) | Sync shared, generic tooling with the parent template repo for `/template` | | [`modules/versioning/`](modules/versioning/README.md) | Check `pyproject.toml` deps and workflow action refs vs. latest releases, update locks; bump the repo's `VERSION` file for deploys/releases | diff --git a/modules/common/README.md b/modules/common/README.md index b72d490..8550af8 100644 --- a/modules/common/README.md +++ b/modules/common/README.md @@ -9,7 +9,7 @@ This module provides common functionality that is used by other modules througho ## Files - `utils.py` — console output helpers: `success()`, `error()`, `warning()`, `info()` (✅/❌/⚠️/ℹ️ - prefixed), plus `create_slug()` + prefixed) - `properties.py` — reads `properties.yml`: `get_repo_root()`, `get_repo_local()`, `get_repo_remote()`, `get_template_local()`, `get_template_remote()` - `cli.py` — Click-like CLI compatibility helpers backed by `argparse` (`echo`, `secho`, `prompt`, diff --git a/modules/common/utils.py b/modules/common/utils.py index b16bd51..203a5f4 100644 --- a/modules/common/utils.py +++ b/modules/common/utils.py @@ -1,6 +1,5 @@ """Common utilities for repo automation.""" -import re import sys from typing import NoReturn @@ -24,22 +23,3 @@ def warning(message: str) -> None: def info(message: str) -> None: """Print info message with emoji prefix.""" print(f"📂 {message}") - - -def create_slug(text: str) -> str: - """ - Convert text to a URL/filename-safe slug. - - Lowercases the text, strips characters that are not alphanumeric, hyphens, - or spaces, then collapses whitespace runs into single underscores. - - Args: - text: The input string to slugify. - - Returns: - A lowercase slug with spaces replaced by underscores. - """ - text = text.lower() - text = re.sub(r"[^\w\s-]", "", text) - text = re.sub(r"\s+", "_", text.strip()) - return text diff --git a/modules/repo/README.md b/modules/repo/README.md index 7da6464..3aeed95 100644 --- a/modules/repo/README.md +++ b/modules/repo/README.md @@ -1,6 +1,6 @@ # Repo Module -Git workflow and session-logging logic behind the `repo.*` invoke tasks and their `/push`, +Git workflow logic behind the `repo.*` invoke tasks and their `/push`, `/pull`, `/squash`, `/rebase`, `/pr-notes`, `/pr`, `/pr-cleanup`, and `/repo` slash-command counterparts. Every file exposes a `main()` entry point, runnable standalone via `python -m modules.repo.`. @@ -13,7 +13,6 @@ counterparts. Every file exposes a `main()` entry point, runnable standalone via (`repo.push` / `/push`) - `pr_push.py` — push the current **feature** branch (fix → test → commit → push), for branches that may not have upstream tracking yet; used by `/ship-it` ahead of opening a PR -- `log.py` — save a session log markdown file to `logs/` (`repo.log`) - `squash.py` — anchored squash of every commit down to the root commit, with an auto-generated message and optional force-push (`repo.squash` / `/squash`) - `rebase.py` — rebase onto the remote default branch, optionally squashing first, with stash and diff --git a/modules/repo/log.py b/modules/repo/log.py deleted file mode 100644 index 2c20916..0000000 --- a/modules/repo/log.py +++ /dev/null @@ -1,52 +0,0 @@ -"""Save repository session logs to markdown files.""" - -from __future__ import annotations - -from datetime import datetime - -from ..common import cli as click -from ..common.properties import get_repo_local -from ..common.utils import create_slug, error, success - - -def main(title: str | None = None, content: str | None = None) -> None: - """Save a repository log markdown file in logs/.""" - repo_root = get_repo_local() - logs_dir = repo_root / "logs" - logs_dir.mkdir(parents=True, exist_ok=True) - - if not title: - title = click.prompt("Log title", type=str) - - if not title or not title.strip(): - error("Log title cannot be empty") - - now = datetime.now().astimezone() - log_stamp = now.strftime("%Y%m%d%H%M") - slug = create_slug(title) - filename = f"{log_stamp}_{slug}.md" - - if content and content.strip(): - body = content.strip() - else: - body = ( - "## Summary\n\n" - "[Repo coding work only]\n\n" - "## Code Changes\n\n" - "- [Files/modules updated]\n\n" - "## Validation\n\n" - "- [Tests/lint run and results]\n\n" - "## Notes\n\n" - "[Exclude unrelated chat/topic detours]" - ) - - file_content = f"# {title}\n\nDate: {now.isoformat(timespec='seconds')}\n\n{body}\n" - - log_file = logs_dir / filename - log_file.write_text(file_content) - - success(f"Saved log: logs/{filename}") - - -if __name__ == "__main__": - main() diff --git a/tasks/repo.py b/tasks/repo.py index fe8933b..a1da2bf 100644 --- a/tasks/repo.py +++ b/tasks/repo.py @@ -1,8 +1,7 @@ -"""Git workflow tasks (pull, push, log, squash, rebase, pr).""" +"""Git workflow tasks (pull, push, squash, rebase, pr).""" from invoke import task -from modules.repo import log as log_module from modules.repo import pr_cleanup as pr_cleanup_module from modules.repo import pr_create as pr_create_module from modules.repo import pr_diff as pr_diff_module @@ -25,12 +24,6 @@ def push(_context): push_module.main(no_confirm=True) -@task -def log(_context, title=None, content=None): - """Save a session log to logs/""" - log_module.main(title=title, content=content) - - @task def squash(_context): """Anchored squash of all commits to root with optional force push"""