Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
MUL-8854 feat(cli,workflows): carry status icon through new_status and issue-status (#10220)
Miran668c0c9f7027
diff --git a/apps/docs/content/docs/cli.mdx b/apps/docs/content/docs/cli.mdxindex 07696b4280..ef7e8add8a 100644--- a/apps/docs/content/docs/cli.mdx+++ b/apps/docs/content/docs/cli.mdx@@ -313,6 +313,7 @@ multica autopilot trigger-add <autopilot-id> --cron "0 9 * * 1" --timezone Europ| `issue` | Create, update, assign, and search issues; manage comments, subscribers, labels, properties, wakeups, the timeline, and runs || `project` | Manage projects, their resources, and the workflow they use || `workflow` | Manage issue workflows: statuses and who handles each one |+| `issue-status` | Manage the workspace status catalog: statuses, their color, and their icon || `label`, `property` | Manage workspace labels and custom properties || `view` | Read saved issue views and list the issues a view shows || `agent`, `skill`, `squad` | Manage agents, skills, and squads |@@ -414,8 +415,9 @@ Migration from CSV parsing: replace `--attachment a,b` with `--attachment a --at| | `status <id> <status>` | Change project status | || | `resource list/add/update/remove` | Manage project resources | `--type`, `--url`, `--default-branch-hint`, `--ref`, `--local-path`, `--daemon-id`, `--execution-mode` (`in_place` / `worktree` for a local directory) || | `workflow get/set <project-id>` | Show the project's effective workflow, or switch it | `set <project-id> <workflow\|default>`: `--map old=new` (repeatable), `--dry-run` prints the status migration plan; the switch neither reassigns issues nor starts runs. Admins and the project lead only |-| `workflow` | `list/get/create/update/delete` | Manage workflows; `get` and other commands accept an ID, ID prefix, exact name, or `default` | `create` / `update`: `--name`, `--description`, `--steps-file` (JSON array of steps; replaces all steps); `update`: `--map old=new` (repeatable), `--dry-run`. Edits and deletes are limited to the workflow owner and workspace admins; a workflow still used by a project cannot be deleted |+| `workflow` | `list/get/create/update/delete` | Manage workflows; `get` and other commands accept an ID, ID prefix, exact name, or `default`. Statuses a workflow declares are workspace catalog entries, edited with `issue-status` | `create` / `update`: `--name`, `--description`, `--steps-file` (JSON array of steps; replaces all steps); `update`: `--map old=new` (repeatable), `--dry-run`. Edits and deletes are limited to the workflow owner and workspace admins; a workflow still used by a project cannot be deleted || | `handoff set <workflow> <status-key>` | Set one step's handler, instructions, and next/back status; unchanged fields are kept | `--handler` (`none`, `project_lead`, `creator`, or a member/agent/squad name or UUID), `--instructions` / `--instructions-file`, `--next`, `--back`, `--copy-for-project` |+| `issue-status` | `list/get/create/update/archive` | Manage the workspace status catalog — the statuses every workflow picks from. To change an issue's current status, use `issue status` | `create`: `--name`, `--category`, `--color`, `--key`, `--icon`; `update`: `--name`, `--description`, `--color`, `--icon` (empty resets to the category default), `--position`; `list`: `--include-archived`. Mutations require workspace owner/admin || `label` | `list/get/create/update/delete` | Manage workspace labels | `list`: `--resource-type` (`issue` or `skill`), `--full-id`; `create`: `--name`, `--color`, `--resource-type` (`issue` or `skill`), `--description` || `property` | `list/get/create/update/archive/unarchive` | Manage workspace custom properties | `create`: `--name`, `--type` (`text`, `number`, `select`, `multi_select`, `date`, `checkbox`, `url`, `actor`, `multi_actor`, `multi_text`, `multi_url`), `--option` (repeatable, select types only); `list`: `--include-archived`; the type cannot be changed after creation || `view` | `list/get/issues` | Read the saved views you can open (your own and workspace-shared ones); `issues` lists what a view shows, in its saved order, with every saved filter applied by the server. Inside an agent run, the views and any "my" conditions are the runtime owner's | `<view>` accepts an ID, ID prefix, or exact name; `list`: `--scope` (`workspace`, `my`, `project`), `--project`, `--full-id`; `issues`: `--limit` (at most 100), `--cursor` (the previous page's `next_cursor`), `--today` (the day relative due-date filters resolve against; default today), `--fields` (JSON only), `--full-id` |diff --git a/apps/docs/content/docs/cli.zh-Hant.mdx b/apps/docs/content/docs/cli.zh-Hant.mdxindex 9d8f2dfdbb..6ed953694b 100644--- a/apps/docs/content/docs/cli.zh-Hant.mdx+++ b/apps/docs/content/docs/cli.zh-Hant.mdx@@ -295,6 +295,7 @@ multica autopilot trigger-add <autopilot-id> --cron "0 9 * * 1" --timezone Asia/| `issue` | 建立、更新、分配和搜尋任務;管理評論、訂閱、標籤、屬性、喚醒、時間線與執行記錄 || `project` | 管理專案、專案資源和專案使用的工作流 || `workflow` | 管理工作流:狀態以及每個狀態交給誰處理 |+| `issue-status` | 管理工作區狀態目錄:狀態及其顏色和圖示 || `label`、`property` | 管理工作區標籤和自定義屬性 || `view` | 讀取儲存的檢視,列出檢視裡的任務 || `agent`、`skill`、`squad` | 管理 AI 代理、skill 和小隊 |@@ -388,8 +389,9 @@ CLI 配置檔案包含可代表你訪問 Multica 的令牌。不要提交到倉| | `status <id> <status>` | 修改專案狀態 | || | `resource list/add/update/remove` | 管理專案附加資源 | `--type`、`--url`、`--default-branch-hint`、`--ref`、`--local-path`、`--daemon-id`、`--execution-mode`(本地目錄的 `in_place` / `worktree`) || | `workflow get/set <project-id>` | 檢視專案當前生效的工作流,或切換工作流 | `set <project-id> <workflow\|default>`:`--map old=new`(可重複),`--dry-run` 列印狀態遷移計劃;切換不會重新分配任務,也不會啟動執行。僅管理員和專案負責人可操作 |-| `workflow` | `list/get/create/update/delete` | 管理工作流;`get` 等命令接受 ID、ID 字首、完整名稱或 `default` | `create` / `update`:`--name`、`--description`、`--steps-file`(步驟的 JSON 陣列,整體替換);`update`:`--map old=new`(可重複)、`--dry-run`。編輯和刪除僅限工作流所有者和工作區管理員;仍被專案使用的工作流不能刪除 |+| `workflow` | `list/get/create/update/delete` | 管理工作流;`get` 等命令接受 ID、ID 字首、完整名稱或 `default`。工作流宣告的狀態屬於工作區狀態目錄,用 `issue-status` 修改 | `create` / `update`:`--name`、`--description`、`--steps-file`(步驟的 JSON 陣列,整體替換);`update`:`--map old=new`(可重複)、`--dry-run`。編輯和刪除僅限工作流所有者和工作區管理員;仍被專案使用的工作流不能刪除 || | `handoff set <workflow> <status-key>` | 設定單個步驟的處理人、說明和下一步/退回狀態,未指定的欄位保持不變 | `--handler`(`none`、`project_lead`、`creator`,或成員/ AI 代理/小隊的名稱或 UUID)、`--instructions` / `--instructions-file`、`--next`、`--back`、`--copy-for-project` |+| `issue-status` | `list/get/create/update/archive` | 管理工作區狀態目錄,即所有工作流共用的狀態。修改任務目前狀態請用 `issue status` | `create`:`--name`、`--category`、`--color`、`--key`、`--icon`;`update`:`--name`、`--description`、`--color`、`--icon`(空值恢復為分類預設圖示)、`--position`;`list`:`--include-archived`。變更需要工作區擁有者或管理員權限 || `label` | `list/get/create/update/delete` | 管理工作區標籤 | `list`:`--resource-type`(`issue` 或 `skill`)、`--full-id`;`create`:`--name`、`--color`、`--resource-type`(`issue` 或 `skill`)、`--description` || `property` | `list/get/create/update/archive/unarchive` | 管理工作區自定義屬性 | `create`:`--name`、`--type`(`text`、`number`、`select`、`multi_select`、`date`、`checkbox`、`url`、`actor`、`multi_actor`、`multi_text`、`multi_url`)、`--option`(可重複,僅 select 型別);`list`:`--include-archived`;型別建立後不可修改 || `view` | `list/get/issues` | 讀取你能開啟的檢視(自己的和工作區共享的);`issues` 按檢視儲存的排序列出檢視裡的任務,檢視儲存的全部篩選條件都由服務端執行。在 AI 代理執行中,看到的檢視和其中「我的」條件都屬於執行時的所有者 | `<view>` 接受 ID、ID 字首或完整名稱;`list`:`--scope`(`workspace`、`my`、`project`)、`--project`、`--full-id`;`issues`:`--limit`(最多 100)、`--cursor`(上一頁的 `next_cursor`)、`--today`(相對到期日篩選按哪一天計算,預設今天)、`--fields`(僅 JSON)、`--full-id` |diff --git a/apps/docs/content/docs/cli.zh.mdx b/apps/docs/content/docs/cli.zh.mdxindex c9bd57a3d7..8a18747d3f 100644--- a/apps/docs/content/docs/cli.zh.mdx+++ b/apps/docs/content/docs/cli.zh.mdx@@ -298,6 +298,7 @@ multica autopilot trigger-add <autopilot-id> --cron "0 9 * * 1" --timezone Asia/| `issue` | 创建、更新、分配和搜索任务;管理评论、订阅、标签、属性、唤醒、时间线与执行记录 || `project` | 管理项目、项目资源和项目使用的工作流 || `workflow` | 管理工作流:状态以及每个状态交给谁处理 |+| `issue-status` | 管理工作区状态目录:状态及其颜色和图标 || `label`、`property` | 管理工作区标签和自定义属性 || `view` | 读取保存的视图,列出视图里的任务 || `agent`、`skill`、`squad` | 管理智能体、skill 和小队 |@@ -391,8 +392,9 @@ CLI 配置文件包含可代表你访问 Multica 的令牌。不要提交到仓| | `status <id> <status>` | 修改项目状态 | || | `resource list/add/update/remove` | 管理项目附加资源 | `--type`、`--url`、`--default-branch-hint`、`--ref`、`--local-path`、`--daemon-id`、`--execution-mode`(本地目录的 `in_place` / `worktree`) || | `workflow get/set <project-id>` | 查看项目当前生效的工作流,或切换工作流 | `set <project-id> <workflow\|default>`:`--map old=new`(可重复),`--dry-run` 打印状态迁移计划;切换不会重新分配任务,也不会启动运行。仅管理员和项目负责人可操作 |-| `workflow` | `list/get/create/update/delete` | 管理工作流;`get` 等命令接受 ID、ID 前缀、完整名称或 `default` | `create` / `update`:`--name`、`--description`、`--steps-file`(步骤的 JSON 数组,整体替换);`update`:`--map old=new`(可重复)、`--dry-run`。编辑和删除仅限工作流所有者和工作区管理员;仍被项目使用的工作流不能删除 |+| `workflow` | `list/get/create/update/delete` | 管理工作流;`get` 等命令接受 ID、ID 前缀、完整名称或 `default`。工作流声明的状态属于工作区状态目录,用 `issue-status` 修改 | `create` / `update`:`--name`、`--description`、`--steps-file`(步骤的 JSON 数组,整体替换);`update`:`--map old=new`(可重复)、`--dry-run`。编辑和删除仅限工作流所有者和工作区管理员;仍被项目使用的工作流不能删除 || | `handoff set <workflow> <status-key>` | 设置单个步骤的处理人、说明和下一步/退回状态,未指定的字段保持不变 | `--handler`(`none`、`project_lead`、`creator`,或成员/智能体/小队的名称或 UUID)、`--instructions` / `--instructions-file`、`--next`、`--back`、`--copy-for-project` |+| `issue-status` | `list/get/create/update/archive` | 管理工作区状态目录,即所有工作流共用的状态。修改任务当前状态请用 `issue status` | `create`:`--name`、`--category`、`--color`、`--key`、`--icon`;`update`:`--name`、`--description`、`--color`、`--icon`(空值恢复为分类默认图标)、`--position`;`list`:`--include-archived`。变更需要工作区所有者或管理员权限 || `label` | `list/get/create/update/delete` | 管理工作区标签 | `list`:`--resource-type`(`issue` 或 `skill`)、`--full-id`;`create`:`--name`、`--color`、`--resource-type`(`issue` 或 `skill`)、`--description` || `property` | `list/get/create/update/archive/unarchive` | 管理工作区自定义属性 | `create`:`--name`、`--type`(`text`、`number`、`select`、`multi_select`、`date`、`checkbox`、`url`、`actor`、`multi_actor`、`multi_text`、`multi_url`)、`--option`(可重复,仅 select 类型);`list`:`--include-archived`;类型创建后不可修改 || `view` | `list/get/issues` | 读取你能打开的视图(自己的和工作区共享的);`issues` 按视图保存的排序列出视图里的任务,视图保存的全部筛选条件都由服务端执行。在智能体运行中,看到的视图和其中「我的」条件都属于运行时的所有者 | `<view>` 接受 ID、ID 前缀或完整名称;`list`:`--scope`(`workspace`、`my`、`project`)、`--project`、`--full-id`;`issues`:`--limit`(最多 100)、`--cursor`(上一页的 `next_cursor`)、`--today`(相对到期日筛选按哪一天计算,默认今天)、`--fields`(仅 JSON)、`--full-id` |diff --git a/packages/core/types/issue-workflow.ts b/packages/core/types/issue-workflow.tsindex 59fd32577f..7ab844e126 100644--- a/packages/core/types/issue-workflow.ts+++ b/packages/core/types/issue-workflow.ts@@ -10,6 +10,8 @@* none use the workspace's Default workflow.*/+import type { IssueStatusIcon } from "./issue-status";+export type IssueWorkflowHandlerType =| "none"| "agent"@@ -61,6 +63,8 @@ export interface NewWorkflowStatus {name: string;category?: string;color?: string;+ /** Presentation-only; empty/absent keeps the category default. */+ icon?: IssueStatusIcon | "";}/** A column of a workflow write: an existing status or a new one, with its handoff. */diff --git a/server/cmd/multica/cmd_issue_status.go b/server/cmd/multica/cmd_issue_status.gonew file mode 100644index 0000000000..66d127b0e5--- /dev/null+++ b/server/cmd/multica/cmd_issue_status.go@@ -0,0 +1,378 @@+package main++import (+ "context"+ "fmt"+ "os"+ "strings"++ "github.com/spf13/cobra"++ "github.com/multica-ai/multica/server/internal/cli"+)++// multica issue-status {list|get|create|update|archive} — the workspace status+// catalog. A status is workspace-shared workflow configuration: every workflow+// picks from the same catalog, and archiving one is refused while any workflow+// still uses it. `multica workflow` DECLARES statuses through its steps file;+// these commands edit the catalog itself, including statuses a workspace+// synced before the declaration carried all of their fields.+//+// The command is top-level rather than `multica workflow status` because the+// resource is not owned by a workflow: the API routes it at /api/issue-statuses+// and a subcommand would take no workflow argument. The one cost is the hyphen+// against `multica issue status <id> <status>`, which changes an issue's+// CURRENT status; the Long help names that other command.+//+// Statuses are addressed by key, name, or id; the CLI resolves name/key to the+// id the API expects. Icon values are validated by the server (presentation+// only: dotted, circle, half, three_quarters, check, slash, cross; empty keeps+// the category default).++type issueStatusDTO struct {+ ID string `json:"id"`+ Key string `json:"key"`+ Name string `json:"name"`+ Description string `json:"description"`+ Category string `json:"category"`+ Color string `json:"color"`+ Icon string `json:"icon"`+ IsSystem bool `json:"is_system"`+ Position float64 `json:"position"`+ ArchivedAt *string `json:"archived_at"`+ CreatedAt string `json:"created_at"`+ UpdatedAt string `json:"updated_at"`+}++var issueStatusCatalogCmd = &cobra.Command{+ Use: "issue-status",+ Short: "Manage the workspace status catalog (statuses and their icons)",+ Long: `Manage the workspace status catalog: the statuses every workflow picks from.++This edits the catalog. To change an issue's CURRENT status, use+'multica issue status <issue-id> <status>'. Mutations require workspace+owner/admin; reading is open to every member.++References accept a key, ID, or name. Names prefer active statuses;+ambiguous names require a key or ID.++Icon values are presentation-only: dotted, circle, half, three_quarters,+check, slash, cross. Empty keeps the category default.`,+}++var issueStatusCatalogListCmd = &cobra.Command{+ Use: "list",+ Short: "List the workspace status catalog",+ Args: exactArgs(0),+ RunE: runIssueStatusList,+}++var issueStatusCatalogGetCmd = &cobra.Command{+ Use: "get <key-or-name>",+ Short: "Show one status",+ Args: exactArgs(1),+ RunE: runIssueStatusGet,+}++var issueStatusCatalogCreateCmd = &cobra.Command{+ Use: "create",+ Short: "Create a status (workspace owner/admin only)",+ Long: `Create a custom status in the workspace catalog.++ multica issue-status create --name "Spec review" --category started \+ --color "#3b82f6" --icon three_quarters++The key is derived from the name; pass --key to pin it. Icon is optional and+presentation-only. Creating a status also adds it to the Default workflow.`,+ Args: exactArgs(0),+ RunE: runIssueStatusCreate,+}++var issueStatusCatalogUpdateCmd = &cobra.Command{+ Use: "update <key-or-name>",+ Short: "Update a status's name, description, color, icon, or position (owner/admin only)",+ Long: `Update a custom status's presentation. Category and key are immutable.++ multica issue-status update spec_review --icon three_quarters+ multica issue-status update spec_review --icon "" # back to the category default++Built-in statuses cannot be modified.`,+ Args: exactArgs(1),+ RunE: runIssueStatusUpdate,+}++var issueStatusCatalogArchiveCmd = &cobra.Command{+ Use: "archive <key-or-name>",+ Short: "Archive a status (owner/admin only; refused while a workflow uses it)",+ Args: exactArgs(1),+ RunE: runIssueStatusArchive,+}++func init() {+ issueStatusCatalogCmd.AddCommand(issueStatusCatalogListCmd)+ issueStatusCatalogCmd.AddCommand(issueStatusCatalogGetCmd)+ issueStatusCatalogCmd.AddCommand(issueStatusCatalogCreateCmd)+ issueStatusCatalogCmd.AddCommand(issueStatusCatalogUpdateCmd)+ issueStatusCatalogCmd.AddCommand(issueStatusCatalogArchiveCmd)++ issueStatusCatalogListCmd.Flags().String("output", "table", "Output format: table or json")+ issueStatusCatalogListCmd.Flags().Bool("include-archived", false, "Include archived statuses")+ issueStatusCatalogGetCmd.Flags().String("output", "table", "Output format: table or json")++ issueStatusCatalogCreateCmd.Flags().String("output", "table", "Output format: table or json")+ issueStatusCatalogCreateCmd.Flags().String("name", "", "Status name (required)")+ issueStatusCatalogCreateCmd.Flags().String("category", "", "Category: backlog, unstarted, started, done, or closed (required)")+ issueStatusCatalogCreateCmd.Flags().String("color", "", "Hex color like #3b82f6 (required)")+ issueStatusCatalogCreateCmd.Flags().String("key", "", "Stable key, derived from --name when omitted; immutable afterwards")+ issueStatusCatalogCreateCmd.Flags().String("description", "", "Status description")+ issueStatusCatalogCreateCmd.Flags().String("icon", "", "Icon: dotted, circle, half, three_quarters, check, slash, cross (empty: category default)")++ issueStatusCatalogUpdateCmd.Flags().String("output", "table", "Output format: table or json")+ issueStatusCatalogUpdateCmd.Flags().String("name", "", "New name")+ issueStatusCatalogUpdateCmd.Flags().String("description", "", "New description")+ issueStatusCatalogUpdateCmd.Flags().String("color", "", "New hex color")+ issueStatusCatalogUpdateCmd.Flags().String("icon", "", "New icon; an empty value resets it to the category default")+ issueStatusCatalogUpdateCmd.Flags().Float64("position", 0, "New ordering position within the category")++ issueStatusCatalogArchiveCmd.Flags().String("output", "table", "Output format: table or json")+}++func fetchIssueStatuses(ctx context.Context, client *cli.APIClient, includeArchived bool) ([]issueStatusDTO, error) {+ path := "/api/issue-statuses"+ if includeArchived {+ path += "?include_archived=true"+ }+ var result struct {+ Statuses []issueStatusDTO `json:"statuses"`+ }+ if err := client.GetJSON(ctx, path, &result); err != nil {+ return nil, fmt.Errorf("list issue statuses: %w", err)+ }+ return result.Statuses, nil+}++// resolveIssueStatusRef matches an id, a key, or a name. Key wins over name+// because the key is what agent instructions and workflows reference; the+// API path uses the id. Names prefer active statuses, since an archived name+// can be reused, and must identify a single status within the preferred set.+func resolveIssueStatusRef(statuses []issueStatusDTO, ref string) (issueStatusDTO, error) {+ trimmed := strings.TrimSpace(ref)+ for _, s := range statuses {+ if s.ID == trimmed {+ return s, nil+ }+ }+ for _, s := range statuses {+ if strings.EqualFold(s.Key, trimmed) {+ return s, nil+ }+ }+ var active, archived []issueStatusDTO+ for _, s := range statuses {+ if !strings.EqualFold(s.Name, trimmed) {+ continue+ }+ if s.ArchivedAt == nil {+ active = append(active, s)+ } else {+ archived = append(archived, s)+ }+ }+ matches := active+ if len(matches) == 0 {+ matches = archived+ }+ if len(matches) == 1 {+ return matches[0], nil+ }+ if len(matches) > 1 {+ keys := make([]string, 0, len(matches))+ for _, s := range matches {+ keys = append(keys, s.Key)+ }+ return issueStatusDTO{}, fmt.Errorf("status name %q is ambiguous; use a key or ID: %s", ref, strings.Join(keys, ", "))+ }+ available := make([]string, 0, len(statuses))+ for _, s := range statuses {+ available = append(available, s.Key)+ }+ return issueStatusDTO{}, fmt.Errorf("status %q not found; available: %s", ref, strings.Join(available, ", "))+}++func printIssueStatusTable(statuses []issueStatusDTO) {+ headers := []string{"KEY", "NAME", "CATEGORY", "ICON", "COLOR", "ARCHIVED"}+ rows := make([][]string, 0, len(statuses))+ for _, s := range statuses {+ archived := ""+ if s.ArchivedAt != nil {+ archived = "yes"+ }+ rows = append(rows, []string{s.Key, s.Name, s.Category, s.Icon, s.Color, archived})+ }+ cli.PrintTable(os.Stdout, headers, rows)+}++func runIssueStatusList(cmd *cobra.Command, _ []string) error {+ client, err := newAPIClient(cmd)+ if err != nil {+ return err+ }+ ctx, cancel := cli.APIContext(context.Background())+ defer cancel()++ includeArchived, _ := cmd.Flags().GetBool("include-archived")+ statuses, err := fetchIssueStatuses(ctx, client, includeArchived)+ if err != nil {+ return err+ }+ if output, _ := cmd.Flags().GetString("output"); output == "json" {+ return cli.PrintJSON(os.Stdout, statuses)+ }+ printIssueStatusTable(statuses)+ return nil+}++func runIssueStatusGet(cmd *cobra.Command, args []string) error {+ client, err := newAPIClient(cmd)+ if err != nil {+ return err+ }+ ctx, cancel := cli.APIContext(context.Background())+ defer cancel()++ // Include archived: "get" must be able to explain a status an issue still+ // sits on, which is exactly the case an archived status produces.+ statuses, err := fetchIssueStatuses(ctx, client, true)+ if err != nil {+ return err+ }+ status, err := resolveIssueStatusRef(statuses, args[0])+ if err != nil {+ return err+ }+ if output, _ := cmd.Flags().GetString("output"); output == "json" {+ return cli.PrintJSON(os.Stdout, status)+ }+ printIssueStatusTable([]issueStatusDTO{status})+ return nil+}++func runIssueStatusCreate(cmd *cobra.Command, _ []string) error {+ name, _ := cmd.Flags().GetString("name")+ category, _ := cmd.Flags().GetString("category")+ color, _ := cmd.Flags().GetString("color")+ if strings.TrimSpace(name) == "" {+ return fmt.Errorf("--name is required")+ }+ if strings.TrimSpace(category) == "" {+ return fmt.Errorf("--category is required: backlog, unstarted, started, done, or closed")+ }+ if strings.TrimSpace(color) == "" {+ return fmt.Errorf("--color is required, for example #3b82f6")+ }+ key, _ := cmd.Flags().GetString("key")+ description, _ := cmd.Flags().GetString("description")+ icon, _ := cmd.Flags().GetString("icon")++ body := map[string]any{"name": name, "category": category, "color": color}+ if key != "" {+ body["key"] = key+ }+ if description != "" {+ body["description"] = description+ }+ if cmd.Flags().Changed("icon") {+ body["icon"] = icon+ }++ client, err := newAPIClient(cmd)+ if err != nil {+ return err+ }+ ctx, cancel := cli.APIContext(context.Background())+ defer cancel()++ var created issueStatusDTO+ if err := client.PostJSON(ctx, "/api/issue-statuses", body, &created); err != nil {+ return fmt.Errorf("create issue status: %w", err)+ }+ if output, _ := cmd.Flags().GetString("output"); output == "json" {+ return cli.PrintJSON(os.Stdout, created)+ }+ fmt.Fprintf(os.Stdout, "Status %q created.\n", created.Name)+ printIssueStatusTable([]issueStatusDTO{created})+ return nil+}++func runIssueStatusUpdate(cmd *cobra.Command, args []string) error {+ client, err := newAPIClient(cmd)+ if err != nil {+ return err+ }+ ctx, cancel := cli.APIContext(context.Background())+ defer cancel()++ statuses, err := fetchIssueStatuses(ctx, client, true)+ if err != nil {+ return err+ }+ status, err := resolveIssueStatusRef(statuses, args[0])+ if err != nil {+ return err+ }++ body := map[string]any{}+ for _, flag := range []string{"name", "description", "color", "icon"} {+ if cmd.Flags().Changed(flag) {+ value, _ := cmd.Flags().GetString(flag)+ body[flag] = value+ }+ }+ if cmd.Flags().Changed("position") {+ position, _ := cmd.Flags().GetFloat64("position")+ body["position"] = position+ }+ if len(body) == 0 {+ return fmt.Errorf("nothing to update; pass --name, --description, --color, --icon, or --position")+ }++ var updated issueStatusDTO+ if err := client.PatchJSON(ctx, "/api/issue-statuses/"+status.ID, body, &updated); err != nil {+ return fmt.Errorf("update issue status: %w", err)+ }+ if output, _ := cmd.Flags().GetString("output"); output == "json" {+ return cli.PrintJSON(os.Stdout, updated)+ }+ fmt.Fprintf(os.Stdout, "Status %q updated.\n", updated.Name)+ printIssueStatusTable([]issueStatusDTO{updated})+ return nil+}++func runIssueStatusArchive(cmd *cobra.Command, args []string) error {+ client, err := newAPIClient(cmd)+ if err != nil {+ return err+ }+ ctx, cancel := cli.APIContext(context.Background())+ defer cancel()++ statuses, err := fetchIssueStatuses(ctx, client, true)+ if err != nil {+ return err+ }+ status, err := resolveIssueStatusRef(statuses, args[0])+ if err != nil {+ return err+ }++ var archived issueStatusDTO+ if err := client.DeleteJSONResponse(ctx, "/api/issue-statuses/"+status.ID, &archived); err != nil {+ return fmt.Errorf("archive issue status: %w", err)+ }+ if output, _ := cmd.Flags().GetString("output"); output == "json" {+ return cli.PrintJSON(os.Stdout, archived)+ }+ fmt.Fprintf(os.Stdout, "Status %q archived.\n", archived.Name)+ printIssueStatusTable([]issueStatusDTO{archived})+ return nil+}diff --git a/server/cmd/multica/cmd_issue_status_test.go b/server/cmd/multica/cmd_issue_status_test.gonew file mode 100644index 0000000000..8303c05ca4--- /dev/null+++ b/server/cmd/multica/cmd_issue_status_test.go@@ -0,0 +1,390 @@+package main++import (+ "encoding/json"+ "net/http"+ "net/http/httptest"+ "strings"+ "testing"++ "github.com/spf13/cobra"+)++// issue-status CLI tests run against a fake catalog API: they assert the+// request shape (status addressed by key or name, icon sent even when empty)+// and the printed result, not the server's own validation.++type issueStatusTestServer struct {+ statuses []issueStatusDTO+ posts []map[string]any+ patches []map[string]any+ patchIDs []string+ deletes []string+}++func newIssueStatusTestServer(t *testing.T) *issueStatusTestServer {+ t.Helper()+ s := &issueStatusTestServer{statuses: []issueStatusDTO{+ {ID: "status-todo", Key: "todo", Name: "Todo", Category: "unstarted", Color: "#94a3b8", IsSystem: true},+ {ID: "status-spec-review", Key: "spec_review", Name: "Spec review", Category: "started", Color: "#3b82f6", Icon: "half"},+ {ID: "status-old", Key: "old_spec", Name: "Old spec", Category: "started", Color: "#3b82f6", ArchivedAt: ptrString("2026-11-01T00:00:00Z")},+ }}+ srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {+ switch {+ case r.Method == http.MethodGet && r.URL.Path == "/api/issue-statuses":+ includeArchived := r.URL.Query().Get("include_archived") == "true"+ out := make([]issueStatusDTO, 0, len(s.statuses))+ for _, status := range s.statuses {+ if status.ArchivedAt != nil && !includeArchived {+ continue+ }+ out = append(out, status)+ }+ _ = json.NewEncoder(w).Encode(map[string]any{"statuses": out, "total": len(out)})+ case r.Method == http.MethodPost && r.URL.Path == "/api/issue-statuses":+ var body map[string]any+ _ = json.NewDecoder(r.Body).Decode(&body)+ s.posts = append(s.posts, body)+ created := issueStatusDTO{ID: "status-new", Category: "started", Color: "#3b82f6"}+ if v, ok := body["name"].(string); ok {+ created.Name = v+ }+ if v, ok := body["category"].(string); ok {+ created.Category = v+ }+ if v, ok := body["icon"].(string); ok {+ created.Icon = v+ }+ created.Key = "new_status"+ _ = json.NewEncoder(w).Encode(created)+ case r.Method == http.MethodPatch && strings.HasPrefix(r.URL.Path, "/api/issue-statuses/"):+ id := strings.TrimPrefix(r.URL.Path, "/api/issue-statuses/")+ var body map[string]any+ _ = json.NewDecoder(r.Body).Decode(&body)+ s.patches = append(s.patches, body)+ s.patchIDs = append(s.patchIDs, id)+ updated := issueStatusDTO{}+ for _, status := range s.statuses {+ if status.ID == id {+ updated = status+ }+ }+ if v, ok := body["icon"].(string); ok {+ updated.Icon = v+ }+ if v, ok := body["name"].(string); ok {+ updated.Name = v+ }+ _ = json.NewEncoder(w).Encode(updated)+ case r.Method == http.MethodDelete && strings.HasPrefix(r.URL.Path, "/api/issue-statuses/"):+ id := strings.TrimPrefix(r.URL.Path, "/api/issue-statuses/")+ s.deletes = append(s.deletes, id)+ archived := issueStatusDTO{ID: id, ArchivedAt: ptrString("2026-11-09T00:00:00Z")}+ for _, status := range s.statuses {+ if status.ID == id {+ archived = status+ archived.ArchivedAt = ptrString("2026-11-09T00:00:00Z")+ }+ }+ _ = json.NewEncoder(w).Encode(archived)+ default:+ http.NotFound(w, r)+ }+ }))+ t.Cleanup(srv.Close)++ t.Setenv("MULTICA_SERVER_URL", srv.URL)+ t.Setenv("MULTICA_WORKSPACE_ID", "ws-1")+ t.Setenv("MULTICA_TOKEN", "mat_test-token")+ return s+}++func ptrString(v string) *string { return &v }++// issueStatusTestCmd mirrors the flags the real command registers, so a run+// function under test sees the same Changed() semantics.+func issueStatusTestCmd() *cobra.Command {+ cmd := &cobra.Command{Use: "issue-status"}+ cmd.Flags().String("output", "table", "")+ cmd.Flags().String("name", "", "")+ cmd.Flags().String("category", "", "")+ cmd.Flags().String("color", "", "")+ cmd.Flags().String("key", "", "")+ cmd.Flags().String("description", "", "")+ cmd.Flags().String("icon", "", "")+ cmd.Flags().Float64("position", 0, "")+ cmd.Flags().Bool("include-archived", false, "")+ return cmd+}++func TestIssueStatusResolveRef(t *testing.T) {+ archived := issueStatusDTO{ID: "status-old", Key: "old_spec", Name: "Spec review", ArchivedAt: ptrString("2026-11-01T00:00:00Z")}+ active := issueStatusDTO{ID: "status-current", Key: "spec_review", Name: "Spec review"}+ otherArchived := issueStatusDTO{ID: "status-older", Key: "older_spec", Name: "SPEC REVIEW", ArchivedAt: archived.ArchivedAt}+ otherActive := issueStatusDTO{ID: "status-other", Key: "other_spec", Name: "SPEC REVIEW"}+ for _, tt := range []struct {+ name string+ statuses []issueStatusDTO+ ref string+ wantID string+ wantKeys []string+ }{+ {name: "archived before active", statuses: []issueStatusDTO{archived, active}, ref: "Spec review", wantID: active.ID},+ {name: "active before archived", statuses: []issueStatusDTO{active, archived}, ref: "Spec review", wantID: active.ID},+ {name: "trimmed case insensitive name", statuses: []issueStatusDTO{archived, active}, ref: " SPEC REVIEW ", wantID: active.ID},+ {name: "single archived name", statuses: []issueStatusDTO{archived}, ref: "Spec review", wantID: archived.ID},+ {name: "archived ID", statuses: []issueStatusDTO{active, archived}, ref: archived.ID, wantID: archived.ID},+ {name: "archived key", statuses: []issueStatusDTO{active, archived}, ref: "OLD_SPEC", wantID: archived.ID},+ {name: "ID before name", statuses: []issueStatusDTO{{ID: "name-match", Name: archived.ID}, archived}, ref: archived.ID, wantID: archived.ID},+ {name: "key before name", statuses: []issueStatusDTO{{ID: "name-match", Name: archived.Key}, archived}, ref: archived.Key, wantID: archived.ID},+ {name: "multiple archived names", statuses: []issueStatusDTO{archived, otherArchived}, ref: "Spec review", wantKeys: []string{archived.Key, otherArchived.Key}},+ {name: "multiple active names", statuses: []issueStatusDTO{archived, active, otherActive}, ref: "Spec review", wantKeys: []string{active.Key, otherActive.Key}},+ } {+ t.Run(tt.name, func(t *testing.T) {+ got, err := resolveIssueStatusRef(tt.statuses, tt.ref)+ if len(tt.wantKeys) > 0 {+ if err == nil {+ t.Fatalf("resolved ambiguous name to %q; want an error", got.ID)+ }+ for _, text := range append(tt.wantKeys, "ambiguous", "key", "ID") {+ if !strings.Contains(err.Error(), text) {+ t.Errorf("error %q should contain %q", err, text)+ }+ }+ return+ }+ if err != nil || got.ID != tt.wantID {+ t.Fatalf("resolve %q = %q, %v; want %q", tt.ref, got.ID, err, tt.wantID)+ }+ })+ }+}++func TestIssueStatusMutationsByRecreatedName(t *testing.T) {+ for _, operation := range []struct {+ name string+ run func(*cobra.Command, []string) error+ }{+ {name: "update", run: runIssueStatusUpdate},+ {name: "archive", run: runIssueStatusArchive},+ } {+ t.Run(operation.name, func(t *testing.T) {+ api := newIssueStatusTestServer(t)+ api.statuses = []issueStatusDTO{+ {ID: "status-retired", Key: "spec_review", Name: "Spec review", ArchivedAt: ptrString("2026-11-01T00:00:00Z")},+ {ID: "status-current", Key: "spec_review_2", Name: "Spec review"},+ }+ cmd := issueStatusTestCmd()+ _ = cmd.Flags().Set("output", "json")+ _ = cmd.Flags().Set("icon", "three_quarters")+ out, err := captureStdout(t, func() error { return operation.run(cmd, []string{"Spec review"}) })+ if err != nil {+ t.Fatalf("%s: %v", operation.name, err)+ }+ var got issueStatusDTO+ if err := json.Unmarshal([]byte(out), &got); err != nil {+ t.Fatalf("unmarshal: %v\n%s", err, out)+ }+ if got.ID != "status-current" {+ t.Fatalf("%s selected %q, want status-current", operation.name, got.ID)+ }+ ids := api.patchIDs+ if operation.name == "archive" {+ ids = api.deletes+ }+ if len(ids) != 1 || ids[0] != "status-current" {+ t.Fatalf("%s targeted %v, want only status-current", operation.name, ids)+ }+ })+ t.Run(operation.name+" rejects ambiguous name", func(t *testing.T) {+ api := newIssueStatusTestServer(t)+ api.statuses = []issueStatusDTO{+ {ID: "status-retired", Key: "spec_review", Name: "Spec review", ArchivedAt: ptrString("2026-11-01T00:00:00Z")},+ {ID: "status-retired-again", Key: "spec_review_2", Name: "Spec review", ArchivedAt: ptrString("2026-11-02T00:00:00Z")},+ }+ cmd := issueStatusTestCmd()+ _ = cmd.Flags().Set("icon", "three_quarters")+ _, err := captureStdout(t, func() error { return operation.run(cmd, []string{"Spec review"}) })+ if err == nil || !strings.Contains(err.Error(), "ambiguous") {+ t.Fatalf("%s error = %v, want ambiguous name", operation.name, err)+ }+ if len(api.patches) != 0 || len(api.deletes) != 0 {+ t.Fatalf("ambiguous name caused mutations: patches=%v, deletes=%v", api.patches, api.deletes)+ }+ })+ }+}++func TestIssueStatusUpdateByKeySendsIcon(t *testing.T) {+ api := newIssueStatusTestServer(t)+ cmd := issueStatusTestCmd()+ _ = cmd.Flags().Set("output", "json")+ _ = cmd.Flags().Set("icon", "three_quarters")++ out, err := captureStdout(t, func() error { return runIssueStatusUpdate(cmd, []string{"spec_review"}) })+ if err != nil {+ t.Fatalf("runIssueStatusUpdate: %v", err)+ }+ if len(api.patches) != 1 {+ t.Fatalf("patches = %d, want 1", len(api.patches))+ }+ if got, _ := api.patches[0]["icon"].(string); got != "three_quarters" {+ t.Fatalf("icon = %q, want three_quarters", got)+ }+ var updated issueStatusDTO+ if err := json.Unmarshal([]byte(out), &updated); err != nil {+ t.Fatalf("unmarshal: %v\n%s", err, out)+ }+ if updated.Icon != "three_quarters" || updated.Key != "spec_review" {+ t.Fatalf("updated = %+v", updated)+ }+}++// An explicit empty --icon must reach the API: it is how a status is reset to+// the category default, distinct from not touching the icon at all.+func TestIssueStatusUpdateResetsIconToDefault(t *testing.T) {+ api := newIssueStatusTestServer(t)+ cmd := issueStatusTestCmd()+ _ = cmd.Flags().Set("icon", "")++ if _, err := captureStdout(t, func() error { return runIssueStatusUpdate(cmd, []string{"spec_review"}) }); err != nil {+ t.Fatalf("runIssueStatusUpdate: %v", err)+ }+ if len(api.patches) != 1 {+ t.Fatalf("patches = %d, want 1", len(api.patches))+ }+ icon, present := api.patches[0]["icon"]+ if !present {+ t.Fatal("icon omitted from the PATCH; an empty value must be sent to reset")+ }+ if icon != "" {+ t.Fatalf("icon = %v, want empty string", icon)+ }+}++func TestIssueStatusGetResolvesByKeyAndName(t *testing.T) {+ newIssueStatusTestServer(t)+ for _, ref := range []string{"spec_review", "Spec review", "status-spec-review"} {+ cmd := issueStatusTestCmd()+ _ = cmd.Flags().Set("output", "json")+ out, err := captureStdout(t, func() error { return runIssueStatusGet(cmd, []string{ref}) })+ if err != nil {+ t.Fatalf("get %q: %v", ref, err)+ }+ var got issueStatusDTO+ if err := json.Unmarshal([]byte(out), &got); err != nil {+ t.Fatalf("get %q unmarshal: %v\n%s", ref, err, out)+ }+ if got.Key != "spec_review" {+ t.Fatalf("get %q resolved to %q", ref, got.Key)+ }+ }+}++func TestIssueStatusGetUnknownRefListsKeys(t *testing.T) {+ newIssueStatusTestServer(t)+ cmd := issueStatusTestCmd()+ _, err := captureStdout(t, func() error { return runIssueStatusGet(cmd, []string{"nope"}) })+ if err == nil {+ t.Fatal("expected an error for an unknown status")+ }+ if !strings.Contains(err.Error(), "spec_review") {+ t.Fatalf("error %q should name available keys", err)+ }+}++func TestIssueStatusCreateRequiresColorAndCategory(t *testing.T) {+ newIssueStatusTestServer(t)+ cmd := issueStatusTestCmd()+ _ = cmd.Flags().Set("name", "Spec review ML")+ if _, err := captureStdout(t, func() error { return runIssueStatusCreate(cmd, nil) }); err == nil || !strings.Contains(err.Error(), "--category") {+ t.Fatalf("missing --category error = %v", err)+ }+ _ = cmd.Flags().Set("category", "started")+ if _, err := captureStdout(t, func() error { return runIssueStatusCreate(cmd, nil) }); err == nil || !strings.Contains(err.Error(), "--color") {+ t.Fatalf("missing --color error = %v", err)+ }+}++func TestIssueStatusCreateSendsIcon(t *testing.T) {+ api := newIssueStatusTestServer(t)+ cmd := issueStatusTestCmd()+ _ = cmd.Flags().Set("name", "Spec review ML")+ _ = cmd.Flags().Set("category", "started")+ _ = cmd.Flags().Set("color", "#3b82f6")+ _ = cmd.Flags().Set("icon", "three_quarters")++ if _, err := captureStdout(t, func() error { return runIssueStatusCreate(cmd, nil) }); err != nil {+ t.Fatalf("runIssueStatusCreate: %v", err)+ }+ if len(api.posts) != 1 {+ t.Fatalf("posts = %d, want 1", len(api.posts))+ }+ if got, _ := api.posts[0]["icon"].(string); got != "three_quarters" {+ t.Fatalf("icon = %q", got)+ }+ if got, _ := api.posts[0]["key"]; got != nil {+ t.Fatalf("key sent although not requested: %v", got)+ }+}++func TestIssueStatusArchiveUsesResolvedID(t *testing.T) {+ api := newIssueStatusTestServer(t)+ cmd := issueStatusTestCmd()+ _ = cmd.Flags().Set("output", "json")++ if _, err := captureStdout(t, func() error { return runIssueStatusArchive(cmd, []string{"Spec review"}) }); err != nil {+ t.Fatalf("runIssueStatusArchive: %v", err)+ }+ if len(api.deletes) != 1 || api.deletes[0] != "status-spec-review" {+ t.Fatalf("deletes = %v, want status-spec-review", api.deletes)+ }+}++func TestIssueStatusListHidesArchivedByDefault(t *testing.T) {+ newIssueStatusTestServer(t)+ cmd := issueStatusTestCmd()+ _ = cmd.Flags().Set("output", "json")++ out, err := captureStdout(t, func() error { return runIssueStatusList(cmd, nil) })+ if err != nil {+ t.Fatalf("runIssueStatusList: %v", err)+ }+ var listed []issueStatusDTO+ if err := json.Unmarshal([]byte(out), &listed); err != nil {+ t.Fatalf("unmarshal: %v\n%s", err, out)+ }+ for _, s := range listed {+ if s.ArchivedAt != nil {+ t.Fatalf("list included archived %q", s.Key)+ }+ }++ cmd = issueStatusTestCmd()+ _ = cmd.Flags().Set("output", "json")+ _ = cmd.Flags().Set("include-archived", "true")+ out, err = captureStdout(t, func() error { return runIssueStatusList(cmd, nil) })+ if err != nil {+ t.Fatalf("runIssueStatusList --include-archived: %v", err)+ }+ if err := json.Unmarshal([]byte(out), &listed); err != nil {+ t.Fatalf("unmarshal: %v\n%s", err, out)+ }+ found := false+ for _, s := range listed {+ if s.Key == "old_spec" {+ found = true+ }+ }+ if !found {+ t.Fatal("--include-archived omitted the archived status")+ }+}++func TestIssueStatusUpdateWithoutFieldsFails(t *testing.T) {+ newIssueStatusTestServer(t)+ cmd := issueStatusTestCmd()+ if _, err := captureStdout(t, func() error { return runIssueStatusUpdate(cmd, []string{"spec_review"}) }); err == nil || !strings.Contains(err.Error(), "nothing to update") {+ t.Fatalf("no-op update error = %v", err)+ }+}diff --git a/server/cmd/multica/main.go b/server/cmd/multica/main.goindex f5f1089c51..d8c46a8a9d 100644--- a/server/cmd/multica/main.go+++ b/server/cmd/multica/main.go@@ -49,6 +49,7 @@ func init() {// Core commandsissueCmd.GroupID = groupCore+ issueStatusCatalogCmd.GroupID = groupCoreprojectCmd.GroupID = groupCoreworkflowCmd.GroupID = groupCorelabelCmd.GroupID = groupCore@@ -77,6 +78,7 @@ func init() {versionCmd.GroupID = groupAdditionalrootCmd.AddCommand(issueCmd)+ rootCmd.AddCommand(issueStatusCatalogCmd)rootCmd.AddCommand(projectCmd)rootCmd.AddCommand(workflowCmd)rootCmd.AddCommand(labelCmd)diff --git a/server/internal/handler/issue_workflow.go b/server/internal/handler/issue_workflow.goindex b72465e81e..1a9f9ebfc7 100644--- a/server/internal/handler/issue_workflow.go+++ b/server/internal/handler/issue_workflow.go@@ -289,6 +289,10 @@ type NewWorkflowStatus struct {Name string `json:"name"`Category string `json:"category"`Color string `json:"color"`+ // Icon is presentation-only geometry (see validIssueStatusIcon). Empty+ // keeps the category default, which is what every status created before+ // this field existed carries.+ Icon string `json:"icon,omitempty"`}// IssueWorkflowStepInput names a step by an existing status key or by a@@ -375,6 +379,9 @@ func createWorkflowStatus(ctx context.Context, qtx *db.Queries, wsUUID pgtype.UUif !ok {category = "started"}+ if !validIssueStatusIcon(in.Icon) {+ return db.IssueStatus{}, false, "invalid status icon", nil+ }color := newStatusDefaultColor[category]if strings.TrimSpace(in.Color) != "" {c, err := normalizeColor(in.Color)@@ -402,6 +409,7 @@ func createWorkflowStatus(ctx context.Context, qtx *db.Queries, wsUUID pgtype.UUName: name,Category: category,Color: color,+ Icon: in.Icon,})if err != nil && isUniqueViolation(err) {return db.IssueStatus{}, false, fmt.Sprintf("a status named %q already exists", name), nildiff --git a/server/internal/handler/issue_workflow_test.go b/server/internal/handler/issue_workflow_test.goindex 3c75a303f4..53f05e695b 100644--- a/server/internal/handler/issue_workflow_test.go+++ b/server/internal/handler/issue_workflow_test.go@@ -285,6 +285,100 @@ func lookupStatusName(t *testing.T, key string) string {return name}+func lookupStatusIcon(t *testing.T, key string) string {+ t.Helper()+ var icon string+ dbfx.QueryRow(t, `SELECT icon FROM issue_status WHERE workspace_id = $1 AND key = $2`, testWorkspaceID, key).Scan(&icon)+ return icon+}++// new_status.icon reaches the catalog: a fresh workspace that applies a+// workflow definition renders the glyph its author declared instead of the+// category default. Before the field existed the key was dropped by JSON+// decoding and the apply still reported success.+func TestCreateIssueWorkflowNewStatusCarriesIcon(t *testing.T) {+ seedTestCatalog(t)+ resetDefaultWorkflow(t)+ statusName := "Icon " + workflowTestSuffix()+ var created IssueWorkflowResponse+ testutil.Call(t, testHandler.CreateIssueWorkflow, workflowRequest("POST", "/api/issue-workflows", map[string]any{+ "name": "Icon template " + workflowTestSuffix(),+ "steps": []map[string]any{{"new_status": map[string]any{"name": statusName, "category": "started", "icon": "three_quarters"}}, {"status_key": "in_review"}},+ })).Want(http.StatusCreated).JSON(&created)+ t.Cleanup(func() {+ testPool.Exec(context.Background(), `DELETE FROM issue_workflow WHERE id = $1`, created.ID)+ testPool.Exec(context.Background(), `DELETE FROM issue_status WHERE workspace_id = $1 AND name = $2`, testWorkspaceID, statusName)+ })++ var newKey string+ for _, s := range created.Steps {+ if lookupStatusName(t, s.StatusKey) == statusName {+ newKey = s.StatusKey+ }+ }+ if newKey == "" {+ t.Fatalf("workflow steps %+v lack the new status", created.Steps)+ }+ if icon := lookupStatusIcon(t, newKey); icon != "three_quarters" {+ t.Fatalf("icon = %q, want three_quarters", icon)+ }+}++// An icon outside the catalog vocabulary fails the workflow write instead of+// being written through or silently replaced.+func TestCreateIssueWorkflowNewStatusRejectsUnknownIcon(t *testing.T) {+ seedTestCatalog(t)+ resetDefaultWorkflow(t)+ statusName := "Bad icon " + workflowTestSuffix()+ testutil.Call(t, testHandler.CreateIssueWorkflow, workflowRequest("POST", "/api/issue-workflows", map[string]any{+ "name": "Bad icon template " + workflowTestSuffix(),+ "steps": []map[string]any{{"new_status": map[string]any{"name": statusName, "category": "started", "icon": "in_review"}}},+ })).Want(http.StatusBadRequest)+ var count int+ dbfx.QueryRow(t, `SELECT count(*) FROM issue_status WHERE workspace_id = $1 AND name = $2`, testWorkspaceID, statusName).Scan(&count)+ if count != 0 {+ t.Fatalf("invalid icon still created %d status rows", count)+ }+}++// Applying a template whose status already exists reuses that status without+// rewriting its icon: the catalog row is shared by every workflow, and a+// per-workflow write would silently revert a local edit.+func TestCreateIssueWorkflowNewStatusReuseKeepsIcon(t *testing.T) {+ seedTestCatalog(t)+ resetDefaultWorkflow(t)+ statusName := "Reused " + workflowTestSuffix()+ create := func(name, icon string) IssueWorkflowResponse {+ t.Helper()+ var wf IssueWorkflowResponse+ testutil.Call(t, testHandler.CreateIssueWorkflow, workflowRequest("POST", "/api/issue-workflows", map[string]any{+ "name": name,+ "steps": []map[string]any{{"new_status": map[string]any{"name": statusName, "category": "started", "icon": icon}}},+ })).Want(http.StatusCreated).JSON(&wf)+ t.Cleanup(func() {+ testPool.Exec(context.Background(), `DELETE FROM issue_workflow WHERE id = $1`, wf.ID)+ })+ return wf+ }+ first := create("Reuse one "+workflowTestSuffix(), "three_quarters")+ t.Cleanup(func() {+ testPool.Exec(context.Background(), `DELETE FROM issue_status WHERE workspace_id = $1 AND name = $2`, testWorkspaceID, statusName)+ })+ var key string+ for _, s := range first.Steps {+ if lookupStatusName(t, s.StatusKey) == statusName {+ key = s.StatusKey+ }+ }+ if key == "" {+ t.Fatalf("first workflow %+v lacks the new status", first.Steps)+ }+ create("Reuse two "+workflowTestSuffix(), "check")+ if icon := lookupStatusIcon(t, key); icon != "three_quarters" {+ t.Fatalf("reuse rewrote the shared icon to %q", icon)+ }+}+func TestDefaultWorkflowIsEditableButNotDeletable(t *testing.T) {seedTestCatalog(t)resetDefaultWorkflow(t)diff --git a/server/internal/service/builtin_skills/multica-platform/references/projects.md b/server/internal/service/builtin_skills/multica-platform/references/projects.mdindex 6d4478c3e4..bb2ed772d9 100644--- a/server/internal/service/builtin_skills/multica-platform/references/projects.md+++ b/server/internal/service/builtin_skills/multica-platform/references/projects.md@@ -221,6 +221,16 @@ issue inside a workflow needs none of them.- Whole workflow: `multica workflow create|update --steps-file <json>`replaces all steps; `multica workflow delete` is refused for Default and fora workflow a project still uses.+- Status catalog: a step's `new_status` may carry `icon` (`dotted`, `circle`,+ `half`, `three_quarters`, `check`, `slash`, `cross`; empty keeps the category+ default), so a definition applied in a fresh workspace renders the glyph its+ author declared. The field applies only when the status is created — a+ status that already exists by name is reused unchanged. Repair an existing+ catalog row, including on a workspace that synced before the field was+ declared, with `multica issue-status update <key-or-name> --icon <value>`+ (`--icon ""` resets it), and read the catalog with `multica issue-status+ list`. These commands edit the workspace catalog, not a workflow, and need+ workspace owner/admin.- Switching: `multica project workflow set <project-id> <workflow|default>`.Run it with `--dry-run` first. Issues on statuses the target lacks need`--map old=new`; a missing mapping fails with