rulesync 3.0.0 → 3.1.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.
- package/README.md +1 -1
- package/dist/index.cjs +495 -367
- package/dist/index.js +493 -365
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -72,7 +72,7 @@ var logger = new Logger();
|
|
|
72
72
|
import { intersection } from "es-toolkit";
|
|
73
73
|
|
|
74
74
|
// src/commands/commands-processor.ts
|
|
75
|
-
import { basename as
|
|
75
|
+
import { basename as basename11, join as join11 } from "path";
|
|
76
76
|
import { z as z8 } from "zod/mini";
|
|
77
77
|
|
|
78
78
|
// src/utils/file.ts
|
|
@@ -187,9 +187,8 @@ var FeatureProcessor = class {
|
|
|
187
187
|
}
|
|
188
188
|
};
|
|
189
189
|
|
|
190
|
-
// src/commands/
|
|
190
|
+
// src/commands/agentsmd-command.ts
|
|
191
191
|
import { basename as basename3, join as join3 } from "path";
|
|
192
|
-
import { z as z4 } from "zod/mini";
|
|
193
192
|
|
|
194
193
|
// src/utils/frontmatter.ts
|
|
195
194
|
import matter from "gray-matter";
|
|
@@ -240,9 +239,9 @@ function parseFrontmatter(content) {
|
|
|
240
239
|
return { frontmatter, body };
|
|
241
240
|
}
|
|
242
241
|
|
|
243
|
-
// src/commands/
|
|
242
|
+
// src/commands/simulated-command.ts
|
|
244
243
|
import { basename as basename2, join as join2 } from "path";
|
|
245
|
-
import { z as
|
|
244
|
+
import { z as z2 } from "zod/mini";
|
|
246
245
|
|
|
247
246
|
// src/types/ai-file.ts
|
|
248
247
|
import path, { relative as relative2, resolve as resolve2 } from "path";
|
|
@@ -322,6 +321,220 @@ var AiFile = class {
|
|
|
322
321
|
}
|
|
323
322
|
};
|
|
324
323
|
|
|
324
|
+
// src/commands/tool-command.ts
|
|
325
|
+
var ToolCommand = class extends AiFile {
|
|
326
|
+
static getSettablePaths() {
|
|
327
|
+
throw new Error("Please implement this method in the subclass.");
|
|
328
|
+
}
|
|
329
|
+
/**
|
|
330
|
+
* Load a command from a tool-specific file path.
|
|
331
|
+
*
|
|
332
|
+
* This method should:
|
|
333
|
+
* 1. Read the file content
|
|
334
|
+
* 2. Parse tool-specific frontmatter format
|
|
335
|
+
* 3. Validate the parsed data
|
|
336
|
+
* 4. Return a concrete ToolCommand instance
|
|
337
|
+
*
|
|
338
|
+
* @param params - Parameters including the file path to load
|
|
339
|
+
* @returns Promise resolving to a concrete ToolCommand instance
|
|
340
|
+
*/
|
|
341
|
+
static async fromFile(_params) {
|
|
342
|
+
throw new Error("Please implement this method in the subclass.");
|
|
343
|
+
}
|
|
344
|
+
/**
|
|
345
|
+
* Convert a RulesyncCommand to the tool-specific command format.
|
|
346
|
+
*
|
|
347
|
+
* This method should:
|
|
348
|
+
* 1. Extract relevant data from the RulesyncCommand
|
|
349
|
+
* 2. Transform frontmatter to tool-specific format
|
|
350
|
+
* 3. Transform body content if needed
|
|
351
|
+
* 4. Return a concrete ToolCommand instance
|
|
352
|
+
*
|
|
353
|
+
* @param params - Parameters including the RulesyncCommand to convert
|
|
354
|
+
* @returns A concrete ToolCommand instance
|
|
355
|
+
*/
|
|
356
|
+
static fromRulesyncCommand(_params) {
|
|
357
|
+
throw new Error("Please implement this method in the subclass.");
|
|
358
|
+
}
|
|
359
|
+
/**
|
|
360
|
+
* Check if this tool is targeted by a RulesyncCommand based on its targets field.
|
|
361
|
+
* Subclasses should override this to provide specific targeting logic.
|
|
362
|
+
*
|
|
363
|
+
* @param rulesyncCommand - The RulesyncCommand to check
|
|
364
|
+
* @returns True if this tool is targeted by the command
|
|
365
|
+
*/
|
|
366
|
+
static isTargetedByRulesyncCommand(_rulesyncCommand) {
|
|
367
|
+
throw new Error("Please implement this method in the subclass.");
|
|
368
|
+
}
|
|
369
|
+
/**
|
|
370
|
+
* Default implementation for checking if a tool is targeted by a RulesyncCommand.
|
|
371
|
+
* Checks if the command's targets include the tool target or a wildcard.
|
|
372
|
+
*
|
|
373
|
+
* @param params - Parameters including the RulesyncCommand and tool target
|
|
374
|
+
* @returns True if the tool target is included in the command's targets
|
|
375
|
+
*/
|
|
376
|
+
static isTargetedByRulesyncCommandDefault({
|
|
377
|
+
rulesyncCommand,
|
|
378
|
+
toolTarget
|
|
379
|
+
}) {
|
|
380
|
+
const targets = rulesyncCommand.getFrontmatter().targets;
|
|
381
|
+
if (!targets) {
|
|
382
|
+
return true;
|
|
383
|
+
}
|
|
384
|
+
if (targets.includes("*")) {
|
|
385
|
+
return true;
|
|
386
|
+
}
|
|
387
|
+
if (targets.includes(toolTarget)) {
|
|
388
|
+
return true;
|
|
389
|
+
}
|
|
390
|
+
return false;
|
|
391
|
+
}
|
|
392
|
+
};
|
|
393
|
+
|
|
394
|
+
// src/commands/simulated-command.ts
|
|
395
|
+
var SimulatedCommandFrontmatterSchema = z2.object({
|
|
396
|
+
description: z2.string()
|
|
397
|
+
});
|
|
398
|
+
var SimulatedCommand = class _SimulatedCommand extends ToolCommand {
|
|
399
|
+
frontmatter;
|
|
400
|
+
body;
|
|
401
|
+
constructor({ frontmatter, body, ...rest }) {
|
|
402
|
+
if (rest.validate) {
|
|
403
|
+
const result = SimulatedCommandFrontmatterSchema.safeParse(frontmatter);
|
|
404
|
+
if (!result.success) {
|
|
405
|
+
throw result.error;
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
super({
|
|
409
|
+
...rest,
|
|
410
|
+
fileContent: stringifyFrontmatter(body, frontmatter)
|
|
411
|
+
});
|
|
412
|
+
this.frontmatter = frontmatter;
|
|
413
|
+
this.body = body;
|
|
414
|
+
}
|
|
415
|
+
getBody() {
|
|
416
|
+
return this.body;
|
|
417
|
+
}
|
|
418
|
+
getFrontmatter() {
|
|
419
|
+
return this.frontmatter;
|
|
420
|
+
}
|
|
421
|
+
toRulesyncCommand() {
|
|
422
|
+
throw new Error("Not implemented because it is a SIMULATED file.");
|
|
423
|
+
}
|
|
424
|
+
static fromRulesyncCommandDefault({
|
|
425
|
+
baseDir = ".",
|
|
426
|
+
rulesyncCommand,
|
|
427
|
+
validate = true
|
|
428
|
+
}) {
|
|
429
|
+
const rulesyncFrontmatter = rulesyncCommand.getFrontmatter();
|
|
430
|
+
const claudecodeFrontmatter = {
|
|
431
|
+
description: rulesyncFrontmatter.description
|
|
432
|
+
};
|
|
433
|
+
const body = rulesyncCommand.getBody();
|
|
434
|
+
return {
|
|
435
|
+
baseDir,
|
|
436
|
+
frontmatter: claudecodeFrontmatter,
|
|
437
|
+
body,
|
|
438
|
+
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
439
|
+
relativeFilePath: rulesyncCommand.getRelativeFilePath(),
|
|
440
|
+
validate
|
|
441
|
+
};
|
|
442
|
+
}
|
|
443
|
+
validate() {
|
|
444
|
+
if (!this.frontmatter) {
|
|
445
|
+
return { success: true, error: null };
|
|
446
|
+
}
|
|
447
|
+
const result = SimulatedCommandFrontmatterSchema.safeParse(this.frontmatter);
|
|
448
|
+
if (result.success) {
|
|
449
|
+
return { success: true, error: null };
|
|
450
|
+
} else {
|
|
451
|
+
return { success: false, error: result.error };
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
static async fromFileDefault({
|
|
455
|
+
baseDir = ".",
|
|
456
|
+
relativeFilePath,
|
|
457
|
+
validate = true
|
|
458
|
+
}) {
|
|
459
|
+
const filePath = join2(
|
|
460
|
+
baseDir,
|
|
461
|
+
_SimulatedCommand.getSettablePaths().relativeDirPath,
|
|
462
|
+
relativeFilePath
|
|
463
|
+
);
|
|
464
|
+
const fileContent = await readFileContent(filePath);
|
|
465
|
+
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
466
|
+
const result = SimulatedCommandFrontmatterSchema.safeParse(frontmatter);
|
|
467
|
+
if (!result.success) {
|
|
468
|
+
throw new Error(`Invalid frontmatter in ${filePath}: ${result.error.message}`);
|
|
469
|
+
}
|
|
470
|
+
return {
|
|
471
|
+
baseDir,
|
|
472
|
+
relativeDirPath: _SimulatedCommand.getSettablePaths().relativeDirPath,
|
|
473
|
+
relativeFilePath: basename2(relativeFilePath),
|
|
474
|
+
frontmatter: result.data,
|
|
475
|
+
body: content.trim(),
|
|
476
|
+
validate
|
|
477
|
+
};
|
|
478
|
+
}
|
|
479
|
+
};
|
|
480
|
+
|
|
481
|
+
// src/commands/agentsmd-command.ts
|
|
482
|
+
var AgentsmdCommand = class _AgentsmdCommand extends SimulatedCommand {
|
|
483
|
+
static getSettablePaths() {
|
|
484
|
+
return {
|
|
485
|
+
relativeDirPath: ".agents/commands"
|
|
486
|
+
};
|
|
487
|
+
}
|
|
488
|
+
static fromRulesyncCommand({
|
|
489
|
+
baseDir = ".",
|
|
490
|
+
rulesyncCommand,
|
|
491
|
+
validate = true
|
|
492
|
+
}) {
|
|
493
|
+
return new _AgentsmdCommand(
|
|
494
|
+
this.fromRulesyncCommandDefault({ baseDir, rulesyncCommand, validate })
|
|
495
|
+
);
|
|
496
|
+
}
|
|
497
|
+
static async fromFile({
|
|
498
|
+
baseDir = ".",
|
|
499
|
+
relativeFilePath,
|
|
500
|
+
validate = true
|
|
501
|
+
}) {
|
|
502
|
+
const filePath = join3(
|
|
503
|
+
baseDir,
|
|
504
|
+
_AgentsmdCommand.getSettablePaths().relativeDirPath,
|
|
505
|
+
relativeFilePath
|
|
506
|
+
);
|
|
507
|
+
const fileContent = await readFileContent(filePath);
|
|
508
|
+
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
509
|
+
const result = SimulatedCommandFrontmatterSchema.safeParse(frontmatter);
|
|
510
|
+
if (!result.success) {
|
|
511
|
+
throw new Error(`Invalid frontmatter in ${filePath}: ${result.error.message}`);
|
|
512
|
+
}
|
|
513
|
+
return new _AgentsmdCommand({
|
|
514
|
+
baseDir,
|
|
515
|
+
relativeDirPath: _AgentsmdCommand.getSettablePaths().relativeDirPath,
|
|
516
|
+
relativeFilePath: basename3(relativeFilePath),
|
|
517
|
+
frontmatter: result.data,
|
|
518
|
+
body: content.trim(),
|
|
519
|
+
validate
|
|
520
|
+
});
|
|
521
|
+
}
|
|
522
|
+
static isTargetedByRulesyncCommand(rulesyncCommand) {
|
|
523
|
+
return this.isTargetedByRulesyncCommandDefault({
|
|
524
|
+
rulesyncCommand,
|
|
525
|
+
toolTarget: "agentsmd"
|
|
526
|
+
});
|
|
527
|
+
}
|
|
528
|
+
};
|
|
529
|
+
|
|
530
|
+
// src/commands/claudecode-command.ts
|
|
531
|
+
import { basename as basename5, join as join5 } from "path";
|
|
532
|
+
import { z as z5 } from "zod/mini";
|
|
533
|
+
|
|
534
|
+
// src/commands/rulesync-command.ts
|
|
535
|
+
import { basename as basename4, join as join4 } from "path";
|
|
536
|
+
import { z as z4 } from "zod/mini";
|
|
537
|
+
|
|
325
538
|
// src/types/rulesync-file.ts
|
|
326
539
|
var RulesyncFile = class extends AiFile {
|
|
327
540
|
static async fromFile(_params) {
|
|
@@ -333,7 +546,7 @@ var RulesyncFile = class extends AiFile {
|
|
|
333
546
|
};
|
|
334
547
|
|
|
335
548
|
// src/types/tool-targets.ts
|
|
336
|
-
import { z as
|
|
549
|
+
import { z as z3 } from "zod/mini";
|
|
337
550
|
var ALL_TOOL_TARGETS = [
|
|
338
551
|
"agentsmd",
|
|
339
552
|
"amazonqcli",
|
|
@@ -354,14 +567,14 @@ var ALL_TOOL_TARGETS = [
|
|
|
354
567
|
"windsurf"
|
|
355
568
|
];
|
|
356
569
|
var ALL_TOOL_TARGETS_WITH_WILDCARD = [...ALL_TOOL_TARGETS, "*"];
|
|
357
|
-
var ToolTargetSchema =
|
|
358
|
-
var ToolTargetsSchema =
|
|
359
|
-
var RulesyncTargetsSchema =
|
|
570
|
+
var ToolTargetSchema = z3.enum(ALL_TOOL_TARGETS);
|
|
571
|
+
var ToolTargetsSchema = z3.array(ToolTargetSchema);
|
|
572
|
+
var RulesyncTargetsSchema = z3.array(z3.enum(ALL_TOOL_TARGETS_WITH_WILDCARD));
|
|
360
573
|
|
|
361
574
|
// src/commands/rulesync-command.ts
|
|
362
|
-
var RulesyncCommandFrontmatterSchema =
|
|
575
|
+
var RulesyncCommandFrontmatterSchema = z4.object({
|
|
363
576
|
targets: RulesyncTargetsSchema,
|
|
364
|
-
description:
|
|
577
|
+
description: z4.string()
|
|
365
578
|
});
|
|
366
579
|
var RulesyncCommand = class _RulesyncCommand extends RulesyncFile {
|
|
367
580
|
frontmatter;
|
|
@@ -406,14 +619,14 @@ var RulesyncCommand = class _RulesyncCommand extends RulesyncFile {
|
|
|
406
619
|
relativeFilePath
|
|
407
620
|
}) {
|
|
408
621
|
const fileContent = await readFileContent(
|
|
409
|
-
|
|
622
|
+
join4(_RulesyncCommand.getSettablePaths().relativeDirPath, relativeFilePath)
|
|
410
623
|
);
|
|
411
624
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
412
625
|
const result = RulesyncCommandFrontmatterSchema.safeParse(frontmatter);
|
|
413
626
|
if (!result.success) {
|
|
414
627
|
throw new Error(`Invalid frontmatter in ${relativeFilePath}: ${result.error.message}`);
|
|
415
628
|
}
|
|
416
|
-
const filename =
|
|
629
|
+
const filename = basename4(relativeFilePath);
|
|
417
630
|
return new _RulesyncCommand({
|
|
418
631
|
baseDir: ".",
|
|
419
632
|
relativeDirPath: _RulesyncCommand.getSettablePaths().relativeDirPath,
|
|
@@ -425,79 +638,9 @@ var RulesyncCommand = class _RulesyncCommand extends RulesyncFile {
|
|
|
425
638
|
}
|
|
426
639
|
};
|
|
427
640
|
|
|
428
|
-
// src/commands/tool-command.ts
|
|
429
|
-
var ToolCommand = class extends AiFile {
|
|
430
|
-
static getSettablePaths() {
|
|
431
|
-
throw new Error("Please implement this method in the subclass.");
|
|
432
|
-
}
|
|
433
|
-
/**
|
|
434
|
-
* Load a command from a tool-specific file path.
|
|
435
|
-
*
|
|
436
|
-
* This method should:
|
|
437
|
-
* 1. Read the file content
|
|
438
|
-
* 2. Parse tool-specific frontmatter format
|
|
439
|
-
* 3. Validate the parsed data
|
|
440
|
-
* 4. Return a concrete ToolCommand instance
|
|
441
|
-
*
|
|
442
|
-
* @param params - Parameters including the file path to load
|
|
443
|
-
* @returns Promise resolving to a concrete ToolCommand instance
|
|
444
|
-
*/
|
|
445
|
-
static async fromFile(_params) {
|
|
446
|
-
throw new Error("Please implement this method in the subclass.");
|
|
447
|
-
}
|
|
448
|
-
/**
|
|
449
|
-
* Convert a RulesyncCommand to the tool-specific command format.
|
|
450
|
-
*
|
|
451
|
-
* This method should:
|
|
452
|
-
* 1. Extract relevant data from the RulesyncCommand
|
|
453
|
-
* 2. Transform frontmatter to tool-specific format
|
|
454
|
-
* 3. Transform body content if needed
|
|
455
|
-
* 4. Return a concrete ToolCommand instance
|
|
456
|
-
*
|
|
457
|
-
* @param params - Parameters including the RulesyncCommand to convert
|
|
458
|
-
* @returns A concrete ToolCommand instance
|
|
459
|
-
*/
|
|
460
|
-
static fromRulesyncCommand(_params) {
|
|
461
|
-
throw new Error("Please implement this method in the subclass.");
|
|
462
|
-
}
|
|
463
|
-
/**
|
|
464
|
-
* Check if this tool is targeted by a RulesyncCommand based on its targets field.
|
|
465
|
-
* Subclasses should override this to provide specific targeting logic.
|
|
466
|
-
*
|
|
467
|
-
* @param rulesyncCommand - The RulesyncCommand to check
|
|
468
|
-
* @returns True if this tool is targeted by the command
|
|
469
|
-
*/
|
|
470
|
-
static isTargetedByRulesyncCommand(_rulesyncCommand) {
|
|
471
|
-
throw new Error("Please implement this method in the subclass.");
|
|
472
|
-
}
|
|
473
|
-
/**
|
|
474
|
-
* Default implementation for checking if a tool is targeted by a RulesyncCommand.
|
|
475
|
-
* Checks if the command's targets include the tool target or a wildcard.
|
|
476
|
-
*
|
|
477
|
-
* @param params - Parameters including the RulesyncCommand and tool target
|
|
478
|
-
* @returns True if the tool target is included in the command's targets
|
|
479
|
-
*/
|
|
480
|
-
static isTargetedByRulesyncCommandDefault({
|
|
481
|
-
rulesyncCommand,
|
|
482
|
-
toolTarget
|
|
483
|
-
}) {
|
|
484
|
-
const targets = rulesyncCommand.getFrontmatter().targets;
|
|
485
|
-
if (!targets) {
|
|
486
|
-
return true;
|
|
487
|
-
}
|
|
488
|
-
if (targets.includes("*")) {
|
|
489
|
-
return true;
|
|
490
|
-
}
|
|
491
|
-
if (targets.includes(toolTarget)) {
|
|
492
|
-
return true;
|
|
493
|
-
}
|
|
494
|
-
return false;
|
|
495
|
-
}
|
|
496
|
-
};
|
|
497
|
-
|
|
498
641
|
// src/commands/claudecode-command.ts
|
|
499
|
-
var ClaudecodeCommandFrontmatterSchema =
|
|
500
|
-
description:
|
|
642
|
+
var ClaudecodeCommandFrontmatterSchema = z5.object({
|
|
643
|
+
description: z5.string()
|
|
501
644
|
});
|
|
502
645
|
var ClaudecodeCommand = class _ClaudecodeCommand extends ToolCommand {
|
|
503
646
|
frontmatter;
|
|
@@ -523,7 +666,7 @@ var ClaudecodeCommand = class _ClaudecodeCommand extends ToolCommand {
|
|
|
523
666
|
}
|
|
524
667
|
static getSettablePathsGlobal() {
|
|
525
668
|
return {
|
|
526
|
-
relativeDirPath:
|
|
669
|
+
relativeDirPath: join5(".claude", "commands")
|
|
527
670
|
};
|
|
528
671
|
}
|
|
529
672
|
getBody() {
|
|
@@ -594,7 +737,7 @@ var ClaudecodeCommand = class _ClaudecodeCommand extends ToolCommand {
|
|
|
594
737
|
global = false
|
|
595
738
|
}) {
|
|
596
739
|
const paths = global ? this.getSettablePathsGlobal() : this.getSettablePaths();
|
|
597
|
-
const filePath =
|
|
740
|
+
const filePath = join5(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
598
741
|
const fileContent = await readFileContent(filePath);
|
|
599
742
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
600
743
|
const result = ClaudecodeCommandFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -604,7 +747,7 @@ var ClaudecodeCommand = class _ClaudecodeCommand extends ToolCommand {
|
|
|
604
747
|
return new _ClaudecodeCommand({
|
|
605
748
|
baseDir,
|
|
606
749
|
relativeDirPath: paths.relativeDirPath,
|
|
607
|
-
relativeFilePath:
|
|
750
|
+
relativeFilePath: basename5(relativeFilePath),
|
|
608
751
|
frontmatter: result.data,
|
|
609
752
|
body: content.trim(),
|
|
610
753
|
validate
|
|
@@ -613,14 +756,14 @@ var ClaudecodeCommand = class _ClaudecodeCommand extends ToolCommand {
|
|
|
613
756
|
};
|
|
614
757
|
|
|
615
758
|
// src/commands/codexcli-command.ts
|
|
616
|
-
import { basename as
|
|
759
|
+
import { basename as basename6, join as join6 } from "path";
|
|
617
760
|
var CodexcliCommand = class _CodexcliCommand extends ToolCommand {
|
|
618
761
|
static getSettablePaths() {
|
|
619
762
|
throw new Error("getSettablePaths is not supported for CodexcliCommand");
|
|
620
763
|
}
|
|
621
764
|
static getSettablePathsGlobal() {
|
|
622
765
|
return {
|
|
623
|
-
relativeDirPath:
|
|
766
|
+
relativeDirPath: join6(".codex", "prompts")
|
|
624
767
|
};
|
|
625
768
|
}
|
|
626
769
|
toRulesyncCommand() {
|
|
@@ -639,146 +782,55 @@ var CodexcliCommand = class _CodexcliCommand extends ToolCommand {
|
|
|
639
782
|
validate: true
|
|
640
783
|
});
|
|
641
784
|
}
|
|
642
|
-
static fromRulesyncCommand({
|
|
643
|
-
baseDir = ".",
|
|
644
|
-
rulesyncCommand,
|
|
645
|
-
validate = true,
|
|
646
|
-
global = false
|
|
647
|
-
}) {
|
|
648
|
-
const paths = global ? this.getSettablePathsGlobal() : this.getSettablePaths();
|
|
649
|
-
return new _CodexcliCommand({
|
|
650
|
-
baseDir,
|
|
651
|
-
fileContent: rulesyncCommand.getBody(),
|
|
652
|
-
relativeDirPath: paths.relativeDirPath,
|
|
653
|
-
relativeFilePath: rulesyncCommand.getRelativeFilePath(),
|
|
654
|
-
validate
|
|
655
|
-
});
|
|
656
|
-
}
|
|
657
|
-
validate() {
|
|
658
|
-
return { success: true, error: null };
|
|
659
|
-
}
|
|
660
|
-
getBody() {
|
|
661
|
-
return this.getFileContent();
|
|
662
|
-
}
|
|
663
|
-
static isTargetedByRulesyncCommand(rulesyncCommand) {
|
|
664
|
-
return this.isTargetedByRulesyncCommandDefault({
|
|
665
|
-
rulesyncCommand,
|
|
666
|
-
toolTarget: "codexcli"
|
|
667
|
-
});
|
|
668
|
-
}
|
|
669
|
-
static async fromFile({
|
|
670
|
-
baseDir = ".",
|
|
671
|
-
relativeFilePath,
|
|
672
|
-
validate = true,
|
|
673
|
-
global = false
|
|
674
|
-
}) {
|
|
675
|
-
const paths = global ? this.getSettablePathsGlobal() : this.getSettablePaths();
|
|
676
|
-
const filePath = join4(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
677
|
-
const fileContent = await readFileContent(filePath);
|
|
678
|
-
const { body: content } = parseFrontmatter(fileContent);
|
|
679
|
-
return new _CodexcliCommand({
|
|
680
|
-
baseDir,
|
|
681
|
-
relativeDirPath: paths.relativeDirPath,
|
|
682
|
-
relativeFilePath: basename4(relativeFilePath),
|
|
683
|
-
fileContent: content.trim(),
|
|
684
|
-
validate
|
|
685
|
-
});
|
|
686
|
-
}
|
|
687
|
-
};
|
|
688
|
-
|
|
689
|
-
// src/commands/copilot-command.ts
|
|
690
|
-
import { basename as basename6, join as join6 } from "path";
|
|
691
|
-
|
|
692
|
-
// src/commands/simulated-command.ts
|
|
693
|
-
import { basename as basename5, join as join5 } from "path";
|
|
694
|
-
import { z as z5 } from "zod/mini";
|
|
695
|
-
var SimulatedCommandFrontmatterSchema = z5.object({
|
|
696
|
-
description: z5.string()
|
|
697
|
-
});
|
|
698
|
-
var SimulatedCommand = class _SimulatedCommand extends ToolCommand {
|
|
699
|
-
frontmatter;
|
|
700
|
-
body;
|
|
701
|
-
constructor({ frontmatter, body, ...rest }) {
|
|
702
|
-
if (rest.validate) {
|
|
703
|
-
const result = SimulatedCommandFrontmatterSchema.safeParse(frontmatter);
|
|
704
|
-
if (!result.success) {
|
|
705
|
-
throw result.error;
|
|
706
|
-
}
|
|
707
|
-
}
|
|
708
|
-
super({
|
|
709
|
-
...rest,
|
|
710
|
-
fileContent: stringifyFrontmatter(body, frontmatter)
|
|
711
|
-
});
|
|
712
|
-
this.frontmatter = frontmatter;
|
|
713
|
-
this.body = body;
|
|
714
|
-
}
|
|
715
|
-
getBody() {
|
|
716
|
-
return this.body;
|
|
717
|
-
}
|
|
718
|
-
getFrontmatter() {
|
|
719
|
-
return this.frontmatter;
|
|
720
|
-
}
|
|
721
|
-
toRulesyncCommand() {
|
|
722
|
-
throw new Error("Not implemented because it is a SIMULATED file.");
|
|
723
|
-
}
|
|
724
|
-
static fromRulesyncCommandDefault({
|
|
785
|
+
static fromRulesyncCommand({
|
|
725
786
|
baseDir = ".",
|
|
726
787
|
rulesyncCommand,
|
|
727
|
-
validate = true
|
|
788
|
+
validate = true,
|
|
789
|
+
global = false
|
|
728
790
|
}) {
|
|
729
|
-
const
|
|
730
|
-
|
|
731
|
-
description: rulesyncFrontmatter.description
|
|
732
|
-
};
|
|
733
|
-
const body = rulesyncCommand.getBody();
|
|
734
|
-
return {
|
|
791
|
+
const paths = global ? this.getSettablePathsGlobal() : this.getSettablePaths();
|
|
792
|
+
return new _CodexcliCommand({
|
|
735
793
|
baseDir,
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
794
|
+
fileContent: rulesyncCommand.getBody(),
|
|
795
|
+
relativeDirPath: paths.relativeDirPath,
|
|
739
796
|
relativeFilePath: rulesyncCommand.getRelativeFilePath(),
|
|
740
797
|
validate
|
|
741
|
-
};
|
|
798
|
+
});
|
|
742
799
|
}
|
|
743
800
|
validate() {
|
|
744
|
-
|
|
745
|
-
return { success: true, error: null };
|
|
746
|
-
}
|
|
747
|
-
const result = SimulatedCommandFrontmatterSchema.safeParse(this.frontmatter);
|
|
748
|
-
if (result.success) {
|
|
749
|
-
return { success: true, error: null };
|
|
750
|
-
} else {
|
|
751
|
-
return { success: false, error: result.error };
|
|
752
|
-
}
|
|
801
|
+
return { success: true, error: null };
|
|
753
802
|
}
|
|
754
|
-
|
|
803
|
+
getBody() {
|
|
804
|
+
return this.getFileContent();
|
|
805
|
+
}
|
|
806
|
+
static isTargetedByRulesyncCommand(rulesyncCommand) {
|
|
807
|
+
return this.isTargetedByRulesyncCommandDefault({
|
|
808
|
+
rulesyncCommand,
|
|
809
|
+
toolTarget: "codexcli"
|
|
810
|
+
});
|
|
811
|
+
}
|
|
812
|
+
static async fromFile({
|
|
755
813
|
baseDir = ".",
|
|
756
814
|
relativeFilePath,
|
|
757
|
-
validate = true
|
|
815
|
+
validate = true,
|
|
816
|
+
global = false
|
|
758
817
|
}) {
|
|
759
|
-
const
|
|
760
|
-
|
|
761
|
-
_SimulatedCommand.getSettablePaths().relativeDirPath,
|
|
762
|
-
relativeFilePath
|
|
763
|
-
);
|
|
818
|
+
const paths = global ? this.getSettablePathsGlobal() : this.getSettablePaths();
|
|
819
|
+
const filePath = join6(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
764
820
|
const fileContent = await readFileContent(filePath);
|
|
765
|
-
const {
|
|
766
|
-
|
|
767
|
-
if (!result.success) {
|
|
768
|
-
throw new Error(`Invalid frontmatter in ${filePath}: ${result.error.message}`);
|
|
769
|
-
}
|
|
770
|
-
return {
|
|
821
|
+
const { body: content } = parseFrontmatter(fileContent);
|
|
822
|
+
return new _CodexcliCommand({
|
|
771
823
|
baseDir,
|
|
772
|
-
relativeDirPath:
|
|
773
|
-
relativeFilePath:
|
|
774
|
-
|
|
775
|
-
body: content.trim(),
|
|
824
|
+
relativeDirPath: paths.relativeDirPath,
|
|
825
|
+
relativeFilePath: basename6(relativeFilePath),
|
|
826
|
+
fileContent: content.trim(),
|
|
776
827
|
validate
|
|
777
|
-
};
|
|
828
|
+
});
|
|
778
829
|
}
|
|
779
830
|
};
|
|
780
831
|
|
|
781
832
|
// src/commands/copilot-command.ts
|
|
833
|
+
import { basename as basename7, join as join7 } from "path";
|
|
782
834
|
var CopilotCommand = class _CopilotCommand extends SimulatedCommand {
|
|
783
835
|
static getSettablePaths() {
|
|
784
836
|
return {
|
|
@@ -799,7 +851,7 @@ var CopilotCommand = class _CopilotCommand extends SimulatedCommand {
|
|
|
799
851
|
relativeFilePath,
|
|
800
852
|
validate = true
|
|
801
853
|
}) {
|
|
802
|
-
const filePath =
|
|
854
|
+
const filePath = join7(
|
|
803
855
|
baseDir,
|
|
804
856
|
_CopilotCommand.getSettablePaths().relativeDirPath,
|
|
805
857
|
relativeFilePath
|
|
@@ -813,7 +865,7 @@ var CopilotCommand = class _CopilotCommand extends SimulatedCommand {
|
|
|
813
865
|
return new _CopilotCommand({
|
|
814
866
|
baseDir,
|
|
815
867
|
relativeDirPath: _CopilotCommand.getSettablePaths().relativeDirPath,
|
|
816
|
-
relativeFilePath:
|
|
868
|
+
relativeFilePath: basename7(relativeFilePath),
|
|
817
869
|
frontmatter: result.data,
|
|
818
870
|
body: content.trim(),
|
|
819
871
|
validate
|
|
@@ -828,16 +880,16 @@ var CopilotCommand = class _CopilotCommand extends SimulatedCommand {
|
|
|
828
880
|
};
|
|
829
881
|
|
|
830
882
|
// src/commands/cursor-command.ts
|
|
831
|
-
import { basename as
|
|
883
|
+
import { basename as basename8, join as join8 } from "path";
|
|
832
884
|
var CursorCommand = class _CursorCommand extends ToolCommand {
|
|
833
885
|
static getSettablePaths() {
|
|
834
886
|
return {
|
|
835
|
-
relativeDirPath:
|
|
887
|
+
relativeDirPath: join8(".cursor", "commands")
|
|
836
888
|
};
|
|
837
889
|
}
|
|
838
890
|
static getSettablePathsGlobal() {
|
|
839
891
|
return {
|
|
840
|
-
relativeDirPath:
|
|
892
|
+
relativeDirPath: join8(".cursor", "commands")
|
|
841
893
|
};
|
|
842
894
|
}
|
|
843
895
|
toRulesyncCommand() {
|
|
@@ -890,13 +942,13 @@ var CursorCommand = class _CursorCommand extends ToolCommand {
|
|
|
890
942
|
global = false
|
|
891
943
|
}) {
|
|
892
944
|
const paths = global ? this.getSettablePathsGlobal() : this.getSettablePaths();
|
|
893
|
-
const filePath =
|
|
945
|
+
const filePath = join8(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
894
946
|
const fileContent = await readFileContent(filePath);
|
|
895
947
|
const { body: content } = parseFrontmatter(fileContent);
|
|
896
948
|
return new _CursorCommand({
|
|
897
949
|
baseDir,
|
|
898
950
|
relativeDirPath: paths.relativeDirPath,
|
|
899
|
-
relativeFilePath:
|
|
951
|
+
relativeFilePath: basename8(relativeFilePath),
|
|
900
952
|
fileContent: content.trim(),
|
|
901
953
|
validate
|
|
902
954
|
});
|
|
@@ -904,7 +956,7 @@ var CursorCommand = class _CursorCommand extends ToolCommand {
|
|
|
904
956
|
};
|
|
905
957
|
|
|
906
958
|
// src/commands/geminicli-command.ts
|
|
907
|
-
import { basename as
|
|
959
|
+
import { basename as basename9, join as join9 } from "path";
|
|
908
960
|
import { parse as parseToml } from "smol-toml";
|
|
909
961
|
import { z as z6 } from "zod/mini";
|
|
910
962
|
var GeminiCliCommandFrontmatterSchema = z6.object({
|
|
@@ -927,7 +979,7 @@ var GeminiCliCommand = class _GeminiCliCommand extends ToolCommand {
|
|
|
927
979
|
}
|
|
928
980
|
static getSettablePathsGlobal() {
|
|
929
981
|
return {
|
|
930
|
-
relativeDirPath:
|
|
982
|
+
relativeDirPath: join9(".gemini", "commands")
|
|
931
983
|
};
|
|
932
984
|
}
|
|
933
985
|
parseTomlContent(content) {
|
|
@@ -999,12 +1051,12 @@ ${geminiFrontmatter.prompt}
|
|
|
999
1051
|
global = false
|
|
1000
1052
|
}) {
|
|
1001
1053
|
const paths = global ? this.getSettablePathsGlobal() : this.getSettablePaths();
|
|
1002
|
-
const filePath =
|
|
1054
|
+
const filePath = join9(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
1003
1055
|
const fileContent = await readFileContent(filePath);
|
|
1004
1056
|
return new _GeminiCliCommand({
|
|
1005
1057
|
baseDir,
|
|
1006
1058
|
relativeDirPath: paths.relativeDirPath,
|
|
1007
|
-
relativeFilePath:
|
|
1059
|
+
relativeFilePath: basename9(relativeFilePath),
|
|
1008
1060
|
fileContent,
|
|
1009
1061
|
validate
|
|
1010
1062
|
});
|
|
@@ -1026,7 +1078,7 @@ ${geminiFrontmatter.prompt}
|
|
|
1026
1078
|
};
|
|
1027
1079
|
|
|
1028
1080
|
// src/commands/roo-command.ts
|
|
1029
|
-
import { basename as
|
|
1081
|
+
import { basename as basename10, join as join10 } from "path";
|
|
1030
1082
|
import { optional, z as z7 } from "zod/mini";
|
|
1031
1083
|
var RooCommandFrontmatterSchema = z7.object({
|
|
1032
1084
|
description: z7.string(),
|
|
@@ -1120,7 +1172,7 @@ var RooCommand = class _RooCommand extends ToolCommand {
|
|
|
1120
1172
|
relativeFilePath,
|
|
1121
1173
|
validate = true
|
|
1122
1174
|
}) {
|
|
1123
|
-
const filePath =
|
|
1175
|
+
const filePath = join10(baseDir, _RooCommand.getSettablePaths().relativeDirPath, relativeFilePath);
|
|
1124
1176
|
const fileContent = await readFileContent(filePath);
|
|
1125
1177
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
1126
1178
|
const result = RooCommandFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -1130,7 +1182,7 @@ var RooCommand = class _RooCommand extends ToolCommand {
|
|
|
1130
1182
|
return new _RooCommand({
|
|
1131
1183
|
baseDir,
|
|
1132
1184
|
relativeDirPath: _RooCommand.getSettablePaths().relativeDirPath,
|
|
1133
|
-
relativeFilePath:
|
|
1185
|
+
relativeFilePath: basename10(relativeFilePath),
|
|
1134
1186
|
frontmatter: result.data,
|
|
1135
1187
|
body: content.trim(),
|
|
1136
1188
|
fileContent,
|
|
@@ -1141,6 +1193,7 @@ var RooCommand = class _RooCommand extends ToolCommand {
|
|
|
1141
1193
|
|
|
1142
1194
|
// src/commands/commands-processor.ts
|
|
1143
1195
|
var commandsProcessorToolTargets = [
|
|
1196
|
+
"agentsmd",
|
|
1144
1197
|
"claudecode",
|
|
1145
1198
|
"geminicli",
|
|
1146
1199
|
"roo",
|
|
@@ -1151,7 +1204,7 @@ var CommandsProcessorToolTargetSchema = z8.enum(
|
|
|
1151
1204
|
// codexcli is not in the list of tool targets but we add it here because it is a valid tool target for global mode generation
|
|
1152
1205
|
commandsProcessorToolTargets.concat("codexcli")
|
|
1153
1206
|
);
|
|
1154
|
-
var commandsProcessorToolTargetsSimulated = ["copilot"];
|
|
1207
|
+
var commandsProcessorToolTargetsSimulated = ["agentsmd", "copilot"];
|
|
1155
1208
|
var commandsProcessorToolTargetsGlobal = [
|
|
1156
1209
|
"claudecode",
|
|
1157
1210
|
"cursor",
|
|
@@ -1176,6 +1229,14 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
1176
1229
|
);
|
|
1177
1230
|
const toolCommands = rulesyncCommands.map((rulesyncCommand) => {
|
|
1178
1231
|
switch (this.toolTarget) {
|
|
1232
|
+
case "agentsmd":
|
|
1233
|
+
if (!AgentsmdCommand.isTargetedByRulesyncCommand(rulesyncCommand)) {
|
|
1234
|
+
return null;
|
|
1235
|
+
}
|
|
1236
|
+
return AgentsmdCommand.fromRulesyncCommand({
|
|
1237
|
+
baseDir: this.baseDir,
|
|
1238
|
+
rulesyncCommand
|
|
1239
|
+
});
|
|
1179
1240
|
case "claudecode":
|
|
1180
1241
|
if (!ClaudecodeCommand.isTargetedByRulesyncCommand(rulesyncCommand)) {
|
|
1181
1242
|
return null;
|
|
@@ -1251,11 +1312,11 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
1251
1312
|
*/
|
|
1252
1313
|
async loadRulesyncFiles() {
|
|
1253
1314
|
const rulesyncCommandPaths = await findFilesByGlobs(
|
|
1254
|
-
|
|
1315
|
+
join11(RulesyncCommand.getSettablePaths().relativeDirPath, "*.md")
|
|
1255
1316
|
);
|
|
1256
1317
|
const rulesyncCommands = (await Promise.allSettled(
|
|
1257
1318
|
rulesyncCommandPaths.map(
|
|
1258
|
-
(path2) => RulesyncCommand.fromFile({ relativeFilePath:
|
|
1319
|
+
(path2) => RulesyncCommand.fromFile({ relativeFilePath: basename11(path2) })
|
|
1259
1320
|
)
|
|
1260
1321
|
)).filter((result) => result.status === "fulfilled").map((result) => result.value);
|
|
1261
1322
|
logger.info(`Successfully loaded ${rulesyncCommands.length} rulesync commands`);
|
|
@@ -1267,6 +1328,8 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
1267
1328
|
*/
|
|
1268
1329
|
async loadToolFiles() {
|
|
1269
1330
|
switch (this.toolTarget) {
|
|
1331
|
+
case "agentsmd":
|
|
1332
|
+
return await this.loadAgentsmdCommands();
|
|
1270
1333
|
case "claudecode":
|
|
1271
1334
|
return await this.loadClaudecodeCommands();
|
|
1272
1335
|
case "geminicli":
|
|
@@ -1292,43 +1355,48 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
1292
1355
|
extension
|
|
1293
1356
|
}) {
|
|
1294
1357
|
const commandFilePaths = await findFilesByGlobs(
|
|
1295
|
-
|
|
1358
|
+
join11(this.baseDir, relativeDirPath, `*.${extension}`)
|
|
1296
1359
|
);
|
|
1297
1360
|
const toolCommands = (await Promise.allSettled(
|
|
1298
1361
|
commandFilePaths.map((path2) => {
|
|
1299
1362
|
switch (toolTarget) {
|
|
1363
|
+
case "agentsmd":
|
|
1364
|
+
return AgentsmdCommand.fromFile({
|
|
1365
|
+
baseDir: this.baseDir,
|
|
1366
|
+
relativeFilePath: basename11(path2)
|
|
1367
|
+
});
|
|
1300
1368
|
case "claudecode":
|
|
1301
1369
|
return ClaudecodeCommand.fromFile({
|
|
1302
1370
|
baseDir: this.baseDir,
|
|
1303
|
-
relativeFilePath:
|
|
1371
|
+
relativeFilePath: basename11(path2),
|
|
1304
1372
|
global: this.global
|
|
1305
1373
|
});
|
|
1306
1374
|
case "geminicli":
|
|
1307
1375
|
return GeminiCliCommand.fromFile({
|
|
1308
1376
|
baseDir: this.baseDir,
|
|
1309
|
-
relativeFilePath:
|
|
1377
|
+
relativeFilePath: basename11(path2),
|
|
1310
1378
|
global: this.global
|
|
1311
1379
|
});
|
|
1312
1380
|
case "roo":
|
|
1313
1381
|
return RooCommand.fromFile({
|
|
1314
1382
|
baseDir: this.baseDir,
|
|
1315
|
-
relativeFilePath:
|
|
1383
|
+
relativeFilePath: basename11(path2)
|
|
1316
1384
|
});
|
|
1317
1385
|
case "copilot":
|
|
1318
1386
|
return CopilotCommand.fromFile({
|
|
1319
1387
|
baseDir: this.baseDir,
|
|
1320
|
-
relativeFilePath:
|
|
1388
|
+
relativeFilePath: basename11(path2)
|
|
1321
1389
|
});
|
|
1322
1390
|
case "cursor":
|
|
1323
1391
|
return CursorCommand.fromFile({
|
|
1324
1392
|
baseDir: this.baseDir,
|
|
1325
|
-
relativeFilePath:
|
|
1393
|
+
relativeFilePath: basename11(path2),
|
|
1326
1394
|
global: this.global
|
|
1327
1395
|
});
|
|
1328
1396
|
case "codexcli":
|
|
1329
1397
|
return CodexcliCommand.fromFile({
|
|
1330
1398
|
baseDir: this.baseDir,
|
|
1331
|
-
relativeFilePath:
|
|
1399
|
+
relativeFilePath: basename11(path2),
|
|
1332
1400
|
global: this.global
|
|
1333
1401
|
});
|
|
1334
1402
|
default:
|
|
@@ -1340,7 +1408,17 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
1340
1408
|
return toolCommands;
|
|
1341
1409
|
}
|
|
1342
1410
|
/**
|
|
1343
|
-
* Load
|
|
1411
|
+
* Load Agents.md command configurations from .agents/commands/ directory
|
|
1412
|
+
*/
|
|
1413
|
+
async loadAgentsmdCommands() {
|
|
1414
|
+
return await this.loadToolCommandDefault({
|
|
1415
|
+
toolTarget: "agentsmd",
|
|
1416
|
+
relativeDirPath: AgentsmdCommand.getSettablePaths().relativeDirPath,
|
|
1417
|
+
extension: "md"
|
|
1418
|
+
});
|
|
1419
|
+
}
|
|
1420
|
+
/**
|
|
1421
|
+
* Load Copilot command configurations from .github/commands/ directory
|
|
1344
1422
|
*/
|
|
1345
1423
|
async loadCopilotCommands() {
|
|
1346
1424
|
return await this.loadToolCommandDefault({
|
|
@@ -1426,7 +1504,7 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
1426
1504
|
};
|
|
1427
1505
|
|
|
1428
1506
|
// src/config/config-resolver.ts
|
|
1429
|
-
import { join as
|
|
1507
|
+
import { join as join12 } from "path";
|
|
1430
1508
|
import { loadConfig } from "c12";
|
|
1431
1509
|
|
|
1432
1510
|
// src/config/config.ts
|
|
@@ -1562,7 +1640,7 @@ function getBaseDirsInLightOfGlobal({
|
|
|
1562
1640
|
global
|
|
1563
1641
|
}) {
|
|
1564
1642
|
if (isEnvTest) {
|
|
1565
|
-
return baseDirs.map((baseDir) =>
|
|
1643
|
+
return baseDirs.map((baseDir) => join12(".", baseDir));
|
|
1566
1644
|
}
|
|
1567
1645
|
if (global) {
|
|
1568
1646
|
return [getHomeDirectory()];
|
|
@@ -1577,7 +1655,7 @@ function getBaseDirsInLightOfGlobal({
|
|
|
1577
1655
|
import { z as z9 } from "zod/mini";
|
|
1578
1656
|
|
|
1579
1657
|
// src/ignore/amazonqcli-ignore.ts
|
|
1580
|
-
import { join as
|
|
1658
|
+
import { join as join13 } from "path";
|
|
1581
1659
|
|
|
1582
1660
|
// src/types/tool-file.ts
|
|
1583
1661
|
var ToolFile = class extends AiFile {
|
|
@@ -1685,7 +1763,7 @@ var AmazonqcliIgnore = class _AmazonqcliIgnore extends ToolIgnore {
|
|
|
1685
1763
|
validate = true
|
|
1686
1764
|
}) {
|
|
1687
1765
|
const fileContent = await readFileContent(
|
|
1688
|
-
|
|
1766
|
+
join13(
|
|
1689
1767
|
baseDir,
|
|
1690
1768
|
this.getSettablePaths().relativeDirPath,
|
|
1691
1769
|
this.getSettablePaths().relativeFilePath
|
|
@@ -1702,7 +1780,7 @@ var AmazonqcliIgnore = class _AmazonqcliIgnore extends ToolIgnore {
|
|
|
1702
1780
|
};
|
|
1703
1781
|
|
|
1704
1782
|
// src/ignore/augmentcode-ignore.ts
|
|
1705
|
-
import { join as
|
|
1783
|
+
import { join as join14 } from "path";
|
|
1706
1784
|
var AugmentcodeIgnore = class _AugmentcodeIgnore extends ToolIgnore {
|
|
1707
1785
|
static getSettablePaths() {
|
|
1708
1786
|
return {
|
|
@@ -1740,7 +1818,7 @@ var AugmentcodeIgnore = class _AugmentcodeIgnore extends ToolIgnore {
|
|
|
1740
1818
|
validate = true
|
|
1741
1819
|
}) {
|
|
1742
1820
|
const fileContent = await readFileContent(
|
|
1743
|
-
|
|
1821
|
+
join14(
|
|
1744
1822
|
baseDir,
|
|
1745
1823
|
this.getSettablePaths().relativeDirPath,
|
|
1746
1824
|
this.getSettablePaths().relativeFilePath
|
|
@@ -1757,7 +1835,7 @@ var AugmentcodeIgnore = class _AugmentcodeIgnore extends ToolIgnore {
|
|
|
1757
1835
|
};
|
|
1758
1836
|
|
|
1759
1837
|
// src/ignore/claudecode-ignore.ts
|
|
1760
|
-
import { join as
|
|
1838
|
+
import { join as join15 } from "path";
|
|
1761
1839
|
import { uniq } from "es-toolkit";
|
|
1762
1840
|
var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
|
|
1763
1841
|
constructor(params) {
|
|
@@ -1793,7 +1871,7 @@ var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
|
|
|
1793
1871
|
const fileContent = rulesyncIgnore.getFileContent();
|
|
1794
1872
|
const patterns = fileContent.split(/\r?\n|\r/).map((line) => line.trim()).filter((line) => line.length > 0 && !line.startsWith("#"));
|
|
1795
1873
|
const deniedValues = patterns.map((pattern) => `Read(${pattern})`);
|
|
1796
|
-
const filePath =
|
|
1874
|
+
const filePath = join15(
|
|
1797
1875
|
baseDir,
|
|
1798
1876
|
this.getSettablePaths().relativeDirPath,
|
|
1799
1877
|
this.getSettablePaths().relativeFilePath
|
|
@@ -1821,7 +1899,7 @@ var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
|
|
|
1821
1899
|
validate = true
|
|
1822
1900
|
}) {
|
|
1823
1901
|
const fileContent = await readFileContent(
|
|
1824
|
-
|
|
1902
|
+
join15(
|
|
1825
1903
|
baseDir,
|
|
1826
1904
|
this.getSettablePaths().relativeDirPath,
|
|
1827
1905
|
this.getSettablePaths().relativeFilePath
|
|
@@ -1838,7 +1916,7 @@ var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
|
|
|
1838
1916
|
};
|
|
1839
1917
|
|
|
1840
1918
|
// src/ignore/cline-ignore.ts
|
|
1841
|
-
import { join as
|
|
1919
|
+
import { join as join16 } from "path";
|
|
1842
1920
|
var ClineIgnore = class _ClineIgnore extends ToolIgnore {
|
|
1843
1921
|
static getSettablePaths() {
|
|
1844
1922
|
return {
|
|
@@ -1875,7 +1953,7 @@ var ClineIgnore = class _ClineIgnore extends ToolIgnore {
|
|
|
1875
1953
|
validate = true
|
|
1876
1954
|
}) {
|
|
1877
1955
|
const fileContent = await readFileContent(
|
|
1878
|
-
|
|
1956
|
+
join16(
|
|
1879
1957
|
baseDir,
|
|
1880
1958
|
this.getSettablePaths().relativeDirPath,
|
|
1881
1959
|
this.getSettablePaths().relativeFilePath
|
|
@@ -1892,7 +1970,7 @@ var ClineIgnore = class _ClineIgnore extends ToolIgnore {
|
|
|
1892
1970
|
};
|
|
1893
1971
|
|
|
1894
1972
|
// src/ignore/cursor-ignore.ts
|
|
1895
|
-
import { join as
|
|
1973
|
+
import { join as join17 } from "path";
|
|
1896
1974
|
var CursorIgnore = class _CursorIgnore extends ToolIgnore {
|
|
1897
1975
|
static getSettablePaths() {
|
|
1898
1976
|
return {
|
|
@@ -1925,7 +2003,7 @@ var CursorIgnore = class _CursorIgnore extends ToolIgnore {
|
|
|
1925
2003
|
validate = true
|
|
1926
2004
|
}) {
|
|
1927
2005
|
const fileContent = await readFileContent(
|
|
1928
|
-
|
|
2006
|
+
join17(
|
|
1929
2007
|
baseDir,
|
|
1930
2008
|
this.getSettablePaths().relativeDirPath,
|
|
1931
2009
|
this.getSettablePaths().relativeFilePath
|
|
@@ -1942,7 +2020,7 @@ var CursorIgnore = class _CursorIgnore extends ToolIgnore {
|
|
|
1942
2020
|
};
|
|
1943
2021
|
|
|
1944
2022
|
// src/ignore/geminicli-ignore.ts
|
|
1945
|
-
import { join as
|
|
2023
|
+
import { join as join18 } from "path";
|
|
1946
2024
|
var GeminiCliIgnore = class _GeminiCliIgnore extends ToolIgnore {
|
|
1947
2025
|
static getSettablePaths() {
|
|
1948
2026
|
return {
|
|
@@ -1969,7 +2047,7 @@ var GeminiCliIgnore = class _GeminiCliIgnore extends ToolIgnore {
|
|
|
1969
2047
|
validate = true
|
|
1970
2048
|
}) {
|
|
1971
2049
|
const fileContent = await readFileContent(
|
|
1972
|
-
|
|
2050
|
+
join18(
|
|
1973
2051
|
baseDir,
|
|
1974
2052
|
this.getSettablePaths().relativeDirPath,
|
|
1975
2053
|
this.getSettablePaths().relativeFilePath
|
|
@@ -1986,7 +2064,7 @@ var GeminiCliIgnore = class _GeminiCliIgnore extends ToolIgnore {
|
|
|
1986
2064
|
};
|
|
1987
2065
|
|
|
1988
2066
|
// src/ignore/junie-ignore.ts
|
|
1989
|
-
import { join as
|
|
2067
|
+
import { join as join19 } from "path";
|
|
1990
2068
|
var JunieIgnore = class _JunieIgnore extends ToolIgnore {
|
|
1991
2069
|
static getSettablePaths() {
|
|
1992
2070
|
return {
|
|
@@ -2013,7 +2091,7 @@ var JunieIgnore = class _JunieIgnore extends ToolIgnore {
|
|
|
2013
2091
|
validate = true
|
|
2014
2092
|
}) {
|
|
2015
2093
|
const fileContent = await readFileContent(
|
|
2016
|
-
|
|
2094
|
+
join19(
|
|
2017
2095
|
baseDir,
|
|
2018
2096
|
this.getSettablePaths().relativeDirPath,
|
|
2019
2097
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2030,7 +2108,7 @@ var JunieIgnore = class _JunieIgnore extends ToolIgnore {
|
|
|
2030
2108
|
};
|
|
2031
2109
|
|
|
2032
2110
|
// src/ignore/kiro-ignore.ts
|
|
2033
|
-
import { join as
|
|
2111
|
+
import { join as join20 } from "path";
|
|
2034
2112
|
var KiroIgnore = class _KiroIgnore extends ToolIgnore {
|
|
2035
2113
|
static getSettablePaths() {
|
|
2036
2114
|
return {
|
|
@@ -2057,7 +2135,7 @@ var KiroIgnore = class _KiroIgnore extends ToolIgnore {
|
|
|
2057
2135
|
validate = true
|
|
2058
2136
|
}) {
|
|
2059
2137
|
const fileContent = await readFileContent(
|
|
2060
|
-
|
|
2138
|
+
join20(
|
|
2061
2139
|
baseDir,
|
|
2062
2140
|
this.getSettablePaths().relativeDirPath,
|
|
2063
2141
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2074,7 +2152,7 @@ var KiroIgnore = class _KiroIgnore extends ToolIgnore {
|
|
|
2074
2152
|
};
|
|
2075
2153
|
|
|
2076
2154
|
// src/ignore/qwencode-ignore.ts
|
|
2077
|
-
import { join as
|
|
2155
|
+
import { join as join21 } from "path";
|
|
2078
2156
|
var QwencodeIgnore = class _QwencodeIgnore extends ToolIgnore {
|
|
2079
2157
|
static getSettablePaths() {
|
|
2080
2158
|
return {
|
|
@@ -2101,7 +2179,7 @@ var QwencodeIgnore = class _QwencodeIgnore extends ToolIgnore {
|
|
|
2101
2179
|
validate = true
|
|
2102
2180
|
}) {
|
|
2103
2181
|
const fileContent = await readFileContent(
|
|
2104
|
-
|
|
2182
|
+
join21(
|
|
2105
2183
|
baseDir,
|
|
2106
2184
|
this.getSettablePaths().relativeDirPath,
|
|
2107
2185
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2118,7 +2196,7 @@ var QwencodeIgnore = class _QwencodeIgnore extends ToolIgnore {
|
|
|
2118
2196
|
};
|
|
2119
2197
|
|
|
2120
2198
|
// src/ignore/roo-ignore.ts
|
|
2121
|
-
import { join as
|
|
2199
|
+
import { join as join22 } from "path";
|
|
2122
2200
|
var RooIgnore = class _RooIgnore extends ToolIgnore {
|
|
2123
2201
|
static getSettablePaths() {
|
|
2124
2202
|
return {
|
|
@@ -2145,7 +2223,7 @@ var RooIgnore = class _RooIgnore extends ToolIgnore {
|
|
|
2145
2223
|
validate = true
|
|
2146
2224
|
}) {
|
|
2147
2225
|
const fileContent = await readFileContent(
|
|
2148
|
-
|
|
2226
|
+
join22(
|
|
2149
2227
|
baseDir,
|
|
2150
2228
|
this.getSettablePaths().relativeDirPath,
|
|
2151
2229
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2162,7 +2240,7 @@ var RooIgnore = class _RooIgnore extends ToolIgnore {
|
|
|
2162
2240
|
};
|
|
2163
2241
|
|
|
2164
2242
|
// src/ignore/windsurf-ignore.ts
|
|
2165
|
-
import { join as
|
|
2243
|
+
import { join as join23 } from "path";
|
|
2166
2244
|
var WindsurfIgnore = class _WindsurfIgnore extends ToolIgnore {
|
|
2167
2245
|
static getSettablePaths() {
|
|
2168
2246
|
return {
|
|
@@ -2189,7 +2267,7 @@ var WindsurfIgnore = class _WindsurfIgnore extends ToolIgnore {
|
|
|
2189
2267
|
validate = true
|
|
2190
2268
|
}) {
|
|
2191
2269
|
const fileContent = await readFileContent(
|
|
2192
|
-
|
|
2270
|
+
join23(
|
|
2193
2271
|
baseDir,
|
|
2194
2272
|
this.getSettablePaths().relativeDirPath,
|
|
2195
2273
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2391,10 +2469,10 @@ var IgnoreProcessor = class extends FeatureProcessor {
|
|
|
2391
2469
|
import { z as z11 } from "zod/mini";
|
|
2392
2470
|
|
|
2393
2471
|
// src/mcp/amazonqcli-mcp.ts
|
|
2394
|
-
import { join as
|
|
2472
|
+
import { join as join25 } from "path";
|
|
2395
2473
|
|
|
2396
2474
|
// src/mcp/rulesync-mcp.ts
|
|
2397
|
-
import { join as
|
|
2475
|
+
import { join as join24 } from "path";
|
|
2398
2476
|
import { z as z10 } from "zod/mini";
|
|
2399
2477
|
var McpTransportTypeSchema = z10.enum(["stdio", "sse", "http"]);
|
|
2400
2478
|
var McpServerBaseSchema = z10.object({
|
|
@@ -2445,7 +2523,7 @@ var RulesyncMcp = class _RulesyncMcp extends RulesyncFile {
|
|
|
2445
2523
|
}
|
|
2446
2524
|
static async fromFile({ validate = true }) {
|
|
2447
2525
|
const fileContent = await readFileContent(
|
|
2448
|
-
|
|
2526
|
+
join24(this.getSettablePaths().relativeDirPath, this.getSettablePaths().relativeFilePath)
|
|
2449
2527
|
);
|
|
2450
2528
|
return new _RulesyncMcp({
|
|
2451
2529
|
baseDir: ".",
|
|
@@ -2512,7 +2590,7 @@ var AmazonqcliMcp = class _AmazonqcliMcp extends ToolMcp {
|
|
|
2512
2590
|
validate = true
|
|
2513
2591
|
}) {
|
|
2514
2592
|
const fileContent = await readFileContent(
|
|
2515
|
-
|
|
2593
|
+
join25(
|
|
2516
2594
|
baseDir,
|
|
2517
2595
|
this.getSettablePaths().relativeDirPath,
|
|
2518
2596
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2548,7 +2626,7 @@ var AmazonqcliMcp = class _AmazonqcliMcp extends ToolMcp {
|
|
|
2548
2626
|
};
|
|
2549
2627
|
|
|
2550
2628
|
// src/mcp/claudecode-mcp.ts
|
|
2551
|
-
import { join as
|
|
2629
|
+
import { join as join26 } from "path";
|
|
2552
2630
|
var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
|
|
2553
2631
|
static getSettablePaths() {
|
|
2554
2632
|
return {
|
|
@@ -2561,7 +2639,7 @@ var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
|
|
|
2561
2639
|
validate = true
|
|
2562
2640
|
}) {
|
|
2563
2641
|
const fileContent = await readFileContent(
|
|
2564
|
-
|
|
2642
|
+
join26(
|
|
2565
2643
|
baseDir,
|
|
2566
2644
|
this.getSettablePaths().relativeDirPath,
|
|
2567
2645
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2597,7 +2675,7 @@ var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
|
|
|
2597
2675
|
};
|
|
2598
2676
|
|
|
2599
2677
|
// src/mcp/cline-mcp.ts
|
|
2600
|
-
import { join as
|
|
2678
|
+
import { join as join27 } from "path";
|
|
2601
2679
|
var ClineMcp = class _ClineMcp extends ToolMcp {
|
|
2602
2680
|
static getSettablePaths() {
|
|
2603
2681
|
return {
|
|
@@ -2610,7 +2688,7 @@ var ClineMcp = class _ClineMcp extends ToolMcp {
|
|
|
2610
2688
|
validate = true
|
|
2611
2689
|
}) {
|
|
2612
2690
|
const fileContent = await readFileContent(
|
|
2613
|
-
|
|
2691
|
+
join27(
|
|
2614
2692
|
baseDir,
|
|
2615
2693
|
this.getSettablePaths().relativeDirPath,
|
|
2616
2694
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2646,7 +2724,7 @@ var ClineMcp = class _ClineMcp extends ToolMcp {
|
|
|
2646
2724
|
};
|
|
2647
2725
|
|
|
2648
2726
|
// src/mcp/copilot-mcp.ts
|
|
2649
|
-
import { join as
|
|
2727
|
+
import { join as join28 } from "path";
|
|
2650
2728
|
var CopilotMcp = class _CopilotMcp extends ToolMcp {
|
|
2651
2729
|
static getSettablePaths() {
|
|
2652
2730
|
return {
|
|
@@ -2659,7 +2737,7 @@ var CopilotMcp = class _CopilotMcp extends ToolMcp {
|
|
|
2659
2737
|
validate = true
|
|
2660
2738
|
}) {
|
|
2661
2739
|
const fileContent = await readFileContent(
|
|
2662
|
-
|
|
2740
|
+
join28(
|
|
2663
2741
|
baseDir,
|
|
2664
2742
|
this.getSettablePaths().relativeDirPath,
|
|
2665
2743
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2695,7 +2773,7 @@ var CopilotMcp = class _CopilotMcp extends ToolMcp {
|
|
|
2695
2773
|
};
|
|
2696
2774
|
|
|
2697
2775
|
// src/mcp/cursor-mcp.ts
|
|
2698
|
-
import { join as
|
|
2776
|
+
import { join as join29 } from "path";
|
|
2699
2777
|
var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
2700
2778
|
static getSettablePaths() {
|
|
2701
2779
|
return {
|
|
@@ -2708,7 +2786,7 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
|
2708
2786
|
validate = true
|
|
2709
2787
|
}) {
|
|
2710
2788
|
const fileContent = await readFileContent(
|
|
2711
|
-
|
|
2789
|
+
join29(
|
|
2712
2790
|
baseDir,
|
|
2713
2791
|
this.getSettablePaths().relativeDirPath,
|
|
2714
2792
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2755,7 +2833,7 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
|
2755
2833
|
};
|
|
2756
2834
|
|
|
2757
2835
|
// src/mcp/roo-mcp.ts
|
|
2758
|
-
import { join as
|
|
2836
|
+
import { join as join30 } from "path";
|
|
2759
2837
|
var RooMcp = class _RooMcp extends ToolMcp {
|
|
2760
2838
|
static getSettablePaths() {
|
|
2761
2839
|
return {
|
|
@@ -2768,7 +2846,7 @@ var RooMcp = class _RooMcp extends ToolMcp {
|
|
|
2768
2846
|
validate = true
|
|
2769
2847
|
}) {
|
|
2770
2848
|
const fileContent = await readFileContent(
|
|
2771
|
-
|
|
2849
|
+
join30(
|
|
2772
2850
|
baseDir,
|
|
2773
2851
|
this.getSettablePaths().relativeDirPath,
|
|
2774
2852
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2975,12 +3053,12 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
2975
3053
|
};
|
|
2976
3054
|
|
|
2977
3055
|
// src/rules/rules-processor.ts
|
|
2978
|
-
import { basename as
|
|
3056
|
+
import { basename as basename17, join as join54 } from "path";
|
|
2979
3057
|
import { XMLBuilder } from "fast-xml-parser";
|
|
2980
3058
|
import { z as z20 } from "zod/mini";
|
|
2981
3059
|
|
|
2982
3060
|
// src/subagents/simulated-subagent.ts
|
|
2983
|
-
import { basename as
|
|
3061
|
+
import { basename as basename12, join as join31 } from "path";
|
|
2984
3062
|
import { z as z12 } from "zod/mini";
|
|
2985
3063
|
|
|
2986
3064
|
// src/subagents/tool-subagent.ts
|
|
@@ -3082,7 +3160,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
3082
3160
|
relativeFilePath,
|
|
3083
3161
|
validate = true
|
|
3084
3162
|
}) {
|
|
3085
|
-
const filePath =
|
|
3163
|
+
const filePath = join31(baseDir, this.getSettablePaths().relativeDirPath, relativeFilePath);
|
|
3086
3164
|
const fileContent = await readFileContent(filePath);
|
|
3087
3165
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
3088
3166
|
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -3092,7 +3170,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
3092
3170
|
return {
|
|
3093
3171
|
baseDir,
|
|
3094
3172
|
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
3095
|
-
relativeFilePath:
|
|
3173
|
+
relativeFilePath: basename12(relativeFilePath),
|
|
3096
3174
|
frontmatter: result.data,
|
|
3097
3175
|
body: content.trim(),
|
|
3098
3176
|
validate
|
|
@@ -3100,6 +3178,29 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
3100
3178
|
}
|
|
3101
3179
|
};
|
|
3102
3180
|
|
|
3181
|
+
// src/subagents/agentsmd-subagent.ts
|
|
3182
|
+
var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
|
|
3183
|
+
static getSettablePaths() {
|
|
3184
|
+
return {
|
|
3185
|
+
relativeDirPath: ".agents/subagents"
|
|
3186
|
+
};
|
|
3187
|
+
}
|
|
3188
|
+
static async fromFile(params) {
|
|
3189
|
+
const baseParams = await this.fromFileDefault(params);
|
|
3190
|
+
return new _AgentsmdSubagent(baseParams);
|
|
3191
|
+
}
|
|
3192
|
+
static fromRulesyncSubagent(params) {
|
|
3193
|
+
const baseParams = this.fromRulesyncSubagentDefault(params);
|
|
3194
|
+
return new _AgentsmdSubagent(baseParams);
|
|
3195
|
+
}
|
|
3196
|
+
static isTargetedByRulesyncSubagent(rulesyncSubagent) {
|
|
3197
|
+
return this.isTargetedByRulesyncSubagentDefault({
|
|
3198
|
+
rulesyncSubagent,
|
|
3199
|
+
toolTarget: "agentsmd"
|
|
3200
|
+
});
|
|
3201
|
+
}
|
|
3202
|
+
};
|
|
3203
|
+
|
|
3103
3204
|
// src/subagents/codexcli-subagent.ts
|
|
3104
3205
|
var CodexCliSubagent = class _CodexCliSubagent extends SimulatedSubagent {
|
|
3105
3206
|
static getSettablePaths() {
|
|
@@ -3216,15 +3317,15 @@ var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
|
3216
3317
|
};
|
|
3217
3318
|
|
|
3218
3319
|
// src/subagents/subagents-processor.ts
|
|
3219
|
-
import { basename as
|
|
3320
|
+
import { basename as basename14, join as join34 } from "path";
|
|
3220
3321
|
import { z as z15 } from "zod/mini";
|
|
3221
3322
|
|
|
3222
3323
|
// src/subagents/claudecode-subagent.ts
|
|
3223
|
-
import { join as
|
|
3324
|
+
import { join as join33 } from "path";
|
|
3224
3325
|
import { z as z14 } from "zod/mini";
|
|
3225
3326
|
|
|
3226
3327
|
// src/subagents/rulesync-subagent.ts
|
|
3227
|
-
import { basename as
|
|
3328
|
+
import { basename as basename13, join as join32 } from "path";
|
|
3228
3329
|
import { z as z13 } from "zod/mini";
|
|
3229
3330
|
var RulesyncSubagentModelSchema = z13.enum(["opus", "sonnet", "haiku", "inherit"]);
|
|
3230
3331
|
var RulesyncSubagentFrontmatterSchema = z13.object({
|
|
@@ -3278,13 +3379,13 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
3278
3379
|
static async fromFile({
|
|
3279
3380
|
relativeFilePath
|
|
3280
3381
|
}) {
|
|
3281
|
-
const fileContent = await readFileContent(
|
|
3382
|
+
const fileContent = await readFileContent(join32(".rulesync/subagents", relativeFilePath));
|
|
3282
3383
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
3283
3384
|
const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
3284
3385
|
if (!result.success) {
|
|
3285
3386
|
throw new Error(`Invalid frontmatter in ${relativeFilePath}: ${result.error.message}`);
|
|
3286
3387
|
}
|
|
3287
|
-
const filename =
|
|
3388
|
+
const filename = basename13(relativeFilePath);
|
|
3288
3389
|
return new _RulesyncSubagent({
|
|
3289
3390
|
baseDir: ".",
|
|
3290
3391
|
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
@@ -3396,7 +3497,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
3396
3497
|
relativeFilePath,
|
|
3397
3498
|
validate = true
|
|
3398
3499
|
}) {
|
|
3399
|
-
const fileContent = await readFileContent(
|
|
3500
|
+
const fileContent = await readFileContent(join33(baseDir, ".claude/agents", relativeFilePath));
|
|
3400
3501
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
3401
3502
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
3402
3503
|
if (!result.success) {
|
|
@@ -3416,6 +3517,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
3416
3517
|
|
|
3417
3518
|
// src/subagents/subagents-processor.ts
|
|
3418
3519
|
var subagentsProcessorToolTargets = [
|
|
3520
|
+
"agentsmd",
|
|
3419
3521
|
"claudecode",
|
|
3420
3522
|
"copilot",
|
|
3421
3523
|
"cursor",
|
|
@@ -3424,6 +3526,7 @@ var subagentsProcessorToolTargets = [
|
|
|
3424
3526
|
"roo"
|
|
3425
3527
|
];
|
|
3426
3528
|
var subagentsProcessorToolTargetsSimulated = [
|
|
3529
|
+
"agentsmd",
|
|
3427
3530
|
"copilot",
|
|
3428
3531
|
"cursor",
|
|
3429
3532
|
"codexcli",
|
|
@@ -3446,6 +3549,15 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
3446
3549
|
);
|
|
3447
3550
|
const toolSubagents = rulesyncSubagents.map((rulesyncSubagent) => {
|
|
3448
3551
|
switch (this.toolTarget) {
|
|
3552
|
+
case "agentsmd":
|
|
3553
|
+
if (!AgentsmdSubagent.isTargetedByRulesyncSubagent(rulesyncSubagent)) {
|
|
3554
|
+
return null;
|
|
3555
|
+
}
|
|
3556
|
+
return AgentsmdSubagent.fromRulesyncSubagent({
|
|
3557
|
+
baseDir: this.baseDir,
|
|
3558
|
+
relativeDirPath: RulesyncSubagent.getSettablePaths().relativeDirPath,
|
|
3559
|
+
rulesyncSubagent
|
|
3560
|
+
});
|
|
3449
3561
|
case "claudecode":
|
|
3450
3562
|
if (!ClaudecodeSubagent.isTargetedByRulesyncSubagent(rulesyncSubagent)) {
|
|
3451
3563
|
return null;
|
|
@@ -3527,7 +3639,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
3527
3639
|
* Load and parse rulesync subagent files from .rulesync/subagents/ directory
|
|
3528
3640
|
*/
|
|
3529
3641
|
async loadRulesyncFiles() {
|
|
3530
|
-
const subagentsDir =
|
|
3642
|
+
const subagentsDir = join34(this.baseDir, RulesyncSubagent.getSettablePaths().relativeDirPath);
|
|
3531
3643
|
const dirExists = await directoryExists(subagentsDir);
|
|
3532
3644
|
if (!dirExists) {
|
|
3533
3645
|
logger.debug(`Rulesync subagents directory not found: ${subagentsDir}`);
|
|
@@ -3542,7 +3654,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
3542
3654
|
logger.info(`Found ${mdFiles.length} subagent files in ${subagentsDir}`);
|
|
3543
3655
|
const rulesyncSubagents = [];
|
|
3544
3656
|
for (const mdFile of mdFiles) {
|
|
3545
|
-
const filepath =
|
|
3657
|
+
const filepath = join34(subagentsDir, mdFile);
|
|
3546
3658
|
try {
|
|
3547
3659
|
const rulesyncSubagent = await RulesyncSubagent.fromFile({
|
|
3548
3660
|
relativeFilePath: mdFile,
|
|
@@ -3568,6 +3680,8 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
3568
3680
|
*/
|
|
3569
3681
|
async loadToolFiles() {
|
|
3570
3682
|
switch (this.toolTarget) {
|
|
3683
|
+
case "agentsmd":
|
|
3684
|
+
return await this.loadAgentsmdSubagents();
|
|
3571
3685
|
case "claudecode":
|
|
3572
3686
|
return await this.loadClaudecodeSubagents();
|
|
3573
3687
|
case "copilot":
|
|
@@ -3587,6 +3701,15 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
3587
3701
|
async loadToolFilesToDelete() {
|
|
3588
3702
|
return this.loadToolFiles();
|
|
3589
3703
|
}
|
|
3704
|
+
/**
|
|
3705
|
+
* Load Agents.md subagent configurations from .agents/subagents/ directory
|
|
3706
|
+
*/
|
|
3707
|
+
async loadAgentsmdSubagents() {
|
|
3708
|
+
return await this.loadToolSubagentsDefault({
|
|
3709
|
+
relativeDirPath: AgentsmdSubagent.getSettablePaths().relativeDirPath,
|
|
3710
|
+
fromFile: (relativeFilePath) => AgentsmdSubagent.fromFile({ relativeFilePath })
|
|
3711
|
+
});
|
|
3712
|
+
}
|
|
3590
3713
|
/**
|
|
3591
3714
|
* Load Claude Code subagent configurations from .claude/agents/ directory
|
|
3592
3715
|
*/
|
|
@@ -3645,8 +3768,8 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
3645
3768
|
relativeDirPath,
|
|
3646
3769
|
fromFile
|
|
3647
3770
|
}) {
|
|
3648
|
-
const paths = await findFilesByGlobs(
|
|
3649
|
-
const subagents = (await Promise.allSettled(paths.map((path2) => fromFile(
|
|
3771
|
+
const paths = await findFilesByGlobs(join34(this.baseDir, relativeDirPath, "*.md"));
|
|
3772
|
+
const subagents = (await Promise.allSettled(paths.map((path2) => fromFile(basename14(path2))))).filter((r) => r.status === "fulfilled").map((r) => r.value);
|
|
3650
3773
|
logger.info(`Successfully loaded ${subagents.length} ${relativeDirPath} subagents`);
|
|
3651
3774
|
return subagents;
|
|
3652
3775
|
}
|
|
@@ -3670,13 +3793,13 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
3670
3793
|
};
|
|
3671
3794
|
|
|
3672
3795
|
// src/rules/agentsmd-rule.ts
|
|
3673
|
-
import { join as
|
|
3796
|
+
import { join as join37 } from "path";
|
|
3674
3797
|
|
|
3675
3798
|
// src/rules/tool-rule.ts
|
|
3676
|
-
import { join as
|
|
3799
|
+
import { join as join36 } from "path";
|
|
3677
3800
|
|
|
3678
3801
|
// src/rules/rulesync-rule.ts
|
|
3679
|
-
import { basename as
|
|
3802
|
+
import { basename as basename15, join as join35 } from "path";
|
|
3680
3803
|
import { z as z16 } from "zod/mini";
|
|
3681
3804
|
var RulesyncRuleFrontmatterSchema = z16.object({
|
|
3682
3805
|
root: z16.optional(z16.optional(z16.boolean())),
|
|
@@ -3742,7 +3865,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
3742
3865
|
relativeFilePath,
|
|
3743
3866
|
validate = true
|
|
3744
3867
|
}) {
|
|
3745
|
-
const filePath =
|
|
3868
|
+
const filePath = join35(this.getSettablePaths().legacy.relativeDirPath, relativeFilePath);
|
|
3746
3869
|
const fileContent = await readFileContent(filePath);
|
|
3747
3870
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
3748
3871
|
const result = RulesyncRuleFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -3757,7 +3880,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
3757
3880
|
agentsmd: result.data.agentsmd,
|
|
3758
3881
|
cursor: result.data.cursor
|
|
3759
3882
|
};
|
|
3760
|
-
const filename =
|
|
3883
|
+
const filename = basename15(filePath);
|
|
3761
3884
|
return new _RulesyncRule({
|
|
3762
3885
|
baseDir: ".",
|
|
3763
3886
|
relativeDirPath: this.getSettablePaths().recommended.relativeDirPath,
|
|
@@ -3771,7 +3894,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
3771
3894
|
relativeFilePath,
|
|
3772
3895
|
validate = true
|
|
3773
3896
|
}) {
|
|
3774
|
-
const filePath =
|
|
3897
|
+
const filePath = join35(this.getSettablePaths().recommended.relativeDirPath, relativeFilePath);
|
|
3775
3898
|
const fileContent = await readFileContent(filePath);
|
|
3776
3899
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
3777
3900
|
const result = RulesyncRuleFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -3786,7 +3909,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
3786
3909
|
agentsmd: result.data.agentsmd,
|
|
3787
3910
|
cursor: result.data.cursor
|
|
3788
3911
|
};
|
|
3789
|
-
const filename =
|
|
3912
|
+
const filename = basename15(filePath);
|
|
3790
3913
|
return new _RulesyncRule({
|
|
3791
3914
|
baseDir: ".",
|
|
3792
3915
|
relativeDirPath: this.getSettablePaths().recommended.relativeDirPath,
|
|
@@ -3875,7 +3998,7 @@ var ToolRule = class extends ToolFile {
|
|
|
3875
3998
|
});
|
|
3876
3999
|
const rulesyncFrontmatter = rulesyncRule.getFrontmatter();
|
|
3877
4000
|
if (!rulesyncFrontmatter.root && rulesyncFrontmatter.agentsmd?.subprojectPath) {
|
|
3878
|
-
params.relativeDirPath =
|
|
4001
|
+
params.relativeDirPath = join36(rulesyncFrontmatter.agentsmd.subprojectPath);
|
|
3879
4002
|
params.relativeFilePath = "AGENTS.md";
|
|
3880
4003
|
}
|
|
3881
4004
|
return params;
|
|
@@ -3951,8 +4074,8 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
3951
4074
|
validate = true
|
|
3952
4075
|
}) {
|
|
3953
4076
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
3954
|
-
const relativePath = isRoot ? "AGENTS.md" :
|
|
3955
|
-
const fileContent = await readFileContent(
|
|
4077
|
+
const relativePath = isRoot ? "AGENTS.md" : join37(".agents/memories", relativeFilePath);
|
|
4078
|
+
const fileContent = await readFileContent(join37(baseDir, relativePath));
|
|
3956
4079
|
return new _AgentsMdRule({
|
|
3957
4080
|
baseDir,
|
|
3958
4081
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -3992,7 +4115,7 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
3992
4115
|
};
|
|
3993
4116
|
|
|
3994
4117
|
// src/rules/amazonqcli-rule.ts
|
|
3995
|
-
import { join as
|
|
4118
|
+
import { join as join38 } from "path";
|
|
3996
4119
|
var AmazonQCliRule = class _AmazonQCliRule extends ToolRule {
|
|
3997
4120
|
static getSettablePaths() {
|
|
3998
4121
|
return {
|
|
@@ -4007,7 +4130,7 @@ var AmazonQCliRule = class _AmazonQCliRule extends ToolRule {
|
|
|
4007
4130
|
validate = true
|
|
4008
4131
|
}) {
|
|
4009
4132
|
const fileContent = await readFileContent(
|
|
4010
|
-
|
|
4133
|
+
join38(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
4011
4134
|
);
|
|
4012
4135
|
return new _AmazonQCliRule({
|
|
4013
4136
|
baseDir,
|
|
@@ -4047,7 +4170,7 @@ var AmazonQCliRule = class _AmazonQCliRule extends ToolRule {
|
|
|
4047
4170
|
};
|
|
4048
4171
|
|
|
4049
4172
|
// src/rules/augmentcode-legacy-rule.ts
|
|
4050
|
-
import { join as
|
|
4173
|
+
import { join as join39 } from "path";
|
|
4051
4174
|
var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
4052
4175
|
toRulesyncRule() {
|
|
4053
4176
|
const rulesyncFrontmatter = {
|
|
@@ -4108,8 +4231,8 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
4108
4231
|
}) {
|
|
4109
4232
|
const settablePaths = this.getSettablePaths();
|
|
4110
4233
|
const isRoot = relativeFilePath === settablePaths.root.relativeFilePath;
|
|
4111
|
-
const relativePath = isRoot ? settablePaths.root.relativeFilePath :
|
|
4112
|
-
const fileContent = await readFileContent(
|
|
4234
|
+
const relativePath = isRoot ? settablePaths.root.relativeFilePath : join39(settablePaths.nonRoot.relativeDirPath, relativeFilePath);
|
|
4235
|
+
const fileContent = await readFileContent(join39(baseDir, relativePath));
|
|
4113
4236
|
return new _AugmentcodeLegacyRule({
|
|
4114
4237
|
baseDir,
|
|
4115
4238
|
relativeDirPath: isRoot ? settablePaths.root.relativeDirPath : settablePaths.nonRoot.relativeDirPath,
|
|
@@ -4122,7 +4245,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
4122
4245
|
};
|
|
4123
4246
|
|
|
4124
4247
|
// src/rules/augmentcode-rule.ts
|
|
4125
|
-
import { join as
|
|
4248
|
+
import { join as join40 } from "path";
|
|
4126
4249
|
var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
4127
4250
|
toRulesyncRule() {
|
|
4128
4251
|
return this.toRulesyncRuleDefault();
|
|
@@ -4154,7 +4277,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
4154
4277
|
validate = true
|
|
4155
4278
|
}) {
|
|
4156
4279
|
const fileContent = await readFileContent(
|
|
4157
|
-
|
|
4280
|
+
join40(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
4158
4281
|
);
|
|
4159
4282
|
const { body: content } = parseFrontmatter(fileContent);
|
|
4160
4283
|
return new _AugmentcodeRule({
|
|
@@ -4177,7 +4300,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
4177
4300
|
};
|
|
4178
4301
|
|
|
4179
4302
|
// src/rules/claudecode-rule.ts
|
|
4180
|
-
import { join as
|
|
4303
|
+
import { join as join41 } from "path";
|
|
4181
4304
|
var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
4182
4305
|
static getSettablePaths() {
|
|
4183
4306
|
return {
|
|
@@ -4186,7 +4309,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
4186
4309
|
relativeFilePath: "CLAUDE.md"
|
|
4187
4310
|
},
|
|
4188
4311
|
nonRoot: {
|
|
4189
|
-
relativeDirPath:
|
|
4312
|
+
relativeDirPath: join41(".claude", "memories")
|
|
4190
4313
|
}
|
|
4191
4314
|
};
|
|
4192
4315
|
}
|
|
@@ -4209,7 +4332,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
4209
4332
|
if (isRoot) {
|
|
4210
4333
|
const relativePath2 = paths.root.relativeFilePath;
|
|
4211
4334
|
const fileContent2 = await readFileContent(
|
|
4212
|
-
|
|
4335
|
+
join41(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
4213
4336
|
);
|
|
4214
4337
|
return new _ClaudecodeRule({
|
|
4215
4338
|
baseDir,
|
|
@@ -4223,8 +4346,8 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
4223
4346
|
if (!paths.nonRoot) {
|
|
4224
4347
|
throw new Error("nonRoot path is not set");
|
|
4225
4348
|
}
|
|
4226
|
-
const relativePath =
|
|
4227
|
-
const fileContent = await readFileContent(
|
|
4349
|
+
const relativePath = join41(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
4350
|
+
const fileContent = await readFileContent(join41(baseDir, relativePath));
|
|
4228
4351
|
return new _ClaudecodeRule({
|
|
4229
4352
|
baseDir,
|
|
4230
4353
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -4266,7 +4389,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
4266
4389
|
};
|
|
4267
4390
|
|
|
4268
4391
|
// src/rules/cline-rule.ts
|
|
4269
|
-
import { join as
|
|
4392
|
+
import { join as join42 } from "path";
|
|
4270
4393
|
import { z as z17 } from "zod/mini";
|
|
4271
4394
|
var ClineRuleFrontmatterSchema = z17.object({
|
|
4272
4395
|
description: z17.string()
|
|
@@ -4311,7 +4434,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
4311
4434
|
validate = true
|
|
4312
4435
|
}) {
|
|
4313
4436
|
const fileContent = await readFileContent(
|
|
4314
|
-
|
|
4437
|
+
join42(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
4315
4438
|
);
|
|
4316
4439
|
return new _ClineRule({
|
|
4317
4440
|
baseDir,
|
|
@@ -4324,7 +4447,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
4324
4447
|
};
|
|
4325
4448
|
|
|
4326
4449
|
// src/rules/codexcli-rule.ts
|
|
4327
|
-
import { join as
|
|
4450
|
+
import { join as join43 } from "path";
|
|
4328
4451
|
var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
4329
4452
|
static getSettablePaths() {
|
|
4330
4453
|
return {
|
|
@@ -4356,7 +4479,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
4356
4479
|
if (isRoot) {
|
|
4357
4480
|
const relativePath2 = paths.root.relativeFilePath;
|
|
4358
4481
|
const fileContent2 = await readFileContent(
|
|
4359
|
-
|
|
4482
|
+
join43(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
4360
4483
|
);
|
|
4361
4484
|
return new _CodexcliRule({
|
|
4362
4485
|
baseDir,
|
|
@@ -4370,8 +4493,8 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
4370
4493
|
if (!paths.nonRoot) {
|
|
4371
4494
|
throw new Error("nonRoot path is not set");
|
|
4372
4495
|
}
|
|
4373
|
-
const relativePath =
|
|
4374
|
-
const fileContent = await readFileContent(
|
|
4496
|
+
const relativePath = join43(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
4497
|
+
const fileContent = await readFileContent(join43(baseDir, relativePath));
|
|
4375
4498
|
return new _CodexcliRule({
|
|
4376
4499
|
baseDir,
|
|
4377
4500
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -4413,7 +4536,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
4413
4536
|
};
|
|
4414
4537
|
|
|
4415
4538
|
// src/rules/copilot-rule.ts
|
|
4416
|
-
import { join as
|
|
4539
|
+
import { join as join44 } from "path";
|
|
4417
4540
|
import { z as z18 } from "zod/mini";
|
|
4418
4541
|
var CopilotRuleFrontmatterSchema = z18.object({
|
|
4419
4542
|
description: z18.optional(z18.string()),
|
|
@@ -4506,11 +4629,11 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
4506
4629
|
validate = true
|
|
4507
4630
|
}) {
|
|
4508
4631
|
const isRoot = relativeFilePath === "copilot-instructions.md";
|
|
4509
|
-
const relativePath = isRoot ?
|
|
4632
|
+
const relativePath = isRoot ? join44(
|
|
4510
4633
|
this.getSettablePaths().root.relativeDirPath,
|
|
4511
4634
|
this.getSettablePaths().root.relativeFilePath
|
|
4512
|
-
) :
|
|
4513
|
-
const fileContent = await readFileContent(
|
|
4635
|
+
) : join44(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
4636
|
+
const fileContent = await readFileContent(join44(baseDir, relativePath));
|
|
4514
4637
|
if (isRoot) {
|
|
4515
4638
|
return new _CopilotRule({
|
|
4516
4639
|
baseDir,
|
|
@@ -4529,7 +4652,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
4529
4652
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
4530
4653
|
if (!result.success) {
|
|
4531
4654
|
throw new Error(
|
|
4532
|
-
`Invalid frontmatter in ${
|
|
4655
|
+
`Invalid frontmatter in ${join44(baseDir, relativeFilePath)}: ${result.error.message}`
|
|
4533
4656
|
);
|
|
4534
4657
|
}
|
|
4535
4658
|
return new _CopilotRule({
|
|
@@ -4568,7 +4691,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
4568
4691
|
};
|
|
4569
4692
|
|
|
4570
4693
|
// src/rules/cursor-rule.ts
|
|
4571
|
-
import { basename as
|
|
4694
|
+
import { basename as basename16, join as join45 } from "path";
|
|
4572
4695
|
import { z as z19 } from "zod/mini";
|
|
4573
4696
|
var CursorRuleFrontmatterSchema = z19.object({
|
|
4574
4697
|
description: z19.optional(z19.string()),
|
|
@@ -4695,19 +4818,19 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
4695
4818
|
validate = true
|
|
4696
4819
|
}) {
|
|
4697
4820
|
const fileContent = await readFileContent(
|
|
4698
|
-
|
|
4821
|
+
join45(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
4699
4822
|
);
|
|
4700
4823
|
const { frontmatter, body: content } = _CursorRule.parseCursorFrontmatter(fileContent);
|
|
4701
4824
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
4702
4825
|
if (!result.success) {
|
|
4703
4826
|
throw new Error(
|
|
4704
|
-
`Invalid frontmatter in ${
|
|
4827
|
+
`Invalid frontmatter in ${join45(baseDir, relativeFilePath)}: ${result.error.message}`
|
|
4705
4828
|
);
|
|
4706
4829
|
}
|
|
4707
4830
|
return new _CursorRule({
|
|
4708
4831
|
baseDir,
|
|
4709
4832
|
relativeDirPath: this.getSettablePaths().nonRoot.relativeDirPath,
|
|
4710
|
-
relativeFilePath:
|
|
4833
|
+
relativeFilePath: basename16(relativeFilePath),
|
|
4711
4834
|
frontmatter: result.data,
|
|
4712
4835
|
body: content.trim(),
|
|
4713
4836
|
validate
|
|
@@ -4739,7 +4862,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
4739
4862
|
};
|
|
4740
4863
|
|
|
4741
4864
|
// src/rules/geminicli-rule.ts
|
|
4742
|
-
import { join as
|
|
4865
|
+
import { join as join46 } from "path";
|
|
4743
4866
|
var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
4744
4867
|
static getSettablePaths() {
|
|
4745
4868
|
return {
|
|
@@ -4771,7 +4894,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
4771
4894
|
if (isRoot) {
|
|
4772
4895
|
const relativePath2 = paths.root.relativeFilePath;
|
|
4773
4896
|
const fileContent2 = await readFileContent(
|
|
4774
|
-
|
|
4897
|
+
join46(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
4775
4898
|
);
|
|
4776
4899
|
return new _GeminiCliRule({
|
|
4777
4900
|
baseDir,
|
|
@@ -4785,8 +4908,8 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
4785
4908
|
if (!paths.nonRoot) {
|
|
4786
4909
|
throw new Error("nonRoot path is not set");
|
|
4787
4910
|
}
|
|
4788
|
-
const relativePath =
|
|
4789
|
-
const fileContent = await readFileContent(
|
|
4911
|
+
const relativePath = join46(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
4912
|
+
const fileContent = await readFileContent(join46(baseDir, relativePath));
|
|
4790
4913
|
return new _GeminiCliRule({
|
|
4791
4914
|
baseDir,
|
|
4792
4915
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -4828,7 +4951,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
4828
4951
|
};
|
|
4829
4952
|
|
|
4830
4953
|
// src/rules/junie-rule.ts
|
|
4831
|
-
import { join as
|
|
4954
|
+
import { join as join47 } from "path";
|
|
4832
4955
|
var JunieRule = class _JunieRule extends ToolRule {
|
|
4833
4956
|
static getSettablePaths() {
|
|
4834
4957
|
return {
|
|
@@ -4847,8 +4970,8 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
4847
4970
|
validate = true
|
|
4848
4971
|
}) {
|
|
4849
4972
|
const isRoot = relativeFilePath === "guidelines.md";
|
|
4850
|
-
const relativePath = isRoot ? "guidelines.md" :
|
|
4851
|
-
const fileContent = await readFileContent(
|
|
4973
|
+
const relativePath = isRoot ? "guidelines.md" : join47(".junie/memories", relativeFilePath);
|
|
4974
|
+
const fileContent = await readFileContent(join47(baseDir, relativePath));
|
|
4852
4975
|
return new _JunieRule({
|
|
4853
4976
|
baseDir,
|
|
4854
4977
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -4888,7 +5011,7 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
4888
5011
|
};
|
|
4889
5012
|
|
|
4890
5013
|
// src/rules/kiro-rule.ts
|
|
4891
|
-
import { join as
|
|
5014
|
+
import { join as join48 } from "path";
|
|
4892
5015
|
var KiroRule = class _KiroRule extends ToolRule {
|
|
4893
5016
|
static getSettablePaths() {
|
|
4894
5017
|
return {
|
|
@@ -4903,7 +5026,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
4903
5026
|
validate = true
|
|
4904
5027
|
}) {
|
|
4905
5028
|
const fileContent = await readFileContent(
|
|
4906
|
-
|
|
5029
|
+
join48(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
4907
5030
|
);
|
|
4908
5031
|
return new _KiroRule({
|
|
4909
5032
|
baseDir,
|
|
@@ -4943,7 +5066,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
4943
5066
|
};
|
|
4944
5067
|
|
|
4945
5068
|
// src/rules/opencode-rule.ts
|
|
4946
|
-
import { join as
|
|
5069
|
+
import { join as join49 } from "path";
|
|
4947
5070
|
var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
4948
5071
|
static getSettablePaths() {
|
|
4949
5072
|
return {
|
|
@@ -4962,8 +5085,8 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
4962
5085
|
validate = true
|
|
4963
5086
|
}) {
|
|
4964
5087
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
4965
|
-
const relativePath = isRoot ? "AGENTS.md" :
|
|
4966
|
-
const fileContent = await readFileContent(
|
|
5088
|
+
const relativePath = isRoot ? "AGENTS.md" : join49(".opencode/memories", relativeFilePath);
|
|
5089
|
+
const fileContent = await readFileContent(join49(baseDir, relativePath));
|
|
4967
5090
|
return new _OpenCodeRule({
|
|
4968
5091
|
baseDir,
|
|
4969
5092
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -5003,7 +5126,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
5003
5126
|
};
|
|
5004
5127
|
|
|
5005
5128
|
// src/rules/qwencode-rule.ts
|
|
5006
|
-
import { join as
|
|
5129
|
+
import { join as join50 } from "path";
|
|
5007
5130
|
var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
5008
5131
|
static getSettablePaths() {
|
|
5009
5132
|
return {
|
|
@@ -5022,8 +5145,8 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
5022
5145
|
validate = true
|
|
5023
5146
|
}) {
|
|
5024
5147
|
const isRoot = relativeFilePath === "QWEN.md";
|
|
5025
|
-
const relativePath = isRoot ? "QWEN.md" :
|
|
5026
|
-
const fileContent = await readFileContent(
|
|
5148
|
+
const relativePath = isRoot ? "QWEN.md" : join50(".qwen/memories", relativeFilePath);
|
|
5149
|
+
const fileContent = await readFileContent(join50(baseDir, relativePath));
|
|
5027
5150
|
return new _QwencodeRule({
|
|
5028
5151
|
baseDir,
|
|
5029
5152
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -5060,7 +5183,7 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
5060
5183
|
};
|
|
5061
5184
|
|
|
5062
5185
|
// src/rules/roo-rule.ts
|
|
5063
|
-
import { join as
|
|
5186
|
+
import { join as join51 } from "path";
|
|
5064
5187
|
var RooRule = class _RooRule extends ToolRule {
|
|
5065
5188
|
static getSettablePaths() {
|
|
5066
5189
|
return {
|
|
@@ -5075,7 +5198,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
5075
5198
|
validate = true
|
|
5076
5199
|
}) {
|
|
5077
5200
|
const fileContent = await readFileContent(
|
|
5078
|
-
|
|
5201
|
+
join51(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
5079
5202
|
);
|
|
5080
5203
|
return new _RooRule({
|
|
5081
5204
|
baseDir,
|
|
@@ -5130,7 +5253,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
5130
5253
|
};
|
|
5131
5254
|
|
|
5132
5255
|
// src/rules/warp-rule.ts
|
|
5133
|
-
import { join as
|
|
5256
|
+
import { join as join52 } from "path";
|
|
5134
5257
|
var WarpRule = class _WarpRule extends ToolRule {
|
|
5135
5258
|
constructor({ fileContent, root, ...rest }) {
|
|
5136
5259
|
super({
|
|
@@ -5156,8 +5279,8 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
5156
5279
|
validate = true
|
|
5157
5280
|
}) {
|
|
5158
5281
|
const isRoot = relativeFilePath === this.getSettablePaths().root.relativeFilePath;
|
|
5159
|
-
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath :
|
|
5160
|
-
const fileContent = await readFileContent(
|
|
5282
|
+
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : join52(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
5283
|
+
const fileContent = await readFileContent(join52(baseDir, relativePath));
|
|
5161
5284
|
return new _WarpRule({
|
|
5162
5285
|
baseDir,
|
|
5163
5286
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : ".warp",
|
|
@@ -5197,7 +5320,7 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
5197
5320
|
};
|
|
5198
5321
|
|
|
5199
5322
|
// src/rules/windsurf-rule.ts
|
|
5200
|
-
import { join as
|
|
5323
|
+
import { join as join53 } from "path";
|
|
5201
5324
|
var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
5202
5325
|
static getSettablePaths() {
|
|
5203
5326
|
return {
|
|
@@ -5212,7 +5335,7 @@ var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
|
5212
5335
|
validate = true
|
|
5213
5336
|
}) {
|
|
5214
5337
|
const fileContent = await readFileContent(
|
|
5215
|
-
|
|
5338
|
+
join53(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
5216
5339
|
);
|
|
5217
5340
|
return new _WindsurfRule({
|
|
5218
5341
|
baseDir,
|
|
@@ -5504,7 +5627,12 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
5504
5627
|
case "agentsmd": {
|
|
5505
5628
|
const rootRule = toolRules[rootRuleIndex];
|
|
5506
5629
|
rootRule?.setFileContent(
|
|
5507
|
-
this.generateXmlReferencesSection(toolRules) +
|
|
5630
|
+
this.generateXmlReferencesSection(toolRules) + this.generateAdditionalConventionsSection({
|
|
5631
|
+
commands: { relativeDirPath: AgentsmdCommand.getSettablePaths().relativeDirPath },
|
|
5632
|
+
subagents: {
|
|
5633
|
+
relativeDirPath: AgentsmdSubagent.getSettablePaths().relativeDirPath
|
|
5634
|
+
}
|
|
5635
|
+
}) + rootRule.getFileContent()
|
|
5508
5636
|
);
|
|
5509
5637
|
return toolRules;
|
|
5510
5638
|
}
|
|
@@ -5601,10 +5729,10 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
5601
5729
|
* Load and parse rulesync rule files from .rulesync/rules/ directory
|
|
5602
5730
|
*/
|
|
5603
5731
|
async loadRulesyncFiles() {
|
|
5604
|
-
const files = await findFilesByGlobs(
|
|
5732
|
+
const files = await findFilesByGlobs(join54(".rulesync/rules", "*.md"));
|
|
5605
5733
|
logger.debug(`Found ${files.length} rulesync files`);
|
|
5606
5734
|
const rulesyncRules = await Promise.all(
|
|
5607
|
-
files.map((file) => RulesyncRule.fromFile({ relativeFilePath:
|
|
5735
|
+
files.map((file) => RulesyncRule.fromFile({ relativeFilePath: basename17(file) }))
|
|
5608
5736
|
);
|
|
5609
5737
|
const rootRules = rulesyncRules.filter((rule) => rule.getFrontmatter().root);
|
|
5610
5738
|
if (rootRules.length > 1) {
|
|
@@ -5622,10 +5750,10 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
5622
5750
|
return rulesyncRules;
|
|
5623
5751
|
}
|
|
5624
5752
|
async loadRulesyncFilesLegacy() {
|
|
5625
|
-
const legacyFiles = await findFilesByGlobs(
|
|
5753
|
+
const legacyFiles = await findFilesByGlobs(join54(".rulesync", "*.md"));
|
|
5626
5754
|
logger.debug(`Found ${legacyFiles.length} legacy rulesync files`);
|
|
5627
5755
|
return Promise.all(
|
|
5628
|
-
legacyFiles.map((file) => RulesyncRule.fromFileLegacy({ relativeFilePath:
|
|
5756
|
+
legacyFiles.map((file) => RulesyncRule.fromFileLegacy({ relativeFilePath: basename17(file) }))
|
|
5629
5757
|
);
|
|
5630
5758
|
}
|
|
5631
5759
|
/**
|
|
@@ -5689,13 +5817,13 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
5689
5817
|
return [];
|
|
5690
5818
|
}
|
|
5691
5819
|
const rootFilePaths = await findFilesByGlobs(
|
|
5692
|
-
|
|
5820
|
+
join54(this.baseDir, root.relativeDirPath ?? ".", root.relativeFilePath)
|
|
5693
5821
|
);
|
|
5694
5822
|
return await Promise.all(
|
|
5695
5823
|
rootFilePaths.map(
|
|
5696
5824
|
(filePath) => root.fromFile({
|
|
5697
5825
|
baseDir: this.baseDir,
|
|
5698
|
-
relativeFilePath:
|
|
5826
|
+
relativeFilePath: basename17(filePath),
|
|
5699
5827
|
global: this.global
|
|
5700
5828
|
})
|
|
5701
5829
|
)
|
|
@@ -5707,13 +5835,13 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
5707
5835
|
return [];
|
|
5708
5836
|
}
|
|
5709
5837
|
const nonRootFilePaths = await findFilesByGlobs(
|
|
5710
|
-
|
|
5838
|
+
join54(this.baseDir, nonRoot.relativeDirPath, `*.${nonRoot.extension}`)
|
|
5711
5839
|
);
|
|
5712
5840
|
return await Promise.all(
|
|
5713
5841
|
nonRootFilePaths.map(
|
|
5714
5842
|
(filePath) => nonRoot.fromFile({
|
|
5715
5843
|
baseDir: this.baseDir,
|
|
5716
|
-
relativeFilePath:
|
|
5844
|
+
relativeFilePath: basename17(filePath),
|
|
5717
5845
|
global: this.global
|
|
5718
5846
|
})
|
|
5719
5847
|
)
|
|
@@ -6083,14 +6211,14 @@ s/<command> [arguments]
|
|
|
6083
6211
|
This syntax employs a double slash (\`s/\`) to prevent conflicts with built-in slash commands.
|
|
6084
6212
|
The \`s\` in \`s/\` stands for *simulate*. Because custom slash commands are not built-in, this syntax provides a pseudo way to invoke them.
|
|
6085
6213
|
|
|
6086
|
-
When users call a custom slash command, you have to look for the markdown file, \`${
|
|
6214
|
+
When users call a custom slash command, you have to look for the markdown file, \`${join54(commands.relativeDirPath, "{command}.md")}\`, then execute the contents of that file as the block of operations.` : "";
|
|
6087
6215
|
const subagentsSection = subagents ? `## Simulated Subagents
|
|
6088
6216
|
|
|
6089
6217
|
Simulated subagents are specialized AI assistants that can be invoked to handle specific types of tasks. In this case, it can be appear something like custom slash commands simply. Simulated subagents can be called by custom slash commands.
|
|
6090
6218
|
|
|
6091
|
-
When users call a simulated subagent, it will look for the corresponding markdown file, \`${
|
|
6219
|
+
When users call a simulated subagent, it will look for the corresponding markdown file, \`${join54(subagents.relativeDirPath, "{subagent}.md")}\`, and execute its contents as the block of operations.
|
|
6092
6220
|
|
|
6093
|
-
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${
|
|
6221
|
+
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${join54(subagents.relativeDirPath, "planner.md")}\`, and execute its contents as the block of operations.` : "";
|
|
6094
6222
|
const result = [
|
|
6095
6223
|
overview,
|
|
6096
6224
|
...this.simulateCommands && CommandsProcessor.getToolTargetsSimulated().includes(this.toolTarget) ? [commandsSection] : [],
|
|
@@ -6315,9 +6443,9 @@ async function generateSubagents(config) {
|
|
|
6315
6443
|
}
|
|
6316
6444
|
|
|
6317
6445
|
// src/cli/commands/gitignore.ts
|
|
6318
|
-
import { join as
|
|
6446
|
+
import { join as join55 } from "path";
|
|
6319
6447
|
var gitignoreCommand = async () => {
|
|
6320
|
-
const gitignorePath =
|
|
6448
|
+
const gitignorePath = join55(process.cwd(), ".gitignore");
|
|
6321
6449
|
const rulesFilesToIgnore = [
|
|
6322
6450
|
"# Generated by rulesync - AI tool configuration files",
|
|
6323
6451
|
"**/.amazonq/",
|
|
@@ -6554,7 +6682,7 @@ async function importSubagents(config, tool) {
|
|
|
6554
6682
|
}
|
|
6555
6683
|
|
|
6556
6684
|
// src/cli/commands/init.ts
|
|
6557
|
-
import { join as
|
|
6685
|
+
import { join as join56 } from "path";
|
|
6558
6686
|
async function initCommand() {
|
|
6559
6687
|
logger.info("Initializing rulesync...");
|
|
6560
6688
|
await ensureDir(".rulesync");
|
|
@@ -6625,7 +6753,7 @@ globs: ["**/*"]
|
|
|
6625
6753
|
- Follow single responsibility principle
|
|
6626
6754
|
`
|
|
6627
6755
|
};
|
|
6628
|
-
const filepath =
|
|
6756
|
+
const filepath = join56(".rulesync/rules", sampleFile.filename);
|
|
6629
6757
|
await ensureDir(".rulesync/rules");
|
|
6630
6758
|
await ensureDir(RulesyncCommand.getSettablePaths().relativeDirPath);
|
|
6631
6759
|
await ensureDir(".rulesync/subagents");
|
|
@@ -6638,7 +6766,7 @@ globs: ["**/*"]
|
|
|
6638
6766
|
}
|
|
6639
6767
|
|
|
6640
6768
|
// src/cli/index.ts
|
|
6641
|
-
var getVersion = () => "3.
|
|
6769
|
+
var getVersion = () => "3.1.0";
|
|
6642
6770
|
var main = async () => {
|
|
6643
6771
|
const program = new Command();
|
|
6644
6772
|
const version = getVersion();
|