🪢 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 import instructions (#18794)
tobi_kla8db3a478b2d
diff --git a/web/src/features/skills/components/CliSkillImportInstructions.tsx b/web/src/features/skills/components/CliSkillImportInstructions.tsxnew file mode 100644index 0000000000..185ab7394f--- /dev/null+++ b/web/src/features/skills/components/CliSkillImportInstructions.tsx@@ -0,0 +1,64 @@+import { Button } from "@/src/components/design-system/Button/Button";+import { Codeblock } from "@/src/components/design-system/Codeblock/Codeblock";+import { useLangfuseBaseUrl } from "@/src/features/public-api/hooks/useLangfuseEnvCode";+import { shellQuote } from "../utils/shellQuote";++export function CliSkillImportInstructions({+ projectId,+}: {+ projectId: string;+}) {+ const host = useLangfuseBaseUrl();++ return (+ <div className="flex flex-col gap-4">+ <p>+ Push skills from your local project to Langfuse. 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 or update the CLI</h3>+ <Codeblock+ language="bash"+ value="npm install -g @langfuse/[email protected]"+ />+ </div>+ <div className="flex flex-col items-start gap-2">+ <h3 className="font-bold">2. Configure your project</h3>+ <p className="text-muted-foreground">+ Replace the placeholders with this project’s API keys. These exports+ configure 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>+ <div className="flex flex-col gap-2">+ <h3 className="font-bold">3. Import skills</h3>+ <p className="text-muted-foreground">+ Run from your local project directory. Replace the example path with a+ skill folder containing SKILL.md, or push all skills under a+ directory. The name in SKILL.md identifies the skill in Langfuse.+ </p>+ <Codeblock+ language="bash"+ value={`# Push one skill\nlangfuse skills push .agents/skills/my-skill\n\n# Push all skills in a directory\nlangfuse skills push .agents/skills --recursive`}+ />+ <p className="text-muted-foreground text-xs">+ Creates new skills or publishes a new version of existing skills when+ their files change.+ </p>+ </div>+ </div>+ );+}diff --git a/web/src/features/skills/components/ImportSkillsDialog.tsx b/web/src/features/skills/components/ImportSkillsDialog.tsxindex 0a1ddb7d47..3812bc21d4 100644--- a/web/src/features/skills/components/ImportSkillsDialog.tsx+++ b/web/src/features/skills/components/ImportSkillsDialog.tsx@@ -9,11 +9,13 @@ import { Checkbox } from "@/src/components/design-system/Checkbox/Checkbox";import { Dialog } from "@/src/components/design-system/Dialog/Dialog";import { DialogController } from "@/src/components/design-system/DialogController/DialogController";import { Input } from "@/src/components/design-system/Input/Input";+import { Tabs } from "@/src/components/design-system/Tabs/Tabs";import { showSuccessToast } from "@/src/features/notifications";import { usePostHogClientCapture } from "@/src/features/posthog-analytics/usePostHogClientCapture";import { api, getTrpcErrorCode, type RouterOutputs } from "@/src/utils/api";import { LocalSkillImportSource } from "./LocalSkillImportSource";+import { CliSkillImportInstructions } from "./CliSkillImportInstructions";import type { ComparedSkill, SkillImportDiscovery } from "./skillImportTypes";import { compareImportedSkills } from "../utils/compare-imported-skills";@@ -30,6 +32,7 @@ export function ImportSkillsDialog({}) {const utils = api.useUtils();const capture = usePostHogClientCapture();+ const [tab, setTab] = useState("local");const [discovery, setDiscovery] = useState<Pick<SkillImportDiscovery, "source" | "commitMessage"> & {skills: ComparedSkill[];@@ -232,6 +235,7 @@ export function ImportSkillsDialog({const createOpenHandler = (openDialog: () => void) => {return function handleOpenDialog() {reset();+ setTab("local");capture("skills:import_open");openDialog();};@@ -243,8 +247,9 @@ export function ImportSkillsDialog({renderDialog={({ closeDialog }) => (<Dialogtitle="Import skills"+ size="lg"actions={- discovery+ tab === "local" && discovery? [{label: `Import ${selectedSkills.length} ${selectedSkills.length === 1 ? "skill" : "skills"}`,@@ -257,144 +262,182 @@ export function ImportSkillsDialog({}><Dialog.Body>- <LocalSkillImportSource busy={busy} onScan={scan} onReset={reset} />- {scanError ? (- <p role="alert" className="ph-no-capture text-destructive">- {scanError}- </p>- ) : null}- {discovery && skills.length === 0 ? (- <p role="status" className="text-muted-foreground">- No SKILL.md files found in this source.- </p>- ) : null}- {discovery && skills.length > 0 ? (- <>- <div className="ph-no-capture">- <Input- aria-label="Search skills"- placeholder="Search skills by name, description, or path"- value={search}- onChange={handleSearchChange}- />- </div>- <div className="flex items-center justify-between gap-2">- <p role="status">- {searchTerm ? `${visibleSkills.length} of ` : ""}- {skills.length} {skills.length === 1 ? "skill" : "skills"}{" "}- {searchTerm ? "shown" : "found"}- {" · "}- {selectedSkills.length} selected- </p>- <Button- text={`${allVisibleSelected ? "Deselect all" : "Select all"}${searchTerm ? " shown" : ""}`}- variant="ghost"- size="sm"- disabled={busy || visibleSelectable.length === 0}- onClick={toggleVisibleSelection}- />- </div>- {visibleSkills.length === 0 ? (- <p role="status" className="text-muted-foreground">- No skills match your search.- </p>- ) : null}- <ul className="ph-no-capture flex flex-col divide-y rounded-md border">- {visibleSkills.map((skill, index) => {- const result = results[skill.path];- const error =- skill.error ||- (result?.status === "error" ? result.message : null);- const imported = result?.status === "success";- const existingStatus = skill.hasChanges- ? "New version"- : "Already up to date";- return (- <li- key={skill.path}- className="flex items-start gap-3 p-3"+ <Tabs value={tab} onValueChange={setTab}>+ <Tabs.List+ variant="inset"+ size="md"+ layout="full"+ aria-label="Import method"+ >+ <Tabs.Trigger+ value="local"+ label="Local files"+ disabled={busy}+ />+ <Tabs.Trigger value="cli" label="CLI" disabled={busy} />+ </Tabs.List>+ <div className="pt-4">+ <Tabs.Content value="cli">+ <CliSkillImportInstructions projectId={projectId} />+ </Tabs.Content>+ <Tabs.Content value="local">+ <div className="flex flex-col gap-4">+ <LocalSkillImportSource+ busy={busy}+ onScan={scan}+ onReset={reset}+ />+ {scanError ? (+ <p+ role="alert"+ className="ph-no-capture text-destructive">- <div className="pt-0.5">- <Checkbox- id={`import-skill-${index}`}- checked={selected.has(skill.path)}- disabled={- busy ||- Boolean(skill.error) ||- imported ||- (skill.exists && !skill.hasChanges)- }- onCheckedChange={createSkillSelectHandler(- skill.path,- )}+ {scanError}+ </p>+ ) : null}+ {discovery && skills.length === 0 ? (+ <p role="status" className="text-muted-foreground">+ No SKILL.md files found in this source.+ </p>+ ) : null}+ {discovery && skills.length > 0 ? (+ <>+ <div className="ph-no-capture">+ <Input+ aria-label="Search skills"+ placeholder="Search skills by name, description, or path"+ value={search}+ onChange={handleSearchChange}/></div>- <label- htmlFor={`import-skill-${index}`}- className="flex min-w-0 flex-1 cursor-pointer flex-col gap-1"- >- <span className="flex flex-wrap items-center gap-2">- <span className="font-bold break-words">- {skill.name}- </span>- {!skill.error ? (- <Badge- text={skill.exists ? existingStatus : "Import"}- color={- skill.exists && !skill.hasChanges- ? "yellow"- : "blue"- }- size="sm"- />- ) : null}- {!skill.error ? (- <Badge- text={`${skill.files.length} ${skill.files.length === 1 ? "file" : "files"}`}- color="primary"- size="sm"- />- ) : null}- </span>- {skill.exists && !skill.error ? (- <span className="text-muted-foreground text-xs">- {skill.hasChanges- ? "Files differ from the latest saved version. Import to create a new version."- : "Files match the latest saved version."}- </span>- ) : null}- <span className="text-muted-foreground text-xs break-all">- {skill.path}- </span>- {skill.description ? (- <span className="text-muted-foreground text-sm break-words">- {skill.description}- </span>- ) : null}- {error ? (- <span- className="text-destructive text-sm"- role="alert"- >- {error}- </span>- ) : null}- {result?.status === "success" ? (- <span className="text-sm" role="status">- Imported as v{result.version}- </span>- ) : null}- </label>- </li>- );- })}- </ul>- <p className="text-muted-foreground text-xs">- Skills with an existing name will get a new version.- Production labels stay unchanged.- </p>- </>- ) : null}+ <div className="flex items-center justify-between gap-2">+ <p role="status">+ {searchTerm ? `${visibleSkills.length} of ` : ""}+ {skills.length}{" "}+ {skills.length === 1 ? "skill" : "skills"}{" "}+ {searchTerm ? "shown" : "found"}+ {" · "}+ {selectedSkills.length} selected+ </p>+ <Button+ text={`${allVisibleSelected ? "Deselect all" : "Select all"}${searchTerm ? " shown" : ""}`}+ variant="ghost"+ size="sm"+ disabled={busy || visibleSelectable.length === 0}+ onClick={toggleVisibleSelection}+ />+ </div>+ {visibleSkills.length === 0 ? (+ <p role="status" className="text-muted-foreground">+ No skills match your search.+ </p>+ ) : null}+ <ul className="ph-no-capture flex flex-col divide-y rounded-md border">+ {visibleSkills.map((skill, index) => {+ const result = results[skill.path];+ const error =+ skill.error ||+ (result?.status === "error"+ ? result.message+ : null);+ const imported = result?.status === "success";+ const existingStatus = skill.hasChanges+ ? "New version"+ : "Already up to date";+ return (+ <li+ key={skill.path}+ className="flex items-start gap-3 p-3"+ >+ <div className="pt-0.5">+ <Checkbox+ id={`import-skill-${index}`}+ checked={selected.has(skill.path)}+ disabled={+ busy ||+ Boolean(skill.error) ||+ imported ||+ (skill.exists && !skill.hasChanges)+ }+ onCheckedChange={createSkillSelectHandler(+ skill.path,+ )}+ />+ </div>+ <label+ htmlFor={`import-skill-${index}`}+ className="flex min-w-0 flex-1 cursor-pointer flex-col gap-1"+ >+ <span className="flex flex-wrap items-center gap-2">+ <span className="font-bold break-words">+ {skill.name}+ </span>+ {!skill.error ? (+ <Badge+ text={+ skill.exists+ ? existingStatus+ : "Import"+ }+ color={+ skill.exists && !skill.hasChanges+ ? "yellow"+ : "blue"+ }+ size="sm"+ />+ ) : null}+ {!skill.error ? (+ <Badge+ text={`${skill.files.length} ${skill.files.length === 1 ? "file" : "files"}`}+ color="primary"+ size="sm"+ />+ ) : null}+ </span>+ {skill.exists && !skill.error ? (+ <span className="text-muted-foreground text-xs">+ {skill.hasChanges+ ? "Files differ from the latest saved version. Import to create a new version."+ : "Files match the latest saved version."}+ </span>+ ) : null}+ <span className="text-muted-foreground text-xs break-all">+ {skill.path}+ </span>+ {skill.description ? (+ <span className="text-muted-foreground text-sm break-words">+ {skill.description}+ </span>+ ) : null}+ {error ? (+ <span+ className="text-destructive text-sm"+ role="alert"+ >+ {error}+ </span>+ ) : null}+ {result?.status === "success" ? (+ <span className="text-sm" role="status">+ Imported as v{result.version}+ </span>+ ) : null}+ </label>+ </li>+ );+ })}+ </ul>+ <p className="text-muted-foreground text-xs">+ Skills with an existing name will get a new version.+ Production labels stay unchanged.+ </p>+ </>+ ) : null}+ </div>+ </Tabs.Content>+ </div>+ </Tabs></Dialog.Body></Dialog>)}diff --git a/web/src/features/skills/components/InstallSkillDialog.tsx b/web/src/features/skills/components/InstallSkillDialog.tsxindex b4c35273c8..0eb4ce16c1 100644--- a/web/src/features/skills/components/InstallSkillDialog.tsx+++ b/web/src/features/skills/components/InstallSkillDialog.tsx@@ -39,7 +39,7 @@ export function InstallSkillDialog({<h3 className="font-bold">1. Install the CLI</h3><Codeblocklanguage="bash"- value="npm install -g @langfuse/[email protected]"+ value="npm install -g @langfuse/[email protected]"/></div><div className="flex flex-col items-start gap-3">