rulesync 3.12.2 → 3.12.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -281,37 +281,6 @@ Example:
281
281
  }
282
282
  ```
283
283
 
284
- #### Modular MCP Support (Experimental)
285
-
286
- Rulesync supports [modular-mcp](https://github.com/d-kimuson/modular-mcp) for context compression. When enabled with `--modular-mcp`, it generates both `.mcp.json` and `modular-mcp.json` files for Claude Code.
287
-
288
- **Benefits:**
289
- - Reduces context usage by loading tool schemas on-demand
290
- - Better scalability when using many MCP servers
291
- - Improved performance with large tool collections
292
-
293
- **Requirements:**
294
- - Each MCP server must have a `description` field (required when `modularMcp` is enabled)
295
- - Currently only supported for Claude Code
296
-
297
- **Usage:**
298
-
299
- ```bash
300
- # Enable modular-mcp via CLI
301
- npx rulesync generate --targets claudecode --features mcp --modular-mcp
302
-
303
- # Or via configuration file
304
- {
305
- "modularMcp": true
306
- }
307
- ```
308
-
309
- **Generated files:**
310
- - `.mcp.json` - Contains modular-mcp proxy configuration
311
- - `modular-mcp.json` - Contains actual MCP server configurations
312
-
313
- For more information, see the [modular-mcp documentation](https://github.com/d-kimuson/modular-mcp).
314
-
315
284
  ### `.rulesyncignore`
316
285
 
317
286
  Example:
@@ -385,6 +354,136 @@ Simulated commands and subagents allow you to generate simulated commands and su
385
354
  Call your-subagent to achieve something.
386
355
  ```
387
356
 
357
+ #### Modular MCP (Experimental)
358
+
359
+ Rulesync supports compressing tokens consumed by MCP servers [d-kimuson/modular-mcp](https://github.com/d-kimuson/modular-mcp) for context saving. When enabled with `--modular-mcp`, it additionally generates `modular-mcp.json`.
360
+
361
+ ```bash
362
+ # Enable modular-mcp via CLI
363
+ npx rulesync generate --targets claudecode --features mcp --modular-mcp
364
+
365
+ # Or via configuration file
366
+ {
367
+ "modularMcp": true
368
+ }
369
+ ```
370
+
371
+ When enabling modular-mcp, each MCP server must have a `description` field. Example:
372
+
373
+ ```diff
374
+ // .rulesync/mcp.json
375
+ {
376
+ "mcpServers": {
377
+ "context7": {
378
+ + "description": "Up-to-date documentation and code examples for libraries",
379
+ "type": "stdio",
380
+ "command": "npx",
381
+ "args": [
382
+ "-y",
383
+ "@upstash/context7-mcp"
384
+ ],
385
+ "env": {}
386
+ }
387
+ }
388
+ ```
389
+
390
+ To demonstrate the effect of modular-mcp, please see the following example:
391
+
392
+ <details>
393
+ <summary>Example of effect</summary>
394
+
395
+ Please see examples using Claude Code.
396
+
397
+ When using following mcp servers:
398
+
399
+ ```json
400
+ // .rulesync/mcp.json
401
+
402
+ {
403
+ "mcpServers": {
404
+ "serena": {
405
+ "description": "Semantic coding tools for intelligent codebase exploration and manipulation",
406
+ "type": "stdio",
407
+ "command": "uvx",
408
+ "args": [
409
+ "--from",
410
+ "git+https://github.com/oraios/serena",
411
+ "serena",
412
+ "start-mcp-server",
413
+ "--context",
414
+ "ide-assistant",
415
+ "--enable-web-dashboard",
416
+ "false",
417
+ "--project",
418
+ "."
419
+ ],
420
+ "env": {}
421
+ },
422
+ "context7": {
423
+ "description": "Up-to-date documentation and code examples for libraries",
424
+ "type": "stdio",
425
+ "command": "npx",
426
+ "args": [
427
+ "-y",
428
+ "@upstash/context7-mcp"
429
+ ],
430
+ "env": {}
431
+ },
432
+ "fetch": {
433
+ "description": "This server enables LLMs to retrieve and process content from web pages, converting HTML to markdown for easier consumption.",
434
+ "type": "stdio",
435
+ "command": "uvx",
436
+ "args": [
437
+ "mcp-server-fetch"
438
+ ],
439
+ "env": {}
440
+ }
441
+ }
442
+ }
443
+ ```
444
+
445
+ Once run `rulesync generate --targets claudecode --features mcp`, `/context` result on Claude Code is as follows:
446
+
447
+ ```
448
+ Context Usage
449
+ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ claude-sonnet-4-5-20250929 · 82k/200k tokens (41%)
450
+ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛀ ⛀
451
+ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛁ System prompt: 2.5k tokens (1.3%)
452
+ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛁ System tools: 13.9k tokens (6.9%)
453
+ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛁ MCP tools: 15.7k tokens (7.9%)
454
+ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛁ Memory files: 5.2k tokens (2.6%)
455
+ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛁ Messages: 8 tokens (0.0%)
456
+ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛝ ⛝ ⛝ ⛶ Free space: 118k (58.8%)
457
+ ⛝ ⛝ ⛝ ⛝ ⛝ ⛝ ⛝ ⛝ ⛝ ⛝ ⛝ Autocompact buffer: 45.0k tokens (22.5%)
458
+ ⛝ ⛝ ⛝ ⛝ ⛝ ⛝ ⛝ ⛝ ⛝ ⛝
459
+ ```
460
+
461
+ On the other hand, once run `rulesync generate --targets claudecode --features mcp --modular-mcp`, `/context` result on Claude Code is as follows:
462
+
463
+ ```
464
+ Context Usage
465
+ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛀ ⛁ claude-sonnet-4-5-20250929 · 68k/200k tokens (34%)
466
+ ⛁ ⛀ ⛀ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶
467
+ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛁ System prompt: 2.5k tokens (1.3%)
468
+ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛁ System tools: 13.5k tokens (6.8%)
469
+ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛁ MCP tools: 1.3k tokens (0.6%)
470
+ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛁ Memory files: 5.2k tokens (2.6%)
471
+ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛁ Messages: 8 tokens (0.0%)
472
+ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛝ ⛝ ⛝ ⛶ Free space: 132k (66.2%)
473
+ ⛝ ⛝ ⛝ ⛝ ⛝ ⛝ ⛝ ⛝ ⛝ ⛝ ⛝ Autocompact buffer: 45.0k tokens (22.5%)
474
+ ⛝ ⛝ ⛝ ⛝ ⛝ ⛝ ⛝ ⛝ ⛝ ⛝
475
+ ```
476
+
477
+ Focus on the difference of MCP tools usage.
478
+
479
+ | | Context Usage|
480
+ |---|---|
481
+ |Disabled Modular MCP| 15.7k tokens (7.9%) |
482
+ |Enabled Modular MCP| 1.3k tokens (0.6%) |
483
+
484
+ So, in this case, approximately 92% reduction in token usage!
485
+ </details>
486
+
388
487
  ## Contributing
389
488
 
390
489
  Issues and Pull Requests are welcome!
package/dist/index.cjs CHANGED
@@ -226,6 +226,26 @@ var FeatureProcessor = class {
226
226
  }
227
227
  };
