Add AdrPlus config, merge ADRs, and fix console I/O issues - #5
Merged
Conversation
docs/adr/adr-config.adrplus was absent, even though the existing ADR files clearly follow the AdrPlus Nygard-template/profile-3 convention (header fields, disclaimer text, and naming all match its defaults) and PromptPlus's sibling repo already has this file. Without it, the adrplus CLI has no way to manage this repo's ADRs.
Updated the package version in ConsolePlus.csproj from 1.0.0-Beta1 to 1.0.0-Beta2 to prepare for the next beta release.
Both records documented the same ConsolePlus/PromptPlus split decision; ADR0011 restated it without adding a distinct decision, so it is folded into ADR0001V01R02 per the project's revision-over-new-number policy. Fixes cross-links in the ADR index and neighboring ADRs' nav. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
ADR0011 was folded into ADR0001V01R02 in the previous commit, leaving a gap in the sequence. Shift ShutdownStateRestoration, EmojiShortcodeModel, LowLevelAnsiAndAlternateScreen, and GeneratedApiDocsOffLimits down by one (0012->0011, 0013->0012, 0014->0013, 0015->0014) so the ADR sequence is contiguous again, fixing every cross-link accordingly. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
NoAnsiConsoleAdapter.Clear() and SetCursorPosition() called the raw Console APIs unguarded, so any headless/redirected process (e.g. this xUnit test host itself) crashed with IOException: "The handle is invalid." Wrapped both in the same catch-IOException/PlatformNotSupportedException "Safe" pattern already used by HideCursor/ShowCursor and EnvironmentUtil's GetSafeWidth/GetSafeHeight/GetSafeTopCursor. CursorLeft/ CursorTop setters had the same bug (raw Console.SetCursorPosition call) and now delegate to the fixed SetCursorPosition instead of duplicating it. Added regression tests against the real ConsolePlus singleton (not the VirtualTerminal mock, which never touches NoAnsiConsoleAdapter) — verified they fail with the original bug and pass with the fix.
… redirected input KeyAvailable and ReadKey(Async) in both AnsiConsoleAdapter and NoAnsiConsoleAdapter only guarded against !_profile.Interactive, which defaults to true outside a short list of known CI providers. A real redirected input (file/pipe/SetIn) doesn't match any of them, so the raw Console.KeyAvailable/ReadKey call was reached and threw .NET's own InvalidOperationException uncaught. Added an explicit Console.IsInputRedirected check alongside _profile.Interactive: KeyAvailable now returns false instead of throwing (matching its existing non-throwing contract), and ReadKey(Async) now throws the same documented "Console is not interactive." exception Read()/ReadLine() already use, instead of leaking the raw framework message. Added regression tests against the real ConsolePlus singleton, verified they fail with the original bug and pass with the fix.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Fixes a stale reading-input.md callout that only mentioned Profile.Interactive; ReadKey/ReadKeyAsync also check IsInputRedirected directly, since the CI-provider heuristic alone misses plain redirection. Adds a note to cursor-and-screen.md covering the presentation-only members that fail safe instead. Co-Authored-By: Claude Sonnet 5 <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.
This pull request updates and reorganizes the Architecture Decision Records (ADRs) for the project, cleaning up document numbering, cross-references, and consolidating overlapping decisions. It also introduces a new ADR that documents the contract for redirected/headless console I/O, clarifying how the library behaves in these environments. The ADR index and navigation links are updated throughout to match the new structure.
ADR document cleanup and consolidation:
ADR0012→ADR0011,ADR0013→ADR0012, etc.), and updated all cross-references and navigation links accordingly. [1] [2] [3] [4] [5]ADR0011V01R01-SeparationFromPromptPlus.md) and merged its content into the revisedADR0001V01R02-SplitConsolePlusAndPromptPlus.md, clarifying that only one ADR records this architectural boundary. [1] [2]Redirected/headless console I/O contract:
ADR0015V01R01-RedirectedConsoleIoContract.md, specifying that all presentation-only writes (e.g.,Clear(), cursor setters) fail safe (no-op), while key-based reads fail loud with a predictable exception under redirection or in headless environments. This ensures consistent, documented behavior and prevents leaking platform exceptions. [1] [2]Documentation and configuration updates:
README.md) and navigation links in all ADRs to match the new file names and ordering. [1] [2] [3] [4] [5] [6]adr-config.adrplusfile to define ADR naming, versioning, and formatting conventions for the repository.These changes improve the maintainability and clarity of the project's architectural documentation, and make the handling of redirected console I/O explicit and robust.