consult-llm-mcp 2.5.2 → 2.5.4

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.
Files changed (83) hide show
  1. package/CHANGELOG.md +198 -0
  2. package/README.md +39 -33
  3. package/consult-llm-mcp-darwin-arm64 +0 -0
  4. package/consult-llm-mcp-darwin-x64 +0 -0
  5. package/consult-llm-mcp-linux-arm64 +0 -0
  6. package/consult-llm-mcp-linux-x64 +0 -0
  7. package/package.json +23 -52
  8. package/run.sh +36 -0
  9. package/dist/cli.d.ts +0 -2
  10. package/dist/cli.js +0 -39
  11. package/dist/clipboard.d.ts +0 -1
  12. package/dist/clipboard.js +0 -10
  13. package/dist/clipboard.test.d.ts +0 -1
  14. package/dist/clipboard.test.js +0 -21
  15. package/dist/config.d.ts +0 -50
  16. package/dist/config.js +0 -108
  17. package/dist/config.test.d.ts +0 -1
  18. package/dist/config.test.js +0 -156
  19. package/dist/executors/api.d.ts +0 -3
  20. package/dist/executors/api.js +0 -29
  21. package/dist/executors/cli-runner.d.ts +0 -17
  22. package/dist/executors/cli-runner.js +0 -57
  23. package/dist/executors/codex-cli.d.ts +0 -6
  24. package/dist/executors/codex-cli.js +0 -90
  25. package/dist/executors/cursor-cli.d.ts +0 -6
  26. package/dist/executors/cursor-cli.js +0 -116
  27. package/dist/executors/gemini-cli.d.ts +0 -6
  28. package/dist/executors/gemini-cli.js +0 -76
  29. package/dist/executors/types.d.ts +0 -15
  30. package/dist/executors/types.js +0 -1
  31. package/dist/external-dirs.d.ts +0 -6
  32. package/dist/external-dirs.js +0 -19
  33. package/dist/external-dirs.test.d.ts +0 -1
  34. package/dist/external-dirs.test.js +0 -23
  35. package/dist/file.d.ts +0 -4
  36. package/dist/file.js +0 -17
  37. package/dist/git-worktree.d.ts +0 -9
  38. package/dist/git-worktree.js +0 -40
  39. package/dist/git-worktree.test.d.ts +0 -1
  40. package/dist/git-worktree.test.js +0 -35
  41. package/dist/git.d.ts +0 -1
  42. package/dist/git.js +0 -17
  43. package/dist/git.test.d.ts +0 -1
  44. package/dist/git.test.js +0 -43
  45. package/dist/index.d.ts +0 -4
  46. package/dist/index.js +0 -25
  47. package/dist/llm-cost.d.ts +0 -7
  48. package/dist/llm-cost.js +0 -38
  49. package/dist/llm-query.d.ts +0 -7
  50. package/dist/llm-query.js +0 -18
  51. package/dist/llm.d.ts +0 -7
  52. package/dist/llm.js +0 -89
  53. package/dist/llm.test.d.ts +0 -1
  54. package/dist/llm.test.js +0 -603
  55. package/dist/logger.d.ts +0 -7
  56. package/dist/logger.js +0 -70
  57. package/dist/main.d.ts +0 -2
  58. package/dist/main.js +0 -21
  59. package/dist/main.logic.d.ts +0 -10
  60. package/dist/main.logic.js +0 -145
  61. package/dist/main.logic.test.d.ts +0 -1
  62. package/dist/main.test.d.ts +0 -1
  63. package/dist/main.test.js +0 -113
  64. package/dist/mcp-server.d.ts +0 -2
  65. package/dist/mcp-server.js +0 -220
  66. package/dist/models.d.ts +0 -1
  67. package/dist/models.js +0 -10
  68. package/dist/prompt-builder.d.ts +0 -4
  69. package/dist/prompt-builder.js +0 -18
  70. package/dist/prompt.test.d.ts +0 -1
  71. package/dist/prompt.test.js +0 -113
  72. package/dist/schema.d.ts +0 -59
  73. package/dist/schema.js +0 -64
  74. package/dist/schema.test.d.ts +0 -1
  75. package/dist/schema.test.js +0 -81
  76. package/dist/server.d.ts +0 -8
  77. package/dist/server.js +0 -143
  78. package/dist/server.test.d.ts +0 -1
  79. package/dist/server.test.js +0 -258
  80. package/dist/system-prompt.d.ts +0 -7
  81. package/dist/system-prompt.js +0 -81
  82. package/dist/version.d.ts +0 -1
  83. package/dist/version.js +0 -1
