agent-contracts 0.20.0 → 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.
@@ -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.19.4
5
+ **Version:** 0.21.0
6
6
 
7
7
  ## Table of Contents
8
8
 
@@ -225,9 +225,12 @@ x-agent:
225
225
 
226
226
  ### render
227
227
 
228
- Render resolved DSL with Handlebars templates.
228
+ (deprecated) Alias for 'generate templates'.
229
229
 
230
- 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.
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.
231
+
232
+ > **Deprecated**: Use 'agent-contracts generate templates' instead.
233
+ > Use `generate templates` instead.
231
234
 
232
235
  **Usage:**
233
236
 
@@ -247,16 +250,16 @@ agent-contracts render --quiet
247
250
  |---|---|---|---|---|
248
251
  | `--config` | -c | No | | Path to agent-contracts.config.yaml. |
249
252
  | `--team` | | No | | Limit to one team (multi-team config only). |
250
- | `--check` | | No | `false` | Check for drift without writing files. |
253
+ | `--check` | | No | `false` | Check for template drift without writing files. |
251
254
  | `--quiet` | | No | `false` | Suppress output on success. |
252
255
 
253
256
  #### Exit Codes
254
257
 
255
- **Exit 0:** Render succeeded (or no drift detected in --check mode).
258
+ **Exit 0:** Generation succeeded (or no drift detected in --check mode).
256
259
 
257
260
  - **stdout:** format=`text`
258
261
 
259
- **Exit 1:** Render failed, config not found, schema validation failed, or drift detected in --check mode.
262
+ **Exit 1:** Generation failed, config not found, schema validation failed, or drift detected in --check mode.
260
263
 
261
264
  - **stderr:** format=`text`
262
265
 
@@ -267,7 +270,7 @@ x-agent:
267
270
  riskLevel: medium
268
271
  requiresConfirmation: false
269
272
  idempotent: true
270
- idempotentNote: Output is deterministic from DSL input and templates. Repeated runs produce identical files. Confirmation is not required because the command is idempotent and --check provides a side-effect-free preview mode.
273
+ idempotentNote: Output is deterministic from DSL input and templates. Repeated runs produce identical files. This is a deprecated alias; prefer 'generate templates'.
271
274
  sideEffects:
272
275
  - file_write
273
276
  sideEffectNote: Writes rendered files to configured output paths. No file writes occur when --check is specified.
@@ -457,6 +460,222 @@ agent-contracts audit dsl --scope agents:architect,implementer -c config.yaml
457
460
 
458
461
  - **stdout:** format=`{options.format}`
459
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
+
460
679
  **Exit 1:** Unexpected error (invalid input, config error, or internal failure).
461
680
 
462
681
  - **stderr:** format=`text`
@@ -465,6 +684,222 @@ agent-contracts audit dsl --scope agents:architect,implementer -c config.yaml
465
684
 
466
685
  - **stdout:** format=`{options.format}`
467
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>
902
+
468
903
  - **stderr:** format=`text`
469
904
 
470
905
  **Exit 11:** Runtime dependency missing (agent-contracts-runtime not installed).
@@ -500,16 +935,25 @@ x-agent:
500
935
 
501
936
  ### generate
502
937
 
503
- Generate guardrail or interface artifacts from DSL.
938
+ Generate artifacts from DSL — templates, guardrails, and/or interface.
504
939
 
505
- 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.
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.
506
941
 
507
942
  **Usage:**
508
943
 
944
+ ```
945
+ agent-contracts generate
946
+ ```
509
947
  ```
510
948
  agent-contracts generate -c agent-contracts.config.yaml
511
949
  ```
512
950
  ```
951
+ agent-contracts generate templates
952
+ ```
953
+ ```
954
+ agent-contracts generate templates --check
955
+ ```
956
+ ```
513
957
  agent-contracts generate guardrails -c agent-contracts.config.yaml
514
958
  ```
515
959
  ```
@@ -532,7 +976,7 @@ agent-contracts generate interface -o team-interface.yaml --dry-run
532
976
 
533
977
  | Name | Required | Description |
534
978
  |---|---|---|
535
- | `type` | No | Type of artifacts to generate. |
979
+ | `type` | No | Type of artifacts to generate. Omit to run all targets. |
536
980
 
537
981
  #### Options
538
982
 
@@ -540,6 +984,7 @@ agent-contracts generate interface -o team-interface.yaml --dry-run
540
984
  |---|---|---|---|---|
541
985
  | `--config` | -c | No | | Path to agent-contracts.config.yaml. |
542
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. |
543
988
  | `--binding` | | No | | Filter to specific software binding(s). Guardrails type only. |
544
989
  | `--output` | -o | No | | Output path for generated team interface. Interface type only. |
545
990
  | `--format` | | No | `"yaml"` | Output format for team interface (yaml or json). Interface type only. |
@@ -548,11 +993,11 @@ agent-contracts generate interface -o team-interface.yaml --dry-run
548
993
 
549
994
  #### Exit Codes
550
995
 
551
- **Exit 0:** Generation succeeded.
996
+ **Exit 0:** Generation succeeded (or no drift detected in --check mode).
552
997
 
553
998
  - **stdout:** format=`text`
554
999
 
555
- **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.
556
1001
 
557
1002
  - **stderr:** format=`text`
558
1003
 
@@ -563,13 +1008,13 @@ x-agent:
563
1008
  riskLevel: medium
564
1009
  requiresConfirmation: false
565
1010
  idempotent: true
566
- idempotentNote: Output is deterministic from DSL input, policies, and bindings. Repeated runs produce identical files. Confirmation is not required because the command is idempotent and --dry-run provides a side-effect-free preview mode.
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.
567
1012
  sideEffects:
568
1013
  - file_write
569
- sideEffectNote: Writes guardrail binding files or team interface files to configured output paths. No file writes occur when --dry-run is specified.
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).
570
1015
  safeDryRunOption: dry-run
571
1016
  recommendedBeforeUse:
572
- - Ensure agent-contracts.config.yaml exists with binding definitions.
1017
+ - Ensure agent-contracts.config.yaml exists with render targets and/or binding definitions.
573
1018
  - Run validate first to confirm DSL is valid.
574
1019
  expectedDurationMs: 5000
575
1020
  retryableExitCodes:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-contracts",
3
- "version": "0.20.0",
3
+ "version": "0.21.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",
@@ -76,8 +76,8 @@
76
76
  "@google/genai": "^2.0.1",
77
77
  "@openai/agents": "^0.11.1",
78
78
  "@types/node": "^25.6.0",
79
- "agent-contracts-runtime": "^0.12.0",
80
- "cli-contracts": "^0.5.2",
79
+ "agent-contracts-runtime": "^0.13.0",
80
+ "cli-contracts": "^0.6.0",
81
81
  "eslint": "^10.2.0",
82
82
  "globals": "^17.5.0",
83
83
  "prettier": "^3.8.2",