terminal-pilot 0.0.47 → 0.0.48

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 (35) hide show
  1. package/dist/cli.d.ts +5 -0
  2. package/dist/cli.js +137 -16
  3. package/dist/cli.js.map +3 -3
  4. package/dist/commands/index.js +17 -0
  5. package/dist/commands/index.js.map +3 -3
  6. package/dist/commands/install.js +17 -0
  7. package/dist/commands/install.js.map +3 -3
  8. package/dist/commands/installer.js +17 -0
  9. package/dist/commands/installer.js.map +3 -3
  10. package/dist/commands/uninstall.js +17 -0
  11. package/dist/commands/uninstall.js.map +3 -3
  12. package/dist/composition.json +1 -1
  13. package/dist/testing/cli-repl.js +135 -15
  14. package/dist/testing/cli-repl.js.map +3 -3
  15. package/dist/testing/qa-cli.js +135 -15
  16. package/dist/testing/qa-cli.js.map +3 -3
  17. package/node_modules/@poe-code/agent-defs/README.md +1 -1
  18. package/node_modules/@poe-code/agent-defs/dist/agents/index.d.ts +1 -0
  19. package/node_modules/@poe-code/agent-defs/dist/agents/index.js +1 -0
  20. package/node_modules/@poe-code/agent-defs/dist/agents/pi.d.ts +2 -0
  21. package/node_modules/@poe-code/agent-defs/dist/agents/pi.js +14 -0
  22. package/node_modules/@poe-code/agent-defs/dist/index.d.ts +1 -1
  23. package/node_modules/@poe-code/agent-defs/dist/index.js +1 -1
  24. package/node_modules/@poe-code/agent-defs/dist/registry.js +2 -1
  25. package/node_modules/@poe-code/agent-defs/dist/types.d.ts +1 -1
  26. package/node_modules/toolcraft-design/dist/components/help-formatter-plain.js +1 -1
  27. package/node_modules/toolcraft-design/dist/components/help-formatter.d.ts +2 -0
  28. package/node_modules/toolcraft-design/dist/components/help-formatter.js +1 -1
  29. package/node_modules/toolcraft-design/dist/explorer/actions.d.ts +1 -0
  30. package/node_modules/toolcraft-design/dist/explorer/actions.js +1 -0
  31. package/node_modules/toolcraft-design/dist/explorer/reducer.js +1 -0
  32. package/node_modules/toolcraft-design/dist/explorer/runtime.js +21 -2
  33. package/node_modules/toolcraft-design/dist/explorer/state.d.ts +6 -0
  34. package/node_modules/toolcraft-design/dist/explorer/state.js +9 -6
  35. package/package.json +1 -1
