From ddd6b57938af594246cf7fe0303a7eb55a228c8d Mon Sep 17 00:00:00 2001 From: Brooklyn Nicholson Date: Tue, 28 Jul 2026 03:47:49 -0500 Subject: [PATCH] test(desktop): a leading slash now chips, superseding #71664's exclusion #71664 asserted a leading slash never chips, correctly: a command only ever executed, so it never reached a rendered message as text. Projecting a skill turn back onto its invocation removes that precondition. --- .../src/components/assistant-ui/directive-text.test.ts | 10 ++++++++-- .../src/components/assistant-ui/directive-text.tsx | 5 +++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/apps/desktop/src/components/assistant-ui/directive-text.test.ts b/apps/desktop/src/components/assistant-ui/directive-text.test.ts index d5f7074e5d13..c177e2f50662 100644 --- a/apps/desktop/src/components/assistant-ui/directive-text.test.ts +++ b/apps/desktop/src/components/assistant-ui/directive-text.test.ts @@ -74,8 +74,14 @@ describe('inline skill references', () => { expect(skills('roughly 3 /4 of it')).toEqual([]) }) - it('does not chip a leading slash — that is a command invocation, not prose', () => { - expect(skills('/clean')).toEqual([]) + it('chips a leading slash, which now reaches the transcript as a skill invocation', () => { + // #71664 asserted the opposite, and was right at the time: a leading slash + // only ever EXECUTED, so it never reached a rendered message as text — + // the turn that reached the bubble was the expanded skill body. Projecting + // a skill turn back onto `/work fix it` changes that precondition, so the + // invocation now has to chip like any other skill reference. + expect(skills('/clean')).toEqual(['/clean']) + expect(skills('/work fix the leak')).toEqual(['/work']) }) it('parses a skill chip alongside an @ reference', () => { diff --git a/apps/desktop/src/components/assistant-ui/directive-text.tsx b/apps/desktop/src/components/assistant-ui/directive-text.tsx index f04340c5d6e1..418f59eda717 100644 --- a/apps/desktop/src/components/assistant-ui/directive-text.tsx +++ b/apps/desktop/src/components/assistant-ui/directive-text.tsx @@ -183,6 +183,11 @@ const HERMES_DIRECTIVE_RE = new RegExp( // pills, so the sent message renders them as pills too rather than flattening // back to raw text. // +// #71664 deliberately excluded a LEADING slash, and was right then: a command +// only ever executed, so it never reached a rendered message as text. Skill +// turns now project back onto their invocation, so that precondition is gone +// and `^` joins the lookbehind. +// // Unlike the composer's caret-anchored trigger, this scans finished text, so // it must reject a token that continues into a path: `/usr/local/bin` would // otherwise chip as `/usr`. `(?![\w-]*\/)` requires the token to end at