agent-contracts 0.20.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 +47 -10
- package/cli-contract.yaml +76 -109
- package/dist/cli.js +2034 -1455
- 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 +25 -107
- package/package.json +5 -4
package/README.md
CHANGED
|
@@ -151,11 +151,11 @@ artifacts:
|
|
|
151
151
|
states: [draft, reviewed, approved]
|
|
152
152
|
````
|
|
153
153
|
|
|
154
|
-
Validate and
|
|
154
|
+
Validate and generate:
|
|
155
155
|
|
|
156
156
|
````bash
|
|
157
157
|
agent-contracts validate
|
|
158
|
-
agent-contracts
|
|
158
|
+
agent-contracts generate -c agent-contracts.config.yaml
|
|
159
159
|
````
|
|
160
160
|
|
|
161
161
|
|
|
@@ -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
|
|
|
@@ -1028,18 +1028,54 @@ npx agent-contracts
|
|
|
1028
1028
|
| `agent-contracts resolve [path]` | Resolve `extends` inheritance and output resolved YAML |
|
|
1029
1029
|
| `agent-contracts validate [path]` | Validate schema and references |
|
|
1030
1030
|
| `agent-contracts lint [path]` | Run semantic lint |
|
|
1031
|
-
| `agent-contracts
|
|
1032
|
-
| `agent-contracts
|
|
1031
|
+
| `agent-contracts generate` | Generate all artifacts (templates + guardrails + interface) |
|
|
1032
|
+
| `agent-contracts generate templates` | Render template outputs from config |
|
|
1033
1033
|
| `agent-contracts generate guardrails` | Generate guardrail artifacts from bindings |
|
|
1034
|
-
| `agent-contracts generate interface` | Generate team interface YAML from DSL
|
|
1034
|
+
| `agent-contracts generate interface` | Generate team interface YAML from DSL |
|
|
1035
|
+
| `agent-contracts score [path]` | Calculate DSL completeness score |
|
|
1035
1036
|
| `agent-contracts audit <type>` | Run LLM-based semantic audit (render/dsl/prompt/all) |
|
|
1036
1037
|
| `agent-contracts check` | Run resolve → validate → lint → render --check |
|
|
1038
|
+
| `agent-contracts render` | _(deprecated)_ Alias for `generate templates` |
|
|
1037
1039
|
|
|
1038
1040
|
The `[path]` argument defaults to `agent-contracts.yaml` in the current directory.
|
|
1039
1041
|
If `-c` / `--config` is specified, the DSL path from the config file is used.
|
|
1040
1042
|
|
|
1041
1043
|
All commands also accept `--team <id>` to limit execution to a single team when using a [multi-team configuration](#multi-team-configuration).
|
|
1042
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
|
+
|
|
1043
1079
|
#### `resolve` options
|
|
1044
1080
|
|
|
1045
1081
|
| Option | Description |
|
|
@@ -1100,8 +1136,9 @@ agent-contracts lint --strict
|
|
|
1100
1136
|
agent-contracts score
|
|
1101
1137
|
agent-contracts score -c agent-contracts.config.yaml --threshold 70
|
|
1102
1138
|
agent-contracts score --format json
|
|
1103
|
-
agent-contracts
|
|
1104
|
-
agent-contracts
|
|
1139
|
+
agent-contracts generate -c agent-contracts.config.yaml
|
|
1140
|
+
agent-contracts generate templates -c agent-contracts.config.yaml
|
|
1141
|
+
agent-contracts generate templates -c agent-contracts.config.yaml --check
|
|
1105
1142
|
agent-contracts check -c agent-contracts.config.yaml --strict
|
|
1106
1143
|
agent-contracts generate interface -c agent-contracts.config.yaml
|
|
1107
1144
|
agent-contracts generate interface -c agent-contracts.config.yaml --dry-run
|
|
@@ -1239,7 +1276,7 @@ renders:
|
|
|
1239
1276
|
|
|
1240
1277
|
Tools with `x-script` get a generated script file; tools without it produce no file at all.
|
|
1241
1278
|
|
|
1242
|
-
`skip_empty` also works with `
|
|
1279
|
+
`skip_empty` also works with `generate templates --check` (drift detection): when the expected output is empty, the check expects the file to **not exist** and reports drift if it does.
|
|
1243
1280
|
|
|
1244
1281
|
### Available context types
|
|
1245
1282
|
|
|
@@ -1724,7 +1761,7 @@ A practical model is:
|
|
|
1724
1761
|
|
|
1725
1762
|
1. define the workflow in YAML
|
|
1726
1763
|
2. validate and lint it in CI
|
|
1727
|
-
3.
|
|
1764
|
+
3. generate prompts and derived docs
|
|
1728
1765
|
4. execute the workflow in your runtime of choice
|
|
1729
1766
|
|
|
1730
1767
|
That separation keeps runtime concerns and architecture concerns from being mixed together.
|
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.
|
|
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,26 +277,34 @@ commandSets:
|
|
|
293
277
|
stderr:
|
|
294
278
|
format: text
|
|
295
279
|
|
|
296
|
-
|
|
297
|
-
riskLevel: low
|
|
298
|
-
requiresConfirmation: false
|
|
299
|
-
idempotent: true
|
|
300
|
-
sideEffects: []
|
|
301
|
-
expectedDurationMs: 3000
|
|
302
|
-
retryableExitCodes: []
|
|
303
|
-
|
|
304
|
-
# ── render ────────────────────────────────────────
|
|
280
|
+
# ── render (deprecated alias) ─────────────────────
|
|
305
281
|
render:
|
|
306
|
-
summary:
|
|
282
|
+
summary: (deprecated) Alias for 'generate templates'.
|
|
283
|
+
deprecated:
|
|
284
|
+
message: >-
|
|
285
|
+
Use 'agent-contracts generate templates' instead.
|
|
286
|
+
alternative: generate templates
|
|
307
287
|
description: >-
|
|
288
|
+
Deprecated alias for 'agent-contracts generate templates'.
|
|
308
289
|
Renders output files from the resolved DSL using Handlebars
|
|
309
|
-
templates
|
|
310
|
-
drift detection
|
|
290
|
+
templates and emits a deprecation warning. Supports --check
|
|
291
|
+
for drift detection. Requires a config file.
|
|
311
292
|
usage:
|
|
312
293
|
- agent-contracts render -c agent-contracts.config.yaml
|
|
313
294
|
- agent-contracts render -c agent-contracts.config.yaml --check
|
|
314
295
|
- agent-contracts render --quiet
|
|
315
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
|
+
|
|
316
308
|
options:
|
|
317
309
|
- name: config
|
|
318
310
|
aliases: [c]
|
|
@@ -333,7 +325,7 @@ commandSets:
|
|
|
333
325
|
type: string
|
|
334
326
|
|
|
335
327
|
- name: check
|
|
336
|
-
description: Check for drift without writing files.
|
|
328
|
+
description: Check for template drift without writing files.
|
|
337
329
|
schema:
|
|
338
330
|
type: boolean
|
|
339
331
|
default: false
|
|
@@ -346,37 +338,21 @@ commandSets:
|
|
|
346
338
|
|
|
347
339
|
exits:
|
|
348
340
|
'0':
|
|
349
|
-
description:
|
|
341
|
+
description: Generation succeeded (or no drift detected in --check mode).
|
|
350
342
|
stdout:
|
|
351
343
|
format: text
|
|
352
344
|
|
|
353
345
|
'1':
|
|
354
346
|
description: >-
|
|
355
|
-
|
|
356
|
-
or drift detected in --check mode.
|
|
347
|
+
Generation failed, config not found, schema validation
|
|
348
|
+
failed, or drift detected in --check mode.
|
|
357
349
|
stderr:
|
|
358
350
|
format: text
|
|
359
351
|
|
|
360
352
|
x-agent:
|
|
361
|
-
riskLevel: medium
|
|
362
|
-
requiresConfirmation: false
|
|
363
|
-
idempotent: true
|
|
364
|
-
idempotentNote: >-
|
|
365
|
-
Output is deterministic from DSL input and templates.
|
|
366
|
-
Repeated runs produce identical files. Confirmation is not
|
|
367
|
-
required because the command is idempotent and --check
|
|
368
|
-
provides a side-effect-free preview mode.
|
|
369
|
-
sideEffects:
|
|
370
|
-
- file_write
|
|
371
|
-
sideEffectNote: >-
|
|
372
|
-
Writes rendered files to configured output paths. No file
|
|
373
|
-
writes occur when --check is specified.
|
|
374
|
-
safeDryRunOption: check
|
|
375
353
|
recommendedBeforeUse:
|
|
376
354
|
- Ensure agent-contracts.config.yaml exists with render targets.
|
|
377
355
|
- Run validate first to confirm DSL is valid.
|
|
378
|
-
expectedDurationMs: 5000
|
|
379
|
-
retryableExitCodes: []
|
|
380
356
|
|
|
381
357
|
# ── check ─────────────────────────────────────────
|
|
382
358
|
check:
|
|
@@ -451,14 +427,8 @@ commandSets:
|
|
|
451
427
|
format: text
|
|
452
428
|
|
|
453
429
|
x-agent:
|
|
454
|
-
riskLevel: low
|
|
455
|
-
requiresConfirmation: false
|
|
456
|
-
idempotent: true
|
|
457
|
-
sideEffects: []
|
|
458
430
|
recommendedBeforeUse:
|
|
459
431
|
- Ensure agent-contracts.config.yaml exists.
|
|
460
|
-
expectedDurationMs: 10000
|
|
461
|
-
retryableExitCodes: []
|
|
462
432
|
|
|
463
433
|
# ── score ─────────────────────────────────────────
|
|
464
434
|
score:
|
|
@@ -540,14 +510,6 @@ commandSets:
|
|
|
540
510
|
stderr:
|
|
541
511
|
format: text
|
|
542
512
|
|
|
543
|
-
x-agent:
|
|
544
|
-
riskLevel: low
|
|
545
|
-
requiresConfirmation: false
|
|
546
|
-
idempotent: true
|
|
547
|
-
sideEffects: []
|
|
548
|
-
expectedDurationMs: 5000
|
|
549
|
-
retryableExitCodes: []
|
|
550
|
-
|
|
551
513
|
# ── audit ───────────────────────────────────────────
|
|
552
514
|
audit:
|
|
553
515
|
summary: Run LLM-based semantic audit on DSL definitions and generated outputs.
|
|
@@ -569,6 +531,18 @@ commandSets:
|
|
|
569
531
|
- agent-contracts audit render --format json -c agent-contracts.config.yaml
|
|
570
532
|
- agent-contracts audit dsl --scope agents:architect,implementer -c config.yaml
|
|
571
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
|
+
|
|
572
546
|
arguments:
|
|
573
547
|
- name: type
|
|
574
548
|
index: 0
|
|
@@ -704,22 +678,6 @@ commandSets:
|
|
|
704
678
|
format: text
|
|
705
679
|
|
|
706
680
|
x-agent:
|
|
707
|
-
riskLevel: medium
|
|
708
|
-
requiresConfirmation: false
|
|
709
|
-
idempotent: false
|
|
710
|
-
idempotentNote: >-
|
|
711
|
-
Safe to repeat (no persistent side effects beyond network calls),
|
|
712
|
-
but LLM inference is non-deterministic — identical inputs may
|
|
713
|
-
produce different findings, severity assignments, and
|
|
714
|
-
recommendation text across runs.
|
|
715
|
-
sideEffects:
|
|
716
|
-
- network
|
|
717
|
-
sideEffectNote: >-
|
|
718
|
-
Makes LLM API calls to the configured adapter (e.g. OpenAI,
|
|
719
|
-
Gemini, Cursor) unless --dry-run is specified. Incurs token
|
|
720
|
-
cost and sends DSL content to the LLM provider.
|
|
721
|
-
safeDryRunOption: dry-run
|
|
722
|
-
expectedDurationMs: 120000
|
|
723
681
|
retryableExitCodes: [12]
|
|
724
682
|
recommendedBeforeUse:
|
|
725
683
|
- Ensure agent-contracts.config.yaml exists with render targets.
|
|
@@ -728,15 +686,20 @@ commandSets:
|
|
|
728
686
|
|
|
729
687
|
# ── generate ──────────────────────────────────────
|
|
730
688
|
generate:
|
|
731
|
-
summary: Generate
|
|
689
|
+
summary: Generate artifacts from DSL — templates, guardrails, and/or interface.
|
|
732
690
|
description: >-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
691
|
+
Unified generation command. When type is omitted, runs all
|
|
692
|
+
generation targets (templates, guardrails, interface). When
|
|
693
|
+
type is "templates", renders output files from the DSL using
|
|
694
|
+
Handlebars templates. When type is "guardrails", produces
|
|
695
|
+
guardrail binding files from DSL, policies, and software
|
|
696
|
+
bindings. When type is "interface", generates a team interface
|
|
697
|
+
YAML/JSON file from the DSL's team_interface section.
|
|
738
698
|
usage:
|
|
699
|
+
- agent-contracts generate
|
|
739
700
|
- agent-contracts generate -c agent-contracts.config.yaml
|
|
701
|
+
- agent-contracts generate templates
|
|
702
|
+
- agent-contracts generate templates --check
|
|
740
703
|
- agent-contracts generate guardrails -c agent-contracts.config.yaml
|
|
741
704
|
- agent-contracts generate guardrails --binding cursor-rules
|
|
742
705
|
- agent-contracts generate guardrails --dry-run
|
|
@@ -744,15 +707,29 @@ commandSets:
|
|
|
744
707
|
- agent-contracts generate interface --format json
|
|
745
708
|
- agent-contracts generate interface -o team-interface.yaml --dry-run
|
|
746
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
|
+
|
|
747
724
|
arguments:
|
|
748
725
|
- name: type
|
|
749
726
|
index: 0
|
|
750
727
|
required: false
|
|
751
|
-
description:
|
|
728
|
+
description: >-
|
|
729
|
+
Type of artifacts to generate. Omit to run all targets.
|
|
752
730
|
schema:
|
|
753
731
|
type: string
|
|
754
|
-
enum: [guardrails, interface]
|
|
755
|
-
default: guardrails
|
|
732
|
+
enum: [templates, guardrails, interface]
|
|
756
733
|
|
|
757
734
|
options:
|
|
758
735
|
- name: config
|
|
@@ -773,6 +750,14 @@ commandSets:
|
|
|
773
750
|
schema:
|
|
774
751
|
type: string
|
|
775
752
|
|
|
753
|
+
- name: check
|
|
754
|
+
description: >-
|
|
755
|
+
Check for template drift without writing files.
|
|
756
|
+
Only applies to the templates target.
|
|
757
|
+
schema:
|
|
758
|
+
type: boolean
|
|
759
|
+
default: false
|
|
760
|
+
|
|
776
761
|
- name: binding
|
|
777
762
|
description: Filter to specific software binding(s). Guardrails type only.
|
|
778
763
|
valueName: name
|
|
@@ -813,36 +798,18 @@ commandSets:
|
|
|
813
798
|
|
|
814
799
|
exits:
|
|
815
800
|
'0':
|
|
816
|
-
description: Generation succeeded.
|
|
801
|
+
description: Generation succeeded (or no drift detected in --check mode).
|
|
817
802
|
stdout:
|
|
818
803
|
format: text
|
|
819
804
|
|
|
820
805
|
'1':
|
|
821
806
|
description: >-
|
|
822
807
|
Generation failed — unknown type, schema validation failed,
|
|
823
|
-
config not found, or error-level diagnostics.
|
|
808
|
+
config not found, drift detected, or error-level diagnostics.
|
|
824
809
|
stderr:
|
|
825
810
|
format: text
|
|
826
811
|
|
|
827
812
|
x-agent:
|
|
828
|
-
riskLevel: medium
|
|
829
|
-
requiresConfirmation: false
|
|
830
|
-
idempotent: true
|
|
831
|
-
idempotentNote: >-
|
|
832
|
-
Output is deterministic from DSL input, policies, and
|
|
833
|
-
bindings. Repeated runs produce identical files.
|
|
834
|
-
Confirmation is not required because the command is
|
|
835
|
-
idempotent and --dry-run provides a side-effect-free
|
|
836
|
-
preview mode.
|
|
837
|
-
sideEffects:
|
|
838
|
-
- file_write
|
|
839
|
-
sideEffectNote: >-
|
|
840
|
-
Writes guardrail binding files or team interface files to
|
|
841
|
-
configured output paths. No file writes occur when
|
|
842
|
-
--dry-run is specified.
|
|
843
|
-
safeDryRunOption: dry-run
|
|
844
813
|
recommendedBeforeUse:
|
|
845
|
-
- Ensure agent-contracts.config.yaml exists with binding definitions.
|
|
814
|
+
- Ensure agent-contracts.config.yaml exists with render targets and/or binding definitions.
|
|
846
815
|
- Run validate first to confirm DSL is valid.
|
|
847
|
-
expectedDurationMs: 5000
|
|
848
|
-
retryableExitCodes: []
|