feat: config export/import + MCP notification monitor - #37
Conversation
Implement minimum viable version of secure token storage: - Add checkConfigPermissions() to verify file is not world-readable (0600) - LoadConfig() warns if config has insecure permissions (backward compatible) - SaveConfig() sets 0600 permissions and verifies them - Add comprehensive unit tests for permission checks Relates to #10
Phase 1: Config layer (internal/config/) - UnmarshalJSON migration logic (old flat format → new env map) - TestAPIConfig response handling (200, 400, 401, 500, timeout) - ShouldSkipPermissions priority logic - GetDefaultBehavior validation and fallback - LoadConfig / SaveConfig round-trip - ProjectEntry serialization (string vs object format) - RemoteHost UserAtHost formatting Coverage: 37.4% of config package statements Tests verify backward compatibility, API connectivity, configuration priority resolution, and file I/O operations. Related to #11 (Phase 2 and 3 will be completed in separate PRs)
实现 #26 - 添加TUI表单管理项目上下文链接 新增功能��� 1. Projects detail panel 添加 'l' 快捷键入口 2. Link 添加表单:选择目标项目、设置 role 3. 支持 unlink 操作 4. 显示已链接项目列表 主要修改: - internal/tui/linkform.go: 新增链接管理表单组件 - internal/tui/model.go: 添加 viewLinkForm 状态和相关处理 - internal/tui/projects.go: 更新帮助文本显示 'l' 快捷键 用户体验: - 在项目列表中按 'l' 打开链接管理 - 列表模式:查看已有链接,按 'a' 添加,按 'd' 删除 - 添加模式:选择项目,可选填 role 描述 - 删除模式:确认删除链接
- Add WebhookConfig struct to Config (URL, format, events filter) - Implement webhook management: add/remove/list/test commands - Integrate webhooks into agent daemon notification system - Support Slack and Feishu webhook formats - Event-based filtering (task_completed, task_failed) Closes #27
Implements comprehensive system diagnostics: - Claude CLI installation and version check - Configuration file validation - API connectivity test - File permissions verification - Agent daemon status monitoring - Disk space analysis Closes #34
Extend Linux terminal detection to FreeBSD and OpenBSD since they share similar terminal emulators (xterm, konsole, gnome-terminal). Closes #33
Create terminal_freebsd.go and terminal_openbsd.go with platform-specific build tags, copying the Linux terminal emulator detection logic since these BSDs share similar terminal environments (xterm, konsole, gnome-terminal). Revert terminal_linux.go to linux-only to ensure proper build constraint resolution across all platforms. Closes #33
Display round-trip latency in milliseconds for API connection tests, both in single-config and all-configs modes. Closes #17
Replace client-dependent MonitorCmd with an in-process singleton goroutine that polls ~/.codes/notifications/ and delivers task completion/failure notifications via piggyback on agent tool responses. - Add internal/mcp/monitor.go with ensureMonitorRunning singleton - All notifications reliably queued in pending buffer (cap 100) - MCP ServerSession.Log used as best-effort push (SetLevel caveat) - task_create/agent_start/team_start_all auto-start the monitor - Query handlers (task_list/task_get/team_status/agent_list) drain pending notifications into responses - Tool descriptions recommend team_watch + periodic team_status for real-time and polling-based monitoring - Add e2e tests covering full MCP protocol notification flow
Add `codes config export` and `codes config import` for sharing configuration between machines. Sensitive values (TOKEN, KEY, SECRET, PASSWORD) are automatically redacted on export and skipped on import.
|
Caution Review failedThe pull request is closed. 📝 WalkthroughWalkthroughThis PR introduces multiple interconnected features: a system diagnostics command, webhook notifications for task events, daemon supervision with auto-restart and health monitoring, workflow approval prompts with persistence, config import/export with sensitive value redaction, TUI project linking, FreeBSD/OpenBSD terminal support, and MCP notification monitoring with response piggybacking. Changes
Sequence Diagram(s)sequenceDiagram
participant Daemon as Agent Daemon
participant Task as Task Completion
participant Notifier as Webhook Notifier
participant Webhook as Webhook Server
Daemon->>Task: Task status change (completed/failed)
Daemon->>Daemon: sendWebhookNotifications(status, task)
Daemon->>Notifier: Determine event type & filter webhooks
Notifier->>Notifier: Build notification payload
Notifier->>Webhook: POST notification to configured webhook
Webhook-->>Notifier: Response
Notifier->>Daemon: Log result (error non-blocking)
sequenceDiagram
participant FS as File System (.codes/notifications)
participant Monitor as Background Monitor
participant Buffer as Pending Queue
participant Response as MCP Response Handler
FS->>Monitor: Notification files written
Monitor->>Monitor: Poll directory periodically
Monitor->>FS: Read & parse JSON notification files
Monitor->>Buffer: Enqueue pending notifications
Monitor->>FS: Clean up processed files
Response->>Buffer: drainPendingNotifications()
Buffer-->>Response: Return & clear buffered notifications
Response->>Response: Piggyback onto response payload
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Poem
✨ Finishing touches
🧪 Generate unit tests (beta)
Tip Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
feat: config export/import + MCP notification monitor
Summary
codes config export/codes config importfor sharing config between machines. Sensitive values (TOKEN, KEY, SECRET, PASSWORD) auto-redacted on export, skipped on import.MonitorCmdbash scripts with server-side singleton goroutine. Notifications are piggybacked on agent tool responses andteam_watchis recommended for real-time monitoring.Changes
Config export/import
internal/commands/cobra.go— RegisterConfigExportCmdandConfigImportCmdinternal/commands/config_sync.go—RunConfigExport/RunConfigImportimplementationMCP notification monitor
internal/mcp/monitor.go— Singleton goroutine polling~/.codes/notifications/, pending queue (cap 100), best-effort MCP logging pushinternal/mcp/agent_tools.go— RemoveMonitorCmd, addMonitorActive+Notificationspiggyback to 7 handlers, update tool descriptions with polling +team_watchrecommendationsinternal/mcp/monitor_e2e_test.go— 5 Go e2e tests + full MCP protocol e2e test (27 assertions)Test plan
go build ./...passesgo vet ./...cleango test ./...all pass (including 5 new MCP e2e tests)Summary by CodeRabbit
New Features
Improvements