@claude-flow/cli 3.0.0-alpha.55 → 3.0.0-alpha.57

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 (139) hide show
  1. package/.claude/settings.json +2 -2
  2. package/dist/src/commands/hooks.d.ts.map +1 -1
  3. package/dist/src/commands/hooks.js +45 -5
  4. package/dist/src/commands/hooks.js.map +1 -1
  5. package/dist/src/commands/init.d.ts.map +1 -1
  6. package/dist/src/commands/init.js +80 -9
  7. package/dist/src/commands/init.js.map +1 -1
  8. package/dist/src/commands/memory.d.ts.map +1 -1
  9. package/dist/src/commands/memory.js +221 -2
  10. package/dist/src/commands/memory.js.map +1 -1
  11. package/dist/src/commands/plugins.d.ts +1 -0
  12. package/dist/src/commands/plugins.d.ts.map +1 -1
  13. package/dist/src/commands/plugins.js +439 -89
  14. package/dist/src/commands/plugins.js.map +1 -1
  15. package/dist/src/commands/transfer-store.d.ts +13 -0
  16. package/dist/src/commands/transfer-store.d.ts.map +1 -0
  17. package/dist/src/commands/transfer-store.js +428 -0
  18. package/dist/src/commands/transfer-store.js.map +1 -0
  19. package/dist/src/init/mcp-generator.d.ts +9 -0
  20. package/dist/src/init/mcp-generator.d.ts.map +1 -1
  21. package/dist/src/init/mcp-generator.js +57 -28
  22. package/dist/src/init/mcp-generator.js.map +1 -1
  23. package/dist/src/init/settings-generator.d.ts.map +1 -1
  24. package/dist/src/init/settings-generator.js +4 -2
  25. package/dist/src/init/settings-generator.js.map +1 -1
  26. package/dist/src/mcp-tools/index.d.ts +1 -0
  27. package/dist/src/mcp-tools/index.d.ts.map +1 -1
  28. package/dist/src/mcp-tools/index.js +1 -0
  29. package/dist/src/mcp-tools/index.js.map +1 -1
  30. package/dist/src/mcp-tools/transfer-tools.d.ts +14 -0
  31. package/dist/src/mcp-tools/transfer-tools.d.ts.map +1 -0
  32. package/dist/src/mcp-tools/transfer-tools.js +396 -0
  33. package/dist/src/mcp-tools/transfer-tools.js.map +1 -0
  34. package/dist/src/plugins/store/discovery.d.ts +73 -0
  35. package/dist/src/plugins/store/discovery.d.ts.map +1 -0
  36. package/dist/src/plugins/store/discovery.js +568 -0
  37. package/dist/src/plugins/store/discovery.js.map +1 -0
  38. package/dist/src/plugins/store/index.d.ts +76 -0
  39. package/dist/src/plugins/store/index.d.ts.map +1 -0
  40. package/dist/src/plugins/store/index.js +141 -0
  41. package/dist/src/plugins/store/index.js.map +1 -0
  42. package/dist/src/plugins/store/search.d.ts +46 -0
  43. package/dist/src/plugins/store/search.d.ts.map +1 -0
  44. package/dist/src/plugins/store/search.js +230 -0
  45. package/dist/src/plugins/store/search.js.map +1 -0
  46. package/dist/src/plugins/store/types.d.ts +274 -0
  47. package/dist/src/plugins/store/types.d.ts.map +1 -0
  48. package/dist/src/plugins/store/types.js +7 -0
  49. package/dist/src/plugins/store/types.js.map +1 -0
  50. package/dist/src/plugins/tests/demo-plugin-store.d.ts +7 -0
  51. package/dist/src/plugins/tests/demo-plugin-store.d.ts.map +1 -0
  52. package/dist/src/plugins/tests/demo-plugin-store.js +126 -0
  53. package/dist/src/plugins/tests/demo-plugin-store.js.map +1 -0
  54. package/dist/src/plugins/tests/standalone-test.d.ts +12 -0
  55. package/dist/src/plugins/tests/standalone-test.d.ts.map +1 -0
  56. package/dist/src/plugins/tests/standalone-test.js +188 -0
  57. package/dist/src/plugins/tests/standalone-test.js.map +1 -0
  58. package/dist/src/plugins/tests/test-plugin-store.d.ts +7 -0
  59. package/dist/src/plugins/tests/test-plugin-store.d.ts.map +1 -0
  60. package/dist/src/plugins/tests/test-plugin-store.js +206 -0
  61. package/dist/src/plugins/tests/test-plugin-store.js.map +1 -0
  62. package/dist/src/transfer/anonymization/index.d.ts +25 -0
  63. package/dist/src/transfer/anonymization/index.d.ts.map +1 -0
  64. package/dist/src/transfer/anonymization/index.js +175 -0
  65. package/dist/src/transfer/anonymization/index.js.map +1 -0
  66. package/dist/src/transfer/deploy-seraphine.d.ts +13 -0
  67. package/dist/src/transfer/deploy-seraphine.d.ts.map +1 -0
  68. package/dist/src/transfer/deploy-seraphine.js +205 -0
  69. package/dist/src/transfer/deploy-seraphine.js.map +1 -0
  70. package/dist/src/transfer/export.d.ts +25 -0
  71. package/dist/src/transfer/export.d.ts.map +1 -0
  72. package/dist/src/transfer/export.js +113 -0
  73. package/dist/src/transfer/export.js.map +1 -0
  74. package/dist/src/transfer/index.d.ts +12 -0
  75. package/dist/src/transfer/index.d.ts.map +1 -0
  76. package/dist/src/transfer/index.js +31 -0
  77. package/dist/src/transfer/index.js.map +1 -0
  78. package/dist/src/transfer/ipfs/client.d.ts +31 -0
  79. package/dist/src/transfer/ipfs/client.d.ts.map +1 -0
  80. package/dist/src/transfer/ipfs/client.js +74 -0
  81. package/dist/src/transfer/ipfs/client.js.map +1 -0
  82. package/dist/src/transfer/ipfs/upload.d.ts +85 -0
  83. package/dist/src/transfer/ipfs/upload.d.ts.map +1 -0
  84. package/dist/src/transfer/ipfs/upload.js +319 -0
  85. package/dist/src/transfer/ipfs/upload.js.map +1 -0
  86. package/dist/src/transfer/models/seraphine.d.ts +72 -0
  87. package/dist/src/transfer/models/seraphine.d.ts.map +1 -0
  88. package/dist/src/transfer/models/seraphine.js +373 -0
  89. package/dist/src/transfer/models/seraphine.js.map +1 -0
  90. package/dist/src/transfer/serialization/cfp.d.ts +49 -0
  91. package/dist/src/transfer/serialization/cfp.d.ts.map +1 -0
  92. package/dist/src/transfer/serialization/cfp.js +180 -0
  93. package/dist/src/transfer/serialization/cfp.js.map +1 -0
  94. package/dist/src/transfer/store/discovery.d.ts +84 -0
  95. package/dist/src/transfer/store/discovery.d.ts.map +1 -0
  96. package/dist/src/transfer/store/discovery.js +275 -0
  97. package/dist/src/transfer/store/discovery.js.map +1 -0
  98. package/dist/src/transfer/store/download.d.ts +70 -0
  99. package/dist/src/transfer/store/download.d.ts.map +1 -0
  100. package/dist/src/transfer/store/download.js +295 -0
  101. package/dist/src/transfer/store/download.js.map +1 -0
  102. package/dist/src/transfer/store/index.d.ts +84 -0
  103. package/dist/src/transfer/store/index.d.ts.map +1 -0
  104. package/dist/src/transfer/store/index.js +153 -0
  105. package/dist/src/transfer/store/index.js.map +1 -0
  106. package/dist/src/transfer/store/publish.d.ts +76 -0
  107. package/dist/src/transfer/store/publish.d.ts.map +1 -0
  108. package/dist/src/transfer/store/publish.js +262 -0
  109. package/dist/src/transfer/store/publish.js.map +1 -0
  110. package/dist/src/transfer/store/registry.d.ts +58 -0
  111. package/dist/src/transfer/store/registry.d.ts.map +1 -0
  112. package/dist/src/transfer/store/registry.js +285 -0
  113. package/dist/src/transfer/store/registry.js.map +1 -0
  114. package/dist/src/transfer/store/search.d.ts +54 -0
  115. package/dist/src/transfer/store/search.d.ts.map +1 -0
  116. package/dist/src/transfer/store/search.js +232 -0
  117. package/dist/src/transfer/store/search.js.map +1 -0
  118. package/dist/src/transfer/store/tests/standalone-test.d.ts +12 -0
  119. package/dist/src/transfer/store/tests/standalone-test.d.ts.map +1 -0
  120. package/dist/src/transfer/store/tests/standalone-test.js +190 -0
  121. package/dist/src/transfer/store/tests/standalone-test.js.map +1 -0
  122. package/dist/src/transfer/store/types.d.ts +193 -0
  123. package/dist/src/transfer/store/types.d.ts.map +1 -0
  124. package/dist/src/transfer/store/types.js +6 -0
  125. package/dist/src/transfer/store/types.js.map +1 -0
  126. package/dist/src/transfer/test-seraphine.d.ts +6 -0
  127. package/dist/src/transfer/test-seraphine.d.ts.map +1 -0
  128. package/dist/src/transfer/test-seraphine.js +105 -0
  129. package/dist/src/transfer/test-seraphine.js.map +1 -0
  130. package/dist/src/transfer/tests/test-store.d.ts +7 -0
  131. package/dist/src/transfer/tests/test-store.d.ts.map +1 -0
  132. package/dist/src/transfer/tests/test-store.js +214 -0
  133. package/dist/src/transfer/tests/test-store.js.map +1 -0
  134. package/dist/src/transfer/types.d.ts +245 -0
  135. package/dist/src/transfer/types.d.ts.map +1 -0
  136. package/dist/src/transfer/types.js +6 -0
  137. package/dist/src/transfer/types.js.map +1 -0
  138. package/dist/tsconfig.tsbuildinfo +1 -1
  139. package/package.json +3 -1
