diff --git a/web/src/Commands.jsx b/web/src/Commands.jsx index bed78ff..baff36b 100644 --- a/web/src/Commands.jsx +++ b/web/src/Commands.jsx @@ -1,12 +1,12 @@ import React, { useEffect, useState } from "react"; -import { getJSON, fileRef } from "./lib.js"; +import { getJSON, fileRef, commandInvocation } from "./lib.js"; import { C, mono, Chip, cardBase, cardHover, pageTitle, sectionLabel, EmptyState, useHover } from "./ui.jsx"; import CopyPrompt from "./Copy.jsx"; // Commands = files under connections/*/commands/ and modules/*/commands/, // registered as MCP prompts. In Claude Code each one is a slash command. -const invocationFor = (name) => `/mcp__gcontext__${name}`; +const invocationFor = (name) => commandInvocation(name); function CommandCard({ cmd }) { const [h, hp] = useHover(); diff --git a/web/src/lib.js b/web/src/lib.js index 59b7fea..44f6ab4 100644 --- a/web/src/lib.js +++ b/web/src/lib.js @@ -30,6 +30,7 @@ export const setServerName = (name) => { if (name) serverName = name; }; export const fileRef = (path) => `@${serverName}:gcontext://${path}`; export const folderRef = (path) => `@${serverName}:gcontext://${path.replace(/\/$/, "")}/`; export const refPrompt = (path, isDir) => (isDir ? folderRef(path) : fileRef(path)); +export const commandInvocation = (name) => `/mcp__${serverName}__${name}`; // File-card label: "notes.md" -> "md", extensionless -> "file". Dotfiles (".env") // stay "file" (lastIndexOf > 0), so the label never repeats the whole name.