@tdsoft-tech/aikit 0.1.34 → 0.1.35

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/cli.js CHANGED
@@ -178,6 +178,34 @@ var init_paths = __esm({
178
178
  */
179
179
  cursorAgents(project) {
180
180
  return join(this.cursorConfig(project ? "project" : "user"), "agents");
181
+ },
182
+ /**
183
+ * Get the Google Antigravity configuration directory
184
+ * Project: .agent/
185
+ * Global: ~/.gemini/antigravity/
186
+ */
187
+ antigravityConfig(scope) {
188
+ if (scope === "project") {
189
+ return join(process.cwd(), ".agent");
190
+ }
191
+ return join(homedir(), ".gemini", "antigravity");
192
+ },
193
+ /**
194
+ * Get Antigravity skills directory
195
+ * Project: .agent/skills/
196
+ * Global: ~/.gemini/antigravity/global_skills/
197
+ */
198
+ antigravitySkills(project) {
199
+ if (project) {
200
+ return join(process.cwd(), ".agent", "skills");
201
+ }
202
+ return join(homedir(), ".gemini", "antigravity", "global_skills");
203
+ },
204
+ /**
205
+ * Get Antigravity agents directory (skills are used for everything in Antigravity)
206
+ */
207
+ antigravityAgents(project) {
208
+ return this.antigravitySkills(project);
181
209
  }
182
210
  };
183
211
  }
@@ -1029,7 +1057,7 @@ var init_config = __esm({
1029
1057
  /**
1030
1058
  * Primary platform to use (affects default behavior)
1031
1059
  */
1032
- primary: z.enum(["opencode", "claude", "cursor"]).default("opencode"),
1060
+ primary: z.enum(["opencode", "claude", "cursor", "antigravity"]).default("opencode"),
1033
1061
  /**
1034
1062
  * Enable OpenCode platform support
1035
1063
  * Default: true (OpenCode is the primary focus)
@@ -1044,7 +1072,12 @@ var init_config = __esm({
1044
1072
  * Enable Cursor platform support
1045
1073
  * Default: false (opt-in)
1046
1074
  */
1047
- cursor: z.boolean().default(false)
1075
+ cursor: z.boolean().default(false),
1076
+ /**
1077
+ * Enable Google Antigravity platform support
1078
+ * Default: false (opt-in)
1079
+ */
1080
+ antigravity: z.boolean().default(false)
1048
1081
  }).default({});
1049
1082
  ConfigSchema = z.object({
1050
1083
  version: z.string(),
@@ -1165,6 +1198,9 @@ var init_config = __esm({
1165
1198
  if (this.config.platform.cursor) {
1166
1199
  platforms.push("cursor");
1167
1200
  }
1201
+ if (this.config.platform.antigravity) {
1202
+ platforms.push("antigravity");
1203
+ }
1168
1204
  return platforms;
1169
1205
  }
1170
1206
  get projectPath() {
@@ -8281,6 +8317,7 @@ var CliPlatform = /* @__PURE__ */ ((CliPlatform2) => {
8281
8317
  CliPlatform2["CLAUDE"] = "claude";
8282
8318
  CliPlatform2["CODEX"] = "codex";
8283
8319
  CliPlatform2["CURSOR"] = "cursor";
8320
+ CliPlatform2["ANTIGRAVITY"] = "antigravity";
8284
8321
  return CliPlatform2;
8285
8322
  })(CliPlatform || {});
8286
8323
  var CliDetector = class {
@@ -8405,6 +8442,35 @@ var CliDetector = class {
8405
8442
  };
8406
8443
  }
8407
8444
  }
8445
+ /**
8446
+ * Check if Antigravity is installed
8447
+ * Antigravity uses .agent/ directory for workspace skills
8448
+ * and ~/.gemini/antigravity/ for global configuration
8449
+ */
8450
+ static async checkAntigravity() {
8451
+ try {
8452
+ const globalPath = join15(homedir3(), ".gemini", "antigravity");
8453
+ const projectPath = join15(process.cwd(), ".agent");
8454
+ const hasGlobal = existsSync6(globalPath);
8455
+ const hasProject = existsSync6(projectPath);
8456
+ const installed = hasGlobal || hasProject;
8457
+ return {
8458
+ name: "antigravity" /* ANTIGRAVITY */,
8459
+ displayName: "Google Antigravity",
8460
+ detected: true,
8461
+ installed,
8462
+ version: installed ? "installed" : void 0,
8463
+ configPath: hasGlobal ? globalPath : projectPath
8464
+ };
8465
+ } catch {
8466
+ return {
8467
+ name: "antigravity" /* ANTIGRAVITY */,
8468
+ displayName: "Google Antigravity",
8469
+ detected: false,
8470
+ installed: false
8471
+ };
8472
+ }
8473
+ }
8408
8474
  /**
8409
8475
  * Check all supported CLIs
8410
8476
  */
@@ -8414,6 +8480,7 @@ var CliDetector = class {
8414
8480
  results.push(await this.checkClaude());
8415
8481
  results.push(await this.checkGitHub());
8416
8482
  results.push(await this.checkCursor());
8483
+ results.push(await this.checkAntigravity());
8417
8484
  return results;
8418
8485
  }
8419
8486
  /**
@@ -8454,6 +8521,15 @@ var CliDetector = class {
8454
8521
  installed: existsSync6(cursorPath),
8455
8522
  configPath: cursorPath
8456
8523
  });
8524
+ const antigravityGlobalPath = join15(homedir3(), ".gemini", "antigravity");
8525
+ const antigravityProjectPath = join15(process.cwd(), ".agent");
8526
+ const antigravityInstalled = existsSync6(antigravityGlobalPath) || existsSync6(antigravityProjectPath);
8527
+ platforms.push({
8528
+ platform: "antigravity" /* ANTIGRAVITY */,
8529
+ displayName: "Google Antigravity",
8530
+ installed: antigravityInstalled,
8531
+ configPath: antigravityInstalled ? existsSync6(antigravityGlobalPath) ? antigravityGlobalPath : antigravityProjectPath : antigravityProjectPath
8532
+ });
8457
8533
  return platforms;
8458
8534
  }
