aiex-cli 0.0.1-beta.12 → 0.0.1-beta.14

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-LwMDdfEV.mjs";
1
+ import { C as formatDoctorDiagnosticsJson, S as doctorDiagnosticsTableRows, _ as JsonSchemaDefinitionSchema, a as DEFAULT_PROMPT_CONFIG, b as generateDrizzleSchema, c as AIConfigSchema, d as description, f as name, h as createMigrationConfig, i as writeAIConfig, l as createConfig, m as version, n as getDefaultAIConfig, o as PLACEHOLDER_SCHEMA, p as package_default, r as readAIConfig, s as PLACEHOLDER_TEXT, t as collectDoctorDiagnostics, u as seedConfig, v as parseJsonSchema, y as toSnakeCase } from "./doctor-c1eu5kMM.mjs";
2
2
  import { createRequire } from "node:module";
3
3
  import path from "node:path";
4
4
  import process from "node:process";
@@ -13669,201 +13669,113 @@ const schemaCommand = defineCommand({
13669
13669
  await fs.mkdir(config.schemaPath, { recursive: true });
13670
13670
  await fs.mkdir(path.dirname(config.drizzleSchemaPath), { recursive: true });
13671
13671
  await fs.mkdir(config.migrationsPath, { recursive: true });
13672
- const userSchema = {
13672
+ const examReportSchema = {
13673
13673
  $schema: $id,
13674
- title: "User",
13674
+ title: "ExamScoreReport",
13675
13675
  type: "object",
13676
13676
  table: {
13677
- name: "users",
13678
- timestamps: true,
13679
- softDelete: true
13677
+ name: "exam_score_reports",
13678
+ timestamps: true
13680
13679
  },
13681
13680
  properties: {
13682
- id: {
13683
- type: "integer",
13684
- primary: true,
13685
- autoIncrement: true
13686
- },
13687
- email: {
13681
+ name: {
13688
13682
  type: "string",
13689
- format: "email",
13690
- unique: true
13683
+ description: "姓名"
13691
13684
  },
13692
- username: {
13685
+ reportNumber: {
13693
13686
  type: "string",
13694
- minLength: 3,
13695
- maxLength: 50,
13696
- unique: true
13687
+ description: "报告编号"
13697
13688
  },
13698
- displayName: {
13689
+ gender: {
13699
13690
  type: "string",
13700
- maxLength: 100
13691
+ description: "性别"
13701
13692
  },
13702
- bio: {
13693
+ printDate: {
13703
13694
  type: "string",
13704
- maxLength: 500
13695
+ format: "date-time",
13696
+ description: "打印日期"
13705
13697
  },
13706
- avatarUrl: {
13698
+ examYear: {
13699
+ type: "integer",
13700
+ description: "考试年份"
13701
+ },
13702
+ examType: {
13707
13703
  type: "string",
13708
- format: "uri"
13704
+ description: "考试类型,如全国统考"
13709
13705
  },
13710
- role: {
13706
+ examCategory: {
13711
13707
  type: "string",
13712
- default: "member"
13708
+ description: "考试类别,如普通高考"
13713
13709
  },
13714
- isActive: {
13715
- type: "boolean",
13716
- default: true
13710
+ province: {
13711
+ type: "string",
13712
+ description: "考试省份"
13717
13713
  },
13718
- lastLoginAt: {
13714
+ subjectCategory: {
13719
13715
  type: "string",
13720
- format: "date-time"
13716
+ description: "科类,如艺术(文)"
13721
13717
  },
13722
- profile: {
13723
- type: "object",
13724
- drizzle: { mode: "json" },
13725
- properties: {
13726
- website: { type: "string" },
13727
- location: { type: "string" },
13728
- socialLinks: {
13729
- type: "array",
13730
- items: {
13731
- type: "object",
13732
- properties: {
13733
- platform: { type: "string" },
13734
- url: { type: "string" }
13735
- }
13736
- }
13737
- }
13738
- }
13718
+ chinese: {
13719
+ type: "integer",
13720
+ description: "语文成绩"
13739
13721
  },
13740
- preferences: {
13741
- type: "object",
13742
- nested: {
13743
- enabled: true,
13744
- relation: "has-one"
13745
- },
13746
- properties: {
13747
- theme: {
13748
- type: "string",
13749
- default: "light"
13750
- },
13751
- language: {
13752
- type: "string",
13753
- default: "en"
13754
- },
13755
- emailNotifications: {
13756
- type: "boolean",
13757
- default: true
13758
- },
13759
- pushNotifications: {
13760
- type: "boolean",
13761
- default: false
13762
- }
13763
- }
13764
- }
13765
- },
13766
- required: ["email", "username"]
13767
- };
13768
- const postSchema = {
13769
- $schema: $id,
13770
- title: "Post",
13771
- type: "object",
13772
- table: {
13773
- name: "posts",
13774
- timestamps: true,
13775
- softDelete: true
13776
- },
13777
- properties: {
13778
- id: {
13722
+ chineseFull: {
13779
13723
  type: "integer",
13780
- primary: true,
13781
- autoIncrement: true
13724
+ description: "语文满分"
13782
13725
  },
13783
- title: {
13784
- type: "string",
13785
- minLength: 5,
13786
- maxLength: 200
13726
+ math: {
13727
+ type: "integer",
13728
+ description: "数学成绩"
13787
13729
  },
13788
- slug: {
13789
- type: "string",
13790
- maxLength: 250,
13791
- unique: true
13730
+ mathFull: {
13731
+ type: "integer",
13732
+ description: "数学满分"
13792
13733
  },
13793
- content: { type: "string" },
13794
- excerpt: {
13795
- type: "string",
13796
- maxLength: 300
13734
+ foreignLang: {
13735
+ type: "integer",
13736
+ description: "外语成绩"
13797
13737
  },
13798
- authorId: { type: "integer" },
13799
- status: {
13800
- type: "string",
13801
- default: "draft"
13738
+ foreignLangFull: {
13739
+ type: "integer",
13740
+ description: "外语满分"
13802
13741
  },
13803
- viewCount: {
13742
+ comprehensive: {
13804
13743
  type: "integer",
13805
- default: 0,
13806
- minimum: 0
13744
+ description: "综合成绩"
13807
13745
  },
13808
- likeCount: {
13746
+ comprehensiveFull: {
13809
13747
  type: "integer",
13810
- default: 0,
13811
- minimum: 0
13748
+ description: "综合满分"
13812
13749
  },
13813
- publishedAt: {
13814
- type: "string",
13815
- format: "date-time"
13750
+ totalScore: {
13751
+ type: "integer",
13752
+ description: "总分"
13816
13753
  },
13817
- tags: {
13818
- type: "array",
13819
- items: { type: "string" }
13754
+ totalFullScore: {
13755
+ type: "integer",
13756
+ description: "总分满分"
13820
13757
  },
13821
- metadata: {
13822
- type: "object",
13823
- drizzle: { mode: "json" },
13824
- properties: {
13825
- featuredImage: { type: "string" },
13826
- readingTime: { type: "integer" },
13827
- seoTitle: { type: "string" },
13828
- seoDescription: { type: "string" }
13829
- }
13758
+ batchLineFirst: {
13759
+ type: "integer",
13760
+ description: "本科第一批录取分数线"
13830
13761
  },
13831
- comments: {
13832
- type: "array",
13833
- items: {
13834
- type: "object",
13835
- nested: {
13836
- enabled: true,
13837
- relation: "has-many"
13838
- },
13839
- properties: {
13840
- content: {
13841
- type: "string",
13842
- minLength: 1,
13843
- maxLength: 1e3
13844
- },
13845
- authorId: { type: "integer" },
13846
- status: {
13847
- type: "string",
13848
- default: "pending"
13849
- },
13850
- parentId: { type: "integer" }
13851
- }
13852
- }
13762
+ batchLineSecond: {
13763
+ type: "integer",
13764
+ description: "本科第二批录取分数线"
13853
13765
  }
13854
13766
  },
13855
13767
  required: [
13856
- "title",
13857
- "slug",
13858
- "authorId"
13768
+ "name",
13769
+ "examYear",
13770
+ "examType",
13771
+ "province",
13772
+ "totalScore"
13859
13773
  ]
13860
13774
  };
13861
- const userStatus = await writeJsonIfAbsent(path.join(config.schemaPath, "user.json"), userSchema);
13862
- const postStatus = await writeJsonIfAbsent(path.join(config.schemaPath, "post.json"), postSchema);
13775
+ const examStatus = await writeJsonIfAbsent(path.join(config.schemaPath, "exam_score_reports.json"), examReportSchema);
13863
13776
  consola.success(`Initialized ${pc.cyan(".aiex/")} with example schemas`);
13864
- if (userStatus === "skipped") consola.warn(`${pc.cyan(".aiex/schema/user.json")} already exists, skipped`);
13865
- if (postStatus === "skipped") consola.warn(`${pc.cyan(".aiex/schema/post.json")} already exists, skipped`);
13866
- consola.info("Example includes: User (with preferences has-one), Post (with comments has-many)");
13777
+ if (examStatus === "skipped") consola.warn(`${pc.cyan(".aiex/schema/exam_score_reports.json")} already exists, skipped`);
13778
+ consola.info("Example includes: ExamScoreReport (college entrance exam score report)");
13867
13779
  outro("Run: aiex schema");
13868
13780
  return;
13869
13781
  }
@@ -13905,13 +13817,6 @@ const schemaCommand = defineCommand({
13905
13817
 
13906
13818
  //#endregion
13907
13819
  //#region src/server/routes/ai.ts
13908
- function maskSecretKey(key) {
13909
- if (!key || key.length <= 4) return "****";
13910
- return `sk-***${key.slice(-4)}`;
13911
- }
13912
- function isMasked(key) {
13913
- return key.startsWith("sk-***");
13914
- }
13915
13820
  function aiRoutes(config) {
13916
13821
  const app = new Hono();
13917
13822
  const aiexDir = path.dirname(config.schemaPath);
@@ -13927,17 +13832,7 @@ function aiRoutes(config) {
13927
13832
  }
13928
13833
  });
13929
13834
  }
13930
- return c.json({
13931
- ...aiConfig,
13932
- provider: {
13933
- ...aiConfig.provider,
13934
- apiKey: maskApiKey(aiConfig.provider.apiKey)
13935
- },
13936
- langfuse: aiConfig.langfuse ? {
13937
- ...aiConfig.langfuse,
13938
- secretKey: maskSecretKey(aiConfig.langfuse.secretKey)
13939
- } : void 0
13940
- });
13835
+ return c.json(aiConfig);
13941
13836
  });
13942
13837
  app.post("/ai/registry-lookup", async (c) => {
13943
13838
  try {
@@ -13965,16 +13860,6 @@ function aiRoutes(config) {
13965
13860
  success: false,
13966
13861
  error: "At least one model must be configured"
13967
13862
  }, 400);
13968
- if (body.provider?.apiKey?.startsWith("sk-***")) {
13969
- const existing = await readAIConfig(aiexDir);
13970
- if (existing) body.provider.apiKey = existing.provider.apiKey;
13971
- else body.provider.apiKey = "";
13972
- }
13973
- if (body.langfuse?.secretKey && isMasked(body.langfuse.secretKey)) {
13974
- const existing = await readAIConfig(aiexDir);
13975
- if (existing?.langfuse) body.langfuse.secretKey = existing.langfuse.secretKey;
13976
- else body.langfuse.secretKey = "";
13977
- }
13978
13863
  await writeAIConfig(aiexDir, AIConfigSchema.parse(body));
13979
13864
  return c.json({ success: true });
13980
13865
  } catch (error) {
@@ -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.12";
414
+ var version = "0.0.1-beta.14";
415
415
  var description = "JSON Schema → SQLite with AI-powered data extraction";
416
416
  var package_default = {
417
417
  name,
@@ -618,10 +618,6 @@ async function writeAIConfig(aiexDir, config) {
618
618
  function getDefaultAIConfig() {
619
619
  return { ...DEFAULT_AI_CONFIG };
620
620
  }
621
- function maskApiKey(apiKey) {
622
- if (apiKey.length <= 4) return "****";
623
- return `sk-***${apiKey.slice(-4)}`;
624
- }
625
621
  async function addToGitignore(aiexDir, fileName) {
626
622
  const projectRoot = path.dirname(aiexDir);
627
623
  const gitignorePath = path.join(projectRoot, GITIGNORE_FILE);
@@ -722,4 +718,4 @@ async function collectDoctorDiagnostics(options = {}) {
722
718
  }
723
719
 
724
720
  //#endregion
725
- export { doctorDiagnosticsTableRows as C, buildDoctorDiagnostics as S, generateDrizzleConfig as _, writeAIConfig as a, toSnakeCase as b, PLACEHOLDER_TEXT as c, seedConfig as d, description as f, createMigrationConfig as g, version as h, readAIConfig as i, AIConfigSchema as l, package_default as m, getDefaultAIConfig as n, DEFAULT_PROMPT_CONFIG as o, name as p, maskApiKey as r, PLACEHOLDER_SCHEMA as s, collectDoctorDiagnostics as t, createConfig as u, JsonSchemaDefinitionSchema as v, formatDoctorDiagnosticsJson as w, generateDrizzleSchema as x, parseJsonSchema as y };
721
+ export { formatDoctorDiagnosticsJson as C, doctorDiagnosticsTableRows as S, JsonSchemaDefinitionSchema as _, DEFAULT_PROMPT_CONFIG as a, generateDrizzleSchema as b, AIConfigSchema as c, description as d, name as f, generateDrizzleConfig as g, createMigrationConfig as h, writeAIConfig as i, createConfig as l, version as m, getDefaultAIConfig as n, PLACEHOLDER_SCHEMA as o, package_default as p, readAIConfig as r, PLACEHOLDER_TEXT as s, collectDoctorDiagnostics as t, seedConfig as u, parseJsonSchema as v, buildDoctorDiagnostics as x, toSnakeCase as y };
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-LwMDdfEV.mjs";
1
+ import { C as formatDoctorDiagnosticsJson, S as doctorDiagnosticsTableRows, _ as JsonSchemaDefinitionSchema, b as generateDrizzleSchema, g as generateDrizzleConfig, h as createMigrationConfig, t as collectDoctorDiagnostics, v as parseJsonSchema, x as buildDoctorDiagnostics } from "./doctor-c1eu5kMM.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.12",
4
+ "version": "0.0.1-beta.14",
5
5
  "description": "JSON Schema → SQLite with AI-powered data extraction",
6
6
  "author": "OSpoon <zxin088@gmail.com>",
7
7
  "license": "MIT",