rulesync 8.2.0 → 8.3.0

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.
@@ -20473,11 +20473,11 @@ function getBaseDirsInLightOfGlobal({
20473
20473
  }
20474
20474
 
20475
20475
  // src/lib/generate.ts
20476
- var import_node_path140 = require("path");
20476
+ var import_node_path141 = require("path");
20477
20477
  var import_es_toolkit5 = require("es-toolkit");
20478
20478
 
20479
20479
  // src/features/permissions/permissions-processor.ts
20480
- var import_mini73 = require("zod/mini");
20480
+ var import_mini74 = require("zod/mini");
20481
20481
 
20482
20482
  // src/features/permissions/claudecode-permissions.ts
20483
20483
  var import_node_path136 = require("path");
@@ -20806,6 +20806,7 @@ function convertClaudeToRulesyncPermissions(params) {
20806
20806
  var import_node_path137 = require("path");
20807
20807
  var smolToml5 = __toESM(require("smol-toml"), 1);
20808
20808
  var RULESYNC_PROFILE_NAME = "rulesync";
20809
+ var RULESYNC_BASH_RULES_FILE_NAME = "rulesync.rules";
20809
20810
  var CodexcliPermissions = class _CodexcliPermissions extends ToolPermissions {
20810
20811
  static getSettablePaths(_options = {}) {
20811
20812
  return {
@@ -20895,6 +20896,22 @@ var CodexcliPermissions = class _CodexcliPermissions extends ToolPermissions {
20895
20896
  });
20896
20897
  }
20897
20898
  };
20899
+ var CodexcliRulesFile = class extends ToolFile {
20900
+ validate() {
20901
+ return { success: true, error: null };
20902
+ }
20903
+ };
20904
+ function createCodexcliBashRulesFile({
20905
+ baseDir = process.cwd(),
20906
+ config
20907
+ }) {
20908
+ return new CodexcliRulesFile({
20909
+ baseDir,
20910
+ relativeDirPath: (0, import_node_path137.join)(".codex", "rules"),
20911
+ relativeFilePath: RULESYNC_BASH_RULES_FILE_NAME,
20912
+ fileContent: buildCodexBashRulesContent(config)
20913
+ });
20914
+ }
20898
20915
  function convertRulesyncToCodexProfile({
20899
20916
  config,
20900
20917
  logger: logger5
@@ -21003,6 +21020,46 @@ function mapReadAction(action) {
21003
21020
  function mapWriteAction(action) {
21004
21021
  return action === "allow" ? "write" : "none";
21005
21022
  }
21023
+ function buildCodexBashRulesContent(config) {
21024
+ const bashRules = config.permission.bash ?? {};
21025
+ const entries = Object.entries(bashRules);
21026
+ const header = [
21027
+ "# Generated by Rulesync from .rulesync/permissions.json (permission.bash)",
21028
+ "# https://developers.openai.com/codex/rules"
21029
+ ];
21030
+ if (entries.length === 0) {
21031
+ return [...header, "# No bash permission rules were configured."].join("\n");
21032
+ }
21033
+ const ruleBlocks = entries.map(([pattern, action]) => {
21034
+ const tokens = toCommandPatternTokens(pattern);
21035
+ if (tokens.length === 0) {
21036
+ return null;
21037
+ }
21038
+ const serializedTokens = tokens.map((token) => JSON.stringify(token)).join(", ");
21039
+ const decision = mapBashActionToDecision(action);
21040
+ return [
21041
+ "",
21042
+ `# ${pattern}`,
21043
+ "prefix_rule(",
21044
+ ` pattern = [${serializedTokens}],`,
21045
+ ` decision = ${JSON.stringify(decision)},`,
21046
+ ` justification = ${JSON.stringify(`Generated from Rulesync permission.bash: ${pattern}`)},`,
21047
+ ")"
21048
+ ].join("\n");
21049
+ }).filter((block) => block !== null);
21050
+ if (ruleBlocks.length === 0) {
21051
+ return [...header, "# No valid bash patterns were found."].join("\n");
21052
+ }
21053
+ return [...header, ...ruleBlocks].join("\n");
21054
+ }
21055
+ function toCommandPatternTokens(commandPattern) {
21056
+ return commandPattern.trim().split(/\s+/).map((token) => token.trim()).filter((token) => token.length > 0);
21057
+ }
21058
+ function mapBashActionToDecision(action) {
21059
+ if (action === "allow") return "allow";
21060
+ if (action === "ask") return "prompt";
21061
+ return "forbidden";
21062
+ }
21006
21063
 
21007
21064
  // src/features/permissions/geminicli-permissions.ts
21008
21065
  var import_node_path138 = require("path");
@@ -21168,16 +21225,200 @@ function parseGeminicliToolEntry({ entry }) {
21168
21225
  };
21169
21226
  }
21170
21227
 
21171
- // src/features/permissions/opencode-permissions.ts
21228
+ // src/features/permissions/kiro-permissions.ts
21172
21229
  var import_node_path139 = require("path");
21173
- var import_jsonc_parser5 = require("jsonc-parser");
21174
21230
  var import_mini72 = require("zod/mini");
21175
- var OpencodePermissionSchema = import_mini72.z.union([
21176
- import_mini72.z.enum(["allow", "ask", "deny"]),
21177
- import_mini72.z.record(import_mini72.z.string(), import_mini72.z.enum(["allow", "ask", "deny"]))
21231
+ var KiroAgentSchema = import_mini72.z.looseObject({
21232
+ allowedTools: import_mini72.z.optional(import_mini72.z.array(import_mini72.z.string())),
21233
+ toolsSettings: import_mini72.z.optional(import_mini72.z.record(import_mini72.z.string(), import_mini72.z.unknown()))
21234
+ });
21235
+ var UnknownRecordSchema = import_mini72.z.record(import_mini72.z.string(), import_mini72.z.unknown());
21236
+ var KiroPermissions = class _KiroPermissions extends ToolPermissions {
21237
+ static getSettablePaths(_options = {}) {
21238
+ return {
21239
+ relativeDirPath: (0, import_node_path139.join)(".kiro", "agents"),
21240
+ relativeFilePath: "default.json"
21241
+ };
21242
+ }
21243
+ isDeletable() {
21244
+ return false;
21245
+ }
21246
+ static async fromFile({
21247
+ baseDir = process.cwd(),
21248
+ validate = true
21249
+ }) {
21250
+ const paths = this.getSettablePaths();
21251
+ const filePath = (0, import_node_path139.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath);
21252
+ const fileContent = await readFileContentOrNull(filePath) ?? JSON.stringify({}, null, 2);
21253
+ return new _KiroPermissions({
21254
+ baseDir,
21255
+ relativeDirPath: paths.relativeDirPath,
21256
+ relativeFilePath: paths.relativeFilePath,
21257
+ fileContent,
21258
+ validate
21259
+ });
21260
+ }
21261
+ static async fromRulesyncPermissions({
21262
+ baseDir = process.cwd(),
21263
+ rulesyncPermissions,
21264
+ validate = true,
21265
+ logger: logger5
21266
+ }) {
21267
+ const paths = this.getSettablePaths();
21268
+ const filePath = (0, import_node_path139.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath);
21269
+ const existingContent = await readFileContentOrNull(filePath) ?? JSON.stringify({}, null, 2);
21270
+ const parsedResult = KiroAgentSchema.safeParse(JSON.parse(existingContent));
21271
+ if (!parsedResult.success) {
21272
+ throw new Error(
21273
+ `Failed to parse existing Kiro agent config at ${filePath}: ${formatError(parsedResult.error)}`
21274
+ );
21275
+ }
21276
+ const config = rulesyncPermissions.getJson();
21277
+ const next = buildKiroPermissionsFromRulesync({ config, logger: logger5, existing: parsedResult.data });
21278
+ return new _KiroPermissions({
21279
+ baseDir,
21280
+ relativeDirPath: paths.relativeDirPath,
21281
+ relativeFilePath: paths.relativeFilePath,
21282
+ fileContent: JSON.stringify(next, null, 2),
21283
+ validate
21284
+ });
21285
+ }
21286
+ toRulesyncPermissions() {
21287
+ let parsed;
21288
+ try {
21289
+ parsed = KiroAgentSchema.parse(JSON.parse(this.getFileContent()));
21290
+ } catch (error) {
21291
+ throw new Error(
21292
+ `Failed to parse Kiro permissions content in ${(0, import_node_path139.join)(this.getRelativeDirPath(), this.getRelativeFilePath())}: ${formatError(error)}`,
21293
+ { cause: error }
21294
+ );
21295
+ }
21296
+ const permission = {};
21297
+ const toolsSettings = parsed.toolsSettings ?? {};
21298
+ const shellSettings = asRecord(toolsSettings.shell);
21299
+ const shellAllow = asStringArray(shellSettings.allowedCommands);
21300
+ const shellDeny = asStringArray(shellSettings.deniedCommands);
21301
+ if (shellAllow.length > 0 || shellDeny.length > 0) {
21302
+ permission.bash = {};
21303
+ for (const pattern of shellAllow) permission.bash[pattern] = "allow";
21304
+ for (const pattern of shellDeny) permission.bash[pattern] = "deny";
21305
+ }
21306
+ const readSettings = asRecord(toolsSettings.read);
21307
+ const readAllow = asStringArray(readSettings.allowedPaths);
21308
+ const readDeny = asStringArray(readSettings.deniedPaths);
21309
+ if (readAllow.length > 0 || readDeny.length > 0) {
21310
+ permission.read = {};
21311
+ for (const pattern of readAllow) permission.read[pattern] = "allow";
21312
+ for (const pattern of readDeny) permission.read[pattern] = "deny";
21313
+ }
21314
+ const writeSettings = asRecord(toolsSettings.write);
21315
+ const writeAllow = asStringArray(writeSettings.allowedPaths);
21316
+ const writeDeny = asStringArray(writeSettings.deniedPaths);
21317
+ if (writeAllow.length > 0 || writeDeny.length > 0) {
21318
+ permission.write = {};
21319
+ for (const pattern of writeAllow) permission.write[pattern] = "allow";
21320
+ for (const pattern of writeDeny) permission.write[pattern] = "deny";
21321
+ }
21322
+ const allowedTools = new Set(parsed.allowedTools ?? []);
21323
+ if (allowedTools.has("web_fetch")) {
21324
+ permission.webfetch = { "*": "allow" };
21325
+ }
21326
+ if (allowedTools.has("web_search")) {
21327
+ permission.websearch = { "*": "allow" };
21328
+ }
21329
+ return this.toRulesyncPermissionsDefault({
21330
+ fileContent: JSON.stringify({ permission }, null, 2)
21331
+ });
21332
+ }
21333
+ validate() {
21334
+ return { success: true, error: null };
21335
+ }
21336
+ static forDeletion({
21337
+ baseDir = process.cwd(),
21338
+ relativeDirPath,
21339
+ relativeFilePath
21340
+ }) {
21341
+ return new _KiroPermissions({
21342
+ baseDir,
21343
+ relativeDirPath,
21344
+ relativeFilePath,
21345
+ fileContent: JSON.stringify({}, null, 2),
21346
+ validate: false
21347
+ });
21348
+ }
21349
+ };
21350
+ function buildKiroPermissionsFromRulesync({
21351
+ config,
21352
+ logger: logger5,
21353
+ existing
21354
+ }) {
21355
+ const nextAllowedTools = new Set(existing.allowedTools ?? []);
21356
+ const nextToolsSettings = { ...asRecord(existing.toolsSettings) };
21357
+ const shell = {
21358
+ allowedCommands: [],
21359
+ deniedCommands: []
21360
+ };
21361
+ const read = {
21362
+ allowedPaths: [],
21363
+ deniedPaths: []
21364
+ };
21365
+ const write = {
21366
+ allowedPaths: [],
21367
+ deniedPaths: []
21368
+ };
21369
+ for (const [category, rules] of Object.entries(config.permission)) {
21370
+ for (const [pattern, action] of Object.entries(rules)) {
21371
+ if (action === "ask") {
21372
+ logger5?.warn(`Kiro permissions do not support "ask". Skipping ${category}:${pattern}`);
21373
+ continue;
21374
+ }
21375
+ if (category === "bash") {
21376
+ (action === "allow" ? shell.allowedCommands : shell.deniedCommands).push(pattern);
21377
+ } else if (category === "read") {
21378
+ (action === "allow" ? read.allowedPaths : read.deniedPaths).push(pattern);
21379
+ } else if (category === "edit" || category === "write") {
21380
+ (action === "allow" ? write.allowedPaths : write.deniedPaths).push(pattern);
21381
+ } else if (category === "webfetch" || category === "websearch") {
21382
+ if (pattern !== "*") {
21383
+ logger5?.warn(
21384
+ `Kiro ${category} supports only wildcard (*) via allowedTools. Skipping rule: ${pattern}`
21385
+ );
21386
+ continue;
21387
+ }
21388
+ if (action === "allow")
21389
+ nextAllowedTools.add(category === "webfetch" ? "web_fetch" : "web_search");
21390
+ } else {
21391
+ logger5?.warn(`Kiro permissions do not support category: ${category}. Skipping.`);
21392
+ }
21393
+ }
21394
+ }
21395
+ nextToolsSettings.shell = shell;
21396
+ nextToolsSettings.read = read;
21397
+ nextToolsSettings.write = write;
21398
+ return {
21399
+ ...existing,
21400
+ allowedTools: [...nextAllowedTools].toSorted(),
21401
+ toolsSettings: nextToolsSettings
21402
+ };
21403
+ }
21404
+ function asRecord(value) {
21405
+ const result = UnknownRecordSchema.safeParse(value);
21406
+ return result.success ? result.data : {};
21407
+ }
21408
+ function asStringArray(value) {
21409
+ return Array.isArray(value) ? value.filter((item) => typeof item === "string") : [];
21410
+ }
21411
+
21412
+ // src/features/permissions/opencode-permissions.ts
21413
+ var import_node_path140 = require("path");
21414
+ var import_jsonc_parser5 = require("jsonc-parser");
21415
+ var import_mini73 = require("zod/mini");
21416
+ var OpencodePermissionSchema = import_mini73.z.union([
21417
+ import_mini73.z.enum(["allow", "ask", "deny"]),
21418
+ import_mini73.z.record(import_mini73.z.string(), import_mini73.z.enum(["allow", "ask", "deny"]))
21178
21419
  ]);
21179
- var OpencodePermissionsConfigSchema = import_mini72.z.looseObject({
21180
- permission: import_mini72.z.optional(import_mini72.z.record(import_mini72.z.string(), OpencodePermissionSchema))
21420
+ var OpencodePermissionsConfigSchema = import_mini73.z.looseObject({
21421
+ permission: import_mini73.z.optional(import_mini73.z.record(import_mini73.z.string(), OpencodePermissionSchema))
21181
21422
  });
21182
21423
  var OpencodePermissions = class _OpencodePermissions extends ToolPermissions {
21183
21424
  json;
@@ -21194,7 +21435,7 @@ var OpencodePermissions = class _OpencodePermissions extends ToolPermissions {
21194
21435
  static getSettablePaths({
21195
21436
  global = false
21196
21437
  } = {}) {
21197
- return global ? { relativeDirPath: (0, import_node_path139.join)(".config", "opencode"), relativeFilePath: "opencode.json" } : { relativeDirPath: ".", relativeFilePath: "opencode.json" };
21438
+ return global ? { relativeDirPath: (0, import_node_path140.join)(".config", "opencode"), relativeFilePath: "opencode.json" } : { relativeDirPath: ".", relativeFilePath: "opencode.json" };
21198
21439
  }
21199
21440
  static async fromFile({
21200
21441
  baseDir = process.cwd(),
@@ -21202,9 +21443,9 @@ var OpencodePermissions = class _OpencodePermissions extends ToolPermissions {
21202
21443
  global = false
21203
21444
  }) {
21204
21445
  const basePaths = _OpencodePermissions.getSettablePaths({ global });
21205
- const jsonDir = (0, import_node_path139.join)(baseDir, basePaths.relativeDirPath);
21206
- const jsoncPath = (0, import_node_path139.join)(jsonDir, "opencode.jsonc");
21207
- const jsonPath = (0, import_node_path139.join)(jsonDir, "opencode.json");
21446
+ const jsonDir = (0, import_node_path140.join)(baseDir, basePaths.relativeDirPath);
21447
+ const jsoncPath = (0, import_node_path140.join)(jsonDir, "opencode.jsonc");
21448
+ const jsonPath = (0, import_node_path140.join)(jsonDir, "opencode.json");
21208
21449
  let fileContent = await readFileContentOrNull(jsoncPath);
21209
21450
  let relativeFilePath = "opencode.jsonc";
21210
21451
  if (!fileContent) {
@@ -21229,9 +21470,9 @@ var OpencodePermissions = class _OpencodePermissions extends ToolPermissions {
21229
21470
  global = false
21230
21471
  }) {
21231
21472
  const basePaths = _OpencodePermissions.getSettablePaths({ global });
21232
- const jsonDir = (0, import_node_path139.join)(baseDir, basePaths.relativeDirPath);
21233
- const jsoncPath = (0, import_node_path139.join)(jsonDir, "opencode.jsonc");
21234
- const jsonPath = (0, import_node_path139.join)(jsonDir, "opencode.json");
21473
+ const jsonDir = (0, import_node_path140.join)(baseDir, basePaths.relativeDirPath);
21474
+ const jsoncPath = (0, import_node_path140.join)(jsonDir, "opencode.jsonc");
21475
+ const jsonPath = (0, import_node_path140.join)(jsonDir, "opencode.json");
21235
21476
  let fileContent = await readFileContentOrNull(jsoncPath);
21236
21477
  let relativeFilePath = "opencode.jsonc";
21237
21478
  if (!fileContent) {
@@ -21305,9 +21546,10 @@ var permissionsProcessorToolTargetTuple = [
21305
21546
  "claudecode",
21306
21547
  "codexcli",
21307
21548
  "geminicli",
21549
+ "kiro",
21308
21550
  "opencode"
21309
21551
  ];
21310
- var PermissionsProcessorToolTargetSchema = import_mini73.z.enum(permissionsProcessorToolTargetTuple);
21552
+ var PermissionsProcessorToolTargetSchema = import_mini74.z.enum(permissionsProcessorToolTargetTuple);
21311
21553
  var toolPermissionsFactories = /* @__PURE__ */ new Map([
21312
21554
  [
21313
21555
  "claudecode",
@@ -21315,7 +21557,7 @@ var toolPermissionsFactories = /* @__PURE__ */ new Map([
21315
21557
  class: ClaudecodePermissions,
21316
21558
  meta: {
21317
21559
  supportsProject: true,
21318
- supportsGlobal: false,
21560
+ supportsGlobal: true,
21319
21561
  supportsImport: true
21320
21562
  }
21321
21563
  }
@@ -21342,6 +21584,17 @@ var toolPermissionsFactories = /* @__PURE__ */ new Map([
21342
21584
  }
21343
21585
  }
21344
21586
  ],
21587
+ [
21588
+ "kiro",
21589
+ {
21590
+ class: KiroPermissions,
21591
+ meta: {
21592
+ supportsProject: true,
21593
+ supportsGlobal: false,
21594
+ supportsImport: true
21595
+ }
21596
+ }
21597
+ ],
21345
21598
  [
21346
21599
  "opencode",
21347
21600
  {
@@ -21437,7 +21690,14 @@ var PermissionsProcessor = class extends FeatureProcessor {
21437
21690
  logger: this.logger,
21438
21691
  global: this.global
21439
21692
  });
21440
- return [toolPermissions];
21693
+ if (this.toolTarget !== "codexcli") {
21694
+ return [toolPermissions];
21695
+ }
21696
+ const bashRulesFile = createCodexcliBashRulesFile({
21697
+ baseDir: this.baseDir,
21698
+ config: rulesyncPermissions.getJson()
21699
+ });
21700
+ return [toolPermissions, bashRulesFile];
21441
21701
  }
21442
21702
  async convertToolFilesToRulesyncFiles(toolFiles) {
21443
21703
  const permissions = toolFiles.filter((f) => f instanceof ToolPermissions);
@@ -21524,7 +21784,7 @@ function warnUnsupportedTargets(params) {
21524
21784
  }
21525
21785
  }
21526
21786
  async function checkRulesyncDirExists(params) {
21527
- return fileExists((0, import_node_path140.join)(params.baseDir, RULESYNC_RELATIVE_DIR_PATH));
21787
+ return fileExists((0, import_node_path141.join)(params.baseDir, RULESYNC_RELATIVE_DIR_PATH));
21528
21788
  }
21529
21789
  async function generate(params) {
21530
21790
  const { config, logger: logger5 } = params;
@@ -21994,7 +22254,7 @@ async function generateCommand(logger5, options) {
21994
22254
  }
21995
22255
 
21996
22256
  // src/cli/commands/gitignore.ts
21997
- var import_node_path141 = require("path");
22257
+ var import_node_path142 = require("path");
21998
22258
 
21999
22259
  // src/cli/commands/gitignore-entries.ts
22000
22260
  var normalizeGitignoreEntryTargets = (target) => {
@@ -22338,7 +22598,7 @@ var removeExistingRulesyncEntries = (content) => {
22338
22598
  return result;
22339
22599
  };
22340
22600
  var gitignoreCommand = async (logger5, options) => {
22341
- const gitignorePath = (0, import_node_path141.join)(process.cwd(), ".gitignore");
22601
+ const gitignorePath = (0, import_node_path142.join)(process.cwd(), ".gitignore");
22342
22602
  let gitignoreContent = "";
22343
22603
  if (await fileExists(gitignorePath)) {
22344
22604
  gitignoreContent = await readFileContent(gitignorePath);
@@ -22705,7 +22965,7 @@ async function importCommand(logger5, options) {
22705
22965
  }
22706
22966
 
22707
22967
  // src/lib/init.ts
22708
- var import_node_path142 = require("path");
22968
+ var import_node_path143 = require("path");
22709
22969
  async function init() {
22710
22970
  const sampleFiles = await createSampleFiles();
22711
22971
  const configFile = await createConfigFile();
@@ -22898,27 +23158,27 @@ Keep the summary concise and ready to reuse in future tasks.`
22898
23158
  await ensureDir(subagentPaths.relativeDirPath);
22899
23159
  await ensureDir(skillPaths.relativeDirPath);
22900
23160
  await ensureDir(ignorePaths.recommended.relativeDirPath);
22901
- const ruleFilepath = (0, import_node_path142.join)(rulePaths.recommended.relativeDirPath, sampleRuleFile.filename);
23161
+ const ruleFilepath = (0, import_node_path143.join)(rulePaths.recommended.relativeDirPath, sampleRuleFile.filename);
22902
23162
  results.push(await writeIfNotExists(ruleFilepath, sampleRuleFile.content));
22903
- const mcpFilepath = (0, import_node_path142.join)(
23163
+ const mcpFilepath = (0, import_node_path143.join)(
22904
23164
  mcpPaths.recommended.relativeDirPath,
22905
23165
  mcpPaths.recommended.relativeFilePath
22906
23166
  );
22907
23167
  results.push(await writeIfNotExists(mcpFilepath, sampleMcpFile.content));
22908
- const commandFilepath = (0, import_node_path142.join)(commandPaths.relativeDirPath, sampleCommandFile.filename);
23168
+ const commandFilepath = (0, import_node_path143.join)(commandPaths.relativeDirPath, sampleCommandFile.filename);
22909
23169
  results.push(await writeIfNotExists(commandFilepath, sampleCommandFile.content));
22910
- const subagentFilepath = (0, import_node_path142.join)(subagentPaths.relativeDirPath, sampleSubagentFile.filename);
23170
+ const subagentFilepath = (0, import_node_path143.join)(subagentPaths.relativeDirPath, sampleSubagentFile.filename);
22911
23171
  results.push(await writeIfNotExists(subagentFilepath, sampleSubagentFile.content));
22912
- const skillDirPath = (0, import_node_path142.join)(skillPaths.relativeDirPath, sampleSkillFile.dirName);
23172
+ const skillDirPath = (0, import_node_path143.join)(skillPaths.relativeDirPath, sampleSkillFile.dirName);
22913
23173
  await ensureDir(skillDirPath);
22914
- const skillFilepath = (0, import_node_path142.join)(skillDirPath, SKILL_FILE_NAME);
23174
+ const skillFilepath = (0, import_node_path143.join)(skillDirPath, SKILL_FILE_NAME);
22915
23175
  results.push(await writeIfNotExists(skillFilepath, sampleSkillFile.content));
22916
- const ignoreFilepath = (0, import_node_path142.join)(
23176
+ const ignoreFilepath = (0, import_node_path143.join)(
22917
23177
  ignorePaths.recommended.relativeDirPath,
22918
23178
  ignorePaths.recommended.relativeFilePath
22919
23179
  );
22920
23180
  results.push(await writeIfNotExists(ignoreFilepath, sampleIgnoreFile.content));
22921
- const hooksFilepath = (0, import_node_path142.join)(hooksPaths.relativeDirPath, hooksPaths.relativeFilePath);
23181
+ const hooksFilepath = (0, import_node_path143.join)(hooksPaths.relativeDirPath, hooksPaths.relativeFilePath);
22922
23182
  results.push(await writeIfNotExists(hooksFilepath, sampleHooksFile.content));
22923
23183
  return results;
22924
23184
  }
@@ -22966,12 +23226,12 @@ async function initCommand(logger5) {
22966
23226
  }
22967
23227
 
22968
23228
  // src/lib/sources.ts
22969
- var import_node_path145 = require("path");
23229
+ var import_node_path146 = require("path");
22970
23230
  var import_promise2 = require("es-toolkit/promise");
22971
23231
 
22972
23232
  // src/lib/git-client.ts
22973
23233
  var import_node_child_process = require("child_process");
22974
- var import_node_path143 = require("path");
23234
+ var import_node_path144 = require("path");
22975
23235
  var import_node_util2 = require("util");
22976
23236
  var execFileAsync = (0, import_node_util2.promisify)(import_node_child_process.execFile);
22977
23237
  var GIT_TIMEOUT_MS = 6e4;
@@ -23059,7 +23319,7 @@ async function fetchSkillFiles(params) {
23059
23319
  const { url, ref, skillsPath, logger: logger5 } = params;
23060
23320
  validateGitUrl(url, { logger: logger5 });
23061
23321
  validateRef(ref);
23062
- if (skillsPath.split(/[/\\]/).includes("..") || (0, import_node_path143.isAbsolute)(skillsPath)) {
23322
+ if (skillsPath.split(/[/\\]/).includes("..") || (0, import_node_path144.isAbsolute)(skillsPath)) {
23063
23323
  throw new GitClientError(
23064
23324
  `Invalid skillsPath "${skillsPath}": must be a relative path without ".."`
23065
23325
  );
@@ -23093,7 +23353,7 @@ async function fetchSkillFiles(params) {
23093
23353
  timeout: GIT_TIMEOUT_MS
23094
23354
  });
23095
23355
  await execFileAsync("git", ["-C", tmpDir, "checkout"], { timeout: GIT_TIMEOUT_MS });
23096
- const skillsDir = (0, import_node_path143.join)(tmpDir, skillsPath);
23356
+ const skillsDir = (0, import_node_path144.join)(tmpDir, skillsPath);
23097
23357
  if (!await directoryExists(skillsDir)) return [];
23098
23358
  return await walkDirectory(skillsDir, skillsDir, 0, { totalFiles: 0, totalSize: 0 }, logger5);
23099
23359
  } catch (error) {
@@ -23115,7 +23375,7 @@ async function walkDirectory(dir, baseDir, depth = 0, ctx = { totalFiles: 0, tot
23115
23375
  const results = [];
23116
23376
  for (const name of await listDirectoryFiles(dir)) {
23117
23377
  if (name === ".git") continue;
23118
- const fullPath = (0, import_node_path143.join)(dir, name);
23378
+ const fullPath = (0, import_node_path144.join)(dir, name);
23119
23379
  if (await isSymlink(fullPath)) {
23120
23380
  logger5?.warn(`Skipping symlink "${fullPath}".`);
23121
23381
  continue;
@@ -23143,7 +23403,7 @@ async function walkDirectory(dir, baseDir, depth = 0, ctx = { totalFiles: 0, tot
23143
23403
  );
23144
23404
  }
23145
23405
  const content = await readFileContent(fullPath);
23146
- results.push({ relativePath: (0, import_node_path143.relative)(baseDir, fullPath), content, size });
23406
+ results.push({ relativePath: (0, import_node_path144.relative)(baseDir, fullPath), content, size });
23147
23407
  }
23148
23408
  }
23149
23409
  return results;
@@ -23151,28 +23411,28 @@ async function walkDirectory(dir, baseDir, depth = 0, ctx = { totalFiles: 0, tot
23151
23411
 
23152
23412
  // src/lib/sources-lock.ts
23153
23413
  var import_node_crypto = require("crypto");
23154
- var import_node_path144 = require("path");
23155
- var import_mini74 = require("zod/mini");
23414
+ var import_node_path145 = require("path");
23415
+ var import_mini75 = require("zod/mini");
23156
23416
  var LOCKFILE_VERSION = 1;
23157
- var LockedSkillSchema = import_mini74.z.object({
23158
- integrity: import_mini74.z.string()
23417
+ var LockedSkillSchema = import_mini75.z.object({
23418
+ integrity: import_mini75.z.string()
23159
23419
  });
23160
- var LockedSourceSchema = import_mini74.z.object({
23161
- requestedRef: (0, import_mini74.optional)(import_mini74.z.string()),
23162
- resolvedRef: import_mini74.z.string().check((0, import_mini74.refine)((v) => /^[0-9a-f]{40}$/.test(v), "resolvedRef must be a 40-character hex SHA")),
23163
- resolvedAt: (0, import_mini74.optional)(import_mini74.z.string()),
23164
- skills: import_mini74.z.record(import_mini74.z.string(), LockedSkillSchema)
23420
+ var LockedSourceSchema = import_mini75.z.object({
23421
+ requestedRef: (0, import_mini75.optional)(import_mini75.z.string()),
23422
+ resolvedRef: import_mini75.z.string().check((0, import_mini75.refine)((v) => /^[0-9a-f]{40}$/.test(v), "resolvedRef must be a 40-character hex SHA")),
23423
+ resolvedAt: (0, import_mini75.optional)(import_mini75.z.string()),
23424
+ skills: import_mini75.z.record(import_mini75.z.string(), LockedSkillSchema)
23165
23425
  });
23166
- var SourcesLockSchema = import_mini74.z.object({
23167
- lockfileVersion: import_mini74.z.number(),
23168
- sources: import_mini74.z.record(import_mini74.z.string(), LockedSourceSchema)
23426
+ var SourcesLockSchema = import_mini75.z.object({
23427
+ lockfileVersion: import_mini75.z.number(),
23428
+ sources: import_mini75.z.record(import_mini75.z.string(), LockedSourceSchema)
23169
23429
  });
23170
- var LegacyLockedSourceSchema = import_mini74.z.object({
23171
- resolvedRef: import_mini74.z.string(),
23172
- skills: import_mini74.z.array(import_mini74.z.string())
23430
+ var LegacyLockedSourceSchema = import_mini75.z.object({
23431
+ resolvedRef: import_mini75.z.string(),
23432
+ skills: import_mini75.z.array(import_mini75.z.string())
23173
23433
  });
23174
- var LegacySourcesLockSchema = import_mini74.z.object({
23175
- sources: import_mini74.z.record(import_mini74.z.string(), LegacyLockedSourceSchema)
23434
+ var LegacySourcesLockSchema = import_mini75.z.object({
23435
+ sources: import_mini75.z.record(import_mini75.z.string(), LegacyLockedSourceSchema)
23176
23436
  });
23177
23437
  function migrateLegacyLock(params) {
23178
23438
  const { legacy, logger: logger5 } = params;
@@ -23197,7 +23457,7 @@ function createEmptyLock() {
23197
23457
  }
23198
23458
  async function readLockFile(params) {
23199
23459
  const { logger: logger5 } = params;
23200
- const lockPath = (0, import_node_path144.join)(params.baseDir, RULESYNC_SOURCES_LOCK_RELATIVE_FILE_PATH);
23460
+ const lockPath = (0, import_node_path145.join)(params.baseDir, RULESYNC_SOURCES_LOCK_RELATIVE_FILE_PATH);
23201
23461
  if (!await fileExists(lockPath)) {
23202
23462
  logger5.debug("No sources lockfile found, starting fresh.");
23203
23463
  return createEmptyLock();
@@ -23226,7 +23486,7 @@ async function readLockFile(params) {
23226
23486
  }
23227
23487
  async function writeLockFile(params) {
23228
23488
  const { logger: logger5 } = params;
23229
- const lockPath = (0, import_node_path144.join)(params.baseDir, RULESYNC_SOURCES_LOCK_RELATIVE_FILE_PATH);
23489
+ const lockPath = (0, import_node_path145.join)(params.baseDir, RULESYNC_SOURCES_LOCK_RELATIVE_FILE_PATH);
23230
23490
  const content = JSON.stringify(params.lock, null, 2) + "\n";
23231
23491
  await writeFileContent(lockPath, content);
23232
23492
  logger5.debug(`Wrote sources lockfile to ${lockPath}`);
@@ -23400,7 +23660,7 @@ function logGitClientHints(params) {
23400
23660
  async function checkLockedSkillsExist(curatedDir, skillNames) {
23401
23661
  if (skillNames.length === 0) return true;
23402
23662
  for (const name of skillNames) {
23403
- if (!await directoryExists((0, import_node_path145.join)(curatedDir, name))) {
23663
+ if (!await directoryExists((0, import_node_path146.join)(curatedDir, name))) {
23404
23664
  return false;
23405
23665
  }
23406
23666
  }
@@ -23408,10 +23668,10 @@ async function checkLockedSkillsExist(curatedDir, skillNames) {
23408
23668
  }
23409
23669
  async function cleanPreviousCuratedSkills(params) {
23410
23670
  const { curatedDir, lockedSkillNames, logger: logger5 } = params;
23411
- const resolvedCuratedDir = (0, import_node_path145.resolve)(curatedDir);
23671
+ const resolvedCuratedDir = (0, import_node_path146.resolve)(curatedDir);
23412
23672
  for (const prevSkill of lockedSkillNames) {
23413
- const prevDir = (0, import_node_path145.join)(curatedDir, prevSkill);
23414
- if (!(0, import_node_path145.resolve)(prevDir).startsWith(resolvedCuratedDir + import_node_path145.sep)) {
23673
+ const prevDir = (0, import_node_path146.join)(curatedDir, prevSkill);
23674
+ if (!(0, import_node_path146.resolve)(prevDir).startsWith(resolvedCuratedDir + import_node_path146.sep)) {
23415
23675
  logger5.warn(
23416
23676
  `Skipping removal of "${prevSkill}": resolved path is outside the curated directory.`
23417
23677
  );
@@ -23450,9 +23710,9 @@ async function writeSkillAndComputeIntegrity(params) {
23450
23710
  for (const file of files) {
23451
23711
  checkPathTraversal({
23452
23712
  relativePath: file.relativePath,
23453
- intendedRootDir: (0, import_node_path145.join)(curatedDir, skillName)
23713
+ intendedRootDir: (0, import_node_path146.join)(curatedDir, skillName)
23454
23714
  });
23455
- await writeFileContent((0, import_node_path145.join)(curatedDir, skillName, file.relativePath), file.content);
23715
+ await writeFileContent((0, import_node_path146.join)(curatedDir, skillName, file.relativePath), file.content);
23456
23716
  written.push({ path: file.relativePath, content: file.content });
23457
23717
  }
23458
23718
  const integrity = computeSkillIntegrity(written);
@@ -23529,7 +23789,7 @@ async function fetchSource(params) {
23529
23789
  ref = resolvedSha;
23530
23790
  logger5.debug(`Resolved ${sourceKey} ref "${requestedRef}" to SHA: ${resolvedSha}`);
23531
23791
  }
23532
- const curatedDir = (0, import_node_path145.join)(baseDir, RULESYNC_CURATED_SKILLS_RELATIVE_DIR_PATH);
23792
+ const curatedDir = (0, import_node_path146.join)(baseDir, RULESYNC_CURATED_SKILLS_RELATIVE_DIR_PATH);
23533
23793
  if (locked && resolvedSha === locked.resolvedRef && !updateSources) {
23534
23794
  const allExist = await checkLockedSkillsExist(curatedDir, lockedSkillNames);
23535
23795
  if (allExist) {
@@ -23654,7 +23914,7 @@ async function fetchSourceViaGit(params) {
23654
23914
  requestedRef = def.ref;
23655
23915
  resolvedSha = def.sha;
23656
23916
  }
23657
- const curatedDir = (0, import_node_path145.join)(baseDir, RULESYNC_CURATED_SKILLS_RELATIVE_DIR_PATH);
23917
+ const curatedDir = (0, import_node_path146.join)(baseDir, RULESYNC_CURATED_SKILLS_RELATIVE_DIR_PATH);
23658
23918
  if (locked && resolvedSha === locked.resolvedRef && !updateSources) {
23659
23919
  if (await checkLockedSkillsExist(curatedDir, lockedSkillNames)) {
23660
23920
  return { skillCount: 0, fetchedSkillNames: lockedSkillNames, updatedLock: lock };
@@ -23770,11 +24030,11 @@ async function installCommand(logger5, options) {
23770
24030
  var import_fastmcp = require("fastmcp");
23771
24031
 
23772
24032
  // src/mcp/tools.ts
23773
- var import_mini83 = require("zod/mini");
24033
+ var import_mini84 = require("zod/mini");
23774
24034
 
23775
24035
  // src/mcp/commands.ts
23776
- var import_node_path146 = require("path");
23777
- var import_mini75 = require("zod/mini");
24036
+ var import_node_path147 = require("path");
24037
+ var import_mini76 = require("zod/mini");
23778
24038
 
23779
24039
  // src/utils/logger.ts
23780
24040
  var BaseLogger = class {
@@ -23925,7 +24185,7 @@ var logger = new ConsoleLogger({ verbose: false, silent: true });
23925
24185
  var maxCommandSizeBytes = 1024 * 1024;
23926
24186
  var maxCommandsCount = 1e3;
23927
24187
  async function listCommands() {
23928
- const commandsDir = (0, import_node_path146.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
24188
+ const commandsDir = (0, import_node_path147.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
23929
24189
  try {
23930
24190
  const files = await listDirectoryFiles(commandsDir);
23931
24191
  const mdFiles = files.filter((file) => file.endsWith(".md"));
@@ -23941,7 +24201,7 @@ async function listCommands() {
23941
24201
  });
23942
24202
  const frontmatter = command.getFrontmatter();
23943
24203
  return {
23944
- relativePathFromCwd: (0, import_node_path146.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, file),
24204
+ relativePathFromCwd: (0, import_node_path147.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, file),
23945
24205
  frontmatter
23946
24206
  };
23947
24207
  } catch (error) {
@@ -23963,13 +24223,13 @@ async function getCommand({ relativePathFromCwd }) {
23963
24223
  relativePath: relativePathFromCwd,
23964
24224
  intendedRootDir: process.cwd()
23965
24225
  });
23966
- const filename = (0, import_node_path146.basename)(relativePathFromCwd);
24226
+ const filename = (0, import_node_path147.basename)(relativePathFromCwd);
23967
24227
  try {
23968
24228
  const command = await RulesyncCommand.fromFile({
23969
24229
  relativeFilePath: filename
23970
24230
  });
23971
24231
  return {
23972
- relativePathFromCwd: (0, import_node_path146.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
24232
+ relativePathFromCwd: (0, import_node_path147.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
23973
24233
  frontmatter: command.getFrontmatter(),
23974
24234
  body: command.getBody()
23975
24235
  };
@@ -23988,7 +24248,7 @@ async function putCommand({
23988
24248
  relativePath: relativePathFromCwd,
23989
24249
  intendedRootDir: process.cwd()
23990
24250
  });
23991
- const filename = (0, import_node_path146.basename)(relativePathFromCwd);
24251
+ const filename = (0, import_node_path147.basename)(relativePathFromCwd);
23992
24252
  const estimatedSize = JSON.stringify(frontmatter).length + body.length;
23993
24253
  if (estimatedSize > maxCommandSizeBytes) {
23994
24254
  throw new Error(
@@ -23998,7 +24258,7 @@ async function putCommand({
23998
24258
  try {
23999
24259
  const existingCommands = await listCommands();
24000
24260
  const isUpdate = existingCommands.some(
24001
- (command2) => command2.relativePathFromCwd === (0, import_node_path146.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
24261
+ (command2) => command2.relativePathFromCwd === (0, import_node_path147.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
24002
24262
  );
24003
24263
  if (!isUpdate && existingCommands.length >= maxCommandsCount) {
24004
24264
  throw new Error(
@@ -24015,11 +24275,11 @@ async function putCommand({
24015
24275
  fileContent,
24016
24276
  validate: true
24017
24277
  });
24018
- const commandsDir = (0, import_node_path146.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
24278
+ const commandsDir = (0, import_node_path147.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
24019
24279
  await ensureDir(commandsDir);
24020
24280
  await writeFileContent(command.getFilePath(), command.getFileContent());
24021
24281
  return {
24022
- relativePathFromCwd: (0, import_node_path146.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
24282
+ relativePathFromCwd: (0, import_node_path147.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
24023
24283
  frontmatter: command.getFrontmatter(),
24024
24284
  body: command.getBody()
24025
24285
  };
@@ -24034,12 +24294,12 @@ async function deleteCommand({ relativePathFromCwd }) {
24034
24294
  relativePath: relativePathFromCwd,
24035
24295
  intendedRootDir: process.cwd()
24036
24296
  });
24037
- const filename = (0, import_node_path146.basename)(relativePathFromCwd);
24038
- const fullPath = (0, import_node_path146.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename);
24297
+ const filename = (0, import_node_path147.basename)(relativePathFromCwd);
24298
+ const fullPath = (0, import_node_path147.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename);
24039
24299
  try {
24040
24300
  await removeFile(fullPath);
24041
24301
  return {
24042
- relativePathFromCwd: (0, import_node_path146.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
24302
+ relativePathFromCwd: (0, import_node_path147.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
24043
24303
  };
24044
24304
  } catch (error) {
24045
24305
  throw new Error(`Failed to delete command file ${relativePathFromCwd}: ${formatError(error)}`, {
@@ -24048,23 +24308,23 @@ async function deleteCommand({ relativePathFromCwd }) {
24048
24308
  }
24049
24309
  }
24050
24310
  var commandToolSchemas = {
24051
- listCommands: import_mini75.z.object({}),
24052
- getCommand: import_mini75.z.object({
24053
- relativePathFromCwd: import_mini75.z.string()
24311
+ listCommands: import_mini76.z.object({}),
24312
+ getCommand: import_mini76.z.object({
24313
+ relativePathFromCwd: import_mini76.z.string()
24054
24314
  }),
24055
- putCommand: import_mini75.z.object({
24056
- relativePathFromCwd: import_mini75.z.string(),
24315
+ putCommand: import_mini76.z.object({
24316
+ relativePathFromCwd: import_mini76.z.string(),
24057
24317
  frontmatter: RulesyncCommandFrontmatterSchema,
24058
- body: import_mini75.z.string()
24318
+ body: import_mini76.z.string()
24059
24319
  }),
24060
- deleteCommand: import_mini75.z.object({
24061
- relativePathFromCwd: import_mini75.z.string()
24320
+ deleteCommand: import_mini76.z.object({
24321
+ relativePathFromCwd: import_mini76.z.string()
24062
24322
  })
24063
24323
  };
24064
24324
  var commandTools = {
24065
24325
  listCommands: {
24066
24326
  name: "listCommands",
24067
- description: `List all commands from ${(0, import_node_path146.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
24327
+ description: `List all commands from ${(0, import_node_path147.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
24068
24328
  parameters: commandToolSchemas.listCommands,
24069
24329
  execute: async () => {
24070
24330
  const commands = await listCommands();
@@ -24106,15 +24366,15 @@ var commandTools = {
24106
24366
  };
24107
24367
 
24108
24368
  // src/mcp/generate.ts
24109
- var import_mini76 = require("zod/mini");
24110
- var generateOptionsSchema = import_mini76.z.object({
24111
- targets: import_mini76.z.optional(import_mini76.z.array(import_mini76.z.string())),
24112
- features: import_mini76.z.optional(import_mini76.z.array(import_mini76.z.string())),
24113
- delete: import_mini76.z.optional(import_mini76.z.boolean()),
24114
- global: import_mini76.z.optional(import_mini76.z.boolean()),
24115
- simulateCommands: import_mini76.z.optional(import_mini76.z.boolean()),
24116
- simulateSubagents: import_mini76.z.optional(import_mini76.z.boolean()),
24117
- simulateSkills: import_mini76.z.optional(import_mini76.z.boolean())
24369
+ var import_mini77 = require("zod/mini");
24370
+ var generateOptionsSchema = import_mini77.z.object({
24371
+ targets: import_mini77.z.optional(import_mini77.z.array(import_mini77.z.string())),
24372
+ features: import_mini77.z.optional(import_mini77.z.array(import_mini77.z.string())),
24373
+ delete: import_mini77.z.optional(import_mini77.z.boolean()),
24374
+ global: import_mini77.z.optional(import_mini77.z.boolean()),
24375
+ simulateCommands: import_mini77.z.optional(import_mini77.z.boolean()),
24376
+ simulateSubagents: import_mini77.z.optional(import_mini77.z.boolean()),
24377
+ simulateSkills: import_mini77.z.optional(import_mini77.z.boolean())
24118
24378
  });
24119
24379
  async function executeGenerate(options = {}) {
24120
24380
  try {
@@ -24193,11 +24453,11 @@ var generateTools = {
24193
24453
  };
24194
24454
 
24195
24455
  // src/mcp/ignore.ts
24196
- var import_node_path147 = require("path");
24197
- var import_mini77 = require("zod/mini");
24456
+ var import_node_path148 = require("path");
24457
+ var import_mini78 = require("zod/mini");
24198
24458
  var maxIgnoreFileSizeBytes = 100 * 1024;
24199
24459
  async function getIgnoreFile() {
24200
- const ignoreFilePath = (0, import_node_path147.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
24460
+ const ignoreFilePath = (0, import_node_path148.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
24201
24461
  try {
24202
24462
  const content = await readFileContent(ignoreFilePath);
24203
24463
  return {
@@ -24214,7 +24474,7 @@ async function getIgnoreFile() {
24214
24474
  }
24215
24475
  }
24216
24476
  async function putIgnoreFile({ content }) {
24217
- const ignoreFilePath = (0, import_node_path147.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
24477
+ const ignoreFilePath = (0, import_node_path148.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
24218
24478
  const contentSizeBytes = Buffer.byteLength(content, "utf8");
24219
24479
  if (contentSizeBytes > maxIgnoreFileSizeBytes) {
24220
24480
  throw new Error(
@@ -24238,8 +24498,8 @@ async function putIgnoreFile({ content }) {
24238
24498
  }
24239
24499
  }
24240
24500
  async function deleteIgnoreFile() {
24241
- const aiignorePath = (0, import_node_path147.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
24242
- const legacyIgnorePath = (0, import_node_path147.join)(process.cwd(), RULESYNC_IGNORE_RELATIVE_FILE_PATH);
24501
+ const aiignorePath = (0, import_node_path148.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
24502
+ const legacyIgnorePath = (0, import_node_path148.join)(process.cwd(), RULESYNC_IGNORE_RELATIVE_FILE_PATH);
24243
24503
  try {
24244
24504
  await Promise.all([removeFile(aiignorePath), removeFile(legacyIgnorePath)]);
24245
24505
  return {
@@ -24257,11 +24517,11 @@ async function deleteIgnoreFile() {
24257
24517
  }
24258
24518
  }
24259
24519
  var ignoreToolSchemas = {
24260
- getIgnoreFile: import_mini77.z.object({}),
24261
- putIgnoreFile: import_mini77.z.object({
24262
- content: import_mini77.z.string()
24520
+ getIgnoreFile: import_mini78.z.object({}),
24521
+ putIgnoreFile: import_mini78.z.object({
24522
+ content: import_mini78.z.string()
24263
24523
  }),
24264
- deleteIgnoreFile: import_mini77.z.object({})
24524
+ deleteIgnoreFile: import_mini78.z.object({})
24265
24525
  };
24266
24526
  var ignoreTools = {
24267
24527
  getIgnoreFile: {
@@ -24294,11 +24554,11 @@ var ignoreTools = {
24294
24554
  };
24295
24555
 
24296
24556
  // src/mcp/import.ts
24297
- var import_mini78 = require("zod/mini");
24298
- var importOptionsSchema = import_mini78.z.object({
24299
- target: import_mini78.z.string(),
24300
- features: import_mini78.z.optional(import_mini78.z.array(import_mini78.z.string())),
24301
- global: import_mini78.z.optional(import_mini78.z.boolean())
24557
+ var import_mini79 = require("zod/mini");
24558
+ var importOptionsSchema = import_mini79.z.object({
24559
+ target: import_mini79.z.string(),
24560
+ features: import_mini79.z.optional(import_mini79.z.array(import_mini79.z.string())),
24561
+ global: import_mini79.z.optional(import_mini79.z.boolean())
24302
24562
  });
24303
24563
  async function executeImport(options) {
24304
24564
  try {
@@ -24369,15 +24629,15 @@ var importTools = {
24369
24629
  };
24370
24630
 
24371
24631
  // src/mcp/mcp.ts
24372
- var import_node_path148 = require("path");
24373
- var import_mini79 = require("zod/mini");
24632
+ var import_node_path149 = require("path");
24633
+ var import_mini80 = require("zod/mini");
24374
24634
  var maxMcpSizeBytes = 1024 * 1024;
24375
24635
  async function getMcpFile() {
24376
24636
  try {
24377
24637
  const rulesyncMcp = await RulesyncMcp.fromFile({
24378
24638
  validate: true
24379
24639
  });
24380
- const relativePathFromCwd = (0, import_node_path148.join)(
24640
+ const relativePathFromCwd = (0, import_node_path149.join)(
24381
24641
  rulesyncMcp.getRelativeDirPath(),
24382
24642
  rulesyncMcp.getRelativeFilePath()
24383
24643
  );
@@ -24415,7 +24675,7 @@ async function putMcpFile({ content }) {
24415
24675
  const paths = RulesyncMcp.getSettablePaths();
24416
24676
  const relativeDirPath = paths.recommended.relativeDirPath;
24417
24677
  const relativeFilePath = paths.recommended.relativeFilePath;
24418
- const fullPath = (0, import_node_path148.join)(baseDir, relativeDirPath, relativeFilePath);
24678
+ const fullPath = (0, import_node_path149.join)(baseDir, relativeDirPath, relativeFilePath);
24419
24679
  const rulesyncMcp = new RulesyncMcp({
24420
24680
  baseDir,
24421
24681
  relativeDirPath,
@@ -24423,9 +24683,9 @@ async function putMcpFile({ content }) {
24423
24683
  fileContent: content,
24424
24684
  validate: true
24425
24685
  });
24426
- await ensureDir((0, import_node_path148.join)(baseDir, relativeDirPath));
24686
+ await ensureDir((0, import_node_path149.join)(baseDir, relativeDirPath));
24427
24687
  await writeFileContent(fullPath, content);
24428
- const relativePathFromCwd = (0, import_node_path148.join)(relativeDirPath, relativeFilePath);
24688
+ const relativePathFromCwd = (0, import_node_path149.join)(relativeDirPath, relativeFilePath);
24429
24689
  return {
24430
24690
  relativePathFromCwd,
24431
24691
  content: rulesyncMcp.getFileContent()
@@ -24443,15 +24703,15 @@ async function deleteMcpFile() {
24443
24703
  try {
24444
24704
  const baseDir = process.cwd();
24445
24705
  const paths = RulesyncMcp.getSettablePaths();
24446
- const recommendedPath = (0, import_node_path148.join)(
24706
+ const recommendedPath = (0, import_node_path149.join)(
24447
24707
  baseDir,
24448
24708
  paths.recommended.relativeDirPath,
24449
24709
  paths.recommended.relativeFilePath
24450
24710
  );
24451
- const legacyPath = (0, import_node_path148.join)(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
24711
+ const legacyPath = (0, import_node_path149.join)(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
24452
24712
  await removeFile(recommendedPath);
24453
24713
  await removeFile(legacyPath);
24454
- const relativePathFromCwd = (0, import_node_path148.join)(
24714
+ const relativePathFromCwd = (0, import_node_path149.join)(
24455
24715
  paths.recommended.relativeDirPath,
24456
24716
  paths.recommended.relativeFilePath
24457
24717
  );
@@ -24468,11 +24728,11 @@ async function deleteMcpFile() {
24468
24728
  }
24469
24729
  }
24470
24730
  var mcpToolSchemas = {
24471
- getMcpFile: import_mini79.z.object({}),
24472
- putMcpFile: import_mini79.z.object({
24473
- content: import_mini79.z.string()
24731
+ getMcpFile: import_mini80.z.object({}),
24732
+ putMcpFile: import_mini80.z.object({
24733
+ content: import_mini80.z.string()
24474
24734
  }),
24475
- deleteMcpFile: import_mini79.z.object({})
24735
+ deleteMcpFile: import_mini80.z.object({})
24476
24736
  };
24477
24737
  var mcpTools = {
24478
24738
  getMcpFile: {
@@ -24505,13 +24765,13 @@ var mcpTools = {
24505
24765
  };
24506
24766
 
24507
24767
  // src/mcp/rules.ts
24508
- var import_node_path149 = require("path");
24509
- var import_mini80 = require("zod/mini");
24768
+ var import_node_path150 = require("path");
24769
+ var import_mini81 = require("zod/mini");
24510
24770
  var logger2 = new ConsoleLogger({ verbose: false, silent: true });
24511
24771
  var maxRuleSizeBytes = 1024 * 1024;
24512
24772
  var maxRulesCount = 1e3;
24513
24773
  async function listRules() {
24514
- const rulesDir = (0, import_node_path149.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
24774
+ const rulesDir = (0, import_node_path150.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
24515
24775
  try {
24516
24776
  const files = await listDirectoryFiles(rulesDir);
24517
24777
  const mdFiles = files.filter((file) => file.endsWith(".md"));
@@ -24524,7 +24784,7 @@ async function listRules() {
24524
24784
  });
24525
24785
  const frontmatter = rule.getFrontmatter();
24526
24786
  return {
24527
- relativePathFromCwd: (0, import_node_path149.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, file),
24787
+ relativePathFromCwd: (0, import_node_path150.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, file),
24528
24788
  frontmatter
24529
24789
  };
24530
24790
  } catch (error) {
@@ -24546,14 +24806,14 @@ async function getRule({ relativePathFromCwd }) {
24546
24806
  relativePath: relativePathFromCwd,
24547
24807
  intendedRootDir: process.cwd()
24548
24808
  });
24549
- const filename = (0, import_node_path149.basename)(relativePathFromCwd);
24809
+ const filename = (0, import_node_path150.basename)(relativePathFromCwd);
24550
24810
  try {
24551
24811
  const rule = await RulesyncRule.fromFile({
24552
24812
  relativeFilePath: filename,
24553
24813
  validate: true
24554
24814
  });
24555
24815
  return {
24556
- relativePathFromCwd: (0, import_node_path149.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
24816
+ relativePathFromCwd: (0, import_node_path150.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
24557
24817
  frontmatter: rule.getFrontmatter(),
24558
24818
  body: rule.getBody()
24559
24819
  };
@@ -24572,7 +24832,7 @@ async function putRule({
24572
24832
  relativePath: relativePathFromCwd,
24573
24833
  intendedRootDir: process.cwd()
24574
24834
  });
24575
- const filename = (0, import_node_path149.basename)(relativePathFromCwd);
24835
+ const filename = (0, import_node_path150.basename)(relativePathFromCwd);
24576
24836
  const estimatedSize = JSON.stringify(frontmatter).length + body.length;
24577
24837
  if (estimatedSize > maxRuleSizeBytes) {
24578
24838
  throw new Error(
@@ -24582,7 +24842,7 @@ async function putRule({
24582
24842
  try {
24583
24843
  const existingRules = await listRules();
24584
24844
  const isUpdate = existingRules.some(
24585
- (rule2) => rule2.relativePathFromCwd === (0, import_node_path149.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
24845
+ (rule2) => rule2.relativePathFromCwd === (0, import_node_path150.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
24586
24846
  );
24587
24847
  if (!isUpdate && existingRules.length >= maxRulesCount) {
24588
24848
  throw new Error(
@@ -24597,11 +24857,11 @@ async function putRule({
24597
24857
  body,
24598
24858
  validate: true
24599
24859
  });
24600
- const rulesDir = (0, import_node_path149.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
24860
+ const rulesDir = (0, import_node_path150.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
24601
24861
  await ensureDir(rulesDir);
24602
24862
  await writeFileContent(rule.getFilePath(), rule.getFileContent());
24603
24863
  return {
24604
- relativePathFromCwd: (0, import_node_path149.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
24864
+ relativePathFromCwd: (0, import_node_path150.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
24605
24865
  frontmatter: rule.getFrontmatter(),
24606
24866
  body: rule.getBody()
24607
24867
  };
@@ -24616,12 +24876,12 @@ async function deleteRule({ relativePathFromCwd }) {
24616
24876
  relativePath: relativePathFromCwd,
24617
24877
  intendedRootDir: process.cwd()
24618
24878
  });
24619
- const filename = (0, import_node_path149.basename)(relativePathFromCwd);
24620
- const fullPath = (0, import_node_path149.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH, filename);
24879
+ const filename = (0, import_node_path150.basename)(relativePathFromCwd);
24880
+ const fullPath = (0, import_node_path150.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH, filename);
24621
24881
  try {
24622
24882
  await removeFile(fullPath);
24623
24883
  return {
24624
- relativePathFromCwd: (0, import_node_path149.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
24884
+ relativePathFromCwd: (0, import_node_path150.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
24625
24885
  };
24626
24886
  } catch (error) {
24627
24887
  throw new Error(`Failed to delete rule file ${relativePathFromCwd}: ${formatError(error)}`, {
@@ -24630,23 +24890,23 @@ async function deleteRule({ relativePathFromCwd }) {
24630
24890
  }
24631
24891
  }
24632
24892
  var ruleToolSchemas = {
24633
- listRules: import_mini80.z.object({}),
24634
- getRule: import_mini80.z.object({
24635
- relativePathFromCwd: import_mini80.z.string()
24893
+ listRules: import_mini81.z.object({}),
24894
+ getRule: import_mini81.z.object({
24895
+ relativePathFromCwd: import_mini81.z.string()
24636
24896
  }),
24637
- putRule: import_mini80.z.object({
24638
- relativePathFromCwd: import_mini80.z.string(),
24897
+ putRule: import_mini81.z.object({
24898
+ relativePathFromCwd: import_mini81.z.string(),
24639
24899
  frontmatter: RulesyncRuleFrontmatterSchema,
24640
- body: import_mini80.z.string()
24900
+ body: import_mini81.z.string()
24641
24901
  }),
24642
- deleteRule: import_mini80.z.object({
24643
- relativePathFromCwd: import_mini80.z.string()
24902
+ deleteRule: import_mini81.z.object({
24903
+ relativePathFromCwd: import_mini81.z.string()
24644
24904
  })
24645
24905
  };
24646
24906
  var ruleTools = {
24647
24907
  listRules: {
24648
24908
  name: "listRules",
24649
- description: `List all rules from ${(0, import_node_path149.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
24909
+ description: `List all rules from ${(0, import_node_path150.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
24650
24910
  parameters: ruleToolSchemas.listRules,
24651
24911
  execute: async () => {
24652
24912
  const rules = await listRules();
@@ -24688,8 +24948,8 @@ var ruleTools = {
24688
24948
  };
24689
24949
 
24690
24950
  // src/mcp/skills.ts
24691
- var import_node_path150 = require("path");
24692
- var import_mini81 = require("zod/mini");
24951
+ var import_node_path151 = require("path");
24952
+ var import_mini82 = require("zod/mini");
24693
24953
  var logger3 = new ConsoleLogger({ verbose: false, silent: true });
24694
24954
  var maxSkillSizeBytes = 1024 * 1024;
24695
24955
  var maxSkillsCount = 1e3;
@@ -24706,19 +24966,19 @@ function mcpSkillFileToAiDirFile(file) {
24706
24966
  };
24707
24967
  }
24708
24968
  function extractDirName(relativeDirPathFromCwd) {
24709
- const dirName = (0, import_node_path150.basename)(relativeDirPathFromCwd);
24969
+ const dirName = (0, import_node_path151.basename)(relativeDirPathFromCwd);
24710
24970
  if (!dirName) {
24711
24971
  throw new Error(`Invalid path: ${relativeDirPathFromCwd}`);
24712
24972
  }
24713
24973
  return dirName;
24714
24974
  }
24715
24975
  async function listSkills() {
24716
- const skillsDir = (0, import_node_path150.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH);
24976
+ const skillsDir = (0, import_node_path151.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH);
24717
24977
  try {
24718
- const skillDirPaths = await findFilesByGlobs((0, import_node_path150.join)(skillsDir, "*"), { type: "dir" });
24978
+ const skillDirPaths = await findFilesByGlobs((0, import_node_path151.join)(skillsDir, "*"), { type: "dir" });
24719
24979
  const skills = await Promise.all(
24720
24980
  skillDirPaths.map(async (dirPath) => {
24721
- const dirName = (0, import_node_path150.basename)(dirPath);
24981
+ const dirName = (0, import_node_path151.basename)(dirPath);
24722
24982
  if (!dirName) return null;
24723
24983
  try {
24724
24984
  const skill = await RulesyncSkill.fromDir({
@@ -24726,7 +24986,7 @@ async function listSkills() {
24726
24986
  });
24727
24987
  const frontmatter = skill.getFrontmatter();
24728
24988
  return {
24729
- relativeDirPathFromCwd: (0, import_node_path150.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
24989
+ relativeDirPathFromCwd: (0, import_node_path151.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
24730
24990
  frontmatter
24731
24991
  };
24732
24992
  } catch (error) {
@@ -24754,7 +25014,7 @@ async function getSkill({ relativeDirPathFromCwd }) {
24754
25014
  dirName
24755
25015
  });
24756
25016
  return {
24757
- relativeDirPathFromCwd: (0, import_node_path150.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
25017
+ relativeDirPathFromCwd: (0, import_node_path151.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
24758
25018
  frontmatter: skill.getFrontmatter(),
24759
25019
  body: skill.getBody(),
24760
25020
  otherFiles: skill.getOtherFiles().map(aiDirFileToMcpSkillFile)
@@ -24788,7 +25048,7 @@ async function putSkill({
24788
25048
  try {
24789
25049
  const existingSkills = await listSkills();
24790
25050
  const isUpdate = existingSkills.some(
24791
- (skill2) => skill2.relativeDirPathFromCwd === (0, import_node_path150.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
25051
+ (skill2) => skill2.relativeDirPathFromCwd === (0, import_node_path151.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
24792
25052
  );
24793
25053
  if (!isUpdate && existingSkills.length >= maxSkillsCount) {
24794
25054
  throw new Error(
@@ -24805,9 +25065,9 @@ async function putSkill({
24805
25065
  otherFiles: aiDirFiles,
24806
25066
  validate: true
24807
25067
  });
24808
- const skillDirPath = (0, import_node_path150.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
25068
+ const skillDirPath = (0, import_node_path151.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
24809
25069
  await ensureDir(skillDirPath);
24810
- const skillFilePath = (0, import_node_path150.join)(skillDirPath, SKILL_FILE_NAME);
25070
+ const skillFilePath = (0, import_node_path151.join)(skillDirPath, SKILL_FILE_NAME);
24811
25071
  const skillFileContent = stringifyFrontmatter(body, frontmatter);
24812
25072
  await writeFileContent(skillFilePath, skillFileContent);
24813
25073
  for (const file of otherFiles) {
@@ -24815,15 +25075,15 @@ async function putSkill({
24815
25075
  relativePath: file.name,
24816
25076
  intendedRootDir: skillDirPath
24817
25077
  });
24818
- const filePath = (0, import_node_path150.join)(skillDirPath, file.name);
24819
- const fileDir = (0, import_node_path150.join)(skillDirPath, (0, import_node_path150.dirname)(file.name));
25078
+ const filePath = (0, import_node_path151.join)(skillDirPath, file.name);
25079
+ const fileDir = (0, import_node_path151.join)(skillDirPath, (0, import_node_path151.dirname)(file.name));
24820
25080
  if (fileDir !== skillDirPath) {
24821
25081
  await ensureDir(fileDir);
24822
25082
  }
24823
25083
  await writeFileContent(filePath, file.body);
24824
25084
  }
24825
25085
  return {
24826
- relativeDirPathFromCwd: (0, import_node_path150.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
25086
+ relativeDirPathFromCwd: (0, import_node_path151.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
24827
25087
  frontmatter: skill.getFrontmatter(),
24828
25088
  body: skill.getBody(),
24829
25089
  otherFiles: skill.getOtherFiles().map(aiDirFileToMcpSkillFile)
@@ -24845,13 +25105,13 @@ async function deleteSkill({
24845
25105
  intendedRootDir: process.cwd()
24846
25106
  });
24847
25107
  const dirName = extractDirName(relativeDirPathFromCwd);
24848
- const skillDirPath = (0, import_node_path150.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
25108
+ const skillDirPath = (0, import_node_path151.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
24849
25109
  try {
24850
25110
  if (await directoryExists(skillDirPath)) {
24851
25111
  await removeDirectory(skillDirPath);
24852
25112
  }
24853
25113
  return {
24854
- relativeDirPathFromCwd: (0, import_node_path150.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
25114
+ relativeDirPathFromCwd: (0, import_node_path151.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
24855
25115
  };
24856
25116
  } catch (error) {
24857
25117
  throw new Error(
@@ -24862,29 +25122,29 @@ async function deleteSkill({
24862
25122
  );
24863
25123
  }
24864
25124
  }
24865
- var McpSkillFileSchema = import_mini81.z.object({
24866
- name: import_mini81.z.string(),
24867
- body: import_mini81.z.string()
25125
+ var McpSkillFileSchema = import_mini82.z.object({
25126
+ name: import_mini82.z.string(),
25127
+ body: import_mini82.z.string()
24868
25128
  });
24869
25129
  var skillToolSchemas = {
24870
- listSkills: import_mini81.z.object({}),
24871
- getSkill: import_mini81.z.object({
24872
- relativeDirPathFromCwd: import_mini81.z.string()
25130
+ listSkills: import_mini82.z.object({}),
25131
+ getSkill: import_mini82.z.object({
25132
+ relativeDirPathFromCwd: import_mini82.z.string()
24873
25133
  }),
24874
- putSkill: import_mini81.z.object({
24875
- relativeDirPathFromCwd: import_mini81.z.string(),
25134
+ putSkill: import_mini82.z.object({
25135
+ relativeDirPathFromCwd: import_mini82.z.string(),
24876
25136
  frontmatter: RulesyncSkillFrontmatterSchema,
24877
- body: import_mini81.z.string(),
24878
- otherFiles: import_mini81.z.optional(import_mini81.z.array(McpSkillFileSchema))
25137
+ body: import_mini82.z.string(),
25138
+ otherFiles: import_mini82.z.optional(import_mini82.z.array(McpSkillFileSchema))
24879
25139
  }),
24880
- deleteSkill: import_mini81.z.object({
24881
- relativeDirPathFromCwd: import_mini81.z.string()
25140
+ deleteSkill: import_mini82.z.object({
25141
+ relativeDirPathFromCwd: import_mini82.z.string()
24882
25142
  })
24883
25143
  };
24884
25144
  var skillTools = {
24885
25145
  listSkills: {
24886
25146
  name: "listSkills",
24887
- description: `List all skills from ${(0, import_node_path150.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, "*", SKILL_FILE_NAME)} with their frontmatter.`,
25147
+ description: `List all skills from ${(0, import_node_path151.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, "*", SKILL_FILE_NAME)} with their frontmatter.`,
24888
25148
  parameters: skillToolSchemas.listSkills,
24889
25149
  execute: async () => {
24890
25150
  const skills = await listSkills();
@@ -24927,13 +25187,13 @@ var skillTools = {
24927
25187
  };
24928
25188
 
24929
25189
  // src/mcp/subagents.ts
24930
- var import_node_path151 = require("path");
24931
- var import_mini82 = require("zod/mini");
25190
+ var import_node_path152 = require("path");
25191
+ var import_mini83 = require("zod/mini");
24932
25192
  var logger4 = new ConsoleLogger({ verbose: false, silent: true });
24933
25193
  var maxSubagentSizeBytes = 1024 * 1024;
24934
25194
  var maxSubagentsCount = 1e3;
24935
25195
  async function listSubagents() {
24936
- const subagentsDir = (0, import_node_path151.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
25196
+ const subagentsDir = (0, import_node_path152.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
24937
25197
  try {
24938
25198
  const files = await listDirectoryFiles(subagentsDir);
24939
25199
  const mdFiles = files.filter((file) => file.endsWith(".md"));
@@ -24946,7 +25206,7 @@ async function listSubagents() {
24946
25206
  });
24947
25207
  const frontmatter = subagent.getFrontmatter();
24948
25208
  return {
24949
- relativePathFromCwd: (0, import_node_path151.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, file),
25209
+ relativePathFromCwd: (0, import_node_path152.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, file),
24950
25210
  frontmatter
24951
25211
  };
24952
25212
  } catch (error) {
@@ -24970,14 +25230,14 @@ async function getSubagent({ relativePathFromCwd }) {
24970
25230
  relativePath: relativePathFromCwd,
24971
25231
  intendedRootDir: process.cwd()
24972
25232
  });
24973
- const filename = (0, import_node_path151.basename)(relativePathFromCwd);
25233
+ const filename = (0, import_node_path152.basename)(relativePathFromCwd);
24974
25234
  try {
24975
25235
  const subagent = await RulesyncSubagent.fromFile({
24976
25236
  relativeFilePath: filename,
24977
25237
  validate: true
24978
25238
  });
24979
25239
  return {
24980
- relativePathFromCwd: (0, import_node_path151.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
25240
+ relativePathFromCwd: (0, import_node_path152.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
24981
25241
  frontmatter: subagent.getFrontmatter(),
24982
25242
  body: subagent.getBody()
24983
25243
  };
@@ -24996,7 +25256,7 @@ async function putSubagent({
24996
25256
  relativePath: relativePathFromCwd,
24997
25257
  intendedRootDir: process.cwd()
24998
25258
  });
24999
- const filename = (0, import_node_path151.basename)(relativePathFromCwd);
25259
+ const filename = (0, import_node_path152.basename)(relativePathFromCwd);
25000
25260
  const estimatedSize = JSON.stringify(frontmatter).length + body.length;
25001
25261
  if (estimatedSize > maxSubagentSizeBytes) {
25002
25262
  throw new Error(
@@ -25006,7 +25266,7 @@ async function putSubagent({
25006
25266
  try {
25007
25267
  const existingSubagents = await listSubagents();
25008
25268
  const isUpdate = existingSubagents.some(
25009
- (subagent2) => subagent2.relativePathFromCwd === (0, import_node_path151.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
25269
+ (subagent2) => subagent2.relativePathFromCwd === (0, import_node_path152.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
25010
25270
  );
25011
25271
  if (!isUpdate && existingSubagents.length >= maxSubagentsCount) {
25012
25272
  throw new Error(
@@ -25021,11 +25281,11 @@ async function putSubagent({
25021
25281
  body,
25022
25282
  validate: true
25023
25283
  });
25024
- const subagentsDir = (0, import_node_path151.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
25284
+ const subagentsDir = (0, import_node_path152.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
25025
25285
  await ensureDir(subagentsDir);
25026
25286
  await writeFileContent(subagent.getFilePath(), subagent.getFileContent());
25027
25287
  return {
25028
- relativePathFromCwd: (0, import_node_path151.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
25288
+ relativePathFromCwd: (0, import_node_path152.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
25029
25289
  frontmatter: subagent.getFrontmatter(),
25030
25290
  body: subagent.getBody()
25031
25291
  };
@@ -25040,12 +25300,12 @@ async function deleteSubagent({ relativePathFromCwd }) {
25040
25300
  relativePath: relativePathFromCwd,
25041
25301
  intendedRootDir: process.cwd()
25042
25302
  });
25043
- const filename = (0, import_node_path151.basename)(relativePathFromCwd);
25044
- const fullPath = (0, import_node_path151.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename);
25303
+ const filename = (0, import_node_path152.basename)(relativePathFromCwd);
25304
+ const fullPath = (0, import_node_path152.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename);
25045
25305
  try {
25046
25306
  await removeFile(fullPath);
25047
25307
  return {
25048
- relativePathFromCwd: (0, import_node_path151.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
25308
+ relativePathFromCwd: (0, import_node_path152.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
25049
25309
  };
25050
25310
  } catch (error) {
25051
25311
  throw new Error(
@@ -25057,23 +25317,23 @@ async function deleteSubagent({ relativePathFromCwd }) {
25057
25317
  }
25058
25318
  }
25059
25319
  var subagentToolSchemas = {
25060
- listSubagents: import_mini82.z.object({}),
25061
- getSubagent: import_mini82.z.object({
25062
- relativePathFromCwd: import_mini82.z.string()
25320
+ listSubagents: import_mini83.z.object({}),
25321
+ getSubagent: import_mini83.z.object({
25322
+ relativePathFromCwd: import_mini83.z.string()
25063
25323
  }),
25064
- putSubagent: import_mini82.z.object({
25065
- relativePathFromCwd: import_mini82.z.string(),
25324
+ putSubagent: import_mini83.z.object({
25325
+ relativePathFromCwd: import_mini83.z.string(),
25066
25326
  frontmatter: RulesyncSubagentFrontmatterSchema,
25067
- body: import_mini82.z.string()
25327
+ body: import_mini83.z.string()
25068
25328
  }),
25069
- deleteSubagent: import_mini82.z.object({
25070
- relativePathFromCwd: import_mini82.z.string()
25329
+ deleteSubagent: import_mini83.z.object({
25330
+ relativePathFromCwd: import_mini83.z.string()
25071
25331
  })
25072
25332
  };
25073
25333
  var subagentTools = {
25074
25334
  listSubagents: {
25075
25335
  name: "listSubagents",
25076
- description: `List all subagents from ${(0, import_node_path151.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
25336
+ description: `List all subagents from ${(0, import_node_path152.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
25077
25337
  parameters: subagentToolSchemas.listSubagents,
25078
25338
  execute: async () => {
25079
25339
  const subagents = await listSubagents();
@@ -25115,7 +25375,7 @@ var subagentTools = {
25115
25375
  };
25116
25376
 
25117
25377
  // src/mcp/tools.ts
25118
- var rulesyncFeatureSchema = import_mini83.z.enum([
25378
+ var rulesyncFeatureSchema = import_mini84.z.enum([
25119
25379
  "rule",
25120
25380
  "command",
25121
25381
  "subagent",
@@ -25125,21 +25385,21 @@ var rulesyncFeatureSchema = import_mini83.z.enum([
25125
25385
  "generate",
25126
25386
  "import"
25127
25387
  ]);
25128
- var rulesyncOperationSchema = import_mini83.z.enum(["list", "get", "put", "delete", "run"]);
25129
- var skillFileSchema = import_mini83.z.object({
25130
- name: import_mini83.z.string(),
25131
- body: import_mini83.z.string()
25388
+ var rulesyncOperationSchema = import_mini84.z.enum(["list", "get", "put", "delete", "run"]);
25389
+ var skillFileSchema = import_mini84.z.object({
25390
+ name: import_mini84.z.string(),
25391
+ body: import_mini84.z.string()
25132
25392
  });
25133
- var rulesyncToolSchema = import_mini83.z.object({
25393
+ var rulesyncToolSchema = import_mini84.z.object({
25134
25394
  feature: rulesyncFeatureSchema,
25135
25395
  operation: rulesyncOperationSchema,
25136
- targetPathFromCwd: import_mini83.z.optional(import_mini83.z.string()),
25137
- frontmatter: import_mini83.z.optional(import_mini83.z.unknown()),
25138
- body: import_mini83.z.optional(import_mini83.z.string()),
25139
- otherFiles: import_mini83.z.optional(import_mini83.z.array(skillFileSchema)),
25140
- content: import_mini83.z.optional(import_mini83.z.string()),
25141
- generateOptions: import_mini83.z.optional(generateOptionsSchema),
25142
- importOptions: import_mini83.z.optional(importOptionsSchema)
25396
+ targetPathFromCwd: import_mini84.z.optional(import_mini84.z.string()),
25397
+ frontmatter: import_mini84.z.optional(import_mini84.z.unknown()),
25398
+ body: import_mini84.z.optional(import_mini84.z.string()),
25399
+ otherFiles: import_mini84.z.optional(import_mini84.z.array(skillFileSchema)),
25400
+ content: import_mini84.z.optional(import_mini84.z.string()),
25401
+ generateOptions: import_mini84.z.optional(generateOptionsSchema),
25402
+ importOptions: import_mini84.z.optional(importOptionsSchema)
25143
25403
  });
25144
25404
  var supportedOperationsByFeature = {
25145
25405
  rule: ["list", "get", "put", "delete"],
@@ -25346,7 +25606,7 @@ async function mcpCommand(logger5, { version }) {
25346
25606
  }
25347
25607
 
25348
25608
  // src/cli/commands/resolve-gitignore-targets.ts
25349
- var import_node_path152 = require("path");
25609
+ var import_node_path153 = require("path");
25350
25610
  var resolveGitignoreTargets = async ({
25351
25611
  cliTargets,
25352
25612
  cwd = process.cwd()
@@ -25354,8 +25614,8 @@ var resolveGitignoreTargets = async ({
25354
25614
  if (cliTargets !== void 0) {
25355
25615
  return cliTargets;
25356
25616
  }
25357
- const baseConfigPath = (0, import_node_path152.join)(cwd, RULESYNC_CONFIG_RELATIVE_FILE_PATH);
25358
- const localConfigPath = (0, import_node_path152.join)(cwd, RULESYNC_LOCAL_CONFIG_RELATIVE_FILE_PATH);
25617
+ const baseConfigPath = (0, import_node_path153.join)(cwd, RULESYNC_CONFIG_RELATIVE_FILE_PATH);
25618
+ const localConfigPath = (0, import_node_path153.join)(cwd, RULESYNC_LOCAL_CONFIG_RELATIVE_FILE_PATH);
25359
25619
  const [hasBase, hasLocal] = await Promise.all([
25360
25620
  fileExists(baseConfigPath),
25361
25621
  fileExists(localConfigPath)
@@ -25776,7 +26036,7 @@ function wrapCommand({
25776
26036
  }
25777
26037
 
25778
26038
  // src/cli/index.ts
25779
- var getVersion = () => "8.2.0";
26039
+ var getVersion = () => "8.3.0";
25780
26040
  function wrapCommand2(name, errorCode, handler) {
25781
26041
  return wrapCommand({ name, errorCode, handler, getVersion });
25782
26042
  }