Skip to content

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

Go

MUL-7732: regroup settings by scope and consolidate scattered pages (#8874)

Jiayuan Zhang104bf7be3570
diff --git a/apps/docs/content/docs/developers/conventions.zh.mdx b/apps/docs/content/docs/developers/conventions.zh.mdx
index bf81fefded..c2f2df12f1 100644
--- a/apps/docs/content/docs/developers/conventions.zh.mdx
+++ b/apps/docs/content/docs/developers/conventions.zh.mdx
@@ -89,7 +89,7 @@ Web 和 Desktop 都有的逻辑,**必须**抽到共享包。"小段重复"也
### Issue 编号
-每个 issue 有人类可读的编号,比如 `MUL-123`:工作区 `issue_prefix`(大写字母和数字,通常 3 个字符,最长 10 个)+ 流水号。工作区管理员可以在**设置 → 通用**中修改前缀;修改会让所有现有 issue 重新编号,外部引用——PR 标题、分支名、文档与聊天里的链接——里的旧前缀会失效。
+每个 issue 有人类可读的编号,比如 `MUL-123`:工作区 `issue_prefix`(大写字母和数字,通常 3 个字符,最长 10 个)+ 流水号。工作区管理员可以在**设置 → 常规**中修改前缀;修改会让所有现有 issue 重新编号,外部引用——PR 标题、分支名、文档与聊天里的链接——里的旧前缀会失效。
### 代码注释
diff --git a/apps/docs/content/docs/dingtalk-bot-integration.fr.mdx b/apps/docs/content/docs/dingtalk-bot-integration.fr.mdx
index 88ff93e791..52b7ac5204 100644
--- a/apps/docs/content/docs/dingtalk-bot-integration.fr.mdx
+++ b/apps/docs/content/docs/dingtalk-bot-integration.fr.mdx
@@ -81,7 +81,7 @@ Envoyez `/clear` pour conserver la discussion Multica en cours tout en appliquan
## Gérer les connexions
- Dans **Agents → _votre agent_ → Capacités → Intégrations**, le créateur de l'agent et les propriétaires/administrateurs de l'espace de travail peuvent connecter l'agent à DingTalk ou le déconnecter. Une fois la connexion établie, cette page affiche le nom du bot, les groupes DingTalk où il a traité des messages avec succès et ses données d'activité dans ces groupes. Tout membre de l'espace de travail disposant d'un accès en lecture à l'agent peut voir ces informations. Les groupes sans message traité avec succès au cours des 90 derniers jours sont placés sous **Inactifs depuis longtemps** et chargés lorsque cette section est dépliée.
-- **Paramètres → Intégrations** liste tous les agents connectés à DingTalk dans l'espace de travail actuel que l'utilisateur peut consulter, avec les données d'activité du bot dans les groupes DingTalk. Les propriétaires/administrateurs de l'espace de travail peuvent aussi déconnecter de DingTalk n'importe quel agent listé. Après la déconnexion, le bot ne reçoit plus de messages, mais l'enregistrement d'installation est conservé pour l'audit. Les propriétaires/administrateurs de l'espace de travail peuvent aussi oublier un groupe. Cela retire le groupe de la liste sans supprimer les conversations ni les messages. Le groupe réapparaît si un membre de l'espace de travail disposant d'un compte DingTalk associé y @mentionne de nouveau le bot et que Multica accepte le message.
+- **Paramètres → Messagerie → DingTalk** liste tous les agents connectés à DingTalk dans l'espace de travail actuel que l'utilisateur peut consulter, avec les données d'activité du bot dans les groupes DingTalk. Les propriétaires/administrateurs de l'espace de travail peuvent aussi déconnecter de DingTalk n'importe quel agent listé. Après la déconnexion, le bot ne reçoit plus de messages, mais l'enregistrement d'installation est conservé pour l'audit. Les propriétaires/administrateurs de l'espace de travail peuvent aussi oublier un groupe. Cela retire le groupe de la liste sans supprimer les conversations ni les messages. Le groupe réapparaît si un membre de l'espace de travail disposant d'un compte DingTalk associé y @mentionne de nouveau le bot et que Multica accepte le message.
## Configuration en auto-hébergement
diff --git a/apps/docs/content/docs/dingtalk-bot-integration.ja.mdx b/apps/docs/content/docs/dingtalk-bot-integration.ja.mdx
index 657991d24f..6fc2d65fd4 100644
--- a/apps/docs/content/docs/dingtalk-bot-integration.ja.mdx
+++ b/apps/docs/content/docs/dingtalk-bot-integration.ja.mdx
@@ -81,7 +81,7 @@ Multica は DingTalk メッセージを受信すると、元のユーザーメ
## 接続を管理する
- **エージェント → _あなたのエージェント_ → 機能 → 連携**ページでは、エージェントの作成者とワークスペースの owner/admin が DingTalk への接続と切断を行えます。接続後は、Bot 名、Bot がメッセージを正常に処理したことのある DingTalk グループ、および各グループでの Bot のアクティビティ状況データが表示されます。エージェントの読み取り権限を持つワークスペースメンバーは、これらの情報をすべて確認できます。直近 90 日間に正常に処理されたメッセージがないグループは**長期間未使用**にまとめられ、展開時に読み込まれます。
-- **設定 → 連携**ページには、現在のワークスペース内で、自分に読み取り権限があり、DingTalk に接続済みのエージェントがすべて表示されます。Bot の DingTalk グループ内でのアクティビティ状況データも表示されます。ワークスペースの owner/admin は、リスト内の任意のエージェントの DingTalk 接続をここから直接切断できます。切断後、Bot はメッセージを受信しなくなりますが、インストール記録は監査用に保持されます。ワークスペースの owner/admin は、グループを一覧から削除することもできます。この操作で会話やメッセージが削除されることはありません。その後、DingTalk アカウントを連携済みのワークスペースメンバーが同じグループで Bot を @メンションし、そのメッセージを Multica が正常に受け付けると、グループは再び表示されます。
+- **設定 → メッセージング → DingTalk**ページには、現在のワークスペース内で、自分に読み取り権限があり、DingTalk に接続済みのエージェントがすべて表示されます。Bot の DingTalk グループ内でのアクティビティ状況データも表示されます。ワークスペースの owner/admin は、リスト内の任意のエージェントの DingTalk 接続をここから直接切断できます。切断後、Bot はメッセージを受信しなくなりますが、インストール記録は監査用に保持されます。ワークスペースの owner/admin は、グループを一覧から削除することもできます。この操作で会話やメッセージが削除されることはありません。その後、DingTalk アカウントを連携済みのワークスペースメンバーが同じグループで Bot を @メンションし、そのメッセージを Multica が正常に受け付けると、グループは再び表示されます。
## セルフホスト設定
diff --git a/apps/docs/content/docs/dingtalk-bot-integration.ko.mdx b/apps/docs/content/docs/dingtalk-bot-integration.ko.mdx
index 4b9c9ef1b0..21a2edfb47 100644
--- a/apps/docs/content/docs/dingtalk-bot-integration.ko.mdx
+++ b/apps/docs/content/docs/dingtalk-bot-integration.ko.mdx
@@ -81,7 +81,7 @@ Multica는 DingTalk 메시지를 받으면 사용자의 원래 메시지에 Ding
## 연결 관리
- **에이전트 → _당신의 에이전트_ → 기능 → 연동** 페이지에서 에이전트 생성자와 워크스페이스 owner/admin은 DingTalk에 연결하거나 연결을 해제할 수 있습니다. DingTalk에 연결하면 이 페이지에 봇 이름, 봇이 메시지를 정상적으로 처리한 적이 있는 DingTalk 그룹, 그리고 각 그룹에서의 봇 활동 상태 데이터가 표시됩니다. 에이전트 읽기 권한이 있는 워크스페이스 멤버는 모두 이 정보를 볼 수 있습니다. 최근 90일 동안 정상적으로 처리된 메시지가 없는 그룹은 **장기 미활동**에 모이며 펼칠 때 불러옵니다.
-- **설정 → 연동** 페이지에는 현재 워크스페이스에서 자신에게 읽기 권한이 있고 DingTalk에 연결된 모든 에이전트 목록과 DingTalk 그룹에서의 봇 활동 상태 데이터가 표시됩니다. 워크스페이스 owner/admin은 목록에 있는 에이전트의 DingTalk 연결을 여기서 바로 해제할 수도 있습니다. 연결을 해제하면 봇은 메시지 수신을 멈추지만 설치 기록은 감사용으로 보관됩니다. 워크스페이스 owner/admin은 그룹을 목록에서 삭제할 수도 있습니다. 이 작업은 대화나 메시지를 삭제하지 않습니다. 이후 DingTalk 계정을 연결한 워크스페이스 멤버가 같은 그룹에서 봇을 다시 @멘션하고 Multica가 해당 메시지를 정상적으로 접수하면 그룹이 다시 표시됩니다.
+- **설정 → 메신저 → DingTalk** 페이지에는 현재 워크스페이스에서 자신에게 읽기 권한이 있고 DingTalk에 연결된 모든 에이전트 목록과 DingTalk 그룹에서의 봇 활동 상태 데이터가 표시됩니다. 워크스페이스 owner/admin은 목록에 있는 에이전트의 DingTalk 연결을 여기서 바로 해제할 수도 있습니다. 연결을 해제하면 봇은 메시지 수신을 멈추지만 설치 기록은 감사용으로 보관됩니다. 워크스페이스 owner/admin은 그룹을 목록에서 삭제할 수도 있습니다. 이 작업은 대화나 메시지를 삭제하지 않습니다. 이후 DingTalk 계정을 연결한 워크스페이스 멤버가 같은 그룹에서 봇을 다시 @멘션하고 Multica가 해당 메시지를 정상적으로 접수하면 그룹이 다시 표시됩니다.
## 자체 호스팅 설정
diff --git a/apps/docs/content/docs/dingtalk-bot-integration.mdx b/apps/docs/content/docs/dingtalk-bot-integration.mdx
index d9fec01db3..7e38bfd2ff 100644
--- a/apps/docs/content/docs/dingtalk-bot-integration.mdx
+++ b/apps/docs/content/docs/dingtalk-bot-integration.mdx
@@ -81,7 +81,7 @@ Send `/clear` to keep the current Multica Chat while applying a fresh agent-visi
## Manage connections
- On **Agents → _your agent_ → Capabilities → Integrations**, the agent's creator and workspace owners/admins can connect the agent to DingTalk or disconnect it. Once connected, this page shows the Bot's name, DingTalk groups where it has successfully processed messages, and its activity status data in those groups. Any workspace member with read access to the agent can see this information. Groups with no successfully processed messages in the last 90 days are placed under **Long inactive** and loaded when expanded.
-- **Settings → Integrations** lists every DingTalk-connected agent in the current workspace that the viewer can read, along with the Bot's activity status data in DingTalk groups. Workspace owners/admins can also disconnect any listed agent from DingTalk. After disconnection, the Bot stops receiving messages, while the installation record is retained for audit. Workspace owners/admins can also forget a group. This removes the group from the list without deleting conversations or messages. The group reappears if a workspace member with a linked DingTalk account later @mentions the Bot there and Multica accepts the message.
+- **Settings → Messaging → DingTalk** lists every DingTalk-connected agent in the current workspace that the viewer can read, along with the Bot's activity status data in DingTalk groups. Workspace owners/admins can also disconnect any listed agent from DingTalk. After disconnection, the Bot stops receiving messages, while the installation record is retained for audit. Workspace owners/admins can also forget a group. This removes the group from the list without deleting conversations or messages. The group reappears if a workspace member with a linked DingTalk account later @mentions the Bot there and Multica accepts the message.
## Self-hosting setup
diff --git a/apps/docs/content/docs/dingtalk-bot-integration.zh.mdx b/apps/docs/content/docs/dingtalk-bot-integration.zh.mdx
index 41f9e07f09..78942d92dc 100644
--- a/apps/docs/content/docs/dingtalk-bot-integration.zh.mdx
+++ b/apps/docs/content/docs/dingtalk-bot-integration.zh.mdx
@@ -81,7 +81,7 @@ Multica 收到钉钉消息后,会尝试在用户原消息上添加钉钉的`
## 管理连接
- 在**智能体 → _你的智能体_ → 能力 → 集成**页面,智能体创建者、工作区 owner/admin 可以在此连接钉钉,或者断开连接。连接上钉钉后,这里会显示 Bot 名称和已成功处理过消息的钉群,以及 Bot 在钉群内的活跃状态数据,有智能体读权限的工作区成员都能看到这些信息。最近 90 天没有成功处理消息的群会归入**长期未活跃**,展开时再加载。
-- 在**设置 → 集成**页面,显示当前工作区内所有有读权限且连接了钉钉的智能体列表,以及 Bot 在钉群内的活跃状态数据。工作区 owner/admin 还可以在此直接断开列表中任意智能体的钉钉连接。断开后 Bot 停止接收消息,安装记录仍会保留用于审计。工作区 owner/admin 还可以忘记某个群。忘记只会从列表中移除该群,不会删除对话和消息。如果已关联钉钉账号的工作区成员以后在该群再次 @ Bot,且 Multica 成功接收这条消息,群会重新出现。
+- 在**设置 → 消息渠道 → 钉钉**页面,显示当前工作区内所有有读权限且连接了钉钉的智能体列表,以及 Bot 在钉群内的活跃状态数据。工作区 owner/admin 还可以在此直接断开列表中任意智能体的钉钉连接。断开后 Bot 停止接收消息,安装记录仍会保留用于审计。工作区 owner/admin 还可以忘记某个群。忘记只会从列表中移除该群,不会删除对话和消息。如果已关联钉钉账号的工作区成员以后在该群再次 @ Bot,且 Multica 成功接收这条消息,群会重新出现。
## 自部署配置
diff --git a/apps/docs/content/docs/github-integration.fr.mdx b/apps/docs/content/docs/github-integration.fr.mdx
index c1ed001177..bf3914802f 100644
--- a/apps/docs/content/docs/github-integration.fr.mdx
+++ b/apps/docs/content/docs/github-integration.fr.mdx
@@ -9,31 +9,29 @@ Une fois GitHub connecté, Multica associe automatiquement les pull requests à
L'intégration GitHub se contente de lire les dépôts autorisés lors de l'installation ; elle ne pousse jamais de commits, de commentaires ni de status checks.
-Multica auto-hébergé peut aussi connecter en parallèle des instances Forgejo, Gitea ou GitLab auto-hébergées, avec la même association automatique des PR, le même passage à Terminé à la fusion et le même affichage de la CI. Le point d'entrée est **Paramètres → Intégrations → Fournisseurs git (auto-hébergés)** ; voir [Fournisseurs Git auto-hébergés](/vcs-integration). Multica Cloud ne propose pas ce point d'entrée.
+Multica auto-hébergé peut aussi connecter en parallèle des instances Forgejo, Gitea ou GitLab auto-hébergées, avec la même association automatique des PR, le même passage à Terminé à la fusion et le même affichage de la CI. Le point d'entrée est **Paramètres → Code** ; voir [Fournisseurs Git auto-hébergés](/vcs-integration). Multica Cloud ne propose pas ce point d'entrée.
## Connecter GitHub
Un propriétaire ou un administrateur de l'espace de travail peut effectuer la connexion :
-1. Ouvrez **Paramètres → GitHub**.
-2. Activez l'interrupteur principal de l'intégration GitHub, **Activer les fonctions GitHub**.
-3. Cliquez sur **Connecter GitHub**.
-4. Sur GitHub, choisissez le compte ou l'organisation, puis autorisez tous les dépôts ou une sélection d'entre eux.
-5. Revenez sur Multica une fois l'installation terminée.
+1. Ouvrez **Paramètres → Code**.
+2. Sur la ligne **GitHub**, cliquez sur **Connecter GitHub**.
+3. Sur GitHub, choisissez le compte ou l'organisation, puis autorisez tous les dépôts ou une sélection d'entre eux.
+4. Revenez sur Multica une fois l'installation terminée.
L'état de la connexion s'affiche sur la même page. Les membres ordinaires peuvent consulter cet état, mais ne peuvent ni connecter, ni déconnecter, ni modifier les interrupteurs.
<Callout type="info">
-La **connexion GitHub** détermine de quels dépôts Multica reçoit les événements de PR ; le réglage des **dépôts de code** (onglet **Dépôts**) détermine les dépôts que les agents peuvent choisir au démarrage des exécutions. Ils ont des rôles différents et se configurent séparément.
+La **connexion GitHub** détermine de quels dépôts Multica reçoit les événements de PR ; le réglage des **dépôts de code** (section **Dépôts** de la même page) détermine les dépôts que les agents peuvent choisir au démarrage des exécutions. Ils ont des rôles différents et se configurent séparément.
</Callout>
## Interrupteurs de fonctions
-**Paramètres → GitHub** comporte quatre interrupteurs :
+La section **Pull requests et tâches** de **Paramètres → Code** comporte ces interrupteurs. **Mettre en pause les fonctionnalités GitHub**, dans le menu **⋯** de la ligne GitHub, désactive les trois interrupteurs ci-dessous sans déconnecter la GitHub App.
| Interrupteur | Effet |
|---|---|
-| Activer les fonctions GitHub | Interrupteur principal. Lorsqu'il est désactivé, les trois interrupteurs ci-dessous cessent de fonctionner, mais la GitHub App reste connectée. |
| Barre latérale des pull requests | Affiche les pull requests associées dans le détail de la tâche. |
| Mention Co-authored-by | Ajoute `Co-authored-by: multica-agent <[email protected]>` aux commits créés par les agents. |
| Lier automatiquement tâches et PR | Détecte les identifiants de tâche dans le nom de branche ou le titre d'une PR, ainsi que dans sa description lorsqu'ils suivent un mot-clé de clôture. |
@@ -99,7 +97,7 @@ Par exemple, une PR qui référence à la fois `MUL-1` et `ENG-2` peut être ass
## Déconnecter
-Cliquer sur **Déconnecter** dans **Paramètres → GitHub** supprime seulement la relation entre l'espace de travail Multica courant et l'installation ; cela ne désinstalle pas l'App de GitHub à votre place. Les enregistrements de PR existants sont conservés, et les nouveaux événements cessent d'arriver dans cet espace de travail.
+Choisir **Déconnecter** dans le menu **⋯** de la ligne GitHub, sur **Paramètres → Code**, supprime seulement la relation entre l'espace de travail Multica courant et l'installation ; cela ne désinstalle pas l'App de GitHub à votre place. Les enregistrements de PR existants sont conservés, et les nouveaux événements cessent d'arriver dans cet espace de travail.
Pour révoquer l'autorisation d'accès aux dépôts côté GitHub, désinstallez l'App ou ajustez son périmètre de dépôts depuis la page des installations de GitHub Apps de votre compte personnel ou de votre organisation. Après la désinstallation, tous les espaces de travail Multica liés à cette installation cessent de recevoir des événements.
@@ -169,7 +167,7 @@ Lors de la mise à niveau d'un déploiement existant, exécutez d'abord les migr
make migrate-up
```
-Redémarrez le serveur API, puis effectuez la connexion dans **Paramètres → GitHub**.
+Redémarrez le serveur API, puis effectuez la connexion dans **Paramètres → Code**.
## Dépannage
diff --git a/apps/docs/content/docs/github-integration.ja.mdx b/apps/docs/content/docs/github-integration.ja.mdx
index bf981bfd62..550ee67b50 100644
--- a/apps/docs/content/docs/github-integration.ja.mdx
+++ b/apps/docs/content/docs/github-integration.ja.mdx
@@ -9,17 +9,16 @@ GitHub を接続すると、Multica はタスク番号を使って pull request
GitHub 連携が読み取るのは、インストール時に許可されたリポジトリだけです。コード、コメント、status check を書き込むことはありません。
-セルフホスト版 Multica では、セルフホストの Forgejo、Gitea、GitLab インスタンスも同時に接続できます。PR の自動紐づけ、マージ時のステータス変更、CI 表示を同じように利用できます。**設定 → 連携 → Git ホスティング**から設定してください。詳しくは[セルフホスト Git ホスティング](/vcs-integration)を参照してください。Multica Cloud にはこの項目はありません。
+セルフホスト版 Multica では、セルフホストの Forgejo、Gitea、GitLab インスタンスも同時に接続できます。PR の自動紐づけ、マージ時のステータス変更、CI 表示を同じように利用できます。**設定 → コード**から設定してください。詳しくは[セルフホスト Git ホスティング](/vcs-integration)を参照してください。Multica Cloud にはこの項目はありません。
## GitHub を接続する
ワークスペースの owner または admin が接続できます。
-1. **設定 → GitHub** を開きます。
-2. GitHub 連携のメインスイッチを有効にします。
-3. **GitHub に接続**をクリックします。
-4. GitHub でアカウントまたは organization を選び、すべてのリポジトリか指定したリポジトリを許可します。
-5. インストールが完了したら Multica に戻ります。
+1. **設定 → コード** を開きます。
+2. **GitHub** の行で **GitHub に接続**をクリックします。
+3. GitHub でアカウントまたは organization を選び、すべてのリポジトリか指定したリポジトリを許可します。
+4. インストールが完了したら Multica に戻ります。
接続状態は同じページに表示されます。通常のメンバーは状態を確認できますが、接続、切断、スイッチの変更はできません。
@@ -29,11 +28,10 @@ GitHub 連携が読み取るのは、インストール時に許可されたリ
## 機能スイッチ
-**設定 → GitHub** には次の設定があります。
+**設定 → コード** の **プルリクエストとタスク** には次の設定があります。GitHub の行の **⋯** メニューで **GitHub 機能を一時停止** すると、下の 3 項目は機能しなくなりますが、GitHub App の接続は解除されません。
| 設定 | 機能 |
|---|---|
-| GitHub 連携 | メインスイッチ。無効にすると下の 3 項目は機能しなくなりますが、GitHub App の接続は解除されません。 |
| PR サイドバー | 紐づいた pull request をタスクの詳細画面に表示します。 |
| Co-authored-by | エージェントが作成する commit に `Co-authored-by: multica-agent <[email protected]>` を追加します。 |
| PR の自動紐づけ | ブランチ名かタイトルにタスク番号を含む PR、または本文で closing keyword の直後にタスク番号を置いた PR を、そのタスクに紐づけます。 |
@@ -85,7 +83,7 @@ CI の状態とマージ可能性は、Multica が GitHub API から取得した
## PR マージ後のステータス変更
-PR がマージされても、必ずしもタスクが完了するわけではありません。そのため、マージ後に何をするかはワークスペースが決めます: **設定 → 連携 → GitHub → PR マージ後のタスクのステータス**。`Done`(新しいワークスペースの既定値)、ほかの「開始済み」「完了」カテゴリーのステータス(「回帰テスト待ち」のようなカスタムステータスも可)、または **変更しない** を選べます。この設定ができる前からあるワークスペースは、これまでの挙動を保ちます。マージしても必ずタスクが完了していたわけではない場合、初期値は **変更しない** です。
+PR がマージされても、必ずしもタスクが完了するわけではありません。そのため、マージ後に何をするかはワークスペースが決めます: **設定 → コード → PR マージ後のタスクのステータス**。`Done`(新しいワークスペースの既定値)、ほかの「開始済み」「完了」カテゴリーのステータス(「回帰テスト待ち」のようなカスタムステータスも可)、または **変更しない** を選べます。この設定ができる前からあるワークスペースは、これまでの挙動を保ちます。マージしても必ずタスクが完了していたわけではない場合、初期値は **変更しない** です。
次の条件をすべて満たすと、タスクは選んだステータスに変わります。
@@ -96,7 +94,7 @@ PR の紐づけ方は結果に影響しません。タイトル、ブランチ
判定は PR イベントがタスクに関わったときだけ行います。紐づいた PR のマージ、紐づけの追加、紐づけの解除です。タスクを再度開いても元には戻らず、次に紐づいた PR がマージされたときに変更されます。設定を変えても、以前にマージされたタスクには影響しません。
-状態の変更は関連する PR を示したシステム操作としてタイムラインに記録され、そのタスクを購読しているメンバーへ通知されます。この設定は[セルフホスト Git ホスティング](/vcs-integration)を含むすべてのコードホストで共通で、そちらのページにも同じ設定が表示されます。
+状態の変更は関連する PR を示したシステム操作としてタイムラインに記録され、そのタスクを購読しているメンバーへ通知されます。この設定は[セルフホスト Git ホスティング](/vcs-integration)を含むすべてのコードホストで共通です。
## 複数のワークスペース
@@ -108,7 +106,7 @@ PR の紐づけ方は結果に影響しません。タイトル、ブランチ
## 接続を解除する
-**設定 → GitHub** の**接続解除**をクリックすると、現在の Multica ワークスペースと installation の関係だけが削除されます。GitHub から App がアンインストールされることはありません。既存の PR 記録は保持されますが、新しいイベントはこのワークスペースに届かなくなります。
+**設定 → コード** の GitHub の行で **⋯** メニューから**接続解除**を選ぶと、現在の Multica ワークスペースと installation の関係だけが削除されます。GitHub から App がアンインストールされることはありません。既存の PR 記録は保持されますが、新しいイベントはこのワークスペースに届かなくなります。
GitHub 側のリポジトリアクセスを取り消す場合は、個人または organization の GitHub App installations ページで App をアンインストールするか、リポジトリの範囲を変更してください。App をアンインストールすると、その installation に接続していたすべての Multica ワークスペースがイベントを受信しなくなります。
@@ -178,7 +176,7 @@ GITHUB_APP_PRIVATE_KEY=<complete PEM private key, including BEGIN/END lines and
make migrate-up
```
-API サービスを再起動し、**設定 → GitHub** から接続します。
+API サービスを再起動し、**設定 → コード** から接続します。
## よくある問題
diff --git a/apps/docs/content/docs/github-integration.ko.mdx b/apps/docs/content/docs/github-integration.ko.mdx
index 7fc4936402..b167a479d4 100644
--- a/apps/docs/content/docs/github-integration.ko.mdx
+++ b/apps/docs/content/docs/github-integration.ko.mdx
@@ -9,17 +9,16 @@ GitHub를 연결하면 Multica가 태스크 번호를 기준으로 pull request
GitHub 연동은 설치할 때 승인한 저장소만 읽으며 코드, 댓글, status check를 제출하지 않습니다.
-자체 배포한 Multica에서는 자체 호스팅 Forgejo, Gitea, GitLab 인스턴스도 동시에 연결해 동일한 PR 자동 연결, merge 시 상태 변경, CI 표시 기능을 사용할 수 있습니다. **설정 → 연동 → Git 코드 호스팅**에서 연결하며 자세한 내용은 [자체 호스팅 Git 코드 호스팅](/vcs-integration)을 참고하세요. Multica Cloud에는 이 메뉴가 없습니다.
+자체 배포한 Multica에서는 자체 호스팅 Forgejo, Gitea, GitLab 인스턴스도 동시에 연결해 동일한 PR 자동 연결, merge 시 상태 변경, CI 표시 기능을 사용할 수 있습니다. **설정 → 코드**에서 연결하며 자세한 내용은 [자체 호스팅 Git 코드 호스팅](/vcs-integration)을 참고하세요. Multica Cloud에는 이 메뉴가 없습니다.
## GitHub 연결
워크스페이스 owner 또는 admin이 연결할 수 있습니다.
-1. **설정 → GitHub**를 엽니다.
-2. GitHub 연동 전체 스위치를 켭니다.
-3. **GitHub 연결**을 클릭합니다.
-4. GitHub에서 계정 또는 조직을 선택하고 모든 저장소나 지정한 저장소를 승인합니다.
-5. 설치가 끝나면 Multica로 돌아옵니다.
+1. **설정 → 코드**를 엽니다.
+2. **GitHub** 행에서 **GitHub 연결**을 클릭합니다.
+3. GitHub에서 계정 또는 조직을 선택하고 모든 저장소나 지정한 저장소를 승인합니다.
+4. 설치가 끝나면 Multica로 돌아옵니다.
연결 상태는 같은 페이지에 표시됩니다. 일반 멤버는 상태를 볼 수 있지만 연결, 연결 해제, 스위치 변경은 할 수 없습니다.
@@ -29,11 +28,10 @@ GitHub 연동은 설치할 때 승인한 저장소만 읽으며 코드, 댓글,
## 기능 스위치
-**설정 → GitHub**에는 다음 설정이 있습니다.
+**설정 → 코드**의 **풀 리퀘스트와 태스크**에는 다음 설정이 있습니다. GitHub 행의 **⋯** 메뉴에서 **GitHub 기능 일시 중지**를 선택하면 아래 세 스위치는 작동하지 않지만 GitHub App 연결은 해제되지 않습니다.
| 설정 | 역할 |
|---|---|
-| GitHub 연동 | 전체 스위치입니다. 끄면 아래 세 기능이 작동하지 않지만 GitHub App 연결은 해제되지 않습니다. |
| PR 사이드바 | 태스크 상세 화면에 연결된 pull request를 표시합니다. |
| Co-authored-by | 에이전트가 만든 commit에 `Co-authored-by: multica-agent <[email protected]>`를 추가합니다. |
| PR 자동 연결 | 브랜치 이름이나 제목에 태스크 번호가 있거나, 본문에서 closing keyword 바로 뒤에 태스크 번호를 쓴 PR을 해당 태스크에 연결합니다. |
@@ -85,7 +83,7 @@ CI 상태와 merge 가능 여부는 Multica가 GitHub API에서 가져온 snapsh
## PR 병합 후 상태 변경
-PR이 merge되었다고 해서 태스크가 반드시 끝난 것은 아닙니다. 그래서 merge 후에 무엇을 할지는 워크스페이스가 정합니다: **설정 → 연동 → GitHub → PR 병합 후 태스크 상태**. `Done`(새 워크스페이스의 기본값), 다른 "시작됨" 또는 "완료" 카테고리의 상태("회귀 테스트 대기" 같은 사용자 지정 상태도 가능), 또는 **변경하지 않음**을 고를 수 있습니다. 이 설정이 생기기 전부터 있던 워크스페이스는 기존 동작을 유지합니다. merge해도 태스크가 항상 완료되지는 않았다면 초기값은 **변경하지 않음**입니다.
+PR이 merge되었다고 해서 태스크가 반드시 끝난 것은 아닙니다. 그래서 merge 후에 무엇을 할지는 워크스페이스가 정합니다: **설정 → 코드 → PR 병합 후 태스크 상태**. `Done`(새 워크스페이스의 기본값), 다른 "시작됨" 또는 "완료" 카테고리의 상태("회귀 테스트 대기" 같은 사용자 지정 상태도 가능), 또는 **변경하지 않음**을 고를 수 있습니다. 이 설정이 생기기 전부터 있던 워크스페이스는 기존 동작을 유지합니다. merge해도 태스크가 항상 완료되지는 않았다면 초기값은 **변경하지 않음**입니다.
다음 조건을 모두 만족하면 태스크가 선택한 상태로 바뀝니다.
@@ -96,7 +94,7 @@ PR을 어떻게 연결했는지는 결과에 영향을 주지 않습니다. 제
판단은 PR 이벤트가 태스크에 닿을 때만 이루어집니다. 연결된 PR의 merge, 연결 추가, 연결 제거입니다. 태스크를 다시 열어도 원래대로 돌아가지 않으며, 다음에 연결된 PR이 merge될 때 바뀝니다. 설정을 바꿔도 이전에 merge된 태스크에는 영향을 주지 않습니다.
-상태 변경은 관련 PR을 적은 시스템 작업으로 타임라인에 기록되고 해당 태스크 구독자에게 알림이 전달됩니다. 이 설정은 [자체 호스팅 Git 코드 호스팅](/vcs-integration)을 포함한 모든 코드 호스트에 공통으로 적용되며, 그 페이지에도 같은 설정이 표시됩니다.
+상태 변경은 관련 PR을 적은 시스템 작업으로 타임라인에 기록되고 해당 태스크 구독자에게 알림이 전달됩니다. 이 설정은 [자체 호스팅 Git 코드 호스팅](/vcs-integration)을 포함한 모든 코드 호스트에 공통으로 적용됩니다.
## 여러 워크스페이스
@@ -108,7 +106,7 @@ PR을 어떻게 연결했는지는 결과에 영향을 주지 않습니다. 제
## 연결 해제
-**설정 → GitHub**에서 **연결 해제**를 클릭하면 현재 Multica 워크스페이스와 해당 installation의 관계만 제거됩니다. GitHub에서 App을 대신 제거하지는 않습니다. 기존 PR 기록은 유지되고 새 이벤트만 해당 워크스페이스에 들어오지 않습니다.
+**설정 → 코드**의 GitHub 행에서 **⋯** 메뉴의 **연결 해제**를 선택하면 현재 Multica 워크스페이스와 해당 installation의 관계만 제거됩니다. GitHub에서 App을 대신 제거하지는 않습니다. 기존 PR 기록은 유지되고 새 이벤트만 해당 워크스페이스에 들어오지 않습니다.
GitHub 측의 저장소 승인을 취소하려면 개인 또는 조직의 GitHub App installations 페이지에서 App을 제거하거나 저장소 범위를 조정해야 합니다. App을 제거하면 해당 installation에 연결된 모든 Multica 워크스페이스가 이벤트 수신을 중지합니다.
@@ -178,7 +176,7 @@ Private key는 GitHub App의 **Private keys → Generate a private key**에서
make migrate-up
```
-API 서비스를 다시 시작한 뒤 **설정 → GitHub**에서 연결을 완료합니다.
+API 서비스를 다시 시작한 뒤 **설정 → 코드**에서 연결을 완료합니다.
## 자주 묻는 문제
diff --git a/apps/docs/content/docs/github-integration.mdx b/apps/docs/content/docs/github-integration.mdx
index c6e514ab4b..a371bc9cd7 100644
--- a/apps/docs/content/docs/github-integration.mdx
+++ b/apps/docs/content/docs/github-integration.mdx
@@ -9,17 +9,16 @@ Once GitHub is connected, Multica automatically links pull requests based on iss
The GitHub integration only reads the repositories authorized at install time; it never pushes commits, comments, or status checks.
-Self-hosted Multica can also connect self-hosted Forgejo, Gitea, or GitLab instances in parallel, with the same PR auto-linking, merge-driven status changes, and CI display. The entry point is **Settings → Integrations → Git hosting**; see [Self-hosted Git hosting](/vcs-integration). Multica Cloud does not offer this entry point.
+Self-hosted Multica can also connect self-hosted Forgejo, Gitea, or GitLab instances in parallel, with the same PR auto-linking, merge-driven status changes, and CI display. The entry point is **Settings → Code**; see [Self-hosted Git hosting](/vcs-integration). Multica Cloud does not offer this entry point.
## Connect GitHub
A workspace owner or admin can complete the connection:
-1. Open **Settings → GitHub**.
-2. Turn on the GitHub integration master switch.
-3. Click **Connect GitHub**.
-4. In GitHub, pick the account or organization and authorize all repositories or a chosen subset.
-5. Return to Multica after the installation completes.
+1. Open **Settings → Code**.
+2. In the **GitHub** row, click **Connect GitHub**.
+3. In GitHub, pick the account or organization and authorize all repositories or a chosen subset.
+4. Return to Multica after the installation completes.
The connection status shows on the same page. Regular members can view the status but can't connect, disconnect, or change the switches.
@@ -29,11 +28,10 @@ The **GitHub connection** decides which repositories Multica receives PR events
## Feature switches
-**Settings → GitHub** has these settings:
+The **Pull requests & issues** section of **Settings → Code** has these settings. **Pause GitHub features** in the GitHub row's **⋯** menu stops the three switches below without disconnecting the GitHub App.
| Switch | Effect |
|---|---|
-| GitHub integration | Master switch. When off, the three below stop working, but the GitHub App stays connected. |
| PR sidebar | Shows linked pull requests in issue detail. |
| Co-authored-by | Adds `Co-authored-by: multica-agent <[email protected]>` to commits created by agents. |
| Auto-link PRs | Links a PR to the issue whose identifier is in its branch name or title, or follows a closing keyword in its body. |
@@ -42,7 +40,7 @@ The **GitHub connection** decides which repositories Multica receives PR events
-**After PRs merge, move the issue to** applies to every code host, including [self-hosted Git hosting](/vcs-integration), whose page shows the same setting.
+**After PRs merge, move the issue to** applies to every code host, including [self-hosted Git hosting](/vcs-integration).
## Link a PR to an issue
@@ -88,7 +86,7 @@ Click an entry to open the PR on GitHub. Turning off the **PR sidebar** only hid
## When merged PRs move an issue
-A merged PR doesn't necessarily mean the issue is finished, so the workspace decides what a merge does: **Settings → Integrations → GitHub → After PRs merge, move the issue to**. Pick `Done` (the default for new workspaces), another started or done status — a custom one such as *Awaiting regression* works too — or **Don't change**. Workspaces that existed before this setting keep their behavior: if merging didn't always complete their issues, they start on **Don't change**.
+A merged PR doesn't necessarily mean the issue is finished, so the workspace decides what a merge does: **Settings → Code → After PRs merge, move the issue to**. Pick `Done` (the default for new workspaces), another started or done status — a custom one such as *Awaiting regression* works too — or **Don't change**. Workspaces that existed before this setting keep their behavior: if merging didn't always complete their issues, they start on **Don't change**.
An issue moves to the chosen status when all of the following hold:
@@ -111,7 +109,7 @@ If one identifier matches an issue in more than one of the connected workspaces
## Disconnect
-Clicking **Disconnect** in **Settings → GitHub** only removes the relationship between the current Multica workspace and the installation; it does not uninstall the App from GitHub for you. Existing PR records are kept, and new events stop flowing into that workspace.
+Choosing **Disconnect** from the GitHub row's **⋯** menu on **Settings → Code** only removes the relationship between the current Multica workspace and the installation; it does not uninstall the App from GitHub for you. Existing PR records are kept, and new events stop flowing into that workspace.
To revoke repository authorization on the GitHub side, uninstall the App or adjust its repository scope from your personal or organization GitHub App installations page. After uninstalling, every Multica workspace linked to that installation stops receiving events.
@@ -181,7 +179,7 @@ When upgrading an existing deployment, run the regular database migrations first
make migrate-up
```
-Restart the API server, then complete the connection in **Settings → GitHub**.
+Restart the API server, then complete the connection in **Settings → Code**.
## Troubleshooting
diff --git a/apps/docs/content/docs/github-integration.zh.mdx b/apps/docs/content/docs/github-integration.zh.mdx
index 77cac267be..eaac179b57 100644
--- a/apps/docs/content/docs/github-integration.zh.mdx
+++ b/apps/docs/content/docs/github-integration.zh.mdx
@@ -9,17 +9,16 @@ import { Callout } from "fumadocs-ui/components/callout";
GitHub 集成只读取安装时授权的仓库,不会提交代码、评论或 status check。
-自部署的 Multica 还可以并行连接自托管的 Forgejo、Gitea 或 GitLab 实例,获得同样的 PR 自动关联、合并后改状态和 CI 展示,入口在 **设置 → 集成 → Git 代码托管**,详见[自托管 Git 代码托管](/vcs-integration)。Multica Cloud 不提供该入口。
+自部署的 Multica 还可以并行连接自托管的 Forgejo、Gitea 或 GitLab 实例,获得同样的 PR 自动关联、合并后改状态和 CI 展示,入口在 **设置 → 代码**,详见[自托管 Git 代码托管](/vcs-integration)。Multica Cloud 不提供该入口。
## 连接 GitHub
工作区 owner 或 admin 可以完成连接:
-1. 打开 **设置 → GitHub**。
-2. 打开 GitHub 集成总开关。
-3. 点击 **连接 GitHub**。
-4. 在 GitHub 中选择账号或组织,并授权全部仓库或指定仓库。
-5. 安装完成后回到 Multica。
+1. 打开 **设置 → 代码**。
+2. 在 **GitHub** 一行点击 **连接 GitHub**。
+3. 在 GitHub 中选择账号或组织,并授权全部仓库或指定仓库。
+4. 安装完成后回到 Multica。
连接状态会显示在同一页面。普通成员可以查看状态,但不能连接、断开或修改开关。
@@ -29,11 +28,10 @@ GitHub 集成只读取安装时授权的仓库,不会提交代码、评论或
## 功能开关
-**设置 → GitHub** 中有以下设置:
+**设置 → 代码** 的 **PR 与任务联动** 中有以下设置。在 GitHub 一行的 **⋯** 菜单中选择 **暂停 GitHub 功能** 后,下面三项开关不再生效,但不会断开 GitHub App。
| 设置 | 作用 |
|---|---|
-| GitHub 集成 | 总开关。关闭后,下面三项不再生效,但不会断开 GitHub App。 |
| PR 侧栏 | 在任务详情中显示关联的 pull request。 |
| Co-authored-by | 在智能体创建的 commit 中加入 `Co-authored-by: multica-agent <[email protected]>`。 |
| 自动关联 PR | 分支名或标题含任务编号、或正文中关闭语句后写了任务编号的 PR,会关联到对应任务。 |
@@ -42,7 +40,7 @@ GitHub 集成只读取安装时授权的仓库,不会提交代码、评论或
-**PR 合并后,任务状态改为** 对所有代码托管平台生效,包括[自托管 Git 代码托管](/vcs-integration),那个页面显示的是同一项设置。
+**PR 合并后,任务状态改为** 对所有代码托管平台生效,包括[自托管 Git 代码托管](/vcs-integration)。
## 让 PR 关联到任务
@@ -88,7 +86,7 @@ CI 状态和可合并性来自 Multica 从 GitHub API 拉取的快照,两者
## PR 合并后怎样改状态
-PR 合并不一定代表任务已完成,所以由工作区决定合并后做什么:**设置 → 集成 → GitHub → PR 合并后,任务状态改为**。可以选 `Done`(新工作区的默认值)、其他"已开始"或"已完成"类的状态(自定义状态也可以,例如「待回归」),或者**不改变**。这项设置出现之前就已存在的工作区保持原来的行为:如果以前的合并并不总会完成任务,初始值就是**不改变**。
+PR 合并不一定代表任务已完成,所以由工作区决定合并后做什么:**设置 → 代码 → PR 合并后,任务状态改为**。可以选 `Done`(新工作区的默认值)、其他"已开始"或"已完成"类的状态(自定义状态也可以,例如「待回归」),或者**不改变**。这项设置出现之前就已存在的工作区保持原来的行为:如果以前的合并并不总会完成任务,初始值就是**不改变**。
以下条件同时成立时,任务会改为选定的状态:
@@ -111,7 +109,7 @@ PR 怎么关联的不影响结果:标题、分支名和正文里的 `Closes MU
## 断开连接
-在 **设置 → GitHub** 点击 **断开**,只会移除当前 Multica 工作区与该 installation 的关系,不会替你从 GitHub 卸载 App。已有 PR 记录会保留,新的事件不再进入该工作区。
+在 **设置 → 代码** 的 GitHub 一行,从 **⋯** 菜单选择 **断开**,只会移除当前 Multica 工作区与该 installation 的关系,不会替你从 GitHub 卸载 App。已有 PR 记录会保留,新的事件不再进入该工作区。
撤销 GitHub 侧的仓库授权,需到个人或组织的 GitHub App installations 页面卸载或调整仓库范围。卸载后,与该 installation 关联的所有 Multica 工作区都会停止接收事件。
@@ -181,7 +179,7 @@ GITHUB_APP_PRIVATE_KEY=<完整 PEM 私钥,保留 BEGIN/END 行和换行>
make migrate-up
```
-重启 API 服务,再到 **设置 → GitHub** 完成连接。
+重启 API 服务,再到 **设置 → 代码** 完成连接。
## 常见问题
diff --git a/apps/docs/content/docs/lark-bot-integration.fr.mdx b/apps/docs/content/docs/lark-bot-integration.fr.mdx
index 654023b279..e1138ce76b 100644
--- a/apps/docs/content/docs/lark-bot-integration.fr.mdx
+++ b/apps/docs/content/docs/lark-bot-integration.fr.mdx
@@ -58,7 +58,7 @@ La première ligne devient le titre et le reste la description. Envoyer `/issue`
## Gérer les connexions
-Ouvrez **Paramètres → Intégrations** pour voir les bots connectés dans l'espace de travail. Les propriétaires et administrateurs de l'espace de travail peuvent les déconnecter ici ; le propriétaire d'un agent peut aussi gérer son propre bot depuis la page **Intégrations** de cet agent.
+Ouvrez **Paramètres → Messagerie → Lark** pour voir les bots connectés dans l'espace de travail. Les propriétaires et administrateurs de l'espace de travail peuvent les déconnecter ici ; le propriétaire d'un agent peut aussi gérer son propre bot depuis la page **Intégrations** de cet agent.
Après la déconnexion, le bot ne reçoit plus de nouveaux messages. Les conversations et enregistrements d'audit existants ne sont pas supprimés.
diff --git a/apps/docs/content/docs/lark-bot-integration.ja.mdx b/apps/docs/content/docs/lark-bot-integration.ja.mdx
index 74e54a4416..6befc6c670 100644
--- a/apps/docs/content/docs/lark-bot-integration.ja.mdx
+++ b/apps/docs/content/docs/lark-bot-integration.ja.mdx
@@ -57,7 +57,7 @@ Safari ではログインに成功してもログイン画面に残ります。
## 接続を管理する
-**設定 → 連携**を開くと、ワークスペースに接続済みの Bot を確認できます。ワークスペースの owner と admin はここから接続を解除できます。エージェントの所有者は、そのエージェントの**連携**ページから自分の Bot を管理できます。
+**設定 → メッセージング → Lark**を開くと、ワークスペースに接続済みの Bot を確認できます。ワークスペースの owner と admin はここから接続を解除できます。エージェントの所有者は、そのエージェントの**連携**ページから自分の Bot を管理できます。
接続を解除すると、Bot は新しいメッセージを受信しなくなります。既存の会話と監査記録は削除されません。
diff --git a/apps/docs/content/docs/lark-bot-integration.ko.mdx b/apps/docs/content/docs/lark-bot-integration.ko.mdx
index b0428e9440..d03e68cc4e 100644
--- a/apps/docs/content/docs/lark-bot-integration.ko.mdx
+++ b/apps/docs/content/docs/lark-bot-integration.ko.mdx
@@ -57,7 +57,7 @@ Safari에서 로그인에 성공해도 로그인 페이지에 계속 머뭅니
## 연결 관리
-**설정 → 연동**에서 워크스페이스에 연결된 Bot을 확인할 수 있습니다. 워크스페이스 owner와 admin은 여기서 연결을 해제할 수 있고, 에이전트 owner도 해당 에이전트의 **연동** 페이지에서 자신의 Bot을 관리할 수 있습니다.
+**설정 → 메신저 → Lark**에서 워크스페이스에 연결된 Bot을 확인할 수 있습니다. 워크스페이스 owner와 admin은 여기서 연결을 해제할 수 있고, 에이전트 owner도 해당 에이전트의 **연동** 페이지에서 자신의 Bot을 관리할 수 있습니다.
연결을 해제하면 Bot이 새 메시지를 받지 않습니다. 기존 대화와 감사 기록은 함께 삭제되지 않습니다.
diff --git a/apps/docs/content/docs/lark-bot-integration.mdx b/apps/docs/content/docs/lark-bot-integration.mdx
index 6d06e35ea9..984a727a6a 100644
--- a/apps/docs/content/docs/lark-bot-integration.mdx
+++ b/apps/docs/content/docs/lark-bot-integration.mdx
@@ -58,7 +58,7 @@ The first line becomes the title and the rest becomes the description. Sending `
## Manage connections
-Open **Settings → Integrations** to view the Bots connected in the workspace. Workspace owners and admins can disconnect them here; an agent's owner can also manage their own Bot from that agent's **Integrations** page.
+Open **Settings → Messaging → Lark** to view the Bots connected in the workspace. Workspace owners and admins can disconnect them here; an agent's owner can also manage their own Bot from that agent's **Integrations** page.
After disconnecting, the Bot stops receiving new messages. Existing conversations and audit records are not deleted.
diff --git a/apps/docs/content/docs/lark-bot-integration.zh.mdx b/apps/docs/content/docs/lark-bot-integration.zh.mdx
index 01fd3ccc5c..d897b8888e 100644
--- a/apps/docs/content/docs/lark-bot-integration.zh.mdx
+++ b/apps/docs/content/docs/lark-bot-integration.zh.mdx
@@ -58,7 +58,7 @@ Safari 登录成功后仍然停留在登录页。
## 管理连接
-打开 **设置 → 集成** 可以查看工作区内已连接的 Bot。工作区 owner 和 admin 可以在这里断开连接;智能体所有者也可以回到该智能体的 **集成** 页面管理自己的 Bot。
+打开 **设置 → 消息渠道 → 飞书** 可以查看工作区内已连接的 Bot。工作区 owner 和 admin 可以在这里断开连接;智能体所有者也可以回到该智能体的 **集成** 页面管理自己的 Bot。
断开后,Bot 不再接收新消息,已有的对话和审计记录不会随之删除。
diff --git a/apps/docs/content/docs/project-resources.fr.mdx b/apps/docs/content/docs/project-resources.fr.mdx
index fad580af10..f3bea07a5d 100644
--- a/apps/docs/content/docs/project-resources.fr.mdx
+++ b/apps/docs/content/docs/project-resources.fr.mdx
@@ -24,9 +24,9 @@ Un répertoire local ne s'applique qu'au daemon auquel il est lié. Lorsque le d
## Ajouter un dépôt GitHub
-Ouvrez le projet et choisissez « Ajouter une ressource » sous **Ressources**. Sélectionnez un dépôt déjà rattaché à l'espace de travail, ou collez une URL Git. Les dépôts de l'espace de travail se gèrent dans **Paramètres → Dépôts** ; une fois GitHub connecté, la même page propose **Choisir depuis GitHub** pour importer les dépôts auxquels la GitHub App a accès.
+Ouvrez le projet et choisissez « Ajouter une ressource » sous **Ressources**. Sélectionnez un dépôt déjà rattaché à l'espace de travail, ou collez une URL Git. Les dépôts de l'espace de travail se gèrent dans **Paramètres → Code** ; une fois GitHub connecté, la même page propose **Choisir depuis GitHub** pour importer les dépôts auxquels la GitHub App a accès.
-Les dépôts ne se limitent pas à GitHub : toute URL Git accessible par le runtime fonctionne comme ressource de dépôt. Une instance Multica auto-hébergée peut aussi connecter des instances Forgejo, Gitea ou GitLab auto-hébergées dans **Paramètres → Intégrations → Fournisseurs git (auto-hébergés)** ; voir [Fournisseurs Git auto-hébergés](/vcs-integration).
+Les dépôts ne se limitent pas à GitHub : toute URL Git accessible par le runtime fonctionne comme ressource de dépôt. Une instance Multica auto-hébergée peut aussi connecter des instances Forgejo, Gitea ou GitLab auto-hébergées dans **Paramètres → Code** ; voir [Fournisseurs Git auto-hébergés](/vcs-integration).
Lors de la création d'un projet, vous pouvez aussi choisir des dépôts directement sous **Dépôts**. Un même projet peut rattacher plusieurs dépôts GitHub.
diff --git a/apps/docs/content/docs/project-resources.ja.mdx b/apps/docs/content/docs/project-resources.ja.mdx
index c7b75b8177..6913406ff9 100644
--- a/apps/docs/content/docs/project-resources.ja.mdx
+++ b/apps/docs/content/docs/project-resources.ja.mdx
@@ -24,9 +24,9 @@ import { Callout } from "fumadocs-ui/components/callout";
## GitHub リポジトリの追加
-プロジェクトを開き、**リソース** で「リソースを追加」を選択します。ワークスペースに紐づけ済みのリポジトリを選ぶことも、Git URL を貼り付けることもできます。ワークスペースのリポジトリは **設定 → リポジトリ** で管理します。GitHub を接続すると、同じページの **GitHub から選択** で、App が認可済みのリポジトリをインポートできます。
+プロジェクトを開き、**リソース** で「リソースを追加」を選択します。ワークスペースに紐づけ済みのリポジトリを選ぶことも、Git URL を貼り付けることもできます。ワークスペースのリポジトリは **設定 → コード** で管理します。GitHub を接続すると、同じページの **GitHub から選択** で、App が認可済みのリポジトリをインポートできます。
-リポジトリは GitHub に限定されません。ランタイムがアクセスできる Git URL であれば、どれでもリポジトリリソースとして使えます。セルフホストの Multica では、**設定 → 連携 → Git ホスティング** でセルフホストの Forgejo、Gitea、GitLab も接続できます。詳細は[セルフホスト Git ホスティング](/vcs-integration)を参照してください。
+リポジトリは GitHub に限定されません。ランタイムがアクセスできる Git URL であれば、どれでもリポジトリリソースとして使えます。セルフホストの Multica では、**設定 → コード** でセルフホストの Forgejo、Gitea、GitLab も接続できます。詳細は[セルフホスト Git ホスティング](/vcs-integration)を参照してください。
プロジェクトの作成時に、**リポジトリ** で直接リポジトリを選ぶこともできます。1 つのプロジェクトには複数の GitHub リポジトリを紐づけられます。
diff --git a/apps/docs/content/docs/project-resources.ko.mdx b/apps/docs/content/docs/project-resources.ko.mdx
index d03b39fbe8..a4980a867a 100644
--- a/apps/docs/content/docs/project-resources.ko.mdx
+++ b/apps/docs/content/docs/project-resources.ko.mdx
@@ -24,9 +24,9 @@ import { Callout } from "fumadocs-ui/components/callout";
## GitHub 저장소 추가
-프로젝트를 열고 **리소스**에서 "리소스 추가"를 선택합니다. 워크스페이스에 이미 연결된 저장소를 고르거나 Git URL을 붙여 넣을 수 있습니다. 워크스페이스 저장소는 **설정 → 코드 저장소**에서 관리합니다. GitHub를 연결한 뒤 같은 페이지에서 **GitHub에서 선택**을 통해 App에 승인된 저장소를 가져올 수 있습니다.
+프로젝트를 열고 **리소스**에서 "리소스 추가"를 선택합니다. 워크스페이스에 이미 연결된 저장소를 고르거나 Git URL을 붙여 넣을 수 있습니다. 워크스페이스 저장소는 **설정 → 코드**에서 관리합니다. GitHub를 연결한 뒤 같은 페이지에서 **GitHub에서 선택**을 통해 App에 승인된 저장소를 가져올 수 있습니다.
-저장소는 GitHub로 제한되지 않습니다. 런타임이 접근할 수 있는 Git URL이라면 모두 저장소 리소스로 사용할 수 있습니다. 자체 배포한 Multica에서는 **설정 → 연동 → Git 코드 호스팅**에서 자체 호스팅 Forgejo, Gitea, GitLab을 연결할 수도 있습니다. [자체 호스팅 Git 코드 호스팅](/vcs-integration)을 참고하세요.
+저장소는 GitHub로 제한되지 않습니다. 런타임이 접근할 수 있는 Git URL이라면 모두 저장소 리소스로 사용할 수 있습니다. 자체 배포한 Multica에서는 **설정 → 코드**에서 자체 호스팅 Forgejo, Gitea, GitLab을 연결할 수도 있습니다. [자체 호스팅 Git 코드 호스팅](/vcs-integration)을 참고하세요.
프로젝트를 만들 때 **Repos**에서 바로 저장소를 선택할 수도 있습니다. 하나의 프로젝트에 여러 GitHub 저장소를 연결할 수 있습니다.
diff --git a/apps/docs/content/docs/project-resources.mdx b/apps/docs/content/docs/project-resources.mdx
index 1fa5901e5d..16b43d695f 100644
--- a/apps/docs/content/docs/project-resources.mdx
+++ b/apps/docs/content/docs/project-resources.mdx
@@ -24,9 +24,9 @@ A local directory only applies to the daemon it is bound to. When the daemon exe
## Add a GitHub repository
-Open the project and choose "Add resource" under **Resources**. Pick a repository already linked to the workspace, or paste a Git URL. Workspace repositories are managed in **Settings → Repositories**; once GitHub is connected, the same page offers **Pick from GitHub** to import repositories the App is authorized for.
+Open the project and choose "Add resource" under **Resources**. Pick a repository already linked to the workspace, or paste a Git URL. Workspace repositories are managed in **Settings → Code**; once GitHub is connected, the same page offers **Pick from GitHub** to import repositories the App is authorized for.
-Repositories are not limited to GitHub: any Git URL the runtime can reach works as a repository resource. Self-hosted Multica can also connect self-hosted Forgejo, Gitea, or GitLab under **Settings → Integrations → Git hosting**; see [Self-hosted Git hosting](/vcs-integration).
+Repositories are not limited to GitHub: any Git URL the runtime can reach works as a repository resource. Self-hosted Multica can also connect self-hosted Forgejo, Gitea, or GitLab under **Settings → Code**; see [Self-hosted Git hosting](/vcs-integration).
When creating a project, you can also pick repositories directly under **Repos**. One project can link multiple GitHub repositories.
diff --git a/apps/docs/content/docs/project-resources.zh.mdx b/apps/docs/content/docs/project-resources.zh.mdx
index 212b61841a..f841f02e32 100644
--- a/apps/docs/content/docs/project-resources.zh.mdx
+++ b/apps/docs/content/docs/project-resources.zh.mdx
@@ -24,9 +24,9 @@ import { Callout } from "fumadocs-ui/components/callout";
## 添加 GitHub 仓库
-打开项目,在 **资源** 中选择"添加资源"。可以选择已关联到工作区的仓库,也可以粘贴 Git URL。工作区仓库在 **设置 → 代码仓库** 中维护;连接 GitHub 后,可在同一页面通过 **从 GitHub 选择** 导入 App 已授权的仓库。
+打开项目,在 **资源** 中选择"添加资源"。可以选择已关联到工作区的仓库,也可以粘贴 Git URL。工作区仓库在 **设置 → 代码** 中维护;连接 GitHub 后,可在同一页面通过 **从 GitHub 选择** 导入 App 已授权的仓库。
-仓库不限于 GitHub:任何运行时能访问的 Git URL 都可以作为仓库资源。自部署的 Multica 还可以在 **设置 → 集成 → Git 代码托管** 连接自托管的 Forgejo、Gitea 或 GitLab,见[自托管 Git 代码托管](/vcs-integration)。
+仓库不限于 GitHub:任何运行时能访问的 Git URL 都可以作为仓库资源。自部署的 Multica 还可以在 **设置 → 代码** 连接自托管的 Forgejo、Gitea 或 GitLab,见[自托管 Git 代码托管](/vcs-integration)。
创建项目时,也可以直接在 **Repos** 中选择仓库。一个项目可以关联多个 GitHub 仓库。
diff --git a/apps/docs/content/docs/slack-bot-integration.fr.mdx b/apps/docs/content/docs/slack-bot-integration.fr.mdx
index 3f7e79c7df..7818c51003 100644
--- a/apps/docs/content/docs/slack-bot-integration.fr.mdx
+++ b/apps/docs/content/docs/slack-bot-integration.fr.mdx
@@ -163,7 +163,7 @@ Dans un canal ou un fil, envoyez `@Multica /clear [message]` dans le fil cible a
## Gérer les connexions
-Ouvrez **Paramètres → Intégrations** pour voir tous les bots Slack connectés. Les propriétaires et administrateurs de l'espace de travail peuvent les déconnecter.
+Ouvrez **Paramètres → Messagerie → Slack** pour voir tous les bots Slack connectés. Les propriétaires et administrateurs de l'espace de travail peuvent les déconnecter.
Après la déconnexion, la connexion Socket Mode s'arrête et le bot ne reçoit plus de nouveaux messages. Les conversations et enregistrements d'audit existants ne sont pas supprimés.
diff --git a/apps/docs/content/docs/slack-bot-integration.ja.mdx b/apps/docs/content/docs/slack-bot-integration.ja.mdx
index b39f2c92d1..c3ca2e8506 100644
--- a/apps/docs/content/docs/slack-bot-integration.ja.mdx
+++ b/apps/docs/content/docs/slack-bot-integration.ja.mdx
@@ -161,7 +161,7 @@ Bot との DM で `/clear` を送ると、現在の Multica Chat はそのまま
## 接続を管理する
-**設定 → 連携**を開くと、接続済みの Slack Bot をすべて確認できます。ワークスペースの owner と admin は接続を解除できます。
+**設定 → メッセージング → Slack**を開くと、接続済みの Slack Bot をすべて確認できます。ワークスペースの owner と admin は接続を解除できます。
接続を解除すると Socket Mode の接続が停止し、Bot は新しいメッセージを受信しなくなります。既存の会話と監査記録は削除されません。
diff --git a/apps/docs/content/docs/slack-bot-integration.ko.mdx b/apps/docs/content/docs/slack-bot-integration.ko.mdx
index 3ff079e3e0..5f82595dfa 100644
--- a/apps/docs/content/docs/slack-bot-integration.ko.mdx
+++ b/apps/docs/content/docs/slack-bot-integration.ko.mdx
@@ -161,7 +161,7 @@ Bot과의 DM에서 `/clear`를 보내면 현재 Multica Chat은 유지되고 에
## 연결 관리
-**설정 → 연동**에서 연결된 모든 Slack Bot을 확인할 수 있습니다. 워크스페이스 owner와 admin이 연결을 해제할 수 있습니다.
+**설정 → 메신저 → Slack**에서 연결된 모든 Slack Bot을 확인할 수 있습니다. 워크스페이스 owner와 admin이 연결을 해제할 수 있습니다.
연결을 해제하면 Socket Mode 연결이 중지되고 Bot이 새 메시지를 받지 않습니다. 기존 대화와 감사 기록은 함께 삭제되지 않습니다.
diff --git a/apps/docs/content/docs/slack-bot-integration.mdx b/apps/docs/content/docs/slack-bot-integration.mdx
index d2fb324b66..48905c74fd 100644
--- a/apps/docs/content/docs/slack-bot-integration.mdx
+++ b/apps/docs/content/docs/slack-bot-integration.mdx
@@ -163,7 +163,7 @@ In a channel or thread, send `@Multica /clear [message]` in the target thread so
## Manage connections
-Open **Settings → Integrations** to view all connected Slack Bots. Workspace owners and admins can disconnect them.
+Open **Settings → Messaging → Slack** to view all connected Slack Bots. Workspace owners and admins can disconnect them.
After disconnecting, the Socket Mode connection stops and the Bot no longer receives new messages. Existing conversations and audit records are not deleted.
diff --git a/apps/docs/content/docs/slack-bot-integration.zh.mdx b/apps/docs/content/docs/slack-bot-integration.zh.mdx
index 46db74bda7..48b3343e5d 100644
--- a/apps/docs/content/docs/slack-bot-integration.zh.mdx
+++ b/apps/docs/content/docs/slack-bot-integration.zh.mdx
@@ -163,7 +163,7 @@ Bot 只会响应明确 @ 它的频道消息。执行时,它会在权限允许
## 管理连接
-打开 **设置 → 集成** 可以查看所有已连接的 Slack Bot。工作区 owner 和 admin 可以断开连接。
+打开 **设置 → 消息渠道 → Slack** 可以查看所有已连接的 Slack Bot。工作区 owner 和 admin 可以断开连接。
断开后,Socket Mode 连接会停止,Bot 不再接收新消息。已有的对话和审计记录不会随之删除。
diff --git a/apps/docs/content/docs/telegram-bot-integration.fr.mdx b/apps/docs/content/docs/telegram-bot-integration.fr.mdx
index 72d73563c3..0a631db247 100644
--- a/apps/docs/content/docs/telegram-bot-integration.fr.mdx
+++ b/apps/docs/content/docs/telegram-bot-integration.fr.mdx
@@ -67,7 +67,7 @@ Les photos, fichiers, vidéos, messages vocaux et audio parviennent à l'agent s
## Gérer les connexions
-Ouvrez **Paramètres → Intégrations → Telegram** pour voir les bots connectés. Les propriétaires et administrateurs peuvent en déconnecter un. La déconnexion arrête le long polling et les réponses sortantes, mais conserve les conversations Multica et les enregistrements d'audit.
+Ouvrez **Paramètres → Messagerie → Telegram** pour voir les bots connectés. Les propriétaires et administrateurs peuvent en déconnecter un. La déconnexion arrête le long polling et les réponses sortantes, mais conserve les conversations Multica et les enregistrements d'audit.
## Configuration en auto-hébergement
diff --git a/apps/docs/content/docs/telegram-bot-integration.ja.mdx b/apps/docs/content/docs/telegram-bot-integration.ja.mdx
index 14118ae498..c8441b428f 100644
--- a/apps/docs/content/docs/telegram-bot-integration.ja.mdx
+++ b/apps/docs/content/docs/telegram-bot-integration.ja.mdx
@@ -54,7 +54,7 @@ Bot は Telegram メッセージを送信・編集してテキストをストリ
## 管理とセルフホスティング
-**Settings → Integrations → Telegram** で接続済み Bot を確認できます。owner と admin は接続を解除できます。会話と監査履歴は保持されます。
+**設定 → メッセージング → Telegram** で接続済み Bot を確認できます。owner と admin は接続を解除できます。会話と監査履歴は保持されます。
セルフホスト環境では、API 起動前に固定の 32-byte 暗号鍵を設定します。
diff --git a/apps/docs/content/docs/telegram-bot-integration.ko.mdx b/apps/docs/content/docs/telegram-bot-integration.ko.mdx
index c576ae527c..51e9cbdc24 100644
--- a/apps/docs/content/docs/telegram-bot-integration.ko.mdx
+++ b/apps/docs/content/docs/telegram-bot-integration.ko.mdx
@@ -54,7 +54,7 @@ Bot은 Telegram 메시지를 보내고 편집해 텍스트 응답을 스트리
## 관리 및 자체 호스팅
-**Settings → Integrations → Telegram**에서 연결된 Bot을 확인할 수 있습니다. owner와 admin은 연결을 해제할 수 있으며, 기존 대화와 감사 기록은 유지됩니다.
+**설정 → 메신저 → Telegram**에서 연결된 Bot을 확인할 수 있습니다. owner와 admin은 연결을 해제할 수 있으며, 기존 대화와 감사 기록은 유지됩니다.
자체 호스팅 환경에서는 API 서버 시작 전에 고정된 32-byte 암호화 키를 설정합니다.
diff --git a/apps/docs/content/docs/telegram-bot-integration.mdx b/apps/docs/content/docs/telegram-bot-integration.mdx
index 7de06ec207..b6352d166d 100644
--- a/apps/docs/content/docs/telegram-bot-integration.mdx
+++ b/apps/docs/content/docs/telegram-bot-integration.mdx
@@ -67,7 +67,7 @@ Photos, files, video, voice, and audio messages reach the agent as attachments o
## Manage connections
-Open **Settings → Integrations → Telegram** to view connected Bots. Owners and admins can disconnect one. Disconnecting stops long polling and outbound replies but preserves Multica conversations and audit records.
+Open **Settings → Messaging → Telegram** to view connected Bots. Owners and admins can disconnect one. Disconnecting stops long polling and outbound replies but preserves Multica conversations and audit records.
## Self-hosting setup
diff --git a/apps/docs/content/docs/telegram-bot-integration.zh.mdx b/apps/docs/content/docs/telegram-bot-integration.zh.mdx
index 820f0e9852..0ec2e39513 100644
--- a/apps/docs/content/docs/telegram-bot-integration.zh.mdx
+++ b/apps/docs/content/docs/telegram-bot-integration.zh.mdx
@@ -67,7 +67,7 @@ Bot 通过发送并编辑 Telegram 消息来流式展示文字回复,引用触
## 管理与断开
-在 **设置 → 集成 → Telegram** 查看所有已连接 Bot。owner 和 admin 可以断开。断开会停止长轮询和后续回复,但保留 Multica 对话与审计记录。
+在 **设置 → 消息渠道 → Telegram** 查看所有已连接 Bot。owner 和 admin 可以断开。断开会停止长轮询和后续回复,但保留 Multica 对话与审计记录。
## 自托管配置
diff --git a/apps/docs/content/docs/tutorial.fr.mdx b/apps/docs/content/docs/tutorial.fr.mdx
index 91bd6982db..583298c382 100644
--- a/apps/docs/content/docs/tutorial.fr.mdx
+++ b/apps/docs/content/docs/tutorial.fr.mdx
@@ -98,7 +98,7 @@ Dans **Discussion**, sélectionnez Engineer et demandez-lui de créer un dépôt
![Discussion : Engineer répond que le dépôt est créé et enregistré](/images/docs/tutorial-chat-create-repo.webp)
-Ouvrez **Paramètres → Dépôts** pour vérifier : `personal-website` figure dans la liste. C'est ici que les agents choisissent un dépôt lorsqu'ils démarrent des exécutions.
+Ouvrez **Paramètres → Code** pour vérifier : `personal-website` figure dans la liste. C'est ici que les agents choisissent un dépôt lorsqu'ils démarrent des exécutions.
![La liste des dépôts dans les paramètres](/images/docs/tutorial-repo-settings.webp)
diff --git a/apps/docs/content/docs/tutorial.ja.mdx b/apps/docs/content/docs/tutorial.ja.mdx
index d47d322452..14d0dc87b3 100644
--- a/apps/docs/content/docs/tutorial.ja.mdx
+++ b/apps/docs/content/docs/tutorial.ja.mdx
@@ -98,7 +98,7 @@ request is ambiguous, ask before acting.
![チャット:Engineer がリポジトリの作成と登録を報告](/images/docs/tutorial-chat-create-repo.webp)
-**設定 → リポジトリ** を開いて確認します。`personal-website` がすでに一覧に入っています。以降、エージェントが作業を実行するときは、ここからリポジトリを選びます。
+**設定 → コード** を開いて確認します。`personal-website` がすでに一覧に入っています。以降、エージェントが作業を実行するときは、ここからリポジトリを選びます。
![設定内のコードリポジトリ一覧](/images/docs/tutorial-repo-settings.webp)
diff --git a/apps/docs/content/docs/tutorial.mdx b/apps/docs/content/docs/tutorial.mdx
index d6dede5d23..ea4d56e299 100644
--- a/apps/docs/content/docs/tutorial.mdx
+++ b/apps/docs/content/docs/tutorial.mdx
@@ -98,7 +98,7 @@ In **Chat**, select Engineer and tell it to create an empty repository named `pe
![Chat: Engineer replies that the repository is created and registered](/images/docs/tutorial-chat-create-repo.webp)
-Open **Settings → Repositories** to confirm: `personal-website` is in the list. Agents pick a repository from here when they start runs.
+Open **Settings → Code** to confirm: `personal-website` is in the list. Agents pick a repository from here when they start runs.
![The repository list in settings](/images/docs/tutorial-repo-settings.webp)
diff --git a/apps/docs/content/docs/tutorial.zh.mdx b/apps/docs/content/docs/tutorial.zh.mdx
index c6a55d1382..f2e2632323 100644
--- a/apps/docs/content/docs/tutorial.zh.mdx
+++ b/apps/docs/content/docs/tutorial.zh.mdx
@@ -98,7 +98,7 @@ request is ambiguous, ask before acting.
![聊天,Engineer 回复仓库已创建并注册](/images/docs/tutorial-chat-create-repo.webp)
-打开**设置 → 代码仓库** 确认:`personal-website` 已经在列表中。之后智能体运行时,从这里选择仓库。
+打开**设置 → 代码** 确认:`personal-website` 已经在列表中。之后智能体运行时,从这里选择仓库。
![设置中的代码仓库列表](/images/docs/tutorial-repo-settings.webp)
diff --git a/apps/docs/content/docs/vcs-integration.fr.mdx b/apps/docs/content/docs/vcs-integration.fr.mdx
index 3278a7b541..8401428d0b 100644
--- a/apps/docs/content/docs/vcs-integration.fr.mdx
+++ b/apps/docs/content/docs/vcs-integration.fr.mdx
@@ -11,7 +11,7 @@ exécutez Multica vous-même ; elle n'est pas proposée sur Multica Cloud. « Au
signifie ici que c'est **Multica** qui est auto-hébergé — généralement pour pouvoir joindre
une instance Git sur votre propre réseau. Un opérateur du serveur doit l'activer
(`MULTICA_VCS_INTEGRATION_ENABLED=true`) et définir `MULTICA_VCS_SECRET_KEY` ; d'ici là,
-la section n'apparaît pas dans Paramètres → Intégrations.
+la ligne n'apparaît pas dans Paramètres → Code.
</Callout>
Multica se connecte à un fournisseur Git auto-hébergé par espace de travail : **Forgejo**, **Gitea** ou **GitLab**. Une fois la connexion établie, toute pull request (GitLab : merge request) dont le nom de branche ou le titre contient un identifiant de tâche (par exemple `MUL-123`), ou dont la description en cite un après un mot-clé de clôture (`Closes MUL-123`), est **associée automatiquement** à cette [tâche](/issues), apparaît sous **Pull requests** dans la barre latérale de la tâche et — une fois toutes les PR associées fusionnées — fait passer la tâche au statut choisi par l'espace de travail (**Terminé** par défaut). La CI du commit de tête s'affiche sous forme de barre de vérifications sur la carte.
@@ -51,7 +51,7 @@ Définissez `MULTICA_PUBLIC_URL` sur l'URL de base publique du serveur pour que
1. Chez votre fournisseur, créez un jeton d'accès disposant d'un accès en lecture aux dépôts que vous voulez refléter :
- **Forgejo / Gitea** : Settings → Applications.
- **GitLab** : un jeton d'accès personnel (ou de groupe/projet) avec la portée `read_api`.
-2. Dans Multica, ouvrez **Paramètres → Intégrations → Fournisseurs git (auto-hébergés)**.
+2. Dans Multica, ouvrez **Paramètres → Code**, puis cliquez sur **Connecter** sur la ligne **Git auto-hébergé**.
3. Choisissez le **Fournisseur**, saisissez l'URL de l'instance (par exemple `https://forgejo.example.com`) et le jeton d'accès, puis cliquez sur **Connecter**. Multica valide le jeton auprès de l'instance avant d'enregistrer.
4. Copiez l'**URL du webhook** et le **Secret du webhook** affichés après la connexion.
diff --git a/apps/docs/content/docs/vcs-integration.ja.mdx b/apps/docs/content/docs/vcs-integration.ja.mdx
index d4402dd9bd..c9ffbe4a68 100644
--- a/apps/docs/content/docs/vcs-integration.ja.mdx
+++ b/apps/docs/content/docs/vcs-integration.ja.mdx
@@ -6,7 +6,7 @@ description: ワークスペースごとにセルフホストの Forgejo、Gitea
import { Callout } from "fumadocs-ui/components/callout";
<Callout type="warn">
-**セルフホスト版 Multica 専用です。** この連携は Multica を**自分でデプロイしている**場合のみ利用でき、Multica Cloud では提供されません。ここでの「セルフホスト」は **Multica 自体**のセルフホストを意味します。通常は独自ネットワーク内の Git インスタンスへアクセスするために使用します。サーバー運用者が `MULTICA_VCS_INTEGRATION_ENABLED=true` を設定して機能を有効にし、`MULTICA_VCS_SECRET_KEY` も設定する必要があります。それまでは、設定 → 連携にこのセクションは表示されません。
+**セルフホスト版 Multica 専用です。** この連携は Multica を**自分でデプロイしている**場合のみ利用でき、Multica Cloud では提供されません。ここでの「セルフホスト」は **Multica 自体**のセルフホストを意味します。通常は独自ネットワーク内の Git インスタンスへアクセスするために使用します。サーバー運用者が `MULTICA_VCS_INTEGRATION_ENABLED=true` を設定して機能を有効にし、`MULTICA_VCS_SECRET_KEY` も設定する必要があります。それまでは、設定 → コードにこの行は表示されません。
</Callout>
Multica はワークスペースごとにセルフホストの Git ホスティング、**Forgejo**、**Gitea**、**GitLab** のいずれかへ接続します。接続後、ブランチ名かタイトルにタスク番号(例: `MUL-123`)を含む Pull Request(GitLab では Merge Request)、または本文で終了キーワードの直後にタスク番号を置いた PR は、対応する[タスク](/issues)へ**自動的に紐づけられ**、タスクサイドバーの **Pull requests** に表示されます。タスクに紐づく PR がすべてマージされると、タスクはワークスペースが選んだステータス(既定は「完了」)へ移動します。head commit の CI はカード上のチェックバーとして表示されます。
@@ -46,7 +46,7 @@ MULTICA_VCS_SECRET_KEY=<base64 32 バイト鍵>
1. Git ホスティング側で、リポジトリの読み取り権限を持つアクセストークンを作成します。
- **Forgejo / Gitea**: 設定 → アプリケーション。
- **GitLab**: `read_api` 権限を持つ個人(またはグループ/プロジェクト)アクセストークン。
-2. Multica で **設定 → 連携 → Git ホスティング**を開きます。
+2. Multica で **設定 → コード**を開き、**セルフホスト Git** の行で **接続** をクリックします。
3. **プロバイダー**を選択し、インスタンス URL(例: `https://forgejo.example.com`)とアクセストークンを入力して **接続**をクリックします。Multica は保存前に、そのトークンでインスタンスへアクセスして検証します。
4. 接続後に表示される **Webhook URL** と **Webhook secret** をコピーします。
diff --git a/apps/docs/content/docs/vcs-integration.ko.mdx b/apps/docs/content/docs/vcs-integration.ko.mdx
index 28f1190000..997533c811 100644
--- a/apps/docs/content/docs/vcs-integration.ko.mdx
+++ b/apps/docs/content/docs/vcs-integration.ko.mdx
@@ -6,7 +6,7 @@ description: 워크스페이스마다 자체 호스팅 Forgejo, Gitea, GitLab
import { Callout } from "fumadocs-ui/components/callout";
<Callout type="warn">
-**자체 배포한 Multica에서만 사용할 수 있습니다.** 이 연동은 Multica를 **직접 배포해 운영할 때만** 제공되며 Multica Cloud에서는 사용할 수 없습니다. 여기서 "자체 호스팅"은 **Multica 자체를 배포하는 것**을 뜻합니다. 일반적으로 자체 네트워크의 Git 인스턴스에 접근하기 위해 사용합니다. 서버 운영자가 `MULTICA_VCS_INTEGRATION_ENABLED=true`로 기능을 켜고 `MULTICA_VCS_SECRET_KEY`도 설정해야 합니다. 그전에는 설정 → 연동에 이 영역이 표시되지 않습니다.
+**자체 배포한 Multica에서만 사용할 수 있습니다.** 이 연동은 Multica를 **직접 배포해 운영할 때만** 제공되며 Multica Cloud에서는 사용할 수 없습니다. 여기서 "자체 호스팅"은 **Multica 자체를 배포하는 것**을 뜻합니다. 일반적으로 자체 네트워크의 Git 인스턴스에 접근하기 위해 사용합니다. 서버 운영자가 `MULTICA_VCS_INTEGRATION_ENABLED=true`로 기능을 켜고 `MULTICA_VCS_SECRET_KEY`도 설정해야 합니다. 그전에는 설정 → 코드에 이 행이 표시되지 않습니다.
</Callout>
Multica는 워크스페이스별로 자체 호스팅 Git 코드 호스팅인 **Forgejo**, **Gitea**, **GitLab** 중 하나에 연결합니다. 연결하면 브랜치 이름이나 제목에 태스크 번호(예: `MUL-123`)가 포함되거나 본문의 종료 키워드 뒤에 태스크 번호(`Closes MUL-123`)가 있는 Pull Request(GitLab에서는 Merge Request)가 해당 [태스크](/issues)에 **자동으로 연결**되고 태스크 사이드바의 **Pull requests**에 표시됩니다. 태스크에 연결된 PR이 모두 merge되면 태스크가 워크스페이스가 정한 상태(기본값 완료)로 이동합니다. head commit의 CI는 카드에 check bar로 표시됩니다.
@@ -46,7 +46,7 @@ MULTICA_VCS_SECRET_KEY=<base64 32바이트 키>
1. Git 코드 호스팅에서 저장소 읽기 권한이 있는 액세스 token을 만듭니다.
- **Forgejo / Gitea**: 설정 → 애플리케이션.
- **GitLab**: `read_api` 권한이 있는 개인(또는 그룹/프로젝트) 액세스 token.
-2. Multica에서 **설정 → 연동 → Git 코드 호스팅**을 엽니다.
+2. Multica에서 **설정 → 코드**를 열고 **셀프 호스팅 Git** 행에서 **연결**을 클릭합니다.
3. **제공자**를 선택하고 인스턴스 URL(예: `https://forgejo.example.com`)과 액세스 token을 입력한 뒤 **연결**을 클릭합니다. Multica는 저장하기 전에 해당 token으로 인스턴스에 접근해 검증합니다.
4. 연결 후 표시되는 **Webhook URL**과 **Webhook secret**을 복사합니다.
diff --git a/apps/docs/content/docs/vcs-integration.mdx b/apps/docs/content/docs/vcs-integration.mdx
index f643f2a635..b17abb09b8 100644
--- a/apps/docs/content/docs/vcs-integration.mdx
+++ b/apps/docs/content/docs/vcs-integration.mdx
@@ -11,7 +11,7 @@ Multica yourself; it is not offered on Multica Cloud. "Self-hosted" here means
**Multica** is self-hosted — typically so it can reach a Git instance on your own
network. A server operator must enable it (`MULTICA_VCS_INTEGRATION_ENABLED=true`)
and set `MULTICA_VCS_SECRET_KEY`; until then the section does not appear in
-Settings → Integrations.
+Settings → Code.
</Callout>
Multica connects to a self-hosted Git provider per workspace: **Forgejo**, **Gitea**, or **GitLab**. Once connected, any pull request (GitLab: merge request) whose branch name or title contains an issue identifier (for example `MUL-123`), or whose body names one after a closing keyword (`Closes MUL-123`), is **auto-linked** to that [issue](/issues) and appears under **Pull requests** in the issue sidebar. When every PR linked to the issue is merged, the issue moves to the status the workspace chose (**Done** by default). CI for the head commit shows as a checks bar on the card.
@@ -51,7 +51,7 @@ Set `MULTICA_PUBLIC_URL` to the server's public base URL so Multica can show a r
1. Create an access token in your provider with read access to the repositories you want mirrored:
- **Forgejo / Gitea**: Settings → Applications.
- **GitLab**: a personal (or group/project) access token with the `read_api` scope.
-2. In Multica, open **Settings → Integrations → Git providers**.
+2. In Multica, open **Settings → Code**, then click **Connect** in the **Self-hosted Git** row.
3. Choose the **provider**, enter the instance URL (for example `https://forgejo.example.com`) and the access token, then **Connect**. Multica validates the token against the instance before saving.
4. Copy the **webhook URL** and **webhook secret** shown after connecting.
diff --git a/apps/docs/content/docs/vcs-integration.zh.mdx b/apps/docs/content/docs/vcs-integration.zh.mdx
index 36096c7841..4990e07945 100644
--- a/apps/docs/content/docs/vcs-integration.zh.mdx
+++ b/apps/docs/content/docs/vcs-integration.zh.mdx
@@ -6,7 +6,7 @@ description: 为每个工作区连接自托管的 Forgejo、Gitea 或 GitLab 实
import { Callout } from "fumadocs-ui/components/callout";
<Callout type="warn">
-**仅适用于自部署的 Multica。** 此集成只在你**自己部署 Multica** 时可用,Multica 云端不提供。这里的「自托管」指的是 **Multica 本身自部署**——通常是为了让它能访问你自己网络内的 Git 实例。需要服务端运维开启(`MULTICA_VCS_INTEGRATION_ENABLED=true`)并设置 `MULTICA_VCS_SECRET_KEY`;在此之前,设置 → 集成里不会出现该板块。
+**仅适用于自部署的 Multica。** 此集成只在你**自己部署 Multica** 时可用,Multica 云端不提供。这里的「自托管」指的是 **Multica 本身自部署**——通常是为了让它能访问你自己网络内的 Git 实例。需要服务端运维开启(`MULTICA_VCS_INTEGRATION_ENABLED=true`)并设置 `MULTICA_VCS_SECRET_KEY`;在此之前,设置 → 代码里不会出现该行。
</Callout>
Multica 按工作区连接自托管的 Git 代码托管:**Forgejo**、**Gitea** 或 **GitLab**。连接后,任何在分支名或标题中包含任务编号(例如 `MUL-123`)、或在正文的关闭关键字后写出该编号(`Closes MUL-123`)的 Pull Request(GitLab 为 Merge Request)都会**自动关联**到对应的 [任务](/issues),出现在任务侧栏的 **Pull requests** 中;任务的所有关联 PR 都合并后,任务会改为工作区选定的状态(默认「完成」)。head commit 的 CI 会以检查条的形式显示在卡片上。
@@ -46,7 +46,7 @@ MULTICA_VCS_SECRET_KEY=<base64 32 字节密钥>
1. 在代码托管中创建具备仓库读取权限的访问令牌:
- **Forgejo / Gitea**:设置 → 应用。
- **GitLab**:具备 `read_api` 权限的个人(或群组/项目)访问令牌。
-2. 在 Multica 中打开 **设置 → 集成 → Git 代码托管**。
+2. 在 Multica 中打开 **设置 → 代码**,在 **自托管 Git** 一行点击 **连接**。
3. 选择**提供方**,填写实例地址(例如 `https://forgejo.example.com`)和访问令牌,点击 **连接**。Multica 会先用该令牌访问实例进行校验,再保存。
4. 复制连接后显示的 **Webhook 地址** 与 **Webhook 密钥**。
diff --git a/packages/core/api/client.test.ts b/packages/core/api/client.test.ts
index 390f6074dc..08e5864d41 100644
--- a/packages/core/api/client.test.ts
+++ b/packages/core/api/client.test.ts
@@ -2579,6 +2579,19 @@ describe("ApiClient workspace MCP servers", () => {
expect(result[0]?.transport).toBe("websocket");
});
+ it("keeps the agent count and degrades a malformed one to unknown", async () => {
+ stubJSON([
+ { ...server, id: "srv-1", agent_count: 3 },
+ { ...server, id: "srv-2", agent_count: "many" },
+ { ...server, id: "srv-3" },
+ ]);
+
+ const result = await new ApiClient("https://api.example.test")
+ .listWorkspaceMcpServers("ws-1");
+
+ expect(result.map((item) => item.agent_count)).toEqual([3, undefined, undefined]);
+ });
+
it("POSTs a name and entry when creating a library server", async () => {
const fetchMock = stubJSON(server);
diff --git a/packages/core/api/schemas.ts b/packages/core/api/schemas.ts
index cd62bd9c5b..2801bc3952 100644
--- a/packages/core/api/schemas.ts
+++ b/packages/core/api/schemas.ts
@@ -3449,6 +3449,9 @@ export const WorkspaceMcpServerSchema = z.object({
name: z.string().default(""),
transport: z.string().default("unknown"),
enabled: z.boolean().optional(),
+ // Older servers omit it; a malformed value drops to "unknown" rather than
+ // failing the whole list.
+ agent_count: z.number().int().nonnegative().optional().catch(undefined),
created_at: z.string().default(""),
updated_at: z.string().default(""),
});
diff --git a/packages/core/types/workspace.ts b/packages/core/types/workspace.ts
index be0b1bcdcc..b9788ace68 100644
--- a/packages/core/types/workspace.ts
+++ b/packages/core/types/workspace.ts
@@ -36,6 +36,11 @@ export interface WorkspaceMcpServer {
name: string;
transport: string;
enabled?: boolean;
+ /**
+ * Live agents the entry is assigned to. Only the workspace library listing
+ * carries it, and servers older than this field omit it.
+ */
+ agent_count?: number;
created_at: string;
updated_at: string;
}
diff --git a/packages/views/agents/components/tabs/agent-mcp-tab.test.tsx b/packages/views/agents/components/tabs/agent-mcp-tab.test.tsx
index 409ea1b60b..87933313d3 100644
--- a/packages/views/agents/components/tabs/agent-mcp-tab.test.tsx
+++ b/packages/views/agents/components/tabs/agent-mcp-tab.test.tsx
@@ -185,7 +185,7 @@ describe("AgentMcpTab", () => {
expect(screen.getByText(/No connected apps yet/i)).toBeTruthy();
const link = screen.getByTestId("app-link");
- expect(link.getAttribute("href")).toBe("/ws/settings?tab=integrations");
+ expect(link.getAttribute("href")).toBe("/ws/settings?tab=apps");
});
it("renders a defensive hidden state when the allowlist is redacted", () => {
diff --git a/packages/views/agents/components/tabs/agent-mcp-tab.tsx b/packages/views/agents/components/tabs/agent-mcp-tab.tsx
index d2808a6ee1..ef42461f31 100644
--- a/packages/views/agents/components/tabs/agent-mcp-tab.tsx
+++ b/packages/views/agents/components/tabs/agent-mcp-tab.tsx
@@ -80,7 +80,7 @@ export function AgentMcpTab({ agent }: { agent: Agent }) {
[agent.composio_toolkit_allowlist],
);
- const settingsHref = `${paths.settings()}?tab=integrations`;
+ const settingsHref = `${paths.settings()}?tab=apps`;
// Composio access warning (MUL-3963). Once an agent is shared, anyone who
// can invoke it can drive the Composio apps enabled here on the owner's
diff --git a/packages/views/common/mcp-server-row.tsx b/packages/views/common/mcp-server-row.tsx
index 1d46a0cf61..8c783876ae 100644
--- a/packages/views/common/mcp-server-row.tsx
+++ b/packages/views/common/mcp-server-row.tsx
@@ -120,6 +120,7 @@ export function McpServerRow({
name,
transport,
status,
+ meta,
canManage,
actionsDisabled = false,
rename,
@@ -131,6 +132,8 @@ export function McpServerRow({
name: string;
transport: string;
status?: ReactNode;
+ /** Extra context after the transport, e.g. how many agents use it. */
+ meta?: ReactNode;
canManage: boolean;
actionsDisabled?: boolean;
rename?: McpServerRenameState;
@@ -215,6 +218,7 @@ export function McpServerRow({
</div>
<p className="text-caption text-muted-foreground">
{mcpTransportLabel(transport)}
+ {meta ? <> · {meta}</> : null}
</p>
</div>
diff --git a/packages/views/issues/components/comment-composers.test.tsx b/packages/views/issues/components/comment-composers.test.tsx
index 5bc2edb251..796eb8bf27 100644
--- a/packages/views/issues/components/comment-composers.test.tsx
+++ b/packages/views/issues/components/comment-composers.test.tsx
@@ -386,6 +386,20 @@ describe("quick action `/` menu", () => {
}
});
+/**
+ * Pick a recipient's action from its chip menu. Under CI load the composer can
+ * still re-render the chips (the previous send settling, the preview catching
+ * up) right after the menu opens, closing it; reopen until the item shows.
+ */
+async function chooseRecipientAction(chip: string, action: RegExp) {
+ await waitFor(() => {
+ const trigger = screen.getByRole("button", { name: chip });
+ if (trigger.getAttribute("aria-expanded") !== "true") fireEvent.click(trigger);
+ expect(screen.getByRole("menuitemradio", { name: action })).toBeInTheDocument();
+ }, { timeout: 5000 });
+ fireEvent.click(screen.getByRole("menuitemradio", { name: action }));
+}
+
describe("comment composers", () => {
it("renders the main comment composer without a manual expand control", () => {
const { container } = renderCommentInput();
@@ -454,17 +468,16 @@ describe("comment composers", () => {
await screen.findByText("Add to current run", {}, { timeout: 5000 });
fireEvent.click(getSubmitButton(container));
await waitFor(() => expect(onSubmit).toHaveBeenCalledWith("only fix web", undefined, undefined,
- ["turn-1"]));
+ ["turn-1"]), { timeout: 5000 });
expect(apiCancelTask).not.toHaveBeenCalled();
fireEvent.change(screen.getByTestId("editor"), { target: { value: "start over on web" } });
- fireEvent.click(await screen.findByRole("button", { name: "Lambda trigger: Add to current run" }, { timeout: 5000 }));
- fireEvent.click(await screen.findByRole("menuitemradio", { name: /Stop and start over/ }));
- fireEvent.click(await screen.findByRole("button", { name: "Stop and send" }));
- await waitFor(() => expect(onSubmit).toHaveBeenCalledWith("start over on web", undefined, undefined, undefined));
+ await chooseRecipientAction("Lambda trigger: Add to current run", /Stop and start over/);
+ fireEvent.click(await screen.findByRole("button", { name: "Stop and send" }, { timeout: 5000 }));
+ await waitFor(() => expect(onSubmit).toHaveBeenCalledWith("start over on web", undefined, undefined, undefined), { timeout: 5000 });
expect(apiCancelTask).toHaveBeenCalledWith("issue-1", "turn-1");
expect(apiCancelTask.mock.invocationCallOrder[0]!).toBeLessThan(onSubmit.mock.invocationCallOrder[1]!);
- });
+ }, 15_000);
it("starts after the run by default when the personal preference says so", async () => {
useCommentComposerStore.setState({ runningAgentReply: "after_run" });
@@ -486,17 +499,16 @@ describe("comment composers", () => {
fireEvent.change(screen.getByTestId("editor"), { target: { value: "only fix web" } });
await screen.findByRole("button", { name: "Lambda trigger: Start after this run" }, { timeout: 5000 });
fireEvent.click(getSubmitButton(container));
- await waitFor(() => expect(onSubmit).toHaveBeenCalledWith("only fix web", undefined, undefined, undefined));
+ await waitFor(() => expect(onSubmit).toHaveBeenCalledWith("only fix web", undefined, undefined, undefined), { timeout: 5000 });
// One message can still go into the running turn.
fireEvent.change(screen.getByTestId("editor"), { target: { value: "and keep desktop as is" } });
- fireEvent.click(await screen.findByRole("button", { name: "Lambda trigger: Start after this run" }, { timeout: 5000 }));
- fireEvent.click(await screen.findByRole("menuitemradio", { name: /Add to current run/ }));
- await screen.findByRole("button", { name: "Lambda trigger: Add to current run" });
+ await chooseRecipientAction("Lambda trigger: Start after this run", /Add to current run/);
+ await screen.findByRole("button", { name: "Lambda trigger: Add to current run" }, { timeout: 5000 });
fireEvent.click(getSubmitButton(container));
await waitFor(() => expect(onSubmit).toHaveBeenLastCalledWith("and keep desktop as is", undefined, undefined,
- ["turn-1"]));
- });
+ ["turn-1"]), { timeout: 5000 });
+ }, 15_000);
it("steers every running recipient the message addresses", async () => {
const turn = (id: string, agentId: string) => ({
@@ -518,12 +530,12 @@ describe("comment composers", () => {
activateComposer("reply-composer-shell");
fireEvent.change(screen.getByTestId("editor"), { target: { value: "only fix web" } });
fireEvent.click(await screen.findByText("2 agents will receive this", {}, { timeout: 5000 }));
- expect(await screen.findByRole("button", { name: "Lambda trigger: Add to current run" })).toBeInTheDocument();
+ expect(await screen.findByRole("button", { name: "Lambda trigger: Add to current run" }, { timeout: 5000 })).toBeInTheDocument();
expect(screen.getByRole("button", { name: "Orion trigger: Add to current run" })).toBeInTheDocument();
fireEvent.click(getSubmitButton(container));
await waitFor(() => expect(onSubmit).toHaveBeenCalledWith("only fix web", undefined, undefined,
- ["turn-1", "turn-2"]));
- });
+ ["turn-1", "turn-2"]), { timeout: 5000 });
+ }, 15_000);
it("never stops the previous recipient after the mentions change under a stale preview", async () => {
const turn = {
@@ -540,8 +552,7 @@ describe("comment composers", () => {
onSubmit={onSubmit} steerByDefault={(task) => task.id === "turn-1"} />);
activateComposer("reply-composer-shell");
fireEvent.change(screen.getByTestId("editor"), { target: { value: "start over" } });
- fireEvent.click(await screen.findByRole("button", { name: "Lambda trigger: Add to current run" }, { timeout: 5000 }));
- fireEvent.click(await screen.findByRole("menuitemradio", { name: /Stop and start over/ }));
+ await chooseRecipientAction("Lambda trigger: Add to current run", /Stop and start over/);
// A slow preview still holds Lambda's restart, though the comment now
// explicitly addresses only a different agent.
apiPreviewCommentTriggers.mockImplementation(() => new Promise(() => {}));
@@ -549,9 +560,9 @@ describe("comment composers", () => {
target: { value: "[@Orion](mention://agent/11111111-1111-4111-8111-111111111111) review desktop" },
});
fireEvent.click(screen.getByRole("button", { name: "Stop and send" }));
- await waitFor(() => expect(onSubmit).toHaveBeenCalled());
+ await waitFor(() => expect(onSubmit).toHaveBeenCalled(), { timeout: 5000 });
expect(apiCancelTask).not.toHaveBeenCalled();
- });
+ }, 15_000);
it("keeps reply submission wired after removing expand", async () => {
const { container, onSubmit } = renderReplyInput();
diff --git a/packages/views/issues/components/pull-requests-section.test.tsx b/packages/views/issues/components/pull-requests-section.test.tsx
index 7047ff9514..fbdca12a22 100644
--- a/packages/views/issues/components/pull-requests-section.test.tsx
+++ b/packages/views/issues/components/pull-requests-section.test.tsx
@@ -127,7 +127,7 @@ describe("PullRequestsSection (MUL-7429)", () => {
renderSection();
fireEvent.click(await screen.findByRole("button", { name: "Pull request automation" }));
fireEvent.click(await screen.findByRole("menuitem", { name: "PR merge settings" }));
- expect(navigatePush).toHaveBeenCalledWith("/acme/settings?tab=integrations&integration=github");
+ expect(navigatePush).toHaveBeenCalledWith("/acme/settings?tab=code");
});
it("offers only the settings link while the workspace leaves status alone", async () => {
diff --git a/packages/views/issues/components/pull-requests-section.tsx b/packages/views/issues/components/pull-requests-section.tsx
index 16651ee3fc..6d7ae265d1 100644
--- a/packages/views/issues/components/pull-requests-section.tsx
+++ b/packages/views/issues/components/pull-requests-section.tsx
@@ -233,7 +233,7 @@ function AutoCompleteMenu({
<DropdownMenuSeparator />
</>
) : null}
- <DropdownMenuItem onClick={() => navigation.push(`${paths.settings()}?tab=integrations&integration=github`)}>
+ <DropdownMenuItem onClick={() => navigation.push(`${paths.settings()}?tab=code`)}>
<Settings />
{t(($) => $.pr_automation.settings)}
</DropdownMenuItem>
diff --git a/packages/views/labels/index.ts b/packages/views/labels/index.ts
index 71e40ecba0..86740c611b 100644
--- a/packages/views/labels/index.ts
+++ b/packages/views/labels/index.ts
@@ -1,2 +1,3 @@
export { LabelChip } from "./label-chip";
export { ResourceLabelPicker } from "./resource-label-picker";
+export { LabelManager, type LabelScope } from "./label-manager";
diff --git a/packages/views/labels/label-manager.tsx b/packages/views/labels/label-manager.tsx
new file mode 100644
index 0000000000..2986430f1a
--- /dev/null
+++ b/packages/views/labels/label-manager.tsx
@@ -0,0 +1,405 @@
+"use client";
+
+import { useEffect, useMemo, useState } from "react";
+import { useQuery } from "@tanstack/react-query";
+import { MoreHorizontal, Pencil, Plus, Search, Tag, Trash2 } from "lucide-react";
+import { toast } from "sonner";
+import { useWorkspaceId } from "@multica/core/hooks";
+import {
+ labelListOptions,
+ useCreateLabel,
+ useDeleteLabel,
+ useUpdateLabel,
+} from "@multica/core/labels";
+import type { Label, LabelResourceType } from "@multica/core/types";
+import { Button } from "@multica/ui/components/ui/button";
+import { Input } from "@multica/ui/components/ui/input";
+import { Textarea } from "@multica/ui/components/ui/textarea";
+import { Label as FieldLabel } from "@multica/ui/components/ui/label";
+import {
+ Dialog,
+ DialogContent,
+ DialogDescription,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle,
+} from "@multica/ui/components/ui/dialog";
+import {
+ AlertDialog,
+ AlertDialogAction,
+ AlertDialogCancel,
+ AlertDialogContent,
+ AlertDialogDescription,
+ AlertDialogFooter,
+ AlertDialogHeader,
+ AlertDialogTitle,
+} from "@multica/ui/components/ui/alert-dialog";
+import {
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuItem,
+ DropdownMenuTrigger,
+} from "@multica/ui/components/ui/dropdown-menu";
+import { ColorPicker, COLOR_PICKER_PRESETS } from "../common/color-picker";
+import { useLocale, useT } from "../i18n";
+
+/**
+ * Label catalogs a user can manage. Narrower than `LabelResourceType`:
+ * the backend still models agent labels, but the product no longer exposes
+ * any way to create, apply, or view them, so they are not manageable here.
+ */
+export type LabelScope = Extract<LabelResourceType, "issue" | "skill">;
+
+interface LabelDraft {
+ name: string;
+ description: string;
+ color: string;
+}
+
+const EMPTY_DRAFT: LabelDraft = {
+ name: "",
+ description: "",
+ color: COLOR_PICKER_PRESETS[6],
+};
+
+/**
+ * Search, create, edit and delete the labels of one catalog. Issue labels are
+ * managed in Settings; skill labels on the Skills page, next to the skills
+ * they tag — the two catalogs never mix.
+ */
+export function LabelManager({ scope }: { scope: LabelScope }) {
+ const { t } = useT("settings");
+ const locale = useLocale();
+ const wsId = useWorkspaceId();
+
+ const resourceType = scope;
+ const [query, setQuery] = useState("");
+ const [editing, setEditing] = useState<Label | null>(null);
+ const [createOpen, setCreateOpen] = useState(false);
+ const [pendingDelete, setPendingDelete] = useState<Label | null>(null);
+
+ const { data: labels = [], isLoading } = useQuery(
+ labelListOptions(wsId, resourceType),
+ );
+ const filteredLabels = useMemo(() => {
+ const normalized = query.trim().toLowerCase();
+ if (!normalized) return labels;
+ return labels.filter(
+ (label) =>
+ label.name.toLowerCase().includes(normalized) ||
+ (label.description ?? "").toLowerCase().includes(normalized),
+ );
+ }, [labels, query]);
+
+ const scopeLabel = t(($) => $.labels.scopes[resourceType]);
+
+ return (
+ <>
+ <div className="space-y-5">
+ <div className="flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between">
+ <div className="relative w-full sm:max-w-sm">
+ <Search className="pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-muted-foreground" />
+ <Input
+ value={query}
+ onChange={(event) => setQuery(event.target.value)}
+ placeholder={t(($) => $.labels.search_placeholder)}
+ className="pl-9"
+ />
+ </div>
+ <Button className="gap-2" onClick={() => setCreateOpen(true)}>
+ <Plus className="size-4" />
+ {t(($) => $.labels.new_label)}
+ </Button>
+ </div>
+
+ <div className="overflow-hidden rounded-lg border border-surface-border bg-card">
+ <div className="hidden grid-cols-[minmax(11rem,1fr)_minmax(12rem,1.4fr)_6rem_7rem_2rem] gap-4 border-b border-surface-border bg-muted/20 px-4 py-2.5 text-caption font-medium text-muted-foreground md:grid">
+ <span>{t(($) => $.labels.columns.name)}</span>
+ <span>{t(($) => $.labels.columns.description)}</span>
+ <span>{t(($) => $.labels.columns.usage)}</span>
+ <span>{t(($) => $.labels.columns.updated)}</span>
+ <span />
+ </div>
+
+ {isLoading ? (
+ <div className="px-4 py-12 text-center text-body text-muted-foreground">
+ {t(($) => $.labels.loading)}
+ </div>
+ ) : filteredLabels.length === 0 ? (
+ <div className="px-4 py-12 text-center">
+ <Tag className="mx-auto size-6 text-faint-foreground" />
+ <p className="mt-3 text-body font-medium">
+ {query
+ ? t(($) => $.labels.no_results)
+ : t(($) => $.labels.empty, { scope: scopeLabel })}
+ </p>
+ </div>
+ ) : (
+ <div className="divide-y divide-surface-border">
+ {filteredLabels.map((label) => (
+ <div
+ key={label.id}
+ className="grid gap-2 px-4 py-3 md:grid-cols-[minmax(11rem,1fr)_minmax(12rem,1.4fr)_6rem_7rem_2rem] md:items-center md:gap-4"
+ >
+ <div className="flex min-w-0 items-center gap-3">
+ <span
+ className="size-2.5 shrink-0 rounded-full"
+ style={{ backgroundColor: label.color }}
+ />
+ <span className="truncate text-body font-medium">{label.name}</span>
+ </div>
+ <p className="min-w-0 truncate text-caption text-muted-foreground md:text-body">
+ {label.description || "—"}
+ </p>
+ <span className="text-caption tabular-nums text-muted-foreground md:text-body">
+ {t(($) => $.labels.usage_count, { count: label.usage_count ?? 0 })}
+ </span>
+ <span className="text-caption text-muted-foreground">
+ {new Date(label.updated_at).toLocaleDateString(locale)}
+ </span>
+ <DropdownMenu>
+ <DropdownMenuTrigger
+ render={
+ <Button
+ variant="ghost"
+ size="icon-sm"
+ aria-label={t(($) => $.labels.actions.open, { name: label.name })}
+ >
+ <MoreHorizontal className="size-4" />
+ </Button>
+ }
+ />
+ <DropdownMenuContent align="end">
+ <DropdownMenuItem onClick={() => setEditing(label)}>
+ <Pencil className="size-4" />
+ {t(($) => $.labels.actions.edit)}
+ </DropdownMenuItem>
+ <DropdownMenuItem
+ variant="destructive"
+ onClick={() => setPendingDelete(label)}
+ >
+ <Trash2 className="size-4" />
+ {t(($) => $.labels.actions.delete)}
+ </DropdownMenuItem>
+ </DropdownMenuContent>
+ </DropdownMenu>
+ </div>
+ ))}
+ </div>
+ )}
+ </div>
+ </div>
+
+ <LabelEditorDialog
+ open={createOpen}
+ onOpenChange={setCreateOpen}
+ resourceType={resourceType}
+ />
+ <LabelEditorDialog
+ open={Boolean(editing)}
+ onOpenChange={(open) => !open && setEditing(null)}
+ resourceType={resourceType}
+ label={editing}
+ />
+ <DeleteLabelDialog
+ label={pendingDelete}
+ onClose={() => setPendingDelete(null)}
+ />
+ </>
+ );
+}
+
+function LabelEditorDialog({
+ open,
+ onOpenChange,
+ resourceType,
+ label,
+}: {
+ open: boolean;
+ onOpenChange: (open: boolean) => void;
+ resourceType: LabelScope;
+ label?: Label | null;
+}) {
+ const { t } = useT("settings");
+ const create = useCreateLabel();
+ const update = useUpdateLabel();
+ const [draft, setDraft] = useState<LabelDraft>(EMPTY_DRAFT);
+
+ useEffect(() => {
+ if (!open) return;
+ setDraft(
+ label
+ ? {
+ name: label.name,
+ description: label.description ?? "",
+ color: label.color,
+ }
+ : EMPTY_DRAFT,
+ );
+ }, [label, open]);
+
+ const submit = () => {
+ const name = draft.name.trim();
+ if (!name) return;
+ if (label) {
+ update.mutate(
+ {
+ id: label.id,
+ resource_type: label.resource_type ?? resourceType,
+ name,
+ description: draft.description.trim(),
+ color: draft.color,
+ },
+ {
+ onSuccess: () => onOpenChange(false),
+ onError: (error) =>
+ toast.error(error instanceof Error ? error.message : t(($) => $.labels.save_failed)),
+ },
+ );
+ return;
+ }
+ create.mutate(
+ {
+ resource_type: resourceType,
+ name,
+ description: draft.description.trim(),
+ color: draft.color,
+ },
+ {
+ onSuccess: () => onOpenChange(false),
+ onError: (error) =>
+ toast.error(error instanceof Error ? error.message : t(($) => $.labels.save_failed)),
+ },
+ );
+ };
+
+ return (
+ <Dialog
+ open={open}
+ onOpenChange={onOpenChange}
+ >
+ <DialogContent className="sm:max-w-lg">
+ <DialogHeader>
+ <DialogTitle>
+ {label ? t(($) => $.labels.editor.edit_title) : t(($) => $.labels.editor.create_title)}
+ </DialogTitle>
+ <DialogDescription>
+ {t(($) => $.labels.editor.scope_hint, {
+ scope: t(($) => $.labels.scopes[resourceType]),
+ })}
+ </DialogDescription>
+ </DialogHeader>
+ <div className="space-y-5 py-2">
+ <div className="space-y-2">
+ <FieldLabel htmlFor="label-name">{t(($) => $.labels.editor.name)}</FieldLabel>
+ <Input
+ id="label-name"
+ autoFocus
+ maxLength={32}
+ value={draft.name}
+ onChange={(event) => setDraft((current) => ({ ...current, name: event.target.value }))}
+ placeholder={t(($) => $.labels.editor.name_placeholder)}
+ />
+ </div>
+ <div className="space-y-2">
+ <FieldLabel htmlFor="label-description">
+ {t(($) => $.labels.editor.description)}
+ </FieldLabel>
+ <Textarea
+ id="label-description"
+ rows={3}
+ value={draft.description}
+ onChange={(event) =>
+ setDraft((current) => ({ ...current, description: event.target.value }))
+ }
+ placeholder={t(($) => $.labels.editor.description_placeholder)}
+ />
+ </div>
+ <div className="space-y-2">
+ <FieldLabel>{t(($) => $.labels.editor.color)}</FieldLabel>
+ <ColorPicker
+ value={draft.color}
+ onChange={(color) => setDraft((current) => ({ ...current, color }))}
+ trigger={
+ <button
+ type="button"
+ aria-label={t(($) => $.labels.editor.color)}
+ className="flex h-9 items-center gap-2.5 rounded-md border border-surface-border px-2.5 transition-colors hover:bg-surface-hover"
+ >
+ <span
+ className="size-5 rounded-full"
+ style={{ backgroundColor: draft.color }}
+ />
+ <span className="font-mono text-caption uppercase text-muted-foreground">
+ {draft.color}
+ </span>
+ </button>
+ }
+ />
+ </div>
+ </div>
+ <DialogFooter>
+ <Button variant="ghost" onClick={() => onOpenChange(false)}>
+ {t(($) => $.labels.editor.cancel)}
+ </Button>
+ <Button
+ onClick={submit}
+ disabled={!draft.name.trim() || create.isPending || update.isPending}
+ >
+ {create.isPending || update.isPending
+ ? t(($) => $.labels.editor.saving)
+ : t(($) => $.labels.editor.save)}
+ </Button>
+ </DialogFooter>
+ </DialogContent>
+ </Dialog>
+ );
+}
+
+function DeleteLabelDialog({
+ label,
+ onClose,
+}: {
+ label: Label | null;
+ onClose: () => void;
+}) {
+ const { t } = useT("settings");
+ const remove = useDeleteLabel();
+ return (
+ <AlertDialog open={Boolean(label)} onOpenChange={(open) => !open && onClose()}>
+ <AlertDialogContent>
+ <AlertDialogHeader>
+ <AlertDialogTitle>{t(($) => $.labels.delete_dialog.title)}</AlertDialogTitle>
+ <AlertDialogDescription>
+ {t(($) => $.labels.delete_dialog.description, {
+ name: label?.name ?? "",
+ count: label?.usage_count ?? 0,
+ })}
+ </AlertDialogDescription>
+ </AlertDialogHeader>
+ <AlertDialogFooter>
+ <AlertDialogCancel>{t(($) => $.labels.delete_dialog.cancel)}</AlertDialogCancel>
+ <AlertDialogAction
+ onClick={() => {
+ if (!label) return;
+ remove.mutate(
+ { id: label.id, resource_type: label.resource_type ?? "issue" },
+ {
+ onSuccess: onClose,
+ onError: (error) =>
+ toast.error(
+ error instanceof Error
+ ? error.message
+ : t(($) => $.labels.delete_dialog.failed),
+ ),
+ },
+ );
+ }}
+ >
+ {t(($) => $.labels.delete_dialog.confirm)}
+ </AlertDialogAction>
+ </AlertDialogFooter>
+ </AlertDialogContent>
+ </AlertDialog>
+ );
+}
diff --git a/packages/views/locales/en/settings.json b/packages/views/locales/en/settings.json
index d2b1983cd1..cb14e47c16 100644
--- a/packages/views/locales/en/settings.json
+++ b/packages/views/locales/en/settings.json
@@ -16,11 +16,7 @@
"reorder": "Reorder {{name}}"
},
"reorder_hint": "Drag within a category to reorder boards, lists, and menus.",
- "built_in_dialog": {
- "title": "Built-in status cannot be changed",
- "description": "Built-in statuses are used by Multica and cannot be edited or archived. You can still change their order within the category.",
- "confirm": "Got it"
- },
+ "built_in_dialog": {},
"editor": {
"create_title": "New status",
"edit_title": "Edit status",
@@ -82,7 +78,8 @@
"done": "Completed.",
"cancelled": "Decided not to do."
},
- "pr_auto_complete_badge": "Set when PRs merge"
+ "pr_auto_complete_badge": "Set when PRs merge",
+ "built_in_locked": "Built-in statuses drive system behavior, so they can't be edited or archived. You can still reorder them."
},
"quick_actions": {
"title": "Quick Actions",
@@ -138,7 +135,6 @@
"toast_saved": "Changes saved"
},
"preferences": {
- "general_title": "General",
"theme": {
"title": "Theme",
"light": "Light",
@@ -155,10 +151,12 @@
"sync_failed": "Language saved on this device, but failed to sync to your account. Other devices may show the previous language."
},
"timezone": {
- "title": "Viewing Timezone",
+ "title": "Time zone",
"browser_suffix": " (browser)",
"hint": "Used for dates and charts across all your workspaces.",
- "sync_failed": "Failed to save your timezone preference."
+ "sync_failed": "Failed to save your timezone preference.",
+ "search": "Search time zones...",
+ "empty": "No matching time zone"
},
"sticky_comment_bar": {
"title": "Pin comment bar to bottom"
@@ -169,10 +167,16 @@
"after_run": "Start after this run",
"hint": "Sets the default only. You can still change it for any message before sending."
},
- "issue_title": "Issue creation",
- "comments_title": "Comments",
- "device_hint": "Saved on this device.",
- "issue_scope": "These preferences apply to this workspace on this device. They only change which fields you see when creating an issue."
+ "comments_title": "Comments & chat",
+ "region_title": "Language & region",
+ "appearance_title": "Appearance",
+ "issue_fields_title": "Fields shown when creating issues",
+ "issue_fields": {
+ "field": "Field",
+ "quick": "Create with agent",
+ "manual": "Manual create",
+ "unsupported": "Not available when creating with an agent"
+ }
},
"shortcuts": {
"title": "Keyboard Shortcuts",
@@ -307,14 +311,11 @@
}
},
"chat": {
- "floating_title": "Floating window",
"floating_label": "Floating chat window",
"floating_hint": "Show the floating chat button on every page."
},
"issue": {
"description": "Choose which fields each create dialog keeps on its toolbar. Hidden fields stay available from the ⋯ menu and reappear while they hold a value.",
- "quick_create_title": "Create with agent toolbar fields",
- "manual_create_title": "Manual create toolbar fields",
"fields": {
"status": "Status",
"priority": "Priority",
@@ -326,7 +327,6 @@
}
},
"mcp": {
- "title": "MCP",
"description": "After adding a server, assign it from an agent's MCP tab.",
"servers_title": "Shared servers",
"write_only_note": "For security, saved URLs, commands, headers, and environment values aren't shown again. To change them, enter a complete new configuration. Renaming keeps the current configuration and agent assignments.",
@@ -343,7 +343,6 @@
"remove_action": "Delete",
"empty_title": "No shared MCP servers",
"disabled_badge": "Disabled",
- "admin_only_note": "Only workspace owners and admins can change the shared MCP servers.",
"delete_title": "Remove shared server?",
"delete_description": "{{name}} will be removed from the library and from every agent it is assigned to, taking effect on their next run.",
"delete_confirm": "Remove",
@@ -365,13 +364,10 @@
"preferences": "Preferences",
"shortcuts": "Shortcuts",
"issue": "Issue",
- "chat": "Chat",
"notifications": "Notifications",
"tokens": "API Tokens",
"general": "General",
- "repositories": "Repositories",
"github": "GitHub",
- "integrations": "Integrations",
"labs": "Labs",
"members": "Members",
"labels": "Labels",
@@ -379,26 +375,32 @@
"properties": "Properties",
"quick_actions": "Quick Actions",
"plugins": "Plugins",
- "mcp": "MCP",
- "billing": "Billing"
+ "mcp": "MCP servers",
+ "billing": "Billing",
+ "code": "Code",
+ "channels": "Messaging",
+ "apps": "Connected apps"
},
"groups": {
"personal": "Personal",
"workspace": "Workspace",
- "issues": "Issue configuration",
+ "issues": "Issues & workflow",
"connections": "Connections & extensions",
- "device": "Desktop app"
+ "device": "This device"
},
"navigate": "Go to settings page",
- "device_scope": "This device"
+ "search": "Search settings",
+ "search_clear": "Clear search",
+ "search_empty": "No matching settings",
+ "search_results_one": "{{count}} result",
+ "search_results_other": "{{count}} results",
+ "admin_only": "Only owners and admins can change this"
},
"plugins": {
"title": "Plugins",
"loading": "Loading Plugins",
"load_failed": "Plugins couldn't be loaded",
"load_failed_description": "Try again. Installed Plugins are unaffected.",
- "read_only": "Read-only access",
- "read_only_description": "Workspace owners and admins can install, configure, and remove Plugins.",
"empty": "No Plugins are installed yet.",
"action_failed": "Plugin action failed",
"enabled": "Plugin enabled",
@@ -610,9 +612,7 @@
"profile_description_too_long": "Profile is too long (max {{max}} characters; currently {{count}}).",
"save": "Update Profile",
"saving": "Updating...",
- "toast_avatar_updated": "Avatar updated",
"toast_avatar_failed": "Failed to upload avatar",
- "toast_profile_updated": "Profile updated",
"toast_profile_failed": "Failed to update profile"
},
"notifications": {
@@ -709,22 +709,17 @@
"logo_label": "Workspace logo",
"change_logo_aria": "Change workspace logo",
"click_logo_hint": "Click the logo to upload a new image",
- "toast_logo_updated": "Workspace logo updated",
"toast_logo_failed": "Failed to upload workspace logo",
"name_label": "Name",
"description_label": "Description",
"description_placeholder": "What does this workspace focus on?",
- "context_label": "Context",
+ "context_label": "Agent context",
"context_placeholder": "Background information and context for AI agents working in this workspace",
"slug_label": "Slug",
"issue_prefix_label": "Issue prefix",
"issue_prefix_hint": "Used in issue numbers like {{example}}.",
- "prefix_confirm_title": "Change issue prefix?",
- "prefix_confirm_description": "All issues will be renumbered from {{oldPrefix}}-N to {{newPrefix}}-N. External references — pull request titles, branch names, links in docs and chat — that use {{oldPrefix}}-N will stop resolving.",
"save": "Save",
"saving": "Saving...",
- "manage_hint": "Only admins and owners can update workspace settings.",
- "toast_saved": "Workspace settings saved",
"toast_save_failed": "Failed to save workspace settings",
"danger_zone": "Danger Zone",
"leave_title": "Leave workspace",
@@ -742,7 +737,18 @@
"deleting": "Deleting...",
"toast_delete_failed": "Failed to delete workspace",
"confirm_cancel": "Cancel",
- "confirm_action": "Confirm"
+ "confirm_action": "Confirm",
+ "context_hint": "Given to every agent in this workspace on every run.",
+ "slug_hint": "Part of every workspace URL. It can't be changed.",
+ "copy_slug": "Copy slug",
+ "copy_failed": "Couldn't copy to clipboard",
+ "change_prefix": "Change prefix...",
+ "prefix_dialog_title": "Change issue prefix",
+ "prefix_dialog_description": "Every issue is renumbered, including done and cancelled ones.",
+ "prefix_new_label": "New prefix",
+ "prefix_rule": "Letters and numbers only, up to 10 characters.",
+ "prefix_confirm_action": "Change to {{prefix}}",
+ "prefix_external_warning": "Old keys such as {{oldExample}} in PR titles, branch names, docs, and chat are not updated, so those links stop working."
},
"delete_workspace_dialog": {
"title": "Delete workspace",
@@ -759,15 +765,10 @@
"toast_failed": "Failed to update setting"
},
"github": {
- "section_master": "Enable GitHub features",
- "master_description_on": "Turning this off pauses GitHub features and keeps existing data.",
"master_description_off": "GitHub features are paused. Existing data is kept.",
- "section_connection": "Connection",
- "connection_title": "GitHub App",
"connected_to": "Connected to {{login}}",
"connect_github": "Connect GitHub",
"connect_opening": "Opening…",
- "connect_disabled_tooltip": "GitHub App is not configured on this server",
"disconnect": "Disconnect",
"disconnecting": "Disconnecting…",
"disconnect_confirm_title": "Disconnect GitHub App",
@@ -776,28 +777,26 @@
"disconnect_confirm_action": "Disconnect",
"not_configured": "GitHub integration is not configured for this deployment. Operators must set",
"not_configured_and": "and",
- "read_only_hint": "Read-only view. Only workspace admins and owners can connect or disconnect GitHub.",
"contact_admin_to_connect": "GitHub is not connected for this workspace. Ask an admin or owner to set up the GitHub App.",
"connected_by": "Connected by {{name}}",
"toast_not_configured": "GitHub integration is not configured for this deployment",
"toast_open_failed": "Failed to open GitHub install",
"toast_disconnect_failed": "Failed to disconnect GitHub App",
"toast_disconnected": "GitHub App disconnected",
- "section_features": "Features",
"feature_pr_sidebar_label": "Pull Request sidebar",
"feature_pr_sidebar_description": "Show linked pull requests inside the issue detail sidebar.",
"feature_co_author_label": "Co-authored-by trailer",
"feature_co_author_description_prefix": "Append",
"feature_co_author_description_suffix": "to commits authored by agents.",
"feature_auto_link_label": "Auto-link issues and PRs",
- "section_repositories": "Repositories",
- "repositories_shortcut_label": "Repository URLs live in the Repositories tab",
- "repositories_shortcut_link": "Manage repositories →",
"toast_failed": "Failed to update GitHub settings",
- "feature_auto_link_description": "Links a PR to the issue whose ID, e.g. {{example}}, is in its title or branch name, or follows “Closes” in its description."
+ "feature_auto_link_description": "Links a PR to the issue whose ID, e.g. {{example}}, is in its title or branch name, or follows “Closes” in its description.",
+ "status_paused": "Paused",
+ "pause": "Pause GitHub features",
+ "resume": "Resume GitHub features"
},
"vcs": {
- "section_title": "Git providers (self-hosted)",
+ "section_title": "Self-hosted Git",
"page_description": "Connect a self-hosted Forgejo, Gitea, or GitLab instance to mirror pull requests onto issues. Each connection uses an access token; agents push branches and open PRs using the runtime's own Git credentials.",
"connect_title": "Connect a provider instance",
"connected_as": "Connected as {{login}}",
@@ -824,7 +823,6 @@
"disconnect_confirm_description": "Mirrored pull requests and their issue links for this connection will be removed. This cannot be undone.",
"disconnect_confirm_cancel": "Cancel",
"disconnect_confirm_action": "Disconnect",
- "toast_connected": "Provider connected",
"toast_connect_failed": "Could not connect to the provider",
"toast_disconnected": "Provider disconnected",
"toast_disconnect_failed": "Could not disconnect",
@@ -834,8 +832,11 @@
"rotate_confirm_cancel": "Cancel",
"rotate_confirm_action": "Regenerate",
"rotating": "Regenerating...",
- "toast_rotated": "Webhook secret regenerated",
- "toast_rotate_failed": "Could not regenerate webhook secret"
+ "toast_rotate_failed": "Could not regenerate webhook secret",
+ "hosts_hint": "GitLab, Gitea, or Forgejo.",
+ "connect_another": "Connect another",
+ "connection_actions": "Actions for {{url}}",
+ "webhook_done": "I've saved it"
},
"lark": {
"section_title": "Lark",
@@ -913,7 +914,6 @@
"install_error_generic": "Install failed. Try again."
},
"composio": {
- "section_title": "Composio",
"page_description": "Connect apps your agents can use.",
"not_enabled_title": "Composio integration not enabled",
"not_enabled_description_prefix": "Set",
@@ -1144,7 +1144,6 @@
"section_title": "Repositories",
"description": "Agents can use these repositories to work on code.",
"url_placeholder": "https://git.example.com/org/repo.git or [email protected]:org/repo.git",
- "url_empty": "(empty URL)",
"description_placeholder": "Description (e.g. Go backend + Next.js frontend)",
"add": "Add repository",
"connect_github": "Connect GitHub",
@@ -1167,21 +1166,26 @@
"github_selected_count": "{{count}} selected",
"github_cancel": "Cancel",
"github_import": "Add repositories",
- "complete_manual_entry_first": "Complete or remove the empty manual repository before importing.",
"save": "Save",
"saving": "Saving...",
"saved_hint": "All changes saved",
"empty": "No repositories yet.",
"edit_aria": "Edit repository",
"cancel_aria": "Cancel edit",
- "delete_aria": "Delete repository",
"delete_confirm_title": "Delete repository?",
"delete_confirm_description": "This repository will be removed from the workspace immediately.",
"delete_confirm_cancel": "Cancel",
"delete_confirm_action": "Delete repository",
"manage_hint": "Only admins and owners can manage repositories.",
- "toast_saved": "Repositories saved",
- "toast_save_failed": "Failed to save repositories"
+ "toast_save_failed": "Failed to save repositories",
+ "add_manually": "Enter a URL...",
+ "add_title": "Add repository",
+ "edit_title": "Edit repository",
+ "edit": "Edit",
+ "url_label": "Repository URL",
+ "description_label": "Description",
+ "duplicate": "This repository is already added.",
+ "actions_aria": "Actions for {{url}}"
},
"desktop": {
"tabs": {
@@ -1277,7 +1281,6 @@
}
},
"members": {
- "section_title": "Members ({{count}})",
"invite_title": "Invite member",
"invite_email_placeholder": "[email protected]",
"invite_button": "Invite",
@@ -1294,9 +1297,6 @@
"seat_purchase_timeout": "The seat purchase was submitted, but confirmation is taking longer than expected. No invitation was sent. Retry the invitation after Billing shows an available seat.",
"seat_purchase_capacity_taken": "The purchased seat is no longer available, so the invitation was not sent. Review current seats before trying again.",
"no_members": "No members found.",
- "pending_title": "Pending invitations ({{count}})",
- "pending_status": "Pending",
- "revoke_invitation_tooltip": "Revoke invitation",
"revoke_invitation_title": "Revoke invitation",
"revoke_invitation_description": "Revoke the invitation to {{email}}? They will no longer be able to join this workspace.",
"toast_invitation_revoked": "Invitation revoked",
@@ -1327,9 +1327,6 @@
"description": "Create and work on issues"
}
},
- "share_links_title": "Share links",
- "role_field": "Role:",
- "expiry_field": "Expiry:",
"share_links_create_title": "Create share link",
"share_links_create_button": "Generate",
"share_links_creating": "Generating...",
@@ -1346,26 +1343,70 @@
"expiry_24h": "24 hours",
"expiry_7d": "7 days",
"expiry_30d": "30 days",
- "expiry_never": "Never"
+ "expiry_never": "Never",
+ "members_label": "Members",
+ "pending_label": "Pending invitations",
+ "share_links_label": "Share links",
+ "share_links_description": "Anyone with the link can join with the chosen role until it expires or you revoke it.",
+ "search_placeholder": "Search name or email",
+ "no_results": "No members match this search.",
+ "no_invitations": "No pending invitations.",
+ "no_share_links": "No share links yet.",
+ "email_label": "Email",
+ "role_label": "Role",
+ "expiry_label": "Expires after",
+ "you": "You",
+ "joined": "Joined {{date}}",
+ "member_actions": "Actions for {{name}}",
+ "invitation_meta": "Sent {{sent}} · Expires {{expires}}",
+ "revoke_invitation_aria": "Revoke invitation for {{email}}",
+ "seats_used": "{{used}} of {{purchased}} seats used",
+ "manage_seats": "Manage seats"
},
"integrations": {
- "code_title": "Code & repositories",
- "messaging_title": "Messaging channels",
- "apps_title": "Your connected apps",
- "apps_scope": "These app connections belong to your account. Workspace channel connections are managed above.",
- "github_hint": "Connect GitHub and configure pull request linking.",
- "vcs_hint": "Connect GitLab, Gitea, or Forgejo.",
- "apps_hint": "Authorize apps for your agents through Composio.",
- "back": "All integrations",
"status_connected": "Connected",
"status_not_connected": "Not connected",
"status_loading": "Checking...",
- "status_unknown": "Status unavailable",
- "channel_hint": "Chat with agents and create issues from {{channel}}."
+ "status_unknown": "Status unavailable"
},
"pr_merge_status": {
"label": "After PRs merge, move the issue to",
"description": "Applies once every PR linked to an issue has merged, and only to merges from now on.",
"none": "Don’t change"
+ },
+ "layout": {
+ "scope": {
+ "account": "Account · synced",
+ "device": "This device only",
+ "device_workspace": "This device · {{name}}",
+ "workspace": "{{name}} workspace",
+ "workspace_only": "Only in {{name}}"
+ },
+ "read_only": {
+ "title": "View only",
+ "description": "Only workspace owners and admins can change these settings.",
+ "contact": "Only owners and admins can change these settings. Ask {{names}}.",
+ "separator": ", "
+ }
+ },
+ "code": {
+ "hosting_title": "Code hosting",
+ "pr_linking_title": "Pull requests & issues",
+ "github_actions": "GitHub actions"
+ },
+ "channels": {
+ "breadcrumb": "Breadcrumb"
+ },
+ "mcp_usage": {
+ "agent_count_one": "Used by {{count}} agent",
+ "agent_count_other": "Used by {{count}} agents",
+ "none": "Not assigned to any agent"
+ },
+ "mcp_sources": {
+ "title": "Ways to give agents tools",
+ "current": "This page",
+ "mcp": "Added by admins and shared across the workspace, then assigned per agent.",
+ "apps": "Authorized with your own account through Composio and enabled on agents you own.",
+ "plugins": "Installed packages that can add tools, scheduled hooks, and storage, each with its own permissions."
}
}
diff --git a/packages/views/locales/en/skills.json b/packages/views/locales/en/skills.json
index 3e0d90b7d7..bb8f7aecd3 100644
--- a/packages/views/locales/en/skills.json
+++ b/packages/views/locales/en/skills.json
@@ -120,7 +120,9 @@
"sort_by": "Sort by",
"direction_asc": "Ascending",
"direction_desc": "Descending",
- "section_columns": "Columns"
+ "section_columns": "Columns",
+ "manage_labels": "Manage labels...",
+ "manage_labels_title": "Skill labels"
},
"detail": {
"all_skills": "All skills",
diff --git a/packages/views/locales/fr/settings.json b/packages/views/locales/fr/settings.json
index b8dbe615b4..3acca4aea9 100644
--- a/packages/views/locales/fr/settings.json
+++ b/packages/views/locales/fr/settings.json
@@ -16,11 +16,7 @@
"reorder": "Réordonner {{name}}"
},
"reorder_hint": "Glissez les statuts au sein d’une catégorie pour réordonner les tableaux, listes et menus.",
- "built_in_dialog": {
- "title": "Ce statut intégré ne peut pas être modifié",
- "description": "Les statuts intégrés sont utilisés par Multica et ne peuvent être ni modifiés ni archivés. Vous pouvez toutefois changer leur ordre dans la catégorie.",
- "confirm": "Compris"
- },
+ "built_in_dialog": {},
"editor": {
"create_title": "Nouvel état",
"edit_title": "Modifier l'état",
@@ -82,7 +78,8 @@
"done": "Terminé.",
"cancelled": "Abandonné."
},
- "pr_auto_complete_badge": "Définie à la fusion des PR"
+ "pr_auto_complete_badge": "Définie à la fusion des PR",
+ "built_in_locked": "Les états intégrés pilotent le comportement du système : ils ne peuvent être ni modifiés ni archivés, mais vous pouvez les réordonner."
},
"quick_actions": {
"title": "Actions rapides",
@@ -138,7 +135,6 @@
"toast_saved": "Modifications enregistrées"
},
"preferences": {
- "general_title": "Général",
"theme": {
"title": "Thème",
"light": "Clair",
@@ -155,10 +151,12 @@
"sync_failed": "Langue enregistrée sur cet appareil, mais la synchronisation avec votre compte a échoué. Vos autres appareils peuvent afficher la langue précédente."
},
"timezone": {
- "title": "Fuseau horaire d'affichage",
+ "title": "Fuseau horaire",
"browser_suffix": " (navigateur)",
"hint": "Utilisé pour les dates et graphiques dans tous vos espaces de travail.",
- "sync_failed": "Échec de l'enregistrement de votre préférence de fuseau horaire."
+ "sync_failed": "Échec de l'enregistrement de votre préférence de fuseau horaire.",
+ "search": "Rechercher un fuseau horaire...",
+ "empty": "Aucun fuseau horaire correspondant"
},
"sticky_comment_bar": {
"title": "Épingler la barre de commentaire en bas"
@@ -169,10 +167,16 @@
"after_run": "Démarrer après cette exécution",
"hint": "Définit seulement le choix par défaut. Vous pouvez le modifier pour chaque message avant l'envoi."
},
- "issue_title": "Création de tâches",
- "comments_title": "Commentaires",
- "device_hint": "Enregistré sur cet appareil.",
- "issue_scope": "Ces préférences s'appliquent à cet espace de travail sur cet appareil. Elles modifient uniquement les champs visibles lors de la création d'une tâche."
+ "comments_title": "Commentaires et discussion",
+ "region_title": "Langue et région",
+ "appearance_title": "Apparence",
+ "issue_fields_title": "Champs affichés à la création de tâches",
+ "issue_fields": {
+ "field": "Champ",
+ "quick": "Création avec un agent",
+ "manual": "Création manuelle",
+ "unsupported": "Indisponible lors de la création avec un agent"
+ }
},
"shortcuts": {
"title": "Raccourcis clavier",
@@ -307,14 +311,11 @@
}
},
"chat": {
- "floating_title": "Fenêtre flottante",
"floating_label": "Fenêtre de discussion flottante",
"floating_hint": "Afficher le bouton de chat flottant sur chaque page."
},
"issue": {
"description": "Choisissez les champs que chaque fenêtre de création garde dans sa barre d'outils. Les champs masqués restent accessibles depuis le menu ⋯ et réapparaissent tant qu'ils contiennent une valeur.",
- "quick_create_title": "Champs de la barre de création avec un agent",
- "manual_create_title": "Champs de la barre de création manuelle",
"fields": {
"status": "Statut",
"priority": "Priorité",
@@ -326,7 +327,6 @@
}
},
"mcp": {
- "title": "MCP",
"description": "Après l’ajout d’un serveur, assignez-le depuis l’onglet MCP d’un agent.",
"servers_title": "Serveurs partagés",
"write_only_note": "Pour votre sécurité, les URL, commandes, en-têtes et valeurs d'environnement enregistrés ne sont plus affichés. Pour les modifier, saisissez une nouvelle configuration complète. Renommer conserve la configuration et les assignations aux agents.",
@@ -343,7 +343,6 @@
"remove_action": "Supprimer",
"empty_title": "Aucun serveur MCP partagé",
"disabled_badge": "Désactivé",
- "admin_only_note": "Seuls les propriétaires et administrateurs de l'espace de travail peuvent modifier les serveurs MCP partagés.",
"delete_title": "Retirer le serveur partagé ?",
"delete_description": "{{name}} sera retiré de la bibliothèque et de tous les agents auxquels il est assigné, à partir de leur prochaine exécution.",
"delete_confirm": "Retirer",
@@ -365,13 +364,10 @@
"preferences": "Préférences",
"shortcuts": "Raccourcis",
"issue": "Tâche",
- "chat": "Discussion",
"notifications": "Notifications",
"tokens": "Jetons d'API",
"general": "Général",
- "repositories": "Dépôts",
"github": "GitHub",
- "integrations": "Intégrations",
"labs": "Labo",
"members": "Membres",
"labels": "Étiquettes",
@@ -379,26 +375,32 @@
"properties": "Propriétés",
"quick_actions": "Actions rapides",
"plugins": "Plugins",
- "mcp": "MCP",
- "billing": "Facturation"
+ "mcp": "Serveurs MCP",
+ "billing": "Facturation",
+ "code": "Code",
+ "channels": "Messagerie",
+ "apps": "Applications connectées"
},
"groups": {
"personal": "Personnel",
"workspace": "Espace de travail",
- "issues": "Configuration des tâches",
+ "issues": "Tâches et flux de travail",
"connections": "Connexions et extensions",
- "device": "Application de bureau"
+ "device": "Cet appareil"
},
"navigate": "Aller aux paramètres",
- "device_scope": "Cet appareil"
+ "search": "Rechercher un paramètre",
+ "search_clear": "Effacer la recherche",
+ "search_empty": "Aucun paramètre correspondant",
+ "search_results_one": "{{count}} résultat",
+ "search_results_other": "{{count}} résultats",
+ "admin_only": "Seuls les propriétaires et administrateurs peuvent modifier ceci"
},
"plugins": {
"title": "Plugins",
"loading": "Chargement des plugins",
"load_failed": "Impossible de charger les plugins",
"load_failed_description": "Réessayez. Les plugins déjà activés et les exécutions épinglées ne sont pas affectés.",
- "read_only": "Accès en lecture seule",
- "read_only_description": "Les propriétaires et administrateurs de l'espace de travail peuvent installer ou modifier les rattachements de plugins.",
"empty": "Aucun plugin intégré disponible.",
"action_failed": "Échec de l'action sur le plugin",
"enabled": "Portée du plugin activée",
@@ -610,9 +612,7 @@
"profile_description_too_long": "Le profil est trop long (maximum {{max}} caractères ; actuellement {{count}}).",
"save": "Mettre à jour le profil",
"saving": "Mise à jour...",
- "toast_avatar_updated": "Avatar mis à jour",
"toast_avatar_failed": "Échec de l'envoi de l'avatar",
- "toast_profile_updated": "Profil mis à jour",
"toast_profile_failed": "Échec de la mise à jour du profil"
},
"notifications": {
@@ -709,22 +709,17 @@
"logo_label": "Logo de l'espace de travail",
"change_logo_aria": "Changer le logo de l'espace de travail",
"click_logo_hint": "Cliquez sur le logo pour envoyer une nouvelle image",
- "toast_logo_updated": "Logo de l'espace de travail mis à jour",
"toast_logo_failed": "Échec de l'envoi du logo de l'espace de travail",
"name_label": "Nom",
"description_label": "Description",
"description_placeholder": "Sur quoi porte cet espace de travail ?",
- "context_label": "Contexte",
+ "context_label": "Contexte des agents",
"context_placeholder": "Informations générales et contexte pour les agents IA travaillant dans cet espace de travail",
"slug_label": "Identifiant d'URL",
"issue_prefix_label": "Préfixe des tâches",
"issue_prefix_hint": "Utilisé dans les numéros de tâches, par exemple {{example}}.",
- "prefix_confirm_title": "Changer le préfixe des tâches ?",
- "prefix_confirm_description": "Toutes les tâches seront renumérotées de {{oldPrefix}}-N vers {{newPrefix}}-N. Les références externes — titres de pull requests, noms de branches, liens dans la documentation et les discussions — qui utilisent {{oldPrefix}}-N cesseront de fonctionner.",
"save": "Enregistrer",
"saving": "Enregistrement...",
- "manage_hint": "Seuls les administrateurs et les propriétaires peuvent modifier les paramètres de l'espace de travail.",
- "toast_saved": "Paramètres de l'espace de travail enregistrés",
"toast_save_failed": "Échec de l'enregistrement des paramètres de l'espace de travail",
"danger_zone": "Zone de danger",
"leave_title": "Quitter l'espace de travail",
@@ -742,7 +737,18 @@
"deleting": "Suppression...",
"toast_delete_failed": "Échec de la suppression de l'espace de travail",
"confirm_cancel": "Annuler",
- "confirm_action": "Confirmer"
+ "confirm_action": "Confirmer",
+ "context_hint": "Transmis à chaque agent de cet espace de travail à chaque exécution.",
+ "slug_hint": "Utilisé dans toutes les URL de l'espace de travail. Il ne peut pas être modifié.",
+ "copy_slug": "Copier le slug",
+ "copy_failed": "Impossible de copier",
+ "change_prefix": "Modifier le préfixe...",
+ "prefix_dialog_title": "Modifier le préfixe des tâches",
+ "prefix_dialog_description": "Toutes les tâches sont renumérotées, y compris celles terminées ou annulées.",
+ "prefix_new_label": "Nouveau préfixe",
+ "prefix_rule": "Lettres et chiffres uniquement, 10 caractères au maximum.",
+ "prefix_confirm_action": "Remplacer par {{prefix}}",
+ "prefix_external_warning": "Les anciens identifiants comme {{oldExample}} dans les titres de PR, noms de branche, documents et discussions ne sont pas mis à jour : ces liens cesseront de fonctionner."
},
"delete_workspace_dialog": {
"title": "Supprimer l'espace de travail",
@@ -759,15 +765,10 @@
"toast_failed": "Échec de la mise à jour du réglage"
},
"github": {
- "section_master": "Activer les fonctions GitHub",
- "master_description_on": "Désactiver met en pause les fonctionnalités GitHub et conserve les données existantes.",
"master_description_off": "Les fonctionnalités GitHub sont en pause. Les données existantes sont conservées.",
- "section_connection": "Connexion",
- "connection_title": "GitHub App",
"connected_to": "Connecté à {{login}}",
"connect_github": "Connecter GitHub",
"connect_opening": "Ouverture…",
- "connect_disabled_tooltip": "La GitHub App n'est pas configurée sur ce serveur",
"disconnect": "Déconnecter",
"disconnecting": "Déconnexion…",
"disconnect_confirm_title": "Déconnecter la GitHub App",
@@ -776,28 +777,26 @@
"disconnect_confirm_action": "Déconnecter",
"not_configured": "L'intégration GitHub n'est pas configurée pour ce déploiement. Les opérateurs doivent définir",
"not_configured_and": "et",
- "read_only_hint": "Vue en lecture seule. Seuls les administrateurs et propriétaires de l'espace de travail peuvent connecter ou déconnecter GitHub.",
"contact_admin_to_connect": "GitHub n'est pas connecté pour cet espace de travail. Demandez à un administrateur ou à un propriétaire de configurer la GitHub App.",
"connected_by": "Connecté par {{name}}",
"toast_not_configured": "L'intégration GitHub n'est pas configurée pour ce déploiement",
"toast_open_failed": "Échec de l'ouverture de l'installation GitHub",
"toast_disconnect_failed": "Échec de la déconnexion de la GitHub App",
"toast_disconnected": "GitHub App déconnectée",
- "section_features": "Fonctions",
"feature_pr_sidebar_label": "Barre latérale des pull requests",
"feature_pr_sidebar_description": "Afficher les pull requests liées dans la barre latérale de la tâche.",
"feature_co_author_label": "Mention Co-authored-by",
"feature_co_author_description_prefix": "Ajouter",
"feature_co_author_description_suffix": "aux commits rédigés par des agents.",
"feature_auto_link_label": "Lier automatiquement tâches et PR",
- "section_repositories": "Dépôts",
- "repositories_shortcut_label": "Les URL de dépôts se trouvent dans l'onglet Dépôts",
- "repositories_shortcut_link": "Gérer les dépôts →",
"toast_failed": "Échec de la mise à jour des paramètres GitHub",
- "feature_auto_link_description": "Lie une PR à la tâche dont l’identifiant, par ex. {{example}}, figure dans son titre ou sa branche, ou suit « Closes » dans sa description."
+ "feature_auto_link_description": "Lie une PR à la tâche dont l’identifiant, par ex. {{example}}, figure dans son titre ou sa branche, ou suit « Closes » dans sa description.",
+ "status_paused": "En pause",
+ "pause": "Mettre en pause les fonctionnalités GitHub",
+ "resume": "Reprendre les fonctionnalités GitHub"
},
"vcs": {
- "section_title": "Fournisseurs git (auto-hébergés)",
+ "section_title": "Git auto-hébergé",
"page_description": "Connectez une instance auto-hébergée de Forgejo, Gitea ou GitLab pour refléter les pull requests sur les tâches. Chaque connexion utilise un jeton d'accès ; les agents poussent leurs branches et ouvrent les PR avec les identifiants git propres au runtime.",
"connect_title": "Connecter une instance de fournisseur",
"connected_as": "Connecté en tant que {{login}}",
@@ -824,7 +823,6 @@
"disconnect_confirm_description": "Les pull requests reflétées et leurs liens vers les tâches pour cette connexion seront supprimés. Cette action est irréversible.",
"disconnect_confirm_cancel": "Annuler",
"disconnect_confirm_action": "Déconnecter",
- "toast_connected": "Fournisseur connecté",
"toast_connect_failed": "Impossible de se connecter au fournisseur",
"toast_disconnected": "Fournisseur déconnecté",
"toast_disconnect_failed": "Impossible de déconnecter",
@@ -834,8 +832,11 @@
"rotate_confirm_cancel": "Annuler",
"rotate_confirm_action": "Régénérer",
"rotating": "Régénération...",
- "toast_rotated": "Secret du webhook régénéré",
- "toast_rotate_failed": "Impossible de régénérer le secret du webhook"
+ "toast_rotate_failed": "Impossible de régénérer le secret du webhook",
+ "hosts_hint": "GitLab, Gitea ou Forgejo.",
+ "connect_another": "Connecter une autre instance",
+ "connection_actions": "Actions pour {{url}}",
+ "webhook_done": "C'est enregistré"
},
"lark": {
"section_title": "Lark",
@@ -913,7 +914,6 @@
"install_error_generic": "Échec de l'installation. Réessayez."
},
"composio": {
- "section_title": "Composio",
"page_description": "Connectez des applications que vos agents peuvent utiliser.",
"not_enabled_title": "Intégration Composio non activée",
"not_enabled_description_prefix": "Définissez",
@@ -1144,7 +1144,6 @@
"section_title": "Dépôts",
"description": "Les agents peuvent utiliser ces dépôts pour travailler sur le code.",
"url_placeholder": "https://git.exemple.com/org/depot.git ou [email protected]:org/depot.git",
- "url_empty": "(URL vide)",
"description_placeholder": "Description (ex. backend Go + frontend Next.js)",
"add": "Ajouter un dépôt",
"connect_github": "Connecter GitHub",
@@ -1167,21 +1166,26 @@
"github_selected_count": "{{count}} sélectionnés",
"github_cancel": "Annuler",
"github_import": "Ajouter les dépôts",
- "complete_manual_entry_first": "Complétez ou supprimez le dépôt manuel vide avant d'importer.",
"save": "Enregistrer",
"saving": "Enregistrement...",
"saved_hint": "Toutes les modifications sont enregistrées",
"empty": "Aucun dépôt pour l'instant.",
"edit_aria": "Modifier le dépôt",
"cancel_aria": "Annuler la modification",
- "delete_aria": "Supprimer le dépôt",
"delete_confirm_title": "Supprimer le dépôt ?",
"delete_confirm_description": "Ce dépôt sera immédiatement retiré de l'espace de travail.",
"delete_confirm_cancel": "Annuler",
"delete_confirm_action": "Supprimer le dépôt",
"manage_hint": "Seuls les administrateurs et les propriétaires peuvent gérer les dépôts.",
- "toast_saved": "Dépôts enregistrés",
- "toast_save_failed": "Échec de l'enregistrement des dépôts"
+ "toast_save_failed": "Échec de l'enregistrement des dépôts",
+ "add_manually": "Saisir une URL...",
+ "add_title": "Ajouter un dépôt",
+ "edit_title": "Modifier le dépôt",
+ "edit": "Modifier",
+ "url_label": "URL du dépôt",
+ "description_label": "Description",
+ "duplicate": "Ce dépôt est déjà ajouté.",
+ "actions_aria": "Actions pour {{url}}"
},
"desktop": {
"tabs": {
@@ -1277,7 +1281,6 @@
}
},
"members": {
- "section_title": "Membres ({{count}})",
"invite_title": "Inviter un membre",
"invite_email_placeholder": "[email protected]",
"invite_button": "Inviter",
@@ -1294,9 +1297,6 @@
"seat_purchase_timeout": "L'achat du siège a été soumis, mais sa confirmation prend plus de temps que prévu. Aucune invitation n'a été envoyée. Réessayez l'invitation lorsque la facturation indique un siège disponible.",
"seat_purchase_capacity_taken": "Le siège acheté n'est plus disponible, l'invitation n'a donc pas été envoyée. Vérifiez les sièges actuels avant de réessayer.",
"no_members": "Aucun membre trouvé.",
- "pending_title": "Invitations en attente ({{count}})",
- "pending_status": "En attente",
- "revoke_invitation_tooltip": "Révoquer l'invitation",
"revoke_invitation_title": "Révoquer l'invitation",
"revoke_invitation_description": "Révoquer l'invitation envoyée à {{email}} ? Cette personne ne pourra plus rejoindre cet espace de travail.",
"toast_invitation_revoked": "Invitation révoquée",
@@ -1327,9 +1327,6 @@
"description": "Créer des tâches et y travailler"
}
},
- "share_links_title": "Liens de partage",
- "role_field": "Rôle :",
- "expiry_field": "Expiration :",
"share_links_create_title": "Créer un lien de partage",
"share_links_create_button": "Générer",
"share_links_creating": "Génération...",
@@ -1346,26 +1343,70 @@
"expiry_24h": "24 heures",
"expiry_7d": "7 jours",
"expiry_30d": "30 jours",
- "expiry_never": "Jamais"
+ "expiry_never": "Jamais",
+ "members_label": "Membres",
+ "pending_label": "Invitations en attente",
+ "share_links_label": "Liens de partage",
+ "share_links_description": "Toute personne disposant du lien peut rejoindre avec le rôle choisi, jusqu'à expiration ou révocation.",
+ "search_placeholder": "Rechercher un nom ou un e-mail",
+ "no_results": "Aucun membre ne correspond à cette recherche.",
+ "no_invitations": "Aucune invitation en attente.",
+ "no_share_links": "Aucun lien de partage pour l'instant.",
+ "email_label": "E-mail",
+ "role_label": "Rôle",
+ "expiry_label": "Expire après",
+ "you": "Vous",
+ "joined": "Membre depuis le {{date}}",
+ "member_actions": "Actions pour {{name}}",
+ "invitation_meta": "Envoyée le {{sent}} · Expire le {{expires}}",
+ "revoke_invitation_aria": "Révoquer l'invitation de {{email}}",
+ "seats_used": "{{used}} sièges utilisés sur {{purchased}}",
+ "manage_seats": "Gérer les sièges"
},
"integrations": {
- "code_title": "Code et dépôts",
- "messaging_title": "Canaux de messagerie",
- "apps_title": "Vos applications connectées",
- "apps_scope": "Ces connexions d'applications appartiennent à votre compte. Les connexions aux canaux de l'espace de travail se gèrent ci-dessus.",
- "github_hint": "Connectez GitHub et configurez l'association des pull requests.",
- "vcs_hint": "Connectez GitLab, Gitea ou Forgejo.",
- "apps_hint": "Autorisez des applications pour vos agents via Composio.",
- "back": "Toutes les intégrations",
"status_connected": "Connecté",
"status_not_connected": "Non connecté",
"status_loading": "Vérification...",
- "status_unknown": "État indisponible",
- "channel_hint": "Discutez avec les agents et créez des tâches depuis {{channel}}."
+ "status_unknown": "État indisponible"
},
"pr_merge_status": {
"label": "Après la fusion des PR, passer la tâche à",
"description": "S’applique quand toutes les PR liées à une tâche sont fusionnées, pour les fusions à venir uniquement.",
"none": "Ne pas changer"
+ },
+ "layout": {
+ "scope": {
+ "account": "Compte · synchronisé",
+ "device": "Cet appareil uniquement",
+ "device_workspace": "Cet appareil · {{name}}",
+ "workspace": "Espace {{name}}",
+ "workspace_only": "Uniquement dans {{name}}"
+ },
+ "read_only": {
+ "title": "Lecture seule",
+ "description": "Seuls les propriétaires et administrateurs de l'espace de travail peuvent modifier ces paramètres.",
+ "contact": "Seuls les propriétaires et administrateurs peuvent modifier ces paramètres. Demandez à {{names}}.",
+ "separator": ", "
+ }
+ },
+ "code": {
+ "hosting_title": "Hébergement du code",
+ "pr_linking_title": "Pull requests et tâches",
+ "github_actions": "Actions GitHub"
+ },
+ "channels": {
+ "breadcrumb": "Fil d'Ariane"
+ },
+ "mcp_usage": {
+ "agent_count_one": "Utilisé par {{count}} agent",
+ "agent_count_other": "Utilisé par {{count}} agents",
+ "none": "Attribué à aucun agent"
+ },
+ "mcp_sources": {
+ "title": "Donner des outils aux agents",
+ "current": "Cette page",
+ "mcp": "Ajoutés par les administrateurs, partagés dans l'espace de travail puis attribués agent par agent.",
+ "apps": "Autorisées avec votre propre compte via Composio et activées sur les agents qui vous appartiennent.",
+ "plugins": "Paquets installés pouvant ajouter des outils, des hooks planifiés et du stockage, chacun avec ses propres autorisations."
}
}
diff --git a/packages/views/locales/fr/skills.json b/packages/views/locales/fr/skills.json
index d9f3194aa3..b5b697a1c8 100644
--- a/packages/views/locales/fr/skills.json
+++ b/packages/views/locales/fr/skills.json
@@ -120,7 +120,9 @@
"sort_by": "Trier par",
"direction_asc": "Croissant",
"direction_desc": "Décroissant",
- "section_columns": "Colonnes"
+ "section_columns": "Colonnes",
+ "manage_labels": "Gérer les étiquettes...",
+ "manage_labels_title": "Étiquettes des skills"
},
"detail": {
"all_skills": "Tous les skills",
diff --git a/packages/views/locales/ja/settings.json b/packages/views/locales/ja/settings.json
index 4e84b010d5..2a58419fab 100644
--- a/packages/views/locales/ja/settings.json
+++ b/packages/views/locales/ja/settings.json
@@ -16,11 +16,7 @@
"reorder": "{{name}} を並べ替え"
},
"reorder_hint": "カテゴリ内でドラッグすると、ボード・一覧・メニューの順序が変わります。",
- "built_in_dialog": {
- "title": "組み込みステータスは変更できません",
- "description": "組み込みステータスは Multica のシステム動作に使われるため、編集やアーカイブはできません。カテゴリー内の順序は変更できます。",
- "confirm": "確認"
- },
+ "built_in_dialog": {},
"editor": {
"create_title": "新しいステータス",
"edit_title": "ステータスを編集",
@@ -82,7 +78,8 @@
"done": "完了。",
"cancelled": "見送り。"
},
- "pr_auto_complete_badge": "PR のマージで自動設定"
+ "pr_auto_complete_badge": "PR のマージで自動設定",
+ "built_in_locked": "組み込みステータスはシステムの動作に使われるため、編集やアーカイブはできません。並び順は変更できます。"
},
"quick_actions": {
"title": "クイックアクション",
@@ -138,7 +135,6 @@
"toast_saved": "変更を保存しました"
},
"preferences": {
- "general_title": "一般",
"theme": {
"title": "テーマ",
"light": "ライト",
@@ -155,10 +151,12 @@
"sync_failed": "このデバイスに言語を保存しましたが、アカウントへの同期に失敗しました。他のデバイスでは以前の言語が表示される場合があります。"
},
"timezone": {
- "title": "表示タイムゾーン",
+ "title": "タイムゾーン",
"browser_suffix": " (ブラウザ)",
"hint": "すべてのワークスペースの日付とグラフに適用します。",
- "sync_failed": "タイムゾーン設定を保存できませんでした。"
+ "sync_failed": "タイムゾーン設定を保存できませんでした。",
+ "search": "タイムゾーンを検索...",
+ "empty": "一致するタイムゾーンはありません"
},
"sticky_comment_bar": {
"title": "コメント欄を下部に固定"
@@ -169,10 +167,16 @@
"after_run": "この実行の後に開始",
"hint": "既定の動作だけを決めます。送信前にメッセージごとに変更できます。"
},
- "issue_title": "タスク作成",
- "comments_title": "コメント",
- "device_hint": "このデバイスに保存されます。",
- "issue_scope": "この設定は、このデバイスの現在のワークスペースに適用され、タスク作成時に表示するフィールドのみを変更します。"
+ "comments_title": "コメントとチャット",
+ "region_title": "言語と地域",
+ "appearance_title": "外観",
+ "issue_fields_title": "タスク作成時に表示するフィールド",
+ "issue_fields": {
+ "field": "フィールド",
+ "quick": "エージェントで作成",
+ "manual": "手動作成",
+ "unsupported": "エージェントでの作成では使用できません"
+ }
},
"shortcuts": {
"title": "キーボードショートカット",
@@ -307,14 +311,11 @@
}
},
"chat": {
- "floating_title": "フローティングウィンドウ",
"floating_label": "フローティングチャット",
"floating_hint": "すべてのページにフローティングチャットボタンを表示します。"
},
"issue": {
"description": "各作成ダイアログのツールバーに常時表示するフィールドを選択します。非表示のフィールドは ⋯ メニューから引き続き使用でき、値がある間は自動的に表示されます。",
- "quick_create_title": "エージェントで作成する際のツールバー項目",
- "manual_create_title": "手動作成ツールバーの項目",
"fields": {
"status": "ステータス",
"priority": "優先度",
@@ -326,7 +327,6 @@
}
},
"mcp": {
- "title": "MCP",
"description": "追加後、エージェントの MCP タブで割り当てます。",
"servers_title": "共有サーバー",
"write_only_note": "機密情報を保護するため、保存した URL、コマンド、ヘッダー、環境変数は再表示されません。変更する場合は、新しい設定をすべて入力してください。名前だけを変更しても、現在の設定とエージェントへの割り当ては維持されます。",
@@ -343,7 +343,6 @@
"remove_action": "削除",
"empty_title": "共有 MCP サーバーはありません",
"disabled_badge": "無効",
- "admin_only_note": "共有 MCP サーバーを変更できるのはワークスペースの owner と admin のみです。",
"delete_title": "共有サーバーを削除しますか?",
"delete_description": "{{name}} はライブラリからも、割り当てられている全エージェントからも削除され、各エージェントの次の実行から反映されます。",
"delete_confirm": "削除",
@@ -365,40 +364,42 @@
"preferences": "環境設定",
"shortcuts": "ショートカット",
"issue": "タスク",
- "chat": "チャット",
"notifications": "通知",
"tokens": "API トークン",
"general": "一般",
- "repositories": "リポジトリ",
"github": "GitHub",
- "integrations": "連携",
"labs": "ラボ",
"members": "メンバー",
"labels": "ラベル",
"issue_statuses": "タスクステータス",
"properties": "プロパティ",
"quick_actions": "クイックアクション",
- "plugins": "Plugins",
- "mcp": "MCP",
- "billing": "請求とプラン"
+ "plugins": "プラグイン",
+ "mcp": "MCP サーバー",
+ "billing": "請求とプラン",
+ "code": "コード",
+ "channels": "メッセージング",
+ "apps": "接続済みアプリ"
},
"groups": {
- "personal": "個人設定",
- "workspace": "ワークスペース管理",
- "issues": "タスク設定",
+ "personal": "個人",
+ "workspace": "ワークスペース",
+ "issues": "タスクとワークフロー",
"connections": "接続と拡張機能",
- "device": "デスクトップアプリ"
+ "device": "このデバイス"
},
"navigate": "設定ページへ移動",
- "device_scope": "このデバイス"
+ "search": "設定を検索",
+ "search_clear": "検索をクリア",
+ "search_empty": "一致する設定はありません",
+ "search_results_other": "{{count}} 件の結果",
+ "admin_only": "オーナーと管理者のみ変更できます"
},
"plugins": {
- "title": "Plugins",
+ "title": "プラグイン",
"loading": "Plugins を読み込み中",
"load_failed": "Plugins を読み込めませんでした",
"load_failed_description": "再試行してください。インストール済みの Plugin には影響しません。",
- "read_only": "読み取り専用",
- "read_only_description": "ワークスペースの owner と admin が Plugin をインストール、設定、削除できます。",
"empty": "インストール済みの Plugin はありません。",
"action_failed": "Plugin 操作に失敗しました",
"enabled": "Plugin を有効にしました",
@@ -608,9 +609,7 @@
"profile_description_too_long": "プロフィールが長すぎます(最大 {{max}} 文字、現在 {{count}} 文字)。",
"save": "プロフィールを更新",
"saving": "更新中...",
- "toast_avatar_updated": "アバターを更新しました",
"toast_avatar_failed": "アバターをアップロードできませんでした",
- "toast_profile_updated": "プロフィールを更新しました",
"toast_profile_failed": "プロフィールを更新できませんでした"
},
"notifications": {
@@ -704,21 +703,17 @@
},
"workspace": {
"section_general": "ワークスペース情報",
- "logo_label": "ワークスペースロゴ",
+ "logo_label": "ワークスペースのアイコン",
"name_label": "名前",
"description_label": "説明",
"description_placeholder": "このワークスペースは何に注力していますか?",
- "context_label": "コンテキスト",
+ "context_label": "エージェントのコンテキスト",
"context_placeholder": "このワークスペースで作業する AI エージェント向けの背景情報とコンテキスト",
"slug_label": "スラッグ",
"issue_prefix_label": "タスク接頭辞",
"issue_prefix_hint": "{{example}} のようなタスク番号に使用されます。",
- "prefix_confirm_title": "タスク接頭辞を変更しますか?",
- "prefix_confirm_description": "すべてのタスク番号が {{oldPrefix}}-N から {{newPrefix}}-N に振り直されます。Pull request のタイトル、ブランチ名、ドキュメントやチャットのリンクなど、{{oldPrefix}}-N を使用している外部参照は解決されなくなります。",
"save": "保存",
"saving": "保存中...",
- "manage_hint": "ワークスペース設定を更新できるのは admin と owner のみです。",
- "toast_saved": "ワークスペース設定を保存しました",
"toast_save_failed": "ワークスペース設定を保存できませんでした",
"danger_zone": "危険な操作",
"leave_title": "ワークスペースを退出",
@@ -739,8 +734,18 @@
"confirm_action": "確認",
"change_logo_aria": "ワークスペースのロゴを変更",
"click_logo_hint": "ロゴをクリックして新しい画像をアップロード",
- "toast_logo_updated": "ワークスペースのロゴを更新しました",
- "toast_logo_failed": "ワークスペースのロゴをアップロードできませんでした"
+ "toast_logo_failed": "ワークスペースのロゴをアップロードできませんでした",
+ "context_hint": "このワークスペースのエージェントに、実行のたびに渡されます。",
+ "slug_hint": "ワークスペースの URL に使われます。作成後は変更できません。",
+ "copy_slug": "slug をコピー",
+ "copy_failed": "コピーできませんでした",
+ "change_prefix": "プレフィックスを変更...",
+ "prefix_dialog_title": "タスクのプレフィックスを変更",
+ "prefix_dialog_description": "完了済み・キャンセル済みを含むすべてのタスクの番号が変わります。",
+ "prefix_new_label": "新しいプレフィックス",
+ "prefix_rule": "英字と数字のみ、最大 10 文字です。",
+ "prefix_confirm_action": "{{prefix}} に変更",
+ "prefix_external_warning": "PR タイトル、ブランチ名、ドキュメント、チャット内の古いキー({{oldExample}} など)は更新されないため、それらのリンクは機能しなくなります。"
},
"delete_workspace_dialog": {
"title": "ワークスペースを削除",
@@ -757,15 +762,10 @@
"toast_failed": "設定を更新できませんでした"
},
"github": {
- "section_master": "GitHub 機能を有効にする",
- "master_description_on": "オフにすると GitHub 機能を停止し、既存データは保持します。",
"master_description_off": "GitHub 機能は停止中です。既存データは保持されています。",
- "section_connection": "接続",
- "connection_title": "GitHub App",
"connected_to": "{{login}} に接続済み",
"connect_github": "GitHub を接続",
"connect_opening": "開いています…",
- "connect_disabled_tooltip": "このサーバーには GitHub App が設定されていません",
"disconnect": "接続解除",
"disconnecting": "接続解除中…",
"disconnect_confirm_title": "GitHub App の接続を解除",
@@ -774,28 +774,26 @@
"disconnect_confirm_action": "接続解除",
"not_configured": "このデプロイには GitHub 連携が設定されていません。運営者が次の値を設定する必要があります:",
"not_configured_and": "および",
- "read_only_hint": "読み取り専用ビューです。GitHub を接続または解除できるのはワークスペースの admin と owner のみです。",
"contact_admin_to_connect": "このワークスペースには GitHub が接続されていません。admin または owner に GitHub App のセットアップを依頼してください。",
"connected_by": "{{name}} が接続",
"toast_not_configured": "このデプロイには GitHub 連携が設定されていません",
"toast_open_failed": "GitHub のインストール画面を開けませんでした",
"toast_disconnect_failed": "GitHub App の接続を解除できませんでした",
"toast_disconnected": "GitHub App の接続を解除しました",
- "section_features": "機能",
"feature_pr_sidebar_label": "Pull request サイドバー",
"feature_pr_sidebar_description": "リンクされた Pull request をタスク詳細サイドバーに表示します。",
"feature_co_author_label": "Co-authored-by トレーラー",
"feature_co_author_description_prefix": "エージェントが作成したコミットに",
"feature_co_author_description_suffix": "を追加します。",
"feature_auto_link_label": "タスクと PR を自動リンク",
- "section_repositories": "リポジトリ",
- "repositories_shortcut_label": "リポジトリ URL はリポジトリタブにあります",
- "repositories_shortcut_link": "リポジトリを管理 →",
"toast_failed": "GitHub 設定を更新できませんでした",
- "feature_auto_link_description": "タイトルかブランチ名にタスク番号(例: {{example}})を含む PR、または説明に「Closes {{example}}」と書いた PR を、そのタスクに関連付けます。"
+ "feature_auto_link_description": "タイトルかブランチ名にタスク番号(例: {{example}})を含む PR、または説明に「Closes {{example}}」と書いた PR を、そのタスクに関連付けます。",
+ "status_paused": "一時停止中",
+ "pause": "GitHub 機能を一時停止",
+ "resume": "GitHub 機能を再開"
},
"vcs": {
- "section_title": "Git providers (self-hosted)",
+ "section_title": "セルフホスト Git",
"page_description": "セルフホストの Forgejo、Gitea、GitLab インスタンスを接続し、Pull request をタスクにミラーリングします。接続ごとにアクセストークンを使用し、エージェントはランタイム自身の Git 認証情報でブランチを push して PR を作成します。",
"connect_title": "Connect a provider instance",
"connected_as": "Connected as {{login}}",
@@ -822,7 +820,6 @@
"disconnect_confirm_description": "この接続でミラーリングされた Pull request と、そのタスクへのリンクが削除されます。この操作は元に戻せません。",
"disconnect_confirm_cancel": "Cancel",
"disconnect_confirm_action": "Disconnect",
- "toast_connected": "Provider connected",
"toast_connect_failed": "Could not connect to the provider",
"toast_disconnected": "Provider disconnected",
"toast_disconnect_failed": "Could not disconnect",
@@ -832,8 +829,11 @@
"rotate_confirm_cancel": "Cancel",
"rotate_confirm_action": "Regenerate",
"rotating": "Regenerating...",
- "toast_rotated": "Webhook secret regenerated",
- "toast_rotate_failed": "Could not regenerate webhook secret"
+ "toast_rotate_failed": "Could not regenerate webhook secret",
+ "hosts_hint": "GitLab、Gitea、Forgejo に対応しています。",
+ "connect_another": "さらに接続",
+ "connection_actions": "{{url}} の操作",
+ "webhook_done": "保存しました"
},
"lark": {
"section_title": "Lark",
@@ -911,7 +911,6 @@
"install_error_generic": "設置に失敗しました。もう一度お試しください。"
},
"composio": {
- "section_title": "Composio",
"page_description": "エージェントが使えるアプリに接続します。",
"not_enabled_title": "Composio integration not enabled",
"not_enabled_description_prefix": "Set",
@@ -1141,7 +1140,6 @@
"section_title": "リポジトリ",
"description": "エージェントはこれらのリポジトリでコードを扱えます。",
"url_placeholder": "https://git.example.com/org/repo.git または [email protected]:org/repo.git",
- "url_empty": "(空の URL)",
"description_placeholder": "説明(例: Go バックエンド + Next.js フロントエンド)",
"add": "リポジトリを追加",
"connect_github": "GitHub に接続",
@@ -1164,21 +1162,26 @@
"github_selected_count": "{{count}} 件選択",
"github_cancel": "キャンセル",
"github_import": "リポジトリを追加",
- "complete_manual_entry_first": "空の手動リポジトリを入力するか削除してからインポートしてください。",
"save": "保存",
"saving": "保存中...",
"saved_hint": "すべての変更を保存しました",
"empty": "まだリポジトリがありません。",
"edit_aria": "リポジトリを編集",
"cancel_aria": "編集をキャンセル",
- "delete_aria": "リポジトリを削除",
"delete_confirm_title": "リポジトリを削除しますか?",
"delete_confirm_description": "このリポジトリはワークスペースから直ちに削除されます。",
"delete_confirm_cancel": "キャンセル",
"delete_confirm_action": "リポジトリを削除",
"manage_hint": "リポジトリを管理できるのは admin と owner のみです。",
- "toast_saved": "リポジトリを保存しました",
- "toast_save_failed": "リポジトリを保存できませんでした"
+ "toast_save_failed": "リポジトリを保存できませんでした",
+ "add_manually": "URL を入力...",
+ "add_title": "リポジトリを追加",
+ "edit_title": "リポジトリを編集",
+ "edit": "編集",
+ "url_label": "リポジトリ URL",
+ "description_label": "説明",
+ "duplicate": "このリポジトリは追加済みです。",
+ "actions_aria": "{{url}} の操作"
},
"desktop": {
"tabs": {
@@ -1270,7 +1273,6 @@
}
},
"members": {
- "section_title": "メンバー({{count}})",
"invite_title": "メンバーを招待",
"invite_email_placeholder": "[email protected]",
"invite_button": "招待",
@@ -1287,9 +1289,6 @@
"seat_purchase_timeout": "席の購入は送信されましたが、確認に時間がかかっています。招待は送信されていません。請求画面に空き席が表示された後、もう一度招待してください。",
"seat_purchase_capacity_taken": "購入した席はすでに利用できないため、招待は送信されませんでした。現在の席を確認してから再試行してください。",
"no_members": "メンバーが見つかりません。",
- "pending_title": "保留中の招待({{count}})",
- "pending_status": "保留中",
- "revoke_invitation_tooltip": "招待を取り消し",
"revoke_invitation_title": "招待を取り消し",
"revoke_invitation_description": "{{email}} への招待を取り消しますか?このワークスペースに参加できなくなります。",
"toast_invitation_revoked": "招待を取り消しました",
@@ -1320,9 +1319,6 @@
"description": "タスクの作成と作業"
}
},
- "share_links_title": "共有リンク",
- "role_field": "ロール:",
- "expiry_field": "有効期限:",
"share_links_create_title": "共有リンクを作成",
"share_links_create_button": "生成",
"share_links_creating": "生成中...",
@@ -1339,26 +1335,69 @@
"expiry_24h": "24時間",
"expiry_7d": "7日",
"expiry_30d": "30日",
- "expiry_never": "無期限"
+ "expiry_never": "無期限",
+ "members_label": "メンバー",
+ "pending_label": "承認待ちの招待",
+ "share_links_label": "共有リンク",
+ "share_links_description": "リンクを知っている人は、期限切れまたは取り消しまで、選択したロールで参加できます。",
+ "search_placeholder": "名前またはメールで検索",
+ "no_results": "一致するメンバーはいません。",
+ "no_invitations": "承認待ちの招待はありません。",
+ "no_share_links": "共有リンクはまだありません。",
+ "email_label": "メールアドレス",
+ "role_label": "ロール",
+ "expiry_label": "有効期限",
+ "you": "あなた",
+ "joined": "{{date}} に参加",
+ "member_actions": "{{name}} の操作",
+ "invitation_meta": "{{sent}} に送信 · {{expires}} に期限切れ",
+ "revoke_invitation_aria": "{{email}} への招待を取り消す",
+ "seats_used": "{{purchased}} 席中 {{used}} 席を使用",
+ "manage_seats": "席を管理"
},
"integrations": {
- "code_title": "コードとリポジトリ",
- "messaging_title": "メッセージチャネル",
- "apps_title": "自分のアプリ接続",
- "apps_scope": "これらのアプリ接続はあなたのアカウントに属します。ワークスペースのチャネル接続は上で管理します。",
- "github_hint": "GitHub を接続し、プルリクエストの関連付けを設定します。",
- "vcs_hint": "GitLab、Gitea、Forgejo を接続します。",
- "apps_hint": "Composio 経由でエージェント用のアプリを認可します。",
- "back": "すべての連携",
"status_connected": "接続済み",
"status_not_connected": "未接続",
"status_loading": "確認中...",
- "status_unknown": "状態を取得できません",
- "channel_hint": "{{channel}} でエージェントと会話し、タスクを作成します。"
+ "status_unknown": "状態を取得できません"
},
"pr_merge_status": {
"label": "PR マージ後のタスクのステータス",
"description": "紐づいた PR がすべてマージされたときに適用され、今後のマージにのみ影響します。",
"none": "変更しない"
+ },
+ "layout": {
+ "scope": {
+ "account": "アカウント · 全デバイスで同期",
+ "device": "このデバイスのみ",
+ "device_workspace": "このデバイスのみ · {{name}}",
+ "workspace": "{{name}} ワークスペース",
+ "workspace_only": "{{name}} のみに適用"
+ },
+ "read_only": {
+ "title": "閲覧のみ",
+ "description": "これらの設定を変更できるのはワークスペースのオーナーと管理者だけです。",
+ "contact": "これらの設定を変更できるのはオーナーと管理者だけです。{{names}} に依頼してください。",
+ "separator": "、"
+ }
+ },
+ "code": {
+ "hosting_title": "コードホスティング",
+ "pr_linking_title": "プルリクエストとタスク",
+ "github_actions": "GitHub の操作"
+ },
+ "channels": {
+ "breadcrumb": "パンくずリスト"
+ },
+ "mcp_usage": {
+ "agent_count_other": "{{count}} 個のエージェントが使用中",
+ "none": "どのエージェントにも割り当てられていません"
+ },
+ "mcp_sources": {
+ "title": "エージェントにツールを与える方法",
+ "current": "このページ",
+ "mcp": "管理者が追加してワークスペースで共有し、エージェントごとに割り当てます。",
+ "apps": "自分のアカウントで Composio 経由で承認し、自分が所有するエージェントで有効にします。",
+ "plugins": "インストールするとツール、定期フック、ストレージを追加でき、プラグインごとに権限を付与します。"
}
}
diff --git a/packages/views/locales/ja/skills.json b/packages/views/locales/ja/skills.json
index 6836da4a1f..e825a0243f 100644
--- a/packages/views/locales/ja/skills.json
+++ b/packages/views/locales/ja/skills.json
@@ -112,7 +112,9 @@
"sort_by": "並び替え",
"direction_asc": "昇順",
"direction_desc": "降順",
- "section_columns": "表示する列"
+ "section_columns": "表示する列",
+ "manage_labels": "ラベルを管理...",
+ "manage_labels_title": "スキルのラベル"
},
"detail": {
"all_skills": "すべてのスキル",
diff --git a/packages/views/locales/ko/settings.json b/packages/views/locales/ko/settings.json
index 9a0a664499..9d10d04bdc 100644
--- a/packages/views/locales/ko/settings.json
+++ b/packages/views/locales/ko/settings.json
@@ -16,11 +16,7 @@
"reorder": "{{name}} 순서 변경"
},
"reorder_hint": "카테고리 안에서 드래그하면 보드, 목록, 메뉴의 순서가 바뀝니다.",
- "built_in_dialog": {
- "title": "기본 상태는 변경할 수 없습니다",
- "description": "기본 상태는 Multica 시스템 동작에 사용되므로 편집하거나 보관할 수 없습니다. 카테고리 내 순서는 변경할 수 있습니다.",
- "confirm": "확인"
- },
+ "built_in_dialog": {},
"editor": {
"create_title": "새 상태",
"edit_title": "상태 편집",
@@ -82,7 +78,8 @@
"done": "완료.",
"cancelled": "진행하지 않기로 함."
},
- "pr_auto_complete_badge": "PR 병합 시 자동 설정"
+ "pr_auto_complete_badge": "PR 병합 시 자동 설정",
+ "built_in_locked": "기본 상태는 시스템 동작에 쓰이므로 편집하거나 보관할 수 없습니다. 순서는 바꿀 수 있습니다."
},
"quick_actions": {
"title": "퀵 액션",
@@ -138,7 +135,6 @@
"toast_saved": "변경사항을 저장했습니다"
},
"preferences": {
- "general_title": "일반",
"theme": {
"title": "테마",
"light": "라이트",
@@ -155,10 +151,12 @@
"sync_failed": "이 기기에는 언어가 저장되었지만 계정 동기화에 실패했습니다. 다른 기기에서는 이전 언어가 표시될 수 있습니다."
},
"timezone": {
- "title": "표시 시간대",
+ "title": "시간대",
"browser_suffix": " (브라우저)",
"hint": "모든 워크스페이스의 날짜와 차트에 적용됩니다.",
- "sync_failed": "시간대 설정을 저장하지 못했습니다."
+ "sync_failed": "시간대 설정을 저장하지 못했습니다.",
+ "search": "시간대 검색...",
+ "empty": "일치하는 시간대가 없습니다"
},
"sticky_comment_bar": {
"title": "댓글 입력란을 하단에 고정"
@@ -169,10 +167,16 @@
"after_run": "이번 실행 후 시작",
"hint": "기본값만 정합니다. 보내기 전에 메시지마다 바꿀 수 있습니다."
},
- "issue_title": "태스크 생성",
- "comments_title": "댓글",
- "device_hint": "현재 기기에 저장됩니다.",
- "issue_scope": "이 설정은 현재 기기의 현재 워크스페이스에 적용되며 태스크 생성 시 표시되는 필드만 변경합니다."
+ "comments_title": "댓글 및 채팅",
+ "region_title": "언어 및 지역",
+ "appearance_title": "모양",
+ "issue_fields_title": "태스크 생성 시 표시할 필드",
+ "issue_fields": {
+ "field": "필드",
+ "quick": "에이전트로 생성",
+ "manual": "수동 생성",
+ "unsupported": "에이전트로 생성할 때는 사용할 수 없습니다"
+ }
},
"shortcuts": {
"title": "키보드 단축키",
@@ -307,14 +311,11 @@
}
},
"chat": {
- "floating_title": "플로팅 창",
"floating_label": "플로팅 채팅 창",
"floating_hint": "모든 페이지에 플로팅 채팅 버튼을 표시합니다."
},
"issue": {
"description": "각 생성 방식의 툴바에 항상 표시할 필드를 선택합니다. 숨긴 필드는 ⋯ 메뉴에서 계속 사용할 수 있으며, 값이 있는 동안에는 자동으로 표시됩니다.",
- "quick_create_title": "에이전트로 생성할 때의 도구 모음 필드",
- "manual_create_title": "수동 생성 도구 모음 필드",
"fields": {
"status": "상태",
"priority": "우선순위",
@@ -326,7 +327,6 @@
}
},
"mcp": {
- "title": "MCP",
"description": "추가 후 에이전트의 MCP 탭에서 할당하세요.",
"servers_title": "공유 서버",
"write_only_note": "민감한 정보를 보호하기 위해 저장된 URL, 명령, 헤더, 환경 변수는 다시 표시되지 않습니다. 변경하려면 새 설정을 모두 입력하세요. 이름만 바꾸면 현재 설정과 에이전트 할당은 그대로 유지됩니다.",
@@ -343,7 +343,6 @@
"remove_action": "삭제",
"empty_title": "공유 MCP 서버가 없습니다",
"disabled_badge": "비활성화됨",
- "admin_only_note": "공유 MCP 서버는 워크스페이스 owner와 admin만 변경할 수 있습니다.",
"delete_title": "공유 서버를 제거할까요?",
"delete_description": "{{name}}은(는) 라이브러리와 할당된 모든 에이전트에서 제거되며 각 에이전트의 다음 실행부터 적용됩니다.",
"delete_confirm": "제거",
@@ -365,40 +364,42 @@
"preferences": "환경설정",
"shortcuts": "단축키",
"issue": "태스크",
- "chat": "채팅",
"notifications": "알림",
"tokens": "API 토큰",
"general": "일반",
- "repositories": "저장소",
"github": "GitHub",
- "integrations": "연동",
"labs": "실험실",
"members": "멤버",
"labels": "레이블",
"issue_statuses": "태스크 상태",
"properties": "속성",
"quick_actions": "퀵 액션",
- "plugins": "Plugins",
- "mcp": "MCP",
- "billing": "결제 및 요금제"
+ "plugins": "플러그인",
+ "mcp": "MCP 서버",
+ "billing": "결제 및 요금제",
+ "code": "코드",
+ "channels": "메신저",
+ "apps": "연결된 앱"
},
"groups": {
- "personal": "개인 설정",
- "workspace": "워크스페이스 관리",
- "issues": "태스크 설정",
+ "personal": "개인",
+ "workspace": "워크스페이스",
+ "issues": "태스크 및 워크플로",
"connections": "연결 및 확장",
- "device": "데스크톱 앱"
+ "device": "이 기기"
},
"navigate": "설정 페이지로 이동",
- "device_scope": "현재 기기"
+ "search": "설정 검색",
+ "search_clear": "검색 지우기",
+ "search_empty": "일치하는 설정이 없습니다",
+ "search_results_other": "결과 {{count}}개",
+ "admin_only": "소유자와 관리자만 변경할 수 있습니다"
},
"plugins": {
- "title": "Plugins",
+ "title": "플러그인",
"loading": "Plugins 불러오는 중",
"load_failed": "Plugins를 불러올 수 없습니다",
"load_failed_description": "다시 시도하세요. 설치된 Plugin에는 영향이 없습니다.",
- "read_only": "읽기 전용",
- "read_only_description": "워크스페이스 owner와 admin이 Plugin을 설치, 설정, 제거할 수 있습니다.",
"empty": "설치된 Plugin이 없습니다.",
"action_failed": "Plugin 작업에 실패했습니다",
"enabled": "Plugin을 활성화했습니다",
@@ -608,9 +609,7 @@
"profile_description_too_long": "프로필이 너무 깁니다(최대 {{max}}자, 현재 {{count}}자).",
"save": "프로필 업데이트",
"saving": "업데이트 중...",
- "toast_avatar_updated": "아바타를 업데이트했습니다",
"toast_avatar_failed": "아바타를 업로드하지 못했습니다",
- "toast_profile_updated": "프로필을 업데이트했습니다",
"toast_profile_failed": "프로필을 업데이트하지 못했습니다"
},
"notifications": {
@@ -704,25 +703,20 @@
},
"workspace": {
"section_general": "워크스페이스 정보",
- "logo_label": "워크스페이스 로고",
+ "logo_label": "워크스페이스 아이콘",
"change_logo_aria": "워크스페이스 로고 변경",
"click_logo_hint": "로고를 클릭하여 새 이미지를 업로드하세요",
- "toast_logo_updated": "워크스페이스 로고를 업데이트했습니다",
"toast_logo_failed": "워크스페이스 로고를 업로드하지 못했습니다",
"name_label": "이름",
"description_label": "설명",
"description_placeholder": "이 워크스페이스는 무엇에 집중하나요?",
- "context_label": "맥락",
+ "context_label": "에이전트 컨텍스트",
"context_placeholder": "이 워크스페이스에서 작업하는 AI 에이전트가 알아야 할 배경 정보와 맥락",
"slug_label": "슬러그",
"issue_prefix_label": "태스크 접두사",
"issue_prefix_hint": "{{example}} 같은 태스크 번호에 사용됩니다.",
- "prefix_confirm_title": "태스크 접두사를 변경할까요?",
- "prefix_confirm_description": "모든 태스크 번호가 {{oldPrefix}}-N에서 {{newPrefix}}-N으로 다시 매겨집니다. Pull request 제목, 브랜치 이름, 문서와 채팅의 링크처럼 {{oldPrefix}}-N을 사용하는 외부 참조는 더 이상 연결되지 않습니다.",
"save": "저장",
"saving": "저장하는 중...",
- "manage_hint": "관리자와 소유자만 워크스페이스 설정을 업데이트할 수 있습니다.",
- "toast_saved": "워크스페이스 설정을 저장했습니다",
"toast_save_failed": "워크스페이스 설정을 저장하지 못했습니다",
"danger_zone": "위험 영역",
"leave_title": "워크스페이스 나가기",
@@ -740,7 +734,18 @@
"deleting": "삭제하는 중...",
"toast_delete_failed": "워크스페이스를 삭제하지 못했습니다",
"confirm_cancel": "취소",
- "confirm_action": "확인"
+ "confirm_action": "확인",
+ "context_hint": "이 워크스페이스의 에이전트에게 실행할 때마다 전달됩니다.",
+ "slug_hint": "모든 워크스페이스 URL에 쓰이며 생성 후에는 변경할 수 없습니다.",
+ "copy_slug": "slug 복사",
+ "copy_failed": "복사하지 못했습니다",
+ "change_prefix": "접두사 변경...",
+ "prefix_dialog_title": "태스크 접두사 변경",
+ "prefix_dialog_description": "완료되거나 취소된 태스크를 포함해 모든 태스크의 번호가 바뀝니다.",
+ "prefix_new_label": "새 접두사",
+ "prefix_rule": "영문자와 숫자만, 최대 10자까지 사용할 수 있습니다.",
+ "prefix_confirm_action": "{{prefix}}(으)로 변경",
+ "prefix_external_warning": "PR 제목, 브랜치 이름, 문서, 채팅에 있는 이전 키({{oldExample}} 등)는 업데이트되지 않으므로 해당 링크가 작동하지 않습니다."
},
"delete_workspace_dialog": {
"title": "워크스페이스 삭제",
@@ -757,15 +762,10 @@
"toast_failed": "설정을 업데이트하지 못했습니다"
},
"github": {
- "section_master": "GitHub 기능 사용",
- "master_description_on": "끄면 GitHub 기능을 일시 중지하고 기존 데이터는 유지합니다.",
"master_description_off": "GitHub 기능이 일시 중지되었습니다. 기존 데이터는 유지됩니다.",
- "section_connection": "연결",
- "connection_title": "GitHub App",
"connected_to": "{{login}}에 연결됨",
"connect_github": "GitHub 연결",
"connect_opening": "여는 중...",
- "connect_disabled_tooltip": "이 서버에 GitHub App이 설정되어 있지 않습니다",
"disconnect": "연결 해제",
"disconnecting": "연결 해제 중...",
"disconnect_confirm_title": "GitHub App 연결 해제",
@@ -774,28 +774,26 @@
"disconnect_confirm_action": "연결 해제",
"not_configured": "이 배포에는 GitHub 연동이 설정되어 있지 않습니다. 운영자가 다음 값을 설정해야 합니다:",
"not_configured_and": "및",
- "read_only_hint": "읽기 전용 보기입니다. 워크스페이스 관리자와 소유자만 GitHub를 연결하거나 해제할 수 있습니다.",
"contact_admin_to_connect": "이 워크스페이스에 GitHub가 연결되어 있지 않습니다. 관리자나 소유자에게 GitHub App 설정을 요청하세요.",
"connected_by": "{{name}}님이 연결함",
"toast_not_configured": "이 배포에는 GitHub 연동이 설정되어 있지 않습니다",
"toast_open_failed": "GitHub 설치 화면을 열지 못했습니다",
"toast_disconnect_failed": "GitHub App 연결을 해제하지 못했습니다",
"toast_disconnected": "GitHub App 연결을 해제했습니다",
- "section_features": "기능",
"feature_pr_sidebar_label": "Pull request 사이드바",
"feature_pr_sidebar_description": "연결된 Pull request를 태스크 상세 사이드바에 표시합니다.",
"feature_co_author_label": "Co-authored-by 트레일러",
"feature_co_author_description_prefix": "에이전트가 작성한 커밋에",
"feature_co_author_description_suffix": "을(를) 추가합니다.",
"feature_auto_link_label": "태스크와 PR 자동 연결",
- "section_repositories": "저장소",
- "repositories_shortcut_label": "저장소 URL은 저장소 탭에 있습니다",
- "repositories_shortcut_link": "저장소 관리 →",
"toast_failed": "GitHub 설정을 업데이트하지 못했습니다",
- "feature_auto_link_description": "제목이나 브랜치 이름에 태스크 번호(예: {{example}})가 있거나 설명에 \"Closes {{example}}\"가 있는 PR을 해당 태스크에 연결합니다."
+ "feature_auto_link_description": "제목이나 브랜치 이름에 태스크 번호(예: {{example}})가 있거나 설명에 \"Closes {{example}}\"가 있는 PR을 해당 태스크에 연결합니다.",
+ "status_paused": "일시 중지됨",
+ "pause": "GitHub 기능 일시 중지",
+ "resume": "GitHub 기능 재개"
},
"vcs": {
- "section_title": "Git providers (self-hosted)",
+ "section_title": "셀프 호스팅 Git",
"page_description": "셀프 호스팅 Forgejo, Gitea, GitLab 인스턴스를 연결해 Pull request를 태스크에 미러링합니다. 연결마다 액세스 토큰을 사용하며, 에이전트는 런타임 자체의 Git 자격 증명으로 브랜치를 푸시하고 PR을 엽니다.",
"connect_title": "Connect a provider instance",
"connected_as": "Connected as {{login}}",
@@ -822,7 +820,6 @@
"disconnect_confirm_description": "이 연결에서 미러링된 Pull request와 태스크 연결이 제거됩니다. 되돌릴 수 없습니다.",
"disconnect_confirm_cancel": "Cancel",
"disconnect_confirm_action": "Disconnect",
- "toast_connected": "Provider connected",
"toast_connect_failed": "Could not connect to the provider",
"toast_disconnected": "Provider disconnected",
"toast_disconnect_failed": "Could not disconnect",
@@ -832,8 +829,11 @@
"rotate_confirm_cancel": "Cancel",
"rotate_confirm_action": "Regenerate",
"rotating": "Regenerating...",
- "toast_rotated": "Webhook secret regenerated",
- "toast_rotate_failed": "Could not regenerate webhook secret"
+ "toast_rotate_failed": "Could not regenerate webhook secret",
+ "hosts_hint": "GitLab, Gitea 또는 Forgejo.",
+ "connect_another": "추가로 연결",
+ "connection_actions": "{{url}} 작업",
+ "webhook_done": "저장했습니다"
},
"telegram": {
"section_title": "Telegram",
@@ -880,7 +880,6 @@
"section_title": "저장소",
"description": "에이전트가 이 저장소에서 코드를 작업할 수 있습니다.",
"url_placeholder": "https://git.example.com/org/repo.git 또는 [email protected]:org/repo.git",
- "url_empty": "(빈 URL)",
"description_placeholder": "설명(예: Go 백엔드 + Next.js 프런트엔드)",
"add": "저장소 추가",
"connect_github": "GitHub 연결",
@@ -903,21 +902,26 @@
"github_selected_count": "{{count}}개 선택",
"github_cancel": "취소",
"github_import": "저장소 추가",
- "complete_manual_entry_first": "비어 있는 수동 저장소를 입력하거나 삭제한 후 가져오세요.",
"save": "저장",
"saving": "저장하는 중...",
"saved_hint": "모든 변경사항 저장됨",
"empty": "아직 저장소가 없습니다.",
"edit_aria": "저장소 수정",
"cancel_aria": "수정 취소",
- "delete_aria": "저장소 삭제",
"delete_confirm_title": "저장소를 삭제할까요?",
"delete_confirm_description": "이 저장소는 워크스페이스에서 즉시 제거됩니다.",
"delete_confirm_cancel": "취소",
"delete_confirm_action": "저장소 삭제",
"manage_hint": "관리자와 소유자만 저장소를 관리할 수 있습니다.",
- "toast_saved": "저장소를 저장했습니다",
- "toast_save_failed": "저장소를 저장하지 못했습니다"
+ "toast_save_failed": "저장소를 저장하지 못했습니다",
+ "add_manually": "URL 입력...",
+ "add_title": "저장소 추가",
+ "edit_title": "저장소 편집",
+ "edit": "편집",
+ "url_label": "저장소 URL",
+ "description_label": "설명",
+ "duplicate": "이미 추가된 저장소입니다.",
+ "actions_aria": "{{url}} 작업"
},
"desktop": {
"tabs": {
@@ -1009,7 +1013,6 @@
}
},
"members": {
- "section_title": "멤버 ({{count}})",
"invite_title": "멤버 초대",
"invite_email_placeholder": "[email protected]",
"invite_button": "초대",
@@ -1026,9 +1029,6 @@
"seat_purchase_timeout": "좌석 구매가 제출되었지만 확인이 예상보다 오래 걸리고 있습니다. 초대는 전송되지 않았습니다. 결제 화면에 사용 가능한 좌석이 표시된 후 다시 초대하세요.",
"seat_purchase_capacity_taken": "구매한 좌석을 더 이상 사용할 수 없어 초대가 전송되지 않았습니다. 현재 좌석을 확인한 후 다시 시도하세요.",
"no_members": "멤버를 찾을 수 없습니다.",
- "pending_title": "대기 중인 초대 ({{count}})",
- "pending_status": "대기 중",
- "revoke_invitation_tooltip": "초대 취소",
"revoke_invitation_title": "초대 취소",
"revoke_invitation_description": "{{email}}에 보낸 초대를 취소할까요? 더 이상 이 워크스페이스에 참가할 수 없습니다.",
"toast_invitation_revoked": "초대를 취소했습니다",
@@ -1059,9 +1059,6 @@
"description": "태스크 생성 및 작업"
}
},
- "share_links_title": "공유 링크",
- "role_field": "역할:",
- "expiry_field": "만료:",
"share_links_create_title": "공유 링크 만들기",
"share_links_create_button": "생성",
"share_links_creating": "생성 중...",
@@ -1078,7 +1075,25 @@
"expiry_24h": "24시간",
"expiry_7d": "7일",
"expiry_30d": "30일",
- "expiry_never": "무기한"
+ "expiry_never": "무기한",
+ "members_label": "멤버",
+ "pending_label": "대기 중인 초대",
+ "share_links_label": "공유 링크",
+ "share_links_description": "링크가 있는 사람은 만료되거나 취소될 때까지 선택한 역할로 참여할 수 있습니다.",
+ "search_placeholder": "이름 또는 이메일 검색",
+ "no_results": "일치하는 멤버가 없습니다.",
+ "no_invitations": "대기 중인 초대가 없습니다.",
+ "no_share_links": "아직 공유 링크가 없습니다.",
+ "email_label": "이메일",
+ "role_label": "역할",
+ "expiry_label": "만료",
+ "you": "나",
+ "joined": "{{date}} 참여",
+ "member_actions": "{{name}} 작업",
+ "invitation_meta": "{{sent}} 발송 · {{expires}} 만료",
+ "revoke_invitation_aria": "{{email}}에 보낸 초대 취소",
+ "seats_used": "{{purchased}}석 중 {{used}}석 사용",
+ "manage_seats": "좌석 관리"
},
"lark": {
"section_title": "Lark",
@@ -1156,7 +1171,6 @@
"install_error_generic": "설치에 실패했어요. 다시 시도하세요."
},
"composio": {
- "section_title": "Composio",
"page_description": "에이전트가 사용할 앱을 연결하세요.",
"not_enabled_title": "Composio integration not enabled",
"not_enabled_description_prefix": "Set",
@@ -1342,23 +1356,48 @@
"byo_failed_toast": "WeCom 봇을 연결하지 못했어요"
},
"integrations": {
- "code_title": "코드 및 저장소",
- "messaging_title": "메시지 채널",
- "apps_title": "내 앱 연결",
- "apps_scope": "이 앱 연결은 내 계정에 속합니다. 워크스페이스 채널 연결은 위에서 관리합니다.",
- "github_hint": "GitHub를 연결하고 풀 리퀘스트 연결을 설정합니다.",
- "vcs_hint": "GitLab, Gitea 또는 Forgejo를 연결합니다.",
- "apps_hint": "Composio를 통해 에이전트용 앱을 승인합니다.",
- "back": "모든 연동",
"status_connected": "연결됨",
"status_not_connected": "연결되지 않음",
"status_loading": "확인 중...",
- "status_unknown": "상태를 확인할 수 없음",
- "channel_hint": "{{channel}}에서 에이전트와 대화하고 태스크를 생성합니다."
+ "status_unknown": "상태를 확인할 수 없음"
},
"pr_merge_status": {
"label": "PR 병합 후 태스크 상태",
"description": "연결된 PR이 모두 병합되면 적용되며, 이후 병합에만 영향을 줍니다.",
"none": "변경하지 않음"
+ },
+ "layout": {
+ "scope": {
+ "account": "계정 · 모든 기기에 동기화",
+ "device": "이 기기에만",
+ "device_workspace": "이 기기에만 · {{name}}",
+ "workspace": "{{name}} 워크스페이스",
+ "workspace_only": "{{name}}에만 적용"
+ },
+ "read_only": {
+ "title": "보기 전용",
+ "description": "이 설정은 워크스페이스 소유자와 관리자만 변경할 수 있습니다.",
+ "contact": "이 설정은 소유자와 관리자만 변경할 수 있습니다. {{names}}에게 요청하세요.",
+ "separator": ", "
+ }
+ },
+ "code": {
+ "hosting_title": "코드 호스팅",
+ "pr_linking_title": "풀 리퀘스트와 태스크",
+ "github_actions": "GitHub 작업"
+ },
+ "channels": {
+ "breadcrumb": "탐색 경로"
+ },
+ "mcp_usage": {
+ "agent_count_other": "에이전트 {{count}}개가 사용 중",
+ "none": "어떤 에이전트에도 할당되지 않음"
+ },
+ "mcp_sources": {
+ "title": "에이전트에 도구를 제공하는 방법",
+ "current": "현재 페이지",
+ "mcp": "관리자가 추가해 워크스페이스에서 공유하고, 에이전트별로 할당합니다.",
+ "apps": "내 계정으로 Composio를 통해 승인하고, 내가 소유한 에이전트에서 사용합니다.",
+ "plugins": "설치하면 도구, 예약 훅, 저장소를 추가할 수 있으며 플러그인마다 권한을 부여합니다."
}
}
diff --git a/packages/views/locales/ko/skills.json b/packages/views/locales/ko/skills.json
index 27b4853383..9d5d87b539 100644
--- a/packages/views/locales/ko/skills.json
+++ b/packages/views/locales/ko/skills.json
@@ -112,7 +112,9 @@
"sort_by": "정렬",
"direction_asc": "오름차순",
"direction_desc": "내림차순",
- "section_columns": "표시 열"
+ "section_columns": "표시 열",
+ "manage_labels": "라벨 관리...",
+ "manage_labels_title": "스킬 라벨"
},
"detail": {
"all_skills": "모든 스킬",
diff --git a/packages/views/locales/zh-Hans/settings.json b/packages/views/locales/zh-Hans/settings.json
index c2e76a2044..b3bd96a98a 100644
--- a/packages/views/locales/zh-Hans/settings.json
+++ b/packages/views/locales/zh-Hans/settings.json
@@ -16,11 +16,7 @@
"reorder": "拖动排序 {{name}}"
},
"reorder_hint": "在分类内拖动排序,同步用于看板、列表和菜单。",
- "built_in_dialog": {
- "title": "无法修改内置状态",
- "description": "内置状态用于 Multica 的系统行为,不能编辑或归档。你仍可调整它们在分类内的顺序。",
- "confirm": "知道了"
- },
+ "built_in_dialog": {},
"editor": {
"create_title": "新建状态",
"edit_title": "编辑状态",
@@ -82,7 +78,8 @@
"done": "已完成。",
"cancelled": "决定不做。"
},
- "pr_auto_complete_badge": "PR 合并后自动进入"
+ "pr_auto_complete_badge": "PR 合并后自动进入",
+ "built_in_locked": "内置状态驱动系统行为,不能编辑或归档,但可以调整顺序。"
},
"quick_actions": {
"title": "快捷操作",
@@ -138,7 +135,6 @@
"toast_saved": "更改已保存"
},
"preferences": {
- "general_title": "常规",
"theme": {
"title": "主题",
"light": "浅色",
@@ -155,10 +151,12 @@
"sync_failed": "语言已在本设备保存,但同步到账号失败。其他设备可能仍显示旧语言。"
},
"timezone": {
- "title": "查看时区",
+ "title": "时区",
"browser_suffix": "(浏览器)",
"hint": "用于所有工作区的日期和图表。",
- "sync_failed": "保存时区偏好失败。"
+ "sync_failed": "保存时区偏好失败。",
+ "search": "搜索时区...",
+ "empty": "没有匹配的时区"
},
"sticky_comment_bar": {
"title": "固定底部评论栏"
@@ -169,10 +167,16 @@
"after_run": "本轮结束后开始",
"hint": "只决定默认选项,每条消息发送前仍可单独修改。"
},
- "issue_title": "任务创建",
- "comments_title": "评论",
- "device_hint": "保存在当前设备上。",
- "issue_scope": "这些偏好仅对当前设备上的当前工作区生效,只影响创建任务时显示的字段。"
+ "comments_title": "评论与聊天",
+ "region_title": "语言与地区",
+ "appearance_title": "外观",
+ "issue_fields_title": "创建任务时显示的字段",
+ "issue_fields": {
+ "field": "字段",
+ "quick": "智能体创建",
+ "manual": "手动创建",
+ "unsupported": "智能体创建时不支持此字段"
+ }
},
"shortcuts": {
"title": "快捷键",
@@ -307,14 +311,11 @@
}
},
"chat": {
- "floating_title": "悬浮窗",
"floating_label": "悬浮聊天窗",
"floating_hint": "在每个页面显示悬浮聊天按钮。"
},
"issue": {
"description": "选择各创建方式的工具栏中常驻显示的字段。隐藏的字段仍可从 ⋯ 菜单使用,有值时会自动显示。",
- "quick_create_title": "智能体创建工具栏字段",
- "manual_create_title": "手动创建工具栏字段",
"fields": {
"status": "状态",
"priority": "优先级",
@@ -326,7 +327,6 @@
}
},
"mcp": {
- "title": "MCP",
"description": "添加后需在智能体的 MCP 页面分配。",
"servers_title": "共享 MCP Server",
"write_only_note": "为保护敏感信息,配置保存后不会再次显示。需要调整时,请填写一份完整的新配置;只修改名称不会影响当前配置和智能体分配。",
@@ -343,7 +343,6 @@
"remove_action": "删除",
"empty_title": "暂无共享 MCP Server",
"disabled_badge": "已禁用",
- "admin_only_note": "只有工作区 owner 和 admin 可以管理共享 MCP Server。",
"delete_title": "移除共享 MCP Server?",
"delete_description": "这会将 {{name}} 从工作区服务库和所有已分配的智能体中移除,从各智能体的下一次运行起生效。",
"delete_confirm": "移除",
@@ -365,40 +364,42 @@
"preferences": "偏好设置",
"shortcuts": "快捷键",
"issue": "任务",
- "chat": "聊天",
"notifications": "通知",
"tokens": "API Token",
"general": "常规",
- "repositories": "代码仓库",
"github": "GitHub",
- "integrations": "集成",
"labs": "实验室",
"members": "成员",
"labels": "标签",
"issue_statuses": "任务状态",
"properties": "属性",
"quick_actions": "快捷操作",
- "plugins": "Plugins",
- "mcp": "MCP",
- "billing": "账单与套餐"
+ "plugins": "插件",
+ "mcp": "MCP 服务器",
+ "billing": "账单与套餐",
+ "code": "代码",
+ "channels": "消息渠道",
+ "apps": "已连接应用"
},
"groups": {
- "personal": "个人设置",
- "workspace": "工作区管理",
- "issues": "任务配置",
+ "personal": "个人",
+ "workspace": "工作区",
+ "issues": "任务与工作流",
"connections": "连接与扩展",
- "device": "桌面应用"
+ "device": "本设备"
},
"navigate": "前往设置页面",
- "device_scope": "当前设备"
+ "search": "搜索设置",
+ "search_clear": "清除搜索",
+ "search_empty": "没有匹配的设置",
+ "search_results_other": "{{count}} 个结果",
+ "admin_only": "只有所有者和管理员可以修改"
},
"plugins": {
- "title": "Plugins",
+ "title": "插件",
"loading": "正在加载 Plugins",
"load_failed": "无法加载 Plugins",
"load_failed_description": "请重试。已安装的 Plugin 不受影响。",
- "read_only": "只读访问",
- "read_only_description": "工作区 owner 和 admin 可以安装、配置和移除 Plugin。",
"empty": "还没有安装任何 Plugin。",
"action_failed": "Plugin 操作失败",
"enabled": "Plugin 已启用",
@@ -608,9 +609,7 @@
"profile_description_too_long": "资料过长(最多 {{max}} 字符,当前 {{count}})。",
"save": "更新资料",
"saving": "更新中...",
- "toast_avatar_updated": "头像已更新",
"toast_avatar_failed": "上传头像失败",
- "toast_profile_updated": "资料已更新",
"toast_profile_failed": "更新资料失败"
},
"notifications": {
@@ -704,25 +703,20 @@
},
"workspace": {
"section_general": "工作区信息",
- "logo_label": "工作区标志",
+ "logo_label": "工作区图标",
"change_logo_aria": "更换工作区图标",
"click_logo_hint": "点击图标上传新图片",
- "toast_logo_updated": "工作区图标已更新",
"toast_logo_failed": "上传工作区图标失败",
"name_label": "名称",
"description_label": "描述",
"description_placeholder": "这个工作区主要做什么?",
- "context_label": "上下文",
+ "context_label": "智能体上下文",
"context_placeholder": "供工作区中的智能体参考的背景信息和上下文",
"slug_label": "Slug",
"issue_prefix_label": "任务前缀",
"issue_prefix_hint": "用于任务编号,例如 {{example}}。",
- "prefix_confirm_title": "确认修改任务前缀?",
- "prefix_confirm_description": "所有任务将从 {{oldPrefix}}-N 重命名为 {{newPrefix}}-N。任何使用旧编号的外部引用——PR 标题、分支名、文档与聊天中的链接——都会失效。",
"save": "保存",
"saving": "保存中...",
- "manage_hint": "只有管理员和所有者可以修改工作区设置。",
- "toast_saved": "已保存工作区设置",
"toast_save_failed": "保存工作区设置失败",
"danger_zone": "危险操作",
"leave_title": "离开工作区",
@@ -740,7 +734,18 @@
"deleting": "删除中...",
"toast_delete_failed": "删除工作区失败",
"confirm_cancel": "取消",
- "confirm_action": "确认"
+ "confirm_action": "确认",
+ "context_hint": "每次运行都会提供给这个工作区里的智能体。",
+ "slug_hint": "用于所有工作区链接,创建后不能修改。",
+ "copy_slug": "复制 slug",
+ "copy_failed": "复制失败",
+ "change_prefix": "修改前缀...",
+ "prefix_dialog_title": "修改任务前缀",
+ "prefix_dialog_description": "所有任务都会重新编号,包括已完成和已取消的任务。",
+ "prefix_new_label": "新前缀",
+ "prefix_rule": "只能使用字母和数字,最多 10 个字符。",
+ "prefix_confirm_action": "修改为 {{prefix}}",
+ "prefix_external_warning": "PR 标题、分支名、文档和聊天里的旧编号(如 {{oldExample}})不会自动更新,这些链接会失效。"
},
"delete_workspace_dialog": {
"title": "删除工作区",
@@ -757,15 +762,10 @@
"toast_failed": "更新设置失败"
},
"github": {
- "section_master": "启用 GitHub 功能",
- "master_description_on": "关闭后暂停 GitHub 功能,保留已有数据。",
"master_description_off": "GitHub 功能已暂停,已有数据保留。",
- "section_connection": "连接",
- "connection_title": "GitHub App",
"connected_to": "已连接到 {{login}}",
"connect_github": "连接 GitHub",
"connect_opening": "正在打开…",
- "connect_disabled_tooltip": "服务端未配置 GitHub App",
"disconnect": "断开",
"disconnecting": "断开中...",
"disconnect_confirm_title": "断开 GitHub App",
@@ -774,28 +774,26 @@
"disconnect_confirm_action": "断开",
"not_configured": "当前部署没有配置 GitHub 集成。运维需要设置",
"not_configured_and": "和",
- "read_only_hint": "只读视图。只有管理员和所有者可以连接或断开 GitHub。",
"contact_admin_to_connect": "当前工作区尚未连接 GitHub。请让管理员或所有者完成 GitHub App 的配置。",
"connected_by": "由 {{name}} 连接",
"toast_not_configured": "当前部署未配置 GitHub 集成",
"toast_open_failed": "打开 GitHub 安装页失败",
"toast_disconnect_failed": "断开 GitHub App 失败",
"toast_disconnected": "已断开 GitHub App",
- "section_features": "功能",
"feature_pr_sidebar_label": "Pull Request 侧栏",
"feature_pr_sidebar_description": "在任务详情侧栏中展示关联的 Pull Request。",
"feature_co_author_label": "Co-authored-by trailer",
"feature_co_author_description_prefix": "在智能体提交的 commit 中追加",
"feature_co_author_description_suffix": "。",
"feature_auto_link_label": "任务 ↔ PR 自动关联",
- "section_repositories": "代码仓库",
- "repositories_shortcut_label": "仓库 URL 仍在\"代码仓库\"标签页中管理",
- "repositories_shortcut_link": "前往管理 →",
"toast_failed": "更新 GitHub 设置失败",
- "feature_auto_link_description": "PR 标题或分支名含任务编号(如 {{example}}),或正文里写了 \"Closes {{example}}\" 时,自动关联到对应任务。"
+ "feature_auto_link_description": "PR 标题或分支名含任务编号(如 {{example}}),或正文里写了 \"Closes {{example}}\" 时,自动关联到对应任务。",
+ "status_paused": "已暂停",
+ "pause": "暂停 GitHub 功能",
+ "resume": "恢复 GitHub 功能"
},
"vcs": {
- "section_title": "Git 代码托管(自托管)",
+ "section_title": "自托管 Git",
"page_description": "连接自托管的 Forgejo、Gitea 或 GitLab 实例,将 Pull Request 镜像到任务上。每个连接使用一个访问令牌;智能体使用运行时自身的 Git 凭据推送分支并创建 PR。",
"connect_title": "连接代码托管实例",
"connected_as": "已以 {{login}} 身份连接",
@@ -822,7 +820,6 @@
"disconnect_confirm_description": "该连接镜像的 Pull Request 及其任务关联将被移除。此操作无法撤销。",
"disconnect_confirm_cancel": "取消",
"disconnect_confirm_action": "断开",
- "toast_connected": "已连接代码托管",
"toast_connect_failed": "无法连接代码托管",
"toast_disconnected": "已断开代码托管连接",
"toast_disconnect_failed": "断开连接失败",
@@ -832,8 +829,11 @@
"rotate_confirm_cancel": "取消",
"rotate_confirm_action": "重新生成",
"rotating": "重新生成中…",
- "toast_rotated": "已重新生成 Webhook 密钥",
- "toast_rotate_failed": "重新生成 Webhook 密钥失败"
+ "toast_rotate_failed": "重新生成 Webhook 密钥失败",
+ "hosts_hint": "GitLab、Gitea 或 Forgejo。",
+ "connect_another": "再连接一个",
+ "connection_actions": "{{url}} 的操作",
+ "webhook_done": "我已保存"
},
"lark": {
"section_title": "飞书",
@@ -911,7 +911,6 @@
"install_error_generic": "安装失败,请重试。"
},
"composio": {
- "section_title": "Composio",
"page_description": "连接智能体可使用的应用。",
"not_enabled_title": "Composio 集成未启用",
"not_enabled_description_prefix": "在服务器上设置",
@@ -1141,7 +1140,6 @@
"section_title": "代码仓库",
"description": "智能体可使用这些仓库处理代码。",
"url_placeholder": "https://git.example.com/org/repo.git 或 [email protected]:org/repo.git",
- "url_empty": "(空 URL)",
"description_placeholder": "描述(例如:Go 后端 + Next.js 前端)",
"add": "添加仓库",
"connect_github": "连接 GitHub",
@@ -1164,21 +1162,26 @@
"github_selected_count": "已选择 {{count}} 个",
"github_cancel": "取消",
"github_import": "添加仓库",
- "complete_manual_entry_first": "请先补全或删除空的手动仓库配置,再从 GitHub 导入。",
"save": "保存",
"saving": "保存中...",
"saved_hint": "所有改动已保存",
"empty": "暂无仓库。",
"edit_aria": "编辑仓库",
"cancel_aria": "取消编辑",
- "delete_aria": "删除仓库",
"delete_confirm_title": "删除代码仓库?",
"delete_confirm_description": "此代码仓库将立即从工作区中移除。",
"delete_confirm_cancel": "取消",
"delete_confirm_action": "删除仓库",
"manage_hint": "只有管理员和所有者可以管理代码仓库。",
- "toast_saved": "已保存代码仓库",
- "toast_save_failed": "保存代码仓库失败"
+ "toast_save_failed": "保存代码仓库失败",
+ "add_manually": "输入 URL...",
+ "add_title": "添加仓库",
+ "edit_title": "编辑仓库",
+ "edit": "编辑",
+ "url_label": "仓库 URL",
+ "description_label": "描述",
+ "duplicate": "这个仓库已经添加过了。",
+ "actions_aria": "{{url}} 的操作"
},
"desktop": {
"tabs": {
@@ -1270,7 +1273,6 @@
}
},
"members": {
- "section_title": "成员({{count}})",
"invite_title": "邀请成员",
"invite_email_placeholder": "[email protected]",
"invite_button": "邀请",
@@ -1287,9 +1289,6 @@
"seat_purchase_timeout": "席位购买已提交,但确认时间超出预期。邀请尚未发送;请在“账单”显示有可用席位后重新邀请。",
"seat_purchase_capacity_taken": "新购买的席位已不可用,因此没有发送邀请。请检查当前席位后重试。",
"no_members": "未找到成员。",
- "pending_title": "待处理邀请({{count}})",
- "pending_status": "待处理",
- "revoke_invitation_tooltip": "撤销邀请",
"revoke_invitation_title": "撤销邀请",
"revoke_invitation_description": "撤销发给 {{email}} 的邀请?对方将不能再加入该工作区。",
"toast_invitation_revoked": "已撤销邀请",
@@ -1320,9 +1319,6 @@
"description": "创建并处理任务"
}
},
- "share_links_title": "分享链接",
- "role_field": "角色:",
- "expiry_field": "有效期:",
"share_links_create_title": "创建分享链接",
"share_links_create_button": "生成",
"share_links_creating": "生成中...",
@@ -1339,26 +1335,69 @@
"expiry_24h": "24 小时",
"expiry_7d": "7 天",
"expiry_30d": "30 天",
- "expiry_never": "永久有效"
+ "expiry_never": "永久有效",
+ "members_label": "成员",
+ "pending_label": "待接受邀请",
+ "share_links_label": "分享链接",
+ "share_links_description": "拿到链接的人都可以以所选角色加入,直到链接过期或被撤销。",
+ "search_placeholder": "搜索姓名或邮箱",
+ "no_results": "没有匹配的成员。",
+ "no_invitations": "没有待接受的邀请。",
+ "no_share_links": "还没有分享链接。",
+ "email_label": "邮箱",
+ "role_label": "角色",
+ "expiry_label": "有效期",
+ "you": "你",
+ "joined": "{{date}} 加入",
+ "member_actions": "{{name}} 的操作",
+ "invitation_meta": "{{sent}} 发送 · {{expires}} 过期",
+ "revoke_invitation_aria": "撤销发给 {{email}} 的邀请",
+ "seats_used": "已用 {{used}} / {{purchased}} 个席位",
+ "manage_seats": "管理席位"
},
"integrations": {
- "code_title": "代码与仓库",
- "messaging_title": "消息渠道",
- "apps_title": "我的应用连接",
- "apps_scope": "这些应用连接属于你的账号。工作区的消息渠道连接在上方管理。",
- "github_hint": "连接 GitHub,配置拉取请求关联。",
- "vcs_hint": "连接 GitLab、Gitea 或 Forgejo。",
- "apps_hint": "通过 Composio 为智能体授权应用。",
- "back": "全部集成",
"status_connected": "已连接",
"status_not_connected": "未连接",
"status_loading": "正在检查...",
- "status_unknown": "状态暂不可用",
- "channel_hint": "在 {{channel}} 中与智能体对话、创建任务。"
+ "status_unknown": "状态暂不可用"
},
"pr_merge_status": {
"label": "PR 合并后,任务状态改为",
"description": "关联的 PR 全部合并后生效,只影响之后合并的 PR。",
"none": "不改变"
+ },
+ "layout": {
+ "scope": {
+ "account": "账号 · 所有设备同步",
+ "device": "仅本设备",
+ "device_workspace": "仅本设备 · {{name}}",
+ "workspace": "{{name}} 工作区",
+ "workspace_only": "仅对 {{name}} 生效"
+ },
+ "read_only": {
+ "title": "你只能查看此页",
+ "description": "只有工作区所有者和管理员可以修改这些设置。",
+ "contact": "只有所有者和管理员可以修改这些设置。如需修改,请联系 {{names}}。",
+ "separator": "、"
+ }
+ },
+ "code": {
+ "hosting_title": "代码托管",
+ "pr_linking_title": "PR 与任务联动",
+ "github_actions": "GitHub 操作"
+ },
+ "channels": {
+ "breadcrumb": "路径"
+ },
+ "mcp_usage": {
+ "agent_count_other": "已分配给 {{count}} 个智能体",
+ "none": "未分配给任何智能体"
+ },
+ "mcp_sources": {
+ "title": "为智能体接入工具的方式",
+ "current": "当前页面",
+ "mcp": "由管理员添加、在工作区内共享,再按智能体分配。",
+ "apps": "用你自己的账号通过 Composio 授权,在你拥有的智能体上启用。",
+ "plugins": "安装后可提供工具、定时 hook 和存储,每个插件单独授权。"
}
}
diff --git a/packages/views/locales/zh-Hans/skills.json b/packages/views/locales/zh-Hans/skills.json
index 123bfd2ac5..87bbd264fd 100644
--- a/packages/views/locales/zh-Hans/skills.json
+++ b/packages/views/locales/zh-Hans/skills.json
@@ -112,7 +112,9 @@
"sort_by": "排序",
"direction_asc": "升序",
"direction_desc": "降序",
- "section_columns": "显示列"
+ "section_columns": "显示列",
+ "manage_labels": "管理标签...",
+ "manage_labels_title": "Skill 标签"
},
"detail": {
"all_skills": "全部 skill",
diff --git a/packages/views/settings/components/account-tab.tsx b/packages/views/settings/components/account-tab.tsx
index 88976bf811..38056e55c9 100644
--- a/packages/views/settings/components/account-tab.tsx
+++ b/packages/views/settings/components/account-tab.tsx
@@ -77,10 +77,6 @@ export function AccountTab() {
value: draft,
savedValue: savedDraft,
onSave: saveProfile,
- onSuccess: () =>
- toast.success(t(($) => $.account.toast_profile_updated), {
- id: "settings-auto-save",
- }),
onError: (error) =>
toast.error(
error instanceof Error
@@ -92,7 +88,7 @@ export function AccountTab() {
});
return (
- <SettingsTab title={t(($) => $.page.tabs.profile)}>
+ <SettingsTab title={t(($) => $.page.tabs.profile)} scope="account">
<SettingsSection
title={t(($) => $.account.section_profile)}
action={
@@ -106,6 +102,7 @@ export function AccountTab() {
>
<SettingsCard>
<SettingsRow
+ anchor="avatar"
label={t(($) => $.account.avatar_label)}
description={t(($) => $.account.click_avatar_hint)}
size="none"
@@ -120,9 +117,6 @@ export function AccountTab() {
try {
const updated = await api.updateMe({ avatar_url: url });
setUser(updated);
- toast.success(t(($) => $.account.toast_avatar_updated), {
- id: "settings-auto-save",
- });
} catch (error) {
toast.error(
error instanceof Error
@@ -136,6 +130,7 @@ export function AccountTab() {
</SettingsRow>
<SettingsRow
+ anchor="name"
label={t(($) => $.account.name_label)}
size="text"
>
@@ -151,6 +146,7 @@ export function AccountTab() {
</SettingsRow>
<SettingsRow
+ anchor="about"
label={t(($) => $.account.profile_description_label)}
description={t(($) => $.account.profile_description_hint)}
size="text"
diff --git a/packages/views/settings/components/billing-tab.tsx b/packages/views/settings/components/billing-tab.tsx
index 2cde529ae7..408930cca8 100644
--- a/packages/views/settings/components/billing-tab.tsx
+++ b/packages/views/settings/components/billing-tab.tsx
@@ -747,6 +747,7 @@ function BillingTabContent() {
return (
<SettingsTab
title={t(($) => $.workspace.title)}
+ scope="workspace"
>
<SettingsCard>
<div
@@ -766,6 +767,7 @@ function BillingTabContent() {
return (
<SettingsTab
title={t(($) => $.workspace.title)}
+ scope="workspace"
>
<Alert variant="destructive">
<AlertCircle />
@@ -858,6 +860,7 @@ function BillingTabContent() {
return (
<SettingsTab
title={t(($) => $.workspace.title)}
+ scope="workspace"
>
{returnResult === "cancel" ? (
<Alert>
diff --git a/packages/views/settings/components/browser-notification-setting.tsx b/packages/views/settings/components/browser-notification-setting.tsx
index e4adcba5dd..a9f1ce4b36 100644
--- a/packages/views/settings/components/browser-notification-setting.tsx
+++ b/packages/views/settings/components/browser-notification-setting.tsx
@@ -50,6 +50,7 @@ export function BrowserNotificationSetting() {
return (
<SettingsCard>
<SettingsRow
+ anchor="browser"
label={t(($) => $.notifications.browser.label)}
description={statusHint}
>
diff --git a/packages/views/settings/components/channels-tab.test.tsx b/packages/views/settings/components/channels-tab.test.tsx
new file mode 100644
index 0000000000..f323babcd9
--- /dev/null
+++ b/packages/views/settings/components/channels-tab.test.tsx
@@ -0,0 +1,105 @@
+import { beforeEach, describe, expect, it, vi } from "vitest";
+import { fireEvent, screen } from "@testing-library/react";
+import { renderWithI18n } from "../../test/i18n";
+
+const state = vi.hoisted(() => ({
+ search: "",
+ connectionError: false,
+ pending: false,
+ // The IM channels keep revoked rows for audit, so the fixture carries a real
+ // status — a row without one is not evidence of a live connection (#8496).
+ installationStatus: "active" as string,
+ push: vi.fn(),
+}));
+vi.mock("../../navigation/context", async (importOriginal) => ({
+ ...(await importOriginal<typeof import("../../navigation/context")>()),
+ useNavigation: () => ({
+ pathname: "/acme/settings",
+ searchParams: new URLSearchParams(state.search),
+ push: state.push,
+ }),
+}));
+vi.mock("@multica/core/hooks", () => ({ useWorkspaceId: () => "ws-1" }));
+vi.mock("@multica/core/paths", () => ({
+ useCurrentWorkspace: () => ({ id: "ws-1", name: "Acme" }),
+}));
+vi.mock("@multica/core/permissions", () => ({
+ useCurrentMember: () => ({ member: { role: "admin" } }),
+}));
+vi.mock("@tanstack/react-query", () => ({
+ queryOptions: <T,>(opts: T) => opts,
+ useQuery: (opts: { select?: (data: unknown) => unknown }) => ({
+ data: opts.select?.({
+ installations: [{ id: "one", status: state.installationStatus }],
+ }),
+ isPending: state.pending,
+ isError: state.connectionError,
+ }),
+}));
+vi.mock("./lark-tab", () => ({ LarkTab: () => <div>Lark detail</div> }));
+vi.mock("./slack-tab", () => ({ SlackTab: () => <div>Slack detail</div> }));
+vi.mock("./dingtalk-tab", () => ({ DingTalkTab: () => <div>DingTalk detail</div> }));
+vi.mock("./wecom-tab", () => ({ WecomTab: () => <div>WeCom detail</div> }));
+vi.mock("./telegram-tab", () => ({ TelegramTab: () => <div>Telegram detail</div> }));
+
+import { ChannelsTab } from "./channels-tab";
+
+beforeEach(() => {
+ state.search = "tab=channels";
+ state.connectionError = false;
+ state.pending = false;
+ state.installationStatus = "active";
+ state.push.mockClear();
+});
+
+describe("ChannelsTab", () => {
+ it("lists only messaging channels, each with its own mark and status", () => {
+ renderWithI18n(<ChannelsTab />);
+
+ expect(screen.getByRole("link", { name: /Slack Connected/ })).toBeInTheDocument();
+ expect(screen.queryByRole("link", { name: /GitHub/ })).toBeNull();
+ expect(screen.queryByRole("link", { name: /Composio/ })).toBeNull();
+ expect(screen.queryByText("Slack detail")).toBeNull();
+ const shapes = ["lark", "slack", "dingtalk", "wecom", "telegram"].map(
+ (channel) => screen.getByTestId(`integration-channel-icon-${channel}`).innerHTML,
+ );
+ expect(new Set(shapes).size).toBe(5);
+
+ fireEvent.click(screen.getByRole("link", { name: /Slack Connected/ }));
+ expect(state.push).toHaveBeenCalledWith("/acme/settings?tab=channels&integration=slack");
+ });
+
+ it("does not report a revoked bot as connected", () => {
+ state.installationStatus = "revoked";
+ renderWithI18n(<ChannelsTab />);
+ expect(screen.getByRole("link", { name: /Slack Not connected/ })).toBeInTheDocument();
+ });
+
+ it.each([
+ ["pending", "Checking..."],
+ ["error", "Status unavailable"],
+ ] as const)("never reports a %s read as disconnected", (kind, label) => {
+ if (kind === "pending") state.pending = true;
+ else state.connectionError = true;
+ renderWithI18n(<ChannelsTab />);
+ expect(screen.getByRole("link", { name: new RegExp(`Slack ${label}`) })).toBeInTheDocument();
+ });
+
+ it("opens one channel with a breadcrumb back to the list", () => {
+ state.search = "tab=channels&integration=slack";
+ renderWithI18n(<ChannelsTab />);
+
+ expect(screen.getByText("Slack detail")).toBeInTheDocument();
+ expect(screen.queryByText("Lark detail")).toBeNull();
+ expect(screen.getByRole("link", { name: "Messaging" })).toHaveAttribute(
+ "href",
+ "/acme/settings?tab=channels",
+ );
+ });
+
+ it("opens the retired Lark bookmark on the Lark page", () => {
+ state.search = "tab=lark";
+ renderWithI18n(<ChannelsTab />);
+ expect(screen.getByText("Lark detail")).toBeInTheDocument();
+ });
+});
diff --git a/packages/views/settings/components/channels-tab.tsx b/packages/views/settings/components/channels-tab.tsx
new file mode 100644
index 0000000000..560860cd02
--- /dev/null
+++ b/packages/views/settings/components/channels-tab.tsx
@@ -0,0 +1,222 @@
+"use client";
+
+import type { ReactNode } from "react";
+import { ChevronRight } from "lucide-react";
+import { useQuery } from "@tanstack/react-query";
+import { useWorkspaceId } from "@multica/core/hooks";
+import { useCurrentMember } from "@multica/core/permissions";
+import { larkInstallationsOptions } from "@multica/core/lark";
+import { slackInstallationsOptions } from "@multica/core/slack";
+import { dingtalkInstallationsOptions } from "@multica/core/dingtalk";
+import { wecomInstallationsOptions } from "@multica/core/wecom";
+import { telegramInstallationsOptions } from "@multica/core/telegram";
+import { cn } from "@multica/ui/lib/utils";
+import { AppLink, useNavigation } from "../../navigation";
+import { useT } from "../../i18n";
+import { LarkTab } from "./lark-tab";
+import { SlackTab } from "./slack-tab";
+import { DingTalkTab } from "./dingtalk-tab";
+import { WecomTab } from "./wecom-tab";
+import { TelegramTab } from "./telegram-tab";
+import { SettingsCard, SettingsTab } from "./settings-layout";
+import { IntegrationChannelIcon } from "./integration-channel-icon";
+import {
+ resolveSettingsLocation,
+ settingsHref,
+ type ChannelIntegration,
+} from "./settings-navigation";
+
+interface ConnectionState {
+ data?: boolean;
+ isPending: boolean;
+ isError: boolean;
+}
+
+interface ChannelEntry {
+ id: ChannelIntegration;
+ label: string;
+ description: string;
+ content: ReactNode;
+ state: ConnectionState;
+}
+
+// The IM channels soft-revoke: the row survives with status 'revoked', so a row
+// count never falls back to zero and would report a torn-down bot as connected
+// forever (#8496).
+const hasActiveInstallation = (data: {
+ installations?: { status: string }[];
+}) => data.installations?.some((inst) => inst.status === "active") ?? false;
+
+/**
+ * Messaging channels: a directory of the chat apps agents can be reached
+ * from, each opening its own detail page. Code hosting lives on the Code page
+ * and account-level app connections on Connected apps.
+ */
+export function ChannelsTab() {
+ const { t } = useT("settings");
+ const navigation = useNavigation();
+ const wsId = useWorkspaceId();
+ const { member } = useCurrentMember(wsId);
+ const canView = !!wsId && !!member;
+
+ // Reuse the detail pages' query caches. Never report a failed or pending
+ // read as disconnected.
+ const lark = useQuery({
+ ...larkInstallationsOptions(wsId),
+ enabled: canView,
+ select: hasActiveInstallation,
+ });
+ const slack = useQuery({
+ ...slackInstallationsOptions(wsId),
+ enabled: canView,
+ select: hasActiveInstallation,
+ });
+ const dingtalk = useQuery({
+ ...dingtalkInstallationsOptions(wsId),
+ enabled: canView,
+ select: hasActiveInstallation,
+ });
+ const wecom = useQuery({
+ ...wecomInstallationsOptions(wsId),
+ enabled: canView,
+ select: hasActiveInstallation,
+ });
+ const telegram = useQuery({
+ ...telegramInstallationsOptions(wsId),
+ enabled: canView,
+ select: hasActiveInstallation,
+ });
+ const channels: ChannelEntry[] = [
+ {
+ id: "lark",
+ label: t(($) => $.lark.section_title),
+ description: t(($) => $.lark.page_description),
+ content: <LarkTab />,
+ state: lark,
+ },
+ {
+ id: "slack",
+ label: t(($) => $.slack.section_title),
+ description: t(($) => $.slack.page_description),
+ content: <SlackTab />,
+ state: slack,
+ },
+ {
+ id: "dingtalk",
+ label: t(($) => $.dingtalk.section_title),
+ description: t(($) => $.dingtalk.page_description),
+ content: <DingTalkTab />,
+ state: dingtalk,
+ },
+ {
+ id: "wecom",
+ label: t(($) => $.wecom.section_title),
+ description: t(($) => $.wecom.page_description),
+ content: <WecomTab />,
+ state: wecom,
+ },
+ {
+ id: "telegram",
+ label: t(($) => $.telegram.section_title),
+ description: t(($) => $.telegram.page_description),
+ content: <TelegramTab />,
+ state: telegram,
+ },
+ ];
+ const requested = resolveSettingsLocation(navigation.searchParams).integration;
+ const selected = channels.find((channel) => channel.id === requested);
+ const href = (integration?: string) =>
+ settingsHref(navigation.pathname, navigation.searchParams, "channels", {
+ integration,
+ });
+
+ if (selected) {
+ return (
+ <SettingsTab
+ title={selected.label}
+ description={selected.description}
+ scope="workspace"
+ breadcrumb={
+ <nav
+ aria-label={t(($) => $.channels.breadcrumb)}
+ className="flex items-center gap-1.5 text-caption text-muted-foreground"
+ >
+ <AppLink
+ href={href()}
+ className="rounded-sm hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring"
+ >
+ {t(($) => $.page.tabs.channels)}
+ </AppLink>
+ <ChevronRight aria-hidden="true" className="size-3" />
+ <span aria-current="page" className="text-foreground">
+ {selected.label}
+ </span>
+ </nav>
+ }
+ >
+ {selected.content}
+ </SettingsTab>
+ );
+ }
+
+ return (
+ <SettingsTab title={t(($) => $.page.tabs.channels)} scope="workspace">
+ <SettingsCard>
+ {channels.map((channel) => (
+ <AppLink
+ key={channel.id}
+ href={href(channel.id)}
+ className="group flex items-center gap-4 px-4 py-4 first:rounded-t-xl last:rounded-b-xl hover:bg-surface-hover focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring"
+ >
+ <span
+ aria-hidden="true"
+ className="flex size-10 shrink-0 items-center justify-center rounded-xl border border-surface-border bg-background text-foreground"
+ >
+ <IntegrationChannelIcon channel={channel.id} />
+ </span>
+ <span className="min-w-0 flex-1">
+ <span className="flex flex-wrap items-center gap-x-3 gap-y-1">
+ <span className="text-body font-medium text-foreground">
+ {channel.label}
+ </span>{" "}
+ <ConnectionBadge state={channel.state} />
+ </span>
+ <span className="mt-1 block text-caption leading-5 text-muted-foreground">
+ {channel.description}
+ </span>
+ </span>
+ <ChevronRight
+ className="size-4 shrink-0 text-muted-foreground group-hover:text-foreground"
+ aria-hidden="true"
+ />
+ </AppLink>
+ ))}
+ </SettingsCard>
+ </SettingsTab>
+ );
+}
+
+export function ConnectionBadge({ state }: { state: ConnectionState }) {
+ const { t } = useT("settings");
+ const connected = !state.isError && !state.isPending && state.data === true;
+ const label = state.isError
+ ? t(($) => $.integrations.status_unknown)
+ : state.isPending
+ ? t(($) => $.integrations.status_loading)
+ : connected
+ ? t(($) => $.integrations.status_connected)
+ : t(($) => $.integrations.status_not_connected);
+ return (
+ <span
+ className={cn(
+ "inline-flex items-center gap-1.5 text-caption",
+ connected ? "text-success" : "text-muted-foreground",
+ )}
+ >
+ {connected && (
+ <span aria-hidden="true" className="size-1.5 rounded-full bg-success" />
+ )}
+ {label}
+ </span>
+ );
+}
diff --git a/packages/views/settings/components/chat-tab.tsx b/packages/views/settings/components/chat-tab.tsx
deleted file mode 100644
index a1c2505a16..0000000000
--- a/packages/views/settings/components/chat-tab.tsx
+++ /dev/null
@@ -1,50 +0,0 @@
-"use client";
-
-import { Switch } from "@multica/ui/components/ui/switch";
-import { useChatStore } from "@multica/core/chat";
-import { toast } from "sonner";
-import { useT } from "../../i18n";
-import { SettingsCard, SettingsRow, SettingsSection } from "./settings-layout";
-
-/**
- * Chat preferences. Currently just the
- * floating-window toggle: when off, the FAB / overlay never mount and Chat
- * is reachable only from its dedicated tab. It is on by default. The preference is
- * a persisted client setting (`floatingChatEnabled`), so it applies
- * immediately without a round-trip.
- */
-export function ChatTab() {
- const { t } = useT("settings");
- const enabled = useChatStore((s) => s.floatingChatEnabled);
- const setEnabled = useChatStore((s) => s.setFloatingChatEnabled);
-
- return (
- <div className="space-y-6">
- <p className="text-caption text-muted-foreground">
- {t(($) => $.preferences.device_hint)}
- </p>
- <SettingsSection title={t(($) => $.chat.floating_title)}>
- <SettingsCard>
- <SettingsRow
- label={t(($) => $.chat.floating_label)}
- description={t(($) => $.chat.floating_hint)}
- >
- <Switch
- checked={enabled}
- onCheckedChange={(checked) => {
- setEnabled(checked);
- toast.success(
- t(($) => $.auto_save.toast_saved),
- {
- id: "settings-auto-save",
- },
- );
- }}
- aria-label={t(($) => $.chat.floating_label)}
- />
- </SettingsRow>
- </SettingsCard>
- </SettingsSection>
- </div>
- );
-}
diff --git a/packages/views/settings/components/code-host.tsx b/packages/views/settings/components/code-host.tsx
new file mode 100644
index 0000000000..d1ea44004f
--- /dev/null
+++ b/packages/views/settings/components/code-host.tsx
@@ -0,0 +1,36 @@
+import type { ReactNode } from "react";
+import { cn } from "@multica/ui/lib/utils";
+
+/** The square logo tile code hosts share on this page. */
+export function HostMark({ children }: { children: ReactNode }) {
+ return (
+ <span
+ aria-hidden="true"
+ className="flex size-9 shrink-0 items-center justify-center rounded-lg border border-surface-border bg-background text-foreground"
+ >
+ {children}
+ </span>
+ );
+}
+
+export function HostStatus({
+ tone,
+ label,
+}: {
+ tone: "success" | "muted";
+ label: string;
+}) {
+ return (
+ <span
+ className={cn(
+ "inline-flex items-center gap-1.5 text-caption font-normal",
+ tone === "success" ? "text-success" : "text-muted-foreground",
+ )}
+ >
+ {tone === "success" ? (
+ <span aria-hidden="true" className="size-1.5 rounded-full bg-success" />
+ ) : null}
+ {label}
+ </span>
+ );
+}
diff --git a/packages/views/settings/components/code-tab.test.tsx b/packages/views/settings/components/code-tab.test.tsx
new file mode 100644
index 0000000000..fdcd982fbf
--- /dev/null
+++ b/packages/views/settings/components/code-tab.test.tsx
@@ -0,0 +1,275 @@
+import type { ReactNode } from "react";
+import { beforeEach, describe, expect, it, vi } from "vitest";
+import { render, screen, waitFor, within } from "@testing-library/react";
+import userEvent from "@testing-library/user-event";
+import { I18nProvider } from "@multica/core/i18n/react";
+import { configStore } from "@multica/core/config";
+import enCommon from "../../locales/en/common.json";
+import enSettings from "../../locales/en/settings.json";
+
+const mockUpdateWorkspace = vi.hoisted(() => vi.fn());
+const mockDeleteInstallation = vi.hoisted(() => vi.fn());
+const mockGetConnectURL = vi.hoisted(() => vi.fn());
+const mockInvalidate = vi.hoisted(() => vi.fn());
+
+const workspaceRef = vi.hoisted(() => ({
+ current: {
+ id: "workspace-1",
+ name: "Acme",
+ slug: "acme",
+ issue_prefix: "ACM",
+ settings: {} as Record<string, unknown>,
+ },
+}));
+const roleRef = vi.hoisted(() => ({
+ current: "owner" as "owner" | "admin" | "member",
+}));
+const installationsRef = vi.hoisted(() => ({
+ current: {
+ installations: [] as { id: string; account_login: string; connected_by?: string }[],
+ configured: true,
+ can_manage: true as boolean,
+ },
+}));
+
+vi.mock("@tanstack/react-query", () => ({
+ useQuery: (opts: { queryKey: unknown[] }) =>
+ JSON.stringify(opts.queryKey).includes("installations")
+ ? { data: installationsRef.current }
+ : { data: [] },
+ useQueryClient: () => ({ setQueryData: vi.fn(), invalidateQueries: mockInvalidate }),
+ queryOptions: <T,>(opts: T) => opts,
+}));
+vi.mock("@multica/core/hooks", () => ({ useWorkspaceId: () => "workspace-1" }));
+vi.mock("@multica/core/paths", () => ({ useCurrentWorkspace: () => workspaceRef.current }));
+vi.mock("@multica/core/permissions", () => ({
+ useCurrentMember: () => ({
+ role: roleRef.current,
+ member: { role: roleRef.current },
+ isLoading: false,
+ }),
+}));
+vi.mock("@multica/core/workspace/queries", () => ({
+ memberListOptions: () => ({ queryKey: ["members"] }),
+ workspaceKeys: { list: () => ["workspaces"] },
+}));
+vi.mock("@multica/core/github", async () => {
+ const actual = await vi.importActual<typeof import("@multica/core/github")>(
+ "@multica/core/github",
+ );
+ return {
+ ...actual,
+ githubInstallationsOptions: () => ({ queryKey: ["github", "installations"] }),
+ };
+});
+vi.mock("@multica/core/api", () => ({
+ api: {
+ updateWorkspace: mockUpdateWorkspace,
+ deleteGitHubInstallation: mockDeleteInstallation,
+ getGitHubConnectURL: mockGetConnectURL,
+ },
+}));
+vi.mock("sonner", () => ({ toast: { success: vi.fn(), error: vi.fn() } }));
+// The repository list and self-hosted rows have their own tests.
+vi.mock("./repositories-section", () => ({ RepositoriesSection: () => null }));
+vi.mock("./code-vcs", () => ({ VCSConnectionRows: () => <div>VCS rows</div> }));
+// The merge rule editor has its own test on the statuses it offers.
+vi.mock("./pr-merge-status-row", () => ({
+ PRMergeStatusRow: ({ canManage }: { canManage: boolean }) => (
+ <div>{canManage ? "merge rule editable" : "merge rule read-only"}</div>
+ ),
+}));
+
+import { CodeTab } from "./code-tab";
+
+const TEST_RESOURCES = { en: { common: enCommon, settings: enSettings } };
+
+function Wrapper({ children }: { children: ReactNode }) {
+ return (
+ <I18nProvider locale="en" resources={TEST_RESOURCES}>
+ {children}
+ </I18nProvider>
+ );
+}
+
+beforeEach(() => {
+ vi.clearAllMocks();
+ workspaceRef.current = {
+ id: "workspace-1",
+ name: "Acme",
+ slug: "acme",
+ issue_prefix: "ACM",
+ settings: { pr_merge_status: "done" },
+ };
+ roleRef.current = "owner";
+ installationsRef.current = { installations: [], configured: true, can_manage: true };
+ configStore
+ .getState()
+ .setAuthConfig({ allowSignup: true, vcsIntegrationAvailable: false });
+ mockUpdateWorkspace.mockImplementation(async (_id: string, payload: object) => ({
+ ...workspaceRef.current,
+ ...payload,
+ }));
+});
+
+function connect() {
+ installationsRef.current = {
+ installations: [{ id: "inst-1", account_login: "acme", connected_by: "Ada" }],
+ configured: true,
+ can_manage: true,
+ };
+}
+
+describe("CodeTab — GitHub", () => {
+ it("offers to connect GitHub and opens the install flow", async () => {
+ mockGetConnectURL.mockResolvedValue({ configured: true, url: "https://github.com/apps/x" });
+ const open = vi.spyOn(window, "open").mockImplementation(() => null);
+ const user = userEvent.setup();
+ render(<CodeTab />, { wrapper: Wrapper });
+
+ expect(screen.getByText("Not connected")).toBeInTheDocument();
+ await user.click(screen.getByRole("button", { name: "Connect GitHub" }));
+
+ await waitFor(() =>
+ expect(open).toHaveBeenCalledWith("https://github.com/apps/x", "_blank", "noopener"),
+ );
+ open.mockRestore();
+ });
+
+ it("names the account and who connected it", () => {
+ connect();
+ render(<CodeTab />, { wrapper: Wrapper });
+
+ expect(screen.getByText("Connected")).toBeInTheDocument();
+ expect(screen.getByText(/Connected to acme · Connected by Ada/)).toBeInTheDocument();
+ });
+
+ it("pauses GitHub from the row menu, keeping the other settings", async () => {
+ connect();
+ workspaceRef.current.settings = { pr_merge_status: "done", co_authored_by_enabled: false };
+ const user = userEvent.setup();
+ render(<CodeTab />, { wrapper: Wrapper });
+
+ await user.click(screen.getByRole("button", { name: "GitHub actions" }));
+ await user.click(await screen.findByRole("menuitem", { name: "Pause GitHub features" }));
+
+ await waitFor(() => {
+ expect(mockUpdateWorkspace).toHaveBeenCalledWith("workspace-1", {
+ settings: {
+ pr_merge_status: "done",
+ co_authored_by_enabled: false,
+ github_enabled: false,
+ },
+ });
+ });
+ });
+
+ it("disables the PR switches while GitHub is paused", () => {
+ connect();
+ workspaceRef.current.settings = { github_enabled: false };
+ render(<CodeTab />, { wrapper: Wrapper });
+
+ expect(screen.getByText("Paused")).toBeInTheDocument();
+ for (const name of ["Pull Request sidebar", "Auto-link issues and PRs", "Co-authored-by trailer"]) {
+ expect(screen.getByRole("switch", { name })).toHaveAttribute("aria-disabled", "true");
+ }
+ });
+
+ // A pause outlives a disconnect. Resuming must not need an App, or an
+ // unconfigured deployment could never turn Co-authored-by back on.
+ it("resumes paused GitHub features without an installation", async () => {
+ installationsRef.current = { installations: [], configured: false, can_manage: true };
+ workspaceRef.current.settings = { github_enabled: false };
+ const user = userEvent.setup();
+ render(<CodeTab />, { wrapper: Wrapper });
+
+ expect(screen.getByText("Not connected")).toBeInTheDocument();
+ expect(screen.getByText(/GitHub features are paused/)).toBeInTheDocument();
+ await user.click(screen.getByRole("button", { name: "GitHub actions" }));
+ expect(screen.queryByRole("menuitem", { name: "Disconnect" })).toBeNull();
+ await user.click(await screen.findByRole("menuitem", { name: "Resume GitHub features" }));
+
+ await waitFor(() => {
+ expect(mockUpdateWorkspace).toHaveBeenCalledWith("workspace-1", {
+ settings: { github_enabled: true },
+ });
+ });
+ });
+
+ it("disconnects only after confirmation", async () => {
+ connect();
+ mockDeleteInstallation.mockResolvedValue(undefined);
+ const user = userEvent.setup();
+ render(<CodeTab />, { wrapper: Wrapper });
+
+ await user.click(screen.getByRole("button", { name: "GitHub actions" }));
+ await user.click(await screen.findByRole("menuitem", { name: "Disconnect" }));
+ expect(mockDeleteInstallation).not.toHaveBeenCalled();
+ const dialog = await screen.findByRole("alertdialog");
+ await user.click(within(dialog).getByRole("button", { name: "Disconnect" }));
+
+ await waitFor(() =>
+ expect(mockDeleteInstallation).toHaveBeenCalledWith("workspace-1", "inst-1"),
+ );
+ });
+
+ it("shows members the connection read-only and who can change it", () => {
+ connect();
+ roleRef.current = "member";
+ installationsRef.current.can_manage = false;
+ render(<CodeTab />, { wrapper: Wrapper });
+
+ expect(screen.getByRole("note")).toHaveTextContent("View only");
+ expect(screen.queryByRole("button", { name: "GitHub actions" })).toBeNull();
+ expect(screen.getByRole("switch", { name: "Pull Request sidebar" })).toHaveAttribute(
+ "aria-disabled",
+ "true",
+ );
+ });
+});
+
+describe("CodeTab — pull requests", () => {
+ it("saves a PR switch into the workspace settings", async () => {
+ connect();
+ const user = userEvent.setup();
+ render(<CodeTab />, { wrapper: Wrapper });
+
+ await user.click(screen.getByRole("switch", { name: "Co-authored-by trailer" }));
+
+ await waitFor(() => {
+ expect(mockUpdateWorkspace).toHaveBeenCalledWith("workspace-1", {
+ settings: { pr_merge_status: "done", co_authored_by_enabled: false },
+ });
+ });
+ });
+
+ it("uses the workspace prefix in the auto-link example", () => {
+ render(<CodeTab />, { wrapper: Wrapper });
+ expect(screen.getByText(/ACM-123/)).toBeInTheDocument();
+ });
+
+ it("edits the merge rule here, even while GitHub features are paused", () => {
+ connect();
+ workspaceRef.current.settings = { pr_merge_status: "done", github_enabled: false };
+ const { unmount } = render(<CodeTab />, { wrapper: Wrapper });
+ // Self-hosted Git merges follow the same rule, so pausing GitHub keeps it.
+ expect(screen.getByText("merge rule editable")).toBeInTheDocument();
+ unmount();
+
+ roleRef.current = "member";
+ render(<CodeTab />, { wrapper: Wrapper });
+ expect(screen.getByText("merge rule read-only")).toBeInTheDocument();
+ });
+
+ it("lists self-hosted Git only where the deployment supports it", () => {
+ const { unmount } = render(<CodeTab />, { wrapper: Wrapper });
+ expect(screen.queryByText("VCS rows")).toBeNull();
+ unmount();
+
+ configStore
+ .getState()
+ .setAuthConfig({ allowSignup: true, vcsIntegrationAvailable: true });
+ render(<CodeTab />, { wrapper: Wrapper });
+ expect(screen.getByText("VCS rows")).toBeInTheDocument();
+ });
+});
diff --git a/packages/views/settings/components/code-tab.tsx b/packages/views/settings/components/code-tab.tsx
new file mode 100644
index 0000000000..e254279248
--- /dev/null
+++ b/packages/views/settings/components/code-tab.tsx
@@ -0,0 +1,348 @@
+"use client";
+
+import { useState } from "react";
+import { useQuery, useQueryClient } from "@tanstack/react-query";
+import { toast } from "sonner";
+import { MoreHorizontal, Pause, Play, Unplug } from "lucide-react";
+import { Button } from "@multica/ui/components/ui/button";
+import { Switch } from "@multica/ui/components/ui/switch";
+import {
+ AlertDialog,
+ AlertDialogAction,
+ AlertDialogCancel,
+ AlertDialogContent,
+ AlertDialogDescription,
+ AlertDialogFooter,
+ AlertDialogHeader,
+ AlertDialogTitle,
+} from "@multica/ui/components/ui/alert-dialog";
+import {
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuItem,
+ DropdownMenuSeparator,
+ DropdownMenuTrigger,
+} from "@multica/ui/components/ui/dropdown-menu";
+import { useConfigStore } from "@multica/core/config";
+import { useWorkspaceId } from "@multica/core/hooks";
+import { useCurrentMember } from "@multica/core/permissions";
+import { useCurrentWorkspace } from "@multica/core/paths";
+import { workspaceKeys } from "@multica/core/workspace/queries";
+import { deriveGitHubSettings, githubInstallationsOptions } from "@multica/core/github";
+import { api } from "@multica/core/api";
+import type { Workspace } from "@multica/core/types";
+import { useT } from "../../i18n";
+import {
+ SettingsCard,
+ SettingsReadOnlyNotice,
+ SettingsRow,
+ SettingsSection,
+ SettingsTab,
+} from "./settings-layout";
+import { GitHubMark } from "./github-mark";
+import { VCSConnectionRows } from "./code-vcs";
+import { HostMark, HostStatus } from "./code-host";
+import { RepositoriesSection } from "./repositories-section";
+import { PRMergeStatusRow } from "./pr-merge-status-row";
+
+type GitHubSettingsKey =
+ | "github_enabled"
+ | "github_pr_sidebar_enabled"
+ | "co_authored_by_enabled"
+ | "github_auto_link_prs_enabled";
+
+/**
+ * Everything about code: which hosts are connected, which repositories agents
+ * work in, and how pull requests link back to issues. One page, so connecting
+ * GitHub and picking its repositories no longer spans two tabs.
+ */
+export function CodeTab() {
+ const { t } = useT("settings");
+ const workspace = useCurrentWorkspace();
+ const wsId = useWorkspaceId();
+ const qc = useQueryClient();
+ const { role, member } = useCurrentMember(wsId);
+ const isManager = role === "owner" || role === "admin";
+ const vcsAvailable = useConfigStore((s) => s.vcsIntegrationAvailable);
+
+ // Every member can see the installation list (MUL-2413); connect and
+ // disconnect follow the backend's `can_manage` so the UI never offers what
+ // the server would reject.
+ const { data: installationData } = useQuery({
+ ...githubInstallationsOptions(wsId),
+ enabled: !!wsId && !!member,
+ });
+ const installations = installationData?.installations ?? [];
+ const configured = installationData?.configured ?? false;
+ const canManageGitHub = installationData?.can_manage === true;
+ const connected = installations.length > 0;
+ const primaryInstallation = installations[0] ?? null;
+
+ const flags = deriveGitHubSettings(workspace);
+ const [savingKey, setSavingKey] = useState<GitHubSettingsKey | null>(null);
+ const [connecting, setConnecting] = useState(false);
+ const [disconnectTarget, setDisconnectTarget] = useState<string | null>(null);
+ const [disconnecting, setDisconnecting] = useState(false);
+
+ async function persistSetting(key: GitHubSettingsKey, next: boolean) {
+ if (!workspace || savingKey) return;
+ setSavingKey(key);
+ try {
+ const merged = {
+ ...((workspace.settings as Record<string, unknown>) ?? {}),
+ [key]: next,
+ };
+ const updated = await api.updateWorkspace(workspace.id, { settings: merged });
+ qc.setQueryData(workspaceKeys.list(), (old: Workspace[] | undefined) =>
+ old?.map((ws) => (ws.id === updated.id ? updated : ws)),
+ );
+ } catch (e) {
+ toast.error(e instanceof Error ? e.message : t(($) => $.github.toast_failed));
+ } finally {
+ setSavingKey(null);
+ }
+ }
+
+ async function handleConnect() {
+ setConnecting(true);
+ try {
+ const resp = await api.getGitHubConnectURL(wsId);
+ if (!resp.configured || !resp.url) {
+ toast.error(t(($) => $.github.toast_not_configured));
+ return;
+ }
+ window.open(resp.url, "_blank", "noopener");
+ } catch (e) {
+ toast.error(e instanceof Error ? e.message : t(($) => $.github.toast_open_failed));
+ } finally {
+ setConnecting(false);
+ }
+ }
+
+ async function handleDisconnect() {
+ if (!disconnectTarget || disconnecting) return;
+ setDisconnecting(true);
+ try {
+ await api.deleteGitHubInstallation(wsId, disconnectTarget);
+ await qc.invalidateQueries({ queryKey: ["github", wsId] });
+ toast.success(t(($) => $.github.toast_disconnected));
+ setDisconnectTarget(null);
+ } catch (e) {
+ toast.error(e instanceof Error ? e.message : t(($) => $.github.toast_disconnect_failed));
+ } finally {
+ setDisconnecting(false);
+ }
+ }
+
+ if (!workspace) return null;
+
+ const githubStatus = !connected
+ ? { tone: "muted" as const, label: t(($) => $.integrations.status_not_connected) }
+ : flags.enabled
+ ? { tone: "success" as const, label: t(($) => $.integrations.status_connected) }
+ : { tone: "muted" as const, label: t(($) => $.github.status_paused) };
+
+ // Pausing is a workspace setting, not part of the installation: it outlives
+ // a disconnect, so the note shows whether or not an App is connected.
+ const pausedNote = !flags.enabled ? (
+ <span className="block">{t(($) => $.github.master_description_off)}</span>
+ ) : null;
+ const githubDetail = connected ? (
+ <>
+ {t(($) => $.github.connected_to, {
+ login: installations.map((i) => i.account_login).join(", "),
+ })}
+ {primaryInstallation?.connected_by
+ ? ` · ${t(($) => $.github.connected_by, { name: primaryInstallation.connected_by })}`
+ : null}
+ {pausedNote}
+ </>
+ ) : !canManageGitHub ? (
+ <>
+ {t(($) => $.github.contact_admin_to_connect)}
+ {pausedNote}
+ </>
+ ) : !configured ? (
+ <>
+ {t(($) => $.github.not_configured)}{" "}
+ <code className="rounded-xs bg-muted px-1 py-0.5 text-micro">GITHUB_APP_SLUG</code>{" "}
+ {t(($) => $.github.not_configured_and)}{" "}
+ <code className="rounded-xs bg-muted px-1 py-0.5 text-micro">GITHUB_WEBHOOK_SECRET</code>
+ {pausedNote}
+ </>
+ ) : (
+ pausedNote
+ );
+
+ const featureDisabled = (key: GitHubSettingsKey) =>
+ !canManageGitHub || !flags.enabled || savingKey === key;
+
+ return (
+ <SettingsTab title={t(($) => $.page.tabs.code)} scope="workspace">
+ {member && !isManager ? <SettingsReadOnlyNotice wsId={wsId} /> : null}
+
+ <SettingsSection title={t(($) => $.code.hosting_title)} anchor="code-hosting">
+ <SettingsCard>
+ <SettingsRow
+ anchor="github"
+ label={
+ <span className="flex min-w-0 items-center gap-3">
+ <HostMark>
+ <GitHubMark className="size-4" />
+ </HostMark>
+ <span className="flex min-w-0 flex-wrap items-center gap-x-2">
+ {t(($) => $.page.tabs.github)}
+ <HostStatus tone={githubStatus.tone} label={githubStatus.label} />
+ </span>
+ </span>
+ }
+ description={githubDetail ? <span className="block pl-12">{githubDetail}</span> : undefined}
+ >
+ {canManageGitHub ? (
+ <span className="flex items-center gap-1">
+ {connected ? null : (
+ <Button
+ variant="outline"
+ size="sm"
+ onClick={handleConnect}
+ disabled={connecting || !configured}
+ aria-busy={connecting || undefined}
+ >
+ {connecting
+ ? t(($) => $.github.connect_opening)
+ : t(($) => $.github.connect_github)}
+ </Button>
+ )}
+ {/* Resume stays reachable after a disconnect: the pause is a
+ workspace setting, and Co-authored-by works without an App.
+ Only disconnecting needs an installation. */}
+ {connected || !flags.enabled ? (
+ <DropdownMenu>
+ <DropdownMenuTrigger
+ render={
+ <Button
+ variant="ghost"
+ size="icon-sm"
+ aria-label={t(($) => $.code.github_actions)}
+ />
+ }
+ >
+ <MoreHorizontal />
+ </DropdownMenuTrigger>
+ <DropdownMenuContent align="end" className="w-auto">
+ <DropdownMenuItem
+ disabled={savingKey === "github_enabled"}
+ onClick={() => persistSetting("github_enabled", !flags.enabled)}
+ >
+ {flags.enabled ? <Pause /> : <Play />}
+ {flags.enabled
+ ? t(($) => $.github.pause)
+ : t(($) => $.github.resume)}
+ </DropdownMenuItem>
+ {primaryInstallation ? (
+ <>
+ <DropdownMenuSeparator />
+ <DropdownMenuItem
+ variant="destructive"
+ onClick={() => setDisconnectTarget(primaryInstallation.id)}
+ >
+ <Unplug />
+ {t(($) => $.github.disconnect)}
+ </DropdownMenuItem>
+ </>
+ ) : null}
+ </DropdownMenuContent>
+ </DropdownMenu>
+ ) : null}
+ </span>
+ ) : null}
+ </SettingsRow>
+ {vcsAvailable ? <VCSConnectionRows /> : null}
+ </SettingsCard>
+ </SettingsSection>
+
+ <RepositoriesSection />
+
+ <SettingsSection
+ title={t(($) => $.code.pr_linking_title)}
+ anchor="pr-linking"
+ >
+ <SettingsCard>
+ <SettingsRow
+ anchor="pr-sidebar"
+ label={t(($) => $.github.feature_pr_sidebar_label)}
+ description={t(($) => $.github.feature_pr_sidebar_description)}
+ >
+ <Switch
+ checked={flags.prSidebar}
+ disabled={featureDisabled("github_pr_sidebar_enabled")}
+ onCheckedChange={(v) => persistSetting("github_pr_sidebar_enabled", v)}
+ aria-label={t(($) => $.github.feature_pr_sidebar_label)}
+ />
+ </SettingsRow>
+ <SettingsRow
+ anchor="auto-link"
+ label={t(($) => $.github.feature_auto_link_label)}
+ description={t(($) => $.github.feature_auto_link_description, {
+ example: `${workspace.issue_prefix || "MUL"}-123`,
+ })}
+ >
+ <Switch
+ checked={flags.autoLinkPRs}
+ disabled={featureDisabled("github_auto_link_prs_enabled")}
+ onCheckedChange={(v) => persistSetting("github_auto_link_prs_enabled", v)}
+ aria-label={t(($) => $.github.feature_auto_link_label)}
+ />
+ </SettingsRow>
+ <SettingsRow
+ anchor="co-author"
+ label={t(($) => $.github.feature_co_author_label)}
+ description={
+ <>
+ {t(($) => $.github.feature_co_author_description_prefix)}{" "}
+ <code className="rounded-xs bg-muted px-1 py-0.5 text-caption">
+ {"Co-authored-by: multica-agent <[email protected]>"}
+ </code>
+ {t(($) => $.github.feature_co_author_description_suffix)}
+ </>
+ }
+ >
+ <Switch
+ checked={flags.coAuthor}
+ disabled={featureDisabled("co_authored_by_enabled")}
+ onCheckedChange={(v) => persistSetting("co_authored_by_enabled", v)}
+ aria-label={t(($) => $.github.feature_co_author_label)}
+ />
+ </SettingsRow>
+ <PRMergeStatusRow canManage={isManager} />
+ </SettingsCard>
+ </SettingsSection>
+
+ <AlertDialog
+ open={!!disconnectTarget}
+ onOpenChange={(v) => {
+ if (!v && !disconnecting) setDisconnectTarget(null);
+ }}
+ >
+ <AlertDialogContent>
+ <AlertDialogHeader>
+ <AlertDialogTitle>{t(($) => $.github.disconnect_confirm_title)}</AlertDialogTitle>
+ <AlertDialogDescription>
+ {t(($) => $.github.disconnect_confirm_description)}
+ </AlertDialogDescription>
+ </AlertDialogHeader>
+ <AlertDialogFooter>
+ <AlertDialogCancel disabled={disconnecting}>
+ {t(($) => $.github.disconnect_confirm_cancel)}
+ </AlertDialogCancel>
+ <AlertDialogAction onClick={handleDisconnect} disabled={disconnecting}>
+ {disconnecting
+ ? t(($) => $.github.disconnecting)
+ : t(($) => $.github.disconnect_confirm_action)}
+ </AlertDialogAction>
+ </AlertDialogFooter>
+ </AlertDialogContent>
+ </AlertDialog>
+ </SettingsTab>
+ );
+}
diff --git a/packages/views/settings/components/code-vcs.test.tsx b/packages/views/settings/components/code-vcs.test.tsx
new file mode 100644
index 0000000000..8630d6749c
--- /dev/null
+++ b/packages/views/settings/components/code-vcs.test.tsx
@@ -0,0 +1,113 @@
+import { beforeEach, describe, expect, it, vi } from "vitest";
+import { screen, waitFor, within } from "@testing-library/react";
+import userEvent from "@testing-library/user-event";
+import { renderWithI18n } from "../../test/i18n";
+
+const mockConnect = vi.hoisted(() => vi.fn());
+const mockRotate = vi.hoisted(() => vi.fn());
+const mockDelete = vi.hoisted(() => vi.fn());
+const listing = vi.hoisted(() => ({
+ current: {
+ connections: [] as {
+ id: string;
+ provider: "forgejo" | "gitea" | "gitlab";
+ instance_url: string;
+ account_login: string;
+ }[],
+ configured: true,
+ can_manage: true,
+ },
+}));
+
+vi.mock("@tanstack/react-query", () => ({
+ useQuery: () => ({ data: listing.current }),
+ useQueryClient: () => ({ invalidateQueries: vi.fn() }),
+ queryOptions: <T,>(opts: T) => opts,
+}));
+vi.mock("@multica/core/hooks", () => ({ useWorkspaceId: () => "ws-1" }));
+vi.mock("@multica/core/api", () => ({
+ api: {
+ connectVCS: mockConnect,
+ rotateVCSWebhook: mockRotate,
+ deleteVCSConnection: mockDelete,
+ },
+}));
+vi.mock("sonner", () => ({ toast: { success: vi.fn(), error: vi.fn() } }));
+
+import { VCSConnectionRows } from "./code-vcs";
+
+const CONNECTION = {
+ id: "vcs-1",
+ provider: "gitea" as const,
+ instance_url: "https://git.acme.dev",
+ account_login: "bot",
+};
+
+beforeEach(() => {
+ vi.clearAllMocks();
+ listing.current = { connections: [], configured: true, can_manage: true };
+});
+
+describe("VCSConnectionRows", () => {
+ it("connects an instance from a dialog and then shows the one-time webhook secret", async () => {
+ mockConnect.mockResolvedValue({
+ ...CONNECTION,
+ webhook_url: "https://api.example/webhooks/vcs/vcs-1",
+ webhook_path: "/webhooks/vcs/vcs-1",
+ webhook_secret: "s3cret",
+ });
+ const user = userEvent.setup();
+ renderWithI18n(<VCSConnectionRows />);
+
+ await user.click(screen.getByRole("button", { name: "Connect" }));
+ const form = await screen.findByRole("dialog");
+ await user.type(within(form).getByLabelText("Instance URL"), " https://git.acme.dev ");
+ await user.type(within(form).getByLabelText("Access token"), "tok");
+ await user.click(within(form).getByRole("button", { name: "Connect" }));
+
+ await waitFor(() =>
+ expect(mockConnect).toHaveBeenCalledWith("ws-1", {
+ provider: "forgejo",
+ instance_url: "https://git.acme.dev",
+ access_token: "tok",
+ }),
+ );
+ const webhook = await screen.findByRole("dialog", { name: /Finish setup/ });
+ expect(within(webhook).getByDisplayValue("s3cret")).toBeInTheDocument();
+ await user.click(within(webhook).getByRole("button", { name: "I've saved it" }));
+ await waitFor(() => expect(screen.queryByRole("dialog")).toBeNull());
+ });
+
+ it("lists connected instances with their actions", async () => {
+ listing.current.connections = [CONNECTION];
+ const user = userEvent.setup();
+ renderWithI18n(<VCSConnectionRows />);
+
+ expect(screen.getByText("Gitea · https://git.acme.dev")).toBeInTheDocument();
+ await user.click(
+ screen.getByRole("button", { name: "Actions for https://git.acme.dev" }),
+ );
+ expect(
+ await screen.findByRole("menuitem", { name: "Regenerate webhook" }),
+ ).toBeInTheDocument();
+ expect(screen.getByRole("menuitem", { name: "Disconnect" })).toBeInTheDocument();
+ // Another instance can still be added.
+ expect(screen.getByRole("button", { name: "Connect another" })).toBeInTheDocument();
+ });
+
+ it("explains the missing server key instead of offering a dead connect", () => {
+ listing.current.configured = false;
+ renderWithI18n(<VCSConnectionRows />);
+
+ expect(screen.getByText("MULTICA_VCS_SECRET_KEY")).toBeInTheDocument();
+ expect(screen.getByRole("button", { name: "Connect" })).toBeDisabled();
+ });
+
+ it("asks members to contact an admin when nothing is connected", () => {
+ listing.current.can_manage = false;
+ renderWithI18n(<VCSConnectionRows />);
+
+ expect(screen.queryByRole("button", { name: "Connect" })).toBeNull();
+ expect(screen.getByText(/Ask a workspace admin/)).toBeInTheDocument();
+ });
+});
diff --git a/packages/views/settings/components/code-vcs.tsx b/packages/views/settings/components/code-vcs.tsx
new file mode 100644
index 0000000000..3326f4119d
--- /dev/null
+++ b/packages/views/settings/components/code-vcs.tsx
@@ -0,0 +1,462 @@
+"use client";
+
+import { useState } from "react";
+import { useQuery, useQueryClient } from "@tanstack/react-query";
+import { toast } from "sonner";
+import { Copy, FolderGit2, GitBranch, MoreHorizontal, RefreshCw, Unplug } from "lucide-react";
+import { Button } from "@multica/ui/components/ui/button";
+import { Input } from "@multica/ui/components/ui/input";
+import { Label } from "@multica/ui/components/ui/label";
+import {
+ Select,
+ SelectContent,
+ SelectItem,
+ SelectTrigger,
+ SelectValue,
+} from "@multica/ui/components/ui/select";
+import {
+ Dialog,
+ DialogContent,
+ DialogDescription,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle,
+} from "@multica/ui/components/ui/dialog";
+import {
+ AlertDialog,
+ AlertDialogAction,
+ AlertDialogCancel,
+ AlertDialogContent,
+ AlertDialogDescription,
+ AlertDialogFooter,
+ AlertDialogHeader,
+ AlertDialogTitle,
+} from "@multica/ui/components/ui/alert-dialog";
+import {
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuItem,
+ DropdownMenuSeparator,
+ DropdownMenuTrigger,
+} from "@multica/ui/components/ui/dropdown-menu";
+import { useWorkspaceId } from "@multica/core/hooks";
+import { vcsConnectionsOptions } from "@multica/core/vcs";
+import { api } from "@multica/core/api";
+import type { ConnectVCSResponse, VCSProvider } from "@multica/core/types";
+import { useT } from "../../i18n";
+import { SettingsRow } from "./settings-layout";
+import { HostMark, HostStatus } from "./code-host";
+
+const PROVIDERS: VCSProvider[] = ["forgejo", "gitea", "gitlab"];
+const PROVIDER_LABELS: Record<VCSProvider, string> = {
+ forgejo: "Forgejo",
+ gitea: "Gitea",
+ gitlab: "GitLab",
+};
+const PROVIDER_OPTIONS = PROVIDERS.map((p) => ({
+ value: p,
+ label: PROVIDER_LABELS[p],
+}));
+
+/**
+ * Self-hosted Forgejo / Gitea / GitLab connections, rendered as rows of the
+ * Code page's "Code hosting" card: one row per connected instance, then a row
+ * to connect another. Connecting and rotating both end on the one-time webhook
+ * secret, shown in a dialog the user has to dismiss.
+ */
+export function VCSConnectionRows() {
+ const { t } = useT("settings");
+ const wsId = useWorkspaceId();
+ const qc = useQueryClient();
+
+ const { data } = useQuery(vcsConnectionsOptions(wsId));
+ const connections = data?.connections ?? [];
+ const configured = data?.configured === true;
+ const canManage = data?.can_manage === true;
+
+ const [connectOpen, setConnectOpen] = useState(false);
+ const [provider, setProvider] = useState<VCSProvider>("forgejo");
+ const [instanceUrl, setInstanceUrl] = useState("");
+ const [token, setToken] = useState("");
+ const [connecting, setConnecting] = useState(false);
+ const [webhook, setWebhook] = useState<ConnectVCSResponse | null>(null);
+ const [rotateTarget, setRotateTarget] = useState<string | null>(null);
+ const [rotating, setRotating] = useState(false);
+ const [deleteTarget, setDeleteTarget] = useState<string | null>(null);
+ const [deleting, setDeleting] = useState(false);
+
+ async function handleConnect() {
+ if (connecting || !instanceUrl.trim() || !token.trim()) return;
+ setConnecting(true);
+ try {
+ const resp = await api.connectVCS(wsId, {
+ provider,
+ instance_url: instanceUrl.trim(),
+ access_token: token.trim(),
+ });
+ await qc.invalidateQueries({ queryKey: ["vcs", wsId] });
+ setInstanceUrl("");
+ setToken("");
+ setConnectOpen(false);
+ setWebhook(resp);
+ } catch (e) {
+ toast.error(e instanceof Error ? e.message : t(($) => $.vcs.toast_connect_failed));
+ } finally {
+ setConnecting(false);
+ }
+ }
+
+ async function handleRotateWebhook() {
+ if (!rotateTarget || rotating) return;
+ setRotating(true);
+ try {
+ const resp = await api.rotateVCSWebhook(wsId, rotateTarget);
+ await qc.invalidateQueries({ queryKey: ["vcs", wsId] });
+ setRotateTarget(null);
+ setWebhook(resp);
+ } catch (e) {
+ toast.error(e instanceof Error ? e.message : t(($) => $.vcs.toast_rotate_failed));
+ } finally {
+ setRotating(false);
+ }
+ }
+
+ async function handleDelete() {
+ if (!deleteTarget || deleting) return;
+ setDeleting(true);
+ try {
+ await api.deleteVCSConnection(wsId, deleteTarget);
+ await qc.invalidateQueries({ queryKey: ["vcs", wsId] });
+ toast.success(t(($) => $.vcs.toast_disconnected));
+ setDeleteTarget(null);
+ } catch (e) {
+ toast.error(e instanceof Error ? e.message : t(($) => $.vcs.toast_disconnect_failed));
+ } finally {
+ setDeleting(false);
+ }
+ }
+
+ async function copy(value: string) {
+ try {
+ await navigator.clipboard.writeText(value);
+ toast.success(t(($) => $.vcs.copied));
+ } catch {
+ toast.error(t(($) => $.vcs.copy_failed));
+ }
+ }
+
+ const connectDetail = !canManage
+ ? connections.length === 0
+ ? t(($) => $.vcs.contact_admin)
+ : undefined
+ : !configured
+ ? (
+ <>
+ {t(($) => $.vcs.not_configured)}{" "}
+ <code className="rounded-xs bg-muted px-1 py-0.5 text-micro">
+ MULTICA_VCS_SECRET_KEY
+ </code>
+ </>
+ )
+ : t(($) => $.vcs.hosts_hint);
+
+ return (
+ <>
+ {connections.map((c) => (
+ <SettingsRow
+ key={c.id}
+ label={
+ <span className="flex min-w-0 items-center gap-3">
+ <HostMark>
+ <GitBranch className="size-4" />
+ </HostMark>
+ <span className="flex min-w-0 flex-wrap items-center gap-x-2">
+ <span className="break-all">
+ {`${PROVIDER_LABELS[c.provider] ?? c.provider} · ${c.instance_url}`}
+ </span>
+ <HostStatus tone="success" label={t(($) => $.integrations.status_connected)} />
+ </span>
+ </span>
+ }
+ description={
+ <span className="block break-all pl-12">
+ {t(($) => $.vcs.connected_as, { login: c.account_login })}
+ </span>
+ }
+ >
+ {canManage ? (
+ <DropdownMenu>
+ <DropdownMenuTrigger
+ render={
+ <Button
+ variant="ghost"
+ size="icon-sm"
+ aria-label={t(($) => $.vcs.connection_actions, { url: c.instance_url })}
+ />
+ }
+ >
+ <MoreHorizontal />
+ </DropdownMenuTrigger>
+ <DropdownMenuContent align="end" className="w-auto">
+ <DropdownMenuItem onClick={() => setRotateTarget(c.id)}>
+ <RefreshCw />
+ {t(($) => $.vcs.regenerate_webhook)}
+ </DropdownMenuItem>
+ <DropdownMenuSeparator />
+ <DropdownMenuItem variant="destructive" onClick={() => setDeleteTarget(c.id)}>
+ <Unplug />
+ {t(($) => $.vcs.disconnect)}
+ </DropdownMenuItem>
+ </DropdownMenuContent>
+ </DropdownMenu>
+ ) : null}
+ </SettingsRow>
+ ))}
+
+ {canManage || connections.length === 0 ? (
+ <SettingsRow
+ anchor="vcs"
+ label={
+ <span className="flex min-w-0 items-center gap-3">
+ <HostMark>
+ <FolderGit2 className="size-4" />
+ </HostMark>
+ <span className="flex min-w-0 flex-wrap items-center gap-x-2">
+ {t(($) => $.vcs.section_title)}
+ {connections.length === 0 ? (
+ <HostStatus
+ tone="muted"
+ label={t(($) => $.integrations.status_not_connected)}
+ />
+ ) : null}
+ </span>
+ </span>
+ }
+ description={
+ connectDetail ? <span className="block pl-12">{connectDetail}</span> : undefined
+ }
+ >
+ {canManage ? (
+ <Button
+ variant="outline"
+ size="sm"
+ disabled={!configured}
+ onClick={() => setConnectOpen(true)}
+ >
+ {connections.length === 0
+ ? t(($) => $.vcs.connect)
+ : t(($) => $.vcs.connect_another)}
+ </Button>
+ ) : null}
+ </SettingsRow>
+ ) : null}
+
+ <Dialog
+ open={connectOpen}
+ onOpenChange={(open) => {
+ if (!open && !connecting) setConnectOpen(false);
+ }}
+ >
+ <DialogContent className="sm:max-w-lg">
+ <DialogHeader>
+ <DialogTitle>{t(($) => $.vcs.connect_title)}</DialogTitle>
+ <DialogDescription>{t(($) => $.vcs.page_description)}</DialogDescription>
+ </DialogHeader>
+ <form
+ className="space-y-4"
+ onSubmit={(event) => {
+ event.preventDefault();
+ void handleConnect();
+ }}
+ >
+ <div className="space-y-1.5">
+ <Label htmlFor="vcs-provider">{t(($) => $.vcs.form_provider_label)}</Label>
+ <Select
+ items={PROVIDER_OPTIONS}
+ value={provider}
+ onValueChange={(v) => setProvider(v as VCSProvider)}
+ >
+ <SelectTrigger id="vcs-provider" className="w-full" disabled={connecting}>
+ <SelectValue />
+ </SelectTrigger>
+ <SelectContent>
+ {PROVIDERS.map((p) => (
+ <SelectItem key={p} value={p}>
+ {PROVIDER_LABELS[p]}
+ </SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
+ </div>
+ <div className="space-y-1.5">
+ <Label htmlFor="vcs-url">{t(($) => $.vcs.form_instance_url_label)}</Label>
+ <Input
+ id="vcs-url"
+ placeholder="https://forgejo.example.com"
+ value={instanceUrl}
+ onChange={(e) => setInstanceUrl(e.target.value)}
+ disabled={connecting}
+ />
+ </div>
+ <div className="space-y-1.5">
+ <Label htmlFor="vcs-token">{t(($) => $.vcs.form_token_label)}</Label>
+ <Input
+ id="vcs-token"
+ type="password"
+ autoComplete="off"
+ placeholder={t(($) => $.vcs.form_token_placeholder)}
+ value={token}
+ onChange={(e) => setToken(e.target.value)}
+ disabled={connecting}
+ />
+ <p className="text-caption text-muted-foreground">{t(($) => $.vcs.form_token_hint)}</p>
+ </div>
+ <DialogFooter>
+ <Button
+ type="button"
+ variant="outline"
+ onClick={() => setConnectOpen(false)}
+ disabled={connecting}
+ >
+ {t(($) => $.vcs.disconnect_confirm_cancel)}
+ </Button>
+ <Button
+ type="submit"
+ disabled={connecting || !instanceUrl.trim() || !token.trim()}
+ aria-busy={connecting || undefined}
+ >
+ {connecting ? t(($) => $.vcs.connecting) : t(($) => $.vcs.connect)}
+ </Button>
+ </DialogFooter>
+ </form>
+ </DialogContent>
+ </Dialog>
+
+ <Dialog
+ open={!!webhook}
+ onOpenChange={(open) => {
+ if (!open) setWebhook(null);
+ }}
+ >
+ <DialogContent className="sm:max-w-lg">
+ <DialogHeader>
+ <DialogTitle>{t(($) => $.vcs.webhook_setup_title)}</DialogTitle>
+ <DialogDescription>{t(($) => $.vcs.webhook_setup_description)}</DialogDescription>
+ </DialogHeader>
+ {webhook ? (
+ <div className="space-y-3">
+ <CopyField
+ id="vcs-webhook-url"
+ label={t(($) => $.vcs.webhook_url_label)}
+ value={webhook.webhook_url || webhook.webhook_path}
+ onCopy={copy}
+ copyLabel={t(($) => $.vcs.copy)}
+ />
+ <CopyField
+ id="vcs-webhook-secret"
+ label={t(($) => $.vcs.webhook_secret_label)}
+ value={webhook.webhook_secret}
+ onCopy={copy}
+ copyLabel={t(($) => $.vcs.copy)}
+ mono
+ />
+ <p className="text-caption text-warning">{t(($) => $.vcs.webhook_secret_warning)}</p>
+ </div>
+ ) : null}
+ <DialogFooter>
+ <Button onClick={() => setWebhook(null)}>{t(($) => $.vcs.webhook_done)}</Button>
+ </DialogFooter>
+ </DialogContent>
+ </Dialog>
+
+ <AlertDialog
+ open={!!rotateTarget}
+ onOpenChange={(v) => {
+ if (!v && !rotating) setRotateTarget(null);
+ }}
+ >
+ <AlertDialogContent>
+ <AlertDialogHeader>
+ <AlertDialogTitle>{t(($) => $.vcs.rotate_confirm_title)}</AlertDialogTitle>
+ <AlertDialogDescription>
+ {t(($) => $.vcs.rotate_confirm_description)}
+ </AlertDialogDescription>
+ </AlertDialogHeader>
+ <AlertDialogFooter>
+ <AlertDialogCancel disabled={rotating}>
+ {t(($) => $.vcs.rotate_confirm_cancel)}
+ </AlertDialogCancel>
+ <AlertDialogAction onClick={handleRotateWebhook} disabled={rotating}>
+ {rotating ? t(($) => $.vcs.rotating) : t(($) => $.vcs.rotate_confirm_action)}
+ </AlertDialogAction>
+ </AlertDialogFooter>
+ </AlertDialogContent>
+ </AlertDialog>
+
+ <AlertDialog
+ open={!!deleteTarget}
+ onOpenChange={(v) => {
+ if (!v && !deleting) setDeleteTarget(null);
+ }}
+ >
+ <AlertDialogContent>
+ <AlertDialogHeader>
+ <AlertDialogTitle>{t(($) => $.vcs.disconnect_confirm_title)}</AlertDialogTitle>
+ <AlertDialogDescription>
+ {t(($) => $.vcs.disconnect_confirm_description)}
+ </AlertDialogDescription>
+ </AlertDialogHeader>
+ <AlertDialogFooter>
+ <AlertDialogCancel disabled={deleting}>
+ {t(($) => $.vcs.disconnect_confirm_cancel)}
+ </AlertDialogCancel>
+ <AlertDialogAction variant="destructive" onClick={handleDelete} disabled={deleting}>
+ {deleting ? t(($) => $.vcs.disconnecting) : t(($) => $.vcs.disconnect_confirm_action)}
+ </AlertDialogAction>
+ </AlertDialogFooter>
+ </AlertDialogContent>
+ </AlertDialog>
+ </>
+ );
+}
+
+function CopyField({
+ id,
+ label,
+ value,
+ onCopy,
+ copyLabel,
+ mono,
+}: {
+ id: string;
+ label: string;
+ value: string;
+ onCopy: (v: string) => void;
+ copyLabel: string;
+ mono?: boolean;
+}) {
+ return (
+ <div className="space-y-1.5">
+ <Label htmlFor={id} className="text-caption">
+ {label}
+ </Label>
+ <div className="flex items-center gap-2">
+ <Input
+ id={id}
+ readOnly
+ value={value}
+ className={mono ? "min-w-0 font-mono text-caption" : "min-w-0 text-caption"}
+ />
+ <Button
+ variant="outline"
+ size="icon-sm"
+ className="shrink-0"
+ onClick={() => onCopy(value)}
+ aria-label={`${copyLabel}: ${label}`}
+ >
+ <Copy />
+ </Button>
+ </div>
+ </div>
+ );
+}
diff --git a/packages/views/settings/components/composio-tab.test.tsx b/packages/views/settings/components/composio-tab.test.tsx
index 948dcede39..124421e108 100644
--- a/packages/views/settings/components/composio-tab.test.tsx
+++ b/packages/views/settings/components/composio-tab.test.tsx
@@ -169,7 +169,7 @@ describe("ComposioTab", () => {
});
expect(mockInvalidate).toHaveBeenCalledWith({ queryKey: ["composio", "connections"] });
// The one-shot param is stripped while ?tab is preserved.
- expect(mockReplace).toHaveBeenCalledWith("/acme/settings?tab=integrations&integration=composio");
+ expect(mockReplace).toHaveBeenCalledWith("/acme/settings?tab=apps");
});
it("toasts error on a failed callback", async () => {
@@ -178,7 +178,7 @@ describe("ComposioTab", () => {
await waitFor(() => {
expect(mockToastError).toHaveBeenCalledWith(enSettings.composio.toast_connect_failed);
});
- expect(mockReplace).toHaveBeenCalledWith("/acme/settings?tab=integrations&integration=composio");
+ expect(mockReplace).toHaveBeenCalledWith("/acme/settings?tab=apps");
});
it("fires the success callback exactly once under StrictMode double-invoke", async () => {
diff --git a/packages/views/settings/components/composio-tab.tsx b/packages/views/settings/components/composio-tab.tsx
index 55f930b266..529567e1c1 100644
--- a/packages/views/settings/components/composio-tab.tsx
+++ b/packages/views/settings/components/composio-tab.tsx
@@ -85,10 +85,12 @@ export function ComposioTab() {
} else {
toast.error(t(($) => $.composio.toast_connect_failed));
}
- // Drop only the Composio one-shot params; keep everything else (notably
- // ?tab=integrations) so the user stays on this tab.
+ // The OAuth service returns to the retired `?tab=integrations` URL. Drop
+ // the one-shot params and point the URL at this page, keeping everything
+ // else, so a refresh neither re-toasts nor leaves the legacy tab behind.
const params = new URLSearchParams(navigation.searchParams);
- params.set("integration", "composio");
+ params.set("tab", "apps");
+ params.delete("integration");
params.delete("connected");
params.delete("error");
const qs = params.toString();
@@ -177,10 +179,6 @@ export function ComposioTab() {
return (
<div className="space-y-6">
- <section className="space-y-1">
- <p className="text-body text-muted-foreground">{t(($) => $.composio.page_description)}</p>
- </section>
-
{toolkitsQuery.isLoading ? (
<Card>
<CardContent>
diff --git a/packages/views/settings/components/connected-apps-tab.test.tsx b/packages/views/settings/components/connected-apps-tab.test.tsx
new file mode 100644
index 0000000000..7fcbded821
--- /dev/null
+++ b/packages/views/settings/components/connected-apps-tab.test.tsx
@@ -0,0 +1,54 @@
+import { beforeEach, describe, expect, it, vi } from "vitest";
+import { renderHook } from "@testing-library/react";
+import { ApiError } from "@multica/core/api";
+import { configStore } from "@multica/core/config";
+import { COMPOSIO_MCP_APPS_FLAG } from "@multica/core/feature-flags";
+
+const state = vi.hoisted(() => ({
+ error: null as Error | null,
+ calls: [] as { enabled?: boolean }[],
+}));
+vi.mock("@tanstack/react-query", () => ({
+ queryOptions: <T,>(opts: T) => opts,
+ useQuery: (opts: { enabled?: boolean }) => {
+ state.calls.push(opts);
+ return { error: opts.enabled === false ? null : state.error };
+ },
+}));
+
+import { useComposioAvailable } from "./connected-apps-tab";
+
+beforeEach(() => {
+ state.error = null;
+ state.calls = [];
+ configStore.getState().setFeatureFlags({ [COMPOSIO_MCP_APPS_FLAG]: true });
+});
+
+describe("useComposioAvailable", () => {
+ it("offers Connected apps when the flag is on and the catalog answers", () => {
+ expect(renderHook(() => useComposioAvailable()).result.current).toBe(true);
+ });
+
+ it("keeps the page while the catalog is loading or fails transiently", () => {
+ state.error = new ApiError("boom", 500, "Internal Server Error");
+ expect(renderHook(() => useComposioAvailable()).result.current).toBe(true);
+ });
+
+ it("hides the page and skips the request when the flag is off", () => {
+ configStore.getState().setFeatureFlags({ [COMPOSIO_MCP_APPS_FLAG]: false });
+ expect(renderHook(() => useComposioAvailable()).result.current).toBe(false);
+ expect(state.calls.every((call) => call.enabled === false)).toBe(true);
+ });
+
+ it("hides the page when the server reports Composio unconfigured", () => {
+ state.error = new ApiError("unavailable", 403, "Forbidden", {
+ code: "composio_not_configured",
+ });
+ expect(renderHook(() => useComposioAvailable()).result.current).toBe(false);
+ });
+
+ it("keeps hiding the page when an older server reports 503", () => {
+ state.error = new ApiError("unavailable", 503, "Service Unavailable");
+ expect(renderHook(() => useComposioAvailable()).result.current).toBe(false);
+ });
+});
diff --git a/packages/views/settings/components/connected-apps-tab.tsx b/packages/views/settings/components/connected-apps-tab.tsx
new file mode 100644
index 0000000000..203c0e9c1f
--- /dev/null
+++ b/packages/views/settings/components/connected-apps-tab.tsx
@@ -0,0 +1,42 @@
+"use client";
+
+import { useQuery } from "@tanstack/react-query";
+import { ApiError, errorCode } from "@multica/core/api";
+import { composioToolkitsOptions } from "@multica/core/composio";
+import { useFeatureEnabled } from "@multica/core/config";
+import { COMPOSIO_MCP_APPS_FLAG } from "@multica/core/feature-flags";
+import { useT } from "../../i18n";
+import { ComposioTab } from "./composio-tab";
+import { SettingsTab } from "./settings-layout";
+
+/**
+ * Whether the Connected apps page exists. A pending or failed catalog read
+ * still counts as available — only an explicit "Composio is not configured on
+ * this server" hides the page, so a transient error never removes it.
+ */
+export function useComposioAvailable(): boolean {
+ const enabled = useFeatureEnabled(COMPOSIO_MCP_APPS_FLAG, false);
+ const toolkits = useQuery({ ...composioToolkitsOptions(), enabled });
+ return (
+ enabled &&
+ errorCode(toolkits.error) !== "composio_not_configured" &&
+ !(toolkits.error instanceof ApiError && toolkits.error.status === 503)
+ );
+}
+
+/**
+ * App connections belong to the signed-in account, not the workspace: the
+ * user authorizes their own Gmail or Notion and enables it on agents they own.
+ */
+export function ConnectedAppsTab() {
+ const { t } = useT("settings");
+ return (
+ <SettingsTab
+ title={t(($) => $.page.tabs.apps)}
+ description={t(($) => $.composio.page_description)}
+ scope="account"
+ >
+ <ComposioTab />
+ </SettingsTab>
+ );
+}
diff --git a/packages/views/settings/components/github-tab.test.tsx b/packages/views/settings/components/github-tab.test.tsx
deleted file mode 100644
index 257d5e351e..0000000000
--- a/packages/views/settings/components/github-tab.test.tsx
+++ /dev/null
@@ -1,334 +0,0 @@
-import type { ReactNode } from "react";
-import { describe, it, expect, beforeEach, vi } from "vitest";
-import { cleanup, render, screen, waitFor, within } from "@testing-library/react";
-import userEvent from "@testing-library/user-event";
-import { I18nProvider } from "@multica/core/i18n/react";
-import enCommon from "../../locales/en/common.json";
-import enIssues from "../../locales/en/issues.json";
-import enSettings from "../../locales/en/settings.json";
-
-const mockUpdateWorkspace = vi.hoisted(() => vi.fn());
-const mockDeleteInstallation = vi.hoisted(() => vi.fn());
-const mockGetConnectURL = vi.hoisted(() => vi.fn());
-const mockInvalidate = vi.hoisted(() => vi.fn());
-const mockNavPush = vi.hoisted(() => vi.fn());
-const mockSetQueryData = vi.hoisted(() => vi.fn());
-const mockToastSuccess = vi.hoisted(() => vi.fn());
-
-const workspaceRef = vi.hoisted(() => ({
- current: {
- id: "workspace-1",
- name: "Acme",
- slug: "acme",
- settings: {} as Record<string, unknown>,
- repos: [{ url: "https://github.com/acme/api" }] as { url: string }[],
- },
-}));
-type MemberRole = "owner" | "admin" | "member" | "guest";
-const membersRef = vi.hoisted(() => ({
- current: [{ user_id: "user-1", role: "owner" as MemberRole }],
-}));
-const installationsRef = vi.hoisted(() => ({
- current: {
- installations: [] as {
- id: string;
- account_login: string;
- installation_id?: number;
- connected_by?: string;
- }[],
- configured: true,
- can_manage: true as boolean,
- },
-}));
-
-vi.mock("@tanstack/react-query", () => ({
- useQuery: (opts: { queryKey: unknown[] }) => {
- const key = JSON.stringify(opts.queryKey);
- if (key.includes("members")) return { data: membersRef.current };
- if (key.includes("installations")) return { data: installationsRef.current };
- return { data: undefined };
- },
- useQueryClient: () => ({
- setQueryData: mockSetQueryData,
- invalidateQueries: mockInvalidate,
- }),
- queryOptions: <T,>(opts: T) => opts,
-}));
-
-vi.mock("@multica/core/hooks", () => ({
- useWorkspaceId: () => "workspace-1",
-}));
-
-vi.mock("@multica/core/paths", () => ({
- useCurrentWorkspace: () => workspaceRef.current,
-}));
-
-vi.mock("@multica/core/workspace/queries", () => ({
- memberListOptions: () => ({ queryKey: ["members"], queryFn: vi.fn() }),
- workspaceKeys: { list: () => ["workspaces"] },
-}));
-
-vi.mock("@multica/core/github", async () => {
- const actual =
- await vi.importActual<typeof import("@multica/core/github")>("@multica/core/github");
- return {
- ...actual,
- githubInstallationsOptions: () => ({
- queryKey: ["github", "installations"],
- queryFn: vi.fn(),
- }),
- };
-});
-
-vi.mock("@multica/core/api", () => ({
- api: {
- updateWorkspace: mockUpdateWorkspace,
- deleteGitHubInstallation: mockDeleteInstallation,
- getGitHubConnectURL: mockGetConnectURL,
- },
-}));
-
-vi.mock("@multica/core/auth", () => {
- const useAuthStore = Object.assign(
- (sel?: (s: { user: { id: string } }) => unknown) =>
- sel ? sel({ user: { id: "user-1" } }) : { user: { id: "user-1" } },
- { getState: () => ({ user: { id: "user-1" } }) },
- );
- return { useAuthStore };
-});
-
-// Mocked at the context module rather than the barrel so <AppLink> stays the
-// real component and its click contract is what the test exercises.
-vi.mock("../../navigation/context", () => ({
- useNavigation: () => ({
- push: mockNavPush,
- replace: vi.fn(),
- back: vi.fn(),
- pathname: "/acme/settings",
- searchParams: new URLSearchParams("tab=github"),
- hash: "",
- getShareableUrl: (p: string) => `https://app.example${p}`,
- }),
-}));
-
-vi.mock("sonner", () => ({
- toast: { success: mockToastSuccess, error: vi.fn() },
-}));
-
-import { GitHubTab } from "./github-tab";
-
-const TEST_RESOURCES = {
- en: { common: enCommon, issues: enIssues, settings: enSettings },
-};
-
-function I18nWrapper({ children }: { children: ReactNode }) {
- return (
- <I18nProvider locale="en" resources={TEST_RESOURCES}>
- {children}
- </I18nProvider>
- );
-}
-
-function resetFixtures() {
- vi.clearAllMocks();
- workspaceRef.current = {
- id: "workspace-1",
- name: "Acme",
- slug: "acme",
- settings: {},
- repos: [{ url: "https://github.com/acme/api" }],
- };
- membersRef.current = [{ user_id: "user-1", role: "owner" }];
- installationsRef.current = { installations: [], configured: true, can_manage: true };
-}
-
-describe("GitHubTab", () => {
- beforeEach(resetFixtures);
-
- it.each([false, true])("states the linking rule beside auto-link when connected=%s", (connected) => {
- installationsRef.current.installations = connected
- ? [{ id: "inst-1", account_login: "acme" }]
- : [];
- render(<GitHubTab />, { wrapper: I18nWrapper });
-
- const toggle = screen.getByRole("switch", { name: /Auto-link issues and PRs/i });
- const row = within(toggle.parentElement!);
- expect(row.getByText(/e\.g\. MUL-123, is in its title or branch name, or follows “Closes” in its description/)).toBeTruthy();
- });
-
- // MUL-7726: what a merge does is chosen here, with the other PR features.
- it("picks the status a merge moves issues to, Done by default", () => {
- render(<GitHubTab />, { wrapper: I18nWrapper });
- const select = screen.getByRole("combobox", { name: "After PRs merge, move the issue to" });
- expect(select).toHaveTextContent("Done");
-
- cleanup();
- workspaceRef.current.settings = { pr_merge_status: "none" };
- render(<GitHubTab />, { wrapper: I18nWrapper });
- expect(screen.getByRole("combobox", { name: "After PRs merge, move the issue to" })).toHaveTextContent("Don’t change");
- });
-
- it("saves the chosen status into the workspace settings", async () => {
- const user = userEvent.setup();
- workspaceRef.current.settings = { github_enabled: true };
- mockUpdateWorkspace.mockResolvedValue({ ...workspaceRef.current, settings: { github_enabled: true, pr_merge_status: "in_review" } });
- render(<GitHubTab />, { wrapper: I18nWrapper });
- await user.click(screen.getByRole("combobox", { name: "After PRs merge, move the issue to" }));
- const inReview = await screen.findByRole("option", { name: "In Review" });
- // A merge never blocks an issue.
- expect(screen.queryByRole("option", { name: "Blocked" })).toBeNull();
- await user.click(inReview);
- await waitFor(() =>
- expect(mockUpdateWorkspace).toHaveBeenCalledWith("workspace-1", {
- settings: { github_enabled: true, pr_merge_status: "in_review" },
- }),
- );
- });
-
- it("greys out the merge status with the other features when GitHub is off", () => {
- workspaceRef.current.settings = { github_enabled: false };
- render(<GitHubTab />, { wrapper: I18nWrapper });
- expect(screen.getByRole("combobox", { name: "After PRs merge, move the issue to" })).toBeDisabled();
- });
-
- it("offers the master switch without a separate turn-off callout", () => {
- render(<GitHubTab />, { wrapper: I18nWrapper });
- expect(screen.getByRole("switch", { name: /enable github features/i })).toBeEnabled();
- // The old standalone callout (title + dedicated "Turn GitHub off" button) is gone.
- expect(screen.queryByRole("button", { name: /^Turn GitHub off$/ })).toBeNull();
- });
-
- it("does not show the hint once the master switch is off", () => {
- workspaceRef.current.settings = { github_enabled: false };
- render(<GitHubTab />, { wrapper: I18nWrapper });
- expect(screen.queryByText(/Not a development team\?/)).toBeNull();
- });
-
- it("disables every feature switch when the master switch is off", () => {
- workspaceRef.current.settings = { github_enabled: false };
- render(<GitHubTab />, { wrapper: I18nWrapper });
-
- const master = screen.getByRole("switch", { name: /enable github features/i });
- expect(master.getAttribute("aria-checked")).toBe("false");
-
- const switches = screen.getAllByRole("switch");
- // First switch is master; remaining must be disabled (aria-disabled or disabled attr)
- const features = switches.slice(1);
- expect(features.length).toBeGreaterThan(0);
- for (const sw of features) {
- const ariaDisabled = sw.getAttribute("aria-disabled");
- const disabled = sw.hasAttribute("disabled");
- expect(ariaDisabled === "true" || disabled).toBe(true);
- }
- });
-
- it("flipping the master switch off persists github_enabled=false and merges existing settings", async () => {
- const user = userEvent.setup();
- workspaceRef.current.settings = { co_authored_by_enabled: true };
- mockUpdateWorkspace.mockResolvedValue({
- ...workspaceRef.current,
- settings: { co_authored_by_enabled: true, github_enabled: false },
- });
-
- render(<GitHubTab />, { wrapper: I18nWrapper });
-
- await user.click(screen.getByRole("switch", { name: /enable github features/i }));
-
- await waitFor(() => {
- expect(mockUpdateWorkspace).toHaveBeenCalledWith("workspace-1", {
- settings: { co_authored_by_enabled: true, github_enabled: false },
- });
- expect(mockToastSuccess).toHaveBeenCalledWith("Changes saved", {
- id: "settings-auto-save",
- });
- });
- });
-
- it("clicking Disconnect opens the confirmation and only fires on confirm", async () => {
- const user = userEvent.setup();
- installationsRef.current = {
- configured: true,
- can_manage: true,
- installations: [{ id: "inst-42", account_login: "acme", installation_id: 42 }],
- };
- mockDeleteInstallation.mockResolvedValue(undefined);
-
- render(<GitHubTab />, { wrapper: I18nWrapper });
-
- await user.click(screen.getByRole("button", { name: /^Disconnect$/ }));
- expect(screen.getByText(/Multica will stop receiving webhooks/i)).toBeTruthy();
- expect(mockDeleteInstallation).not.toHaveBeenCalled();
-
- const dialogConfirm = screen
- .getAllByRole("button", { name: /^Disconnect$/ })
- .find((b) => b.getAttribute("data-slot")?.includes("alert-dialog"));
- await user.click(dialogConfirm ?? screen.getAllByRole("button", { name: /^Disconnect$/ })[1]!);
-
- await waitFor(() => {
- expect(mockDeleteInstallation).toHaveBeenCalledWith("workspace-1", "inst-42");
- });
- });
-
- it("Disconnect button is still visible when the master switch is off", () => {
- workspaceRef.current.settings = { github_enabled: false };
- installationsRef.current = {
- configured: true,
- can_manage: true,
- installations: [{ id: "inst-1", account_login: "acme", installation_id: 1 }],
- };
- render(<GitHubTab />, { wrapper: I18nWrapper });
- expect(screen.getByRole("button", { name: /^Disconnect$/ })).toBeTruthy();
- });
-
- it("non-admin sees the existing connection but no Connect/Disconnect controls", () => {
- membersRef.current = [{ user_id: "user-1", role: "member" }];
- installationsRef.current = {
- configured: true,
- can_manage: false,
- installations: [{ id: "inst-1", account_login: "acme" }],
- };
- render(<GitHubTab />, { wrapper: I18nWrapper });
-
- expect(screen.getByText(/Connected to acme/i)).toBeTruthy();
- expect(screen.getByText(/Read-only view\./i)).toBeTruthy();
- expect(screen.queryByRole("button", { name: /^Connect GitHub$/ })).toBeNull();
- expect(screen.queryByRole("button", { name: /^Disconnect$/ })).toBeNull();
- });
-
- it("non-admin with no connection sees the contact-admin hint", () => {
- membersRef.current = [{ user_id: "user-1", role: "member" }];
- installationsRef.current = {
- configured: true,
- can_manage: false,
- installations: [],
- };
- render(<GitHubTab />, { wrapper: I18nWrapper });
-
- expect(screen.getByText(/Ask an admin or owner/i)).toBeTruthy();
- expect(screen.queryByRole("button", { name: /^Connect GitHub$/ })).toBeNull();
- });
-
- it("renders the connected_by line when the backend provides it", () => {
- installationsRef.current = {
- configured: true,
- can_manage: true,
- installations: [
- {
- id: "inst-7",
- account_login: "acme",
- installation_id: 7,
- connected_by: "Jiayuan",
- },
- ],
- };
- render(<GitHubTab />, { wrapper: I18nWrapper });
- expect(screen.getByText(/Connected by Jiayuan/)).toBeTruthy();
- });
-
- it("repositories shortcut navigates to the repositories tab", async () => {
- const user = userEvent.setup();
- render(<GitHubTab />, { wrapper: I18nWrapper });
- await user.click(screen.getByRole("button", { name: /Manage repositories/ }));
- expect(mockNavPush).toHaveBeenCalledWith("/acme/settings?tab=repositories");
- });
-});
diff --git a/packages/views/settings/components/github-tab.tsx b/packages/views/settings/components/github-tab.tsx
deleted file mode 100644
index ee3695f80e..0000000000
--- a/packages/views/settings/components/github-tab.tsx
+++ /dev/null
@@ -1,392 +0,0 @@
-"use client";
-
-import { useState } from "react";
-import { useQuery, useQueryClient } from "@tanstack/react-query";
-import { toast } from "sonner";
-import { ExternalLink, GitCommitHorizontal, Link2, PanelRight } from "lucide-react";
-import { Button } from "@multica/ui/components/ui/button";
-import { Card, CardContent } from "@multica/ui/components/ui/card";
-import { Label } from "@multica/ui/components/ui/label";
-import { Switch } from "@multica/ui/components/ui/switch";
-import {
- AlertDialog,
- AlertDialogAction,
- AlertDialogCancel,
- AlertDialogContent,
- AlertDialogDescription,
- AlertDialogFooter,
- AlertDialogHeader,
- AlertDialogTitle,
-} from "@multica/ui/components/ui/alert-dialog";
-import { useAuthStore } from "@multica/core/auth";
-import { useWorkspaceId } from "@multica/core/hooks";
-import { useCurrentWorkspace } from "@multica/core/paths";
-import { memberListOptions, workspaceKeys } from "@multica/core/workspace/queries";
-import { deriveGitHubSettings, githubInstallationsOptions } from "@multica/core/github";
-import { api } from "@multica/core/api";
-import type { Workspace } from "@multica/core/types";
-import { AppLink, useNavigation } from "../../navigation";
-import { useT } from "../../i18n";
-import { SettingsTab } from "./settings-layout";
-import { GitHubMark } from "./github-mark";
-import { PRMergeStatusRow } from "./pr-merge-status-row";
-
-type SettingsKey =
- | "github_enabled"
- | "github_pr_sidebar_enabled"
- | "co_authored_by_enabled"
- | "github_auto_link_prs_enabled";
-
-export function GitHubTab() {
- const { t } = useT("settings");
- const workspace = useCurrentWorkspace();
- const wsId = useWorkspaceId();
- const qc = useQueryClient();
- const navigation = useNavigation();
- const user = useAuthStore((s) => s.user);
-
- const { data: members = [] } = useQuery(memberListOptions(wsId));
- const currentMember = members.find((m) => m.user_id === user?.id) ?? null;
- // `canView` gates the read-only installation list (every workspace member
- // sees it after MUL-2413); `canManage` gates the Connect / Disconnect
- // actions and comes from the backend response (`can_manage`) so the
- // frontend never claims management rights the server would reject.
- const canView = !!currentMember;
-
- const { data: installationData } = useQuery({
- ...githubInstallationsOptions(wsId),
- enabled: !!wsId && canView,
- });
- const installations = installationData?.installations ?? [];
- const configured = installationData?.configured ?? false;
- const canManage = installationData?.can_manage === true;
- const connected = installations.length > 0;
- const primaryInstallation = installations[0] ?? null;
-
- const flags = deriveGitHubSettings(workspace);
- const [savingKey, setSavingKey] = useState<SettingsKey | null>(null);
- const [connecting, setConnecting] = useState(false);
- const [disconnectTarget, setDisconnectTarget] = useState<string | null>(null);
- const [disconnecting, setDisconnecting] = useState(false);
-
- async function persistSetting(key: SettingsKey, next: boolean) {
- if (!workspace || savingKey) return;
- setSavingKey(key);
- try {
- const merged = {
- ...((workspace.settings as Record<string, unknown>) ?? {}),
- [key]: next,
- };
- const updated = await api.updateWorkspace(workspace.id, { settings: merged });
- qc.setQueryData(workspaceKeys.list(), (old: Workspace[] | undefined) =>
- old?.map((ws) => (ws.id === updated.id ? updated : ws)),
- );
- toast.success(t(($) => $.auto_save.toast_saved), {
- id: "settings-auto-save",
- });
- } catch (e) {
- toast.error(e instanceof Error ? e.message : t(($) => $.github.toast_failed));
- } finally {
- setSavingKey(null);
- }
- }
-
- async function handleConnect() {
- setConnecting(true);
- try {
- const resp = await api.getGitHubConnectURL(wsId);
- if (!resp.configured || !resp.url) {
- toast.error(t(($) => $.github.toast_not_configured));
- return;
- }
- window.open(resp.url, "_blank", "noopener");
- } catch (e) {
- toast.error(e instanceof Error ? e.message : t(($) => $.github.toast_open_failed));
- } finally {
- setConnecting(false);
- }
- }
-
- async function handleDisconnect() {
- if (!disconnectTarget || disconnecting) return;
- setDisconnecting(true);
- try {
- await api.deleteGitHubInstallation(wsId, disconnectTarget);
- await qc.invalidateQueries({ queryKey: ["github", wsId] });
- toast.success(t(($) => $.github.toast_disconnected));
- setDisconnectTarget(null);
- } catch (e) {
- toast.error(e instanceof Error ? e.message : t(($) => $.github.toast_disconnect_failed));
- } finally {
- setDisconnecting(false);
- }
- }
-
- if (!workspace) return null;
-
- const repositoriesHref = `${navigation.pathname}?tab=repositories`;
-
- return (
- <SettingsTab
- title={t(($) => $.page.tabs.github)}
- >
- <section className="space-y-3">
- <Card>
- <CardContent>
- <div className="flex items-start justify-between gap-4">
- <div className="flex items-start gap-3">
- <div className="rounded-md border bg-muted/50 p-2 text-muted-foreground">
- <GitHubMark className="h-4 w-4" />
- </div>
- <div className="space-y-1">
- <Label htmlFor="github-master" className="text-body font-medium">
- {t(($) => $.github.section_master)}
- </Label>
- <p className="text-body text-muted-foreground">
- {flags.enabled
- ? t(($) => $.github.master_description_on)
- : t(($) => $.github.master_description_off)}
- </p>
- </div>
- </div>
- <Switch
- id="github-master"
- checked={flags.enabled}
- onCheckedChange={(v) => persistSetting("github_enabled", v)}
- disabled={!canManage || savingKey === "github_enabled"}
- />
- </div>
- </CardContent>
- </Card>
- </section>
-
- <section className="space-y-3">
- <h2 className="text-body font-semibold">{t(($) => $.github.section_connection)}</h2>
- <Card>
- <CardContent className="space-y-4">
- <div className="flex items-start justify-between gap-4">
- <div className="flex items-start gap-3">
- <GitHubMark className="h-6 w-6 mt-0.5 shrink-0" />
- <div className="space-y-1">
- <p className="text-body font-medium">{t(($) => $.github.connection_title)}</p>
- {connected ? (
- <>
- <p className="text-caption text-muted-foreground">
- {t(($) => $.github.connected_to, {
- login: installations.map((i) => i.account_login).join(", "),
- })}
- </p>
- {primaryInstallation?.connected_by && (
- <p className="text-caption text-muted-foreground">
- {t(($) => $.github.connected_by, {
- name: primaryInstallation.connected_by!,
- })}
- </p>
- )}
- </>
- ) : !canManage ? (
- <p className="text-caption text-muted-foreground">
- {t(($) => $.github.contact_admin_to_connect)}
- </p>
- ) : null}
- </div>
- </div>
- {canManage && (
- <div className="flex items-center gap-2">
- {connected && primaryInstallation ? (
- // Disconnect must stay reachable even when the master switch
- // is off — disconnect is a separate intent (revoke the App
- // grant) from hiding the feature.
- <Button
- variant="outline"
- size="sm"
- onClick={() => setDisconnectTarget(primaryInstallation.id)}
- >
- {t(($) => $.github.disconnect)}
- </Button>
- ) : (
- <Button
- size="sm"
- onClick={handleConnect}
- disabled={connecting || !configured}
- title={
- !configured
- ? t(($) => $.github.connect_disabled_tooltip)
- : undefined
- }
- >
- {connecting
- ? t(($) => $.github.connect_opening)
- : t(($) => $.github.connect_github)}
- </Button>
- )}
- </div>
- )}
- </div>
-
- {canManage && !configured && (
- <p className="text-caption text-muted-foreground">
- {t(($) => $.github.not_configured)}{" "}
- <code className="rounded-xs bg-muted px-1 py-0.5 text-micro">GITHUB_APP_SLUG</code>{" "}
- {t(($) => $.github.not_configured_and)}{" "}
- <code className="rounded-xs bg-muted px-1 py-0.5 text-micro">GITHUB_WEBHOOK_SECRET</code>.
- </p>
- )}
-
- {!canManage && connected && (
- <p className="text-caption text-muted-foreground">
- {t(($) => $.github.read_only_hint)}
- </p>
- )}
- </CardContent>
- </Card>
- </section>
-
- <section className="space-y-3">
- <h2 className="text-body font-semibold">{t(($) => $.github.section_features)}</h2>
- <Card className="gap-0 py-0">
- <CardContent className="divide-y divide-surface-border px-0">
- <FeatureRow
- id="github-pr-sidebar"
- icon={<PanelRight className="h-4 w-4" />}
- label={t(($) => $.github.feature_pr_sidebar_label)}
- description={
- <p className="text-body text-muted-foreground">
- {t(($) => $.github.feature_pr_sidebar_description)}
- </p>
- }
- checked={flags.prSidebar}
- disabled={!canManage || !flags.enabled || savingKey === "github_pr_sidebar_enabled"}
- onCheckedChange={(v) => persistSetting("github_pr_sidebar_enabled", v)}
- />
-
- <FeatureRow
- id="github-coauthor"
- icon={<GitCommitHorizontal className="h-4 w-4" />}
- label={t(($) => $.github.feature_co_author_label)}
- description={
- <p className="text-body text-muted-foreground">
- {t(($) => $.github.feature_co_author_description_prefix)}{" "}
- <code className="rounded-xs bg-muted px-1 py-0.5 text-caption">
- {"Co-authored-by: multica-agent <[email protected]>"}
- </code>{" "}
- {t(($) => $.github.feature_co_author_description_suffix)}
- </p>
- }
- checked={flags.coAuthor}
- disabled={!canManage || !flags.enabled || savingKey === "co_authored_by_enabled"}
- onCheckedChange={(v) => persistSetting("co_authored_by_enabled", v)}
- />
-
- <FeatureRow
- id="github-auto-link"
- icon={<Link2 className="h-4 w-4" />}
- label={t(($) => $.github.feature_auto_link_label)}
- description={
- <p className="text-body text-muted-foreground">
- {t(($) => $.github.feature_auto_link_description, { example: "MUL-123" })}
- </p>
- }
- checked={flags.autoLinkPRs}
- disabled={!canManage || !flags.enabled || savingKey === "github_auto_link_prs_enabled"}
- onCheckedChange={(v) => persistSetting("github_auto_link_prs_enabled", v)}
- />
-
- {/* Shared by every code host; the self-hosted Git page shows the
- same value. Greyed out with the rest of the GitHub features when
- the master switch is off. */}
- <PRMergeStatusRow canManage={canManage} disabled={!flags.enabled} />
- </CardContent>
- </Card>
- </section>
-
- <section className="space-y-3">
- <h2 className="text-body font-semibold">{t(($) => $.github.section_repositories)}</h2>
- <Card>
- <CardContent>
- <div className="flex flex-wrap items-center justify-between gap-3">
- <p className="text-body font-medium">
- {t(($) => $.github.repositories_shortcut_label)}
- </p>
- <Button
- variant="outline"
- size="sm"
- render={<AppLink href={repositoriesHref} />}
- nativeButton={false}
- >
- <ExternalLink className="h-3 w-3" />
- {t(($) => $.github.repositories_shortcut_link)}
- </Button>
- </div>
- </CardContent>
- </Card>
- </section>
-
- <AlertDialog
- open={!!disconnectTarget}
- onOpenChange={(v) => {
- if (!v && !disconnecting) setDisconnectTarget(null);
- }}
- >
- <AlertDialogContent>
- <AlertDialogHeader>
- <AlertDialogTitle>
- {t(($) => $.github.disconnect_confirm_title)}
- </AlertDialogTitle>
- <AlertDialogDescription>
- {t(($) => $.github.disconnect_confirm_description)}
- </AlertDialogDescription>
- </AlertDialogHeader>
- <AlertDialogFooter>
- <AlertDialogCancel disabled={disconnecting}>
- {t(($) => $.github.disconnect_confirm_cancel)}
- </AlertDialogCancel>
- <AlertDialogAction onClick={handleDisconnect} disabled={disconnecting}>
- {disconnecting
- ? t(($) => $.github.disconnecting)
- : t(($) => $.github.disconnect_confirm_action)}
- </AlertDialogAction>
- </AlertDialogFooter>
- </AlertDialogContent>
- </AlertDialog>
- </SettingsTab>
- );
-}
-
-function FeatureRow({
- id,
- icon,
- label,
- description,
- checked,
- disabled,
- onCheckedChange,
-}: {
- id: string;
- icon: React.ReactNode;
- label: string;
- description: React.ReactNode;
- checked: boolean;
- disabled: boolean;
- onCheckedChange: (v: boolean) => void;
-}) {
- return (
- <div className="flex items-start justify-between gap-4 px-4 py-3.5">
- <div className="flex items-start gap-3">
- <div className="rounded-md border bg-muted/50 p-2 text-muted-foreground">{icon}</div>
- <div className="space-y-1">
- <Label htmlFor={id} className="text-body font-medium">
- {label}
- </Label>
- {description}
- </div>
- </div>
- <Switch
- id={id}
- checked={checked}
- disabled={disabled}
- onCheckedChange={onCheckedChange}
- />
- </div>
- );
-}
diff --git a/packages/views/settings/components/integrations-tab.test.tsx b/packages/views/settings/components/integrations-tab.test.tsx
deleted file mode 100644
index 204264bcf1..0000000000
--- a/packages/views/settings/components/integrations-tab.test.tsx
+++ /dev/null
@@ -1,188 +0,0 @@
-import { beforeEach, describe, expect, it, vi } from "vitest";
-import { fireEvent, screen } from "@testing-library/react";
-import { ApiError } from "@multica/core/api";
-import { configStore } from "@multica/core/config";
-import { COMPOSIO_MCP_APPS_FLAG } from "@multica/core/feature-flags";
-import { renderWithI18n } from "../../test/i18n";
-
-const state = vi.hoisted(() => ({
- search: "",
- error: null as Error | null,
- connectionError: false,
- pending: false,
- // The IM channels keep revoked rows for audit, so the fixture carries a real
- // status — a row without one is not evidence of a live connection (#8496).
- installationStatus: "active" as string,
- calls: [] as { queryKey: readonly unknown[]; enabled?: boolean }[],
- push: vi.fn(),
-}));
-vi.mock("../../navigation/context", async (importOriginal) => ({
- ...(await importOriginal<typeof import("../../navigation/context")>()),
- useNavigation: () => ({
- pathname: "/acme/settings",
- searchParams: new URLSearchParams(state.search),
- push: state.push,
- }),
-}));
-vi.mock("@multica/core/hooks", () => ({ useWorkspaceId: () => "ws-1" }));
-vi.mock("@multica/core/permissions", () => ({
- useCurrentMember: () => ({ member: { role: "admin" } }),
-}));
-vi.mock("@tanstack/react-query", () => ({
- queryOptions: <T,>(opts: T) => opts,
- infiniteQueryOptions: <T,>(opts: T) => opts,
- useQuery: (opts: {
- queryKey: readonly unknown[];
- enabled?: boolean;
- select?: (data: unknown) => unknown;
- }) => {
- state.calls.push(opts);
- if (opts.queryKey.includes("toolkits"))
- return { error: opts.enabled === false ? null : state.error };
- const data =
- opts.queryKey[0] === "composio"
- ? [{ status: "active" }]
- : {
- installations: [{ id: "one", status: state.installationStatus }],
- connections: [],
- };
- return {
- data: opts.select?.(data),
- isPending: state.pending,
- isError: state.connectionError,
- };
- },
-}));
-vi.mock("./github-tab", () => ({ GitHubTab: () => <div>GitHub detail</div> }));
-vi.mock("./lark-tab", () => ({ LarkTab: () => <div>Lark detail</div> }));
-vi.mock("./composio-tab", () => ({
- ComposioTab: () => <div>Composio detail</div>,
-}));
-vi.mock("./slack-tab", () => ({ SlackTab: () => <div>Slack detail</div> }));
-vi.mock("./dingtalk-tab", () => ({
- DingTalkTab: () => <div>DingTalk detail</div>,
-}));
-vi.mock("./vcs-tab", () => ({ VCSTab: () => <div>VCS detail</div> }));
-vi.mock("./wecom-tab", () => ({ WecomTab: () => <div>WeCom detail</div> }));
-vi.mock("./telegram-tab", () => ({
- TelegramTab: () => <div>Telegram detail</div>,
-}));
-
-import { IntegrationsTab } from "./integrations-tab";
-
-beforeEach(() => {
- state.search = "";
- state.error = null;
- state.connectionError = false;
- state.pending = false;
- state.installationStatus = "active";
- state.calls = [];
- state.push.mockClear();
- configStore.getState().setFeatureFlags({ [COMPOSIO_MCP_APPS_FLAG]: true });
- configStore
- .getState()
- .setAuthConfig({ allowSignup: true, vcsIntegrationAvailable: false });
-});
-
-describe("Integration directory", () => {
- it("shows live connection summaries without mounting configuration forms", () => {
- renderWithI18n(<IntegrationsTab />);
- expect(
- screen.getByRole("link", { name: /GitHub Connected/ }),
- ).toBeInTheDocument();
- expect(screen.queryByText("GitHub detail")).not.toBeInTheDocument();
- const shapes = ["lark", "slack", "dingtalk", "wecom", "telegram"].map(
- (channel) =>
- screen.getByTestId(`integration-channel-icon-${channel}`).innerHTML,
- );
- expect(new Set(shapes).size).toBe(5);
- fireEvent.click(screen.getByRole("link", { name: /GitHub Connected/ }));
- expect(state.push).toHaveBeenCalledWith(
- "/acme/settings?tab=integrations&integration=github",
- );
- });
- it("opens only the selected provider and offers a directory link", () => {
- state.search = "tab=integrations&integration=slack";
- renderWithI18n(<IntegrationsTab />);
- expect(screen.getByText("Slack detail")).toBeInTheDocument();
- expect(screen.queryByText("Lark detail")).not.toBeInTheDocument();
- expect(
- screen.getByRole("link", { name: "All integrations" }),
- ).toHaveAttribute("href", "/acme/settings?tab=integrations");
- });
- it("handles the existing GitHub bookmark", () => {
- state.search = "tab=github";
- renderWithI18n(<IntegrationsTab />);
- expect(screen.getByText("GitHub detail")).toBeInTheDocument();
- });
- it.each(["connected=notion", "error=composio_connect_failed"])(
- "mounts the OAuth result handler for %s",
- (callback) => {
- state.search = `tab=integrations&${callback}`;
- renderWithI18n(<IntegrationsTab />);
- expect(screen.getByText("Composio detail")).toBeInTheDocument();
- },
- );
- it("hides disabled Composio entries and disables their queries", () => {
- configStore.getState().setFeatureFlags({ [COMPOSIO_MCP_APPS_FLAG]: false });
- state.search = "tab=integrations&integration=composio";
- renderWithI18n(<IntegrationsTab />);
- expect(screen.queryByText("Composio detail")).not.toBeInTheDocument();
- expect(
- state.calls
- .filter((call) => call.queryKey[0] === "composio")
- .every((call) => call.enabled === false),
- ).toBe(true);
- });
- it("hides Composio when the server reports it unconfigured", () => {
- state.error = new ApiError("unavailable", 403, "Forbidden", {
- code: "composio_not_configured",
- });
- renderWithI18n(<IntegrationsTab />);
- expect(
- screen.queryByRole("link", { name: /Composio/ }),
- ).not.toBeInTheDocument();
- });
- it("keeps hiding Composio when an older server reports 503", () => {
- state.error = new ApiError("unavailable", 503, "Service Unavailable");
- renderWithI18n(<IntegrationsTab />);
- expect(
- screen.queryByRole("link", { name: /Composio/ }),
- ).not.toBeInTheDocument();
- });
- it("only offers self-hosted Git providers when the deployment enables them", () => {
- const { unmount } = renderWithI18n(<IntegrationsTab />);
- expect(
- screen.queryByRole("link", { name: /Git providers/i }),
- ).not.toBeInTheDocument();
- unmount();
- configStore
- .getState()
- .setAuthConfig({ allowSignup: true, vcsIntegrationAvailable: true });
- state.search = "tab=integrations&integration=vcs";
- renderWithI18n(<IntegrationsTab />);
- expect(screen.getByText("VCS detail")).toBeInTheDocument();
- });
- it("reports revoked IM channels as disconnected while GitHub keeps counting rows", () => {
- // Revoking an IM bot flips status and KEEPS the row, so counting rows would
- // leave a torn-down bot showing a green "Connected" here forever (#8496).
- // GitHub hard-deletes instead, so its count-based read stays correct and a
- // row that is still present really does mean connected.
- state.installationStatus = "revoked";
- renderWithI18n(<IntegrationsTab />);
- expect(
- screen.getByRole("link", { name: /GitHub Connected/ }),
- ).toBeInTheDocument();
- for (const channel of ["Lark", "Slack", "DingTalk", "WeCom", "Telegram"]) {
- expect(
- screen.getByRole("link", { name: new RegExp(`${channel} Not connected`) }),
- ).toBeInTheDocument();
- }
- });
- it("does not report failed status reads as disconnected", () => {
- state.connectionError = true;
- renderWithI18n(<IntegrationsTab />);
- expect(screen.getAllByText("Status unavailable").length).toBeGreaterThan(0);
- expect(screen.queryByText("Not connected")).not.toBeInTheDocument();
- });
-});
diff --git a/packages/views/settings/components/integrations-tab.tsx b/packages/views/settings/components/integrations-tab.tsx
deleted file mode 100644
index a160ae95e6..0000000000
--- a/packages/views/settings/components/integrations-tab.tsx
+++ /dev/null
@@ -1,332 +0,0 @@
-"use client";
-
-import type { ReactNode } from "react";
-import { ArrowLeft, ChevronRight, FolderGit2, Blocks } from "lucide-react";
-import { useQuery } from "@tanstack/react-query";
-import { ApiError, errorCode } from "@multica/core/api";
-import { useWorkspaceId } from "@multica/core/hooks";
-import { useCurrentMember } from "@multica/core/permissions";
-import {
- composioToolkitsOptions,
- composioConnectionsOptions,
-} from "@multica/core/composio";
-import { githubInstallationsOptions } from "@multica/core/github";
-import { larkInstallationsOptions } from "@multica/core/lark";
-import { slackInstallationsOptions } from "@multica/core/slack";
-import { dingtalkInstallationsOptions } from "@multica/core/dingtalk";
-import { wecomInstallationsOptions } from "@multica/core/wecom";
-import { telegramInstallationsOptions } from "@multica/core/telegram";
-import { vcsConnectionsOptions } from "@multica/core/vcs";
-import { useConfigStore, useFeatureEnabled } from "@multica/core/config";
-import { COMPOSIO_MCP_APPS_FLAG } from "@multica/core/feature-flags";
-import { cn } from "@multica/ui/lib/utils";
-import { AppLink, useNavigation } from "../../navigation";
-import { useT } from "../../i18n";
-import { LarkTab } from "./lark-tab";
-import { ComposioTab } from "./composio-tab";
-import { SlackTab } from "./slack-tab";
-import { DingTalkTab } from "./dingtalk-tab";
-import { VCSTab } from "./vcs-tab";
-import { WecomTab } from "./wecom-tab";
-import { TelegramTab } from "./telegram-tab";
-import { GitHubTab } from "./github-tab";
-import { GitHubMark } from "./github-mark";
-import { SettingsCard, SettingsSection, SettingsTab } from "./settings-layout";
-import { IntegrationChannelIcon } from "./integration-channel-icon";
-import { resolveSettingsLocation, settingsHref } from "./settings-navigation";
-
-interface ConnectionState {
- data?: boolean;
- isPending: boolean;
- isError: boolean;
-}
-
-interface IntegrationEntry {
- id: string;
- label: string;
- description: string;
- icon: ReactNode;
- content: ReactNode;
- state: ConnectionState;
-}
-
-// The IM channels soft-revoke: the row survives with status 'revoked', so a row
-// count never falls back to zero and would report a torn-down bot as connected
-// forever. GitHub and VCS hard-delete instead, so their count-based reads below
-// are correct and deliberately left as they are (#8496).
-const hasActiveInstallation = (data: {
- installations?: { status: string }[];
-}) => data.installations?.some((inst) => inst.status === "active") ?? false;
-
-export function IntegrationsTab() {
- const { t } = useT("settings");
- const navigation = useNavigation();
- const wsId = useWorkspaceId();
- const { member } = useCurrentMember(wsId);
- const canView = !!wsId && !!member;
- const composioEnabled = useFeatureEnabled(COMPOSIO_MCP_APPS_FLAG, false);
- const vcsAvailable = useConfigStore((s) => s.vcsIntegrationAvailable);
- const toolkits = useQuery({
- ...composioToolkitsOptions(),
- enabled: composioEnabled,
- });
- const composioAvailable =
- composioEnabled &&
- errorCode(toolkits.error) !== "composio_not_configured" &&
- !(toolkits.error instanceof ApiError && toolkits.error.status === 503);
-
- // Reuse the detail pages' query caches. Never report a failed or pending read
- // as disconnected, and do not issue deployment-disabled integration queries.
- const github = useQuery({
- ...githubInstallationsOptions(wsId),
- enabled: canView,
- select: (data) => (data.installations?.length ?? 0) > 0,
- });
- const lark = useQuery({
- ...larkInstallationsOptions(wsId),
- enabled: canView,
- select: hasActiveInstallation,
- });
- const slack = useQuery({
- ...slackInstallationsOptions(wsId),
- enabled: canView,
- select: hasActiveInstallation,
- });
- const dingtalk = useQuery({
- ...dingtalkInstallationsOptions(wsId),
- enabled: canView,
- select: hasActiveInstallation,
- });
- const wecom = useQuery({
- ...wecomInstallationsOptions(wsId),
- enabled: canView,
- select: hasActiveInstallation,
- });
- const telegram = useQuery({
- ...telegramInstallationsOptions(wsId),
- enabled: canView,
- select: hasActiveInstallation,
- });
- const vcs = useQuery({
- ...vcsConnectionsOptions(wsId),
- enabled: canView && vcsAvailable,
- select: (data) => (data.connections?.length ?? 0) > 0,
- });
- const composio = useQuery({
- ...composioConnectionsOptions(),
- enabled: composioAvailable,
- select: (data) => data.some((connection) => connection.status === "active"),
- });
- const groups: {
- id: string;
- label: string;
- description?: string;
- entries: IntegrationEntry[];
- }[] = [
- {
- id: "code",
- label: t(($) => $.integrations.code_title),
- entries: [
- {
- id: "github",
- label: t(($) => $.page.tabs.github),
- description: t(($) => $.integrations.github_hint),
- icon: <GitHubMark className="size-5" />,
- content: <GitHubTab />,
- state: github,
- },
- ...(vcsAvailable
- ? [
- {
- id: "vcs",
- label: t(($) => $.vcs.section_title),
- description: t(($) => $.integrations.vcs_hint),
- icon: <FolderGit2 className="size-5" />,
- content: <VCSTab />,
- state: vcs,
- },
- ]
- : []),
- ],
- },
- {
- id: "messaging",
- label: t(($) => $.integrations.messaging_title),
- entries: [
- {
- id: "lark",
- label: t(($) => $.lark.section_title),
- description: t(($) => $.lark.page_description),
- icon: <IntegrationChannelIcon channel="lark" />,
- content: <LarkTab />,
- state: lark,
- },
- {
- id: "slack",
- label: t(($) => $.slack.section_title),
- description: t(($) => $.slack.page_description),
- icon: <IntegrationChannelIcon channel="slack" />,
- content: <SlackTab />,
- state: slack,
- },
- {
- id: "dingtalk",
- label: t(($) => $.dingtalk.section_title),
- description: t(($) => $.dingtalk.page_description),
- icon: <IntegrationChannelIcon channel="dingtalk" />,
- content: <DingTalkTab />,
- state: dingtalk,
- },
- {
- id: "wecom",
- label: t(($) => $.wecom.section_title),
- description: t(($) => $.wecom.page_description),
- icon: <IntegrationChannelIcon channel="wecom" />,
- content: <WecomTab />,
- state: wecom,
- },
- {
- id: "telegram",
- label: t(($) => $.telegram.section_title),
- description: t(($) => $.telegram.page_description),
- icon: <IntegrationChannelIcon channel="telegram" />,
- content: <TelegramTab />,
- state: telegram,
- },
- ],
- },
- ...(composioAvailable
- ? [
- {
- id: "apps",
- label: t(($) => $.integrations.apps_title),
- description: t(($) => $.integrations.apps_scope),
- entries: [
- {
- id: "composio",
- label: t(($) => $.composio.section_title),
- description: t(($) => $.integrations.apps_hint),
- icon: <Blocks className="size-5" />,
- content: <ComposioTab />,
- state: composio,
- },
- ],
- },
- ]
- : []),
- ];
- // The OAuth service still returns to ?tab=integrations with one-shot params.
- // Mount its owning page so it can consume the callback and refresh its cache.
- const hasComposioCallback =
- navigation.searchParams.has("connected") ||
- navigation.searchParams.get("error") === "composio_connect_failed";
- const requested = hasComposioCallback
- ? "composio"
- : resolveSettingsLocation(navigation.searchParams).integration;
- const selected = groups
- .flatMap((group) => group.entries)
- .find((item) => item.id === requested);
- const href = (integration?: string) =>
- settingsHref(navigation.pathname, navigation.searchParams, "integrations", {
- integration,
- });
-
- if (selected) {
- return (
- <div className="space-y-6">
- <AppLink
- href={href()}
- className="inline-flex items-center gap-2 rounded-md text-body text-muted-foreground hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring"
- >
- <ArrowLeft className="size-4" aria-hidden="true" />
- {t(($) => $.integrations.back)}
- </AppLink>
- {selected.id === "github" ? (
- selected.content
- ) : (
- <SettingsTab
- title={selected.label}
- description={selected.description}
- >
- {selected.content}
- </SettingsTab>
- )}
- </div>
- );
- }
-
- return (
- <SettingsTab
- title={t(($) => $.page.tabs.integrations)}
- >
- {groups.map((group) => (
- <SettingsSection
- key={group.id}
- title={group.label}
- description={group.description}
- >
- <SettingsCard>
- {group.entries.map((item) => (
- <AppLink
- key={item.id}
- href={href(item.id)}
- className="group flex items-center gap-4 px-4 py-5 first:rounded-t-xl last:rounded-b-xl hover:bg-surface-hover focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring"
- >
- <span
- aria-hidden="true"
- className="flex size-11 shrink-0 items-center justify-center rounded-xl border border-surface-border bg-background text-foreground"
- >
- {item.icon}
- </span>
- <span className="min-w-0 flex-1">
- <span className="flex flex-wrap items-center gap-x-3 gap-y-1">
- <span className="text-body font-medium text-foreground">
- {item.label}
- </span>{" "}
- <ConnectionBadge state={item.state} />{" "}
- </span>
- <span className="mt-1 block text-caption leading-5 text-muted-foreground">
- {group.id === "messaging"
- ? t(($) => $.integrations.channel_hint, {
- channel: item.label,
- })
- : item.description}
- </span>
- </span>
- <ChevronRight
- className="size-4 shrink-0 text-muted-foreground group-hover:text-foreground"
- aria-hidden="true"
- />
- </AppLink>
- ))}
- </SettingsCard>
- </SettingsSection>
- ))}
- </SettingsTab>
- );
-}
-
-function ConnectionBadge({ state }: { state: ConnectionState }) {
- const { t } = useT("settings");
- const connected = !state.isError && !state.isPending && state.data === true;
- const label = state.isError
- ? t(($) => $.integrations.status_unknown)
- : state.isPending
- ? t(($) => $.integrations.status_loading)
- : connected
- ? t(($) => $.integrations.status_connected)
- : t(($) => $.integrations.status_not_connected);
- return (
- <span
- className={cn(
- "inline-flex items-center gap-1.5 text-caption",
- connected ? "text-success" : "text-muted-foreground",
- )}
- >
- {connected && (
- <span aria-hidden="true" className="size-1.5 rounded-full bg-success" />
- )}
- {label}
- </span>
- );
-}
diff --git a/packages/views/settings/components/issue-statuses-tab.test.tsx b/packages/views/settings/components/issue-statuses-tab.test.tsx
index 796be1ca04..00bd405970 100644
--- a/packages/views/settings/components/issue-statuses-tab.test.tsx
+++ b/packages/views/settings/components/issue-statuses-tab.test.tsx
@@ -112,7 +112,6 @@ const BUILT_IN_IN_REVIEW = entry({
position: 0,
});
-// Two switches now render (show archived, PR auto-complete); name the one meant.
const archivedToggle = () =>
screen.queryByRole("switch", { name: new RegExp(`^${en.issue_statuses.show_archived.split(" (")[0]}`) });
@@ -135,11 +134,11 @@ describe("IssueStatusesTab", () => {
const QA = entry({ key: "qa", name: "QA" });
const badgeLink = () => screen.getByText(en.issue_statuses.pr_auto_complete_badge).closest("a");
- it("badges Done by default and links to the GitHub setting", () => {
+ it("badges Done by default and links to the rule on the Code page", () => {
catalog = [BUILT_IN_DONE, QA];
render(<IssueStatusesTab />);
expect(screen.getAllByText(en.issue_statuses.pr_auto_complete_badge)).toHaveLength(1);
- expect(badgeLink()?.getAttribute("href")).toBe("/acme/settings?tab=integrations&integration=github");
+ expect(badgeLink()?.getAttribute("href")).toBe("/acme/settings?tab=code&section=pr-merge-status");
expect(badgeLink()?.closest(".group\\/row")).toHaveTextContent(en.issue_statuses.built_in_descriptions.done);
});
@@ -443,34 +442,27 @@ describe("IssueStatusesTab", () => {
]);
});
- it.each([
- ["edit", "click"], ["archive", "click"],
- ["edit", "enter"], ["archive", "enter"],
- ["edit", "escape"], ["archive", "escape"],
- ] as const)("dismisses the built-in %s notice using %s", async (action, dismiss) => {
+ it("locks the definition of built-in statuses where the actions are", async () => {
const user = userEvent.setup();
- catalog = [BUILT_IN_IN_REVIEW];
+ catalog = [BUILT_IN_IN_REVIEW, entry({ key: "qa", name: "QA", position: 1 })];
render(<IssueStatusesTab />);
const trigger = screen.getByLabelText(
en.issue_statuses.actions.open.replace("{{name}}", "in_review"),
);
expect(trigger.className).toContain("group-focus-within/row:opacity-100");
expect(trigger.className).toContain("data-popup-open:opacity-100");
- fireEvent.click(trigger);
- fireEvent.click(await screen.findByRole("menuitem", { name: en.issue_statuses.actions[action] }));
- const dialog = await screen.findByRole("alertdialog");
- expect(within(dialog).getByText(en.issue_statuses.built_in_dialog.description)).toBeInTheDocument();
- expect(screen.queryByLabelText(en.issue_statuses.editor.name)).toBeNull();
- const close = within(dialog).getByRole("button", { name: en.issue_statuses.built_in_dialog.confirm });
- if (dismiss === "click") {
- await user.click(close);
- } else {
- close.focus();
- await user.keyboard(dismiss === "enter" ? "{Enter}" : "{Escape}");
- }
- await waitFor(() => expect(screen.queryByRole("alertdialog")).toBeNull());
- // Closing must release the modal layer, not leave Settings inaccessible.
- await user.click(screen.getByLabelText(`${en.issue_statuses.add}: ${en.issue_statuses.category_labels.started}`));
- expect(await screen.findByRole("dialog")).toBeInTheDocument();
+ await user.click(trigger);
+ const edit = await screen.findByRole("menuitem", { name: en.issue_statuses.actions.edit });
+ const archive = screen.getByRole("menuitem", { name: en.issue_statuses.actions.archive });
+ expect(edit).toHaveAttribute("aria-disabled", "true");
+ expect(archive).toHaveAttribute("aria-disabled", "true");
+ expect(screen.getByText(en.issue_statuses.built_in_locked)).toBeInTheDocument();
+ // Reordering stays available for built-ins.
+ expect(
+ screen.getByRole("menuitem", { name: en.issue_statuses.actions.move_down }),
+ ).not.toHaveAttribute("aria-disabled", "true");
+ await user.click(edit);
+ expect(screen.queryByRole("dialog")).toBeNull();
+ expect(screen.queryByRole("alertdialog")).toBeNull();
});
});
diff --git a/packages/views/settings/components/issue-statuses-tab.tsx b/packages/views/settings/components/issue-statuses-tab.tsx
index 751f718acb..a5ce288b02 100644
--- a/packages/views/settings/components/issue-statuses-tab.tsx
+++ b/packages/views/settings/components/issue-statuses-tab.tsx
@@ -8,6 +8,7 @@ import {
ArrowDown,
ArrowUp,
GripVertical,
+ Lock,
MoreHorizontal,
Pencil,
Plus,
@@ -105,7 +106,10 @@ import { StatusIcon } from "../../issues/components/status-icon";
import { useStatusLabel } from "../../issues/utils/status-label";
import { useT } from "../../i18n";
import { AppLink, useNavigation } from "../../navigation";
-import { SettingsTab } from "./settings-layout";
+import {
+ SettingsReadOnlyNotice,
+ SettingsTab,
+} from "./settings-layout";
import { settingsHref } from "./settings-navigation";
/**
@@ -151,7 +155,6 @@ export function IssueStatusesTab() {
const [archiveOpen, setArchiveOpen] = useState(false);
const [inspection, setInspection] = useState<{ workspaceId: string; status: IssueStatusEntry } | null>(null);
const [inspectionOpen, setInspectionOpen] = useState(false);
- const [showBuiltInNotice, setShowBuiltInNotice] = useState(false);
const { data: statuses = [], isLoading } = useQuery(issueStatusListOptions(wsId));
const { data: members = [] } = useQuery(memberListOptions(wsId));
@@ -161,11 +164,11 @@ export function IssueStatusesTab() {
return members.find((m) => m.user_id === currentUser.id)?.role ?? null;
}, [members, currentUser]);
const isAdmin = myRole === "owner" || myRole === "admin";
- // The status a merge moves issues to is set on the GitHub page (MUL-7726);
+ // The status a merge moves issues to is set on the Code page (MUL-7726);
// its row carries a badge linking there.
const mergeTarget = derivePRMergeStatus(useCurrentWorkspace());
- const mergeSettingsHref = settingsHref(navigation.pathname, navigation.searchParams, "integrations", {
- integration: "github",
+ const mergeSettingsHref = settingsHref(navigation.pathname, navigation.searchParams, "code", {
+ section: "pr-merge-status",
});
const groups = useMemo(
@@ -195,51 +198,47 @@ export function IssueStatusesTab() {
return (
<SettingsTab
- title={t(($) => $.issue_statuses.title)}
- >
- <div className="space-y-4">
- {isAdmin && (
- <p className="text-caption text-muted-foreground">{t(($) => $.issue_statuses.reorder_hint)}</p>
- )}
- {/* Offered only once the workspace has something archived. A permanently
- disabled "Show archived (0)" is a control that can never do
- anything. */}
- {archivedCount > 0 && (
- <label className="flex items-center justify-end gap-2 text-caption text-muted-foreground">
+ title={t(($) => $.page.tabs.issue_statuses)}
+ description={isAdmin ? t(($) => $.issue_statuses.reorder_hint) : undefined}
+ scope="workspace"
+ actions={
+ // Offered only once the workspace has something archived. A
+ // permanently disabled "Show archived (0)" is a control that can
+ // never do anything.
+ archivedCount > 0 ? (
+ <label className="flex items-center gap-2 text-caption text-muted-foreground">
{t(($) => $.issue_statuses.show_archived, { count: archivedCount })}
<Switch checked={showArchived} onCheckedChange={setShowArchived} />
</label>
- )}
-
- {isLoading ? (
- <div className="rounded-lg border border-surface-border bg-card px-4 py-12 text-center text-body text-muted-foreground">
- {t(($) => $.issue_statuses.loading)}
- </div>
- ) : (
- // The four categories are sections of a single
- // workflow, and separate borders made them read as unrelated
- // settings.
- <div className="overflow-hidden rounded-lg border border-surface-border bg-card">
- {groups.map((group) => (
- <CategorySection
- key={`${wsId}:${group.category}`}
- category={group.category}
- entries={group.entries}
- canManage={isAdmin}
- mergeTarget={mergeTarget}
- mergeSettingsHref={mergeSettingsHref}
- onCreate={() => setCreateCategory(group.category)}
- onEdit={(entry) => entry.is_system ? setShowBuiltInNotice(true) : setEditing(entry)}
- onArchive={(entry) => {
- if (entry.is_system) setShowBuiltInNotice(true);
- else { setPendingArchive(entry); setArchiveOpen(true); }
- }}
- onViewIssues={viewIssues}
- />
- ))}
- </div>
- )}
- </div>
+ ) : undefined
+ }
+ >
+ {myRole && !isAdmin ? <SettingsReadOnlyNotice wsId={wsId} /> : null}
+ {isLoading ? (
+ <div className="rounded-lg border border-surface-border bg-card px-4 py-12 text-center text-body text-muted-foreground">
+ {t(($) => $.issue_statuses.loading)}
+ </div>
+ ) : (
+ // The four categories are sections of a single
+ // workflow, and separate borders made them read as unrelated
+ // settings.
+ <div className="overflow-hidden rounded-lg border border-surface-border bg-card">
+ {groups.map((group) => (
+ <CategorySection
+ key={`${wsId}:${group.category}`}
+ category={group.category}
+ entries={group.entries}
+ canManage={isAdmin}
+ mergeTarget={mergeTarget}
+ mergeSettingsHref={mergeSettingsHref}
+ onCreate={() => setCreateCategory(group.category)}
+ onEdit={(entry) => setEditing(entry)}
+ onArchive={(entry) => { setPendingArchive(entry); setArchiveOpen(true); }}
+ onViewIssues={viewIssues}
+ />
+ ))}
+ </div>
+ )}
<StatusEditorDialog
open={createCategory !== null}
@@ -260,19 +259,6 @@ export function IssueStatusesTab() {
{inspection?.workspaceId === wsId && <StatusIssueInspection key={`${wsId}:${inspection.status.key}`} status={inspection.status} onClose={() => setInspectionOpen(false)} />}
</DialogContent>
</Dialog>
- <AlertDialog open={showBuiltInNotice} onOpenChange={setShowBuiltInNotice}>
- <AlertDialogContent>
- <AlertDialogHeader>
- <AlertDialogTitle>{t(($) => $.issue_statuses.built_in_dialog.title)}</AlertDialogTitle>
- <AlertDialogDescription>{t(($) => $.issue_statuses.built_in_dialog.description)}</AlertDialogDescription>
- </AlertDialogHeader>
- <AlertDialogFooter>
- <AlertDialogCancel variant="default">
- {t(($) => $.issue_statuses.built_in_dialog.confirm)}
- </AlertDialogCancel>
- </AlertDialogFooter>
- </AlertDialogContent>
- </AlertDialog>
</SettingsTab>
);
}
@@ -540,14 +526,23 @@ function StatusRow({
{t(($) => $.issue_statuses.actions.move_down)}
</DropdownMenuItem>
<DropdownMenuSeparator />
- <DropdownMenuItem onClick={onEdit}>
+ {/* Built-ins drive system behavior, so their definition is locked.
+ Say so where the actions are instead of offering them and
+ refusing afterwards. */}
+ <DropdownMenuItem disabled={entry.is_system} onClick={onEdit}>
<Pencil className="size-4" />
{t(($) => $.issue_statuses.actions.edit)}
</DropdownMenuItem>
- <DropdownMenuItem variant="destructive" onClick={onArchive}>
+ <DropdownMenuItem variant="destructive" disabled={entry.is_system} onClick={onArchive}>
<Archive className="size-4" />
{t(($) => $.issue_statuses.actions.archive)}
</DropdownMenuItem>
+ {entry.is_system && (
+ <p className="flex max-w-64 gap-1.5 px-2 pb-1 pt-1.5 text-caption leading-4 text-muted-foreground">
+ <Lock className="mt-0.5 size-3 shrink-0" aria-hidden="true" />
+ {t(($) => $.issue_statuses.built_in_locked)}
+ </p>
+ )}
</DropdownMenuContent>
</DropdownMenu>
)}
diff --git a/packages/views/settings/components/issue-tab.test.tsx b/packages/views/settings/components/issue-tab.test.tsx
deleted file mode 100644
index a5d057da0b..0000000000
--- a/packages/views/settings/components/issue-tab.test.tsx
+++ /dev/null
@@ -1,76 +0,0 @@
-import { afterEach, beforeEach, describe, expect, it } from "vitest";
-import { cleanup, screen } from "@testing-library/react";
-import userEvent from "@testing-library/user-event";
-import {
- DEFAULT_MANUAL_CREATE_FIELDS,
- DEFAULT_QUICK_CREATE_FIELDS,
- useIssueCreateSettingsStore,
-} from "@multica/core/issues/stores/issue-create-settings-store";
-import { renderWithI18n } from "../../test/i18n";
-import { IssueTab } from "./issue-tab";
-
-function resetStore() {
- useIssueCreateSettingsStore.setState({
- quickCreateFields: DEFAULT_QUICK_CREATE_FIELDS,
- manualCreateFields: DEFAULT_MANUAL_CREATE_FIELDS,
- });
-}
-
-describe("IssueTab", () => {
- beforeEach(resetStore);
-
- afterEach(() => {
- cleanup();
- resetStore();
- });
-
- it("renders a switch per field with the persisted selection", () => {
- renderWithI18n(<IssueTab />);
-
- // 3 quick create fields + 7 manual create fields.
- const switches = screen.getAllByRole("switch");
- expect(switches).toHaveLength(10);
-
- // Quick create defaults to project only.
- const [quickProject, quickPriority, quickDueDate] = switches;
- expect(quickProject).toBeChecked();
- expect(quickPriority).not.toBeChecked();
- expect(quickDueDate).not.toBeChecked();
-
- // Manual create defaults to the classic toolbar; dates start hidden.
- const manual = switches.slice(3);
- for (const s of manual.slice(0, 5)) expect(s).toBeChecked();
- expect(manual[5]).not.toBeChecked();
- expect(manual[6]).not.toBeChecked();
- });
-
- it("persists enabling a quick create field", async () => {
- const user = userEvent.setup();
- renderWithI18n(<IssueTab />);
-
- const [, quickPriority] = screen.getAllByRole("switch");
- await user.click(quickPriority!);
-
- expect(useIssueCreateSettingsStore.getState().quickCreateFields).toEqual([
- "project",
- "priority",
- ]);
- });
-
- it("persists hiding a manual create field without touching quick create", async () => {
- const user = userEvent.setup();
- renderWithI18n(<IssueTab />);
-
- // Manual section starts at index 3; labels is its 4th row (index 6 overall).
- const manualLabels = screen.getAllByRole("switch")[6];
- await user.click(manualLabels!);
-
- expect(useIssueCreateSettingsStore.getState().manualCreateFields).toEqual([
- "status",
- "priority",
- "assignee",
- "project",
- ]);
- expect(useIssueCreateSettingsStore.getState().quickCreateFields).toEqual(["project"]);
- });
-});
diff --git a/packages/views/settings/components/issue-tab.tsx b/packages/views/settings/components/issue-tab.tsx
deleted file mode 100644
index fd4ba827a1..0000000000
--- a/packages/views/settings/components/issue-tab.tsx
+++ /dev/null
@@ -1,82 +0,0 @@
-"use client";
-
-import { Switch } from "@multica/ui/components/ui/switch";
-import {
- MANUAL_CREATE_FIELDS,
- QUICK_CREATE_FIELDS,
- useIssueCreateSettingsStore,
-} from "@multica/core/issues/stores/issue-create-settings-store";
-import { toast } from "sonner";
-import { useT } from "../../i18n";
-import { SettingsCard, SettingsRow, SettingsSection } from "./settings-layout";
-
-/**
- * Issue preferences. One group per create-issue
- * mode (agent quick create / manual create), each a switch list of the fields
- * that mode keeps on its dialog toolbar. Persisted client-side per workspace;
- * a field toggled off stays reachable from the dialog's ⋯ overflow and
- * re-surfaces automatically while it holds a value, so hiding is never
- * destructive.
- */
-export function IssueTab() {
- const { t } = useT("settings");
- const quickFields = useIssueCreateSettingsStore((s) => s.quickCreateFields);
- const setQuickVisible = useIssueCreateSettingsStore(
- (s) => s.setQuickCreateFieldVisible,
- );
- const manualFields = useIssueCreateSettingsStore((s) => s.manualCreateFields);
- const setManualVisible = useIssueCreateSettingsStore(
- (s) => s.setManualCreateFieldVisible,
- );
-
- const savedToast = () =>
- toast.success(
- t(($) => $.auto_save.toast_saved),
- { id: "settings-auto-save" },
- );
-
- return (
- <div className="space-y-8">
- <p className="text-caption text-muted-foreground">
- {t(($) => $.preferences.issue_scope)}
- </p>
- <SettingsSection
- title={t(($) => $.issue.quick_create_title)}
- >
- <SettingsCard>
- {QUICK_CREATE_FIELDS.map((field) => (
- <SettingsRow key={field} label={t(($) => $.issue.fields[field])}>
- <Switch
- checked={quickFields.includes(field)}
- onCheckedChange={(checked) => {
- setQuickVisible(field, checked);
- savedToast();
- }}
- aria-label={t(($) => $.issue.fields[field])}
- />
- </SettingsRow>
- ))}
- </SettingsCard>
- </SettingsSection>
-
- <SettingsSection
- title={t(($) => $.issue.manual_create_title)}
- >
- <SettingsCard>
- {MANUAL_CREATE_FIELDS.map((field) => (
- <SettingsRow key={field} label={t(($) => $.issue.fields[field])}>
- <Switch
- checked={manualFields.includes(field)}
- onCheckedChange={(checked) => {
- setManualVisible(field, checked);
- savedToast();
- }}
- aria-label={t(($) => $.issue.fields[field])}
- />
- </SettingsRow>
- ))}
- </SettingsCard>
- </SettingsSection>
- </div>
- );
-}
diff --git a/packages/views/settings/components/keyboard-shortcuts-tab.tsx b/packages/views/settings/components/keyboard-shortcuts-tab.tsx
index 509909eeec..6a5ad8e54e 100644
--- a/packages/views/settings/components/keyboard-shortcuts-tab.tsx
+++ b/packages/views/settings/components/keyboard-shortcuts-tab.tsx
@@ -115,6 +115,7 @@ export function KeyboardShortcutsTab() {
<SettingsTab
title={t(($) => $.shortcuts.title)}
description={t(($) => $.shortcuts.description)}
+ scope="device"
>
<div className="flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between">
<div className="relative min-w-0 flex-1 sm:max-w-sm">
diff --git a/packages/views/settings/components/labels-tab.test.tsx b/packages/views/settings/components/labels-tab.test.tsx
index 1ac2c873fd..456f7f3270 100644
--- a/packages/views/settings/components/labels-tab.test.tsx
+++ b/packages/views/settings/components/labels-tab.test.tsx
@@ -1,14 +1,25 @@
import { afterEach, describe, expect, it, vi } from "vitest";
import { cleanup, screen } from "@testing-library/react";
+import userEvent from "@testing-library/user-event";
import { renderWithI18n } from "../../test/i18n";
import { LabelsTab } from "./labels-tab";
+import { LabelManager } from "../../labels/label-manager";
vi.mock("@multica/core/hooks", () => ({
useWorkspaceId: () => "workspace-1",
}));
+const queried = vi.hoisted(() => ({ keys: [] as unknown[][] }));
vi.mock("@tanstack/react-query", () => ({
- useQuery: () => ({ data: [], isLoading: false }),
+ queryOptions: <T,>(options: T) => options,
+ useQuery: (options: { queryKey: unknown[] }) => {
+ queried.keys.push(options.queryKey);
+ return { data: [], isLoading: false };
+ },
+}));
+
+vi.mock("@multica/core/paths", () => ({
+ useCurrentWorkspace: () => ({ id: "workspace-1", name: "Acme" }),
}));
vi.mock("@multica/core/labels", () => ({
@@ -20,17 +31,35 @@ vi.mock("@multica/core/labels", () => ({
useDeleteLabel: () => ({ mutate: vi.fn(), isPending: false }),
}));
-describe("LabelsTab scopes", () => {
- afterEach(cleanup);
+describe("Label catalogs", () => {
+ afterEach(() => {
+ cleanup();
+ queried.keys = [];
+ });
- // Agent labels were removed from the product (MUL-5600). The backend still
- // models the `agent` resource type, so the guard here is that the settings
- // UI never offers it as a manageable catalog again.
- it("offers only the issue and skill catalogs", () => {
+ // Agent labels were removed from the product (MUL-5600) even though the
+ // backend still models the `agent` resource type.
+ it("switches between the issue and skill catalogs, never agent labels", async () => {
+ const user = userEvent.setup();
renderWithI18n(<LabelsTab />);
- expect(screen.getByRole("button", { name: /Issues/ })).toBeInTheDocument();
- expect(screen.getByRole("button", { name: /Skills/ })).toBeInTheDocument();
- expect(screen.queryByRole("button", { name: /Agents/ })).toBeNull();
+ const issues = screen.getByRole("tab", { name: /Issues/ });
+ expect(issues).toHaveAttribute("aria-selected", "true");
+ expect(screen.getByRole("tab", { name: /Skills/ })).toHaveAttribute("aria-selected", "false");
+ expect(screen.queryByRole("tab", { name: /Agents/ })).toBeNull();
+
+ queried.keys = [];
+ await user.click(screen.getByRole("tab", { name: /Skills/ }));
+
+ expect(screen.getByRole("tab", { name: /Skills/ })).toHaveAttribute("aria-selected", "true");
+ expect(queried.keys).toContainEqual(["labels", "workspace-1", "list", "skill"]);
+ expect(queried.keys.some((key) => key.includes("agent"))).toBe(false);
+ });
+
+ it("manages the skill catalog where it is mounted for skills", () => {
+ renderWithI18n(<LabelManager scope="skill" />);
+
+ expect(queried.keys).toContainEqual(["labels", "workspace-1", "list", "skill"]);
+ expect(screen.getByRole("button", { name: /New label/ })).toBeInTheDocument();
});
});
diff --git a/packages/views/settings/components/labels-tab.tsx b/packages/views/settings/components/labels-tab.tsx
index 949b9f81e4..c6d41bdff3 100644
--- a/packages/views/settings/components/labels-tab.tsx
+++ b/packages/views/settings/components/labels-tab.tsx
@@ -1,432 +1,45 @@
"use client";
-import { useEffect, useMemo, useState } from "react";
+import { useState } from "react";
import { useQuery } from "@tanstack/react-query";
-import { MoreHorizontal, Pencil, Plus, Search, Tag, Trash2 } from "lucide-react";
-import { toast } from "sonner";
import { useWorkspaceId } from "@multica/core/hooks";
-import {
- labelListOptions,
- useCreateLabel,
- useDeleteLabel,
- useUpdateLabel,
-} from "@multica/core/labels";
-import type { Label, LabelResourceType } from "@multica/core/types";
-import { Button } from "@multica/ui/components/ui/button";
-import { Input } from "@multica/ui/components/ui/input";
-import { Textarea } from "@multica/ui/components/ui/textarea";
-import { Label as FieldLabel } from "@multica/ui/components/ui/label";
-import {
- Dialog,
- DialogContent,
- DialogDescription,
- DialogFooter,
- DialogHeader,
- DialogTitle,
-} from "@multica/ui/components/ui/dialog";
-import {
- AlertDialog,
- AlertDialogAction,
- AlertDialogCancel,
- AlertDialogContent,
- AlertDialogDescription,
- AlertDialogFooter,
- AlertDialogHeader,
- AlertDialogTitle,
-} from "@multica/ui/components/ui/alert-dialog";
-import {
- DropdownMenu,
- DropdownMenuContent,
- DropdownMenuItem,
- DropdownMenuTrigger,
-} from "@multica/ui/components/ui/dropdown-menu";
-import { cn } from "@multica/ui/lib/utils";
-import { ColorPicker, COLOR_PICKER_PRESETS } from "../../common/color-picker";
-import { useLocale, useT } from "../../i18n";
-import { SettingsTab } from "./settings-layout";
+import { labelListOptions } from "@multica/core/labels";
+import { useT } from "../../i18n";
+import { LabelManager, type LabelScope } from "../../labels/label-manager";
+import { SettingsTab, SettingsViewTabs } from "./settings-layout";
/**
- * Label scopes this settings tab manages. Narrower than `LabelResourceType`:
- * the backend still models agent labels, but the product no longer exposes
- * any way to create, apply, or view them, so they are not manageable here.
+ * The workspace's label catalogs. Issue and skill labels are separate lists;
+ * agent labels were removed from the product (MUL-5600) even though the
+ * backend still models the `agent` resource type.
*/
-type LabelScope = Extract<LabelResourceType, "issue" | "skill">;
-
-const RESOURCE_TYPES: LabelScope[] = ["issue", "skill"];
-
-interface LabelDraft {
- name: string;
- description: string;
- color: string;
-}
-
-const EMPTY_DRAFT: LabelDraft = {
- name: "",
- description: "",
- color: COLOR_PICKER_PRESETS[6],
-};
-
export function LabelsTab() {
const { t } = useT("settings");
- const locale = useLocale();
const wsId = useWorkspaceId();
-
- const [resourceType, setResourceType] = useState<LabelScope>("issue");
- const [query, setQuery] = useState("");
- const [editing, setEditing] = useState<Label | null>(null);
- const [createOpen, setCreateOpen] = useState(false);
- const [pendingDelete, setPendingDelete] = useState<Label | null>(null);
-
- const { data: labels = [], isLoading } = useQuery(
- labelListOptions(wsId, resourceType),
- );
- const filteredLabels = useMemo(() => {
- const normalized = query.trim().toLowerCase();
- if (!normalized) return labels;
- return labels.filter(
- (label) =>
- label.name.toLowerCase().includes(normalized) ||
- (label.description ?? "").toLowerCase().includes(normalized),
- );
- }, [labels, query]);
-
- const scopeLabel = t(($) => $.labels.scopes[resourceType]);
+ const [scope, setScope] = useState<LabelScope>("issue");
+ // Same queries the manager runs, so the counts come from the shared cache.
+ const { data: issueLabels } = useQuery(labelListOptions(wsId, "issue"));
+ const { data: skillLabels } = useQuery(labelListOptions(wsId, "skill"));
return (
<SettingsTab
title={t(($) => $.labels.title)}
description={t(($) => $.labels.description)}
+ scope="workspace"
>
- <div className="space-y-5">
- <div className="flex flex-wrap items-center gap-2 border-b border-surface-border pb-3">
- {RESOURCE_TYPES.map((type) => (
- <Button
- key={type}
- type="button"
- size="sm"
- variant={resourceType === type ? "secondary" : "ghost"}
- className={cn(
- "gap-2",
- resourceType === type && "bg-surface-selected text-surface-selected-foreground",
- )}
- onClick={() => {
- setResourceType(type);
- setQuery("");
- }}
- >
- <Tag className="size-3.5" />
- {t(($) => $.labels.scopes[type])}
- <span className="text-caption tabular-nums text-muted-foreground">
- {type === resourceType ? labels.length : ""}
- </span>
- </Button>
- ))}
- </div>
-
- <div className="flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between">
- <div className="relative w-full sm:max-w-sm">
- <Search className="pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-muted-foreground" />
- <Input
- value={query}
- onChange={(event) => setQuery(event.target.value)}
- placeholder={t(($) => $.labels.search_placeholder)}
- className="pl-9"
- />
- </div>
- <Button className="gap-2" onClick={() => setCreateOpen(true)}>
- <Plus className="size-4" />
- {t(($) => $.labels.new_label)}
- </Button>
- </div>
-
- <div className="overflow-hidden rounded-lg border border-surface-border bg-card">
- <div className="hidden grid-cols-[minmax(11rem,1fr)_minmax(12rem,1.4fr)_6rem_7rem_2rem] gap-4 border-b border-surface-border bg-muted/20 px-4 py-2.5 text-caption font-medium text-muted-foreground md:grid">
- <span>{t(($) => $.labels.columns.name)}</span>
- <span>{t(($) => $.labels.columns.description)}</span>
- <span>{t(($) => $.labels.columns.usage)}</span>
- <span>{t(($) => $.labels.columns.updated)}</span>
- <span />
- </div>
-
- {isLoading ? (
- <div className="px-4 py-12 text-center text-body text-muted-foreground">
- {t(($) => $.labels.loading)}
- </div>
- ) : filteredLabels.length === 0 ? (
- <div className="px-4 py-12 text-center">
- <Tag className="mx-auto size-6 text-faint-foreground" />
- <p className="mt-3 text-body font-medium">
- {query
- ? t(($) => $.labels.no_results)
- : t(($) => $.labels.empty, { scope: scopeLabel })}
- </p>
- </div>
- ) : (
- <div className="divide-y divide-surface-border">
- {filteredLabels.map((label) => (
- <div
- key={label.id}
- className="grid gap-2 px-4 py-3 md:grid-cols-[minmax(11rem,1fr)_minmax(12rem,1.4fr)_6rem_7rem_2rem] md:items-center md:gap-4"
- >
- <div className="flex min-w-0 items-center gap-3">
- <span
- className="size-2.5 shrink-0 rounded-full"
- style={{ backgroundColor: label.color }}
- />
- <span className="truncate text-body font-medium">{label.name}</span>
- </div>
- <p className="min-w-0 truncate text-caption text-muted-foreground md:text-body">
- {label.description || "—"}
- </p>
- <span className="text-caption tabular-nums text-muted-foreground md:text-body">
- {t(($) => $.labels.usage_count, { count: label.usage_count ?? 0 })}
- </span>
- <span className="text-caption text-muted-foreground">
- {new Date(label.updated_at).toLocaleDateString(locale)}
- </span>
- <DropdownMenu>
- <DropdownMenuTrigger
- render={
- <Button
- variant="ghost"
- size="icon-sm"
- aria-label={t(($) => $.labels.actions.open, { name: label.name })}
- >
- <MoreHorizontal className="size-4" />
- </Button>
- }
- />
- <DropdownMenuContent align="end">
- <DropdownMenuItem onClick={() => setEditing(label)}>
- <Pencil className="size-4" />
- {t(($) => $.labels.actions.edit)}
- </DropdownMenuItem>
- <DropdownMenuItem
- variant="destructive"
- onClick={() => setPendingDelete(label)}
- >
- <Trash2 className="size-4" />
- {t(($) => $.labels.actions.delete)}
- </DropdownMenuItem>
- </DropdownMenuContent>
- </DropdownMenu>
- </div>
- ))}
- </div>
- )}
- </div>
+ <div className="space-y-4">
+ <SettingsViewTabs
+ label={t(($) => $.labels.title)}
+ items={[
+ { value: "issue", label: t(($) => $.labels.scopes.issue), count: issueLabels?.length },
+ { value: "skill", label: t(($) => $.labels.scopes.skill), count: skillLabels?.length },
+ ]}
+ value={scope}
+ onChange={setScope}
+ />
+ {/* Keyed so switching lists also clears the search. */}
+ <LabelManager key={scope} scope={scope} />
</div>
-
- <LabelEditorDialog
- open={createOpen}
- onOpenChange={setCreateOpen}
- resourceType={resourceType}
- />
- <LabelEditorDialog
- open={Boolean(editing)}
- onOpenChange={(open) => !open && setEditing(null)}
- resourceType={resourceType}
- label={editing}
- />
- <DeleteLabelDialog
- label={pendingDelete}
- onClose={() => setPendingDelete(null)}
- />
</SettingsTab>
);
}
-
-function LabelEditorDialog({
- open,
- onOpenChange,
- resourceType,
- label,
-}: {
- open: boolean;
- onOpenChange: (open: boolean) => void;
- resourceType: LabelScope;
- label?: Label | null;
-}) {
- const { t } = useT("settings");
- const create = useCreateLabel();
- const update = useUpdateLabel();
- const [draft, setDraft] = useState<LabelDraft>(EMPTY_DRAFT);
-
- useEffect(() => {
- if (!open) return;
- setDraft(
- label
- ? {
- name: label.name,
- description: label.description ?? "",
- color: label.color,
- }
- : EMPTY_DRAFT,
- );
- }, [label, open]);
-
- const submit = () => {
- const name = draft.name.trim();
- if (!name) return;
- if (label) {
- update.mutate(
- {
- id: label.id,
- resource_type: label.resource_type ?? resourceType,
- name,
- description: draft.description.trim(),
- color: draft.color,
- },
- {
- onSuccess: () => onOpenChange(false),
- onError: (error) =>
- toast.error(error instanceof Error ? error.message : t(($) => $.labels.save_failed)),
- },
- );
- return;
- }
- create.mutate(
- {
- resource_type: resourceType,
- name,
- description: draft.description.trim(),
- color: draft.color,
- },
- {
- onSuccess: () => onOpenChange(false),
- onError: (error) =>
- toast.error(error instanceof Error ? error.message : t(($) => $.labels.save_failed)),
- },
- );
- };
-
- return (
- <Dialog
- open={open}
- onOpenChange={onOpenChange}
- >
- <DialogContent className="sm:max-w-lg">
- <DialogHeader>
- <DialogTitle>
- {label ? t(($) => $.labels.editor.edit_title) : t(($) => $.labels.editor.create_title)}
- </DialogTitle>
- <DialogDescription>
- {t(($) => $.labels.editor.scope_hint, {
- scope: t(($) => $.labels.scopes[resourceType]),
- })}
- </DialogDescription>
- </DialogHeader>
- <div className="space-y-5 py-2">
- <div className="space-y-2">
- <FieldLabel htmlFor="label-name">{t(($) => $.labels.editor.name)}</FieldLabel>
- <Input
- id="label-name"
- autoFocus
- maxLength={32}
- value={draft.name}
- onChange={(event) => setDraft((current) => ({ ...current, name: event.target.value }))}
- placeholder={t(($) => $.labels.editor.name_placeholder)}
- />
- </div>
- <div className="space-y-2">
- <FieldLabel htmlFor="label-description">
- {t(($) => $.labels.editor.description)}
- </FieldLabel>
- <Textarea
- id="label-description"
- rows={3}
- value={draft.description}
- onChange={(event) =>
- setDraft((current) => ({ ...current, description: event.target.value }))
- }
- placeholder={t(($) => $.labels.editor.description_placeholder)}
- />
- </div>
- <div className="space-y-2">
- <FieldLabel>{t(($) => $.labels.editor.color)}</FieldLabel>
- <ColorPicker
- value={draft.color}
- onChange={(color) => setDraft((current) => ({ ...current, color }))}
- trigger={
- <button
- type="button"
- aria-label={t(($) => $.labels.editor.color)}
- className="flex h-9 items-center gap-2.5 rounded-md border border-surface-border px-2.5 transition-colors hover:bg-surface-hover"
- >
- <span
- className="size-5 rounded-full"
- style={{ backgroundColor: draft.color }}
- />
- <span className="font-mono text-caption uppercase text-muted-foreground">
- {draft.color}
- </span>
- </button>
- }
- />
- </div>
- </div>
- <DialogFooter>
- <Button variant="ghost" onClick={() => onOpenChange(false)}>
- {t(($) => $.labels.editor.cancel)}
- </Button>
- <Button
- onClick={submit}
- disabled={!draft.name.trim() || create.isPending || update.isPending}
- >
- {create.isPending || update.isPending
- ? t(($) => $.labels.editor.saving)
- : t(($) => $.labels.editor.save)}
- </Button>
- </DialogFooter>
- </DialogContent>
- </Dialog>
- );
-}
-
-function DeleteLabelDialog({
- label,
- onClose,
-}: {
- label: Label | null;
- onClose: () => void;
-}) {
- const { t } = useT("settings");
- const remove = useDeleteLabel();
- return (
- <AlertDialog open={Boolean(label)} onOpenChange={(open) => !open && onClose()}>
- <AlertDialogContent>
- <AlertDialogHeader>
- <AlertDialogTitle>{t(($) => $.labels.delete_dialog.title)}</AlertDialogTitle>
- <AlertDialogDescription>
- {t(($) => $.labels.delete_dialog.description, {
- name: label?.name ?? "",
- count: label?.usage_count ?? 0,
- })}
- </AlertDialogDescription>
- </AlertDialogHeader>
- <AlertDialogFooter>
- <AlertDialogCancel>{t(($) => $.labels.delete_dialog.cancel)}</AlertDialogCancel>
- <AlertDialogAction
- onClick={() => {
- if (!label) return;
- remove.mutate(
- { id: label.id, resource_type: label.resource_type ?? "issue" },
- {
- onSuccess: onClose,
- onError: (error) =>
- toast.error(
- error instanceof Error
- ? error.message
- : t(($) => $.labels.delete_dialog.failed),
- ),
- },
- );
- }}
- >
- {t(($) => $.labels.delete_dialog.confirm)}
- </AlertDialogAction>
- </AlertDialogFooter>
- </AlertDialogContent>
- </AlertDialog>
- );
-}
diff --git a/packages/views/settings/components/mcp-tab.test.tsx b/packages/views/settings/components/mcp-tab.test.tsx
index 66c30ad6fc..e22e46540f 100644
--- a/packages/views/settings/components/mcp-tab.test.tsx
+++ b/packages/views/settings/components/mcp-tab.test.tsx
@@ -30,11 +30,13 @@ const data = vi.hoisted(() => ({
}));
vi.mock("@tanstack/react-query", () => ({
+ queryOptions: <T,>(options: T) => options,
useQuery: () => ({ data: data.servers, isLoading: data.isLoading }),
}));
vi.mock("@multica/core/workspace/queries", () => ({
workspaceMcpServersOptions: () => ({ queryKey: ["workspaces", "workspace-1", "mcp-servers"] }),
+ memberListOptions: () => ({ queryKey: ["workspaces", "workspace-1", "members"] }),
}));
vi.mock("@multica/core/workspace/mutations", () => ({
@@ -527,6 +529,20 @@ describe("McpTab", () => {
).toBeInTheDocument();
});
+ it("says how many agents use each server, when the server reports it", () => {
+ data.servers = [
+ server({ id: "s1", name: "sentry", agent_count: 3 }),
+ server({ id: "s2", name: "figma", agent_count: 0 }),
+ server({ id: "s3", name: "legacy" }),
+ ];
+ render(<McpTab />, { wrapper: Wrapper });
+
+ expect(screen.getByText(/Used by 3 agents/)).toBeInTheDocument();
+ expect(screen.getByText(/Not assigned to any agent/)).toBeInTheDocument();
+ // An older server omits the count; say nothing rather than "0".
+ expect(screen.getAllByText(/Used by|Not assigned/)).toHaveLength(2);
+ });
+
it("renders an empty state when the library is empty", () => {
data.servers = [];
render(<McpTab />, { wrapper: Wrapper });
diff --git a/packages/views/settings/components/mcp-tab.tsx b/packages/views/settings/components/mcp-tab.tsx
index 06c202795e..8ffa100a08 100644
--- a/packages/views/settings/components/mcp-tab.tsx
+++ b/packages/views/settings/components/mcp-tab.tsx
@@ -1,7 +1,7 @@
"use client";
import { useMemo, useState } from "react";
-import { Loader2, Plus, Server } from "lucide-react";
+import { ArrowRight, Blocks, Loader2, Plug, Plus, Server } from "lucide-react";
import { useQuery } from "@tanstack/react-query";
import { toast } from "sonner";
import {
@@ -18,6 +18,9 @@ import { Badge } from "@multica/ui/components/ui/badge";
import { Button } from "@multica/ui/components/ui/button";
import { useCurrentWorkspace } from "@multica/core/paths";
import { useCurrentMember } from "@multica/core/permissions";
+import { useFeatureEnabled } from "@multica/core/config";
+import { PLUGINS_V1_FLAG } from "@multica/core/feature-flags";
+import { cn } from "@multica/ui/lib/utils";
import { workspaceMcpServersOptions } from "@multica/core/workspace/queries";
import {
useCreateWorkspaceMcpServer,
@@ -29,7 +32,15 @@ import { McpServerDialog } from "../../agents/components/tabs/mcp-server-dialog"
import type { ManagedMcpServer } from "../../agents/components/tabs/mcp-config-model";
import { McpServerRow } from "../../common/mcp-server-row";
import { useT } from "../../i18n";
-import { SettingsCard, SettingsSection, SettingsTab } from "./settings-layout";
+import {
+ SettingsCard,
+ SettingsReadOnlyNotice,
+ SettingsSection,
+ SettingsTab,
+} from "./settings-layout";
+import { AppLink, useOptionalNavigation } from "../../navigation";
+import { useComposioAvailable } from "./connected-apps-tab";
+import { settingsHref } from "./settings-navigation";
/**
* The workspace MCP server library (GH #6062).
@@ -193,9 +204,14 @@ export function McpTab() {
return (
<SettingsTab
- title={t(($) => $.mcp.title)}
+ title={t(($) => $.page.tabs.mcp)}
description={t(($) => $.mcp.description)}
+ scope="workspace"
>
+ {!canManage && !currentMember.isLoading ? (
+ <SettingsReadOnlyNotice wsId={wsId} />
+ ) : null}
+ <ToolSourcesOverview />
<SettingsSection
title={t(($) => $.mcp.servers_title)}
description={t(($) => $.mcp.write_only_note)}
@@ -235,6 +251,13 @@ export function McpTab() {
key={server.name}
name={server.name}
transport={server.transport}
+ meta={
+ server.agent_count === undefined
+ ? undefined
+ : server.agent_count > 0
+ ? t(($) => $.mcp_usage.agent_count, { count: server.agent_count })
+ : t(($) => $.mcp_usage.none)
+ }
status={
server.enabled === false ? (
<Badge variant="secondary">
@@ -284,11 +307,6 @@ export function McpTab() {
</ul>
)}
</SettingsCard>
- {!canManage && !currentMember.isLoading ? (
- <p className="px-0.5 text-caption text-muted-foreground">
- {t(($) => $.mcp.admin_only_note)}
- </p>
- ) : null}
</SettingsSection>
<McpServerDialog
@@ -335,3 +353,108 @@ export function McpTab() {
</SettingsTab>
);
}
+
+/**
+ * Three things give agents outside tools, and they differ in who owns the
+ * credential and who can use it. Name all three here — the page people look
+ * for when they think "MCP" — and link to the other two.
+ */
+function ToolSourcesOverview() {
+ const { t } = useT("settings");
+ const navigation = useOptionalNavigation();
+ const appsAvailable = useComposioAvailable();
+ const tabHref = (tab: string) =>
+ navigation
+ ? settingsHref(navigation.pathname, navigation.searchParams, tab)
+ : `?tab=${tab}`;
+ const pluginsEnabled = useFeatureEnabled(PLUGINS_V1_FLAG, false);
+ const sources = [
+ {
+ key: "mcp",
+ icon: Server,
+ title: t(($) => $.page.tabs.mcp),
+ description: t(($) => $.mcp_sources.mcp),
+ href: null,
+ },
+ ...(appsAvailable
+ ? [
+ {
+ key: "apps",
+ icon: Plug,
+ title: t(($) => $.page.tabs.apps),
+ description: t(($) => $.mcp_sources.apps),
+ href: tabHref("apps"),
+ },
+ ]
+ : []),
+ ...(pluginsEnabled
+ ? [
+ {
+ key: "plugins",
+ icon: Blocks,
+ title: t(($) => $.page.tabs.plugins),
+ description: t(($) => $.mcp_sources.plugins),
+ href: tabHref("plugins"),
+ },
+ ]
+ : []),
+ ];
+ // With nothing to compare against, the explainer would only restate the
+ // page description.
+ if (sources.length < 2) return null;
+ return (
+ <SettingsSection title={t(($) => $.mcp_sources.title)}>
+ <div
+ className={cn(
+ "grid overflow-hidden rounded-xl border border-surface-border bg-surface",
+ sources.length === 3 ? "sm:grid-cols-3" : "sm:grid-cols-2",
+ )}
+ >
+ {sources.map((source, index) => {
+ const Icon = source.icon;
+ const body = (
+ <>
+ <span className="flex items-center gap-2 text-body font-medium">
+ <Icon className="size-4 text-muted-foreground" aria-hidden="true" />
+ {source.title}
+ {source.href ? (
+ <ArrowRight
+ className="ml-auto size-3.5 text-muted-foreground"
+ aria-hidden="true"
+ />
+ ) : (
+ <span className="ml-auto rounded-full bg-muted px-2 py-0.5 text-micro font-medium text-muted-foreground">
+ {t(($) => $.mcp_sources.current)}
+ </span>
+ )}
+ </span>
+ <span className="mt-1.5 block text-caption leading-5 text-muted-foreground">
+ {source.description}
+ </span>
+ </>
+ );
+ const className = cn(
+ "block px-4 py-3.5",
+ index > 0 && "border-t border-surface-border sm:border-l sm:border-t-0",
+ );
+ return source.href ? (
+ <AppLink
+ key={source.key}
+ href={source.href}
+ className={cn(
+ className,
+ "transition-colors hover:bg-surface-hover focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring",
+ )}
+ >
+ {body}
+ </AppLink>
+ ) : (
+ <div key={source.key} className={cn(className, "bg-muted/30")}>
+ {body}
+ </div>
+ );
+ })}
+ </div>
+ </SettingsSection>
+ );
+}
diff --git a/packages/views/settings/components/members-tab.test.tsx b/packages/views/settings/components/members-tab.test.tsx
new file mode 100644
index 0000000000..3808375201
--- /dev/null
+++ b/packages/views/settings/components/members-tab.test.tsx
@@ -0,0 +1,258 @@
+import { useSyncExternalStore, type ReactNode } from "react";
+import { beforeEach, describe, expect, it, vi } from "vitest";
+import { act, fireEvent, screen, waitFor, within } from "@testing-library/react";
+import userEvent from "@testing-library/user-event";
+import { configStore } from "@multica/core/config";
+import { BILLING_WORKSPACE_SUBSCRIPTIONS_FLAG } from "@multica/core/feature-flags";
+import { renderWithI18n } from "../../test/i18n";
+
+const mockCreateMember = vi.hoisted(() => vi.fn());
+// The URL the settings router holds; `setSearch` stands in for navigation.
+const url = vi.hoisted(() => {
+ const listeners = new Set<() => void>();
+ const state = { search: "" };
+ return {
+ get: () => state.search,
+ set: (search: string) => {
+ state.search = search;
+ listeners.forEach((listener) => listener());
+ },
+ subscribe: (listener: () => void) => {
+ listeners.add(listener);
+ return () => listeners.delete(listener);
+ },
+ };
+});
+const data = vi.hoisted(() => ({
+ members: [] as Array<Record<string, unknown>>,
+ invitations: [] as Array<Record<string, unknown>>,
+ shareLinks: [] as Array<Record<string, unknown>>,
+ summary: null as Record<string, unknown> | null,
+}));
+
+vi.mock("@tanstack/react-query", () => ({
+ queryOptions: <T,>(opts: T) => opts,
+ useQuery: (opts: { queryKey: unknown[] }) => {
+ const key = JSON.stringify(opts.queryKey);
+ if (key.includes("invitations")) return { data: data.invitations };
+ if (key.includes("share-links")) return { data: data.shareLinks };
+ if (key.includes("members")) return { data: data.members };
+ return { data: data.summary };
+ },
+ useQueryClient: () => ({
+ invalidateQueries: vi.fn(),
+ fetchQuery: vi.fn(),
+ }),
+}));
+vi.mock("@multica/core/billing", () => ({
+ usePreviewWorkspaceSeatPurchase: () => ({ mutateAsync: vi.fn() }),
+ usePurchaseWorkspaceSeats: () => ({ mutateAsync: vi.fn() }),
+ workspaceSubscriptionSummaryOptions: (wsId: string) => ({
+ queryKey: ["billing", wsId, "summary"],
+ }),
+}));
+vi.mock("@multica/core/hooks", () => ({ useWorkspaceId: () => "ws-1" }));
+vi.mock("@multica/core/paths", () => ({
+ useCurrentWorkspace: () => ({ id: "ws-1", name: "Acme", slug: "acme" }),
+}));
+vi.mock("@multica/core/api", async (importOriginal) => ({
+ ...(await importOriginal<typeof import("@multica/core/api")>()),
+ api: { createMember: mockCreateMember },
+}));
+vi.mock("@multica/core/auth", () => {
+ const state = { user: { id: "user-1" } };
+ const useAuthStore = Object.assign(
+ (selector?: (s: typeof state) => unknown) => (selector ? selector(state) : state),
+ { getState: () => state },
+ );
+ return { useAuthStore };
+});
+vi.mock("../../common/actor-avatar", () => ({ ActorAvatar: () => <span /> }));
+vi.mock("../../navigation", () => ({
+ AppLink: ({ href, children, ...rest }: { href: string; children: ReactNode }) => (
+ <a href={href} {...rest}>
+ {children}
+ </a>
+ ),
+ useOptionalNavigation: () => {
+ const search = useSyncExternalStore(url.subscribe, url.get);
+ const go = (href: string) => url.set(href.split("?")[1] ?? "");
+ return {
+ pathname: "/acme/settings",
+ searchParams: new URLSearchParams(search),
+ push: go,
+ replace: go,
+ };
+ },
+}));
+vi.mock("sonner", () => ({ toast: { success: vi.fn(), error: vi.fn() } }));
+
+import { MembersTab } from "./members-tab";
+
+const member = (id: string, name: string, role: string) => ({
+ id: `m-${id}`,
+ user_id: id,
+ workspace_id: "ws-1",
+ role,
+ name,
+ email: `${name.toLowerCase().split(" ")[0]}@acme.dev`,
+ avatar_url: null,
+ created_at: "2025-01-08T00:00:00Z",
+});
+
+beforeEach(() => {
+ vi.clearAllMocks();
+ url.set("tab=members");
+ data.members = [
+ member("user-1", "Ada Lovelace", "owner"),
+ member("user-2", "Grace Hopper", "admin"),
+ member("user-3", "Alan Turing", "member"),
+ ];
+ data.invitations = [
+ {
+ id: "inv-1",
+ workspace_id: "ws-1",
+ inviter_id: "user-1",
+ invitee_email: "[email protected]",
+ invitee_user_id: null,
+ role: "member",
+ status: "pending",
+ created_at: "2025-03-01T00:00:00Z",
+ updated_at: "2025-03-01T00:00:00Z",
+ expires_at: "2025-03-08T00:00:00Z",
+ },
+ ];
+ data.shareLinks = [];
+ data.summary = null;
+ configStore.getState().setFeatureFlags({});
+});
+
+describe("MembersTab", () => {
+ it("lists members with their role and marks the current user", () => {
+ renderWithI18n(<MembersTab />);
+
+ expect(screen.getByRole("tab", { name: /Members\s*3/ })).toHaveAttribute(
+ "aria-selected",
+ "true",
+ );
+ expect(screen.getByText("Ada Lovelace")).toBeInTheDocument();
+ expect(screen.getByText("You")).toBeInTheDocument();
+ expect(screen.getByRole("button", { name: "Actions for Grace Hopper" })).toBeInTheDocument();
+ // Nobody manages their own membership from this list.
+ expect(screen.queryByRole("button", { name: "Actions for Ada Lovelace" })).toBeNull();
+ });
+
+ it("filters members by name or email", () => {
+ renderWithI18n(<MembersTab />);
+ const search = screen.getByRole("searchbox", { name: "Search name or email" });
+
+ fireEvent.change(search, { target: { value: "grace@" } });
+ expect(screen.getByText("Grace Hopper")).toBeInTheDocument();
+ expect(screen.queryByText("Alan Turing")).toBeNull();
+
+ fireEvent.change(search, { target: { value: "nobody" } });
+ expect(screen.getByText("No members match this search.")).toBeInTheDocument();
+ });
+
+ it("shows when each pending invitation was sent and expires", async () => {
+ const user = userEvent.setup();
+ renderWithI18n(<MembersTab />);
+
+ await user.click(screen.getByRole("tab", { name: /Pending invitations\s*1/ }));
+ expect(screen.getByText("[email protected]")).toBeInTheDocument();
+ expect(screen.getByText(/Sent .* · Expires /)).toBeInTheDocument();
+ expect(
+ screen.getByRole("button", { name: "Revoke invitation for [email protected]" }),
+ ).toBeInTheDocument();
+ });
+
+ it("keeps the open list in the URL and follows it while on the page", async () => {
+ const user = userEvent.setup();
+ renderWithI18n(<MembersTab />);
+
+ await user.click(screen.getByRole("tab", { name: /Pending invitations\s*1/ }));
+ expect(url.get()).toBe("tab=members&section=invitations");
+
+ // A search result or back/forward changes the URL without remounting.
+ act(() => url.set("tab=members&section=links"));
+ expect(screen.getByRole("tab", { name: /Share links\s*0/ })).toHaveAttribute(
+ "aria-selected",
+ "true",
+ );
+ act(() => url.set("tab=members"));
+ expect(screen.getByRole("tab", { name: /Members\s*3/ })).toHaveAttribute(
+ "aria-selected",
+ "true",
+ );
+ });
+
+ it("opens the tab a deep link names", () => {
+ url.set("tab=members&section=links");
+ renderWithI18n(<MembersTab />);
+ expect(screen.getByRole("tab", { name: /Share links\s*0/ })).toHaveAttribute(
+ "aria-selected",
+ "true",
+ );
+ expect(screen.getByText("No share links yet.")).toBeInTheDocument();
+ });
+
+ it("invites from a dialog and closes it once the invitation is sent", async () => {
+ mockCreateMember.mockResolvedValue({});
+ const user = userEvent.setup();
+ renderWithI18n(<MembersTab />);
+
+ await user.click(screen.getByRole("button", { name: "Invite member" }));
+ const dialog = await screen.findByRole("dialog", { name: "Invite member" });
+ await user.type(within(dialog).getByRole("textbox", { name: "Email" }), "[email protected]");
+ await user.click(within(dialog).getByRole("button", { name: "Invite" }));
+
+ await waitFor(() =>
+ expect(mockCreateMember).toHaveBeenCalledWith("ws-1", {
+ email: "[email protected]",
+ role: "member",
+ }),
+ );
+ await waitFor(() => expect(screen.queryByRole("dialog")).toBeNull());
+ });
+
+ it("keeps the invite dialog open when sending fails", async () => {
+ mockCreateMember.mockRejectedValue(new Error("nope"));
+ const user = userEvent.setup();
+ renderWithI18n(<MembersTab />);
+
+ await user.click(screen.getByRole("button", { name: "Invite member" }));
+ const dialog = await screen.findByRole("dialog", { name: "Invite member" });
+ await user.type(within(dialog).getByRole("textbox", { name: "Email" }), "[email protected]");
+ await user.click(within(dialog).getByRole("button", { name: "Invite" }));
+
+ await waitFor(() => expect(mockCreateMember).toHaveBeenCalled());
+ expect(screen.getByRole("dialog", { name: "Invite member" })).toBeInTheDocument();
+ });
+
+ it("links seat usage to billing when subscriptions are on", () => {
+ configStore
+ .getState()
+ .setFeatureFlags({ [BILLING_WORKSPACE_SUBSCRIPTIONS_FLAG]: true });
+ data.summary = { seatCapacity: { used: 3, reserved: 1, purchased: 5 } };
+ renderWithI18n(<MembersTab />);
+
+ expect(screen.getByText(/4 of 5 seats used/)).toBeInTheDocument();
+ expect(screen.getByRole("link", { name: "Manage seats" })).toHaveAttribute(
+ "href",
+ "/acme/settings?tab=billing",
+ );
+ });
+
+ it("gives members a read-only view without invite or share-link controls", () => {
+ data.members = [
+ member("user-1", "Ada Lovelace", "member"),
+ member("user-2", "Grace Hopper", "owner"),
+ ];
+ renderWithI18n(<MembersTab />);
+
+ expect(screen.getByRole("note")).toHaveTextContent("Ask Grace Hopper");
+ expect(screen.queryByRole("button", { name: "Invite member" })).toBeNull();
+ expect(screen.queryByRole("tab", { name: /Share links/ })).toBeNull();
+ expect(screen.queryByRole("button", { name: /^Actions for/ })).toBeNull();
+ });
+});
diff --git a/packages/views/settings/components/members-tab.tsx b/packages/views/settings/components/members-tab.tsx
index 874f6c4dfa..bc65d1b7ce 100644
--- a/packages/views/settings/components/members-tab.tsx
+++ b/packages/views/settings/components/members-tab.tsx
@@ -1,8 +1,7 @@
"use client";
-import { useCallback, useEffect, useRef, useState } from "react";
+import { useCallback, useEffect, useRef, useState, type ReactNode } from "react";
import {
- Clock,
Copy,
Crown,
Link,
@@ -10,6 +9,7 @@ import {
Mail,
MoreHorizontal,
Plus,
+ Search,
Shield,
Trash2,
User,
@@ -17,7 +17,7 @@ import {
X,
} from "lucide-react";
import { ActorAvatar } from "../../common/actor-avatar";
-import { useOptionalNavigation } from "../../navigation";
+import { AppLink, useOptionalNavigation } from "../../navigation";
import type {
Invitation,
MemberRole,
@@ -28,7 +28,15 @@ import type {
} from "@multica/core/types";
import { Input } from "@multica/ui/components/ui/input";
import { Button } from "@multica/ui/components/ui/button";
-import { Card, CardContent } from "@multica/ui/components/ui/card";
+import { Label } from "@multica/ui/components/ui/label";
+import {
+ Dialog,
+ DialogContent,
+ DialogDescription,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle,
+} from "@multica/ui/components/ui/dialog";
import { Badge } from "@multica/ui/components/ui/badge";
import {
AlertDialog,
@@ -66,6 +74,8 @@ import {
workspaceSubscriptionSummaryOptions,
} from "@multica/core/billing";
import { useWorkspaceId } from "@multica/core/hooks";
+import { useFeatureEnabled } from "@multica/core/config";
+import { BILLING_WORKSPACE_SUBSCRIPTIONS_FLAG } from "@multica/core/feature-flags";
import { useCurrentWorkspace } from "@multica/core/paths";
import {
invitationListOptions,
@@ -75,7 +85,13 @@ import {
} from "@multica/core/workspace/queries";
import { api, errorCode } from "@multica/core/api";
import { useLocale, useT } from "../../i18n";
-import { SettingsCard, SettingsSection, SettingsTab } from "./settings-layout";
+import {
+ SettingsCard,
+ SettingsReadOnlyNotice,
+ SettingsTab,
+ SettingsViewTabs,
+} from "./settings-layout";
+import { resolveSettingsLocation, settingsHref } from "./settings-navigation";
import { formatStripeMinorAmount } from "./billing-format";
import {
isSingleSeatInvitePreview,
@@ -88,6 +104,8 @@ import {
const SEAT_PURCHASE_CONFIRM_TIMEOUT_MS = 2 * 60_000;
+type MembersView = "members" | "invitations" | "links";
+
type InviteSeatPurchase = {
workspaceId: string;
email: string;
@@ -170,6 +188,7 @@ function MemberRow({
onRemove: () => void;
}) {
const { t } = useT("settings");
+ const locale = useLocale();
const roleConfig = useRoleLabels();
const rc = roleConfig[member.role];
const RoleIcon = rc.icon;
@@ -182,14 +201,36 @@ function MemberRow({
<div className="flex items-center gap-3 px-4 py-3">
<ActorAvatar actorType="member" actorId={member.user_id} size="lg" />
<div className="min-w-0 flex-1">
- <div className="text-body font-medium truncate">{member.name}</div>
- <div className="text-caption text-muted-foreground truncate">{member.email}</div>
+ <div className="flex min-w-0 items-center gap-2">
+ <span className="truncate text-body font-medium">{member.name}</span>
+ {isSelf ? (
+ <Badge variant="secondary" className="shrink-0">
+ {t(($) => $.members.you)}
+ </Badge>
+ ) : null}
+ </div>
+ <div className="truncate text-caption text-muted-foreground">{member.email}</div>
</div>
+ <span className="hidden w-32 shrink-0 text-caption tabular-nums text-muted-foreground md:block">
+ {t(($) => $.members.joined, {
+ date: new Date(member.created_at).toLocaleDateString(locale),
+ })}
+ </span>
+ <span className="flex w-24 shrink-0 items-center gap-1.5 text-body">
+ <RoleIcon className="size-3.5 text-muted-foreground" aria-hidden="true" />
+ {rc.label}
+ </span>
+ <span className="flex size-7 shrink-0 items-center justify-center">
{showMenu && (
<DropdownMenu>
<DropdownMenuTrigger
render={
- <Button variant="ghost" size="icon-sm" disabled={busy}>
+ <Button
+ variant="ghost"
+ size="icon-sm"
+ disabled={busy}
+ aria-label={t(($) => $.members.member_actions, { name: member.name })}
+ >
<MoreHorizontal className="h-4 w-4 text-muted-foreground" />
</Button>
}
@@ -250,10 +291,7 @@ function MemberRow({
</DropdownMenuContent>
</DropdownMenu>
)}
- <Badge variant="secondary">
- <RoleIcon className="h-3 w-3" />
- {rc.label}
- </Badge>
+ </span>
</div>
);
}
@@ -270,35 +308,40 @@ function InvitationRow({
busy: boolean;
}) {
const { t } = useT("settings");
+ const locale = useLocale();
const roleConfig = useRoleLabels();
const rc = roleConfig[invitation.role];
return (
<div className="flex items-center gap-3 px-4 py-3">
- <div className="flex h-8 w-8 items-center justify-center rounded-full bg-muted">
- <Mail className="h-4 w-4 text-muted-foreground" />
+ <div className="flex size-8 shrink-0 items-center justify-center rounded-full bg-muted">
+ <Mail className="size-4 text-muted-foreground" aria-hidden="true" />
</div>
<div className="min-w-0 flex-1">
- <div className="text-body font-medium truncate">{invitation.invitee_email}</div>
- <div className="flex items-center gap-1 text-caption text-muted-foreground">
- <Clock className="h-3 w-3" />
- <span>{t(($) => $.members.pending_status)}</span>
+ <div className="truncate text-body font-medium">{invitation.invitee_email}</div>
+ <div className="truncate text-caption text-muted-foreground">
+ {t(($) => $.members.invitation_meta, {
+ sent: new Date(invitation.created_at).toLocaleDateString(locale),
+ expires: new Date(invitation.expires_at).toLocaleDateString(locale),
+ })}
</div>
</div>
- {canManage && (
- <Button
- variant="ghost"
- size="icon-sm"
- disabled={busy}
- onClick={onRevoke}
- title={t(($) => $.members.revoke_invitation_tooltip)}
- >
- <X className="h-4 w-4 text-muted-foreground" />
- </Button>
- )}
- <Badge variant="outline">
- {rc.label}
- </Badge>
+ <span className="w-24 shrink-0 text-body">{rc.label}</span>
+ <span className="flex size-7 shrink-0 items-center justify-center">
+ {canManage && (
+ <Button
+ variant="ghost"
+ size="icon-sm"
+ disabled={busy}
+ onClick={onRevoke}
+ aria-label={t(($) => $.members.revoke_invitation_aria, {
+ email: invitation.invitee_email,
+ })}
+ >
+ <X className="size-4 text-muted-foreground" />
+ </Button>
+ )}
+ </span>
</div>
);
}
@@ -323,8 +366,8 @@ function ShareLinkRow({
return (
<div className="flex items-center gap-3 px-4 py-3">
- <div className="flex h-8 w-8 items-center justify-center rounded-full bg-muted">
- <Link className="h-4 w-4 text-muted-foreground" />
+ <div className="flex size-8 shrink-0 items-center justify-center rounded-full bg-muted">
+ <Link className="size-4 text-muted-foreground" aria-hidden="true" />
</div>
<div className="min-w-0 flex-1">
<div className="flex flex-wrap items-center gap-x-1 text-body font-medium">
@@ -338,26 +381,24 @@ function ShareLinkRow({
{joinUrl}
</div>
</div>
+ <span className="w-24 shrink-0 text-body">{rc.label}</span>
<Button
variant="ghost"
size="icon-sm"
onClick={onCopy}
- title={t(($) => $.members.share_link_copy_tooltip)}
+ aria-label={t(($) => $.members.share_link_copy_tooltip)}
>
- <Copy className="h-4 w-4 text-muted-foreground" />
+ <Copy className="size-4 text-muted-foreground" />
</Button>
<Button
variant="ghost"
size="icon-sm"
disabled={busy}
onClick={onRevoke}
- title={t(($) => $.members.share_link_revoke_tooltip)}
+ aria-label={t(($) => $.members.share_link_revoke_tooltip)}
>
- <Trash2 className="h-4 w-4 text-muted-foreground" />
+ <Trash2 className="size-4 text-muted-foreground" />
</Button>
- <Badge variant="outline">
- {rc.label}
- </Badge>
</div>
);
}
@@ -375,6 +416,31 @@ export function MembersTab() {
const { data: members = [] } = useQuery(memberListOptions(wsId));
const { data: invitations = [] } = useQuery(invitationListOptions(wsId));
+ const [inviteOpen, setInviteOpen] = useState(false);
+ const [shareLinkOpen, setShareLinkOpen] = useState(false);
+ const requestedView = resolveSettingsLocation(
+ navigation?.searchParams ?? new URLSearchParams(),
+ ).section;
+ const urlView: MembersView =
+ requestedView === "invitations" || requestedView === "links"
+ ? requestedView
+ : "members";
+ const [localView, setLocalView] = useState<MembersView>(urlView);
+ // With a router the URL owns the open list, so search results that land on
+ // this page and back/forward switch it too. Without one it is local state.
+ const view = navigation ? urlView : localView;
+ const setView = (next: MembersView) => {
+ if (!navigation) {
+ setLocalView(next);
+ return;
+ }
+ navigation.replace(
+ settingsHref(navigation.pathname, navigation.searchParams, "members", {
+ section: next === "members" ? undefined : next,
+ }),
+ );
+ };
+ const [memberQuery, setMemberQuery] = useState("");
const [inviteEmail, setInviteEmail] = useState("");
const [inviteRole, setInviteRole] = useState<MemberRole>("member");
const [inviteLoading, setInviteLoading] = useState(false);
@@ -412,6 +478,19 @@ export function MembersTab() {
// Only owners/admins may list share links; skip the request for plain
// members (the server would 403) once the current member's role is known.
const { data: shareLinks = [] } = useQuery(shareLinkListOptions(wsId, canManageWorkspace));
+ const billingEnabled = useFeatureEnabled(BILLING_WORKSPACE_SUBSCRIPTIONS_FLAG, false);
+ const seats = useQuery({
+ ...workspaceSubscriptionSummaryOptions(wsId),
+ enabled: billingEnabled && canManageWorkspace,
+ }).data?.seatCapacity;
+ const needle = memberQuery.trim().toLocaleLowerCase();
+ const visibleMembers = needle
+ ? members.filter(
+ (m) =>
+ m.name.toLocaleLowerCase().includes(needle) ||
+ m.email.toLocaleLowerCase().includes(needle),
+ )
+ : members;
const sendInvitation = useCallback(
async (email: string, role: MemberRole) => {
@@ -434,6 +513,7 @@ export function MembersTab() {
setInviteLoading(true);
try {
await sendInvitation(email, role);
+ setInviteOpen(false);
} catch (e) {
const code = errorCode(e);
const capacityFailure = seatInvitationCapacityFailure(code);
@@ -482,6 +562,9 @@ export function MembersTab() {
);
return;
}
+ // Hand over to the purchase confirmation rather than stacking a
+ // second modal on the invite dialog.
+ setInviteOpen(false);
setInviteSeatPurchase({
workspaceId: workspace.id,
email,
@@ -736,6 +819,7 @@ export function MembersTab() {
try {
await api.createShareLink(workspace.id, { role: shareLinkRole, expires_in: parseInt(shareLinkExpiry) || undefined });
qc.invalidateQueries({ queryKey: workspaceKeys.shareLinks(wsId) });
+ setShareLinkOpen(false);
toast.success(t(($) => $.members.toast_share_link_created));
} catch (e) {
toast.error(e instanceof Error ? e.message : t(($) => $.members.toast_share_link_failed));
@@ -784,178 +868,303 @@ export function MembersTab() {
if (!workspace) return null;
- return (
- <SettingsTab title={t(($) => $.page.tabs.members)}>
- <SettingsSection title={t(($) => $.members.section_title, { count: members.length })}>
+ const roleItems = (["member", "admin"] as const).map((value) => ({
+ value,
+ label: roleConfig[value].label,
+ }));
+ const expiryOptions = [
+ { value: "24", label: t(($) => $.members.expiry_24h) },
+ { value: "168", label: t(($) => $.members.expiry_7d) },
+ { value: "720", label: t(($) => $.members.expiry_30d) },
+ { value: "0", label: t(($) => $.members.expiry_never) },
+ ];
+ const views: { value: MembersView; label: string; count: number }[] = [
+ { value: "members", label: t(($) => $.members.members_label), count: members.length },
+ { value: "invitations", label: t(($) => $.members.pending_label), count: invitations.length },
+ ...(canManageWorkspace
+ ? [{ value: "links" as const, label: t(($) => $.members.share_links_label), count: shareLinks.length }]
+ : []),
+ ];
+ const activeView = views.some((item) => item.value === view) ? view : "members";
- {canManageWorkspace && (
- <Card>
- <CardContent className="space-y-3">
- <div className="flex items-center gap-2">
- <Plus className="h-4 w-4 text-muted-foreground" />
- <h3 className="text-body font-medium">{t(($) => $.members.invite_title)}</h3>
- </div>
- <div className="grid gap-3 sm:grid-cols-[1fr_120px_auto]">
+ return (
+ <SettingsTab
+ title={t(($) => $.page.tabs.members)}
+ scope="workspace"
+ actions={
+ canManageWorkspace ? (
+ <Button onClick={() => setInviteOpen(true)}>
+ <Plus />
+ {t(($) => $.members.invite_title)}
+ </Button>
+ ) : undefined
+ }
+ >
+ {currentMember && !canManageWorkspace ? (
+ <SettingsReadOnlyNotice wsId={wsId} />
+ ) : null}
+ <section className="space-y-3">
+ <div className="flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between">
+ <SettingsViewTabs
+ label={t(($) => $.page.tabs.members)}
+ items={views}
+ value={activeView}
+ onChange={setView}
+ />
+ <div className="flex min-w-0 items-center gap-3">
+ {seats && billingEnabled ? (
+ <span className="shrink-0 text-caption text-muted-foreground">
+ {t(($) => $.members.seats_used, {
+ used: seats.used + seats.reserved,
+ purchased: seats.purchased,
+ })}
+ {" · "}
+ <AppLink
+ href={
+ navigation
+ ? settingsHref(navigation.pathname, navigation.searchParams, "billing")
+ : "?tab=billing"
+ }
+ className="text-foreground underline-offset-4 hover:underline"
+ >
+ {t(($) => $.members.manage_seats)}
+ </AppLink>
+ </span>
+ ) : null}
+ {activeView === "members" ? (
+ <div className="relative w-full sm:w-56">
+ <Search
+ aria-hidden="true"
+ className="pointer-events-none absolute left-2.5 top-1/2 size-4 -translate-y-1/2 text-muted-foreground"
+ />
<Input
- type="email"
- name="invite-email"
- autoComplete="email"
- spellCheck={false}
- aria-label={t(($) => $.members.invite_email_placeholder)}
- value={inviteEmail}
- onChange={(e) => setInviteEmail(e.target.value)}
- placeholder={t(($) => $.members.invite_email_placeholder)}
- onKeyDown={(e) => {
- if (e.key === "Enter" && inviteEmail.trim()) handleInviteMember();
- }}
+ type="search"
+ value={memberQuery}
+ onChange={(event) => setMemberQuery(event.target.value)}
+ placeholder={t(($) => $.members.search_placeholder)}
+ aria-label={t(($) => $.members.search_placeholder)}
+ className="pl-8"
/>
- <Select
- items={(["member", "admin"] as const).map((value) => ({
- value,
- label: roleConfig[value].label,
- }))}
- value={inviteRole}
- onValueChange={(value) => setInviteRole(value as MemberRole)}
- >
- <SelectTrigger size="sm">
- <SelectValue>{() => roleConfig[inviteRole].label}</SelectValue>
- </SelectTrigger>
- <SelectContent>
- <SelectItem value="member">{roleConfig.member.label}</SelectItem>
- <SelectItem value="admin">{roleConfig.admin.label}</SelectItem>
- </SelectContent>
- </Select>
- <Button
- onClick={handleInviteMember}
- disabled={inviteLoading || !inviteEmail.trim()}
- >
- {inviteLoading ? t(($) => $.members.inviting) : t(($) => $.members.invite_button)}
- </Button>
</div>
- </CardContent>
- </Card>
- )}
+ ) : activeView === "links" ? (
+ <Button variant="outline" size="sm" onClick={() => setShareLinkOpen(true)}>
+ <Plus />
+ {t(($) => $.members.share_links_create_title)}
+ </Button>
+ ) : null}
+ </div>
+ </div>
- {members.length > 0 ? (
+ {activeView === "members" ? (
+ visibleMembers.length > 0 ? (
+ <SettingsCard>
+ {visibleMembers.map((m) => (
+ <div key={m.id}>
+ <MemberRow
+ member={m}
+ canManage={canManageWorkspace}
+ canManageOwners={isOwner}
+ ownerCount={ownerCount}
+ isSelf={m.user_id === user?.id}
+ busy={memberActionId === m.id}
+ onRoleChange={(role) => handleRoleChange(m.id, role)}
+ onRemove={() => handleRemoveMember(m)}
+ />
+ </div>
+ ))}
+ </SettingsCard>
+ ) : (
+ <EmptyList>
+ {needle ? t(($) => $.members.no_results) : t(($) => $.members.no_members)}
+ </EmptyList>
+ )
+ ) : activeView === "invitations" ? (
+ invitations.length > 0 ? (
+ <SettingsCard>
+ {invitations.map((inv) => (
+ <div key={inv.id}>
+ <InvitationRow
+ invitation={inv}
+ canManage={canManageWorkspace}
+ onRevoke={() => handleRevokeInvitation(inv)}
+ busy={invitationActionId === inv.id}
+ />
+ </div>
+ ))}
+ </SettingsCard>
+ ) : (
+ <EmptyList>{t(($) => $.members.no_invitations)}</EmptyList>
+ )
+ ) : shareLinks.length > 0 ? (
<SettingsCard>
- {members.map((m) => (
- <div key={m.id}>
- <MemberRow
- member={m}
- canManage={canManageWorkspace}
- canManageOwners={isOwner}
- ownerCount={ownerCount}
- isSelf={m.user_id === user?.id}
- busy={memberActionId === m.id}
- onRoleChange={(role) => handleRoleChange(m.id, role)}
- onRemove={() => handleRemoveMember(m)}
+ {shareLinks.map((link) => (
+ <div key={link.id}>
+ <ShareLinkRow
+ link={link}
+ onRevoke={() => handleRevokeShareLink(link)}
+ busy={shareLinkActionId === link.id}
+ onCopy={() => handleCopyShareLink(link)}
/>
</div>
))}
</SettingsCard>
) : (
- <p className="text-body text-muted-foreground">{t(($) => $.members.no_members)}</p>
+ <EmptyList>{t(($) => $.members.no_share_links)}</EmptyList>
)}
- </SettingsSection>
+ </section>
- {invitations.length > 0 && (
- <SettingsSection title={t(($) => $.members.pending_title, { count: invitations.length })}>
- <SettingsCard>
- {invitations.map((inv) => (
- <div key={inv.id}>
- <InvitationRow
- invitation={inv}
- canManage={canManageWorkspace}
- onRevoke={() => handleRevokeInvitation(inv)}
- busy={invitationActionId === inv.id}
- />
- </div>
- ))}
- </SettingsCard>
- </SettingsSection>
- )}
+ <Dialog
+ open={inviteOpen}
+ onOpenChange={(open) => {
+ if (!open && !inviteLoading) setInviteOpen(false);
+ }}
+ >
+ <DialogContent className="sm:max-w-md">
+ <DialogHeader>
+ <DialogTitle>{t(($) => $.members.invite_title)}</DialogTitle>
+ </DialogHeader>
+ <form
+ className="space-y-4"
+ onSubmit={(event) => {
+ event.preventDefault();
+ if (inviteEmail.trim()) void handleInviteMember();
+ }}
+ >
+ <div className="space-y-1.5">
+ <Label htmlFor="invite-email">{t(($) => $.members.email_label)}</Label>
+ <Input
+ id="invite-email"
+ type="email"
+ name="invite-email"
+ autoComplete="email"
+ spellCheck={false}
+ value={inviteEmail}
+ onChange={(e) => setInviteEmail(e.target.value)}
+ placeholder={t(($) => $.members.invite_email_placeholder)}
+ autoFocus
+ />
+ </div>
+ <div className="space-y-1.5">
+ <Label htmlFor="invite-role">{t(($) => $.members.role_label)}</Label>
+ <Select
+ items={roleItems}
+ value={inviteRole}
+ onValueChange={(value) => setInviteRole(value as MemberRole)}
+ >
+ <SelectTrigger id="invite-role" className="w-full">
+ <SelectValue>{() => roleConfig[inviteRole].label}</SelectValue>
+ </SelectTrigger>
+ <SelectContent>
+ {roleItems.map((item) => (
+ <SelectItem key={item.value} value={item.value}>
+ <span className="flex flex-col">
+ <span>{item.label}</span>
+ <span className="text-caption text-muted-foreground">
+ {roleConfig[item.value].description}
+ </span>
+ </span>
+ </SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
+ </div>
+ <DialogFooter>
+ <Button
+ type="button"
+ variant="outline"
+ onClick={() => setInviteOpen(false)}
+ disabled={inviteLoading}
+ >
+ {t(($) => $.members.confirm_cancel)}
+ </Button>
+ <Button
+ type="submit"
+ disabled={inviteLoading || !inviteEmail.trim()}
+ aria-busy={inviteLoading || undefined}
+ >
+ {inviteLoading ? t(($) => $.members.inviting) : t(($) => $.members.invite_button)}
+ </Button>
+ </DialogFooter>
+ </form>
+ </DialogContent>
+ </Dialog>
- {canManageWorkspace && (
- <SettingsSection title={t(($) => $.members.share_links_title, { count: shareLinks.length })}>
- <Card>
- <CardContent className="space-y-3">
- <div className="flex items-center gap-2">
- <Link className="h-4 w-4 text-muted-foreground" />
- <h3 className="text-body font-medium">{t(($) => $.members.share_links_create_title)}</h3>
- </div>
- <div className="flex flex-wrap items-center gap-x-3 gap-y-2">
- <div className="flex min-w-0 flex-1 basis-40 items-center gap-2">
- <span className="text-body text-muted-foreground shrink-0">{t(($) => $.members.role_field)}</span>
- <Select
- items={(["member", "admin"] as const).map((value) => ({
- value,
- label: roleConfig[value].label,
- }))}
- value={shareLinkRole}
- onValueChange={(value) => setShareLinkRole(value as MemberRole)}
- >
- <SelectTrigger size="sm">
- <SelectValue>{() => roleConfig[shareLinkRole].label}</SelectValue>
- </SelectTrigger>
- <SelectContent className="min-w-0">
- <SelectItem value="member">{roleConfig.member.label}</SelectItem>
- <SelectItem value="admin">{roleConfig.admin.label}</SelectItem>
- </SelectContent>
- </Select>
- </div>
- <div className="flex min-w-0 flex-1 basis-40 items-center gap-2">
- <span className="text-body text-muted-foreground shrink-0">{t(($) => $.members.expiry_field)}</span>
- <Select
- items={[
- { value: "24", label: t(($) => $.members.expiry_24h) },
- { value: "168", label: t(($) => $.members.expiry_7d) },
- { value: "720", label: t(($) => $.members.expiry_30d) },
- { value: "0", label: t(($) => $.members.expiry_never) },
- ]}
- value={shareLinkExpiry}
- onValueChange={(v) => v && setShareLinkExpiry(v)}
- >
- <SelectTrigger size="sm">
- <SelectValue>{() => {
- const opts: Record<string, string> = {
- "24": t(($) => $.members.expiry_24h),
- "168": t(($) => $.members.expiry_7d),
- "720": t(($) => $.members.expiry_30d),
- "0": t(($) => $.members.expiry_never),
- };
- return opts[shareLinkExpiry] || shareLinkExpiry;
- }}</SelectValue>
- </SelectTrigger>
- <SelectContent className="min-w-0">
- <SelectItem value="24">{t(($) => $.members.expiry_24h)}</SelectItem>
- <SelectItem value="168">{t(($) => $.members.expiry_7d)}</SelectItem>
- <SelectItem value="720">{t(($) => $.members.expiry_30d)}</SelectItem>
- <SelectItem value="0">{t(($) => $.members.expiry_never)}</SelectItem>
- </SelectContent>
- </Select>
- </div>
- <Button onClick={handleCreateShareLink} disabled={shareLinkLoading} className="shrink-0">
- {shareLinkLoading ? t(($) => $.members.share_links_creating) : t(($) => $.members.share_links_create_button)}
- </Button>
- </div>
- </CardContent>
- </Card>
- {shareLinks.length > 0 && (
- <SettingsCard>
- {shareLinks.map((link) => (
- <div key={link.id}>
- <ShareLinkRow
- link={link}
- onRevoke={() => handleRevokeShareLink(link)}
- busy={shareLinkActionId === link.id}
- onCopy={() => handleCopyShareLink(link)}
- />
- </div>
- ))}
- </SettingsCard>
- )}
- </SettingsSection>
- )}
+ <Dialog
+ open={shareLinkOpen}
+ onOpenChange={(open) => {
+ if (!open && !shareLinkLoading) setShareLinkOpen(false);
+ }}
+ >
+ <DialogContent className="sm:max-w-md">
+ <DialogHeader>
+ <DialogTitle>{t(($) => $.members.share_links_create_title)}</DialogTitle>
+ <DialogDescription>{t(($) => $.members.share_links_description)}</DialogDescription>
+ </DialogHeader>
+ <div className="space-y-4">
+ <div className="space-y-1.5">
+ <Label htmlFor="share-link-role">{t(($) => $.members.role_label)}</Label>
+ <Select
+ items={roleItems}
+ value={shareLinkRole}
+ onValueChange={(value) => setShareLinkRole(value as MemberRole)}
+ >
+ <SelectTrigger id="share-link-role" className="w-full">
+ <SelectValue>{() => roleConfig[shareLinkRole].label}</SelectValue>
+ </SelectTrigger>
+ <SelectContent>
+ {roleItems.map((item) => (
+ <SelectItem key={item.value} value={item.value}>
+ {item.label}
+ </SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
+ </div>
+ <div className="space-y-1.5">
+ <Label htmlFor="share-link-expiry">{t(($) => $.members.expiry_label)}</Label>
+ <Select
+ items={expiryOptions}
+ value={shareLinkExpiry}
+ onValueChange={(v) => v && setShareLinkExpiry(v)}
+ >
+ <SelectTrigger id="share-link-expiry" className="w-full">
+ <SelectValue>
+ {() =>
+ expiryOptions.find((option) => option.value === shareLinkExpiry)?.label ??
+ shareLinkExpiry
+ }
+ </SelectValue>
+ </SelectTrigger>
+ <SelectContent>
+ {expiryOptions.map((option) => (
+ <SelectItem key={option.value} value={option.value}>
+ {option.label}
+ </SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
+ </div>
+ </div>
+ <DialogFooter>
+ <Button
+ variant="outline"
+ onClick={() => setShareLinkOpen(false)}
+ disabled={shareLinkLoading}
+ >
+ {t(($) => $.members.confirm_cancel)}
+ </Button>
+ <Button
+ onClick={() => void handleCreateShareLink()}
+ disabled={shareLinkLoading}
+ aria-busy={shareLinkLoading || undefined}
+ >
+ {shareLinkLoading
+ ? t(($) => $.members.share_links_creating)
+ : t(($) => $.members.share_links_create_button)}
+ </Button>
+ </DialogFooter>
+ </DialogContent>
+ </Dialog>
<AlertDialog
open={inviteSeatPurchase !== null}
@@ -1093,3 +1302,11 @@ export function MembersTab() {
</SettingsTab>
);
}
+
+function EmptyList({ children }: { children: ReactNode }) {
+ return (
+ <div className="rounded-xl border border-dashed border-surface-border px-4 py-10 text-center text-body text-muted-foreground">
+ {children}
+ </div>
+ );
+}
diff --git a/packages/views/settings/components/notifications-tab.tsx b/packages/views/settings/components/notifications-tab.tsx
index 92a69d3c65..8759c313ad 100644
--- a/packages/views/settings/components/notifications-tab.tsx
+++ b/packages/views/settings/components/notifications-tab.tsx
@@ -46,10 +46,6 @@ export function NotificationsTab() {
delete updated[key];
}
mutation.mutate(updated, {
- onSuccess: () =>
- toast.success(t(($) => $.auto_save.toast_saved), {
- id: "settings-auto-save",
- }),
onError: (err) =>
toast.error(
err instanceof Error && err.message
@@ -62,10 +58,11 @@ export function NotificationsTab() {
const systemEnabled = preferences.system_notifications !== "muted";
return (
- <SettingsTab title={t(($) => $.page.tabs.notifications)}>
+ <SettingsTab title={t(($) => $.page.tabs.notifications)} scope="workspace-only">
<SettingsSection
title={t(($) => $.notifications.title)}
description={t(($) => $.notifications.description)}
+ anchor="inbox"
>
<SettingsCard>
{INBOX_GROUP_KEYS.map((key: InboxGroupKey) => {
@@ -73,6 +70,7 @@ export function NotificationsTab() {
return (
<SettingsRow
key={key}
+ anchor={key}
label={t(($) => $.notifications.groups[key].label)}
description={t(($) => $.notifications.groups[key].description)}
>
@@ -93,6 +91,7 @@ export function NotificationsTab() {
>
<SettingsCard>
<SettingsRow
+ anchor="system"
label={t(($) => $.notifications.system.label)}
>
<Switch
diff --git a/packages/views/settings/components/plugins-tab.test.tsx b/packages/views/settings/components/plugins-tab.test.tsx
index f9b414d3a1..4a91aca665 100644
--- a/packages/views/settings/components/plugins-tab.test.tsx
+++ b/packages/views/settings/components/plugins-tab.test.tsx
@@ -21,11 +21,14 @@ const data = vi.hoisted(() => ({
}));
vi.mock("@tanstack/react-query", () => ({
+ queryOptions: <T,>(options: T) => options,
// Two queries reach this tab: what is installed, and what has been published.
// They are told apart by the query key so a test can have one without the
// other — which is the normal state right after a publish.
useQuery: (options: { queryKey?: readonly unknown[] }) =>
- options?.queryKey?.[1] === "packages"
+ options?.queryKey?.includes("members")
+ ? { data: [], isLoading: false, isError: false }
+ : options?.queryKey?.[1] === "packages"
? { data: data.packages, isLoading: false, isError: false }
: { data: data.installed, isLoading: false, isError: false },
}));
@@ -242,7 +245,7 @@ describe("PluginsTab", () => {
data.installed.plugins = [INSTALLATION];
render(<PluginsTab />, { wrapper: Wrapper });
- expect(screen.getByText("Read-only access")).toBeInTheDocument();
+ expect(screen.getByText("View only")).toBeInTheDocument();
// The whole publish-and-install section is admin-only.
expect(screen.queryByRole("button", { name: "Upload package" })).not.toBeInTheDocument();
expect(screen.queryByRole("button", { name: "Review and install" })).not.toBeInTheDocument();
diff --git a/packages/views/settings/components/plugins-tab.tsx b/packages/views/settings/components/plugins-tab.tsx
index 31ddfc5fdf..b3c421eff0 100644
--- a/packages/views/settings/components/plugins-tab.tsx
+++ b/packages/views/settings/components/plugins-tab.tsx
@@ -39,7 +39,12 @@ import { Textarea } from "@multica/ui/components/ui/textarea";
import { Switch } from "@multica/ui/components/ui/switch";
import { mcpHooks, PluginHookActivity, PluginMCPApproval, PluginScheduleActivity } from "../../plugins";
import { useLocale, useT } from "../../i18n";
-import { SettingsCard, SettingsSection, SettingsTab } from "./settings-layout";
+import {
+ SettingsCard,
+ SettingsReadOnlyNotice,
+ SettingsSection,
+ SettingsTab,
+} from "./settings-layout";
/**
* The scope list is the entire trust model: there is no signature, no
@@ -679,14 +684,8 @@ export function PluginsTab() {
const installations = useMemo(() => data?.plugins ?? [], [data]);
return (
- <SettingsTab title={t(($) => $.plugins.title)} >
- {!canManage ? (
- <Alert>
- <AlertCircle />
- <AlertTitle>{t(($) => $.plugins.read_only)}</AlertTitle>
- <AlertDescription>{t(($) => $.plugins.read_only_description)}</AlertDescription>
- </Alert>
- ) : null}
+ <SettingsTab title={t(($) => $.plugins.title)} scope="workspace">
+ {role && !canManage ? <SettingsReadOnlyNotice wsId={wsId} /> : null}
{canManage ? <PublishAndInstall wsId={wsId} canManage={canManage} /> : null}
diff --git a/packages/views/settings/components/pr-merge-status-row.test.tsx b/packages/views/settings/components/pr-merge-status-row.test.tsx
new file mode 100644
index 0000000000..50e60f9ece
--- /dev/null
+++ b/packages/views/settings/components/pr-merge-status-row.test.tsx
@@ -0,0 +1,115 @@
+import type { ReactNode } from "react";
+import { beforeEach, describe, expect, it, vi } from "vitest";
+import { cleanup, render, screen, waitFor } from "@testing-library/react";
+import userEvent from "@testing-library/user-event";
+import { I18nProvider } from "@multica/core/i18n/react";
+import type { IssueStatusEntry } from "@multica/core/types";
+import enCommon from "../../locales/en/common.json";
+import enIssues from "../../locales/en/issues.json";
+import enSettings from "../../locales/en/settings.json";
+
+const mockUpdateWorkspace = vi.hoisted(() => vi.fn());
+const workspaceRef = vi.hoisted(() => ({
+ current: { id: "workspace-1", settings: {} as Record<string, unknown> },
+}));
+const catalogRef = vi.hoisted(() => ({ current: [] as IssueStatusEntry[] }));
+
+vi.mock("@tanstack/react-query", () => ({
+ useQuery: () => ({ data: catalogRef.current, isPending: false, isError: false, refetch: vi.fn() }),
+ useQueryClient: () => ({ setQueryData: vi.fn() }),
+ queryOptions: <T,>(opts: T) => opts,
+}));
+vi.mock("@multica/core/hooks", () => ({ useWorkspaceId: () => "workspace-1" }));
+vi.mock("@multica/core/paths", () => ({ useCurrentWorkspace: () => workspaceRef.current }));
+vi.mock("@multica/core/api", () => ({ api: { updateWorkspace: mockUpdateWorkspace } }));
+vi.mock("sonner", () => ({ toast: { error: vi.fn() } }));
+
+import { PRMergeStatusRow } from "./pr-merge-status-row";
+
+const TEST_RESOURCES = {
+ en: { common: enCommon, issues: enIssues, settings: enSettings },
+};
+
+function Wrapper({ children }: { children: ReactNode }) {
+ return (
+ <I18nProvider locale="en" resources={TEST_RESOURCES}>
+ {children}
+ </I18nProvider>
+ );
+}
+
+function status(key: string, name: string, category: IssueStatusEntry["category"]): IssueStatusEntry {
+ return {
+ id: key,
+ workspace_id: "workspace-1",
+ key,
+ name,
+ description: "",
+ category,
+ color: "#888888",
+ is_system: key !== "qa",
+ position: 0,
+ archived_at: null,
+ created_at: "",
+ updated_at: "",
+ };
+}
+
+const select = () =>
+ screen.getByRole("combobox", { name: enSettings.pr_merge_status.label });
+
+beforeEach(() => {
+ vi.clearAllMocks();
+ workspaceRef.current = { id: "workspace-1", settings: {} };
+ catalogRef.current = [
+ status("in_review", "In Review", "started"),
+ status("blocked", "Blocked", "started"),
+ status("qa", "QA", "started"),
+ status("done", "Done", "done"),
+ ];
+});
+
+describe("PRMergeStatusRow", () => {
+ it("moves issues to Done by default and shows no change when turned off", () => {
+ render(<PRMergeStatusRow canManage />, { wrapper: Wrapper });
+ expect(select()).toHaveTextContent("Done");
+
+ cleanup();
+ workspaceRef.current.settings = { pr_merge_status: "none" };
+ render(<PRMergeStatusRow canManage />, { wrapper: Wrapper });
+ expect(select()).toHaveTextContent(enSettings.pr_merge_status.none);
+ });
+
+ it("reads a status that is no longer offered as no change", () => {
+ workspaceRef.current.settings = { pr_merge_status: "retired" };
+ render(<PRMergeStatusRow canManage />, { wrapper: Wrapper });
+ expect(select()).toHaveTextContent(enSettings.pr_merge_status.none);
+ });
+
+ it("saves the chosen status alongside the other workspace settings", async () => {
+ const user = userEvent.setup();
+ workspaceRef.current.settings = { github_enabled: true };
+ mockUpdateWorkspace.mockResolvedValue({
+ ...workspaceRef.current,
+ settings: { github_enabled: true, pr_merge_status: "qa" },
+ });
+ render(<PRMergeStatusRow canManage />, { wrapper: Wrapper });
+
+ await user.click(select());
+ const qa = await screen.findByRole("option", { name: "QA" });
+ // A merge never blocks an issue.
+ expect(screen.queryByRole("option", { name: "Blocked" })).toBeNull();
+ await user.click(qa);
+
+ await waitFor(() =>
+ expect(mockUpdateWorkspace).toHaveBeenCalledWith("workspace-1", {
+ settings: { github_enabled: true, pr_merge_status: "qa" },
+ }),
+ );
+ });
+
+ it("is read-only for members who cannot manage the workspace", () => {
+ render(<PRMergeStatusRow canManage={false} />, { wrapper: Wrapper });
+ expect(select()).toBeDisabled();
+ });
+});
diff --git a/packages/views/settings/components/pr-merge-status-row.tsx b/packages/views/settings/components/pr-merge-status-row.tsx
index 97d6056fac..f488f02481 100644
--- a/packages/views/settings/components/pr-merge-status-row.tsx
+++ b/packages/views/settings/components/pr-merge-status-row.tsx
@@ -3,7 +3,7 @@
import { useState } from "react";
import { useQueryClient } from "@tanstack/react-query";
import { toast } from "sonner";
-import { CircleOff, GitMerge } from "lucide-react";
+import { CircleOff } from "lucide-react";
import { api } from "@multica/core/api";
import { derivePRMergeStatus, PR_MERGE_STATUS_NONE } from "@multica/core/github";
import { useWorkspaceId } from "@multica/core/hooks";
@@ -11,7 +11,6 @@ import { useIssueStatuses } from "@multica/core/issue-statuses/hooks";
import { useCurrentWorkspace } from "@multica/core/paths";
import type { IssueStatusCategory, Workspace } from "@multica/core/types";
import { workspaceKeys } from "@multica/core/workspace/queries";
-import { Label } from "@multica/ui/components/ui/label";
import {
Select,
SelectContent,
@@ -25,6 +24,7 @@ import {
import { StatusIcon } from "../../issues/components/status-icon";
import { useStatusLabel } from "../../issues/utils/status-label";
import { useT } from "../../i18n";
+import { SettingsRow } from "./settings-layout";
/** The categories a merge may move an issue into, with their built-ins.
* Blocked is left out: a merge never blocks an issue. */
@@ -34,18 +34,17 @@ const TARGET_CATEGORIES: { category: IssueStatusCategory; builtIns: string[] }[]
];
/**
- * "After PRs merge, move the issue to" (MUL-7726): the one PR merge setting,
- * shared by GitHub and self-hosted providers. It saves on change like the
- * other integration switches and only affects merges from now on.
+ * "After PRs merge, move the issue to" (MUL-7726): the one PR merge rule,
+ * shared by GitHub and self-hosted providers. It lives on the Code page with
+ * the other pull request rules and only affects merges from now on.
*/
-export function PRMergeStatusRow({ canManage, disabled = false }: { canManage: boolean; disabled?: boolean }) {
+export function PRMergeStatusRow({ canManage }: { canManage: boolean }) {
const { t } = useT("settings");
const workspace = useCurrentWorkspace();
const wsId = useWorkspaceId();
const qc = useQueryClient();
const catalog = useIssueStatuses(wsId);
const statusLabel = useStatusLabel(wsId);
- const [saving, setSaving] = useState(false);
// Built-ins are always offered: the server accepts them before the catalog
// is seeded, and the catalog may still be loading.
@@ -58,25 +57,7 @@ export function PRMergeStatusRow({ canManage, disabled = false }: { canManage: b
// nothing on the server, so it reads as "no change" here too.
const value = !catalog.isLoaded || groups.some((group) => group.keys.includes(stored)) ? stored : PR_MERGE_STATUS_NONE;
- async function persist(next: string) {
- if (!workspace || saving || next === value) return;
- setSaving(true);
- try {
- const updated = await api.updateWorkspace(workspace.id, {
- settings: { ...((workspace.settings as Record<string, unknown>) ?? {}), pr_merge_status: next },
- });
- qc.setQueryData(workspaceKeys.list(), (old: Workspace[] | undefined) =>
- old?.map((ws) => (ws.id === updated.id ? updated : ws)),
- );
- toast.success(t(($) => $.auto_save.toast_saved), { id: "settings-auto-save" });
- } catch (e) {
- toast.error(e instanceof Error ? e.message : t(($) => $.auto_save.failed));
- } finally {
- setSaving(false);
- }
- }
-
- const option = (key: string) =>
+ const renderOption = (key: string) =>
key === PR_MERGE_STATUS_NONE ? (
<>
<CircleOff className="text-muted-foreground" />
@@ -95,19 +76,32 @@ export function PRMergeStatusRow({ canManage, disabled = false }: { canManage: b
</>
);
+ const [saving, setSaving] = useState(false);
+
+ async function persist(next: string) {
+ if (!workspace || saving || next === value) return;
+ setSaving(true);
+ try {
+ const updated = await api.updateWorkspace(workspace.id, {
+ settings: { ...((workspace.settings as Record<string, unknown>) ?? {}), pr_merge_status: next },
+ });
+ qc.setQueryData(workspaceKeys.list(), (old: Workspace[] | undefined) =>
+ old?.map((ws) => (ws.id === updated.id ? updated : ws)),
+ );
+ } catch (e) {
+ toast.error(e instanceof Error ? e.message : t(($) => $.auto_save.failed));
+ } finally {
+ setSaving(false);
+ }
+ }
+
return (
- <div className="flex items-start justify-between gap-4 px-4 py-3.5">
- <div className="flex items-start gap-3">
- <div className="rounded-md border bg-muted/50 p-2 text-muted-foreground">
- <GitMerge className="h-4 w-4" />
- </div>
- <div className="space-y-1">
- <Label htmlFor="pr-merge-status" className="text-body font-medium">
- {t(($) => $.pr_merge_status.label)}
- </Label>
- <p className="text-body text-muted-foreground">{t(($) => $.pr_merge_status.description)}</p>
- </div>
- </div>
+ <SettingsRow
+ anchor="pr-merge-status"
+ label={t(($) => $.pr_merge_status.label)}
+ description={t(($) => $.pr_merge_status.description)}
+ size="select"
+ >
<Select
items={[
{ value: PR_MERGE_STATUS_NONE, label: t(($) => $.pr_merge_status.none) },
@@ -115,26 +109,31 @@ export function PRMergeStatusRow({ canManage, disabled = false }: { canManage: b
]}
value={value}
onValueChange={(next) => next && void persist(next)}
- disabled={!canManage || disabled || saving}
+ disabled={!canManage || saving}
>
- <SelectTrigger id="pr-merge-status" className="w-48 shrink-0" aria-busy={saving || undefined}>
- <SelectValue>{() => option(value)}</SelectValue>
+ <SelectTrigger
+ size="sm"
+ className="w-full"
+ aria-label={t(($) => $.pr_merge_status.label)}
+ aria-busy={saving || undefined}
+ >
+ <SelectValue>{() => renderOption(value)}</SelectValue>
</SelectTrigger>
- <SelectContent>
- <SelectItem value={PR_MERGE_STATUS_NONE}>{option(PR_MERGE_STATUS_NONE)}</SelectItem>
+ <SelectContent align="end">
+ <SelectItem value={PR_MERGE_STATUS_NONE}>{renderOption(PR_MERGE_STATUS_NONE)}</SelectItem>
{groups.map((group) => (
<SelectGroup key={group.category}>
<SelectSeparator />
<SelectLabel>{t(($) => $.issue_statuses.category_labels[group.category])}</SelectLabel>
{group.keys.map((key) => (
<SelectItem key={key} value={key}>
- {option(key)}
+ {renderOption(key)}
</SelectItem>
))}
</SelectGroup>
))}
</SelectContent>
</Select>
- </div>
+ </SettingsRow>
);
}
diff --git a/packages/views/settings/components/preferences-tab.test.tsx b/packages/views/settings/components/preferences-tab.test.tsx
index 7f2787f357..3ffe3bb404 100644
--- a/packages/views/settings/components/preferences-tab.test.tsx
+++ b/packages/views/settings/components/preferences-tab.test.tsx
@@ -9,7 +9,7 @@ import {
afterEach,
vi,
} from "vitest";
-import { render, screen, act, cleanup, waitFor } from "@testing-library/react";
+import { render, screen, act, cleanup, waitFor, within } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import { I18nProvider } from "@multica/core/i18n/react";
import enCommon from "../../locales/en/common.json";
@@ -54,6 +54,23 @@ vi.mock("@multica/core/i18n/react", async () => {
};
});
+// The chat store is registered by the app shell; a callable stand-in with the
+// Zustand shape is enough for the one toggle this page owns.
+const chatState = vi.hoisted(() => ({
+ floatingChatEnabled: true,
+ setFloatingChatEnabled: vi.fn(),
+}));
+vi.mock("@multica/core/chat", () => ({
+ useChatStore: Object.assign(
+ (selector: (state: typeof chatState) => unknown) => selector(chatState),
+ { getState: () => chatState },
+ ),
+}));
+
+vi.mock("@multica/core/paths", () => ({
+ useCurrentWorkspace: () => ({ id: "ws-1", name: "Acme" }),
+}));
+
vi.mock("@multica/core/api", () => ({
api: { updateMe: mockUpdateMe },
}));
@@ -88,6 +105,12 @@ vi.mock("@multica/core/auth", async () => {
import { PreferencesTab } from "./preferences-tab";
import { useCommentComposerStore } from "@multica/core/issues/stores";
+import {
+ DEFAULT_MANUAL_CREATE_FIELDS,
+ DEFAULT_QUICK_CREATE_FIELDS,
+ useIssueCreateSettingsStore,
+} from "@multica/core/issues/stores/issue-create-settings-store";
+
const TEST_RESOURCES = {
en: { common: enCommon, auth: enAuth, settings: enSettings },
@@ -136,44 +159,35 @@ describe("PreferencesTab — Language switcher", () => {
expect(mockReload).not.toHaveBeenCalled();
});
- it("shows a confirmation toast when the theme is saved locally", async () => {
+ it("applies the theme on this device without announcing success", async () => {
const user = userEvent.setup({ advanceTimers: vi.advanceTimersByTime });
render(<PreferencesTab />, { wrapper: I18nWrapper });
- await user.click(screen.getByRole("combobox", { name: "Theme" }));
- await user.click(await screen.findByRole("option", { name: "Dark" }));
+ const group = screen.getByRole("group", { name: "Theme" });
+ expect(within(group).getByRole("button", { name: "Light" })).toHaveAttribute(
+ "aria-pressed",
+ "true",
+ );
+ await user.click(within(group).getByRole("button", { name: "Dark" }));
expect(mockSetTheme).toHaveBeenCalledWith("dark");
- expect(mockToastSuccess).toHaveBeenCalledTimes(1);
+ expect(mockToastSuccess).not.toHaveBeenCalled();
});
- it("when not logged in: persists + reloads, no PATCH", async () => {
- const user = userEvent.setup({ advanceTimers: vi.advanceTimersByTime });
- render(<PreferencesTab />, { wrapper: I18nWrapper });
-
- await pickLanguage(user, "한국어");
-
- expect(mockPersist).toHaveBeenCalledWith("ko");
- expect(mockUpdateMe).not.toHaveBeenCalled();
- expect(mockToastSuccess).toHaveBeenCalledTimes(1);
- expect(mockReload).not.toHaveBeenCalled();
- act(() => vi.advanceTimersByTime(900));
- expect(mockReload).toHaveBeenCalledTimes(1);
- expect(mockToastWarning).not.toHaveBeenCalled();
- });
-
- it("when not logged in: selecting Japanese persists ja + reloads, no PATCH", async () => {
+ it.each([
+ { name: "한국어", locale: "ko" },
+ { name: "日本語", locale: "ja" },
+ ])("when not logged in: persists $locale and reloads, no PATCH", async ({ name, locale }) => {
const user = userEvent.setup({ advanceTimers: vi.advanceTimersByTime });
render(<PreferencesTab />, { wrapper: I18nWrapper });
- await pickLanguage(user, "日本語");
+ await pickLanguage(user, name);
- expect(mockPersist).toHaveBeenCalledWith("ja");
+ expect(mockPersist).toHaveBeenCalledWith(locale);
expect(mockUpdateMe).not.toHaveBeenCalled();
- expect(mockToastSuccess).toHaveBeenCalledTimes(1);
- expect(mockReload).not.toHaveBeenCalled();
- act(() => vi.advanceTimersByTime(900));
+ // The reload is the confirmation; no success toast precedes it.
expect(mockReload).toHaveBeenCalledTimes(1);
+ expect(mockToastSuccess).not.toHaveBeenCalled();
expect(mockToastWarning).not.toHaveBeenCalled();
});
@@ -191,10 +205,7 @@ describe("PreferencesTab — Language switcher", () => {
expect(mockPersist).toHaveBeenCalledWith(locale);
expect(mockUpdateMe).toHaveBeenCalledWith({ language: locale });
expect(mockToastWarning).not.toHaveBeenCalled();
- expect(mockToastSuccess).toHaveBeenCalledTimes(1);
- expect(mockReload).not.toHaveBeenCalled();
- act(() => vi.advanceTimersByTime(900));
- expect(mockReload).toHaveBeenCalledTimes(1);
+ await waitFor(() => expect(mockReload).toHaveBeenCalledTimes(1));
});
it("when logged in + PATCH fails: shows toast and delays reload by 2.5s", async () => {
@@ -220,12 +231,11 @@ describe("PreferencesTab — Language switcher", () => {
});
});
-describe("PreferencesTab — Timezone section", () => {
- // Shrink the picker to the curated COMMON_TIMEZONES fallback. With the
- // real Intl.supportedValuesOf the popup renders ~600 options, and
- // userEvent traversal of that list blew past the per-test timeout on
- // slow CI runners (MUL-4427). Everything these tests pick — Asia/Tokyo
- // and the "(browser)" sentinel — exists in the fallback list too.
+describe("PreferencesTab — Time zone", () => {
+ // Shrink the picker to the curated COMMON_TIMEZONES fallback so the list
+ // stays small enough for fast userEvent traversal (MUL-4427). Everything
+ // these tests pick — Asia/Tokyo and the "(browser)" entry — exists in the
+ // fallback list too.
const intlWithValues = Intl as typeof Intl & {
supportedValuesOf?: (key: "timeZone") => string[];
};
@@ -242,51 +252,46 @@ describe("PreferencesTab — Timezone section", () => {
userRef.current = null;
});
- // Base UI Select portals its popup onto document.body; unmount each
- // render fully between tests so a prior test's trigger/popup can't
- // shadow the next one's.
afterEach(() => {
cleanup();
});
- // Opens the Select popup and clicks the option whose accessible name
- // matches. Re-queries the trigger each call so it operates on the
- // current render, never a stale node.
async function pickTimezone(
user: ReturnType<typeof userEvent.setup>,
+ search: string,
name: RegExp | string,
) {
- await user.click(
- screen.getByRole("combobox", { name: "Viewing Timezone" }),
+ await user.click(screen.getByRole("button", { name: "Time zone" }));
+ await user.type(
+ await screen.findByPlaceholderText("Search time zones..."),
+ search,
);
await user.click(await screen.findByRole("option", { name }));
}
- it("renders the stored timezone in the trigger", () => {
+ it("renders the stored time zone in the trigger", () => {
userRef.current = { id: "user-1", timezone: "Asia/Shanghai" };
render(<PreferencesTab />, { wrapper: I18nWrapper });
expect(
- screen.getByRole("combobox", { name: "Viewing Timezone" }).textContent,
+ screen.getByRole("button", { name: "Time zone" }).textContent,
).toContain("Asia/Shanghai");
});
- // handleChange PATCHes then updates the store asynchronously, so the
- // post-pick assertions must waitFor it to settle.
- it("saving a new timezone PATCHes /api/me and updates the auth store", async () => {
+ it("searches the list and saves the chosen zone to the account", async () => {
userRef.current = { id: "user-1", timezone: "Asia/Shanghai" };
const updatedUser = { id: "user-1", timezone: "Asia/Tokyo" };
mockUpdateMe.mockResolvedValueOnce(updatedUser);
const user = userEvent.setup();
render(<PreferencesTab />, { wrapper: I18nWrapper });
- await pickTimezone(user, "Asia/Tokyo");
+ await pickTimezone(user, "tokyo", /Asia\/Tokyo/);
await waitFor(() => {
expect(mockUpdateMe).toHaveBeenCalledWith({ timezone: "Asia/Tokyo" });
expect(mockSetUser).toHaveBeenCalledWith(updatedUser);
- expect(mockToastSuccess).toHaveBeenCalledTimes(1);
});
+ expect(mockToastSuccess).not.toHaveBeenCalled();
});
it("surfaces a toast when the PATCH fails", async () => {
@@ -295,7 +300,7 @@ describe("PreferencesTab — Timezone section", () => {
const user = userEvent.setup();
render(<PreferencesTab />, { wrapper: I18nWrapper });
- await pickTimezone(user, "Asia/Tokyo");
+ await pickTimezone(user, "tokyo", /Asia\/Tokyo/);
await waitFor(() => {
expect(mockUpdateMe).toHaveBeenCalledWith({ timezone: "Asia/Tokyo" });
@@ -311,9 +316,9 @@ describe("PreferencesTab — Timezone section", () => {
const user = userEvent.setup();
render(<PreferencesTab />, { wrapper: I18nWrapper });
- // The "(browser)" sentinel option resets the preference to NULL; the
- // wire payload is an empty string the backend translates to NULL.
- await pickTimezone(user, /browser/i);
+ // The "(browser)" entry resets the preference to NULL; the wire payload
+ // is an empty string the backend translates to NULL.
+ await pickTimezone(user, "browser", /browser/i);
await waitFor(() => {
expect(mockUpdateMe).toHaveBeenCalledWith({ timezone: "" });
@@ -324,11 +329,12 @@ describe("PreferencesTab — Timezone section", () => {
});
});
-describe("PreferencesTab — Replying to a running agent", () => {
+describe("PreferencesTab — Comments & chat", () => {
beforeEach(() => {
vi.clearAllMocks();
userRef.current = null;
- useCommentComposerStore.setState({ runningAgentReply: "steer" });
+ useCommentComposerStore.setState({ runningAgentReply: "steer", sticky: true });
+ chatState.floatingChatEnabled = true;
});
afterEach(() => {
@@ -347,57 +353,82 @@ describe("PreferencesTab — Replying to a running agent", () => {
expect(useCommentComposerStore.getState().runningAgentReply).toBe("after_run");
expect(select).toHaveTextContent("Start after this run");
- expect(mockToastSuccess).toHaveBeenCalledTimes(1);
+ expect(mockToastSuccess).not.toHaveBeenCalled();
});
-});
-describe("PreferencesTab — Sticky comment bar", () => {
- beforeEach(() => {
- vi.clearAllMocks();
- userRef.current = null;
- useCommentComposerStore.setState({ sticky: true });
+ it("toggles the sticky comment bar and the floating chat silently", async () => {
+ const user = userEvent.setup();
+ render(<PreferencesTab />, { wrapper: I18nWrapper });
+
+ const sticky = screen.getByRole("switch", { name: "Pin comment bar to bottom" });
+ expect(sticky).toHaveAttribute("aria-checked", "true");
+ await user.click(sticky);
+ expect(useCommentComposerStore.getState().sticky).toBe(false);
+
+ await user.click(screen.getByRole("switch", { name: enSettings.chat.floating_label }));
+ expect(chatState.setFloatingChatEnabled).toHaveBeenCalledWith(false);
+ expect(mockToastSuccess).not.toHaveBeenCalled();
});
+});
+describe("PreferencesTab — Create-issue fields", () => {
+ function resetStore() {
+ useIssueCreateSettingsStore.setState({
+ quickCreateFields: DEFAULT_QUICK_CREATE_FIELDS,
+ manualCreateFields: DEFAULT_MANUAL_CREATE_FIELDS,
+ });
+ }
+ beforeEach(resetStore);
afterEach(() => {
cleanup();
+ resetStore();
});
- it("renders on by default and toggles the preference off with a saved toast", async () => {
- const user = userEvent.setup();
+ it("shows one row per field with a column per create dialog", () => {
render(<PreferencesTab />, { wrapper: I18nWrapper });
+ const table = screen.getByRole("table");
+ // 7 fields; quick create supports 3 of them, manual create all 7.
+ expect(within(table).getAllByRole("checkbox")).toHaveLength(10);
+ expect(
+ within(table).getByRole("checkbox", { name: "Project · Create with agent" }),
+ ).toBeChecked();
+ expect(
+ within(table).getByRole("checkbox", { name: "Due date · Manual create" }),
+ ).not.toBeChecked();
+ // Unsupported cells explain themselves instead of rendering a dead box.
+ expect(
+ within(table).getAllByLabelText(enSettings.preferences.issue_fields.unsupported),
+ ).toHaveLength(4);
+ });
- const toggle = screen.getByRole("switch", { name: "Pin comment bar to bottom" });
- expect(toggle).toHaveAttribute("aria-checked", "true");
-
- await user.click(toggle);
+ it("persists each dialog's fields independently", async () => {
+ const user = userEvent.setup();
+ render(<PreferencesTab />, { wrapper: I18nWrapper });
- expect(useCommentComposerStore.getState().sticky).toBe(false);
- expect(toggle).toHaveAttribute("aria-checked", "false");
- expect(mockToastSuccess).toHaveBeenCalledTimes(1);
+ await user.click(screen.getByRole("checkbox", { name: "Priority · Create with agent" }));
+ await user.click(screen.getByRole("checkbox", { name: "Labels · Manual create" }));
+
+ expect(useIssueCreateSettingsStore.getState().quickCreateFields).toEqual([
+ "project",
+ "priority",
+ ]);
+ expect(useIssueCreateSettingsStore.getState().manualCreateFields).toEqual([
+ "status",
+ "priority",
+ "assignee",
+ "project",
+ ]);
});
});
-describe("Preferences sections", () => {
+describe("PreferencesTab — Scope", () => {
afterEach(() => {
- navigationState.search = "";
cleanup();
});
- it("opens the issue creation controls from an old bookmark", () => {
- navigationState.search = "tab=issue";
- render(
- <I18nWrapper>
- <PreferencesTab />
- </I18nWrapper>,
- );
- expect(screen.getByRole("tab", { name: "Issue creation" })).toHaveAttribute(
- "aria-selected",
- "true",
- );
- expect(
- screen.getByText(enSettings.preferences.issue_scope),
- ).toBeInTheDocument();
- expect(
- screen.queryByRole("combobox", { name: "Theme" }),
- ).not.toBeInTheDocument();
+
+ it("labels where each group of settings is stored", () => {
+ render(<PreferencesTab />, { wrapper: I18nWrapper });
+ expect(screen.getByText("Account · synced")).toBeInTheDocument();
+ expect(screen.getAllByText("This device only")).toHaveLength(2);
});
});
diff --git a/packages/views/settings/components/preferences-tab.tsx b/packages/views/settings/components/preferences-tab.tsx
index a2cf2b5b92..ca7e20238a 100644
--- a/packages/views/settings/components/preferences-tab.tsx
+++ b/packages/views/settings/components/preferences-tab.tsx
@@ -1,6 +1,7 @@
"use client";
-import { useMemo } from "react";
+import { useMemo, useState } from "react";
+import { ChevronsUpDown } from "lucide-react";
import { toast } from "sonner";
import {
Select,
@@ -10,6 +11,19 @@ import {
SelectValue,
} from "@multica/ui/components/ui/select";
import { Switch } from "@multica/ui/components/ui/switch";
+import { Checkbox } from "@multica/ui/components/ui/checkbox";
+import {
+ Popover,
+ PopoverContent,
+ PopoverTrigger,
+} from "@multica/ui/components/ui/popover";
+import {
+ Command,
+ CommandEmpty,
+ CommandInput,
+ CommandItem,
+ CommandList,
+} from "@multica/ui/components/ui/command";
import { useTheme } from "@multica/ui/components/common/theme-provider";
import {
DEFAULT_LOCALE,
@@ -18,19 +32,21 @@ import {
} from "@multica/core/i18n";
import { useLocaleAdapter } from "@multica/core/i18n/react";
import { useAuthStore } from "@multica/core/auth";
-import { useCommentComposerStore, type RunningAgentReply } from "@multica/core/issues/stores";
+import { useChatStore } from "@multica/core/chat";
+import {
+ useCommentComposerStore,
+ type RunningAgentReply,
+} from "@multica/core/issues/stores";
+import {
+ MANUAL_CREATE_FIELDS,
+ QUICK_CREATE_FIELDS,
+ useIssueCreateSettingsStore,
+ type ManualCreateField,
+ type QuickCreateField,
+} from "@multica/core/issues/stores/issue-create-settings-store";
import { api } from "@multica/core/api";
import { browserTimezone, timezoneOptions } from "../../common/timezone-select";
-import {
- Tabs,
- TabsList,
- TabsTrigger,
- TabsContent,
-} from "@multica/ui/components/ui/tabs";
-import { useNavigation } from "../../navigation";
-import { resolveSettingsLocation, settingsHref } from "./settings-navigation";
-import { IssueTab } from "./issue-tab";
-import { ChatTab } from "./chat-tab";
+import { SegmentedToggle } from "../../common/segmented-toggle";
import { useT } from "../../i18n";
import {
SettingsCard,
@@ -39,77 +55,98 @@ import {
SettingsTab,
} from "./settings-layout";
+/**
+ * Preferences on one page. The settings here are stored in three different
+ * places — the account (language, timezone), this device (theme, composer,
+ * chat) and this device for the current workspace (create-dialog fields) —
+ * so each section carries a scope badge instead of splitting them into tabs.
+ * Changes apply immediately; only failures are announced.
+ */
export function PreferencesTab() {
const { t } = useT("settings");
- const navigation = useNavigation();
- const requested = resolveSettingsLocation(navigation.searchParams).section;
- const section =
- requested === "issue" || requested === "chat" ? requested : "general";
return (
- <SettingsTab
- title={t(($) => $.page.tabs.preferences)}
- >
- <Tabs
- value={section}
- onValueChange={(next) =>
- navigation.replace(
- settingsHref(
- navigation.pathname,
- navigation.searchParams,
- "preferences",
- { section: String(next) },
- ),
- )
- }
+ <SettingsTab title={t(($) => $.page.tabs.preferences)}>
+ <SettingsSection
+ title={t(($) => $.preferences.region_title)}
+ scope="account"
+ anchor="region"
>
- <TabsList
- variant="line"
- className="mb-6 max-w-full justify-start"
- aria-label={t(($) => $.page.tabs.preferences)}
- >
- <TabsTrigger value="general">
- {t(($) => $.preferences.general_title)}
- </TabsTrigger>
- <TabsTrigger value="issue">
- {t(($) => $.preferences.issue_title)}
- </TabsTrigger>
- <TabsTrigger value="chat">{t(($) => $.page.tabs.chat)}</TabsTrigger>
- </TabsList>
- <TabsContent value="general">
- <GeneralPreferences />
- </TabsContent>
- <TabsContent value="issue">
- <IssueTab />
- </TabsContent>
- <TabsContent value="chat">
- <ChatTab />
- </TabsContent>
- </Tabs>
+ <SettingsCard>
+ <LanguageRow />
+ <TimezoneRow />
+ </SettingsCard>
+ </SettingsSection>
+
+ <SettingsSection
+ title={t(($) => $.preferences.appearance_title)}
+ scope="device"
+ anchor="appearance"
+ >
+ <SettingsCard>
+ <ThemeRow />
+ </SettingsCard>
+ </SettingsSection>
+
+ <SettingsSection
+ title={t(($) => $.preferences.comments_title)}
+ scope="device"
+ anchor="comments"
+ >
+ <SettingsCard>
+ <StickyCommentBarRow />
+ <RunningAgentReplyRow />
+ <FloatingChatRow />
+ </SettingsCard>
+ </SettingsSection>
+
+ <SettingsSection
+ title={t(($) => $.preferences.issue_fields_title)}
+ description={t(($) => $.issue.description)}
+ scope="device-workspace"
+ anchor="issue"
+ >
+ <IssueFieldsMatrix />
+ </SettingsSection>
</SettingsTab>
);
}
-function GeneralPreferences() {
+function ThemeRow() {
+ const { t } = useT("settings");
const { theme, setTheme } = useTheme();
+ const value = theme === "light" || theme === "dark" ? theme : "system";
+ return (
+ <SettingsRow anchor="theme" label={t(($) => $.preferences.theme.title)}>
+ <div role="group" aria-label={t(($) => $.preferences.theme.title)}>
+ <SegmentedToggle
+ value={value}
+ onChange={setTheme}
+ buttonClassName="px-3 py-1 text-label"
+ options={[
+ ["light", t(($) => $.preferences.theme.light)],
+ ["dark", t(($) => $.preferences.theme.dark)],
+ ["system", t(($) => $.preferences.theme.system)],
+ ]}
+ />
+ </div>
+ </SettingsRow>
+ );
+}
+
+function LanguageRow() {
const { t, i18n } = useT("settings");
const localeAdapter = useLocaleAdapter();
const user = useAuthStore((s) => s.user);
// i18next.language can be a region-tagged BCP-47 string (e.g. "en-US",
// "zh-Hans-CN") returned by intl-localematcher. Normalize to a supported
- // locale before comparing — otherwise the radio shows neither option active.
+ // locale before comparing — otherwise the select shows neither option.
const currentLocale: SupportedLocale = SUPPORTED_LOCALES.includes(
i18n.language as SupportedLocale,
)
? (i18n.language as SupportedLocale)
: DEFAULT_LOCALE;
- const themeOptions = [
- { value: "light" as const, label: t(($) => $.preferences.theme.light) },
- { value: "dark" as const, label: t(($) => $.preferences.theme.dark) },
- { value: "system" as const, label: t(($) => $.preferences.theme.system) },
- ];
-
const languageOptions: { value: SupportedLocale; label: string }[] = [
{ value: "en", label: t(($) => $.preferences.language.english) },
{ value: "zh-Hans", label: t(($) => $.preferences.language.chinese) },
@@ -120,7 +157,7 @@ function GeneralPreferences() {
// Persist locally → sync to user.language → reload. Reload (vs in-place
// changeLanguage) avoids hydration mismatch and is the i18next-recommended
- // pattern for App Router.
+ // pattern for App Router. The reload itself is the confirmation.
//
// If the cross-device sync (PATCH /api/me) fails, the local cookie is
// already written so the new locale will take effect after reload — but
@@ -146,105 +183,40 @@ function GeneralPreferences() {
setTimeout(() => window.location.reload(), 2500);
return;
}
- toast.success(
- t(($) => $.auto_save.toast_saved),
- {
- id: "settings-auto-save",
- },
- );
- // Keep the confirmation visible before the locale reload replaces the UI.
- setTimeout(() => window.location.reload(), 900);
+ window.location.reload();
};
return (
- <>
- <SettingsSection title={t(($) => $.preferences.general_title)}>
- <SettingsCard>
- <SettingsRow
- label={t(($) => $.preferences.theme.title)}
- size="select"
- >
- <Select
- items={themeOptions}
- value={theme}
- onValueChange={(next) => {
- if (!next || next === theme) return;
- setTheme(next as (typeof themeOptions)[number]["value"]);
- toast.success(
- t(($) => $.auto_save.toast_saved),
- {
- id: "settings-auto-save",
- },
- );
- }}
- >
- <SelectTrigger
- size="sm"
- className="w-full"
- aria-label={t(($) => $.preferences.theme.title)}
- >
- <SelectValue>
- {themeOptions.find((option) => option.value === theme)?.label}
- </SelectValue>
- </SelectTrigger>
- <SelectContent align="end">
- {themeOptions.map((option) => (
- <SelectItem key={option.value} value={option.value}>
- {option.label}
- </SelectItem>
- ))}
- </SelectContent>
- </Select>
- </SettingsRow>
-
- <SettingsRow
- label={t(($) => $.preferences.language.title)}
- size="select"
- >
- <Select
- items={languageOptions}
- value={currentLocale}
- onValueChange={(next) => {
- if (next) void handleLanguageChange(next as SupportedLocale);
- }}
- >
- <SelectTrigger
- size="sm"
- className="w-full"
- aria-label={t(($) => $.preferences.language.title)}
- >
- <SelectValue>
- {
- languageOptions.find(
- (option) => option.value === currentLocale,
- )?.label
- }
- </SelectValue>
- </SelectTrigger>
- <SelectContent align="end">
- {languageOptions.map((option) => (
- <SelectItem key={option.value} value={option.value}>
- {option.label}
- </SelectItem>
- ))}
- </SelectContent>
- </Select>
- </SettingsRow>
-
- <TimezoneRow />
- </SettingsCard>
- </SettingsSection>
- <SettingsSection
- title={t(($) => $.preferences.comments_title)}
- description={t(($) => $.preferences.device_hint)}
- className="mt-8"
+ <SettingsRow
+ anchor="language"
+ label={t(($) => $.preferences.language.title)}
+ size="select"
+ >
+ <Select
+ items={languageOptions}
+ value={currentLocale}
+ onValueChange={(next) => {
+ if (next) void handleLanguageChange(next as SupportedLocale);
+ }}
>
- <SettingsCard>
- <StickyCommentBarRow />
- <RunningAgentReplyRow />
- </SettingsCard>
- </SettingsSection>
- </>
+ <SelectTrigger
+ size="sm"
+ className="w-full"
+ aria-label={t(($) => $.preferences.language.title)}
+ >
+ <SelectValue>
+ {languageOptions.find((option) => option.value === currentLocale)?.label}
+ </SelectValue>
+ </SelectTrigger>
+ <SelectContent align="end">
+ {languageOptions.map((option) => (
+ <SelectItem key={option.value} value={option.value}>
+ {option.label}
+ </SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
+ </SettingsRow>
);
}
@@ -255,19 +227,12 @@ function StickyCommentBarRow() {
return (
<SettingsRow
+ anchor="sticky-comment-bar"
label={t(($) => $.preferences.sticky_comment_bar.title)}
>
<Switch
checked={sticky}
- onCheckedChange={() => {
- toggleSticky();
- toast.success(
- t(($) => $.auto_save.toast_saved),
- {
- id: "settings-auto-save",
- },
- );
- }}
+ onCheckedChange={() => toggleSticky()}
aria-label={t(($) => $.preferences.sticky_comment_bar.title)}
/>
</SettingsRow>
@@ -285,6 +250,7 @@ function RunningAgentReplyRow() {
return (
<SettingsRow
+ anchor="running-agent-reply"
label={t(($) => $.preferences.running_agent_reply.title)}
description={t(($) => $.preferences.running_agent_reply.hint)}
size="select"
@@ -293,14 +259,7 @@ function RunningAgentReplyRow() {
items={options}
value={value}
onValueChange={(next) => {
- if (!next || next === value) return;
- setValue(next as RunningAgentReply);
- toast.success(
- t(($) => $.auto_save.toast_saved),
- {
- id: "settings-auto-save",
- },
- );
+ if (next && next !== value) setValue(next as RunningAgentReply);
}}
>
<SelectTrigger
@@ -324,38 +283,156 @@ function RunningAgentReplyRow() {
);
}
-// Base UI rejects "" as a SelectItem value, so route the "no preference"
-// state through this sentinel and translate at the wire boundary.
+/**
+ * When off, the FAB / overlay never mount and Chat is reachable only from its
+ * dedicated tab. A persisted client setting, so it applies immediately.
+ */
+function FloatingChatRow() {
+ const { t } = useT("settings");
+ const enabled = useChatStore((s) => s.floatingChatEnabled);
+ const setEnabled = useChatStore((s) => s.setFloatingChatEnabled);
+ return (
+ <SettingsRow
+ anchor="chat"
+ label={t(($) => $.chat.floating_label)}
+ description={t(($) => $.chat.floating_hint)}
+ >
+ <Switch
+ checked={enabled}
+ onCheckedChange={(checked) => setEnabled(checked)}
+ aria-label={t(($) => $.chat.floating_label)}
+ />
+ </SettingsRow>
+ );
+}
+
+/**
+ * Which fields each create-issue dialog keeps on its toolbar, as one field ×
+ * dialog grid. A field toggled off stays reachable from the dialog's ⋯
+ * overflow and re-surfaces while it holds a value, so hiding is never
+ * destructive. Quick create supports fewer fields; those cells show a dash.
+ */
+function IssueFieldsMatrix() {
+ const { t } = useT("settings");
+ const quickFields = useIssueCreateSettingsStore((s) => s.quickCreateFields);
+ const setQuickVisible = useIssueCreateSettingsStore(
+ (s) => s.setQuickCreateFieldVisible,
+ );
+ const manualFields = useIssueCreateSettingsStore((s) => s.manualCreateFields);
+ const setManualVisible = useIssueCreateSettingsStore(
+ (s) => s.setManualCreateFieldVisible,
+ );
+ const quickLabel = t(($) => $.preferences.issue_fields.quick);
+ const manualLabel = t(($) => $.preferences.issue_fields.manual);
+
+ return (
+ <SettingsCard>
+ <table className="w-full text-body">
+ <thead>
+ <tr className="border-b border-surface-border bg-muted/20 text-caption font-medium text-muted-foreground">
+ <th scope="col" className="px-4 py-2 text-left font-medium">
+ {t(($) => $.preferences.issue_fields.field)}
+ </th>
+ <th scope="col" className="w-32 px-4 py-2 text-center font-medium">
+ {quickLabel}
+ </th>
+ <th scope="col" className="w-32 px-4 py-2 text-center font-medium">
+ {manualLabel}
+ </th>
+ </tr>
+ </thead>
+ <tbody className="divide-y divide-surface-border">
+ {MANUAL_CREATE_FIELDS.map((field: ManualCreateField) => {
+ const fieldLabel = t(($) => $.issue.fields[field]);
+ const quickSupported = (QUICK_CREATE_FIELDS as readonly string[]).includes(field);
+ return (
+ <tr key={field}>
+ <th scope="row" className="px-4 py-2.5 text-left font-normal">
+ {fieldLabel}
+ </th>
+ <td className="px-4 py-2.5 text-center">
+ {quickSupported ? (
+ <Checkbox
+ checked={quickFields.includes(field as QuickCreateField)}
+ onCheckedChange={(checked) =>
+ setQuickVisible(field as QuickCreateField, checked === true)
+ }
+ aria-label={`${fieldLabel} · ${quickLabel}`}
+ />
+ ) : (
+ <span
+ className="text-faint-foreground"
+ aria-label={t(($) => $.preferences.issue_fields.unsupported)}
+ title={t(($) => $.preferences.issue_fields.unsupported)}
+ >
+ —
+ </span>
+ )}
+ </td>
+ <td className="px-4 py-2.5 text-center">
+ <Checkbox
+ checked={manualFields.includes(field)}
+ onCheckedChange={(checked) =>
+ setManualVisible(field, checked === true)
+ }
+ aria-label={`${fieldLabel} · ${manualLabel}`}
+ />
+ </td>
+ </tr>
+ );
+ })}
+ </tbody>
+ </table>
+ </SettingsCard>
+ );
+}
+
+// Base UI rejects "" as an item value, so route the "no preference" state
+// through this sentinel and translate at the wire boundary.
const BROWSER_TZ_VALUE = "__browser__";
+/** "UTC+8", "UTC-3:30" — the offset right now, for scanning the list. */
+function utcOffset(tz: string): string {
+ try {
+ const part = new Intl.DateTimeFormat("en-US", {
+ timeZone: tz,
+ timeZoneName: "shortOffset",
+ })
+ .formatToParts(new Date())
+ .find((p) => p.type === "timeZoneName")?.value;
+ return part ? part.replace(/^GMT/, "UTC").replace(/^UTC$/, "UTC+0") : "";
+ } catch {
+ return "";
+ }
+}
+
function TimezoneRow() {
const { t } = useT("settings");
const user = useAuthStore((s) => s.user);
const setUser = useAuthStore((s) => s.setUser);
+ const [open, setOpen] = useState(false);
const stored = user?.timezone ?? null;
const browser = browserTimezone();
const value = stored ?? BROWSER_TZ_VALUE;
- // Full IANA list (from timezoneOptions in common/timezone-select) so a
- // user needing a non-curated zone isn't stuck with ~18 common ones.
- // Memoized — timezoneOptions enumerates ~600 IANA zones per call.
+ // The full IANA list (~600 zones) so a user needing a non-curated zone is
+ // not stuck with the common ones — which is why this is searchable.
const options = useMemo(
- () => timezoneOptions(stored ?? browser),
+ () =>
+ timezoneOptions(stored ?? browser).map((tz) => ({
+ tz,
+ offset: utcOffset(tz),
+ })),
[stored, browser],
);
const handleChange = async (next: string) => {
+ setOpen(false);
if (next === value) return;
const payload = next === BROWSER_TZ_VALUE ? "" : next;
try {
const updated = await api.updateMe({ timezone: payload });
setUser(updated);
- toast.success(
- t(($) => $.auto_save.toast_saved),
- {
- id: "settings-auto-save",
- },
- );
} catch (err) {
toast.error(
err instanceof Error && err.message
@@ -365,57 +442,72 @@ function TimezoneRow() {
}
};
- const formatTZLabel = (tz: string) => {
- if (tz === BROWSER_TZ_VALUE) {
- return `${browser}${t(($) => $.preferences.timezone.browser_suffix)}`;
- }
- return tz;
- };
+ const current = stored ?? browser;
+ const suffix = stored ? "" : t(($) => $.preferences.timezone.browser_suffix);
return (
<SettingsRow
+ anchor="timezone"
label={t(($) => $.preferences.timezone.title)}
description={t(($) => $.preferences.timezone.hint)}
size="select-wide"
>
- <Select
- items={[
- { value: BROWSER_TZ_VALUE, label: formatTZLabel(BROWSER_TZ_VALUE) },
- ...options.map((timezone) => ({
- value: timezone,
- label: formatTZLabel(timezone),
- })),
- ]}
- value={value}
- onValueChange={(next) => {
- if (next) void handleChange(next);
- }}
- >
- <SelectTrigger
- size="sm"
- className="w-full font-mono text-caption"
- aria-label={t(($) => $.preferences.timezone.title)}
+ <Popover open={open} onOpenChange={setOpen}>
+ <PopoverTrigger
+ render={
+ <button
+ type="button"
+ aria-label={t(($) => $.preferences.timezone.title)}
+ className="flex h-7 w-full items-center gap-1.5 rounded-md border border-input bg-transparent pl-2.5 pr-2 text-left text-body outline-none transition-colors focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 dark:bg-input/30 dark:hover:bg-input/50"
+ />
+ }
>
- <SelectValue>{formatTZLabel(value)}</SelectValue>
- </SelectTrigger>
- <SelectContent align="end" className="max-h-72">
- <SelectItem
- value={BROWSER_TZ_VALUE}
- className="font-mono text-caption"
+ <span className="min-w-0 flex-1 truncate font-mono text-caption">
+ {current}
+ {suffix}
+ </span>
+ <span className="shrink-0 text-caption text-muted-foreground">
+ {utcOffset(current)}
+ </span>
+ <ChevronsUpDown aria-hidden="true" className="size-4 shrink-0 text-muted-foreground" />
+ </PopoverTrigger>
+ <PopoverContent align="end" className="w-80 p-0">
+ {/* Plain substring matching: fuzzy ranking puts "Antarctica/Vostok"
+ next to "Asia/Tokyo" for "tok", which reads as a wrong result. */}
+ <Command
+ filter={(itemValue, search) =>
+ itemValue.toLocaleLowerCase().includes(search.trim().toLocaleLowerCase()) ? 1 : 0
+ }
>
- {formatTZLabel(BROWSER_TZ_VALUE)}
- </SelectItem>
- {options.map((timezone) => (
- <SelectItem
- key={timezone}
- value={timezone}
- className="font-mono text-caption"
- >
- {formatTZLabel(timezone)}
- </SelectItem>
- ))}
- </SelectContent>
- </Select>
+ <CommandInput placeholder={t(($) => $.preferences.timezone.search)} />
+ <CommandList>
+ <CommandEmpty>{t(($) => $.preferences.timezone.empty)}</CommandEmpty>
+ <CommandItem
+ value={`${browser} ${t(($) => $.preferences.timezone.browser_suffix)}`}
+ data-checked={value === BROWSER_TZ_VALUE}
+ onSelect={() => void handleChange(BROWSER_TZ_VALUE)}
+ >
+ <span className="min-w-0 flex-1 truncate font-mono text-caption">
+ {browser}
+ {t(($) => $.preferences.timezone.browser_suffix)}
+ </span>
+ <span className="text-caption text-muted-foreground">{utcOffset(browser)}</span>
+ </CommandItem>
+ {options.map(({ tz, offset }) => (
+ <CommandItem
+ key={tz}
+ value={`${tz} ${offset}`}
+ data-checked={value === tz}
+ onSelect={() => void handleChange(tz)}
+ >
+ <span className="min-w-0 flex-1 truncate font-mono text-caption">{tz}</span>
+ <span className="text-caption text-muted-foreground">{offset}</span>
+ </CommandItem>
+ ))}
+ </CommandList>
+ </Command>
+ </PopoverContent>
+ </Popover>
</SettingsRow>
);
}
diff --git a/packages/views/settings/components/properties-tab.tsx b/packages/views/settings/components/properties-tab.tsx
index 9ab24f549d..9d0605a9c0 100644
--- a/packages/views/settings/components/properties-tab.tsx
+++ b/packages/views/settings/components/properties-tab.tsx
@@ -77,7 +77,7 @@ import {
PropertyIconPicker,
} from "../../common/property-icon";
import { useLocale, useT } from "../../i18n";
-import { SettingsTab } from "./settings-layout";
+import { SettingsReadOnlyNotice, SettingsTab } from "./settings-layout";
const MAX_ACTIVE_PROPERTIES = 20;
@@ -141,7 +141,9 @@ export function PropertiesTab() {
<SettingsTab
title={t(($) => $.properties.title)}
description={t(($) => $.properties.description)}
+ scope="workspace"
>
+ {currentMember && !canManage ? <SettingsReadOnlyNotice wsId={wsId} /> : null}
<div className="space-y-5">
<div className="flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between">
<div className="relative w-full sm:max-w-sm">
diff --git a/packages/views/settings/components/quick-actions-tab.tsx b/packages/views/settings/components/quick-actions-tab.tsx
index c2d1368fa1..9977a19303 100644
--- a/packages/views/settings/components/quick-actions-tab.tsx
+++ b/packages/views/settings/components/quick-actions-tab.tsx
@@ -248,6 +248,7 @@ export function QuickActionsTab() {
<SettingsTab
title={t(($) => $.quick_actions.title)}
description={t(($) => $.quick_actions.description)}
+ scope="workspace"
>
<div className="space-y-5">
<div className="flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between">
diff --git a/packages/views/settings/components/repositories-section.test.tsx b/packages/views/settings/components/repositories-section.test.tsx
new file mode 100644
index 0000000000..7c2dcbeefb
--- /dev/null
+++ b/packages/views/settings/components/repositories-section.test.tsx
@@ -0,0 +1,374 @@
+import type { ReactNode } from "react";
+import { beforeEach, describe, expect, it, vi } from "vitest";
+import { render, screen, waitFor, within } from "@testing-library/react";
+import userEvent from "@testing-library/user-event";
+import { I18nProvider } from "@multica/core/i18n/react";
+import enCommon from "../../locales/en/common.json";
+import enSettings from "../../locales/en/settings.json";
+
+const mockUpdateWorkspace = vi.hoisted(() => vi.fn());
+const mockGetGitHubConnectURL = vi.hoisted(() => vi.fn());
+const mockNavReplace = vi.hoisted(() => vi.fn());
+const mockToastError = vi.hoisted(() => vi.fn());
+const workspaceRef = vi.hoisted(() => ({
+ current: {
+ id: "workspace-1",
+ name: "Test Workspace",
+ slug: "test-workspace",
+ repos: [] as { url: string; description?: string }[],
+ },
+}));
+const roleRef = vi.hoisted(() => ({
+ current: "owner" as "owner" | "admin" | "member",
+}));
+const githubRef = vi.hoisted(() => ({
+ current: {
+ installations: [] as { id: string; account_login: string }[],
+ configured: true,
+ repository_browse_configured: true,
+ can_manage: true,
+ },
+}));
+const githubQueryStateRef = vi.hoisted(() => ({
+ current: { isPending: false, isFetching: false },
+}));
+const githubRepositoriesRef = vi.hoisted(() => ({
+ current: [] as {
+ id: number;
+ full_name: string;
+ html_url: string;
+ clone_url: string;
+ description: string | null;
+ private: boolean;
+ archived: boolean;
+ default_branch: string;
+ }[],
+}));
+const searchParamsRef = vi.hoisted(() => ({
+ current: new URLSearchParams("tab=code"),
+}));
+
+vi.mock("@tanstack/react-query", () => ({
+ useQuery: () => ({ data: githubRef.current, ...githubQueryStateRef.current }),
+ useInfiniteQuery: () => ({
+ data: {
+ pages: [
+ {
+ repositories: githubRepositoriesRef.current,
+ total_count: githubRepositoriesRef.current.length,
+ next_page: null,
+ },
+ ],
+ },
+ isPending: false,
+ isError: false,
+ hasNextPage: false,
+ isFetchingNextPage: false,
+ fetchNextPage: vi.fn(),
+ }),
+ useQueryClient: () => ({ setQueryData: vi.fn() }),
+ queryOptions: <T,>(options: T) => options,
+ infiniteQueryOptions: <T,>(options: T) => options,
+}));
+
+vi.mock("@multica/core/hooks", () => ({ useWorkspaceId: () => "workspace-1" }));
+vi.mock("@multica/core/permissions", () => ({
+ useCurrentMember: () => ({ role: roleRef.current, isLoading: false }),
+}));
+vi.mock("@multica/core/paths", () => ({
+ useCurrentWorkspace: () => workspaceRef.current,
+}));
+vi.mock("@multica/core/workspace/queries", () => ({
+ workspaceKeys: { list: () => ["workspaces"] },
+}));
+vi.mock("@multica/core/api", () => ({
+ api: {
+ updateWorkspace: mockUpdateWorkspace,
+ getGitHubConnectURL: mockGetGitHubConnectURL,
+ },
+}));
+vi.mock("sonner", () => ({ toast: { success: vi.fn(), error: mockToastError } }));
+vi.mock("../../navigation", () => ({
+ useNavigation: () => ({
+ push: vi.fn(),
+ replace: mockNavReplace,
+ pathname: "/acme/settings",
+ searchParams: searchParamsRef.current,
+ }),
+}));
+
+import { RepositoriesSection, repositoryIdentity } from "./repositories-section";
+
+const TEST_RESOURCES = { en: { common: enCommon, settings: enSettings } };
+
+function Wrapper({ children }: { children: ReactNode }) {
+ return (
+ <I18nProvider locale="en" resources={TEST_RESOURCES}>
+ {children}
+ </I18nProvider>
+ );
+}
+
+beforeEach(() => {
+ vi.clearAllMocks();
+ workspaceRef.current = {
+ id: "workspace-1",
+ name: "Test Workspace",
+ slug: "test-workspace",
+ repos: [{ url: "https://github.com/multica-ai/multica", description: "Main app" }],
+ };
+ roleRef.current = "owner";
+ githubRef.current = {
+ installations: [],
+ configured: true,
+ repository_browse_configured: true,
+ can_manage: true,
+ };
+ githubQueryStateRef.current = { isPending: false, isFetching: false };
+ githubRepositoriesRef.current = [];
+ searchParamsRef.current = new URLSearchParams("tab=code");
+ mockUpdateWorkspace.mockImplementation(async (_id: string, payload: object) => ({
+ ...workspaceRef.current,
+ ...payload,
+ }));
+});
+
+async function openAddMenu(user: ReturnType<typeof userEvent.setup>) {
+ await user.click(screen.getByRole("button", { name: /Add repository/ }));
+}
+
+describe("RepositoriesSection", () => {
+ it("lists repositories as read-only rows with their description", () => {
+ render(<RepositoriesSection />, { wrapper: Wrapper });
+
+ expect(screen.getByText("https://github.com/multica-ai/multica")).toBeInTheDocument();
+ expect(screen.getByText("Main app")).toBeInTheDocument();
+ expect(screen.queryByRole("textbox")).toBeNull();
+ });
+
+ it("adds a repository from the dialog in one request", async () => {
+ const user = userEvent.setup();
+ render(<RepositoriesSection />, { wrapper: Wrapper });
+
+ await openAddMenu(user);
+ await user.click(await screen.findByRole("menuitem", { name: "Enter a URL..." }));
+ const dialog = await screen.findByRole("dialog", { name: "Add repository" });
+ const save = within(dialog).getByRole("button", { name: "Save" });
+ expect(save).toBeDisabled();
+
+ await user.type(
+ within(dialog).getByRole("textbox", { name: "Repository URL" }),
+ "[email protected]:acme/api.git",
+ );
+ await user.type(
+ within(dialog).getByRole("textbox", { name: "Description" }),
+ " Go API ",
+ );
+ await user.click(save);
+
+ await waitFor(() => {
+ expect(mockUpdateWorkspace).toHaveBeenCalledWith("workspace-1", {
+ repos: [
+ { url: "https://github.com/multica-ai/multica", description: "Main app" },
+ { url: "[email protected]:acme/api.git", description: "Go API" },
+ ],
+ });
+ });
+ await waitFor(() => expect(screen.queryByRole("dialog")).toBeNull());
+ });
+
+ it("refuses a repository that is already listed under another URL form", async () => {
+ const user = userEvent.setup();
+ render(<RepositoriesSection />, { wrapper: Wrapper });
+
+ await openAddMenu(user);
+ await user.click(await screen.findByRole("menuitem", { name: "Enter a URL..." }));
+ const dialog = await screen.findByRole("dialog", { name: "Add repository" });
+ await user.type(
+ within(dialog).getByRole("textbox", { name: "Repository URL" }),
+ "[email protected]:multica-ai/multica.git",
+ );
+
+ expect(within(dialog).getByText("This repository is already added.")).toBeInTheDocument();
+ expect(within(dialog).getByRole("button", { name: "Save" })).toBeDisabled();
+ });
+
+ it("keeps the dialog open with the input when saving fails", async () => {
+ mockUpdateWorkspace.mockRejectedValueOnce(new Error("boom"));
+ const user = userEvent.setup();
+ render(<RepositoriesSection />, { wrapper: Wrapper });
+
+ await user.click(screen.getByRole("button", { name: /Actions for https:\/\/github.com\/multica-ai\/multica/ }));
+ await user.click(await screen.findByRole("menuitem", { name: "Edit" }));
+ const dialog = await screen.findByRole("dialog", { name: "Edit repository" });
+ const description = within(dialog).getByRole("textbox", { name: "Description" });
+ await user.clear(description);
+ await user.type(description, "Renamed");
+ await user.click(within(dialog).getByRole("button", { name: "Save" }));
+
+ await waitFor(() => expect(mockToastError).toHaveBeenCalledWith("boom"));
+ expect(screen.getByRole("dialog", { name: "Edit repository" })).toBeInTheDocument();
+ expect(description).toHaveValue("Renamed");
+ });
+
+ it("removes a repository only after confirmation", async () => {
+ const user = userEvent.setup();
+ render(<RepositoriesSection />, { wrapper: Wrapper });
+
+ await user.click(screen.getByRole("button", { name: /Actions for https:\/\/github.com\/multica-ai\/multica/ }));
+ await user.click(await screen.findByRole("menuitem", { name: "Delete repository" }));
+ expect(mockUpdateWorkspace).not.toHaveBeenCalled();
+ await user.click(
+ within(await screen.findByRole("alertdialog")).getByRole("button", {
+ name: "Delete repository",
+ }),
+ );
+
+ await waitFor(() => {
+ expect(mockUpdateWorkspace).toHaveBeenCalledWith("workspace-1", { repos: [] });
+ });
+ });
+
+ it("hides every write affordance from members", () => {
+ roleRef.current = "member";
+ render(<RepositoriesSection />, { wrapper: Wrapper });
+
+ expect(screen.queryByRole("button", { name: /Add repository/ })).toBeNull();
+ expect(screen.queryByRole("button", { name: /Actions for/ })).toBeNull();
+ });
+
+ it("starts GitHub connection with the signed repository return target", async () => {
+ mockGetGitHubConnectURL.mockResolvedValue({
+ configured: true,
+ url: "https://github.com/apps/multica/installations/new",
+ });
+ const open = vi.spyOn(window, "open").mockImplementation(() => null);
+ const user = userEvent.setup();
+ render(<RepositoriesSection />, { wrapper: Wrapper });
+
+ await openAddMenu(user);
+ await user.click(await screen.findByRole("menuitem", { name: /Connect GitHub/ }));
+
+ await waitFor(() => {
+ expect(mockGetGitHubConnectURL).toHaveBeenCalledWith("workspace-1", "repositories");
+ expect(open).toHaveBeenCalledWith(
+ "https://github.com/apps/multica/installations/new",
+ "_blank",
+ "noopener",
+ );
+ });
+ open.mockRestore();
+ });
+
+ it("explains why GitHub import is unavailable when browsing is not configured", async () => {
+ githubRef.current = { ...githubRef.current, repository_browse_configured: false };
+ const user = userEvent.setup();
+ render(<RepositoriesSection />, { wrapper: Wrapper });
+
+ await openAddMenu(user);
+ const item = await screen.findByRole("menuitem", { name: /Connect GitHub/ });
+ expect(item).toHaveAttribute("aria-disabled", "true");
+ expect(item).toHaveTextContent("GITHUB_APP_ID");
+ });
+
+ it("imports selected GitHub repositories and deduplicates HTTPS against SSH", async () => {
+ workspaceRef.current = {
+ ...workspaceRef.current,
+ repos: [{ url: "[email protected]:multica-ai/multica.git" }],
+ };
+ githubRef.current = {
+ ...githubRef.current,
+ installations: [{ id: "installation-row-1", account_login: "multica-ai" }],
+ };
+ githubRepositoriesRef.current = [
+ {
+ id: 1,
+ full_name: "multica-ai/multica",
+ html_url: "https://github.com/multica-ai/multica",
+ clone_url: "https://github.com/multica-ai/multica.git",
+ description: "Existing repository",
+ private: false,
+ archived: false,
+ default_branch: "main",
+ },
+ {
+ id: 2,
+ full_name: "multica-ai/console",
+ html_url: "https://github.com/multica-ai/console",
+ clone_url: "https://github.com/multica-ai/console.git",
+ description: "Console app",
+ private: true,
+ archived: false,
+ default_branch: "main",
+ },
+ ];
+ const user = userEvent.setup();
+ render(<RepositoriesSection />, { wrapper: Wrapper });
+
+ await openAddMenu(user);
+ await user.click(await screen.findByRole("menuitem", { name: /Choose from GitHub/ }));
+ const checkboxes = await screen.findAllByRole("checkbox");
+ expect(checkboxes).toHaveLength(2);
+ expect(
+ checkboxes[0]!.hasAttribute("disabled") ||
+ checkboxes[0]!.getAttribute("aria-disabled") === "true",
+ ).toBe(true);
+
+ await user.click(checkboxes[1]!);
+ await user.click(screen.getByRole("button", { name: "Add repositories" }));
+
+ await waitFor(() => {
+ expect(mockUpdateWorkspace).toHaveBeenCalledWith("workspace-1", {
+ repos: [
+ { url: "[email protected]:multica-ai/multica.git" },
+ { url: "https://github.com/multica-ai/console.git", description: "Console app" },
+ ],
+ });
+ });
+ });
+
+ it("opens the picker after returning from a GitHub connection", async () => {
+ githubRef.current = {
+ ...githubRef.current,
+ installations: [{ id: "installation-row-1", account_login: "multica-ai" }],
+ };
+ searchParamsRef.current = new URLSearchParams("tab=repositories&github_connected=1");
+
+ render(<RepositoriesSection />, { wrapper: Wrapper });
+
+ expect(
+ await screen.findByRole("heading", { name: "Choose GitHub repositories" }),
+ ).toBeTruthy();
+ expect(mockNavReplace).toHaveBeenCalledWith("/acme/settings?tab=repositories");
+ });
+
+ it("clears the GitHub callback query after an empty installation result", async () => {
+ searchParamsRef.current = new URLSearchParams("tab=repositories&github_connected=1");
+
+ render(<RepositoriesSection />, { wrapper: Wrapper });
+
+ await waitFor(() => {
+ expect(mockNavReplace).toHaveBeenCalledWith("/acme/settings?tab=repositories");
+ });
+ expect(screen.queryByRole("heading", { name: "Choose GitHub repositories" })).toBeNull();
+ });
+});
+
+describe("repositoryIdentity", () => {
+ it("preserves repository path casing when comparing clone URLs", () => {
+ expect(repositoryIdentity("https://GitHub.com/Acme/Repo.git")).toBe("github.com/Acme/Repo");
+ expect(repositoryIdentity("[email protected]:acme/repo.git")).toBe("github.com/acme/repo");
+ });
+
+ it("keeps a non-default port, since it can name another server", () => {
+ expect(repositoryIdentity("https://git.example.com:8443/acme/api.git")).not.toBe(
+ repositoryIdentity("https://git.example.com:9443/acme/api.git"),
+ );
+ expect(repositoryIdentity("https://git.example.com:443/acme/api.git")).toBe(
+ repositoryIdentity("[email protected]:acme/api.git"),
+ );
+ expect(repositoryIdentity("ssh://[email protected]:22/acme/api.git")).toBe(
+ repositoryIdentity("[email protected]:acme/api.git"),
+ );
+ });
+});
diff --git a/packages/views/settings/components/repositories-tab.tsx b/packages/views/settings/components/repositories-section.tsx
similarity index 60%
rename from packages/views/settings/components/repositories-tab.tsx
rename to packages/views/settings/components/repositories-section.tsx
index 8543436a32..9f3e07b6d7 100644
--- a/packages/views/settings/components/repositories-tab.tsx
+++ b/packages/views/settings/components/repositories-section.tsx
@@ -1,8 +1,18 @@
"use client";
-import { useCallback, useEffect, useMemo, useState } from "react";
-import { LoaderCircle, Plus, Search, Trash2 } from "lucide-react";
+import { useEffect, useMemo, useState } from "react";
+import {
+ ChevronDown,
+ FolderGit2,
+ LoaderCircle,
+ MoreHorizontal,
+ Pencil,
+ Plus,
+ Search,
+ Trash2,
+} from "lucide-react";
import { Input } from "@multica/ui/components/ui/input";
+import { Label } from "@multica/ui/components/ui/label";
import { Button } from "@multica/ui/components/ui/button";
import { Badge } from "@multica/ui/components/ui/badge";
import { Checkbox } from "@multica/ui/components/ui/checkbox";
@@ -31,16 +41,22 @@ import {
AlertDialogHeader,
AlertDialogTitle,
} from "@multica/ui/components/ui/alert-dialog";
+import {
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuItem,
+ DropdownMenuTrigger,
+} from "@multica/ui/components/ui/dropdown-menu";
import { toast } from "sonner";
import {
useInfiniteQuery,
useQuery,
useQueryClient,
} from "@tanstack/react-query";
-import { useAuthStore } from "@multica/core/auth";
import { useWorkspaceId } from "@multica/core/hooks";
+import { useCurrentMember } from "@multica/core/permissions";
import { useCurrentWorkspace } from "@multica/core/paths";
-import { memberListOptions, workspaceKeys } from "@multica/core/workspace/queries";
+import { workspaceKeys } from "@multica/core/workspace/queries";
import {
githubInstallationRepositoriesOptions,
githubInstallationsOptions,
@@ -53,26 +69,21 @@ import type {
} from "@multica/core/types";
import { useNavigation } from "../../navigation";
import { useT } from "../../i18n";
-import {
- SettingsCard,
- SettingsSaveState,
- SettingsSection,
- SettingsTab,
-} from "./settings-layout";
-import { useAutoSave } from "./use-auto-save";
+import { SettingsCard, SettingsSection } from "./settings-layout";
import { GitHubMark } from "./github-mark";
const EMPTY_REPOSITORIES: WorkspaceRepo[] = [];
-function repositoriesEqual(left: WorkspaceRepo[], right: WorkspaceRepo[]) {
- if (left.length !== right.length) return false;
- return left.every(
- (repo, index) =>
- repo.url === right[index]?.url &&
- (repo.description ?? "") === (right[index]?.description ?? ""),
- );
-}
+/** Default ports the URL parser keeps for schemes it does not know. */
+const DEFAULT_PORTS: Record<string, string> = { "ssh:": "22", "git:": "9418" };
+/**
+ * Host + path identity of a clone URL, so HTTPS and SSH forms of the same
+ * repository compare equal. Path casing is preserved: hosts are
+ * case-insensitive, repository paths are not guaranteed to be. A non-default
+ * port stays in the identity: it can name a different server, and treating
+ * two instances as one would block adding the second.
+ */
export function repositoryIdentity(rawURL: string): string | null {
const value = rawURL.trim();
if (!value) return null;
@@ -90,6 +101,9 @@ export function repositoryIdentity(rawURL: string): string | null {
try {
const parsed = new URL(value);
host = parsed.hostname;
+ if (parsed.port && parsed.port !== DEFAULT_PORTS[parsed.protocol]) {
+ host = `${host}:${parsed.port}`;
+ }
path = parsed.pathname;
} catch {
return null;
@@ -103,17 +117,30 @@ export function repositoryIdentity(rawURL: string): string | null {
return `${host.toLowerCase()}/${normalizedPath}`;
}
-export function RepositoriesTab() {
+interface RepositoryDraft {
+ /** Index being edited, or null when adding. */
+ index: number | null;
+ url: string;
+ description: string;
+}
+
+/**
+ * The repositories agents may clone and push to. Rows are read-only; adding
+ * and editing happen in a dialog that saves on confirm, so a half-typed URL
+ * is never persisted and every change is one deliberate request.
+ */
+export function RepositoriesSection() {
const { t } = useT("settings");
- const user = useAuthStore((state) => state.user);
const workspace = useCurrentWorkspace();
const wsId = useWorkspaceId();
const queryClient = useQueryClient();
const navigation = useNavigation();
- const { data: members = [] } = useQuery(memberListOptions(wsId));
- const [repositories, setRepositories] = useState<WorkspaceRepo[]>(
- workspace?.repos ?? EMPTY_REPOSITORIES,
- );
+ const { role } = useCurrentMember(wsId);
+ const canManageWorkspace = role === "owner" || role === "admin";
+ const repositories = workspace?.repos ?? EMPTY_REPOSITORIES;
+
+ const [draft, setDraft] = useState<RepositoryDraft | null>(null);
+ const [saving, setSaving] = useState(false);
const [pendingRemovalIndex, setPendingRemovalIndex] = useState<number | null>(null);
const [connectingGitHub, setConnectingGitHub] = useState(false);
const [githubPickerOpen, setGitHubPickerOpen] = useState(false);
@@ -123,9 +150,6 @@ export function RepositoriesTab() {
>(new Map());
const [repositorySearch, setRepositorySearch] = useState("");
- const currentMember = members.find((member) => member.user_id === user?.id) ?? null;
- const canManageWorkspace =
- currentMember?.role === "owner" || currentMember?.role === "admin";
const {
data: githubData,
isPending: githubInstallationsPending,
@@ -173,13 +197,6 @@ export function RepositoriesTab() {
);
}, [githubRepositories, repositorySearch]);
- useEffect(() => {
- setRepositories(workspace?.repos ?? EMPTY_REPOSITORIES);
- // A cache update after auto-save replaces the Workspace object. Keying on
- // identity prevents that response from wiping a newer local keystroke.
- // eslint-disable-next-line react-hooks/exhaustive-deps -- intentionally keyed on workspace identity
- }, [workspace?.id]);
-
useEffect(() => {
if (
selectedInstallationID &&
@@ -192,6 +209,9 @@ export function RepositoriesTab() {
setSelectedInstallationID(githubInstallations[0]?.id ?? "");
}, [githubInstallations, selectedInstallationID]);
+ // The GitHub App install flow returns with `github_connected=1` (or an
+ // error). Open the picker once the installation list reflects the new
+ // install, then drop the one-shot params so a refresh does not repeat it.
useEffect(() => {
const connected = navigation.searchParams.get("github_connected") === "1";
const githubError = navigation.searchParams.get("github_error");
@@ -227,53 +247,58 @@ export function RepositoriesTab() {
t,
]);
- const savedRepositories = workspace?.repos ?? EMPTY_REPOSITORIES;
- const draft = useMemo(() => repositories, [repositories]);
- const saveRepositories = useCallback(
- async (next: WorkspaceRepo[]) => {
- if (!workspace) return;
+ const persist = async (next: WorkspaceRepo[]) => {
+ if (!workspace) return false;
+ setSaving(true);
+ try {
const updated = await api.updateWorkspace(workspace.id, { repos: next });
queryClient.setQueryData(
workspaceKeys.list(),
(old: Workspace[] | undefined) =>
old?.map((item) => (item.id === updated.id ? updated : item)),
);
- },
- [queryClient, workspace],
- );
- const allUrlsValid = repositories.every((repo) => repo.url.trim().length > 0);
- const autoSave = useAutoSave({
- value: draft,
- savedValue: savedRepositories,
- onSave: saveRepositories,
- onSuccess: () =>
- toast.success(t(($) => $.repositories.toast_saved), {
- id: "settings-auto-save",
- }),
- onError: (error) =>
+ return true;
+ } catch (error) {
toast.error(
error instanceof Error
? error.message
: t(($) => $.repositories.toast_save_failed),
- ),
- enabled: !!workspace && canManageWorkspace && allUrlsValid,
- isEqual: repositoriesEqual,
- });
+ );
+ return false;
+ } finally {
+ setSaving(false);
+ }
+ };
- const updateRepository = (
- index: number,
- field: keyof WorkspaceRepo,
- value: string,
- ) => {
- setRepositories((current) =>
- current.map((repo, repoIndex) =>
- repoIndex === index ? { ...repo, [field]: value } : repo,
- ),
+ const draftIdentity = draft ? repositoryIdentity(draft.url) : null;
+ const draftDuplicate =
+ !!draftIdentity &&
+ repositories.some(
+ (repository, index) =>
+ index !== draft?.index &&
+ repositoryIdentity(repository.url) === draftIdentity,
);
+
+ const saveDraft = async () => {
+ if (!draft || !draft.url.trim() || draftDuplicate) return;
+ const entry: WorkspaceRepo = {
+ url: draft.url.trim(),
+ ...(draft.description.trim() ? { description: draft.description.trim() } : {}),
+ };
+ const next =
+ draft.index === null
+ ? [...repositories, entry]
+ : repositories.map((repository, index) =>
+ index === draft.index ? entry : repository,
+ );
+ if (await persist(next)) setDraft(null);
};
- const addRepository = () => {
- setRepositories((current) => [...current, { url: "" }]);
+ const removeRepository = async (index: number) => {
+ const ok = await persist(
+ repositories.filter((_, repoIndex) => repoIndex !== index),
+ );
+ if (ok) setPendingRemovalIndex(null);
};
const openGitHubPicker = () => {
@@ -283,11 +308,7 @@ export function RepositoriesTab() {
setGitHubPickerOpen(true);
};
- const handleGitHubAction = async () => {
- if (githubInstallations.length > 0) {
- openGitHubPicker();
- return;
- }
+ const connectGitHub = async () => {
setConnectingGitHub(true);
try {
const response = await api.getGitHubConnectURL(wsId, "repositories");
@@ -325,11 +346,7 @@ export function RepositoriesTab() {
});
};
- const importGitHubRepositories = () => {
- if (!allUrlsValid) {
- toast.error(t(($) => $.repositories.complete_manual_entry_first));
- return;
- }
+ const importGitHubRepositories = async () => {
const additions: WorkspaceRepo[] = [];
const known = new Set(existingRepositoryIdentities);
for (const repository of selectedRepositories.values()) {
@@ -347,138 +364,232 @@ export function RepositoriesTab() {
closeGitHubPicker();
return;
}
- const next = [...repositories, ...additions];
- setRepositories(next);
- autoSave.saveNow(next);
- closeGitHubPicker();
- };
-
- const removeRepository = (index: number) => {
- const next = repositories.filter((_, repoIndex) => repoIndex !== index);
- setRepositories(next);
- autoSave.saveNow(next);
+ if (await persist([...repositories, ...additions])) closeGitHubPicker();
};
if (!workspace) return null;
+ const githubItemDisabled =
+ connectingGitHub ||
+ !githubBrowseConfigured ||
+ (!githubConnectConfigured && githubInstallations.length === 0);
+
return (
- <SettingsTab title={t(($) => $.page.tabs.repositories)}>
- <SettingsSection
- description={t(($) => $.repositories.description)}
- action={
- <SettingsSaveState
- status={autoSave.status}
- savingLabel={t(($) => $.auto_save.saving)}
- savedLabel={t(($) => $.auto_save.saved)}
- errorLabel={t(($) => $.auto_save.failed)}
- />
- }
- >
- <SettingsCard>
- {repositories.length === 0 ? (
- <div className="px-4 py-8 text-center text-caption text-muted-foreground">
- {t(($) => $.repositories.empty)}
- </div>
- ) : null}
+ <SettingsSection
+ title={t(($) => $.repositories.section_title)}
+ description={t(($) => $.repositories.description)}
+ anchor="repositories"
+ action={
+ canManageWorkspace ? (
+ <DropdownMenu>
+ <DropdownMenuTrigger render={<Button size="sm" />}>
+ <Plus />
+ {t(($) => $.repositories.add)}
+ <ChevronDown />
+ </DropdownMenuTrigger>
+ <DropdownMenuContent align="end" className="w-auto min-w-56">
+ <DropdownMenuItem
+ disabled={githubItemDisabled}
+ onClick={() =>
+ githubInstallations.length > 0
+ ? openGitHubPicker()
+ : void connectGitHub()
+ }
+ >
+ {connectingGitHub ? (
+ <LoaderCircle className="animate-spin" />
+ ) : (
+ <GitHubMark className="size-4" />
+ )}
+ <span className="flex flex-col">
+ <span>
+ {githubInstallations.length > 0
+ ? t(($) => $.repositories.choose_from_github)
+ : t(($) => $.repositories.connect_github)}
+ </span>
+ {!githubBrowseConfigured ? (
+ <span className="text-caption text-muted-foreground">
+ {t(($) => $.repositories.github_browse_not_configured)}
+ </span>
+ ) : null}
+ </span>
+ </DropdownMenuItem>
+ <DropdownMenuItem
+ onClick={() => setDraft({ index: null, url: "", description: "" })}
+ >
+ <Pencil />
+ {t(($) => $.repositories.add_manually)}
+ </DropdownMenuItem>
+ </DropdownMenuContent>
+ </DropdownMenu>
+ ) : null
+ }
+ >
+ <SettingsCard>
+ {repositories.length === 0 ? (
+ <div className="px-4 py-8 text-center text-caption text-muted-foreground">
+ {canManageWorkspace
+ ? t(($) => $.repositories.empty)
+ : t(($) => $.repositories.manage_hint)}
+ </div>
+ ) : (
+ repositories.map((repository, index) => {
+ const identity = repositoryIdentity(repository.url);
+ const onGitHub = identity?.startsWith("github.com/") ?? false;
+ return (
+ <div
+ key={`${index}:${repository.url}`}
+ className="flex min-h-14 items-center gap-3 px-4 py-2.5"
+ >
+ <span
+ aria-hidden="true"
+ className="flex size-5 shrink-0 items-center justify-center text-muted-foreground"
+ >
+ {onGitHub ? (
+ <GitHubMark className="size-4" />
+ ) : (
+ <FolderGit2 className="size-4" />
+ )}
+ </span>
+ <div className="min-w-0 flex-1">
+ <p className="truncate font-mono text-label" title={repository.url}>
+ {repository.url}
+ </p>
+ {repository.description ? (
+ <p className="mt-0.5 truncate text-caption text-muted-foreground">
+ {repository.description}
+ </p>
+ ) : null}
+ </div>
+ {canManageWorkspace ? (
+ <DropdownMenu>
+ <DropdownMenuTrigger
+ render={
+ <Button
+ variant="ghost"
+ size="icon-sm"
+ aria-label={t(($) => $.repositories.actions_aria, {
+ url: repository.url,
+ })}
+ />
+ }
+ >
+ <MoreHorizontal />
+ </DropdownMenuTrigger>
+ <DropdownMenuContent align="end" className="w-auto">
+ <DropdownMenuItem
+ onClick={() =>
+ setDraft({
+ index,
+ url: repository.url,
+ description: repository.description ?? "",
+ })
+ }
+ >
+ <Pencil />
+ {t(($) => $.repositories.edit)}
+ </DropdownMenuItem>
+ <DropdownMenuItem
+ variant="destructive"
+ onClick={() => setPendingRemovalIndex(index)}
+ >
+ <Trash2 />
+ {t(($) => $.repositories.delete_confirm_action)}
+ </DropdownMenuItem>
+ </DropdownMenuContent>
+ </DropdownMenu>
+ ) : null}
+ </div>
+ );
+ })
+ )}
+ </SettingsCard>
- {repositories.map((repository, index) => (
- <div
- key={index}
- className="grid gap-2 px-4 py-3.5 sm:grid-cols-[minmax(0,1fr)_minmax(0,0.8fr)_auto] sm:items-center"
- >
+ <Dialog
+ open={draft !== null}
+ onOpenChange={(open) => {
+ if (!open && !saving) setDraft(null);
+ }}
+ >
+ <DialogContent className="sm:max-w-lg">
+ <DialogHeader>
+ <DialogTitle>
+ {draft?.index === null
+ ? t(($) => $.repositories.add_title)
+ : t(($) => $.repositories.edit_title)}
+ </DialogTitle>
+ <DialogDescription>{t(($) => $.repositories.description)}</DialogDescription>
+ </DialogHeader>
+ <form
+ className="space-y-4"
+ onSubmit={(event) => {
+ event.preventDefault();
+ void saveDraft();
+ }}
+ >
+ <div className="space-y-1.5">
+ <Label htmlFor="repository-url">{t(($) => $.repositories.url_label)}</Label>
<Input
- type="text"
- name={`repository-${index}-url`}
+ id="repository-url"
autoComplete="off"
spellCheck={false}
- aria-label={t(($) => $.repositories.url_placeholder)}
- value={repository.url}
+ value={draft?.url ?? ""}
onChange={(event) =>
- updateRepository(index, "url", event.target.value)
+ setDraft((current) =>
+ current ? { ...current, url: event.target.value } : current,
+ )
}
- onBlur={autoSave.flush}
- disabled={!canManageWorkspace}
- aria-invalid={!repository.url.trim()}
+ aria-invalid={draftDuplicate || undefined}
placeholder={t(($) => $.repositories.url_placeholder)}
className="font-mono text-caption"
/>
+ {draftDuplicate ? (
+ <p className="text-caption text-destructive">
+ {t(($) => $.repositories.duplicate)}
+ </p>
+ ) : null}
+ </div>
+ <div className="space-y-1.5">
+ <Label htmlFor="repository-description">
+ {t(($) => $.repositories.description_label)}
+ </Label>
<Input
- type="text"
- name={`repository-${index}-description`}
+ id="repository-description"
autoComplete="off"
- aria-label={t(($) => $.repositories.description_placeholder)}
- value={repository.description ?? ""}
+ value={draft?.description ?? ""}
onChange={(event) =>
- updateRepository(index, "description", event.target.value)
+ setDraft((current) =>
+ current ? { ...current, description: event.target.value } : current,
+ )
}
- onBlur={autoSave.flush}
- disabled={!canManageWorkspace}
placeholder={t(($) => $.repositories.description_placeholder)}
/>
- {canManageWorkspace ? (
- <Button
- variant="ghost"
- size="icon-sm"
- aria-label={t(($) => $.repositories.delete_aria)}
- className="justify-self-end text-muted-foreground hover:text-destructive"
- onClick={() => setPendingRemovalIndex(index)}
- >
- <Trash2 className="size-3.5" />
- </Button>
- ) : null}
- </div>
- ))}
-
- {canManageWorkspace ? (
- <div className="flex flex-wrap items-center justify-between gap-3 px-4 py-3.5">
- <div className="flex flex-wrap items-center gap-2">
- <Button variant="outline" size="sm" onClick={addRepository}>
- <Plus className="size-3.5" />
- {t(($) => $.repositories.add)}
- </Button>
- <Button
- size="sm"
- onClick={handleGitHubAction}
- disabled={
- connectingGitHub ||
- !githubBrowseConfigured ||
- (!githubConnectConfigured &&
- githubInstallations.length === 0)
- }
- title={
- !githubBrowseConfigured
- ? t(($) => $.repositories.github_browse_not_configured)
- : undefined
- }
- >
- {connectingGitHub ? (
- <LoaderCircle className="size-3.5 animate-spin" />
- ) : (
- <GitHubMark className="size-3.5" />
- )}
- {githubInstallations.length > 0
- ? t(($) => $.repositories.choose_from_github)
- : t(($) => $.repositories.connect_github)}
- </Button>
- </div>
- {!allUrlsValid ? (
- <span className="text-caption text-muted-foreground">
- {t(($) => $.repositories.url_empty)}
- </span>
- ) : null}
</div>
- ) : (
- <div className="px-4 py-3 text-caption text-muted-foreground">
- {t(($) => $.repositories.manage_hint)}
- </div>
- )}
- </SettingsCard>
- </SettingsSection>
+ <DialogFooter>
+ <Button
+ type="button"
+ variant="outline"
+ onClick={() => setDraft(null)}
+ disabled={saving}
+ >
+ {t(($) => $.repositories.github_cancel)}
+ </Button>
+ <Button
+ type="submit"
+ disabled={saving || !draft?.url.trim() || draftDuplicate}
+ aria-busy={saving || undefined}
+ >
+ {saving ? t(($) => $.repositories.saving) : t(($) => $.repositories.save)}
+ </Button>
+ </DialogFooter>
+ </form>
+ </DialogContent>
+ </Dialog>
<Dialog
open={githubPickerOpen}
onOpenChange={(open) => {
- if (!open) closeGitHubPicker();
+ if (!open && !saving) closeGitHubPicker();
}}
>
<DialogContent className="flex max-h-[85vh] flex-col gap-0 p-0 sm:max-w-2xl">
@@ -643,12 +754,13 @@ export function RepositoriesTab() {
count: selectedRepositories.size,
})}
</p>
- <Button variant="ghost" onClick={closeGitHubPicker}>
+ <Button variant="ghost" onClick={closeGitHubPicker} disabled={saving}>
{t(($) => $.repositories.github_cancel)}
</Button>
<Button
- onClick={importGitHubRepositories}
- disabled={selectedRepositories.size === 0 || !allUrlsValid}
+ onClick={() => void importGitHubRepositories()}
+ disabled={selectedRepositories.size === 0 || saving}
+ aria-busy={saving || undefined}
>
{t(($) => $.repositories.github_import)}
</Button>
@@ -659,7 +771,7 @@ export function RepositoriesTab() {
<AlertDialog
open={pendingRemovalIndex !== null}
onOpenChange={(open) => {
- if (!open) setPendingRemovalIndex(null);
+ if (!open && !saving) setPendingRemovalIndex(null);
}}
>
<AlertDialogContent>
@@ -672,16 +784,16 @@ export function RepositoriesTab() {
</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
- <AlertDialogCancel>
+ <AlertDialogCancel disabled={saving}>
{t(($) => $.repositories.delete_confirm_cancel)}
</AlertDialogCancel>
<AlertDialogAction
variant="destructive"
+ disabled={saving}
onClick={() => {
if (pendingRemovalIndex !== null) {
- removeRepository(pendingRemovalIndex);
+ void removeRepository(pendingRemovalIndex);
}
- setPendingRemovalIndex(null);
}}
>
{t(($) => $.repositories.delete_confirm_action)}
@@ -689,6 +801,6 @@ export function RepositoriesTab() {
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>
- </SettingsTab>
+ </SettingsSection>
);
}
diff --git a/packages/views/settings/components/repositories-tab.test.tsx b/packages/views/settings/components/repositories-tab.test.tsx
deleted file mode 100644
index bda731accd..0000000000
--- a/packages/views/settings/components/repositories-tab.test.tsx
+++ /dev/null
@@ -1,472 +0,0 @@
-import type { ReactNode } from "react";
-import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
-import { render, screen, waitFor } from "@testing-library/react";
-import userEvent from "@testing-library/user-event";
-import { I18nProvider } from "@multica/core/i18n/react";
-import enCommon from "../../locales/en/common.json";
-import enSettings from "../../locales/en/settings.json";
-
-const mockUpdateWorkspace = vi.hoisted(() => vi.fn());
-const mockGetGitHubConnectURL = vi.hoisted(() => vi.fn());
-const mockFetchNextPage = vi.hoisted(() => vi.fn());
-const mockNavReplace = vi.hoisted(() => vi.fn());
-const mockToastSuccess = vi.hoisted(() => vi.fn());
-const workspaceRef = vi.hoisted(() => ({
- current: {
- id: "workspace-1",
- name: "Test Workspace",
- slug: "test-workspace",
- repos: [{ url: "https://github.com/multica-ai/multica" }] as {
- url: string;
- description?: string;
- }[],
- },
-}));
-const membersRef = vi.hoisted(() => ({
- current: [{ user_id: "user-1", role: "owner" as "owner" | "admin" | "member" }],
-}));
-const githubRef = vi.hoisted(() => ({
- current: {
- installations: [] as { id: string; account_login: string }[],
- configured: true,
- repository_browse_configured: true,
- can_manage: true,
- },
-}));
-const githubQueryStateRef = vi.hoisted(() => ({
- current: {
- isPending: false,
- isFetching: false,
- },
-}));
-const githubRepositoriesRef = vi.hoisted(() => ({
- current: [] as {
- id: number;
- full_name: string;
- html_url: string;
- clone_url: string;
- description: string | null;
- private: boolean;
- archived: boolean;
- default_branch: string;
- }[],
-}));
-const searchParamsRef = vi.hoisted(() => ({
- current: new URLSearchParams("tab=repositories"),
-}));
-
-vi.mock("@tanstack/react-query", () => ({
- useQuery: (options: { queryKey: readonly unknown[] }) => {
- if (options.queryKey.includes("installations")) {
- return { data: githubRef.current, ...githubQueryStateRef.current };
- }
- return { data: membersRef.current };
- },
- useInfiniteQuery: () => ({
- data: {
- pages: [
- {
- repositories: githubRepositoriesRef.current,
- total_count: githubRepositoriesRef.current.length,
- next_page: null,
- },
- ],
- },
- isPending: false,
- isError: false,
- hasNextPage: false,
- isFetchingNextPage: false,
- fetchNextPage: mockFetchNextPage,
- }),
- useQueryClient: () => ({ setQueryData: vi.fn() }),
- queryOptions: <T,>(options: T) => options,
- infiniteQueryOptions: <T,>(options: T) => options,
-}));
-
-vi.mock("@multica/core/hooks", () => ({
- useWorkspaceId: () => "workspace-1",
-}));
-
-vi.mock("@multica/core/paths", () => ({
- useCurrentWorkspace: () => workspaceRef.current,
-}));
-
-vi.mock("@multica/core/workspace/queries", () => ({
- memberListOptions: () => ({ queryKey: ["members"], queryFn: vi.fn() }),
- workspaceKeys: { list: () => ["workspaces"] },
-}));
-
-vi.mock("@multica/core/api", () => ({
- api: {
- updateWorkspace: mockUpdateWorkspace,
- getGitHubConnectURL: mockGetGitHubConnectURL,
- },
-}));
-
-vi.mock("@multica/core/auth", () => {
- const useAuthStore = Object.assign(
- (selector?: (state: { user: { id: string } }) => unknown) =>
- selector ? selector({ user: { id: "user-1" } }) : { user: { id: "user-1" } },
- { getState: () => ({ user: { id: "user-1" } }) },
- );
- return { useAuthStore };
-});
-
-vi.mock("sonner", () => ({
- toast: { success: mockToastSuccess, error: vi.fn() },
-}));
-
-vi.mock("../../navigation", () => ({
- useNavigation: () => ({
- push: vi.fn(),
- replace: mockNavReplace,
- back: vi.fn(),
- pathname: "/acme/settings",
- searchParams: searchParamsRef.current,
- hash: "",
- getShareableUrl: (path: string) => `https://app.example${path}`,
- }),
-}));
-
-import { RepositoriesTab, repositoryIdentity } from "./repositories-tab";
-
-const TEST_RESOURCES = {
- en: { common: enCommon, settings: enSettings },
-};
-
-function I18nWrapper({ children }: { children: ReactNode }) {
- return (
- <I18nProvider locale="en" resources={TEST_RESOURCES}>
- {children}
- </I18nProvider>
- );
-}
-
-describe("RepositoriesTab — automatic updates", () => {
- beforeEach(() => {
- vi.clearAllMocks();
- vi.useFakeTimers({ shouldAdvanceTime: true });
- workspaceRef.current = {
- id: "workspace-1",
- name: "Test Workspace",
- slug: "test-workspace",
- repos: [{ url: "https://github.com/multica-ai/multica" }],
- };
- membersRef.current = [{ user_id: "user-1", role: "owner" }];
- githubRef.current = {
- installations: [],
- configured: true,
- repository_browse_configured: true,
- can_manage: true,
- };
- githubQueryStateRef.current = {
- isPending: false,
- isFetching: false,
- };
- githubRepositoriesRef.current = [];
- searchParamsRef.current = new URLSearchParams("tab=repositories");
- mockNavReplace.mockImplementation((path: string) => {
- searchParamsRef.current = new URLSearchParams(path.split("?")[1] ?? "");
- });
- mockUpdateWorkspace.mockImplementation(
- async (_id: string, payload: { repos: { url: string; description?: string }[] }) => ({
- ...workspaceRef.current,
- repos: payload.repos,
- }),
- );
- });
-
- afterEach(() => {
- vi.useRealTimers();
- });
-
- function setupUser() {
- return userEvent.setup({ advanceTimers: vi.advanceTimersByTime });
- }
-
- it("renders persisted repositories as the same shared input controls used for editing", () => {
- render(<RepositoriesTab />, { wrapper: I18nWrapper });
-
- const inputs = screen.getAllByRole("textbox") as HTMLInputElement[];
- expect(inputs).toHaveLength(2);
- expect(inputs[0]!.value).toBe("https://github.com/multica-ai/multica");
- expect(screen.queryByRole("button", { name: /^Save$/ })).toBeNull();
- });
-
- it("updates a changed URL automatically on blur", async () => {
- const user = setupUser();
- render(<RepositoriesTab />, { wrapper: I18nWrapper });
-
- const urlInput = screen.getAllByRole("textbox")[0]!;
- await user.clear(urlInput);
- await user.type(urlInput, "https://github.com/multica-ai/edited");
- await user.tab();
-
- await waitFor(() => {
- expect(mockUpdateWorkspace).toHaveBeenCalledWith("workspace-1", {
- repos: [{ url: "https://github.com/multica-ai/edited" }],
- });
- expect(mockToastSuccess).toHaveBeenCalledWith("Repositories saved", {
- id: "settings-auto-save",
- });
- });
- });
-
- it("debounces updates while the user is still typing", async () => {
- const user = setupUser();
- render(<RepositoriesTab />, { wrapper: I18nWrapper });
-
- const urlInput = screen.getAllByRole("textbox")[0]!;
- await user.type(urlInput, "-next");
- expect(mockUpdateWorkspace).not.toHaveBeenCalled();
-
- vi.advanceTimersByTime(650);
- await waitFor(() => expect(mockUpdateWorkspace).toHaveBeenCalledTimes(1));
- });
-
- it("does not persist a new row until its URL is non-empty", async () => {
- const user = setupUser();
- render(<RepositoriesTab />, { wrapper: I18nWrapper });
-
- await user.click(screen.getByRole("button", { name: /Add repository/ }));
- expect(screen.getAllByRole("textbox")).toHaveLength(4);
- vi.advanceTimersByTime(1000);
- expect(mockUpdateWorkspace).not.toHaveBeenCalled();
-
- const newUrlInput = screen.getAllByRole("textbox")[2]!;
- await user.type(newUrlInput, "[email protected]:multica-ai/second.git");
- await user.tab();
-
- await waitFor(() => {
- expect(mockUpdateWorkspace).toHaveBeenCalledWith("workspace-1", {
- repos: [
- { url: "https://github.com/multica-ai/multica" },
- { url: "[email protected]:multica-ai/second.git" },
- ],
- });
- });
- });
-
- it("persists deletion immediately without a separate save action", async () => {
- const user = setupUser();
- render(<RepositoriesTab />, { wrapper: I18nWrapper });
-
- await user.click(screen.getByRole("button", { name: "Delete repository" }));
- expect(mockUpdateWorkspace).not.toHaveBeenCalled();
- await user.click(
- screen.getByRole("button", { name: "Delete repository" }),
- );
-
- await waitFor(() => {
- expect(mockUpdateWorkspace).toHaveBeenCalledWith("workspace-1", { repos: [] });
- });
- expect(screen.getByText("No repositories yet.")).toBeTruthy();
- });
-
- it("accepts scp-like repository shorthand", async () => {
- const user = setupUser();
- render(<RepositoriesTab />, { wrapper: I18nWrapper });
-
- const urlInput = screen.getAllByRole("textbox")[0] as HTMLInputElement;
- await user.clear(urlInput);
- await user.type(urlInput, "[email protected]:multica-ai/multica.git");
- expect(urlInput.type).toBe("text");
- expect(urlInput.validity.valid).toBe(true);
- await user.tab();
-
- await waitFor(() => {
- expect(mockUpdateWorkspace).toHaveBeenCalledWith("workspace-1", {
- repos: [{ url: "[email protected]:multica-ai/multica.git" }],
- });
- });
- });
-
- it("includes the description in the automatic update payload", async () => {
- workspaceRef.current = {
- ...workspaceRef.current,
- repos: [{ url: "https://github.com/multica-ai/multica", description: "Main app" }],
- };
- const user = setupUser();
- render(<RepositoriesTab />, { wrapper: I18nWrapper });
-
- const descriptionInput = screen.getAllByRole("textbox")[1] as HTMLInputElement;
- expect(descriptionInput.value).toBe("Main app");
- await user.clear(descriptionInput);
- await user.type(descriptionInput, "Updated description");
- await user.tab();
-
- await waitFor(() => {
- expect(mockUpdateWorkspace).toHaveBeenCalledWith("workspace-1", {
- repos: [
- {
- url: "https://github.com/multica-ai/multica",
- description: "Updated description",
- },
- ],
- });
- });
- });
-
- it("keeps repository controls read-only for members", () => {
- membersRef.current = [{ user_id: "user-1", role: "member" }];
- render(<RepositoriesTab />, { wrapper: I18nWrapper });
-
- expect(screen.getAllByRole("textbox").every((input) => input.hasAttribute("disabled"))).toBe(true);
- expect(screen.queryByRole("button", { name: /Add repository/ })).toBeNull();
- });
-
- it("starts GitHub connection with the signed repository return target", async () => {
- const user = setupUser();
- mockGetGitHubConnectURL.mockResolvedValue({
- configured: true,
- url: "https://github.com/apps/multica/installations/new",
- });
- const open = vi.spyOn(window, "open").mockImplementation(() => null);
- render(<RepositoriesTab />, { wrapper: I18nWrapper });
-
- await user.click(screen.getByRole("button", { name: "Connect GitHub" }));
-
- await waitFor(() => {
- expect(mockGetGitHubConnectURL).toHaveBeenCalledWith(
- "workspace-1",
- "repositories",
- );
- expect(open).toHaveBeenCalledWith(
- "https://github.com/apps/multica/installations/new",
- "_blank",
- "noopener",
- );
- });
- open.mockRestore();
- });
-
- it("keeps GitHub import disabled when repository browsing is unavailable", () => {
- githubRef.current = {
- installations: [],
- configured: true,
- repository_browse_configured: false,
- can_manage: true,
- };
- render(<RepositoriesTab />, { wrapper: I18nWrapper });
-
- const button = screen.getByRole("button", { name: "Connect GitHub" });
- expect(
- button.hasAttribute("disabled") ||
- button.getAttribute("aria-disabled") === "true",
- ).toBe(true);
- expect(button.getAttribute("title")).toContain("GITHUB_APP_ID");
- });
-
- it("imports selected GitHub repositories and deduplicates HTTPS against SSH", async () => {
- workspaceRef.current = {
- ...workspaceRef.current,
- repos: [{ url: "[email protected]:multica-ai/multica.git" }],
- };
- githubRef.current = {
- installations: [{ id: "installation-row-1", account_login: "multica-ai" }],
- configured: true,
- repository_browse_configured: true,
- can_manage: true,
- };
- githubRepositoriesRef.current = [
- {
- id: 1,
- full_name: "multica-ai/multica",
- html_url: "https://github.com/multica-ai/multica",
- clone_url: "https://github.com/multica-ai/multica.git",
- description: "Existing repository",
- private: false,
- archived: false,
- default_branch: "main",
- },
- {
- id: 2,
- full_name: "multica-ai/console",
- html_url: "https://github.com/multica-ai/console",
- clone_url: "https://github.com/multica-ai/console.git",
- description: "Console app",
- private: true,
- archived: false,
- default_branch: "main",
- },
- ];
- const user = setupUser();
- render(<RepositoriesTab />, { wrapper: I18nWrapper });
-
- await user.click(
- screen.getByRole("button", { name: "Choose from GitHub" }),
- );
- const checkboxes = screen.getAllByRole("checkbox");
- expect(checkboxes).toHaveLength(2);
- expect(
- checkboxes[0]!.hasAttribute("disabled") ||
- checkboxes[0]!.getAttribute("aria-disabled") === "true",
- ).toBe(true);
-
- await user.click(checkboxes[1]!);
- await user.click(screen.getByRole("button", { name: "Add repositories" }));
-
- await waitFor(() => {
- expect(mockUpdateWorkspace).toHaveBeenCalledWith("workspace-1", {
- repos: [
- { url: "[email protected]:multica-ai/multica.git" },
- {
- url: "https://github.com/multica-ai/console.git",
- description: "Console app",
- },
- ],
- });
- });
- });
-
- it("preserves repository path casing when comparing clone URLs", () => {
- expect(
- repositoryIdentity("https://GitHub.com/Acme/Repo.git"),
- ).toBe("github.com/Acme/Repo");
- expect(
- repositoryIdentity("[email protected]:acme/repo.git"),
- ).toBe("github.com/acme/repo");
- });
-
- it("opens the picker after returning from a GitHub connection", async () => {
- githubRef.current = {
- installations: [{ id: "installation-row-1", account_login: "multica-ai" }],
- configured: true,
- repository_browse_configured: true,
- can_manage: true,
- };
- searchParamsRef.current = new URLSearchParams(
- "tab=repositories&github_connected=1",
- );
-
- render(<RepositoriesTab />, { wrapper: I18nWrapper });
-
- expect(
- await screen.findByRole("heading", {
- name: "Choose GitHub repositories",
- }),
- ).toBeTruthy();
- expect(mockNavReplace).toHaveBeenCalledWith(
- "/acme/settings?tab=repositories",
- );
- });
-
- it("clears the GitHub callback query after an empty installation result", async () => {
- searchParamsRef.current = new URLSearchParams(
- "tab=repositories&github_connected=1",
- );
-
- render(<RepositoriesTab />, { wrapper: I18nWrapper });
-
- await waitFor(() => {
- expect(mockNavReplace).toHaveBeenCalledWith(
- "/acme/settings?tab=repositories",
- );
- });
- expect(
- screen.queryByRole("heading", {
- name: "Choose GitHub repositories",
- }),
- ).toBeNull();
- });
-});
diff --git a/packages/views/settings/components/settings-layout.tsx b/packages/views/settings/components/settings-layout.tsx
index ae4b7050cc..2f3f81c777 100644
--- a/packages/views/settings/components/settings-layout.tsx
+++ b/packages/views/settings/components/settings-layout.tsx
@@ -1,28 +1,133 @@
-import type { ReactNode } from "react";
-import { AlertCircle, Check, Loader2 } from "lucide-react";
+"use client";
+
+import { useId, type ReactNode } from "react";
+import {
+ AlertCircle,
+ Building2,
+ Check,
+ Eye,
+ Laptop,
+ Loader2,
+ UserRound,
+} from "lucide-react";
+import { useQuery } from "@tanstack/react-query";
import { Card, CardContent } from "@multica/ui/components/ui/card";
import { cn } from "@multica/ui/lib/utils";
+import { useCurrentWorkspace } from "@multica/core/paths";
+import { memberListOptions } from "@multica/core/workspace/queries";
+import { WorkspaceAvatar } from "../../workspace/workspace-avatar";
+import { useT } from "../../i18n";
export type SettingsSaveStatus = "idle" | "saving" | "saved" | "error";
+/**
+ * Where a setting takes effect. Settings mix three storage scopes — the
+ * account, the current workspace, and this device — and the page chrome says
+ * which one applies so nobody has to guess whether a change follows them.
+ */
+export type SettingsScope =
+ | "account"
+ | "device"
+ | "device-workspace"
+ | "workspace"
+ | "workspace-only";
+
+/** Anchor attribute search results and legacy `?section=` links scroll to. */
+export const SETTINGS_ANCHOR_ATTR = "data-settings-anchor";
+
+const SCOPE_BADGE_CLASS =
+ "inline-flex h-5 min-w-0 shrink-0 items-center gap-1 rounded-full bg-muted px-2 text-caption font-medium text-muted-foreground";
+
+export function SettingsScopeBadge({ scope }: { scope: SettingsScope }) {
+ const { t } = useT("settings");
+ // Only the workspace-bound scopes read the workspace, so account and device
+ // pages render without the workspace query.
+ if (scope === "workspace" || scope === "workspace-only" || scope === "device-workspace") {
+ return <WorkspaceScopeBadge scope={scope} />;
+ }
+ const Icon = scope === "account" ? UserRound : Laptop;
+ return (
+ <span data-slot="settings-scope" className={SCOPE_BADGE_CLASS}>
+ <Icon aria-hidden="true" className="size-3" />
+ <span className="truncate">
+ {scope === "account"
+ ? t(($) => $.layout.scope.account)
+ : t(($) => $.layout.scope.device)}
+ </span>
+ </span>
+ );
+}
+
+function WorkspaceScopeBadge({
+ scope,
+}: {
+ scope: "workspace" | "workspace-only" | "device-workspace";
+}) {
+ const { t } = useT("settings");
+ const workspace = useCurrentWorkspace();
+ const name = workspace?.name ?? t(($) => $.page.workspace_fallback);
+ // A letter avatar is illegible at chip size, so only a real logo is shown.
+ const mark =
+ scope === "device-workspace" ? (
+ <Laptop aria-hidden="true" className="size-3" />
+ ) : workspace?.avatar_url ? (
+ <WorkspaceAvatar
+ name={name}
+ avatarUrl={workspace.avatar_url}
+ className="size-3 rounded-xs border-0"
+ />
+ ) : (
+ <Building2 aria-hidden="true" className="size-3" />
+ );
+ const label =
+ scope === "workspace"
+ ? t(($) => $.layout.scope.workspace, { name })
+ : scope === "workspace-only"
+ ? t(($) => $.layout.scope.workspace_only, { name })
+ : t(($) => $.layout.scope.device_workspace, { name });
+ return (
+ <span data-slot="settings-scope" className={SCOPE_BADGE_CLASS}>
+ {mark}
+ <span className="truncate">{label}</span>
+ </span>
+ );
+}
+
export function SettingsTab({
title,
description,
+ scope,
+ actions,
+ breadcrumb,
children,
}: {
title: ReactNode;
description?: ReactNode;
+ scope?: SettingsScope;
+ /** Primary page-level action, aligned with the title. */
+ actions?: ReactNode;
+ /** Parent location for detail pages; rendered above the title. */
+ breadcrumb?: ReactNode;
children: ReactNode;
}) {
return (
<div className="space-y-8">
<header>
- <h2 className="text-title-lg font-semibold tracking-tight">{title}</h2>
- {description ? (
- <p className="mt-1 max-w-2xl text-body leading-6 text-muted-foreground">
- {description}
- </p>
- ) : null}
+ {breadcrumb ? <div className="mb-2">{breadcrumb}</div> : null}
+ <div className="flex min-w-0 items-start gap-4">
+ <div className="min-w-0 flex-1">
+ <div className="flex min-w-0 flex-wrap items-center gap-x-2.5 gap-y-1">
+ <h2 className="text-title-lg font-semibold tracking-tight">{title}</h2>
+ {scope ? <SettingsScopeBadge scope={scope} /> : null}
+ </div>
+ {description ? (
+ <p className="mt-1 max-w-2xl text-body leading-6 text-muted-foreground">
+ {description}
+ </p>
+ ) : null}
+ </div>
+ {actions ? <div className="shrink-0">{actions}</div> : null}
+ </div>
</header>
{children}
</div>
@@ -32,23 +137,38 @@ export function SettingsTab({
export function SettingsSection({
title,
description,
+ scope,
action,
+ anchor,
children,
className,
}: {
title?: ReactNode;
description?: ReactNode;
+ scope?: SettingsScope;
action?: ReactNode;
+ /** Target for search results and deep links (`?section=<anchor>`). */
+ anchor?: string;
children: ReactNode;
className?: string;
}) {
+ const headingId = useId();
return (
- <section className={cn("space-y-3", className)}>
+ <section
+ className={cn("scroll-mt-6 space-y-3", className)}
+ aria-labelledby={title ? headingId : undefined}
+ {...(anchor ? { [SETTINGS_ANCHOR_ATTR]: anchor } : {})}
+ >
{title || description || action ? (
<div className="flex min-w-0 items-end justify-between gap-4 px-0.5">
<div className="min-w-0">
{title ? (
- <h3 className="text-body font-semibold">{title}</h3>
+ <div className="flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1">
+ <h3 id={headingId} className="text-body font-semibold">
+ {title}
+ </h3>
+ {scope ? <SettingsScopeBadge scope={scope} /> : null}
+ </div>
) : null}
{description ? (
<p className="mt-1 text-caption leading-5 text-muted-foreground">
@@ -109,6 +229,7 @@ export function SettingsRow({
className,
size,
align = "center",
+ anchor,
}: {
label: ReactNode;
description?: ReactNode;
@@ -117,11 +238,14 @@ export function SettingsRow({
/** Control column width tier; omit for content-hugging controls (buttons, switches). */
size?: SettingsControlSize;
align?: "center" | "start";
+ /** Target for search results and deep links (`?section=<anchor>`). */
+ anchor?: string;
}) {
return (
<div
+ {...(anchor ? { [SETTINGS_ANCHOR_ATTR]: anchor } : {})}
className={cn(
- "flex min-h-16 gap-4 px-4 py-3.5 sm:justify-between sm:gap-8",
+ "flex min-h-16 scroll-mt-6 gap-4 px-4 py-3.5 transition-colors duration-700 data-[flash=true]:bg-surface-selected sm:justify-between sm:gap-8",
size ? "flex-col sm:flex-row" : "flex-row justify-between",
align === "center"
? size
@@ -154,6 +278,89 @@ export function SettingsRow({
);
}
+/** Segmented switch between the lists one settings page manages. */
+export function SettingsViewTabs<T extends string>({
+ label,
+ items,
+ value,
+ onChange,
+}: {
+ /** Accessible name of the tab list. */
+ label: string;
+ items: readonly { value: T; label: ReactNode; count?: number }[];
+ value: T;
+ onChange: (value: T) => void;
+}) {
+ return (
+ <div
+ role="tablist"
+ aria-label={label}
+ className="inline-flex w-fit items-center gap-0.5 rounded-lg bg-muted p-0.5"
+ >
+ {items.map((item) => (
+ <button
+ key={item.value}
+ type="button"
+ role="tab"
+ aria-selected={value === item.value}
+ onClick={() => onChange(item.value)}
+ className={cn(
+ "inline-flex h-7 items-center gap-1.5 rounded-md px-2.5 text-label font-medium transition-colors focus-visible:outline-2 focus-visible:outline-ring",
+ value === item.value
+ ? "bg-background text-foreground shadow-sm"
+ : "text-muted-foreground hover:text-foreground",
+ )}
+ >
+ {item.label}
+ {item.count !== undefined ? (
+ <>
+ {" "}
+ <span className="text-caption font-normal tabular-nums text-muted-foreground">
+ {item.count}
+ </span>
+ </>
+ ) : null}
+ </button>
+ ))}
+ </div>
+ );
+}
+
+/**
+ * The one read-only explanation for workspace pages a member can see but not
+ * change. It names who can make the change so the next step is obvious.
+ */
+export function SettingsReadOnlyNotice({ wsId }: { wsId: string }) {
+ const { t } = useT("settings");
+ const { data: members = [] } = useQuery({
+ ...memberListOptions(wsId),
+ enabled: !!wsId,
+ });
+ const managers = members
+ .filter((member) => member.role === "owner" || member.role === "admin")
+ .map((member) => member.name)
+ .filter(Boolean)
+ .slice(0, 3);
+ return (
+ <div
+ role="note"
+ className="flex items-start gap-3 rounded-xl border border-surface-border bg-surface px-4 py-3 text-body"
+ >
+ <Eye aria-hidden="true" className="mt-0.5 size-4 shrink-0 text-muted-foreground" />
+ <div className="min-w-0">
+ <p className="font-medium">{t(($) => $.layout.read_only.title)}</p>
+ <p className="mt-0.5 text-caption leading-5 text-muted-foreground">
+ {managers.length > 0
+ ? t(($) => $.layout.read_only.contact, {
+ names: managers.join(t(($) => $.layout.read_only.separator)),
+ })
+ : t(($) => $.layout.read_only.description)}
+ </p>
+ </div>
+ </div>
+ );
+}
+
export function SettingsSaveState({
status,
savingLabel,
diff --git a/packages/views/settings/components/settings-navigation.test.ts b/packages/views/settings/components/settings-navigation.test.ts
index b6117862a1..a26e1f2e81 100644
--- a/packages/views/settings/components/settings-navigation.test.ts
+++ b/packages/views/settings/components/settings-navigation.test.ts
@@ -2,17 +2,64 @@
import { describe, expect, it } from "vitest";
import { resolveSettingsLocation, settingsHref } from "./settings-navigation";
+const resolve = (search: string) =>
+ resolveSettingsLocation(new URLSearchParams(search));
+
describe("settings location", () => {
it.each([
- ["issue", "preferences", "issue", null],
- ["chat", "preferences", "chat", null],
- ["github", "integrations", null, "github"],
- ["lark", "integrations", null, "lark"],
- ["labs", "workspace", null, null],
- ])("resolves the retired %s entry", (old, tab, section, integration) => {
- expect(resolveSettingsLocation(new URLSearchParams({ tab: old! }))).toEqual(
- { tab, section, integration },
- );
+ ["tab=issue", { tab: "preferences", section: "issue", integration: null }],
+ ["tab=chat", { tab: "preferences", section: "chat", integration: null }],
+ ["tab=labs", { tab: "workspace", section: null, integration: null }],
+ ["tab=lark", { tab: "channels", section: null, integration: "lark" }],
+ [
+ "tab=integrations&integration=slack",
+ { tab: "channels", section: null, integration: "slack" },
+ ],
+ ["tab=integrations", { tab: "channels", section: null, integration: null }],
+ [
+ "tab=integrations&integration=vcs",
+ { tab: "code", section: "code-hosting", integration: null },
+ ],
+ [
+ "tab=integrations&integration=github",
+ { tab: "code", section: null, integration: null },
+ ],
+ [
+ "tab=integrations&integration=composio",
+ { tab: "apps", section: null, integration: null },
+ ],
+ ])("resolves the retired %s entry", (search, expected) => {
+ expect(resolve(search)).toEqual(expected);
+ });
+
+ it("keeps server redirects from the GitHub App install working", () => {
+ // github.go returns to one of these two tabs after the App is installed.
+ expect(resolve("tab=github")).toEqual({
+ tab: "code",
+ section: null,
+ integration: null,
+ });
+ expect(resolve("tab=repositories&github_connected=1")).toEqual({
+ tab: "code",
+ section: "repositories",
+ integration: null,
+ });
+ });
+
+ it.each(["connected=notion", "error=composio_connect_failed"])(
+ "sends the Composio OAuth callback (%s) to Connected apps",
+ (callback) => {
+ expect(resolve(`tab=integrations&${callback}`).tab).toBe("apps");
+ },
+ );
+
+ it("passes current pages and anchors through untouched", () => {
+ expect(resolve("tab=code&section=pr-sidebar")).toEqual({
+ tab: "code",
+ section: "pr-sidebar",
+ integration: null,
+ });
+ expect(resolve("").tab).toBe("profile");
});
it("preserves unrelated query state while replacing page-specific state", () => {
@@ -20,9 +67,9 @@ describe("settings location", () => {
settingsHref(
"/acme/settings",
new URLSearchParams("tab=preferences&section=chat&keep=1"),
- "integrations",
+ "channels",
{ integration: "slack" },
),
- ).toBe("/acme/settings?tab=integrations&keep=1&integration=slack");
+ ).toBe("/acme/settings?tab=channels&keep=1&integration=slack");
});
});
diff --git a/packages/views/settings/components/settings-navigation.ts b/packages/views/settings/components/settings-navigation.ts
index 4c003326b8..27dbadef89 100644
--- a/packages/views/settings/components/settings-navigation.ts
+++ b/packages/views/settings/components/settings-navigation.ts
@@ -1,17 +1,76 @@
-/** Resolve bookmarks for settings pages that now live inside another page. */
-export function resolveSettingsLocation(params: URLSearchParams) {
+/** Messaging integrations that live under the Channels page. */
+export const CHANNEL_INTEGRATIONS = [
+ "lark",
+ "slack",
+ "dingtalk",
+ "wecom",
+ "telegram",
+] as const;
+
+export type ChannelIntegration = (typeof CHANNEL_INTEGRATIONS)[number];
+
+export function isChannelIntegration(
+ value: string | null,
+): value is ChannelIntegration {
+ return (CHANNEL_INTEGRATIONS as readonly string[]).includes(value ?? "");
+}
+
+export interface SettingsLocation {
+ tab: string;
+ /** In-page anchor to scroll to (see `SettingsSection`/`SettingsRow`). */
+ section: string | null;
+ /** Detail page within Channels. */
+ integration: string | null;
+}
+
+/**
+ * Resolve a settings URL, including links that predate the current layout.
+ * Server redirects still point at some of them — the GitHub App install flow
+ * returns to `?tab=github` / `?tab=repositories` and the Composio OAuth flow to
+ * `?tab=integrations&connected=…` — so these mappings are part of the URL
+ * contract, not bookmarks we can drop.
+ */
+export function resolveSettingsLocation(
+ params: URLSearchParams,
+): SettingsLocation {
const tab = params.get("tab") ?? "profile";
- if (tab === "issue" || tab === "chat") {
- return { tab: "preferences", section: tab, integration: null };
- }
- if (tab === "github" || tab === "lark") {
- return { tab: "integrations", section: null, integration: tab };
+ const section = params.get("section");
+ const integration = params.get("integration");
+ switch (tab) {
+ case "issue":
+ case "chat":
+ return { tab: "preferences", section: tab, integration: null };
+ case "labs":
+ return { tab: "workspace", section: null, integration: null };
+ case "github":
+ return { tab: "code", section, integration: null };
+ case "repositories":
+ return { tab: "code", section: section ?? "repositories", integration: null };
+ case "integrations": {
+ const composioCallback =
+ params.has("connected") ||
+ params.get("error") === "composio_connect_failed";
+ if (composioCallback || integration === "composio") {
+ return { tab: "apps", section: null, integration: null };
+ }
+ if (integration === "github") {
+ return { tab: "code", section: null, integration: null };
+ }
+ if (integration === "vcs") {
+ return { tab: "code", section: "code-hosting", integration: null };
+ }
+ return {
+ tab: "channels",
+ section: null,
+ integration: isChannelIntegration(integration) ? integration : null,
+ };
+ }
+ default:
+ if (isChannelIntegration(tab)) {
+ return { tab: "channels", section: null, integration: tab };
+ }
+ return { tab, section, integration };
}
- return {
- tab: tab === "labs" ? "workspace" : tab,
- section: params.get("section"),
- integration: params.get("integration"),
- };
}
/** Clear page-specific state while preserving unrelated callback parameters. */
diff --git a/packages/views/settings/components/settings-page.test.tsx b/packages/views/settings/components/settings-page.test.tsx
index 4c2d1639ba..4dcb348c4a 100644
--- a/packages/views/settings/components/settings-page.test.tsx
+++ b/packages/views/settings/components/settings-page.test.tsx
@@ -16,25 +16,48 @@ const stub = vi.hoisted(() => (name: string) => () => ({
}));
vi.mock("./account-tab", stub("AccountTab"));
vi.mock("./preferences-tab", stub("PreferencesTab"));
-vi.mock("./chat-tab", stub("ChatTab"));
-vi.mock("./issue-tab", stub("IssueTab"));
vi.mock("./tokens-tab", stub("TokensTab"));
vi.mock("./workspace-tab", stub("WorkspaceTab"));
vi.mock("./members-tab", stub("MembersTab"));
-vi.mock("./repositories-tab", stub("RepositoriesTab"));
-vi.mock("./github-tab", stub("GitHubTab"));
-vi.mock("./integrations-tab", stub("IntegrationsTab"));
+vi.mock("./code-tab", stub("CodeTab"));
+vi.mock("./channels-tab", stub("ChannelsTab"));
vi.mock("./notifications-tab", stub("NotificationsTab"));
vi.mock("./labels-tab", stub("LabelsTab"));
+vi.mock("./issue-statuses-tab", stub("IssueStatusesTab"));
vi.mock("./properties-tab", stub("PropertiesTab"));
vi.mock("./quick-actions-tab", stub("QuickActionsTab"));
vi.mock("./keyboard-shortcuts-tab", stub("KeyboardShortcutsTab"));
vi.mock("./plugins-tab", stub("PluginsTab"));
+vi.mock("./mcp-tab", stub("McpTab"));
vi.mock("./billing-tab", stub("BillingTab"));
+const shell = vi.hoisted(() => ({
+ appsAvailable: false,
+ role: "owner" as "owner" | "admin" | "member",
+}));
+vi.mock("./connected-apps-tab", () => ({
+ ConnectedAppsTab: () => <div>ConnectedAppsTab</div>,
+ useComposioAvailable: () => shell.appsAvailable,
+}));
+
vi.mock("@multica/core/paths", () => ({
- useCurrentWorkspace: () => ({ name: "Acme" }),
+ useCurrentWorkspace: () => ({ id: "ws-1", name: "Acme" }),
+}));
+vi.mock("@multica/core/workspace/avatar-url", () => ({
+ resolvePublicFileUrl: (url: string | null | undefined) => url ?? null,
}));
+vi.mock("@multica/core/permissions", () => ({
+ useCurrentMember: () => ({ role: shell.role, isLoading: false }),
+}));
+vi.mock("@multica/core/auth", () => {
+ const state = { user: { id: "user-1", name: "Ada Lovelace", avatar_url: null } };
+ const useAuthStore = Object.assign(
+ (selector?: (s: typeof state) => unknown) =>
+ selector ? selector(state) : state,
+ { getState: () => state },
+ );
+ return { useAuthStore };
+});
const replace = vi.fn();
const push = vi.fn();
@@ -69,11 +92,18 @@ function trigger() {
return screen.getByRole("button", { name: "Toggle left sidebar" });
}
+function nav() {
+ return screen.getByRole("navigation", { name: "Settings" });
+}
+
beforeEach(() => {
layout.compact = true;
navigationState.search = "";
+ shell.appsAvailable = false;
+ shell.role = "owner";
configStore.getState().setFeatureFlags({});
replace.mockClear();
+ push.mockClear();
});
describe("SettingsPage nav trigger", () => {
@@ -115,7 +145,7 @@ describe("SettingsPage nav trigger", () => {
expect(
screen.queryByRole("button", { name: "Toggle left sidebar" }),
).not.toBeInTheDocument();
- expect(screen.getByText("Settings")).toBeInTheDocument();
+ expect(screen.getByRole("heading", { name: "Settings" })).toBeInTheDocument();
});
});
@@ -170,17 +200,32 @@ describe("SettingsPage workspace subscription feature flag", () => {
});
describe("SettingsPage information architecture", () => {
- it("groups workspace configuration and keeps retired pages out of navigation", () => {
+ it("groups pages by who they affect, then by topic", () => {
renderWithI18n(<SettingsPage />);
- const nav = screen.getByRole("navigation", { name: "Settings" });
- const issues = within(nav).getByRole("region", {
- name: "Issue configuration",
- });
+ const personal = within(nav()).getByRole("region", { name: /Personal/ });
+ expect(within(personal).getByRole("link", { name: "Preferences" })).toBeInTheDocument();
+ expect(within(personal).getByRole("link", { name: "API Tokens" })).toBeInTheDocument();
+
+ // The workspace group is named after the workspace it configures.
+ const workspace = within(nav()).getByRole("region", { name: /Acme/ });
+ const issues = within(workspace).getByRole("group", { name: "Issues & workflow" });
expect(
within(issues).getByRole("link", { name: "Issue Statuses" }),
).toBeInTheDocument();
+ const connections = within(workspace).getByRole("group", {
+ name: "Connections & extensions",
+ });
+ for (const name of ["Code", "Messaging", "MCP servers"]) {
+ expect(within(connections).getByRole("link", { name })).toBeInTheDocument();
+ }
+ });
+
+ it("keeps retired pages out of navigation", () => {
+ renderWithI18n(<SettingsPage />);
expect(
- within(nav).queryByRole("link", { name: /^(Issue|Chat|GitHub|Labs)$/ }),
+ within(nav()).queryByRole("link", {
+ name: /^(Issue|Chat|GitHub|Labs|Integrations|Repositories)$/,
+ }),
).not.toBeInTheDocument();
});
@@ -194,6 +239,43 @@ describe("SettingsPage information architecture", () => {
);
});
+ it("opens the GitHub App return URL on the Code page", () => {
+ navigationState.search = "tab=repositories&github_connected=1";
+ renderWithI18n(<SettingsPage />);
+ expect(screen.getByText("CodeTab")).toBeInTheDocument();
+ expect(screen.getByRole("link", { name: "Code" })).toHaveAttribute(
+ "aria-current",
+ "page",
+ );
+ });
+
+ it("lists Connected apps with the personal pages only when Composio is available", () => {
+ const first = renderWithI18n(<SettingsPage />);
+ expect(screen.queryByRole("link", { name: "Connected apps" })).toBeNull();
+ first.unmount();
+
+ shell.appsAvailable = true;
+ navigationState.search = "tab=integrations&connected=notion";
+ renderWithI18n(<SettingsPage />);
+ const personal = within(nav()).getByRole("region", { name: /Personal/ });
+ expect(
+ within(personal).getByRole("link", { name: "Connected apps" }),
+ ).toHaveAttribute("aria-current", "page");
+ expect(screen.getByText("ConnectedAppsTab")).toBeInTheDocument();
+ });
+
+ it("marks pages a member can only view", () => {
+ shell.role = "member";
+ renderWithI18n(<SettingsPage />);
+ const general = screen.getByRole("link", { name: /^General/ });
+ expect(
+ within(general).getByLabelText("Only owners and admins can change this"),
+ ).toBeInTheDocument();
+ // Labels stay editable for every member, so they carry no lock.
+ const labels = screen.getByRole("link", { name: "Labels" });
+ expect(within(labels).queryByLabelText(/Only owners/)).toBeNull();
+ });
+
it("places platform settings in a device group", () => {
renderWithI18n(
<SettingsPage
@@ -207,14 +289,14 @@ describe("SettingsPage information architecture", () => {
]}
/>,
);
- const device = screen.getByRole("region", { name: "Desktop app" });
+ const device = screen.getByRole("region", { name: "This device" });
expect(
within(device).getByRole("link", { name: "Updates" }),
).toBeInTheDocument();
});
it("navigates from the compact selector and clears the old detail", () => {
- navigationState.search = "tab=integrations&integration=github&keep=1";
+ navigationState.search = "tab=channels&integration=slack&keep=1";
renderWithI18n(<SettingsPage />);
fireEvent.change(
screen.getByRole("combobox", { name: "Go to settings page" }),
@@ -223,3 +305,45 @@ describe("SettingsPage information architecture", () => {
expect(push).toHaveBeenCalledWith("/acme/settings?tab=preferences&keep=1");
});
});
+
+describe("SettingsPage search", () => {
+ it("finds settings inside pages and opens the one chosen", () => {
+ renderWithI18n(<SettingsPage />);
+ const input = screen.getByRole("searchbox", { name: "Search settings" });
+
+ fireEvent.change(input, { target: { value: "time zone" } });
+
+ const results = screen.getByRole("listbox", { name: "Search settings" });
+ const option = within(results).getByRole("option", { name: /Time zone/ });
+ expect(option).toHaveTextContent("Personal › Preferences");
+
+ fireEvent.click(option);
+ expect(push).toHaveBeenCalledWith(
+ "/acme/settings?tab=preferences&section=timezone",
+ );
+ });
+
+ it("opens the highlighted result from the keyboard and clears on Escape", () => {
+ renderWithI18n(<SettingsPage />);
+ const input = screen.getByRole("searchbox", { name: "Search settings" });
+
+ fireEvent.change(input, { target: { value: "slack" } });
+ fireEvent.keyDown(input, { key: "Enter" });
+ expect(push).toHaveBeenCalledWith(
+ "/acme/settings?tab=channels&integration=slack",
+ );
+
+ fireEvent.keyDown(input, { key: "Escape" });
+ expect(input).toHaveValue("");
+ expect(screen.queryByRole("listbox")).toBeNull();
+ });
+
+ it("does not offer pages hidden by feature flags", () => {
+ renderWithI18n(<SettingsPage />);
+ fireEvent.change(
+ screen.getByRole("searchbox", { name: "Search settings" }),
+ { target: { value: "plugins" } },
+ );
+ expect(screen.getByText("No matching settings")).toBeInTheDocument();
+ });
+});
diff --git a/packages/views/settings/components/settings-page.tsx b/packages/views/settings/components/settings-page.tsx
index 70e5a86c3c..28e61c3249 100644
--- a/packages/views/settings/components/settings-page.tsx
+++ b/packages/views/settings/components/settings-page.tsx
@@ -1,40 +1,51 @@
"use client";
-import React from "react";
+import React, { useEffect, useMemo, useRef, useState } from "react";
import {
- ChevronRight,
- User,
- SlidersHorizontal,
- Key,
- Settings,
- Users,
- FolderGit2,
Bell,
- Plug,
- Tags,
- CircleDot,
- Keyboard,
- Zap,
Blocks,
+ CircleDot,
CreditCard,
+ FolderGit2,
+ Keyboard,
+ KeyRound,
+ Laptop,
+ ListPlus,
+ Lock,
+ MessagesSquare,
+ Plug,
+ Search,
Server,
+ Settings,
+ SlidersHorizontal,
+ Tags,
+ User,
+ Users,
+ X,
+ Zap,
} from "lucide-react";
+import { useAuthStore } from "@multica/core/auth";
import { useCurrentWorkspace } from "@multica/core/paths";
import { useFeatureEnabled } from "@multica/core/config";
+import { useCurrentMember } from "@multica/core/permissions";
import {
BILLING_WORKSPACE_SUBSCRIPTIONS_FLAG,
PLUGINS_V1_FLAG,
} from "@multica/core/feature-flags";
+import { resolvePublicFileUrl } from "@multica/core/workspace/avatar-url";
+import { ActorAvatar } from "@multica/ui/components/common/actor-avatar";
import { cn } from "@multica/ui/lib/utils";
import { resolveSettingsLocation, settingsHref } from "./settings-navigation";
import { AppLink, useNavigation } from "../../navigation";
+import { WorkspaceAvatar } from "../../workspace/workspace-avatar";
import { AccountTab } from "./account-tab";
import { PreferencesTab } from "./preferences-tab";
import { TokensTab } from "./tokens-tab";
import { WorkspaceTab } from "./workspace-tab";
import { MembersTab } from "./members-tab";
-import { RepositoriesTab } from "./repositories-tab";
-import { IntegrationsTab } from "./integrations-tab";
+import { CodeTab } from "./code-tab";
+import { ChannelsTab } from "./channels-tab";
+import { ConnectedAppsTab, useComposioAvailable } from "./connected-apps-tab";
import { NotificationsTab } from "./notifications-tab";
import { LabelsTab } from "./labels-tab";
import { IssueStatusesTab } from "./issue-statuses-tab";
@@ -44,6 +55,10 @@ import { KeyboardShortcutsTab } from "./keyboard-shortcuts-tab";
import { PluginsTab } from "./plugins-tab";
import { McpTab } from "./mcp-tab";
import { BillingTab } from "./billing-tab";
+import { SETTINGS_ANCHOR_ATTR } from "./settings-layout";
+import { searchSettings } from "./settings-search";
+import { HighlightText } from "../../search/highlight-text";
+import { useSettingsSearchIndex } from "./use-settings-search-index";
import { CollapsedNavTrigger } from "../../layout/page-header";
import { useT } from "../../i18n";
@@ -59,184 +74,351 @@ interface SettingsPageProps {
extraDeviceTabs?: ExtraSettingsTab[];
}
-type SettingsEntry = ExtraSettingsTab & { wide?: boolean };
+type SettingsEntry = ExtraSettingsTab & {
+ wide?: boolean;
+ /** Owners and admins manage it; members see a read-only page. */
+ adminOnly?: boolean;
+};
+
+interface SettingsSubgroup {
+ key: string;
+ label?: string;
+ entries: SettingsEntry[];
+}
+
+interface SettingsScopeGroup {
+ key: "personal" | "workspace" | "device";
+ label: string;
+ /** Leading mark: whose settings these are. */
+ mark: React.ReactNode;
+ /** Trailing detail (the user's name, "Workspace"). */
+ tag?: string;
+ subgroups: SettingsSubgroup[];
+}
+
+const FLASH_MS = 1600;
+const ANCHOR_WAIT_MS = 1500;
export function SettingsPage({ extraDeviceTabs = [] }: SettingsPageProps = {}) {
const { t } = useT("settings");
- const workspaceName =
- useCurrentWorkspace()?.name ?? t(($) => $.page.workspace_fallback);
+ const workspace = useCurrentWorkspace();
+ const workspaceName = workspace?.name ?? t(($) => $.page.workspace_fallback);
+ const user = useAuthStore((s) => s.user);
+ const { role } = useCurrentMember(workspace?.id ?? "");
+ const isMember = role === "member";
const navigation = useNavigation();
const pluginsEnabled = useFeatureEnabled(PLUGINS_V1_FLAG, false);
const billingEnabled = useFeatureEnabled(
BILLING_WORKSPACE_SUBSCRIPTIONS_FLAG,
false,
);
+ const appsAvailable = useComposioAvailable();
const entry = (
value: string,
label: string,
icon: ExtraSettingsTab["icon"],
content: React.ReactNode,
- wide = false,
- ): SettingsEntry => ({ value, label, icon, content, wide });
- const groups = [
+ options: { wide?: boolean; adminOnly?: boolean } = {},
+ ): SettingsEntry => ({ value, label, icon, content, ...options });
+
+ const groups: SettingsScopeGroup[] = [
{
key: "personal",
label: t(($) => $.page.groups.personal),
- scope: t(($) => $.page.groups.personal),
- entries: [
- entry(
- "profile",
- t(($) => $.page.tabs.profile),
- User,
- <AccountTab />,
- ),
- entry(
- "preferences",
- t(($) => $.page.tabs.preferences),
- SlidersHorizontal,
- <PreferencesTab />,
- ),
- entry(
- "notifications",
- t(($) => $.page.tabs.notifications),
- Bell,
- <NotificationsTab />,
- ),
- entry(
- "shortcuts",
- t(($) => $.page.tabs.shortcuts),
- Keyboard,
- <KeyboardShortcutsTab />,
- ),
- entry(
- "tokens",
- t(($) => $.page.tabs.tokens),
- Key,
- <TokensTab />,
- ),
+ mark: (
+ <ActorAvatar
+ name={user?.name ?? ""}
+ initials={(user?.name ?? "U").charAt(0).toUpperCase()}
+ avatarUrl={resolvePublicFileUrl(user?.avatar_url)}
+ size="xs"
+ />
+ ),
+ tag: user?.name,
+ subgroups: [
+ {
+ key: "personal",
+ entries: [
+ entry("profile", t(($) => $.page.tabs.profile), User, <AccountTab />),
+ entry(
+ "preferences",
+ t(($) => $.page.tabs.preferences),
+ SlidersHorizontal,
+ <PreferencesTab />,
+ ),
+ entry(
+ "notifications",
+ t(($) => $.page.tabs.notifications),
+ Bell,
+ <NotificationsTab />,
+ ),
+ entry(
+ "shortcuts",
+ t(($) => $.page.tabs.shortcuts),
+ Keyboard,
+ <KeyboardShortcutsTab />,
+ ),
+ ...(appsAvailable
+ ? [entry("apps", t(($) => $.page.tabs.apps), Plug, <ConnectedAppsTab />)]
+ : []),
+ entry("tokens", t(($) => $.page.tabs.tokens), KeyRound, <TokensTab />),
+ ],
+ },
],
},
{
key: "workspace",
- label: t(($) => $.page.groups.workspace),
- scope: workspaceName,
- entries: [
- entry(
- "workspace",
- t(($) => $.page.tabs.general),
- Settings,
- <WorkspaceTab />,
- ),
- entry(
- "members",
- t(($) => $.page.tabs.members),
- Users,
- <MembersTab />,
- ),
- ...(billingEnabled
- ? [
- entry(
- "billing",
- t(($) => $.page.tabs.billing),
- CreditCard,
- <BillingTab />,
- ),
- ]
- : []),
- ],
- },
- {
- key: "issues",
- label: t(($) => $.page.groups.issues),
- scope: workspaceName,
- entries: [
- entry(
- "issue-statuses",
- t(($) => $.page.tabs.issue_statuses),
- CircleDot,
- <IssueStatusesTab />,
- true,
- ),
- entry(
- "labels",
- t(($) => $.page.tabs.labels),
- Tags,
- <LabelsTab />,
- true,
- ),
- entry(
- "properties",
- t(($) => $.page.tabs.properties),
- SlidersHorizontal,
- <PropertiesTab />,
- true,
- ),
- entry(
- "quick-actions",
- t(($) => $.page.tabs.quick_actions),
- Zap,
- <QuickActionsTab />,
- true,
- ),
- ],
- },
- {
- key: "connections",
- label: t(($) => $.page.groups.connections),
- scope: workspaceName,
- entries: [
- entry(
- "repositories",
- t(($) => $.page.tabs.repositories),
- FolderGit2,
- <RepositoriesTab />,
- ),
- entry(
- "integrations",
- t(($) => $.page.tabs.integrations),
- Plug,
- <IntegrationsTab />,
- ),
- entry(
- "mcp",
- t(($) => $.page.tabs.mcp),
- Server,
- <McpTab />,
- ),
- ...(pluginsEnabled
- ? [
- entry(
- "plugins",
- t(($) => $.page.tabs.plugins),
- Blocks,
- <PluginsTab />,
- ),
- ]
- : []),
+ label: workspaceName,
+ mark: (
+ <WorkspaceAvatar
+ name={workspaceName}
+ avatarUrl={workspace?.avatar_url}
+ size="sm"
+ className="size-4 rounded-xs"
+ />
+ ),
+ tag: t(($) => $.page.groups.workspace),
+ subgroups: [
+ {
+ key: "workspace",
+ entries: [
+ entry("workspace", t(($) => $.page.tabs.general), Settings, <WorkspaceTab />, {
+ adminOnly: true,
+ }),
+ entry("members", t(($) => $.page.tabs.members), Users, <MembersTab />, {
+ adminOnly: true,
+ }),
+ ...(billingEnabled
+ ? [
+ entry(
+ "billing",
+ t(($) => $.page.tabs.billing),
+ CreditCard,
+ <BillingTab />,
+ ),
+ ]
+ : []),
+ ],
+ },
+ {
+ key: "issues",
+ label: t(($) => $.page.groups.issues),
+ entries: [
+ entry(
+ "issue-statuses",
+ t(($) => $.page.tabs.issue_statuses),
+ CircleDot,
+ <IssueStatusesTab />,
+ { wide: true, adminOnly: true },
+ ),
+ entry("labels", t(($) => $.page.tabs.labels), Tags, <LabelsTab />, {
+ wide: true,
+ }),
+ entry(
+ "properties",
+ t(($) => $.page.tabs.properties),
+ ListPlus,
+ <PropertiesTab />,
+ { wide: true, adminOnly: true },
+ ),
+ entry(
+ "quick-actions",
+ t(($) => $.page.tabs.quick_actions),
+ Zap,
+ <QuickActionsTab />,
+ { wide: true },
+ ),
+ ],
+ },
+ {
+ key: "connections",
+ label: t(($) => $.page.groups.connections),
+ entries: [
+ entry("code", t(($) => $.page.tabs.code), FolderGit2, <CodeTab />, {
+ adminOnly: true,
+ }),
+ entry(
+ "channels",
+ t(($) => $.page.tabs.channels),
+ MessagesSquare,
+ <ChannelsTab />,
+ ),
+ entry("mcp", t(($) => $.page.tabs.mcp), Server, <McpTab />, {
+ adminOnly: true,
+ }),
+ ...(pluginsEnabled
+ ? [
+ entry("plugins", t(($) => $.page.tabs.plugins), Blocks, <PluginsTab />, {
+ adminOnly: true,
+ }),
+ ]
+ : []),
+ ],
+ },
],
},
...(extraDeviceTabs.length
? [
{
- key: "device",
+ key: "device" as const,
label: t(($) => $.page.groups.device),
- scope: t(($) => $.page.device_scope),
- entries: extraDeviceTabs as SettingsEntry[],
+ mark: <Laptop aria-hidden="true" className="size-4 text-muted-foreground" />,
+ subgroups: [{ key: "device", entries: extraDeviceTabs as SettingsEntry[] }],
},
]
: []),
];
+ const allEntries = groups.flatMap((group) =>
+ group.subgroups.flatMap((subgroup) => subgroup.entries),
+ );
const location = resolveSettingsLocation(navigation.searchParams);
const candidate =
location.tab === "billing" && !billingEnabled ? "workspace" : location.tab;
const active =
- groups
- .flatMap((group) => group.entries)
- .find((item) => item.value === candidate) ?? groups[0]!.entries[0]!;
- const activeGroup = groups.find((group) => group.entries.includes(active))!;
+ allEntries.find((item) => item.value === candidate) ?? allEntries[0]!;
const href = (value: string) =>
settingsHref(navigation.pathname, navigation.searchParams, value);
+ const scopeOf = (value: string) =>
+ groups.find((group) =>
+ group.subgroups.some((subgroup) =>
+ subgroup.entries.some((item) => item.value === value),
+ ),
+ );
+
+ // --- search ---------------------------------------------------------------
+ const [query, setQuery] = useState("");
+ const [activeResult, setActiveResult] = useState(0);
+ const searchPages = useMemo(
+ () => allEntries.map((item) => ({ value: item.value, label: item.label })),
+ // Labels are derived from i18n and flags; the value list is the identity.
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ [allEntries.map((item) => `${item.value}:${item.label}`).join("|")],
+ );
+ const index = useSettingsSearchIndex(searchPages);
+ const results = useMemo(() => searchSettings(index, query), [index, query]);
+ const openResult = (position: number) => {
+ const result = results[position];
+ if (!result) return;
+ setActiveResult(position);
+ navigation.push(
+ settingsHref(navigation.pathname, navigation.searchParams, result.tab, {
+ section: result.anchor,
+ integration: result.integration,
+ }),
+ );
+ };
+
+ // --- anchors --------------------------------------------------------------
+ // Search results and legacy `?section=` links name an anchor inside the
+ // page. Tab content can still be loading on the first frame, so wait briefly
+ // for the anchor before scrolling it into view and flashing it.
+ const contentRef = useRef<HTMLDivElement>(null);
+ useEffect(() => {
+ const anchor = location.section;
+ if (!anchor) return;
+ let cancelled = false;
+ let flashTimer: ReturnType<typeof setTimeout> | undefined;
+ const startedAt = Date.now();
+ const find = () => {
+ if (cancelled) return;
+ const target = contentRef.current?.querySelector<HTMLElement>(
+ `[${SETTINGS_ANCHOR_ATTR}="${CSS.escape(anchor)}"]`,
+ );
+ if (!target) {
+ if (Date.now() - startedAt < ANCHOR_WAIT_MS) {
+ requestAnimationFrame(find);
+ }
+ return;
+ }
+ const reduceMotion =
+ typeof window.matchMedia === "function" &&
+ window.matchMedia("(prefers-reduced-motion: reduce)").matches;
+ target.scrollIntoView?.({
+ block: "center",
+ behavior: reduceMotion ? "auto" : "smooth",
+ });
+ target.setAttribute("data-flash", "true");
+ flashTimer = setTimeout(() => target.removeAttribute("data-flash"), FLASH_MS);
+ };
+ requestAnimationFrame(find);
+ return () => {
+ cancelled = true;
+ if (flashTimer) clearTimeout(flashTimer);
+ };
+ }, [active.value, location.section]);
+
+ const navItem = (item: SettingsEntry) => (
+ <li key={item.value}>
+ <AppLink
+ href={href(item.value)}
+ aria-current={active.value === item.value ? "page" : undefined}
+ className={cn(
+ "flex min-h-8 items-center gap-2.5 rounded-lg px-3 py-1.5 text-body transition-colors focus-visible:outline-2 focus-visible:outline-ring",
+ active.value === item.value
+ ? "bg-surface-selected font-medium text-surface-selected-foreground hover:bg-surface-selected"
+ : "text-muted-foreground hover:bg-surface-hover hover:text-foreground",
+ )}
+ >
+ <item.icon className="size-4 shrink-0" aria-hidden="true" />
+ <span className="min-w-0 flex-1 truncate">{item.label}</span>
+ {isMember && item.adminOnly ? (
+ <Lock
+ className="size-3 shrink-0 text-faint-foreground"
+ aria-label={t(($) => $.page.admin_only)}
+ />
+ ) : null}
+ </AppLink>
+ </li>
+ );
+
+ const searchResults = (
+ <div className="space-y-1">
+ <p className="px-3 pb-1 text-caption text-muted-foreground" role="status">
+ {results.length > 0
+ ? t(($) => $.page.search_results, { count: results.length })
+ : t(($) => $.page.search_empty)}
+ </p>
+ <ul id="settings-search-results" role="listbox" aria-label={t(($) => $.page.search)}>
+ {results.map((result, position) => {
+ const page = allEntries.find((item) => item.value === result.tab);
+ const scope = scopeOf(result.tab);
+ const path = [scope?.label, result.anchor || result.integration ? page?.label : null]
+ .filter(Boolean)
+ .join(" › ");
+ return (
+ <li key={`${result.tab}#${result.anchor ?? ""}#${result.integration ?? ""}`}>
+ <button
+ type="button"
+ role="option"
+ aria-selected={position === activeResult}
+ onClick={() => openResult(position)}
+ onMouseMove={() => setActiveResult(position)}
+ className={cn(
+ "w-full rounded-lg px-3 py-2 text-left transition-colors focus-visible:outline-2 focus-visible:outline-ring",
+ position === activeResult
+ ? "bg-surface-selected text-surface-selected-foreground"
+ : "hover:bg-surface-hover",
+ )}
+ >
+ <span className="block truncate text-body">
+ <HighlightText text={result.title} query={query} />
+ </span>
+ {result.snippet ? (
+ <span className="mt-0.5 block truncate text-caption text-muted-foreground">
+ <HighlightText text={result.snippet} query={query} />
+ </span>
+ ) : null}
+ <span className="mt-0.5 block truncate text-caption text-muted-foreground">
+ {path}
+ </span>
+ </button>
+ </li>
+ );
+ })}
+ </ul>
+ </div>
+ );
+
return (
<div className="flex min-h-0 flex-1 flex-col overflow-hidden bg-background md:flex-row">
<aside className="shrink-0 border-b border-surface-border md:flex md:w-60 md:flex-col md:border-b-0 md:border-r">
@@ -256,61 +438,123 @@ export function SettingsPage({ extraDeviceTabs = [] }: SettingsPageProps = {}) {
value={active.value}
onChange={(event) => navigation.push(href(event.target.value))}
>
- {groups.map((group) => (
- <optgroup key={group.key} label={group.label}>
- {group.entries.map((item) => (
- <option key={item.value} value={item.value}>
- {item.label}
- </option>
- ))}
- </optgroup>
- ))}
+ {groups.flatMap((group) =>
+ group.subgroups.map((subgroup) => (
+ <optgroup
+ key={`${group.key}:${subgroup.key}`}
+ label={subgroup.label ? `${group.label} · ${subgroup.label}` : group.label}
+ >
+ {subgroup.entries.map((item) => (
+ <option key={item.value} value={item.value}>
+ {item.label}
+ </option>
+ ))}
+ </optgroup>
+ )),
+ )}
</select>
</div>
+ <div className="relative mx-3 mb-3 hidden shrink-0 md:block">
+ <Search
+ aria-hidden="true"
+ className="pointer-events-none absolute left-2.5 top-1/2 size-4 -translate-y-1/2 text-muted-foreground"
+ />
+ <input
+ type="search"
+ value={query}
+ onChange={(event) => {
+ setQuery(event.target.value);
+ setActiveResult(0);
+ }}
+ onKeyDown={(event) => {
+ if (event.nativeEvent.isComposing) return;
+ if (event.key === "ArrowDown") {
+ event.preventDefault();
+ setActiveResult((current) =>
+ Math.min(current + 1, Math.max(results.length - 1, 0)),
+ );
+ } else if (event.key === "ArrowUp") {
+ event.preventDefault();
+ setActiveResult((current) => Math.max(current - 1, 0));
+ } else if (event.key === "Enter") {
+ event.preventDefault();
+ openResult(activeResult);
+ } else if (event.key === "Escape" && query) {
+ event.preventDefault();
+ setQuery("");
+ }
+ }}
+ placeholder={t(($) => $.page.search)}
+ aria-label={t(($) => $.page.search)}
+ aria-controls={query ? "settings-search-results" : undefined}
+ className="h-8 w-full rounded-lg border border-input bg-transparent pl-8 pr-8 text-body outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 dark:bg-input/30 [&::-webkit-search-cancel-button]:hidden"
+ />
+ {query ? (
+ <button
+ type="button"
+ onClick={() => setQuery("")}
+ aria-label={t(($) => $.page.search_clear)}
+ className="absolute right-1.5 top-1/2 flex size-6 -translate-y-1/2 items-center justify-center rounded-md text-muted-foreground hover:bg-surface-hover hover:text-foreground"
+ >
+ <X className="size-3.5" aria-hidden="true" />
+ </button>
+ ) : null}
+ </div>
<nav
aria-label={t(($) => $.page.title)}
- className="hidden min-h-0 space-y-5 overflow-y-auto px-3 pb-6 md:block"
+ className="hidden min-h-0 overflow-y-auto px-3 pb-6 md:block"
>
- {groups.map((group) => (
- <section
- key={group.key}
- aria-labelledby={`settings-group-${group.key}`}
- >
- <h2
- id={`settings-group-${group.key}`}
- className="mb-1.5 px-3 text-caption font-medium text-muted-foreground"
- >
- {group.label}
- </h2>
- <ul className="space-y-0.5">
- {group.entries.map((item) => (
- <li key={item.value}>
- <AppLink
- href={href(item.value)}
- aria-current={
- active.value === item.value ? "page" : undefined
+ {query ? (
+ searchResults
+ ) : (
+ <div className="divide-y divide-surface-border">
+ {groups.map((group) => (
+ <section
+ key={group.key}
+ aria-labelledby={`settings-group-${group.key}`}
+ className="py-2.5 first:pt-0"
+ >
+ <h2
+ id={`settings-group-${group.key}`}
+ className="flex h-8 min-w-0 items-center gap-2.5 px-3 text-label font-semibold text-foreground"
+ >
+ <span className="flex size-4 shrink-0 items-center justify-center">
+ {group.mark}
+ </span>
+ <span className="truncate">{group.label}</span>
+ {group.tag ? (
+ <span className="ml-auto shrink-0 truncate text-micro font-medium text-muted-foreground">
+ {group.tag}
+ </span>
+ ) : null}
+ </h2>
+ {group.subgroups.map((subgroup) => (
+ <div
+ key={subgroup.key}
+ role={subgroup.label ? "group" : undefined}
+ aria-labelledby={
+ subgroup.label ? `settings-subgroup-${subgroup.key}` : undefined
}
- className={cn(
- "flex min-h-9 items-center gap-2.5 rounded-lg px-3 py-2 text-body transition-colors focus-visible:outline-2 focus-visible:outline-ring",
- active.value === item.value
- ? "bg-surface-selected font-medium text-surface-selected-foreground hover:bg-surface-selected"
- : "text-muted-foreground hover:bg-surface-hover hover:text-foreground",
- )}
>
- <item.icon
- className="size-4 shrink-0"
- aria-hidden="true"
- />
- <span className="min-w-0 truncate">{item.label}</span>
- </AppLink>
- </li>
- ))}
- </ul>
- </section>
- ))}
+ {subgroup.label ? (
+ <h3
+ id={`settings-subgroup-${subgroup.key}`}
+ className="px-3 pb-1 pt-3 text-caption font-medium text-muted-foreground"
+ >
+ {subgroup.label}
+ </h3>
+ ) : null}
+ <ul className="space-y-px">{subgroup.entries.map(navItem)}</ul>
+ </div>
+ ))}
+ </section>
+ ))}
+ </div>
+ )}
</nav>
</aside>
<div
+ ref={contentRef}
key={`${active.value}:${location.integration ?? ""}`}
className="min-w-0 flex-1 overflow-y-auto overscroll-contain"
>
@@ -320,15 +564,6 @@ export function SettingsPage({ extraDeviceTabs = [] }: SettingsPageProps = {}) {
active.wide ? "max-w-5xl" : "max-w-4xl",
)}
>
- <div className="mb-3 flex min-w-0 items-center gap-2 text-caption text-muted-foreground">
- <span className="truncate">{activeGroup.scope}</span>
- {activeGroup.scope !== activeGroup.label && (
- <>
- <ChevronRight aria-hidden="true" className="size-3 shrink-0" />
- <span className="shrink-0">{activeGroup.label}</span>
- </>
- )}
- </div>
{active.content}
</div>
</div>
diff --git a/packages/views/settings/components/settings-search.test.ts b/packages/views/settings/components/settings-search.test.ts
new file mode 100644
index 0000000000..827d8df121
--- /dev/null
+++ b/packages/views/settings/components/settings-search.test.ts
@@ -0,0 +1,68 @@
+// @vitest-environment node
+import { describe, expect, it } from "vitest";
+import {
+ descriptionSnippet,
+ searchSettings,
+ type SettingsSearchEntry,
+} from "./settings-search";
+
+const entries: SettingsSearchEntry[] = [
+ { tab: "profile", title: "Profile" },
+ {
+ tab: "profile",
+ anchor: "about",
+ title: "About you",
+ description: "Given to agents working for you on every run.",
+ },
+ { tab: "workspace", anchor: "context", title: "Agent context" },
+ { tab: "channels", integration: "slack", title: "Slack" },
+ { tab: "channels", integration: "lark", title: "Lark" },
+];
+
+describe("searchSettings", () => {
+ it("returns nothing for an empty or blank query", () => {
+ expect(searchSettings(entries, "")).toEqual([]);
+ expect(searchSettings(entries, " ")).toEqual([]);
+ });
+
+ it("ranks title matches before description-only matches", () => {
+ const results = searchSettings(entries, "agent");
+ expect(results.map((result) => result.title)).toEqual([
+ "Agent context",
+ "About you",
+ ]);
+ });
+
+ it("matches case-insensitively and keeps each detail page", () => {
+ expect(searchSettings(entries, "SLACK").map((r) => r.integration)).toEqual([
+ "slack",
+ ]);
+ // Channels share a tab, so the detail page is part of the identity.
+ expect(searchSettings(entries, "a").map((r) => r.title)).toContain("Lark");
+ });
+
+ it("keeps the first entry for a duplicated location", () => {
+ const results = searchSettings(
+ [...entries, { tab: "profile", title: "Profile again" }],
+ "profile",
+ );
+ expect(results.map((r) => r.title)).toEqual(["Profile"]);
+ });
+});
+
+describe("descriptionSnippet", () => {
+ it("keeps short descriptions whole", () => {
+ expect(descriptionSnippet("Given to agents.", "agents")).toBe(
+ "Given to agents.",
+ );
+ });
+
+ it("trims the lead so a late match stays visible", () => {
+ const text =
+ "This is a rather long description that eventually mentions agents.";
+ const snippet = descriptionSnippet(text, "agents");
+ expect(snippet.startsWith("...")).toBe(true);
+ expect(snippet).toContain("agents");
+ expect(snippet.length).toBeLessThan(text.length);
+ });
+});
diff --git a/packages/views/settings/components/settings-search.ts b/packages/views/settings/components/settings-search.ts
new file mode 100644
index 0000000000..1d9406cd8e
--- /dev/null
+++ b/packages/views/settings/components/settings-search.ts
@@ -0,0 +1,75 @@
+/**
+ * One searchable setting. Titles and descriptions are resolved copy, so the
+ * search matches what the user reads in the current language. User-entered
+ * values (a workspace name, a repository URL) are deliberately not indexed:
+ * the search finds where a setting lives, not what it currently holds.
+ */
+export interface SettingsSearchEntry {
+ /** Settings page (`?tab=`) the entry opens. */
+ tab: string;
+ /** In-page anchor (`?section=`); omitted for page-level entries. */
+ anchor?: string;
+ /** Detail page within Channels (`?integration=`). */
+ integration?: string;
+ title: string;
+ description?: string;
+}
+
+export interface SettingsSearchResult extends SettingsSearchEntry {
+ /** The description window shown under the title, trimmed around the match. */
+ snippet?: string;
+}
+
+// Sized for the settings nav column: about 16 CJK characters fit on a line.
+const SNIPPET_LEAD = 6;
+const SNIPPET_LENGTH = 16;
+const ELLIPSIS = "...";
+
+/** Case-insensitive, whitespace-trimmed needle; empty means "no search". */
+export function normalizeSettingsQuery(query: string): string {
+ return query.trim().toLocaleLowerCase();
+}
+
+/** Keep the match visible in a one-line description preview. */
+export function descriptionSnippet(description: string, needle: string): string {
+ const at = description.toLocaleLowerCase().indexOf(needle);
+ if (at < 0 || at + needle.length <= SNIPPET_LENGTH) return description;
+ const start = Math.max(0, at - SNIPPET_LEAD);
+ return `${ELLIPSIS}${description.slice(start)}`;
+}
+
+/**
+ * Rank entries whose title or description contains the query: title matches
+ * first (page-level before in-page), then description-only matches, each in
+ * index order so results read in the same order as the navigation.
+ */
+export function searchSettings(
+ entries: readonly SettingsSearchEntry[],
+ query: string,
+): SettingsSearchResult[] {
+ const needle = normalizeSettingsQuery(query);
+ if (!needle) return [];
+ const titleHits: SettingsSearchResult[] = [];
+ const descriptionHits: SettingsSearchResult[] = [];
+ const seen = new Set<string>();
+ for (const entry of entries) {
+ const key = `${entry.tab}#${entry.anchor ?? ""}#${entry.integration ?? ""}`;
+ if (seen.has(key)) continue;
+ const inTitle = entry.title.toLocaleLowerCase().includes(needle);
+ const inDescription =
+ !!entry.description &&
+ entry.description.toLocaleLowerCase().includes(needle);
+ if (!inTitle && !inDescription) continue;
+ seen.add(key);
+ const result: SettingsSearchResult = {
+ ...entry,
+ snippet: entry.description
+ ? inDescription
+ ? descriptionSnippet(entry.description, needle)
+ : entry.description
+ : undefined,
+ };
+ (inTitle ? titleHits : descriptionHits).push(result);
+ }
+ return [...titleHits, ...descriptionHits];
+}
diff --git a/packages/views/settings/components/tokens-tab.tsx b/packages/views/settings/components/tokens-tab.tsx
index e521871713..840f6fabc0 100644
--- a/packages/views/settings/components/tokens-tab.tsx
+++ b/packages/views/settings/components/tokens-tab.tsx
@@ -130,7 +130,7 @@ export function TokensTab() {
};
return (
- <SettingsTab title={t(($) => $.tokens.title)} description={t(($) => $.tokens.purpose)}>
+ <SettingsTab title={t(($) => $.tokens.title)} description={t(($) => $.tokens.purpose)} scope="account">
<SettingsSection
description={t(($) => $.tokens.security_note)}
>
diff --git a/packages/views/settings/components/use-settings-search-index.ts b/packages/views/settings/components/use-settings-search-index.ts
new file mode 100644
index 0000000000..519dd4238c
--- /dev/null
+++ b/packages/views/settings/components/use-settings-search-index.ts
@@ -0,0 +1,207 @@
+"use client";
+
+import { useMemo } from "react";
+import { useT } from "../../i18n";
+import type { SettingsSearchEntry } from "./settings-search";
+import { CHANNEL_INTEGRATIONS } from "./settings-navigation";
+
+const NOTIFICATION_GROUPS = [
+ "assignments",
+ "status_changes",
+ "comments",
+ "mentions",
+ "updates",
+ "agent_activity",
+] as const;
+
+export interface SettingsSearchPage {
+ value: string;
+ label: string;
+}
+
+export type SettingsSearchIndexEntry = SettingsSearchEntry;
+
+/**
+ * The searchable settings for the pages currently in the navigation. Anchors
+ * here must match the `anchor` props on the corresponding `SettingsSection` /
+ * `SettingsRow`; entries for hidden pages (feature flags, desktop-only) are
+ * dropped so a result never lands on a page the user cannot open.
+ */
+export function useSettingsSearchIndex(
+ pages: readonly SettingsSearchPage[],
+): SettingsSearchIndexEntry[] {
+ const { t } = useT("settings");
+ return useMemo(() => {
+ const visible = new Set(pages.map((page) => page.value));
+ const rows: SettingsSearchIndexEntry[] = [
+ // Personal
+ { tab: "profile", anchor: "avatar", title: t(($) => $.account.avatar_label) },
+ { tab: "profile", anchor: "name", title: t(($) => $.account.name_label) },
+ {
+ tab: "profile",
+ anchor: "about",
+ title: t(($) => $.account.profile_description_label),
+ description: t(($) => $.account.profile_description_hint),
+ },
+ { tab: "preferences", anchor: "language", title: t(($) => $.preferences.language.title) },
+ {
+ tab: "preferences",
+ anchor: "timezone",
+ title: t(($) => $.preferences.timezone.title),
+ description: t(($) => $.preferences.timezone.hint),
+ },
+ { tab: "preferences", anchor: "theme", title: t(($) => $.preferences.theme.title) },
+ {
+ tab: "preferences",
+ anchor: "sticky-comment-bar",
+ title: t(($) => $.preferences.sticky_comment_bar.title),
+ },
+ {
+ tab: "preferences",
+ anchor: "running-agent-reply",
+ title: t(($) => $.preferences.running_agent_reply.title),
+ description: t(($) => $.preferences.running_agent_reply.hint),
+ },
+ {
+ tab: "preferences",
+ anchor: "chat",
+ title: t(($) => $.chat.floating_label),
+ description: t(($) => $.chat.floating_hint),
+ },
+ {
+ tab: "preferences",
+ anchor: "issue",
+ title: t(($) => $.preferences.issue_fields_title),
+ description: t(($) => $.issue.description),
+ },
+ ...NOTIFICATION_GROUPS.map((group) => ({
+ tab: "notifications",
+ anchor: group,
+ title: t(($) => $.notifications.groups[group].label),
+ description: t(($) => $.notifications.groups[group].description),
+ })),
+ {
+ tab: "notifications",
+ anchor: "system",
+ title: t(($) => $.notifications.system.label),
+ description: t(($) => $.notifications.system.description),
+ },
+ {
+ tab: "notifications",
+ anchor: "browser",
+ title: t(($) => $.notifications.browser.label),
+ },
+ {
+ tab: "tokens",
+ title: t(($) => $.page.tabs.tokens),
+ description: t(($) => $.tokens.purpose),
+ },
+ {
+ tab: "shortcuts",
+ title: t(($) => $.page.tabs.shortcuts),
+ description: t(($) => $.shortcuts.description),
+ },
+ {
+ tab: "apps",
+ title: t(($) => $.page.tabs.apps),
+ description: t(($) => $.composio.page_description),
+ },
+ // Workspace
+ { tab: "workspace", anchor: "name", title: t(($) => $.workspace.name_label) },
+ { tab: "workspace", anchor: "description", title: t(($) => $.workspace.description_label) },
+ {
+ tab: "workspace",
+ anchor: "context",
+ title: t(($) => $.workspace.context_label),
+ description: t(($) => $.workspace.context_hint),
+ },
+ { tab: "workspace", anchor: "slug", title: t(($) => $.workspace.slug_label) },
+ {
+ tab: "workspace",
+ anchor: "issue-prefix",
+ title: t(($) => $.workspace.issue_prefix_label),
+ },
+ { tab: "workspace", anchor: "leave", title: t(($) => $.workspace.leave_title) },
+ { tab: "workspace", anchor: "delete", title: t(($) => $.workspace.delete_title) },
+ { tab: "members", anchor: "invitations", title: t(($) => $.members.pending_label) },
+ { tab: "members", anchor: "links", title: t(($) => $.members.share_links_label) },
+ {
+ tab: "labels",
+ title: t(($) => $.page.tabs.labels),
+ description: t(($) => $.labels.description),
+ },
+ {
+ tab: "properties",
+ title: t(($) => $.page.tabs.properties),
+ description: t(($) => $.properties.description),
+ },
+ {
+ tab: "quick-actions",
+ title: t(($) => $.page.tabs.quick_actions),
+ description: t(($) => $.quick_actions.description),
+ },
+ { tab: "code", anchor: "code-hosting", title: t(($) => $.code.hosting_title) },
+ { tab: "code", anchor: "github", title: t(($) => $.page.tabs.github) },
+ { tab: "code", anchor: "vcs", title: t(($) => $.vcs.section_title) },
+ {
+ tab: "code",
+ anchor: "repositories",
+ title: t(($) => $.repositories.section_title),
+ description: t(($) => $.repositories.description),
+ },
+ { tab: "code", anchor: "pr-linking", title: t(($) => $.code.pr_linking_title) },
+ {
+ tab: "code",
+ anchor: "pr-sidebar",
+ title: t(($) => $.github.feature_pr_sidebar_label),
+ description: t(($) => $.github.feature_pr_sidebar_description),
+ },
+ {
+ tab: "code",
+ anchor: "auto-link",
+ title: t(($) => $.github.feature_auto_link_label),
+ description: t(($) => $.github.feature_auto_link_description, {
+ example: "MUL-123",
+ }),
+ },
+ {
+ tab: "code",
+ anchor: "co-author",
+ title: t(($) => $.github.feature_co_author_label),
+ },
+ {
+ tab: "code",
+ anchor: "pr-merge-status",
+ title: t(($) => $.pr_merge_status.label),
+ description: t(($) => $.pr_merge_status.description),
+ },
+ ...CHANNEL_INTEGRATIONS.map((channel) => ({
+ tab: "channels",
+ integration: channel,
+ title: t(($) => $[channel].section_title),
+ description: t(($) => $[channel].page_description),
+ })),
+ {
+ tab: "mcp",
+ title: t(($) => $.page.tabs.mcp),
+ description: t(($) => $.mcp.description),
+ },
+ ];
+ // Rows without an anchor describe a whole page: fold their copy into the
+ // page entry so each page is indexed once, with its description.
+ const pageDescriptions = new Map(
+ rows
+ .filter((row) => !row.anchor && !row.integration)
+ .map((row) => [row.tab, row.description]),
+ );
+ const pageEntries: SettingsSearchIndexEntry[] = pages.map((page) => ({
+ tab: page.value,
+ title: page.label,
+ description: pageDescriptions.get(page.value),
+ }));
+ return [
+ ...pageEntries,
+ ...rows.filter((row) => row.anchor || row.integration),
+ ].filter((entry) => visible.has(entry.tab));
+ }, [pages, t]);
+}
diff --git a/packages/views/settings/components/vcs-tab.tsx b/packages/views/settings/components/vcs-tab.tsx
deleted file mode 100644
index d59aea0e46..0000000000
--- a/packages/views/settings/components/vcs-tab.tsx
+++ /dev/null
@@ -1,371 +0,0 @@
-"use client";
-
-import { useState } from "react";
-import { useQuery, useQueryClient } from "@tanstack/react-query";
-import { toast } from "sonner";
-import { Copy, GitBranch, RefreshCw, Trash2 } from "lucide-react";
-import { Button } from "@multica/ui/components/ui/button";
-import { Card, CardContent } from "@multica/ui/components/ui/card";
-import { Input } from "@multica/ui/components/ui/input";
-import { Label } from "@multica/ui/components/ui/label";
-import {
- Select,
- SelectContent,
- SelectItem,
- SelectTrigger,
- SelectValue,
-} from "@multica/ui/components/ui/select";
-import {
- AlertDialog,
- AlertDialogAction,
- AlertDialogCancel,
- AlertDialogContent,
- AlertDialogDescription,
- AlertDialogFooter,
- AlertDialogHeader,
- AlertDialogTitle,
-} from "@multica/ui/components/ui/alert-dialog";
-import { useWorkspaceId } from "@multica/core/hooks";
-import { vcsConnectionsOptions } from "@multica/core/vcs";
-import { api } from "@multica/core/api";
-import type { ConnectVCSResponse, VCSProvider } from "@multica/core/types";
-import { useT } from "../../i18n";
-import { PRMergeStatusRow } from "./pr-merge-status-row";
-
-const PROVIDERS: VCSProvider[] = ["forgejo", "gitea", "gitlab"];
-const PROVIDER_LABELS: Record<VCSProvider, string> = {
- forgejo: "Forgejo",
- gitea: "Gitea",
- gitlab: "GitLab",
-};
-const PROVIDER_OPTIONS = PROVIDERS.map((p) => ({
- value: p,
- label: PROVIDER_LABELS[p],
-}));
-
-
-export function VCSTab() {
- const { t } = useT("settings");
- const wsId = useWorkspaceId();
- const qc = useQueryClient();
-
- const { data } = useQuery(vcsConnectionsOptions(wsId));
- const connections = data?.connections ?? [];
- const configured = data?.configured === true;
- const canManage = data?.can_manage === true;
-
- const [provider, setProvider] = useState<VCSProvider>("forgejo");
- const [instanceUrl, setInstanceUrl] = useState("");
- const [token, setToken] = useState("");
- const [connecting, setConnecting] = useState(false);
- const [justConnected, setJustConnected] = useState<ConnectVCSResponse | null>(null);
- const [rotateTarget, setRotateTarget] = useState<string | null>(null);
- const [rotating, setRotating] = useState(false);
- const [deleteTarget, setDeleteTarget] = useState<string | null>(null);
- const [deleting, setDeleting] = useState(false);
-
- async function handleConnect() {
- if (connecting || !instanceUrl.trim() || !token.trim()) return;
- setConnecting(true);
- try {
- const resp = await api.connectVCS(wsId, {
- provider,
- instance_url: instanceUrl.trim(),
- access_token: token.trim(),
- });
- await qc.invalidateQueries({ queryKey: ["vcs", wsId] });
- setJustConnected(resp);
- setInstanceUrl("");
- setToken("");
- toast.success(t(($) => $.vcs.toast_connected));
- } catch (e) {
- toast.error(e instanceof Error ? e.message : t(($) => $.vcs.toast_connect_failed));
- } finally {
- setConnecting(false);
- }
- }
-
- async function handleRotateWebhook() {
- if (!rotateTarget || rotating) return;
- setRotating(true);
- try {
- const resp = await api.rotateVCSWebhook(wsId, rotateTarget);
- await qc.invalidateQueries({ queryKey: ["vcs", wsId] });
- setJustConnected(resp);
- setRotateTarget(null);
- toast.success(t(($) => $.vcs.toast_rotated));
- } catch (e) {
- toast.error(e instanceof Error ? e.message : t(($) => $.vcs.toast_rotate_failed));
- } finally {
- setRotating(false);
- }
- }
-
- async function handleDelete() {
- if (!deleteTarget || deleting) return;
- setDeleting(true);
- try {
- await api.deleteVCSConnection(wsId, deleteTarget);
- await qc.invalidateQueries({ queryKey: ["vcs", wsId] });
- if (justConnected?.id === deleteTarget) setJustConnected(null);
- toast.success(t(($) => $.vcs.toast_disconnected));
- setDeleteTarget(null);
- } catch (e) {
- toast.error(e instanceof Error ? e.message : t(($) => $.vcs.toast_disconnect_failed));
- } finally {
- setDeleting(false);
- }
- }
-
- async function copy(value: string) {
- try {
- await navigator.clipboard.writeText(value);
- toast.success(t(($) => $.vcs.copied));
- } catch {
- toast.error(t(($) => $.vcs.copy_failed));
- }
- }
-
- return (
- <div className="space-y-6">
- <p className="text-body text-muted-foreground">{t(($) => $.vcs.page_description)}</p>
-
- {connections.length > 0 && (
- <div className="space-y-3">
- {connections.map((c) => (
- <Card key={c.id}>
- <CardContent className="flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between sm:gap-4">
- <div className="flex min-w-0 items-start gap-3">
- <div className="rounded-md border bg-muted/50 p-2 text-muted-foreground shrink-0">
- <GitBranch className="h-4 w-4" />
- </div>
- <div className="min-w-0 space-y-0.5">
- <p className="text-body font-medium break-all">
- {(PROVIDER_LABELS[c.provider] ?? c.provider) + " · " + c.instance_url}
- </p>
- <p className="text-caption text-muted-foreground break-all">
- {t(($) => $.vcs.connected_as, { login: c.account_login })}
- </p>
- </div>
- </div>
- {canManage && (
- <div className="flex flex-wrap items-center gap-2 shrink-0">
- <Button
- variant="outline"
- size="sm"
- onClick={() => setRotateTarget(c.id)}
- >
- <RefreshCw className="h-3 w-3" />
- {t(($) => $.vcs.regenerate_webhook)}
- </Button>
- <Button variant="outline" size="sm" onClick={() => setDeleteTarget(c.id)}>
- <Trash2 className="h-3 w-3" />
- {t(($) => $.vcs.disconnect)}
- </Button>
- </div>
- )}
- </CardContent>
- </Card>
- ))}
- </div>
- )}
-
- {/* The PR merge setting is shared with GitHub; shown here once a
- provider is connected, since that is when it starts to matter. */}
- {connections.length > 0 && (
- <Card className="py-0">
- <CardContent className="px-0">
- <PRMergeStatusRow canManage={canManage} />
- </CardContent>
- </Card>
- )}
-
- {justConnected && (
- <Card className="border-primary/40">
- <CardContent className="space-y-3">
- <div className="space-y-1">
- <p className="text-body font-medium">{t(($) => $.vcs.webhook_setup_title)}</p>
- <p className="text-caption text-muted-foreground">
- {t(($) => $.vcs.webhook_setup_description)}
- </p>
- </div>
- <CopyField
- label={t(($) => $.vcs.webhook_url_label)}
- value={justConnected.webhook_url || justConnected.webhook_path}
- onCopy={copy}
- copyLabel={t(($) => $.vcs.copy)}
- />
- <CopyField
- label={t(($) => $.vcs.webhook_secret_label)}
- value={justConnected.webhook_secret}
- onCopy={copy}
- copyLabel={t(($) => $.vcs.copy)}
- mono
- />
- <p className="text-caption text-amber-600 dark:text-amber-500">
- {t(($) => $.vcs.webhook_secret_warning)}
- </p>
- </CardContent>
- </Card>
- )}
-
- {canManage && (
- <Card>
- <CardContent className="space-y-4">
- <p className="text-body font-medium">{t(($) => $.vcs.connect_title)}</p>
- {!configured ? (
- <p className="text-caption text-muted-foreground">
- {t(($) => $.vcs.not_configured)}{" "}
- <code className="rounded-xs bg-muted px-1 py-0.5 text-micro">
- MULTICA_VCS_SECRET_KEY
- </code>
- .
- </p>
- ) : (
- <>
- <div className="space-y-1.5">
- <Label htmlFor="vcs-provider">{t(($) => $.vcs.form_provider_label)}</Label>
- <Select
- items={PROVIDER_OPTIONS}
- value={provider}
- onValueChange={(v) => setProvider(v as VCSProvider)}
- >
- <SelectTrigger id="vcs-provider" disabled={connecting}>
- <SelectValue />
- </SelectTrigger>
- <SelectContent>
- {PROVIDERS.map((p) => (
- <SelectItem key={p} value={p}>
- {PROVIDER_LABELS[p]}
- </SelectItem>
- ))}
- </SelectContent>
- </Select>
- </div>
- <div className="space-y-1.5">
- <Label htmlFor="vcs-url">{t(($) => $.vcs.form_instance_url_label)}</Label>
- <Input
- id="vcs-url"
- placeholder="https://forgejo.example.com"
- value={instanceUrl}
- onChange={(e) => setInstanceUrl(e.target.value)}
- disabled={connecting}
- />
- </div>
- <div className="space-y-1.5">
- <Label htmlFor="vcs-token">{t(($) => $.vcs.form_token_label)}</Label>
- <Input
- id="vcs-token"
- type="password"
- placeholder={t(($) => $.vcs.form_token_placeholder)}
- value={token}
- onChange={(e) => setToken(e.target.value)}
- disabled={connecting}
- />
- <p className="text-caption text-muted-foreground">{t(($) => $.vcs.form_token_hint)}</p>
- </div>
- <div className="flex justify-end">
- <Button
- size="sm"
- onClick={handleConnect}
- disabled={connecting || !instanceUrl.trim() || !token.trim()}
- >
- {connecting ? t(($) => $.vcs.connecting) : t(($) => $.vcs.connect)}
- </Button>
- </div>
- </>
- )}
- </CardContent>
- </Card>
- )}
-
- {!canManage && connections.length === 0 && (
- <p className="text-caption text-muted-foreground">{t(($) => $.vcs.contact_admin)}</p>
- )}
-
- <AlertDialog
- open={!!rotateTarget}
- onOpenChange={(v) => {
- if (!v && !rotating) setRotateTarget(null);
- }}
- >
- <AlertDialogContent>
- <AlertDialogHeader>
- <AlertDialogTitle>{t(($) => $.vcs.rotate_confirm_title)}</AlertDialogTitle>
- <AlertDialogDescription>
- {t(($) => $.vcs.rotate_confirm_description)}
- </AlertDialogDescription>
- </AlertDialogHeader>
- <AlertDialogFooter>
- <AlertDialogCancel disabled={rotating}>
- {t(($) => $.vcs.rotate_confirm_cancel)}
- </AlertDialogCancel>
- <AlertDialogAction onClick={handleRotateWebhook} disabled={rotating}>
- {rotating ? t(($) => $.vcs.rotating) : t(($) => $.vcs.rotate_confirm_action)}
- </AlertDialogAction>
- </AlertDialogFooter>
- </AlertDialogContent>
- </AlertDialog>
-
- <AlertDialog
- open={!!deleteTarget}
- onOpenChange={(v) => {
- if (!v && !deleting) setDeleteTarget(null);
- }}
- >
- <AlertDialogContent>
- <AlertDialogHeader>
- <AlertDialogTitle>{t(($) => $.vcs.disconnect_confirm_title)}</AlertDialogTitle>
- <AlertDialogDescription>
- {t(($) => $.vcs.disconnect_confirm_description)}
- </AlertDialogDescription>
- </AlertDialogHeader>
- <AlertDialogFooter>
- <AlertDialogCancel disabled={deleting}>
- {t(($) => $.vcs.disconnect_confirm_cancel)}
- </AlertDialogCancel>
- <AlertDialogAction onClick={handleDelete} disabled={deleting}>
- {deleting ? t(($) => $.vcs.disconnecting) : t(($) => $.vcs.disconnect_confirm_action)}
- </AlertDialogAction>
- </AlertDialogFooter>
- </AlertDialogContent>
- </AlertDialog>
- </div>
- );
-}
-
-function CopyField({
- label,
- value,
- onCopy,
- copyLabel,
- mono,
-}: {
- label: string;
- value: string;
- onCopy: (v: string) => void;
- copyLabel: string;
- mono?: boolean;
-}) {
- return (
- <div className="space-y-1.5">
- <Label className="text-caption">{label}</Label>
- <div className="flex items-center gap-2">
- <Input
- readOnly
- value={value}
- className={mono ? "min-w-0 font-mono text-caption" : "min-w-0 text-caption"}
- />
- <Button
- variant="outline"
- size="sm"
- className="shrink-0"
- onClick={() => onCopy(value)}
- title={copyLabel}
- >
- <Copy className="h-3 w-3" />
- </Button>
- </div>
- </div>
- );
-}
diff --git a/packages/views/settings/components/workspace-tab.test.tsx b/packages/views/settings/components/workspace-tab.test.tsx
index 090f19c64a..b4ae7562ea 100644
--- a/packages/views/settings/components/workspace-tab.test.tsx
+++ b/packages/views/settings/components/workspace-tab.test.tsx
@@ -1,6 +1,6 @@
import type { ReactNode } from "react";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
-import { render, screen, waitFor } from "@testing-library/react";
+import { render, screen, waitFor, within } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import { I18nProvider } from "@multica/core/i18n/react";
import enCommon from "../../locales/en/common.json";
@@ -21,7 +21,9 @@ const workspaceRef = vi.hoisted(() => ({
},
}));
const membersRef = vi.hoisted(() => ({
- current: [{ user_id: "user-1", role: "owner" as "owner" | "admin" | "member" }],
+ current: [
+ { user_id: "user-1", role: "owner" as "owner" | "admin" | "member", name: "Ada" },
+ ] as { user_id: string; role: "owner" | "admin" | "member"; name?: string }[],
}));
vi.mock("@tanstack/react-query", () => ({
@@ -113,7 +115,7 @@ describe("WorkspaceTab — automatic updates", () => {
issue_prefix: "TES",
repos: [],
};
- membersRef.current = [{ user_id: "user-1", role: "owner" }];
+ membersRef.current = [{ user_id: "user-1", role: "owner", name: "Ada" }];
mockUpdateWorkspace.mockImplementation(
async (_id: string, payload: Record<string, unknown>) => ({
...workspaceRef.current,
@@ -132,33 +134,16 @@ describe("WorkspaceTab — automatic updates", () => {
return userEvent.setup({ advanceTimers: vi.advanceTimersByTime });
}
- it("renders the current prefix in the shared input control", () => {
- render(<WorkspaceTab />, { wrapper: I18nWrapper });
- const input = screen.getByPlaceholderText("TES") as HTMLInputElement;
- expect(input.value).toBe("TES");
- expect(screen.queryByRole("button", { name: /^Save$/ })).toBeNull();
- });
-
- it("renders the workspace slug in the shared read-only input control", () => {
+ it("shows the prefix and slug as values, not editable fields", () => {
render(<WorkspaceTab />, { wrapper: I18nWrapper });
- const input = screen.getByRole("textbox", { name: "Slug" }) as HTMLInputElement;
- expect(input.value).toBe("test-workspace");
- expect(input.readOnly).toBe(true);
- });
-
- it("uppercases and strips non-alphanumeric prefix input", async () => {
- const user = setupUser();
- render(<WorkspaceTab />, { wrapper: I18nWrapper });
- const input = screen.getByPlaceholderText("TES") as HTMLInputElement;
-
- await user.clear(input);
- await user.type(input, "ab-12!cd");
-
- expect(input.value).toBe("AB12CD");
+ expect(screen.getByText("TES")).toBeInTheDocument();
+ expect(screen.getByText("test-workspace")).toBeInTheDocument();
+ expect(screen.queryByRole("textbox", { name: "Slug" })).toBeNull();
+ expect(screen.queryByRole("button", { name: /^Save$/ })).toBeNull();
});
- it("auto-saves ordinary workspace fields without invalidating issue caches", async () => {
+ it("auto-saves ordinary workspace fields silently, without invalidating issue caches", async () => {
const user = setupUser();
render(<WorkspaceTab />, { wrapper: I18nWrapper });
const nameInput = screen.getByDisplayValue("Test Workspace");
@@ -173,76 +158,78 @@ describe("WorkspaceTab — automatic updates", () => {
description: "",
context: "",
});
- expect(mockToastSuccess).toHaveBeenCalledWith(
- "Workspace settings saved",
- { id: "settings-auto-save" },
- );
});
+ // The inline save state reports success; a toast would repeat it.
+ expect(mockToastSuccess).not.toHaveBeenCalled();
expect(mockInvalidateQueries).not.toHaveBeenCalled();
});
- it("asks for confirmation on prefix blur and persists only after confirmation", async () => {
+ it("changes the prefix only from its own dialog, after previewing the result", async () => {
const user = setupUser();
render(<WorkspaceTab />, { wrapper: I18nWrapper });
- const input = screen.getByPlaceholderText("TES") as HTMLInputElement;
- await user.clear(input);
- await user.type(input, "NEW");
- await user.tab();
+ await user.click(screen.getByRole("button", { name: "Change prefix..." }));
+ const dialog = await screen.findByRole("dialog", { name: "Change issue prefix" });
+ const input = within(dialog).getByRole("textbox", { name: "New prefix" });
+ await user.clear(input);
+ await user.type(input, "ab-12!cd");
+ expect(input).toHaveValue("AB12CD");
+ expect(within(dialog).getByText("TES-123")).toBeInTheDocument();
+ expect(within(dialog).getByText("AB12CD-123")).toBeInTheDocument();
expect(mockUpdateWorkspace).not.toHaveBeenCalled();
- await screen.findByText(/Change issue prefix/i);
- expect(screen.getByText(/TES-N/)).toBeTruthy();
- expect(screen.getByText(/NEW-N/)).toBeTruthy();
- await user.click(screen.getByRole("button", { name: "Confirm" }));
+ await user.click(within(dialog).getByRole("button", { name: "Change to AB12CD" }));
await waitFor(() => {
expect(mockUpdateWorkspace).toHaveBeenCalledWith("workspace-1", {
- issue_prefix: "NEW",
+ issue_prefix: "AB12CD",
});
});
expect(mockInvalidateQueries).toHaveBeenCalledWith({
queryKey: ["issues", "workspace-1"],
});
- expect(mockToastSuccess).toHaveBeenCalledWith(
- "Workspace settings saved",
- { id: "settings-auto-save" },
- );
+ await waitFor(() => {
+ expect(screen.queryByRole("dialog", { name: "Change issue prefix" })).toBeNull();
+ });
});
- it("does not persist a prefix when the confirmation is cancelled", async () => {
+ it("does not persist a prefix when the dialog is cancelled", async () => {
const user = setupUser();
render(<WorkspaceTab />, { wrapper: I18nWrapper });
- const input = screen.getByPlaceholderText("TES") as HTMLInputElement;
- await user.clear(input);
- await user.type(input, "NEW");
- await user.tab();
- await screen.findByText(/Change issue prefix/i);
- await user.click(screen.getByRole("button", { name: "Cancel" }));
+ await user.click(screen.getByRole("button", { name: "Change prefix..." }));
+ const dialog = await screen.findByRole("dialog", { name: "Change issue prefix" });
+ await user.type(within(dialog).getByRole("textbox", { name: "New prefix" }), "X");
+ await user.click(within(dialog).getByRole("button", { name: "Cancel" }));
expect(mockUpdateWorkspace).not.toHaveBeenCalled();
- expect(input.value).toBe("NEW");
});
- it("marks an empty prefix invalid and does not persist it", async () => {
+ it("cannot confirm an empty or unchanged prefix", async () => {
const user = setupUser();
render(<WorkspaceTab />, { wrapper: I18nWrapper });
- const input = screen.getByPlaceholderText("TES") as HTMLInputElement;
- await user.clear(input);
- await user.tab();
+ await user.click(screen.getByRole("button", { name: "Change prefix..." }));
+ const dialog = await screen.findByRole("dialog", { name: "Change issue prefix" });
+ const input = within(dialog).getByRole("textbox", { name: "New prefix" });
+ expect(within(dialog).getByRole("button", { name: "Change to TES" })).toBeDisabled();
+ await user.clear(input);
expect(input).toHaveAttribute("aria-invalid", "true");
- expect(mockUpdateWorkspace).not.toHaveBeenCalled();
+ expect(within(dialog).getByRole("button", { name: /^Change to/ })).toBeDisabled();
});
- it("disables editable workspace controls for regular members", () => {
- membersRef.current = [{ user_id: "user-1", role: "member" }];
+ it("shows regular members the values read-only, with who to ask", () => {
+ membersRef.current = [
+ { user_id: "user-1", role: "member" },
+ { user_id: "user-2", role: "owner", name: "Grace Hopper" },
+ ];
render(<WorkspaceTab />, { wrapper: I18nWrapper });
- expect(screen.getByPlaceholderText("TES")).toBeDisabled();
- expect(screen.getByDisplayValue("Test Workspace")).toBeDisabled();
+ expect(screen.getByRole("note")).toHaveTextContent("Ask Grace Hopper");
+ expect(screen.queryByDisplayValue("Test Workspace")).toBeNull();
+ expect(screen.getByText("Test Workspace")).toBeInTheDocument();
+ expect(screen.queryByRole("button", { name: "Change prefix..." })).toBeNull();
});
});
diff --git a/packages/views/settings/components/workspace-tab.tsx b/packages/views/settings/components/workspace-tab.tsx
index 6cb71d0569..0ea4bfd9fb 100644
--- a/packages/views/settings/components/workspace-tab.tsx
+++ b/packages/views/settings/components/workspace-tab.tsx
@@ -1,10 +1,20 @@
"use client";
import { useCallback, useEffect, useMemo, useState } from "react";
-import { LogOut } from "lucide-react";
+import { Copy } from "lucide-react";
import { Input } from "@multica/ui/components/ui/input";
import { Textarea } from "@multica/ui/components/ui/textarea";
import { Button } from "@multica/ui/components/ui/button";
+import { Label } from "@multica/ui/components/ui/label";
+import {
+ Dialog,
+ DialogContent,
+ DialogDescription,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle,
+} from "@multica/ui/components/ui/dialog";
+import { copyText } from "@multica/ui/lib/clipboard";
import {
AlertDialog,
AlertDialogContent,
@@ -39,6 +49,7 @@ import { DeleteWorkspaceDialog } from "./delete-workspace-dialog";
import { useT } from "../../i18n";
import {
SettingsCard,
+ SettingsReadOnlyNotice,
SettingsRow,
SettingsSaveState,
SettingsSection,
@@ -130,7 +141,7 @@ export function WorkspaceTab() {
const [name, setName] = useState(workspace?.name ?? "");
const [description, setDescription] = useState(workspace?.description ?? "");
const [context, setContext] = useState(workspace?.context ?? "");
- const [issuePrefix, setIssuePrefix] = useState(workspace?.issue_prefix ?? "");
+ const [prefixDraft, setPrefixDraft] = useState<string | null>(null);
const [prefixSaveStatus, setPrefixSaveStatus] =
useState<SettingsSaveStatus>("idle");
const [actionId, setActionId] = useState<string | null>(null);
@@ -161,7 +172,7 @@ export function WorkspaceTab() {
setName(workspace?.name ?? "");
setDescription(workspace?.description ?? "");
setContext(workspace?.context ?? "");
- setIssuePrefix(workspace?.issue_prefix ?? "");
+ setPrefixDraft(null);
// eslint-disable-next-line react-hooks/exhaustive-deps -- intentionally keyed on id only; see comment above
}, [workspace?.id]);
@@ -171,7 +182,7 @@ export function WorkspaceTab() {
const normalizePrefix = (raw: string) =>
raw.toUpperCase().replace(/[^A-Z0-9]/g, "").slice(0, 10);
- const normalizedPrefix = normalizePrefix(issuePrefix);
+ const normalizedPrefix = normalizePrefix(prefixDraft ?? "");
const prefixChanged =
!!workspace && normalizedPrefix !== workspace.issue_prefix;
const prefixInvalid = normalizedPrefix.length === 0;
@@ -202,10 +213,6 @@ export function WorkspaceTab() {
value: detailsDraft,
savedValue: savedDetails,
onSave: saveDetails,
- onSuccess: () =>
- toast.success(t(($) => $.workspace.toast_saved), {
- id: "settings-auto-save",
- }),
onError: (error) =>
toast.error(
error instanceof Error
@@ -230,9 +237,7 @@ export function WorkspaceTab() {
// so every cached issue key is stale after this confirmed change.
await qc.invalidateQueries({ queryKey: issueKeys.all(updated.id) });
setPrefixSaveStatus("saved");
- toast.success(t(($) => $.workspace.toast_saved), {
- id: "settings-auto-save",
- });
+ setPrefixDraft(null);
} catch (error) {
setPrefixSaveStatus("error");
toast.error(
@@ -243,20 +248,6 @@ export function WorkspaceTab() {
}
};
- const handlePrefixBlur = () => {
- if (!workspace || prefixInvalid || !prefixChanged) return;
- const nextPrefix = normalizedPrefix;
- setConfirmAction({
- title: t(($) => $.workspace.prefix_confirm_title),
- description: t(($) => $.workspace.prefix_confirm_description, {
- oldPrefix: workspace.issue_prefix,
- newPrefix: nextPrefix,
- }),
- variant: "destructive",
- onConfirm: () => performPrefixSave(nextPrefix),
- });
- };
-
const handleLeaveWorkspace = () => {
if (!workspace) return;
setConfirmAction({
@@ -300,19 +291,27 @@ export function WorkspaceTab() {
if (!workspace) return null;
+ const readOnly = membersFetched && !canManageWorkspace;
+ const readOnlyText = (value: string) => (
+ <p className="whitespace-pre-wrap break-words text-body text-foreground sm:text-right">
+ {value || <span className="text-faint-foreground">—</span>}
+ </p>
+ );
+ const saveStatus =
+ prefixSaveStatus === "saving" || prefixSaveStatus === "error"
+ ? prefixSaveStatus
+ : detailsAutoSave.status === "idle"
+ ? prefixSaveStatus
+ : detailsAutoSave.status;
+
return (
- <SettingsTab title={t(($) => $.page.tabs.general)}>
+ <SettingsTab title={t(($) => $.page.tabs.general)} scope="workspace">
+ {readOnly ? <SettingsReadOnlyNotice wsId={workspace.id} /> : null}
<SettingsSection
title={t(($) => $.workspace.section_general)}
action={
<SettingsSaveState
- status={
- prefixSaveStatus === "saving" || prefixSaveStatus === "error"
- ? prefixSaveStatus
- : detailsAutoSave.status === "idle"
- ? prefixSaveStatus
- : detailsAutoSave.status
- }
+ status={saveStatus}
savingLabel={t(($) => $.auto_save.saving)}
savedLabel={t(($) => $.auto_save.saved)}
errorLabel={t(($) => $.auto_save.failed)}
@@ -321,8 +320,11 @@ export function WorkspaceTab() {
>
<SettingsCard>
<SettingsRow
+ anchor="logo"
label={t(($) => $.workspace.logo_label)}
- description={t(($) => $.workspace.click_logo_hint)}
+ description={
+ canManageWorkspace ? t(($) => $.workspace.click_logo_hint) : undefined
+ }
size="none"
>
<div className="flex justify-start sm:justify-end">
@@ -343,9 +345,6 @@ export function WorkspaceTab() {
(old: Workspace[] | undefined) =>
old?.map((ws) => (ws.id === updated.id ? updated : ws)),
);
- toast.success(t(($) => $.workspace.toast_logo_updated), {
- id: "settings-auto-save",
- });
} catch (error) {
toast.error(
error instanceof Error
@@ -359,108 +358,122 @@ export function WorkspaceTab() {
</SettingsRow>
<SettingsRow
+ anchor="name"
label={t(($) => $.workspace.name_label)}
- size="text"
+ size={readOnly ? undefined : "text"}
>
- <Input
- type="text"
- name="workspace-name"
- autoComplete="organization"
- aria-label={t(($) => $.workspace.name_label)}
- value={name}
- onChange={(event) => setName(event.target.value)}
- onBlur={detailsAutoSave.flush}
- disabled={!canManageWorkspace}
- />
+ {readOnly ? (
+ readOnlyText(workspace.name)
+ ) : (
+ <Input
+ type="text"
+ name="workspace-name"
+ autoComplete="organization"
+ aria-label={t(($) => $.workspace.name_label)}
+ value={name}
+ onChange={(event) => setName(event.target.value)}
+ onBlur={detailsAutoSave.flush}
+ disabled={!canManageWorkspace}
+ />
+ )}
</SettingsRow>
<SettingsRow
+ anchor="description"
label={t(($) => $.workspace.description_label)}
- size="text"
+ size={readOnly ? undefined : "text"}
align="start"
>
- <Textarea
- name="workspace-description"
- autoComplete="off"
- aria-label={t(($) => $.workspace.description_label)}
- value={description}
- onChange={(event) => setDescription(event.target.value)}
- onBlur={detailsAutoSave.flush}
- rows={3}
- disabled={!canManageWorkspace}
- className="resize-none"
- placeholder={t(($) => $.workspace.description_placeholder)}
- />
+ {readOnly ? (
+ readOnlyText(workspace.description ?? "")
+ ) : (
+ <Textarea
+ name="workspace-description"
+ autoComplete="off"
+ aria-label={t(($) => $.workspace.description_label)}
+ value={description}
+ onChange={(event) => setDescription(event.target.value)}
+ onBlur={detailsAutoSave.flush}
+ rows={3}
+ disabled={!canManageWorkspace}
+ className="resize-none"
+ placeholder={t(($) => $.workspace.description_placeholder)}
+ />
+ )}
</SettingsRow>
<SettingsRow
+ anchor="context"
label={t(($) => $.workspace.context_label)}
- size="text"
+ description={t(($) => $.workspace.context_hint)}
+ size={readOnly ? undefined : "text"}
align="start"
>
- <Textarea
- name="workspace-context"
- autoComplete="off"
- aria-label={t(($) => $.workspace.context_label)}
- value={context}
- onChange={(event) => setContext(event.target.value)}
- onBlur={detailsAutoSave.flush}
- rows={4}
- disabled={!canManageWorkspace}
- className="resize-none"
- placeholder={t(($) => $.workspace.context_placeholder)}
- />
+ {readOnly ? (
+ readOnlyText(workspace.context ?? "")
+ ) : (
+ <Textarea
+ name="workspace-context"
+ autoComplete="off"
+ aria-label={t(($) => $.workspace.context_label)}
+ value={context}
+ onChange={(event) => setContext(event.target.value)}
+ onBlur={detailsAutoSave.flush}
+ rows={4}
+ disabled={!canManageWorkspace}
+ className="resize-y"
+ placeholder={t(($) => $.workspace.context_placeholder)}
+ />
+ )}
</SettingsRow>
<SettingsRow
+ anchor="slug"
label={t(($) => $.workspace.slug_label)}
- size="text"
+ description={t(($) => $.workspace.slug_hint)}
>
- <Input
- type="text"
- name="workspace-slug"
- autoComplete="off"
- spellCheck={false}
- aria-label={t(($) => $.workspace.slug_label)}
- value={workspace.slug}
- readOnly
- className="bg-muted/50 font-mono text-muted-foreground dark:bg-muted/50"
- />
+ <span className="flex items-center gap-1">
+ <code className="font-mono text-label text-foreground">{workspace.slug}</code>
+ <Button
+ variant="ghost"
+ size="icon-xs"
+ aria-label={t(($) => $.workspace.copy_slug)}
+ onClick={async () => {
+ if (!(await copyText(workspace.slug))) {
+ toast.error(t(($) => $.workspace.copy_failed));
+ }
+ }}
+ >
+ <Copy />
+ </Button>
+ </span>
</SettingsRow>
<SettingsRow
+ anchor="issue-prefix"
label={t(($) => $.workspace.issue_prefix_label)}
description={t(($) => $.workspace.issue_prefix_hint, {
- example: `${normalizedPrefix || workspace.issue_prefix}-123`,
+ example: `${workspace.issue_prefix}-123`,
})}
- size="code"
>
- <Input
- type="text"
- name="workspace-issue-prefix"
- autoComplete="off"
- autoCapitalize="characters"
- spellCheck={false}
- aria-label={t(($) => $.workspace.issue_prefix_label)}
- value={issuePrefix}
- onChange={(event) => {
- setPrefixSaveStatus("idle");
- setIssuePrefix(normalizePrefix(event.target.value));
- }}
- onBlur={handlePrefixBlur}
- disabled={!canManageWorkspace}
- maxLength={10}
- aria-invalid={prefixInvalid}
- className="font-mono uppercase"
- placeholder={workspace.issue_prefix}
- />
+ <span className="flex items-center gap-3">
+ <code className="font-mono text-label text-foreground">
+ {workspace.issue_prefix}
+ </code>
+ {canManageWorkspace ? (
+ <Button
+ variant="outline"
+ size="sm"
+ onClick={() => {
+ setPrefixSaveStatus("idle");
+ setPrefixDraft(workspace.issue_prefix);
+ }}
+ >
+ {t(($) => $.workspace.change_prefix)}
+ </Button>
+ ) : null}
+ </span>
</SettingsRow>
-
- {!canManageWorkspace && (
- <div className="px-4 py-3 text-caption text-muted-foreground">
- {t(($) => $.workspace.manage_hint)}
- </div>
- )}
</SettingsCard>
</SettingsSection>
@@ -468,16 +481,10 @@ export function WorkspaceTab() {
Delete button and the sole-owner Leave guidance don't flash in
after mount. */}
{membersFetched && (
- <SettingsSection
- title={
- <span className="inline-flex items-center gap-2">
- <LogOut className="h-4 w-4 text-muted-foreground" />
- {t(($) => $.workspace.danger_zone)}
- </span>
- }
- >
+ <SettingsSection title={t(($) => $.workspace.danger_zone)}>
<SettingsCard>
<SettingsRow
+ anchor="leave"
label={t(($) => $.workspace.leave_title)}
description={
isSoleOwner
@@ -499,6 +506,7 @@ export function WorkspaceTab() {
{isOwner && (
<SettingsRow
+ anchor="delete"
label={
<span className="text-destructive">
{t(($) => $.workspace.delete_title)}
@@ -520,6 +528,86 @@ export function WorkspaceTab() {
</SettingsSection>
)}
+ <Dialog
+ open={prefixDraft !== null}
+ onOpenChange={(open) => {
+ if (!open && prefixSaveStatus !== "saving") setPrefixDraft(null);
+ }}
+ >
+ <DialogContent className="sm:max-w-md">
+ <DialogHeader>
+ <DialogTitle>{t(($) => $.workspace.prefix_dialog_title)}</DialogTitle>
+ <DialogDescription>
+ {t(($) => $.workspace.prefix_dialog_description)}
+ </DialogDescription>
+ </DialogHeader>
+ <form
+ className="space-y-4"
+ onSubmit={(event) => {
+ event.preventDefault();
+ if (prefixInvalid || !prefixChanged) return;
+ void performPrefixSave(normalizedPrefix);
+ }}
+ >
+ <div className="space-y-1.5">
+ <Label htmlFor="workspace-issue-prefix">
+ {t(($) => $.workspace.prefix_new_label)}
+ </Label>
+ <Input
+ id="workspace-issue-prefix"
+ name="workspace-issue-prefix"
+ autoComplete="off"
+ autoCapitalize="characters"
+ spellCheck={false}
+ value={prefixDraft ?? ""}
+ onChange={(event) => setPrefixDraft(normalizePrefix(event.target.value))}
+ maxLength={10}
+ aria-invalid={prefixInvalid}
+ className="font-mono uppercase"
+ autoFocus
+ />
+ <p className="text-caption text-muted-foreground">
+ {t(($) => $.workspace.prefix_rule)}
+ </p>
+ </div>
+ <div className="flex items-center gap-2 rounded-lg border border-surface-border px-3 py-2 font-mono text-label">
+ <span className="text-muted-foreground line-through">
+ {`${workspace.issue_prefix}-123`}
+ </span>
+ <span aria-hidden="true" className="text-muted-foreground">→</span>
+ <span className="font-medium">
+ {`${normalizedPrefix || workspace.issue_prefix}-123`}
+ </span>
+ </div>
+ <p className="text-caption leading-5 text-destructive">
+ {t(($) => $.workspace.prefix_external_warning, {
+ oldExample: `${workspace.issue_prefix}-123`,
+ })}
+ </p>
+ <DialogFooter>
+ <Button
+ type="button"
+ variant="outline"
+ onClick={() => setPrefixDraft(null)}
+ disabled={prefixSaveStatus === "saving"}
+ >
+ {t(($) => $.workspace.confirm_cancel)}
+ </Button>
+ <Button
+ type="submit"
+ variant="destructive"
+ disabled={prefixInvalid || !prefixChanged || prefixSaveStatus === "saving"}
+ aria-busy={prefixSaveStatus === "saving" || undefined}
+ >
+ {t(($) => $.workspace.prefix_confirm_action, {
+ prefix: normalizedPrefix || workspace.issue_prefix,
+ })}
+ </Button>
+ </DialogFooter>
+ </form>
+ </DialogContent>
+ </Dialog>
+
<AlertDialog open={!!confirmAction} onOpenChange={(v) => { if (!v) setConfirmAction(null); }}>
<AlertDialogContent>
<AlertDialogHeader>
diff --git a/packages/views/skills/components/skill-list-toolbar.tsx b/packages/views/skills/components/skill-list-toolbar.tsx
index b2dc589521..07d926a253 100644
--- a/packages/views/skills/components/skill-list-toolbar.tsx
+++ b/packages/views/skills/components/skill-list-toolbar.tsx
@@ -10,6 +10,7 @@ import {
HardDrive,
Pencil,
Search,
+ Tags,
X,
} from "lucide-react";
import { useQuery } from "@tanstack/react-query";
@@ -22,8 +23,10 @@ import {
DropdownMenu,
DropdownMenuCheckboxItem,
DropdownMenuContent,
+ DropdownMenuItem,
DropdownMenuRadioGroup,
DropdownMenuRadioItem,
+ DropdownMenuSeparator,
DropdownMenuSub,
DropdownMenuSubContent,
DropdownMenuSubTrigger,
@@ -51,6 +54,13 @@ import {
type SkillSortField,
} from "@multica/core/skills/stores";
import { LabelChip } from "../../labels/label-chip";
+import { LabelManager } from "../../labels/label-manager";
+import {
+ Dialog,
+ DialogContent,
+ DialogHeader,
+ DialogTitle,
+} from "@multica/ui/components/ui/dialog";
import { useT } from "../../i18n";
import type { SkillRow } from "./skill-list-filter";
import { PAGE_TOOLBAR } from "../../layout/page-header";
@@ -126,6 +136,7 @@ export function SkillListToolbar({
}) {
const { t } = useT("skills");
const [labelSearch, setLabelSearch] = useState("");
+ const [manageLabelsOpen, setManageLabelsOpen] = useState(false);
const wsId = useWorkspaceId();
const { data: catalogLabels = [] } = useQuery(labelListOptions(wsId, "skill"));
@@ -451,6 +462,15 @@ export function SkillListToolbar({
</div>
)}
</div>
+ {/* A shortcut to the skill label catalog, next to the
+ skills it tags; Settings → Labels manages the same list. */}
+ <DropdownMenuSeparator className="my-0" />
+ <div className="p-1">
+ <DropdownMenuItem onClick={() => setManageLabelsOpen(true)}>
+ <Tags />
+ {t(($) => $.toolbar.manage_labels)}
+ </DropdownMenuItem>
+ </div>
</DropdownMenuSubContent>
</DropdownMenuSub>
</DropdownMenuContent>
@@ -567,6 +587,15 @@ export function SkillListToolbar({
</PopoverContent>
</Popover>
</div>
+
+ <Dialog open={manageLabelsOpen} onOpenChange={setManageLabelsOpen}>
+ <DialogContent className="max-h-[85vh] overflow-y-auto sm:max-w-3xl">
+ <DialogHeader>
+ <DialogTitle>{t(($) => $.toolbar.manage_labels_title)}</DialogTitle>
+ </DialogHeader>
+ <LabelManager scope="skill" />
+ </DialogContent>
+ </Dialog>
</div>
);
}
diff --git a/server/internal/handler/workspace_mcp_api.go b/server/internal/handler/workspace_mcp_api.go
index 60088d9f9c..2c6b590249 100644
--- a/server/internal/handler/workspace_mcp_api.go
+++ b/server/internal/handler/workspace_mcp_api.go
@@ -27,8 +27,11 @@ type WorkspaceMcpServerResponse struct {
Name string `json:"name"`
Transport string `json:"transport"`
Enabled *bool `json:"enabled,omitempty"`
- CreatedAt string `json:"created_at"`
- UpdatedAt string `json:"updated_at"`
+ // AgentCount is how many live agents the entry is assigned to. Only the
+ // workspace library listing reports it; per-agent responses omit it.
+ AgentCount *int64 `json:"agent_count,omitempty"`
+ CreatedAt string `json:"created_at"`
+ UpdatedAt string `json:"updated_at"`
}
// mcpTransportOf classifies a server entry for display, and — because the
@@ -98,9 +101,21 @@ func (h *Handler) ListWorkspaceMcpServers(w http.ResponseWriter, r *http.Request
writeError(w, http.StatusInternalServerError, "failed to list workspace MCP servers")
return
}
+ counts, err := h.Queries.CountWorkspaceMcpServerAgents(r.Context(), idUUID)
+ if err != nil {
+ writeError(w, http.StatusInternalServerError, "failed to list workspace MCP servers")
+ return
+ }
+ agentCounts := make(map[string]int64, len(counts))
+ for _, row := range counts {
+ agentCounts[uuidToString(row.ServerID)] = row.AgentCount
+ }
resp := make([]WorkspaceMcpServerResponse, 0, len(servers))
for _, server := range servers {
- resp = append(resp, workspaceMcpServerToResponse(server))
+ item := workspaceMcpServerToResponse(server)
+ count := agentCounts[item.ID]
+ item.AgentCount = &count
+ resp = append(resp, item)
}
writeJSON(w, http.StatusOK, resp)
}
diff --git a/server/internal/handler/workspace_mcp_api_test.go b/server/internal/handler/workspace_mcp_api_test.go
index 32740e973a..684655968c 100644
--- a/server/internal/handler/workspace_mcp_api_test.go
+++ b/server/internal/handler/workspace_mcp_api_test.go
@@ -95,6 +95,44 @@ func TestListWorkspaceMcpServers_NeverEchoesSecrets(t *testing.T) {
}
}
+// The library listing reports how many live agents use each entry, so the
+// settings page can show whether removing one affects anybody. Archived
+// agents never receive a server and must not inflate the count.
+func TestListWorkspaceMcpServers_ReportsLiveAgentCount(t *testing.T) {
+ if testHandler == nil {
+ t.Skip("database not available")
+ }
+ usedID := createWorkspaceMcpServerForTest(t, "sentry", workspaceMcpTestEntry)
+ unusedID := createWorkspaceMcpServerForTest(t, "figma", workspaceMcpTestEntry)
+ for _, name := range []string{"ws-mcp-count-a", "ws-mcp-count-b"} {
+ addAgentMcpServerForTest(t, createHandlerTestAgent(t, name, nil), usedID)
+ }
+ archivedID := createHandlerTestAgent(t, "ws-mcp-count-archived", nil)
+ addAgentMcpServerForTest(t, archivedID, usedID)
+ if _, err := testPool.Exec(context.Background(),
+ `UPDATE agent SET archived_at = now() WHERE id = $1`, archivedID); err != nil {
+ t.Fatalf("archive agent: %v", err)
+ }
+
+ code, resp, raw := listWorkspaceMcpServersForTest(t, nil)
+ if code != http.StatusOK {
+ t.Fatalf("expected 200, got %d: %s", code, raw)
+ }
+ counts := map[string]int64{}
+ for _, server := range resp {
+ if server.AgentCount == nil {
+ t.Fatalf("library listing must report agent_count for %q: %s", server.Name, raw)
+ }
+ counts[server.ID] = *server.AgentCount
+ }
+ if counts[usedID] != 2 {
+ t.Errorf("agent_count for the assigned server = %d, want 2", counts[usedID])
+ }
+ if got, ok := counts[unusedID]; !ok || got != 0 {
+ t.Errorf("agent_count for the unassigned server = %d (present=%v), want 0", got, ok)
+ }
+}
+
func createWorkspaceMcpServerViaAPI(t *testing.T, body any, mutate func(*http.Request)) (int, WorkspaceMcpServerResponse, string) {
t.Helper()
diff --git a/server/pkg/db/generated/workspace_mcp.sql.go b/server/pkg/db/generated/workspace_mcp.sql.go
index 4d1383e44d..8cfd3cf399 100644
--- a/server/pkg/db/generated/workspace_mcp.sql.go
+++ b/server/pkg/db/generated/workspace_mcp.sql.go
@@ -27,6 +27,43 @@ func (q *Queries) AddAgentMcpServer(ctx context.Context, arg AddAgentMcpServerPa
return err
}
+const countWorkspaceMcpServerAgents = `-- name: CountWorkspaceMcpServerAgents :many
+SELECT ams.server_id, COUNT(*)::bigint AS agent_count
+FROM agent_mcp_server ams
+JOIN workspace_mcp_server s ON s.id = ams.server_id
+JOIN agent a ON a.id = ams.agent_id
+WHERE s.workspace_id = $1 AND a.archived_at IS NULL
+GROUP BY ams.server_id
+`
+
+type CountWorkspaceMcpServerAgentsRow struct {
+ ServerID pgtype.UUID `json:"server_id"`
+ AgentCount int64 `json:"agent_count"`
+}
+
+// How many live agents each library entry is assigned to, for the workspace
+// settings list. Archived agents never receive the server, so they are not
+// counted; servers with no assignment are simply absent from the result.
+func (q *Queries) CountWorkspaceMcpServerAgents(ctx context.Context, workspaceID pgtype.UUID) ([]CountWorkspaceMcpServerAgentsRow, error) {
+ rows, err := q.db.Query(ctx, countWorkspaceMcpServerAgents, workspaceID)
+ if err != nil {
+ return nil, err
+ }
+ defer rows.Close()
+ items := []CountWorkspaceMcpServerAgentsRow{}
+ for rows.Next() {
+ var i CountWorkspaceMcpServerAgentsRow
+ if err := rows.Scan(&i.ServerID, &i.AgentCount); err != nil {
+ return nil, err
+ }
+ items = append(items, i)
+ }
+ if err := rows.Err(); err != nil {
+ return nil, err
+ }
+ return items, nil
+}
+
const createWorkspaceMcpServer = `-- name: CreateWorkspaceMcpServer :one
INSERT INTO workspace_mcp_server (workspace_id, name, config, created_by)
VALUES ($1, $2, $3, $4)
diff --git a/server/pkg/db/queries/workspace_mcp.sql b/server/pkg/db/queries/workspace_mcp.sql
index e5d8813efa..37b8bec9a2 100644
--- a/server/pkg/db/queries/workspace_mcp.sql
+++ b/server/pkg/db/queries/workspace_mcp.sql
@@ -6,6 +6,17 @@ SELECT * FROM workspace_mcp_server
WHERE workspace_id = $1
ORDER BY name ASC;
+-- name: CountWorkspaceMcpServerAgents :many
+-- How many live agents each library entry is assigned to, for the workspace
+-- settings list. Archived agents never receive the server, so they are not
+-- counted; servers with no assignment are simply absent from the result.
+SELECT ams.server_id, COUNT(*)::bigint AS agent_count
+FROM agent_mcp_server ams
+JOIN workspace_mcp_server s ON s.id = ams.server_id
+JOIN agent a ON a.id = ams.agent_id
+WHERE s.workspace_id = $1 AND a.archived_at IS NULL
+GROUP BY ams.server_id;
+
-- name: LockWorkspaceMcpServerForShare :one
-- Taken by the assignment writer before it inserts. A shared row lock
-- conflicts with the exclusive lock DeleteWorkspaceMcpServer takes, so an