workflow-agent-cli 2.11.0 → 2.12.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/dist/cli/index.js +150 -0
- package/dist/cli/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -5807,6 +5807,155 @@ async function learnConfigCommand(options) {
|
|
|
5807
5807
|
);
|
|
5808
5808
|
}
|
|
5809
5809
|
}
|
|
5810
|
+
async function learnPublishCommand(patternId, options) {
|
|
5811
|
+
const cwd = getWorkspacePath();
|
|
5812
|
+
const store = new PatternStore2(cwd);
|
|
5813
|
+
const makePrivate = options.private ?? false;
|
|
5814
|
+
const actionWord = makePrivate ? "private" : "public";
|
|
5815
|
+
const emoji = makePrivate ? "\u{1F512}" : "\u{1F310}";
|
|
5816
|
+
console.log(chalk16.cyan(`
|
|
5817
|
+
${emoji} Mark Pattern(s) ${actionWord}
|
|
5818
|
+
`));
|
|
5819
|
+
if (options.all) {
|
|
5820
|
+
const fixesResult = await store.listFixPatterns({});
|
|
5821
|
+
const blueprintsResult = await store.listBlueprints({});
|
|
5822
|
+
const allFixes = fixesResult.success && fixesResult.data ? fixesResult.data : [];
|
|
5823
|
+
const allBlueprints = blueprintsResult.success && blueprintsResult.data ? blueprintsResult.data : [];
|
|
5824
|
+
const fixesToUpdate = allFixes.filter((p13) => p13.isPrivate !== makePrivate);
|
|
5825
|
+
const blueprintsToUpdate = allBlueprints.filter(
|
|
5826
|
+
(p13) => p13.isPrivate !== makePrivate
|
|
5827
|
+
);
|
|
5828
|
+
const totalToUpdate = fixesToUpdate.length + blueprintsToUpdate.length;
|
|
5829
|
+
if (totalToUpdate === 0) {
|
|
5830
|
+
console.log(
|
|
5831
|
+
chalk16.yellow(` All patterns are already ${actionWord}. Nothing to do.`)
|
|
5832
|
+
);
|
|
5833
|
+
return;
|
|
5834
|
+
}
|
|
5835
|
+
console.log(
|
|
5836
|
+
chalk16.white(
|
|
5837
|
+
` Found ${totalToUpdate} pattern(s) to mark as ${actionWord}:`
|
|
5838
|
+
)
|
|
5839
|
+
);
|
|
5840
|
+
console.log(chalk16.dim(` Fix Patterns: ${fixesToUpdate.length}`));
|
|
5841
|
+
console.log(chalk16.dim(` Blueprints: ${blueprintsToUpdate.length}`));
|
|
5842
|
+
if (!options.yes) {
|
|
5843
|
+
const confirmed = await p11.confirm({
|
|
5844
|
+
message: `Mark all ${totalToUpdate} patterns as ${actionWord}?`,
|
|
5845
|
+
initialValue: false
|
|
5846
|
+
});
|
|
5847
|
+
if (p11.isCancel(confirmed) || !confirmed) {
|
|
5848
|
+
p11.cancel("Cancelled");
|
|
5849
|
+
return;
|
|
5850
|
+
}
|
|
5851
|
+
}
|
|
5852
|
+
let successCount = 0;
|
|
5853
|
+
let failCount = 0;
|
|
5854
|
+
for (const pattern2 of fixesToUpdate) {
|
|
5855
|
+
const result2 = await store.saveFixPattern({
|
|
5856
|
+
...pattern2,
|
|
5857
|
+
isPrivate: makePrivate,
|
|
5858
|
+
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
5859
|
+
});
|
|
5860
|
+
if (result2.success) {
|
|
5861
|
+
successCount++;
|
|
5862
|
+
} else {
|
|
5863
|
+
failCount++;
|
|
5864
|
+
}
|
|
5865
|
+
}
|
|
5866
|
+
for (const blueprint of blueprintsToUpdate) {
|
|
5867
|
+
const result2 = await store.saveBlueprint({
|
|
5868
|
+
...blueprint,
|
|
5869
|
+
isPrivate: makePrivate,
|
|
5870
|
+
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
5871
|
+
});
|
|
5872
|
+
if (result2.success) {
|
|
5873
|
+
successCount++;
|
|
5874
|
+
} else {
|
|
5875
|
+
failCount++;
|
|
5876
|
+
}
|
|
5877
|
+
}
|
|
5878
|
+
console.log(
|
|
5879
|
+
chalk16.green(`
|
|
5880
|
+
\u2705 Updated ${successCount} pattern(s) to ${actionWord}`)
|
|
5881
|
+
);
|
|
5882
|
+
if (failCount > 0) {
|
|
5883
|
+
console.log(chalk16.red(`\u274C Failed to update ${failCount} pattern(s)`));
|
|
5884
|
+
}
|
|
5885
|
+
return;
|
|
5886
|
+
}
|
|
5887
|
+
if (!patternId) {
|
|
5888
|
+
console.log(chalk16.red("\u274C Pattern ID is required"));
|
|
5889
|
+
console.log(
|
|
5890
|
+
chalk16.dim(" Usage: workflow learn:publish <patternId> [--private]")
|
|
5891
|
+
);
|
|
5892
|
+
console.log(
|
|
5893
|
+
chalk16.dim(" workflow learn:publish --all [--private]")
|
|
5894
|
+
);
|
|
5895
|
+
process.exit(1);
|
|
5896
|
+
}
|
|
5897
|
+
let patternType = "fix";
|
|
5898
|
+
let pattern = await store.getFixPattern(patternId);
|
|
5899
|
+
if (!pattern.success || !pattern.data) {
|
|
5900
|
+
const bpResult = await store.getBlueprint(patternId);
|
|
5901
|
+
if (bpResult.success && bpResult.data) {
|
|
5902
|
+
pattern = bpResult;
|
|
5903
|
+
patternType = "blueprint";
|
|
5904
|
+
} else {
|
|
5905
|
+
console.log(chalk16.red(`
|
|
5906
|
+
\u274C Pattern not found: ${patternId}`));
|
|
5907
|
+
console.log(
|
|
5908
|
+
chalk16.dim(" Use 'workflow learn:list' to see available patterns")
|
|
5909
|
+
);
|
|
5910
|
+
process.exit(1);
|
|
5911
|
+
}
|
|
5912
|
+
}
|
|
5913
|
+
const currentStatus = pattern.data.isPrivate ? "private" : "public";
|
|
5914
|
+
if (pattern.data.isPrivate === makePrivate) {
|
|
5915
|
+
console.log(
|
|
5916
|
+
chalk16.yellow(` Pattern is already ${actionWord}. Nothing to do.`)
|
|
5917
|
+
);
|
|
5918
|
+
console.log(chalk16.dim(` Name: ${pattern.data.name}`));
|
|
5919
|
+
return;
|
|
5920
|
+
}
|
|
5921
|
+
console.log(chalk16.white(` Pattern: ${pattern.data.name}`));
|
|
5922
|
+
console.log(chalk16.dim(` Type: ${patternType}`));
|
|
5923
|
+
console.log(chalk16.dim(` Current: ${currentStatus} \u2192 ${actionWord}`));
|
|
5924
|
+
if (!options.yes) {
|
|
5925
|
+
const confirmed = await p11.confirm({
|
|
5926
|
+
message: `Mark this pattern as ${actionWord}?`,
|
|
5927
|
+
initialValue: true
|
|
5928
|
+
});
|
|
5929
|
+
if (p11.isCancel(confirmed) || !confirmed) {
|
|
5930
|
+
p11.cancel("Cancelled");
|
|
5931
|
+
return;
|
|
5932
|
+
}
|
|
5933
|
+
}
|
|
5934
|
+
const updatedPattern = {
|
|
5935
|
+
...pattern.data,
|
|
5936
|
+
isPrivate: makePrivate,
|
|
5937
|
+
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
5938
|
+
};
|
|
5939
|
+
let result;
|
|
5940
|
+
if (patternType === "fix") {
|
|
5941
|
+
result = await store.saveFixPattern(updatedPattern);
|
|
5942
|
+
} else {
|
|
5943
|
+
result = await store.saveBlueprint(updatedPattern);
|
|
5944
|
+
}
|
|
5945
|
+
if (result.success) {
|
|
5946
|
+
console.log(chalk16.green(`
|
|
5947
|
+
\u2705 Pattern marked as ${actionWord}`));
|
|
5948
|
+
if (!makePrivate) {
|
|
5949
|
+
console.log(
|
|
5950
|
+
chalk16.dim(" Run 'workflow learn:sync --push' to upload to registry")
|
|
5951
|
+
);
|
|
5952
|
+
}
|
|
5953
|
+
} else {
|
|
5954
|
+
console.log(chalk16.red(`
|
|
5955
|
+
\u274C Failed: ${result.error}`));
|
|
5956
|
+
process.exit(1);
|
|
5957
|
+
}
|
|
5958
|
+
}
|
|
5810
5959
|
async function learnDeprecateCommand(patternId, reason) {
|
|
5811
5960
|
const cwd = getWorkspacePath();
|
|
5812
5961
|
const store = new PatternStore2(cwd);
|
|
@@ -6394,6 +6543,7 @@ program.command("learn:apply <patternId>").description("Apply a pattern to the c
|
|
|
6394
6543
|
program.command("learn:sync").description("Sync patterns with remote registry").option("--push", "Push local patterns to registry").option("--pull", "Pull patterns from registry").option("--dry-run", "Preview without syncing").action(learnSyncCommand);
|
|
6395
6544
|
program.command("learn: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").action(learnConfigCommand);
|
|
6396
6545
|
program.command("learn:deprecate <patternId> <reason>").description("Deprecate an outdated pattern").argument("<patternId>", "Pattern ID to deprecate").argument("<reason>", "Reason for deprecation").action(learnDeprecateCommand);
|
|
6546
|
+
program.command("learn:publish [patternId]").description("Mark pattern(s) as public for syncing").option("--private", "Mark as private instead of public").option("--all", "Apply to all patterns").option("-y, --yes", "Skip confirmation prompts").action(learnPublishCommand);
|
|
6397
6547
|
program.command("learn:stats").description("Show learning statistics").action(learnStatsCommand);
|
|
6398
6548
|
program.command("solution:capture").description("Capture a solution pattern from working code").option("--name <name>", "Solution name").option("--description <desc>", "Solution description").option(
|
|
6399
6549
|
"--category <cat>",
|