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.
@@ -155,8 +155,8 @@ function consumeTerminatedString(input, index, allowBellTerminator) {
155
155
 
156
156
  // src/cli.ts
157
157
  import { realpath } from "node:fs/promises";
158
- import path5 from "node:path";
159
- import { fileURLToPath as fileURLToPath3 } from "node:url";
158
+ import path6 from "node:path";
159
+ import { fileURLToPath as fileURLToPath4 } from "node:url";
160
160
 
161
161
  // ../cmdkit/src/cli.ts
162
162
  import { access, readFile, writeFile } from "node:fs/promises";
@@ -1511,11 +1511,11 @@ function formatSegment(segment, casing) {
1511
1511
  const separator = casing === "snake" ? "_" : "-";
1512
1512
  return splitWords(segment).join(separator);
1513
1513
  }
1514
- function toOptionFlag(path6, casing) {
1515
- return `--${path6.map((segment) => formatSegment(segment, casing)).join(".")}`;
1514
+ function toOptionFlag(path7, casing) {
1515
+ return `--${path7.map((segment) => formatSegment(segment, casing)).join(".")}`;
1516
1516
  }
1517
- function toOptionAttribute(path6, casing) {
1518
- return path6.map((segment) => {
1517
+ function toOptionAttribute(path7, casing) {
1518
+ return path7.map((segment) => {
1519
1519
  const formatted = formatSegment(segment, casing);
1520
1520
  if (casing === "snake") {
1521
1521
  return formatted;
@@ -1526,13 +1526,13 @@ function toOptionAttribute(path6, casing) {
1526
1526
  ).join("");
1527
1527
  }).join(".");
1528
1528
  }
1529
- function toDisplayPath(path6) {
1530
- return path6.join(".");
1529
+ function toDisplayPath(path7) {
1530
+ return path7.join(".");
1531
1531
  }
1532
- function collectFields(schema, casing, path6 = [], inheritedOptional = false) {
1532
+ function collectFields(schema, casing, path7 = [], inheritedOptional = false) {
1533
1533
  const fields = [];
1534
1534
  for (const [key, rawChildSchema] of Object.entries(schema.shape)) {
1535
- const nextPath = [...path6, key];
1535
+ const nextPath = [...path7, key];
1536
1536
  const optional = inheritedOptional || rawChildSchema.kind === "optional";
1537
1537
  const childSchema = unwrapOptional(rawChildSchema);
1538
1538
  if (childSchema.kind === "object") {
@@ -1555,9 +1555,9 @@ function collectFields(schema, casing, path6 = [], inheritedOptional = false) {
1555
1555
  }
1556
1556
  return fields;
1557
1557
  }
1558
- function toCommanderOptionAttribute(path6, casing) {
1559
- const optionAttribute = toOptionAttribute(path6, casing);
1560
- const optionFlag = toOptionFlag(path6, casing);
1558
+ function toCommanderOptionAttribute(path7, casing) {
1559
+ const optionAttribute = toOptionAttribute(path7, casing);
1560
+ const optionFlag = toOptionFlag(path7, casing);
1561
1561
  if (!GLOBAL_LONG_OPTION_FLAGS.has(optionFlag)) {
1562
1562
  return optionAttribute;
1563
1563
  }
@@ -1685,8 +1685,13 @@ function createOption(field) {
1685
1685
  if (collidesWithGlobalFlag) {
1686
1686
  return [createCommanderOption(flags, field.description, field)];
1687
1687
  }
1688
+ const mainOption = createCommanderOption(`${flags} [value]`, field.description, field);
1689
+ mainOption.preset(true);
1690
+ mainOption.argParser(
1691
+ (value) => typeof value === "boolean" ? value : parseBooleanText(value, field.displayPath)
1692
+ );
1688
1693
  return [
1689
- createCommanderOption(flags, field.description, field),
1694
+ mainOption,
1690
1695
  createCommanderOption(`--no-${field.optionFlag.slice(2)}`, field.description, field)
1691
1696
  ];
1692
1697
  }
@@ -1804,7 +1809,7 @@ function formatHelpFieldFlags(field) {
1804
1809
  return formatPositionalToken(field);
1805
1810
  }
1806
1811
  if (field.schema.kind === "boolean") {
1807
- return formatOptionFlags(field);
1812
+ return `${formatOptionFlags(field)} [value]`;
1808
1813
  }
1809
1814
  return `${formatOptionFlags(field)} <${describeSchemaType(field.schema)}>`;
1810
1815
  }
@@ -2017,10 +2022,10 @@ function addGlobalOptions(command) {
2017
2022
  throw new InvalidArgumentError('Invalid value for "--output". Expected one of: rich, md, markdown, json.');
2018
2023
  }).option("--verbose", "Print stack traces for unexpected errors.");
2019
2024
  }
2020
- function setNestedValue(target, path6, value) {
2025
+ function setNestedValue(target, path7, value) {
2021
2026
  let cursor = target;
2022
- for (let index = 0; index < path6.length - 1; index += 1) {
2023
- const segment = path6[index] ?? "";
2027
+ for (let index = 0; index < path7.length - 1; index += 1) {
2028
+ const segment = path7[index] ?? "";
2024
2029
  const existing = cursor[segment];
2025
2030
  if (typeof existing === "object" && existing !== null) {
2026
2031
  cursor = existing;
@@ -2030,7 +2035,7 @@ function setNestedValue(target, path6, value) {
2030
2035
  cursor[segment] = next;
2031
2036
  cursor = next;
2032
2037
  }
2033
- const leaf = path6[path6.length - 1];
2038
+ const leaf = path7[path7.length - 1];
2034
2039
  if (leaf !== void 0) {
2035
2040
  cursor[leaf] = value;
2036
2041
  }
@@ -2126,13 +2131,13 @@ async function withOutputFormat2(output, fn) {
2126
2131
  }
2127
2132
  function createFs() {
2128
2133
  return {
2129
- readFile: async (path6, encoding = "utf8") => readFile(path6, { encoding }),
2130
- writeFile: async (path6, contents) => {
2131
- await writeFile(path6, contents);
2134
+ readFile: async (path7, encoding = "utf8") => readFile(path7, { encoding }),
2135
+ writeFile: async (path7, contents) => {
2136
+ await writeFile(path7, contents);
2132
2137
  },
2133
- exists: async (path6) => {
2138
+ exists: async (path7) => {
2134
2139
  try {
2135
- await access(path6);
2140
+ await access(path7);
2136
2141
  return true;
2137
2142
  } catch {
2138
2143
  return false;
@@ -2153,9 +2158,9 @@ function isPlainObject(value) {
2153
2158
  function hasFieldValue(value) {
2154
2159
  return value !== void 0;
2155
2160
  }
2156
- function hasNestedField(fields, path6) {
2161
+ function hasNestedField(fields, path7) {
2157
2162
  return fields.some(
2158
- (field) => path6.length < field.path.length && path6.every((segment, index) => field.path[index] === segment)
2163
+ (field) => path7.length < field.path.length && path7.every((segment, index) => field.path[index] === segment)
2159
2164
  );
2160
2165
  }
2161
2166
  function describeExpectedPresetValue(schema) {
@@ -2242,9 +2247,9 @@ async function loadPresetValues(fields, presetPath) {
2242
2247
  }
2243
2248
  const fieldByPath = new Map(fields.map((field) => [field.displayPath, field]));
2244
2249
  const presetValues = {};
2245
- function visitObject(current, path6) {
2250
+ function visitObject(current, path7) {
2246
2251
  for (const [key, value] of Object.entries(current)) {
2247
- const nextPath = [...path6, key];
2252
+ const nextPath = [...path7, key];
2248
2253
  const displayPath = toDisplayPath(nextPath);
2249
2254
  const field = fieldByPath.get(displayPath);
2250
2255
  if (field !== void 0) {
@@ -4462,16 +4467,16 @@ function getConfigFormat(pathOrFormat) {
4462
4467
  }
4463
4468
  return formatRegistry[formatName];
4464
4469
  }
4465
- function detectFormat(path6) {
4466
- const ext = getExtension(path6);
4470
+ function detectFormat(path7) {
4471
+ const ext = getExtension(path7);
4467
4472
  return extensionMap[ext];
4468
4473
  }
4469
- function getExtension(path6) {
4470
- const lastDot = path6.lastIndexOf(".");
4474
+ function getExtension(path7) {
4475
+ const lastDot = path7.lastIndexOf(".");
4471
4476
  if (lastDot === -1) {
4472
4477
  return "";
4473
4478
  }
4474
- return path6.slice(lastDot).toLowerCase();
4479
+ return path7.slice(lastDot).toLowerCase();
4475
4480
  }
4476
4481
 
4477
4482
  // ../config-mutations/src/execution/path-utils.ts
@@ -4773,8 +4778,8 @@ async function applyChmod(mutation, context, options) {
4773
4778
  };
4774
4779
  }
4775
4780
  try {
4776
- const stat = await context.fs.stat(targetPath);
4777
- const currentMode = typeof stat.mode === "number" ? stat.mode & 511 : null;
4781
+ const stat2 = await context.fs.stat(targetPath);
4782
+ const currentMode = typeof stat2.mode === "number" ? stat2.mode & 511 : null;
4778
4783
  if (currentMode === mutation.mode) {
4779
4784
  return {
4780
4785
  outcome: { changed: false, effect: "none", detail: "noop" },
@@ -5121,6 +5126,11 @@ async function executeMutation(mutation, context, options) {
5121
5126
  import Mustache2 from "mustache";
5122
5127
  var originalEscape = Mustache2.escape;
5123
5128
 
5129
+ // ../agent-skill-config/src/templates.ts
5130
+ import { readFile as readFile2, stat } from "node:fs/promises";
5131
+ import path4 from "node:path";
5132
+ import { fileURLToPath as fileURLToPath2 } from "node:url";
5133
+
5124
5134
  // ../agent-skill-config/src/apply.ts
5125
5135
  var UnsupportedAgentError = class extends Error {
5126
5136
  constructor(agentId) {
@@ -5177,9 +5187,9 @@ async function installSkill(agentId, skill, options) {
5177
5187
 
5178
5188
  // src/commands/installer.ts
5179
5189
  import os2 from "node:os";
5180
- import path4 from "node:path";
5190
+ import path5 from "node:path";
5181
5191
  import * as nodeFs from "node:fs/promises";
5182
- import { readFile as readFile2 } from "node:fs/promises";
5192
+ import { readFile as readFile3 } from "node:fs/promises";
5183
5193
  var DEFAULT_INSTALL_AGENT = "claude-code";
5184
5194
  var DEFAULT_INSTALL_SCOPE = "local";
5185
5195
  var TERMINAL_PILOT_SKILL_NAME = "terminal-pilot";
@@ -5229,7 +5239,7 @@ async function loadTerminalPilotTemplate() {
5229
5239
  ];
5230
5240
  for (const candidate of candidates) {
5231
5241
  try {
5232
- terminalPilotTemplateCache = await readFile2(candidate, "utf8");
5242
+ terminalPilotTemplateCache = await readFile3(candidate, "utf8");
5233
5243
  return terminalPilotTemplateCache;
5234
5244
  } catch (error2) {
5235
5245
  if (!isNotFoundError(error2)) {
@@ -5244,7 +5254,7 @@ function resolveHomeRelativePath(targetPath, homeDir) {
5244
5254
  return homeDir;
5245
5255
  }
5246
5256
  if (targetPath.startsWith("~/")) {
5247
- return path4.join(homeDir, targetPath.slice(2));
5257
+ return path5.join(homeDir, targetPath.slice(2));
5248
5258
  }
5249
5259
  return targetPath;
5250
5260
  }
@@ -5254,12 +5264,12 @@ function getSkillFolderWithHome(agent, scope, cwd, homeDir) {
5254
5264
  throwUnsupportedAgent(agent);
5255
5265
  }
5256
5266
  return {
5257
- displayPath: path4.join(
5267
+ displayPath: path5.join(
5258
5268
  scope === "global" ? config.globalSkillDir : config.localSkillDir,
5259
5269
  TERMINAL_PILOT_SKILL_NAME
5260
5270
  ),
5261
- fullPath: path4.join(
5262
- scope === "global" ? resolveHomeRelativePath(config.globalSkillDir, homeDir) : path4.resolve(cwd, config.localSkillDir),
5271
+ fullPath: path5.join(
5272
+ scope === "global" ? resolveHomeRelativePath(config.globalSkillDir, homeDir) : path5.resolve(cwd, config.localSkillDir),
5263
5273
  TERMINAL_PILOT_SKILL_NAME
5264
5274
  )
5265
5275
  };
@@ -5666,7 +5676,7 @@ import { Resvg } from "@resvg/resvg-js";
5666
5676
  import { readFileSync } from "node:fs";
5667
5677
  import { createRequire as createRequire2 } from "node:module";
5668
5678
  import { dirname as dirname2, join as join2 } from "node:path";
5669
- import { fileURLToPath as fileURLToPath2 } from "node:url";
5679
+ import { fileURLToPath as fileURLToPath3 } from "node:url";
5670
5680
  var require2 = createRequire2(import.meta.url);
5671
5681
  var fontPackageRoot = dirname2(require2.resolve("jetbrains-mono/package.json"));
5672
5682
  var webfontRoot = join2(fontPackageRoot, "fonts/webfonts");
@@ -5674,7 +5684,7 @@ function readWebfontBase64(filename) {
5674
5684
  return readFileSync(join2(webfontRoot, filename)).toString("base64");
5675
5685
  }
5676
5686
  function resolveAssetPath(filename) {
5677
- return fileURLToPath2(new URL(`../assets/${filename}`, import.meta.url));
5687
+ return fileURLToPath3(new URL(`../assets/${filename}`, import.meta.url));
5678
5688
  }
5679
5689
  function createFontFace(base64, weight, style) {
5680
5690
  return `@font-face {
@@ -6370,9 +6380,9 @@ async function isDirectExecution(argv) {
6370
6380
  return false;
6371
6381
  }
6372
6382
  try {
6373
- const modulePath = fileURLToPath3(import.meta.url);
6383
+ const modulePath = fileURLToPath4(import.meta.url);
6374
6384
  const [resolvedEntryPoint, resolvedModulePath] = await Promise.all([
6375
- realpath(path5.resolve(entryPoint)),
6385
+ realpath(path6.resolve(entryPoint)),
6376
6386
  realpath(modulePath)
6377
6387
  ]);
6378
6388
  return resolvedEntryPoint === resolvedModulePath;