@synchronized-studio/cmsassets-agent 0.2.0 → 0.3.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/aiReview-GDZZWQ3N.js +9 -0
- package/dist/aiReview-WD5QPIHJ.js +9 -0
- package/dist/chunk-HYSTWSLW.js +411 -0
- package/dist/chunk-MCKXYHFX.js +461 -0
- package/dist/chunk-MW74S44G.js +1073 -0
- package/dist/chunk-O6X5SMT4.js +1681 -0
- package/dist/chunk-SHAT7M2R.js +1023 -0
- package/dist/chunk-XHL55FTA.js +1745 -0
- package/dist/cli.js +35 -11
- package/dist/index.d.ts +47 -9
- package/dist/index.js +9 -4
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -9,8 +9,8 @@ import {
|
|
|
9
9
|
saveReport,
|
|
10
10
|
scan,
|
|
11
11
|
verify
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import "./chunk-
|
|
12
|
+
} from "./chunk-O6X5SMT4.js";
|
|
13
|
+
import "./chunk-SHAT7M2R.js";
|
|
14
14
|
import "./chunk-E74TGIFQ.js";
|
|
15
15
|
import "./chunk-QGM4M3NI.js";
|
|
16
16
|
|
|
@@ -239,10 +239,21 @@ var initCommand = defineCommand({
|
|
|
239
239
|
consola2.warn("Package install failed. You can install it manually later.");
|
|
240
240
|
}
|
|
241
241
|
}
|
|
242
|
+
const hasAiKey = !!process.env.OPENAI_API_KEY;
|
|
243
|
+
const aiMode = args["ai-verify"] && hasAiKey;
|
|
244
|
+
if (args["ai-verify"] && !hasAiKey) {
|
|
245
|
+
consola2.log(` ${pc.yellow("No OPENAI_API_KEY")} \u2014 using mixed fallback (AST for high/medium, report-only for low)`);
|
|
246
|
+
consola2.log("");
|
|
247
|
+
} else if (aiMode) {
|
|
248
|
+
consola2.log(` ${pc.cyan("AI mode")} \u2014 AI will patch and verify each file`);
|
|
249
|
+
consola2.log("");
|
|
250
|
+
}
|
|
242
251
|
consola2.info("Applying patches...");
|
|
243
252
|
const applyReport = await applyPlan(plan, {
|
|
244
253
|
dryRun: false,
|
|
245
|
-
includeTests: args["include-tests"]
|
|
254
|
+
includeTests: args["include-tests"],
|
|
255
|
+
aiMode,
|
|
256
|
+
aiModel: args["ai-model"] ?? "gpt-4o"
|
|
246
257
|
});
|
|
247
258
|
applyReport.installed = installed;
|
|
248
259
|
let aiReviewReport;
|
|
@@ -270,7 +281,7 @@ var initCommand = defineCommand({
|
|
|
270
281
|
consola2.log(pc.bold(" CMS Assets Agent \u2014 AI Verification"));
|
|
271
282
|
consola2.log(pc.dim(" \u2500".repeat(25)));
|
|
272
283
|
consola2.log("");
|
|
273
|
-
const { aiReviewAll } = await import("./aiReview-
|
|
284
|
+
const { aiReviewAll } = await import("./aiReview-GDZZWQ3N.js");
|
|
274
285
|
aiReviewReport = await aiReviewAll(root, appliedPaths, plan, {
|
|
275
286
|
model: args["ai-model"] ?? "gpt-4o",
|
|
276
287
|
maxIterations: parseInt(args["ai-max-iterations"] ?? "3", 10)
|
|
@@ -296,21 +307,34 @@ var initCommand = defineCommand({
|
|
|
296
307
|
const report = createReport({ apply: applyReport, plan, scan: scanResult, aiReview: aiReviewReport });
|
|
297
308
|
saveReport(root, report);
|
|
298
309
|
const applied = applyReport.files.filter((f) => f.applied);
|
|
299
|
-
const
|
|
310
|
+
const manualReview = applyReport.files.filter((f) => f.method === "manual-review");
|
|
311
|
+
const skipped = applyReport.files.filter((f) => !f.applied && f.method === "skipped");
|
|
312
|
+
const s = applyReport.summary;
|
|
300
313
|
consola2.log("");
|
|
301
314
|
consola2.log(pc.bold(" CMS Assets Agent \u2014 Init Complete"));
|
|
302
315
|
consola2.log(pc.dim(" \u2500".repeat(25)));
|
|
303
316
|
consola2.log("");
|
|
304
|
-
|
|
305
|
-
|
|
317
|
+
if (s) {
|
|
318
|
+
consola2.log(` ${pc.dim("Candidates:")} ${s.candidatesFound}`);
|
|
319
|
+
if (s.patchedByAi > 0) consola2.log(` ${pc.green("Patched (AI):")} ${s.patchedByAi}`);
|
|
320
|
+
if (s.patchedByAst > 0) consola2.log(` ${pc.green("Patched (AST):")} ${s.patchedByAst}`);
|
|
321
|
+
if (s.manualReviewRequired > 0) consola2.log(` ${pc.yellow("Manual review:")} ${s.manualReviewRequired}`);
|
|
322
|
+
if (s.skipped > 0) consola2.log(` ${pc.dim("Skipped:")} ${s.skipped}`);
|
|
323
|
+
} else {
|
|
324
|
+
consola2.log(` ${pc.green("Applied:")} ${applied.length} files`);
|
|
325
|
+
consola2.log(` ${pc.yellow("Skipped:")} ${skipped.length + manualReview.length} files`);
|
|
326
|
+
}
|
|
306
327
|
if (installed) consola2.log(` ${pc.green("Installed:")} @synchronized-studio/response-transformer`);
|
|
307
328
|
if (scriptAdded) consola2.log(` ${pc.green("Script:")} Added "cmsassets:transform" to package.json`);
|
|
308
329
|
consola2.log("");
|
|
309
330
|
for (const file of applied) {
|
|
310
|
-
consola2.log(` ${pc.green("
|
|
331
|
+
consola2.log(` ${pc.green("+")} ${file.filePath} ${pc.dim(`(${file.method}, ${file.durationMs}ms)`)}`);
|
|
332
|
+
}
|
|
333
|
+
for (const file of manualReview) {
|
|
334
|
+
consola2.log(` ${pc.yellow("?")} ${file.filePath} ${pc.dim(`\u2014 ${file.reason}`)}`);
|
|
311
335
|
}
|
|
312
336
|
for (const file of skipped) {
|
|
313
|
-
consola2.log(` ${pc.
|
|
337
|
+
consola2.log(` ${pc.dim("-")} ${file.filePath} ${pc.dim(`\u2014 ${file.reason}`)}`);
|
|
314
338
|
}
|
|
315
339
|
consola2.log("");
|
|
316
340
|
if (!installed) {
|
|
@@ -692,7 +716,7 @@ var applyCommand = defineCommand4({
|
|
|
692
716
|
consola5.log(pc4.bold(" CMS Assets Agent \u2014 AI Verification"));
|
|
693
717
|
consola5.log(pc4.dim(" \u2500".repeat(25)));
|
|
694
718
|
consola5.log("");
|
|
695
|
-
const { aiReviewAll } = await import("./aiReview-
|
|
719
|
+
const { aiReviewAll } = await import("./aiReview-GDZZWQ3N.js");
|
|
696
720
|
aiReviewReport = await aiReviewAll(root, appliedPaths, plan, {
|
|
697
721
|
model: args["ai-model"] ?? "gpt-4o",
|
|
698
722
|
maxIterations: parseInt(args["ai-max-iterations"] ?? "3", 10)
|
|
@@ -1020,7 +1044,7 @@ var rollbackCommand = defineCommand7({
|
|
|
1020
1044
|
var main = defineCommand8({
|
|
1021
1045
|
meta: {
|
|
1022
1046
|
name: "cmsassets-agent",
|
|
1023
|
-
version: "0.
|
|
1047
|
+
version: "0.3.0",
|
|
1024
1048
|
description: "Auto-integrate @synchronized-studio/response-transformer into any JS/TS project."
|
|
1025
1049
|
},
|
|
1026
1050
|
subCommands: {
|
package/dist/index.d.ts
CHANGED
|
@@ -519,22 +519,24 @@ declare const PatchPlan: z.ZodObject<{
|
|
|
519
519
|
};
|
|
520
520
|
}>;
|
|
521
521
|
type PatchPlan = z.infer<typeof PatchPlan>;
|
|
522
|
+
declare const PatchMethod: z.ZodEnum<["ast", "llm", "llm-complete", "ai-complete", "skipped", "manual-review"]>;
|
|
523
|
+
type PatchMethod = z.infer<typeof PatchMethod>;
|
|
522
524
|
declare const PatchedFileReport: z.ZodObject<{
|
|
523
525
|
filePath: z.ZodString;
|
|
524
526
|
applied: z.ZodBoolean;
|
|
525
|
-
method: z.ZodEnum<["ast", "llm", "llm-complete", "skipped"]>;
|
|
527
|
+
method: z.ZodEnum<["ast", "llm", "llm-complete", "ai-complete", "skipped", "manual-review"]>;
|
|
526
528
|
reason: z.ZodOptional<z.ZodString>;
|
|
527
529
|
durationMs: z.ZodNumber;
|
|
528
530
|
}, "strip", z.ZodTypeAny, {
|
|
529
531
|
filePath: string;
|
|
530
532
|
applied: boolean;
|
|
531
|
-
method: "llm" | "ast" | "llm-complete" | "skipped";
|
|
533
|
+
method: "llm" | "ast" | "llm-complete" | "ai-complete" | "skipped" | "manual-review";
|
|
532
534
|
durationMs: number;
|
|
533
535
|
reason?: string | undefined;
|
|
534
536
|
}, {
|
|
535
537
|
filePath: string;
|
|
536
538
|
applied: boolean;
|
|
537
|
-
method: "llm" | "ast" | "llm-complete" | "skipped";
|
|
539
|
+
method: "llm" | "ast" | "llm-complete" | "ai-complete" | "skipped" | "manual-review";
|
|
538
540
|
durationMs: number;
|
|
539
541
|
reason?: string | undefined;
|
|
540
542
|
}>;
|
|
@@ -550,22 +552,41 @@ declare const ApplyReport: z.ZodObject<{
|
|
|
550
552
|
files: z.ZodArray<z.ZodObject<{
|
|
551
553
|
filePath: z.ZodString;
|
|
552
554
|
applied: z.ZodBoolean;
|
|
553
|
-
method: z.ZodEnum<["ast", "llm", "llm-complete", "skipped"]>;
|
|
555
|
+
method: z.ZodEnum<["ast", "llm", "llm-complete", "ai-complete", "skipped", "manual-review"]>;
|
|
554
556
|
reason: z.ZodOptional<z.ZodString>;
|
|
555
557
|
durationMs: z.ZodNumber;
|
|
556
558
|
}, "strip", z.ZodTypeAny, {
|
|
557
559
|
filePath: string;
|
|
558
560
|
applied: boolean;
|
|
559
|
-
method: "llm" | "ast" | "llm-complete" | "skipped";
|
|
561
|
+
method: "llm" | "ast" | "llm-complete" | "ai-complete" | "skipped" | "manual-review";
|
|
560
562
|
durationMs: number;
|
|
561
563
|
reason?: string | undefined;
|
|
562
564
|
}, {
|
|
563
565
|
filePath: string;
|
|
564
566
|
applied: boolean;
|
|
565
|
-
method: "llm" | "ast" | "llm-complete" | "skipped";
|
|
567
|
+
method: "llm" | "ast" | "llm-complete" | "ai-complete" | "skipped" | "manual-review";
|
|
566
568
|
durationMs: number;
|
|
567
569
|
reason?: string | undefined;
|
|
568
570
|
}>, "many">;
|
|
571
|
+
summary: z.ZodOptional<z.ZodObject<{
|
|
572
|
+
candidatesFound: z.ZodNumber;
|
|
573
|
+
patchedByAi: z.ZodNumber;
|
|
574
|
+
patchedByAst: z.ZodNumber;
|
|
575
|
+
manualReviewRequired: z.ZodNumber;
|
|
576
|
+
skipped: z.ZodNumber;
|
|
577
|
+
}, "strip", z.ZodTypeAny, {
|
|
578
|
+
skipped: number;
|
|
579
|
+
candidatesFound: number;
|
|
580
|
+
patchedByAi: number;
|
|
581
|
+
patchedByAst: number;
|
|
582
|
+
manualReviewRequired: number;
|
|
583
|
+
}, {
|
|
584
|
+
skipped: number;
|
|
585
|
+
candidatesFound: number;
|
|
586
|
+
patchedByAi: number;
|
|
587
|
+
patchedByAst: number;
|
|
588
|
+
manualReviewRequired: number;
|
|
589
|
+
}>>;
|
|
569
590
|
totalDurationMs: z.ZodNumber;
|
|
570
591
|
}, "strip", z.ZodTypeAny, {
|
|
571
592
|
projectRoot: string;
|
|
@@ -573,7 +594,7 @@ declare const ApplyReport: z.ZodObject<{
|
|
|
573
594
|
files: {
|
|
574
595
|
filePath: string;
|
|
575
596
|
applied: boolean;
|
|
576
|
-
method: "llm" | "ast" | "llm-complete" | "skipped";
|
|
597
|
+
method: "llm" | "ast" | "llm-complete" | "ai-complete" | "skipped" | "manual-review";
|
|
577
598
|
durationMs: number;
|
|
578
599
|
reason?: string | undefined;
|
|
579
600
|
}[];
|
|
@@ -583,13 +604,20 @@ declare const ApplyReport: z.ZodObject<{
|
|
|
583
604
|
installed: boolean;
|
|
584
605
|
envUpdated: boolean;
|
|
585
606
|
totalDurationMs: number;
|
|
607
|
+
summary?: {
|
|
608
|
+
skipped: number;
|
|
609
|
+
candidatesFound: number;
|
|
610
|
+
patchedByAi: number;
|
|
611
|
+
patchedByAst: number;
|
|
612
|
+
manualReviewRequired: number;
|
|
613
|
+
} | undefined;
|
|
586
614
|
}, {
|
|
587
615
|
projectRoot: string;
|
|
588
616
|
schemaVersion: "1.0";
|
|
589
617
|
files: {
|
|
590
618
|
filePath: string;
|
|
591
619
|
applied: boolean;
|
|
592
|
-
method: "llm" | "ast" | "llm-complete" | "skipped";
|
|
620
|
+
method: "llm" | "ast" | "llm-complete" | "ai-complete" | "skipped" | "manual-review";
|
|
593
621
|
durationMs: number;
|
|
594
622
|
reason?: string | undefined;
|
|
595
623
|
}[];
|
|
@@ -599,6 +627,13 @@ declare const ApplyReport: z.ZodObject<{
|
|
|
599
627
|
installed: boolean;
|
|
600
628
|
envUpdated: boolean;
|
|
601
629
|
totalDurationMs: number;
|
|
630
|
+
summary?: {
|
|
631
|
+
skipped: number;
|
|
632
|
+
candidatesFound: number;
|
|
633
|
+
patchedByAi: number;
|
|
634
|
+
patchedByAst: number;
|
|
635
|
+
manualReviewRequired: number;
|
|
636
|
+
} | undefined;
|
|
602
637
|
}>;
|
|
603
638
|
type ApplyReport = z.infer<typeof ApplyReport>;
|
|
604
639
|
declare const VerifyReport: z.ZodObject<{
|
|
@@ -726,6 +761,9 @@ interface ApplyOptions {
|
|
|
726
761
|
dryRun?: boolean;
|
|
727
762
|
includeTests?: boolean;
|
|
728
763
|
maxFiles?: number;
|
|
764
|
+
/** When true, OpenAI key is available and AI-first mode should be used. */
|
|
765
|
+
aiMode?: boolean;
|
|
766
|
+
aiModel?: string;
|
|
729
767
|
}
|
|
730
768
|
declare function applyPlan(plan: PatchPlan, opts?: ApplyOptions): Promise<ApplyReport>;
|
|
731
769
|
|
|
@@ -808,4 +846,4 @@ interface PipelineResult {
|
|
|
808
846
|
}
|
|
809
847
|
declare function runFullPipeline(opts: PipelineOptions): Promise<PipelineResult>;
|
|
810
848
|
|
|
811
|
-
export { AiFileResult, AiReviewReport, ApplyReport, CmsInfo, CmsType, Confidence, FilePatch, FrameworkInfo, FrameworkName, InjectionCandidate, InjectionType, PackageManager, PatchPlan, PatchedFileReport, type PipelineOptions, type PipelineResult, ScanResult, VerifyProfile, VerifyReport, aiReviewAll, applyPlan, createPlan, createReport, gitOps, loadPlanFile, runFullPipeline, savePlanFile, saveReport, scan, verify };
|
|
849
|
+
export { AiFileResult, AiReviewReport, ApplyReport, CmsInfo, CmsType, Confidence, FilePatch, FrameworkInfo, FrameworkName, InjectionCandidate, InjectionType, PackageManager, PatchMethod, PatchPlan, PatchedFileReport, type PipelineOptions, type PipelineResult, ScanResult, VerifyProfile, VerifyReport, aiReviewAll, applyPlan, createPlan, createReport, gitOps, loadPlanFile, runFullPipeline, savePlanFile, saveReport, scan, verify };
|
package/dist/index.js
CHANGED
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
InjectionCandidate,
|
|
12
12
|
InjectionType,
|
|
13
13
|
PackageManager,
|
|
14
|
+
PatchMethod,
|
|
14
15
|
PatchPlan,
|
|
15
16
|
PatchedFileReport,
|
|
16
17
|
ScanResult,
|
|
@@ -25,11 +26,11 @@ import {
|
|
|
25
26
|
saveReport,
|
|
26
27
|
scan,
|
|
27
28
|
verify
|
|
28
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-O6X5SMT4.js";
|
|
29
30
|
import {
|
|
30
31
|
aiReviewAll
|
|
31
|
-
} from "./chunk-
|
|
32
|
-
import "./chunk-
|
|
32
|
+
} from "./chunk-MCKXYHFX.js";
|
|
33
|
+
import "./chunk-SHAT7M2R.js";
|
|
33
34
|
import "./chunk-E74TGIFQ.js";
|
|
34
35
|
import "./chunk-QGM4M3NI.js";
|
|
35
36
|
|
|
@@ -62,10 +63,13 @@ async function runFullPipeline(opts) {
|
|
|
62
63
|
previousCommit = gitOps.getHeadCommit(root);
|
|
63
64
|
gitOps.createBranch(root, `cmsassets-agent/integrate-${Date.now()}`);
|
|
64
65
|
}
|
|
66
|
+
const aiMode = opts.aiVerify && !!process.env.OPENAI_API_KEY;
|
|
65
67
|
const applyReport = await applyPlan(plan, {
|
|
66
68
|
dryRun: opts.dryRun ?? false,
|
|
67
69
|
includeTests: opts.includeTests ?? false,
|
|
68
|
-
maxFiles: opts.maxFiles
|
|
70
|
+
maxFiles: opts.maxFiles,
|
|
71
|
+
aiMode,
|
|
72
|
+
aiModel: opts.aiModel
|
|
69
73
|
});
|
|
70
74
|
if (opts.gitCommit && gitOps.isGitRepo(root) && !opts.dryRun) {
|
|
71
75
|
gitOps.stageAll(root);
|
|
@@ -134,6 +138,7 @@ export {
|
|
|
134
138
|
InjectionCandidate,
|
|
135
139
|
InjectionType,
|
|
136
140
|
PackageManager,
|
|
141
|
+
PatchMethod,
|
|
137
142
|
PatchPlan,
|
|
138
143
|
PatchedFileReport,
|
|
139
144
|
ScanResult,
|
package/package.json
CHANGED