poe-code 3.0.398 → 3.0.399

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.
package/dist/index.js CHANGED
@@ -96961,19 +96961,251 @@ var init_install2 = __esm({
96961
96961
  }
96962
96962
  });
96963
96963
 
96964
- // src/cli/commands/test.ts
96964
+ // src/utils/command-checks.ts
96965
+ function formatCommandRunnerResult(result) {
96966
+ const stdout = result.stdout.length > 0 ? result.stdout : "<empty>";
96967
+ const stderr = result.stderr.length > 0 ? result.stderr : "<empty>";
96968
+ return `stdout:
96969
+ ${stdout}
96970
+ stderr:
96971
+ ${stderr}`;
96972
+ }
96973
+ var init_command_checks = __esm({
96974
+ "src/utils/command-checks.ts"() {
96975
+ "use strict";
96976
+ init_src17();
96977
+ init_src12();
96978
+ }
96979
+ });
96980
+
96981
+ // src/services/version.ts
96982
+ import semver from "semver";
96983
+ async function checkForUpdate(options) {
96984
+ const { currentVersion, httpClient } = options;
96985
+ try {
96986
+ const response = await httpClient("https://registry.npmjs.org/poe-code", {
96987
+ method: "GET",
96988
+ headers: { Accept: "application/json" }
96989
+ });
96990
+ if (!response.ok) {
96991
+ return null;
96992
+ }
96993
+ const data = await response.json();
96994
+ const latestVersion = data?.["dist-tags"]?.latest;
96995
+ if (typeof latestVersion !== "string" || !semver.valid(latestVersion)) {
96996
+ return null;
96997
+ }
96998
+ const updateAvailable = semver.gt(latestVersion, currentVersion);
96999
+ return {
97000
+ currentVersion,
97001
+ latestVersion,
97002
+ updateAvailable
97003
+ };
97004
+ } catch {
97005
+ return null;
97006
+ }
97007
+ }
97008
+ var init_version = __esm({
97009
+ "src/services/version.ts"() {
97010
+ "use strict";
97011
+ }
97012
+ });
97013
+
97014
+ // src/services/update.ts
97015
+ function detectPoeCodePackageManager(env) {
97016
+ const userAgent = env.npm_config_user_agent ?? "";
97017
+ const userAgentManager = userAgent.split(" ")[0]?.split("/")[0];
97018
+ const normalizedUserAgentManager = normalizePackageManager(userAgentManager);
97019
+ if (normalizedUserAgentManager) {
97020
+ return normalizedUserAgentManager;
97021
+ }
97022
+ const execPath = env.npm_execpath ?? "";
97023
+ const execPathManager = detectPackageManagerFromPath(execPath);
97024
+ return execPathManager ?? "npm";
97025
+ }
97026
+ function createPoeCodeUpdatePlan(options) {
97027
+ const packageManager = options.packageManager ?? detectPoeCodePackageManager(options.env ?? {});
97028
+ if (packageManager === "bun") {
97029
+ return {
97030
+ packageManager,
97031
+ command: "bun",
97032
+ args: ["install", "-g", POE_CODE_PACKAGE]
97033
+ };
97034
+ }
97035
+ if (packageManager === "pnpm") {
97036
+ return {
97037
+ packageManager,
97038
+ command: "pnpm",
97039
+ args: ["add", "-g", POE_CODE_PACKAGE]
97040
+ };
97041
+ }
97042
+ if (packageManager === "yarn") {
97043
+ return {
97044
+ packageManager,
97045
+ command: "yarn",
97046
+ args: ["global", "add", POE_CODE_PACKAGE]
97047
+ };
97048
+ }
97049
+ return {
97050
+ packageManager,
97051
+ command: "npm",
97052
+ args: ["install", "-g", POE_CODE_PACKAGE]
97053
+ };
97054
+ }
97055
+ async function updatePoeCode(options) {
97056
+ const plan = createPoeCodeUpdatePlan({
97057
+ packageManager: options.packageManager,
97058
+ env: options.env
97059
+ });
97060
+ const shouldCheckVersion = options.checkVersion !== false;
97061
+ const version = shouldCheckVersion ? await checkForUpdate({
97062
+ currentVersion: options.currentVersion,
97063
+ httpClient: options.httpClient
97064
+ }) : null;
97065
+ if (version && !version.updateAvailable && options.force !== true) {
97066
+ return {
97067
+ status: "current",
97068
+ plan,
97069
+ version
97070
+ };
97071
+ }
97072
+ const result = await options.runCommand(plan.command, plan.args);
97073
+ if (result.exitCode !== 0) {
97074
+ throw new Error(
97075
+ [
97076
+ `poe-code update failed with exit code ${result.exitCode}: ${formatPoeCodeUpdateCommand(plan)}`,
97077
+ formatCommandRunnerResult(result)
97078
+ ].join("\n")
97079
+ );
97080
+ }
97081
+ return {
97082
+ status: "updated",
97083
+ plan,
97084
+ version
97085
+ };
97086
+ }
97087
+ function formatPoeCodeUpdateCommand(plan) {
97088
+ return [plan.command, ...plan.args].map(quoteCommandPart).join(" ");
97089
+ }
97090
+ function normalizePackageManager(value) {
97091
+ if (value === "npm" || value === "bun" || value === "pnpm" || value === "yarn") {
97092
+ return value;
97093
+ }
97094
+ return void 0;
97095
+ }
97096
+ function detectPackageManagerFromPath(value) {
97097
+ const lower = value.toLowerCase();
97098
+ if (lower.includes("bun")) {
97099
+ return "bun";
97100
+ }
97101
+ if (lower.includes("pnpm")) {
97102
+ return "pnpm";
97103
+ }
97104
+ if (lower.includes("yarn")) {
97105
+ return "yarn";
97106
+ }
97107
+ if (lower.includes("npm")) {
97108
+ return "npm";
97109
+ }
97110
+ return void 0;
97111
+ }
97112
+ function quoteCommandPart(value) {
97113
+ if (value.length === 0) {
97114
+ return '""';
97115
+ }
97116
+ if (!needsQuoting(value)) {
97117
+ return value;
97118
+ }
97119
+ return `"${value.replaceAll('"', '\\"')}"`;
97120
+ }
97121
+ function needsQuoting(value) {
97122
+ return value.includes(" ") || value.includes(" ") || value.includes("\n");
97123
+ }
97124
+ var POE_CODE_PACKAGE;
97125
+ var init_update = __esm({
97126
+ "src/services/update.ts"() {
97127
+ "use strict";
97128
+ init_command_checks();
97129
+ init_version();
97130
+ POE_CODE_PACKAGE = "poe-code@latest";
97131
+ }
97132
+ });
97133
+
97134
+ // src/cli/commands/update.ts
96965
97135
  import { Option as Option4 } from "commander";
