Skip to content

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

Go

feat(projects): archive and restore projects (MUL-8861) (#10620)

Jiayuan Zhang095c79f2c7ae
diff --git a/CLI_AND_DAEMON.md b/CLI_AND_DAEMON.md
index 323a5b2b25..bb97d68f8c 100644
--- a/CLI_AND_DAEMON.md
+++ b/CLI_AND_DAEMON.md
@@ -968,9 +968,10 @@ belongs to a workspace and can optionally have a lead (member or agent).
multica project list
multica project list --status in_progress
multica project list --output json
+multica project list --archived
```
-Available filters: `--status`.
+Available filters: `--status`, `--archived` (only archived projects; they are hidden by default).
### Get Project
@@ -1005,6 +1006,18 @@ multica project status <id> in_progress
Valid statuses: `planned`, `in_progress`, `paused`, `completed`, `cancelled`.
+### Archive and Restore
+
+```bash
+multica project archive <id>
+multica project restore <id>
+```
+
+Archiving hides a project from lists and pickers and stops new issues from being
+filed into it (HTTP 409 `project_archived`); existing issues stay editable.
+Active autopilots that file into the project are paused, and restoring does not
+resume them. Archiving is independent of status.
+
### Delete Project
```bash
diff --git a/apps/docs/content/docs/cli.fr.mdx b/apps/docs/content/docs/cli.fr.mdx
index 5f5448ec73..0b2426c0c5 100644
--- a/apps/docs/content/docs/cli.fr.mdx
+++ b/apps/docs/content/docs/cli.fr.mdx
@@ -416,6 +416,7 @@ Les tableaux ci-dessous couvrent toutes les commandes de premier niveau actuelle
| | `cancel-task <task-id>` | Annuler une exécution en cours ou en file d'attente | `--issue` |
| `project` | `list/get/create/update/delete` | Gérer les projets | `create` : `--title` (obligatoire), `--lead`, `--status`, `--icon`, `--start-date`, `--due-date`, `--repo` (répétable) |
| | `status <id> <status>` | Changer le statut d'un projet | |
+| | `archive/restore <id>` | Archiver ou restaurer un projet. Un projet archivé est masqué de `list`, n'accepte plus de nouvelles tâches et met en pause les automatisations qui y créent des tâches | `list --archived` liste uniquement les projets archivés |
| | `resource list/add/update/remove` | Gérer les ressources d'un projet | `--type`, `--url`, `--default-branch-hint`, `--ref`, `--local-path`, `--daemon-id`, `--execution-mode` (`in_place` / `worktree` pour un répertoire local) |
| `label` | `list/get/create/update/delete` | Gérer les étiquettes de l'espace de travail | `list` : `--resource-type` (`issue` ou `skill`), `--full-id` ; `create` : `--name`, `--color`, `--resource-type` (`issue` ou `skill`), `--description` |
| `property` | `list/get/create/update/archive/unarchive` | Gérer les propriétés personnalisées de l'espace de travail | `create` : `--name`, `--type` (`text`, `number`, `select`, `multi_select`, `date`, `checkbox`, `url`, `actor`, `multi_actor`), `--option` (répétable, types select uniquement) ; `list` : `--include-archived` ; le type ne peut plus être modifié après la création |
diff --git a/apps/docs/content/docs/cli.ja.mdx b/apps/docs/content/docs/cli.ja.mdx
index a100ab0584..11e14f8edf 100644
--- a/apps/docs/content/docs/cli.ja.mdx
+++ b/apps/docs/content/docs/cli.ja.mdx
@@ -408,6 +408,7 @@ CLI の設定ファイルには、あなたとして Multica にアクセスで
| | `cancel-task <task-id>` | 進行中またはキュー中の実行をキャンセル | `--issue` |
| `project` | `list/get/create/update/delete` | プロジェクトを管理 | `create`: `--title`(必須)、`--lead`、`--status`、`--icon`、`--start-date`、`--due-date`、`--repo`(繰り返し可) |
| | `status <id> <status>` | プロジェクトのステータスを変更 | |
+| | `archive/restore <id>` | プロジェクトをアーカイブ/復元。アーカイブ済みのプロジェクトは `list` に表示されず、新しいタスクを受け付けず、そこにタスクを作成する自動化は一時停止される | `list --archived` でアーカイブ済みのプロジェクトのみを表示 |
| | `resource list/add/update/remove` | プロジェクトの追加リソースを管理 | `--type`、`--url`、`--default-branch-hint`、`--ref`、`--local-path`、`--daemon-id`、`--execution-mode`(ローカルディレクトリの `in_place` / `worktree`) |
| `label` | `list/get/create/update/delete` | ワークスペースのラベルを管理 | `list`: `--resource-type`(`issue` または `skill`)、`--full-id`;`create`: `--name`、`--color`、`--resource-type`(`issue` または `skill`)、`--description` |
| `property` | `list/get/create/update/archive/unarchive` | ワークスペースのカスタムプロパティを管理 | `create`: `--name`、`--type`(`text`、`number`、`select`、`multi_select`、`date`、`checkbox`、`url`、`actor`、`multi_actor`、`multi_text`、`multi_url`)、`--option`(繰り返し可、select 系のみ);`list`: `--include-archived`;タイプは作成後に変更できません |
diff --git a/apps/docs/content/docs/cli.ko.mdx b/apps/docs/content/docs/cli.ko.mdx
index 910d4bedf9..9162317e9f 100644
--- a/apps/docs/content/docs/cli.ko.mdx
+++ b/apps/docs/content/docs/cli.ko.mdx
@@ -408,6 +408,7 @@ CLI 설정 파일에는 사용자를 대신해 Multica에 접근할 수 있는 t
| | `cancel-task <task-id>` | 진행 중 또는 큐 대기 중인 실행 취소 | `--issue` |
| `project` | `list/get/create/update/delete` | 프로젝트 관리 | `create`: `--title`(필수), `--lead`, `--status`, `--icon`, `--start-date`, `--due-date`, `--repo`(반복 가능) |
| | `status <id> <status>` | 프로젝트 상태 변경 | |
+| | `archive/restore <id>` | 프로젝트 보관/복원. 보관된 프로젝트는 `list`에 표시되지 않고 새 태스크를 받지 않으며, 그 프로젝트에 태스크를 만드는 자동화는 일시 중지됨 | `list --archived`는 보관된 프로젝트만 표시 |
| | `resource list/add/update/remove` | 프로젝트 추가 리소스 관리 | `--type`, `--url`, `--default-branch-hint`, `--ref`, `--local-path`, `--daemon-id`, `--execution-mode`(로컬 디렉터리의 `in_place` / `worktree`) |
| `label` | `list/get/create/update/delete` | 워크스페이스 라벨 관리 | `list`: `--resource-type`(`issue` 또는 `skill`), `--full-id`; `create`: `--name`, `--color`, `--resource-type`(`issue` 또는 `skill`), `--description` |
| `property` | `list/get/create/update/archive/unarchive` | 워크스페이스 사용자 지정 속성 관리 | `create`: `--name`, `--type`(`text`, `number`, `select`, `multi_select`, `date`, `checkbox`, `url`, `actor`, `multi_actor`, `multi_text`, `multi_url`), `--option`(반복 가능, select 유형만). `list`: `--include-archived`. 유형은 생성 후 변경 불가 |
diff --git a/apps/docs/content/docs/cli.mdx b/apps/docs/content/docs/cli.mdx
index 8d99df71ef..506a17982b 100644
--- a/apps/docs/content/docs/cli.mdx
+++ b/apps/docs/content/docs/cli.mdx
@@ -439,6 +439,7 @@ Migration from CSV parsing: replace `--attachment a,b` with `--attachment a --at
| | `cancel-task <task-id>` | Cancel a running or queued run | `--issue` |
| `project` | `list/get/create/update/delete` | Manage projects | `create`: `--title` (required), `--lead`, `--status`, `--icon`, `--start-date`, `--due-date`, `--repo` (repeatable) |
| | `status <id> <status>` | Change project status | |
+| | `archive/restore <id>` | Archive or restore a project. Archived projects are hidden from `list`, accept no new issues, and pause the autopilots that file into them | `list --archived` lists only archived projects |
| | `resource list/add/update/remove` | Manage project resources | `--type`, `--url`, `--default-branch-hint`, `--ref`, `--local-path`, `--daemon-id`, `--execution-mode` (`in_place` / `worktree` for a local directory) |
| | `workflow get/set <project-id>` | Show the project's effective workflow, or switch it | `set <project-id> <workflow\|default>`: `--map old=new` (repeatable), `--dry-run` prints the status migration plan; the switch neither reassigns issues nor starts runs. Admins and the project lead only |
| `workflow` | `list/get/create/update/delete` | Manage workflows; `get` and other commands accept an ID, ID prefix, exact name, or `default`. Statuses a workflow declares are workspace catalog entries, edited with `issue-status` | `create` / `update`: `--name`, `--description`, `--steps-file` (JSON array of steps; replaces all steps); `update`: `--map old=new` (repeatable), `--dry-run`. Edits and deletes are limited to the workflow owner and workspace admins; a workflow still used by a project cannot be deleted |
diff --git a/apps/docs/content/docs/cli.zh-Hant.mdx b/apps/docs/content/docs/cli.zh-Hant.mdx
index 731b7889ad..36da758f83 100644
--- a/apps/docs/content/docs/cli.zh-Hant.mdx
+++ b/apps/docs/content/docs/cli.zh-Hant.mdx
@@ -413,6 +413,7 @@ CLI 配置檔案包含可代表你訪問 Multica 的令牌。不要提交到倉
| | `cancel-task <task-id>` | 取消進行中或排隊中的執行 | `--issue` |
| `project` | `list/get/create/update/delete` | 管理專案 | `create`:`--title`(必填)、`--lead`、`--status`、`--icon`、`--start-date`、`--due-date`、`--repo`(可重複) |
| | `status <id> <status>` | 修改專案狀態 | |
+| | `archive/restore <id>` | 歸檔或恢復專案。已歸檔的專案不出現在 `list` 中、不再接受新任務,向它建立任務的自動化會被暫停 | `list --archived` 只列出已歸檔的專案 |
| | `resource list/add/update/remove` | 管理專案附加資源 | `--type`、`--url`、`--default-branch-hint`、`--ref`、`--local-path`、`--daemon-id`、`--execution-mode`(本地目錄的 `in_place` / `worktree`) |
| | `workflow get/set <project-id>` | 檢視專案當前生效的工作流,或切換工作流 | `set <project-id> <workflow\|default>`:`--map old=new`(可重複),`--dry-run` 列印狀態遷移計劃;切換不會重新分配任務,也不會啟動執行。僅管理員和專案負責人可操作 |
| `workflow` | `list/get/create/update/delete` | 管理工作流;`get` 等命令接受 ID、ID 字首、完整名稱或 `default`。工作流宣告的狀態屬於工作區狀態目錄,用 `issue-status` 修改 | `create` / `update`:`--name`、`--description`、`--steps-file`(步驟的 JSON 陣列,整體替換);`update`:`--map old=new`(可重複)、`--dry-run`。編輯和刪除僅限工作流所有者和工作區管理員;仍被專案使用的工作流不能刪除 |
diff --git a/apps/docs/content/docs/cli.zh.mdx b/apps/docs/content/docs/cli.zh.mdx
index 085d9c24ee..cbc47cc1fe 100644
--- a/apps/docs/content/docs/cli.zh.mdx
+++ b/apps/docs/content/docs/cli.zh.mdx
@@ -416,6 +416,7 @@ CLI 配置文件包含可代表你访问 Multica 的令牌。不要提交到仓
| | `cancel-task <task-id>` | 取消进行中或排队中的运行 | `--issue` |
| `project` | `list/get/create/update/delete` | 管理项目 | `create`:`--title`(必填)、`--lead`、`--status`、`--icon`、`--start-date`、`--due-date`、`--repo`(可重复) |
| | `status <id> <status>` | 修改项目状态 | |
+| | `archive/restore <id>` | 归档或恢复项目。已归档的项目不出现在 `list` 中、不再接受新任务,向它创建任务的自动化会被暂停 | `list --archived` 只列出已归档的项目 |
| | `resource list/add/update/remove` | 管理项目附加资源 | `--type`、`--url`、`--default-branch-hint`、`--ref`、`--local-path`、`--daemon-id`、`--execution-mode`(本地目录的 `in_place` / `worktree`) |
| | `workflow get/set <project-id>` | 查看项目当前生效的工作流,或切换工作流 | `set <project-id> <workflow\|default>`:`--map old=new`(可重复),`--dry-run` 打印状态迁移计划;切换不会重新分配任务,也不会启动运行。仅管理员和项目负责人可操作 |
| `workflow` | `list/get/create/update/delete` | 管理工作流;`get` 等命令接受 ID、ID 前缀、完整名称或 `default`。工作流声明的状态属于工作区状态目录,用 `issue-status` 修改 | `create` / `update`:`--name`、`--description`、`--steps-file`(步骤的 JSON 数组,整体替换);`update`:`--map old=new`(可重复)、`--dry-run`。编辑和删除仅限工作流所有者和工作区管理员;仍被项目使用的工作流不能删除 |
diff --git a/apps/mobile/app/(app)/[workspace]/more/projects.tsx b/apps/mobile/app/(app)/[workspace]/more/projects.tsx
index 940782c5e2..c4bbf2dc53 100644
--- a/apps/mobile/app/(app)/[workspace]/more/projects.tsx
+++ b/apps/mobile/app/(app)/[workspace]/more/projects.tsx
@@ -41,7 +41,7 @@ export default function ProjectsPage() {
const sorted = useMemo(() => {
if (!data) return [];
- return [...data].sort(
+ return data.filter((p) => !p.archived_at).sort(
(a, b) =>
new Date(b.updated_at).getTime() - new Date(a.updated_at).getTime(),
);
diff --git a/apps/mobile/components/issue/pickers/project-picker-body.tsx b/apps/mobile/components/issue/pickers/project-picker-body.tsx
index cc4c8e2a9f..4d75ab8ee8 100644
--- a/apps/mobile/components/issue/pickers/project-picker-body.tsx
+++ b/apps/mobile/components/issue/pickers/project-picker-body.tsx
@@ -42,6 +42,7 @@ export function ProjectPickerBody({ value, query, onChange }: Props) {
const q = query.trim().toLowerCase();
const matchName = (n: string) => !q || n.toLowerCase().includes(q);
const projectRows: Row[] = [...projects]
+ .filter((p) => !p.archived_at || p.id === value?.id)
.filter((p) => matchName(p.title))
.sort((a, b) => a.title.localeCompare(b.title))
.map((p) => ({ kind: "project" as const, project: p }));
diff --git a/apps/mobile/data/api.ts b/apps/mobile/data/api.ts
index 64aa3941a2..2402be427b 100644
--- a/apps/mobile/data/api.ts
+++ b/apps/mobile/data/api.ts
@@ -987,8 +987,12 @@ class ApiClient {
// --- Projects ---
async listProjects(opts?: {
signal?: AbortSignal;
+ includeArchived?: boolean;
}): Promise<ListProjectsResponse> {
- const raw = await this.fetch<unknown>("/api/projects", {
+ const path = opts?.includeArchived
+ ? "/api/projects?include_archived=true"
+ : "/api/projects";
+ const raw = await this.fetch<unknown>(path, {
signal: opts?.signal,
});
return parseWithFallback(
diff --git a/apps/mobile/data/queries/projects.ts b/apps/mobile/data/queries/projects.ts
index f18d143024..d53e1d7366 100644
--- a/apps/mobile/data/queries/projects.ts
+++ b/apps/mobile/data/queries/projects.ts
@@ -30,8 +30,10 @@ export const projectKeys = {
export const projectListOptions = (wsId: string | null) =>
queryOptions({
queryKey: projectKeys.list(wsId),
+ // Includes archived projects: the list doubles as the lookup map for an
+ // issue's project. Browse and picker screens filter them out themselves.
queryFn: async ({ signal }) => {
- const res = await api.listProjects({ signal });
+ const res = await api.listProjects({ signal, includeArchived: true });
return res.projects;
},
enabled: !!wsId,
diff --git a/packages/core/api/client.ts b/packages/core/api/client.ts
index a7e750e6a8..916d381196 100644
--- a/packages/core/api/client.ts
+++ b/packages/core/api/client.ts
@@ -112,6 +112,7 @@ import type {
StartMikaOnboardingResponse,
CancelTaskResponse,
Project,
+ ArchiveProjectResponse,
CreateProjectRequest,
UpdateProjectRequest,
ListProjectsResponse,
@@ -378,6 +379,7 @@ import {
RuntimeUsageListSchema,
SearchIssuesResponseSchema,
ProjectSchema,
+ ArchiveProjectResponseSchema,
ListProjectMembersResponseSchema,
ProjectSubscriptionSchema,
ListProjectsResponseSchema,
@@ -1414,11 +1416,12 @@ export class ApiClient {
});
}
- async searchProjects(params: { q: string; limit?: number; offset?: number; include_closed?: boolean; signal?: AbortSignal }): Promise<SearchProjectsResponse> {
+ async searchProjects(params: { q: string; limit?: number; offset?: number; include_closed?: boolean; include_archived?: boolean; signal?: AbortSignal }): Promise<SearchProjectsResponse> {
const search = new URLSearchParams({ q: params.q });
if (params.limit !== undefined) search.set("limit", String(params.limit));
if (params.offset !== undefined) search.set("offset", String(params.offset));
if (params.include_closed) search.set("include_closed", "true");
+ if (params.include_archived) search.set("include_archived", "true");
const raw = await this.fetch<unknown>(
`/api/projects/search?${search}`,
params.signal ? { signal: params.signal } : undefined,
@@ -4406,9 +4409,10 @@ export class ApiClient {
}
// Projects
- async listProjects(params?: { status?: string }): Promise<ListProjectsResponse> {
+ async listProjects(params?: { status?: string; include_archived?: boolean }): Promise<ListProjectsResponse> {
const search = new URLSearchParams();
if (params?.status) search.set("status", params.status);
+ if (params?.include_archived) search.set("include_archived", "true");
const raw = await this.fetch<unknown>(`/api/projects?${search}`);
return parseWithFallback(raw, ListProjectsResponseSchema, EMPTY_LIST_PROJECTS_RESPONSE, {
endpoint: "GET /api/projects",
@@ -4440,6 +4444,18 @@ export class ApiClient {
await this.fetch(`/api/projects/${id}`, { method: "DELETE" });
}
+ async archiveProject(id: string): Promise<ArchiveProjectResponse> {
+ const raw = await this.fetch<unknown>(`/api/projects/${id}/archive`, { method: "POST" });
+ return parseWithFallback(raw, ArchiveProjectResponseSchema, { ...EMPTY_PROJECT, paused_autopilot_ids: [] }, {
+ endpoint: "POST /api/projects/:id/archive",
+ });
+ }
+
+ async restoreProject(id: string): Promise<Project> {
+ const raw = await this.fetch<unknown>(`/api/projects/${id}/restore`, { method: "POST" });
+ return parseWithFallback(raw, ProjectSchema, EMPTY_PROJECT, { endpoint: "POST /api/projects/:id/restore" });
+ }
+
async getProjectMembers(id: string): Promise<ListProjectMembersResponse> {
const raw = await this.fetch<unknown>(`/api/projects/${id}/members`);
return parseWithFallback(raw, ListProjectMembersResponseSchema, { members: [], total: 0 }, {
diff --git a/packages/core/api/schemas.ts b/packages/core/api/schemas.ts
index 81ce8287fe..71f9fda2f7 100644
--- a/packages/core/api/schemas.ts
+++ b/packages/core/api/schemas.ts
@@ -1810,8 +1810,15 @@ export const ProjectSchema = z.object({
done_count: z.number().default(0),
resource_count: z.number().default(0),
workflow_id: z.string().nullable().default(null),
+ archived_at: z.string().nullable().default(null).catch(null),
+ archived_by_type: z.enum(["member", "agent"]).nullable().default(null).catch(null),
+ archived_by_id: z.string().nullable().default(null).catch(null),
}).loose();
+export const ArchiveProjectResponseSchema = ProjectSchema.extend({
+ paused_autopilot_ids: z.array(z.string()).default([]).catch([]),
+});
+
export const EMPTY_PROJECT: Project = {
id: "", workspace_id: "", title: "", description: null, icon: null,
status: "planned", priority: "none", lead_type: null, lead_id: null,
diff --git a/packages/core/issues/sidebar-list.ts b/packages/core/issues/sidebar-list.ts
index f0ecf4c03f..9abaf28982 100644
--- a/packages/core/issues/sidebar-list.ts
+++ b/packages/core/issues/sidebar-list.ts
@@ -211,7 +211,9 @@ export function builtinSidebarRequest(
}
/** The projects the sidebar lists, filtered and ordered by its settings. */
-export function sidebarProjects<P extends Pick<Project, "id" | "title" | "status" | "lead_type" | "lead_id" | "created_at" | "updated_at">>(
+export function sidebarProjects<
+ P extends Pick<Project, "id" | "title" | "status" | "lead_type" | "lead_id" | "created_at" | "updated_at" | "archived_at">,
+>(
projects: readonly P[],
settings: SidebarProjectSettings,
manualOrder: readonly string[],
@@ -220,6 +222,7 @@ export function sidebarProjects<P extends Pick<Project, "id" | "title" | "status
const statuses = new Set<string>(settings.statuses);
const shown = projects.filter(
(p) =>
+ !p.archived_at &&
statuses.has(p.status) &&
(!settings.onlyMine || (p.lead_type === "member" && !!userId && p.lead_id === userId)),
);
diff --git a/packages/core/projects/archive.test.ts b/packages/core/projects/archive.test.ts
new file mode 100644
index 0000000000..74773b3770
--- /dev/null
+++ b/packages/core/projects/archive.test.ts
@@ -0,0 +1,17 @@
+import { describe, expect, it } from "vitest";
+import { isProjectArchived, selectableProjects } from "./archive";
+
+describe("selectableProjects", () => {
+ const live = { id: "live", archived_at: null };
+ const archived = { id: "archived", archived_at: "2026-01-01T00:00:00Z" };
+
+ it("drops archived projects", () => {
+ expect(selectableProjects([live, archived])).toEqual([live]);
+ expect(isProjectArchived(archived)).toBe(true);
+ expect(isProjectArchived(live)).toBe(false);
+ });
+
+ it("keeps the archived project that is already selected", () => {
+ expect(selectableProjects([live, archived], "archived")).toEqual([live, archived]);
+ });
+});
diff --git a/packages/core/projects/archive.ts b/packages/core/projects/archive.ts
new file mode 100644
index 0000000000..7b369e8792
--- /dev/null
+++ b/packages/core/projects/archive.ts
@@ -0,0 +1,18 @@
+import type { Project } from "../types";
+
+/** An archived project stays readable but is no longer offered as a choice. */
+export function isProjectArchived(project: Pick<Project, "archived_at"> | null | undefined): boolean {
+ return !!project?.archived_at;
+}
+
+/**
+ * The projects a picker should offer: everything not archived, plus the
+ * currently selected one so an issue already in an archived project still
+ * shows its value.
+ */
+export function selectableProjects<T extends Pick<Project, "id" | "archived_at">>(
+ projects: readonly T[],
+ selectedId?: string | null,
+): T[] {
+ return projects.filter((p) => !isProjectArchived(p) || p.id === selectedId);
+}
diff --git a/packages/core/projects/index.ts b/packages/core/projects/index.ts
index 00ef14c76e..c89d2032af 100644
--- a/packages/core/projects/index.ts
+++ b/packages/core/projects/index.ts
@@ -1,6 +1,15 @@
export { canDeleteProject } from "./deletion-permissions";
export { projectKeys, projectListOptions, projectDetailOptions, projectSubscriptionOptions } from "./queries";
-export { useCreateProject, useUpdateProject, useDeleteProject, useSetProjectSubscription, ProjectDeletionOfflineError } from "./mutations";
+export {
+ useCreateProject,
+ useUpdateProject,
+ useDeleteProject,
+ useArchiveProject,
+ useRestoreProject,
+ useSetProjectSubscription,
+ ProjectDeletionOfflineError,
+} from "./mutations";
+export { isProjectArchived, selectableProjects } from "./archive";
export { useProjectDraftStore } from "./draft-store";
export {
useProjectViewStore,
diff --git a/packages/core/projects/mutations.ts b/packages/core/projects/mutations.ts
index 4dfe26fb3e..f253a6f3b6 100644
--- a/packages/core/projects/mutations.ts
+++ b/packages/core/projects/mutations.ts
@@ -2,6 +2,7 @@ import { onlineManager, useMutation, useQueryClient } from "@tanstack/react-quer
import { api } from "../api";
import { projectKeys } from "./queries";
import { issueKeys } from "../issues/queries";
+import { autopilotKeys } from "../autopilots/queries";
import { useWorkspaceId } from "../hooks";
import { useRecentContextStore } from "../chat/recent-context-store";
import { clearIssueSurfaceViewState } from "../issues/stores/surface-view-store";
@@ -103,6 +104,49 @@ export function useDeleteProject() {
});
}
+function useWriteProjectToCache() {
+ const qc = useQueryClient();
+ const wsId = useWorkspaceId();
+ return (project: Project) => {
+ qc.setQueryData<ListProjectsResponse>(projectKeys.list(wsId), (old) =>
+ old ? { ...old, projects: old.projects.map((p) => (p.id === project.id ? { ...p, ...project } : p)) } : old,
+ );
+ qc.setQueryData<Project>(projectKeys.detail(wsId, project.id), (old) =>
+ old ? { ...old, ...project } : project,
+ );
+ };
+}
+
+export function useArchiveProject() {
+ const qc = useQueryClient();
+ const wsId = useWorkspaceId();
+ const writeProject = useWriteProjectToCache();
+ return useMutation({
+ mutationFn: (id: string) => api.archiveProject(id),
+ onSuccess: ({ paused_autopilot_ids: _paused, ...project }) => writeProject(project),
+ onSettled: (_data, _err, id) => {
+ qc.invalidateQueries({ queryKey: projectKeys.detail(wsId, id) });
+ qc.invalidateQueries({ queryKey: projectKeys.list(wsId) });
+ // Archiving pauses the autopilots that file into the project.
+ qc.invalidateQueries({ queryKey: autopilotKeys.all(wsId) });
+ },
+ });
+}
+
+export function useRestoreProject() {
+ const qc = useQueryClient();
+ const wsId = useWorkspaceId();
+ const writeProject = useWriteProjectToCache();
+ return useMutation({
+ mutationFn: (id: string) => api.restoreProject(id),
+ onSuccess: (project) => writeProject(project),
+ onSettled: (_data, _err, id) => {
+ qc.invalidateQueries({ queryKey: projectKeys.detail(wsId, id) });
+ qc.invalidateQueries({ queryKey: projectKeys.list(wsId) });
+ },
+ });
+}
+
export function useSetProjectSubscription() {
const qc = useQueryClient();
const wsId = useWorkspaceId();
diff --git a/packages/core/projects/queries.ts b/packages/core/projects/queries.ts
index b8d4820e25..bd74a336ca 100644
--- a/packages/core/projects/queries.ts
+++ b/packages/core/projects/queries.ts
@@ -11,10 +11,14 @@ export const projectKeys = {
[...projectKeys.detail(wsId, id), "subscription"] as const,
};
+// The cached list includes archived projects: it doubles as the id → project
+// lookup for every issue row, breadcrumb and filter chip, and an issue in an
+// archived project still needs its project's name. Surfaces that offer a
+// project as a choice filter archived ones out (see isProjectArchived).
export function projectListOptions(wsId: string) {
return queryOptions({
queryKey: projectKeys.list(wsId),
- queryFn: () => api.listProjects(),
+ queryFn: () => api.listProjects({ include_archived: true }),
select: (data) => data.projects,
});
}
diff --git a/packages/core/search-index/client.ts b/packages/core/search-index/client.ts
index 15449b401e..26e4baef09 100644
--- a/packages/core/search-index/client.ts
+++ b/packages/core/search-index/client.ts
@@ -167,8 +167,8 @@ export class LocalSearchIndexClient {
if (result === null) this.serving = false;
resolve(result);
});
- const { q, limit, offset, include_closed } = params;
- channel.post({ type: "search", id, kind, params: { q, limit, offset, include_closed } });
+ const { q, limit, offset, include_closed, include_archived } = params;
+ channel.post({ type: "search", id, kind, params: { q, limit, offset, include_closed, include_archived } });
});
}
diff --git a/packages/core/search-index/engine.test.ts b/packages/core/search-index/engine.test.ts
index e989470841..c646b26dfe 100644
--- a/packages/core/search-index/engine.test.ts
+++ b/packages/core/search-index/engine.test.ts
@@ -345,6 +345,23 @@ describe("SearchIndexEngine.searchProjects", () => {
expect(row.matched_snippet).toBe("covers the roadmap");
expect(row).not.toHaveProperty("search_updated_at");
});
+
+ it("leaves archived projects out unless asked, then ranks them last", () => {
+ const live = project({ title: "Billing revamp" });
+ const cancelled = project({ title: "Billing v1", status: "cancelled" });
+ const archived = project({ title: "Billing pilot", archived_at: "2026-02-01T00:00:00Z" });
+ const exactArchived = project({ title: "Billing", archived_at: "2026-02-01T00:00:00Z" });
+ const engine = new SearchIndexEngine();
+ [archived, exactArchived, cancelled, live].forEach((p) => engine.upsertProject(p));
+
+ expect(engine.searchProjects({ q: "billing", include_closed: true }).map((h) => h.id)).toEqual([
+ live.id,
+ cancelled.id,
+ ]);
+ expect(
+ engine.searchProjects({ q: "billing", include_closed: true, include_archived: true }).map((h) => h.id),
+ ).toEqual([exactArchived.id, live.id, cancelled.id, archived.id]);
+ });
});
describe("timestampMicros", () => {
diff --git a/packages/core/search-index/engine.ts b/packages/core/search-index/engine.ts
index 5aedf5b143..44ac6c3678 100644
--- a/packages/core/search-index/engine.ts
+++ b/packages/core/search-index/engine.ts
@@ -28,6 +28,8 @@ export interface IssueSearchParams {
limit?: number;
offset?: number;
include_closed?: boolean;
+ /** Projects only: archived projects are left out unless asked for. */
+ include_archived?: boolean;
}
export type ProjectSearchParams = IssueSearchParams;
@@ -66,6 +68,7 @@ interface CommentEntry {
interface ProjectEntry {
id: string;
status: string;
+ archived: boolean;
title: string;
description: string;
updatedAt: number;
@@ -209,6 +212,7 @@ export class SearchIndexEngine {
const entry: ProjectEntry = {
id: project.id,
status: project.status,
+ archived: !!project.archived_at,
title: project.title.toLowerCase(),
description: description.toLowerCase(),
updatedAt: timestampMicros(project.search_updated_at || project.updated_at),
@@ -394,6 +398,7 @@ export class SearchIndexEngine {
const candidates: Candidate[] = [];
for (const project of this.projects.values()) {
if (!params.include_closed && (project.status === "completed" || project.status === "cancelled")) continue;
+ if (!params.include_archived && project.archived) continue;
const { title, description } = project;
const titlePhrase = title.includes(phrase);
const titleAllTerms = multi && terms.every((term) => title.includes(term));
@@ -414,7 +419,8 @@ export class SearchIndexEngine {
candidates.push({
hit: { id: project.id, matchSource: titlePhrase || titleAllTerms ? "title" : "description" },
- cancelledRank: project.status === "cancelled" && !titleExact ? 1 : 0,
+ // Mirrors the server: archived sinks below cancelled, exact titles excepted.
+ cancelledRank: titleExact ? 0 : project.archived ? 2 : project.status === "cancelled" ? 1 : 0,
relevance,
updatedAt: project.updatedAt,
});
diff --git a/packages/core/search-index/instance.ts b/packages/core/search-index/instance.ts
index fa8eb6ecd7..190c410eb9 100644
--- a/packages/core/search-index/instance.ts
+++ b/packages/core/search-index/instance.ts
@@ -22,7 +22,7 @@ export async function searchIssues(params: SearchParams): Promise<SearchIssuesRe
}
/** Project search with the same local-first behavior as `searchIssues`. */
-export async function searchProjects(params: SearchParams): Promise<SearchProjectsResponse> {
+export async function searchProjects(params: Parameters<typeof api.searchProjects>[0]): Promise<SearchProjectsResponse> {
const local = await getLocalSearchIndex().searchProjects(params);
return local ?? api.searchProjects(params);
}
diff --git a/packages/core/types/index.ts b/packages/core/types/index.ts
index 72e606f3c3..c6220828fb 100644
--- a/packages/core/types/index.ts
+++ b/packages/core/types/index.ts
@@ -210,6 +210,7 @@ export type {
CreateProjectRequest,
UpdateProjectRequest,
ListProjectsResponse,
+ ArchiveProjectResponse,
ProjectResource,
ProjectResourceType,
ProjectResourceRef,
diff --git a/packages/core/types/project.ts b/packages/core/types/project.ts
index 707e6127d8..1ca600b869 100644
--- a/packages/core/types/project.ts
+++ b/packages/core/types/project.ts
@@ -46,6 +46,19 @@ export interface Project {
* Optional because older servers do not send it. (MUL-7420)
*/
workflow_id?: string | null;
+ /**
+ * Set while the project is archived: hidden from default lists and pickers
+ * and closed to new issues, otherwise intact. Orthogonal to `status`.
+ * Optional because older servers do not send it. (MUL-8861)
+ */
+ archived_at?: string | null;
+ archived_by_type?: "member" | "agent" | null;
+ archived_by_id?: string | null;
+}
+
+export interface ArchiveProjectResponse extends Project {
+ /** Autopilots the archive paused because they file into this project. */
+ paused_autopilot_ids: string[];
}
export interface CreateProjectRequest {
diff --git a/packages/views/autopilots/components/autopilot-detail-page.tsx b/packages/views/autopilots/components/autopilot-detail-page.tsx
index bc55b2db99..77560b1f13 100644
--- a/packages/views/autopilots/components/autopilot-detail-page.tsx
+++ b/packages/views/autopilots/components/autopilot-detail-page.tsx
@@ -4,7 +4,7 @@ import { useMemo, useState, type ReactNode } from "react";
import {
Zap, Play, Clock, Plus, Trash2, CheckCircle2, XCircle, Loader2, Pencil,
Ban, ChevronDown, ChevronRight, MoreHorizontal, Link2, ArrowUpRight, FilePlus2,
- Webhook, RotateCw, Server, FileQuestion, FileText, Square,
+ Webhook, RotateCw, Server, FileQuestion, FileText, Square, Archive,
} from "@multica/ui/icons";
import { useQuery } from "@tanstack/react-query";
import { autopilotDetailOptions, autopilotRunsOptions, autopilotRunOptions } from "@multica/core/autopilots/queries";
@@ -1219,6 +1219,23 @@ export function AutopilotDetailPage({ autopilotId }: { autopilotId: string }) {
)}
</div>
)}
+ {autopilot.pause_reason === "project_archived" && (
+ <div
+ role="status"
+ className="flex items-center gap-2 rounded-lg border bg-muted/40 px-3 py-2 text-caption text-muted-foreground"
+ >
+ <Archive className="size-3.5 shrink-0" />
+ <span className="flex-1">{t(($) => $.detail.paused_project_archived)}</span>
+ {autopilot.project_id && (
+ <AppLink
+ href={wsPaths.projectDetail(autopilot.project_id)}
+ className="font-medium underline underline-offset-2"
+ >
+ {t(($) => $.detail.open_project)}
+ </AppLink>
+ )}
+ </div>
+ )}
<ObjectIdentity
media={<ObjectIconMark icon={summary.icon} />}
diff --git a/packages/views/autopilots/components/autopilots-page.tsx b/packages/views/autopilots/components/autopilots-page.tsx
index 9c3a005939..de6eda3682 100644
--- a/packages/views/autopilots/components/autopilots-page.tsx
+++ b/packages/views/autopilots/components/autopilots-page.tsx
@@ -73,7 +73,9 @@ function NameCell({ autopilot }: { autopilot: Autopilot }) {
title={
autopilot.pause_reason === "agent_runtime_required"
? t(($) => $.status.paused_runtime_required)
- : t(($) => $.status.paused)
+ : autopilot.pause_reason === "project_archived"
+ ? t(($) => $.status.paused_project_archived)
+ : t(($) => $.status.paused)
}
className="flex shrink-0 items-center text-amber-500"
>
diff --git a/packages/views/editor/extensions/mention-suggestion.tsx b/packages/views/editor/extensions/mention-suggestion.tsx
index a1e004648a..9678d88dc1 100644
--- a/packages/views/editor/extensions/mention-suggestion.tsx
+++ b/packages/views/editor/extensions/mention-suggestion.tsx
@@ -37,6 +37,7 @@ import { ListTodo } from "@multica/ui/icons";
import { ActorAvatar } from "../../common/actor-avatar";
import { StatusIcon } from "../../issues/components/status-icon";
import { ProjectIcon } from "../../projects/components/project-icon";
+import { ArchivedProjectTag } from "../../projects/components/project-archive";
import { useT } from "../../i18n";
import { Badge } from "@multica/ui/components/ui/badge";
import {
@@ -89,6 +90,8 @@ export interface MentionItem {
icon?: string | null;
/** Project status snapshot for recent/current project rendering */
projectStatus?: ProjectStatus;
+ /** Archived projects stay mentionable; search ranks them last. */
+ projectArchived?: boolean;
/** Present when the target should remain discoverable but cannot be selected. */
disabledReason?: "agent_runtime_required";
}
@@ -310,6 +313,7 @@ export const MentionList = forwardRef<MentionListRef, MentionListProps>(
q,
limit: SERVER_CONTEXT_SEARCH_LIMIT,
include_closed: true,
+ include_archived: true,
signal: controller.signal,
}),
]);
@@ -611,6 +615,7 @@ function MentionRow({
</span>
)}
</span>
+ {item.projectArchived && <ArchivedProjectTag />}
{projectStatusCfg && (
<span className={`${projectStatusCfg.dotColor} ml-auto size-1.5 shrink-0 rounded-full`} />
)}
@@ -683,7 +688,14 @@ function issueToMention(
};
}
-function projectToMention(p: { id: string; title: string; description?: string | null; icon?: string | null; status?: ProjectStatus }): MentionItem {
+function projectToMention(p: {
+ id: string;
+ title: string;
+ description?: string | null;
+ icon?: string | null;
+ status?: ProjectStatus;
+ archived_at?: string | null;
+}): MentionItem {
return {
id: p.id,
label: p.title,
@@ -691,6 +703,7 @@ function projectToMention(p: { id: string; title: string; description?: string |
description: p.description ?? undefined,
icon: p.icon ?? null,
projectStatus: p.status,
+ projectArchived: !!p.archived_at,
};
}
diff --git a/packages/views/issue-views/view-header.tsx b/packages/views/issue-views/view-header.tsx
index 160b75ccda..598693d902 100644
--- a/packages/views/issue-views/view-header.tsx
+++ b/packages/views/issue-views/view-header.tsx
@@ -127,12 +127,18 @@ export function IssueViewHeader({
controller,
base,
baseMenu,
+ baseBadge,
+ hideCreate = false,
trailing,
}: {
controller: IssueSurfaceController;
base: IssueViewHeaderBase;
/** Name-menu items for the page itself, e.g. project actions. */
baseMenu?: ReactNode;
+ /** Marker after the page's own name, e.g. an archived project's tag. */
+ baseBadge?: ReactNode;
+ /** Drops the new-issue button, e.g. on an archived project. */
+ hideCreate?: boolean;
/** Layout toggles at the far end, e.g. the project's properties panel. */
trailing?: ReactNode;
}) {
@@ -363,6 +369,7 @@ export function IssueViewHeader({
{unreadView ? <UnreadViewIcon /> : activeView ? <Layers className="size-4" /> : baseIcon}
</RefreshablePageIcon>
<span className="min-w-0 truncate">{activeView ? activeViewName : baseName}</span>
+ {!activeView && baseBadge}
</>
);
@@ -564,15 +571,17 @@ export function IssueViewHeader({
onTableFacetChange={controller.setActiveTableFacet}
iconOnly
/>
- <IconButton
- label={t(($) => $.views.new_issue)}
- shortcut={<ActionShortcutKeycaps action="createIssue" />}
- tooltipSide="bottom"
- className="text-muted-foreground"
- onClick={() => controller.openCreateIssue()}
- >
- <SquarePen />
- </IconButton>
+ {!hideCreate && (
+ <IconButton
+ label={t(($) => $.views.new_issue)}
+ shortcut={<ActionShortcutKeycaps action="createIssue" />}
+ tooltipSide="bottom"
+ className="text-muted-foreground"
+ onClick={() => controller.openCreateIssue()}
+ >
+ <SquarePen />
+ </IconButton>
+ )}
{trailing && (
<>
<Separator orientation="vertical" className="ml-1 data-vertical:h-4 data-vertical:self-center" />
diff --git a/packages/views/issues/surface/issue-surface.tsx b/packages/views/issues/surface/issue-surface.tsx
index 8fc2332443..8258275d6d 100644
--- a/packages/views/issues/surface/issue-surface.tsx
+++ b/packages/views/issues/surface/issue-surface.tsx
@@ -90,6 +90,7 @@ export function IssueSurface({
modes,
surfaceKey,
createDefaults,
+ allowCreate = true,
search,
renderHeader,
renderEmpty,
@@ -186,6 +187,7 @@ export function IssueSurface({
scope={effectiveScope}
modes={modes}
createDefaults={createDefaults}
+ allowCreate={allowCreate}
search={search}
renderHeader={renderHeader}
renderEmpty={renderEmpty}
@@ -208,6 +210,7 @@ function IssueSurfaceContent({
scope,
modes,
createDefaults,
+ allowCreate = true,
search,
renderHeader,
renderEmpty,
@@ -319,7 +322,7 @@ function IssueSurfaceContent({
title={t(($) => $.detail.empty_issues_title)}
description={t(($) => $.detail.empty_issues_hint)}
actions={
- <>
+ allowCreate && <>
<Button size="sm" onClick={() => controller.openCreateIssue()}>
<Plus aria-hidden="true" />
{t(($) => $.detail.empty_issues_new_button)}
@@ -351,7 +354,7 @@ function IssueSurfaceContent({
childProgressMap={controller.childProgressMap}
projectMap={controller.projectMap}
projectId={controller.projectId}
- onCreateIssue={openCreateIssue}
+ onCreateIssue={allowCreate ? openCreateIssue : undefined}
statusPagination={controller.statusPagination}
groupBranches={controller.groupBranches}
/>
@@ -364,7 +367,7 @@ function IssueSurfaceContent({
projectMap={controller.projectMap}
projectId={controller.projectId}
onMoveIssue={controller.moveIssue}
- onCreateIssue={openCreateIssue}
+ onCreateIssue={allowCreate ? openCreateIssue : undefined}
statusPagination={controller.statusPagination!}
/>
)}
@@ -393,7 +396,7 @@ function IssueSurfaceContent({
childProgressMap={controller.childProgressMap}
projectMap={controller.projectMap}
projectId={controller.projectId}
- onCreateIssue={openCreateIssue}
+ onCreateIssue={allowCreate ? openCreateIssue : undefined}
groupBranches={controller.groupBranches}
/>
)}
diff --git a/packages/views/issues/surface/types.ts b/packages/views/issues/surface/types.ts
index 3894be11db..06b43c72aa 100644
--- a/packages/views/issues/surface/types.ts
+++ b/packages/views/issues/surface/types.ts
@@ -26,6 +26,12 @@ export interface IssueSurfaceProps {
modes: IssueSurfaceMode[];
surfaceKey?: string;
createDefaults?: IssueCreateDefaults;
+ /**
+ * False hides the surface's new-issue affordances (column "+", empty-state
+ * actions). Table sub-issue creation stays: a sub-issue keeps its parent's
+ * project. Defaults to true.
+ */
+ allowCreate?: boolean;
/** Server-owned membership search shared by non-Table issue surfaces. */
search?: string;
}
diff --git a/packages/views/layout/panels/pinned-section.tsx b/packages/views/layout/panels/pinned-section.tsx
index a69ba52f2d..78328987e9 100644
--- a/packages/views/layout/panels/pinned-section.tsx
+++ b/packages/views/layout/panels/pinned-section.tsx
@@ -12,7 +12,7 @@ import {
} from "@dnd-kit/core";
import { SortableContext, verticalListSortingStrategy, useSortable, arrayMove } from "@dnd-kit/sortable";
import { CSS } from "@dnd-kit/utilities";
-import { Folder, X } from "@multica/ui/icons";
+import { Archive, Folder, X } from "@multica/ui/icons";
import { cn } from "@multica/ui/lib/utils";
import { TooltipHint } from "@multica/ui/components/common/tooltip-hint";
import { ShimmerText } from "@multica/ui/components/common/shimmer-text";
@@ -322,6 +322,7 @@ function PinRow({
onUnpin: () => void;
wsId: string;
}) {
+ const { t: tProjects } = useT("projects");
const isIssue = pin.item_type === "issue";
const agents = useIssueAgentState(wsId, isIssue ? pin.item_id : "");
const unread = useIssueUnread(wsId, isIssue ? pin.item_id : "");
@@ -381,6 +382,15 @@ function PinRow({
label={project.title}
active={active}
labelSuffix={project.visibility === "private" && <PrivateProjectLock />}
+ trailing={
+ project.archived_at ? (
+ <Archive
+ role="img"
+ aria-label={tProjects(($) => $.archive.badge)}
+ className="size-3 shrink-0 text-muted-foreground"
+ />
+ ) : undefined
+ }
iconNode={
project.icon ? <ProjectIcon project={project} size="md" /> : <Folder className="size-4 shrink-0" />
}
diff --git a/packages/views/layout/panels/work-panel.tsx b/packages/views/layout/panels/work-panel.tsx
index 229d54e841..d3521e7f2c 100644
--- a/packages/views/layout/panels/work-panel.tsx
+++ b/packages/views/layout/panels/work-panel.tsx
@@ -117,6 +117,7 @@ export function WorkPanel() {
() => sidebarProjects(projects, projectSettings, projectOrder, userId),
[projects, projectSettings, projectOrder, userId],
);
+ const activeProjectCount = useMemo(() => projects.filter((project) => !project.archived_at).length, [projects]);
const openProject = projects.find((project) => isPathWithin(pathname, p.projectDetail(project.id)));
const shownProjects = useKeptActiveItem(PROJECTS_LIST, filteredProjects, openProject?.id ?? null, openProject);
const plainRowsLit = !pins.isActivePinnedRoute;
@@ -191,7 +192,7 @@ export function WorkPanel() {
userId={userId}
pathname={pathname}
projects={shownProjects}
- totalProjects={projects.length}
+ totalProjects={activeProjectCount}
plainRowsLit={plainRowsLit}
activeIssueId={currentIssueId}
litSource={litSource}
diff --git a/packages/views/layout/panels/work-tree.test.tsx b/packages/views/layout/panels/work-tree.test.tsx
index 633612747c..382dc462a9 100644
--- a/packages/views/layout/panels/work-tree.test.tsx
+++ b/packages/views/layout/panels/work-tree.test.tsx
@@ -192,7 +192,14 @@ describe("ProjectsSection", () => {
const menu = await screen.findByRole("menu");
const items = Array.from(menu.querySelectorAll('[role="menuitem"]'), (el) => el.textContent?.trim());
- expect(items).toEqual(["New issue in this project", "Rename", "Open in new tab", "Pin to sidebar", "Copy link"]);
+ expect(items).toEqual([
+ "New issue in this project",
+ "Rename",
+ "Open in new tab",
+ "Pin to sidebar",
+ "Copy link",
+ "Archive",
+ ]);
fireEvent.click(screen.getByRole("menuitem", { name: "New issue in this project" }));
expect(openCreateIssue).toHaveBeenCalledWith({ project_id: "p2" });
diff --git a/packages/views/locales/en/autopilots.json b/packages/views/locales/en/autopilots.json
index 01c5a29928..f47f1c891b 100644
--- a/packages/views/locales/en/autopilots.json
+++ b/packages/views/locales/en/autopilots.json
@@ -21,7 +21,8 @@
"active": "Active",
"paused": "Paused",
"paused_runtime_required": "Paused — the assignee needs a runtime",
- "archived": "Archived"
+ "archived": "Archived",
+ "paused_project_archived": "Paused — its project is archived"
},
"execution_mode": {
"create_issue": "Create Issue",
@@ -115,7 +116,8 @@
"cancel": "Cancel",
"confirm": "Delete",
"deleting": "Deleting..."
- }
+ },
+ "paused_project_archived": "Paused because its project was archived. Restore the project, then reactivate this autopilot."
},
"access": {
"title": "Manage access",
diff --git a/packages/views/locales/en/projects.json b/packages/views/locales/en/projects.json
index da0d75dfc6..2282626e68 100644
--- a/packages/views/locales/en/projects.json
+++ b/packages/views/locales/en/projects.json
@@ -15,7 +15,11 @@
"pin": "Pin to sidebar",
"unpin": "Unpin",
"delete": "Delete",
- "no_matches": "No projects match"
+ "no_matches": "No projects match",
+ "scope_archived": "Archived projects",
+ "archive": "Archive",
+ "restore": "Restore",
+ "no_archived": "No archived projects"
},
"table": {
"name": "Name",
@@ -24,7 +28,8 @@
"progress": "Progress",
"lead": "Lead",
"created": "Created",
- "issues": "Issues"
+ "issues": "Issues",
+ "archived": "Archived"
},
"status": {
"planned": "Planned",
@@ -86,7 +91,9 @@
"no_issues_yet": "No issues yet",
"toast_link_copied": "Link copied",
"toast_project_deleted": "Project deleted",
- "toast_move_issue_failed": "Failed to move issue"
+ "toast_move_issue_failed": "Failed to move issue",
+ "archive_action": "Archive project",
+ "restore_action": "Restore project"
},
"resources": {
"section_header": "Resources",
@@ -155,7 +162,9 @@
"title": "Delete project",
"description": "This will delete the project. Issues will not be deleted but will be unlinked.",
"confirm": "Delete",
- "cancel": "Cancel"
+ "cancel": "Cancel",
+ "archive_instead": "Archive instead",
+ "archive_hint": "Archiving hides the project but keeps its issues, history and settings. You can restore it any time."
},
"picker": {
"no_project": "No project",
@@ -224,5 +233,29 @@
"publish_description": "All workspace members will be able to see this project and its issues, comments, and attachments.",
"done": "Done",
"retry": "Retry"
+ },
+ "archive": {
+ "badge": "Archived",
+ "dialog_title": "Archive “{{name}}”?",
+ "dialog_title_count_one": "Archive {{count}} project?",
+ "dialog_title_count_other": "Archive {{count}} projects?",
+ "dialog_description": "Archived projects are hidden from project lists and pickers and stop accepting new issues. Nothing is deleted.",
+ "dialog_open_issues_one": "{{count}} open issue stays as it is, still readable and editable.",
+ "dialog_open_issues_other": "{{count}} open issues stay as they are, still readable and editable.",
+ "dialog_autopilots_one": "{{count}} active autopilot that files issues into it will be paused.",
+ "dialog_autopilots_other": "{{count}} active autopilots that file issues into it will be paused.",
+ "dialog_restore_hint": "You can restore it any time from Archived projects.",
+ "cancel": "Cancel",
+ "confirm": "Archive",
+ "toast_archived": "Archived “{{name}}”",
+ "toast_archived_count_one": "Archived {{count}} project",
+ "toast_archived_count_other": "Archived {{count}} projects",
+ "toast_paused_one": "Paused {{count}} autopilot that files issues into it",
+ "toast_paused_other": "Paused {{count}} autopilots that file issues into it",
+ "undo": "Undo",
+ "toast_restored": "Restored “{{name}}”",
+ "toast_completed": "“{{name}}” is completed",
+ "notice": "This project is archived. It's hidden from project lists and pickers and accepts no new issues; its issues stay readable and editable.",
+ "prop_label": "Archived"
}
}
diff --git a/packages/views/locales/es/autopilots.json b/packages/views/locales/es/autopilots.json
index c59aa1b2d0..0fb4f3cee6 100644
--- a/packages/views/locales/es/autopilots.json
+++ b/packages/views/locales/es/autopilots.json
@@ -21,7 +21,8 @@
"active": "Activo",
"paused": "En pausa",
"paused_runtime_required": "En pausa: el asignado necesita un runtime",
- "archived": "Archivado"
+ "archived": "Archivado",
+ "paused_project_archived": "En pausa: su proyecto está archivado"
},
"execution_mode": {
"create_issue": "Crear tarea",
@@ -115,7 +116,8 @@
"create_issue": "{{agent}} crea una tarea en cada ejecución",
"run_only": "{{agent}} lo ejecuta sin crear una tarea",
"with_trigger": "{{trigger}} · {{action}}"
- }
+ },
+ "paused_project_archived": "En pausa porque su proyecto se archivó. Restaura el proyecto y reactiva esta automatización."
},
"access": {
"title": "Gestionar acceso",
diff --git a/packages/views/locales/es/projects.json b/packages/views/locales/es/projects.json
index 0e37fdce22..82a997a8a1 100644
--- a/packages/views/locales/es/projects.json
+++ b/packages/views/locales/es/projects.json
@@ -15,7 +15,11 @@
"no_matches": "Ningún proyecto coincide",
"scope_all": "Todos los proyectos",
"scope_active": "Proyectos activos",
- "scope_closed": "Proyectos cerrados"
+ "scope_closed": "Proyectos cerrados",
+ "scope_archived": "Proyectos archivados",
+ "archive": "Archivar",
+ "restore": "Restaurar",
+ "no_archived": "No hay proyectos archivados"
},
"table": {
"name": "Nombre",
@@ -24,7 +28,8 @@
"progress": "Progreso",
"lead": "Responsable",
"created": "Creado",
- "issues": "Tareas"
+ "issues": "Tareas",
+ "archived": "Archivado"
},
"status": {
"planned": "Planificado",
@@ -86,7 +91,9 @@
"toast_move_issue_failed": "No se ha podido mover la tarea",
"not_found_description": "Puede haberse eliminado o puede que no tengas acceso.",
"back_to_list": "Todos los proyectos",
- "empty_issues_add_existing": "Añadir tarea existente"
+ "empty_issues_add_existing": "Añadir tarea existente",
+ "archive_action": "Archivar proyecto",
+ "restore_action": "Restaurar proyecto"
},
"resources": {
"section_header": "Recursos",
@@ -155,7 +162,9 @@
"title": "Eliminar proyecto",
"description": "Esto eliminará el proyecto. Las tareas no se eliminarán, pero se desenlazarán.",
"confirm": "Eliminar",
- "cancel": "Cancelar"
+ "cancel": "Cancelar",
+ "archive_instead": "Archivar en su lugar",
+ "archive_hint": "Archivar oculta el proyecto pero conserva sus tareas, historial y ajustes. Puedes restaurarlo cuando quieras."
},
"picker": {
"no_project": "Sin proyecto",
@@ -224,5 +233,29 @@
"publish_description": "Todos los miembros podrán ver este proyecto, sus tareas, comentarios y archivos adjuntos.",
"done": "Listo",
"retry": "Reintentar"
+ },
+ "archive": {
+ "badge": "Archivado",
+ "dialog_title": "¿Archivar «{{name}}»?",
+ "dialog_title_count_one": "¿Archivar {{count}} proyecto?",
+ "dialog_title_count_other": "¿Archivar {{count}} proyectos?",
+ "dialog_description": "Los proyectos archivados se ocultan de las listas y selectores de proyectos y dejan de aceptar tareas nuevas. No se elimina nada.",
+ "dialog_open_issues_one": "{{count}} tarea abierta se queda como está y se puede seguir viendo y editando.",
+ "dialog_open_issues_other": "{{count}} tareas abiertas se quedan como están y se pueden seguir viendo y editando.",
+ "dialog_autopilots_one": "Se pausará {{count}} automatización activa que crea tareas en él.",
+ "dialog_autopilots_other": "Se pausarán {{count}} automatizaciones activas que crean tareas en él.",
+ "dialog_restore_hint": "Puedes restaurarlo cuando quieras desde Proyectos archivados.",
+ "cancel": "Cancelar",
+ "confirm": "Archivar",
+ "toast_archived": "«{{name}}» archivado",
+ "toast_archived_count_one": "{{count}} proyecto archivado",
+ "toast_archived_count_other": "{{count}} proyectos archivados",
+ "toast_paused_one": "Se pausó {{count}} automatización que crea tareas en él",
+ "toast_paused_other": "Se pausaron {{count}} automatizaciones que crean tareas en él",
+ "undo": "Deshacer",
+ "toast_restored": "«{{name}}» restaurado",
+ "toast_completed": "«{{name}}» está completado",
+ "notice": "Este proyecto está archivado. No aparece en las listas ni en los selectores de proyectos y no acepta tareas nuevas; sus tareas se pueden seguir viendo y editando.",
+ "prop_label": "Archivado"
}
}
diff --git a/packages/views/locales/fr/autopilots.json b/packages/views/locales/fr/autopilots.json
index f6defbdb31..6e617ae271 100644
--- a/packages/views/locales/fr/autopilots.json
+++ b/packages/views/locales/fr/autopilots.json
@@ -21,7 +21,8 @@
"active": "Active",
"paused": "En pause",
"paused_runtime_required": "En pause — l'assigné a besoin d'un runtime",
- "archived": "Archivée"
+ "archived": "Archivée",
+ "paused_project_archived": "En pause — son projet est archivé"
},
"execution_mode": {
"create_issue": "Créer une tâche",
@@ -115,7 +116,8 @@
"cancel": "Annuler",
"confirm": "Supprimer",
"deleting": "Suppression..."
- }
+ },
+ "paused_project_archived": "En pause car son projet a été archivé. Restaurez le projet, puis réactivez cette automatisation."
},
"access": {
"title": "Gérer l'accès",
diff --git a/packages/views/locales/fr/projects.json b/packages/views/locales/fr/projects.json
index cf5b7d94ae..071a4cfeab 100644
--- a/packages/views/locales/fr/projects.json
+++ b/packages/views/locales/fr/projects.json
@@ -15,7 +15,11 @@
"pin": "Épingler à la barre latérale",
"unpin": "Détacher",
"delete": "Supprimer",
- "no_matches": "Aucun projet correspondant"
+ "no_matches": "Aucun projet correspondant",
+ "scope_archived": "Projets archivés",
+ "archive": "Archiver",
+ "restore": "Restaurer",
+ "no_archived": "Aucun projet archivé"
},
"table": {
"name": "Nom",
@@ -24,7 +28,8 @@
"progress": "Avancement",
"lead": "Responsable",
"created": "Création",
- "issues": "Tâches"
+ "issues": "Tâches",
+ "archived": "Archivé"
},
"status": {
"planned": "Planifié",
@@ -86,7 +91,9 @@
"no_issues_yet": "Aucune tâche pour l'instant",
"toast_link_copied": "Lien copié",
"toast_project_deleted": "Projet supprimé",
- "toast_move_issue_failed": "Échec du déplacement de la tâche"
+ "toast_move_issue_failed": "Échec du déplacement de la tâche",
+ "archive_action": "Archiver le projet",
+ "restore_action": "Restaurer le projet"
},
"resources": {
"section_header": "Ressources",
@@ -155,7 +162,9 @@
"title": "Supprimer le projet",
"description": "Le projet sera supprimé. Les tâches ne seront pas supprimées, mais elles seront détachées.",
"confirm": "Supprimer",
- "cancel": "Annuler"
+ "cancel": "Annuler",
+ "archive_instead": "Archiver plutôt",
+ "archive_hint": "L'archivage masque le projet mais conserve ses tâches, son historique et ses réglages. Vous pouvez le restaurer à tout moment."
},
"picker": {
"no_project": "Aucun projet",
@@ -224,5 +233,29 @@
"publish_description": "Tous les membres pourront voir ce projet, ses tâches, commentaires et pièces jointes.",
"done": "Terminé",
"retry": "Réessayer"
+ },
+ "archive": {
+ "badge": "Archivé",
+ "dialog_title": "Archiver « {{name}} » ?",
+ "dialog_title_count_one": "Archiver {{count}} projet ?",
+ "dialog_title_count_other": "Archiver {{count}} projets ?",
+ "dialog_description": "Les projets archivés sont masqués des listes et sélecteurs de projets et n'acceptent plus de nouvelles tâches. Rien n'est supprimé.",
+ "dialog_open_issues_one": "{{count}} tâche ouverte reste telle quelle, toujours consultable et modifiable.",
+ "dialog_open_issues_other": "{{count}} tâches ouvertes restent telles quelles, toujours consultables et modifiables.",
+ "dialog_autopilots_one": "{{count}} automatisation active qui y crée des tâches sera mise en pause.",
+ "dialog_autopilots_other": "{{count}} automatisations actives qui y créent des tâches seront mises en pause.",
+ "dialog_restore_hint": "Vous pouvez le restaurer à tout moment depuis Projets archivés.",
+ "cancel": "Annuler",
+ "confirm": "Archiver",
+ "toast_archived": "« {{name}} » archivé",
+ "toast_archived_count_one": "{{count}} projet archivé",
+ "toast_archived_count_other": "{{count}} projets archivés",
+ "toast_paused_one": "{{count}} automatisation qui y crée des tâches a été mise en pause",
+ "toast_paused_other": "{{count}} automatisations qui y créent des tâches ont été mises en pause",
+ "undo": "Annuler",
+ "toast_restored": "« {{name}} » restauré",
+ "toast_completed": "« {{name}} » est terminé",
+ "notice": "Ce projet est archivé. Il n'apparaît plus dans les listes ni les sélecteurs de projets et n'accepte plus de nouvelles tâches ; ses tâches restent consultables et modifiables.",
+ "prop_label": "Archivé"
}
}
diff --git a/packages/views/locales/ja/autopilots.json b/packages/views/locales/ja/autopilots.json
index caeeb5fd38..a57828a877 100644
--- a/packages/views/locales/ja/autopilots.json
+++ b/packages/views/locales/ja/autopilots.json
@@ -21,7 +21,8 @@
"active": "アクティブ",
"paused": "一時停止中",
"paused_runtime_required": "一時停止中 — 担当エージェントのランタイムが必要です",
- "archived": "アーカイブ済み"
+ "archived": "アーカイブ済み",
+ "paused_project_archived": "一時停止中 — プロジェクトがアーカイブされています"
},
"execution_mode": {
"create_issue": "タスクを作成",
@@ -115,7 +116,8 @@
"cancel": "キャンセル",
"confirm": "削除",
"deleting": "削除中..."
- }
+ },
+ "paused_project_archived": "プロジェクトがアーカイブされたため一時停止しました。プロジェクトを復元してから再度有効にしてください。"
},
"access": {
"title": "アクセス管理",
diff --git a/packages/views/locales/ja/projects.json b/packages/views/locales/ja/projects.json
index ae62abbb4c..2da3a3b723 100644
--- a/packages/views/locales/ja/projects.json
+++ b/packages/views/locales/ja/projects.json
@@ -15,7 +15,11 @@
"pin": "サイドバーにピン留め",
"unpin": "ピン留め解除",
"delete": "削除",
- "no_matches": "該当するプロジェクトはありません"
+ "no_matches": "該当するプロジェクトはありません",
+ "scope_archived": "アーカイブ済みのプロジェクト",
+ "archive": "アーカイブ",
+ "restore": "復元",
+ "no_archived": "アーカイブ済みのプロジェクトはありません"
},
"table": {
"name": "名前",
@@ -24,7 +28,8 @@
"progress": "進捗",
"lead": "リード",
"created": "作成日",
- "issues": "タスク数"
+ "issues": "タスク数",
+ "archived": "アーカイブ日"
},
"status": {
"planned": "計画中",
@@ -86,7 +91,9 @@
"no_issues_yet": "タスクはまだありません",
"toast_link_copied": "リンクをコピーしました",
"toast_project_deleted": "プロジェクトを削除しました",
- "toast_move_issue_failed": "タスクを移動できませんでした"
+ "toast_move_issue_failed": "タスクを移動できませんでした",
+ "archive_action": "プロジェクトをアーカイブ",
+ "restore_action": "プロジェクトを復元"
},
"resources": {
"section_header": "リソース",
@@ -155,7 +162,9 @@
"title": "プロジェクトを削除",
"description": "プロジェクトが削除されます。タスクは削除されませんが、リンクが解除されます。",
"confirm": "削除",
- "cancel": "キャンセル"
+ "cancel": "キャンセル",
+ "archive_instead": "代わりにアーカイブ",
+ "archive_hint": "アーカイブするとプロジェクトは非表示になりますが、タスク・履歴・設定は残り、いつでも復元できます。"
},
"picker": {
"no_project": "プロジェクトなし",
@@ -224,5 +233,24 @@
"publish_description": "すべてのワークスペースメンバーがこのプロジェクトとタスク、コメント、添付ファイルを閲覧できるようになります。",
"done": "完了",
"retry": "再試行"
+ },
+ "archive": {
+ "badge": "アーカイブ済み",
+ "dialog_title": "「{{name}}」をアーカイブしますか?",
+ "dialog_title_count_other": "{{count}} 件のプロジェクトをアーカイブしますか?",
+ "dialog_description": "アーカイブしたプロジェクトはプロジェクト一覧や選択肢に表示されず、新しいタスクも作成できなくなります。何も削除されません。",
+ "dialog_open_issues_other": "未完了のタスク {{count}} 件はそのまま残り、引き続き閲覧・編集できます。",
+ "dialog_autopilots_other": "このプロジェクトにタスクを作成する有効な自動化 {{count}} 件が一時停止されます。",
+ "dialog_restore_hint": "「アーカイブ済みのプロジェクト」からいつでも復元できます。",
+ "cancel": "キャンセル",
+ "confirm": "アーカイブ",
+ "toast_archived": "「{{name}}」をアーカイブしました",
+ "toast_archived_count_other": "{{count}} 件のプロジェクトをアーカイブしました",
+ "toast_paused_other": "このプロジェクトにタスクを作成する自動化 {{count}} 件を一時停止しました",
+ "undo": "元に戻す",
+ "toast_restored": "「{{name}}」を復元しました",
+ "toast_completed": "「{{name}}」を完了にしました",
+ "notice": "このプロジェクトはアーカイブ済みです。一覧や選択肢に表示されず、新しいタスクは作成できません。既存のタスクは閲覧・編集できます。",
+ "prop_label": "アーカイブ"
}
}
diff --git a/packages/views/locales/ko/autopilots.json b/packages/views/locales/ko/autopilots.json
index 77e677c083..4f96e7c2aa 100644
--- a/packages/views/locales/ko/autopilots.json
+++ b/packages/views/locales/ko/autopilots.json
@@ -21,7 +21,8 @@
"active": "활성",
"paused": "일시 중지",
"paused_runtime_required": "일시 중지됨 — 담당 에이전트에 런타임이 필요합니다",
- "archived": "보관됨"
+ "archived": "보관됨",
+ "paused_project_archived": "일시 중지됨 — 프로젝트가 보관되었습니다"
},
"execution_mode": {
"create_issue": "태스크 생성",
@@ -115,7 +116,8 @@
"cancel": "취소",
"confirm": "삭제",
"deleting": "삭제하는 중..."
- }
+ },
+ "paused_project_archived": "프로젝트가 보관되어 자동화가 일시 중지되었습니다. 프로젝트를 복원한 후 다시 활성화하세요."
},
"access": {
"title": "접근 권한 관리",
diff --git a/packages/views/locales/ko/projects.json b/packages/views/locales/ko/projects.json
index b4ebe6cf1a..2069181be0 100644
--- a/packages/views/locales/ko/projects.json
+++ b/packages/views/locales/ko/projects.json
@@ -15,7 +15,11 @@
"pin": "사이드바에 고정",
"unpin": "고정 해제",
"delete": "삭제",
- "no_matches": "일치하는 프로젝트가 없습니다"
+ "no_matches": "일치하는 프로젝트가 없습니다",
+ "scope_archived": "보관된 프로젝트",
+ "archive": "보관",
+ "restore": "복원",
+ "no_archived": "보관된 프로젝트가 없습니다"
},
"table": {
"name": "이름",
@@ -24,7 +28,8 @@
"progress": "진행률",
"lead": "리드",
"created": "생성일",
- "issues": "태스크 수"
+ "issues": "태스크 수",
+ "archived": "보관일"
},
"status": {
"planned": "계획됨",
@@ -86,7 +91,9 @@
"no_issues_yet": "아직 태스크가 없습니다",
"toast_link_copied": "링크를 복사했습니다",
"toast_project_deleted": "프로젝트를 삭제했습니다",
- "toast_move_issue_failed": "태스크를 이동하지 못했습니다"
+ "toast_move_issue_failed": "태스크를 이동하지 못했습니다",
+ "archive_action": "프로젝트 보관",
+ "restore_action": "프로젝트 복원"
},
"resources": {
"section_header": "리소스",
@@ -155,7 +162,9 @@
"title": "프로젝트 삭제",
"description": "프로젝트가 삭제됩니다. 태스크는 삭제되지 않지만 프로젝트 연결은 해제됩니다.",
"confirm": "삭제",
- "cancel": "취소"
+ "cancel": "취소",
+ "archive_instead": "대신 보관",
+ "archive_hint": "보관하면 프로젝트가 숨겨지지만 태스크, 기록, 설정은 유지되며 언제든 복원할 수 있습니다."
},
"picker": {
"no_project": "프로젝트 없음",
@@ -224,5 +233,24 @@
"publish_description": "모든 워크스페이스 멤버가 프로젝트와 해당 태스크, 댓글, 첨부 파일을 볼 수 있게 됩니다.",
"done": "완료",
"retry": "다시 시도"
+ },
+ "archive": {
+ "badge": "보관됨",
+ "dialog_title": "“{{name}}” 프로젝트를 보관할까요?",
+ "dialog_title_count_other": "프로젝트 {{count}}개를 보관할까요?",
+ "dialog_description": "보관된 프로젝트는 프로젝트 목록과 선택 메뉴에서 숨겨지고 새 태스크를 받지 않습니다. 삭제되는 것은 없습니다.",
+ "dialog_open_issues_other": "완료되지 않은 태스크 {{count}}개는 그대로 남으며 계속 보고 편집할 수 있습니다.",
+ "dialog_autopilots_other": "이 프로젝트에 태스크를 만드는 활성 자동화 {{count}}개가 일시 중지됩니다.",
+ "dialog_restore_hint": "‘보관된 프로젝트’에서 언제든 복원할 수 있습니다.",
+ "cancel": "취소",
+ "confirm": "보관",
+ "toast_archived": "“{{name}}” 프로젝트를 보관했습니다",
+ "toast_archived_count_other": "프로젝트 {{count}}개를 보관했습니다",
+ "toast_paused_other": "이 프로젝트에 태스크를 만드는 자동화 {{count}}개를 일시 중지했습니다",
+ "undo": "실행 취소",
+ "toast_restored": "“{{name}}” 프로젝트를 복원했습니다",
+ "toast_completed": "“{{name}}” 프로젝트를 완료했습니다",
+ "notice": "보관된 프로젝트입니다. 프로젝트 목록과 선택 메뉴에 표시되지 않고 새 태스크를 받지 않습니다. 기존 태스크는 계속 보고 편집할 수 있습니다.",
+ "prop_label": "보관"
}
}
diff --git a/packages/views/locales/ru/autopilots.json b/packages/views/locales/ru/autopilots.json
index 1a7390bd1c..b0b9a7167c 100644
--- a/packages/views/locales/ru/autopilots.json
+++ b/packages/views/locales/ru/autopilots.json
@@ -21,7 +21,8 @@
"active": "Активен",
"paused": "Приостановлен",
"paused_runtime_required": "Приостановлен — исполнителю нужна среда выполнения",
- "archived": "В архиве"
+ "archived": "В архиве",
+ "paused_project_archived": "Приостановлен — проект в архиве"
},
"execution_mode": {
"create_issue": "Создавать задачу",
@@ -115,7 +116,8 @@
"deleting": "Удаление..."
},
"not_found_description": "Возможно, он удалён или у вас нет доступа.",
- "back_to_list": "Все автопилоты"
+ "back_to_list": "Все автопилоты",
+ "paused_project_archived": "Приостановлен, потому что его проект архивирован. Восстановите проект, затем снова активируйте этот автопилот."
},
"access": {
"title": "Управление доступом",
diff --git a/packages/views/locales/ru/projects.json b/packages/views/locales/ru/projects.json
index 13d4cf0f1a..2064eae053 100644
--- a/packages/views/locales/ru/projects.json
+++ b/packages/views/locales/ru/projects.json
@@ -15,7 +15,11 @@
"pin": "Закрепить в боковой панели",
"unpin": "Открепить",
"delete": "Удалить",
- "no_matches": "Нет подходящих проектов"
+ "no_matches": "Нет подходящих проектов",
+ "scope_archived": "Архивные проекты",
+ "archive": "Архивировать",
+ "restore": "Восстановить",
+ "no_archived": "Нет архивных проектов"
},
"table": {
"name": "Название",
@@ -24,7 +28,8 @@
"progress": "Прогресс",
"lead": "Руководитель",
"created": "Создан",
- "issues": "Задачи"
+ "issues": "Задачи",
+ "archived": "В архиве с"
},
"status": {
"planned": "Запланирован",
@@ -86,7 +91,9 @@
"toast_move_issue_failed": "Не удалось переместить задачу",
"not_found_description": "Возможно, он удалён или у вас нет доступа.",
"back_to_list": "Все проекты",
- "empty_issues_add_existing": "Добавить существующую задачу"
+ "empty_issues_add_existing": "Добавить существующую задачу",
+ "archive_action": "Архивировать проект",
+ "restore_action": "Восстановить проект"
},
"resources": {
"section_header": "Ресурсы",
@@ -155,7 +162,9 @@
"description": "Проект будет удалён. Задачи не удалятся, но будут отвязаны от проекта.",
"confirm": "Удалить",
"cancel": "Отмена",
- "offline_error": "Нет подключения к сети. Подключитесь и повторите удаление."
+ "offline_error": "Нет подключения к сети. Подключитесь и повторите удаление.",
+ "archive_instead": "Архивировать вместо этого",
+ "archive_hint": "Архивация скрывает проект, но сохраняет его задачи, историю и настройки. Его можно восстановить в любой момент."
},
"picker": {
"no_project": "Без проекта",
@@ -224,5 +233,39 @@
"publish_description": "Все участники смогут видеть проект, его задачи, комментарии и вложения.",
"done": "Готово",
"retry": "Повторить"
+ },
+ "archive": {
+ "badge": "В архиве",
+ "dialog_title": "Архивировать «{{name}}»?",
+ "dialog_title_count_one": "Архивировать {{count}} проект?",
+ "dialog_title_count_few": "Архивировать {{count}} проекта?",
+ "dialog_title_count_many": "Архивировать {{count}} проектов?",
+ "dialog_title_count_other": "Архивировать {{count}} проекта?",
+ "dialog_description": "Архивные проекты скрыты из списков и выбора проектов и не принимают новые задачи. Ничего не удаляется.",
+ "dialog_open_issues_one": "{{count}} открытая задача останется как есть, её можно смотреть и редактировать.",
+ "dialog_open_issues_few": "{{count}} открытые задачи останутся как есть, их можно смотреть и редактировать.",
+ "dialog_open_issues_many": "{{count}} открытых задач останутся как есть, их можно смотреть и редактировать.",
+ "dialog_open_issues_other": "{{count}} открытой задачи останутся как есть, их можно смотреть и редактировать.",
+ "dialog_autopilots_one": "{{count}} активный автопилот, создающий в нём задачи, будет приостановлен.",
+ "dialog_autopilots_few": "{{count}} активных автопилота, создающих в нём задачи, будут приостановлены.",
+ "dialog_autopilots_many": "{{count}} активных автопилотов, создающих в нём задачи, будут приостановлены.",
+ "dialog_autopilots_other": "{{count}} активного автопилота, создающих в нём задачи, будут приостановлены.",
+ "dialog_restore_hint": "Его можно восстановить в любой момент в разделе «Архивные проекты».",
+ "cancel": "Отмена",
+ "confirm": "Архивировать",
+ "toast_archived": "«{{name}}» в архиве",
+ "toast_archived_count_one": "{{count}} проект в архиве",
+ "toast_archived_count_few": "{{count}} проекта в архиве",
+ "toast_archived_count_many": "{{count}} проектов в архиве",
+ "toast_archived_count_other": "{{count}} проекта в архиве",
+ "toast_paused_one": "Приостановлен {{count}} автопилот, создающий в нём задачи",
+ "toast_paused_few": "Приостановлено {{count}} автопилота, создающих в нём задачи",
+ "toast_paused_many": "Приостановлено {{count}} автопилотов, создающих в нём задачи",
+ "toast_paused_other": "Приостановлено {{count}} автопилота, создающих в нём задачи",
+ "undo": "Отменить",
+ "toast_restored": "«{{name}}» восстановлен",
+ "toast_completed": "«{{name}}» завершён",
+ "notice": "Проект в архиве: он скрыт из списков и выбора проектов и не принимает новые задачи; существующие задачи можно смотреть и редактировать.",
+ "prop_label": "В архиве"
}
}
diff --git a/packages/views/locales/zh-Hans/autopilots.json b/packages/views/locales/zh-Hans/autopilots.json
index f53389a059..f9b7d50425 100644
--- a/packages/views/locales/zh-Hans/autopilots.json
+++ b/packages/views/locales/zh-Hans/autopilots.json
@@ -21,7 +21,8 @@
"active": "启用",
"paused": "已暂停",
"paused_runtime_required": "已暂停——执行智能体需绑定运行时",
- "archived": "已归档"
+ "archived": "已归档",
+ "paused_project_archived": "已暂停——所属项目已归档"
},
"execution_mode": {
"create_issue": "创建任务",
@@ -115,7 +116,8 @@
"cancel": "取消",
"confirm": "删除",
"deleting": "删除中..."
- }
+ },
+ "paused_project_archived": "由于所属项目已归档,自动化已暂停。恢复项目后请重新启用。"
},
"access": {
"title": "管理访问",
diff --git a/packages/views/locales/zh-Hans/projects.json b/packages/views/locales/zh-Hans/projects.json
index d8be32abf3..40bc04be0a 100644
--- a/packages/views/locales/zh-Hans/projects.json
+++ b/packages/views/locales/zh-Hans/projects.json
@@ -15,7 +15,11 @@
"pin": "固定到侧边栏",
"unpin": "取消钉选",
"delete": "删除",
- "no_matches": "没有匹配的项目"
+ "no_matches": "没有匹配的项目",
+ "scope_archived": "已归档的项目",
+ "archive": "归档",
+ "restore": "恢复",
+ "no_archived": "没有已归档的项目"
},
"table": {
"name": "名称",
@@ -24,7 +28,8 @@
"progress": "进度",
"lead": "负责人",
"created": "创建时间",
- "issues": "任务数"
+ "issues": "任务数",
+ "archived": "归档于"
},
"status": {
"planned": "计划中",
@@ -86,7 +91,9 @@
"no_issues_yet": "目前还没有任务",
"toast_link_copied": "已复制链接",
"toast_project_deleted": "已删除项目",
- "toast_move_issue_failed": "移动任务失败"
+ "toast_move_issue_failed": "移动任务失败",
+ "archive_action": "归档项目",
+ "restore_action": "恢复项目"
},
"resources": {
"section_header": "资源",
@@ -155,7 +162,9 @@
"title": "删除项目",
"description": "将删除这个项目。任务不会被删除,只会从项目中解除关联。",
"confirm": "删除",
- "cancel": "取消"
+ "cancel": "取消",
+ "archive_instead": "改为归档",
+ "archive_hint": "归档会隐藏项目,但保留它的任务、历史和设置,随时可以恢复。"
},
"picker": {
"no_project": "无项目",
@@ -224,5 +233,24 @@
"publish_description": "工作区所有成员都将能查看这个项目及其中的任务、评论和附件。",
"done": "完成",
"retry": "重试"
+ },
+ "archive": {
+ "badge": "已归档",
+ "dialog_title": "归档「{{name}}」?",
+ "dialog_title_count_other": "归档 {{count}} 个项目?",
+ "dialog_description": "归档后,项目会从项目列表和选择器中隐藏,也不能再新建任务。不会删除任何内容。",
+ "dialog_open_issues_other": "{{count}} 个未完成的任务保持原样,仍可查看和编辑。",
+ "dialog_autopilots_other": "{{count}} 个向它创建任务的自动化会被暂停。",
+ "dialog_restore_hint": "之后可以在「已归档的项目」里随时恢复。",
+ "cancel": "取消",
+ "confirm": "归档",
+ "toast_archived": "已归档「{{name}}」",
+ "toast_archived_count_other": "已归档 {{count}} 个项目",
+ "toast_paused_other": "已暂停 {{count}} 个向它创建任务的自动化",
+ "undo": "撤销",
+ "toast_restored": "已恢复「{{name}}」",
+ "toast_completed": "「{{name}}」已完成",
+ "notice": "该项目已归档:不会出现在项目列表和选择器中,也不能新建任务;已有任务仍可查看和编辑。",
+ "prop_label": "归档"
}
}
diff --git a/packages/views/locales/zh-Hant/autopilots.json b/packages/views/locales/zh-Hant/autopilots.json
index dad2480fdc..690a76a7b6 100644
--- a/packages/views/locales/zh-Hant/autopilots.json
+++ b/packages/views/locales/zh-Hant/autopilots.json
@@ -21,7 +21,8 @@
"active": "啟用",
"paused": "已暫停",
"paused_runtime_required": "已暫停——執行 AI 代理需繫結執行時",
- "archived": "已歸檔"
+ "archived": "已歸檔",
+ "paused_project_archived": "已暫停——所屬專案已歸檔"
},
"execution_mode": {
"create_issue": "建立任務",
@@ -115,7 +116,8 @@
"cancel": "取消",
"confirm": "刪除",
"deleting": "刪除中..."
- }
+ },
+ "paused_project_archived": "由於所屬專案已歸檔,自動化已暫停。還原專案後請重新啟用。"
},
"access": {
"title": "管理訪問",
diff --git a/packages/views/locales/zh-Hant/projects.json b/packages/views/locales/zh-Hant/projects.json
index a47a5cf198..feae8fcb50 100644
--- a/packages/views/locales/zh-Hant/projects.json
+++ b/packages/views/locales/zh-Hant/projects.json
@@ -15,7 +15,11 @@
"pin": "固定到側邊欄",
"unpin": "取消釘選",
"delete": "刪除",
- "no_matches": "沒有匹配的專案"
+ "no_matches": "沒有匹配的專案",
+ "scope_archived": "已歸檔的專案",
+ "archive": "歸檔",
+ "restore": "還原",
+ "no_archived": "沒有已歸檔的專案"
},
"table": {
"name": "名稱",
@@ -24,7 +28,8 @@
"progress": "進度",
"lead": "負責人",
"created": "建立時間",
- "issues": "任務數"
+ "issues": "任務數",
+ "archived": "歸檔於"
},
"status": {
"planned": "計劃中",
@@ -86,7 +91,9 @@
"no_issues_yet": "目前還沒有任務",
"toast_link_copied": "已複製連結",
"toast_project_deleted": "已刪除專案",
- "toast_move_issue_failed": "移動任務失敗"
+ "toast_move_issue_failed": "移動任務失敗",
+ "archive_action": "歸檔專案",
+ "restore_action": "還原專案"
},
"resources": {
"section_header": "資源",
@@ -155,7 +162,9 @@
"title": "刪除專案",
"description": "將刪除這個專案。任務不會被刪除,只會從專案中解除關聯。",
"confirm": "刪除",
- "cancel": "取消"
+ "cancel": "取消",
+ "archive_instead": "改為歸檔",
+ "archive_hint": "歸檔會隱藏專案,但保留它的任務、歷史和設定,隨時可以還原。"
},
"picker": {
"no_project": "無專案",
@@ -224,5 +233,24 @@
"publish_description": "工作區所有成員都將能查看這個專案及其中的任務、評論和附件。",
"done": "完成",
"retry": "重試"
+ },
+ "archive": {
+ "badge": "已歸檔",
+ "dialog_title": "歸檔「{{name}}」?",
+ "dialog_title_count_other": "歸檔 {{count}} 個專案?",
+ "dialog_description": "歸檔後,專案會從專案列表和選擇器中隱藏,也不能再新增任務。不會刪除任何內容。",
+ "dialog_open_issues_other": "{{count}} 個未完成的任務保持原樣,仍可檢視和編輯。",
+ "dialog_autopilots_other": "{{count}} 個向它建立任務的自動化會被暫停。",
+ "dialog_restore_hint": "之後可以在「已歸檔的專案」裡隨時還原。",
+ "cancel": "取消",
+ "confirm": "歸檔",
+ "toast_archived": "已歸檔「{{name}}」",
+ "toast_archived_count_other": "已歸檔 {{count}} 個專案",
+ "toast_paused_other": "已暫停 {{count}} 個向它建立任務的自動化",
+ "undo": "復原",
+ "toast_restored": "已還原「{{name}}」",
+ "toast_completed": "「{{name}}」已完成",
+ "notice": "此專案已歸檔:不會出現在專案列表和選擇器中,也不能新增任務;既有任務仍可檢視和編輯。",
+ "prop_label": "歸檔"
}
}
diff --git a/packages/views/modals/quick-create-issue.tsx b/packages/views/modals/quick-create-issue.tsx
index 5b45c94c09..7ce80b8959 100644
--- a/packages/views/modals/quick-create-issue.tsx
+++ b/packages/views/modals/quick-create-issue.tsx
@@ -34,6 +34,7 @@ import { useCurrentWorkspace, useWorkspacePaths } from "@multica/core/paths";
import { AppLink, resolveClickIntent } from "../navigation";
import { agentListOptions, squadListOptions } from "@multica/core/workspace/queries";
import { projectListOptions } from "@multica/core/projects/queries";
+import { isProjectArchived } from "@multica/core/projects";
import {
useQuickCreateStore,
type QuickCreateActorType,
@@ -310,12 +311,13 @@ export function AgentCreatePanel({
// Stale-id sweep. Once the project list query has actually resolved
// (`isSuccess` — distinct from "data is the empty default during loading"),
// a `projectId` that isn't in the list means the project was deleted in
- // another session. Clear local state AND the unfinished draft — the draft
- // is the only persisted copy left, and leaving it would make the next open
- // re-seed and submit the same dead value.
+ // another session; an archived one takes no new issues either. Clear local
+ // state AND the unfinished draft — the draft is the only persisted copy
+ // left, and leaving it would make the next open re-seed and submit the same
+ // dead value.
useEffect(() => {
if (!projectsLoaded || projectId === null) return;
- if (projects.some((p) => p.id === projectId)) return;
+ if (projects.some((p) => p.id === projectId && !isProjectArchived(p))) return;
setProjectId(null);
if (draft.shared.projectId === projectId) {
setShared({ projectId: undefined });
diff --git a/packages/views/projects/components/project-archive.tsx b/packages/views/projects/components/project-archive.tsx
new file mode 100644
index 0000000000..feffb0d64b
--- /dev/null
+++ b/packages/views/projects/components/project-archive.tsx
@@ -0,0 +1,243 @@
+"use client";
+
+import { useCallback, useState, type ReactNode } from "react";
+import { useQueryClient } from "@tanstack/react-query";
+import { toast } from "sonner";
+import { Archive } from "@multica/ui/icons";
+import { cn } from "@multica/ui/lib/utils";
+import { Button } from "@multica/ui/components/ui/button";
+import { Spinner } from "@multica/ui/components/ui/spinner";
+import {
+ Dialog,
+ DialogContent,
+ DialogDescription,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle,
+} from "@multica/ui/components/ui/dialog";
+import { useWorkspaceId } from "@multica/core/hooks";
+import { autopilotListOptions } from "@multica/core/autopilots/queries";
+import { useArchiveProject, useRestoreProject } from "@multica/core/projects";
+import type { Project, ProjectStatus } from "@multica/core/types";
+import { useT } from "../../i18n";
+import { CollectionTag } from "../../layout/collection-list";
+
+function errorMessage(err: unknown): string {
+ return err instanceof Error ? err.message : String(err);
+}
+
+/** Inline marker for an archived project in lists, search results and pins. */
+export function ArchivedProjectTag() {
+ const { t } = useT("projects");
+ return <CollectionTag>{t(($) => $.archive.badge)}</CollectionTag>;
+}
+
+function openIssueCount(rows: Project[]): number {
+ return rows.reduce((sum, p) => sum + Math.max(0, p.issue_count - p.done_count), 0);
+}
+
+interface ArchiveRequestOptions {
+ onArchived?: () => void;
+ /** Skip the confirmation, for callers that already asked (the delete dialog). */
+ immediate?: boolean;
+}
+
+/**
+ * Archive flow shared by every surface that offers it. A project with no open
+ * issues and no active autopilots archives immediately behind an undo toast;
+ * otherwise a dialog first says what stays and what pauses. Render `dialog`
+ * once next to the trigger.
+ */
+export function useArchiveProjects(): {
+ requestArchive: (rows: Project[], options?: ArchiveRequestOptions) => void;
+ dialog: ReactNode;
+} {
+ const { t } = useT("projects");
+ const qc = useQueryClient();
+ const wsId = useWorkspaceId();
+ const archiveProject = useArchiveProject();
+ const restoreProject = useRestoreProject();
+ const [pending, setPending] = useState<{
+ rows: Project[];
+ autopilotCount: number;
+ onArchived?: () => void;
+ } | null>(null);
+ const [archiving, setArchiving] = useState(false);
+
+ const archive = useCallback(
+ async (rows: Project[], onArchived?: () => void) => {
+ const archived: Project[] = [];
+ let paused = 0;
+ try {
+ for (const project of rows) {
+ const res = await archiveProject.mutateAsync(project.id);
+ archived.push(project);
+ paused += res.paused_autopilot_ids.length;
+ }
+ } catch (err) {
+ toast.error(errorMessage(err));
+ }
+ if (archived.length === 0) return;
+ onArchived?.();
+ const title =
+ archived.length === 1
+ ? t(($) => $.archive.toast_archived, { name: archived[0]!.title })
+ : t(($) => $.archive.toast_archived_count, { count: archived.length });
+ toast.success(title, {
+ description: paused > 0 ? t(($) => $.archive.toast_paused, { count: paused }) : undefined,
+ action: {
+ label: t(($) => $.archive.undo),
+ onClick: () => {
+ for (const project of archived) restoreProject.mutate(project.id);
+ },
+ },
+ });
+ },
+ [archiveProject, restoreProject, t],
+ );
+
+ const requestArchive = useCallback(
+ (rows: Project[], options?: ArchiveRequestOptions) => {
+ const targets = rows.filter((p) => !p.archived_at);
+ if (targets.length === 0) return;
+ if (options?.immediate) {
+ void archive(targets, options.onArchived);
+ return;
+ }
+ void (async () => {
+ const ids = new Set(targets.map((p) => p.id));
+ let autopilotCount = 0;
+ try {
+ const { autopilots } = await qc.ensureQueryData(autopilotListOptions(wsId));
+ autopilotCount = autopilots.filter(
+ (a) => a.status === "active" && !!a.project_id && ids.has(a.project_id),
+ ).length;
+ } catch {
+ // The count only decides whether to confirm; the server pauses
+ // whatever is active regardless.
+ }
+ if (openIssueCount(targets) === 0 && autopilotCount === 0) {
+ await archive(targets, options?.onArchived);
+ return;
+ }
+ setPending({ rows: targets, autopilotCount, onArchived: options?.onArchived });
+ })();
+ },
+ [archive, qc, wsId],
+ );
+
+ const confirm = async () => {
+ if (!pending || archiving) return;
+ setArchiving(true);
+ try {
+ await archive(pending.rows, pending.onArchived);
+ setPending(null);
+ } finally {
+ setArchiving(false);
+ }
+ };
+
+ const openIssues = pending ? openIssueCount(pending.rows) : 0;
+ const dialog = (
+ <Dialog
+ open={pending !== null}
+ onOpenChange={(open) => {
+ if (!open && !archiving) setPending(null);
+ }}
+ >
+ <DialogContent className="sm:max-w-md" showCloseButton={!archiving}>
+ <DialogHeader>
+ <DialogTitle>
+ {pending?.rows.length === 1
+ ? t(($) => $.archive.dialog_title, { name: pending.rows[0]!.title })
+ : t(($) => $.archive.dialog_title_count, { count: pending?.rows.length ?? 0 })}
+ </DialogTitle>
+ <DialogDescription>{t(($) => $.archive.dialog_description)}</DialogDescription>
+ </DialogHeader>
+ <ul className="list-disc space-y-1 pl-5 text-body text-muted-foreground">
+ {openIssues > 0 && <li>{t(($) => $.archive.dialog_open_issues, { count: openIssues })}</li>}
+ {pending && pending.autopilotCount > 0 && (
+ <li>{t(($) => $.archive.dialog_autopilots, { count: pending.autopilotCount })}</li>
+ )}
+ <li>{t(($) => $.archive.dialog_restore_hint)}</li>
+ </ul>
+ <DialogFooter>
+ <Button
+ type="button"
+ variant="outline"
+ size="sm"
+ disabled={archiving}
+ onClick={() => setPending(null)}
+ >
+ {t(($) => $.archive.cancel)}
+ </Button>
+ <Button type="button" size="sm" disabled={archiving} aria-busy={archiving} onClick={() => void confirm()}>
+ {archiving ? <Spinner className="size-3.5" aria-hidden="true" /> : <Archive className="size-3.5" />}
+ {t(($) => $.archive.confirm)}
+ </Button>
+ </DialogFooter>
+ </DialogContent>
+ </Dialog>
+ );
+
+ return { requestArchive, dialog };
+}
+
+/**
+ * After a project is marked completed, offer to archive it from the toast.
+ * Clicking the action is the confirmation, and the row may have left the
+ * current scope by then, so it archives without a dialog; the result toast
+ * still carries Undo.
+ */
+export function useOfferArchiveOnComplete() {
+ const { t } = useT("projects");
+ const { requestArchive } = useArchiveProjects();
+ return useCallback(
+ (project: Project, nextStatus: ProjectStatus) => {
+ if (nextStatus !== "completed" || project.status === "completed" || project.archived_at) return;
+ toast.success(t(($) => $.archive.toast_completed, { name: project.title }), {
+ action: {
+ label: t(($) => $.page.archive),
+ onClick: () => requestArchive([{ ...project, status: nextStatus }], { immediate: true }),
+ },
+ });
+ },
+ [requestArchive, t],
+ );
+}
+
+/** Restore with a confirmation toast; paused autopilots stay paused. */
+export function useRestoreProjects() {
+ const { t } = useT("projects");
+ const restoreProject = useRestoreProject();
+ return useCallback(
+ (project: Project) => {
+ restoreProject.mutate(project.id, {
+ onSuccess: () => toast.success(t(($) => $.archive.toast_restored, { name: project.title })),
+ onError: (err) => toast.error(errorMessage(err)),
+ });
+ },
+ [restoreProject, t],
+ );
+}
+
+/** Notice under the project page header while the project is archived. */
+export function ArchivedProjectNotice({ project, className }: { project: Project; className?: string }) {
+ const { t } = useT("projects");
+ const restore = useRestoreProjects();
+ return (
+ <div
+ role="status"
+ className={cn(
+ "flex items-center gap-2 rounded-lg border bg-muted/40 px-3 py-2 text-caption text-muted-foreground",
+ className,
+ )}
+ >
+ <Archive className="size-3.5 shrink-0 text-muted-foreground" />
+ <span className="min-w-0 flex-1">{t(($) => $.archive.notice)}</span>
+ <Button variant="outline" size="xs" onClick={() => restore(project)}>
+ {t(($) => $.page.restore)}
+ </Button>
+ </div>
+ );
+}
diff --git a/packages/views/projects/components/project-badge.tsx b/packages/views/projects/components/project-badge.tsx
index 067fcc1b75..f8b8041e15 100644
--- a/packages/views/projects/components/project-badge.tsx
+++ b/packages/views/projects/components/project-badge.tsx
@@ -16,11 +16,13 @@ import {
} from "@multica/ui/components/ui/dropdown-menu";
import type { Project, ProjectStatus, ProjectPriority, UpdateProjectRequest } from "@multica/core/types";
import { PriorityIcon } from "../../issues/components/priority-icon";
+import { useOfferArchiveOnComplete } from "./project-archive";
import { useProjectStatusLabels, useProjectPriorityLabels } from "./labels";
export function ProjectStatusBadge({ project, handleUpdate, triggerClassName, align = "end" }: { project: Project; handleUpdate: (data: UpdateProjectRequest) => void; triggerClassName?: string; align?: "start" | "end" | "center" }) {
const statusLabels = useProjectStatusLabels();
const statusCfg = PROJECT_STATUS_CONFIG[project.status];
+ const offerArchive = useOfferArchiveOnComplete();
return (
<DropdownMenu>
@@ -37,7 +39,13 @@ export function ProjectStatusBadge({ project, handleUpdate, triggerClassName, al
/>
<DropdownMenuContent align={align} className="w-44">
{PROJECT_STATUS_ORDER.map((s) => (
- <DropdownMenuItem key={s} onClick={() => handleUpdate({ status: s as ProjectStatus })}>
+ <DropdownMenuItem
+ key={s}
+ onClick={() => {
+ handleUpdate({ status: s as ProjectStatus });
+ offerArchive(project, s as ProjectStatus);
+ }}
+ >
<span className={cn("size-2 rounded-full", PROJECT_STATUS_CONFIG[s].dotColor)} />
<span>{statusLabels[s]}</span>
{s === project.status && <Check className="ml-auto h-3.5 w-3.5" />}
diff --git a/packages/views/projects/components/project-detail.tsx b/packages/views/projects/components/project-detail.tsx
index 66c911a401..64ac8b30e1 100644
--- a/packages/views/projects/components/project-detail.tsx
+++ b/packages/views/projects/components/project-detail.tsx
@@ -3,7 +3,7 @@
import { useMemo, useState, useCallback, useRef, useEffect } from "react";
import { useRegisterCommandBarContext } from "../../search/register-context";
import { useDefaultLayout, usePanelRef } from "react-resizable-panels";
-import { BellOff, BellRing, Check, ChevronRight, FileQuestion, Link2, PanelRight, Pencil, Pin, PinOff, Trash2, UserMinus } from "@multica/ui/icons";
+import { Archive, ArchiveRestore, BellOff, BellRing, Check, ChevronRight, FileQuestion, Link2, PanelRight, Pencil, Pin, PinOff, Trash2, UserMinus } from "@multica/ui/icons";
import { useQuery } from "@tanstack/react-query";
import { cn } from "@multica/ui/lib/utils";
import { copyText } from "@multica/ui/lib/clipboard";
@@ -81,7 +81,15 @@ import {
AlertDialogTitle,
} from "@multica/ui/components/ui/alert-dialog";
import { useT } from "../../i18n";
-import { useProjectStatusLabels, useProjectPriorityLabels } from "./labels";
+import { useProjectStatusLabels, useProjectPriorityLabels, useFormatRelativeDate } from "./labels";
+import {
+ ArchivedProjectNotice,
+ ArchivedProjectTag,
+ useArchiveProjects,
+ useOfferArchiveOnComplete,
+ useRestoreProjects,
+} from "./project-archive";
+import { PAGE_GUTTER } from "../../layout/page-header";
import { matchesPinyin } from "../../editor/extensions/pinyin-match";
// Property row — sidebar property display
@@ -125,6 +133,10 @@ export function ProjectDetail({ projectId }: { projectId: string }) {
const userId = useAuthStore((s) => s.user?.id);
const deleteProject = useDeleteProject();
const deleted = deleteProject.isSuccess && deleteProject.variables === projectId;
+ const { requestArchive, dialog: archiveDialog } = useArchiveProjects();
+ const restore = useRestoreProjects();
+ const offerArchive = useOfferArchiveOnComplete();
+ const formatRelativeDate = useFormatRelativeDate();
const { data: project, isLoading } = useQuery({
...projectDetailOptions(wsId, projectId),
enabled: !deleted,
@@ -258,6 +270,15 @@ export function ProjectDetail({ projectId }: { projectId: string }) {
[project, updateProject],
);
+ const handleStatusChange = useCallback(
+ (status: ProjectStatus) => {
+ if (!project) return;
+ handleUpdateField({ status });
+ offerArchive(project, status);
+ },
+ [project, handleUpdateField, offerArchive],
+ );
+
const handleDelete = useCallback(() => {
if (!project || deleteProject.isPending) return;
deleteProject.mutate(project.id, {
@@ -307,6 +328,7 @@ export function ProjectDetail({ projectId }: { projectId: string }) {
}
const issueMetrics = getProjectIssueMetrics(project);
+ const archived = !!project.archived_at;
const statusCfg = PROJECT_STATUS_CONFIG[project.status];
const sidebarContent = (
@@ -371,7 +393,7 @@ export function ProjectDetail({ projectId }: { projectId: string }) {
/>
<DropdownMenuContent align="start" className="w-44">
{PROJECT_STATUS_ORDER.map((s) => (
- <DropdownMenuItem key={s} onClick={() => handleUpdateField({ status: s as ProjectStatus })}>
+ <DropdownMenuItem key={s} onClick={() => handleStatusChange(s as ProjectStatus)}>
<span className={cn("size-2 rounded-full", PROJECT_STATUS_CONFIG[s].dotColor)} />
<span>{statusLabels[s]}</span>
{s === project.status && <Check className="ml-auto h-3.5 w-3.5" />}
@@ -486,6 +508,18 @@ export function ProjectDetail({ projectId }: { projectId: string }) {
<ProjectDueDatePicker dueDate={project.due_date} onUpdate={handleUpdateField} />
</PropRow>
<ProjectWorkflowPropRow project={project} onOpen={openWorkflowSheet} />
+ {archived && (
+ <PropRow label={t(($) => $.archive.prop_label)}>
+ <span className="tabular-nums">{formatRelativeDate(project.archived_at!)}</span>
+ {project.archived_by_type && project.archived_by_id && (
+ <>
+ <span className="text-muted-foreground">·</span>
+ <ActorAvatar actorType={project.archived_by_type} actorId={project.archived_by_id} size="sm" enableHoverCard />
+ <span className="truncate">{getActorName(project.archived_by_type, project.archived_by_id)}</span>
+ </>
+ )}
+ </PropRow>
+ )}
</div>}
</div>
@@ -562,10 +596,14 @@ export function ProjectDetail({ projectId }: { projectId: string }) {
<IssueSurface
scope={issueScope}
modes={["board", "list", "table", "swimlane", "gantt"]}
+ allowCreate={!archived}
renderHeader={({ controller }) => (
+ <>
<IssueViewHeader
controller={controller}
base={{ kind: "project", project }}
+ baseBadge={archived ? <ArchivedProjectTag /> : undefined}
+ hideCreate={archived}
baseMenu={
<>
<DropdownMenuItem
@@ -604,19 +642,28 @@ export function ProjectDetail({ projectId }: { projectId: string }) {
{isSubscribed ? t(($) => $.detail.unsubscribe_action) : t(($) => $.detail.subscribe_action)}
</DropdownMenuItem>
<ProjectWorkflowMenuItem project={project} onOpen={() => setWorkflowSheetOpen(true)} />
+ <DropdownMenuSeparator />
+ {archived ? (
+ <DropdownMenuItem onClick={() => restore(project)}>
+ <ArchiveRestore className="h-3.5 w-3.5" />
+ {t(($) => $.detail.restore_action)}
+ </DropdownMenuItem>
+ ) : (
+ <DropdownMenuItem onClick={() => requestArchive([project])}>
+ <Archive className="h-3.5 w-3.5" />
+ {t(($) => $.detail.archive_action)}
+ </DropdownMenuItem>
+ )}
{canDelete && (
- <>
- <DropdownMenuSeparator />
- <DropdownMenuItem
- variant="destructive"
- disabled={deleting}
- aria-busy={deleting}
- onClick={() => setDeleteDialogOpen(true)}
- >
- {deleting ? <Spinner className="size-3.5" aria-hidden="true" /> : <Trash2 className="h-3.5 w-3.5" />}
- {t(($) => $.detail.delete_action)}
- </DropdownMenuItem>
- </>
+ <DropdownMenuItem
+ variant="destructive"
+ disabled={deleting}
+ aria-busy={deleting}
+ onClick={() => setDeleteDialogOpen(true)}
+ >
+ {deleting ? <Spinner className="size-3.5" aria-hidden="true" /> : <Trash2 className="h-3.5 w-3.5" />}
+ {t(($) => $.detail.delete_action)}
+ </DropdownMenuItem>
)}
</>
}
@@ -639,6 +686,12 @@ export function ProjectDetail({ projectId }: { projectId: string }) {
</Tooltip>
}
/>
+ {archived && (
+ <div className={cn("shrink-0 pt-2", PAGE_GUTTER)}>
+ <ArchivedProjectNotice project={project} />
+ </div>
+ )}
+ </>
)}
/>
</div>
@@ -672,6 +725,7 @@ export function ProjectDetail({ projectId }: { projectId: string }) {
</ResizablePanelGroup>
<ProjectWorkflowSheet project={project} open={workflowSheetOpen} onOpenChange={setWorkflowSheetOpen} />
+ {archiveDialog}
{/* Delete confirmation */}
{canDelete && (
@@ -688,7 +742,29 @@ export function ProjectDetail({ projectId }: { projectId: string }) {
{t(($) => $.delete_dialog.description)}
</AlertDialogDescription>
</AlertDialogHeader>
+ {!archived && (
+ <div className="flex items-start gap-2 rounded-lg border bg-muted/40 px-3 py-2 text-caption text-muted-foreground">
+ <Archive className="mt-0.5 size-3.5 shrink-0" />
+ <span>{t(($) => $.delete_dialog.archive_hint)}</span>
+ </div>
+ )}
<AlertDialogFooter>
+ {!archived && (
+ <Button
+ type="button"
+ variant="ghost"
+ size="sm"
+ className="sm:mr-auto"
+ disabled={deleting}
+ onClick={() => {
+ setDeleteDialogOpen(false);
+ requestArchive([project], { immediate: true });
+ }}
+ >
+ <Archive className="size-3.5" />
+ {t(($) => $.delete_dialog.archive_instead)}
+ </Button>
+ )}
<AlertDialogCancel disabled={deleting}>
{t(($) => $.delete_dialog.cancel)}
</AlertDialogCancel>
diff --git a/packages/views/projects/components/project-picker.tsx b/packages/views/projects/components/project-picker.tsx
index d4fd2d3379..5bd3f9907e 100644
--- a/packages/views/projects/components/project-picker.tsx
+++ b/packages/views/projects/components/project-picker.tsx
@@ -4,9 +4,11 @@ import { useState } from "react";
import { FolderKanban } from "@multica/ui/icons";
import { useQuery } from "@tanstack/react-query";
import { projectListOptions } from "@multica/core/projects/queries";
+import { isProjectArchived, selectableProjects } from "@multica/core/projects";
import { useWorkspaceId } from "@multica/core/hooks";
import type { UpdateIssueRequest } from "@multica/core/types";
import { ProjectIcon } from "./project-icon";
+import { ArchivedProjectTag } from "./project-archive";
import {
PropertyPicker,
PickerItem,
@@ -63,7 +65,7 @@ export function ProjectPicker({
// Client-side filter: substring match plus pinyin so Chinese project names
// are reachable by latin input (e.g. "sjtmh" → "数据透明化").
const query = filter.trim().toLowerCase();
- const filtered = projects.filter(
+ const filtered = selectableProjects(projects, projectId).filter(
(p) => p.title.toLowerCase().includes(query) || matchesPinyin(p.title, query),
);
@@ -126,6 +128,7 @@ export function ProjectPicker({
>
<ProjectIcon project={p} size="sm" />
<span className="truncate">{p.title}</span>
+ {isProjectArchived(p) && <ArchivedProjectTag />}
</PickerItem>
))}
diff --git a/packages/views/projects/components/project-row-actions.tsx b/packages/views/projects/components/project-row-actions.tsx
index 1173ee0fd8..87facea500 100644
--- a/packages/views/projects/components/project-row-actions.tsx
+++ b/packages/views/projects/components/project-row-actions.tsx
@@ -3,7 +3,7 @@
import { useState, type ReactNode } from "react";
import { useQuery } from "@tanstack/react-query";
import { toast } from "sonner";
-import { ExternalLink, Link2, Pencil, Pin, PinOff, Trash2 } from "@multica/ui/icons";
+import { Archive, ArchiveRestore, ExternalLink, Link2, Pencil, Pin, PinOff, Trash2 } from "@multica/ui/icons";
import { copyText } from "@multica/ui/lib/clipboard";
import { Button } from "@multica/ui/components/ui/button";
import { Spinner } from "@multica/ui/components/ui/spinner";
@@ -31,19 +31,24 @@ import { agentListOptions, memberListOptions } from "@multica/core/workspace/que
import { useT } from "../../i18n";
import { useIntentNavigate, useNavigation } from "../../navigation";
import { CollectionRowMenu } from "../../layout/collection-list";
+import { useArchiveProjects, useRestoreProjects } from "./project-archive";
export function DeleteProjectsDialog({
rows,
open,
onOpenChange,
onDeleted,
+ onArchiveInstead,
}: {
rows: Project[];
open: boolean;
onOpenChange: (open: boolean) => void;
onDeleted?: () => void;
+ /** Offers archiving as the reversible alternative; omitted when every row is already archived. */
+ onArchiveInstead?: () => void;
}) {
const { t } = useT("projects");
+ const canArchiveInstead = !!onArchiveInstead && rows.some((p) => !p.archived_at);
const deleteProject = useDeleteProject();
const [deleting, setDeleting] = useState(false);
@@ -81,7 +86,29 @@ export function DeleteProjectsDialog({
{t(($) => $.delete_dialog.description)}
</DialogDescription>
</DialogHeader>
+ {canArchiveInstead && (
+ <div className="flex items-start gap-2 rounded-lg border bg-muted/40 px-3 py-2 text-caption text-muted-foreground">
+ <Archive className="mt-0.5 size-3.5 shrink-0" />
+ <span>{t(($) => $.delete_dialog.archive_hint)}</span>
+ </div>
+ )}
<DialogFooter>
+ {canArchiveInstead && (
+ <Button
+ type="button"
+ variant="ghost"
+ size="sm"
+ className="sm:mr-auto"
+ disabled={deleting}
+ onClick={() => {
+ onOpenChange(false);
+ onArchiveInstead?.();
+ }}
+ >
+ <Archive className="size-3.5" />
+ {t(($) => $.delete_dialog.archive_instead)}
+ </Button>
+ )}
<Button
type="button"
variant="outline"
@@ -141,6 +168,8 @@ export function ProjectRowActions({
const createPin = useCreatePin();
const deletePin = useDeletePin();
const [deleteOpen, setDeleteOpen] = useState(false);
+ const { requestArchive, dialog: archiveDialog } = useArchiveProjects();
+ const restore = useRestoreProjects();
const togglePin = () => {
if (pinned) deletePin.mutate({ itemType: "project", itemId: project.id });
@@ -201,17 +230,26 @@ export function ProjectRowActions({
<Link2 className="size-3.5" />
{tLayout(($) => $.rail.copy_link)}
</DropdownMenuItem>
+ <DropdownMenuSeparator />
+ {project.archived_at ? (
+ <DropdownMenuItem onClick={() => restore(project)}>
+ <ArchiveRestore className="size-3.5" />
+ {t(($) => $.page.restore)}
+ </DropdownMenuItem>
+ ) : (
+ <DropdownMenuItem onClick={() => requestArchive([project])}>
+ <Archive className="size-3.5" />
+ {t(($) => $.page.archive)}
+ </DropdownMenuItem>
+ )}
{canDelete && (
- <>
- <DropdownMenuSeparator />
- <DropdownMenuItem
- variant="destructive"
- onClick={() => setDeleteOpen(true)}
- >
- <Trash2 className="size-3.5" />
- {t(($) => $.page.delete)}
- </DropdownMenuItem>
- </>
+ <DropdownMenuItem
+ variant="destructive"
+ onClick={() => setDeleteOpen(true)}
+ >
+ <Trash2 className="size-3.5" />
+ {t(($) => $.page.delete)}
+ </DropdownMenuItem>
)}
{trailing}
</CollectionRowMenu>
@@ -220,7 +258,9 @@ export function ProjectRowActions({
rows={[project]}
open={deleteOpen}
onOpenChange={setDeleteOpen}
+ onArchiveInstead={() => requestArchive([project], { immediate: true })}
/>
+ {archiveDialog}
</>
);
}
diff --git a/packages/views/projects/components/projects-page.test.tsx b/packages/views/projects/components/projects-page.test.tsx
index 2c2563bdd7..3a18a18fbf 100644
--- a/packages/views/projects/components/projects-page.test.tsx
+++ b/packages/views/projects/components/projects-page.test.tsx
@@ -50,12 +50,16 @@ vi.mock("@tanstack/react-query", () => ({
}
return { data: [], isLoading: false };
},
+ useQueryClient: () => ({ ensureQueryData: async () => ({ autopilots: [] }) }),
}));
vi.mock("@multica/core/projects", () => ({
projectListOptions: () => ({ queryKey: ["projects"] }),
+ isProjectArchived: (project: { archived_at?: string | null }) => !!project.archived_at,
useUpdateProject: () => ({ mutate: mocks.updateProject }),
useDeleteProject: () => ({ mutateAsync: mocks.deleteProject }),
+ useArchiveProject: () => ({ mutateAsync: vi.fn() }),
+ useRestoreProject: () => ({ mutateAsync: vi.fn() }),
useProjectViewStore: (selector: (state: unknown) => unknown) =>
selector(mocks.projectViewState),
}));
@@ -467,6 +471,32 @@ describe("ProjectsPage header", () => {
expect(screen.getByText("Old Roadmap")).toBeInTheDocument();
});
+ it("keeps archived projects out of every scope but Archived", async () => {
+ const user = userEvent.setup();
+ const ARCHIVED: Project = {
+ ...CLOSED,
+ id: "project-archived",
+ title: "Shelved Launch",
+ archived_at: "2026-01-02T00:00:00Z",
+ archived_by_type: "member",
+ archived_by_id: "user-1",
+ };
+ mocks.projects = [PROJECT, CLOSED, ARCHIVED];
+ renderProjects();
+
+ expect(screen.queryByText("Shelved Launch")).not.toBeInTheDocument();
+ expect(screen.getByRole("button", { name: /^Archived projects/ })).toHaveTextContent("1");
+
+ await user.click(screen.getByRole("button", { name: /^Closed projects/ }));
+ expect(screen.queryByText("Shelved Launch")).not.toBeInTheDocument();
+
+ await user.click(screen.getByRole("button", { name: /^Archived projects/ }));
+ expect(screen.getByRole("heading", { level: 1, name: "Archived projects" })).toBeInTheDocument();
+ expect(screen.getByText("Shelved Launch")).toBeInTheDocument();
+ expect(screen.queryByText("Old Roadmap")).not.toBeInTheDocument();
+ expect(screen.getAllByRole("button", { name: "Restore" }).length).toBeGreaterThan(0);
+ });
+
it("has no search, and offers Reset only while a filter narrows the list", () => {
mocks.projects = [PROJECT, CLOSED];
renderProjects();
diff --git a/packages/views/projects/components/projects-page.tsx b/packages/views/projects/components/projects-page.tsx
index a33ed56b0f..b93f39b0ce 100644
--- a/packages/views/projects/components/projects-page.tsx
+++ b/packages/views/projects/components/projects-page.tsx
@@ -2,6 +2,8 @@
import { useCallback, useMemo, useState } from "react";
import {
+ Archive,
+ ArchiveRestore,
FolderKanban,
LayoutGrid,
Pin,
@@ -10,6 +12,7 @@ import {
} from "@multica/ui/icons";
import { useQuery } from "@tanstack/react-query";
import {
+ isProjectArchived,
projectListOptions,
useUpdateProject,
useProjectViewStore,
@@ -75,6 +78,7 @@ import { ProjectIcon } from "./project-icon";
import { ProjectsIntro } from "./projects-intro";
import { useT } from "../../i18n";
import { DeleteProjectsDialog, ProjectRowActions } from "./project-row-actions";
+import { useArchiveProjects, useRestoreProjects } from "./project-archive";
import { useFormatRelativeDate } from "./labels";
import { ProjectStatusBadge, ProjectPriorityBadge } from "./project-badge";
import { ProjectLeadPicker } from "./project-lead-picker";
@@ -248,12 +252,15 @@ function ProjectCard({
// Header tools — scope menu, filter, display (view, sort, columns).
// Scope splits the lifecycle in two: still being worked on, or closed. The
-// status filter narrows further within it.
-type ProjectScope = "all" | "active" | "closed";
-const PROJECT_SCOPES: ProjectScope[] = ["all", "active", "closed"];
+// status filter narrows further within it. Archived projects sit outside the
+// lifecycle scopes, in their own. (MUL-8861)
+type ProjectScope = "all" | "active" | "closed" | "archived";
+const PROJECT_SCOPES: ProjectScope[] = ["all", "active", "closed", "archived"];
const CLOSED_STATUSES: ReadonlySet<ProjectStatus> = new Set(["completed", "cancelled"]);
function inScope(project: Project, scope: ProjectScope): boolean {
+ if (isProjectArchived(project)) return scope === "archived";
+ if (scope === "archived") return false;
if (scope === "all") return true;
return CLOSED_STATUSES.has(project.status) === (scope === "closed");
}
@@ -281,7 +288,8 @@ function countActiveFilters(f: ProjectListFilters): number {
}
// Batch toolbar — page-anchored (not viewport). Pin all selected (any
-// member) + Delete (only when every selected project is deletable).
+// member), Archive or Restore (any member), Delete (only when every selected
+// project is deletable).
function ProjectBatchToolbar({
rows,
pinnedIds,
@@ -296,8 +304,11 @@ function ProjectBatchToolbar({
const { t } = useT("projects");
const createPin = useCreatePin();
const [confirmDelete, setConfirmDelete] = useState(false);
+ const { requestArchive, dialog: archiveDialog } = useArchiveProjects();
+ const restore = useRestoreProjects();
const anyUnpinned = rows.some((p) => !pinnedIds.has(p.id));
+ const allArchived = rows.length > 0 && rows.every(isProjectArchived);
return (
<>
@@ -319,6 +330,24 @@ function ProjectBatchToolbar({
{t(($) => $.page.pin)}
</Button>
)}
+ {allArchived ? (
+ <Button
+ variant="ghost"
+ size="sm"
+ onClick={() => {
+ for (const p of rows) restore(p);
+ onClear();
+ }}
+ >
+ <ArchiveRestore className="mr-1 size-3.5" />
+ {t(($) => $.page.restore)}
+ </Button>
+ ) : (
+ <Button variant="ghost" size="sm" onClick={() => requestArchive(rows, { onArchived: onClear })}>
+ <Archive className="mr-1 size-3.5" />
+ {t(($) => $.page.archive)}
+ </Button>
+ )}
{canDelete && (
<Button
variant="ghost"
@@ -337,7 +366,9 @@ function ProjectBatchToolbar({
open={confirmDelete}
onOpenChange={setConfirmDelete}
onDeleted={onClear}
+ onArchiveInstead={() => requestArchive(rows, { onArchived: onClear, immediate: true })}
/>
+ {archiveDialog}
</>
);
}
@@ -406,10 +437,18 @@ export function ProjectsPage() {
}, [projects]);
const scopeCounts = useMemo<Record<ProjectScope, number>>(() => {
- const counts = { all: projects.length, active: 0, closed: 0 };
- for (const p of projects) counts[inScope(p, "closed") ? "closed" : "active"] += 1;
+ const counts = { all: 0, active: 0, closed: 0, archived: 0 };
+ for (const p of projects) {
+ if (isProjectArchived(p)) {
+ counts.archived += 1;
+ continue;
+ }
+ counts.all += 1;
+ counts[inScope(p, "closed") ? "closed" : "active"] += 1;
+ }
return counts;
}, [projects]);
+ const restore = useRestoreProjects();
const visible = useMemo(() => {
const filtered = projects.filter((p) => {
@@ -460,6 +499,7 @@ export function ProjectsPage() {
<CollectionNameCell
icon={<ProjectIcon project={project} size="sm" />}
title={project.title}
+ muted={isProjectArchived(project)}
/>
),
},
@@ -547,18 +587,38 @@ export function ProjectsPage() {
className: "font-mono tabular-nums",
cell: (project) => project.issue_count,
},
- {
- key: "created",
- header: t(($) => $.table.created),
- width: 104,
- sortKey: "created",
- hideable: true,
- cell: (project) => (
- <span className="tabular-nums">{formatRelativeDate(project.created_at)}</span>
- ),
- },
+ scope === "archived"
+ ? {
+ // Archived scope: when it was archived, and the way back.
+ key: "archived",
+ header: t(($) => $.table.archived),
+ width: 160,
+ core: true,
+ interactive: true,
+ cell: (project) => (
+ <span className="flex w-full items-center justify-between gap-2">
+ <span className="tabular-nums">
+ {project.archived_at ? formatRelativeDate(project.archived_at) : null}
+ </span>
+ <Button variant="outline" size="xs" onClick={() => restore(project)}>
+ <ArchiveRestore />
+ {t(($) => $.page.restore)}
+ </Button>
+ </span>
+ ),
+ }
+ : {
+ key: "created",
+ header: t(($) => $.table.created),
+ width: 104,
+ sortKey: "created",
+ hideable: true,
+ cell: (project) => (
+ <span className="tabular-nums">{formatRelativeDate(project.created_at)}</span>
+ ),
+ },
],
- [t, formatRelativeDate],
+ [t, formatRelativeDate, scope, restore],
);
const sort: CollectionSort = {
@@ -577,7 +637,10 @@ export function ProjectsPage() {
all: t(($) => $.page.scope_all),
active: t(($) => $.page.scope_active),
closed: t(($) => $.page.scope_closed),
+ archived: t(($) => $.page.scope_archived),
};
+ const noMatchesTitle =
+ scope === "archived" && !hasActiveFilters ? t(($) => $.page.no_archived) : t(($) => $.page.no_matches);
return (
// relative: positioning anchor for the page-centered batch toolbar.
@@ -736,7 +799,7 @@ export function ProjectsPage() {
selection={{ selectedIds, onChange: setSelectedIds }}
empty={
<CollectionNoMatches
- title={t(($) => $.page.no_matches)}
+ title={noMatchesTitle}
onReset={clearFilters}
hasFilters={hasActiveFilters}
/>
@@ -746,7 +809,7 @@ export function ProjectsPage() {
<CardsLoading />
) : visible.length === 0 ? (
<CollectionNoMatches
- title={t(($) => $.page.no_matches)}
+ title={noMatchesTitle}
onReset={clearFilters}
hasFilters={hasActiveFilters}
/>
diff --git a/packages/views/search/pages/issue-pages.tsx b/packages/views/search/pages/issue-pages.tsx
index 4ec8ebe568..c3d796bc77 100644
--- a/packages/views/search/pages/issue-pages.tsx
+++ b/packages/views/search/pages/issue-pages.tsx
@@ -18,6 +18,7 @@ import { issueLabelsOptions, labelListOptions } from "@multica/core/labels/queri
import { useAttachLabelToIssue, useDetachLabel } from "@multica/core/labels/mutations";
import { useModalStore } from "@multica/core/modals";
import { projectListOptions } from "@multica/core/projects/queries";
+import { selectableProjects } from "@multica/core/projects";
import { quickActionListOptions } from "@multica/core/quick-actions";
import type { Issue, IssuePriority, Label } from "@multica/core/types";
import { StatusIcon } from "../../issues/components/status-icon";
@@ -428,7 +429,9 @@ export function IssueProjectPage({ target, query }: { target: IssueTarget; query
const writer = useIssueTargetWriter(target);
const { data: projects = [] } = useQuery(projectListOptions(wsId));
const current = common(writer.issues, (issue) => issue.project_id);
- const live = projects.filter((project) => project.status !== "cancelled" || project.id === current);
+ const live = selectableProjects(projects, current).filter(
+ (project) => project.status !== "cancelled" || project.id === current,
+ );
const visible = filterByLabel(live, query, (project) => project.title);
const noProjectLabel = t(($) => $.pages.no_project);
const q = query.trim().toLowerCase();
diff --git a/packages/views/search/pages/other-pages.tsx b/packages/views/search/pages/other-pages.tsx
index 6ddf83d4d1..547fa794e5 100644
--- a/packages/views/search/pages/other-pages.tsx
+++ b/packages/views/search/pages/other-pages.tsx
@@ -13,6 +13,7 @@ import { useModalStore } from "@multica/core/modals";
import { PROJECT_STATUS_CONFIG, PROJECT_STATUS_ORDER } from "@multica/core/projects/config";
import { useUpdateProject } from "@multica/core/projects/mutations";
import { projectListOptions } from "@multica/core/projects/queries";
+import { selectableProjects } from "@multica/core/projects";
import type { Agent, ChatSession, Project } from "@multica/core/types";
import { useTheme } from "@multica/ui/components/common/theme-provider";
import { cn } from "@multica/ui/lib/utils";
@@ -229,7 +230,7 @@ export function ChatProjectPage({
const { data: projects = [] } = useQuery(projectListOptions(wsId));
const current = session.project_id ?? null;
const q = query.trim().toLowerCase();
- const visible = projects
+ const visible = selectableProjects(projects, current)
.filter((project) => project.status !== "cancelled" || project.id === current)
.filter((project) => !q || scoreText(project.title, q) > 0);
const noProjectLabel = t(($) => $.pages.no_project);
diff --git a/packages/views/search/result-rows.tsx b/packages/views/search/result-rows.tsx
index 98601b0275..95f3d2e37e 100644
--- a/packages/views/search/result-rows.tsx
+++ b/packages/views/search/result-rows.tsx
@@ -21,6 +21,7 @@ import { ActorAvatar } from "../common/actor-avatar";
import { availabilityConfig } from "../agents/presence";
import { StatusIcon } from "../issues/components";
import { ProjectIcon } from "../projects/components/project-icon";
+import { ArchivedProjectTag } from "../projects/components/project-archive";
import { useProjectStatusLabels } from "../projects/components/labels";
import { useT } from "../i18n";
import { HighlightText } from "./highlight-text";
@@ -77,6 +78,7 @@ export function ProjectResultRow({
<span className="min-w-0 flex-1 truncate">
<HighlightText text={project.title} query={query} />
</span>
+ {project.archived_at && <ArchivedProjectTag />}
<span
className={`shrink-0 text-caption ${PROJECT_STATUS_CONFIG[status]?.color ?? "text-muted-foreground"}`}
>
diff --git a/packages/views/search/root-view.tsx b/packages/views/search/root-view.tsx
index cc2f292023..42fed46cb8 100644
--- a/packages/views/search/root-view.tsx
+++ b/packages/views/search/root-view.tsx
@@ -544,15 +544,17 @@ function BestMatchGroups({
trailing={<RowHint>{t(($) => $.types.project)}</RowHint>}
/>
);
- actions.push({
- id: "new-issue",
- label: t(($) => $.best.new_issue_in, { name: project.title }),
- icon: SquarePen,
- run: () => {
- palette.close();
- openCreateIssueWithPreference({ project_id: project.id });
- },
- });
+ if (!project.archived_at) {
+ actions.push({
+ id: "new-issue",
+ label: t(($) => $.best.new_issue_in, { name: project.title }),
+ icon: SquarePen,
+ run: () => {
+ palette.close();
+ openCreateIssueWithPreference({ project_id: project.id });
+ },
+ });
+ }
}
return (
diff --git a/packages/views/search/use-server-search.ts b/packages/views/search/use-server-search.ts
index 7e5acdec65..fe1d7f9346 100644
--- a/packages/views/search/use-server-search.ts
+++ b/packages/views/search/use-server-search.ts
@@ -51,7 +51,7 @@ export function useServerSearch(query: string, options: { projects: boolean }) {
const [issueRes, projectRes] = await Promise.all([
searchIssues({ q, limit: 20, include_closed: true, signal: controller.signal }),
withProjects
- ? searchProjects({ q, limit: 10, include_closed: true, signal: controller.signal })
+ ? searchProjects({ q, limit: 10, include_closed: true, include_archived: true, signal: controller.signal })
: Promise.resolve({ projects: [] as SearchProjectResult[] }),
]);
if (!controller.signal.aborted) {
diff --git a/server/cmd/multica/cmd_autopilot.go b/server/cmd/multica/cmd_autopilot.go
index 555f51a777..4af2df758d 100644
--- a/server/cmd/multica/cmd_autopilot.go
+++ b/server/cmd/multica/cmd_autopilot.go
@@ -425,7 +425,7 @@ func runAutopilotCreate(cmd *cobra.Command, _ []string) error {
body["description"] = v
}
if v, _ := cmd.Flags().GetString("project"); v != "" {
- projectRef, err := resolveProjectID(ctx, client, v)
+ projectRef, err := resolveProjectIDForNewWork(ctx, client, v)
if err != nil {
return fmt.Errorf("resolve project: %w", err)
}
@@ -492,6 +492,8 @@ func runAutopilotUpdate(cmd *cobra.Command, args []string) error {
if v == "" {
body["project_id"] = nil
} else {
+ // Keeping a paused autopilot on its archived project is allowed;
+ // the server refuses a switch into one or a resume.
projectRef, err := resolveProjectID(ctx, client, v)
if err != nil {
return fmt.Errorf("resolve project: %w", err)
diff --git a/server/cmd/multica/cmd_id_resolver.go b/server/cmd/multica/cmd_id_resolver.go
index 44a9c30f17..a8596375b7 100644
--- a/server/cmd/multica/cmd_id_resolver.go
+++ b/server/cmd/multica/cmd_id_resolver.go
@@ -20,12 +20,18 @@ type resolvedID struct {
// Display is a best-effort label for human-facing messages. It may equal
// ID when resolution does not fetch display metadata from the server.
Display string
+ // Archived is set when the prefix matched only an archived candidate. A
+ // full UUID is not looked up, so it never sets this.
+ Archived bool
}
type idCandidate struct {
ID string
Display string
Detail string
+ // Archived candidates only resolve when no live candidate matches the
+ // prefix, so an archived project never makes a live one ambiguous.
+ Archived bool
}
func displayID(id string, full bool) string {
@@ -104,6 +110,16 @@ func resolveIDByPrefix(ctx context.Context, client *cli.APIClient, kind, input s
}
}
+ live := make([]idCandidate, 0, len(matches))
+ for _, m := range matches {
+ if !m.Archived {
+ live = append(live, m)
+ }
+ }
+ if len(live) > 0 {
+ matches = live
+ }
+
switch len(matches) {
case 0:
return resolvedID{}, fmt.Errorf("no %s found matching id prefix %q; run the list command with --full-id to copy the full UUID", kind, input)
@@ -112,7 +128,7 @@ func resolveIDByPrefix(ctx context.Context, client *cli.APIClient, kind, input s
if display == "" {
display = matches[0].ID
}
- return resolvedID{ID: matches[0].ID, Display: display}, nil
+ return resolvedID{ID: matches[0].ID, Display: display, Archived: matches[0].Archived}, nil
default:
return resolvedID{}, ambiguousIDPrefixError(kind, input, matches)
}
@@ -353,11 +369,29 @@ func resolveProjectID(ctx context.Context, client *cli.APIClient, input string)
return resolveIDByPrefix(ctx, client, "project", input, fetchProjectCandidates)
}
+// resolveProjectIDForNewWork resolves --project on creates that file new work
+// into a project (issue create, autopilot create). Updates use
+// resolveProjectID: the server alone knows whether the project changes. A prefix that
+// only matches an archived project is refused here with the restore command,
+// instead of round-tripping to the server's 409 project_archived.
+func resolveProjectIDForNewWork(ctx context.Context, client *cli.APIClient, input string) (resolvedID, error) {
+ ref, err := resolveProjectID(ctx, client, input)
+ if err != nil {
+ return resolvedID{}, err
+ }
+ if ref.Archived {
+ return resolvedID{}, fmt.Errorf("project %q is archived and accepts no new work; restore it first with: multica project restore %s", ref.Display, ref.ID)
+ }
+ return ref, nil
+}
+
func fetchProjectCandidates(ctx context.Context, client *cli.APIClient) ([]idCandidate, error) {
if client.WorkspaceID == "" {
return nil, fmt.Errorf("workspace_id is required to resolve project id prefixes")
}
- params := url.Values{"workspace_id": {client.WorkspaceID}}
+ // Archived projects are candidates too, so get / restore / issue list
+ // --project still reach them; resolveIDByPrefix prefers live projects.
+ params := url.Values{"workspace_id": {client.WorkspaceID}, "include_archived": {"true"}}
var result map[string]any
if err := client.GetJSON(ctx, "/api/projects?"+params.Encode(), &result); err != nil {
return nil, err
@@ -369,10 +403,15 @@ func fetchProjectCandidates(ctx context.Context, client *cli.APIClient) ([]idCan
if !ok {
continue
}
+ detail := strVal(p, "status")
+ if strVal(p, "archived_at") != "" {
+ detail += ", archived"
+ }
candidates = append(candidates, idCandidate{
- ID: strVal(p, "id"),
- Display: strVal(p, "title"),
- Detail: strVal(p, "status"),
+ ID: strVal(p, "id"),
+ Display: strVal(p, "title"),
+ Detail: detail,
+ Archived: strVal(p, "archived_at") != "",
})
}
return candidates, nil
diff --git a/server/cmd/multica/cmd_issue.go b/server/cmd/multica/cmd_issue.go
index e149ff2327..0073a7cc13 100644
--- a/server/cmd/multica/cmd_issue.go
+++ b/server/cmd/multica/cmd_issue.go
@@ -1618,7 +1618,12 @@ func runIssueCreate(cmd *cobra.Command, _ []string) error {
body["parent_issue_id"] = parent.ID
}
if v, _ := cmd.Flags().GetString("project"); v != "" {
- project, err := resolveProjectID(ctx, client, v)
+ resolveProject := resolveProjectIDForNewWork
+ if _, ok := body["parent_issue_id"]; ok {
+ // A sub-issue may stay in its parent's archived project; the server checks that.
+ resolveProject = resolveProjectID
+ }
+ project, err := resolveProject(ctx, client, v)
if err != nil {
return fmt.Errorf("resolve project: %w", err)
}
@@ -1860,6 +1865,8 @@ func runIssueUpdate(cmd *cobra.Command, args []string) error {
if v == "" {
body["project_id"] = nil
} else {
+ // Naming the issue's current archived project is an ordinary edit;
+ // the server refuses only a move into one (409 project_archived).
project, err := resolveProjectID(ctx, client, v)
if err != nil {
return fmt.Errorf("resolve project: %w", err)
diff --git a/server/cmd/multica/cmd_project.go b/server/cmd/multica/cmd_project.go
index 0f9332ecf3..f2bf27cbbb 100644
--- a/server/cmd/multica/cmd_project.go
+++ b/server/cmd/multica/cmd_project.go
@@ -52,6 +52,24 @@ var projectDeleteCmd = &cobra.Command{
RunE: runProjectDelete,
}
+var projectArchiveCmd = &cobra.Command{
+ Use: "archive <id>",
+ Short: "Archive a project: hide it from default lists and stop new issues from being filed into it",
+ Long: `Archive a project. It disappears from default project lists and pickers and
+accepts no new issues; its existing issues stay readable and editable, and its
+status is unchanged. Autopilots that file into it are paused. Undo with
+` + "`multica project restore <id>`" + `.`,
+ Args: exactArgs(1),
+ RunE: runProjectArchive,
+}
+
+var projectRestoreCmd = &cobra.Command{
+ Use: "restore <id>",
+ Short: "Restore an archived project (paused autopilots stay paused)",
+ Args: exactArgs(1),
+ RunE: runProjectRestore,
+}
+
var projectStatusCmd = &cobra.Command{
Use: "status <id> <status>",
Short: "Change project status",
@@ -152,6 +170,8 @@ func init() {
projectCmd.AddCommand(projectUpdateCmd)
projectCmd.AddCommand(projectDeleteCmd)
projectCmd.AddCommand(projectStatusCmd)
+ projectCmd.AddCommand(projectArchiveCmd)
+ projectCmd.AddCommand(projectRestoreCmd)
projectCmd.AddCommand(projectResourceCmd)
projectResourceCmd.AddCommand(projectResourceListCmd)
@@ -170,6 +190,7 @@ func init() {
projectListCmd.Flags().String("output", "table", "Output format: table or json")
projectListCmd.Flags().Bool("full-id", false, "Show full UUIDs in table output")
projectListCmd.Flags().String("status", "", "Filter by status")
+ projectListCmd.Flags().Bool("archived", false, "List archived projects instead of active ones")
// project get
projectGetCmd.Flags().String("output", "json", "Output format: table or json")
@@ -240,6 +261,10 @@ func init() {
// project status
projectStatusCmd.Flags().String("output", "table", "Output format: table or json")
+
+ // project archive / restore
+ projectArchiveCmd.Flags().String("output", "table", "Output format: table or json")
+ projectRestoreCmd.Flags().String("output", "table", "Output format: table or json")
}
// Project commands
@@ -260,6 +285,10 @@ func runProjectList(cmd *cobra.Command, _ []string) error {
if v, _ := cmd.Flags().GetString("status"); v != "" {
params.Set("status", v)
}
+ archivedOnly, _ := cmd.Flags().GetBool("archived")
+ if archivedOnly {
+ params.Set("include_archived", "true")
+ }
path := "/api/projects"
if len(params) > 0 {
@@ -272,6 +301,15 @@ func runProjectList(cmd *cobra.Command, _ []string) error {
}
projectsRaw, _ := result["projects"].([]any)
+ if archivedOnly {
+ archived := make([]any, 0, len(projectsRaw))
+ for _, raw := range projectsRaw {
+ if p, ok := raw.(map[string]any); ok && strVal(p, "archived_at") != "" {
+ archived = append(archived, raw)
+ }
+ }
+ projectsRaw = archived
+ }
output, _ := cmd.Flags().GetString("output")
if output == "json" {
@@ -335,12 +373,13 @@ func runProjectGet(cmd *cobra.Command, args []string) error {
if output == "table" {
actors := loadActorDisplayLookup(ctx, client)
lead := formatLead(project, actors)
- headers := []string{"ID", "TITLE", "STATUS", "LEAD", "DESCRIPTION"}
+ headers := []string{"ID", "TITLE", "STATUS", "LEAD", "ARCHIVED", "DESCRIPTION"}
rows := [][]string{{
strVal(project, "id"),
strVal(project, "title"),
strVal(project, "status"),
lead,
+ formatProjectArchived(project),
strVal(project, "description"),
}}
cli.PrintTable(os.Stdout, headers, rows)
@@ -539,6 +578,84 @@ func runProjectDelete(cmd *cobra.Command, args []string) error {
return nil
}
+// formatProjectArchived renders the archive date for table output, or "-"
+// for an active project.
+func formatProjectArchived(project map[string]any) string {
+ archivedAt := strVal(project, "archived_at")
+ if archivedAt == "" {
+ return "-"
+ }
+ if len(archivedAt) >= 10 {
+ return archivedAt[:10]
+ }
+ return archivedAt
+}
+
+func runProjectArchive(cmd *cobra.Command, args []string) error {
+ client, err := newAPIClient(cmd)
+ if err != nil {
+ return err
+ }
+
+ ctx, cancel := cli.APIContext(context.Background())
+ defer cancel()
+
+ projectRef, err := resolveProjectID(ctx, client, args[0])
+ if err != nil {
+ return fmt.Errorf("resolve project: %w", err)
+ }
+
+ var result map[string]any
+ if err := client.PostJSON(ctx, "/api/projects/"+projectRef.ID+"/archive", map[string]any{}, &result); err != nil {
+ return fmt.Errorf("archive project: %w", err)
+ }
+
+ fmt.Fprintf(os.Stderr, "Project %s archived. Restore it with `multica project restore %s`.\n", strVal(result, "title"), strVal(result, "id"))
+ if paused, _ := result["paused_autopilot_ids"].([]any); len(paused) > 0 {
+ ids := make([]string, 0, len(paused))
+ for _, id := range paused {
+ if s, ok := id.(string); ok {
+ ids = append(ids, s)
+ }
+ }
+ fmt.Fprintf(os.Stderr, "Paused %d autopilot(s) that file into it: %s\n", len(ids), strings.Join(ids, ", "))
+ }
+
+ output, _ := cmd.Flags().GetString("output")
+ if output == "json" {
+ return cli.PrintJSON(os.Stdout, result)
+ }
+ return nil
+}
+
+func runProjectRestore(cmd *cobra.Command, args []string) error {
+ client, err := newAPIClient(cmd)
+ if err != nil {
+ return err
+ }
+
+ ctx, cancel := cli.APIContext(context.Background())
+ defer cancel()
+
+ projectRef, err := resolveProjectID(ctx, client, args[0])
+ if err != nil {
+ return fmt.Errorf("resolve project: %w", err)
+ }
+
+ var result map[string]any
+ if err := client.PostJSON(ctx, "/api/projects/"+projectRef.ID+"/restore", map[string]any{}, &result); err != nil {
+ return fmt.Errorf("restore project: %w", err)
+ }
+
+ fmt.Fprintf(os.Stderr, "Project %s restored.\n", strVal(result, "title"))
+
+ output, _ := cmd.Flags().GetString("output")
+ if output == "json" {
+ return cli.PrintJSON(os.Stdout, result)
+ }
+ return nil
+}
+
func runProjectStatus(cmd *cobra.Command, args []string) error {
id := args[0]
status := args[1]
diff --git a/server/cmd/multica/cmd_project_archive_test.go b/server/cmd/multica/cmd_project_archive_test.go
new file mode 100644
index 0000000000..c2a09615b6
--- /dev/null
+++ b/server/cmd/multica/cmd_project_archive_test.go
@@ -0,0 +1,237 @@
+package main
+
+import (
+ "context"
+ "encoding/json"
+ "net/http"
+ "net/http/httptest"
+ "net/url"
+ "strings"
+ "testing"
+
+ "github.com/multica-ai/multica/server/internal/cli"
+ "github.com/spf13/cobra"
+)
+
+const (
+ archiveTestProjectID = "11111111-1111-1111-1111-111111111111"
+ archiveTestArchivedID = "22222222-2222-2222-2222-222222222222"
+)
+
+func newProjectArchiveTestServer(t *testing.T, calls *[]string, listQueries *[]string) *httptest.Server {
+ t.Helper()
+ srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ *calls = append(*calls, r.Method+" "+r.URL.Path)
+ switch {
+ case r.Method == http.MethodGet && r.URL.Path == "/api/projects":
+ *listQueries = append(*listQueries, r.URL.RawQuery)
+ projects := []any{
+ map[string]any{"id": archiveTestProjectID, "title": "Active", "status": "in_progress", "archived_at": nil},
+ }
+ if r.URL.Query().Get("include_archived") == "true" {
+ projects = append(projects, map[string]any{
+ "id": archiveTestArchivedID, "title": "Old", "status": "completed", "archived_at": "2026-11-01T00:00:00Z",
+ })
+ }
+ json.NewEncoder(w).Encode(map[string]any{"projects": projects, "total": len(projects)})
+ case r.Method == http.MethodPost && r.URL.Path == "/api/projects/"+archiveTestArchivedID+"/archive":
+ json.NewEncoder(w).Encode(map[string]any{
+ "id": archiveTestArchivedID, "title": "Old", "archived_at": "2026-11-15T00:00:00Z",
+ "paused_autopilot_ids": []string{"33333333-3333-3333-3333-333333333333"},
+ })
+ case r.Method == http.MethodPost && r.URL.Path == "/api/projects/"+archiveTestArchivedID+"/restore":
+ json.NewEncoder(w).Encode(map[string]any{"id": archiveTestArchivedID, "title": "Old", "archived_at": nil})
+ default:
+ http.NotFound(w, r)
+ }
+ }))
+ t.Setenv("MULTICA_SERVER_URL", srv.URL)
+ t.Setenv("MULTICA_WORKSPACE_ID", "ws-1")
+ t.Setenv("MULTICA_TOKEN", "test-token")
+ return srv
+}
+
+func TestRunProjectArchiveAndRestoreResolveArchivedPrefix(t *testing.T) {
+ var calls, listQueries []string
+ srv := newProjectArchiveTestServer(t, &calls, &listQueries)
+ defer srv.Close()
+
+ archive := &cobra.Command{Use: "archive"}
+ archive.Flags().String("output", "json", "")
+ if err := runProjectArchive(archive, []string{"22222222"}); err != nil {
+ t.Fatalf("runProjectArchive: %v", err)
+ }
+ restore := &cobra.Command{Use: "restore"}
+ restore.Flags().String("output", "json", "")
+ if err := runProjectRestore(restore, []string{"22222222"}); err != nil {
+ t.Fatalf("runProjectRestore: %v", err)
+ }
+
+ want := []string{
+ "GET /api/projects",
+ "POST /api/projects/" + archiveTestArchivedID + "/archive",
+ "GET /api/projects",
+ "POST /api/projects/" + archiveTestArchivedID + "/restore",
+ }
+ if len(calls) != len(want) {
+ t.Fatalf("calls = %v, want %v", calls, want)
+ }
+ for i := range want {
+ if calls[i] != want[i] {
+ t.Fatalf("calls[%d] = %q, want %q", i, calls[i], want[i])
+ }
+ }
+ for _, q := range listQueries {
+ if v, _ := url.ParseQuery(q); v.Get("include_archived") != "true" {
+ t.Fatalf("prefix resolution must include archived projects, got query %q", q)
+ }
+ }
+}
+
+func TestRunProjectListArchivedOnly(t *testing.T) {
+ var calls, listQueries []string
+ srv := newProjectArchiveTestServer(t, &calls, &listQueries)
+ defer srv.Close()
+
+ cmd := &cobra.Command{Use: "list"}
+ cmd.Flags().String("output", "json", "")
+ cmd.Flags().Bool("full-id", false, "")
+ cmd.Flags().String("status", "", "")
+ cmd.Flags().Bool("archived", false, "")
+ _ = cmd.Flags().Set("archived", "true")
+
+ out, err := captureStdout(t, func() error { return runProjectList(cmd, nil) })
+ if err != nil {
+ t.Fatalf("runProjectList: %v", err)
+ }
+ var projects []map[string]any
+ if err := json.Unmarshal([]byte(out), &projects); err != nil {
+ t.Fatalf("decode output %q: %v", out, err)
+ }
+ if len(projects) != 1 || projects[0]["id"] != archiveTestArchivedID {
+ t.Fatalf("--archived listed %v, want only the archived project", projects)
+ }
+}
+
+func TestResolveProjectIDPrefersLiveProjectOnSharedPrefix(t *testing.T) {
+ const (
+ live = "11111111-aaaa-1111-1111-111111111111"
+ archived = "11111111-bbbb-1111-1111-111111111111"
+ shelved = "22222222-2222-2222-2222-222222222222"
+ )
+ srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ json.NewEncoder(w).Encode(map[string]any{"projects": []any{
+ map[string]any{"id": live, "title": "Live", "status": "in_progress", "archived_at": nil},
+ map[string]any{"id": archived, "title": "Old", "status": "completed", "archived_at": "2026-11-01T00:00:00Z"},
+ map[string]any{"id": shelved, "title": "Shelved", "status": "paused", "archived_at": "2026-11-01T00:00:00Z"},
+ }})
+ }))
+ defer srv.Close()
+ client := cli.NewAPIClient(srv.URL, "ws-1", "test-token")
+ ctx := context.Background()
+
+ for name, resolve := range map[string]func(context.Context, *cli.APIClient, string) (resolvedID, error){
+ "read": resolveProjectID,
+ "new work": resolveProjectIDForNewWork,
+ } {
+ ref, err := resolve(ctx, client, "11111111")
+ if err != nil || ref.ID != live {
+ t.Fatalf("%s: shared prefix resolved to %+v, %v; want the live project", name, ref, err)
+ }
+ }
+
+ ref, err := resolveProjectID(ctx, client, "22222222")
+ if err != nil || ref.ID != shelved || !ref.Archived {
+ t.Fatalf("read of an archived-only prefix = %+v, %v; want the archived project", ref, err)
+ }
+ if _, err := resolveProjectIDForNewWork(ctx, client, "22222222"); err == nil ||
+ !strings.Contains(err.Error(), "archived") || !strings.Contains(err.Error(), "multica project restore "+shelved) {
+ t.Fatalf("new work into an archived-only prefix: err = %v, want the restore hint", err)
+ }
+}
+
+// archivedProjectWriteServer lists a live and an archived project sharing a
+// prefix and, like the API, accepts a write naming the record's current
+// archived project but refuses a move into it with 409 project_archived.
+func archivedProjectWriteServer(t *testing.T, recordPath, method, currentProject string, sent *[]any) *httptest.Server {
+ t.Helper()
+ srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ switch {
+ case r.Method == http.MethodGet && r.URL.Path == "/api/projects":
+ json.NewEncoder(w).Encode(map[string]any{"projects": []any{
+ map[string]any{"id": "11111111-aaaa-1111-1111-111111111111", "title": "Live", "status": "in_progress", "archived_at": nil},
+ map[string]any{"id": archiveTestArchivedID, "title": "Old", "status": "completed", "archived_at": "2026-11-01T00:00:00Z"},
+ }})
+ case r.URL.Path == recordPath && r.Method == http.MethodGet:
+ json.NewEncoder(w).Encode(map[string]any{"id": "rec", "project_id": currentProject})
+ case r.URL.Path == recordPath && r.Method == method:
+ var body map[string]any
+ if err := json.NewDecoder(r.Body).Decode(&body); err != nil {
+ t.Errorf("decode body: %v", err)
+ }
+ *sent = append(*sent, body["project_id"])
+ if body["project_id"] == archiveTestArchivedID && currentProject != archiveTestArchivedID {
+ w.WriteHeader(http.StatusConflict)
+ json.NewEncoder(w).Encode(map[string]any{"code": "project_archived", "error": "project is archived; restore it before adding issues"})
+ return
+ }
+ json.NewEncoder(w).Encode(map[string]any{"id": "rec", "project_id": body["project_id"]})
+ default:
+ http.NotFound(w, r)
+ }
+ }))
+ setCLITestServerEnv(t, srv.URL)
+ return srv
+}
+
+func TestUpdateCommandsKeepEditingInsideArchivedProject(t *testing.T) {
+ const (
+ issueID = "44444444-4444-4444-8444-444444444444"
+ autopilotID = "55555555-5555-4555-8555-555555555555"
+ otherID = "66666666-6666-4666-8666-666666666666"
+ )
+ commands := map[string]struct {
+ path, method string
+ run func(project string) error
+ }{
+ "issue update": {"/api/issues/" + issueID, http.MethodPut, func(project string) error {
+ cmd := newIssueUpdateTestCmd()
+ _ = cmd.Flags().Set("title", "renamed")
+ _ = cmd.Flags().Set("project", project)
+ return runIssueUpdate(cmd, []string{issueID})
+ }},
+ "autopilot update": {"/api/autopilots/" + autopilotID, http.MethodPatch, func(project string) error {
+ cmd := newAutopilotUpdateTestCmd()
+ _ = cmd.Flags().Set("title", "renamed")
+ _ = cmd.Flags().Set("project", project)
+ return runAutopilotUpdate(cmd, []string{autopilotID})
+ }},
+ }
+ for name, c := range commands {
+ t.Run(name, func(t *testing.T) {
+ // Already in the archived project: short prefix and full UUID behave the same.
+ for _, ref := range []string{"22222222", archiveTestArchivedID} {
+ var sent []any
+ srv := archivedProjectWriteServer(t, c.path, c.method, archiveTestArchivedID, &sent)
+ if err := c.run(ref); err != nil {
+ t.Fatalf("edit inside archived project with --project %s: %v", ref, err)
+ }
+ if len(sent) != 1 || sent[0] != archiveTestArchivedID {
+ t.Fatalf("--project %s sent project_id %v, want %s", ref, sent, archiveTestArchivedID)
+ }
+ srv.Close()
+ }
+
+ // Moving in from elsewhere is still refused, again the same for both forms.
+ for _, ref := range []string{"22222222", archiveTestArchivedID} {
+ var sent []any
+ srv := archivedProjectWriteServer(t, c.path, c.method, otherID, &sent)
+ err := c.run(ref)
+ if err == nil || !strings.Contains(err.Error(), "archived") {
+ t.Fatalf("move into archived project with --project %s: err = %v, want project_archived", ref, err)
+ }
+ srv.Close()
+ }
+ })
+ }
+}
diff --git a/server/cmd/server/router.go b/server/cmd/server/router.go
index 330a7265b2..6d8fa175eb 100644
--- a/server/cmd/server/router.go
+++ b/server/cmd/server/router.go
@@ -2286,6 +2286,8 @@ func NewRouterWithOptions(pool *pgxpool.Pool, hub *realtime.Hub, bus *events.Bus
r.Get("/", h.GetProject)
r.Put("/", h.UpdateProject)
r.Delete("/", h.DeleteProject)
+ r.Post("/archive", h.ArchiveProject)
+ r.Post("/restore", h.RestoreProject)
r.Post("/workflow", h.SetProjectWorkflow)
r.Get("/members", h.ListProjectMembers)
r.Post("/members", h.AddProjectMembers)
diff --git a/server/internal/daemon/daemon.go b/server/internal/daemon/daemon.go
index 58ab470517..6813770245 100644
--- a/server/internal/daemon/daemon.go
+++ b/server/internal/daemon/daemon.go
@@ -8114,6 +8114,7 @@ func (d *Daemon) runTask(ctx context.Context, task Task, provider string, slot i
ProjectID: task.ProjectID,
ProjectTitle: task.ProjectTitle,
ProjectDescription: task.ProjectDescription,
+ ProjectArchived: task.ProjectArchived,
ProjectResources: convertProjectResourcesForEnv(task.ProjectResources),
ChatSessionID: task.ChatSessionID,
ChatChannelType: task.ChatChannelType,
diff --git a/server/internal/daemon/execenv/execenv.go b/server/internal/daemon/execenv/execenv.go
index 2f4c5e3411..72d864f862 100644
--- a/server/internal/daemon/execenv/execenv.go
+++ b/server/internal/daemon/execenv/execenv.go
@@ -160,6 +160,7 @@ type TaskContextForEnv struct {
ProjectID string // active project for this task, when present
ProjectTitle string // human-readable project title
ProjectDescription string // durable project-level context, rendered into the brief's Project Context section
+ ProjectArchived bool // project is archived; rendered as a note in the Project Context section
ProjectResources []ProjectResourceForEnv // resources attached to the project
ChatSessionID string // non-empty for chat tasks
// ChatChannelType is the IM platform behind a chat session ("slack",
diff --git a/server/internal/daemon/execenv/execenv_test.go b/server/internal/daemon/execenv/execenv_test.go
index 8e7f88a839..50afd272e6 100644
--- a/server/internal/daemon/execenv/execenv_test.go
+++ b/server/internal/daemon/execenv/execenv_test.go
@@ -735,6 +735,21 @@ func TestProjectReposReplaceWorkspaceReposInMetaSkill(t *testing.T) {
}
}
+func TestProjectContextNotesArchivedProject(t *testing.T) {
+ t.Parallel()
+ for _, archived := range []bool{false, true} {
+ var b strings.Builder
+ writeProjectContext(&b, TaskContextForEnv{
+ ProjectID: "22222222-3333-4444-5555-666666666666",
+ ProjectTitle: "Old Project",
+ ProjectArchived: archived,
+ })
+ if got := strings.Contains(b.String(), "This project is **archived**"); got != archived {
+ t.Errorf("archived=%v: brief archived note present=%v:\n%s", archived, got, b.String())
+ }
+ }
+}
+
func TestWriteProjectResourcesSkippedWhenNone(t *testing.T) {
t.Parallel()
dir := t.TempDir()
diff --git a/server/internal/daemon/execenv/runtime_config_sections.go b/server/internal/daemon/execenv/runtime_config_sections.go
index 9a76416b1a..d150e9d7cb 100644
--- a/server/internal/daemon/execenv/runtime_config_sections.go
+++ b/server/internal/daemon/execenv/runtime_config_sections.go
@@ -522,6 +522,9 @@ func writeProjectContext(b *strings.Builder, ctx TaskContextForEnv) {
if ctx.ProjectTitle != "" {
fmt.Fprintf(b, "The active project for this task is **%s**.\n\n", ctx.ProjectTitle)
}
+ if ctx.ProjectArchived {
+ b.WriteString("This project is **archived**: existing issues stay readable and editable, but it accepts no new issues — the API returns 409 `project_archived` for `--project` writes into it. Finish the work at hand; do not restore the project unless the user asks.\n\n")
+ }
if desc := strings.TrimSpace(ctx.ProjectDescription); desc != "" {
b.WriteString("Project description — durable context the project owner set for work in this project:\n\n")
b.WriteString(desc)
diff --git a/server/internal/daemon/types.go b/server/internal/daemon/types.go
index 6229c4f687..65c66b224c 100644
--- a/server/internal/daemon/types.go
+++ b/server/internal/daemon/types.go
@@ -115,6 +115,7 @@ type Task struct {
ProjectID string `json:"project_id,omitempty"` // active project for this task, when present
ProjectTitle string `json:"project_title,omitempty"` // human-readable project title for context injection
ProjectDescription string `json:"project_description,omitempty"` // durable project-level context injected into the brief
+ ProjectArchived bool `json:"project_archived,omitempty"` // project is archived; the brief says so
ProjectResources []ProjectResourceData `json:"project_resources,omitempty"` // project-scoped resources to expose to the agent
IsLeaderTask bool `json:"is_leader_task,omitempty"` // true when executing in the squad-leader coordinator role
LeaderRoleResolved bool `json:"leader_role_resolved,omitempty"` // server capability: IsLeaderTask/SquadID authoritatively answer "is this a leader run". Absent on servers predating it — those before #4951 never sent is_leader_task at all, later ones send it without this guarantee — so taskIsSquadLeader falls back to the briefing marker for both (MUL-5811)
diff --git a/server/internal/handler/agent.go b/server/internal/handler/agent.go
index 32989516ef..066b36509e 100644
--- a/server/internal/handler/agent.go
+++ b/server/internal/handler/agent.go
@@ -465,6 +465,7 @@ type AgentTaskResponse struct {
ProjectID string `json:"project_id,omitempty"` // issue's project, when present
ProjectTitle string `json:"project_title,omitempty"` // for surfacing in agent context
ProjectDescription string `json:"project_description,omitempty"` // durable project-level context injected into the brief
+ ProjectArchived bool `json:"project_archived,omitempty"` // project is archived: the brief tells the agent not to file new issues into it
ProjectResources []ProjectResourceData `json:"project_resources,omitempty"` // resources attached to the project
CreatedAt string `json:"created_at"`
PriorSessionID string `json:"prior_session_id,omitempty"` // session ID from a previous task on same issue
diff --git a/server/internal/handler/autopilot.go b/server/internal/handler/autopilot.go
index 7d9cb053c3..39d8489d55 100644
--- a/server/internal/handler/autopilot.go
+++ b/server/internal/handler/autopilot.go
@@ -897,6 +897,10 @@ func (h *Handler) CreateAutopilot(w http.ResponseWriter, r *http.Request) {
if !ok {
return
}
+ if h.projectIsArchived(r.Context(), h.Queries, projectID, wsUUID) {
+ writeProjectArchived(w)
+ return
+ }
// Parse before insert so a malformed payload doesn't open a transaction.
subscribers, ok := parseAutopilotSubscribers(w, req.Subscribers)
@@ -1209,6 +1213,15 @@ func (h *Handler) UpdateAutopilot(w http.ResponseWriter, r *http.Request) {
if req.Status != nil {
nextStatus = *req.Status
}
+ // An archived project takes no new issues, so pointing an autopilot at
+ // one or resuming one that still targets one is refused. Editing a
+ // paused autopilot in place stays allowed.
+ projectChanged := params.ProjectID != prev.ProjectID
+ resuming := nextStatus == "active" && prev.Status != "active"
+ if (projectChanged || resuming) && h.projectIsArchived(r.Context(), qtx, params.ProjectID, prev.WorkspaceID) {
+ writeProjectArchived(w)
+ return
+ }
validateAssignee := typeSent || idSent || (req.Status != nil && *req.Status == "active")
if validateAssignee && !h.validateAutopilotAssigneeForSave(
w, r, qtx, nextType, nextID, prev.WorkspaceID, nextStatus == "active",
diff --git a/server/internal/handler/issue.go b/server/internal/handler/issue.go
index 7c4a1cf6c5..8e42933e70 100644
--- a/server/internal/handler/issue.go
+++ b/server/internal/handler/issue.go
@@ -3025,16 +3025,21 @@ func (h *Handler) QuickCreateIssue(w http.ResponseWriter, r *http.Request) {
if !ok {
return
}
- if _, err := h.Queries.GetProjectInWorkspace(r.Context(), db.GetProjectInWorkspaceParams{
+ project, err := h.Queries.GetProjectInWorkspace(r.Context(), db.GetProjectInWorkspaceParams{
ID: pid,
WorkspaceID: wsUUID,
- }); err != nil {
+ })
+ if err != nil {
writeError(w, http.StatusBadRequest, "project not found")
return
}
if !h.requireProjectVisible(w, r, uuidToString(wsUUID), pid, http.StatusBadRequest, "project not found") {
return
}
+ if project.ArchivedAt.Valid {
+ writeProjectArchived(w)
+ return
+ }
projectUUID = pid
}
@@ -3712,6 +3717,10 @@ func (h *Handler) CreateIssue(w http.ResponseWriter, r *http.Request) {
writeError(w, http.StatusBadRequest, "project not found in this workspace")
return
}
+ if errors.Is(err, service.ErrProjectArchived) {
+ writeProjectArchived(w)
+ return
+ }
if errors.Is(err, service.ErrIssueLabelNotFound) {
writeError(w, http.StatusBadRequest, "one or more labels not found in this workspace")
return
@@ -4187,10 +4196,11 @@ func (h *Handler) UpdateIssue(w http.ResponseWriter, r *http.Request) {
if !ok {
return
}
- if _, err := h.Queries.GetProjectInWorkspace(r.Context(), db.GetProjectInWorkspaceParams{
+ project, err := h.Queries.GetProjectInWorkspace(r.Context(), db.GetProjectInWorkspaceParams{
ID: projectUUID,
WorkspaceID: prevIssue.WorkspaceID,
- }); err != nil {
+ })
+ if err != nil {
if !isNotFound(err) {
slog.Error("update issue: validate project scope",
append(logger.RequestAttrs(r), "project_id", uuidToString(projectUUID), "error", err)...)
@@ -4203,6 +4213,11 @@ func (h *Handler) UpdateIssue(w http.ResponseWriter, r *http.Request) {
if !h.requireProjectVisible(w, r, uuidToString(prevIssue.WorkspaceID), projectUUID, http.StatusBadRequest, "project not found in this workspace") {
return
}
+ // Re-sending the issue's current project is a no-op, not a move.
+ if project.ArchivedAt.Valid && project.ID != prevIssue.ProjectID {
+ writeProjectArchived(w)
+ return
+ }
params.ProjectID = projectUUID
} else {
params.ProjectID = pgtype.UUID{Valid: false}
@@ -4882,10 +4897,11 @@ func (h *Handler) BatchUpdateIssues(w http.ResponseWriter, r *http.Request) {
if !ok {
return
}
- if _, err := h.Queries.GetProjectInWorkspace(r.Context(), db.GetProjectInWorkspaceParams{
+ project, err := h.Queries.GetProjectInWorkspace(r.Context(), db.GetProjectInWorkspaceParams{
ID: projectUUID,
WorkspaceID: wsUUID,
- }); err != nil {
+ })
+ if err != nil {
if !isNotFound(err) {
slog.Error("batch update issues: validate project scope",
append(logger.RequestAttrs(r), "project_id", uuidToString(projectUUID), "error", err)...)
@@ -4898,6 +4914,10 @@ func (h *Handler) BatchUpdateIssues(w http.ResponseWriter, r *http.Request) {
if !h.requireProjectVisible(w, r, uuidToString(wsUUID), projectUUID, http.StatusBadRequest, "project not found in this workspace") {
return
}
+ if project.ArchivedAt.Valid {
+ writeProjectArchived(w)
+ return
+ }
batchProjectID = projectUUID
}
diff --git a/server/internal/handler/issue_move.go b/server/internal/handler/issue_move.go
index 76c51df936..116ab5e2ad 100644
--- a/server/internal/handler/issue_move.go
+++ b/server/internal/handler/issue_move.go
@@ -70,14 +70,12 @@ func (h *Handler) MoveIssue(w http.ResponseWriter, r *http.Request) {
if !valid {
return
}
- var exists bool
+ var exists, archived bool
err := h.DB.QueryRow(r.Context(), `
- SELECT EXISTS (
- SELECT 1
- FROM project
- WHERE workspace_id = $1 AND id = $2
- )
- `, current.WorkspaceID, *projectID).Scan(&exists)
+ SELECT
+ EXISTS (SELECT 1 FROM project WHERE workspace_id = $1 AND id = $2),
+ EXISTS (SELECT 1 FROM project WHERE workspace_id = $1 AND id = $2 AND archived_at IS NOT NULL)
+ `, current.WorkspaceID, *projectID).Scan(&exists, &archived)
if err != nil {
writeIssueTableQueryFailure(w, r, "failed to validate move project")
return
@@ -89,6 +87,11 @@ func (h *Handler) MoveIssue(w http.ResponseWriter, r *http.Request) {
if !h.requireProjectVisible(w, r, uuidToString(current.WorkspaceID), *projectID, http.StatusBadRequest, "project not found in this workspace") {
return
}
+ // Reordering inside an archived project is fine; moving into one is not.
+ if archived && *projectID != current.ProjectID {
+ writeProjectArchived(w)
+ return
+ }
}
beforeID, ok := decodeIssueMoveAnchor(w, fields["before_id"], "before_id")
diff --git a/server/internal/handler/issue_workflow.go b/server/internal/handler/issue_workflow.go
index a507ac2950..c3a94cfbe1 100644
--- a/server/internal/handler/issue_workflow.go
+++ b/server/internal/handler/issue_workflow.go
@@ -154,7 +154,8 @@ func issueWorkflowToResponse(row db.IssueWorkflow, def issueworkflow.Definition,
// without a workflow, or pointing at a deleted one, count for Default.
// Projects the caller may not see (visible returns false) are left out.
func (h *Handler) projectIDsByWorkflow(ctx context.Context, wsUUID pgtype.UUID, rows []db.IssueWorkflow, visible func(db.Project) bool) (map[string][]string, error) {
- projects, err := h.Queries.ListProjects(ctx, db.ListProjectsParams{WorkspaceID: wsUUID})
+ // Archived projects still run on their workflow, so they count as users.
+ projects, err := h.Queries.ListProjects(ctx, db.ListProjectsParams{WorkspaceID: wsUUID, IncludeArchived: true})
if err != nil {
return nil, err
}
@@ -189,7 +190,7 @@ func (h *Handler) workflowStatusCatalog(ctx context.Context, q *db.Queries, wsUU
if err := issuestatus.Ensure(ctx, q, wsUUID); err != nil {
return nil, err
}
- rows, err := q.ListIssueStatusEntries(ctx, db.ListIssueStatusEntriesParams{WorkspaceID: wsUUID, IncludeArchived: true})
+ rows, err := q.ListIssueStatusEntries(ctx, db.ListIssueStatusEntriesParams{WorkspaceID: wsUUID})
if err != nil {
return nil, err
}
diff --git a/server/internal/handler/project.go b/server/internal/handler/project.go
index 4f89f504fc..d83b6fe32e 100644
--- a/server/internal/handler/project.go
+++ b/server/internal/handler/project.go
@@ -53,6 +53,12 @@ type ProjectResponse struct {
// Visibility is "workspace" (every member) or "private" (project members
// plus workspace owners/admins). (MUL-8472)
Visibility string `json:"visibility"`
+ // ArchivedAt is non-null while the project is archived: hidden from
+ // default lists and pickers, closed to new issues, otherwise intact.
+ // Orthogonal to Status. (MUL-8861)
+ ArchivedAt *string `json:"archived_at"`
+ ArchivedByType *string `json:"archived_by_type"`
+ ArchivedByID *string `json:"archived_by_id"`
}
func projectToResponse(p db.Project) ProjectResponse {
@@ -74,6 +80,10 @@ func projectToResponse(p db.Project) ProjectResponse {
UpdatedAt: timestampToString(p.UpdatedAt),
WorkflowID: uuidToPtr(p.WorkflowID),
Visibility: projectVisibilityOrDefault(p.Visibility),
+
+ ArchivedAt: timestampToPtr(p.ArchivedAt),
+ ArchivedByType: textToPtr(p.ArchivedByType),
+ ArchivedByID: uuidToPtr(p.ArchivedByID),
}
}
@@ -181,10 +191,13 @@ func (h *Handler) ListProjects(w http.ResponseWriter, r *http.Request) {
if p := r.URL.Query().Get("priority"); p != "" {
priorityFilter = pgtype.Text{String: p, Valid: true}
}
+ // Archived projects are opt-in so agents resolving a project by name only
+ // see the ones that still accept work.
projects, err := h.Queries.ListProjects(r.Context(), db.ListProjectsParams{
- WorkspaceID: wsUUID,
- Status: statusFilter,
- Priority: priorityFilter,
+ WorkspaceID: wsUUID,
+ Status: statusFilter,
+ Priority: priorityFilter,
+ IncludeArchived: r.URL.Query().Get("include_archived") == "true",
})
if err != nil {
writeError(w, http.StatusInternalServerError, "failed to list projects")
@@ -831,7 +844,7 @@ type SearchProjectResponse struct {
}
// buildProjectSearchQuery builds a dynamic SQL query for project search.
-func buildProjectSearchQuery(phrase string, terms []string, includeClosed bool, hiddenProjectIDs ...pgtype.UUID) (string, []any) {
+func buildProjectSearchQuery(phrase string, terms []string, includeClosed, includeArchived bool, hiddenProjectIDs ...pgtype.UUID) (string, []any) {
phrase = strings.ToLower(phrase)
for i, t := range terms {
terms[i] = strings.ToLower(t)
@@ -889,6 +902,9 @@ func buildProjectSearchQuery(phrase string, terms []string, includeClosed bool,
if !includeClosed {
whereClause += " AND p.status NOT IN ('completed', 'cancelled')"
}
+ if !includeArchived {
+ whereClause += " AND p.archived_at IS NULL"
+ }
// --- ORDER BY ranking ---
var rankCases []string
@@ -922,8 +938,10 @@ func buildProjectSearchQuery(phrase string, terms []string, includeClosed bool,
// list. Demote ahead of rankExpr, with the same direct-hit exception as
// issue search (see buildSearchQuery): an exact title means the user is
// targeting that one project.
+ // Archived projects sink below cancelled ones for the same reason: they
+ // stay findable, but are rarely what the user is reaching for.
cancelledRank := fmt.Sprintf(
- "CASE WHEN p.status = 'cancelled' AND LOWER(p.title) <> %s THEN 1 ELSE 0 END",
+ "CASE WHEN LOWER(p.title) = %s THEN 0 WHEN p.archived_at IS NOT NULL THEN 2 WHEN p.status = 'cancelled' THEN 1 ELSE 0 END",
phraseParam,
)
@@ -958,6 +976,7 @@ func buildProjectSearchQuery(phrase string, terms []string, includeClosed bool,
p.status, p.priority, p.lead_type, p.lead_id,
p.start_date, p.due_date,
p.created_at, p.updated_at, p.visibility, p.creator_type, p.creator_id,
+ p.archived_at, p.archived_by_type, p.archived_by_id,
%s AS match_source
FROM project p
WHERE p.workspace_id = %s AND %s
@@ -1002,6 +1021,7 @@ func (h *Handler) SearchProjects(w http.ResponseWriter, r *http.Request) {
}
includeClosed := r.URL.Query().Get("include_closed") == "true"
+ includeArchived := r.URL.Query().Get("include_archived") == "true"
wsUUID, ok := parseUUIDOrBadRequest(w, workspaceID, "workspace_id")
if !ok {
@@ -1013,7 +1033,7 @@ func (h *Handler) SearchProjects(w http.ResponseWriter, r *http.Request) {
if !ok {
return
}
- sqlQuery, args := buildProjectSearchQuery(q, terms, includeClosed, hidden.Param()...)
+ sqlQuery, args := buildProjectSearchQuery(q, terms, includeClosed, includeArchived, hidden.Param()...)
args[1] = wsUUID
args[len(args)-2] = limit
args[len(args)-1] = offset
@@ -1044,6 +1064,9 @@ func (h *Handler) SearchProjects(w http.ResponseWriter, r *http.Request) {
&row.project.Visibility,
&row.project.CreatorType,
&row.project.CreatorID,
+ &row.project.ArchivedAt,
+ &row.project.ArchivedByType,
+ &row.project.ArchivedByID,
&row.matchSource,
); err != nil {
return fmt.Errorf("scan: %w", err)
diff --git a/server/internal/handler/project_archive.go b/server/internal/handler/project_archive.go
new file mode 100644
index 0000000000..e26ab9568f
--- /dev/null
+++ b/server/internal/handler/project_archive.go
@@ -0,0 +1,175 @@
+package handler
+
+import (
+ "context"
+ "errors"
+ "net/http"
+
+ "github.com/go-chi/chi/v5"
+ "github.com/jackc/pgx/v5"
+ "github.com/jackc/pgx/v5/pgtype"
+ "github.com/multica-ai/multica/server/internal/util"
+ db "github.com/multica-ai/multica/server/pkg/db/generated"
+ "github.com/multica-ai/multica/server/pkg/protocol"
+)
+
+// projectArchivedCode is the machine-readable code for writes that try to
+// put new work into an archived project. Clients key their "restore it
+// first" copy off it.
+const projectArchivedCode = "project_archived"
+
+func writeProjectArchived(w http.ResponseWriter) {
+ writeErrorCode(w, http.StatusConflict, projectArchivedCode, "project is archived; restore it before adding issues")
+}
+
+// projectIsArchived reports whether a workspace project is archived. A
+// project that cannot be read reports false: callers have already validated
+// existence and only need the archive bit.
+func (h *Handler) projectIsArchived(ctx context.Context, q *db.Queries, projectID, workspaceID pgtype.UUID) bool {
+ if !projectID.Valid {
+ return false
+ }
+ project, err := q.GetProjectInWorkspace(ctx, db.GetProjectInWorkspaceParams{
+ ID: projectID,
+ WorkspaceID: workspaceID,
+ })
+ return err == nil && project.ArchivedAt.Valid
+}
+
+// ArchiveProjectResponse is the archived project plus the autopilots the
+// archive paused, so callers can tell the user what stopped.
+type ArchiveProjectResponse struct {
+ ProjectResponse
+ PausedAutopilotIDs []string `json:"paused_autopilot_ids"`
+}
+
+// loadArchivableProject runs the gate shared by archive and restore: the
+// same visibility and member gate as UpdateProject, so anyone who can edit
+// the project can archive or restore it.
+func (h *Handler) loadArchivableProject(w http.ResponseWriter, r *http.Request) (db.Project, string, bool) {
+ workspaceID := h.resolveWorkspaceID(r)
+ idUUID, ok := parseUUIDOrBadRequest(w, chi.URLParam(r, "id"), "project id")
+ if !ok {
+ return db.Project{}, "", false
+ }
+ wsUUID, ok := parseUUIDOrBadRequest(w, workspaceID, "workspace id")
+ if !ok {
+ return db.Project{}, "", false
+ }
+ project, err := h.Queries.GetProjectInWorkspace(r.Context(), db.GetProjectInWorkspaceParams{
+ ID: idUUID, WorkspaceID: wsUUID,
+ })
+ if err != nil {
+ writeError(w, http.StatusNotFound, "project not found")
+ return db.Project{}, "", false
+ }
+ if !h.requireProjectVisible(w, r, workspaceID, project.ID, http.StatusNotFound, "project not found") {
+ return db.Project{}, "", false
+ }
+ if _, ok := requireUserID(w, r); !ok {
+ return db.Project{}, "", false
+ }
+ return project, workspaceID, true
+}
+
+func (h *Handler) projectResponseWithCounts(ctx context.Context, project db.Project) ProjectResponse {
+ resp := projectToResponse(project)
+ resp.IssueCount, resp.DoneCount = h.loadProjectIssueStats(ctx, project.WorkspaceID, project.ID)
+ resp.ResourceCount = h.loadProjectResourceCount(ctx, project.ID)
+ return resp
+}
+
+func (h *Handler) ArchiveProject(w http.ResponseWriter, r *http.Request) {
+ project, workspaceID, ok := h.loadArchivableProject(w, r)
+ if !ok {
+ return
+ }
+ if project.ArchivedAt.Valid {
+ writeError(w, http.StatusConflict, "project is already archived")
+ return
+ }
+ actorType, actorID := h.resolveActor(r, requestUserID(r), workspaceID)
+ actorUUID, err := util.ParseUUID(actorID)
+ if err != nil {
+ writeError(w, http.StatusInternalServerError, "failed to resolve actor")
+ return
+ }
+
+ tx, err := h.TxStarter.Begin(r.Context())
+ if err != nil {
+ writeError(w, http.StatusInternalServerError, "failed to archive project")
+ return
+ }
+ defer tx.Rollback(r.Context())
+ qtx := h.Queries.WithTx(tx)
+
+ archived, err := qtx.ArchiveProject(r.Context(), db.ArchiveProjectParams{
+ ID: project.ID,
+ WorkspaceID: project.WorkspaceID,
+ ArchivedByType: pgtype.Text{String: actorType, Valid: true},
+ ArchivedByID: actorUUID,
+ })
+ if errors.Is(err, pgx.ErrNoRows) {
+ writeError(w, http.StatusConflict, "project is already archived")
+ return
+ }
+ if err != nil {
+ writeError(w, http.StatusInternalServerError, "failed to archive project")
+ return
+ }
+ paused, err := qtx.PauseAutopilotsByArchivedProject(r.Context(), db.PauseAutopilotsByArchivedProjectParams{
+ WorkspaceID: project.WorkspaceID,
+ ProjectID: project.ID,
+ })
+ if err != nil {
+ writeError(w, http.StatusInternalServerError, "failed to pause project autopilots")
+ return
+ }
+ if err := tx.Commit(r.Context()); err != nil {
+ writeError(w, http.StatusInternalServerError, "failed to archive project")
+ return
+ }
+
+ resp := ArchiveProjectResponse{
+ ProjectResponse: h.projectResponseWithCounts(r.Context(), archived),
+ PausedAutopilotIDs: make([]string, 0, len(paused)),
+ }
+ h.publish(protocol.EventProjectUpdated, workspaceID, actorType, actorID, map[string]any{"project": resp.ProjectResponse})
+ for _, autopilot := range paused {
+ resp.PausedAutopilotIDs = append(resp.PausedAutopilotIDs, uuidToString(autopilot.ID))
+ h.publish(protocol.EventAutopilotUpdated, workspaceID, actorType, actorID, map[string]any{
+ "autopilot": autopilotToResponse(autopilot, nil),
+ })
+ }
+ writeJSON(w, http.StatusOK, resp)
+}
+
+func (h *Handler) RestoreProject(w http.ResponseWriter, r *http.Request) {
+ project, workspaceID, ok := h.loadArchivableProject(w, r)
+ if !ok {
+ return
+ }
+ if !project.ArchivedAt.Valid {
+ writeError(w, http.StatusConflict, "project is not archived")
+ return
+ }
+ actorType, actorID := h.resolveActor(r, requestUserID(r), workspaceID)
+
+ // Autopilots paused by the archive stay paused: resuming automation is
+ // an explicit decision, not a side effect of restoring.
+ restored, err := h.Queries.RestoreProject(r.Context(), db.RestoreProjectParams{
+ ID: project.ID,
+ WorkspaceID: project.WorkspaceID,
+ })
+ if errors.Is(err, pgx.ErrNoRows) {
+ writeError(w, http.StatusConflict, "project is not archived")
+ return
+ }
+ if err != nil {
+ writeError(w, http.StatusInternalServerError, "failed to restore project")
+ return
+ }
+ resp := h.projectResponseWithCounts(r.Context(), restored)
+ h.publish(protocol.EventProjectUpdated, workspaceID, actorType, actorID, map[string]any{"project": resp})
+ writeJSON(w, http.StatusOK, resp)
+}
diff --git a/server/internal/handler/project_archive_test.go b/server/internal/handler/project_archive_test.go
new file mode 100644
index 0000000000..5973fa8fd8
--- /dev/null
+++ b/server/internal/handler/project_archive_test.go
@@ -0,0 +1,338 @@
+package handler
+
+import (
+ "context"
+ "encoding/json"
+ "net/http"
+ "net/http/httptest"
+ "testing"
+
+ "github.com/multica-ai/multica/server/internal/testutil"
+)
+
+func archiveProjectForTest(t *testing.T, userID, projectID string) *httptest.ResponseRecorder {
+ t.Helper()
+ w := httptest.NewRecorder()
+ req := newRequestAs(userID, http.MethodPost, "/api/projects/"+projectID+"/archive", nil)
+ testHandler.ArchiveProject(w, withURLParam(req, "id", projectID))
+ return w
+}
+
+func restoreProjectForTest(t *testing.T, userID, projectID string) *httptest.ResponseRecorder {
+ t.Helper()
+ w := httptest.NewRecorder()
+ req := newRequestAs(userID, http.MethodPost, "/api/projects/"+projectID+"/restore", nil)
+ testHandler.RestoreProject(w, withURLParam(req, "id", projectID))
+ return w
+}
+
+func listProjectIDsForTest(t *testing.T, query string) map[string]bool {
+ t.Helper()
+ w := httptest.NewRecorder()
+ testHandler.ListProjects(w, newRequest(http.MethodGet, "/api/projects?workspace_id="+testWorkspaceID+query, nil))
+ if w.Code != http.StatusOK {
+ t.Fatalf("ListProjects: %d %s", w.Code, w.Body.String())
+ }
+ var resp struct {
+ Projects []ProjectResponse `json:"projects"`
+ }
+ if err := json.NewDecoder(w.Body).Decode(&resp); err != nil {
+ t.Fatalf("decode ListProjects: %v", err)
+ }
+ ids := make(map[string]bool, len(resp.Projects))
+ for _, p := range resp.Projects {
+ ids[p.ID] = true
+ }
+ return ids
+}
+
+func createIssueForArchiveTest(t *testing.T, body map[string]any) *httptest.ResponseRecorder {
+ t.Helper()
+ w := httptest.NewRecorder()
+ testHandler.CreateIssue(w, newRequest(http.MethodPost, "/api/issues?workspace_id="+testWorkspaceID, body))
+ if w.Code == http.StatusCreated {
+ var issue IssueResponse
+ if err := json.Unmarshal(w.Body.Bytes(), &issue); err == nil {
+ t.Cleanup(func() {
+ _, _ = testPool.Exec(context.Background(), `DELETE FROM issue WHERE id = $1`, issue.ID)
+ })
+ }
+ }
+ return w
+}
+
+func decodeErrorCode(t *testing.T, w *httptest.ResponseRecorder) string {
+ t.Helper()
+ var body struct {
+ Code string `json:"code"`
+ }
+ _ = json.Unmarshal(w.Body.Bytes(), &body)
+ return body.Code
+}
+
+func TestArchiveAndRestoreProject(t *testing.T) {
+ if testHandler == nil {
+ t.Skip("database not available")
+ }
+ // Any member who can edit the project can archive it; deletion's
+ // creator/admin gate does not apply.
+ memberID := createProjectPermissionTestMember(t, "member")
+ project := createProjectPermissionTestProject(t, "archive lifecycle project")
+
+ w := archiveProjectForTest(t, memberID, project.ID)
+ if w.Code != http.StatusOK {
+ t.Fatalf("ArchiveProject: %d %s", w.Code, w.Body.String())
+ }
+ var archived ArchiveProjectResponse
+ if err := json.NewDecoder(w.Body).Decode(&archived); err != nil {
+ t.Fatalf("decode ArchiveProject: %v", err)
+ }
+ if archived.ArchivedAt == nil || archived.ArchivedByType == nil || *archived.ArchivedByType != "member" ||
+ archived.ArchivedByID == nil || *archived.ArchivedByID != memberID {
+ t.Fatalf("archive fields = %v / %v / %v", archived.ArchivedAt, archived.ArchivedByType, archived.ArchivedByID)
+ }
+ if archived.Status != project.Status {
+ t.Fatalf("archive changed status %q -> %q", project.Status, archived.Status)
+ }
+
+ if listProjectIDsForTest(t, "")[project.ID] {
+ t.Fatal("default project list still returns the archived project")
+ }
+ if !listProjectIDsForTest(t, "&include_archived=true")[project.ID] {
+ t.Fatal("include_archived=true does not return the archived project")
+ }
+
+ if w := archiveProjectForTest(t, memberID, project.ID); w.Code != http.StatusConflict {
+ t.Fatalf("second archive: expected 409, got %d %s", w.Code, w.Body.String())
+ }
+
+ w = restoreProjectForTest(t, memberID, project.ID)
+ if w.Code != http.StatusOK {
+ t.Fatalf("RestoreProject: %d %s", w.Code, w.Body.String())
+ }
+ var restored ProjectResponse
+ if err := json.NewDecoder(w.Body).Decode(&restored); err != nil {
+ t.Fatalf("decode RestoreProject: %v", err)
+ }
+ if restored.ArchivedAt != nil || restored.ArchivedByType != nil || restored.ArchivedByID != nil {
+ t.Fatalf("restore left archive fields set: %+v", restored)
+ }
+ if !listProjectIDsForTest(t, "")[project.ID] {
+ t.Fatal("restored project is missing from the default list")
+ }
+ if w := restoreProjectForTest(t, memberID, project.ID); w.Code != http.StatusConflict {
+ t.Fatalf("second restore: expected 409, got %d %s", w.Code, w.Body.String())
+ }
+}
+
+func TestArchiveProjectRejectsOtherWorkspace(t *testing.T) {
+ if testHandler == nil {
+ t.Skip("database not available")
+ }
+ foreignWorkspaceID := dbfx.Insert(t, "workspace", testutil.Cols{
+ "name": "Foreign Archive WS",
+ "slug": "foreign-archive-ws",
+ "description": "cross-tenant archive test",
+ "issue_prefix": "FAW",
+ })
+ foreignProjectID := dbfx.Insert(t, "project", testutil.Cols{
+ "workspace_id": foreignWorkspaceID,
+ "title": "foreign project",
+ })
+
+ if w := archiveProjectForTest(t, testUserID, foreignProjectID); w.Code != http.StatusNotFound {
+ t.Fatalf("archive foreign project: expected 404, got %d %s", w.Code, w.Body.String())
+ }
+ var archived bool
+ if err := testPool.QueryRow(context.Background(),
+ `SELECT archived_at IS NOT NULL FROM project WHERE id = $1`, foreignProjectID,
+ ).Scan(&archived); err != nil {
+ t.Fatalf("read foreign project: %v", err)
+ }
+ if archived {
+ t.Fatal("foreign project was archived through another workspace")
+ }
+}
+
+func TestArchivedProjectRefusesNewIssuesButKeepsExistingOnesEditable(t *testing.T) {
+ if testHandler == nil {
+ t.Skip("database not available")
+ }
+ project := createProjectPermissionTestProject(t, "archive guard project")
+
+ w := createIssueForArchiveTest(t, map[string]any{"title": "existing work", "project_id": project.ID})
+ if w.Code != http.StatusCreated {
+ t.Fatalf("seed issue: %d %s", w.Code, w.Body.String())
+ }
+ var existing IssueResponse
+ if err := json.NewDecoder(w.Body).Decode(&existing); err != nil {
+ t.Fatalf("decode seed issue: %v", err)
+ }
+ w = createIssueForArchiveTest(t, map[string]any{"title": "elsewhere"})
+ if w.Code != http.StatusCreated {
+ t.Fatalf("seed outside issue: %d %s", w.Code, w.Body.String())
+ }
+ var outside IssueResponse
+ if err := json.NewDecoder(w.Body).Decode(&outside); err != nil {
+ t.Fatalf("decode outside issue: %v", err)
+ }
+
+ if w := archiveProjectForTest(t, testUserID, project.ID); w.Code != http.StatusOK {
+ t.Fatalf("ArchiveProject: %d %s", w.Code, w.Body.String())
+ }
+
+ w = createIssueForArchiveTest(t, map[string]any{"title": "new work", "project_id": project.ID})
+ if w.Code != http.StatusConflict || decodeErrorCode(t, w) != projectArchivedCode {
+ t.Fatalf("create into archived project: expected 409 %s, got %d %s", projectArchivedCode, w.Code, w.Body.String())
+ }
+
+ // A sub-issue inherits its parent's project; continuing existing work is allowed.
+ w = createIssueForArchiveTest(t, map[string]any{"title": "follow-up", "parent_issue_id": existing.ID})
+ if w.Code != http.StatusCreated {
+ t.Fatalf("sub-issue under archived project: expected 201, got %d %s", w.Code, w.Body.String())
+ }
+ // The create form names the parent's project explicitly; that is still the parent's project.
+ w = createIssueForArchiveTest(t, map[string]any{"title": "follow-up 2", "parent_issue_id": existing.ID, "project_id": project.ID})
+ if w.Code != http.StatusCreated {
+ t.Fatalf("sub-issue naming its parent's archived project: expected 201, got %d %s", w.Code, w.Body.String())
+ }
+ w = createIssueForArchiveTest(t, map[string]any{"title": "stray", "parent_issue_id": outside.ID, "project_id": project.ID})
+ if w.Code != http.StatusConflict || decodeErrorCode(t, w) != projectArchivedCode {
+ t.Fatalf("sub-issue filed into another parent's archived project: expected 409, got %d %s", w.Code, w.Body.String())
+ }
+
+ update := func(issueID string, body map[string]any) *httptest.ResponseRecorder {
+ w := httptest.NewRecorder()
+ req := newRequest(http.MethodPut, "/api/issues/"+issueID, body)
+ testHandler.UpdateIssue(w, withURLParam(req, "id", issueID))
+ return w
+ }
+ if w := update(existing.ID, map[string]any{"title": "existing work, renamed", "project_id": project.ID}); w.Code != http.StatusOK {
+ t.Fatalf("edit issue inside archived project: expected 200, got %d %s", w.Code, w.Body.String())
+ }
+ if w := update(outside.ID, map[string]any{"project_id": project.ID}); w.Code != http.StatusConflict || decodeErrorCode(t, w) != projectArchivedCode {
+ t.Fatalf("move issue into archived project: expected 409, got %d %s", w.Code, w.Body.String())
+ }
+
+ w = httptest.NewRecorder()
+ testHandler.BatchUpdateIssues(w, newRequest(http.MethodPost, "/api/issues/batch-update", map[string]any{
+ "issue_ids": []string{outside.ID},
+ "updates": map[string]any{"project_id": project.ID},
+ }))
+ if w.Code != http.StatusConflict || decodeErrorCode(t, w) != projectArchivedCode {
+ t.Fatalf("batch move into archived project: expected 409, got %d %s", w.Code, w.Body.String())
+ }
+
+ if w := restoreProjectForTest(t, testUserID, project.ID); w.Code != http.StatusOK {
+ t.Fatalf("RestoreProject: %d %s", w.Code, w.Body.String())
+ }
+ if w := update(outside.ID, map[string]any{"project_id": project.ID}); w.Code != http.StatusOK {
+ t.Fatalf("move issue into restored project: expected 200, got %d %s", w.Code, w.Body.String())
+ }
+}
+
+func TestArchiveProjectPausesAutopilotsAndBlocksResume(t *testing.T) {
+ if testHandler == nil {
+ t.Skip("database not available")
+ }
+ ctx := context.Background()
+ project := createProjectPermissionTestProject(t, "archive autopilot project")
+ runtimeID := createCascadeFixtureRuntime(t, ctx, "Archive Autopilot Runtime")
+ agentID := createCascadeFixtureAgent(t, ctx, runtimeID, "Archive Autopilot Agent")
+
+ var autopilotID string
+ if err := testPool.QueryRow(ctx, `
+ INSERT INTO autopilot (
+ workspace_id, title, assignee_type, assignee_id, status,
+ execution_mode, created_by_type, created_by_id, project_id
+ )
+ VALUES ($1, 'files into archived project', 'agent', $2, 'active',
+ 'create_issue', 'member', $3, $4)
+ RETURNING id
+ `, testWorkspaceID, agentID, testUserID, project.ID).Scan(&autopilotID); err != nil {
+ t.Fatalf("insert autopilot: %v", err)
+ }
+ t.Cleanup(func() {
+ _, _ = testPool.Exec(context.Background(), `DELETE FROM autopilot WHERE id = $1`, autopilotID)
+ })
+
+ w := archiveProjectForTest(t, testUserID, project.ID)
+ if w.Code != http.StatusOK {
+ t.Fatalf("ArchiveProject: %d %s", w.Code, w.Body.String())
+ }
+ var archived ArchiveProjectResponse
+ if err := json.NewDecoder(w.Body).Decode(&archived); err != nil {
+ t.Fatalf("decode ArchiveProject: %v", err)
+ }
+ if len(archived.PausedAutopilotIDs) != 1 || archived.PausedAutopilotIDs[0] != autopilotID {
+ t.Fatalf("paused_autopilot_ids = %v, want [%s]", archived.PausedAutopilotIDs, autopilotID)
+ }
+
+ readAutopilot := func() (string, string) {
+ var status, reason string
+ if err := testPool.QueryRow(ctx,
+ `SELECT status, COALESCE(pause_reason, '') FROM autopilot WHERE id = $1`, autopilotID,
+ ).Scan(&status, &reason); err != nil {
+ t.Fatalf("read autopilot: %v", err)
+ }
+ return status, reason
+ }
+ if status, reason := readAutopilot(); status != "paused" || reason != "project_archived" {
+ t.Fatalf("autopilot = (%q, %q), want (paused, project_archived)", status, reason)
+ }
+
+ resume := func() *httptest.ResponseRecorder {
+ w := httptest.NewRecorder()
+ req := newRequest(http.MethodPatch, "/api/autopilots/"+autopilotID+"?workspace_id="+testWorkspaceID,
+ map[string]any{"status": "active"})
+ testHandler.UpdateAutopilot(w, withURLParam(req, "id", autopilotID))
+ return w
+ }
+ if w := resume(); w.Code != http.StatusConflict || decodeErrorCode(t, w) != projectArchivedCode {
+ t.Fatalf("resume autopilot on archived project: expected 409, got %d %s", w.Code, w.Body.String())
+ }
+
+ // Restoring does not resume automation on its own.
+ if w := restoreProjectForTest(t, testUserID, project.ID); w.Code != http.StatusOK {
+ t.Fatalf("RestoreProject: %d %s", w.Code, w.Body.String())
+ }
+ if status, _ := readAutopilot(); status != "paused" {
+ t.Fatalf("restore resumed the autopilot: status %q", status)
+ }
+ if w := resume(); w.Code != http.StatusOK {
+ t.Fatalf("resume after restore: expected 200, got %d %s", w.Code, w.Body.String())
+ }
+}
+
+func TestArchivedProjectStillCountsAsWorkflowUser(t *testing.T) {
+ seedTestCatalog(t)
+ resetDefaultWorkflow(t)
+ wf := createTestWorkflow(t, "Archived user "+workflowTestSuffix(), "in_progress")
+ projectID := createWorkflowTestProject(t, "Archived workflow project")
+ setProjectWorkflow(t, projectID, map[string]any{"workflow_id": wf.ID}).Want(http.StatusOK)
+
+ projectIDs := func() []string {
+ t.Helper()
+ var list struct {
+ Workflows []IssueWorkflowResponse `json:"workflows"`
+ }
+ testutil.Call(t, testHandler.ListIssueWorkflows, workflowRequest("GET", "/api/issue-workflows", nil)).Want(http.StatusOK).JSON(&list)
+ for _, row := range list.Workflows {
+ if row.ID == wf.ID {
+ return row.ProjectIDs
+ }
+ }
+ t.Fatalf("workflow %s missing from list", wf.ID)
+ return nil
+ }
+ if got := projectIDs(); len(got) != 1 || got[0] != projectID {
+ t.Fatalf("before archive: project_ids = %v, want [%s]", got, projectID)
+ }
+
+ if w := archiveProjectForTest(t, testUserID, projectID); w.Code != http.StatusOK {
+ t.Fatalf("ArchiveProject: %d %s", w.Code, w.Body.String())
+ }
+ if got := projectIDs(); len(got) != 1 || got[0] != projectID {
+ t.Fatalf("after archive: project_ids = %v, want the archived project still listed", got)
+ }
+}
diff --git a/server/internal/handler/project_resource.go b/server/internal/handler/project_resource.go
index e9d4e689c4..8593d3500a 100644
--- a/server/internal/handler/project_resource.go
+++ b/server/internal/handler/project_resource.go
@@ -968,6 +968,7 @@ type claimProjectContext struct {
ProjectID string
Title string
Description string
+ Archived bool
Resources []ProjectResourceData
Repos []RepoData
}
@@ -979,6 +980,7 @@ func (c claimProjectContext) applyTo(resp *AgentTaskResponse) {
resp.ProjectID = c.ProjectID
resp.ProjectTitle = c.Title
resp.ProjectDescription = c.Description
+ resp.ProjectArchived = c.Archived
if len(c.Resources) > 0 {
resp.ProjectResources = c.Resources
}
@@ -1021,6 +1023,7 @@ func (h *Handler) resolveClaimProjectContext(ctx context.Context, projectID, wor
out.ProjectID = uuidToString(project.ID)
out.Title = project.Title
out.Description = project.Description.String
+ out.Archived = project.ArchivedAt.Valid
rows, resErr := h.Queries.ListProjectResourcesInWorkspace(ctx, db.ListProjectResourcesInWorkspaceParams{
ProjectID: project.ID,
diff --git a/server/internal/handler/search_test.go b/server/internal/handler/search_test.go
index 133ebfd04a..f28ebcd50a 100644
--- a/server/internal/handler/search_test.go
+++ b/server/internal/handler/search_test.go
@@ -60,7 +60,7 @@ func TestBuildSearchQuery_OmitsUnusedExactTotal(t *testing.T) {
}
func TestBuildProjectSearchQuery_OmitsUnusedExactTotal(t *testing.T) {
- query, _ := buildProjectSearchQuery("Hello", []string{"Hello"}, false)
+ query, _ := buildProjectSearchQuery("Hello", []string{"Hello"}, false, false)
if strings.Contains(query, "COUNT(*) OVER()") || strings.Contains(query, "total_count") {
t.Fatalf("project search query should not calculate an unused exact total:\n%s", query)
@@ -227,7 +227,7 @@ func TestBuildSearchQuery_SpecialChars(t *testing.T) {
// --- Project search tests ---
func TestBuildProjectSearchQuery_SingleTerm(t *testing.T) {
- query, args := buildProjectSearchQuery("Hello", []string{"Hello"}, false)
+ query, args := buildProjectSearchQuery("Hello", []string{"Hello"}, false, false)
if args[0] != "hello" {
t.Errorf("expected phrase arg to be lowercased, got %q", args[0])
@@ -250,7 +250,7 @@ func TestBuildProjectSearchQuery_SingleTerm(t *testing.T) {
}
func TestBuildProjectSearchQuery_MultiTerm(t *testing.T) {
- query, args := buildProjectSearchQuery("Foo Bar", []string{"Foo", "Bar"}, false)
+ query, args := buildProjectSearchQuery("Foo Bar", []string{"Foo", "Bar"}, false, false)
if args[0] != "foo bar" {
t.Errorf("expected phrase arg lowercased, got %q", args[0])
@@ -268,7 +268,7 @@ func TestBuildProjectSearchQuery_MultiTerm(t *testing.T) {
}
func TestBuildProjectSearchQuery_IncludeClosed(t *testing.T) {
- query, _ := buildProjectSearchQuery("test", []string{"test"}, true)
+ query, _ := buildProjectSearchQuery("test", []string{"test"}, true, false)
if strings.Contains(query, "NOT IN ('completed', 'cancelled')") {
t.Error("query should not exclude completed/cancelled when includeClosed=true")
@@ -522,7 +522,7 @@ func TestBuildSearchQuery_DoneNotDemotedAheadOfRelevance(t *testing.T) {
// projects above issues — an undemoted cancelled project can be the first row
// of the entire result list.
func TestBuildProjectSearchQuery_CancelledDemotedAheadOfRelevance(t *testing.T) {
- query, _ := buildProjectSearchQuery("platform", []string{"platform"}, true)
+ query, _ := buildProjectSearchQuery("platform", []string{"platform"}, true, false)
orderBy := orderByClause(t, query)
cancelledAt := strings.Index(orderBy, "p.status = 'cancelled'")
@@ -536,7 +536,7 @@ func TestBuildProjectSearchQuery_CancelledDemotedAheadOfRelevance(t *testing.T)
if cancelledAt > relevanceEndsAt {
t.Errorf("cancelled projects sort after the relevance tiers:\n%s", orderBy)
}
- if !strings.Contains(orderBy, "LOWER(p.title) <> $1") {
+ if !strings.Contains(orderBy, "CASE WHEN LOWER(p.title) = $1 THEN 0") {
t.Errorf("exact-title hit is not exempt from the cancelled demotion:\n%s", orderBy)
}
if !strings.Contains(orderBy, "p.updated_at DESC") {
@@ -544,6 +544,29 @@ func TestBuildProjectSearchQuery_CancelledDemotedAheadOfRelevance(t *testing.T)
}
}
+// Archived projects are hidden from search unless asked for, and when asked
+// for they sink below cancelled ones (MUL-8861).
+func TestBuildProjectSearchQuery_Archived(t *testing.T) {
+ query, _ := buildProjectSearchQuery("platform", []string{"platform"}, true, false)
+ if !strings.Contains(query, "p.archived_at IS NULL") {
+ t.Errorf("default project search does not exclude archived projects:\n%s", query)
+ }
+
+ query, _ = buildProjectSearchQuery("platform", []string{"platform"}, true, true)
+ if strings.Contains(query, "p.archived_at IS NULL") {
+ t.Errorf("include_archived search still excludes archived projects:\n%s", query)
+ }
+ orderBy := orderByClause(t, query)
+ archivedAt := strings.Index(orderBy, "p.archived_at IS NOT NULL THEN 2")
+ cancelledAt := strings.Index(orderBy, "p.status = 'cancelled' THEN 1")
+ if archivedAt == -1 || cancelledAt == -1 {
+ t.Fatalf("project ORDER BY is missing the archived or cancelled demotion:\n%s", orderBy)
+ }
+ if archivedAt > strings.Index(orderBy, "ELSE 5 END") {
+ t.Errorf("archived demotion sorts after the relevance tiers:\n%s", orderBy)
+ }
+}
+
// buildSearchQuery mutates the terms slice in place (lowercasing); this wrapper
// keeps each test's literals independent.
func buildSearchQueryForTest(t *testing.T, phrase string, terms []string, num int, hasNum bool, includeClosed bool) string {
diff --git a/server/internal/handler/source_context.go b/server/internal/handler/source_context.go
index 1b58cfb361..a397781801 100644
--- a/server/internal/handler/source_context.go
+++ b/server/internal/handler/source_context.go
@@ -968,6 +968,9 @@ func (h *Handler) writeSourceContextError(w http.ResponseWriter, err error, limi
case errors.Is(err, service.ErrParentIssueNotFound), errors.Is(err, service.ErrProjectNotFound):
status = http.StatusBadRequest
message = err.Error()
+ case errors.Is(err, service.ErrProjectArchived):
+ status, code = http.StatusConflict, projectArchivedCode
+ message = err.Error()
case errors.As(err, &propertyErr):
status, code = http.StatusBadRequest, "invalid_issue_property"
message = propertyErr.Message
diff --git a/server/internal/service/builtin_skills/multica-platform/references/projects.md b/server/internal/service/builtin_skills/multica-platform/references/projects.md
index bb2ed772d9..89af984298 100644
--- a/server/internal/service/builtin_skills/multica-platform/references/projects.md
+++ b/server/internal/service/builtin_skills/multica-platform/references/projects.md
@@ -7,6 +7,7 @@ display metadata; it is context later injected into task briefs and
- [Core model](#core-model)
- [CLI](#cli)
- [local_directory execution modes](#local_directory-execution-modes)
+- [Archived projects](#archived-projects)
- [Referring to a project in a comment](#referring-to-a-project-in-a-comment)
- [When to add a resource](#when-to-add-a-resource)
- [Debugging wrong context](#debugging-wrong-context)
@@ -53,6 +54,9 @@ multica project update <project-id> --title "<title>" --output json
multica project update <project-id> --due-date 2026-04-15 --output json
multica project update <project-id> --start-date "" --output json # clear the start date
multica project status <project-id> in_progress --output json
+multica project list --archived --output json
+multica project archive <project-id> --output json
+multica project restore <project-id> --output json
multica project resource list <project-id> --output json
multica project resource add <project-id> --type github_repo --url <github-url> --output json
multica project resource add <project-id> --type github_repo --url <github-url> --ref <branch-or-sha> --output json
@@ -110,6 +114,31 @@ run in place. Saving `worktree` is refused (HTTP 422, code
advertise the capability — the fix is updating the Multica app there, then
retrying. Pass an empty value to clear it back to the default.
+## Archived projects
+
+Archiving is separate from status: a `completed` or `cancelled` project can be
+archived or not, and restoring it keeps its status. An archived project has a
+non-null `archived_at` (plus `archived_by_type` / `archived_by_id`).
+
+- `project list` hides archived projects; `--archived` lists only them.
+ `project get`, `project restore` and `issue list --project` still reach
+ them. An ID prefix resolves to a live project first and to an archived one
+ only when nothing live matches; `--project` on `issue create` and
+ `autopilot create` refuses an archived-only match and prints the restore
+ command. Updates resolve it normally and leave the decision to the server.
+- It accepts no new issues. Creating an issue with `--project` set to it, or
+ moving an issue into it, fails with HTTP 409 code `project_archived`. Issues
+ already in it stay readable and editable, and sub-issues of those issues
+ inherit the project as before.
+- Archiving pauses every active autopilot that files issues into the project
+ (`pause_reason: project_archived`; `project archive` lists them). Restoring
+ does not resume them, and an autopilot cannot be resumed or pointed at the
+ project while it stays archived.
+- When your task's project is archived, the brief says so. Finish the work at
+ hand; restore the project only when the user asks.
+
+Archive and restore need the same permission as editing the project.
+
## Referring to a project in a comment
A project has no `MUL-123`-style identifier, so writing its title as prose
@@ -152,8 +181,8 @@ is task-local checkout state.
## Side effects
-Project create/update/delete/status and project resource add/update/remove
-mutate durable workspace state and affect future tasks. Ask before changing
+Project create/update/delete/status/archive/restore and project resource
+add/update/remove mutate durable workspace state and affect future tasks. Ask before changing
`local_directory` unless the user explicitly requested that exact local path.
## Project workflows
diff --git a/server/internal/service/issue.go b/server/internal/service/issue.go
index 88fd072a8c..49f229c0d5 100644
--- a/server/internal/service/issue.go
+++ b/server/internal/service/issue.go
@@ -161,6 +161,11 @@ var ErrParentIssueNotFound = errors.New("parent issue not found in this workspac
// having to remember it. Callers translate this into 400.
var ErrProjectNotFound = errors.New("project not found in this workspace")
+// ErrProjectArchived signals that the caller explicitly filed a new issue
+// into an archived project. Callers translate this into 409
+// project_archived; restoring the project lifts it.
+var ErrProjectArchived = errors.New("project is archived; restore it before adding issues")
+
// ErrIssueLabelNotFound signals that one of the supplied LabelIDs does not
// exist in the issue's workspace or is not an issue-scoped label. The whole
// create is rejected so a new issue is never born with a partial or wrong
@@ -355,6 +360,7 @@ func (s *IssueService) createOnce(ctx context.Context, p IssueCreateParams, opts
// WorkspaceID — there is no path from this service to a row in a
// foreign workspace.
projectID := p.ProjectID
+ var parentProjectID pgtype.UUID
if p.ParentIssueID.Valid {
parent, err := qtx.GetIssueInWorkspace(ctx, db.GetIssueInWorkspaceParams{
ID: p.ParentIssueID,
@@ -366,17 +372,24 @@ func (s *IssueService) createOnce(ctx context.Context, p IssueCreateParams, opts
// Back-fill project from parent when the caller did not pin
// one explicitly. Matches the long-standing HTTP behavior: a
// sub-issue inherits its parent's project unless overridden.
+ parentProjectID = parent.ProjectID
if !projectID.Valid {
projectID = parent.ProjectID
}
}
if projectID.Valid {
- if _, err := qtx.GetProjectInWorkspace(ctx, db.GetProjectInWorkspaceParams{
+ project, err := qtx.GetProjectInWorkspace(ctx, db.GetProjectInWorkspaceParams{
ID: projectID,
WorkspaceID: p.WorkspaceID,
- }); err != nil {
+ })
+ if err != nil {
return IssueCreateResult{}, ErrProjectNotFound
}
+ // A sub-issue staying in its parent's archived project continues work
+ // already there; only filing new work into it is refused.
+ if project.ArchivedAt.Valid && projectID != parentProjectID {
+ return IssueCreateResult{}, ErrProjectArchived
+ }
}
// Validate labels before we increment the issue counter so a stale or
diff --git a/server/migrations/658_project_archive.down.sql b/server/migrations/658_project_archive.down.sql
new file mode 100644
index 0000000000..9984332006
--- /dev/null
+++ b/server/migrations/658_project_archive.down.sql
@@ -0,0 +1,4 @@
+ALTER TABLE project
+ DROP COLUMN IF EXISTS archived_by_id,
+ DROP COLUMN IF EXISTS archived_by_type,
+ DROP COLUMN IF EXISTS archived_at;
diff --git a/server/migrations/658_project_archive.up.sql b/server/migrations/658_project_archive.up.sql
new file mode 100644
index 0000000000..d4e2e2e3db
--- /dev/null
+++ b/server/migrations/658_project_archive.up.sql
@@ -0,0 +1,9 @@
+-- MUL-8861: archiving hides a project from the default lists, pickers and
+-- agent project resolution without touching its status or its issues.
+-- NULL means not archived, so existing rows need no backfill and older
+-- servers keep writing valid rows. Nullable with no default, so the ALTER is
+-- catalog-only. The archiving actor can be a member or an agent.
+ALTER TABLE project
+ ADD COLUMN IF NOT EXISTS archived_at TIMESTAMPTZ,
+ ADD COLUMN IF NOT EXISTS archived_by_type TEXT,
+ ADD COLUMN IF NOT EXISTS archived_by_id UUID;
diff --git a/server/pkg/db/generated/autopilot.sql.go b/server/pkg/db/generated/autopilot.sql.go
index 7269432080..2271b687b9 100644
--- a/server/pkg/db/generated/autopilot.sql.go
+++ b/server/pkg/db/generated/autopilot.sql.go
@@ -1672,6 +1672,62 @@ func (q *Queries) LockAutopilotForUpdate(ctx context.Context, arg LockAutopilotF
return i, err
}
+const pauseAutopilotsByArchivedProject = `-- name: PauseAutopilotsByArchivedProject :many
+UPDATE autopilot
+SET status = 'paused',
+ pause_reason = 'project_archived',
+ updated_at = now()
+WHERE status = 'active'
+ AND workspace_id = $1
+ AND project_id = $2
+RETURNING id, workspace_id, title, description, assignee_id, status, execution_mode, issue_title_template, created_by_type, created_by_id, last_run_at, created_at, updated_at, assignee_type, project_id, pause_reason
+`
+
+type PauseAutopilotsByArchivedProjectParams struct {
+ WorkspaceID pgtype.UUID `json:"workspace_id"`
+ ProjectID pgtype.UUID `json:"project_id"`
+}
+
+// An archived project accepts no new issues, so an automation filing into it
+// would fail every run. Pause it, keeping the configuration; restoring the
+// project leaves it paused for an explicit resume.
+func (q *Queries) PauseAutopilotsByArchivedProject(ctx context.Context, arg PauseAutopilotsByArchivedProjectParams) ([]Autopilot, error) {
+ rows, err := q.db.Query(ctx, pauseAutopilotsByArchivedProject, arg.WorkspaceID, arg.ProjectID)
+ if err != nil {
+ return nil, err
+ }
+ defer rows.Close()
+ items := []Autopilot{}
+ for rows.Next() {
+ var i Autopilot
+ if err := rows.Scan(
+ &i.ID,
+ &i.WorkspaceID,
+ &i.Title,
+ &i.Description,
+ &i.AssigneeID,
+ &i.Status,
+ &i.ExecutionMode,
+ &i.IssueTitleTemplate,
+ &i.CreatedByType,
+ &i.CreatedByID,
+ &i.LastRunAt,
+ &i.CreatedAt,
+ &i.UpdatedAt,
+ &i.AssigneeType,
+ &i.ProjectID,
+ &i.PauseReason,
+ ); err != nil {
+ return nil, err
+ }
+ items = append(items, i)
+ }
+ if err := rows.Err(); err != nil {
+ return nil, err
+ }
+ return items, nil
+}
+
const pauseAutopilotsByUnboundAgents = `-- name: PauseAutopilotsByUnboundAgents :many
UPDATE autopilot a
SET status = 'paused',
diff --git a/server/pkg/db/generated/issue_workflow.sql.go b/server/pkg/db/generated/issue_workflow.sql.go
index 15144109d8..14fbcbdd27 100644
--- a/server/pkg/db/generated/issue_workflow.sql.go
+++ b/server/pkg/db/generated/issue_workflow.sql.go
@@ -338,7 +338,7 @@ func (q *Queries) ListNamedIssueWorkflowSteps(ctx context.Context, workspaceID p
}
const listProjectsUsingDefaultIssueWorkflow = `-- name: ListProjectsUsingDefaultIssueWorkflow :many
-SELECT id, workspace_id, title, description, icon, status, lead_type, lead_id, created_at, updated_at, priority, start_date, due_date, workflow_id, creator_type, creator_id, visibility FROM project
+SELECT id, workspace_id, title, description, icon, status, lead_type, lead_id, created_at, updated_at, priority, start_date, due_date, workflow_id, creator_type, creator_id, visibility, archived_at, archived_by_type, archived_by_id FROM project
WHERE workspace_id = $1::uuid
AND workflow_id IS NULL
ORDER BY created_at, id
@@ -371,6 +371,9 @@ func (q *Queries) ListProjectsUsingDefaultIssueWorkflow(ctx context.Context, wor
&i.CreatorType,
&i.CreatorID,
&i.Visibility,
+ &i.ArchivedAt,
+ &i.ArchivedByType,
+ &i.ArchivedByID,
); err != nil {
return nil, err
}
@@ -383,7 +386,7 @@ func (q *Queries) ListProjectsUsingDefaultIssueWorkflow(ctx context.Context, wor
}
const listProjectsUsingIssueWorkflow = `-- name: ListProjectsUsingIssueWorkflow :many
-SELECT id, workspace_id, title, description, icon, status, lead_type, lead_id, created_at, updated_at, priority, start_date, due_date, workflow_id, creator_type, creator_id, visibility FROM project
+SELECT id, workspace_id, title, description, icon, status, lead_type, lead_id, created_at, updated_at, priority, start_date, due_date, workflow_id, creator_type, creator_id, visibility, archived_at, archived_by_type, archived_by_id FROM project
WHERE workspace_id = $1::uuid
AND workflow_id = $2::uuid
ORDER BY created_at, id
@@ -421,6 +424,9 @@ func (q *Queries) ListProjectsUsingIssueWorkflow(ctx context.Context, arg ListPr
&i.CreatorType,
&i.CreatorID,
&i.Visibility,
+ &i.ArchivedAt,
+ &i.ArchivedByType,
+ &i.ArchivedByID,
); err != nil {
return nil, err
}
@@ -433,7 +439,7 @@ func (q *Queries) ListProjectsUsingIssueWorkflow(ctx context.Context, arg ListPr
}
const lockProjectForWorkflowChange = `-- name: LockProjectForWorkflowChange :one
-SELECT id, workspace_id, title, description, icon, status, lead_type, lead_id, created_at, updated_at, priority, start_date, due_date, workflow_id, creator_type, creator_id, visibility FROM project
+SELECT id, workspace_id, title, description, icon, status, lead_type, lead_id, created_at, updated_at, priority, start_date, due_date, workflow_id, creator_type, creator_id, visibility, archived_at, archived_by_type, archived_by_id FROM project
WHERE id = $1::uuid
AND workspace_id = $2::uuid
FOR UPDATE
@@ -466,6 +472,9 @@ func (q *Queries) LockProjectForWorkflowChange(ctx context.Context, arg LockProj
&i.CreatorType,
&i.CreatorID,
&i.Visibility,
+ &i.ArchivedAt,
+ &i.ArchivedByType,
+ &i.ArchivedByID,
)
return i, err
}
@@ -590,7 +599,7 @@ UPDATE project SET
updated_at = now()
WHERE id = $2::uuid
AND workspace_id = $3::uuid
-RETURNING id, workspace_id, title, description, icon, status, lead_type, lead_id, created_at, updated_at, priority, start_date, due_date, workflow_id, creator_type, creator_id, visibility
+RETURNING id, workspace_id, title, description, icon, status, lead_type, lead_id, created_at, updated_at, priority, start_date, due_date, workflow_id, creator_type, creator_id, visibility, archived_at, archived_by_type, archived_by_id
`
type SetProjectWorkflowParams struct {
@@ -620,6 +629,9 @@ func (q *Queries) SetProjectWorkflow(ctx context.Context, arg SetProjectWorkflow
&i.CreatorType,
&i.CreatorID,
&i.Visibility,
+ &i.ArchivedAt,
+ &i.ArchivedByType,
+ &i.ArchivedByID,
)
return i, err
}
diff --git a/server/pkg/db/generated/models.go b/server/pkg/db/generated/models.go
index 5068fa58da..abacc2f91d 100644
--- a/server/pkg/db/generated/models.go
+++ b/server/pkg/db/generated/models.go
@@ -1522,23 +1522,26 @@ type PluginStorage struct {
}
type Project struct {
- ID pgtype.UUID `json:"id"`
- WorkspaceID pgtype.UUID `json:"workspace_id"`
- Title string `json:"title"`
- Description pgtype.Text `json:"description"`
- Icon pgtype.Text `json:"icon"`
- Status string `json:"status"`
- LeadType pgtype.Text `json:"lead_type"`
- LeadID pgtype.UUID `json:"lead_id"`
- CreatedAt pgtype.Timestamptz `json:"created_at"`
- UpdatedAt pgtype.Timestamptz `json:"updated_at"`
- Priority string `json:"priority"`
- StartDate pgtype.Date `json:"start_date"`
- DueDate pgtype.Date `json:"due_date"`
- WorkflowID pgtype.UUID `json:"workflow_id"`
- CreatorType pgtype.Text `json:"creator_type"`
- CreatorID pgtype.UUID `json:"creator_id"`
- Visibility string `json:"visibility"`
+ ID pgtype.UUID `json:"id"`
+ WorkspaceID pgtype.UUID `json:"workspace_id"`
+ Title string `json:"title"`
+ Description pgtype.Text `json:"description"`
+ Icon pgtype.Text `json:"icon"`
+ Status string `json:"status"`
+ LeadType pgtype.Text `json:"lead_type"`
+ LeadID pgtype.UUID `json:"lead_id"`
+ CreatedAt pgtype.Timestamptz `json:"created_at"`
+ UpdatedAt pgtype.Timestamptz `json:"updated_at"`
+ Priority string `json:"priority"`
+ StartDate pgtype.Date `json:"start_date"`
+ DueDate pgtype.Date `json:"due_date"`
+ WorkflowID pgtype.UUID `json:"workflow_id"`
+ CreatorType pgtype.Text `json:"creator_type"`
+ CreatorID pgtype.UUID `json:"creator_id"`
+ Visibility string `json:"visibility"`
+ ArchivedAt pgtype.Timestamptz `json:"archived_at"`
+ ArchivedByType pgtype.Text `json:"archived_by_type"`
+ ArchivedByID pgtype.UUID `json:"archived_by_id"`
}
type ProjectMember struct {
diff --git a/server/pkg/db/generated/project.sql.go b/server/pkg/db/generated/project.sql.go
index 99d132a143..ff77adf990 100644
--- a/server/pkg/db/generated/project.sql.go
+++ b/server/pkg/db/generated/project.sql.go
@@ -11,6 +11,58 @@ import (
"github.com/jackc/pgx/v5/pgtype"
)
+const archiveProject = `-- name: ArchiveProject :one
+UPDATE project SET
+ archived_at = now(),
+ archived_by_type = $3,
+ archived_by_id = $4,
+ updated_at = now()
+WHERE id = $1 AND workspace_id = $2 AND archived_at IS NULL
+RETURNING id, workspace_id, title, description, icon, status, lead_type, lead_id, created_at, updated_at, priority, start_date, due_date, workflow_id, creator_type, creator_id, visibility, archived_at, archived_by_type, archived_by_id
+`
+
+type ArchiveProjectParams struct {
+ ID pgtype.UUID `json:"id"`
+ WorkspaceID pgtype.UUID `json:"workspace_id"`
+ ArchivedByType pgtype.Text `json:"archived_by_type"`
+ ArchivedByID pgtype.UUID `json:"archived_by_id"`
+}
+
+// Guarded on archived_at IS NULL so a repeated archive keeps the first
+// actor and time; no row means it was already archived (or is gone).
+func (q *Queries) ArchiveProject(ctx context.Context, arg ArchiveProjectParams) (Project, error) {
+ row := q.db.QueryRow(ctx, archiveProject,
+ arg.ID,
+ arg.WorkspaceID,
+ arg.ArchivedByType,
+ arg.ArchivedByID,
+ )
+ var i Project
+ err := row.Scan(
+ &i.ID,
+ &i.WorkspaceID,
+ &i.Title,
+ &i.Description,
+ &i.Icon,
+ &i.Status,
+ &i.LeadType,
+ &i.LeadID,
+ &i.CreatedAt,
+ &i.UpdatedAt,
+ &i.Priority,
+ &i.StartDate,
+ &i.DueDate,
+ &i.WorkflowID,
+ &i.CreatorType,
+ &i.CreatorID,
+ &i.Visibility,
+ &i.ArchivedAt,
+ &i.ArchivedByType,
+ &i.ArchivedByID,
+ )
+ return i, err
+}
+
const countIssuesByProject = `-- name: CountIssuesByProject :one
SELECT count(*) FROM issue
WHERE project_id = $1
@@ -30,7 +82,7 @@ INSERT INTO project (
creator_type, creator_id
) VALUES (
$1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13
-) RETURNING id, workspace_id, title, description, icon, status, lead_type, lead_id, created_at, updated_at, priority, start_date, due_date, workflow_id, creator_type, creator_id, visibility
+) RETURNING id, workspace_id, title, description, icon, status, lead_type, lead_id, created_at, updated_at, priority, start_date, due_date, workflow_id, creator_type, creator_id, visibility, archived_at, archived_by_type, archived_by_id
`
type CreateProjectParams struct {
@@ -84,6 +136,9 @@ func (q *Queries) CreateProject(ctx context.Context, arg CreateProjectParams) (P
&i.CreatorType,
&i.CreatorID,
&i.Visibility,
+ &i.ArchivedAt,
+ &i.ArchivedByType,
+ &i.ArchivedByID,
)
return i, err
}
@@ -104,7 +159,7 @@ func (q *Queries) DeleteProject(ctx context.Context, arg DeleteProjectParams) er
}
const getProjectInWorkspace = `-- name: GetProjectInWorkspace :one
-SELECT id, workspace_id, title, description, icon, status, lead_type, lead_id, created_at, updated_at, priority, start_date, due_date, workflow_id, creator_type, creator_id, visibility FROM project
+SELECT id, workspace_id, title, description, icon, status, lead_type, lead_id, created_at, updated_at, priority, start_date, due_date, workflow_id, creator_type, creator_id, visibility, archived_at, archived_by_type, archived_by_id FROM project
WHERE id = $1 AND workspace_id = $2
`
@@ -134,6 +189,9 @@ func (q *Queries) GetProjectInWorkspace(ctx context.Context, arg GetProjectInWor
&i.CreatorType,
&i.CreatorID,
&i.Visibility,
+ &i.ArchivedAt,
+ &i.ArchivedByType,
+ &i.ArchivedByID,
)
return i, err
}
@@ -181,21 +239,28 @@ func (q *Queries) GetProjectIssueStats(ctx context.Context, arg GetProjectIssueS
}
const listProjects = `-- name: ListProjects :many
-SELECT id, workspace_id, title, description, icon, status, lead_type, lead_id, created_at, updated_at, priority, start_date, due_date, workflow_id, creator_type, creator_id, visibility FROM project
+SELECT id, workspace_id, title, description, icon, status, lead_type, lead_id, created_at, updated_at, priority, start_date, due_date, workflow_id, creator_type, creator_id, visibility, archived_at, archived_by_type, archived_by_id FROM project
WHERE workspace_id = $1
AND ($2::text IS NULL OR status = $2)
AND ($3::text IS NULL OR priority = $3)
+ AND ($4::boolean OR archived_at IS NULL)
ORDER BY created_at DESC
`
type ListProjectsParams struct {
- WorkspaceID pgtype.UUID `json:"workspace_id"`
- Status pgtype.Text `json:"status"`
- Priority pgtype.Text `json:"priority"`
+ WorkspaceID pgtype.UUID `json:"workspace_id"`
+ Status pgtype.Text `json:"status"`
+ Priority pgtype.Text `json:"priority"`
+ IncludeArchived bool `json:"include_archived"`
}
func (q *Queries) ListProjects(ctx context.Context, arg ListProjectsParams) ([]Project, error) {
- rows, err := q.db.Query(ctx, listProjects, arg.WorkspaceID, arg.Status, arg.Priority)
+ rows, err := q.db.Query(ctx, listProjects,
+ arg.WorkspaceID,
+ arg.Status,
+ arg.Priority,
+ arg.IncludeArchived,
+ )
if err != nil {
return nil, err
}
@@ -221,6 +286,9 @@ func (q *Queries) ListProjects(ctx context.Context, arg ListProjectsParams) ([]P
&i.CreatorType,
&i.CreatorID,
&i.Visibility,
+ &i.ArchivedAt,
+ &i.ArchivedByType,
+ &i.ArchivedByID,
); err != nil {
return nil, err
}
@@ -272,6 +340,49 @@ func (q *Queries) LockProjectForDelete(ctx context.Context, arg LockProjectForDe
return id, err
}
+const restoreProject = `-- name: RestoreProject :one
+UPDATE project SET
+ archived_at = NULL,
+ archived_by_type = NULL,
+ archived_by_id = NULL,
+ updated_at = now()
+WHERE id = $1 AND workspace_id = $2 AND archived_at IS NOT NULL
+RETURNING id, workspace_id, title, description, icon, status, lead_type, lead_id, created_at, updated_at, priority, start_date, due_date, workflow_id, creator_type, creator_id, visibility, archived_at, archived_by_type, archived_by_id
+`
+
+type RestoreProjectParams struct {
+ ID pgtype.UUID `json:"id"`
+ WorkspaceID pgtype.UUID `json:"workspace_id"`
+}
+
+func (q *Queries) RestoreProject(ctx context.Context, arg RestoreProjectParams) (Project, error) {
+ row := q.db.QueryRow(ctx, restoreProject, arg.ID, arg.WorkspaceID)
+ var i Project
+ err := row.Scan(
+ &i.ID,
+ &i.WorkspaceID,
+ &i.Title,
+ &i.Description,
+ &i.Icon,
+ &i.Status,
+ &i.LeadType,
+ &i.LeadID,
+ &i.CreatedAt,
+ &i.UpdatedAt,
+ &i.Priority,
+ &i.StartDate,
+ &i.DueDate,
+ &i.WorkflowID,
+ &i.CreatorType,
+ &i.CreatorID,
+ &i.Visibility,
+ &i.ArchivedAt,
+ &i.ArchivedByType,
+ &i.ArchivedByID,
+ )
+ return i, err
+}
+
const updateProject = `-- name: UpdateProject :one
UPDATE project SET
title = COALESCE($2, title),
@@ -285,7 +396,7 @@ UPDATE project SET
due_date = CASE WHEN $15::boolean THEN $16 ELSE due_date END,
updated_at = now()
WHERE id = $1
-RETURNING id, workspace_id, title, description, icon, status, lead_type, lead_id, created_at, updated_at, priority, start_date, due_date, workflow_id, creator_type, creator_id, visibility
+RETURNING id, workspace_id, title, description, icon, status, lead_type, lead_id, created_at, updated_at, priority, start_date, due_date, workflow_id, creator_type, creator_id, visibility, archived_at, archived_by_type, archived_by_id
`
type UpdateProjectParams struct {
@@ -345,6 +456,9 @@ func (q *Queries) UpdateProject(ctx context.Context, arg UpdateProjectParams) (P
&i.CreatorType,
&i.CreatorID,
&i.Visibility,
+ &i.ArchivedAt,
+ &i.ArchivedByType,
+ &i.ArchivedByID,
)
return i, err
}
diff --git a/server/pkg/db/generated/project_member.sql.go b/server/pkg/db/generated/project_member.sql.go
index 9c1104fa81..d6bd475d79 100644
--- a/server/pkg/db/generated/project_member.sql.go
+++ b/server/pkg/db/generated/project_member.sql.go
@@ -419,7 +419,7 @@ func (q *Queries) TouchProjectSearchIndexEntries(ctx context.Context, arg TouchP
const updateProjectVisibility = `-- name: UpdateProjectVisibility :one
UPDATE project SET visibility = $1, updated_at = now()
WHERE id = $2 AND workspace_id = $3
-RETURNING id, workspace_id, title, description, icon, status, lead_type, lead_id, created_at, updated_at, priority, start_date, due_date, workflow_id, creator_type, creator_id, visibility
+RETURNING id, workspace_id, title, description, icon, status, lead_type, lead_id, created_at, updated_at, priority, start_date, due_date, workflow_id, creator_type, creator_id, visibility, archived_at, archived_by_type, archived_by_id
`
type UpdateProjectVisibilityParams struct {
@@ -449,6 +449,9 @@ func (q *Queries) UpdateProjectVisibility(ctx context.Context, arg UpdateProject
&i.CreatorType,
&i.CreatorID,
&i.Visibility,
+ &i.ArchivedAt,
+ &i.ArchivedByType,
+ &i.ArchivedByID,
)
return i, err
}
diff --git a/server/pkg/db/generated/search_index.sql.go b/server/pkg/db/generated/search_index.sql.go
index e4d2c34c18..395cdc869f 100644
--- a/server/pkg/db/generated/search_index.sql.go
+++ b/server/pkg/db/generated/search_index.sql.go
@@ -380,7 +380,7 @@ func (q *Queries) ListSearchIndexIssuesPage(ctx context.Context, arg ListSearchI
}
const listSearchIndexProjects = `-- name: ListSearchIndexProjects :many
-SELECT id, workspace_id, title, description, icon, status, lead_type, lead_id, created_at, updated_at, priority, start_date, due_date, workflow_id, creator_type, creator_id, visibility FROM project
+SELECT id, workspace_id, title, description, icon, status, lead_type, lead_id, created_at, updated_at, priority, start_date, due_date, workflow_id, creator_type, creator_id, visibility, archived_at, archived_by_type, archived_by_id FROM project
WHERE workspace_id = $1
ORDER BY id
`
@@ -412,6 +412,9 @@ func (q *Queries) ListSearchIndexProjects(ctx context.Context, workspaceID pgtyp
&i.CreatorType,
&i.CreatorID,
&i.Visibility,
+ &i.ArchivedAt,
+ &i.ArchivedByType,
+ &i.ArchivedByID,
); err != nil {
return nil, err
}
@@ -424,7 +427,7 @@ func (q *Queries) ListSearchIndexProjects(ctx context.Context, workspaceID pgtyp
}
const listSearchIndexProjectsByIDs = `-- name: ListSearchIndexProjectsByIDs :many
-SELECT id, workspace_id, title, description, icon, status, lead_type, lead_id, created_at, updated_at, priority, start_date, due_date, workflow_id, creator_type, creator_id, visibility FROM project
+SELECT id, workspace_id, title, description, icon, status, lead_type, lead_id, created_at, updated_at, priority, start_date, due_date, workflow_id, creator_type, creator_id, visibility, archived_at, archived_by_type, archived_by_id FROM project
WHERE workspace_id = $1 AND id = ANY($2::uuid[])
`
@@ -460,6 +463,9 @@ func (q *Queries) ListSearchIndexProjectsByIDs(ctx context.Context, arg ListSear
&i.CreatorType,
&i.CreatorID,
&i.Visibility,
+ &i.ArchivedAt,
+ &i.ArchivedByType,
+ &i.ArchivedByID,
); err != nil {
return nil, err
}
diff --git a/server/pkg/db/queries/autopilot.sql b/server/pkg/db/queries/autopilot.sql
index cb10c2ec56..85e1f83240 100644
--- a/server/pkg/db/queries/autopilot.sql
+++ b/server/pkg/db/queries/autopilot.sql
@@ -123,6 +123,19 @@ WHERE status = 'active'
AND assignee_id = @squad_id
RETURNING *;
+-- name: PauseAutopilotsByArchivedProject :many
+-- An archived project accepts no new issues, so an automation filing into it
+-- would fail every run. Pause it, keeping the configuration; restoring the
+-- project leaves it paused for an explicit resume.
+UPDATE autopilot
+SET status = 'paused',
+ pause_reason = 'project_archived',
+ updated_at = now()
+WHERE status = 'active'
+ AND workspace_id = @workspace_id
+ AND project_id = @project_id
+RETURNING *;
+
-- name: UpdateAutopilotLastRunAt :exec
UPDATE autopilot SET last_run_at = now(), updated_at = now()
WHERE id = $1;
diff --git a/server/pkg/db/queries/project.sql b/server/pkg/db/queries/project.sql
index 3b2f7998f1..cb7d9a33ba 100644
--- a/server/pkg/db/queries/project.sql
+++ b/server/pkg/db/queries/project.sql
@@ -3,8 +3,29 @@ SELECT * FROM project
WHERE workspace_id = $1
AND (sqlc.narg('status')::text IS NULL OR status = sqlc.narg('status'))
AND (sqlc.narg('priority')::text IS NULL OR priority = sqlc.narg('priority'))
+ AND (sqlc.arg('include_archived')::boolean OR archived_at IS NULL)
ORDER BY created_at DESC;
+-- name: ArchiveProject :one
+-- Guarded on archived_at IS NULL so a repeated archive keeps the first
+-- actor and time; no row means it was already archived (or is gone).
+UPDATE project SET
+ archived_at = now(),
+ archived_by_type = sqlc.narg('archived_by_type'),
+ archived_by_id = sqlc.narg('archived_by_id'),
+ updated_at = now()
+WHERE id = $1 AND workspace_id = $2 AND archived_at IS NULL
+RETURNING *;
+
+-- name: RestoreProject :one
+UPDATE project SET
+ archived_at = NULL,
+ archived_by_type = NULL,
+ archived_by_id = NULL,
+ updated_at = now()
+WHERE id = $1 AND workspace_id = $2 AND archived_at IS NOT NULL
+RETURNING *;
+
-- name: GetProjectInWorkspace :one
SELECT * FROM project
WHERE id = $1 AND workspace_id = $2;