- Added utility functions for SQLite operations in `sqliteUtils.ts`, including row manipulation and JSON parsing. - Enhanced `WorkspaceKnowledgePrepareService` to manage document generations and content hashes. - Updated constants for chunk write batch size to improve performance. - Modified types to include generation IDs and content hashes in document records. - Introduced SQLite database path configuration in `paths.ts`. - Refactored `ChatPage` component to optimize rendering and handle file changes. - Created unit tests for SQLite storage and document metadata management. - Updated chat run service tests to reflect changes in event handling and data persistence.
28 lines
765 B
JavaScript
28 lines
765 B
JavaScript
import { existsSync } from 'node:fs'
|
|
import path from 'node:path'
|
|
import { spawnSync } from 'node:child_process'
|
|
|
|
const root = process.cwd()
|
|
const electronInstall = path.join(root, 'node_modules', 'electron', 'install.js')
|
|
|
|
const run = (command, args) => {
|
|
const result = spawnSync(command, args, {
|
|
cwd: root,
|
|
stdio: 'inherit',
|
|
env: process.env
|
|
})
|
|
if (result.status !== 0) {
|
|
process.exit(result.status || 1)
|
|
}
|
|
}
|
|
|
|
if (existsSync(electronInstall)) {
|
|
run(process.execPath, [electronInstall])
|
|
}
|
|
|
|
if (process.env.NCURATOR_REBUILD_NATIVE === '1') {
|
|
run(process.execPath, [path.join(root, 'scripts', 'rebuild-better-sqlite3-electron.mjs')])
|
|
} else {
|
|
console.log('[postinstall] skip native rebuild; set NCURATOR_REBUILD_NATIVE=1 to run it')
|
|
}
|