Snippets are exact-name-keyed templates (PR formats, checklists, style rules) — prescriptive artifacts the user wants applied consistently. Distinct from memories, which are searched descriptive prose. - Migration 0002 adds scope/project_id/deleted_at to snippets, partial unique indexes per scope, and a scope/project CHECK constraint mirroring memories_scope_project_chk. - New @shared-memory/schemas: SnippetName/Put/Get/List/Delete inputs with shared scope-project refinement. - lib/snippets.ts: get/put/list/softDelete helpers used by both the Web Server Actions and the MCP tool handlers. - Four new MCP tools (snippet.put/get/list/delete) with directive descriptions contrasting against memory.* (exact-name lookup vs search; templates vs facts). - /snippets pages: list, new, [name] with edit + delete and a scope-picker when a name lives in multiple scopes. - Nav: Snippets link between Memories and Projects. Design note: when a name exists in both user and project scope, snippet.get without an explicit scope prefers project (if project key given) then falls back to user. The detail page shows a picker when the name is ambiguous and no scope query param was supplied. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
46 lines
1.4 KiB
TypeScript
46 lines
1.4 KiB
TypeScript
import Link from "next/link";
|
|
import { Container } from "@/app/_components/ui/container";
|
|
import { UserMenu } from "./_user-menu";
|
|
import { SearchBox } from "./_search-box";
|
|
import type { Session } from "next-auth";
|
|
|
|
export function Nav({ user }: { user: Session["user"] }) {
|
|
return (
|
|
<header className="fixed top-0 inset-x-0 z-20 h-14 bg-surface-1/80 backdrop-blur border-b border-border">
|
|
<Container className="h-full flex items-center gap-4">
|
|
<Link
|
|
href="/memories"
|
|
className="flex items-center gap-2 text-fg font-semibold tracking-tight no-underline"
|
|
>
|
|
<span className="inline-block size-2 rounded-full bg-accent-400" />
|
|
shared-memory
|
|
</Link>
|
|
|
|
<nav className="hidden md:flex items-center gap-1 ml-2">
|
|
<NavLink href="/memories">Memories</NavLink>
|
|
<NavLink href="/snippets">Snippets</NavLink>
|
|
<NavLink href="/projects">Projects</NavLink>
|
|
<NavLink href="/settings">Settings</NavLink>
|
|
</nav>
|
|
|
|
<div className="flex-1 max-w-md ml-auto">
|
|
<SearchBox />
|
|
</div>
|
|
|
|
<UserMenu user={user} />
|
|
</Container>
|
|
</header>
|
|
);
|
|
}
|
|
|
|
function NavLink({ href, children }: { href: string; children: React.ReactNode }) {
|
|
return (
|
|
<Link
|
|
href={href}
|
|
className="px-2.5 py-1.5 rounded-md text-sm text-fg-muted hover:text-fg hover:bg-surface-2 no-underline"
|
|
>
|
|
{children}
|
|
</Link>
|
|
);
|
|
}
|