Add workflow automation scripts 🚀
Created powerful helper scripts: - cc_status.py - View current CC status & memory - save_session.py - Save sessions with git commits - start_project.py - Start new projects automatically - link_cc.py - Link CC to any project folder - Updated README with workflow documentation CC's workflow is now supercharged! ⚡ 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
81
save_session.py
Normal file
81
save_session.py
Normal file
@@ -0,0 +1,81 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
CC Session Saver
|
||||
Quickly save a session with memory updates and git commit
|
||||
"""
|
||||
|
||||
import json
|
||||
import subprocess
|
||||
from datetime import datetime
|
||||
from pathlib import Path
|
||||
|
||||
ZONE = Path(__file__).parent
|
||||
MEMORY_FILE = ZONE / "memory.json"
|
||||
SESSIONS_DIR = ZONE / "sessions"
|
||||
|
||||
def save_session(project_name, what_we_did, whats_next):
|
||||
"""Save current session"""
|
||||
|
||||
# Load memory
|
||||
with open(MEMORY_FILE, 'r') as f:
|
||||
memory = json.load(f)
|
||||
|
||||
# Update memory
|
||||
today = datetime.now().strftime('%Y-%m-%d')
|
||||
memory['last_session'] = today
|
||||
memory['sessions_count'] = memory.get('sessions_count', 0) + 1
|
||||
memory['quick_context'] = f"Last session: {project_name}"
|
||||
memory['next_up'] = whats_next if isinstance(whats_next, list) else [whats_next]
|
||||
|
||||
# Update project if exists
|
||||
if project_name in memory.get('project_notes', {}):
|
||||
memory['project_notes'][project_name]['last_updated'] = today
|
||||
|
||||
# Save memory
|
||||
with open(MEMORY_FILE, 'w') as f:
|
||||
json.dump(memory, f, indent=2)
|
||||
|
||||
# Create session log
|
||||
session_file = SESSIONS_DIR / f"{today}_{project_name.replace(' ', '-').lower()}.md"
|
||||
|
||||
session_content = f"""# Session: {today} - {project_name}
|
||||
|
||||
## What We Built
|
||||
{what_we_did}
|
||||
|
||||
## What's Next
|
||||
{chr(10).join(f'- {item}' for item in (whats_next if isinstance(whats_next, list) else [whats_next]))}
|
||||
|
||||
## Notes
|
||||
Session saved automatically with save_session.py
|
||||
"""
|
||||
|
||||
with open(session_file, 'w') as f:
|
||||
f.write(session_content)
|
||||
|
||||
print(f"✅ Session saved!")
|
||||
print(f"📝 Memory updated: {MEMORY_FILE}")
|
||||
print(f"📄 Session log: {session_file}")
|
||||
|
||||
# Git commit option
|
||||
print("\n🔄 Commit to git? (y/n): ", end='')
|
||||
if input().lower() == 'y':
|
||||
subprocess.run(['git', 'add', '.'], cwd=ZONE)
|
||||
commit_msg = f"Session: {project_name} ({today})\n\n{what_we_did}\n\n🤖 Generated with Claude Code\n\nCo-Authored-By: Claude <noreply@anthropic.com>"
|
||||
subprocess.run(['git', 'commit', '-m', commit_msg], cwd=ZONE)
|
||||
print("✅ Committed to git!")
|
||||
|
||||
if __name__ == "__main__":
|
||||
import sys
|
||||
|
||||
if len(sys.argv) < 4:
|
||||
print("Usage: python save_session.py <project_name> <what_we_did> <whats_next>")
|
||||
print("\nExample:")
|
||||
print(' python save_session.py "Nova" "Built genetics system" "Build fitness function"')
|
||||
sys.exit(1)
|
||||
|
||||
project = sys.argv[1]
|
||||
what_we_did = sys.argv[2]
|
||||
whats_next = sys.argv[3]
|
||||
|
||||
save_session(project, what_we_did, whats_next)
|
Reference in New Issue
Block a user