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 CHANGED
@@ -17,7 +17,7 @@ CLI để setup nhanh SP-RAG theo hướng dev-friendly:
17
17
  ## Trạng thái package
18
18
 
19
19
  - package npm public: `sp-rag`
20
- - version đang publish: `0.6.13`
20
+ - version đang publish: `0.6.14`
21
21
  - binary public: `sp-rag`
22
22
 
23
23
  ## Cài từ source trong monorepo
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')) {
@@ -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 (!content) {
26
+ if (content === null) {
26
27
  return null;
27
28
  }
28
- return JSON.parse(content);
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);
@@ -0,0 +1,6 @@
1
+ export function stripUtf8Bom(content) {
2
+ return content.replace(/^\uFEFF/, '');
3
+ }
4
+ export function parseJsonWithBom(content) {
5
+ return JSON.parse(stripUtf8Bom(content));
6
+ }
@@ -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() ? JSON.parse(existing) : {};
12
+ return existing?.trim() ? parseJsonWithBom(existing) : {};
12
13
  }
13
14
  function withHeaders(target, headers) {
14
15
  if (!headers) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sp-rag",
3
- "version": "0.6.13",
3
+ "version": "0.6.14",
4
4
  "description": "CLI cho setup MCP, codegraph GitNexus và skill của SP-RAG",
5
5
  "type": "module",
6
6
  "files": [