@sylphx/flow 1.0.1 → 1.0.3
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/CHANGELOG.md +12 -0
- package/package.json +10 -9
- package/src/commands/codebase-command.ts +168 -0
- package/src/commands/flow-command.ts +1137 -0
- package/src/commands/flow-orchestrator.ts +296 -0
- package/src/commands/hook-command.ts +444 -0
- package/src/commands/init-command.ts +92 -0
- package/src/commands/init-core.ts +322 -0
- package/src/commands/knowledge-command.ts +161 -0
- package/src/commands/run-command.ts +120 -0
- package/src/components/benchmark-monitor.tsx +331 -0
- package/src/components/reindex-progress.tsx +261 -0
- package/src/composables/functional/index.ts +14 -0
- package/src/composables/functional/useEnvironment.ts +171 -0
- package/src/composables/functional/useFileSystem.ts +139 -0
- package/src/composables/index.ts +5 -0
- package/src/composables/useEnv.ts +13 -0
- package/src/composables/useRuntimeConfig.ts +27 -0
- package/src/composables/useTargetConfig.ts +45 -0
- package/src/config/ai-config.ts +376 -0
- package/src/config/constants.ts +35 -0
- package/src/config/index.ts +27 -0
- package/src/config/rules.ts +43 -0
- package/src/config/servers.ts +371 -0
- package/src/config/targets.ts +126 -0
- package/src/core/agent-loader.ts +141 -0
- package/src/core/agent-manager.ts +174 -0
- package/src/core/ai-sdk.ts +603 -0
- package/src/core/app-factory.ts +381 -0
- package/src/core/builtin-agents.ts +9 -0
- package/src/core/command-system.ts +550 -0
- package/src/core/config-system.ts +550 -0
- package/src/core/connection-pool.ts +390 -0
- package/src/core/di-container.ts +155 -0
- package/src/core/error-handling.ts +519 -0
- package/src/core/formatting/bytes.test.ts +115 -0
- package/src/core/formatting/bytes.ts +64 -0
- package/src/core/functional/async.ts +313 -0
- package/src/core/functional/either.ts +109 -0
- package/src/core/functional/error-handler.ts +135 -0
- package/src/core/functional/error-types.ts +311 -0
- package/src/core/functional/index.ts +19 -0
- package/src/core/functional/option.ts +142 -0
- package/src/core/functional/pipe.ts +189 -0
- package/src/core/functional/result.ts +204 -0
- package/src/core/functional/validation.ts +138 -0
- package/src/core/headless-display.ts +96 -0
- package/src/core/index.ts +6 -0
- package/src/core/installers/file-installer.ts +303 -0
- package/src/core/installers/mcp-installer.ts +213 -0
- package/src/core/interfaces/index.ts +22 -0
- package/src/core/interfaces/repository.interface.ts +91 -0
- package/src/core/interfaces/service.interface.ts +133 -0
- package/src/core/interfaces.ts +129 -0
- package/src/core/loop-controller.ts +200 -0
- package/src/core/result.ts +351 -0
- package/src/core/rule-loader.ts +147 -0
- package/src/core/rule-manager.ts +240 -0
- package/src/core/service-config.ts +252 -0
- package/src/core/session-service.ts +121 -0
- package/src/core/state-detector.ts +389 -0
- package/src/core/storage-factory.ts +115 -0
- package/src/core/stream-handler.ts +288 -0
- package/src/core/target-manager.ts +161 -0
- package/src/core/type-utils.ts +427 -0
- package/src/core/unified-storage.ts +456 -0
- package/src/core/upgrade-manager.ts +300 -0
- package/src/core/validation/limit.test.ts +155 -0
- package/src/core/validation/limit.ts +46 -0
- package/src/core/validation/query.test.ts +44 -0
- package/src/core/validation/query.ts +20 -0
- package/src/db/auto-migrate.ts +322 -0
- package/src/db/base-database-client.ts +144 -0
- package/src/db/cache-db.ts +218 -0
- package/src/db/cache-schema.ts +75 -0
- package/src/db/database.ts +70 -0
- package/src/db/index.ts +252 -0
- package/src/db/memory-db.ts +153 -0
- package/src/db/memory-schema.ts +29 -0
- package/src/db/schema.ts +289 -0
- package/src/db/session-repository.ts +733 -0
- package/src/domains/codebase/index.ts +5 -0
- package/src/domains/codebase/tools.ts +139 -0
- package/src/domains/index.ts +8 -0
- package/src/domains/knowledge/index.ts +10 -0
- package/src/domains/knowledge/resources.ts +537 -0
- package/src/domains/knowledge/tools.ts +174 -0
- package/src/domains/utilities/index.ts +6 -0
- package/src/domains/utilities/time/index.ts +5 -0
- package/src/domains/utilities/time/tools.ts +291 -0
- package/src/index.ts +211 -0
- package/src/services/agent-service.ts +273 -0
- package/src/services/claude-config-service.ts +252 -0
- package/src/services/config-service.ts +258 -0
- package/src/services/evaluation-service.ts +271 -0
- package/src/services/functional/evaluation-logic.ts +296 -0
- package/src/services/functional/file-processor.ts +273 -0
- package/src/services/functional/index.ts +12 -0
- package/src/services/index.ts +13 -0
- package/src/services/mcp-service.ts +432 -0
- package/src/services/memory.service.ts +476 -0
- package/src/services/search/base-indexer.ts +156 -0
- package/src/services/search/codebase-indexer-types.ts +38 -0
- package/src/services/search/codebase-indexer.ts +647 -0
- package/src/services/search/embeddings-provider.ts +455 -0
- package/src/services/search/embeddings.ts +316 -0
- package/src/services/search/functional-indexer.ts +323 -0
- package/src/services/search/index.ts +27 -0
- package/src/services/search/indexer.ts +380 -0
- package/src/services/search/knowledge-indexer.ts +422 -0
- package/src/services/search/semantic-search.ts +244 -0
- package/src/services/search/tfidf.ts +559 -0
- package/src/services/search/unified-search-service.ts +888 -0
- package/src/services/smart-config-service.ts +385 -0
- package/src/services/storage/cache-storage.ts +487 -0
- package/src/services/storage/drizzle-storage.ts +581 -0
- package/src/services/storage/index.ts +15 -0
- package/src/services/storage/lancedb-vector-storage.ts +494 -0
- package/src/services/storage/memory-storage.ts +268 -0
- package/src/services/storage/separated-storage.ts +467 -0
- package/src/services/storage/vector-storage.ts +13 -0
- package/src/shared/agents/index.ts +63 -0
- package/src/shared/files/index.ts +99 -0
- package/src/shared/index.ts +32 -0
- package/src/shared/logging/index.ts +24 -0
- package/src/shared/processing/index.ts +153 -0
- package/src/shared/types/index.ts +25 -0
- package/src/targets/claude-code.ts +574 -0
- package/src/targets/functional/claude-code-logic.ts +185 -0
- package/src/targets/functional/index.ts +6 -0
- package/src/targets/opencode.ts +529 -0
- package/src/types/agent.types.ts +32 -0
- package/src/types/api/batch.ts +108 -0
- package/src/types/api/errors.ts +118 -0
- package/src/types/api/index.ts +55 -0
- package/src/types/api/requests.ts +76 -0
- package/src/types/api/responses.ts +180 -0
- package/src/types/api/websockets.ts +85 -0
- package/src/types/api.types.ts +9 -0
- package/src/types/benchmark.ts +49 -0
- package/src/types/cli.types.ts +87 -0
- package/src/types/common.types.ts +35 -0
- package/src/types/database.types.ts +510 -0
- package/src/types/mcp-config.types.ts +448 -0
- package/src/types/mcp.types.ts +69 -0
- package/src/types/memory-types.ts +63 -0
- package/src/types/provider.types.ts +28 -0
- package/src/types/rule.types.ts +24 -0
- package/src/types/session.types.ts +214 -0
- package/src/types/target-config.types.ts +295 -0
- package/src/types/target.types.ts +140 -0
- package/src/types/todo.types.ts +25 -0
- package/src/types.ts +40 -0
- package/src/utils/advanced-tokenizer.ts +191 -0
- package/src/utils/agent-enhancer.ts +114 -0
- package/src/utils/ai-model-fetcher.ts +19 -0
- package/src/utils/async-file-operations.ts +516 -0
- package/src/utils/audio-player.ts +345 -0
- package/src/utils/cli-output.ts +266 -0
- package/src/utils/codebase-helpers.ts +211 -0
- package/src/utils/console-ui.ts +79 -0
- package/src/utils/database-errors.ts +140 -0
- package/src/utils/debug-logger.ts +49 -0
- package/src/utils/error-handler.ts +53 -0
- package/src/utils/file-operations.ts +310 -0
- package/src/utils/file-scanner.ts +259 -0
- package/src/utils/functional/array.ts +355 -0
- package/src/utils/functional/index.ts +15 -0
- package/src/utils/functional/object.ts +279 -0
- package/src/utils/functional/string.ts +281 -0
- package/src/utils/functional.ts +543 -0
- package/src/utils/help.ts +20 -0
- package/src/utils/immutable-cache.ts +106 -0
- package/src/utils/index.ts +78 -0
- package/src/utils/jsonc.ts +158 -0
- package/src/utils/logger.ts +396 -0
- package/src/utils/mcp-config.ts +249 -0
- package/src/utils/memory-tui.ts +414 -0
- package/src/utils/models-dev.ts +91 -0
- package/src/utils/notifications.ts +169 -0
- package/src/utils/object-utils.ts +51 -0
- package/src/utils/parallel-operations.ts +487 -0
- package/src/utils/paths.ts +143 -0
- package/src/utils/process-manager.ts +155 -0
- package/src/utils/prompts.ts +120 -0
- package/src/utils/search-tool-builder.ts +214 -0
- package/src/utils/secret-utils.ts +179 -0
- package/src/utils/security.ts +537 -0
- package/src/utils/session-manager.ts +168 -0
- package/src/utils/session-title.ts +87 -0
- package/src/utils/settings.ts +182 -0
- package/src/utils/simplified-errors.ts +410 -0
- package/src/utils/sync-utils.ts +159 -0
- package/src/utils/target-config.ts +570 -0
- package/src/utils/target-utils.ts +394 -0
- package/src/utils/template-engine.ts +94 -0
- package/src/utils/test-audio.ts +71 -0
- package/src/utils/todo-context.ts +46 -0
- package/src/utils/token-counter.ts +288 -0
- package/dist/index.d.ts +0 -10
- package/dist/index.js +0 -59554
- package/dist/lancedb.linux-x64-gnu-b7f0jgsz.node +0 -0
- package/dist/lancedb.linux-x64-musl-tgcv22rx.node +0 -0
- package/dist/shared/chunk-25dwp0dp.js +0 -89
- package/dist/shared/chunk-3pjb6063.js +0 -208
- package/dist/shared/chunk-4d6ydpw7.js +0 -2854
- package/dist/shared/chunk-4wjcadjk.js +0 -225
- package/dist/shared/chunk-5j4w74t6.js +0 -30
- package/dist/shared/chunk-5j8m3dh3.js +0 -58
- package/dist/shared/chunk-5thh3qem.js +0 -91
- package/dist/shared/chunk-6g9xy73m.js +0 -252
- package/dist/shared/chunk-7eq34c42.js +0 -23
- package/dist/shared/chunk-c2gwgx3r.js +0 -115
- package/dist/shared/chunk-cjd3mk4c.js +0 -1320
- package/dist/shared/chunk-g5cv6703.js +0 -368
- package/dist/shared/chunk-hpkhykhq.js +0 -574
- package/dist/shared/chunk-m2322pdk.js +0 -122
- package/dist/shared/chunk-nd5fdvaq.js +0 -26
- package/dist/shared/chunk-pgd3m6zf.js +0 -108
- package/dist/shared/chunk-qk8n91hw.js +0 -494
- package/dist/shared/chunk-rkkn8szp.js +0 -16855
- package/dist/shared/chunk-t16rfxh0.js +0 -61
- package/dist/shared/chunk-t4fbfa5v.js +0 -19
- package/dist/shared/chunk-t77h86w6.js +0 -276
- package/dist/shared/chunk-v0ez4aef.js +0 -71
- package/dist/shared/chunk-v29j2r3s.js +0 -32051
- package/dist/shared/chunk-vfbc6ew5.js +0 -765
- package/dist/shared/chunk-vmeqwm1c.js +0 -204
- package/dist/shared/chunk-x66eh37x.js +0 -137
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @sylphx/flow
|
|
2
2
|
|
|
3
|
+
## 1.0.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Publish source code instead of bundled dist to fix Unicode and native binding issues
|
|
8
|
+
|
|
9
|
+
## 1.0.2
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Fix missing dist directory in npm package by adding prepublishOnly script
|
|
14
|
+
|
|
3
15
|
## 1.0.0
|
|
4
16
|
|
|
5
17
|
### Major Changes
|
package/package.json
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sylphx/flow",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "AI-powered development workflow automation with autonomous loop mode and smart configuration",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
|
-
"sylphx-flow": "./
|
|
7
|
+
"sylphx-flow": "./src/index.ts"
|
|
8
|
+
},
|
|
9
|
+
"engines": {
|
|
10
|
+
"node": ">=18.0.0"
|
|
8
11
|
},
|
|
9
12
|
"scripts": {
|
|
10
|
-
"build": "bunup",
|
|
11
13
|
"dev": "bun src/index.ts",
|
|
12
|
-
"start": "bun
|
|
14
|
+
"start": "bun src/index.ts",
|
|
13
15
|
"test": "vitest run",
|
|
14
16
|
"test:watch": "vitest",
|
|
15
|
-
"type-check": "tsc --noEmit"
|
|
16
|
-
"clean": "rm -rf dist",
|
|
17
|
-
"prepublishOnly": "bun run build"
|
|
17
|
+
"type-check": "tsc --noEmit"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"commander": "^14.0.2",
|
|
@@ -37,10 +37,11 @@
|
|
|
37
37
|
"access": "public"
|
|
38
38
|
},
|
|
39
39
|
"files": [
|
|
40
|
-
"
|
|
40
|
+
"src",
|
|
41
41
|
"README.md",
|
|
42
42
|
"CHANGELOG.md",
|
|
43
|
-
"LOOP_MODE.md"
|
|
43
|
+
"LOOP_MODE.md",
|
|
44
|
+
"package.json"
|
|
44
45
|
],
|
|
45
46
|
"keywords": [
|
|
46
47
|
"ai",
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
import { Command } from 'commander';
|
|
3
|
+
import ora from 'ora';
|
|
4
|
+
import { ReindexMonitor } from '../components/reindex-progress.js';
|
|
5
|
+
import { CodebaseIndexer } from '../services/search/codebase-indexer.js';
|
|
6
|
+
import { getDefaultEmbeddingProvider } from '../services/search/embeddings.js';
|
|
7
|
+
import { getSearchService } from '../services/search/unified-search-service.js';
|
|
8
|
+
import { CLIError } from '../utils/error-handler.js';
|
|
9
|
+
|
|
10
|
+
export const codebaseSearchCommand = new Command('search')
|
|
11
|
+
.description('Search codebase files and source code')
|
|
12
|
+
.argument('<query>', 'Search query - use natural language, function names, or technical terms')
|
|
13
|
+
.option('-l, --limit <number>', 'Maximum number of results to return', '10')
|
|
14
|
+
.option('--include-content', 'Include file content snippets in results', true)
|
|
15
|
+
.option('--extensions <exts...>', 'Filter by file extensions (e.g., .ts .tsx .js)')
|
|
16
|
+
.option('--path <pattern>', 'Filter by path pattern (e.g., src/components)')
|
|
17
|
+
.option('--exclude <patterns...>', 'Exclude paths containing these patterns')
|
|
18
|
+
.action(async (query, options) => {
|
|
19
|
+
try {
|
|
20
|
+
console.log('');
|
|
21
|
+
console.log(chalk.cyan.bold('▸ Search Codebase'));
|
|
22
|
+
console.log(chalk.gray(` Query: "${query}"`));
|
|
23
|
+
|
|
24
|
+
const spinner = ora('Searching...').start();
|
|
25
|
+
const searchService = getSearchService();
|
|
26
|
+
await searchService.initialize();
|
|
27
|
+
|
|
28
|
+
const result = await searchService.searchCodebase(query, {
|
|
29
|
+
limit: Number.parseInt(String(options.limit), 10) || 10,
|
|
30
|
+
include_content: options.includeContent !== false,
|
|
31
|
+
file_extensions: options.extensions,
|
|
32
|
+
path_filter: options.path,
|
|
33
|
+
exclude_paths: options.exclude,
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
spinner.stop();
|
|
37
|
+
|
|
38
|
+
const output = searchService.formatResultsForCLI(result.results, query, result.totalIndexed);
|
|
39
|
+
console.log(output);
|
|
40
|
+
console.log('');
|
|
41
|
+
} catch (error) {
|
|
42
|
+
console.error(chalk.red(`\n✗ Error: ${(error as Error).message}\n`));
|
|
43
|
+
process.exit(1);
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
export const codebaseReindexCommand = new Command('reindex')
|
|
48
|
+
.description('Reindex all codebase files')
|
|
49
|
+
.action(async () => {
|
|
50
|
+
try {
|
|
51
|
+
const indexer = new CodebaseIndexer();
|
|
52
|
+
|
|
53
|
+
// Check if API key exists - only use embeddings if key is present
|
|
54
|
+
const hasApiKey = !!process.env.OPENAI_API_KEY;
|
|
55
|
+
const embeddingProvider = hasApiKey ? await getDefaultEmbeddingProvider() : undefined;
|
|
56
|
+
const mode: 'tfidf-only' | 'semantic' = hasApiKey ? 'semantic' : 'tfidf-only';
|
|
57
|
+
|
|
58
|
+
// Create monitor for progress display
|
|
59
|
+
const monitor = new ReindexMonitor();
|
|
60
|
+
|
|
61
|
+
// Start the UI
|
|
62
|
+
monitor.start(0); // Will update total when we know file count
|
|
63
|
+
|
|
64
|
+
let totalFiles = 0;
|
|
65
|
+
let phase: 'tokenizing' | 'calculating' | 'completed' = 'tokenizing';
|
|
66
|
+
|
|
67
|
+
// Set initial mode
|
|
68
|
+
monitor.updateProgress({ mode });
|
|
69
|
+
|
|
70
|
+
const result = await indexer.indexCodebase({
|
|
71
|
+
force: true, // Reindex should always force rebuild
|
|
72
|
+
embeddingProvider,
|
|
73
|
+
onProgress: (progress) => {
|
|
74
|
+
// Track total files on first progress update
|
|
75
|
+
if (totalFiles === 0 && progress.total > 0) {
|
|
76
|
+
totalFiles = progress.total;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// Update Ink UI only (stderr output was interfering with Ink rendering)
|
|
80
|
+
monitor.updateProgress({
|
|
81
|
+
current: progress.current,
|
|
82
|
+
total: progress.total,
|
|
83
|
+
fileName: progress.fileName,
|
|
84
|
+
status: progress.status,
|
|
85
|
+
phase,
|
|
86
|
+
});
|
|
87
|
+
},
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
// Handle cache hit - simulate progress to show 100%
|
|
91
|
+
if (result.stats.cacheHit) {
|
|
92
|
+
monitor.updateProgress({
|
|
93
|
+
current: result.stats.totalFiles,
|
|
94
|
+
total: result.stats.totalFiles,
|
|
95
|
+
fileName: '',
|
|
96
|
+
status: 'completed',
|
|
97
|
+
phase: 'tokenizing',
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
// Small delay
|
|
101
|
+
await new Promise((resolve) => setTimeout(resolve, 300));
|
|
102
|
+
} else {
|
|
103
|
+
// Update to calculating phase
|
|
104
|
+
phase = 'calculating';
|
|
105
|
+
monitor.updateProgress({ phase: 'calculating' });
|
|
106
|
+
|
|
107
|
+
// Small delay to show calculating phase
|
|
108
|
+
await new Promise((resolve) => setTimeout(resolve, 500));
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// Show completion with stats
|
|
112
|
+
monitor.updateProgress({
|
|
113
|
+
phase: 'completed',
|
|
114
|
+
stats: {
|
|
115
|
+
documentsProcessed: result.stats.totalFiles,
|
|
116
|
+
uniqueTerms: result.tfidfIndex.idf.size,
|
|
117
|
+
},
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
// Give time to see the completion message
|
|
121
|
+
await new Promise((resolve) => setTimeout(resolve, 2000));
|
|
122
|
+
|
|
123
|
+
monitor.stop();
|
|
124
|
+
} catch (error) {
|
|
125
|
+
throw new CLIError(`Codebase reindex failed: ${(error as Error).message}`);
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
export const codebaseStatusCommand = new Command('status')
|
|
130
|
+
.description('Get codebase search system status')
|
|
131
|
+
.action(async () => {
|
|
132
|
+
try {
|
|
133
|
+
console.log('');
|
|
134
|
+
console.log(chalk.cyan.bold('▸ Codebase Status'));
|
|
135
|
+
|
|
136
|
+
const searchService = getSearchService();
|
|
137
|
+
await searchService.initialize();
|
|
138
|
+
const status = await searchService.getStatus();
|
|
139
|
+
|
|
140
|
+
if (status.codebase.indexed) {
|
|
141
|
+
console.log(chalk.green('\n✓ Indexed and ready'));
|
|
142
|
+
console.log(chalk.gray(` Files: ${status.codebase.fileCount}`));
|
|
143
|
+
if (status.codebase.indexedAt) {
|
|
144
|
+
console.log(
|
|
145
|
+
chalk.gray(` Last indexed: ${new Date(status.codebase.indexedAt).toLocaleString()}`)
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
} else {
|
|
149
|
+
console.log(chalk.yellow('\n⚠ Not indexed'));
|
|
150
|
+
console.log(chalk.gray(' Run: sylphx-flow codebase reindex'));
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
console.log(chalk.cyan('\n▸ Available Commands'));
|
|
154
|
+
console.log(chalk.gray(' • codebase search <query>'));
|
|
155
|
+
console.log(chalk.gray(' • codebase reindex'));
|
|
156
|
+
console.log(chalk.gray(' • codebase status'));
|
|
157
|
+
console.log('');
|
|
158
|
+
} catch (error) {
|
|
159
|
+
console.error(chalk.red(`\n✗ Error: ${(error as Error).message}\n`));
|
|
160
|
+
process.exit(1);
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
export const codebaseCommand = new Command('codebase')
|
|
165
|
+
.description('Manage codebase indexing and search')
|
|
166
|
+
.addCommand(codebaseSearchCommand)
|
|
167
|
+
.addCommand(codebaseReindexCommand)
|
|
168
|
+
.addCommand(codebaseStatusCommand);
|