diff --git a/archive/README.md b/archive/README.md index 695ea6c..ffb7312 100644 --- a/archive/README.md +++ b/archive/README.md @@ -2,5 +2,6 @@ Archived skills, extensions, and agent personas preserved for historical reference or future independent development. These are not active dependencies of the core skills ecosystem. +- **`skills/git-commit`**: Deprecated and consolidated into `skills/git-manager` (with working-branch commit autonomy governed by `profile/AGENTS.md`). - **`extensions/commit-logger`**: Deprecated in favor of Git history, Conventional Commits, and Gitea issues/PRs. - **`agents/anne-droid.md`**: Persona workflows archived during skills ecosystem redesign. diff --git a/skills/git-commit/SKILL.md b/archive/skills/git-commit/SKILL.md similarity index 100% rename from skills/git-commit/SKILL.md rename to archive/skills/git-commit/SKILL.md diff --git a/skills/git-manager/SKILL.md b/skills/git-manager/SKILL.md new file mode 100644 index 0000000..9d57b96 --- /dev/null +++ b/skills/git-manager/SKILL.md @@ -0,0 +1,65 @@ +--- +name: git-manager +description: >- + Manage Git repository hygiene, branches, worktrees, incremental Conventional Commits, + history integration (rebase, squash, cherry-pick, merge), conflict stops, and + evidence-first reflog recovery. Use when creating branches or worktrees, committing + completed task checkpoints, integrating branches, or recovering lost commits. Not for + pull request lifecycle: use gitea-pr. Not for diff code inspection: use code-review. +--- + +# Git Manager + +## Use when +- Creating dedicated branches or isolated worktrees before making edits. +- Recording clean, atomic Conventional Commits as coherent tasks finish, or slicing a dirty tree. +- Integrating branches (rebase, squash, merge, cherry-pick) or stopping cleanly on conflicts. +- Recovering lost commits, dangling refs, or broken working-tree state via reflog. +- Not for pull request creation or review threads: use `gitea-pr`. +- Not for multi-axis static diff evaluation: use `code-review`. + +## Steps +1. **Inspect repository state.** Resolve repository root (`git rev-parse --show-toplevel`), active + branch, upstream tracking, working-tree status (`git status --short`), repo `AGENTS.md` + conventions, and `git log -n 5 --oneline`. Run all commands from the target repository root; + trust the diff over conversation claims. +2. **Branch and worktree isolation.** Enforce branch-before-edits (`git switch -c `). For + parallel slices or spikes without disturbing the current working tree, manage isolated worktrees + per [references/worktrees.md](references/worktrees.md). Never remove a worktree containing + uncommitted or unmerged work without explicit confirmation. +3. **Incremental checkpoint commits.** Group coherent, independently revertible slices and format + messages per [references/commits.md](references/commits.md). Enforce the pre-commit gate: right + repo, explicit file or hunk staging (never blind `git add -A` over unrelated or scratch files), + relevant checks passing, zero secrets, and message faithful to the diff. Follow `profile/AGENTS.md`: + - **`delivery` mode on a non-default working branch**: commit each verified unit immediately + without pausing for approval, unless an exception applies (`main`/`master`, failing checks, + or unfamiliar working-tree edits). + - **`learning` mode**: list diff facts, ask 0-2 questions, and pause so the user writes the + commit message per `profile/learning-contract.md`. In `/practice`, let the user run the commands. +4. **Integration and history editing.** Rebase local unshared branches, squash noisy fixups, merge, + or cherry-pick per [references/history-editing.md](references/history-editing.md). On any + conflict: stop immediately, report conflicting files and hunks in prose, never guess resolution, + and offer clean `--abort`. +5. **Evidence-first recovery.** For lost commits, detached `HEAD`, or botched history edits, inspect + `git reflog` and `git fsck` before acting and restore into `recovery/` per + [references/recovery.md](references/recovery.md). Never run speculative `--hard` resets. +6. **Verify post-operation state.** Confirm branch ref, new commit SHA (`git log -n 3 --oneline`), + and remaining working-tree status (`git status --short`). + +## Your call +- **Direct `main`/`master` commits or ambiguous dirty trees**: approve any commit on `main`/`master` + or choose how to slice unfamiliar pre-existing working-tree edits. +- **`learning` mode commit reasoning**: write the commit message and rationale per `learning-contract.md`. +- **Integration strategy and exceptions**: choose rebase vs. merge when non-obvious, and adjudicate + conflicts, reverts, or non-trivial cherry-picks. +- **Destructive operations**: explicitly confirm with impact described first per `profile/AGENTS.md` + before `git reset --hard`, `git restore `, `git clean -fd`, force-push, or dirty worktree removal. + +## Done when +- Target branch, worktree, checkpoint commit, integration, or recovery branch is verified by SHA + and `git status --short` reflects expected leftover state. + +## Hands off to +- `code-review`: when a branch or commit range is ready for multi-axis static diff review. +- `gitea-pr`: when verified commits are pushed and ready for pull request creation or update. +- `document`: when a commit or recovery surfaces a decision or insight worth recording separately. diff --git a/skills/git-manager/references/commits.md b/skills/git-manager/references/commits.md new file mode 100644 index 0000000..3b38960 --- /dev/null +++ b/skills/git-manager/references/commits.md @@ -0,0 +1,47 @@ +# Incremental Checkpoint Commits + +Reference for `git-manager`. Conventions for slicing changes, formatting Conventional Commits, enforcing pre-commit hygiene, and applying session-mode commit rules. + +## 1. Slice Boundaries +- One slice equals one coherent change that can be understood, reviewed, or reverted on its own (for example: contract or schema first, test + minimal fix, documentation update separately when distinct). +- Commit incrementally as each task or sub-task passes its relevant checks. Do not hoard multiple completed tasks in an uncommitted working tree. +- Order slices so every commit builds cleanly on the preceding commit. +- Flag and exclude accidental additions: scratch scripts, `.env` files, build artifacts, debug logs, or unrelated formatting churn. + +## 2. Staging Discipline +- Stage explicit paths (`git add `) or specific hunks (`git add -p`). +- Never run a blind `git add -A` or `git add .` when untracked files, local worktrees, or unrelated edits exist in the repository. +- Inspect `git diff --cached --stat` and `git diff --cached` before committing to confirm that staged content matches the intended slice and nothing else. + +## 3. Message Conventions and Depth Matching +- Use the repository's `AGENTS.md` commit types and scopes when defined; otherwise use Conventional Commits (`feat`, `fix`, `refactor`, `docs`, `test`, `build`, `ci`, `chore`, `perf`, `security`). +- Match message depth to change significance: + - **Trivial or mechanical**: concise imperative subject line only (`<= 72` characters). + - **Multi-part slice**: subject line + concise bullet list of concrete behavioral changes. + - **Non-obvious constraint or trade-off**: subject line + bullets + `Rationale:` line explaining why this approach was chosen over alternatives. +- Link issues (`Closes #` or `Refs #`) only when the commit or branch genuinely satisfies those criteria. +- Trust the staged diff over conversation claims; never overclaim untested behavior. + +## 4. Deterministic Pre-Commit Gate +Verify all four checks before creating any commit: +1. **Repository and branch**: `git rev-parse --show-toplevel` matches the target repository and active branch matches intent. +2. **Scoped index**: `git diff --cached` contains only this slice. +3. **Verification**: relevant tests, linters, or builds for the touched surface have run and passed. +4. **Secret scan**: zero tokens, keys, passwords, or private connection strings appear in `git diff --cached`. + +## 5. Session Modes and Exception Stops + +- **`delivery` mode on a non-default working branch**: + Once the pre-commit gate passes and none of the exception stops below apply, execute `git commit`, verify `git log -1 --oneline` and `git status --short`, and continue working without pausing for approval. + +- **Exception stops (always pause for human decision per `profile/AGENTS.md`)**: + 1. Active branch is `main`, `master`, or detached `HEAD`. + 2. Relevant checks failed and cannot be resolved within current task scope (never silently waive failing checks). + 3. Working tree contains unfamiliar modifications or ambiguous untracked files not produced by the current task; present 2-3 slicing options (recommended first) exposing files and consequences. + 4. Operation involves `git revert`, cross-branch `cherry-pick` adaptation, or rewriting shared history. + +- **`learning` mode (`profile/learning-contract.md`)**: + For each slice, state the facts (files, behavior changed, checks present or missing, risks) and ask 0-2 questions drawn from the diff. Pause so the user writes the commit message. Evaluate the user's draft against the diff (`correct`, `missing`, `wrong`, `unsupported` + assistance level) and let them revise. Write a message only if explicitly asked, recording `shown-solution`. + +- **`/practice` active**: + Stop after slice inspection and message calibration: explain the staging boundary and let the user run the `git add` and `git commit` commands directly. diff --git a/skills/git-workspace/references/history-editing.md b/skills/git-manager/references/history-editing.md similarity index 100% rename from skills/git-workspace/references/history-editing.md rename to skills/git-manager/references/history-editing.md diff --git a/skills/git-workspace/references/recovery.md b/skills/git-manager/references/recovery.md similarity index 92% rename from skills/git-workspace/references/recovery.md rename to skills/git-manager/references/recovery.md index 53f6873..85c8dd9 100644 --- a/skills/git-workspace/references/recovery.md +++ b/skills/git-manager/references/recovery.md @@ -1,6 +1,6 @@ # Evidence-First Git Recovery -Reference for `git-workspace`. Procedures for diagnosing and recovering lost commits, detached heads, botched rebases, or corrupted refs using observable evidence. +Reference for `git-manager`. Procedures for diagnosing and recovering lost commits, detached heads, botched rebases, or corrupted refs using observable evidence. ## Core Invariant Never propose a destructive command (`git reset --hard`, `git checkout -f`, `git clean -fd`) as a speculative remedy. Destructive commands discard uncommitted files permanently. Always inspect evidence first, locate candidate commit SHAs, and restore state into a new named branch. diff --git a/skills/git-workspace/references/worktrees.md b/skills/git-manager/references/worktrees.md similarity index 92% rename from skills/git-workspace/references/worktrees.md rename to skills/git-manager/references/worktrees.md index 039a13f..c31a1c7 100644 --- a/skills/git-workspace/references/worktrees.md +++ b/skills/git-manager/references/worktrees.md @@ -1,6 +1,6 @@ # Git Worktrees -Reference for `git-workspace`. Manage isolated working trees linked to the same underlying Git repository without cloning or stashing. +Reference for `git-manager`. Manage isolated working trees linked to the same underlying Git repository without cloning or stashing. ## Use Cases - Working on a quick fix or spike without stashing or switching branches in your main working tree. diff --git a/skills/git-workspace/SKILL.md b/skills/git-workspace/SKILL.md deleted file mode 100644 index 5d2b889..0000000 --- a/skills/git-workspace/SKILL.md +++ /dev/null @@ -1,50 +0,0 @@ ---- -name: git-workspace -description: >- - Manage Git branches, worktrees, history integration (rebase, squash, cherry-pick), - conflict stops, and evidence-first reflog recovery. Use when creating branches or - worktrees, synchronizing branches, editing history, or recovering lost commits. - Not for slicing checkpoint commits: use git-commit. ---- - -# Git Workspace - -## Use when -- Creating dedicated feature branches or isolated worktrees before making edits. -- Integrating branches (rebase, squash, merge, cherry-pick) or resolving conflicts. -- Recovering lost commits, dangling refs, or broken working-tree state via reflog. -- Not for slicing uncommitted diffs into checkpoint commits: use `git-commit`. - -## Steps -1. **Inspect state.** Resolve target repository root (`git rev-parse --show-toplevel`), active branch, - upstream tracking, clean vs. dirty status (`git status --short`), and reflog head. All commands execute - strictly from the target repository root. -2. **Branch and worktree management.** Enforce the branch-before-edits invariant. Create dedicated feature - branches (`git switch -c `). When working across parallel tasks or spikes without disturbing current - working-tree state, create an isolated worktree following [references/worktrees.md](references/worktrees.md). - Never remove a worktree containing uncommitted or unmerged work without explicit confirmation. -3. **Integration and history editing.** Rebase local unshared branches onto upstream base; collapse fixup - checkpoints via squash; cherry-pick with dependency checks. On any merge or rebase conflict: stop immediately, - report conflicting files and hunks in prose, never guess resolution, and offer clean abort (`git rebase --abort`). - Follow [references/history-editing.md](references/history-editing.md). -4. **Evidence-first recovery.** When a commit, branch, or working-tree state appears lost or corrupted, inspect - evidence first (`git reflog`, `git fsck`, `git branch -v`) to identify exact candidate SHAs and timestamps - before proposing any fix. Never run destructive resets (`git reset --hard`) as a speculative remedy. Restore - discovered state into a dedicated recovery branch. Follow [references/recovery.md](references/recovery.md). -5. **Verify post-operation state.** Confirm target ref, commit log (`git log -n 3 --oneline`), and clean working - tree before concluding. - -## Your call -- **Branch and worktree naming and target paths**: choose names and locations for new branches or worktrees. -- **Integration strategy**: choose rebase vs. merge when an architectural choice exists. -- **Conflict resolution**: adjudicate conflicting hunks when git stops during integration. -- **Consequential and destructive actions**: require explicit confirmation with impact described first per - `profile/AGENTS.md` before running destructive commands (`git reset --hard`, force-push, worktree removal). - -## Done when -- Target branch or worktree is created, integrated, or safely cleaned up; or lost ref is restored to a named - branch with observable verification evidence. - -## Hands off to -- `git-commit`: when code changes are ready to be sliced, reviewed, and committed. -- `code-review`: when a branch or PR diff is ready for multi-axis static review before integration.