aigent-team 0.3.0 → 0.4.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 +48 -7
- package/dist/{chunk-RH4B2QFX.js → chunk-OMO7OMKB.js} +254 -22
- package/dist/cli.js +684 -23
- package/dist/index.d.ts +49 -0
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/templates/teams/ba/assets/story-template.md +49 -0
- package/templates/teams/ba/examples/acceptance-criteria.md +39 -0
- package/templates/teams/ba/output-contracts/user-story-rubric.md +33 -0
- package/templates/teams/ba/references/acceptance-criteria.md +7 -0
- package/templates/teams/ba/references/api-contract-design.md +7 -0
- package/templates/teams/ba/references/requirements-analysis.md +7 -0
- package/templates/teams/ba/references/user-story-mapping.md +7 -0
- package/templates/teams/ba/skills/requirement-validation.md +11 -0
- package/templates/teams/ba/skills/story-decomposition.md +16 -0
- package/templates/teams/be/references/api-design.md +7 -0
- package/templates/teams/be/references/async-processing.md +7 -0
- package/templates/teams/be/references/auth-security.md +7 -0
- package/templates/teams/be/references/caching.md +7 -0
- package/templates/teams/be/references/database.md +7 -0
- package/templates/teams/be/references/error-handling.md +7 -0
- package/templates/teams/be/references/observability.md +7 -0
- package/templates/teams/be/references/review-checklist.md +7 -0
- package/templates/teams/be/references/testing.md +7 -0
- package/templates/teams/be/skills/api-load-test.md +11 -0
- package/templates/teams/be/skills/database-migration.md +11 -0
- package/templates/teams/devops/references/ci-cd.md +7 -0
- package/templates/teams/devops/references/cost-optimization.md +7 -0
- package/templates/teams/devops/references/disaster-recovery.md +7 -0
- package/templates/teams/devops/references/docker.md +7 -0
- package/templates/teams/devops/references/infrastructure-as-code.md +7 -0
- package/templates/teams/devops/references/kubernetes.md +7 -0
- package/templates/teams/devops/references/monitoring.md +7 -0
- package/templates/teams/devops/references/review-checklist.md +7 -0
- package/templates/teams/devops/references/security.md +7 -0
- package/templates/teams/devops/scripts/health-check.sh +35 -0
- package/templates/teams/devops/skills/health-check.md +11 -0
- package/templates/teams/devops/skills/rollback-procedure.md +15 -0
- package/templates/teams/fe/examples/component-audit.md +35 -0
- package/templates/teams/fe/references/accessibility.md +7 -0
- package/templates/teams/fe/references/component-architecture.md +7 -0
- package/templates/teams/fe/references/css-styling.md +7 -0
- package/templates/teams/fe/references/forms.md +7 -0
- package/templates/teams/fe/references/performance.md +7 -0
- package/templates/teams/fe/references/review-checklist.md +7 -0
- package/templates/teams/fe/references/security.md +7 -0
- package/templates/teams/fe/references/state-management.md +7 -0
- package/templates/teams/fe/references/testing.md +7 -0
- package/templates/teams/fe/skills/analyze-bundle.md +16 -0
- package/templates/teams/fe/skills/component-audit.md +11 -0
- package/templates/teams/lead/references/cross-team-coordination.md +7 -0
- package/templates/teams/lead/references/quality-gates.md +7 -0
- package/templates/teams/lead/references/task-decomposition.md +7 -0
- package/templates/teams/lead/skills/parallel-orchestration.md +11 -0
- package/templates/teams/lead/skills/sprint-review.md +11 -0
- package/templates/teams/qa/assets/test-report-template.md +63 -0
- package/templates/teams/qa/output-contracts/test-plan-rubric.md +36 -0
- package/templates/teams/qa/references/ci-integration.md +7 -0
- package/templates/teams/qa/references/e2e-testing.md +7 -0
- package/templates/teams/qa/references/mocking.md +7 -0
- package/templates/teams/qa/references/performance-testing.md +7 -0
- package/templates/teams/qa/references/review-checklist.md +7 -0
- package/templates/teams/qa/references/security-testing.md +7 -0
- package/templates/teams/qa/references/test-data.md +7 -0
- package/templates/teams/qa/references/test-strategy.md +7 -0
- package/templates/teams/qa/skills/flaky-test-diagnosis.md +11 -0
- package/templates/teams/qa/skills/generate-test-data.md +15 -0
package/README.md
CHANGED
|
@@ -49,10 +49,19 @@ Each agent is a senior-level specialist (8+ years expertise) with deep knowledge
|
|
|
49
49
|
└─────┘ └─────┘ └─────┘ └──────┘ └───────┘
|
|
50
50
|
```
|
|
51
51
|
|
|
52
|
-
Each agent has
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
52
|
+
Each agent has a 9-layer content architecture (L0–L8):
|
|
53
|
+
|
|
54
|
+
| Layer | Content | Loading |
|
|
55
|
+
|-------|---------|---------|
|
|
56
|
+
| **L0** Use Case | Agent identity + role description | Always |
|
|
57
|
+
| **L1** Metadata | Frontmatter: name, trigger, tags, whenToRead | Always (catalog) |
|
|
58
|
+
| **L2** Core Skill | Rules (~30-50 lines) + skill index (~80-150 lines) | Always |
|
|
59
|
+
| **L3** References | Deep reference docs (3-9 per agent) | On-demand |
|
|
60
|
+
| **L4** Examples | Few-shot examples for output quality | On-demand |
|
|
61
|
+
| **L5** Scripts | Automation and validation scripts | On-demand |
|
|
62
|
+
| **L6** Assets | Templates, report formats, checklists | On-demand |
|
|
63
|
+
| **L7** Output Contracts | Self-validation rubrics | On-demand |
|
|
64
|
+
| **L8** Governance | Version, owner, review status (manifest only) | Never (audit) |
|
|
56
65
|
|
|
57
66
|
This keeps the always-loaded context slim while providing access to thousands of lines of senior expertise when needed.
|
|
58
67
|
|
|
@@ -91,7 +100,7 @@ npx aigent-team generate
|
|
|
91
100
|
|
|
92
101
|
When run without flags, an interactive wizard lets you choose:
|
|
93
102
|
- **Generate mode**: Platform configs or Plugin bundle
|
|
94
|
-
- **Scopes**: Agents, Skills, References
|
|
103
|
+
- **Scopes**: Agents, Skills, References, Examples, Output Contracts, Scripts, Assets
|
|
95
104
|
- **Team agents**: which roles to generate
|
|
96
105
|
- **Target platforms**: which platforms to generate for
|
|
97
106
|
|
|
@@ -186,6 +195,31 @@ npx aigent-team validate
|
|
|
186
195
|
|
|
187
196
|
Checks generated files against each platform's constraints (file size, frontmatter format, naming).
|
|
188
197
|
|
|
198
|
+
### Audit
|
|
199
|
+
|
|
200
|
+
```bash
|
|
201
|
+
npx aigent-team audit
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
Reports skill governance status across all agents:
|
|
205
|
+
- **Status breakdown**: active, draft, review-needed, deprecated
|
|
206
|
+
- **Errors**: deprecated skills (exits with code 1 for CI integration)
|
|
207
|
+
- **Warnings**: skills needing review, missing governance metadata
|
|
208
|
+
- **Info**: draft skills, missing version/owner
|
|
209
|
+
|
|
210
|
+
Skills opt into governance via frontmatter:
|
|
211
|
+
|
|
212
|
+
```yaml
|
|
213
|
+
---
|
|
214
|
+
name: Analyze Bundle Size
|
|
215
|
+
governance:
|
|
216
|
+
version: "1.0.0"
|
|
217
|
+
owner: fe-team
|
|
218
|
+
status: active
|
|
219
|
+
lastReviewedAt: "2025-03-15"
|
|
220
|
+
---
|
|
221
|
+
```
|
|
222
|
+
|
|
189
223
|
## Configuration
|
|
190
224
|
|
|
191
225
|
Create `aigent-team.config.json` (or `.ts` / `.js`) in your project root:
|
|
@@ -250,8 +284,10 @@ npx aigent-team generate --platform claude-code # Single platform
|
|
|
250
284
|
npx aigent-team generate --scope skills # Only skill files
|
|
251
285
|
npx aigent-team generate --team fe,be # Only FE + BE agents
|
|
252
286
|
npx aigent-team generate --scope plugin # Plugin bundle
|
|
287
|
+
npx aigent-team generate --scope examples,scripts # Only examples + scripts
|
|
253
288
|
npx aigent-team install ./plugin --force # Install plugin
|
|
254
289
|
npx aigent-team uninstall my-app # Remove plugin
|
|
290
|
+
npx aigent-team audit # Governance audit
|
|
255
291
|
```
|
|
256
292
|
|
|
257
293
|
## Generated output
|
|
@@ -261,13 +297,17 @@ After running `aigent-team generate`, you'll see:
|
|
|
261
297
|
```
|
|
262
298
|
# Claude Code
|
|
263
299
|
.claude/agents/fe-agent.md # Rules + skill index (always loaded)
|
|
264
|
-
.claude/agents/fe-agent/references/ # Deep reference docs
|
|
300
|
+
.claude/agents/fe-agent/references/ # Deep reference docs (L3)
|
|
265
301
|
├── component-architecture.md
|
|
266
302
|
├── state-management.md
|
|
267
303
|
└── ...
|
|
268
|
-
.claude/agents/fe-agent/skills/ # Executable procedures
|
|
304
|
+
.claude/agents/fe-agent/skills/ # Executable procedures (L2)
|
|
269
305
|
├── analyze-bundle.md
|
|
270
306
|
└── component-audit.md
|
|
307
|
+
.claude/agents/fe-agent/examples/ # Few-shot examples (L4)
|
|
308
|
+
.claude/agents/fe-agent/contracts/ # Output contracts (L7)
|
|
309
|
+
.claude/agents/fe-agent/scripts/ # Automation scripts (L5)
|
|
310
|
+
.claude/agents/fe-agent/assets/ # Templates & resources (L6)
|
|
271
311
|
CLAUDE.md # Agent team overview
|
|
272
312
|
|
|
273
313
|
# Cursor
|
|
@@ -415,6 +455,7 @@ This mirrors how a real tech lead operates — delegating to specialists and ens
|
|
|
415
455
|
| [Agent Reference](docs/base/agents.md) | All 6 agents — roles, capabilities, reference file catalog |
|
|
416
456
|
| [Vision & Roadmap](docs/base/vision.md) | Future plans, design principles, platform expansion |
|
|
417
457
|
| [RFC-001: Scope & Plugin](docs/rfcs/rfc-001-generate-scope.md) | `--scope`, `--team`, plugin system design |
|
|
458
|
+
| [RFC-002: Content Layers](docs/rfcs/rfc-002-skill-content-layers.md) | 9-layer architecture (L0–L8), frontmatter, governance |
|
|
418
459
|
| [Contributing](CONTRIBUTING.md) | Development setup, how to add agents/compilers |
|
|
419
460
|
| [Changelog](CHANGELOG.md) | Release history |
|
|
420
461
|
|
|
@@ -4,7 +4,7 @@ import { createRequire } from 'module'; const require = createRequire(import.met
|
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
var PLATFORMS = ["claude-code", "cursor", "codex", "antigravity"];
|
|
6
6
|
var TEAM_ROLES = ["lead", "ba", "fe", "be", "qa", "devops"];
|
|
7
|
-
var GENERATE_SCOPES = ["all", "agents", "skills", "references", "plugin"];
|
|
7
|
+
var GENERATE_SCOPES = ["all", "agents", "skills", "references", "examples", "output-contracts", "scripts", "assets", "plugin"];
|
|
8
8
|
var PLUGIN_BUNDLE_DIRS = {
|
|
9
9
|
"claude-code": "claude-code-plugin",
|
|
10
10
|
cursor: "cursor-ide-plugin",
|
|
@@ -81,6 +81,7 @@ import { readFileSync as readFileSync2, existsSync as existsSync2, readdirSync }
|
|
|
81
81
|
import { resolve as resolve2, dirname } from "path";
|
|
82
82
|
import { fileURLToPath } from "url";
|
|
83
83
|
import { parse as parseYaml } from "yaml";
|
|
84
|
+
import matter from "gray-matter";
|
|
84
85
|
import { deepmerge } from "deepmerge-ts";
|
|
85
86
|
var __dirname = dirname(fileURLToPath(import.meta.url));
|
|
86
87
|
var PACKAGE_ROOT = resolve2(__dirname, "..");
|
|
@@ -88,6 +89,13 @@ var TEMPLATES_DIR = existsSync2(resolve2(PACKAGE_ROOT, "templates")) ? resolve2(
|
|
|
88
89
|
function readIfExists(path) {
|
|
89
90
|
return existsSync2(path) ? readFileSync2(path, "utf-8").trim() : "";
|
|
90
91
|
}
|
|
92
|
+
function parseFrontmatter(raw) {
|
|
93
|
+
if (!raw.trimStart().startsWith("---")) {
|
|
94
|
+
return { data: {}, content: raw };
|
|
95
|
+
}
|
|
96
|
+
const { data, content } = matter(raw);
|
|
97
|
+
return { data, content: content.trim() };
|
|
98
|
+
}
|
|
91
99
|
function loadReferences(refsDir) {
|
|
92
100
|
if (!existsSync2(refsDir)) return [];
|
|
93
101
|
const refs = [];
|
|
@@ -97,47 +105,158 @@ function loadReferences(refsDir) {
|
|
|
97
105
|
const subDir = resolve2(refsDir, file.name);
|
|
98
106
|
const subFiles = readdirSync(subDir).filter((f) => f.endsWith(".md"));
|
|
99
107
|
for (const subFile of subFiles) {
|
|
100
|
-
const
|
|
108
|
+
const raw = readFileSync2(resolve2(subDir, subFile), "utf-8").trim();
|
|
109
|
+
const { data, content } = parseFrontmatter(raw);
|
|
101
110
|
const id = `${file.name}/${subFile.replace(".md", "")}`;
|
|
102
111
|
refs.push({
|
|
103
112
|
id,
|
|
104
|
-
title: subFile.replace(".md", "").replace(/-/g, " "),
|
|
105
|
-
description: "",
|
|
106
|
-
whenToRead: "",
|
|
107
|
-
content
|
|
113
|
+
title: data.title || subFile.replace(".md", "").replace(/-/g, " "),
|
|
114
|
+
description: data.description || "",
|
|
115
|
+
whenToRead: data.whenToRead || "",
|
|
116
|
+
content,
|
|
117
|
+
tags: data.tags || void 0
|
|
108
118
|
});
|
|
109
119
|
}
|
|
110
120
|
} else if (file.name.endsWith(".md")) {
|
|
111
|
-
const
|
|
121
|
+
const raw = readFileSync2(resolve2(refsDir, file.name), "utf-8").trim();
|
|
122
|
+
const { data, content } = parseFrontmatter(raw);
|
|
112
123
|
const id = file.name.replace(".md", "");
|
|
113
124
|
refs.push({
|
|
114
125
|
id,
|
|
115
|
-
title: id.replace(/-/g, " "),
|
|
116
|
-
description: "",
|
|
117
|
-
whenToRead: "",
|
|
118
|
-
content
|
|
126
|
+
title: data.title || id.replace(/-/g, " "),
|
|
127
|
+
description: data.description || "",
|
|
128
|
+
whenToRead: data.whenToRead || "",
|
|
129
|
+
content,
|
|
130
|
+
tags: data.tags || void 0
|
|
119
131
|
});
|
|
120
132
|
}
|
|
121
133
|
}
|
|
122
134
|
return refs;
|
|
123
135
|
}
|
|
136
|
+
var GOVERNANCE_STATUSES = ["draft", "active", "review-needed", "deprecated"];
|
|
137
|
+
function parseGovernance(data) {
|
|
138
|
+
const gov = data.governance;
|
|
139
|
+
if (!gov) return void 0;
|
|
140
|
+
const result = {};
|
|
141
|
+
if (typeof gov.version === "string") result.version = gov.version;
|
|
142
|
+
if (typeof gov.owner === "string") result.owner = gov.owner;
|
|
143
|
+
if (typeof gov.status === "string" && GOVERNANCE_STATUSES.includes(gov.status)) {
|
|
144
|
+
result.status = gov.status;
|
|
145
|
+
}
|
|
146
|
+
if (typeof gov.lastReviewedAt === "string") result.lastReviewedAt = gov.lastReviewedAt;
|
|
147
|
+
if (typeof gov.deprecatedReason === "string") result.deprecatedReason = gov.deprecatedReason;
|
|
148
|
+
return Object.keys(result).length > 0 ? result : void 0;
|
|
149
|
+
}
|
|
124
150
|
function loadSkills(skillsDir) {
|
|
125
151
|
if (!existsSync2(skillsDir)) return [];
|
|
126
152
|
const skills = [];
|
|
127
153
|
const files = readdirSync(skillsDir).filter((f) => f.endsWith(".md"));
|
|
128
154
|
for (const file of files) {
|
|
129
|
-
const
|
|
155
|
+
const raw = readFileSync2(resolve2(skillsDir, file), "utf-8").trim();
|
|
156
|
+
const { data, content } = parseFrontmatter(raw);
|
|
130
157
|
const id = file.replace(".md", "");
|
|
131
158
|
skills.push({
|
|
132
159
|
id,
|
|
133
|
-
name: id.replace(/-/g, " "),
|
|
134
|
-
description: "",
|
|
135
|
-
trigger: "",
|
|
136
|
-
content
|
|
160
|
+
name: data.name || id.replace(/-/g, " "),
|
|
161
|
+
description: data.description || "",
|
|
162
|
+
trigger: data.trigger || "",
|
|
163
|
+
content,
|
|
164
|
+
useCases: data.useCases || void 0,
|
|
165
|
+
tags: data.tags || void 0,
|
|
166
|
+
governance: parseGovernance(data)
|
|
137
167
|
});
|
|
138
168
|
}
|
|
139
169
|
return skills;
|
|
140
170
|
}
|
|
171
|
+
function loadExamples(examplesDir) {
|
|
172
|
+
if (!existsSync2(examplesDir)) return [];
|
|
173
|
+
return readdirSync(examplesDir).filter((f) => f.endsWith(".md")).map((f) => {
|
|
174
|
+
const raw = readFileSync2(resolve2(examplesDir, f), "utf-8").trim();
|
|
175
|
+
const { data, content } = parseFrontmatter(raw);
|
|
176
|
+
const id = f.replace(".md", "");
|
|
177
|
+
return {
|
|
178
|
+
id,
|
|
179
|
+
name: data.name || id.replace(/-/g, " "),
|
|
180
|
+
description: data.description || "",
|
|
181
|
+
skillRef: data.skillRef || void 0,
|
|
182
|
+
content,
|
|
183
|
+
tags: data.tags || void 0
|
|
184
|
+
};
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
function loadOutputContracts(contractsDir) {
|
|
188
|
+
if (!existsSync2(contractsDir)) return [];
|
|
189
|
+
return readdirSync(contractsDir).filter((f) => f.endsWith(".md")).map((f) => {
|
|
190
|
+
const raw = readFileSync2(resolve2(contractsDir, f), "utf-8").trim();
|
|
191
|
+
const { data, content } = parseFrontmatter(raw);
|
|
192
|
+
const id = f.replace(".md", "");
|
|
193
|
+
return {
|
|
194
|
+
id,
|
|
195
|
+
name: data.name || id.replace(/-/g, " "),
|
|
196
|
+
description: data.description || "",
|
|
197
|
+
skillRef: data.skillRef || void 0,
|
|
198
|
+
format: data.format || void 0,
|
|
199
|
+
content,
|
|
200
|
+
tags: data.tags || void 0
|
|
201
|
+
};
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
var SCRIPT_EXTENSIONS = [".md", ".sh", ".py", ".js", ".ts"];
|
|
205
|
+
function inferLanguage(filename) {
|
|
206
|
+
const ext = filename.slice(filename.lastIndexOf("."));
|
|
207
|
+
const map = {
|
|
208
|
+
".sh": "bash",
|
|
209
|
+
".py": "python",
|
|
210
|
+
".js": "javascript",
|
|
211
|
+
".ts": "typescript",
|
|
212
|
+
".md": "markdown"
|
|
213
|
+
};
|
|
214
|
+
return map[ext] || "unknown";
|
|
215
|
+
}
|
|
216
|
+
function loadScripts(scriptsDir) {
|
|
217
|
+
if (!existsSync2(scriptsDir)) return [];
|
|
218
|
+
return readdirSync(scriptsDir).filter((f) => SCRIPT_EXTENSIONS.some((ext) => f.endsWith(ext))).map((f) => {
|
|
219
|
+
const raw = readFileSync2(resolve2(scriptsDir, f), "utf-8").trim();
|
|
220
|
+
const { data, content } = parseFrontmatter(raw);
|
|
221
|
+
const id = f.replace(/\.[^.]+$/, "");
|
|
222
|
+
return {
|
|
223
|
+
id,
|
|
224
|
+
name: data.name || id.replace(/-/g, " "),
|
|
225
|
+
description: data.description || "",
|
|
226
|
+
language: data.language || inferLanguage(f),
|
|
227
|
+
content,
|
|
228
|
+
tags: data.tags || void 0
|
|
229
|
+
};
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
var ASSET_EXTENSIONS = [".md", ".json", ".yaml", ".yml", ".html"];
|
|
233
|
+
function inferFormat(filename) {
|
|
234
|
+
const ext = filename.slice(filename.lastIndexOf("."));
|
|
235
|
+
const map = {
|
|
236
|
+
".md": "markdown",
|
|
237
|
+
".json": "json",
|
|
238
|
+
".yaml": "yaml",
|
|
239
|
+
".yml": "yaml",
|
|
240
|
+
".html": "html"
|
|
241
|
+
};
|
|
242
|
+
return map[ext] || "unknown";
|
|
243
|
+
}
|
|
244
|
+
function loadAssets(assetsDir) {
|
|
245
|
+
if (!existsSync2(assetsDir)) return [];
|
|
246
|
+
return readdirSync(assetsDir).filter((f) => ASSET_EXTENSIONS.some((ext) => f.endsWith(ext))).map((f) => {
|
|
247
|
+
const raw = readFileSync2(resolve2(assetsDir, f), "utf-8").trim();
|
|
248
|
+
const { data, content } = parseFrontmatter(raw);
|
|
249
|
+
const id = f.replace(/\.[^.]+$/, "");
|
|
250
|
+
return {
|
|
251
|
+
id,
|
|
252
|
+
name: data.name || id.replace(/-/g, " "),
|
|
253
|
+
description: data.description || "",
|
|
254
|
+
format: data.format || inferFormat(f),
|
|
255
|
+
content,
|
|
256
|
+
tags: data.tags || void 0
|
|
257
|
+
};
|
|
258
|
+
});
|
|
259
|
+
}
|
|
141
260
|
function loadBuiltinAgent(role) {
|
|
142
261
|
const teamDir = resolve2(TEMPLATES_DIR, "teams", role);
|
|
143
262
|
const agentYaml = readFileSync2(resolve2(teamDir, "agent.yaml"), "utf-8");
|
|
@@ -148,6 +267,10 @@ function loadBuiltinAgent(role) {
|
|
|
148
267
|
const references = loadReferences(resolve2(teamDir, "references"));
|
|
149
268
|
const rulesContent = readIfExists(resolve2(teamDir, "rules.md"));
|
|
150
269
|
const skills = loadSkills(resolve2(teamDir, "skills"));
|
|
270
|
+
const examples = loadExamples(resolve2(teamDir, "examples"));
|
|
271
|
+
const outputContracts = loadOutputContracts(resolve2(teamDir, "output-contracts"));
|
|
272
|
+
const scripts = loadScripts(resolve2(teamDir, "scripts"));
|
|
273
|
+
const assets = loadAssets(resolve2(teamDir, "assets"));
|
|
151
274
|
return {
|
|
152
275
|
id: agentDef.id,
|
|
153
276
|
name: agentDef.name,
|
|
@@ -164,6 +287,10 @@ function loadBuiltinAgent(role) {
|
|
|
164
287
|
references,
|
|
165
288
|
rulesContent,
|
|
166
289
|
skills,
|
|
290
|
+
examples,
|
|
291
|
+
outputContracts,
|
|
292
|
+
scripts,
|
|
293
|
+
assets,
|
|
167
294
|
globs: agentDef.globs || []
|
|
168
295
|
};
|
|
169
296
|
}
|
|
@@ -216,6 +343,22 @@ function loadAgents(config, cwd = process.cwd()) {
|
|
|
216
343
|
if (localSkills.length) {
|
|
217
344
|
agent.skills = [...agent.skills, ...localSkills];
|
|
218
345
|
}
|
|
346
|
+
const localExamples = loadExamples(resolve2(localDir, "examples"));
|
|
347
|
+
if (localExamples.length) {
|
|
348
|
+
agent.examples = [...agent.examples, ...localExamples];
|
|
349
|
+
}
|
|
350
|
+
const localContracts = loadOutputContracts(resolve2(localDir, "output-contracts"));
|
|
351
|
+
if (localContracts.length) {
|
|
352
|
+
agent.outputContracts = [...agent.outputContracts, ...localContracts];
|
|
353
|
+
}
|
|
354
|
+
const localScripts = loadScripts(resolve2(localDir, "scripts"));
|
|
355
|
+
if (localScripts.length) {
|
|
356
|
+
agent.scripts = [...agent.scripts, ...localScripts];
|
|
357
|
+
}
|
|
358
|
+
const localAssets = loadAssets(resolve2(localDir, "assets"));
|
|
359
|
+
if (localAssets.length) {
|
|
360
|
+
agent.assets = [...agent.assets, ...localAssets];
|
|
361
|
+
}
|
|
219
362
|
}
|
|
220
363
|
const resolvedShared = [];
|
|
221
364
|
for (const ref of agent.sharedKnowledge) {
|
|
@@ -244,20 +387,92 @@ function assembleSkillIndex(agent) {
|
|
|
244
387
|
} else {
|
|
245
388
|
parts.push(assembleAgentMarkdown(agent));
|
|
246
389
|
}
|
|
247
|
-
if (agent.
|
|
248
|
-
const
|
|
249
|
-
|
|
390
|
+
if (agent.references?.length) {
|
|
391
|
+
const refsWithMeta = agent.references.filter((r) => r.whenToRead);
|
|
392
|
+
if (refsWithMeta.length) {
|
|
393
|
+
const refLines = refsWithMeta.map(
|
|
394
|
+
(r) => `| \`${r.id}\` | ${r.title} | ${r.whenToRead} |`
|
|
395
|
+
);
|
|
396
|
+
parts.push([
|
|
397
|
+
"## Reference Files",
|
|
398
|
+
"",
|
|
399
|
+
"Load the relevant reference file when you need deep knowledge:",
|
|
400
|
+
"",
|
|
401
|
+
"| Reference | Title | When to read |",
|
|
402
|
+
"|-----------|-------|-------------|",
|
|
403
|
+
...refLines
|
|
404
|
+
].join("\n"));
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
if (agent.examples?.length) {
|
|
408
|
+
const exampleLines = agent.examples.map(
|
|
409
|
+
(e) => `| \`${e.id}\` | ${e.name} | ${e.skillRef || "\u2014"} |`
|
|
250
410
|
);
|
|
411
|
+
parts.push([
|
|
412
|
+
"## Examples",
|
|
413
|
+
"",
|
|
414
|
+
"Load the relevant example file for few-shot guidance:",
|
|
415
|
+
"",
|
|
416
|
+
"| Example | Name | Skill Ref |",
|
|
417
|
+
"|---------|------|-----------|",
|
|
418
|
+
...exampleLines
|
|
419
|
+
].join("\n"));
|
|
420
|
+
}
|
|
421
|
+
if (agent.outputContracts?.length) {
|
|
422
|
+
const contractLines = agent.outputContracts.map(
|
|
423
|
+
(c) => `| \`${c.id}\` | ${c.name} | ${c.format || "\u2014"} |`
|
|
424
|
+
);
|
|
425
|
+
parts.push([
|
|
426
|
+
"## Output Contracts",
|
|
427
|
+
"",
|
|
428
|
+
"Validate your output against the relevant contract:",
|
|
429
|
+
"",
|
|
430
|
+
"| Contract | Name | Format |",
|
|
431
|
+
"|----------|------|--------|",
|
|
432
|
+
...contractLines
|
|
433
|
+
].join("\n"));
|
|
434
|
+
}
|
|
435
|
+
if (agent.skills?.length) {
|
|
436
|
+
const hasTriggers = agent.skills.some((s) => s.trigger);
|
|
437
|
+
const skillLines = hasTriggers ? agent.skills.map((s) => `| \`${s.id}\` | ${s.name} | ${s.trigger || "\u2014"} |`) : agent.skills.map((s) => `| \`${s.id}\` | ${s.name} |`);
|
|
438
|
+
const header = hasTriggers ? ["| Skill | Name | Trigger |", "|-------|------|---------|"] : ["| Skill | Name |", "|-------|------|"];
|
|
251
439
|
parts.push([
|
|
252
440
|
"## Executable Skills",
|
|
253
441
|
"",
|
|
254
442
|
"Load the relevant skill file when performing these procedures:",
|
|
255
443
|
"",
|
|
256
|
-
|
|
257
|
-
"|-------|------|",
|
|
444
|
+
...header,
|
|
258
445
|
...skillLines
|
|
259
446
|
].join("\n"));
|
|
260
447
|
}
|
|
448
|
+
if (agent.scripts?.length) {
|
|
449
|
+
const scriptLines = agent.scripts.map(
|
|
450
|
+
(s) => `| \`${s.id}\` | ${s.name} | ${s.language} |`
|
|
451
|
+
);
|
|
452
|
+
parts.push([
|
|
453
|
+
"## Scripts",
|
|
454
|
+
"",
|
|
455
|
+
"Available automation and validation scripts:",
|
|
456
|
+
"",
|
|
457
|
+
"| Script | Name | Language |",
|
|
458
|
+
"|--------|------|----------|",
|
|
459
|
+
...scriptLines
|
|
460
|
+
].join("\n"));
|
|
461
|
+
}
|
|
462
|
+
if (agent.assets?.length) {
|
|
463
|
+
const assetLines = agent.assets.map(
|
|
464
|
+
(a) => `| \`${a.id}\` | ${a.name} | ${a.format} |`
|
|
465
|
+
);
|
|
466
|
+
parts.push([
|
|
467
|
+
"## Assets",
|
|
468
|
+
"",
|
|
469
|
+
"Available templates and resource files:",
|
|
470
|
+
"",
|
|
471
|
+
"| Asset | Name | Format |",
|
|
472
|
+
"|-------|------|--------|",
|
|
473
|
+
...assetLines
|
|
474
|
+
].join("\n"));
|
|
475
|
+
}
|
|
261
476
|
return parts.join("\n\n");
|
|
262
477
|
}
|
|
263
478
|
function assembleAgentMarkdown(agent) {
|
|
@@ -318,6 +533,18 @@ function assembleReference(ref) {
|
|
|
318
533
|
function assembleSkill(skill) {
|
|
319
534
|
return skill.content;
|
|
320
535
|
}
|
|
536
|
+
function assembleExample(example) {
|
|
537
|
+
return example.content;
|
|
538
|
+
}
|
|
539
|
+
function assembleOutputContract(contract) {
|
|
540
|
+
return contract.content;
|
|
541
|
+
}
|
|
542
|
+
function assembleScript(script) {
|
|
543
|
+
return script.content;
|
|
544
|
+
}
|
|
545
|
+
function assembleAsset(asset) {
|
|
546
|
+
return asset.content;
|
|
547
|
+
}
|
|
321
548
|
|
|
322
549
|
export {
|
|
323
550
|
PLATFORMS,
|
|
@@ -326,9 +553,14 @@ export {
|
|
|
326
553
|
PLUGIN_BUNDLE_DIRS,
|
|
327
554
|
loadConfig,
|
|
328
555
|
configExists,
|
|
556
|
+
parseFrontmatter,
|
|
329
557
|
loadAgents,
|
|
330
558
|
assembleSkillIndex,
|
|
331
559
|
assembleAgentMarkdown,
|
|
332
560
|
assembleReference,
|
|
333
|
-
assembleSkill
|
|
561
|
+
assembleSkill,
|
|
562
|
+
assembleExample,
|
|
563
|
+
assembleOutputContract,
|
|
564
|
+
assembleScript,
|
|
565
|
+
assembleAsset
|
|
334
566
|
};
|