ruleloom 0.1.0 → 0.2.1

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/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.1 — 2026-12-06
4
+
5
+ - README: the compile overview is an image (`docs/compile-overview.png`, shipped in the package) instead of an ASCII diagram whose columns broke on npmjs.com. No code change.
6
+
7
+ ## 0.2.0 — 2026-12-01
8
+
9
+ - **Zod 4** (`^4.6.6`): Zod 3 is affected by GHSA-mrhx-c7xc-m3w5 (high — memory exhaustion while validating oversized constrained collections), fixed in 4.6.6 only. The exported schemas (`AgentConfigSchema`, `ProjectFileSchema`…) are now Zod 4 schemas: a caller composing them with its own Zod 3 schemas must upgrade too. Calling `.parse` / `.safeParse` on them is unchanged.
10
+ - Error messages of `AGENT_CONFIG_INVALID` and `PROJECT_CONFIG_INVALID` flatten nested issues: a bad record key (`random`, `data`, `mcp`, `targets`, `resources`) names its code and full path instead of Zod 4's generic "Invalid key in record", and a failed union names the branch that failed a check.
11
+
3
12
  ## 0.1.0 — 2026-11-30
4
13
 
5
14
  First release, extracted from the agent compiler of the Foliora template factory.
package/README.md CHANGED
@@ -4,16 +4,7 @@
4
4
 
5
5
  RuleLoom reads an agent written as plain files — rules, skills, a mission, MCP servers, variables — and produces what each platform loads by itself: `.claude/` for Claude Code, `AGENTS.md` and `.agents/skills/` for Codex, `.github/agents/` and `.github/instructions/` for Copilot. The same definition also compiles to one prompt string, for a completion API.
6
6
 
7
- ```
8
- agents/ .ruleloom/build/
9
- shared/rules/00_HONESTY.md claude/writer/.claude/agents/acme-writer.md
10
- writer/ .claude/rules/10-shape.md
11
- agent.json ruleloom compile .claude/skills/20-changelog-style/SKILL.md
12
- source/mission.md ─────────────▶ codex/writer/AGENTS.md
13
- source/rules/10_SHAPE.md .agents/skills/20-changelog-style/SKILL.md
14
- source/skills/20_CHANGELOG_STYLE.md copilot/writer/.github/agents/acme-writer.agent.md
15
- .github/instructions/10-shape.instructions.md
16
- ```
7
+ ![ruleloom compile reads agents/ (shared/rules/00_HONESTY.md; writer/agent.json, source/mission.md, source/rules/10_SHAPE.md, source/skills/20_CHANGELOG_STYLE.md) and writes .ruleloom/build/: claude/writer/.claude/ (agents/acme-writer.md, rules/10-shape.md, skills/20-changelog-style/SKILL.md), codex/writer/ (AGENTS.md, .agents/skills/20-changelog-style/SKILL.md), copilot/writer/.github/ (agents/acme-writer.agent.md, instructions/10-shape.instructions.md)](https://cdn.jsdelivr.net/npm/ruleloom@0.2.1/docs/compile-overview.png)
17
8
 
18
9
  - **One source, three platforms.** Rules, skills and MCP servers are written once; each adapter writes the platform's own format.
19
10
  - **Deterministic.** Same inputs, same bytes, same checksum. No timestamp, no globbing: `ruleloom compile --check` fails CI when generated files drift.
package/dist/config.d.ts CHANGED
@@ -1,55 +1,17 @@
1
1
  import { z } from 'zod';
2
2
  /** One rule, skill or mission file, with the codes it speaks to. */
3
3
  export declare const AgentModuleSchema: z.ZodObject<{
4
- /**
5
- * Path relative to the agent directory (`source/rules/10_COMMON.md`), or
6
- * relative to the shared directory when it starts with `shared/`, or to a
7
- * declared resource when it starts with `@<resource>/`.
8
- */
9
4
  path: z.ZodString;
10
- /**
11
- * Verification codes this file helps fix. A retry recompiles with only the
12
- * modules whose tags match what failed: a contrast failure has no business
13
- * reloading the layout rules, and paying for them again on every attempt is
14
- * the largest avoidable cost of a generate-verify loop.
15
- */
16
- tags: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
17
- /** Kept on every retry, whatever failed: the output contract, above all. */
5
+ tags: z.ZodDefault<z.ZodArray<z.ZodString>>;
18
6
  always: z.ZodDefault<z.ZodBoolean>;
19
- /**
20
- * In a compiled prompt, placed after the run-supplied blocks rather than
21
- * before them, so the output contract is the last thing the model reads.
22
- * Ignored by bundles, which have no run blocks.
23
- */
24
7
  trailing: z.ZodDefault<z.ZodBoolean>;
25
- /**
26
- * What the file becomes. Inferred from the path when absent: anything
27
- * under a `skills/` directory is a skill, everything else a rule. `mission`
28
- * is the agent's own prompt — its role and deliverables — and an agent
29
- * declares at most one.
30
- */
31
- kind: z.ZodOptional<z.ZodEnum<["rule", "skill", "mission"]>>;
32
- /**
33
- * The modes this module belongs to, from the agent's `modes`. Empty means
34
- * every mode. A module bound to modes is compiled only for one of them: a
35
- * procedure for one kind of input says nothing to a run that has another.
36
- */
37
- modes: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
38
- }, "strip", z.ZodTypeAny, {
39
- path: string;
40
- tags: string[];
41
- always: boolean;
42
- trailing: boolean;
43
- modes: string[];
44
- kind?: "rule" | "skill" | "mission" | undefined;
45
- }, {
46
- path: string;
47
- tags?: string[] | undefined;
48
- always?: boolean | undefined;
49
- trailing?: boolean | undefined;
50
- kind?: "rule" | "skill" | "mission" | undefined;
51
- modes?: string[] | undefined;
52
- }>;
8
+ kind: z.ZodOptional<z.ZodEnum<{
9
+ rule: "rule";
10
+ skill: "skill";
11
+ mission: "mission";
12
+ }>>;
13
+ modes: z.ZodDefault<z.ZodArray<z.ZodString>>;
14
+ }, z.core.$strip>;
53
15
  export type AgentModule = z.infer<typeof AgentModuleSchema>;
