compose-agentsmd 3.2.1 → 3.2.3

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.
@@ -506,12 +506,27 @@ const resolveRulesRoot = (rulesetDir, source, refresh) => {
506
506
  }
507
507
  return { rulesRoot: resolveLocalRulesRoot(rulesetDir, source) };
508
508
  };
509
+ const formatRuleSourcePath = (rulePath, rulesRoot, rulesetDir, source, resolvedRef) => {
510
+ // Check if this rule is from the resolved rulesRoot (GitHub or local source)
511
+ const isFromSource = rulePath.startsWith(rulesRoot);
512
+ if (isFromSource && source.startsWith("github:")) {
513
+ // GitHub source rule
514
+ const parsed = parseGithubSource(source);
515
+ const cacheRepoRoot = path.dirname(rulesRoot);
516
+ const relativePath = normalizePath(path.relative(cacheRepoRoot, rulePath));
517
+ const refToUse = resolvedRef ?? parsed.ref;
518
+ return `github:${parsed.owner}/${parsed.repo}@${refToUse}/${relativePath}`;
519
+ }
520
+ // For local rules (either from local source or extra), use path relative to project root
521
+ const result = normalizePath(path.relative(rulesetDir, rulePath));
522
+ return result;
523
+ };
509
524
  const composeRuleset = (rulesetPath, rootDir, options) => {
510
525
  const rulesetDir = path.dirname(rulesetPath);
511
526
  const projectRuleset = readProjectRuleset(rulesetPath);
512
527
  const outputFileName = projectRuleset.output ?? DEFAULT_OUTPUT;
513
528
  const outputPath = resolveFrom(rulesetDir, outputFileName);
514
- const { rulesRoot } = resolveRulesRoot(rulesetDir, projectRuleset.source, options.refresh ?? false);
529
+ const { rulesRoot, resolvedRef } = resolveRulesRoot(rulesetDir, projectRuleset.source, options.refresh ?? false);
515
530
  const globalRoot = path.join(rulesRoot, "global");
516
531
  const domainsRoot = path.join(rulesRoot, "domains");
517
532
  const resolvedRules = [];
@@ -529,7 +544,8 @@ const composeRuleset = (rulesetPath, rootDir, options) => {
529
544
  addRulePaths(directRulePaths, resolvedRules, seenRules);
530
545
  const parts = resolvedRules.map((rulePath) => {
531
546
  const body = normalizeTrailingWhitespace(fs.readFileSync(rulePath, "utf8"));
532
- return `Source: ${normalizePath(rulePath)}\n\n${body}`;
547
+ const sourcePath = formatRuleSourcePath(rulePath, rulesRoot, rulesetDir, projectRuleset.source, resolvedRef);
548
+ return `Source: ${sourcePath}\n\n${body}`;
533
549
  });
534
550
  const lintHeader = "<!-- markdownlint-disable MD025 -->";
535
551
  const toolRules = normalizeTrailingWhitespace(TOOL_RULES);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "compose-agentsmd",
3
- "version": "3.2.1",
3
+ "version": "3.2.3",
4
4
  "description": "CLI tools for composing per-project AGENTS.md files from modular rule sets",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -44,7 +44,7 @@
44
44
  "node": ">=20"
45
45
  },
46
46
  "devDependencies": {
47
- "@types/node": "^25.0.10",
47
+ "@types/node": "^25.1.0",
48
48
  "typescript": "^5.7.3"
49
49
  },
50
50
  "dependencies": {
@@ -2,6 +2,7 @@
2
2
  - Before starting any work, run `compose-agentsmd` from the project root.
3
3
  - To update shared rules, run `compose-agentsmd edit-rules`, edit the workspace rules, then run `compose-agentsmd apply-rules`.
4
4
  - Do not edit `AGENTS.md` directly; update the source rules and regenerate.
5
+ - These tool rules live in tools/tool-rules.md in the compose-agentsmd repository; do not duplicate them in global rule modules.
5
6
  - When updating rules, include a colorized diff-style summary in the final response. Use `git diff --stat` first, then include the raw ANSI-colored output of `git diff --color=always` (no sanitizing or reformatting), and limit the output to the rule files that changed.
6
7
  - Also provide a short, copy-pasteable command the user can run to view the diff in the same format. Use absolute paths so it works regardless of the current working directory, and scope it to the changed rule files.
7
8
  - If a diff is provided, a separate detailed summary is not required. If a diff is not possible, include a detailed summary of what changed (added/removed/modified items).