turno-cli 0.0.0-stage → 0.1.1
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/CHANGELOG.md +30 -0
- package/LICENSE +202 -0
- package/NOTICE +18 -0
- package/README.md +335 -2
- package/dist/accounts/audit.js +54 -0
- package/dist/accounts/builtin.js +214 -0
- package/dist/accounts/delegate.js +185 -0
- package/dist/accounts/registry.js +190 -0
- package/dist/agents/index.js +101 -0
- package/dist/agents/snippets.js +64 -0
- package/dist/cli/args.js +47 -0
- package/dist/cli/commands/accounts.js +216 -0
- package/dist/cli/commands/auto.js +44 -0
- package/dist/cli/commands/available.js +18 -0
- package/dist/cli/commands/browser.js +175 -0
- package/dist/cli/commands/complete.js +112 -0
- package/dist/cli/commands/completion.js +57 -0
- package/dist/cli/commands/config.js +168 -0
- package/dist/cli/commands/doctor.js +324 -0
- package/dist/cli/commands/exhausted.js +40 -0
- package/dist/cli/commands/handoff.js +118 -0
- package/dist/cli/commands/hook.js +63 -0
- package/dist/cli/commands/identity.js +114 -0
- package/dist/cli/commands/limit.js +102 -0
- package/dist/cli/commands/mcp.js +350 -0
- package/dist/cli/commands/mcpd.js +161 -0
- package/dist/cli/commands/migrate.js +176 -0
- package/dist/cli/commands/open.js +60 -0
- package/dist/cli/commands/profile.js +259 -0
- package/dist/cli/commands/resolve.js +23 -0
- package/dist/cli/commands/run.js +15 -0
- package/dist/cli/commands/secret.js +123 -0
- package/dist/cli/commands/session.js +36 -0
- package/dist/cli/commands/sessions.js +27 -0
- package/dist/cli/commands/setup.js +224 -0
- package/dist/cli/commands/status.js +101 -0
- package/dist/cli/commands/statusline.js +275 -0
- package/dist/cli/commands/ui.js +276 -0
- package/dist/cli/commands/undo.js +67 -0
- package/dist/cli/commands/update-check.js +22 -0
- package/dist/cli/commands/upgrade.js +162 -0
- package/dist/cli/commands/usage.js +167 -0
- package/dist/cli/commands/version.js +27 -0
- package/dist/cli/commands/which.js +28 -0
- package/dist/cli/group.js +50 -0
- package/dist/cli/io.js +22 -0
- package/dist/cli/launch.js +98 -0
- package/dist/cli/launchers.js +200 -0
- package/dist/cli/main.js +94 -0
- package/dist/cli/registry.js +77 -0
- package/dist/core/config-edit.js +42 -0
- package/dist/core/config.js +137 -0
- package/dist/core/exhausted.js +30 -0
- package/dist/core/journal.js +185 -0
- package/dist/core/manifest.js +177 -0
- package/dist/core/paths.js +54 -0
- package/dist/core/profiles.js +61 -0
- package/dist/core/ratelimit.js +39 -0
- package/dist/core/resolve.js +78 -0
- package/dist/core/secrets.js +44 -0
- package/dist/core/sessions.js +173 -0
- package/dist/core/toml-edit.js +152 -0
- package/dist/core/update.js +102 -0
- package/dist/core/version.js +109 -0
- package/dist/mcpd/cache.js +41 -0
- package/dist/mcpd/connectors.js +63 -0
- package/dist/mcpd/daemon.js +163 -0
- package/dist/mcpd/gateway.js +308 -0
- package/dist/mcpd/importer.js +160 -0
- package/dist/mcpd/instances.js +303 -0
- package/dist/mcpd/jsonrpc.js +19 -0
- package/dist/mcpd/launchd.js +86 -0
- package/dist/mcpd/peerpid.js +25 -0
- package/dist/mcpd/sync.js +208 -0
- package/dist/mcpd/upstream.js +232 -0
- package/dist/statusline/cost.js +135 -0
- package/dist/statusline/render.js +246 -0
- package/dist/ui/cmap.js +57 -0
- package/dist/ui/fonts.js +107 -0
- package/dist/ui/settings.js +69 -0
- package/dist/ui/terminal-id.js +30 -0
- package/dist/ui/terminals.js +163 -0
- package/package.json +69 -3
package/dist/ui/fonts.js
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { execFileSync } from "node:child_process";
|
|
2
|
+
import { createHash } from "node:crypto";
|
|
3
|
+
import { existsSync, mkdirSync, readFileSync, renameSync, writeFileSync } from "node:fs";
|
|
4
|
+
import { join } from "node:path";
|
|
5
|
+
import { findOnPath } from "../cli/launch.js";
|
|
6
|
+
const NF = "https://raw.githubusercontent.com/ryanoasis/nerd-fonts/v3.4.0/patched-fonts/Meslo/S/";
|
|
7
|
+
/** Same values as turno-fonts, for an install without that optional package. */
|
|
8
|
+
export const FALLBACK = {
|
|
9
|
+
family: "MesloLGS Nerd Font",
|
|
10
|
+
version: "3.4.0",
|
|
11
|
+
files: [
|
|
12
|
+
{
|
|
13
|
+
file: "MesloLGSNerdFont-Regular.ttf",
|
|
14
|
+
url: `${NF}Regular/MesloLGSNerdFont-Regular.ttf`,
|
|
15
|
+
sha256: "44ae9b687639c1529ecd01e5d0ae8d98f3b30cb20b02bbe4e6d9fb474c8dee36",
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
file: "MesloLGSNerdFont-Bold.ttf",
|
|
19
|
+
url: `${NF}Bold/MesloLGSNerdFont-Bold.ttf`,
|
|
20
|
+
sha256: "9799788a96066045c3f53f2e5bcbe376c6b9adb9514e3276cc84ac42d8b176d0",
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
file: "MesloLGSNerdFont-Italic.ttf",
|
|
24
|
+
url: `${NF}Italic/MesloLGSNerdFont-Italic.ttf`,
|
|
25
|
+
sha256: "3dede17df16e62abdae99ea7f13a14cbc391e2cc9429c8dfa1b5349e78758e9c",
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
file: "MesloLGSNerdFont-BoldItalic.ttf",
|
|
29
|
+
url: `${NF}Bold-Italic/MesloLGSNerdFont-BoldItalic.ttf`,
|
|
30
|
+
sha256: "734956444bc02c8ea0e7f7effe46c616f2e492734c6afe91049e4735d522542c",
|
|
31
|
+
},
|
|
32
|
+
],
|
|
33
|
+
};
|
|
34
|
+
export async function fontSource() {
|
|
35
|
+
try {
|
|
36
|
+
const pkg = (await import("turno-fonts"));
|
|
37
|
+
return { family: pkg.FAMILY, version: pkg.VERSION, files: pkg.FONTS, dir: pkg.fontsDir };
|
|
38
|
+
}
|
|
39
|
+
catch {
|
|
40
|
+
return FALLBACK;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
/** The per-user font folder: no admin rights needed. */
|
|
44
|
+
export function userFontDir(env, platform = process.platform) {
|
|
45
|
+
if (env.TURNO_FONT_DIR)
|
|
46
|
+
return env.TURNO_FONT_DIR;
|
|
47
|
+
const home = env.HOME ?? "";
|
|
48
|
+
if (platform === "darwin")
|
|
49
|
+
return join(home, "Library", "Fonts");
|
|
50
|
+
if (platform === "linux")
|
|
51
|
+
return join(env.XDG_DATA_HOME || join(home, ".local", "share"), "fonts");
|
|
52
|
+
return undefined;
|
|
53
|
+
}
|
|
54
|
+
export const sha256 = (buf) => createHash("sha256").update(buf).digest("hex");
|
|
55
|
+
export function checkFonts(source, dir) {
|
|
56
|
+
return source.files.map((f) => {
|
|
57
|
+
const target = join(dir, f.file);
|
|
58
|
+
let state = "missing";
|
|
59
|
+
if (existsSync(target))
|
|
60
|
+
state = sha256(readFileSync(target)) === f.sha256 ? "installed" : "different";
|
|
61
|
+
return { ...f, target, state };
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
async function bytesOf(source, f, doFetch) {
|
|
65
|
+
if (source.dir)
|
|
66
|
+
return { buf: readFileSync(join(source.dir, f.file)), downloaded: false };
|
|
67
|
+
const res = await doFetch(f.url, { signal: AbortSignal.timeout(60_000) });
|
|
68
|
+
if (!res.ok)
|
|
69
|
+
throw new Error(`downloading ${f.file}: HTTP ${res.status}`);
|
|
70
|
+
return { buf: Buffer.from(await res.arrayBuffer()), downloaded: true };
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Copy the font files into `dir`. A file that is already there with the right checksum is
|
|
74
|
+
* kept; one with the same name and other contents is skipped unless `force`. Every byte
|
|
75
|
+
* written is checked against the pinned SHA-256 first.
|
|
76
|
+
*/
|
|
77
|
+
export async function installFonts(source, opts) {
|
|
78
|
+
const results = [];
|
|
79
|
+
for (const check of checkFonts(source, opts.dir)) {
|
|
80
|
+
if (check.state === "installed" || (check.state === "different" && !opts.force)) {
|
|
81
|
+
results.push({ ...check, action: check.state === "installed" ? "kept" : "skipped" });
|
|
82
|
+
continue;
|
|
83
|
+
}
|
|
84
|
+
if (opts.dryRun) {
|
|
85
|
+
results.push({ ...check, action: source.dir ? "copied" : "downloaded" });
|
|
86
|
+
continue;
|
|
87
|
+
}
|
|
88
|
+
const { buf, downloaded } = await bytesOf(source, check, opts.fetch ?? fetch);
|
|
89
|
+
if (sha256(buf) !== check.sha256)
|
|
90
|
+
throw new Error(`${check.file}: checksum mismatch, nothing written for it`);
|
|
91
|
+
mkdirSync(opts.dir, { recursive: true });
|
|
92
|
+
opts.journal?.save(check.target);
|
|
93
|
+
const tmp = `${check.target}.${process.pid}.tmp`;
|
|
94
|
+
writeFileSync(tmp, buf, { mode: 0o644 });
|
|
95
|
+
renameSync(tmp, check.target);
|
|
96
|
+
opts.journal?.settle(check.target);
|
|
97
|
+
results.push({ ...check, action: downloaded ? "downloaded" : "copied" });
|
|
98
|
+
}
|
|
99
|
+
const wrote = results.some((r) => r.action === "copied" || r.action === "downloaded");
|
|
100
|
+
if (wrote && !opts.dryRun && (opts.platform ?? process.platform) === "linux") {
|
|
101
|
+
const fc = findOnPath("fc-cache", opts.env ?? process.env);
|
|
102
|
+
if (fc)
|
|
103
|
+
execFileSync(fc, ["-f", opts.dir], { stdio: "ignore" });
|
|
104
|
+
}
|
|
105
|
+
return results;
|
|
106
|
+
}
|
|
107
|
+
//# sourceMappingURL=fonts.js.map
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { existsSync, readFileSync, realpathSync } from "node:fs";
|
|
2
|
+
/** Refresh every 30 s so reset countdowns and the clock-driven parts stay current. */
|
|
3
|
+
export const REFRESH_SECONDS = 30;
|
|
4
|
+
function real(p) {
|
|
5
|
+
try {
|
|
6
|
+
return realpathSync(p);
|
|
7
|
+
}
|
|
8
|
+
catch {
|
|
9
|
+
return p;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
export function readSettings(file) {
|
|
13
|
+
if (!existsSync(file))
|
|
14
|
+
return {};
|
|
15
|
+
return JSON.parse(readFileSync(file, "utf8"));
|
|
16
|
+
}
|
|
17
|
+
export function currentStatusLine(file) {
|
|
18
|
+
try {
|
|
19
|
+
const s = readSettings(file).statusLine;
|
|
20
|
+
return s && typeof s === "object" ? s : undefined;
|
|
21
|
+
}
|
|
22
|
+
catch {
|
|
23
|
+
return undefined;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
/** Whether a status line command runs turno's. */
|
|
27
|
+
export function isTurnoStatusLine(s) {
|
|
28
|
+
return Boolean(s && /(^|[\s/])turno statusline(\s|$)/.test(s.command));
|
|
29
|
+
}
|
|
30
|
+
/** The entry to write: our command, keeping any other keys the user set (padding, ...). */
|
|
31
|
+
export function wantedStatusLine(command, existing) {
|
|
32
|
+
return { ...(existing ?? {}), type: "command", command, refreshInterval: existing?.refreshInterval ?? REFRESH_SECONDS };
|
|
33
|
+
}
|
|
34
|
+
export function setStatusLine(file, command, journal) {
|
|
35
|
+
const settings = readSettings(file);
|
|
36
|
+
const before = settings.statusLine;
|
|
37
|
+
const after = wantedStatusLine(command, before);
|
|
38
|
+
const changed = JSON.stringify(before) !== JSON.stringify(after);
|
|
39
|
+
const result = { file: real(file), changed, after, ...(before ? { before } : {}) };
|
|
40
|
+
if (changed)
|
|
41
|
+
journal.write(file, `${JSON.stringify({ ...settings, statusLine: after }, null, 2)}\n`);
|
|
42
|
+
return result;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Set the top-level `nerd_terminals` array of config.toml, keeping comments and tables: the
|
|
46
|
+
* line is replaced in place, or added before the first table.
|
|
47
|
+
*/
|
|
48
|
+
export function withNerdTerminals(text, ids) {
|
|
49
|
+
const line = `nerd_terminals = [${ids.map((i) => JSON.stringify(i)).join(", ")}]`;
|
|
50
|
+
const lines = text.split("\n");
|
|
51
|
+
const firstTable = lines.findIndex((l) => /^\s*\[/.test(l));
|
|
52
|
+
const top = firstTable < 0 ? lines.length : firstTable;
|
|
53
|
+
for (let i = 0; i < top; i++) {
|
|
54
|
+
if (/^\s*nerd_terminals\s*=/.test(lines[i])) {
|
|
55
|
+
lines[i] = line;
|
|
56
|
+
return lines.join("\n");
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
if (firstTable < 0) {
|
|
60
|
+
const body = text.length === 0 || text.endsWith("\n") ? text : `${text}\n`;
|
|
61
|
+
return `${body}${line}\n`;
|
|
62
|
+
}
|
|
63
|
+
let at = firstTable;
|
|
64
|
+
while (at > 0 && lines[at - 1].trim() === "")
|
|
65
|
+
at--;
|
|
66
|
+
lines.splice(at, 0, line);
|
|
67
|
+
return lines.join("\n");
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=settings.js.map
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
const BY_PROGRAM = {
|
|
2
|
+
WarpTerminal: "warp",
|
|
3
|
+
"iTerm.app": "iterm2",
|
|
4
|
+
Apple_Terminal: "apple-terminal",
|
|
5
|
+
ghostty: "ghostty",
|
|
6
|
+
WezTerm: "wezterm",
|
|
7
|
+
Orca: "orca",
|
|
8
|
+
};
|
|
9
|
+
/** Terminals that draw Nerd Font icons whatever font is set: they ship the symbols. */
|
|
10
|
+
export const BUILTIN_SYMBOLS = new Set(["ghostty", "wezterm", "kitty", "orca"]);
|
|
11
|
+
export function currentTerminal(env) {
|
|
12
|
+
const program = env.TERM_PROGRAM ?? "";
|
|
13
|
+
if (program === "vscode") {
|
|
14
|
+
const cursor = Boolean(env.CURSOR_TRACE_ID) || (env.__CFBundleIdentifier ?? "").startsWith("com.todesktop.");
|
|
15
|
+
return cursor ? "cursor" : "vscode";
|
|
16
|
+
}
|
|
17
|
+
if (BY_PROGRAM[program])
|
|
18
|
+
return BY_PROGRAM[program];
|
|
19
|
+
if (env.KITTY_WINDOW_ID || env.TERM === "xterm-kitty")
|
|
20
|
+
return "kitty";
|
|
21
|
+
if (env.ALACRITTY_WINDOW_ID || env.ALACRITTY_SOCKET)
|
|
22
|
+
return "alacritty";
|
|
23
|
+
return undefined;
|
|
24
|
+
}
|
|
25
|
+
/** Whether `auto` icons should be Nerd Font icons in this terminal. */
|
|
26
|
+
export function nerdHere(env, nerdTerminals) {
|
|
27
|
+
const id = currentTerminal(env);
|
|
28
|
+
return id !== undefined && (BUILTIN_SYMBOLS.has(id) || nerdTerminals.includes(id));
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=terminal-id.js.map
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { BUILTIN_SYMBOLS } from "./terminal-id.js";
|
|
4
|
+
const home = (env) => env.HOME ?? "";
|
|
5
|
+
const xdg = (env) => env.XDG_CONFIG_HOME || join(home(env), ".config");
|
|
6
|
+
/** A Nerd Font family name: patched fonts carry "NF" or "Nerd Font" in the name. */
|
|
7
|
+
export function isNerdFamily(family) {
|
|
8
|
+
return Boolean(family && /(\bNF\b|\bNFM\b|\bNFP\b|Nerd Font)/i.test(family));
|
|
9
|
+
}
|
|
10
|
+
// TOML: set or read one key inside one [section], keeping the rest of the file as written.
|
|
11
|
+
function tomlSection(lines, section) {
|
|
12
|
+
const header = lines.findIndex((l) => l.trim() === `[${section}]`);
|
|
13
|
+
if (header < 0)
|
|
14
|
+
return undefined;
|
|
15
|
+
let end = header + 1;
|
|
16
|
+
while (end < lines.length && !/^\s*\[/.test(lines[end]))
|
|
17
|
+
end++;
|
|
18
|
+
return [header, end];
|
|
19
|
+
}
|
|
20
|
+
export function tomlGet(text, section, key) {
|
|
21
|
+
const lines = text.split("\n");
|
|
22
|
+
const range = tomlSection(lines, section);
|
|
23
|
+
if (!range)
|
|
24
|
+
return undefined;
|
|
25
|
+
const re = new RegExp(`^\\s*${key}\\s*=\\s*"((?:[^"\\\\]|\\\\.)*)"`);
|
|
26
|
+
for (let i = range[0] + 1; i < range[1]; i++) {
|
|
27
|
+
const m = re.exec(lines[i]);
|
|
28
|
+
if (m)
|
|
29
|
+
return JSON.parse(`"${m[1]}"`);
|
|
30
|
+
}
|
|
31
|
+
return undefined;
|
|
32
|
+
}
|
|
33
|
+
export function tomlSet(text, section, key, value) {
|
|
34
|
+
const lines = text.split("\n");
|
|
35
|
+
const entry = `${key} = ${JSON.stringify(value)}`;
|
|
36
|
+
const range = tomlSection(lines, section);
|
|
37
|
+
if (!range) {
|
|
38
|
+
const body = text.length === 0 || text.endsWith("\n") ? text : `${text}\n`;
|
|
39
|
+
return `${body}${body.trim() ? "\n" : ""}[${section}]\n${entry}\n`;
|
|
40
|
+
}
|
|
41
|
+
const re = new RegExp(`^\\s*${key}\\s*=`);
|
|
42
|
+
for (let i = range[0] + 1; i < range[1]; i++) {
|
|
43
|
+
if (re.test(lines[i])) {
|
|
44
|
+
lines[i] = entry;
|
|
45
|
+
return lines.join("\n");
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
// After the section's last non-blank line.
|
|
49
|
+
let at = range[1];
|
|
50
|
+
while (at > range[0] + 1 && lines[at - 1].trim() === "")
|
|
51
|
+
at--;
|
|
52
|
+
lines.splice(at, 0, entry);
|
|
53
|
+
return lines.join("\n");
|
|
54
|
+
}
|
|
55
|
+
// JSONC (VS Code, Cursor): replace a top-level string value in place, or add it after "{".
|
|
56
|
+
const jsonKey = (key) => new RegExp(`("${key.replace(/\./g, "\\.")}"\\s*:\\s*)"((?:[^"\\\\]|\\\\.)*)"`);
|
|
57
|
+
export function jsoncGet(text, key) {
|
|
58
|
+
const m = jsonKey(key).exec(text);
|
|
59
|
+
return m ? JSON.parse(`"${m[2]}"`) : undefined;
|
|
60
|
+
}
|
|
61
|
+
export function jsoncSet(text, key, value) {
|
|
62
|
+
const re = jsonKey(key);
|
|
63
|
+
if (re.test(text))
|
|
64
|
+
return text.replace(re, (_all, head) => `${head}${JSON.stringify(value)}`);
|
|
65
|
+
const open = text.indexOf("{");
|
|
66
|
+
if (open < 0)
|
|
67
|
+
return `{\n ${JSON.stringify(key)}: ${JSON.stringify(value)}\n}\n`;
|
|
68
|
+
const rest = text.slice(open + 1);
|
|
69
|
+
const empty = rest.trim().startsWith("}");
|
|
70
|
+
return `${text.slice(0, open + 1)}\n ${JSON.stringify(key)}: ${JSON.stringify(value)}${empty ? "" : ","}${rest}`;
|
|
71
|
+
}
|
|
72
|
+
const VSCODE_KEY = "terminal.integrated.fontFamily";
|
|
73
|
+
function editorSettings(app, linuxDir) {
|
|
74
|
+
return (env, platform) => platform === "darwin"
|
|
75
|
+
? join(home(env), "Library", "Application Support", app, "User", "settings.json")
|
|
76
|
+
: join(xdg(env), linuxDir, "User", "settings.json");
|
|
77
|
+
}
|
|
78
|
+
export const TERMINALS = [
|
|
79
|
+
{
|
|
80
|
+
id: "warp",
|
|
81
|
+
name: "Warp",
|
|
82
|
+
symbols: false,
|
|
83
|
+
config: (env) => join(home(env), ".warp", "settings.toml"),
|
|
84
|
+
read: (t) => tomlGet(t, "appearance.text", "font_name"),
|
|
85
|
+
write: (t, f) => tomlSet(t, "appearance.text", "font_name", f),
|
|
86
|
+
app: "Warp.app",
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
id: "vscode",
|
|
90
|
+
name: "VS Code",
|
|
91
|
+
symbols: false,
|
|
92
|
+
config: editorSettings("Code", "Code"),
|
|
93
|
+
read: (t) => jsoncGet(t, VSCODE_KEY),
|
|
94
|
+
write: (t, f) => jsoncSet(t, VSCODE_KEY, f),
|
|
95
|
+
app: "Visual Studio Code.app",
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
id: "cursor",
|
|
99
|
+
name: "Cursor",
|
|
100
|
+
symbols: false,
|
|
101
|
+
config: editorSettings("Cursor", "Cursor"),
|
|
102
|
+
read: (t) => jsoncGet(t, VSCODE_KEY),
|
|
103
|
+
write: (t, f) => jsoncSet(t, VSCODE_KEY, f),
|
|
104
|
+
app: "Cursor.app",
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
id: "alacritty",
|
|
108
|
+
name: "Alacritty",
|
|
109
|
+
symbols: false,
|
|
110
|
+
config: (env) => join(xdg(env), "alacritty", "alacritty.toml"),
|
|
111
|
+
read: (t) => tomlGet(t, "font.normal", "family"),
|
|
112
|
+
write: (t, f) => tomlSet(t, "font.normal", "family", f),
|
|
113
|
+
app: "Alacritty.app",
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
id: "iterm2",
|
|
117
|
+
name: "iTerm2",
|
|
118
|
+
symbols: false,
|
|
119
|
+
manual: "Settings > Profiles > Text > Font: MesloLGS Nerd Font (iTerm2 rewrites its own preferences, so turno leaves them alone)",
|
|
120
|
+
app: "iTerm.app",
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
id: "apple-terminal",
|
|
124
|
+
name: "Terminal",
|
|
125
|
+
symbols: false,
|
|
126
|
+
manual: "Settings > Profiles > Text > Font > Change: MesloLGS Nerd Font",
|
|
127
|
+
},
|
|
128
|
+
{ id: "ghostty", name: "Ghostty", symbols: true, app: "Ghostty.app" },
|
|
129
|
+
{ id: "wezterm", name: "WezTerm", symbols: true, app: "WezTerm.app" },
|
|
130
|
+
{ id: "kitty", name: "kitty", symbols: true, app: "kitty.app" },
|
|
131
|
+
{ id: "orca", name: "Orca", symbols: true },
|
|
132
|
+
];
|
|
133
|
+
for (const t of TERMINALS)
|
|
134
|
+
if (t.symbols !== BUILTIN_SYMBOLS.has(t.id))
|
|
135
|
+
throw new Error(`terminal table out of sync: ${t.id}`);
|
|
136
|
+
export function terminal(id) {
|
|
137
|
+
return TERMINALS.find((t) => t.id === id);
|
|
138
|
+
}
|
|
139
|
+
/** Whether a terminal seems installed: its config file or its app bundle exists. */
|
|
140
|
+
export function installed(t, env, platform) {
|
|
141
|
+
if (t.config && existsSync(t.config(env, platform)))
|
|
142
|
+
return true;
|
|
143
|
+
const apps = env.TURNO_APPS_DIR || "/Applications";
|
|
144
|
+
return platform === "darwin" && t.app !== undefined && existsSync(join(apps, t.app));
|
|
145
|
+
}
|
|
146
|
+
export function fontOf(t, env, platform) {
|
|
147
|
+
if (!t.config || !t.read)
|
|
148
|
+
return undefined;
|
|
149
|
+
const file = t.config(env, platform);
|
|
150
|
+
if (!existsSync(file))
|
|
151
|
+
return undefined;
|
|
152
|
+
try {
|
|
153
|
+
return t.read(readFileSync(file, "utf8"));
|
|
154
|
+
}
|
|
155
|
+
catch {
|
|
156
|
+
return undefined;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
/** Terminals that need a Nerd Font and have one set in their config file. */
|
|
160
|
+
export function detectNerdTerminals(env, platform = process.platform) {
|
|
161
|
+
return TERMINALS.filter((t) => !t.symbols && isNerdFamily(fontOf(t, env, platform))).map((t) => t.id);
|
|
162
|
+
}
|
|
163
|
+
//# sourceMappingURL=terminals.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,72 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "turno-cli",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "One MCP gateway and per-folder accounts for Claude Code, Codex, Copilot CLI and Cursor CLI.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"claude-code",
|
|
7
|
+
"codex",
|
|
8
|
+
"copilot",
|
|
9
|
+
"cursor",
|
|
10
|
+
"mcp",
|
|
11
|
+
"model-context-protocol",
|
|
12
|
+
"mcp-gateway",
|
|
13
|
+
"ai-agents",
|
|
14
|
+
"coding-agents",
|
|
15
|
+
"cli",
|
|
16
|
+
"statusline",
|
|
17
|
+
"profiles",
|
|
18
|
+
"developer-tools"
|
|
19
|
+
],
|
|
20
|
+
"license": "Apache-2.0",
|
|
21
|
+
"author": "William Frank Monroy Mamani (https://github.com/william-monroy)",
|
|
22
|
+
"homepage": "https://github.com/wimo-dev/turno#readme",
|
|
23
|
+
"repository": {
|
|
24
|
+
"type": "git",
|
|
25
|
+
"url": "git+https://github.com/wimo-dev/turno.git",
|
|
26
|
+
"directory": "packages/turno"
|
|
27
|
+
},
|
|
28
|
+
"bugs": {
|
|
29
|
+
"url": "https://github.com/wimo-dev/turno/issues"
|
|
30
|
+
},
|
|
31
|
+
"type": "module",
|
|
32
|
+
"engines": {
|
|
33
|
+
"node": ">=22.11"
|
|
34
|
+
},
|
|
35
|
+
"bin": {
|
|
36
|
+
"turno": "dist/cli/main.js"
|
|
37
|
+
},
|
|
38
|
+
"files": [
|
|
39
|
+
"dist",
|
|
40
|
+
"!dist/**/*.map",
|
|
41
|
+
"CHANGELOG.md",
|
|
42
|
+
"README.md",
|
|
43
|
+
"LICENSE",
|
|
44
|
+
"NOTICE"
|
|
45
|
+
],
|
|
46
|
+
"dependencies": {
|
|
47
|
+
"@modelcontextprotocol/sdk": "1.32.2",
|
|
48
|
+
"smol-toml": "1.9.1"
|
|
49
|
+
},
|
|
50
|
+
"optionalDependencies": {
|
|
51
|
+
"turno-browser": "^0.1.1",
|
|
52
|
+
"turno-fonts": "^0.1.1"
|
|
53
|
+
},
|
|
54
|
+
"devDependencies": {
|
|
55
|
+
"@types/node": "^26.6.6",
|
|
56
|
+
"typescript": "^7.0.2",
|
|
57
|
+
"vitest": "^5.1.0"
|
|
58
|
+
},
|
|
59
|
+
"os": [
|
|
60
|
+
"darwin",
|
|
61
|
+
"linux"
|
|
62
|
+
],
|
|
63
|
+
"publishConfig": {
|
|
64
|
+
"access": "public",
|
|
65
|
+
"provenance": true
|
|
66
|
+
},
|
|
67
|
+
"scripts": {
|
|
68
|
+
"build": "rm -rf dist && tsc -p tsconfig.build.json && chmod +x dist/cli/main.js",
|
|
69
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
70
|
+
"test": "vitest run"
|
|
71
|
+
}
|
|
6
72
|
}
|