cmp-standards 2.8.1 → 2.9.1
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/analytics/CrossProjectAnalytics.d.ts +128 -0
- package/dist/analytics/CrossProjectAnalytics.d.ts.map +1 -0
- package/dist/analytics/CrossProjectAnalytics.js +431 -0
- package/dist/analytics/CrossProjectAnalytics.js.map +1 -0
- package/dist/analytics/index.d.ts +1 -0
- package/dist/analytics/index.d.ts.map +1 -1
- package/dist/analytics/index.js +2 -0
- package/dist/analytics/index.js.map +1 -1
- package/dist/cache/EmbeddingCache.d.ts +6 -4
- package/dist/cache/EmbeddingCache.d.ts.map +1 -1
- package/dist/cache/EmbeddingCache.js +28 -17
- package/dist/cache/EmbeddingCache.js.map +1 -1
- package/dist/cli/index.js +247 -141
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/ui.d.ts +134 -0
- package/dist/cli/ui.d.ts.map +1 -0
- package/dist/cli/ui.js +311 -0
- package/dist/cli/ui.js.map +1 -0
- package/dist/dashboard/tokens.d.ts +228 -0
- package/dist/dashboard/tokens.d.ts.map +1 -0
- package/dist/dashboard/tokens.js +450 -0
- package/dist/dashboard/tokens.js.map +1 -0
- package/dist/dashboard/ui.d.ts +3 -0
- package/dist/dashboard/ui.d.ts.map +1 -1
- package/dist/dashboard/ui.js +95 -61
- package/dist/dashboard/ui.js.map +1 -1
- package/dist/db/cloud.d.ts +11 -0
- package/dist/db/cloud.d.ts.map +1 -1
- package/dist/db/cloud.js +49 -1
- package/dist/db/cloud.js.map +1 -1
- package/dist/db/migrations.d.ts +1 -0
- package/dist/db/migrations.d.ts.map +1 -1
- package/dist/db/migrations.js +109 -0
- package/dist/db/migrations.js.map +1 -1
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +2 -0
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/startup-verify.d.ts +31 -0
- package/dist/hooks/startup-verify.d.ts.map +1 -0
- package/dist/hooks/startup-verify.js +360 -0
- package/dist/hooks/startup-verify.js.map +1 -0
- package/dist/plugins/PluginManager.d.ts +160 -0
- package/dist/plugins/PluginManager.d.ts.map +1 -0
- package/dist/plugins/PluginManager.js +417 -0
- package/dist/plugins/PluginManager.js.map +1 -0
- package/dist/plugins/index.d.ts +7 -0
- package/dist/plugins/index.d.ts.map +1 -0
- package/dist/plugins/index.js +7 -0
- package/dist/plugins/index.js.map +1 -0
- package/dist/services/AuditLog.d.ts +205 -0
- package/dist/services/AuditLog.d.ts.map +1 -0
- package/dist/services/AuditLog.js +352 -0
- package/dist/services/AuditLog.js.map +1 -0
- package/dist/services/FeedbackCollector.d.ts +8 -0
- package/dist/services/FeedbackCollector.d.ts.map +1 -1
- package/dist/services/FeedbackCollector.js +19 -2
- package/dist/services/FeedbackCollector.js.map +1 -1
- package/dist/services/GitIntegration.d.ts +140 -0
- package/dist/services/GitIntegration.d.ts.map +1 -0
- package/dist/services/GitIntegration.js +423 -0
- package/dist/services/GitIntegration.js.map +1 -0
- package/dist/services/HookVerifier.d.ts +95 -0
- package/dist/services/HookVerifier.d.ts.map +1 -0
- package/dist/services/HookVerifier.js +493 -0
- package/dist/services/HookVerifier.js.map +1 -0
- package/dist/services/MemoryVersioning.d.ts +108 -0
- package/dist/services/MemoryVersioning.d.ts.map +1 -0
- package/dist/services/MemoryVersioning.js +281 -0
- package/dist/services/MemoryVersioning.js.map +1 -0
- package/dist/services/context-injector.d.ts +8 -0
- package/dist/services/context-injector.d.ts.map +1 -1
- package/dist/services/context-injector.js +19 -2
- package/dist/services/context-injector.js.map +1 -1
- package/dist/services/index.d.ts +4 -0
- package/dist/services/index.d.ts.map +1 -1
- package/dist/services/index.js +5 -0
- package/dist/services/index.js.map +1 -1
- package/dist/services/memory-router.d.ts +8 -0
- package/dist/services/memory-router.d.ts.map +1 -1
- package/dist/services/memory-router.js +19 -2
- package/dist/services/memory-router.js.map +1 -1
- package/dist/services/pattern-tracker.d.ts +13 -0
- package/dist/services/pattern-tracker.d.ts.map +1 -1
- package/dist/services/pattern-tracker.js +33 -3
- package/dist/services/pattern-tracker.js.map +1 -1
- package/dist/services/semantic-search.d.ts +4 -0
- package/dist/services/semantic-search.d.ts.map +1 -1
- package/dist/services/semantic-search.js +53 -13
- package/dist/services/semantic-search.js.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +1 -0
- package/dist/types/index.js.map +1 -1
- package/package.json +4 -1
|
@@ -0,0 +1,423 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Git Integration Service
|
|
3
|
+
*
|
|
4
|
+
* Provides Git integration for memory system:
|
|
5
|
+
* - Auto-commit memory changes
|
|
6
|
+
* - Export memories as Git-tracked files
|
|
7
|
+
* - Sync with remote repositories
|
|
8
|
+
* - Version history via Git
|
|
9
|
+
*
|
|
10
|
+
* @version 2.9.0
|
|
11
|
+
*/
|
|
12
|
+
import { simpleGit } from 'simple-git';
|
|
13
|
+
import path from 'path';
|
|
14
|
+
import fs from 'fs/promises';
|
|
15
|
+
// =============================================================================
|
|
16
|
+
// Git Integration Service
|
|
17
|
+
// =============================================================================
|
|
18
|
+
export class GitIntegrationService {
|
|
19
|
+
git;
|
|
20
|
+
config;
|
|
21
|
+
system;
|
|
22
|
+
pendingChanges = new Map();
|
|
23
|
+
commitTimer;
|
|
24
|
+
initialized = false;
|
|
25
|
+
constructor(options) {
|
|
26
|
+
this.system = options.system;
|
|
27
|
+
this.config = {
|
|
28
|
+
enabled: options.config.enabled ?? true,
|
|
29
|
+
repoPath: options.config.repoPath ?? process.cwd(),
|
|
30
|
+
memoriesDir: options.config.memoriesDir ?? '.memories',
|
|
31
|
+
branch: options.config.branch,
|
|
32
|
+
remote: options.config.remote ?? 'origin',
|
|
33
|
+
autoCommit: options.config.autoCommit ?? false,
|
|
34
|
+
autoCommitInterval: options.config.autoCommitInterval ?? 300000, // 5 minutes
|
|
35
|
+
commitPrefix: options.config.commitPrefix ?? '[memory]',
|
|
36
|
+
author: options.config.author,
|
|
37
|
+
};
|
|
38
|
+
this.git = simpleGit(this.config.repoPath);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Initialize the Git integration
|
|
42
|
+
*/
|
|
43
|
+
async init() {
|
|
44
|
+
if (!this.config.enabled)
|
|
45
|
+
return false;
|
|
46
|
+
try {
|
|
47
|
+
// Check if it's a git repo
|
|
48
|
+
const isRepo = await this.git.checkIsRepo();
|
|
49
|
+
if (!isRepo) {
|
|
50
|
+
console.warn('[GitIntegration] Not a git repository');
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
// Create memories directory if it doesn't exist
|
|
54
|
+
const memoriesPath = path.join(this.config.repoPath, this.config.memoriesDir);
|
|
55
|
+
await fs.mkdir(memoriesPath, { recursive: true });
|
|
56
|
+
// Add .gitkeep
|
|
57
|
+
const gitkeepPath = path.join(memoriesPath, '.gitkeep');
|
|
58
|
+
try {
|
|
59
|
+
await fs.access(gitkeepPath);
|
|
60
|
+
}
|
|
61
|
+
catch {
|
|
62
|
+
await fs.writeFile(gitkeepPath, '');
|
|
63
|
+
}
|
|
64
|
+
// Start auto-commit timer if enabled
|
|
65
|
+
if (this.config.autoCommit) {
|
|
66
|
+
this.startAutoCommit();
|
|
67
|
+
}
|
|
68
|
+
this.initialized = true;
|
|
69
|
+
return true;
|
|
70
|
+
}
|
|
71
|
+
catch (error) {
|
|
72
|
+
console.error('[GitIntegration] Init failed:', error);
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Save a memory to file and stage for commit
|
|
78
|
+
*/
|
|
79
|
+
async saveMemory(memoryId, content, options) {
|
|
80
|
+
if (!this.initialized)
|
|
81
|
+
return false;
|
|
82
|
+
try {
|
|
83
|
+
const filePath = this.getMemoryFilePath(memoryId, content.domain);
|
|
84
|
+
const fileContent = this.formatMemoryFile(memoryId, content);
|
|
85
|
+
await fs.mkdir(path.dirname(filePath), { recursive: true });
|
|
86
|
+
await fs.writeFile(filePath, fileContent, 'utf-8');
|
|
87
|
+
// Stage the file
|
|
88
|
+
await this.git.add(filePath);
|
|
89
|
+
// Track for batch commit
|
|
90
|
+
this.pendingChanges.set(memoryId, content);
|
|
91
|
+
// Commit immediately if requested
|
|
92
|
+
if (options?.immediate) {
|
|
93
|
+
await this.commit(`Add memory: ${content.title}`);
|
|
94
|
+
}
|
|
95
|
+
return true;
|
|
96
|
+
}
|
|
97
|
+
catch (error) {
|
|
98
|
+
console.error('[GitIntegration] Save failed:', error);
|
|
99
|
+
return false;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Delete a memory file and stage for commit
|
|
104
|
+
*/
|
|
105
|
+
async deleteMemory(memoryId, domain, options) {
|
|
106
|
+
if (!this.initialized)
|
|
107
|
+
return false;
|
|
108
|
+
try {
|
|
109
|
+
const filePath = this.getMemoryFilePath(memoryId, domain);
|
|
110
|
+
try {
|
|
111
|
+
await fs.unlink(filePath);
|
|
112
|
+
await this.git.add(filePath);
|
|
113
|
+
}
|
|
114
|
+
catch {
|
|
115
|
+
// File doesn't exist, that's fine
|
|
116
|
+
}
|
|
117
|
+
// Track deletion
|
|
118
|
+
this.pendingChanges.delete(memoryId);
|
|
119
|
+
if (options?.immediate) {
|
|
120
|
+
await this.commit(`Delete memory: ${memoryId}`);
|
|
121
|
+
}
|
|
122
|
+
return true;
|
|
123
|
+
}
|
|
124
|
+
catch (error) {
|
|
125
|
+
console.error('[GitIntegration] Delete failed:', error);
|
|
126
|
+
return false;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Commit pending changes
|
|
131
|
+
*/
|
|
132
|
+
async commit(message) {
|
|
133
|
+
if (!this.initialized) {
|
|
134
|
+
return { success: false, message: 'Not initialized', error: 'Git integration not initialized' };
|
|
135
|
+
}
|
|
136
|
+
try {
|
|
137
|
+
const status = await this.git.status();
|
|
138
|
+
if (!this.hasChanges(status)) {
|
|
139
|
+
return { success: true, message: 'No changes to commit', filesChanged: 0 };
|
|
140
|
+
}
|
|
141
|
+
const commitMessage = this.formatCommitMessage(message, status);
|
|
142
|
+
// Use raw command for author option
|
|
143
|
+
let result;
|
|
144
|
+
if (this.config.author) {
|
|
145
|
+
result = await this.git.raw([
|
|
146
|
+
'commit',
|
|
147
|
+
'-m', commitMessage,
|
|
148
|
+
'--author', `${this.config.author.name} <${this.config.author.email}>`
|
|
149
|
+
]);
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
result = await this.git.commit(commitMessage);
|
|
153
|
+
}
|
|
154
|
+
// Get the commit hash from the result
|
|
155
|
+
const commitMatch = typeof result === 'string'
|
|
156
|
+
? result.match(/\[[\w\s]+\s([a-f0-9]+)\]/)
|
|
157
|
+
: null;
|
|
158
|
+
// Clear pending changes
|
|
159
|
+
this.pendingChanges.clear();
|
|
160
|
+
const commitHash = commitMatch?.[1] ??
|
|
161
|
+
(typeof result === 'object' && 'commit' in result ? result.commit : undefined);
|
|
162
|
+
return {
|
|
163
|
+
success: true,
|
|
164
|
+
commitHash,
|
|
165
|
+
message: commitMessage,
|
|
166
|
+
filesChanged: status.files.length,
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
catch (error) {
|
|
170
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
171
|
+
return { success: false, message: 'Commit failed', error: errorMessage };
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Push changes to remote
|
|
176
|
+
*/
|
|
177
|
+
async push() {
|
|
178
|
+
if (!this.initialized) {
|
|
179
|
+
return { success: false, error: 'Not initialized' };
|
|
180
|
+
}
|
|
181
|
+
try {
|
|
182
|
+
const branch = this.config.branch ?? (await this.git.branch()).current;
|
|
183
|
+
await this.git.push(this.config.remote, branch);
|
|
184
|
+
return { success: true, pushed: 1 };
|
|
185
|
+
}
|
|
186
|
+
catch (error) {
|
|
187
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
188
|
+
return { success: false, error: errorMessage };
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Pull changes from remote
|
|
193
|
+
*/
|
|
194
|
+
async pull() {
|
|
195
|
+
if (!this.initialized) {
|
|
196
|
+
return { success: false, error: 'Not initialized' };
|
|
197
|
+
}
|
|
198
|
+
try {
|
|
199
|
+
const branch = this.config.branch ?? (await this.git.branch()).current;
|
|
200
|
+
const result = await this.git.pull(this.config.remote, branch);
|
|
201
|
+
return {
|
|
202
|
+
success: true,
|
|
203
|
+
pulled: result.summary.changes,
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
catch (error) {
|
|
207
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
208
|
+
return { success: false, error: errorMessage };
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Get current status
|
|
213
|
+
*/
|
|
214
|
+
async getStatus() {
|
|
215
|
+
return this.git.status();
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Get commit history for memories
|
|
219
|
+
*/
|
|
220
|
+
async getHistory(limit = 20) {
|
|
221
|
+
try {
|
|
222
|
+
const log = await this.git.log({
|
|
223
|
+
maxCount: limit,
|
|
224
|
+
'--': [this.config.memoriesDir],
|
|
225
|
+
});
|
|
226
|
+
return log.all.map(entry => ({
|
|
227
|
+
hash: entry.hash,
|
|
228
|
+
date: entry.date,
|
|
229
|
+
message: entry.message,
|
|
230
|
+
author: entry.author_name,
|
|
231
|
+
}));
|
|
232
|
+
}
|
|
233
|
+
catch {
|
|
234
|
+
return [];
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Export all memories from database to files
|
|
239
|
+
*/
|
|
240
|
+
async exportAll(memories) {
|
|
241
|
+
let exported = 0;
|
|
242
|
+
let failed = 0;
|
|
243
|
+
for (const memory of memories) {
|
|
244
|
+
const success = await this.saveMemory(memory.id, memory.content);
|
|
245
|
+
if (success) {
|
|
246
|
+
exported++;
|
|
247
|
+
}
|
|
248
|
+
else {
|
|
249
|
+
failed++;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
// Commit all changes
|
|
253
|
+
if (exported > 0) {
|
|
254
|
+
await this.commit(`Export ${exported} memories`);
|
|
255
|
+
}
|
|
256
|
+
return { exported, failed };
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Import memories from files
|
|
260
|
+
*/
|
|
261
|
+
async importAll() {
|
|
262
|
+
const memories = [];
|
|
263
|
+
const memoriesPath = path.join(this.config.repoPath, this.config.memoriesDir);
|
|
264
|
+
try {
|
|
265
|
+
const files = await this.findMemoryFiles(memoriesPath);
|
|
266
|
+
for (const file of files) {
|
|
267
|
+
try {
|
|
268
|
+
const content = await fs.readFile(file, 'utf-8');
|
|
269
|
+
const memory = this.parseMemoryFile(content);
|
|
270
|
+
if (memory) {
|
|
271
|
+
memories.push(memory);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
catch {
|
|
275
|
+
console.warn(`[GitIntegration] Failed to parse: ${file}`);
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
catch {
|
|
280
|
+
// Memories directory doesn't exist
|
|
281
|
+
}
|
|
282
|
+
return memories;
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* Stop auto-commit and cleanup
|
|
286
|
+
*/
|
|
287
|
+
stop() {
|
|
288
|
+
if (this.commitTimer) {
|
|
289
|
+
clearInterval(this.commitTimer);
|
|
290
|
+
this.commitTimer = undefined;
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
// ==========================================================================
|
|
294
|
+
// Private Methods
|
|
295
|
+
// ==========================================================================
|
|
296
|
+
startAutoCommit() {
|
|
297
|
+
if (this.commitTimer) {
|
|
298
|
+
clearInterval(this.commitTimer);
|
|
299
|
+
}
|
|
300
|
+
this.commitTimer = setInterval(async () => {
|
|
301
|
+
if (this.pendingChanges.size > 0) {
|
|
302
|
+
await this.commit();
|
|
303
|
+
}
|
|
304
|
+
}, this.config.autoCommitInterval);
|
|
305
|
+
}
|
|
306
|
+
getMemoryFilePath(memoryId, domain) {
|
|
307
|
+
const domainDir = domain ?? 'general';
|
|
308
|
+
const fileName = `${memoryId}.md`;
|
|
309
|
+
return path.join(this.config.repoPath, this.config.memoriesDir, domainDir, fileName);
|
|
310
|
+
}
|
|
311
|
+
formatMemoryFile(memoryId, content) {
|
|
312
|
+
const now = new Date().toISOString();
|
|
313
|
+
const frontmatter = {
|
|
314
|
+
id: memoryId,
|
|
315
|
+
title: content.title,
|
|
316
|
+
domain: content.domain ?? 'general',
|
|
317
|
+
source: content.source ?? 'system',
|
|
318
|
+
createdAt: now,
|
|
319
|
+
updatedAt: now,
|
|
320
|
+
};
|
|
321
|
+
const yaml = Object.entries(frontmatter)
|
|
322
|
+
.map(([k, v]) => `${k}: ${JSON.stringify(v)}`)
|
|
323
|
+
.join('\n');
|
|
324
|
+
return `---
|
|
325
|
+
${yaml}
|
|
326
|
+
---
|
|
327
|
+
|
|
328
|
+
# ${content.title}
|
|
329
|
+
|
|
330
|
+
${content.body ?? ''}
|
|
331
|
+
|
|
332
|
+
${content.relatedFiles?.length ? `\n## Related Files\n\n${content.relatedFiles.map(f => `- ${f}`).join('\n')}` : ''}
|
|
333
|
+
`;
|
|
334
|
+
}
|
|
335
|
+
parseMemoryFile(content) {
|
|
336
|
+
const match = content.match(/^---\n([\s\S]*?)\n---\n([\s\S]*)$/);
|
|
337
|
+
if (!match)
|
|
338
|
+
return null;
|
|
339
|
+
try {
|
|
340
|
+
const [, frontmatter, body] = match;
|
|
341
|
+
const metadata = {};
|
|
342
|
+
// Parse YAML-like frontmatter
|
|
343
|
+
for (const line of frontmatter.split('\n')) {
|
|
344
|
+
const colonIdx = line.indexOf(':');
|
|
345
|
+
if (colonIdx > 0) {
|
|
346
|
+
const key = line.slice(0, colonIdx).trim();
|
|
347
|
+
const value = line.slice(colonIdx + 1).trim();
|
|
348
|
+
try {
|
|
349
|
+
metadata[key] = JSON.parse(value);
|
|
350
|
+
}
|
|
351
|
+
catch {
|
|
352
|
+
metadata[key] = value;
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
return {
|
|
357
|
+
id: String(metadata.id ?? ''),
|
|
358
|
+
title: String(metadata.title ?? ''),
|
|
359
|
+
body: body.trim(),
|
|
360
|
+
domain: metadata.domain,
|
|
361
|
+
source: metadata.source,
|
|
362
|
+
createdAt: String(metadata.createdAt ?? ''),
|
|
363
|
+
updatedAt: String(metadata.updatedAt ?? ''),
|
|
364
|
+
metadata,
|
|
365
|
+
};
|
|
366
|
+
}
|
|
367
|
+
catch {
|
|
368
|
+
return null;
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
async findMemoryFiles(dir) {
|
|
372
|
+
const files = [];
|
|
373
|
+
try {
|
|
374
|
+
const entries = await fs.readdir(dir, { withFileTypes: true });
|
|
375
|
+
for (const entry of entries) {
|
|
376
|
+
const fullPath = path.join(dir, entry.name);
|
|
377
|
+
if (entry.isDirectory()) {
|
|
378
|
+
const subFiles = await this.findMemoryFiles(fullPath);
|
|
379
|
+
files.push(...subFiles);
|
|
380
|
+
}
|
|
381
|
+
else if (entry.name.endsWith('.md')) {
|
|
382
|
+
files.push(fullPath);
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
catch {
|
|
387
|
+
// Directory doesn't exist
|
|
388
|
+
}
|
|
389
|
+
return files;
|
|
390
|
+
}
|
|
391
|
+
hasChanges(status) {
|
|
392
|
+
return status.files.length > 0;
|
|
393
|
+
}
|
|
394
|
+
formatCommitMessage(message, status) {
|
|
395
|
+
const prefix = this.config.commitPrefix;
|
|
396
|
+
const changes = status.files.length;
|
|
397
|
+
const defaultMsg = `Update ${changes} memory file${changes !== 1 ? 's' : ''}`;
|
|
398
|
+
return `${prefix} ${message ?? defaultMsg}`;
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
// =============================================================================
|
|
402
|
+
// Singleton Instance
|
|
403
|
+
// =============================================================================
|
|
404
|
+
let instance = null;
|
|
405
|
+
export function getGitIntegration(system = 'ECOSYSTEM', config) {
|
|
406
|
+
if (!instance) {
|
|
407
|
+
instance = new GitIntegrationService({ system, config: config ?? {} });
|
|
408
|
+
}
|
|
409
|
+
return instance;
|
|
410
|
+
}
|
|
411
|
+
export function resetGitIntegration() {
|
|
412
|
+
if (instance) {
|
|
413
|
+
instance.stop();
|
|
414
|
+
instance = null;
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
/**
|
|
418
|
+
* Create a new Git integration with custom config
|
|
419
|
+
*/
|
|
420
|
+
export function createGitIntegration(options) {
|
|
421
|
+
return new GitIntegrationService(options);
|
|
422
|
+
}
|
|
423
|
+
//# sourceMappingURL=GitIntegration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GitIntegration.js","sourceRoot":"","sources":["../../src/services/GitIntegration.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,SAAS,EAA2B,MAAM,YAAY,CAAA;AAC/D,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,EAAE,MAAM,aAAa,CAAA;AAkD5B,gFAAgF;AAChF,0BAA0B;AAC1B,gFAAgF;AAEhF,MAAM,OAAO,qBAAqB;IACxB,GAAG,CAAW;IACd,MAAM,CAAW;IACjB,MAAM,CAAW;IACjB,cAAc,GAA+B,IAAI,GAAG,EAAE,CAAA;IACtD,WAAW,CAAiB;IAC5B,WAAW,GAAG,KAAK,CAAA;IAE3B,YAAY,OAA0D;QACpE,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAA;QAC5B,IAAI,CAAC,MAAM,GAAG;YACZ,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC,OAAO,IAAI,IAAI;YACvC,QAA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AAEhF,IAAI,QAAQ,GAAiC,IAAI,CAAA;AAEjD,MAAM,UAAU,iBAAiB,CAC/B,SAAoB,WAAW,EAC/B,MAA2B;IAE3B,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,QAAQ,GAAG,IAAI,qBAAqB,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,IAAI,EAAE,EAAE,CAAC,CAAA;IACxE,CAAC;IACD,OAAO,QAAQ,CAAA;AACjB,CAAC;AAED,MAAM,UAAU,mBAAmB;IACjC,IAAI,QAAQ,EAAE,CAAC;QACb,QAAQ,CAAC,IAAI,EAAE,CAAA;QACf,QAAQ,GAAG,IAAI,CAAA;IACjB,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAAC,OAGpC;IACC,OAAO,IAAI,qBAAqB,CAAC,OAAO,CAAC,CAAA;AAC3C,CAAC"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hook Verifier Service
|
|
3
|
+
*
|
|
4
|
+
* Validates and auto-fixes Claude Code hook configurations:
|
|
5
|
+
* - Checks if hooks are properly configured in .claude/settings.json
|
|
6
|
+
* - Verifies hook files exist and have proper CLI entry points
|
|
7
|
+
* - Auto-fixes misconfigured hooks
|
|
8
|
+
* - Can run automatically on startup or via CLI
|
|
9
|
+
*
|
|
10
|
+
* @version 2.9.0
|
|
11
|
+
*/
|
|
12
|
+
export interface HookConfig {
|
|
13
|
+
type: 'command';
|
|
14
|
+
command: string;
|
|
15
|
+
}
|
|
16
|
+
export interface ClaudeSettings {
|
|
17
|
+
hooks?: {
|
|
18
|
+
PreToolUse?: HookConfig[];
|
|
19
|
+
PostToolUse?: HookConfig[];
|
|
20
|
+
Notification?: HookConfig[];
|
|
21
|
+
Stop?: HookConfig[];
|
|
22
|
+
SubagentStop?: HookConfig[];
|
|
23
|
+
};
|
|
24
|
+
permissions?: {
|
|
25
|
+
allow?: string[];
|
|
26
|
+
deny?: string[];
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
export interface HookVerificationResult {
|
|
30
|
+
hookPath: string;
|
|
31
|
+
hookType: string;
|
|
32
|
+
status: 'valid' | 'missing_file' | 'missing_entry_point' | 'invalid_syntax' | 'missing_shebang';
|
|
33
|
+
message: string;
|
|
34
|
+
autoFixable: boolean;
|
|
35
|
+
fixed?: boolean;
|
|
36
|
+
}
|
|
37
|
+
export interface VerificationReport {
|
|
38
|
+
projectPath: string;
|
|
39
|
+
settingsPath: string;
|
|
40
|
+
settingsExists: boolean;
|
|
41
|
+
hooksConfigured: number;
|
|
42
|
+
results: HookVerificationResult[];
|
|
43
|
+
errors: string[];
|
|
44
|
+
warnings: string[];
|
|
45
|
+
allValid: boolean;
|
|
46
|
+
fixedCount: number;
|
|
47
|
+
}
|
|
48
|
+
export declare class HookVerifierService {
|
|
49
|
+
private projectPath;
|
|
50
|
+
constructor(projectPath?: string);
|
|
51
|
+
/**
|
|
52
|
+
* Verify all hooks in the project
|
|
53
|
+
*/
|
|
54
|
+
verify(autoFix?: boolean): Promise<VerificationReport>;
|
|
55
|
+
/**
|
|
56
|
+
* Verify a single hook configuration
|
|
57
|
+
*/
|
|
58
|
+
private verifyHook;
|
|
59
|
+
/**
|
|
60
|
+
* Extract hook file path from command
|
|
61
|
+
*/
|
|
62
|
+
private extractHookPath;
|
|
63
|
+
/**
|
|
64
|
+
* Check if the file has a valid CLI entry point
|
|
65
|
+
*/
|
|
66
|
+
private hasValidEntryPoint;
|
|
67
|
+
/**
|
|
68
|
+
* Attempt to fix a hook issue
|
|
69
|
+
*/
|
|
70
|
+
private fixHook;
|
|
71
|
+
/**
|
|
72
|
+
* Fix missing entry point by adding CLI execution code
|
|
73
|
+
*/
|
|
74
|
+
private fixMissingEntryPoint;
|
|
75
|
+
/**
|
|
76
|
+
* Fix missing shebang in shell script
|
|
77
|
+
*/
|
|
78
|
+
private fixMissingShebang;
|
|
79
|
+
/**
|
|
80
|
+
* Generate hook template
|
|
81
|
+
*/
|
|
82
|
+
static generateHookTemplate(hookType: string, language?: 'ts' | 'js' | 'sh'): string;
|
|
83
|
+
/**
|
|
84
|
+
* Create a new hook file with proper structure
|
|
85
|
+
*/
|
|
86
|
+
createHook(hookType: string, fileName: string, language?: 'ts' | 'js' | 'sh'): Promise<string>;
|
|
87
|
+
/**
|
|
88
|
+
* Add hook to settings.json
|
|
89
|
+
*/
|
|
90
|
+
addHookToSettings(hookType: 'PreToolUse' | 'PostToolUse' | 'Notification' | 'Stop' | 'SubagentStop', command: string): Promise<void>;
|
|
91
|
+
}
|
|
92
|
+
export declare function formatVerificationReport(report: VerificationReport): string;
|
|
93
|
+
export declare function getHookVerifier(projectPath?: string): HookVerifierService;
|
|
94
|
+
export declare function resetHookVerifier(): void;
|
|
95
|
+
//# sourceMappingURL=HookVerifier.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HookVerifier.d.ts","sourceRoot":"","sources":["../../src/services/HookVerifier.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AASH,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,SAAS,CAAA;IACf,OAAO,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,WAAW,cAAc;IAC7B,KAAK,CAAC,EAAE;QACN,UAAU,CAAC,EAAE,UAAU,EAAE,CAAA;QACzB,WAAW,CAAC,EAAE,UAAU,EAAE,CAAA;QAC1B,YAAY,CAAC,EAAE,UAAU,EAAE,CAAA;QAC3B,IAAI,CAAC,EAAE,UAAU,EAAE,CAAA;QACnB,YAAY,CAAC,EAAE,UAAU,EAAE,CAAA;KAC5B,CAAA;IACD,WAAW,CAAC,EAAE;QACZ,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;QAChB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAA;KAChB,CAAA;CACF;AAED,MAAM,WAAW,sBAAsB;IACrC,QAAQ,EAAE,MAAM,CAAA;IAChB,QAAQ,EAAE,MAAM,CAAA;IAChB,M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