agent-contracts 0.25.0 → 0.30.1
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 +99 -0
- package/cli-contract.yaml +176 -81
- package/dist/cli.js +1045 -174
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +81 -4
- package/dist/index.js +838 -118
- package/dist/index.js.map +1 -1
- package/docs/cli-reference.md +80 -30
- package/dsl_base/agents/dsl-auditor.yaml +5 -11
- package/dsl_base/agents/dsl-designer.yaml +7 -17
- package/dsl_base/artifacts.yaml +0 -28
- package/dsl_base/components.yaml +4 -4
- package/dsl_base/tasks.yaml +2 -0
- package/package.json +6 -3
package/README.md
CHANGED
|
@@ -214,6 +214,8 @@ A **Tool** defines an invokable CLI/MCP tool:
|
|
|
214
214
|
* kind (cli, mcp, etc.)
|
|
215
215
|
* input/output artifacts
|
|
216
216
|
* invokable_by (which agents can use it)
|
|
217
|
+
* `extends` — inherit from a base tool definition
|
|
218
|
+
* `command` — single command name (alternative to `commands[]`)
|
|
217
219
|
* `commands` — structured list of sub-commands with `category`, `reads`, `writes`, and `purpose`
|
|
218
220
|
|
|
219
221
|
### Workflow
|
|
@@ -337,6 +339,8 @@ Design regressions become testable.
|
|
|
337
339
|
* **Guardrail policies** with configurable enforcement (block/warn/shadow/info)
|
|
338
340
|
* **Software bindings** (DI) for tool-specific guardrail implementation (Cursor, Git, GitHub)
|
|
339
341
|
* **Guardrail generation** from DSL + policy + bindings via `generate guardrails`
|
|
342
|
+
* **Navigation index** — compile-time artifact-centric model mapping artifacts to operations, agent permissions, relations, and action routes
|
|
343
|
+
* **Tool `extends`** — tool inheritance for sharing `cli_contract`, `artifact_bindings`, and other metadata across related tool definitions
|
|
340
344
|
* **Interface generation** from DSL via `generate interface` for cross-team contracts
|
|
341
345
|
* **Flexible file splitting** via `$ref` (replacement), `$refs` (import + deep-merge), and JSON Pointer `$ref` (in-document)
|
|
342
346
|
* **Multi-team collaboration** via `team_interface` (public boundary), `imports` (team consumption), and `team_task` (cross-team delegation)
|
|
@@ -704,6 +708,96 @@ artifacts:
|
|
|
704
708
|
|
|
705
709
|
---
|
|
706
710
|
|
|
711
|
+
## artifact-contracts integration
|
|
712
|
+
|
|
713
|
+
agent-contracts integrates with [artifact-contracts](https://github.com/foo-ogawa/artifact-contracts) and [cli-contracts](https://github.com/foo-ogawa/cli-contracts) to provide a unified artifact governance model.
|
|
714
|
+
|
|
715
|
+
### Design principle
|
|
716
|
+
|
|
717
|
+
Relationships flow in one direction: **agent → artifact**.
|
|
718
|
+
|
|
719
|
+
- Agents declare which artifacts they own (`own_artifacts`), read (`can_read_artifacts`), or write (`can_write_artifacts`)
|
|
720
|
+
- Tools declare which abstract slots map to project artifacts (`artifact_bindings`)
|
|
721
|
+
- Artifact definitions themselves do not reference agents (the legacy `owner`/`producers`/`editors`/`consumers` fields are deprecated)
|
|
722
|
+
|
|
723
|
+
### How it works
|
|
724
|
+
|
|
725
|
+
**1. Define project artifacts** in `artifact-contracts.yaml` (project-specific):
|
|
726
|
+
|
|
727
|
+
````yaml
|
|
728
|
+
artifacts:
|
|
729
|
+
api-specs:
|
|
730
|
+
type: source
|
|
731
|
+
authority: canonical
|
|
732
|
+
path_patterns: ["specs/**/*.yaml"]
|
|
733
|
+
api-contracts:
|
|
734
|
+
type: generated-code
|
|
735
|
+
authority: generated
|
|
736
|
+
path_patterns: ["src/generated/**/*.ts"]
|
|
737
|
+
````
|
|
738
|
+
|
|
739
|
+
**2. Import artifacts** into your agent-contracts DSL via `$ref`:
|
|
740
|
+
|
|
741
|
+
````yaml
|
|
742
|
+
artifacts: { $ref: "./artifact-contracts.yaml#/artifacts" }
|
|
743
|
+
````
|
|
744
|
+
|
|
745
|
+
**3. cli-contracts define tools with domain-agnostic slot names** (reusable across projects):
|
|
746
|
+
|
|
747
|
+
````yaml
|
|
748
|
+
# cli-contract.yaml (tool's interface)
|
|
749
|
+
artifactSlots:
|
|
750
|
+
source-specs:
|
|
751
|
+
description: "Source specification files"
|
|
752
|
+
direction: read
|
|
753
|
+
contract-output:
|
|
754
|
+
description: "Generated contract output"
|
|
755
|
+
direction: write
|
|
756
|
+
|
|
757
|
+
commandSets:
|
|
758
|
+
tool-name:
|
|
759
|
+
commands:
|
|
760
|
+
generate:
|
|
761
|
+
summary: Generate contracts
|
|
762
|
+
effects:
|
|
763
|
+
reads: [source-specs]
|
|
764
|
+
writes: [contract-output]
|
|
765
|
+
exits:
|
|
766
|
+
'0':
|
|
767
|
+
description: Success
|
|
768
|
+
````
|
|
769
|
+
|
|
770
|
+
**4. Map abstract slots to project artifacts** using `artifact_bindings` on tools:
|
|
771
|
+
|
|
772
|
+
````yaml
|
|
773
|
+
tools:
|
|
774
|
+
micro-contracts:
|
|
775
|
+
kind: cli
|
|
776
|
+
cli_contract: tools/micro-contracts/cli-contract.yaml
|
|
777
|
+
artifact_bindings:
|
|
778
|
+
source-specs: api-specs
|
|
779
|
+
contract-output: api-contracts
|
|
780
|
+
````
|
|
781
|
+
|
|
782
|
+
**5. Agents reference tools and artifacts** directly:
|
|
783
|
+
|
|
784
|
+
````yaml
|
|
785
|
+
agents:
|
|
786
|
+
architect:
|
|
787
|
+
own_artifacts: [api-contracts, api-specs]
|
|
788
|
+
can_read_artifacts: [api-specs, api-contracts]
|
|
789
|
+
can_write_artifacts: [api-contracts]
|
|
790
|
+
can_execute_tools: [micro-contracts]
|
|
791
|
+
````
|
|
792
|
+
|
|
793
|
+
### Validation and linting
|
|
794
|
+
|
|
795
|
+
- `own_artifacts` entries are validated to exist in the `artifacts` section
|
|
796
|
+
- `artifact_bindings` values are validated to exist in the `artifacts` section
|
|
797
|
+
- A lint rule warns if `own_artifacts` entries are not included in `can_read_artifacts`
|
|
798
|
+
|
|
799
|
+
---
|
|
800
|
+
|
|
707
801
|
## Example: Workflow definition
|
|
708
802
|
|
|
709
803
|
````yaml
|
|
@@ -1035,6 +1129,7 @@ npx agent-contracts
|
|
|
1035
1129
|
| `agent-contracts score [path]` | Calculate DSL completeness score |
|
|
1036
1130
|
| `agent-contracts audit <type>` | Run LLM-based semantic audit (render/dsl/prompt/all) |
|
|
1037
1131
|
| `agent-contracts check` | Run resolve → validate → lint → render --check |
|
|
1132
|
+
| `agent-contracts navigation-index` | Build artifact-centric navigation index |
|
|
1038
1133
|
| `agent-contracts render` | _(deprecated)_ Alias for `generate templates` |
|
|
1039
1134
|
|
|
1040
1135
|
The `[path]` argument defaults to `agent-contracts.yaml` in the current directory.
|
|
@@ -1147,6 +1242,9 @@ agent-contracts audit dsl -c agent-contracts.config.yaml
|
|
|
1147
1242
|
agent-contracts audit render -c agent-contracts.config.yaml --format json
|
|
1148
1243
|
agent-contracts audit all -c agent-contracts.config.yaml --adapter claude
|
|
1149
1244
|
agent-contracts audit dsl -c agent-contracts.config.yaml --dry-run
|
|
1245
|
+
agent-contracts navigation-index
|
|
1246
|
+
agent-contracts navigation-index --format yaml
|
|
1247
|
+
agent-contracts navigation-index --artifact api-contracts
|
|
1150
1248
|
````
|
|
1151
1249
|
|
|
1152
1250
|
---
|
|
@@ -1285,6 +1383,7 @@ Each `context` type provides a different rendering scope:
|
|
|
1285
1383
|
| Context | Scope | Output | Key variables |
|
|
1286
1384
|
|---------|-------|--------|---------------|
|
|
1287
1385
|
| `system` | Single file | `output` as-is | `system`, `dsl`, `guardrailEnforcement`\*, `bindings`\* |
|
|
1386
|
+
| `navigation_index` | Single file | `output` as-is | `version`, `generated_at`, `system`, `artifacts` (full `ProjectNavigationIndex`) |
|
|
1288
1387
|
| `agent` | Per agent | `{agent.id}` in output path | `agent`, `receivableTasks`, `delegatableTasks`, `relatedArtifacts`, `relatedTools`, `relatedHandoffTypes`, `mergedBehavior`, `relatedGuardrails`, `relatedValidations`, `dsl` |
|
|
1289
1388
|
| `task` | Per task | `{task.id}` in output path | `task`, `targetAgent`, `relatedGuardrails`, `relatedValidations`, `dsl` |
|
|
1290
1389
|
| `artifact` | Per artifact | `{artifact.id}` in output path | `artifact`, `relatedTools`, `relatedValidations`, `relatedGuardrails`, `producerAgents`, `consumerAgents`, `editorAgents`, `createdInWorkflows`, `dsl` |
|