@deimoscloud/coreai 0.1.9 → 0.1.11
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 +7 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/index.js +7 -0
- 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 -410
- package/src/agents/compiler.ts +0 -424
- 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
package/src/context/loader.ts
DELETED
|
@@ -1,357 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Context Loader
|
|
3
|
-
*
|
|
4
|
-
* Loads shared context from remote documentation providers with cache-first resolution.
|
|
5
|
-
* Handles first-run scenarios when cache is empty.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import type { CacheManager, CacheOptions, FetchOptions } from '../cache/index.js';
|
|
9
|
-
import type { CacheEntry, CacheMetadata } from '../cache/types.js';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Context source definition
|
|
13
|
-
*/
|
|
14
|
-
export interface ContextSource {
|
|
15
|
-
/**
|
|
16
|
-
* Unique identifier for this context
|
|
17
|
-
*/
|
|
18
|
-
key: string;
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Remote URL to fetch from
|
|
22
|
-
*/
|
|
23
|
-
url: string;
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Optional title for the context
|
|
27
|
-
*/
|
|
28
|
-
title?: string;
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Optional tags for categorization
|
|
32
|
-
*/
|
|
33
|
-
tags?: string[];
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Whether this context is required (fail if cannot load)
|
|
37
|
-
*/
|
|
38
|
-
required?: boolean;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Context load result
|
|
43
|
-
*/
|
|
44
|
-
export interface ContextLoadResult {
|
|
45
|
-
/**
|
|
46
|
-
* Successfully loaded contexts
|
|
47
|
-
*/
|
|
48
|
-
loaded: {
|
|
49
|
-
key: string;
|
|
50
|
-
content: string;
|
|
51
|
-
fromCache: boolean;
|
|
52
|
-
metadata: CacheMetadata;
|
|
53
|
-
}[];
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Failed contexts
|
|
57
|
-
*/
|
|
58
|
-
failed: {
|
|
59
|
-
key: string;
|
|
60
|
-
error: string;
|
|
61
|
-
required: boolean;
|
|
62
|
-
}[];
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* Total duration in milliseconds
|
|
66
|
-
*/
|
|
67
|
-
duration: number;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* Options for the context loader
|
|
72
|
-
*/
|
|
73
|
-
export interface ContextLoaderOptions {
|
|
74
|
-
/**
|
|
75
|
-
* The cache manager to use
|
|
76
|
-
*/
|
|
77
|
-
cacheManager: CacheManager;
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Default TTL for cached contexts (seconds)
|
|
81
|
-
*/
|
|
82
|
-
defaultTtl?: number;
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* Whether to fail on any required context failure
|
|
86
|
-
*/
|
|
87
|
-
failOnRequired?: boolean;
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* Maximum concurrent fetches
|
|
91
|
-
*/
|
|
92
|
-
concurrency?: number;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* Options for loading contexts
|
|
97
|
-
*/
|
|
98
|
-
export interface LoadOptions extends CacheOptions, FetchOptions {
|
|
99
|
-
/**
|
|
100
|
-
* Continue loading other contexts if one fails
|
|
101
|
-
*/
|
|
102
|
-
continueOnError?: boolean;
|
|
103
|
-
|
|
104
|
-
/**
|
|
105
|
-
* Progress callback
|
|
106
|
-
*/
|
|
107
|
-
onProgress?: (loaded: number, total: number, current: string) => void;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* Context Loader
|
|
112
|
-
*
|
|
113
|
-
* Provides cache-first context resolution with graceful degradation
|
|
114
|
-
* for first-run scenarios when the cache is empty.
|
|
115
|
-
*/
|
|
116
|
-
export class ContextLoader {
|
|
117
|
-
private cacheManager: CacheManager;
|
|
118
|
-
private defaultTtl: number;
|
|
119
|
-
private failOnRequired: boolean;
|
|
120
|
-
private concurrency: number;
|
|
121
|
-
|
|
122
|
-
constructor(options: ContextLoaderOptions) {
|
|
123
|
-
this.cacheManager = options.cacheManager;
|
|
124
|
-
this.defaultTtl = options.defaultTtl ?? 3600;
|
|
125
|
-
this.failOnRequired = options.failOnRequired ?? true;
|
|
126
|
-
this.concurrency = options.concurrency ?? 5;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
* Load a single context
|
|
131
|
-
*/
|
|
132
|
-
async load(source: ContextSource, options?: LoadOptions): Promise<CacheEntry<string>> {
|
|
133
|
-
try {
|
|
134
|
-
const cacheOptions: CacheOptions & FetchOptions = {
|
|
135
|
-
...options,
|
|
136
|
-
ttl: options?.ttl ?? this.defaultTtl,
|
|
137
|
-
};
|
|
138
|
-
if (source.tags) {
|
|
139
|
-
cacheOptions.tags = source.tags;
|
|
140
|
-
}
|
|
141
|
-
const entry = await this.cacheManager.getWithFallback<string>(
|
|
142
|
-
source.key,
|
|
143
|
-
source.url,
|
|
144
|
-
cacheOptions
|
|
145
|
-
);
|
|
146
|
-
|
|
147
|
-
return entry;
|
|
148
|
-
} catch (error) {
|
|
149
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
150
|
-
|
|
151
|
-
if (source.required && this.failOnRequired) {
|
|
152
|
-
throw new Error(`Failed to load required context "${source.key}": ${message}`);
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
throw error;
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
/**
|
|
160
|
-
* Load multiple contexts
|
|
161
|
-
*/
|
|
162
|
-
async loadMany(sources: ContextSource[], options?: LoadOptions): Promise<ContextLoadResult> {
|
|
163
|
-
const startTime = Date.now();
|
|
164
|
-
const result: ContextLoadResult = {
|
|
165
|
-
loaded: [],
|
|
166
|
-
failed: [],
|
|
167
|
-
duration: 0,
|
|
168
|
-
};
|
|
169
|
-
|
|
170
|
-
// Track which entries were loaded from cache vs fetched
|
|
171
|
-
const cacheStatuses = new Map<string, boolean>();
|
|
172
|
-
|
|
173
|
-
// Check cache status for all keys first
|
|
174
|
-
for (const source of sources) {
|
|
175
|
-
const status = await this.cacheManager.getCache().getStatus(source.key);
|
|
176
|
-
cacheStatuses.set(source.key, status === 'valid');
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
// Process in chunks for concurrency control
|
|
180
|
-
const chunks = this.chunkArray(sources, this.concurrency);
|
|
181
|
-
|
|
182
|
-
let completed = 0;
|
|
183
|
-
for (const chunk of chunks) {
|
|
184
|
-
const promises = chunk.map(async (source) => {
|
|
185
|
-
try {
|
|
186
|
-
const itemCacheOptions: CacheOptions & FetchOptions = {
|
|
187
|
-
...options,
|
|
188
|
-
ttl: options?.ttl ?? this.defaultTtl,
|
|
189
|
-
};
|
|
190
|
-
if (source.tags) {
|
|
191
|
-
itemCacheOptions.tags = source.tags;
|
|
192
|
-
}
|
|
193
|
-
const entry = await this.cacheManager.getWithFallback<string>(
|
|
194
|
-
source.key,
|
|
195
|
-
source.url,
|
|
196
|
-
itemCacheOptions
|
|
197
|
-
);
|
|
198
|
-
|
|
199
|
-
result.loaded.push({
|
|
200
|
-
key: source.key,
|
|
201
|
-
content: entry.content,
|
|
202
|
-
fromCache: cacheStatuses.get(source.key) ?? false,
|
|
203
|
-
metadata: entry.metadata,
|
|
204
|
-
});
|
|
205
|
-
} catch (error) {
|
|
206
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
207
|
-
result.failed.push({
|
|
208
|
-
key: source.key,
|
|
209
|
-
error: message,
|
|
210
|
-
required: source.required ?? false,
|
|
211
|
-
});
|
|
212
|
-
|
|
213
|
-
if (source.required && this.failOnRequired && !options?.continueOnError) {
|
|
214
|
-
throw new Error(`Failed to load required context "${source.key}": ${message}`);
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
});
|
|
218
|
-
|
|
219
|
-
await Promise.all(promises);
|
|
220
|
-
|
|
221
|
-
completed += chunk.length;
|
|
222
|
-
if (options?.onProgress) {
|
|
223
|
-
const currentKey = chunk[chunk.length - 1]?.key ?? '';
|
|
224
|
-
options.onProgress(completed, sources.length, currentKey);
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
result.duration = Date.now() - startTime;
|
|
229
|
-
|
|
230
|
-
// Check for required failures
|
|
231
|
-
if (this.failOnRequired && !options?.continueOnError) {
|
|
232
|
-
const requiredFailures = result.failed.filter((f) => f.required);
|
|
233
|
-
if (requiredFailures.length > 0) {
|
|
234
|
-
throw new Error(
|
|
235
|
-
`Failed to load ${requiredFailures.length} required context(s): ${requiredFailures.map((f) => f.key).join(', ')}`
|
|
236
|
-
);
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
return result;
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
/**
|
|
244
|
-
* Load contexts by tag
|
|
245
|
-
*/
|
|
246
|
-
async loadByTag(tag: string, _options?: LoadOptions): Promise<ContextLoadResult> {
|
|
247
|
-
const startTime = Date.now();
|
|
248
|
-
const result: ContextLoadResult = {
|
|
249
|
-
loaded: [],
|
|
250
|
-
failed: [],
|
|
251
|
-
duration: 0,
|
|
252
|
-
};
|
|
253
|
-
|
|
254
|
-
// Get all cached entries with this tag
|
|
255
|
-
const entries = await this.cacheManager.getCache().list({ tag });
|
|
256
|
-
|
|
257
|
-
for (const entry of entries) {
|
|
258
|
-
try {
|
|
259
|
-
const cached = await this.cacheManager.getCache().get<string>(entry.key);
|
|
260
|
-
if (cached) {
|
|
261
|
-
result.loaded.push({
|
|
262
|
-
key: entry.key,
|
|
263
|
-
content: cached.content,
|
|
264
|
-
fromCache: true,
|
|
265
|
-
metadata: cached.metadata,
|
|
266
|
-
});
|
|
267
|
-
}
|
|
268
|
-
} catch (error) {
|
|
269
|
-
result.failed.push({
|
|
270
|
-
key: entry.key,
|
|
271
|
-
error: error instanceof Error ? error.message : String(error),
|
|
272
|
-
required: false,
|
|
273
|
-
});
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
result.duration = Date.now() - startTime;
|
|
278
|
-
return result;
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
/**
|
|
282
|
-
* Refresh all contexts (sync from remote)
|
|
283
|
-
*/
|
|
284
|
-
async refresh(sources: ContextSource[], options?: LoadOptions): Promise<ContextLoadResult> {
|
|
285
|
-
return this.loadMany(sources, {
|
|
286
|
-
...options,
|
|
287
|
-
forceRefresh: true,
|
|
288
|
-
});
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
/**
|
|
292
|
-
* Check if all required contexts are available (cached or fetchable)
|
|
293
|
-
*/
|
|
294
|
-
async checkAvailability(
|
|
295
|
-
sources: ContextSource[]
|
|
296
|
-
): Promise<{ available: string[]; missing: string[]; errors: string[] }> {
|
|
297
|
-
const available: string[] = [];
|
|
298
|
-
const missing: string[] = [];
|
|
299
|
-
const errors: string[] = [];
|
|
300
|
-
|
|
301
|
-
for (const source of sources) {
|
|
302
|
-
try {
|
|
303
|
-
// Check if cached
|
|
304
|
-
const hasCached = await this.cacheManager.getCache().has(source.key);
|
|
305
|
-
if (hasCached) {
|
|
306
|
-
available.push(source.key);
|
|
307
|
-
continue;
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
// Check if fetcher is available
|
|
311
|
-
const url = new URL(source.url);
|
|
312
|
-
const source_type = this.getSourceFromHostname(url.hostname);
|
|
313
|
-
if (this.cacheManager.hasFetcher(source_type)) {
|
|
314
|
-
missing.push(source.key); // Can be fetched but not cached
|
|
315
|
-
} else {
|
|
316
|
-
errors.push(`${source.key}: No fetcher for ${source_type}`);
|
|
317
|
-
}
|
|
318
|
-
} catch (error) {
|
|
319
|
-
errors.push(`${source.key}: ${error instanceof Error ? error.message : String(error)}`);
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
return { available, missing, errors };
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
/**
|
|
327
|
-
* Get the cache manager
|
|
328
|
-
*/
|
|
329
|
-
getCacheManager(): CacheManager {
|
|
330
|
-
return this.cacheManager;
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
// Private helpers
|
|
334
|
-
|
|
335
|
-
private getSourceFromHostname(hostname: string): string {
|
|
336
|
-
const lower = hostname.toLowerCase();
|
|
337
|
-
if (lower.includes('confluence') || lower.includes('atlassian.net')) return 'confluence';
|
|
338
|
-
if (lower.includes('github.com') || lower.includes('github')) return 'github';
|
|
339
|
-
if (lower.includes('notion.so') || lower.includes('notion')) return 'notion';
|
|
340
|
-
return 'custom';
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
private chunkArray<T>(array: T[], size: number): T[][] {
|
|
344
|
-
const chunks: T[][] = [];
|
|
345
|
-
for (let i = 0; i < array.length; i += size) {
|
|
346
|
-
chunks.push(array.slice(i, i + size));
|
|
347
|
-
}
|
|
348
|
-
return chunks;
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
/**
|
|
353
|
-
* Create a context loader
|
|
354
|
-
*/
|
|
355
|
-
export function createContextLoader(options: ContextLoaderOptions): ContextLoader {
|
|
356
|
-
return new ContextLoader(options);
|
|
357
|
-
}
|
package/src/index.test.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { VERSION } from './index.js';
|
|
2
|
-
|
|
3
|
-
describe('CoreAI', () => {
|
|
4
|
-
describe('VERSION', () => {
|
|
5
|
-
it('should export the correct version', () => {
|
|
6
|
-
expect(VERSION).toBe('0.1.0');
|
|
7
|
-
});
|
|
8
|
-
|
|
9
|
-
it('should be a string', () => {
|
|
10
|
-
expect(typeof VERSION).toBe('string');
|
|
11
|
-
});
|
|
12
|
-
});
|
|
13
|
-
});
|
package/src/index.ts
DELETED
|
@@ -1,268 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* CoreAI - A configurable, team-ready AI agent orchestration platform.
|
|
3
|
-
*
|
|
4
|
-
* This is the main library export for programmatic usage.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import { readFileSync } from 'fs';
|
|
8
|
-
import { dirname, join } from 'path';
|
|
9
|
-
import { fileURLToPath } from 'url';
|
|
10
|
-
|
|
11
|
-
// Find package.json by walking up from the current module
|
|
12
|
-
function findPackageJson(): string {
|
|
13
|
-
let dir = dirname(fileURLToPath(import.meta.url));
|
|
14
|
-
while (dir !== dirname(dir)) {
|
|
15
|
-
const pkgPath = join(dir, 'package.json');
|
|
16
|
-
try {
|
|
17
|
-
const content = readFileSync(pkgPath, 'utf-8');
|
|
18
|
-
const pkg = JSON.parse(content);
|
|
19
|
-
if (pkg.name === '@deimoscloud/coreai') {
|
|
20
|
-
return content;
|
|
21
|
-
}
|
|
22
|
-
} catch {
|
|
23
|
-
// Continue searching
|
|
24
|
-
}
|
|
25
|
-
dir = dirname(dir);
|
|
26
|
-
}
|
|
27
|
-
return '{"version": "unknown"}';
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
const packageJson = JSON.parse(findPackageJson());
|
|
31
|
-
export const VERSION: string = packageJson.version;
|
|
32
|
-
|
|
33
|
-
// Configuration
|
|
34
|
-
export {
|
|
35
|
-
loadConfig,
|
|
36
|
-
loadConfigFromFile,
|
|
37
|
-
findConfigFile,
|
|
38
|
-
configExists,
|
|
39
|
-
getConfigPath,
|
|
40
|
-
ConfigError,
|
|
41
|
-
} from './config/index.js';
|
|
42
|
-
|
|
43
|
-
export type {
|
|
44
|
-
CoreAIConfig,
|
|
45
|
-
ResolvedCoreAIConfig,
|
|
46
|
-
ProjectConfig,
|
|
47
|
-
TeamConfig,
|
|
48
|
-
IntegrationsConfig,
|
|
49
|
-
QualityGatesConfig,
|
|
50
|
-
TechStackConfig,
|
|
51
|
-
CacheConfig,
|
|
52
|
-
ConfigErrorCode,
|
|
53
|
-
} from './config/index.js';
|
|
54
|
-
|
|
55
|
-
// Agents
|
|
56
|
-
export {
|
|
57
|
-
loadAgentFromFile,
|
|
58
|
-
loadAgentsFromDirectory,
|
|
59
|
-
parseAgentYaml,
|
|
60
|
-
validateAgentDefinition,
|
|
61
|
-
getRoleFromFilename,
|
|
62
|
-
AgentError,
|
|
63
|
-
resolveString,
|
|
64
|
-
resolveObject,
|
|
65
|
-
resolveAgentDefinition,
|
|
66
|
-
hasVariables,
|
|
67
|
-
extractVariables,
|
|
68
|
-
ResolutionError,
|
|
69
|
-
generateAgentMarkdown,
|
|
70
|
-
compileAgent,
|
|
71
|
-
compileAgents,
|
|
72
|
-
loadAllAgents,
|
|
73
|
-
filterAgentsByTeam,
|
|
74
|
-
getCoreAgentsDir,
|
|
75
|
-
} from './agents/index.js';
|
|
76
|
-
|
|
77
|
-
export type {
|
|
78
|
-
AgentDefinition,
|
|
79
|
-
ResolvedAgentDefinition,
|
|
80
|
-
AgentType,
|
|
81
|
-
WorkflowType,
|
|
82
|
-
AgentMetadata,
|
|
83
|
-
AgentSource,
|
|
84
|
-
AgentErrorCode,
|
|
85
|
-
ResolutionContext,
|
|
86
|
-
ResolutionOptions,
|
|
87
|
-
CompileOptions,
|
|
88
|
-
CompileResult,
|
|
89
|
-
} from './agents/index.js';
|
|
90
|
-
|
|
91
|
-
// Adapters
|
|
92
|
-
export {
|
|
93
|
-
AdapterFactory,
|
|
94
|
-
createAdapterFactory,
|
|
95
|
-
createAdapterInfo,
|
|
96
|
-
AdapterError,
|
|
97
|
-
} from './adapters/index.js';
|
|
98
|
-
|
|
99
|
-
export type {
|
|
100
|
-
AdapterType,
|
|
101
|
-
AdapterImplementation,
|
|
102
|
-
AdapterInfo,
|
|
103
|
-
AdapterFactoryOptions,
|
|
104
|
-
AdapterErrorCode,
|
|
105
|
-
BaseAdapter,
|
|
106
|
-
IssueTrackerAdapter,
|
|
107
|
-
GitProviderAdapter,
|
|
108
|
-
DocumentationProviderAdapter,
|
|
109
|
-
StateProviderAdapter,
|
|
110
|
-
Adapter,
|
|
111
|
-
Issue,
|
|
112
|
-
IssueQuery,
|
|
113
|
-
IssueStatus,
|
|
114
|
-
CreateIssueData,
|
|
115
|
-
UpdateIssueData,
|
|
116
|
-
PullRequest,
|
|
117
|
-
PullRequestQuery,
|
|
118
|
-
PullRequestStatus,
|
|
119
|
-
CreatePullRequestData,
|
|
120
|
-
Review,
|
|
121
|
-
CreateReviewData,
|
|
122
|
-
ReviewDecision,
|
|
123
|
-
ReviewComment,
|
|
124
|
-
DocumentationPage,
|
|
125
|
-
DocumentationQuery,
|
|
126
|
-
StateEntry,
|
|
127
|
-
StateOptions,
|
|
128
|
-
} from './adapters/index.js';
|
|
129
|
-
|
|
130
|
-
// Cache
|
|
131
|
-
export {
|
|
132
|
-
CacheError,
|
|
133
|
-
CACHE_PATHS,
|
|
134
|
-
DEFAULT_CACHE_CONFIG,
|
|
135
|
-
FileCacheProvider,
|
|
136
|
-
createFileCacheProvider,
|
|
137
|
-
FileCacheManager,
|
|
138
|
-
createCacheManager,
|
|
139
|
-
} from './cache/index.js';
|
|
140
|
-
|
|
141
|
-
export type {
|
|
142
|
-
CacheSource,
|
|
143
|
-
CacheStatus,
|
|
144
|
-
CacheMetadata,
|
|
145
|
-
CacheEntry,
|
|
146
|
-
CacheOptions,
|
|
147
|
-
CacheListOptions,
|
|
148
|
-
CacheStats,
|
|
149
|
-
SyncResult,
|
|
150
|
-
CacheErrorCode,
|
|
151
|
-
CacheProvider,
|
|
152
|
-
RemoteFetcher,
|
|
153
|
-
FetchOptions,
|
|
154
|
-
CacheManager,
|
|
155
|
-
SyncOptions,
|
|
156
|
-
FileCacheProviderOptions,
|
|
157
|
-
CacheManagerOptions,
|
|
158
|
-
} from './cache/index.js';
|
|
159
|
-
|
|
160
|
-
// Context
|
|
161
|
-
export { ContextLoader, createContextLoader } from './context/index.js';
|
|
162
|
-
|
|
163
|
-
export type {
|
|
164
|
-
ContextSource,
|
|
165
|
-
ContextLoadResult,
|
|
166
|
-
ContextLoaderOptions,
|
|
167
|
-
LoadOptions,
|
|
168
|
-
} from './context/index.js';
|
|
169
|
-
|
|
170
|
-
// Commands
|
|
171
|
-
export {
|
|
172
|
-
CommandRegistry,
|
|
173
|
-
createCommandRegistry,
|
|
174
|
-
getGlobalRegistry,
|
|
175
|
-
resetGlobalRegistry,
|
|
176
|
-
createCommandContext,
|
|
177
|
-
cleanupContext,
|
|
178
|
-
withContext,
|
|
179
|
-
loadCommandFromFile,
|
|
180
|
-
loadCommandsFromDirectory,
|
|
181
|
-
loadCoreAICommands,
|
|
182
|
-
loadAllCommands,
|
|
183
|
-
runCommand,
|
|
184
|
-
executeWithDegradation,
|
|
185
|
-
createDegradingHandler,
|
|
186
|
-
StepTracker,
|
|
187
|
-
} from './commands/index.js';
|
|
188
|
-
|
|
189
|
-
export type {
|
|
190
|
-
CommandCategory,
|
|
191
|
-
IntegrationDependency,
|
|
192
|
-
CommandMetadata,
|
|
193
|
-
CommandContext,
|
|
194
|
-
BaseCommandOptions,
|
|
195
|
-
CommandResult,
|
|
196
|
-
CommandHandler,
|
|
197
|
-
CommandDefinition,
|
|
198
|
-
CommandOptionDefinition,
|
|
199
|
-
CommandArgumentDefinition,
|
|
200
|
-
MarkdownCommand,
|
|
201
|
-
RegistryEntry,
|
|
202
|
-
CommandLoaderOptions,
|
|
203
|
-
CommandLoadResult,
|
|
204
|
-
CreateContextOptions,
|
|
205
|
-
RunCommandOptions,
|
|
206
|
-
} from './commands/index.js';
|
|
207
|
-
|
|
208
|
-
// Skills
|
|
209
|
-
export {
|
|
210
|
-
extractVariables as extractSkillVariables,
|
|
211
|
-
substituteVariables,
|
|
212
|
-
checkDependencies,
|
|
213
|
-
loadCustomTemplates,
|
|
214
|
-
generateSkills,
|
|
215
|
-
formatGenerateResult,
|
|
216
|
-
builtInSkills,
|
|
217
|
-
} from './skills/index.js';
|
|
218
|
-
|
|
219
|
-
export type {
|
|
220
|
-
SkillTemplate,
|
|
221
|
-
SkillVariables,
|
|
222
|
-
SkillCategory,
|
|
223
|
-
SkillDependency,
|
|
224
|
-
GenerateSkillsOptions,
|
|
225
|
-
GenerateSkillsResult,
|
|
226
|
-
GeneratedSkill,
|
|
227
|
-
SkillError,
|
|
228
|
-
} from './skills/index.js';
|
|
229
|
-
|
|
230
|
-
// KnowledgeLibrary
|
|
231
|
-
export {
|
|
232
|
-
DEFAULT_KNOWLEDGE_LIBRARY_PATH,
|
|
233
|
-
STANDARD_FILES,
|
|
234
|
-
AGENT_DIRECTORIES,
|
|
235
|
-
CONTROL_FILES,
|
|
236
|
-
getAgentDirectories,
|
|
237
|
-
initKnowledgeLibrary,
|
|
238
|
-
initAgentKnowledgeLibrary,
|
|
239
|
-
agentKnowledgeLibraryExists,
|
|
240
|
-
getAgentKnowledgeState,
|
|
241
|
-
generateMessageFilename,
|
|
242
|
-
readInboxMessages,
|
|
243
|
-
writeInboxMessage,
|
|
244
|
-
markMessageProcessed,
|
|
245
|
-
getKnowledgeLibraryState,
|
|
246
|
-
updateAgentContext,
|
|
247
|
-
formatKnowledgeLibraryState,
|
|
248
|
-
formatAgentKnowledgeState,
|
|
249
|
-
} from './knowledge-library/index.js';
|
|
250
|
-
|
|
251
|
-
export type {
|
|
252
|
-
MessageType,
|
|
253
|
-
MessagePriority,
|
|
254
|
-
MessageMetadata,
|
|
255
|
-
Message,
|
|
256
|
-
AgentContext,
|
|
257
|
-
Objective,
|
|
258
|
-
Decision,
|
|
259
|
-
Dependency,
|
|
260
|
-
AgentControl,
|
|
261
|
-
AgentDirectories,
|
|
262
|
-
AgentKnowledgeState,
|
|
263
|
-
InitKnowledgeLibraryOptions,
|
|
264
|
-
InitKnowledgeLibraryResult,
|
|
265
|
-
ReadMessagesOptions,
|
|
266
|
-
WriteMessageOptions,
|
|
267
|
-
KnowledgeLibraryState,
|
|
268
|
-
} from './knowledge-library/index.js';
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* KnowledgeLibrary Module
|
|
3
|
-
*
|
|
4
|
-
* Local agent state management with inbox/outbox directories.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
export {
|
|
8
|
-
DEFAULT_KNOWLEDGE_LIBRARY_PATH,
|
|
9
|
-
STANDARD_FILES,
|
|
10
|
-
AGENT_DIRECTORIES,
|
|
11
|
-
CONTROL_FILES,
|
|
12
|
-
getAgentDirectories,
|
|
13
|
-
initKnowledgeLibrary,
|
|
14
|
-
initAgentKnowledgeLibrary,
|
|
15
|
-
agentKnowledgeLibraryExists,
|
|
16
|
-
getAgentKnowledgeState,
|
|
17
|
-
generateMessageFilename,
|
|
18
|
-
readInboxMessages,
|
|
19
|
-
writeInboxMessage,
|
|
20
|
-
markMessageProcessed,
|
|
21
|
-
getKnowledgeLibraryState,
|
|
22
|
-
updateAgentContext,
|
|
23
|
-
formatKnowledgeLibraryState,
|
|
24
|
-
formatAgentKnowledgeState,
|
|
25
|
-
} from './manager.js';
|
|
26
|
-
|
|
27
|
-
export type {
|
|
28
|
-
MessageType,
|
|
29
|
-
MessagePriority,
|
|
30
|
-
MessageMetadata,
|
|
31
|
-
Message,
|
|
32
|
-
AgentContext,
|
|
33
|
-
Objective,
|
|
34
|
-
Decision,
|
|
35
|
-
Dependency,
|
|
36
|
-
AgentControl,
|
|
37
|
-
AgentDirectories,
|
|
38
|
-
AgentKnowledgeState,
|
|
39
|
-
InitKnowledgeLibraryOptions,
|
|
40
|
-
InitKnowledgeLibraryResult,
|
|
41
|
-
ReadMessagesOptions,
|
|
42
|
-
WriteMessageOptions,
|
|
43
|
-
KnowledgeLibraryState,
|
|
44
|
-
} from './types.js';
|