autosnippet 3.2.21 → 3.3.2

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.
Files changed (311) hide show
  1. package/dashboard/dist/assets/icons-BJ2mUBi8.js +1 -0
  2. package/dashboard/dist/assets/index-B659K9t5.js +128 -0
  3. package/dashboard/dist/assets/index-NCm40PMD.css +1 -0
  4. package/dashboard/dist/index.html +3 -3
  5. package/dist/bin/cli.d.ts +1 -1
  6. package/dist/bin/cli.js +244 -261
  7. package/dist/lib/agent/context/ExplorationTracker.d.ts +2 -0
  8. package/dist/lib/agent/context/ExplorationTracker.js +21 -3
  9. package/dist/lib/agent/core/ToolExecutionPipeline.d.ts +3 -1
  10. package/dist/lib/agent/core/ToolExecutionPipeline.js +8 -1
  11. package/dist/lib/agent/forge/DynamicComposer.d.ts +58 -0
  12. package/dist/lib/agent/forge/DynamicComposer.js +99 -0
  13. package/dist/lib/agent/forge/SandboxRunner.d.ts +60 -0
  14. package/dist/lib/agent/forge/SandboxRunner.js +251 -0
  15. package/dist/lib/agent/forge/TemporaryToolRegistry.d.ts +76 -0
  16. package/dist/lib/agent/forge/TemporaryToolRegistry.js +154 -0
  17. package/dist/lib/agent/forge/ToolForge.d.ts +92 -0
  18. package/dist/lib/agent/forge/ToolForge.js +239 -0
  19. package/dist/lib/agent/forge/ToolRequirementAnalyzer.d.ts +44 -0
  20. package/dist/lib/agent/forge/ToolRequirementAnalyzer.js +119 -0
  21. package/dist/lib/agent/tools/ToolRegistry.d.ts +2 -0
  22. package/dist/lib/agent/tools/ToolRegistry.js +4 -0
  23. package/dist/lib/agent/tools/composite.js +0 -1
  24. package/dist/lib/agent/tools/index.d.ts +2 -50
  25. package/dist/lib/agent/tools/index.js +2 -3
  26. package/dist/lib/agent/tools/lifecycle.d.ts +1 -58
  27. package/dist/lib/agent/tools/lifecycle.js +2 -75
  28. package/dist/lib/cli/SetupService.d.ts +46 -2
  29. package/dist/lib/cli/SetupService.js +2 -27
  30. package/dist/lib/cli/deploy/FileManifest.d.ts +0 -21
  31. package/dist/lib/cli/deploy/FileManifest.js +0 -11
  32. package/dist/lib/{platform/ios/spm → core/discovery}/SpmDiscoverer.d.ts +2 -5
  33. package/dist/lib/{platform/ios/spm → core/discovery}/SpmDiscoverer.js +159 -44
  34. package/dist/lib/core/discovery/index.d.ts +1 -1
  35. package/dist/lib/core/discovery/index.js +2 -2
  36. package/dist/lib/domain/knowledge/KnowledgeEntry.d.ts +10 -0
  37. package/dist/lib/domain/knowledge/KnowledgeEntry.js +2 -0
  38. package/dist/lib/domain/knowledge/Lifecycle.d.ts +19 -2
  39. package/dist/lib/domain/knowledge/Lifecycle.js +32 -6
  40. package/dist/lib/domain/knowledge/UnifiedValidator.d.ts +1 -5
  41. package/dist/lib/domain/knowledge/UnifiedValidator.js +7 -44
  42. package/dist/lib/domain/knowledge/values/Stats.d.ts +29 -0
  43. package/dist/lib/domain/knowledge/values/Stats.js +41 -0
  44. package/dist/lib/external/mcp/McpServer.d.ts +19 -38
  45. package/dist/lib/external/mcp/McpServer.js +145 -117
  46. package/dist/lib/external/mcp/autoApproveInjector.js +0 -2
  47. package/dist/lib/external/mcp/handlers/bootstrap/MissionBriefingBuilder.d.ts +26 -1
  48. package/dist/lib/external/mcp/handlers/bootstrap/MissionBriefingBuilder.js +41 -0
  49. package/dist/lib/external/mcp/handlers/bootstrap/pipeline/orchestrator.js +49 -0
  50. package/dist/lib/external/mcp/handlers/bootstrap/shared/bootstrap-phases.d.ts +3 -0
  51. package/dist/lib/external/mcp/handlers/bootstrap/shared/bootstrap-phases.js +27 -0
  52. package/dist/lib/external/mcp/handlers/bootstrap/skills.js +1 -1
  53. package/dist/lib/external/mcp/handlers/bootstrap-external.js +1 -0
  54. package/dist/lib/external/mcp/handlers/bootstrap-internal.js +2 -0
  55. package/dist/lib/external/mcp/handlers/consolidated.d.ts +116 -6
  56. package/dist/lib/external/mcp/handlers/consolidated.js +251 -71
  57. package/dist/lib/external/mcp/handlers/guard.d.ts +150 -0
  58. package/dist/lib/external/mcp/handlers/guard.js +245 -8
  59. package/dist/lib/external/mcp/handlers/knowledge.d.ts +0 -29
  60. package/dist/lib/external/mcp/handlers/knowledge.js +1 -76
  61. package/dist/lib/external/mcp/handlers/panorama.d.ts +36 -0
  62. package/dist/lib/external/mcp/handlers/panorama.js +156 -0
  63. package/dist/lib/external/mcp/handlers/system.d.ts +2 -54
  64. package/dist/lib/external/mcp/handlers/system.js +3 -113
  65. package/dist/lib/external/mcp/handlers/task.d.ts +13 -24
  66. package/dist/lib/external/mcp/handlers/task.js +217 -557
  67. package/dist/lib/external/mcp/handlers/types.d.ts +91 -8
  68. package/dist/lib/external/mcp/handlers/types.js +18 -1
  69. package/dist/lib/external/mcp/handlers/wiki-external.d.ts +18 -1
  70. package/dist/lib/external/mcp/handlers/wiki-external.js +16 -1
  71. package/dist/lib/external/mcp/tools.d.ts +14 -20
  72. package/dist/lib/external/mcp/tools.js +62 -91
  73. package/dist/lib/http/HttpServer.js +52 -6
  74. package/dist/lib/http/routes/{snippets.d.ts → audit.d.ts} +4 -2
  75. package/dist/lib/http/routes/audit.js +51 -0
  76. package/dist/lib/http/routes/commands.d.ts +1 -1
  77. package/dist/lib/http/routes/commands.js +1 -66
  78. package/dist/lib/http/routes/guardReport.d.ts +10 -0
  79. package/dist/lib/http/routes/guardReport.js +143 -0
  80. package/dist/lib/http/routes/knowledge.js +32 -1
  81. package/dist/lib/http/routes/panorama.d.ts +11 -0
  82. package/dist/lib/http/routes/panorama.js +322 -0
  83. package/dist/lib/http/routes/remote.js +0 -5
  84. package/dist/lib/http/routes/signals.d.ts +10 -0
  85. package/dist/lib/http/routes/signals.js +104 -0
  86. package/dist/lib/http/routes/task.d.ts +2 -3
  87. package/dist/lib/http/routes/task.js +17 -347
  88. package/dist/lib/http/routes/violations.js +1 -1
  89. package/dist/lib/infrastructure/audit/AuditLogger.d.ts +6 -1
  90. package/dist/lib/infrastructure/audit/AuditLogger.js +14 -1
  91. package/dist/lib/infrastructure/database/drizzle/schema.d.ts +181 -583
  92. package/dist/lib/infrastructure/database/drizzle/schema.js +28 -69
  93. package/dist/lib/infrastructure/database/migrations/004_evolution_proposals.d.ts +8 -0
  94. package/dist/lib/infrastructure/database/migrations/004_evolution_proposals.js +43 -0
  95. package/dist/lib/infrastructure/logging/Logger.d.ts +2 -0
  96. package/dist/lib/infrastructure/logging/Logger.js +34 -7
  97. package/dist/lib/infrastructure/monitoring/ErrorTracker.js +3 -1
  98. package/dist/lib/infrastructure/monitoring/PerformanceMonitor.d.ts +2 -2
  99. package/dist/lib/infrastructure/monitoring/PerformanceMonitor.js +12 -10
  100. package/dist/lib/infrastructure/notification/LarkNotifier.d.ts +24 -0
  101. package/dist/lib/infrastructure/notification/LarkNotifier.js +97 -0
  102. package/dist/lib/infrastructure/report/ReportStore.d.ts +45 -0
  103. package/dist/lib/infrastructure/report/ReportStore.js +133 -0
  104. package/dist/lib/infrastructure/signal/SignalAggregator.d.ts +18 -0
  105. package/dist/lib/infrastructure/signal/SignalAggregator.js +84 -0
  106. package/dist/lib/infrastructure/signal/SignalBridge.d.ts +13 -0
  107. package/dist/lib/infrastructure/signal/SignalBridge.js +20 -0
  108. package/dist/lib/infrastructure/signal/SignalBus.d.ts +63 -0
  109. package/dist/lib/infrastructure/signal/SignalBus.js +106 -0
  110. package/dist/lib/infrastructure/signal/SignalTraceWriter.d.ts +36 -0
  111. package/dist/lib/infrastructure/signal/SignalTraceWriter.js +130 -0
  112. package/dist/lib/injection/ServiceContainer.js +6 -0
  113. package/dist/lib/injection/ServiceMap.d.ts +16 -19
  114. package/dist/lib/injection/modules/AgentModule.d.ts +1 -1
  115. package/dist/lib/injection/modules/AgentModule.js +7 -1
  116. package/dist/lib/injection/modules/AppModule.d.ts +3 -4
  117. package/dist/lib/injection/modules/AppModule.js +7 -43
  118. package/dist/lib/injection/modules/GuardModule.js +59 -2
  119. package/dist/lib/injection/modules/InfraModule.d.ts +0 -1
  120. package/dist/lib/injection/modules/InfraModule.js +9 -7
  121. package/dist/lib/injection/modules/KnowledgeModule.js +51 -0
  122. package/dist/lib/injection/modules/PanoramaModule.d.ts +18 -0
  123. package/dist/lib/injection/modules/PanoramaModule.js +76 -0
  124. package/dist/lib/injection/modules/SignalModule.d.ts +10 -0
  125. package/dist/lib/injection/modules/SignalModule.js +84 -0
  126. package/dist/lib/repository/knowledge/KnowledgeRepository.impl.d.ts +1 -0
  127. package/dist/lib/repository/knowledge/KnowledgeRepository.impl.js +6 -0
  128. package/dist/lib/service/bootstrap/BootstrapTaskManager.d.ts +3 -1
  129. package/dist/lib/service/bootstrap/BootstrapTaskManager.js +20 -1
  130. package/dist/lib/service/delivery/AgentInstructionsGenerator.js +4 -5
  131. package/dist/lib/service/delivery/CursorDeliveryPipeline.d.ts +3 -1
  132. package/dist/lib/service/delivery/CursorDeliveryPipeline.js +13 -10
  133. package/dist/lib/service/delivery/RulesGenerator.js +3 -2
  134. package/dist/lib/service/evolution/ConsolidationAdvisor.d.ts +114 -0
  135. package/dist/lib/service/evolution/ConsolidationAdvisor.js +542 -0
  136. package/dist/lib/service/evolution/ContradictionDetector.d.ts +54 -0
  137. package/dist/lib/service/evolution/ContradictionDetector.js +253 -0
  138. package/dist/lib/service/evolution/DecayDetector.d.ts +71 -0
  139. package/dist/lib/service/evolution/DecayDetector.js +244 -0
  140. package/dist/lib/service/evolution/EnhancementSuggester.d.ts +38 -0
  141. package/dist/lib/service/evolution/EnhancementSuggester.js +220 -0
  142. package/dist/lib/service/evolution/KnowledgeMetabolism.d.ts +82 -0
  143. package/dist/lib/service/evolution/KnowledgeMetabolism.js +167 -0
  144. package/dist/lib/service/evolution/RedundancyAnalyzer.d.ts +53 -0
  145. package/dist/lib/service/evolution/RedundancyAnalyzer.js +210 -0
  146. package/dist/lib/service/evolution/StagingManager.d.ts +57 -0
  147. package/dist/lib/service/evolution/StagingManager.js +201 -0
  148. package/dist/lib/service/guard/ComplianceReporter.d.ts +42 -2
  149. package/dist/lib/service/guard/ComplianceReporter.js +43 -5
  150. package/dist/lib/service/guard/CoverageAnalyzer.d.ts +54 -0
  151. package/dist/lib/service/guard/CoverageAnalyzer.js +149 -0
  152. package/dist/lib/service/guard/GuardCheckEngine.d.ts +55 -1
  153. package/dist/lib/service/guard/GuardCheckEngine.js +508 -15
  154. package/dist/lib/service/guard/GuardFeedbackLoop.d.ts +3 -0
  155. package/dist/lib/service/guard/GuardFeedbackLoop.js +9 -0
  156. package/dist/lib/service/guard/ReverseGuard.d.ts +73 -0
  157. package/dist/lib/service/guard/ReverseGuard.js +256 -0
  158. package/dist/lib/service/guard/RuleLearner.d.ts +12 -0
  159. package/dist/lib/service/guard/RuleLearner.js +38 -0
  160. package/dist/lib/service/guard/UncertaintyCollector.d.ts +83 -0
  161. package/dist/lib/service/guard/UncertaintyCollector.js +149 -0
  162. package/dist/lib/service/guard/ViolationsStore.d.ts +1 -0
  163. package/dist/lib/service/guard/ViolationsStore.js +33 -3
  164. package/dist/lib/service/knowledge/ConfidenceRouter.d.ts +13 -0
  165. package/dist/lib/service/knowledge/ConfidenceRouter.js +14 -0
  166. package/dist/lib/service/knowledge/KnowledgeService.js +22 -4
  167. package/dist/lib/service/module/ModuleService.js +3 -13
  168. package/dist/lib/service/panorama/CouplingAnalyzer.d.ts +27 -0
  169. package/dist/lib/service/panorama/CouplingAnalyzer.js +192 -0
  170. package/dist/lib/service/panorama/DimensionAnalyzer.d.ts +28 -0
  171. package/dist/lib/service/panorama/DimensionAnalyzer.js +320 -0
  172. package/dist/lib/service/panorama/LayerInferrer.d.ts +19 -0
  173. package/dist/lib/service/panorama/LayerInferrer.js +182 -0
  174. package/dist/lib/service/panorama/ModuleDiscoverer.d.ts +24 -0
  175. package/dist/lib/service/panorama/ModuleDiscoverer.js +185 -0
  176. package/dist/lib/service/panorama/PanoramaAggregator.d.ts +29 -0
  177. package/dist/lib/service/panorama/PanoramaAggregator.js +228 -0
  178. package/dist/lib/service/panorama/PanoramaScanner.d.ts +52 -0
  179. package/dist/lib/service/panorama/PanoramaScanner.js +188 -0
  180. package/dist/lib/service/panorama/PanoramaService.d.ts +108 -0
  181. package/dist/lib/service/panorama/PanoramaService.js +220 -0
  182. package/dist/lib/service/panorama/PanoramaTypes.d.ts +134 -0
  183. package/dist/lib/service/panorama/PanoramaTypes.js +6 -0
  184. package/dist/lib/service/panorama/RoleRefiner.d.ts +48 -0
  185. package/dist/lib/service/panorama/RoleRefiner.js +535 -0
  186. package/dist/lib/service/search/MultiSignalRanker.d.ts +1 -0
  187. package/dist/lib/service/search/MultiSignalRanker.js +16 -0
  188. package/dist/lib/service/search/SearchEngine.d.ts +1 -0
  189. package/dist/lib/service/search/SearchEngine.js +9 -1
  190. package/dist/lib/service/search/SearchTypes.d.ts +2 -0
  191. package/dist/lib/service/signal/HitRecorder.d.ts +68 -0
  192. package/dist/lib/service/signal/HitRecorder.js +173 -0
  193. package/dist/lib/service/skills/SignalCollector.d.ts +3 -1
  194. package/dist/lib/service/skills/SignalCollector.js +31 -1
  195. package/dist/lib/service/task/IntentExtractor.d.ts +58 -0
  196. package/dist/lib/service/task/IntentExtractor.js +142 -0
  197. package/dist/lib/service/task/PrimeSearchPipeline.d.ts +54 -0
  198. package/dist/lib/service/task/PrimeSearchPipeline.js +98 -0
  199. package/dist/lib/shared/constants.d.ts +0 -15
  200. package/dist/lib/shared/constants.js +0 -10
  201. package/dist/lib/shared/schemas/config.d.ts +4 -1
  202. package/dist/lib/shared/schemas/config.js +8 -1
  203. package/dist/lib/shared/schemas/mcp-tools.d.ts +41 -96
  204. package/dist/lib/shared/schemas/mcp-tools.js +59 -119
  205. package/dist/scripts/analyze-signals.d.ts +20 -0
  206. package/dist/scripts/analyze-signals.js +155 -0
  207. package/dist/scripts/diagnose-mcp.js +1 -1
  208. package/dist/scripts/release.js +2 -10
  209. package/package.json +4 -19
  210. package/skills/autosnippet-devdocs/SKILL.md +11 -8
  211. package/templates/claude-code/hooks/autosnippet-session.sh +10 -15
  212. package/templates/cursor-hooks/hooks/session-start.sh +1 -1
  213. package/templates/instructions/agent-static.md +2 -1
  214. package/templates/instructions/conventions.md +5 -6
  215. package/templates/recipes-setup/README.md +1 -2
  216. package/dashboard/dist/assets/icons-C1dUryS-.js +0 -1
  217. package/dashboard/dist/assets/index-D0whuycy.css +0 -1
  218. package/dashboard/dist/assets/index-DdvZE4Yd.js +0 -128
  219. package/dist/lib/domain/task/Task.d.ts +0 -140
  220. package/dist/lib/domain/task/Task.js +0 -254
  221. package/dist/lib/domain/task/TaskDependency.d.ts +0 -23
  222. package/dist/lib/domain/task/TaskDependency.js +0 -34
  223. package/dist/lib/domain/task/TaskIdGenerator.d.ts +0 -40
  224. package/dist/lib/domain/task/TaskIdGenerator.js +0 -75
  225. package/dist/lib/domain/task/index.d.ts +0 -4
  226. package/dist/lib/domain/task/index.js +0 -4
  227. package/dist/lib/http/routes/snippets.js +0 -49
  228. package/dist/lib/infrastructure/database/migrations/002_add_tasks.d.ts +0 -11
  229. package/dist/lib/infrastructure/database/migrations/002_add_tasks.js +0 -86
  230. package/dist/lib/platform/ClipboardManager.d.ts +0 -24
  231. package/dist/lib/platform/ClipboardManager.js +0 -142
  232. package/dist/lib/platform/NativeUi.d.ts +0 -53
  233. package/dist/lib/platform/NativeUi.js +0 -284
  234. package/dist/lib/platform/ios/index.d.ts +0 -38
  235. package/dist/lib/platform/ios/index.js +0 -42
  236. package/dist/lib/platform/ios/routes/spm.d.ts +0 -9
  237. package/dist/lib/platform/ios/routes/spm.js +0 -371
  238. package/dist/lib/platform/ios/snippet/PlaceholderConverter.d.ts +0 -21
  239. package/dist/lib/platform/ios/snippet/PlaceholderConverter.js +0 -48
  240. package/dist/lib/platform/ios/snippet/XcodeCodec.d.ts +0 -23
  241. package/dist/lib/platform/ios/snippet/XcodeCodec.js +0 -96
  242. package/dist/lib/platform/ios/spm/DependencyGraph.d.ts +0 -56
  243. package/dist/lib/platform/ios/spm/DependencyGraph.js +0 -195
  244. package/dist/lib/platform/ios/spm/PackageSwiftParser.d.ts +0 -69
  245. package/dist/lib/platform/ios/spm/PackageSwiftParser.js +0 -231
  246. package/dist/lib/platform/ios/spm/PathFinder.d.ts +0 -28
  247. package/dist/lib/platform/ios/spm/PathFinder.js +0 -117
  248. package/dist/lib/platform/ios/spm/PolicyEngine.d.ts +0 -44
  249. package/dist/lib/platform/ios/spm/PolicyEngine.js +0 -79
  250. package/dist/lib/platform/ios/spm/SpmHelper.d.ts +0 -102
  251. package/dist/lib/platform/ios/spm/SpmHelper.js +0 -464
  252. package/dist/lib/platform/ios/xcode/HeaderResolver.d.ts +0 -33
  253. package/dist/lib/platform/ios/xcode/HeaderResolver.js +0 -90
  254. package/dist/lib/platform/ios/xcode/SaveEventFilter.d.ts +0 -66
  255. package/dist/lib/platform/ios/xcode/SaveEventFilter.js +0 -142
  256. package/dist/lib/platform/ios/xcode/XcodeAutomation.d.ts +0 -71
  257. package/dist/lib/platform/ios/xcode/XcodeAutomation.js +0 -327
  258. package/dist/lib/platform/ios/xcode/XcodeImportResolver.d.ts +0 -130
  259. package/dist/lib/platform/ios/xcode/XcodeImportResolver.js +0 -404
  260. package/dist/lib/platform/ios/xcode/XcodeIntegration.d.ts +0 -89
  261. package/dist/lib/platform/ios/xcode/XcodeIntegration.js +0 -588
  262. package/dist/lib/platform/ios/xcode/XcodeWriteUtils.d.ts +0 -99
  263. package/dist/lib/platform/ios/xcode/XcodeWriteUtils.js +0 -190
  264. package/dist/lib/repository/task/TaskRepository.impl.d.ts +0 -171
  265. package/dist/lib/repository/task/TaskRepository.impl.js +0 -347
  266. package/dist/lib/service/automation/ActionPipeline.d.ts +0 -34
  267. package/dist/lib/service/automation/ActionPipeline.js +0 -53
  268. package/dist/lib/service/automation/AutomationOrchestrator.d.ts +0 -86
  269. package/dist/lib/service/automation/AutomationOrchestrator.js +0 -57
  270. package/dist/lib/service/automation/ContextCollector.d.ts +0 -24
  271. package/dist/lib/service/automation/ContextCollector.js +0 -35
  272. package/dist/lib/service/automation/DirectiveDetector.d.ts +0 -51
  273. package/dist/lib/service/automation/DirectiveDetector.js +0 -112
  274. package/dist/lib/service/automation/FileWatcher.d.ts +0 -51
  275. package/dist/lib/service/automation/FileWatcher.js +0 -366
  276. package/dist/lib/service/automation/TriggerResolver.d.ts +0 -36
  277. package/dist/lib/service/automation/TriggerResolver.js +0 -62
  278. package/dist/lib/service/automation/handlers/AlinkHandler.d.ts +0 -7
  279. package/dist/lib/service/automation/handlers/AlinkHandler.js +0 -80
  280. package/dist/lib/service/automation/handlers/CreateHandler.d.ts +0 -11
  281. package/dist/lib/service/automation/handlers/CreateHandler.js +0 -170
  282. package/dist/lib/service/automation/handlers/GuardHandler.d.ts +0 -17
  283. package/dist/lib/service/automation/handlers/GuardHandler.js +0 -218
  284. package/dist/lib/service/automation/handlers/HeaderHandler.d.ts +0 -2
  285. package/dist/lib/service/automation/handlers/HeaderHandler.js +0 -32
  286. package/dist/lib/service/automation/handlers/SearchHandler.d.ts +0 -11
  287. package/dist/lib/service/automation/handlers/SearchHandler.js +0 -278
  288. package/dist/lib/service/snippet/SnippetFactory.d.ts +0 -101
  289. package/dist/lib/service/snippet/SnippetFactory.js +0 -145
  290. package/dist/lib/service/snippet/SnippetInstaller.d.ts +0 -91
  291. package/dist/lib/service/snippet/SnippetInstaller.js +0 -276
  292. package/dist/lib/service/snippet/codecs/SnippetCodec.d.ts +0 -44
  293. package/dist/lib/service/snippet/codecs/SnippetCodec.js +0 -35
  294. package/dist/lib/service/snippet/codecs/VSCodeCodec.d.ts +0 -27
  295. package/dist/lib/service/snippet/codecs/VSCodeCodec.js +0 -82
  296. package/dist/lib/service/task/TaskGraphService.d.ts +0 -222
  297. package/dist/lib/service/task/TaskGraphService.js +0 -597
  298. package/dist/lib/service/task/TaskKnowledgeBridge.d.ts +0 -95
  299. package/dist/lib/service/task/TaskKnowledgeBridge.js +0 -298
  300. package/dist/lib/service/task/TaskReadyEngine.d.ts +0 -84
  301. package/dist/lib/service/task/TaskReadyEngine.js +0 -115
  302. package/dist/scripts/build-native-ui.d.ts +0 -3
  303. package/dist/scripts/build-native-ui.js +0 -62
  304. package/dist/scripts/init-snippets.d.ts +0 -30
  305. package/dist/scripts/init-snippets.js +0 -298
  306. package/dist/scripts/install-full.d.ts +0 -7
  307. package/dist/scripts/install-full.js +0 -38
  308. package/resources/native-ui/README.md +0 -29
  309. package/resources/native-ui/combined-window.swift +0 -494
  310. package/resources/native-ui/main.swift +0 -598
  311. package/scripts/postinstall-safe.mjs +0 -89
