workflow-agent-cli 2.22.11 → 2.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/dist/{chunk-MMPXQG3O.js → chunk-M6RHIUSM.js} +10 -4
- package/dist/chunk-M6RHIUSM.js.map +1 -0
- package/dist/cli/index.js +319 -104
- package/dist/cli/index.js.map +1 -1
- package/dist/scripts/postinstall.js +0 -0
- package/dist/sync-6T5TD4QS.js +7 -0
- package/package.json +30 -31
- package/dist/chunk-MMPXQG3O.js.map +0 -1
- package/dist/sync-ON7M53OC.js +0 -7
- /package/dist/{sync-ON7M53OC.js.map → sync-6T5TD4QS.js.map} +0 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Workflow Agent Team
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -512,13 +512,19 @@ async function syncCommand(options) {
|
|
|
512
512
|
for (const pulled of pullResult.patterns) {
|
|
513
513
|
try {
|
|
514
514
|
if (pulled.type === "fix" && pulled.data) {
|
|
515
|
-
|
|
515
|
+
const fixData = pulled.data;
|
|
516
|
+
await store.saveFixPattern(fixData);
|
|
517
|
+
console.log(chalk.dim(` \u2713 ${fixData.name} (fix)`));
|
|
516
518
|
savedCount++;
|
|
517
519
|
} else if (pulled.type === "blueprint" && pulled.data) {
|
|
518
|
-
|
|
520
|
+
const blueprintData = pulled.data;
|
|
521
|
+
await store.saveBlueprint(blueprintData);
|
|
522
|
+
console.log(chalk.dim(` \u2713 ${blueprintData.name} (blueprint)`));
|
|
519
523
|
savedCount++;
|
|
520
524
|
} else if (pulled.type === "solution" && pulled.data) {
|
|
521
|
-
|
|
525
|
+
const solutionData = pulled.data;
|
|
526
|
+
await store.saveSolution(solutionData);
|
|
527
|
+
console.log(chalk.dim(` \u2713 ${solutionData.name} (solution)`));
|
|
522
528
|
savedCount++;
|
|
523
529
|
}
|
|
524
530
|
} catch {
|
|
@@ -573,4 +579,4 @@ async function syncCommand(options) {
|
|
|
573
579
|
export {
|
|
574
580
|
syncCommand
|
|
575
581
|
};
|
|
576
|
-
//# sourceMappingURL=chunk-
|
|
582
|
+
//# sourceMappingURL=chunk-M6RHIUSM.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(chalk.dim(\" Your anonymized patterns can now be shared with the community.\\n\"));\n } else {\n console.log(chalk.red(`\\n❌ Failed to enable sync: ${enableResult.error}\\n`));\n process.exit(1);\n }\n // If only --enable-sync was passed, exit after enabling\n if (!options.push && !options.pull && !options.all && !options.solutions && !options.scopes) {\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(chalk.red(`\\n❌ Failed to disable sync: ${disableResult.error}\\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 = 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) 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(chalk.dim(` • Direction: ${direction === \"both\" ? \"push + pull\" : direction}`));\n if (options.includePrivate) 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 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 // 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({ includeDeprecated: false });\n const allSolutions = await store.listSolutions({ includeDeprecated: false });\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(chalk.dim(` Found ${publicCount} fixes, ${blueprints.length} blueprints to sync (including private)`));\n } else if (publicCount === 0 && privateCount > 0) {\n console.log(chalk.yellow(` Found 0 fixes ready to sync (${privateCount} are private)`));\n console.log(chalk.dim(` Use --include-private to include them, or run 'workflow learn migrate --public'`));\n } else {\n console.log(chalk.dim(` Found ${publicCount} fixes, ${blueprints.length} blueprints ready to sync`));\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(chalk.dim(` Found ${publicCount} solutions to sync (including private)`));\n } else if (publicCount === 0 && privateCount > 0 && !options.dryRun) {\n console.log(chalk.yellow(` Found 0 solutions ready to sync (${privateCount} are private)`));\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(chalk.dim(` Skipping private solutions. Use --include-private to force include them.`));\n } else {\n // Migrate all private solutions to public\n const allSolutions = await store.listSolutions({ includeDeprecated: false });\n for (const sol of allSolutions.data ?? []) {\n if (sol.isPrivate) {\n const updated = { ...sol, isPrivate: false, updatedAt: new Date().toISOString() };\n await store.saveSolution(updated);\n solutions.push(updated);\n }\n }\n console.log(chalk.green(` ✓ Migrated ${privateCount} solutions to public`));\n }\n } else if (publicCount === 0 && privateCount > 0) {\n // Dry run mode - just show the message\n console.log(chalk.yellow(` Found 0 solutions ready to sync (${privateCount} are private)`));\n console.log(chalk.dim(` Use --include-private to include them, or run 'workflow solution migrate --public'`));\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((e) => e.type === \"solution\");\n if (solutionErrors.length > 0) {\n console.log(chalk.yellow(` Found 0 solutions (${solutionErrors.length} failed schema validation)`));\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(chalk.dim(` ... and ${err.details.length - 3} more issues`));\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((p) => p.type === \"blueprint\").length;\n const solutionCount = patternsToSync.filter((p) => p.type === \"solution\").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(chalk.yellow(\"\\n [DRY-RUN] Would push patterns to registry\"));\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 ✅ Pushed ${pushResult.pushed} patterns to registry`),\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(\n ` Try again in ${error.getTimeUntilReset()}`,\n ),\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(chalk.yellow(\" [DRY-RUN] Would pull patterns from registry\"));\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(chalk.dim(` Registry has ${typeCounts[\"solution\"]} solution(s) available`));\n }\n if (syncLearn) {\n const fixCount = typeCounts[\"fix\"] ?? 0;\n const bpCount = typeCounts[\"blueprint\"] ?? 0;\n console.log(chalk.dim(` Registry has ${fixCount} fix(es), ${bpCount} blueprint(s) available`));\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 ✅ Pulled ${savedCount} new patterns from registry`),\n );\n if (savedCount < totalPatterns) {\n console.log(chalk.dim(` (${totalPatterns - savedCount} already existed locally)`));\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(\n ` Try again in ${error.getTimeUntilReset()}`,\n ),\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 { FixPattern, Blueprint, SolutionPattern } 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>(\n \"/api/patterns/push\",\n {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n \"x-contributor-id\": contributorId,\n },\n body: JSON.stringify(payload),\n },\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(options: {\n type?: \"fix\" | \"blueprint\" | \"solution\";\n limit?: number;\n offset?: number;\n since?: string;\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>(\n path: string,\n options: RequestInit,\n ): 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 { message?: string; resetAt?: string | null; remaining?: number };\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 { error?: string };\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;;;AChBP,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;AAAA,MAC1B;AAAA,MACA;AAAA,QACE,QAAQ;AAAA,QACR,SAAS;AAAA,UACP,gBAAgB;AAAA,UAChB,oBAAoB;AAAA,QACtB;AAAA,QACA,MAAM,KAAK,UAAU,OAAO;AAAA,MAC9B;AAAA,IACF;AAEA,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,KAAK,UAKP,CAAC,G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