rulesync 10.0.0 → 11.0.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.
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- const require_import = require("../import-Dcj5HiOE.cjs");
2
+ const require_import = require("../import-ESr9cSFw.cjs");
3
3
  let commander = require("commander");
4
4
  let zod_mini = require("zod/mini");
5
5
  let node_path = require("node:path");
@@ -1204,11 +1204,13 @@ const DERIVED_PATHS_NOT_GITIGNORED = /* @__PURE__ */ new Set([
1204
1204
  "**/.antigravity/settings.json",
1205
1205
  "**/.claude/settings.json",
1206
1206
  "**/.claude/settings.local.json",
1207
+ "**/.codex/config.toml",
1207
1208
  "**/.devin/config.json",
1208
1209
  "**/.factory/settings.json",
1209
- "**/.gemini/settings.json",
1210
+ "**/.grok/config.toml",
1211
+ "**/.vibe/config.toml",
1212
+ "**/reasonix.toml",
1210
1213
  "**/.zed/settings.json",
1211
- "**/.warp/settings.toml",
1212
1214
  "**/kilo.json",
1213
1215
  "**/kilo.jsonc",
1214
1216
  "**/opencode.json"
@@ -1224,7 +1226,6 @@ const supportsProject = (factory) => {
1224
1226
  };
1225
1227
  const getProjectPaths = (factory) => factory.class.getSettablePaths({ global: false });
1226
1228
  const pushEntry = (entries, target, feature, entry) => {
1227
- if (DERIVED_PATHS_NOT_GITIGNORED.has(entry)) return;
1228
1229
  entries.push({
1229
1230
  target,
1230
1231
  feature,
@@ -1293,7 +1294,8 @@ const DERIVED_FEATURES = [
1293
1294
  "permissions",
1294
1295
  "ignore"
1295
1296
  ];
1296
- const deriveAllGitignoreEntries = () => DERIVED_FEATURES.flatMap((feature) => deriveFeatureGitignoreEntries(feature));
1297
+ const deriveAllGitignoreEntriesUnfiltered = () => DERIVED_FEATURES.flatMap((feature) => deriveFeatureGitignoreEntries(feature));
1298
+ const deriveAllGitignoreEntries = () => deriveAllGitignoreEntriesUnfiltered().filter((tag) => !DERIVED_PATHS_NOT_GITIGNORED.has(tag.entry));
1297
1299
  //#endregion
1298
1300
  //#region src/cli/commands/gitignore-entries.ts
1299
1301
  const normalizeGitignoreEntryTargets = (target) => {
@@ -1572,6 +1574,35 @@ const removeExistingRulesyncEntries = (content) => {
1572
1574
  while (result.endsWith("\n\n")) result = result.slice(0, -1);
1573
1575
  return result;
1574
1576
  };
1577
+ const extractRulesyncManagedEntries = (content) => {
1578
+ const lines = content.split("\n");
1579
+ const managed = [];
1580
+ let index = 0;
1581
+ const collectBlockLines = (start, end) => {
1582
+ for (const blockLine of lines.slice(start, end)) {
1583
+ const trimmed = blockLine.trim();
1584
+ if (trimmed !== "") managed.push(trimmed);
1585
+ }
1586
+ };
1587
+ while (index < lines.length) {
1588
+ const line = lines[index] ?? "";
1589
+ if (isRulesyncHeader(line)) {
1590
+ const footerIndex = findRulesyncFooterIndex(lines, index + 1);
1591
+ if (footerIndex !== -1) {
1592
+ collectBlockLines(index + 1, footerIndex);
1593
+ index = footerIndex + 1;
1594
+ continue;
1595
+ }
1596
+ const legacyEnd = skipLegacyRulesyncBlock(lines, index);
1597
+ collectBlockLines(index + 1, legacyEnd);
1598
+ index = legacyEnd;
1599
+ continue;
1600
+ }
1601
+ if (isRulesyncEntry(line)) managed.push(line.trim());
1602
+ index++;
1603
+ }
1604
+ return managed;
1605
+ };
1575
1606
  const groupEntriesByDestination = ({ entries, resolveDestination }) => {
1576
1607
  const gitignore = /* @__PURE__ */ new Set();
1577
1608
  const gitattributes = /* @__PURE__ */ new Set();
@@ -1608,6 +1639,8 @@ const gitignoreCommand = async (logger, options) => {
1608
1639
  let content = "";
1609
1640
  if (await require_import.fileExists(filePath)) content = await require_import.readFileContent(filePath);
1610
1641
  const cleanedContent = removeExistingRulesyncEntries(content);
1642
+ const entrySet = new Set(entries);
1643
+ const entriesRemoved = [...new Set(extractRulesyncManagedEntries(content).filter((entry) => !entrySet.has(entry)))];
1611
1644
  const existingEntries = new Set(content.split("\n").map((line) => line.trim()).filter((line) => line !== "" && !isRulesyncHeader(line) && !isRulesyncFooter(line)));
1612
1645
  const alreadyExistedEntries = entries.filter((entry) => existingEntries.has(entry));
1613
1646
  const entriesToAdd = entries.filter((entry) => !existingEntries.has(entry));
@@ -1620,13 +1653,15 @@ const gitignoreCommand = async (logger, options) => {
1620
1653
  if (content === newContent) return {
1621
1654
  updated: false,
1622
1655
  alreadyExistedEntries,
1623
- entriesToAdd: []
1656
+ entriesToAdd: [],
1657
+ entriesRemoved: []
1624
1658
  };
1625
1659
  await require_import.writeFileContent(filePath, newContent);
1626
1660
  return {
1627
1661
  updated: true,
1628
1662
  alreadyExistedEntries,
1629
- entriesToAdd
1663
+ entriesToAdd,
1664
+ entriesRemoved
1630
1665
  };
1631
1666
  };
1632
1667
  const gitignoreResult = await updateRulesyncFile({
@@ -1652,6 +1687,12 @@ const gitignoreCommand = async (logger, options) => {
1652
1687
  logger.captureData("gitignorePath", gitignorePath);
1653
1688
  logger.captureData("gitattributesPath", gitattributesPath);
1654
1689
  logger.captureData("alreadyExisted", [...gitignoreResult.alreadyExistedEntries, ...gitattributesResult.alreadyExistedEntries]);
1690
+ logger.captureData("entriesRemoved", gitignoreResult.entriesRemoved);
1691
+ }
1692
+ if (gitignoreResult.entriesRemoved.length > 0) {
1693
+ logger.warn("The following entries were removed from the rulesync-managed block in .gitignore and are no longer gitignored by rulesync:");
1694
+ for (const entry of gitignoreResult.entriesRemoved) logger.warn(` ${entry}`);
1695
+ logger.warn("Review these paths before committing — user-managed settings files may contain secrets.");
1655
1696
  }
1656
1697
  if (gitignoreResult.updated) logger.success("Updated .gitignore with rulesync entries:");
1657
1698
  else logger.success(".gitignore is already up to date");
@@ -6515,7 +6556,7 @@ function wrapCommand$1({ name, errorCode, handler, getVersion, loggerFactory = c
6515
6556
  }
6516
6557
  //#endregion
6517
6558
  //#region src/cli/index.ts
6518
- const getVersion = () => "10.0.0";
6559
+ const getVersion = () => "11.0.0";
6519
6560
  function wrapCommand(name, errorCode, handler) {
6520
6561
  return wrapCommand$1({
6521
6562
  name,
package/dist/cli/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { $ as removeFile, A as CLAUDECODE_SKILLS_DIR_PATH, At as RULESYNC_SOURCES_LOCK_RELATIVE_FILE_PATH, B as ErrorCodes, C as RulesyncHooks, Ct as RULESYNC_PERMISSIONS_FILE_NAME, D as CLAUDECODE_LOCAL_RULE_FILE_NAME, Dt as RULESYNC_RELATIVE_DIR_PATH, E as CLAUDECODE_DIR, Et as RULESYNC_PERMISSIONS_SCHEMA_URL, F as ConfigResolver, G as fileExists, H as createTempDirectory, I as findControlCharacter, J as getHomeDirectory, K as findFilesByGlobs, L as ConsoleLogger, M as RulesyncCommandFrontmatterSchema, Mt as formatError, N as stringifyFrontmatter, Nt as ALL_FEATURES, O as CLAUDECODE_MEMORIES_DIR_NAME, Ot as RULESYNC_RULES_RELATIVE_DIR_PATH, P as loadYaml, Pt as ALL_FEATURES_WITH_WILDCARD, Q as removeDirectory, R as JsonLogger, S as HooksProcessor, St as RULESYNC_OVERVIEW_FILE_NAME, T as CODEXCLI_DIR, Tt as RULESYNC_PERMISSIONS_RELATIVE_FILE_PATH, U as directoryExists, V as checkPathTraversal, W as ensureDir, X as listDirectoryFiles, Y as isSymlink, Z as readFileContent, _ as RulesyncPermissions, _t as RULESYNC_LOCAL_CONFIG_RELATIVE_FILE_PATH, a as convertFromTool, at as ToolTargetSchema, b as IgnoreProcessor, bt as RULESYNC_MCP_RELATIVE_FILE_PATH, c as RulesyncRuleFrontmatterSchema, ct as RULESYNC_AIIGNORE_RELATIVE_FILE_PATH, d as RulesyncSubagentFrontmatterSchema, dt as RULESYNC_CONFIG_SCHEMA_URL, et as removeTempDirectory, f as SkillsProcessor, ft as RULESYNC_CURATED_SKILLS_RELATIVE_DIR_PATH, g as SKILL_FILE_NAME$1, gt as RULESYNC_IGNORE_RELATIVE_FILE_PATH, h as RulesyncSkillFrontmatterSchema, ht as RULESYNC_HOOKS_RELATIVE_FILE_PATH, i as getProcessorRegistryEntry, it as ALL_TOOL_TARGETS_WITH_WILDCARD, j as RulesyncCommand, jt as RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, k as CLAUDECODE_SETTINGS_LOCAL_FILE_NAME, kt as RULESYNC_SKILLS_RELATIVE_DIR_PATH, l as SubagentsProcessor, lt as RULESYNC_COMMANDS_RELATIVE_DIR_PATH, m as RulesyncSkill, mt as RULESYNC_HOOKS_JSONC_FILE_NAME, n as checkRulesyncDirExists, nt as writeFileContent, o as RulesProcessor, ot as MAX_FILE_SIZE, p as getLocalSkillDirNames, pt as RULESYNC_HOOKS_FILE_NAME, q as getFileSize, r as generate, rt as ALL_TOOL_TARGETS, s as RulesyncRule, st as RULESYNC_AIIGNORE_FILE_NAME, t as importFromTool, tt as toPosixPath, u as RulesyncSubagent, ut as RULESYNC_CONFIG_RELATIVE_FILE_PATH, v as McpProcessor, vt as RULESYNC_MCP_FILE_NAME, w as CommandsProcessor, wt as RULESYNC_PERMISSIONS_JSONC_FILE_NAME, x as RulesyncIgnore, xt as RULESYNC_MCP_SCHEMA_URL, y as RulesyncMcp, yt as RULESYNC_MCP_JSONC_FILE_NAME, z as CLIError } from "../import-B02AyWkQ.js";
2
+ import { $ as removeFile, A as CLAUDECODE_SKILLS_DIR_PATH, At as RULESYNC_SOURCES_LOCK_RELATIVE_FILE_PATH, B as ErrorCodes, C as RulesyncHooks, Ct as RULESYNC_PERMISSIONS_FILE_NAME, D as CLAUDECODE_LOCAL_RULE_FILE_NAME, Dt as RULESYNC_RELATIVE_DIR_PATH, E as CLAUDECODE_DIR, Et as RULESYNC_PERMISSIONS_SCHEMA_URL, F as ConfigResolver, G as fileExists, H as createTempDirectory, I as findControlCharacter, J as getHomeDirectory, K as findFilesByGlobs, L as ConsoleLogger, M as RulesyncCommandFrontmatterSchema, Mt as formatError, N as stringifyFrontmatter, Nt as ALL_FEATURES, O as CLAUDECODE_MEMORIES_DIR_NAME, Ot as RULESYNC_RULES_RELATIVE_DIR_PATH, P as loadYaml, Pt as ALL_FEATURES_WITH_WILDCARD, Q as removeDirectory, R as JsonLogger, S as HooksProcessor, St as RULESYNC_OVERVIEW_FILE_NAME, T as CODEXCLI_DIR, Tt as RULESYNC_PERMISSIONS_RELATIVE_FILE_PATH, U as directoryExists, V as checkPathTraversal, W as ensureDir, X as listDirectoryFiles, Y as isSymlink, Z as readFileContent, _ as RulesyncPermissions, _t as RULESYNC_LOCAL_CONFIG_RELATIVE_FILE_PATH, a as convertFromTool, at as ToolTargetSchema, b as IgnoreProcessor, bt as RULESYNC_MCP_RELATIVE_FILE_PATH, c as RulesyncRuleFrontmatterSchema, ct as RULESYNC_AIIGNORE_RELATIVE_FILE_PATH, d as RulesyncSubagentFrontmatterSchema, dt as RULESYNC_CONFIG_SCHEMA_URL, et as removeTempDirectory, f as SkillsProcessor, ft as RULESYNC_CURATED_SKILLS_RELATIVE_DIR_PATH, g as SKILL_FILE_NAME$1, gt as RULESYNC_IGNORE_RELATIVE_FILE_PATH, h as RulesyncSkillFrontmatterSchema, ht as RULESYNC_HOOKS_RELATIVE_FILE_PATH, i as getProcessorRegistryEntry, it as ALL_TOOL_TARGETS_WITH_WILDCARD, j as RulesyncCommand, jt as RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, k as CLAUDECODE_SETTINGS_LOCAL_FILE_NAME, kt as RULESYNC_SKILLS_RELATIVE_DIR_PATH, l as SubagentsProcessor, lt as RULESYNC_COMMANDS_RELATIVE_DIR_PATH, m as RulesyncSkill, mt as RULESYNC_HOOKS_JSONC_FILE_NAME, n as checkRulesyncDirExists, nt as writeFileContent, o as RulesProcessor, ot as MAX_FILE_SIZE, p as getLocalSkillDirNames, pt as RULESYNC_HOOKS_FILE_NAME, q as getFileSize, r as generate, rt as ALL_TOOL_TARGETS, s as RulesyncRule, st as RULESYNC_AIIGNORE_FILE_NAME, t as importFromTool, tt as toPosixPath, u as RulesyncSubagent, ut as RULESYNC_CONFIG_RELATIVE_FILE_PATH, v as McpProcessor, vt as RULESYNC_MCP_FILE_NAME, w as CommandsProcessor, wt as RULESYNC_PERMISSIONS_JSONC_FILE_NAME, x as RulesyncIgnore, xt as RULESYNC_MCP_SCHEMA_URL, y as RulesyncMcp, yt as RULESYNC_MCP_JSONC_FILE_NAME, z as CLIError } from "../import-AKytnIKl.js";
3
3
  import { Command } from "commander";
4
4
  import { nonnegative, optional, refine, z } from "zod/mini";
5
5
  import * as path$1 from "node:path";
@@ -1202,11 +1202,13 @@ const DERIVED_PATHS_NOT_GITIGNORED = /* @__PURE__ */ new Set([
1202
1202
  "**/.antigravity/settings.json",
1203
1203
  "**/.claude/settings.json",
1204
1204
  "**/.claude/settings.local.json",
1205
+ "**/.codex/config.toml",
1205
1206
  "**/.devin/config.json",
1206
1207
  "**/.factory/settings.json",
1207
- "**/.gemini/settings.json",
1208
+ "**/.grok/config.toml",
1209
+ "**/.vibe/config.toml",
1210
+ "**/reasonix.toml",
1208
1211
  "**/.zed/settings.json",
1209
- "**/.warp/settings.toml",
1210
1212
  "**/kilo.json",
1211
1213
  "**/kilo.jsonc",
1212
1214
  "**/opencode.json"
@@ -1222,7 +1224,6 @@ const supportsProject = (factory) => {
1222
1224
  };
1223
1225
  const getProjectPaths = (factory) => factory.class.getSettablePaths({ global: false });
1224
1226
  const pushEntry = (entries, target, feature, entry) => {
1225
- if (DERIVED_PATHS_NOT_GITIGNORED.has(entry)) return;
1226
1227
  entries.push({
1227
1228
  target,
1228
1229
  feature,
@@ -1291,7 +1292,8 @@ const DERIVED_FEATURES = [
1291
1292
  "permissions",
1292
1293
  "ignore"
1293
1294
  ];
1294
- const deriveAllGitignoreEntries = () => DERIVED_FEATURES.flatMap((feature) => deriveFeatureGitignoreEntries(feature));
1295
+ const deriveAllGitignoreEntriesUnfiltered = () => DERIVED_FEATURES.flatMap((feature) => deriveFeatureGitignoreEntries(feature));
1296
+ const deriveAllGitignoreEntries = () => deriveAllGitignoreEntriesUnfiltered().filter((tag) => !DERIVED_PATHS_NOT_GITIGNORED.has(tag.entry));
1295
1297
  //#endregion
1296
1298
  //#region src/cli/commands/gitignore-entries.ts
1297
1299
  const normalizeGitignoreEntryTargets = (target) => {
@@ -1570,6 +1572,35 @@ const removeExistingRulesyncEntries = (content) => {
1570
1572
  while (result.endsWith("\n\n")) result = result.slice(0, -1);
1571
1573
  return result;
1572
1574
  };
1575
+ const extractRulesyncManagedEntries = (content) => {
1576
+ const lines = content.split("\n");
1577
+ const managed = [];
1578
+ let index = 0;
1579
+ const collectBlockLines = (start, end) => {
1580
+ for (const blockLine of lines.slice(start, end)) {
1581
+ const trimmed = blockLine.trim();
1582
+ if (trimmed !== "") managed.push(trimmed);
1583
+ }
1584
+ };
1585
+ while (index < lines.length) {
1586
+ const line = lines[index] ?? "";
1587
+ if (isRulesyncHeader(line)) {
1588
+ const footerIndex = findRulesyncFooterIndex(lines, index + 1);
1589
+ if (footerIndex !== -1) {
1590
+ collectBlockLines(index + 1, footerIndex);
1591
+ index = footerIndex + 1;
1592
+ continue;
1593
+ }
1594
+ const legacyEnd = skipLegacyRulesyncBlock(lines, index);
1595
+ collectBlockLines(index + 1, legacyEnd);
1596
+ index = legacyEnd;
1597
+ continue;
1598
+ }
1599
+ if (isRulesyncEntry(line)) managed.push(line.trim());
1600
+ index++;
1601
+ }
1602
+ return managed;
1603
+ };
1573
1604
  const groupEntriesByDestination = ({ entries, resolveDestination }) => {
1574
1605
  const gitignore = /* @__PURE__ */ new Set();
1575
1606
  const gitattributes = /* @__PURE__ */ new Set();
@@ -1606,6 +1637,8 @@ const gitignoreCommand = async (logger, options) => {
1606
1637
  let content = "";
1607
1638
  if (await fileExists(filePath)) content = await readFileContent(filePath);
1608
1639
  const cleanedContent = removeExistingRulesyncEntries(content);
1640
+ const entrySet = new Set(entries);
1641
+ const entriesRemoved = [...new Set(extractRulesyncManagedEntries(content).filter((entry) => !entrySet.has(entry)))];
1609
1642
  const existingEntries = new Set(content.split("\n").map((line) => line.trim()).filter((line) => line !== "" && !isRulesyncHeader(line) && !isRulesyncFooter(line)));
1610
1643
  const alreadyExistedEntries = entries.filter((entry) => existingEntries.has(entry));
1611
1644
  const entriesToAdd = entries.filter((entry) => !existingEntries.has(entry));
@@ -1618,13 +1651,15 @@ const gitignoreCommand = async (logger, options) => {
1618
1651
  if (content === newContent) return {
1619
1652
  updated: false,
1620
1653
  alreadyExistedEntries,
1621
- entriesToAdd: []
1654
+ entriesToAdd: [],
1655
+ entriesRemoved: []
1622
1656
  };
1623
1657
  await writeFileContent(filePath, newContent);
1624
1658
  return {
1625
1659
  updated: true,
1626
1660
  alreadyExistedEntries,
1627
- entriesToAdd
1661
+ entriesToAdd,
1662
+ entriesRemoved
1628
1663
  };
1629
1664
  };
1630
1665
  const gitignoreResult = await updateRulesyncFile({
@@ -1650,6 +1685,12 @@ const gitignoreCommand = async (logger, options) => {
1650
1685
  logger.captureData("gitignorePath", gitignorePath);
1651
1686
  logger.captureData("gitattributesPath", gitattributesPath);
1652
1687
  logger.captureData("alreadyExisted", [...gitignoreResult.alreadyExistedEntries, ...gitattributesResult.alreadyExistedEntries]);
1688
+ logger.captureData("entriesRemoved", gitignoreResult.entriesRemoved);
1689
+ }
1690
+ if (gitignoreResult.entriesRemoved.length > 0) {
1691
+ logger.warn("The following entries were removed from the rulesync-managed block in .gitignore and are no longer gitignored by rulesync:");
1692
+ for (const entry of gitignoreResult.entriesRemoved) logger.warn(` ${entry}`);
1693
+ logger.warn("Review these paths before committing — user-managed settings files may contain secrets.");
1653
1694
  }
1654
1695
  if (gitignoreResult.updated) logger.success("Updated .gitignore with rulesync entries:");
1655
1696
  else logger.success(".gitignore is already up to date");
@@ -6513,7 +6554,7 @@ function wrapCommand$1({ name, errorCode, handler, getVersion, loggerFactory = c
6513
6554
  }
6514
6555
  //#endregion
6515
6556
  //#region src/cli/index.ts
6516
- const getVersion = () => "10.0.0";
6557
+ const getVersion = () => "11.0.0";
6517
6558
  function wrapCommand(name, errorCode, handler) {
6518
6559
  return wrapCommand$1({
6519
6560
  name,