#!/usr/bin/env node
import {
  BaseCommand,
  EXIT_CODES
} from "../../chunk-LNA6M2IE.js";
import {
  getProjectConfigPath,
  loadProjectSourceConfig,
  saveProjectConfig
} from "../../chunk-GFDGYQ6M.js";
import "../../chunk-T4EXUIBY.js";
import "../../chunk-C4QI54PN.js";
import "../../chunk-FTD5Z6QD.js";
import {
  init_esm_shims
} from "../../chunk-DHET7RCE.js";

// src/cli/commands/config/set-project.ts
init_esm_shims();
import { Args } from "@oclif/core";
var ConfigSetProject = class _ConfigSetProject extends BaseCommand {
  static summary = "Set a project-level configuration value";
  static description = "Set a project-level configuration value (source, marketplace, agentsSource)";
  static args = {
    key: Args.string({
      description: "Configuration key (source, marketplace, agentsSource)",
      required: true
    }),
    value: Args.string({
      description: "Configuration value",
      required: true
    })
  };
  static flags = {
    ...BaseCommand.baseFlags
  };
  async run() {
    const { args } = await this.parse(_ConfigSetProject);
    const projectDir = process.cwd();
    const { key, value } = args;
    const validKeys = ["source", "marketplace", "agentsSource"];
    if (!validKeys.includes(key)) {
      this.error(`Unknown configuration key: ${key}
Valid keys: ${validKeys.join(", ")}`, {
        exit: EXIT_CODES.INVALID_ARGS
      });
    }
    const existingConfig = await loadProjectSourceConfig(projectDir) || {};
    const newConfig = {
      ...existingConfig,
      [key]: value
    };
    await saveProjectConfig(projectDir, newConfig);
    this.logSuccess(`Set ${key} = ${value} (project-level)`);
    this.logInfo(`Saved to ${getProjectConfigPath(projectDir)}`);
  }
};
export {
  ConfigSetProject as default
};
//# sourceMappingURL=set-project.js.map