agent-contracts 0.19.5 → 0.21.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 +12 -9
- package/cli-contract.yaml +63 -31
- package/dist/cli.js +2445 -2166
- package/dist/cli.js.map +1 -1
- package/dist/index.js +290 -9
- package/dist/index.js.map +1 -1
- package/docs/cli-reference.md +514 -27
- package/package.json +3 -3
package/docs/cli-reference.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
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
4
|
|
|
5
|
-
**Version:** 0.
|
|
5
|
+
**Version:** 0.21.0
|
|
6
6
|
|
|
7
7
|
## Table of Contents
|
|
8
8
|
|
|
@@ -72,7 +72,7 @@ agent-contracts resolve -c agent-contracts.config.yaml
|
|
|
72
72
|
|
|
73
73
|
**Exit 0:** Resolved DSL output successfully.
|
|
74
74
|
|
|
75
|
-
- **stdout:** format=`
|
|
75
|
+
- **stdout:** format=`{options.format}`
|
|
76
76
|
|
|
77
77
|
**Exit 1:** Resolution failed (file not found, parse error, or config error).
|
|
78
78
|
|
|
@@ -87,6 +87,9 @@ x-agent:
|
|
|
87
87
|
idempotent: true
|
|
88
88
|
sideEffects:
|
|
89
89
|
|
|
90
|
+
expectedDurationMs: 3000
|
|
91
|
+
retryableExitCodes:
|
|
92
|
+
|
|
90
93
|
```
|
|
91
94
|
|
|
92
95
|
---
|
|
@@ -135,7 +138,7 @@ agent-contracts validate --quiet
|
|
|
135
138
|
|
|
136
139
|
**Exit 0:** Validation passed. No errors found.
|
|
137
140
|
|
|
138
|
-
- **stdout:** format=`
|
|
141
|
+
- **stdout:** format=`{options.format}`
|
|
139
142
|
|
|
140
143
|
**Exit 1:** Validation failed or unexpected error.
|
|
141
144
|
|
|
@@ -150,6 +153,9 @@ x-agent:
|
|
|
150
153
|
idempotent: true
|
|
151
154
|
sideEffects:
|
|
152
155
|
|
|
156
|
+
expectedDurationMs: 3000
|
|
157
|
+
retryableExitCodes:
|
|
158
|
+
|
|
153
159
|
```
|
|
154
160
|
|
|
155
161
|
---
|
|
@@ -195,7 +201,7 @@ agent-contracts lint --format json
|
|
|
195
201
|
|
|
196
202
|
**Exit 0:** Lint passed. No errors or warnings.
|
|
197
203
|
|
|
198
|
-
- **stdout:** format=`
|
|
204
|
+
- **stdout:** format=`{options.format}`
|
|
199
205
|
|
|
200
206
|
**Exit 1:** Lint failed or unexpected error.
|
|
201
207
|
|
|
@@ -210,15 +216,21 @@ x-agent:
|
|
|
210
216
|
idempotent: true
|
|
211
217
|
sideEffects:
|
|
212
218
|
|
|
219
|
+
expectedDurationMs: 3000
|
|
220
|
+
retryableExitCodes:
|
|
221
|
+
|
|
213
222
|
```
|
|
214
223
|
|
|
215
224
|
---
|
|
216
225
|
|
|
217
226
|
### render
|
|
218
227
|
|
|
219
|
-
|
|
228
|
+
(deprecated) Alias for 'generate templates'.
|
|
229
|
+
|
|
230
|
+
Deprecated alias for 'agent-contracts generate templates'. Renders output files from the resolved DSL using Handlebars templates and emits a deprecation warning. Supports --check for drift detection. Requires a config file.
|
|
220
231
|
|
|
221
|
-
|
|
232
|
+
> **Deprecated**: Use 'agent-contracts generate templates' instead.
|
|
233
|
+
> Use `generate templates` instead.
|
|
222
234
|
|
|
223
235
|
**Usage:**
|
|
224
236
|
|
|
@@ -238,16 +250,16 @@ agent-contracts render --quiet
|
|
|
238
250
|
|---|---|---|---|---|
|
|
239
251
|
| `--config` | -c | No | | Path to agent-contracts.config.yaml. |
|
|
240
252
|
| `--team` | | No | | Limit to one team (multi-team config only). |
|
|
241
|
-
| `--check` | | No | `false` | Check for drift without writing files. |
|
|
253
|
+
| `--check` | | No | `false` | Check for template drift without writing files. |
|
|
242
254
|
| `--quiet` | | No | `false` | Suppress output on success. |
|
|
243
255
|
|
|
244
256
|
#### Exit Codes
|
|
245
257
|
|
|
246
|
-
**Exit 0:**
|
|
258
|
+
**Exit 0:** Generation succeeded (or no drift detected in --check mode).
|
|
247
259
|
|
|
248
260
|
- **stdout:** format=`text`
|
|
249
261
|
|
|
250
|
-
**Exit 1:**
|
|
262
|
+
**Exit 1:** Generation failed, config not found, schema validation failed, or drift detected in --check mode.
|
|
251
263
|
|
|
252
264
|
- **stderr:** format=`text`
|
|
253
265
|
|
|
@@ -258,11 +270,17 @@ x-agent:
|
|
|
258
270
|
riskLevel: medium
|
|
259
271
|
requiresConfirmation: false
|
|
260
272
|
idempotent: true
|
|
273
|
+
idempotentNote: Output is deterministic from DSL input and templates. Repeated runs produce identical files. This is a deprecated alias; prefer 'generate templates'.
|
|
261
274
|
sideEffects:
|
|
262
275
|
- file_write
|
|
276
|
+
sideEffectNote: Writes rendered files to configured output paths. No file writes occur when --check is specified.
|
|
277
|
+
safeDryRunOption: check
|
|
263
278
|
recommendedBeforeUse:
|
|
264
279
|
- Ensure agent-contracts.config.yaml exists with render targets.
|
|
265
280
|
- Run validate first to confirm DSL is valid.
|
|
281
|
+
expectedDurationMs: 5000
|
|
282
|
+
retryableExitCodes:
|
|
283
|
+
|
|
266
284
|
```
|
|
267
285
|
|
|
268
286
|
---
|
|
@@ -271,7 +289,7 @@ x-agent:
|
|
|
271
289
|
|
|
272
290
|
Run full pipeline — resolve, validate, lint, render --check.
|
|
273
291
|
|
|
274
|
-
Executes the complete verification pipeline in order: resolve DSL, validate schema and references, run lint rules,
|
|
292
|
+
Executes the complete verification pipeline in order: (1) resolve DSL, (2) validate schema and references, (3) run lint rules, (4) check render drift via render --check. Steps 1–4 always run. Additionally, when the DSL declares cross-team interfaces, (5) verifies interface import consistency and (6) checks team-interface.yaml drift. Steps 5–6 are skipped when no cross-team interfaces exist.
|
|
275
293
|
|
|
276
294
|
**Usage:**
|
|
277
295
|
|
|
@@ -299,7 +317,7 @@ agent-contracts check --format json --quiet
|
|
|
299
317
|
|
|
300
318
|
**Exit 0:** All checks passed.
|
|
301
319
|
|
|
302
|
-
- **stdout:** format=`
|
|
320
|
+
- **stdout:** format=`{options.format}`
|
|
303
321
|
|
|
304
322
|
**Exit 1:** One or more checks failed — validation errors, lint errors, render drift, or missing interface files.
|
|
305
323
|
|
|
@@ -316,6 +334,9 @@ x-agent:
|
|
|
316
334
|
|
|
317
335
|
recommendedBeforeUse:
|
|
318
336
|
- Ensure agent-contracts.config.yaml exists.
|
|
337
|
+
expectedDurationMs: 10000
|
|
338
|
+
retryableExitCodes:
|
|
339
|
+
|
|
319
340
|
```
|
|
320
341
|
|
|
321
342
|
---
|
|
@@ -360,7 +381,7 @@ agent-contracts score -c agent-contracts.config.yaml
|
|
|
360
381
|
|
|
361
382
|
**Exit 0:** Score calculated (and above threshold if specified).
|
|
362
383
|
|
|
363
|
-
- **stdout:** format=`
|
|
384
|
+
- **stdout:** format=`{options.format}`
|
|
364
385
|
|
|
365
386
|
**Exit 1:** Score below threshold, schema validation failed, or unexpected error.
|
|
366
387
|
|
|
@@ -375,6 +396,9 @@ x-agent:
|
|
|
375
396
|
idempotent: true
|
|
376
397
|
sideEffects:
|
|
377
398
|
|
|
399
|
+
expectedDurationMs: 5000
|
|
400
|
+
retryableExitCodes:
|
|
401
|
+
|
|
378
402
|
```
|
|
379
403
|
|
|
380
404
|
---
|
|
@@ -426,22 +450,463 @@ agent-contracts audit dsl --scope agents:architect,implementer -c config.yaml
|
|
|
426
450
|
| `--dry-run` | | No | `false` | Output the audit prompt without calling LLM. |
|
|
427
451
|
| `--adapter` | | No | | SDK adapter to use for LLM calls (overrides config audit.adapter). |
|
|
428
452
|
| `--model` | | No | | LLM model override (overrides config audit.model). |
|
|
453
|
+
| `--fail-on` | | No | `"critical"` | Minimum finding severity that causes exit 10 (info|warning|error|critical). |
|
|
454
|
+
| `--output` | -o | No | | Write result to a file instead of stdout. |
|
|
455
|
+
| `--report-format` | | No | `"text"` | Alias for --format. When both are specified, --report-format takes precedence. |
|
|
429
456
|
|
|
430
457
|
#### Exit Codes
|
|
431
458
|
|
|
432
|
-
**Exit 0:** No
|
|
459
|
+
**Exit 0:** Audit succeeded. No findings at or above --fail-on threshold.
|
|
460
|
+
|
|
461
|
+
- **stdout:** format=`{options.format}`
|
|
462
|
+
|
|
463
|
+
| Property | Type | Required | Description |
|
|
464
|
+
|---|---|---|---|
|
|
465
|
+
| `summary` | `string` | Yes | |
|
|
466
|
+
| `riskLevel` | `"low" \| "medium" \| "high" \| "critical"` | Yes | |
|
|
467
|
+
| `findings` | `object[]` | Yes | |
|
|
468
|
+
| `findings[].id` | `string` | No | Unique finding identifier. |
|
|
469
|
+
| `findings[].severity` | `"info" \| "warning" \| "error" \| "critical"` | Yes | |
|
|
470
|
+
| `findings[].category` | `string` | Yes | Finding category (e.g. missing-policy, inconsistent-risk). |
|
|
471
|
+
| `findings[].target` | `string` | No | Target of the finding (command ID, schema path). |
|
|
472
|
+
| `findings[].location` | `string` | No | Location within the target. |
|
|
473
|
+
| `findings[].message` | `string` | Yes | |
|
|
474
|
+
| `findings[].recommendation` | `string` | No | |
|
|
475
|
+
| `findings[].confidence` | `number (min: 0, max: 1)` | No | Confidence score (0-1) for LLM-generated findings. |
|
|
476
|
+
| `findings[].evidence` | `object[]` | No | |
|
|
477
|
+
| `findings[].evidence[].kind` | `enum(7 values)` | Yes | |
|
|
478
|
+
| `findings[].evidence[].target` | `string` | No | Target identifier (file path, command ID, schema name). |
|
|
479
|
+
| `findings[].evidence[].location` | `string` | No | Location within the target (line number, JSON pointer). |
|
|
480
|
+
| `findings[].evidence[].excerpt` | `string` | No | Relevant excerpt from the target. |
|
|
481
|
+
| `findings[].details` | `Record<string, any>` | No | |
|
|
482
|
+
| `recommendedActions` | `object[]` | No | |
|
|
483
|
+
| `recommendedActions[].kind` | `enum(6 values)` | Yes | |
|
|
484
|
+
| `recommendedActions[].title` | `string` | Yes | |
|
|
485
|
+
| `recommendedActions[].command` | `string` | No | CLI command to run (for run_command kind). |
|
|
486
|
+
| `recommendedActions[].target` | `string` | No | Target file or resource. |
|
|
487
|
+
| `recommendedActions[].rationale` | `string` | No | |
|
|
488
|
+
| `metadata` | `object` | No | |
|
|
489
|
+
| `metadata.tool` | `string` | No | |
|
|
490
|
+
| `metadata.command` | `string` | No | |
|
|
491
|
+
| `metadata.version` | `string` | No | |
|
|
492
|
+
| `metadata.generatedAt` | `string` | No | |
|
|
493
|
+
| `metadata.adapter` | `string` | No | |
|
|
494
|
+
| `metadata.model` | `string` | No | |
|
|
495
|
+
|
|
496
|
+
<details>
|
|
497
|
+
<summary>JSON Schema</summary>
|
|
498
|
+
|
|
499
|
+
```json
|
|
500
|
+
{
|
|
501
|
+
"type": "object",
|
|
502
|
+
"description": "Top-level result from an agent audit. Canonical schema for agent interoperability across toolchains.",
|
|
503
|
+
"required": [
|
|
504
|
+
"summary",
|
|
505
|
+
"riskLevel",
|
|
506
|
+
"findings"
|
|
507
|
+
],
|
|
508
|
+
"properties": {
|
|
509
|
+
"summary": {
|
|
510
|
+
"type": "string"
|
|
511
|
+
},
|
|
512
|
+
"riskLevel": {
|
|
513
|
+
"type": "string",
|
|
514
|
+
"enum": [
|
|
515
|
+
"low",
|
|
516
|
+
"medium",
|
|
517
|
+
"high",
|
|
518
|
+
"critical"
|
|
519
|
+
]
|
|
520
|
+
},
|
|
521
|
+
"findings": {
|
|
522
|
+
"type": "array",
|
|
523
|
+
"items": {
|
|
524
|
+
"type": "object",
|
|
525
|
+
"description": "A single finding from an agent audit or analysis.",
|
|
526
|
+
"required": [
|
|
527
|
+
"severity",
|
|
528
|
+
"category",
|
|
529
|
+
"message"
|
|
530
|
+
],
|
|
531
|
+
"properties": {
|
|
532
|
+
"id": {
|
|
533
|
+
"type": "string",
|
|
534
|
+
"description": "Unique finding identifier."
|
|
535
|
+
},
|
|
536
|
+
"severity": {
|
|
537
|
+
"type": "string",
|
|
538
|
+
"enum": [
|
|
539
|
+
"info",
|
|
540
|
+
"warning",
|
|
541
|
+
"error",
|
|
542
|
+
"critical"
|
|
543
|
+
]
|
|
544
|
+
},
|
|
545
|
+
"category": {
|
|
546
|
+
"type": "string",
|
|
547
|
+
"description": "Finding category (e.g. missing-policy, inconsistent-risk)."
|
|
548
|
+
},
|
|
549
|
+
"target": {
|
|
550
|
+
"type": "string",
|
|
551
|
+
"description": "Target of the finding (command ID, schema path)."
|
|
552
|
+
},
|
|
553
|
+
"location": {
|
|
554
|
+
"type": "string",
|
|
555
|
+
"description": "Location within the target."
|
|
556
|
+
},
|
|
557
|
+
"message": {
|
|
558
|
+
"type": "string"
|
|
559
|
+
},
|
|
560
|
+
"recommendation": {
|
|
561
|
+
"type": "string"
|
|
562
|
+
},
|
|
563
|
+
"confidence": {
|
|
564
|
+
"type": "number",
|
|
565
|
+
"minimum": 0,
|
|
566
|
+
"maximum": 1,
|
|
567
|
+
"description": "Confidence score (0-1) for LLM-generated findings."
|
|
568
|
+
},
|
|
569
|
+
"evidence": {
|
|
570
|
+
"type": "array",
|
|
571
|
+
"items": {
|
|
572
|
+
"type": "object",
|
|
573
|
+
"description": "Evidence supporting an agent finding.",
|
|
574
|
+
"required": [
|
|
575
|
+
"kind"
|
|
576
|
+
],
|
|
577
|
+
"properties": {
|
|
578
|
+
"kind": {
|
|
579
|
+
"type": "string",
|
|
580
|
+
"enum": [
|
|
581
|
+
"file",
|
|
582
|
+
"command",
|
|
583
|
+
"schema",
|
|
584
|
+
"diff",
|
|
585
|
+
"stdout",
|
|
586
|
+
"stderr",
|
|
587
|
+
"text"
|
|
588
|
+
]
|
|
589
|
+
},
|
|
590
|
+
"target": {
|
|
591
|
+
"type": "string",
|
|
592
|
+
"description": "Target identifier (file path, command ID, schema name)."
|
|
593
|
+
},
|
|
594
|
+
"location": {
|
|
595
|
+
"type": "string",
|
|
596
|
+
"description": "Location within the target (line number, JSON pointer)."
|
|
597
|
+
},
|
|
598
|
+
"excerpt": {
|
|
599
|
+
"type": "string",
|
|
600
|
+
"description": "Relevant excerpt from the target."
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
},
|
|
605
|
+
"details": {
|
|
606
|
+
"type": "object",
|
|
607
|
+
"additionalProperties": true
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
},
|
|
612
|
+
"recommendedActions": {
|
|
613
|
+
"type": "array",
|
|
614
|
+
"items": {
|
|
615
|
+
"type": "object",
|
|
616
|
+
"description": "A recommended action from an agent audit.",
|
|
617
|
+
"required": [
|
|
618
|
+
"kind",
|
|
619
|
+
"title"
|
|
620
|
+
],
|
|
621
|
+
"properties": {
|
|
622
|
+
"kind": {
|
|
623
|
+
"type": "string",
|
|
624
|
+
"enum": [
|
|
625
|
+
"run_command",
|
|
626
|
+
"edit_file",
|
|
627
|
+
"review",
|
|
628
|
+
"confirm",
|
|
629
|
+
"block",
|
|
630
|
+
"ignore"
|
|
631
|
+
]
|
|
632
|
+
},
|
|
633
|
+
"title": {
|
|
634
|
+
"type": "string"
|
|
635
|
+
},
|
|
636
|
+
"command": {
|
|
637
|
+
"type": "string",
|
|
638
|
+
"description": "CLI command to run (for run_command kind)."
|
|
639
|
+
},
|
|
640
|
+
"target": {
|
|
641
|
+
"type": "string",
|
|
642
|
+
"description": "Target file or resource."
|
|
643
|
+
},
|
|
644
|
+
"rationale": {
|
|
645
|
+
"type": "string"
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
}
|
|
649
|
+
},
|
|
650
|
+
"metadata": {
|
|
651
|
+
"type": "object",
|
|
652
|
+
"properties": {
|
|
653
|
+
"tool": {
|
|
654
|
+
"type": "string"
|
|
655
|
+
},
|
|
656
|
+
"command": {
|
|
657
|
+
"type": "string"
|
|
658
|
+
},
|
|
659
|
+
"version": {
|
|
660
|
+
"type": "string"
|
|
661
|
+
},
|
|
662
|
+
"generatedAt": {
|
|
663
|
+
"type": "string"
|
|
664
|
+
},
|
|
665
|
+
"adapter": {
|
|
666
|
+
"type": "string"
|
|
667
|
+
},
|
|
668
|
+
"model": {
|
|
669
|
+
"type": "string"
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
```
|
|
676
|
+
|
|
677
|
+
</details>
|
|
678
|
+
|
|
679
|
+
**Exit 1:** Unexpected error (invalid input, config error, or internal failure).
|
|
433
680
|
|
|
434
|
-
- **
|
|
681
|
+
- **stderr:** format=`text`
|
|
435
682
|
|
|
436
|
-
**Exit
|
|
683
|
+
**Exit 10:** Findings at or above --fail-on severity threshold detected.
|
|
684
|
+
|
|
685
|
+
- **stdout:** format=`{options.format}`
|
|
686
|
+
|
|
687
|
+
| Property | Type | Required | Description |
|
|
688
|
+
|---|---|---|---|
|
|
689
|
+
| `summary` | `string` | Yes | |
|
|
690
|
+
| `riskLevel` | `"low" \| "medium" \| "high" \| "critical"` | Yes | |
|
|
691
|
+
| `findings` | `object[]` | Yes | |
|
|
692
|
+
| `findings[].id` | `string` | No | Unique finding identifier. |
|
|
693
|
+
| `findings[].severity` | `"info" \| "warning" \| "error" \| "critical"` | Yes | |
|
|
694
|
+
| `findings[].category` | `string` | Yes | Finding category (e.g. missing-policy, inconsistent-risk). |
|
|
695
|
+
| `findings[].target` | `string` | No | Target of the finding (command ID, schema path). |
|
|
696
|
+
| `findings[].location` | `string` | No | Location within the target. |
|
|
697
|
+
| `findings[].message` | `string` | Yes | |
|
|
698
|
+
| `findings[].recommendation` | `string` | No | |
|
|
699
|
+
| `findings[].confidence` | `number (min: 0, max: 1)` | No | Confidence score (0-1) for LLM-generated findings. |
|
|
700
|
+
| `findings[].evidence` | `object[]` | No | |
|
|
701
|
+
| `findings[].evidence[].kind` | `enum(7 values)` | Yes | |
|
|
702
|
+
| `findings[].evidence[].target` | `string` | No | Target identifier (file path, command ID, schema name). |
|
|
703
|
+
| `findings[].evidence[].location` | `string` | No | Location within the target (line number, JSON pointer). |
|
|
704
|
+
| `findings[].evidence[].excerpt` | `string` | No | Relevant excerpt from the target. |
|
|
705
|
+
| `findings[].details` | `Record<string, any>` | No | |
|
|
706
|
+
| `recommendedActions` | `object[]` | No | |
|
|
707
|
+
| `recommendedActions[].kind` | `enum(6 values)` | Yes | |
|
|
708
|
+
| `recommendedActions[].title` | `string` | Yes | |
|
|
709
|
+
| `recommendedActions[].command` | `string` | No | CLI command to run (for run_command kind). |
|
|
710
|
+
| `recommendedActions[].target` | `string` | No | Target file or resource. |
|
|
711
|
+
| `recommendedActions[].rationale` | `string` | No | |
|
|
712
|
+
| `metadata` | `object` | No | |
|
|
713
|
+
| `metadata.tool` | `string` | No | |
|
|
714
|
+
| `metadata.command` | `string` | No | |
|
|
715
|
+
| `metadata.version` | `string` | No | |
|
|
716
|
+
| `metadata.generatedAt` | `string` | No | |
|
|
717
|
+
| `metadata.adapter` | `string` | No | |
|
|
718
|
+
| `metadata.model` | `string` | No | |
|
|
719
|
+
|
|
720
|
+
<details>
|
|
721
|
+
<summary>JSON Schema</summary>
|
|
722
|
+
|
|
723
|
+
```json
|
|
724
|
+
{
|
|
725
|
+
"type": "object",
|
|
726
|
+
"description": "Top-level result from an agent audit. Canonical schema for agent interoperability across toolchains.",
|
|
727
|
+
"required": [
|
|
728
|
+
"summary",
|
|
729
|
+
"riskLevel",
|
|
730
|
+
"findings"
|
|
731
|
+
],
|
|
732
|
+
"properties": {
|
|
733
|
+
"summary": {
|
|
734
|
+
"type": "string"
|
|
735
|
+
},
|
|
736
|
+
"riskLevel": {
|
|
737
|
+
"type": "string",
|
|
738
|
+
"enum": [
|
|
739
|
+
"low",
|
|
740
|
+
"medium",
|
|
741
|
+
"high",
|
|
742
|
+
"critical"
|
|
743
|
+
]
|
|
744
|
+
},
|
|
745
|
+
"findings": {
|
|
746
|
+
"type": "array",
|
|
747
|
+
"items": {
|
|
748
|
+
"type": "object",
|
|
749
|
+
"description": "A single finding from an agent audit or analysis.",
|
|
750
|
+
"required": [
|
|
751
|
+
"severity",
|
|
752
|
+
"category",
|
|
753
|
+
"message"
|
|
754
|
+
],
|
|
755
|
+
"properties": {
|
|
756
|
+
"id": {
|
|
757
|
+
"type": "string",
|
|
758
|
+
"description": "Unique finding identifier."
|
|
759
|
+
},
|
|
760
|
+
"severity": {
|
|
761
|
+
"type": "string",
|
|
762
|
+
"enum": [
|
|
763
|
+
"info",
|
|
764
|
+
"warning",
|
|
765
|
+
"error",
|
|
766
|
+
"critical"
|
|
767
|
+
]
|
|
768
|
+
},
|
|
769
|
+
"category": {
|
|
770
|
+
"type": "string",
|
|
771
|
+
"description": "Finding category (e.g. missing-policy, inconsistent-risk)."
|
|
772
|
+
},
|
|
773
|
+
"target": {
|
|
774
|
+
"type": "string",
|
|
775
|
+
"description": "Target of the finding (command ID, schema path)."
|
|
776
|
+
},
|
|
777
|
+
"location": {
|
|
778
|
+
"type": "string",
|
|
779
|
+
"description": "Location within the target."
|
|
780
|
+
},
|
|
781
|
+
"message": {
|
|
782
|
+
"type": "string"
|
|
783
|
+
},
|
|
784
|
+
"recommendation": {
|
|
785
|
+
"type": "string"
|
|
786
|
+
},
|
|
787
|
+
"confidence": {
|
|
788
|
+
"type": "number",
|
|
789
|
+
"minimum": 0,
|
|
790
|
+
"maximum": 1,
|
|
791
|
+
"description": "Confidence score (0-1) for LLM-generated findings."
|
|
792
|
+
},
|
|
793
|
+
"evidence": {
|
|
794
|
+
"type": "array",
|
|
795
|
+
"items": {
|
|
796
|
+
"type": "object",
|
|
797
|
+
"description": "Evidence supporting an agent finding.",
|
|
798
|
+
"required": [
|
|
799
|
+
"kind"
|
|
800
|
+
],
|
|
801
|
+
"properties": {
|
|
802
|
+
"kind": {
|
|
803
|
+
"type": "string",
|
|
804
|
+
"enum": [
|
|
805
|
+
"file",
|
|
806
|
+
"command",
|
|
807
|
+
"schema",
|
|
808
|
+
"diff",
|
|
809
|
+
"stdout",
|
|
810
|
+
"stderr",
|
|
811
|
+
"text"
|
|
812
|
+
]
|
|
813
|
+
},
|
|
814
|
+
"target": {
|
|
815
|
+
"type": "string",
|
|
816
|
+
"description": "Target identifier (file path, command ID, schema name)."
|
|
817
|
+
},
|
|
818
|
+
"location": {
|
|
819
|
+
"type": "string",
|
|
820
|
+
"description": "Location within the target (line number, JSON pointer)."
|
|
821
|
+
},
|
|
822
|
+
"excerpt": {
|
|
823
|
+
"type": "string",
|
|
824
|
+
"description": "Relevant excerpt from the target."
|
|
825
|
+
}
|
|
826
|
+
}
|
|
827
|
+
}
|
|
828
|
+
},
|
|
829
|
+
"details": {
|
|
830
|
+
"type": "object",
|
|
831
|
+
"additionalProperties": true
|
|
832
|
+
}
|
|
833
|
+
}
|
|
834
|
+
}
|
|
835
|
+
},
|
|
836
|
+
"recommendedActions": {
|
|
837
|
+
"type": "array",
|
|
838
|
+
"items": {
|
|
839
|
+
"type": "object",
|
|
840
|
+
"description": "A recommended action from an agent audit.",
|
|
841
|
+
"required": [
|
|
842
|
+
"kind",
|
|
843
|
+
"title"
|
|
844
|
+
],
|
|
845
|
+
"properties": {
|
|
846
|
+
"kind": {
|
|
847
|
+
"type": "string",
|
|
848
|
+
"enum": [
|
|
849
|
+
"run_command",
|
|
850
|
+
"edit_file",
|
|
851
|
+
"review",
|
|
852
|
+
"confirm",
|
|
853
|
+
"block",
|
|
854
|
+
"ignore"
|
|
855
|
+
]
|
|
856
|
+
},
|
|
857
|
+
"title": {
|
|
858
|
+
"type": "string"
|
|
859
|
+
},
|
|
860
|
+
"command": {
|
|
861
|
+
"type": "string",
|
|
862
|
+
"description": "CLI command to run (for run_command kind)."
|
|
863
|
+
},
|
|
864
|
+
"target": {
|
|
865
|
+
"type": "string",
|
|
866
|
+
"description": "Target file or resource."
|
|
867
|
+
},
|
|
868
|
+
"rationale": {
|
|
869
|
+
"type": "string"
|
|
870
|
+
}
|
|
871
|
+
}
|
|
872
|
+
}
|
|
873
|
+
},
|
|
874
|
+
"metadata": {
|
|
875
|
+
"type": "object",
|
|
876
|
+
"properties": {
|
|
877
|
+
"tool": {
|
|
878
|
+
"type": "string"
|
|
879
|
+
},
|
|
880
|
+
"command": {
|
|
881
|
+
"type": "string"
|
|
882
|
+
},
|
|
883
|
+
"version": {
|
|
884
|
+
"type": "string"
|
|
885
|
+
},
|
|
886
|
+
"generatedAt": {
|
|
887
|
+
"type": "string"
|
|
888
|
+
},
|
|
889
|
+
"adapter": {
|
|
890
|
+
"type": "string"
|
|
891
|
+
},
|
|
892
|
+
"model": {
|
|
893
|
+
"type": "string"
|
|
894
|
+
}
|
|
895
|
+
}
|
|
896
|
+
}
|
|
897
|
+
}
|
|
898
|
+
}
|
|
899
|
+
```
|
|
900
|
+
|
|
901
|
+
</details>
|
|
437
902
|
|
|
438
|
-
- **
|
|
903
|
+
- **stderr:** format=`text`
|
|
439
904
|
|
|
440
|
-
**Exit
|
|
905
|
+
**Exit 11:** Runtime dependency missing (agent-contracts-runtime not installed).
|
|
441
906
|
|
|
442
907
|
- **stderr:** format=`text`
|
|
443
908
|
|
|
444
|
-
**Exit
|
|
909
|
+
**Exit 12:** LLM provider or adapter error (API failure, auth error).
|
|
445
910
|
|
|
446
911
|
- **stderr:** format=`text`
|
|
447
912
|
|
|
@@ -449,11 +914,17 @@ agent-contracts audit dsl --scope agents:architect,implementer -c config.yaml
|
|
|
449
914
|
|
|
450
915
|
```yaml
|
|
451
916
|
x-agent:
|
|
452
|
-
riskLevel:
|
|
917
|
+
riskLevel: medium
|
|
453
918
|
requiresConfirmation: false
|
|
454
|
-
idempotent:
|
|
919
|
+
idempotent: false
|
|
920
|
+
idempotentNote: Safe to repeat (no persistent side effects beyond network calls), but LLM inference is non-deterministic — identical inputs may produce different findings, severity assignments, and recommendation text across runs.
|
|
455
921
|
sideEffects:
|
|
456
|
-
|
|
922
|
+
- network
|
|
923
|
+
sideEffectNote: Makes LLM API calls to the configured adapter (e.g. OpenAI, Gemini, Cursor) unless --dry-run is specified. Incurs token cost and sends DSL content to the LLM provider.
|
|
924
|
+
safeDryRunOption: dry-run
|
|
925
|
+
expectedDurationMs: 120000
|
|
926
|
+
retryableExitCodes:
|
|
927
|
+
- 12
|
|
457
928
|
recommendedBeforeUse:
|
|
458
929
|
- Ensure agent-contracts.config.yaml exists with render targets.
|
|
459
930
|
- Run validate first to confirm DSL is valid.
|
|
@@ -464,16 +935,25 @@ x-agent:
|
|
|
464
935
|
|
|
465
936
|
### generate
|
|
466
937
|
|
|
467
|
-
Generate
|
|
938
|
+
Generate artifacts from DSL — templates, guardrails, and/or interface.
|
|
468
939
|
|
|
469
|
-
|
|
940
|
+
Unified generation command. When type is omitted, runs all generation targets (templates, guardrails, interface). When type is "templates", renders output files from the DSL using Handlebars templates. When type is "guardrails", 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.
|
|
470
941
|
|
|
471
942
|
**Usage:**
|
|
472
943
|
|
|
944
|
+
```
|
|
945
|
+
agent-contracts generate
|
|
946
|
+
```
|
|
473
947
|
```
|
|
474
948
|
agent-contracts generate -c agent-contracts.config.yaml
|
|
475
949
|
```
|
|
476
950
|
```
|
|
951
|
+
agent-contracts generate templates
|
|
952
|
+
```
|
|
953
|
+
```
|
|
954
|
+
agent-contracts generate templates --check
|
|
955
|
+
```
|
|
956
|
+
```
|
|
477
957
|
agent-contracts generate guardrails -c agent-contracts.config.yaml
|
|
478
958
|
```
|
|
479
959
|
```
|
|
@@ -496,7 +976,7 @@ agent-contracts generate interface -o team-interface.yaml --dry-run
|
|
|
496
976
|
|
|
497
977
|
| Name | Required | Description |
|
|
498
978
|
|---|---|---|
|
|
499
|
-
| `type` | No | Type of artifacts to generate. |
|
|
979
|
+
| `type` | No | Type of artifacts to generate. Omit to run all targets. |
|
|
500
980
|
|
|
501
981
|
#### Options
|
|
502
982
|
|
|
@@ -504,6 +984,7 @@ agent-contracts generate interface -o team-interface.yaml --dry-run
|
|
|
504
984
|
|---|---|---|---|---|
|
|
505
985
|
| `--config` | -c | No | | Path to agent-contracts.config.yaml. |
|
|
506
986
|
| `--team` | | No | | Limit to one team (multi-team config only). |
|
|
987
|
+
| `--check` | | No | `false` | Check for template drift without writing files. Only applies to the templates target. |
|
|
507
988
|
| `--binding` | | No | | Filter to specific software binding(s). Guardrails type only. |
|
|
508
989
|
| `--output` | -o | No | | Output path for generated team interface. Interface type only. |
|
|
509
990
|
| `--format` | | No | `"yaml"` | Output format for team interface (yaml or json). Interface type only. |
|
|
@@ -512,11 +993,11 @@ agent-contracts generate interface -o team-interface.yaml --dry-run
|
|
|
512
993
|
|
|
513
994
|
#### Exit Codes
|
|
514
995
|
|
|
515
|
-
**Exit 0:** Generation succeeded.
|
|
996
|
+
**Exit 0:** Generation succeeded (or no drift detected in --check mode).
|
|
516
997
|
|
|
517
998
|
- **stdout:** format=`text`
|
|
518
999
|
|
|
519
|
-
**Exit 1:** Generation failed — unknown type, schema validation failed, config not found, or error-level diagnostics.
|
|
1000
|
+
**Exit 1:** Generation failed — unknown type, schema validation failed, config not found, drift detected, or error-level diagnostics.
|
|
520
1001
|
|
|
521
1002
|
- **stderr:** format=`text`
|
|
522
1003
|
|
|
@@ -527,11 +1008,17 @@ x-agent:
|
|
|
527
1008
|
riskLevel: medium
|
|
528
1009
|
requiresConfirmation: false
|
|
529
1010
|
idempotent: true
|
|
1011
|
+
idempotentNote: Output is deterministic from DSL input, templates, policies, and bindings. Repeated runs produce identical files. Confirmation is not required because the command is idempotent and --dry-run / --check provide side-effect-free preview modes.
|
|
530
1012
|
sideEffects:
|
|
531
1013
|
- file_write
|
|
1014
|
+
sideEffectNote: Writes rendered template files, guardrail binding files, and/or team interface files to configured output paths. No file writes occur when --dry-run or --check is specified (--check applies to templates only).
|
|
1015
|
+
safeDryRunOption: dry-run
|
|
532
1016
|
recommendedBeforeUse:
|
|
533
|
-
- Ensure agent-contracts.config.yaml exists with binding definitions.
|
|
1017
|
+
- Ensure agent-contracts.config.yaml exists with render targets and/or binding definitions.
|
|
534
1018
|
- Run validate first to confirm DSL is valid.
|
|
1019
|
+
expectedDurationMs: 5000
|
|
1020
|
+
retryableExitCodes:
|
|
1021
|
+
|
|
535
1022
|
```
|
|
536
1023
|
|
|
537
1024
|
---
|