aiex-cli 0.0.3 → 0.0.4-beta.2

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.
Files changed (117) hide show
  1. package/dist/cli.mjs +1046 -791
  2. package/dist/{doctor-collector-BVbuw5LY.mjs → doctor-collector-CDg_BdI8.mjs} +556 -10
  3. package/dist/index.mjs +1 -1
  4. package/dist/web/assets/AISettings-kEwOynPE.js +272 -0
  5. package/dist/web/assets/DataBrowser-IlgTMGi0.js +97 -0
  6. package/dist/web/assets/ExtractionViewer-0F4C26V5.js +1 -0
  7. package/dist/web/assets/JsonSchemaEditor-Dyl391lX.js +571 -0
  8. package/dist/web/assets/{api-client-BsgtGnzl.js → api-client-b4ZBXpNH.js} +1 -1
  9. package/dist/web/assets/{cssMode-CPThwItX.js → cssMode-BM5FOYIl.js} +1 -1
  10. package/dist/web/assets/dialog-CnZ7jH1l.js +109 -0
  11. package/dist/web/assets/dist-CElVIpns.js +1 -0
  12. package/dist/web/assets/{editor.main-BnOkwRFv.js → editor.main-C2Q97Dkk.js} +2 -2
  13. package/dist/web/assets/{freemarker2-DWDTYVJR.js → freemarker2-BqyJTCTn.js} +1 -1
  14. package/dist/web/assets/{handlebars-D4DzjGQ7.js → handlebars-DxRJTefg.js} +1 -1
  15. package/dist/web/assets/{html-DnzhKSoD.js → html-gyvgrapw.js} +1 -1
  16. package/dist/web/assets/{htmlMode-CR7UKfEH.js → htmlMode-CNjCRwdY.js} +1 -1
  17. package/dist/web/assets/{index-CPjJbU4i.js → index-C8qUHnqD.js} +38 -38
  18. package/dist/web/assets/{javascript-D2srszZ8.js → javascript-BK6ufvq6.js} +1 -1
  19. package/dist/web/assets/{jsonMode-B4jaPYEr.js → jsonMode-m2trGjkO.js} +1 -1
  20. package/dist/web/assets/{liquid-CIT2Wl_l.js → liquid-BtyuYqQQ.js} +1 -1
  21. package/dist/web/assets/{mdx-CWLaEOFy.js → mdx-C8K4EvCQ.js} +1 -1
  22. package/dist/web/assets/{monaco.contribution-DDv5ldfS.js → monaco.contribution-BTr-G8hO.js} +2 -2
  23. package/dist/web/assets/object-utils-C6FkG7fw.js +1 -0
  24. package/dist/web/assets/{python-6CGfpCNq.js → python-8dyH1nS_.js} +1 -1
  25. package/dist/web/assets/{razor-DEMMh3TD.js → razor-DtWMI74k.js} +1 -1
  26. package/dist/web/assets/textarea-DMpqBhjw.js +522 -0
  27. package/dist/web/assets/{tsMode-Cm1NtjPs.js → tsMode-Dv8YG-YK.js} +1 -1
  28. package/dist/web/assets/{typescript-BM9aPEFg.js → typescript-DbClKYS3.js} +1 -1
  29. package/dist/web/assets/vue-i18n-Du42D0vb.js +931 -0
  30. package/dist/web/assets/{xml-CoSbvcg5.js → xml-Bb59gjP6.js} +1 -1
  31. package/dist/web/assets/{yaml-56GOgy8k.js → yaml-DVMb_IfV.js} +1 -1
  32. package/dist/web/index.html +8 -8
  33. package/dist/zh-CN-B5QVQVm-.mjs +486 -0
  34. package/package.json +3 -1
  35. package/dist/web/assets/AISettings-D6EpB8tt.js +0 -272
  36. package/dist/web/assets/DataBrowser-N77fBaoa.js +0 -97
  37. package/dist/web/assets/ExtractionViewer-BSZycwgL.js +0 -1
  38. package/dist/web/assets/JsonSchemaEditor-DfHs5bc0.js +0 -571
  39. package/dist/web/assets/button-Cdgr9Igy.js +0 -927
  40. package/dist/web/assets/dialog-CUkPLPNP.js +0 -109
  41. package/dist/web/assets/dist-9yHVMqQ0.js +0 -1
  42. package/dist/web/assets/object-utils-I4gWdSnS.js +0 -1
  43. package/dist/web/assets/runtime-dom.esm-bundler-ei_N7Xjw.js +0 -1
  44. package/dist/web/assets/textarea-DEQMRfG8.js +0 -522
  45. /package/dist/{completions-C3rmTwXZ.mjs → completions-Bh0DOngr.mjs} +0 -0
  46. /package/dist/web/assets/{abap-Bgec7Keq.js → abap-DiwvWnMr.js} +0 -0
  47. /package/dist/web/assets/{apex-VBlPwEoQ.js → apex-CmtZjKlf.js} +0 -0
  48. /package/dist/web/assets/{azcli-DKqrEFBx.js → azcli-DL2My_i-.js} +0 -0
  49. /package/dist/web/assets/{bat-DdgQWy_0.js → bat-B-nC98wG.js} +0 -0
  50. /package/dist/web/assets/{bicep-CRMM43EB.js → bicep-Ju5MwOgh.js} +0 -0
  51. /package/dist/web/assets/{cameligo-UatALtML.js → cameligo-8Eu1TyBr.js} +0 -0
  52. /package/dist/web/assets/{clojure-D8JU08RA.js → clojure-u-RpMkH3.js} +0 -0
  53. /package/dist/web/assets/{coffee-C56wu358.js → coffee-CdA7bbTe.js} +0 -0
  54. /package/dist/web/assets/{cpp-CyZLvhJG.js → cpp-CzNFP8ks.js} +0 -0
  55. /package/dist/web/assets/{csharp-BJl3ixva.js → csharp-j1LThmcE.js} +0 -0
  56. /package/dist/web/assets/{csp-CxEKxmO-.js → csp-CLRC61y6.js} +0 -0
  57. /package/dist/web/assets/{css-B0t_muXd.js → css-r6rC_7P2.js} +0 -0
  58. /package/dist/web/assets/{cypher-D1hqiMFD.js → cypher-CW08XVUh.js} +0 -0
  59. /package/dist/web/assets/{dart-Bz550Pyv.js → dart-Cs9aL5T_.js} +0 -0
  60. /package/dist/web/assets/{dockerfile-CIXgVAuA.js → dockerfile-BWM0M184.js} +0 -0
  61. /package/dist/web/assets/{ecl-D9qbvZoA.js → ecl-MJJuer5P.js} +0 -0
  62. /package/dist/web/assets/{editor.api-C8BHpRhn.js → editor.api-nsOUOZde.js} +0 -0
  63. /package/dist/web/assets/{elixir-b2M38fAy.js → elixir-D2AIuXqn.js} +0 -0
  64. /package/dist/web/assets/{flow9-Dq1UYMkt.js → flow9-B2H24giC.js} +0 -0
  65. /package/dist/web/assets/{fsharp-BaeLhgfq.js → fsharp-CFNadkg7.js} +0 -0
  66. /package/dist/web/assets/{go-Bd-NFKIC.js → go-dSur1iB2.js} +0 -0
  67. /package/dist/web/assets/{graphql-DZVerJfy.js → graphql-qyhAo11d.js} +0 -0
  68. /package/dist/web/assets/{hcl-CAVzrZfH.js → hcl-DFzjMyzm.js} +0 -0
  69. /package/dist/web/assets/{ini-CyXdX58t.js → ini-TdzA8TIl.js} +0 -0
  70. /package/dist/web/assets/{java-B5pNgvhy.js → java-CSGA9pkE.js} +0 -0
  71. /package/dist/web/assets/{julia-XRhmV3AN.js → julia-9izz5OsY.js} +0 -0
  72. /package/dist/web/assets/{kotlin-DOd3J5vr.js → kotlin-DuPK7AtF.js} +0 -0
  73. /package/dist/web/assets/{less-veZSnyw6.js → less-B8d93iCg.js} +0 -0
  74. /package/dist/web/assets/{lexon-QWGkuK0H.js → lexon-DWtEIyu7.js} +0 -0
  75. /package/dist/web/assets/{lua-CYGpjuO5.js → lua-Ciq0OGgt.js} +0 -0
  76. /package/dist/web/assets/{m3-yNnrZkdc.js → m3-Cki6JWj_.js} +0 -0
  77. /package/dist/web/assets/{markdown-BCSWEPSX.js → markdown-Cu47xwU0.js} +0 -0
  78. /package/dist/web/assets/{mips-OpYmcC30.js → mips-BM8ui995.js} +0 -0
  79. /package/dist/web/assets/{msdax-2oxoTO9Z.js → msdax-DqLio0_c.js} +0 -0
  80. /package/dist/web/assets/{mysql-5KlC-K_9.js → mysql-v1wbjJOq.js} +0 -0
  81. /package/dist/web/assets/{objective-c-CcDCgtLx.js → objective-c-CQl3PGSB.js} +0 -0
  82. /package/dist/web/assets/{pascal-BZGsbaEV.js → pascal-D4iW0ZtD.js} +0 -0
  83. /package/dist/web/assets/{pascaligo-DtD5qU3G.js → pascaligo-BdC9CZdj.js} +0 -0
  84. /package/dist/web/assets/{perl-C1jNNS3E.js → perl-BL10m4XD.js} +0 -0
  85. /package/dist/web/assets/{pgsql-CT0fhiZa.js → pgsql-Be_oqVo3.js} +0 -0
  86. /package/dist/web/assets/{php-D6DrXoPM.js → php-BtvXSFRI.js} +0 -0
  87. /package/dist/web/assets/{pla-b3-HN2pF.js → pla-B2vUy15C.js} +0 -0
  88. /package/dist/web/assets/{postiats-Bin2ApVS.js → postiats-CbmTTfXr.js} +0 -0
  89. /package/dist/web/assets/{powerquery-7ASnn-ZG.js → powerquery-DszLhJGx.js} +0 -0
  90. /package/dist/web/assets/{powershell-t4p7sU1H.js → powershell-B0dYktF6.js} +0 -0
  91. /package/dist/web/assets/{preload-helper-Dd-HcVz_.js → preload-helper-DWTEM3RW.js} +0 -0
  92. /package/dist/web/assets/{protobuf-BUGeWa_j.js → protobuf-CZvaj1VX.js} +0 -0
  93. /package/dist/web/assets/{pug-BuKcgC9s.js → pug-CPDx1B3S.js} +0 -0
  94. /package/dist/web/assets/{qsharp-DxLLX8mo.js → qsharp-CAxMZVjw.js} +0 -0
  95. /package/dist/web/assets/{r-DMlFgn7A.js → r-8DbbFX2l.js} +0 -0
  96. /package/dist/web/assets/{redis-cXItkC5u.js → redis-DRWj9MtJ.js} +0 -0
  97. /package/dist/web/assets/{redshift-BZVbW7HE.js → redshift-C6cElE_5.js} +0 -0
  98. /package/dist/web/assets/{restructuredtext-BzjxwS8h.js → restructuredtext-W9pS9n3m.js} +0 -0
  99. /package/dist/web/assets/{ruby-C5nyLV4l.js → ruby-BKnzWnk-.js} +0 -0
  100. /package/dist/web/assets/{rust-BcmMsHdf.js → rust-YPCclWwe.js} +0 -0
  101. /package/dist/web/assets/{sb-Dnb1iy6B.js → sb-BgM4DTFb.js} +0 -0
  102. /package/dist/web/assets/{scala-anMIFYpA.js → scala-fz1OPLMl.js} +0 -0
  103. /package/dist/web/assets/{scheme-BItQTe08.js → scheme-8Uz1RIbu.js} +0 -0
  104. /package/dist/web/assets/{scss-BOv51BJ5.js → scss-Djo3IYXr.js} +0 -0
  105. /package/dist/web/assets/{shell-BsRYRTNN.js → shell-CINF5Tx_.js} +0 -0
  106. /package/dist/web/assets/{solidity-BtuLgGDx.js → solidity-GgiNEuUm.js} +0 -0
  107. /package/dist/web/assets/{sophia-B0Vkc5MF.js → sophia-Culj97P9.js} +0 -0
  108. /package/dist/web/assets/{sparql-B7lvkZQM.js → sparql-C2ZlpxOY.js} +0 -0
  109. /package/dist/web/assets/{sql-DvP5MpA3.js → sql-BEf5Pg7Y.js} +0 -0
  110. /package/dist/web/assets/{st-GVUeyB3U.js → st-CT6UUoeH.js} +0 -0
  111. /package/dist/web/assets/{swift-DSPIoCjm.js → swift-B5g0xTG3.js} +0 -0
  112. /package/dist/web/assets/{systemverilog-Icj2-k23.js → systemverilog-CEgQz9DR.js} +0 -0
  113. /package/dist/web/assets/{tcl-Cd8KQcm-.js → tcl-D0qL2L0I.js} +0 -0
  114. /package/dist/web/assets/{twig-CBHmt8z3.js → twig-BFUAVf1E.js} +0 -0
  115. /package/dist/web/assets/{typespec-Ckc037mq.js → typespec-CjVVcNKm.js} +0 -0
  116. /package/dist/web/assets/{vb-B97GW9Wb.js → vb-CZJr-DQz.js} +0 -0
  117. /package/dist/web/assets/{wgsl-DIKmb3YH.js → wgsl-ivoXUo2e.js} +0 -0
