Repository navigation
refactor(cli): split config.ts into config/ modules - #575
Merged
Merged
Conversation
…fig.ts Drops mergeTomlValues, which nothing used.
|
Contributor
Coverage Report
📁 File Coverage (20 files)
|
tuler
approved these changes
Nov 3, 2026
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
config.tshad grown to 1200+ lines mixing three things: the parsedConfigthe rest of the CLI uses, thecartesi.tomlparsers, and a couple of helpers only one builder needs. This splits it along those lines, with no behaviour change: every moved function is identical to the original apart fromexport,config.tskeeps exporting every name it exported before, and importers outsideconfig/don't change except for the two nvram helpers below.Moving
config.tstoconfig/index.tswas considered and left out. It would touch the import path in 31 files this PR otherwise doesn't change, so it's a separate follow-up if wanted.Imports only go downward:
config.ts→config/toml/*→ the parsed side (accounts,defaults,size,types,constants,errors).toml/holds parsing only. The defaults live on the parsed side, andtoml/drives.tsandtoml/machine.tsimport them. Nothing underconfig/importsconfig.ts.parsereads as before: merge the files → check the top-level keys →parseDrives,parseNvrams→ duplicate labels →[withdrawal],[machine],sdk→assertAccountsDrive.No changeset added as nothing is user visible.
Changes:
builder/nvram.ts: gainsnvramImageFilenameandnvramHasImage, which describe the image this builder writes;machine.tsandcommands/shell.tsimport them from there.config/toml/accounts.ts: theaccounts_drive/accounts_drive_sizemarker shared by drives and nvrams, and the[withdrawal]table, which only applies to an application with an accounts drive.getDriveFormatstays a parser helper inconfig/toml/drives.ts, exported throughconfig.tsforbuilder/none.ts.mergeTomlValuesis dropped as nothing used it.TomlPrimitive, deprecated by smol-toml 1.9 in favour ofTomlValue, is replaced, and the localTomlTableby smol-toml's own, which is the same type.src/config.js.