agent-contracts 0.30.1 → 0.30.3
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 +29 -0
- package/cli-contract.yaml +80 -1
- package/dist/cli.js +455 -954
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +40 -1
- package/dist/index.js +324 -951
- package/dist/index.js.map +1 -1
- package/dsl_base/agents/dsl-designer.yaml +4 -0
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -340,6 +340,7 @@ Design regressions become testable.
|
|
|
340
340
|
* **Software bindings** (DI) for tool-specific guardrail implementation (Cursor, Git, GitHub)
|
|
341
341
|
* **Guardrail generation** from DSL + policy + bindings via `generate guardrails`
|
|
342
342
|
* **Navigation index** — compile-time artifact-centric model mapping artifacts to operations, agent permissions, relations, and action routes
|
|
343
|
+
* **Artifact coverage** — measure what percentage of project files are covered by artifact `path_patterns` definitions, with CI gating via `--min-coverage`
|
|
343
344
|
* **Tool `extends`** — tool inheritance for sharing `cli_contract`, `artifact_bindings`, and other metadata across related tool definitions
|
|
344
345
|
* **Interface generation** from DSL via `generate interface` for cross-team contracts
|
|
345
346
|
* **Flexible file splitting** via `$ref` (replacement), `$refs` (import + deep-merge), and JSON Pointer `$ref` (in-document)
|
|
@@ -1130,6 +1131,7 @@ npx agent-contracts
|
|
|
1130
1131
|
| `agent-contracts audit <type>` | Run LLM-based semantic audit (render/dsl/prompt/all) |
|
|
1131
1132
|
| `agent-contracts check` | Run resolve → validate → lint → render --check |
|
|
1132
1133
|
| `agent-contracts navigation-index` | Build artifact-centric navigation index |
|
|
1134
|
+
| `agent-contracts artifact-coverage` | Measure file coverage by artifact definitions |
|
|
1133
1135
|
| `agent-contracts render` | _(deprecated)_ Alias for `generate templates` |
|
|
1134
1136
|
|
|
1135
1137
|
The `[path]` argument defaults to `agent-contracts.yaml` in the current directory.
|
|
@@ -1209,6 +1211,25 @@ audit:
|
|
|
1209
1211
|
model: gpt-4.1
|
|
1210
1212
|
```
|
|
1211
1213
|
|
|
1214
|
+
#### `artifact-coverage` options
|
|
1215
|
+
|
|
1216
|
+
| Option | Description |
|
|
1217
|
+
|--------|-------------|
|
|
1218
|
+
| `--format <text\|json>` | Output format (default: `text`) |
|
|
1219
|
+
| `--min-coverage <number>` | Minimum coverage %; exit 1 if below (for CI gates) |
|
|
1220
|
+
| `-c, --config <path>` | Path to `agent-contracts.config.yaml` |
|
|
1221
|
+
| `--team <id>` | Limit to one team (multi-team config only) |
|
|
1222
|
+
|
|
1223
|
+
Configure additional exclude patterns in `agent-contracts.config.yaml`:
|
|
1224
|
+
|
|
1225
|
+
```yaml
|
|
1226
|
+
artifact_coverage:
|
|
1227
|
+
exclude_patterns:
|
|
1228
|
+
- "*.lock"
|
|
1229
|
+
- "**/*.snap"
|
|
1230
|
+
- ".cursor/**"
|
|
1231
|
+
```
|
|
1232
|
+
|
|
1212
1233
|
The score command evaluates 7 dimensions:
|
|
1213
1234
|
|
|
1214
1235
|
| Dimension | What it measures | Weight |
|
|
@@ -1245,6 +1266,10 @@ agent-contracts audit dsl -c agent-contracts.config.yaml --dry-run
|
|
|
1245
1266
|
agent-contracts navigation-index
|
|
1246
1267
|
agent-contracts navigation-index --format yaml
|
|
1247
1268
|
agent-contracts navigation-index --artifact api-contracts
|
|
1269
|
+
agent-contracts artifact-coverage
|
|
1270
|
+
agent-contracts artifact-coverage --format json
|
|
1271
|
+
agent-contracts artifact-coverage --min-coverage 80
|
|
1272
|
+
agent-contracts artifact-coverage -c agent-contracts.config.yaml
|
|
1248
1273
|
````
|
|
1249
1274
|
|
|
1250
1275
|
---
|
|
@@ -1451,6 +1476,10 @@ Templates can use these built-in helpers:
|
|
|
1451
1476
|
| `notEmpty` | `{{#if (notEmpty obj)}}` | True when object has at least one key |
|
|
1452
1477
|
| `inc` | `{{inc @index}}` | Increment number by 1 (for 1-based indexing) |
|
|
1453
1478
|
| `yamlBlock` | `{{{yamlBlock obj}}}` | Render value as YAML-formatted text |
|
|
1479
|
+
| `jsonBlock` | `{{{jsonBlock obj}}}` | Render value as pretty-printed JSON |
|
|
1480
|
+
| `yamlFrontmatter` | `{{{yamlFrontmatter obj}}}` | Render value as YAML frontmatter (`---` delimiters) |
|
|
1481
|
+
| `handoffPayload` | `(handoffPayload handoffType)` | Resolve handoff payload (`example` or schema skeleton) |
|
|
1482
|
+
| `handoffEnvelope` | `(handoffEnvelope handoffType id=@key)` | Build `{ type, version, payload }` envelope object |
|
|
1454
1483
|
| `lookupPayloadFields` | `{{#each (lookupPayloadFields schema)}}` | Extract schema field info (name, type, required, enum); resolves `allOf` internally |
|
|
1455
1484
|
| `join` | `{{join arr ", "}}` | Join array elements with separator |
|
|
1456
1485
|
| `contains` | `{{#if (contains arr "x")}}` | True when array includes value |
|
package/cli-contract.yaml
CHANGED
|
@@ -3,7 +3,7 @@ cli_contracts: 0.1.0
|
|
|
3
3
|
|
|
4
4
|
info:
|
|
5
5
|
title: agent-contracts CLI
|
|
6
|
-
version: 0.30.
|
|
6
|
+
version: 0.30.2
|
|
7
7
|
description: >-
|
|
8
8
|
Declarative YAML DSL toolkit for defining, validating, and rendering
|
|
9
9
|
multi-agent development workflows. Provides static validation,
|
|
@@ -911,3 +911,82 @@ command_sets:
|
|
|
911
911
|
description: Build failed — schema validation error, config error, or resolution failure.
|
|
912
912
|
stderr:
|
|
913
913
|
format: text
|
|
914
|
+
|
|
915
|
+
# ── artifact-coverage ────────────────────────────────
|
|
916
|
+
artifact-coverage:
|
|
917
|
+
summary: Measure file coverage by artifact path_patterns definitions.
|
|
918
|
+
description: >-
|
|
919
|
+
Cross-references git ls-files output against compiled artifact
|
|
920
|
+
path_patterns / exclude_patterns to measure what percentage of
|
|
921
|
+
a project's tracked files are covered by artifact definitions.
|
|
922
|
+
Reports uncovered files, overlapping files, and per-artifact
|
|
923
|
+
match counts. Supports CI gating via --min-coverage.
|
|
924
|
+
usage:
|
|
925
|
+
- agent-contracts artifact-coverage
|
|
926
|
+
- agent-contracts artifact-coverage -c agent-contracts.config.yaml
|
|
927
|
+
- agent-contracts artifact-coverage --format json
|
|
928
|
+
- agent-contracts artifact-coverage --min-coverage 80
|
|
929
|
+
|
|
930
|
+
arguments:
|
|
931
|
+
- name: dir
|
|
932
|
+
index: 0
|
|
933
|
+
required: false
|
|
934
|
+
description: Path to agent-contracts.yaml.
|
|
935
|
+
schema:
|
|
936
|
+
type: string
|
|
937
|
+
default: agent-contracts.yaml
|
|
938
|
+
file:
|
|
939
|
+
mode: read
|
|
940
|
+
exists: true
|
|
941
|
+
media_type: application/yaml
|
|
942
|
+
encoding: utf-8
|
|
943
|
+
|
|
944
|
+
options:
|
|
945
|
+
- name: config
|
|
946
|
+
aliases: [c]
|
|
947
|
+
description: Path to agent-contracts.config.yaml.
|
|
948
|
+
value_name: path
|
|
949
|
+
schema:
|
|
950
|
+
type: string
|
|
951
|
+
file:
|
|
952
|
+
mode: read
|
|
953
|
+
exists: false
|
|
954
|
+
media_type: application/yaml
|
|
955
|
+
encoding: utf-8
|
|
956
|
+
|
|
957
|
+
- name: team
|
|
958
|
+
description: Limit to one team (multi-team config only).
|
|
959
|
+
value_name: id
|
|
960
|
+
schema:
|
|
961
|
+
type: string
|
|
962
|
+
|
|
963
|
+
- name: format
|
|
964
|
+
description: Output format.
|
|
965
|
+
value_name: format
|
|
966
|
+
schema:
|
|
967
|
+
type: string
|
|
968
|
+
enum: [text, json]
|
|
969
|
+
default: text
|
|
970
|
+
|
|
971
|
+
- name: min-coverage
|
|
972
|
+
description: Minimum coverage percentage; exit 1 if below (for CI gates).
|
|
973
|
+
value_name: number
|
|
974
|
+
schema:
|
|
975
|
+
type: number
|
|
976
|
+
|
|
977
|
+
exits:
|
|
978
|
+
'0':
|
|
979
|
+
description: Coverage report generated (and above threshold if --min-coverage specified).
|
|
980
|
+
stdout:
|
|
981
|
+
format: '{options.format}'
|
|
982
|
+
schema_note: >-
|
|
983
|
+
Output format depends on --format option. Text shows
|
|
984
|
+
human-readable coverage report; json produces structured
|
|
985
|
+
ArtifactCoverageReport object.
|
|
986
|
+
|
|
987
|
+
'1':
|
|
988
|
+
description: >-
|
|
989
|
+
Coverage below threshold, schema validation failed,
|
|
990
|
+
or unexpected error.
|
|
991
|
+
stderr:
|
|
992
|
+
format: text
|