97136
+ function registerUpdateCommand(program, container, currentVersion) {
97137
+ return program.command("update").description("Update poe-code to the latest published version.").option("--force", "Run the installer even when poe-code is already current.").option("--no-version-check", "Skip the npm registry version check before updating.").addOption(
97138
+ new Option4("--package-manager <manager>", "Override package manager detection.").choices([
97139
+ "npm",
97140
+ "bun",
97141
+ "pnpm",
97142
+ "yarn"
97143
+ ])
97144
+ ).action(async (options) => {
97145
+ await executeUpdate(program, container, currentVersion, options);
97146
+ });
97147
+ }
97148
+ async function executeUpdate(program, container, currentVersion, options) {
97149
+ const flags = resolveCommandFlags(program);
97150
+ const resources = createExecutionResources(container, flags, "update");
97151
+ const plan = createPoeCodeUpdatePlan({
97152
+ packageManager: options.packageManager,
97153
+ env: container.env.variables
97154
+ });
97155
+ resources.logger.intro("update");
97156
+ resources.logger.resolved("Command", formatPoeCodeUpdateCommand(plan));
97157
+ if (flags.dryRun) {
97158
+ resources.logger.dryRun(`Dry run: would run ${formatPoeCodeUpdateCommand(plan)}.`);
97159
+ return;
97160
+ }
97161
+ const result = await withSpinner({
97162
+ message: "Updating poe-code...",
97163
+ fn: () => updatePoeCode({
97164
+ currentVersion,
97165
+ httpClient: container.httpClient,
97166
+ runCommand: resources.context.runCommand,
97167
+ env: container.env.variables,
97168
+ packageManager: options.packageManager,
97169
+ force: options.force,
97170
+ checkVersion: options.versionCheck
97171
+ })
97172
+ });
97173
+ if (result.status === "current") {
97174
+ resources.logger.success(`poe-code is already up to date (${currentVersion}).`);
97175
+ resources.context.finalize();
97176
+ return;
97177
+ }
97178
+ if (options.versionCheck !== false && result.version === null) {
97179
+ resources.logger.warn("Could not check the npm registry; ran the installer anyway.");
97180
+ }
97181
+ const latestVersion = result.version?.latestVersion;
97182
+ resources.logger.success(
97183
+ latestVersion ? `Updated poe-code to ${latestVersion}.` : "Updated poe-code."
97184
+ );
97185
+ resources.context.finalize();
97186
+ }
97187
+ var init_update2 = __esm({
97188
+ "src/cli/commands/update.ts"() {
97189
+ "use strict";
97190
+ init_src2();
97191
+ init_shared();
97192
+ init_update();
97193
+ }
97194
+ });
97195
+
97196
+ // src/cli/commands/test.ts
97197
+ import { Option as Option5 } from "commander";
96966
97198
  function registerTestCommand(program, container) {
96967
97199
  const serviceNames = container.registry.list().filter((service) => typeof service.test === "function");
96968
97200
  const serviceDescription = `Agent to test${formatServiceList(listServiceNames(serviceNames))}`;
96969
97201
  return program.command("test").description("Run agent health checks.").argument("[agent]", serviceDescription).option("--isolated", "Run the health check using isolated configuration.").option("--model <model>", "Model override passed to the agent for the health check").option("--hooks-from <agentId>", "Agent hook configuration to bridge for this health check").addOption(
96970
- new Option4("--hooks-strategy <strategy>", "Hook bridge strategy (default: auto)").choices([
97202
+ new Option5("--hooks-strategy <strategy>", "Hook bridge strategy (default: auto)").choices([
96971
97203
  "auto",
96972
97204
  "symlink",
96973
97205
  "transform"
96974
97206
  ])
96975
97207
  ).addOption(
96976
- new Option4("--hooks-scope <scope>", "Hook bridge scope (default: merged)").choices([
97208
+ new Option5("--hooks-scope <scope>", "Hook bridge scope (default: merged)").choices([
96977
97209
  "project",
96978
97210
  "user",
96979
97211
  "merged"
@@ -97422,39 +97654,6 @@ var init_skill = __esm({
97422
97654
  }
97423
97655
  });
97424
97656
 
97425
- // src/services/version.ts
97426
- import semver from "semver";
97427
- async function checkForUpdate(options) {
97428
- const { currentVersion, httpClient } = options;
97429
- try {
97430
- const response = await httpClient("https://registry.npmjs.org/poe-code", {
97431
- method: "GET",
97432
- headers: { Accept: "application/json" }
97433
- });
97434
- if (!response.ok) {
97435
- return null;
97436
- }
97437
- const data = await response.json();
97438
- const latestVersion = data?.["dist-tags"]?.latest;
97439
- if (typeof latestVersion !== "string" || !semver.valid(latestVersion)) {
97440
- return null;
97441
- }
97442
- const updateAvailable = semver.gt(latestVersion, currentVersion);
97443
- return {
97444
- currentVersion,
97445
- latestVersion,
97446
- updateAvailable
97447
- };
97448
- } catch {
97449
- return null;
97450
- }
97451
- }
97452
- var init_version = __esm({
97453
- "src/services/version.ts"() {
97454
- "use strict";
97455
- }
97456
- });
97457
-
97458
97657
  // src/cli/exit-signals.ts
97459
97658
  var VersionExit;
97460
97659
  var init_exit_signals = __esm({
@@ -97796,7 +97995,7 @@ var init_usage = __esm({
97796
97995
  });
97797
97996
 
97798
97997
  // src/cli/commands/models.ts
97799
- import { Option as Option5 } from "commander";
97998
+ import { Option as Option6 } from "commander";
97800
97999
  import parseDuration2 from "parse-duration";
97801
98000
  import { stringify as yamlStringify } from "yaml";
97802
98001
  function formatTokenCount(tokens) {
@@ -97943,7 +98142,7 @@ function writeYaml(value) {
97943
98142
  }
97944
98143
  function registerModelsCommand(program, container) {
97945
98144
  program.command("models").alias("m").description("List available Poe API models.").option("--provider <name>", "Filter by provider name").option("--model <name>", "Filter by exact model id").option("--search <term>", "Search model id and provider name").option("--feature <name>", "Filter by feature (tools, web_search, reasoning)").option("--endpoint <path>", "Filter by supported endpoint (e.g. /v1/responses)").option("--input <modalities>", "Filter by input modalities (e.g. text,image)").option("--output <modalities>", "Filter by output modalities (e.g. text)").option("--tools", "Show only models with tool support").option("--since <duration>", "Show models added within duration (e.g. 7d, 2w, 3mo)").addOption(
97946
- new Option5(
98145
+ new Option6(
97947
98146
  "--view <name>",
97948
98147
  "Table view: capabilities, pricing, parameters, or raw"
97949
98148
  ).choices(Array.from(modelViewNames)).default("capabilities")
@@ -101009,7 +101208,7 @@ var init_experiment3 = __esm({
101009
101208
  });
101010
101209
 
101011
101210
  // src/cli/commands/launch.ts
101012
- import { Option as Option6 } from "commander";
101211
+ import { Option as Option7 } from "commander";
101013
101212
  function registerLaunchCommand(program, container) {
101014
101213
  const launch = program.command("launch").description("Manage long-running host and Docker processes.").addHelpCommand(false);
101015
101214
  launch.command("start").usage("<id> -- <command> [args...]").description("Start and supervise a managed process.").argument("[id]", "Managed process identifier").argument("[command...]", "Command and arguments to run after --").addOption(createChoiceOption("--restart <policy>", "Restart policy", ["never", "on-failure", "always"], "on-failure")).option("--max-restarts <n>", "Max consecutive restarts", "5").option("--ready-pattern <string>", "Log substring to wait for before reporting running").option("--ready-port <port>", "TCP port to probe for readiness").option("--cwd <dir>", "Working directory for the managed process").option("--env <entry>", "Environment variable (KEY=VALUE)", collectValues, []).option("--image <image>", "Docker image").option("--mount <src:target[:ro]>", "Docker bind mount", collectValues, []).option("--port <host:container>", "Docker port mapping", collectValues, []).option("--network <name>", "Docker network").addOption(createChoiceOption("--engine <engine>", "Container engine", ["docker", "podman"])).action(async function(id, commandArgs) {
@@ -101475,7 +101674,7 @@ function formatUptime(state) {
101475
101674
  return `${seconds}s`;
101476
101675
  }
101477
101676
  function createChoiceOption(flags, description, choices2, defaultValue) {
101478
- const option = new Option6(flags, description).choices(choices2);
101677
+ const option = new Option7(flags, description).choices(choices2);
101479
101678
  if (defaultValue !== void 0) {
101480
101679
  option.default(defaultValue);
101481
101680
  }
@@ -105531,9 +105730,9 @@ var init_shared2 = __esm({
105531
105730
  });
105532
105731
 
105533
105732
  // src/cli/commands/runtime/init.ts
105534
- import { Option as Option7 } from "commander";
105733
+ import { Option as Option8 } from "commander";
105535
105734
  function registerRuntimeInitCommand(runtime, root, container) {
105536
- runtime.command("init").description("Initialize project runtime configuration.").addOption(new Option7("--type <type>", "Runtime backend").choices(["host", "docker", "e2b"])).option("--no-dockerfile", "Do not create .poe-code/Dockerfile.").action(async (options) => {
105735
+ runtime.command("init").description("Initialize project runtime configuration.").addOption(new Option8("--type <type>", "Runtime backend").choices(["host", "docker", "e2b"])).option("--no-dockerfile", "Do not create .poe-code/Dockerfile.").action(async (options) => {
105537
105736
  await executeRuntimeInit(root, container, options);
105538
105737
  });
105539
105738
  }
@@ -138733,7 +138932,7 @@ var init_tasks2 = __esm({
138733
138932
 
138734
138933
  // src/cli/commands/gaslight.ts
138735
138934
  import path177 from "node:path";
138736
- import { Option as Option8 } from "commander";
138935
+ import { Option as Option9 } from "commander";
138737
138936
  function resolveConfiguredPath(cwd, homeDir, value) {
138738
138937
  if (value.startsWith("~/")) {
138739
138938
  return path177.join(homeDir, value.slice(2));
@@ -138928,7 +139127,7 @@ async function scaffoldConfig(container, scope, force, dryRun) {
138928
139127
  }
138929
139128
  function registerGaslightCommand(program, container) {
138930
139129
  const gaslight = program.command("gaslight").description("Run a plan through a resumable sequence of agent follow-ups.").argument("[plan-path]", "Markdown plan to implement").option("--agent <agent>", "Agent to run").option("--config <path>", "gaslight.yaml variant to use").option("--model <model>", "Model to run").option("--plans <paths...>", "Markdown plans to run sequentially").addOption(
138931
- new Option8("--mode <mode>", "Spawn mode").choices(["read", "edit", "yolo", "auto"]).default("auto")
139130
+ new Option9("--mode <mode>", "Spawn mode").choices(["read", "edit", "yolo", "auto"]).default("auto")
138932
139131
  ).action(async function(providedPlanPath) {
138933
139132
  const flags = resolveCommandFlags(program);
138934
139133
  const options = this.opts();
@@ -139055,7 +139254,7 @@ var init_package2 = __esm({
139055
139254
  "package.json"() {
139056
139255
  package_default2 = {
139057
139256
  name: "poe-code",
139058
- version: "3.0.398",
139257
+ version: "3.0.399",
139059
139258
  description: "CLI tool to configure Poe API for developer workflows.",
139060
139259
  type: "module",
139061
139260
  main: "./dist/index.js",
@@ -139374,7 +139573,7 @@ __export(program_exports, {
139374
139573
  createProgram: () => createProgram
139375
139574
  });
139376
139575
  import { basename as basename9, join as join16 } from "node:path";
139377
- import { Command as Command3, InvalidArgumentError as InvalidArgumentError3, Option as Option9 } from "commander";
139576
+ import { Command as Command3, InvalidArgumentError as InvalidArgumentError3, Option as Option10 } from "commander";
139378
139577
  function formatCommandHeader(cmd) {
139379
139578
  const parts = [];
139380
139579
  let current = cmd;
@@ -139667,7 +139866,7 @@ function registerMaestroCommand(program, container) {
139667
139866
  "--yes",
139668
139867
  maestroCommandSchema.shape.yes.inner.description ?? "Accept defaults non-interactively"
139669
139868
  ).addOption(
139670
- new Option9(
139869
+ new Option10(
139671
139870
  "--log-level <level>",
139672
139871
  maestroCommandSchema.shape.logLevel.description ?? "Log level"
139673
139872
  ).choices(maestroCommandSchema.shape.logLevel.values.map(String)).default(maestroCommandSchema.shape.logLevel.default)
@@ -139715,7 +139914,7 @@ function registerMaestroCommand(program, container) {
139715
139914
  "--yes",
139716
139915
  maestroCommandSchema.shape.yes.inner.description ?? "Accept defaults non-interactively"
139717
139916
  ).addOption(
139718
- new Option9(
139917
+ new Option10(
139719
139918
  "--log-level <level>",
139720
139919
  maestroCommandSchema.shape.logLevel.description ?? "Log level"
139721
139920
  ).choices(maestroCommandSchema.shape.logLevel.values.map(String)).default(maestroCommandSchema.shape.logLevel.default)
@@ -139905,6 +140104,7 @@ function bootstrapProgram(container) {
139905
140104
  });
139906
140105
  registerVersionOption(program, container, package_default2.version);
139907
140106
  registerInstallCommand(program, container);
140107
+ registerUpdateCommand(program, container, package_default2.version);
139908
140108
  registerConfigureCommand(program, container);
139909
140109
  registerAgentCommand(program, container);
139910
140110
  registerSpawnCommand(program, container, {
@@ -140050,6 +140250,7 @@ var init_program = __esm({
140050
140250
  init_auth();
140051
140251
  init_utils4();
140052
140252
  init_install2();
140253
+ init_update2();
140053
140254
  init_unconfigure();
140054
140255
  init_test();
140055
140256
  init_skill();
@@ -140075,6 +140276,7 @@ var init_program = __esm({
140075
140276
  init_execution_context();
140076
140277
  ROOT_HELP_COMMAND_SPECS = [
140077
140278
  { path: ["install"] },
140279
+ { path: ["update"] },
140078
140280
  { path: ["configure"] },
140079
140281
  { path: ["unconfigure"] },
140080
140282
  { path: ["login"] },