feat(bot,bridge): P1 !auto 토글 자동승인 + P2 BridgeTransport 추상화 #task-304 #task-305

P1: !auto 토글 (bot.py + extension.ts)
- auto_approve_projects set으로 프로젝트별 상태 관리
- !auto → on/off 토글, pending 자동 승인 + 🤖 자동 승인됨 embed
- Extension step_probe에서 autoApproveEnabled 시 직접 tryApprovalStrategies

P2: BridgeTransport 추상화 (bridge.py)
- BridgeTransport ABC + LocalTransport (기존 동작 100% 호환)
- RemoteTransport 스켈레톤 (multi-PC 대비)
- config.py BOT_MODE/REMOTE_BRIDGE_URL, main.py transport 주입

docs: usage-guide.md + tech-stack.md Python 경로 기록
This commit is contained in:
Variet Worker
2026-03-11 19:25:40 +09:00
parent 1696a2976b
commit c1303999cf
8 changed files with 434 additions and 106 deletions

16
main.py
View File

@@ -42,6 +42,7 @@ async def main():
logger.info("=" * 50)
logger.info(f"Brain path: {Config.BRAIN_PATH}")
logger.info(f"Debounce: {Config.DEBOUNCE_SECONDS}s")
logger.info(f"Bot mode: {Config.BOT_MODE}")
# Shared event queue
event_queue = asyncio.Queue()
@@ -49,10 +50,25 @@ async def main():
# Get the running loop
loop = asyncio.get_running_loop()
# Create transport based on BOT_MODE
transport = None # None → LocalTransport (default)
if Config.BOT_MODE == "remote":
from bridge import RemoteTransport
if not Config.REMOTE_BRIDGE_URL:
logger.error("REMOTE_BRIDGE_URL is required for remote mode")
sys.exit(1)
transport = RemoteTransport(Config.REMOTE_BRIDGE_URL)
logger.info(f"Remote transport: {Config.REMOTE_BRIDGE_URL}")
# Create components
watcher = BrainWatcher(event_queue, loop)
bot = GravityBot(event_queue)
# Inject transport if specified (otherwise bot uses default LocalTransport)
if transport is not None:
from bridge import BridgeProtocol
bot.bridge = BridgeProtocol(transport)
try:
# Start watcher (runs in a separate thread via watchdog)
watcher.start()