@synchronized-studio/cmsassets-agent 0.1.1 → 0.1.3
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/aiReview-6WOTHK5N.js +9 -0
- package/dist/chunk-E74TGIFQ.js +88 -0
- package/dist/chunk-OAWCNTAC.js +397 -0
- package/dist/chunk-Q6VYUIS7.js +1035 -0
- package/dist/chunk-WDZHZ32V.js +1433 -0
- package/dist/cli.js +82 -42
- package/dist/index.js +4 -3
- package/dist/openaiClient-YGAFYB3X.js +11 -0
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -9,8 +9,9 @@ import {
|
|
|
9
9
|
saveReport,
|
|
10
10
|
scan,
|
|
11
11
|
verify
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import "./chunk-
|
|
12
|
+
} from "./chunk-WDZHZ32V.js";
|
|
13
|
+
import "./chunk-Q6VYUIS7.js";
|
|
14
|
+
import "./chunk-E74TGIFQ.js";
|
|
14
15
|
import "./chunk-QGM4M3NI.js";
|
|
15
16
|
|
|
16
17
|
// src/cli.ts
|
|
@@ -67,6 +68,18 @@ function confirm(question) {
|
|
|
67
68
|
});
|
|
68
69
|
});
|
|
69
70
|
}
|
|
71
|
+
function getOpenAiInstallCommand(packageManager) {
|
|
72
|
+
switch (packageManager) {
|
|
73
|
+
case "pnpm":
|
|
74
|
+
return "pnpm add openai";
|
|
75
|
+
case "yarn":
|
|
76
|
+
return "yarn add openai";
|
|
77
|
+
case "bun":
|
|
78
|
+
return "bun add openai";
|
|
79
|
+
default:
|
|
80
|
+
return "npm install openai";
|
|
81
|
+
}
|
|
82
|
+
}
|
|
70
83
|
var initCommand = defineCommand({
|
|
71
84
|
meta: {
|
|
72
85
|
name: "init",
|
|
@@ -227,25 +240,43 @@ var initCommand = defineCommand({
|
|
|
227
240
|
if (args["ai-verify"]) {
|
|
228
241
|
const appliedPaths = applyReport.files.filter((f) => f.applied).map((f) => f.filePath);
|
|
229
242
|
if (appliedPaths.length > 0) {
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
+
const { checkAiVerifyReady } = await import("./openaiClient-YGAFYB3X.js");
|
|
244
|
+
let ready = await checkAiVerifyReady(root);
|
|
245
|
+
if (!ready.ok && ready.canInstallInProject) {
|
|
246
|
+
const openaiInstallCmd = getOpenAiInstallCommand(scanResult.packageManager);
|
|
247
|
+
consola2.info(`Installing openai in project: ${openaiInstallCmd}`);
|
|
248
|
+
try {
|
|
249
|
+
const { execSync } = await import("child_process");
|
|
250
|
+
execSync(openaiInstallCmd, { cwd: root, stdio: "inherit" });
|
|
251
|
+
ready = await checkAiVerifyReady(root);
|
|
252
|
+
} catch {
|
|
253
|
+
consola2.warn("Installing openai failed. AI verification skipped.");
|
|
254
|
+
ready = { ok: false };
|
|
255
|
+
}
|
|
243
256
|
}
|
|
244
|
-
if (
|
|
245
|
-
consola2.
|
|
257
|
+
if (!ready.ok) {
|
|
258
|
+
consola2.warn(` ${pc.yellow("AI Verification skipped:")} ${ready.reason}`);
|
|
259
|
+
} else {
|
|
260
|
+
consola2.log("");
|
|
261
|
+
consola2.log(pc.bold(" CMS Assets Agent \u2014 AI Verification"));
|
|
262
|
+
consola2.log(pc.dim(" \u2500".repeat(25)));
|
|
263
|
+
consola2.log("");
|
|
264
|
+
const { aiReviewAll } = await import("./aiReview-6WOTHK5N.js");
|
|
265
|
+
aiReviewReport = await aiReviewAll(root, appliedPaths, plan, {
|
|
266
|
+
model: args["ai-model"] ?? "gpt-4o",
|
|
267
|
+
maxIterations: parseInt(args["ai-max-iterations"] ?? "3", 10)
|
|
268
|
+
});
|
|
269
|
+
consola2.log("");
|
|
270
|
+
consola2.log(` ${pc.green("Passed:")} ${aiReviewReport.filesPassed} files`);
|
|
271
|
+
if (aiReviewReport.filesFixed > 0) {
|
|
272
|
+
consola2.log(` ${pc.blue("Fixed:")} ${aiReviewReport.filesFixed} files`);
|
|
273
|
+
}
|
|
274
|
+
if (aiReviewReport.filesFailed > 0) {
|
|
275
|
+
consola2.log(` ${pc.red("Failed:")} ${aiReviewReport.filesFailed} files`);
|
|
276
|
+
}
|
|
277
|
+
consola2.log(` ${pc.dim(`Tokens used: ${aiReviewReport.tokensUsed}`)}`);
|
|
278
|
+
consola2.log("");
|
|
246
279
|
}
|
|
247
|
-
consola2.log(` ${pc.dim(`Tokens used: ${aiReviewReport.tokensUsed}`)}`);
|
|
248
|
-
consola2.log("");
|
|
249
280
|
}
|
|
250
281
|
}
|
|
251
282
|
let scriptAdded = false;
|
|
@@ -282,6 +313,9 @@ var initCommand = defineCommand({
|
|
|
282
313
|
if (scriptAdded) {
|
|
283
314
|
consola2.log(` ${pc.dim("Re-run later with:")} ${pc.cyan("npm run cmsassets:transform")}`);
|
|
284
315
|
}
|
|
316
|
+
if (!args["ai-verify"] && applied.length > 0) {
|
|
317
|
+
consola2.log(` ${pc.dim("Optional:")} Add ${pc.cyan("--ai-verify")} to have AI review patched files (requires OPENAI_API_KEY).`);
|
|
318
|
+
}
|
|
285
319
|
consola2.log("");
|
|
286
320
|
}
|
|
287
321
|
});
|
|
@@ -640,28 +674,34 @@ var applyCommand = defineCommand4({
|
|
|
640
674
|
if (args["ai-verify"]) {
|
|
641
675
|
const appliedPaths = applyReport.files.filter((f) => f.applied).map((f) => f.filePath);
|
|
642
676
|
if (appliedPaths.length > 0) {
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
consola5.log(` ${pc4.
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
677
|
+
const { checkAiVerifyReady } = await import("./openaiClient-YGAFYB3X.js");
|
|
678
|
+
const ready = await checkAiVerifyReady(root);
|
|
679
|
+
if (!ready.ok) {
|
|
680
|
+
consola5.warn(` ${pc4.yellow("AI Verification skipped:")} ${ready.reason}`);
|
|
681
|
+
} else {
|
|
682
|
+
consola5.log("");
|
|
683
|
+
consola5.log(pc4.bold(" CMS Assets Agent \u2014 AI Verification"));
|
|
684
|
+
consola5.log(pc4.dim(" \u2500".repeat(25)));
|
|
685
|
+
consola5.log("");
|
|
686
|
+
const { aiReviewAll } = await import("./aiReview-6WOTHK5N.js");
|
|
687
|
+
aiReviewReport = await aiReviewAll(root, appliedPaths, plan, {
|
|
688
|
+
model: args["ai-model"] ?? "gpt-4o",
|
|
689
|
+
maxIterations: parseInt(args["ai-max-iterations"] ?? "3", 10)
|
|
690
|
+
});
|
|
691
|
+
consola5.log("");
|
|
692
|
+
consola5.log(` ${pc4.green("Passed:")} ${aiReviewReport.filesPassed} files`);
|
|
693
|
+
if (aiReviewReport.filesFixed > 0) {
|
|
694
|
+
consola5.log(` ${pc4.blue("Fixed:")} ${aiReviewReport.filesFixed} files`);
|
|
695
|
+
}
|
|
696
|
+
if (aiReviewReport.filesFailed > 0) {
|
|
697
|
+
consola5.log(` ${pc4.red("Failed:")} ${aiReviewReport.filesFailed} files`);
|
|
698
|
+
}
|
|
699
|
+
consola5.log(` ${pc4.dim(`Tokens used: ${aiReviewReport.tokensUsed}`)}`);
|
|
700
|
+
consola5.log("");
|
|
701
|
+
if (aiReviewReport.filesFixed > 0 && gitOps.isGitRepo(root) && branchCreated) {
|
|
702
|
+
gitOps.stageAll(root);
|
|
703
|
+
gitOps.commit(root, "chore(cmsassets-agent): AI-verified fixes for missed transforms");
|
|
704
|
+
}
|
|
665
705
|
}
|
|
666
706
|
}
|
|
667
707
|
}
|
|
@@ -971,7 +1011,7 @@ var rollbackCommand = defineCommand7({
|
|
|
971
1011
|
var main = defineCommand8({
|
|
972
1012
|
meta: {
|
|
973
1013
|
name: "cmsassets-agent",
|
|
974
|
-
version: "0.1.
|
|
1014
|
+
version: "0.1.3",
|
|
975
1015
|
description: "Auto-integrate @synchronized-studio/response-transformer into any JS/TS project."
|
|
976
1016
|
},
|
|
977
1017
|
subCommands: {
|
package/dist/index.js
CHANGED
|
@@ -25,11 +25,12 @@ import {
|
|
|
25
25
|
saveReport,
|
|
26
26
|
scan,
|
|
27
27
|
verify
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-WDZHZ32V.js";
|
|
29
29
|
import {
|
|
30
30
|
aiReviewAll
|
|
31
|
-
} from "./chunk-
|
|
32
|
-
import "./chunk-
|
|
31
|
+
} from "./chunk-OAWCNTAC.js";
|
|
32
|
+
import "./chunk-Q6VYUIS7.js";
|
|
33
|
+
import "./chunk-E74TGIFQ.js";
|
|
33
34
|
import "./chunk-QGM4M3NI.js";
|
|
34
35
|
|
|
35
36
|
// src/engine.ts
|
package/package.json
CHANGED