@@ -74,7 +74,7 @@ function doctorDiagnosticsTableRows(d) {
74
74
  //#endregion
75
75
  //#region package.json
76
76
  var name = "aiex-cli";
77
- var version = "0.0.3";
77
+ var version = "0.0.4-beta.2";
78
78
  var description = "JSON Schema → SQLite with AI-powered data extraction";
79
79
  var package_default = {
80
80
  name,
@@ -155,6 +155,8 @@ var package_default = {
155
155
  "esbuild": "catalog:",
156
156
  "execa": "catalog:",
157
157
  "hono": "catalog:",
158
+ "i18next": "catalog:",
159
+ "i18next-fs-backend": "catalog:",
158
160
  "jsonfile": "catalog:",
159
161
  "jsonrepair": "catalog:",
160
162
  "kysely": "catalog:",
@@ -270,6 +272,11 @@ const NotionConfigSchema = z.object({
270
272
  token: z.string(),
271
273
  schemas: z.record(NotionSchemaConfigSchema).default({})
272
274
  });
275
+ const WebhookConfigSchema = z.object({
276
+ enabled: z.boolean(),
277
+ url: z.string(),
278
+ secret: z.string().optional()
279
+ });
273
280
  const AIConfigSchema = z.object({
274
281
  provider: AIProviderConfigSchema,
275
282
  prompt: PromptConfigSchema,
@@ -277,7 +284,8 @@ const AIConfigSchema = z.object({
277
284
  image: ImageOcrConfigSchema.optional(),
278
285
  pdf: PdfConfigSchema.optional(),
279
286
  langfuse: LangfuseConfigSchema.optional(),
280
- notion: NotionConfigSchema.optional()
287
+ notion: NotionConfigSchema.optional(),
288
+ webhook: WebhookConfigSchema.optional()
281
289
  });
282
290
 
283
291
  //#endregion
@@ -369,7 +377,12 @@ const DEFAULT_AI_CONFIG = {
369
377
  prompt: DEFAULT_PROMPT_CONFIG,
370
378
  extraction: DEFAULT_EXTRACTION_CONFIG,
371
379
  image: DEFAULT_IMAGE_OCR_CONFIG,
372
- pdf: DEFAULT_PDF_CONFIG
380
+ pdf: DEFAULT_PDF_CONFIG,
381
+ webhook: {
382
+ enabled: false,
383
+ url: "",
384
+ secret: ""
385
+ }
373
386
  };
374
387
 
375
388
  //#endregion
@@ -410,6 +423,536 @@ async function addToGitignore(aiexDir, fileName) {
410
423
  }
411
424
  }
412
425
 
426
+ //#endregion
427
+ //#region src/locales/en.ts
428
+ const en = {
429
+ common: {
430
+ done: "Done!",
431
+ failed: "Failed!",
432
+ cancelled: "Cancelled",
433
+ save: "Save",
434
+ cancel: "Cancel",
435
+ delete: "Delete",
436
+ close: "Close",
437
+ loading: "Loading...",
438
+ unknownError: "Unknown error"
439
+ },
440
+ cli: { description: "JSON Schema → SQLite with AI-powered data extraction" },
441
+ command: {
442
+ web: {
443
+ description: "Start visual JSON Schema editor",
444
+ args: { port: "Port to listen on" },
445
+ starting: "Starting web server...",
446
+ serverRunning: "Server running at {{url}}",
447
+ schemaDir: "Schema directory: {{path}}",
448
+ pressCtrlC: "Press Ctrl+C to stop",
449
+ browserOpenFailed: "Could not open browser. Visit {{url}} manually."
450
+ },
451
+ schema: {
452
+ description: "Sync JSON Schema to SQLite database",
453
+ args: {
454
+ generate: "Only generate Drizzle schema, skip migrate",
455
+ name: "Name for the migration"
456
+ },
457
+ noSchemas: "No schema files found in {{path}}",
458
+ runWebHint: "Run {{cmd}} to create and configure schemas in the Web UI",
459
+ generating: "Generating Drizzle schema...",
460
+ generated: "Generated {{path}} from {{count}} schema file(s)",
461
+ generatedOk: "Schema generated",
462
+ generatedFail: "Generation failed",
463
+ runningMigrations: "Running migrations...",
464
+ migrationFailed: "Failed to generate migration",
465
+ noChanges: "No changes detected",
466
+ migrationFilesGenerated: "Migration files generated",
467
+ databaseMigrated: "Database migrated",
468
+ migrationsApplied: "Migrations applied",
469
+ migrationFail: "Migration failed",
470
+ runWithoutGenerate: "Done! Run without --generate to apply migrations"
471
+ },
472
+ extract: {
473
+ description: "Extract structured data from text, images, or PDFs",
474
+ args: {
475
+ schema: "Schema name (without .json extension)",
476
+ file: "File path to extract from. Supported: {{types}}.",
477
+ model: "AI model to use for extraction (overrides auto-selection)",
478
+ dir: "Directory containing files to batch extract",
479
+ glob: "Glob pattern to filter files in batch mode (e.g. \"*.pdf\")",
480
+ noInsert: "Extract and save JSON without inserting into SQLite",
481
+ force: "Force re-extraction even if the file has already been processed successfully"
482
+ },
483
+ interactive: {
484
+ selectSchema: "Select a schema to extract data for:",
485
+ chooseSource: "Choose input source:",
486
+ singleFile: "Single file",
487
+ singleFileHint: "Extract from a file (txt, pdf, image)",
488
+ batchDir: "Batch directory",
489
+ batchDirHint: "Extract all supported files in a directory",
490
+ enterFilePath: "Enter file path:",
491
+ enterDirPath: "Enter directory path:",
492
+ filePathRequired: "Please enter a file path",
493
+ dirPathRequired: "Please enter a directory path"
494
+ },
495
+ errors: {
496
+ noAIConfig: "AI configuration not found. Please run \"{{cmd}}\" to configure AI settings first",
497
+ noApiKey: "API Key not configured. Please configure AI settings in the Web interface first",
498
+ noModels: "No models configured. Please add at least one model in AI Settings",
499
+ modelNotFound: "Model \"{{model}}\" not found in configuration. Available models: {{available}}",
500
+ conflictFileDir: "Cannot combine -f/--file with -d/--dir",
501
+ schemaRequiredBatch: "Schema name (-s) is required in batch mode",
502
+ schemaRequiredSingle: "Please provide a schema name (-s) to extract from",
503
+ fileRequiredSingle: "Please provide a file (-f) to extract from",
504
+ noSchemas: "No schema files found in {{path}}. Run {{cmd}} to create and configure schemas first."
505
+ },
506
+ history: {
507
+ description: "List extraction audit records",
508
+ empty: "No extraction history found",
509
+ errors: {
510
+ idRequired: "Audit record id is required",
511
+ recordNotFound: "Extraction record not found: {{id}}"
512
+ },
513
+ deleted: "Deleted extraction record: {{id}}"
514
+ },
515
+ show: {
516
+ description: "Show an extraction audit record",
517
+ args: { id: "Audit record id" }
518
+ },
519
+ retry: {
520
+ description: "Retry an extraction audit record",
521
+ args: {
522
+ id: "Audit record id",
523
+ noInsert: "Extract and save JSON without inserting into SQLite"
524
+ }
525
+ },
526
+ rm: {
527
+ description: "Delete an extraction audit record and cached upload",
528
+ args: { id: "Audit record id" }
529
+ },
530
+ batch: {
531
+ scanning: "Scanning {{dir}} for supported files...",
532
+ found: "Found {{count}} file(s) to process",
533
+ processing: "[{{current}}/{{total}}] Processing: {{file}}",
534
+ complete: "Batch complete: {{success}} succeeded, {{fail}} failed, {{total}} total",
535
+ failSummary: "Completed with failures ({{count}} failed)",
536
+ errors: {
537
+ cannotReadDir: "Cannot read directory: {{dir}}",
538
+ noSupportedFiles: "No supported files found in {{dir}}"
539
+ }
540
+ },
541
+ file: {
542
+ hashWarning: "Failed to calculate file hash for {{file}}: {{error}}",
543
+ alreadyProcessed: "File {{file}} (hash: {{hash}}) has already been processed successfully. Skipping.",
544
+ ocrText: "Extracted image text via local OCR (confidence: {{confidence}}%)",
545
+ pdfFallback: "Fell back to unpdf — {{count}} page(s) extracted",
546
+ pdfConverted: "Converted PDF via {{name}}, {{count}} page(s)",
547
+ markdownSaved: "Markdown saved: {{path}}",
548
+ errorProcessing: "Error processing {{name}}: {{error}}",
549
+ extractedFrom: "Extracting from {{file}}...",
550
+ extracting: "Extracting data...",
551
+ extractFail: "Extraction failed",
552
+ extractComplete: "Extraction complete",
553
+ extractRetry: "API responded with {{code}}, retrying in {{delay}}s ({{attempt}}/{{max}})",
554
+ resultSaved: "Result saved: {{path}}",
555
+ tokenUsage: "Token usage: prompt={{prompt}}, completion={{completion}}, total={{total}}",
556
+ insertingDb: "Inserting into database...",
557
+ dbNotReady: "Database not ready",
558
+ insertedTables: "Inserted into {{count}} table(s)",
559
+ dbInsertFail: "Database insert failed",
560
+ processSuccess: "Processed: {{file}}",
561
+ notionSynced: "Synced to Notion: {{count}} page(s)",
562
+ notionSyncFail: "Notion sync failed: {{error}}",
563
+ webhookSynced: "Webhook payload sent successfully",
564
+ webhookSyncFail: "Webhook push failed: {{error}}",
565
+ extractionFailed: "Failed: {{error}}"
566
+ }
567
+ },
568
+ watch: {
569
+ description: "Watch a directory for new files and automatically extract data",
570
+ args: {
571
+ schema: "Schema name (without .json extension) to use for extraction",
572
+ dir: "Directory path to watch for incoming files",
573
+ model: "AI model to use for extraction (overrides default/auto-selected model)",
574
+ noInsert: "Extract and save JSON without inserting into SQLite database"
575
+ },
576
+ errors: {
577
+ schemaRequired: "Schema name (-s) is required",
578
+ dirRequired: "Watch directory path (-d) is required",
579
+ schemaNotFound: "Schema file for \"{{name}}\" not found",
580
+ dirNotExist: "Watch directory does not exist: {{dir}} — {{error}}",
581
+ notADirectory: "Watch path is not a directory: {{dir}}"
582
+ },
583
+ starting: {
584
+ watchFolder: "Starting watch on folder: {{dir}}",
585
+ schema: "Schema: {{name}}",
586
+ modelOverride: "Model Override: {{name}}"
587
+ },
588
+ events: {
589
+ stopped: "Stopping watch directory daemon...",
590
+ stoppedOk: "Daemon stopped.",
591
+ pressCtrlC: "Press Ctrl+C to stop",
592
+ skippedUnsupported: "[Watcher] Skipped unsupported file type: {{file}}",
593
+ fileDetected: "[Watcher] New file detected: {{file}}. Processing...",
594
+ alreadyProcessed: "[Watcher] File {{file}} (hash: {{hash}}) has already been processed successfully. Skipping.",
595
+ processedSuccess: "[Watcher] File processed successfully: {{file}}",
596
+ processingFailed: "[Watcher] Processing failed for: {{file}}",
597
+ extractionFailed: "Extraction failed. See extraction audit history.",
598
+ errorProcessing: "[Watcher] Error processing file {{file}}: {{error}}",
599
+ watcherError: "[Watcher] Watcher error: {{error}}"
600
+ },
601
+ notification: {
602
+ success: "Successfully processed and inserted data.",
603
+ successTitle: "AIEX Watch: {{file}}",
604
+ failTitle: "AIEX Watch Failed: {{file}}"
605
+ }
606
+ },
607
+ dump: {
608
+ description: "Dump SQLite database table to Excel (.xlsx) or CSV (.csv)",
609
+ args: {
610
+ table: "SQLite table name to export",
611
+ schema: "Schema name (without .json extension) to export",
612
+ format: "Export format: csv or xlsx (default: inferred from output or csv)",
613
+ output: "Output file path (default: ./<tableName>.<format>)"
614
+ },
615
+ errors: {
616
+ tableOrSchemaRequired: "Either table name (--table / -t) or schema name (--schema / -s) is required",
617
+ schemaNotFound: "Schema file for \"{{name}}\" not found",
618
+ noTableName: "Schema \"{{name}}\" does not define a database table name.",
619
+ tableMismatch: "Specified table name \"{{table}}\" does not match schema table name \"{{schemaTable}}\"",
620
+ unsupportedFormat: "Unsupported dump format: \"{{format}}\". Supported formats: csv, xlsx",
621
+ dbNotFound: "Database file not found at {{path}}. Please run \"{{cmd}}\" to create the database first.",
622
+ tableNotFound: "Table \"{{name}}\" not found in database. Run \"{{cmd}}\" first to migrate.",
623
+ tableEmpty: "Table \"{{name}}\" is empty. Exporting empty file..."
624
+ },
625
+ loading: "Loading data from table \"{{name}}\"...",
626
+ loaded: "Loaded {{count}} row(s)",
627
+ emptyTable: "Empty table",
628
+ formatting: "Formatting data...",
629
+ formatted: "Data formatted",
630
+ writing: "Writing {{format}} file to {{path}}...",
631
+ dumpCompleted: "Dump completed successfully",
632
+ successMsg: "Successfully dumped {{count}} row(s) to {{path}}",
633
+ fileWriteFailed: "File write failed",
634
+ dbQueryFailed: "Database query failed"
635
+ },
636
+ doctor: {
637
+ description: "Print environment and configuration diagnostics",
638
+ args: { json: "Print diagnostics as JSON" },
639
+ headers: ["key", "value"],
640
+ diagnosticsFailed: "Doctor diagnostics failed: {{error}}",
641
+ notTested: "not tested",
642
+ none: "none"
643
+ },
644
+ completion: {
645
+ description: "Generate shell completion scripts (bash|zsh|fish)\n\nUsage:\n aiex completion bash # source <(aiex completion bash)\n aiex completion zsh # source <(aiex completion zsh)\n aiex completion fish # aiex completion fish | source",
646
+ args: { shell: "Shell type: bash, zsh, fish" },
647
+ error: "Error: {{error}}"
648
+ }
649
+ },
650
+ errors: {
651
+ file: {
652
+ empty: "Uploaded file is empty",
653
+ sizeExceeded: "File size ({{size}}MB) exceeds {{limit}} limit: {{file}}",
654
+ unsupportedType: "Unsupported file type \"{{type}}\". Supported: {{supported}}.",
655
+ missingUpload: "Uploaded file is no longer available. Re-run extraction with the original file.",
656
+ notADirectory: "Not a directory: {{dir}}"
657
+ },
658
+ ai: {
659
+ apiKeyMissing: "API Key not configured. Please configure AI settings in the web UI.",
660
+ extractionNotObject: "Extraction result is not an object and cannot be written to Notion.",
661
+ noModels: "No AI models configured. Please add at least one model in AI Settings.",
662
+ noVisionModel: "Image input requires a model with vision capability{{hint}}.",
663
+ noVisionModelContext: "No vision-capable model with sufficient context window (≥{{tokens}} tokens) found{{hint}}.",
664
+ addSuitableModel: " Please add a suitable vision-capable model in AI Settings."
665
+ },
666
+ ocr: {
667
+ platformUnsupported: "Local OCR is only available on macOS or Windows. Current platform: {{platform}}.",
668
+ disabled: "Image OCR fallback is disabled in AI settings.",
669
+ unavailable: "Local OCR is unavailable. Install optional dependency @napi-rs/system-ocr and approve its native build scripts. {{error}}",
670
+ noText: "Local OCR did not recognize any text in the image.",
671
+ lowConfidence: "Local OCR confidence {{confidence}}% is below the configured minimum {{min}}%."
672
+ },
673
+ schema: {
674
+ validationFailed: "Schema validation failed: {{name}}\n{{issues}}",
675
+ cannotRead: "Cannot read schema file: {{name}}",
676
+ invalidJson: "Invalid JSON in schema file: {{name}}",
677
+ noFiles: "No schema files found",
678
+ migrationFailed: "Migration failed",
679
+ migrationHelperInvalidOutput: "Migration helper did not return valid output",
680
+ migrationHelperFailed: "Migration helper failed"
681
+ },
682
+ db: {
683
+ notFound: "Database not found at {{path}}. Run {{cmd}} first to create the database.",
684
+ tableNotFound: "Table \"{{name}}\" not found in database. Run {{cmd}} first to create tables.",
685
+ cannotVerify: "Cannot verify database: {{error}}"
686
+ },
687
+ notion: {
688
+ tokenRequired: "Notion integration token is required.",
689
+ idRequired: "Notion database or data source URL/ID is required.",
690
+ notEnabled: "Notion export is not enabled. Configure Notion settings first.",
691
+ noSchemaConfig: "Notion database is not configured for schema \"{{name}}\".",
692
+ noDatabaseId: "Notion database ID is required for schema \"{{name}}\".",
693
+ noDataSource: "No data source found for this Notion database. Copy the data source link from Notion, or share the source database with the integration.",
694
+ noProperties: "Notion data source did not return properties. Make sure it is shared with the integration and is not a linked data source.",
695
+ noFieldsMatched: "No extracted fields matched Notion database properties.",
696
+ unknown: "Notion connection failed"
697
+ },
698
+ pdf: {
699
+ externalNotConfigured: "External PDF converter is selected but no external command is configured.",
700
+ converterRequiresConfig: "PDF converter \"{{name}}\" requires configuration."
701
+ },
702
+ extractionAudit: {
703
+ recordNotFound: "Extraction audit record not found: {{id}}",
704
+ interrupted: "Extraction did not finish. It may have been interrupted."
705
+ }
706
+ },
707
+ server: {
708
+ invalidTableName: "Invalid table name",
709
+ invalidFileName: "Invalid extraction file name",
710
+ schemaNotFound: "Schema not found",
711
+ saveSchemaFailed: "Failed to save schema",
712
+ promptSnapshotNotAvailable: "Prompt snapshot not found. Save the schema first.",
713
+ deleteSchemaFailed: "Failed to delete schema",
714
+ extractionNotFound: "Extraction result not found",
715
+ cannotInferSchema: "Cannot infer schema name from extraction file name",
716
+ schemaRequired: "Schema is required",
717
+ provideTextOrFile: "Provide text or upload a file to extract",
718
+ conflictTextAndFile: "Text and file input cannot be used together",
719
+ aiConfigNotFound: "AI configuration not found. Configure AI settings first.",
720
+ apiKeyNotConfigured: "API Key not configured. Configure AI settings first.",
721
+ noModelsConfigured: "No models configured. Add at least one model in AI Settings.",
722
+ modelNotFound: "Model \"{{name}}\" not found in AI settings",
723
+ extractionRecordNotFound: "Extraction record not found",
724
+ dbNotFound: "Database not found. Run `aiex schema` first.",
725
+ tableNotFound: "Table \"{{name}}\" not found in database",
726
+ promptSchemaPlaceholder: "System prompt must contain the {schema} placeholder",
727
+ promptTextPlaceholder: "User prompt must contain the {text} placeholder",
728
+ atLeastOneModel: "At least one model must be configured",
729
+ notionTokenRequired: "Notion token is required when Notion export is enabled",
730
+ notionDbIdRequired: "Notion database ID is required for schema \"{{name}}\"",
731
+ migrationFailed: "Migration failed"
732
+ },
733
+ webUi: {
734
+ title: "AIEX Schema Editor",
735
+ subtitle: "Visual JSON Schema editor for SQLite database generation",
736
+ editor: "Editor",
737
+ data: "Data",
738
+ savedSchemas: "Saved Schemas",
739
+ newSchema: "New",
740
+ loadExample: "Load Example",
741
+ tables: "Tables",
742
+ hasData: "has data",
743
+ empty: "empty",
744
+ previewPrompt: "Preview Prompt",
745
+ toggleDarkMode: "Toggle dark mode",
746
+ aiSettings: "AI Settings",
747
+ loading: "Loading...",
748
+ promptPreview: "Prompt Preview - {{name}}",
749
+ systemPrompt: "System Prompt",
750
+ userPromptTemplate: "User Prompt Template",
751
+ noPromptSnapshot: "No prompt snapshot available. Save the schema first.",
752
+ extractionJson: "Extraction JSON",
753
+ selectTable: "Select a table from the sidebar",
754
+ rowsPerPage: "Rows per page:",
755
+ search: "Search...",
756
+ confirmUnsaved: "You have unsaved changes. Loading a new schema will discard them. Continue?",
757
+ confirmNewSchema: "You have unsaved changes. Creating a new schema will discard them. Continue?",
758
+ confirmLoadExample: "You have unsaved changes. Loading example will discard them. Continue?",
759
+ pleaseEnterTableName: "Please enter a table name",
760
+ extractionSaved: "Extraction JSON",
761
+ aiSettingsTitle: "AI Settings",
762
+ provider: "Provider",
763
+ baseUrl: "Base URL",
764
+ apiKey: "API Key",
765
+ timeout: "Timeout (seconds)",
766
+ models: "Models",
767
+ addModel: "Add Model",
768
+ modelName: "Model name (e.g. gpt-4o)",
769
+ structuredOutput: "Structured Output",
770
+ textOnlyOutput: "Text-only Output",
771
+ visionSupported: "Vision Supported",
772
+ visionUnsupported: "Vision Unsupported",
773
+ subscribe: "Registry",
774
+ imageInput: "Image Input",
775
+ imageInputSummary: {
776
+ visionModel: "Image files will use your configured vision model first.",
777
+ ocrFallback: "No vision model is configured, and local OCR fallback is disabled.",
778
+ ocrLocal: "No vision model is configured. Image text will require local OCR on macOS or Windows.",
779
+ ocrAuto: "No vision model is configured. On macOS or Windows, local OCR will be tried automatically for text-heavy images."
780
+ },
781
+ visionModelConfigured: "Vision model configured",
782
+ noVisionModel: "No vision model",
783
+ advancedImageSettings: "Advanced image settings",
784
+ hideAdvancedImageSettings: "Hide advanced image settings",
785
+ ocrFallback: "OCR fallback",
786
+ ocrLanguages: "Languages",
787
+ ocrMinConfidence: "Minimum confidence",
788
+ ocrHint: "Image extraction always prefers a vision model. OCR fallback is only used when no vision model is available.",
789
+ pdfConversion: "PDF Conversion",
790
+ converter: "Converter",
791
+ command: "Command",
792
+ arguments: "Arguments",
793
+ outputFile: "Output File (optional)",
794
+ fallbackToBuiltin: "Fallback to built-in converter",
795
+ keepConvertedFiles: "Keep converted files on disk",
796
+ placeholders: "Placeholders:",
797
+ externalHint: "Placeholders: {input}, {outputDir}, {basename}. If Output File is blank, the first generated .md file will be selected automatically.",
798
+ langfuseTracing: "Langfuse Tracing",
799
+ enabled: "Enabled",
800
+ secretKey: "Secret Key",
801
+ publicKey: "Public Key",
802
+ host: "Host (optional)",
803
+ notionExport: "Notion Export",
804
+ integrationToken: "Integration Token",
805
+ schemaBinding: "Schema Binding",
806
+ selectSchema: "Select a schema",
807
+ databaseUrl: "Database/Data Source URL or ID",
808
+ connectAndMap: "Connect & Map",
809
+ advancedMapping: "Advanced mapping",
810
+ titleProperty: "Title Property (optional)",
811
+ fieldMapJson: "Field Map JSON",
812
+ notionMappingHint: "Selecting a schema fills the left-side keys. Nested objects use dot paths such as {{path}}. Object arrays are skipped; model them as separate Notion data sources later if needed.",
813
+ promptTemplates: "Prompt Templates",
814
+ promptPlaceholderHint: "Placeholders: {{schema}} JSON Schema structure description, {{text}} text to extract from",
815
+ connectedProperties: "Connected · {{count}} properties loaded",
816
+ fieldsMapped: "Connected · {{mapped}}/{{total}} fields mapped",
817
+ fieldMapObject: "Field map must be a JSON object",
818
+ fieldMapString: "Field map value for \"{{key}}\" must be a string",
819
+ fieldMapValidJson: "Field map must be valid JSON",
820
+ notionConnected: "Connected to Notion ({{count}} properties)",
821
+ notionSyncSuccess: "Synced to Notion ({{count}} page)",
822
+ notionSyncFailed: "Notion sync failed",
823
+ toastSaved: "Saved",
824
+ toastLoadFailed: "Failed to load {{name}}",
825
+ toastSaveFailed: "Failed to save {{fileName}}",
826
+ toastDeleteFailed: "Failed to delete {{name}}",
827
+ toastLoadExtractions: "Failed to load extractions",
828
+ toastLoadTables: "Failed to load tables",
829
+ toastLoadFailedGeneric: "Failed to load table data",
830
+ toastMigrationApplied: "Migration applied ({{changes}} changes, {{tables}} tables)",
831
+ toastNoChanges: "No changes detected",
832
+ toastMigrationFailed: "Migration failed",
833
+ toastSchemaListFailed: "Failed to load schema list",
834
+ toastPromptPreviewFailed: "Failed to load prompt snapshot",
835
+ toastInspectNotionFailed: "Notion connection failed",
836
+ toastLoadFullDataFailed: "Failed to load full table data",
837
+ toastSelectSchema: "Select a schema first",
838
+ toastEnterToken: "Enter a Notion integration token",
839
+ toastEnterDatabaseId: "Enter a Notion database or data source URL/ID",
840
+ synced: "Synced",
841
+ failed: "Failed",
842
+ pending: "Pending",
843
+ retry: "Retry",
844
+ sync: "Sync",
845
+ viewJson: "View JSON",
846
+ viewExtractionJson: "View extraction JSON",
847
+ download: "Download",
848
+ exportExcel: "Excel",
849
+ exportCsv: "CSV",
850
+ exportJson: "JSON",
851
+ selectExtraction: "Select an extraction record from the sidebar",
852
+ notionStatusSynced: "Synced to Notion",
853
+ notionStatusFailed: "Notion sync failed",
854
+ notionStatusNotSynced: "Notion not synced",
855
+ syncNotion: "Sync Notion",
856
+ retryNotion: "Retry Notion"
857
+ },
858
+ config: { ocrDefaultLanguages: "en-US, zh-Hans" },
859
+ pdf: {
860
+ converterOptions: {
861
+ unpdf: "Built-in text extraction (unpdf)",
862
+ mineru: "MinerU (mineru)",
863
+ markitdown: "MarkItDown (markitdown)",
864
+ marker: "Marker (marker_single)",
865
+ external: "Custom External Command"
866
+ },
867
+ ocrFallbackOptions: {
868
+ auto: "Auto on macOS or Windows when no vision model exists",
869
+ off: "Off",
870
+ local: "Require local OCR"
871
+ }
872
+ },
873
+ prompt: {
874
+ defaultSystem: `You are a professional data extraction assistant. Your task is to extract structured data from text and return a JSON object based on the data structure definition provided below.
875
+
876
+ {schema}
877
+
878
+ Extraction requirements:
879
+ 1. Extract data strictly according to the field names and types defined in the structure
880
+ 2. If a field's information is missing from the text, set that field to null
881
+ 3. Do not add fields that are not in the structure definition
882
+ 4. Maintain data accuracy and completeness`,
883
+ defaultUser: `Please extract data from the following text:
884
+ {text}`
885
+ },
886
+ fields: {
887
+ config: "Fields Config",
888
+ fewShotExamples: "Few-Shot Examples",
889
+ addExample: "Add Example",
890
+ inputTextExample: "Input Text Example",
891
+ expectedJsonOutput: "Expected JSON Output",
892
+ validJson: "Valid JSON",
893
+ invalidJson: "Invalid JSON",
894
+ genTemplate: "Gen Template",
895
+ noExamples: "No few-shot examples defined",
896
+ deleteExample: "Delete Example",
897
+ inputPlaceholder: "Paste raw unstructured text example here...",
898
+ outputPlaceholder: "{ ... }",
899
+ mustStartLowercase: "Must start with lowercase letter",
900
+ onlyLowercaseAllow: "Only lowercase letters, digits, and underscores allowed",
901
+ lessThan: "-"
902
+ },
903
+ extraction: { status: {
904
+ succeeded: "succeeded",
905
+ failed: "failed",
906
+ stale: "stale",
907
+ running: "running"
908
+ } }
909
+ };
910
+
911
+ //#endregion
912
+ //#region src/locales/i18n.ts
913
+ let tFn = null;
914
+ let i18nInstance = null;
915
+ let initPromise = null;
916
+ function detectLocale() {
917
+ if ((process.env.LANG || process.env.LC_ALL || process.env.LC_MESSAGES || "").startsWith("zh")) return "zh-CN";
918
+ return "en";
919
+ }
920
+ function resolveFallback(key, options) {
921
+ let value = en;
922
+ const parts = key.split(".");
923
+ for (const part of parts) if (value && typeof value === "object" && part in value) value = value[part];
924
+ else return key;
925
+ if (typeof value !== "string") return key;
926
+ if (options) return Object.entries(options).reduce((str, [k, v]) => str.replace(`{{${k}}}`, String(v)), value);
927
+ return value;
928
+ }
929
+ async function initI18n(lng) {
930
+ if (i18nInstance) return;
931
+ if (initPromise) return initPromise;
932
+ initPromise = (async () => {
933
+ const { createInstance } = await import("i18next");
934
+ const instance = createInstance();
935
+ i18nInstance = instance;
936
+ const locale = lng ?? detectLocale();
937
+ await instance.init({
938
+ lng: locale,
939
+ fallbackLng: "en",
940
+ resources: {
941
+ "en": { translation: en },
942
+ "zh-CN": { translation: await import("./zh-CN-B5QVQVm-.mjs").then((m) => m.zhCN) }
943
+ },
944
+ interpolation: { escapeValue: false },
945
+ returnNull: false
946
+ });
947
+ tFn = instance.t.bind(instance);
948
+ })();
949
+ return initPromise;
950
+ }
951
+ function t(key, options) {
952
+ if (tFn) return tFn(key, options);
953
+ return resolveFallback(key, options);
954
+ }
955
+
413
956
  //#endregion
414
957
  //#region src/core/image-ocr/index.ts
415
958
  const DEFAULT_OCR_LANGUAGES = "en-US, zh-Hans";
@@ -442,21 +985,24 @@ function parseOcrLanguages(languages) {
442
985
  }
443
986
  async function recognizeImageText(imagePath, config, runtime = defaultRuntime) {
444
987
  const mode = imageOcrMode(config);
445
- if (!isLocalOcrPlatform(runtime.platform)) throw new Error(`Local OCR is only available on macOS or Windows. Current platform: ${runtime.platform}.`);
446
- if (mode === "off") throw new Error("Image OCR fallback is disabled in AI settings.");
988
+ if (!isLocalOcrPlatform(runtime.platform)) throw new Error(t("errors.ocr.platformUnsupported", { platform: runtime.platform }));
989
+ if (mode === "off") throw new Error(t("errors.ocr.disabled"));
447
990
  let localOcr;
448
991
  try {
449
992
  localOcr = await runtime.loadLocalOcr();
450
993
  } catch (error) {
451
994
  const message = error instanceof Error ? error.message : String(error);
452
- throw new Error(`Local OCR is unavailable. Install optional dependency @napi-rs/system-ocr and approve its native build scripts. ${message}`);
995
+ throw new Error(t("errors.ocr.unavailable", { error: message }));
453
996
  }
454
997
  const result = await localOcr.recognize(imagePath, localOcr.OcrAccuracy.Accurate, parseOcrLanguages(config?.ocrLanguages));
455
998
  const text = result.text.trim();
456
- if (!text) throw new Error("Local OCR did not recognize any text in the image.");
999
+ if (!text) throw new Error(t("errors.ocr.noText"));
457
1000
  const confidence = result.confidence;
458
1001
  const minConfidence = config?.ocrMinConfidence ?? 0;
459
- if (confidence < minConfidence) throw new Error(`Local OCR confidence ${(confidence * 100).toFixed(1)}% is below the configured minimum ${(minConfidence * 100).toFixed(1)}%.`);
1002
+ if (confidence < minConfidence) throw new Error(t("errors.ocr.lowConfidence", {
1003
+ confidence: (confidence * 100).toFixed(1),
1004
+ min: (minConfidence * 100).toFixed(1)
1005
+ }));
460
1006
  return {
461
1007
  text,
462
1008
  confidence
@@ -471,7 +1017,7 @@ async function checkImageOcrAvailability(imagePath, runtime = defaultRuntime) {
471
1017
  dependencyLoaded: false,
472
1018
  ocrOk: null,
473
1019
  imagePath,
474
- error: `Local OCR is only available on macOS or Windows. Current platform: ${runtime.platform}.`
1020
+ error: t("errors.ocr.platformUnsupported", { platform: runtime.platform })
475
1021
  };
476
1022
  let localOcr;
477
1023
  try {
@@ -973,4 +1519,4 @@ async function collectDoctorDiagnostics(options = {}) {
973
1519
  }
974
1520
 
975
1521
  //#endregion
976
- export { name as C, doctorDiagnosticsTableRows as D, buildDoctorDiagnostics as E, formatDoctorDiagnosticsJson as O, description as S, version as T, PLACEHOLDER_SCHEMA as _, parseJsonSchema as a, createConfig as b, recognizeImageText as c, readAIConfig as d, writeAIConfig as f, DEFAULT_PROMPT_CONFIG as g, DEFAULT_MINERU_CONFIG as h, JsonSchemaDefinitionSchema as i, shouldUseImageOcrFallback as l, DEFAULT_MARKITDOWN_CONFIG as m, createMigrationConfig as n, toSnakeCase as o, DEFAULT_MARKER_CONFIG as p, generateDrizzleConfig as r, generateDrizzleSchema as s, collectDoctorDiagnostics as t, getDefaultAIConfig as u, PLACEHOLDER_TEXT as v, package_default as w, seedConfig as x, AIConfigSchema as y };
1522
+ export { formatDoctorDiagnosticsJson as A, seedConfig as C, version as D, package_default as E, buildDoctorDiagnostics as O, createConfig as S, name as T, DEFAULT_MINERU_CONFIG as _, parseJsonSchema as a, PLACEHOLDER_TEXT as b, recognizeImageText as c, t as d, getDefaultAIConfig as f, DEFAULT_MARKITDOWN_CONFIG as g, DEFAULT_MARKER_CONFIG as h, JsonSchemaDefinitionSchema as i, doctorDiagnosticsTableRows as k, shouldUseImageOcrFallback as l, writeAIConfig as m, createMigrationConfig as n, toSnakeCase as o, readAIConfig as p, generateDrizzleConfig as r, generateDrizzleSchema as s, collectDoctorDiagnostics as t, initI18n as u, DEFAULT_PROMPT_CONFIG as v, description as w, AIConfigSchema as x, PLACEHOLDER_SCHEMA as y };
package/dist/index.mjs CHANGED
@@ -1,3 +1,3 @@
1
- import { D as doctorDiagnosticsTableRows, E as buildDoctorDiagnostics, O as formatDoctorDiagnosticsJson, a as parseJsonSchema, i as JsonSchemaDefinitionSchema, n as createMigrationConfig, r as generateDrizzleConfig, s as generateDrizzleSchema, t as collectDoctorDiagnostics } from "./doctor-collector-BVbuw5LY.mjs";
1
+ import { A as formatDoctorDiagnosticsJson, O as buildDoctorDiagnostics, a as parseJsonSchema, i as JsonSchemaDefinitionSchema, k as doctorDiagnosticsTableRows, n as createMigrationConfig, r as generateDrizzleConfig, s as generateDrizzleSchema, t as collectDoctorDiagnostics } from "./doctor-collector-CDg_BdI8.mjs";
2
2
 
3
3
  export { JsonSchemaDefinitionSchema, buildDoctorDiagnostics, collectDoctorDiagnostics, createMigrationConfig, doctorDiagnosticsTableRows, formatDoctorDiagnosticsJson, generateDrizzleConfig, generateDrizzleSchema, parseJsonSchema };