MCPcopy Create free account
hub / github.com/dailydotdev/apps / restoreCommandText

Function restoreCommandText

packages/shared/src/features/interests/chat.ts:72–83  ·  view source on GitHub ↗
(
  turn: Pick<InterestTurn, 'text' | 'relationships'>,
)

Source from the content-addressed store, hash-verified

70 /@dailydev:post:([a-zA-Z0-9]+)(?::([a-zA-Z0-9]+))?/g;
71
72export const restoreCommandText = (
73 turn: Pick<InterestTurn, 'text' | 'relationships'>,
74): string => {
75 const text = turn.text ?? '';
76 return text.replace(FEEDBACK_MARKER_REGEX, (full, postId, relId) => {
77 if (!relId) {
78 return full;
79 }
80 const entry = turn.relationships?.find((rel) => rel.id === relId);
81 return entry?.url ?? `@dailydev:post:${postId}`;
82 });
83};

Callers 2

echoResolvedFunction · 0.90

Calls 1

replaceMethod · 0.80

Tested by

no test coverage detected