workflow-agent-cli 2.22.7 → 2.22.9
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/dist/{chunk-2QPX6LZF.js → chunk-MMPXQG3O.js} +24 -3
- package/dist/chunk-MMPXQG3O.js.map +1 -0
- package/dist/cli/index.js +50 -10
- package/dist/cli/index.js.map +1 -1
- package/dist/sync-ON7M53OC.js +7 -0
- package/package.json +1 -1
- package/dist/chunk-2QPX6LZF.js.map +0 -1
- package/dist/sync-RPVMAAG7.js +0 -7
- /package/dist/{sync-RPVMAAG7.js.map → sync-ON7M53OC.js.map} +0 -0
|
@@ -278,6 +278,7 @@ async function syncCommand(options) {
|
|
|
278
278
|
if (options.includePrivate) console.log(chalk.dim(" \u2022 Including private patterns"));
|
|
279
279
|
console.log("");
|
|
280
280
|
const store = new PatternStore(cwd);
|
|
281
|
+
await store.initialize();
|
|
281
282
|
const anonymizer = new PatternAnonymizer();
|
|
282
283
|
const syncData = await store.getPatternsForSync();
|
|
283
284
|
let fixes = syncData.fixes ?? [];
|
|
@@ -347,8 +348,9 @@ async function syncCommand(options) {
|
|
|
347
348
|
const allSolutions = await store.listSolutions({ includeDeprecated: false });
|
|
348
349
|
for (const sol of allSolutions.data ?? []) {
|
|
349
350
|
if (sol.isPrivate) {
|
|
350
|
-
|
|
351
|
-
|
|
351
|
+
const updated = { ...sol, isPrivate: false, updatedAt: (/* @__PURE__ */ new Date()).toISOString() };
|
|
352
|
+
await store.saveSolution(updated);
|
|
353
|
+
solutions.push(updated);
|
|
352
354
|
}
|
|
353
355
|
}
|
|
354
356
|
console.log(chalk.green(` \u2713 Migrated ${privateCount} solutions to public`));
|
|
@@ -356,6 +358,25 @@ async function syncCommand(options) {
|
|
|
356
358
|
} else if (publicCount === 0 && privateCount > 0) {
|
|
357
359
|
console.log(chalk.yellow(` Found 0 solutions ready to sync (${privateCount} are private)`));
|
|
358
360
|
console.log(chalk.dim(` Use --include-private to include them, or run 'workflow solution migrate --public'`));
|
|
361
|
+
} else if (publicCount === 0 && privateCount === 0) {
|
|
362
|
+
const validationErrors = store.getValidationErrors();
|
|
363
|
+
const solutionErrors = validationErrors.filter((e) => e.type === "solution");
|
|
364
|
+
if (solutionErrors.length > 0) {
|
|
365
|
+
console.log(chalk.yellow(` Found 0 solutions (${solutionErrors.length} failed schema validation)`));
|
|
366
|
+
for (const err of solutionErrors) {
|
|
367
|
+
console.log(chalk.dim(` \u2022 ${err.file}: ${err.error}`));
|
|
368
|
+
if (err.details) {
|
|
369
|
+
for (const detail of err.details.slice(0, 3)) {
|
|
370
|
+
console.log(chalk.dim(` - ${detail}`));
|
|
371
|
+
}
|
|
372
|
+
if (err.details.length > 3) {
|
|
373
|
+
console.log(chalk.dim(` ... and ${err.details.length - 3} more issues`));
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
} else {
|
|
378
|
+
console.log(chalk.dim(` Found 0 solutions to sync`));
|
|
379
|
+
}
|
|
359
380
|
} else {
|
|
360
381
|
console.log(chalk.dim(` Found ${publicCount} solutions ready to sync`));
|
|
361
382
|
}
|
|
@@ -552,4 +573,4 @@ async function syncCommand(options) {
|
|
|
552
573
|
export {
|
|
553
574
|
syncCommand
|
|
554
575
|
};
|
|
555
|
-
//# sourceMappingURL=chunk-
|
|
576
|
+
//# sourceMappingURL=chunk-MMPXQG3O.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 await store.saveFixPattern(pulled.data as FixPattern);\n savedCount++;\n } else if (pulled.type === \"blueprint\" && pulled.data) {\n await store.saveBlueprint(pulled.data as Blueprint);\n savedCount++;\n } else if (pulled.type === \"solution\" && pulled.data) {\n await store.saveSolution(pulled.data as SolutionPattern);\n savedCount++;\n }\n } catch {\n // Pattern might already exist\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":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AAAA,cACJ,qBAAqB,MAAM,kBAAkB,CAAC;AAAA,YAChD;AAAA,UACF;AAAA,QACF,WAAW,iBAAiB,eAAe;AACzC,kBAAQ,IAAI,MAAM,IAAI;AAAA,2BAAyB,MAAM,OAAO,EAAE,CAAC;AAAA,QACjE,OAAO;AACL,kBAAQ;AAAA,YACN,MAAM;AAAA,cACJ;AAAA,2BAAyB,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,CAAC;AAAA,YACjF;AAAA,UACF;AAAA,QACF;AACA,gBAAQ,KAAK,CAAC;AAAA,MAChB;AAAA,IACF;AAAA,EACF;AAEA,EAAE,QAAM,MAAM,MAAM,gBAAgB,CAAC;AACvC;","names":["p","p"]}
|
package/dist/cli/index.js
CHANGED
|
@@ -40,7 +40,7 @@ import {
|
|
|
40
40
|
import "../chunk-3ADL5QDN.js";
|
|
41
41
|
import {
|
|
42
42
|
syncCommand
|
|
43
|
-
} from "../chunk-
|
|
43
|
+
} from "../chunk-MMPXQG3O.js";
|
|
44
44
|
|
|
45
45
|
// src/cli/index.ts
|
|
46
46
|
import { Command as Command7 } from "commander";
|
|
@@ -5444,9 +5444,15 @@ async function solutionCaptureCommand(options) {
|
|
|
5444
5444
|
p11.cancel("Solution not saved");
|
|
5445
5445
|
process.exit(0);
|
|
5446
5446
|
}
|
|
5447
|
-
await store.saveSolution(pattern);
|
|
5447
|
+
const saveResult = await store.saveSolution(pattern);
|
|
5448
|
+
if (!saveResult.success) {
|
|
5449
|
+
console.error(chalk18.red(`
|
|
5450
|
+
\u2717 Failed to save solution: ${saveResult.error}
|
|
5451
|
+
`));
|
|
5452
|
+
process.exit(1);
|
|
5453
|
+
}
|
|
5448
5454
|
console.log(chalk18.green(`
|
|
5449
|
-
\u2713 Solution saved
|
|
5455
|
+
\u2713 Solution saved: .workflow/patterns/solutions/${pattern.id}.json
|
|
5450
5456
|
`));
|
|
5451
5457
|
} catch (error) {
|
|
5452
5458
|
spinner10.stop("Analysis failed");
|
|
@@ -5795,13 +5801,35 @@ async function solutionCreateCommand(options) {
|
|
|
5795
5801
|
name,
|
|
5796
5802
|
description,
|
|
5797
5803
|
category,
|
|
5798
|
-
keywords,
|
|
5804
|
+
tags: keywords.map((k) => ({ name: k, category })),
|
|
5805
|
+
problem: {
|
|
5806
|
+
description,
|
|
5807
|
+
keywords,
|
|
5808
|
+
symptoms: [],
|
|
5809
|
+
impact: "To be documented",
|
|
5810
|
+
errorPatterns: []
|
|
5811
|
+
},
|
|
5799
5812
|
implementation: {
|
|
5800
|
-
files: [
|
|
5813
|
+
files: [
|
|
5814
|
+
{
|
|
5815
|
+
path: "placeholder.ts",
|
|
5816
|
+
purpose: "Placeholder - add actual files with solution capture",
|
|
5817
|
+
role: "service",
|
|
5818
|
+
content: "",
|
|
5819
|
+
exports: [],
|
|
5820
|
+
imports: [],
|
|
5821
|
+
lineCount: 1
|
|
5822
|
+
}
|
|
5823
|
+
],
|
|
5801
5824
|
dependencies: [],
|
|
5802
5825
|
devDependencies: [],
|
|
5803
5826
|
envVars: []
|
|
5804
5827
|
},
|
|
5828
|
+
architecture: {
|
|
5829
|
+
entryPoints: [],
|
|
5830
|
+
dataFlow: "To be documented",
|
|
5831
|
+
keyDecisions: []
|
|
5832
|
+
},
|
|
5805
5833
|
compatibility: {
|
|
5806
5834
|
framework,
|
|
5807
5835
|
frameworkVersion: ">=1.0.0",
|
|
@@ -5815,13 +5843,21 @@ async function solutionCreateCommand(options) {
|
|
|
5815
5843
|
failures: 0,
|
|
5816
5844
|
successRate: 0
|
|
5817
5845
|
},
|
|
5846
|
+
relatedPatterns: [],
|
|
5847
|
+
source: "manual",
|
|
5818
5848
|
isPrivate: true,
|
|
5819
5849
|
createdAt: now,
|
|
5820
5850
|
updatedAt: now
|
|
5821
5851
|
};
|
|
5822
|
-
await store.saveSolution(solution);
|
|
5852
|
+
const saveResult = await store.saveSolution(solution);
|
|
5853
|
+
if (!saveResult.success) {
|
|
5854
|
+
console.error(chalk18.red(`
|
|
5855
|
+
\u2717 Failed to save solution: ${saveResult.error}
|
|
5856
|
+
`));
|
|
5857
|
+
process.exit(1);
|
|
5858
|
+
}
|
|
5823
5859
|
console.log(chalk18.green("\n\u2713 Solution pattern created!\n"));
|
|
5824
|
-
console.log(chalk18.dim(`
|
|
5860
|
+
console.log(chalk18.dim(` Path: .workflow/patterns/solutions/${solution.id}.json`));
|
|
5825
5861
|
console.log(chalk18.dim(` Name: ${name}`));
|
|
5826
5862
|
console.log(chalk18.dim(` Category: ${category}`));
|
|
5827
5863
|
console.log(chalk18.dim(`
|
|
@@ -5989,7 +6025,11 @@ async function solutionImportCommand(file, options) {
|
|
|
5989
6025
|
skipped++;
|
|
5990
6026
|
continue;
|
|
5991
6027
|
}
|
|
5992
|
-
await store.saveSolution(solution);
|
|
6028
|
+
const saveResult = await store.saveSolution(solution);
|
|
6029
|
+
if (!saveResult.success) {
|
|
6030
|
+
console.log(chalk18.red(` \u2717 Failed to import: ${solution.name} - ${saveResult.error}`));
|
|
6031
|
+
continue;
|
|
6032
|
+
}
|
|
5993
6033
|
console.log(chalk18.green(` \u2713 Imported: ${solution.name}`));
|
|
5994
6034
|
imported++;
|
|
5995
6035
|
}
|
|
@@ -8258,7 +8298,7 @@ ${chalk21.bold("Pro Tip:")}
|
|
|
8258
8298
|
$ workflow sync --all ${chalk21.dim("# Sync everything")}
|
|
8259
8299
|
`
|
|
8260
8300
|
).action(async (options) => {
|
|
8261
|
-
const { syncCommand: syncCommand2 } = await import("../sync-
|
|
8301
|
+
const { syncCommand: syncCommand2 } = await import("../sync-ON7M53OC.js");
|
|
8262
8302
|
return syncCommand2({ ...options, learn: true });
|
|
8263
8303
|
});
|
|
8264
8304
|
learnCmd.command("config").description("Configure learning settings").option("--enable-sync", "Enable pattern sync").option("--disable-sync", "Disable pattern sync").option("--enable-telemetry", "Enable anonymous telemetry").option("--disable-telemetry", "Disable telemetry").option("--reset-id", "Reset contributor ID").option("--show", "Show current configuration").addHelpText(
|
|
@@ -8455,7 +8495,7 @@ async function scopeRemoveCommand(name) {
|
|
|
8455
8495
|
}
|
|
8456
8496
|
async function scopeSyncCommand(options) {
|
|
8457
8497
|
console.log(chalk22.bold.cyan("\n\u{1F504} Syncing Scopes\n"));
|
|
8458
|
-
const { syncCommand: syncCommand2 } = await import("../sync-
|
|
8498
|
+
const { syncCommand: syncCommand2 } = await import("../sync-ON7M53OC.js");
|
|
8459
8499
|
await syncCommand2({
|
|
8460
8500
|
...options,
|
|
8461
8501
|
scopes: true,
|