terminal-pilot 0.0.42 → 0.0.43

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 (39) hide show
  1. package/README.md +7 -3
  2. package/dist/cli.js +99 -67
  3. package/dist/cli.js.map +4 -4
  4. package/dist/commands/index.js.map +2 -2
  5. package/dist/commands/install.js.map +2 -2
  6. package/dist/commands/installer.js.map +2 -2
  7. package/dist/commands/uninstall.js.map +2 -2
  8. package/dist/composition.json +35 -0
  9. package/dist/templates/terminal-pilot.md +1 -1
  10. package/dist/testing/cli-repl.js +99 -67
  11. package/dist/testing/cli-repl.js.map +4 -4
  12. package/dist/testing/qa-cli.js +99 -67
  13. package/dist/testing/qa-cli.js.map +4 -4
  14. package/node_modules/@poe-code/agent-defs/LICENSE +21 -0
  15. package/node_modules/@poe-code/agent-defs/package.json +12 -3
  16. package/node_modules/@poe-code/agent-skill-config/README.md +25 -17
  17. package/node_modules/@poe-code/agent-skill-config/dist/templates/poe-generate.md +16 -22
  18. package/node_modules/@poe-code/agent-skill-config/dist/templates/terminal-pilot.md +1 -1
  19. package/node_modules/@poe-code/agent-skill-config/package.json +1 -0
  20. package/node_modules/@poe-code/config-mutations/LICENSE +21 -0
  21. package/node_modules/@poe-code/config-mutations/README.md +8 -8
  22. package/node_modules/@poe-code/config-mutations/package.json +11 -2
  23. package/node_modules/@poe-code/frontmatter/LICENSE +21 -0
  24. package/node_modules/@poe-code/frontmatter/README.md +2 -2
  25. package/node_modules/@poe-code/frontmatter/package.json +11 -2
  26. package/node_modules/toolcraft-design/LICENSE +21 -0
  27. package/node_modules/toolcraft-design/README.md +8 -4
  28. package/node_modules/toolcraft-design/dist/dashboard/terminal.js +48 -6
  29. package/node_modules/toolcraft-design/dist/explorer/actions.d.ts +4 -0
  30. package/node_modules/toolcraft-design/dist/explorer/actions.js +1 -0
  31. package/node_modules/toolcraft-design/dist/explorer/events.d.ts +4 -0
  32. package/node_modules/toolcraft-design/dist/explorer/reducer.js +52 -4
  33. package/node_modules/toolcraft-design/dist/explorer/render/list.js +47 -20
  34. package/node_modules/toolcraft-design/dist/explorer/render/modal.js +13 -1
  35. package/node_modules/toolcraft-design/dist/explorer/render/test-fixtures.js +1 -1
  36. package/node_modules/toolcraft-design/dist/explorer/runtime.js +3 -0
  37. package/node_modules/toolcraft-design/dist/explorer/state.d.ts +9 -0
  38. package/node_modules/toolcraft-design/package.json +3 -2
  39. package/package.json +1 -1
@@ -0,0 +1,35 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "packages": [
4
+ {
5
+ "name": "@poe-code/agent-defs",
6
+ "version": "0.0.1",
7
+ "license": "MIT"
8
+ },
9
+ {
10
+ "name": "@poe-code/agent-skill-config",
11
+ "version": "0.0.1",
12
+ "license": "MIT"
13
+ },
14
+ {
15
+ "name": "@poe-code/config-mutations",
16
+ "version": "0.0.1",
17
+ "license": "MIT"
18
+ },
19
+ {
20
+ "name": "@poe-code/frontmatter",
21
+ "version": "0.0.1",
22
+ "license": "MIT"
23
+ },
24
+ {
25
+ "name": "terminal-pilot",
26
+ "version": "0.0.43",
27
+ "license": "MIT"
28
+ },
29
+ {
30
+ "name": "toolcraft-design",
31
+ "version": "0.0.2",
32
+ "license": "MIT"
33
+ }
34
+ ]
35
+ }
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: terminal-pilot
3
- description: 'Terminal automation skill using the terminal-pilot CLI'
3
+ description: "Terminal automation skill using the terminal-pilot CLI"
4
4
  ---
