@jvittechs/jai1-cli 0.1.94 → 0.1.96

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
@@ -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.94",
36
+ version: "0.1.96",
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: {
@@ -1000,7 +1000,14 @@ var MigrateIdeService = class {
1000
1000
  const stat = await fs4.stat(filepath);
1001
1001
  if (!stat.isFile()) continue;
1002
1002
  const content = await fs4.readFile(filepath, "utf-8");
1003
- const { data: frontmatter } = matter(content);
1003
+ let frontmatter = {};
1004
+ try {
1005
+ const { data } = matter(content);
1006
+ frontmatter = data;
1007
+ } catch (e) {
1008
+ console.warn(`\u26A0\uFE0F Skipping ${file}: Invalid YAML frontmatter`);
1009
+ continue;
1010
+ }
1004
1011
  const name = path.basename(file, ".md");
1005
1012
  const trigger = this.extractTrigger(frontmatter);
1006
1013
  const alwaysApply = this.isAlwaysTrigger(trigger);
@@ -2349,7 +2356,15 @@ var ContextScannerService = class {
2349
2356
  async parseContextItem(filepath, ide, type) {
2350
2357
  const content = await fs5.readFile(filepath, "utf-8");
2351
2358
  const stat = await fs5.stat(filepath);
2352
- const { data: frontmatter, content: bodyContent } = matter2(content);
2359
+ let frontmatter = {};
2360
+ let bodyContent = content;
2361
+ try {
2362
+ const parsed = matter2(content);
2363
+ frontmatter = parsed.data;
2364
+ bodyContent = parsed.content;
2365
+ } catch (e) {
2366
+ console.warn(`\u26A0\uFE0F Invalid YAML frontmatter in ${filepath}, skipping frontmatter parsing`);
2367
+ }
2353
2368
  const config = IDE_CONFIGS[ide];
2354
2369
  const description = frontmatter[config.frontmatterSchema.descriptionField];
2355
2370
  let globs;
@@ -5608,7 +5623,12 @@ var ImageService = class {
5608
5623
  "Content-Type": "application/json",
5609
5624
  "JAI1-Access-Key": config.accessKey
5610
5625
  },
5611
- body: JSON.stringify(options)
5626
+ body: JSON.stringify({
5627
+ prompt: options.prompt,
5628
+ model: options.model,
5629
+ size: options.size || "1024x1024",
5630
+ quality: options.quality || "hd"
5631
+ })
5612
5632
  });
5613
5633
  if (!response.ok) {
5614
5634
  let errorMessage = `HTTP ${response.status}`;
@@ -5681,26 +5701,50 @@ var ImageService = class {
5681
5701
 
5682
5702
  // src/commands/image/gen.ts
5683
5703
  import terminalImage from "terminal-image";
5704
+ var SUPPORTED_SIZES = [
5705
+ "1024x1024",
5706
+ // 1:1 (default)
5707
+ "1792x1024",
5708
+ // 16:9 (landscape)
5709
+ "1024x1792",
5710
+ // 9:16 (portrait)
5711
+ "1024x768",
5712
+ // 4:3 (landscape)
5713
+ "768x1024"
5714
+ // 3:4 (portrait)
5715
+ ];
5684
5716
  function createImageGenCommand() {
5685
- 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-flash-preview").option("-w, --width <number>", "Image width").option("-h, --height <number>", "Image height").option("-r, --ratio <ratio>", "Aspect ratio (1:1, 16:9, 9:16, 4:3, 3:4)").option("--negative <prompt>", "Negative prompt").option("--seed <number>", "Random seed").option("--no-display", "Don't display image in terminal").action(async (prompt, options) => {
5717
+ 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) => {
5686
5718
  const configService = new ConfigService();
5687
5719
  const config = await configService.load();
5688
5720
  if (!config) {
5689
5721
  throw new ValidationError('Not initialized. Run "jai1 auth" first.');
5690
5722
  }
5723
+ const size = options.size;
5724
+ if (!SUPPORTED_SIZES.includes(size)) {
5725
+ console.error(`
5726
+ \u274C Invalid size: ${size}`);
5727
+ console.error(` Supported sizes: ${SUPPORTED_SIZES.join(", ")}`);
5728
+ console.error("\n Size reference:");
5729
+ console.error(" 1024x1024 - Square (1:1)");
5730
+ console.error(" 1792x1024 - Landscape wide (16:9)");
5731
+ console.error(" 1024x1792 - Portrait tall (9:16)");
5732
+ console.error(" 1024x768 - Landscape (4:3)");
5733
+ console.error(" 768x1024 - Portrait (3:4)");
5734
+ process.exit(1);
5735
+ }
5691
5736
  const imageService = new ImageService();
5692
5737
  console.log("\u{1F3A8} Generating image...");
5693
5738
  console.log(` Prompt: ${prompt}`);
5694
5739
  console.log(` Model: ${options.model}`);
5740
+ console.log(` Size: ${size}`);
5741
+ console.log(` Quality: ${options.quality}`);
5695
5742
  try {
5696
5743
  const result = await imageService.generate(config, {
5697
5744
  prompt,
5698
5745
  model: options.model,
5699
- ...options.width && { width: parseInt(options.width) },
5700
- ...options.height && { height: parseInt(options.height) },
5701
- ...options.ratio && { aspectRatio: options.ratio },
5702
- ...options.negative && { negativePrompt: options.negative },
5703
- ...options.seed && { seed: parseInt(options.seed) }
5746
+ size,
5747
+ quality: options.quality
5704
5748
  });
5705
5749
  console.log("\n\u2705 Image generated successfully!");
5706
5750
  console.log(` URL: ${result.url}`);
@@ -11137,7 +11181,15 @@ function parseMarkdownContent(content) {
11137
11181
  rawContent: content
11138
11182
  };
11139
11183
  }
11140
- const { data: frontmatter, content: body } = matter3(content);
11184
+ let frontmatter = {};
11185
+ let body = content;
11186
+ try {
11187
+ const parsed = matter3(content);
11188
+ frontmatter = parsed.data;
11189
+ body = parsed.content;
11190
+ } catch (e) {
11191
+ console.warn(`\u26A0\uFE0F Invalid YAML frontmatter, skipping frontmatter parsing`);
11192
+ }
11141
11193
  const comments = extractCommentsSection(body);
11142
11194
  const mainContent = removeCommentsSection(body);
11143
11195
  return {