agent-contracts 0.16.1 → 0.17.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.
@@ -0,0 +1,453 @@
1
+ # agent-contracts CLI
2
+
3
+ Declarative YAML DSL toolkit for defining, validating, and rendering multi-agent development workflows. Provides static validation, semantic linting, prompt rendering, guardrail generation, and completeness scoring for agent contract definitions.
4
+
5
+ **Version:** 0.16.2
6
+
7
+ ## Table of Contents
8
+
9
+ - [agent-contracts](#agent-contracts)
10
+ - [resolve](#agent-contracts-resolve)
11
+ - [validate](#agent-contracts-validate)
12
+ - [lint](#agent-contracts-lint)
13
+ - [render](#agent-contracts-render)
14
+ - [check](#agent-contracts-check)
15
+ - [score](#agent-contracts-score)
16
+ - [generate](#agent-contracts-generate)
17
+
18
+ ---
19
+
20
+ ## agent-contracts
21
+
22
+ Agent contracts tooling — validate, lint, render DSL files.
23
+
24
+ ### Global Options
25
+
26
+ | Option | Aliases | Required | Default | Description |
27
+ |---|---|---|---|---|
28
+ | `--version` | -V | No | | Print version and exit. |
29
+ | `--help` | -h | No | | Show help and exit. |
30
+
31
+ ### resolve
32
+
33
+ Resolve DSL (load + merge extends) and output YAML.
34
+
35
+ Loads the agent-contracts DSL file, merges all extends inheritance chains, substitutes variables from config, and outputs the fully resolved result as YAML or JSON.
36
+
37
+ **Usage:**
38
+
39
+ ```
40
+ agent-contracts resolve
41
+ ```
42
+ ```
43
+ agent-contracts resolve path/to/agent-contracts.yaml
44
+ ```
45
+ ```
46
+ agent-contracts resolve --format json
47
+ ```
48
+ ```
49
+ agent-contracts resolve --expand-defaults
50
+ ```
51
+ ```
52
+ agent-contracts resolve -c agent-contracts.config.yaml
53
+ ```
54
+
55
+ #### Arguments
56
+
57
+ | Name | Required | Description |
58
+ |---|---|---|
59
+ | `dir` | No | Path to agent-contracts.yaml. |
60
+
61
+ #### Options
62
+
63
+ | Option | Aliases | Required | Default | Description |
64
+ |---|---|---|---|---|
65
+ | `--config` | -c | No | | Path to agent-contracts.config.yaml. |
66
+ | `--team` | | No | | Limit to one team (multi-team config only). |
67
+ | `--format` | | No | `"text"` | Output format. |
68
+ | `--expand-defaults` | | No | `false` | Expand all Zod default values in output. Fields like required_validations, tags, and can_read_artifacts are written explicitly instead of relying on schema defaults. |
69
+
70
+ #### Exit Codes
71
+
72
+ **Exit 0:** Resolved DSL output successfully.
73
+
74
+ - **stdout:** format=`text`
75
+
76
+ **Exit 1:** Resolution failed (file not found, parse error, or config error).
77
+
78
+ - **stderr:** format=`text`
79
+
80
+ #### Extensions
81
+
82
+ ```yaml
83
+ x-agent:
84
+ riskLevel: low
85
+ requiresConfirmation: false
86
+ idempotent: true
87
+ sideEffects:
88
+
89
+ ```
90
+
91
+ ---
92
+
93
+ ### validate
94
+
95
+ Validate DSL against schema and check references.
96
+
97
+ Validates the resolved DSL against the Zod schema, checks inter-entity references (agent→task, task→artifact, etc.), and validates handoff schemas. Reports diagnostics with severity levels.
98
+
99
+ **Usage:**
100
+
101
+ ```
102
+ agent-contracts validate
103
+ ```
104
+ ```
105
+ agent-contracts validate path/to/agent-contracts.yaml
106
+ ```
107
+ ```
108
+ agent-contracts validate --strict
109
+ ```
110
+ ```
111
+ agent-contracts validate --format json
112
+ ```
113
+ ```
114
+ agent-contracts validate --quiet
115
+ ```
116
+
117
+ #### Arguments
118
+
119
+ | Name | Required | Description |
120
+ |---|---|---|
121
+ | `dir` | No | Path to agent-contracts.yaml. |
122
+
123
+ #### Options
124
+
125
+ | Option | Aliases | Required | Default | Description |
126
+ |---|---|---|---|---|
127
+ | `--config` | -c | No | | Path to agent-contracts.config.yaml. |
128
+ | `--team` | | No | | Limit to one team (multi-team config only). |
129
+ | `--format` | | No | `"text"` | Diagnostic output format. |
130
+ | `--quiet` | | No | `false` | Suppress output on success. |
131
+ | `--strict` | | No | `false` | Treat warnings as errors. |
132
+
133
+ #### Exit Codes
134
+
135
+ **Exit 0:** Validation passed. No errors found.
136
+
137
+ - **stdout:** format=`text`
138
+
139
+ **Exit 1:** Validation failed or unexpected error.
140
+
141
+ - **stderr:** format=`text`
142
+
143
+ #### Extensions
144
+
145
+ ```yaml
146
+ x-agent:
147
+ riskLevel: low
148
+ requiresConfirmation: false
149
+ idempotent: true
150
+ sideEffects:
151
+
152
+ ```
153
+
154
+ ---
155
+
156
+ ### lint
157
+
158
+ Run semantic lint rules on resolved DSL.
159
+
160
+ Runs TypeScript-based semantic lint rules and Spectral rules on the resolved DSL. Checks for best-practice violations, naming conventions, and structural issues beyond schema conformance.
161
+
162
+ **Usage:**
163
+
164
+ ```
165
+ agent-contracts lint
166
+ ```
167
+ ```
168
+ agent-contracts lint path/to/agent-contracts.yaml
169
+ ```
170
+ ```
171
+ agent-contracts lint --strict
172
+ ```
173
+ ```
174
+ agent-contracts lint --format json
175
+ ```
176
+
177
+ #### Arguments
178
+
179
+ | Name | Required | Description |
180
+ |---|---|---|
181
+ | `dir` | No | Path to agent-contracts.yaml. |
182
+
183
+ #### Options
184
+
185
+ | Option | Aliases | Required | Default | Description |
186
+ |---|---|---|---|---|
187
+ | `--config` | -c | No | | Path to agent-contracts.config.yaml. |
188
+ | `--team` | | No | | Limit to one team (multi-team config only). |
189
+ | `--format` | | No | `"text"` | Output format. |
190
+ | `--quiet` | | No | `false` | Suppress output on success. |
191
+ | `--strict` | | No | `false` | Treat warnings as errors. |
192
+
193
+ #### Exit Codes
194
+
195
+ **Exit 0:** Lint passed. No errors or warnings.
196
+
197
+ - **stdout:** format=`text`
198
+
199
+ **Exit 1:** Lint failed or unexpected error.
200
+
201
+ - **stderr:** format=`text`
202
+
203
+ #### Extensions
204
+
205
+ ```yaml
206
+ x-agent:
207
+ riskLevel: low
208
+ requiresConfirmation: false
209
+ idempotent: true
210
+ sideEffects:
211
+
212
+ ```
213
+
214
+ ---
215
+
216
+ ### render
217
+
218
+ Render resolved DSL with Handlebars templates.
219
+
220
+ Renders output files from the resolved DSL using Handlebars templates configured in agent-contracts.config.yaml. Supports drift detection via --check mode. Requires a config file.
221
+
222
+ **Usage:**
223
+
224
+ ```
225
+ agent-contracts render -c agent-contracts.config.yaml
226
+ ```
227
+ ```
228
+ agent-contracts render -c agent-contracts.config.yaml --check
229
+ ```
230
+ ```
231
+ agent-contracts render --quiet
232
+ ```
233
+
234
+ #### Options
235
+
236
+ | Option | Aliases | Required | Default | Description |
237
+ |---|---|---|---|---|
238
+ | `--config` | -c | No | | Path to agent-contracts.config.yaml. |
239
+ | `--team` | | No | | Limit to one team (multi-team config only). |
240
+ | `--check` | | No | `false` | Check for drift without writing files. |
241
+ | `--quiet` | | No | `false` | Suppress output on success. |
242
+
243
+ #### Exit Codes
244
+
245
+ **Exit 0:** Render succeeded (or no drift detected in --check mode).
246
+
247
+ - **stdout:** format=`text`
248
+
249
+ **Exit 1:** Render failed, config not found, schema validation failed, or drift detected in --check mode.
250
+
251
+ - **stderr:** format=`text`
252
+
253
+ #### Extensions
254
+
255
+ ```yaml
256
+ x-agent:
257
+ riskLevel: medium
258
+ requiresConfirmation: false
259
+ idempotent: true
260
+ sideEffects:
261
+ - file_write
262
+ recommendedBeforeUse:
263
+ - Ensure agent-contracts.config.yaml exists with render targets.
264
+ - Run validate first to confirm DSL is valid.
265
+ ```
266
+
267
+ ---
268
+
269
+ ### check
270
+
271
+ Run full pipeline — resolve, validate, lint, render --check.
272
+
273
+ Executes the complete verification pipeline in order: resolve DSL, validate schema and references, run lint rules, and check for render drift. Also verifies cross-team interface imports and team-interface.yaml drift when applicable.
274
+
275
+ **Usage:**
276
+
277
+ ```
278
+ agent-contracts check -c agent-contracts.config.yaml
279
+ ```
280
+ ```
281
+ agent-contracts check -c agent-contracts.config.yaml --strict
282
+ ```
283
+ ```
284
+ agent-contracts check --format json --quiet
285
+ ```
286
+
287
+ #### Options
288
+
289
+ | Option | Aliases | Required | Default | Description |
290
+ |---|---|---|---|---|
291
+ | `--config` | -c | No | | Path to agent-contracts.config.yaml. |
292
+ | `--team` | | No | | Limit to one team (multi-team config only). |
293
+ | `--format` | | No | `"text"` | Diagnostic output format. |
294
+ | `--quiet` | | No | `false` | Suppress output on success. |
295
+ | `--strict` | | No | `false` | Treat warnings as errors. |
296
+
297
+ #### Exit Codes
298
+
299
+ **Exit 0:** All checks passed.
300
+
301
+ - **stdout:** format=`text`
302
+
303
+ **Exit 1:** One or more checks failed — validation errors, lint errors, render drift, or missing interface files.
304
+
305
+ - **stderr:** format=`text`
306
+
307
+ #### Extensions
308
+
309
+ ```yaml
310
+ x-agent:
311
+ riskLevel: low
312
+ requiresConfirmation: false
313
+ idempotent: true
314
+ sideEffects:
315
+
316
+ recommendedBeforeUse:
317
+ - Ensure agent-contracts.config.yaml exists.
318
+ ```
319
+
320
+ ---
321
+
322
+ ### score
323
+
324
+ Calculate DSL completeness score.
325
+
326
+ Evaluates the resolved DSL across 7 dimensions including artifact validation coverage, task validation coverage, guardrail policy coverage, workflow validation integration, schema completeness, cross-reference bidirectionality, and guardrail scope resolution. Returns a score out of 100 with optional CI gating via --threshold.
327
+
328
+ **Usage:**
329
+
330
+ ```
331
+ agent-contracts score
332
+ ```
333
+ ```
334
+ agent-contracts score --format json
335
+ ```
336
+ ```
337
+ agent-contracts score --threshold 70
338
+ ```
339
+ ```
340
+ agent-contracts score -c agent-contracts.config.yaml
341
+ ```
342
+
343
+ #### Arguments
344
+
345
+ | Name | Required | Description |
346
+ |---|---|---|
347
+ | `dir` | No | Path to agent-contracts.yaml. |
348
+
349
+ #### Options
350
+
351
+ | Option | Aliases | Required | Default | Description |
352
+ |---|---|---|---|---|
353
+ | `--config` | -c | No | | Path to agent-contracts.config.yaml. |
354
+ | `--team` | | No | | Limit to one team (multi-team config only). |
355
+ | `--format` | | No | `"text"` | Output format. |
356
+ | `--threshold` | | No | | Minimum score; exit 1 if below (for CI gates). |
357
+
358
+ #### Exit Codes
359
+
360
+ **Exit 0:** Score calculated (and above threshold if specified).
361
+
362
+ - **stdout:** format=`text`
363
+
364
+ **Exit 1:** Score below threshold, schema validation failed, or unexpected error.
365
+
366
+ - **stderr:** format=`text`
367
+
368
+ #### Extensions
369
+
370
+ ```yaml
371
+ x-agent:
372
+ riskLevel: low
373
+ requiresConfirmation: false
374
+ idempotent: true
375
+ sideEffects:
376
+
377
+ ```
378
+
379
+ ---
380
+
381
+ ### generate
382
+
383
+ Generate guardrail or interface artifacts from DSL.
384
+
385
+ Generates runtime artifacts from the DSL. When type is "guardrails" (default), produces guardrail binding files from DSL, policies, and software bindings. When type is "interface", generates a team interface YAML/JSON file from the DSL's team_interface section.
386
+
387
+ **Usage:**
388
+
389
+ ```
390
+ agent-contracts generate -c agent-contracts.config.yaml
391
+ ```
392
+ ```
393
+ agent-contracts generate guardrails -c agent-contracts.config.yaml
394
+ ```
395
+ ```
396
+ agent-contracts generate guardrails --binding cursor-rules
397
+ ```
398
+ ```
399
+ agent-contracts generate guardrails --dry-run
400
+ ```
401
+ ```
402
+ agent-contracts generate interface -c agent-contracts.config.yaml
403
+ ```
404
+ ```
405
+ agent-contracts generate interface --format json
406
+ ```
407
+ ```
408
+ agent-contracts generate interface -o team-interface.yaml --dry-run
409
+ ```
410
+
411
+ #### Arguments
412
+
413
+ | Name | Required | Description |
414
+ |---|---|---|
415
+ | `type` | No | Type of artifacts to generate. |
416
+
417
+ #### Options
418
+
419
+ | Option | Aliases | Required | Default | Description |
420
+ |---|---|---|---|---|
421
+ | `--config` | -c | No | | Path to agent-contracts.config.yaml. |
422
+ | `--team` | | No | | Limit to one team (multi-team config only). |
423
+ | `--binding` | | No | | Filter to specific software binding(s). Guardrails type only. |
424
+ | `--output` | -o | No | | Output path for generated team interface. Interface type only. |
425
+ | `--format` | | No | `"yaml"` | Output format for team interface (yaml or json). Interface type only. |
426
+ | `--dry-run` | | No | `false` | Print what would be generated without writing files. |
427
+ | `--quiet` | | No | `false` | Suppress output on success. |
428
+
429
+ #### Exit Codes
430
+
431
+ **Exit 0:** Generation succeeded.
432
+
433
+ - **stdout:** format=`text`
434
+
435
+ **Exit 1:** Generation failed — unknown type, schema validation failed, config not found, or error-level diagnostics.
436
+
437
+ - **stderr:** format=`text`
438
+
439
+ #### Extensions
440
+
441
+ ```yaml
442
+ x-agent:
443
+ riskLevel: medium
444
+ requiresConfirmation: false
445
+ idempotent: true
446
+ sideEffects:
447
+ - file_write
448
+ recommendedBeforeUse:
449
+ - Ensure agent-contracts.config.yaml exists with binding definitions.
450
+ - Run validate first to confirm DSL is valid.
451
+ ```
452
+
453
+ ---
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-contracts",
3
- "version": "0.16.1",
3
+ "version": "0.17.0",
4
4
  "description": "Declarative YAML DSL toolkit for defining, validating, and rendering multi-agent development workflows",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -16,6 +16,8 @@
16
16
  },
17
17
  "files": [
18
18
  "dist",
19
+ "cli-contract.yaml",
20
+ "docs/cli-reference.md",
19
21
  "README.md",
20
22
  "LICENSE"
21
23
  ],
@@ -28,6 +30,7 @@
28
30
  "lint": "eslint src/ test/",
29
31
  "typecheck": "tsc --noEmit",
30
32
  "generate:schema": "tsx scripts/generate-json-schema.ts",
33
+ "generate:docs": "cli-contracts docs",
31
34
  "prepublishOnly": "npm run clean && npm run build"
32
35
  },
33
36
  "keywords": [
@@ -69,6 +72,7 @@
69
72
  "@types/node": "^25.6.0",
70
73
  "eslint": "^10.2.0",
71
74
  "globals": "^17.5.0",
75
+ "cli-contracts": "^0.2.0",
72
76
  "prettier": "^3.8.2",
73
77
  "tsup": "^8.5.1",
74
78
  "tsx": "^4.21.0",