@plur-ai/core 0.9.6 → 0.9.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.
- package/dist/index.js +24 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -283,10 +283,31 @@ var PlurConfigSchema = z.object({
|
|
|
283
283
|
// src/config.ts
|
|
284
284
|
function loadConfig(configPath) {
|
|
285
285
|
if (!existsSync3(configPath)) return PlurConfigSchema.parse({});
|
|
286
|
+
let raw;
|
|
286
287
|
try {
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
288
|
+
raw = yaml.load(readFileSync(configPath, "utf8")) ?? {};
|
|
289
|
+
} catch (err) {
|
|
290
|
+
logger.warning(`[plur:config] cannot parse YAML at ${configPath}: ${err.message} \u2014 falling back to defaults`);
|
|
291
|
+
return PlurConfigSchema.parse({});
|
|
292
|
+
}
|
|
293
|
+
if (Array.isArray(raw.stores)) {
|
|
294
|
+
const validStores = [];
|
|
295
|
+
for (let i = 0; i < raw.stores.length; i++) {
|
|
296
|
+
const entry = raw.stores[i];
|
|
297
|
+
const parsed = StoreEntrySchema.safeParse(entry);
|
|
298
|
+
if (parsed.success) {
|
|
299
|
+
validStores.push(entry);
|
|
300
|
+
} else {
|
|
301
|
+
const label = entry?.scope ?? entry?.url ?? entry?.path ?? `index ${i}`;
|
|
302
|
+
logger.warning(`[plur:config] dropping invalid stores[${i}] (${label}) from ${configPath}: ${parsed.error.issues.map((it) => it.message).join("; ")}`);
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
raw.stores = validStores;
|
|
306
|
+
}
|
|
307
|
+
try {
|
|
308
|
+
return PlurConfigSchema.parse(raw);
|
|
309
|
+
} catch (err) {
|
|
310
|
+
logger.warning(`[plur:config] top-level config invalid at ${configPath}: ${err.message} \u2014 falling back to defaults`);
|
|
290
311
|
return PlurConfigSchema.parse({});
|
|
291
312
|
}
|
|
292
313
|
}
|