54
16
  /** What a module becomes when `kind` is left out. */
55
17
  export declare function moduleKind(module: AgentModule): 'rule' | 'skill' | 'mission';
@@ -60,300 +22,51 @@ export declare function moduleKind(module: AgentModule): 'rule' | 'skill' | 'mis
60
22
  * whoever launches the agent; a definition that carried a secret would put
61
23
  * it in every generated file and every commit of them.
62
24
  */
63
- export declare const McpServerSchema: z.ZodEffects<z.ZodObject<{
64
- /** stdio transport: the command to launch. */
25
+ export declare const McpServerSchema: z.ZodObject<{
65
26
  command: z.ZodOptional<z.ZodString>;
66
- args: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
67
- /** Remote transport: the server URL. */
68
- url: z.ZodOptional<z.ZodString>;
69
- env: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
70
- }, "strict", z.ZodTypeAny, {
71
- args: string[];
72
- env: string[];
73
- command?: string | undefined;
74
- url?: string | undefined;
75
- }, {
76
- command?: string | undefined;
77
- args?: string[] | undefined;
78
- url?: string | undefined;
79
- env?: string[] | undefined;
80
- }>, {
81
- args: string[];
82
- env: string[];
83
- command?: string | undefined;
84
- url?: string | undefined;
85
- }, {
86
- command?: string | undefined;
87
- args?: string[] | undefined;
88
- url?: string | undefined;
89
- env?: string[] | undefined;
90
- }>;
27
+ args: z.ZodDefault<z.ZodArray<z.ZodString>>;
28
+ url: z.ZodOptional<z.ZodURL>;
29
+ env: z.ZodDefault<z.ZodArray<z.ZodString>>;
30
+ }, z.core.$strict>;
91
31
  export type McpServer = z.infer<typeof McpServerSchema>;
