terminal-pilot 0.0.7 → 0.0.8
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 +52 -105
- package/dist/cli.js.map +4 -4
- package/dist/commands/close-session.js +19 -83
- package/dist/commands/close-session.js.map +3 -3
- package/dist/commands/create-session.js +19 -83
- package/dist/commands/create-session.js.map +3 -3
- package/dist/commands/fill.js +19 -83
- package/dist/commands/fill.js.map +3 -3
- package/dist/commands/get-session.js +19 -83
- package/dist/commands/get-session.js.map +3 -3
- package/dist/commands/index.js +27 -94
- package/dist/commands/index.js.map +4 -4
- package/dist/commands/install.js +2 -5
- package/dist/commands/install.js.map +4 -4
- package/dist/commands/installer.js +2 -5
- package/dist/commands/installer.js.map +4 -4
- package/dist/commands/list-sessions.js +19 -83
- package/dist/commands/list-sessions.js.map +3 -3
- package/dist/commands/press-key.js +19 -83
- package/dist/commands/press-key.js.map +3 -3
- package/dist/commands/read-history.js +19 -83
- package/dist/commands/read-history.js.map +3 -3
- package/dist/commands/read-screen.js +19 -83
- package/dist/commands/read-screen.js.map +3 -3
- package/dist/commands/resize.js +19 -83
- package/dist/commands/resize.js.map +3 -3
- package/dist/commands/runtime.js +19 -83
- package/dist/commands/runtime.js.map +3 -3
- package/dist/commands/screenshot.js +19 -83
- package/dist/commands/screenshot.js.map +3 -3
- package/dist/commands/send-signal.js +19 -83
- package/dist/commands/send-signal.js.map +3 -3
- package/dist/commands/type.js +19 -83
- package/dist/commands/type.js.map +3 -3
- package/dist/commands/uninstall.js +1 -4
- package/dist/commands/uninstall.js.map +4 -4
- package/dist/commands/wait-for-exit.js +19 -83
- package/dist/commands/wait-for-exit.js.map +3 -3
- package/dist/commands/wait-for.js +19 -83
- package/dist/commands/wait-for.js.map +3 -3
- package/dist/index.js +19 -83
- package/dist/index.js.map +3 -3
- package/dist/terminal-pilot.js +19 -83
- package/dist/terminal-pilot.js.map +3 -3
- package/dist/terminal-session.js +19 -83
- package/dist/terminal-session.js.map +3 -3
- package/dist/testing/cli-repl.js +52 -105
- package/dist/testing/cli-repl.js.map +4 -4
- package/dist/testing/qa-cli.js +52 -105
- package/dist/testing/qa-cli.js.map +4 -4
- package/package.json +1 -1
package/dist/testing/qa-cli.js
CHANGED
|
@@ -1734,8 +1734,8 @@ function findVisibleChild(group, token, scope) {
|
|
|
1734
1734
|
(child) => child.name === token || child.aliases.includes(token)
|
|
1735
1735
|
);
|
|
1736
1736
|
}
|
|
1737
|
-
function resolveHelpTarget(root, argv, scope) {
|
|
1738
|
-
const breadcrumb = [root.name];
|
|
1737
|
+
function resolveHelpTarget(root, argv, scope, rootDisplayName) {
|
|
1738
|
+
const breadcrumb = [rootDisplayName ?? root.name];
|
|
1739
1739
|
let current = root;
|
|
1740
1740
|
for (const token of argv.slice(2)) {
|
|
1741
1741
|
if (token.startsWith("-") || token === "help") {
|
|
@@ -1826,7 +1826,7 @@ function formatCommandRows(group, scope) {
|
|
|
1826
1826
|
function formatGlobalOptionRows(showVersion) {
|
|
1827
1827
|
const rows = [
|
|
1828
1828
|
{
|
|
1829
|
-
flags: "--preset",
|
|
1829
|
+
flags: "--preset <path>",
|
|
1830
1830
|
description: "Load parameter defaults from a JSON file"
|
|
1831
1831
|
},
|
|
1832
1832
|
{
|
|
@@ -1834,11 +1834,11 @@ function formatGlobalOptionRows(showVersion) {
|
|
|
1834
1834
|
description: "Accept defaults, skip prompts"
|
|
1835
1835
|
},
|
|
1836
1836
|
{
|
|
1837
|
-
flags: "--output",
|
|
1837
|
+
flags: "--output <format>",
|
|
1838
1838
|
description: "Output format (rich, md, json)"
|
|
1839
1839
|
},
|
|
1840
1840
|
{
|
|
1841
|
-
flags: "--help",
|
|
1841
|
+
flags: "-h, --help",
|
|
1842
1842
|
description: "Show help"
|
|
1843
1843
|
}
|
|
1844
1844
|
];
|
|
@@ -1853,7 +1853,14 @@ function formatGlobalOptionRows(showVersion) {
|
|
|
1853
1853
|
function renderHelpSections(sections) {
|
|
1854
1854
|
return sections.filter((section) => section.length > 0).join("\n\n");
|
|
1855
1855
|
}
|
|
1856
|
-
function
|
|
1856
|
+
function buildUsageLine(breadcrumb, rootUsageName, suffix) {
|
|
1857
|
+
if (rootUsageName === void 0) {
|
|
1858
|
+
return void 0;
|
|
1859
|
+
}
|
|
1860
|
+
const subPath = breadcrumb.slice(1).join(" ");
|
|
1861
|
+
return subPath ? `${rootUsageName} ${subPath} ${suffix}` : `${rootUsageName} ${suffix}`;
|
|
1862
|
+
}
|
|
1863
|
+
function renderGroupHelp(group, breadcrumb, scope, showVersion, rootUsageName) {
|
|
1857
1864
|
const sections = [];
|
|
1858
1865
|
const commandRows = formatCommandRows(group, scope);
|
|
1859
1866
|
if (commandRows.length > 0) {
|
|
@@ -1864,12 +1871,13 @@ ${formatCommandList(commandRows)}`);
|
|
|
1864
1871
|
${formatOptionList(formatGlobalOptionRows(showVersion))}`);
|
|
1865
1872
|
return renderHelpDocument({
|
|
1866
1873
|
breadcrumb,
|
|
1874
|
+
usageLine: buildUsageLine(breadcrumb, rootUsageName, "[options] [command]"),
|
|
1867
1875
|
description: group.description,
|
|
1868
1876
|
requiresAuth: group.requires?.auth === true,
|
|
1869
1877
|
sections
|
|
1870
1878
|
});
|
|
1871
1879
|
}
|
|
1872
|
-
function renderLeafHelp(command, breadcrumb, casing) {
|
|
1880
|
+
function renderLeafHelp(command, breadcrumb, casing, rootUsageName) {
|
|
1873
1881
|
const sections = [];
|
|
1874
1882
|
const fields = assignPositionals(collectFields(command.params, casing), command.positional);
|
|
1875
1883
|
const optionRows = fields.map((field) => ({
|
|
@@ -1887,8 +1895,11 @@ ${formatOptionList(formatGlobalOptionRows(false))}`);
|
|
|
1887
1895
|
sections.push(`${text.section("Secrets (via environment):")}
|
|
1888
1896
|
${formatOptionList(secretRows)}`);
|
|
1889
1897
|
}
|
|
1898
|
+
const positionalFields = fields.filter((f) => f.positionalIndex !== void 0);
|
|
1899
|
+
const usageSuffix = positionalFields.length > 0 ? `[options] ${positionalFields.map(formatPositionalToken).join(" ")}` : "[options]";
|
|
1890
1900
|
return renderHelpDocument({
|
|
1891
1901
|
breadcrumb,
|
|
1902
|
+
usageLine: buildUsageLine(breadcrumb, rootUsageName, usageSuffix),
|
|
1892
1903
|
description: command.description,
|
|
1893
1904
|
requiresAuth: command.requires?.auth === true,
|
|
1894
1905
|
sections
|
|
@@ -1896,11 +1907,14 @@ ${formatOptionList(secretRows)}`);
|
|
|
1896
1907
|
}
|
|
1897
1908
|
function renderHelpDocument(input) {
|
|
1898
1909
|
const lines = [text.heading(input.breadcrumb.join(" ")), ""];
|
|
1910
|
+
if (input.usageLine !== void 0) {
|
|
1911
|
+
lines.push(`${text.section("Usage:")} ${text.usageCommand(input.usageLine)}`, "");
|
|
1912
|
+
}
|
|
1899
1913
|
if (input.description !== void 0) {
|
|
1900
|
-
lines.push(
|
|
1914
|
+
lines.push(input.description);
|
|
1901
1915
|
}
|
|
1902
1916
|
if (input.requiresAuth) {
|
|
1903
|
-
lines.push("
|
|
1917
|
+
lines.push("Requires: authentication");
|
|
1904
1918
|
}
|
|
1905
1919
|
if (input.description !== void 0 || input.requiresAuth) {
|
|
1906
1920
|
lines.push("");
|
|
@@ -1910,11 +1924,11 @@ function renderHelpDocument(input) {
|
|
|
1910
1924
|
`;
|
|
1911
1925
|
}
|
|
1912
1926
|
async function renderGeneratedHelp(root, argv, options) {
|
|
1913
|
-
const target = resolveHelpTarget(root, argv, "cli");
|
|
1927
|
+
const target = resolveHelpTarget(root, argv, "cli", options.rootDisplayName);
|
|
1914
1928
|
const output = resolveHelpOutput(argv);
|
|
1915
1929
|
const casing = options.casing ?? "kebab";
|
|
1916
1930
|
await withOutputFormat2(output, async () => {
|
|
1917
|
-
const rendered = target.node.kind === "group" ? renderGroupHelp(target.node, target.breadcrumb, "cli", options.version !== void 0) : renderLeafHelp(target.node, target.breadcrumb, casing);
|
|
1931
|
+
const rendered = target.node.kind === "group" ? renderGroupHelp(target.node, target.breadcrumb, "cli", options.version !== void 0, options.rootUsageName) : renderLeafHelp(target.node, target.breadcrumb, casing, options.rootUsageName);
|
|
1918
1932
|
process.stdout.write(rendered);
|
|
1919
1933
|
});
|
|
1920
1934
|
}
|
|
@@ -2684,8 +2698,10 @@ async function runCLI(roots, options = {}) {
|
|
|
2684
2698
|
import { randomUUID } from "node:crypto";
|
|
2685
2699
|
|
|
2686
2700
|
// src/terminal-session.ts
|
|
2687
|
-
import { spawn as spawnChildProcess } from "node:child_process";
|
|
2688
2701
|
import { EventEmitter } from "node:events";
|
|
2702
|
+
import { accessSync, chmodSync, constants } from "node:fs";
|
|
2703
|
+
import { createRequire } from "node:module";
|
|
2704
|
+
import { dirname, join } from "node:path";
|
|
2689
2705
|
import * as nodePty from "node-pty";
|
|
2690
2706
|
|
|
2691
2707
|
// src/terminal-buffer.ts
|
|
@@ -3523,93 +3539,27 @@ function createPtyProcess({
|
|
|
3523
3539
|
cols,
|
|
3524
3540
|
rows
|
|
3525
3541
|
}) {
|
|
3526
|
-
|
|
3527
|
-
|
|
3528
|
-
cwd,
|
|
3529
|
-
env,
|
|
3530
|
-
cols,
|
|
3531
|
-
rows,
|
|
3532
|
-
encoding: "utf8"
|
|
3533
|
-
});
|
|
3534
|
-
} catch {
|
|
3535
|
-
return createChildProcessFallback({ command, args, cwd, env });
|
|
3536
|
-
}
|
|
3537
|
-
}
|
|
3538
|
-
function createChildProcessFallback({
|
|
3539
|
-
command,
|
|
3540
|
-
args,
|
|
3541
|
-
cwd,
|
|
3542
|
-
env
|
|
3543
|
-
}) {
|
|
3544
|
-
const child = spawnChildProcess(command, args, {
|
|
3542
|
+
ensureSpawnHelperExecutable();
|
|
3543
|
+
return nodePty.spawn(command, args, {
|
|
3545
3544
|
cwd,
|
|
3546
3545
|
env,
|
|
3547
|
-
|
|
3546
|
+
cols,
|
|
3547
|
+
rows,
|
|
3548
|
+
encoding: "utf8"
|
|
3548
3549
|
});
|
|
3549
|
-
return new ChildProcessFallback(child);
|
|
3550
3550
|
}
|
|
3551
|
-
var
|
|
3552
|
-
|
|
3553
|
-
|
|
3554
|
-
|
|
3555
|
-
|
|
3556
|
-
|
|
3557
|
-
|
|
3558
|
-
|
|
3559
|
-
|
|
3560
|
-
|
|
3561
|
-
|
|
3562
|
-
child.stderr.on("data", this.handleData);
|
|
3563
|
-
child.on("exit", (exitCode, signal) => {
|
|
3564
|
-
this.exitEmitter.emit("exit", {
|
|
3565
|
-
exitCode: exitCode ?? signalToExitCode(signal),
|
|
3566
|
-
signal: void 0
|
|
3567
|
-
});
|
|
3568
|
-
});
|
|
3569
|
-
}
|
|
3570
|
-
write(data) {
|
|
3571
|
-
this.child.stdin.write(data);
|
|
3572
|
-
}
|
|
3573
|
-
resize() {
|
|
3574
|
-
}
|
|
3575
|
-
kill(signal) {
|
|
3576
|
-
this.child.kill(signal);
|
|
3577
|
-
}
|
|
3578
|
-
onData(listener) {
|
|
3579
|
-
this.dataEmitter.on("data", listener);
|
|
3580
|
-
return {
|
|
3581
|
-
dispose: () => {
|
|
3582
|
-
this.dataEmitter.off("data", listener);
|
|
3583
|
-
}
|
|
3584
|
-
};
|
|
3585
|
-
}
|
|
3586
|
-
onExit(listener) {
|
|
3587
|
-
this.exitEmitter.on("exit", listener);
|
|
3588
|
-
return {
|
|
3589
|
-
dispose: () => {
|
|
3590
|
-
this.exitEmitter.off("exit", listener);
|
|
3591
|
-
}
|
|
3592
|
-
};
|
|
3593
|
-
}
|
|
3594
|
-
handleData = (chunk) => {
|
|
3595
|
-
this.dataEmitter.emit("data", String(chunk));
|
|
3596
|
-
};
|
|
3597
|
-
};
|
|
3598
|
-
function signalToExitCode(signal) {
|
|
3599
|
-
if (signal === null) {
|
|
3600
|
-
return 0;
|
|
3601
|
-
}
|
|
3602
|
-
const signalNumbers = {
|
|
3603
|
-
SIGTERM: 15,
|
|
3604
|
-
SIGINT: 2,
|
|
3605
|
-
SIGHUP: 1,
|
|
3606
|
-
SIGKILL: 9
|
|
3607
|
-
};
|
|
3608
|
-
const signalNumber = signalNumbers[signal];
|
|
3609
|
-
if (signalNumber === void 0) {
|
|
3610
|
-
return 1;
|
|
3551
|
+
var spawnHelperChecked = false;
|
|
3552
|
+
function ensureSpawnHelperExecutable() {
|
|
3553
|
+
if (spawnHelperChecked) return;
|
|
3554
|
+
spawnHelperChecked = true;
|
|
3555
|
+
const require3 = createRequire(import.meta.url);
|
|
3556
|
+
const nodePtyDir = dirname(require3.resolve("node-pty"));
|
|
3557
|
+
const helper = join(nodePtyDir, "..", "prebuilds", `${process.platform}-${process.arch}`, "spawn-helper");
|
|
3558
|
+
try {
|
|
3559
|
+
accessSync(helper, constants.X_OK);
|
|
3560
|
+
} catch {
|
|
3561
|
+
chmodSync(helper, 493);
|
|
3611
3562
|
}
|
|
3612
|
-
return 128 + signalNumber;
|
|
3613
3563
|
}
|
|
3614
3564
|
function matchPattern(buffer, pattern) {
|
|
3615
3565
|
const clean = normalizeHistoryBuffer(stripAnsi(buffer));
|
|
@@ -4996,9 +4946,6 @@ async function executeMutation(mutation, context, options) {
|
|
|
4996
4946
|
import Mustache2 from "mustache";
|
|
4997
4947
|
var originalEscape = Mustache2.escape;
|
|
4998
4948
|
|
|
4999
|
-
// ../agent-skill-config/src/templates.ts
|
|
5000
|
-
import { readFile as readFile2 } from "node:fs/promises";
|
|
5001
|
-
|
|
5002
4949
|
// ../agent-skill-config/src/apply.ts
|
|
5003
4950
|
var UnsupportedAgentError = class extends Error {
|
|
5004
4951
|
constructor(agentId) {
|
|
@@ -5057,7 +5004,7 @@ async function installSkill(agentId, skill, options) {
|
|
|
5057
5004
|
import os2 from "node:os";
|
|
5058
5005
|
import path4 from "node:path";
|
|
5059
5006
|
import * as nodeFs from "node:fs/promises";
|
|
5060
|
-
import { readFile as
|
|
5007
|
+
import { readFile as readFile2 } from "node:fs/promises";
|
|
5061
5008
|
var DEFAULT_INSTALL_AGENT = "claude-code";
|
|
5062
5009
|
var DEFAULT_INSTALL_SCOPE = "local";
|
|
5063
5010
|
var TERMINAL_PILOT_SKILL_NAME = "terminal-pilot";
|
|
@@ -5107,7 +5054,7 @@ async function loadTerminalPilotTemplate() {
|
|
|
5107
5054
|
];
|
|
5108
5055
|
for (const candidate of candidates) {
|
|
5109
5056
|
try {
|
|
5110
|
-
terminalPilotTemplateCache = await
|
|
5057
|
+
terminalPilotTemplateCache = await readFile2(candidate, "utf8");
|
|
5111
5058
|
return terminalPilotTemplateCache;
|
|
5112
5059
|
} catch (error2) {
|
|
5113
5060
|
if (!isNotFoundError(error2)) {
|
|
@@ -5542,14 +5489,14 @@ import { Resvg } from "@resvg/resvg-js";
|
|
|
5542
5489
|
|
|
5543
5490
|
// ../terminal-png/src/font.ts
|
|
5544
5491
|
import { readFileSync } from "node:fs";
|
|
5545
|
-
import { createRequire } from "node:module";
|
|
5546
|
-
import { dirname, join } from "node:path";
|
|
5492
|
+
import { createRequire as createRequire2 } from "node:module";
|
|
5493
|
+
import { dirname as dirname2, join as join2 } from "node:path";
|
|
5547
5494
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
5548
|
-
var require2 =
|
|
5549
|
-
var fontPackageRoot =
|
|
5550
|
-
var webfontRoot =
|
|
5495
|
+
var require2 = createRequire2(import.meta.url);
|
|
5496
|
+
var fontPackageRoot = dirname2(require2.resolve("jetbrains-mono/package.json"));
|
|
5497
|
+
var webfontRoot = join2(fontPackageRoot, "fonts/webfonts");
|
|
5551
5498
|
function readWebfontBase64(filename) {
|
|
5552
|
-
return readFileSync(
|
|
5499
|
+
return readFileSync(join2(webfontRoot, filename)).toString("base64");
|
|
5553
5500
|
}
|
|
5554
5501
|
function resolveAssetPath(filename) {
|
|
5555
5502
|
return fileURLToPath2(new URL(`../assets/${filename}`, import.meta.url));
|