package/CHANGELOG.md ADDED
@@ -0,0 +1,198 @@
1
+ # Changelog
2
+
3
+ ## v2.5.4 (2026-03-07)
4
+
5
+ - Rewrote server from TypeScript to Rust
6
+ - Distributed as cross-compiled native binaries (macOS arm64/x64, Linux
7
+ x64/arm64) via npm with a POSIX sh launcher
8
+ - Added `MCP_DEBUG_STDIN` env var for raw stdin transport logging
9
+
10
+ ## v2.5.3 (2026-03-06)
11
+
12
+ - Added `CONSULT_LLM_` prefix to backend and reasoning effort env vars:
13
+ `CONSULT_LLM_GEMINI_BACKEND`, `CONSULT_LLM_OPENAI_BACKEND`,
14
+ `CONSULT_LLM_CODEX_REASONING_EFFORT`. Old unprefixed names still work with a
15
+ deprecation warning.
16
+
17
+ ## v2.5.2 (2026-03-06)
18
+
19
+ - Fixed Codex CLI thread resumption failing due to unsupported `--add-dir` flag
20
+ in `codex exec resume`
21
+
22
+ ## v2.5.1 (2026-03-06)
23
+
24
+ - Consult skill now queries both Gemini and Codex in parallel by default, with
25
+ `--gemini` and `--codex` flags for single-model consultation
26
+ - CLI backends now receive main worktree path as additional context when running
27
+ inside a git worktree
28
+ - CLI backends now detect external file directories (outside workspace) and pass
29
+ them to Gemini/Codex so referenced files are accessible
30
+ - Debate skill now supports multi-round debates via `--rounds` flag (default 2,
31
+ max 3)
32
+ - Reduced anchoring bias in debate/debate-vs final review phase
33
+ - Added `install-skills` script for easy skill installation
34
+
35
+ ## v2.5.0 (2026-03-05)
36
+
37
+ - Added gpt-5.4 model support ($2.50/$15 per million tokens)
38
+
39
+ ## v2.4.2 (2026-02-28)
40
+
41
+ - Added gemini-3.1-pro-preview model support
42
+ - Filter unavailable models from the tool schema based on configured API keys
43
+ and CLI backends, preventing errors when selecting unconfigured models
44
+
45
+ ## v2.4.1 (2026-02-25)
46
+
47
+ - Updated tool description to tell callers not to inline file contents in the
48
+ prompt field, since the server reads files automatically via the `files`
49
+ parameter
50
+
51
+ ## v2.3.0 (2026-02-25)
52
+
53
+ - Added Cursor CLI (`cursor-agent`) as a new executor backend
54
+ - Replaced `GEMINI_MODE`/`OPENAI_MODE` with `GEMINI_BACKEND`/`OPENAI_BACKEND`
55
+ for backend routing (legacy env vars still work with deprecation warnings)
56
+ - Added `CONSULT_LLM_EXTRA_MODELS` environment variable for adding models
57
+ without code changes
58
+ - Removed gpt-5.1 and Claude models from built-in model list
59
+
60
+ ## v2.2.0 (2026-02-14)
61
+
62
+ - Added `task_mode` parameter for adaptive system prompts with five modes:
63
+ `review`, `plan`, `create`, `debug`, and `general` (default)
64
+
65
+ ## v2.1.0 (2026-02-12)
66
+
67
+ - Added multi-turn conversation support for CLI modes via `thread_id` parameter
68
+ - Codex CLI: uses `--json` output and `exec resume` for session continuity
69
+ - Gemini CLI: uses `-o json` output and `-r` flag for session resume
70
+ - Responses include a `[thread_id:xxx]` prefix for follow-up requests
71
+ - Replaced generic CLI executor with dedicated Codex and Gemini executors
72
+ - Added debate skill example (`skills/debate/SKILL.md`) showcasing multi-turn
73
+ conversations
74
+
75
+ ## v2.0.1 (2026-02-05)
76
+
77
+ - Added gpt-5.3-codex model support
78
+
79
+ ## v2.0.0 (2026-02-04)
80
+
81
+ - Log files now stored in XDG state directory
82
+ (`~/.local/state/consult-llm-mcp/`) instead of `~/.consult-llm-mcp/logs/`,
83
+ following the XDG Base Directory Specification
84
+
85
+ ## v1.7.2 (2026-02-04)
86
+
87
+ - Extracted model definitions to dedicated module, resolving a circular
88
+ dependency between config and schema
89
+
90
+ ## v1.7.1 (2026-02-04)
91
+
92
+ - Removed o3 model, succeeded by gpt-5.2 which is now the default OpenAI model
93
+ - Documented model selection behavior and `CONSULT_LLM_ALLOWED_MODELS` usage
94
+
95
+ ## v1.7.0 (2026-01-29)
96
+
97
+ - Added configurable system prompt path via `CONSULT_LLM_SYSTEM_PROMPT_PATH`
98
+ environment variable
99
+
100
+ ## v1.5.0 (2026-01-12)
101
+
102
+ - Added gpt-5.2-codex model support
103
+ - Added `CONSULT_LLM_ALLOWED_MODELS` environment variable to filter which models
104
+ are available in the tool schema
105
+
106
+ ## v1.4.7 (2025-12-12)
107
+
108
+ - Added gpt-5.2 model support
109
+
110
+ ## v1.4.6 (2025-12-03)
111
+
112
+ - Removed 5-minute timeout from CLI executors
113
+
114
+ ## v1.4.5 (2025-12-02)
115
+
116
+ - Improved system prompt by removing redundant "no critical issues found"
117
+ statement
118
+ - Fixed `init-prompt` command to use npx
119
+ - Moved skill and slash command examples to separate files
120
+
121
+ ## v1.4.4 (2025-11-26)
122
+
123
+ - Added support for gemini-3-pro-preview model
124
+
125
+ ## v1.4.3 (2025-11-22)
126
+
127
+ - Added `--skip-git-repo-check` to Codex CLI args, fixing issues when running
128
+ outside git repositories
129
+
130
+ ## v1.4.2 (2025-11-21)
131
+
132
+ - Added gpt-5.1-codex-max model support
133
+ - Made Codex CLI reasoning effort configurable
134
+ - Fixed Codex CLI execution
135
+
136
+ ## v1.4.1 (2025-11-19)
137
+
138
+ - Added test suite with vitest
139
+ - Fixed web mode file handling
140
+ - Split server entry point for better modularity
141
+
142
+ ## v1.4.0 (2025-11-18)
143
+
144
+ - Added Codex CLI support as a new executor backend
145
+ - Refactored LLM execution to a functional executor pattern
146
+ - Migrated to Zod v4 with native JSON schema generation
147
+ - Added example Claude Code skill to README
148
+
149
+ ## v1.3.0 (2025-11-16)
150
+
151
+ - Added web mode: copies the formatted prompt to clipboard for pasting into
152
+ browser-based LLMs instead of querying an API directly
153
+
154
+ ## v1.2.0 (2025-10-25)
155
+
156
+ - Added custom system prompt support, configurable via file
157
+ - Added environment variable documentation
158
+ - Set up ESLint and code quality checks
159
+
160
+ ## v1.1.2 (2025-10-25)
161
+
162
+ - Added `--version` flag to display the server version
163
+
164
+ ## v1.1.1 (2025-10-25)
165
+
166
+ - Added Gemini CLI mode support with a dedicated system prompt and instructions
167
+ - Enforced code file context requirement in the tool description
168
+ - Improved code review guidance in prompts
169
+
170
+ ## v1.1.0 (2025-07-28)
171
+
172
+ - Added Gemini CLI mode as an alternative to the Gemini API, with free quota
173
+ support
174
+ - Added debug logging and configuration logging with sensitive data redaction
175
+
176
+ ## v1.0.5 (2025-06-29)
177
+
178
+ - Improved system prompt for more concise and critical analysis
179
+ - Updated tool description to emphasize neutral, unbiased questioning
180
+ - Moved main prompt to the `prompt` field instead of embedding in markdown
181
+
182
+ ## v1.0.4 (2025-06-25)
183
+
184
+ - Added system prompt to LLM queries for enhanced analysis and recommendations
185
+ - Added `prompt` parameter to the tool
186
+
187
+ ## v1.0.3 (2025-06-23)
188
+
189
+ - Added deepseek-reasoner and gemini-2.5-pro model options
190
+ - Added API key validation checks for OpenAI, Gemini, and DeepSeek models
191
+
192
+ ## v1.0.2 (2025-06-23)
193
+
194
+ - Added server version logging and version in server metadata
195
+
196
+ ## v1.0.1 (2025-06-23)
197
+
198
+ Initial release.
package/README.md CHANGED
@@ -64,7 +64,7 @@ to bring in the heavy artillery. Supports multi-turn conversations.
64
64
  -e OPENAI_API_KEY=your_openai_key \
