sp-rag 0.6.13 → 0.6.14
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/README.md +1 -1
- package/dist/cli.js +3 -0
- package/dist/lib/config-store.js +7 -2
- package/dist/lib/json.js +6 -0
- package/dist/lib/mcp-config.js +2 -1
- package/package.json +1 -1
package/README.md
CHANGED
package/dist/cli.js
CHANGED
|
@@ -426,6 +426,9 @@ async function emitDoctorReport(parsed, defaults, explicitClient, checks) {
|
|
|
426
426
|
async function runClientSetup(parsed, defaults, client) {
|
|
427
427
|
const nextDefaults = deriveDefaultsForClient(parsed, defaults, client);
|
|
428
428
|
validateStoredToken(nextDefaults);
|
|
429
|
+
if (!optionFlag(parsed, 'skip-mcp')) {
|
|
430
|
+
resolveAuthForMcp(parsed, nextDefaults);
|
|
431
|
+
}
|
|
429
432
|
const configPath = await saveResolvedConfig(nextDefaults);
|
|
430
433
|
process.stdout.write(`Đã lưu config CLI tại ${configPath}\n`);
|
|
431
434
|
if (!optionFlag(parsed, 'skip-mcp')) {
|
package/dist/lib/config-store.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import os from 'node:os';
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import { mkdir, readFile, rm, writeFile } from 'node:fs/promises';
|
|
4
|
+
import { parseJsonWithBom, stripUtf8Bom } from './json.js';
|
|
4
5
|
function stripUndefined(value) {
|
|
5
6
|
return Object.fromEntries(Object.entries(value).filter(([, entry]) => entry !== undefined));
|
|
6
7
|
}
|
|
@@ -22,10 +23,14 @@ export async function loadCliConfig(homeDir) {
|
|
|
22
23
|
}
|
|
23
24
|
throw error;
|
|
24
25
|
});
|
|
25
|
-
if (
|
|
26
|
+
if (content === null) {
|
|
26
27
|
return null;
|
|
27
28
|
}
|
|
28
|
-
|
|
29
|
+
const normalized = stripUtf8Bom(content);
|
|
30
|
+
if (!normalized.trim()) {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
return parseJsonWithBom(normalized);
|
|
29
34
|
}
|
|
30
35
|
export async function saveCliConfig(config, homeDir) {
|
|
31
36
|
const filePath = resolveCliConfigPath(homeDir);
|
package/dist/lib/json.js
ADDED
package/dist/lib/mcp-config.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import os from 'node:os';
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import { mkdir, readFile, writeFile } from 'node:fs/promises';
|
|
4
|
+
import { parseJsonWithBom } from './json.js';
|
|
4
5
|
function escapeRegex(value) {
|
|
5
6
|
return value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
6
7
|
}
|
|
@@ -8,7 +9,7 @@ function quotedTomlKey(value) {
|
|
|
8
9
|
return `"${value.replace(/"/g, '\\"')}"`;
|
|
9
10
|
}
|
|
10
11
|
function parseJsonObject(existing) {
|
|
11
|
-
return existing?.trim() ?
|
|
12
|
+
return existing?.trim() ? parseJsonWithBom(existing) : {};
|
|
12
13
|
}
|
|
13
14
|
function withHeaders(target, headers) {
|
|
14
15
|
if (!headers) {
|