@clazic/kordoc 2.2.5 → 2.2.7

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.
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // src/utils.ts
4
- var VERSION = true ? "2.2.5" : "0.0.0-dev";
4
+ var VERSION = true ? "2.2.7" : "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-LMJTT3ZJ.js.map
93
+ //# sourceMappingURL=chunk-3CNYQD23.js.map
@@ -6,7 +6,7 @@ import {
6
6
  precheckZipSize,
7
7
  sanitizeHref,
8
8
  toArrayBuffer
9
- } from "./chunk-LMJTT3ZJ.js";
9
+ } from "./chunk-3CNYQD23.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-BVSC3NC2.js");
5409
+ const { resolveOcrProvider } = await import("./resolve-NYKB5P3U.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-3PTQ3RGF.js.map
9617
+ //# sourceMappingURL=chunk-UFIRSH5G.js.map
package/dist/cli.js CHANGED
@@ -4,11 +4,11 @@ import {
4
4
  markdownToHwpx,
5
5
  markdownToXlsx,
6
6
  parse
7
- } from "./chunk-3PTQ3RGF.js";
7
+ } from "./chunk-UFIRSH5G.js";
8
8
  import {
9
9
  VERSION,
10
10
  toArrayBuffer
11
- } from "./chunk-LMJTT3ZJ.js";
11
+ } from "./chunk-3CNYQD23.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-ZZOKWPQK.js");
124
+ const { sanitizeError } = await import("./utils-3EDZ5QEH.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-ZZOKWPQK.js");
208
+ const { sanitizeError } = await import("./utils-3EDZ5QEH.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-NUH25Y6O.js");
217
+ const { watchDirectory } = await import("./watch-BDL7I557.js");
218
218
  await watchDirectory({
219
219
  dir,
220
220
  outDir: opts.outDir,
package/dist/index.cjs CHANGED
@@ -2043,8 +2043,10 @@ function callCli(mode, imagePath) {
2043
2043
  const args = buildCliArgs(mode, imagePath);
2044
2044
  const result = (0, import_child_process2.spawnSync)(mode, args, {
2045
2045
  encoding: "utf-8",
2046
- timeout: 6e4,
2047
- maxBuffer: 10 * 1024 * 1024
2046
+ timeout: 18e4,
2047
+ maxBuffer: 10 * 1024 * 1024,
2048
+ // claude: /tmp에서 실행하여 프로젝트 CLAUDE.md의 규칙 간섭 방지
2049
+ ...mode === "claude" ? { cwd: (0, import_os.tmpdir)() } : {}
2048
2050
  });
2049
2051
  if (result.error) {
2050
2052
  throw new Error(`${mode} CLI \uC2E4\uD589 \uC2E4\uD328: ${result.error.message}`);
@@ -2059,6 +2061,8 @@ function callCodexCli(imagePath) {
2059
2061
  const outPath = (0, import_path.join)((0, import_os.tmpdir)(), `kordoc-codex-out-${Date.now()}.txt`);
2060
2062
  try {
2061
2063
  const args = ["exec", OCR_PROMPT, "--image", imagePath, "--output-last-message", outPath];
2064
+ const model = process.env.KORDOC_CODEX_MODEL;
2065
+ if (model) args.push("--model", model);
2062
2066
  const result = (0, import_child_process2.spawnSync)("codex", args, {
2063
2067
  encoding: "utf-8",
2064
2068
  timeout: 18e4,
@@ -2090,10 +2094,18 @@ function buildCliArgs(mode, imagePath) {
2090
2094
 
2091
2095
  \uC774\uBBF8\uC9C0: @${imagePath}`;
2092
2096
  switch (mode) {
2093
- case "gemini":
2094
- return ["--prompt", promptWithImage, "--yolo"];
2095
- case "claude":
2096
- return ["--print", promptWithImage];
2097
+ case "gemini": {
2098
+ const args = ["--prompt", promptWithImage, "--yolo"];
2099
+ const model = process.env.KORDOC_GEMINI_MODEL;
2100
+ if (model) args.push("--model", model);
2101
+ return args;
2102
+ }
2103
+ case "claude": {
2104
+ const args = ["--print", promptWithImage];
2105
+ const model = process.env.KORDOC_CLAUDE_MODEL;
2106
+ if (model) args.push("--model", model);
2107
+ return args;
2108
+ }
2097
2109
  default:
2098
2110
  throw new Error(`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 CLI: ${mode}`);
2099
2111
  }
@@ -2456,7 +2468,7 @@ var import_jszip2 = __toESM(require("jszip"), 1);
2456
2468
  var import_xmldom = require("@xmldom/xmldom");
2457
2469
 
2458
2470
  // src/utils.ts
2459
- var VERSION = true ? "2.2.5" : "0.0.0-dev";
2471
+ var VERSION = true ? "2.2.7" : "0.0.0-dev";
2460
2472
  function toArrayBuffer(buf) {
2461
2473
  if (buf.byteOffset === 0 && buf.byteLength === buf.buffer.byteLength) {
2462
2474
  return buf.buffer;