autosnippet 3.3.2 → 3.3.3
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/dist/bin/cli.js +27 -1
- package/dist/lib/cli/KnowledgeSyncService.d.ts +26 -0
- package/dist/lib/cli/KnowledgeSyncService.js +33 -1
- package/dist/lib/external/mcp/handlers/browse.d.ts +1 -0
- package/dist/lib/external/mcp/handlers/browse.js +2 -1
- package/dist/lib/external/mcp/handlers/consolidated.d.ts +1 -0
- package/dist/lib/external/mcp/handlers/panorama.d.ts +11 -11
- package/dist/lib/external/mcp/handlers/panorama.js +20 -20
- package/dist/lib/external/mcp/handlers/system.d.ts +1 -1
- package/dist/lib/external/mcp/handlers/task.js +2 -1
- package/dist/lib/external/mcp/tools.d.ts +12 -12
- package/dist/lib/external/mcp/tools.js +120 -118
- package/dist/lib/http/middleware/validate.js +7 -3
- package/dist/lib/infrastructure/database/drizzle/schema.d.ts +100 -0
- package/dist/lib/infrastructure/database/drizzle/schema.js +10 -0
- package/dist/lib/infrastructure/database/migrations/005_recipe_source_refs.d.ts +9 -0
- package/dist/lib/infrastructure/database/migrations/005_recipe_source_refs.js +24 -0
- package/dist/lib/infrastructure/vector/HnswVectorAdapter.js +18 -2
- package/dist/lib/injection/ServiceContainer.js +2 -0
- package/dist/lib/injection/modules/KnowledgeModule.d.ts +5 -0
- package/dist/lib/injection/modules/KnowledgeModule.js +80 -0
- package/dist/lib/service/bootstrap/UiStartupTasks.d.ts +45 -0
- package/dist/lib/service/bootstrap/UiStartupTasks.js +101 -0
- package/dist/lib/service/evolution/ConsolidationAdvisor.js +9 -9
- package/dist/lib/service/evolution/ContradictionDetector.js +2 -2
- package/dist/lib/service/evolution/RedundancyAnalyzer.js +2 -2
- package/dist/lib/service/knowledge/SourceRefReconciler.d.ts +68 -0
- package/dist/lib/service/knowledge/SourceRefReconciler.js +309 -0
- package/dist/lib/service/panorama/PanoramaService.d.ts +18 -1
- package/dist/lib/service/panorama/PanoramaService.js +148 -5
- package/dist/lib/service/search/BM25Scorer.d.ts +2 -2
- package/dist/lib/service/search/CoarseRanker.d.ts +7 -6
- package/dist/lib/service/search/CoarseRanker.js +11 -10
- package/dist/lib/service/search/FieldWeightedScorer.d.ts +81 -0
- package/dist/lib/service/search/FieldWeightedScorer.js +318 -0
- package/dist/lib/service/search/MultiSignalRanker.d.ts +2 -2
- package/dist/lib/service/search/MultiSignalRanker.js +1 -1
- package/dist/lib/service/search/SearchEngine.d.ts +8 -7
- package/dist/lib/service/search/SearchEngine.js +59 -10
- package/dist/lib/service/search/SearchTypes.d.ts +23 -3
- package/dist/lib/service/search/SearchTypes.js +6 -1
- package/dist/lib/service/task/IntentExtractor.d.ts +8 -0
- package/dist/lib/service/task/IntentExtractor.js +115 -1
- package/dist/lib/service/task/PrimeSearchPipeline.js +39 -24
- package/dist/lib/service/vector/VectorService.d.ts +3 -0
- package/dist/lib/service/vector/VectorService.js +38 -4
- package/package.json +1 -1
- package/skills/autosnippet-create/SKILL.md +98 -89
- package/skills/autosnippet-devdocs/SKILL.md +55 -60
- package/templates/guard-ci.yml +2 -2
- package/templates/recipes-setup/_template.md +39 -39
|
@@ -1,92 +1,87 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: autosnippet-devdocs
|
|
3
|
-
description:
|
|
3
|
+
description: Generate and publish project Wiki documentation using autosnippet_wiki MCP tool (plan → write → finalize). Use when user says "generate wiki/docs", "write documentation", or agent needs to produce structured project documentation from the knowledge base.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
# AutoSnippet —
|
|
6
|
+
# AutoSnippet — Wiki Documentation Generation
|
|
7
7
|
|
|
8
|
-
This skill
|
|
8
|
+
This skill guides the agent through generating structured **Wiki documentation** from the AutoSnippet knowledge base using the `autosnippet_wiki` MCP tool.
|
|
9
9
|
|
|
10
10
|
## When to use this skill
|
|
11
11
|
|
|
12
|
-
-
|
|
13
|
-
- After
|
|
14
|
-
-
|
|
15
|
-
- After
|
|
16
|
-
- When the user says "保存这个分析" / "记录一下" / "save this to KB"
|
|
12
|
+
- User asks to **generate project documentation** or **wiki**
|
|
13
|
+
- After a **cold-start bootstrap** completes — produce docs from newly captured knowledge
|
|
14
|
+
- When the user says "generate docs" / "write wiki" / "create documentation"
|
|
15
|
+
- After significant **knowledge base changes** — refresh documentation
|
|
17
16
|
|
|
18
|
-
## MCP
|
|
17
|
+
## MCP Tools
|
|
19
18
|
|
|
20
|
-
| Tool | Description |
|
|
21
|
-
|
|
22
|
-
| `
|
|
23
|
-
| `
|
|
19
|
+
| Tool | Operation | Description |
|
|
20
|
+
|------|-----------|-------------|
|
|
21
|
+
| `autosnippet_wiki` | `plan` | Plan topics + data packages (returns topic list + per-topic data for writing) |
|
|
22
|
+
| `autosnippet_wiki` | `finalize` | Complete generation (write meta.json, dedup check, validate completeness) |
|
|
23
|
+
| `autosnippet_search` | — | Search knowledge for additional context during writing |
|
|
24
|
+
| `autosnippet_knowledge` | `get` | Retrieve full Recipe content for reference |
|
|
24
25
|
|
|
25
|
-
##
|
|
26
|
+
## Workflow
|
|
26
27
|
|
|
27
|
-
|
|
28
|
+
### Step 1: Plan topics
|
|
28
29
|
|
|
29
30
|
```json
|
|
30
31
|
{
|
|
31
|
-
"
|
|
32
|
-
|
|
33
|
-
"markdown": "## 问题背景\n\n冷启动耗时 8s...\n\n## 根因分析\n\n...\n\n## 解决方案\n\n...",
|
|
34
|
-
"knowledgeType": "dev-document",
|
|
35
|
-
"description": "冷启动耗时 8s 的根因分析和优化方案",
|
|
36
|
-
"tags": ["debug-report", "performance"],
|
|
37
|
-
"scope": "project-specific"
|
|
38
|
-
}]
|
|
32
|
+
"operation": "plan",
|
|
33
|
+
"language": "en"
|
|
39
34
|
}
|
|
40
35
|
```
|
|
41
36
|
|
|
42
|
-
|
|
37
|
+
Returns:
|
|
38
|
+
- **topics[]** — Recommended documentation topics based on knowledge base content
|
|
39
|
+
- **dataPackages** — Per-topic data bundles (related Recipes, code patterns, architecture info)
|
|
40
|
+
- **sessionId** — Session identifier for the finalize step
|
|
43
41
|
|
|
44
|
-
|
|
45
|
-
|-------|-------------|
|
|
46
|
-
| `title` | Document title (Chinese or English) |
|
|
47
|
-
| `markdown` | Full Markdown content |
|
|
48
|
-
|
|
49
|
-
### Optional fields
|
|
50
|
-
|
|
51
|
-
| Field | Default | Description |
|
|
52
|
-
|-------|---------|-------------|
|
|
53
|
-
| `description` | `""` | One-line summary |
|
|
54
|
-
| `tags` | `[]` | Labels for filtering: `adr`, `debug-report`, `design-doc`, `research`, `performance`, `refactoring` |
|
|
55
|
-
| `scope` | `project-specific` | `universal` or `project-specific` |
|
|
42
|
+
### Step 2: Write articles
|
|
56
43
|
|
|
57
|
-
|
|
44
|
+
For each topic in the plan:
|
|
45
|
+
1. Read the **dataPackage** for that topic
|
|
46
|
+
2. Write a well-structured Markdown article to the wiki directory (`AutoSnippet/wiki/`)
|
|
47
|
+
3. Use Recipe content as source of truth — cite Recipe titles
|
|
48
|
+
4. Follow the structure: Overview → Details → Code Examples → Related Topics
|
|
58
49
|
|
|
59
|
-
|
|
60
|
-
|-----|----------|
|
|
61
|
-
| `adr` | Architecture Decision Record |
|
|
62
|
-
| `debug-report` | Bug investigation / root cause analysis |
|
|
63
|
-
| `design-doc` | Module/feature design document |
|
|
64
|
-
| `research` | Technology research or investigation |
|
|
65
|
-
| `performance` | Benchmark results, profiling analysis |
|
|
66
|
-
| `refactoring` | Refactoring plan or post-mortem |
|
|
67
|
-
| `migration` | Migration guide or plan |
|
|
68
|
-
| `meeting-notes` | Technical meeting summary |
|
|
50
|
+
### Step 3: Finalize
|
|
69
51
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
52
|
+
```json
|
|
53
|
+
{
|
|
54
|
+
"operation": "finalize",
|
|
55
|
+
"sessionId": "<from plan>",
|
|
56
|
+
"articlesWritten": ["AutoSnippet/wiki/topic-1.md", "AutoSnippet/wiki/topic-2.md"]
|
|
57
|
+
}
|
|
58
|
+
```
|
|
73
59
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
60
|
+
This triggers:
|
|
61
|
+
- **meta.json** generation — topic index with cross-references
|
|
62
|
+
- **Dedup check** — detect overlapping articles
|
|
63
|
+
- **Completeness validation** — ensure all planned topics are covered
|
|
77
64
|
|
|
78
|
-
##
|
|
65
|
+
## Writing guidelines
|
|
79
66
|
|
|
80
67
|
- Use **clear headings** (`##`, `###`) — helps search and scanning
|
|
81
|
-
- Include a **summary section** at the top
|
|
68
|
+
- Include a **summary section** at the top of each article
|
|
82
69
|
- Reference **file paths** and **class names** concretely — improves search relevance
|
|
83
|
-
-
|
|
84
|
-
- For
|
|
70
|
+
- Cite **Recipe triggers** (e.g., `@bilidili-feature-url-routing`) as knowledge sources
|
|
71
|
+
- For architecture docs: Context → Design → Implementation → Trade-offs
|
|
72
|
+
- For pattern docs: When to Use → How to Use → Code Example → Anti-patterns
|
|
73
|
+
|
|
74
|
+
## Language parameter
|
|
75
|
+
|
|
76
|
+
| Value | Effect |
|
|
77
|
+
|-------|--------|
|
|
78
|
+
| `"en"` | English documentation (default) |
|
|
79
|
+
| `"zh"` | Chinese documentation |
|
|
85
80
|
|
|
86
81
|
## Related Skills
|
|
87
82
|
|
|
88
83
|
| Skill | When to use |
|
|
89
84
|
|-------|-------------|
|
|
90
|
-
| `autosnippet-create` |
|
|
91
|
-
| `autosnippet-devdocs` (this) |
|
|
92
|
-
| `autosnippet-recipes` | Looking up existing knowledge |
|
|
85
|
+
| `autosnippet-create` | Submitting **code patterns/recipes** to KB (not documents) |
|
|
86
|
+
| `autosnippet-devdocs` (this) | Generating **Wiki documentation** from KB |
|
|
87
|
+
| `autosnippet-recipes` | Looking up existing knowledge for reference |
|
package/templates/guard-ci.yml
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# AutoSnippet Guard CI/CD Check
|
|
2
2
|
# Auto-generated by AutoSnippet. Do not edit manually.
|
|
3
|
-
#
|
|
3
|
+
# Automatically runs Guard compliance checks on push and PR.
|
|
4
4
|
#
|
|
5
|
-
#
|
|
5
|
+
# Usage: Copy this file to your project's .github/workflows/ directory.
|
|
6
6
|
|
|
7
7
|
name: AutoSnippet Guard Check
|
|
8
8
|
|
|
@@ -1,42 +1,42 @@
|
|
|
1
1
|
---
|
|
2
|
-
#
|
|
2
|
+
# Required Fields
|
|
3
3
|
title: Your Recipe Title Here (English, ≤50 chars, verb-based)
|
|
4
4
|
trigger: @my_trigger
|
|
5
5
|
category: Network # MUST be one of: View, Service, Tool, Model, Network, Storage, UI, Utility
|
|
6
6
|
language: swift # swift, objectivec, go, python, java, kotlin, javascript, typescript, dart, rust
|
|
7
|
-
summary_cn:
|
|
7
|
+
summary_cn: Chinese summary, ≤100 chars
|
|
8
8
|
summary_en: English summary, ≤100 words
|
|
9
|
-
headers: ["import Foundation"] #
|
|
9
|
+
headers: ["import Foundation"] # Complete import statement array
|
|
10
10
|
knowledgeType: code-pattern # code-pattern, architecture, best-practice, code-standard, code-style, code-relation, data-flow, event-and-data-flow, module-dependency, boundary-constraint, solution, anti-pattern
|
|
11
11
|
|
|
12
|
-
# V3 Cursor Delivery
|
|
13
|
-
kind: pattern # rule =
|
|
14
|
-
doClause: "Use dependency injection via constructor" #
|
|
15
|
-
dontClause: "Don't instantiate services with new directly" #
|
|
16
|
-
whenClause: "When creating a new service class" #
|
|
12
|
+
# V3 Cursor Delivery Required Fields
|
|
13
|
+
kind: pattern # rule = mandatory constraint | pattern = reusable pattern | fact = project fact
|
|
14
|
+
doClause: "Use dependency injection via constructor" # English imperative, verb-first, ≤60 tokens
|
|
15
|
+
dontClause: "Don't instantiate services with new directly" # English negative constraint
|
|
16
|
+
whenClause: "When creating a new service class" # English trigger scenario
|
|
17
17
|
coreCode: |
|
|
18
18
|
class MyService {
|
|
19
19
|
constructor(private db: Database) {}
|
|
20
20
|
}
|
|
21
21
|
usageGuide: |
|
|
22
|
-
###
|
|
23
|
-
|
|
24
|
-
###
|
|
25
|
-
|
|
22
|
+
### When to Use
|
|
23
|
+
When creating a new Service class
|
|
24
|
+
### Convention
|
|
25
|
+
Always use constructor injection
|
|
26
26
|
|
|
27
|
-
#
|
|
28
|
-
keywords: ["
|
|
27
|
+
# Optional Fields (recommended)
|
|
28
|
+
keywords: ["keyword1", "keyword2", "keyword3"]
|
|
29
29
|
tags: [tag1, tag2]
|
|
30
30
|
whenToUse: |
|
|
31
|
-
-
|
|
32
|
-
-
|
|
33
|
-
-
|
|
31
|
+
- Applicable scenario 1
|
|
32
|
+
- Applicable scenario 2
|
|
33
|
+
- Applicable scenario 3
|
|
34
34
|
whenNotToUse: |
|
|
35
|
-
-
|
|
36
|
-
-
|
|
35
|
+
- Scenario to avoid 1
|
|
36
|
+
- Scenario to avoid 2
|
|
37
37
|
difficulty: beginner # beginner, intermediate, advanced
|
|
38
38
|
authority: 1 # 1~5
|
|
39
|
-
relatedRecipes: ["
|
|
39
|
+
relatedRecipes: ["@related_recipe_trigger"]
|
|
40
40
|
version: "1.0.0"
|
|
41
41
|
updatedAt: 1706515200
|
|
42
42
|
author: team_name
|
|
@@ -46,38 +46,38 @@ deprecated: false
|
|
|
46
46
|
## Snippet / Code Reference
|
|
47
47
|
|
|
48
48
|
```
|
|
49
|
-
//
|
|
49
|
+
// Paste or write code snippet here (ideally runnable, with error handling and comments)
|
|
50
50
|
```
|
|
51
51
|
|
|
52
52
|
## AI Context / Usage Guide
|
|
53
53
|
|
|
54
|
-
###
|
|
54
|
+
### When to Use
|
|
55
55
|
|
|
56
|
-
-
|
|
57
|
-
-
|
|
58
|
-
-
|
|
56
|
+
- Applicable scenario description
|
|
57
|
+
- Typical business or technical context
|
|
58
|
+
- Typical user role
|
|
59
59
|
|
|
60
|
-
###
|
|
60
|
+
### When Not to Use
|
|
61
61
|
|
|
62
|
-
-
|
|
63
|
-
-
|
|
62
|
+
- Exclusion scenarios, easy-to-misuse cases
|
|
63
|
+
- When to apply alternatives
|
|
64
64
|
|
|
65
|
-
###
|
|
65
|
+
### Steps
|
|
66
66
|
|
|
67
|
-
1.
|
|
68
|
-
2.
|
|
69
|
-
3.
|
|
67
|
+
1. Step 1: Preparation or prerequisites
|
|
68
|
+
2. Step 2: Core logic
|
|
69
|
+
3. Step 3: Result handling or follow-up
|
|
70
70
|
|
|
71
|
-
###
|
|
71
|
+
### Key Points
|
|
72
72
|
|
|
73
|
-
-
|
|
74
|
-
-
|
|
75
|
-
-
|
|
73
|
+
- Error-prone areas, easily overlooked details
|
|
74
|
+
- Thread/memory/lifecycle constraints
|
|
75
|
+
- Performance characteristics or limitations
|
|
76
76
|
|
|
77
|
-
###
|
|
77
|
+
### Dependencies & Prerequisites
|
|
78
78
|
|
|
79
|
-
-
|
|
80
|
-
-
|
|
79
|
+
- Required modules/frameworks to import
|
|
80
|
+
- Minimum system/API version
|
|
81
81
|
- 权限、配置或环境要求
|
|
82
82
|
|
|
83
83
|
### 错误处理
|