65
65
  -e GEMINI_API_KEY=your_gemini_key \
66
66
  -e DEEPSEEK_API_KEY=your_deepseek_key \
67
- -e GEMINI_BACKEND=gemini-cli \
67
+ -e CONSULT_LLM_GEMINI_BACKEND=gemini-cli \
68
68
  -- npx -y consult-llm-mcp
69
69
  ```
70
70
 
@@ -344,7 +344,7 @@ or use your Google AI Pro subscription.
344
344
  **Setup:**
345
345
 
346
346
  ```bash
347
- claude mcp add consult-llm -e GEMINI_BACKEND=gemini-cli -- npx -y consult-llm-mcp
347
+ claude mcp add consult-llm -e CONSULT_LLM_GEMINI_BACKEND=gemini-cli -- npx -y consult-llm-mcp
348
348
  ```
349
349
 
350
350
  #### Codex CLI
@@ -359,12 +359,12 @@ Use OpenAI's Codex CLI for OpenAI models.
359
359
  **Setup:**
360
360
 
361
361
  ```bash
362
- claude mcp add consult-llm -e OPENAI_BACKEND=codex-cli -- npx -y consult-llm-mcp
362
+ claude mcp add consult-llm -e CONSULT_LLM_OPENAI_BACKEND=codex-cli -- npx -y consult-llm-mcp
363
363
  ```
364
364
 
365
365
  <!-- prettier-ignore -->
366
366
  > [!TIP]
367
- > Set reasoning effort with `-e CODEX_REASONING_EFFORT=high`. Options:
367
+ > Set reasoning effort with `-e CONSULT_LLM_CODEX_REASONING_EFFORT=high`. Options:
368
368
  > `none`, `minimal`, `low`, `medium`, `high`, `xhigh`.
369
369
 
370
370
  #### Cursor CLI
@@ -380,15 +380,17 @@ Use Cursor's agent CLI to route GPT and Gemini models through one tool.
380
380
 
381
381
  ```bash
