log-llm-config 1.2.3 → 1.2.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.
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { existsSync, statSync
|
|
2
|
-
import { join } from 'node:path';
|
|
1
|
+
import { existsSync, statSync } from 'node:fs';
|
|
3
2
|
import { homedir } from 'node:os';
|
|
4
3
|
import { readJSONFile, readMCPConfig, readMarkdownFile, readInstalledExtensions } from '../readers/file_readers.js';
|
|
5
4
|
import { getExtensionsCachePath, getExtensionsCacheInstalledSuffix, getVscdbPath } from '../paths/path_constants_helpers.js';
|
|
@@ -93,18 +92,6 @@ function handleInstalledExtensions(handledSpecialPaths, configFiles, extensionsC
|
|
|
93
92
|
function collectConfigFilesFromPatterns(patterns, projectRoot, onProgress, options) {
|
|
94
93
|
// Prefer process.env.HOME so hook invoker (e.g. Cursor) can pass real home when it differs from os.homedir()
|
|
95
94
|
const home = (process.env.HOME && process.env.HOME.trim()) || homedir();
|
|
96
|
-
try {
|
|
97
|
-
const claudeSettingsPath = join(home, '.claude', 'settings.json');
|
|
98
|
-
writeFileSync(join(process.cwd(), '.optimus-home-debug.json'), JSON.stringify({
|
|
99
|
-
process_env_HOME: process.env.HOME ?? null,
|
|
100
|
-
homedir: homedir(),
|
|
101
|
-
resolved_home: home,
|
|
102
|
-
claude_settings_path: claudeSettingsPath,
|
|
103
|
-
claude_settings_exists: existsSync(claudeSettingsPath),
|
|
104
|
-
cwd: process.cwd(),
|
|
105
|
-
}, null, 2));
|
|
106
|
-
}
|
|
107
|
-
catch (_) { }
|
|
108
95
|
const pathConstants = options?.client_path_constants;
|
|
109
96
|
if (!pathConstants)
|
|
110
97
|
throw new Error('client_path_constants required from API response but not provided');
|
|
@@ -206,23 +206,30 @@ export function applyAutofixViolations(violations) {
|
|
|
206
206
|
fixed++;
|
|
207
207
|
hookRunLog(`autofix: applied uuid=${inst.uuid} path=${inst.config_file_path}`);
|
|
208
208
|
reportPromises.push(reportAutofixApplied(inst.uuid, 'success'));
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
209
|
+
const authKey = readStoredAuthKey();
|
|
210
|
+
if (authKey) {
|
|
211
|
+
let updatedContent;
|
|
212
|
+
try {
|
|
213
|
+
updatedContent = JSON.parse(readFileSync(inst.config_file_path, 'utf8'));
|
|
214
|
+
}
|
|
215
|
+
catch {
|
|
216
|
+
updatedContent = undefined;
|
|
217
|
+
}
|
|
218
|
+
if (updatedContent !== undefined) {
|
|
219
|
+
const fileType = (inst.file_type ?? '').trim();
|
|
220
|
+
if (fileType) {
|
|
221
|
+
reportPromises.push(sendConfigFile({ file_type: fileType, file_path: inst.config_file_path, raw_content: updatedContent }, resolveHardwareUuid(), authKey).then((sentOk) => {
|
|
222
|
+
hookRunLog(`autofix: uploaded remediated file uuid=${inst.uuid} path=${inst.config_file_path} ok=${sentOk}`);
|
|
222
223
|
}));
|
|
223
224
|
}
|
|
225
|
+
else {
|
|
226
|
+
hookRunLog(`autofix: skip upload uuid=${inst.uuid} — remediation_instructions.json missing file_type (re-sync manifest)`);
|
|
227
|
+
}
|
|
224
228
|
}
|
|
225
229
|
}
|
|
230
|
+
else {
|
|
231
|
+
hookRunLog(`autofix: skip re-upload uuid=${inst.uuid} (no stored auth key)`);
|
|
232
|
+
}
|
|
226
233
|
const spec = remediationFixSpec(inst);
|
|
227
234
|
if (spec?.restart_required && spec.restart_command) {
|
|
228
235
|
hookRunLog(`autofix: restart required uuid=${inst.uuid} command=${spec.restart_command}`);
|