poe-code 3.0.321 → 3.0.323

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
@@ -17297,7 +17297,8 @@ var init_inspect = __esm({
17297
17297
 
17298
17298
  // packages/poe-code-config/src/provider-config.ts
17299
17299
  async function loadProviderShapeBaseUrls(options) {
17300
- const document = await readDocument(options.fs, options.filePath);
17300
+ const readConfig = options.readOnly ? readDocumentReadonly : readDocument;
17301
+ const document = await readConfig(options.fs, options.filePath);
17301
17302
  const providers = getOwnRecordEntry5(document, providersScope);
17302
17303
  const providerConfig = getOwnRecordEntry5(providers, options.providerId);
17303
17304
  if (Object.keys(providerConfig).length === 0) {
@@ -63123,7 +63124,9 @@ async function buildActiveProvider(input) {
63123
63124
  }
63124
63125
  const providerBaseUrlEnv = resolveProviderBaseUrlEnv(input.container, input.provider);
63125
63126
  const environmentBaseUrl = resolveBaseUrlRoot(providerBaseUrlEnv, input.provider.baseUrlEnvPath);
63126
- const configuredBaseUrl = resolveNonEmpty(input.explicitShapeBaseUrls?.[apiShape]) ?? resolveShapeBaseUrl(resolveNonEmpty(input.explicitBaseUrl), shape.baseUrlPath) ?? resolveShapeBaseUrl(environmentBaseUrl, shape.envBaseUrlPath ?? shape.baseUrlPath) ?? await resolveStoredShapeBaseUrl(input.container, input.provider.id, apiShape);
63127
+ const configuredBaseUrl = resolveNonEmpty(input.explicitShapeBaseUrls?.[apiShape]) ?? resolveShapeBaseUrl(resolveNonEmpty(input.explicitBaseUrl), shape.baseUrlPath) ?? resolveShapeBaseUrl(environmentBaseUrl, shape.envBaseUrlPath ?? shape.baseUrlPath) ?? await resolveStoredShapeBaseUrl(input.container, input.provider.id, apiShape, {
63128
+ readOnly: input.readOnly
63129
+ });
63127
63130
  if (input.provider.requiresBaseUrl === true && configuredBaseUrl === void 0) {
63128
63131
  throw new Error(
63129
63132
  `Provider "${input.provider.id}" requires a base URL for API shape "${apiShape}". Run \`poe-code provider login ${input.provider.id} --base-url <url>\`, set ${input.provider.baseUrlEnvVar ?? "the provider base URL env var"}, or pass --base-url.`
@@ -63294,7 +63297,8 @@ async function resolveActiveProviderForService(container, serviceName, options =
63294
63297
  agent: agent3,
63295
63298
  credential,
63296
63299
  explicitBaseUrl: metadata?.baseUrl,
63297
- explicitShapeBaseUrls: parseProviderShapeBaseUrls(provider2, metadata?.shapeBaseUrl ?? [])
63300
+ explicitShapeBaseUrls: parseProviderShapeBaseUrls(provider2, metadata?.shapeBaseUrl ?? []),
63301
+ readOnly: options.readOnly
63298
63302
  });
63299
63303
  }
63300
63304
  async function resolveSingleProviderCandidate(container, agent3, options) {
@@ -63313,11 +63317,12 @@ async function resolveSingleProviderCandidate(container, agent3, options) {
63313
63317
  }
63314
63318
  return void 0;
63315
63319
  }
63316
- async function resolveStoredShapeBaseUrl(container, providerId, apiShape) {
63320
+ async function resolveStoredShapeBaseUrl(container, providerId, apiShape, options = {}) {
63317
63321
  const shapeBaseUrls = await loadProviderShapeBaseUrls({
63318
63322
  fs: container.fs,
63319
63323
  filePath: container.env.servicesConfigPath,
63320
- providerId
63324
+ providerId,
63325
+ readOnly: options.readOnly
63321
63326
  });
63322
63327
  const value = shapeBaseUrls[apiShape];
63323
63328
  return typeof value === "string" && value.trim().length > 0 ? value : void 0;
@@ -65715,7 +65720,8 @@ async function createConfigurePayload(init) {
65715
65720
  agent: agent3,
65716
65721
  credential: apiKey,
65717
65722
  explicitBaseUrl,
65718
- explicitShapeBaseUrls
65723
+ explicitShapeBaseUrls,
65724
+ readOnly: flags.dryRun
65719
65725
  });
65720
65726
  payload.provider = activeProvider;
65721
65727
  }
@@ -65724,7 +65730,8 @@ async function createConfigurePayload(init) {
65724
65730
  const configModel = await resolveModel(
65725
65731
  {
65726
65732
  fs: container.fs,
65727
- filePath: container.env.configPath
65733
+ filePath: container.env.configPath,
65734
+ readOnly: flags.dryRun
65728
65735
  },
65729
65736
  adapter.name
65730
65737
  );
@@ -94156,22 +94163,22 @@ function formatUnconfigureMessages(service, label, unconfigured, _payload) {
94156
94163
  case "claude-code":
94157
94164
  return {
94158
94165
  success: didUnconfigure ? "Removed Claude Code configuration." : "No Claude Code configuration found.",
94159
- dry: "Dry run: would remove Claude Code configuration."
94166
+ dry: didUnconfigure ? "Dry run: would remove Claude Code configuration." : "No Claude Code configuration found."
94160
94167
  };
94161
94168
  case "codex":
94162
94169
  return {
94163
94170
  success: didUnconfigure ? "Removed Codex configuration." : "No Codex configuration found.",
94164
- dry: "Dry run: would remove Codex configuration."
94171
+ dry: didUnconfigure ? "Dry run: would remove Codex configuration." : "No Codex configuration found."
94165
94172
  };
94166
94173
  case "opencode":
94167
94174
  return {
94168
94175
  success: didUnconfigure ? "Removed OpenCode CLI configuration." : "No OpenCode CLI configuration found.",
94169
- dry: "Dry run: would remove OpenCode CLI configuration."
94176
+ dry: didUnconfigure ? "Dry run: would remove OpenCode CLI configuration." : "No OpenCode CLI configuration found."
94170
94177
  };
94171
94178
  default:
94172
94179
  return {
94173
94180
  success: didUnconfigure ? `Removed ${label} configuration.` : `No ${label} configuration found.`,
94174
- dry: `Dry run: would remove ${label} configuration.`
94181
+ dry: didUnconfigure ? `Dry run: would remove ${label} configuration.` : `No ${label} configuration found.`
94175
94182
  };
94176
94183
  }
94177
94184
  }
@@ -94202,14 +94209,15 @@ async function executeLogout(program, container) {
94202
94209
  projectFilePath: container.env.projectConfigPath,
94203
94210
  readOnly: flags.dryRun
94204
94211
  });
94205
- let authenticatedProviders = [];
94212
+ const authenticatedProviders = await Promise.all(
94213
+ container.providerRegistry.list().map(async (provider2) => ({
94214
+ id: provider2.id,
94215
+ authenticated: await container.providerRegistry.isLoggedIn(provider2.id, {
94216
+ readOnly: flags.dryRun
94217
+ })
94218
+ }))
94219
+ );
94206
94220
  if (!flags.dryRun) {
94207
- authenticatedProviders = await Promise.all(
94208
- container.providerRegistry.list().map(async (provider2) => ({
94209
- id: provider2.id,
94210
- authenticated: await container.providerRegistry.isLoggedIn(provider2.id)
94211
- }))
94212
- );
94213
94221
  for (const provider2 of authenticatedProviders) {
94214
94222
  await container.providerRegistry.logout(provider2.id);
94215
94223
  }
@@ -94221,10 +94229,13 @@ async function executeLogout(program, container) {
94221
94229
  }
94222
94230
  await executeUnconfigure(program, container, serviceName, {});
94223
94231
  }
94232
+ const environmentCredential = container.env.getVariable("POE_API_KEY");
94233
+ const hasEnvironmentCredential = typeof environmentCredential === "string" && environmentCredential.trim().length > 0;
94224
94234
  if (flags.dryRun) {
94235
+ const hasStoredState = Object.keys(configuredServices).length > 0 || authenticatedProviders.some((provider2) => provider2.authenticated) || hasEnvironmentCredential || await fileExists3(container, container.env.configPath) || await fileExists3(container, container.env.servicesConfigPath);
94225
94236
  resources.context.complete({
94226
94237
  success: "Logged out.",
94227
- dry: `Dry run: would delete config at ${container.env.configPath}.`
94238
+ dry: hasStoredState ? `Dry run: would delete config at ${container.env.configPath}.` : "Already logged out."
94228
94239
  });
94229
94240
  resources.context.finalize();
94230
94241
  return;
@@ -94237,17 +94248,27 @@ async function executeLogout(program, container) {
94237
94248
  fs: container.fs,
94238
94249
  filePath: container.env.servicesConfigPath
94239
94250
  });
94240
- const environmentCredential = container.env.getVariable("POE_API_KEY");
94241
- const hasEnvironmentCredential = typeof environmentCredential === "string" && environmentCredential.trim().length > 0;
94242
94251
  resources.context.complete({
94243
94252
  success: hasEnvironmentCredential ? "Stored credentials removed, but POE_API_KEY remains set; unset it to log out fully." : deleted || deletedServicesConfig || authenticatedProviders.some((provider2) => provider2.authenticated) ? "Logged out." : "Already logged out.",
94244
94253
  dry: `Dry run: would delete config at ${container.env.configPath}.`
94245
94254
  });
94246
94255
  resources.context.finalize();
94247
94256
  }
94257
+ async function fileExists3(container, filePath) {
94258
+ try {
94259
+ await container.fs.lstat(filePath);
94260
+ return true;
94261
+ } catch (error3) {
94262
+ if (isNotFound(error3)) {
94263
+ return false;
94264
+ }
94265
+ throw error3;
94266
+ }
94267
+ }
94248
94268
  var init_logout = __esm({
94249
94269
  "src/cli/commands/logout.ts"() {
94250
94270
  "use strict";
94271
+ init_src6();
94251
94272
  init_config5();
94252
94273
  init_shared();
94253
94274
  init_unconfigure();
@@ -96392,7 +96413,7 @@ ${formatMcpToolsDocs()}`).action(async (options) => {
96392
96413
  let agent3 = agentArg;
96393
96414
  if (!agent3) {
96394
96415
  if (flags.assumeYes || options.yes) {
96395
- const fromConfig = await resolveDefaultAgent(container);
96416
+ const fromConfig = await resolveDefaultAgent(container, { readOnly: flags.dryRun });
96396
96417
  agent3 = fromConfig !== null ? parseAgentSpecifier(fromConfig).agent : DEFAULT_MCP_AGENT;
96397
96418
  } else {
96398
96419
  if (process.stdin.isTTY !== true) {
@@ -98931,8 +98952,9 @@ function resolveAbsoluteDocPath(container, docPath) {
98931
98952
  }
98932
98953
  return path149.isAbsolute(docPath) ? docPath : path149.resolve(container.env.cwd, docPath);
98933
98954
  }
98934
- async function resolveRalphCommandConfig(container) {
98935
- const configDoc = await readMergedDocument(
98955
+ async function resolveRalphCommandConfig(container, options = {}) {
98956
+ const readConfig = options.readOnly ? readMergedDocumentReadonly : readMergedDocument;
98957
+ const configDoc = await readConfig(
98936
98958
  container.fs,
98937
98959
  container.env.configPath,
98938
98960
  container.env.projectConfigPath
@@ -99069,7 +99091,7 @@ async function promptForAgent(container, program) {
99069
99091
  );
99070
99092
  }
99071
99093
  const selectedAgent = await resolveLoopAgent({
99072
- configuredDefaultAgent: await resolveDefaultAgent(container),
99094
+ configuredDefaultAgent: await resolveDefaultAgent(container, { readOnly: flags.dryRun }),
99073
99095
  assumeYes: flags.assumeYes,
99074
99096
  fallbackAgent: DEFAULT_RALPH_AGENT,
99075
99097
  message: "Select agent to run Ralph with:",
@@ -99097,7 +99119,7 @@ async function resolveRunAgent(options) {
99097
99119
  const selectedAgent = await resolveLoopAgent({
99098
99120
  providedAgent: options.providedAgent,
99099
99121
  frontmatterAgent: configured,
99100
- configuredDefaultAgent: await resolveDefaultAgent(options.container),
99122
+ configuredDefaultAgent: await resolveDefaultAgent(options.container, { readOnly: flags.dryRun }),
99101
99123
  assumeYes: flags.assumeYes,
99102
99124
  fallbackAgent: DEFAULT_RALPH_AGENT,
99103
99125
  message: "Select agent to run Ralph with:",
@@ -99207,7 +99229,7 @@ function registerRalphCommand(program, container) {
99207
99229
  const options = this.opts();
99208
99230
  resources.logger.intro("ralph init");
99209
99231
  try {
99210
- const commandConfig = await resolveRalphCommandConfig(container);
99232
+ const commandConfig = await resolveRalphCommandConfig(container, { readOnly: flags.dryRun });
99211
99233
  const docPath = await resolveDocPath2({
99212
99234
  container,
99213
99235
  program,
@@ -99273,7 +99295,7 @@ function registerRalphCommand(program, container) {
99273
99295
  const runtimeOptions = pickRuntimeOptions(options);
99274
99296
  resources.logger.intro("ralph run");
99275
99297
  try {
99276
- const commandConfig = await resolveRalphCommandConfig(container);
99298
+ const commandConfig = await resolveRalphCommandConfig(container, { readOnly: flags.dryRun });
99277
99299
  const docPath = await resolveDocPath2({
99278
99300
  container,
99279
99301
  program,
@@ -137893,7 +137915,7 @@ var init_package2 = __esm({
137893
137915
  "package.json"() {
137894
137916
  package_default2 = {
137895
137917
  name: "poe-code",
137896
- version: "3.0.321",
137918
+ version: "3.0.323",
137897
137919
  description: "CLI tool to configure Poe API for developer workflows.",
137898
137920
  type: "module",
137899
137921
  main: "./dist/index.js",