92
- export declare const AgentConfigSchema: z.ZodEffects<z.ZodObject<{
32
+ export declare const AgentConfigSchema: z.ZodObject<{
93
33
  name: z.ZodString;
94
34
  version: z.ZodString;
95
- /** One line: what the agent turns into what. Becomes its description. */
96
35
  summary: z.ZodString;
97
- /** Artefact names this agent reads and writes, for the orchestrator. */
98
- inputs: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
99
- outputs: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
100
- /**
101
- * Choices the agent's text leaves open, cited as `${{NAME}}`. A rule
102
- * that offers a menu is answered the same way every time; a slot drawn
103
- * by the run gets a different answer. The compiler takes the first value
104
- * when nobody draws, so a compilation stays deterministic.
105
- */
106
- random: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString, "many">>>;
107
- /** Constants the agent's text cites as `${{NAME}}`, one value each. */
36
+ inputs: z.ZodDefault<z.ZodArray<z.ZodString>>;
37
+ outputs: z.ZodDefault<z.ZodArray<z.ZodString>>;
38
+ random: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>>;
108
39
  data: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
109
- /** Lines that open every compiled prompt and every agent file. */
110
- preamble: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
111
- /**
112
- * Shared rules this agent inherits, by file name in `<shared>/rules/`.
113
- * Declared, never globbed: a shared rule reaches an agent because that
114
- * agent asked for it.
115
- */
116
- sharedRules: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
40
+ preamble: z.ZodDefault<z.ZodArray<z.ZodString>>;
41
+ sharedRules: z.ZodDefault<z.ZodArray<z.ZodString>>;
117
42
  runtime: z.ZodDefault<z.ZodObject<{
118
- /**
119
- * Skills preloaded into the agent's context rather than fetched on
120
- * demand, by skill slug. Only targets with a preload mechanism use
121
- * it; the others expose every skill for discovery.
122
- */
123
- skills: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
124
- }, "strip", z.ZodTypeAny, {
125
- skills: string[];
126
- }, {
127
- skills?: string[] | undefined;
128
- }>>;
129
- /** The modes the agent may be compiled for, the first being the default. */
130
- modes: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
131
- /** MCP servers the agent may use, by name. */
132
- mcp: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodEffects<z.ZodObject<{
133
- /** stdio transport: the command to launch. */
43
+ skills: z.ZodDefault<z.ZodArray<z.ZodString>>;
44
+ }, z.core.$strip>>;
45
+ modes: z.ZodDefault<z.ZodArray<z.ZodString>>;
46
+ mcp: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
134
47
  command: z.ZodOptional<z.ZodString>;
135
- args: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
136
- /** Remote transport: the server URL. */
137
- url: z.ZodOptional<z.ZodString>;
138
- env: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
139
- }, "strict", z.ZodTypeAny, {
140
- args: string[];
141
- env: string[];
142
- command?: string | undefined;
143
- url?: string | undefined;
144
- }, {
145
- command?: string | undefined;
146
- args?: string[] | undefined;
147
- url?: string | undefined;
148
- env?: string[] | undefined;
149
- }>, {
150
- args: string[];
151
- env: string[];
152
- command?: string | undefined;
153
- url?: string | undefined;
154
- }, {
155
- command?: string | undefined;
156
- args?: string[] | undefined;
157
- url?: string | undefined;
158
- env?: string[] | undefined;
159
- }>>>;
160
- /** Per-target settings: `{ "claude": { "tools": "Read, Grep" } }`. */
48
+ args: z.ZodDefault<z.ZodArray<z.ZodString>>;
49
+ url: z.ZodOptional<z.ZodURL>;
50
+ env: z.ZodDefault<z.ZodArray<z.ZodString>>;
51
+ }, z.core.$strict>>>;
161
52
  targets: z.ZodDefault<z.ZodObject<{
162
- claude: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>>;
163
- codex: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>>;
164
- copilot: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>>;
165
- }, "strict", z.ZodTypeAny, {
166
- claude?: Record<string, string | string[]> | undefined;
167
- codex?: Record<string, string | string[]> | undefined;
168
- copilot?: Record<string, string | string[]> | undefined;
169
- }, {
170
- claude?: Record<string, string | string[]> | undefined;
171
- codex?: Record<string, string | string[]> | undefined;
172
- copilot?: Record<string, string | string[]> | undefined;
173
- }>>;
53
+ claude: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>>;
54
+ codex: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>>;
55
+ copilot: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>>;
56
+ }, z.core.$strict>>;
174
57
  modules: z.ZodArray<z.ZodObject<{
175
- /**
176
- * Path relative to the agent directory (`source/rules/10_COMMON.md`), or
177
- * relative to the shared directory when it starts with `shared/`, or to a
178
- * declared resource when it starts with `@<resource>/`.
179
- */
180
58
  path: z.ZodString;
181
- /**
182
- * Verification codes this file helps fix. A retry recompiles with only the
183
- * modules whose tags match what failed: a contrast failure has no business
184
- * reloading the layout rules, and paying for them again on every attempt is
185
- * the largest avoidable cost of a generate-verify loop.
186
- */
187
- tags: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
188
- /** Kept on every retry, whatever failed: the output contract, above all. */
59
+ tags: z.ZodDefault<z.ZodArray<z.ZodString>>;
189
60
  always: z.ZodDefault<z.ZodBoolean>;
190
- /**
191
- * In a compiled prompt, placed after the run-supplied blocks rather than
192
- * before them, so the output contract is the last thing the model reads.
193
- * Ignored by bundles, which have no run blocks.
194
- */
195
61
  trailing: z.ZodDefault<z.ZodBoolean>;
196
- /**
197
- * What the file becomes. Inferred from the path when absent: anything
198
- * under a `skills/` directory is a skill, everything else a rule. `mission`
199
- * is the agent's own prompt — its role and deliverables — and an agent
200
- * declares at most one.
201
- */
202
- kind: z.ZodOptional<z.ZodEnum<["rule", "skill", "mission"]>>;
203
- /**
204
- * The modes this module belongs to, from the agent's `modes`. Empty means
205
- * every mode. A module bound to modes is compiled only for one of them: a
206
- * procedure for one kind of input says nothing to a run that has another.
207
- */
208
- modes: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
209
- }, "strip", z.ZodTypeAny, {
210
- path: string;
211
- tags: string[];
212
- always: boolean;
213
- trailing: boolean;
214
- modes: string[];
215
- kind?: "rule" | "skill" | "mission" | undefined;
216
- }, {
217
- path: string;
218
- tags?: string[] | undefined;
219
- always?: boolean | undefined;
220
- trailing?: boolean | undefined;
221
- kind?: "rule" | "skill" | "mission" | undefined;
222
- modes?: string[] | undefined;
223
- }>, "many">;
224
- }, "strip", z.ZodTypeAny, {
225
- modes: string[];
226
- name: string;
227
- version: string;
228
- summary: string;
229
- inputs: string[];
230
- outputs: string[];
231
- random: Record<string, string[]>;
232
- data: Record<string, string>;
233
- preamble: string[];
234
- sharedRules: string[];
235
- runtime: {
236
- skills: string[];
237
- };
238
- mcp: Record<string, {
239
- args: string[];
240
- env: string[];
241
- command?: string | undefined;
242
- url?: string | undefined;
243
- }>;
244
- targets: {
245
- claude?: Record<string, string | string[]> | undefined;
246
- codex?: Record<string, string | string[]> | undefined;
247
- copilot?: Record<string, string | string[]> | undefined;
248
- };
249
- modules: {
250
- path: string;
251
- tags: string[];
252
- always: boolean;
253
- trailing: boolean;
254
- modes: string[];
255
- kind?: "rule" | "skill" | "mission" | undefined;
256
- }[];
257
- }, {
258
- name: string;
259
- version: string;
260
- summary: string;
261
- modules: {
262
- path: string;
263
- tags?: string[] | undefined;
264
- always?: boolean | undefined;
265
- trailing?: boolean | undefined;
266
- kind?: "rule" | "skill" | "mission" | undefined;
267
- modes?: string[] | undefined;
268
- }[];
269
- modes?: string[] | undefined;
270
- inputs?: string[] | undefined;
271
- outputs?: string[] | undefined;
272
- random?: Record<string, string[]> | undefined;
273
- data?: Record<string, string> | undefined;
274
- preamble?: string[] | undefined;
275
- sharedRules?: string[] | undefined;
276
- runtime?: {
277
- skills?: string[] | undefined;
278
- } | undefined;
279
- mcp?: Record<string, {
280
- command?: string | undefined;
281
- args?: string[] | undefined;
282
- url?: string | undefined;
283
- env?: string[] | undefined;
284
- }> | undefined;
285
- targets?: {
286
- claude?: Record<string, string | string[]> | undefined;
287
- codex?: Record<string, string | string[]> | undefined;
288
- copilot?: Record<string, string | string[]> | undefined;
289
- } | undefined;
290
- }>, {
291
- modes: string[];
292
- name: string;
293
- version: string;
294
- summary: string;
295
- inputs: string[];
296
- outputs: string[];
297
- random: Record<string, string[]>;
298
- data: Record<string, string>;
299
- preamble: string[];
300
- sharedRules: string[];
301
- runtime: {
302
- skills: string[];
303
- };
304
- mcp: Record<string, {
305
- args: string[];
306
- env: string[];
307
- command?: string | undefined;
308
- url?: string | undefined;
309
- }>;
310
- targets: {
311
- claude?: Record<string, string | string[]> | undefined;
312
- codex?: Record<string, string | string[]> | undefined;
313
- copilot?: Record<string, string | string[]> | undefined;
314
- };
315
- modules: {
316
- path: string;
317
- tags: string[];
318
- always: boolean;
319
- trailing: boolean;
320
- modes: string[];
321
- kind?: "rule" | "skill" | "mission" | undefined;
322
- }[];
323
- }, {
324
- name: string;
325
- version: string;
326
- summary: string;
327
- modules: {
328
- path: string;
329
- tags?: string[] | undefined;
330
- always?: boolean | undefined;
331
- trailing?: boolean | undefined;
332
- kind?: "rule" | "skill" | "mission" | undefined;
333
- modes?: string[] | undefined;
334
- }[];
335
- modes?: string[] | undefined;
336
- inputs?: string[] | undefined;
337
- outputs?: string[] | undefined;
338
- random?: Record<string, string[]> | undefined;
339
- data?: Record<string, string> | undefined;
340
- preamble?: string[] | undefined;
341
- sharedRules?: string[] | undefined;
342
- runtime?: {
343
- skills?: string[] | undefined;
344
- } | undefined;
345
- mcp?: Record<string, {
346
- command?: string | undefined;
347
- args?: string[] | undefined;
348
- url?: string | undefined;
349
- env?: string[] | undefined;
350
- }> | undefined;
351
- targets?: {
352
- claude?: Record<string, string | string[]> | undefined;
353
- codex?: Record<string, string | string[]> | undefined;
354
- copilot?: Record<string, string | string[]> | undefined;
355
- } | undefined;
356
- }>;
62
+ kind: z.ZodOptional<z.ZodEnum<{
63
+ rule: "rule";
64
+ skill: "skill";
65
+ mission: "mission";
66
+ }>>;
67
+ modes: z.ZodDefault<z.ZodArray<z.ZodString>>;
68
+ }, z.core.$strip>>;
69
+ }, z.core.$strip>;
357
70
  export type AgentConfig = z.infer<typeof AgentConfigSchema>;