382
382
  # Route GPT models through Cursor CLI
383
- claude mcp add consult-llm -e OPENAI_BACKEND=cursor-cli -- npx -y consult-llm-mcp
383
+ claude mcp add consult-llm -e CONSULT_LLM_OPENAI_BACKEND=cursor-cli -- npx -y consult-llm-mcp
384
384
 
385
385
  # Route Gemini models through Cursor CLI
386
- claude mcp add consult-llm -e GEMINI_BACKEND=cursor-cli -- npx -y consult-llm-mcp
386
+ claude mcp add consult-llm -e CONSULT_LLM_GEMINI_BACKEND=cursor-cli -- npx -y consult-llm-mcp
387
387
 
388
388
  # Route everything through Cursor CLI
389
389
  claude mcp add consult-llm \
390
- -e OPENAI_BACKEND=cursor-cli \
391
- -e GEMINI_BACKEND=cursor-cli \
390
+ -e CONSULT_LLM_OPENAI_BACKEND=cursor-cli \
391
+ -e CONSULT_LLM_GEMINI_BACKEND=cursor-cli \
392
+ -e CONSULT_LLM_CODEX_REASONING_EFFORT=high \
393
+ -e CONSULT_LLM_ALLOWED_MODELS="gemini-3-pro-preview,gpt-5.3-codex" \
392
394
  -- npx -y consult-llm-mcp
