Skip to content

armgit / ruflo

Public Imported from GitHub
0

🌊 The original agent harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, federation, vector RAG integration, and native Claude Code / Codex / Hermes and many more Integrated

Checkpoint: File edits

rUvbb33929e93ae
diff --git a/v3/@claude-flow/cli/src/transfer/store/tests/standalone-test.ts b/v3/@claude-flow/cli/src/transfer/store/tests/standalone-test.ts
new file mode 100644
index 0000000000..0efb23297e
--- /dev/null
+++ b/v3/@claude-flow/cli/src/transfer/store/tests/standalone-test.ts
@@ -0,0 +1,206 @@
+#!/usr/bin/env npx tsx
+/**
+ * Standalone Pattern Store Test
+ * Run this in any environment to verify the IPFS-based pattern store works
+ *
+ * Usage:
+ * npx tsx standalone-test.ts
+ * # or
+ * npm run test:pattern-store
+ */
+
+import {
+ PatternStore,
+ createDiscoveryService,
+ searchPatterns,
+ getFeaturedPatterns,
+ getTrendingPatterns,
+ getNewestPatterns,
+ getCategoryStats,
+ getTagCloud,
+ getSearchSuggestions,
+ getSimilarPatterns,
+} from '../index.js';
+
+async function main() {
+ console.log('');
+ console.log('╔══════════════════════════════════════════════════════════════╗');
+ console.log('β•‘ CLAUDE FLOW V3 - STANDALONE PATTERN STORE TEST β•‘');
+ console.log('β•‘ IPFS-Based Decentralized Pattern Marketplace β•‘');
+ console.log('β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•');
+ console.log('');
+
+ let passed = 0;
+ let failed = 0;
+
+ // Test 1: Discovery Service Creation
+ console.log('β–Ά Test 1: Create Discovery Service');
+ try {
+ const discovery = createDiscoveryService();
+ const registries = discovery.listRegistries();
+ console.log(` βœ… Created service with ${registries.length} bootstrap registries`);
+ passed++;
+ } catch (e) {
+ console.log(` ❌ Failed: ${(e as Error).message}`);
+ failed++;
+ }
+
+ // Test 2: Discover Registry
+ console.log('β–Ά Test 2: Discover Registry via IPNS');
+ let registry: any = null;
+ try {
+ const discovery = createDiscoveryService();
+ const result = await discovery.discoverRegistry();
+ if (result.success && result.registry) {
+ registry = result.registry;
+ console.log(` βœ… Discovered ${result.registry.patterns.length} patterns from ${result.source}`);
+ passed++;
+ } else {
+ throw new Error(result.error || 'No registry');
+ }
+ } catch (e) {
+ console.log(` ❌ Failed: ${(e as Error).message}`);
+ failed++;
+ }
+
+ if (!registry) {
+ console.log('\n❌ Cannot continue without registry\n');
+ process.exit(1);
+ }
+
+ // Test 3: Search Patterns
+ console.log('β–Ά Test 3: Search for "agent"');
+ try {
+ const results = searchPatterns(registry, { query: 'agent' });
+ console.log(` βœ… Found ${results.patterns.length} patterns matching "agent"`);
+ passed++;
+ } catch (e) {
+ console.log(` ❌ Failed: ${(e as Error).message}`);
+ failed++;
+ }
+
+ // Test 4: Get Featured Patterns
+ console.log('β–Ά Test 4: Get Featured Patterns');
+ try {
+ const featured = getFeaturedPatterns(registry);
+ console.log(` βœ… Found ${featured.length} featured patterns`);
+ if (featured.length > 0) {
+ console.log(` - ${featured[0].name} (${featured[0].id})`);
+ }
+ passed++;
+ } catch (e) {
+ console.log(` ❌ Failed: ${(e as Error).message}`);
+ failed++;
+ }
+
+ // Test 5: Get Trending Patterns
+ console.log('β–Ά Test 5: Get Trending Patterns');
+ try {
+ const trending = getTrendingPatterns(registry);
+ console.log(` βœ… Found ${trending.length} trending patterns`);
+ passed++;
+ } catch (e) {
+ console.log(` ❌ Failed: ${(e as Error).message}`);
+ failed++;
+ }
+
+ // Test 6: Get Newest Patterns
+ console.log('β–Ά Test 6: Get Newest Patterns');
+ try {
+ const newest = getNewestPatterns(registry);
+ console.log(` βœ… Found ${newest.length} newest patterns`);
+ passed++;
+ } catch (e) {
+ console.log(` ❌ Failed: ${(e as Error).message}`);
+ failed++;
+ }
+
+ // Test 7: Search with Filters
+ console.log('β–Ά Test 7: Search with Filters (verified only)');
+ try {
+ const results = searchPatterns(registry, { verified: true });
+ console.log(` βœ… Found ${results.patterns.length} verified patterns`);
+ passed++;
+ } catch (e) {
+ console.log(` ❌ Failed: ${(e as Error).message}`);
+ failed++;
+ }
+
+ // Test 8: Category Stats
+ console.log('β–Ά Test 8: Get Category Statistics');
+ try {
+ const stats = getCategoryStats(registry);
+ console.log(` βœ… Found ${stats.length} categories with stats`);
+ passed++;
+ } catch (e) {
+ console.log(` ❌ Failed: ${(e as Error).message}`);
+ failed++;
+ }
+
+ // Test 9: Tag Cloud
+ console.log('β–Ά Test 9: Get Tag Cloud');
+ try {
+ const tags = getTagCloud(registry);
+ console.log(` βœ… Found ${tags.size} unique tags`);
+ passed++;
+ } catch (e) {
+ console.log(` ❌ Failed: ${(e as Error).message}`);
+ failed++;
+ }
+
+ // Test 10: Search Suggestions
+ console.log('β–Ά Test 10: Get Search Suggestions');
+ try {
+ const suggestions = getSearchSuggestions(registry, 'pat');
+ console.log(` βœ… Got ${suggestions.length} suggestions for "pat"`);
+ passed++;
+ } catch (e) {
+ console.log(` ❌ Failed: ${(e as Error).message}`);
+ failed++;
+ }
+
+ // Test 11: PatternStore Class
+ console.log('β–Ά Test 11: PatternStore Class API');
+ try {
+ const store = new PatternStore();
+ await store.initialize();
+ const stats = store.getStats();
+ console.log(` βœ… PatternStore initialized:`);
+ console.log(` Total Patterns: ${stats.totalPatterns}`);
+ console.log(` Total Downloads: ${stats.totalDownloads.toLocaleString()}`);
+ console.log(` Categories: ${stats.categories}`);
+ passed++;
+ } catch (e) {
+ console.log(` ❌ Failed: ${(e as Error).message}`);
+ failed++;
+ }
+
+ // Summary
+ console.log('');
+ console.log('═══════════════════════════════════════════════════════════════');
+ console.log(' TEST RESULTS ');
+ console.log('═══════════════════════════════════════════════════════════════');
+ console.log('');
+ console.log(` Total: ${passed + failed}`);
+ console.log(` βœ… Passed: ${passed}`);
+ console.log(` ❌ Failed: ${failed}`);
+ console.log('');
+
+ if (failed === 0) {
+ console.log(' πŸŽ‰ All tests passed! Pattern Store is working correctly.');
+ console.log('');
+ console.log(' Available CLI Commands:');
+ console.log(' npx @claude-flow/cli patterns list');
+ console.log(' npx @claude-flow/cli patterns list --featured');
+ console.log(' npx @claude-flow/cli patterns search -q "agent"');
+ console.log(' npx @claude-flow/cli patterns info -n <pattern-id>');
+ console.log('');
+ }
+
+ process.exit(failed > 0 ? 1 : 0);
+}
+
+main().catch(err => {
+ console.error('Fatal error:', err);
+ process.exit(1);
+});