create-theokit 1.16.1 → 1.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { homedir } from 'node:os'
|
|
2
|
+
|
|
1
3
|
import { Box, Text, useApp, useInput } from 'ink'
|
|
2
4
|
import { type ReactElement, useState } from 'react'
|
|
3
5
|
import {
|
|
@@ -15,7 +17,6 @@ import {
|
|
|
15
17
|
readTurnUsage,
|
|
16
18
|
TheoTUIProvider,
|
|
17
19
|
useTurnElapsed,
|
|
18
|
-
WelcomeBanner,
|
|
19
20
|
type UIMessageLike,
|
|
20
21
|
} from '@theokit/tui'
|
|
21
22
|
import { InProcessTransport, useAgent } from 'theokit/client'
|
|
@@ -26,9 +27,14 @@ import { AGENT } from '../shared/agent.js'
|
|
|
26
27
|
|
|
27
28
|
/** Shown in the status bar (from `shared/agent.ts`). */
|
|
28
29
|
const MODEL = AGENT.model
|
|
29
|
-
|
|
30
|
+
/** cwd with the home dir tildeified (`~/…`), so the banner line stays short. */
|
|
31
|
+
const CWD = process.cwd().replace(homedir(), '~')
|
|
30
32
|
/** Claude Code's warm accent (truecolor; degrades gracefully on 256-color terminals). */
|
|
31
33
|
const ACCENT = '#d97757'
|
|
34
|
+
/** A little pixel mascot for the welcome box (single-width block glyphs — renders everywhere). */
|
|
35
|
+
const MASCOT = ['▛▀▜', '▌••▐', '▙▄▟'].join('\n')
|
|
36
|
+
/** Below this column count the welcome box collapses to a single column (the two-column aside needs room). */
|
|
37
|
+
const WIDE_COLS = 90
|
|
32
38
|
/** Whimsical status words cycled while the agent thinks (Claude Code idiom — the ✻ spinner rotates these). */
|
|
33
39
|
const THINKING_PHRASES = [
|
|
34
40
|
'Thinking',
|
|
@@ -68,6 +74,53 @@ const transport = new InProcessTransport({
|
|
|
68
74
|
run: (input) => streamAgentTurnInProcess(chatAgent, apiKey(), input),
|
|
69
75
|
})
|
|
70
76
|
|
|
77
|
+
/** The app name — `{{name}}` is substituted at scaffold time. */
|
|
78
|
+
const APP_NAME = '{{name}}'
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* The Claude-Code welcome box: a rounded accent border. On a wide terminal it lays out two columns —
|
|
82
|
+
* left is the `✻` header + a little pixel mascot + the model + cwd; right is the getting-started tips +
|
|
83
|
+
* what's new. Below `WIDE_COLS` it collapses to a single column so nothing truncates.
|
|
84
|
+
*/
|
|
85
|
+
function Banner(): ReactElement {
|
|
86
|
+
const cols = process.stdout.columns ?? 80
|
|
87
|
+
const wide = cols >= WIDE_COLS
|
|
88
|
+
return (
|
|
89
|
+
<Box
|
|
90
|
+
borderStyle="round"
|
|
91
|
+
borderColor={ACCENT}
|
|
92
|
+
paddingX={1}
|
|
93
|
+
flexDirection="row"
|
|
94
|
+
width={wide ? Math.min(cols - 2, 96) : undefined}
|
|
95
|
+
>
|
|
96
|
+
<Box flexDirection="column" flexGrow={1}>
|
|
97
|
+
<Text color={ACCENT} bold>
|
|
98
|
+
✻ Welcome to {APP_NAME}
|
|
99
|
+
</Text>
|
|
100
|
+
<Text color={ACCENT}>{MASCOT}</Text>
|
|
101
|
+
<Text dimColor>{MODEL}</Text>
|
|
102
|
+
<Text dimColor wrap="truncate-start">
|
|
103
|
+
cwd: {CWD}
|
|
104
|
+
</Text>
|
|
105
|
+
</Box>
|
|
106
|
+
{wide ? (
|
|
107
|
+
<Box flexDirection="column" flexShrink={0} marginLeft={2}>
|
|
108
|
+
<Text color={ACCENT} bold>
|
|
109
|
+
Tips for getting started
|
|
110
|
+
</Text>
|
|
111
|
+
<Text dimColor>Ask me anything — I stream a reply</Text>
|
|
112
|
+
<Text dimColor>/help · @ mention a file · esc interrupts</Text>
|
|
113
|
+
<Text> </Text>
|
|
114
|
+
<Text color={ACCENT} bold>
|
|
115
|
+
What's new
|
|
116
|
+
</Text>
|
|
117
|
+
<Text dimColor>Human-in-the-loop approvals · live token usage</Text>
|
|
118
|
+
</Box>
|
|
119
|
+
) : null}
|
|
120
|
+
</Box>
|
|
121
|
+
)
|
|
122
|
+
}
|
|
123
|
+
|
|
71
124
|
export function App(): ReactElement {
|
|
72
125
|
const agent = useAgent<{ message: string }>(transport)
|
|
73
126
|
const streaming = agent.status === 'streaming'
|
|
@@ -146,12 +199,7 @@ export function App(): ReactElement {
|
|
|
146
199
|
choice bar) so they receive keys under plain Ink — the ChatComposer keeps using Ink's own hooks. */}
|
|
147
200
|
<InkInputProvider>
|
|
148
201
|
<Box flexDirection="column">
|
|
149
|
-
<
|
|
150
|
-
name="✻ Welcome to {{name}}"
|
|
151
|
-
hints={['/help for help · /clear to reset', 'Enter sends · @ mentions a file · esc interrupts']}
|
|
152
|
-
>
|
|
153
|
-
<Text dimColor>cwd: {CWD}</Text>
|
|
154
|
-
</WelcomeBanner>
|
|
202
|
+
<Banner />
|
|
155
203
|
|
|
156
204
|
<AgentTimeline events={events} />
|
|
157
205
|
|