agentydragon(tasks): implement command snippet truncation in session approval labels

This commit is contained in:
Rai (Michael Pokorny)
2025-06-24 20:55:43 -07:00
parent 2a015a2464
commit fca6766935
5 changed files with 159 additions and 23 deletions
@@ -1,7 +1,7 @@
+++
id = "28"
title = "Include Command Snippet in Session-Scoped Approval Label"
status = "Not started"
status = "In progress"
dependencies = "03,06,08,13,15,32,18,19,22,23"
last_updated = "2025-06-25T01:40:09.600000"
+++
@@ -24,11 +24,12 @@ Improve the session-scoped approval option label for commands by including a bac
## Implementation
**How it was implemented**
- In the command-review widget, capture the `commandForDisplay` string and apply a `truncateMiddle(maxLen)` helper.
- Embed the truncated snippet into the session-scoped approval option label.
- Make `maxSnippetLength` configurable via UI settings (default e.g. 30 characters).
- Add tests covering snippet lengths under, equal to, and exceeding the max length, verifying correct ellipsis placement.
**Planned implementation**
- Add a `truncateMiddle` helper in both the Rust TUI and the JS/TS UI to ellipsize command snippets in the middle.
- Extract the first line of the command string (up to any newline), truncate to a default max length (e.g. 30 characters), inserting a single-character ellipsis `…` when needed.
- In the session-scoped approval option, replace the static label with a dynamic one:
`Yes, always allow running `<snippet>` for this session (a)`.
- Write unit tests for the helper and label generation covering commands shorter than, equal to, and longer than the max length.
## Notes