358
71
  /** Reads and validates `<agentDir>/agent.json`. */
359
72
  export declare function readAgentConfig(agentDir: string): AgentConfig;
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAiCxB,oEAAoE;AACpE,eAAO,MAAM,iBAAiB;IAC5B;;;;OAIG;;IAEH;;;;;OAKG;;IAEH,4EAA4E;;IAE5E;;;;OAIG;;IAEH;;;;;OAKG;;IAEH;;;;OAIG;;;;;;;;;;;;;;;;EAEH,CAAC;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AAkCxB,oEAAoE;AACpE,eAAO,MAAM,iBAAiB;;;;;;;;;;;iBAmC5B,CAAC;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE5D,qDAAqD;AACrD,wBAAgB,UAAU,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAG5E;AAED;;;;;;GAMG;AACH,eAAO,MAAM,eAAe;;;;;kBAiBxB,CAAC;AACL,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAgBxD,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAuF1B,CAAC;AACL,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE5D,mDAAmD;AACnD,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,WAAW,CAa7D"}
package/dist/config.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import { readFileSync } from 'node:fs';
2
2
  import { join } from 'node:path';
3
3
  import { z } from 'zod';
4
+ import { formatIssues } from './issues.js';
4
5
  import { RuleLoomError } from './errors.js';
