compose-agentsmd 2.0.2 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -30,7 +30,7 @@ From each project root, run:
30
30
  compose-agentsmd
31
31
  ```
32
32
 
33
- The tool searches for `agent-ruleset.json` under the given root directory (default: current working directory), and writes output files as specified by each ruleset. If `output` is omitted, it defaults to `AGENTS.md`.
33
+ The tool reads `agent-ruleset.json` from the given root directory (default: current working directory), and writes the output file specified by the ruleset. If `output` is omitted, it defaults to `AGENTS.md`.
34
34
 
35
35
  The tool prepends a small "Tool Rules" block to every generated `AGENTS.md` so agents know how to regenerate or update rules.
36
36
 
@@ -9,21 +9,6 @@ const DEFAULT_OUTPUT = "AGENTS.md";
9
9
  const DEFAULT_CACHE_ROOT = path.join(os.homedir(), ".agentsmd", "cache");
10
10
  const DEFAULT_WORKSPACE_ROOT = path.join(os.homedir(), ".agentsmd", "workspace");
11
11
  const RULESET_SCHEMA_PATH = new URL("../agent-ruleset.schema.json", import.meta.url);
12
- const DEFAULT_IGNORE_DIRS = new Set([
13
- ".git",
14
- "agent-rules",
15
- "agent-rules-private",
16
- "agent-rules-local",
17
- "agent-rules-tools",
18
- "compose-agentsmd",
19
- "node_modules",
20
- "dist",
21
- "build",
22
- "out",
23
- ".next",
24
- ".turbo",
25
- "coverage"
26
- ]);
27
12
  const TOOL_RULES_PATH = new URL("../tools/tool-rules.md", import.meta.url);
28
13
  const USAGE_PATH = new URL("../tools/usage.txt", import.meta.url);
29
14
  const parseArgs = (argv) => {
@@ -394,46 +379,22 @@ const composeRuleset = (rulesetPath, rootDir, options) => {
394
379
  fs.writeFileSync(outputPath, output, "utf8");
395
380
  return normalizePath(path.relative(rootDir, outputPath));
396
381
  };
397
- const findRulesetFiles = (rootDir, rulesetName) => {
398
- const results = [];
399
- const pending = [rootDir];
400
- while (pending.length > 0) {
401
- const currentDir = pending.pop();
402
- if (!currentDir) {
403
- continue;
404
- }
405
- const entries = fs.readdirSync(currentDir, { withFileTypes: true });
406
- for (const entry of entries) {
407
- const entryPath = path.join(currentDir, entry.name);
408
- if (entry.isDirectory()) {
409
- if (DEFAULT_IGNORE_DIRS.has(entry.name)) {
410
- continue;
411
- }
412
- pending.push(entryPath);
413
- continue;
414
- }
415
- if (entry.isFile() && entry.name === rulesetName) {
416
- results.push(entryPath);
417
- }
418
- }
419
- }
420
- return results;
421
- };
422
382
  const getRulesetFiles = (rootDir, specificRuleset, rulesetName) => {
423
383
  if (specificRuleset) {
424
384
  const resolved = resolveFrom(rootDir, specificRuleset);
425
385
  ensureFileExists(resolved);
426
386
  return [resolved];
427
387
  }
428
- return findRulesetFiles(rootDir, rulesetName);
388
+ const defaultRuleset = path.join(rootDir, rulesetName);
389
+ if (!fs.existsSync(defaultRuleset)) {
390
+ return [];
391
+ }
392
+ return [defaultRuleset];
429
393
  };
430
394
  const ensureSingleRuleset = (rulesetFiles, rootDir, rulesetName) => {
431
395
  if (rulesetFiles.length === 0) {
432
- throw new Error(`No ruleset files named ${rulesetName} found under ${rootDir}`);
433
- }
434
- if (rulesetFiles.length > 1) {
435
- const list = rulesetFiles.map((file) => `- ${normalizePath(path.relative(rootDir, file))}`).join("\n");
436
- throw new Error(`Multiple ruleset files found. Specify one with --ruleset:\n${list}`);
396
+ const expectedPath = normalizePath(path.join(rootDir, rulesetName));
397
+ throw new Error(`Missing ruleset file: ${expectedPath}`);
437
398
  }
438
399
  return rulesetFiles[0];
439
400
  };
@@ -473,7 +434,8 @@ const main = () => {
473
434
  return;
474
435
  }
475
436
  if (rulesetFiles.length === 0) {
476
- throw new Error(`No ruleset files named ${rulesetName} found under ${rootDir}`);
437
+ const expectedPath = normalizePath(path.join(rootDir, rulesetName));
438
+ throw new Error(`Missing ruleset file: ${expectedPath}`);
477
439
  }
478
440
  const outputs = rulesetFiles
479
441
  .sort()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "compose-agentsmd",
3
- "version": "2.0.2",
3
+ "version": "3.0.0",
4
4
  "description": "CLI tools for composing per-project AGENTS.md files from modular rule sets",
5
5
  "license": "MIT",
6
6
  "repository": {
package/tools/usage.txt CHANGED
@@ -3,6 +3,6 @@ Usage: compose-agentsmd [edit-rules|apply-rules] [--root <path>] [--ruleset <pat
3
3
  Options:
4
4
  --root <path> Project root directory (default: current working directory)
5
5
  --ruleset <path> Only compose a single ruleset file
6
- --ruleset-name <name> Ruleset filename to search for (default: agent-ruleset.json)
6
+ --ruleset-name <name> Ruleset filename in the project root (default: agent-ruleset.json)
7
7
  --refresh Refresh cached remote rules
8
- --clear-cache Remove cached remote rules and exit
8
+ --clear-cache Remove cached remote rules and exit