docs(agent): add rules and skills
This commit is contained in:
41
.agent/skills/git-push/SKILL.md
Normal file
41
.agent/skills/git-push/SKILL.md
Normal file
@@ -0,0 +1,41 @@
|
||||
# Git Push & Format Skill
|
||||
|
||||
## Description
|
||||
Formats git commit messages according to Conventional Commits specification and pushes changes to the remote repository. Use this when the user asks to commit changes, save progress, or upload code.
|
||||
|
||||
## Triggers
|
||||
- "Запушь изменения" (Push changes)
|
||||
- "Сделай коммит" (Make a commit)
|
||||
- "Сохрани в гит" (Save to git)
|
||||
- "Сделай пуш" (Make a push)
|
||||
- "Запушь" (Push)
|
||||
|
||||
## Format (Conventional Commits)
|
||||
When writing a git commit message, you MUST follow this format:
|
||||
`<type>[optional scope]: <description>`
|
||||
|
||||
### Allowed Types
|
||||
- **feat**: A new feature
|
||||
- **fix**: A bug fix
|
||||
- **docs**: Documentation only changes
|
||||
- **style**: Changes that do not affect the meaning of the code (white-space, formatting, etc)
|
||||
- **refactor**: A code change that neither fixes a bug nor adds a feature
|
||||
- **perf**: A code change that improves performance
|
||||
- **test**: Adding missing tests or correcting existing tests
|
||||
- **chore**: Changes to the build process or auxiliary tools and libraries
|
||||
|
||||
### Instructions for Agent
|
||||
1. Analyze the user's request or recent file changes to determine the `type` and `description`.
|
||||
2. Construct the commit message string (e.g., "fix(auth): correct token validation").
|
||||
3. **Execute** the bash script below, passing the generated message as an argument.
|
||||
|
||||
## Execution
|
||||
Run the following command (replace .YOUR_MESSAGE. with the formatted string):
|
||||
|
||||
```bash
|
||||
/bin/bash .agent/skills/git-push/scripts/push_changes.sh "YOUR_MESSAGE"
|
||||
```
|
||||
|
||||
## Example Usage
|
||||
If user says "I fixed the login bug", you execute:
|
||||
`/bin/bash .agent/skills/git-push/scripts/push_changes.sh "fix(auth): resolve login error"`
|
||||
31
.agent/skills/git-push/scripts/push_changes.sh
Executable file
31
.agent/skills/git-push/scripts/push_changes.sh
Executable file
@@ -0,0 +1,31 @@
|
||||
#!/bin/bash
|
||||
|
||||
# --- НАСТРОЙКИ (Проверь, чтобы совпадали с check_and_pull.sh) ---
|
||||
SERVER="root@192.168.1.87"
|
||||
REMOTE_PATH="/root/magistr/program"
|
||||
# -------------------------------------------------------------
|
||||
|
||||
COMMIT_MSG="$1"
|
||||
|
||||
# Проверка: если сообщение пустое, ругаемся
|
||||
if [ -z "$COMMIT_MSG" ]; then
|
||||
echo "❌ Error: Commit message is required."
|
||||
echo "Usage: ./push_changes.sh \"feat: description\""
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "🚀 Starting Push Sequence to $SERVER..."
|
||||
|
||||
# Выполняем цепочку команд на сервере одной строкой
|
||||
ssh -o BatchMode=yes "$SERVER" "export LANG=C.UTF-8 && cd $REMOTE_PATH && \
|
||||
git add . && \
|
||||
git commit -m \"$COMMIT_MSG\" && \
|
||||
git push origin main"
|
||||
|
||||
# Проверяем код возврата последней команды
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "✅ Success! Changes pushed to remote."
|
||||
else
|
||||
echo "❌ Failed to push. Check the output above for errors."
|
||||
exit 1
|
||||
fi
|
||||
Reference in New Issue
Block a user