@neurcode-ai/cli 0.4.0 → 0.6.0

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.
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Watch command - Start the Neurcode Watch service
3
+ *
4
+ * Starts a background service that watches for file changes and records
5
+ * them to support the "Time Machine" feature.
6
+ */
7
+ export declare function watchCommand(): Promise<void>;
8
+ //# sourceMappingURL=watch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"watch.d.ts","sourceRoot":"","sources":["../../src/commands/watch.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,wBAAsB,YAAY,kBA6CjC"}
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.watchCommand = watchCommand;
4
+ const Sentinel_1 = require("../services/watch/Sentinel");
5
+ /**
6
+ * Watch command - Start the Neurcode Watch service
7
+ *
8
+ * Starts a background service that watches for file changes and records
9
+ * them to support the "Time Machine" feature.
10
+ */
11
+ async function watchCommand() {
12
+ try {
13
+ // Get project root (current working directory)
14
+ const projectRoot = process.cwd();
15
+ // Create and initialize Sentinel
16
+ const sentinel = new Sentinel_1.Sentinel(projectRoot);
17
+ await sentinel.initialize();
18
+ // Start watching
19
+ await sentinel.start();
20
+ console.log('✅ Neurcode Watch is running...');
21
+ // Check if cloud sync is configured
22
+ const syncer = sentinel.getSyncer();
23
+ if (syncer.isConfigured()) {
24
+ console.log('☁️ Cloud sync: ENABLED (events will be synced to dashboard.neurcode.com)');
25
+ }
26
+ else {
27
+ console.log('📦 Cloud sync: DISABLED (local-only mode)');
28
+ console.log(' Run "neurcode config --key <your_api_key>" to enable cloud sync');
29
+ }
30
+ console.log(' Press Ctrl+C to stop\n');
31
+ // Handle graceful shutdown
32
+ const shutdown = async () => {
33
+ console.log('\n🛑 Shutting down...');
34
+ await sentinel.stop();
35
+ process.exit(0);
36
+ };
37
+ process.on('SIGINT', shutdown);
38
+ process.on('SIGTERM', shutdown);
39
+ // Keep the process alive
40
+ // The watcher will keep the event loop alive
41
+ }
42
+ catch (error) {
43
+ if (error instanceof Error) {
44
+ console.error('❌ Error starting watch service:', error.message);
45
+ }
46
+ else {
47
+ console.error('❌ Unknown error:', error);
48
+ }
49
+ process.exit(1);
50
+ }
51
+ }
52
+ //# sourceMappingURL=watch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"watch.js","sourceRoot":"","sources":["../../src/commands/watch.ts"],"names":[],"mappings":";;AAQA,oCA6CC;AArDD,yDAAsD;AAEtD;;;;;GAKG;AACI,KAAK,UAAU,YAAY;IAChC,IAAI,CAAC;QACH,+CAA+C;QAC/C,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;QAElC,iCAAiC;QACjC,MAAM,QAAQ,GAAG,IAAI,mBAAQ,CAAC,WAAW,CAAC,CAAC;QAC3C,MAAM,QAAQ,CAAC,UAAU,EAAE,CAAC;QAE5B,iBAAiB;QACjB,MAAM,QAAQ,CAAC,KAAK,EAAE,CAAC;QAEvB,OAAO,CAAC,GAAG,CAAC,gCAAgC,CAAC,CAAC;QAE9C,oCAAoC;QACpC,MAAM,MAAM,GAAG,QAAQ,CAAC,SAAS,EAAE,CAAC;QACpC,IAAI,MAAM,CAAC,YAAY,EAAE,EAAE,CAAC;YAC1B,OAAO,CAAC,GAAG,CAAC,2EAA2E,CAAC,CAAC;QAC3F,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,GAAG,CAAC,2CAA2C,CAAC,CAAC;YACzD,OAAO,CAAC,GAAG,CAAC,oEAAoE,CAAC,CAAC;QACpF,CAAC;QAED,OAAO,CAAC,GAAG,CAAC,2BAA2B,CAAC,CAAC;QAEzC,2BAA2B;QAC3B,MAAM,QAAQ,GAAG,KAAK,IAAI,EAAE;YAC1B,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC;YACrC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;YACtB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC,CAAC;QAEF,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;QAC/B,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;QAEhC,yBAAyB;QACzB,6CAA6C;IAC/C,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;YAC3B,OAAO,CAAC,KAAK,CAAC,iCAAiC,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;QAClE,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,KAAK,CAAC,kBAAkB,EAAE,KAAK,CAAC,CAAC;QAC3C,CAAC;QACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC"}
package/dist/index.js CHANGED
@@ -14,6 +14,7 @@ const verify_1 = require("./commands/verify");
14
14
  const config_1 = require("./commands/config");
15
15
  const map_1 = require("./commands/map");
16
16
  const allow_1 = require("./commands/allow");
17
+ const watch_1 = require("./commands/watch");
17
18
  // Read version from package.json
18
19
  let version = '0.1.2'; // fallback
