agent-contracts 0.0.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/LICENSE +21 -0
- package/README.md +492 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/package.json +55 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 foo-ogawa
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,492 @@
|
|
|
1
|
+
# agent-contracts
|
|
2
|
+
|
|
3
|
+
A toolkit for declaratively defining multi-agent development workflows in **YAML DSL**, with static validation, linting, and prompt rendering.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Define agent responsibilities, permissions, and handoff relationships** in structured YAML
|
|
8
|
+
- **Track artifact ownership, editors, consumers, and validation requirements**
|
|
9
|
+
- **Detect design flaws statically** via Schema Validation + Semantic Lint
|
|
10
|
+
- **Define and validate handoff payloads** with structured schemas
|
|
11
|
+
- **Generate static agent prompts (md)** from Handlebars templates via Prompt Renderer
|
|
12
|
+
- **Separate common and project-specific definitions** using the `extends` inheritance mechanism
|
|
13
|
+
|
|
14
|
+
## Design Philosophy
|
|
15
|
+
|
|
16
|
+
Just as OpenAPI represents "API contracts," agent-contracts expresses **the entire operational design — including agent organization, artifacts, validation, and handoffs** — in YAML.
|
|
17
|
+
|
|
18
|
+
### 3-Layer Model
|
|
19
|
+
|
|
20
|
+
| Layer | Role | Defined in |
|
|
21
|
+
|---|---|---|
|
|
22
|
+
| **Agent** | Capability declaration and general behavioral spec of the execution entity | `agents` |
|
|
23
|
+
| **Task** | Work type that can be delegated to an agent, with task-specific behavioral spec | `tasks` |
|
|
24
|
+
| **Handoff** | A concrete delegation instance | Generated at runtime |
|
|
25
|
+
|
|
26
|
+
### Definition Inheritance and Override
|
|
27
|
+
|
|
28
|
+
```text
|
|
29
|
+
base definition (shared team definition)
|
|
30
|
+
↓ project definition references base via extends
|
|
31
|
+
↓ id-based deep merge + merge operators apply diffs
|
|
32
|
+
→ resolved YAML (final result)
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
2-layer model. Priority: **project > base**
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## DSL Structure
|
|
40
|
+
|
|
41
|
+
### Top Level
|
|
42
|
+
|
|
43
|
+
```yaml
|
|
44
|
+
version: 1
|
|
45
|
+
extends: "@agent-contracts/base-team" # Inheritance source (optional; standalone if omitted)
|
|
46
|
+
|
|
47
|
+
system:
|
|
48
|
+
id: my-project
|
|
49
|
+
name: My Agent Workflow
|
|
50
|
+
default_phase_order:
|
|
51
|
+
- analyze
|
|
52
|
+
- specify
|
|
53
|
+
- plan
|
|
54
|
+
- implement
|
|
55
|
+
- audit
|
|
56
|
+
- release
|
|
57
|
+
- reflect
|
|
58
|
+
|
|
59
|
+
agents: []
|
|
60
|
+
tasks: []
|
|
61
|
+
artifacts: []
|
|
62
|
+
tools: []
|
|
63
|
+
validations: []
|
|
64
|
+
handoff_types: []
|
|
65
|
+
workflow: []
|
|
66
|
+
policies: []
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### File Organization
|
|
70
|
+
|
|
71
|
+
**Single-file format** — All sections in one YAML file:
|
|
72
|
+
|
|
73
|
+
```yaml
|
|
74
|
+
# agentdef.yaml
|
|
75
|
+
version: 1
|
|
76
|
+
system: { ... }
|
|
77
|
+
agents: [...]
|
|
78
|
+
tasks: [...]
|
|
79
|
+
artifacts: [...]
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
**Multi-file format** — Entry point references split files via `$ref`:
|
|
83
|
+
|
|
84
|
+
```yaml
|
|
85
|
+
# agentdef.yaml
|
|
86
|
+
version: 1
|
|
87
|
+
extends: "@agent-contracts/base-team"
|
|
88
|
+
system:
|
|
89
|
+
id: my-project
|
|
90
|
+
name: My Agent Workflow
|
|
91
|
+
default_phase_order: [analyze, specify, plan, implement, audit, release, reflect]
|
|
92
|
+
|
|
93
|
+
agents: { $ref: "./agents.yaml" }
|
|
94
|
+
tasks: { $ref: "./tasks.yaml" }
|
|
95
|
+
artifacts: { $ref: "./artifacts.yaml" }
|
|
96
|
+
tools: { $ref: "./tools.yaml" }
|
|
97
|
+
validations: { $ref: "./validations.yaml" }
|
|
98
|
+
handoff_types: { $ref: "./handoff-types.yaml" }
|
|
99
|
+
workflow: { $ref: "./workflow.yaml" }
|
|
100
|
+
policies: { $ref: "./policies.yaml" }
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
## DSL Definition Examples
|
|
106
|
+
|
|
107
|
+
### Agent Definition
|
|
108
|
+
|
|
109
|
+
```yaml
|
|
110
|
+
agents:
|
|
111
|
+
- id: main-architect
|
|
112
|
+
role_name: "Architect"
|
|
113
|
+
purpose: "Drive phases, delegate, make gate decisions, integrate audits"
|
|
114
|
+
can_read_artifacts:
|
|
115
|
+
- spec-md
|
|
116
|
+
- codebase
|
|
117
|
+
- test-report
|
|
118
|
+
can_write_artifacts:
|
|
119
|
+
- review-note
|
|
120
|
+
can_execute_tools:
|
|
121
|
+
- spec-impact-check
|
|
122
|
+
can_perform_validations:
|
|
123
|
+
- evidence-gate-review
|
|
124
|
+
can_invoke_agents:
|
|
125
|
+
- implementer
|
|
126
|
+
- test-writer
|
|
127
|
+
can_return_handoffs:
|
|
128
|
+
- evidence-gate-verdict
|
|
129
|
+
|
|
130
|
+
# General behavioral spec (common across all tasks)
|
|
131
|
+
responsibilities:
|
|
132
|
+
- "Manage phase progression and gate decisions"
|
|
133
|
+
constraints:
|
|
134
|
+
- "Never write code directly"
|
|
135
|
+
rules:
|
|
136
|
+
- id: R-ARCH-001
|
|
137
|
+
description: "Evidence Gates must use structured evaluation criteria"
|
|
138
|
+
severity: mandatory
|
|
139
|
+
|
|
140
|
+
# Extension properties (freely added with x- prefix)
|
|
141
|
+
x-identity: |
|
|
142
|
+
You act as the Architect. You NEVER implement or test directly.
|
|
143
|
+
Instead you delegate to specialist sub-agents.
|
|
144
|
+
x-role-selection-guide:
|
|
145
|
+
- agent: implementer
|
|
146
|
+
condition: "Backend code, infrastructure, database migrations"
|
|
147
|
+
- agent: test-writer
|
|
148
|
+
condition: "Test code creation and coverage improvement"
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### Task Definition
|
|
152
|
+
|
|
153
|
+
```yaml
|
|
154
|
+
tasks:
|
|
155
|
+
- id: implement-feature
|
|
156
|
+
description: "Delegate feature implementation"
|
|
157
|
+
target_agent: implementer
|
|
158
|
+
allowed_from_agents:
|
|
159
|
+
- main-architect
|
|
160
|
+
phase: implement
|
|
161
|
+
input_artifacts:
|
|
162
|
+
- spec-md
|
|
163
|
+
- plan-md
|
|
164
|
+
invocation_handoff: task-delegation
|
|
165
|
+
result_handoff: dependency-evidence
|
|
166
|
+
|
|
167
|
+
# Task-specific behavioral spec
|
|
168
|
+
responsibilities:
|
|
169
|
+
- "Implement all requirements from spec-md"
|
|
170
|
+
execution_steps:
|
|
171
|
+
- id: read-specs
|
|
172
|
+
action: "Read spec-md and design-docs"
|
|
173
|
+
- id: implement
|
|
174
|
+
action: "Implement changes in codebase"
|
|
175
|
+
- id: run-db-lint
|
|
176
|
+
action: "Run db-lint"
|
|
177
|
+
uses_tool: db-lint
|
|
178
|
+
completion_criteria:
|
|
179
|
+
- "canonical artifacts updated"
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### Artifact Definition
|
|
183
|
+
|
|
184
|
+
```yaml
|
|
185
|
+
artifacts:
|
|
186
|
+
- id: spec-md
|
|
187
|
+
type: document
|
|
188
|
+
description: "Specification document"
|
|
189
|
+
owner: main-architect
|
|
190
|
+
producers: [main-architect]
|
|
191
|
+
editors: [main-architect]
|
|
192
|
+
consumers: [implementer, test-writer]
|
|
193
|
+
states: [draft, reviewed, approved]
|
|
194
|
+
required_validations: [spec-semantic-review]
|
|
195
|
+
visibility: internal
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
### Merge Operators (for diffs in `extends` inheritance)
|
|
199
|
+
|
|
200
|
+
When inheriting a base definition via `extends`, entities are matched by `id` within each section, and diffs are described using merge operators.
|
|
201
|
+
|
|
202
|
+
```yaml
|
|
203
|
+
# Project definition (inherits base via extends)
|
|
204
|
+
extends: "@agent-contracts/base-team"
|
|
205
|
+
|
|
206
|
+
agents:
|
|
207
|
+
# Same id exists in base → deep merge
|
|
208
|
+
- id: implementer
|
|
209
|
+
constraints:
|
|
210
|
+
$append:
|
|
211
|
+
- "Import litedbmodel only via package path"
|
|
212
|
+
|
|
213
|
+
# id not in base → added as new
|
|
214
|
+
- id: designer
|
|
215
|
+
role_name: "Designer"
|
|
216
|
+
purpose: "UI design"
|
|
217
|
+
|
|
218
|
+
tasks:
|
|
219
|
+
- id: implement-feature
|
|
220
|
+
execution_steps:
|
|
221
|
+
$insert_after:
|
|
222
|
+
target: run-db-lint
|
|
223
|
+
items:
|
|
224
|
+
- id: run-contract-pipeline
|
|
225
|
+
action: "Run contract pipeline"
|
|
226
|
+
uses_tool: api-pipeline
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
Merge operators:
|
|
230
|
+
|
|
231
|
+
| Operator | Behavior |
|
|
232
|
+
|---|---|
|
|
233
|
+
| `$append` | Append to end of array |
|
|
234
|
+
| `$prepend` | Prepend to beginning of array |
|
|
235
|
+
| `$insert_after` | Insert after element with specified id |
|
|
236
|
+
| `$replace` | Replace entire array/value |
|
|
237
|
+
| `$remove` | Remove element by id |
|
|
238
|
+
| (direct value) | Override scalar field |
|
|
239
|
+
|
|
240
|
+
### Extension Properties (`x-` prefix)
|
|
241
|
+
|
|
242
|
+
Information that cannot be expressed with the standard schema can be written as properties with the `x-` prefix (following OpenAPI conventions).
|
|
243
|
+
|
|
244
|
+
```yaml
|
|
245
|
+
agents:
|
|
246
|
+
- id: main-architect
|
|
247
|
+
# ... standard properties ...
|
|
248
|
+
|
|
249
|
+
# Scalar (multiline text)
|
|
250
|
+
x-identity: |
|
|
251
|
+
You act as the Architect.
|
|
252
|
+
|
|
253
|
+
# Array
|
|
254
|
+
x-role-selection-guide:
|
|
255
|
+
- agent: implementer
|
|
256
|
+
condition: "Backend code, infrastructure"
|
|
257
|
+
|
|
258
|
+
# Object
|
|
259
|
+
x-cursor-config:
|
|
260
|
+
subagent_type: null
|
|
261
|
+
globs: ["**/*"]
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
- `x-` properties pass through the schema validator (no type errors)
|
|
265
|
+
- Same merge rules and operators as standard properties apply during `extends` inheritance
|
|
266
|
+
- Included in the Prompt Renderer template context
|
|
267
|
+
|
|
268
|
+
---
|
|
269
|
+
|
|
270
|
+
## CLI
|
|
271
|
+
|
|
272
|
+
### Installation
|
|
273
|
+
|
|
274
|
+
```bash
|
|
275
|
+
npm install -g agent-contracts # Global
|
|
276
|
+
npm install -D agent-contracts # Project-local
|
|
277
|
+
npx agent-contracts # Direct execution
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
### Commands
|
|
281
|
+
|
|
282
|
+
| Command | Description |
|
|
283
|
+
|---|---|
|
|
284
|
+
| `agent-contracts resolve [dir]` | Resolve `extends` inheritance and output resolved YAML |
|
|
285
|
+
| `agent-contracts validate [dir]` | Schema validation + reference integrity check. Exit 1 on errors |
|
|
286
|
+
| `agent-contracts lint [dir]` | Run semantic lint. Display diagnostics and control exit code by severity |
|
|
287
|
+
| `agent-contracts render [dir]` | Generate prompt md from resolved YAML + Handlebars templates |
|
|
288
|
+
| `agent-contracts render [dir] --check` | Drift check. Detect diffs without writing files; exit 1 if diffs found |
|
|
289
|
+
|
|
290
|
+
### Render Command Options
|
|
291
|
+
|
|
292
|
+
| Option | Description |
|
|
293
|
+
|---|---|
|
|
294
|
+
| `--template-dir <path>` | Handlebars template directory (required) |
|
|
295
|
+
| `--output-dir <path>` | Output directory (required) |
|
|
296
|
+
| `agent-contracts check [dir]` | Run resolve → validate → lint → render --check in sequence (for CI) |
|
|
297
|
+
|
|
298
|
+
### Common Options
|
|
299
|
+
|
|
300
|
+
| Option | Description |
|
|
301
|
+
|---|---|
|
|
302
|
+
| `--format json\|text` | Specify output format |
|
|
303
|
+
| `--quiet` | Show errors only |
|
|
304
|
+
| `--strict` | Treat warnings as exit 1 |
|
|
305
|
+
|
|
306
|
+
### Usage Examples
|
|
307
|
+
|
|
308
|
+
```bash
|
|
309
|
+
# Output resolved YAML to stdout
|
|
310
|
+
agent-contracts resolve ./my-project
|
|
311
|
+
|
|
312
|
+
# Output resolved YAML to file
|
|
313
|
+
agent-contracts resolve ./my-project -o resolved.yaml
|
|
314
|
+
|
|
315
|
+
# Schema validation
|
|
316
|
+
agent-contracts validate ./my-project
|
|
317
|
+
|
|
318
|
+
# Semantic lint (JSON output)
|
|
319
|
+
agent-contracts lint ./my-project --format json
|
|
320
|
+
|
|
321
|
+
# Generate prompt md
|
|
322
|
+
agent-contracts render ./my-project --template-dir ./templates --output-dir ./rendered
|
|
323
|
+
|
|
324
|
+
# Drift check in CI
|
|
325
|
+
agent-contracts render ./my-project --template-dir ./templates --output-dir ./rendered --check
|
|
326
|
+
|
|
327
|
+
# Run all checks in CI
|
|
328
|
+
agent-contracts check ./my-project --template-dir ./templates --output-dir ./rendered --strict
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
### Multi-level Inheritance (base → team → project)
|
|
332
|
+
|
|
333
|
+
```bash
|
|
334
|
+
# 1. Resolve base
|
|
335
|
+
agent-contracts resolve ./base/ -o ./team/base-resolved.yaml
|
|
336
|
+
|
|
337
|
+
# 2. Resolve team definition (references base-resolved.yaml via extends)
|
|
338
|
+
agent-contracts resolve ./team/ -o ./project/team-resolved.yaml
|
|
339
|
+
|
|
340
|
+
# 3. Resolve project definition
|
|
341
|
+
agent-contracts resolve ./project/ -o ./resolved.yaml
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
---
|
|
345
|
+
|
|
346
|
+
## Workflow
|
|
347
|
+
|
|
348
|
+
```text
|
|
349
|
+
1. Define DSL in YAML
|
|
350
|
+
├── agentdef.yaml (entry point; references base via extends)
|
|
351
|
+
└── agents.yaml, tasks.yaml, ... (for multi-file format)
|
|
352
|
+
|
|
353
|
+
2. agent-contracts resolve
|
|
354
|
+
Resolve extends inheritance → id-based deep merge → generate resolved YAML
|
|
355
|
+
|
|
356
|
+
3. agent-contracts validate
|
|
357
|
+
Zod schema shape validation + reference integrity check
|
|
358
|
+
|
|
359
|
+
4. agent-contracts lint
|
|
360
|
+
Bidirectional consistency, coverage analysis, workflow graph completeness
|
|
361
|
+
|
|
362
|
+
5. agent-contracts render
|
|
363
|
+
resolved YAML + Handlebars templates → generate agent prompts (md)
|
|
364
|
+
|
|
365
|
+
6. agent-contracts check in CI
|
|
366
|
+
Run steps 2–5 in sequence to ensure design consistency and up-to-date rendered output
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
---
|
|
370
|
+
|
|
371
|
+
## Prompt Rendering
|
|
372
|
+
|
|
373
|
+
Generates static md files from resolved YAML and Handlebars templates.
|
|
374
|
+
|
|
375
|
+
### Template Context
|
|
376
|
+
|
|
377
|
+
| Context | Contents |
|
|
378
|
+
|---|---|
|
|
379
|
+
| **global context** | Entire resolved YAML (system, agents, tasks, artifacts, etc. + extension properties) |
|
|
380
|
+
| **per-agent context** | Each agent + related tasks + related handoff_types + related artifacts/tools |
|
|
381
|
+
|
|
382
|
+
### Template Example
|
|
383
|
+
|
|
384
|
+
```handlebars
|
|
385
|
+
# {{agent.role_name}}
|
|
386
|
+
|
|
387
|
+
## Purpose
|
|
388
|
+
|
|
389
|
+
{{agent.purpose}}
|
|
390
|
+
|
|
391
|
+
## Responsibilities
|
|
392
|
+
|
|
393
|
+
{{#each mergedResponsibilities}}
|
|
394
|
+
- {{this}}
|
|
395
|
+
{{/each}}
|
|
396
|
+
|
|
397
|
+
{{#if agent.x-identity}}
|
|
398
|
+
## Identity
|
|
399
|
+
|
|
400
|
+
{{{agent.x-identity}}}
|
|
401
|
+
{{/if}}
|
|
402
|
+
|
|
403
|
+
{{#if agent.x-role-selection-guide}}
|
|
404
|
+
## Role Selection Guide
|
|
405
|
+
|
|
406
|
+
{{#each agent.x-role-selection-guide}}
|
|
407
|
+
- **{{this.agent}}**: {{this.condition}}
|
|
408
|
+
{{/each}}
|
|
409
|
+
{{/if}}
|
|
410
|
+
```
|
|
411
|
+
|
|
412
|
+
Templates are responsible only for **defining section structure and rendering methods**. All project-specific content is sourced from YAML (standard properties + extension properties).
|
|
413
|
+
|
|
414
|
+
---
|
|
415
|
+
|
|
416
|
+
## Validation Layers
|
|
417
|
+
|
|
418
|
+
agent-contracts separates validation into 3 layers.
|
|
419
|
+
|
|
420
|
+
### A. Schema Validation (Zod + Spectral)
|
|
421
|
+
|
|
422
|
+
- Type, required field, and enum validation
|
|
423
|
+
- Detection of custom properties without `x-` prefix
|
|
424
|
+
- Handoff payload shape validation
|
|
425
|
+
- Naming conventions
|
|
426
|
+
|
|
427
|
+
### B. Reference Resolution
|
|
428
|
+
|
|
429
|
+
- ID reference integrity across agents / tasks / artifacts / tools / validations
|
|
430
|
+
- Existence check for owner, producers, editors, consumers references
|
|
431
|
+
|
|
432
|
+
### C. Semantic Lint (TypeScript custom rules)
|
|
433
|
+
|
|
434
|
+
- **Bidirectional consistency** between `can_execute_tools` and `tools.invokable_by`
|
|
435
|
+
- Bidirectional consistency between `allowed_from_agents` and `can_invoke_agents`
|
|
436
|
+
- Validation coverage analysis (e.g., whether code artifacts have mechanical validation)
|
|
437
|
+
- Workflow graph completeness (existence of release / audit roots)
|
|
438
|
+
- Design rule validation on post-merge resolved definitions
|
|
439
|
+
|
|
440
|
+
---
|
|
441
|
+
|
|
442
|
+
## Programmatic API
|
|
443
|
+
|
|
444
|
+
In addition to the CLI, a programmatic API is available for use from TypeScript.
|
|
445
|
+
|
|
446
|
+
```typescript
|
|
447
|
+
import { resolve, validate, lint, render } from "agent-contracts";
|
|
448
|
+
|
|
449
|
+
const resolved = await resolve("./my-project");
|
|
450
|
+
const validationResult = await validate(resolved);
|
|
451
|
+
const lintResult = await lint(resolved);
|
|
452
|
+
await render(resolved, { templateDir: "./templates", outputDir: "./rendered" });
|
|
453
|
+
```
|
|
454
|
+
|
|
455
|
+
---
|
|
456
|
+
|
|
457
|
+
## Tech Stack
|
|
458
|
+
|
|
459
|
+
| Category | Choice |
|
|
460
|
+
|---|---|
|
|
461
|
+
| Language | TypeScript 5.x (ESM, strict mode) |
|
|
462
|
+
| Schema | Zod |
|
|
463
|
+
| YAML parsing | yaml (npm) |
|
|
464
|
+
| Lint | Spectral (Stoplight) |
|
|
465
|
+
| Templates | Handlebars |
|
|
466
|
+
| CLI | commander |
|
|
467
|
+
| Testing | Vitest |
|
|
468
|
+
| Build | tsup |
|
|
469
|
+
|
|
470
|
+
---
|
|
471
|
+
|
|
472
|
+
## Project Structure
|
|
473
|
+
|
|
474
|
+
```text
|
|
475
|
+
agent-contracts/
|
|
476
|
+
src/
|
|
477
|
+
schema/ # Zod schema definitions
|
|
478
|
+
loader/ # YAML loading and integration
|
|
479
|
+
resolver/ # extends resolution + id-based deep merge
|
|
480
|
+
validator/ # Schema Validation + reference integrity
|
|
481
|
+
linter/ # Semantic Lint (TypeScript custom rules)
|
|
482
|
+
renderer/ # Prompt Renderer (Handlebars)
|
|
483
|
+
cli/ # CLI entry point + commands
|
|
484
|
+
spectral/ # Spectral rulesets
|
|
485
|
+
schemas/ # JSON Schema derived from Zod
|
|
486
|
+
test/
|
|
487
|
+
fixtures/ # Test YAML samples
|
|
488
|
+
```
|
|
489
|
+
|
|
490
|
+
## License
|
|
491
|
+
|
|
492
|
+
MIT
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,UAAU,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "agent-contracts",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Declarative YAML DSL toolkit for defining, validating, and rendering multi-agent development workflows",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"bin": {
|
|
9
|
+
"agent-contracts": "dist/cli.js"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"dist",
|
|
13
|
+
"README.md",
|
|
14
|
+
"LICENSE"
|
|
15
|
+
],
|
|
16
|
+
"scripts": {
|
|
17
|
+
"build": "tsc",
|
|
18
|
+
"clean": "rm -rf dist",
|
|
19
|
+
"test": "vitest run",
|
|
20
|
+
"test:unit": "vitest run test/unit",
|
|
21
|
+
"test:watch": "vitest",
|
|
22
|
+
"prepublishOnly": "npm run clean && npm run build"
|
|
23
|
+
},
|
|
24
|
+
"keywords": [
|
|
25
|
+
"agent",
|
|
26
|
+
"multi-agent",
|
|
27
|
+
"workflow",
|
|
28
|
+
"yaml",
|
|
29
|
+
"dsl",
|
|
30
|
+
"validation",
|
|
31
|
+
"lint",
|
|
32
|
+
"prompt-rendering",
|
|
33
|
+
"handoff",
|
|
34
|
+
"typescript",
|
|
35
|
+
"ai-development"
|
|
36
|
+
],
|
|
37
|
+
"author": "foo-ogawa",
|
|
38
|
+
"license": "MIT",
|
|
39
|
+
"repository": {
|
|
40
|
+
"type": "git",
|
|
41
|
+
"url": "git+https://github.com/foo-ogawa/agent-contracts.git"
|
|
42
|
+
},
|
|
43
|
+
"homepage": "https://github.com/foo-ogawa/agent-contracts#readme",
|
|
44
|
+
"bugs": {
|
|
45
|
+
"url": "https://github.com/foo-ogawa/agent-contracts/issues"
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"@types/node": "^20.11.0",
|
|
49
|
+
"typescript": "^5.3.3",
|
|
50
|
+
"vitest": "^1.2.0"
|
|
51
|
+
},
|
|
52
|
+
"engines": {
|
|
53
|
+
"node": ">=18.0.0"
|
|
54
|
+
}
|
|
55
|
+
}
|