autosnippet 3.3.8 → 3.4.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 +1 -1
- package/config/default.json +1 -1
- package/dashboard/dist/assets/{index-DV8biUkH.js → index-8b1Gf3Bb.js} +4 -4
- package/dashboard/dist/index.html +1 -1
- package/dist/lib/agent/AgentRuntime.js +13 -1
- package/dist/lib/agent/AgentRuntimeTypes.d.ts +2 -0
- package/dist/lib/agent/PipelineStrategy.js +32 -2
- package/dist/lib/agent/context/ContextWindow.d.ts +2 -1
- package/dist/lib/agent/context/ContextWindow.js +18 -4
- package/dist/lib/agent/context/ExplorationTracker.js +6 -1
- package/dist/lib/agent/context/exploration/ExplorationStrategies.js +2 -1
- package/dist/lib/agent/core/LoopContext.d.ts +3 -0
- package/dist/lib/agent/core/LoopContext.js +3 -0
- package/dist/lib/agent/domain/EpisodicConsolidator.d.ts +5 -0
- package/dist/lib/agent/domain/EpisodicConsolidator.js +60 -5
- package/dist/lib/agent/domain/insight-analyst.d.ts +16 -0
- package/dist/lib/agent/domain/insight-analyst.js +38 -0
- package/dist/lib/agent/domain/insight-gate.js +12 -0
- package/dist/lib/agent/memory/MemoryConsolidator.js +17 -0
- package/dist/lib/bootstrap.js +6 -1
- package/dist/lib/cli/SetupService.js +5 -4
- package/dist/lib/domain/dimension/DimensionRegistry.d.ts +6 -4
- package/dist/lib/domain/dimension/DimensionRegistry.js +19 -23
- package/dist/lib/external/ai/AiProvider.d.ts +2 -0
- package/dist/lib/external/ai/AiProvider.js +4 -0
- package/dist/lib/external/ai/providers/ClaudeProvider.d.ts +1 -1
- package/dist/lib/external/ai/providers/ClaudeProvider.js +6 -2
- package/dist/lib/external/ai/providers/GoogleGeminiProvider.d.ts +1 -1
- package/dist/lib/external/ai/providers/GoogleGeminiProvider.js +6 -2
- package/dist/lib/external/ai/providers/OpenAiProvider.d.ts +1 -1
- package/dist/lib/external/ai/providers/OpenAiProvider.js +7 -3
- package/dist/lib/external/mcp/McpServer.js +19 -2
- package/dist/lib/external/mcp/handlers/bootstrap/MissionBriefingBuilder.js +10 -2
- package/dist/lib/external/mcp/handlers/bootstrap/pipeline/mock-pipeline.js +10 -29
- package/dist/lib/external/mcp/handlers/bootstrap/pipeline/orchestrator.js +37 -4
- package/dist/lib/http/routes/ai.js +2 -2
- package/dist/lib/infrastructure/database/DatabaseConnection.js +7 -6
- package/dist/lib/service/delivery/CursorDeliveryPipeline.js +15 -1
- package/dist/lib/shared/PathGuard.js +16 -10
- package/dist/lib/shared/isOwnDevRepo.d.ts +29 -4
- package/dist/lib/shared/isOwnDevRepo.js +64 -4
- package/package.json +1 -1
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* isOwnDevRepo —
|
|
2
|
+
* isOwnDevRepo — 检测 projectRoot 是否应排除 AutoSnippet 运行时数据创建
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* 三层保护:
|
|
5
|
+
* 1. isAutoSnippetDevRepo — AutoSnippet 自身源码仓库
|
|
6
|
+
* 2. isAutoSnippetEcosystemRepo — AutoSnippet 生态项目(autosnippet-book 等)
|
|
7
|
+
* 3. isExcludedProject — 综合判定:不适合创建知识库的项目
|
|
6
8
|
*
|
|
7
|
-
*
|
|
9
|
+
* 用于防止 MCP 服务器 / CLI 在不当目录创建 `.autosnippet/` 运行时数据。
|
|
10
|
+
*
|
|
11
|
+
* isAutoSnippetDevRepo 检测条件(三者同时满足):
|
|
8
12
|
* 1. projectRoot/package.json 的 name === 'autosnippet'
|
|
9
13
|
* 2. projectRoot/lib/bootstrap.ts 存在(源码标记)
|
|
10
14
|
* 3. projectRoot/SOUL.md 存在(项目灵魂文档)
|
|
@@ -14,5 +18,26 @@
|
|
|
14
18
|
* 结果按 dir 缓存,避免重复 IO
|
|
15
19
|
*/
|
|
16
20
|
export declare function isAutoSnippetDevRepo(dir: string): boolean;
|
|
21
|
+
/**
|
|
22
|
+
* 判断 dir 是否是 AutoSnippet 生态项目(不应创建运行时数据)
|
|
23
|
+
*
|
|
24
|
+
* 检测条件:package.json 的 name 以 'autosnippet-' 开头
|
|
25
|
+
* 例如 autosnippet-book、autosnippet-examples 等
|
|
26
|
+
*/
|
|
27
|
+
export declare function isAutoSnippetEcosystemRepo(dir: string): boolean;
|
|
28
|
+
/**
|
|
29
|
+
* 综合判定:项目是否应排除创建 .autosnippet/ 运行时数据
|
|
30
|
+
*
|
|
31
|
+
* 当前排除:
|
|
32
|
+
* 1. AutoSnippet 源码仓库本身
|
|
33
|
+
* 2. AutoSnippet 生态项目(autosnippet-book 等)
|
|
34
|
+
* 3. 存在 .autosnippet-skip 标记文件的项目(用户手动排除)
|
|
35
|
+
*
|
|
36
|
+
* @returns { excluded: boolean; reason: string }
|
|
37
|
+
*/
|
|
38
|
+
export declare function isExcludedProject(dir: string): {
|
|
39
|
+
excluded: boolean;
|
|
40
|
+
reason: string;
|
|
41
|
+
};
|
|
17
42
|
/** 重置缓存(仅用于测试) */
|
|
18
43
|
export declare function _resetDevRepoCache(): void;
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* isOwnDevRepo —
|
|
2
|
+
* isOwnDevRepo — 检测 projectRoot 是否应排除 AutoSnippet 运行时数据创建
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* 三层保护:
|
|
5
|
+
* 1. isAutoSnippetDevRepo — AutoSnippet 自身源码仓库
|
|
6
|
+
* 2. isAutoSnippetEcosystemRepo — AutoSnippet 生态项目(autosnippet-book 等)
|
|
7
|
+
* 3. isExcludedProject — 综合判定:不适合创建知识库的项目
|
|
6
8
|
*
|
|
7
|
-
*
|
|
9
|
+
* 用于防止 MCP 服务器 / CLI 在不当目录创建 `.autosnippet/` 运行时数据。
|
|
10
|
+
*
|
|
11
|
+
* isAutoSnippetDevRepo 检测条件(三者同时满足):
|
|
8
12
|
* 1. projectRoot/package.json 的 name === 'autosnippet'
|
|
9
13
|
* 2. projectRoot/lib/bootstrap.ts 存在(源码标记)
|
|
10
14
|
* 3. projectRoot/SOUL.md 存在(项目灵魂文档)
|
|
@@ -13,6 +17,8 @@ import fs from 'node:fs';
|
|
|
13
17
|
import path from 'node:path';
|
|
14
18
|
/** 多路径缓存(同一进程可能检测多个目录) */
|
|
15
19
|
const _cache = new Map();
|
|
20
|
+
/** 排除项目缓存 */
|
|
21
|
+
const _excludeCache = new Map();
|
|
16
22
|
/**
|
|
17
23
|
* 判断 dir 是否是 AutoSnippet 自身的源码开发仓库
|
|
18
24
|
* 结果按 dir 缓存,避免重复 IO
|
|
@@ -44,7 +50,61 @@ export function isAutoSnippetDevRepo(dir) {
|
|
|
44
50
|
_cache.set(resolved, result);
|
|
45
51
|
return result;
|
|
46
52
|
}
|
|
53
|
+
/**
|
|
54
|
+
* 判断 dir 是否是 AutoSnippet 生态项目(不应创建运行时数据)
|
|
55
|
+
*
|
|
56
|
+
* 检测条件:package.json 的 name 以 'autosnippet-' 开头
|
|
57
|
+
* 例如 autosnippet-book、autosnippet-examples 等
|
|
58
|
+
*/
|
|
59
|
+
export function isAutoSnippetEcosystemRepo(dir) {
|
|
60
|
+
const resolved = path.resolve(dir);
|
|
61
|
+
try {
|
|
62
|
+
const pkgPath = path.join(resolved, 'package.json');
|
|
63
|
+
if (fs.existsSync(pkgPath)) {
|
|
64
|
+
const raw = fs.readFileSync(pkgPath, 'utf-8');
|
|
65
|
+
const pkg = JSON.parse(raw);
|
|
66
|
+
return typeof pkg.name === 'string' && pkg.name.startsWith('autosnippet-');
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
catch {
|
|
70
|
+
// 读取失败 → 不是
|
|
71
|
+
}
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* 综合判定:项目是否应排除创建 .autosnippet/ 运行时数据
|
|
76
|
+
*
|
|
77
|
+
* 当前排除:
|
|
78
|
+
* 1. AutoSnippet 源码仓库本身
|
|
79
|
+
* 2. AutoSnippet 生态项目(autosnippet-book 等)
|
|
80
|
+
* 3. 存在 .autosnippet-skip 标记文件的项目(用户手动排除)
|
|
81
|
+
*
|
|
82
|
+
* @returns { excluded: boolean; reason: string }
|
|
83
|
+
*/
|
|
84
|
+
export function isExcludedProject(dir) {
|
|
85
|
+
const resolved = path.resolve(dir);
|
|
86
|
+
const cached = _excludeCache.get(resolved);
|
|
87
|
+
if (cached !== undefined) {
|
|
88
|
+
return cached;
|
|
89
|
+
}
|
|
90
|
+
let result;
|
|
91
|
+
if (isAutoSnippetDevRepo(resolved)) {
|
|
92
|
+
result = { excluded: true, reason: 'AutoSnippet 源码开发仓库' };
|
|
93
|
+
}
|
|
94
|
+
else if (isAutoSnippetEcosystemRepo(resolved)) {
|
|
95
|
+
result = { excluded: true, reason: 'AutoSnippet 生态项目' };
|
|
96
|
+
}
|
|
97
|
+
else if (fs.existsSync(path.join(resolved, '.autosnippet-skip'))) {
|
|
98
|
+
result = { excluded: true, reason: '项目包含 .autosnippet-skip 标记' };
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
result = { excluded: false, reason: '' };
|
|
102
|
+
}
|
|
103
|
+
_excludeCache.set(resolved, result);
|
|
104
|
+
return result;
|
|
105
|
+
}
|
|
47
106
|
/** 重置缓存(仅用于测试) */
|
|
48
107
|
export function _resetDevRepoCache() {
|
|
49
108
|
_cache.clear();
|
|
109
|
+
_excludeCache.clear();
|
|
50
110
|
}
|