this repo has no description
40
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add --no-git command line argument to skip git operations

Adds --no-git flag to bsky.py that skips git operations when exporting
agent state. This prevents the automatic git staging of agent backups
when the bot needs to export state (e.g., during halt operations).

Usage: python bsky.py --no-git

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

+34 -16
+6
CLAUDE.md
··· 13 13 ac && python bsky.py 14 14 # OR 15 15 source .venv/bin/activate && python bsky.py 16 + 17 + # Run with testing mode (no messages sent, queue preserved) 18 + ac && python bsky.py --test 19 + 20 + # Run without git operations for agent backups 21 + ac && python bsky.py --no-git 16 22 ``` 17 23 18 24 ### Managing Tools
+28 -16
bsky.py
··· 87 87 # Testing mode flag 88 88 TESTING_MODE = False 89 89 90 - def export_agent_state(client, agent): 90 + # Skip git operations flag 91 + SKIP_GIT = False 92 + 93 + def export_agent_state(client, agent, skip_git=False): 91 94 """Export agent state to agent_archive/ (timestamped) and agents/ (current).""" 92 95 try: 93 - # Confirm export with user 94 - response = input("Export agent state to files and stage with git? (y/n): ").lower().strip() 95 - if response not in ['y', 'yes']: 96 - logger.info("Agent export cancelled by user.") 97 - return 96 + # Confirm export with user unless git is being skipped 97 + if not skip_git: 98 + response = input("Export agent state to files and stage with git? (y/n): ").lower().strip() 99 + if response not in ['y', 'yes']: 100 + logger.info("Agent export cancelled by user.") 101 + return 102 + else: 103 + logger.info("Exporting agent state (git staging disabled)") 98 104 99 105 # Create directories if they don't exist 100 106 os.makedirs("agent_archive", exist_ok=True) ··· 117 123 118 124 logger.info(f"✅ Agent exported to {archive_file} and {current_file}") 119 125 120 - # Git add only the current agent file (archive is ignored) 121 - try: 122 - subprocess.run(["git", "add", current_file], check=True, capture_output=True) 123 - logger.info("Added current agent file to git staging") 124 - except subprocess.CalledProcessError as e: 125 - logger.warning(f"Failed to git add agent file: {e}") 126 + # Git add only the current agent file (archive is ignored) unless skip_git is True 127 + if not skip_git: 128 + try: 129 + subprocess.run(["git", "add", current_file], check=True, capture_output=True) 130 + logger.info("Added current agent file to git staging") 131 + except subprocess.CalledProcessError as e: 132 + logger.warning(f"Failed to git add agent file: {e}") 126 133 127 134 except Exception as e: 128 135 logger.error(f"Failed to export agent: {e}") ··· 176 183 177 184 # Export agent state 178 185 logger.info("Exporting agent state...") 179 - export_agent_state(CLIENT, void_agent) 186 + export_agent_state(CLIENT, void_agent, skip_git=SKIP_GIT) 180 187 181 188 # Log agent details 182 189 logger.info(f"Void agent details - ID: {void_agent.id}") ··· 517 524 logger.error("Please use add_post_to_bluesky_reply_thread instead.") 518 525 logger.error("Update the agent's tools using register_tools.py") 519 526 # Export agent state before terminating 520 - export_agent_state(CLIENT, void_agent) 527 + export_agent_state(CLIENT, void_agent, skip_git=SKIP_GIT) 521 528 logger.info("=== BOT TERMINATED DUE TO DEPRECATED TOOL USE ===") 522 529 exit(1) 523 530 ··· 562 569 save_processed_notifications(processed_uris) 563 570 564 571 # Export agent state before terminating 565 - export_agent_state(CLIENT, void_agent) 572 + export_agent_state(CLIENT, void_agent, skip_git=SKIP_GIT) 566 573 567 574 # Exit the program 568 575 logger.info("=== BOT TERMINATED BY AGENT ===") ··· 575 582 logger.error("Please use add_post_to_bluesky_reply_thread instead.") 576 583 logger.error("Update the agent's tools using register_tools.py") 577 584 # Export agent state before terminating 578 - export_agent_state(CLIENT, void_agent) 585 + export_agent_state(CLIENT, void_agent, skip_git=SKIP_GIT) 579 586 logger.info("=== BOT TERMINATED DUE TO DEPRECATED TOOL USE ===") 580 587 exit(1) 581 588 ··· 991 998 # Parse command line arguments 992 999 parser = argparse.ArgumentParser(description='Void Bot - Bluesky autonomous agent') 993 1000 parser.add_argument('--test', action='store_true', help='Run in testing mode (no messages sent, queue files preserved)') 1001 + parser.add_argument('--no-git', action='store_true', help='Skip git operations when exporting agent state') 994 1002 args = parser.parse_args() 995 1003 996 1004 global TESTING_MODE 997 1005 TESTING_MODE = args.test 1006 + 1007 + # Store no-git flag globally for use in export_agent_state calls 1008 + global SKIP_GIT 1009 + SKIP_GIT = args.no_git 998 1010 999 1011 if TESTING_MODE: 1000 1012 logger.info("🧪 === RUNNING IN TESTING MODE ===")