claude-code-pulsify 1.3.0 → 1.3.1
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/install.js +23 -5
- package/package.json +1 -1
package/bin/install.js
CHANGED
|
@@ -9,9 +9,12 @@ const { isOurEntry, upsertHookArray, removeFromHookArray } = require('../lib/ins
|
|
|
9
9
|
const PACKAGE_VERSION = require('../package.json').version
|
|
10
10
|
const HOOKS_SOURCE = path.join(__dirname, '..', 'hooks')
|
|
11
11
|
const HOOK_FILES = ['statusline.js', 'context-monitor.js', 'check-update.js', 'check-update-worker.js']
|
|
12
|
+
const LIB_SOURCE = path.join(__dirname, '..', 'lib')
|
|
13
|
+
const LIB_FILES = ['statusline.js', 'context.js', 'install.js']
|
|
12
14
|
|
|
13
15
|
const configDir = process.env.CLAUDE_CONFIG_DIR || path.join(require('node:os').homedir(), '.claude')
|
|
14
16
|
const hooksTarget = path.join(configDir, 'hooks', 'claude-code-pulsify')
|
|
17
|
+
const libTarget = path.join(configDir, 'hooks', 'lib')
|
|
15
18
|
const settingsPath = path.join(configDir, 'settings.json')
|
|
16
19
|
|
|
17
20
|
// --- Helpers ---
|
|
@@ -49,11 +52,20 @@ function install() {
|
|
|
49
52
|
console.log(` Copied ${file}`)
|
|
50
53
|
}
|
|
51
54
|
|
|
52
|
-
// 2.
|
|
55
|
+
// 2. Copy lib (hooks require('../lib/...') at runtime)
|
|
56
|
+
fs.mkdirSync(libTarget, { recursive: true })
|
|
57
|
+
for (const file of LIB_FILES) {
|
|
58
|
+
const src = path.join(LIB_SOURCE, file)
|
|
59
|
+
const dst = path.join(libTarget, file)
|
|
60
|
+
fs.copyFileSync(src, dst)
|
|
61
|
+
console.log(` Copied lib/${file}`)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// 3. Write VERSION
|
|
53
65
|
fs.writeFileSync(path.join(hooksTarget, 'VERSION'), PACKAGE_VERSION, 'utf8')
|
|
54
66
|
console.log(` Wrote VERSION (${PACKAGE_VERSION})`)
|
|
55
67
|
|
|
56
|
-
//
|
|
68
|
+
// 4. Clear update cache so stale "update available" indicators don't persist after install.
|
|
57
69
|
// The background worker will refresh it on next session.
|
|
58
70
|
const cachePath = path.join(configDir, 'cache', 'claude-code-pulsify-update.json')
|
|
59
71
|
try {
|
|
@@ -63,7 +75,7 @@ function install() {
|
|
|
63
75
|
// Doesn't exist — fine
|
|
64
76
|
}
|
|
65
77
|
|
|
66
|
-
//
|
|
78
|
+
// 5. Patch settings.json
|
|
67
79
|
const settings = readJSON(settingsPath)
|
|
68
80
|
|
|
69
81
|
// statusLine — check for conflicts from other tools
|
|
@@ -124,7 +136,13 @@ function uninstall() {
|
|
|
124
136
|
console.log(` Removed ${hooksTarget}`)
|
|
125
137
|
}
|
|
126
138
|
|
|
127
|
-
// 2.
|
|
139
|
+
// 2. Remove lib directory
|
|
140
|
+
if (fs.existsSync(libTarget)) {
|
|
141
|
+
fs.rmSync(libTarget, { recursive: true })
|
|
142
|
+
console.log(` Removed ${libTarget}`)
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// 3. Clean settings.json
|
|
128
146
|
if (fs.existsSync(settingsPath)) {
|
|
129
147
|
const settings = readJSON(settingsPath)
|
|
130
148
|
|
|
@@ -153,7 +171,7 @@ function uninstall() {
|
|
|
153
171
|
writeJSON(settingsPath, settings)
|
|
154
172
|
}
|
|
155
173
|
|
|
156
|
-
//
|
|
174
|
+
// 4. Remove cache file
|
|
157
175
|
const cachePath = path.join(configDir, 'cache', 'claude-code-pulsify-update.json')
|
|
158
176
|
try {
|
|
159
177
|
fs.unlinkSync(cachePath)
|