skill-any-code 1.0.0 → 1.0.1
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/adapters/command.schemas.js +18 -0
- package/dist/application/analysis.app.service.js +264 -0
- package/dist/application/bootstrap.js +21 -0
- package/dist/application/services/llm.analysis.service.js +170 -0
- package/dist/common/config.js +213 -0
- package/dist/common/constants.js +11 -0
- package/dist/common/errors.js +37 -0
- package/dist/common/logger.js +77 -0
- package/dist/common/types.js +2 -0
- package/dist/common/ui.js +201 -0
- package/dist/common/utils.js +117 -0
- package/dist/domain/index.js +17 -0
- package/dist/domain/interfaces.js +2 -0
- package/dist/domain/services/analysis.service.js +696 -0
- package/dist/domain/services/incremental.service.js +81 -0
- package/dist/infrastructure/blacklist.service.js +71 -0
- package/dist/infrastructure/cache/file.hash.cache.js +140 -0
- package/dist/infrastructure/git/git.service.js +159 -0
- package/dist/infrastructure/git.service.js +157 -0
- package/dist/infrastructure/index.service.js +108 -0
- package/dist/infrastructure/llm/llm.usage.tracker.js +58 -0
- package/dist/infrastructure/llm/openai.client.js +141 -0
- package/{src/infrastructure/llm/prompt.template.ts → dist/infrastructure/llm/prompt.template.js} +31 -36
- package/dist/infrastructure/llm.service.js +61 -0
- package/dist/infrastructure/skill/skill.generator.js +83 -0
- package/{src/infrastructure/skill/templates/resolve.script.ts → dist/infrastructure/skill/templates/resolve.script.js} +18 -15
- package/dist/infrastructure/skill/templates/skill.md.template.js +47 -0
- package/dist/infrastructure/splitter/code.splitter.js +137 -0
- package/dist/infrastructure/storage.service.js +409 -0
- package/dist/infrastructure/worker-pool/parse.worker.impl.js +137 -0
- package/dist/infrastructure/worker-pool/parse.worker.js +43 -0
- package/dist/infrastructure/worker-pool/worker-pool.service.js +171 -0
- package/package.json +5 -1
- package/jest.config.js +0 -27
- package/src/adapters/command.schemas.ts +0 -21
- package/src/application/analysis.app.service.ts +0 -272
- package/src/application/bootstrap.ts +0 -35
- package/src/application/services/llm.analysis.service.ts +0 -237
- package/src/cli.ts +0 -297
- package/src/common/config.ts +0 -209
- package/src/common/constants.ts +0 -8
- package/src/common/errors.ts +0 -34
- package/src/common/logger.ts +0 -82
- package/src/common/types.ts +0 -385
- package/src/common/ui.ts +0 -228
- package/src/common/utils.ts +0 -81
- package/src/domain/index.ts +0 -1
- package/src/domain/interfaces.ts +0 -188
- package/src/domain/services/analysis.service.ts +0 -735
- package/src/domain/services/incremental.service.ts +0 -50
- package/src/index.ts +0 -6
- package/src/infrastructure/blacklist.service.ts +0 -37
- package/src/infrastructure/cache/file.hash.cache.ts +0 -119
- package/src/infrastructure/git/git.service.ts +0 -120
- package/src/infrastructure/git.service.ts +0 -121
- package/src/infrastructure/index.service.ts +0 -94
- package/src/infrastructure/llm/llm.usage.tracker.ts +0 -65
- package/src/infrastructure/llm/openai.client.ts +0 -162
- package/src/infrastructure/llm.service.ts +0 -70
- package/src/infrastructure/skill/skill.generator.ts +0 -53
- package/src/infrastructure/skill/templates/skill.md.template.ts +0 -45
- package/src/infrastructure/splitter/code.splitter.ts +0 -176
- package/src/infrastructure/storage.service.ts +0 -413
- package/src/infrastructure/worker-pool/parse.worker.impl.ts +0 -135
- package/src/infrastructure/worker-pool/parse.worker.ts +0 -9
- package/src/infrastructure/worker-pool/worker-pool.service.ts +0 -173
- package/tsconfig.json +0 -24
- package/tsconfig.test.json +0 -5
package/src/domain/interfaces.ts
DELETED
|
@@ -1,188 +0,0 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
AnalysisResult,
|
|
3
|
-
AnalysisParams,
|
|
4
|
-
FullAnalysisParams,
|
|
5
|
-
IncrementalAnalysisParams,
|
|
6
|
-
ResumeAnalysisParams,
|
|
7
|
-
FileAnalysis,
|
|
8
|
-
DirectoryAnalysis,
|
|
9
|
-
AnalysisCheckpoint,
|
|
10
|
-
ModificationLog,
|
|
11
|
-
LLMConfig,
|
|
12
|
-
LLMCallOptions,
|
|
13
|
-
LLMResponse,
|
|
14
|
-
FileChunk,
|
|
15
|
-
FileChunkAnalysis,
|
|
16
|
-
TokenUsageStats,
|
|
17
|
-
} from '../common/types'
|
|
18
|
-
|
|
19
|
-
// ===== V2.3 黑名单服务接口 =====
|
|
20
|
-
export interface IBlacklistService {
|
|
21
|
-
load(globalBlacklist: string[], projectRoot: string): Promise<void>
|
|
22
|
-
isIgnored(relativePath: string): boolean
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/** AI 工具 Provider 标识 */
|
|
26
|
-
export type SkillProvider = 'opencode' | 'cursor' | 'claude' | 'codex'
|
|
27
|
-
|
|
28
|
-
/** Skill 生成配置 */
|
|
29
|
-
export interface SkillGenerateOptions {
|
|
30
|
-
projectRoot: string
|
|
31
|
-
storageRoot: string
|
|
32
|
-
providers: SkillProvider[]
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/** Skill 生成器接口 */
|
|
36
|
-
export interface ISkillGenerator {
|
|
37
|
-
generate(options: SkillGenerateOptions): Promise<string[]>
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
// 解析服务接口
|
|
41
|
-
export interface IAnalysisService {
|
|
42
|
-
/** 统一解析入口:全量与增量共享管线,仅通过 fileFilter 区分 */
|
|
43
|
-
analyze(params: AnalysisParams): Promise<AnalysisResult>
|
|
44
|
-
/** @deprecated 向后兼容,内部转为 analyze 调用 */
|
|
45
|
-
fullAnalysis(params: FullAnalysisParams): Promise<AnalysisResult>
|
|
46
|
-
/** @deprecated 向后兼容,内部转为 analyze 调用 */
|
|
47
|
-
incrementalAnalysis(params: IncrementalAnalysisParams): Promise<AnalysisResult>
|
|
48
|
-
resumeAnalysis(params: ResumeAnalysisParams): Promise<AnalysisResult>
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
// 增量计算服务接口
|
|
52
|
-
export interface IIncrementalService {
|
|
53
|
-
canDoIncremental(projectRoot: string): Promise<{
|
|
54
|
-
available: boolean
|
|
55
|
-
baseCommit?: string
|
|
56
|
-
reason?: string
|
|
57
|
-
}>
|
|
58
|
-
getChangedFiles(projectRoot: string, baseCommit: string, targetCommit: string): Promise<string[]>
|
|
59
|
-
findNearestCommonAncestor(projectRoot: string, commits: string[]): Promise<string | null>
|
|
60
|
-
getAffectedDirectories(changedFiles: string[]): string[]
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
// 存储服务接口(V2.3 已移除 saveProjectSummary / getProjectSummary / saveModificationLog)
|
|
64
|
-
export interface IStorageService {
|
|
65
|
-
saveFileAnalysis(projectSlug: string, filePath: string, data: FileAnalysis): Promise<void>
|
|
66
|
-
saveDirectoryAnalysis(projectSlug: string, dirPath: string, data: DirectoryAnalysis): Promise<void>
|
|
67
|
-
getFileAnalysis(projectSlug: string, filePath: string, type: 'summary' | 'full' | 'diagram'): Promise<FileAnalysis | null>
|
|
68
|
-
getDirectoryAnalysis(projectSlug: string, dirPath: string, type: 'summary' | 'full' | 'diagram'): Promise<DirectoryAnalysis | null>
|
|
69
|
-
getCheckpoint(projectSlug: string): Promise<AnalysisCheckpoint | null>
|
|
70
|
-
saveCheckpoint(projectSlug: string, checkpoint: AnalysisCheckpoint): Promise<void>
|
|
71
|
-
getStoragePath(projectSlug: string): string
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
// Git操作服务接口
|
|
75
|
-
export interface IGitService {
|
|
76
|
-
isGitProject(projectRoot: string): Promise<boolean>
|
|
77
|
-
getCurrentCommit(projectRoot: string): Promise<string>
|
|
78
|
-
getCurrentBranch(projectRoot: string): Promise<string>
|
|
79
|
-
getProjectSlug(projectRoot: string): Promise<string>
|
|
80
|
-
getUncommittedChanges(projectRoot: string): Promise<string[]>
|
|
81
|
-
diffCommits(projectRoot: string, commit1: string, commit2: string): Promise<string[]>
|
|
82
|
-
/** 文件级 git commit id(最近一次修改该文件的提交),需求 10.3.2 / 13.8 */
|
|
83
|
-
getFileLastCommit(projectRoot: string, filePath: string): Promise<string | null>
|
|
84
|
-
/** 文件是否处于 dirty 状态(存在未提交修改),需求 10.3.2 / 13.8 */
|
|
85
|
-
isFileDirty(projectRoot: string, filePath: string): Promise<boolean>
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
// Worker调度服务接口
|
|
89
|
-
export interface IWorkerPoolService {
|
|
90
|
-
submitFileAnalysisTask(
|
|
91
|
-
filePath: string,
|
|
92
|
-
fileContent: string,
|
|
93
|
-
fileHash: string,
|
|
94
|
-
language?: string
|
|
95
|
-
): Promise<{ analysis: FileAnalysis; usage: TokenUsageStats }>
|
|
96
|
-
submitDirectoryAggregationTask(
|
|
97
|
-
dirPath: string,
|
|
98
|
-
payload: {
|
|
99
|
-
childrenDirs: Array<{ name: string; summary: string; description?: string }>
|
|
100
|
-
childrenFiles: Array<{ name: string; summary: string; description?: string }>
|
|
101
|
-
}
|
|
102
|
-
): Promise<{ description: string; summary: string; usage: TokenUsageStats }>
|
|
103
|
-
submitValidationTask(parentResult: DirectoryAnalysis, childResult: FileAnalysis | DirectoryAnalysis): Promise<{
|
|
104
|
-
valid: boolean
|
|
105
|
-
corrections?: Partial<FileAnalysis | DirectoryAnalysis>
|
|
106
|
-
log?: ModificationLog
|
|
107
|
-
}>
|
|
108
|
-
setConcurrency(concurrency: number): void
|
|
109
|
-
waitAll(): Promise<void>
|
|
110
|
-
cancelAll(): void
|
|
111
|
-
terminate(force?: boolean): Promise<void>
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
// LLM服务客户端接口
|
|
115
|
-
export interface ILLMClient {
|
|
116
|
-
/**
|
|
117
|
-
* 连接可用性校验(V2.5)
|
|
118
|
-
* - 在进入任何解析流程前调用;
|
|
119
|
-
* - 配置不完整或服务不可用时抛出带有明确 ErrorCode 的 AppError。
|
|
120
|
-
*/
|
|
121
|
-
testConnection(config: LLMConfig): Promise<void>;
|
|
122
|
-
|
|
123
|
-
/**
|
|
124
|
-
* 调用LLM服务执行请求
|
|
125
|
-
* @param prompt 提示词
|
|
126
|
-
* @param options 调用选项
|
|
127
|
-
*/
|
|
128
|
-
call(prompt: string, options?: LLMCallOptions): Promise<LLMResponse>;
|
|
129
|
-
|
|
130
|
-
/**
|
|
131
|
-
* 批量调用LLM服务
|
|
132
|
-
* @param prompts 提示词列表
|
|
133
|
-
* @param options 调用选项
|
|
134
|
-
*/
|
|
135
|
-
batchCall(prompts: string[], options?: LLMCallOptions): Promise<LLMResponse[]>;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
// 文件分片处理器接口
|
|
139
|
-
export interface IFileSplitter {
|
|
140
|
-
/**
|
|
141
|
-
* 按语义边界拆分大文件
|
|
142
|
-
* @param fileContent 文件内容
|
|
143
|
-
* @param maxChunkSize 单分片最大长度
|
|
144
|
-
*/
|
|
145
|
-
split(fileContent: string, maxChunkSize: number): Promise<FileChunk[]>;
|
|
146
|
-
|
|
147
|
-
/**
|
|
148
|
-
* 合并多个分片的解析结果
|
|
149
|
-
* @param chunks 分片解析结果列表
|
|
150
|
-
* @param filePath 文件路径
|
|
151
|
-
*/
|
|
152
|
-
merge(chunks: FileChunkAnalysis[], filePath: string): Promise<FileAnalysis>;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
// 解析结果缓存接口
|
|
156
|
-
export interface IAnalysisCache {
|
|
157
|
-
/**
|
|
158
|
-
* 获取缓存的解析结果
|
|
159
|
-
* @param fileHash 文件内容哈希
|
|
160
|
-
*/
|
|
161
|
-
get(fileHash: string): Promise<FileAnalysis | null>;
|
|
162
|
-
|
|
163
|
-
/**
|
|
164
|
-
* 保存解析结果到缓存
|
|
165
|
-
* @param fileHash 文件内容哈希
|
|
166
|
-
* @param result 解析结果
|
|
167
|
-
*/
|
|
168
|
-
set(fileHash: string, result: FileAnalysis): Promise<void>;
|
|
169
|
-
|
|
170
|
-
/**
|
|
171
|
-
* 清除缓存
|
|
172
|
-
* @param fileHash 可选,指定文件哈希清除,不传则清除全部
|
|
173
|
-
*/
|
|
174
|
-
clear(fileHash?: string): Promise<void>;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
// 代码解析器接口
|
|
178
|
-
export interface ICodeParser {
|
|
179
|
-
supportedExtensions: string[]
|
|
180
|
-
parse(fileContent: string, filePath: string): Promise<Omit<FileAnalysis, 'path' | 'type'>>
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
// 解析器注册中心接口
|
|
184
|
-
export interface IParserRegistry {
|
|
185
|
-
registerParser(parser: ICodeParser): void
|
|
186
|
-
getParser(extension: string): ICodeParser | null
|
|
187
|
-
getSupportedExtensions(): string[]
|
|
188
|
-
}
|