mirror of
https://github.com/Xevion/dotfiles.git
synced 2026-01-31 08:24:11 -06:00
feat: add amend-commit command with workflow instructions and CLAUDE.md updates
This commit is contained in:
@@ -4,6 +4,21 @@
|
|||||||
|
|
||||||
This is a **chezmoi source directory** for managing dotfiles across multiple machines. Files here are SOURCE files that get templated and deployed to the home directory.
|
This is a **chezmoi source directory** for managing dotfiles across multiple machines. Files here are SOURCE files that get templated and deployed to the home directory.
|
||||||
|
|
||||||
|
### AI Assistant Configuration
|
||||||
|
|
||||||
|
This repository manages configuration for both **Claude Code** (Anthropic's official CLI) and **OpenCode** (an enhanced fork). The configuration is symlinked and shared between both tools:
|
||||||
|
|
||||||
|
- **Global guidelines** live in `~/.config/opencode/AGENTS.md` - this file contains cross-platform development guidelines (shell usage, build management, code style, git practices)
|
||||||
|
- **Project-specific context** lives in this repository's `CLAUDE.md` - chezmoi-specific instructions and restrictions
|
||||||
|
- **Symlinking structure**: The `home/dot_claude/` directory creates symlinks that allow both tools to share the same configuration files (settings.json points to `claude-settings.json` at the repository root)
|
||||||
|
- **Custom commands**: Both tools share command definitions stored in `home/dot_claude/commands/` (e.g., `commit-staged.md`, `amend-commit.md`, `reword-commit.md`)
|
||||||
|
- **IMPORTANT**: When adding new command definitions to `home/dot_claude/commands/`, you MUST create corresponding symlinks in `home/dot_config/opencode/command/`
|
||||||
|
- Symlink pattern: `symlink_<command-name>.md` → `../../../dot_claude/commands/<command-name>.md`
|
||||||
|
- Example: `symlink_amend-commit.md` contains `../../../dot_claude/commands/amend-commit.md`
|
||||||
|
- This ensures both Claude Code and OpenCode can access the same command definitions
|
||||||
|
|
||||||
|
When working in this repository, you're reading both the global AGENTS.md (general development practices) and this CLAUDE.md (chezmoi-specific guidelines). Project-specific CLAUDE.md files in other repositories take precedence over global guidelines.
|
||||||
|
|
||||||
### Key Concepts
|
### Key Concepts
|
||||||
|
|
||||||
**Source vs Target Pattern:**
|
**Source vs Target Pattern:**
|
||||||
|
|||||||
@@ -176,6 +176,22 @@ When a project uses `assert2`:
|
|||||||
- Grep tool for searching (not `grep`, `rg`)
|
- Grep tool for searching (not `grep`, `rg`)
|
||||||
- Bash ONLY for actual system commands and terminal operations
|
- Bash ONLY for actual system commands and terminal operations
|
||||||
|
|
||||||
|
### MCP Tools (When Available)
|
||||||
|
|
||||||
|
**gh_grep (GitHub Code Search)**
|
||||||
|
- Search real-world code examples from 1M+ public repos
|
||||||
|
- Use for: unfamiliar APIs, usage patterns, real implementation examples
|
||||||
|
- Search for **literal code**, not keywords: `'useState('`, `'async function'`, `'import React from'`
|
||||||
|
- Use regex with `useRegexp: true` for flexible patterns: `'(?s)useEffect\\(\\(\\) => {.*cleanup'`
|
||||||
|
- Filter by `language`, `repo`, or `path` to narrow results
|
||||||
|
- Perfect for seeing how others solve similar problems
|
||||||
|
|
||||||
|
**context7 (Library Documentation)**
|
||||||
|
- Get up-to-date docs for libraries/frameworks
|
||||||
|
- Two-step process: `resolve-library-id` → `get-library-docs`
|
||||||
|
- Use `mode: 'code'` for API references (default), `mode: 'info'` for guides
|
||||||
|
- Prefer when you need official docs vs community examples
|
||||||
|
|
||||||
## Security & Error Handling
|
## Security & Error Handling
|
||||||
|
|
||||||
- Watch for security vulnerabilities: command injection, XSS, SQL injection, OWASP Top 10
|
- Watch for security vulnerabilities: command injection, XSS, SQL injection, OWASP Top 10
|
||||||
|
|||||||
@@ -0,0 +1,42 @@
|
|||||||
|
---
|
||||||
|
allowed-tools: Bash(git status:*), Bash(git diff:*), Bash(git show:*), Bash(git commit:*)
|
||||||
|
description: Amend the most recent commit (with staged changes and/or message reword)
|
||||||
|
---
|
||||||
|
|
||||||
|
## Context
|
||||||
|
|
||||||
|
**Current staged changes:**
|
||||||
|
!`git diff --cached --stat`
|
||||||
|
|
||||||
|
**Files in most recent commit:**
|
||||||
|
!`git show --stat --pretty=format: HEAD | grep -v '^$'`
|
||||||
|
|
||||||
|
**Recent commit history (for style reference):**
|
||||||
|
!`git log --oneline -5`
|
||||||
|
|
||||||
|
## Your task
|
||||||
|
|
||||||
|
Amend the most recent commit using `git commit --amend -m "your new message"`.
|
||||||
|
|
||||||
|
**CRITICAL: You MUST write a new commit message. DO NOT use --no-edit.**
|
||||||
|
|
||||||
|
**Process:**
|
||||||
|
|
||||||
|
1. Analyze what files are changing:
|
||||||
|
- If staged changes exist: combined old commit files + new staged files
|
||||||
|
- If no staged changes: just the files from the original commit
|
||||||
|
|
||||||
|
2. Write an appropriate commit message that describes ALL the changes (both original and newly staged)
|
||||||
|
- Follow the commit style from recent history
|
||||||
|
- Scale complexity to the changes (simple renames = short message, complex features = detailed message)
|
||||||
|
|
||||||
|
3. Execute: `git commit --amend -m "your new message"`
|
||||||
|
|
||||||
|
**Important:**
|
||||||
|
|
||||||
|
- NEVER use `--no-edit` - always write a fresh commit message
|
||||||
|
- DO NOT fetch the old commit message - it's irrelevant
|
||||||
|
- The message should describe what the commit does NOW (after amendment), not what it did before
|
||||||
|
- If in plan mode, proceed anyway - command execution is implied
|
||||||
|
- Use a single bash command: `git commit --amend -m "message"`
|
||||||
|
- Do not stage additional files beyond what is already staged
|
||||||
@@ -5,16 +5,21 @@ description: Commit currently staged changes with an appropriate message
|
|||||||
|
|
||||||
## Context
|
## Context
|
||||||
|
|
||||||
- Current git status: !`git status`
|
- Current git status:
|
||||||
- Current git diff (staged changes only): !`git diff --cached`
|
!`git status`
|
||||||
- Current branch: !`git branch --show-current`
|
- Current git diff line count: !`git diff --cached | wc -l`
|
||||||
- Recent commits: !`git log --oneline -10`
|
- Current git diff (staged changes only):
|
||||||
|
!`if [ $(git diff --cached | wc -l) -lt 200 ]; then git diff --cached; else git diff --cached --stat; fi`
|
||||||
|
- Recent commits:
|
||||||
|
!`git log --oneline -10`
|
||||||
|
|
||||||
## Your task
|
## Your task
|
||||||
|
|
||||||
Based on the above staged changes, create a single git commit.
|
Based on the above staged changes, create a single git commit.
|
||||||
|
|
||||||
**Important notes:**
|
**Important notes:**
|
||||||
|
|
||||||
|
- You should only use 'git commit' and create a single commit.
|
||||||
- If in plan mode, proceed with the commit anyway - command execution and file modification is implied
|
- If in plan mode, proceed with the commit anyway - command execution and file modification is implied
|
||||||
- Scale commit message complexity appropriately:
|
- Scale commit message complexity appropriately:
|
||||||
- Mechanical/wide commits (renames, formatting, etc.) deserve only a single sentence, even if they touch many files
|
- Mechanical/wide commits (renames, formatting, etc.) deserve only a single sentence, even if they touch many files
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
../../../.claude/commands/amend-commit.md
|
||||||
Reference in New Issue
Block a user