autosnippet 2.9.0 → 2.11.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/README.md +12 -12
- package/bin/cli.js +53 -40
- package/config/constitution.yaml +9 -2
- package/dashboard/dist/assets/{icons-CH-H9x0E.js → icons-D4IWpDIk.js} +105 -100
- package/dashboard/dist/assets/index-CWBNcF9z.css +1 -0
- package/dashboard/dist/assets/index-DHtzhbuG.js +120 -0
- package/dashboard/dist/index.html +3 -3
- package/lib/cli/AiScanService.js +35 -36
- package/lib/cli/KnowledgeSyncService.js +345 -0
- package/lib/cli/SetupService.js +8 -26
- package/lib/cli/UpgradeService.js +28 -0
- package/lib/core/gateway/GatewayActionRegistry.js +48 -58
- package/lib/domain/index.js +16 -11
- package/lib/domain/knowledge/KnowledgeEntry.js +289 -0
- package/lib/domain/knowledge/KnowledgeRepository.js +123 -0
- package/lib/domain/knowledge/Lifecycle.js +99 -0
- package/lib/domain/knowledge/index.js +27 -0
- package/lib/domain/knowledge/values/Constraints.js +128 -0
- package/lib/domain/knowledge/values/Content.js +69 -0
- package/lib/domain/knowledge/values/Quality.js +81 -0
- package/lib/domain/knowledge/values/Reasoning.js +70 -0
- package/lib/domain/knowledge/values/Relations.js +142 -0
- package/lib/domain/knowledge/values/Stats.js +72 -0
- package/lib/domain/knowledge/values/index.js +9 -0
- package/lib/external/ai/AiProvider.js +85 -11
- package/lib/external/mcp/McpServer.js +7 -5
- package/lib/external/mcp/handlers/bootstrap/pipeline/orchestrator.js +18 -2
- package/lib/external/mcp/handlers/bootstrap.js +116 -11
- package/lib/external/mcp/handlers/browse.js +76 -73
- package/lib/external/mcp/handlers/candidate.js +26 -275
- package/lib/external/mcp/handlers/guard.js +2 -0
- package/lib/external/mcp/handlers/knowledge.js +267 -0
- package/lib/external/mcp/handlers/structure.js +25 -23
- package/lib/external/mcp/handlers/system.js +10 -12
- package/lib/external/mcp/tools.js +134 -140
- package/lib/http/HttpServer.js +14 -8
- package/lib/http/routes/ai.js +4 -3
- package/lib/http/routes/extract.js +48 -4
- package/lib/http/routes/knowledge.js +246 -0
- package/lib/http/routes/search.js +12 -17
- package/lib/infrastructure/database/migrations/016_unified_knowledge_entries.js +395 -0
- package/lib/infrastructure/database/migrations/017_camelcase_knowledge_entries.js +107 -0
- package/lib/infrastructure/external/XcodeAutomation.js +187 -103
- package/lib/injection/ServiceContainer.js +69 -60
- package/lib/repository/knowledge/KnowledgeRepository.impl.js +338 -0
- package/lib/service/automation/DirectiveDetector.js +2 -3
- package/lib/service/automation/FileWatcher.js +59 -28
- package/lib/service/automation/XcodeIntegration.js +931 -156
- package/lib/service/automation/handlers/AlinkHandler.js +5 -4
- package/lib/service/automation/handlers/CreateHandler.js +53 -19
- package/lib/service/automation/handlers/DraftHandler.js +1 -1
- package/lib/service/automation/handlers/GuardHandler.js +183 -20
- package/lib/service/automation/handlers/SearchHandler.js +25 -22
- package/lib/service/candidate/SimilarityService.js +2 -2
- package/lib/service/chat/AnalystAgent.js +9 -0
- package/lib/service/chat/CandidateGuardrail.js +22 -11
- package/lib/service/chat/ChatAgent.js +132 -54
- package/lib/service/chat/ContextWindow.js +5 -5
- package/lib/service/chat/HandoffProtocol.js +1 -0
- package/lib/service/chat/ProducerAgent.js +40 -13
- package/lib/service/chat/ReasoningLayer.js +854 -0
- package/lib/service/chat/ReasoningTrace.js +329 -0
- package/lib/service/chat/tools.js +308 -205
- package/lib/service/cursor/CursorDeliveryPipeline.js +279 -0
- package/lib/service/cursor/KnowledgeCompressor.js +87 -0
- package/lib/service/cursor/RulesGenerator.js +168 -0
- package/lib/service/cursor/SkillsSyncer.js +268 -0
- package/lib/service/cursor/TokenBudget.js +58 -0
- package/lib/service/cursor/TopicClassifier.js +141 -0
- package/lib/service/guard/GuardCheckEngine.js +99 -10
- package/lib/service/guard/GuardService.js +57 -46
- package/lib/service/knowledge/ConfidenceRouter.js +159 -0
- package/lib/service/knowledge/KnowledgeFileWriter.js +595 -0
- package/lib/service/knowledge/KnowledgeService.js +802 -0
- package/lib/service/recipe/RecipeParser.js +3 -12
- package/lib/service/search/SearchEngine.js +67 -22
- package/lib/service/skills/SignalCollector.js +14 -9
- package/lib/service/skills/SkillAdvisor.js +13 -11
- package/lib/service/snippet/SnippetFactory.js +5 -5
- package/lib/service/spm/SpmService.js +15 -48
- package/lib/shared/RecipeReadinessChecker.js +6 -11
- package/package.json +1 -1
- package/scripts/install-cursor-skill.js +0 -6
- package/scripts/migrate-md-to-knowledge.mjs +364 -0
- package/skills/autosnippet-analysis/SKILL.md +15 -7
- package/skills/autosnippet-candidates/SKILL.md +8 -8
- package/skills/autosnippet-coldstart/SKILL.md +8 -4
- package/skills/autosnippet-concepts/SKILL.md +7 -6
- package/skills/autosnippet-create/SKILL.md +13 -13
- package/skills/autosnippet-intent/SKILL.md +3 -2
- package/skills/autosnippet-lifecycle/SKILL.md +5 -5
- package/skills/autosnippet-recipes/SKILL.md +18 -6
- package/templates/constitution.yaml +1 -1
- package/templates/copilot-instructions.md +6 -6
- package/templates/recipes-setup/README.md +3 -3
- package/dashboard/dist/assets/index-CqJRvYRL.js +0 -197
- package/dashboard/dist/assets/index-DICm9PNa.css +0 -1
- package/lib/cli/CandidateSyncService.js +0 -261
- package/lib/cli/SyncService.js +0 -356
- package/lib/domain/candidate/Candidate.js +0 -196
- package/lib/domain/candidate/CandidateRepository.js +0 -107
- package/lib/domain/candidate/Reasoning.js +0 -52
- package/lib/domain/recipe/Recipe.js +0 -421
- package/lib/domain/recipe/RecipeRepository.js +0 -54
- package/lib/domain/types/CandidateStatus.js +0 -52
- package/lib/http/routes/candidates.js +0 -559
- package/lib/http/routes/recipes.js +0 -397
- package/lib/repository/candidate/CandidateRepository.impl.js +0 -230
- package/lib/repository/recipe/RecipeRepository.impl.js +0 -498
- package/lib/service/candidate/CandidateAggregator.js +0 -52
- package/lib/service/candidate/CandidateFileWriter.js +0 -383
- package/lib/service/candidate/CandidateService.js +0 -1001
- package/lib/service/recipe/RecipeFileWriter.js +0 -514
- package/lib/service/recipe/RecipeService.js +0 -786
- package/lib/service/recipe/RecipeStatsTracker.js +0 -148
|
@@ -37,9 +37,9 @@ This skill documents the Recipe lifecycle and clarifies what Agent can and canno
|
|
|
37
37
|
## Agent Role: What You CAN Do
|
|
38
38
|
|
|
39
39
|
### 1. Submit Candidates
|
|
40
|
-
- `
|
|
41
|
-
- `
|
|
42
|
-
- `
|
|
40
|
+
- `autosnippet_submit_knowledge` - single structured candidate
|
|
41
|
+
- `autosnippet_submit_knowledge_batch` - batch structured candidates
|
|
42
|
+
- `autosnippet_submit_knowledge_batch` - submit .md files as candidates
|
|
43
43
|
|
|
44
44
|
### 2. Validate and Enhance Candidates
|
|
45
45
|
- `autosnippet_validate_candidate` - pre-validate quality
|
|
@@ -81,7 +81,7 @@ This skill documents the Recipe lifecycle and clarifies what Agent can and canno
|
|
|
81
81
|
2. Generate structured candidate with rationale, steps, etc.
|
|
82
82
|
3. `autosnippet_check_duplicate` - verify no duplicate exists
|
|
83
83
|
4. `autosnippet_validate_candidate` - pre-validate quality
|
|
84
|
-
5. `
|
|
84
|
+
5. `autosnippet_submit_knowledge` - submit to candidate pool
|
|
85
85
|
6. Tell user: "Candidate submitted. Review in Dashboard Candidates page."
|
|
86
86
|
|
|
87
87
|
### Workflow 2: User asks about an existing Recipe
|
|
@@ -94,7 +94,7 @@ This skill documents the Recipe lifecycle and clarifies what Agent can and canno
|
|
|
94
94
|
1. Explain: "I cannot modify Recipes directly. I can submit an improved version as a new candidate."
|
|
95
95
|
2. `autosnippet_get_recipe` to read current content
|
|
96
96
|
3. Generate improved candidate based on user's feedback
|
|
97
|
-
4. `
|
|
97
|
+
4. `autosnippet_submit_knowledge` - submit improved version
|
|
98
98
|
5. Tell user: "Improved version submitted as candidate. Update the Recipe in Dashboard."
|
|
99
99
|
|
|
100
100
|
---
|
|
@@ -27,9 +27,9 @@ Recipe creation, review, publish, update, deprecate, delete are **human-only via
|
|
|
27
27
|
|
|
28
28
|
---
|
|
29
29
|
|
|
30
|
-
##
|
|
30
|
+
## V3 Recipe Model
|
|
31
31
|
|
|
32
|
-
Recipe is the core knowledge unit.
|
|
32
|
+
Recipe is the core knowledge unit. V3 uses a unified structured model:
|
|
33
33
|
|
|
34
34
|
- **kind**: rule (mandatory norm, Guard enforced) | pattern (best practice) | fact (structural knowledge)
|
|
35
35
|
- **knowledgeType**: code-pattern | architecture | best-practice | naming | error-handling | performance | security | testing | api-usage | workflow | dependency | rule
|
|
@@ -78,7 +78,7 @@ Recipe is the core knowledge unit. V2 uses a unified structured model:
|
|
|
78
78
|
|
|
79
79
|
---
|
|
80
80
|
|
|
81
|
-
## MCP Tools Reference (
|
|
81
|
+
## MCP Tools Reference (38 tools)
|
|
82
82
|
|
|
83
83
|
### Query (Agent can freely use)
|
|
84
84
|
|
|
@@ -109,9 +109,9 @@ Recipe is the core knowledge unit. V2 uses a unified structured model:
|
|
|
109
109
|
|
|
110
110
|
| Tool | Description |
|
|
111
111
|
|------|-------------|
|
|
112
|
-
|
|
|
113
|
-
|
|
|
114
|
-
|
|
|
112
|
+
| autosnippet_submit_knowledge | Submit single candidate (supports structured content) |
|
|
113
|
+
| autosnippet_submit_knowledge_batch | Batch submit candidates |
|
|
114
|
+
| autosnippet_submit_knowledge_batch | Submit draft .md files as candidates |
|
|
115
115
|
| autosnippet_validate_candidate | Validate candidate quality |
|
|
116
116
|
| autosnippet_check_duplicate | Dedup check |
|
|
117
117
|
| autosnippet_enrich_candidates | AI semantic field enrichment for candidates |
|
|
@@ -124,6 +124,18 @@ Recipe is the core knowledge unit. V2 uses a unified structured model:
|
|
|
124
124
|
| autosnippet_guard_audit_files | Multi-file batch Guard audit |
|
|
125
125
|
| autosnippet_scan_project | Lightweight project scan + Guard audit |
|
|
126
126
|
| autosnippet_bootstrap_knowledge | Cold-start knowledge base initialization (9 dimensions) |
|
|
127
|
+
| autosnippet_bootstrap_refine | AI refinement of bootstrap candidates (Phase 6) |
|
|
128
|
+
|
|
129
|
+
### Skills Management
|
|
130
|
+
|
|
131
|
+
| Tool | Description |
|
|
132
|
+
|------|-------------|
|
|
133
|
+
| autosnippet_list_skills | List all available Agent Skills |
|
|
134
|
+
| autosnippet_load_skill | Load Skill document for domain guidance |
|
|
135
|
+
| autosnippet_create_skill | Create project-level Skill |
|
|
136
|
+
| autosnippet_update_skill | Update project-level Skill |
|
|
137
|
+
| autosnippet_delete_skill | Delete project-level Skill |
|
|
138
|
+
| autosnippet_suggest_skills | AI-powered Skill creation suggestions |
|
|
127
139
|
|
|
128
140
|
### Usage Telemetry
|
|
129
141
|
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
|
|
24
24
|
## 强制规则(必须遵守)
|
|
25
25
|
1. **禁止直接修改** 知识库目录内容(`AutoSnippet/recipes/`、`.autosnippet/` 等)。
|
|
26
|
-
2. 创建或入库必须走 **Dashboard** 或 MCP 工具流程(`
|
|
26
|
+
2. 创建或入库必须走 **Dashboard** 或 MCP 工具流程(`autosnippet_submit_knowledge`、`autosnippet_submit_knowledge_batch`)。
|
|
27
27
|
3. **优先使用 Recipe** 作为项目标准;源代码仅作补充。
|
|
28
28
|
4. MCP 检索优先:使用 `autosnippet_search` 或 `autosnippet_context_search` 获取语义检索结果。
|
|
29
29
|
5. MCP 调用失败时,**不要在同一轮重复重试**,回退到已读文档或静态上下文。
|
|
@@ -47,9 +47,9 @@
|
|
|
47
47
|
### 候选提交 & 校验
|
|
48
48
|
- `autosnippet_validate_candidate` — 提交前预校验(5 层)
|
|
49
49
|
- `autosnippet_check_duplicate` — 相似度检测
|
|
50
|
-
- `
|
|
51
|
-
- `
|
|
52
|
-
- `
|
|
50
|
+
- `autosnippet_submit_knowledge` — 单条提交(reasoning 必填)
|
|
51
|
+
- `autosnippet_submit_knowledge_batch` — 批量提交(含去重 + 限流)
|
|
52
|
+
- `autosnippet_submit_knowledge_batch` — 解析草稿 Markdown 文件
|
|
53
53
|
- `autosnippet_enrich_candidates` — AI 补全缺失语义字段
|
|
54
54
|
|
|
55
55
|
### 项目扫描 & 冷启动
|
|
@@ -85,8 +85,8 @@
|
|
|
85
85
|
|
|
86
86
|
## 推荐工作流
|
|
87
87
|
- **查找**:`autosnippet_search`(推荐)或 `autosnippet_context_search`(上下文感知)。
|
|
88
|
-
- **产出候选**:`autosnippet_validate_candidate` 预校验 → `
|
|
89
|
-
- **冷启动**:`autosnippet_bootstrap_knowledge` → `autosnippet_enrich_candidates` → `autosnippet_bootstrap_refine` → 逐 Target 深入 → `
|
|
88
|
+
- **产出候选**:`autosnippet_validate_candidate` 预校验 → `autosnippet_submit_knowledge` 提交。
|
|
89
|
+
- **冷启动**:`autosnippet_bootstrap_knowledge` → `autosnippet_enrich_candidates` → `autosnippet_bootstrap_refine` → 逐 Target 深入 → `autosnippet_submit_knowledge_batch`。
|
|
90
90
|
- **Skills 创建**:`autosnippet_suggest_skills` 分析 → `autosnippet_create_skill` 固化知识。
|
|
91
91
|
- **采纳反馈**:`autosnippet_confirm_usage`(记录使用量影响排序权重)。
|
|
92
92
|
|
|
@@ -160,9 +160,9 @@ V2 知识库中的 Recipe 按 `knowledgeType` 自动归入三类 kind,影响
|
|
|
160
160
|
| `autosnippet_search` | 统合搜索(BM25 + 语义融合) |
|
|
161
161
|
| `autosnippet_context_search` | 智能上下文检索 |
|
|
162
162
|
| `autosnippet_validate_candidate` | 候选结构化预校验 |
|
|
163
|
-
| `
|
|
164
|
-
| `
|
|
165
|
-
| `
|
|
163
|
+
| `autosnippet_submit_knowledge` | 单条候选提交(reasoning 必填) |
|
|
164
|
+
| `autosnippet_submit_knowledge_batch` | 批量候选提交 |
|
|
165
|
+
| `autosnippet_submit_knowledge_batch` | 解析草稿 Markdown 为候选 |
|
|
166
166
|
| `autosnippet_confirm_usage` | 确认 Recipe 被采纳/应用 |
|
|
167
167
|
| `autosnippet_recipe_insights` | 获取 Recipe 质量洞察(只读) |
|
|
168
168
|
|