terminal-pilot 0.0.11 → 0.0.13
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 +56 -46
- package/dist/cli.js.map +4 -4
- package/dist/commands/index.js +21 -16
- package/dist/commands/index.js.map +4 -4
- package/dist/commands/install.js +17 -12
- package/dist/commands/install.js.map +4 -4
- package/dist/commands/installer.js +12 -7
- package/dist/commands/installer.js.map +4 -4
- package/dist/commands/uninstall.js +11 -6
- package/dist/commands/uninstall.js.map +4 -4
- package/dist/testing/cli-repl.js +56 -46
- package/dist/testing/cli-repl.js.map +4 -4
- package/dist/testing/qa-cli.js +68 -58
- package/dist/testing/qa-cli.js.map +4 -4
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -83,8 +83,8 @@ var require_src = __commonJS({
|
|
|
83
83
|
|
|
84
84
|
// src/cli.ts
|
|
85
85
|
import { realpath } from "node:fs/promises";
|
|
86
|
-
import
|
|
87
|
-
import { fileURLToPath as
|
|
86
|
+
import path6 from "node:path";
|
|
87
|
+
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
88
88
|
|
|
89
89
|
// ../cmdkit/src/cli.ts
|
|
90
90
|
import { access, readFile, writeFile } from "node:fs/promises";
|
|
@@ -1439,11 +1439,11 @@ function formatSegment(segment, casing) {
|
|
|
1439
1439
|
const separator = casing === "snake" ? "_" : "-";
|
|
1440
1440
|
return splitWords(segment).join(separator);
|
|
1441
1441
|
}
|
|
1442
|
-
function toOptionFlag(
|
|
1443
|
-
return `--${
|
|
1442
|
+
function toOptionFlag(path7, casing) {
|
|
1443
|
+
return `--${path7.map((segment) => formatSegment(segment, casing)).join(".")}`;
|
|
1444
1444
|
}
|
|
1445
|
-
function toOptionAttribute(
|
|
1446
|
-
return
|
|
1445
|
+
function toOptionAttribute(path7, casing) {
|
|
1446
|
+
return path7.map((segment) => {
|
|
1447
1447
|
const formatted = formatSegment(segment, casing);
|
|
1448
1448
|
if (casing === "snake") {
|
|
1449
1449
|
return formatted;
|
|
@@ -1454,13 +1454,13 @@ function toOptionAttribute(path6, casing) {
|
|
|
1454
1454
|
).join("");
|
|
1455
1455
|
}).join(".");
|
|
1456
1456
|
}
|
|
1457
|
-
function toDisplayPath(
|
|
1458
|
-
return
|
|
1457
|
+
function toDisplayPath(path7) {
|
|
1458
|
+
return path7.join(".");
|
|
1459
1459
|
}
|
|
1460
|
-
function collectFields(schema, casing,
|
|
1460
|
+
function collectFields(schema, casing, path7 = [], inheritedOptional = false) {
|
|
1461
1461
|
const fields = [];
|
|
1462
1462
|
for (const [key, rawChildSchema] of Object.entries(schema.shape)) {
|
|
1463
|
-
const nextPath = [...
|
|
1463
|
+
const nextPath = [...path7, key];
|
|
1464
1464
|
const optional = inheritedOptional || rawChildSchema.kind === "optional";
|
|
1465
1465
|
const childSchema = unwrapOptional(rawChildSchema);
|
|
1466
1466
|
if (childSchema.kind === "object") {
|
|
@@ -1483,9 +1483,9 @@ function collectFields(schema, casing, path6 = [], inheritedOptional = false) {
|
|
|
1483
1483
|
}
|
|
1484
1484
|
return fields;
|
|
1485
1485
|
}
|
|
1486
|
-
function toCommanderOptionAttribute(
|
|
1487
|
-
const optionAttribute = toOptionAttribute(
|
|
1488
|
-
const optionFlag = toOptionFlag(
|
|
1486
|
+
function toCommanderOptionAttribute(path7, casing) {
|
|
1487
|
+
const optionAttribute = toOptionAttribute(path7, casing);
|
|
1488
|
+
const optionFlag = toOptionFlag(path7, casing);
|
|
1489
1489
|
if (!GLOBAL_LONG_OPTION_FLAGS.has(optionFlag)) {
|
|
1490
1490
|
return optionAttribute;
|
|
1491
1491
|
}
|
|
@@ -1613,8 +1613,13 @@ function createOption(field) {
|
|
|
1613
1613
|
if (collidesWithGlobalFlag) {
|
|
1614
1614
|
return [createCommanderOption(flags, field.description, field)];
|
|
1615
1615
|
}
|
|
1616
|
+
const mainOption = createCommanderOption(`${flags} [value]`, field.description, field);
|
|
1617
|
+
mainOption.preset(true);
|
|
1618
|
+
mainOption.argParser(
|
|
1619
|
+
(value) => typeof value === "boolean" ? value : parseBooleanText(value, field.displayPath)
|
|
1620
|
+
);
|
|
1616
1621
|
return [
|
|
1617
|
-
|
|
1622
|
+
mainOption,
|
|
1618
1623
|
createCommanderOption(`--no-${field.optionFlag.slice(2)}`, field.description, field)
|
|
1619
1624
|
];
|
|
1620
1625
|
}
|
|
@@ -1732,7 +1737,7 @@ function formatHelpFieldFlags(field) {
|
|
|
1732
1737
|
return formatPositionalToken(field);
|
|
1733
1738
|
}
|
|
1734
1739
|
if (field.schema.kind === "boolean") {
|
|
1735
|
-
return formatOptionFlags(field)
|
|
1740
|
+
return `${formatOptionFlags(field)} [value]`;
|
|
1736
1741
|
}
|
|
1737
1742
|
return `${formatOptionFlags(field)} <${describeSchemaType(field.schema)}>`;
|
|
1738
1743
|
}
|
|
@@ -1945,10 +1950,10 @@ function addGlobalOptions(command) {
|
|
|
1945
1950
|
throw new InvalidArgumentError('Invalid value for "--output". Expected one of: rich, md, markdown, json.');
|
|
1946
1951
|
}).option("--verbose", "Print stack traces for unexpected errors.");
|
|
1947
1952
|
}
|
|
1948
|
-
function setNestedValue(target,
|
|
1953
|
+
function setNestedValue(target, path7, value) {
|
|
1949
1954
|
let cursor = target;
|
|
1950
|
-
for (let index = 0; index <
|
|
1951
|
-
const segment =
|
|
1955
|
+
for (let index = 0; index < path7.length - 1; index += 1) {
|
|
1956
|
+
const segment = path7[index] ?? "";
|
|
1952
1957
|
const existing = cursor[segment];
|
|
1953
1958
|
if (typeof existing === "object" && existing !== null) {
|
|
1954
1959
|
cursor = existing;
|
|
@@ -1958,7 +1963,7 @@ function setNestedValue(target, path6, value) {
|
|
|
1958
1963
|
cursor[segment] = next;
|
|
1959
1964
|
cursor = next;
|
|
1960
1965
|
}
|
|
1961
|
-
const leaf =
|
|
1966
|
+
const leaf = path7[path7.length - 1];
|
|
1962
1967
|
if (leaf !== void 0) {
|
|
1963
1968
|
cursor[leaf] = value;
|
|
1964
1969
|
}
|
|
@@ -2054,13 +2059,13 @@ async function withOutputFormat2(output, fn) {
|
|
|
2054
2059
|
}
|
|
2055
2060
|
function createFs() {
|
|
2056
2061
|
return {
|
|
2057
|
-
readFile: async (
|
|
2058
|
-
writeFile: async (
|
|
2059
|
-
await writeFile(
|
|
2062
|
+
readFile: async (path7, encoding = "utf8") => readFile(path7, { encoding }),
|
|
2063
|
+
writeFile: async (path7, contents) => {
|
|
2064
|
+
await writeFile(path7, contents);
|
|
2060
2065
|
},
|
|
2061
|
-
exists: async (
|
|
2066
|
+
exists: async (path7) => {
|
|
2062
2067
|
try {
|
|
2063
|
-
await access(
|
|
2068
|
+
await access(path7);
|
|
2064
2069
|
return true;
|
|
2065
2070
|
} catch {
|
|
2066
2071
|
return false;
|
|
@@ -2081,9 +2086,9 @@ function isPlainObject(value) {
|
|
|
2081
2086
|
function hasFieldValue(value) {
|
|
2082
2087
|
return value !== void 0;
|
|
2083
2088
|
}
|
|
2084
|
-
function hasNestedField(fields,
|
|
2089
|
+
function hasNestedField(fields, path7) {
|
|
2085
2090
|
return fields.some(
|
|
2086
|
-
(field) =>
|
|
2091
|
+
(field) => path7.length < field.path.length && path7.every((segment, index) => field.path[index] === segment)
|
|
2087
2092
|
);
|
|
2088
2093
|
}
|
|
2089
2094
|
function describeExpectedPresetValue(schema) {
|
|
@@ -2170,9 +2175,9 @@ async function loadPresetValues(fields, presetPath) {
|
|
|
2170
2175
|
}
|
|
2171
2176
|
const fieldByPath = new Map(fields.map((field) => [field.displayPath, field]));
|
|
2172
2177
|
const presetValues = {};
|
|
2173
|
-
function visitObject(current,
|
|
2178
|
+
function visitObject(current, path7) {
|
|
2174
2179
|
for (const [key, value] of Object.entries(current)) {
|
|
2175
|
-
const nextPath = [...
|
|
2180
|
+
const nextPath = [...path7, key];
|
|
2176
2181
|
const displayPath = toDisplayPath(nextPath);
|
|
2177
2182
|
const field = fieldByPath.get(displayPath);
|
|
2178
2183
|
if (field !== void 0) {
|
|
@@ -4456,16 +4461,16 @@ function getConfigFormat(pathOrFormat) {
|
|
|
4456
4461
|
}
|
|
4457
4462
|
return formatRegistry[formatName];
|
|
4458
4463
|
}
|
|
4459
|
-
function detectFormat(
|
|
4460
|
-
const ext = getExtension(
|
|
4464
|
+
function detectFormat(path7) {
|
|
4465
|
+
const ext = getExtension(path7);
|
|
4461
4466
|
return extensionMap[ext];
|
|
4462
4467
|
}
|
|
4463
|
-
function getExtension(
|
|
4464
|
-
const lastDot =
|
|
4468
|
+
function getExtension(path7) {
|
|
4469
|
+
const lastDot = path7.lastIndexOf(".");
|
|
4465
4470
|
if (lastDot === -1) {
|
|
4466
4471
|
return "";
|
|
4467
4472
|
}
|
|
4468
|
-
return
|
|
4473
|
+
return path7.slice(lastDot).toLowerCase();
|
|
4469
4474
|
}
|
|
4470
4475
|
|
|
4471
4476
|
// ../config-mutations/src/execution/path-utils.ts
|
|
@@ -4767,8 +4772,8 @@ async function applyChmod(mutation, context, options) {
|
|
|
4767
4772
|
};
|
|
4768
4773
|
}
|
|
4769
4774
|
try {
|
|
4770
|
-
const
|
|
4771
|
-
const currentMode = typeof
|
|
4775
|
+
const stat2 = await context.fs.stat(targetPath);
|
|
4776
|
+
const currentMode = typeof stat2.mode === "number" ? stat2.mode & 511 : null;
|
|
4772
4777
|
if (currentMode === mutation.mode) {
|
|
4773
4778
|
return {
|
|
4774
4779
|
outcome: { changed: false, effect: "none", detail: "noop" },
|
|
@@ -5115,6 +5120,11 @@ async function executeMutation(mutation, context, options) {
|
|
|
5115
5120
|
import Mustache2 from "mustache";
|
|
5116
5121
|
var originalEscape = Mustache2.escape;
|
|
5117
5122
|
|
|
5123
|
+
// ../agent-skill-config/src/templates.ts
|
|
5124
|
+
import { readFile as readFile2, stat } from "node:fs/promises";
|
|
5125
|
+
import path4 from "node:path";
|
|
5126
|
+
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
5127
|
+
|
|
5118
5128
|
// ../agent-skill-config/src/apply.ts
|
|
5119
5129
|
var UnsupportedAgentError = class extends Error {
|
|
5120
5130
|
constructor(agentId) {
|
|
@@ -5171,9 +5181,9 @@ async function installSkill(agentId, skill, options) {
|
|
|
5171
5181
|
|
|
5172
5182
|
// src/commands/installer.ts
|
|
5173
5183
|
import os2 from "node:os";
|
|
5174
|
-
import
|
|
5184
|
+
import path5 from "node:path";
|
|
5175
5185
|
import * as nodeFs from "node:fs/promises";
|
|
5176
|
-
import { readFile as
|
|
5186
|
+
import { readFile as readFile3 } from "node:fs/promises";
|
|
5177
5187
|
var DEFAULT_INSTALL_AGENT = "claude-code";
|
|
5178
5188
|
var DEFAULT_INSTALL_SCOPE = "local";
|
|
5179
5189
|
var TERMINAL_PILOT_SKILL_NAME = "terminal-pilot";
|
|
@@ -5223,7 +5233,7 @@ async function loadTerminalPilotTemplate() {
|
|
|
5223
5233
|
];
|
|
5224
5234
|
for (const candidate of candidates) {
|
|
5225
5235
|
try {
|
|
5226
|
-
terminalPilotTemplateCache = await
|
|
5236
|
+
terminalPilotTemplateCache = await readFile3(candidate, "utf8");
|
|
5227
5237
|
return terminalPilotTemplateCache;
|
|
5228
5238
|
} catch (error2) {
|
|
5229
5239
|
if (!isNotFoundError(error2)) {
|
|
@@ -5238,7 +5248,7 @@ function resolveHomeRelativePath(targetPath, homeDir) {
|
|
|
5238
5248
|
return homeDir;
|
|
5239
5249
|
}
|
|
5240
5250
|
if (targetPath.startsWith("~/")) {
|
|
5241
|
-
return
|
|
5251
|
+
return path5.join(homeDir, targetPath.slice(2));
|
|
5242
5252
|
}
|
|
5243
5253
|
return targetPath;
|
|
5244
5254
|
}
|
|
@@ -5248,12 +5258,12 @@ function getSkillFolderWithHome(agent, scope, cwd, homeDir) {
|
|
|
5248
5258
|
throwUnsupportedAgent(agent);
|
|
5249
5259
|
}
|
|
5250
5260
|
return {
|
|
5251
|
-
displayPath:
|
|
5261
|
+
displayPath: path5.join(
|
|
5252
5262
|
scope === "global" ? config.globalSkillDir : config.localSkillDir,
|
|
5253
5263
|
TERMINAL_PILOT_SKILL_NAME
|
|
5254
5264
|
),
|
|
5255
|
-
fullPath:
|
|
5256
|
-
scope === "global" ? resolveHomeRelativePath(config.globalSkillDir, homeDir) :
|
|
5265
|
+
fullPath: path5.join(
|
|
5266
|
+
scope === "global" ? resolveHomeRelativePath(config.globalSkillDir, homeDir) : path5.resolve(cwd, config.localSkillDir),
|
|
5257
5267
|
TERMINAL_PILOT_SKILL_NAME
|
|
5258
5268
|
)
|
|
5259
5269
|
};
|
|
@@ -5660,7 +5670,7 @@ import { Resvg } from "@resvg/resvg-js";
|
|
|
5660
5670
|
import { readFileSync } from "node:fs";
|
|
5661
5671
|
import { createRequire as createRequire2 } from "node:module";
|
|
5662
5672
|
import { dirname as dirname2, join as join2 } from "node:path";
|
|
5663
|
-
import { fileURLToPath as
|
|
5673
|
+
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
5664
5674
|
var require2 = createRequire2(import.meta.url);
|
|
5665
5675
|
var fontPackageRoot = dirname2(require2.resolve("jetbrains-mono/package.json"));
|
|
5666
5676
|
var webfontRoot = join2(fontPackageRoot, "fonts/webfonts");
|
|
@@ -5668,7 +5678,7 @@ function readWebfontBase64(filename) {
|
|
|
5668
5678
|
return readFileSync(join2(webfontRoot, filename)).toString("base64");
|
|
5669
5679
|
}
|
|
5670
5680
|
function resolveAssetPath(filename) {
|
|
5671
|
-
return
|
|
5681
|
+
return fileURLToPath3(new URL(`../assets/${filename}`, import.meta.url));
|
|
5672
5682
|
}
|
|
5673
5683
|
function createFontFace(base64, weight, style) {
|
|
5674
5684
|
return `@font-face {
|
|
@@ -6364,9 +6374,9 @@ async function isDirectExecution(argv) {
|
|
|
6364
6374
|
return false;
|
|
6365
6375
|
}
|
|
6366
6376
|
try {
|
|
6367
|
-
const modulePath =
|
|
6377
|
+
const modulePath = fileURLToPath4(import.meta.url);
|
|
6368
6378
|
const [resolvedEntryPoint, resolvedModulePath] = await Promise.all([
|
|
6369
|
-
realpath(
|
|
6379
|
+
realpath(path6.resolve(entryPoint)),
|
|
6370
6380
|
realpath(modulePath)
|
|
6371
6381
|
]);
|
|
6372
6382
|
return resolvedEntryPoint === resolvedModulePath;
|