@synchronized-studio/cmsassets-agent 0.3.0 → 0.3.4

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 CHANGED
@@ -9,8 +9,8 @@ import {
9
9
  saveReport,
10
10
  scan,
11
11
  verify
12
- } from "./chunk-O6X5SMT4.js";
13
- import "./chunk-SHAT7M2R.js";
12
+ } from "./chunk-MLVJQZAM.js";
13
+ import "./chunk-FMHDWOQ2.js";
14
14
  import "./chunk-E74TGIFQ.js";
15
15
  import "./chunk-QGM4M3NI.js";
16
16
 
@@ -240,13 +240,33 @@ var initCommand = defineCommand({
240
240
  }
241
241
  }
242
242
  const hasAiKey = !!process.env.OPENAI_API_KEY;
243
- const aiMode = args["ai-verify"] && hasAiKey;
243
+ let aiMode = args["ai-verify"] && hasAiKey;
244
244
  if (args["ai-verify"] && !hasAiKey) {
245
245
  consola2.log(` ${pc.yellow("No OPENAI_API_KEY")} \u2014 using mixed fallback (AST for high/medium, report-only for low)`);
246
246
  consola2.log("");
247
247
  } else if (aiMode) {
248
- consola2.log(` ${pc.cyan("AI mode")} \u2014 AI will patch and verify each file`);
249
- consola2.log("");
248
+ const { checkAiVerifyReady } = await import("./openaiClient-YGAFYB3X.js");
249
+ let ready = await checkAiVerifyReady(root);
250
+ if (!ready.ok && ready.canInstallInProject) {
251
+ const openaiInstallCmd = getOpenAiInstallCommand(scanResult.packageManager);
252
+ consola2.info(`Installing openai in project: ${openaiInstallCmd}`);
253
+ try {
254
+ const { execSync } = await import("child_process");
255
+ execSync(openaiInstallCmd, { cwd: root, stdio: "inherit" });
256
+ ready = await checkAiVerifyReady(root);
257
+ } catch {
258
+ consola2.warn("Installing openai failed.");
259
+ ready = { ok: false };
260
+ }
261
+ }
262
+ if (!ready.ok) {
263
+ consola2.log(` ${pc.yellow("AI mode unavailable")} \u2014 falling back to AST-only patching`);
264
+ consola2.log("");
265
+ aiMode = false;
266
+ } else {
267
+ consola2.log(` ${pc.cyan("AI mode")} \u2014 AI will patch and verify each file`);
268
+ consola2.log("");
269
+ }
250
270
  }
251
271
  consola2.info("Applying patches...");
252
272
  const applyReport = await applyPlan(plan, {
@@ -281,7 +301,7 @@ var initCommand = defineCommand({
281
301
  consola2.log(pc.bold(" CMS Assets Agent \u2014 AI Verification"));
282
302
  consola2.log(pc.dim(" \u2500".repeat(25)));
283
303
  consola2.log("");
284
- const { aiReviewAll } = await import("./aiReview-GDZZWQ3N.js");
304
+ const { aiReviewAll } = await import("./aiReview-EZOXVKJ5.js");
285
305
  aiReviewReport = await aiReviewAll(root, appliedPaths, plan, {
286
306
  model: args["ai-model"] ?? "gpt-4o",
287
307
  maxIterations: parseInt(args["ai-max-iterations"] ?? "3", 10)
@@ -716,7 +736,7 @@ var applyCommand = defineCommand4({
716
736
  consola5.log(pc4.bold(" CMS Assets Agent \u2014 AI Verification"));
717
737
  consola5.log(pc4.dim(" \u2500".repeat(25)));
718
738
  consola5.log("");
719
- const { aiReviewAll } = await import("./aiReview-GDZZWQ3N.js");
739
+ const { aiReviewAll } = await import("./aiReview-EZOXVKJ5.js");
720
740
  aiReviewReport = await aiReviewAll(root, appliedPaths, plan, {
721
741
  model: args["ai-model"] ?? "gpt-4o",
722
742
  maxIterations: parseInt(args["ai-max-iterations"] ?? "3", 10)
package/dist/index.js CHANGED
@@ -26,11 +26,11 @@ import {
26
26
  saveReport,
27
27
  scan,
28
28
  verify
29
- } from "./chunk-O6X5SMT4.js";
29
+ } from "./chunk-MLVJQZAM.js";
30
30
  import {
31
31
  aiReviewAll
32
- } from "./chunk-MCKXYHFX.js";
33
- import "./chunk-SHAT7M2R.js";
32
+ } from "./chunk-TNI77W4G.js";
33
+ import "./chunk-FMHDWOQ2.js";
34
34
  import "./chunk-E74TGIFQ.js";
35
35
  import "./chunk-QGM4M3NI.js";
36
36
 
@@ -63,7 +63,12 @@ async function runFullPipeline(opts) {
63
63
  previousCommit = gitOps.getHeadCommit(root);
64
64
  gitOps.createBranch(root, `cmsassets-agent/integrate-${Date.now()}`);
65
65
  }
66
- const aiMode = opts.aiVerify && !!process.env.OPENAI_API_KEY;
66
+ let aiMode = opts.aiVerify && !!process.env.OPENAI_API_KEY;
67
+ if (aiMode) {
68
+ const { checkAiVerifyReady } = await import("./openaiClient-YGAFYB3X.js");
69
+ const ready = await checkAiVerifyReady(root);
70
+ if (!ready.ok) aiMode = false;
71
+ }
67
72
  const applyReport = await applyPlan(plan, {
68
73
  dryRun: opts.dryRun ?? false,
69
74
  includeTests: opts.includeTests ?? false,
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@synchronized-studio/cmsassets-agent",
3
- "version": "0.3.0",
3
+ "version": "0.3.4",
4
4
  "description": "CLI agent that auto-integrates @synchronized-studio/response-transformer into any JS/TS project.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "types": "./dist/index.d.ts",
8
8
  "bin": {
9
- "cmsassets-agent": "./dist/cli.js"
9
+ "cmsassets-agent": "dist/cli.js"
10
10
  },
11
11
  "exports": {
12
12
  ".": {