393
395
  ```
394
396
 
@@ -459,11 +461,12 @@ See the "Using web mode..." example above for a concrete transcript.
459
461
  - Options: `gpt-5.2` (default), `gpt-5.4`, `gemini-2.5-pro`,
460
462
  `gemini-3-pro-preview`, `gemini-3.1-pro-preview`, `deepseek-reasoner`,
461
463
  `gpt-5.3-codex`, `gpt-5.2-codex`
462
- - `GEMINI_BACKEND` - Backend for Gemini models (optional)
464
+ - `CONSULT_LLM_GEMINI_BACKEND` - Backend for Gemini models (optional)
463
465
  - Options: `api` (default), `gemini-cli`, `cursor-cli`
464
- - `OPENAI_BACKEND` - Backend for OpenAI models (optional)
466
+ - `CONSULT_LLM_OPENAI_BACKEND` - Backend for OpenAI models (optional)
465
467
  - Options: `api` (default), `codex-cli`, `cursor-cli`
466
- - `CODEX_REASONING_EFFORT` - Configure reasoning effort for Codex CLI (optional)
468
+ - `CONSULT_LLM_CODEX_REASONING_EFFORT` - Configure reasoning effort for Codex
469
+ CLI (optional)
467
470
  - See [Codex CLI](#codex-cli) for details and available options
468
471
  - `CONSULT_LLM_EXTRA_MODELS` - Add models not in the built-in list (optional)
469
472
  - Comma-separated list, e.g., `grok-3,kimi-k2.5`
@@ -480,6 +483,11 @@ See the "Using web mode..." example above for a concrete transcript.
480
483
  (optional)
481
484
  - Overrides the default `~/.consult-llm-mcp/SYSTEM_PROMPT.md` location
482
485
  - Useful for project-specific prompts
486
+ - `MCP_DEBUG_STDIN` - Log raw JSON-RPC messages received on stdin (optional)
487
+ - Set to `1` to enable
488
+ - Logs every message as `RAW RECV` entries and poll timing gaps as
489
+ `STDIN POLL` entries in `mcp.log`
490
+ - Useful for debugging transport-level issues
483
491
 
484
492
  ### Custom system prompt
485
493
 
@@ -777,51 +785,49 @@ forth before synthesizing and implementing. See
777
785
 
778
786
  To work on the MCP server locally and use your development version:
779
787
 
780
- 1. Clone the repository and install dependencies:
788
+ 1. Clone the repository:
781
789
 
782
790
  ```bash
783
791
  git clone https://github.com/raine/consult-llm-mcp.git
784
792
  cd consult-llm-mcp
785
- npm install
786
793
  ```
787
794
 
788
- 2. Build the project:
795
+ 2. Build and test:
789
796
 
790
797
  ```bash
791
- npm run build
798
+ cargo build
799
+ cargo test
800
+ just check # format, lint, test
792
801
  ```
793
802
 
794
- 3. Install globally from the local directory:
795
-
796
- ```bash
797
- npm link
798
- ```
799
-
800
- 4. Add the MCP server to Claude Code using the global command:
803
+ 3. Add the MCP server to Claude Code using your local build:
801
804
  ```bash
