@jxtools/promptline 1.3.6 → 1.3.7
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/bin/promptline.mjs +1 -38
- package/package.json +1 -1
package/bin/promptline.mjs
CHANGED
|
@@ -4,7 +4,6 @@ import { existsSync, readFileSync, writeFileSync, copyFileSync, chmodSync } from
|
|
|
4
4
|
import { resolve, dirname, join } from 'path'
|
|
5
5
|
import { fileURLToPath } from 'url'
|
|
6
6
|
import { spawn, execSync } from 'child_process'
|
|
7
|
-
import { createInterface } from 'readline'
|
|
8
7
|
import { homedir } from 'os'
|
|
9
8
|
|
|
10
9
|
const __dirname = dirname(fileURLToPath(import.meta.url))
|
|
@@ -59,32 +58,7 @@ const hookFiles = [
|
|
|
59
58
|
'promptline-session-end.sh',
|
|
60
59
|
]
|
|
61
60
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
if (!allHooksInstalled) {
|
|
65
|
-
const answer = await ask('Install PromptLine hooks for Claude Code? (Y/n) ')
|
|
66
|
-
|
|
67
|
-
if (answer.toLowerCase() === 'n') {
|
|
68
|
-
console.log(' Skipped. Run promptline again to install later.')
|
|
69
|
-
process.exit(0)
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
installHooks()
|
|
73
|
-
} else {
|
|
74
|
-
const hooksOutdated = hookFiles.some(f => {
|
|
75
|
-
try {
|
|
76
|
-
const src = readFileSync(join(pkgDir, f), 'utf-8')
|
|
77
|
-
const dest = readFileSync(join(hooksDir, f), 'utf-8')
|
|
78
|
-
return src !== dest
|
|
79
|
-
} catch {
|
|
80
|
-
return true
|
|
81
|
-
}
|
|
82
|
-
})
|
|
83
|
-
|
|
84
|
-
if (hooksOutdated) {
|
|
85
|
-
installHooks()
|
|
86
|
-
}
|
|
87
|
-
}
|
|
61
|
+
installHooks()
|
|
88
62
|
|
|
89
63
|
// Start Vite dev server
|
|
90
64
|
const viteBin = resolve(pkgDir, 'node_modules', '.bin', 'vite')
|
|
@@ -127,16 +101,6 @@ process.on('SIGINT', () => {
|
|
|
127
101
|
|
|
128
102
|
// --- Helpers ---
|
|
129
103
|
|
|
130
|
-
function ask(question) {
|
|
131
|
-
const rl = createInterface({ input: process.stdin, output: process.stdout })
|
|
132
|
-
return new Promise((resolve) => {
|
|
133
|
-
rl.question(question, (answer) => {
|
|
134
|
-
rl.close()
|
|
135
|
-
resolve(answer.trim() || 'y')
|
|
136
|
-
})
|
|
137
|
-
})
|
|
138
|
-
}
|
|
139
|
-
|
|
140
104
|
function installHooks() {
|
|
141
105
|
// Copy hook scripts
|
|
142
106
|
execSync(`mkdir -p "${hooksDir}"`)
|
|
@@ -191,5 +155,4 @@ function installHooks() {
|
|
|
191
155
|
}
|
|
192
156
|
|
|
193
157
|
writeFileSync(settingsPath, JSON.stringify(settings, null, 2) + '\n')
|
|
194
|
-
console.log(`\x1b[32m✓\x1b[0m Hooks installed`)
|
|
195
158
|
}
|