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
package/dist/cli.d.ts CHANGED
@@ -1,5 +1,10 @@
1
1
  #!/usr/bin/env node
2
2
  import type { TerminalPilotRuntime } from "./commands/runtime.js";
3
+ /**
4
+ * Rewrite pilot-level `--json` to toolcraft's `--output json`.
5
+ * Stop once create-session (and similar) child argv begins so nested tools keep their own `--json`.
6
+ */
7
+ export declare function normalizeArgv(argv: string[]): string[];
3
8
  export declare function main(argv?: string[], options?: {
4
9
  terminalPilotRuntime?: TerminalPilotRuntime;
5
10
  packageVersion?: string;
package/dist/cli.js CHANGED
@@ -1636,7 +1636,7 @@ function formatColumns(opts) {
1636
1636
  function formatCommandList(commands) {
1637
1637
  return formatColumns({
1638
1638
  rows: commands.map((cmd) => ({
1639
- left: text.command(cmd.name),
1639
+ left: `${" ".repeat((cmd.depth ?? 0) * 2)}${text.command(cmd.name)}`,
1640
1640
  right: cmd.description
1641
1641
  }))
1642
1642
  });
@@ -1773,7 +1773,7 @@ function formatColumns2(opts) {
1773
1773
  function formatCommandList2(commands) {
1774
1774
  return formatColumns2({
1775
1775
  rows: commands.map((cmd) => ({
1776
- left: cmd.name,
1776
+ left: `${" ".repeat((cmd.depth ?? 0) * 2)}${cmd.name}`,
1777
1777
  right: cmd.description
1778
1778
  }))
1779
1779
  });
@@ -6062,6 +6062,7 @@ function resolveCLIControls(controls) {
6062
6062
  validateOutputFormats(outputFormats);
6063
6063
  return {
6064
6064
  debug: controls?.debug === true,
6065
+ help: controls?.help === "concise" ? "concise" : "extended",
6065
6066
  logLevel: controls?.logLevel === true,
6066
6067
  output: controls?.output === true || typeof controls?.output === "object",
6067
6068
  outputFormats,
@@ -6558,11 +6559,31 @@ function formatCommandRowName(node, casing, globalLongOptionFlags) {
6558
6559
  const name = parameterTokens.length === 0 ? baseName : `${baseName} ${parameterTokens.join(" ")}`;
6559
6560
  return name;
6560
6561
  }
6561
- function formatCommandRows(group, scope, casing, globalLongOptionFlags) {
6562
- return getHelpChildren(group, scope).map((child) => ({
6563
- name: formatCommandRowName(child, casing, globalLongOptionFlags),
6564
- description: child.description ?? ""
6565
- }));
6562
+ function formatCommandRows(group, scope, casing, globalLongOptionFlags, help) {
6563
+ if (help === "concise") {
6564
+ return getHelpChildren(group, scope).map((child) => ({
6565
+ name: formatCommandRowName(child, casing, globalLongOptionFlags),
6566
+ description: child.description ?? "",
6567
+ kind: child.kind,
6568
+ depth: 0
6569
+ }));
6570
+ }
6571
+ const rows = [];
6572
+ const visit = (node, depth) => {
6573
+ for (const child of getHelpChildren(node, scope)) {
6574
+ rows.push({
6575
+ name: formatCommandRowName(child, casing, globalLongOptionFlags),
6576
+ description: child.description ?? "",
6577
+ kind: child.kind,
6578
+ depth
6579
+ });
6580
+ if (child.kind === "group") {
6581
+ visit(child, depth + 1);
6582
+ }
6583
+ }
6584
+ };
6585
+ visit(group, 0);
6586
+ return rows;
6566
6587
  }
6567
6588
  function formatGlobalOptionsLine(ctx) {
6568
6589
  const flags = [];
@@ -6650,7 +6671,13 @@ function renderGroupHelp(group, breadcrumb, scope, casing, globalOptions, rootUs
6650
6671
  globalOptions.showVersion,
6651
6672
  globalOptions.controls
6652
6673
  );
6653
- const commandRows = formatCommandRows(group, scope, casing, globalLongOptionFlags);
6674
+ const commandRows = formatCommandRows(
6675
+ group,
6676
+ scope,
6677
+ casing,
6678
+ globalLongOptionFlags,
6679
+ globalOptions.controls.help
6680
+ );
6654
6681
  if (commandRows.length > 0) {
6655
6682
  sections.push(`${text.sectionHeader("Commands")}
6656
6683
  ${formatHelpCommandList(commandRows)}`);
@@ -6739,7 +6766,13 @@ function renderJsonHelp(target, root, casing, globalOptions, rootUsageName) {
6739
6766
  );
6740
6767
  const node = target.node;
6741
6768
  if (node.kind === "group") {
6742
- const commandRows = formatCommandRows(node, "cli", casing, globalLongOptionFlags);
6769
+ const commandRows = formatCommandRows(
6770
+ node,
6771
+ "cli",
6772
+ casing,
6773
+ globalLongOptionFlags,
6774
+ globalOptions.controls.help
6775
+ );
6743
6776
  const isRoot = node === root;
6744
6777
  return `${JSON.stringify(
6745
6778
  {
@@ -6753,7 +6786,12 @@ function renderJsonHelp(target, root, casing, globalOptions, rootUsageName) {
6753
6786
  formatGroupUsageSuffix(node, "cli", casing, globalLongOptionFlags)
6754
6787
  ),
6755
6788
  ...node.description === void 0 ? {} : { description: node.description },
6756
- commands: commandRows.map((row) => ({ name: row.name, description: row.description })),
6789
+ commands: commandRows.map((row) => ({
6790
+ name: row.name,
6791
+ description: row.description,
6792
+ kind: row.kind,
6793
+ depth: row.depth
6794
+ })),
6757
6795
  options: isRoot ? collectSchemaGlobalFieldRows(node, "cli", casing, globalLongOptionFlags).map((row) => ({
6758
6796
  name: row.flags.split(/[ ,]+/)[0]?.replace(/^--/, "") ?? row.flags,
6759
6797
  flags: row.flags.split(", "),
@@ -11180,6 +11218,22 @@ var gooseAgent = {
11180
11218
  }
11181
11219
  };
11182
11220
 
11221
+ // ../agent-defs/src/agents/pi.ts
11222
+ var piAgent = {
11223
+ id: "pi",
11224
+ name: "pi",
11225
+ aliases: ["pi-agent"],
11226
+ label: "Pi",
11227
+ summary: "Pi coding agent (spawn-only; uses local Pi auth/settings).",
11228
+ binaryName: "pi",
11229
+ branding: {
11230
+ colors: {
11231
+ dark: "#F2F2F2",
11232
+ light: "#242424"
11233
+ }
11234
+ }
11235
+ };
11236
+
11183
11237
  // ../agent-defs/src/agents/poe-agent.ts
11184
11238
  var poeAgentAgent = {
11185
11239
  id: "poe-agent",
@@ -11223,6 +11277,7 @@ var allAgents = Object.freeze([
11223
11277
  freezeAgent(openCodeAgent),
11224
11278
  freezeAgent(kimiAgent),
11225
11279
  freezeAgent(gooseAgent),
11280
+ freezeAgent(piAgent),
11226
11281
  freezeAgent(poeAgentAgent)
11227
11282
  ]);
11228
11283
  var lookup2 = /* @__PURE__ */ new Map();
@@ -14770,13 +14825,78 @@ function sleep2(ms) {
14770
14825
  // src/cli.ts
14771
14826
  configureTheme({ brand: "green", label: "Terminal Pilot" });
14772
14827
  function getBundledPackageVersion() {
14773
- return true ? "0.0.47" : void 0;
14774
- }
14828
+ return true ? "0.0.48" : void 0;
14829
+ }
14830
+ var pilotOptionsWithValues = /* @__PURE__ */ new Set([
14831
+ "--session",
14832
+ "-s",
14833
+ "--cwd",
14834
+ "--cols",
14835
+ "--rows",
14836
+ "--timeout",
14837
+ "-t",
14838
+ "--last",
14839
+ "-n",
14840
+ "--output",
14841
+ "-o",
14842
+ "--scope",
14843
+ "--padding",
14844
+ "-p",
14845
+ "--log-level",
14846
+ "--preset",
14847
+ "--signal"
14848
+ ]);
14775
14849
  function normalizeArgv(argv) {
14776
- if (argv.includes("--json") && !argv.some((argument) => argument === "--output" || argument.startsWith("--output="))) {
14777
- return argv.flatMap((argument) => argument === "--json" ? ["--output", "json"] : [argument]);
14850
+ if (!argv.includes("--json")) {
14851
+ return argv;
14852
+ }
14853
+ if (argv.some((argument) => argument === "--output" || argument.startsWith("--output="))) {
14854
+ return argv;
14855
+ }
14856
+ const normalized = [];
14857
+ let index = 0;
14858
+ let bareTokenCount = 0;
14859
+ let expectOptionValue = false;
14860
+ while (index < argv.length) {
14861
+ const token = argv[index];
14862
+ if (index < 2) {
14863
+ normalized.push(token);
14864
+ index += 1;
14865
+ continue;
14866
+ }
14867
+ if (token === "--") {
14868
+ normalized.push(token, ...argv.slice(index + 1));
14869
+ break;
14870
+ }
14871
+ if (expectOptionValue) {
14872
+ normalized.push(token);
14873
+ expectOptionValue = false;
14874
+ index += 1;
14875
+ continue;
14876
+ }
14877
+ if (token === "--json") {
14878
+ normalized.push("--output", "json");
14879
+ index += 1;
14880
+ continue;
14881
+ }
14882
+ if (token.startsWith("-") && token !== "-") {
14883
+ normalized.push(token);
14884
+ const optionName = token.includes("=") ? token.slice(0, token.indexOf("=")) : token;
14885
+ if (!token.includes("=") && (pilotOptionsWithValues.has(optionName) || optionName === "--debug" && argv[index + 1] !== void 0 && !argv[index + 1].startsWith("-"))) {
14886
+ expectOptionValue = true;
14887
+ }
14888
+ index += 1;
14889
+ continue;
14890
+ }
14891
+ bareTokenCount += 1;
14892
+ if (bareTokenCount >= 2) {
14893
+ normalized.push(...argv.slice(index));
14894
+ break;
14895
+ }
14896
+ normalized.push(token);
14897
+ index += 1;
14778
14898
  }
14779
- return argv;
14899
+ return normalized;
14780
14900
  }
14781
14901
  async function main(argv = process.argv, options = {}) {
14782
14902
  if (isTerminalPilotDaemonArgv(argv)) {
@@ -14823,6 +14943,7 @@ if (await isDirectExecution(process.argv)) {
14823
14943
  await main();
14824
14944
  }
14825
14945
  export {
14826
- main
14946
+ main,
14947
+ normalizeArgv
14827
14948
  };
14828
14949
  //# sourceMappingURL=cli.js.map