@@ -1719,7 +1719,7 @@ function formatColumns(opts) {
1719
1719
  function formatCommandList(commands) {
1720
1720
  return formatColumns({
1721
1721
  rows: commands.map((cmd) => ({
1722
- left: text.command(cmd.name),
1722
+ left: `${" ".repeat((cmd.depth ?? 0) * 2)}${text.command(cmd.name)}`,
1723
1723
  right: cmd.description
1724
1724
  }))
1725
1725
  });
@@ -1856,7 +1856,7 @@ function formatColumns2(opts) {
1856
1856
  function formatCommandList2(commands) {
1857
1857
  return formatColumns2({
1858
1858
  rows: commands.map((cmd) => ({
1859
- left: cmd.name,
1859
+ left: `${" ".repeat((cmd.depth ?? 0) * 2)}${cmd.name}`,
1860
1860
  right: cmd.description
1861
1861
  }))
1862
1862
  });
@@ -6145,6 +6145,7 @@ function resolveCLIControls(controls) {
6145
6145
  validateOutputFormats(outputFormats);
6146
6146
  return {
6147
6147
  debug: controls?.debug === true,
6148
+ help: controls?.help === "concise" ? "concise" : "extended",
6148
6149
  logLevel: controls?.logLevel === true,
6149
6150
  output: controls?.output === true || typeof controls?.output === "object",
6150
6151
  outputFormats,
@@ -6641,11 +6642,31 @@ function formatCommandRowName(node, casing, globalLongOptionFlags) {
6641
6642
  const name = parameterTokens.length === 0 ? baseName : `${baseName} ${parameterTokens.join(" ")}`;
6642
6643
  return name;
6643
6644
  }
6644
- function formatCommandRows(group, scope, casing, globalLongOptionFlags) {
6645
- return getHelpChildren(group, scope).map((child) => ({
6646
- name: formatCommandRowName(child, casing, globalLongOptionFlags),
6647
- description: child.description ?? ""
6648
- }));
6645
+ function formatCommandRows(group, scope, casing, globalLongOptionFlags, help) {
6646
+ if (help === "concise") {
6647
+ return getHelpChildren(group, scope).map((child) => ({
6648
+ name: formatCommandRowName(child, casing, globalLongOptionFlags),
6649
+ description: child.description ?? "",
6650
+ kind: child.kind,
6651
+ depth: 0
6652
+ }));
6653
+ }
6654
+ const rows = [];
6655
+ const visit = (node, depth) => {
6656
+ for (const child of getHelpChildren(node, scope)) {
6657
+ rows.push({
6658
+ name: formatCommandRowName(child, casing, globalLongOptionFlags),
6659
+ description: child.description ?? "",
6660
+ kind: child.kind,
6661
+ depth
6662
+ });
6663
+ if (child.kind === "group") {
6664
+ visit(child, depth + 1);
6665
+ }
6666
+ }
6667
+ };
6668
+ visit(group, 0);
6669
+ return rows;
6649
6670
  }
6650
6671
  function formatGlobalOptionsLine(ctx) {
6651
6672
  const flags = [];
@@ -6733,7 +6754,13 @@ function renderGroupHelp(group, breadcrumb, scope, casing, globalOptions, rootUs
6733
6754
  globalOptions.showVersion,
6734
6755
  globalOptions.controls
6735
6756
  );
6736
- const commandRows = formatCommandRows(group, scope, casing, globalLongOptionFlags);
6757
+ const commandRows = formatCommandRows(
6758
+ group,
6759
+ scope,
6760
+ casing,
6761
+ globalLongOptionFlags,
6762
+ globalOptions.controls.help
6763
+ );
6737
6764
  if (commandRows.length > 0) {
6738
6765
  sections.push(`${text.sectionHeader("Commands")}
6739
6766
  ${formatHelpCommandList(commandRows)}`);
@@ -6822,7 +6849,13 @@ function renderJsonHelp(target, root, casing, globalOptions, rootUsageName) {
6822
6849
  );
6823
6850
  const node = target.node;
6824
6851
  if (node.kind === "group") {
6825
- const commandRows = formatCommandRows(node, "cli", casing, globalLongOptionFlags);
6852
+ const commandRows = formatCommandRows(
6853
+ node,
6854
+ "cli",
6855
+ casing,
6856
+ globalLongOptionFlags,
6857
+ globalOptions.controls.help
6858
+ );
6826
6859
  const isRoot = node === root;
6827
6860
  return `${JSON.stringify(
6828
6861
  {
@@ -6836,7 +6869,12 @@ function renderJsonHelp(target, root, casing, globalOptions, rootUsageName) {
6836
6869
  formatGroupUsageSuffix(node, "cli", casing, globalLongOptionFlags)
6837
6870
  ),
6838
6871
  ...node.description === void 0 ? {} : { description: node.description },
6839
- commands: commandRows.map((row) => ({ name: row.name, description: row.description })),
6872
+ commands: commandRows.map((row) => ({
6873
+ name: row.name,
6874
+ description: row.description,
6875
+ kind: row.kind,
6876
+ depth: row.depth
6877
+ })),
6840
6878
  options: isRoot ? collectSchemaGlobalFieldRows(node, "cli", casing, globalLongOptionFlags).map((row) => ({
6841
6879
  name: row.flags.split(/[ ,]+/)[0]?.replace(/^--/, "") ?? row.flags,
6842
6880
  flags: row.flags.split(", "),
@@ -11190,6 +11228,22 @@ var gooseAgent = {
11190
11228
  }
11191
11229
  };
11192
11230
 
11231
+ // ../agent-defs/src/agents/pi.ts
11232
+ var piAgent = {
11233
+ id: "pi",
11234
+ name: "pi",
11235
+ aliases: ["pi-agent"],
11236
+ label: "Pi",
11237
+ summary: "Pi coding agent (spawn-only; uses local Pi auth/settings).",
11238
+ binaryName: "pi",
11239
+ branding: {
11240
+ colors: {
11241
+ dark: "#F2F2F2",
11242
+ light: "#242424"
11243
+ }
11244
+ }
11245
+ };
11246
+
11193
11247
  // ../agent-defs/src/agents/poe-agent.ts
11194
11248
  var poeAgentAgent = {
11195
11249
  id: "poe-agent",
@@ -11233,6 +11287,7 @@ var allAgents = Object.freeze([
11233
11287
  freezeAgent(openCodeAgent),
11234
11288
  freezeAgent(kimiAgent),
11235
11289
  freezeAgent(gooseAgent),
11290
+ freezeAgent(piAgent),
11236
11291
  freezeAgent(poeAgentAgent)
11237
11292
  ]);
11238
11293
  var lookup2 = /* @__PURE__ */ new Map();
@@ -14780,13 +14835,78 @@ function sleep2(ms) {
14780
14835
  // src/cli.ts
14781
14836
  configureTheme({ brand: "green", label: "Terminal Pilot" });
14782
14837
  function getBundledPackageVersion() {
14783
- return true ? "0.0.47" : void 0;
14784
- }
14838
+ return true ? "0.0.48" : void 0;
14839
+ }
14840
+ var pilotOptionsWithValues = /* @__PURE__ */ new Set([
14841
+ "--session",
14842
+ "-s",
14843
+ "--cwd",
14844
+ "--cols",
14845
+ "--rows",
14846
+ "--timeout",
14847
+ "-t",
14848
+ "--last",
14849
+ "-n",
14850
+ "--output",
14851
+ "-o",
14852
+ "--scope",
14853
+ "--padding",
14854
+ "-p",
14855
+ "--log-level",
14856
+ "--preset",
14857
+ "--signal"
14858
+ ]);
14785
14859
  function normalizeArgv(argv) {
14786
- if (argv.includes("--json") && !argv.some((argument) => argument === "--output" || argument.startsWith("--output="))) {
14787
- return argv.flatMap((argument) => argument === "--json" ? ["--output", "json"] : [argument]);
14860
+ if (!argv.includes("--json")) {
14861
+ return argv;
14862
+ }
14863
+ if (argv.some((argument) => argument === "--output" || argument.startsWith("--output="))) {
14864
+ return argv;
14865
+ }
14866
+ const normalized = [];
14867
+ let index = 0;
14868
+ let bareTokenCount = 0;
14869
+ let expectOptionValue = false;
14870
+ while (index < argv.length) {
14871
+ const token = argv[index];
14872
+ if (index < 2) {
14873
+ normalized.push(token);
14874
+ index += 1;
14875
+ continue;
14876
+ }
14877
+ if (token === "--") {
14878
+ normalized.push(token, ...argv.slice(index + 1));
14879
+ break;
14880
+ }
14881
+ if (expectOptionValue) {
14882
+ normalized.push(token);
14883
+ expectOptionValue = false;
14884
+ index += 1;
14885
+ continue;
14886
+ }
14887
+ if (token === "--json") {
14888
+ normalized.push("--output", "json");
14889
+ index += 1;
14890
+ continue;
14891
+ }
14892
+ if (token.startsWith("-") && token !== "-") {
14893
+ normalized.push(token);
14894
+ const optionName = token.includes("=") ? token.slice(0, token.indexOf("=")) : token;
14895
+ if (!token.includes("=") && (pilotOptionsWithValues.has(optionName) || optionName === "--debug" && argv[index + 1] !== void 0 && !argv[index + 1].startsWith("-"))) {
14896
+ expectOptionValue = true;
14897
+ }
14898
+ index += 1;
14899
+ continue;
14900
+ }
14901
+ bareTokenCount += 1;
14902
+ if (bareTokenCount >= 2) {
14903
+ normalized.push(...argv.slice(index));
14904
+ break;
14905
+ }
14906
+ normalized.push(token);
14907
+ index += 1;
14788
14908
  }
14789
- return argv;
14909
+ return normalized;
14790
14910
  }
14791
14911
  async function main(argv = process.argv, options = {}) {
14792
14912
  if (isTerminalPilotDaemonArgv(argv)) {