@synchronized-studio/cmsassets-agent 0.1.0 → 0.1.1
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.js +55 -3
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -119,6 +119,31 @@ var initCommand = defineCommand({
|
|
|
119
119
|
description: "Enable LLM fallback for low-confidence patches when AST fails",
|
|
120
120
|
default: false
|
|
121
121
|
},
|
|
122
|
+
"llm-all": {
|
|
123
|
+
type: "boolean",
|
|
124
|
+
description: "Try LLM for any failed AST patch. Requires --llm and OPENAI_API_KEY.",
|
|
125
|
+
default: false
|
|
126
|
+
},
|
|
127
|
+
"llm-only": {
|
|
128
|
+
type: "boolean",
|
|
129
|
+
description: "Skip AST, use LLM for all patches (testing only). Requires OPENAI_API_KEY.",
|
|
130
|
+
default: false
|
|
131
|
+
},
|
|
132
|
+
"ai-verify": {
|
|
133
|
+
type: "boolean",
|
|
134
|
+
description: "Run AI verification after patching to catch missed transforms. Requires OPENAI_API_KEY.",
|
|
135
|
+
default: false
|
|
136
|
+
},
|
|
137
|
+
"ai-model": {
|
|
138
|
+
type: "string",
|
|
139
|
+
description: "OpenAI model for AI verification",
|
|
140
|
+
default: "gpt-4o"
|
|
141
|
+
},
|
|
142
|
+
"ai-max-iterations": {
|
|
143
|
+
type: "string",
|
|
144
|
+
description: "Max AI fix attempts per file",
|
|
145
|
+
default: "3"
|
|
146
|
+
},
|
|
122
147
|
"include-tests": {
|
|
123
148
|
type: "boolean",
|
|
124
149
|
description: "Also patch test/fixture files",
|
|
@@ -162,7 +187,9 @@ var initCommand = defineCommand({
|
|
|
162
187
|
}
|
|
163
188
|
const plan = createPlan(scanResult);
|
|
164
189
|
if (args.slug) plan.env.placeholder = `https://${args.slug}.cmsassets.com`;
|
|
165
|
-
if (args.llm) plan.policies.allowLlmFallback = true;
|
|
190
|
+
if (args.llm || args["llm-only"]) plan.policies.allowLlmFallback = true;
|
|
191
|
+
if (args["llm-all"]) plan.policies.llmFallbackForAll = true;
|
|
192
|
+
if (args["llm-only"]) plan.policies.llmOnly = true;
|
|
166
193
|
if (args["dry-run"]) {
|
|
167
194
|
consola2.log(pc.bold(" Dry Run \u2014 planned changes:"));
|
|
168
195
|
consola2.log("");
|
|
@@ -196,12 +223,37 @@ var initCommand = defineCommand({
|
|
|
196
223
|
includeTests: args["include-tests"]
|
|
197
224
|
});
|
|
198
225
|
applyReport.installed = installed;
|
|
226
|
+
let aiReviewReport;
|
|
227
|
+
if (args["ai-verify"]) {
|
|
228
|
+
const appliedPaths = applyReport.files.filter((f) => f.applied).map((f) => f.filePath);
|
|
229
|
+
if (appliedPaths.length > 0) {
|
|
230
|
+
consola2.log("");
|
|
231
|
+
consola2.log(pc.bold(" CMS Assets Agent \u2014 AI Verification"));
|
|
232
|
+
consola2.log(pc.dim(" \u2500".repeat(25)));
|
|
233
|
+
consola2.log("");
|
|
234
|
+
const { aiReviewAll } = await import("./aiReview-HZKRPSUV.js");
|
|
235
|
+
aiReviewReport = await aiReviewAll(root, appliedPaths, plan, {
|
|
236
|
+
model: args["ai-model"] ?? "gpt-4o",
|
|
237
|
+
maxIterations: parseInt(args["ai-max-iterations"] ?? "3", 10)
|
|
238
|
+
});
|
|
239
|
+
consola2.log("");
|
|
240
|
+
consola2.log(` ${pc.green("Passed:")} ${aiReviewReport.filesPassed} files`);
|
|
241
|
+
if (aiReviewReport.filesFixed > 0) {
|
|
242
|
+
consola2.log(` ${pc.blue("Fixed:")} ${aiReviewReport.filesFixed} files`);
|
|
243
|
+
}
|
|
244
|
+
if (aiReviewReport.filesFailed > 0) {
|
|
245
|
+
consola2.log(` ${pc.red("Failed:")} ${aiReviewReport.filesFailed} files`);
|
|
246
|
+
}
|
|
247
|
+
consola2.log(` ${pc.dim(`Tokens used: ${aiReviewReport.tokensUsed}`)}`);
|
|
248
|
+
consola2.log("");
|
|
249
|
+
}
|
|
250
|
+
}
|
|
199
251
|
let scriptAdded = false;
|
|
200
252
|
if (!args["no-script"]) {
|
|
201
253
|
const result = injectNpmScript(root);
|
|
202
254
|
scriptAdded = result.added;
|
|
203
255
|
}
|
|
204
|
-
const report = createReport({ apply: applyReport, plan, scan: scanResult });
|
|
256
|
+
const report = createReport({ apply: applyReport, plan, scan: scanResult, aiReview: aiReviewReport });
|
|
205
257
|
saveReport(root, report);
|
|
206
258
|
const applied = applyReport.files.filter((f) => f.applied);
|
|
207
259
|
const skipped = applyReport.files.filter((f) => !f.applied);
|
|
@@ -919,7 +971,7 @@ var rollbackCommand = defineCommand7({
|
|
|
919
971
|
var main = defineCommand8({
|
|
920
972
|
meta: {
|
|
921
973
|
name: "cmsassets-agent",
|
|
922
|
-
version: "0.1.
|
|
974
|
+
version: "0.1.1",
|
|
923
975
|
description: "Auto-integrate @synchronized-studio/response-transformer into any JS/TS project."
|
|
924
976
|
},
|
|
925
977
|
subCommands: {
|
package/package.json
CHANGED