compose-agentsmd 3.2.3 → 3.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -134,4 +134,11 @@ npm install
134
134
  npm run lint
135
135
  npm run build
136
136
  npm test
137
- ```
137
+ ```
138
+
139
+ ## Overview
140
+ This repository contains the compose-agentsmd project.
141
+
142
+ ## Requirements and Configuration
143
+ - No required environment variables are documented.
144
+
@@ -16,6 +16,13 @@ const RULESET_SCHEMA_PATH = new URL("../agent-ruleset.schema.json", import.meta.
16
16
  const PACKAGE_JSON_PATH = new URL("../package.json", import.meta.url);
17
17
  const TOOL_RULES_PATH = new URL("../tools/tool-rules.md", import.meta.url);
18
18
  const USAGE_PATH = new URL("../tools/usage.txt", import.meta.url);
19
+ const readValueArg = (remaining, index, flag) => {
20
+ const value = remaining[index + 1];
21
+ if (!value) {
22
+ throw new Error(`Missing value for ${flag}`);
23
+ }
24
+ return value;
25
+ };
19
26
  const parseArgs = (argv) => {
20
27
  const args = {};
21
28
  const knownCommands = new Set(["edit-rules", "apply-rules", "init"]);
@@ -38,28 +45,19 @@ const parseArgs = (argv) => {
38
45
  continue;
39
46
  }
40
47
  if (arg === "--root") {
41
- const value = remaining[i + 1];
42
- if (!value) {
43
- throw new Error("Missing value for --root");
44
- }
48
+ const value = readValueArg(remaining, i, "--root");
45
49
  args.root = value;
46
50
  i += 1;
47
51
  continue;
48
52
  }
49
53
  if (arg === "--ruleset") {
50
- const value = remaining[i + 1];
51
- if (!value) {
52
- throw new Error("Missing value for --ruleset");
53
- }
54
+ const value = readValueArg(remaining, i, "--ruleset");
54
55
  args.ruleset = value;
55
56
  i += 1;
56
57
  continue;
57
58
  }
58
59
  if (arg === "--ruleset-name") {
59
- const value = remaining[i + 1];
60
- if (!value) {
61
- throw new Error("Missing value for --ruleset-name");
62
- }
60
+ const value = readValueArg(remaining, i, "--ruleset-name");
63
61
  args.rulesetName = value;
64
62
  i += 1;
65
63
  continue;
@@ -73,19 +71,13 @@ const parseArgs = (argv) => {
73
71
  continue;
74
72
  }
75
73
  if (arg === "--source") {
76
- const value = remaining[i + 1];
77
- if (!value) {
78
- throw new Error("Missing value for --source");
79
- }
74
+ const value = readValueArg(remaining, i, "--source");
80
75
  args.source = value;
81
76
  i += 1;
82
77
  continue;
83
78
  }
84
79
  if (arg === "--domains") {
85
- const value = remaining[i + 1];
86
- if (!value) {
87
- throw new Error("Missing value for --domains");
88
- }
80
+ const value = readValueArg(remaining, i, "--domains");
89
81
  args.domains = [...(args.domains ?? []), ...value.split(",").map((entry) => entry.trim())];
90
82
  i += 1;
91
83
  continue;
@@ -95,10 +87,7 @@ const parseArgs = (argv) => {
95
87
  continue;
96
88
  }
97
89
  if (arg === "--extra") {
98
- const value = remaining[i + 1];
99
- if (!value) {
100
- throw new Error("Missing value for --extra");
101
- }
90
+ const value = readValueArg(remaining, i, "--extra");
102
91
  args.extra = [...(args.extra ?? []), ...value.split(",").map((entry) => entry.trim())];
103
92
  i += 1;
104
93
  continue;
@@ -108,10 +97,7 @@ const parseArgs = (argv) => {
108
97
  continue;
109
98
  }
110
99
  if (arg === "--output") {
111
- const value = remaining[i + 1];
112
- if (!value) {
113
- throw new Error("Missing value for --output");
114
- }
100
+ const value = readValueArg(remaining, i, "--output");
115
101
  args.output = value;
116
102
  i += 1;
117
103
  continue;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "compose-agentsmd",
3
- "version": "3.2.3",
3
+ "version": "3.2.4",
4
4
  "description": "CLI tools for composing per-project AGENTS.md files from modular rule sets",
5
5
  "license": "MIT",
6
6
  "repository": {