228
228
 
229
+ // src/utils/error.ts
230
+ var import_zod = require("zod");
231
+ function isZodErrorLike(error) {
232
+ return error !== null && typeof error === "object" && "issues" in error && Array.isArray(error.issues) && error.issues.every(
233
+ (issue) => issue !== null && typeof issue === "object" && "path" in issue && Array.isArray(issue.path) && "message" in issue && typeof issue.message === "string"
234
+ );
235
+ }
236
+ function formatError(error) {
237
+ if (error instanceof import_zod.ZodError || isZodErrorLike(error)) {
238
+ return error.issues.map((issue) => {
239
+ const path2 = issue.path.length > 0 ? `${issue.path.join(".")}: ` : "";
240
+ return `${path2}${issue.message}`;
241
+ }).join("; ");
242
+ }
243
+ if (error instanceof Error) {
244
+ return `${error.name}: ${error.message}`;
245
+ }
246
+ return String(error);
247
+ }
248
+
229
249
  // src/commands/agentsmd-command.ts
230
250
  var import_node_path4 = require("path");
231
251
 
@@ -442,7 +462,7 @@ var SimulatedCommand = class _SimulatedCommand extends ToolCommand {
442
462
  const result = SimulatedCommandFrontmatterSchema.safeParse(frontmatter);
443
463
  if (!result.success) {
444
464
  throw new Error(
445
- `Invalid frontmatter in ${(0, import_node_path3.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${result.error.message}`
465
+ `Invalid frontmatter in ${(0, import_node_path3.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
446
466
  );
447
467
  }
448
468
  }
@@ -492,7 +512,7 @@ var SimulatedCommand = class _SimulatedCommand extends ToolCommand {
492
512
  return {
493
513
  success: false,
494
514
  error: new Error(
495
- `Invalid frontmatter in ${(0, import_node_path3.join)(this.relativeDirPath, this.relativeFilePath)}: ${result.error.message}`
515
+ `Invalid frontmatter in ${(0, import_node_path3.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
496
516
  )
497
517
  };
498
518
  }
@@ -511,7 +531,7 @@ var SimulatedCommand = class _SimulatedCommand extends ToolCommand {
511
531
  const { frontmatter, body: content } = parseFrontmatter(fileContent);
512
532
  const result = SimulatedCommandFrontmatterSchema.safeParse(frontmatter);
513
533
  if (!result.success) {
514
- throw new Error(`Invalid frontmatter in ${filePath}: ${result.error.message}`);
534
+ throw new Error(`Invalid frontmatter in ${filePath}: ${formatError(result.error)}`);
515
535
  }
516
536
  return {
517
537
  baseDir,
@@ -554,7 +574,7 @@ var AgentsmdCommand = class _AgentsmdCommand extends SimulatedCommand {
554
574
  const { frontmatter, body: content } = parseFrontmatter(fileContent);
555
575
  const result = SimulatedCommandFrontmatterSchema.safeParse(frontmatter);
556
576
  if (!result.success) {
557
- throw new Error(`Invalid frontmatter in ${filePath}: ${result.error.message}`);
577
+ throw new Error(`Invalid frontmatter in ${filePath}: ${formatError(result.error)}`);
558
578
  }
559
579
  return new _AgentsmdCommand({
560
580
  baseDir,
@@ -630,7 +650,7 @@ var RulesyncCommand = class _RulesyncCommand extends RulesyncFile {
630
650
  const result = RulesyncCommandFrontmatterSchema.safeParse(frontmatter);
631
651
  if (!result.success) {
632
652
  throw new Error(
633
- `Invalid frontmatter in ${(0, import_node_path5.join)(rest.baseDir ?? ".", rest.relativeDirPath, rest.relativeFilePath)}: ${result.error.message}`
653
+ `Invalid frontmatter in ${(0, import_node_path5.join)(rest.baseDir ?? ".", rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
634
654
  );
635
655
  }
636
656
  }
@@ -663,7 +683,7 @@ var RulesyncCommand = class _RulesyncCommand extends RulesyncFile {
663
683
  return {
664
684
  success: false,
665
685
  error: new Error(
666
- `Invalid frontmatter in ${(0, import_node_path5.join)(this.relativeDirPath, this.relativeFilePath)}: ${result.error.message}`
686
+ `Invalid frontmatter in ${(0, import_node_path5.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
667
687
  )
668
688
  };
669
689
  }
@@ -677,7 +697,7 @@ var RulesyncCommand = class _RulesyncCommand extends RulesyncFile {
677
697
  const { frontmatter, body: content } = parseFrontmatter(fileContent);
678
698
  const result = RulesyncCommandFrontmatterSchema.safeParse(frontmatter);
679
699
  if (!result.success) {
680
- throw new Error(`Invalid frontmatter in ${relativeFilePath}: ${result.error.message}`);
700
+ throw new Error(`Invalid frontmatter in ${relativeFilePath}: ${formatError(result.error)}`);
681
701
  }
682
702
  const filename = (0, import_node_path5.basename)(relativeFilePath);
683
703
  return new _RulesyncCommand({
@@ -703,7 +723,7 @@ var ClaudecodeCommand = class _ClaudecodeCommand extends ToolCommand {
703
723
  const result = ClaudecodeCommandFrontmatterSchema.safeParse(frontmatter);
704
724
  if (!result.success) {
705
725
  throw new Error(
706
- `Invalid frontmatter in ${(0, import_node_path6.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${result.error.message}`
726
+ `Invalid frontmatter in ${(0, import_node_path6.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
707
727
  );
708
728
  }
709
729
  }
@@ -774,7 +794,7 @@ var ClaudecodeCommand = class _ClaudecodeCommand extends ToolCommand {
774
794
  return {
775
795
  success: false,
776
796
  error: new Error(
777
- `Invalid frontmatter in ${(0, import_node_path6.join)(this.relativeDirPath, this.relativeFilePath)}: ${result.error.message}`
797
+ `Invalid frontmatter in ${(0, import_node_path6.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
778
798
  )
779
799
  };
780
800
  }
@@ -797,7 +817,7 @@ var ClaudecodeCommand = class _ClaudecodeCommand extends ToolCommand {
797
817
  const { frontmatter, body: content } = parseFrontmatter(fileContent);
798
818
  const result = ClaudecodeCommandFrontmatterSchema.safeParse(frontmatter);
799
819
  if (!result.success) {
800
- throw new Error(`Invalid frontmatter in ${filePath}: ${result.error.message}`);
820
+ throw new Error(`Invalid frontmatter in ${filePath}: ${formatError(result.error)}`);
801
821
  }
802
822
  return new _ClaudecodeCommand({
803
823
  baseDir,
@@ -899,7 +919,7 @@ var CopilotCommand = class _CopilotCommand extends ToolCommand {
899
919
  const result = CopilotCommandFrontmatterSchema.safeParse(frontmatter);
900
920
  if (!result.success) {
901
921
  throw new Error(
902
- `Invalid frontmatter in ${(0, import_node_path8.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${result.error.message}`
922
+ `Invalid frontmatter in ${(0, import_node_path8.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
903
923
  );
904
924
  }
905
925
  }
@@ -949,7 +969,7 @@ var CopilotCommand = class _CopilotCommand extends ToolCommand {
949
969
  return {
950
970
  success: false,
951
971
  error: new Error(
952
- `Invalid frontmatter in ${(0, import_node_path8.join)(this.relativeDirPath, this.relativeFilePath)}: ${result.error.message}`
972
+ `Invalid frontmatter in ${(0, import_node_path8.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
953
973
  )
954
974
  };
955
975
  }
@@ -988,7 +1008,7 @@ var CopilotCommand = class _CopilotCommand extends ToolCommand {
988
1008
  const { frontmatter, body: content } = parseFrontmatter(fileContent);
989
1009
  const result = CopilotCommandFrontmatterSchema.safeParse(frontmatter);
990
1010
  if (!result.success) {
991
- throw new Error(`Invalid frontmatter in ${filePath}: ${result.error.message}`);
1011
+ throw new Error(`Invalid frontmatter in ${filePath}: ${formatError(result.error)}`);
992
1012
  }
993
1013
  return new _CopilotCommand({
994
1014
  baseDir,
@@ -1105,7 +1125,9 @@ var GeminiCliCommand = class _GeminiCliCommand extends ToolCommand {
1105
1125
  const parsed = (0, import_smol_toml.parse)(content);
1106
1126
  const result = GeminiCliCommandFrontmatterSchema.safeParse(parsed);
1107
1127
  if (!result.success) {
1108
- throw new Error(`Invalid frontmatter in Gemini CLI command file: ${result.error.message}`);
1128
+ throw new Error(
1129
+ `Invalid frontmatter in Gemini CLI command file: ${formatError(result.error)}`
1130
+ );
1109
1131
  }
1110
1132
  return {
1111
1133
  description: result.data.description || "",
@@ -1218,7 +1240,7 @@ var RooCommand = class _RooCommand extends ToolCommand {
1218
1240
  const result = RooCommandFrontmatterSchema.safeParse(frontmatter);
1219
1241
  if (!result.success) {
1220
1242
  throw new Error(
1221
- `Invalid frontmatter in ${(0, import_node_path11.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${result.error.message}`
1243
+ `Invalid frontmatter in ${(0, import_node_path11.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
1222
1244
  );
1223
1245
  }
1224
1246
  }
@@ -1284,7 +1306,7 @@ var RooCommand = class _RooCommand extends ToolCommand {
1284
1306
  return {
1285
1307
  success: false,
1286
1308
  error: new Error(
1287
- `Invalid frontmatter in ${(0, import_node_path11.join)(this.relativeDirPath, this.relativeFilePath)}: ${result.error.message}`
1309
+ `Invalid frontmatter in ${(0, import_node_path11.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
1288
1310
  )
1289
1311
  };
1290
1312
  }
@@ -1305,7 +1327,7 @@ var RooCommand = class _RooCommand extends ToolCommand {
1305
1327
  const { frontmatter, body: content } = parseFrontmatter(fileContent);
1306
1328
  const result = RooCommandFrontmatterSchema.safeParse(frontmatter);
1307
1329
  if (!result.success) {
1308
- throw new Error(`Invalid frontmatter in ${filePath}: ${result.error.message}`);
1330
+ throw new Error(`Invalid frontmatter in ${filePath}: ${formatError(result.error)}`);
1309
1331
  }
1310
1332
  return new _RooCommand({
1311
1333
  baseDir,
@@ -1351,7 +1373,7 @@ var CommandsProcessor = class extends FeatureProcessor {
1351
1373
  const result = CommandsProcessorToolTargetSchema.safeParse(toolTarget);
1352
1374
  if (!result.success) {
1353
1375
  throw new Error(
1354
- `Invalid tool target for CommandsProcessor: ${toolTarget}. ${result.error.message}`
1376
+ `Invalid tool target for CommandsProcessor: ${toolTarget}. ${formatError(result.error)}`
1355
1377
  );
1356
1378
  }
1357
1379
  this.toolTarget = result.data;
@@ -2520,7 +2542,7 @@ var IgnoreProcessor = class extends FeatureProcessor {
2520
2542
  const result = IgnoreProcessorToolTargetSchema.safeParse(toolTarget);
2521
2543
  if (!result.success) {
2522
2544
  throw new Error(
2523
- `Invalid tool target for IgnoreProcessor: ${toolTarget}. ${result.error.message}`
2545
+ `Invalid tool target for IgnoreProcessor: ${toolTarget}. ${formatError(result.error)}`
2524
2546
  );
2525
2547
  }
2526
2548
  this.toolTarget = result.data;
@@ -2757,7 +2779,7 @@ var RulesyncMcp = class _RulesyncMcp extends RulesyncFile {
2757
2779
  return {
2758
2780
  success: false,
2759
2781
  error: new Error(
2760
- `Invalid MCP server configuration for modular-mcp: ${result.error.message}`
2782
+ `Invalid MCP server configuration for modular-mcp: ${formatError(result.error)}`
2761
2783
  )
2762
2784
  };
2763
2785
  }
@@ -3537,7 +3559,7 @@ var McpProcessor = class extends FeatureProcessor {
3537
3559
  const result = McpProcessorToolTargetSchema.safeParse(toolTarget);
3538
3560
  if (!result.success) {
3539
3561
  throw new Error(
3540
- `Invalid tool target for McpProcessor: ${toolTarget}. ${result.error.message}`
3562
+ `Invalid tool target for McpProcessor: ${toolTarget}. ${formatError(result.error)}`
3541
3563
  );
3542
3564
  }
3543
3565
  this.toolTarget = result.data;
@@ -3803,7 +3825,7 @@ var SimulatedSubagent = class extends ToolSubagent {
3803
3825
  const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
3804
3826
  if (!result.success) {
3805
3827
  throw new Error(
3806
- `Invalid frontmatter in ${(0, import_node_path35.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${result.error.message}`
3828
+ `Invalid frontmatter in ${(0, import_node_path35.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
3807
3829
  );
3808
3830
  }
3809
3831
  }
@@ -3854,7 +3876,7 @@ var SimulatedSubagent = class extends ToolSubagent {
3854
3876
  return {
3855
3877
  success: false,
3856
3878
  error: new Error(
3857
- `Invalid frontmatter in ${(0, import_node_path35.join)(this.relativeDirPath, this.relativeFilePath)}: ${result.error.message}`
3879
+ `Invalid frontmatter in ${(0, import_node_path35.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
3858
3880
  )
3859
3881
  };
3860
3882
  }
@@ -3869,7 +3891,7 @@ var SimulatedSubagent = class extends ToolSubagent {
3869
3891
  const { frontmatter, body: content } = parseFrontmatter(fileContent);
3870
3892
  const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
3871
3893
  if (!result.success) {
3872
- throw new Error(`Invalid frontmatter in ${filePath}: ${result.error.message}`);
3894
+ throw new Error(`Invalid frontmatter in ${filePath}: ${formatError(result.error)}`);
3873
3895
  }
3874
3896
  return {
3875
3897
  baseDir,
@@ -4050,7 +4072,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
4050
4072
  const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
4051
4073
  if (!result.success) {
4052
4074
  throw new Error(
4053
- `Invalid frontmatter in ${(0, import_node_path36.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${result.error.message}`
4075
+ `Invalid frontmatter in ${(0, import_node_path36.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
4054
4076
  );
4055
4077
  }
4056
4078
  }
@@ -4082,7 +4104,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
4082
4104
  return {
4083
4105
  success: false,
4084
4106
  error: new Error(
4085
- `Invalid frontmatter in ${(0, import_node_path36.join)(this.relativeDirPath, this.relativeFilePath)}: ${result.error.message}`
4107
+ `Invalid frontmatter in ${(0, import_node_path36.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
4086
4108
  )
4087
4109
  };
4088
4110
  }
@@ -4094,7 +4116,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
4094
4116
  const { frontmatter, body: content } = parseFrontmatter(fileContent);
4095
4117
  const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
4096
4118
  if (!result.success) {
4097
- throw new Error(`Invalid frontmatter in ${relativeFilePath}: ${result.error.message}`);
4119
+ throw new Error(`Invalid frontmatter in ${relativeFilePath}: ${formatError(result.error)}`);
4098
4120
  }
4099
4121
  const filename = (0, import_node_path36.basename)(relativeFilePath);
4100
4122
  return new _RulesyncSubagent({
@@ -4122,7 +4144,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
4122
4144
  const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
4123
4145
  if (!result.success) {
4124
4146
  throw new Error(
4125
- `Invalid frontmatter in ${(0, import_node_path37.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${result.error.message}`
4147
+ `Invalid frontmatter in ${(0, import_node_path37.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
4126
4148
  );
4127
4149
  }
4128
4150
  }
@@ -4202,7 +4224,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
4202
4224
  return {
4203
4225
  success: false,
4204
4226
  error: new Error(
4205
- `Invalid frontmatter in ${(0, import_node_path37.join)(this.relativeDirPath, this.relativeFilePath)}: ${result.error.message}`
4227
+ `Invalid frontmatter in ${(0, import_node_path37.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
4206
4228
  )
4207
4229
  };
4208
4230
  }
@@ -4225,7 +4247,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
4225
4247
  const { frontmatter, body: content } = parseFrontmatter(fileContent);
4226
4248
  const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
4227
4249
  if (!result.success) {
4228
- throw new Error(`Invalid frontmatter in ${filePath}: ${result.error.message}`);
4250
+ throw new Error(`Invalid frontmatter in ${filePath}: ${formatError(result.error)}`);
4229
4251
  }
4230
4252
  return new _ClaudecodeSubagent({
4231
4253
  baseDir,
@@ -4271,7 +4293,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
4271
4293
  const result = SubagentsProcessorToolTargetSchema.safeParse(toolTarget);
4272
4294
  if (!result.success) {
4273
4295
  throw new Error(
4274
- `Invalid tool target for SubagentsProcessor: ${toolTarget}. ${result.error.message}`
4296
+ `Invalid tool target for SubagentsProcessor: ${toolTarget}. ${formatError(result.error)}`
4275
4297
  );
4276
4298
  }
4277
4299
  this.toolTarget = result.data;
@@ -4571,7 +4593,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
4571
4593
  const result = RulesyncRuleFrontmatterSchema.safeParse(frontmatter);
4572
4594
  if (!result.success) {
4573
4595
  throw new Error(
4574
- `Invalid frontmatter in ${(0, import_node_path39.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${result.error.message}`
4596
+ `Invalid frontmatter in ${(0, import_node_path39.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
4575
4597
  );
4576
4598
  }
4577
4599
  }
@@ -4606,7 +4628,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
4606
4628
  return {
4607
4629
  success: false,
4608
4630
  error: new Error(
4609
- `Invalid frontmatter in ${(0, import_node_path39.join)(this.relativeDirPath, this.relativeFilePath)}: ${result.error.message}`
4631
+ `Invalid frontmatter in ${(0, import_node_path39.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
4610
4632
  )
4611
4633
  };
4612
4634
  }
@@ -4625,7 +4647,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
4625
4647
  const { frontmatter, body: content } = parseFrontmatter(fileContent);
4626
4648
  const result = RulesyncRuleFrontmatterSchema.safeParse(frontmatter);
4627
4649
  if (!result.success) {
4628
- throw new Error(`Invalid frontmatter in ${legacyPath}: ${result.error.message}`);
4650
+ throw new Error(`Invalid frontmatter in ${legacyPath}: ${formatError(result.error)}`);
4629
4651
  }
4630
4652
  const validatedFrontmatter = {
4631
4653
  root: result.data.root ?? false,
@@ -4654,7 +4676,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
4654
4676
  const { frontmatter, body: content } = parseFrontmatter(fileContent);
4655
4677
  const result = RulesyncRuleFrontmatterSchema.safeParse(frontmatter);
4656
4678
  if (!result.success) {
4657
- throw new Error(`Invalid frontmatter in ${filePath}: ${result.error.message}`);
4679
+ throw new Error(`Invalid frontmatter in ${filePath}: ${formatError(result.error)}`);
4658
4680
  }
4659
4681
  const validatedFrontmatter = {
4660
4682
  root: result.data.root ?? false,
@@ -5317,7 +5339,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
5317
5339
  const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
5318
5340
  if (!result.success) {
5319
5341
  throw new Error(
5320
- `Invalid frontmatter in ${(0, import_node_path48.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${result.error.message}`
5342
+ `Invalid frontmatter in ${(0, import_node_path48.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
5321
5343
  );
5322
5344
  }
5323
5345
  }
@@ -5412,7 +5434,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
5412
5434
  const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
5413
5435
  if (!result.success) {
5414
5436
  throw new Error(
5415
- `Invalid frontmatter in ${(0, import_node_path48.join)(baseDir, relativeFilePath)}: ${result.error.message}`
5437
+ `Invalid frontmatter in ${(0, import_node_path48.join)(baseDir, relativeFilePath)}: ${formatError(result.error)}`
5416
5438
  );
5417
5439
  }
5418
5440
  return new _CopilotRule({
@@ -5436,7 +5458,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
5436
5458
  return {
5437
5459
  success: false,
5438
5460
  error: new Error(
5439
- `Invalid frontmatter in ${(0, import_node_path48.join)(this.relativeDirPath, this.relativeFilePath)}: ${result.error.message}`
5461
+ `Invalid frontmatter in ${(0, import_node_path48.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
5440
5462
  )
5441
5463
  };
5442
5464
  }
@@ -5478,7 +5500,7 @@ var CursorRule = class _CursorRule extends ToolRule {
5478
5500
  const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
5479
5501
  if (!result.success) {
5480
5502
  throw new Error(
5481
- `Invalid frontmatter in ${(0, import_node_path49.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${result.error.message}`
5503
+ `Invalid frontmatter in ${(0, import_node_path49.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
5482
5504
  );
5483
5505
  }
5484
5506
  }
@@ -5601,7 +5623,7 @@ var CursorRule = class _CursorRule extends ToolRule {
5601
5623
  const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
5602
5624
  if (!result.success) {
5603
5625
  throw new Error(
5604
- `Invalid frontmatter in ${(0, import_node_path49.join)(baseDir, relativeFilePath)}: ${result.error.message}`
5626
+ `Invalid frontmatter in ${(0, import_node_path49.join)(baseDir, relativeFilePath)}: ${formatError(result.error)}`
5605
5627
  );
5606
5628
  }
5607
5629
  return new _CursorRule({
@@ -5624,7 +5646,7 @@ var CursorRule = class _CursorRule extends ToolRule {
5624
5646
  return {
5625
5647
  success: false,
5626
5648
  error: new Error(
5627
- `Invalid frontmatter in ${(0, import_node_path49.join)(this.relativeDirPath, this.relativeFilePath)}: ${result.error.message}`
5649
+ `Invalid frontmatter in ${(0, import_node_path49.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
5628
5650
  )
5629
5651
  };
5630
5652
  }
@@ -6199,7 +6221,7 @@ var RulesProcessor = class extends FeatureProcessor {
6199
6221
  const result = RulesProcessorToolTargetSchema.safeParse(toolTarget);
6200
6222
  if (!result.success) {
6201
6223
  throw new Error(
6202
- `Invalid tool target for RulesProcessor: ${toolTarget}. ${result.error.message}`
6224
+ `Invalid tool target for RulesProcessor: ${toolTarget}. ${formatError(result.error)}`
6203
6225
  );
6204
6226
  }
6205
6227
  this.toolTarget = result.data;
@@ -7667,7 +7689,7 @@ Attention, again, you are just the planner, so though you can read any files and
7667
7689
  }
7668
7690
 
7669
7691
  // src/cli/index.ts
7670
- var getVersion = () => "3.12.2";
7692
+ var getVersion = () => "3.12.4";
7671
7693
  var main = async () => {
7672
7694
  const program = new import_commander.Command();
7673
7695
  const version = getVersion();
package/dist/index.js CHANGED
@@ -203,6 +203,26 @@ var FeatureProcessor = class {
203
203
  }
204
204
  };
205
205
 
206
+ // src/utils/error.ts
207
+ import { ZodError } from "zod";
208
+ function isZodErrorLike(error) {
209
+ return error !== null && typeof error === "object" && "issues" in error && Array.isArray(error.issues) && error.issues.every(
210
+ (issue) => issue !== null && typeof issue === "object" && "path" in issue && Array.isArray(issue.path) && "message" in issue && typeof issue.message === "string"
211
+ );
212
+ }
213
+ function formatError(error) {
214
+ if (error instanceof ZodError || isZodErrorLike(error)) {
215
+ return error.issues.map((issue) => {
216
+ const path2 = issue.path.length > 0 ? `${issue.path.join(".")}: ` : "";
217
+ return `${path2}${issue.message}`;
218
+ }).join("; ");
219
+ }
220
+ if (error instanceof Error) {
221
+ return `${error.name}: ${error.message}`;
222
+ }
223
+ return String(error);
224
+ }
225
+
206
226
  // src/commands/agentsmd-command.ts
207
227
  import { basename as basename3, join as join3 } from "path";
208
228
 
@@ -419,7 +439,7 @@ var SimulatedCommand = class _SimulatedCommand extends ToolCommand {
419
439
  const result = SimulatedCommandFrontmatterSchema.safeParse(frontmatter);
420
440
  if (!result.success) {
421
441
  throw new Error(
422
- `Invalid frontmatter in ${join2(rest.relativeDirPath, rest.relativeFilePath)}: ${result.error.message}`
442
+ `Invalid frontmatter in ${join2(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
423
443
  );
424
444
  }
425
445
  }
@@ -469,7 +489,7 @@ var SimulatedCommand = class _SimulatedCommand extends ToolCommand {
469
489
  return {
470
490
  success: false,
471
491
  error: new Error(
472
- `Invalid frontmatter in ${join2(this.relativeDirPath, this.relativeFilePath)}: ${result.error.message}`
492
+ `Invalid frontmatter in ${join2(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
473
493
  )
474
494
  };
475
495
  }
@@ -488,7 +508,7 @@ var SimulatedCommand = class _SimulatedCommand extends ToolCommand {
488
508
  const { frontmatter, body: content } = parseFrontmatter(fileContent);
489
509
  const result = SimulatedCommandFrontmatterSchema.safeParse(frontmatter);
490
510
  if (!result.success) {
491
- throw new Error(`Invalid frontmatter in ${filePath}: ${result.error.message}`);
511
+ throw new Error(`Invalid frontmatter in ${filePath}: ${formatError(result.error)}`);
492
512
  }
493
513
  return {
494
514
  baseDir,
@@ -531,7 +551,7 @@ var AgentsmdCommand = class _AgentsmdCommand extends SimulatedCommand {
531
551
  const { frontmatter, body: content } = parseFrontmatter(fileContent);
532
552
  const result = SimulatedCommandFrontmatterSchema.safeParse(frontmatter);
533
553
  if (!result.success) {
534
- throw new Error(`Invalid frontmatter in ${filePath}: ${result.error.message}`);
554
+ throw new Error(`Invalid frontmatter in ${filePath}: ${formatError(result.error)}`);
535
555
  }
536
556
  return new _AgentsmdCommand({
537
557
  baseDir,
@@ -607,7 +627,7 @@ var RulesyncCommand = class _RulesyncCommand extends RulesyncFile {
607
627
  const result = RulesyncCommandFrontmatterSchema.safeParse(frontmatter);
608
628
  if (!result.success) {
609
629
  throw new Error(
610
- `Invalid frontmatter in ${join4(rest.baseDir ?? ".", rest.relativeDirPath, rest.relativeFilePath)}: ${result.error.message}`
630
+ `Invalid frontmatter in ${join4(rest.baseDir ?? ".", rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
611
631
  );
612
632
  }
613
633
  }
@@ -640,7 +660,7 @@ var RulesyncCommand = class _RulesyncCommand extends RulesyncFile {
640
660
  return {
641
661
  success: false,
642
662
  error: new Error(
643
- `Invalid frontmatter in ${join4(this.relativeDirPath, this.relativeFilePath)}: ${result.error.message}`
663
+ `Invalid frontmatter in ${join4(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
644
664
  )
645
665
  };
646
666
  }
@@ -654,7 +674,7 @@ var RulesyncCommand = class _RulesyncCommand extends RulesyncFile {
654
674
  const { frontmatter, body: content } = parseFrontmatter(fileContent);
655
675
  const result = RulesyncCommandFrontmatterSchema.safeParse(frontmatter);
656
676
  if (!result.success) {
657
- throw new Error(`Invalid frontmatter in ${relativeFilePath}: ${result.error.message}`);
677
+ throw new Error(`Invalid frontmatter in ${relativeFilePath}: ${formatError(result.error)}`);
658
678
  }
659
679
  const filename = basename4(relativeFilePath);
660
680
  return new _RulesyncCommand({
@@ -680,7 +700,7 @@ var ClaudecodeCommand = class _ClaudecodeCommand extends ToolCommand {
680
700
  const result = ClaudecodeCommandFrontmatterSchema.safeParse(frontmatter);
681
701
  if (!result.success) {
682
702
  throw new Error(
683
- `Invalid frontmatter in ${join5(rest.relativeDirPath, rest.relativeFilePath)}: ${result.error.message}`
703
+ `Invalid frontmatter in ${join5(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
684
704
  );
685
705
  }
686
706
  }
@@ -751,7 +771,7 @@ var ClaudecodeCommand = class _ClaudecodeCommand extends ToolCommand {
751
771
  return {
752
772
  success: false,
753
773
  error: new Error(
754
- `Invalid frontmatter in ${join5(this.relativeDirPath, this.relativeFilePath)}: ${result.error.message}`
774
+ `Invalid frontmatter in ${join5(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
755
775
  )
756
776
  };
757
777
  }
@@ -774,7 +794,7 @@ var ClaudecodeCommand = class _ClaudecodeCommand extends ToolCommand {
774
794
  const { frontmatter, body: content } = parseFrontmatter(fileContent);
775
795
  const result = ClaudecodeCommandFrontmatterSchema.safeParse(frontmatter);
776
796
  if (!result.success) {
777
- throw new Error(`Invalid frontmatter in ${filePath}: ${result.error.message}`);
797
+ throw new Error(`Invalid frontmatter in ${filePath}: ${formatError(result.error)}`);
778
798
  }
779
799
  return new _ClaudecodeCommand({
780
800
  baseDir,
@@ -876,7 +896,7 @@ var CopilotCommand = class _CopilotCommand extends ToolCommand {
876
896
  const result = CopilotCommandFrontmatterSchema.safeParse(frontmatter);
877
897
  if (!result.success) {
878
898
  throw new Error(
879
- `Invalid frontmatter in ${join7(rest.relativeDirPath, rest.relativeFilePath)}: ${result.error.message}`
899
+ `Invalid frontmatter in ${join7(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
880
900
  );
881
901
  }
882
902
  }
@@ -926,7 +946,7 @@ var CopilotCommand = class _CopilotCommand extends ToolCommand {
926
946
  return {
927
947
  success: false,
928
948
  error: new Error(
929
- `Invalid frontmatter in ${join7(this.relativeDirPath, this.relativeFilePath)}: ${result.error.message}`
949
+ `Invalid frontmatter in ${join7(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
930
950
  )
931
951
  };
932
952
  }
@@ -965,7 +985,7 @@ var CopilotCommand = class _CopilotCommand extends ToolCommand {
965
985
  const { frontmatter, body: content } = parseFrontmatter(fileContent);
966
986
  const result = CopilotCommandFrontmatterSchema.safeParse(frontmatter);
967
987
  if (!result.success) {
968
- throw new Error(`Invalid frontmatter in ${filePath}: ${result.error.message}`);
988
+ throw new Error(`Invalid frontmatter in ${filePath}: ${formatError(result.error)}`);
969
989
  }
970
990
  return new _CopilotCommand({
971
991
  baseDir,
@@ -1082,7 +1102,9 @@ var GeminiCliCommand = class _GeminiCliCommand extends ToolCommand {
1082
1102
  const parsed = parseToml(content);
1083
1103
  const result = GeminiCliCommandFrontmatterSchema.safeParse(parsed);
1084
1104
  if (!result.success) {
1085
- throw new Error(`Invalid frontmatter in Gemini CLI command file: ${result.error.message}`);
1105
+ throw new Error(
1106
+ `Invalid frontmatter in Gemini CLI command file: ${formatError(result.error)}`
1107
+ );
1086
1108
  }
1087
1109
  return {
1088
1110
  description: result.data.description || "",
@@ -1195,7 +1217,7 @@ var RooCommand = class _RooCommand extends ToolCommand {
1195
1217
  const result = RooCommandFrontmatterSchema.safeParse(frontmatter);
1196
1218
  if (!result.success) {
1197
1219
  throw new Error(
1198
- `Invalid frontmatter in ${join10(rest.relativeDirPath, rest.relativeFilePath)}: ${result.error.message}`
1220
+ `Invalid frontmatter in ${join10(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
1199
1221
  );
1200
1222
  }
1201
1223
  }
@@ -1261,7 +1283,7 @@ var RooCommand = class _RooCommand extends ToolCommand {
1261
1283
  return {
1262
1284
  success: false,
1263
1285
  error: new Error(
1264
- `Invalid frontmatter in ${join10(this.relativeDirPath, this.relativeFilePath)}: ${result.error.message}`
1286
+ `Invalid frontmatter in ${join10(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
1265
1287
  )
1266
1288
  };
1267
1289
  }
@@ -1282,7 +1304,7 @@ var RooCommand = class _RooCommand extends ToolCommand {
1282
1304
  const { frontmatter, body: content } = parseFrontmatter(fileContent);
1283
1305
  const result = RooCommandFrontmatterSchema.safeParse(frontmatter);
1284
1306
  if (!result.success) {
1285
- throw new Error(`Invalid frontmatter in ${filePath}: ${result.error.message}`);
1307
+ throw new Error(`Invalid frontmatter in ${filePath}: ${formatError(result.error)}`);
1286
1308
  }
1287
1309
  return new _RooCommand({
1288
1310
  baseDir,
@@ -1328,7 +1350,7 @@ var CommandsProcessor = class extends FeatureProcessor {
1328
1350
  const result = CommandsProcessorToolTargetSchema.safeParse(toolTarget);
1329
1351
  if (!result.success) {
1330
1352
  throw new Error(
1331
- `Invalid tool target for CommandsProcessor: ${toolTarget}. ${result.error.message}`
1353
+ `Invalid tool target for CommandsProcessor: ${toolTarget}. ${formatError(result.error)}`
1332
1354
  );
1333
1355
  }
1334
1356
  this.toolTarget = result.data;
@@ -2497,7 +2519,7 @@ var IgnoreProcessor = class extends FeatureProcessor {
2497
2519
  const result = IgnoreProcessorToolTargetSchema.safeParse(toolTarget);
2498
2520
  if (!result.success) {
2499
2521
  throw new Error(
2500
- `Invalid tool target for IgnoreProcessor: ${toolTarget}. ${result.error.message}`
2522
+ `Invalid tool target for IgnoreProcessor: ${toolTarget}. ${formatError(result.error)}`
2501
2523
  );
2502
2524
  }
2503
2525
  this.toolTarget = result.data;
@@ -2734,7 +2756,7 @@ var RulesyncMcp = class _RulesyncMcp extends RulesyncFile {
2734
2756
  return {
2735
2757
  success: false,
2736
2758
  error: new Error(
2737
- `Invalid MCP server configuration for modular-mcp: ${result.error.message}`
2759
+ `Invalid MCP server configuration for modular-mcp: ${formatError(result.error)}`
2738
2760
  )
2739
2761
  };
2740
2762
  }
@@ -3514,7 +3536,7 @@ var McpProcessor = class extends FeatureProcessor {
3514
3536
  const result = McpProcessorToolTargetSchema.safeParse(toolTarget);
3515
3537
  if (!result.success) {
3516
3538
  throw new Error(
3517
- `Invalid tool target for McpProcessor: ${toolTarget}. ${result.error.message}`
3539
+ `Invalid tool target for McpProcessor: ${toolTarget}. ${formatError(result.error)}`
3518
3540
  );
3519
3541
  }
3520
3542
  this.toolTarget = result.data;
@@ -3780,7 +3802,7 @@ var SimulatedSubagent = class extends ToolSubagent {
3780
3802
  const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
3781
3803
  if (!result.success) {
3782
3804
  throw new Error(
3783
- `Invalid frontmatter in ${join34(rest.relativeDirPath, rest.relativeFilePath)}: ${result.error.message}`
3805
+ `Invalid frontmatter in ${join34(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
3784
3806
  );
3785
3807
  }
3786
3808
  }
@@ -3831,7 +3853,7 @@ var SimulatedSubagent = class extends ToolSubagent {
3831
3853
  return {
3832
3854
  success: false,
3833
3855
  error: new Error(
3834
- `Invalid frontmatter in ${join34(this.relativeDirPath, this.relativeFilePath)}: ${result.error.message}`
3856
+ `Invalid frontmatter in ${join34(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
3835
3857
  )
3836
3858
  };
3837
3859
  }
@@ -3846,7 +3868,7 @@ var SimulatedSubagent = class extends ToolSubagent {
3846
3868
  const { frontmatter, body: content } = parseFrontmatter(fileContent);
3847
3869
  const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
3848
3870
  if (!result.success) {
3849
- throw new Error(`Invalid frontmatter in ${filePath}: ${result.error.message}`);
3871
+ throw new Error(`Invalid frontmatter in ${filePath}: ${formatError(result.error)}`);
3850
3872
  }
3851
3873
  return {
3852
3874
  baseDir,
@@ -4027,7 +4049,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
4027
4049
  const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
4028
4050
  if (!result.success) {
4029
4051
  throw new Error(
4030
- `Invalid frontmatter in ${join35(rest.relativeDirPath, rest.relativeFilePath)}: ${result.error.message}`
4052
+ `Invalid frontmatter in ${join35(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
4031
4053
  );
4032
4054
  }
4033
4055
  }
@@ -4059,7 +4081,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
4059
4081
  return {
4060
4082
  success: false,
4061
4083
  error: new Error(
4062
- `Invalid frontmatter in ${join35(this.relativeDirPath, this.relativeFilePath)}: ${result.error.message}`
4084
+ `Invalid frontmatter in ${join35(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
4063
4085
  )
4064
4086
  };
4065
4087
  }
@@ -4071,7 +4093,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
4071
4093
  const { frontmatter, body: content } = parseFrontmatter(fileContent);
4072
4094
  const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
4073
4095
  if (!result.success) {
4074
- throw new Error(`Invalid frontmatter in ${relativeFilePath}: ${result.error.message}`);
4096
+ throw new Error(`Invalid frontmatter in ${relativeFilePath}: ${formatError(result.error)}`);
4075
4097
  }
4076
4098
  const filename = basename13(relativeFilePath);
4077
4099
  return new _RulesyncSubagent({
@@ -4099,7 +4121,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
4099
4121
  const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
4100
4122
  if (!result.success) {
4101
4123
  throw new Error(
4102
- `Invalid frontmatter in ${join36(rest.relativeDirPath, rest.relativeFilePath)}: ${result.error.message}`
4124
+ `Invalid frontmatter in ${join36(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
4103
4125
  );
4104
4126
  }
4105
4127
  }
@@ -4179,7 +4201,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
4179
4201
  return {
4180
4202
  success: false,
4181
4203
  error: new Error(
4182
- `Invalid frontmatter in ${join36(this.relativeDirPath, this.relativeFilePath)}: ${result.error.message}`
4204
+ `Invalid frontmatter in ${join36(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
4183
4205
  )
4184
4206
  };
4185
4207
  }
@@ -4202,7 +4224,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
4202
4224
  const { frontmatter, body: content } = parseFrontmatter(fileContent);
4203
4225
  const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
4204
4226
  if (!result.success) {
4205
- throw new Error(`Invalid frontmatter in ${filePath}: ${result.error.message}`);
4227
+ throw new Error(`Invalid frontmatter in ${filePath}: ${formatError(result.error)}`);
4206
4228
  }
4207
4229
  return new _ClaudecodeSubagent({
4208
4230
  baseDir,
@@ -4248,7 +4270,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
4248
4270
  const result = SubagentsProcessorToolTargetSchema.safeParse(toolTarget);
4249
4271
  if (!result.success) {
4250
4272
  throw new Error(
4251
- `Invalid tool target for SubagentsProcessor: ${toolTarget}. ${result.error.message}`
4273
+ `Invalid tool target for SubagentsProcessor: ${toolTarget}. ${formatError(result.error)}`
4252
4274
  );
4253
4275
  }
4254
4276
  this.toolTarget = result.data;
@@ -4548,7 +4570,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
4548
4570
  const result = RulesyncRuleFrontmatterSchema.safeParse(frontmatter);
4549
4571
  if (!result.success) {
4550
4572
  throw new Error(
4551
- `Invalid frontmatter in ${join38(rest.relativeDirPath, rest.relativeFilePath)}: ${result.error.message}`
4573
+ `Invalid frontmatter in ${join38(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
4552
4574
  );
4553
4575
  }
4554
4576
  }
@@ -4583,7 +4605,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
4583
4605
  return {
4584
4606
  success: false,
4585
4607
  error: new Error(
4586
- `Invalid frontmatter in ${join38(this.relativeDirPath, this.relativeFilePath)}: ${result.error.message}`
4608
+ `Invalid frontmatter in ${join38(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
4587
4609
  )
4588
4610
  };
4589
4611
  }
@@ -4602,7 +4624,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
4602
4624
  const { frontmatter, body: content } = parseFrontmatter(fileContent);
4603
4625
  const result = RulesyncRuleFrontmatterSchema.safeParse(frontmatter);
4604
4626
  if (!result.success) {
4605
- throw new Error(`Invalid frontmatter in ${legacyPath}: ${result.error.message}`);
4627
+ throw new Error(`Invalid frontmatter in ${legacyPath}: ${formatError(result.error)}`);
4606
4628
  }
4607
4629
  const validatedFrontmatter = {
4608
4630
  root: result.data.root ?? false,
@@ -4631,7 +4653,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
4631
4653
  const { frontmatter, body: content } = parseFrontmatter(fileContent);
4632
4654
  const result = RulesyncRuleFrontmatterSchema.safeParse(frontmatter);
4633
4655
  if (!result.success) {
4634
- throw new Error(`Invalid frontmatter in ${filePath}: ${result.error.message}`);
4656
+ throw new Error(`Invalid frontmatter in ${filePath}: ${formatError(result.error)}`);
4635
4657
  }
4636
4658
  const validatedFrontmatter = {
4637
4659
  root: result.data.root ?? false,
@@ -5294,7 +5316,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
5294
5316
  const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
5295
5317
  if (!result.success) {
5296
5318
  throw new Error(
5297
- `Invalid frontmatter in ${join47(rest.relativeDirPath, rest.relativeFilePath)}: ${result.error.message}`
5319
+ `Invalid frontmatter in ${join47(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
5298
5320
  );
5299
5321
  }
5300
5322
  }
@@ -5389,7 +5411,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
5389
5411
  const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
5390
5412
  if (!result.success) {
5391
5413
  throw new Error(
5392
- `Invalid frontmatter in ${join47(baseDir, relativeFilePath)}: ${result.error.message}`
5414
+ `Invalid frontmatter in ${join47(baseDir, relativeFilePath)}: ${formatError(result.error)}`
5393
5415
  );
5394
5416
  }
5395
5417
  return new _CopilotRule({
@@ -5413,7 +5435,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
5413
5435
  return {
5414
5436
  success: false,
5415
5437
  error: new Error(
5416
- `Invalid frontmatter in ${join47(this.relativeDirPath, this.relativeFilePath)}: ${result.error.message}`
5438
+ `Invalid frontmatter in ${join47(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
5417
5439
  )
5418
5440
  };
5419
5441
  }
@@ -5455,7 +5477,7 @@ var CursorRule = class _CursorRule extends ToolRule {
5455
5477
  const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
5456
5478
  if (!result.success) {
5457
5479
  throw new Error(
5458
- `Invalid frontmatter in ${join48(rest.relativeDirPath, rest.relativeFilePath)}: ${result.error.message}`
5480
+ `Invalid frontmatter in ${join48(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
5459
5481
  );
5460
5482
  }
5461
5483
  }
@@ -5578,7 +5600,7 @@ var CursorRule = class _CursorRule extends ToolRule {
5578
5600
  const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
5579
5601
  if (!result.success) {
5580
5602
  throw new Error(
5581
- `Invalid frontmatter in ${join48(baseDir, relativeFilePath)}: ${result.error.message}`
5603
+ `Invalid frontmatter in ${join48(baseDir, relativeFilePath)}: ${formatError(result.error)}`
5582
5604
  );
5583
5605
  }
5584
5606
  return new _CursorRule({
@@ -5601,7 +5623,7 @@ var CursorRule = class _CursorRule extends ToolRule {
5601
5623
  return {
5602
5624
  success: false,
5603
5625
  error: new Error(
5604
- `Invalid frontmatter in ${join48(this.relativeDirPath, this.relativeFilePath)}: ${result.error.message}`
5626
+ `Invalid frontmatter in ${join48(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
5605
5627
  )
5606
5628
  };
5607
5629
  }
@@ -6176,7 +6198,7 @@ var RulesProcessor = class extends FeatureProcessor {
6176
6198
  const result = RulesProcessorToolTargetSchema.safeParse(toolTarget);
6177
6199
  if (!result.success) {
6178
6200
  throw new Error(
6179
- `Invalid tool target for RulesProcessor: ${toolTarget}. ${result.error.message}`
6201
+ `Invalid tool target for RulesProcessor: ${toolTarget}. ${formatError(result.error)}`
6180
6202
  );
6181
6203
  }
6182
6204
  this.toolTarget = result.data;
@@ -7644,7 +7666,7 @@ Attention, again, you are just the planner, so though you can read any files and
7644
7666
  }
7645
7667
 
7646
7668
  // src/cli/index.ts
7647
- var getVersion = () => "3.12.2";
7669
+ var getVersion = () => "3.12.4";
7648
7670
  var main = async () => {
7649
7671
  const program = new Command();
7650
7672
  const version = getVersion();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rulesync",
3
- "version": "3.12.2",
3
+ "version": "3.12.4",
4
4
  "description": "Unified AI rules management CLI tool that generates configuration files for various AI development tools",
5
5
  "keywords": [
6
6
  "ai",