feat: add optional group field to server config - #56
Open
ice616 wants to merge 1 commit into
Open
Conversation
Adds a free-form `group` label to server definitions (SSH_SERVER_<NAME>_GROUP in .env, group = "..." in TOML). It round-trips through exportToToml/exportToEnv and is returned by ssh_list_servers, so a server's group membership travels with the config itself when exporting to or importing from other tools — distinct from the existing .server-groups.json / ssh_group_manage batch-execution groups, which stay untouched. Optional and additive: omitted from generated config when unset, no changes to existing server definitions required.
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.
Closes #55.
Summary
Adds an optional, free-form
grouplabel to server definitions:.env:SSH_SERVER_<NAME>_GROUP=productiongroup = "production"The field round-trips through
ConfigLoader.exportToToml()/exportToEnv(), andssh_list_serversnow returns it alongsidename/host/user/defaultDir/description.Why
As discussed in #55: today a server's group/environment membership only exists in the separate
.server-groups.jsonfile used byssh_group_manage/ssh_execute_groupfor batch execution. That's a different concern (execution strategy — parallel/sequential/rolling, with servers referenced by name) from descriptive grouping.Having
grouplive on the server entry itself means:group/folderconcept per host — this gives a natural 1:1 field to map to/from when converting configs.ssh_list_serverscan show group membership at a glance without cross-referencing.server-groups.json.This is purely additive metadata — it does not touch
.server-groups.json,ssh_group_manage, orssh_execute_group, which keep working exactly as before. A follow-up could optionally letssh_group_manage listderive a dynamic group from this field (similar to the existingalldynamic group), but that's out of scope here to keep this change minimal and low-risk.Changes
src/config-loader.js: readgroupfrom both the TOML and.envloaders; write it back in both exporters. Omitted entirely when unset, so existing configs and generated output are unaffected.src/index.js:ssh_list_serversincludesgroupin its output (empty string when unset); description text updated to mention it.tests/test-config-field-names.js: extendedEXPECTED_CAMEL_FIELDSand both the.env/TOML fixtures to covergroup, keeping it locked in alongside the other camelCase fields this test already guards.README.md/CLAUDE.md: documented the new field in both the.envand TOML config references.CHANGELOG.md: added an[Unreleased]entry.Testing
All suites pass except the pre-existing
test:lifecyclefailures (SIGTERM/SIGINT handling), which are unrelated to this change and reproduce identically onmainwithout this branch (verified viagit stash).Also manually verified with a scratch TOML/
.envfixture (load → export → reload round-trip) thatgroupsurvives every direction: TOML→loader,.env→loader, loader→exportToToml, loader→exportToEnv, and export→reload.