MCPcopy Create free account
hub / github.com/buct2012dbl/Dorchestrator / insertFile

Method insertFile

coding-agent/src/context/database.ts:68–94  ·  view source on GitHub ↗
(file: FileRecord)

Source from the content-addressed store, hash-verified

66
67 // File operations
68 insertFile(file: FileRecord): number {
69 const stmt = this.db.prepare(`
70 INSERT INTO files (path, hash, size, language, modified_at, indexed_at, line_count, token_count)
71 VALUES (?, ?, ?, ?, ?, ?, ?, ?)
72 ON CONFLICT(path) DO UPDATE SET
73 hash = excluded.hash,
74 size = excluded.size,
75 language = excluded.language,
76 modified_at = excluded.modified_at,
77 indexed_at = excluded.indexed_at,
78 line_count = excluded.line_count,
79 token_count = excluded.token_count
80 `);
81
82 const result = stmt.run(
83 file.path,
84 file.hash,
85 file.size,
86 file.language,
87 file.modified_at,
88 file.indexed_at,
89 file.line_count,
90 file.token_count
91 );
92
93 return result.lastInsertRowid as number;
94 }
95
96 getFile(path: string): FileRecord | undefined {
97 const stmt = this.db.prepare('SELECT * FROM files WHERE path = ?');

Callers 1

buildIndexMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected