mirror of
https://github.com/bleak-ai/gcontext.git
synced 2026-08-11 13:19:23 +02:00
Fix hardcoded server name in Commands slash command invocation
The command invocation used "gcontext" instead of the dynamic server name from /api/project, so copied slash commands were wrong for non-default instance names. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
bc51b04c31
commit
d29ef972b1
@@ -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();
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user