vibehub-cli 1.0.41 → 1.0.43
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/commands/add.d.ts.map +1 -1
- package/dist/commands/add.js +27 -0
- package/dist/commands/add.js.map +1 -1
- package/dist/commands/clone.d.ts +3 -0
- package/dist/commands/clone.d.ts.map +1 -0
- package/dist/commands/clone.js +219 -0
- package/dist/commands/clone.js.map +1 -0
- package/dist/commands/set.d.ts.map +1 -1
- package/dist/commands/set.js +15 -4
- package/dist/commands/set.js.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/adapters/gemini-adapter.d.ts +105 -0
- package/dist/lib/adapters/gemini-adapter.d.ts.map +1 -0
- package/dist/lib/adapters/gemini-adapter.js +295 -0
- package/dist/lib/adapters/gemini-adapter.js.map +1 -0
- package/dist/lib/adapters/index.d.ts +2 -0
- package/dist/lib/adapters/index.d.ts.map +1 -0
- package/dist/lib/adapters/index.js +2 -0
- package/dist/lib/adapters/index.js.map +1 -0
- package/dist/lib/cloud-service.d.ts +57 -0
- package/dist/lib/cloud-service.d.ts.map +1 -1
- package/dist/lib/cloud-service.js +83 -1
- package/dist/lib/cloud-service.js.map +1 -1
- package/dist/lib/csv-prompt-parser.js.map +1 -1
- package/dist/lib/vibehub-manager.d.ts +76 -5
- package/dist/lib/vibehub-manager.d.ts.map +1 -1
- package/dist/lib/vibehub-manager.js +347 -9
- package/dist/lib/vibehub-manager.js.map +1 -1
- package/package.json +1 -1
|
@@ -16,11 +16,27 @@ export interface VibeHubConfig {
|
|
|
16
16
|
workspaceTracking: boolean;
|
|
17
17
|
};
|
|
18
18
|
workspace?: {
|
|
19
|
-
cursorWorkspaceId
|
|
20
|
-
cursorWorkspacePath
|
|
21
|
-
isActive
|
|
22
|
-
createdAt
|
|
23
|
-
lastAccessed
|
|
19
|
+
cursorWorkspaceId?: string | null;
|
|
20
|
+
cursorWorkspacePath?: string | null;
|
|
21
|
+
isActive?: boolean;
|
|
22
|
+
createdAt?: string;
|
|
23
|
+
lastAccessed?: string;
|
|
24
|
+
editors?: {
|
|
25
|
+
cursor?: {
|
|
26
|
+
workspaceId: string;
|
|
27
|
+
workspacePath: string;
|
|
28
|
+
isActive: boolean;
|
|
29
|
+
createdAt: string;
|
|
30
|
+
lastAccessed: string;
|
|
31
|
+
};
|
|
32
|
+
antigravity?: {
|
|
33
|
+
projectHash: string;
|
|
34
|
+
isActive: boolean;
|
|
35
|
+
createdAt: string;
|
|
36
|
+
lastAccessed: string;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
activeEditors?: string[];
|
|
24
40
|
};
|
|
25
41
|
cloud?: {
|
|
26
42
|
projectUrl: string;
|
|
@@ -106,6 +122,34 @@ export declare class VibeHubManager {
|
|
|
106
122
|
* Detect and map Cursor workspace to this project
|
|
107
123
|
*/
|
|
108
124
|
private detectAndMapCursorWorkspace;
|
|
125
|
+
/**
|
|
126
|
+
* Detect and map Antigravity (Gemini) workspace to this project
|
|
127
|
+
*/
|
|
128
|
+
detectAndMapAntigravityWorkspace(): Promise<void>;
|
|
129
|
+
/**
|
|
130
|
+
* Update config with Antigravity workspace information
|
|
131
|
+
*/
|
|
132
|
+
private updateConfigWithAntigravityWorkspace;
|
|
133
|
+
/**
|
|
134
|
+
* Extract prompts from Antigravity workspace
|
|
135
|
+
*/
|
|
136
|
+
private extractAntigravityPrompts;
|
|
137
|
+
/**
|
|
138
|
+
* Store Antigravity prompts with editor tag
|
|
139
|
+
*/
|
|
140
|
+
private storeAntigravityPrompts;
|
|
141
|
+
/**
|
|
142
|
+
* Generate CSV for Antigravity prompts
|
|
143
|
+
*/
|
|
144
|
+
private generateAntigravityPromptsCsv;
|
|
145
|
+
/**
|
|
146
|
+
* Append Antigravity prompts to CSV
|
|
147
|
+
*/
|
|
148
|
+
private appendAntigravityPromptsToCsv;
|
|
149
|
+
/**
|
|
150
|
+
* Sync Antigravity workspace (similar to syncWorkspace for Cursor)
|
|
151
|
+
*/
|
|
152
|
+
syncAntigravityWorkspace(projectHash: string): Promise<void>;
|
|
109
153
|
/**
|
|
110
154
|
* Get Cursor workspace storage path based on OS
|
|
111
155
|
*/
|
|
@@ -182,5 +226,32 @@ export declare class VibeHubManager {
|
|
|
182
226
|
* Stop all file watchers
|
|
183
227
|
*/
|
|
184
228
|
stopAllWatching(): Promise<void>;
|
|
229
|
+
/**
|
|
230
|
+
* Initialize repository from a clone operation
|
|
231
|
+
*/
|
|
232
|
+
initFromClone(options: {
|
|
233
|
+
projectId: number;
|
|
234
|
+
projectName: string;
|
|
235
|
+
description?: string | null;
|
|
236
|
+
cloudUrl: string;
|
|
237
|
+
apiUrl: string;
|
|
238
|
+
accessType: 'owner' | 'public' | 'collaborator';
|
|
239
|
+
userEmail?: string;
|
|
240
|
+
}): Promise<void>;
|
|
241
|
+
/**
|
|
242
|
+
* Import commits from clone data
|
|
243
|
+
*/
|
|
244
|
+
importCommits(commits: Array<{
|
|
245
|
+
id: string;
|
|
246
|
+
message: string;
|
|
247
|
+
author: string;
|
|
248
|
+
timestamp: string;
|
|
249
|
+
changes?: Record<string, any>;
|
|
250
|
+
files?: string[];
|
|
251
|
+
}>): Promise<void>;
|
|
252
|
+
/**
|
|
253
|
+
* Get the repo path (for external use)
|
|
254
|
+
*/
|
|
255
|
+
getRepoPath(): string;
|
|
185
256
|
}
|
|
186
257
|
//# sourceMappingURL=vibehub-manager.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vibehub-manager.d.ts","sourceRoot":"","sources":["../../src/lib/vibehub-manager.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"vibehub-manager.d.ts","sourceRoot":"","sources":["../../src/lib/vibehub-manager.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,MAAM,GAAG,MAAM,CAAC;IAC3B,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,M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AE,MAAM,GAAG,IAAI,CAAC;QAC5B,QAAQ,EAAE,MAAM,CAAC;QACjB,MAAM,EAAE,MAAM,CAAC;QACf,UAAU,EAAE,OAAO,GAAG,QAAQ,GAAG,cAAc,CAAC;QAChD,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,GAAG,OAAO,CAAC,IAAI,CAAC;IAwCjB;;OAEG;IACG,aAAa,CAAC,OAAO,EAAE,KAAK,CAAC;QACjC,EAAE,EAAE,MAAM,CAAC;QACX,OAAO,EAAE,MAAM,CAAC;QAChB,MAAM,EAAE,MAAM,CAAC;QACf,SAAS,EAAE,MAAM,CAAC;QAClB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QAC9B,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;KAClB,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IA6BlB;;OAEG;IACH,WAAW,IAAI,MAAM;CAGtB"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import fs from 'fs-extra';
|
|
2
2
|
import path from 'path';
|
|
3
3
|
import crypto from 'crypto';
|
|
4
|
+
import { GeminiAdapter } from './adapters/gemini-adapter.js';
|
|
4
5
|
export class VibeHubManager {
|
|
5
6
|
constructor(repoPath) {
|
|
6
7
|
this.fileWatchers = new Map();
|
|
@@ -55,6 +56,8 @@ export class VibeHubManager {
|
|
|
55
56
|
await fs.writeJson(this.configPath, vibehubConfig, { spaces: 2 });
|
|
56
57
|
// Try to detect and map Cursor workspace
|
|
57
58
|
await this.detectAndMapCursorWorkspace();
|
|
59
|
+
// Try to detect and map Antigravity workspace
|
|
60
|
+
await this.detectAndMapAntigravityWorkspace();
|
|
58
61
|
// Create initial commit
|
|
59
62
|
await this.createInitialCommit(config.author);
|
|
60
63
|
}
|
|
@@ -263,6 +266,265 @@ export class VibeHubManager {
|
|
|
263
266
|
console.log('⚠️ Could not detect Cursor workspace:', error.message);
|
|
264
267
|
}
|
|
265
268
|
}
|
|
269
|
+
/**
|
|
270
|
+
* Detect and map Antigravity (Gemini) workspace to this project
|
|
271
|
+
*/
|
|
272
|
+
async detectAndMapAntigravityWorkspace() {
|
|
273
|
+
try {
|
|
274
|
+
const geminiAdapter = new GeminiAdapter();
|
|
275
|
+
if (!await geminiAdapter.isInstalled()) {
|
|
276
|
+
return; // Silently skip if not installed
|
|
277
|
+
}
|
|
278
|
+
// Check if already configured
|
|
279
|
+
const config = await this.getConfig();
|
|
280
|
+
if (config.workspace?.editors?.antigravity?.projectHash) {
|
|
281
|
+
return; // Already configured
|
|
282
|
+
}
|
|
283
|
+
// First check available projects
|
|
284
|
+
const availableProjects = await geminiAdapter.listAvailableProjects();
|
|
285
|
+
if (availableProjects.length === 0) {
|
|
286
|
+
console.log('ℹ️ No Antigravity chat data found. Run "gemini" in your project first.');
|
|
287
|
+
return;
|
|
288
|
+
}
|
|
289
|
+
const workspace = await geminiAdapter.findWorkspaceForProject(this.repoPath);
|
|
290
|
+
if (!workspace) {
|
|
291
|
+
// Show available projects to help user
|
|
292
|
+
console.log('⚠️ Could not auto-detect Antigravity workspace for this project.');
|
|
293
|
+
console.log(' Available Antigravity projects:');
|
|
294
|
+
for (const project of availableProjects) {
|
|
295
|
+
console.log(` - Hash: ${project.projectHash.substring(0, 12)}... (${project.promptCount} prompts)`);
|
|
296
|
+
if (project.samplePrompt) {
|
|
297
|
+
console.log(` Sample: "${project.samplePrompt}"`);
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
console.log(' Tip: Run "gemini" CLI in this project folder to create chat data.');
|
|
301
|
+
return;
|
|
302
|
+
}
|
|
303
|
+
await this.updateConfigWithAntigravityWorkspace(workspace.projectHash, workspace);
|
|
304
|
+
console.log(`✅ Mapped Antigravity workspace: ${workspace.projectHash.substring(0, 8)}...`);
|
|
305
|
+
// Extract initial prompts
|
|
306
|
+
await this.extractAntigravityPrompts(workspace.projectHash);
|
|
307
|
+
}
|
|
308
|
+
catch (error) {
|
|
309
|
+
console.log('⚠️ Could not detect Antigravity workspace:', error.message);
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
/**
|
|
313
|
+
* Update config with Antigravity workspace information
|
|
314
|
+
*/
|
|
315
|
+
async updateConfigWithAntigravityWorkspace(projectHash, workspace) {
|
|
316
|
+
const config = await this.getConfig();
|
|
317
|
+
// Initialize workspace and editors objects if needed
|
|
318
|
+
if (!config.workspace) {
|
|
319
|
+
config.workspace = {};
|
|
320
|
+
}
|
|
321
|
+
if (!config.workspace.editors) {
|
|
322
|
+
config.workspace.editors = {};
|
|
323
|
+
}
|
|
324
|
+
// Migrate existing Cursor data to new structure if needed
|
|
325
|
+
if (config.workspace.cursorWorkspaceId && !config.workspace.editors.cursor) {
|
|
326
|
+
config.workspace.editors.cursor = {
|
|
327
|
+
workspaceId: config.workspace.cursorWorkspaceId,
|
|
328
|
+
workspacePath: config.workspace.cursorWorkspacePath || '',
|
|
329
|
+
isActive: config.workspace.isActive ?? true,
|
|
330
|
+
createdAt: config.workspace.createdAt || new Date().toISOString(),
|
|
331
|
+
lastAccessed: config.workspace.lastAccessed || new Date().toISOString()
|
|
332
|
+
};
|
|
333
|
+
}
|
|
334
|
+
// Add Antigravity workspace
|
|
335
|
+
config.workspace.editors.antigravity = {
|
|
336
|
+
projectHash: projectHash,
|
|
337
|
+
isActive: true,
|
|
338
|
+
createdAt: new Date().toISOString(),
|
|
339
|
+
lastAccessed: new Date().toISOString()
|
|
340
|
+
};
|
|
341
|
+
// Update activeEditors array
|
|
342
|
+
if (!config.workspace.activeEditors) {
|
|
343
|
+
config.workspace.activeEditors = [];
|
|
344
|
+
}
|
|
345
|
+
if (!config.workspace.activeEditors.includes('antigravity')) {
|
|
346
|
+
config.workspace.activeEditors.push('antigravity');
|
|
347
|
+
}
|
|
348
|
+
if (config.workspace.cursorWorkspaceId &&
|
|
349
|
+
!config.workspace.activeEditors.includes('cursor')) {
|
|
350
|
+
config.workspace.activeEditors.push('cursor');
|
|
351
|
+
}
|
|
352
|
+
await this.updateConfig(config);
|
|
353
|
+
}
|
|
354
|
+
/**
|
|
355
|
+
* Extract prompts from Antigravity workspace
|
|
356
|
+
*/
|
|
357
|
+
async extractAntigravityPrompts(projectHash) {
|
|
358
|
+
try {
|
|
359
|
+
console.log('📝 Extracting prompts from Antigravity...');
|
|
360
|
+
const geminiAdapter = new GeminiAdapter();
|
|
361
|
+
const prompts = await geminiAdapter.extractPrompts(projectHash);
|
|
362
|
+
if (prompts.length === 0) {
|
|
363
|
+
console.log('ℹ️ No prompts found in Antigravity workspace');
|
|
364
|
+
return;
|
|
365
|
+
}
|
|
366
|
+
// Store prompts with editor tag
|
|
367
|
+
await this.storeAntigravityPrompts(projectHash, prompts);
|
|
368
|
+
// Generate CSV
|
|
369
|
+
await this.generateAntigravityPromptsCsv(projectHash, prompts);
|
|
370
|
+
console.log(`✅ Extracted ${prompts.length} prompts from Antigravity`);
|
|
371
|
+
}
|
|
372
|
+
catch (error) {
|
|
373
|
+
console.log('⚠️ Could not extract Antigravity prompts:', error.message);
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
/**
|
|
377
|
+
* Store Antigravity prompts with editor tag
|
|
378
|
+
*/
|
|
379
|
+
async storeAntigravityPrompts(projectHash, prompts) {
|
|
380
|
+
const sessionsDir = path.join(this.repoPath, '.vibehub', 'sessions');
|
|
381
|
+
await fs.ensureDir(sessionsDir);
|
|
382
|
+
const promptsFile = path.join(sessionsDir, 'prompts.json');
|
|
383
|
+
// Load existing prompts
|
|
384
|
+
let promptsData;
|
|
385
|
+
try {
|
|
386
|
+
promptsData = await fs.readJson(promptsFile);
|
|
387
|
+
}
|
|
388
|
+
catch {
|
|
389
|
+
promptsData = {
|
|
390
|
+
version: "1.0",
|
|
391
|
+
created_at: new Date().toISOString(),
|
|
392
|
+
last_updated: new Date().toISOString(),
|
|
393
|
+
total_prompts: 0,
|
|
394
|
+
prompts: []
|
|
395
|
+
};
|
|
396
|
+
}
|
|
397
|
+
let nextId = promptsData.prompts.length + 1;
|
|
398
|
+
// Add ALL Antigravity prompts (no deduplication)
|
|
399
|
+
for (const prompt of prompts) {
|
|
400
|
+
promptsData.prompts.push({
|
|
401
|
+
id: nextId++,
|
|
402
|
+
text: prompt.text,
|
|
403
|
+
timestamp: prompt.timestamp,
|
|
404
|
+
timestamp_iso: prompt.timestampIso,
|
|
405
|
+
editor: 'antigravity',
|
|
406
|
+
source: 'antigravity',
|
|
407
|
+
session_id: prompt.sessionId,
|
|
408
|
+
metadata: {
|
|
409
|
+
model: prompt.model,
|
|
410
|
+
projectHash: projectHash
|
|
411
|
+
}
|
|
412
|
+
});
|
|
413
|
+
}
|
|
414
|
+
// Sort by timestamp
|
|
415
|
+
promptsData.prompts.sort((a, b) => a.timestamp - b.timestamp);
|
|
416
|
+
promptsData.total_prompts = promptsData.prompts.length;
|
|
417
|
+
promptsData.last_updated = new Date().toISOString();
|
|
418
|
+
await fs.writeJson(promptsFile, promptsData, { spaces: 2 });
|
|
419
|
+
}
|
|
420
|
+
/**
|
|
421
|
+
* Generate CSV for Antigravity prompts
|
|
422
|
+
*/
|
|
423
|
+
async generateAntigravityPromptsCsv(projectHash, prompts) {
|
|
424
|
+
try {
|
|
425
|
+
const exportsDir = path.join(this.repoPath, '.vibehub', 'workspace', 'exports', `antigravity-${projectHash.substring(0, 8)}`);
|
|
426
|
+
await fs.ensureDir(exportsDir);
|
|
427
|
+
const csvRows = ['prompt_id,timestamp,prompt_text,editor,session_id'];
|
|
428
|
+
let promptId = 1;
|
|
429
|
+
for (const prompt of prompts) {
|
|
430
|
+
const timestamp = new Date(prompt.timestamp).toISOString();
|
|
431
|
+
const promptText = prompt.text.replace(/"/g, '""').replace(/\n/g, ' ');
|
|
432
|
+
const sessionId = prompt.sessionId || '';
|
|
433
|
+
csvRows.push(`"${promptId++}","${timestamp}","${promptText}","antigravity","${sessionId}"`);
|
|
434
|
+
}
|
|
435
|
+
const csvContent = csvRows.join('\n');
|
|
436
|
+
const csvFile = path.join(exportsDir, 'prompts_with_timestamps.csv');
|
|
437
|
+
await fs.writeFile(csvFile, csvContent);
|
|
438
|
+
console.log(`📊 Generated Antigravity CSV with ${prompts.length} prompts`);
|
|
439
|
+
}
|
|
440
|
+
catch (error) {
|
|
441
|
+
console.log('⚠️ Could not generate Antigravity CSV:', error.message);
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
/**
|
|
445
|
+
* Append Antigravity prompts to CSV
|
|
446
|
+
*/
|
|
447
|
+
async appendAntigravityPromptsToCsv(projectHash, newPrompts, startId) {
|
|
448
|
+
try {
|
|
449
|
+
const exportsDir = path.join(this.repoPath, '.vibehub', 'workspace', 'exports', `antigravity-${projectHash.substring(0, 8)}`);
|
|
450
|
+
await fs.ensureDir(exportsDir);
|
|
451
|
+
const csvFile = path.join(exportsDir, 'prompts_with_timestamps.csv');
|
|
452
|
+
const csvExists = await fs.pathExists(csvFile);
|
|
453
|
+
if (!csvExists) {
|
|
454
|
+
// Create new CSV with header
|
|
455
|
+
const csvRows = ['prompt_id,timestamp,prompt_text,editor,session_id'];
|
|
456
|
+
let promptId = startId;
|
|
457
|
+
for (const prompt of newPrompts) {
|
|
458
|
+
const timestamp = new Date(prompt.timestamp).toISOString();
|
|
459
|
+
const promptText = prompt.text.replace(/"/g, '""').replace(/\n/g, ' ');
|
|
460
|
+
const sessionId = prompt.sessionId || '';
|
|
461
|
+
csvRows.push(`"${promptId++}","${timestamp}","${promptText}","antigravity","${sessionId}"`);
|
|
462
|
+
}
|
|
463
|
+
await fs.writeFile(csvFile, csvRows.join('\n'));
|
|
464
|
+
}
|
|
465
|
+
else {
|
|
466
|
+
// Append to existing CSV
|
|
467
|
+
const csvRows = [];
|
|
468
|
+
let promptId = startId;
|
|
469
|
+
for (const prompt of newPrompts) {
|
|
470
|
+
const timestamp = new Date(prompt.timestamp).toISOString();
|
|
471
|
+
const promptText = prompt.text.replace(/"/g, '""').replace(/\n/g, ' ');
|
|
472
|
+
const sessionId = prompt.sessionId || '';
|
|
473
|
+
csvRows.push(`"${promptId++}","${timestamp}","${promptText}","antigravity","${sessionId}"`);
|
|
474
|
+
}
|
|
475
|
+
const csvContent = csvRows.join('\n');
|
|
476
|
+
await fs.appendFile(csvFile, '\n' + csvContent);
|
|
477
|
+
}
|
|
478
|
+
console.log(`📝 Appended ${newPrompts.length} Antigravity prompts to CSV`);
|
|
479
|
+
}
|
|
480
|
+
catch (error) {
|
|
481
|
+
console.log('⚠️ Could not append Antigravity prompts to CSV:', error.message);
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
/**
|
|
485
|
+
* Sync Antigravity workspace (similar to syncWorkspace for Cursor)
|
|
486
|
+
*/
|
|
487
|
+
async syncAntigravityWorkspace(projectHash) {
|
|
488
|
+
try {
|
|
489
|
+
console.log('🔄 Syncing Antigravity workspace...');
|
|
490
|
+
const geminiAdapter = new GeminiAdapter();
|
|
491
|
+
const allPrompts = await geminiAdapter.extractPrompts(projectHash);
|
|
492
|
+
// Load existing prompts to find new ones
|
|
493
|
+
const sessionsDir = path.join(this.repoPath, '.vibehub', 'sessions');
|
|
494
|
+
const promptsFile = path.join(sessionsDir, 'prompts.json');
|
|
495
|
+
let existingPromptsData;
|
|
496
|
+
try {
|
|
497
|
+
existingPromptsData = await fs.readJson(promptsFile);
|
|
498
|
+
}
|
|
499
|
+
catch {
|
|
500
|
+
existingPromptsData = { prompts: [] };
|
|
501
|
+
}
|
|
502
|
+
// Get existing Antigravity prompt IDs (by session_id + text to identify unique prompts)
|
|
503
|
+
const existingAntigravityKeys = new Set(existingPromptsData.prompts
|
|
504
|
+
.filter((p) => p.editor === 'antigravity')
|
|
505
|
+
.map((p) => `${p.session_id}:${p.text}`));
|
|
506
|
+
// Find new prompts
|
|
507
|
+
const newPrompts = allPrompts.filter(p => !existingAntigravityKeys.has(`${p.sessionId}:${p.text}`));
|
|
508
|
+
if (newPrompts.length > 0) {
|
|
509
|
+
const startId = existingPromptsData.prompts.length + 1;
|
|
510
|
+
await this.storeAntigravityPrompts(projectHash, newPrompts);
|
|
511
|
+
await this.appendAntigravityPromptsToCsv(projectHash, newPrompts, startId);
|
|
512
|
+
console.log(`✅ Found ${newPrompts.length} new prompts from Antigravity`);
|
|
513
|
+
}
|
|
514
|
+
else {
|
|
515
|
+
console.log(`📊 No new Antigravity prompts found (${allPrompts.length} total)`);
|
|
516
|
+
}
|
|
517
|
+
// Update last accessed time
|
|
518
|
+
const config = await this.getConfig();
|
|
519
|
+
if (config.workspace?.editors?.antigravity) {
|
|
520
|
+
config.workspace.editors.antigravity.lastAccessed = new Date().toISOString();
|
|
521
|
+
await this.updateConfig(config);
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
catch (error) {
|
|
525
|
+
console.log('⚠️ Antigravity sync failed:', error.message);
|
|
526
|
+
}
|
|
527
|
+
}
|
|
266
528
|
/**
|
|
267
529
|
* Get Cursor workspace storage path based on OS
|
|
268
530
|
*/
|
|
@@ -407,7 +669,8 @@ export class VibeHubManager {
|
|
|
407
669
|
text: prompt.text,
|
|
408
670
|
timestamp: prompt.unixMs || Date.now(),
|
|
409
671
|
timestamp_iso: new Date(prompt.unixMs || Date.now()).toISOString(),
|
|
410
|
-
|
|
672
|
+
editor: 'cursor', // Editor tag for multi-editor support
|
|
673
|
+
source: 'cursor',
|
|
411
674
|
workspace_id: workspaceId,
|
|
412
675
|
metadata: {
|
|
413
676
|
commandType: prompt.commandType,
|
|
@@ -449,12 +712,13 @@ export class VibeHubManager {
|
|
|
449
712
|
// Load prompts
|
|
450
713
|
const promptsData = await fs.readJson(promptsFile);
|
|
451
714
|
const workspacePrompts = promptsData.prompts.filter((p) => p.workspace_id === workspaceId);
|
|
452
|
-
// Create CSV content with prompt ID
|
|
453
|
-
const csvRows = ['prompt_id,timestamp,prompt_text,workspace_id'];
|
|
715
|
+
// Create CSV content with prompt ID and editor column
|
|
716
|
+
const csvRows = ['prompt_id,timestamp,prompt_text,editor,workspace_id'];
|
|
454
717
|
for (const prompt of workspacePrompts) {
|
|
455
718
|
const timestamp = new Date(prompt.timestamp).toISOString();
|
|
456
719
|
const promptText = prompt.text.replace(/"/g, '""').replace(/\n/g, ' ');
|
|
457
|
-
|
|
720
|
+
const editor = prompt.editor || prompt.source || 'cursor'; // Fallback for old prompts
|
|
721
|
+
csvRows.push(`"${prompt.id}","${timestamp}","${promptText}","${editor}","${workspaceId}"`);
|
|
458
722
|
}
|
|
459
723
|
const csvContent = csvRows.join('\n');
|
|
460
724
|
const csvFile = path.join(exportsDir, 'prompts_with_timestamps.csv');
|
|
@@ -476,12 +740,13 @@ export class VibeHubManager {
|
|
|
476
740
|
// Check if CSV file exists
|
|
477
741
|
const csvExists = await fs.pathExists(csvFile);
|
|
478
742
|
if (!csvExists) {
|
|
479
|
-
// If CSV doesn't exist, create it with header
|
|
480
|
-
const csvRows = ['prompt_id,timestamp,prompt_text,workspace_id'];
|
|
743
|
+
// If CSV doesn't exist, create it with header (includes editor column)
|
|
744
|
+
const csvRows = ['prompt_id,timestamp,prompt_text,editor,workspace_id'];
|
|
481
745
|
for (const prompt of newPrompts) {
|
|
482
746
|
const timestamp = new Date(prompt.timestamp).toISOString();
|
|
483
747
|
const promptText = prompt.text.replace(/"/g, '""').replace(/\n/g, ' ');
|
|
484
|
-
|
|
748
|
+
const editor = prompt.editor || 'cursor';
|
|
749
|
+
csvRows.push(`"${prompt.id}","${timestamp}","${promptText}","${editor}","${workspaceId}"`);
|
|
485
750
|
}
|
|
486
751
|
const csvContent = csvRows.join('\n');
|
|
487
752
|
await fs.writeFile(csvFile, csvContent);
|
|
@@ -498,7 +763,8 @@ export class VibeHubManager {
|
|
|
498
763
|
for (const prompt of newPrompts) {
|
|
499
764
|
const timestamp = new Date(prompt.timestamp).toISOString();
|
|
500
765
|
const promptText = prompt.text.replace(/"/g, '""').replace(/\n/g, ' ');
|
|
501
|
-
|
|
766
|
+
const editor = prompt.editor || 'cursor';
|
|
767
|
+
csvRows.push(`"${prompt.id}","${timestamp}","${promptText}","${editor}","${workspaceId}"`);
|
|
502
768
|
}
|
|
503
769
|
const csvContent = csvRows.join('\n');
|
|
504
770
|
// Read existing content to verify append
|
|
@@ -833,7 +1099,8 @@ logToFile('👁️ Background watcher started').catch(console.error);
|
|
|
833
1099
|
text: prompt.text,
|
|
834
1100
|
timestamp: prompt.unixMs || Date.now(),
|
|
835
1101
|
timestamp_iso: new Date(prompt.unixMs || Date.now()).toISOString(),
|
|
836
|
-
|
|
1102
|
+
editor: 'cursor', // Editor tag for multi-editor support
|
|
1103
|
+
source: 'cursor',
|
|
837
1104
|
workspace_id: workspaceId,
|
|
838
1105
|
metadata: {
|
|
839
1106
|
commandType: prompt.commandType,
|
|
@@ -971,5 +1238,76 @@ logToFile('👁️ Background watcher started').catch(console.error);
|
|
|
971
1238
|
console.log('⚠️ Could not stop background watcher:', error.message);
|
|
972
1239
|
}
|
|
973
1240
|
}
|
|
1241
|
+
/**
|
|
1242
|
+
* Initialize repository from a clone operation
|
|
1243
|
+
*/
|
|
1244
|
+
async initFromClone(options) {
|
|
1245
|
+
const vibehubDir = path.join(this.repoPath, '.vibehub');
|
|
1246
|
+
// Create .vibehub directory structure
|
|
1247
|
+
await fs.ensureDir(vibehubDir);
|
|
1248
|
+
await fs.ensureDir(path.join(vibehubDir, 'workspace'));
|
|
1249
|
+
await fs.ensureDir(path.join(vibehubDir, 'sessions'));
|
|
1250
|
+
await fs.ensureDir(path.join(vibehubDir, 'config'));
|
|
1251
|
+
await fs.ensureDir(path.join(vibehubDir, 'exports'));
|
|
1252
|
+
await fs.ensureDir(this.commitsPath);
|
|
1253
|
+
// Create vibehub.json configuration
|
|
1254
|
+
const vibehubConfig = {
|
|
1255
|
+
projectId: options.projectId,
|
|
1256
|
+
projectName: options.projectName,
|
|
1257
|
+
description: options.description || '',
|
|
1258
|
+
localPath: this.repoPath,
|
|
1259
|
+
createdAt: new Date().toISOString(),
|
|
1260
|
+
lastUpdated: new Date().toISOString(),
|
|
1261
|
+
version: '1.0.0',
|
|
1262
|
+
author: {
|
|
1263
|
+
name: options.userEmail?.split('@')[0] || 'cloned',
|
|
1264
|
+
email: options.userEmail || ''
|
|
1265
|
+
},
|
|
1266
|
+
config: {
|
|
1267
|
+
autoSync: true,
|
|
1268
|
+
capturePrompts: true,
|
|
1269
|
+
workspaceTracking: true
|
|
1270
|
+
},
|
|
1271
|
+
cloud: {
|
|
1272
|
+
projectUrl: options.cloudUrl,
|
|
1273
|
+
apiUrl: options.apiUrl,
|
|
1274
|
+
userEmail: options.userEmail || ''
|
|
1275
|
+
},
|
|
1276
|
+
lastSync: new Date().toISOString()
|
|
1277
|
+
};
|
|
1278
|
+
await fs.writeJson(this.configPath, vibehubConfig, { spaces: 2 });
|
|
1279
|
+
}
|
|
1280
|
+
/**
|
|
1281
|
+
* Import commits from clone data
|
|
1282
|
+
*/
|
|
1283
|
+
async importCommits(commits) {
|
|
1284
|
+
// Sort commits by timestamp (oldest first) to maintain order
|
|
1285
|
+
const sortedCommits = [...commits].sort((a, b) => new Date(a.timestamp).getTime() - new Date(b.timestamp).getTime());
|
|
1286
|
+
for (const commit of sortedCommits) {
|
|
1287
|
+
const commitFile = path.join(this.commitsPath, `${commit.id}.json`);
|
|
1288
|
+
// Only import if not already exists
|
|
1289
|
+
if (!await fs.pathExists(commitFile)) {
|
|
1290
|
+
const fullCommit = {
|
|
1291
|
+
id: commit.id,
|
|
1292
|
+
timestamp: commit.timestamp,
|
|
1293
|
+
message: commit.message,
|
|
1294
|
+
author: commit.author,
|
|
1295
|
+
files: commit.files || [],
|
|
1296
|
+
changes: commit.changes || {},
|
|
1297
|
+
metadata: {
|
|
1298
|
+
importedFromCloud: true,
|
|
1299
|
+
importedAt: new Date().toISOString()
|
|
1300
|
+
}
|
|
1301
|
+
};
|
|
1302
|
+
await fs.writeJson(commitFile, fullCommit, { spaces: 2 });
|
|
1303
|
+
}
|
|
1304
|
+
}
|
|
1305
|
+
}
|
|
1306
|
+
/**
|
|
1307
|
+
* Get the repo path (for external use)
|
|
1308
|
+
*/
|
|
1309
|
+
getRepoPath() {
|
|
1310
|
+
return this.repoPath;
|
|
1311
|
+
}
|
|
974
1312
|
}
|
|
975
1313
|
//# sourceMappingURL=vibehub-manager.js.map
|