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.
@@ -84,8 +84,8 @@ var require_src = __commonJS({
84
84
  import assert from "node:assert/strict";
85
85
  import { rm } from "node:fs/promises";
86
86
  import os3 from "node:os";
87
- import path6 from "node:path";
88
- import { fileURLToPath as fileURLToPath4 } from "node:url";
87
+ import path7 from "node:path";
88
+ import { fileURLToPath as fileURLToPath5 } from "node:url";
89
89
 
90
90
  // src/ansi.ts
91
91
  var ESC = 27;
@@ -162,8 +162,8 @@ function consumeTerminatedString(input, index, allowBellTerminator) {
162
162
 
163
163
  // src/cli.ts
164
164
  import { realpath } from "node:fs/promises";
165
- import path5 from "node:path";
166
- import { fileURLToPath as fileURLToPath3 } from "node:url";
165
+ import path6 from "node:path";
166
+ import { fileURLToPath as fileURLToPath4 } from "node:url";
167
167
 
168
168
  // ../cmdkit/src/cli.ts
169
169
  import { access, readFile, writeFile } from "node:fs/promises";
@@ -1518,11 +1518,11 @@ function formatSegment(segment, casing) {
1518
1518
  const separator = casing === "snake" ? "_" : "-";
1519
1519
  return splitWords(segment).join(separator);
1520
1520
  }
1521
- function toOptionFlag(path7, casing) {
1522
- return `--${path7.map((segment) => formatSegment(segment, casing)).join(".")}`;
1521
+ function toOptionFlag(path8, casing) {
1522
+ return `--${path8.map((segment) => formatSegment(segment, casing)).join(".")}`;
1523
1523
  }
1524
- function toOptionAttribute(path7, casing) {
1525
- return path7.map((segment) => {
1524
+ function toOptionAttribute(path8, casing) {
1525
+ return path8.map((segment) => {
1526
1526
  const formatted = formatSegment(segment, casing);
1527
1527
  if (casing === "snake") {
1528
1528
  return formatted;
@@ -1533,13 +1533,13 @@ function toOptionAttribute(path7, casing) {
1533
1533
  ).join("");
1534
1534
  }).join(".");
1535
1535
  }
1536
- function toDisplayPath(path7) {
1537
- return path7.join(".");
1536
+ function toDisplayPath(path8) {
1537
+ return path8.join(".");
1538
1538
  }
1539
- function collectFields(schema, casing, path7 = [], inheritedOptional = false) {
1539
+ function collectFields(schema, casing, path8 = [], inheritedOptional = false) {
1540
1540
  const fields = [];
1541
1541
  for (const [key, rawChildSchema] of Object.entries(schema.shape)) {
1542
- const nextPath = [...path7, key];
1542
+ const nextPath = [...path8, key];
1543
1543
  const optional = inheritedOptional || rawChildSchema.kind === "optional";
1544
1544
  const childSchema = unwrapOptional(rawChildSchema);
1545
1545
  if (childSchema.kind === "object") {
@@ -1562,9 +1562,9 @@ function collectFields(schema, casing, path7 = [], inheritedOptional = false) {
1562
1562
  }
1563
1563
  return fields;
1564
1564
  }
1565
- function toCommanderOptionAttribute(path7, casing) {
1566
- const optionAttribute = toOptionAttribute(path7, casing);
1567
- const optionFlag = toOptionFlag(path7, casing);
1565
+ function toCommanderOptionAttribute(path8, casing) {
1566
+ const optionAttribute = toOptionAttribute(path8, casing);
1567
+ const optionFlag = toOptionFlag(path8, casing);
1568
1568
  if (!GLOBAL_LONG_OPTION_FLAGS.has(optionFlag)) {
1569
1569
  return optionAttribute;
1570
1570
  }
@@ -1692,8 +1692,13 @@ function createOption(field) {
1692
1692
  if (collidesWithGlobalFlag) {
1693
1693
  return [createCommanderOption(flags, field.description, field)];
1694
1694
  }
1695
+ const mainOption = createCommanderOption(`${flags} [value]`, field.description, field);
1696
+ mainOption.preset(true);
1697
+ mainOption.argParser(
1698
+ (value) => typeof value === "boolean" ? value : parseBooleanText(value, field.displayPath)
1699
+ );
1695
1700
  return [
1696
- createCommanderOption(flags, field.description, field),
1701
+ mainOption,
1697
1702
  createCommanderOption(`--no-${field.optionFlag.slice(2)}`, field.description, field)
1698
1703
  ];
1699
1704
  }
@@ -1811,7 +1816,7 @@ function formatHelpFieldFlags(field) {
1811
1816
  return formatPositionalToken(field);
1812
1817
  }
1813
1818
  if (field.schema.kind === "boolean") {
1814
- return formatOptionFlags(field);
1819
+ return `${formatOptionFlags(field)} [value]`;
1815
1820
  }
1816
1821
  return `${formatOptionFlags(field)} <${describeSchemaType(field.schema)}>`;
1817
1822
  }
@@ -2024,10 +2029,10 @@ function addGlobalOptions(command) {
2024
2029
  throw new InvalidArgumentError('Invalid value for "--output". Expected one of: rich, md, markdown, json.');
2025
2030
  }).option("--verbose", "Print stack traces for unexpected errors.");
2026
2031
  }
2027
- function setNestedValue(target, path7, value) {
2032
+ function setNestedValue(target, path8, value) {
2028
2033
  let cursor = target;
2029
- for (let index = 0; index < path7.length - 1; index += 1) {
2030
- const segment = path7[index] ?? "";
2034
+ for (let index = 0; index < path8.length - 1; index += 1) {
2035
+ const segment = path8[index] ?? "";
2031
2036
  const existing = cursor[segment];
2032
2037
  if (typeof existing === "object" && existing !== null) {
2033
2038
  cursor = existing;
@@ -2037,7 +2042,7 @@ function setNestedValue(target, path7, value) {
2037
2042
  cursor[segment] = next;
2038
2043
  cursor = next;
2039
2044
  }
2040
- const leaf = path7[path7.length - 1];
2045
+ const leaf = path8[path8.length - 1];
2041
2046
  if (leaf !== void 0) {
2042
2047
  cursor[leaf] = value;
2043
2048
  }
@@ -2133,13 +2138,13 @@ async function withOutputFormat2(output, fn) {
2133
2138
  }
2134
2139
  function createFs() {
2135
2140
  return {
2136
- readFile: async (path7, encoding = "utf8") => readFile(path7, { encoding }),
2137
- writeFile: async (path7, contents) => {
2138
- await writeFile(path7, contents);
2141
+ readFile: async (path8, encoding = "utf8") => readFile(path8, { encoding }),
2142
+ writeFile: async (path8, contents) => {
2143
+ await writeFile(path8, contents);
2139
2144
  },
2140
- exists: async (path7) => {
2145
+ exists: async (path8) => {
2141
2146
  try {
2142
- await access(path7);
2147
+ await access(path8);
2143
2148
  return true;
2144
2149
  } catch {
2145
2150
  return false;
@@ -2160,9 +2165,9 @@ function isPlainObject(value) {
2160
2165
  function hasFieldValue(value) {
2161
2166
  return value !== void 0;
2162
2167
  }
2163
- function hasNestedField(fields, path7) {
2168
+ function hasNestedField(fields, path8) {
2164
2169
  return fields.some(
2165
- (field) => path7.length < field.path.length && path7.every((segment, index) => field.path[index] === segment)
2170
+ (field) => path8.length < field.path.length && path8.every((segment, index) => field.path[index] === segment)
2166
2171
  );
2167
2172
  }
2168
2173
  function describeExpectedPresetValue(schema) {
@@ -2249,9 +2254,9 @@ async function loadPresetValues(fields, presetPath) {
2249
2254
  }
2250
2255
  const fieldByPath = new Map(fields.map((field) => [field.displayPath, field]));
2251
2256
  const presetValues = {};
2252
- function visitObject(current, path7) {
2257
+ function visitObject(current, path8) {
2253
2258
  for (const [key, value] of Object.entries(current)) {
2254
- const nextPath = [...path7, key];
2259
+ const nextPath = [...path8, key];
2255
2260
  const displayPath = toDisplayPath(nextPath);
2256
2261
  const field = fieldByPath.get(displayPath);
2257
2262
  if (field !== void 0) {
@@ -4469,16 +4474,16 @@ function getConfigFormat(pathOrFormat) {
4469
4474
  }
4470
4475
  return formatRegistry[formatName];
4471
4476
  }
4472
- function detectFormat(path7) {
4473
- const ext = getExtension(path7);
4477
+ function detectFormat(path8) {
4478
+ const ext = getExtension(path8);
4474
4479
  return extensionMap[ext];
4475
4480
  }
4476
- function getExtension(path7) {
4477
- const lastDot = path7.lastIndexOf(".");
4481
+ function getExtension(path8) {
4482
+ const lastDot = path8.lastIndexOf(".");
4478
4483
  if (lastDot === -1) {
4479
4484
  return "";
4480
4485
  }
4481
- return path7.slice(lastDot).toLowerCase();
4486
+ return path8.slice(lastDot).toLowerCase();
4482
4487
  }
4483
4488
 
4484
4489
  // ../config-mutations/src/execution/path-utils.ts
@@ -4780,8 +4785,8 @@ async function applyChmod(mutation, context, options) {
4780
4785
  };
4781
4786
  }
4782
4787
  try {
4783
- const stat = await context.fs.stat(targetPath);
4784
- const currentMode = typeof stat.mode === "number" ? stat.mode & 511 : null;
4788
+ const stat2 = await context.fs.stat(targetPath);
4789
+ const currentMode = typeof stat2.mode === "number" ? stat2.mode & 511 : null;
4785
4790
  if (currentMode === mutation.mode) {
4786
4791
  return {
4787
4792
  outcome: { changed: false, effect: "none", detail: "noop" },
@@ -5128,6 +5133,11 @@ async function executeMutation(mutation, context, options) {
5128
5133
  import Mustache2 from "mustache";
5129
5134
  var originalEscape = Mustache2.escape;
5130
5135
 
5136
+ // ../agent-skill-config/src/templates.ts
5137
+ import { readFile as readFile2, stat } from "node:fs/promises";
5138
+ import path4 from "node:path";
5139
+ import { fileURLToPath as fileURLToPath2 } from "node:url";
5140
+
5131
5141
  // ../agent-skill-config/src/apply.ts
5132
5142
  var UnsupportedAgentError = class extends Error {
5133
5143
  constructor(agentId) {
@@ -5184,9 +5194,9 @@ async function installSkill(agentId, skill, options) {
5184
5194
 
5185
5195
  // src/commands/installer.ts
5186
5196
  import os2 from "node:os";
5187
- import path4 from "node:path";
5197
+ import path5 from "node:path";
5188
5198
  import * as nodeFs from "node:fs/promises";
5189
- import { readFile as readFile2 } from "node:fs/promises";
5199
+ import { readFile as readFile3 } from "node:fs/promises";
5190
5200
  var DEFAULT_INSTALL_AGENT = "claude-code";
5191
5201
  var DEFAULT_INSTALL_SCOPE = "local";
5192
5202
  var TERMINAL_PILOT_SKILL_NAME = "terminal-pilot";
@@ -5236,7 +5246,7 @@ async function loadTerminalPilotTemplate() {
5236
5246
  ];
5237
5247
  for (const candidate of candidates) {
5238
5248
  try {
5239
- terminalPilotTemplateCache = await readFile2(candidate, "utf8");
5249
+ terminalPilotTemplateCache = await readFile3(candidate, "utf8");
5240
5250
  return terminalPilotTemplateCache;
5241
5251
  } catch (error2) {
5242
5252
  if (!isNotFoundError(error2)) {
@@ -5251,7 +5261,7 @@ function resolveHomeRelativePath(targetPath, homeDir) {
5251
5261
  return homeDir;
5252
5262
  }
5253
5263
  if (targetPath.startsWith("~/")) {
5254
- return path4.join(homeDir, targetPath.slice(2));
5264
+ return path5.join(homeDir, targetPath.slice(2));
5255
5265
  }
5256
5266
  return targetPath;
5257
5267
  }
@@ -5261,12 +5271,12 @@ function getSkillFolderWithHome(agent, scope, cwd, homeDir) {
5261
5271
  throwUnsupportedAgent(agent);
5262
5272
  }
5263
5273
  return {
5264
- displayPath: path4.join(
5274
+ displayPath: path5.join(
5265
5275
  scope === "global" ? config.globalSkillDir : config.localSkillDir,
5266
5276
  TERMINAL_PILOT_SKILL_NAME
5267
5277
  ),
5268
- fullPath: path4.join(
5269
- scope === "global" ? resolveHomeRelativePath(config.globalSkillDir, homeDir) : path4.resolve(cwd, config.localSkillDir),
5278
+ fullPath: path5.join(
5279
+ scope === "global" ? resolveHomeRelativePath(config.globalSkillDir, homeDir) : path5.resolve(cwd, config.localSkillDir),
5270
5280
  TERMINAL_PILOT_SKILL_NAME
5271
5281
  )
5272
5282
  };
@@ -5673,7 +5683,7 @@ import { Resvg } from "@resvg/resvg-js";
5673
5683
  import { readFileSync } from "node:fs";
5674
5684
  import { createRequire as createRequire2 } from "node:module";
5675
5685
  import { dirname as dirname2, join as join2 } from "node:path";
5676
- import { fileURLToPath as fileURLToPath2 } from "node:url";
5686
+ import { fileURLToPath as fileURLToPath3 } from "node:url";
5677
5687
  var require2 = createRequire2(import.meta.url);
5678
5688
  var fontPackageRoot = dirname2(require2.resolve("jetbrains-mono/package.json"));
5679
5689
  var webfontRoot = join2(fontPackageRoot, "fonts/webfonts");
@@ -5681,7 +5691,7 @@ function readWebfontBase64(filename) {
5681
5691
  return readFileSync(join2(webfontRoot, filename)).toString("base64");
5682
5692
  }
5683
5693
  function resolveAssetPath(filename) {
5684
- return fileURLToPath2(new URL(`../assets/${filename}`, import.meta.url));
5694
+ return fileURLToPath3(new URL(`../assets/${filename}`, import.meta.url));
5685
5695
  }
5686
5696
  function createFontFace(base64, weight, style) {
5687
5697
  return `@font-face {
@@ -6377,9 +6387,9 @@ async function isDirectExecution(argv) {
6377
6387
  return false;
6378
6388
  }
6379
6389
  try {
6380
- const modulePath = fileURLToPath3(import.meta.url);
6390
+ const modulePath = fileURLToPath4(import.meta.url);
6381
6391
  const [resolvedEntryPoint, resolvedModulePath] = await Promise.all([
6382
- realpath(path5.resolve(entryPoint)),
6392
+ realpath(path6.resolve(entryPoint)),
6383
6393
  realpath(modulePath)
6384
6394
  ]);
6385
6395
  return resolvedEntryPoint === resolvedModulePath;
@@ -6491,13 +6501,13 @@ function createTerminalPilotCliRepl() {
6491
6501
  }
6492
6502
 
6493
6503
  // src/testing/qa-cli.ts
6494
- var testingDirectory = path6.dirname(fileURLToPath4(import.meta.url));
6495
- var repoRoot = path6.resolve(testingDirectory, "../../../..");
6496
- var tsxPath = path6.join(repoRoot, "node_modules", ".bin", "tsx");
6497
- var testCliPath = path6.join(repoRoot, "packages/terminal-pilot/src/testing/test-cli.js");
6498
- var menuCliPath = path6.join(repoRoot, "packages/terminal-pilot/src/testing/menu-cli.js");
6499
- var vimSavedFile = path6.join(os3.tmpdir(), "terminal-pilot-qa-test.txt");
6500
- var vimDiscardFile = path6.join(os3.tmpdir(), "terminal-pilot-qa-discard.txt");
6504
+ var testingDirectory = path7.dirname(fileURLToPath5(import.meta.url));
6505
+ var repoRoot = path7.resolve(testingDirectory, "../../../..");
6506
+ var tsxPath = path7.join(repoRoot, "node_modules", ".bin", "tsx");
6507
+ var testCliPath = path7.join(repoRoot, "packages/terminal-pilot/src/testing/test-cli.js");
6508
+ var menuCliPath = path7.join(repoRoot, "packages/terminal-pilot/src/testing/menu-cli.js");
6509
+ var vimSavedFile = path7.join(os3.tmpdir(), "terminal-pilot-qa-test.txt");
6510
+ var vimDiscardFile = path7.join(os3.tmpdir(), "terminal-pilot-qa-discard.txt");
6501
6511
  var QaContext = class {
6502
6512
  repl = createTerminalPilotCliRepl();
6503
6513
  async close() {
@@ -7243,7 +7253,7 @@ var cases = [
7243
7253
  "VIM",
7244
7254
  "-t",
7245
7255
  "5000",
7246
- path6.basename(vimSavedFile)
7256
+ path7.basename(vimSavedFile)
7247
7257
  ]);
7248
7258
  await ctx.expectOk(["press-key", "-s", "VIM", "i"]);
7249
7259
  await ctx.expectOk(["type", "-s", "VIM", "hello from terminal-pilot"]);
@@ -7298,7 +7308,7 @@ var cases = [
7298
7308
  "VIM2",
7299
7309
  "-t",
7300
7310
  "5000",
7301
- path6.basename(vimDiscardFile)
7311
+ path7.basename(vimDiscardFile)
7302
7312
  ]);
7303
7313
  await ctx.expectOk(["press-key", "-s", "VIM2", "i"]);
7304
7314
  await ctx.expectOk(["type", "-s", "VIM2", "this should not be saved"]);
@@ -7396,7 +7406,7 @@ Summary: ${cases.filter((entry) => !entry.skipped).length - failures.length} pas
7396
7406
  process.exitCode = 1;
7397
7407
  }
7398
7408
  }
7399
- if (process.argv[1] === fileURLToPath4(import.meta.url)) {
7409
+ if (process.argv[1] === fileURLToPath5(import.meta.url)) {
7400
7410
  await main2();
7401
7411
  }
7402
7412
  export {