🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.
TypeScript analyticsautogenevaluationlangchainlarge-language-modelsllama-indexllmllm-evaluationllm-observabilityllmopsmonitoringobservabilityopen-sourceopenaiplaygroundprompt-engineeringprompt-managementself-hostedycombinator
feat(skills): add CLI installation guidance (#18552)
tobi_klb6b5dd794a43
diff --git a/web/src/__tests__/server/unit/skill-service.servertest.ts b/web/src/__tests__/server/unit/skill-service.servertest.tsindex d4c1bb31be..5d71c59c87 100644--- a/web/src/__tests__/server/unit/skill-service.servertest.ts+++ b/web/src/__tests__/server/unit/skill-service.servertest.ts@@ -170,6 +170,33 @@ describe("SkillService versions", () => {};}+ it("includes labels from older versions without counting their tags", async () => {+ const test = setup();+ test.db.skill.findMany+ .mockResolvedValueOnce([+ { ...test.skill, labels: ["latest"], tags: ["support"] },+ ])+ .mockResolvedValueOnce([+ { labels: ["latest"] },+ { labels: ["staging", "canary"] },+ { labels: ["production", "staging"] },+ ]);++ await expect(+ test.service.filterOptions({ projectId: "project" }),+ ).resolves.toEqual({+ names: ["test-skill"],+ tags: [{ value: "support", count: 1 }],+ labels: ["canary", "latest", "production", "staging"],+ });+ expect(test.db.skill.findMany).toHaveBeenNthCalledWith(+ 2,+ expect.objectContaining({+ where: { projectId: "project", labels: { isEmpty: false } },+ }),+ );+ });+it.each(["setLabels", "deleteVersion", "deleteSkill"] as const)("checks labels added before the mutation lock during %s",async (operation) => {diff --git a/web/src/features/skills/components/InstallSkillDialog.tsx b/web/src/features/skills/components/InstallSkillDialog.tsxnew file mode 100644index 0000000000..b4c35273c8--- /dev/null+++ b/web/src/features/skills/components/InstallSkillDialog.tsx@@ -0,0 +1,98 @@+import { Dialog } from "@/src/components/design-system/Dialog/Dialog";+import { Codeblock } from "@/src/components/design-system/Codeblock/Codeblock";+import { Button } from "@/src/components/design-system/Button/Button";+import {+ SkillInstallationOptions,+ type SkillInstallationOptionsProps,+} from "./SkillInstallationOptions";+import { useLangfuseBaseUrl } from "@/src/features/public-api/hooks/useLangfuseEnvCode";+import { useSkillInstallOptions } from "../hooks/useSkillInstallOptions";+import { shellQuote } from "../utils/shellQuote";++type InstallSkillDialogProps = Pick<+ SkillInstallationOptionsProps,+ "initialValues" | "labels" | "tags"+> & {+ projectId: string;+};++export function InstallSkillDialog({+ projectId,+ labels,+ initialValues,+ ...options+}: InstallSkillDialogProps) {+ const host = useLangfuseBaseUrl();+ const { query: skillOptions, names } = useSkillInstallOptions(+ projectId,+ initialValues.name,+ );++ return (+ <Dialog title="Install with CLI" size="lg" closeOnInteractionOutside>+ <Dialog.Body>+ <p>+ Run these commands in your local project directory. Requires Node.js+ 20 or later. The Langfuse CLI is in beta.+ </p>+ <div className="flex flex-col gap-2">+ <h3 className="font-bold">1. Install the CLI</h3>+ <Codeblock+ language="bash"+ value="npm install -g @langfuse/[email protected]"+ />+ </div>+ <div className="flex flex-col items-start gap-3">+ <h3 className="font-bold">+ 2. Configure local environment variables+ </h3>+ <p className="text-muted-foreground">+ Replace the placeholders with this project’s public and secret keys.+ These exports configure the CLI in your current terminal session. If+ you already set <code>LANGFUSE_BASE_URL</code>, update it to the+ same host.+ </p>+ <Button+ text="Get project API keys"+ href={`/project/${projectId}/settings/api-keys`}+ variant="secondary"+ size="sm"+ />+ <div className="ph-no-capture w-full">+ <Codeblock+ language="bash"+ value={`export LANGFUSE_PUBLIC_KEY='pk-lf-...'\nexport LANGFUSE_SECRET_KEY='sk-lf-...'\nexport LANGFUSE_HOST=${shellQuote(host)}`}+ />+ </div>+ </div>+ {skillOptions.isPending && (+ <p className="text-muted-foreground">Loading installation options…</p>+ )}+ {!skillOptions.isPending && skillOptions.isError && (+ <div className="flex flex-col items-start gap-2">+ <p role="alert">Could not load installation options.</p>+ <Button+ text="Try again"+ variant="secondary"+ size="sm"+ onClick={() => skillOptions.refetch()}+ />+ </div>+ )}+ {!skillOptions.isPending && !skillOptions.isError && (+ <SkillInstallationOptions+ {...options}+ names={names}+ labels={[+ ...new Set([...labels, ...(skillOptions.data?.labels ?? [])]),+ ].sort((a, b) => a.localeCompare(b))}+ initialValues={{+ ...initialValues,+ name: initialValues.name || names[0] || "",+ }}+ />+ )}+ </Dialog.Body>+ </Dialog>+ );+}diff --git a/web/src/features/skills/components/SkillCliSelector.stories.tsx b/web/src/features/skills/components/SkillCliSelector.stories.tsxnew file mode 100644index 0000000000..375e2dac72--- /dev/null+++ b/web/src/features/skills/components/SkillCliSelector.stories.tsx@@ -0,0 +1,38 @@+import { fn } from "storybook/test";+import preview from "../../../../.storybook/preview";+import { SkillCliSelector } from "./SkillCliSelector";++const meta = preview.meta({ component: SkillCliSelector });++export const Tags = meta.story({+ args: {+ label: "Skill tag",+ options: ["customer-support", "engineering", "research"].map((value) => ({+ value,+ label: value,+ })),+ value: "customer-support",+ onValueChange: fn(),+ },+});++export const Labels = meta.story({+ args: {+ label: "Version label",+ options: ["production", "latest"].map((value) => ({ value, label: value })),+ value: "production",+ onValueChange: fn(),+ },+});++export const LongTag = meta.story({+ args: {+ label: "Skill tag",+ options: [+ "customer-support-international-escalation-and-troubleshooting",+ "engineering",+ ].map((value) => ({ value, label: value })),+ value: "customer-support-international-escalation-and-troubleshooting",+ onValueChange: fn(),+ },+});diff --git a/web/src/features/skills/components/SkillCliSelector.tsx b/web/src/features/skills/components/SkillCliSelector.tsxnew file mode 100644index 0000000000..b6bfd87aa7--- /dev/null+++ b/web/src/features/skills/components/SkillCliSelector.tsx@@ -0,0 +1,53 @@+import { useId, type ReactNode } from "react";+import {+ Select,+ SelectContent,+ SelectItem,+ SelectTrigger,+ SelectValue,+} from "@/src/components/ui/select";++type SkillCliSelectorProps = {+ label: string;+ options: { value: string; label: ReactNode }[];+ value: string;+ onValueChange: (value: string) => void;+};++export function SkillCliSelector({+ label,+ options,+ value,+ onValueChange,+}: SkillCliSelectorProps) {+ const id = useId();+ return (+ <div className="ph-no-capture flex min-w-0 flex-col gap-2">+ <label className="text-muted-foreground text-xs" htmlFor={id}>+ {label}+ </label>+ <Select+ value={value}+ onValueChange={onValueChange}+ disabled={options.length === 0}+ >+ <SelectTrigger id={id} aria-label={label}>+ <SelectValue+ placeholder={+ options.length > 0+ ? `Select ${label.toLowerCase()}`+ : "No skills available"+ }+ />+ </SelectTrigger>+ <SelectContent className="ph-no-capture">+ {options.map((option) => (+ <SelectItem key={option.value} value={option.value}>+ {option.label}+ </SelectItem>+ ))}+ </SelectContent>+ </Select>+ </div>+ );+}diff --git a/web/src/features/skills/components/SkillEditor.tsx b/web/src/features/skills/components/SkillEditor.tsxindex dff453b6dc..90801a618d 100644--- a/web/src/features/skills/components/SkillEditor.tsx+++ b/web/src/features/skills/components/SkillEditor.tsx@@ -15,6 +15,7 @@ import {TriangleAlert,RotateCcw,Save,+ Terminal,} from "lucide-react";import { Tooltip } from "@/src/components/design-system/Tooltip/Tooltip";import { IconButton } from "@/src/components/design-system/IconButton/IconButton";@@ -24,6 +25,8 @@ import Page from "@/src/components/layouts/page";import { Button } from "@/src/components/ui/button";import { Dialog } from "@/src/components/design-system/Dialog/Dialog";import { DialogController } from "@/src/components/design-system/DialogController/DialogController";+import { Button as DesignSystemButton } from "@/src/components/design-system/Button/Button";+import { InstallSkillDialog } from "@/src/features/skills/components/InstallSkillDialog";import { showErrorToast, showSuccessToast } from "@/src/features/notifications";import { usePostHogClientCapture } from "@/src/features/posthog-analytics/usePostHogClientCapture";import { createSkillVersionFromDraft } from "@/src/features/skills/actions/createSkillVersion";@@ -110,6 +113,8 @@ export function SkillEditor({const fileCount = useStore(store, (state) => Object.keys(state.files).length);const name = useStore(store, (state) => state.name);const baseVersion = useStore(store, (state) => state.baseVersion);+ const labels = useStore(store, (state) => state.labels);+ const tags = useStore(store, (state) => state.tags);const skillMarkdown = useStore(store,(state) => state.files["SKILL.md"]?.content,@@ -340,7 +345,10 @@ export function SkillEditor({const renderHeaderActions = (openDialog: (- state: { kind: "save"; createNew: boolean } | { kind: "discard" },+ state:+ | { kind: "save"; createNew: boolean }+ | { kind: "discard" }+ | { kind: "install" },) => void,closeMenu?: () => void,) => (@@ -379,6 +387,17 @@ export function SkillEditor({Download</Button>) : null}+ {!isDraft && baseVersion !== null ? (+ <DesignSystemButton+ text="Install with CLI"+ variant="secondary"+ icon={Terminal}+ onClick={() => {+ closeMenu?.();+ openDialog({ kind: "install" });+ }}+ />+ ) : null}{nameWarning ? (<Tooltip label={nameWarning}>{({ getTriggerProps }) => (@@ -457,10 +476,29 @@ export function SkillEditor({return (<DialogController<- { kind: "save"; createNew: boolean } | { kind: "discard" }+ | { kind: "save"; createNew: boolean }+ | { kind: "discard" }+ | { kind: "install" }>- renderDialog={({ state, closeDialog }) =>- state.kind === "discard" ? (+ renderDialog={({ state, closeDialog }) => {+ if (state.kind === "install") {+ if (baseVersion === null) return null;+ return (+ <InstallSkillDialog+ projectId={projectId}+ initialValues={{+ by: "name",+ name,+ version: baseVersion,+ label: labels.includes("production") ? "production" : "latest",+ tag: tags[0] ?? "my-tag",+ }}+ labels={labels}+ tags={tags}+ />+ );+ }+ return state.kind === "discard" ? (<Dialogtitle="Discard draft?"text="Your unsaved file changes and commit note will be lost."@@ -492,8 +530,8 @@ export function SkillEditor({if (await save(state.createNew)) closeDialog();}}/>- )- }+ );+ }}>{({ openDialog }) => (<Pagediff --git a/web/src/features/skills/components/SkillInstallationOptions.stories.tsx b/web/src/features/skills/components/SkillInstallationOptions.stories.tsxnew file mode 100644index 0000000000..1087075cbb--- /dev/null+++ b/web/src/features/skills/components/SkillInstallationOptions.stories.tsx@@ -0,0 +1,49 @@+import preview from "../../../../.storybook/preview";+import { SkillInstallationOptions } from "./SkillInstallationOptions";++const meta = preview.meta({ component: SkillInstallationOptions });++export const FromSkill = meta.story({+ args: {+ initialValues: {+ by: "name",+ name: "review-code",+ version: 7,+ label: "production",+ tag: "engineering",+ },+ names: ["review-code", "refund-policy"],+ labels: ["production", "staging"],+ tags: ["engineering", "research"],+ },+});++export const FromList = meta.story({+ args: {+ initialValues: {+ by: "tag",+ name: "review-code",+ version: null,+ label: "production",+ tag: "customer-support",+ },+ names: ["review-code", "refund-policy"],+ labels: ["production"],+ tags: ["customer-support", "engineering"],+ },+});++export const NoTags = meta.story({+ args: {+ initialValues: {+ by: "tag",+ name: "review-code",+ version: null,+ label: "production",+ tag: "my-tag",+ },+ names: ["review-code", "refund-policy"],+ labels: [],+ tags: [],+ },+});diff --git a/web/src/features/skills/components/SkillInstallationOptions.tsx b/web/src/features/skills/components/SkillInstallationOptions.tsxnew file mode 100644index 0000000000..e27a32c4ad--- /dev/null+++ b/web/src/features/skills/components/SkillInstallationOptions.tsx@@ -0,0 +1,232 @@+import { useId, useState } from "react";+import { SkillNameSchema } from "@langfuse/shared";+import { Tabs } from "@/src/components/design-system/Tabs/Tabs";+import { Input } from "@/src/components/design-system/Input/Input";+import { Codeblock } from "@/src/components/design-system/Codeblock/Codeblock";+import { SkillCliSelector } from "./SkillCliSelector";+import { shellQuote } from "../utils/shellQuote";++export type SkillInstallationOptionsProps = {+ initialValues: {+ by: "name" | "tag";+ name: string;+ version: number | null;+ label: string;+ tag: string;+ };+ labels: string[];+ tags: string[];+ names: string[];+};++export function SkillInstallationOptions({+ initialValues,+ labels,+ tags,+ names,+}: SkillInstallationOptionsProps) {+ const id = useId();+ const [by, setBy] = useState<string>(initialValues.by);+ const [name, setName] = useState(initialValues.name);+ const [selector, setSelector] = useState<string>(+ initialValues.version === null ? "label" : "version",+ );+ const [version, setVersion] = useState(String(initialValues.version ?? 1));+ const [nameLabel, setNameLabel] = useState(initialValues.label);+ const [tag, setTag] = useState(initialValues.tag);+ const [tagLabel, setTagLabel] = useState(initialValues.label);+ const [directory, setDirectory] = useState(".agents/skills");+ const directoryFlag =+ directory === ".agents/skills"+ ? ""+ : ` --directory=${shellQuote(directory)}`;+ const labelOptions = [...new Set([...labels, "production", "latest"])];+ const activeSelector = by === "tag" ? "label" : selector;+ const pinnedVersion = activeSelector === "version";+ const validVersion =+ /^[1-9]\d*$/.test(version) && Number.isSafeInteger(Number(version));+ const selectedName = selectedOption(name, names);+ const selectedTag = tags.length > 0 ? selectedOption(tag, tags) : tag;+ const selectedNameLabel = selectedOption(nameLabel, labelOptions);+ const selectedTagLabel = selectedOption(tagLabel, labelOptions);+ const nameValidation = SkillNameSchema.safeParse(selectedName);+ const normalizedName = nameValidation.success+ ? nameValidation.data+ : selectedName;+ const nameTarget = pinnedVersion+ ? `${shellQuote(normalizedName)} --version ${version}`+ : `${shellQuote(normalizedName)} --label=${shellQuote(selectedNameLabel)}`;+ const target =+ by === "tag"+ ? `--tag=${shellQuote(selectedTag.trim())} --label=${shellQuote(selectedTagLabel)}`+ : nameTarget;+ const invalidNameError = nameValidation.success+ ? null+ : "Select a valid skill name.";+ const nameError =+ names.length === 0+ ? "No skills available in this project."+ : invalidNameError;+ const tagError = selectedTag.trim()+ ? null+ : "Enter a tag to generate the install command.";+ const versionError =+ pinnedVersion && !validVersion+ ? "Enter a positive whole-number version."+ : null;+ const error = by === "name" ? (nameError ?? versionError) : tagError;+ const description = getInstallationDescription(by, pinnedVersion);++ return (+ <div className="ph-no-capture flex flex-col gap-4">+ <div className="flex flex-col gap-3">+ <h3 className="font-bold">3. Install skills</h3>+ <div className="grid min-w-0 gap-4 sm:grid-cols-3">+ <Tabs value={by} onValueChange={setBy}>+ <Tabs.List aria-label="Install by" variant="inset" size="md">+ <Tabs.Trigger value="name" label="Name" />+ <Tabs.Trigger value="tag" label="Tag" />+ </Tabs.List>+ <Tabs.Content value="name">+ <div className="pt-3">+ <SkillCliSelector+ label="Skill name"+ options={names.map((name) => ({ value: name, label: name }))}+ value={selectedName}+ onValueChange={setName}+ />+ </div>+ </Tabs.Content>+ <Tabs.Content value="tag">+ <div className="pt-3">+ {tags.length > 0 ? (+ <SkillCliSelector+ label="Skill tag"+ options={tags.map((tag) => ({ value: tag, label: tag }))}+ value={selectedTag}+ onValueChange={setTag}+ />+ ) : (+ <div className="flex min-w-0 flex-col gap-2">+ <label+ className="text-muted-foreground text-xs"+ htmlFor={`${id}-tag`}+ >+ Skill tag+ </label>+ <Input+ id={`${id}-tag`}+ value={selectedTag}+ onChange={(event) => setTag(event.target.value)}+ placeholder="my-tag"+ />+ </div>+ )}+ </div>+ </Tabs.Content>+ </Tabs>+ <Tabs value={activeSelector} onValueChange={setSelector}>+ <Tabs.List aria-label="Version selection" variant="inset" size="md">+ <Tabs.Trigger+ value="version"+ label="Version"+ disabled={by === "tag"}+ />+ <Tabs.Trigger value="label" label="Label" />+ </Tabs.List>+ <Tabs.Content value="version">+ <div className="flex min-w-0 flex-col gap-2 pt-3">+ <label+ className="text-muted-foreground text-xs"+ htmlFor={`${id}-version`}+ >+ Skill version+ </label>+ <Input+ id={`${id}-version`}+ type="number"+ value={version}+ onChange={(event) => setVersion(event.target.value)}+ aria-invalid={!validVersion}+ />+ </div>+ </Tabs.Content>+ <Tabs.Content value="label">+ <div className="pt-3">+ <SkillCliSelector+ label="Version label"+ options={labelOptions.map((label) => ({+ value: label,+ label,+ }))}+ value={by === "tag" ? selectedTagLabel : selectedNameLabel}+ onValueChange={by === "tag" ? setTagLabel : setNameLabel}+ />+ </div>+ </Tabs.Content>+ </Tabs>+ <div className="flex min-w-0 flex-col gap-3 sm:pt-10">+ <SkillCliSelector+ label="Install to"+ options={[+ { value: ".agents/skills", label: "Default" },+ { value: ".claude/skills", label: "Claude Code" },+ { value: ".cursor/skills", label: "Cursor" },+ ].map(({ value, label }) => ({+ value,+ label: (+ <span className="flex min-w-0 items-center gap-2">+ <span className="shrink-0">{label} </span>+ <span+ className="text-muted-foreground truncate text-xs"+ title={value}+ >+ {value}+ </span>+ </span>+ ),+ }))}+ value={directory}+ onValueChange={setDirectory}+ />+ </div>+ </div>+ <p className="text-muted-foreground">{description}</p>+ {error ? (+ <p role="alert" className="text-destructive">+ {error}+ </p>+ ) : (+ <Codeblock+ language="bash"+ value={`langfuse skills install ${target}${directoryFlag}`}+ />+ )}+ </div>+ <div className="flex flex-col gap-2">+ <h3 className="font-bold">4. Update installed skills</h3>+ <p className="text-muted-foreground">+ Skills are installed in <code>{directory}</code>. Commit{" "}+ <code>langfuse-skills-lock.json</code> to share the selection with+ your team. Updates use the saved directories and follow saved labels;+ pinned versions stay fixed.+ </p>+ <Codeblock language="bash" value="langfuse skills update" />+ </div>+ </div>+ );+}++function selectedOption(value: string, options: string[]) {+ return options.includes(value) ? value : (options[0] ?? "");+}++function getInstallationDescription(by: string, pinnedVersion: boolean) {+ if (by === "tag") {+ return "Installs every skill with this tag at the chosen label. Each skill must have that label.";+ }+ if (pinnedVersion) {+ return "Pins this skill to the selected version.";+ }+ return "Follows this label when you update, even when it moves to a new version.";+}diff --git a/web/src/features/skills/components/SkillsPage.tsx b/web/src/features/skills/components/SkillsPage.tsxindex a2c9ef1713..36fda8a622 100644--- a/web/src/features/skills/components/SkillsPage.tsx+++ b/web/src/features/skills/components/SkillsPage.tsx@@ -1,6 +1,6 @@import { useMemo } from "react";import Link from "next/link";-import { Download, FileCode2, Plus, Trash } from "lucide-react";+import { Download, FileCode2, Plus, Terminal, Trash } from "lucide-react";import { NumberParam, useQueryParams, withDefault } from "use-query-params";import Page from "@/src/components/layouts/page";import { Button } from "@/src/components/ui/button";@@ -40,49 +40,121 @@ import {skillsFilterConfig,} from "../constants/skillsFilterConfig";import { ImportSkillsDialog } from "./ImportSkillsDialog";+import { InstallSkillDialog } from "./InstallSkillDialog";+import { useSkillInstallOptions } from "../hooks/useSkillInstallOptions";type SkillRow = RouterOutput["skills"]["all"]["data"][number];export function SkillsPage() {const projectId = useProjectIdFromURL() ?? "";const canCreate = useHasProjectAccess({ projectId, scope: "skills:CUD" });- const capture = usePostHogClientCapture();- const newSkillHref = `/project/${projectId}/skills/new`;+ const { query: filterOptions } = useSkillInstallOptions(projectId, "");return (- <Page- headerProps={{- title: "Skills",- titleBadges: <InternalFeatureBadge />,- help: {- description:- "Create, version, and distribute reusable agent skills from one place.",- href: "https://langfuse.com/docs",- },- actionButtonsRight: (- <div className="flex items-center gap-2">- <ImportSkillsDialog key={projectId} projectId={projectId}>- {(openDialog) => (- <DesignSystemButton- text="Import"- icon={Download}- variant="secondary"- disabled={!canCreate}- onClick={openDialog}- />- )}- </ImportSkillsDialog>- <NewSkillButton- canCreate={canCreate}- href={newSkillHref}- onOpen={() => capture("skills:new_form_open")}- />- </div>- ),- }}+ <DialogController+ renderDialog={() => (+ <InstallSkillDialog+ projectId={projectId}+ initialValues={{+ by: "tag",+ name: "",+ version: null,+ label: "production",+ tag: filterOptions.data?.tags[0]?.value ?? "my-tag",+ }}+ labels={["production", "latest"]}+ tags={filterOptions.data?.tags.map((tag) => tag.value) ?? []}+ />+ )}>- <SkillsList key={projectId} projectId={projectId} canDelete={canCreate} />- </Page>+ {({ openDialog }) => (+ <Page+ headerProps={{+ title: "Skills",+ titleBadges: <InternalFeatureBadge />,+ help: {+ description:+ "Create, version, and distribute reusable agent skills from one place.",+ href: "https://langfuse.com/docs",+ },+ actionButtonsRight: (+ <SkillsHeaderActions+ projectId={projectId}+ canCreate={canCreate}+ installDisabled={filterOptions.isPending}+ onInstall={openDialog}+ />+ ),+ actionButtonsMenu: ({ closeMenu }) => (+ <SkillsHeaderActions+ projectId={projectId}+ canCreate={canCreate}+ installDisabled={filterOptions.isPending}+ onInstall={openDialog}+ closeMenu={() => closeMenu({ handoffFocus: true })}+ />+ ),+ }}+ >+ <SkillsList+ key={projectId}+ projectId={projectId}+ canDelete={canCreate}+ />+ </Page>+ )}+ </DialogController>+ );+}++type SkillsHeaderActionsProps = {+ projectId: string;+ canCreate: boolean;+ installDisabled: boolean;+ onInstall: () => void;+ closeMenu?: () => void;+};++function SkillsHeaderActions({+ projectId,+ canCreate,+ installDisabled,+ onInstall,+ closeMenu,+}: SkillsHeaderActionsProps) {+ const capture = usePostHogClientCapture();++ function handleInstall() {+ closeMenu?.();+ onInstall();+ }++ return (+ <div className="flex max-w-full flex-wrap items-center gap-2">+ <DesignSystemButton+ text="Install with CLI"+ icon={Terminal}+ variant="secondary"+ disabled={installDisabled}+ onClick={handleInstall}+ />+ <ImportSkillsDialog key={projectId} projectId={projectId}>+ {(openDialog) => (+ <DesignSystemButton+ text="Import"+ icon={Download}+ variant="secondary"+ disabled={!canCreate}+ onClick={openDialog}+ />+ )}+ </ImportSkillsDialog>+ <NewSkillButton+ canCreate={canCreate}+ href={`/project/${projectId}/skills/new`}+ onOpen={() => capture("skills:new_form_open")}+ />+ </div>);}diff --git a/web/src/features/skills/hooks/useSkillInstallOptions.ts b/web/src/features/skills/hooks/useSkillInstallOptions.tsnew file mode 100644index 0000000000..d939711cc7--- /dev/null+++ b/web/src/features/skills/hooks/useSkillInstallOptions.ts@@ -0,0 +1,16 @@+import { api } from "@/src/utils/api";++export function useSkillInstallOptions(projectId: string, initialName: string) {+ const query = api.skills.filterOptions.useQuery(+ { projectId },+ { enabled: Boolean(projectId) },+ );+ const names = [+ ...new Set([+ ...(query.data?.names ?? []),+ ...(initialName ? [initialName] : []),+ ]),+ ].sort((a, b) => a.localeCompare(b));++ return { query, names };+}diff --git a/web/src/features/skills/server/skill-service.ts b/web/src/features/skills/server/skill-service.tsindex 52e1aa338c..f3eb344465 100644--- a/web/src/features/skills/server/skill-service.ts+++ b/web/src/features/skills/server/skill-service.ts@@ -423,13 +423,19 @@ export class SkillService {}async filterOptions(params: { projectId: string }) {- const skills = await this.prisma.skill.findMany({- where: {- projectId: params.projectId,- labels: { has: SKILL_LATEST_LABEL },- },- select: { tags: true },- });+ const [skills, labeledVersions] = await Promise.all([+ this.prisma.skill.findMany({+ where: {+ projectId: params.projectId,+ labels: { has: SKILL_LATEST_LABEL },+ },+ select: { name: true, tags: true },+ }),+ this.prisma.skill.findMany({+ where: { projectId: params.projectId, labels: { isEmpty: false } },+ select: { labels: true },+ }),+ ]);const counts = new Map<string, number>();for (const skill of skills) {for (const tag of new Set(skill.tags)) {@@ -437,6 +443,12 @@ export class SkillService {}}return {+ labels: [+ ...new Set(labeledVersions.flatMap(({ labels }) => labels)),+ ].sort((a, b) => a.localeCompare(b)),+ names: [...new Set(skills.map(({ name }) => name))].sort((a, b) =>+ a.localeCompare(b),+ ),tags: [...counts].map(([value, count]) => ({ value, count })).sort((a, b) => a.value.localeCompare(b.value)),diff --git a/web/src/features/skills/utils/shellQuote.ts b/web/src/features/skills/utils/shellQuote.tsnew file mode 100644index 0000000000..0c9c96c600--- /dev/null+++ b/web/src/features/skills/utils/shellQuote.ts@@ -0,0 +1,4 @@+// Single quotes keep shell metacharacters in user-defined CLI values literal.+export function shellQuote(value: string) {+ return `'${value.replaceAll("'", "'\"'\"'")}'`;+}