claude-notification-plugin 1.0.21 → 1.0.22
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 +32 -4
- package/package.json +1 -1
package/bin/install.js
CHANGED
|
@@ -108,14 +108,14 @@ async function main () {
|
|
|
108
108
|
|
|
109
109
|
rl.close();
|
|
110
110
|
|
|
111
|
-
// Create config
|
|
111
|
+
// Create / update config
|
|
112
112
|
fs.mkdirSync(claudeDir, { recursive: true });
|
|
113
113
|
|
|
114
|
-
const
|
|
114
|
+
const defaults = {
|
|
115
115
|
telegram: {
|
|
116
116
|
enabled: true,
|
|
117
|
-
token,
|
|
118
|
-
chatId,
|
|
117
|
+
token: '',
|
|
118
|
+
chatId: '',
|
|
119
119
|
deleteAfterHours: 24,
|
|
120
120
|
},
|
|
121
121
|
windowsNotification: {
|
|
@@ -129,8 +129,36 @@ async function main () {
|
|
|
129
129
|
enabled: true,
|
|
130
130
|
},
|
|
131
131
|
minSeconds: 15,
|
|
132
|
+
notifyOnWaiting: false,
|
|
133
|
+
debug: false,
|
|
132
134
|
};
|
|
133
135
|
|
|
136
|
+
// Load existing config and merge (user values take priority)
|
|
137
|
+
let existing = {};
|
|
138
|
+
if (fs.existsSync(configPath)) {
|
|
139
|
+
try {
|
|
140
|
+
existing = JSON.parse(fs.readFileSync(configPath, 'utf-8'));
|
|
141
|
+
} catch {
|
|
142
|
+
// ignore malformed config
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
const config = { ...defaults, ...existing };
|
|
147
|
+
// Deep-merge nested objects
|
|
148
|
+
for (const key of Object.keys(defaults)) {
|
|
149
|
+
if (defaults[key] && typeof defaults[key] === 'object' && !Array.isArray(defaults[key])) {
|
|
150
|
+
config[key] = { ...defaults[key], ...(existing[key] || {}) };
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
// Apply Telegram credentials from this run (if provided)
|
|
155
|
+
if (token) {
|
|
156
|
+
config.telegram.token = token;
|
|
157
|
+
}
|
|
158
|
+
if (chatId) {
|
|
159
|
+
config.telegram.chatId = chatId;
|
|
160
|
+
}
|
|
161
|
+
|
|
134
162
|
fs.writeFileSync(configPath, JSON.stringify(config, null, 2));
|
|
135
163
|
|
|
136
164
|
// Patch settings.json
|
package/package.json
CHANGED