@@ -1,80 +0,0 @@
1
- /**
2
- * AlinkHandler — 处理 alink 指令
3
- *
4
- * 解析编辑器中的 alink 触发行,提取 completionKey,
5
- * 通过数据库查找匹配的 Recipe,打开 Dashboard 详情页。
6
- */
7
- import { and, eq } from 'drizzle-orm';
8
- import { getServiceContainer } from '#inject/ServiceContainer.js';
9
- import { knowledgeEntries } from '../../../infrastructure/database/drizzle/schema.js';
10
- export async function handleAlink(alinkLine) {
11
- const { TRIGGER_SYMBOL } = await import('../../../infrastructure/config/TriggerSymbol.js');
12
- let completionKey = null;
13
- const alinkMark = 'alink';
14
- if (alinkLine.includes(TRIGGER_SYMBOL)) {
15
- const parts = alinkLine
16
- .split(TRIGGER_SYMBOL)
17
- .map((p) => p.trim())
18
- .filter(Boolean);
19
- if (parts.length >= 2 && parts[parts.length - 1] === alinkMark) {
20
- completionKey = parts[parts.length - 2];
21
- }
22
- }
23
- if (completionKey != null) {
24
- try {
25
- // 从 DI 容器获取数据库实例,查找匹配 trigger 的 Recipe
26
- const container = getServiceContainer();
27
- const db = container.get('database');
28
- let recipeId = null;
29
- if (db) {
30
- const rawDb = typeof db.getDb === 'function' ? db.getDb() : db;
31
- try {
32
- // ★ Drizzle 类型安全 — 精确匹配 trigger
33
- const drizzle = typeof db.getDrizzle === 'function' ? db.getDrizzle() : null;
34
- if (!drizzle) {
35
- throw new Error('Drizzle not available');
36
- }
37
- const row = drizzle
38
- .select({ id: knowledgeEntries.id })
39
- .from(knowledgeEntries)
40
- .where(and(eq(knowledgeEntries.trigger, completionKey), eq(knowledgeEntries.lifecycle, 'active')))
41
- .limit(1)
42
- .get();
43
- if (row) {
44
- recipeId = row.id;
45
- }
46
- }
47
- catch {
48
- // DB 查询失败时回退到搜索
49
- }
50
- // 若精确匹配失败,尝试模糊搜索(保留 raw SQL — LIKE + ESCAPE)
51
- if (!recipeId) {
52
- try {
53
- const rawDb2 = (typeof db.getDb === 'function' ? db.getDb() : db);
54
- const escaped = completionKey.replace(/[%_\\]/g, (ch) => `\\${ch}`);
55
- const row = rawDb2
56
- .prepare("SELECT id FROM knowledge_entries WHERE (trigger LIKE ? ESCAPE '\\' OR title LIKE ? ESCAPE '\\') AND lifecycle = 'active' LIMIT 1")
57
- .get(`%${escaped}%`, `%${escaped}%`);
58
- if (row) {
59
- recipeId = row.id;
60
- }
61
- }
62
- catch {
63
- /* silent */
64
- }
65
- }
66
- }
67
- // 构建 Dashboard URL 并打开
68
- const port = process.env.ASD_DASHBOARD_PORT || 3000;
69
- const host = process.env.ASD_DASHBOARD_HOST || 'localhost';
70
- const url = recipeId
71
- ? `http://${host}:${port}/#/recipes/${recipeId}`
72
- : `http://${host}:${port}/#/search?q=${encodeURIComponent(completionKey)}`;
73
- const open = (await import('open')).default;
74
- await open(url);
75
- }
76
- catch (err) {
77
- console.warn(`[alink] Failed to open link: ${err.message}`);
78
- }
79
- }
80
- }
@@ -1,11 +0,0 @@
1
- /**
2
- * CreateHandler — 处理 // as:c 指令
3
- * 从 FileWatcher 拆分,负责候选创建逻辑
4
- */
5
- /**
6
- * 处理 // as:c 指令
7
- * @param createOption 'c' | 'f' | undefined
8
- */
9
- export declare function handleCreate(watcher: import('../FileWatcher.js').FileWatcher, fullPath: string, relativePath: string, createOption: string | null): Promise<void>;
10
- /** 查找 // as:c 的行号 (1-based) */
11
- export declare function findCreateLineNumber(content: string): number;
@@ -1,170 +0,0 @@
1
- /**
2
- * CreateHandler — 处理 // as:c 指令
3
- * 从 FileWatcher 拆分,负责候选创建逻辑
4
- */
5
- import { readFileSync, writeFileSync } from 'node:fs';
6
- import { saveEventFilter } from '#platform/ios/xcode/SaveEventFilter.js';
7
- import { LanguageService } from '#shared/LanguageService.js';
8
- import { REGEX } from '../DirectiveDetector.js';
9
- /**
10
- * 处理 // as:c 指令
11
- * @param createOption 'c' | 'f' | undefined
12
- */
13
- export async function handleCreate(watcher, fullPath, relativePath, createOption) {
14
- const XA = await import('../../../platform/ios/xcode/XcodeAutomation.js');
15
- const CM = await import('../../../platform/ClipboardManager.js');
16
- // 1. 读剪贴板(仅 -c 模式)
17
- let textToExtract = '';
18
- if (createOption === 'c') {
19
- textToExtract = CM.read().trim();
20
- }
21
- // 2. 自动移除触发行
22
- let cutSucceeded = false;
23
- try {
24
- const content = readFileSync(fullPath, 'utf8');
25
- const lineNumber = findCreateLineNumber(content);
26
- if (XA.isXcodeRunning() && lineNumber > 0) {
27
- const savedClip = CM.read();
28
- cutSucceeded = XA.cutLineInXcode(lineNumber);
29
- if (cutSucceeded && savedClip) {
30
- await _sleep(200);
31
- CM.write(savedClip);
32
- }
33
- }
34
- if (!cutSucceeded) {
35
- const newContent = content.replace(REGEX.CREATE_REMOVE, '');
36
- saveEventFilter.markWrite(fullPath, newContent);
37
- writeFileSync(fullPath, newContent, 'utf8');
38
- }
39
- }
40
- catch (err) {
41
- console.error('[Watcher] Failed to remove as:create mark', err.message);
42
- }
43
- // 3. 无 -c 选项:打开 Dashboard
44
- if (createOption !== 'c') {
45
- const autoScan = createOption === 'f' ? '&autoScan=1' : '';
46
- watcher._openDashboard(`/?action=create&path=${encodeURIComponent(relativePath)}${autoScan}`);
47
- return;
48
- }
49
- // 4. -c 模式:剪贴板为空则打开 Dashboard
50
- if (textToExtract.length === 0) {
51
- watcher._openDashboard(`/?action=create&path=${encodeURIComponent(relativePath)}`);
52
- return;
53
- }
54
- // 5. -c 模式:静默创建候选
55
- try {
56
- await silentCreateCandidate(watcher, textToExtract, relativePath);
57
- }
58
- catch (e) {
59
- console.warn('[Watcher] 静默创建候选失败,回退到打开浏览器:', e.message);
60
- watcher._openDashboard(`/?action=create&path=${encodeURIComponent(relativePath)}&source=clipboard`);
61
- }
62
- }
63
- /** 静默创建候选(从剪贴板文本解析 Recipe 并提交) */
64
- async function silentCreateCandidate(watcher, text, relativePath) {
65
- const { RecipeParser } = await import('../../recipe/RecipeParser.js');
66
- const parser = new RecipeParser();
67
- const normalize = (arr) => arr.map((r) => ({
68
- title: r.title,
69
- summary: r.summary || r.description || '',
70
- trigger: r.trigger,
71
- category: r.category || 'Utility',
72
- language: r.language || 'unknown',
73
- code: r.code,
74
- usageGuide: r.usageGuide || '',
75
- headers: r.headers || [],
76
- }));
77
- // 先尝试批量解析(仅对 Recipe Markdown 格式有效)
78
- const allRecipes = parser.parseAll(text);
79
- const validRecipes = allRecipes.filter((r) => r.title?.trim());
80
- if (validRecipes.length > 0) {
81
- const items = normalize(validRecipes);
82
- await watcher._resolveHeadersIfNeeded(items[0], relativePath, text);
83
- await watcher._appendCandidates(items, 'watch-create');
84
- const msg = validRecipes.length === 1
85
- ? `已创建候选「${validRecipes[0].title}」,请在 Dashboard Candidates 页审核`
86
- : `已创建 ${validRecipes.length} 条候选,请在 Dashboard Candidates 页审核`;
87
- watcher._notify(msg);
88
- return;
89
- }
90
- // 尝试单条解析
91
- if (parser.isCompleteRecipe(text)) {
92
- const one = parser.parse(text);
93
- if (one?.title?.trim()) {
94
- const item = normalize([one])[0];
95
- await watcher._resolveHeadersIfNeeded(item, relativePath, text);
96
- await watcher._appendCandidates([item], 'watch-create');
97
- watcher._notify(`已创建候选「${one.title}」,请在 Candidates 页审核`);
98
- return;
99
- }
100
- }
101
- // -c 模式:剪贴板内容整体作为一条候选(不拆分)
102
- // 先用 AI 生成标题和摘要,code 保持剪贴板原文
103
- const lang = relativePath ? LanguageService.inferLang(relativePath) || 'unknown' : 'unknown';
104
- const ext = LanguageService.extForLang(lang) || '.txt';
105
- const fileName = relativePath
106
- ? (relativePath.split('/').pop() ?? `clipboard${ext}`)
107
- : `clipboard${ext}`;
108
- let title = fileName.replace(/\.\w+$/, '') || 'Clipboard Snippet';
109
- let summary = '';
110
- let usageGuide = '';
111
- let category = 'Utility';
112
- let headers = [];
113
- let tags = [];
114
- let trigger = '';
115
- // 尝试用 AI 生成摘要信息(但 code 始终保持原文)
116
- try {
117
- const { getServiceContainer } = await import('../../../injection/ServiceContainer.js');
118
- const container = getServiceContainer();
119
- const agentFactory = container.get('agentFactory');
120
- const aiResult = await agentFactory.scanKnowledge({
121
- label: title,
122
- files: [{ name: title, content: text, language: lang }],
123
- task: 'summarize',
124
- });
125
- if (aiResult && !aiResult.error) {
126
- title = aiResult.title || title;
127
- summary = aiResult.summary || '';
128
- usageGuide = aiResult.usageGuide || '';
129
- category = aiResult.category || category;
130
- headers = aiResult.headers || [];
131
- tags = aiResult.tags || [];
132
- trigger = aiResult.trigger || '';
133
- }
134
- }
135
- catch {
136
- /* AI 不可用,使用默认值 */
137
- }
138
- const item = {
139
- title,
140
- summary,
141
- description: summary,
142
- trigger,
143
- category,
144
- language: lang,
145
- code: text, // 剪贴板原文整体
146
- usageGuide,
147
- headers,
148
- tags,
149
- };
150
- await watcher._resolveHeadersIfNeeded(item, relativePath, text);
151
- await watcher._appendCandidates([item], 'watch-create');
152
- watcher._notify(`已创建候选「${title}」,请在 Candidates 页审核`);
153
- }
154
- /** 查找 // as:c 的行号 (1-based) */
155
- export function findCreateLineNumber(content) {
156
- if (!content) {
157
- return -1;
158
- }
159
- const lines = content.split(/\r?\n/);
160
- for (let i = 0; i < lines.length; i++) {
161
- const t = lines[i].trim();
162
- if (t.startsWith('// as:create') || t.startsWith('// as:c')) {
163
- return i + 1;
164
- }
165
- }
166
- return -1;
167
- }
168
- function _sleep(ms) {
169
- return new Promise((resolve) => setTimeout(resolve, ms));
170
- }
@@ -1,17 +0,0 @@
1
- /**
2
- * GuardHandler — 处理 // as:a (audit/guard/lint) 指令
3
- *
4
- * 用法:
5
- * // as:a — 检查当前文件 (scope=file)
6
- * // as:a file — 同上,显式 file scope
7
- * // as:a target — 检查当前文件所在目录树 (scope=target)
8
- * // as:a project — 检查整个项目所有源文件 (scope=project)
9
- * // as:a <keyword> — 检查当前文件 + 搜索相关规范
10
- */
11
- /**
12
- * @param watcher FileWatcher 实例
13
- * @param fullPath 当前文件绝对路径
14
- * @param code 当前文件内容
15
- * @param guardLine 触发行原文
16
- */
17
- export declare function handleGuard(watcher: import('../FileWatcher.js').FileWatcher, fullPath: string, code: string, guardLine: string): Promise<void>;
@@ -1,218 +0,0 @@
1
- /**
2
- * GuardHandler — 处理 // as:a (audit/guard/lint) 指令
3
- *
4
- * 用法:
5
- * // as:a — 检查当前文件 (scope=file)
6
- * // as:a file — 同上,显式 file scope
7
- * // as:a target — 检查当前文件所在目录树 (scope=target)
8
- * // as:a project — 检查整个项目所有源文件 (scope=project)
9
- * // as:a <keyword> — 检查当前文件 + 搜索相关规范
10
- */
11
- import { readFile } from 'node:fs/promises';
12
- import { dirname, extname, join } from 'node:path';
13
- import { LanguageService } from '#shared/LanguageService.js';
14
- /** 已知的 scope 关键词 */
15
- const SCOPE_KEYWORDS = new Set(['file', 'target', 'project', 'all']);
16
- /** 支持审计的源文件扩展名 — 委托给 LanguageService */
17
- const SOURCE_EXTS = LanguageService.sourceExts;
18
- /** 递归收集目录下所有源文件路径 */
19
- async function collectSourceFiles(dir) {
20
- const { readdir } = await import('node:fs/promises');
21
- const files = [];
22
- // 跳过的目录
23
- const SKIP_DIRS = new Set([
24
- 'node_modules',
25
- '.git',
26
- 'build',
27
- 'DerivedData',
28
- 'Pods',
29
- '.build',
30
- 'vendor',
31
- 'dist',
32
- '.next',
33
- 'Carthage',
34
- 'xcuserdata',
35
- '__pycache__',
36
- ]);
37
- async function walk(currentDir) {
38
- let entries;
39
- try {
40
- entries = await readdir(currentDir, { withFileTypes: true });
41
- }
42
- catch {
43
- return; // 权限不足等情况跳过
44
- }
45
- for (const entry of entries) {
46
- if (entry.name.startsWith('.') && entry.name !== '.') {
47
- continue;
48
- }
49
- const fullPath = join(currentDir, entry.name);
50
- if (entry.isDirectory()) {
51
- if (!SKIP_DIRS.has(entry.name)) {
52
- await walk(fullPath);
53
- }
54
- }
55
- else if (entry.isFile() && SOURCE_EXTS.has(extname(entry.name).toLowerCase())) {
56
- files.push(fullPath);
57
- }
58
- }
59
- }
60
- await walk(dir);
61
- return files;
62
- }
63
- /**
64
- * @param watcher FileWatcher 实例
65
- * @param fullPath 当前文件绝对路径
66
- * @param code 当前文件内容
67
- * @param guardLine 触发行原文
68
- */
69
- export async function handleGuard(watcher, fullPath, code, guardLine) {
70
- const rest = guardLine.replace(/^\/\/\s*as:(?:audit|a|lint|l|guard|g)\s*/, '').trim();
71
- const scopeArg = rest.toLowerCase();
72
- const isScope = SCOPE_KEYWORDS.has(scopeArg);
73
- // 确定 scope:无参数或 'file' → file;'target' → target;'project'/'all' → project
74
- const scope = !rest || scopeArg === 'file'
75
- ? 'file'
76
- : scopeArg === 'target'
77
- ? 'target'
78
- : scopeArg === 'project' || scopeArg === 'all'
79
- ? 'project'
80
- : 'file'; // 非 scope 关键词回退到 file
81
- try {
82
- const { detectLanguage } = await import('../../guard/GuardCheckEngine.js');
83
- const { ServiceContainer } = await import('../../../injection/ServiceContainer.js');
84
- const container = ServiceContainer.getInstance();
85
- const engine = container.get('guardCheckEngine');
86
- /* ── 多文件审计 (target / project) ── */
87
- if (scope === 'project' || scope === 'target') {
88
- let scanRoot;
89
- if (scope === 'project') {
90
- scanRoot = watcher?.projectRoot;
91
- }
92
- else {
93
- // target: 扫描当前文件所在目录树
94
- scanRoot = dirname(fullPath);
95
- }
96
- if (!scanRoot) {
97
- console.warn(' ⚠️ 无法确定扫描根目录,回退到单文件检查');
98
- return _auditSingleFile(watcher, engine, fullPath, code, detectLanguage, 'file');
99
- }
100
- const scopeLabel = scope === 'project' ? '整个项目' : '当前目录';
101
- const sourcePaths = await collectSourceFiles(scanRoot);
102
- if (sourcePaths.length === 0) {
103
- watcher._notify?.('未找到可审计的源文件');
104
- return;
105
- }
106
- // 读取所有文件内容
107
- const fileEntries = [];
108
- let readErrors = 0;
109
- for (const p of sourcePaths) {
110
- try {
111
- const content = await readFile(p, 'utf-8');
112
- fileEntries.push({ path: p, content });
113
- }
114
- catch {
115
- readErrors++;
116
- }
117
- }
118
- if (readErrors > 0) {
119
- console.warn(` ⚠️ ${readErrors} 个文件读取失败,已跳过`);
120
- }
121
- // 批量审计(传递 scope 以启用对应维度规则)
122
- const report = engine.auditFiles(fileEntries, { scope });
123
- const { summary } = report;
124
- if (summary.totalViolations === 0) {
125
- watcher._notify?.(`${scopeLabel}审计通过 ✅ ${fileEntries.length} 个文件,无违规`);
126
- }
127
- else {
128
- watcher._notify?.(`${scopeLabel}审计: ${summary.totalViolations} 个问题 (${summary.errors ?? 0} 错误, ${summary.warnings ?? 0} 警告)`);
129
- const filesWithIssues = report.files.filter((f) => f.summary.total > 0);
130
- for (const file of filesWithIssues.slice(0, 10)) {
131
- const _rel = String(file.filePath).replace(`${scanRoot}/`, '');
132
- const errors = file.violations.filter((v) => v.severity === 'error');
133
- const warnings = file.violations.filter((v) => v.severity === 'warning');
134
- for (const _v of errors.slice(0, 5)) {
135
- }
136
- if (errors.length > 5) {
137
- }
138
- for (const _v of warnings.slice(0, 3)) {
139
- }
140
- if (warnings.length > 3) {
141
- }
142
- }
143
- if (filesWithIssues.length > 10) {
144
- }
145
- // 跨文件问题汇总
146
- if (report.crossFileViolations?.length > 0) {
147
- for (const v of report.crossFileViolations.slice(0, 10)) {
148
- if (v.locations) {
149
- for (const loc of v.locations.slice(0, 5)) {
150
- const _relLoc = loc.filePath.replace(`${scanRoot}/`, '');
151
- }
152
- if (v.locations.length > 5) {
153
- }
154
- }
155
- }
156
- }
157
- }
158
- return;
159
- }
160
- _auditSingleFile(watcher, engine, fullPath, code, detectLanguage, scope);
161
- // 如果有非 scope 关键词,也做语义搜索
162
- if (rest && !isScope) {
163
- try {
164
- const searchEngine = container.get('searchEngine');
165
- const results = await searchEngine.search(rest, { limit: 3, mode: 'keyword' });
166
- const items = Array.isArray(results) ? results : results.items || [];
167
- if (items.length > 0) {
168
- for (const _r of items) {
169
- }
170
- }
171
- }
172
- catch {
173
- // 搜索失败不阻塞
174
- }
175
- }
176
- }
177
- catch (err) {
178
- console.warn(` ⚠️ Guard 检查失败: ${err.message}`);
179
- }
180
- }
181
- /** 检查单个文件并打印结果 */
182
- function _auditSingleFile(watcher, engine, fullPath, code, detectLanguage, scope = 'file') {
183
- const language = detectLanguage(fullPath);
184
- const violations = engine.checkCode(code, language, { scope });
185
- if (violations.length === 0) {
186
- watcher._notify?.('审计通过 ✅ 无违规');
187
- }
188
- else {
189
- const errors = violations.filter((v) => v.severity === 'error');
190
- const warnings = violations.filter((v) => v.severity === 'warning');
191
- watcher._notify?.(`审计: ${violations.length} 个问题 (${errors.length} 错误, ${warnings.length} 警告)`);
192
- for (const v of errors) {
193
- if (v.fixSuggestion) {
194
- }
195
- }
196
- for (const v of warnings.slice(0, 5)) {
197
- if (v.fixSuggestion) {
198
- }
199
- }
200
- if (warnings.length > 5) {
201
- }
202
- }
203
- // Guard ↔ Recipe 闭环:检测修复并自动确认使用(fire-and-forget)
204
- import('../../../injection/ServiceContainer.js')
205
- .then(({ ServiceContainer }) => {
206
- try {
207
- const container = ServiceContainer.getInstance();
208
- const feedbackLoop = container.get('guardFeedbackLoop');
209
- feedbackLoop.processFixDetection({ violations }, fullPath);
210
- }
211
- catch {
212
- /* guardFeedbackLoop not available */
213
- }
214
- })
215
- .catch(() => {
216
- /* ignored */
217
- });
218
- }
@@ -1,2 +0,0 @@
1
- /** HeaderHandler — 处理 // as:include / // as:import 指令 */
2
- export declare function handleHeader(watcher: import('../FileWatcher.js').FileWatcher, fullPath: string, headerLine: string, importArray: string[], isSwift: boolean): Promise<void>;
@@ -1,32 +0,0 @@
1
- /** HeaderHandler — 处理 // as:include / // as:import 指令 */
2
- import { readFileSync } from 'node:fs';
3
- import { basename } from 'node:path';
4
- export async function handleHeader(watcher, fullPath, headerLine, importArray, isSwift) {
5
- try {
6
- const HeaderResolver = await import('../../../platform/ios/xcode/HeaderResolver.js');
7
- const parsed = HeaderResolver.parseImportLine(headerLine);
8
- if (!parsed) {
9
- return;
10
- }
11
- const resolved = await HeaderResolver.resolveHeadersForText(watcher.projectRoot, basename(fullPath), readFileSync(fullPath, 'utf8'));
12
- if (!resolved || !resolved.headers || resolved.headers.length === 0) {
13
- return;
14
- }
15
- const { insertHeaders } = await import('../../../platform/ios/xcode/XcodeIntegration.js');
16
- const result = await insertHeaders(watcher, fullPath, resolved.headers, {
17
- isSwift,
18
- moduleName: resolved.moduleName || null,
19
- });
20
- if (result.cancelled) {
21
- return;
22
- }
23
- if (result.inserted.length === 0 && result.skipped.length > 0) {
24
- }
25
- }
26
- catch (err) {
27
- console.warn(` ⚠️ Header 处理失败: ${err.message}`);
28
- if (process.env.ASD_DEBUG === '1') {
29
- console.error(err.stack);
30
- }
31
- }
32
- }
@@ -1,11 +0,0 @@
1
- /** SearchHandler — 处理 // as:s 指令 */
2
- export declare function handleSearch(watcher: import('../FileWatcher.js').FileWatcher, fullPath: string, relativePath: string, searchLine: string): Promise<void>;
3
- /** 将搜索结果标准化为 NativeUI 可展示格式 */
4
- export declare function normalizeSearchResults(results: unknown): {
5
- title: string;
6
- code: string;
7
- explanation: string;
8
- headers: string[];
9
- moduleName: string | null;
10
- trigger: string;
11
- }[];