log-llm-config 1.3.5 → 1.3.6
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.
|
@@ -92,6 +92,11 @@ export function readVscdbItemTableJson(dbPath, itemKey) {
|
|
|
92
92
|
}
|
|
93
93
|
// Bare JSON primitives (e.g. cursor/thirdPartyExtensibilityEnabled stores `true`/`false`).
|
|
94
94
|
if (typeof parsed === 'boolean' || typeof parsed === 'number' || typeof parsed === 'string') {
|
|
95
|
+
const leaf = itemKey.split('/').pop() ?? '';
|
|
96
|
+
// Legacy cursorai/donotchange/privacyMode row is bare true/false; compliance paths use …/privacyMode.privacyMode.
|
|
97
|
+
if (typeof parsed === 'boolean' && leaf === 'privacyMode') {
|
|
98
|
+
return { [itemKey]: { privacyMode: parsed } };
|
|
99
|
+
}
|
|
95
100
|
return { [itemKey]: parsed };
|
|
96
101
|
}
|
|
97
102
|
return { [itemKey]: {} };
|
|
@@ -20,6 +20,14 @@ import { readStoredAuthKey } from '../auth/auth_key_store.js';
|
|
|
20
20
|
// ---------------------------------------------------------------------------
|
|
21
21
|
// Helpers
|
|
22
22
|
// ---------------------------------------------------------------------------
|
|
23
|
+
/**
|
|
24
|
+
* ItemTable keys use slashes (e.g. cursorai/donotchange/privacyMode) and do not contain dots.
|
|
25
|
+
* Compliance setting_path is `${itemKey}.${nested.path}` — take the segment before the first `.`.
|
|
26
|
+
*/
|
|
27
|
+
export function itemTableKeyFromSettingPath(settingPath) {
|
|
28
|
+
const i = settingPath.indexOf('.');
|
|
29
|
+
return i === -1 ? settingPath : settingPath.slice(0, i);
|
|
30
|
+
}
|
|
23
31
|
/** Traverse a JSON object using dot-notation path. Returns undefined if any segment is missing. */
|
|
24
32
|
export function getByPath(obj, path) {
|
|
25
33
|
const parts = path.split('.');
|
|
@@ -85,20 +93,25 @@ function verifyOpsApplied(configJson, settingPath, ops) {
|
|
|
85
93
|
}
|
|
86
94
|
return { ok: true, expected: null };
|
|
87
95
|
}
|
|
88
|
-
/** Plain JSON file or virtual `…/state.vscdb#
|
|
89
|
-
function loadRemediationConfigJson(configFilePath) {
|
|
96
|
+
/** Plain JSON file or virtual `…/state.vscdb#itemKey` path for ItemTable-backed settings. */
|
|
97
|
+
function loadRemediationConfigJson(configFilePath, checkSettingPaths = []) {
|
|
90
98
|
const hashIdx = configFilePath.indexOf('#');
|
|
91
99
|
if (hashIdx >= 0) {
|
|
92
100
|
const dbPath = configFilePath.slice(0, hashIdx);
|
|
93
|
-
const
|
|
94
|
-
if (!
|
|
101
|
+
const itemKeyFromPath = configFilePath.slice(hashIdx + 1).trim();
|
|
102
|
+
if (!itemKeyFromPath)
|
|
95
103
|
return { ok: false, reason: 'empty_vscdb_key' };
|
|
96
104
|
if (!existsSync(dbPath))
|
|
97
105
|
return { ok: false, reason: 'db_not_found' };
|
|
98
|
-
const
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
106
|
+
const keys = new Set([itemKeyFromPath, ...checkSettingPaths.map(itemTableKeyFromSettingPath)].filter(Boolean));
|
|
107
|
+
const merged = {};
|
|
108
|
+
for (const k of keys) {
|
|
109
|
+
const wrapped = readVscdbItemTableJson(dbPath, k);
|
|
110
|
+
if (wrapped === null)
|
|
111
|
+
return { ok: false, reason: 'vscdb_read_failed' };
|
|
112
|
+
Object.assign(merged, wrapped);
|
|
113
|
+
}
|
|
114
|
+
return { ok: true, json: merged };
|
|
102
115
|
}
|
|
103
116
|
if (!existsSync(configFilePath))
|
|
104
117
|
return { ok: false, reason: 'file_not_found' };
|
|
@@ -137,7 +150,7 @@ export function runLocalRemediationComplianceCheck() {
|
|
|
137
150
|
const checks = compliance.checks ?? [];
|
|
138
151
|
if (checks.length === 0)
|
|
139
152
|
continue;
|
|
140
|
-
const loaded = loadRemediationConfigJson(entry.config_file_path);
|
|
153
|
+
const loaded = loadRemediationConfigJson(entry.config_file_path, checks.map((c) => c.setting_path));
|
|
141
154
|
if (!loaded.ok) {
|
|
142
155
|
const msg = loaded.reason === 'file_not_found'
|
|
143
156
|
? `compliance_check: config file not found, skipping uuid=${entry.uuid}`
|
|
@@ -374,7 +387,7 @@ export function pruneSatisfiedOneTimeRemediations() {
|
|
|
374
387
|
remaining.push(raw);
|
|
375
388
|
continue;
|
|
376
389
|
}
|
|
377
|
-
const prLoaded = loadRemediationConfigJson(inst.config_file_path);
|
|
390
|
+
const prLoaded = loadRemediationConfigJson(inst.config_file_path, checks.map((c) => c.setting_path));
|
|
378
391
|
if (!prLoaded.ok) {
|
|
379
392
|
remaining.push(raw);
|
|
380
393
|
continue;
|