autosnippet 2.6.0 → 2.7.0
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/bin/cli.js +1 -1
- package/dashboard/dist/assets/{icons-rnn04CvH.js → icons-Cq4-iQhP.js} +148 -88
- package/dashboard/dist/assets/index-DBxH7pVn.css +1 -0
- package/dashboard/dist/assets/index-Dw2F6qAS.js +197 -0
- package/dashboard/dist/assets/{react-markdown-CWxUbOf4.js → react-markdown-BA6FB2NP.js} +1 -1
- package/dashboard/dist/assets/{syntax-highlighter-CJ2drQQb.js → syntax-highlighter-CVLHn9O5.js} +1 -1
- package/dashboard/dist/assets/{vendor-f83ah6cm.js → vendor-BotF760a.js} +61 -61
- package/dashboard/dist/index.html +6 -6
- package/lib/bootstrap.js +1 -1
- package/lib/cli/SetupService.js +33 -8
- package/lib/cli/UpgradeService.js +139 -2
- package/lib/core/ast/ProjectGraph.js +599 -0
- package/lib/core/gateway/GatewayActionRegistry.js +2 -2
- package/lib/domain/recipe/Recipe.js +3 -0
- package/lib/external/ai/AiProvider.js +83 -20
- package/lib/external/ai/providers/ClaudeProvider.js +197 -0
- package/lib/external/ai/providers/GoogleGeminiProvider.js +235 -1
- package/lib/external/ai/providers/OpenAiProvider.js +131 -0
- package/lib/external/mcp/handlers/bootstrap/pipeline/dimension-context.js +216 -0
- package/lib/external/mcp/handlers/bootstrap/pipeline/orchestrator.js +468 -0
- package/lib/external/mcp/handlers/bootstrap/pipeline/tier-scheduler.js +162 -0
- package/lib/external/mcp/handlers/bootstrap/skills.js +225 -0
- package/lib/external/mcp/handlers/bootstrap.js +151 -1634
- package/lib/external/mcp/handlers/browse.js +1 -1
- package/lib/external/mcp/handlers/candidate.js +1 -33
- package/lib/external/mcp/handlers/skill.js +54 -17
- package/lib/external/mcp/tools.js +4 -3
- package/lib/http/middleware/requestLogger.js +23 -4
- package/lib/http/routes/ai.js +3 -1
- package/lib/http/routes/auth.js +3 -2
- package/lib/http/routes/candidates.js +49 -25
- package/lib/http/routes/commands.js +0 -8
- package/lib/http/routes/guardRules.js +1 -16
- package/lib/http/routes/recipes.js +4 -17
- package/lib/http/routes/search.js +11 -19
- package/lib/http/routes/skills.js +2 -0
- package/lib/http/routes/snippets.js +0 -33
- package/lib/http/routes/spm.js +37 -63
- package/lib/http/utils/routeHelpers.js +31 -0
- package/lib/infrastructure/config/Paths.js +9 -0
- package/lib/infrastructure/logging/Logger.js +86 -3
- package/lib/infrastructure/realtime/RealtimeService.js +2 -5
- package/lib/infrastructure/vector/JsonVectorAdapter.js +24 -1
- package/lib/injection/ServiceContainer.js +55 -2
- package/lib/service/bootstrap/BootstrapTaskManager.js +400 -0
- package/lib/service/candidate/CandidateFileWriter.js +68 -27
- package/lib/service/candidate/CandidateService.js +156 -10
- package/lib/service/chat/AnalystAgent.js +216 -0
- package/lib/service/chat/CandidateGuardrail.js +134 -0
- package/lib/service/chat/ChatAgent.js +1036 -167
- package/lib/service/chat/ContextWindow.js +730 -0
- package/lib/service/chat/HandoffProtocol.js +180 -0
- package/lib/service/chat/ProducerAgent.js +240 -0
- package/lib/service/chat/ToolRegistry.js +149 -5
- package/lib/service/chat/tools.js +1397 -61
- package/lib/service/recipe/RecipeFileWriter.js +12 -1
- package/lib/service/skills/SignalCollector.js +31 -6
- package/lib/service/skills/SkillAdvisor.js +2 -1
- package/lib/service/skills/SkillHooks.js +13 -5
- package/lib/service/spm/SpmService.js +2 -2
- package/package.json +1 -1
- package/templates/copilot-instructions.md +20 -3
- package/templates/cursor-rules/autosnippet-conventions.mdc +21 -4
- package/templates/cursor-rules/autosnippet-skills.mdc +45 -0
- package/dashboard/dist/assets/index-BBKa3Dgi.js +0 -195
- package/dashboard/dist/assets/index-DLsECfzW.css +0 -1
|
@@ -300,7 +300,18 @@ export class RecipeFileWriter {
|
|
|
300
300
|
}
|
|
301
301
|
if (recipe.content?.steps?.length > 0) {
|
|
302
302
|
parts.push('### 使用步骤\n');
|
|
303
|
-
recipe.content.steps.forEach((step, i) => {
|
|
303
|
+
recipe.content.steps.forEach((step, i) => {
|
|
304
|
+
if (typeof step === 'string') {
|
|
305
|
+
parts.push(`${i + 1}. ${step}`);
|
|
306
|
+
} else {
|
|
307
|
+
const title = step.title || '';
|
|
308
|
+
const desc = step.description || '';
|
|
309
|
+
const code = step.code || '';
|
|
310
|
+
const text = [title, desc].filter(Boolean).join(': ');
|
|
311
|
+
parts.push(`${i + 1}. ${text || '(步骤)'}`);
|
|
312
|
+
if (code) { parts.push(''); parts.push(`\`\`\`\n${code}\n\`\`\``); }
|
|
313
|
+
}
|
|
314
|
+
});
|
|
304
315
|
parts.push('');
|
|
305
316
|
}
|
|
306
317
|
if (recipe.constraints?.boundaries?.length > 0) {
|
|
@@ -76,14 +76,14 @@ export class SignalCollector {
|
|
|
76
76
|
projectRoot,
|
|
77
77
|
database = null,
|
|
78
78
|
chatAgent = null,
|
|
79
|
-
mode = '
|
|
79
|
+
mode = 'auto',
|
|
80
80
|
intervalMs = DEFAULT_INTERVAL_MS,
|
|
81
81
|
onSuggestions = null,
|
|
82
82
|
}) {
|
|
83
83
|
this.#projectRoot = projectRoot;
|
|
84
84
|
this.#db = database;
|
|
85
85
|
this.#chatAgent = chatAgent;
|
|
86
|
-
this.#mode = ['off', 'suggest', 'auto'].includes(mode) ? mode : '
|
|
86
|
+
this.#mode = ['off', 'suggest', 'auto'].includes(mode) ? mode : 'auto';
|
|
87
87
|
this.#intervalMs = Math.max(Math.min(intervalMs, MAX_INTERVAL_MS), MIN_INTERVAL_MS);
|
|
88
88
|
this.#logger = Logger.getInstance();
|
|
89
89
|
this.#onSuggestions = onSuggestions;
|
|
@@ -160,6 +160,16 @@ export class SignalCollector {
|
|
|
160
160
|
getSnapshot() { return { ...this.#snapshot }; }
|
|
161
161
|
getMode() { return this.#mode; }
|
|
162
162
|
|
|
163
|
+
/** 从 pendingSuggestions 中移除已创建的 Skill */
|
|
164
|
+
removePendingSuggestion(name) {
|
|
165
|
+
if (!this.#snapshot.pendingSuggestions?.length) return;
|
|
166
|
+
this.#snapshot.pendingSuggestions = this.#snapshot.pendingSuggestions.filter(s => s.name !== name);
|
|
167
|
+
if (this.#snapshot.lastResult) {
|
|
168
|
+
this.#snapshot.lastResult.newSuggestions = this.#snapshot.pendingSuggestions.length;
|
|
169
|
+
}
|
|
170
|
+
this.#saveSnapshot();
|
|
171
|
+
}
|
|
172
|
+
|
|
163
173
|
setMode(mode) {
|
|
164
174
|
if (!['off', 'suggest', 'auto'].includes(mode)) return;
|
|
165
175
|
this.#mode = mode;
|
|
@@ -211,6 +221,17 @@ export class SignalCollector {
|
|
|
211
221
|
newSuggestions: newSuggestions.length,
|
|
212
222
|
aiToolCalls: toolCalls?.length || 0,
|
|
213
223
|
};
|
|
224
|
+
// 持久化 AI 生成的建议,供前端直接读取
|
|
225
|
+
if (newSuggestions.length > 0) {
|
|
226
|
+
this.#snapshot.pendingSuggestions = newSuggestions.map(s => ({
|
|
227
|
+
name: s.name,
|
|
228
|
+
description: s.description || s.reason || '',
|
|
229
|
+
rationale: s.rationale || s.reason || '',
|
|
230
|
+
body: s.body || '',
|
|
231
|
+
source: s.source || 'signal-collector',
|
|
232
|
+
priority: s.priority || 'medium',
|
|
233
|
+
}));
|
|
234
|
+
}
|
|
214
235
|
|
|
215
236
|
if (newSuggestions.length > 0) {
|
|
216
237
|
for (const s of newSuggestions) {
|
|
@@ -403,14 +424,16 @@ ${JSON.stringify(signals.codeChanges, null, 2)}
|
|
|
403
424
|
|
|
404
425
|
1. 综合分析以上 6 个维度的信号
|
|
405
426
|
2. 识别重复模式、高频错误、未覆盖的操作
|
|
406
|
-
3.
|
|
407
|
-
4.
|
|
408
|
-
5.
|
|
427
|
+
3. **只推荐项目特有的知识模式**,不要推荐通用编程知识(如 Git 基础、语言语法等)
|
|
428
|
+
4. 推荐的 Skill 应该能固化团队/项目的独有约定、架构决策或反复出现的问题解决方案
|
|
429
|
+
5. 根据信号密度判断下次分析应间隔多久(5-1440 分钟)
|
|
430
|
+
6. 给出简要分析摘要
|
|
431
|
+
7. 如果没有发现值得推荐的项目特有模式,返回空的 suggestions 数组
|
|
409
432
|
|
|
410
433
|
## 输出格式
|
|
411
434
|
|
|
412
435
|
在你的回复最后一行,输出一个 JSON 对象(不要包在 markdown code block 中):
|
|
413
|
-
{"suggestions":[{"name":"skill-name","reason":"推荐原因","priority":"high|medium|low","body":"推荐的 Skill 内容"}],"nextIntervalMinutes":60,"summary":"一句话分析摘要"}`;
|
|
436
|
+
{"suggestions":[{"name":"skill-name","description":"一句话中文描述","reason":"推荐原因","priority":"high|medium|low","body":"推荐的 Skill 内容"}],"nextIntervalMinutes":60,"summary":"一句话分析摘要"}`;
|
|
414
437
|
}
|
|
415
438
|
|
|
416
439
|
// ═══════════════════════════════════════════════════════
|
|
@@ -473,6 +496,7 @@ ${JSON.stringify(signals.codeChanges, null, 2)}
|
|
|
473
496
|
lastResult: data.lastResult || null,
|
|
474
497
|
lastAiSummary: data.lastAiSummary || '',
|
|
475
498
|
autoCreated: Array.isArray(data.autoCreated) ? data.autoCreated : [],
|
|
499
|
+
pendingSuggestions: Array.isArray(data.pendingSuggestions) ? data.pendingSuggestions : [],
|
|
476
500
|
};
|
|
477
501
|
}
|
|
478
502
|
} catch { /* corrupt — reset */ }
|
|
@@ -484,6 +508,7 @@ ${JSON.stringify(signals.codeChanges, null, 2)}
|
|
|
484
508
|
lastResult: null,
|
|
485
509
|
lastAiSummary: '',
|
|
486
510
|
autoCreated: [],
|
|
511
|
+
pendingSuggestions: [],
|
|
487
512
|
};
|
|
488
513
|
}
|
|
489
514
|
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
|
|
18
18
|
import fs from 'node:fs';
|
|
19
19
|
import path from 'node:path';
|
|
20
|
+
import { getProjectSkillsPath } from '../../infrastructure/config/Paths.js';
|
|
20
21
|
|
|
21
22
|
export class SkillAdvisor {
|
|
22
23
|
#projectRoot;
|
|
@@ -299,7 +300,7 @@ export class SkillAdvisor {
|
|
|
299
300
|
*/
|
|
300
301
|
#listExistingProjectSkills() {
|
|
301
302
|
const names = new Set();
|
|
302
|
-
const dir =
|
|
303
|
+
const dir = getProjectSkillsPath(this.#projectRoot);
|
|
303
304
|
try {
|
|
304
305
|
fs.readdirSync(dir, { withFileTypes: true })
|
|
305
306
|
.filter(d => d.isDirectory())
|
|
@@ -10,18 +10,26 @@
|
|
|
10
10
|
* - onGuardCheck(violation, ctx) → violation (可修改)
|
|
11
11
|
* - onBootstrapComplete(stats, ctx) → void
|
|
12
12
|
*
|
|
13
|
-
* 加载顺序: 内置 skills/ → 项目级
|
|
13
|
+
* 加载顺序: 内置 skills/ → 项目级 AutoSnippet/skills/(同名覆盖)
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
16
|
import fs from 'node:fs';
|
|
17
17
|
import path from 'node:path';
|
|
18
18
|
import { fileURLToPath } from 'node:url';
|
|
19
19
|
import Logger from '../../infrastructure/logging/Logger.js';
|
|
20
|
+
import { getProjectSkillsPath } from '../../infrastructure/config/Paths.js';
|
|
20
21
|
|
|
21
22
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
const SKILLS_DIR = path.resolve(__dirname, '../../../skills');
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* 获取项目级 Skills 目录(运行时动态解析)
|
|
27
|
+
* 路径: {projectRoot}/AutoSnippet/skills/
|
|
28
|
+
*/
|
|
29
|
+
function _getProjectSkillsDir() {
|
|
30
|
+
const projectRoot = process.env.ASD_PROJECT_DIR || process.cwd();
|
|
31
|
+
return getProjectSkillsPath(projectRoot);
|
|
32
|
+
}
|
|
25
33
|
|
|
26
34
|
const HOOK_NAMES = [
|
|
27
35
|
'onCandidateSubmit',
|
|
@@ -48,7 +56,7 @@ export class SkillHooks {
|
|
|
48
56
|
await this.#loadFromDir(SKILLS_DIR, loaded);
|
|
49
57
|
|
|
50
58
|
// 2. 项目级 skills(覆盖同名)
|
|
51
|
-
await this.#loadFromDir(
|
|
59
|
+
await this.#loadFromDir(_getProjectSkillsDir(), loaded);
|
|
52
60
|
|
|
53
61
|
// 3. 注册所有钩子
|
|
54
62
|
for (const [skillName, mod] of loaded) {
|
|
@@ -650,7 +650,7 @@ export class SpmService {
|
|
|
650
650
|
const CODE_EXTS = isDirectoryTarget
|
|
651
651
|
? new Set(['.swift', '.m', '.mm', '.h', '.c', '.cpp', '.js', '.ts', '.tsx', '.jsx', '.py', '.java', '.kt', '.go', '.rs', '.rb', '.vue', '.mjs', '.cjs'])
|
|
652
652
|
: new Set(['.swift', '.m', '.h', '.c', '.cpp', '.mm']);
|
|
653
|
-
const SKIP_DIRS = new Set(['node_modules', '.git', 'dist', 'build', '.next', 'Pods', '.build', 'DerivedData', 'vendor', '__pycache__', '.venv', 'target']);
|
|
653
|
+
const SKIP_DIRS = new Set(['node_modules', '.git', 'dist', 'build', '.next', 'Pods', 'Carthage', '.build', 'DerivedData', 'vendor', '__pycache__', '.venv', 'target']);
|
|
654
654
|
const MAX_FILES = 300;
|
|
655
655
|
|
|
656
656
|
const files = [];
|
|
@@ -889,7 +889,7 @@ export class SpmService {
|
|
|
889
889
|
// 非 SPM 项目:直接扫描常见源码目录(fallback)
|
|
890
890
|
this.#logger.info('[SpmService] scanProject: No SPM targets, falling back to directory scan');
|
|
891
891
|
const CODE_EXTS = new Set(['.swift', '.m', '.mm', '.h', '.js', '.ts', '.tsx', '.jsx', '.py', '.java', '.kt', '.go', '.rs', '.rb', '.vue', '.mjs', '.cjs']);
|
|
892
|
-
const SKIP_DIRS = new Set(['node_modules', '.git', 'dist', 'build', '.next', 'Pods', '.build', 'DerivedData', 'vendor', '__pycache__', '.venv', 'target']);
|
|
892
|
+
const SKIP_DIRS = new Set(['node_modules', '.git', 'dist', 'build', '.next', 'Pods', 'Carthage', '.build', 'DerivedData', 'vendor', '__pycache__', '.venv', 'target']);
|
|
893
893
|
const srcDirs = ['Sources', 'src', 'lib', 'app', 'pages', 'components', 'modules', 'packages'];
|
|
894
894
|
|
|
895
895
|
const walkDir = (dir, targetName) => {
|
package/package.json
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
## 知识库与结构
|
|
10
10
|
- 知识库根目录:`AutoSnippet/`(用户项目可通过 boxspec `knowledgeBase.dir` 自定义)
|
|
11
11
|
- Recipe:`AutoSnippet/recipes/*.md`(Markdown + Frontmatter + Snippet + Usage Guide)
|
|
12
|
+
- **Project Skills**:`AutoSnippet/skills/<name>/SKILL.md`(项目级 AI 知识增强文档,跟随 Git)
|
|
12
13
|
- constitution.yaml:`AutoSnippet/constitution.yaml`(权限宪法:角色 + 能力 + 治理规则)
|
|
13
14
|
- 运行时 DB:`.autosnippet/autosnippet.db`(SQLite,recipes/candidates/snippets 索引缓存)
|
|
14
15
|
- 向量索引:`.autosnippet/context/`(`asd embed` 生成)
|
|
@@ -51,14 +52,21 @@
|
|
|
51
52
|
- `autosnippet_submit_draft_recipes` — 解析草稿 Markdown 文件
|
|
52
53
|
- `autosnippet_enrich_candidates` — AI 补全缺失语义字段
|
|
53
54
|
|
|
54
|
-
### 项目扫描
|
|
55
|
+
### 项目扫描 & 冷启动
|
|
55
56
|
- `autosnippet_get_targets` / `autosnippet_get_target_files` / `autosnippet_get_target_metadata`
|
|
56
57
|
- `autosnippet_scan_project` — 轻量探查(文件清单 + Guard 审计)
|
|
57
|
-
- `autosnippet_bootstrap_knowledge` — 冷启动知识库初始化(9
|
|
58
|
+
- `autosnippet_bootstrap_knowledge` — 冷启动知识库初始化(9 维度 + 自动生成 Project Skills)
|
|
59
|
+
- `autosnippet_bootstrap_refine` — Bootstrap 候选 AI 润色(summary/insight/relations)
|
|
58
60
|
|
|
59
61
|
### Guard & 治理
|
|
60
62
|
- `autosnippet_guard_check` / `autosnippet_guard_audit_files` / `autosnippet_compliance_report`
|
|
61
63
|
|
|
64
|
+
### Skills
|
|
65
|
+
- `autosnippet_list_skills` — 列出所有可用 Skills(内置 + 项目级)
|
|
66
|
+
- `autosnippet_load_skill` — 加载 Skill 完整文档
|
|
67
|
+
- `autosnippet_create_skill` — 创建项目级 Skill(写入 `AutoSnippet/skills/`)
|
|
68
|
+
- `autosnippet_suggest_skills` — 基于使用模式推荐创建 Skill
|
|
69
|
+
|
|
62
70
|
### 其它
|
|
63
71
|
- `autosnippet_health` / `autosnippet_capabilities` / `autosnippet_confirm_usage`
|
|
64
72
|
|
|
@@ -67,10 +75,19 @@
|
|
|
67
75
|
- Frontmatter 必填字段(7):`title`、`trigger`(@开头)、`category`(8 选 1)、`language`、`summary_cn`、`summary_en`、`headers`。
|
|
68
76
|
- Usage Guide 必须用 `###` 三级标题分段,列表式书写,禁止一行文字墙。
|
|
69
77
|
|
|
78
|
+
## Project Skills
|
|
79
|
+
- **发现**:`autosnippet_list_skills` — 列出所有可用 Skills(内置 + 项目级)
|
|
80
|
+
- **加载**:`autosnippet_load_skill(skillName)` — 获取 Skill 完整操作指南
|
|
81
|
+
- **创建**:`autosnippet_create_skill(name, description, content)` — 创建项目级 Skill
|
|
82
|
+
- **推荐**:`autosnippet_suggest_skills` — 基于使用模式推荐创建 Skill
|
|
83
|
+
- **Bootstrap 自动生成**:冷启动 Phase 5.5 自动生成 4 个 Project Skills(code-standard, architecture, project-profile, agent-guidelines)
|
|
84
|
+
- **优先级**:项目级 Skill 同名覆盖内置;宏观知识查 Skill,微观代码模式查 Recipe
|
|
85
|
+
|
|
70
86
|
## 推荐工作流
|
|
71
87
|
- **查找**:`autosnippet_search`(推荐)或 `autosnippet_context_search`(上下文感知)。
|
|
72
88
|
- **产出候选**:`autosnippet_validate_candidate` 预校验 → `autosnippet_submit_candidate` 提交。
|
|
73
|
-
-
|
|
89
|
+
- **冷启动**:`autosnippet_bootstrap_knowledge` → `autosnippet_enrich_candidates` → `autosnippet_bootstrap_refine` → 逐 Target 深入 → `autosnippet_submit_candidates`。
|
|
90
|
+
- **Skills 创建**:`autosnippet_suggest_skills` 分析 → `autosnippet_create_skill` 固化知识。
|
|
74
91
|
- **采纳反馈**:`autosnippet_confirm_usage`(记录使用量影响排序权重)。
|
|
75
92
|
|
|
76
93
|
## 与 Cursor 规则联动
|
|
@@ -41,9 +41,19 @@ Recipes are classified into three kinds:
|
|
|
41
41
|
- **Retry policy**: If an MCP call fails, do not retry within the same agent turn; fall back to static docs or already-read context.
|
|
42
42
|
- **Adoption tracking**: Tool `autosnippet_confirm_usage` records that a Recipe was adopted or applied (affects usage stats and authority ranking). Show it when the user explicitly adopts a recipe, not immediately after presenting one.
|
|
43
43
|
- **Batch scan**: Ask Cursor in natural language (e.g. "scan all targets in this project", "batch extract candidates") to trigger the batch-scan workflow. The workflow calls `autosnippet_get_targets` → `autosnippet_get_target_files` → extract per file → `autosnippet_submit_candidates` automatically.
|
|
44
|
-
- **Cold start**: Use `autosnippet_bootstrap_knowledge` for full project knowledge initialization covering 9 dimensions
|
|
44
|
+
- **Cold start**: Use `autosnippet_bootstrap_knowledge` for full project knowledge initialization covering 9 dimensions. Phase 5.5 auto-generates 4 Project Skills (code-standard, architecture, project-profile, agent-guidelines) to `AutoSnippet/skills/`.
|
|
45
45
|
|
|
46
|
-
##
|
|
46
|
+
## Project Skills
|
|
47
|
+
|
|
48
|
+
- **Skills 目录**: `AutoSnippet/skills/<name>/SKILL.md` — 跟随项目 Git 管理
|
|
49
|
+
- **发现**: `autosnippet_list_skills` — 列出所有可用 Skills(内置 + 项目级)
|
|
50
|
+
- **加载**: `autosnippet_load_skill(skillName)` — 获取 Skill 完整文档
|
|
51
|
+
- **创建**: `autosnippet_create_skill(name, description, content)` — 创建项目级 Skill
|
|
52
|
+
- **推荐**: `autosnippet_suggest_skills` — 基于使用模式推荐创建 Skill
|
|
53
|
+
- **优先级**: 项目级 Skill 同名覆盖内置 Skill;Skill > Recipe(宏观知识优先查 Skill)
|
|
54
|
+
- **Bootstrap 自动生成**: 冷启动会自动生成 `project-code-standard`、`project-architecture`、`project-profile`、`project-agent-guidelines` 四个 Project Skills
|
|
55
|
+
|
|
56
|
+
## MCP tools (36 total)
|
|
47
57
|
|
|
48
58
|
### Search (prefer search / context_search)
|
|
49
59
|
- `autosnippet_search` — Unified search (auto: BM25 + semantic fusion)
|
|
@@ -66,14 +76,21 @@ Recipes are classified into three kinds:
|
|
|
66
76
|
- `autosnippet_submit_draft_recipes` — Parse draft Markdown files
|
|
67
77
|
- `autosnippet_enrich_candidates` — AI-fill missing semantic fields
|
|
68
78
|
|
|
69
|
-
### Project scanning
|
|
79
|
+
### Project scanning & bootstrap
|
|
70
80
|
- `autosnippet_get_targets` / `autosnippet_get_target_files` / `autosnippet_get_target_metadata`
|
|
71
81
|
- `autosnippet_scan_project` — Lightweight probe (file list + Guard audit)
|
|
72
|
-
- `autosnippet_bootstrap_knowledge` — Cold-start knowledge initialization
|
|
82
|
+
- `autosnippet_bootstrap_knowledge` — Cold-start knowledge initialization (9 dimensions + auto Project Skills)
|
|
83
|
+
- `autosnippet_bootstrap_refine` — AI refinement for bootstrap candidates (summary/insight/relations)
|
|
73
84
|
|
|
74
85
|
### Guard & governance
|
|
75
86
|
- `autosnippet_guard_check` / `autosnippet_guard_audit_files` / `autosnippet_compliance_report`
|
|
76
87
|
|
|
88
|
+
### Skills
|
|
89
|
+
- `autosnippet_list_skills` — List all available Skills (builtin + project)
|
|
90
|
+
- `autosnippet_load_skill` — Load a Skill's full document
|
|
91
|
+
- `autosnippet_create_skill` — Create a project-level Skill in `AutoSnippet/skills/`
|
|
92
|
+
- `autosnippet_suggest_skills` — Recommend Skills based on usage patterns
|
|
93
|
+
|
|
77
94
|
### Other
|
|
78
95
|
- `autosnippet_health` / `autosnippet_capabilities` / `autosnippet_confirm_usage`
|
|
79
96
|
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: AutoSnippet Project Skills — 项目级知识增强文档索引与使用指引
|
|
3
|
+
alwaysApply: true
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# AutoSnippet Project Skills
|
|
7
|
+
|
|
8
|
+
Project Skills 是针对当前项目自动生成或手动创建的 AI Agent 知识增强文档。
|
|
9
|
+
它们存放在 `AutoSnippet/skills/` 目录下,跟随项目 Git 管理。
|
|
10
|
+
|
|
11
|
+
## 如何发现与加载
|
|
12
|
+
|
|
13
|
+
1. **列出所有 Skills**:调用 `autosnippet_list_skills` 查看当前可用的 Skills(含内置 + 项目级)
|
|
14
|
+
2. **加载完整内容**:调用 `autosnippet_load_skill(skillName)` 获取具体 Skill 的完整文档
|
|
15
|
+
3. **按需加载**:不确定该用哪个 Skill 时,先加载 `autosnippet-intent` 做意图路由
|
|
16
|
+
4. **创建 Skill**:调用 `autosnippet_create_skill(name, description, content)` 创建项目级 Skill
|
|
17
|
+
5. **Skill 推荐**:调用 `autosnippet_suggest_skills` 获取基于使用模式的 Skill 创建建议
|
|
18
|
+
|
|
19
|
+
## Bootstrap 自动生成的 Project Skills
|
|
20
|
+
|
|
21
|
+
冷启动(`autosnippet_bootstrap_knowledge`)Phase 5.5 会自动为 4 个宏观维度生成 Project Skills:
|
|
22
|
+
|
|
23
|
+
| Skill | 维度 | 说明 |
|
|
24
|
+
|-------|------|------|
|
|
25
|
+
| `project-code-standard` | 代码规范 | 命名约定、文件组织规范 |
|
|
26
|
+
| `project-architecture` | 架构模式 | 分层架构、模块边界、依赖图 |
|
|
27
|
+
| `project-profile` | 项目特征 | 技术栈、模块结构、代码指标 |
|
|
28
|
+
| `project-agent-guidelines` | Agent 约束 | 强制规则、TODO/FIXME、WARNING |
|
|
29
|
+
|
|
30
|
+
生成后的 Skill 文件位于 `AutoSnippet/skills/<name>/SKILL.md`,自动跟随 Git。
|
|
31
|
+
调用 `autosnippet_load_skill` 可加载完整内容。
|
|
32
|
+
|
|
33
|
+
## 推荐工作流
|
|
34
|
+
|
|
35
|
+
冷启动完整流程:
|
|
36
|
+
1. `autosnippet_bootstrap_knowledge` — 9 维度分析 + 自动生成 Project Skills
|
|
37
|
+
2. `autosnippet_enrich_candidates` — 补全缺失语义字段
|
|
38
|
+
3. `autosnippet_bootstrap_refine` — AI 润色 summary/insight/relations
|
|
39
|
+
4. 逐 Target 深入分析 → `autosnippet_submit_candidates`
|
|
40
|
+
|
|
41
|
+
## 使用优先级
|
|
42
|
+
|
|
43
|
+
- **Project Skills > 内置 Skills**:同名时项目级覆盖内置
|
|
44
|
+
- **Skill > Recipe**:宏观架构/规范知识优先查 Skill,微观代码模式查 Recipe
|
|
45
|
+
- **Skills 是只读参考**:不要直接修改 SKILL.md,应通过 `autosnippet_create_skill` 工具创建或更新
|