terminal-pilot 0.0.7 → 0.0.9
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 +66 -103
- package/dist/cli.js.map +4 -4
- package/dist/commands/close-session.js +33 -81
- package/dist/commands/close-session.js.map +3 -3
- package/dist/commands/create-session.js +33 -81
- package/dist/commands/create-session.js.map +3 -3
- package/dist/commands/fill.js +33 -81
- package/dist/commands/fill.js.map +3 -3
- package/dist/commands/get-session.js +33 -81
- package/dist/commands/get-session.js.map +3 -3
- package/dist/commands/index.js +41 -92
- 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 +33 -81
- package/dist/commands/list-sessions.js.map +3 -3
- package/dist/commands/press-key.js +33 -81
- package/dist/commands/press-key.js.map +3 -3
- package/dist/commands/read-history.js +33 -81
- package/dist/commands/read-history.js.map +3 -3
- package/dist/commands/read-screen.js +33 -81
- package/dist/commands/read-screen.js.map +3 -3
- package/dist/commands/resize.js +33 -81
- package/dist/commands/resize.js.map +3 -3
- package/dist/commands/runtime.js +33 -81
- package/dist/commands/runtime.js.map +3 -3
- package/dist/commands/screenshot.js +33 -81
- package/dist/commands/screenshot.js.map +3 -3
- package/dist/commands/send-signal.js +33 -81
- package/dist/commands/send-signal.js.map +3 -3
- package/dist/commands/type.js +33 -81
- 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 +33 -81
- package/dist/commands/wait-for-exit.js.map +3 -3
- package/dist/commands/wait-for.js +33 -81
- package/dist/commands/wait-for.js.map +3 -3
- package/dist/index.js +33 -81
- package/dist/index.js.map +3 -3
- package/dist/terminal-pilot.js +33 -81
- package/dist/terminal-pilot.js.map +3 -3
- package/dist/terminal-session.js +33 -81
- package/dist/terminal-session.js.map +3 -3
- package/dist/testing/cli-repl.js +66 -103
- package/dist/testing/cli-repl.js.map +4 -4
- package/dist/testing/qa-cli.js +66 -103
- package/dist/testing/qa-cli.js.map +4 -4
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1655,8 +1655,8 @@ function findVisibleChild(group, token, scope) {
|
|
|
1655
1655
|
(child) => child.name === token || child.aliases.includes(token)
|
|
1656
1656
|
);
|
|
1657
1657
|
}
|
|
1658
|
-
function resolveHelpTarget(root, argv, scope) {
|
|
1659
|
-
const breadcrumb = [root.name];
|
|
1658
|
+
function resolveHelpTarget(root, argv, scope, rootDisplayName) {
|
|
1659
|
+
const breadcrumb = [rootDisplayName ?? root.name];
|
|
1660
1660
|
let current = root;
|
|
1661
1661
|
for (const token of argv.slice(2)) {
|
|
1662
1662
|
if (token.startsWith("-") || token === "help") {
|
|
@@ -1747,7 +1747,7 @@ function formatCommandRows(group, scope) {
|
|
|
1747
1747
|
function formatGlobalOptionRows(showVersion) {
|
|
1748
1748
|
const rows = [
|
|
1749
1749
|
{
|
|
1750
|
-
flags: "--preset",
|
|
1750
|
+
flags: "--preset <path>",
|
|
1751
1751
|
description: "Load parameter defaults from a JSON file"
|
|
1752
1752
|
},
|
|
1753
1753
|
{
|
|
@@ -1755,11 +1755,11 @@ function formatGlobalOptionRows(showVersion) {
|
|
|
1755
1755
|
description: "Accept defaults, skip prompts"
|
|
1756
1756
|
},
|
|
1757
1757
|
{
|
|
1758
|
-
flags: "--output",
|
|
1758
|
+
flags: "--output <format>",
|
|
1759
1759
|
description: "Output format (rich, md, json)"
|
|
1760
1760
|
},
|
|
1761
1761
|
{
|
|
1762
|
-
flags: "--help",
|
|
1762
|
+
flags: "-h, --help",
|
|
1763
1763
|
description: "Show help"
|
|
1764
1764
|
}
|
|
1765
1765
|
];
|
|
@@ -1774,7 +1774,14 @@ function formatGlobalOptionRows(showVersion) {
|
|
|
1774
1774
|
function renderHelpSections(sections) {
|
|
1775
1775
|
return sections.filter((section) => section.length > 0).join("\n\n");
|
|
1776
1776
|
}
|
|
1777
|
-
function
|
|
1777
|
+
function buildUsageLine(breadcrumb, rootUsageName, suffix) {
|
|
1778
|
+
if (rootUsageName === void 0) {
|
|
1779
|
+
return void 0;
|
|
1780
|
+
}
|
|
1781
|
+
const subPath = breadcrumb.slice(1).join(" ");
|
|
1782
|
+
return subPath ? `${rootUsageName} ${subPath} ${suffix}` : `${rootUsageName} ${suffix}`;
|
|
1783
|
+
}
|
|
1784
|
+
function renderGroupHelp(group, breadcrumb, scope, showVersion, rootUsageName) {
|
|
1778
1785
|
const sections = [];
|
|
1779
1786
|
const commandRows = formatCommandRows(group, scope);
|
|
1780
1787
|
if (commandRows.length > 0) {
|
|
@@ -1785,12 +1792,13 @@ ${formatCommandList(commandRows)}`);
|
|
|
1785
1792
|
${formatOptionList(formatGlobalOptionRows(showVersion))}`);
|
|
1786
1793
|
return renderHelpDocument({
|
|
1787
1794
|
breadcrumb,
|
|
1795
|
+
usageLine: buildUsageLine(breadcrumb, rootUsageName, "[options] [command]"),
|
|
1788
1796
|
description: group.description,
|
|
1789
1797
|
requiresAuth: group.requires?.auth === true,
|
|
1790
1798
|
sections
|
|
1791
1799
|
});
|
|
1792
1800
|
}
|
|
1793
|
-
function renderLeafHelp(command, breadcrumb, casing) {
|
|
1801
|
+
function renderLeafHelp(command, breadcrumb, casing, rootUsageName) {
|
|
1794
1802
|
const sections = [];
|
|
1795
1803
|
const fields = assignPositionals(collectFields(command.params, casing), command.positional);
|
|
1796
1804
|
const optionRows = fields.map((field) => ({
|
|
@@ -1808,8 +1816,11 @@ ${formatOptionList(formatGlobalOptionRows(false))}`);
|
|
|
1808
1816
|
sections.push(`${text.section("Secrets (via environment):")}
|
|
1809
1817
|
${formatOptionList(secretRows)}`);
|
|
1810
1818
|
}
|
|
1819
|
+
const positionalFields = fields.filter((f) => f.positionalIndex !== void 0);
|
|
1820
|
+
const usageSuffix = positionalFields.length > 0 ? `[options] ${positionalFields.map(formatPositionalToken).join(" ")}` : "[options]";
|
|
1811
1821
|
return renderHelpDocument({
|
|
1812
1822
|
breadcrumb,
|
|
1823
|
+
usageLine: buildUsageLine(breadcrumb, rootUsageName, usageSuffix),
|
|
1813
1824
|
description: command.description,
|
|
1814
1825
|
requiresAuth: command.requires?.auth === true,
|
|
1815
1826
|
sections
|
|
@@ -1817,11 +1828,14 @@ ${formatOptionList(secretRows)}`);
|
|
|
1817
1828
|
}
|
|
1818
1829
|
function renderHelpDocument(input) {
|
|
1819
1830
|
const lines = [text.heading(input.breadcrumb.join(" ")), ""];
|
|
1831
|
+
if (input.usageLine !== void 0) {
|
|
1832
|
+
lines.push(`${text.section("Usage:")} ${text.usageCommand(input.usageLine)}`, "");
|
|
1833
|
+
}
|
|
1820
1834
|
if (input.description !== void 0) {
|
|
1821
|
-
lines.push(
|
|
1835
|
+
lines.push(input.description);
|
|
1822
1836
|
}
|
|
1823
1837
|
if (input.requiresAuth) {
|
|
1824
|
-
lines.push("
|
|
1838
|
+
lines.push("Requires: authentication");
|
|
1825
1839
|
}
|
|
1826
1840
|
if (input.description !== void 0 || input.requiresAuth) {
|
|
1827
1841
|
lines.push("");
|
|
@@ -1831,11 +1845,11 @@ function renderHelpDocument(input) {
|
|
|
1831
1845
|
`;
|
|
1832
1846
|
}
|
|
1833
1847
|
async function renderGeneratedHelp(root, argv, options) {
|
|
1834
|
-
const target = resolveHelpTarget(root, argv, "cli");
|
|
1848
|
+
const target = resolveHelpTarget(root, argv, "cli", options.rootDisplayName);
|
|
1835
1849
|
const output = resolveHelpOutput(argv);
|
|
1836
1850
|
const casing = options.casing ?? "kebab";
|
|
1837
1851
|
await withOutputFormat2(output, async () => {
|
|
1838
|
-
const rendered = target.node.kind === "group" ? renderGroupHelp(target.node, target.breadcrumb, "cli", options.version !== void 0) : renderLeafHelp(target.node, target.breadcrumb, casing);
|
|
1852
|
+
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);
|
|
1839
1853
|
process.stdout.write(rendered);
|
|
1840
1854
|
});
|
|
1841
1855
|
}
|
|
@@ -2605,8 +2619,10 @@ async function runCLI(roots, options = {}) {
|
|
|
2605
2619
|
import { randomUUID } from "node:crypto";
|
|
2606
2620
|
|
|
2607
2621
|
// src/terminal-session.ts
|
|
2608
|
-
import { spawn as spawnChildProcess } from "node:child_process";
|
|
2609
2622
|
import { EventEmitter } from "node:events";
|
|
2623
|
+
import { accessSync, chmodSync, constants } from "node:fs";
|
|
2624
|
+
import { createRequire } from "node:module";
|
|
2625
|
+
import { dirname, join } from "node:path";
|
|
2610
2626
|
import * as nodePty from "node-pty";
|
|
2611
2627
|
|
|
2612
2628
|
// src/ansi.ts
|
|
@@ -3517,93 +3533,43 @@ function createPtyProcess({
|
|
|
3517
3533
|
cols,
|
|
3518
3534
|
rows
|
|
3519
3535
|
}) {
|
|
3520
|
-
|
|
3521
|
-
|
|
3522
|
-
cwd,
|
|
3523
|
-
env,
|
|
3524
|
-
cols,
|
|
3525
|
-
rows,
|
|
3526
|
-
encoding: "utf8"
|
|
3527
|
-
});
|
|
3528
|
-
} catch {
|
|
3529
|
-
return createChildProcessFallback({ command, args, cwd, env });
|
|
3530
|
-
}
|
|
3531
|
-
}
|
|
3532
|
-
function createChildProcessFallback({
|
|
3533
|
-
command,
|
|
3534
|
-
args,
|
|
3535
|
-
cwd,
|
|
3536
|
-
env
|
|
3537
|
-
}) {
|
|
3538
|
-
const child = spawnChildProcess(command, args, {
|
|
3536
|
+
ensureSpawnHelperExecutable();
|
|
3537
|
+
return nodePty.spawn(command, args, {
|
|
3539
3538
|
cwd,
|
|
3540
3539
|
env,
|
|
3541
|
-
|
|
3540
|
+
cols,
|
|
3541
|
+
rows,
|
|
3542
|
+
encoding: "utf8"
|
|
3542
3543
|
});
|
|
3543
|
-
return new ChildProcessFallback(child);
|
|
3544
3544
|
}
|
|
3545
|
-
var
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
-
|
|
3551
|
-
|
|
3552
|
-
|
|
3553
|
-
|
|
3554
|
-
|
|
3555
|
-
|
|
3556
|
-
|
|
3557
|
-
|
|
3558
|
-
|
|
3559
|
-
|
|
3560
|
-
|
|
3561
|
-
|
|
3562
|
-
|
|
3563
|
-
}
|
|
3564
|
-
write(data) {
|
|
3565
|
-
this.child.stdin.write(data);
|
|
3566
|
-
}
|
|
3567
|
-
resize() {
|
|
3568
|
-
}
|
|
3569
|
-
kill(signal) {
|
|
3570
|
-
this.child.kill(signal);
|
|
3571
|
-
}
|
|
3572
|
-
onData(listener) {
|
|
3573
|
-
this.dataEmitter.on("data", listener);
|
|
3574
|
-
return {
|
|
3575
|
-
dispose: () => {
|
|
3576
|
-
this.dataEmitter.off("data", listener);
|
|
3577
|
-
}
|
|
3578
|
-
};
|
|
3579
|
-
}
|
|
3580
|
-
onExit(listener) {
|
|
3581
|
-
this.exitEmitter.on("exit", listener);
|
|
3582
|
-
return {
|
|
3583
|
-
dispose: () => {
|
|
3584
|
-
this.exitEmitter.off("exit", listener);
|
|
3545
|
+
var spawnHelperChecked = false;
|
|
3546
|
+
function ensureSpawnHelperExecutable() {
|
|
3547
|
+
if (spawnHelperChecked) return;
|
|
3548
|
+
spawnHelperChecked = true;
|
|
3549
|
+
const require3 = createRequire(import.meta.url);
|
|
3550
|
+
const nodePtyDir = dirname(require3.resolve("node-pty"));
|
|
3551
|
+
const helper = join(nodePtyDir, "..", "prebuilds", `${process.platform}-${process.arch}`, "spawn-helper");
|
|
3552
|
+
try {
|
|
3553
|
+
accessSync(helper, constants.X_OK);
|
|
3554
|
+
} catch (error2) {
|
|
3555
|
+
if (isMissingFileError(error2)) {
|
|
3556
|
+
return;
|
|
3557
|
+
}
|
|
3558
|
+
try {
|
|
3559
|
+
chmodSync(helper, 493);
|
|
3560
|
+
} catch (chmodError) {
|
|
3561
|
+
if (isMissingFileError(chmodError)) {
|
|
3562
|
+
return;
|
|
3585
3563
|
}
|
|
3586
|
-
|
|
3587
|
-
|
|
3588
|
-
handleData = (chunk) => {
|
|
3589
|
-
this.dataEmitter.emit("data", String(chunk));
|
|
3590
|
-
};
|
|
3591
|
-
};
|
|
3592
|
-
function signalToExitCode(signal) {
|
|
3593
|
-
if (signal === null) {
|
|
3594
|
-
return 0;
|
|
3564
|
+
throw chmodError;
|
|
3565
|
+
}
|
|
3595
3566
|
}
|
|
3596
|
-
|
|
3597
|
-
|
|
3598
|
-
|
|
3599
|
-
|
|
3600
|
-
SIGKILL: 9
|
|
3601
|
-
};
|
|
3602
|
-
const signalNumber = signalNumbers[signal];
|
|
3603
|
-
if (signalNumber === void 0) {
|
|
3604
|
-
return 1;
|
|
3567
|
+
}
|
|
3568
|
+
function isMissingFileError(error2) {
|
|
3569
|
+
if (!(error2 instanceof Error)) {
|
|
3570
|
+
return false;
|
|
3605
3571
|
}
|
|
3606
|
-
return
|
|
3572
|
+
return "code" in error2 && error2.code === "ENOENT";
|
|
3607
3573
|
}
|
|
3608
3574
|
function matchPattern(buffer, pattern) {
|
|
3609
3575
|
const clean = normalizeHistoryBuffer(stripAnsi2(buffer));
|
|
@@ -4983,9 +4949,6 @@ async function executeMutation(mutation, context, options) {
|
|
|
4983
4949
|
import Mustache2 from "mustache";
|
|
4984
4950
|
var originalEscape = Mustache2.escape;
|
|
4985
4951
|
|
|
4986
|
-
// ../agent-skill-config/src/templates.ts
|
|
4987
|
-
import { readFile as readFile2 } from "node:fs/promises";
|
|
4988
|
-
|
|
4989
4952
|
// ../agent-skill-config/src/apply.ts
|
|
4990
4953
|
var UnsupportedAgentError = class extends Error {
|
|
4991
4954
|
constructor(agentId) {
|
|
@@ -5044,7 +5007,7 @@ async function installSkill(agentId, skill, options) {
|
|
|
5044
5007
|
import os2 from "node:os";
|
|
5045
5008
|
import path4 from "node:path";
|
|
5046
5009
|
import * as nodeFs from "node:fs/promises";
|
|
5047
|
-
import { readFile as
|
|
5010
|
+
import { readFile as readFile2 } from "node:fs/promises";
|
|
5048
5011
|
var DEFAULT_INSTALL_AGENT = "claude-code";
|
|
5049
5012
|
var DEFAULT_INSTALL_SCOPE = "local";
|
|
5050
5013
|
var TERMINAL_PILOT_SKILL_NAME = "terminal-pilot";
|
|
@@ -5094,7 +5057,7 @@ async function loadTerminalPilotTemplate() {
|
|
|
5094
5057
|
];
|
|
5095
5058
|
for (const candidate of candidates) {
|
|
5096
5059
|
try {
|
|
5097
|
-
terminalPilotTemplateCache = await
|
|
5060
|
+
terminalPilotTemplateCache = await readFile2(candidate, "utf8");
|
|
5098
5061
|
return terminalPilotTemplateCache;
|
|
5099
5062
|
} catch (error2) {
|
|
5100
5063
|
if (!isNotFoundError(error2)) {
|
|
@@ -5529,14 +5492,14 @@ import { Resvg } from "@resvg/resvg-js";
|
|
|
5529
5492
|
|
|
5530
5493
|
// ../terminal-png/src/font.ts
|
|
5531
5494
|
import { readFileSync } from "node:fs";
|
|
5532
|
-
import { createRequire } from "node:module";
|
|
5533
|
-
import { dirname, join } from "node:path";
|
|
5495
|
+
import { createRequire as createRequire2 } from "node:module";
|
|
5496
|
+
import { dirname as dirname2, join as join2 } from "node:path";
|
|
5534
5497
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
5535
|
-
var require2 =
|
|
5536
|
-
var fontPackageRoot =
|
|
5537
|
-
var webfontRoot =
|
|
5498
|
+
var require2 = createRequire2(import.meta.url);
|
|
5499
|
+
var fontPackageRoot = dirname2(require2.resolve("jetbrains-mono/package.json"));
|
|
5500
|
+
var webfontRoot = join2(fontPackageRoot, "fonts/webfonts");
|
|
5538
5501
|
function readWebfontBase64(filename) {
|
|
5539
|
-
return readFileSync(
|
|
5502
|
+
return readFileSync(join2(webfontRoot, filename)).toString("base64");
|
|
5540
5503
|
}
|
|
5541
5504
|
function resolveAssetPath(filename) {
|
|
5542
5505
|
return fileURLToPath2(new URL(`../assets/${filename}`, import.meta.url));
|