prjct-cli 2.23.8 → 2.23.10
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/CHANGELOG.md +19 -1
- package/README.md +9 -1
- package/dist/bin/prjct-core.mjs +322 -322
- package/dist/daemon/entry.mjs +214 -214
- package/package.json +3 -1
- package/scripts/ensure-native-deps.js +64 -0
- package/scripts/postinstall.js +16 -12
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "prjct-cli",
|
|
3
|
-
"version": "2.23.
|
|
3
|
+
"version": "2.23.10",
|
|
4
4
|
"description": "Context layer for AI agents. Project context for Claude Code, Gemini CLI, and more.",
|
|
5
5
|
"main": "dist/bin/prjct.mjs",
|
|
6
6
|
"bin": {
|
|
@@ -98,6 +98,7 @@
|
|
|
98
98
|
"bin/prjct",
|
|
99
99
|
"dist/",
|
|
100
100
|
"templates/",
|
|
101
|
+
"scripts/ensure-native-deps.js",
|
|
101
102
|
"scripts/postinstall.js",
|
|
102
103
|
"scripts/ensure-bun.sh",
|
|
103
104
|
"scripts/install.sh",
|
|
@@ -107,6 +108,7 @@
|
|
|
107
108
|
],
|
|
108
109
|
"prepublishOnly": "node scripts/build.js",
|
|
109
110
|
"trustedDependencies": [
|
|
111
|
+
"better-sqlite3",
|
|
110
112
|
"chalk"
|
|
111
113
|
]
|
|
112
114
|
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const { execFileSync } = require('node:child_process')
|
|
4
|
+
const path = require('node:path')
|
|
5
|
+
|
|
6
|
+
const ROOT = path.resolve(__dirname, '..')
|
|
7
|
+
|
|
8
|
+
function npmCommand() {
|
|
9
|
+
return process.platform === 'win32' ? 'npm.cmd' : 'npm'
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
function hasBetterSqliteBinding() {
|
|
13
|
+
try {
|
|
14
|
+
const Database = require('better-sqlite3')
|
|
15
|
+
new Database(':memory:').close()
|
|
16
|
+
return true
|
|
17
|
+
} catch (error) {
|
|
18
|
+
const message = error instanceof Error ? error.message : String(error)
|
|
19
|
+
if (
|
|
20
|
+
message.includes('Could not locate the bindings file') ||
|
|
21
|
+
message.includes('better_sqlite3.node')
|
|
22
|
+
) {
|
|
23
|
+
return false
|
|
24
|
+
}
|
|
25
|
+
throw error
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function ensureNativeDependencies(options = {}) {
|
|
30
|
+
if (process.env.PRJCT_SKIP_NATIVE_REBUILD === '1') {
|
|
31
|
+
return { rebuilt: false, skipped: true }
|
|
32
|
+
}
|
|
33
|
+
if (hasBetterSqliteBinding()) {
|
|
34
|
+
return { rebuilt: false, skipped: false }
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const stdio = options.stdio || 'inherit'
|
|
38
|
+
execFileSync(npmCommand(), ['rebuild', 'better-sqlite3', '--foreground-scripts'], {
|
|
39
|
+
cwd: ROOT,
|
|
40
|
+
stdio,
|
|
41
|
+
timeout: 120000,
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
if (!hasBetterSqliteBinding()) {
|
|
45
|
+
throw new Error('better-sqlite3 native binding is still unavailable after rebuild')
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return { rebuilt: true, skipped: false }
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (require.main === module) {
|
|
52
|
+
try {
|
|
53
|
+
ensureNativeDependencies()
|
|
54
|
+
} catch (error) {
|
|
55
|
+
const message = error instanceof Error ? error.message : String(error)
|
|
56
|
+
console.error(`prjct native dependency install failed: ${message}`)
|
|
57
|
+
process.exit(1)
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
module.exports = {
|
|
62
|
+
ensureNativeDependencies,
|
|
63
|
+
hasBetterSqliteBinding,
|
|
64
|
+
}
|
package/scripts/postinstall.js
CHANGED
|
@@ -6,11 +6,13 @@
|
|
|
6
6
|
* NOTE: postinstall often doesn't run (npm quirks, --ignore-scripts, etc.)
|
|
7
7
|
* The reliable setup path is `prjct start` which users run manually.
|
|
8
8
|
*
|
|
9
|
-
* This script
|
|
9
|
+
* This script may repair required native dependencies, but it must never
|
|
10
|
+
* install optional tools, mutate shell config, or configure integrations.
|
|
10
11
|
*/
|
|
11
12
|
|
|
12
13
|
const fs = require('node:fs')
|
|
13
14
|
const path = require('node:path')
|
|
15
|
+
const { ensureNativeDependencies } = require('./ensure-native-deps')
|
|
14
16
|
|
|
15
17
|
const ROOT = path.resolve(__dirname, '..')
|
|
16
18
|
const pkg = JSON.parse(fs.readFileSync(path.join(ROOT, 'package.json'), 'utf-8'))
|
|
@@ -23,6 +25,19 @@ const DIM = '\x1b[2m'
|
|
|
23
25
|
const BOLD = '\x1b[1m'
|
|
24
26
|
const RESET = '\x1b[0m'
|
|
25
27
|
|
|
28
|
+
try {
|
|
29
|
+
const result = ensureNativeDependencies({ stdio: 'inherit' })
|
|
30
|
+
if (result.rebuilt) {
|
|
31
|
+
console.log(` ${DIM}Built required SQLite native dependency.${RESET}`)
|
|
32
|
+
}
|
|
33
|
+
} catch (error) {
|
|
34
|
+
const message = error instanceof Error ? error.message : String(error)
|
|
35
|
+
console.error(`\n${BOLD}prjct native dependency repair warning:${RESET} ${message}`)
|
|
36
|
+
console.error(
|
|
37
|
+
`${DIM}Install will continue. prjct will retry this repair before starting the daemon.${RESET}`
|
|
38
|
+
)
|
|
39
|
+
}
|
|
40
|
+
|
|
26
41
|
console.log(`
|
|
27
42
|
${CYAN}${BOLD} prjct${RESET} ${DIM}v${VERSION}${RESET}
|
|
28
43
|
|
|
@@ -32,14 +47,3 @@ ${CYAN}${BOLD} prjct${RESET} ${DIM}v${VERSION}${RESET}
|
|
|
32
47
|
|
|
33
48
|
${DIM}Supports: Claude Code, Gemini CLI, or both${RESET}
|
|
34
49
|
`)
|
|
35
|
-
|
|
36
|
-
// Auto-install Bun for optimal performance (best-effort)
|
|
37
|
-
try {
|
|
38
|
-
const { execSync } = require('node:child_process')
|
|
39
|
-
const ensureBun = path.join(__dirname, 'ensure-bun.sh')
|
|
40
|
-
if (fs.existsSync(ensureBun)) {
|
|
41
|
-
execSync(`sh "${ensureBun}"`, { stdio: 'inherit', timeout: 30000 })
|
|
42
|
-
}
|
|
43
|
-
} catch (_err) {
|
|
44
|
-
console.log(` ${DIM}Bun not installed — using Node.js (slower)${RESET}`)
|
|
45
|
-
}
|