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 +69 -184
- package/dist/{doctor-LwMDdfEV.mjs → doctor-c1eu5kMM.mjs} +2 -6
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as doctorDiagnosticsTableRows,
|
|
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
|
|
13672
|
+
const examReportSchema = {
|
|
13673
13673
|
$schema: $id,
|
|
13674
|
-
title: "
|
|
13674
|
+
title: "ExamScoreReport",
|
|
13675
13675
|
type: "object",
|
|
13676
13676
|
table: {
|
|
13677
|
-
name: "
|
|
13678
|
-
timestamps: true
|
|
13679
|
-
softDelete: true
|
|
13677
|
+
name: "exam_score_reports",
|
|
13678
|
+
timestamps: true
|
|
13680
13679
|
},
|
|
13681
13680
|
properties: {
|
|
13682
|
-
|
|
13683
|
-
type: "integer",
|
|
13684
|
-
primary: true,
|
|
13685
|
-
autoIncrement: true
|
|
13686
|
-
},
|
|
13687
|
-
email: {
|
|
13681
|
+
name: {
|
|
13688
13682
|
type: "string",
|
|
13689
|
-
|
|
13690
|
-
unique: true
|
|
13683
|
+
description: "姓名"
|
|
13691
13684
|
},
|
|
13692
|
-
|
|
13685
|
+
reportNumber: {
|
|
13693
13686
|
type: "string",
|
|
13694
|
-
|
|
13695
|
-
maxLength: 50,
|
|
13696
|
-
unique: true
|
|
13687
|
+
description: "报告编号"
|
|
13697
13688
|
},
|
|
13698
|
-
|
|
13689
|
+
gender: {
|
|
13699
13690
|
type: "string",
|
|
13700
|
-
|
|
13691
|
+
description: "性别"
|
|
13701
13692
|
},
|
|
13702
|
-
|
|
13693
|
+
printDate: {
|
|
13703
13694
|
type: "string",
|
|
13704
|
-
|
|
13695
|
+
format: "date-time",
|
|
13696
|
+
description: "打印日期"
|
|
13705
13697
|
},
|
|
13706
|
-
|
|
13698
|
+
examYear: {
|
|
13699
|
+
type: "integer",
|
|
13700
|
+
description: "考试年份"
|
|
13701
|
+
},
|
|
13702
|
+
examType: {
|
|
13707
13703
|
type: "string",
|
|
13708
|
-
|
|
13704
|
+
description: "考试类型,如全国统考"
|
|
13709
13705
|
},
|
|
13710
|
-
|
|
13706
|
+
examCategory: {
|
|
13711
13707
|
type: "string",
|
|
13712
|
-
|
|
13708
|
+
description: "考试类别,如普通高考"
|
|
13713
13709
|
},
|
|
13714
|
-
|
|
13715
|
-
type: "
|
|
13716
|
-
|
|
13710
|
+
province: {
|
|
13711
|
+
type: "string",
|
|
13712
|
+
description: "考试省份"
|
|
13717
13713
|
},
|
|
13718
|
-
|
|
13714
|
+
subjectCategory: {
|
|
13719
13715
|
type: "string",
|
|
13720
|
-
|
|
13716
|
+
description: "科类,如艺术(文)"
|
|
13721
13717
|
},
|
|
13722
|
-
|
|
13723
|
-
type: "
|
|
13724
|
-
|
|
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
|
-
|
|
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
|
-
|
|
13781
|
-
autoIncrement: true
|
|
13724
|
+
description: "语文满分"
|
|
13782
13725
|
},
|
|
13783
|
-
|
|
13784
|
-
type: "
|
|
13785
|
-
|
|
13786
|
-
maxLength: 200
|
|
13726
|
+
math: {
|
|
13727
|
+
type: "integer",
|
|
13728
|
+
description: "数学成绩"
|
|
13787
13729
|
},
|
|
13788
|
-
|
|
13789
|
-
type: "
|
|
13790
|
-
|
|
13791
|
-
unique: true
|
|
13730
|
+
mathFull: {
|
|
13731
|
+
type: "integer",
|
|
13732
|
+
description: "数学满分"
|
|
13792
13733
|
},
|
|
13793
|
-
|
|
13794
|
-
|
|
13795
|
-
|
|
13796
|
-
maxLength: 300
|
|
13734
|
+
foreignLang: {
|
|
13735
|
+
type: "integer",
|
|
13736
|
+
description: "外语成绩"
|
|
13797
13737
|
},
|
|
13798
|
-
|
|
13799
|
-
|
|
13800
|
-
|
|
13801
|
-
default: "draft"
|
|
13738
|
+
foreignLangFull: {
|
|
13739
|
+
type: "integer",
|
|
13740
|
+
description: "外语满分"
|
|
13802
13741
|
},
|
|
13803
|
-
|
|
13742
|
+
comprehensive: {
|
|
13804
13743
|
type: "integer",
|
|
13805
|
-
|
|
13806
|
-
minimum: 0
|
|
13744
|
+
description: "综合成绩"
|
|
13807
13745
|
},
|
|
13808
|
-
|
|
13746
|
+
comprehensiveFull: {
|
|
13809
13747
|
type: "integer",
|
|
13810
|
-
|
|
13811
|
-
minimum: 0
|
|
13748
|
+
description: "综合满分"
|
|
13812
13749
|
},
|
|
13813
|
-
|
|
13814
|
-
type: "
|
|
13815
|
-
|
|
13750
|
+
totalScore: {
|
|
13751
|
+
type: "integer",
|
|
13752
|
+
description: "总分"
|
|
13816
13753
|
},
|
|
13817
|
-
|
|
13818
|
-
type: "
|
|
13819
|
-
|
|
13754
|
+
totalFullScore: {
|
|
13755
|
+
type: "integer",
|
|
13756
|
+
description: "总分满分"
|
|
13820
13757
|
},
|
|
13821
|
-
|
|
13822
|
-
type: "
|
|
13823
|
-
|
|
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
|
-
|
|
13832
|
-
type: "
|
|
13833
|
-
|
|
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
|
-
"
|
|
13857
|
-
"
|
|
13858
|
-
"
|
|
13768
|
+
"name",
|
|
13769
|
+
"examYear",
|
|
13770
|
+
"examType",
|
|
13771
|
+
"province",
|
|
13772
|
+
"totalScore"
|
|
13859
13773
|
]
|
|
13860
13774
|
};
|
|
13861
|
-
const
|
|
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 (
|
|
13865
|
-
|
|
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.
|
|
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 {
|
|
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
|
|
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