@@ -0,0 +1,295 @@
1
+ /**
2
+ * Pattern Download Service
3
+ * Secure download and verification of patterns from IPFS
4
+ */
5
+ import * as fs from 'fs';
6
+ import * as path from 'path';
7
+ import * as crypto from 'crypto';
8
+ import { DEFAULT_STORE_CONFIG } from './registry.js';
9
+ /**
10
+ * Pattern Downloader
11
+ * Handles secure download and verification of patterns
12
+ */
13
+ export class PatternDownloader {
14
+ config;
15
+ downloadCache;
16
+ constructor(config = {}) {
17
+ this.config = { ...DEFAULT_STORE_CONFIG, ...config };
18
+ this.downloadCache = new Map();
19
+ }
20
+ /**
21
+ * Download a pattern from IPFS
22
+ */
23
+ async downloadPattern(pattern, options = {}, onProgress) {
24
+ console.log(`[Download] Starting download: ${pattern.displayName}`);
25
+ console.log(`[Download] CID: ${pattern.cid}`);
26
+ console.log(`[Download] Size: ${pattern.size} bytes`);
27
+ // Check cache
28
+ const cached = this.downloadCache.get(pattern.cid);
29
+ if (cached && fs.existsSync(cached.path)) {
30
+ console.log(`[Download] Found in cache: ${cached.path}`);
31
+ return {
32
+ success: true,
33
+ pattern,
34
+ outputPath: cached.path,
35
+ imported: false,
36
+ verified: true,
37
+ size: pattern.size,
38
+ };
39
+ }
40
+ try {
41
+ // Determine output path
42
+ const outputPath = this.resolveOutputPath(pattern, options);
43
+ console.log(`[Download] Output path: ${outputPath}`);
44
+ // Ensure directory exists
45
+ const outputDir = path.dirname(outputPath);
46
+ if (!fs.existsSync(outputDir)) {
47
+ fs.mkdirSync(outputDir, { recursive: true });
48
+ }
49
+ // Fetch from IPFS
50
+ const content = await this.fetchFromIPFS(pattern.cid, onProgress);
51
+ if (!content) {
52
+ return {
53
+ success: false,
54
+ pattern,
55
+ verified: false,
56
+ size: 0,
57
+ };
58
+ }
59
+ // Verify checksum
60
+ let verified = false;
61
+ if (options.verify !== false) {
62
+ verified = this.verifyChecksum(content, pattern.checksum);
63
+ if (!verified) {
64
+ console.warn(`[Download] Warning: Checksum verification failed!`);
65
+ if (this.config.requireVerification) {
66
+ return {
67
+ success: false,
68
+ pattern,
69
+ verified: false,
70
+ size: content.length,
71
+ };
72
+ }
73
+ }
74
+ else {
75
+ console.log(`[Download] Checksum verified!`);
76
+ }
77
+ }
78
+ // Verify signature if available
79
+ if (pattern.signature && pattern.publicKey) {
80
+ const sigVerified = this.verifySignature(content, pattern.signature, pattern.publicKey);
81
+ if (!sigVerified) {
82
+ console.warn(`[Download] Warning: Signature verification failed!`);
83
+ }
84
+ else {
85
+ console.log(`[Download] Signature verified!`);
86
+ }
87
+ }
88
+ // Write to file
89
+ fs.writeFileSync(outputPath, content);
90
+ console.log(`[Download] Written to: ${outputPath}`);
91
+ // Update cache
92
+ this.downloadCache.set(pattern.cid, {
93
+ path: outputPath,
94
+ downloadedAt: Date.now(),
95
+ });
96
+ // Import if requested
97
+ let imported = false;
98
+ if (options.import) {
99
+ imported = await this.importPattern(outputPath, options.importStrategy);
100
+ }
101
+ return {
102
+ success: true,
103
+ pattern,
104
+ outputPath,
105
+ imported,
106
+ verified,
107
+ size: content.length,
108
+ };
109
+ }
110
+ catch (error) {
111
+ console.error(`[Download] Failed:`, error);
112
+ return {
113
+ success: false,
114
+ pattern,
115
+ verified: false,
116
+ size: 0,
117
+ };
118
+ }
119
+ }
120
+ /**
121
+ * Fetch content from IPFS gateway
122
+ */
123
+ async fetchFromIPFS(cid, onProgress) {
124
+ const url = `${this.config.gateway}/ipfs/${cid}`;
125
+ console.log(`[Download] Fetching: ${url}`);
126
+ try {
127
+ // In production: Actual HTTP fetch with progress
128
+ // For demo: Generate mock content
129
+ const mockContent = this.generateMockContent(cid);
130
+ // Simulate progress
131
+ if (onProgress) {
132
+ const totalBytes = mockContent.length;
133
+ let downloaded = 0;
134
+ const chunkSize = Math.ceil(totalBytes / 10);
135
+ for (let i = 0; i < 10; i++) {
136
+ downloaded = Math.min(downloaded + chunkSize, totalBytes);
137
+ onProgress({
138
+ bytesDownloaded: downloaded,
139
+ totalBytes,
140
+ percentage: Math.round((downloaded / totalBytes) * 100),
141
+ });
142
+ // Small delay to simulate network
143
+ await new Promise(resolve => setTimeout(resolve, 50));
144
+ }
145
+ }
146
+ return mockContent;
147
+ }
148
+ catch (error) {
149
+ console.error(`[Download] Fetch failed:`, error);
150
+ return null;
151
+ }
152
+ }
153
+ /**
154
+ * Verify content checksum
155
+ */
156
+ verifyChecksum(content, expectedChecksum) {
157
+ const actualChecksum = crypto
158
+ .createHash('sha256')
159
+ .update(content)
160
+ .digest('hex');
161
+ return actualChecksum === expectedChecksum;
162
+ }
163
+ /**
164
+ * Verify content signature
165
+ */
166
+ verifySignature(content, signature, publicKey) {
167
+ // In production: Use actual Ed25519 verification
168
+ // For demo: Check signature format
169
+ return signature.startsWith('ed25519:') && publicKey.startsWith('ed25519:');
170
+ }
171
+ /**
172
+ * Resolve output path for pattern
173
+ */
174
+ resolveOutputPath(pattern, options) {
175
+ if (options.output) {
176
+ // If output is a directory, append filename
177
+ if (fs.existsSync(options.output) && fs.statSync(options.output).isDirectory()) {
178
+ return path.join(options.output, `${pattern.name}.cfp.json`);
179
+ }
180
+ return options.output;
181
+ }
182
+ // Default: cache directory
183
+ const cacheDir = path.resolve(this.config.cacheDir);
184
+ return path.join(cacheDir, `${pattern.name}-${pattern.version}.cfp.json`);
185
+ }
186
+ /**
187
+ * Import downloaded pattern
188
+ */
189
+ async importPattern(filePath, strategy = 'merge') {
190
+ console.log(`[Download] Importing pattern with strategy: ${strategy}`);
191
+ try {
192
+ const content = fs.readFileSync(filePath, 'utf-8');
193
+ const cfp = JSON.parse(content);
194
+ // In production: Import to local pattern store
195
+ // For demo: Just validate
196
+ if (cfp.magic !== 'CFP1') {
197
+ console.error(`[Download] Invalid CFP format`);
198
+ return false;
199
+ }
200
+ console.log(`[Download] Pattern imported: ${cfp.metadata.name}`);
201
+ return true;
202
+ }
203
+ catch (error) {
204
+ console.error(`[Download] Import failed:`, error);
205
+ return false;
206
+ }
207
+ }
208
+ /**
209
+ * Generate mock content for demo
210
+ */
211
+ generateMockContent(cid) {
212
+ const mockCFP = {
213
+ magic: 'CFP1',
214
+ version: '1.0.0',
215
+ createdAt: new Date().toISOString(),
216
+ generatedBy: 'claude-flow@3.0.0',
217
+ metadata: {
218
+ id: cid,
219
+ name: 'downloaded-pattern',
220
+ description: 'A downloaded pattern from IPFS',
221
+ author: { id: 'unknown', verified: false },
222
+ license: 'MIT',
223
+ tags: ['downloaded'],
224
+ createdAt: new Date().toISOString(),
225
+ updatedAt: new Date().toISOString(),
226
+ },
227
+ anonymization: {
228
+ level: 'standard',
229
+ appliedTransforms: [],
230
+ piiRedacted: false,
231
+ pathsStripped: false,
232
+ timestampsGeneralized: false,
233
+ checksum: crypto.createHash('sha256').update(cid).digest('hex'),
234
+ },
235
+ patterns: {
236
+ routing: [],
237
+ complexity: [],
238
+ coverage: [],
239
+ trajectory: [],
240
+ custom: [],
241
+ },
242
+ statistics: {
243
+ totalPatterns: 0,
244
+ avgConfidence: 0,
245
+ patternTypes: {},
246
+ timeRange: {
247
+ start: new Date().toISOString(),
248
+ end: new Date().toISOString(),
249
+ },
250
+ },
251
+ };
252
+ return Buffer.from(JSON.stringify(mockCFP, null, 2));
253
+ }
254
+ /**
255
+ * Clear download cache
256
+ */
257
+ clearCache() {
258
+ this.downloadCache.clear();
259
+ console.log(`[Download] Cache cleared`);
260
+ }
261
+ /**
262
+ * Get cache statistics
263
+ */
264
+ getCacheStats() {
265
+ let totalSize = 0;
266
+ for (const { path: cachedPath } of this.downloadCache.values()) {
267
+ if (fs.existsSync(cachedPath)) {
268
+ totalSize += fs.statSync(cachedPath).size;
269
+ }
270
+ }
271
+ return {
272
+ count: this.downloadCache.size,
273
+ totalSize,
274
+ };
275
+ }
276
+ }
277
+ /**
278
+ * Batch download multiple patterns
279
+ */
280
+ export async function batchDownload(patterns, options = {}, config) {
281
+ const downloader = new PatternDownloader(config);
282
+ const results = [];
283
+ for (const pattern of patterns) {
284
+ const result = await downloader.downloadPattern(pattern, options);
285
+ results.push(result);
286
+ }
287
+ return results;
288
+ }
289
+ /**
290
+ * Create downloader with default config
291
+ */
292
+ export function createDownloader(config) {
293
+ return new PatternDownloader(config);
294
+ }
295
+ //# sourceMappingURL=download.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"download.js","sourceRoot":"","sources":["../../../../src/transfer/store/download.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AAOjC,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAYrD;;;GAGG;AACH,MAAM,OAAO,iBAAiB;IACpB,MAAM,CAAc;IACpB,aAAa,CAAsD;IAE3E,YAAY,SAA+B,EAAE;QAC3C,IAAI,CAAC,MAAM,GAAG,EAAE,GAAG,oBAAoB,EAAE,GAAG,MAAM,EAAE,CAAC;QACrD,IAAI,CAAC,aAAa,GAAG,IAAI,GAAG,EAAE,CAAC;IACjC,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,eAAe,CACnB,OAAqB,EACrB,UAA2B,EAAE,EAC7B,UAAqC;QAErC,OAAO,CAAC,GAAG,CAAC,iCAAiC,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC;QACpE,OAAO,CAAC,GAAG,CAAC,mBAAmB,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;QAC9C,OAAO,CAAC,GAAG,CAAC,oBAAoB,OAAO,CAAC,IAAI,QAAQ,CAAC,CAAC;QAEtD,cAAc;QACd,MAAM,MAAM,GAAG,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACnD,IAAI,MAAM,IAAI,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;YACzC,OAAO,CAAC,GAAG,C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,CAAC;YAC/D,IAAI,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;gBAC9B,SAAS,IAAI,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC;YAC5C,CAAC;QACH,CAAC;QAED,OAAO;YACL,KAAK,EAAE,IAAI,CAAC,aAAa,CAAC,IAAI;YAC9B,SAAS;SACV,CAAC;IACJ,CAAC;CACF;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,QAAwB,EACxB,UAA2B,EAAE,EAC7B,MAA6B;IAE7B,MAAM,UAAU,GAAG,IAAI,iBAAiB,CAAC,MAAM,CAAC,CAAC;IACjD,MAAM,OAAO,GAAqB,EAAE,CAAC;IAErC,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;QAC/B,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,eAAe,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAClE,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACvB,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAC,MAA6B;IAC5D,OAAO,IAAI,iBAAiB,CAAC,MAAM,CAAC,CAAC;AACvC,CAAC"}
@@ -0,0 +1,84 @@
1
+ /**
2
+ * Pattern Store Module
3
+ * Decentralized pattern marketplace using IPFS
4
+ */
5
+ export type { PatternEntry, PatternAuthor, PatternCategory, PatternRegistry, SearchOptions, SearchResult, PublishOptions, PublishResult, DownloadOptions, DownloadResult, KnownRegistry, StoreConfig, RatingSubmission, } from './types.js';
6
+ export { REGISTRY_VERSION, BOOTSTRAP_REGISTRIES, DEFAULT_STORE_CONFIG, createRegistry, getDefaultCategories, addPatternToRegistry, removePatternFromRegistry, serializeRegistry, deserializeRegistry, signRegistry, verifyRegistrySignature, mergeRegistries, generatePatternId, } from './registry.js';
7
+ export type { DiscoveryResult, IPNSResolution } from './discovery.js';
8
+ export { PatternDiscovery, createDiscoveryService } from './discovery.js';
9
+ export { searchPatterns, getFeaturedPatterns, getTrendingPatterns, getNewestPatterns, getPatternById, getPatternByName, getPatternsByAuthor, getPatternsByCategory, getSimilarPatterns, getCategoryStats, getTagCloud, getSearchSuggestions, } from './search.js';
10
+ export type { DownloadProgressCallback } from './download.js';
11
+ export { PatternDownloader, batchDownload, createDownloader, } from './download.js';
12
+ export type { ContributionRequest } from './publish.js';
13
+ export { PatternPublisher, submitContribution, checkContributionStatus, createPublisher, quickPublish, } from './publish.js';
14
+ import type { SearchOptions, SearchResult, DownloadOptions, DownloadResult, PublishOptions, PublishResult, PatternEntry, PatternCategory, KnownRegistry, StoreConfig } from './types.js';
15
+ import type { CFPFormat } from '../types.js';
16
+ /**
17
+ * Pattern Store - High-level API
18
+ */
19
+ export declare class PatternStore {
20
+ private discovery;
21
+ private downloader;
22
+ private publisher;
23
+ private registry;
24
+ private config;
25
+ constructor(config?: Partial<StoreConfig>);
26
+ /**
27
+ * Initialize store and load registry
28
+ */
29
+ initialize(registryName?: string): Promise<boolean>;
30
+ /**
31
+ * Search patterns
32
+ */
33
+ search(options?: SearchOptions): SearchResult;
34
+ /**
35
+ * Get pattern by ID
36
+ */
37
+ getPattern(patternId: string): PatternEntry | undefined;
38
+ /**
39
+ * Download pattern
40
+ */
41
+ download(patternId: string, options?: DownloadOptions): Promise<DownloadResult>;
42
+ /**
43
+ * Publish pattern
44
+ */
45
+ publish(cfp: CFPFormat, options: PublishOptions): Promise<PublishResult>;
46
+ /**
47
+ * Get featured patterns
48
+ */
49
+ getFeatured(): PatternEntry[];
50
+ /**
51
+ * Get trending patterns
52
+ */
53
+ getTrending(): PatternEntry[];
54
+ /**
55
+ * Get newest patterns
56
+ */
57
+ getNewest(): PatternEntry[];
58
+ /**
59
+ * Get categories
60
+ */
61
+ getCategories(): PatternCategory[];
62
+ /**
63
+ * Get available registries
64
+ */
65
+ getRegistries(): KnownRegistry[];
66
+ /**
67
+ * Refresh registry
68
+ */
69
+ refresh(): Promise<boolean>;
70
+ /**
71
+ * Get store statistics
72
+ */
73
+ getStats(): {
74
+ totalPatterns: number;
75
+ totalDownloads: number;
76
+ totalAuthors: number;
77
+ categories: number;
78
+ };
79
+ }
80
+ /**
81
+ * Create pattern store instance
82
+ */
83
+ export declare function createPatternStore(config?: Partial<StoreConfig>): PatternStore;
84
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/transfer/store/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,YAAY,EACV,YAAY,EACZ,aAAa,EACb,eAAe,EACf,eAAe,EACf,aAAa,EACb,YAAY,EACZ,cAAc,EACd,aAAa,EACb,eAAe,EACf,cAAc,EACd,aAAa,EACb,WAAW,EACX,gBAAgB,GACjB,MAAM,YAAY,CAAC;AAGpB,OAAO,EACL,gBAAgB,EAChB,oBAAoB,EACpB,oBAAoB,EACpB,cAAc,EACd,oBAAoB,EACpB,oBAAoB,EACpB,yBAAyB,EACzB,iBAAiB,EACjB,mBAAmB,EACnB,YAAY,EACZ,uBAAuB,EACvB,eAAe,EACf,iBAAiB,GAClB,MAAM,eAAe,CAAC;AAGvB,YAAY,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACtE,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAG1E,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,mBAAmB,EACnB,iBAAiB,EACjB,cAAc,EACd,gBAAgB,EAChB,mBAAmB,EACnB,qBAAqB,EACrB,kBAAkB,EAClB,gBAAgB,EAChB,WAAW,EACX,oBAAoB,GACrB,MAAM,aAAa,CAAC;AAGrB,YAAY,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAC;AAC9D,OAAO,EACL,iBAAiB,EACjB,aAAa,EACb,gBAAgB,GACjB,MAAM,eAAe,CAAC;AAGvB,Y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,aAAa,EAAE;IAKhC;;OAEG;IACG,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC;IAOjC;;OAEG;IACH,QAAQ,IAAI;QACV,aAAa,EAAE,MAAM,CAAC;QACtB,cAAc,EAAE,MAAM,CAAC;QACvB,YAAY,EAAE,MAAM,CAAC;QACrB,UAAU,EAAE,MAAM,CAAC;KACpB;CAWF;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,GAC5B,YAAY,CAEd"}
@@ -0,0 +1,153 @@
1
+ /**
2
+ * Pattern Store Module
3
+ * Decentralized pattern marketplace using IPFS
4
+ */
5
+ // Registry
6
+ export { REGISTRY_VERSION, BOOTSTRAP_REGISTRIES, DEFAULT_STORE_CONFIG, createRegistry, getDefaultCategories, addPatternToRegistry, removePatternFromRegistry, serializeRegistry, deserializeRegistry, signRegistry, verifyRegistrySignature, mergeRegistries, generatePatternId, } from './registry.js';
7
+ export { PatternDiscovery, createDiscoveryService } from './discovery.js';
8
+ // Search
9
+ export { searchPatterns, getFeaturedPatterns, getTrendingPatterns, getNewestPatterns, getPatternById, getPatternByName, getPatternsByAuthor, getPatternsByCategory, getSimilarPatterns, getCategoryStats, getTagCloud, getSearchSuggestions, } from './search.js';
10
+ export { PatternDownloader, batchDownload, createDownloader, } from './download.js';
11
+ export { PatternPublisher, submitContribution, checkContributionStatus, createPublisher, quickPublish, } from './publish.js';
12
+ import { searchPatterns as doSearchPatterns, getFeaturedPatterns as doGetFeaturedPatterns, getTrendingPatterns as doGetTrendingPatterns, getNewestPatterns as doGetNewestPatterns, } from './search.js';
13
+ /**
14
+ * Pattern Store - High-level API
15
+ */
16
+ export class PatternStore {
17
+ discovery = null;
18
+ downloader = null;
19
+ publisher = null;
20
+ registry = null;
21
+ config;
22
+ constructor(config = {}) {
23
+ this.config = config;
24
+ }
25
+ /**
26
+ * Initialize store and load registry
27
+ */
28
+ async initialize(registryName) {
29
+ // Dynamic imports to avoid ESM/CommonJS issues
30
+ const { PatternDiscovery } = await import('./discovery.js');
31
+ const { PatternDownloader } = await import('./download.js');
32
+ const { PatternPublisher } = await import('./publish.js');
33
+ this.discovery = new PatternDiscovery(this.config);
34
+ this.downloader = new PatternDownloader(this.config);
35
+ this.publisher = new PatternPublisher(this.config);
36
+ const result = await this.discovery.discoverRegistry(registryName);
37
+ if (result.success && result.registry) {
38
+ this.registry = result.registry;
39
+ return true;
40
+ }
41
+ return false;
42
+ }
43
+ /**
44
+ * Search patterns
45
+ */
46
+ search(options = {}) {
47
+ if (!this.registry) {
48
+ throw new Error('Store not initialized. Call initialize() first.');
49
+ }
50
+ return doSearchPatterns(this.registry, options);
51
+ }
52
+ /**
53
+ * Get pattern by ID
54
+ */
55
+ getPattern(patternId) {
56
+ if (!this.registry) {
57
+ throw new Error('Store not initialized. Call initialize() first.');
58
+ }
59
+ return this.registry.patterns.find(p => p.id === patternId);
60
+ }
61
+ /**
62
+ * Download pattern
63
+ */
64
+ async download(patternId, options = {}) {
65
+ const pattern = this.getPattern(patternId);
66
+ if (!pattern) {
67
+ throw new Error(`Pattern not found: ${patternId}`);
68
+ }
69
+ if (!this.downloader) {
70
+ throw new Error('Store not initialized. Call initialize() first.');
71
+ }
72
+ return this.downloader.downloadPattern(pattern, options);
73
+ }
74
+ /**
75
+ * Publish pattern
76
+ */
77
+ async publish(cfp, options) {
78
+ if (!this.publisher) {
79
+ throw new Error('Store not initialized. Call initialize() first.');
80
+ }
81
+ return this.publisher.publishPattern(cfp, options);
82
+ }
83
+ /**
84
+ * Get featured patterns
85
+ */
86
+ getFeatured() {
87
+ if (!this.registry)
88
+ return [];
89
+ return doGetFeaturedPatterns(this.registry);
90
+ }
91
+ /**
92
+ * Get trending patterns
93
+ */
94
+ getTrending() {
95
+ if (!this.registry)
96
+ return [];
97
+ return doGetTrendingPatterns(this.registry);
98
+ }
99
+ /**
100
+ * Get newest patterns
101
+ */
102
+ getNewest() {
103
+ if (!this.registry)
104
+ return [];
105
+ return doGetNewestPatterns(this.registry);
106
+ }
107
+ /**
108
+ * Get categories
109
+ */
110
+ getCategories() {
111
+ if (!this.registry)
112
+ return [];
113
+ return this.registry.categories;
114
+ }
115
+ /**
116
+ * Get available registries
117
+ */
118
+ getRegistries() {
119
+ if (!this.discovery)
120
+ return [];
121
+ return this.discovery.listRegistries();
122
+ }
123
+ /**
124
+ * Refresh registry
125
+ */
126
+ async refresh() {
127
+ if (this.discovery) {
128
+ this.discovery.clearCache();
129
+ }
130
+ return this.initialize();
131
+ }
132
+ /**
133
+ * Get store statistics
134
+ */
135
+ getStats() {
136
+ if (!this.registry) {
137
+ return { totalPatterns: 0, totalDownloads: 0, totalAuthors: 0, categories: 0 };
138
+ }
139
+ return {
140
+ totalPatterns: this.registry.totalPatterns,
141
+ totalDownloads: this.registry.totalDownloads,
142
+ totalAuthors: this.registry.totalAuthors,
143
+ categories: this.registry.categories.length,
144
+ };
145
+ }
146
+ }
147
+ /**
148
+ * Create pattern store instance
149
+ */
150
+ export function createPatternStore(config) {
151
+ return new PatternStore(config);
152
+ }
153
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/transfer/store/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAmBH,WAAW;AACX,OAAO,EACL,gBAAgB,EAChB,oBAAoB,EACpB,oBAAoB,EACpB,cAAc,EACd,oBAAoB,EACpB,oBAAoB,EACpB,yBAAyB,EACzB,iBAAiB,EACjB,mBAAmB,EACnB,YAAY,EACZ,uBAAuB,EACvB,eAAe,EACf,iBAAiB,GAClB,MAAM,eAAe,CAAC;AAIvB,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAE1E,SAAS;AACT,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,mBAAmB,EACnB,iBAAiB,EACjB,cAAc,EACd,gBAAgB,EAChB,mBAAmB,EACnB,qBAAqB,EACrB,kBAA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AC,IAAI,CAAC,QAAQ,EAAE,CAAC;YACnB,OAAO,EAAE,aAAa,EAAE,CAAC,EAAE,cAAc,EAAE,CAAC,EAAE,YAAY,EAAE,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,CAAC;QACjF,CAAC;QACD,OAAO;YACL,aAAa,EAAE,IAAI,CAAC,QAAQ,CAAC,aAAa;YAC1C,cAAc,EAAE,IAAI,CAAC,QAAQ,CAAC,cAAc;YAC5C,YAAY,EAAE,IAAI,CAAC,QAAQ,CAAC,YAAY;YACxC,UAAU,EAAE,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,MAAM;SAC5C,CAAC;IACJ,CAAC;CACF;AAED;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAChC,MAA6B;IAE7B,OAAO,IAAI,YAAY,CAAC,MAAM,CAAC,CAAC;AAClC,CAAC"}
@@ -0,0 +1,76 @@
1
+ /**
2
+ * Pattern Publish Service
3
+ * Publish and contribute patterns to decentralized registry
4
+ */
5
+ import type { PublishOptions, PublishResult, StoreConfig } from './types.js';
6
+ import type { CFPFormat } from '../types.js';
7
+ /**
8
+ * Pattern Publisher
9
+ * Handles publishing patterns to IPFS and registry
10
+ */
11
+ export declare class PatternPublisher {
12
+ private config;
13
+ constructor(config?: Partial<StoreConfig>);
14
+ /**
15
+ * Publish a pattern to IPFS and registry
16
+ */
17
+ publishPattern(cfp: CFPFormat, options: PublishOptions): Promise<PublishResult>;
18
+ /**
19
+ * Sign content with private key
20
+ */
21
+ private signContent;
22
+ /**
23
+ * Get current author info
24
+ */
25
+ private getAuthor;
26
+ /**
27
+ * Validate pattern before publish
28
+ */
29
+ validateForPublish(cfp: CFPFormat, options: PublishOptions): string[];
30
+ /**
31
+ * Create publish preview
32
+ */
33
+ createPreview(cfp: CFPFormat, options: PublishOptions): object;
34
+ }
35
+ /**
36
+ * Submit contribution request
37
+ * For contributing to official registry
38
+ */
39
+ export interface ContributionRequest {
40
+ patternCid: string;
41
+ name: string;
42
+ displayName: string;
43
+ description: string;
44
+ categories: string[];
45
+ tags: string[];
46
+ authorId: string;
47
+ signature: string;
48
+ publicKey: string;
49
+ message?: string;
50
+ }
51
+ /**
52
+ * Submit a contribution to the registry
53
+ */
54
+ export declare function submitContribution(request: ContributionRequest): Promise<{
55
+ success: boolean;
56
+ submissionId: string;
57
+ message: string;
58
+ }>;
59
+ /**
60
+ * Check contribution status
61
+ */
62
+ export declare function checkContributionStatus(submissionId: string): Promise<{
63
+ status: 'pending' | 'reviewing' | 'approved' | 'rejected';
64
+ message: string;
65
+ reviewedAt?: string;
66
+ reviewer?: string;
67
+ }>;
68
+ /**
69
+ * Create publisher with default config
70
+ */
71
+ export declare function createPublisher(config?: Partial<StoreConfig>): PatternPublisher;
72
+ /**
73
+ * Quick publish helper
74
+ */
75
+ export declare function quickPublish(cfp: CFPFormat, name: string, description: string, tags: string[], config?: Partial<StoreConfig>): Promise<PublishResult>;
76
+ //# sourceMappingURL=publish.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"publish.d.ts","sourceRoot":"","sources":["../../../../src/transfer/store/publish.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,KAAK,EAIV,cAAc,EACd,aAAa,EACb,WAAW,EACZ,MAAM,YAAY,CAAC;AAEpB,OAAO,KAAK,EAAE,SAAS,EAAsB,MAAM,aAAa,CAAC;AAIjE;;;GAGG;AACH,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,MAAM,CAAc;gBAEhB,MAAM,GAAE,OAAO,CAAC,WAAW,CAAM;IAI7C;;OAEG;IACG,cAAc,CAClB,GAAG,EAAE,SAAS,EACd,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,aAAa,CAAC;IA8GzB;;OAEG;IACH,OAAO,CAAC,WAAW;IAsBnB;;OAEG;IACH,OAAO,CAAC,SAAS;IAoBjB;;OAEG;IACH,kBAAkB,CAAC,GAAG,EAAE,SAAS,EAAE,OAAO,EAAE,cAAc,GAAG,MAAM,EAAE;IA2C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