workflow-agent-cli 2.23.0 → 2.23.2
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/README.md +15 -15
- package/dist/{auto-fix-7WAESKYO.js → auto-fix-WGRYEFLJ.js} +2 -2
- package/dist/{chunk-IWFUJ2DS.js → chunk-DWHIY7R4.js} +20 -9
- package/dist/chunk-DWHIY7R4.js.map +1 -0
- package/dist/{chunk-D36IFZUZ.js → chunk-EHRI6BI6.js} +15 -4
- package/dist/chunk-EHRI6BI6.js.map +1 -0
- package/dist/{chunk-M6RHIUSM.js → chunk-K42R54II.js} +147 -54
- package/dist/chunk-K42R54II.js.map +1 -0
- package/dist/{chunk-XGS2VFBP.js → chunk-MBRMT5ZG.js} +865 -18
- package/dist/chunk-MBRMT5ZG.js.map +1 -0
- package/dist/{chunk-YELUGXOM.js → chunk-NPJJZHJG.js} +1 -1
- package/dist/chunk-NPJJZHJG.js.map +1 -0
- package/dist/{chunk-UWJ2ZGEI.js → chunk-OH6TK27N.js} +3 -3
- package/dist/{chunk-ZLDJ2OGO.js → chunk-WK7D2AVV.js} +11 -3
- package/dist/{chunk-ZLDJ2OGO.js.map → chunk-WK7D2AVV.js.map} +1 -1
- package/dist/cli/index.js +771 -285
- package/dist/cli/index.js.map +1 -1
- package/dist/config/index.js +2 -2
- package/dist/index.d.ts +87 -56
- package/dist/index.js +26 -10
- package/dist/scripts/postinstall.js +1 -1
- package/dist/scripts/postinstall.js.map +1 -1
- package/dist/sync-HHQM3GKR.js +7 -0
- package/dist/validators/index.js +1 -1
- package/dist/verify-PA7R6FBJ.js +8 -0
- package/package.json +2 -2
- package/dist/chunk-3ADL5QDN.js +0 -396
- package/dist/chunk-3ADL5QDN.js.map +0 -1
- package/dist/chunk-D36IFZUZ.js.map +0 -1
- package/dist/chunk-IWFUJ2DS.js.map +0 -1
- package/dist/chunk-M6RHIUSM.js.map +0 -1
- package/dist/chunk-XGS2VFBP.js.map +0 -1
- package/dist/chunk-YELUGXOM.js.map +0 -1
- package/dist/sync-6T5TD4QS.js +0 -7
- package/dist/verify-TX6LFMI6.js +0 -8
- /package/dist/{auto-fix-7WAESKYO.js.map → auto-fix-WGRYEFLJ.js.map} +0 -0
- /package/dist/{chunk-UWJ2ZGEI.js.map → chunk-OH6TK27N.js.map} +0 -0
- /package/dist/{sync-6T5TD4QS.js.map → sync-HHQM3GKR.js.map} +0 -0
- /package/dist/{verify-TX6LFMI6.js.map → verify-PA7R6FBJ.js.map} +0 -0
|
@@ -36,17 +36,14 @@ var RegistryClient = class {
|
|
|
36
36
|
hash: p2.hash
|
|
37
37
|
}))
|
|
38
38
|
};
|
|
39
|
-
const response = await this.request(
|
|
40
|
-
"
|
|
41
|
-
{
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
body: JSON.stringify(payload)
|
|
48
|
-
}
|
|
49
|
-
);
|
|
39
|
+
const response = await this.request("/api/patterns/push", {
|
|
40
|
+
method: "POST",
|
|
41
|
+
headers: {
|
|
42
|
+
"Content-Type": "application/json",
|
|
43
|
+
"x-contributor-id": contributorId
|
|
44
|
+
},
|
|
45
|
+
body: JSON.stringify(payload)
|
|
46
|
+
});
|
|
50
47
|
return response;
|
|
51
48
|
}
|
|
52
49
|
/**
|
|
@@ -205,11 +202,17 @@ async function syncCommand(options) {
|
|
|
205
202
|
const enableResult = await contributorManager.enableSync();
|
|
206
203
|
if (enableResult.success) {
|
|
207
204
|
console.log(chalk.green("\n\u2705 Sync enabled!"));
|
|
208
|
-
console.log(
|
|
205
|
+
console.log(
|
|
206
|
+
chalk.dim(
|
|
207
|
+
" Your anonymized patterns can now be shared with the community.\n"
|
|
208
|
+
)
|
|
209
|
+
);
|
|
209
210
|
} else {
|
|
210
|
-
console.log(
|
|
211
|
+
console.log(
|
|
212
|
+
chalk.red(`
|
|
211
213
|
\u274C Failed to enable sync: ${enableResult.error}
|
|
212
|
-
`)
|
|
214
|
+
`)
|
|
215
|
+
);
|
|
213
216
|
process.exit(1);
|
|
214
217
|
}
|
|
215
218
|
if (!options.push && !options.pull && !options.all && !options.solutions && !options.scopes) {
|
|
@@ -223,9 +226,11 @@ async function syncCommand(options) {
|
|
|
223
226
|
console.log(chalk.green("\n\u2705 Sync disabled!"));
|
|
224
227
|
console.log(chalk.dim(" Your patterns will no longer be shared.\n"));
|
|
225
228
|
} else {
|
|
226
|
-
console.log(
|
|
229
|
+
console.log(
|
|
230
|
+
chalk.red(`
|
|
227
231
|
\u274C Failed to disable sync: ${disableResult.error}
|
|
228
|
-
`)
|
|
232
|
+
`)
|
|
233
|
+
);
|
|
229
234
|
process.exit(1);
|
|
230
235
|
}
|
|
231
236
|
p.outro(chalk.green("Sync disabled"));
|
|
@@ -271,11 +276,17 @@ async function syncCommand(options) {
|
|
|
271
276
|
console.log(chalk.yellow("\n\u{1F4CB} DRY-RUN MODE: No changes will be synced\n"));
|
|
272
277
|
}
|
|
273
278
|
console.log(chalk.cyan("\n\u{1F4E6} Syncing:"));
|
|
274
|
-
if (syncLearn)
|
|
279
|
+
if (syncLearn)
|
|
280
|
+
console.log(chalk.dim(" \u2022 Learning patterns (fixes, blueprints)"));
|
|
275
281
|
if (syncSolutions) console.log(chalk.dim(" \u2022 Solution patterns"));
|
|
276
282
|
if (syncScopes) console.log(chalk.dim(" \u2022 Custom scopes"));
|
|
277
|
-
console.log(
|
|
278
|
-
|
|
283
|
+
console.log(
|
|
284
|
+
chalk.dim(
|
|
285
|
+
` \u2022 Direction: ${direction === "both" ? "push + pull" : direction}`
|
|
286
|
+
)
|
|
287
|
+
);
|
|
288
|
+
if (options.includePrivate)
|
|
289
|
+
console.log(chalk.dim(" \u2022 Including private patterns"));
|
|
279
290
|
console.log("");
|
|
280
291
|
const store = new PatternStore(cwd);
|
|
281
292
|
await store.initialize();
|
|
@@ -291,10 +302,18 @@ async function syncCommand(options) {
|
|
|
291
302
|
const privateFixes = stats.privateFixes;
|
|
292
303
|
const privateBlueprints = stats.privateBlueprints;
|
|
293
304
|
const privateSolutions = stats.privateSolutions;
|
|
305
|
+
void totalLocalFixes;
|
|
306
|
+
void totalLocalBlueprints;
|
|
307
|
+
void totalLocalSolutions;
|
|
308
|
+
void privateBlueprints;
|
|
294
309
|
if (options.includePrivate) {
|
|
295
310
|
const allFixes = await store.listFixPatterns({ includeDeprecated: false });
|
|
296
|
-
const allBlueprints = await store.listBlueprints({
|
|
297
|
-
|
|
311
|
+
const allBlueprints = await store.listBlueprints({
|
|
312
|
+
includeDeprecated: false
|
|
313
|
+
});
|
|
314
|
+
const allSolutions = await store.listSolutions({
|
|
315
|
+
includeDeprecated: false
|
|
316
|
+
});
|
|
298
317
|
fixes = allFixes.data ?? [];
|
|
299
318
|
blueprints = allBlueprints.data ?? [];
|
|
300
319
|
solutions = allSolutions.data ?? [];
|
|
@@ -304,12 +323,28 @@ async function syncCommand(options) {
|
|
|
304
323
|
const publicCount = fixes.length;
|
|
305
324
|
const privateCount = privateFixes;
|
|
306
325
|
if (options.includePrivate) {
|
|
307
|
-
console.log(
|
|
326
|
+
console.log(
|
|
327
|
+
chalk.dim(
|
|
328
|
+
` Found ${publicCount} fixes, ${blueprints.length} blueprints to sync (including private)`
|
|
329
|
+
)
|
|
330
|
+
);
|
|
308
331
|
} else if (publicCount === 0 && privateCount > 0) {
|
|
309
|
-
console.log(
|
|
310
|
-
|
|
332
|
+
console.log(
|
|
333
|
+
chalk.yellow(
|
|
334
|
+
` Found 0 fixes ready to sync (${privateCount} are private)`
|
|
335
|
+
)
|
|
336
|
+
);
|
|
337
|
+
console.log(
|
|
338
|
+
chalk.dim(
|
|
339
|
+
` Use --include-private to include them, or run 'workflow learn migrate --public'`
|
|
340
|
+
)
|
|
341
|
+
);
|
|
311
342
|
} else {
|
|
312
|
-
console.log(
|
|
343
|
+
console.log(
|
|
344
|
+
chalk.dim(
|
|
345
|
+
` Found ${publicCount} fixes, ${blueprints.length} blueprints ready to sync`
|
|
346
|
+
)
|
|
347
|
+
);
|
|
313
348
|
}
|
|
314
349
|
for (const fix of fixes) {
|
|
315
350
|
const result = anonymizer.anonymizeFixPattern(fix);
|
|
@@ -336,33 +371,67 @@ async function syncCommand(options) {
|
|
|
336
371
|
const publicCount = solutions.length;
|
|
337
372
|
const privateCount = privateSolutions;
|
|
338
373
|
if (options.includePrivate) {
|
|
339
|
-
console.log(
|
|
374
|
+
console.log(
|
|
375
|
+
chalk.dim(
|
|
376
|
+
` Found ${publicCount} solutions to sync (including private)`
|
|
377
|
+
)
|
|
378
|
+
);
|
|
340
379
|
} else if (publicCount === 0 && privateCount > 0 && !options.dryRun) {
|
|
341
|
-
console.log(
|
|
380
|
+
console.log(
|
|
381
|
+
chalk.yellow(
|
|
382
|
+
` Found 0 solutions ready to sync (${privateCount} are private)`
|
|
383
|
+
)
|
|
384
|
+
);
|
|
342
385
|
const shouldMigrate = await p.confirm({
|
|
343
386
|
message: `Would you like to make your ${privateCount} solution(s) public for sync?`
|
|
344
387
|
});
|
|
345
388
|
if (p.isCancel(shouldMigrate) || !shouldMigrate) {
|
|
346
|
-
console.log(
|
|
389
|
+
console.log(
|
|
390
|
+
chalk.dim(
|
|
391
|
+
` Skipping private solutions. Use --include-private to force include them.`
|
|
392
|
+
)
|
|
393
|
+
);
|
|
347
394
|
} else {
|
|
348
|
-
const allSolutions = await store.listSolutions({
|
|
395
|
+
const allSolutions = await store.listSolutions({
|
|
396
|
+
includeDeprecated: false
|
|
397
|
+
});
|
|
349
398
|
for (const sol of allSolutions.data ?? []) {
|
|
350
399
|
if (sol.isPrivate) {
|
|
351
|
-
const updated = {
|
|
400
|
+
const updated = {
|
|
401
|
+
...sol,
|
|
402
|
+
isPrivate: false,
|
|
403
|
+
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
404
|
+
};
|
|
352
405
|
await store.saveSolution(updated);
|
|
353
406
|
solutions.push(updated);
|
|
354
407
|
}
|
|
355
408
|
}
|
|
356
|
-
console.log(
|
|
409
|
+
console.log(
|
|
410
|
+
chalk.green(` \u2713 Migrated ${privateCount} solutions to public`)
|
|
411
|
+
);
|
|
357
412
|
}
|
|
358
413
|
} else if (publicCount === 0 && privateCount > 0) {
|
|
359
|
-
console.log(
|
|
360
|
-
|
|
414
|
+
console.log(
|
|
415
|
+
chalk.yellow(
|
|
416
|
+
` Found 0 solutions ready to sync (${privateCount} are private)`
|
|
417
|
+
)
|
|
418
|
+
);
|
|
419
|
+
console.log(
|
|
420
|
+
chalk.dim(
|
|
421
|
+
` Use --include-private to include them, or run 'workflow solution migrate --public'`
|
|
422
|
+
)
|
|
423
|
+
);
|
|
361
424
|
} else if (publicCount === 0 && privateCount === 0) {
|
|
362
425
|
const validationErrors = store.getValidationErrors();
|
|
363
|
-
const solutionErrors = validationErrors.filter(
|
|
426
|
+
const solutionErrors = validationErrors.filter(
|
|
427
|
+
(e) => e.type === "solution"
|
|
428
|
+
);
|
|
364
429
|
if (solutionErrors.length > 0) {
|
|
365
|
-
console.log(
|
|
430
|
+
console.log(
|
|
431
|
+
chalk.yellow(
|
|
432
|
+
` Found 0 solutions (${solutionErrors.length} failed schema validation)`
|
|
433
|
+
)
|
|
434
|
+
);
|
|
366
435
|
for (const err of solutionErrors) {
|
|
367
436
|
console.log(chalk.dim(` \u2022 ${err.file}: ${err.error}`));
|
|
368
437
|
if (err.details) {
|
|
@@ -370,7 +439,11 @@ async function syncCommand(options) {
|
|
|
370
439
|
console.log(chalk.dim(` - ${detail}`));
|
|
371
440
|
}
|
|
372
441
|
if (err.details.length > 3) {
|
|
373
|
-
console.log(
|
|
442
|
+
console.log(
|
|
443
|
+
chalk.dim(
|
|
444
|
+
` ... and ${err.details.length - 3} more issues`
|
|
445
|
+
)
|
|
446
|
+
);
|
|
374
447
|
}
|
|
375
448
|
}
|
|
376
449
|
}
|
|
@@ -400,15 +473,21 @@ async function syncCommand(options) {
|
|
|
400
473
|
console.log(chalk.yellow(" No patterns to push\n"));
|
|
401
474
|
} else {
|
|
402
475
|
const fixCount = patternsToSync.filter((p2) => p2.type === "fix").length;
|
|
403
|
-
const bpCount = patternsToSync.filter(
|
|
404
|
-
|
|
476
|
+
const bpCount = patternsToSync.filter(
|
|
477
|
+
(p2) => p2.type === "blueprint"
|
|
478
|
+
).length;
|
|
479
|
+
const solutionCount = patternsToSync.filter(
|
|
480
|
+
(p2) => p2.type === "solution"
|
|
481
|
+
).length;
|
|
405
482
|
console.log(
|
|
406
483
|
chalk.dim(
|
|
407
484
|
` Ready to push: ${fixCount} fixes, ${bpCount} blueprints, ${solutionCount} solutions`
|
|
408
485
|
)
|
|
409
486
|
);
|
|
410
487
|
if (options.dryRun) {
|
|
411
|
-
console.log(
|
|
488
|
+
console.log(
|
|
489
|
+
chalk.yellow("\n [DRY-RUN] Would push patterns to registry")
|
|
490
|
+
);
|
|
412
491
|
} else {
|
|
413
492
|
const contributorResult = await contributorManager.getOrCreateId();
|
|
414
493
|
if (!contributorResult.success || !contributorResult.data) {
|
|
@@ -440,8 +519,10 @@ async function syncCommand(options) {
|
|
|
440
519
|
}
|
|
441
520
|
}
|
|
442
521
|
console.log(
|
|
443
|
-
chalk.green(
|
|
444
|
-
|
|
522
|
+
chalk.green(
|
|
523
|
+
`
|
|
524
|
+
\u2705 Pushed ${pushResult.pushed} patterns to registry`
|
|
525
|
+
)
|
|
445
526
|
);
|
|
446
527
|
if (pushResult.skipped > 0) {
|
|
447
528
|
console.log(
|
|
@@ -465,9 +546,7 @@ async function syncCommand(options) {
|
|
|
465
546
|
if (error instanceof RateLimitedException) {
|
|
466
547
|
console.log(chalk.red("\n \u274C Rate limit exceeded"));
|
|
467
548
|
console.log(
|
|
468
|
-
chalk.dim(
|
|
469
|
-
` Try again in ${error.getTimeUntilReset()}`
|
|
470
|
-
)
|
|
549
|
+
chalk.dim(` Try again in ${error.getTimeUntilReset()}`)
|
|
471
550
|
);
|
|
472
551
|
} else if (error instanceof RegistryError) {
|
|
473
552
|
console.log(chalk.red(`
|
|
@@ -488,7 +567,9 @@ async function syncCommand(options) {
|
|
|
488
567
|
if (direction === "pull" || direction === "both") {
|
|
489
568
|
console.log(chalk.cyan("\n\u{1F4E5} Pulling patterns from registry...\n"));
|
|
490
569
|
if (options.dryRun) {
|
|
491
|
-
console.log(
|
|
570
|
+
console.log(
|
|
571
|
+
chalk.yellow(" [DRY-RUN] Would pull patterns from registry")
|
|
572
|
+
);
|
|
492
573
|
} else {
|
|
493
574
|
const registryClient = new RegistryClient();
|
|
494
575
|
try {
|
|
@@ -532,31 +613,43 @@ async function syncCommand(options) {
|
|
|
532
613
|
}
|
|
533
614
|
}
|
|
534
615
|
if (syncSolutions && typeCounts["solution"] !== void 0) {
|
|
535
|
-
console.log(
|
|
616
|
+
console.log(
|
|
617
|
+
chalk.dim(
|
|
618
|
+
` Registry has ${typeCounts["solution"]} solution(s) available`
|
|
619
|
+
)
|
|
620
|
+
);
|
|
536
621
|
}
|
|
537
622
|
if (syncLearn) {
|
|
538
623
|
const fixCount = typeCounts["fix"] ?? 0;
|
|
539
624
|
const bpCount = typeCounts["blueprint"] ?? 0;
|
|
540
|
-
console.log(
|
|
625
|
+
console.log(
|
|
626
|
+
chalk.dim(
|
|
627
|
+
` Registry has ${fixCount} fix(es), ${bpCount} blueprint(s) available`
|
|
628
|
+
)
|
|
629
|
+
);
|
|
541
630
|
}
|
|
542
631
|
if (totalPatterns === 0) {
|
|
543
632
|
console.log(chalk.dim(" No new patterns to pull"));
|
|
544
633
|
} else {
|
|
545
634
|
console.log(
|
|
546
|
-
chalk.green(
|
|
547
|
-
|
|
635
|
+
chalk.green(
|
|
636
|
+
`
|
|
637
|
+
\u2705 Pulled ${savedCount} new patterns from registry`
|
|
638
|
+
)
|
|
548
639
|
);
|
|
549
640
|
if (savedCount < totalPatterns) {
|
|
550
|
-
console.log(
|
|
641
|
+
console.log(
|
|
642
|
+
chalk.dim(
|
|
643
|
+
` (${totalPatterns - savedCount} already existed locally)`
|
|
644
|
+
)
|
|
645
|
+
);
|
|
551
646
|
}
|
|
552
647
|
}
|
|
553
648
|
} catch (error) {
|
|
554
649
|
if (error instanceof RateLimitedException) {
|
|
555
650
|
console.log(chalk.red("\n \u274C Rate limit exceeded"));
|
|
556
651
|
console.log(
|
|
557
|
-
chalk.dim(
|
|
558
|
-
` Try again in ${error.getTimeUntilReset()}`
|
|
559
|
-
)
|
|
652
|
+
chalk.dim(` Try again in ${error.getTimeUntilReset()}`)
|
|
560
653
|
);
|
|
561
654
|
} else if (error instanceof RegistryError) {
|
|
562
655
|
console.log(chalk.red(`
|
|
@@ -579,4 +672,4 @@ async function syncCommand(options) {
|
|
|
579
672
|
export {
|
|
580
673
|
syncCommand
|
|
581
674
|
};
|
|
582
|
-
//# sourceMappingURL=chunk-
|
|
675
|
+
//# sourceMappingURL=chunk-K42R54II.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/cli/commands/sync.ts","../src/sync/registry-client.ts"],"sourcesContent":["/**\n * Unified Sync Command\n *\n * Orchestrates syncing of patterns and solutions with the registry.\n * Combines functionality from learn:sync and solution sync.\n *\n * Usage:\n * workflow sync # Interactive sync (prompts for direction)\n * workflow sync --push # Push local patterns to registry\n * workflow sync --pull # Pull patterns from registry\n * workflow sync --solutions # Include solution patterns\n * workflow sync --learn # Include learning patterns (default)\n * workflow sync --scopes # Sync custom scope packages\n * workflow sync --all # Sync everything\n * workflow sync --dry-run # Preview without syncing\n */\n\nimport * as p from \"@clack/prompts\";\nimport chalk from \"chalk\";\nimport {\n PatternStore,\n PatternAnonymizer,\n ContributorManager,\n type FixPattern,\n type Blueprint,\n type SolutionPattern,\n} from \"@hawkinside_out/workflow-improvement-tracker\";\nimport {\n RegistryClient,\n RateLimitedException,\n RegistryError,\n} from \"../../sync/registry-client.js\";\n\nexport interface UnifiedSyncOptions {\n push?: boolean;\n pull?: boolean;\n solutions?: boolean;\n learn?: boolean;\n scopes?: boolean;\n all?: boolean;\n dryRun?: boolean;\n enableSync?: boolean;\n disableSync?: boolean;\n includePrivate?: boolean;\n}\n\nfunction getWorkspacePath(): string {\n return process.cwd();\n}\n\n/**\n * Unified sync command that orchestrates all sync operations\n */\nexport async function syncCommand(options: UnifiedSyncOptions): Promise<void> {\n const cwd = getWorkspacePath();\n const contributorManager = new ContributorManager(cwd);\n\n p.intro(chalk.bgBlue(\" workflow sync \"));\n\n // Handle --enable-sync option\n if (options.enableSync) {\n const enableResult = await contributorManager.enableSync();\n if (enableResult.success) {\n console.log(chalk.green(\"\\n✅ Sync enabled!\"));\n console.log(\n chalk.dim(\n \" Your anonymized patterns can now be shared with the community.\\n\",\n ),\n );\n } else {\n console.log(\n chalk.red(`\\n❌ Failed to enable sync: ${enableResult.error}\\n`),\n );\n process.exit(1);\n }\n // If only --enable-sync was passed, exit after enabling\n if (\n !options.push &&\n !options.pull &&\n !options.all &&\n !options.solutions &&\n !options.scopes\n ) {\n p.outro(chalk.green(\"Sync enabled\"));\n return;\n }\n }\n\n // Handle --disable-sync option\n if (options.disableSync) {\n const disableResult = await contributorManager.disableSync();\n if (disableResult.success) {\n console.log(chalk.green(\"\\n✅ Sync disabled!\"));\n console.log(chalk.dim(\" Your patterns will no longer be shared.\\n\"));\n } else {\n console.log(\n chalk.red(`\\n❌ Failed to disable sync: ${disableResult.error}\\n`),\n );\n process.exit(1);\n }\n p.outro(chalk.green(\"Sync disabled\"));\n return;\n }\n\n // Check if sync is enabled\n const config = await contributorManager.getConfig();\n if (!config.success || !config.data?.syncOptIn) {\n console.log(chalk.yellow(\"\\n⚠️ Sync is not enabled.\\n\"));\n console.log(chalk.dim(\" To enable sync, run:\"));\n console.log(chalk.dim(\" workflow learn config --enable-sync\\n\"));\n console.log(\n chalk.dim(\n \" This allows you to share anonymized patterns with the community.\",\n ),\n );\n p.outro(chalk.yellow(\"Sync not enabled\"));\n process.exit(0);\n }\n\n // Determine what to sync\n const syncLearn =\n options.learn || options.all || (!options.solutions && !options.scopes);\n const syncSolutions = options.solutions || options.all;\n const syncScopes = options.scopes || options.all;\n\n // Determine direction\n let direction: \"push\" | \"pull\" | \"both\" = \"both\";\n if (options.push && !options.pull) {\n direction = \"push\";\n } else if (options.pull && !options.push) {\n direction = \"pull\";\n } else if (!options.push && !options.pull) {\n // Interactive mode - ask user\n const choice = await p.select({\n message: \"Sync direction:\",\n options: [\n { value: \"push\", label: \"📤 Push - Upload local patterns to registry\" },\n { value: \"pull\", label: \"📥 Pull - Download patterns from registry\" },\n { value: \"both\", label: \"🔄 Both - Push then pull\" },\n ],\n });\n\n if (p.isCancel(choice)) {\n p.cancel(\"Sync cancelled\");\n process.exit(0);\n }\n direction = choice as \"push\" | \"pull\" | \"both\";\n }\n\n if (options.dryRun) {\n console.log(chalk.yellow(\"\\n📋 DRY-RUN MODE: No changes will be synced\\n\"));\n }\n\n // Show what will be synced\n console.log(chalk.cyan(\"\\n📦 Syncing:\"));\n if (syncLearn)\n console.log(chalk.dim(\" • Learning patterns (fixes, blueprints)\"));\n if (syncSolutions) console.log(chalk.dim(\" • Solution patterns\"));\n if (syncScopes) console.log(chalk.dim(\" • Custom scopes\"));\n console.log(\n chalk.dim(\n ` • Direction: ${direction === \"both\" ? \"push + pull\" : direction}`,\n ),\n );\n if (options.includePrivate)\n console.log(chalk.dim(\" • Including private patterns\"));\n console.log(\"\");\n\n const store = new PatternStore(cwd);\n await store.initialize();\n const anonymizer = new PatternAnonymizer();\n\n // Get patterns to sync\n // If --include-private is set, get all patterns; otherwise filter to public only\n const syncData = await store.getPatternsForSync();\n let fixes = syncData.fixes ?? [];\n let blueprints = syncData.blueprints ?? [];\n let solutions = syncData.solutions ?? [];\n\n // Get stats for all patterns to show why some might be excluded\n const stats = await store.getStats();\n // Note: These variables are used to provide context about excluded patterns\n const totalLocalFixes = stats.totalFixes;\n const totalLocalBlueprints = stats.totalBlueprints;\n const totalLocalSolutions = stats.totalSolutions;\n const privateFixes = stats.privateFixes;\n const privateBlueprints = stats.privateBlueprints;\n const privateSolutions = stats.privateSolutions;\n\n // Use the stats to show info about local patterns\n void totalLocalFixes;\n void totalLocalBlueprints;\n void totalLocalSolutions;\n void privateBlueprints;\n\n // If --include-private, we need to get all patterns including private ones\n if (options.includePrivate) {\n const allFixes = await store.listFixPatterns({ includeDeprecated: false });\n const allBlueprints = await store.listBlueprints({\n includeDeprecated: false,\n });\n const allSolutions = await store.listSolutions({\n includeDeprecated: false,\n });\n fixes = allFixes.data ?? [];\n blueprints = allBlueprints.data ?? [];\n solutions = allSolutions.data ?? [];\n }\n\n // Filter based on options\n const patternsToSync: Array<{\n pattern: FixPattern | Blueprint | SolutionPattern;\n type: \"fix\" | \"blueprint\" | \"solution\";\n originalId: string;\n }> = [];\n\n if (syncLearn) {\n const publicCount = fixes.length;\n const privateCount = privateFixes;\n\n if (options.includePrivate) {\n console.log(\n chalk.dim(\n ` Found ${publicCount} fixes, ${blueprints.length} blueprints to sync (including private)`,\n ),\n );\n } else if (publicCount === 0 && privateCount > 0) {\n console.log(\n chalk.yellow(\n ` Found 0 fixes ready to sync (${privateCount} are private)`,\n ),\n );\n console.log(\n chalk.dim(\n ` Use --include-private to include them, or run 'workflow learn migrate --public'`,\n ),\n );\n } else {\n console.log(\n chalk.dim(\n ` Found ${publicCount} fixes, ${blueprints.length} blueprints ready to sync`,\n ),\n );\n }\n\n for (const fix of fixes) {\n const result = anonymizer.anonymizeFixPattern(fix);\n if (result.success && result.data) {\n patternsToSync.push({\n pattern: result.data,\n type: \"fix\",\n originalId: fix.id,\n });\n }\n }\n\n for (const bp of blueprints) {\n const result = anonymizer.anonymizeBlueprint(bp);\n if (result.success && result.data) {\n patternsToSync.push({\n pattern: result.data,\n type: \"blueprint\",\n originalId: bp.id,\n });\n }\n }\n }\n\n if (syncSolutions) {\n const publicCount = solutions.length;\n const privateCount = privateSolutions;\n\n if (options.includePrivate) {\n console.log(\n chalk.dim(\n ` Found ${publicCount} solutions to sync (including private)`,\n ),\n );\n } else if (publicCount === 0 && privateCount > 0 && !options.dryRun) {\n console.log(\n chalk.yellow(\n ` Found 0 solutions ready to sync (${privateCount} are private)`,\n ),\n );\n\n // Prompt user to migrate solutions to public\n const shouldMigrate = await p.confirm({\n message: `Would you like to make your ${privateCount} solution(s) public for sync?`,\n });\n\n if (p.isCancel(shouldMigrate) || !shouldMigrate) {\n console.log(\n chalk.dim(\n ` Skipping private solutions. Use --include-private to force include them.`,\n ),\n );\n } else {\n // Migrate all private solutions to public\n const allSolutions = await store.listSolutions({\n includeDeprecated: false,\n });\n for (const sol of allSolutions.data ?? []) {\n if (sol.isPrivate) {\n const updated = {\n ...sol,\n isPrivate: false,\n updatedAt: new Date().toISOString(),\n };\n await store.saveSolution(updated);\n solutions.push(updated);\n }\n }\n console.log(\n chalk.green(` ✓ Migrated ${privateCount} solutions to public`),\n );\n }\n } else if (publicCount === 0 && privateCount > 0) {\n // Dry run mode - just show the message\n console.log(\n chalk.yellow(\n ` Found 0 solutions ready to sync (${privateCount} are private)`,\n ),\n );\n console.log(\n chalk.dim(\n ` Use --include-private to include them, or run 'workflow solution migrate --public'`,\n ),\n );\n } else if (publicCount === 0 && privateCount === 0) {\n // No solutions at all - check for validation errors\n const validationErrors = store.getValidationErrors();\n const solutionErrors = validationErrors.filter(\n (e) => e.type === \"solution\",\n );\n if (solutionErrors.length > 0) {\n console.log(\n chalk.yellow(\n ` Found 0 solutions (${solutionErrors.length} failed schema validation)`,\n ),\n );\n for (const err of solutionErrors) {\n console.log(chalk.dim(` • ${err.file}: ${err.error}`));\n if (err.details) {\n for (const detail of err.details.slice(0, 3)) {\n console.log(chalk.dim(` - ${detail}`));\n }\n if (err.details.length > 3) {\n console.log(\n chalk.dim(\n ` ... and ${err.details.length - 3} more issues`,\n ),\n );\n }\n }\n }\n } else {\n console.log(chalk.dim(` Found 0 solutions to sync`));\n }\n } else {\n console.log(chalk.dim(` Found ${publicCount} solutions ready to sync`));\n }\n\n for (const solution of solutions) {\n const result = anonymizer.anonymizeSolution(solution);\n if (result.success && result.data) {\n patternsToSync.push({\n pattern: result.data,\n type: \"solution\",\n originalId: solution.id,\n });\n }\n }\n }\n\n if (syncScopes) {\n // TODO: Implement scope sync when scope registry is available\n console.log(chalk.dim(\" Scope sync: Coming soon\"));\n }\n\n // PUSH operation\n if (direction === \"push\" || direction === \"both\") {\n console.log(chalk.cyan(\"\\n📤 Pushing patterns...\\n\"));\n\n if (patternsToSync.length === 0) {\n console.log(chalk.yellow(\" No patterns to push\\n\"));\n } else {\n const fixCount = patternsToSync.filter((p) => p.type === \"fix\").length;\n const bpCount = patternsToSync.filter(\n (p) => p.type === \"blueprint\",\n ).length;\n const solutionCount = patternsToSync.filter(\n (p) => p.type === \"solution\",\n ).length;\n\n console.log(\n chalk.dim(\n ` Ready to push: ${fixCount} fixes, ${bpCount} blueprints, ${solutionCount} solutions`,\n ),\n );\n\n if (options.dryRun) {\n console.log(\n chalk.yellow(\"\\n [DRY-RUN] Would push patterns to registry\"),\n );\n } else {\n // Get contributor ID\n const contributorResult = await contributorManager.getOrCreateId();\n if (!contributorResult.success || !contributorResult.data) {\n console.log(chalk.red(\"\\n ❌ Failed to get contributor ID\"));\n process.exit(1);\n }\n\n // Push to registry\n const registryClient = new RegistryClient();\n\n try {\n console.log(chalk.dim(\"\\n Connecting to registry...\"));\n\n const pushResult = await registryClient.push(\n patternsToSync.map((p) => ({\n pattern: p.pattern,\n type: p.type,\n })),\n contributorResult.data,\n );\n\n // Mark pushed patterns as synced\n if (pushResult.pushed > 0) {\n const pushedFixIds = patternsToSync\n .filter((p) => p.type === \"fix\")\n .map((p) => p.originalId);\n const pushedBpIds = patternsToSync\n .filter((p) => p.type === \"blueprint\")\n .map((p) => p.originalId);\n const pushedSolutionIds = patternsToSync\n .filter((p) => p.type === \"solution\")\n .map((p) => p.originalId);\n\n if (pushedFixIds.length > 0) {\n await store.markAsSynced(pushedFixIds, \"fix\");\n }\n if (pushedBpIds.length > 0) {\n await store.markAsSynced(pushedBpIds, \"blueprint\");\n }\n if (pushedSolutionIds.length > 0) {\n await store.markAsSynced(pushedSolutionIds, \"solution\");\n }\n }\n\n console.log(\n chalk.green(\n `\\n ✅ Pushed ${pushResult.pushed} patterns to registry`,\n ),\n );\n\n if (pushResult.skipped > 0) {\n console.log(\n chalk.dim(` (${pushResult.skipped} already existed)`),\n );\n }\n\n if (pushResult.errors && pushResult.errors.length > 0) {\n console.log(chalk.yellow(`\\n ⚠️ Some patterns had errors:`));\n for (const err of pushResult.errors) {\n console.log(chalk.dim(` - ${err}`));\n }\n }\n\n console.log(\n chalk.dim(\n `\\n Rate limit: ${pushResult.rateLimit.remaining} patterns remaining this hour`,\n ),\n );\n } catch (error) {\n if (error instanceof RateLimitedException) {\n console.log(chalk.red(\"\\n ❌ Rate limit exceeded\"));\n console.log(\n chalk.dim(` Try again in ${error.getTimeUntilReset()}`),\n );\n } else if (error instanceof RegistryError) {\n console.log(chalk.red(`\\n ❌ Registry error: ${error.message}`));\n } else {\n console.log(\n chalk.red(\n `\\n ❌ Failed to push: ${error instanceof Error ? error.message : String(error)}`,\n ),\n );\n }\n process.exit(1);\n }\n }\n }\n }\n\n // PULL operation\n if (direction === \"pull\" || direction === \"both\") {\n console.log(chalk.cyan(\"\\n📥 Pulling patterns from registry...\\n\"));\n\n if (options.dryRun) {\n console.log(\n chalk.yellow(\" [DRY-RUN] Would pull patterns from registry\"),\n );\n } else {\n const registryClient = new RegistryClient();\n\n try {\n console.log(chalk.dim(\" Connecting to registry...\"));\n\n // Pull patterns based on sync options - need to call separately for each type\n const pullTypes: (\"fix\" | \"blueprint\" | \"solution\")[] = [];\n if (syncLearn) {\n pullTypes.push(\"fix\", \"blueprint\");\n }\n if (syncSolutions) {\n pullTypes.push(\"solution\");\n }\n\n let totalPatterns = 0;\n let savedCount = 0;\n const typeCounts: Record<string, number> = {};\n\n for (const pullType of pullTypes) {\n const pullResult = await registryClient.pull({\n type: pullType,\n });\n\n typeCounts[pullType] = pullResult.patterns.length;\n totalPatterns += pullResult.patterns.length;\n\n for (const pulled of pullResult.patterns) {\n try {\n if (pulled.type === \"fix\" && pulled.data) {\n const fixData = pulled.data as FixPattern;\n await store.saveFixPattern(fixData);\n console.log(chalk.dim(` ✓ ${fixData.name} (fix)`));\n savedCount++;\n } else if (pulled.type === \"blueprint\" && pulled.data) {\n const blueprintData = pulled.data as Blueprint;\n await store.saveBlueprint(blueprintData);\n console.log(chalk.dim(` ✓ ${blueprintData.name} (blueprint)`));\n savedCount++;\n } else if (pulled.type === \"solution\" && pulled.data) {\n const solutionData = pulled.data as SolutionPattern;\n await store.saveSolution(solutionData);\n console.log(chalk.dim(` ✓ ${solutionData.name} (solution)`));\n savedCount++;\n }\n } catch {\n // Pattern might already exist - silently skip\n }\n }\n }\n\n // Show registry stats\n if (syncSolutions && typeCounts[\"solution\"] !== undefined) {\n console.log(\n chalk.dim(\n ` Registry has ${typeCounts[\"solution\"]} solution(s) available`,\n ),\n );\n }\n if (syncLearn) {\n const fixCount = typeCounts[\"fix\"] ?? 0;\n const bpCount = typeCounts[\"blueprint\"] ?? 0;\n console.log(\n chalk.dim(\n ` Registry has ${fixCount} fix(es), ${bpCount} blueprint(s) available`,\n ),\n );\n }\n\n if (totalPatterns === 0) {\n console.log(chalk.dim(\" No new patterns to pull\"));\n } else {\n console.log(\n chalk.green(\n `\\n ✅ Pulled ${savedCount} new patterns from registry`,\n ),\n );\n if (savedCount < totalPatterns) {\n console.log(\n chalk.dim(\n ` (${totalPatterns - savedCount} already existed locally)`,\n ),\n );\n }\n }\n } catch (error) {\n if (error instanceof RateLimitedException) {\n console.log(chalk.red(\"\\n ❌ Rate limit exceeded\"));\n console.log(\n chalk.dim(` Try again in ${error.getTimeUntilReset()}`),\n );\n } else if (error instanceof RegistryError) {\n console.log(chalk.red(`\\n ❌ Registry error: ${error.message}`));\n } else {\n console.log(\n chalk.red(\n `\\n ❌ Failed to pull: ${error instanceof Error ? error.message : String(error)}`,\n ),\n );\n }\n process.exit(1);\n }\n }\n }\n\n p.outro(chalk.green(\"Sync complete!\"));\n}\n","/**\n * Registry Client for pattern sync\n *\n * HTTP client for pushing patterns to and pulling patterns from\n * the community pattern registry.\n */\n\nimport type {\n FixPattern,\n Blueprint,\n SolutionPattern,\n} from \"@hawkinside_out/workflow-improvement-tracker\";\n\n// Default registry URL\nconst DEFAULT_REGISTRY_URL = \"https://registry-api-rust.vercel.app\";\n\n/**\n * Pattern payload for push/pull operations\n */\nexport interface RegistryPattern {\n id: string;\n type: \"fix\" | \"blueprint\" | \"solution\";\n data: Record<string, unknown>;\n hash?: string;\n createdAt?: string;\n}\n\n/**\n * Push response from registry\n */\nexport interface PushResponse {\n status: \"ok\" | \"error\";\n pushed: number;\n skipped: number;\n errors?: string[];\n rateLimit: {\n remaining: number;\n resetAt: string | null;\n };\n}\n\n/**\n * Pull response from registry\n */\nexport interface PullResponse {\n patterns: RegistryPattern[];\n pagination: {\n offset: number;\n limit: number;\n total: number;\n hasMore: boolean;\n };\n}\n\n/**\n * Rate limit error details\n */\nexport interface RateLimitError {\n message: string;\n resetAt: string | null;\n remaining: number;\n}\n\n/**\n * Registry client options\n */\nexport interface RegistryClientOptions {\n /**\n * Base URL of the registry API\n * Defaults to https://patterns.workflow-agent.dev\n * Can be overridden via WORKFLOW_REGISTRY_URL env var\n */\n baseUrl?: string;\n\n /**\n * Request timeout in milliseconds\n * Defaults to 30000 (30 seconds)\n */\n timeout?: number;\n\n /**\n * Number of retry attempts for failed requests\n * Defaults to 3\n */\n retries?: number;\n}\n\n/**\n * Registry Client\n *\n * Handles HTTP communication with the pattern registry API\n */\nexport class RegistryClient {\n private readonly baseUrl: string;\n private readonly timeout: number;\n private readonly retries: number;\n\n constructor(options: RegistryClientOptions = {}) {\n // Priority: options > env var > default\n this.baseUrl =\n options.baseUrl ||\n process.env.WORKFLOW_REGISTRY_URL ||\n DEFAULT_REGISTRY_URL;\n\n // Ensure no trailing slash\n this.baseUrl = this.baseUrl.replace(/\\/$/, \"\");\n\n this.timeout = options.timeout ?? 30000;\n this.retries = options.retries ?? 3;\n }\n\n /**\n * Push patterns to the registry\n *\n * @param patterns - Array of anonymized patterns to push\n * @param contributorId - Anonymous contributor ID\n * @returns Push result with count of pushed/skipped patterns\n * @throws Error if rate limited or push fails\n */\n async push(\n patterns: Array<{\n pattern: FixPattern | Blueprint | SolutionPattern;\n type: \"fix\" | \"blueprint\" | \"solution\";\n hash?: string;\n }>,\n contributorId: string,\n ): Promise<PushResponse> {\n const payload = {\n patterns: patterns.map((p) => ({\n id: p.pattern.id,\n type: p.type,\n data: p.pattern as unknown as Record<string, unknown>,\n hash: p.hash,\n })),\n };\n\n const response = await this.request<PushResponse>(\"/api/patterns/push\", {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n \"x-contributor-id\": contributorId,\n },\n body: JSON.stringify(payload),\n });\n\n return response;\n }\n\n /**\n * Pull patterns from the registry\n *\n * @param options - Pull options\n * @returns Array of patterns from the registry\n */\n async pull(\n options: {\n type?: \"fix\" | \"blueprint\" | \"solution\";\n limit?: number;\n offset?: number;\n since?: string;\n } = {},\n ): Promise<PullResponse> {\n const params = new URLSearchParams();\n\n if (options.type) {\n params.set(\"type\", options.type);\n }\n if (options.limit) {\n params.set(\"limit\", options.limit.toString());\n }\n if (options.offset) {\n params.set(\"offset\", options.offset.toString());\n }\n if (options.since) {\n params.set(\"since\", options.since);\n }\n\n const queryString = params.toString();\n const url = `/api/patterns/pull${queryString ? `?${queryString}` : \"\"}`;\n\n return this.request<PullResponse>(url, {\n method: \"GET\",\n });\n }\n\n /**\n * Get a single pattern by ID\n *\n * @param patternId - UUID of the pattern\n * @returns Pattern data or null if not found\n */\n async getPattern(patternId: string): Promise<RegistryPattern | null> {\n try {\n return await this.request<RegistryPattern>(`/api/patterns/${patternId}`, {\n method: \"GET\",\n });\n } catch (error) {\n if (error instanceof RegistryError && error.statusCode === 404) {\n return null;\n }\n throw error;\n }\n }\n\n /**\n * Check if the registry is available\n */\n async healthCheck(): Promise<boolean> {\n try {\n await this.request<{ status: string }>(\"/api/health\", {\n method: \"GET\",\n });\n return true;\n } catch {\n return false;\n }\n }\n\n /**\n * Make an HTTP request to the registry\n */\n private async request<T>(path: string, options: RequestInit): Promise<T> {\n const url = `${this.baseUrl}${path}`;\n let lastError: Error | null = null;\n\n for (let attempt = 1; attempt <= this.retries; attempt++) {\n try {\n const controller = new AbortController();\n const timeoutId = setTimeout(() => controller.abort(), this.timeout);\n\n const response = await fetch(url, {\n ...options,\n signal: controller.signal,\n });\n\n clearTimeout(timeoutId);\n\n if (response.status === 429) {\n // Rate limited\n const body = (await response.json()) as {\n message?: string;\n resetAt?: string | null;\n remaining?: number;\n };\n throw new RateLimitedException(\n body.message || \"Rate limit exceeded\",\n body.resetAt ?? null,\n body.remaining ?? 0,\n );\n }\n\n if (!response.ok) {\n const body = (await response.json().catch(() => ({}))) as {\n error?: string;\n };\n throw new RegistryError(\n body.error || `Request failed with status ${response.status}`,\n response.status,\n body,\n );\n }\n\n return (await response.json()) as T;\n } catch (error) {\n lastError = error instanceof Error ? error : new Error(String(error));\n\n // Don't retry rate limit errors\n if (error instanceof RateLimitedException) {\n throw error;\n }\n\n // Don't retry on 4xx errors (except timeout)\n if (\n error instanceof RegistryError &&\n error.statusCode >= 400 &&\n error.statusCode < 500\n ) {\n throw error;\n }\n\n // Wait before retrying (exponential backoff)\n if (attempt < this.retries) {\n await new Promise((resolve) =>\n setTimeout(resolve, Math.pow(2, attempt) * 1000),\n );\n }\n }\n }\n\n throw lastError ?? new Error(\"Request failed after retries\");\n }\n}\n\n/**\n * Registry API error\n */\nexport class RegistryError extends Error {\n constructor(\n message: string,\n public readonly statusCode: number,\n public readonly body?: unknown,\n ) {\n super(message);\n this.name = \"RegistryError\";\n }\n}\n\n/**\n * Rate limit exceeded error\n */\nexport class RateLimitedException extends Error {\n constructor(\n message: string,\n public readonly resetAt: string | null,\n public readonly remaining: number,\n ) {\n super(message);\n this.name = \"RateLimitedException\";\n }\n\n /**\n * Get human-readable time until rate limit resets\n */\n getTimeUntilReset(): string {\n if (!this.resetAt) {\n return \"unknown\";\n }\n\n const resetTime = new Date(this.resetAt).getTime();\n const now = Date.now();\n const diffMs = resetTime - now;\n\n if (diffMs <= 0) {\n return \"now\";\n }\n\n const minutes = Math.ceil(diffMs / 60000);\n if (minutes < 60) {\n return `${minutes} minute${minutes === 1 ? \"\" : \"s\"}`;\n }\n\n const hours = Math.ceil(minutes / 60);\n return `${hours} hour${hours === 1 ? \"\" : \"s\"}`;\n }\n}\n"],"mappings":";AAiBA,YAAY,OAAO;AACnB,OAAO,WAAW;AAClB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAIK;;;ACZP,IAAM,uBAAuB;AA8EtB,IAAM,iBAAN,MAAqB;AAAA,EACT;AAAA,EACA;AAAA,EACA;AAAA,EAEjB,YAAY,UAAiC,CAAC,GAAG;AAE/C,SAAK,UACH,QAAQ,WACR,QAAQ,IAAI,yBACZ;AAGF,SAAK,UAAU,KAAK,QAAQ,QAAQ,OAAO,EAAE;AAE7C,SAAK,UAAU,QAAQ,WAAW;AAClC,SAAK,UAAU,QAAQ,WAAW;AAAA,EACpC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,MAAM,KACJ,UAKA,eACuB;AACvB,UAAM,UAAU;AAAA,MACd,UAAU,SAAS,IAAI,CAACA,QAAO;AAAA,QAC7B,IAAIA,GAAE,QAAQ;AAAA,QACd,MAAMA,GAAE;AAAA,QACR,MAAMA,GAAE;AAAA,QACR,MAAMA,GAAE;AAAA,MACV,EAAE;AAAA,IACJ;AAEA,UAAM,WAAW,MAAM,KAAK,QAAsB,sBAAsB;AAAA,MACtE,QAAQ;AAAA,MACR,SAAS;AAAA,QACP,gBAAgB;AAAA,QAChB,oBAAoB;AAAA,MACtB;AAAA,MACA,MAAM,KAAK,UAAU,OAAO;AAAA,IAC9B,CAAC;AAED,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,KACJ,UAKI,CAAC,GACkB;AACvB,UAAM,SAAS,IAAI,gBA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