aiex-cli 0.0.0 → 0.0.1-beta.1

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/README.md CHANGED
@@ -21,8 +21,8 @@ npm install -g aiex-cli
21
21
  ```
22
22
 
23
23
  ```bash
24
- cd my-project && aiex schema --init # set up your schema directory
25
- aiex schema "*.json" # generate SQLite from JSON Schema
24
+ aiex schema --init # set up .aiex/schema/ directory
25
+ aiex schema # generate SQLite from JSON Schema files
26
26
  aiex extract -s invoice -f invoice.pdf # extract data with AI
27
27
  ```
28
28
 
@@ -58,7 +58,7 @@ Opens a browser UI where you can visually design and manage your schemas, config
58
58
  ### 3. Generate Database
59
59
 
60
60
  ```bash
61
- aiex schema "*.json"
61
+ aiex schema
62
62
  ```
63
63
 
64
64
  Converts your JSON Schema files into a SQLite database with full migration support.
package/dist/cli.mjs CHANGED
@@ -1,10 +1,10 @@
1
- import { C as formatDoctorDiagnosticsJson, S as doctorDiagnosticsTableRows, a as writeAIConfig, b as generateDrizzleSchema, c as PLACEHOLDER_TEXT, d as seedConfig, f as description$1, 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, y as parseJsonSchema } from "./doctor-Wic10PLt.mjs";
1
+ import { C as formatDoctorDiagnosticsJson, S as doctorDiagnosticsTableRows, a as writeAIConfig, b as generateDrizzleSchema, c as PLACEHOLDER_TEXT, d as seedConfig, f as description$1, 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, y as parseJsonSchema } from "./doctor-Dk4QYsbc.mjs";
2
2
  import { createRequire } from "node:module";
3
3
  import path from "node:path";
4
4
  import process from "node:process";
5
5
  import { fileURLToPath } from "node:url";
6
6
  import { ZodError } from "zod";
7
- import fs, { glob } from "node:fs/promises";
7
+ import fs from "node:fs/promises";
8
8
  import { defineCommand, runMain } from "citty";
9
9
  import updateNotifier from "update-notifier";
10
10
  import CliTable3 from "cli-table3";
@@ -9309,17 +9309,6 @@ const extractCommand = defineCommand({
9309
9309
  //#endregion
9310
9310
  //#region src/commands/schema.ts
9311
9311
  const execFileAsync$1 = promisify(execFile);
9312
- async function resolveSchemaFiles(pattern) {
9313
- const cwd = process.cwd();
9314
- const absPattern = path.isAbsolute(pattern) ? pattern : path.resolve(cwd, pattern);
9315
- const files = [];
9316
- try {
9317
- for await (const entry of glob(absPattern)) files.push(entry);
9318
- } catch {
9319
- if (await fs.access(absPattern).then(() => true, () => false)) files.push(absPattern);
9320
- }
9321
- return files.filter((f) => f.endsWith(".json"));
9322
- }
9323
9312
  async function generateFromFiles(schemaFiles, config) {
9324
9313
  const result = parseAllSchemas(await Promise.all(schemaFiles.map(async (filePath) => {
9325
9314
  return {
@@ -9375,11 +9364,6 @@ const schemaCommand = defineCommand({
9375
9364
  description: "Sync JSON Schema to SQLite database"
9376
9365
  },
9377
9366
  args: {
9378
- files: {
9379
- type: "positional",
9380
- description: "JSON Schema file path(s), supports glob patterns",
9381
- required: false
9382
- },
9383
9367
  init: {
9384
9368
  type: "boolean",
9385
9369
  alias: "i",
@@ -9597,18 +9581,18 @@ const schemaCommand = defineCommand({
9597
9581
  await fs.writeFile(path.join(config.schemaPath, "post.json"), `${JSON.stringify(postSchema, null, 2)}\n`);
9598
9582
  consola.success(`Initialized ${pc.cyan(".aiex/")} with example schemas`);
9599
9583
  consola.info("Example includes: User (with preferences has-one), Post (with comments has-many)");
9600
- outro("Run: aiex schema .aiex/schema/*.json");
9584
+ outro("Run: aiex schema");
9601
9585
  return;
9602
9586
  }
9603
- if (!args.files) {
9604
- consola.error("Missing required argument: FILES");
9605
- consola.info("Use --init to initialize with an example schema");
9606
- outro("Failed!");
9607
- return;
9587
+ let schemaFiles;
9588
+ try {
9589
+ schemaFiles = await fs.readdir(config.schemaPath);
9590
+ schemaFiles = schemaFiles.filter((f) => f.endsWith(".json")).map((f) => path.join(config.schemaPath, f));
9591
+ } catch {
9592
+ schemaFiles = [];
9608
9593
  }
9609
- const schemaFiles = await resolveSchemaFiles(args.files);
9610
9594
  if (schemaFiles.length === 0) {
9611
- consola.error(`No schema files found for: ${args.files}`);
9595
+ consola.error(`No schema files found in ${pc.cyan(".aiex/schema/")}`);
9612
9596
  consola.info("Use --init to initialize with an example schema");
9613
9597
  outro("Failed!");
9614
9598
  return;
@@ -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.0";
414
+ var version = "0.0.1-beta.1";
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 formatDoctorDiagnosticsJson, S as doctorDiagnosticsTableRows, _ as generateDrizzleConfig, b as generateDrizzleSchema, g as createMigrationConfig, t as collectDoctorDiagnostics, v as JsonSchemaDefinitionSchema, x as buildDoctorDiagnostics, y as parseJsonSchema } from "./doctor-Wic10PLt.mjs";
1
+ import { C as formatDoctorDiagnosticsJson, S as doctorDiagnosticsTableRows, _ as generateDrizzleConfig, b as generateDrizzleSchema, g as createMigrationConfig, t as collectDoctorDiagnostics, v as JsonSchemaDefinitionSchema, x as buildDoctorDiagnostics, y as parseJsonSchema } from "./doctor-Dk4QYsbc.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.0",
4
+ "version": "0.0.1-beta.1",
5
5
  "description": "JSON Schema → SQLite with AI-powered data extraction",
6
6
  "author": "OSpoon <zxin088@gmail.com>",
7
7
  "license": "MIT",