8459
8535
  /**
@@ -8475,6 +8551,8 @@ var CliDetector = class {
8475
8551
  return "cursor" /* CURSOR */;
8476
8552
  } else if (normalized === "codex") {
8477
8553
  return "codex" /* CODEX */;
8554
+ } else if (normalized === "antigravity" || normalized === "gemini" || normalized === "google-antigravity") {
8555
+ return "antigravity" /* ANTIGRAVITY */;
8478
8556
  }
8479
8557
  throw new Error(`Unknown platform: ${name}`);
8480
8558
  }
@@ -8513,8 +8591,20 @@ async function initializeConfig(configDir, _isGlobal, platformConfig) {
8513
8591
  "memory/observations",
8514
8592
  "memory/research"
8515
8593
  ];
8516
- for (const dir of dirs) {
8517
- await mkdir12(join17(configDir, dir), { recursive: true });
8594
+ try {
8595
+ for (const dir of dirs) {
8596
+ await mkdir12(join17(configDir, dir), { recursive: true });
8597
+ }
8598
+ } catch (error) {
8599
+ if (error.code === "EACCES") {
8600
+ const parentDir = join17(configDir, "..");
8601
+ throw new Error(
8602
+ `Permission denied: Cannot create ${configDir}
8603
+ The parent directory may be owned by another user.
8604
+ Try: sudo chown -R $USER:staff "${parentDir}" or run in a different directory.`
8605
+ );
8606
+ }
8607
+ throw error;
8518
8608
  }
8519
8609
  const platform = platformConfig || {
8520
8610
  primary: "opencode",
@@ -9675,6 +9765,141 @@ ${agent.systemPrompt}`;
9675
9765
  }
9676
9766
  };
9677
9767
 
9768
+ // src/platform/antigravity-adapter.ts
9769
+ init_esm_shims();
9770
+ init_paths();
9771
+ import { writeFile as writeFile16, mkdir as mkdir16 } from "fs/promises";
9772
+ import { join as join21 } from "path";
9773
+ var AntigravityAdapter = class {
9774
+ platform = "antigravity" /* ANTIGRAVITY */;
9775
+ displayName = "Google Antigravity";
9776
+ getCommandsDir() {
9777
+ return this.getSkillsDir();
9778
+ }
9779
+ getSkillsDir() {
9780
+ return paths.antigravitySkills(true);
9781
+ }
9782
+ getAgentsDir() {
9783
+ return paths.antigravitySkills(true);
9784
+ }
9785
+ async transformCommand(command) {
9786
+ const name = `aikit-${command.name.replace(/:/g, "-")}`;
9787
+ const content = this.generateSkillFromCommand(command, name);
9788
+ return { name, content };
9789
+ }
9790
+ async transformSkill(skill) {
9791
+ const name = skill.name;
9792
+ const skillContent = this.generateSkillContent(skill);
9793
+ return {
9794
+ name,
9795
+ directory: name,
9796
+ files: { "SKILL.md": skillContent }
9797
+ };
9798
+ }
9799
+ async transformAgent(agent) {
9800
+ const name = `agent-${agent.name}`;
9801
+ const content = this.generateAgentAsSkill(agent, name);
9802
+ return { name, content };
9803
+ }
9804
+ async installCommand(name, content) {
9805
+ const skillDir = join21(this.getSkillsDir(), name);
9806
+ await mkdir16(skillDir, { recursive: true });
9807
+ await writeFile16(join21(skillDir, "SKILL.md"), content);
9808
+ }
9809
+ async installSkill(name, directory, files) {
9810
+ const baseDir = this.getSkillsDir();
9811
+ const targetDir = directory ? join21(baseDir, directory) : join21(baseDir, name);
9812
+ await mkdir16(targetDir, { recursive: true });
9813
+ for (const [filename, content] of Object.entries(files)) {
9814
+ await writeFile16(join21(targetDir, filename), content);
9815
+ }
9816
+ }
9817
+ async installAgent(name, content) {
9818
+ const skillDir = join21(this.getSkillsDir(), name);
9819
+ await mkdir16(skillDir, { recursive: true });
9820
+ await writeFile16(join21(skillDir, "SKILL.md"), content);
9821
+ }
9822
+ /**
9823
+ * Generate YAML frontmatter for Antigravity skills
9824
+ */
9825
+ generateFrontmatter(name, description) {
9826
+ return `---
9827
+ name: ${name}
9828
+ description: ${description}
9829
+ ---`;
9830
+ }
9831
+ /**
9832
+ * Convert AIKit command to Antigravity skill format
9833
+ */
9834
+ generateSkillFromCommand(command, skillName) {
9835
+ const frontmatter = this.generateFrontmatter(
9836
+ skillName,
9837
+ command.description
9838
+ );
9839
+ const examples = command.examples.map((e) => `- \`${e}\``).join("\n");
9840
+ let workflow = command.content;
9841
+ workflow = workflow.replace(/\$ARGUMENTS/g, "$ARGUMENTS").replace(/\$1/g, "$1").replace(/\$2/g, "$2").replace(/\$3/g, "$3");
9842
+ return `${frontmatter}
9843
+
9844
+ # ${command.name} Command
9845
+
9846
+ ${command.description}
9847
+
9848
+ ## Usage
9849
+ \`${command.usage}\`
9850
+
9851
+ ## Examples
9852
+ ${examples}
9853
+
9854
+ ## Workflow
9855
+ ${workflow}
9856
+
9857
+ **Category**: ${command.category}`;
9858
+ }
9859
+ /**
9860
+ * Convert AIKit skill to Antigravity skill format
9861
+ */
9862
+ generateSkillContent(skill) {
9863
+ const frontmatter = this.generateFrontmatter(
9864
+ skill.name,
9865
+ `${skill.description} ${skill.useWhen}`
9866
+ );
9867
+ return `${frontmatter}
9868
+
9869
+ # ${skill.name}
9870
+
9871
+ ${skill.description}
9872
+
9873
+ ## When to Use
9874
+ ${skill.useWhen}
9875
+
9876
+ ## Workflow
9877
+ ${skill.content}
9878
+
9879
+ **IMPORTANT**: Follow this skill's workflow step by step. Do not skip steps.`;
9880
+ }
9881
+ /**
9882
+ * Convert AIKit agent to Antigravity skill format
9883
+ */
9884
+ generateAgentAsSkill(agent, skillName) {
9885
+ const frontmatter = this.generateFrontmatter(
9886
+ skillName,
9887
+ `Agent: ${agent.name}. ${agent.systemPrompt.slice(0, 100)}...`
9888
+ );
9889
+ return `${frontmatter}
9890
+
9891
+ # ${agent.name} Agent
9892
+
9893
+ This skill embodies the ${agent.name} agent persona.
9894
+
9895
+ ## System Prompt
9896
+ ${agent.systemPrompt}
9897
+
9898
+ ## How to Use
9899
+ When you need to act as the ${agent.name} agent, follow the system prompt above as your guiding instructions.`;
9900
+ }
9901
+ };
9902
+
9678
9903
  // src/platform/adapters.ts
