Resolve import cycles and migrate to chorus.services module path

This comprehensive refactoring addresses critical architectural issues:

IMPORT CYCLE RESOLUTION:
• pkg/crypto ↔ pkg/slurp/roles: Created pkg/security/access_levels.go
• pkg/ucxl → pkg/dht: Created pkg/storage/interfaces.go
• pkg/slurp/leader → pkg/election → pkg/slurp/storage: Moved types to pkg/election/interfaces.go

MODULE PATH MIGRATION:
• Changed from github.com/anthonyrawlins/bzzz to chorus.services/bzzz
• Updated all import statements across 115+ files
• Maintains compatibility while removing personal GitHub account dependency

TYPE SYSTEM IMPROVEMENTS:
• Resolved duplicate type declarations in crypto package
• Added missing type definitions (RoleStatus, TimeRestrictions, KeyStatus, KeyRotationResult)
• Proper interface segregation to prevent future cycles

ARCHITECTURAL BENEFITS:
• Build now progresses past structural issues to normal dependency resolution
• Cleaner separation of concerns between packages
• Eliminates circular dependencies that prevented compilation
• Establishes foundation for scalable codebase growth

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
anthonyrawlins
2025-08-17 10:04:25 +10:00
parent e9252ccddc
commit d96c931a29
115 changed files with 1010 additions and 534 deletions

View File

@@ -24,7 +24,7 @@ type SecurityConfig struct {
// Config represents the complete configuration for a Bzzz agent
type Config struct {
HiveAPI HiveAPIConfig `yaml:"hive_api"`
WHOOSHAPI WHOOSHAPIConfig `yaml:"hive_api"`
Agent AgentConfig `yaml:"agent"`
GitHub GitHubConfig `yaml:"github"`
P2P P2PConfig `yaml:"p2p"`
@@ -36,8 +36,8 @@ type Config struct {
Security SecurityConfig `yaml:"security"` // Cluster security and elections
}
// HiveAPIConfig holds Hive system integration settings
type HiveAPIConfig struct {
// WHOOSHAPIConfig holds WHOOSH system integration settings
type WHOOSHAPIConfig struct {
BaseURL string `yaml:"base_url"`
APIKey string `yaml:"api_key"`
Timeout time.Duration `yaml:"timeout"`
@@ -258,7 +258,7 @@ func LoadConfig(configPath string) (*Config, error) {
// getDefaultConfig returns the default configuration
func getDefaultConfig() *Config {
return &Config{
HiveAPI: HiveAPIConfig{
WHOOSHAPI: WHOOSHAPIConfig{
BaseURL: "https://hive.home.deepblack.cloud",
Timeout: 30 * time.Second,
RetryCount: 3,
@@ -404,12 +404,12 @@ func loadFromFile(config *Config, filePath string) error {
// loadFromEnv loads configuration from environment variables
func loadFromEnv(config *Config) error {
// Hive API configuration
// WHOOSH API configuration
if url := os.Getenv("BZZZ_HIVE_API_URL"); url != "" {
config.HiveAPI.BaseURL = url
config.WHOOSHAPI.BaseURL = url
}
if apiKey := os.Getenv("BZZZ_HIVE_API_KEY"); apiKey != "" {
config.HiveAPI.APIKey = apiKey
config.WHOOSHAPI.APIKey = apiKey
}
// Agent configuration
@@ -481,7 +481,7 @@ func loadFromEnv(config *Config) error {
// validateConfig validates the configuration values
func validateConfig(config *Config) error {
// Validate required fields
if config.HiveAPI.BaseURL == "" {
if config.WHOOSHAPI.BaseURL == "" {
return fmt.Errorf("hive_api.base_url is required")
}