agent-contracts 0.21.0 → 0.22.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 CHANGED
@@ -1011,7 +1011,7 @@ VarsSubstitutionError: Undefined variable "repo_url" in value "Repository: ${var
1011
1011
 
1012
1012
  For the full CLI reference with all commands, options, arguments, exit codes, and AI agent policies, see the [CLI Reference](docs/cli-reference.md).
1013
1013
 
1014
- The CLI contract specification is defined in [`cli-contract.yaml`](cli-contract.yaml) using [CLI Contracts](https://github.com/foo-ogawa/cli-contracts).
1014
+ The CLI contract specification is defined in [`cli-contract.yaml`](cli-contract.yaml) using [CLI Contracts](https://github.com/foo-ogawa/cli-contracts). Commands that have side effects declare structured `effects` metadata, and the `--introspect` global option outputs the derived policy as JSON without executing the command.
1015
1015
 
1016
1016
  ### Installation
1017
1017
 
@@ -1042,6 +1042,40 @@ If `-c` / `--config` is specified, the DSL path from the config file is used.
1042
1042
 
1043
1043
  All commands also accept `--team <id>` to limit execution to a single team when using a [multi-team configuration](#multi-team-configuration).
1044
1044
 
1045
+ #### `--introspect` (global)
1046
+
1047
+ Any command can be invoked with `--introspect` to output the derived policy as JSON **without executing** the command. This is useful for AI agents to inspect what side effects a command would have before deciding whether to run it.
1048
+
1049
+ ````bash
1050
+ agent-contracts generate --introspect
1051
+ agent-contracts audit --introspect
1052
+ agent-contracts validate --introspect
1053
+ ````
1054
+
1055
+ The output follows the [CLI Contracts](https://github.com/foo-ogawa/cli-contracts) `IntrospectionResult` shape:
1056
+
1057
+ ````json
1058
+ {
1059
+ "command": "generate",
1060
+ "activeOptions": ["format"],
1061
+ "policy": {
1062
+ "riskLevel": "low",
1063
+ "requiresConfirmation": false,
1064
+ "idempotent": true,
1065
+ "sideEffects": ["file_write"],
1066
+ "reads": [],
1067
+ "writes": [
1068
+ {
1069
+ "kind": "semantic",
1070
+ "target": "configured render, guardrail, and interface output paths",
1071
+ "idempotent": true,
1072
+ "source": "command:generate"
1073
+ }
1074
+ ]
1075
+ }
1076
+ }
1077
+ ````
1078
+
1045
1079
  #### `resolve` options
1046
1080
 
1047
1081
  | Option | Description |
package/cli-contract.yaml CHANGED
@@ -3,7 +3,7 @@ cliContracts: 0.1.0
3
3
 
4
4
  info:
5
5
  title: agent-contracts CLI
6
- version: 0.21.0
6
+ version: 0.22.0
7
7
  description: >-
8
8
  Declarative YAML DSL toolkit for defining, validating, and rendering
9
9
  multi-agent development workflows. Provides static validation,
@@ -112,14 +112,6 @@ commandSets:
112
112
  stderr:
113
113
  format: text
114
114
 
115
- x-agent:
116
- riskLevel: low
117
- requiresConfirmation: false
118
- idempotent: true
119
- sideEffects: []
120
- expectedDurationMs: 3000
121
- retryableExitCodes: []
122
-
123
115
  # ── validate ──────────────────────────────────────
124
116
  validate:
125
117
  summary: Validate DSL against schema and check references.
@@ -203,14 +195,6 @@ commandSets:
203
195
  stderr:
204
196
  format: text
205
197
 
206
- x-agent:
207
- riskLevel: low
208
- requiresConfirmation: false
209
- idempotent: true
210
- sideEffects: []
211
- expectedDurationMs: 3000
212
- retryableExitCodes: []
213
-
214
198
  # ── lint ──────────────────────────────────────────
215
199
  lint:
216
200
  summary: Run semantic lint rules on resolved DSL.
@@ -293,14 +277,6 @@ commandSets:
293
277
  stderr:
294
278
  format: text
295
279
 
296
- x-agent:
297
- riskLevel: low
298
- requiresConfirmation: false
299
- idempotent: true
300
- sideEffects: []
301
- expectedDurationMs: 3000
302
- retryableExitCodes: []
303
-
304
280
  # ── render (deprecated alias) ─────────────────────
305
281
  render:
306
282
  summary: (deprecated) Alias for 'generate templates'.
@@ -318,6 +294,17 @@ commandSets:
318
294
  - agent-contracts render -c agent-contracts.config.yaml --check
319
295
  - agent-contracts render --quiet
320
296
 
297
+ effects:
298
+ riskLevel: medium
299
+ writes:
300
+ - target: "configured render output paths"
301
+ description: "rendered template files from DSL input"
302
+ overwrite: true
303
+ idempotent: true
304
+ idempotentNote: >-
305
+ Output is deterministic from DSL input and templates.
306
+ Repeated runs produce identical files.
307
+
321
308
  options:
322
309
  - name: config
323
310
  aliases: [c]
@@ -363,24 +350,9 @@ commandSets:
363
350
  format: text
364
351
 
365
352
  x-agent:
366
- riskLevel: medium
367
- requiresConfirmation: false
368
- idempotent: true
369
- idempotentNote: >-
370
- Output is deterministic from DSL input and templates.
371
- Repeated runs produce identical files. This is a
372
- deprecated alias; prefer 'generate templates'.
373
- sideEffects:
374
- - file_write
375
- sideEffectNote: >-
376
- Writes rendered files to configured output paths. No file
377
- writes occur when --check is specified.
378
- safeDryRunOption: check
379
353
  recommendedBeforeUse:
380
354
  - Ensure agent-contracts.config.yaml exists with render targets.
381
355
  - Run validate first to confirm DSL is valid.
382
- expectedDurationMs: 5000
383
- retryableExitCodes: []
384
356
 
385
357
  # ── check ─────────────────────────────────────────
386
358
  check:
@@ -455,14 +427,8 @@ commandSets:
455
427
  format: text
456
428
 
457
429
  x-agent:
458
- riskLevel: low
459
- requiresConfirmation: false
460
- idempotent: true
461
- sideEffects: []
462
430
  recommendedBeforeUse:
463
431
  - Ensure agent-contracts.config.yaml exists.
464
- expectedDurationMs: 10000
465
- retryableExitCodes: []
466
432
 
467
433
  # ── score ─────────────────────────────────────────
468
434
  score:
@@ -544,14 +510,6 @@ commandSets:
544
510
  stderr:
545
511
  format: text
546
512
 
547
- x-agent:
548
- riskLevel: low
549
- requiresConfirmation: false
550
- idempotent: true
551
- sideEffects: []
552
- expectedDurationMs: 5000
553
- retryableExitCodes: []
554
-
555
513
  # ── audit ───────────────────────────────────────────
556
514
  audit:
557
515
  summary: Run LLM-based semantic audit on DSL definitions and generated outputs.
@@ -573,6 +531,18 @@ commandSets:
573
531
  - agent-contracts audit render --format json -c agent-contracts.config.yaml
574
532
  - agent-contracts audit dsl --scope agents:architect,implementer -c config.yaml
575
533
 
534
+ effects:
535
+ riskLevel: medium
536
+ network:
537
+ description: >-
538
+ LLM API calls to configured adapter (e.g. OpenAI,
539
+ Gemini, Cursor). Incurs token cost and sends DSL
540
+ content to the LLM provider.
541
+ idempotent: false
542
+ idempotentNote: >-
543
+ LLM inference is non-deterministic — identical inputs
544
+ may produce different findings across runs.
545
+
576
546
  arguments:
577
547
  - name: type
578
548
  index: 0
@@ -708,22 +678,6 @@ commandSets:
708
678
  format: text
709
679
 
710
680
  x-agent:
711
- riskLevel: medium
712
- requiresConfirmation: false
713
- idempotent: false
714
- idempotentNote: >-
715
- Safe to repeat (no persistent side effects beyond network calls),
716
- but LLM inference is non-deterministic — identical inputs may
717
- produce different findings, severity assignments, and
718
- recommendation text across runs.
719
- sideEffects:
720
- - network
721
- sideEffectNote: >-
722
- Makes LLM API calls to the configured adapter (e.g. OpenAI,
723
- Gemini, Cursor) unless --dry-run is specified. Incurs token
724
- cost and sends DSL content to the LLM provider.
725
- safeDryRunOption: dry-run
726
- expectedDurationMs: 120000
727
681
  retryableExitCodes: [12]
728
682
  recommendedBeforeUse:
729
683
  - Ensure agent-contracts.config.yaml exists with render targets.
@@ -753,6 +707,20 @@ commandSets:
753
707
  - agent-contracts generate interface --format json
754
708
  - agent-contracts generate interface -o team-interface.yaml --dry-run
755
709
 
710
+ effects:
711
+ riskLevel: low
712
+ writes:
713
+ - target: "configured render, guardrail, and interface output paths"
714
+ description: >-
715
+ template files, guardrail binding files, and/or team
716
+ interface files generated from DSL input
717
+ overwrite: true
718
+ idempotent: true
719
+ idempotentNote: >-
720
+ Output is deterministic from DSL input, templates,
721
+ policies, and bindings. Repeated runs produce
722
+ identical files.
723
+
756
724
  arguments:
757
725
  - name: type
758
726
  index: 0
@@ -842,25 +810,6 @@ commandSets:
842
810
  format: text
843
811
 
844
812
  x-agent:
845
- riskLevel: medium
846
- requiresConfirmation: false
847
- idempotent: true
848
- idempotentNote: >-
849
- Output is deterministic from DSL input, templates, policies,
850
- and bindings. Repeated runs produce identical files.
851
- Confirmation is not required because the command is
852
- idempotent and --dry-run / --check provide side-effect-free
853
- preview modes.
854
- sideEffects:
855
- - file_write
856
- sideEffectNote: >-
857
- Writes rendered template files, guardrail binding files,
858
- and/or team interface files to configured output paths.
859
- No file writes occur when --dry-run or --check is specified
860
- (--check applies to templates only).
861
- safeDryRunOption: dry-run
862
813
  recommendedBeforeUse:
863
814
  - Ensure agent-contracts.config.yaml exists with render targets and/or binding definitions.
864
815
  - Run validate first to confirm DSL is valid.
865
- expectedDurationMs: 5000
866
- retryableExitCodes: []