@soulcraft/brainy 3.20.2 ā 3.20.4
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 +9 -0
- package/bin/brainy-interactive.js +2 -2
- package/dist/brainy.d.ts +1 -1
- package/dist/mcp/brainyMCPAdapter.d.ts +1 -1
- package/dist/mcp/brainyMCPService.d.ts +1 -1
- package/dist/neural/embeddedPatterns.d.ts +1 -1
- package/dist/neural/embeddedPatterns.js +1 -1
- package/dist/shared/default-augmentations.d.ts +1 -1
- package/dist/storage/adapters/fileSystemStorage.js +30 -17
- package/dist/types/{brainyDataInterface.js ā brainyInterface.js} +1 -1
- package/package.json +1 -1
- package/dist/augmentationFactory.d.ts +0 -86
- package/dist/augmentationFactory.js +0 -342
- package/dist/augmentationRegistry.d.ts +0 -38
- package/dist/augmentationRegistry.js +0 -54
- package/dist/augmentationRegistryLoader.d.ts +0 -146
- package/dist/augmentationRegistryLoader.js +0 -213
- package/dist/augmentations/KnowledgeAugmentation.d.ts +0 -40
- package/dist/augmentations/KnowledgeAugmentation.js +0 -251
- package/dist/augmentations/intelligentVerbScoring.d.ts +0 -158
- package/dist/augmentations/intelligentVerbScoring.js +0 -377
- package/dist/augmentations/marketplace/AugmentationMarketplace.d.ts +0 -168
- package/dist/augmentations/marketplace/AugmentationMarketplace.js +0 -329
- package/dist/augmentations/marketplace/cli.d.ts +0 -47
- package/dist/augmentations/marketplace/cli.js +0 -265
- package/dist/augmentations/memoryAugmentations.d.ts +0 -72
- package/dist/augmentations/memoryAugmentations.js +0 -280
- package/dist/augmentations/serverSearchAugmentations.d.ts +0 -190
- package/dist/augmentations/serverSearchAugmentations.js +0 -586
- package/dist/brainy-unified.d.ts +0 -106
- package/dist/brainy-unified.js +0 -327
- package/dist/brainyData.d.ts +0 -1832
- package/dist/brainyData.js +0 -6443
- package/dist/brainyDataV3.d.ts +0 -186
- package/dist/brainyDataV3.js +0 -337
- package/dist/config/distributedPresets-new.d.ts +0 -118
- package/dist/config/distributedPresets-new.js +0 -318
- package/dist/config/modelPrecisionManager.d.ts +0 -42
- package/dist/config/modelPrecisionManager.js +0 -98
- package/dist/connectors/interfaces/IConnector.d.ts +0 -143
- package/dist/connectors/interfaces/IConnector.js +0 -8
- package/dist/demo.d.ts +0 -106
- package/dist/demo.js +0 -201
- package/dist/embeddings/SingletonModelManager.d.ts +0 -95
- package/dist/embeddings/SingletonModelManager.js +0 -220
- package/dist/embeddings/lightweight-embedder.d.ts +0 -22
- package/dist/embeddings/lightweight-embedder.js +0 -128
- package/dist/embeddings/model-manager.d.ts +0 -39
- package/dist/embeddings/model-manager.js +0 -245
- package/dist/embeddings/universal-memory-manager.d.ts +0 -38
- package/dist/embeddings/universal-memory-manager.js +0 -166
- package/dist/embeddings/worker-embedding.d.ts +0 -7
- package/dist/embeddings/worker-embedding.js +0 -73
- package/dist/embeddings/worker-manager.d.ts +0 -28
- package/dist/embeddings/worker-manager.js +0 -162
- package/dist/examples/basicUsage.d.ts +0 -4
- package/dist/examples/basicUsage.js +0 -121
- package/dist/indices/fieldIndex.d.ts +0 -76
- package/dist/indices/fieldIndex.js +0 -357
- package/dist/mcp/brainyMCPBroadcast.d.ts +0 -82
- package/dist/mcp/brainyMCPBroadcast.js +0 -303
- package/dist/mcp/brainyMCPClient.d.ts +0 -92
- package/dist/mcp/brainyMCPClient.js +0 -258
- package/dist/scripts/precomputePatternEmbeddings.d.ts +0 -19
- package/dist/scripts/precomputePatternEmbeddings.js +0 -100
- package/dist/utils/cacheAutoConfig.d.ts +0 -63
- package/dist/utils/cacheAutoConfig.js +0 -261
- package/dist/utils/hybridModelManager.d.ts +0 -64
- package/dist/utils/hybridModelManager.js +0 -95
- package/dist/utils/statistics.d.ts +0 -28
- package/dist/utils/statistics.js +0 -25
- package/dist/vfs/ConceptSystem.d.ts +0 -203
- package/dist/vfs/ConceptSystem.js +0 -545
- package/dist/vfs/EntityManager.d.ts +0 -75
- package/dist/vfs/EntityManager.js +0 -216
- package/dist/vfs/EventRecorder.d.ts +0 -84
- package/dist/vfs/EventRecorder.js +0 -269
- package/dist/vfs/GitBridge.d.ts +0 -167
- package/dist/vfs/GitBridge.js +0 -537
- package/dist/vfs/KnowledgeAugmentation.d.ts +0 -104
- package/dist/vfs/KnowledgeAugmentation.js +0 -146
- package/dist/vfs/KnowledgeLayer.d.ts +0 -35
- package/dist/vfs/KnowledgeLayer.js +0 -443
- package/dist/vfs/PersistentEntitySystem.d.ts +0 -165
- package/dist/vfs/PersistentEntitySystem.js +0 -503
- package/dist/vfs/SemanticVersioning.d.ts +0 -105
- package/dist/vfs/SemanticVersioning.js +0 -309
- package/dist/vfs/VFSHealthCheck.d.ts +0 -78
- package/dist/vfs/VFSHealthCheck.js +0 -299
- /package/dist/types/{brainyDataInterface.d.ts ā brainyInterface.d.ts} +0 -0
|
@@ -1,329 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Augmentation Marketplace
|
|
3
|
-
*
|
|
4
|
-
* A VS Code/WebStorm-style plugin marketplace for Brainy augmentations
|
|
5
|
-
* Integrates with Soulcraft Brain-Cloud API for premium augmentations
|
|
6
|
-
*
|
|
7
|
-
* Features:
|
|
8
|
-
* - Browse and search augmentations
|
|
9
|
-
* - Install from cloud registry
|
|
10
|
-
* - Manage local augmentations
|
|
11
|
-
* - Auto-updates and licensing
|
|
12
|
-
*/
|
|
13
|
-
import { v4 as uuidv4 } from '../../universal/uuid.js';
|
|
14
|
-
/**
|
|
15
|
-
* Augmentation Marketplace - Main class
|
|
16
|
-
*/
|
|
17
|
-
export class AugmentationMarketplace {
|
|
18
|
-
constructor(config = {}) {
|
|
19
|
-
this.installedCache = new Map();
|
|
20
|
-
this.cloudCache = new Map();
|
|
21
|
-
this.config = {
|
|
22
|
-
apiUrl: config.apiUrl || 'https://api.brain-cloud.soulcraft.com/v1',
|
|
23
|
-
apiKey: config.apiKey || process.env.BRAIN_CLOUD_API_KEY || '',
|
|
24
|
-
cacheDir: config.cacheDir || '.brainy/cache',
|
|
25
|
-
augmentationsDir: config.augmentationsDir || '.brainy/augmentations',
|
|
26
|
-
autoUpdate: config.autoUpdate ?? true,
|
|
27
|
-
checkInterval: config.checkInterval || 24 * 60 * 60 * 1000 // 24 hours
|
|
28
|
-
};
|
|
29
|
-
this.loadInstalledAugmentations();
|
|
30
|
-
if (this.config.autoUpdate) {
|
|
31
|
-
this.startUpdateChecker();
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Get all installed augmentations
|
|
36
|
-
*/
|
|
37
|
-
getInstalled() {
|
|
38
|
-
return Array.from(this.installedCache.values());
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Get available local augmentations (built-in)
|
|
42
|
-
*/
|
|
43
|
-
async getAvailableLocal() {
|
|
44
|
-
// Import and return built-in augmentations
|
|
45
|
-
const { createDefaultAugmentations } = await import('../defaultAugmentations.js');
|
|
46
|
-
const augmentations = createDefaultAugmentations();
|
|
47
|
-
return augmentations.map(aug => aug.getManifest());
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Search cloud registry
|
|
51
|
-
*/
|
|
52
|
-
async searchCloud(query = '', filters = {}, page = 1, limit = 20) {
|
|
53
|
-
const params = new URLSearchParams({
|
|
54
|
-
q: query,
|
|
55
|
-
page: page.toString(),
|
|
56
|
-
limit: limit.toString()
|
|
57
|
-
});
|
|
58
|
-
// Add filters
|
|
59
|
-
if (filters.category)
|
|
60
|
-
params.append('category', filters.category);
|
|
61
|
-
if (filters.tags)
|
|
62
|
-
filters.tags.forEach(tag => params.append('tag', tag));
|
|
63
|
-
if (filters.minRating)
|
|
64
|
-
params.append('minRating', filters.minRating.toString());
|
|
65
|
-
if (filters.free !== undefined)
|
|
66
|
-
params.append('free', filters.free.toString());
|
|
67
|
-
if (filters.verified !== undefined)
|
|
68
|
-
params.append('verified', filters.verified.toString());
|
|
69
|
-
if (filters.compatible !== undefined)
|
|
70
|
-
params.append('compatible', filters.compatible.toString());
|
|
71
|
-
const response = await fetch(`${this.config.apiUrl}/augmentations?${params}`, {
|
|
72
|
-
headers: {
|
|
73
|
-
'Authorization': `Bearer ${this.config.apiKey}`,
|
|
74
|
-
'Content-Type': 'application/json'
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
if (!response.ok) {
|
|
78
|
-
throw new Error(`Failed to search augmentations: ${response.statusText}`);
|
|
79
|
-
}
|
|
80
|
-
const data = await response.json();
|
|
81
|
-
// Cache results
|
|
82
|
-
data.results.forEach((aug) => {
|
|
83
|
-
this.cloudCache.set(aug.id, aug);
|
|
84
|
-
});
|
|
85
|
-
return data;
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* Get detailed information about a cloud augmentation
|
|
89
|
-
*/
|
|
90
|
-
async getCloudDetails(id) {
|
|
91
|
-
// Check cache first
|
|
92
|
-
if (this.cloudCache.has(id)) {
|
|
93
|
-
return this.cloudCache.get(id);
|
|
94
|
-
}
|
|
95
|
-
const response = await fetch(`${this.config.apiUrl}/augmentations/${id}`, {
|
|
96
|
-
headers: {
|
|
97
|
-
'Authorization': `Bearer ${this.config.apiKey}`,
|
|
98
|
-
'Content-Type': 'application/json'
|
|
99
|
-
}
|
|
100
|
-
});
|
|
101
|
-
if (!response.ok) {
|
|
102
|
-
throw new Error(`Failed to get augmentation details: ${response.statusText}`);
|
|
103
|
-
}
|
|
104
|
-
const augmentation = await response.json();
|
|
105
|
-
this.cloudCache.set(id, augmentation);
|
|
106
|
-
return augmentation;
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* Install augmentation from cloud
|
|
110
|
-
*/
|
|
111
|
-
async installFromCloud(id, options = {}) {
|
|
112
|
-
// Get augmentation details
|
|
113
|
-
const cloudAug = await this.getCloudDetails(id);
|
|
114
|
-
// Check compatibility
|
|
115
|
-
const brainyVersion = await this.getBrainyVersion();
|
|
116
|
-
if (!this.isCompatible(cloudAug, brainyVersion)) {
|
|
117
|
-
throw new Error(`Augmentation ${cloudAug.name} is not compatible with Brainy ${brainyVersion}`);
|
|
118
|
-
}
|
|
119
|
-
// Check if already installed
|
|
120
|
-
const existing = this.getInstalledByCloudId(id);
|
|
121
|
-
if (existing) {
|
|
122
|
-
throw new Error(`Augmentation ${cloudAug.name} is already installed`);
|
|
123
|
-
}
|
|
124
|
-
// Download augmentation package
|
|
125
|
-
const packageData = await this.downloadPackage(id);
|
|
126
|
-
// Extract and install
|
|
127
|
-
const installPath = await this.extractPackage(packageData, cloudAug);
|
|
128
|
-
// Create installation record
|
|
129
|
-
const installed = {
|
|
130
|
-
id: uuidv4(),
|
|
131
|
-
name: cloudAug.name,
|
|
132
|
-
version: options.version || cloudAug.version,
|
|
133
|
-
installedAt: new Date().toISOString(),
|
|
134
|
-
installedFrom: 'cloud',
|
|
135
|
-
cloudId: id,
|
|
136
|
-
enabled: options.enable ?? true,
|
|
137
|
-
autoUpdate: options.autoUpdate ?? this.config.autoUpdate,
|
|
138
|
-
config: options.config,
|
|
139
|
-
path: installPath
|
|
140
|
-
};
|
|
141
|
-
// Save installation info
|
|
142
|
-
this.installedCache.set(installed.id, installed);
|
|
143
|
-
await this.saveInstalledAugmentations();
|
|
144
|
-
// Load and initialize if enabled
|
|
145
|
-
if (installed.enabled) {
|
|
146
|
-
await this.loadAugmentation(installed);
|
|
147
|
-
}
|
|
148
|
-
return installed;
|
|
149
|
-
}
|
|
150
|
-
/**
|
|
151
|
-
* Install from local file
|
|
152
|
-
*/
|
|
153
|
-
async installFromFile(filePath, options = {}) {
|
|
154
|
-
// Implementation for installing from local .brainy-aug file
|
|
155
|
-
throw new Error('Not implemented yet');
|
|
156
|
-
}
|
|
157
|
-
/**
|
|
158
|
-
* Enable an installed augmentation
|
|
159
|
-
*/
|
|
160
|
-
async enable(name) {
|
|
161
|
-
const augmentation = this.getInstalledByName(name);
|
|
162
|
-
if (!augmentation) {
|
|
163
|
-
throw new Error(`Augmentation ${name} not found`);
|
|
164
|
-
}
|
|
165
|
-
augmentation.enabled = true;
|
|
166
|
-
await this.saveInstalledAugmentations();
|
|
167
|
-
await this.loadAugmentation(augmentation);
|
|
168
|
-
}
|
|
169
|
-
/**
|
|
170
|
-
* Disable an installed augmentation
|
|
171
|
-
*/
|
|
172
|
-
async disable(name) {
|
|
173
|
-
const augmentation = this.getInstalledByName(name);
|
|
174
|
-
if (!augmentation) {
|
|
175
|
-
throw new Error(`Augmentation ${name} not found`);
|
|
176
|
-
}
|
|
177
|
-
augmentation.enabled = false;
|
|
178
|
-
await this.saveInstalledAugmentations();
|
|
179
|
-
await this.unloadAugmentation(augmentation);
|
|
180
|
-
}
|
|
181
|
-
/**
|
|
182
|
-
* Uninstall an augmentation
|
|
183
|
-
*/
|
|
184
|
-
async uninstall(name) {
|
|
185
|
-
const augmentation = this.getInstalledByName(name);
|
|
186
|
-
if (!augmentation) {
|
|
187
|
-
throw new Error(`Augmentation ${name} not found`);
|
|
188
|
-
}
|
|
189
|
-
// Unload if loaded
|
|
190
|
-
if (augmentation.enabled) {
|
|
191
|
-
await this.unloadAugmentation(augmentation);
|
|
192
|
-
}
|
|
193
|
-
// Remove files
|
|
194
|
-
await this.removeAugmentationFiles(augmentation);
|
|
195
|
-
// Remove from cache
|
|
196
|
-
this.installedCache.delete(augmentation.id);
|
|
197
|
-
await this.saveInstalledAugmentations();
|
|
198
|
-
}
|
|
199
|
-
/**
|
|
200
|
-
* Update an augmentation
|
|
201
|
-
*/
|
|
202
|
-
async update(name) {
|
|
203
|
-
const augmentation = this.getInstalledByName(name);
|
|
204
|
-
if (!augmentation) {
|
|
205
|
-
throw new Error(`Augmentation ${name} not found`);
|
|
206
|
-
}
|
|
207
|
-
if (!augmentation.cloudId) {
|
|
208
|
-
throw new Error(`Augmentation ${name} was not installed from cloud`);
|
|
209
|
-
}
|
|
210
|
-
// Check for updates
|
|
211
|
-
const cloudAug = await this.getCloudDetails(augmentation.cloudId);
|
|
212
|
-
if (cloudAug.version === augmentation.version) {
|
|
213
|
-
throw new Error(`Augmentation ${name} is already up to date`);
|
|
214
|
-
}
|
|
215
|
-
// Uninstall old version
|
|
216
|
-
await this.uninstall(name);
|
|
217
|
-
// Install new version
|
|
218
|
-
await this.installFromCloud(augmentation.cloudId, {
|
|
219
|
-
enable: augmentation.enabled,
|
|
220
|
-
autoUpdate: augmentation.autoUpdate,
|
|
221
|
-
config: augmentation.config
|
|
222
|
-
});
|
|
223
|
-
}
|
|
224
|
-
/**
|
|
225
|
-
* Check for updates for all installed augmentations
|
|
226
|
-
*/
|
|
227
|
-
async checkForUpdates() {
|
|
228
|
-
const updates = [];
|
|
229
|
-
for (const augmentation of this.installedCache.values()) {
|
|
230
|
-
if (!augmentation.cloudId)
|
|
231
|
-
continue;
|
|
232
|
-
try {
|
|
233
|
-
const cloudAug = await this.getCloudDetails(augmentation.cloudId);
|
|
234
|
-
if (cloudAug.version !== augmentation.version) {
|
|
235
|
-
updates.push({
|
|
236
|
-
augmentation,
|
|
237
|
-
newVersion: cloudAug.version
|
|
238
|
-
});
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
catch (error) {
|
|
242
|
-
console.warn(`Failed to check updates for ${augmentation.name}:`, error);
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
return updates;
|
|
246
|
-
}
|
|
247
|
-
// Private helper methods
|
|
248
|
-
async getBrainyVersion() {
|
|
249
|
-
// Get Brainy version from package.json
|
|
250
|
-
try {
|
|
251
|
-
const packageJson = await import('../../../package.json');
|
|
252
|
-
return packageJson.version;
|
|
253
|
-
}
|
|
254
|
-
catch {
|
|
255
|
-
return '0.0.0';
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
isCompatible(augmentation, brainyVersion) {
|
|
259
|
-
// Simple version comparison - can be enhanced
|
|
260
|
-
return true; // TODO: Implement proper semver comparison
|
|
261
|
-
}
|
|
262
|
-
getInstalledByName(name) {
|
|
263
|
-
return Array.from(this.installedCache.values()).find(a => a.name === name);
|
|
264
|
-
}
|
|
265
|
-
getInstalledByCloudId(cloudId) {
|
|
266
|
-
return Array.from(this.installedCache.values()).find(a => a.cloudId === cloudId);
|
|
267
|
-
}
|
|
268
|
-
async downloadPackage(id) {
|
|
269
|
-
const response = await fetch(`${this.config.apiUrl}/augmentations/${id}/download`, {
|
|
270
|
-
headers: {
|
|
271
|
-
'Authorization': `Bearer ${this.config.apiKey}`
|
|
272
|
-
}
|
|
273
|
-
});
|
|
274
|
-
if (!response.ok) {
|
|
275
|
-
throw new Error(`Failed to download augmentation: ${response.statusText}`);
|
|
276
|
-
}
|
|
277
|
-
return response.arrayBuffer();
|
|
278
|
-
}
|
|
279
|
-
async extractPackage(packageData, cloudAug) {
|
|
280
|
-
// Extract package to augmentations directory
|
|
281
|
-
// This would use tar/zip extraction in real implementation
|
|
282
|
-
const installPath = `${this.config.augmentationsDir}/${cloudAug.name}-${cloudAug.version}`;
|
|
283
|
-
// TODO: Implement actual extraction
|
|
284
|
-
return installPath;
|
|
285
|
-
}
|
|
286
|
-
async loadAugmentation(augmentation) {
|
|
287
|
-
// Dynamically import and register the augmentation
|
|
288
|
-
// TODO: Implement dynamic loading
|
|
289
|
-
}
|
|
290
|
-
async unloadAugmentation(augmentation) {
|
|
291
|
-
// Unregister the augmentation from the system
|
|
292
|
-
// TODO: Implement unloading
|
|
293
|
-
}
|
|
294
|
-
async removeAugmentationFiles(augmentation) {
|
|
295
|
-
// Remove augmentation files from disk
|
|
296
|
-
// TODO: Implement file removal
|
|
297
|
-
}
|
|
298
|
-
async loadInstalledAugmentations() {
|
|
299
|
-
// Load installed augmentations from disk
|
|
300
|
-
// TODO: Implement loading from disk
|
|
301
|
-
}
|
|
302
|
-
async saveInstalledAugmentations() {
|
|
303
|
-
// Save installed augmentations to disk
|
|
304
|
-
// TODO: Implement saving to disk
|
|
305
|
-
}
|
|
306
|
-
startUpdateChecker() {
|
|
307
|
-
this.updateCheckTimer = setInterval(async () => {
|
|
308
|
-
try {
|
|
309
|
-
const updates = await this.checkForUpdates();
|
|
310
|
-
if (updates.length > 0) {
|
|
311
|
-
console.log(`Found ${updates.length} augmentation updates available`);
|
|
312
|
-
// Could emit an event or callback here
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
catch (error) {
|
|
316
|
-
console.warn('Failed to check for augmentation updates:', error);
|
|
317
|
-
}
|
|
318
|
-
}, this.config.checkInterval);
|
|
319
|
-
}
|
|
320
|
-
/**
|
|
321
|
-
* Cleanup resources
|
|
322
|
-
*/
|
|
323
|
-
destroy() {
|
|
324
|
-
if (this.updateCheckTimer) {
|
|
325
|
-
clearInterval(this.updateCheckTimer);
|
|
326
|
-
}
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
//# sourceMappingURL=AugmentationMarketplace.js.map
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Augmentation Marketplace CLI Commands
|
|
3
|
-
*
|
|
4
|
-
* Provides command-line interface for managing augmentations
|
|
5
|
-
* Similar to npm/yarn but for Brainy augmentations
|
|
6
|
-
*/
|
|
7
|
-
import { AugmentationMarketplace } from './AugmentationMarketplace.js';
|
|
8
|
-
/**
|
|
9
|
-
* List installed augmentations
|
|
10
|
-
*/
|
|
11
|
-
export declare function listCommand(marketplace: AugmentationMarketplace): Promise<void>;
|
|
12
|
-
/**
|
|
13
|
-
* Search cloud registry
|
|
14
|
-
*/
|
|
15
|
-
export declare function searchCommand(marketplace: AugmentationMarketplace, query: string, options?: {
|
|
16
|
-
category?: string;
|
|
17
|
-
free?: boolean;
|
|
18
|
-
limit?: number;
|
|
19
|
-
}): Promise<void>;
|
|
20
|
-
/**
|
|
21
|
-
* Show augmentation details
|
|
22
|
-
*/
|
|
23
|
-
export declare function infoCommand(marketplace: AugmentationMarketplace, nameOrId: string): Promise<void>;
|
|
24
|
-
/**
|
|
25
|
-
* Install augmentation
|
|
26
|
-
*/
|
|
27
|
-
export declare function installCommand(marketplace: AugmentationMarketplace, nameOrId: string, options?: {
|
|
28
|
-
version?: string;
|
|
29
|
-
noEnable?: boolean;
|
|
30
|
-
noAutoUpdate?: boolean;
|
|
31
|
-
}): Promise<void>;
|
|
32
|
-
/**
|
|
33
|
-
* Uninstall augmentation
|
|
34
|
-
*/
|
|
35
|
-
export declare function uninstallCommand(marketplace: AugmentationMarketplace, name: string): Promise<void>;
|
|
36
|
-
/**
|
|
37
|
-
* Enable augmentation
|
|
38
|
-
*/
|
|
39
|
-
export declare function enableCommand(marketplace: AugmentationMarketplace, name: string): Promise<void>;
|
|
40
|
-
/**
|
|
41
|
-
* Disable augmentation
|
|
42
|
-
*/
|
|
43
|
-
export declare function disableCommand(marketplace: AugmentationMarketplace, name: string): Promise<void>;
|
|
44
|
-
/**
|
|
45
|
-
* Update augmentation
|
|
46
|
-
*/
|
|
47
|
-
export declare function updateCommand(marketplace: AugmentationMarketplace, name?: string): Promise<void>;
|
|
@@ -1,265 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Augmentation Marketplace CLI Commands
|
|
3
|
-
*
|
|
4
|
-
* Provides command-line interface for managing augmentations
|
|
5
|
-
* Similar to npm/yarn but for Brainy augmentations
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* Format augmentation for display
|
|
9
|
-
*/
|
|
10
|
-
function formatAugmentation(aug) {
|
|
11
|
-
const price = aug.price ? `$${aug.price}` : 'Free';
|
|
12
|
-
const rating = 'ā'.repeat(Math.round(aug.rating));
|
|
13
|
-
return `
|
|
14
|
-
${aug.displayName} v${aug.version} by ${aug.author}
|
|
15
|
-
${aug.description}
|
|
16
|
-
Category: ${aug.category} | Price: ${price} | Rating: ${rating} (${aug.reviews} reviews)
|
|
17
|
-
Downloads: ${aug.downloads.toLocaleString()} | Size: ${formatBytes(aug.size)}
|
|
18
|
-
Tags: ${aug.tags.join(', ')}
|
|
19
|
-
`.trim();
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Format bytes to human readable
|
|
23
|
-
*/
|
|
24
|
-
function formatBytes(bytes) {
|
|
25
|
-
if (bytes < 1024)
|
|
26
|
-
return bytes + ' B';
|
|
27
|
-
if (bytes < 1024 * 1024)
|
|
28
|
-
return (bytes / 1024).toFixed(1) + ' KB';
|
|
29
|
-
if (bytes < 1024 * 1024 * 1024)
|
|
30
|
-
return (bytes / 1024 / 1024).toFixed(1) + ' MB';
|
|
31
|
-
return (bytes / 1024 / 1024 / 1024).toFixed(1) + ' GB';
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* List installed augmentations
|
|
35
|
-
*/
|
|
36
|
-
export async function listCommand(marketplace) {
|
|
37
|
-
const installed = marketplace.getInstalled();
|
|
38
|
-
if (installed.length === 0) {
|
|
39
|
-
console.log('No augmentations installed');
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
console.log('\nInstalled Augmentations:');
|
|
43
|
-
console.log('========================\n');
|
|
44
|
-
for (const aug of installed) {
|
|
45
|
-
const status = aug.enabled ? 'ā
Enabled' : 'ā Disabled';
|
|
46
|
-
const autoUpdate = aug.autoUpdate ? 'š' : '';
|
|
47
|
-
console.log(`${aug.name} v${aug.version} ${status} ${autoUpdate}`);
|
|
48
|
-
console.log(` Installed: ${new Date(aug.installedAt).toLocaleDateString()}`);
|
|
49
|
-
console.log(` From: ${aug.installedFrom}`);
|
|
50
|
-
if (aug.cloudId) {
|
|
51
|
-
console.log(` Cloud ID: ${aug.cloudId}`);
|
|
52
|
-
}
|
|
53
|
-
console.log('');
|
|
54
|
-
}
|
|
55
|
-
// Check for updates
|
|
56
|
-
console.log('Checking for updates...');
|
|
57
|
-
const updates = await marketplace.checkForUpdates();
|
|
58
|
-
if (updates.length > 0) {
|
|
59
|
-
console.log(`\nā ļø ${updates.length} update(s) available:`);
|
|
60
|
-
for (const update of updates) {
|
|
61
|
-
console.log(` ${update.augmentation.name}: ${update.augmentation.version} ā ${update.newVersion}`);
|
|
62
|
-
}
|
|
63
|
-
console.log('\nRun "brainy augment update <name>" to update');
|
|
64
|
-
}
|
|
65
|
-
else {
|
|
66
|
-
console.log('All augmentations are up to date āØ');
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Search cloud registry
|
|
71
|
-
*/
|
|
72
|
-
export async function searchCommand(marketplace, query, options = {}) {
|
|
73
|
-
console.log(`Searching for "${query}"...`);
|
|
74
|
-
const filters = {};
|
|
75
|
-
if (options.category)
|
|
76
|
-
filters.category = options.category;
|
|
77
|
-
if (options.free !== undefined)
|
|
78
|
-
filters.free = options.free;
|
|
79
|
-
const results = await marketplace.searchCloud(query, filters, 1, options.limit || 10);
|
|
80
|
-
if (results.total === 0) {
|
|
81
|
-
console.log('No augmentations found');
|
|
82
|
-
return;
|
|
83
|
-
}
|
|
84
|
-
console.log(`\nFound ${results.total} augmentation(s):`);
|
|
85
|
-
console.log('================================\n');
|
|
86
|
-
for (const aug of results.results) {
|
|
87
|
-
console.log(formatAugmentation(aug));
|
|
88
|
-
console.log('---');
|
|
89
|
-
}
|
|
90
|
-
if (results.pages > 1) {
|
|
91
|
-
console.log(`\nShowing page ${results.page} of ${results.pages}`);
|
|
92
|
-
console.log('Use --page flag to see more results');
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* Show augmentation details
|
|
97
|
-
*/
|
|
98
|
-
export async function infoCommand(marketplace, nameOrId) {
|
|
99
|
-
// Check if it's installed locally first
|
|
100
|
-
const installed = marketplace.getInstalled().find(a => a.name === nameOrId);
|
|
101
|
-
if (installed) {
|
|
102
|
-
console.log('\nš¦ Installed Augmentation:');
|
|
103
|
-
console.log('=========================\n');
|
|
104
|
-
console.log(`Name: ${installed.name}`);
|
|
105
|
-
console.log(`Version: ${installed.version}`);
|
|
106
|
-
console.log(`Status: ${installed.enabled ? 'Enabled' : 'Disabled'}`);
|
|
107
|
-
console.log(`Auto-update: ${installed.autoUpdate ? 'Yes' : 'No'}`);
|
|
108
|
-
console.log(`Installed: ${new Date(installed.installedAt).toLocaleString()}`);
|
|
109
|
-
console.log(`Path: ${installed.path}`);
|
|
110
|
-
if (installed.cloudId) {
|
|
111
|
-
console.log('\nFetching cloud details...');
|
|
112
|
-
try {
|
|
113
|
-
const cloudAug = await marketplace.getCloudDetails(installed.cloudId);
|
|
114
|
-
console.log('\n' + formatAugmentation(cloudAug));
|
|
115
|
-
if (cloudAug.documentationUrl) {
|
|
116
|
-
console.log(`\nš Documentation: ${cloudAug.documentationUrl}`);
|
|
117
|
-
}
|
|
118
|
-
if (cloudAug.repositoryUrl) {
|
|
119
|
-
console.log(`š¦ Repository: ${cloudAug.repositoryUrl}`);
|
|
120
|
-
}
|
|
121
|
-
if (cloudAug.supportUrl) {
|
|
122
|
-
console.log(`š Support: ${cloudAug.supportUrl}`);
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
catch (error) {
|
|
126
|
-
console.log('Could not fetch cloud details');
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
else {
|
|
131
|
-
// Try to find in cloud
|
|
132
|
-
try {
|
|
133
|
-
const cloudAug = await marketplace.getCloudDetails(nameOrId);
|
|
134
|
-
console.log('\nāļø Cloud Augmentation:');
|
|
135
|
-
console.log('=====================\n');
|
|
136
|
-
console.log(formatAugmentation(cloudAug));
|
|
137
|
-
if (cloudAug.longDescription) {
|
|
138
|
-
console.log(`\n${cloudAug.longDescription}`);
|
|
139
|
-
}
|
|
140
|
-
if (cloudAug.requirements.length > 0) {
|
|
141
|
-
console.log('\nš Requirements:');
|
|
142
|
-
cloudAug.requirements.forEach(req => console.log(` - ${req}`));
|
|
143
|
-
}
|
|
144
|
-
if (cloudAug.permissions.length > 0) {
|
|
145
|
-
console.log('\nš Permissions:');
|
|
146
|
-
cloudAug.permissions.forEach(perm => console.log(` - ${perm}`));
|
|
147
|
-
}
|
|
148
|
-
if (cloudAug.documentationUrl) {
|
|
149
|
-
console.log(`\nš Documentation: ${cloudAug.documentationUrl}`);
|
|
150
|
-
}
|
|
151
|
-
if (cloudAug.repositoryUrl) {
|
|
152
|
-
console.log(`š¦ Repository: ${cloudAug.repositoryUrl}`);
|
|
153
|
-
}
|
|
154
|
-
if (cloudAug.supportUrl) {
|
|
155
|
-
console.log(`š Support: ${cloudAug.supportUrl}`);
|
|
156
|
-
}
|
|
157
|
-
console.log('\nTo install, run: brainy augment install ' + nameOrId);
|
|
158
|
-
}
|
|
159
|
-
catch (error) {
|
|
160
|
-
console.error(`Augmentation "${nameOrId}" not found`);
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
/**
|
|
165
|
-
* Install augmentation
|
|
166
|
-
*/
|
|
167
|
-
export async function installCommand(marketplace, nameOrId, options = {}) {
|
|
168
|
-
console.log(`Installing ${nameOrId}...`);
|
|
169
|
-
try {
|
|
170
|
-
const installed = await marketplace.installFromCloud(nameOrId, {
|
|
171
|
-
version: options.version,
|
|
172
|
-
enable: !options.noEnable,
|
|
173
|
-
autoUpdate: !options.noAutoUpdate
|
|
174
|
-
});
|
|
175
|
-
console.log(`ā
Successfully installed ${installed.name} v${installed.version}`);
|
|
176
|
-
if (installed.enabled) {
|
|
177
|
-
console.log(' Augmentation is enabled and ready to use');
|
|
178
|
-
}
|
|
179
|
-
else {
|
|
180
|
-
console.log(' Run "brainy augment enable ' + installed.name + '" to enable');
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
catch (error) {
|
|
184
|
-
console.error(`ā Failed to install: ${error.message}`);
|
|
185
|
-
process.exit(1);
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
/**
|
|
189
|
-
* Uninstall augmentation
|
|
190
|
-
*/
|
|
191
|
-
export async function uninstallCommand(marketplace, name) {
|
|
192
|
-
console.log(`Uninstalling ${name}...`);
|
|
193
|
-
try {
|
|
194
|
-
await marketplace.uninstall(name);
|
|
195
|
-
console.log(`ā
Successfully uninstalled ${name}`);
|
|
196
|
-
}
|
|
197
|
-
catch (error) {
|
|
198
|
-
console.error(`ā Failed to uninstall: ${error.message}`);
|
|
199
|
-
process.exit(1);
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
/**
|
|
203
|
-
* Enable augmentation
|
|
204
|
-
*/
|
|
205
|
-
export async function enableCommand(marketplace, name) {
|
|
206
|
-
try {
|
|
207
|
-
await marketplace.enable(name);
|
|
208
|
-
console.log(`ā
Enabled ${name}`);
|
|
209
|
-
}
|
|
210
|
-
catch (error) {
|
|
211
|
-
console.error(`ā Failed to enable: ${error.message}`);
|
|
212
|
-
process.exit(1);
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
/**
|
|
216
|
-
* Disable augmentation
|
|
217
|
-
*/
|
|
218
|
-
export async function disableCommand(marketplace, name) {
|
|
219
|
-
try {
|
|
220
|
-
await marketplace.disable(name);
|
|
221
|
-
console.log(`ā
Disabled ${name}`);
|
|
222
|
-
}
|
|
223
|
-
catch (error) {
|
|
224
|
-
console.error(`ā Failed to disable: ${error.message}`);
|
|
225
|
-
process.exit(1);
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
/**
|
|
229
|
-
* Update augmentation
|
|
230
|
-
*/
|
|
231
|
-
export async function updateCommand(marketplace, name) {
|
|
232
|
-
if (name) {
|
|
233
|
-
// Update specific augmentation
|
|
234
|
-
console.log(`Updating ${name}...`);
|
|
235
|
-
try {
|
|
236
|
-
await marketplace.update(name);
|
|
237
|
-
console.log(`ā
Successfully updated ${name}`);
|
|
238
|
-
}
|
|
239
|
-
catch (error) {
|
|
240
|
-
console.error(`ā Failed to update: ${error.message}`);
|
|
241
|
-
process.exit(1);
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
else {
|
|
245
|
-
// Update all augmentations
|
|
246
|
-
console.log('Checking for updates...');
|
|
247
|
-
const updates = await marketplace.checkForUpdates();
|
|
248
|
-
if (updates.length === 0) {
|
|
249
|
-
console.log('All augmentations are up to date āØ');
|
|
250
|
-
return;
|
|
251
|
-
}
|
|
252
|
-
console.log(`Found ${updates.length} update(s)`);
|
|
253
|
-
for (const update of updates) {
|
|
254
|
-
console.log(`\nUpdating ${update.augmentation.name}: ${update.augmentation.version} ā ${update.newVersion}`);
|
|
255
|
-
try {
|
|
256
|
-
await marketplace.update(update.augmentation.name);
|
|
257
|
-
console.log(`ā
Updated successfully`);
|
|
258
|
-
}
|
|
259
|
-
catch (error) {
|
|
260
|
-
console.error(`ā Failed: ${error.message}`);
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
//# sourceMappingURL=cli.js.map
|