summaryrefslogtreecommitdiff
path: root/internal/config/config.go
diff options
context:
space:
mode:
authorPeter Stone <thepeterstone@gmail.com>2026-02-08 21:35:45 -1000
committerPeter Stone <thepeterstone@gmail.com>2026-02-08 21:35:45 -1000
commit2e2b2187b957e9af78797a67ec5c6874615fae02 (patch)
tree1181dbb7e43f5d30cb025fa4d50fd4e7a2c893b3 /internal/config/config.go
Initial project: task model, executor, API server, CLI, storage, reporter
Claudomator automation toolkit for Claude Code with: - Task model with YAML parsing, validation, state machine (49 tests, 0 races) - SQLite storage for tasks and executions - Executor pool with bounded concurrency, timeout, cancellation - REST API + WebSocket for mobile PWA integration - Webhook/multi-notifier system - CLI: init, run, serve, list, status commands - Console, JSON, HTML reporters with cost tracking Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Diffstat (limited to 'internal/config/config.go')
-rw-r--r--internal/config/config.go41
1 files changed, 41 insertions, 0 deletions
diff --git a/internal/config/config.go b/internal/config/config.go
new file mode 100644
index 0000000..da7f264
--- /dev/null
+++ b/internal/config/config.go
@@ -0,0 +1,41 @@
+package config
+
+import (
+ "os"
+ "path/filepath"
+)
+
+type Config struct {
+ DataDir string `toml:"data_dir"`
+ DBPath string `toml:"-"`
+ LogDir string `toml:"-"`
+ ClaudeBinaryPath string `toml:"claude_binary_path"`
+ MaxConcurrent int `toml:"max_concurrent"`
+ DefaultTimeout string `toml:"default_timeout"`
+ ServerAddr string `toml:"server_addr"`
+ WebhookURL string `toml:"webhook_url"`
+}
+
+func Default() *Config {
+ home, _ := os.UserHomeDir()
+ dataDir := filepath.Join(home, ".claudomator")
+ return &Config{
+ DataDir: dataDir,
+ DBPath: filepath.Join(dataDir, "claudomator.db"),
+ LogDir: filepath.Join(dataDir, "executions"),
+ ClaudeBinaryPath: "claude",
+ MaxConcurrent: 3,
+ DefaultTimeout: "15m",
+ ServerAddr: ":8484",
+ }
+}
+
+// EnsureDirs creates the data directory structure.
+func (c *Config) EnsureDirs() error {
+ for _, dir := range []string{c.DataDir, c.LogDir} {
+ if err := os.MkdirAll(dir, 0700); err != nil {
+ return err
+ }
+ }
+ return nil
+}