@sylphx/flow 1.1.1 → 1.2.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.
Files changed (45) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/package.json +1 -1
  3. package/src/commands/hook-command.ts +10 -230
  4. package/src/composables/index.ts +0 -1
  5. package/src/config/servers.ts +35 -78
  6. package/src/core/interfaces.ts +0 -33
  7. package/src/domains/index.ts +0 -2
  8. package/src/index.ts +0 -4
  9. package/src/services/mcp-service.ts +0 -16
  10. package/src/targets/claude-code.ts +3 -9
  11. package/src/targets/functional/claude-code-logic.ts +4 -22
  12. package/src/targets/opencode.ts +0 -6
  13. package/src/types/mcp.types.ts +29 -38
  14. package/src/types/target.types.ts +0 -2
  15. package/src/types.ts +0 -1
  16. package/src/commands/codebase-command.ts +0 -168
  17. package/src/commands/knowledge-command.ts +0 -161
  18. package/src/composables/useTargetConfig.ts +0 -45
  19. package/src/core/formatting/bytes.test.ts +0 -115
  20. package/src/core/validation/limit.test.ts +0 -155
  21. package/src/core/validation/query.test.ts +0 -44
  22. package/src/domains/codebase/index.ts +0 -5
  23. package/src/domains/codebase/tools.ts +0 -139
  24. package/src/domains/knowledge/index.ts +0 -10
  25. package/src/domains/knowledge/resources.ts +0 -537
  26. package/src/domains/knowledge/tools.ts +0 -174
  27. package/src/services/search/base-indexer.ts +0 -156
  28. package/src/services/search/codebase-indexer-types.ts +0 -38
  29. package/src/services/search/codebase-indexer.ts +0 -647
  30. package/src/services/search/embeddings-provider.ts +0 -455
  31. package/src/services/search/embeddings.ts +0 -316
  32. package/src/services/search/functional-indexer.ts +0 -323
  33. package/src/services/search/index.ts +0 -27
  34. package/src/services/search/indexer.ts +0 -380
  35. package/src/services/search/knowledge-indexer.ts +0 -422
  36. package/src/services/search/semantic-search.ts +0 -244
  37. package/src/services/search/tfidf.ts +0 -559
  38. package/src/services/search/unified-search-service.ts +0 -888
  39. package/src/services/storage/cache-storage.ts +0 -487
  40. package/src/services/storage/drizzle-storage.ts +0 -581
  41. package/src/services/storage/index.ts +0 -15
  42. package/src/services/storage/lancedb-vector-storage.ts +0 -494
  43. package/src/services/storage/memory-storage.ts +0 -268
  44. package/src/services/storage/separated-storage.ts +0 -467
  45. package/src/services/storage/vector-storage.ts +0 -13
