Skip to content

Add Hex1bTerminalAutomator imperative testing API#243

Merged
mitchdenny merged 1 commit intomainfrom
terminal-automator
Mar 13, 2026
Merged

Add Hex1bTerminalAutomator imperative testing API#243
mitchdenny merged 1 commit intomainfrom
terminal-automator

Conversation

@mitchdenny
Copy link
Copy Markdown
Owner

Introduce Hex1bTerminalAutomator, an imperative async API for terminal test automation that layers on top of the existing input sequencer.

Each method executes immediately and records its result in a step history. When a step fails, Hex1bAutomationException provides rich diagnostics including:

  • Full breadcrumb trail of completed steps with timings
  • Caller file/line via CallerFilePath/CallerLineNumber attributes
  • Terminal snapshot at the point of failure
  • Total elapsed time across all steps

New Types

  • Hex1bTerminalAutomator — Main API with wait, key, mouse, and typing methods
  • Hex1bAutomationException — Rich exception with step history and snapshot
  • AutomationStepRecord — Immutable record of a completed step

The automator supports modifier stacking (Ctrl/Shift/Alt), sequence caching for common keys, and composability via SequenceAsync for inline or pre-built sequences.

Introduce Hex1bTerminalAutomator, an imperative async API for terminal
test automation that layers on top of the existing input sequencer.

Each method executes immediately and records its result in a step history.
When a step fails, Hex1bAutomationException provides rich diagnostics:
- Full breadcrumb trail of completed steps with timings
- Caller file/line via CallerFilePath/CallerLineNumber attributes
- Terminal snapshot at the point of failure
- Total elapsed time across all steps

New types:
- Hex1bTerminalAutomator: Main API with wait, key, mouse, and typing methods
- Hex1bAutomationException: Rich exception with step history and snapshot
- AutomationStepRecord: Immutable record of a completed step

The automator supports modifier stacking (Ctrl/Shift/Alt), sequence caching
for common keys, and composability via SequenceAsync for inline or pre-built
sequences. Extension methods can be built on top for domain-specific helpers.

Includes 16 unit tests and updated testing guide documentation.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown

📦 PR Packages Published

Preview packages for this PR have been published to GitHub Packages.

Package Version

0.116.0-pr.243.23043055060.555d192.1

Packages

Package Description
Hex1b Core TUI library
Hex1b.McpServer MCP server for terminal session management
Hex1b.Tool CLI tool for terminal management and diagnostics

Usage Examples

Hex1b - PackageReference (csproj):

<PackageReference Include="Hex1b" Version="0.116.0-pr.243.23043055060.555d192.1" />

Hex1b - .NET CLI:

dotnet add package Hex1b --version 0.116.0-pr.243.23043055060.555d192.1

Hex1b.McpServer - Install as global tool:

dotnet tool install -g Hex1b.McpServer --version 0.116.0-pr.243.23043055060.555d192.1

Hex1b.Tool - Install as global tool:

dotnet tool install -g Hex1b.Tool --version 0.116.0-pr.243.23043055060.555d192.1

Once installed, the tool is available as:

hex1b terminal list
hex1b capture <id> --format svg
hex1b keys <id> --key Enter

NuGet Configuration

To use this package, you need to configure a NuGet.config file with the GitHub Packages feed:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <!--To inherit the global NuGet package sources remove the <clear/> line below -->
    <clear />
    <add key="nuget" value="https://api.nuget.org/v3/index.json" />
    <add key="github-mitchdenny" value="https://nuget.pkg.github.com/mitchdenny/index.json" />
  </packageSources>
  <packageSourceMapping>
    <packageSource key="nuget">
      <package pattern="*" />
    </packageSource>
    <packageSource key="github-mitchdenny">
      <package pattern="Hex1b*" />
    </packageSource>
  </packageSourceMapping>
</configuration>

Authentication

GitHub Packages requires authentication. Make sure your GitHub CLI has the read:packages scope:

# Check current scopes
gh auth status

# If needed, refresh with packages scope
gh auth refresh -s read:packages

# Configure NuGet to use GitHub auth
dotnet nuget update source github-mitchdenny \
  --username YOUR_GITHUB_USERNAME \
  --password $(gh auth token) \
  --store-password-in-clear-text

Package published at 2026-03-13 08:52:01 UTC

mitchdenny pushed a commit to microsoft/aspire that referenced this pull request Mar 13, 2026
Demonstrate the new Hex1bTerminalAutomator imperative testing API by
converting WaitCommandTests from the Hex1bTerminalInputSequenceBuilder
declarative pattern to the automator's step-by-step async pattern.