5
6
  /**
6
7
  * What an agent declares about itself: `<agentsRoot>/<name>/agent.json`.
@@ -81,7 +82,7 @@ export const McpServerSchema = z
81
82
  command: z.string().min(1).optional(),
82
83
  args: z.array(z.string()).default([]),
83
84
  /** Remote transport: the server URL. */
84
- url: z.string().url().optional(),
85
+ url: z.url().optional(),
85
86
  env: z.array(z.string().regex(ENV_NAME, 'MCP_ENV_NAME_INVALID')).default([]),
86
87
  })
87
88
  .strict()
@@ -197,10 +198,7 @@ export function readAgentConfig(agentDir) {
197
198
  }
198
199
  const parsed = AgentConfigSchema.safeParse(raw);
199
200
  if (!parsed.success) {
200
- const issues = parsed.error.issues
201
- .map((issue) => `${issue.path.join('.') || '(root)'}: ${issue.message}`)
202
- .join(' | ');
203
- throw new RuleLoomError('AGENT_CONFIG_INVALID', `${path} — ${issues}`);
201
+ throw new RuleLoomError('AGENT_CONFIG_INVALID', `${path} — ${formatIssues(parsed.error.issues)}`);
204
202
  }
205
203
  return parsed.data;
206
204
  }
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C;;;;;;;GAOG;AAEH,oDAAoD;AACpD,MAAM,SAAS,GAAG,mBAAmB,CAAC;AAEtC,qEAAqE;AACrE,MAAM,SAAS,GAAG,mBAAmB,CAAC;AAEtC;;;GAGG;AACH,MAAM,YAAY,GAAG,uDAAuD,CAAC;AAE7E,oEAAoE;AACpE,MAAM,UAAU,GAAG,kBAAkB,CAAC;AAEtC,8DAA8D;AAC9D,MAAM,WAAW,GAAG,kCAAkC,CAAC;AAEvD,uEAAuE;AACvE,MAAM,QAAQ,GAAG,oBAAoB,CAAC;AAEtC,oEAAoE;AACpE,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IACxC;;;;OAIG;IACH,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACvB;;;;;OAKG;IACH,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC;IAC5C,4EAA4E;IAC5E,MAAM,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC;IAClC;;;;OAIG;IACH,QAAQ,EAAE,CAAC,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AAiB,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;IAChD,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACpB,MAAM,IAAI,aAAa,CAAC,sBAAsB,EAAE,GAAG,IAAI,MAAM,YAAY,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IACpG,CAAC;IACD,OAAO,MAAM,CAAC,IAAI,CAAC;AACrB,CAAC"}
@@ -0,0 +1,6 @@
1
+ import type { z } from 'zod';
2
+ type Issue = z.core.$ZodIssue;
3
+ /** `path: message | path: message`, every nested code reachable by a reader. */
4
+ export declare function formatIssues(issues: readonly Issue[]): string;
5
+ export {};
6
+ //# sourceMappingURL=issues.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"issues.d.ts","sourceRoot":"","sources":["../src/issues.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAE7B,KAAK,KAAK,GAAG,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC;AA6B9B,gFAAgF;AAChF,wBAAgB,YAAY,CAAC,MAAM,EAAE,SAAS,KAAK,EAAE,GAAG,MAAM,CAK7D"}
package/dist/issues.js ADDED
@@ -0,0 +1,31 @@
1
+ /**
2
+ * The leaves of a Zod issue tree, each with its full path.
3
+ *
4
+ * Zod 4 reports a bad record key as one `invalid_key` issue ("Invalid key in
5
+ * record") that holds the key schema's own issues, and a failed union as one
6
+ * `invalid_union` holding each branch's. The code RuleLoom attaches to a
7
+ * check (`RANDOM_NAME_INVALID`…) lives in those children: a formatter that
8
+ * printed only the top message would hide it.
9
+ */
10
+ function leaves(issue, prefix) {
11
+ const path = [...prefix, ...issue.path];
12
+ if (issue.code === 'invalid_key' || issue.code === 'invalid_element') {
13
+ return issue.issues.flatMap((child) => leaves(child, path));
14
+ }
15
+ if (issue.code === 'invalid_union' && issue.errors.length > 0) {
16
+ const branches = issue.errors.map((branch) => branch.flatMap((child) => leaves(child, path)));
17
+ // A branch that failed on a check, not on the type, is the one the
18
+ // author meant: a multiline string, not "expected array".
19
+ const meant = issue.errors.flatMap((branch, index) => branch.some((child) => child.code !== 'invalid_type') ? branches[index] : []);
20
+ return meant.length > 0 ? meant : branches.flat();
21
+ }
22
+ return [{ path, message: issue.message }];
23
+ }
24
+ /** `path: message | path: message`, every nested code reachable by a reader. */
25
+ export function formatIssues(issues) {
26
+ return issues
27
+ .flatMap((issue) => leaves(issue, []))
28
+ .map(({ path, message }) => `${path.map(String).join('.') || '(root)'}: ${message}`)
29
+ .join(' | ');
30
+ }
31
+ //# sourceMappingURL=issues.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"issues.js","sourceRoot":"","sources":["../src/issues.ts"],"names":[],"mappings":"AAKA;;;;;;;;GAQG;AACH,SAAS,MAAM,CAAC,KAAY,EAAE,MAAY;IACxC,MAAM,IAAI,GAAG,CAAC,GAAG,MAAM,EAAE,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC;IACxC,IAAI,KAAK,CAAC,IAAI,KAAK,aAAa,IAAI,KAAK,CAAC,IAAI,KAAK,iBAAiB,EAAE,CAAC;QACrE,OAAO,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC;IAC9D,CAAC;IACD,IAAI,KAAK,CAAC,IAAI,KAAK,eAAe,IAAI,KAAK,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC9D,MAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;QAC9F,mEAAmE;QACnE,0DAA0D;QAC1D,MAAM,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CACnD,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,cAAc,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAE,CAAC,CAAC,CAAC,EAAE,CAC9E,CAAC;QACF,OAAO,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;IACpD,CAAC;IACD,OAAO,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;AAC5C,CAAC;AAED,gFAAgF;AAChF,MAAM,UAAU,YAAY,CAAC,MAAwB;IACnD,OAAO,MAAM;SACV,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;SACrC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,QAAQ,KAAK,OAAO,EAAE,CAAC;SACnF,IAAI,CAAC,KAAK,CAAC,CAAC;AACjB,CAAC"}
package/dist/project.d.ts CHANGED
@@ -11,121 +11,45 @@ import { z } from 'zod';
11
11
  * writer/agent.json