@@ -1,156 +0,0 @@
1
- /**
2
- * Base indexer with common indexing logic
3
- * Shared by knowledge and codebase indexers
4
- */
5
-
6
- import type { SearchIndex } from './tfidf.js';
7
- import { createLogger } from '../../utils/debug-logger.js';
8
-
9
- const log = createLogger('search:indexing');
10
-
11
- export interface IndexingStatus {
12
- isIndexing: boolean;
13
- progress: number; // 0-100
14
- totalItems: number;
15
- indexedItems: number;
16
- startTime: number;
17
- error?: string;
18
- }
19
-
20
- export interface IndexerConfig {
21
- name: string; // 'knowledge' or 'codebase'
22
- }
23
-
24
- /**
25
- * Base class for indexers with common functionality
26
- *
27
- * IMPORTANT: Indexing always starts automatically on initialization.
28
- * This is mandatory - without indexing, search cannot work and stale data misleads users.
29
- */
30
- export abstract class BaseIndexer {
31
- protected cachedIndex: SearchIndex | null = null;
32
- protected indexingPromise: Promise<SearchIndex> | null = null;
33
- protected status: IndexingStatus = {
34
- isIndexing: false,
35
- progress: 0,
36
- totalItems: 0,
37
- indexedItems: 0,
38
- startTime: 0,
39
- };
40
-
41
- constructor(protected config: IndexerConfig) {
42
- // MANDATORY: Start background indexing immediately
43
- // Without indexing, search won't work. Stale data misleads users.
44
- setTimeout(() => this.startBackgroundIndexing(), 0);
45
- }
46
-
47
- /**
48
- * Abstract method: Build index (implemented by subclasses)
49
- */
50
- protected abstract buildIndex(): Promise<SearchIndex>;
51
-
52
- /**
53
- * Get current indexing status
54
- */
55
- getStatus(): IndexingStatus {
56
- return { ...this.status };
57
- }
58
-
59
- /**
60
- * Check if index is ready
61
- */
62
- isReady(): boolean {
63
- return this.cachedIndex !== null && !this.status.isIndexing;
64
- }
65
-
66
- /**
67
- * Start background indexing (non-blocking)
68
- */
69
- startBackgroundIndexing(): void {
70
- if (this.status.isIndexing || this.cachedIndex) {
71
- return;
72
- }
73
-
74
- log(`Starting background ${this.config.name} indexing`);
75
- this.loadIndex().catch((error) => {
76
- log(`Background ${this.config.name} indexing failed:`, error instanceof Error ? error.message : String(error));
77
- });
78
- }
79
-
80
- /**
81
- * Load or build index (with caching)
82
- */
83
- async loadIndex(): Promise<SearchIndex> {
84
- // Return cached index if available
85
- if (this.cachedIndex) {
86
- return this.cachedIndex;
87
- }
88
-
89
- // If already indexing, wait for it
90
- if (this.indexingPromise) {
91
- return this.indexingPromise;
92
- }
93
-
94
- // Start indexing
95
- this.status.isIndexing = true;
96
- this.status.progress = 0;
97
- this.status.startTime = Date.now();
98
- this.status.error = undefined;
99
-
100
- this.indexingPromise = this.buildIndex()
101
- .then((index) => {
102
- this.cachedIndex = index;
103
- this.status.isIndexing = false;
104
- this.status.progress = 100;
105
- this.status.totalItems = index.totalDocuments;
106
- this.status.indexedItems = index.totalDocuments;
107
- log(`${this.config.name} indexing complete:`, index.totalDocuments, 'documents');
108
- return index;
109
- })
110
- .catch((error) => {
111
- this.status.isIndexing = false;
112
- this.status.error = error instanceof Error ? error.message : String(error);
113
- log(`${this.config.name} indexing failed:`, error instanceof Error ? error.message : String(error));
114
- throw error;
115
- });
116
-
117
- return this.indexingPromise;
118
- }
119
-
120
- /**
121
- * Clear cache
122
- */
123
- clearCache(): void {
124
- this.cachedIndex = null;
125
- this.indexingPromise = null;
126
- this.status = {
127
- isIndexing: false,
128
- progress: 0,
129
- totalItems: 0,
130
- indexedItems: 0,
131
- startTime: 0,
132
- };
133
- }
134
-
135
- /**
136
- * Get index statistics
137
- */
138
- async getStats(): Promise<{
139
- totalDocuments: number;
140
- uniqueTerms: number;
141
- generatedAt: string;
142
- version: string;
143
- } | null> {
144
- const index = await this.loadIndex();
145
- if (!index) {
146
- return null;
147
- }
148
-
149
- return {
150
- totalDocuments: index.totalDocuments,
151
- uniqueTerms: index.idf.size,
152
- generatedAt: index.metadata.generatedAt,
153
- version: index.metadata.version,
154
- };
155
- }
156
- }
@@ -1,38 +0,0 @@
1
- /**
2
- * Types and interfaces for the codebase indexer
3
- */
4
-
5
- import type { SearchIndex } from './tfidf.js';
6
-
7
- export interface CodebaseFile {
8
- path: string; // Relative path from codebase root
9
- absolutePath: string;
10
- content: string;
11
- language?: string; // Detected programming language
12
- size: number;
13
- mtime: number; // Last modified time
14
- }
15
-
16
- export interface IndexCache {
17
- version: string;
18
- codebaseRoot: string;
19
- indexedAt: string;
20
- fileCount: number;
21
- files: Map<string, { mtime: number; hash: string }>; // Track file changes
22
- tfidfIndex?: SearchIndex;
23
- vectorIndexPath?: string;
24
- }
25
-
26
- export interface CodebaseIndexerOptions {
27
- codebaseRoot?: string;
28
- cacheDir?: string;
29
- batchSize?: number;
30
- }
31
-
32
- export interface IndexingStatus {
33
- isIndexing: boolean;
34
- progress: number; // 0-100
35
- currentFile?: string;
36
- totalFiles: number;
37
- indexedFiles: number;
38
- }