802
- claude mcp add consult-llm -- consult-llm-mcp
805
+ claude mcp add consult-llm -- /path/to/consult-llm-mcp/target/debug/consult-llm-mcp
803
806
  ```
804
807
 
805
- Now when you make changes:
808
+ Now when you make changes, rebuild with `cargo build` and restart Claude Code.
806
809
 
807
- 1. Rebuild: `npm run build`
808
- 2. Restart Claude Code to pick up the changes
810
+ ### Releasing
809
811
 
810
- Alternatively, you can use the dev script for development without building:
812
+ Requires [zig](https://ziglang.org/),
813
+ [cargo-zigbuild](https://github.com/rust-cross/cargo-zigbuild), and
814
+ cross-compilation targets:
811
815
 
812
816
  ```bash
813
- claude mcp add consult-llm -- npm run dev
817
+ brew install zig
818
+ cargo install cargo-zigbuild
819
+ rustup target add aarch64-apple-darwin x86_64-apple-darwin x86_64-unknown-linux-gnu aarch64-unknown-linux-gnu
814
820
  ```
815
821
 
816
- This runs the TypeScript source directly with `tsx`, allowing faster iteration
817
- without rebuilding.
818
-
819
- To unlink the global version later:
822
+ Publish a new version:
820
823
 
821
824
  ```bash