12
12
  */
13
13
  export declare const TARGETS: readonly ["claude", "codex", "copilot"];
14
- export declare const TargetSchema: z.ZodEnum<["claude", "codex", "copilot"]>;
14
+ export declare const TargetSchema: z.ZodEnum<{
15
+ claude: "claude";
16
+ codex: "codex";
17
+ copilot: "copilot";
18
+ }>;
15
19
  export type Target = z.infer<typeof TargetSchema>;
16
20
  /** A shared referential: a local directory, or a Git repository pinned to a ref. */
17
- export declare const ResourceSchema: z.ZodUnion<[z.ZodObject<{
21
+ export declare const ResourceSchema: z.ZodUnion<readonly [z.ZodObject<{
18
22
  path: z.ZodString;
19
- }, "strict", z.ZodTypeAny, {
20
- path: string;
21
- }, {
22
- path: string;
23
- }>, z.ZodObject<{
23
+ }, z.core.$strict>, z.ZodObject<{
24
24
  git: z.ZodString;
25
- /** A tag or a commit. A branch moves, and a moving source is not reproducible. */
26
25
  ref: z.ZodString;
27
- /** Expected commit: compilation refuses a ref that resolves elsewhere. */
28
26
  commit: z.ZodOptional<z.ZodString>;
29
- /** Sub-directory of the repository that holds the resources. */
30
27
  path: z.ZodDefault<z.ZodString>;
31
- }, "strict", z.ZodTypeAny, {
32
- path: string;
33
- git: string;
34
- ref: string;
35
- commit?: string | undefined;
36
- }, {
37
- git: string;
38
- ref: string;
39
- path?: string | undefined;
40
- commit?: string | undefined;
41
- }>]>;
28
+ }, z.core.$strict>]>;
42
29
  export type Resource = z.infer<typeof ResourceSchema>;
