fix(daemon): remove dead code and improve UX feedback
Remove unused ListWorkspaces/Workspace from daemon client, add log when default workspace is set implicitly, document token reload limitation. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
e4a905c841
commit
e263064e87
3 changed files with 3 additions and 15 deletions
|
|
@ -123,6 +123,7 @@ func runWatch(cmd *cobra.Command, args []string) error {
|
|||
|
||||
if cfg.WorkspaceID == "" {
|
||||
cfg.WorkspaceID = ws.ID
|
||||
fmt.Fprintf(os.Stderr, "Set default workspace to %s (%s)\n", ws.ID, ws.Name)
|
||||
}
|
||||
|
||||
if err := cli.SaveCLIConfig(cfg); err != nil {
|
||||
|
|
|
|||
|
|
@ -36,12 +36,6 @@ func isWorkspaceNotFoundError(err error) bool {
|
|||
return strings.Contains(strings.ToLower(reqErr.Body), "workspace not found")
|
||||
}
|
||||
|
||||
// Workspace represents a workspace from the API.
|
||||
type Workspace struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
// Client handles HTTP communication with the Multica server daemon API.
|
||||
type Client struct {
|
||||
baseURL string
|
||||
|
|
@ -62,15 +56,6 @@ func (c *Client) SetToken(token string) {
|
|||
c.token = token
|
||||
}
|
||||
|
||||
// ListWorkspaces fetches the user's workspaces using the auth token.
|
||||
func (c *Client) ListWorkspaces(ctx context.Context) ([]Workspace, error) {
|
||||
var ws []Workspace
|
||||
if err := c.getJSON(ctx, "/api/workspaces", &ws); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return ws, nil
|
||||
}
|
||||
|
||||
func (c *Client) ClaimTask(ctx context.Context, runtimeID string) (*Task, error) {
|
||||
var resp struct {
|
||||
Task *Task `json:"task"`
|
||||
|
|
|
|||
|
|
@ -204,6 +204,8 @@ func (d *Daemon) configWatchLoop(ctx context.Context) {
|
|||
}
|
||||
|
||||
// reloadWorkspaces reconciles the active workspace set with the config file.
|
||||
// NOTE: Token changes (e.g. re-login as a different user) are not picked up;
|
||||
// the daemon must be restarted for a new auth token to take effect.
|
||||
func (d *Daemon) reloadWorkspaces(ctx context.Context) {
|
||||
d.reloading.Lock()
|
||||
defer d.reloading.Unlock()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue