Skip to content

Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.

Go

feat(cli): support app_url in CLI config (#186)

LinYushen40aa3f6bd9bb
diff --git a/server/cmd/multica/cmd_auth.go b/server/cmd/multica/cmd_auth.go
index ab5251f179..e053c10325 100644
--- a/server/cmd/multica/cmd_auth.go
+++ b/server/cmd/multica/cmd_auth.go
@@ -66,6 +66,10 @@ func resolveAppURL() string {
return strings.TrimRight(val, "/")
}
}
+ cfg, err := cli.LoadCLIConfig()
+ if err == nil && cfg.AppURL != "" {
+ return strings.TrimRight(cfg.AppURL, "/")
+ }
return "http://localhost:3000"
}
@@ -203,6 +207,7 @@ func runAuthLoginBrowser(cmd *cobra.Command) error {
cfg, _ := cli.LoadCLIConfig()
cfg.Token = patResp.Token
cfg.ServerURL = serverURL
+ cfg.AppURL = appURL
if err := cli.SaveCLIConfig(cfg); err != nil {
return fmt.Errorf("failed to save config: %w", err)
}
diff --git a/server/cmd/multica/cmd_config.go b/server/cmd/multica/cmd_config.go
index 585a4ab1a9..96e5b3e558 100644
--- a/server/cmd/multica/cmd_config.go
+++ b/server/cmd/multica/cmd_config.go
@@ -24,7 +24,7 @@ var configShowCmd = &cobra.Command{
var configSetCmd = &cobra.Command{
Use: "set <key> <value>",
Short: "Set a CLI configuration value",
- Long: "Supported keys: server_url, workspace_id",
+ Long: "Supported keys: server_url, app_url, workspace_id",
Args: cobra.ExactArgs(2),
RunE: runConfigSet,
}
@@ -43,6 +43,7 @@ func runConfigShow(_ *cobra.Command, _ []string) error {
path, _ := cli.CLIConfigPath()
fmt.Fprintf(os.Stdout, "Config file: %s\n", path)
fmt.Fprintf(os.Stdout, "server_url: %s\n", valueOrDefault(cfg.ServerURL, "(not set)"))
+ fmt.Fprintf(os.Stdout, "app_url: %s\n", valueOrDefault(cfg.AppURL, "(not set)"))
fmt.Fprintf(os.Stdout, "workspace_id: %s\n", valueOrDefault(cfg.WorkspaceID, "(not set)"))
return nil
}
@@ -58,10 +59,12 @@ func runConfigSet(_ *cobra.Command, args []string) error {
switch key {
case "server_url":
cfg.ServerURL = value
+ case "app_url":
+ cfg.AppURL = value
case "workspace_id":
cfg.WorkspaceID = value
default:
- return fmt.Errorf("unknown config key %q (supported: server_url, workspace_id)", key)
+ return fmt.Errorf("unknown config key %q (supported: server_url, app_url, workspace_id)", key)
}
if err := cli.SaveCLIConfig(cfg); err != nil {
diff --git a/server/internal/cli/config.go b/server/internal/cli/config.go
index f9f390e446..31bf624031 100644
--- a/server/internal/cli/config.go
+++ b/server/internal/cli/config.go
@@ -19,6 +19,7 @@ type WatchedWorkspace struct {
// CLIConfig holds persistent CLI settings.
type CLIConfig struct {
ServerURL string `json:"server_url,omitempty"`
+ AppURL string `json:"app_url,omitempty"`
WorkspaceID string `json:"workspace_id,omitempty"`
Token string `json:"token,omitempty"`
WatchedWorkspaces []WatchedWorkspace `json:"watched_workspaces,omitempty"`