Update root, tools (+1 ~1)

This commit is contained in:
Echo
2026-01-29 13:18:30 +00:00
parent f9912e0081
commit 1706656d78
2 changed files with 103 additions and 0 deletions

View File

@@ -148,6 +148,13 @@ You are free to edit `HEARTBEAT.md` with a short checklist or reminders. Keep it
**Tip:** Batch similar periodic checks into `HEARTBEAT.md` instead of creating multiple cron jobs. Use cron for precise schedules and standalone tasks.
### 📦 Git Commits (~/clawd → gitea.romfast.ro/romfast/clawd)
- **NU face commit automat** - întreabă-l pe Marius când să dau commit
- Verifică periodic dacă sunt fișiere uncommitted: `git status`
- Dacă sunt modificări semnificative, întreabă: "Am X fișiere modificate, fac commit?"
- Evită commit-uri prea multe (nu la fiecare modificare mică)
- Evită să rămână fișiere uncommitted prea mult timp
### 📋 Cron Jobs + Kanban (OBLIGATORIU)
Când se execută orice job cron:
1. **Start:** Creează task în kanban (Progress) cu numele job-ului

96
tools/git_commit.py Executable file
View File

@@ -0,0 +1,96 @@
#!/usr/bin/env python3
"""
Git commit helper - auto-generates commit message from changed files
Usage: python3 git_commit.py [--push] [--dry-run]
"""
import subprocess
import sys
import os
from datetime import datetime
REPO_PATH = os.path.expanduser("~/clawd")
def run(cmd, capture=True):
result = subprocess.run(cmd, shell=True, cwd=REPO_PATH,
capture_output=capture, text=True)
return result.stdout.strip() if capture else result.returncode
def get_status():
"""Get git status summary"""
status = run("git status --porcelain")
if not status:
return None, []
files = []
for line in status.split('\n'):
if line.strip():
status_code = line[:2]
filename = line[3:]
files.append((status_code.strip(), filename))
return status, files
def generate_message(files):
"""Generate commit message from changed files"""
# Group by directory/type
areas = set()
for _, f in files:
if '/' in f:
areas.add(f.split('/')[0])
else:
areas.add('root')
# Count changes
added = len([f for s, f in files if 'A' in s or '?' in s])
modified = len([f for s, f in files if 'M' in s])
deleted = len([f for s, f in files if 'D' in s])
parts = []
if added: parts.append(f"+{added}")
if modified: parts.append(f"~{modified}")
if deleted: parts.append(f"-{deleted}")
change_summary = " ".join(parts) if parts else "changes"
area_list = ", ".join(sorted(areas)[:3])
if len(areas) > 3:
area_list += f" +{len(areas)-3} more"
return f"Update {area_list} ({change_summary})"
def main():
dry_run = "--dry-run" in sys.argv
push = "--push" in sys.argv
status, files = get_status()
if not status:
print('{"status": "clean", "message": "Nothing to commit"}')
return 0
print(f"Files changed: {len(files)}")
for s, f in files[:10]:
print(f" [{s}] {f}")
if len(files) > 10:
print(f" ... and {len(files)-10} more")
message = generate_message(files)
print(f"\nCommit message: {message}")
if dry_run:
print("\n[DRY RUN - no changes made]")
return 0
# Stage all and commit
run("git add -A", capture=False)
result = run(f'git commit -m "{message}"')
print(f"\n{result}")
if push:
print("\nPushing...")
push_result = run("git push 2>&1")
print(push_result)
return 0
if __name__ == "__main__":
sys.exit(main())