@clazic/kordoc 2.2.3 → 2.2.5
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/{chunk-NND6AJ7Y.js → chunk-3PTQ3RGF.js} +3 -3
- package/dist/{chunk-Z24TFFSO.js → chunk-LMJTT3ZJ.js} +2 -2
- package/dist/cli.js +5 -5
- package/dist/index.cjs +12 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +13 -9
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +2 -2
- package/dist/{resolve-H4SNHDDT.js → resolve-BVSC3NC2.js} +13 -9
- package/dist/resolve-BVSC3NC2.js.map +1 -0
- package/dist/{utils-Q3MHKY3T.js → utils-ZZOKWPQK.js} +2 -2
- package/dist/{watch-RVLVNLCX.js → watch-NUH25Y6O.js} +3 -3
- package/package.json +1 -1
- package/dist/resolve-H4SNHDDT.js.map +0 -1
- /package/dist/{chunk-NND6AJ7Y.js.map → chunk-3PTQ3RGF.js.map} +0 -0
- /package/dist/{chunk-Z24TFFSO.js.map → chunk-LMJTT3ZJ.js.map} +0 -0
- /package/dist/{utils-Q3MHKY3T.js.map → utils-ZZOKWPQK.js.map} +0 -0
- /package/dist/{watch-RVLVNLCX.js.map → watch-NUH25Y6O.js.map} +0 -0
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
precheckZipSize,
|
|
7
7
|
sanitizeHref,
|
|
8
8
|
toArrayBuffer
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-LMJTT3ZJ.js";
|
|
10
10
|
import {
|
|
11
11
|
parsePageRange
|
|
12
12
|
} from "./chunk-MOL7MDBG.js";
|
|
@@ -5406,7 +5406,7 @@ async function parsePdfDocument(buffer, options) {
|
|
|
5406
5406
|
const ocrMode = options?.ocrMode;
|
|
5407
5407
|
if (!ocrProvider && ocrMode && ocrMode !== "off") {
|
|
5408
5408
|
try {
|
|
5409
|
-
const { resolveOcrProvider } = await import("./resolve-
|
|
5409
|
+
const { resolveOcrProvider } = await import("./resolve-BVSC3NC2.js");
|
|
5410
5410
|
ocrProvider = await resolveOcrProvider(ocrMode, warnings);
|
|
5411
5411
|
} catch (resolveErr) {
|
|
5412
5412
|
if (ocrMode !== "auto") {
|
|
@@ -9614,4 +9614,4 @@ export {
|
|
|
9614
9614
|
cfb/cfb.js:
|
|
9615
9615
|
(*! crc32.js (C) 2014-present SheetJS -- http://sheetjs.com *)
|
|
9616
9616
|
*/
|
|
9617
|
-
//# sourceMappingURL=chunk-
|
|
9617
|
+
//# sourceMappingURL=chunk-3PTQ3RGF.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// src/utils.ts
|
|
4
|
-
var VERSION = true ? "2.2.
|
|
4
|
+
var VERSION = true ? "2.2.5" : "0.0.0-dev";
|
|
5
5
|
function toArrayBuffer(buf) {
|
|
6
6
|
if (buf.byteOffset === 0 && buf.byteLength === buf.buffer.byteLength) {
|
|
7
7
|
return buf.buffer;
|
|
@@ -90,4 +90,4 @@ export {
|
|
|
90
90
|
sanitizeHref,
|
|
91
91
|
classifyError
|
|
92
92
|
};
|
|
93
|
-
//# sourceMappingURL=chunk-
|
|
93
|
+
//# sourceMappingURL=chunk-LMJTT3ZJ.js.map
|
package/dist/cli.js
CHANGED
|
@@ -4,11 +4,11 @@ import {
|
|
|
4
4
|
markdownToHwpx,
|
|
5
5
|
markdownToXlsx,
|
|
6
6
|
parse
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-3PTQ3RGF.js";
|
|
8
8
|
import {
|
|
9
9
|
VERSION,
|
|
10
10
|
toArrayBuffer
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-LMJTT3ZJ.js";
|
|
12
12
|
import "./chunk-MOL7MDBG.js";
|
|
13
13
|
import "./chunk-ZWE3DS7E.js";
|
|
14
14
|
|
|
@@ -121,7 +121,7 @@ async function runParse(files, opts) {
|
|
|
121
121
|
saveImages(absPath);
|
|
122
122
|
}
|
|
123
123
|
} catch (err) {
|
|
124
|
-
const { sanitizeError } = await import("./utils-
|
|
124
|
+
const { sanitizeError } = await import("./utils-ZZOKWPQK.js");
|
|
125
125
|
process.stderr.write(`
|
|
126
126
|
[kordoc] ERROR: ${fileName} \u2014 ${sanitizeError(err)}
|
|
127
127
|
`);
|
|
@@ -205,7 +205,7 @@ program.command("convert <input>").description("\uB9C8\uD06C\uB2E4\uC6B4 \uD30C\
|
|
|
205
205
|
`));
|
|
206
206
|
}
|
|
207
207
|
} catch (err) {
|
|
208
|
-
const { sanitizeError } = await import("./utils-
|
|
208
|
+
const { sanitizeError } = await import("./utils-ZZOKWPQK.js");
|
|
209
209
|
process.stderr.write(` FAIL
|
|
210
210
|
`);
|
|
211
211
|
process.stderr.write(` \u2192 ${sanitizeError(err)}
|
|
@@ -214,7 +214,7 @@ program.command("convert <input>").description("\uB9C8\uD06C\uB2E4\uC6B4 \uD30C\
|
|
|
214
214
|
}
|
|
215
215
|
});
|
|
216
216
|
program.command("watch <dir>").description("\uB514\uB809\uD1A0\uB9AC \uAC10\uC2DC \u2014 \uC0C8 \uBB38\uC11C \uC790\uB3D9 \uBCC0\uD658").option("--webhook <url>", "\uACB0\uACFC \uC804\uC1A1 \uC6F9\uD6C5 URL").option("-d, --out-dir <dir>", "\uBCC0\uD658 \uACB0\uACFC \uCD9C\uB825 \uB514\uB809\uD1A0\uB9AC").option("-p, --pages <range>", "\uD398\uC774\uC9C0/\uC139\uC158 \uBC94\uC704").option("--format <type>", "\uCD9C\uB825 \uD615\uC2DD: markdown \uB610\uB294 json", "markdown").option("--silent", "\uC9C4\uD589 \uBA54\uC2DC\uC9C0 \uC228\uAE30\uAE30").action(async (dir, opts) => {
|
|
217
|
-
const { watchDirectory } = await import("./watch-
|
|
217
|
+
const { watchDirectory } = await import("./watch-NUH25Y6O.js");
|
|
218
218
|
await watchDirectory({
|
|
219
219
|
dir,
|
|
220
220
|
outDir: opts.outDir,
|
package/dist/index.cjs
CHANGED
|
@@ -1994,8 +1994,8 @@ function getTesseractFallbackMessage() {
|
|
|
1994
1994
|
"\uB354 \uB098\uC740 \uD488\uC9C8(\uD14C\uC774\uBE14/\uD5E4\uB529 \uAD6C\uC870 \uBCF4\uC874)\uC744 \uC704\uD574 AI CLI \uC124\uCE58\uB97C \uAD8C\uC7A5\uD569\uB2C8\uB2E4:",
|
|
1995
1995
|
"",
|
|
1996
1996
|
" [\uAD8C\uC7A5] Gemini CLI: https://ai.google.dev/gemini-api/docs/cli",
|
|
1997
|
-
" Claude CLI: npm install -g @anthropic-ai/claude-code",
|
|
1998
1997
|
" Codex CLI: npm install -g @openai/codex",
|
|
1998
|
+
" Claude CLI: npm install -g @anthropic-ai/claude-code",
|
|
1999
1999
|
" Ollama: brew install ollama (+ ollama pull gemma4:27b)"
|
|
2000
2000
|
].join("\n");
|
|
2001
2001
|
}
|
|
@@ -2004,13 +2004,16 @@ var init_auto_detect = __esm({
|
|
|
2004
2004
|
"src/ocr/auto-detect.ts"() {
|
|
2005
2005
|
"use strict";
|
|
2006
2006
|
import_child_process = require("child_process");
|
|
2007
|
-
CLI_PRIORITY = ["gemini", "
|
|
2007
|
+
CLI_PRIORITY = ["gemini", "codex", "claude", "ollama"];
|
|
2008
2008
|
}
|
|
2009
2009
|
});
|
|
2010
2010
|
|
|
2011
2011
|
// src/ocr/cli-provider.ts
|
|
2012
2012
|
function getTempDir() {
|
|
2013
|
-
if (!_tempDir)
|
|
2013
|
+
if (!_tempDir) {
|
|
2014
|
+
_tempDir = (0, import_path.join)(process.cwd(), ".kordoc-tmp");
|
|
2015
|
+
(0, import_fs.mkdirSync)(_tempDir, { recursive: true });
|
|
2016
|
+
}
|
|
2014
2017
|
return _tempDir;
|
|
2015
2018
|
}
|
|
2016
2019
|
function createCliOcrProvider(mode) {
|
|
@@ -2053,12 +2056,12 @@ function callCli(mode, imagePath) {
|
|
|
2053
2056
|
return result.stdout || "";
|
|
2054
2057
|
}
|
|
2055
2058
|
function callCodexCli(imagePath) {
|
|
2056
|
-
const outPath = (0, import_path.join)(
|
|
2059
|
+
const outPath = (0, import_path.join)((0, import_os.tmpdir)(), `kordoc-codex-out-${Date.now()}.txt`);
|
|
2057
2060
|
try {
|
|
2058
2061
|
const args = ["exec", OCR_PROMPT, "--image", imagePath, "--output-last-message", outPath];
|
|
2059
2062
|
const result = (0, import_child_process2.spawnSync)("codex", args, {
|
|
2060
2063
|
encoding: "utf-8",
|
|
2061
|
-
timeout:
|
|
2064
|
+
timeout: 18e4,
|
|
2062
2065
|
maxBuffer: 10 * 1024 * 1024,
|
|
2063
2066
|
input: ""
|
|
2064
2067
|
// stdin EOF 즉시 전달 (대화형 입력 차단)
|
|
@@ -2098,8 +2101,9 @@ function buildCliArgs(mode, imagePath) {
|
|
|
2098
2101
|
async function callOllamaApi(imagePath) {
|
|
2099
2102
|
const { readFileSync: readFileSync2 } = await import("fs");
|
|
2100
2103
|
const imageBase64 = readFileSync2(imagePath).toString("base64");
|
|
2101
|
-
const model = process.env.KORDOC_OLLAMA_MODEL || "
|
|
2104
|
+
const model = process.env.KORDOC_OLLAMA_MODEL || "qwen3-vl:8b";
|
|
2102
2105
|
const host = process.env.KORDOC_OLLAMA_HOST || "http://localhost:11434";
|
|
2106
|
+
const timeoutMs = Number(process.env.KORDOC_OLLAMA_TIMEOUT) || 12e4;
|
|
2103
2107
|
const response = await fetch(`${host}/api/chat`, {
|
|
2104
2108
|
method: "POST",
|
|
2105
2109
|
headers: { "Content-Type": "application/json" },
|
|
@@ -2112,7 +2116,7 @@ async function callOllamaApi(imagePath) {
|
|
|
2112
2116
|
}],
|
|
2113
2117
|
stream: false
|
|
2114
2118
|
}),
|
|
2115
|
-
signal: AbortSignal.timeout(
|
|
2119
|
+
signal: AbortSignal.timeout(timeoutMs)
|
|
2116
2120
|
});
|
|
2117
2121
|
if (!response.ok) {
|
|
2118
2122
|
throw new Error(`Ollama API \uC624\uB958: ${response.status} ${response.statusText}`);
|
|
@@ -2452,7 +2456,7 @@ var import_jszip2 = __toESM(require("jszip"), 1);
|
|
|
2452
2456
|
var import_xmldom = require("@xmldom/xmldom");
|
|
2453
2457
|
|
|
2454
2458
|
// src/utils.ts
|
|
2455
|
-
var VERSION = true ? "2.2.
|
|
2459
|
+
var VERSION = true ? "2.2.5" : "0.0.0-dev";
|
|
2456
2460
|
function toArrayBuffer(buf) {
|
|
2457
2461
|
if (buf.byteOffset === 0 && buf.byteLength === buf.buffer.byteLength) {
|
|
2458
2462
|
return buf.buffer;
|