Changes:
- Update NuGet.config: Add hex1b-gh-packages feed for PR packages
- Update Directory.Packages.props: Hex1b packages to 0.116.0-pr.243
  (from mitchdenny/hex1b#243 which adds the automator API)
- Add tests/Shared/Hex1bAutomatorTestHelpers.cs: Automator extension
  methods (WaitForSuccessPromptAsync, DeclineAgentInitPromptAsync,
  AspireNewAsync, etc.) with descriptive step names for diagnostics
- Add tests/.../Helpers/CliE2EAutomatorHelpers.cs: Docker-specific
  automator extensions (PrepareDockerEnvironmentAsync,
  InstallAspireCliInDockerAsync)
- Convert WaitCommandTests.cs: Replace builder pattern with imperative
  automator calls. Each step executes immediately with rich error context
  on failure (step history, terminal snapshot, caller location).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown

🚀 Deployment Successful

Your PR environment has been deployed to Azure!

Resources


Deployment completed at 2026-03-13 08:59:04 UTC

@mitchdenny mitchdenny merged commit 57be761 into main Mar 13, 2026
11 checks passed
@github-actions
Copy link
Copy Markdown

🗑️ Environment Cleanup

The PR environment hex1b-pr-243 has been automatically deleted due to inactivity (PR was inactive for more than 0 hour(s)).

This operation runs asynchronously and may take a few minutes to complete.


Cleanup initiated at 2026-03-13 09:28:44 UTC

mitchdenny pushed a commit to microsoft/aspire that referenced this pull request Mar 14, 2026
Demonstrate the new Hex1bTerminalAutomator imperative testing API by
converting WaitCommandTests from the Hex1bTerminalInputSequenceBuilder
declarative pattern to the automator's step-by-step async pattern.

Changes:
- Update NuGet.config: Add hex1b-gh-packages feed for PR packages
- Update Directory.Packages.props: Hex1b packages to 0.116.0-pr.243
  (from mitchdenny/hex1b#243 which adds the automator API)
- Add tests/Shared/Hex1bAutomatorTestHelpers.cs: Automator extension
  methods (WaitForSuccessPromptAsync, DeclineAgentInitPromptAsync,
  AspireNewAsync, etc.) with descriptive step names for diagnostics
- Add tests/.../Helpers/CliE2EAutomatorHelpers.cs: Docker-specific
  automator extensions (PrepareDockerEnvironmentAsync,
  InstallAspireCliInDockerAsync)
- Convert WaitCommandTests.cs: Replace builder pattern with imperative
  automator calls. Each step executes immediately with rich error context
  on failure (step history, terminal snapshot, caller location).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
mitchdenny added a commit to microsoft/aspire that referenced this pull request Mar 14, 2026
…5206)

* Convert WaitCommandTests to Hex1bTerminalAutomator API

Demonstrate the new Hex1bTerminalAutomator imperative testing API by
converting WaitCommandTests from the Hex1bTerminalInputSequenceBuilder
declarative pattern to the automator's step-by-step async pattern.

Changes:
- Update NuGet.config: Add hex1b-gh-packages feed for PR packages
- Update Directory.Packages.props: Hex1b packages to 0.116.0-pr.243
  (from mitchdenny/hex1b#243 which adds the automator API)
- Add tests/Shared/Hex1bAutomatorTestHelpers.cs: Automator extension
  methods (WaitForSuccessPromptAsync, DeclineAgentInitPromptAsync,
  AspireNewAsync, etc.) with descriptive step names for diagnostics
- Add tests/.../Helpers/CliE2EAutomatorHelpers.cs: Docker-specific
  automator extensions (PrepareDockerEnvironmentAsync,
  InstallAspireCliInDockerAsync)
- Convert WaitCommandTests.cs: Replace builder pattern with imperative
  automator calls. Each step executes immediately with rich error context
  on failure (step history, terminal snapshot, caller location).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Fix unresolved XML doc cref for Hex1bTerminalInputSequenceBuilder

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Mitch Denny <mitch@mitchdeny.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI pushed a commit to microsoft/aspire that referenced this pull request Mar 14, 2026
…5206)

* Convert WaitCommandTests to Hex1bTerminalAutomator API

Demonstrate the new Hex1bTerminalAutomator imperative testing API by
converting WaitCommandTests from the Hex1bTerminalInputSequenceBuilder
declarative pattern to the automator's step-by-step async pattern.

Changes:
- Update NuGet.config: Add hex1b-gh-packages feed for PR packages
- Update Directory.Packages.props: Hex1b packages to 0.116.0-pr.243
  (from mitchdenny/hex1b#243 which adds the automator API)
- Add tests/Shared/Hex1bAutomatorTestHelpers.cs: Automator extension
  methods (WaitForSuccessPromptAsync, DeclineAgentInitPromptAsync,
  AspireNewAsync, etc.) with descriptive step names for diagnostics
- Add tests/.../Helpers/CliE2EAutomatorHelpers.cs: Docker-specific
  automator extensions (PrepareDockerEnvironmentAsync,
  InstallAspireCliInDockerAsync)
- Convert WaitCommandTests.cs: Replace builder pattern with imperative
  automator calls. Each step executes immediately with rich error context
  on failure (step history, terminal snapshot, caller location).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Fix unresolved XML doc cref for Hex1bTerminalInputSequenceBuilder

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Mitch Denny <mitch@mitchdeny.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant