From 1af07f96ba9f90e234467e5639440653c9df8d04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20=C5=BBebrak?= Date: Mon, 15 Dec 2025 10:28:07 +0100 Subject: [PATCH 1/9] Adjust docstring --- clive/__private/settings/_settings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clive/__private/settings/_settings.py b/clive/__private/settings/_settings.py index 553652c6a8..63a4239ce2 100644 --- a/clive/__private/settings/_settings.py +++ b/clive/__private/settings/_settings.py @@ -50,7 +50,7 @@ class Settings: The environment variable ```bash - CLIVE__FIRST_GROUP__NESTED_GROUP__SOME_KEY=124 + CLIVE_FIRST_GROUP__NESTED_GROUP__SOME_KEY=124 ``` would override the setting in the file. -- GitLab From 69919a0f578ee0174f3a05d3c5d3765b54214cb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20=C5=BBebrak?= Date: Thu, 11 Dec 2025 09:16:32 +0000 Subject: [PATCH 2/9] Add CLAUDE.md with project documentation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add comprehensive project overview and architecture documentation - Document CLI and TUI structure with reference to docs/cli_commands_structure.md - Include testing patterns, fixtures, and CI configuration - Document code style, conventions, and development guidelines - Add known accounts, tracked accounts, and profile system details - Reference configuration sources instead of hardcoded values 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 --- CLAUDE.md | 295 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 295 insertions(+) create mode 100644 CLAUDE.md diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000000..b59dfa3eb0 --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,295 @@ +# CLAUDE.md + +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. + +## Project Overview + +**Clive** is a CLI and TUI (Terminal User Interface) application for interacting with the Hive blockchain. It's written +in Python and designed to replace the original Hive CLI for power users and testing. The TUI features mouse-based +navigation inspired by midnight commander. + +- **Main entry point**: `clive` - automatically launches TUI when run without arguments, or CLI mode when arguments + are provided like `clive` for TUI and `clive --help` for CLI +- **Development entry point**: `clive-dev` - includes extra debugging information +- **Python version**: (see `requires-python` in `pyproject.toml`, restricted due to wax dependency) +- **Build system**: Poetry +- **Main branch**: `develop` (use this for PRs, not `main`) + +## GitLab Instance + +This project uses **gitlab.syncad.com**, NOT gitlab.com. + +- Repository: https://gitlab.syncad.com/hive/clive +- Use `glab api "projects/hive%2Fclive/..."` for API calls + +## Essential Commands + +### Installation and Setup + +```bash +# Install dependencies (must be run from repository root) +poetry install + +# When updating dependencies and hive submodule is updated also, test-tools should be forced to uninstall first +pip uninstall -y test-tools && poetry install +``` + +### Running Clive + +```bash +# Launch TUI (default) +clive + +# Use CLI mode +clive --help +clive show profile +clive configure profile create + +# Development mode with debug info (useful for presenting full stack-trace instead of pretty errors in CLI) +clive-dev +``` + +### Linting and Formatting + +```bash +# Run all pre-commit hooks (include tools like ruff, mypy and additional hooks) +pre-commit run --all-files + +# Lint with Ruff +ruff check clive/ tests/ + +# Format code +ruff format clive/ tests/ + +# Type checking +mypy clive/ tests/ +``` + +### Testing + +```bash +# Run smoke test +pytest -n 2 tests/functional/cli/show/test_show_account.py::test_show_account tests/functional/cli/process/test_process_transfer.py::test_process_transfer + +# Run all tests in parallel (default process count set in .gitlab-ci.yml) +pytest -n 16 + +# Run unit tests only +pytest tests/unit/ + +# Run functional tests (CLI or TUI) +pytest tests/functional/cli/ +pytest tests/functional/tui/ + +# Run a single test file (example) +pytest tests/unit/test_date_utils.py + +# Run a specific test (example) +pytest tests/unit/test_date_utils.py::test_specific_function -v + +# Run with timeout (important for tests that may hang) +pytest --timeout=600 + +# Run without parallelization (for debugging) +pytest -n 0 +``` + +**Note**: Tests require the embedded testnet dependencies. Some tests spawn local Hive nodes using `test-tools`. + +## Architecture + +### Configuration + +**Global settings** can be configured via: + +1. **Settings files** (in order of precedence): + + - `~/.clive/settings.toml` (user settings, higher priority) + - `{project_root}/settings.toml` (project defaults) + +2. **Environment variables** override settings files using the format: + + ```bash + CLIVE_{GROUP}__{KEY}=value + ``` + + Example: `CLIVE_NODE__CHAIN_ID=abc123` overrides `[NODE] CHAIN_ID` in settings.toml + +3. **Special environment variable**: `CLIVE_DATA_PATH` controls the Clive data directory (default: `~/.clive`). This + also determines where user settings are loaded from (`$CLIVE_DATA_PATH/settings.toml`). + +**Per-profile settings** are stored separately for each profile and configured via `clive configure`: + +- Tracked accounts (working account + watched accounts) +- Known accounts (and enable/disable feature) +- Key aliases +- Node address +- Chain ID + +See `clive configure --help` for all available options. + +### Core Architecture Pattern: Command Pattern + +Clive uses a **Command Pattern** for all operations that interact with the blockchain or beekeeper: + +- **Commands location**: `clive/__private/core/commands/` +- **Base classes**: All commands inherit from `Command` (in `abc/command.py`) +- **Execution**: Commands are async and executed via `await command.execute()` +- **Command hierarchy**: + - `Command` - Base class with `_execute()` method + - `CommandWithResult` - Commands that return a value + - `CommandRestricted` - Base for commands with execution preconditions + - `CommandInUnlocked` - Commands requiring unlocked user wallet + - `CommandEncryption` - Commands requiring both unlocked user wallet and encryption wallet + - `CommandPasswordSecured` - Commands requiring a password + - `CommandDataRetrieval` - Commands that fetch data from the node + - `CommandCachedDataRetrieval` - Data retrieval with caching support + +### World Object - Application Container + +`World` (`clive/__private/core/world.py`) is the top-level container and single source of truth: + +- `world.profile` - Current user profile (settings, accounts, keys) +- `world.node` - Hive node connection for API calls +- `world.commands` - Access to all command instances +- `world.beekeeper_manager` - Manages beekeeper (key storage) lifecycle +- `world.app_state` - Application state (locked/unlocked, etc.) + +**Important**: Direct `world.node` API calls should be avoided in CLI/TUI. Use `world.commands` instead, which handles +errors properly. + +### Profile System + +Profiles (`clive/__private/core/profile.py`) store user configuration: + +- **Working account**: The currently active Hive account +- **Watched accounts**: Accounts being monitored +- **Known accounts**: Accounts approved for transactions. CLI requires explicit addition before broadcasting + operations (configurable via `enable`/`disable`). TUI automatically adds accounts when operations are added to cart + (also configurable). Managed via `clive configure known-account` +- **Key aliases**: Named public keys +- **Transaction**: Pending transaction operations +- **Node address**: Hive node endpoint +- **Chain ID**: Blockchain identifier (like a mainnet/mirrornet/testnet) + +Profiles are persisted to disk via `PersistentStorageService` with encryption support. + +**Note**: Tracked accounts is a combination of working account and watched accounts. + +### Dual Interface Architecture + +**CLI Mode** (`clive/__private/cli/`): + +- Built with **Typer** for command-line interface +- Main command groups: `configure`, `show`, `process`, `beekeeper`, `generate`, `unlock`, `lock` +- For complete CLI command structure, see `docs/cli_commands_structure.md` +- CLI implementation in `clive/__private/cli/` +- Most of the commands —especially those that interact with profile— require Beekeeper (via the + `CLIVE_BEEKEEPER__REMOTE_ADDRESS` and `CLIVE_BEEKEEPER__SESSION_TOKEN` environment variables) for profile encryption + and decryption. +- Commands `clive beekeeper spawn` and `clive beekeeper create-session` can be used for preparing the CLI environment. + +**TUI Mode** (`clive/__private/ui/`): + +- Built with **Textual** (Python TUI framework) +- Main app: `clive/__private/ui/app.py` (Clive class) +- Screens in `clive/__private/ui/screens/` +- Widgets in `clive/__private/ui/widgets/` +- Styling: TCSS (a Textual variation of CSS) files stored as .scss due to better syntax highlighting +- TUI can be used in environment where Beekeeper is already running (`CLIVE_BEEKEEPER__REMOTE_ADDRESS` and + `CLIVE_BEEKEEPER__SESSION_TOKEN` env vars are set), but without them, beekeeper will be automatically spawned and + session will be created when starting TUI. + +### Beekeeper Integration + +Clive uses **beekeepy** (async Python wrapper) to communicate with Hive's beekeeper for key management: + +- **BeekeeperManager**: `clive/__private/core/beekeeper_manager.py` +- Beekeeper stores keys in encrypted wallets +- Beekeeper wallets are stored in the `~/.clive/beekeeper` directory (or `$CLIVE_DATA_PATH/beekeeper` if customized) +- Two wallet types: user wallets (for signing) and encryption wallets (for encrypting profile data) +- Wallets must be unlocked before use +- Beekeeper address and session token can be pointed with respective setting in the `settings.toml` file or via env + var that would have higher precedence + +### Blockchain Communication + +- **Node interaction**: `clive/__private/core/node/node.py` +- **API wrapper**: `clive/__private/core/node/async_hived/` - async wrapper around Hive node APIs +- **Wax integration**: Uses `hiveio-wax` for transaction building and signing +- **Operation models**: `clive/__private/models/schemas.py` - Pydantic models for Hive operations + +### Storage and Migrations + +- **Storage service**: `clive/__private/storage/service/service.py` +- **Converters**: Runtime models ↔ Storage models +- **Migrations**: `clive/__private/storage/migrations/` - versioned profile schema migrations +- Profiles are stored as encrypted files (location can controlled by `CLIVE_DATA_PATH` environment variable, default: + `~/.clive/data/`) + +## Test Organization + +Tests are organized into two main categories: + +- **`tests/unit/`** - Unit tests for individual components (keys, storage, commands, etc.) +- **`tests/functional/`** - Functional tests split by interface: + - `functional/cli/` - CLI command tests + - `functional/tui/` - TUI interaction tests + +**Test fixtures and patterns**: + +Common fixtures (`tests/conftest.py`): + +- `world` - Async World instance +- `beekeeper` - Async beekeeper instance from beekeepy (spawned automatically) +- `node` - Local testnet node (spawned automatically via test-tools) + +CLI test patterns (`tests/functional/cli/`): + +- Uses `CLITester` from `clive-local-tools` package +- `cli_tester` fixture - Provides typed CLI testing interface with command invocation and output checking + +TUI test patterns (`tests/functional/tui/`): + +- Uses `ClivePilot` (Textual's async test driver) +- `prepared_env` fixture - Returns `(node, wallet, pilot)` tuple with TUI ready on Unlock screen +- `prepared_tui_on_dashboard` fixture - TUI already authenticated and on Dashboard screen +- `node_with_wallet` fixture - Test node with initialized wallet +- Tests interact with TUI via pilot (e.g., `pilot.click()`, `pilot.press()`) + +## Development Guidelines + +### Code Style + +- **Strict mypy**: Type hints are required and strictly enforced +- **Ruff**: Comprehensive linting with "ALL" rules (see `pyproject.toml` for ignored rules) +- **Future imports**: All files must have `from __future__ import annotations` (enforced by ruff) +- **Docstrings**: Google style, checked by pydoclint (no redundant type hints in docstrings) +- **Line length**: See `line-length` in `pyproject.toml` (currently 120 characters) + +### Important Conventions + +1. **Private modules**: Implementation details are in `__private/` directories +2. **No direct initialization**: Some classes (like `Profile`) use factory methods instead of `__init__` +3. **Command pattern**: Always use commands for blockchain operations, not direct API calls +4. **Async context managers**: Many resources (World, Node) require async context manager usage +5. **Settings**: Use `safe_settings` from `clive/__private/settings` for reading configuration + +### When Working With Tests + +- Pytest tests use `test-tools` from the Hive submodule for spawning local nodes +- For manual tests, local testnet node can be started manually via `testnet_node.py` +- Both `testnet_node.py` and `test-tools` based tests require executables from the `hive` submodule pointed by the + `HIVE_BUILD_ROOT_PATH` environment variable +- Beekeeper is spawned automatically by test fixtures when needed +- Tests modify settings to use test directories, not user's actual Clive data +- The `clive-local-tools` package provides test helpers and checkers + +### CI Environment + +Tests run in CI with: + +- Parallel processes configurable via `PYTEST_NUMBER_OF_PROCESSES` (see `.gitlab-ci.yml`, default: 16) +- Timeout configurable via `PYTEST_TIMEOUT_MINUTES` (typically 10 minutes for most test suites) +- Separate jobs for unit tests, CLI tests, and TUI tests +- Tests run against installed wheel (not editable install) -- GitLab From 2edd1a70207917bc3c84899d380420e10ce43b8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20=C5=BBebrak?= Date: Mon, 15 Dec 2025 10:53:51 +0000 Subject: [PATCH 3/9] Add Claude Code slash commands for common workflows MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add /smoke, /lint, /test, and /reflection commands to streamline development workflows like running smoke tests, linting, and pytest. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- .claude/commands/lint.md | 13 +++++++++ .claude/commands/reflection.md | 48 ++++++++++++++++++++++++++++++++++ .claude/commands/smoke.md | 9 +++++++ .claude/commands/test.md | 28 ++++++++++++++++++++ 4 files changed, 98 insertions(+) create mode 100644 .claude/commands/lint.md create mode 100644 .claude/commands/reflection.md create mode 100644 .claude/commands/smoke.md create mode 100644 .claude/commands/test.md diff --git a/.claude/commands/lint.md b/.claude/commands/lint.md new file mode 100644 index 0000000000..dc7ec82026 --- /dev/null +++ b/.claude/commands/lint.md @@ -0,0 +1,13 @@ +Run all linting and formatting checks on the codebase. + +Execute this command: + +```bash +pre-commit run --all-files +``` + +Report the results: + +- If all checks pass, confirm success +- If checks fail, summarize which hooks failed and the key issues found +- For auto-fixable issues (like formatting), mention if files were modified diff --git a/.claude/commands/reflection.md b/.claude/commands/reflection.md new file mode 100644 index 0000000000..5368d98e52 --- /dev/null +++ b/.claude/commands/reflection.md @@ -0,0 +1,48 @@ +You are an expert in prompt engineering, specializing in optimizing AI code assistant instructions. Your task is to +analyze and improve the instructions for Claude Code. Follow these steps carefully: + +1. Analysis Phase: Review the chat history in your context window. + +Then, examine the current Claude instructions, commands and config /CLAUDE.md /.claude/commands/\* +\*\*/CLAUDE.md .claude/settings.json .claude/settings.local.json + +Analyze the chat history, instructions, commands and config to identify areas that could be improved. Look for: + +- Inconsistencies in Claude's responses +- Misunderstandings of user requests +- Areas where Claude could provide more detailed or accurate information +- Opportunities to enhance Claude's ability to handle specific types of queries or tasks +- New commands or improvements to a commands name, function or response +- MCPs we've approved locally that we should add to the config, especially if we've added new tools or require them + for the command to work + +2. Interaction Phase: Present your findings and improvement ideas to the human. For each suggestion: a) Explain the + current issue you've identified b) Propose a specific change or addition to the instructions c) Describe how this + change would improve Claude's performance + +Wait for feedback from the human on each suggestion before proceeding. If the human approves a change, move it to the +implementation phase. If not, refine your suggestion or move on to the next idea. + +3. Implementation Phase: For each approved change: a) Clearly state the section of the instructions you're modifying b) + Present the new or modified text for that section c) Explain how this change addresses the issue identified in the + analysis phase + +4. Output Format: Present your final output in the following structure: + + +[List the issues identified and potential improvements] + + + +[For each approved improvement: +1. Section being modified +2. New or modified instruction text +3. Explanation of how this addresses the identified issue] + + + [Present the complete, updated set of instructions for Claude, incorporating all approved changes] + + +Remember, your goal is to enhance Claude's performance and consistency while maintaining the core functionality and +purpose of the AI assistant. Be thorough in your analysis, clear in your explanations, and precise in your +implementations. diff --git a/.claude/commands/smoke.md b/.claude/commands/smoke.md new file mode 100644 index 0000000000..10230b31e8 --- /dev/null +++ b/.claude/commands/smoke.md @@ -0,0 +1,9 @@ +Run the smoke test to quickly verify basic CLI functionality. + +Execute this command: + +```bash +pytest -n 2 tests/functional/cli/show/test_show_account.py::test_show_account tests/functional/cli/process/test_process_transfer.py::test_process_transfer +``` + +Report the results concisely - whether tests passed or failed, and any errors encountered. diff --git a/.claude/commands/test.md b/.claude/commands/test.md new file mode 100644 index 0000000000..0ec397fc32 --- /dev/null +++ b/.claude/commands/test.md @@ -0,0 +1,28 @@ +Run pytest with the provided arguments. + +Arguments: $ARGUMENTS + +First, expand any shortcuts in the arguments: + +- `unit` → `tests/unit/` +- `cli` → `tests/functional/cli/` +- `tui` → `tests/functional/tui/` +- `functional` → `tests/functional/` + +Then execute pytest with the expanded path. Examples: + +- `/test unit` runs `pytest tests/unit/` +- `/test cli` runs `pytest tests/functional/cli/` +- `/test tests/unit/test_date_utils.py -v` runs as-is (full path provided) + +If no arguments provided, run all tests with parallel execution: + +```bash +pytest -n 16 +``` + +Report results concisely: + +- Number of tests passed/failed/skipped +- For failures, show the test name and a brief summary of the error +- Suggest next steps if tests fail -- GitLab From f28af530361d66db6ecccb16864a2420b65add6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20=C5=BBebrak?= Date: Mon, 15 Dec 2025 11:23:23 +0000 Subject: [PATCH 4/9] Document Claude Code slash commands and simplify Testing section MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add new "Claude Code Commands" section documenting /smoke, /lint, /test, /reflection - Document test shortcuts (unit, cli, tui, functional) - Simplify Testing section by referencing slash commands 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- CLAUDE.md | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index b59dfa3eb0..9c71840cdf 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -22,6 +22,17 @@ This project uses **gitlab.syncad.com**, NOT gitlab.com. - Repository: https://gitlab.syncad.com/hive/clive - Use `glab api "projects/hive%2Fclive/..."` for API calls +## Claude Code Commands + +Available slash commands for development workflows: + +| Command | Description | +| -------------- | ------------------------------------------------------------- | +| `/smoke` | Run smoke test | +| `/lint` | Run all pre-commit hooks | +| `/test ` | Run pytest with shortcuts: `unit`, `cli`, `tui`, `functional` | +| `/reflection` | Analyze and improve Claude Code configuration | + ## Essential Commands ### Installation and Setup @@ -67,23 +78,10 @@ mypy clive/ tests/ ### Testing -```bash -# Run smoke test -pytest -n 2 tests/functional/cli/show/test_show_account.py::test_show_account tests/functional/cli/process/test_process_transfer.py::test_process_transfer - -# Run all tests in parallel (default process count set in .gitlab-ci.yml) -pytest -n 16 - -# Run unit tests only -pytest tests/unit/ - -# Run functional tests (CLI or TUI) -pytest tests/functional/cli/ -pytest tests/functional/tui/ - -# Run a single test file (example) -pytest tests/unit/test_date_utils.py +Use `/smoke`, `/lint`, and `/test` slash commands for common workflows (see +[Claude Code Commands](#claude-code-commands)). +```bash # Run a specific test (example) pytest tests/unit/test_date_utils.py::test_specific_function -v -- GitLab From 35484a0434c18e15b458d666c9e3e3854f2303a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20=C5=BBebrak?= Date: Mon, 15 Dec 2025 13:03:47 +0000 Subject: [PATCH 5/9] Add useful GitLab CLI commands to CLAUDE.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added glab commands for common MR and pipeline operations. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- CLAUDE.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/CLAUDE.md b/CLAUDE.md index 9c71840cdf..707610c792 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -283,6 +283,24 @@ TUI test patterns (`tests/functional/tui/`): - Tests modify settings to use test directories, not user's actual Clive data - The `clive-local-tools` package provides test helpers and checkers +### Useful Commands + +#### GitLab CLI (glab) + +```bash +# Find MR for a branch +glab mr list --source-branch= + +# Add comment to MR +glab mr note --message "..." + +# Get pipeline job details +glab api "projects/hive%2Fclive/pipelines//jobs" + +# Get job logs +glab api "projects/hive%2Fclive/jobs//trace" +``` + ### CI Environment Tests run in CI with: -- GitLab From aae69e0ae093bc01701206b1d18d708b72bce75e Mon Sep 17 00:00:00 2001 From: Aleksandra Grabowska Date: Mon, 15 Dec 2025 09:14:29 +0000 Subject: [PATCH 6/9] Update balance table to show Liquid, Savings, and Stake rows Reorganize balance table layout to match Dashboard reorganization (MR !792): - Change from 4 columns with headers to 3 columns without headers - Remove column headers (show_header=False) for cleaner display - Add new 'Stake' row displaying HP and VESTS balances - Simplify column definitions by removing empty string labels - All amounts now display with currency symbols via humanize functions This layout change separates liquid, savings, and stake balances into distinct rows, making the CLI output consistent with the Dashboard UI. Related to #514 --- .../cli/commands/show/show_account.py | 30 ++++++++----------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/clive/__private/cli/commands/show/show_account.py b/clive/__private/cli/commands/show/show_account.py index f3ae282da2..9e58b8e2d0 100644 --- a/clive/__private/cli/commands/show/show_account.py +++ b/clive/__private/cli/commands/show/show_account.py @@ -21,7 +21,6 @@ from clive.__private.core.formatters.humanize import ( humanize_manabar_regeneration_time, humanize_percent, ) -from clive.__private.models.asset import Asset if TYPE_CHECKING: from clive.__private.core.alarms.alarms_storage import AlarmsStorage @@ -77,28 +76,25 @@ class ShowAccount(WorldBasedCommand): return general_info_table def _create_balance_table(self) -> Table: - balances_table = Table(title="The balances") - hive_symbol = Asset.get_symbol(Asset.Hive) - hbd_symbol = Asset.get_symbol(Asset.Hbd) - hp_symbol = "HP" - balances_table.add_column("", justify="left", style="cyan", no_wrap=True) - balances_table.add_column(hbd_symbol, justify="right", style="green", no_wrap=True) - balances_table.add_column(hive_symbol, justify="right", style="green", no_wrap=True) - balances_table.add_column(hp_symbol, justify="right", style="green", no_wrap=True) - - humanize_asset_no_symbol = partial(humanize_asset, show_symbol=False) + balances_table = Table(title="The balances", show_header=False) + balances_table.add_column(justify="left", style="cyan", no_wrap=True) + balances_table.add_column(justify="right", style="green", no_wrap=True) + balances_table.add_column(justify="right", style="green", no_wrap=True) balances_table.add_row( "Liquid", - humanize_asset_no_symbol(self._account_data.hbd_balance), - humanize_asset_no_symbol(self._account_data.hive_balance), - humanize_hive_power_with_comma(self._account_data.owned_hp_balance.hp_balance, show_symbol=False), + f"{humanize_asset(self._account_data.hbd_balance)}", + f"{humanize_asset(self._account_data.hive_balance)}", ) balances_table.add_row( "Savings", - humanize_asset_no_symbol(self._account_data.hbd_savings), - humanize_asset_no_symbol(self._account_data.hive_savings), - "---", + f"{humanize_asset(self._account_data.hbd_savings)}", + f"{humanize_asset(self._account_data.hive_savings)}", + ) + balances_table.add_row( + "Stake", + humanize_hive_power_with_comma(self._account_data.owned_hp_balance.hp_balance, show_symbol=True), + humanize_asset(self._account_data.owned_hp_balance.vests_balance), ) return balances_table -- GitLab From 523b5d3786a2b4aa9b2870b5d037f61fb5c89e3a Mon Sep 17 00:00:00 2001 From: Aleksandra Grabowska Date: Mon, 15 Dec 2025 09:15:29 +0000 Subject: [PATCH 7/9] Add decimal alignment to balance amounts using align_to_dot() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Implement proper decimal point alignment for all balance amounts in the balance table using the existing align_to_dot() utility function. This ensures that decimal points line up vertically within each column, making the table more readable and consistent with other parts of the application that use the same alignment utility. Changes: - Import align_to_dot from humanize module - Align HBD/HP values in column 2 (Liquid, Savings, Stake) - Align HIVE/VESTS values in column 3 (Liquid, Savings, Stake) - Use existing utility instead of manual string splitting Closes #514 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 --- .../cli/commands/show/show_account.py | 34 ++++++++++--------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/clive/__private/cli/commands/show/show_account.py b/clive/__private/cli/commands/show/show_account.py index 9e58b8e2d0..f73f08a725 100644 --- a/clive/__private/cli/commands/show/show_account.py +++ b/clive/__private/cli/commands/show/show_account.py @@ -1,7 +1,6 @@ from __future__ import annotations from dataclasses import dataclass, field -from functools import partial from typing import TYPE_CHECKING from rich.columns import Columns @@ -14,6 +13,7 @@ from clive.__private.cli.print_cli import print_cli from clive.__private.cli.styling import colorize_error from clive.__private.core.accounts.accounts import TrackedAccount from clive.__private.core.formatters.humanize import ( + align_to_dot, humanize_asset, humanize_bool, humanize_datetime, @@ -81,21 +81,23 @@ class ShowAccount(WorldBasedCommand): balances_table.add_column(justify="right", style="green", no_wrap=True) balances_table.add_column(justify="right", style="green", no_wrap=True) - balances_table.add_row( - "Liquid", - f"{humanize_asset(self._account_data.hbd_balance)}", - f"{humanize_asset(self._account_data.hive_balance)}", - ) - balances_table.add_row( - "Savings", - f"{humanize_asset(self._account_data.hbd_savings)}", - f"{humanize_asset(self._account_data.hive_savings)}", - ) - balances_table.add_row( - "Stake", - humanize_hive_power_with_comma(self._account_data.owned_hp_balance.hp_balance, show_symbol=True), - humanize_asset(self._account_data.owned_hp_balance.vests_balance), - ) + # Get all balance values as strings + hbd_liquid = humanize_asset(self._account_data.hbd_balance) + hbd_savings = humanize_asset(self._account_data.hbd_savings) + hp_stake = humanize_hive_power_with_comma(self._account_data.owned_hp_balance.hp_balance, show_symbol=True) + + hive_liquid = humanize_asset(self._account_data.hive_balance) + hive_savings = humanize_asset(self._account_data.hive_savings) + vests_stake = humanize_asset(self._account_data.owned_hp_balance.vests_balance) + + # Align decimal points within each column + col2_aligned = align_to_dot(hbd_liquid, hbd_savings, hp_stake) + col3_aligned = align_to_dot(hive_liquid, hive_savings, vests_stake) + + balances_table.add_row("Liquid", col2_aligned[0], col3_aligned[0]) + balances_table.add_row("Savings", col2_aligned[1], col3_aligned[1]) + balances_table.add_row("Stake", col2_aligned[2], col3_aligned[2]) + return balances_table def _create_manabar_stats_table(self) -> Table: -- GitLab From 6ad2d5b4f46a17a1c383aa3bc7a7bd47168a65a0 Mon Sep 17 00:00:00 2001 From: Aleksandra Grabowska Date: Fri, 19 Dec 2025 08:31:28 +0000 Subject: [PATCH 8/9] Fix HP formatting in balance table to match Dashboard MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use humanize_hive_power() instead of humanize_hive_power_with_comma() for the Stake row, matching the TUI Dashboard implementation. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- clive/__private/cli/commands/show/show_account.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/clive/__private/cli/commands/show/show_account.py b/clive/__private/cli/commands/show/show_account.py index f73f08a725..f0b8c7d4e3 100644 --- a/clive/__private/cli/commands/show/show_account.py +++ b/clive/__private/cli/commands/show/show_account.py @@ -17,6 +17,7 @@ from clive.__private.core.formatters.humanize import ( humanize_asset, humanize_bool, humanize_datetime, + humanize_hive_power, humanize_hive_power_with_comma, humanize_manabar_regeneration_time, humanize_percent, @@ -84,7 +85,7 @@ class ShowAccount(WorldBasedCommand): # Get all balance values as strings hbd_liquid = humanize_asset(self._account_data.hbd_balance) hbd_savings = humanize_asset(self._account_data.hbd_savings) - hp_stake = humanize_hive_power_with_comma(self._account_data.owned_hp_balance.hp_balance, show_symbol=True) + hp_stake = humanize_hive_power(self._account_data.owned_hp_balance.hp_balance) hive_liquid = humanize_asset(self._account_data.hive_balance) hive_savings = humanize_asset(self._account_data.hive_savings) -- GitLab From 3fb9f756188a5fb93aac47885ef41ab5376e09c5 Mon Sep 17 00:00:00 2001 From: Aleksandra Grabowska Date: Fri, 19 Dec 2025 08:31:57 +0000 Subject: [PATCH 9/9] Fix VESTS formatting in balance table to match Dashboard MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add use_short_form=True parameter to humanize_asset() for VESTS, matching the TUI Dashboard implementation. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- clive/__private/cli/commands/show/show_account.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clive/__private/cli/commands/show/show_account.py b/clive/__private/cli/commands/show/show_account.py index f0b8c7d4e3..dcf4b2579d 100644 --- a/clive/__private/cli/commands/show/show_account.py +++ b/clive/__private/cli/commands/show/show_account.py @@ -89,7 +89,7 @@ class ShowAccount(WorldBasedCommand): hive_liquid = humanize_asset(self._account_data.hive_balance) hive_savings = humanize_asset(self._account_data.hive_savings) - vests_stake = humanize_asset(self._account_data.owned_hp_balance.vests_balance) + vests_stake = humanize_asset(self._account_data.owned_hp_balance.vests_balance, use_short_form=True) # Align decimal points within each column col2_aligned = align_to_dot(hbd_liquid, hbd_savings, hp_stake) -- GitLab