qwen-base 1.0.3 → 1.0.4
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 +29 -0
- package/package.json +1 -1
package/bin/install.js
CHANGED
|
@@ -165,6 +165,35 @@ function install(isGlobal) {
|
|
|
165
165
|
}
|
|
166
166
|
}
|
|
167
167
|
|
|
168
|
+
// Wire BASE Python hooks into settings.json
|
|
169
|
+
const settingsPath = path.join(qwenDir, 'settings.json');
|
|
170
|
+
let settings = {};
|
|
171
|
+
if (fs.existsSync(settingsPath)) {
|
|
172
|
+
try { settings = JSON.parse(fs.readFileSync(settingsPath, 'utf8')); } catch (e) {}
|
|
173
|
+
}
|
|
174
|
+
if (!settings.hooks) settings.hooks = {};
|
|
175
|
+
|
|
176
|
+
const hookFiles = [
|
|
177
|
+
{ event: 'UserPromptSubmit', file: 'base-pulse-check.py' },
|
|
178
|
+
{ event: 'UserPromptSubmit', file: 'psmm-injector.py' },
|
|
179
|
+
{ event: 'SessionStart', file: 'satellite-detection.py' },
|
|
180
|
+
];
|
|
181
|
+
|
|
182
|
+
for (const hook of hookFiles) {
|
|
183
|
+
const hookPath = path.join(baseDest, 'hooks', hook.file).replace(/\\/g, '/');
|
|
184
|
+
const hookCommand = `python3 ${hookPath}`;
|
|
185
|
+
if (!settings.hooks[hook.event]) settings.hooks[hook.event] = [];
|
|
186
|
+
const exists = settings.hooks[hook.event].some(h =>
|
|
187
|
+
(h.command && h.command.includes(hook.file)) ||
|
|
188
|
+
(h.hooks && h.hooks.some(i => i.command && i.command.includes(hook.file)))
|
|
189
|
+
);
|
|
190
|
+
if (!exists) {
|
|
191
|
+
settings.hooks[hook.event].push({ hooks: [{ type: 'command', command: hookCommand }] });
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
fs.writeFileSync(settingsPath, JSON.stringify(settings, null, 2));
|
|
195
|
+
console.log(` ${green}+${reset} Wired BASE hooks in settings.json`);
|
|
196
|
+
|
|
168
197
|
console.log(`
|
|
169
198
|
${green}Done!${reset} Open Qwen Code and type ${cyan}/base${reset} to start.
|
|
170
199
|
`);
|