From: Jérôme Benoit Date: Fri, 17 Apr 2026 21:35:15 +0000 (+0200) Subject: feat(ui-cli): short hash prefix matching, human output formatters, embedded agent... X-Git-Tag: cli@v4.5.0~26 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=dd8e4161d8629cae2020a5ff451b1539f83b29db;p=e-mobility-charging-stations-simulator.git feat(ui-cli): short hash prefix matching, human output formatters, embedded agent skill Short hash resolution: - Resolve hash ID prefixes via station list lookup before command execution - Skip resolution when all IDs are full-length (>= 48 chars, SHA-384) - Clear error messages for ambiguous or unknown prefixes - Silent mode suppresses spinner during internal resolution call Human output formatters: - Borderless table renderers for station list, template list, simulator state, performance stats - Shared format utils: truncateId, statusIcon, wsIcon, fuzzyTime, countConnectors - Truncate hash IDs in all human output tables (station list + success/failure) - Type guards with Array.isArray + null checks for safe payload dispatch - Handle supervisionUrls as string | string[], optional configuration - Dynamic status capitalization, shared captureStream test helper - 70 new tests (format + renderers), using canonical ChargingStationData type Embedded agent skill: - `skill show` prints embedded SKILL.md to stdout - `skill install [--global] [--force]` writes to .agents/skills/ - SKILL.md embedded at build time via esbuild define - Follows AgentSkills.io open standard CLI option rename: - Global --url renamed to --server-url (explicit intent) - supervision set-url --url renamed to --supervision-url (no collision) README restructured with prefix matching docs, output modes table, station delete options, grouped simulator vs local commands --- diff --git a/ui/cli/README.md b/ui/cli/README.md index 6b02186f..2ff767b2 100644 --- a/ui/cli/README.md +++ b/ui/cli/README.md @@ -98,7 +98,7 @@ Use `--config ` to load a specific config file instead of the XDG default. ## Usage ```shell -node dist/cli.js [global-options] [subcommand] [options] +evse-cli [global-options] [subcommand] [options] ``` ### Global Options @@ -111,24 +111,43 @@ node dist/cli.js [global-options] [subcommand] [options] | `--server-url ` | WebSocket URL (overrides config host/port/secure) | | `-h, --help` | Show help | -### Commands +### Using hashIds + +Most commands accept optional `[hashId...]` arguments to target specific stations. Omitting them applies the command to all stations. + +Hash IDs support **prefix matching** — you can use a short prefix instead of the full ID. The CLI resolves it automatically: + +```shell +# Full hash: +evse-cli station start e9041c294a82a2d6aa194a801c3ba39d6b24d1cb... + +# Short prefix (copied from `station list` output): +evse-cli station start e9041c294a82 + +# Even shorter (as long as it's unambiguous): +evse-cli station start e904 +``` + +If a prefix matches multiple stations, the CLI returns an error. + +### Simulator Commands #### simulator ```shell -node dist/cli.js simulator state # Get simulator state and statistics -node dist/cli.js simulator start # Start the simulator -node dist/cli.js simulator stop # Stop the simulator +evse-cli simulator state # Get simulator state and statistics +evse-cli simulator start # Start the simulator +evse-cli simulator stop # Stop the simulator ``` #### station ```shell -node dist/cli.js station list # List all charging stations -node dist/cli.js station start [hashId...] # Start station(s) -node dist/cli.js station stop [hashId...] # Stop station(s) -node dist/cli.js station add -t