@deimoscloud/coreai 0.1.9 → 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 +1 -1
- package/dist/cli/index.js.map +1 -1
- package/dist/index.js +1 -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 -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/cache/types.test.ts
DELETED
|
@@ -1,192 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Cache Types Tests
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import { CacheError, CACHE_PATHS, DEFAULT_CACHE_CONFIG } from './types.js';
|
|
6
|
-
import type {
|
|
7
|
-
CacheSource,
|
|
8
|
-
CacheStatus,
|
|
9
|
-
CacheMetadata,
|
|
10
|
-
CacheEntry,
|
|
11
|
-
CacheOptions,
|
|
12
|
-
CacheListOptions,
|
|
13
|
-
CacheStats,
|
|
14
|
-
SyncResult,
|
|
15
|
-
} from './types.js';
|
|
16
|
-
|
|
17
|
-
describe('CacheError', () => {
|
|
18
|
-
it('should create error with message and code', () => {
|
|
19
|
-
const error = new CacheError('Entry not found', 'not_found');
|
|
20
|
-
expect(error.message).toBe('Entry not found');
|
|
21
|
-
expect(error.code).toBe('not_found');
|
|
22
|
-
expect(error.name).toBe('CacheError');
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
it('should create error with key', () => {
|
|
26
|
-
const error = new CacheError('Entry not found', 'not_found', 'test-key');
|
|
27
|
-
expect(error.key).toBe('test-key');
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
it('should create error with cause', () => {
|
|
31
|
-
const cause = new Error('Original error');
|
|
32
|
-
const error = new CacheError('Wrapped error', 'read_failed', undefined, cause);
|
|
33
|
-
expect(error.cause).toBe(cause);
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
it('should be instanceof Error', () => {
|
|
37
|
-
const error = new CacheError('Test', 'not_found');
|
|
38
|
-
expect(error).toBeInstanceOf(Error);
|
|
39
|
-
expect(error).toBeInstanceOf(CacheError);
|
|
40
|
-
});
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
describe('CACHE_PATHS', () => {
|
|
44
|
-
it('should define root path', () => {
|
|
45
|
-
expect(CACHE_PATHS.ROOT).toBe('.coreai/cache');
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
it('should define content path', () => {
|
|
49
|
-
expect(CACHE_PATHS.CONTENT).toBe('.coreai/cache/content');
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
it('should define metadata path', () => {
|
|
53
|
-
expect(CACHE_PATHS.METADATA).toBe('.coreai/cache/metadata');
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
it('should define index path', () => {
|
|
57
|
-
expect(CACHE_PATHS.INDEX).toBe('.coreai/cache/index.json');
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
it('should define lock path', () => {
|
|
61
|
-
expect(CACHE_PATHS.LOCK).toBe('.coreai/cache/.lock');
|
|
62
|
-
});
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
describe('DEFAULT_CACHE_CONFIG', () => {
|
|
66
|
-
it('should have default TTL of 1 hour', () => {
|
|
67
|
-
expect(DEFAULT_CACHE_CONFIG.ttl).toBe(3600);
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
it('should have default max size of 100MB', () => {
|
|
71
|
-
expect(DEFAULT_CACHE_CONFIG.maxSize).toBe(100 * 1024 * 1024);
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
it('should have default max entries of 1000', () => {
|
|
75
|
-
expect(DEFAULT_CACHE_CONFIG.maxEntries).toBe(1000);
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
it('should enable auto cleanup by default', () => {
|
|
79
|
-
expect(DEFAULT_CACHE_CONFIG.autoCleanup).toBe(true);
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
it('should have cleanup interval of 1 hour', () => {
|
|
83
|
-
expect(DEFAULT_CACHE_CONFIG.cleanupInterval).toBe(3600);
|
|
84
|
-
});
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
describe('Type shapes', () => {
|
|
88
|
-
it('should accept valid CacheSource values', () => {
|
|
89
|
-
const sources: CacheSource[] = ['confluence', 'github', 'notion', 'local', 'custom'];
|
|
90
|
-
expect(sources).toHaveLength(5);
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
it('should accept valid CacheStatus values', () => {
|
|
94
|
-
const statuses: CacheStatus[] = ['valid', 'stale', 'expired', 'error'];
|
|
95
|
-
expect(statuses).toHaveLength(4);
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
it('should create valid CacheMetadata', () => {
|
|
99
|
-
const metadata: CacheMetadata = {
|
|
100
|
-
key: 'test-key',
|
|
101
|
-
source: 'confluence',
|
|
102
|
-
sourceUrl: 'https://example.com/page',
|
|
103
|
-
cachedAt: new Date().toISOString(),
|
|
104
|
-
expiresAt: new Date(Date.now() + 3600000).toISOString(),
|
|
105
|
-
contentHash: 'abc123',
|
|
106
|
-
size: 1024,
|
|
107
|
-
contentType: 'text/markdown',
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
expect(metadata.key).toBe('test-key');
|
|
111
|
-
expect(metadata.source).toBe('confluence');
|
|
112
|
-
});
|
|
113
|
-
|
|
114
|
-
it('should create valid CacheEntry', () => {
|
|
115
|
-
const entry: CacheEntry = {
|
|
116
|
-
metadata: {
|
|
117
|
-
key: 'test-key',
|
|
118
|
-
source: 'github',
|
|
119
|
-
sourceUrl: 'https://github.com/owner/repo',
|
|
120
|
-
cachedAt: new Date().toISOString(),
|
|
121
|
-
expiresAt: new Date(Date.now() + 3600000).toISOString(),
|
|
122
|
-
contentHash: 'def456',
|
|
123
|
-
size: 2048,
|
|
124
|
-
contentType: 'text/markdown',
|
|
125
|
-
},
|
|
126
|
-
content: '# Test Content',
|
|
127
|
-
};
|
|
128
|
-
|
|
129
|
-
expect(entry.metadata.key).toBe('test-key');
|
|
130
|
-
expect(entry.content).toBe('# Test Content');
|
|
131
|
-
});
|
|
132
|
-
|
|
133
|
-
it('should create valid CacheOptions', () => {
|
|
134
|
-
const options: CacheOptions = {
|
|
135
|
-
ttl: 7200,
|
|
136
|
-
forceRefresh: false,
|
|
137
|
-
skipCache: false,
|
|
138
|
-
tags: ['docs', 'architecture'],
|
|
139
|
-
};
|
|
140
|
-
|
|
141
|
-
expect(options.ttl).toBe(7200);
|
|
142
|
-
expect(options.tags).toHaveLength(2);
|
|
143
|
-
});
|
|
144
|
-
|
|
145
|
-
it('should create valid CacheListOptions', () => {
|
|
146
|
-
const options: CacheListOptions = {
|
|
147
|
-
source: 'confluence',
|
|
148
|
-
tag: 'docs',
|
|
149
|
-
status: 'valid',
|
|
150
|
-
limit: 10,
|
|
151
|
-
};
|
|
152
|
-
|
|
153
|
-
expect(options.source).toBe('confluence');
|
|
154
|
-
expect(options.limit).toBe(10);
|
|
155
|
-
});
|
|
156
|
-
|
|
157
|
-
it('should create valid CacheStats', () => {
|
|
158
|
-
const stats: CacheStats = {
|
|
159
|
-
totalEntries: 100,
|
|
160
|
-
totalSize: 1024 * 1024,
|
|
161
|
-
validEntries: 80,
|
|
162
|
-
staleEntries: 15,
|
|
163
|
-
expiredEntries: 5,
|
|
164
|
-
bySource: {
|
|
165
|
-
confluence: 50,
|
|
166
|
-
github: 30,
|
|
167
|
-
notion: 10,
|
|
168
|
-
local: 10,
|
|
169
|
-
custom: 0,
|
|
170
|
-
},
|
|
171
|
-
oldestEntry: new Date(Date.now() - 86400000).toISOString(),
|
|
172
|
-
newestEntry: new Date().toISOString(),
|
|
173
|
-
};
|
|
174
|
-
|
|
175
|
-
expect(stats.totalEntries).toBe(100);
|
|
176
|
-
expect(stats.bySource.confluence).toBe(50);
|
|
177
|
-
});
|
|
178
|
-
|
|
179
|
-
it('should create valid SyncResult', () => {
|
|
180
|
-
const result: SyncResult = {
|
|
181
|
-
added: 5,
|
|
182
|
-
updated: 10,
|
|
183
|
-
removed: 2,
|
|
184
|
-
failed: 1,
|
|
185
|
-
errors: [{ key: 'failed-key', error: 'Network error' }],
|
|
186
|
-
duration: 5000,
|
|
187
|
-
};
|
|
188
|
-
|
|
189
|
-
expect(result.added).toBe(5);
|
|
190
|
-
expect(result.errors).toHaveLength(1);
|
|
191
|
-
});
|
|
192
|
-
});
|
package/src/cache/types.ts
DELETED
|
@@ -1,313 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Cache Types
|
|
3
|
-
*
|
|
4
|
-
* Type definitions for the shared context cache system.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Source type for cached content
|
|
9
|
-
*/
|
|
10
|
-
export type CacheSource = 'confluence' | 'github' | 'notion' | 'local' | 'custom';
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Cache entry status
|
|
14
|
-
*/
|
|
15
|
-
export type CacheStatus = 'valid' | 'stale' | 'expired' | 'error';
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Metadata for a cached entry
|
|
19
|
-
*/
|
|
20
|
-
export interface CacheMetadata {
|
|
21
|
-
/**
|
|
22
|
-
* Unique key for this cache entry
|
|
23
|
-
*/
|
|
24
|
-
key: string;
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Source provider (e.g., 'confluence', 'github')
|
|
28
|
-
*/
|
|
29
|
-
source: CacheSource;
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Original source URL or identifier
|
|
33
|
-
*/
|
|
34
|
-
sourceUrl: string;
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* When the content was cached
|
|
38
|
-
*/
|
|
39
|
-
cachedAt: string;
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* When the content expires (ISO date string)
|
|
43
|
-
*/
|
|
44
|
-
expiresAt: string;
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* ETag or version hash from source (for conditional fetching)
|
|
48
|
-
*/
|
|
49
|
-
etag?: string;
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Content hash for integrity checking
|
|
53
|
-
*/
|
|
54
|
-
contentHash: string;
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* Size in bytes
|
|
58
|
-
*/
|
|
59
|
-
size: number;
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Content type (e.g., 'text/markdown', 'application/json')
|
|
63
|
-
*/
|
|
64
|
-
contentType: string;
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Original title or name
|
|
68
|
-
*/
|
|
69
|
-
title?: string;
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Last modified timestamp from source
|
|
73
|
-
*/
|
|
74
|
-
lastModified?: string;
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* Custom tags for categorization
|
|
78
|
-
*/
|
|
79
|
-
tags?: string[];
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* A cached content entry
|
|
84
|
-
*/
|
|
85
|
-
export interface CacheEntry<T = string> {
|
|
86
|
-
/**
|
|
87
|
-
* Entry metadata
|
|
88
|
-
*/
|
|
89
|
-
metadata: CacheMetadata;
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* The cached content
|
|
93
|
-
*/
|
|
94
|
-
content: T;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* Options for cache operations
|
|
99
|
-
*/
|
|
100
|
-
export interface CacheOptions {
|
|
101
|
-
/**
|
|
102
|
-
* Time-to-live in seconds (default: 3600 = 1 hour)
|
|
103
|
-
*/
|
|
104
|
-
ttl?: number;
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
* Force refresh even if cached
|
|
108
|
-
*/
|
|
109
|
-
forceRefresh?: boolean;
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* Skip cache and fetch directly
|
|
113
|
-
*/
|
|
114
|
-
skipCache?: boolean;
|
|
115
|
-
|
|
116
|
-
/**
|
|
117
|
-
* Custom tags to apply
|
|
118
|
-
*/
|
|
119
|
-
tags?: string[];
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
* Options for listing cache entries
|
|
124
|
-
*/
|
|
125
|
-
export interface CacheListOptions {
|
|
126
|
-
/**
|
|
127
|
-
* Filter by source
|
|
128
|
-
*/
|
|
129
|
-
source?: CacheSource;
|
|
130
|
-
|
|
131
|
-
/**
|
|
132
|
-
* Filter by tag
|
|
133
|
-
*/
|
|
134
|
-
tag?: string;
|
|
135
|
-
|
|
136
|
-
/**
|
|
137
|
-
* Filter by status
|
|
138
|
-
*/
|
|
139
|
-
status?: CacheStatus;
|
|
140
|
-
|
|
141
|
-
/**
|
|
142
|
-
* Maximum entries to return
|
|
143
|
-
*/
|
|
144
|
-
limit?: number;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
/**
|
|
148
|
-
* Cache statistics
|
|
149
|
-
*/
|
|
150
|
-
export interface CacheStats {
|
|
151
|
-
/**
|
|
152
|
-
* Total number of entries
|
|
153
|
-
*/
|
|
154
|
-
totalEntries: number;
|
|
155
|
-
|
|
156
|
-
/**
|
|
157
|
-
* Total size in bytes
|
|
158
|
-
*/
|
|
159
|
-
totalSize: number;
|
|
160
|
-
|
|
161
|
-
/**
|
|
162
|
-
* Number of valid entries
|
|
163
|
-
*/
|
|
164
|
-
validEntries: number;
|
|
165
|
-
|
|
166
|
-
/**
|
|
167
|
-
* Number of stale entries
|
|
168
|
-
*/
|
|
169
|
-
staleEntries: number;
|
|
170
|
-
|
|
171
|
-
/**
|
|
172
|
-
* Number of expired entries
|
|
173
|
-
*/
|
|
174
|
-
expiredEntries: number;
|
|
175
|
-
|
|
176
|
-
/**
|
|
177
|
-
* Entries by source
|
|
178
|
-
*/
|
|
179
|
-
bySource: Record<CacheSource, number>;
|
|
180
|
-
|
|
181
|
-
/**
|
|
182
|
-
* Oldest entry timestamp
|
|
183
|
-
*/
|
|
184
|
-
oldestEntry?: string;
|
|
185
|
-
|
|
186
|
-
/**
|
|
187
|
-
* Newest entry timestamp
|
|
188
|
-
*/
|
|
189
|
-
newestEntry?: string;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
/**
|
|
193
|
-
* Result of a sync operation
|
|
194
|
-
*/
|
|
195
|
-
export interface SyncResult {
|
|
196
|
-
/**
|
|
197
|
-
* Number of entries added
|
|
198
|
-
*/
|
|
199
|
-
added: number;
|
|
200
|
-
|
|
201
|
-
/**
|
|
202
|
-
* Number of entries updated
|
|
203
|
-
*/
|
|
204
|
-
updated: number;
|
|
205
|
-
|
|
206
|
-
/**
|
|
207
|
-
* Number of entries removed
|
|
208
|
-
*/
|
|
209
|
-
removed: number;
|
|
210
|
-
|
|
211
|
-
/**
|
|
212
|
-
* Number of entries that failed to sync
|
|
213
|
-
*/
|
|
214
|
-
failed: number;
|
|
215
|
-
|
|
216
|
-
/**
|
|
217
|
-
* Error messages for failed entries
|
|
218
|
-
*/
|
|
219
|
-
errors: { key: string; error: string }[];
|
|
220
|
-
|
|
221
|
-
/**
|
|
222
|
-
* Duration of sync in milliseconds
|
|
223
|
-
*/
|
|
224
|
-
duration: number;
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
/**
|
|
228
|
-
* Cache error codes
|
|
229
|
-
*/
|
|
230
|
-
export type CacheErrorCode =
|
|
231
|
-
| 'not_found'
|
|
232
|
-
| 'expired'
|
|
233
|
-
| 'invalid_key'
|
|
234
|
-
| 'write_failed'
|
|
235
|
-
| 'read_failed'
|
|
236
|
-
| 'fetch_failed'
|
|
237
|
-
| 'invalid_config'
|
|
238
|
-
| 'storage_full';
|
|
239
|
-
|
|
240
|
-
/**
|
|
241
|
-
* Cache-specific error
|
|
242
|
-
*/
|
|
243
|
-
export class CacheError extends Error {
|
|
244
|
-
constructor(
|
|
245
|
-
message: string,
|
|
246
|
-
public readonly code: CacheErrorCode,
|
|
247
|
-
public readonly key?: string,
|
|
248
|
-
public override readonly cause?: Error
|
|
249
|
-
) {
|
|
250
|
-
super(message);
|
|
251
|
-
this.name = 'CacheError';
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
/**
|
|
256
|
-
* Default cache directory paths
|
|
257
|
-
*/
|
|
258
|
-
export const CACHE_PATHS = {
|
|
259
|
-
/**
|
|
260
|
-
* Root cache directory (relative to project root)
|
|
261
|
-
*/
|
|
262
|
-
ROOT: '.coreai/cache',
|
|
263
|
-
|
|
264
|
-
/**
|
|
265
|
-
* Content storage directory
|
|
266
|
-
*/
|
|
267
|
-
CONTENT: '.coreai/cache/content',
|
|
268
|
-
|
|
269
|
-
/**
|
|
270
|
-
* Metadata storage directory
|
|
271
|
-
*/
|
|
272
|
-
METADATA: '.coreai/cache/metadata',
|
|
273
|
-
|
|
274
|
-
/**
|
|
275
|
-
* Index file for fast lookups
|
|
276
|
-
*/
|
|
277
|
-
INDEX: '.coreai/cache/index.json',
|
|
278
|
-
|
|
279
|
-
/**
|
|
280
|
-
* Lock file for concurrent access
|
|
281
|
-
*/
|
|
282
|
-
LOCK: '.coreai/cache/.lock',
|
|
283
|
-
} as const;
|
|
284
|
-
|
|
285
|
-
/**
|
|
286
|
-
* Default cache configuration
|
|
287
|
-
*/
|
|
288
|
-
export const DEFAULT_CACHE_CONFIG = {
|
|
289
|
-
/**
|
|
290
|
-
* Default TTL in seconds (1 hour)
|
|
291
|
-
*/
|
|
292
|
-
ttl: 3600,
|
|
293
|
-
|
|
294
|
-
/**
|
|
295
|
-
* Maximum cache size in bytes (100MB)
|
|
296
|
-
*/
|
|
297
|
-
maxSize: 100 * 1024 * 1024,
|
|
298
|
-
|
|
299
|
-
/**
|
|
300
|
-
* Maximum number of entries
|
|
301
|
-
*/
|
|
302
|
-
maxEntries: 1000,
|
|
303
|
-
|
|
304
|
-
/**
|
|
305
|
-
* Enable automatic cleanup of expired entries
|
|
306
|
-
*/
|
|
307
|
-
autoCleanup: true,
|
|
308
|
-
|
|
309
|
-
/**
|
|
310
|
-
* Cleanup interval in seconds (1 hour)
|
|
311
|
-
*/
|
|
312
|
-
cleanupInterval: 3600,
|
|
313
|
-
} as const;
|