UI: stories only — goals removed from the web (project page, board cards, task page)

Goals stay in the DB and MCP for now (agent context, Bugsink); PEP-66 turns them into epic labels.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Асель 2026-11-14 00:44:55 +05:00
parent f66d3dbc5b
commit b517072362
5 changed files with 7 additions and 47 deletions

View File

@ -1,7 +1,6 @@
"use server";
import {
createGoal,
createTask,
getQuestion,
getSession,
@ -68,22 +67,12 @@ export async function answerQuestion(f: FormData) {
});
}
export async function addGoal(f: FormData) {
const user = await requireUser();
await attempt(f, async () => {
const p = await projectForUser(db, user.id, Number(str(f, "projectId")));
if (!str(f, "title")) throw new PeppaError("Нужно название цели");
await createGoal(db, p.id, str(f, "title"), str(f, "description") || undefined);
});
}
export async function addTask(f: FormData) {
const user = await requireUser();
await attempt(f, async () => {
const p = await projectForUser(db, user.id, Number(str(f, "projectId")));
if (!str(f, "title")) throw new PeppaError("Нужно название задачи");
const goalId = str(f, "goalId") ? Number(str(f, "goalId")) : undefined;
const ref = await createTask(db, { projectId: p.id, goalId, title: str(f, "title"), description: str(f, "description") || undefined });
const ref = await createTask(db, { projectId: p.id, title: str(f, "title"), description: str(f, "description") || undefined });
return `/t/${ref.key}`;
});
}

View File

