(info: DeepLinkBannerInfo)
| 52 | * and whether its CLAUDE.md may be stale relative to upstream. |
| 53 | */ |
| 54 | export function buildDeepLinkBanner(info: DeepLinkBannerInfo): string { |
| 55 | const lines = [ |
| 56 | `This session was opened by an external deep link in ${tildify(info.cwd)}`, |
| 57 | ] |
| 58 | if (info.repo) { |
| 59 | const age = info.lastFetch ? formatRelativeTimeAgo(info.lastFetch) : 'never' |
| 60 | const stale = |
| 61 | !info.lastFetch || |
| 62 | Date.now() - info.lastFetch.getTime() > STALE_FETCH_WARN_MS |
| 63 | lines.push( |
| 64 | `Resolved ${info.repo} from local clones · last fetched ${age}${stale ? ' — CLAUDE.md may be stale' : ''}`, |
| 65 | ) |
| 66 | } |
| 67 | if (info.prefillLength) { |
| 68 | lines.push( |
| 69 | info.prefillLength > LONG_PREFILL_THRESHOLD |
| 70 | ? `The prompt below (${formatNumber(info.prefillLength)} chars) was supplied by the link — scroll to review the entire prompt before pressing Enter.` |
| 71 | : 'The prompt below was supplied by the link — review carefully before pressing Enter.', |
| 72 | ) |
| 73 | } |
| 74 | return lines.join('\n') |
| 75 | } |
| 76 | |
| 77 | /** |
| 78 | * Read the mtime of .git/FETCH_HEAD, which git updates on every fetch or |
no test coverage detected