autosnippet 3.2.20 → 3.2.21

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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2021 高雪峰
3
+ Copyright (c) 2021 GaoXuefeng
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -26,7 +26,7 @@
26
26
  "console": true,
27
27
  "file": {
28
28
  "enabled": true,
29
- "path": "./logs"
29
+ "path": "./.autosnippet/logs"
30
30
  }
31
31
  },
32
32
  "constitution": {
@@ -218,16 +218,10 @@ export const GITIGNORE_RULES = [
218
218
  { pattern: '!.autosnippet/config.json', negation: true },
219
219
  // Environment (contains API keys created by `asd setup`)
220
220
  { pattern: '.env', comment: '环境变量(含 API Key)' },
221
- // Logs
222
- { pattern: 'logs/', comment: '运行日志' },
221
+ // Logs(已收纳到 .autosnippet/ 下,由 .autosnippet/* 统一覆盖)
223
222
  ];
224
223
  /** .gitignore 迁移规则 — 升级时清理旧格式 */
225
- export const GITIGNORE_MIGRATIONS = [
226
- // v2.4.0: ".autosnippet/" → ".autosnippet/*"
227
- { find: /^\.autosnippet\/$/m, replace: '.autosnippet/*' },
228
- // Skills 已迁移到 AutoSnippet/skills/,清理旧 negation
229
- { find: /^!?\.autosnippet\/skills\/.*\n?/gm, replace: '' },
230
- ];
224
+ export const GITIGNORE_MIGRATIONS = [];
231
225
  /** MCP Server 配置生成器 */
232
226
  export function buildMcpServerEntry(projectRoot, ide) {
233
227
  const base = {
@@ -23,8 +23,10 @@ export async function health(ctx) {
23
23
  }
24
24
  // 2) Database 连通性 + 知识库统计
25
25
  try {
26
- const db = ctx.container.get('database');
27
- if (db) {
26
+ const dbConn = ctx.container.get('database');
27
+ if (dbConn) {
28
+ // DatabaseConnection 包装器 → 解包获取原始 better-sqlite3 实例
29
+ const db = typeof dbConn.getDb === 'function' ? dbConn.getDb() : dbConn;
28
30
  db.prepare('SELECT 1').get();
29
31
  checks.database = true;
30
32
  // 知识库统计(轻量聚合查询)
@@ -98,7 +98,7 @@ export class Logger {
98
98
  static instance = null;
99
99
  static getInstance(config = {}) {
100
100
  if (!this.instance) {
101
- const logsDir = config.file?.path || './logs';
101
+ const logsDir = config.file?.path || './.autosnippet/logs';
102
102
  // 确保日志目录存在
103
103
  if (!fs.existsSync(logsDir)) {
104
104
  fs.mkdirSync(logsDir, { recursive: true });
@@ -14,7 +14,7 @@ export class ErrorTracker {
14
14
  reportInterval;
15
15
  constructor(options = {}) {
16
16
  this.config = {
17
- logDirectory: options.logDirectory || path.join(process.cwd(), 'logs', 'errors'),
17
+ logDirectory: options.logDirectory || path.join(process.cwd(), '.autosnippet', 'logs', 'errors'),
18
18
  maxErrorsInMemory: options.maxErrorsInMemory || 500,
19
19
  enableFileLogging: options.enableFileLogging !== false,
20
20
  enableConsoleLogging: options.enableConsoleLogging !== false,
@@ -18,7 +18,6 @@ import { CodeEntityGraph } from '../../service/knowledge/CodeEntityGraph.js';
18
18
  import { ConfidenceRouter } from '../../service/knowledge/ConfidenceRouter.js';
19
19
  import { KnowledgeGraphService } from '../../service/knowledge/KnowledgeGraphService.js';
20
20
  import { KnowledgeService } from '../../service/knowledge/KnowledgeService.js';
21
- import { CrossEncoderReranker } from '../../service/search/CrossEncoderReranker.js';
22
21
  import { HybridRetriever } from '../../service/search/HybridRetriever.js';
23
22
  import { SearchEngine } from '../../service/search/SearchEngine.js';
24
23
  import { LanguageService } from '../../shared/LanguageService.js';
@@ -47,10 +46,10 @@ export function register(c) {
47
46
  vectorStore: ct.get('vectorStore'),
48
47
  vectorService,
49
48
  hybridRetriever: ct.get('hybridRetriever'),
50
- crossEncoderReranker: new CrossEncoderReranker({
51
- aiProvider: embedProvider,
52
- logger: ct.singletons.logger || console,
53
- }),
49
+ // CrossEncoderReranker disabled — BM25+vector dual-recall + CoarseRanker + MultiSignalRanker
50
+ // is sufficient for knowledge-base scale (hundreds~thousands of entries).
51
+ // Re-enable when document scale grows to 10k+ or external noisy sources are integrated.
52
+ crossEncoderReranker: null,
54
53
  });
55
54
  }, { aiDependent: true });
56
55
  c.singleton('vectorStore', (ct) => {
@@ -32,7 +32,7 @@ const MonitoringConfig = z.object({
32
32
  });
33
33
  const FileLogConfig = z.object({
34
34
  enabled: z.boolean().default(true),
35
- path: z.string().default('./logs'),
35
+ path: z.string().default('./.autosnippet/logs'),
36
36
  });
37
37
  const LoggingConfig = z.object({
38
38
  level: z.enum(['debug', 'info', 'warn', 'error', 'silent']).default('info'),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "autosnippet",
3
- "version": "3.2.20",
3
+ "version": "3.2.21",
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",