"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
  // If the importer is in node compatibility mode or this is not an ESM
  // file that has been converted to a CommonJS file using a Babel-
  // compatible transform (i.e. "__esModule" has not been set), then set
  // "default" to the CommonJS "module.exports" for node compatibility.
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
  mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var goose_exports = {};
__export(goose_exports, {
  installGooseEarly: () => installGooseEarly,
  installGooseLate: () => installGooseLate,
  printGooseNextSteps: () => printGooseNextSteps,
  uninitGoose: () => uninitGoose
});
module.exports = __toCommonJS(goose_exports);
var fs = __toESM(require("fs"));
var path = __toESM(require("path"));
var import_common = require("../common");
var import_instructions = require("../instructions");
var import_common2 = require("../common");
const GOOSE_BLOCK_ID = "goose";
function installGooseEarly(_projectRoot) {
}
function installGooseLate(projectRoot, cavemanMode, shellCompressionLevel, enableMemory) {
  const instructionsPath = path.join(projectRoot, ".kirograph", "goose.md");
  (0, import_common.ensureDir)(path.dirname(instructionsPath));
  fs.writeFileSync(instructionsPath, (0, import_instructions.buildAgentInstructions)((0, import_common2.buildInstructionOpts)(cavemanMode, shellCompressionLevel, enableMemory)));
  console.log(`  \u2713 Goose instructions written to ${instructionsPath}`);
  const agentsPath = path.join(projectRoot, "AGENTS.md");
  const changed = (0, import_common.upsertGeneratedBlock)(agentsPath, GOOSE_BLOCK_ID, "## KiroGraph", (0, import_instructions.buildAgentInstructions)((0, import_common2.buildInstructionOpts)(cavemanMode, shellCompressionLevel, enableMemory)));
  console.log(changed ? `  \u2713 AGENTS.md updated with KiroGraph instructions (Goose)` : `  \u2713 AGENTS.md already up to date`);
}
function uninitGoose(projectRoot) {
  const agentsPath = path.join(projectRoot, "AGENTS.md");
  if ((0, import_common.removeGeneratedBlock)(agentsPath, GOOSE_BLOCK_ID)) {
    console.log(`  \u2713 Removed KiroGraph block from AGENTS.md (Goose)`);
  }
}
function printGooseNextSteps(projectRoot) {
  const escapedPath = projectRoot.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
  console.log("\n  Done! KiroGraph instructions are in AGENTS.md.");
  (0, import_common.printMcpCommand)(`goose mcp add kirograph -- kirograph serve --mcp --path "${escapedPath}"`);
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  installGooseEarly,
  installGooseLate,
  printGooseNextSteps,
  uninitGoose
});
//# sourceMappingURL=goose.js.map
