@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,282 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
resolveString,
|
|
3
|
-
resolveObject,
|
|
4
|
-
resolveAgentDefinition,
|
|
5
|
-
hasVariables,
|
|
6
|
-
extractVariables,
|
|
7
|
-
ResolutionError,
|
|
8
|
-
} from './resolver.js';
|
|
9
|
-
import type { CoreAIConfig } from '../config/types.js';
|
|
10
|
-
import type { AgentDefinition } from './types.js';
|
|
11
|
-
|
|
12
|
-
describe('Variable Resolver', () => {
|
|
13
|
-
const mockConfig: CoreAIConfig = {
|
|
14
|
-
version: '1.0',
|
|
15
|
-
project: {
|
|
16
|
-
name: 'test-project',
|
|
17
|
-
type: 'software',
|
|
18
|
-
},
|
|
19
|
-
team: {
|
|
20
|
-
agents: ['backend-engineer', 'frontend-engineer'],
|
|
21
|
-
},
|
|
22
|
-
integrations: {
|
|
23
|
-
documentation: {
|
|
24
|
-
provider: 'confluence',
|
|
25
|
-
config: {
|
|
26
|
-
base_url: 'https://docs.example.com',
|
|
27
|
-
space_key: 'TEAM',
|
|
28
|
-
},
|
|
29
|
-
},
|
|
30
|
-
issue_tracker: {
|
|
31
|
-
provider: 'jira',
|
|
32
|
-
config: {
|
|
33
|
-
base_url: 'https://jira.example.com',
|
|
34
|
-
project_key: 'PROJ',
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
git: {
|
|
38
|
-
provider: 'github',
|
|
39
|
-
config: {
|
|
40
|
-
repo: 'org/repo',
|
|
41
|
-
default_branch: 'main',
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
|
-
},
|
|
45
|
-
tech_stack: {
|
|
46
|
-
primary_language: 'TypeScript',
|
|
47
|
-
frameworks: ['React', 'Node.js'],
|
|
48
|
-
cloud: 'AWS',
|
|
49
|
-
},
|
|
50
|
-
quality_gates: {
|
|
51
|
-
lint: { command: 'npm run lint', required: true },
|
|
52
|
-
test: { command: 'npm test', required: true },
|
|
53
|
-
},
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
const mockAgent: AgentDefinition = {
|
|
57
|
-
role: 'backend-engineer',
|
|
58
|
-
type: 'ic-engineer',
|
|
59
|
-
display_name: 'Backend Engineer',
|
|
60
|
-
description: 'A backend engineer',
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
describe('resolveString', () => {
|
|
64
|
-
it('should resolve config variables', () => {
|
|
65
|
-
const result = resolveString('Project: ${config.project.name}', { config: mockConfig });
|
|
66
|
-
expect(result).toBe('Project: test-project');
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
it('should resolve nested config variables', () => {
|
|
70
|
-
const result = resolveString('Language: ${config.tech_stack.primary_language}', {
|
|
71
|
-
config: mockConfig,
|
|
72
|
-
});
|
|
73
|
-
expect(result).toBe('Language: TypeScript');
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
it('should resolve agent variables', () => {
|
|
77
|
-
const result = resolveString('Role: ${agent.role}', { agent: mockAgent });
|
|
78
|
-
expect(result).toBe('Role: backend-engineer');
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
it('should resolve remote.documentation shortcut', () => {
|
|
82
|
-
const result = resolveString('Docs: ${remote.documentation}', { config: mockConfig });
|
|
83
|
-
expect(result).toBe('Docs: https://docs.example.com');
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
it('should resolve remote.issues shortcut', () => {
|
|
87
|
-
const result = resolveString('Issues: ${remote.issues}', { config: mockConfig });
|
|
88
|
-
expect(result).toBe('Issues: https://jira.example.com');
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
it('should resolve remote.git shortcut', () => {
|
|
92
|
-
const result = resolveString('Repo: ${remote.git}', { config: mockConfig });
|
|
93
|
-
expect(result).toBe('Repo: org/repo');
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
it('should resolve multiple variables in one string', () => {
|
|
97
|
-
const result = resolveString('${agent.role} on ${config.project.name}', {
|
|
98
|
-
config: mockConfig,
|
|
99
|
-
agent: mockAgent,
|
|
100
|
-
});
|
|
101
|
-
expect(result).toBe('backend-engineer on test-project');
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
it('should leave unresolved variables as-is in non-strict mode', () => {
|
|
105
|
-
const result = resolveString('Value: ${config.nonexistent}', { config: mockConfig });
|
|
106
|
-
expect(result).toBe('Value: ${config.nonexistent}');
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
it('should throw in strict mode for unresolved variables', () => {
|
|
110
|
-
expect(() => {
|
|
111
|
-
resolveString('Value: ${config.nonexistent}', { config: mockConfig }, { strict: true });
|
|
112
|
-
}).toThrow(ResolutionError);
|
|
113
|
-
});
|
|
114
|
-
|
|
115
|
-
it('should throw in strict mode for missing context', () => {
|
|
116
|
-
expect(() => {
|
|
117
|
-
resolveString('Value: ${config.project.name}', {}, { strict: true });
|
|
118
|
-
}).toThrow(ResolutionError);
|
|
119
|
-
});
|
|
120
|
-
|
|
121
|
-
it('should resolve arrays as JSON', () => {
|
|
122
|
-
const result = resolveString('Frameworks: ${config.tech_stack.frameworks}', {
|
|
123
|
-
config: mockConfig,
|
|
124
|
-
});
|
|
125
|
-
expect(result).toBe('Frameworks: ["React","Node.js"]');
|
|
126
|
-
});
|
|
127
|
-
|
|
128
|
-
it('should resolve objects as JSON', () => {
|
|
129
|
-
const result = resolveString('Gate: ${config.quality_gates.lint}', { config: mockConfig });
|
|
130
|
-
expect(result).toBe('Gate: {"command":"npm run lint","required":true}');
|
|
131
|
-
});
|
|
132
|
-
|
|
133
|
-
it('should handle strings without variables', () => {
|
|
134
|
-
const result = resolveString('No variables here', { config: mockConfig });
|
|
135
|
-
expect(result).toBe('No variables here');
|
|
136
|
-
});
|
|
137
|
-
});
|
|
138
|
-
|
|
139
|
-
describe('hasVariables', () => {
|
|
140
|
-
it('should return true for strings with variables', () => {
|
|
141
|
-
expect(hasVariables('${config.project.name}')).toBe(true);
|
|
142
|
-
expect(hasVariables('Hello ${agent.role}')).toBe(true);
|
|
143
|
-
});
|
|
144
|
-
|
|
145
|
-
it('should return false for strings without variables', () => {
|
|
146
|
-
expect(hasVariables('No variables')).toBe(false);
|
|
147
|
-
expect(hasVariables('Just $ signs')).toBe(false);
|
|
148
|
-
});
|
|
149
|
-
});
|
|
150
|
-
|
|
151
|
-
describe('extractVariables', () => {
|
|
152
|
-
it('should extract single variable', () => {
|
|
153
|
-
const vars = extractVariables('${config.project.name}');
|
|
154
|
-
expect(vars).toEqual(['config.project.name']);
|
|
155
|
-
});
|
|
156
|
-
|
|
157
|
-
it('should extract multiple variables', () => {
|
|
158
|
-
const vars = extractVariables('${agent.role} on ${config.project.name}');
|
|
159
|
-
expect(vars).toEqual(['agent.role', 'config.project.name']);
|
|
160
|
-
});
|
|
161
|
-
|
|
162
|
-
it('should return empty array for no variables', () => {
|
|
163
|
-
const vars = extractVariables('No variables');
|
|
164
|
-
expect(vars).toEqual([]);
|
|
165
|
-
});
|
|
166
|
-
});
|
|
167
|
-
|
|
168
|
-
describe('resolveObject', () => {
|
|
169
|
-
it('should resolve variables in nested objects', () => {
|
|
170
|
-
const input = {
|
|
171
|
-
name: '${config.project.name}',
|
|
172
|
-
agent: {
|
|
173
|
-
role: '${agent.role}',
|
|
174
|
-
display: '${agent.display_name}',
|
|
175
|
-
},
|
|
176
|
-
};
|
|
177
|
-
|
|
178
|
-
const result = resolveObject(input, { config: mockConfig, agent: mockAgent });
|
|
179
|
-
|
|
180
|
-
expect(result).toEqual({
|
|
181
|
-
name: 'test-project',
|
|
182
|
-
agent: {
|
|
183
|
-
role: 'backend-engineer',
|
|
184
|
-
display: 'Backend Engineer',
|
|
185
|
-
},
|
|
186
|
-
});
|
|
187
|
-
});
|
|
188
|
-
|
|
189
|
-
it('should resolve variables in arrays', () => {
|
|
190
|
-
const input = {
|
|
191
|
-
sources: ['${remote.documentation}/architecture', '${remote.documentation}/api'],
|
|
192
|
-
};
|
|
193
|
-
|
|
194
|
-
const result = resolveObject(input, { config: mockConfig });
|
|
195
|
-
|
|
196
|
-
expect(result).toEqual({
|
|
197
|
-
sources: ['https://docs.example.com/architecture', 'https://docs.example.com/api'],
|
|
198
|
-
});
|
|
199
|
-
});
|
|
200
|
-
|
|
201
|
-
it('should handle null and undefined values', () => {
|
|
202
|
-
const input = {
|
|
203
|
-
value: null,
|
|
204
|
-
other: undefined,
|
|
205
|
-
name: '${config.project.name}',
|
|
206
|
-
};
|
|
207
|
-
|
|
208
|
-
const result = resolveObject(input, { config: mockConfig });
|
|
209
|
-
|
|
210
|
-
expect(result).toEqual({
|
|
211
|
-
value: null,
|
|
212
|
-
other: undefined,
|
|
213
|
-
name: 'test-project',
|
|
214
|
-
});
|
|
215
|
-
});
|
|
216
|
-
|
|
217
|
-
it('should preserve non-string primitives', () => {
|
|
218
|
-
const input = {
|
|
219
|
-
count: 42,
|
|
220
|
-
enabled: true,
|
|
221
|
-
name: '${config.project.name}',
|
|
222
|
-
};
|
|
223
|
-
|
|
224
|
-
const result = resolveObject(input, { config: mockConfig });
|
|
225
|
-
|
|
226
|
-
expect(result).toEqual({
|
|
227
|
-
count: 42,
|
|
228
|
-
enabled: true,
|
|
229
|
-
name: 'test-project',
|
|
230
|
-
});
|
|
231
|
-
});
|
|
232
|
-
});
|
|
233
|
-
|
|
234
|
-
describe('resolveAgentDefinition', () => {
|
|
235
|
-
it('should resolve all variables in an agent definition', () => {
|
|
236
|
-
const agent: AgentDefinition = {
|
|
237
|
-
role: 'backend-engineer',
|
|
238
|
-
type: 'ic-engineer',
|
|
239
|
-
display_name: 'Backend Engineer',
|
|
240
|
-
description: 'Backend engineer for ${config.project.name}',
|
|
241
|
-
expertise: {
|
|
242
|
-
primary: ['API design'],
|
|
243
|
-
tech_stack: '${config.tech_stack}',
|
|
244
|
-
},
|
|
245
|
-
behaviors: {
|
|
246
|
-
workflow: 'ticket-implementation',
|
|
247
|
-
quality_gates: '${config.quality_gates}',
|
|
248
|
-
},
|
|
249
|
-
context_sources: {
|
|
250
|
-
shared: ['${remote.documentation}/architecture'],
|
|
251
|
-
personal: ['KnowledgeLibrary/${agent.role}/context'],
|
|
252
|
-
},
|
|
253
|
-
communication: {
|
|
254
|
-
inbox: 'KnowledgeLibrary/${agent.role}/inbox',
|
|
255
|
-
outbox: 'KnowledgeLibrary/${agent.role}/outbox',
|
|
256
|
-
},
|
|
257
|
-
};
|
|
258
|
-
|
|
259
|
-
const resolved = resolveAgentDefinition(agent, mockConfig);
|
|
260
|
-
|
|
261
|
-
expect(resolved.description).toBe('Backend engineer for test-project');
|
|
262
|
-
expect(resolved.context_sources?.shared?.[0]).toBe('https://docs.example.com/architecture');
|
|
263
|
-
expect(resolved.context_sources?.personal?.[0]).toBe(
|
|
264
|
-
'KnowledgeLibrary/backend-engineer/context'
|
|
265
|
-
);
|
|
266
|
-
expect(resolved.communication?.inbox).toBe('KnowledgeLibrary/backend-engineer/inbox');
|
|
267
|
-
});
|
|
268
|
-
|
|
269
|
-
it('should work without config', () => {
|
|
270
|
-
const agent: AgentDefinition = {
|
|
271
|
-
role: 'test-agent',
|
|
272
|
-
type: 'ic-engineer',
|
|
273
|
-
display_name: 'Test Agent',
|
|
274
|
-
description: 'Agent role: ${agent.role}',
|
|
275
|
-
};
|
|
276
|
-
|
|
277
|
-
const resolved = resolveAgentDefinition(agent);
|
|
278
|
-
|
|
279
|
-
expect(resolved.description).toBe('Agent role: test-agent');
|
|
280
|
-
});
|
|
281
|
-
});
|
|
282
|
-
});
|
package/src/agents/resolver.ts
DELETED
|
@@ -1,262 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Variable Resolution System
|
|
3
|
-
*
|
|
4
|
-
* Resolves variable placeholders in agent definitions.
|
|
5
|
-
* Supports: ${config.*}, ${agent.*}, ${remote.*}
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import type { CoreAIConfig } from '../config/types.js';
|
|
9
|
-
import type { AgentDefinition } from './types.js';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Context for variable resolution
|
|
13
|
-
*/
|
|
14
|
-
export interface ResolutionContext {
|
|
15
|
-
config?: CoreAIConfig;
|
|
16
|
-
agent?: AgentDefinition;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Options for variable resolution
|
|
21
|
-
*/
|
|
22
|
-
export interface ResolutionOptions {
|
|
23
|
-
/**
|
|
24
|
-
* If true, throw an error for unresolved variables.
|
|
25
|
-
* If false, leave unresolved variables as-is.
|
|
26
|
-
* Default: false
|
|
27
|
-
*/
|
|
28
|
-
strict?: boolean;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Error thrown when variable resolution fails
|
|
33
|
-
*/
|
|
34
|
-
export class ResolutionError extends Error {
|
|
35
|
-
constructor(
|
|
36
|
-
message: string,
|
|
37
|
-
public readonly variable: string,
|
|
38
|
-
public readonly path?: string
|
|
39
|
-
) {
|
|
40
|
-
super(message);
|
|
41
|
-
this.name = 'ResolutionError';
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Pattern to match variable placeholders: ${namespace.path.to.value}
|
|
47
|
-
*/
|
|
48
|
-
const VARIABLE_PATTERN = /\$\{([a-z_][a-z0-9_]*(?:\.[a-z_][a-z0-9_]*)*)\}/gi;
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Get a nested value from an object using dot notation
|
|
52
|
-
*/
|
|
53
|
-
function getNestedValue(obj: unknown, path: string): unknown {
|
|
54
|
-
const parts = path.split('.');
|
|
55
|
-
let current: unknown = obj;
|
|
56
|
-
|
|
57
|
-
for (const part of parts) {
|
|
58
|
-
if (current === null || current === undefined) {
|
|
59
|
-
return undefined;
|
|
60
|
-
}
|
|
61
|
-
if (typeof current !== 'object') {
|
|
62
|
-
return undefined;
|
|
63
|
-
}
|
|
64
|
-
current = (current as Record<string, unknown>)[part];
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
return current;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* Resolve a single variable reference
|
|
72
|
-
*/
|
|
73
|
-
function resolveVariable(
|
|
74
|
-
variable: string,
|
|
75
|
-
context: ResolutionContext,
|
|
76
|
-
options: ResolutionOptions
|
|
77
|
-
): string | undefined {
|
|
78
|
-
const parts = variable.split('.');
|
|
79
|
-
const namespace = parts[0];
|
|
80
|
-
const path = parts.slice(1).join('.');
|
|
81
|
-
|
|
82
|
-
let value: unknown;
|
|
83
|
-
|
|
84
|
-
switch (namespace) {
|
|
85
|
-
case 'config':
|
|
86
|
-
if (!context.config) {
|
|
87
|
-
if (options.strict) {
|
|
88
|
-
throw new ResolutionError(
|
|
89
|
-
`Cannot resolve \${${variable}}: no config context provided`,
|
|
90
|
-
variable
|
|
91
|
-
);
|
|
92
|
-
}
|
|
93
|
-
return undefined;
|
|
94
|
-
}
|
|
95
|
-
value = getNestedValue(context.config, path);
|
|
96
|
-
break;
|
|
97
|
-
|
|
98
|
-
case 'agent':
|
|
99
|
-
if (!context.agent) {
|
|
100
|
-
if (options.strict) {
|
|
101
|
-
throw new ResolutionError(
|
|
102
|
-
`Cannot resolve \${${variable}}: no agent context provided`,
|
|
103
|
-
variable
|
|
104
|
-
);
|
|
105
|
-
}
|
|
106
|
-
return undefined;
|
|
107
|
-
}
|
|
108
|
-
value = getNestedValue(context.agent, path);
|
|
109
|
-
break;
|
|
110
|
-
|
|
111
|
-
case 'remote':
|
|
112
|
-
// Remote is a shortcut for integration URLs
|
|
113
|
-
value = resolveRemoteVariable(path, context, options);
|
|
114
|
-
break;
|
|
115
|
-
|
|
116
|
-
default:
|
|
117
|
-
if (options.strict) {
|
|
118
|
-
throw new ResolutionError(`Unknown variable namespace: ${namespace}`, variable);
|
|
119
|
-
}
|
|
120
|
-
return undefined;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
if (value === undefined) {
|
|
124
|
-
if (options.strict) {
|
|
125
|
-
throw new ResolutionError(`Cannot resolve \${${variable}}: path not found`, variable, path);
|
|
126
|
-
}
|
|
127
|
-
return undefined;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
// Convert value to string representation
|
|
131
|
-
if (typeof value === 'string') {
|
|
132
|
-
return value;
|
|
133
|
-
}
|
|
134
|
-
if (typeof value === 'number' || typeof value === 'boolean') {
|
|
135
|
-
return String(value);
|
|
136
|
-
}
|
|
137
|
-
// For objects/arrays, return JSON representation
|
|
138
|
-
return JSON.stringify(value);
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
/**
|
|
142
|
-
* Resolve remote.* variables (shortcuts to integration URLs)
|
|
143
|
-
*/
|
|
144
|
-
function resolveRemoteVariable(
|
|
145
|
-
path: string,
|
|
146
|
-
context: ResolutionContext,
|
|
147
|
-
options: ResolutionOptions
|
|
148
|
-
): string | undefined {
|
|
149
|
-
if (!context.config?.integrations) {
|
|
150
|
-
if (options.strict) {
|
|
151
|
-
throw new ResolutionError(
|
|
152
|
-
`Cannot resolve \${remote.${path}}: no integrations configured`,
|
|
153
|
-
`remote.${path}`
|
|
154
|
-
);
|
|
155
|
-
}
|
|
156
|
-
return undefined;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
const integrations = context.config.integrations;
|
|
160
|
-
|
|
161
|
-
// Map remote shortcuts to integration paths
|
|
162
|
-
switch (path) {
|
|
163
|
-
case 'documentation':
|
|
164
|
-
return (
|
|
165
|
-
integrations.documentation?.config?.base_url ??
|
|
166
|
-
integrations.documentation?.config?.base_path
|
|
167
|
-
);
|
|
168
|
-
|
|
169
|
-
case 'issues':
|
|
170
|
-
return integrations.issue_tracker?.config?.base_url;
|
|
171
|
-
|
|
172
|
-
case 'git':
|
|
173
|
-
return integrations.git?.config?.repo;
|
|
174
|
-
|
|
175
|
-
case 'state':
|
|
176
|
-
return integrations.state?.config?.base_path ?? integrations.state?.config?.bucket;
|
|
177
|
-
|
|
178
|
-
default:
|
|
179
|
-
// Try to resolve as nested path under integrations
|
|
180
|
-
return getNestedValue(integrations, path) as string | undefined;
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
/**
|
|
185
|
-
* Resolve all variables in a string
|
|
186
|
-
*/
|
|
187
|
-
export function resolveString(
|
|
188
|
-
input: string,
|
|
189
|
-
context: ResolutionContext,
|
|
190
|
-
options: ResolutionOptions = {}
|
|
191
|
-
): string {
|
|
192
|
-
return input.replace(VARIABLE_PATTERN, (match, variable: string) => {
|
|
193
|
-
const resolved = resolveVariable(variable, context, options);
|
|
194
|
-
return resolved !== undefined ? resolved : match;
|
|
195
|
-
});
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
/**
|
|
199
|
-
* Check if a string contains variable placeholders
|
|
200
|
-
*/
|
|
201
|
-
export function hasVariables(input: string): boolean {
|
|
202
|
-
// Create new regex to avoid state issues with global flag
|
|
203
|
-
const pattern = /\$\{([a-z_][a-z0-9_]*(?:\.[a-z_][a-z0-9_]*)*)\}/i;
|
|
204
|
-
return pattern.test(input);
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
/**
|
|
208
|
-
* Extract all variable references from a string
|
|
209
|
-
*/
|
|
210
|
-
export function extractVariables(input: string): string[] {
|
|
211
|
-
const matches = input.matchAll(VARIABLE_PATTERN);
|
|
212
|
-
return Array.from(matches, (m) => m[1]).filter((v): v is string => v !== undefined);
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
/**
|
|
216
|
-
* Recursively resolve all variables in an object
|
|
217
|
-
*/
|
|
218
|
-
export function resolveObject<T>(
|
|
219
|
-
obj: T,
|
|
220
|
-
context: ResolutionContext,
|
|
221
|
-
options: ResolutionOptions = {}
|
|
222
|
-
): T {
|
|
223
|
-
if (obj === null || obj === undefined) {
|
|
224
|
-
return obj;
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
if (typeof obj === 'string') {
|
|
228
|
-
return resolveString(obj, context, options) as T;
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
if (Array.isArray(obj)) {
|
|
232
|
-
return obj.map((item) => resolveObject(item, context, options)) as T;
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
if (typeof obj === 'object') {
|
|
236
|
-
const result: Record<string, unknown> = {};
|
|
237
|
-
for (const [key, value] of Object.entries(obj)) {
|
|
238
|
-
result[key] = resolveObject(value, context, options);
|
|
239
|
-
}
|
|
240
|
-
return result as T;
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
return obj;
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
/**
|
|
247
|
-
* Resolve all variables in an agent definition
|
|
248
|
-
*/
|
|
249
|
-
export function resolveAgentDefinition(
|
|
250
|
-
agent: AgentDefinition,
|
|
251
|
-
config?: CoreAIConfig,
|
|
252
|
-
options: ResolutionOptions = {}
|
|
253
|
-
): AgentDefinition {
|
|
254
|
-
const context: ResolutionContext = {
|
|
255
|
-
agent,
|
|
256
|
-
};
|
|
257
|
-
if (config) {
|
|
258
|
-
context.config = config;
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
return resolveObject(agent, context, options);
|
|
262
|
-
}
|
package/src/agents/types.ts
DELETED
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* CoreAI Agent Types
|
|
3
|
-
*
|
|
4
|
-
* TypeScript types corresponding to the JSON schema at schemas/agent.schema.json
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
export type AgentType = 'ic-engineer' | 'manager' | 'specialist' | 'coordinator';
|
|
8
|
-
|
|
9
|
-
export type WorkflowType =
|
|
10
|
-
| 'ticket-implementation'
|
|
11
|
-
| 'bug-investigation'
|
|
12
|
-
| 'code-review'
|
|
13
|
-
| 'planning-estimation';
|
|
14
|
-
|
|
15
|
-
export interface AgentExpertise {
|
|
16
|
-
primary?: string[];
|
|
17
|
-
tech_stack?: string;
|
|
18
|
-
[key: string]: unknown;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export interface AgentPrinciples {
|
|
22
|
-
code_quality?: string[];
|
|
23
|
-
testing?: string[];
|
|
24
|
-
security?: string[];
|
|
25
|
-
performance?: string[];
|
|
26
|
-
[key: string]: string[] | undefined;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export interface AgentBehaviors {
|
|
30
|
-
workflow?: WorkflowType;
|
|
31
|
-
quality_gates?: string;
|
|
32
|
-
[key: string]: unknown;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export interface AgentContextSources {
|
|
36
|
-
shared?: string[];
|
|
37
|
-
personal?: string[];
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export interface AgentCommunication {
|
|
41
|
-
inbox?: string;
|
|
42
|
-
outbox?: string;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Default Claude Code tools available to agents
|
|
47
|
-
*/
|
|
48
|
-
export const DEFAULT_AGENT_TOOLS = ['Read', 'Write', 'Edit', 'Bash', 'Glob', 'Grep'] as const;
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Raw agent definition as loaded from YAML (before variable resolution)
|
|
52
|
-
*/
|
|
53
|
-
export interface AgentDefinition {
|
|
54
|
-
role: string;
|
|
55
|
-
type: AgentType;
|
|
56
|
-
display_name: string;
|
|
57
|
-
description: string;
|
|
58
|
-
responsibilities?: string[];
|
|
59
|
-
expertise?: AgentExpertise;
|
|
60
|
-
skills?: string[];
|
|
61
|
-
principles?: AgentPrinciples;
|
|
62
|
-
behaviors?: AgentBehaviors;
|
|
63
|
-
context_sources?: AgentContextSources;
|
|
64
|
-
communication?: AgentCommunication;
|
|
65
|
-
/**
|
|
66
|
-
* Claude Code tools available to this agent.
|
|
67
|
-
* If not specified, defaults to: Read, Write, Edit, Bash, Glob, Grep
|
|
68
|
-
*/
|
|
69
|
-
tools?: string[];
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* Agent definition after variable resolution
|
|
74
|
-
*/
|
|
75
|
-
export interface ResolvedAgentDefinition extends AgentDefinition {
|
|
76
|
-
// After resolution, these fields may have expanded values
|
|
77
|
-
expertise?: AgentExpertise & {
|
|
78
|
-
tech_stack?: Record<string, unknown>;
|
|
79
|
-
};
|
|
80
|
-
behaviors?: AgentBehaviors & {
|
|
81
|
-
quality_gates?: Record<string, unknown>;
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* Agent source location
|
|
87
|
-
*/
|
|
88
|
-
export type AgentSource = 'core' | 'custom' | 'override';
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* Agent metadata including source information
|
|
92
|
-
*/
|
|
93
|
-
export interface AgentMetadata {
|
|
94
|
-
definition: AgentDefinition;
|
|
95
|
-
source: AgentSource;
|
|
96
|
-
filePath: string;
|
|
97
|
-
}
|
package/src/cache/index.ts
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Cache Module
|
|
3
|
-
*
|
|
4
|
-
* Provides the shared context cache system for storing and retrieving
|
|
5
|
-
* content from remote documentation providers.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
// Types
|
|
9
|
-
export type {
|
|
10
|
-
CacheSource,
|
|
11
|
-
CacheStatus,
|
|
12
|
-
CacheMetadata,
|
|
13
|
-
CacheEntry,
|
|
14
|
-
CacheOptions,
|
|
15
|
-
CacheListOptions,
|
|
16
|
-
CacheStats,
|
|
17
|
-
SyncResult,
|
|
18
|
-
CacheErrorCode,
|
|
19
|
-
} from './types.js';
|
|
20
|
-
|
|
21
|
-
export { CacheError, CACHE_PATHS, DEFAULT_CACHE_CONFIG } from './types.js';
|
|
22
|
-
|
|
23
|
-
// Interfaces
|
|
24
|
-
export type {
|
|
25
|
-
CacheProvider,
|
|
26
|
-
RemoteFetcher,
|
|
27
|
-
FetchOptions,
|
|
28
|
-
CacheManager,
|
|
29
|
-
SyncOptions,
|
|
30
|
-
} from './interfaces.js';
|
|
31
|
-
|
|
32
|
-
// Provider
|
|
33
|
-
export type { FileCacheProviderOptions } from './provider.js';
|
|
34
|
-
export { FileCacheProvider, createFileCacheProvider } from './provider.js';
|
|
35
|
-
|
|
36
|
-
// Manager
|
|
37
|
-
export type { CacheManagerOptions } from './manager.js';
|
|
38
|
-
export { CacheManager as FileCacheManager, createCacheManager } from './manager.js';
|