autosnippet 3.2.22 → 3.3.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/dashboard/dist/assets/{icons-C1dUryS-.js → icons-BofcEZ3f.js} +1 -1
- package/dashboard/dist/assets/index-SiN1GChm.js +128 -0
- package/dashboard/dist/index.html +2 -2
- package/dist/bin/cli.d.ts +0 -1
- package/dist/bin/cli.js +0 -133
- package/dist/lib/cli/SetupService.d.ts +46 -2
- package/dist/lib/cli/SetupService.js +2 -27
- package/dist/lib/{platform/ios/spm → core/discovery}/SpmDiscoverer.d.ts +2 -5
- package/dist/lib/{platform/ios/spm → core/discovery}/SpmDiscoverer.js +159 -44
- package/dist/lib/core/discovery/index.d.ts +1 -1
- package/dist/lib/core/discovery/index.js +2 -2
- package/dist/lib/external/mcp/handlers/guard.js +6 -3
- package/dist/lib/http/HttpServer.js +0 -6
- package/dist/lib/http/routes/commands.d.ts +1 -1
- package/dist/lib/http/routes/commands.js +1 -66
- package/dist/lib/http/routes/remote.js +0 -5
- package/dist/lib/injection/ServiceMap.d.ts +0 -9
- package/dist/lib/injection/modules/AppModule.d.ts +2 -3
- package/dist/lib/injection/modules/AppModule.js +3 -30
- package/dist/lib/service/module/ModuleService.js +3 -13
- package/dist/lib/service/search/SearchEngine.js +1 -1
- package/dist/lib/shared/constants.d.ts +0 -15
- package/dist/lib/shared/constants.js +0 -10
- package/dist/scripts/release.js +2 -10
- package/package.json +4 -19
- package/dashboard/dist/assets/index-DdvZE4Yd.js +0 -128
- package/dist/lib/http/routes/snippets.d.ts +0 -6
- package/dist/lib/http/routes/snippets.js +0 -49
- package/dist/lib/platform/ClipboardManager.d.ts +0 -24
- package/dist/lib/platform/ClipboardManager.js +0 -142
- package/dist/lib/platform/NativeUi.d.ts +0 -53
- package/dist/lib/platform/NativeUi.js +0 -284
- package/dist/lib/platform/ios/index.d.ts +0 -38
- package/dist/lib/platform/ios/index.js +0 -42
- package/dist/lib/platform/ios/routes/spm.d.ts +0 -9
- package/dist/lib/platform/ios/routes/spm.js +0 -371
- package/dist/lib/platform/ios/snippet/PlaceholderConverter.d.ts +0 -21
- package/dist/lib/platform/ios/snippet/PlaceholderConverter.js +0 -48
- package/dist/lib/platform/ios/snippet/XcodeCodec.d.ts +0 -23
- package/dist/lib/platform/ios/snippet/XcodeCodec.js +0 -96
- package/dist/lib/platform/ios/spm/DependencyGraph.d.ts +0 -56
- package/dist/lib/platform/ios/spm/DependencyGraph.js +0 -195
- package/dist/lib/platform/ios/spm/PackageSwiftParser.d.ts +0 -69
- package/dist/lib/platform/ios/spm/PackageSwiftParser.js +0 -231
- package/dist/lib/platform/ios/spm/PathFinder.d.ts +0 -28
- package/dist/lib/platform/ios/spm/PathFinder.js +0 -117
- package/dist/lib/platform/ios/spm/PolicyEngine.d.ts +0 -44
- package/dist/lib/platform/ios/spm/PolicyEngine.js +0 -79
- package/dist/lib/platform/ios/spm/SpmHelper.d.ts +0 -102
- package/dist/lib/platform/ios/spm/SpmHelper.js +0 -464
- package/dist/lib/platform/ios/xcode/HeaderResolver.d.ts +0 -33
- package/dist/lib/platform/ios/xcode/HeaderResolver.js +0 -90
- package/dist/lib/platform/ios/xcode/SaveEventFilter.d.ts +0 -66
- package/dist/lib/platform/ios/xcode/SaveEventFilter.js +0 -142
- package/dist/lib/platform/ios/xcode/XcodeAutomation.d.ts +0 -71
- package/dist/lib/platform/ios/xcode/XcodeAutomation.js +0 -327
- package/dist/lib/platform/ios/xcode/XcodeImportResolver.d.ts +0 -130
- package/dist/lib/platform/ios/xcode/XcodeImportResolver.js +0 -404
- package/dist/lib/platform/ios/xcode/XcodeIntegration.d.ts +0 -89
- package/dist/lib/platform/ios/xcode/XcodeIntegration.js +0 -588
- package/dist/lib/platform/ios/xcode/XcodeWriteUtils.d.ts +0 -99
- package/dist/lib/platform/ios/xcode/XcodeWriteUtils.js +0 -190
- package/dist/lib/service/automation/ActionPipeline.d.ts +0 -34
- package/dist/lib/service/automation/ActionPipeline.js +0 -53
- package/dist/lib/service/automation/AutomationOrchestrator.d.ts +0 -86
- package/dist/lib/service/automation/AutomationOrchestrator.js +0 -57
- package/dist/lib/service/automation/ContextCollector.d.ts +0 -24
- package/dist/lib/service/automation/ContextCollector.js +0 -35
- package/dist/lib/service/automation/DirectiveDetector.d.ts +0 -51
- package/dist/lib/service/automation/DirectiveDetector.js +0 -112
- package/dist/lib/service/automation/FileWatcher.d.ts +0 -51
- package/dist/lib/service/automation/FileWatcher.js +0 -366
- package/dist/lib/service/automation/TriggerResolver.d.ts +0 -36
- package/dist/lib/service/automation/TriggerResolver.js +0 -62
- package/dist/lib/service/automation/handlers/AlinkHandler.d.ts +0 -7
- package/dist/lib/service/automation/handlers/AlinkHandler.js +0 -80
- package/dist/lib/service/automation/handlers/CreateHandler.d.ts +0 -11
- package/dist/lib/service/automation/handlers/CreateHandler.js +0 -170
- package/dist/lib/service/automation/handlers/GuardHandler.d.ts +0 -17
- package/dist/lib/service/automation/handlers/GuardHandler.js +0 -218
- package/dist/lib/service/automation/handlers/HeaderHandler.d.ts +0 -2
- package/dist/lib/service/automation/handlers/HeaderHandler.js +0 -32
- package/dist/lib/service/automation/handlers/SearchHandler.d.ts +0 -11
- package/dist/lib/service/automation/handlers/SearchHandler.js +0 -278
- package/dist/lib/service/snippet/SnippetFactory.d.ts +0 -101
- package/dist/lib/service/snippet/SnippetFactory.js +0 -145
- package/dist/lib/service/snippet/SnippetInstaller.d.ts +0 -91
- package/dist/lib/service/snippet/SnippetInstaller.js +0 -276
- package/dist/lib/service/snippet/codecs/SnippetCodec.d.ts +0 -44
- package/dist/lib/service/snippet/codecs/SnippetCodec.js +0 -35
- package/dist/lib/service/snippet/codecs/VSCodeCodec.d.ts +0 -27
- package/dist/lib/service/snippet/codecs/VSCodeCodec.js +0 -82
- package/dist/scripts/build-native-ui.d.ts +0 -3
- package/dist/scripts/build-native-ui.js +0 -62
- package/dist/scripts/init-snippets.d.ts +0 -30
- package/dist/scripts/init-snippets.js +0 -298
- package/dist/scripts/install-full.d.ts +0 -7
- package/dist/scripts/install-full.js +0 -38
- package/resources/native-ui/README.md +0 -29
- package/resources/native-ui/combined-window.swift +0 -494
- package/resources/native-ui/main.swift +0 -598
- package/scripts/postinstall-safe.mjs +0 -89
|
@@ -414,15 +414,18 @@ export async function scanProject(ctx, args) {
|
|
|
414
414
|
const includeContent = args.includeContent || false;
|
|
415
415
|
const contentMaxLines = args.contentMaxLines || 100;
|
|
416
416
|
const projectRoot = resolveProjectRoot(ctx.container);
|
|
417
|
-
//
|
|
417
|
+
// 使用 ModuleService(多语言统一入口)
|
|
418
418
|
let service;
|
|
419
419
|
try {
|
|
420
420
|
const { ModuleService } = await import('#service/module/ModuleService.js');
|
|
421
421
|
service = new ModuleService(projectRoot);
|
|
422
422
|
}
|
|
423
423
|
catch {
|
|
424
|
-
|
|
425
|
-
|
|
424
|
+
return envelope({
|
|
425
|
+
success: false,
|
|
426
|
+
data: { targets: [], files: [], guardAudit: null, message: 'ModuleService not available' },
|
|
427
|
+
meta: { tool: 'autosnippet_bootstrap' },
|
|
428
|
+
});
|
|
426
429
|
}
|
|
427
430
|
await service.load();
|
|
428
431
|
const allTargets = await service.listTargets();
|
|
@@ -15,7 +15,6 @@ import { initErrorTracker } from '../infrastructure/monitoring/ErrorTracker.js';
|
|
|
15
15
|
import { initPerformanceMonitor } from '../infrastructure/monitoring/PerformanceMonitor.js';
|
|
16
16
|
import { initRealtimeService } from '../infrastructure/realtime/RealtimeService.js';
|
|
17
17
|
import { getServiceContainer } from '../injection/ServiceContainer.js';
|
|
18
|
-
import spmRouter from '../platform/ios/routes/spm.js';
|
|
19
18
|
import apiSpec from './api-spec.js';
|
|
20
19
|
import { errorHandler } from './middleware/errorHandler.js';
|
|
21
20
|
import { gatewayMiddleware } from './middleware/gatewayMiddleware.js';
|
|
@@ -36,7 +35,6 @@ import recipesRouter from './routes/recipes.js';
|
|
|
36
35
|
import remoteRouter from './routes/remote.js';
|
|
37
36
|
import searchRouter from './routes/search.js';
|
|
38
37
|
import skillsRouter from './routes/skills.js';
|
|
39
|
-
import snippetRouter from './routes/snippets.js';
|
|
40
38
|
import taskRouter from './routes/task.js';
|
|
41
39
|
import violationsRouter from './routes/violations.js';
|
|
42
40
|
import wikiRouter from './routes/wiki.js';
|
|
@@ -231,8 +229,6 @@ export class HttpServer {
|
|
|
231
229
|
this.app.use(`${apiPrefix}/task`, taskRouter);
|
|
232
230
|
// 搜索路由
|
|
233
231
|
this.app.use(`${apiPrefix}/search`, searchRouter);
|
|
234
|
-
// Snippet 路由
|
|
235
|
-
this.app.use(`${apiPrefix}/snippets`, snippetRouter);
|
|
236
232
|
// AI 路由
|
|
237
233
|
this.app.use(`${apiPrefix}/ai`, aiRouter);
|
|
238
234
|
// 提取路由
|
|
@@ -243,8 +239,6 @@ export class HttpServer {
|
|
|
243
239
|
this.app.use(`${apiPrefix}/skills`, skillsRouter);
|
|
244
240
|
// Candidates 路由(AI 补齐/润色)
|
|
245
241
|
this.app.use(`${apiPrefix}/candidates`, candidatesRouter);
|
|
246
|
-
// SPM 路由(向后兼容保留)
|
|
247
|
-
this.app.use(`${apiPrefix}/spm`, spmRouter);
|
|
248
242
|
// Modules 路由(v3.2 统一多语言模块扫描)
|
|
249
243
|
this.app.use(`${apiPrefix}/modules`, modulesRouter);
|
|
250
244
|
// 违规记录路由
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Commands API 路由
|
|
3
|
-
* 执行
|
|
3
|
+
* 执行 Module Map 刷新、Embed (重建索引) 等命令
|
|
4
4
|
*/
|
|
5
5
|
import express from 'express';
|
|
6
6
|
import Logger from '../../infrastructure/logging/Logger.js';
|
|
@@ -9,56 +9,6 @@ import { FileReadQuery, FileSaveBody } from '../../shared/schemas/http-requests.
|
|
|
9
9
|
import { validate, validateQuery } from '../middleware/validate.js';
|
|
10
10
|
const router = express.Router();
|
|
11
11
|
const logger = Logger.getInstance();
|
|
12
|
-
/**
|
|
13
|
-
* POST /api/v1/commands/install
|
|
14
|
-
* 从 Recipe 生成并同步 Snippet 到 IDE
|
|
15
|
-
* Body: { target?: 'xcode' | 'vscode' | 'all' }
|
|
16
|
-
*/
|
|
17
|
-
router.post('/install', async (req, res) => {
|
|
18
|
-
const container = getServiceContainer();
|
|
19
|
-
const knowledgeRepository = container.get('knowledgeRepository');
|
|
20
|
-
const target = req.body?.target || 'all';
|
|
21
|
-
// 获取所有活跃 Recipe(V3: lifecycle='active' 即 Recipe)
|
|
22
|
-
const result = await knowledgeRepository.findWithPagination({ lifecycle: 'active' }, { page: 1, pageSize: 9999 });
|
|
23
|
-
const recipes = (result?.data ??
|
|
24
|
-
result?.items ??
|
|
25
|
-
[])
|
|
26
|
-
.map((r) => ({
|
|
27
|
-
id: r.id,
|
|
28
|
-
title: r.title,
|
|
29
|
-
trigger: r.trigger,
|
|
30
|
-
code: r.content?.pattern || '',
|
|
31
|
-
description: r.description || r.summaryCn || '',
|
|
32
|
-
language: r.language || 'unknown',
|
|
33
|
-
}))
|
|
34
|
-
.filter((r) => String(r.code).trim().length > 0);
|
|
35
|
-
const installResults = {};
|
|
36
|
-
// Xcode
|
|
37
|
-
if ((target === 'all' || target === 'xcode') && process.platform === 'darwin') {
|
|
38
|
-
try {
|
|
39
|
-
const xcodeInstaller = container.get('snippetInstaller');
|
|
40
|
-
installResults.xcode = xcodeInstaller.installFromRecipes(recipes);
|
|
41
|
-
}
|
|
42
|
-
catch (e) {
|
|
43
|
-
installResults.xcode = { success: false, error: e.message };
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
// VSCode
|
|
47
|
-
if (target === 'all' || target === 'vscode') {
|
|
48
|
-
try {
|
|
49
|
-
const vscodeInstaller = container.get('vscodeSnippetInstaller');
|
|
50
|
-
installResults.vscode = vscodeInstaller.installFromRecipes(recipes);
|
|
51
|
-
}
|
|
52
|
-
catch (e) {
|
|
53
|
-
installResults.vscode = { success: false, error: e.message };
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
logger.info('Snippets installed via dashboard', { target, results: installResults });
|
|
57
|
-
res.json({
|
|
58
|
-
success: true,
|
|
59
|
-
data: installResults,
|
|
60
|
-
});
|
|
61
|
-
});
|
|
62
12
|
/**
|
|
63
13
|
* POST /api/v1/commands/spm-map
|
|
64
14
|
* 执行 SPM 依赖映射刷新(向后兼容)
|
|
@@ -126,24 +76,9 @@ router.post('/embed', async (req, res) => {
|
|
|
126
76
|
router.get('/status', async (req, res) => {
|
|
127
77
|
const container = getServiceContainer();
|
|
128
78
|
const status = {
|
|
129
|
-
snippets: { xcode: { synced: false }, vscode: { synced: false } },
|
|
130
79
|
index: { ready: false },
|
|
131
80
|
spmMap: { available: false },
|
|
132
81
|
};
|
|
133
|
-
try {
|
|
134
|
-
const snippetInstaller = container.get('snippetInstaller');
|
|
135
|
-
status.snippets.xcode.synced = (await snippetInstaller.listInstalled?.())?.length > 0;
|
|
136
|
-
}
|
|
137
|
-
catch {
|
|
138
|
-
/* ignore */
|
|
139
|
-
}
|
|
140
|
-
try {
|
|
141
|
-
const vscodeInstaller = container.get('vscodeSnippetInstaller');
|
|
142
|
-
status.snippets.vscode.synced = (await vscodeInstaller.listInstalled?.())?.length > 0;
|
|
143
|
-
}
|
|
144
|
-
catch {
|
|
145
|
-
/* ignore */
|
|
146
|
-
}
|
|
147
82
|
try {
|
|
148
83
|
const indexingPipeline = container.get('indexingPipeline');
|
|
149
84
|
status.index.ready = true; // IndexingPipeline is available
|
|
@@ -715,16 +715,12 @@ async function replyLark(messageId, text) {
|
|
|
715
715
|
/**
|
|
716
716
|
* 截取 IDE 窗口截图(通过 ScreenCaptureKit 原生 API,息屏时可用)
|
|
717
717
|
* @param [opts.windowTitle] 窗口标题关键词(默认 "Code")
|
|
718
|
-
* @returns >}
|
|
719
718
|
*/
|
|
720
719
|
async function captureIDEScreenshot(opts = {}) {
|
|
721
720
|
try {
|
|
722
721
|
const { screenshot } = await import('../../platform/ScreenCaptureService.js');
|
|
723
|
-
// 统一使用窗口截取(desktopIndependentWindow,亮屏/息屏均可用)
|
|
724
|
-
// 优先截取 IDE 窗口
|
|
725
722
|
const windowTitle = opts.windowTitle || 'Code';
|
|
726
723
|
let result = await screenshot({ windowTitle, format: 'png' });
|
|
727
|
-
// IDE 窗口未找到 → 尝试常见 IDE 名称
|
|
728
724
|
if (!result.success) {
|
|
729
725
|
for (const alt of ['Visual Studio', 'Cursor', 'Xcode', 'IntelliJ', 'WebStorm']) {
|
|
730
726
|
if (alt.toLowerCase() === windowTitle.toLowerCase()) {
|
|
@@ -736,7 +732,6 @@ async function captureIDEScreenshot(opts = {}) {
|
|
|
736
732
|
}
|
|
737
733
|
}
|
|
738
734
|
}
|
|
739
|
-
// 仍未找到 → 不指定窗口名,Swift 工具会自动选最大窗口
|
|
740
735
|
if (!result.success) {
|
|
741
736
|
logger.info(`[Remote/Screenshot] IDE window not found, capturing largest available window`);
|
|
742
737
|
result = await screenshot({ format: 'png' });
|
|
@@ -21,11 +21,9 @@ import type { EventBus } from '../infrastructure/event/EventBus.js';
|
|
|
21
21
|
import type Logger from '../infrastructure/logging/Logger.js';
|
|
22
22
|
import type { IndexingPipeline } from '../infrastructure/vector/IndexingPipeline.js';
|
|
23
23
|
import type { VectorStore } from '../infrastructure/vector/VectorStore.js';
|
|
24
|
-
import type { SpmHelper } from '../platform/ios/spm/SpmHelper.js';
|
|
25
24
|
import type { KnowledgeRepositoryImpl } from '../repository/knowledge/KnowledgeRepository.impl.js';
|
|
26
25
|
import type { TaskRepositoryImpl } from '../repository/task/TaskRepository.impl.js';
|
|
27
26
|
import type { TokenUsageStore } from '../repository/token/TokenUsageStore.js';
|
|
28
|
-
import type { AutomationOrchestrator } from '../service/automation/AutomationOrchestrator.js';
|
|
29
27
|
import type { BootstrapTaskManager } from '../service/bootstrap/BootstrapTaskManager.js';
|
|
30
28
|
import type DimensionCopy from '../service/bootstrap/DimensionCopyRegistry.js';
|
|
31
29
|
import type { CursorDeliveryPipeline } from '../service/delivery/CursorDeliveryPipeline.js';
|
|
@@ -50,8 +48,6 @@ import type { RecipeParser } from '../service/recipe/RecipeParser.js';
|
|
|
50
48
|
import type { HybridRetriever } from '../service/search/HybridRetriever.js';
|
|
51
49
|
import type SearchEngine from '../service/search/SearchEngine.js';
|
|
52
50
|
import type { SkillHooks } from '../service/skills/SkillHooks.js';
|
|
53
|
-
import type { SnippetFactory } from '../service/snippet/SnippetFactory.js';
|
|
54
|
-
import type { SnippetInstaller } from '../service/snippet/SnippetInstaller.js';
|
|
55
51
|
import type { TaskGraphService } from '../service/task/TaskGraphService.js';
|
|
56
52
|
import type { TaskKnowledgeBridge } from '../service/task/TaskKnowledgeBridge.js';
|
|
57
53
|
import type { TaskReadyEngine } from '../service/task/TaskReadyEngine.js';
|
|
@@ -82,11 +78,6 @@ export interface ServiceMap {
|
|
|
82
78
|
recipeExtractor: RecipeExtractor | null;
|
|
83
79
|
feedbackCollector: FeedbackCollector;
|
|
84
80
|
tokenUsageStore: TokenUsageStore;
|
|
85
|
-
snippetFactory: SnippetFactory;
|
|
86
|
-
snippetInstaller: SnippetInstaller;
|
|
87
|
-
vscodeSnippetInstaller: SnippetInstaller;
|
|
88
|
-
spmService: SpmHelper;
|
|
89
|
-
automationOrchestrator: AutomationOrchestrator;
|
|
90
81
|
moduleService: ModuleService;
|
|
91
82
|
cursorDeliveryPipeline: CursorDeliveryPipeline;
|
|
92
83
|
taskIdGenerator: TaskIdGenerator;
|
|
@@ -2,10 +2,9 @@
|
|
|
2
2
|
* AppModule — 应用层杂项服务注册
|
|
3
3
|
*
|
|
4
4
|
* 负责注册:
|
|
5
|
-
* - recipeParser, recipeCandidateValidator
|
|
5
|
+
* - recipeParser, recipeCandidateValidator
|
|
6
6
|
* - qualityScorer, feedbackCollector, tokenUsageStore, recipeExtractor
|
|
7
|
-
* -
|
|
8
|
-
* - cursorDeliveryPipeline
|
|
7
|
+
* - moduleService, cursorDeliveryPipeline
|
|
9
8
|
* - taskIdGenerator, taskReadyEngine, taskKnowledgeBridge, taskGraphService
|
|
10
9
|
*/
|
|
11
10
|
import type { ServiceContainer } from '../ServiceContainer.js';
|
|
@@ -2,18 +2,14 @@
|
|
|
2
2
|
* AppModule — 应用层杂项服务注册
|
|
3
3
|
*
|
|
4
4
|
* 负责注册:
|
|
5
|
-
* - recipeParser, recipeCandidateValidator
|
|
5
|
+
* - recipeParser, recipeCandidateValidator
|
|
6
6
|
* - qualityScorer, feedbackCollector, tokenUsageStore, recipeExtractor
|
|
7
|
-
* -
|
|
8
|
-
* - cursorDeliveryPipeline
|
|
7
|
+
* - moduleService, cursorDeliveryPipeline
|
|
9
8
|
* - taskIdGenerator, taskReadyEngine, taskKnowledgeBridge, taskGraphService
|
|
10
9
|
*/
|
|
11
10
|
import { resolveProjectRoot } from '#shared/resolveProjectRoot.js';
|
|
12
11
|
import { TaskIdGenerator } from '../../domain/task/TaskIdGenerator.js';
|
|
13
|
-
import { XcodeCodec } from '../../platform/ios/snippet/XcodeCodec.js';
|
|
14
|
-
import { SpmHelper } from '../../platform/ios/spm/SpmHelper.js';
|
|
15
12
|
import { TokenUsageStore } from '../../repository/token/TokenUsageStore.js';
|
|
16
|
-
import { AutomationOrchestrator } from '../../service/automation/AutomationOrchestrator.js';
|
|
17
13
|
import { CursorDeliveryPipeline } from '../../service/delivery/CursorDeliveryPipeline.js';
|
|
18
14
|
import { RecipeExtractor } from '../../service/knowledge/RecipeExtractor.js';
|
|
19
15
|
import { ModuleService } from '../../service/module/ModuleService.js';
|
|
@@ -21,9 +17,6 @@ import { FeedbackCollector } from '../../service/quality/FeedbackCollector.js';
|
|
|
21
17
|
import { QualityScorer } from '../../service/quality/QualityScorer.js';
|
|
22
18
|
import { RecipeCandidateValidator } from '../../service/recipe/RecipeCandidateValidator.js';
|
|
23
19
|
import { RecipeParser } from '../../service/recipe/RecipeParser.js';
|
|
24
|
-
import { VSCodeCodec } from '../../service/snippet/codecs/VSCodeCodec.js';
|
|
25
|
-
import { SnippetFactory } from '../../service/snippet/SnippetFactory.js';
|
|
26
|
-
import { SnippetInstaller } from '../../service/snippet/SnippetInstaller.js';
|
|
27
20
|
import { TaskGraphService } from '../../service/task/TaskGraphService.js';
|
|
28
21
|
import { TaskKnowledgeBridge } from '../../service/task/TaskKnowledgeBridge.js';
|
|
29
22
|
import { TaskReadyEngine } from '../../service/task/TaskReadyEngine.js';
|
|
@@ -41,27 +34,7 @@ export function register(c) {
|
|
|
41
34
|
const db = ct.get('database');
|
|
42
35
|
return new TokenUsageStore(db.getDb(), db.getDrizzle());
|
|
43
36
|
});
|
|
44
|
-
// ═══
|
|
45
|
-
c.singleton('snippetFactory', (ct) => {
|
|
46
|
-
const factory = new SnippetFactory(ct.get('knowledgeRepository'));
|
|
47
|
-
factory.registerCodec(new XcodeCodec());
|
|
48
|
-
factory.registerCodec(new VSCodeCodec());
|
|
49
|
-
return factory;
|
|
50
|
-
});
|
|
51
|
-
c.singleton('snippetInstaller', (ct) => {
|
|
52
|
-
const factory = ct.get('snippetFactory');
|
|
53
|
-
return new SnippetInstaller({ codec: factory.getCodec('xcode'), snippetFactory: factory });
|
|
54
|
-
});
|
|
55
|
-
c.singleton('vscodeSnippetInstaller', (ct) => {
|
|
56
|
-
const factory = ct.get('snippetFactory');
|
|
57
|
-
return new SnippetInstaller({ codec: factory.getCodec('vscode'), snippetFactory: factory });
|
|
58
|
-
});
|
|
59
|
-
// ═══ Platform + Automation ═══
|
|
60
|
-
c.singleton('spmService', (ct) => {
|
|
61
|
-
const projectRoot = resolveProjectRoot(ct);
|
|
62
|
-
return new SpmHelper(projectRoot);
|
|
63
|
-
});
|
|
64
|
-
c.singleton('automationOrchestrator', () => new AutomationOrchestrator());
|
|
37
|
+
// ═══ Module ═══
|
|
65
38
|
c.singleton('moduleService', (ct) => {
|
|
66
39
|
const projectRoot = resolveProjectRoot(ct);
|
|
67
40
|
return new ModuleService(projectRoot, {
|
|
@@ -366,19 +366,9 @@ export class ModuleService {
|
|
|
366
366
|
if (!Array.isArray(recipes)) {
|
|
367
367
|
recipes = [];
|
|
368
368
|
}
|
|
369
|
-
// 3.5
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
const HeaderResolver = await import('../../platform/ios/xcode/HeaderResolver.js');
|
|
373
|
-
const targetRootDir = await PathFinder.findTargetRootDir(files[0].path);
|
|
374
|
-
for (const recipe of recipes) {
|
|
375
|
-
const headerList = (recipe.headers || []);
|
|
376
|
-
recipe.headerPaths = await Promise.all(headerList.map((h) => HeaderResolver.resolveHeaderRelativePath(h, targetRootDir)));
|
|
377
|
-
recipe.moduleName = targetName;
|
|
378
|
-
}
|
|
379
|
-
}
|
|
380
|
-
catch (err) {
|
|
381
|
-
this.#logger.warn(`[ModuleService] Header resolution failed: ${err.message}`);
|
|
369
|
+
// 3.5 moduleName 注入
|
|
370
|
+
for (const recipe of recipes) {
|
|
371
|
+
recipe.moduleName = targetName;
|
|
382
372
|
}
|
|
383
373
|
// 4. 工具增强
|
|
384
374
|
onProgress?.({ type: 'scan:enriching', recipeCount: recipes.length });
|
|
@@ -78,14 +78,6 @@ export declare const SEARCH: Readonly<{
|
|
|
78
78
|
DEFAULT_LIMIT: 10;
|
|
79
79
|
MAX_RESULTS: 100;
|
|
80
80
|
}>;
|
|
81
|
-
/** FileWatcher 配置 */
|
|
82
|
-
export declare const FILE_WATCHER: Readonly<{
|
|
83
|
-
DEBOUNCE_DELAY_MS: 300;
|
|
84
|
-
STABILITY_THRESHOLD_MS: 500;
|
|
85
|
-
POLL_INTERVAL_MS: 100;
|
|
86
|
-
BINARY_INTERVAL_MS: 300;
|
|
87
|
-
MAX_FILE_SIZE_BYTES: number;
|
|
88
|
-
}>;
|
|
89
81
|
/** AiProvider 熔断配置 */
|
|
90
82
|
export declare const AI_CIRCUIT_BREAKER: Readonly<{
|
|
91
83
|
FAILURE_THRESHOLD: 5;
|
|
@@ -176,13 +168,6 @@ declare const _default: {
|
|
|
176
168
|
DEFAULT_LIMIT: 10;
|
|
177
169
|
MAX_RESULTS: 100;
|
|
178
170
|
}>;
|
|
179
|
-
FILE_WATCHER: Readonly<{
|
|
180
|
-
DEBOUNCE_DELAY_MS: 300;
|
|
181
|
-
STABILITY_THRESHOLD_MS: 500;
|
|
182
|
-
POLL_INTERVAL_MS: 100;
|
|
183
|
-
BINARY_INTERVAL_MS: 300;
|
|
184
|
-
MAX_FILE_SIZE_BYTES: number;
|
|
185
|
-
}>;
|
|
186
171
|
AI_CIRCUIT_BREAKER: Readonly<{
|
|
187
172
|
FAILURE_THRESHOLD: 5;
|
|
188
173
|
}>;
|
|
@@ -83,15 +83,6 @@ export const SEARCH = Object.freeze({
|
|
|
83
83
|
DEFAULT_LIMIT: 10,
|
|
84
84
|
MAX_RESULTS: 100,
|
|
85
85
|
});
|
|
86
|
-
// ─── 文件监听器 ──────────────────────────────────────────
|
|
87
|
-
/** FileWatcher 配置 */
|
|
88
|
-
export const FILE_WATCHER = Object.freeze({
|
|
89
|
-
DEBOUNCE_DELAY_MS: 300,
|
|
90
|
-
STABILITY_THRESHOLD_MS: 500,
|
|
91
|
-
POLL_INTERVAL_MS: 100,
|
|
92
|
-
BINARY_INTERVAL_MS: 300,
|
|
93
|
-
MAX_FILE_SIZE_BYTES: 1024 * 1024,
|
|
94
|
-
});
|
|
95
86
|
// ─── AI Provider ─────────────────────────────────────────
|
|
96
87
|
/** AiProvider 熔断配置 */
|
|
97
88
|
export const AI_CIRCUIT_BREAKER = Object.freeze({
|
|
@@ -129,7 +120,6 @@ export default {
|
|
|
129
120
|
COMPLIANCE_SCORING,
|
|
130
121
|
KNOWLEDGE_CONFIDENCE,
|
|
131
122
|
SEARCH,
|
|
132
|
-
FILE_WATCHER,
|
|
133
123
|
AI_CIRCUIT_BREAKER,
|
|
134
124
|
CACHE,
|
|
135
125
|
MONITORING,
|
package/dist/scripts/release.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* 用途:自动化发布前检查和发布流程
|
|
5
5
|
* 使用:node scripts/release.js [patch|minor|major]
|
|
6
6
|
*/
|
|
7
|
-
import { DASHBOARD_DIR, PACKAGE_ROOT
|
|
7
|
+
import { DASHBOARD_DIR, PACKAGE_ROOT } from '../lib/shared/package-root.js';
|
|
8
8
|
const __dirname = import.meta.dirname;
|
|
9
9
|
import { execSync } from 'node:child_process';
|
|
10
10
|
import fs from 'node:fs';
|
|
@@ -196,15 +196,7 @@ class ReleaseChecker {
|
|
|
196
196
|
// 检查其他构建产物
|
|
197
197
|
checkBuildArtifacts() {
|
|
198
198
|
header('其他构建产物检查');
|
|
199
|
-
|
|
200
|
-
if (!fs.existsSync(nativeUI)) {
|
|
201
|
-
this.warnings.push('Native UI 未构建 (执行 npm run build:native-ui)');
|
|
202
|
-
warning('Native UI: 未构建');
|
|
203
|
-
}
|
|
204
|
-
else {
|
|
205
|
-
const stat = fs.statSync(nativeUI);
|
|
206
|
-
success(`Native UI: 已构建 (${new Date(stat.mtime).toLocaleString()})`);
|
|
207
|
-
}
|
|
199
|
+
success('No platform-specific binaries to check');
|
|
208
200
|
}
|
|
209
201
|
// 运行测试
|
|
210
202
|
runTests() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "autosnippet",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.0",
|
|
4
4
|
"description": "Extract code patterns into a knowledge base for AI coding assistants",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/lib/bootstrap.js",
|
|
@@ -61,14 +61,11 @@
|
|
|
61
61
|
"build": "tsc",
|
|
62
62
|
"build:check": "tsc --noEmit",
|
|
63
63
|
"postbuild": "node scripts/postbuild.mjs",
|
|
64
|
-
"
|
|
65
|
-
"prepublishOnly": "npm run build && npm run build:dashboard && node dist/scripts/build-native-ui.js",
|
|
66
|
-
"build:native-ui": "swiftc resources/native-ui/main.swift resources/native-ui/combined-window.swift -o resources/native-ui/native-ui -framework AppKit",
|
|
64
|
+
"prepublishOnly": "npm run build && npm run build:dashboard",
|
|
67
65
|
"build:screenshot": "swiftc -O -framework ScreenCaptureKit -framework AppKit resources/native-ui/screenshot.swift -o resources/native-ui/screenshot",
|
|
68
66
|
"install:cursor-skill": "node dist/scripts/install-cursor-skill.js",
|
|
69
67
|
"install:cursor-skill:mcp": "node dist/scripts/install-cursor-skill.js --mcp",
|
|
70
68
|
"install:vscode-copilot": "node dist/scripts/install-vscode-copilot.js",
|
|
71
|
-
"install:full": "node dist/scripts/install-full.js",
|
|
72
69
|
"verify:context-api": "node dist/scripts/verify-context-api.js",
|
|
73
70
|
"setup:mcp": "node dist/scripts/setup-mcp-config.js --editor vscode && node dist/scripts/setup-mcp-config.js --editor cursor",
|
|
74
71
|
"build:dashboard": "cd dashboard && npm run build",
|
|
@@ -87,9 +84,6 @@
|
|
|
87
84
|
"release:major": "node dist/scripts/release.js major",
|
|
88
85
|
"cli": "node dist/bin/cli.js",
|
|
89
86
|
"mcp": "node dist/bin/mcp-server.js",
|
|
90
|
-
"init:snippets": "node dist/scripts/init-snippets.js init",
|
|
91
|
-
"list:snippets": "node dist/scripts/init-snippets.js list",
|
|
92
|
-
"remove:snippets": "node dist/scripts/init-snippets.js remove",
|
|
93
87
|
"diagnose:mcp": "node dist/scripts/diagnose-mcp.js",
|
|
94
88
|
"lint": "biome check lib/ bin/ config/ scripts/",
|
|
95
89
|
"lint:fix": "biome check --fix lib/ bin/ config/ scripts/",
|
|
@@ -105,10 +99,9 @@
|
|
|
105
99
|
"asd-mcp": "dist/bin/mcp-server.js"
|
|
106
100
|
},
|
|
107
101
|
"keywords": [
|
|
108
|
-
"snippet",
|
|
109
|
-
"code-snippet",
|
|
110
102
|
"knowledge-base",
|
|
111
103
|
"ai",
|
|
104
|
+
"ai-agent",
|
|
112
105
|
"mcp",
|
|
113
106
|
"copilot",
|
|
114
107
|
"cursor",
|
|
@@ -116,12 +109,10 @@
|
|
|
116
109
|
"guard",
|
|
117
110
|
"ast",
|
|
118
111
|
"tree-sitter",
|
|
119
|
-
"xcode",
|
|
120
|
-
"ios",
|
|
121
|
-
"swift",
|
|
122
112
|
"typescript",
|
|
123
113
|
"javascript",
|
|
124
114
|
"python",
|
|
115
|
+
"swift",
|
|
125
116
|
"rust",
|
|
126
117
|
"kotlin",
|
|
127
118
|
"developer-tools",
|
|
@@ -136,7 +127,6 @@
|
|
|
136
127
|
"@larksuiteoapi/node-sdk": "^1.59.0",
|
|
137
128
|
"@modelcontextprotocol/sdk": "^1.27.1",
|
|
138
129
|
"better-sqlite3": "^12.6.2",
|
|
139
|
-
"chokidar": "^5.0.0",
|
|
140
130
|
"commander": "^14.0.3",
|
|
141
131
|
"cors": "^2.8.6",
|
|
142
132
|
"dotenv": "^17.3.1",
|
|
@@ -161,18 +151,13 @@
|
|
|
161
151
|
"files": [
|
|
162
152
|
"dist",
|
|
163
153
|
"config",
|
|
164
|
-
"scripts/postinstall-safe.mjs",
|
|
165
154
|
"scripts/postbuild.mjs",
|
|
166
155
|
"skills",
|
|
167
156
|
"templates",
|
|
168
157
|
"dashboard/dist",
|
|
169
158
|
"template.json",
|
|
170
|
-
"resources/native-ui/main.swift",
|
|
171
|
-
"resources/native-ui/combined-window.swift",
|
|
172
|
-
"resources/native-ui/native-ui",
|
|
173
159
|
"resources/native-ui/screenshot.swift",
|
|
174
160
|
"resources/native-ui/screenshot",
|
|
175
|
-
"resources/native-ui/README.md",
|
|
176
161
|
"resources/openChrome.applescript",
|
|
177
162
|
"resources/grammars"
|
|
178
163
|
],
|