]> Piment Noir Git Repositories - e-mobility-charging-stations-simulator.git/commit
feat(ui-cli): add custom JSON payload option for OCPP and transaction commands
authorJérôme Benoit <jerome.benoit@sap.com>
Fri, 17 Apr 2026 23:10:32 +0000 (01:10 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Fri, 17 Apr 2026 23:10:32 +0000 (01:10 +0200)
commit331705d19e0f1541720cb72ffe83c0f405cb8bb8
tree76028e27b7acc5750f6f80998b26fa15f201fa8a
parentbcb21a59907b2ab0841956fe2c50f8bd2be8619a
feat(ui-cli): add custom JSON payload option for OCPP and transaction commands

Add -p, --payload <json|@file|-> to all 16 OCPP commands and both
transaction commands. Supports three input modes:
- Inline JSON: -p '{"reason":"PowerUp"}'
- File: -p @collections/boot.json
- Stdin: echo '{}' | evse-cli ocpp heartbeat -p -

Payload is merged beneath command-specific options (--id-tag, etc.)
so CLI flags always take precedence.

Implementation:
- New resolve-payload.ts: async resolver with validation (object check,
  empty check, JSON parse error with preview)
- Payload resolution integrated into runAction try/catch for clean
  error handling (no stack traces on user input errors)
- PAYLOAD_OPTION/PAYLOAD_DESC constants shared via payload.ts
- 11 unit tests for resolvePayload (inline, @file, edge cases)
- README and SKILL.md updated with examples
ui/cli/README.md
ui/cli/skills/evse-simulator/SKILL.md
ui/cli/src/commands/action.ts
ui/cli/src/commands/ocpp.ts
ui/cli/src/commands/payload.ts
ui/cli/src/commands/resolve-payload.ts [new file with mode: 0644]
ui/cli/src/commands/transaction.ts
ui/cli/tests/resolve-payload.test.ts [new file with mode: 0644]