5
5
 
6
6
  # Terminal Pilot
@@ -93,7 +93,7 @@ var globalWithRequire = globalThis;
93
93
  globalWithRequire.require ??= createRequire(path.join(process.cwd(), "package.json"));
94
94
 
95
95
  // ../toolcraft/src/cli.ts
96
- import { access, lstat, readFile, rename, unlink, writeFile as writeFile2 } from "node:fs/promises";
96
+ import { readFile as readFile2 } from "node:fs/promises";
97
97
  import path5 from "node:path";
98
98
  import {
99
99
  Command as CommanderCommand,
@@ -4658,6 +4658,12 @@ function buildReport(context) {
4658
4658
  return `${lines.join("\n")}
4659
4659
  `;
4660
4660
  }
4661
+ function renderErrorReport(context) {
4662
+ return {
4663
+ content: buildReport(context),
4664
+ redactedKeys: commandSecretEnvNames(context.command?.secrets)
4665
+ };
4666
+ }
4661
4667
  async function writeErrorReport(context) {
4662
4668
  const env = context.env ?? process.env;
4663
4669
  if (!reportsEnabled(context.errorReports, env) || isSkippedError(context.error)) {
@@ -4671,7 +4677,7 @@ async function writeErrorReport(context) {
4671
4677
  if (reportDirMustStayWithinProject(context.errorReports)) {
4672
4678
  await assertReportDirWithinProject(projectRoot, reportDir);
4673
4679
  }
4674
- await writeFile(absolutePath, buildReport(context));
4680
+ await writeFile(absolutePath, renderErrorReport(context).content);
4675
4681
  return {
4676
4682
  absolutePath,
4677
4683
  displayPath: relativeDisplayPath(projectRoot, absolutePath)
@@ -5269,8 +5275,8 @@ function throwValidationErrors(errors) {
5269
5275
  ${rendered.join("\n")}`);
5270
5276
  }
5271
5277
 
5272
- // ../toolcraft/src/cli.ts
5273
- configureTheme({ brand: "blue", label: "Toolcraft" });
5278
+ // ../toolcraft/src/runtime/io.ts
5279
+ import { access, lstat, readFile, rename, unlink, writeFile as writeFile2 } from "node:fs/promises";
5274
5280
  var RESERVED_SERVICE_NAMES = /* @__PURE__ */ new Set([
5275
5281
  "params",
5276
5282
  "secrets",
@@ -5283,6 +5289,47 @@ var RESERVED_SERVICE_NAMES = /* @__PURE__ */ new Set([
5283
5289
  "root"
5284
5290
  ]);
5285
5291
  var RESERVED_SERVICE_NAMES_MESSAGE = "Available reserved names: params, secrets, fetch, fs, env, diagnostics, progress, runtimeOptions, root.";
5292
+ function createFs(fs4) {
5293
+ if (fs4 !== void 0) {
5294
+ return fs4;
5295
+ }
5296
+ return {
5297
+ readFile: async (path17, encoding = "utf8") => readFile(path17, { encoding }),
5298
+ writeFile: async (path17, contents, options) => {
5299
+ await writeFile2(path17, contents, options);
5300
+ },
5301
+ exists: async (path17) => {
5302
+ try {
5303
+ await access(path17);
5304
+ return true;
5305
+ } catch {
5306
+ return false;
5307
+ }
5308
+ },
5309
+ lstat: async (path17) => lstat(path17),
5310
+ rename: async (fromPath, toPath) => rename(fromPath, toPath),
5311
+ unlink: async (path17) => unlink(path17)
5312
+ };
5313
+ }
5314
+ function createEnv(values = process.env) {
5315
+ return {
5316
+ get(key) {
5317
+ return values[key];
5318
+ }
5319
+ };
5320
+ }
5321
+ function validateServices(services) {
5322
+ for (const name of Object.keys(services)) {
5323
+ if (RESERVED_SERVICE_NAMES.has(name)) {
5324
+ throw new Error(
5325
+ `Service name "${name}" is reserved. Choose a different name. ${RESERVED_SERVICE_NAMES_MESSAGE}`
5326
+ );
5327
+ }
5328
+ }
5329
+ }
5330
+
5331
+ // ../toolcraft/src/cli.ts
5332
+ configureTheme({ brand: "blue", label: "Toolcraft" });
5286
5333
  var NULL_OPTION_VALUE = /* @__PURE__ */ Symbol("toolcraft.cli.null");
5287
5334
  var optionalModulePaths = {
5288
5335
  approvals: "./human-in-loop/approvals-commands.js",
@@ -7091,32 +7138,6 @@ async function withOutputFormat2(output, fn) {
7091
7138
  resetOutputFormatCache();
7092
7139
  }
7093
7140
  }
7094
- function createFs() {
7095
- return {
7096
- readFile: async (path17, encoding = "utf8") => readFile(path17, { encoding }),
7097
- writeFile: async (path17, contents, options) => {
7098
- await writeFile2(path17, contents, options);
7099
- },
7100
- exists: async (path17) => {
7101
- try {
7102
- await access(path17);
7103
- return true;
7104
- } catch {
7105
- return false;
7106
- }
7107
- },
7108
- lstat: async (path17) => lstat(path17),
7109
- rename: async (fromPath, toPath) => rename(fromPath, toPath),
7110
- unlink: async (path17) => unlink(path17)
7111
- };
7112
- }
7113
- function createEnv(values = process.env) {
7114
- return {
7115
- get(key) {
7116
- return values[key];
7117
- }
7118
- };
7119
- }
7120
7141
  function isPlainObject4(value) {
7121
7142
  return typeof value === "object" && value !== null && !Array.isArray(value);
7122
7143
  }
@@ -7228,7 +7249,7 @@ function validatePresetFieldValue(value, field, presetPath) {
7228
7249
  async function loadPresetValues(fields, presetPath) {
7229
7250
  let rawPreset;
7230
7251
  try {
7231
- rawPreset = await readFile(presetPath, {
7252
+ rawPreset = await readFile2(presetPath, {
7232
7253
  encoding: "utf8"
7233
7254
  });
7234
7255
  } catch (error3) {
@@ -7495,7 +7516,7 @@ async function loadFixtureScenario(command, selector) {
7495
7516
  const fixturePath = resolveFixturePath(commandPath);
7496
7517
  let rawFixture;
7497
7518
  try {
7498
- rawFixture = await readFile(fixturePath, {
7519
+ rawFixture = await readFile2(fixturePath, {
7499
7520
  encoding: "utf8"
7500
7521
  });
7501
7522
  } catch {
@@ -7532,16 +7553,16 @@ function createFixtureEnvValues(command) {
7532
7553
  }
7533
7554
  return values;
7534
7555
  }
7535
- async function resolveFixtureRuntime(command, services, requirementOptions, runtimeFetch) {
7556
+ async function resolveFixtureRuntime(command, services, requirementOptions, runtimeFetch, runtimeEnv, runtimeFs) {
7536
7557
  const selector = process.env.TOOLCRAFT_FIXTURE;
7537
7558
  if (selector === void 0 || selector.length === 0) {
7538
7559
  return {
7539
- env: createEnv(),
7560
+ env: createEnv(runtimeEnv),
7540
7561
  fetch: runtimeFetch,
7541
- fs: createFs(),
7562
+ fs: createFs(runtimeFs),
7542
7563
  isFixture: false,
7543
7564
  requirementOptions,
7544
- secrets: resolveCommandSecrets(command),
7565
+ secrets: resolveCommandSecrets(command, runtimeEnv),
7545
7566
  services
7546
7567
  };
7547
7568
  }
@@ -7589,8 +7610,8 @@ function renderApprovalDeclined(error3) {
7589
7610
  logger2.error(error3.message);
7590
7611
  process.exitCode = 1;
7591
7612
  }
7592
- function renderCliErrorPattern(pattern) {
7593
- const logger2 = createLogger();
7613
+ function renderCliErrorPattern(pattern, outputEmitter) {
7614
+ const logger2 = createLogger(outputEmitter);
7594
7615
  if (pattern.kind === "usage") {
7595
7616
  logger2.error(
7596
7617
  appendUsagePointer(pattern.message, {
@@ -7640,15 +7661,6 @@ This is a bug in toolcraft or in the command definition; it cannot be worked aro
7640
7661
  }
7641
7662
  process.exitCode = 1;
7642
7663
  }
7643
- function validateServices(services) {
7644
- for (const name of Object.keys(services)) {
7645
- if (RESERVED_SERVICE_NAMES.has(name)) {
7646
- throw new Error(
7647
- `Service name "${name}" is reserved. Choose a different name. ${RESERVED_SERVICE_NAMES_MESSAGE}`
7648
- );
7649
- }
7650
- }
7651
- }
7652
7664
  function getNestedValue(target, path17) {
7653
7665
  return path17.reduce(
7654
7666
  (current, segment) => current !== null && typeof current === "object" ? current[segment] : void 0,
@@ -8281,8 +8293,8 @@ function getResolvedFlags(command) {
8281
8293
  const flags = command.optsWithGlobals();
8282
8294
  return flags;
8283
8295
  }
8284
- async function executeCommand(state, services, requirementOptions, runtimeFetch, runtimeOptions, diagnosticsOptions, onErrorReportContext) {
8285
- const logger2 = createLogger();
8296
+ async function executeCommand(state, services, requirementOptions, runtimeFetch, runtimeOptions, runtimeEnv, runtimeFs, outputEmitter, diagnosticsOptions, onErrorReportContext) {
8297
+ const logger2 = createLogger(outputEmitter);
8286
8298
  const primitives = {
8287
8299
  logger: logger2,
8288
8300
  renderTable,
@@ -8301,7 +8313,9 @@ async function executeCommand(state, services, requirementOptions, runtimeFetch,
8301
8313
  state.command,
8302
8314
  services,
8303
8315
  requirementOptions,
8304
- runtimeFetch
8316
+ runtimeFetch,
8317
+ runtimeEnv,
8318
+ runtimeFs
8305
8319
  );
8306
8320
  const preflightContext = {
8307
8321
  ...runtime.services,
@@ -8369,7 +8383,13 @@ async function executeCommand(state, services, requirementOptions, runtimeFetch,
8369
8383
  renderHumanInLoopPending(result);
8370
8384
  return;
8371
8385
  }
8372
- const renderStatus = renderResult(state.command, result, output, primitives);
8386
+ const renderStatus = renderResult(
8387
+ state.command,
8388
+ result,
8389
+ output,
8390
+ primitives,
8391
+ outputEmitter === void 0 ? void 0 : (chunk) => outputEmitter(chunk.endsWith("\n") ? chunk.slice(0, -1) : chunk)
8392
+ );
8373
8393
  if (renderStatus.mcpError) {
8374
8394
  process.exitCode = 1;
8375
8395
  }
@@ -8581,7 +8601,7 @@ function renderHttpError(error3, options) {
8581
8601
  }
8582
8602
  }
8583
8603
  async function handleRunError(error3, options) {
8584
- const logger2 = createLogger();
8604
+ const logger2 = createLogger(options.outputEmitter);
8585
8605
  await withOutputFormat2(options.output, async () => {
8586
8606
  if (error3 instanceof UserError) {
8587
8607
  renderCliErrorPattern(
@@ -8597,16 +8617,20 @@ async function handleRunError(error3, options) {
8597
8617
  } : {
8598
8618
  kind: "runtime-user",
8599
8619
  message: error3.message
8600
- }
8620
+ },
8621
+ options.outputEmitter
8601
8622
  );
8602
8623
  return;
8603
8624
  }
8604
8625
  if (error3 instanceof Error && error3.name === "ToolcraftBugError") {
8605
- renderCliErrorPattern({
8606
- kind: "toolcraft-bug",
8607
- error: error3,
8608
- debugStackMode: options.debugStackMode
8609
- });
8626
+ renderCliErrorPattern(
8627
+ {
8628
+ kind: "toolcraft-bug",
8629
+ error: error3,
8630
+ debugStackMode: options.debugStackMode
8631
+ },
8632
+ options.outputEmitter
8633
+ );
8610
8634
  return;
8611
8635
  }
8612
8636
  if (error3 instanceof CommanderError2) {
@@ -8650,12 +8674,15 @@ async function handleRunError(error3, options) {
8650
8674
  return;
8651
8675
  }
8652
8676
  const message2 = error3 instanceof Error ? error3.message : String(error3);
8653
- renderCliErrorPattern({
8654
- kind: "unexpected",
8655
- message: message2,
8656
- stack: error3 instanceof Error ? error3.stack : void 0,
8657
- debugStackMode: options.debugStackMode
8658
- });
8677
+ renderCliErrorPattern(
8678
+ {
8679
+ kind: "unexpected",
8680
+ message: message2,
8681
+ stack: error3 instanceof Error ? error3.stack : void 0,
8682
+ debugStackMode: options.debugStackMode
8683
+ },
8684
+ options.outputEmitter
8685
+ );
8659
8686
  });
8660
8687
  }
8661
8688
  function formatCommanderErrorMessage(error3) {
@@ -8931,7 +8958,8 @@ async function runCLI(roots, options = {}) {
8931
8958
  root
8932
8959
  };
8933
8960
  const requirementOptions = {
8934
- apiVersion: options.apiVersion
8961
+ apiVersion: options.apiVersion,
8962
+ env: options.env
8935
8963
  };
8936
8964
  validateServices(services);
8937
8965
  if (hasHelpFlag(argv)) {
@@ -8973,6 +9001,9 @@ async function runCLI(roots, options = {}) {
8973
9001
  requirementOptions,
8974
9002
  runtimeFetch,
8975
9003
  runtimeOptions,
9004
+ options.env,
9005
+ options.fs,
9006
+ options.outputEmitter,
8976
9007
  {
8977
9008
  logLevel: options.logLevel,
8978
9009
  logger: options.logger,
@@ -9048,6 +9079,7 @@ async function runCLI(roots, options = {}) {
9048
9079
  argv,
9049
9080
  rootUsageName,
9050
9081
  commandPath: resolvedCommandPath,
9082
+ outputEmitter: options.outputEmitter,
9051
9083
  userErrorPattern: errorReportContext?.params === void 0 ? userErrorPattern : "runtime-user"
9052
9084
  });
9053
9085
  }
@@ -12254,7 +12286,7 @@ function hasOwnErrorCode4(error3, code) {
12254
12286
  }
12255
12287
 
12256
12288
  // ../agent-skill-config/src/templates.ts
12257
- import { readFile as readFile2, stat } from "node:fs/promises";
12289
+ import { readFile as readFile3, stat } from "node:fs/promises";
12258
12290
  import path9 from "node:path";
12259
12291
  import { fileURLToPath as fileURLToPath3 } from "node:url";
12260
12292
 
@@ -14378,7 +14410,7 @@ function sleep2(ms) {
14378
14410
  // src/cli.ts
14379
14411
  configureTheme({ brand: "green", label: "Terminal Pilot" });
14380
14412
  function getBundledPackageVersion() {
14381
- return true ? "0.0.42" : void 0;
14413
+ return true ? "0.0.43" : void 0;
14382
14414
  }
14383
14415
  function normalizeArgv(argv) {
14384
14416
  if (argv.includes("--json") && !argv.some((argument) => argument === "--output" || argument.startsWith("--output="))) {