terminal-pilot 0.0.10 → 0.0.12

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.
Files changed (54) hide show
  1. package/dist/cli.js +243 -79
  2. package/dist/cli.js.map +4 -4
  3. package/dist/commands/close-session.js +11 -2
  4. package/dist/commands/close-session.js.map +2 -2
  5. package/dist/commands/create-session.js +11 -2
  6. package/dist/commands/create-session.js.map +2 -2
  7. package/dist/commands/fill.js +11 -2
  8. package/dist/commands/fill.js.map +2 -2
  9. package/dist/commands/get-session.js +11 -2
  10. package/dist/commands/get-session.js.map +2 -2
  11. package/dist/commands/index.js +152 -23
  12. package/dist/commands/index.js.map +4 -4
  13. package/dist/commands/install.js +140 -19
  14. package/dist/commands/install.js.map +4 -4
  15. package/dist/commands/installer.js +53 -8
  16. package/dist/commands/installer.js.map +4 -4
  17. package/dist/commands/list-sessions.js +11 -2
  18. package/dist/commands/list-sessions.js.map +2 -2
  19. package/dist/commands/press-key.js +11 -2
  20. package/dist/commands/press-key.js.map +2 -2
  21. package/dist/commands/read-history.js +11 -2
  22. package/dist/commands/read-history.js.map +2 -2
  23. package/dist/commands/read-screen.js +11 -2
  24. package/dist/commands/read-screen.js.map +2 -2
  25. package/dist/commands/resize.js +11 -2
  26. package/dist/commands/resize.js.map +2 -2
  27. package/dist/commands/runtime.js +8 -0
  28. package/dist/commands/runtime.js.map +2 -2
  29. package/dist/commands/screenshot.js +11 -2
  30. package/dist/commands/screenshot.js.map +2 -2
  31. package/dist/commands/send-signal.js +11 -2
  32. package/dist/commands/send-signal.js.map +2 -2
  33. package/dist/commands/type.js +11 -2
  34. package/dist/commands/type.js.map +2 -2
  35. package/dist/commands/uninstall.js +55 -9
  36. package/dist/commands/uninstall.js.map +4 -4
  37. package/dist/commands/wait-for-exit.js +11 -2
  38. package/dist/commands/wait-for-exit.js.map +2 -2
  39. package/dist/commands/wait-for.js +11 -2
  40. package/dist/commands/wait-for.js.map +2 -2
  41. package/dist/index.js +8 -0
  42. package/dist/index.js.map +2 -2
  43. package/dist/terminal-buffer.d.ts +1 -0
  44. package/dist/terminal-buffer.js +8 -0
  45. package/dist/terminal-buffer.js.map +2 -2
  46. package/dist/terminal-pilot.js +8 -0
  47. package/dist/terminal-pilot.js.map +2 -2
  48. package/dist/terminal-session.js +8 -0
  49. package/dist/terminal-session.js.map +2 -2
  50. package/dist/testing/cli-repl.js +243 -79
  51. package/dist/testing/cli-repl.js.map +4 -4
  52. package/dist/testing/qa-cli.js +255 -91
  53. package/dist/testing/qa-cli.js.map +4 -4
  54. 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 path5 from "node:path";
87
- import { fileURLToPath as fileURLToPath3 } from "node:url";
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";
@@ -639,6 +639,12 @@ function renderTable(options) {
639
639
 
640
640
  // ../design-system/src/acp/components.ts
641
641
  import chalk7 from "chalk";
642
+
643
+ // ../design-system/src/acp/writer.ts
644
+ import { AsyncLocalStorage as AsyncLocalStorage2 } from "node:async_hooks";
645
+ var storage = new AsyncLocalStorage2();
646
+
647
+ // ../design-system/src/acp/components.ts
642
648
  var AGENT_PREFIX = `${chalk7.green.bold("\u2713")} agent: `;
643
649
 
644
650
  // ../design-system/src/dashboard/buffer.ts
@@ -811,10 +817,11 @@ var S = {
811
817
  ...options
812
818
  };
813
819
  },
