aiex-cli 0.0.1-beta.7 → 0.0.1-beta.8

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.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { C as doctorDiagnosticsTableRows, a as writeAIConfig, b as toSnakeCase, c as PLACEHOLDER_TEXT, d as seedConfig, f as description, g as createMigrationConfig, h as version, i as readAIConfig, l as AIConfigSchema, m as package_default, n as getDefaultAIConfig, o as DEFAULT_PROMPT_CONFIG, p as name, r as maskApiKey, s as PLACEHOLDER_SCHEMA, t as collectDoctorDiagnostics, u as createConfig, v as JsonSchemaDefinitionSchema, w as formatDoctorDiagnosticsJson, x as generateDrizzleSchema, y as parseJsonSchema } from "./doctor-SWEG-HYl.mjs";
1
+ import { C as doctorDiagnosticsTableRows, a as writeAIConfig, b as toSnakeCase, c as PLACEHOLDER_TEXT, d as seedConfig, f as description, g as createMigrationConfig, h as version, i as readAIConfig, l as AIConfigSchema, m as package_default, n as getDefaultAIConfig, o as DEFAULT_PROMPT_CONFIG, p as name, r as maskApiKey, s as PLACEHOLDER_SCHEMA, t as collectDoctorDiagnostics, u as createConfig, v as JsonSchemaDefinitionSchema, w as formatDoctorDiagnosticsJson, x as generateDrizzleSchema, y as parseJsonSchema } from "./doctor-DxG7uaGR.mjs";
2
2
  import { createRequire } from "node:module";
3
3
  import path from "node:path";
4
4
  import process from "node:process";
@@ -12956,18 +12956,18 @@ function detectMimeType(filePath) {
12956
12956
  }
12957
12957
  async function readFilePart(filePath) {
12958
12958
  const mime = detectMimeType(filePath);
12959
- const dataUri = `data:${mime};base64,${(await fs.readFile(filePath)).toString("base64")}`;
12959
+ const buffer = await fs.readFile(filePath);
12960
12960
  const name$1 = path.basename(filePath);
12961
12961
  if (mime.startsWith("image/")) return {
12962
12962
  type: "image",
12963
- name: name$1,
12964
- image: dataUri
12963
+ image: buffer,
12964
+ mimeType: mime
12965
12965
  };
12966
12966
  return {
12967
12967
  type: "file",
12968
- name: name$1,
12969
- data: dataUri,
12970
- mimeType: mime
12968
+ data: buffer,
12969
+ mediaType: mime,
12970
+ filename: name$1
12971
12971
  };
12972
12972
  }
12973
12973
  function nullableType(type) {
@@ -13118,26 +13118,14 @@ async function extractStructuredData(input) {
13118
13118
  let result;
13119
13119
  if (useFileContent) {
13120
13120
  const filePart = await readFilePart(file);
13121
- const fileName = filePart.name;
13122
13121
  const contentParts = [{
13123
13122
  type: "text",
13124
- text: user.includes(PLACEHOLDER_TEXT) ? user.replaceAll(PLACEHOLDER_TEXT, text || `Data is contained in the attached file: ${fileName}`) : user
13125
- }];
13126
- if (filePart.type === "image") contentParts.push({
13127
- type: "image",
13128
- image: filePart.image
13129
- });
13130
- else contentParts.push({
13131
- type: "file",
13132
- data: filePart.data,
13133
- mimeType: filePart.mimeType
13134
- });
13123
+ text: user.includes(PLACEHOLDER_TEXT) ? user.replaceAll(PLACEHOLDER_TEXT, text || `Data is contained in the attached file: ${filePart.filename || path.basename(file)}`) : user
13124
+ }, filePart];
13135
13125
  const fileOpts = {
13136
13126
  model: provider.chatModel(selected.name),
13127
+ system,
13137
13128
  messages: [{
13138
- role: "system",
13139
- content: system
13140
- }, {
13141
13129
  role: "user",
13142
13130
  content: contentParts
13143
13131
  }],
@@ -14135,6 +14123,16 @@ function schemaRoutes(config) {
14135
14123
  const filePath = resolveSchemaFile(schemaDir, c.req.param("name"));
14136
14124
  if (!filePath) return c.json({ error: "Invalid schema file name" }, 400);
14137
14125
  try {
14126
+ const aiexDir = path.dirname(schemaDir);
14127
+ try {
14128
+ const content = await fs.readFile(filePath, "utf-8");
14129
+ const parsed = JsonSchemaDefinitionSchema.safeParse(JSON.parse(content));
14130
+ if (parsed.success) {
14131
+ const tableName = parsed.data.table.name;
14132
+ const snapshotPath = path.join(aiexDir, "extracted", `${tableName}.prompt.md`);
14133
+ await fs.unlink(snapshotPath).catch(() => {});
14134
+ }
14135
+ } catch {}
14138
14136
  await fs.unlink(filePath);
14139
14137
  return c.json({ success: true });
14140
14138
  } catch {
@@ -411,7 +411,7 @@ function generateDrizzleConfig() {
411
411
  //#endregion
412
412
  //#region package.json
413
413
  var name = "aiex-cli";
414
- var version = "0.0.1-beta.7";
414
+ var version = "0.0.1-beta.8";
415
415
  var description = "JSON Schema → SQLite with AI-powered data extraction";
416
416
  var package_default = {
417
417
  name,
package/dist/index.mjs CHANGED
@@ -1,3 +1,3 @@
1
- import { C as doctorDiagnosticsTableRows, S as buildDoctorDiagnostics, _ as generateDrizzleConfig, g as createMigrationConfig, t as collectDoctorDiagnostics, v as JsonSchemaDefinitionSchema, w as formatDoctorDiagnosticsJson, x as generateDrizzleSchema, y as parseJsonSchema } from "./doctor-SWEG-HYl.mjs";
1
+ import { C as doctorDiagnosticsTableRows, S as buildDoctorDiagnostics, _ as generateDrizzleConfig, g as createMigrationConfig, t as collectDoctorDiagnostics, v as JsonSchemaDefinitionSchema, w as formatDoctorDiagnosticsJson, x as generateDrizzleSchema, y as parseJsonSchema } from "./doctor-DxG7uaGR.mjs";
2
2
 
3
3
  export { JsonSchemaDefinitionSchema, buildDoctorDiagnostics, collectDoctorDiagnostics, createMigrationConfig, doctorDiagnosticsTableRows, formatDoctorDiagnosticsJson, generateDrizzleConfig, generateDrizzleSchema, parseJsonSchema };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "aiex-cli",
3
3
  "type": "module",
4
- "version": "0.0.1-beta.7",
4
+ "version": "0.0.1-beta.8",
5
5
  "description": "JSON Schema → SQLite with AI-powered data extraction",
6
6
  "author": "OSpoon <zxin088@gmail.com>",
7
7
  "license": "MIT",