@ -10,14 +10,14 @@ import { Empty, Flash, Key, Notice, PageHeader, Section } from "@/components/com
import { IncidentsSection } from "@/components/Incidents";
import { Badge } from "@/components/ui/badge";
import { Button } from "@/components/ui/button";
import { Input, NativeSelect, Textarea } from "@/components/ui/input";
import { Input, Textarea } from "@/components/ui/input";
import { SettingsDialog } from "@/components/SettingsDialog";
import { Workspace } from "@/components/Workspace";
import { requireUser } from "@/lib/auth";
import { cn } from "@/lib/utils";
import { db } from "@/lib/db";
import { board, projectForUserByKey, projectSessions } from "@/lib/queries";
import { addGoal, addProjectMember, addTask, deployProdAction, grantRepoAccessToMembers, removeProjectMember } from "../../actions";
import { addProjectMember, addTask, deployProdAction, grantRepoAccessToMembers, removeProjectMember } from "../../actions";
const RELEASE_STATUS: Record<Release["status"], { label: string; tone: "info" | "ok" | "warn" | "danger" | "muted" }> = {
deploying: { label: "выкатывается", tone: "info" },
@ -61,7 +61,7 @@ export default async function ProjectPage({ params, searchParams }: { params: Pr
const tab = TABS.find((t) => t.id === tabParam)?.id ?? "board";
const p = await projectForUserByKey(user.id, key).catch(() => null);
if (!p) notFound();
const [{ goals, tasks }, sessions, team, repo, incidentSettings, sources, incidents, releases, current] = await Promise.all([
const [{ tasks }, sessions, team, repo, incidentSettings, sources, incidents, releases, current] = await Promise.all([
board(p.id),
projectSessions(p.id),
listMembers(db, p),
@ -81,13 +81,11 @@ export default async function ProjectPage({ params, searchParams }: { params: Pr
const missingAccess = team.members.some((m) => noRepoAccess(m.login));
const isOwner = p.ownerId === user.id;
const back = tab === "board" ? `/p/${p.key}` : `/p/${p.key}?tab=${tab}`;
const goalTitle = new Map(goals.map((g) => [g.id, g.title]));
const cards: Card[] = tasks.map((t) => ({
key: `${p.key}-${t.number}`,
title: t.title,
status: t.status,
column: columnOf(t.status),
goal: t.goalId ? (goalTitle.get(t.goalId) ?? null) : null,
}));
const aside = (
@ -167,20 +165,6 @@ export default async function ProjectPage({ params, searchParams }: { params: Pr
)}
{isOwner && <p className="m-0 text-xs text-muted-foreground">Участник видит доску и входящие, двигает карточки и отвечает агентам; получает доступ на запись к репозиторию.</p>}
</PanelSection>
<PanelSection title="Цели" count={goals.length}>
<ul className="m-0 flex list-none flex-col gap-1 p-0 text-sm">
{goals.map((g) => (
<li key={g.id} className="px-2">◎ {g.title}</li>
))}
</ul>
<form action={addGoal} className="flex flex-col gap-2">
<Hidden fields={{ projectId: p.id, back }} />
<Input name="title" required placeholder="Новая цель" aria-label="Название цели" className="h-8" />
<Textarea name="description" rows={2} placeholder="Зачем и какой результат" aria-label="Описание цели" />
<Button size="sm" className="self-start">Создать цель</Button>
</form>
</PanelSection>
</div>
);
@ -189,12 +173,6 @@ export default async function ProjectPage({ params, searchParams }: { params: Pr
<Hidden fields={{ projectId: p.id, back }} />
<Input name="title" required placeholder="Что сделать" aria-label="Название стори" />
<Textarea name="description" rows={5} placeholder="Описание: кому и зачем, критерии готовности" aria-label="Описание стори" />
<NativeSelect name="goalId" aria-label="Цель" defaultValue="">
<option value="">Без цели</option>
{goals.map((g) => (
<option key={g.id} value={g.id}>◎ {g.title}</option>
))}
</NativeSelect>
<Button variant="default" size="sm" className="self-start">Создать стори</Button>
</form>
);

View File

@ -1,8 +1,6 @@
import Link from "next/link";
import { notFound } from "next/navigation";
import { eq } from "drizzle-orm";
import { CircleCheck, CircleX, GitPullRequest, Hourglass, Play } from "lucide-react";
import { goals } from "@peppa/db";
import { taskCiSummary } from "@peppa/core";
import { AutoRefresh } from "@/components/AutoRefresh";
import { PanelSection } from "@/components/ActivityAside";
@ -25,7 +23,6 @@ export default async function TaskPage({ params, searchParams }: { params: Promi
const ref = await taskForUser(user.id, decodeURIComponent(key)).catch(() => null);
if (!ref) notFound();
const { task, project } = ref;
const [goal] = task.goalId ? await db.select().from(goals).where(eq(goals.id, task.goalId)) : [];
const { questions, sessions, events } = await taskActivity(task.id);
const artifacts = openspecArtifacts(project, task.openspecChange);
const ci = await taskCiSummary(db, ref);
@ -80,7 +77,6 @@ export default async function TaskPage({ params, searchParams }: { params: Promi
crumbs={
<>
<Link href={`/p/${project.key}`} className="text-muted-foreground hover:text-foreground">{project.name}</Link>
{goal && <span>· ◎ {goal.title}</span>}
</>
}
title={

View File

@ -13,7 +13,6 @@ export interface Card {
title: string;
status: string;
column: Column;
goal: string | null;
}
const COLUMNS: Array<{ id: Column; title: string; hint: string; dot: string }> = [
@ -82,9 +81,8 @@ export function Board({ cards, back }: { cards: Card[]; back: string }) {
<Link href={`/t/${card.key}`} className="text-foreground hover:no-underline">
<span className="font-mono text-xs text-primary">{card.key}</span> {card.title}
</Link>
{(card.goal || STATUS[card.status] || NEXT[c.id]) && (
{(STATUS[card.status] || NEXT[c.id]) && (
<div className="flex flex-wrap items-center gap-1.5">
{card.goal && <span className="min-w-0 basis-full truncate text-xs text-muted-foreground">◎ {card.goal}</span>}
{STATUS[card.status] && <Badge variant={STATUS[card.status]!.tone}>{STATUS[card.status]!.label}</Badge>}
{NEXT[c.id] && (
<Button size="xs" className="ml-auto" disabled={pending} onClick={() => move(card.key, NEXT[c.id]!.to)}>

View File

@ -1,7 +1,7 @@
import { existsSync, readdirSync, readFileSync } from "node:fs";
import { join } from "node:path";
import { listSessions, PeppaError, projectForUser, resolveTask, userProjectIds, type Project, type TaskRef } from "@peppa/core";
import { events, goals, projects, questions, sessions, tasks } from "@peppa/db";
import { events, projects, questions, sessions, tasks } from "@peppa/db";
import { formatTaskKey } from "@peppa/shared";
import { and, asc, count, desc, eq, inArray, isNull } from "drizzle-orm";
import { db } from "./db";
@ -36,9 +36,8 @@ export async function projectForUserByKey(userId: number, key: string): Promise<
}
export async function board(projectId: number) {
const gs = await db.select().from(goals).where(eq(goals.projectId, projectId)).orderBy(asc(goals.id));
const ts = await db.select().from(tasks).where(eq(tasks.projectId, projectId)).orderBy(asc(tasks.number));
return { goals: gs, tasks: ts };
return { tasks: ts };
}
export async function projectSessions(projectId: number) {