@gmickel/gno 0.7.0 → 0.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +90 -50
- package/THIRD_PARTY_NOTICES.md +22 -0
- package/assets/screenshots/webui-ask-answer.png +0 -0
- package/assets/screenshots/webui-collections.png +0 -0
- package/assets/screenshots/webui-editor.png +0 -0
- package/assets/screenshots/webui-home.png +0 -0
- package/assets/skill/SKILL.md +12 -12
- package/assets/skill/cli-reference.md +59 -57
- package/assets/skill/examples.md +8 -7
- package/assets/skill/mcp-reference.md +8 -4
- package/package.json +32 -25
- package/src/app/constants.ts +43 -42
- package/src/cli/colors.ts +1 -1
- package/src/cli/commands/ask.ts +44 -43
- package/src/cli/commands/cleanup.ts +9 -8
- package/src/cli/commands/collection/add.ts +12 -12
- package/src/cli/commands/collection/index.ts +4 -4
- package/src/cli/commands/collection/list.ts +26 -25
- package/src/cli/commands/collection/remove.ts +10 -10
- package/src/cli/commands/collection/rename.ts +10 -10
- package/src/cli/commands/context/add.ts +1 -1
- package/src/cli/commands/context/check.ts +17 -17
- package/src/cli/commands/context/index.ts +4 -4
- package/src/cli/commands/context/list.ts +11 -11
- package/src/cli/commands/context/rm.ts +1 -1
- package/src/cli/commands/doctor.ts +86 -84
- package/src/cli/commands/embed.ts +30 -28
- package/src/cli/commands/get.ts +27 -26
- package/src/cli/commands/index-cmd.ts +9 -9
- package/src/cli/commands/index.ts +16 -16
- package/src/cli/commands/init.ts +13 -12
- package/src/cli/commands/ls.ts +20 -19
- package/src/cli/commands/mcp/config.ts +30 -28
- package/src/cli/commands/mcp/index.ts +4 -4
- package/src/cli/commands/mcp/install.ts +17 -17
- package/src/cli/commands/mcp/paths.ts +133 -133
- package/src/cli/commands/mcp/status.ts +21 -21
- package/src/cli/commands/mcp/uninstall.ts +13 -13
- package/src/cli/commands/mcp.ts +2 -2
- package/src/cli/commands/models/clear.ts +12 -11
- package/src/cli/commands/models/index.ts +5 -5
- package/src/cli/commands/models/list.ts +31 -30
- package/src/cli/commands/models/path.ts +1 -1
- package/src/cli/commands/models/pull.ts +19 -18
- package/src/cli/commands/models/use.ts +4 -4
- package/src/cli/commands/multi-get.ts +38 -36
- package/src/cli/commands/query.ts +21 -20
- package/src/cli/commands/ref-parser.ts +10 -10
- package/src/cli/commands/reset.ts +40 -39
- package/src/cli/commands/search.ts +14 -13
- package/src/cli/commands/serve.ts +4 -4
- package/src/cli/commands/shared.ts +11 -10
- package/src/cli/commands/skill/index.ts +5 -5
- package/src/cli/commands/skill/install.ts +18 -17
- package/src/cli/commands/skill/paths-cmd.ts +11 -10
- package/src/cli/commands/skill/paths.ts +23 -23
- package/src/cli/commands/skill/show.ts +13 -12
- package/src/cli/commands/skill/uninstall.ts +16 -15
- package/src/cli/commands/status.ts +25 -24
- package/src/cli/commands/update.ts +3 -3
- package/src/cli/commands/vsearch.ts +17 -16
- package/src/cli/context.ts +5 -5
- package/src/cli/errors.ts +3 -3
- package/src/cli/format/search-results.ts +37 -37
- package/src/cli/options.ts +43 -43
- package/src/cli/program.ts +455 -459
- package/src/cli/progress.ts +1 -1
- package/src/cli/run.ts +24 -23
- package/src/collection/add.ts +9 -8
- package/src/collection/index.ts +3 -3
- package/src/collection/remove.ts +7 -6
- package/src/collection/types.ts +6 -6
- package/src/config/defaults.ts +1 -1
- package/src/config/index.ts +5 -5
- package/src/config/loader.ts +19 -18
- package/src/config/paths.ts +9 -8
- package/src/config/saver.ts +14 -13
- package/src/config/types.ts +53 -52
- package/src/converters/adapters/markitdownTs/adapter.ts +21 -19
- package/src/converters/adapters/officeparser/adapter.ts +18 -16
- package/src/converters/canonicalize.ts +12 -12
- package/src/converters/errors.ts +26 -22
- package/src/converters/index.ts +8 -8
- package/src/converters/mime.ts +25 -25
- package/src/converters/native/markdown.ts +10 -9
- package/src/converters/native/plaintext.ts +8 -7
- package/src/converters/path.ts +2 -2
- package/src/converters/pipeline.ts +11 -10
- package/src/converters/registry.ts +8 -8
- package/src/converters/types.ts +14 -14
- package/src/converters/versions.ts +4 -4
- package/src/index.ts +4 -4
- package/src/ingestion/chunker.ts +10 -9
- package/src/ingestion/index.ts +6 -6
- package/src/ingestion/language.ts +62 -62
- package/src/ingestion/sync.ts +50 -49
- package/src/ingestion/types.ts +10 -10
- package/src/ingestion/walker.ts +14 -13
- package/src/llm/cache.ts +51 -49
- package/src/llm/errors.ts +40 -36
- package/src/llm/index.ts +9 -9
- package/src/llm/lockfile.ts +6 -6
- package/src/llm/nodeLlamaCpp/adapter.ts +13 -12
- package/src/llm/nodeLlamaCpp/embedding.ts +9 -8
- package/src/llm/nodeLlamaCpp/generation.ts +7 -6
- package/src/llm/nodeLlamaCpp/lifecycle.ts +11 -10
- package/src/llm/nodeLlamaCpp/rerank.ts +6 -5
- package/src/llm/policy.ts +5 -5
- package/src/llm/registry.ts +6 -5
- package/src/llm/types.ts +2 -2
- package/src/mcp/resources/index.ts +15 -13
- package/src/mcp/server.ts +25 -23
- package/src/mcp/tools/get.ts +25 -23
- package/src/mcp/tools/index.ts +32 -29
- package/src/mcp/tools/multi-get.ts +34 -32
- package/src/mcp/tools/query.ts +29 -27
- package/src/mcp/tools/search.ts +14 -12
- package/src/mcp/tools/status.ts +12 -11
- package/src/mcp/tools/vsearch.ts +26 -24
- package/src/pipeline/answer.ts +9 -9
- package/src/pipeline/chunk-lookup.ts +1 -1
- package/src/pipeline/contextual.ts +4 -4
- package/src/pipeline/expansion.ts +23 -21
- package/src/pipeline/explain.ts +21 -21
- package/src/pipeline/fusion.ts +9 -9
- package/src/pipeline/hybrid.ts +41 -42
- package/src/pipeline/index.ts +10 -10
- package/src/pipeline/query-language.ts +39 -39
- package/src/pipeline/rerank.ts +8 -7
- package/src/pipeline/search.ts +22 -22
- package/src/pipeline/types.ts +8 -8
- package/src/pipeline/vsearch.ts +21 -24
- package/src/serve/CLAUDE.md +21 -15
- package/src/serve/config-sync.ts +9 -8
- package/src/serve/context.ts +19 -18
- package/src/serve/index.ts +1 -1
- package/src/serve/jobs.ts +7 -7
- package/src/serve/public/app.tsx +79 -25
- package/src/serve/public/components/AddCollectionDialog.tsx +382 -0
- package/src/serve/public/components/CaptureButton.tsx +60 -0
- package/src/serve/public/components/CaptureModal.tsx +365 -0
- package/src/serve/public/components/IndexingProgress.tsx +333 -0
- package/src/serve/public/components/ShortcutHelpModal.tsx +106 -0
- package/src/serve/public/components/ai-elements/code-block.tsx +42 -32
- package/src/serve/public/components/ai-elements/conversation.tsx +16 -14
- package/src/serve/public/components/ai-elements/inline-citation.tsx +33 -32
- package/src/serve/public/components/ai-elements/loader.tsx +5 -4
- package/src/serve/public/components/ai-elements/message.tsx +39 -37
- package/src/serve/public/components/ai-elements/prompt-input.tsx +97 -95
- package/src/serve/public/components/ai-elements/sources.tsx +12 -10
- package/src/serve/public/components/ai-elements/suggestion.tsx +10 -9
- package/src/serve/public/components/editor/CodeMirrorEditor.tsx +142 -0
- package/src/serve/public/components/editor/MarkdownPreview.tsx +311 -0
- package/src/serve/public/components/editor/index.ts +6 -0
- package/src/serve/public/components/preset-selector.tsx +29 -28
- package/src/serve/public/components/ui/badge.tsx +13 -12
- package/src/serve/public/components/ui/button-group.tsx +13 -12
- package/src/serve/public/components/ui/button.tsx +23 -22
- package/src/serve/public/components/ui/card.tsx +16 -16
- package/src/serve/public/components/ui/carousel.tsx +36 -35
- package/src/serve/public/components/ui/collapsible.tsx +1 -1
- package/src/serve/public/components/ui/command.tsx +17 -15
- package/src/serve/public/components/ui/dialog.tsx +13 -12
- package/src/serve/public/components/ui/dropdown-menu.tsx +13 -12
- package/src/serve/public/components/ui/hover-card.tsx +6 -5
- package/src/serve/public/components/ui/input-group.tsx +45 -43
- package/src/serve/public/components/ui/input.tsx +6 -6
- package/src/serve/public/components/ui/progress.tsx +5 -4
- package/src/serve/public/components/ui/scroll-area.tsx +11 -10
- package/src/serve/public/components/ui/select.tsx +19 -18
- package/src/serve/public/components/ui/separator.tsx +6 -5
- package/src/serve/public/components/ui/table.tsx +18 -18
- package/src/serve/public/components/ui/textarea.tsx +4 -4
- package/src/serve/public/components/ui/tooltip.tsx +5 -4
- package/src/serve/public/globals.css +27 -4
- package/src/serve/public/hooks/use-api.ts +8 -8
- package/src/serve/public/hooks/useCaptureModal.tsx +83 -0
- package/src/serve/public/hooks/useKeyboardShortcuts.ts +85 -0
- package/src/serve/public/index.html +4 -4
- package/src/serve/public/lib/utils.ts +6 -0
- package/src/serve/public/pages/Ask.tsx +27 -26
- package/src/serve/public/pages/Browse.tsx +28 -27
- package/src/serve/public/pages/Collections.tsx +439 -0
- package/src/serve/public/pages/Dashboard.tsx +166 -40
- package/src/serve/public/pages/DocView.tsx +258 -73
- package/src/serve/public/pages/DocumentEditor.tsx +510 -0
- package/src/serve/public/pages/Search.tsx +80 -58
- package/src/serve/routes/api.ts +272 -155
- package/src/serve/security.ts +4 -4
- package/src/serve/server.ts +66 -48
- package/src/store/index.ts +5 -5
- package/src/store/migrations/001-initial.ts +24 -23
- package/src/store/migrations/002-documents-fts.ts +7 -6
- package/src/store/migrations/index.ts +4 -4
- package/src/store/migrations/runner.ts +17 -15
- package/src/store/sqlite/adapter.ts +123 -121
- package/src/store/sqlite/fts5-snowball.ts +24 -23
- package/src/store/sqlite/index.ts +1 -1
- package/src/store/sqlite/setup.ts +12 -12
- package/src/store/sqlite/types.ts +4 -4
- package/src/store/types.ts +19 -19
- package/src/store/vector/index.ts +3 -3
- package/src/store/vector/sqlite-vec.ts +23 -20
- package/src/store/vector/stats.ts +10 -8
- package/src/store/vector/types.ts +2 -2
- package/vendor/fts5-snowball/README.md +6 -6
- package/assets/screenshots/webui-ask-answer.jpg +0 -0
- package/assets/screenshots/webui-home.jpg +0 -0
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* @module src/cli/commands/mcp/install
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import { CliError } from
|
|
8
|
-
import { getGlobals } from
|
|
7
|
+
import { CliError } from "../../errors.js";
|
|
8
|
+
import { getGlobals } from "../../program.js";
|
|
9
9
|
import {
|
|
10
10
|
type AnyMcpConfig,
|
|
11
11
|
buildEntry,
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
type StandardMcpEntry,
|
|
16
16
|
setServerEntry,
|
|
17
17
|
writeMcpConfig,
|
|
18
|
-
} from
|
|
18
|
+
} from "./config.js";
|
|
19
19
|
import {
|
|
20
20
|
buildMcpServerEntry,
|
|
21
21
|
getTargetDisplayName,
|
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
type McpTarget,
|
|
25
25
|
resolveMcpConfigPath,
|
|
26
26
|
TARGETS_WITH_PROJECT_SCOPE,
|
|
27
|
-
} from
|
|
27
|
+
} from "./paths.js";
|
|
28
28
|
|
|
29
29
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
30
30
|
// Types
|
|
@@ -49,7 +49,7 @@ interface InstallResult {
|
|
|
49
49
|
target: McpTarget;
|
|
50
50
|
scope: McpScope;
|
|
51
51
|
configPath: string;
|
|
52
|
-
action:
|
|
52
|
+
action: "created" | "updated" | "dry_run_create" | "dry_run_update";
|
|
53
53
|
serverEntry: { command: string; args: string[] };
|
|
54
54
|
}
|
|
55
55
|
|
|
@@ -91,10 +91,10 @@ async function installToTarget(
|
|
|
91
91
|
const alreadyExists = hasServerEntry(config, MCP_SERVER_NAME, configFormat);
|
|
92
92
|
if (alreadyExists && !force) {
|
|
93
93
|
throw new CliError(
|
|
94
|
-
|
|
94
|
+
"VALIDATION",
|
|
95
95
|
`${getTargetDisplayName(target)} already has gno configured.\n` +
|
|
96
96
|
` Config: ${configPath}\n` +
|
|
97
|
-
|
|
97
|
+
" Use --force to overwrite."
|
|
98
98
|
);
|
|
99
99
|
}
|
|
100
100
|
|
|
@@ -105,12 +105,12 @@ async function installToTarget(
|
|
|
105
105
|
target,
|
|
106
106
|
scope,
|
|
107
107
|
configPath,
|
|
108
|
-
action: wouldCreate ?
|
|
108
|
+
action: wouldCreate ? "dry_run_create" : "dry_run_update",
|
|
109
109
|
serverEntry,
|
|
110
110
|
};
|
|
111
111
|
}
|
|
112
112
|
|
|
113
|
-
const action = wouldCreate ?
|
|
113
|
+
const action = wouldCreate ? "created" : "updated";
|
|
114
114
|
|
|
115
115
|
// Build format-specific entry and add to config
|
|
116
116
|
const entry = buildEntry(serverEntry.command, serverEntry.args, configFormat);
|
|
@@ -143,8 +143,8 @@ function safeGetGlobals(): { json: boolean; quiet: boolean } {
|
|
|
143
143
|
* Install gno MCP server.
|
|
144
144
|
*/
|
|
145
145
|
export async function installMcp(opts: InstallOptions = {}): Promise<void> {
|
|
146
|
-
const target = opts.target ??
|
|
147
|
-
const scope = opts.scope ??
|
|
146
|
+
const target = opts.target ?? "claude-desktop";
|
|
147
|
+
const scope = opts.scope ?? "user";
|
|
148
148
|
const force = opts.force ?? false;
|
|
149
149
|
const dryRun = opts.dryRun ?? false;
|
|
150
150
|
const globals = safeGetGlobals();
|
|
@@ -152,9 +152,9 @@ export async function installMcp(opts: InstallOptions = {}): Promise<void> {
|
|
|
152
152
|
const quiet = opts.quiet ?? globals.quiet;
|
|
153
153
|
|
|
154
154
|
// Validate scope - only some targets support project scope
|
|
155
|
-
if (scope ===
|
|
155
|
+
if (scope === "project" && !TARGETS_WITH_PROJECT_SCOPE.includes(target)) {
|
|
156
156
|
throw new CliError(
|
|
157
|
-
|
|
157
|
+
"VALIDATION",
|
|
158
158
|
`${getTargetDisplayName(target)} does not support project scope. Use --scope user.`
|
|
159
159
|
);
|
|
160
160
|
}
|
|
@@ -181,18 +181,18 @@ export async function installMcp(opts: InstallOptions = {}): Promise<void> {
|
|
|
181
181
|
}
|
|
182
182
|
|
|
183
183
|
if (dryRun) {
|
|
184
|
-
const dryRunVerb = result.action ===
|
|
185
|
-
process.stdout.write(
|
|
184
|
+
const dryRunVerb = result.action === "dry_run_create" ? "create" : "update";
|
|
185
|
+
process.stdout.write("Dry run - no changes made.\n\n");
|
|
186
186
|
process.stdout.write(
|
|
187
187
|
`Would ${dryRunVerb} gno in ${getTargetDisplayName(target)}:\n`
|
|
188
188
|
);
|
|
189
189
|
process.stdout.write(` Config: ${result.configPath}\n`);
|
|
190
190
|
process.stdout.write(` Command: ${serverEntry.command}\n`);
|
|
191
|
-
process.stdout.write(` Args: ${serverEntry.args.join(
|
|
191
|
+
process.stdout.write(` Args: ${serverEntry.args.join(" ")}\n`);
|
|
192
192
|
return;
|
|
193
193
|
}
|
|
194
194
|
|
|
195
|
-
const verb = result.action ===
|
|
195
|
+
const verb = result.action === "created" ? "Installed" : "Updated";
|
|
196
196
|
process.stdout.write(
|
|
197
197
|
`${verb} gno MCP server in ${getTargetDisplayName(target)}.\n`
|
|
198
198
|
);
|
|
@@ -5,27 +5,27 @@
|
|
|
5
5
|
* @module src/cli/commands/mcp/paths
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import { existsSync } from
|
|
9
|
-
import { homedir, platform } from
|
|
10
|
-
import { join } from
|
|
8
|
+
import { existsSync } from "node:fs";
|
|
9
|
+
import { homedir, platform } from "node:os";
|
|
10
|
+
import { join } from "node:path";
|
|
11
11
|
|
|
12
12
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
13
13
|
// Types
|
|
14
14
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
15
15
|
|
|
16
16
|
export type McpTarget =
|
|
17
|
-
|
|
|
18
|
-
|
|
|
19
|
-
|
|
|
20
|
-
|
|
|
21
|
-
|
|
|
22
|
-
|
|
|
23
|
-
|
|
|
24
|
-
|
|
|
25
|
-
|
|
|
26
|
-
|
|
|
27
|
-
|
|
28
|
-
export type McpScope =
|
|
17
|
+
| "claude-desktop"
|
|
18
|
+
| "claude-code"
|
|
19
|
+
| "codex"
|
|
20
|
+
| "cursor"
|
|
21
|
+
| "zed"
|
|
22
|
+
| "windsurf"
|
|
23
|
+
| "opencode"
|
|
24
|
+
| "amp"
|
|
25
|
+
| "lmstudio"
|
|
26
|
+
| "librechat";
|
|
27
|
+
|
|
28
|
+
export type McpScope = "user" | "project";
|
|
29
29
|
|
|
30
30
|
/**
|
|
31
31
|
* Config format varies by target.
|
|
@@ -36,11 +36,11 @@ export type McpScope = 'user' | 'project';
|
|
|
36
36
|
* - yaml_standard: YAML file with mcpServers key (LibreChat)
|
|
37
37
|
*/
|
|
38
38
|
export type McpConfigFormat =
|
|
39
|
-
|
|
|
40
|
-
|
|
|
41
|
-
|
|
|
42
|
-
|
|
|
43
|
-
|
|
|
39
|
+
| "standard"
|
|
40
|
+
| "context_servers"
|
|
41
|
+
| "mcp"
|
|
42
|
+
| "amp_mcp"
|
|
43
|
+
| "yaml_standard";
|
|
44
44
|
|
|
45
45
|
export interface McpConfigPaths {
|
|
46
46
|
/** Config file path */
|
|
@@ -69,44 +69,44 @@ export interface McpPathOptions {
|
|
|
69
69
|
// Constants
|
|
70
70
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
71
71
|
|
|
72
|
-
export const MCP_SERVER_NAME =
|
|
72
|
+
export const MCP_SERVER_NAME = "gno";
|
|
73
73
|
|
|
74
74
|
/** All supported MCP targets */
|
|
75
75
|
export const MCP_TARGETS: McpTarget[] = [
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
76
|
+
"claude-desktop",
|
|
77
|
+
"claude-code",
|
|
78
|
+
"codex",
|
|
79
|
+
"cursor",
|
|
80
|
+
"zed",
|
|
81
|
+
"windsurf",
|
|
82
|
+
"opencode",
|
|
83
|
+
"amp",
|
|
84
|
+
"lmstudio",
|
|
85
|
+
"librechat",
|
|
86
86
|
];
|
|
87
87
|
|
|
88
88
|
/** Targets that support project scope */
|
|
89
89
|
export const TARGETS_WITH_PROJECT_SCOPE: McpTarget[] = [
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
90
|
+
"claude-code",
|
|
91
|
+
"codex",
|
|
92
|
+
"cursor",
|
|
93
|
+
"opencode",
|
|
94
|
+
"librechat",
|
|
95
95
|
];
|
|
96
96
|
|
|
97
97
|
/** Get config format for a target */
|
|
98
98
|
export function getTargetConfigFormat(target: McpTarget): McpConfigFormat {
|
|
99
99
|
switch (target) {
|
|
100
|
-
case
|
|
101
|
-
return
|
|
102
|
-
case
|
|
103
|
-
return
|
|
104
|
-
case
|
|
105
|
-
return
|
|
106
|
-
case
|
|
107
|
-
return
|
|
100
|
+
case "zed":
|
|
101
|
+
return "context_servers";
|
|
102
|
+
case "opencode":
|
|
103
|
+
return "mcp";
|
|
104
|
+
case "amp":
|
|
105
|
+
return "amp_mcp";
|
|
106
|
+
case "librechat":
|
|
107
|
+
return "yaml_standard";
|
|
108
108
|
default:
|
|
109
|
-
return
|
|
109
|
+
return "standard";
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
112
|
|
|
@@ -123,18 +123,18 @@ const COMMANDS_PATH_PATTERN = /\/commands\/.*$/;
|
|
|
123
123
|
function resolveClaudeDesktopPath(home: string): string {
|
|
124
124
|
const plat = platform();
|
|
125
125
|
|
|
126
|
-
if (plat ===
|
|
126
|
+
if (plat === "darwin") {
|
|
127
127
|
return join(
|
|
128
128
|
home,
|
|
129
|
-
|
|
129
|
+
"Library/Application Support/Claude/claude_desktop_config.json"
|
|
130
130
|
);
|
|
131
131
|
}
|
|
132
|
-
if (plat ===
|
|
133
|
-
const appData = process.env.APPDATA || join(home,
|
|
134
|
-
return join(appData,
|
|
132
|
+
if (plat === "win32") {
|
|
133
|
+
const appData = process.env.APPDATA || join(home, "AppData/Roaming");
|
|
134
|
+
return join(appData, "Claude/claude_desktop_config.json");
|
|
135
135
|
}
|
|
136
136
|
// Linux and other Unix
|
|
137
|
-
return join(home,
|
|
137
|
+
return join(home, ".config/Claude/claude_desktop_config.json");
|
|
138
138
|
}
|
|
139
139
|
|
|
140
140
|
/**
|
|
@@ -145,34 +145,34 @@ function resolveClaudeCodePath(
|
|
|
145
145
|
home: string,
|
|
146
146
|
cwd: string
|
|
147
147
|
): string {
|
|
148
|
-
if (scope ===
|
|
149
|
-
return join(home,
|
|
148
|
+
if (scope === "user") {
|
|
149
|
+
return join(home, ".claude.json");
|
|
150
150
|
}
|
|
151
|
-
return join(cwd,
|
|
151
|
+
return join(cwd, ".mcp.json");
|
|
152
152
|
}
|
|
153
153
|
|
|
154
154
|
/**
|
|
155
155
|
* Resolve Codex config path.
|
|
156
156
|
*/
|
|
157
157
|
function resolveCodexPath(scope: McpScope, home: string, cwd: string): string {
|
|
158
|
-
if (scope ===
|
|
159
|
-
return join(home,
|
|
158
|
+
if (scope === "user") {
|
|
159
|
+
return join(home, ".codex.json");
|
|
160
160
|
}
|
|
161
|
-
return join(cwd,
|
|
161
|
+
return join(cwd, ".codex/.mcp.json");
|
|
162
162
|
}
|
|
163
163
|
|
|
164
164
|
/**
|
|
165
165
|
* Resolve Cursor config path.
|
|
166
166
|
*/
|
|
167
167
|
function resolveCursorPath(scope: McpScope, home: string, cwd: string): string {
|
|
168
|
-
if (scope ===
|
|
168
|
+
if (scope === "user") {
|
|
169
169
|
const plat = platform();
|
|
170
|
-
if (plat ===
|
|
171
|
-
return join(home,
|
|
170
|
+
if (plat === "win32") {
|
|
171
|
+
return join(home, ".cursor", "mcp.json");
|
|
172
172
|
}
|
|
173
|
-
return join(home,
|
|
173
|
+
return join(home, ".cursor/mcp.json");
|
|
174
174
|
}
|
|
175
|
-
return join(cwd,
|
|
175
|
+
return join(cwd, ".cursor/mcp.json");
|
|
176
176
|
}
|
|
177
177
|
|
|
178
178
|
/**
|
|
@@ -180,16 +180,16 @@ function resolveCursorPath(scope: McpScope, home: string, cwd: string): string {
|
|
|
180
180
|
*/
|
|
181
181
|
function resolveZedPath(home: string): string {
|
|
182
182
|
const plat = platform();
|
|
183
|
-
if (plat ===
|
|
183
|
+
if (plat === "win32") {
|
|
184
184
|
// Zed not available on Windows, but provide path anyway
|
|
185
|
-
return join(home,
|
|
185
|
+
return join(home, ".config/zed/settings.json");
|
|
186
186
|
}
|
|
187
187
|
// macOS and Linux use XDG or fallback
|
|
188
188
|
const xdgConfig = process.env.XDG_CONFIG_HOME;
|
|
189
189
|
if (xdgConfig) {
|
|
190
|
-
return join(xdgConfig,
|
|
190
|
+
return join(xdgConfig, "zed/settings.json");
|
|
191
191
|
}
|
|
192
|
-
return join(home,
|
|
192
|
+
return join(home, ".config/zed/settings.json");
|
|
193
193
|
}
|
|
194
194
|
|
|
195
195
|
/**
|
|
@@ -197,10 +197,10 @@ function resolveZedPath(home: string): string {
|
|
|
197
197
|
*/
|
|
198
198
|
function resolveWindsurfPath(home: string): string {
|
|
199
199
|
const plat = platform();
|
|
200
|
-
if (plat ===
|
|
201
|
-
return join(home,
|
|
200
|
+
if (plat === "win32") {
|
|
201
|
+
return join(home, ".codeium", "windsurf", "mcp_config.json");
|
|
202
202
|
}
|
|
203
|
-
return join(home,
|
|
203
|
+
return join(home, ".codeium/windsurf/mcp_config.json");
|
|
204
204
|
}
|
|
205
205
|
|
|
206
206
|
/**
|
|
@@ -211,15 +211,15 @@ function resolveOpenCodePath(
|
|
|
211
211
|
home: string,
|
|
212
212
|
cwd: string
|
|
213
213
|
): string {
|
|
214
|
-
if (scope ===
|
|
214
|
+
if (scope === "user") {
|
|
215
215
|
const plat = platform();
|
|
216
|
-
if (plat ===
|
|
217
|
-
return join(home,
|
|
216
|
+
if (plat === "win32") {
|
|
217
|
+
return join(home, ".config", "opencode", "config.json");
|
|
218
218
|
}
|
|
219
|
-
return join(home,
|
|
219
|
+
return join(home, ".config/opencode/config.json");
|
|
220
220
|
}
|
|
221
221
|
// Project scope: opencode.json in project root
|
|
222
|
-
return join(cwd,
|
|
222
|
+
return join(cwd, "opencode.json");
|
|
223
223
|
}
|
|
224
224
|
|
|
225
225
|
/**
|
|
@@ -227,10 +227,10 @@ function resolveOpenCodePath(
|
|
|
227
227
|
*/
|
|
228
228
|
function resolveAmpPath(home: string): string {
|
|
229
229
|
const plat = platform();
|
|
230
|
-
if (plat ===
|
|
231
|
-
return join(home,
|
|
230
|
+
if (plat === "win32") {
|
|
231
|
+
return join(home, ".config", "amp", "settings.json");
|
|
232
232
|
}
|
|
233
|
-
return join(home,
|
|
233
|
+
return join(home, ".config/amp/settings.json");
|
|
234
234
|
}
|
|
235
235
|
|
|
236
236
|
/**
|
|
@@ -238,10 +238,10 @@ function resolveAmpPath(home: string): string {
|
|
|
238
238
|
*/
|
|
239
239
|
function resolveLmStudioPath(home: string): string {
|
|
240
240
|
const plat = platform();
|
|
241
|
-
if (plat ===
|
|
242
|
-
return join(home,
|
|
241
|
+
if (plat === "win32") {
|
|
242
|
+
return join(home, ".lmstudio", "mcp.json");
|
|
243
243
|
}
|
|
244
|
-
return join(home,
|
|
244
|
+
return join(home, ".lmstudio/mcp.json");
|
|
245
245
|
}
|
|
246
246
|
|
|
247
247
|
/**
|
|
@@ -249,7 +249,7 @@ function resolveLmStudioPath(home: string): string {
|
|
|
249
249
|
* LibreChat uses librechat.yaml in project root (project scope only).
|
|
250
250
|
*/
|
|
251
251
|
function resolveLibreChatPath(cwd: string): string {
|
|
252
|
-
return join(cwd,
|
|
252
|
+
return join(cwd, "librechat.yaml");
|
|
253
253
|
}
|
|
254
254
|
|
|
255
255
|
/**
|
|
@@ -258,7 +258,7 @@ function resolveLibreChatPath(cwd: string): string {
|
|
|
258
258
|
export function resolveMcpConfigPath(opts: McpPathOptions): McpConfigPaths {
|
|
259
259
|
const {
|
|
260
260
|
target,
|
|
261
|
-
scope =
|
|
261
|
+
scope = "user",
|
|
262
262
|
cwd = process.cwd(),
|
|
263
263
|
homeDir = homedir(),
|
|
264
264
|
} = opts;
|
|
@@ -267,61 +267,61 @@ export function resolveMcpConfigPath(opts: McpPathOptions): McpConfigPaths {
|
|
|
267
267
|
const supportsProjectScope = TARGETS_WITH_PROJECT_SCOPE.includes(target);
|
|
268
268
|
|
|
269
269
|
switch (target) {
|
|
270
|
-
case
|
|
270
|
+
case "claude-desktop":
|
|
271
271
|
return {
|
|
272
272
|
configPath: resolveClaudeDesktopPath(homeDir),
|
|
273
273
|
supportsProjectScope,
|
|
274
274
|
configFormat,
|
|
275
275
|
};
|
|
276
|
-
case
|
|
276
|
+
case "claude-code":
|
|
277
277
|
return {
|
|
278
278
|
configPath: resolveClaudeCodePath(scope, homeDir, cwd),
|
|
279
279
|
supportsProjectScope,
|
|
280
280
|
configFormat,
|
|
281
281
|
};
|
|
282
|
-
case
|
|
282
|
+
case "codex":
|
|
283
283
|
return {
|
|
284
284
|
configPath: resolveCodexPath(scope, homeDir, cwd),
|
|
285
285
|
supportsProjectScope,
|
|
286
286
|
configFormat,
|
|
287
287
|
};
|
|
288
|
-
case
|
|
288
|
+
case "cursor":
|
|
289
289
|
return {
|
|
290
290
|
configPath: resolveCursorPath(scope, homeDir, cwd),
|
|
291
291
|
supportsProjectScope,
|
|
292
292
|
configFormat,
|
|
293
293
|
};
|
|
294
|
-
case
|
|
294
|
+
case "zed":
|
|
295
295
|
return {
|
|
296
296
|
configPath: resolveZedPath(homeDir),
|
|
297
297
|
supportsProjectScope,
|
|
298
298
|
configFormat,
|
|
299
299
|
};
|
|
300
|
-
case
|
|
300
|
+
case "windsurf":
|
|
301
301
|
return {
|
|
302
302
|
configPath: resolveWindsurfPath(homeDir),
|
|
303
303
|
supportsProjectScope,
|
|
304
304
|
configFormat,
|
|
305
305
|
};
|
|
306
|
-
case
|
|
306
|
+
case "opencode":
|
|
307
307
|
return {
|
|
308
308
|
configPath: resolveOpenCodePath(scope, homeDir, cwd),
|
|
309
309
|
supportsProjectScope,
|
|
310
310
|
configFormat,
|
|
311
311
|
};
|
|
312
|
-
case
|
|
312
|
+
case "amp":
|
|
313
313
|
return {
|
|
314
314
|
configPath: resolveAmpPath(homeDir),
|
|
315
315
|
supportsProjectScope,
|
|
316
316
|
configFormat,
|
|
317
317
|
};
|
|
318
|
-
case
|
|
318
|
+
case "lmstudio":
|
|
319
319
|
return {
|
|
320
320
|
configPath: resolveLmStudioPath(homeDir),
|
|
321
321
|
supportsProjectScope,
|
|
322
322
|
configFormat,
|
|
323
323
|
};
|
|
324
|
-
case
|
|
324
|
+
case "librechat":
|
|
325
325
|
return {
|
|
326
326
|
configPath: resolveLibreChatPath(cwd),
|
|
327
327
|
supportsProjectScope,
|
|
@@ -329,7 +329,7 @@ export function resolveMcpConfigPath(opts: McpPathOptions): McpConfigPaths {
|
|
|
329
329
|
};
|
|
330
330
|
default: {
|
|
331
331
|
const _exhaustive: never = target;
|
|
332
|
-
throw new Error(`Unknown target: ${_exhaustive}`);
|
|
332
|
+
throw new Error(`Unknown target: ${String(_exhaustive)}`);
|
|
333
333
|
}
|
|
334
334
|
}
|
|
335
335
|
}
|
|
@@ -338,11 +338,11 @@ export function resolveMcpConfigPath(opts: McpPathOptions): McpConfigPaths {
|
|
|
338
338
|
* Resolve paths for all targets.
|
|
339
339
|
*/
|
|
340
340
|
export function resolveAllMcpPaths(
|
|
341
|
-
scope: McpScope |
|
|
342
|
-
target: McpTarget |
|
|
341
|
+
scope: McpScope | "all" = "all",
|
|
342
|
+
target: McpTarget | "all" = "all",
|
|
343
343
|
overrides?: { cwd?: string; homeDir?: string }
|
|
344
344
|
): Array<{ target: McpTarget; scope: McpScope; paths: McpConfigPaths }> {
|
|
345
|
-
const targets: McpTarget[] = target ===
|
|
345
|
+
const targets: McpTarget[] = target === "all" ? MCP_TARGETS : [target];
|
|
346
346
|
const results: Array<{
|
|
347
347
|
target: McpTarget;
|
|
348
348
|
scope: McpScope;
|
|
@@ -355,7 +355,7 @@ export function resolveAllMcpPaths(
|
|
|
355
355
|
if (supportsProject) {
|
|
356
356
|
// Targets that support both scopes
|
|
357
357
|
const scopes: McpScope[] =
|
|
358
|
-
scope ===
|
|
358
|
+
scope === "all" ? ["user", "project"] : [scope];
|
|
359
359
|
for (const s of scopes) {
|
|
360
360
|
results.push({
|
|
361
361
|
target: t,
|
|
@@ -365,13 +365,13 @@ export function resolveAllMcpPaths(
|
|
|
365
365
|
}
|
|
366
366
|
} else {
|
|
367
367
|
// User scope only - skip if filtering by project
|
|
368
|
-
if (scope ===
|
|
368
|
+
if (scope === "project") {
|
|
369
369
|
continue;
|
|
370
370
|
}
|
|
371
371
|
results.push({
|
|
372
372
|
target: t,
|
|
373
|
-
scope:
|
|
374
|
-
paths: resolveMcpConfigPath({ target: t, scope:
|
|
373
|
+
scope: "user",
|
|
374
|
+
paths: resolveMcpConfigPath({ target: t, scope: "user", ...overrides }),
|
|
375
375
|
});
|
|
376
376
|
}
|
|
377
377
|
}
|
|
@@ -401,40 +401,40 @@ export function findBunPath(): string {
|
|
|
401
401
|
export function buildMcpServerEntry(): McpServerEntry {
|
|
402
402
|
const bunPath = findBunPath();
|
|
403
403
|
const home = homedir();
|
|
404
|
-
const isWindows = platform() ===
|
|
404
|
+
const isWindows = platform() === "win32";
|
|
405
405
|
|
|
406
406
|
// 1. Check if running from source (dev mode)
|
|
407
407
|
const scriptPath = process.argv[1];
|
|
408
408
|
if (
|
|
409
|
-
scriptPath?.includes(
|
|
410
|
-
scriptPath?.includes(
|
|
409
|
+
scriptPath?.includes("/gno/src/cli/") ||
|
|
410
|
+
scriptPath?.includes("\\gno\\src\\cli\\")
|
|
411
411
|
) {
|
|
412
412
|
// Dev mode: run the entry script directly with bun
|
|
413
|
-
const entryScript = scriptPath.replace(COMMANDS_PATH_PATTERN,
|
|
414
|
-
return { command: bunPath, args: [
|
|
413
|
+
const entryScript = scriptPath.replace(COMMANDS_PATH_PATTERN, "/index.ts");
|
|
414
|
+
return { command: bunPath, args: ["run", entryScript, "mcp"] };
|
|
415
415
|
}
|
|
416
416
|
|
|
417
417
|
// 2. Check common gno install locations (cross-platform)
|
|
418
418
|
const gnoCandidates = isWindows
|
|
419
419
|
? [
|
|
420
|
-
join(home,
|
|
421
|
-
join(home,
|
|
420
|
+
join(home, ".bun\\bin\\gno.exe"),
|
|
421
|
+
join(home, "AppData\\Roaming\\npm\\gno.cmd"),
|
|
422
422
|
]
|
|
423
423
|
: [
|
|
424
|
-
join(home,
|
|
425
|
-
|
|
426
|
-
|
|
424
|
+
join(home, ".bun/bin/gno"),
|
|
425
|
+
"/usr/local/bin/gno",
|
|
426
|
+
"/opt/homebrew/bin/gno",
|
|
427
427
|
];
|
|
428
428
|
|
|
429
429
|
for (const gnoPath of gnoCandidates) {
|
|
430
430
|
if (existsSync(gnoPath)) {
|
|
431
|
-
return { command: bunPath, args: [gnoPath,
|
|
431
|
+
return { command: bunPath, args: [gnoPath, "mcp"] };
|
|
432
432
|
}
|
|
433
433
|
}
|
|
434
434
|
|
|
435
435
|
// 3. Fallback to bunx (works if gno is published to npm)
|
|
436
436
|
// Note: This may trigger network access on first run
|
|
437
|
-
return { command: bunPath, args: [
|
|
437
|
+
return { command: bunPath, args: ["x", "@gmickel/gno", "mcp"] };
|
|
438
438
|
}
|
|
439
439
|
|
|
440
440
|
/**
|
|
@@ -442,29 +442,29 @@ export function buildMcpServerEntry(): McpServerEntry {
|
|
|
442
442
|
*/
|
|
443
443
|
export function getTargetDisplayName(target: McpTarget): string {
|
|
444
444
|
switch (target) {
|
|
445
|
-
case
|
|
446
|
-
return
|
|
447
|
-
case
|
|
448
|
-
return
|
|
449
|
-
case
|
|
450
|
-
return
|
|
451
|
-
case
|
|
452
|
-
return
|
|
453
|
-
case
|
|
454
|
-
return
|
|
455
|
-
case
|
|
456
|
-
return
|
|
457
|
-
case
|
|
458
|
-
return
|
|
459
|
-
case
|
|
460
|
-
return
|
|
461
|
-
case
|
|
462
|
-
return
|
|
463
|
-
case
|
|
464
|
-
return
|
|
445
|
+
case "claude-desktop":
|
|
446
|
+
return "Claude Desktop";
|
|
447
|
+
case "claude-code":
|
|
448
|
+
return "Claude Code";
|
|
449
|
+
case "codex":
|
|
450
|
+
return "Codex";
|
|
451
|
+
case "cursor":
|
|
452
|
+
return "Cursor";
|
|
453
|
+
case "zed":
|
|
454
|
+
return "Zed";
|
|
455
|
+
case "windsurf":
|
|
456
|
+
return "Windsurf";
|
|
457
|
+
case "opencode":
|
|
458
|
+
return "OpenCode";
|
|
459
|
+
case "amp":
|
|
460
|
+
return "Amp";
|
|
461
|
+
case "lmstudio":
|
|
462
|
+
return "LM Studio";
|
|
463
|
+
case "librechat":
|
|
464
|
+
return "LibreChat";
|
|
465
465
|
default: {
|
|
466
466
|
const _exhaustive: never = target;
|
|
467
|
-
throw new Error(`Unknown target: ${_exhaustive}`);
|
|
467
|
+
throw new Error(`Unknown target: ${String(_exhaustive)}`);
|
|
468
468
|
}
|
|
469
469
|
}
|
|
470
470
|
}
|