mirror of
https://github.com/tiennm99/try-claudekit.git
synced 2026-04-17 19:22:28 +00:00
feat: add ClaudeKit configuration
Add agent definitions, slash commands, hooks, and settings for Claude Code project tooling.
This commit is contained in:
31
.claude/commands/checkpoint/create.md
Normal file
31
.claude/commands/checkpoint/create.md
Normal file
@@ -0,0 +1,31 @@
|
||||
---
|
||||
description: Create a git stash checkpoint with optional description
|
||||
category: workflow
|
||||
allowed-tools: Bash(git stash:*), Bash(git add:*), Bash(git status:*)
|
||||
argument-hint: "[optional description]"
|
||||
---
|
||||
|
||||
## Create a checkpoint
|
||||
|
||||
Create a git stash checkpoint to save your current working state.
|
||||
|
||||
## Current status
|
||||
!`git status --short`
|
||||
|
||||
## Task
|
||||
|
||||
Create a git stash checkpoint while keeping all current changes in the working directory. Steps:
|
||||
|
||||
1. If no description provided in $ARGUMENTS, use current timestamp as "YYYY-MM-DD HH:MM:SS"
|
||||
2. Create a stash object without modifying the working directory:
|
||||
- First add all files temporarily: `git add -A`
|
||||
- Create the stash object: `git stash create "claude-checkpoint: $ARGUMENTS"`
|
||||
- This returns a commit SHA that we need to capture
|
||||
3. Store the stash object in the stash list:
|
||||
- `git stash store -m "claude-checkpoint: $ARGUMENTS" <SHA>`
|
||||
4. Reset the index to unstage files: `git reset`
|
||||
5. Confirm the checkpoint was created and show what was saved
|
||||
|
||||
Note: Using `git stash create` + `git stash store` creates a checkpoint without touching your working directory.
|
||||
|
||||
Example: If user runs `/checkpoint before major refactor`, it creates a stash checkpoint while leaving all your files exactly as they are.
|
||||
34
.claude/commands/checkpoint/list.md
Normal file
34
.claude/commands/checkpoint/list.md
Normal file
@@ -0,0 +1,34 @@
|
||||
---
|
||||
description: List all Claude Code checkpoints with time and description
|
||||
category: workflow
|
||||
allowed-tools: Bash(git stash:*)
|
||||
---
|
||||
|
||||
## List Claude Code checkpoints
|
||||
|
||||
Display all checkpoints created by Claude Code during this and previous sessions.
|
||||
|
||||
## Task
|
||||
|
||||
List all Claude Code checkpoints. Steps:
|
||||
|
||||
1. Run `git stash list` to get all stashes
|
||||
2. Filter for lines containing "claude-checkpoint:" using grep or by parsing the output
|
||||
3. For each matching stash line (format: `stash@{n}: On branch: message`):
|
||||
- Extract the stash number from `stash@{n}`
|
||||
- Extract the branch name after "On "
|
||||
- Extract the checkpoint description after "claude-checkpoint: "
|
||||
- Use `git log -1 --format="%ai" stash@{n}` to get the timestamp for each stash
|
||||
|
||||
4. Format and display as:
|
||||
```
|
||||
Claude Code Checkpoints:
|
||||
[n] YYYY-MM-DD HH:MM:SS - Description (branch)
|
||||
```
|
||||
Where n is the stash index number
|
||||
|
||||
5. If `git stash list | grep "claude-checkpoint:"` returns nothing, display:
|
||||
"No checkpoints found. Use /checkpoint [description] to create one."
|
||||
|
||||
Example: A stash line like `stash@{2}: On main: claude-checkpoint: before auth refactor`
|
||||
Should display as: `[2] 2025-01-15 10:30:45 - before auth refactor (main)`
|
||||
42
.claude/commands/checkpoint/restore.md
Normal file
42
.claude/commands/checkpoint/restore.md
Normal file
@@ -0,0 +1,42 @@
|
||||
---
|
||||
description: Restore project to a previous checkpoint
|
||||
category: workflow
|
||||
allowed-tools: Bash(git stash:*), Bash(git status:*), Bash(git reset:*), Bash(grep:*), Bash(head:*)
|
||||
argument-hint: "<checkpoint-number|latest>"
|
||||
---
|
||||
|
||||
## Restore to checkpoint
|
||||
|
||||
Restore your project files to a previous checkpoint created with /checkpoint.
|
||||
|
||||
## Available checkpoints
|
||||
!`git stash list | grep "claude-checkpoint" | head -10`
|
||||
|
||||
## Current status
|
||||
!`git status --short`
|
||||
|
||||
## Task
|
||||
|
||||
Restore the project to a previous checkpoint. Based on $ARGUMENTS:
|
||||
|
||||
1. Parse the argument:
|
||||
- If empty or "latest": Find the most recent claude-checkpoint stash
|
||||
- If a number (e.g. "2"): Use stash@{2} if it's a claude-checkpoint
|
||||
- Otherwise: Show error and list available checkpoints
|
||||
|
||||
2. Check for uncommitted changes with `git status --porcelain`. If any exist:
|
||||
- Create a temporary backup stash: `git stash push -m "claude-restore-backup: $(date +%Y-%m-%d_%H:%M:%S)"`
|
||||
- Note the stash reference for potential recovery
|
||||
|
||||
3. Apply the checkpoint:
|
||||
- Use `git stash apply stash@{n}` (not pop, to preserve the checkpoint)
|
||||
- If there's a conflict due to uncommitted changes that were stashed, handle gracefully
|
||||
|
||||
4. Show what was restored:
|
||||
- Display which checkpoint was applied
|
||||
- If uncommitted changes were backed up, inform user how to recover them
|
||||
|
||||
Example outputs:
|
||||
- For `/restore`: "Restored to checkpoint: before major refactor (stash@{0})"
|
||||
- For `/restore 3`: "Restored to checkpoint: working OAuth implementation (stash@{3})"
|
||||
- With uncommitted changes: "Backed up current changes to stash@{0}. Restored to checkpoint: before major refactor (stash@{1})"
|
||||
Reference in New Issue
Block a user