@agentfile/core 0.1.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/dist/generator.d.ts +12 -0
- package/dist/generator.d.ts.map +1 -0
- package/dist/generator.js +87 -0
- package/dist/generator.js.map +1 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +20 -0
- package/dist/index.js.map +1 -0
- package/dist/loader.d.ts +16 -0
- package/dist/loader.d.ts.map +1 -0
- package/dist/loader.js +82 -0
- package/dist/loader.js.map +1 -0
- package/dist/renderer.d.ts +15 -0
- package/dist/renderer.d.ts.map +1 -0
- package/dist/renderer.js +129 -0
- package/dist/renderer.js.map +1 -0
- package/dist/schema.d.ts +229 -0
- package/dist/schema.d.ts.map +1 -0
- package/dist/schema.js +45 -0
- package/dist/schema.js.map +1 -0
- package/package.json +45 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Contract, GenerateResult } from './schema.js';
|
|
2
|
+
export interface GenerateOptions {
|
|
3
|
+
root: string;
|
|
4
|
+
agents: string[];
|
|
5
|
+
dryRun?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export interface ValidateOptions {
|
|
8
|
+
contractPath: string;
|
|
9
|
+
}
|
|
10
|
+
export declare function validateContract(options: ValidateOptions): Contract;
|
|
11
|
+
export declare function generate(options: GenerateOptions): GenerateResult;
|
|
12
|
+
//# sourceMappingURL=generator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../src/generator.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,QAAQ,EAAY,cAAc,EAAe,MAAM,aAAa,CAAA;AAIlF,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAK,MAAM,CAAA;IACf,MAAM,EAAG,MAAM,EAAE,CAAA;IACjB,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB;AAED,MAAM,WAAW,eAAe;IAC9B,YAAY,EAAE,MAAM,CAAA;CACrB;AAqCD,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,eAAe,GAAG,QAAQ,CAEnE;AAID,wBAAgB,QAAQ,CAAC,OAAO,EAAE,eAAe,GAAG,cAAc,CAyDjE"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { writeFileSync, mkdirSync, existsSync } from 'fs';
|
|
3
|
+
import { join, dirname } from 'path';
|
|
4
|
+
import { loadContract, loadOverride, resolveAgent, resolveAgentSelection } from './loader.js';
|
|
5
|
+
import { renderTemplate, renderSkillMdc } from './renderer.js';
|
|
6
|
+
// ─── Helpers ───────────────────────────────────────────────────────────────
|
|
7
|
+
function writeFile(path, content, dryRun) {
|
|
8
|
+
if (dryRun)
|
|
9
|
+
return;
|
|
10
|
+
const dir = dirname(path);
|
|
11
|
+
if (!existsSync(dir))
|
|
12
|
+
mkdirSync(dir, { recursive: true });
|
|
13
|
+
writeFileSync(path, content, 'utf-8');
|
|
14
|
+
}
|
|
15
|
+
// Cursor generates one .mdc file per skill in addition to its main file
|
|
16
|
+
function generateCursorSkillFiles(root, contract, dryRun) {
|
|
17
|
+
if (!contract.skills.length)
|
|
18
|
+
return [];
|
|
19
|
+
return contract.skills.map(skill => {
|
|
20
|
+
const output = `.cursor/rules/skills/${skill.name}.mdc`;
|
|
21
|
+
const content = renderSkillMdc(skill);
|
|
22
|
+
try {
|
|
23
|
+
writeFile(join(root, output), content, dryRun);
|
|
24
|
+
return { status: 'ok', agent: `cursor:skill:${skill.name}`, output, content };
|
|
25
|
+
}
|
|
26
|
+
catch (err) {
|
|
27
|
+
return {
|
|
28
|
+
status: 'error',
|
|
29
|
+
agent: `cursor:skill:${skill.name}`,
|
|
30
|
+
error: err instanceof Error ? err : new Error(String(err))
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
// ─── Validate ──────────────────────────────────────────────────────────────
|
|
36
|
+
export function validateContract(options) {
|
|
37
|
+
return loadContract(options.contractPath);
|
|
38
|
+
}
|
|
39
|
+
// ─── Generate ──────────────────────────────────────────────────────────────
|
|
40
|
+
export function generate(options) {
|
|
41
|
+
const { root, agents: requestedAgents, dryRun = false } = options;
|
|
42
|
+
const contractPath = join(root, 'ai', 'contract.yaml');
|
|
43
|
+
const agentsDir = join(root, 'ai', 'agents');
|
|
44
|
+
const overridePath = join(root, 'ai.override.yaml');
|
|
45
|
+
const contract = loadContract(contractPath);
|
|
46
|
+
const override = loadOverride(overridePath);
|
|
47
|
+
const selection = resolveAgentSelection(requestedAgents, agentsDir);
|
|
48
|
+
const results = [];
|
|
49
|
+
// Report unknown agents as skipped
|
|
50
|
+
for (const unknown of selection.unknown) {
|
|
51
|
+
results.push({
|
|
52
|
+
status: 'skipped',
|
|
53
|
+
agent: unknown,
|
|
54
|
+
reason: `No agent folder found at ai/agents/${unknown}`
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
// Generate each resolved agent
|
|
58
|
+
for (const agentName of selection.resolved) {
|
|
59
|
+
const agentDir = join(agentsDir, agentName);
|
|
60
|
+
try {
|
|
61
|
+
const resolved = resolveAgent(agentsDir, agentName);
|
|
62
|
+
// Determine skills rendering format per agent
|
|
63
|
+
const skillsFormat = agentName === 'copilot' ? 'copilot' :
|
|
64
|
+
agentName === 'agents-md' ? 'agents-md' :
|
|
65
|
+
'markdown';
|
|
66
|
+
const content = renderTemplate(resolved.template, { contract, override }, skillsFormat);
|
|
67
|
+
const output = resolved.config.output;
|
|
68
|
+
writeFile(join(root, output), content, dryRun);
|
|
69
|
+
results.push({ status: 'ok', agent: agentName, output, content });
|
|
70
|
+
// Cursor: also generate per-skill .mdc files
|
|
71
|
+
if (agentName === 'cursor') {
|
|
72
|
+
const skillResults = generateCursorSkillFiles(root, contract, dryRun);
|
|
73
|
+
results.push(...skillResults);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
catch (err) {
|
|
77
|
+
results.push({
|
|
78
|
+
status: 'error',
|
|
79
|
+
agent: agentName,
|
|
80
|
+
error: err instanceof Error ? err : new Error(String(err))
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
const success = results.every(r => r.status !== 'error');
|
|
85
|
+
return { results, success };
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=generator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../src/generator.ts"],"names":[],"mappings":"AAAA,8BAA8B;AAC9B,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,IAAI,CAAA;AACzD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AAEpC,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA;AAC7F,OAAO,EAAE,cAAc,EAAE,cAAc,EAAqB,MAAM,eAAe,CAAA;AAejF,8EAA8E;AAE9E,SAAS,SAAS,CAAC,IAAY,EAAE,OAAe,EAAE,MAAe;IAC/D,IAAI,MAAM;QAAE,OAAM;IAClB,MAAM,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACzB,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC;QAAE,SAAS,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAA;IACzD,aAAa,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,CAAA;AACvC,CAAC;AAED,wEAAwE;AACxE,SAAS,wBAAwB,CAC/B,IAAgB,EAChB,QAAkB,EAClB,MAAiB;IAEjB,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM;QAAE,OAAO,EAAE,CAAA;IAEtC,OAAO,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE;QACjC,MAAM,MAAM,GAAI,wBAAwB,KAAK,CA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C,IAAI,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAA;gBACrE,OAAO,CAAC,IAAI,CAAC,GAAG,YAAY,CAAC,CAAA;YAC/B,CAAC;QACH,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,OAAO,CAAC,IAAI,CAAC;gBACX,MAAM,EAAE,OAAO;gBACf,KAAK,EAAG,SAAS;gBACjB,KAAK,EAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;aAC5D,CAAC,CAAA;QACJ,CAAC;IACH,CAAC;IAED,MAAM,OAAO,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,OAAO,CAAC,CAAA;IACxD,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,CAAA;AAC7B,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @agentfile/core
|
|
3
|
+
*
|
|
4
|
+
* Core engine for agentfile — schema validation, loading, rendering, and generation.
|
|
5
|
+
* This package is framework-agnostic and has no CLI concerns.
|
|
6
|
+
*
|
|
7
|
+
* Primary entry points:
|
|
8
|
+
* generate() — full generation pass
|
|
9
|
+
* validateContract() — schema validation only
|
|
10
|
+
* renderTemplate() — pure template rendering
|
|
11
|
+
*/
|
|
12
|
+
export { generate, validateContract } from './generator.js';
|
|
13
|
+
export type { GenerateOptions, ValidateOptions } from './generator.js';
|
|
14
|
+
export { renderTemplate, renderSkillMarkdown, renderSkillMdc, renderSkillCopilot } from './renderer.js';
|
|
15
|
+
export type { RenderContext, SkillsFormat } from './renderer.js';
|
|
16
|
+
export { loadContract, loadOverride, loadAgentConfig, loadAgentTemplate, resolveAgent, discoverAgents, resolveAgentSelection, ValidationError } from './loader.js';
|
|
17
|
+
export type { Skill, Contract, AgentConfig, Override, ResolvedAgent, AgentResult, GenerateResult, AgentSelection } from './schema.js';
|
|
18
|
+
export { ContractSchema, AgentConfigSchema, OverrideSchema, SkillSchema } from './schema.js';
|
|
19
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAc,gBAAgB,CAAA;AACnE,YAAY,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAGtE,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAA;AACvG,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,MAAQ,eAAe,CAAA;AAGlE,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,eAAe,EACf,iBAAiB,EACjB,YAAY,EACZ,cAAc,EACd,qBAAqB,EACrB,eAAe,EAChB,MAAkD,aAAa,CAAA;AAGhE,YAAY,EACV,KAAK,EACL,QAAQ,EACR,WAAW,EACX,QAAQ,EACR,aAAa,EACb,WAAW,EACX,cAAc,EACd,cAAc,EACf,MAAkD,aAAa,CAAA;AAGhE,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,cAAc,EACd,WAAW,EACZ,MAAkD,aAAa,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @agentfile/core
|
|
3
|
+
*
|
|
4
|
+
* Core engine for agentfile — schema validation, loading, rendering, and generation.
|
|
5
|
+
* This package is framework-agnostic and has no CLI concerns.
|
|
6
|
+
*
|
|
7
|
+
* Primary entry points:
|
|
8
|
+
* generate() — full generation pass
|
|
9
|
+
* validateContract() — schema validation only
|
|
10
|
+
* renderTemplate() — pure template rendering
|
|
11
|
+
*/
|
|
12
|
+
// ─── Generation API ────────────────────────────────────────────────────────
|
|
13
|
+
export { generate, validateContract } from './generator.js';
|
|
14
|
+
// ─── Rendering API ─────────────────────────────────────────────────────────
|
|
15
|
+
export { renderTemplate, renderSkillMarkdown, renderSkillMdc, renderSkillCopilot } from './renderer.js';
|
|
16
|
+
// ─── Loading API ───────────────────────────────────────────────────────────
|
|
17
|
+
export { loadContract, loadOverride, loadAgentConfig, loadAgentTemplate, resolveAgent, discoverAgents, resolveAgentSelection, ValidationError } from './loader.js';
|
|
18
|
+
// ─── Schemas (for consumers that want to validate custom inputs) ────────────
|
|
19
|
+
export { ContractSchema, AgentConfigSchema, OverrideSchema, SkillSchema } from './schema.js';
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,8EAA8E;AAC9E,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAc,gBAAgB,CAAA;AAGnE,8EAA8E;AAC9E,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAA;AAGvG,8EAA8E;AAC9E,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,eAAe,EACf,iBAAiB,EACjB,YAAY,EACZ,cAAc,EACd,qBAAqB,EACrB,eAAe,EAChB,MAAkD,aAAa,CAAA;AAchE,+EAA+E;AAC/E,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,cAAc,EACd,WAAW,EACZ,MAAkD,aAAa,CAAA"}
|
package/dist/loader.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { type Contract, type AgentConfig, type Override, type ResolvedAgent, type AgentSelection } from './schema.js';
|
|
3
|
+
export declare class ValidationError extends Error {
|
|
4
|
+
readonly file: string;
|
|
5
|
+
readonly issues: string[];
|
|
6
|
+
constructor(file: string, issues: string[]);
|
|
7
|
+
}
|
|
8
|
+
export declare function parseYaml<S extends z.ZodTypeAny>(path: string, schema: S): z.output<S>;
|
|
9
|
+
export declare function loadContract(contractPath: string): Contract;
|
|
10
|
+
export declare function loadAgentConfig(agentDir: string): AgentConfig;
|
|
11
|
+
export declare function loadAgentTemplate(agentDir: string): string;
|
|
12
|
+
export declare function resolveAgent(agentsDir: string, agentName: string): ResolvedAgent;
|
|
13
|
+
export declare function discoverAgents(agentsDir: string): string[];
|
|
14
|
+
export declare function loadOverride(overridePath: string): Override | null;
|
|
15
|
+
export declare function resolveAgentSelection(requested: string[], agentsDir: string): AgentSelection;
|
|
16
|
+
//# sourceMappingURL=loader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../src/loader.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,EAIL,KAAK,QAAQ,EACb,KAAK,WAAW,EAChB,KAAK,QAAQ,EACb,KAAK,aAAa,EAClB,KAAK,cAAc,EACpB,MAAM,aAAa,CAAA;AAIpB,qBAAa,eAAgB,SAAQ,KAAK;aACZ,IAAI,EAAE,MAAM;aAAkB,MAAM,EAAE,MAAM,EAAE;gBAA9C,IAAI,EAAE,MAAM,EAAkB,MAAM,EAAE,MAAM,EAAE;CAI3E;AAED,wBAAgB,SAAS,CAAC,CAAC,SAAS,CAAC,CAAC,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAwBtF;AAID,wBAAgB,YAAY,CAAC,YAAY,EAAE,MAAM,GAAG,QAAQ,CAE3D;AAID,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,WAAW,CAE7D;AAED,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAM1D;AAED,wBAAgB,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,aAAa,CAKhF;AAID,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,CAM1D;AAID,wBAAgB,YAAY,CAAC,YAAY,EAAE,MAAM,GAAG,QAAQ,GAAG,IAAI,CAGlE;AAID,wBAAgB,qBAAqB,CACnC,SAAS,EAAE,MAAM,EAAE,EACnB,SAAS,EAAG,MAAM,GACjB,cAAc,CAKhB"}
|
package/dist/loader.js
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { readFileSync, existsSync, readdirSync } from 'fs';
|
|
3
|
+
import { join } from 'path';
|
|
4
|
+
import { parse } from 'yaml';
|
|
5
|
+
import { ContractSchema, AgentConfigSchema, OverrideSchema } from './schema.js';
|
|
6
|
+
// ─── YAML Loader ───────────────────────────────────────────────────────────
|
|
7
|
+
export class ValidationError extends Error {
|
|
8
|
+
file;
|
|
9
|
+
issues;
|
|
10
|
+
constructor(file, issues) {
|
|
11
|
+
super(`Validation failed in ${file}:\n${issues.map(i => ` • ${i}`).join('\n')}`);
|
|
12
|
+
this.file = file;
|
|
13
|
+
this.issues = issues;
|
|
14
|
+
this.name = 'ValidationError';
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
export function parseYaml(path, schema) {
|
|
18
|
+
if (!existsSync(path)) {
|
|
19
|
+
throw new Error(`Required file not found: ${path}`);
|
|
20
|
+
}
|
|
21
|
+
let raw;
|
|
22
|
+
try {
|
|
23
|
+
raw = readFileSync(path, 'utf-8');
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
throw new Error(`Could not read file: ${path}`);
|
|
27
|
+
}
|
|
28
|
+
const parsed = parse(raw);
|
|
29
|
+
const result = schema.safeParse(parsed);
|
|
30
|
+
if (!result.success) {
|
|
31
|
+
const issues = result.error.issues.map(i => {
|
|
32
|
+
const path = i.path.length ? `${i.path.join('.')}: ` : '';
|
|
33
|
+
return `${path}${i.message}`;
|
|
34
|
+
});
|
|
35
|
+
throw new ValidationError(path, issues);
|
|
36
|
+
}
|
|
37
|
+
return result.data;
|
|
38
|
+
}
|
|
39
|
+
// ─── Contract Loader ───────────────────────────────────────────────────────
|
|
40
|
+
export function loadContract(contractPath) {
|
|
41
|
+
return parseYaml(contractPath, ContractSchema);
|
|
42
|
+
}
|
|
43
|
+
// ─── Agent Loaders ─────────────────────────────────────────────────────────
|
|
44
|
+
export function loadAgentConfig(agentDir) {
|
|
45
|
+
return parseYaml(join(agentDir, 'config.yaml'), AgentConfigSchema);
|
|
46
|
+
}
|
|
47
|
+
export function loadAgentTemplate(agentDir) {
|
|
48
|
+
const templatePath = join(agentDir, 'template.md');
|
|
49
|
+
if (!existsSync(templatePath)) {
|
|
50
|
+
throw new Error(`Template not found: ${templatePath}`);
|
|
51
|
+
}
|
|
52
|
+
return readFileSync(templatePath, 'utf-8');
|
|
53
|
+
}
|
|
54
|
+
export function resolveAgent(agentsDir, agentName) {
|
|
55
|
+
const agentDir = join(agentsDir, agentName);
|
|
56
|
+
const config = loadAgentConfig(agentDir);
|
|
57
|
+
const template = loadAgentTemplate(agentDir);
|
|
58
|
+
return { name: agentName, config, template };
|
|
59
|
+
}
|
|
60
|
+
// ─── Agent Discovery ───────────────────────────────────────────────────────
|
|
61
|
+
export function discoverAgents(agentsDir) {
|
|
62
|
+
if (!existsSync(agentsDir))
|
|
63
|
+
return [];
|
|
64
|
+
return readdirSync(agentsDir, { withFileTypes: true })
|
|
65
|
+
.filter(d => d.isDirectory())
|
|
66
|
+
.map(d => d.name)
|
|
67
|
+
.sort();
|
|
68
|
+
}
|
|
69
|
+
// ─── Override Loader ───────────────────────────────────────────────────────
|
|
70
|
+
export function loadOverride(overridePath) {
|
|
71
|
+
if (!existsSync(overridePath))
|
|
72
|
+
return null;
|
|
73
|
+
return parseYaml(overridePath, OverrideSchema);
|
|
74
|
+
}
|
|
75
|
+
// ─── Agent Selection ───────────────────────────────────────────────────────
|
|
76
|
+
export function resolveAgentSelection(requested, agentsDir) {
|
|
77
|
+
const available = discoverAgents(agentsDir);
|
|
78
|
+
const unknown = requested.filter(a => !available.includes(a));
|
|
79
|
+
const resolved = requested.filter(a => available.includes(a));
|
|
80
|
+
return { requested, available, resolved, unknown };
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=loader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loader.js","sourceRoot":"","sources":["../src/loader.ts"],"names":[],"mappings":"AAAA,8BAA8B;AAC9B,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,IAAI,CAAA;AAC1D,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAC3B,OAAO,EAAE,KAAK,EAAE,MAAM,MAAM,CAAA;AAG5B,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,cAAc,EAMf,MAAM,aAAa,CAAA;AAEpB,8EAA8E;AAE9E,MAAM,OAAO,eAAgB,SAAQ,KAAK;IACZ;IAA8B;IAA1D,YAA4B,IAAY,EAAkB,MAAgB;QACxE,KAAK,CAAC,wBAAwB,IAAI,MAAM,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;QADvD,SAAI,GAAJ,IAAI,CAAQ;QAAkB,WAAM,GAAN,MAAM,CAAU;QAExE,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAA;IAC/B,CAAC;CACF;AAED,MAAM,UAAU,SAAS,CAAyB,IAAY,EAAE,MAAS;IACvE,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;QACtB,MAAM,IAAI,KAAK,CAAC,4BAA4B,IAAI,EAAE,CAAC,CAAA;IACrD,CAAC;IAED,IAAI,GAAW,CAAA;IACf,IAAI,CAAC;QACH,GAAG,GAAG,YAAY,CA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/D,MAAM,QAAQ,GAAI,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAA;IAC9D,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAA;AACpD,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Contract, Override, Skill } from './schema.js';
|
|
2
|
+
export interface RenderContext {
|
|
3
|
+
contract: Contract;
|
|
4
|
+
override: Override | null;
|
|
5
|
+
}
|
|
6
|
+
export declare function renderSkillMarkdown(skill: Skill): string;
|
|
7
|
+
export declare function renderSkillMdc(skill: Skill): string;
|
|
8
|
+
export declare function renderSkillCopilot(skill: Skill): string;
|
|
9
|
+
export type SkillsFormat = 'markdown' | 'copilot' | 'agents-md';
|
|
10
|
+
/**
|
|
11
|
+
* Renders a template string using a RenderContext.
|
|
12
|
+
* skillsFormat controls how skills are rendered for a given agent.
|
|
13
|
+
*/
|
|
14
|
+
export declare function renderTemplate(template: string, ctx: RenderContext, skillsFormat?: SkillsFormat): string;
|
|
15
|
+
//# sourceMappingURL=renderer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"renderer.d.ts","sourceRoot":"","sources":["../src/renderer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAI5D,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,QAAQ,CAAA;IAClB,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAAA;CAC1B;AAoBD,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,CAgCxD;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,CAqCnD;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,CAIvD;AAqBD,MAAM,MAAM,YAAY,GAAG,UAAU,GAAG,SAAS,GAAG,WAAW,CAAA;AA2B/D;;;GAGG;AACH,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,MAAM,EAChB,GAAG,EAAE,aAAa,EAClB,YAAY,GAAE,YAAyB,GACtC,MAAM,CASR"}
|
package/dist/renderer.js
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
// ─── Helpers ───────────────────────────────────────────────────────────────
|
|
2
|
+
function renderList(items) {
|
|
3
|
+
return items.length
|
|
4
|
+
? items.map(item => `- ${item}`).join('\n')
|
|
5
|
+
: '_None defined._';
|
|
6
|
+
}
|
|
7
|
+
function renderOverrideBlocks(override) {
|
|
8
|
+
if (!override?.blocks?.length)
|
|
9
|
+
return '';
|
|
10
|
+
return override.blocks
|
|
11
|
+
.map(block => `\n## ${block.section}\n\n${block.content.trim()}`)
|
|
12
|
+
.join('\n');
|
|
13
|
+
}
|
|
14
|
+
// ─── Skill Renderers ───────────────────────────────────────────────────────
|
|
15
|
+
// Each format is a pure function: Skill → string
|
|
16
|
+
export function renderSkillMarkdown(skill) {
|
|
17
|
+
const lines = [];
|
|
18
|
+
lines.push(`### ${skill.name}`);
|
|
19
|
+
lines.push(`${skill.description}\n`);
|
|
20
|
+
if (skill.context.length) {
|
|
21
|
+
lines.push('**Context**');
|
|
22
|
+
skill.context.forEach(c => lines.push(`- ${c}`));
|
|
23
|
+
lines.push('');
|
|
24
|
+
}
|
|
25
|
+
lines.push('**Steps**');
|
|
26
|
+
skill.steps.forEach((s, i) => lines.push(`${i + 1}. ${s}`));
|
|
27
|
+
lines.push('');
|
|
28
|
+
if (skill.expected_output) {
|
|
29
|
+
lines.push('**Expected output**');
|
|
30
|
+
lines.push(skill.expected_output.trim());
|
|
31
|
+
lines.push('');
|
|
32
|
+
}
|
|
33
|
+
if (skill.examples.length) {
|
|
34
|
+
lines.push('**Examples**');
|
|
35
|
+
skill.examples.forEach(ex => {
|
|
36
|
+
lines.push(`- Input: \`${ex.input}\``);
|
|
37
|
+
lines.push(` Output: ${ex.output.trim()}`);
|
|
38
|
+
});
|
|
39
|
+
lines.push('');
|
|
40
|
+
}
|
|
41
|
+
return lines.join('\n');
|
|
42
|
+
}
|
|
43
|
+
export function renderSkillMdc(skill) {
|
|
44
|
+
const lines = [];
|
|
45
|
+
lines.push('---');
|
|
46
|
+
lines.push(`description: ${skill.description}`);
|
|
47
|
+
lines.push('alwaysApply: false');
|
|
48
|
+
lines.push('---');
|
|
49
|
+
lines.push('');
|
|
50
|
+
lines.push(`# ${skill.name}`);
|
|
51
|
+
lines.push('');
|
|
52
|
+
if (skill.context.length) {
|
|
53
|
+
lines.push('## Context');
|
|
54
|
+
skill.context.forEach(c => lines.push(`- ${c}`));
|
|
55
|
+
lines.push('');
|
|
56
|
+
}
|
|
57
|
+
lines.push('## Steps');
|
|
58
|
+
skill.steps.forEach((s, i) => lines.push(`${i + 1}. ${s}`));
|
|
59
|
+
lines.push('');
|
|
60
|
+
if (skill.expected_output) {
|
|
61
|
+
lines.push('## Expected output');
|
|
62
|
+
lines.push(skill.expected_output.trim());
|
|
63
|
+
lines.push('');
|
|
64
|
+
}
|
|
65
|
+
if (skill.examples.length) {
|
|
66
|
+
lines.push('## Examples');
|
|
67
|
+
skill.examples.forEach(ex => {
|
|
68
|
+
lines.push(`**Input:** ${ex.input}`);
|
|
69
|
+
lines.push(`**Output:** ${ex.output.trim()}`);
|
|
70
|
+
lines.push('');
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
return lines.join('\n').trim() + '\n';
|
|
74
|
+
}
|
|
75
|
+
export function renderSkillCopilot(skill) {
|
|
76
|
+
const steps = skill.steps.join('; ');
|
|
77
|
+
const context = skill.context.length ? ` Context: ${skill.context.join(', ')}.` : '';
|
|
78
|
+
return `- **${skill.name}**: ${skill.description}.${context} Steps: ${steps}.`;
|
|
79
|
+
}
|
|
80
|
+
// ─── Skills Block Renderers ────────────────────────────────────────────────
|
|
81
|
+
function renderSkillsMarkdown(skills) {
|
|
82
|
+
if (!skills.length)
|
|
83
|
+
return '';
|
|
84
|
+
return '\n## Skills\n\n' + skills.map(renderSkillMarkdown).join('\n');
|
|
85
|
+
}
|
|
86
|
+
function renderSkillsCopilot(skills) {
|
|
87
|
+
if (!skills.length)
|
|
88
|
+
return '';
|
|
89
|
+
return '\n## Available Workflows\n\n' + skills.map(renderSkillCopilot).join('\n');
|
|
90
|
+
}
|
|
91
|
+
function renderSkillsAgentsMd(skills) {
|
|
92
|
+
if (!skills.length)
|
|
93
|
+
return '';
|
|
94
|
+
return '\n## Skills\n\n' + skills.map(renderSkillMarkdown).join('\n');
|
|
95
|
+
}
|
|
96
|
+
function buildTokenMap(ctx, skillsFormat) {
|
|
97
|
+
const { project, rules, skills } = ctx.contract;
|
|
98
|
+
const renderSkills = () => {
|
|
99
|
+
switch (skillsFormat) {
|
|
100
|
+
case 'copilot': return renderSkillsCopilot(skills);
|
|
101
|
+
case 'agents-md': return renderSkillsAgentsMd(skills);
|
|
102
|
+
default: return renderSkillsMarkdown(skills);
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
return {
|
|
106
|
+
'project.name': project.name,
|
|
107
|
+
'project.stack.join(\', \')': project.stack.join(', '),
|
|
108
|
+
'rules.coding': renderList(rules.coding),
|
|
109
|
+
'rules.architecture': renderList(rules.architecture),
|
|
110
|
+
'rules.testing': renderList(rules.testing),
|
|
111
|
+
'rules.naming': renderList(rules.naming),
|
|
112
|
+
'skills': renderSkills(),
|
|
113
|
+
'override': renderOverrideBlocks(ctx.override)
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
// ─── Renderer ─────────────────────────────────────────────────────────────
|
|
117
|
+
/**
|
|
118
|
+
* Renders a template string using a RenderContext.
|
|
119
|
+
* skillsFormat controls how skills are rendered for a given agent.
|
|
120
|
+
*/
|
|
121
|
+
export function renderTemplate(template, ctx, skillsFormat = 'markdown') {
|
|
122
|
+
const tokens = buildTokenMap(ctx, skillsFormat);
|
|
123
|
+
let output = template;
|
|
124
|
+
for (const [token, value] of Object.entries(tokens)) {
|
|
125
|
+
output = output.replaceAll(`\${${token}}`, value);
|
|
126
|
+
}
|
|
127
|
+
return output.trim() + '\n';
|
|
128
|
+
}
|
|
129
|
+
//# sourceMappingURL=renderer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"renderer.js","sourceRoot":"","sources":["../src/renderer.ts"],"names":[],"mappings":"AASA,8EAA8E;AAE9E,SAAS,UAAU,CAAC,KAAe;IACjC,OAAO,KAAK,CAAC,MAAM;QACjB,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;QAC3C,CAAC,CAAC,iBAAiB,CAAA;AACvB,CAAC;AAED,SAAS,oBAAoB,CAAC,QAAyB;IACrD,IAAI,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM;QAAE,OAAO,EAAE,CAAA;IACxC,OAAO,QAAQ,CAAC,MAAM;SACnB,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,QAAQ,KAAK,CAAC,OAAO,OAAO,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC;SAChE,IAAI,CAAC,IAAI,CAAC,CAAA;AACf,CAAC;AAED,8EAA8E;AAC9E,iDAAiD;AAEjD,MAAM,UAAU,mBAAmB,CAAC,KAAY;IAC9C,MAAM,KAAK,GAAa,EAAE,CAAA;IAE1B,KAAK,CAAC,IAAI,CAAC,OAAO,KAAK,CAAC,IAAI,EAAE,CAAC,CAAA;IAC/B,KAAK,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,WAAW,IAAI,CAAC,CAAA;IAEpC,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;QACzB,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,CAAA;QACzB,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CA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,CAAC,CAAA;IAE/C,IAAI,MAAM,GAAG,QAAQ,CAAA;IACrB,KAAK,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QACpD,MAAM,GAAG,MAAM,CAAC,UAAU,CAAC,MAAM,KAAK,GAAG,EAAE,KAAK,CAAC,CAAA;IACnD,CAAC;IAED,OAAO,MAAM,CAAC,IAAI,EAAE,GAAG,IAAI,CAAA;AAC7B,CAAC"}
|
package/dist/schema.d.ts
ADDED
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const SkillExampleSchema: z.ZodObject<{
|
|
3
|
+
input: z.ZodString;
|
|
4
|
+
output: z.ZodString;
|
|
5
|
+
}, "strip", z.ZodTypeAny, {
|
|
6
|
+
input: string;
|
|
7
|
+
output: string;
|
|
8
|
+
}, {
|
|
9
|
+
input: string;
|
|
10
|
+
output: string;
|
|
11
|
+
}>;
|
|
12
|
+
export declare const SkillSchema: z.ZodObject<{
|
|
13
|
+
name: z.ZodString;
|
|
14
|
+
description: z.ZodString;
|
|
15
|
+
context: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
|
|
16
|
+
steps: z.ZodArray<z.ZodString, "many">;
|
|
17
|
+
expected_output: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
18
|
+
examples: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
19
|
+
input: z.ZodString;
|
|
20
|
+
output: z.ZodString;
|
|
21
|
+
}, "strip", z.ZodTypeAny, {
|
|
22
|
+
input: string;
|
|
23
|
+
output: string;
|
|
24
|
+
}, {
|
|
25
|
+
input: string;
|
|
26
|
+
output: string;
|
|
27
|
+
}>, "many">>>;
|
|
28
|
+
}, "strip", z.ZodTypeAny, {
|
|
29
|
+
name: string;
|
|
30
|
+
description: string;
|
|
31
|
+
context: string[];
|
|
32
|
+
steps: string[];
|
|
33
|
+
expected_output: string;
|
|
34
|
+
examples: {
|
|
35
|
+
input: string;
|
|
36
|
+
output: string;
|
|
37
|
+
}[];
|
|
38
|
+
}, {
|
|
39
|
+
name: string;
|
|
40
|
+
description: string;
|
|
41
|
+
steps: string[];
|
|
42
|
+
context?: string[] | undefined;
|
|
43
|
+
expected_output?: string | undefined;
|
|
44
|
+
examples?: {
|
|
45
|
+
input: string;
|
|
46
|
+
output: string;
|
|
47
|
+
}[] | undefined;
|
|
48
|
+
}>;
|
|
49
|
+
export declare const ContractSchema: z.ZodObject<{
|
|
50
|
+
version: z.ZodLiteral<1>;
|
|
51
|
+
project: z.ZodObject<{
|
|
52
|
+
name: z.ZodString;
|
|
53
|
+
stack: z.ZodArray<z.ZodString, "many">;
|
|
54
|
+
}, "strip", z.ZodTypeAny, {
|
|
55
|
+
name: string;
|
|
56
|
+
stack: string[];
|
|
57
|
+
}, {
|
|
58
|
+
name: string;
|
|
59
|
+
stack: string[];
|
|
60
|
+
}>;
|
|
61
|
+
rules: z.ZodDefault<z.ZodObject<{
|
|
62
|
+
coding: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
|
|
63
|
+
architecture: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
|
|
64
|
+
testing: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
|
|
65
|
+
naming: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
|
|
66
|
+
}, "strip", z.ZodTypeAny, {
|
|
67
|
+
coding: string[];
|
|
68
|
+
architecture: string[];
|
|
69
|
+
testing: string[];
|
|
70
|
+
naming: string[];
|
|
71
|
+
}, {
|
|
72
|
+
coding?: string[] | undefined;
|
|
73
|
+
architecture?: string[] | undefined;
|
|
74
|
+
testing?: string[] | undefined;
|
|
75
|
+
naming?: string[] | undefined;
|
|
76
|
+
}>>;
|
|
77
|
+
skills: z.ZodArray<z.ZodObject<{
|
|
78
|
+
name: z.ZodString;
|
|
79
|
+
description: z.ZodString;
|
|
80
|
+
context: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
|
|
81
|
+
steps: z.ZodArray<z.ZodString, "many">;
|
|
82
|
+
expected_output: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
83
|
+
examples: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
84
|
+
input: z.ZodString;
|
|
85
|
+
output: z.ZodString;
|
|
86
|
+
}, "strip", z.ZodTypeAny, {
|
|
87
|
+
input: string;
|
|
88
|
+
output: string;
|
|
89
|
+
}, {
|
|
90
|
+
input: string;
|
|
91
|
+
output: string;
|
|
92
|
+
}>, "many">>>;
|
|
93
|
+
}, "strip", z.ZodTypeAny, {
|
|
94
|
+
name: string;
|
|
95
|
+
description: string;
|
|
96
|
+
context: string[];
|
|
97
|
+
steps: string[];
|
|
98
|
+
expected_output: string;
|
|
99
|
+
examples: {
|
|
100
|
+
input: string;
|
|
101
|
+
output: string;
|
|
102
|
+
}[];
|
|
103
|
+
}, {
|
|
104
|
+
name: string;
|
|
105
|
+
description: string;
|
|
106
|
+
steps: string[];
|
|
107
|
+
context?: string[] | undefined;
|
|
108
|
+
expected_output?: string | undefined;
|
|
109
|
+
examples?: {
|
|
110
|
+
input: string;
|
|
111
|
+
output: string;
|
|
112
|
+
}[] | undefined;
|
|
113
|
+
}>, "many">;
|
|
114
|
+
}, "strip", z.ZodTypeAny, {
|
|
115
|
+
version: 1;
|
|
116
|
+
project: {
|
|
117
|
+
name: string;
|
|
118
|
+
stack: string[];
|
|
119
|
+
};
|
|
120
|
+
rules: {
|
|
121
|
+
coding: string[];
|
|
122
|
+
architecture: string[];
|
|
123
|
+
testing: string[];
|
|
124
|
+
naming: string[];
|
|
125
|
+
};
|
|
126
|
+
skills: {
|
|
127
|
+
name: string;
|
|
128
|
+
description: string;
|
|
129
|
+
context: string[];
|
|
130
|
+
steps: string[];
|
|
131
|
+
expected_output: string;
|
|
132
|
+
examples: {
|
|
133
|
+
input: string;
|
|
134
|
+
output: string;
|
|
135
|
+
}[];
|
|
136
|
+
}[];
|
|
137
|
+
}, {
|
|
138
|
+
version: 1;
|
|
139
|
+
project: {
|
|
140
|
+
name: string;
|
|
141
|
+
stack: string[];
|
|
142
|
+
};
|
|
143
|
+
skills: {
|
|
144
|
+
name: string;
|
|
145
|
+
description: string;
|
|
146
|
+
steps: string[];
|
|
147
|
+
context?: string[] | undefined;
|
|
148
|
+
expected_output?: string | undefined;
|
|
149
|
+
examples?: {
|
|
150
|
+
input: string;
|
|
151
|
+
output: string;
|
|
152
|
+
}[] | undefined;
|
|
153
|
+
}[];
|
|
154
|
+
rules?: {
|
|
155
|
+
coding?: string[] | undefined;
|
|
156
|
+
architecture?: string[] | undefined;
|
|
157
|
+
testing?: string[] | undefined;
|
|
158
|
+
naming?: string[] | undefined;
|
|
159
|
+
} | undefined;
|
|
160
|
+
}>;
|
|
161
|
+
export declare const AgentConfigSchema: z.ZodObject<{
|
|
162
|
+
name: z.ZodString;
|
|
163
|
+
output: z.ZodString;
|
|
164
|
+
description: z.ZodString;
|
|
165
|
+
}, "strip", z.ZodTypeAny, {
|
|
166
|
+
output: string;
|
|
167
|
+
name: string;
|
|
168
|
+
description: string;
|
|
169
|
+
}, {
|
|
170
|
+
output: string;
|
|
171
|
+
name: string;
|
|
172
|
+
description: string;
|
|
173
|
+
}>;
|
|
174
|
+
export declare const OverrideSchema: z.ZodObject<{
|
|
175
|
+
blocks: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
176
|
+
section: z.ZodString;
|
|
177
|
+
content: z.ZodString;
|
|
178
|
+
}, "strip", z.ZodTypeAny, {
|
|
179
|
+
section: string;
|
|
180
|
+
content: string;
|
|
181
|
+
}, {
|
|
182
|
+
section: string;
|
|
183
|
+
content: string;
|
|
184
|
+
}>, "many">>;
|
|
185
|
+
}, "strip", z.ZodTypeAny, {
|
|
186
|
+
blocks: {
|
|
187
|
+
section: string;
|
|
188
|
+
content: string;
|
|
189
|
+
}[];
|
|
190
|
+
}, {
|
|
191
|
+
blocks?: {
|
|
192
|
+
section: string;
|
|
193
|
+
content: string;
|
|
194
|
+
}[] | undefined;
|
|
195
|
+
}>;
|
|
196
|
+
export type Skill = z.output<typeof SkillSchema>;
|
|
197
|
+
export type Contract = z.output<typeof ContractSchema>;
|
|
198
|
+
export type AgentConfig = z.output<typeof AgentConfigSchema>;
|
|
199
|
+
export type Override = z.output<typeof OverrideSchema>;
|
|
200
|
+
export interface AgentSelection {
|
|
201
|
+
requested: string[];
|
|
202
|
+
available: string[];
|
|
203
|
+
resolved: string[];
|
|
204
|
+
unknown: string[];
|
|
205
|
+
}
|
|
206
|
+
export interface ResolvedAgent {
|
|
207
|
+
name: string;
|
|
208
|
+
config: AgentConfig;
|
|
209
|
+
template: string;
|
|
210
|
+
}
|
|
211
|
+
export type AgentResult = {
|
|
212
|
+
status: 'ok';
|
|
213
|
+
agent: string;
|
|
214
|
+
output: string;
|
|
215
|
+
content: string;
|
|
216
|
+
} | {
|
|
217
|
+
status: 'skipped';
|
|
218
|
+
agent: string;
|
|
219
|
+
reason: string;
|
|
220
|
+
} | {
|
|
221
|
+
status: 'error';
|
|
222
|
+
agent: string;
|
|
223
|
+
error: Error;
|
|
224
|
+
};
|
|
225
|
+
export interface GenerateResult {
|
|
226
|
+
results: AgentResult[];
|
|
227
|
+
success: boolean;
|
|
228
|
+
}
|
|
229
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAIvB,eAAO,MAAM,kBAAkB;;;;;;;;;EAG7B,CAAA;AAEF,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAOtB,CAAA;AAIF,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;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,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAG,WAAW,EAAE,CAAA;IACvB,OAAO,EAAG,OAAO,CAAA;CAClB"}
|
package/dist/schema.js
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
// ─── Skill ─────────────────────────────────────────────────────────────────
|
|
3
|
+
export const SkillExampleSchema = z.object({
|
|
4
|
+
input: z.string(),
|
|
5
|
+
output: z.string()
|
|
6
|
+
});
|
|
7
|
+
export const SkillSchema = z.object({
|
|
8
|
+
name: z.string().min(1),
|
|
9
|
+
description: z.string().min(1),
|
|
10
|
+
context: z.array(z.string()).optional().default([]),
|
|
11
|
+
steps: z.array(z.string()).min(1, 'A skill must have at least one step'),
|
|
12
|
+
expected_output: z.string().optional().default(''),
|
|
13
|
+
examples: z.array(SkillExampleSchema).optional().default([])
|
|
14
|
+
});
|
|
15
|
+
// ─── Contract ──────────────────────────────────────────────────────────────
|
|
16
|
+
export const ContractSchema = z.object({
|
|
17
|
+
version: z.literal(1, {
|
|
18
|
+
errorMap: () => ({ message: 'Unsupported contract version. Only version 1 is supported.' })
|
|
19
|
+
}),
|
|
20
|
+
project: z.object({
|
|
21
|
+
name: z.string().min(1, 'project.name must not be empty'),
|
|
22
|
+
stack: z.array(z.string()).min(1, 'project.stack must contain at least one entry')
|
|
23
|
+
}),
|
|
24
|
+
rules: z.object({
|
|
25
|
+
coding: z.array(z.string()).optional().default([]),
|
|
26
|
+
architecture: z.array(z.string()).optional().default([]),
|
|
27
|
+
testing: z.array(z.string()).optional().default([]),
|
|
28
|
+
naming: z.array(z.string()).optional().default([])
|
|
29
|
+
}).default({}),
|
|
30
|
+
skills: z.array(SkillSchema).min(1, 'contract must define at least one skill')
|
|
31
|
+
});
|
|
32
|
+
// ─── Agent Config ──────────────────────────────────────────────────────────
|
|
33
|
+
export const AgentConfigSchema = z.object({
|
|
34
|
+
name: z.string().min(1),
|
|
35
|
+
output: z.string().min(1, 'output path must not be empty'),
|
|
36
|
+
description: z.string()
|
|
37
|
+
});
|
|
38
|
+
// ─── Override ──────────────────────────────────────────────────────────────
|
|
39
|
+
export const OverrideSchema = z.object({
|
|
40
|
+
blocks: z.array(z.object({
|
|
41
|
+
section: z.string().min(1),
|
|
42
|
+
content: z.string()
|
|
43
|
+
})).default([])
|
|
44
|
+
});
|
|
45
|
+
//# sourceMappingURL=schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,8EAA8E;AAE9E,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC,KAAK,EAAG,CAAC,CAAC,MAAM,EAAE;IAClB,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;CACnB,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAClC,IAAI,EAAa,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAClC,WAAW,EAAM,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAClC,OAAO,EAAU,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;IAC3D,KAAK,EAAY,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,qCAAqC,CAAC;IAClF,eAAe,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;IAClD,QAAQ,EAAS,CAAC,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;CACpE,CAAC,CAAA;A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C,MAAM,CAAC;IACxC,IAAI,EAAS,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC9B,MAAM,EAAO,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,+BAA+B,CAAC;IAC/D,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;CACxB,CAAC,CAAA;AAEF,8EAA8E;AAE9E,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC;IACrC,MAAM,EAAE,CAAC,CAAC,KAAK,CACb,CAAC,CAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;QAC1B,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;KACpB,CAAC,CACH,CAAC,OAAO,CAAC,EAAE,CAAC;CACd,CAAC,CAAA"}
|
package/package.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@agentfile/core",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Core engine for agentfile — schema validation, loading, rendering, and generation",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": "./dist/index.js",
|
|
11
|
+
"types": "./dist/index.d.ts"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"files": ["dist"],
|
|
15
|
+
"scripts": {
|
|
16
|
+
"build": "tsc",
|
|
17
|
+
"typecheck": "tsc --noEmit",
|
|
18
|
+
"test": "vitest run"
|
|
19
|
+
},
|
|
20
|
+
"keywords": ["ai", "agents", "rules", "claude", "copilot", "cursor", "agentfile"],
|
|
21
|
+
"license": "MIT",
|
|
22
|
+
"repository": {
|
|
23
|
+
"type": "git",
|
|
24
|
+
"url": "https://github.com/dennishavermans/agentfile"
|
|
25
|
+
},
|
|
26
|
+
"homepage": "https://github.com/dennishavermans/agentfile#readme",
|
|
27
|
+
"bugs": {
|
|
28
|
+
"url": "https://github.com/dennishavermans/agentfile/issues"
|
|
29
|
+
},
|
|
30
|
+
"engines": {
|
|
31
|
+
"node": ">=18.0.0"
|
|
32
|
+
},
|
|
33
|
+
"publishConfig": {
|
|
34
|
+
"access": "public"
|
|
35
|
+
},
|
|
36
|
+
"dependencies": {
|
|
37
|
+
"@types/node": "^20.0.0",
|
|
38
|
+
"yaml": "^2.3.4",
|
|
39
|
+
"zod": "^3.22.4"
|
|
40
|
+
},
|
|
41
|
+
"devDependencies": {
|
|
42
|
+
"typescript": "^5.3.0",
|
|
43
|
+
"vitest": "^4.1.0"
|
|
44
|
+
}
|
|
45
|
+
}
|