@jvittechs/jai1-cli 0.1.93 → 0.1.95
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 +127 -22
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -33,7 +33,7 @@ var NetworkError = class extends Jai1Error {
|
|
|
33
33
|
// package.json
|
|
34
34
|
var package_default = {
|
|
35
35
|
name: "@jvittechs/jai1-cli",
|
|
36
|
-
version: "0.1.
|
|
36
|
+
version: "0.1.95",
|
|
37
37
|
description: "A unified CLI tool for JV-IT TECHS developers to manage Jai1 Framework. Please contact TeamAI for usage instructions.",
|
|
38
38
|
type: "module",
|
|
39
39
|
bin: {
|
|
@@ -778,6 +778,16 @@ import path from "path";
|
|
|
778
778
|
import matter from "gray-matter";
|
|
779
779
|
|
|
780
780
|
// src/constants/ide-migration-configs.ts
|
|
781
|
+
function isAlwaysTrigger(trigger) {
|
|
782
|
+
return trigger === "always_on" || trigger === "always";
|
|
783
|
+
}
|
|
784
|
+
function getGlobFromTrigger(trigger, globs) {
|
|
785
|
+
if (globs && globs.length > 0) return globs;
|
|
786
|
+
if (trigger && !isAlwaysTrigger(trigger) && trigger !== "manual") {
|
|
787
|
+
return [trigger];
|
|
788
|
+
}
|
|
789
|
+
return void 0;
|
|
790
|
+
}
|
|
781
791
|
var IDE_MIGRATION_CONFIGS = {
|
|
782
792
|
cursor: {
|
|
783
793
|
id: "cursor",
|
|
@@ -793,10 +803,12 @@ var IDE_MIGRATION_CONFIGS = {
|
|
|
793
803
|
if (opts.description) {
|
|
794
804
|
lines.push(`description: ${opts.description}`);
|
|
795
805
|
}
|
|
796
|
-
|
|
797
|
-
|
|
806
|
+
const alwaysApply = opts.alwaysApply || isAlwaysTrigger(opts.trigger);
|
|
807
|
+
const globs = getGlobFromTrigger(opts.trigger, opts.globs);
|
|
808
|
+
if (globs && globs.length > 0) {
|
|
809
|
+
lines.push(`globs: ${globs.join(", ")}`);
|
|
798
810
|
}
|
|
799
|
-
lines.push(`alwaysApply: ${
|
|
811
|
+
lines.push(`alwaysApply: ${alwaysApply}`);
|
|
800
812
|
lines.push("---");
|
|
801
813
|
return lines.join("\n");
|
|
802
814
|
}
|
|
@@ -811,7 +823,16 @@ var IDE_MIGRATION_CONFIGS = {
|
|
|
811
823
|
commandsPath: null,
|
|
812
824
|
fileExtension: ".md",
|
|
813
825
|
generateFrontmatter: (opts) => {
|
|
814
|
-
|
|
826
|
+
let trigger;
|
|
827
|
+
if (opts.trigger) {
|
|
828
|
+
trigger = opts.trigger === "always" ? "always_on" : opts.trigger;
|
|
829
|
+
} else if (opts.alwaysApply) {
|
|
830
|
+
trigger = "always_on";
|
|
831
|
+
} else if (opts.globs && opts.globs.length > 0) {
|
|
832
|
+
trigger = opts.globs[0];
|
|
833
|
+
} else {
|
|
834
|
+
trigger = "always_on";
|
|
835
|
+
}
|
|
815
836
|
return `---
|
|
816
837
|
trigger: ${trigger}
|
|
817
838
|
---`;
|
|
@@ -827,7 +848,16 @@ trigger: ${trigger}
|
|
|
827
848
|
commandsPath: null,
|
|
828
849
|
fileExtension: ".md",
|
|
829
850
|
generateFrontmatter: (opts) => {
|
|
830
|
-
|
|
851
|
+
let trigger;
|
|
852
|
+
if (opts.trigger) {
|
|
853
|
+
trigger = opts.trigger === "always" ? "always_on" : opts.trigger;
|
|
854
|
+
} else if (opts.alwaysApply) {
|
|
855
|
+
trigger = "always_on";
|
|
856
|
+
} else if (opts.globs && opts.globs.length > 0) {
|
|
857
|
+
trigger = opts.globs[0];
|
|
858
|
+
} else {
|
|
859
|
+
trigger = "always_on";
|
|
860
|
+
}
|
|
831
861
|
return `---
|
|
832
862
|
trigger: ${trigger}
|
|
833
863
|
---`;
|
|
@@ -847,8 +877,12 @@ trigger: ${trigger}
|
|
|
847
877
|
if (opts.description) {
|
|
848
878
|
lines.push(`description: ${opts.description}`);
|
|
849
879
|
}
|
|
850
|
-
|
|
851
|
-
|
|
880
|
+
const isAlways = opts.alwaysApply || isAlwaysTrigger(opts.trigger);
|
|
881
|
+
if (!isAlways) {
|
|
882
|
+
const paths = getGlobFromTrigger(opts.trigger, opts.globs);
|
|
883
|
+
if (paths && paths.length > 0) {
|
|
884
|
+
lines.push(`paths: ${paths.join(", ")}`);
|
|
885
|
+
}
|
|
852
886
|
}
|
|
853
887
|
lines.push("---");
|
|
854
888
|
return lines.join("\n");
|
|
@@ -864,7 +898,16 @@ trigger: ${trigger}
|
|
|
864
898
|
commandsPath: null,
|
|
865
899
|
fileExtension: ".md",
|
|
866
900
|
generateFrontmatter: (opts) => {
|
|
867
|
-
|
|
901
|
+
let trigger;
|
|
902
|
+
if (opts.trigger) {
|
|
903
|
+
trigger = opts.trigger === "always" ? "always_on" : opts.trigger;
|
|
904
|
+
} else if (opts.alwaysApply) {
|
|
905
|
+
trigger = "always_on";
|
|
906
|
+
} else if (opts.globs && opts.globs.length > 0) {
|
|
907
|
+
trigger = opts.globs[0];
|
|
908
|
+
} else {
|
|
909
|
+
trigger = "always_on";
|
|
910
|
+
}
|
|
868
911
|
return `---
|
|
869
912
|
trigger: ${trigger}
|
|
870
913
|
---`;
|
|
@@ -923,14 +966,18 @@ var MigrateIdeService = class {
|
|
|
923
966
|
frontmatter = data;
|
|
924
967
|
} catch {
|
|
925
968
|
}
|
|
969
|
+
const name = path.basename(file, ".mdc");
|
|
970
|
+
const trigger = this.extractTrigger(frontmatter);
|
|
971
|
+
const alwaysApply = this.isAlwaysTrigger(trigger);
|
|
926
972
|
items.push({
|
|
927
973
|
type: "rules",
|
|
928
|
-
name
|
|
974
|
+
name,
|
|
929
975
|
filepath,
|
|
930
976
|
relativePath: path.relative(this.projectPath, filepath),
|
|
931
977
|
description: frontmatter.description,
|
|
932
978
|
globs: this.extractGlobs(frontmatter),
|
|
933
|
-
|
|
979
|
+
trigger,
|
|
980
|
+
alwaysApply
|
|
934
981
|
});
|
|
935
982
|
}
|
|
936
983
|
return items;
|
|
@@ -954,14 +1001,18 @@ var MigrateIdeService = class {
|
|
|
954
1001
|
if (!stat.isFile()) continue;
|
|
955
1002
|
const content = await fs4.readFile(filepath, "utf-8");
|
|
956
1003
|
const { data: frontmatter } = matter(content);
|
|
1004
|
+
const name = path.basename(file, ".md");
|
|
1005
|
+
const trigger = this.extractTrigger(frontmatter);
|
|
1006
|
+
const alwaysApply = this.isAlwaysTrigger(trigger);
|
|
957
1007
|
items.push({
|
|
958
1008
|
type,
|
|
959
|
-
name
|
|
1009
|
+
name,
|
|
960
1010
|
filepath,
|
|
961
1011
|
relativePath: path.relative(this.projectPath, filepath),
|
|
962
1012
|
description: frontmatter.description,
|
|
963
1013
|
globs: this.extractGlobs(frontmatter),
|
|
964
|
-
|
|
1014
|
+
trigger,
|
|
1015
|
+
alwaysApply
|
|
965
1016
|
});
|
|
966
1017
|
}
|
|
967
1018
|
return items;
|
|
@@ -975,6 +1026,7 @@ var MigrateIdeService = class {
|
|
|
975
1026
|
const frontmatter = config.generateFrontmatter({
|
|
976
1027
|
description: sourceItem.description,
|
|
977
1028
|
globs: sourceItem.globs,
|
|
1029
|
+
trigger: sourceItem.trigger,
|
|
978
1030
|
alwaysApply: sourceItem.alwaysApply,
|
|
979
1031
|
sourceFile: sourceItem.relativePath
|
|
980
1032
|
});
|
|
@@ -1071,14 +1123,38 @@ ${reference}
|
|
|
1071
1123
|
return path.join(this.projectPath, config.basePath, contentPath, filename);
|
|
1072
1124
|
}
|
|
1073
1125
|
// Helper methods
|
|
1126
|
+
/**
|
|
1127
|
+
* Extract trigger from frontmatter
|
|
1128
|
+
* Jai1 source format uses 'trigger' field (Windsurf/Antigravity compatible)
|
|
1129
|
+
*/
|
|
1130
|
+
extractTrigger(frontmatter) {
|
|
1131
|
+
const trigger = frontmatter.trigger;
|
|
1132
|
+
if (typeof trigger === "string") {
|
|
1133
|
+
return trigger;
|
|
1134
|
+
}
|
|
1135
|
+
if (frontmatter.alwaysApply === true) {
|
|
1136
|
+
return "always_on";
|
|
1137
|
+
}
|
|
1138
|
+
const globs = this.extractGlobs(frontmatter);
|
|
1139
|
+
if (globs && globs.length > 0) {
|
|
1140
|
+
return globs[0];
|
|
1141
|
+
}
|
|
1142
|
+
return void 0;
|
|
1143
|
+
}
|
|
1144
|
+
/**
|
|
1145
|
+
* Extract globs from frontmatter
|
|
1146
|
+
*/
|
|
1074
1147
|
extractGlobs(frontmatter) {
|
|
1075
1148
|
const globs = frontmatter.globs;
|
|
1076
1149
|
if (typeof globs === "string") return [globs];
|
|
1077
1150
|
if (Array.isArray(globs)) return globs;
|
|
1078
1151
|
return void 0;
|
|
1079
1152
|
}
|
|
1080
|
-
|
|
1081
|
-
|
|
1153
|
+
/**
|
|
1154
|
+
* Check if trigger indicates "always apply"
|
|
1155
|
+
*/
|
|
1156
|
+
isAlwaysTrigger(trigger) {
|
|
1157
|
+
return trigger === "always" || trigger === "always_on";
|
|
1082
1158
|
}
|
|
1083
1159
|
};
|
|
1084
1160
|
|
|
@@ -5532,7 +5608,12 @@ var ImageService = class {
|
|
|
5532
5608
|
"Content-Type": "application/json",
|
|
5533
5609
|
"JAI1-Access-Key": config.accessKey
|
|
5534
5610
|
},
|
|
5535
|
-
body: JSON.stringify(
|
|
5611
|
+
body: JSON.stringify({
|
|
5612
|
+
prompt: options.prompt,
|
|
5613
|
+
model: options.model,
|
|
5614
|
+
size: options.size || "1024x1024",
|
|
5615
|
+
quality: options.quality || "hd"
|
|
5616
|
+
})
|
|
5536
5617
|
});
|
|
5537
5618
|
if (!response.ok) {
|
|
5538
5619
|
let errorMessage = `HTTP ${response.status}`;
|
|
@@ -5605,26 +5686,50 @@ var ImageService = class {
|
|
|
5605
5686
|
|
|
5606
5687
|
// src/commands/image/gen.ts
|
|
5607
5688
|
import terminalImage from "terminal-image";
|
|
5689
|
+
var SUPPORTED_SIZES = [
|
|
5690
|
+
"1024x1024",
|
|
5691
|
+
// 1:1 (default)
|
|
5692
|
+
"1792x1024",
|
|
5693
|
+
// 16:9 (landscape)
|
|
5694
|
+
"1024x1792",
|
|
5695
|
+
// 9:16 (portrait)
|
|
5696
|
+
"1024x768",
|
|
5697
|
+
// 4:3 (landscape)
|
|
5698
|
+
"768x1024"
|
|
5699
|
+
// 3:4 (portrait)
|
|
5700
|
+
];
|
|
5608
5701
|
function createImageGenCommand() {
|
|
5609
|
-
return new Command16("gen").description("Generate an image from text prompt").argument("<prompt>", "Image description prompt").option("-m, --model <model>", "Model to use", "gemini-3-
|
|
5702
|
+
return new Command16("gen").description("Generate an image from text prompt").argument("<prompt>", "Image description prompt").option("-m, --model <model>", "Model to use", "gemini-3-pro-image-preview").option("-s, --size <size>", `Image size: ${SUPPORTED_SIZES.join(", ")}`, "1024x1024").option("-q, --quality <quality>", "Image quality: standard, hd", "hd").option("--no-display", "Don't display image in terminal").action(async (prompt, options) => {
|
|
5610
5703
|
const configService = new ConfigService();
|
|
5611
5704
|
const config = await configService.load();
|
|
5612
5705
|
if (!config) {
|
|
5613
5706
|
throw new ValidationError('Not initialized. Run "jai1 auth" first.');
|
|
5614
5707
|
}
|
|
5708
|
+
const size = options.size;
|
|
5709
|
+
if (!SUPPORTED_SIZES.includes(size)) {
|
|
5710
|
+
console.error(`
|
|
5711
|
+
\u274C Invalid size: ${size}`);
|
|
5712
|
+
console.error(` Supported sizes: ${SUPPORTED_SIZES.join(", ")}`);
|
|
5713
|
+
console.error("\n Size reference:");
|
|
5714
|
+
console.error(" 1024x1024 - Square (1:1)");
|
|
5715
|
+
console.error(" 1792x1024 - Landscape wide (16:9)");
|
|
5716
|
+
console.error(" 1024x1792 - Portrait tall (9:16)");
|
|
5717
|
+
console.error(" 1024x768 - Landscape (4:3)");
|
|
5718
|
+
console.error(" 768x1024 - Portrait (3:4)");
|
|
5719
|
+
process.exit(1);
|
|
5720
|
+
}
|
|
5615
5721
|
const imageService = new ImageService();
|
|
5616
5722
|
console.log("\u{1F3A8} Generating image...");
|
|
5617
5723
|
console.log(` Prompt: ${prompt}`);
|
|
5618
5724
|
console.log(` Model: ${options.model}`);
|
|
5725
|
+
console.log(` Size: ${size}`);
|
|
5726
|
+
console.log(` Quality: ${options.quality}`);
|
|
5619
5727
|
try {
|
|
5620
5728
|
const result = await imageService.generate(config, {
|
|
5621
5729
|
prompt,
|
|
5622
5730
|
model: options.model,
|
|
5623
|
-
|
|
5624
|
-
|
|
5625
|
-
...options.ratio && { aspectRatio: options.ratio },
|
|
5626
|
-
...options.negative && { negativePrompt: options.negative },
|
|
5627
|
-
...options.seed && { seed: parseInt(options.seed) }
|
|
5731
|
+
size,
|
|
5732
|
+
quality: options.quality
|
|
5628
5733
|
});
|
|
5629
5734
|
console.log("\n\u2705 Image generated successfully!");
|
|
5630
5735
|
console.log(` URL: ${result.url}`);
|