9679
9904
  function createAdapter(platform) {
9680
9905
  switch (platform) {
@@ -9684,6 +9909,8 @@ function createAdapter(platform) {
9684
9909
  return new ClaudeAdapter();
9685
9910
  case "cursor" /* CURSOR */:
9686
9911
  return new CursorAdapter();
9912
+ case "antigravity" /* ANTIGRAVITY */:
9913
+ return new AntigravityAdapter();
9687
9914
  default:
9688
9915
  throw new Error(`Unsupported platform: ${platform}`);
9689
9916
  }
@@ -9696,6 +9923,8 @@ function platformTypeToCliPlatform(type) {
9696
9923
  return "claude" /* CLAUDE */;
9697
9924
  case "cursor":
9698
9925
  return "cursor" /* CURSOR */;
9926
+ case "antigravity":
9927
+ return "antigravity" /* ANTIGRAVITY */;
9699
9928
  }
9700
9929
  }
9701
9930
  function getEnabledAdapters(config) {
@@ -9707,24 +9936,27 @@ function getEnabledAdapters(config) {
9707
9936
  var SUPPORTED_PLATFORMS = [
9708
9937
  { platform: "opencode" /* OPENCODE */, name: "OpenCode", configKey: "opencode" },
9709
9938
  { platform: "claude" /* CLAUDE */, name: "Claude Code CLI", configKey: "claude" },
9710
- { platform: "cursor" /* CURSOR */, name: "Cursor", configKey: "cursor" }
9939
+ { platform: "cursor" /* CURSOR */, name: "Cursor", configKey: "cursor" },
9940
+ { platform: "antigravity" /* ANTIGRAVITY */, name: "Google Antigravity", configKey: "antigravity" }
9711
9941
  ];
9712
9942
 
9713
9943
  // src/cli/commands/init.ts
9714
9944
  function getPlatformConfig(choice) {
9715
9945
  switch (choice) {
9716
9946
  case "opencode":
9717
- return { opencode: true, claude: false, cursor: false, primary: "opencode" };
9947
+ return { opencode: true, claude: false, cursor: false, antigravity: false, primary: "opencode" };
9718
9948
  case "claude":
9719
- return { opencode: false, claude: true, cursor: false, primary: "claude" };
9949
+ return { opencode: false, claude: true, cursor: false, antigravity: false, primary: "claude" };
9720
9950
  case "cursor":
9721
- return { opencode: false, claude: false, cursor: true, primary: "cursor" };
9951
+ return { opencode: false, claude: false, cursor: true, antigravity: false, primary: "cursor" };
9952
+ case "antigravity":
9953
+ return { opencode: false, claude: false, cursor: false, antigravity: true, primary: "antigravity" };
9722
9954
  case "both":
9723
- return { opencode: true, claude: true, cursor: false, primary: "opencode" };
9955
+ return { opencode: true, claude: true, cursor: false, antigravity: false, primary: "opencode" };
9724
9956
  }
9725
9957
  }
9726
9958
  function registerInitCommand(program2) {
9727
- program2.command("init [platform]").description("Initialize AIKit configuration for a specific platform").option("-g, --global", "Initialize global configuration").option("-p, --project", "Initialize project-level configuration").option("--opencode", "Use OpenCode only").option("--claude", "Use Claude Code only").option("--cursor", "Use Cursor only").option("--both", "Use both OpenCode and Claude Code").action(async (platformArg, options) => {
9959
+ program2.command("init [platform]").description("Initialize AIKit configuration for a specific platform").option("-g, --global", "Initialize global configuration").option("-p, --project", "Initialize project-level configuration").option("--opencode", "Use OpenCode only").option("--claude", "Use Claude Code only").option("--cursor", "Use Cursor only").option("--antigravity", "Use Google Antigravity only").option("--both", "Use both OpenCode and Claude Code").action(async (platformArg, options) => {
9728
9960
  const configDir = options.global ? paths.globalConfig() : paths.projectConfig();
9729
9961
  console.log(chalk3.bold("\n\u{1F680} AIKit Setup\n"));
9730
9962
  logger.info(`Initializing AIKit in ${configDir}...`);
@@ -9736,6 +9968,8 @@ function registerInitCommand(program2) {
9736
9968
  platformChoice = "claude";
9737
9969
  } else if (options.cursor) {
9738
9970
  platformChoice = "cursor";
9971
+ } else if (options.antigravity) {
9972
+ platformChoice = "antigravity";
9739
9973
  } else if (options.both) {
9740
9974
  platformChoice = "both";
9741
9975
  } else if (platformArg) {
@@ -9744,6 +9978,8 @@ function registerInitCommand(program2) {
9744
9978
  platformChoice = "cursor";
9745
9979
  } else if (mapped === "claude" /* CLAUDE */) {
9746
9980
  platformChoice = "claude";
9981
+ } else if (mapped === "antigravity" /* ANTIGRAVITY */) {
9982
+ platformChoice = "antigravity";
9747
9983
  } else {
9748
9984
  platformChoice = "opencode";
9749
9985
  }
@@ -9759,6 +9995,10 @@ function registerInitCommand(program2) {
9759
9995
  name: `${chalk3.green("\u25CF")} OpenCode ${chalk3.gray("(recommended)")}`,
9760
9996
  value: "opencode"
9761
9997
  },
9998
+ {
9999
+ name: `${chalk3.blue("\u25CF")} Google Antigravity ${chalk3.blue("(NEW)")}`,
10000
+ value: "antigravity"
10001
+ },
9762
10002
  {
9763
10003
  name: `${chalk3.yellow("\u25CF")} Claude Code ${chalk3.yellow("(Beta)")}`,
9764
10004
  value: "claude"
@@ -9784,15 +10024,20 @@ function registerInitCommand(program2) {
9784
10024
  console.log(chalk3.magenta("\n\u26A0\uFE0F Cursor support is in Beta"));
9785
10025
  console.log(chalk3.gray(" Some features may be limited or experimental.\n"));
9786
10026
  }
10027
+ if (platformChoice === "antigravity") {
10028
+ console.log(chalk3.blue("\n\u{1F680} Google Antigravity - NEW!"));
10029
+ console.log(chalk3.gray(" Skills will be installed to .agent/skills/\n"));
10030
+ }
9787
10031
  }
9788
10032
  const platformConfig = getPlatformConfig(platformChoice);
9789
10033
  await initializeConfig(configDir, options.global, platformConfig);
9790
10034
  logger.success("\u2713 Configuration created");
9791
10035
  console.log(chalk3.bold("\n\u{1F4CB} Platform Configuration:"));
9792
- console.log(` OpenCode: ${platformConfig.opencode ? chalk3.green("enabled") : chalk3.gray("disabled")}`);
9793
- console.log(` Claude Code: ${platformConfig.claude ? chalk3.yellow("enabled (Beta)") : chalk3.gray("disabled")}`);
9794
- console.log(` Cursor: ${platformConfig.cursor ? chalk3.magenta("enabled (Beta)") : chalk3.gray("disabled")}`);
9795
- console.log(` Primary: ${chalk3.cyan(platformConfig.primary)}
10036
+ console.log(` OpenCode: ${platformConfig.opencode ? chalk3.green("enabled") : chalk3.gray("disabled")}`);
10037
+ console.log(` Antigravity: ${platformConfig.antigravity ? chalk3.blue("enabled (NEW)") : chalk3.gray("disabled")}`);
10038
+ console.log(` Claude Code: ${platformConfig.claude ? chalk3.yellow("enabled (Beta)") : chalk3.gray("disabled")}`);
10039
+ console.log(` Cursor: ${platformConfig.cursor ? chalk3.magenta("enabled (Beta)") : chalk3.gray("disabled")}`);
10040
+ console.log(` Primary: ${chalk3.cyan(platformConfig.primary)}
9796
10041
  `);
9797
10042
  if (!options.global) {
9798
10043
  const config = await loadConfig();
@@ -9925,6 +10170,8 @@ function cliPlatformToType(platform) {
9925
10170
  return "claude";
9926
10171
  case "cursor" /* CURSOR */:
9927
10172
  return "cursor";
10173
+ case "antigravity" /* ANTIGRAVITY */:
10174
+ return "antigravity";
9928
10175
  default:
9929
10176
  return "opencode";
9930
10177
  }
@@ -9937,6 +10184,7 @@ function registerInstallCommand(program2) {
9937
10184
  logger.info("Platform Configuration:");
9938
10185
  logger.info(` Primary: ${config.getPrimaryPlatform()}`);
9939
10186
  logger.info(` OpenCode: ${config.isPlatformEnabled("opencode") ? "enabled" : "disabled"}`);
10187
+ logger.info(` Antigravity: ${config.isPlatformEnabled("antigravity") ? "enabled" : "disabled"}`);
9940
10188
  logger.info(` Claude Code: ${config.isPlatformEnabled("claude") ? "enabled (archived)" : "disabled (archived)"}`);
9941
10189
  logger.info(` Cursor: ${config.isPlatformEnabled("cursor") ? "enabled" : "disabled"}`);
9942
10190
  logger.info("");
@@ -10077,8 +10325,8 @@ import chalk5 from "chalk";
10077
10325
 
10078
10326
  // src/core/sync-engine.ts
10079
10327
  init_esm_shims();
10080
- import { readFile as readFile16, writeFile as writeFile19, copyFile, mkdir as mkdir17 } from "fs/promises";
10081
- import { join as join24, dirname as dirname4 } from "path";
10328
+ import { readFile as readFile16, writeFile as writeFile20, copyFile, mkdir as mkdir18 } from "fs/promises";
10329
+ import { join as join25, dirname as dirname4 } from "path";
10082
10330
  import inquirer3 from "inquirer";
10083
10331
  import chalk4 from "chalk";
10084
10332
 
@@ -10086,8 +10334,8 @@ import chalk4 from "chalk";
10086
10334
  init_esm_shims();
10087
10335
  init_paths();
10088
10336
  init_logger();
10089
- import { readFile as readFile13, readdir as readdir8, writeFile as writeFile16, stat } from "fs/promises";
10090
- import { join as join21 } from "path";
10337
+ import { readFile as readFile13, readdir as readdir8, writeFile as writeFile17, stat } from "fs/promises";
10338
+ import { join as join22 } from "path";
10091
10339
  import { createHash } from "crypto";
10092
10340
  var VersionManager = class {
10093
10341
  config;
@@ -10098,7 +10346,7 @@ var VersionManager = class {
10098
10346
  * Get current installed version
10099
10347
  */
10100
10348
  async getCurrentVersion() {
10101
- const versionPath = join21(paths.globalConfig(), ".version.json");
10349
+ const versionPath = join22(paths.globalConfig(), ".version.json");
10102
10350
  try {
10103
10351
  const content = await readFile13(versionPath, "utf-8");
10104
10352
  return JSON.parse(content);
@@ -10111,7 +10359,7 @@ var VersionManager = class {
10111
10359
  */
10112
10360
  getPackageVersion() {
10113
10361
  try {
10114
- const packageJson = __require(join21(process.cwd(), "package.json"));
10362
+ const packageJson = __require(join22(process.cwd(), "package.json"));
10115
10363
  return packageJson.version || "0.0.0";
10116
10364
  } catch {
10117
10365
  return "0.0.0";
@@ -10169,7 +10417,7 @@ var VersionManager = class {
10169
10417
  const removedSkills = [];
10170
10418
  const conflicts = [];
10171
10419
  const installedSkills = /* @__PURE__ */ new Map();
10172
- const installedPath = join21(paths.globalConfig(), ".installed-skills.json");
10420
+ const installedPath = join22(paths.globalConfig(), ".installed-skills.json");
10173
10421
  try {
10174
10422
  const installedData = await readFile13(installedPath, "utf-8");
10175
10423
  const installedList = JSON.parse(installedData);
@@ -10221,7 +10469,7 @@ var VersionManager = class {
10221
10469
  const loadFromDir = async (dir) => {
10222
10470
  const files = await readdir8(dir);
10223
10471
  for (const file of files) {
10224
- const filePath = join21(dir, file);
10472
+ const filePath = join22(dir, file);
10225
10473
  const stats = await stat(filePath);
10226
10474
  if (stats.isDirectory()) {
10227
10475
  await loadFromDir(filePath);
@@ -10268,9 +10516,9 @@ var VersionManager = class {
10268
10516
  * Save installed skills info
10269
10517
  */
10270
10518
  async saveInstalledSkills(skills) {
10271
- const installedPath = join21(paths.globalConfig(), ".installed-skills.json");
10519
+ const installedPath = join22(paths.globalConfig(), ".installed-skills.json");
10272
10520
  try {
10273
- await writeFile16(installedPath, JSON.stringify(skills, null, 2));
10521
+ await writeFile17(installedPath, JSON.stringify(skills, null, 2));
10274
10522
  } catch (error) {
10275
10523
  logger.error("Failed to save installed skills info:", error);
10276
10524
  }
@@ -10291,8 +10539,8 @@ var VersionManager = class {
10291
10539
  packageVersion: this.getPackageVersion(),
10292
10540
  migrationHistory: migration ? [...current.migrationHistory, migration] : current.migrationHistory
10293
10541
  };
10294
- const versionPath = join21(paths.globalConfig(), ".version.json");
10295
- await writeFile16(versionPath, JSON.stringify(updated, null, 2));
10542
+ const versionPath = join22(paths.globalConfig(), ".version.json");
10543
+ await writeFile17(versionPath, JSON.stringify(updated, null, 2));
10296
10544
  }
10297
10545
  /**
10298
10546
  * Check if migration is needed
@@ -10307,8 +10555,8 @@ var VersionManager = class {
10307
10555
  // src/core/backup-manager.ts
10308
10556
  init_esm_shims();
10309
10557
  init_logger();
10310
- import { readFile as readFile14, writeFile as writeFile17, readdir as readdir9, stat as stat2, unlink as unlink2, mkdir as mkdir16 } from "fs/promises";
10311
- import { join as join22, dirname as dirname3 } from "path";
10558
+ import { readFile as readFile14, writeFile as writeFile18, readdir as readdir9, stat as stat2, unlink as unlink2, mkdir as mkdir17 } from "fs/promises";
10559
+ import { join as join23, dirname as dirname3 } from "path";
10312
10560
  import { createHash as createHash2 } from "crypto";
10313
10561
  var BackupManager = class {
10314
10562
  configPath;
@@ -10316,7 +10564,7 @@ var BackupManager = class {
10316
10564
  maxBackups;
10317
10565
  constructor(configPath, maxBackups = 5) {
10318
10566
  this.configPath = configPath;
10319
- this.backupsDir = join22(configPath, ".backups");
10567
+ this.backupsDir = join23(configPath, ".backups");
10320
10568
  this.maxBackups = maxBackups;
10321
10569
  }
10322
10570
  /**
@@ -10324,10 +10572,10 @@ var BackupManager = class {
10324
10572
  */
10325
10573
  async createBackup(fromVersion, toVersion) {
10326
10574
  try {
10327
- await mkdir16(this.backupsDir, { recursive: true });
10575
+ await mkdir17(this.backupsDir, { recursive: true });
10328
10576
  const backupId = `${(/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-")}`;
10329
- const backupPath = join22(this.backupsDir, `${backupId}-v${toVersion}`);
10330
- await mkdir16(backupPath, { recursive: true });
10577
+ const backupPath = join23(this.backupsDir, `${backupId}-v${toVersion}`);
10578
+ await mkdir17(backupPath, { recursive: true });
10331
10579
  logger.info(`Creating backup: ${backupPath}`);
10332
10580
  const files = [];
10333
10581
  const backupItems = [
@@ -10348,8 +10596,8 @@ var BackupManager = class {
10348
10596
  files,
10349
10597
  success: true
10350
10598
  };
10351
- const manifestPath = join22(backupPath, "backup-manifest.json");
10352
- await writeFile17(manifestPath, JSON.stringify(manifest, null, 2));
10599
+ const manifestPath = join23(backupPath, "backup-manifest.json");
10600
+ await writeFile18(manifestPath, JSON.stringify(manifest, null, 2));
10353
10601
  await this.cleanupOldBackups();
10354
10602
  logger.success(`\u2713 Backup created: ${backupId}`);
10355
10603
  return backupId;
@@ -10362,20 +10610,20 @@ var BackupManager = class {
10362
10610
  * Backup a file or directory
10363
10611
  */
10364
10612
  async backupItem(sourceDir, item, targetDir) {
10365
- const sourcePath = join22(sourceDir, item);
10366
- const targetPath = join22(targetDir, item);
10613
+ const sourcePath = join23(sourceDir, item);
10614
+ const targetPath = join23(targetDir, item);
10367
10615
  const files = [];
10368
10616
  try {
10369
10617
  const stats = await stat2(sourcePath);
10370
10618
  if (stats.isDirectory()) {
10371
- await mkdir16(targetPath, { recursive: true });
10619
+ await mkdir17(targetPath, { recursive: true });
10372
10620
  const entries = await readdir9(sourcePath);
10373
10621
  for (const entry of entries) {
10374
10622
  const entryFiles = await this.backupItem(sourcePath, entry, targetPath);
10375
10623
  files.push(...entryFiles);
10376
10624
  }
10377
10625
  } else if (stats.isFile()) {
10378
- await mkdir16(dirname3(targetPath), { recursive: true });
10626
+ await mkdir17(dirname3(targetPath), { recursive: true });
10379
10627
  await this.copyFile(sourcePath, targetPath);
10380
10628
  const hash = await this.calculateHash(targetPath);
10381
10629
  files.push({
@@ -10394,7 +10642,7 @@ var BackupManager = class {
10394
10642
  */
10395
10643
  async copyFile(source, target) {
10396
10644
  const content = await readFile14(source);
10397
- await writeFile17(target, content);
10645
+ await writeFile18(target, content);
10398
10646
  }
10399
10647
  /**
10400
10648
  * Calculate file hash
@@ -10415,8 +10663,8 @@ var BackupManager = class {
10415
10663
  const entries = await readdir9(this.backupsDir);
10416
10664
  const backups = [];
10417
10665
  for (const entry of entries) {
10418
- const backupPath = join22(this.backupsDir, entry);
10419
- const manifestPath = join22(backupPath, "backup-manifest.json");
10666
+ const backupPath = join23(this.backupsDir, entry);
10667
+ const manifestPath = join23(backupPath, "backup-manifest.json");
10420
10668
  try {
10421
10669
  const manifestContent = await readFile14(manifestPath, "utf-8");
10422
10670
  const manifest = JSON.parse(manifestContent);
@@ -10446,7 +10694,7 @@ var BackupManager = class {
10446
10694
  const calculate = async (dir) => {
10447
10695
  const entries = await readdir9(dir);
10448
10696
  for (const entry of entries) {
10449
- const entryPath = join22(dir, entry);
10697
+ const entryPath = join23(dir, entry);
10450
10698
  const stats = await stat2(entryPath);
10451
10699
  if (stats.isDirectory()) {
10452
10700
  await calculate(entryPath);
@@ -10478,9 +10726,9 @@ var BackupManager = class {
10478
10726
  return false;
10479
10727
  }
10480
10728
  for (const file of backup.manifest.files) {
10481
- const sourcePath = join22(backup.path, file.path);
10482
- const targetPath = join22(this.configPath, file.path);
10483
- await mkdir16(dirname3(targetPath), { recursive: true });
10729
+ const sourcePath = join23(backup.path, file.path);
10730
+ const targetPath = join23(this.configPath, file.path);
10731
+ await mkdir17(dirname3(targetPath), { recursive: true });
10484
10732
  await this.copyFile(sourcePath, targetPath);
10485
10733
  }
10486
10734
  logger.success(`\u2713 Backup restored: ${backupId}`);
@@ -10495,10 +10743,10 @@ var BackupManager = class {
10495
10743
  */
10496
10744
  async validateBackup(backup) {
10497
10745
  try {
10498
- const manifestPath = join22(backup.path, "backup-manifest.json");
10746
+ const manifestPath = join23(backup.path, "backup-manifest.json");
10499
10747
  await readFile14(manifestPath, "utf-8");
10500
10748
  for (const file of backup.manifest.files) {
10501
- const filePath = join22(backup.path, file.path);
10749
+ const filePath = join23(backup.path, file.path);
10502
10750
  await stat2(filePath);
10503
10751
  const currentHash = await this.calculateHash(filePath);
10504
10752
  if (currentHash !== file.hash) {
@@ -10524,7 +10772,7 @@ var BackupManager = class {
10524
10772
  }
10525
10773
  const entries = await readdir9(backup.path);
10526
10774
  for (const entry of entries) {
10527
- const entryPath = join22(backup.path, entry);
10775
+ const entryPath = join23(backup.path, entry);
10528
10776
  const stats = await stat2(entryPath);
10529
10777
  if (stats.isDirectory()) {
10530
10778
  await this.removeDirectory(entryPath);
@@ -10545,7 +10793,7 @@ var BackupManager = class {
10545
10793
  async removeDirectory(dirPath) {
10546
10794
  const entries = await readdir9(dirPath);
10547
10795
  for (const entry of entries) {
10548
- const entryPath = join22(dirPath, entry);
10796
+ const entryPath = join23(dirPath, entry);
10549
10797
  const stats = await stat2(entryPath);
10550
10798
  if (stats.isDirectory()) {
10551
10799
  await this.removeDirectory(entryPath);
@@ -10591,14 +10839,14 @@ var BackupManager = class {
10591
10839
  // src/core/migration-manager.ts
10592
10840
  init_esm_shims();
10593
10841
  init_logger();
10594
- import { readFile as readFile15, writeFile as writeFile18, readdir as readdir10 } from "fs/promises";
10595
- import { join as join23 } from "path";
10842
+ import { readFile as readFile15, writeFile as writeFile19, readdir as readdir10 } from "fs/promises";
10843
+ import { join as join24 } from "path";
10596
10844
  var MigrationManager = class {
10597
10845
  configPath;
10598
10846
  migrationsDir;
10599
10847
  constructor(configPath) {
10600
10848
  this.configPath = configPath;
10601
- this.migrationsDir = join23(process.cwd(), "src/core/migrations");
10849
+ this.migrationsDir = join24(process.cwd(), "src/core/migrations");
10602
10850
  }
10603
10851
  /**
10604
10852
  * Load all available migrations
@@ -10610,7 +10858,7 @@ var MigrationManager = class {
10610
10858
  for (const file of files) {
10611
10859
  if (file.endsWith(".js") && file.startsWith("migrate-")) {
10612
10860
  try {
10613
- const module = await import(join23(this.migrationsDir, file));
10861
+ const module = await import(join24(this.migrationsDir, file));
10614
10862
  const migration = module.default || module.migration;
10615
10863
  if (migration) {
10616
10864
  migrations.push(migration);
@@ -10629,7 +10877,7 @@ var MigrationManager = class {
10629
10877
  * Get applied migrations
10630
10878
  */
10631
10879
  async getAppliedMigrations() {
10632
- const migrationHistoryPath = join23(this.configPath, ".migration-history.json");
10880
+ const migrationHistoryPath = join24(this.configPath, ".migration-history.json");
10633
10881
  try {
10634
10882
  const content = await readFile15(migrationHistoryPath, "utf-8");
10635
10883
  const history = JSON.parse(content);
@@ -10717,7 +10965,7 @@ var MigrationManager = class {
10717
10965
  * Update migration history
10718
10966
  */
10719
10967
  async updateMigrationHistory(entries) {
10720
- const historyPath = join23(this.configPath, ".migration-history.json");
10968
+ const historyPath = join24(this.configPath, ".migration-history.json");
10721
10969
  try {
10722
10970
  let history = [];
10723
10971
  try {
@@ -10726,7 +10974,7 @@ var MigrationManager = class {
10726
10974
  } catch {
10727
10975
  }
10728
10976
  history.push(...entries);
10729
- await writeFile18(historyPath, JSON.stringify(history, null, 2));
10977
+ await writeFile19(historyPath, JSON.stringify(history, null, 2));
10730
10978
  } catch (error) {
10731
10979
  logger.error("Failed to update migration history:", error);
10732
10980
  }
@@ -10735,14 +10983,14 @@ var MigrationManager = class {
10735
10983
  * Update migration history status
10736
10984
  */
10737
10985
  async updateMigrationHistoryStatus(version, status) {
10738
- const historyPath = join23(this.configPath, ".migration-history.json");
10986
+ const historyPath = join24(this.configPath, ".migration-history.json");
10739
10987
  try {
10740
10988
  const content = await readFile15(historyPath, "utf-8");
10741
10989
  const history = JSON.parse(content);
10742
10990
  const updated = history.map(
10743
10991
  (m) => m.to === version ? { ...m, status } : m
10744
10992
  );
10745
- await writeFile18(historyPath, JSON.stringify(updated, null, 2));
10993
+ await writeFile19(historyPath, JSON.stringify(updated, null, 2));
10746
10994
  } catch (error) {
10747
10995
  logger.error("Failed to update migration history status:", error);
10748
10996
  }
@@ -10751,7 +10999,7 @@ var MigrationManager = class {
10751
10999
  * Get migration history
10752
11000
  */
10753
11001
  async getMigrationHistory() {
10754
- const historyPath = join23(this.configPath, ".migration-history.json");
11002
+ const historyPath = join24(this.configPath, ".migration-history.json");
10755
11003
  try {
10756
11004
  const content = await readFile15(historyPath, "utf-8");
10757
11005
  return JSON.parse(content);
@@ -11062,17 +11310,17 @@ var SyncEngine = class {
11062
11310
  * Install a skill
11063
11311
  */
11064
11312
  async installSkill(sourceDir, skill, targetDir) {
11065
- const sourcePath = join24(sourceDir, skill.category, `${skill.name}.md`);
11066
- const targetPath = join24(targetDir, skill.category, `${skill.name}.md`);
11067
- await mkdir17(dirname4(targetPath), { recursive: true });
11313
+ const sourcePath = join25(sourceDir, skill.category, `${skill.name}.md`);
11314
+ const targetPath = join25(targetDir, skill.category, `${skill.name}.md`);
11315
+ await mkdir18(dirname4(targetPath), { recursive: true });
11068
11316
  await copyFile(sourcePath, targetPath);
11069
11317
  }
11070
11318
  /**
11071
11319
  * Archive a removed skill
11072
11320
  */
11073
11321
  async archiveSkill(targetDir, skill) {
11074
- const sourcePath = join24(targetDir, skill.category, `${skill.name}.md`);
11075
- const targetPath = join24(targetDir, skill.category, `${skill.name}-deprecated.md`);
11322
+ const sourcePath = join25(targetDir, skill.category, `${skill.name}.md`);
11323
+ const targetPath = join25(targetDir, skill.category, `${skill.name}-deprecated.md`);
11076
11324
  try {
11077
11325
  const content = await readFile16(sourcePath, "utf-8");
11078
11326
  const deprecatedNotice = `---
@@ -11083,8 +11331,8 @@ Reason: Check release notes for replacement
11083
11331
  ---
11084
11332
 
11085
11333
  ${content}`;
11086
- await mkdir17(dirname4(targetPath), { recursive: true });
11087
- await writeFile19(targetPath, deprecatedNotice);
11334
+ await mkdir18(dirname4(targetPath), { recursive: true });
11335
+ await writeFile20(targetPath, deprecatedNotice);
11088
11336
  } catch (error) {
11089
11337
  if (error.code === "ENOENT") {
11090
11338
  console.log(chalk4.yellow(` - ${skill.name} (not found, skipping)`));
@@ -11317,8 +11565,8 @@ async function configureToolAction(toolName) {
11317
11565
  // src/cli/commands/misc.ts
11318
11566
  init_esm_shims();
11319
11567
  import chalk7 from "chalk";
11320
- import { readFile as readFile17, writeFile as writeFile20, mkdir as mkdir18 } from "fs/promises";
11321
- import { join as join25 } from "path";
11568
+ import { readFile as readFile17, writeFile as writeFile21, mkdir as mkdir19 } from "fs/promises";
11569
+ import { join as join26 } from "path";
11322
11570
  init_config();
11323
11571
  init_memory();
11324
11572
  init_beads();
@@ -11381,9 +11629,9 @@ function registerModeCommand(program2) {
11381
11629
  console.log(chalk7.red(`Invalid mode. Available modes: ${validModes.join(", ")}`));
11382
11630
  return;
11383
11631
  }
11384
- const configData = JSON.parse(await readFile17(join25(configPath, "aikit.json"), "utf-8"));
11632
+ const configData = JSON.parse(await readFile17(join26(configPath, "aikit.json"), "utf-8"));
11385
11633
  configData.mode = mode;
11386
- await writeFile20(join25(configPath, "aikit.json"), JSON.stringify(configData, null, 2));
11634
+ await writeFile21(join26(configPath, "aikit.json"), JSON.stringify(configData, null, 2));
11387
11635
  console.log(chalk7.green(`\u2713 Mode set to: ${mode}`));
11388
11636
  console.log(chalk7.gray(`Configuration updated at: ${configPath}/aikit.json`));
11389
11637
  } catch (error) {
@@ -11501,7 +11749,7 @@ function registerPlatformCommand(program2) {
11501
11749
  try {
11502
11750
  let configData = {};
11503
11751
  try {
11504
- configData = JSON.parse(await readFile17(join25(configPath, "aikit.json"), "utf-8"));
11752
+ configData = JSON.parse(await readFile17(join26(configPath, "aikit.json"), "utf-8"));
11505
11753
  } catch {
11506
11754
  }
11507
11755
  if (!configData.platform) {
@@ -11509,8 +11757,8 @@ function registerPlatformCommand(program2) {
11509
11757
  }
11510
11758
  configData.platform.primary = platform;
11511
11759
  configData.platform[platform] = true;
11512
- await mkdir18(configPath, { recursive: true });
11513
- await writeFile20(join25(configPath, "aikit.json"), JSON.stringify(configData, null, 2));
11760
+ await mkdir19(configPath, { recursive: true });
11761
+ await writeFile21(join26(configPath, "aikit.json"), JSON.stringify(configData, null, 2));
11514
11762
  console.log(chalk7.green(`\u2713 Primary platform set to: ${platform}`));
11515
11763
  console.log(chalk7.gray(`Configuration updated at: ${configPath}/aikit.json`));
11516
11764
  console.log();
@@ -11532,7 +11780,7 @@ async function togglePlatform(platform, enable) {
11532
11780
  try {
11533
11781
  let configData = {};
11534
11782
  try {
11535
- configData = JSON.parse(await readFile17(join25(configPath, "aikit.json"), "utf-8"));
11783
+ configData = JSON.parse(await readFile17(join26(configPath, "aikit.json"), "utf-8"));
11536
11784
  } catch {
11537
11785
  }
11538
11786
  if (!configData.platform) {
@@ -11543,8 +11791,8 @@ async function togglePlatform(platform, enable) {
11543
11791
  };
11544
11792
  }
11545
11793
  configData.platform[platform] = enable;
11546
- await mkdir18(configPath, { recursive: true });
11547
- await writeFile20(join25(configPath, "aikit.json"), JSON.stringify(configData, null, 2));
11794
+ await mkdir19(configPath, { recursive: true });
11795
+ await writeFile21(join26(configPath, "aikit.json"), JSON.stringify(configData, null, 2));
11548
11796
  const action = enable ? "enabled" : "disabled";
11549
11797
  const emoji = enable ? "\u2713" : "\u25CB";
11550
11798
  console.log(chalk7.green(`${emoji} Platform ${platform} ${action}`));