Files
orca/src/shared/jcode-terminal-title.ts
T
NeilandClaude 5dd5294294 perf(orcad): keep the server bundle ASCII so V8 stores it at half the size (#31495)
* perf(orcad): keep the server bundle ASCII so V8 stores it one byte per character

129 non-ASCII characters in regex literals (and three in a String.raw plugin
template) made V8 hold the whole ~11 MB orcad-server.js source as a two-byte
string. Write them as \uXXXX escapes and fail the build if any return.

Co-Authored-By: Claude <noreply@anthropic.com>

* fix(orcad): keep license comments ASCII and name the module the guard trips on

esbuild gathers legal comments at the end of the bundle; escape that comment so
a dependency's license text cannot fail the ASCII guard, while licenses still
ship with the code. The guard now reports the offset and, from an unminified
rebuild, the module the character came from. A dark-switch build is covered.

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-21 04:06:49 -07:00

22 lines
1.3 KiB
TypeScript

// jcode paints `<emoji> jcode <session-name>[ · +N -M][ · work|last ~<dur>]` about once
// a second (crates/jcode-tui/src/tui/app/terminal_title.rs). The tail is live status,
// the emoji is picked per session and swapped mid-turn, and the head is jcode's own
// name plus the codename it generates ("Puppy", "Tigress") — a label, never a
// conversation name. Captured titles are in docs/reference/jcode-hook-events.md.
const JCODE_TITLE_STATUS_RE =
/^[\p{Extended_Pictographic}\u{FE0F}\u{200D}]+\s*|\s+\u00B7\s+(?:\+\d+\s+-\d+|(?:work|last)\s+~\S+)(?=\s+\u00B7\s+|$)/gu
/** The jcode title with its per-session emoji and live diff/duration segments removed. */
export function stripJcodeTitleStatus(title: string): string {
return title.replace(JCODE_TITLE_STATUS_RE, '').trim()
}
// `jcode`, `jcode Puppy`, and `jcode/creek Puppy` (the self-dev variant) are all
// identity; anything the user could recognise as their own work has more to it.
const JCODE_IDENTITY_TITLE_RE = /^jcode(?:\/[^\s\u00B7]+)?(?:\s+[^\s\u00B7]+)?$/iu
/** True when a jcode title says only which jcode session this is, not what it is doing. */
export function isJcodeIdentityTerminalTitle(title: string | null | undefined): boolean {
return Boolean(title) && JCODE_IDENTITY_TITLE_RE.test(stripJcodeTitleStatus(title ?? ''))
}