814
- Object(shape) {
820
+ Object(shape, options = {}) {
815
821
  return {
816
822
  kind: "object",
817
- shape
823
+ shape,
824
+ ...options
818
825
  };
819
826
  },
820
827
  Optional(inner) {
@@ -1198,6 +1205,14 @@ function getCommandSourcePath(command) {
1198
1205
  return command[commandSourcePathSymbol];
1199
1206
  }
1200
1207
 
1208
+ // ../cmdkit/src/number-schema.ts
1209
+ function isValidNumberSchemaValue(value, schema) {
1210
+ return typeof value === "number" && Number.isFinite(value) && (schema.jsonType !== "integer" || Number.isInteger(value));
1211
+ }
1212
+ function getExpectedNumberDescription(schema) {
1213
+ return schema.jsonType === "integer" ? "an integer" : "a number";
1214
+ }
1215
+
1201
1216
  // ../cmdkit/src/renderer.ts
1202
1217
  function isObject(value) {
1203
1218
  return value !== null && typeof value === "object" && !Array.isArray(value);
@@ -1424,11 +1439,11 @@ function formatSegment(segment, casing) {
1424
1439
  const separator = casing === "snake" ? "_" : "-";
1425
1440
  return splitWords(segment).join(separator);
1426
1441
  }
1427
- function toOptionFlag(path6, casing) {
1428
- return `--${path6.map((segment) => formatSegment(segment, casing)).join(".")}`;
1442
+ function toOptionFlag(path7, casing) {
1443
+ return `--${path7.map((segment) => formatSegment(segment, casing)).join(".")}`;
1429
1444
  }
1430
- function toOptionAttribute(path6, casing) {
1431
- return path6.map((segment) => {
1445
+ function toOptionAttribute(path7, casing) {
1446
+ return path7.map((segment) => {
1432
1447
  const formatted = formatSegment(segment, casing);
1433
1448
  if (casing === "snake") {
1434
1449
  return formatted;
@@ -1439,13 +1454,13 @@ function toOptionAttribute(path6, casing) {
1439
1454
  ).join("");
1440
1455
  }).join(".");
1441
1456
  }
1442
- function toDisplayPath(path6) {
1443
- return path6.join(".");
1457
+ function toDisplayPath(path7) {
1458
+ return path7.join(".");
1444
1459
  }
1445
- function collectFields(schema, casing, path6 = [], inheritedOptional = false) {
1460
+ function collectFields(schema, casing, path7 = [], inheritedOptional = false) {
1446
1461
  const fields = [];
1447
1462
  for (const [key, rawChildSchema] of Object.entries(schema.shape)) {
1448
- const nextPath = [...path6, key];
1463
+ const nextPath = [...path7, key];
1449
1464
  const optional = inheritedOptional || rawChildSchema.kind === "optional";
1450
1465
  const childSchema = unwrapOptional(rawChildSchema);
1451
1466
  if (childSchema.kind === "object") {
@@ -1468,9 +1483,9 @@ function collectFields(schema, casing, path6 = [], inheritedOptional = false) {
1468
1483
  }
1469
1484
  return fields;
1470
1485
  }
1471
- function toCommanderOptionAttribute(path6, casing) {
1472
- const optionAttribute = toOptionAttribute(path6, casing);
1473
- const optionFlag = toOptionFlag(path6, casing);
1486
+ function toCommanderOptionAttribute(path7, casing) {
1487
+ const optionAttribute = toOptionAttribute(path7, casing);
1488
+ const optionFlag = toOptionFlag(path7, casing);
1474
1489
  if (!GLOBAL_LONG_OPTION_FLAGS.has(optionFlag)) {
1475
1490
  return optionAttribute;
1476
1491
  }
@@ -1548,8 +1563,10 @@ function parseScalarValue(value, schema, label) {
1548
1563
  return value;
1549
1564
  case "number": {
1550
1565
  const parsed = Number(value);
1551
- if (!Number.isFinite(parsed)) {
1552
- throw new InvalidArgumentError(`Invalid value for "${label}". Expected a number.`);
1566
+ if (!isValidNumberSchemaValue(parsed, schema)) {
1567
+ throw new InvalidArgumentError(
1568
+ `Invalid value for "${label}". Expected ${getExpectedNumberDescription(schema)}.`
1569
+ );
1553
1570
  }
1554
1571
  return parsed;
1555
1572
  }
@@ -1637,6 +1654,9 @@ function resolveHelpOutput(argv) {
1637
1654
  if (value === "rich" || value === "md" || value === "json") {
1638
1655
  return value;
1639
1656
  }
1657
+ if (value === "markdown") {
1658
+ return "md";
1659
+ }
1640
1660
  continue;
1641
1661
  }
1642
1662
  if (token.startsWith("--output=")) {
@@ -1644,6 +1664,9 @@ function resolveHelpOutput(argv) {
1644
1664
  if (value === "rich" || value === "md" || value === "json") {
1645
1665
  return value;
1646
1666
  }
1667
+ if (value === "markdown") {
1668
+ return "md";
1669
+ }
1647
1670
  }
1648
1671
  }
1649
1672
  return "rich";
@@ -1652,7 +1675,7 @@ function isNodeVisibleInScope(node, scope) {
1652
1675
  if (node.kind === "command") {
1653
1676
  return node.scope.includes(scope);
1654
1677
  }
1655
- return getVisibleChildren(node, scope).length > 0 || Boolean(node.default && node.default.scope.includes(scope));
1678
+ return getVisibleChildren(node, scope).length > 0 || Boolean(node.default && node.default.scope.includes(scope)) || node.scope === void 0 || node.scope.includes(scope);
1656
1679
  }
1657
1680
  function getVisibleChildren(group, scope) {
1658
1681
  return group.children.filter((child) => isNodeVisibleInScope(child, scope));
@@ -1894,10 +1917,10 @@ function createNodeCommand(node, casing, execute) {
1894
1917
  });
1895
1918
  return command;
1896
1919
  }
1897
- const visibleChildren = node.children.map((child) => createNodeCommand(child, casing, execute)).filter((child) => child !== null);
1898
- if (visibleChildren.length === 0 && node.default === void 0) {
1920
+ if (!isNodeVisibleInScope(node, "cli")) {
1899
1921
  return null;
1900
1922
  }
1923
+ const visibleChildren = node.children.map((child) => createNodeCommand(child, casing, execute)).filter((child) => child !== null);
1901
1924
  const group = new CommanderCommand(node.name);
1902
1925
  if (node.description !== void 0) {
1903
1926
  group.description(node.description);
@@ -1916,13 +1939,16 @@ function addGlobalOptions(command) {
1916
1939
  if (value === "rich" || value === "md" || value === "json") {
1917
1940
  return value;
1918
1941
  }
1919
- throw new InvalidArgumentError('Invalid value for "--output". Expected one of: rich, md, json.');
1942
+ if (value === "markdown") {
1943
+ return "md";
1944
+ }
1945
+ throw new InvalidArgumentError('Invalid value for "--output". Expected one of: rich, md, markdown, json.');
1920
1946
  }).option("--verbose", "Print stack traces for unexpected errors.");
1921
1947
  }
1922
- function setNestedValue(target, path6, value) {
1948
+ function setNestedValue(target, path7, value) {
1923
1949
  let cursor = target;
1924
- for (let index = 0; index < path6.length - 1; index += 1) {
1925
- const segment = path6[index] ?? "";
1950
+ for (let index = 0; index < path7.length - 1; index += 1) {
1951
+ const segment = path7[index] ?? "";
1926
1952
  const existing = cursor[segment];
1927
1953
  if (typeof existing === "object" && existing !== null) {
1928
1954
  cursor = existing;
@@ -1932,7 +1958,7 @@ function setNestedValue(target, path6, value) {
1932
1958
  cursor[segment] = next;
1933
1959
  cursor = next;
1934
1960
  }
1935
- const leaf = path6[path6.length - 1];
1961
+ const leaf = path7[path7.length - 1];
1936
1962
  if (leaf !== void 0) {
1937
1963
  cursor[leaf] = value;
1938
1964
  }
@@ -1994,20 +2020,22 @@ async function promptForField(field) {
1994
2020
  }
1995
2021
  return parseScalarValue(entered, field.schema, field.displayPath);
1996
2022
  }
1997
- function resolveOutput(globalFlags) {
1998
- if (globalFlags.output !== void 0) {
1999
- return globalFlags.output;
2023
+ function resolveOutput(resolvedFlags) {
2024
+ if (resolvedFlags.json === true) {
2025
+ return "json";
2026
+ }
2027
+ if (resolvedFlags.output !== void 0) {
2028
+ return resolvedFlags.output;
2000
2029
  }
2001
2030
  return "rich";
2002
2031
  }
2032
+ var DESIGN_SYSTEM_OUTPUT_BY_MODE = {
2033
+ rich: "terminal",
2034
+ md: "markdown",
2035
+ json: "json"
2036
+ };
2003
2037
  function toDesignSystemOutput(output) {
2004
- if (output === "md") {
2005
- return "markdown";
2006
- }
2007
- if (output === "json") {
2008
- return "json";
2009
- }
2010
- return "terminal";
2038
+ return DESIGN_SYSTEM_OUTPUT_BY_MODE[output];
2011
2039
  }
2012
2040
  async function withOutputFormat2(output, fn) {
2013
2041
  const previous = process.env.OUTPUT_FORMAT;
@@ -2016,19 +2044,23 @@ async function withOutputFormat2(output, fn) {
2016
2044
  try {
2017
2045
  return await fn();
2018
2046
  } finally {
2019
- process.env.OUTPUT_FORMAT = previous;
2047
+ if (previous === void 0) {
2048
+ delete process.env.OUTPUT_FORMAT;
2049
+ } else {
2050
+ process.env.OUTPUT_FORMAT = previous;
2051
+ }
2020
2052
  resetOutputFormatCache();
2021
2053
  }
2022
2054
  }
2023
2055
  function createFs() {
2024
2056
  return {
2025
- readFile: async (path6, encoding = "utf8") => readFile(path6, { encoding }),
2026
- writeFile: async (path6, contents) => {
2027
- await writeFile(path6, contents);
2057
+ readFile: async (path7, encoding = "utf8") => readFile(path7, { encoding }),
2058
+ writeFile: async (path7, contents) => {
2059
+ await writeFile(path7, contents);
2028
2060
  },
2029
- exists: async (path6) => {
2061
+ exists: async (path7) => {
2030
2062
  try {
2031
- await access(path6);
2063
+ await access(path7);
2032
2064
  return true;
2033
2065
  } catch {
2034
2066
  return false;
@@ -2049,9 +2081,9 @@ function isPlainObject(value) {
2049
2081
  function hasFieldValue(value) {
2050
2082
  return value !== void 0;
2051
2083
  }
2052
- function hasNestedField(fields, path6) {
2084
+ function hasNestedField(fields, path7) {
2053
2085
  return fields.some(
2054
- (field) => path6.length < field.path.length && path6.every((segment, index) => field.path[index] === segment)
2086
+ (field) => path7.length < field.path.length && path7.every((segment, index) => field.path[index] === segment)
2055
2087
  );
2056
2088
  }
2057
2089
  function describeExpectedPresetValue(schema) {
@@ -2064,6 +2096,9 @@ function describeExpectedPresetValue(schema) {
2064
2096
  return `a ${schema.kind}`;
2065
2097
  }
2066
2098
  function validatePresetScalarValue(value, schema, fieldPath, presetPath) {
2099
+ if (value === null && schema.nullable === true) {
2100
+ return null;
2101
+ }
2067
2102
  switch (schema.kind) {
2068
2103
  case "string":
2069
2104
  if (typeof value !== "string") {
@@ -2071,7 +2106,7 @@ function validatePresetScalarValue(value, schema, fieldPath, presetPath) {
2071
2106
  }
2072
2107
  return value;
2073
2108
  case "number":
2074
- if (typeof value !== "number" || !Number.isFinite(value)) {
2109
+ if (!isValidNumberSchemaValue(value, schema)) {
2075
2110
  break;
2076
2111
  }
2077
2112
  return value;
@@ -2135,9 +2170,9 @@ async function loadPresetValues(fields, presetPath) {
2135
2170
  }
2136
2171
  const fieldByPath = new Map(fields.map((field) => [field.displayPath, field]));
2137
2172
  const presetValues = {};
2138
- function visitObject(current, path6) {
2173
+ function visitObject(current, path7) {
2139
2174
  for (const [key, value] of Object.entries(current)) {
2140
- const nextPath = [...path6, key];
2175
+ const nextPath = [...path7, key];
2141
2176
  const displayPath = toDisplayPath(nextPath);
2142
2177
  const field = fieldByPath.get(displayPath);
2143
2178
  if (field !== void 0) {
@@ -2489,7 +2524,7 @@ async function resolveParams(fields, positionalValues, optionValues, presetPath,
2489
2524
  }
2490
2525
  return params17;
2491
2526
  }
2492
- function getGlobalFlags(command) {
2527
+ function getResolvedFlags(command) {
2493
2528
  const flags = command.optsWithGlobals();
2494
2529
  return flags;
2495
2530
  }
@@ -2501,9 +2536,10 @@ async function executeCommand(state, services, requirementOptions) {
2501
2536
  getTheme,
2502
2537
  note
2503
2538
  };
2504
- const globalFlags = getGlobalFlags(state.actionCommand);
2505
- const output = resolveOutput(globalFlags);
2506
- const shouldPrompt = !globalFlags.yes && Boolean(process.stdin.isTTY);
2539
+ const optionValues = state.actionCommand.optsWithGlobals();
2540
+ const resolvedFlags = optionValues;
2541
+ const output = resolveOutput(resolvedFlags);
2542
+ const shouldPrompt = !resolvedFlags.yes && Boolean(process.stdin.isTTY);
2507
2543
  const runtime = await resolveFixtureRuntime(state.command, services, requirementOptions);
2508
2544
  const preflightContext = {
2509
2545
  ...runtime.services,
@@ -2520,15 +2556,15 @@ async function executeCommand(state, services, requirementOptions) {
2520
2556
  const params17 = await resolveParams(
2521
2557
  state.fields,
2522
2558
  state.positionalValues,
2523
- state.actionCommand.optsWithGlobals(),
2524
- globalFlags.preset,
2559
+ optionValues,
2560
+ resolvedFlags.preset,
2525
2561
  shouldPrompt
2526
2562
  );
2527
2563
  const context = {
2528
2564
  ...preflightContext,
2529
2565
  params: params17
2530
2566
  };
2531
- if (state.command.confirm && !globalFlags.yes && process.stdin.isTTY) {
2567
+ if (state.command.confirm && !resolvedFlags.yes && process.stdin.isTTY) {
2532
2568
  for (const field of state.fields) {
2533
2569
  const value = field.path.reduce(
2534
2570
  (current, segment) => current && typeof current === "object" ? current[segment] : void 0,
@@ -2604,7 +2640,7 @@ async function runCLI(roots, options = {}) {
2604
2640
  try {
2605
2641
  await executeCommand(state, services, requirementOptions);
2606
2642
  } catch (error2) {
2607
- handleRunError(error2, Boolean(getGlobalFlags(state.actionCommand).verbose));
2643
+ handleRunError(error2, Boolean(getResolvedFlags(state.actionCommand).verbose));
2608
2644
  }
2609
2645
  };
2610
2646
  for (const child of root.children) {
@@ -2719,6 +2755,7 @@ var TerminalBuffer = class {
2719
2755
  _state = 0 /* Normal */;
2720
2756
  _csiParams = "";
2721
2757
  _csiPrivate = "";
2758
+ _autoWrap = true;
2722
2759
  _style = createDefaultStyleState();
2723
2760
  _styleSequence = "";
2724
2761
  displayBuffer;
@@ -2846,6 +2883,9 @@ var TerminalBuffer = class {
2846
2883
  const p1 = params17[1] ?? 0;
2847
2884
  if (this._csiPrivate === "?") {
2848
2885
  if (final === "h" || final === "l") {
2886
+ if (params17.includes(7)) {
2887
+ this._autoWrap = final === "h";
2888
+ }
2849
2889
  if (params17.includes(1049)) {
2850
2890
  if (final === "h") {
2851
2891
  this._screen = this._makeScreen(this._cols, this._rows);
@@ -3060,6 +3100,10 @@ var TerminalBuffer = class {
3060
3100
  } else if (code >= 32 && code !== 127) {
3061
3101
  this._setChar(this._cursorY, this._cursorX, ch);
3062
3102
  this._cursorX++;
3103
+ if (!this._autoWrap) {
3104
+ this._cursorX = Math.min(this._cursorX, this._cols - 1);
3105
+ return;
3106
+ }
3063
3107
  if (this._cursorX >= this._cols) {
3064
3108
  this._cursorX = 0;
3065
3109
  this._newline();
@@ -3974,13 +4018,46 @@ var kimiAgent = {
3974
4018
  }
3975
4019
  };
3976
4020
 
4021
+ // ../agent-defs/src/agents/goose.ts
4022
+ var gooseAgent = {
4023
+ id: "goose",
4024
+ name: "goose",
4025
+ label: "Goose",
4026
+ summary: "Block's open-source AI agent with ACP support.",
4027
+ binaryName: "goose",
4028
+ configPath: "~/.config/goose/config.yaml",
4029
+ branding: {
4030
+ colors: {
4031
+ dark: "#FF6B35",
4032
+ light: "#E85D26"
4033
+ }
4034
+ }
4035
+ };
4036
+
4037
+ // ../agent-defs/src/agents/poe-agent.ts
4038
+ var poeAgentAgent = {
4039
+ id: "poe-agent",
4040
+ name: "poe-agent",
4041
+ label: "Poe Agent",
4042
+ summary: "Run one-shot prompts with the built-in Poe agent runtime.",
4043
+ configPath: "~/.poe-code/config.json",
4044
+ branding: {
4045
+ colors: {
4046
+ dark: "#A465F7",
4047
+ light: "#7A3FD3"
4048
+ }
4049
+ }
4050
+ };
4051
+
3977
4052
  // ../agent-defs/src/registry.ts
3978
4053
  var allAgents = [
3979
4054
  claudeCodeAgent,
3980
4055
  claudeDesktopAgent,
3981
4056
  codexAgent,
3982
4057
  openCodeAgent,
3983
- kimiAgent
4058
+ kimiAgent,
4059
+ gooseAgent,
4060
+ poeAgentAgent
3984
4061
  ];
3985
4062
  var lookup = /* @__PURE__ */ new Map();
3986
4063
  for (const agent of allAgents) {
@@ -4012,6 +4089,10 @@ var agentSkillConfigs = {
4012
4089
  opencode: {
4013
4090
  globalSkillDir: "~/.config/opencode/skills",
4014
4091
  localSkillDir: ".opencode/skills"
4092
+ },
4093
+ goose: {
4094
+ globalSkillDir: "~/.agents/skills",
4095
+ localSkillDir: ".agents/skills"
4015
4096
  }
4016
4097
  };
4017
4098
  var supportedAgents = Object.keys(agentSkillConfigs);
@@ -4275,14 +4356,92 @@ var tomlFormat = {
4275
4356
  prune: prune2
4276
4357
  };
4277
4358
 
4359
+ // ../config-mutations/src/formats/yaml.ts
4360
+ import { parse as parseYaml, stringify as stringifyYaml } from "yaml";
4361
+ function isConfigObject3(value) {
4362
+ return typeof value === "object" && value !== null && !Array.isArray(value);
4363
+ }
4364
+ function parse5(content) {
4365
+ if (!content || content.trim() === "") {
4366
+ return {};
4367
+ }
4368
+ const parsed = parseYaml(content);
4369
+ if (parsed === null || parsed === void 0) {
4370
+ return {};
4371
+ }
4372
+ if (!isConfigObject3(parsed)) {
4373
+ throw new Error("Expected YAML object.");
4374
+ }
4375
+ return parsed;
4376
+ }
4377
+ function serialize3(obj) {
4378
+ const serialized = stringifyYaml(obj);
4379
+ return serialized.endsWith("\n") ? serialized : `${serialized}
4380
+ `;
4381
+ }
4382
+ function merge3(base, patch) {
4383
+ const result = { ...base };
4384
+ for (const [key, value] of Object.entries(patch)) {
4385
+ if (value === void 0) {
4386
+ continue;
4387
+ }
4388
+ const existing = result[key];
4389
+ if (isConfigObject3(existing) && isConfigObject3(value)) {
4390
+ result[key] = merge3(existing, value);
4391
+ continue;
4392
+ }
4393
+ result[key] = value;
4394
+ }
4395
+ return result;
4396
+ }
4397
+ function prune3(obj, shape) {
4398
+ let changed = false;
4399
+ const result = { ...obj };
4400
+ for (const [key, pattern] of Object.entries(shape)) {
4401
+ if (!(key in result)) {
4402
+ continue;
4403
+ }
4404
+ const current = result[key];
4405
+ if (isConfigObject3(pattern) && Object.keys(pattern).length === 0) {
4406
+ delete result[key];
4407
+ changed = true;
4408
+ continue;
4409
+ }
4410
+ if (isConfigObject3(pattern) && isConfigObject3(current)) {
4411
+ const { changed: childChanged, result: childResult } = prune3(current, pattern);
4412
+ if (childChanged) {
4413
+ changed = true;
4414
+ }
4415
+ if (Object.keys(childResult).length === 0) {
4416
+ delete result[key];
4417
+ } else {
4418
+ result[key] = childResult;
4419
+ }
4420
+ continue;
4421
+ }
4422
+ delete result[key];
4423
+ changed = true;
4424
+ }
4425
+ return { changed, result };
4426
+ }
4427
+ var yamlFormat = {
4428
+ parse: parse5,
4429
+ serialize: serialize3,
4430
+ merge: merge3,
4431
+ prune: prune3
4432
+ };
4433
+
4278
4434
  // ../config-mutations/src/formats/index.ts
4279
4435
  var formatRegistry = {
4280
4436
  json: jsonFormat,
4281
- toml: tomlFormat
4437
+ toml: tomlFormat,
4438
+ yaml: yamlFormat
4282
4439
  };
4283
4440
  var extensionMap = {
4284
4441
  ".json": "json",
4285
- ".toml": "toml"
4442
+ ".toml": "toml",
4443
+ ".yaml": "yaml",
4444
+ ".yml": "yaml"
4286
4445
  };
4287
4446
  function getConfigFormat(pathOrFormat) {
4288
4447
  if (pathOrFormat in formatRegistry) {
@@ -4297,16 +4456,16 @@ function getConfigFormat(pathOrFormat) {
4297
4456
  }
4298
4457
  return formatRegistry[formatName];
4299
4458
  }
4300
- function detectFormat(path6) {
4301
- const ext = getExtension(path6);
4459
+ function detectFormat(path7) {
4460
+ const ext = getExtension(path7);
4302
4461
  return extensionMap[ext];
4303
4462
  }
4304
- function getExtension(path6) {
4305
- const lastDot = path6.lastIndexOf(".");
4463
+ function getExtension(path7) {
4464
+ const lastDot = path7.lastIndexOf(".");
4306
4465
  if (lastDot === -1) {
4307
4466
  return "";
4308
4467
  }
4309
- return path6.slice(lastDot).toLowerCase();
4468
+ return path7.slice(lastDot).toLowerCase();
4310
4469
  }
4311
4470
 
4312
4471
  // ../config-mutations/src/execution/path-utils.ts
@@ -4431,7 +4590,7 @@ function pruneKeysByPrefix(table, prefix) {
4431
4590
  }
4432
4591
  return result;
4433
4592
  }
4434
- function isConfigObject3(value) {
4593
+ function isConfigObject4(value) {
4435
4594
  return typeof value === "object" && value !== null && !Array.isArray(value);
4436
4595
  }
4437
4596
  function mergeWithPruneByPrefix(base, patch, pruneByPrefix) {
@@ -4440,7 +4599,7 @@ function mergeWithPruneByPrefix(base, patch, pruneByPrefix) {
4440
4599
  for (const [key, value] of Object.entries(patch)) {
4441
4600
  const current = result[key];
4442
4601
  const prefix = prefixMap[key];
4443
- if (isConfigObject3(current) && isConfigObject3(value)) {
4602
+ if (isConfigObject4(current) && isConfigObject4(value)) {
4444
4603
  if (prefix) {
4445
4604
  const pruned = pruneKeysByPrefix(current, prefix);
4446
4605
  result[key] = { ...pruned, ...value };
@@ -4608,8 +4767,8 @@ async function applyChmod(mutation, context, options) {
4608
4767
  };
4609
4768
  }
4610
4769
  try {
4611
- const stat = await context.fs.stat(targetPath);
4612
- const currentMode = typeof stat.mode === "number" ? stat.mode & 511 : null;
4770
+ const stat2 = await context.fs.stat(targetPath);
4771
+ const currentMode = typeof stat2.mode === "number" ? stat2.mode & 511 : null;
4613
4772
  if (currentMode === mutation.mode) {
4614
4773
  return {
4615
4774
  outcome: { changed: false, effect: "none", detail: "noop" },
@@ -4956,6 +5115,11 @@ async function executeMutation(mutation, context, options) {
4956
5115
  import Mustache2 from "mustache";
4957
5116
  var originalEscape = Mustache2.escape;
4958
5117
 
5118
+ // ../agent-skill-config/src/templates.ts
5119
+ import { readFile as readFile2, stat } from "node:fs/promises";
5120
+ import path4 from "node:path";
5121
+ import { fileURLToPath as fileURLToPath2 } from "node:url";
5122
+
4959
5123
  // ../agent-skill-config/src/apply.ts
4960
5124
  var UnsupportedAgentError = class extends Error {
4961
5125
  constructor(agentId) {
@@ -5012,9 +5176,9 @@ async function installSkill(agentId, skill, options) {
5012
5176
 
5013
5177
  // src/commands/installer.ts
5014
5178
  import os2 from "node:os";
5015
- import path4 from "node:path";
5179
+ import path5 from "node:path";
5016
5180
  import * as nodeFs from "node:fs/promises";
5017
- import { readFile as readFile2 } from "node:fs/promises";
5181
+ import { readFile as readFile3 } from "node:fs/promises";
5018
5182
  var DEFAULT_INSTALL_AGENT = "claude-code";
5019
5183
  var DEFAULT_INSTALL_SCOPE = "local";
5020
5184
  var TERMINAL_PILOT_SKILL_NAME = "terminal-pilot";
@@ -5064,7 +5228,7 @@ async function loadTerminalPilotTemplate() {
5064
5228
  ];
5065
5229
  for (const candidate of candidates) {
5066
5230
  try {
5067
- terminalPilotTemplateCache = await readFile2(candidate, "utf8");
5231
+ terminalPilotTemplateCache = await readFile3(candidate, "utf8");
5068
5232
  return terminalPilotTemplateCache;
5069
5233
  } catch (error2) {
5070
5234
  if (!isNotFoundError(error2)) {
@@ -5079,7 +5243,7 @@ function resolveHomeRelativePath(targetPath, homeDir) {
5079
5243
  return homeDir;
5080
5244
  }
5081
5245
  if (targetPath.startsWith("~/")) {
5082
- return path4.join(homeDir, targetPath.slice(2));
5246
+ return path5.join(homeDir, targetPath.slice(2));
5083
5247
  }
5084
5248
  return targetPath;
5085
5249
  }
@@ -5089,12 +5253,12 @@ function getSkillFolderWithHome(agent, scope, cwd, homeDir) {
5089
5253
  throwUnsupportedAgent(agent);
5090
5254
  }
5091
5255
  return {
5092
- displayPath: path4.join(
5256
+ displayPath: path5.join(
5093
5257
  scope === "global" ? config.globalSkillDir : config.localSkillDir,
5094
5258
  TERMINAL_PILOT_SKILL_NAME
5095
5259
  ),
5096
- fullPath: path4.join(
5097
- scope === "global" ? resolveHomeRelativePath(config.globalSkillDir, homeDir) : path4.resolve(cwd, config.localSkillDir),
5260
+ fullPath: path5.join(
5261
+ scope === "global" ? resolveHomeRelativePath(config.globalSkillDir, homeDir) : path5.resolve(cwd, config.localSkillDir),
5098
5262
  TERMINAL_PILOT_SKILL_NAME
5099
5263
  )
5100
5264
  };
@@ -5464,7 +5628,7 @@ function applySgr(style, paramsText) {
5464
5628
  }
5465
5629
  return nextStyle;
5466
5630
  }
5467
- function parseAnsi(input) {
5631
+ function parseAnsi2(input) {
5468
5632
  const runs = [];
5469
5633
  let style = createDefaultStyle();
5470
5634
  let textStart = 0;
@@ -5501,7 +5665,7 @@ import { Resvg } from "@resvg/resvg-js";
5501
5665
  import { readFileSync } from "node:fs";
5502
5666
  import { createRequire as createRequire2 } from "node:module";
5503
5667
  import { dirname as dirname2, join as join2 } from "node:path";
5504
- import { fileURLToPath as fileURLToPath2 } from "node:url";
5668
+ import { fileURLToPath as fileURLToPath3 } from "node:url";
5505
5669
  var require2 = createRequire2(import.meta.url);
5506
5670
  var fontPackageRoot = dirname2(require2.resolve("jetbrains-mono/package.json"));
5507
5671
  var webfontRoot = join2(fontPackageRoot, "fonts/webfonts");
@@ -5509,7 +5673,7 @@ function readWebfontBase64(filename) {
5509
5673
  return readFileSync(join2(webfontRoot, filename)).toString("base64");
5510
5674
  }
5511
5675
  function resolveAssetPath(filename) {
5512
- return fileURLToPath2(new URL(`../assets/${filename}`, import.meta.url));
5676
+ return fileURLToPath3(new URL(`../assets/${filename}`, import.meta.url));
5513
5677
  }
5514
5678
  function createFontFace(base64, weight, style) {
5515
5679
  return `@font-face {
@@ -5999,7 +6163,7 @@ function formatNumber(value) {
5999
6163
 
6000
6164
  // ../terminal-png/src/index.ts
6001
6165
  async function renderTerminalPng(ansiText, options = {}) {
6002
- const runs = parseAnsi(ansiText);
6166
+ const runs = parseAnsi2(ansiText);
6003
6167
  const svg = renderSvg(runs, {
6004
6168
  padding: options.padding,
6005
6169
  window: options.window
@@ -6205,9 +6369,9 @@ async function isDirectExecution(argv) {
6205
6369
  return false;
6206
6370
  }
6207
6371
  try {
6208
- const modulePath = fileURLToPath3(import.meta.url);
6372
+ const modulePath = fileURLToPath4(import.meta.url);
6209
6373
  const [resolvedEntryPoint, resolvedModulePath] = await Promise.all([
6210
- realpath(path5.resolve(entryPoint)),
6374
+ realpath(path6.resolve(entryPoint)),
6211
6375
  realpath(modulePath)
6212
6376
  ]);
6213
6377
  return resolvedEntryPoint === resolvedModulePath;