store: Discord bot dynamic configuration with live reload

This commit is contained in:
Cal Corum 2026-02-13 14:35:08 -06:00
parent b5f276a3b4
commit e2e70edda1

View File

@ -0,0 +1,30 @@
---
id: 8bd768ce-365c-4e25-b93a-ff4d67554141
type: solution
title: "Discord bot dynamic configuration with live reload"
tags: [discord-bot, python, discord.py, live-reload, configuration, pattern, claude-coordinator]
importance: 0.7
confidence: 0.8
created: "2026-02-13T20:35:08.512896+00:00"
updated: "2026-02-13T20:35:08.512896+00:00"
---
Implemented /add-project command for Claude Discord Coordinator that adds projects without restarting bot.
Key pattern:
- Config.add_project() adds to in-memory config
- Config.save() writes atomically (temp file + os.replace)
- No bot restart needed - config reloaded live
Files:
- config.py: add_project() and save() methods
- commands.py: /add-project slash command with git clone + validation
- Rollback on failure: delete cloned dir, don't save config
Git auth: credential.helper=store with ~/.git-credentials for automated cloning
Benefits:
- Self-service project setup via Discord
- No manual config editing
- No service restarts
- Atomic config updates prevent corruption