@soulcraft/brainy 1.5.0 → 2.0.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/CHANGELOG.md +188 -0
- package/LICENSE +2 -2
- package/README.md +201 -596
- package/bin/brainy-interactive.js +564 -0
- package/bin/brainy-ts.js +18 -0
- package/bin/brainy.js +672 -81
- package/dist/augmentationPipeline.d.ts +48 -220
- package/dist/augmentationPipeline.js +60 -508
- package/dist/augmentationRegistry.d.ts +22 -31
- package/dist/augmentationRegistry.js +28 -79
- package/dist/augmentations/apiServerAugmentation.d.ts +108 -0
- package/dist/augmentations/apiServerAugmentation.js +502 -0
- package/dist/augmentations/batchProcessingAugmentation.d.ts +95 -0
- package/dist/augmentations/batchProcessingAugmentation.js +567 -0
- package/dist/augmentations/brainyAugmentation.d.ts +153 -0
- package/dist/augmentations/brainyAugmentation.js +145 -0
- package/dist/augmentations/cacheAugmentation.d.ts +105 -0
- package/dist/augmentations/cacheAugmentation.js +238 -0
- package/dist/augmentations/conduitAugmentations.d.ts +54 -156
- package/dist/augmentations/conduitAugmentations.js +156 -1082
- package/dist/augmentations/connectionPoolAugmentation.d.ts +62 -0
- package/dist/augmentations/connectionPoolAugmentation.js +316 -0
- package/dist/augmentations/defaultAugmentations.d.ts +53 -0
- package/dist/augmentations/defaultAugmentations.js +88 -0
- package/dist/augmentations/entityRegistryAugmentation.d.ts +126 -0
- package/dist/augmentations/entityRegistryAugmentation.js +386 -0
- package/dist/augmentations/indexAugmentation.d.ts +117 -0
- package/dist/augmentations/indexAugmentation.js +284 -0
- package/dist/augmentations/intelligentVerbScoringAugmentation.d.ts +152 -0
- package/dist/augmentations/intelligentVerbScoringAugmentation.js +554 -0
- package/dist/augmentations/metricsAugmentation.d.ts +202 -0
- package/dist/augmentations/metricsAugmentation.js +291 -0
- package/dist/augmentations/monitoringAugmentation.d.ts +94 -0
- package/dist/augmentations/monitoringAugmentation.js +227 -0
- package/dist/augmentations/neuralImport.d.ts +50 -117
- package/dist/augmentations/neuralImport.js +255 -629
- package/dist/augmentations/requestDeduplicatorAugmentation.d.ts +52 -0
- package/dist/augmentations/requestDeduplicatorAugmentation.js +162 -0
- package/dist/augmentations/serverSearchAugmentations.d.ts +43 -22
- package/dist/augmentations/serverSearchAugmentations.js +125 -72
- package/dist/augmentations/storageAugmentation.d.ts +54 -0
- package/dist/augmentations/storageAugmentation.js +93 -0
- package/dist/augmentations/storageAugmentations.d.ts +96 -0
- package/dist/augmentations/storageAugmentations.js +182 -0
- package/dist/augmentations/synapseAugmentation.d.ts +156 -0
- package/dist/augmentations/synapseAugmentation.js +312 -0
- package/dist/augmentations/walAugmentation.d.ts +108 -0
- package/dist/augmentations/walAugmentation.js +515 -0
- package/dist/brainyData.d.ts +404 -130
- package/dist/brainyData.js +1331 -853
- package/dist/chat/BrainyChat.d.ts +16 -8
- package/dist/chat/BrainyChat.js +60 -32
- package/dist/chat/ChatCLI.d.ts +1 -1
- package/dist/chat/ChatCLI.js +6 -6
- package/dist/cli/catalog.d.ts +3 -3
- package/dist/cli/catalog.js +116 -70
- package/dist/cli/commands/core.d.ts +61 -0
- package/dist/cli/commands/core.js +348 -0
- package/dist/cli/commands/neural.d.ts +25 -0
- package/dist/cli/commands/neural.js +508 -0
- package/dist/cli/commands/utility.d.ts +37 -0
- package/dist/cli/commands/utility.js +276 -0
- package/dist/cli/index.d.ts +7 -0
- package/dist/cli/index.js +167 -0
- package/dist/cli/interactive.d.ts +164 -0
- package/dist/cli/interactive.js +542 -0
- package/dist/cortex/neuralImport.js +5 -5
- package/dist/critical/model-guardian.js +11 -4
- package/dist/embeddings/lightweight-embedder.d.ts +23 -0
- package/dist/embeddings/lightweight-embedder.js +136 -0
- package/dist/embeddings/universal-memory-manager.d.ts +38 -0
- package/dist/embeddings/universal-memory-manager.js +206 -0
- package/dist/embeddings/worker-embedding.d.ts +7 -0
- package/dist/embeddings/worker-embedding.js +77 -0
- package/dist/embeddings/worker-manager.d.ts +28 -0
- package/dist/embeddings/worker-manager.js +162 -0
- package/dist/examples/basicUsage.js +7 -7
- package/dist/graph/pathfinding.d.ts +78 -0
- package/dist/graph/pathfinding.js +393 -0
- package/dist/hnsw/hnswIndex.d.ts +13 -0
- package/dist/hnsw/hnswIndex.js +35 -0
- package/dist/hnsw/hnswIndexOptimized.d.ts +1 -0
- package/dist/hnsw/hnswIndexOptimized.js +3 -0
- package/dist/index.d.ts +9 -11
- package/dist/index.js +21 -11
- package/dist/indices/fieldIndex.d.ts +76 -0
- package/dist/indices/fieldIndex.js +357 -0
- package/dist/mcp/brainyMCPAdapter.js +3 -2
- package/dist/mcp/mcpAugmentationToolset.js +11 -17
- package/dist/neural/embeddedPatterns.d.ts +41 -0
- package/dist/neural/embeddedPatterns.js +4044 -0
- package/dist/neural/naturalLanguageProcessor.d.ts +94 -0
- package/dist/neural/naturalLanguageProcessor.js +317 -0
- package/dist/neural/naturalLanguageProcessorStatic.d.ts +64 -0
- package/dist/neural/naturalLanguageProcessorStatic.js +151 -0
- package/dist/neural/neuralAPI.d.ts +255 -0
- package/dist/neural/neuralAPI.js +612 -0
- package/dist/neural/patternLibrary.d.ts +101 -0
- package/dist/neural/patternLibrary.js +313 -0
- package/dist/neural/patterns.d.ts +27 -0
- package/dist/neural/patterns.js +68 -0
- package/dist/neural/staticPatternMatcher.d.ts +35 -0
- package/dist/neural/staticPatternMatcher.js +153 -0
- package/dist/scripts/precomputePatternEmbeddings.d.ts +19 -0
- package/dist/scripts/precomputePatternEmbeddings.js +100 -0
- package/dist/storage/adapters/fileSystemStorage.d.ts +5 -0
- package/dist/storage/adapters/fileSystemStorage.js +20 -0
- package/dist/storage/adapters/s3CompatibleStorage.d.ts +5 -0
- package/dist/storage/adapters/s3CompatibleStorage.js +16 -0
- package/dist/storage/enhancedClearOperations.d.ts +83 -0
- package/dist/storage/enhancedClearOperations.js +345 -0
- package/dist/storage/storageFactory.js +31 -27
- package/dist/triple/TripleIntelligence.d.ts +134 -0
- package/dist/triple/TripleIntelligence.js +548 -0
- package/dist/types/augmentations.d.ts +45 -344
- package/dist/types/augmentations.js +5 -2
- package/dist/types/brainyDataInterface.d.ts +20 -10
- package/dist/types/graphTypes.d.ts +46 -0
- package/dist/types/graphTypes.js +16 -2
- package/dist/utils/BoundedRegistry.d.ts +29 -0
- package/dist/utils/BoundedRegistry.js +54 -0
- package/dist/utils/embedding.js +20 -3
- package/dist/utils/hybridModelManager.js +10 -5
- package/dist/utils/metadataFilter.d.ts +33 -19
- package/dist/utils/metadataFilter.js +58 -23
- package/dist/utils/metadataIndex.d.ts +37 -6
- package/dist/utils/metadataIndex.js +427 -64
- package/dist/utils/requestDeduplicator.d.ts +10 -0
- package/dist/utils/requestDeduplicator.js +24 -0
- package/dist/utils/unifiedCache.d.ts +103 -0
- package/dist/utils/unifiedCache.js +311 -0
- package/package.json +43 -128
- package/scripts/ensure-models.js +108 -0
- package/scripts/prepare-models.js +387 -0
- package/OFFLINE_MODELS.md +0 -56
- package/dist/intelligence/neuralEngine.d.ts +0 -207
- package/dist/intelligence/neuralEngine.js +0 -706
- package/dist/utils/modelLoader.d.ts +0 -32
- package/dist/utils/modelLoader.js +0 -219
- package/dist/utils/modelManager.d.ts +0 -77
- package/dist/utils/modelManager.js +0 -219
|
@@ -0,0 +1,348 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core CLI Commands - TypeScript Implementation
|
|
3
|
+
*
|
|
4
|
+
* Essential database operations: add, search, get, relate, import, export
|
|
5
|
+
*/
|
|
6
|
+
import chalk from 'chalk';
|
|
7
|
+
import ora from 'ora';
|
|
8
|
+
import { readFileSync, writeFileSync } from 'fs';
|
|
9
|
+
import { BrainyData } from '../../brainyData.js';
|
|
10
|
+
let brainyInstance = null;
|
|
11
|
+
const getBrainy = async () => {
|
|
12
|
+
if (!brainyInstance) {
|
|
13
|
+
brainyInstance = new BrainyData();
|
|
14
|
+
await brainyInstance.init();
|
|
15
|
+
}
|
|
16
|
+
return brainyInstance;
|
|
17
|
+
};
|
|
18
|
+
const formatOutput = (data, options) => {
|
|
19
|
+
if (options.json) {
|
|
20
|
+
console.log(options.pretty ? JSON.stringify(data, null, 2) : JSON.stringify(data));
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
export const coreCommands = {
|
|
24
|
+
/**
|
|
25
|
+
* Add data to the neural database
|
|
26
|
+
*/
|
|
27
|
+
async add(text, options) {
|
|
28
|
+
const spinner = ora('Adding to neural database...').start();
|
|
29
|
+
try {
|
|
30
|
+
const brain = await getBrainy();
|
|
31
|
+
let metadata = {};
|
|
32
|
+
if (options.metadata) {
|
|
33
|
+
try {
|
|
34
|
+
metadata = JSON.parse(options.metadata);
|
|
35
|
+
}
|
|
36
|
+
catch {
|
|
37
|
+
spinner.fail('Invalid metadata JSON');
|
|
38
|
+
process.exit(1);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
if (options.id) {
|
|
42
|
+
metadata.id = options.id;
|
|
43
|
+
}
|
|
44
|
+
if (options.type) {
|
|
45
|
+
metadata.type = options.type;
|
|
46
|
+
}
|
|
47
|
+
// Smart detection by default
|
|
48
|
+
const result = await brain.add(text, metadata);
|
|
49
|
+
spinner.succeed('Added successfully');
|
|
50
|
+
if (!options.json) {
|
|
51
|
+
console.log(chalk.green(`✓ Added with ID: ${result}`));
|
|
52
|
+
if (options.type) {
|
|
53
|
+
console.log(chalk.dim(` Type: ${options.type}`));
|
|
54
|
+
}
|
|
55
|
+
if (Object.keys(metadata).length > 0) {
|
|
56
|
+
console.log(chalk.dim(` Metadata: ${JSON.stringify(metadata)}`));
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
formatOutput({ id: result, metadata }, options);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
catch (error) {
|
|
64
|
+
spinner.fail('Failed to add data');
|
|
65
|
+
console.error(chalk.red(error.message));
|
|
66
|
+
process.exit(1);
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
/**
|
|
70
|
+
* Search the neural database
|
|
71
|
+
*/
|
|
72
|
+
async search(query, options) {
|
|
73
|
+
const spinner = ora('Searching neural database...').start();
|
|
74
|
+
try {
|
|
75
|
+
const brain = await getBrainy();
|
|
76
|
+
const searchOptions = {
|
|
77
|
+
limit: options.limit ? parseInt(options.limit) : 10
|
|
78
|
+
};
|
|
79
|
+
if (options.threshold) {
|
|
80
|
+
searchOptions.threshold = parseFloat(options.threshold);
|
|
81
|
+
}
|
|
82
|
+
if (options.metadata) {
|
|
83
|
+
try {
|
|
84
|
+
searchOptions.filter = JSON.parse(options.metadata);
|
|
85
|
+
}
|
|
86
|
+
catch {
|
|
87
|
+
spinner.fail('Invalid metadata filter JSON');
|
|
88
|
+
process.exit(1);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
const results = await brain.search(query, searchOptions.limit, searchOptions);
|
|
92
|
+
spinner.succeed(`Found ${results.length} results`);
|
|
93
|
+
if (!options.json) {
|
|
94
|
+
if (results.length === 0) {
|
|
95
|
+
console.log(chalk.yellow('No results found'));
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
results.forEach((result, i) => {
|
|
99
|
+
console.log(chalk.cyan(`\n${i + 1}. ${result.content || result.id}`));
|
|
100
|
+
if (result.score !== undefined) {
|
|
101
|
+
console.log(chalk.dim(` Similarity: ${(result.score * 100).toFixed(1)}%`));
|
|
102
|
+
}
|
|
103
|
+
if (result.metadata) {
|
|
104
|
+
console.log(chalk.dim(` Metadata: ${JSON.stringify(result.metadata)}`));
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
formatOutput(results, options);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
catch (error) {
|
|
114
|
+
spinner.fail('Search failed');
|
|
115
|
+
console.error(chalk.red(error.message));
|
|
116
|
+
process.exit(1);
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
/**
|
|
120
|
+
* Get item by ID
|
|
121
|
+
*/
|
|
122
|
+
async get(id, options) {
|
|
123
|
+
const spinner = ora('Fetching item...').start();
|
|
124
|
+
try {
|
|
125
|
+
const brain = await getBrainy();
|
|
126
|
+
// Try to get the item
|
|
127
|
+
const results = await brain.search(id, 1);
|
|
128
|
+
if (results.length === 0) {
|
|
129
|
+
spinner.fail('Item not found');
|
|
130
|
+
console.log(chalk.yellow(`No item found with ID: ${id}`));
|
|
131
|
+
process.exit(1);
|
|
132
|
+
}
|
|
133
|
+
const item = results[0];
|
|
134
|
+
spinner.succeed('Item found');
|
|
135
|
+
if (!options.json) {
|
|
136
|
+
console.log(chalk.cyan('\nItem Details:'));
|
|
137
|
+
console.log(` ID: ${item.id}`);
|
|
138
|
+
console.log(` Content: ${item.content || 'N/A'}`);
|
|
139
|
+
if (item.metadata) {
|
|
140
|
+
console.log(` Metadata: ${JSON.stringify(item.metadata, null, 2)}`);
|
|
141
|
+
}
|
|
142
|
+
if (options.withConnections) {
|
|
143
|
+
// Get verbs/relationships
|
|
144
|
+
// Get connections if method exists
|
|
145
|
+
const connections = brain.getConnections ? await brain.getConnections(id) : [];
|
|
146
|
+
if (connections && connections.length > 0) {
|
|
147
|
+
console.log(chalk.cyan('\nConnections:'));
|
|
148
|
+
connections.forEach((conn) => {
|
|
149
|
+
console.log(` ${conn.source} --[${conn.type}]--> ${conn.target}`);
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
formatOutput(item, options);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
catch (error) {
|
|
159
|
+
spinner.fail('Failed to get item');
|
|
160
|
+
console.error(chalk.red(error.message));
|
|
161
|
+
process.exit(1);
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
/**
|
|
165
|
+
* Create relationship between items
|
|
166
|
+
*/
|
|
167
|
+
async relate(source, verb, target, options) {
|
|
168
|
+
const spinner = ora('Creating relationship...').start();
|
|
169
|
+
try {
|
|
170
|
+
const brain = await getBrainy();
|
|
171
|
+
let metadata = {};
|
|
172
|
+
if (options.metadata) {
|
|
173
|
+
try {
|
|
174
|
+
metadata = JSON.parse(options.metadata);
|
|
175
|
+
}
|
|
176
|
+
catch {
|
|
177
|
+
spinner.fail('Invalid metadata JSON');
|
|
178
|
+
process.exit(1);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
if (options.weight) {
|
|
182
|
+
metadata.weight = parseFloat(options.weight);
|
|
183
|
+
}
|
|
184
|
+
// Create the relationship
|
|
185
|
+
const result = await brain.addVerb(source, target, verb, metadata);
|
|
186
|
+
spinner.succeed('Relationship created');
|
|
187
|
+
if (!options.json) {
|
|
188
|
+
console.log(chalk.green(`✓ Created relationship with ID: ${result}`));
|
|
189
|
+
console.log(chalk.dim(` ${source} --[${verb}]--> ${target}`));
|
|
190
|
+
if (metadata.weight) {
|
|
191
|
+
console.log(chalk.dim(` Weight: ${metadata.weight}`));
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
else {
|
|
195
|
+
formatOutput({ id: result, source, verb, target, metadata }, options);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
catch (error) {
|
|
199
|
+
spinner.fail('Failed to create relationship');
|
|
200
|
+
console.error(chalk.red(error.message));
|
|
201
|
+
process.exit(1);
|
|
202
|
+
}
|
|
203
|
+
},
|
|
204
|
+
/**
|
|
205
|
+
* Import data from file
|
|
206
|
+
*/
|
|
207
|
+
async import(file, options) {
|
|
208
|
+
const spinner = ora('Importing data...').start();
|
|
209
|
+
try {
|
|
210
|
+
const brain = await getBrainy();
|
|
211
|
+
const format = options.format || 'json';
|
|
212
|
+
const batchSize = options.batchSize ? parseInt(options.batchSize) : 100;
|
|
213
|
+
// Read file content
|
|
214
|
+
const content = readFileSync(file, 'utf-8');
|
|
215
|
+
let items = [];
|
|
216
|
+
switch (format) {
|
|
217
|
+
case 'json':
|
|
218
|
+
items = JSON.parse(content);
|
|
219
|
+
if (!Array.isArray(items)) {
|
|
220
|
+
items = [items];
|
|
221
|
+
}
|
|
222
|
+
break;
|
|
223
|
+
case 'jsonl':
|
|
224
|
+
items = content.split('\n')
|
|
225
|
+
.filter(line => line.trim())
|
|
226
|
+
.map(line => JSON.parse(line));
|
|
227
|
+
break;
|
|
228
|
+
case 'csv':
|
|
229
|
+
// Simple CSV parsing (first line is headers)
|
|
230
|
+
const lines = content.split('\n').filter(line => line.trim());
|
|
231
|
+
const headers = lines[0].split(',').map(h => h.trim());
|
|
232
|
+
items = lines.slice(1).map(line => {
|
|
233
|
+
const values = line.split(',').map(v => v.trim());
|
|
234
|
+
const obj = {};
|
|
235
|
+
headers.forEach((h, i) => {
|
|
236
|
+
obj[h] = values[i];
|
|
237
|
+
});
|
|
238
|
+
return obj;
|
|
239
|
+
});
|
|
240
|
+
break;
|
|
241
|
+
}
|
|
242
|
+
spinner.text = `Importing ${items.length} items...`;
|
|
243
|
+
// Process in batches
|
|
244
|
+
let imported = 0;
|
|
245
|
+
for (let i = 0; i < items.length; i += batchSize) {
|
|
246
|
+
const batch = items.slice(i, i + batchSize);
|
|
247
|
+
for (const item of batch) {
|
|
248
|
+
if (typeof item === 'string') {
|
|
249
|
+
await brain.add(item);
|
|
250
|
+
}
|
|
251
|
+
else if (item.content || item.text) {
|
|
252
|
+
await brain.add(item.content || item.text, item.metadata || item);
|
|
253
|
+
}
|
|
254
|
+
else {
|
|
255
|
+
await brain.add(JSON.stringify(item), { originalData: item });
|
|
256
|
+
}
|
|
257
|
+
imported++;
|
|
258
|
+
}
|
|
259
|
+
spinner.text = `Imported ${imported}/${items.length} items...`;
|
|
260
|
+
}
|
|
261
|
+
spinner.succeed(`Imported ${imported} items`);
|
|
262
|
+
if (!options.json) {
|
|
263
|
+
console.log(chalk.green(`✓ Successfully imported ${imported} items from ${file}`));
|
|
264
|
+
console.log(chalk.dim(` Format: ${format}`));
|
|
265
|
+
console.log(chalk.dim(` Batch size: ${batchSize}`));
|
|
266
|
+
}
|
|
267
|
+
else {
|
|
268
|
+
formatOutput({ imported, file, format, batchSize }, options);
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
catch (error) {
|
|
272
|
+
spinner.fail('Import failed');
|
|
273
|
+
console.error(chalk.red(error.message));
|
|
274
|
+
process.exit(1);
|
|
275
|
+
}
|
|
276
|
+
},
|
|
277
|
+
/**
|
|
278
|
+
* Export database
|
|
279
|
+
*/
|
|
280
|
+
async export(file, options) {
|
|
281
|
+
const spinner = ora('Exporting database...').start();
|
|
282
|
+
try {
|
|
283
|
+
const brain = await getBrainy();
|
|
284
|
+
const format = options.format || 'json';
|
|
285
|
+
// Export all data
|
|
286
|
+
const data = await brain.export({ format: 'json' });
|
|
287
|
+
let output = '';
|
|
288
|
+
switch (format) {
|
|
289
|
+
case 'json':
|
|
290
|
+
output = options.pretty
|
|
291
|
+
? JSON.stringify(data, null, 2)
|
|
292
|
+
: JSON.stringify(data);
|
|
293
|
+
break;
|
|
294
|
+
case 'jsonl':
|
|
295
|
+
if (Array.isArray(data)) {
|
|
296
|
+
output = data.map(item => JSON.stringify(item)).join('\n');
|
|
297
|
+
}
|
|
298
|
+
else {
|
|
299
|
+
output = JSON.stringify(data);
|
|
300
|
+
}
|
|
301
|
+
break;
|
|
302
|
+
case 'csv':
|
|
303
|
+
if (Array.isArray(data) && data.length > 0) {
|
|
304
|
+
// Get all unique keys for headers
|
|
305
|
+
const headers = new Set();
|
|
306
|
+
data.forEach(item => {
|
|
307
|
+
Object.keys(item).forEach(key => headers.add(key));
|
|
308
|
+
});
|
|
309
|
+
const headerArray = Array.from(headers);
|
|
310
|
+
// Create CSV
|
|
311
|
+
output = headerArray.join(',') + '\n';
|
|
312
|
+
output += data.map(item => {
|
|
313
|
+
return headerArray.map(h => {
|
|
314
|
+
const value = item[h];
|
|
315
|
+
if (typeof value === 'object') {
|
|
316
|
+
return JSON.stringify(value);
|
|
317
|
+
}
|
|
318
|
+
return value || '';
|
|
319
|
+
}).join(',');
|
|
320
|
+
}).join('\n');
|
|
321
|
+
}
|
|
322
|
+
break;
|
|
323
|
+
}
|
|
324
|
+
if (file) {
|
|
325
|
+
writeFileSync(file, output);
|
|
326
|
+
spinner.succeed(`Exported to ${file}`);
|
|
327
|
+
if (!options.json) {
|
|
328
|
+
console.log(chalk.green(`✓ Successfully exported database to ${file}`));
|
|
329
|
+
console.log(chalk.dim(` Format: ${format}`));
|
|
330
|
+
console.log(chalk.dim(` Items: ${Array.isArray(data) ? data.length : 1}`));
|
|
331
|
+
}
|
|
332
|
+
else {
|
|
333
|
+
formatOutput({ file, format, count: Array.isArray(data) ? data.length : 1 }, options);
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
else {
|
|
337
|
+
spinner.succeed('Export complete');
|
|
338
|
+
console.log(output);
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
catch (error) {
|
|
342
|
+
spinner.fail('Export failed');
|
|
343
|
+
console.error(chalk.red(error.message));
|
|
344
|
+
process.exit(1);
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
};
|
|
348
|
+
//# sourceMappingURL=core.js.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 🧠 Neural Similarity API Commands
|
|
3
|
+
*
|
|
4
|
+
* CLI interface for semantic similarity, clustering, and neural operations
|
|
5
|
+
*/
|
|
6
|
+
interface CommandArguments {
|
|
7
|
+
action?: string;
|
|
8
|
+
id?: string;
|
|
9
|
+
query?: string;
|
|
10
|
+
threshold?: number;
|
|
11
|
+
format?: string;
|
|
12
|
+
output?: string;
|
|
13
|
+
limit?: number;
|
|
14
|
+
algorithm?: string;
|
|
15
|
+
dimensions?: number;
|
|
16
|
+
explain?: boolean;
|
|
17
|
+
_: string[];
|
|
18
|
+
}
|
|
19
|
+
export declare const neuralCommand: {
|
|
20
|
+
command: string;
|
|
21
|
+
describe: string;
|
|
22
|
+
builder: (yargs: any) => any;
|
|
23
|
+
handler: (argv: CommandArguments) => Promise<void>;
|
|
24
|
+
};
|
|
25
|
+
export default neuralCommand;
|