Files
multica/packages/views/issues/utils/strip-mention-markdown.ts
LinYushen ca10535bb6 fix: execution log name rendering and squad assignee support (#2575)
* fix: execution log name rendering and squad assignee support

- Strip mention markdown in trigger_summary ([@Name](mention://...) → @Name)
  so execution log rows show clean text instead of raw markdown
- Add squad to ActorFilterValue type so squad assignees are filterable
- Add squad section to assignee filter dropdown in issues-header
- Add i18n keys for squads_group (en/zh-Hans)

Co-authored-by: multica-agent <github@multica.ai>

* fix: address PR #2575 review feedback

1. Extract stripMentionMarkdown as reusable helper with proper regex
   - Handles escaped brackets in names (e.g. David\[TF\])
   - Skips backslash-escaped mentions (\[@...])
   - Handles issue mentions (no @ prefix)
   - Does not touch regular markdown links
   - 10 unit tests added

2. Squad only appears in Assignee filter, not Creator
   - Added showSquads prop to ActorSubContent (default true)
   - Creator filter passes showSquads={false}

3. Squad included in Agents scope
   - issues-page scope filter now includes squad in agents scope
   - 2 regression tests added for scope coverage

Co-authored-by: multica-agent <github@multica.ai>

---------

Co-authored-by: multica-agent <github@multica.ai>
2026-05-14 13:08:05 +08:00

22 lines
851 B
TypeScript

/**
* Strip mention markdown syntax to plain text.
*
* Handles:
* - Simple mentions: `[@Name](mention://agent/id)` → `@Name`
* - Escaped brackets in names: `[@David\[TF\]](mention://agent/id)` → `@David[TF]`
* - Issue mentions (no @): `[MUL-123](mention://issue/id)` → `MUL-123`
* - Does NOT touch regular markdown links: `[docs](https://...)` stays unchanged
* - Does NOT touch backslash-escaped mentions: `\[@Name](mention://...)` stays unchanged
*
* The regex mirrors the tokenizer in mention-extension.ts.
*/
export function stripMentionMarkdown(text: string): string {
return text.replace(
/(?<![\\])\[(@?)((?:\\.|[^\]])+)\]\(mention:\/\/\w+\/[^)]+\)/g,
(_, prefix: string, rawLabel: string) => {
const label = rawLabel.replace(/\\\[/g, "[").replace(/\\\]/g, "]");
return `${prefix}${label}`;
},
);
}