blyuecode 0.1.2 → 0.1.4
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/dist/index.js +2 -2
- package/dist/ui/Banner.js +39 -12
- package/dist/ui/RocketBar.js +21 -7
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useState, useEffect } from 'react';
|
|
4
|
-
import { render, Box } from 'ink';
|
|
4
|
+
import { render, Box, Static } from 'ink';
|
|
5
5
|
import { Setup } from './ui/Setup.js';
|
|
6
6
|
import { Chat } from './ui/Chat.js';
|
|
7
7
|
import { Banner } from './ui/Banner.js';
|
|
@@ -15,6 +15,6 @@ const App = () => {
|
|
|
15
15
|
setReady(true);
|
|
16
16
|
}
|
|
17
17
|
}, []);
|
|
18
|
-
return (_jsxs(Box, { flexDirection: "column", marginTop: 1, children: [_jsx(Banner, {}), ready ? _jsx(Chat, {}) : _jsx(Setup, { onDone: () => setReady(true) })] }));
|
|
18
|
+
return (_jsxs(Box, { flexDirection: "column", marginTop: 1, children: [_jsx(Static, { items: ['banner'], children: () => _jsx(Banner, {}) }), ready ? _jsx(Chat, {}) : _jsx(Setup, { onDone: () => setReady(true) })] }));
|
|
19
19
|
};
|
|
20
20
|
render(_jsx(App, {}));
|
package/dist/ui/Banner.js
CHANGED
|
@@ -4,6 +4,7 @@ import { Box, Text, useStdout } from 'ink';
|
|
|
4
4
|
import { readFileSync } from 'fs';
|
|
5
5
|
import { fileURLToPath } from 'url';
|
|
6
6
|
import { dirname, join } from 'path';
|
|
7
|
+
import os from 'os';
|
|
7
8
|
import { hueAt } from './animColor.js';
|
|
8
9
|
import { MakerMark } from './MakerMark.js';
|
|
9
10
|
function getVersion() {
|
|
@@ -16,6 +17,25 @@ function getVersion() {
|
|
|
16
17
|
return '0.0.0';
|
|
17
18
|
}
|
|
18
19
|
}
|
|
20
|
+
// Detect low-spec hardware — disable animation entirely
|
|
21
|
+
function isLowSpec() {
|
|
22
|
+
if (process.env.BLYUE_STATIC === '1')
|
|
23
|
+
return true;
|
|
24
|
+
if (process.env.BLYUE_SLOW === '1')
|
|
25
|
+
return true;
|
|
26
|
+
try {
|
|
27
|
+
// total RAM in GB
|
|
28
|
+
const gb = os.totalmem() / 1024 / 1024 / 1024;
|
|
29
|
+
if (gb < 6)
|
|
30
|
+
return true;
|
|
31
|
+
// CPU cores — Atom usually has 2-4
|
|
32
|
+
const cores = os.cpus().length;
|
|
33
|
+
if (cores <= 4 && gb < 8)
|
|
34
|
+
return true;
|
|
35
|
+
}
|
|
36
|
+
catch { }
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
19
39
|
const BLYUE_BIG = [
|
|
20
40
|
'██████╗ ██╗ ██╗ ██╗ ██╗ ██╗ ███████╗',
|
|
21
41
|
'██╔══██╗██║ ╚██╗ ██╔╝ ██║ ██║ ██╔════╝',
|
|
@@ -31,16 +51,16 @@ const BLYUE_SMALL = [
|
|
|
31
51
|
'|___/|____|\\___/ \\___/|___|',
|
|
32
52
|
];
|
|
33
53
|
const CODE_BIG = [
|
|
34
|
-
'
|
|
35
|
-
'██╔════╝██╔═══██╗██╔══██╗██╔════╝',
|
|
36
|
-
'██║ ██║ ██║██║ ██║█████╗ ',
|
|
37
|
-
'██║ ██║ ██║██║ ██║██╔══╝ ',
|
|
38
|
-
'╚██████╗╚██████╔╝██████╔╝███████╗',
|
|
39
|
-
'
|
|
54
|
+
' ██████╗ ██████╗ ██████╗ ███████╗',
|
|
55
|
+
' ██╔════╝██╔═══██╗██╔══██╗██╔════╝',
|
|
56
|
+
' ██║ ██║ ██║██║ ██║█████╗ ',
|
|
57
|
+
' ██║ ██║ ██║██║ ██║██╔══╝ ',
|
|
58
|
+
' ╚██████╗╚██████╔╝██████╔╝███████╗',
|
|
59
|
+
' ╚═════╝ ╚═════╝ ╚═════╝ ╚══════╝',
|
|
40
60
|
];
|
|
41
61
|
const CODE_SMALL = [
|
|
42
|
-
'█▀▀ █▀█ █▀▄ █▀▀',
|
|
43
|
-
'█▄▄ █▄█ █▄▀ ██▄',
|
|
62
|
+
' █▀▀ █▀█ █▀▄ █▀▀',
|
|
63
|
+
' █▄▄ █▄█ █▄▀ ██▄',
|
|
44
64
|
];
|
|
45
65
|
export const Banner = () => {
|
|
46
66
|
const { stdout } = useStdout();
|
|
@@ -48,12 +68,19 @@ export const Banner = () => {
|
|
|
48
68
|
const wide = width >= 60;
|
|
49
69
|
const blyue = wide ? BLYUE_BIG : BLYUE_SMALL;
|
|
50
70
|
const code = wide ? CODE_BIG : CODE_SMALL;
|
|
71
|
+
const [staticMode] = useState(() => isLowSpec());
|
|
51
72
|
const [t, setT] = useState(0);
|
|
52
73
|
useEffect(() => {
|
|
53
|
-
|
|
74
|
+
if (staticMode)
|
|
75
|
+
return; // no animation on low-spec
|
|
76
|
+
const interval = setInterval(() => {
|
|
77
|
+
setT((v) => (v + 1 / 320) % 1);
|
|
78
|
+
}, 100);
|
|
54
79
|
return () => clearInterval(interval);
|
|
55
|
-
}, []);
|
|
56
|
-
|
|
80
|
+
}, [staticMode]);
|
|
81
|
+
// In static mode, use a fixed pleasant hue
|
|
82
|
+
const baseHue = staticMode ? 0.15 : t;
|
|
83
|
+
const brand = hueAt(baseHue);
|
|
57
84
|
const version = getVersion();
|
|
58
|
-
return (_jsxs(Box, { flexDirection: "column", children: [_jsx(MakerMark, { color: brand }), _jsx(Text, { children: " " }), blyue.map((line, i) => (_jsx(Text, { color: hueAt((
|
|
85
|
+
return (_jsxs(Box, { flexDirection: "column", children: [_jsx(MakerMark, { color: brand }), _jsx(Text, { children: " " }), blyue.map((line, i) => (_jsx(Text, { color: hueAt((baseHue + i * 0.06) % 1), bold: true, children: line }, 'b' + i))), code.map((line, i) => (_jsx(Text, { color: hueAt((baseHue + i * 0.06 + 0.35) % 1), bold: true, children: line }, 'c' + i))), _jsx(Text, { children: " " }), _jsx(Text, { color: "gray", children: 'a coding agent · v' + version }), _jsx(Text, { children: " " })] }));
|
|
59
86
|
};
|
package/dist/ui/RocketBar.js
CHANGED
|
@@ -3,24 +3,38 @@ import { useState, useEffect } from 'react';
|
|
|
3
3
|
import { Text } from 'ink';
|
|
4
4
|
import { theme } from './theme.js';
|
|
5
5
|
import { hueAt } from './animColor.js';
|
|
6
|
+
import os from 'os';
|
|
7
|
+
function isSlow() {
|
|
8
|
+
if (process.env.BLYUE_STATIC === '1')
|
|
9
|
+
return true;
|
|
10
|
+
try {
|
|
11
|
+
return os.totalmem() / 1024 / 1024 / 1024 < 6;
|
|
12
|
+
}
|
|
13
|
+
catch { }
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
6
16
|
export const RocketBar = ({ label, loading, width }) => {
|
|
17
|
+
const [slow] = useState(() => isSlow());
|
|
7
18
|
const [t, setT] = useState(0);
|
|
8
19
|
const [pos, setPos] = useState(0);
|
|
9
|
-
//
|
|
20
|
+
// Slower tick on low-spec machines
|
|
21
|
+
const tickMs = slow ? 200 : 50;
|
|
22
|
+
const rocketMs = slow ? 200 : 65;
|
|
10
23
|
useEffect(() => {
|
|
11
|
-
|
|
24
|
+
if (slow)
|
|
25
|
+
return; // no hue cycling on slow hardware
|
|
26
|
+
const int = setInterval(() => setT((v) => (v + 0.00625) % 1), tickMs);
|
|
12
27
|
return () => clearInterval(int);
|
|
13
|
-
}, []);
|
|
14
|
-
const fixed = 5 + label.length;
|
|
28
|
+
}, [slow, tickMs]);
|
|
29
|
+
const fixed = 5 + label.length;
|
|
15
30
|
const midLen = Math.max(0, width - fixed);
|
|
16
|
-
// Rocket position animation
|
|
17
31
|
useEffect(() => {
|
|
18
32
|
if (!loading || midLen < 6)
|
|
19
33
|
return;
|
|
20
34
|
const track = midLen - 2;
|
|
21
|
-
const int = setInterval(() => setPos((p) => (p + 1) % track),
|
|
35
|
+
const int = setInterval(() => setPos((p) => (p + 1) % track), rocketMs);
|
|
22
36
|
return () => clearInterval(int);
|
|
23
|
-
}, [loading, midLen]);
|
|
37
|
+
}, [loading, midLen, rocketMs]);
|
|
24
38
|
const hue = hueAt(t);
|
|
25
39
|
if (!loading || midLen < 6) {
|
|
26
40
|
return (_jsxs(Text, { children: [_jsx(Text, { color: theme.muted, children: '╭─ ' }), _jsx(Text, { color: loading ? hue : theme.accent, bold: true, children: label }), _jsx(Text, { color: theme.muted, children: ' ' + '─'.repeat(midLen) + '╮' })] }));
|