Repository navigation
Refactor: deepen internal modules and table-driven flag parsing - #152
Merged
Merged
Conversation
The user-enums catalogue and the app-version tracker now stage writes through the same random-name, exclusive-create temp file as draft saves.
readJsonObjectFile tells an absent file (raw null) from a corrupt one (obj null); register, rename and media registration use it.
Adds tests for the refusal and for --force-write.
…silence Error messages are unchanged and now pinned by tests.
Boolean, text and numeric flags that only set one field move into typed tables; flags with validation or command scoping keep their branches.
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.
Internal refactor with no behaviour change. Duplicated logic moves behind small internal modules, and the CLI flag parser becomes table-driven.
Changes
src/atomic-write.tsholds the temp + fsync + rename staging. The user-enums catalogue and the app-version tracker now use the same random-name, exclusive-create temp file as draft saves.draft.writeAtomickeeps its signature.readJsonObjectFile/parseJsonObject(inbom.ts) replace seven hand-rolled read-and-parse copies in register, rename, media registration and the CLI. An absent file and a corrupt one remain distinct outcomes.requireSegment(src/segment-lookup.ts) replaces 17 find-or-throw copies andsaveTemplate's own search loop. The error message is unchanged.runFfmpegAnalysis(src/ffmpeg-pass.ts). Each keeps its own error labels and hints.parseFlagsbranches into typed tables. A table entry that doesn't match itsFlagsfield fails type-checking. Flags with validation, multiple values or command scoping keep their branches.detectStoreAppVersionandmattingState.src/goes from 23,330 to 23,119 code lines, not counting blanks and comments.Verification
npm run build,npm test(1228 tests, 0 failures; 10 new),npm run lint,npm run wasm:verify, Python client unit tests,npm pack+npm run smoke:package, all on Node 20.masteras well as on this branch:--force-writefor rename and registerparseFlagsreturn identical results on 107,996 argument vectors: every flag, in every command context, with the value present, missing, flag-like and repeated.--helpand every<command> --helpdescribeoutputlib.jsexports.d.tsfiles (byte-identical)Review notes
bc7d4c3. One commit per change, so the PR can be reviewed commit by commit.src/index.ts/src/caption.ts.