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.
This commit is contained in:
Brooklyn Nicholson 2026-07-28 03:47:49 -05:00
parent 20b2022b8c
commit ddd6b57938
2 changed files with 13 additions and 2 deletions

View file

@ -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', () => {

View file

@ -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