autosnippet 3.1.5 → 3.1.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/dashboard/dist/assets/{index-D9fV5GGQ.js → index-Ciz4nd_4.js} +2 -2
- package/dashboard/dist/index.html +1 -1
- package/lib/external/mcp/handlers/bootstrap/MissionBriefingBuilder.js +36 -5
- package/lib/external/mcp/handlers/bootstrap/base-dimensions.js +5 -5
- package/lib/external/mcp/handlers/bootstrap/pipeline/EpisodicMemory.js +1 -1
- package/lib/external/mcp/handlers/bootstrap/pipeline/ToolResultCache.js +1 -1
- package/lib/external/mcp/handlers/bootstrap/pipeline/dimension-configs.js +2 -2
- package/lib/external/mcp/handlers/bootstrap/pipeline/noAiFallback.js +1 -1
- package/lib/external/mcp/handlers/bootstrap/shared/dimension-sop.js +670 -0
- package/lib/external/mcp/handlers/bootstrap/shared/dimension-text.js +2 -2
- package/lib/external/mcp/handlers/bootstrap/shared/skill-generator.js +86 -10
- package/lib/external/mcp/handlers/system.js +21 -2
- package/lib/external/mcp/tools.js +23 -10
- package/lib/platform/ios/xcode/XcodeIntegration.js +2 -2
- package/lib/service/candidate/CandidateAggregator.js +52 -0
- package/lib/service/chat/tools/ai-analysis.js +3 -3
- package/lib/service/chat/tools/ast-graph.js +2 -2
- package/lib/shared/RecipeReadinessChecker.js +13 -5
- package/package.json +1 -1
- package/scripts/migrate-md-to-knowledge.mjs +5 -2
- package/skills/autosnippet-analysis/SKILL.md +5 -5
- package/skills/autosnippet-coldstart/SKILL.md +75 -60
- package/skills/autosnippet-concepts/SKILL.md +2 -2
- package/skills/autosnippet-guard/SKILL.md +3 -3
- package/skills/autosnippet-intent/SKILL.md +1 -1
- package/templates/copilot-instructions.md +18 -2
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
7
|
<title>AutoSnippet Dashboard</title>
|
|
8
|
-
<script type="module" crossorigin src="/assets/index-
|
|
8
|
+
<script type="module" crossorigin src="/assets/index-Ciz4nd_4.js"></script>
|
|
9
9
|
<link rel="modulepreload" crossorigin href="/assets/yaml-qRaU8Ldn.js">
|
|
10
10
|
<link rel="modulepreload" crossorigin href="/assets/vendor-CEnWn7aV.js">
|
|
11
11
|
<link rel="modulepreload" crossorigin href="/assets/axios-C0Zqfgkc.js">
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
import { TierScheduler } from './pipeline/tier-scheduler.js';
|
|
18
18
|
import { SUBMISSION_SCHEMA, EXAMPLE_TEMPLATES } from './shared/dimension-text.js';
|
|
19
|
+
import { getDimensionSOP, sopToCompactText, PRE_SUBMIT_CHECKLIST } from './shared/dimension-sop.js';
|
|
19
20
|
|
|
20
21
|
// ── 常量 ────────────────────────────────────────────────────
|
|
21
22
|
|
|
@@ -42,25 +43,45 @@ const SIZE_THRESHOLDS = {
|
|
|
42
43
|
* @returns {object} — Mission Briefing 维度任务对象
|
|
43
44
|
*/
|
|
44
45
|
function enrichDimensionTask(dim, skills, tier) {
|
|
45
|
-
// ── analysisGuide:
|
|
46
|
-
|
|
46
|
+
// ── analysisGuide: SOP 化 — 优先使用维度专属 SOP,否则回退通用指引 ──
|
|
47
|
+
const sop = getDimensionSOP(dim.id);
|
|
48
|
+
let analysisGuide;
|
|
49
|
+
|
|
50
|
+
if (sop) {
|
|
51
|
+
// SOP 结构化模式: steps + timeEstimate + commonMistakes
|
|
52
|
+
analysisGuide = {
|
|
53
|
+
goal: `分析项目的${dim.label}`,
|
|
54
|
+
focus: dim.guide,
|
|
55
|
+
steps: sop.steps,
|
|
56
|
+
timeEstimate: sop.timeEstimate || '10-15 min',
|
|
57
|
+
commonMistakes: sop.commonMistakes || [],
|
|
58
|
+
};
|
|
59
|
+
} else {
|
|
60
|
+
// 无 SOP 的维度: 保留原始文本指引(兼容新增维度未定义 SOP 的情况)
|
|
61
|
+
analysisGuide = `分析项目的${dim.label}。\n\n重点关注:\n${dim.guide}\n\n分析要求:\n1. 在具体文件/类中验证发现(引用 ≥3 个文件路径)\n2. 说明具体实现方式和代码特征\n3. 解释设计意图\n4. 提供统计数据(数量、占比)\n5. 每个知识点独立描述,目标 3-5 个发现`;
|
|
62
|
+
}
|
|
47
63
|
|
|
48
64
|
// 如果有相关 skill,注入到 analysisGuide 中
|
|
49
65
|
const relatedSkill = skills?.find(
|
|
50
66
|
(s) => s.relatedDimension === dim.id || s.name === dim.skillMeta?.name
|
|
51
67
|
);
|
|
52
68
|
if (relatedSkill) {
|
|
53
|
-
|
|
69
|
+
const skillHint = `参考已有 Skill (${relatedSkill.name}):\n${relatedSkill.content?.substring(0, 500) || ''}`;
|
|
70
|
+
if (typeof analysisGuide === 'string') {
|
|
71
|
+
analysisGuide += `\n\n${skillHint}`;
|
|
72
|
+
} else {
|
|
73
|
+
analysisGuide.referenceSkill = skillHint;
|
|
74
|
+
}
|
|
54
75
|
}
|
|
55
76
|
|
|
56
|
-
// ── submissionSpec ──
|
|
77
|
+
// ── submissionSpec: 嵌入 Quality Checklist ──
|
|
57
78
|
const submissionSpec = {
|
|
58
79
|
knowledgeTypes: dim.knowledgeTypes || [],
|
|
59
80
|
targetCandidateCount: '3-5',
|
|
60
81
|
contentStyle:
|
|
61
82
|
'融合基本用法与项目特征的「项目特写」。\n四大核心内容:\n1. 项目选择了什么 — 采用了哪种写法/模式/约定\n2. 为什么这样选 — 统计分布、占比、历史决策\n3. 项目禁止什么 — 反模式、已废弃写法\n4. 新代码怎么写 — 可直接复制的代码模板 + 来源标注',
|
|
62
83
|
contentQuality:
|
|
63
|
-
'content.markdown 必须 ≥200 字符,包含: (1) ## 标题 (2) 正文说明 (3) 至少一个 ```代码块``` (4) 来源标注「(来源: FileName.ext:行号)」。短于 200
|
|
84
|
+
'content.markdown 必须 ≥200 字符,包含: (1) ## 标题 (2) 正文说明 (3) 至少一个 ```代码块``` (4) 来源标注「(来源: FileName.ext:行号)」。短于 200 字符的提交会被拒绝。\n【禁止】标题和正文中不得出现 "Agent" 字样 — 所有候选必须以项目规范/开发规范的视角撰写,描述的是项目规则而非 AI Agent 指南。',
|
|
64
85
|
cursorFields: {
|
|
65
86
|
trigger: '@前缀-kebab-case(每个候选唯一)',
|
|
66
87
|
kind: 'rule=强制约束 | pattern=实现模式 | fact=项目事实',
|
|
@@ -71,6 +92,7 @@ function enrichDimensionTask(dim, skills, tier) {
|
|
|
71
92
|
},
|
|
72
93
|
dimensionCompleteGuide:
|
|
73
94
|
'调用 dimension_complete 时必须传递: referencedFiles=[本维度分析过的全部文件路径], keyFindings=[3-5条关键发现摘要], analysisText=详细分析报告(≥500字符,含##标题+列表+代码块)',
|
|
95
|
+
preSubmitChecklist: PRE_SUBMIT_CHECKLIST,
|
|
74
96
|
};
|
|
75
97
|
|
|
76
98
|
// ── skillMeta ──
|
|
@@ -533,6 +555,15 @@ export function buildMissionBriefing({
|
|
|
533
555
|
for (const dim of briefing.dimensions) {
|
|
534
556
|
delete dim.evidenceStarters;
|
|
535
557
|
}
|
|
558
|
+
// Level 5: SOP 降级为紧凑文本 + 移除 FAIL_EXAMPLES
|
|
559
|
+
for (const dim of briefing.dimensions) {
|
|
560
|
+
if (dim.analysisGuide && typeof dim.analysisGuide === 'object') {
|
|
561
|
+
dim.analysisGuide = sopToCompactText(dim.analysisGuide);
|
|
562
|
+
}
|
|
563
|
+
if (dim.submissionSpec?.preSubmitChecklist?.FAIL_EXAMPLES) {
|
|
564
|
+
delete dim.submissionSpec.preSubmitChecklist.FAIL_EXAMPLES;
|
|
565
|
+
}
|
|
566
|
+
}
|
|
536
567
|
// 更新 meta
|
|
537
568
|
const newSize = JSON.stringify(briefing).length;
|
|
538
569
|
briefing.meta.responseSizeKB = Math.round(newSize / 1024);
|
|
@@ -90,10 +90,10 @@ export const baseDimensions = [
|
|
|
90
90
|
'Project tech stack, module structure, third-party dependencies, base extensions/classes, event hooks, infrastructure services, and runtime/interop features (auto-generated by bootstrap)',
|
|
91
91
|
},
|
|
92
92
|
},
|
|
93
|
-
// ⑦
|
|
93
|
+
// ⑦ 项目开发强制规范(Skill)
|
|
94
94
|
{
|
|
95
95
|
id: 'agent-guidelines',
|
|
96
|
-
label: '
|
|
96
|
+
label: '项目开发强制规范',
|
|
97
97
|
guide:
|
|
98
98
|
'三大核心原则(严谨性/深度特征挖掘/完整性)、命名强制、线程安全、内存约束、已废弃 API 标记、架构约束注释、TODO/FIXME',
|
|
99
99
|
knowledgeTypes: ['boundary-constraint', 'code-standard'],
|
|
@@ -101,7 +101,7 @@ export const baseDimensions = [
|
|
|
101
101
|
skillMeta: {
|
|
102
102
|
name: 'project-agent-guidelines',
|
|
103
103
|
description:
|
|
104
|
-
'Mandatory coding rules, deprecated APIs and
|
|
104
|
+
'Mandatory coding rules, deprecated APIs and project constraints (auto-generated by bootstrap)',
|
|
105
105
|
},
|
|
106
106
|
},
|
|
107
107
|
|
|
@@ -112,7 +112,7 @@ export const baseDimensions = [
|
|
|
112
112
|
id: 'objc-deep-scan',
|
|
113
113
|
label: '深度扫描(常量/Hook)',
|
|
114
114
|
guide:
|
|
115
|
-
'全量扫描 #define 值宏/函数宏、extern/static 常量、Method Swizzling hook
|
|
115
|
+
'全量扫描 #define 值宏/函数宏、extern/static 常量、Method Swizzling hook 对(开发者必须使用项目常量,修改被 hook 方法前必须查阅 hook 清单)',
|
|
116
116
|
knowledgeTypes: ['code-standard', 'code-pattern'],
|
|
117
117
|
conditions: { languages: ['objectivec', 'swift'] },
|
|
118
118
|
skillWorthy: true,
|
|
@@ -128,7 +128,7 @@ export const baseDimensions = [
|
|
|
128
128
|
id: 'category-scan',
|
|
129
129
|
label: '基础类分类方法扫描',
|
|
130
130
|
guide:
|
|
131
|
-
'Foundation/UIKit Category/Extension
|
|
131
|
+
'Foundation/UIKit Category/Extension 逐方法清单(含完整实现代码与项目使用频次),仅扫描基础类分类、不含业务代码(遇到同等功能必须使用项目已有分类方法,禁止重复实现)',
|
|
132
132
|
knowledgeTypes: ['code-standard', 'code-pattern'],
|
|
133
133
|
conditions: { languages: ['objectivec', 'swift'] },
|
|
134
134
|
skillWorthy: true,
|
|
@@ -95,7 +95,7 @@ export class EpisodicMemory {
|
|
|
95
95
|
/** @type {object} 项目上下文 (不变信息) */
|
|
96
96
|
#projectContext;
|
|
97
97
|
|
|
98
|
-
/** @type {import('../../../../../
|
|
98
|
+
/** @type {import('../../../../../infrastructure/logging/Logger.js').default} */
|
|
99
99
|
#logger;
|
|
100
100
|
|
|
101
101
|
/**
|
|
@@ -32,7 +32,7 @@ export class ToolResultCache {
|
|
|
32
32
|
/** @type {Map<string, {content: string, cachedAt: number, hitCount: number}>} */
|
|
33
33
|
#fileCache = new Map();
|
|
34
34
|
|
|
35
|
-
/** @type {import('../../../../../
|
|
35
|
+
/** @type {import('../../../../../infrastructure/logging/Logger.js').default} */
|
|
36
36
|
#logger;
|
|
37
37
|
|
|
38
38
|
/** @type {{hits: number, misses: number, evictions: number}} */
|
|
@@ -103,8 +103,8 @@ export const DIMENSION_CONFIGS_V3 = {
|
|
|
103
103
|
allowedKnowledgeTypes: ['best-practice'],
|
|
104
104
|
},
|
|
105
105
|
'agent-guidelines': {
|
|
106
|
-
label: '
|
|
107
|
-
guide: '
|
|
106
|
+
label: '项目开发强制规范',
|
|
107
|
+
guide: '总结在此项目开发时必须遵守的强制规则和约束。',
|
|
108
108
|
focusAreas: [
|
|
109
109
|
'命名强制规则和前缀约定',
|
|
110
110
|
'线程安全约束',
|
|
@@ -121,7 +121,7 @@ export async function runNoAiFallback(fillContext) {
|
|
|
121
121
|
if (guidelines) {
|
|
122
122
|
candidates.push(guidelines);
|
|
123
123
|
skills.push(
|
|
124
|
-
_wrapAsSkill('agent-guidelines', '
|
|
124
|
+
_wrapAsSkill('agent-guidelines', '项目开发强制规范', guidelines.content.markdown)
|
|
125
125
|
);
|
|
126
126
|
report.candidatesCreated++;
|
|
127
127
|
report.skillsCreated++;
|