"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 claude_exports = {};
__export(claude_exports, {
  installClaudeEarly: () => installClaudeEarly,
  installClaudeLate: () => installClaudeLate,
  printClaudeNextSteps: () => printClaudeNextSteps,
  uninitClaude: () => uninitClaude
});
module.exports = __toCommonJS(claude_exports);
var fs = __toESM(require("fs"));
var path = __toESM(require("path"));
var import_common = require("../common");
var import_instructions = require("../instructions");
const CLAUDE_IMPORT = "@.kirograph/claude.md";
function installClaudeEarly(projectRoot) {
  const mcpPath = path.join(projectRoot, ".mcp.json");
  (0, import_common.writeMcpServersConfig)(mcpPath, {
    command: import_common.KIROGRAPH_COMMAND,
    args: import_common.KIROGRAPH_MCP_ARGS
  });
  console.log(`  \u2713 Claude MCP server registered in ${mcpPath}`);
}
function installClaudeLate(projectRoot, cavemanMode, _shellCompressionLevel, _enableMemory) {
  const instructionsPath = path.join(projectRoot, ".kirograph", "claude.md");
  (0, import_common.ensureDir)(path.dirname(instructionsPath));
  fs.writeFileSync(instructionsPath, (0, import_instructions.buildAgentInstructions)(cavemanMode));
  console.log(`  \u2713 Claude instructions written to ${instructionsPath}`);
  const memoryPath = path.join(projectRoot, "CLAUDE.md");
  const changed = (0, import_common.appendImportLine)(memoryPath, CLAUDE_IMPORT, "## KiroGraph");
  console.log(changed ? `  \u2713 Claude project memory updated in ${memoryPath}` : `  \u2713 Claude project memory already imports ${CLAUDE_IMPORT}`);
}
function uninitClaude(projectRoot) {
  const mcpPath = path.join(projectRoot, ".mcp.json");
  if ((0, import_common.removeMcpServersConfig)(mcpPath)) {
    console.log(`  \u2713 Removed kirograph from .mcp.json`);
  }
  const memoryPath = path.join(projectRoot, "CLAUDE.md");
  if ((0, import_common.removeImportLine)(memoryPath, CLAUDE_IMPORT)) {
    console.log(`  \u2713 Removed KiroGraph import from CLAUDE.md`);
  }
}
function printClaudeNextSteps() {
  console.log("\n  Done! Restart Claude Code for the MCP server and project memory to load.\n");
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  installClaudeEarly,
  installClaudeLate,
  printClaudeNextSteps,
  uninitClaude
});
//# sourceMappingURL=claude.js.map
