@hasna/terminal 2.0.5 → 2.2.0
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/dist/cli.js +23 -9
- package/package.json +1 -1
- package/src/ai.ts +46 -113
- package/src/cli.tsx +22 -9
- package/src/command-validator.ts +11 -0
- package/src/context-hints.ts +202 -0
- package/src/output-processor.ts +7 -18
- package/src/providers/base.ts +3 -1
- package/src/providers/groq.ts +108 -0
- package/src/providers/index.ts +26 -2
- package/src/providers/providers.test.ts +4 -2
- package/src/providers/xai.ts +108 -0
- package/dist/App.js +0 -404
- package/dist/Browse.js +0 -79
- package/dist/FuzzyPicker.js +0 -47
- package/dist/Onboarding.js +0 -51
- package/dist/Spinner.js +0 -12
- package/dist/StatusBar.js +0 -49
- package/dist/ai.js +0 -368
- package/dist/cache.js +0 -41
- package/dist/command-rewriter.js +0 -64
- package/dist/command-validator.js +0 -77
- package/dist/compression.js +0 -107
- package/dist/diff-cache.js +0 -107
- package/dist/economy.js +0 -79
- package/dist/expand-store.js +0 -38
- package/dist/file-cache.js +0 -72
- package/dist/file-index.js +0 -62
- package/dist/history.js +0 -62
- package/dist/lazy-executor.js +0 -54
- package/dist/line-dedup.js +0 -59
- package/dist/loop-detector.js +0 -75
- package/dist/mcp/install.js +0 -98
- package/dist/mcp/server.js +0 -569
- package/dist/noise-filter.js +0 -86
- package/dist/output-processor.js +0 -136
- package/dist/output-router.js +0 -41
- package/dist/parsers/base.js +0 -2
- package/dist/parsers/build.js +0 -64
- package/dist/parsers/errors.js +0 -101
- package/dist/parsers/files.js +0 -78
- package/dist/parsers/git.js +0 -99
- package/dist/parsers/index.js +0 -48
- package/dist/parsers/tests.js +0 -89
- package/dist/providers/anthropic.js +0 -39
- package/dist/providers/base.js +0 -4
- package/dist/providers/cerebras.js +0 -95
- package/dist/providers/index.js +0 -49
- package/dist/recipes/model.js +0 -20
- package/dist/recipes/storage.js +0 -136
- package/dist/search/content-search.js +0 -68
- package/dist/search/file-search.js +0 -61
- package/dist/search/filters.js +0 -34
- package/dist/search/index.js +0 -5
- package/dist/search/semantic.js +0 -320
- package/dist/session-boot.js +0 -59
- package/dist/session-context.js +0 -55
- package/dist/sessions-db.js +0 -120
- package/dist/smart-display.js +0 -286
- package/dist/snapshots.js +0 -51
- package/dist/supervisor.js +0 -112
- package/dist/test-watchlist.js +0 -131
- package/dist/tree.js +0 -94
- package/dist/usage-cache.js +0 -65
package/dist/mcp/install.js
DELETED
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
// MCP installation helper — register open-terminal as MCP server for various agents
|
|
2
|
-
import { execSync } from "child_process";
|
|
3
|
-
import { existsSync, readFileSync, writeFileSync } from "fs";
|
|
4
|
-
import { homedir } from "os";
|
|
5
|
-
import { join } from "path";
|
|
6
|
-
const TERMINAL_BIN = "terminal"; // the CLI binary name
|
|
7
|
-
function which(cmd) {
|
|
8
|
-
try {
|
|
9
|
-
return execSync(`which ${cmd}`, { encoding: "utf8" }).trim();
|
|
10
|
-
}
|
|
11
|
-
catch {
|
|
12
|
-
return null;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
export function installClaude() {
|
|
16
|
-
try {
|
|
17
|
-
execSync(`claude mcp add --transport stdio --scope user open-terminal -- ${which(TERMINAL_BIN) ?? "npx"} ${which(TERMINAL_BIN) ? "mcp serve" : "@hasna/terminal mcp serve"}`, { stdio: "inherit" });
|
|
18
|
-
console.log("✓ Installed open-terminal MCP server for Claude Code");
|
|
19
|
-
return true;
|
|
20
|
-
}
|
|
21
|
-
catch (e) {
|
|
22
|
-
console.error("Failed to install for Claude Code:", e);
|
|
23
|
-
return false;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
export function installCodex() {
|
|
27
|
-
const configPath = join(homedir(), ".codex", "config.toml");
|
|
28
|
-
try {
|
|
29
|
-
let content = existsSync(configPath) ? readFileSync(configPath, "utf8") : "";
|
|
30
|
-
if (content.includes("[mcp_servers.open-terminal]")) {
|
|
31
|
-
console.log("✓ open-terminal already configured for Codex");
|
|
32
|
-
return true;
|
|
33
|
-
}
|
|
34
|
-
const bin = which(TERMINAL_BIN) ?? "npx @hasna/terminal";
|
|
35
|
-
content += `\n[mcp_servers.open-terminal]\ncommand = "${bin}"\nargs = ["mcp", "serve"]\n`;
|
|
36
|
-
writeFileSync(configPath, content);
|
|
37
|
-
console.log("✓ Installed open-terminal MCP server for Codex");
|
|
38
|
-
return true;
|
|
39
|
-
}
|
|
40
|
-
catch (e) {
|
|
41
|
-
console.error("Failed to install for Codex:", e);
|
|
42
|
-
return false;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
export function installGemini() {
|
|
46
|
-
const configPath = join(homedir(), ".gemini", "settings.json");
|
|
47
|
-
try {
|
|
48
|
-
let config = {};
|
|
49
|
-
if (existsSync(configPath)) {
|
|
50
|
-
config = JSON.parse(readFileSync(configPath, "utf8"));
|
|
51
|
-
}
|
|
52
|
-
if (!config.mcpServers)
|
|
53
|
-
config.mcpServers = {};
|
|
54
|
-
const bin = which(TERMINAL_BIN) ?? "npx";
|
|
55
|
-
const args = which(TERMINAL_BIN) ? ["mcp", "serve"] : ["@hasna/terminal", "mcp", "serve"];
|
|
56
|
-
config.mcpServers["open-terminal"] = { command: bin, args };
|
|
57
|
-
writeFileSync(configPath, JSON.stringify(config, null, 2));
|
|
58
|
-
console.log("✓ Installed open-terminal MCP server for Gemini");
|
|
59
|
-
return true;
|
|
60
|
-
}
|
|
61
|
-
catch (e) {
|
|
62
|
-
console.error("Failed to install for Gemini:", e);
|
|
63
|
-
return false;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
export function installAll() {
|
|
67
|
-
installClaude();
|
|
68
|
-
installCodex();
|
|
69
|
-
installGemini();
|
|
70
|
-
}
|
|
71
|
-
export function handleMcpInstall(args) {
|
|
72
|
-
const flags = new Set(args);
|
|
73
|
-
if (flags.has("--all")) {
|
|
74
|
-
installAll();
|
|
75
|
-
return;
|
|
76
|
-
}
|
|
77
|
-
if (flags.has("--claude")) {
|
|
78
|
-
installClaude();
|
|
79
|
-
return;
|
|
80
|
-
}
|
|
81
|
-
if (flags.has("--codex")) {
|
|
82
|
-
installCodex();
|
|
83
|
-
return;
|
|
84
|
-
}
|
|
85
|
-
if (flags.has("--gemini")) {
|
|
86
|
-
installGemini();
|
|
87
|
-
return;
|
|
88
|
-
}
|
|
89
|
-
console.log("Usage: t mcp install [--claude|--codex|--gemini|--all]");
|
|
90
|
-
console.log("");
|
|
91
|
-
console.log("Install open-terminal as an MCP server for AI coding agents.");
|
|
92
|
-
console.log("");
|
|
93
|
-
console.log("Options:");
|
|
94
|
-
console.log(" --claude Install for Claude Code");
|
|
95
|
-
console.log(" --codex Install for OpenAI Codex");
|
|
96
|
-
console.log(" --gemini Install for Gemini CLI");
|
|
97
|
-
console.log(" --all Install for all agents");
|
|
98
|
-
}
|