@agentuity/cli 1.0.40 → 1.0.41

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/src/config.ts CHANGED
@@ -141,6 +141,8 @@ function expandTilde(path: string): string {
141
141
  }
142
142
 
143
143
  let cachedConfig: Config | null | undefined;
144
+ // Track the resolved config path so saveConfig writes back to the same file
145
+ let cachedConfigPath: string | undefined;
144
146
 
145
147
  export async function loadConfig(
146
148
  customPath?: string,
@@ -217,6 +219,7 @@ export async function loadConfig(
217
219
  // This ensures --config flag is respected across all commands
218
220
  if (!skipCache) {
219
221
  cachedConfig = result.data;
222
+ cachedConfigPath = configPath;
220
223
  }
221
224
  return result.data;
222
225
  } catch (error) {
@@ -227,6 +230,7 @@ export async function loadConfig(
227
230
  // Note: For long-running processes, consider time-based cache expiry for transient failures.
228
231
  if (!skipCache) {
229
232
  cachedConfig = null;
233
+ cachedConfigPath = configPath;
230
234
  }
231
235
  return null;
232
236
  }
@@ -275,7 +279,10 @@ function formatYAML(obj: unknown, indent = 0): string {
275
279
  }
276
280
 
277
281
  export async function saveConfig(config: Config, customPath?: string): Promise<void> {
278
- const configPath = customPath || (await getProfile());
282
+ // Use the path the config was originally loaded from (cachedConfigPath) so that
283
+ // saves go back to the correct profile even when --profile was used to load it.
284
+ // Falls back to getProfile() if no config has been loaded yet.
285
+ const configPath = customPath || cachedConfigPath || (await getProfile());
279
286
  await ensureConfigDir();
280
287
 
281
288
  const content = formatYAML(config);
@@ -443,8 +443,14 @@ export function buildValidationInput(
443
443
  const camelCaseName = opt.name.replace(/-([a-z])/g, (_, letter) => letter.toUpperCase());
444
444
  let value = rawOptions[opt.name] ?? rawOptions[camelCaseName];
445
445
 
446
- // Handle --yes alias for --confirm: if confirm is not set but yes is, use yes value
447
- if (opt.name === 'confirm' && value === undefined && rawOptions.yes === true) {
446
+ // Handle --yes and --force aliases for --confirm: if confirm is not set but yes/force is, use that value
447
+ // Only treat --force as a --confirm alias if the schema does NOT declare a separate 'force' option
448
+ if (
449
+ opt.name === 'confirm' &&
450
+ value === undefined &&
451
+ (rawOptions.yes === true ||
452
+ (rawOptions.force === true && !parsed.some((o) => o.name === 'force')))
453
+ ) {
448
454
  value = true;
449
455
  }
450
456