refactor(engine): merge detect + platform into one deep Environment module (deepening #5)#253
Merged
Merged
Conversation
…odule (deepening #5) lib/detect.sh + lib/platform.sh collapse into lib/environment.sh (438 lines, under the 800 rule), internally layered private _environment_probe_* (I/O) -> _environment_classify (form_factor logic) behind a small interface: environment_snapshot() (full {os,arch,cpu,gpu,...,form_factor} in one call) + environment_field(). Backward-compat aliases retained (detect_environment, detect_get_field, platform_classify, platform_export_env) so callers and the `detect` subcommand are unchanged. Dispatcher fetches the snapshot once; runner reads gpu via environment_field. `setup_ubuntu detect --json` output is byte-identical (golden test) so the ADR-0019-adjacent TUI/agent contract holds. Adds Environment to CONTEXT.md. Claude-Session: https://claude.ai/code/session_01NX5H2vuMTv4mBmjpPYoS3s Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
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
Architecture deepening #5 (grilling-locked): merge
lib/detect.sh+lib/platform.shinto one deeplib/environment.sh(438 lines, under the 800rule). Internally layered: private
_environment_probe_*(I/O) ->_environment_classify(form_factor logic) behind a small interface ->environment_snapshot()(full{os,arch,cpu,gpu,...,form_factor}in one call)environment_field(). Backward-compat aliases kept (detect_environment,detect_get_field,platform_classify,platform_export_env); the dispatcherfetches the snapshot once; the runner reads gpu via
environment_field.detect --jsonoutput is byte-identical (golden test) so the ADR-0019-adjacentTUI/agent contract holds. Adds Environment to CONTEXT.md.
Test plan
runner 93.9%
platform_export_envtakes arequired arg to satisfy SC2119/2120 without a disable)
detect --jsongolden output unchangedDeepening candidate #5.
.agents/memoryuntouched.Generated with Claude Code.