@deimoscloud/coreai 0.1.8 → 0.1.10
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/cli/index.js +5 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/package.json +6 -1
- package/.prettierrc +0 -9
- package/AGENT_SPEC.md +0 -347
- package/ARCHITECTURE.md +0 -547
- package/DRAFT_PRD.md +0 -1440
- package/IMPLEMENTATION_PLAN.md +0 -256
- package/PRODUCT.md +0 -473
- package/WORKFLOWS.md +0 -295
- package/commands/core/check-inbox.md +0 -34
- package/commands/core/delegate.md +0 -30
- package/commands/core/git-commit.md +0 -144
- package/commands/core/pr-create.md +0 -193
- package/commands/core/review.md +0 -56
- package/commands/core/sprint-status.md +0 -65
- package/commands/optional/docs-update.md +0 -200
- package/commands/optional/jira-create.md +0 -200
- package/commands/optional/jira-transition.md +0 -184
- package/commands/optional/worktree-cleanup.md +0 -167
- package/commands/optional/worktree-setup.md +0 -110
- package/eslint.config.js +0 -29
- package/jest.config.js +0 -22
- package/knowledge-library/README.md +0 -118
- package/knowledge-library/android-engineer/context/current.txt +0 -42
- package/knowledge-library/android-engineer/control/decisions.txt +0 -9
- package/knowledge-library/android-engineer/control/dependencies.txt +0 -19
- package/knowledge-library/android-engineer/control/objectives.txt +0 -26
- package/knowledge-library/android-engineer/history/.gitkeep +0 -0
- package/knowledge-library/android-engineer/inbox/processed/.gitkeep +0 -0
- package/knowledge-library/android-engineer/outbox/.gitkeep +0 -0
- package/knowledge-library/android-engineer/tech/.gitkeep +0 -0
- package/knowledge-library/architecture.txt +0 -61
- package/knowledge-library/backend-engineer/context/current.txt +0 -42
- package/knowledge-library/backend-engineer/control/decisions.txt +0 -9
- package/knowledge-library/backend-engineer/control/dependencies.txt +0 -19
- package/knowledge-library/backend-engineer/control/objectives.txt +0 -26
- package/knowledge-library/backend-engineer/history/.gitkeep +0 -0
- package/knowledge-library/backend-engineer/inbox/processed/.gitkeep +0 -0
- package/knowledge-library/backend-engineer/outbox/.gitkeep +0 -0
- package/knowledge-library/backend-engineer/tech/.gitkeep +0 -0
- package/knowledge-library/context.txt +0 -52
- package/knowledge-library/devops-engineer/context/current.txt +0 -42
- package/knowledge-library/devops-engineer/control/decisions.txt +0 -9
- package/knowledge-library/devops-engineer/control/dependencies.txt +0 -19
- package/knowledge-library/devops-engineer/control/objectives.txt +0 -26
- package/knowledge-library/devops-engineer/history/.gitkeep +0 -0
- package/knowledge-library/devops-engineer/inbox/processed/.gitkeep +0 -0
- package/knowledge-library/devops-engineer/outbox/.gitkeep +0 -0
- package/knowledge-library/devops-engineer/tech/.gitkeep +0 -0
- package/knowledge-library/engineering-manager/context/current.txt +0 -40
- package/knowledge-library/engineering-manager/control/decisions.txt +0 -9
- package/knowledge-library/engineering-manager/control/objectives.txt +0 -27
- package/knowledge-library/engineering-manager/history/.gitkeep +0 -0
- package/knowledge-library/engineering-manager/inbox/processed/.gitkeep +0 -0
- package/knowledge-library/engineering-manager/outbox/.gitkeep +0 -0
- package/knowledge-library/engineering-manager/tech/.gitkeep +0 -0
- package/knowledge-library/prd.txt +0 -81
- package/knowledge-library/product-manager/context/current.txt +0 -42
- package/knowledge-library/product-manager/control/decisions.txt +0 -9
- package/knowledge-library/product-manager/control/dependencies.txt +0 -19
- package/knowledge-library/product-manager/control/objectives.txt +0 -26
- package/knowledge-library/product-manager/history/.gitkeep +0 -0
- package/knowledge-library/product-manager/inbox/processed/.gitkeep +0 -0
- package/knowledge-library/product-manager/outbox/.gitkeep +0 -0
- package/knowledge-library/product-manager/tech/.gitkeep +0 -0
- package/knowledge-library/qa-engineer/context/current.txt +0 -42
- package/knowledge-library/qa-engineer/control/decisions.txt +0 -9
- package/knowledge-library/qa-engineer/control/dependencies.txt +0 -19
- package/knowledge-library/qa-engineer/control/objectives.txt +0 -26
- package/knowledge-library/qa-engineer/history/.gitkeep +0 -0
- package/knowledge-library/qa-engineer/inbox/processed/.gitkeep +0 -0
- package/knowledge-library/qa-engineer/outbox/.gitkeep +0 -0
- package/knowledge-library/qa-engineer/tech/.gitkeep +0 -0
- package/knowledge-library/security-engineer/context/current.txt +0 -42
- package/knowledge-library/security-engineer/control/decisions.txt +0 -9
- package/knowledge-library/security-engineer/control/dependencies.txt +0 -19
- package/knowledge-library/security-engineer/control/objectives.txt +0 -26
- package/knowledge-library/security-engineer/history/.gitkeep +0 -0
- package/knowledge-library/security-engineer/inbox/processed/.gitkeep +0 -0
- package/knowledge-library/security-engineer/outbox/.gitkeep +0 -0
- package/knowledge-library/security-engineer/tech/.gitkeep +0 -0
- package/knowledge-library/solutions-architect/context/current.txt +0 -42
- package/knowledge-library/solutions-architect/control/decisions.txt +0 -9
- package/knowledge-library/solutions-architect/control/dependencies.txt +0 -19
- package/knowledge-library/solutions-architect/control/objectives.txt +0 -26
- package/knowledge-library/solutions-architect/history/.gitkeep +0 -0
- package/knowledge-library/solutions-architect/inbox/processed/.gitkeep +0 -0
- package/knowledge-library/solutions-architect/outbox/.gitkeep +0 -0
- package/knowledge-library/solutions-architect/tech/.gitkeep +0 -0
- package/knowledge-library/wearos-engineer/context/current.txt +0 -42
- package/knowledge-library/wearos-engineer/control/decisions.txt +0 -9
- package/knowledge-library/wearos-engineer/control/dependencies.txt +0 -19
- package/knowledge-library/wearos-engineer/control/objectives.txt +0 -26
- package/knowledge-library/wearos-engineer/history/.gitkeep +0 -0
- package/knowledge-library/wearos-engineer/inbox/processed/.gitkeep +0 -0
- package/knowledge-library/wearos-engineer/outbox/.gitkeep +0 -0
- package/knowledge-library/wearos-engineer/tech/.gitkeep +0 -0
- package/scripts/add-agent.sh +0 -323
- package/scripts/install.sh +0 -354
- package/src/adapters/factory.test.ts +0 -386
- package/src/adapters/factory.ts +0 -305
- package/src/adapters/index.ts +0 -113
- package/src/adapters/interfaces.ts +0 -268
- package/src/adapters/mcp/client.test.ts +0 -130
- package/src/adapters/mcp/client.ts +0 -451
- package/src/adapters/mcp/discovery.test.ts +0 -315
- package/src/adapters/mcp/discovery.ts +0 -340
- package/src/adapters/mcp/index.ts +0 -66
- package/src/adapters/mcp/mapper.test.ts +0 -218
- package/src/adapters/mcp/mapper.ts +0 -536
- package/src/adapters/mcp/registry.test.ts +0 -433
- package/src/adapters/mcp/registry.ts +0 -550
- package/src/adapters/mcp/types.ts +0 -258
- package/src/adapters/native/filesystem.test.ts +0 -350
- package/src/adapters/native/filesystem.ts +0 -393
- package/src/adapters/native/github.test.ts +0 -173
- package/src/adapters/native/github.ts +0 -627
- package/src/adapters/native/index.ts +0 -22
- package/src/adapters/native/selector.test.ts +0 -224
- package/src/adapters/native/selector.ts +0 -150
- package/src/adapters/types.ts +0 -270
- package/src/agents/compiler.test.ts +0 -399
- package/src/agents/compiler.ts +0 -422
- package/src/agents/index.ts +0 -37
- package/src/agents/loader.test.ts +0 -319
- package/src/agents/loader.ts +0 -143
- package/src/agents/resolver.test.ts +0 -282
- package/src/agents/resolver.ts +0 -262
- package/src/agents/types.ts +0 -97
- package/src/cache/index.ts +0 -38
- package/src/cache/interfaces.ts +0 -283
- package/src/cache/manager.test.ts +0 -266
- package/src/cache/manager.ts +0 -388
- package/src/cache/provider.test.ts +0 -485
- package/src/cache/provider.ts +0 -745
- package/src/cache/types.test.ts +0 -192
- package/src/cache/types.ts +0 -313
- package/src/cli/commands/build.test.ts +0 -248
- package/src/cli/commands/build.ts +0 -284
- package/src/cli/commands/cache.test.ts +0 -221
- package/src/cli/commands/cache.ts +0 -229
- package/src/cli/commands/index.ts +0 -63
- package/src/cli/commands/init.test.ts +0 -173
- package/src/cli/commands/init.ts +0 -296
- package/src/cli/commands/skills.test.ts +0 -272
- package/src/cli/commands/skills.ts +0 -348
- package/src/cli/commands/status.test.ts +0 -392
- package/src/cli/commands/status.ts +0 -332
- package/src/cli/commands/sync.test.ts +0 -213
- package/src/cli/commands/sync.ts +0 -251
- package/src/cli/commands/validate.test.ts +0 -216
- package/src/cli/commands/validate.ts +0 -340
- package/src/cli/index.test.ts +0 -190
- package/src/cli/index.ts +0 -493
- package/src/commands/context.test.ts +0 -163
- package/src/commands/context.ts +0 -111
- package/src/commands/index.ts +0 -56
- package/src/commands/loader.test.ts +0 -273
- package/src/commands/loader.ts +0 -355
- package/src/commands/registry.test.ts +0 -384
- package/src/commands/registry.ts +0 -248
- package/src/commands/runner.test.ts +0 -297
- package/src/commands/runner.ts +0 -222
- package/src/commands/types.ts +0 -361
- package/src/config/index.ts +0 -19
- package/src/config/loader.test.ts +0 -262
- package/src/config/loader.ts +0 -188
- package/src/config/types.ts +0 -154
- package/src/context/index.ts +0 -14
- package/src/context/loader.test.ts +0 -334
- package/src/context/loader.ts +0 -357
- package/src/index.test.ts +0 -13
- package/src/index.ts +0 -268
- package/src/knowledge-library/index.ts +0 -44
- package/src/knowledge-library/manager.test.ts +0 -536
- package/src/knowledge-library/manager.ts +0 -804
- package/src/knowledge-library/types.ts +0 -432
- package/src/skills/generator.test.ts +0 -602
- package/src/skills/generator.ts +0 -491
- package/src/skills/index.ts +0 -27
- package/src/skills/templates.ts +0 -520
- package/src/skills/types.ts +0 -251
- package/templates/completion-report.md +0 -72
- package/templates/feedback.md +0 -56
- package/templates/project-files/CLAUDE.md.template +0 -109
- package/templates/project-files/coreai.json.example +0 -47
- package/templates/project-files/mcp.json.template +0 -20
- package/templates/review-complete.md +0 -64
- package/templates/review-request.md +0 -67
- package/templates/task-assignment.md +0 -51
- package/tsconfig.build.json +0 -4
- package/tsconfig.json +0 -26
- package/tsup.config.ts +0 -23
|
@@ -1,399 +0,0 @@
|
|
|
1
|
-
import { mkdtempSync, mkdirSync, writeFileSync, rmSync, readFileSync, existsSync } from 'fs';
|
|
2
|
-
import { join, dirname } from 'path';
|
|
3
|
-
import { tmpdir } from 'os';
|
|
4
|
-
import { fileURLToPath } from 'url';
|
|
5
|
-
import {
|
|
6
|
-
generateAgentMarkdown,
|
|
7
|
-
compileAgent,
|
|
8
|
-
loadAllAgents,
|
|
9
|
-
filterAgentsByTeam,
|
|
10
|
-
compileAgents,
|
|
11
|
-
} from './compiler.js';
|
|
12
|
-
import type { AgentDefinition, AgentMetadata } from './types.js';
|
|
13
|
-
import type { CoreAIConfig } from '../config/types.js';
|
|
14
|
-
|
|
15
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
16
|
-
const __dirname = dirname(__filename);
|
|
17
|
-
|
|
18
|
-
describe('Agent Compiler', () => {
|
|
19
|
-
let tempDir: string;
|
|
20
|
-
|
|
21
|
-
beforeEach(() => {
|
|
22
|
-
tempDir = mkdtempSync(join(tmpdir(), 'coreai-compiler-test-'));
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
afterEach(() => {
|
|
26
|
-
rmSync(tempDir, { recursive: true, force: true });
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
const minimalAgent: AgentDefinition = {
|
|
30
|
-
role: 'test-agent',
|
|
31
|
-
type: 'ic-engineer',
|
|
32
|
-
display_name: 'Test Agent',
|
|
33
|
-
description: 'A test agent for unit testing.',
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
const fullAgent: AgentDefinition = {
|
|
37
|
-
role: 'backend-engineer',
|
|
38
|
-
type: 'ic-engineer',
|
|
39
|
-
display_name: 'Backend Engineer',
|
|
40
|
-
description: 'Senior backend engineer specializing in API design.',
|
|
41
|
-
responsibilities: ['Design APIs', 'Write tests', 'Review code'],
|
|
42
|
-
expertise: {
|
|
43
|
-
primary: ['API design', 'Database design'],
|
|
44
|
-
tech_stack: 'TypeScript, Node.js',
|
|
45
|
-
},
|
|
46
|
-
skills: ['Code review', 'Debugging'],
|
|
47
|
-
principles: {
|
|
48
|
-
code_quality: ['Write clean code', 'Follow SOLID'],
|
|
49
|
-
testing: ['Test first', 'High coverage'],
|
|
50
|
-
},
|
|
51
|
-
behaviors: {
|
|
52
|
-
workflow: 'ticket-implementation',
|
|
53
|
-
quality_gates: 'lint, test, build',
|
|
54
|
-
},
|
|
55
|
-
context_sources: {
|
|
56
|
-
shared: ['docs/architecture'],
|
|
57
|
-
personal: ['KnowledgeLibrary/backend-engineer/context'],
|
|
58
|
-
},
|
|
59
|
-
communication: {
|
|
60
|
-
inbox: 'KnowledgeLibrary/backend-engineer/inbox',
|
|
61
|
-
outbox: 'KnowledgeLibrary/backend-engineer/outbox',
|
|
62
|
-
},
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
describe('generateAgentMarkdown', () => {
|
|
66
|
-
it('should generate markdown for minimal agent', () => {
|
|
67
|
-
const markdown = generateAgentMarkdown(minimalAgent);
|
|
68
|
-
|
|
69
|
-
expect(markdown).toContain('# Test Agent');
|
|
70
|
-
expect(markdown).toContain('**Role:** test-agent');
|
|
71
|
-
expect(markdown).toContain('**Type:** ic-engineer');
|
|
72
|
-
expect(markdown).toContain('## Description');
|
|
73
|
-
expect(markdown).toContain('A test agent for unit testing.');
|
|
74
|
-
expect(markdown).toContain('*Generated by CoreAI*');
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
it('should generate markdown for full agent', () => {
|
|
78
|
-
const markdown = generateAgentMarkdown(fullAgent);
|
|
79
|
-
|
|
80
|
-
// Header
|
|
81
|
-
expect(markdown).toContain('# Backend Engineer');
|
|
82
|
-
expect(markdown).toContain('**Role:** backend-engineer');
|
|
83
|
-
|
|
84
|
-
// Responsibilities
|
|
85
|
-
expect(markdown).toContain('## Responsibilities');
|
|
86
|
-
expect(markdown).toContain('- Design APIs');
|
|
87
|
-
expect(markdown).toContain('- Write tests');
|
|
88
|
-
|
|
89
|
-
// Expertise
|
|
90
|
-
expect(markdown).toContain('## Expertise');
|
|
91
|
-
expect(markdown).toContain('### Primary Areas');
|
|
92
|
-
expect(markdown).toContain('- API design');
|
|
93
|
-
expect(markdown).toContain('### Tech Stack');
|
|
94
|
-
expect(markdown).toContain('TypeScript, Node.js');
|
|
95
|
-
|
|
96
|
-
// Skills
|
|
97
|
-
expect(markdown).toContain('## Skills');
|
|
98
|
-
expect(markdown).toContain('- Code review');
|
|
99
|
-
|
|
100
|
-
// Principles
|
|
101
|
-
expect(markdown).toContain('## Principles');
|
|
102
|
-
expect(markdown).toContain('### Code Quality');
|
|
103
|
-
expect(markdown).toContain('- Write clean code');
|
|
104
|
-
expect(markdown).toContain('### Testing');
|
|
105
|
-
expect(markdown).toContain('- Test first');
|
|
106
|
-
|
|
107
|
-
// Behaviors
|
|
108
|
-
expect(markdown).toContain('## Behaviors');
|
|
109
|
-
expect(markdown).toContain('**Workflow:** ticket-implementation');
|
|
110
|
-
|
|
111
|
-
// Context Sources
|
|
112
|
-
expect(markdown).toContain('## Context Sources');
|
|
113
|
-
expect(markdown).toContain('### Shared');
|
|
114
|
-
expect(markdown).toContain('- docs/architecture');
|
|
115
|
-
expect(markdown).toContain('### Personal');
|
|
116
|
-
|
|
117
|
-
// Communication
|
|
118
|
-
expect(markdown).toContain('## Communication');
|
|
119
|
-
expect(markdown).toContain('**Inbox:**');
|
|
120
|
-
expect(markdown).toContain('**Outbox:**');
|
|
121
|
-
});
|
|
122
|
-
|
|
123
|
-
it('should format snake_case titles correctly', () => {
|
|
124
|
-
const markdown = generateAgentMarkdown(fullAgent);
|
|
125
|
-
expect(markdown).toContain('### Code Quality');
|
|
126
|
-
});
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
describe('compileAgent', () => {
|
|
130
|
-
it('should compile agent with variable resolution', () => {
|
|
131
|
-
const agent: AgentDefinition = {
|
|
132
|
-
role: 'test-agent',
|
|
133
|
-
type: 'ic-engineer',
|
|
134
|
-
display_name: 'Test Agent',
|
|
135
|
-
description: 'Agent for ${config.project.name}',
|
|
136
|
-
};
|
|
137
|
-
|
|
138
|
-
const config: CoreAIConfig = {
|
|
139
|
-
version: '1.0',
|
|
140
|
-
project: { name: 'my-project' },
|
|
141
|
-
};
|
|
142
|
-
|
|
143
|
-
const markdown = compileAgent(agent, config);
|
|
144
|
-
|
|
145
|
-
expect(markdown).toContain('Agent for my-project');
|
|
146
|
-
});
|
|
147
|
-
|
|
148
|
-
it('should compile agent without config', () => {
|
|
149
|
-
const markdown = compileAgent(minimalAgent);
|
|
150
|
-
expect(markdown).toContain('# Test Agent');
|
|
151
|
-
});
|
|
152
|
-
});
|
|
153
|
-
|
|
154
|
-
describe('loadAllAgents', () => {
|
|
155
|
-
it('should load agents from core directory', () => {
|
|
156
|
-
// Create core agents
|
|
157
|
-
const coreDir = join(tempDir, 'core');
|
|
158
|
-
mkdirSync(coreDir);
|
|
159
|
-
writeFileSync(
|
|
160
|
-
join(coreDir, 'agent-one.yaml'),
|
|
161
|
-
`
|
|
162
|
-
role: agent-one
|
|
163
|
-
type: ic-engineer
|
|
164
|
-
display_name: Agent One
|
|
165
|
-
description: First agent
|
|
166
|
-
`
|
|
167
|
-
);
|
|
168
|
-
|
|
169
|
-
const agents = loadAllAgents({ coreAgentsDir: coreDir });
|
|
170
|
-
|
|
171
|
-
expect(agents.size).toBe(1);
|
|
172
|
-
expect(agents.get('agent-one')?.source).toBe('core');
|
|
173
|
-
});
|
|
174
|
-
|
|
175
|
-
it('should load agents from custom directory', () => {
|
|
176
|
-
const customDir = join(tempDir, 'custom');
|
|
177
|
-
mkdirSync(customDir);
|
|
178
|
-
writeFileSync(
|
|
179
|
-
join(customDir, 'custom-agent.yaml'),
|
|
180
|
-
`
|
|
181
|
-
role: custom-agent
|
|
182
|
-
type: specialist
|
|
183
|
-
display_name: Custom Agent
|
|
184
|
-
description: A custom agent
|
|
185
|
-
`
|
|
186
|
-
);
|
|
187
|
-
|
|
188
|
-
const agents = loadAllAgents({ customAgentsDir: customDir });
|
|
189
|
-
|
|
190
|
-
expect(agents.size).toBe(1);
|
|
191
|
-
expect(agents.get('custom-agent')?.source).toBe('custom');
|
|
192
|
-
});
|
|
193
|
-
|
|
194
|
-
it('should mark overridden agents correctly', () => {
|
|
195
|
-
const coreDir = join(tempDir, 'core');
|
|
196
|
-
const customDir = join(tempDir, 'custom');
|
|
197
|
-
mkdirSync(coreDir);
|
|
198
|
-
mkdirSync(customDir);
|
|
199
|
-
|
|
200
|
-
// Core agent
|
|
201
|
-
writeFileSync(
|
|
202
|
-
join(coreDir, 'shared-agent.yaml'),
|
|
203
|
-
`
|
|
204
|
-
role: shared-agent
|
|
205
|
-
type: ic-engineer
|
|
206
|
-
display_name: Core Version
|
|
207
|
-
description: Core version of agent
|
|
208
|
-
`
|
|
209
|
-
);
|
|
210
|
-
|
|
211
|
-
// Custom override
|
|
212
|
-
writeFileSync(
|
|
213
|
-
join(customDir, 'shared-agent.yaml'),
|
|
214
|
-
`
|
|
215
|
-
role: shared-agent
|
|
216
|
-
type: ic-engineer
|
|
217
|
-
display_name: Custom Version
|
|
218
|
-
description: Custom version of agent
|
|
219
|
-
`
|
|
220
|
-
);
|
|
221
|
-
|
|
222
|
-
const agents = loadAllAgents({
|
|
223
|
-
coreAgentsDir: coreDir,
|
|
224
|
-
customAgentsDir: customDir,
|
|
225
|
-
});
|
|
226
|
-
|
|
227
|
-
expect(agents.size).toBe(1);
|
|
228
|
-
expect(agents.get('shared-agent')?.source).toBe('override');
|
|
229
|
-
expect(agents.get('shared-agent')?.definition.display_name).toBe('Custom Version');
|
|
230
|
-
});
|
|
231
|
-
});
|
|
232
|
-
|
|
233
|
-
describe('filterAgentsByTeam', () => {
|
|
234
|
-
it('should return all agents when no team config', () => {
|
|
235
|
-
const agents = new Map<string, AgentMetadata>([
|
|
236
|
-
['agent-one', { definition: minimalAgent, source: 'core', filePath: '' }],
|
|
237
|
-
['agent-two', { definition: fullAgent, source: 'core', filePath: '' }],
|
|
238
|
-
]);
|
|
239
|
-
|
|
240
|
-
const filtered = filterAgentsByTeam(agents);
|
|
241
|
-
expect(filtered.size).toBe(2);
|
|
242
|
-
});
|
|
243
|
-
|
|
244
|
-
it('should filter agents by team config', () => {
|
|
245
|
-
const agents = new Map<string, AgentMetadata>([
|
|
246
|
-
['agent-one', { definition: minimalAgent, source: 'core', filePath: '' }],
|
|
247
|
-
['agent-two', { definition: fullAgent, source: 'core', filePath: '' }],
|
|
248
|
-
]);
|
|
249
|
-
|
|
250
|
-
const config: CoreAIConfig = {
|
|
251
|
-
version: '1.0',
|
|
252
|
-
project: { name: 'test' },
|
|
253
|
-
team: { agents: ['agent-one'] },
|
|
254
|
-
};
|
|
255
|
-
|
|
256
|
-
const filtered = filterAgentsByTeam(agents, config);
|
|
257
|
-
expect(filtered.size).toBe(1);
|
|
258
|
-
expect(filtered.has('agent-one')).toBe(true);
|
|
259
|
-
expect(filtered.has('agent-two')).toBe(false);
|
|
260
|
-
});
|
|
261
|
-
|
|
262
|
-
it('should handle empty team agents array', () => {
|
|
263
|
-
const agents = new Map<string, AgentMetadata>([
|
|
264
|
-
['agent-one', { definition: minimalAgent, source: 'core', filePath: '' }],
|
|
265
|
-
]);
|
|
266
|
-
|
|
267
|
-
const config: CoreAIConfig = {
|
|
268
|
-
version: '1.0',
|
|
269
|
-
project: { name: 'test' },
|
|
270
|
-
team: { agents: [] },
|
|
271
|
-
};
|
|
272
|
-
|
|
273
|
-
const filtered = filterAgentsByTeam(agents, config);
|
|
274
|
-
expect(filtered.size).toBe(1);
|
|
275
|
-
});
|
|
276
|
-
});
|
|
277
|
-
|
|
278
|
-
describe('compileAgents', () => {
|
|
279
|
-
it('should compile agents to output directory', () => {
|
|
280
|
-
const coreDir = join(tempDir, 'core');
|
|
281
|
-
const outputDir = join(tempDir, 'output');
|
|
282
|
-
mkdirSync(coreDir);
|
|
283
|
-
|
|
284
|
-
writeFileSync(
|
|
285
|
-
join(coreDir, 'test-agent.yaml'),
|
|
286
|
-
`
|
|
287
|
-
role: test-agent
|
|
288
|
-
type: ic-engineer
|
|
289
|
-
display_name: Test Agent
|
|
290
|
-
description: A test agent
|
|
291
|
-
`
|
|
292
|
-
);
|
|
293
|
-
|
|
294
|
-
const result = compileAgents(undefined, {
|
|
295
|
-
coreAgentsDir: coreDir,
|
|
296
|
-
outputDir,
|
|
297
|
-
projectRoot: tempDir,
|
|
298
|
-
});
|
|
299
|
-
|
|
300
|
-
expect(result.compiled.length).toBe(1);
|
|
301
|
-
expect(result.errors.length).toBe(0);
|
|
302
|
-
expect(result.compiled[0].role).toBe('test-agent');
|
|
303
|
-
|
|
304
|
-
// Verify file was created
|
|
305
|
-
const outputPath = join(outputDir, 'test-agent.md');
|
|
306
|
-
expect(existsSync(outputPath)).toBe(true);
|
|
307
|
-
|
|
308
|
-
const content = readFileSync(outputPath, 'utf-8');
|
|
309
|
-
expect(content).toContain('# Test Agent');
|
|
310
|
-
});
|
|
311
|
-
|
|
312
|
-
it('should resolve variables during compilation', () => {
|
|
313
|
-
const coreDir = join(tempDir, 'core');
|
|
314
|
-
const outputDir = join(tempDir, 'output');
|
|
315
|
-
mkdirSync(coreDir);
|
|
316
|
-
|
|
317
|
-
writeFileSync(
|
|
318
|
-
join(coreDir, 'test-agent.yaml'),
|
|
319
|
-
`
|
|
320
|
-
role: test-agent
|
|
321
|
-
type: ic-engineer
|
|
322
|
-
display_name: Test Agent
|
|
323
|
-
description: Agent for \${config.project.name}
|
|
324
|
-
`
|
|
325
|
-
);
|
|
326
|
-
|
|
327
|
-
const config: CoreAIConfig = {
|
|
328
|
-
version: '1.0',
|
|
329
|
-
project: { name: 'my-awesome-project' },
|
|
330
|
-
};
|
|
331
|
-
|
|
332
|
-
compileAgents(config, {
|
|
333
|
-
coreAgentsDir: coreDir,
|
|
334
|
-
outputDir,
|
|
335
|
-
projectRoot: tempDir,
|
|
336
|
-
});
|
|
337
|
-
|
|
338
|
-
const content = readFileSync(join(outputDir, 'test-agent.md'), 'utf-8');
|
|
339
|
-
expect(content).toContain('Agent for my-awesome-project');
|
|
340
|
-
});
|
|
341
|
-
|
|
342
|
-
it('should create output directory if it does not exist', () => {
|
|
343
|
-
const coreDir = join(tempDir, 'core');
|
|
344
|
-
const outputDir = join(tempDir, 'nested', 'output', 'dir');
|
|
345
|
-
mkdirSync(coreDir);
|
|
346
|
-
|
|
347
|
-
writeFileSync(
|
|
348
|
-
join(coreDir, 'test-agent.yaml'),
|
|
349
|
-
`
|
|
350
|
-
role: test-agent
|
|
351
|
-
type: ic-engineer
|
|
352
|
-
display_name: Test Agent
|
|
353
|
-
description: A test agent
|
|
354
|
-
`
|
|
355
|
-
);
|
|
356
|
-
|
|
357
|
-
compileAgents(undefined, {
|
|
358
|
-
coreAgentsDir: coreDir,
|
|
359
|
-
outputDir,
|
|
360
|
-
projectRoot: tempDir,
|
|
361
|
-
});
|
|
362
|
-
|
|
363
|
-
expect(existsSync(outputDir)).toBe(true);
|
|
364
|
-
});
|
|
365
|
-
});
|
|
366
|
-
|
|
367
|
-
describe('Core Agents Compilation', () => {
|
|
368
|
-
it('should compile all core agents successfully', () => {
|
|
369
|
-
const coreAgentsDir = join(__dirname, '../../agents');
|
|
370
|
-
const outputDir = join(tempDir, 'compiled');
|
|
371
|
-
|
|
372
|
-
const result = compileAgents(undefined, {
|
|
373
|
-
coreAgentsDir,
|
|
374
|
-
outputDir,
|
|
375
|
-
projectRoot: tempDir,
|
|
376
|
-
});
|
|
377
|
-
|
|
378
|
-
expect(result.errors.length).toBe(0);
|
|
379
|
-
expect(result.compiled.length).toBe(4);
|
|
380
|
-
|
|
381
|
-
// Verify each agent was compiled
|
|
382
|
-
const roles = result.compiled.map((c) => c.role).sort();
|
|
383
|
-
expect(roles).toEqual([
|
|
384
|
-
'backend-engineer',
|
|
385
|
-
'devops-engineer',
|
|
386
|
-
'engineering-manager',
|
|
387
|
-
'frontend-engineer',
|
|
388
|
-
]);
|
|
389
|
-
|
|
390
|
-
// Verify files exist and have content
|
|
391
|
-
for (const compiled of result.compiled) {
|
|
392
|
-
const content = readFileSync(compiled.outputPath, 'utf-8');
|
|
393
|
-
expect(content.length).toBeGreaterThan(0);
|
|
394
|
-
expect(content).toContain('# ');
|
|
395
|
-
expect(content).toContain('*Generated by CoreAI*');
|
|
396
|
-
}
|
|
397
|
-
});
|
|
398
|
-
});
|
|
399
|
-
});
|