aigent-team 0.2.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 +150 -13
- package/dist/{chunk-U3NGK2UZ.js → chunk-OMO7OMKB.js} +264 -22
- package/dist/cli.js +1750 -217
- package/dist/index.d.ts +54 -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
|
|
|
@@ -81,13 +90,102 @@ Interactive wizard that:
|
|
|
81
90
|
2. Lets you pick which team agents to enable
|
|
82
91
|
3. Creates `aigent-team.config.json`
|
|
83
92
|
|
|
93
|
+
> **Note:** `init` only creates the config file. Run `aigent-team generate` to generate platform configs.
|
|
94
|
+
|
|
84
95
|
### Generate
|
|
85
96
|
|
|
86
97
|
```bash
|
|
87
98
|
npx aigent-team generate
|
|
88
99
|
```
|
|
89
100
|
|
|
90
|
-
|
|
101
|
+
When run without flags, an interactive wizard lets you choose:
|
|
102
|
+
- **Generate mode**: Platform configs or Plugin bundle
|
|
103
|
+
- **Scopes**: Agents, Skills, References, Examples, Output Contracts, Scripts, Assets
|
|
104
|
+
- **Team agents**: which roles to generate
|
|
105
|
+
- **Target platforms**: which platforms to generate for
|
|
106
|
+
|
|
107
|
+
You can also pass flags to skip the wizard:
|
|
108
|
+
|
|
109
|
+
#### Scope filtering
|
|
110
|
+
|
|
111
|
+
Generate only specific output types:
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
# Only agent skill index files (no references or skills)
|
|
115
|
+
npx aigent-team generate --scope agents
|
|
116
|
+
|
|
117
|
+
# Only executable skill files
|
|
118
|
+
npx aigent-team generate --scope skills
|
|
119
|
+
|
|
120
|
+
# Only reference docs
|
|
121
|
+
npx aigent-team generate --scope references
|
|
122
|
+
|
|
123
|
+
# Combine scopes
|
|
124
|
+
npx aigent-team generate --scope agents,skills
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
#### Team filtering
|
|
128
|
+
|
|
129
|
+
Override the config's `teams` array from the CLI:
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
# Generate only for FE and BE agents
|
|
133
|
+
npx aigent-team generate --team fe,be
|
|
134
|
+
|
|
135
|
+
# Combine with scope: only skills for QA
|
|
136
|
+
npx aigent-team generate --scope skills --team qa
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### Plugin system
|
|
140
|
+
|
|
141
|
+
Create a self-contained plugin bundle:
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
# Generate plugin bundle
|
|
145
|
+
npx aigent-team generate --scope plugin
|
|
146
|
+
|
|
147
|
+
# Or select "Plugin bundle" in the interactive wizard
|
|
148
|
+
npx aigent-team generate
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
This creates a `.aigent-team-plugin/` directory (configurable via `output.pluginDir`) with self-contained per-platform bundles:
|
|
152
|
+
|
|
153
|
+
```
|
|
154
|
+
.aigent-team-plugin/
|
|
155
|
+
├── manifest.json # Metadata: version, roles, platforms, agent info
|
|
156
|
+
├── claude-code-plugin/ # Self-contained Claude Code bundle
|
|
157
|
+
│ ├── rules/ # Hub file (CLAUDE.md)
|
|
158
|
+
│ ├── agents/ # Agent skill indexes
|
|
159
|
+
│ ├── skills/{agent}/ # Executable skill files
|
|
160
|
+
│ └── kb/ # References + shared knowledge
|
|
161
|
+
│ ├── {agent}/ # Per-agent reference docs
|
|
162
|
+
│ └── shared/ # Shared knowledge files
|
|
163
|
+
├── cursor-ide-plugin/ # Self-contained Cursor bundle
|
|
164
|
+
│ ├── .cursor-plugin/ # Plugin manifest
|
|
165
|
+
│ ├── rules/ # Shared conventions
|
|
166
|
+
│ ├── agents/ # Agent .mdc files
|
|
167
|
+
│ ├── skills/ # Skill files
|
|
168
|
+
│ └── kb/ # References
|
|
169
|
+
└── ... # Other platform bundles
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
Each platform bundle is fully self-contained — all agents, skills, references, and shared knowledge are inside. Users can distribute or install any bundle independently.
|
|
173
|
+
|
|
174
|
+
Install a plugin into a project:
|
|
175
|
+
|
|
176
|
+
```bash
|
|
177
|
+
# Install plugin — converts to platform-native formats
|
|
178
|
+
npx aigent-team install ./path/to/plugin
|
|
179
|
+
|
|
180
|
+
# Install for specific platform only
|
|
181
|
+
npx aigent-team install ./plugin --platform cursor
|
|
182
|
+
|
|
183
|
+
# Overwrite existing files
|
|
184
|
+
npx aigent-team install ./plugin --force
|
|
185
|
+
|
|
186
|
+
# Uninstall — removes all files installed by the plugin
|
|
187
|
+
npx aigent-team uninstall my-plugin-name
|
|
188
|
+
```
|
|
91
189
|
|
|
92
190
|
### Validate
|
|
93
191
|
|
|
@@ -97,6 +195,31 @@ npx aigent-team validate
|
|
|
97
195
|
|
|
98
196
|
Checks generated files against each platform's constraints (file size, frontmatter format, naming).
|
|
99
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
|
+
|
|
100
223
|
## Configuration
|
|
101
224
|
|
|
102
225
|
Create `aigent-team.config.json` (or `.ts` / `.js`) in your project root:
|
|
@@ -132,6 +255,7 @@ Create `aigent-team.config.json` (or `.ts` / `.js`) in your project root:
|
|
|
132
255
|
| `teams` | `string[]` | Yes | Agent teams to enable: `lead`, `ba`, `fe`, `be`, `qa`, `devops` |
|
|
133
256
|
| `overrides` | `object` | No | Per-team overrides for `techStack`, `tools`, `globs` |
|
|
134
257
|
| `overrides.<team>.techStack` | `object` | No | Override `languages`, `frameworks`, `libraries`, `buildTools` |
|
|
258
|
+
| `output.pluginDir` | `string` | No | Plugin output directory (default: `.aigent-team-plugin/`) |
|
|
135
259
|
|
|
136
260
|
### Programmatic config
|
|
137
261
|
|
|
@@ -153,11 +277,17 @@ export default defineConfig({
|
|
|
153
277
|
});
|
|
154
278
|
```
|
|
155
279
|
|
|
156
|
-
###
|
|
280
|
+
### CLI flags
|
|
157
281
|
|
|
158
282
|
```bash
|
|
159
|
-
|
|
160
|
-
npx aigent-team generate --
|
|
283
|
+
npx aigent-team generate --platform claude-code # Single platform
|
|
284
|
+
npx aigent-team generate --scope skills # Only skill files
|
|
285
|
+
npx aigent-team generate --team fe,be # Only FE + BE agents
|
|
286
|
+
npx aigent-team generate --scope plugin # Plugin bundle
|
|
287
|
+
npx aigent-team generate --scope examples,scripts # Only examples + scripts
|
|
288
|
+
npx aigent-team install ./plugin --force # Install plugin
|
|
289
|
+
npx aigent-team uninstall my-app # Remove plugin
|
|
290
|
+
npx aigent-team audit # Governance audit
|
|
161
291
|
```
|
|
162
292
|
|
|
163
293
|
## Generated output
|
|
@@ -167,13 +297,17 @@ After running `aigent-team generate`, you'll see:
|
|
|
167
297
|
```
|
|
168
298
|
# Claude Code
|
|
169
299
|
.claude/agents/fe-agent.md # Rules + skill index (always loaded)
|
|
170
|
-
.claude/agents/fe-agent/references/ # Deep reference docs
|
|
300
|
+
.claude/agents/fe-agent/references/ # Deep reference docs (L3)
|
|
171
301
|
├── component-architecture.md
|
|
172
302
|
├── state-management.md
|
|
173
303
|
└── ...
|
|
174
|
-
.claude/agents/fe-agent/skills/ # Executable procedures
|
|
304
|
+
.claude/agents/fe-agent/skills/ # Executable procedures (L2)
|
|
175
305
|
├── analyze-bundle.md
|
|
176
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)
|
|
177
311
|
CLAUDE.md # Agent team overview
|
|
178
312
|
|
|
179
313
|
# Cursor
|
|
@@ -316,9 +450,12 @@ This mirrors how a real tech lead operates — delegating to specialists and ens
|
|
|
316
450
|
|
|
317
451
|
| Document | Description |
|
|
318
452
|
|---|---|
|
|
319
|
-
| [
|
|
320
|
-
| [
|
|
321
|
-
| [
|
|
453
|
+
| [Docs Index](docs/INDEX.md) | Entry point for all documentation, version history, RFC tracker |
|
|
454
|
+
| [Architecture](docs/base/architecture.md) | System design, data flow, module map, compiler pattern |
|
|
455
|
+
| [Agent Reference](docs/base/agents.md) | All 6 agents — roles, capabilities, reference file catalog |
|
|
456
|
+
| [Vision & Roadmap](docs/base/vision.md) | Future plans, design principles, platform expansion |
|
|
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 |
|
|
322
459
|
| [Contributing](CONTRIBUTING.md) | Development setup, how to add agents/compilers |
|
|
323
460
|
| [Changelog](CHANGELOG.md) | Release history |
|
|
324
461
|
|
|
@@ -4,6 +4,13 @@ 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", "examples", "output-contracts", "scripts", "assets", "plugin"];
|
|
8
|
+
var PLUGIN_BUNDLE_DIRS = {
|
|
9
|
+
"claude-code": "claude-code-plugin",
|
|
10
|
+
cursor: "cursor-ide-plugin",
|
|
11
|
+
codex: "codex-plugin",
|
|
12
|
+
antigravity: "antigravity-plugin"
|
|
13
|
+
};
|
|
7
14
|
var TechStackSchema = z.object({
|
|
8
15
|
languages: z.array(z.string()).optional(),
|
|
9
16
|
frameworks: z.array(z.string()).optional(),
|
|
@@ -35,7 +42,8 @@ var ConfigSchema = z.object({
|
|
|
35
42
|
architecture: z.string().optional()
|
|
36
43
|
}).optional(),
|
|
37
44
|
output: z.object({
|
|
38
|
-
directory: z.string().optional()
|
|
45
|
+
directory: z.string().optional(),
|
|
46
|
+
pluginDir: z.string().optional()
|
|
39
47
|
}).optional()
|
|
40
48
|
});
|
|
41
49
|
|
|
@@ -73,6 +81,7 @@ import { readFileSync as readFileSync2, existsSync as existsSync2, readdirSync }
|
|
|
73
81
|
import { resolve as resolve2, dirname } from "path";
|
|
74
82
|
import { fileURLToPath } from "url";
|
|
75
83
|
import { parse as parseYaml } from "yaml";
|
|
84
|
+
import matter from "gray-matter";
|
|
76
85
|
import { deepmerge } from "deepmerge-ts";
|
|
77
86
|
var __dirname = dirname(fileURLToPath(import.meta.url));
|
|
78
87
|
var PACKAGE_ROOT = resolve2(__dirname, "..");
|
|
@@ -80,6 +89,13 @@ var TEMPLATES_DIR = existsSync2(resolve2(PACKAGE_ROOT, "templates")) ? resolve2(
|
|
|
80
89
|
function readIfExists(path) {
|
|
81
90
|
return existsSync2(path) ? readFileSync2(path, "utf-8").trim() : "";
|
|
82
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
|
+
}
|
|
83
99
|
function loadReferences(refsDir) {
|
|
84
100
|
if (!existsSync2(refsDir)) return [];
|
|
85
101
|
const refs = [];
|
|
@@ -89,47 +105,158 @@ function loadReferences(refsDir) {
|
|
|
89
105
|
const subDir = resolve2(refsDir, file.name);
|
|
90
106
|
const subFiles = readdirSync(subDir).filter((f) => f.endsWith(".md"));
|
|
91
107
|
for (const subFile of subFiles) {
|
|
92
|
-
const
|
|
108
|
+
const raw = readFileSync2(resolve2(subDir, subFile), "utf-8").trim();
|
|
109
|
+
const { data, content } = parseFrontmatter(raw);
|
|
93
110
|
const id = `${file.name}/${subFile.replace(".md", "")}`;
|
|
94
111
|
refs.push({
|
|
95
112
|
id,
|
|
96
|
-
title: subFile.replace(".md", "").replace(/-/g, " "),
|
|
97
|
-
description: "",
|
|
98
|
-
whenToRead: "",
|
|
99
|
-
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
|
|
100
118
|
});
|
|
101
119
|
}
|
|
102
120
|
} else if (file.name.endsWith(".md")) {
|
|
103
|
-
const
|
|
121
|
+
const raw = readFileSync2(resolve2(refsDir, file.name), "utf-8").trim();
|
|
122
|
+
const { data, content } = parseFrontmatter(raw);
|
|
104
123
|
const id = file.name.replace(".md", "");
|
|
105
124
|
refs.push({
|
|
106
125
|
id,
|
|
107
|
-
title: id.replace(/-/g, " "),
|
|
108
|
-
description: "",
|
|
109
|
-
whenToRead: "",
|
|
110
|
-
content
|
|
126
|
+
title: data.title || id.replace(/-/g, " "),
|
|
127
|
+
description: data.description || "",
|
|
128
|
+
whenToRead: data.whenToRead || "",
|
|
129
|
+
content,
|
|
130
|
+
tags: data.tags || void 0
|
|
111
131
|
});
|
|
112
132
|
}
|
|
113
133
|
}
|
|
114
134
|
return refs;
|
|
115
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
|
+
}
|
|
116
150
|
function loadSkills(skillsDir) {
|
|
117
151
|
if (!existsSync2(skillsDir)) return [];
|
|
118
152
|
const skills = [];
|
|
119
153
|
const files = readdirSync(skillsDir).filter((f) => f.endsWith(".md"));
|
|
120
154
|
for (const file of files) {
|
|
121
|
-
const
|
|
155
|
+
const raw = readFileSync2(resolve2(skillsDir, file), "utf-8").trim();
|
|
156
|
+
const { data, content } = parseFrontmatter(raw);
|
|
122
157
|
const id = file.replace(".md", "");
|
|
123
158
|
skills.push({
|
|
124
159
|
id,
|
|
125
|
-
name: id.replace(/-/g, " "),
|
|
126
|
-
description: "",
|
|
127
|
-
trigger: "",
|
|
128
|
-
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)
|
|
129
167
|
});
|
|
130
168
|
}
|
|
131
169
|
return skills;
|
|
132
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
|
+
}
|
|
133
260
|
function loadBuiltinAgent(role) {
|
|
134
261
|
const teamDir = resolve2(TEMPLATES_DIR, "teams", role);
|
|
135
262
|
const agentYaml = readFileSync2(resolve2(teamDir, "agent.yaml"), "utf-8");
|
|
@@ -140,6 +267,10 @@ function loadBuiltinAgent(role) {
|
|
|
140
267
|
const references = loadReferences(resolve2(teamDir, "references"));
|
|
141
268
|
const rulesContent = readIfExists(resolve2(teamDir, "rules.md"));
|
|
142
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"));
|
|
143
274
|
return {
|
|
144
275
|
id: agentDef.id,
|
|
145
276
|
name: agentDef.name,
|
|
@@ -156,6 +287,10 @@ function loadBuiltinAgent(role) {
|
|
|
156
287
|
references,
|
|
157
288
|
rulesContent,
|
|
158
289
|
skills,
|
|
290
|
+
examples,
|
|
291
|
+
outputContracts,
|
|
292
|
+
scripts,
|
|
293
|
+
assets,
|
|
159
294
|
globs: agentDef.globs || []
|
|
160
295
|
};
|
|
161
296
|
}
|
|
@@ -208,6 +343,22 @@ function loadAgents(config, cwd = process.cwd()) {
|
|
|
208
343
|
if (localSkills.length) {
|
|
209
344
|
agent.skills = [...agent.skills, ...localSkills];
|
|
210
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
|
+
}
|
|
211
362
|
}
|
|
212
363
|
const resolvedShared = [];
|
|
213
364
|
for (const ref of agent.sharedKnowledge) {
|
|
@@ -236,20 +387,92 @@ function assembleSkillIndex(agent) {
|
|
|
236
387
|
} else {
|
|
237
388
|
parts.push(assembleAgentMarkdown(agent));
|
|
238
389
|
}
|
|
239
|
-
if (agent.
|
|
240
|
-
const
|
|
241
|
-
|
|
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"} |`
|
|
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"} |`
|
|
242
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 |", "|-------|------|"];
|
|
243
439
|
parts.push([
|
|
244
440
|
"## Executable Skills",
|
|
245
441
|
"",
|
|
246
442
|
"Load the relevant skill file when performing these procedures:",
|
|
247
443
|
"",
|
|
248
|
-
|
|
249
|
-
"|-------|------|",
|
|
444
|
+
...header,
|
|
250
445
|
...skillLines
|
|
251
446
|
].join("\n"));
|
|
252
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
|
+
}
|
|
253
476
|
return parts.join("\n\n");
|
|
254
477
|
}
|
|
255
478
|
function assembleAgentMarkdown(agent) {
|
|
@@ -310,15 +533,34 @@ function assembleReference(ref) {
|
|
|
310
533
|
function assembleSkill(skill) {
|
|
311
534
|
return skill.content;
|
|
312
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
|
+
}
|
|
313
548
|
|
|
314
549
|
export {
|
|
315
550
|
PLATFORMS,
|
|
316
551
|
TEAM_ROLES,
|
|
552
|
+
GENERATE_SCOPES,
|
|
553
|
+
PLUGIN_BUNDLE_DIRS,
|
|
317
554
|
loadConfig,
|
|
318
555
|
configExists,
|
|
556
|
+
parseFrontmatter,
|
|
319
557
|
loadAgents,
|
|
320
558
|
assembleSkillIndex,
|
|
321
559
|
assembleAgentMarkdown,
|
|
322
560
|
assembleReference,
|
|
323
|
-
assembleSkill
|
|
561
|
+
assembleSkill,
|
|
562
|
+
assembleExample,
|
|
563
|
+
assembleOutputContract,
|
|
564
|
+
assembleScript,
|
|
565
|
+
assembleAsset
|
|
324
566
|
};
|