@agentfile/core 0.1.3 → 0.1.4
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 +69 -0
- package/package.json +3 -2
package/README.md
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# @agentfile/core
|
|
2
|
+
|
|
3
|
+
Core engine for [agentfile](https://github.com/dennishavermans/agentfile) — schema validation, YAML loading, template rendering, and file generation.
|
|
4
|
+
|
|
5
|
+
Use this package if you want to integrate agentfile into your own tooling or build scripts.
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
```typescript
|
|
10
|
+
import { generate, validateContract } from '@agentfile/core'
|
|
11
|
+
|
|
12
|
+
// Validate only
|
|
13
|
+
const contract = validateContract({ contractPath: 'ai/contract.yaml' })
|
|
14
|
+
|
|
15
|
+
// Full generation
|
|
16
|
+
const result = generate({
|
|
17
|
+
root: process.cwd(),
|
|
18
|
+
agents: ['claude', 'cursor'],
|
|
19
|
+
dryRun: false
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
for (const r of result.results) {
|
|
23
|
+
if (r.status === 'ok') console.log(`Generated ${r.output}`)
|
|
24
|
+
if (r.status === 'error') console.error(r.error.message)
|
|
25
|
+
if (r.status === 'skipped') console.warn(r.reason)
|
|
26
|
+
}
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## API
|
|
30
|
+
|
|
31
|
+
### `generate(options)`
|
|
32
|
+
|
|
33
|
+
Generates agent instruction files for the given agents.
|
|
34
|
+
|
|
35
|
+
```typescript
|
|
36
|
+
generate({
|
|
37
|
+
root: string, // project root
|
|
38
|
+
agents: string[], // agent names to generate
|
|
39
|
+
dryRun?: boolean // render without writing files
|
|
40
|
+
})
|
|
41
|
+
// returns: { results: AgentResult[], success: boolean }
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### `validateContract(options)`
|
|
45
|
+
|
|
46
|
+
Validates `contract.yaml` against the schema. Throws on invalid input.
|
|
47
|
+
|
|
48
|
+
```typescript
|
|
49
|
+
validateContract({ contractPath: string })
|
|
50
|
+
// returns: Contract
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### `renderTemplate(template, context, skillsFormat?)`
|
|
54
|
+
|
|
55
|
+
Pure template rendering — no I/O.
|
|
56
|
+
|
|
57
|
+
```typescript
|
|
58
|
+
renderTemplate(template: string, ctx: RenderContext, skillsFormat?: SkillsFormat)
|
|
59
|
+
// returns: string
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Links
|
|
63
|
+
|
|
64
|
+
- [Full documentation](https://github.com/dennishavermans/agentfile)
|
|
65
|
+
- [CLI](https://www.npmjs.com/package/@agentfile/cli)
|
|
66
|
+
|
|
67
|
+
## License
|
|
68
|
+
|
|
69
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentfile/core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "Core engine for agentfile — schema validation, loading, rendering, and generation",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
14
|
"files": [
|
|
15
|
-
"dist"
|
|
15
|
+
"dist",
|
|
16
|
+
"README.md"
|
|
16
17
|
],
|
|
17
18
|
"scripts": {
|
|
18
19
|
"build": "tsc",
|