MCPcopy Create free account
hub / github.com/arctic-cli/interface / buildLines

Function buildLines

packages/arctic/src/cli/ui.ts:72–113  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

70 }
71
72 function buildLines() {
73 const accent = Style.TEXT_INFO_BOLD
74 const body = Style.TEXT_DIM
75 const reset = Style.TEXT_NORMAL
76
77 const rows: string[] = []
78 rows.push(`${accent}Arctic ${reset} ${body}v${Installation.VERSION}${reset}`)
79 rows.push(`${body}${ellipsize(process.cwd(), CONTENT_WIDTH)}${reset}`)
80 rows.push(`${accent}Channel${reset} ${body}${Installation.CHANNEL}${reset}`)
81 rows.push(`${accent}────────────────────────────────────────────${reset}`)
82 rows.push(`${accent}Tips${reset}`)
83
84 const tips = ["Run `arctic init` to create ARCTIC.md instructions.", "Start a new session with `arctic run`."]
85
86 for (const tip of tips) {
87 wrapText(tip, CONTENT_WIDTH - 2).forEach((line, index) => {
88 const prefix = index === 0 ? "• " : " "
89 rows.push(`${body}${prefix}${line}${reset}`)
90 })
91 }
92
93 rows.push("")
94 rows.push(`${accent}Recent${reset}`)
95 const recentSessions = loadRecentSessions(RECENT_SESSION_LIMIT)
96 if (recentSessions.length === 0) {
97 rows.push(`${body}No recent sessions${reset}`)
98 } else {
99 for (const session of recentSessions) {
100 const title = Locale.truncate(session.title ?? session.id, 40)
101 const timestamp = session.updated ? Locale.todayTimeOrDateTime(session.updated) : "unknown"
102 const wrapped = wrapText(`${title} · ${timestamp}`, CONTENT_WIDTH - 4)
103 wrapped.forEach((line, index) => {
104 const prefix = index === 0 ? "• " : " "
105 rows.push(`${body}${prefix}${line}${reset}`)
106 })
107 }
108 }
109 rows.push(`${accent}────────────────────────────────────────────${reset}`)
110 rows.push(`${accent}Prompt${reset}`)
111 rows.push(`${body}> Ready for your next command${reset}`)
112 return rows
113 }
114
115 function padLine(value: string) {
116 const visible = stripAnsi(value)

Callers 1

logoFunction · 0.85

Calls 5

loadRecentSessionsFunction · 0.90
ellipsizeFunction · 0.85
wrapTextFunction · 0.85
pushMethod · 0.80
cwdMethod · 0.65

Tested by

no test coverage detected