Skip to content

fix(watch): preserve subdirectories in converted output - #82

Merged
chrisryugj merged 1 commit into
chrisryugj:mainfrom
ROTl24:fix/watch-output-subdirectories
Sep 24, 2026
Merged

chrisryugj merged 1 commit into
chrisryugj:mainfrom
ROTl24:fix/watch-output-subdirectories

Conversation

@ROTl24

@ROTl24 ROTl24 commented Sep 24, 2026

Copy link
Copy Markdown
Contributor

kordoc watch ./inbox -d ./converted watches recursively, but builds output paths from basename(filePath). If inbox/alpha/report.hwpx and inbox/beta/report.hwpx arrive, both conversions succeed and write converted/report.md; one result silently overwrites the other. JSON output has the same problem.

This keeps the relative parent directory, so the files become converted/alpha/report.md and converted/beta/report.md. Root-level files keep their existing output paths. The README now describes this layout.

The regression tests start the actual CLI watcher and convert generated HWPX documents in both output formats. Both tests failed before the change and pass afterward.

Validated on Windows, Node 24:

  • Full suite with KORDOC_OFFLINE=1: 2012 passed, 7 skipped.
  • npm run typecheck and npm run build: passed.

Corpus and Hancom visual gates were not run. This fixes collisions between subdirectories; same-stem files with different extensions in the same directory retain the existing naming behavior.

Recursive watching flattened all source paths to their basename, so alpha/report.hwpx and beta/report.hwpx silently overwrote the same output file. Preserve the relative parent directory and create it before writing.

Add CLI integration coverage for Markdown and JSON with same-named documents in separate folders and a root-level document. Document the output layout. On Windows with Node 24, both new tests failed before the fix; the full offline suite now passes 2012 tests with 7 skips. Typecheck and build pass. Corpus and Hancom visual gates were not run.
chrisryugj added a commit that referenced this pull request Sep 24, 2026
@chrisryugj
chrisryugj merged commit b40a0f7 into chrisryugj:main Sep 24, 2026
@chrisryugj

Copy link
Copy Markdown
Owner

Thanks @ROTl24 — merged and included in v4.15.0.

watch -d now preserves relative subdirectories, so files with the same basename no longer overwrite each other. The Korean and English READMEs document the output layout.

Validation: Node 20/22/24 CI passed; local tests had 0 failures (2,295 passed, 3 skipped). The corpus gates passed, including 23,700 fuzz runs with no crashes, hangs or slow-limit failures. Both main and the v4.15.0 tag were successfully mirrored to GitLab.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants