Skip to content

feat(cli): wrap transaction hashes in clickable StellarExpert links - #2

Open
Opulencechuks wants to merge 4 commits into
mainfrom
track-request-durations
Open

feat(cli): wrap transaction hashes in clickable StellarExpert links#2
Opulencechuks wants to merge 4 commits into
mainfrom
track-request-durations

Conversation

@Opulencechuks

Copy link
Copy Markdown
Owner

Clickable StellarExpert Links for Transaction Hashes in CLI

Description

This pull request implements automatic terminal-level hyperlink wrapping for all 64-character Stellar transaction hashes printed to standard output or standard error by the momo-cli tool.

When terminal software that supports the OSC 8 hyperlink specification encounters these transaction hashes, they will be formatted as colorized, clickable links pointing directly to the correct transaction page on StellarExpert (resolving to either the public or testnet explorer depending on the active STELLAR_NETWORK environment variable).

Proposed Changes

src/scripts/momo-cli.ts

  • Added stream interception logic at the entry point of the CLI application.
  • Overwrote process.stdout.write and process.stderr.write to scan output chunks (both string and raw buffer data) using a regular expression that detects 64-character hexadecimal transaction hashes (/\b([0-9a-fA-F]{64})\b/g).
  • Encapsulated matching hashes in the ANSI OSC 8 hyperlink format:
    \x1b]8;;https://stellar.expert/explorer/<network>/tx/<hash>\x1b\\\x1b[36m\x1b[1m<hash>\x1b[0m\x1b]8;;\x1b\\
  • Used colorized styling (Cyan + Bold) for maximum visual clarity on supported terminals.

momo-cli (Bash Wrapper)

  • Added inline documentation indicating that the CLI now automatically wraps transaction hashes in clickable StellarExpert links.

Verification & Acceptance Criteria

  • Formatting check: Successfully verified using a test run that matching 64-character hex strings are correctly replaced by valid OSC 8 hyperlink sequences containing the appropriate environment-aware StellarExpert URL structure.
  • Console safety: Verified that the wrapper handles both string and Uint8Array chunks gracefully without throwing encoding or parsing errors.

@github-actions

Copy link
Copy Markdown

📊 Coverage Report

❌ Coverage below thresholds

Metric Current Threshold Status
Statements 9.1% 20%
Branches 9.05% 15%
Functions 8.2% 25%
Lines 9.09% 20%

Coverage enforcement is configured in jest.config.js. Thresholds only go up — never down.

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