墨笔初成,入卷有门 · Add N1 CLI with subcommands, envelope, EXIF, ROI, and detect - #29
Merged
Conversation
…I, and detect N1 CLI entry point (roadmap §5, D106): - light-ocr bin with recognize/detect/info subcommands - recognize: file/stdin input, json/jsonl/text output, implicit default - detect: detection-only output (Core Engine::detect(), no recognition) - info: --model-info/--version (mutually exclusive) - schemaVersion=1 DocumentResult envelope with stable line/detection IDs - EXIF orientation: JS parser + C++ pixel transform, --no-exif flag - ROI --region: pageSpace rectangle, adapter-layer crop, box offset - stdout/stderr strict separation, stable exit codes (64-72) - Flag validation before input reading (parameter errors surface first) - Agent Skill at .agents/skills/local-ocr/SKILL.md - D106 decision in decisions.md, cli-design.md design doc - 54 unit tests (cli logic + exif parser), all passing
added 4 commits
July 22, 2026 08:40
…tect() CI failed on all platforms with -Werror=unused-variable: detection_input_width and detection_input_height were copied from recognize() but never read in detect() (no diagnostics collection).
- addon.cpp: move detect_mode from function param to Request struct (worker lambda can't capture native_recognize_impl params) - addon.cpp: fix recognize ROI offset to use line.box.points (Quad has no begin/end, it has .points array) - CMakeLists.txt: add exif.cpp to fuzz_encoded_image sources (linker error: undefined reference to exif::apply_orientation) - exif.cpp: fix size_t to uint32_t narrowing warning (C4267)
Result::value() returns const T& for lvalues, so modifying boxes/lines through it failed with 'assignment of member in read-only object'. Fix: move the result out to a local variable before modifying, then wrap in Result::success before returning.
Function was defined after EngineState::run() but called from the worker lambda inside it. Non-core builds compile addon.cpp as one translation unit and require declaration before use.
This was referenced Jul 22, 2026
birhantprkc
pushed a commit
to birhantprkc/light-ocr
that referenced
this pull request
Jul 29, 2026
…ect (arcships#29) * feat(n1): 墨笔初成,入卷有门 · add N1 CLI with subcommands, envelope, EXIF, ROI, and detect N1 CLI entry point (roadmap §5, D106): - light-ocr bin with recognize/detect/info subcommands - recognize: file/stdin input, json/jsonl/text output, implicit default - detect: detection-only output (Core Engine::detect(), no recognition) - info: --model-info/--version (mutually exclusive) - schemaVersion=1 DocumentResult envelope with stable line/detection IDs - EXIF orientation: JS parser + C++ pixel transform, --no-exif flag - ROI --region: pageSpace rectangle, adapter-layer crop, box offset - stdout/stderr strict separation, stable exit codes (64-72) - Flag validation before input reading (parameter errors surface first) - Agent Skill at .agents/skills/local-ocr/SKILL.md - D106 decision in decisions.md, cli-design.md design doc - 54 unit tests (cli logic + exif parser), all passing * fix(core): 删冗余变量,编译无碍 · remove unused detection_input variables in detect() CI failed on all platforms with -Werror=unused-variable: detection_input_width and detection_input_height were copied from recognize() but never read in detect() (no diagnostics collection). * fix(n1): 修补编译,链路通达 · fix contract/safety CI failures - addon.cpp: move detect_mode from function param to Request struct (worker lambda can't capture native_recognize_impl params) - addon.cpp: fix recognize ROI offset to use line.box.points (Quad has no begin/end, it has .points array) - CMakeLists.txt: add exif.cpp to fuzz_encoded_image sources (linker error: undefined reference to exif::apply_orientation) - exif.cpp: fix size_t to uint32_t narrowing warning (C4267) * fix(n1): 去常量之限,变量可动 · fix const-correctness in ROI offset Result::value() returns const T& for lvalues, so modifying boxes/lines through it failed with 'assignment of member in read-only object'. Fix: move the result out to a local variable before modifying, then wrap in Result::success before returning. * fix(n1): 前置定义,先后有序 · move detect_result_to_ocr_result before worker Function was defined after EngineState::run() but called from the worker lambda inside it. Non-core builds compile addon.cpp as one translation unit and require declaration before use. --------- Co-authored-by: chenghan <chenghan@fazhitech.cn>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
N1 CLI entry point implementation (roadmap §5, D106).
Changes
CLI bin (bindings/node/bin/light-ocr.cjs)
ecognize\ / \detect\ / \info, with implicit recognize default
ecognize: file/stdin → json/jsonl/text, --region, --provider, --no-exif, --schema-version\
C++ Core changes
egion\ options in \�ddon.cpp\
ative_detect\ binding in \�ddon.cpp\
JS layer
egion\ options in \RecognizeOptions\
Design docs
Agent Skill
Tests (54 passing)
What needs CI verification
C++ changes require native build (cmake + MSVC + node headers). Local environment lacks these. CI should verify:
ative_detect\ binding works end-to-end
Not in this PR