43
30
  export declare const ProjectFileSchema: z.ZodObject<{
44
- /** Directory holding one sub-directory per agent. Relative to the project file. */
45
31
  agentsDir: z.ZodDefault<z.ZodString>;
46
- /** Shared rules, blocks and constraints. Relative to `agentsDir`. */
47
32
  sharedDir: z.ZodDefault<z.ZodString>;
48
- /** Sub-directories of `agentsDir` that are never agents. */
49
- exclude: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
50
- /** Prefix of every generated agent name: `acme-` turns `reviewer` into `acme-reviewer`. */
33
+ exclude: z.ZodDefault<z.ZodArray<z.ZodString>>;
51
34
  namePrefix: z.ZodDefault<z.ZodString>;
52
- /**
53
- * A paragraph every agent file ends on, relative to `sharedDir`. Said out
54
- * loud because rule loading is invisible: a model that cannot see where
55
- * its rules came from must not conclude they are optional.
56
- */
57
35
  constraints: z.ZodOptional<z.ZodString>;
58
- /** Run-supplied prompt blocks: `<number>_<NAME>.md` templates, relative to `sharedDir`. */
59
36
  blocksDir: z.ZodDefault<z.ZodString>;
60
- /** Block files start at this number; hand-written modules stay below it. */
61
37
  blockNumberFloor: z.ZodDefault<z.ZodNumber>;
62
- /** Targets compiled when none is named. */
63
- targets: z.ZodDefault<z.ZodArray<z.ZodEnum<["claude", "codex", "copilot"]>, "many">>;
64
- /** Shared referentials, cited in module paths as `@<alias>/…`. */
65
- resources: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodObject<{
38
+ targets: z.ZodDefault<z.ZodArray<z.ZodEnum<{
39
+ claude: "claude";
40
+ codex: "codex";
41
+ copilot: "copilot";
42
+ }>>>;
43
+ resources: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
66
44
  path: z.ZodString;
67
- }, "strict", z.ZodTypeAny, {
68
- path: string;
69
- }, {
70
- path: string;
71
- }>, z.ZodObject<{
45
+ }, z.core.$strict>, z.ZodObject<{
72
46
  git: z.ZodString;
73
- /** A tag or a commit. A branch moves, and a moving source is not reproducible. */
74
47
  ref: z.ZodString;
75
- /** Expected commit: compilation refuses a ref that resolves elsewhere. */
76
48
  commit: z.ZodOptional<z.ZodString>;
77
- /** Sub-directory of the repository that holds the resources. */
78
49
  path: z.ZodDefault<z.ZodString>;
79
- }, "strict", z.ZodTypeAny, {
80
- path: string;
81
- git: string;
82
- ref: string;
83
- commit?: string | undefined;
84
- }, {
85
- git: string;
86
- ref: string;
87
- path?: string | undefined;
88
- commit?: string | undefined;
89
- }>]>>>;
90
- /** Where Git resources are fetched. Relative to the project file. */
50
+ }, z.core.$strict>]>>>;
91
51
  cacheDir: z.ZodDefault<z.ZodString>;
92
- }, "strict", z.ZodTypeAny, {
93
- targets: ("claude" | "codex" | "copilot")[];
94
- agentsDir: string;
95
- sharedDir: string;
96
- exclude: string[];
97
- namePrefix: string;
98
- blocksDir: string;
99
- blockNumberFloor: number;
100
- resources: Record<string, {
101
- path: string;
102
- } | {
103
- path: string;
104
- git: string;
105
- ref: string;
106
- commit?: string | undefined;
107
- }>;
108
- cacheDir: string;
109
- constraints?: string | undefined;
110
- }, {
111
- targets?: ("claude" | "codex" | "copilot")[] | undefined;
112
- agentsDir?: string | undefined;
113
- sharedDir?: string | undefined;
114
- exclude?: string[] | undefined;
115
- namePrefix?: string | undefined;
116
- constraints?: string | undefined;
117
- blocksDir?: string | undefined;
118
- blockNumberFloor?: number | undefined;
119
- resources?: Record<string, {
120
- path: string;
121
- } | {
122
- git: string;
123
- ref: string;
124
- path?: string | undefined;
125
- commit?: string | undefined;
126
- }> | undefined;
127
- cacheDir?: string | undefined;
128
- }>;
52
+ }, z.core.$strict>;
129
53
  export type ProjectFile = z.infer<typeof ProjectFileSchema>;