822
- npm unlink -g
825
+ scripts/publish patch # or minor, major
823
826
  ```
824
827
 
828
+ This cross-compiles for all platforms, stages the binaries, publishes to npm,
829
+ then commits and tags.
830
+
825
831
  ## Related projects
826
832
 
827
833
  - [workmux](https://github.com/raine/workmux) — Git worktrees + tmux windows for
Binary file
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -1,36 +1,7 @@
1
1
  {
2
2
  "name": "consult-llm-mcp",
3
- "version": "2.5.2",
3
+ "version": "2.5.4",
4
4
  "description": "MCP server for consulting powerful AI models",
5
- "type": "module",
6
- "main": "dist/main.js",
7
- "bin": {
8
- "consult-llm-mcp": "./dist/main.js"
9
- },
10
- "scripts": {
11
- "build": "./scripts/generate-version && tsc",
12
- "dev": "tsx src/main.ts",
13
- "start": "node dist/main.js",
14
- "test": "vitest",
15
- "test:run": "vitest run",
16
- "format": "oxfmt --write .",
17
- "check": "concurrently \"pnpm:check:*\"",
18
- "check:types": "tsc --noEmit",
19
- "check:format": "oxfmt --check .",
20
- "check:lint": "biome lint .",
21
- "check:test": "vitest run",
22
- "install-global": "npm run build && npm install -g .",
23
- "prepublishOnly": "pnpm run check && npm run build",
24
- "publish:dry": "npm publish --dry-run"
25
- },
26
- "keywords": [
27
- "mcp",
28
- "openai",
29
- "gemini",
30
- "llm",
31
- "ai"
32
- ],
33
- "author": "",
34
5
  "repository": {
35
6
  "type": "git",
36
7
  "url": "git+https://github.com/raine/consult-llm-mcp.git"
@@ -39,28 +10,28 @@
39
10
  "bugs": {
40
11
  "url": "https://github.com/raine/consult-llm-mcp/issues"
41
12
  },
42
- "files": [
43
- "dist",
44
- "README.md"
45
- ],
46
- "engines": {
47
- "node": ">=18.0.0"
48
- },
49
13
  "license": "MIT",
50
- "dependencies": {
51
- "@modelcontextprotocol/sdk": "^1.27.1",
52
- "clipboardy": "^5.3.1",
53
- "openai": "^6.25.0",
54
- "prettier": "^3.8.1",
55
- "zod": "^4.3.6"
14
+ "bin": {
15
+ "consult-llm-mcp": "./run.sh"
56
16
  },
57
- "devDependencies": {
58
- "@biomejs/biome": "2.4.4",
59
- "@types/node": "^25.3.0",
60
- "concurrently": "^9.2.1",
61
- "oxfmt": "^0.35.0",
62
- "tsx": "^4.21.0",
63
- "typescript": "^5.9.3",
64
- "vitest": "^4.0.18"
65
- }
17
+ "files": [
18
+ "run.sh",
19
+ "consult-llm-mcp-darwin-arm64",
20
+ "consult-llm-mcp-darwin-x64",
21
+ "consult-llm-mcp-linux-x64",
22
+ "consult-llm-mcp-linux-arm64",
23
+ "README.md",
24
+ "CHANGELOG.md"
25
+ ],
26
+ "os": [
27
+ "darwin",
28
+ "linux"
29
+ ],
30
+ "keywords": [
31
+ "mcp",
32
+ "openai",
33
+ "gemini",
34
+ "llm",
35
+ "ai"
36
+ ]
66
37
  }
package/run.sh ADDED
@@ -0,0 +1,36 @@
1
+ #!/bin/sh
2
+ set -e
3
+
4
+ # Resolve symlinks to find the actual script directory (npm creates symlinks in .bin/)
5
+ # When invoked via PATH, $0 may be just the command name without a path
6
+ script="$0"
7
+ case "$script" in
8
+ */*) ;;
9
+ *) script="$(command -v "$script" 2>/dev/null || echo "$script")" ;;
10
+ esac
11
+ while [ -L "$script" ]; do
12
+ target="$(readlink "$script")"
13
+ case "$target" in
14
+ /*) script="$target" ;;
15
+ *) script="$(dirname "$script")/$target" ;;
16
+ esac
17
+ done
18
+ DIR="$(cd -P "$(dirname "$script")" && pwd)"
19
+
20
+ OS="$(uname -s)"
21
+ ARCH="$(uname -m)"
22
+
23
+ case "$OS:$ARCH" in
24
+ Darwin:arm64 | Darwin:aarch64) BIN="$DIR/consult-llm-mcp-darwin-arm64" ;;
25
+ Darwin:x86_64) BIN="$DIR/consult-llm-mcp-darwin-x64" ;;
26
+ Linux:x86_64 | Linux:amd64) BIN="$DIR/consult-llm-mcp-linux-x64" ;;
27
+ Linux:aarch64 | Linux:arm64) BIN="$DIR/consult-llm-mcp-linux-arm64" ;;
28
+ *)
29
+ echo "consult-llm-mcp: unsupported platform: $OS $ARCH" >&2
30
+ exit 1
31
+ ;;
32
+ esac
33
+
34
+ # npm may strip executable bits on sidecar binaries during extraction
35
+ [ -x "$BIN" ] || chmod +x "$BIN"
36
+ exec "$BIN" "$@"
package/dist/cli.d.ts DELETED
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- export {};
package/dist/cli.js DELETED
@@ -1,39 +0,0 @@
1
- #!/usr/bin/env node
2
- import { getClientForModel } from './index.js';
3
- async function main() {
4
- const args = process.argv.slice(2);
5
- if (args.length === 0) {
6
- console.error('Usage: llmtool <prompt>');
7
- console.error('Environment variables:');
8
- console.error(' OPENAI_API_KEY - Required for GPT models');
9
- console.error(' GEMINI_API_KEY - Required for Gemini models');
10
- console.error(' MODEL - Model to use (default: gpt-3.5-turbo)');
11
- process.exit(1);
12
- }
13
- const prompt = args.join(' ');
14
- const model = process.env.MODEL || 'gpt-3.5-turbo';
15
- try {
16
- const { client } = getClientForModel(model);
17
- const completion = await client.chat.completions.create({
18
- model,
19
- messages: [{ role: 'user', content: prompt }],
20
- temperature: 0.7,
21
- });
22
- const response = completion.choices[0]?.message?.content;
23
- if (response) {
24
- console.log(response);
25
- }
26
- else {
27
- console.error('No response from the model');
28
- process.exit(1);
29
- }
30
- }
31
- catch (error) {
32
- console.error('Error:', error instanceof Error ? error.message : String(error));
33
- process.exit(1);
34
- }
35
- }
36
- main().catch((error) => {
37
- console.error('Fatal error:', error);
38
- process.exit(1);
39
- });
@@ -1 +0,0 @@
1
- export declare function copyToClipboard(text: string): Promise<void>;
package/dist/clipboard.js DELETED
@@ -1,10 +0,0 @@
1
- import clipboard from 'clipboardy';
2
- export async function copyToClipboard(text) {
3
- try {
4
- await clipboard.write(text);
5
- }
6
- catch (error) {
7
- const message = error instanceof Error ? error.message : 'Unknown clipboard error';
8
- throw new Error(`Failed to copy prompt to clipboard: ${message}`);
9
- }
10
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,21 +0,0 @@
1
- import { describe, it, expect, vi, afterEach } from 'vitest';
2
- import { copyToClipboard } from './clipboard.js';
3
- const writeMock = vi.hoisted(() => vi.fn());
4
- vi.mock('clipboardy', () => ({
5
- default: {
6
- write: writeMock,
7
- },
8
- }));
9
- afterEach(() => {
10
- writeMock.mockReset();
11
- });
12
- describe('copyToClipboard', () => {
13
- it('writes text to clipboard', async () => {
14
- await copyToClipboard('hello world');
15
- expect(writeMock).toHaveBeenCalledWith('hello world');
16
- });
17
- it('wraps clipboard errors with a descriptive message', async () => {
18
- writeMock.mockRejectedValueOnce(new Error('OS error'));
19
- await expect(copyToClipboard('x')).rejects.toThrow('Failed to copy prompt to clipboard: OS error');
20
- });
21
- });
package/dist/config.d.ts DELETED
@@ -1,50 +0,0 @@
1
- import { z } from 'zod/v4';
2
- export interface ProviderAvailability {
3
- geminiApiKey?: string;
4
- geminiBackend: string;
5
- openaiApiKey?: string;
6
- openaiBackend: string;
7
- deepseekApiKey?: string;
8
- }
9
- export declare function filterByAvailability(models: string[], providers: ProviderAvailability): string[];
10
- /** Build the final model catalog from built-in + extra + allowlist filtering. */
11
- export declare function buildModelCatalog(builtinModels: readonly string[], extraModelsRaw?: string, allowedModelsRaw?: string): string[];
12
- export declare const SupportedChatModel: z.ZodEnum<{
13
- [x: string]: string;
14
- }>;
15
- export type SupportedChatModel = z.infer<typeof SupportedChatModel>;
16
- export declare const fallbackModel: string;
17
- declare const Config: z.ZodObject<{
18
- openaiApiKey: z.ZodOptional<z.ZodString>;
19
- geminiApiKey: z.ZodOptional<z.ZodString>;
20
- deepseekApiKey: z.ZodOptional<z.ZodString>;
21
- defaultModel: z.ZodOptional<z.ZodEnum<{
22
- [x: string]: string;
23
- }>>;
24
- geminiBackend: z.ZodDefault<z.ZodEnum<{
25
- api: "api";
26
- "gemini-cli": "gemini-cli";
27
- "cursor-cli": "cursor-cli";
28
- }>>;
29
- openaiBackend: z.ZodDefault<z.ZodEnum<{
30
- api: "api";
31
- "cursor-cli": "cursor-cli";
32
- "codex-cli": "codex-cli";
33
- }>>;
34
- codexReasoningEffort: z.ZodOptional<z.ZodEnum<{
35
- none: "none";
36
- minimal: "minimal";
37
- low: "low";
38
- medium: "medium";
39
- high: "high";
40
- xhigh: "xhigh";
41
- }>>;
42
- systemPromptPath: z.ZodOptional<z.ZodString>;
43
- }, z.core.$strip>;
44
- type ParsedConfig = z.infer<typeof Config>;
45
- export type Config = ParsedConfig & {
46
- allowedModels: string[];
47
- };
48
- export declare function migrateBackendEnv(newVar: string | undefined, oldVar: string | undefined, providerCliValue: string, legacyName: string, newName: string): string | undefined;
49
- export declare const config: Config;
50
- export {};