sp-rag 0.6.3 → 0.6.5

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.3`
20
+ - version đang publish: `0.6.5`
21
21
  - binary public: `sp-rag`
22
22
 
23
23
  ## Cài từ source trong monorepo
@@ -66,6 +66,12 @@ Flow khuyên dùng sau khi đã có `grc_pat_*`:
66
66
  4. khi đổi token, chỉ cần `token add`
67
67
  5. khi muốn kiểm tra máy đang được cấu hình ra sao, dùng `explain`
68
68
 
69
+ Ghi chú:
70
+
71
+ - với `cursor` và `vscode` ở `scope project`, nếu Sếpp đang đứng sẵn trong repo thì có thể bỏ `--cwd`
72
+ - CLI sẽ tự dùng thư mục hiện tại cho cả MCP lẫn skill
73
+ - rule/agent mới đã được tăng độ ưu tiên MCP-first, giảm khả năng model nhảy thẳng sang grep/read file local
74
+
69
75
  Ví dụ:
70
76
 
71
77
  ```bash
package/dist/cli.js CHANGED
@@ -4,7 +4,7 @@ import { runEvaluationSuite } from './lib/eval.js';
4
4
  import { defaultBaseUrl, defaultMcpServerAlias, defaultMcpUrl, installMcpConfig, resolveMcpConfigPath, } from './lib/mcp-config.js';
5
5
  import { fetchJson, fetchText, runDoctor } from './lib/http.js';
6
6
  import { installSkill, resolveSkillInstallTarget, } from './lib/skill.js';
7
- const cliVersion = '0.6.3';
7
+ const cliVersion = '0.6.5';
8
8
  function parseArgv(argv) {
9
9
  const positionals = [];
10
10
  const options = {};
package/dist/lib/skill.js CHANGED
@@ -31,10 +31,11 @@ function normalizeScope(client, scope) {
31
31
  }
32
32
  }
33
33
  function requireProjectCwd(client, cwd) {
34
- if (!cwd?.trim()) {
34
+ const resolvedCwd = cwd?.trim() ? cwd : process.cwd();
35
+ if (!resolvedCwd.trim()) {
35
36
  throw new Error(`${client} cần --cwd hoặc --target-dir để cài skill theo project.`);
36
37
  }
37
- return path.resolve(cwd);
38
+ return path.resolve(resolvedCwd);
38
39
  }
39
40
  export function defaultSkillDir(client = 'codex', cwd, scope) {
40
41
  const normalizedScope = normalizeScope(client, scope);
@@ -61,7 +62,7 @@ export function defaultSkillDir(client = 'codex', cwd, scope) {
61
62
  function renderSkillMarkdown(context) {
62
63
  return `---
63
64
  name: sp-rag
64
- description: Use SP-RAG whenever the user asks about this codebase, internal business domain, rendered docs, import inventory, or codegraph sync status. Prefer MCP-backed evidence before answering from memory.
65
+ description: Use SP-RAG whenever the user asks about this codebase, internal business domain, rendered docs, import inventory, or codegraph sync status. You must call SP-RAG MCP tools first before answering from memory or reading local files.
65
66
  ---
66
67
 
67
68
  # SP-RAG
@@ -87,27 +88,30 @@ Docs URL: \`${context.docsUrl}\`
87
88
 
88
89
  ## Guardrails
89
90
 
91
+ - You must call SP-RAG MCP tools first for codebase or domain questions before using local workspace search, grep, or file reads.
90
92
  - Prefer MCP-grounded answers before relying on memory.
91
93
  - If the evidence may be stale, say so clearly and mention that the graph or docs may need a refresh.
92
94
  - Do not trigger sync or import actions unless the user asked for it or the workflow truly requires it.
93
95
  - When rendered docs already answer the question, cite or summarize those docs instead of rewriting everything from scratch.
96
+ - Only fall back to local workspace search or file reads after MCP is unavailable or clearly lacks the needed evidence, and say that you are falling back.
94
97
  `;
95
98
  }
96
99
  function renderCursorRule(context) {
97
100
  return `---
98
101
  description: Use SP-RAG when the request is about this codebase, internal business workflows, rendered docs, import inventory, or codegraph sync status.
99
102
  globs:
100
- alwaysApply: false
103
+ alwaysApply: true
101
104
  ---
102
105
 
103
106
  # SP-RAG
104
107
 
105
- - Prefer the \`${context.serverAlias}\` MCP server at \`${context.mcpUrl}\` before answering from memory.
108
+ - You must call the \`${context.serverAlias}\` MCP server first before using local workspace search, grep, or file reads for codebase and domain questions.
106
109
  - Use rendered docs from \`${context.docsUrl}\` when documentation already answers the question.
107
110
  - For architecture, domain, entities, relations, and business workflow questions, query MCP first and only then synthesize the answer.
108
111
  - For freshness or operational questions, check sync status, recent runs, and metrics before assuming the graph is current.
109
112
  - Only trigger codegraph sync when the user explicitly asks for it or stale evidence is the confirmed blocker.
110
113
  - If the evidence may be stale, say so clearly.
114
+ - Only fall back to local workspace search after MCP is unavailable or clearly lacks the needed evidence, and say that you are falling back.
111
115
  `;
112
116
  }
113
117
  function renderVsCodeAgent(context) {
@@ -121,6 +125,8 @@ You are the SP-RAG custom agent for this workspace.
121
125
 
122
126
  Use the \`${context.serverAlias}\` MCP server at \`${context.mcpUrl}\` and the rendered docs URL \`${context.docsUrl}\` as your grounded source of truth.
123
127
 
128
+ You must call an SP-RAG MCP tool before using local workspace search, grep, or file reads for codebase and domain questions.
129
+
124
130
  ## Recommended Workflow
125
131
 
126
132
  1. Start with \`healthz\` if connectivity or freshness is uncertain.
@@ -132,9 +138,11 @@ Use the \`${context.serverAlias}\` MCP server at \`${context.mcpUrl}\` and the r
132
138
  ## Guardrails
133
139
 
134
140
  - Prefer MCP-grounded evidence before answering from memory.
141
+ - Do not use local workspace search, grep, or file reads until SP-RAG MCP has been tried first for the current question.
135
142
  - When evidence may be stale, say so clearly and mention that a refresh might be needed.
136
143
  - Do not trigger sync or import actions unless the workflow truly requires it.
137
144
  - When rendered docs already answer the question, summarize those docs instead of rewriting everything from scratch.
145
+ - Only fall back to local workspace search or file reads after MCP is unavailable or clearly lacks the needed evidence, and say that you are falling back.
138
146
  `;
139
147
  }
140
148
  function renderSkillArtifact(context) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sp-rag",
3
- "version": "0.6.3",
3
+ "version": "0.6.5",
4
4
  "description": "CLI cho setup MCP, codegraph GitNexus và skill của SP-RAG",
5
5
  "type": "module",
6
6
  "files": [