Add bd config command for external integration configuration

- Add GetAllConfig/DeleteConfig methods to storage interface
- Implement config set/get/list/unset subcommands with JSON support
- Add comprehensive tests for config operations
- Create CONFIG.md with full documentation and examples
- Update README.md with config section
- Support namespace conventions (jira.*, linear.*, github.*, custom.*)

Closes bd-60

Amp-Thread-ID: https://ampcode.com/threads/T-33db7481-de7c-475e-b562-6afb7fb4bc7a
Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
Steve Yegge
2025-10-23 14:14:00 -07:00
parent feac3f86e7
commit e8eb0cb6ae
7 changed files with 741 additions and 76 deletions

View File

@@ -1803,6 +1803,31 @@ func (s *SQLiteStorage) GetConfig(ctx context.Context, key string) (string, erro
return value, err
}
// GetAllConfig gets all configuration key-value pairs
func (s *SQLiteStorage) GetAllConfig(ctx context.Context) (map[string]string, error) {
rows, err := s.db.QueryContext(ctx, `SELECT key, value FROM config ORDER BY key`)
if err != nil {
return nil, err
}
defer rows.Close()
config := make(map[string]string)
for rows.Next() {
var key, value string
if err := rows.Scan(&key, &value); err != nil {
return nil, err
}
config[key] = value
}
return config, rows.Err()
}
// DeleteConfig deletes a configuration value
func (s *SQLiteStorage) DeleteConfig(ctx context.Context, key string) error {
_, err := s.db.ExecContext(ctx, `DELETE FROM config WHERE key = ?`, key)
return err
}
// SetMetadata sets a metadata value (for internal state like import hashes)
func (s *SQLiteStorage) SetMetadata(ctx context.Context, key, value string) error {
_, err := s.db.ExecContext(ctx, `