rulesync 8.24.0 → 8.24.1

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.
@@ -6294,9 +6294,11 @@ function generateOpencodeStylePluginCode(config, supportedEvents, toolConfigKey,
6294
6294
  const escapedCommand = escapeForTemplateLiteral(handler.command);
6295
6295
  if (handler.matcher) {
6296
6296
  const safeMatcher = validateAndSanitizeMatcher(handler.matcher);
6297
- lines.push(` const __re = new RegExp("${safeMatcher}");`);
6298
- lines.push(` if (__re.test(input.tool)) {`);
6299
- lines.push(` await $\`${escapedCommand}\`;`);
6297
+ lines.push(" {");
6298
+ lines.push(` const __re = new RegExp("${safeMatcher}");`);
6299
+ lines.push(` if (__re.test(input.tool)) {`);
6300
+ lines.push(` await $\`${escapedCommand}\`;`);
6301
+ lines.push(" }");
6300
6302
  lines.push(" }");
6301
6303
  } else {
6302
6304
  lines.push(` await $\`${escapedCommand}\`;`);
@@ -8422,7 +8424,7 @@ var ToolMcp = class extends ToolFile {
8422
8424
  var AMP_MCP_SERVERS_KEY = "amp.mcpServers";
8423
8425
  function parseAmpSettingsJsonc(fileContent) {
8424
8426
  const errors = [];
8425
- const parsed = parseJsonc3(fileContent || "{}", errors);
8427
+ const parsed = parseJsonc3(fileContent || "{}", errors, { allowTrailingComma: true });
8426
8428
  if (errors.length > 0) {
8427
8429
  const details = errors.map((error) => `${printParseErrorCode(error.error)} at offset ${error.offset}`).join(", ");
8428
8430
  throw new Error(`Failed to parse Amp settings: ${details}`);
@@ -12969,6 +12971,18 @@ var CursorPermissions = class _CursorPermissions extends ToolPermissions {
12969
12971
  const managedTypes = new Set(
12970
12972
  Object.keys(config.permission).map((category) => toCursorType(category))
12971
12973
  );
12974
+ const existingEditorRaw = settings.editor;
12975
+ let existingEditor;
12976
+ if (existingEditorRaw === void 0) {
12977
+ existingEditor = {};
12978
+ } else if (existingEditorRaw !== null && typeof existingEditorRaw === "object" && !Array.isArray(existingEditorRaw)) {
12979
+ existingEditor = existingEditorRaw;
12980
+ } else {
12981
+ logger?.warn(
12982
+ `Cursor CLI config at ${filePath} has a non-object \`editor\` field; ignoring existing editor settings.`
12983
+ );
12984
+ existingEditor = {};
12985
+ }
12972
12986
  const existingPermissionsRaw = settings.permissions;
12973
12987
  let existingPermissions;
12974
12988
  if (existingPermissionsRaw === void 0) {
@@ -12996,11 +13010,7 @@ var CursorPermissions = class _CursorPermissions extends ToolPermissions {
12996
13010
  };
12997
13011
  const mergedAllow = uniq6([...preservedAllow, ...allow].toSorted());
12998
13012
  const mergedDeny = uniq6([...preservedDeny, ...deny].toSorted());
12999
- if (mergedAllow.length > 0) {
13000
- mergedPermissions.allow = mergedAllow;
13001
- } else {
13002
- delete mergedPermissions.allow;
13003
- }
13013
+ mergedPermissions.allow = mergedAllow;
13004
13014
  if (mergedDeny.length > 0) {
13005
13015
  mergedPermissions.deny = mergedDeny;
13006
13016
  } else {
@@ -13009,6 +13019,10 @@ var CursorPermissions = class _CursorPermissions extends ToolPermissions {
13009
13019
  const merged = {
13010
13020
  ...settings,
13011
13021
  version: settings.version ?? 1,
13022
+ editor: {
13023
+ ...existingEditor,
13024
+ vimMode: existingEditor.vimMode ?? false
13025
+ },
13012
13026
  permissions: mergedPermissions
13013
13027
  };
13014
13028
  const fileContent = JSON.stringify(merged, null, 2);
@@ -6327,9 +6327,11 @@ function generateOpencodeStylePluginCode(config, supportedEvents, toolConfigKey,
6327
6327
  const escapedCommand = escapeForTemplateLiteral(handler.command);
6328
6328
  if (handler.matcher) {
6329
6329
  const safeMatcher = validateAndSanitizeMatcher(handler.matcher);
6330
- lines.push(` const __re = new RegExp("${safeMatcher}");`);
6331
- lines.push(` if (__re.test(input.tool)) {`);
6332
- lines.push(` await $\`${escapedCommand}\`;`);
6330
+ lines.push(" {");
6331
+ lines.push(` const __re = new RegExp("${safeMatcher}");`);
6332
+ lines.push(` if (__re.test(input.tool)) {`);
6333
+ lines.push(` await $\`${escapedCommand}\`;`);
6334
+ lines.push(" }");
6333
6335
  lines.push(" }");
6334
6336
  } else {
6335
6337
  lines.push(` await $\`${escapedCommand}\`;`);
@@ -8455,7 +8457,7 @@ var ToolMcp = class extends ToolFile {
8455
8457
  var AMP_MCP_SERVERS_KEY = "amp.mcpServers";
8456
8458
  function parseAmpSettingsJsonc(fileContent) {
8457
8459
  const errors = [];
8458
- const parsed = (0, import_jsonc_parser3.parse)(fileContent || "{}", errors);
8460
+ const parsed = (0, import_jsonc_parser3.parse)(fileContent || "{}", errors, { allowTrailingComma: true });
8459
8461
  if (errors.length > 0) {
8460
8462
  const details = errors.map((error) => `${(0, import_jsonc_parser3.printParseErrorCode)(error.error)} at offset ${error.offset}`).join(", ");
8461
8463
  throw new Error(`Failed to parse Amp settings: ${details}`);
@@ -13002,6 +13004,18 @@ var CursorPermissions = class _CursorPermissions extends ToolPermissions {
13002
13004
  const managedTypes = new Set(
13003
13005
  Object.keys(config.permission).map((category) => toCursorType(category))
13004
13006
  );
13007
+ const existingEditorRaw = settings.editor;
13008
+ let existingEditor;
13009
+ if (existingEditorRaw === void 0) {
13010
+ existingEditor = {};
13011
+ } else if (existingEditorRaw !== null && typeof existingEditorRaw === "object" && !Array.isArray(existingEditorRaw)) {
13012
+ existingEditor = existingEditorRaw;
13013
+ } else {
13014
+ logger5?.warn(
13015
+ `Cursor CLI config at ${filePath} has a non-object \`editor\` field; ignoring existing editor settings.`
13016
+ );
13017
+ existingEditor = {};
13018
+ }
13005
13019
  const existingPermissionsRaw = settings.permissions;
13006
13020
  let existingPermissions;
13007
13021
  if (existingPermissionsRaw === void 0) {
@@ -13029,11 +13043,7 @@ var CursorPermissions = class _CursorPermissions extends ToolPermissions {
13029
13043
  };
13030
13044
  const mergedAllow = (0, import_es_toolkit7.uniq)([...preservedAllow, ...allow].toSorted());
13031
13045
  const mergedDeny = (0, import_es_toolkit7.uniq)([...preservedDeny, ...deny].toSorted());
13032
- if (mergedAllow.length > 0) {
13033
- mergedPermissions.allow = mergedAllow;
13034
- } else {
13035
- delete mergedPermissions.allow;
13036
- }
13046
+ mergedPermissions.allow = mergedAllow;
13037
13047
  if (mergedDeny.length > 0) {
13038
13048
  mergedPermissions.deny = mergedDeny;
13039
13049
  } else {
@@ -13042,6 +13052,10 @@ var CursorPermissions = class _CursorPermissions extends ToolPermissions {
13042
13052
  const merged = {
13043
13053
  ...settings,
13044
13054
  version: settings.version ?? 1,
13055
+ editor: {
13056
+ ...existingEditor,
13057
+ vimMode: existingEditor.vimMode ?? false
13058
+ },
13045
13059
  permissions: mergedPermissions
13046
13060
  };
13047
13061
  const fileContent = JSON.stringify(merged, null, 2);
@@ -34272,7 +34286,7 @@ function wrapCommand({
34272
34286
  }
34273
34287
 
34274
34288
  // src/cli/index.ts
34275
- var getVersion = () => "8.24.0";
34289
+ var getVersion = () => "8.24.1";
34276
34290
  function wrapCommand2(name, errorCode, handler) {
34277
34291
  return wrapCommand({ name, errorCode, handler, getVersion });
34278
34292
  }
package/dist/cli/index.js CHANGED
@@ -79,7 +79,7 @@ import {
79
79
  stringifyFrontmatter,
80
80
  toPosixPath,
81
81
  writeFileContent
82
- } from "../chunk-KWUW4DM2.js";
82
+ } from "../chunk-YM6XKTQO.js";
83
83
 
84
84
  // src/cli/index.ts
85
85
  import { Command } from "commander";
@@ -6532,7 +6532,7 @@ function wrapCommand({
6532
6532
  }
6533
6533
 
6534
6534
  // src/cli/index.ts
6535
- var getVersion = () => "8.24.0";
6535
+ var getVersion = () => "8.24.1";
6536
6536
  function wrapCommand2(name, errorCode, handler) {
6537
6537
  return wrapCommand({ name, errorCode, handler, getVersion });
6538
6538
  }
package/dist/index.cjs CHANGED
@@ -6200,9 +6200,11 @@ function generateOpencodeStylePluginCode(config, supportedEvents, toolConfigKey,
6200
6200
  const escapedCommand = escapeForTemplateLiteral(handler.command);
6201
6201
  if (handler.matcher) {
6202
6202
  const safeMatcher = validateAndSanitizeMatcher(handler.matcher);
6203
- lines.push(` const __re = new RegExp("${safeMatcher}");`);
6204
- lines.push(` if (__re.test(input.tool)) {`);
6205
- lines.push(` await $\`${escapedCommand}\`;`);
6203
+ lines.push(" {");
6204
+ lines.push(` const __re = new RegExp("${safeMatcher}");`);
6205
+ lines.push(` if (__re.test(input.tool)) {`);
6206
+ lines.push(` await $\`${escapedCommand}\`;`);
6207
+ lines.push(" }");
6206
6208
  lines.push(" }");
6207
6209
  } else {
6208
6210
  lines.push(` await $\`${escapedCommand}\`;`);
@@ -8328,7 +8330,7 @@ var ToolMcp = class extends ToolFile {
8328
8330
  var AMP_MCP_SERVERS_KEY = "amp.mcpServers";
8329
8331
  function parseAmpSettingsJsonc(fileContent) {
8330
8332
  const errors = [];
8331
- const parsed = (0, import_jsonc_parser3.parse)(fileContent || "{}", errors);
8333
+ const parsed = (0, import_jsonc_parser3.parse)(fileContent || "{}", errors, { allowTrailingComma: true });
8332
8334
  if (errors.length > 0) {
8333
8335
  const details = errors.map((error) => `${(0, import_jsonc_parser3.printParseErrorCode)(error.error)} at offset ${error.offset}`).join(", ");
8334
8336
  throw new Error(`Failed to parse Amp settings: ${details}`);
@@ -12875,6 +12877,18 @@ var CursorPermissions = class _CursorPermissions extends ToolPermissions {
12875
12877
  const managedTypes = new Set(
12876
12878
  Object.keys(config.permission).map((category) => toCursorType(category))
12877
12879
  );
12880
+ const existingEditorRaw = settings.editor;
12881
+ let existingEditor;
12882
+ if (existingEditorRaw === void 0) {
12883
+ existingEditor = {};
12884
+ } else if (existingEditorRaw !== null && typeof existingEditorRaw === "object" && !Array.isArray(existingEditorRaw)) {
12885
+ existingEditor = existingEditorRaw;
12886
+ } else {
12887
+ logger?.warn(
12888
+ `Cursor CLI config at ${filePath} has a non-object \`editor\` field; ignoring existing editor settings.`
12889
+ );
12890
+ existingEditor = {};
12891
+ }
12878
12892
  const existingPermissionsRaw = settings.permissions;
12879
12893
  let existingPermissions;
12880
12894
  if (existingPermissionsRaw === void 0) {
@@ -12902,11 +12916,7 @@ var CursorPermissions = class _CursorPermissions extends ToolPermissions {
12902
12916
  };
12903
12917
  const mergedAllow = (0, import_es_toolkit7.uniq)([...preservedAllow, ...allow].toSorted());
12904
12918
  const mergedDeny = (0, import_es_toolkit7.uniq)([...preservedDeny, ...deny].toSorted());
12905
- if (mergedAllow.length > 0) {
12906
- mergedPermissions.allow = mergedAllow;
12907
- } else {
12908
- delete mergedPermissions.allow;
12909
- }
12919
+ mergedPermissions.allow = mergedAllow;
12910
12920
  if (mergedDeny.length > 0) {
12911
12921
  mergedPermissions.deny = mergedDeny;
12912
12922
  } else {
@@ -12915,6 +12925,10 @@ var CursorPermissions = class _CursorPermissions extends ToolPermissions {
12915
12925
  const merged = {
12916
12926
  ...settings,
12917
12927
  version: settings.version ?? 1,
12928
+ editor: {
12929
+ ...existingEditor,
12930
+ vimMode: existingEditor.vimMode ?? false
12931
+ },
12918
12932
  permissions: mergedPermissions
12919
12933
  };
12920
12934
  const fileContent = JSON.stringify(merged, null, 2);
package/dist/index.js CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  convertFromTool,
8
8
  generate,
9
9
  importFromTool
10
- } from "./chunk-KWUW4DM2.js";
10
+ } from "./chunk-YM6XKTQO.js";
11
11
 
12
12
  // src/index.ts
13
13
  async function generate2(options = {}) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rulesync",
3
- "version": "8.24.0",
3
+ "version": "8.24.1",
4
4
  "description": "Unified AI rules management CLI tool that generates configuration files for various AI development tools",
5
5
  "keywords": [
6
6
  "ai",