19
20
  try {
@@ -93,6 +94,12 @@ program
93
94
  .action((filePath) => {
94
95
  (0, allow_1.allowCommand)(filePath);
95
96
  });
97
+ program
98
+ .command('watch')
99
+ .description('Start Neurcode Watch - A local background service that records file changes for Time Machine feature')
100
+ .action(() => {
101
+ (0, watch_1.watchCommand)();
102
+ });
96
103
  program
97
104
  .command('verify')
98
105
  .description('Verify plan adherence - Compare current changes against an Architect Plan')
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAEA,yCAAoC;AACpC,2BAAkC;AAClC,+BAA4B;AAC5B,4CAAgD;AAChD,8CAAuE;AACvE,kDAAsD;AACtD,kDAAsD;AACtD,0CAA8C;AAC9C,4C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;KACnC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEL,SAAS;KACN,QAAQ,CAAC,YAAY,EAAE,4BAA4B,CAAC;KACpD,MAAM,CAAC,wBAAwB,EAAE,wCAAwC,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,QAAQ,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;KACtG,MAAM,CAAC,mBAAmB,EAAE,YAAY,CAAC;KACzC,MAAM,CAAC,mBAAmB,EAAE,mBAAmB,CAAC;KAChD,MAAM,CAAC,WAAW,EAAE,oDAAoD,CAAC;KACzE,MAAM,CAAC,UAAU,EAAE,sDAAsD,CAAC;KAC1E,MAAM,CAAC,SAAS,EAAE,0BAA0B,CAAC;KAC7C,MAAM,CAAC,CAAC,QAAQ,EAAE,OAAO,EAAE,EAAE;IAC5B,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC;QACvB,OAAO,CAAC,KAAK,CAAC,mCAAmC,CAAC,CAAC;QACnD,OAAO,CAAC,GAAG,CAAC,qEAAqE,CAAC,CAAC;QACnF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IACD,IAAA,sBAAa,EAAC,QAAQ,EAAE;QACtB,SAAS,EAAE,OAAO,CAAC,SAAS;QAC5B,SAAS,EAAE,OAAO,CAAC,SAAS;QAC5B,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,MAAM,EAAE,OAAO,CAAC,MAAM,IAAI,KAAK;QAC/B,MAAM,EAAE,OAAO,CAAC,MAAM,IAAI,KAAK;QAC/B,KAAK,EAAE,OAAO,CAAC,KAAK,IAAI,KAAK;KAC9B,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEL,OAAO,CAAC,KAAK,EAAE,CAAC"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * BlobStore - Content-Addressable Storage for file content
3
+ *
4
+ * Stores compressed file content in .neurcode/blobs/ directory.
5
+ * Filename is the SHA-256 hash of the content.
6
+ */
7
+ export declare class BlobStore {
8
+ private readonly blobsDir;
9
+ constructor(projectRoot: string);
10
+ /**
11
+ * Initialize the blob store directory
12
+ */
13
+ initialize(): Promise<void>;
14
+ /**
15
+ * Store content and return its hash
16
+ * @param content - The file content to store
17
+ * @returns The SHA-256 hash of the content
18
+ */
19
+ store(content: string): Promise<string>;
20
+ /**
21
+ * Check if a blob exists by hash
22
+ * @param hash - The SHA-256 hash
23
+ * @returns True if the blob exists
24
+ */
25
+ exists(hash: string): Promise<boolean>;
26
+ /**
27
+ * Get the path to a blob by hash
28
+ * @param hash - The SHA-256 hash
29
+ * @returns The full path to the blob file
30
+ */
31
+ getBlobPath(hash: string): string;
32
+ }
33
+ //# sourceMappingURL=BlobStore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BlobStore.d.ts","sourceRoot":"","sources":["../../../src/services/watch/BlobStore.ts"],"names":[],"mappings":"AAMA;;;;;GAKG;AACH,qBAAa,SAAS;IACpB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;gBAEtB,WAAW,EAAE,MAAM;IAI/B;;OAEG;IACG,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAIjC;;;;OAIG;IACG,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAuB7C;;;;OAIG;IACG,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAU5C;;;;OAIG;IACH,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;CAGlC"}
@@ -0,0 +1,108 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.BlobStore = void 0;
37
+ const crypto_1 = require("crypto");
38
+ const zlib_1 = require("zlib");
39
+ const fs_1 = require("fs");
40
+ const path = __importStar(require("path"));
41
+ const fsExtra = __importStar(require("fs-extra"));
42
+ /**
43
+ * BlobStore - Content-Addressable Storage for file content
44
+ *
45
+ * Stores compressed file content in .neurcode/blobs/ directory.
46
+ * Filename is the SHA-256 hash of the content.
47
+ */
48
+ class BlobStore {
49
+ blobsDir;
50
+ constructor(projectRoot) {
51
+ this.blobsDir = path.join(projectRoot, '.neurcode', 'blobs');
52
+ }
53
+ /**
54
+ * Initialize the blob store directory
55
+ */
56
+ async initialize() {
57
+ await fsExtra.ensureDir(this.blobsDir);
58
+ }
59
+ /**
60
+ * Store content and return its hash
61
+ * @param content - The file content to store
62
+ * @returns The SHA-256 hash of the content
63
+ */
64
+ async store(content) {
65
+ // Compute SHA-256 hash
66
+ const hash = (0, crypto_1.createHash)('sha256').update(content, 'utf8').digest('hex');
67
+ const blobPath = path.join(this.blobsDir, hash);
68
+ // Check if blob already exists
69
+ try {
70
+ await fs_1.promises.access(blobPath);
71
+ // Blob already exists, return hash
72
+ return hash;
73
+ }
74
+ catch {
75
+ // Blob doesn't exist, create it
76
+ }
77
+ // Compress content with GZIP
78
+ const compressed = (0, zlib_1.gzipSync)(Buffer.from(content, 'utf8'));
79
+ // Write compressed content to disk
80
+ await fs_1.promises.writeFile(blobPath, compressed);
81
+ return hash;
82
+ }
83
+ /**
84
+ * Check if a blob exists by hash
85
+ * @param hash - The SHA-256 hash
86
+ * @returns True if the blob exists
87
+ */
88
+ async exists(hash) {
89
+ const blobPath = path.join(this.blobsDir, hash);
90
+ try {
91
+ await fs_1.promises.access(blobPath);
92
+ return true;
93
+ }
94
+ catch {
95
+ return false;
96
+ }
97
+ }
98
+ /**
99
+ * Get the path to a blob by hash
100
+ * @param hash - The SHA-256 hash
101
+ * @returns The full path to the blob file
102
+ */
103
+ getBlobPath(hash) {
104
+ return path.join(this.blobsDir, hash);
105
+ }
106
+ }
107
+ exports.BlobStore = BlobStore;
108
+ //# sourceMappingURL=BlobStore.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BlobStore.js","sourceRoot":"","sources":["../../../src/services/watch/BlobStore.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mCAAoC;AACpC,+BAAgC;AAChC,2BAAoC;AACpC,2CAA6B;AAC7B,kDAAoC;AAEpC;;;;;GAKG;AACH,MAAa,SAAS;IACH,QAAQ,CAAS;IAElC,YAAY,WAAmB;QAC7B,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC;IAC/D,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,UAAU;QACd,MAAM,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACzC,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,KAAK,CAAC,O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
8
+ filePath: string;
9
+ hash: string;
10
+ timestamp: number;
11
+ }
12
+ /**
13
+ * Journal - SQLite database for tracking file change history
14
+ *
15
+ * Stores sessions and events in .neurcode/history.db
16
+ */
17
+ export declare class Journal {
18
+ private db;
19
+ private readonly dbPath;
20
+ constructor(projectRoot: string);
21
+ /**
22
+ * Initialize database schema
23
+ */
24
+ private initializeSchema;
25
+ /**
26
+ * Create a new session
27
+ * @returns The session ID
28
+ */
29
+ createSession(): string;
30
+ /**
31
+ * Record a file change event
32
+ * @param sessionId - The session ID
33
+ * @param filePath - The path to the changed file
34
+ * @param hash - The SHA-256 hash of the file content
35
+ */
36
+ recordEvent(sessionId: string, filePath: string, hash: string): void;
37
+ /**
38
+ * Get all events for a session
39
+ * @param sessionId - The session ID
40
+ * @returns Array of events
41
+ */
42
+ getSessionEvents(sessionId: string): Event[];
43
+ /**
44
+ * Get all events for a file
45
+ * @param filePath - The file path
46
+ * @returns Array of events
47
+ */
48
+ getFileEvents(filePath: string): Event[];
49
+ /**
50
+ * Get the latest event for a file
51
+ * @param filePath - The file path
52
+ * @returns The latest event or null
53
+ */
54
+ getLatestFileEvent(filePath: string): Event | null;
55
+ /**
56
+ * Close the database connection
57
+ */
58
+ close(): void;
59
+ }
60
+ //# sourceMappingURL=Journal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Journal.d.ts","sourceRoot":"","sources":["../../../src/services/watch/Journal.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,KAAK;IACpB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;;GAIG;AACH,qBAAa,OAAO;IAClB,OAAO,CAAC,EAAE,CAAe;IACzB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;gBAEpB,WAAW,EAAE,MAAM;IAgB/B;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAgCxB;;;OAGG;IACH,aAAa,IAAI,MAAM;IAavB;;;;;OAKG;IACH,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI;IAWpE;;;;OAIG;IACH,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,KAAK,EAAE;IAW5C;;;;OAIG;IACH,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,KAAK,EAAE;IAWxC;;;;OAIG;IACH,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,KAAK,GAAG,IAAI;IAalD;;OAEG;IACH,KAAK,IAAI,IAAI;CAGd"}
@@ -0,0 +1,174 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __importDefault = (this && this.__importDefault) || function (mod) {
36
+ return (mod && mod.__esModule) ? mod : { "default": mod };
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.Journal = void 0;
40
+ const better_sqlite3_1 = __importDefault(require("better-sqlite3"));
41
+ const path = __importStar(require("path"));
42
+ const fsExtra = __importStar(require("fs-extra"));
43
+ const uuid_1 = require("uuid");
44
+ /**
45
+ * Journal - SQLite database for tracking file change history
46
+ *
47
+ * Stores sessions and events in .neurcode/history.db
48
+ */
49
+ class Journal {
50
+ db;
51
+ dbPath;
52
+ constructor(projectRoot) {
53
+ this.dbPath = path.join(projectRoot, '.neurcode', 'history.db');
54
+ // Ensure .neurcode directory exists
55
+ fsExtra.ensureDirSync(path.dirname(this.dbPath));
56
+ // Open database connection
57
+ this.db = new better_sqlite3_1.default(this.dbPath);
58
+ // Enable WAL mode for better performance
59
+ this.db.pragma('journal_mode = WAL');
60
+ // Initialize schema
61
+ this.initializeSchema();
62
+ }
63
+ /**
64
+ * Initialize database schema
65
+ */
66
+ initializeSchema() {
67
+ // Create sessions table
68
+ this.db.exec(`
69
+ CREATE TABLE IF NOT EXISTS sessions (
70
+ id TEXT PRIMARY KEY,
71
+ start_time INTEGER NOT NULL
72
+ )
73
+ `);
74
+ // Create events table
75
+ this.db.exec(`
76
+ CREATE TABLE IF NOT EXISTS events (
77
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
78
+ session_id TEXT NOT NULL,
79
+ file_path TEXT NOT NULL,
80
+ hash TEXT NOT NULL,
81
+ timestamp INTEGER NOT NULL,
82
+ FOREIGN KEY (session_id) REFERENCES sessions(id)
83
+ )
84
+ `);
85
+ // Create index on session_id for faster queries
86
+ this.db.exec(`
87
+ CREATE INDEX IF NOT EXISTS idx_events_session_id ON events(session_id)
88
+ `);
89
+ // Create index on file_path for faster queries
90
+ this.db.exec(`
91
+ CREATE INDEX IF NOT EXISTS idx_events_file_path ON events(file_path)
92
+ `);
93
+ }
94
+ /**
95
+ * Create a new session
96
+ * @returns The session ID
97
+ */
98
+ createSession() {
99
+ const sessionId = (0, uuid_1.v4)();
100
+ const startTime = Date.now();
101
+ const stmt = this.db.prepare(`
102
+ INSERT INTO sessions (id, start_time)
103
+ VALUES (?, ?)
104
+ `);
105
+ stmt.run(sessionId, startTime);
106
+ return sessionId;
107
+ }
108
+ /**
109
+ * Record a file change event
110
+ * @param sessionId - The session ID
111
+ * @param filePath - The path to the changed file
112
+ * @param hash - The SHA-256 hash of the file content
113
+ */
114
+ recordEvent(sessionId, filePath, hash) {
115
+ const timestamp = Date.now();
116
+ const stmt = this.db.prepare(`
117
+ INSERT INTO events (session_id, file_path, hash, timestamp)
118
+ VALUES (?, ?, ?, ?)
119
+ `);
120
+ stmt.run(sessionId, filePath, hash, timestamp);
121
+ }
122
+ /**
123
+ * Get all events for a session
124
+ * @param sessionId - The session ID
125
+ * @returns Array of events
126
+ */
127
+ getSessionEvents(sessionId) {
128
+ const stmt = this.db.prepare(`
129
+ SELECT id, session_id, file_path, hash, timestamp
130
+ FROM events
131
+ WHERE session_id = ?
132
+ ORDER BY timestamp ASC
133
+ `);
134
+ return stmt.all(sessionId);
135
+ }
136
+ /**
137
+ * Get all events for a file
138
+ * @param filePath - The file path
139
+ * @returns Array of events
140
+ */
141
+ getFileEvents(filePath) {
142
+ const stmt = this.db.prepare(`
143
+ SELECT id, session_id, file_path, hash, timestamp
144
+ FROM events
145
+ WHERE file_path = ?
146
+ ORDER BY timestamp DESC
147
+ `);
148
+ return stmt.all(filePath);
149
+ }
150
+ /**
151
+ * Get the latest event for a file
152
+ * @param filePath - The file path
153
+ * @returns The latest event or null
154
+ */
155
+ getLatestFileEvent(filePath) {
156
+ const stmt = this.db.prepare(`
157
+ SELECT id, session_id, file_path, hash, timestamp
158
+ FROM events
159
+ WHERE file_path = ?
160
+ ORDER BY timestamp DESC
161
+ LIMIT 1
162
+ `);
163
+ const result = stmt.get(filePath);
164
+ return result || null;
165
+ }
166
+ /**
167
+ * Close the database connection
168
+ */
169
+ close() {
170
+ this.db.close();
171
+ }
172
+ }
173
+ exports.Journal = Journal;
174
+ //# sourceMappingURL=Journal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Journal.js","sourceRoot":"","sources":["../../../src/services/watch/Journal.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oEAAsC;AAEtC,2CAA6B;AAC7B,kDAAoC;AACpC,+BAAoC;AAepC;;;;GAIG;AACH,MAAa,OAAO;IACV,EAAE,CAAe;IACR,MAAM,CAAS;IAEhC,YAAY,WAAmB;QAC7B,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,WAAW,EAAE,YAAY,CAAC,CAAC;QAEhE,oCAAoC;QACpC,OAAO,CAAC,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;QAEjD,2BAA2B;QAC3B,IAAI,CAAC,EAAE,GAAG,IAAI,wBAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAEpC,yCAAyC;QACzC,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC;QAErC,oBAAoB;QACpB,IAAI,CAAC,gBAAgB,EAAE,CAAC;IAC1B,CAAC;IAED;;OAEG;IACK,gBAAgB;QACtB,wBAAwB;QACxB,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC;;;;;KAKZ,CAAC,CAAC;QAEH,sBAAsB;QACtB,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC;;;;;;;;;KASZ,CAAC,CAAC;QAEH,gDAAgD;QAChD,IAAI,CAAC,EAAE,CAAC,IAAI,CA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EH,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAsB,CAAC;QACvD,OAAO,MAAM,IAAI,IAAI,CAAC;IACxB,CAAC;IAED;;OAEG;IACH,KAAK;QACH,IAAI,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC;IAClB,CAAC;CACF;AAjJD,0BAiJC"}
@@ -0,0 +1,48 @@
1
+ import { Syncer } from './Syncer';
2
+ /**
3
+ * Sentinel - File system watcher that records file changes
4
+ *
5
+ * Watches the project root for file changes, stores content in BlobStore,
6
+ * and records events in Journal. Uses debouncing to prevent high CPU usage.
7
+ */
8
+ export declare class Sentinel {
9
+ private watcher;
10
+ private blobStore;
11
+ private journal;
12
+ private syncer;
13
+ private sessionId;
14
+ private projectRoot;
15
+ private debounceTimer;
16
+ private pendingChanges;
17
+ private readonly debounceMs;
18
+ constructor(projectRoot: string);
19
+ /**
20
+ * Initialize the watch service
21
+ */
22
+ initialize(): Promise<void>;
23
+ /**
24
+ * Start watching the project root
25
+ */
26
+ start(): Promise<void>;
27
+ /**
28
+ * Handle a file change event (with debouncing)
29
+ */
30
+ private handleChange;
31
+ /**
32
+ * Process all pending changes after debounce period
33
+ */
34
+ private processPendingChanges;
35
+ /**
36
+ * Stop watching
37
+ */
38
+ stop(): Promise<void>;
39
+ /**
40
+ * Get the current session ID
41
+ */
42
+ getSessionId(): string;
43
+ /**
44
+ * Get the syncer instance (for checking sync status)
45
+ */
46
+ getSyncer(): Syncer;
47
+ }
48
+ //# sourceMappingURL=Sentinel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Sentinel.d.ts","sourceRoot":"","sources":["../../../src/services/watch/Sentinel.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC;;;;;GAKG;AACH,qBAAa,QAAQ;IACnB,OAAO,CAAC,OAAO,CAAmC;IAClD,OAAO,CAAC,SAAS,CAAY;IAC7B,OAAO,CAAC,OAAO,CAAU;IACzB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,aAAa,CAA+B;IACpD,OAAO,CAAC,cAAc,CAAuD;IAC7E,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAO;gBAEtB,WAAW,EAAE,MAAM;IAQ/B;;OAEG;IACG,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAIjC;;OAEG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAwC5B;;OAEG;IACH,OAAO,CAAC,YAAY;IAkBpB;;OAEG;YACW,qBAAqB;IA4CnC;;OAEG;IACG,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAwB3B;;OAEG;IACH,YAAY,IAAI,MAAM;IAItB;;OAEG;IACH,SAAS,IAAI,MAAM;CAGpB"}
@@ -0,0 +1,203 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.Sentinel = void 0;
37
+ const chokidar = __importStar(require("chokidar"));
38
+ const path = __importStar(require("path"));
39
+ const fs_1 = require("fs");
40
+ const BlobStore_1 = require("./BlobStore");
41
+ const Journal_1 = require("./Journal");
42
+ const Syncer_1 = require("./Syncer");
43
+ /**
44
+ * Sentinel - File system watcher that records file changes
45
+ *
46
+ * Watches the project root for file changes, stores content in BlobStore,
47
+ * and records events in Journal. Uses debouncing to prevent high CPU usage.
48
+ */
49
+ class Sentinel {
50
+ watcher = null;
51
+ blobStore;
52
+ journal;
53
+ syncer;
54
+ sessionId;
55
+ projectRoot;
56
+ debounceTimer = null;
57
+ pendingChanges = new Map();
58
+ debounceMs = 500;
59
+ constructor(projectRoot) {
60
+ this.projectRoot = projectRoot;
61
+ this.blobStore = new BlobStore_1.BlobStore(projectRoot);
62
+ this.journal = new Journal_1.Journal(projectRoot);
63
+ this.syncer = new Syncer_1.Syncer(projectRoot);
64
+ this.sessionId = this.journal.createSession();
65
+ }
66
+ /**
67
+ * Initialize the watch service
68
+ */
69
+ async initialize() {
70
+ await this.blobStore.initialize();
71
+ }
72
+ /**
73
+ * Start watching the project root
74
+ */
75
+ async start() {
76
+ if (this.watcher) {
77
+ throw new Error('Sentinel is already watching');
78
+ }
79
+ // Ignore patterns for common directories and files
80
+ const ignored = [
81
+ '**/.git/**',
82
+ '**/node_modules/**',
83
+ '**/.neurcode/**',
84
+ '**/.next/**',
85
+ '**/dist/**',
86
+ '**/build/**',
87
+ '**/.DS_Store',
88
+ '**/Thumbs.db',
89
+ ];
90
+ this.watcher = chokidar.watch(this.projectRoot, {
91
+ ignored,
92
+ persistent: true,
93
+ ignoreInitial: true, // Don't process existing files on startup
94
+ awaitWriteFinish: {
95
+ stabilityThreshold: 200,
96
+ pollInterval: 100,
97
+ },
98
+ });
99
+ // Handle file changes
100
+ this.watcher.on('add', (filePath) => this.handleChange(filePath, 'add'));
101
+ this.watcher.on('change', (filePath) => this.handleChange(filePath, 'change'));
102
+ this.watcher.on('unlink', (filePath) => this.handleChange(filePath, 'unlink'));
103
+ this.watcher.on('error', (error) => {
104
+ console.error('❌ Watch error:', error);
105
+ });
106
+ console.log(`👁️ Watching: ${this.projectRoot}`);
107
+ console.log(`📝 Session ID: ${this.sessionId}`);
108
+ }
109
+ /**
110
+ * Handle a file change event (with debouncing)
111
+ */
112
+ handleChange(filePath, eventType) {
113
+ // Normalize path relative to project root
114
+ const relativePath = path.relative(this.projectRoot, filePath);
115
+ // Store the most recent event type for this file
116
+ this.pendingChanges.set(relativePath, eventType);
117
+ // Clear existing debounce timer
118
+ if (this.debounceTimer) {
119
+ clearTimeout(this.debounceTimer);
120
+ }
121
+ // Set new debounce timer
122
+ this.debounceTimer = setTimeout(() => {
123
+ this.processPendingChanges();
124
+ }, this.debounceMs);
125
+ }
126
+ /**
127
+ * Process all pending changes after debounce period
128
+ */
129
+ async processPendingChanges() {
130
+ const changes = Array.from(this.pendingChanges.entries());
131
+ this.pendingChanges.clear();
132
+ if (changes.length === 0) {
133
+ return;
134
+ }
135
+ for (const [filePath, eventType] of changes) {
136
+ try {
137
+ if (eventType === 'unlink') {
138
+ // File was deleted - we can't read it, but we can record the deletion
139
+ // For now, we'll skip recording deletions (or record with a special marker)
140
+ continue;
141
+ }
142
+ // Read file content
143
+ const fullPath = path.join(this.projectRoot, filePath);
144
+ const content = await fs_1.promises.readFile(fullPath, 'utf-8');
145
+ // Store content in blob store
146
+ const hash = await this.blobStore.store(content);
147
+ // Record event in journal (local SQLite)
148
+ this.journal.recordEvent(this.sessionId, filePath, hash);
149
+ // Queue event for cloud sync (non-blocking, fire-and-forget)
150
+ this.syncer.queueEvent({
151
+ sessionId: this.sessionId,
152
+ filePath,
153
+ hash,
154
+ timestamp: Date.now(),
155
+ });
156
+ console.log(`📝 Recorded: ${filePath} (${hash.substring(0, 8)}...)`);
157
+ }
158
+ catch (error) {
159
+ // Skip files that can't be read (permissions, binary files, etc.)
160
+ if (error instanceof Error) {
161
+ // Silently skip - this is expected for some files
162
+ }
163
+ }
164
+ }
165
+ }
166
+ /**
167
+ * Stop watching
168
+ */
169
+ async stop() {
170
+ if (this.debounceTimer) {
171
+ clearTimeout(this.debounceTimer);
172
+ this.debounceTimer = null;
173
+ }
174
+ if (this.watcher) {
175
+ await this.watcher.close();
176
+ this.watcher = null;
177
+ }
178
+ // Flush any pending syncs before closing
179
+ if (this.syncer.isConfigured()) {
180
+ console.log('☁️ Flushing pending cloud syncs...');
181
+ const result = await this.syncer.flush();
182
+ if (result.success && result.synced > 0) {
183
+ console.log(`✅ Synced ${result.synced} events to cloud`);
184
+ }
185
+ }
186
+ this.journal.close();
187
+ console.log('🛑 Watch stopped');
188
+ }
189
+ /**
190
+ * Get the current session ID
191
+ */
192
+ getSessionId() {
193
+ return this.sessionId;
194
+ }
195
+ /**
196
+ * Get the syncer instance (for checking sync status)
197
+ */
198
+ getSyncer() {
199
+ return this.syncer;
200
+ }
201
+ }
202
+ exports.Sentinel = Sentinel;
203
+ //# sourceMappingURL=Sentinel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Sentinel.js","sourceRoot":"","sources":["../../../src/services/watch/Sentinel.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mDAAqC;AACrC,2CAA6B;AAC7B,2BAAoC;AACpC,2CAAwC;AACxC,uCAAoC;AACpC,qCAAkC;AAElC;;;;;GAKG;AACH,MAAa,QAAQ;IACX,OAAO,GAA8B,IAAI,CAAC;IAC1C,SAAS,CAAY;IACrB,OAAO,CAAU;IACjB,MAAM,CAAS;IACf,SAAS,CAAS;IAClB,WAAW,CAAS;IACpB,aAAa,GA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CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,IAAI;QACR,IAAI,IAAI,CAAC,aAAa,EAAE,CAAC;YACvB,YAAY,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;YACjC,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;QAC5B,CAAC;QAED,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACjB,MAAM,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;YAC3B,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACtB,CAAC;QAED,yCAAyC;QACzC,IAAI,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,EAAE,CAAC;YAC/B,OAAO,CAAC,GAAG,CAAC,qCAAqC,CAAC,CAAC;YACnD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;YACzC,IAAI,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBACxC,OAAO,CAAC,GAAG,CAAC,YAAY,MAAM,CAAC,MAAM,kBAAkB,CAAC,CAAC;YAC3D,CAAC;QACH,CAAC;QAED,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;QACrB,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;IAClC,CAAC;IAED;;OAEG;IACH,YAAY;QACV,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAED;;OAEG;IACH,SAAS;QACP,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;CACF;AAjLD,4BAiLC"}
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Syncer - Cloud sync service for Time Machine events
3
+ *
4
+ * Pushes file change events to the cloud API in a fire-and-forget manner.
5
+ * If API key is not configured, operates in local-only mode (silent failure).
6
+ */
7
+ export interface SyncEvent {
8
+ sessionId: string;
9
+ filePath: string;
10
+ hash: string;
11
+ timestamp: number;
12
+ }
13
+ export interface SyncResult {
14
+ success: boolean;
15
+ synced: number;
16
+ skipped: number;
17
+ error?: string;
18
+ }
19
+ /**
20
+ * Syncer - Handles cloud sync of history events
21
+ */
22
+ export declare class Syncer {
23
+ private apiUrl;
24
+ private apiKey;
25
+ private projectRoot;
26
+ private syncQueue;
27
+ private syncTimer;
28
+ private readonly batchSize;
29
+ private readonly debounceMs;
30
+ constructor(projectRoot: string);
31
+ /**
32
+ * Queue an event for sync (non-blocking)
33
+ * @param event - The event to sync
34
+ */
35
+ queueEvent(event: SyncEvent): void;
36
+ /**
37
+ * Sync a batch of events to the cloud
38
+ * @returns Sync result
39
+ */
40
+ private syncBatch;
41
+ /**
42
+ * Force sync all pending events (useful for shutdown)
43
+ */
44
+ flush(): Promise<SyncResult>;
45
+ /**
46
+ * Check if syncer is configured (has API key)
47
+ */
48
+ isConfigured(): boolean;
49
+ /**
50
+ * Reload API key from config (useful if user logs in after watch starts)
51
+ */
52
+ reloadConfig(): void;
53
+ }
54
+ //# sourceMappingURL=Syncer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Syncer.d.ts","sourceRoot":"","sources":["../../../src/services/watch/Syncer.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,MAAM,WAAW,SAAS;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,qBAAa,MAAM;IACjB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,MAAM,CAAgB;IAC9B,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,SAAS,CAAmB;IACpC,OAAO,CAAC,SAAS,CAA+B;IAChD,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAM;IAChC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAQ;gBAEvB,WAAW,EAAE,MAAM;IAO/B;;;OAGG;IACH,UAAU,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI;IAuBlC;;;OAGG;YACW,SAAS;IAuFvB;;OAEG;IACG,KAAK,IAAI,OAAO,CAAC,UAAU,CAAC;IAyBlC;;OAEG;IACH,YAAY,IAAI,OAAO;IAIvB;;OAEG;IACH,YAAY,IAAI,IAAI;CAKrB"}
@@ -0,0 +1,207 @@
1
+ "use strict";
2
+ /**
3
+ * Syncer - Cloud sync service for Time Machine events
4
+ *
5
+ * Pushes file change events to the cloud API in a fire-and-forget manner.
6
+ * If API key is not configured, operates in local-only mode (silent failure).
7
+ */
8
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
9
+ if (k2 === undefined) k2 = k;
10
+ var desc = Object.getOwnPropertyDescriptor(m, k);
11
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
12
+ desc = { enumerable: true, get: function() { return m[k]; } };
13
+ }
14
+ Object.defineProperty(o, k2, desc);
15
+ }) : (function(o, m, k, k2) {
16
+ if (k2 === undefined) k2 = k;
17
+ o[k2] = m[k];
18
+ }));
19
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
20
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
21
+ }) : function(o, v) {
22
+ o["default"] = v;
23
+ });
24
+ var __importStar = (this && this.__importStar) || (function () {
25
+ var ownKeys = function(o) {
26
+ ownKeys = Object.getOwnPropertyNames || function (o) {
27
+ var ar = [];
28
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
29
+ return ar;
30
+ };
31
+ return ownKeys(o);
32
+ };
33
+ return function (mod) {
34
+ if (mod && mod.__esModule) return mod;
35
+ var result = {};
36
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
37
+ __setModuleDefault(result, mod);
38
+ return result;
39
+ };
40
+ })();
41
+ Object.defineProperty(exports, "__esModule", { value: true });
42
+ exports.Syncer = void 0;
43
+ const config_1 = require("../../config");
44
+ const fs_1 = require("fs");
45
+ const path = __importStar(require("path"));
46
+ /**
47
+ * Syncer - Handles cloud sync of history events
48
+ */
49
+ class Syncer {
50
+ apiUrl;
51
+ apiKey;
52
+ projectRoot;
53
+ syncQueue = [];
54
+ syncTimer = null;
55
+ batchSize = 10; // Sync in batches
56
+ debounceMs = 2000; // Wait 2 seconds before syncing
57
+ constructor(projectRoot) {
58
+ this.projectRoot = projectRoot;
59
+ const config = (0, config_1.loadConfig)();
60
+ this.apiUrl = config.apiUrl || config_1.DEFAULT_API_URL;
61
+ this.apiKey = (0, config_1.getApiKey)();
62
+ }
63
+ /**
64
+ * Queue an event for sync (non-blocking)
65
+ * @param event - The event to sync
66
+ */
67
+ queueEvent(event) {
68
+ // If no API key, skip silently (local-only mode)
69
+ if (!this.apiKey) {
70
+ return;
71
+ }
72
+ // Add to queue
73
+ this.syncQueue.push(event);
74
+ // Clear existing timer
75
+ if (this.syncTimer) {
76
+ clearTimeout(this.syncTimer);
77
+ }
78
+ // Set new timer to sync after debounce period
79
+ this.syncTimer = setTimeout(() => {
80
+ this.syncBatch().catch((error) => {
81
+ // Silently handle errors - don't block the watch service
82
+ console.error('⚠️ Sync error (non-fatal):', error.message);
83
+ });
84
+ }, this.debounceMs);
85
+ }
86
+ /**
87
+ * Sync a batch of events to the cloud
88
+ * @returns Sync result
89
+ */
90
+ async syncBatch() {
91
+ if (this.syncQueue.length === 0) {
92
+ return { success: true, synced: 0, skipped: 0 };
93
+ }
94
+ // If no API key, clear queue and return
95
+ if (!this.apiKey) {
96
+ this.syncQueue = [];
97
+ return { success: false, synced: 0, skipped: 0, error: 'No API key configured' };
98
+ }
99
+ // Take a batch from the queue
100
+ const batch = this.syncQueue.splice(0, this.batchSize);
101
+ // Prepare events (metadata only - no content)
102
+ const events = batch.map(event => ({
103
+ sessionId: event.sessionId,
104
+ filePath: event.filePath,
105
+ hash: event.hash,
106
+ timestamp: event.timestamp,
107
+ }));
108
+ // Read blob content for all unique hashes in the batch
109
+ // Send blobs separately for server-side deduplication
110
+ const blobs = {};
111
+ const uniqueHashes = new Set(batch.map(e => e.hash));
112
+ for (const hash of uniqueHashes) {
113
+ try {
114
+ // Try to read the blob content
115
+ const blobPath = path.join(this.projectRoot, '.neurcode', 'blobs', hash);
116
+ const blobContent = await fs_1.promises.readFile(blobPath);
117
+ // Convert to base64 for transmission
118
+ // Server will handle deduplication - we send all blobs, server checks which are new
119
+ blobs[hash] = blobContent.toString('base64');
120
+ }
121
+ catch {
122
+ // If blob doesn't exist or can't be read, skip it
123
+ // The server can still store the event metadata with just the hash
124
+ // This allows events to be recorded even if blob read fails
125
+ }
126
+ }
127
+ try {
128
+ // Make API request with separated events and blobs
129
+ // Format: { events: [...], blobs: { [hash]: base64Content } }
130
+ const response = await fetch(`${this.apiUrl}/api/v1/history/sync`, {
131
+ method: 'POST',
132
+ headers: {
133
+ 'Content-Type': 'application/json',
134
+ 'Authorization': `Bearer ${this.apiKey}`,
135
+ },
136
+ body: JSON.stringify({
137
+ events,
138
+ blobs, // Separate blobs map for server-side deduplication
139
+ }),
140
+ });
141
+ if (!response.ok) {
142
+ const errorText = await response.text();
143
+ throw new Error(`API error: ${response.status} ${errorText}`);
144
+ }
145
+ const result = await response.json();
146
+ // If there are more events in the queue, schedule another sync
147
+ if (this.syncQueue.length > 0) {
148
+ setTimeout(() => {
149
+ this.syncBatch().catch((error) => {
150
+ console.error('⚠️ Sync error (non-fatal):', error.message);
151
+ });
152
+ }, this.debounceMs);
153
+ }
154
+ return result;
155
+ }
156
+ catch (error) {
157
+ // Log error but don't throw - this is fire-and-forget
158
+ console.error('⚠️ Failed to sync events to cloud:', error.message);
159
+ return {
160
+ success: false,
161
+ synced: 0,
162
+ skipped: batch.length,
163
+ error: error.message,
164
+ };
165
+ }
166
+ }
167
+ /**
168
+ * Force sync all pending events (useful for shutdown)
169
+ */
170
+ async flush() {
171
+ if (this.syncTimer) {
172
+ clearTimeout(this.syncTimer);
173
+ this.syncTimer = null;
174
+ }
175
+ // Sync all remaining events
176
+ const results = [];
177
+ while (this.syncQueue.length > 0) {
178
+ const result = await this.syncBatch();
179
+ results.push(result);
180
+ }
181
+ // Aggregate results
182
+ const totalSynced = results.reduce((sum, r) => sum + r.synced, 0);
183
+ const totalSkipped = results.reduce((sum, r) => sum + r.skipped, 0);
184
+ const allSuccess = results.every(r => r.success);
185
+ return {
186
+ success: allSuccess,
187
+ synced: totalSynced,
188
+ skipped: totalSkipped,
189
+ };
190
+ }
191
+ /**
192
+ * Check if syncer is configured (has API key)
193
+ */
194
+ isConfigured() {
195
+ return this.apiKey !== null;
196
+ }
197
+ /**
198
+ * Reload API key from config (useful if user logs in after watch starts)
199
+ */
200
+ reloadConfig() {
201
+ const config = (0, config_1.loadConfig)();
202
+ this.apiUrl = config.apiUrl || config_1.DEFAULT_API_URL;
203
+ this.apiKey = (0, config_1.getApiKey)();
204
+ }
205
+ }
206
+ exports.Syncer = Syncer;
207
+ //# sourceMappingURL=Syncer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Syncer.js","sourceRoot":"","sources":["../../../src/services/watch/Syncer.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,yCAAsE;AACtE,2BAAoC;AACpC,2CAA6B;AAgB7B;;GAEG;AACH,MAAa,MAAM;IACT,MAAM,CAAS;IACf,MAAM,CAAgB;IACtB,WAAW,CAAS;IACpB,SAAS,GAAgB,EAAE,CAAC;IAC5B,SAAS,GAA0B,IAAI,CAAC;IAC/B,SAAS,GAAG,EAAE,CAAC,CAAC,kBAAkB;IAClC,UAAU,GAAG,IAAI,CAAC,CAAC,gC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C;IAC5B,CAAC;CACF;AAjLD,wBAiLC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neurcode-ai/cli",
3
- "version": "0.4.0",
3
+ "version": "0.6.0",
4
4
  "description": "Neurcode CLI - AI code governance and diff analysis",
5
5
  "bin": {
6
6
  "neurcode": "./dist/index.js"
@@ -38,17 +38,24 @@
38
38
  "dependencies": {
39
39
  "@neurcode-ai/diff-parser": "^0.1.0",
40
40
  "@neurcode-ai/policy-engine": "^0.1.0",
41
+ "better-sqlite3": "^12.5.0",
41
42
  "chalk": "^4.1.2",
43
+ "chokidar": "^3.6.0",
42
44
  "commander": "^11.1.0",
45
+ "fs-extra": "^11.2.0",
43
46
  "glob": "^10.3.10",
44
- "ts-morph": "^24.0.0"
47
+ "ts-morph": "^24.0.0",
48
+ "uuid": "^9.0.1"
45
49
  },
46
50
  "publishConfig": {
47
51
  "access": "public"
48
52
  },
49
53
  "devDependencies": {
50
- "@types/node": "^20.10.0",
54
+ "@types/better-sqlite3": "^7.6.11",
55
+ "@types/fs-extra": "^11.0.4",
51
56
  "@types/glob": "^8.1.0",
57
+ "@types/node": "^20.10.0",
58
+ "@types/uuid": "^9.0.8",
52
59
  "typescript": "^5.3.0"
53
60
  }
54
61
  }