Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

merge main into litellm_skills_ssh_sources and re-apply ssh source parsing on the shadcn skill form

ryanb0ed6c8d8947
diff --cc ui/litellm-dashboard/src/app/(dashboard)/skills/_components/add_plugin_form.tsx
index 226f9d19837,5627f402a65..0c114dce700
--- a/ui/litellm-dashboard/src/app/(dashboard)/skills/_components/add_plugin_form.tsx
+++ b/ui/litellm-dashboard/src/app/(dashboard)/skills/_components/add_plugin_form.tsx
@@@ -160,152 -219,208 +219,208 @@@ const AddPluginForm: React.FC<AddPlugin
};
return (
- <Modal title="Add New Skill" open={visible} onCancel={handleCancel} footer={null} width={700} className="top-8">
- <Form form={form} layout="vertical" onFinish={handleSubmit} className="mt-4">
- {/* Smart URL Input */}
- <Form.Item
- label="Repository URL"
- name="skillUrl"
- rules={[{ required: true, message: "Please enter a repository URL" }]}
- tooltip="Paste an HTTPS git repository URL from GitHub, GitLab, Bitbucket, or a self-hosted host, e.g. github.com/org/repo or github.com/org/repo/tree/main/my-skill. For a private repository use its SSH clone URL ([email protected]:org/repo.git) so Claude Code clones it with your own SSH key"
- >
- <Input
- placeholder="https://github.com/org/repo or https://gitlab.com/org/repo"
- className="rounded-lg"
- onChange={handleUrlChange}
- />
- </Form.Item>
-
- {/* Optional subfolder for monorepos */}
- <Form.Item
- label="Subfolder path (Optional)"
- name="subPath"
- rules={[
- {
- validator: (_, value) =>
- !value || isValidSubPath(value)
- ? Promise.resolve()
- : Promise.reject(
- new Error(
- "Subfolder must be a relative path like plugins/my-skill (letters, numbers, dots, hyphens, underscores)",
- ),
- ),
- },
- ]}
- tooltip="Path within the repository where the skill lives (e.g., plugins/my-skill). Leave empty if the skill is at the repo root."
- extra={urlEncodesSubdir ? "The URL already points to a subfolder, so this field is disabled" : undefined}
- >
- <Input
- placeholder="plugins/my-skill"
- className="rounded-lg"
- onChange={handleSubPathChange}
- disabled={urlEncodesSubdir}
- />
- </Form.Item>
-
- {/* Parsed preview */}
- {urlPreview && (
- <div className="mb-4 px-3 py-2 bg-blue-50 border border-blue-200 rounded-lg text-sm text-blue-700">
- Detected: {urlPreview.label}
- </div>
- )}
-
- {/* Skill Name */}
- <Form.Item
- label="Skill Name"
- name="name"
- rules={[
- { required: true, message: "Please enter skill name" },
- {
- pattern: /^[a-z0-9-]+$/,
- message: "Name must be kebab-case (lowercase, numbers, hyphens only)",
- },
- ]}
- tooltip="Unique identifier in kebab-case format (e.g., my-skill)"
- >
- <Input placeholder="my-skill" className="rounded-lg" />
- </Form.Item>
-
- {/* Domain and Namespace — side by side */}
- <div className="flex gap-4">
- <Form.Item
- label="Domain (Optional)"
- name="domain"
- tooltip="Top-level grouping in the Skill Hub (e.g., Productivity)"
- className="flex-1"
- >
- <Input placeholder="Productivity" className="rounded-lg" />
- </Form.Item>
- <Form.Item
- label="Namespace (Optional)"
- name="namespace"
- tooltip="Sub-grouping within domain (e.g., workflows)"
- className="flex-1"
- >
- <Input placeholder="workflows" className="rounded-lg" />
- </Form.Item>
- </div>
-
- {/* Description */}
- <Form.Item label="Description (Optional)" name="description" tooltip="Brief description of what the skill does">
- <TextArea rows={3} placeholder="A skill that helps with..." maxLength={500} className="rounded-lg" />
- </Form.Item>
-
- {/* Category */}
- <Form.Item label="Category (Optional)" name="category" tooltip="Select a category or enter a custom one">
- <Select
- placeholder="Select or type a category"
- allowClear
- showSearch
- optionFilterProp="children"
- className="rounded-lg"
- >
- {PREDEFINED_CATEGORIES.map((cat) => (
- <Option key={cat} value={cat}>
- {cat}
- </Option>
- ))}
- </Select>
- </Form.Item>
-
- {/* Keywords */}
- <Form.Item label="Keywords (Optional)" name="keywords" tooltip="Comma-separated list of keywords for search">
- <Input placeholder="search, web, api" className="rounded-lg" />
- </Form.Item>
-
- {/* Version */}
- <Form.Item label="Version (Optional)" name="version" tooltip="Semantic version (e.g., 1.0.0)">
- <Input placeholder="1.0.0" className="rounded-lg" />
- </Form.Item>
-
- {/* Author Name */}
- <Form.Item label="Author Name (Optional)" name="authorName" tooltip="Name of the skill author or organization">
- <Input placeholder="Your Name or Organization" className="rounded-lg" />
- </Form.Item>
-
- {/* Author Email */}
- <Form.Item
- label="Author Email (Optional)"
- name="authorEmail"
- rules={[{ type: "email", message: "Please enter a valid email" }]}
- tooltip="Contact email for the skill author"
- >
- <Input type="email" placeholder="[email protected]" className="rounded-lg" />
- </Form.Item>
-
- {/* Submit Buttons */}
- <Form.Item className="mb-0 mt-6">
- <div className="flex justify-end gap-2">
- <Button variant="secondary" onClick={handleCancel} disabled={isSubmitting}>
- Cancel
- </Button>
- <Button type="submit" loading={isSubmitting}>
- {isSubmitting ? "Adding..." : "Add Skill"}
- </Button>
- </div>
- </Form.Item>
- </Form>
- </Modal>
+ <Dialog open={visible} onOpenChange={(open) => !open && handleCancel()}>
+ <DialogContent className="top-8 max-h-[calc(100dvh-4rem)] translate-y-0 overflow-y-auto sm:max-w-[700px]">
+ <DialogHeader>
+ <DialogTitle>Add New Skill</DialogTitle>
+ </DialogHeader>
+ <TooltipProvider>
+ <form onSubmit={form.handleSubmit(handleSubmit)} noValidate className="mt-4">
+ <FieldGroup>
+ <FormField
+ control={form.control}
+ name="skillUrl"
+ label={labelWithHint(
+ "Source URL",
- "Paste an HTTPS git repository URL from GitHub, GitLab, Bitbucket, or a self-hosted host (e.g. github.com/org/repo or github.com/org/repo/tree/main/my-skill), or an HTTPS link to a .zip archive of the skill hosted on S3 or any static file server.",
++ "Paste an HTTPS git repository URL from GitHub, GitLab, Bitbucket, or a self-hosted host (e.g. github.com/org/repo or github.com/org/repo/tree/main/my-skill), or an HTTPS link to a .zip archive of the skill hosted on S3 or any static file server. For a private repository use its SSH clone URL ([email protected]:org/repo.git) so Claude Code clones it with your own SSH key.",
+ )}
+ >
+ {({ ref, onChange, ...field }) => (
+ <Input
+ {...field}
+ ref={ref}
+ placeholder="https://github.com/org/repo or https://bucket.s3.amazonaws.com/my-skill.zip"
+ className="rounded-lg"
+ onChange={(event) => {
+ onChange(event);
+ recomputePreview(event.target.value, form.getValues("subPath"));
+ }}
+ />
+ )}
+ </FormField>
+
+ <FormField
+ control={form.control}
+ name="subPath"
+ label={labelWithHint(
+ "Subfolder path (Optional)",
+ "Path within the repository where the skill lives (e.g., plugins/my-skill). Leave empty if the skill is at the repo root.",
+ )}
+ description={subPathLock ? SUB_PATH_LOCK_REASON[subPathLock] : undefined}
+ >
+ {({ ref, onChange, ...field }) => (
+ <Input
+ {...field}
+ ref={ref}
+ placeholder="plugins/my-skill"
+ className="rounded-lg"
+ onChange={(event) => {
+ onChange(event);
+ recomputePreview(form.getValues("skillUrl"), event.target.value);
+ }}
+ disabled={subPathLock !== null}
+ />
+ )}
+ </FormField>
+
+ {urlPreview?.parsed.source === "archive" && (
+ <FormField
+ control={form.control}
+ name="sha256"
+ label={labelWithHint(
+ "Archive SHA-256 (Optional)",
+ "Hex digest of the zip file. Claude Code refuses to install the archive if its checksum does not match.",
+ )}
+ >
+ {({ ref, ...field }) => (
+ <Input {...field} ref={ref} placeholder="64 hex characters" className="rounded-lg font-mono" />
+ )}
+ </FormField>
+ )}
+
+ {urlPreview && (
+ <div className="rounded-lg border border-info/20 bg-info/10 px-3 py-2 text-sm text-info">
+ Detected: {urlPreview.label}
+ </div>
+ )}
+
+ <FormField
+ control={form.control}
+ name="name"
+ label={labelWithHint("Skill Name", "Unique identifier in kebab-case format (e.g., my-skill)")}
+ >
+ {({ ref, ...field }) => <Input {...field} ref={ref} placeholder="my-skill" className="rounded-lg" />}
+ </FormField>
+
+ <div className="flex gap-4">
+ <FormField
+ control={form.control}
+ name="domain"
+ label={labelWithHint("Domain (Optional)", "Top-level grouping in the Skill Hub (e.g., Productivity)")}
+ className="flex-1"
+ >
+ {({ ref, ...field }) => (
+ <Input {...field} ref={ref} placeholder="Productivity" className="rounded-lg" />
+ )}
+ </FormField>
+ <FormField
+ control={form.control}
+ name="namespace"
+ label={labelWithHint("Namespace (Optional)", "Sub-grouping within domain (e.g., workflows)")}
+ className="flex-1"
+ >
+ {({ ref, ...field }) => <Input {...field} ref={ref} placeholder="workflows" className="rounded-lg" />}
+ </FormField>
+ </div>
+
+ <FormField
+ control={form.control}
+ name="description"
+ label={labelWithHint("Description (Optional)", "Brief description of what the skill does")}
+ >
+ {({ ref, ...field }) => (
+ <Textarea
+ {...field}
+ ref={ref}
+ rows={3}
+ placeholder="A skill that helps with..."
+ maxLength={500}
+ className="rounded-lg"
+ />
+ )}
+ </FormField>
+
+ <FormField
+ control={form.control}
+ name="category"
+ label={labelWithHint("Category (Optional)", "Select a category or enter a custom one")}
+ >
+ {({ id, value, onChange, "aria-invalid": ariaInvalid, "aria-describedby": ariaDescribedBy }) => (
+ <Combobox items={PREDEFINED_CATEGORIES} value={value} onValueChange={onChange}>
+ <ComboboxInput
+ id={id}
+ aria-invalid={ariaInvalid}
+ aria-describedby={ariaDescribedBy}
+ placeholder="Select or type a category"
+ className="w-full rounded-lg"
+ showClear={value != null && value !== ""}
+ />
+ <ComboboxContent>
+ <ComboboxEmpty>No matching categories</ComboboxEmpty>
+ <ComboboxList>
+ {(category: string) => (
+ <ComboboxItem key={category} value={category}>
+ {category}
+ </ComboboxItem>
+ )}
+ </ComboboxList>
+ </ComboboxContent>
+ </Combobox>
+ )}
+ </FormField>
+
+ <FormField
+ control={form.control}
+ name="keywords"
+ label={labelWithHint("Keywords (Optional)", "Comma-separated list of keywords for search")}
+ >
+ {({ ref, ...field }) => (
+ <Input {...field} ref={ref} placeholder="search, web, api" className="rounded-lg" />
+ )}
+ </FormField>
+
+ <FormField
+ control={form.control}
+ name="version"
+ label={labelWithHint("Version (Optional)", "Semantic version (e.g., 1.0.0)")}
+ >
+ {({ ref, ...field }) => <Input {...field} ref={ref} placeholder="1.0.0" className="rounded-lg" />}
+ </FormField>
+
+ <FormField
+ control={form.control}
+ name="authorName"
+ label={labelWithHint("Author Name (Optional)", "Name of the skill author or organization")}
+ >
+ {({ ref, ...field }) => (
+ <Input {...field} ref={ref} placeholder="Your Name or Organization" className="rounded-lg" />
+ )}
+ </FormField>
+
+ <FormField
+ control={form.control}
+ name="authorEmail"
+ label={labelWithHint("Author Email (Optional)", "Contact email for the skill author")}
+ >
+ {({ ref, ...field }) => (
+ <Input {...field} ref={ref} type="email" placeholder="[email protected]" className="rounded-lg" />
+ )}
+ </FormField>
+ </FieldGroup>
+
+ <div className="mt-6 flex justify-end gap-2">
+ <Button type="button" variant="outline" onClick={handleCancel} disabled={isSubmitting}>
+ Cancel
+ </Button>
+ <Button type="submit" disabled={isSubmitting} aria-busy={isSubmitting}>
+ {isSubmitting && <UiLoadingSpinner className="size-4" />}
+ {isSubmitting ? "Adding..." : "Add Skill"}
+ </Button>
+ </div>
+ </form>
+ </TooltipProvider>
+ </DialogContent>
+ </Dialog>
);
};
diff --cc ui/litellm-dashboard/src/components/claude_code_plugins/helpers.test.ts
index dc51dd19e78,4713fcbc55b..ccdc0a1a388
--- a/ui/litellm-dashboard/src/components/claude_code_plugins/helpers.test.ts
+++ b/ui/litellm-dashboard/src/components/claude_code_plugins/helpers.test.ts
@@@ -460,44 -466,6 +471,56 @@@ describe("parseSkillSource", () =>
expect(parseSkillSource("gitlab.com/org/repo", "a//b")).toBeNull();
});
+ it("keeps an scp-style ssh clone url so private hosts authenticate with the user's key", () => {
+ expect(parseSkillSource("[email protected]:org/repo.git")?.parsed).toEqual({
+ source: "url",
+ url: "[email protected]:org/repo.git",
+ });
+ expect(parseSkillSource("[email protected]:org/repo")?.parsed).toEqual({
+ source: "url",
+ url: "[email protected]:org/repo.git",
+ });
+ expect(parseSkillSource("[email protected]:org/repo.git")?.suggestedName).toBe("repo");
+ });
+
+ it("normalizes an ssh:// clone url and keeps a custom port", () => {
+ expect(parseSkillSource("ssh://[email protected]/org/repo")?.parsed).toEqual({
+ source: "url",
+ url: "ssh://[email protected]/org/repo.git",
+ });
+ expect(parseSkillSource("ssh://[email protected]:2222/org/nested/repo.git")?.parsed).toEqual({
+ source: "url",
+ url: "ssh://[email protected]:2222/org/nested/repo.git",
+ });
+ });
+
+ it("combines an ssh clone url with an explicit subfolder", () => {
+ expect(parseSkillSource("[email protected]:org/repo.git", "plugins/my-skill")?.parsed).toEqual({
+ source: "git-subdir",
+ url: "[email protected]:org/repo.git",
+ path: "plugins/my-skill",
+ });
+ expect(parseSkillSource("[email protected]:org/repo.git", "../etc")).toBeNull();
+ });
+
+ it("rejects ssh-looking input without a host or repo path", () => {
+ expect(parseSkillSource("[email protected]:repo.git")).toBeNull();
+ expect(parseSkillSource("git@localhost:org/repo.git")).toBeNull();
+ expect(parseSkillSource("git@:org/repo.git")).toBeNull();
++ expect(parseSkillSource("ssh://ghe.example.com/org/repo.git")).toBeNull();
++ });
++
++ it("rejects ssh remotes with ip hosts or dot-only path segments", () => {
++ expect(parseSkillSource("[email protected]:org/repo.git")).toBeNull();
++ expect(parseSkillSource("ssh://[email protected]/org/repo")).toBeNull();
++ expect(parseSkillSource("[email protected]:../etc")).toBeNull();
++ expect(parseSkillSource("ssh://[email protected]/org/../repo")).toBeNull();
++ expect(parseSkillSource("[email protected]:org/.github")?.parsed).toEqual({
++ source: "url",
++ url: "[email protected]:org/.github.git",
++ });
+ });
+
it("returns null for empty and garbage input", () => {
expect(parseSkillSource("")).toBeNull();
expect(parseSkillSource(" ")).toBeNull();
@@@ -567,7 -568,7 +623,7 @@@
// Skill sources are served on the unauthenticated public feeds and cloned by clients, so the
// parser must never publish an insecure, credentialed, internal, or malformed clone URL.
describe("parseSkillSource — security boundary", () => {
-- it("rejects non-https schemes", () => {
++ it("rejects schemes other than https and user-qualified ssh", () => {
for (const url of [
"http://gitlab.com/org/repo",
"HTTP://gitlab.com/org/repo",
diff --cc ui/litellm-dashboard/src/components/claude_code_plugins/helpers.ts
index caf59c71b76,6f673d67f87..cbca22da1f3
--- a/ui/litellm-dashboard/src/components/claude_code_plugins/helpers.ts
+++ b/ui/litellm-dashboard/src/components/claude_code_plugins/helpers.ts
@@@ -30,10 -36,6 +36,11 @@@ const IPV4_HOST_REGEX = /^\d{1,3}(\.\d{
const GITHUB_ORG_REGEX = /^[A-Za-z0-9-]+$/;
const GITHUB_REPO_REGEX = /^[A-Za-z0-9._-]+$/;
+const SSH_SCP_REGEX = /^([a-z0-9._-]+)@([a-z0-9.-]+\.[a-z]{2,}):([a-z0-9._-]+(?:\/[a-z0-9._-]+)+?)(?:\.git)?\/?$/i;
+const SSH_URL_REGEX =
+ /^ssh:\/\/([a-z0-9._-]+)@([a-z0-9.-]+\.[a-z]{2,})(:\d+)?\/([a-z0-9._-]+(?:\/[a-z0-9._-]+)+?)(?:\.git)?\/?$/i;
++const DOTS_ONLY_SEGMENT_REGEX = /^\.+$/;
+
const buildRepoUrl = (url: URL): string => `${url.protocol}//${url.host}${url.pathname.replace(/\/+$/, "")}`;
const pathSegments = (url: URL): string[] => url.pathname.split("/").filter((seg) => seg !== "");
@@@ -138,13 -140,13 +145,12 @@@ const parseGitHubSource = (url: URL, su
return repoPreview;
};
--const parseRawGitSource = (url: URL, subPath?: string): SkillSourcePreview | null => {
-- if (pathSegments(url).length < 2) {
-- return null;
-- }
--
-- const repoUrl = buildRepoUrl(url);
--
++const buildGitSourcePreview = (
++ kind: "Git" | "SSH",
++ repoUrl: string,
++ repoName: string,
++ subPath?: string,
++): SkillSourcePreview | null => {
const normalized = normalizeSubPath(subPath ?? "");
if (normalized !== "") {
if (!SUBDIR_PATH_REGEX.test(normalized)) {
@@@ -152,66 -154,31 +158,77 @@@
}
return {
parsed: { source: "git-subdir", url: repoUrl, path: normalized },
-- label: `Git subdir — ${repoUrl} @ ${normalized}`,
++ label: `${kind} subdir — ${repoUrl} @ ${normalized}`,
suggestedName: toKebabCase(lastSegment(normalized)),
};
}
return {
parsed: { source: "url", url: repoUrl },
-- label: `Git repo — ${repoUrl}`,
-- suggestedName: toKebabCase(lastSegment(url.pathname).replace(/\.git$/, "")),
++ label: `${kind} repo — ${repoUrl}`,
++ suggestedName: toKebabCase(repoName),
};
};
++const parseRawGitSource = (url: URL, subPath?: string): SkillSourcePreview | null => {
++ if (pathSegments(url).length < 2) {
++ return null;
++ }
++ const repoName = lastSegment(url.pathname).replace(/\.git$/, "");
++ return buildGitSourcePreview("Git", buildRepoUrl(url), repoName, subPath);
++};
++
++interface SshRemote {
++ cloneUrl: string;
++ repoPath: string;
++}
++
+const withGitSuffix = (path: string): string => `${path.replace(/\.git$/i, "")}.git`;
+
- const parseSshRepoUrl = (raw: string): string | null => {
++const buildSshRemote = (rawPath: string, toCloneUrl: (repoPath: string) => string): SshRemote | null => {
++ if (rawPath.split("/").some((segment) => DOTS_ONLY_SEGMENT_REGEX.test(segment))) {
++ return null;
++ }
++ const repoPath = withGitSuffix(rawPath);
++ return { cloneUrl: toCloneUrl(repoPath), repoPath };
++};
++
++const parseSshRemote = (raw: string): SshRemote | null => {
+ const trimmed = raw.trim();
+ const sshUrl = SSH_URL_REGEX.exec(trimmed);
+ if (sshUrl) {
+ const [, user, host, port, path] = sshUrl;
- return `ssh://${user}@${host}${port ?? ""}/${withGitSuffix(path)}`;
++ return buildSshRemote(path, (repoPath) => `ssh://${user}@${host}${port ?? ""}/${repoPath}`);
+ }
+ const scp = SSH_SCP_REGEX.exec(trimmed);
+ if (scp) {
+ const [, user, host, path] = scp;
- return `${user}@${host}:${withGitSuffix(path)}`;
++ return buildSshRemote(path, (repoPath) => `${user}@${host}:${repoPath}`);
+ }
+ return null;
+};
+
- const parseSshSource = (cloneUrl: string, subPath?: string): SkillSourcePreview | null => {
- const repoName = lastSegment(cloneUrl.replace(/\.git$/, "").replace(/^[^:]*:/, ""));
- const normalized = normalizeSubPath(subPath ?? "");
- if (normalized !== "") {
- if (!SUBDIR_PATH_REGEX.test(normalized)) {
- return null;
- }
- return {
- parsed: { source: "git-subdir", url: cloneUrl, path: normalized },
- label: `SSH subdir — ${cloneUrl} @ ${normalized}`,
- suggestedName: toKebabCase(lastSegment(normalized)),
- };
- }
- return {
- parsed: { source: "url", url: cloneUrl },
- label: `SSH repo — ${cloneUrl}`,
- suggestedName: toKebabCase(repoName),
- };
- };
++const parseSshSource = (remote: SshRemote, subPath?: string): SkillSourcePreview | null =>
++ buildGitSourcePreview("SSH", remote.cloneUrl, lastSegment(remote.repoPath).replace(/\.git$/, ""), subPath);
++
+ const parseArchiveSource = (url: URL): SkillSourcePreview => ({
+ parsed: { source: "archive", url: url.href },
+ label: `Zip archive — ${url.host}${url.pathname}`,
+ suggestedName: toKebabCase(lastSegment(url.pathname).replace(ZIP_ARCHIVE_REGEX, "")),
+ });
/**
- * Parse any git-accessible repository URL into a registerable skill source.
- * GitHub https URLs keep their `github`/`git-subdir` shorthand; ssh clone URLs stay ssh so a
- * private host authenticates with the user's own key; every other host is treated as a raw repo
- * URL, with an optional subfolder turning it into git-subdir.
+ * Parse any git-accessible repository URL or https zip archive URL into a registerable skill
+ * source. A `.zip` path is an `archive` source (S3, Artifactory, any static host). GitHub URLs
- * keep their `github`/`git-subdir` shorthand; every other host is treated as a raw repo URL,
++ * keep their `github`/`git-subdir` shorthand; ssh clone URLs stay ssh so a private host
++ * authenticates with the user's own key; every other host is treated as a raw repo URL,
+ * with an optional subfolder turning it into git-subdir.
*/
export const parseSkillSource = (rawUrl: string, subPath?: string): SkillSourcePreview | null => {
- const sshCloneUrl = parseSshRepoUrl(rawUrl);
- if (sshCloneUrl) {
- return parseSshSource(sshCloneUrl, subPath);
++ const sshRemote = parseSshRemote(rawUrl);
++ if (sshRemote) {
++ return parseSshSource(sshRemote, subPath);
+ }
const url = parseRepoUrl(rawUrl);
if (!url) {
return null;
@@@ -307,16 -268,14 +318,14 @@@ export const getSourceDisplayText = (so
};
/**
-- * Get clickable link for plugin source
++ * Get clickable link for plugin source. Ssh clone urls are not browsable, so they yield null.
*/
export const getSourceLink = (source: PluginSource): string | null => {
if (source.source === "github" && source.repo) {
return `https://github.com/${source.repo}`;
}
- if ((source.source === "url" || source.source === "git-subdir") && source.url) {
- return source.url.startsWith("https://") ? source.url : null;
- }
- return null;
+ const linksToUrl = source.source === "url" || source.source === "git-subdir" || source.source === "archive";
- return linksToUrl && source.url ? source.url : null;
++ return linksToUrl && source.url?.startsWith("https://") ? source.url : null;
};
/**
diff --cc ui/litellm-dashboard/src/components/claude_code_plugins/skill_detail.tsx
index ad98fdf232c,b37204c6073..c873e660bb3
--- a/ui/litellm-dashboard/src/components/claude_code_plugins/skill_detail.tsx
+++ b/ui/litellm-dashboard/src/components/claude_code_plugins/skill_detail.tsx
@@@ -1,7 -1,8 +1,38 @@@
import React, { useState } from "react";
- import { ArrowLeftOutlined, CopyOutlined, CheckOutlined, LinkOutlined } from "@ant-design/icons";
- import { buildMarketplaceSettingsSnippet, formatInstallCommand, getSourceLink } from "./helpers";
- import { Plugin } from "./types";
+ import { ArrowLeft, Check, Copy, Link2 } from "lucide-react";
+ import { cn } from "@/lib/cva.config";
-import { buildMarketplaceSettingsSnippet, formatInstallCommand } from "./helpers";
-import { Plugin } from "./types";
++import { buildMarketplaceSettingsSnippet, formatInstallCommand, getSourceDisplayText, getSourceLink } from "./helpers";
++import { Plugin, PluginSource } from "./types";
++
++const SkillSource: React.FC<{ source: PluginSource }> = ({ source }) => {
++ const link = getSourceLink(source);
++ const href = link && source.source === "git-subdir" && source.path ? `${link}/tree/main/${source.path}` : link;
++ if (href) {
++ return (
++ <div className="mb-6">
++ <div className="mb-1 text-xs text-muted-foreground">Source</div>
++ <a
++ href={href}
++ target="_blank"
++ rel="noopener noreferrer"
++ className="flex items-center gap-1 break-all text-[13px] text-info"
++ >
++ {href.replace("https://", "")}
++ <Link2 className="size-3 shrink-0" />
++ </a>
++ </div>
++ );
++ }
++ if (!source.url) {
++ return null;
++ }
++ return (
++ <div className="mb-6">
++ <div className="mb-1 text-xs text-muted-foreground">Source</div>
++ <div className="break-all text-[13px] text-foreground">{getSourceDisplayText(source)}</div>
++ </div>
++ );
++};
interface SkillDetailProps {
skill: Plugin;
@@@ -21,18 -22,14 +52,6 @@@ const SkillDetail: React.FC<SkillDetail
setTimeout(() => setCopiedKey(null), 2000);
};
- const sourceLink = getSourceLink(skill.source);
-- const sourceUrl = (() => {
-- const src = skill.source;
- if (sourceLink && src.source === "git-subdir" && src.path) {
- return `${sourceLink}/tree/main/${src.path}`;
- }
- return sourceLink;
- if (src.source === "github" && src.repo) return `https://github.com/${src.repo}`;
- if (src.source === "git-subdir" && src.url) return src.path ? `${src.url}/tree/main/${src.path}` : src.url;
- if ((src.source === "url" || src.source === "archive") && src.url) return src.url;
- return null;
-- })();
- const sourceText = skill.source.url
- ? `${skill.source.url}${skill.source.path ? ` @ ${skill.source.path}` : ""}`
- : sourceUrl;
--
const installCommand = formatInstallCommand(skill);
const settingsSnippet = buildMarketplaceSettingsSnippet(
@@@ -150,39 -128,25 +150,12 @@@
</span>
</div>
- {sourceUrl ? (
- <div style={{ marginBottom: 24 }}>
- <div style={{ fontSize: 12, color: "#5f6368", marginBottom: 4 }}>Source</div>
- {sourceUrl && (
- <div className="mb-6">
- <div className="mb-1 text-xs text-muted-foreground">Source</div>
-- <a
-- href={sourceUrl}
-- target="_blank"
-- rel="noopener noreferrer"
- style={{
- fontSize: 13,
- color: "#1a73e8",
- wordBreak: "break-all",
- display: "flex",
- alignItems: "center",
- gap: 4,
- }}
- className="flex items-center gap-1 break-all text-[13px] text-info"
-- >
-- {sourceUrl.replace("https://", "")}
- <LinkOutlined style={{ fontSize: 11, flexShrink: 0 }} />
- <Link2 className="size-3 shrink-0" />
-- </a>
-- </div>
- ) : (
- sourceText && (
- <div style={{ marginBottom: 24 }}>
- <div style={{ fontSize: 12, color: "#5f6368", marginBottom: 4 }}>Source</div>
- <div style={{ fontSize: 13, color: "#3c4043", wordBreak: "break-all" }}>{sourceText}</div>
- </div>
- )
-- )}
++ <SkillSource source={skill.source} />
{skill.keywords && skill.keywords.length > 0 && (
- <div style={{ marginBottom: 24 }}>
- <div style={{ fontSize: 12, color: "#5f6368", marginBottom: 8 }}>Tags</div>
- <div style={{ display: "flex", flexWrap: "wrap", gap: 6 }}>
+ <div className="mb-6">
+ <div className="mb-2 text-xs text-muted-foreground">Tags</div>
+ <div className="flex flex-wrap gap-1.5">
{skill.keywords.map((kw) => (
<span
key={kw}