mirror of
https://github.com/YspCoder/clawgo.git
synced 2026-04-28 04:57:29 +08:00
fix package
This commit is contained in:
@@ -7,8 +7,8 @@ import (
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"clawgo/pkg/config"
|
||||
"clawgo/pkg/logger"
|
||||
"github.com/YspCoder/clawgo/pkg/config"
|
||||
"github.com/YspCoder/clawgo/pkg/logger"
|
||||
)
|
||||
|
||||
func copyDirectory(src, dst string) error {
|
||||
@@ -9,11 +9,11 @@ import (
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"clawgo/pkg/agent"
|
||||
"clawgo/pkg/bus"
|
||||
"clawgo/pkg/cron"
|
||||
"clawgo/pkg/logger"
|
||||
"clawgo/pkg/providers"
|
||||
"github.com/YspCoder/clawgo/pkg/agent"
|
||||
"github.com/YspCoder/clawgo/pkg/bus"
|
||||
"github.com/YspCoder/clawgo/pkg/cron"
|
||||
"github.com/YspCoder/clawgo/pkg/logger"
|
||||
"github.com/YspCoder/clawgo/pkg/providers"
|
||||
|
||||
"github.com/chzyer/readline"
|
||||
)
|
||||
@@ -27,7 +27,7 @@ func agentCmd() {
|
||||
switch args[i] {
|
||||
case "--debug", "-d":
|
||||
logger.SetLevel(logger.DEBUG)
|
||||
fmt.Println("🔍 Debug mode enabled")
|
||||
fmt.Println("馃攳 Debug mode enabled")
|
||||
case "-m", "--message":
|
||||
if i+1 < len(args) {
|
||||
message = args[i+1]
|
||||
@@ -10,9 +10,9 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"clawgo/pkg/bus"
|
||||
"clawgo/pkg/channels"
|
||||
"clawgo/pkg/config"
|
||||
"github.com/YspCoder/clawgo/pkg/bus"
|
||||
"github.com/YspCoder/clawgo/pkg/channels"
|
||||
"github.com/YspCoder/clawgo/pkg/config"
|
||||
|
||||
qrterminal "github.com/mdp/qrterminal/v3"
|
||||
)
|
||||
@@ -55,7 +55,7 @@ func channelHelp() {
|
||||
func channelTestCmd() {
|
||||
to := ""
|
||||
channelName := ""
|
||||
message := "This is a test message from ClawGo 🦞"
|
||||
message := "This is a test message from ClawGo 馃"
|
||||
|
||||
args := os.Args[3:]
|
||||
for i := 0; i < len(args); i++ {
|
||||
@@ -104,11 +104,11 @@ func channelTestCmd() {
|
||||
|
||||
fmt.Printf("Sending test message to %s (%s)...\n", channelName, to)
|
||||
if err := mgr.SendToChannel(ctx, channelName, to, message); err != nil {
|
||||
fmt.Printf("✗ Failed to send message: %v\n", err)
|
||||
fmt.Printf("鉁?Failed to send message: %v\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
fmt.Println("✓ Test message sent successfully!")
|
||||
fmt.Println("鉁?Test message sent successfully!")
|
||||
}
|
||||
|
||||
func whatsAppChannelCmd() {
|
||||
@@ -9,8 +9,8 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"clawgo/pkg/config"
|
||||
"clawgo/pkg/configops"
|
||||
"github.com/YspCoder/clawgo/pkg/config"
|
||||
"github.com/YspCoder/clawgo/pkg/configops"
|
||||
)
|
||||
|
||||
func configCmd() {
|
||||
@@ -100,7 +100,7 @@ func configSetCmd() {
|
||||
return
|
||||
}
|
||||
|
||||
fmt.Printf("✓ Updated %s = %v\n", path, value)
|
||||
fmt.Printf("鉁?Updated %s = %v\n", path, value)
|
||||
running, err := triggerGatewayReload()
|
||||
if err != nil {
|
||||
if running {
|
||||
@@ -113,7 +113,7 @@ func configSetCmd() {
|
||||
}
|
||||
fmt.Printf("Updated config file. Hot reload not applied: %v\n", err)
|
||||
} else {
|
||||
fmt.Println("✓ Gateway hot reload signal sent")
|
||||
fmt.Println("鉁?Gateway hot reload signal sent")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -150,7 +150,7 @@ func configReloadCmd() {
|
||||
fmt.Printf("Hot reload not applied: %v\n", err)
|
||||
return
|
||||
}
|
||||
fmt.Println("✓ Gateway hot reload signal sent")
|
||||
fmt.Println("鉁?Gateway hot reload signal sent")
|
||||
}
|
||||
|
||||
func configCheckCmd() {
|
||||
@@ -161,11 +161,11 @@ func configCheckCmd() {
|
||||
}
|
||||
validationErrors := config.Validate(cfg)
|
||||
if len(validationErrors) == 0 {
|
||||
fmt.Println("✓ Config validation passed")
|
||||
fmt.Println("鉁?Config validation passed")
|
||||
return
|
||||
}
|
||||
|
||||
fmt.Println("✗ Config validation failed:")
|
||||
fmt.Println("鉁?Config validation failed:")
|
||||
for _, ve := range validationErrors {
|
||||
fmt.Printf(" - %v\n", ve)
|
||||
}
|
||||
@@ -265,7 +265,7 @@ func providerCmd() {
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
fmt.Println("✓ Provider configuration saved.")
|
||||
fmt.Println("鉁?Provider configuration saved.")
|
||||
running, err := triggerGatewayReload()
|
||||
if err != nil {
|
||||
if running {
|
||||
@@ -275,7 +275,7 @@ func providerCmd() {
|
||||
fmt.Printf("Gateway not running, reload skipped: %v\n", err)
|
||||
return
|
||||
}
|
||||
fmt.Println("✓ Gateway hot reload signal sent")
|
||||
fmt.Println("鉁?Gateway hot reload signal sent")
|
||||
}
|
||||
|
||||
func providerNames(cfg *config.Config) []string {
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"path/filepath"
|
||||
"time"
|
||||
|
||||
"clawgo/pkg/cron"
|
||||
"github.com/YspCoder/clawgo/pkg/cron"
|
||||
)
|
||||
|
||||
func cronCmd() {
|
||||
@@ -177,15 +177,15 @@ func cronAddCmd(storePath string) {
|
||||
return
|
||||
}
|
||||
|
||||
fmt.Printf("✓ Added job '%s' (%s)\n", job.Name, job.ID)
|
||||
fmt.Printf("鉁?Added job '%s' (%s)\n", job.Name, job.ID)
|
||||
}
|
||||
|
||||
func cronRemoveCmd(storePath, jobID string) {
|
||||
cs := cron.NewCronService(storePath, nil)
|
||||
if cs.RemoveJob(jobID) {
|
||||
fmt.Printf("✓ Removed job %s\n", jobID)
|
||||
fmt.Printf("鉁?Removed job %s\n", jobID)
|
||||
} else {
|
||||
fmt.Printf("✗ Job %s not found\n", jobID)
|
||||
fmt.Printf("鉁?Job %s not found\n", jobID)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -205,8 +205,8 @@ func cronEnableCmd(storePath string, disable bool) {
|
||||
if disable {
|
||||
status = "disabled"
|
||||
}
|
||||
fmt.Printf("✓ Job '%s' %s\n", job.Name, status)
|
||||
fmt.Printf("鉁?Job '%s' %s\n", job.Name, status)
|
||||
} else {
|
||||
fmt.Printf("✗ Job %s not found\n", jobID)
|
||||
fmt.Printf("鉁?Job %s not found\n", jobID)
|
||||
}
|
||||
}
|
||||
@@ -13,18 +13,18 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"clawgo/pkg/agent"
|
||||
"clawgo/pkg/api"
|
||||
"clawgo/pkg/bus"
|
||||
"clawgo/pkg/channels"
|
||||
"clawgo/pkg/config"
|
||||
"clawgo/pkg/cron"
|
||||
"clawgo/pkg/heartbeat"
|
||||
"clawgo/pkg/logger"
|
||||
"clawgo/pkg/nodes"
|
||||
"clawgo/pkg/providers"
|
||||
"clawgo/pkg/runtimecfg"
|
||||
"clawgo/pkg/sentinel"
|
||||
"github.com/YspCoder/clawgo/pkg/agent"
|
||||
"github.com/YspCoder/clawgo/pkg/api"
|
||||
"github.com/YspCoder/clawgo/pkg/bus"
|
||||
"github.com/YspCoder/clawgo/pkg/channels"
|
||||
"github.com/YspCoder/clawgo/pkg/config"
|
||||
"github.com/YspCoder/clawgo/pkg/cron"
|
||||
"github.com/YspCoder/clawgo/pkg/heartbeat"
|
||||
"github.com/YspCoder/clawgo/pkg/logger"
|
||||
"github.com/YspCoder/clawgo/pkg/nodes"
|
||||
"github.com/YspCoder/clawgo/pkg/providers"
|
||||
"github.com/YspCoder/clawgo/pkg/runtimecfg"
|
||||
"github.com/YspCoder/clawgo/pkg/sentinel"
|
||||
"github.com/pion/webrtc/v4"
|
||||
)
|
||||
|
||||
@@ -107,26 +107,26 @@ func gatewayCmd() {
|
||||
|
||||
enabledChannels := channelManager.GetEnabledChannels()
|
||||
if len(enabledChannels) > 0 {
|
||||
fmt.Printf("✓ Channels enabled: %s\n", enabledChannels)
|
||||
fmt.Printf("鉁?Channels enabled: %s\n", enabledChannels)
|
||||
} else {
|
||||
fmt.Println("⚠ Warning: No channels enabled")
|
||||
fmt.Println("鈿?Warning: No channels enabled")
|
||||
}
|
||||
|
||||
fmt.Printf("✓ Gateway started on %s:%d\n", cfg.Gateway.Host, cfg.Gateway.Port)
|
||||
fmt.Printf("鉁?Gateway started on %s:%d\n", cfg.Gateway.Host, cfg.Gateway.Port)
|
||||
fmt.Println("Press Ctrl+C to stop. Send SIGHUP to hot-reload config.")
|
||||
|
||||
if err := cronService.Start(); err != nil {
|
||||
fmt.Printf("Error starting cron service: %v\n", err)
|
||||
}
|
||||
fmt.Println("✓ Cron service started")
|
||||
fmt.Println("鉁?Cron service started")
|
||||
|
||||
if err := heartbeatService.Start(); err != nil {
|
||||
fmt.Printf("Error starting heartbeat service: %v\n", err)
|
||||
}
|
||||
fmt.Println("✓ Heartbeat service started")
|
||||
fmt.Println("鉁?Heartbeat service started")
|
||||
if cfg.Sentinel.Enabled {
|
||||
sentinelService.Start()
|
||||
fmt.Println("✓ Sentinel service started")
|
||||
fmt.Println("鉁?Sentinel service started")
|
||||
}
|
||||
|
||||
registryServer := api.NewServer(cfg.Gateway.Host, cfg.Gateway.Port, cfg.Gateway.Token, nodes.DefaultManager())
|
||||
@@ -367,7 +367,7 @@ func gatewayCmd() {
|
||||
if err := registryServer.Start(ctx); err != nil {
|
||||
fmt.Printf("Error starting node registry server: %v\n", err)
|
||||
} else {
|
||||
fmt.Printf("✓ Node registry server started on %s:%d\n", cfg.Gateway.Host, cfg.Gateway.Port)
|
||||
fmt.Printf("鉁?Node registry server started on %s:%d\n", cfg.Gateway.Host, cfg.Gateway.Port)
|
||||
}
|
||||
|
||||
if err := channelManager.StartAll(ctx); err != nil {
|
||||
@@ -381,10 +381,10 @@ func gatewayCmd() {
|
||||
sigChan := make(chan os.Signal, 1)
|
||||
signal.Notify(sigChan, gatewayNotifySignals()...)
|
||||
applyReload := func() {
|
||||
fmt.Println("\n↻ Reloading config...")
|
||||
fmt.Println("\n鈫?Reloading config...")
|
||||
newCfg, err := config.LoadConfig(getConfigPath())
|
||||
if err != nil {
|
||||
fmt.Printf("✗ Reload failed (load config): %v\n", err)
|
||||
fmt.Printf("鉁?Reload failed (load config): %v\n", err)
|
||||
return
|
||||
}
|
||||
if strings.EqualFold(strings.TrimSpace(os.Getenv(envRootGranted)), "1") || strings.EqualFold(strings.TrimSpace(os.Getenv(envRootGranted)), "true") {
|
||||
@@ -398,7 +398,7 @@ func gatewayCmd() {
|
||||
}
|
||||
|
||||
if reflect.DeepEqual(cfg, newCfg) {
|
||||
fmt.Println("✓ Config unchanged, skip reload")
|
||||
fmt.Println("鉁?Config unchanged, skip reload")
|
||||
return
|
||||
}
|
||||
|
||||
@@ -437,13 +437,13 @@ func gatewayCmd() {
|
||||
cfg = newCfg
|
||||
runtimecfg.Set(cfg)
|
||||
configureGatewayNodeP2P(agentLoop, registryServer, cfg)
|
||||
fmt.Println("✓ Config hot-reload applied (logging/metadata only)")
|
||||
fmt.Println("鉁?Config hot-reload applied (logging/metadata only)")
|
||||
return
|
||||
}
|
||||
|
||||
newAgentLoop, newChannelManager, err := buildGatewayRuntime(ctx, newCfg, msgBus, cronService)
|
||||
if err != nil {
|
||||
fmt.Printf("✗ Reload failed (init runtime): %v\n", err)
|
||||
fmt.Printf("鉁?Reload failed (init runtime): %v\n", err)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -485,11 +485,11 @@ func gatewayCmd() {
|
||||
sentinelService.SetManager(channelManager)
|
||||
|
||||
if err := channelManager.StartAll(ctx); err != nil {
|
||||
fmt.Printf("✗ Reload failed (start channels): %v\n", err)
|
||||
fmt.Printf("鉁?Reload failed (start channels): %v\n", err)
|
||||
return
|
||||
}
|
||||
go agentLoop.Run(ctx)
|
||||
fmt.Println("✓ Config hot-reload applied")
|
||||
fmt.Println("鉁?Config hot-reload applied")
|
||||
}
|
||||
|
||||
for {
|
||||
@@ -511,7 +511,7 @@ func gatewayCmd() {
|
||||
cronService.Stop()
|
||||
agentLoop.Stop()
|
||||
channelManager.StopAll(ctx)
|
||||
fmt.Println("✓ Gateway stopped")
|
||||
fmt.Println("鉁?Gateway stopped")
|
||||
return
|
||||
}
|
||||
}
|
||||
@@ -606,7 +606,7 @@ func gatewayInstallServiceCmd() error {
|
||||
return err
|
||||
}
|
||||
|
||||
fmt.Printf("✓ Gateway service registered: %s (%s)\n", gatewayServiceName, scope)
|
||||
fmt.Printf("鉁?Gateway service registered: %s (%s)\n", gatewayServiceName, scope)
|
||||
fmt.Printf(" Unit file: %s\n", unitPath)
|
||||
fmt.Println(" Start service: clawgo gateway start")
|
||||
fmt.Println(" Restart service: clawgo gateway restart")
|
||||
@@ -766,9 +766,9 @@ func buildGatewayRuntime(ctx context.Context, cfg *config.Config, msgBus *bus.Me
|
||||
startupInfo := agentLoop.GetStartupInfo()
|
||||
toolsInfo := startupInfo["tools"].(map[string]interface{})
|
||||
skillsInfo := startupInfo["skills"].(map[string]interface{})
|
||||
fmt.Println("\n📦 Agent Status:")
|
||||
fmt.Printf(" • Tools: %d loaded\n", toolsInfo["count"])
|
||||
fmt.Printf(" • Skills: %d/%d available\n", skillsInfo["available"], skillsInfo["total"])
|
||||
fmt.Println("\n馃摝 Agent Status:")
|
||||
fmt.Printf(" 鈥?Tools: %d loaded\n", toolsInfo["count"])
|
||||
fmt.Printf(" 鈥?Skills: %d/%d available\n", skillsInfo["available"], skillsInfo["total"])
|
||||
|
||||
logger.InfoCF("agent", logger.C0098,
|
||||
map[string]interface{}{
|
||||
@@ -19,14 +19,14 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"clawgo/pkg/agent"
|
||||
"clawgo/pkg/bus"
|
||||
"clawgo/pkg/config"
|
||||
"clawgo/pkg/cron"
|
||||
"clawgo/pkg/nodes"
|
||||
"clawgo/pkg/providers"
|
||||
"clawgo/pkg/runtimecfg"
|
||||
"clawgo/pkg/tools"
|
||||
"github.com/YspCoder/clawgo/pkg/agent"
|
||||
"github.com/YspCoder/clawgo/pkg/bus"
|
||||
"github.com/YspCoder/clawgo/pkg/config"
|
||||
"github.com/YspCoder/clawgo/pkg/cron"
|
||||
"github.com/YspCoder/clawgo/pkg/nodes"
|
||||
"github.com/YspCoder/clawgo/pkg/providers"
|
||||
"github.com/YspCoder/clawgo/pkg/runtimecfg"
|
||||
"github.com/YspCoder/clawgo/pkg/tools"
|
||||
"github.com/gorilla/websocket"
|
||||
"github.com/pion/webrtc/v4"
|
||||
)
|
||||
@@ -151,11 +151,11 @@ func nodeRegisterCmd(args []string) {
|
||||
fmt.Printf("Error registering node: %v\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
fmt.Printf("✓ Node registered: %s -> %s\n", info.ID, opts.GatewayBase)
|
||||
fmt.Printf("鉁?Node registered: %s -> %s\n", info.ID, opts.GatewayBase)
|
||||
if !opts.Watch {
|
||||
return
|
||||
}
|
||||
fmt.Printf("✓ Heartbeat loop started: every %ds\n", opts.HeartbeatSec)
|
||||
fmt.Printf("鉁?Heartbeat loop started: every %ds\n", opts.HeartbeatSec)
|
||||
if err := runNodeHeartbeatLoop(client, opts, info); err != nil {
|
||||
fmt.Printf("Heartbeat loop stopped: %v\n", err)
|
||||
os.Exit(1)
|
||||
@@ -175,7 +175,7 @@ func nodeHeartbeatCmd(args []string) {
|
||||
fmt.Printf("Error sending heartbeat: %v\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
fmt.Printf("✓ Heartbeat sent: %s -> %s\n", opts.ID, opts.GatewayBase)
|
||||
fmt.Printf("鉁?Heartbeat sent: %s -> %s\n", opts.ID, opts.GatewayBase)
|
||||
}
|
||||
|
||||
func parseNodeRegisterArgs(args []string, cfg *config.Config) (nodeRegisterOptions, error) {
|
||||
@@ -409,23 +409,23 @@ func runNodeHeartbeatLoop(client *http.Client, opts nodeRegisterOptions, info no
|
||||
for {
|
||||
if err := runNodeHeartbeatSocket(ctx, opts, info); err != nil {
|
||||
if ctx.Err() != nil {
|
||||
fmt.Println("✓ Node heartbeat stopped")
|
||||
fmt.Println("鉁?Node heartbeat stopped")
|
||||
return nil
|
||||
}
|
||||
fmt.Printf("Warning: node socket closed for %s: %v\n", info.ID, err)
|
||||
}
|
||||
if ctx.Err() != nil {
|
||||
fmt.Println("✓ Node heartbeat stopped")
|
||||
fmt.Println("鉁?Node heartbeat stopped")
|
||||
return nil
|
||||
}
|
||||
if regErr := postNodeRegister(ctx, client, opts.GatewayBase, opts.Token, info); regErr != nil {
|
||||
fmt.Printf("Warning: re-register failed for %s: %v\n", info.ID, regErr)
|
||||
} else {
|
||||
fmt.Printf("✓ Node re-registered: %s\n", info.ID)
|
||||
fmt.Printf("鉁?Node re-registered: %s\n", info.ID)
|
||||
}
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
fmt.Println("✓ Node heartbeat stopped")
|
||||
fmt.Println("鉁?Node heartbeat stopped")
|
||||
return nil
|
||||
case <-time.After(2 * time.Second):
|
||||
}
|
||||
@@ -466,7 +466,7 @@ func runNodeHeartbeatSocket(ctx context.Context, opts nodeRegisterOptions, info
|
||||
if err := waitNodeAck(ctx, acks, errs, "registered", info.ID); err != nil {
|
||||
return err
|
||||
}
|
||||
fmt.Printf("✓ Node socket connected: %s\n", info.ID)
|
||||
fmt.Printf("鉁?Node socket connected: %s\n", info.ID)
|
||||
|
||||
ticker := time.NewTicker(time.Duration(opts.HeartbeatSec) * time.Second)
|
||||
pingTicker := time.NewTicker(nodeSocketPingInterval(opts.HeartbeatSec))
|
||||
@@ -493,7 +493,7 @@ func runNodeHeartbeatSocket(ctx context.Context, opts nodeRegisterOptions, info
|
||||
if err := waitNodeAck(ctx, acks, errs, "heartbeat", info.ID); err != nil {
|
||||
return err
|
||||
}
|
||||
fmt.Printf("✓ Heartbeat ok: %s\n", info.ID)
|
||||
fmt.Printf("鉁?Heartbeat ok: %s\n", info.ID)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,10 +11,10 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"clawgo/pkg/agent"
|
||||
"clawgo/pkg/config"
|
||||
"clawgo/pkg/nodes"
|
||||
"clawgo/pkg/providers"
|
||||
"github.com/YspCoder/clawgo/pkg/agent"
|
||||
"github.com/YspCoder/clawgo/pkg/config"
|
||||
"github.com/YspCoder/clawgo/pkg/nodes"
|
||||
"github.com/YspCoder/clawgo/pkg/providers"
|
||||
)
|
||||
|
||||
type stubNodeProvider struct {
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"clawgo/pkg/config"
|
||||
"github.com/YspCoder/clawgo/pkg/config"
|
||||
)
|
||||
|
||||
type onboardOptions struct {
|
||||
@@ -3,7 +3,7 @@ package main
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"clawgo/pkg/config"
|
||||
"github.com/YspCoder/clawgo/pkg/config"
|
||||
)
|
||||
|
||||
func TestParseOnboardOptionsSyncWebUI(t *testing.T) {
|
||||
@@ -8,8 +8,8 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"clawgo/pkg/config"
|
||||
"clawgo/pkg/skills"
|
||||
"github.com/YspCoder/clawgo/pkg/config"
|
||||
"github.com/YspCoder/clawgo/pkg/skills"
|
||||
)
|
||||
|
||||
func skillsCmd() {
|
||||
@@ -8,8 +8,8 @@ import (
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
"clawgo/pkg/nodes"
|
||||
"clawgo/pkg/providers"
|
||||
"github.com/YspCoder/clawgo/pkg/nodes"
|
||||
"github.com/YspCoder/clawgo/pkg/providers"
|
||||
)
|
||||
|
||||
func statusCmd() {
|
||||
@@ -24,16 +24,16 @@ func statusCmd() {
|
||||
fmt.Printf("%s clawgo Status\n\n", logo)
|
||||
|
||||
if _, err := os.Stat(configPath); err == nil {
|
||||
fmt.Println("Config:", configPath, "✓")
|
||||
fmt.Println("Config:", configPath, "[ok]")
|
||||
} else {
|
||||
fmt.Println("Config:", configPath, "✗")
|
||||
fmt.Println("Config:", configPath, "[missing]")
|
||||
}
|
||||
|
||||
workspace := cfg.WorkspacePath()
|
||||
if _, err := os.Stat(workspace); err == nil {
|
||||
fmt.Println("Workspace:", workspace, "✓")
|
||||
fmt.Println("Workspace:", workspace, "[ok]")
|
||||
} else {
|
||||
fmt.Println("Workspace:", workspace, "✗")
|
||||
fmt.Println("Workspace:", workspace, "[missing]")
|
||||
}
|
||||
|
||||
if _, err := os.Stat(configPath); err == nil {
|
||||
@@ -59,7 +59,7 @@ func statusCmd() {
|
||||
hasKey := strings.TrimSpace(activeProvider.APIKey) != ""
|
||||
status := "not set"
|
||||
if hasKey {
|
||||
status = "✓"
|
||||
status = "configured"
|
||||
}
|
||||
fmt.Printf("Provider API Key: %s\n", status)
|
||||
fmt.Printf("Logging: %v\n", cfg.Logging.Enabled)
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"clawgo/pkg/config"
|
||||
"github.com/YspCoder/clawgo/pkg/config"
|
||||
)
|
||||
|
||||
func TestStatusCmdUsesActiveProviderDetails(t *testing.T) {
|
||||
@@ -71,7 +71,7 @@ func TestStatusCmdUsesActiveProviderDetails(t *testing.T) {
|
||||
if !strings.Contains(out, "Provider API Base: https://backup.example/v1") {
|
||||
t.Fatalf("expected active provider api base in output, got: %s", out)
|
||||
}
|
||||
if !strings.Contains(out, "Provider API Key: ✓") {
|
||||
if !strings.Contains(out, "Provider API Key: configured") {
|
||||
t.Fatalf("expected active provider api key status in output, got: %s", out)
|
||||
}
|
||||
if !strings.Contains(out, "Nodes P2P: enabled=true transport=webrtc") {
|
||||
@@ -12,8 +12,8 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"clawgo/pkg/config"
|
||||
"clawgo/pkg/logger"
|
||||
"github.com/YspCoder/clawgo/pkg/config"
|
||||
"github.com/YspCoder/clawgo/pkg/logger"
|
||||
)
|
||||
|
||||
//go:embed workspace
|
||||
@@ -22,7 +22,7 @@ var embeddedFiles embed.FS
|
||||
var version = "dev"
|
||||
var buildTime = "unknown"
|
||||
|
||||
const logo = "🦞"
|
||||
const logo = "馃"
|
||||
const gatewayServiceName = "clawgo-gateway.service"
|
||||
const envRootGranted = "CLAWGO_ROOT_GRANTED"
|
||||
|
||||
Reference in New Issue
Block a user