130
54
  /** A project with every path made absolute. */
131
55
  export interface Project {
@@ -1 +1 @@
1
- {"version":3,"file":"project.d.ts","sourceRoot":"","sources":["../src/project.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB;;;;;;;;;;GAUG;AAEH,eAAO,MAAM,OAAO,yCAA0C,CAAC;AAC/D,eAAO,MAAM,YAAY,2CAAkB,CAAC;AAC5C,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAElD,oFAAoF;AACpF,eAAO,MAAM,cAAc;;;;;;;;IAKrB,kFAAkF;;IAElF,0EAA0E;;IAE1E,gEAAgE;;;;;;;;;;;;IAIpE,CAAC;AACH,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAItD,eAAO,MAAM,iBAAiB;IAE1B,mFAAmF;;IAEnF,qEAAqE;;IAErE,4DAA4D;;IAE5D,2FAA2F;;IAE3F;;;;OAIG;;IAEH,2FAA2F;;IAE3F,4EAA4E;;IAE5E,2CAA2C;;IAE3C,kEAAkE;;;;;;;;;QAnChE,kFAAkF;;QAElF,0EAA0E;;QAE1E,gEAAgE;;;;;;;;;;;;;IAiClE,qEAAqE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAG9D,CAAC;AACZ,MAAM,MAAM,WAA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;;;;;;;;;;;;;;;;kBA2BnB,CAAC;AACZ,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE5D,+CAA+C;AAC/C,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,gBAAgB,EAAE,MAAM,CAAC;IACzB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IACpC,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,eAAO,MAAM,YAAY,kBAAkB,CAAC;AAI5C,kEAAkE;AAClE,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAM,GAAG,OAAO,CAyB7G;AAED,qEAAqE;AACrE,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAUjD"}
package/dist/project.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import { existsSync, readFileSync } from 'node:fs';
2
2
  import { dirname, isAbsolute, join, resolve } from 'node:path';
3
3
  import { z } from 'zod';
4
+ import { formatIssues } from './issues.js';
4
5
  import { RuleLoomError } from './errors.js';
5
6
  /**
6
7
  * The project around the agents: where they live, what they share, and the
@@ -65,7 +66,7 @@ const absolute = (base, path) => (isAbsolute(path) ? path : resolve(base, path))
65
66
  export function defineProject(root, options = {}) {
66
67
  const parsed = ProjectFileSchema.safeParse(options);
67
68
  if (!parsed.success) {
68
- throw new RuleLoomError('PROJECT_CONFIG_INVALID', parsed.error.issues.map((issue) => `${issue.path.join('.') || '(root)'}: ${issue.message}`).join(' | '));
69
+ throw new RuleLoomError('PROJECT_CONFIG_INVALID', formatIssues(parsed.error.issues));
69
70
  }
70
71
  const file = parsed.data;
71
72
  const base = resolve(root);
@@ -1 +1 @@
1
- {"version":3,"file":"project.js","sourceRoot":"","sources":["../src/project.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC/D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C;;;;;;;;;;GAUG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,QAAQ,EAAE,OAAO,EAAE,SAAS,CAAU,CAAC;AAC/D,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AAG5C,oFAAoF;AACpF,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC;IACpC,CAAC,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE;IAC9C,CAAC;SACE,MAAM,CAAC;QACN,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;QACtB,kFAAkF;QAClF,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;QACtB,0EAA0E;QAC1E,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC,QAAQ,EAAE;QACvD,gEAAgE;QAChE,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,GA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AAI,CAAC,UAAU,CAAC,IAAI,CAAC;QAAE,OAAO,aAAa,CAAC,IAAI,CAAC,CAAC;IAClD,IAAI,GAAY,CAAC;IACjB,IAAI,CAAC;QACH,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;IAC/C,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,aAAa,CAAC,2BAA2B,EAAE,GAAG,IAAI,MAAO,KAAe,CAAC,OAAO,EAAE,CAAC,CAAC;IAChG,CAAC;IACD,OAAO,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,GAAiD,CAAC,CAAC;AACzF,CAAC"}
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ruleloom",
3
- "version": "0.1.0",
3
+ "version": "0.2.1",
4
4
  "description": "Define an AI agent once — rules, skills, MCP servers, variables — and compile it into the native configuration of Claude Code, OpenAI Codex and GitHub Copilot.",
5
5
  "keywords": [
6
6
  "ai-agents",
@@ -43,7 +43,7 @@
43
43
  "prepublishOnly": "npm run typecheck && npm test && npm run build"
44
44
  },
45
45
  "dependencies": {
46
- "zod": "^3.24.1"
46
+ "zod": "^4.6.6"
47
47
  },
48
48
  "devDependencies": {
49
49
  "@types/node": "^22.10.0",