blyuecode 0.1.3 → 0.1.5
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 +40 -27
- package/dist/ui/RocketBar.js +34 -8
- 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,8 +17,29 @@ function getVersion() {
|
|
|
16
17
|
return '0.0.0';
|
|
17
18
|
}
|
|
18
19
|
}
|
|
20
|
+
// Static mode = no animation. Animated mode = hue cycling.
|
|
21
|
+
function shouldAnimate() {
|
|
22
|
+
if (process.env.BLYUE_ANIMATE === '1')
|
|
23
|
+
return true;
|
|
24
|
+
if (process.env.BLYUE_STATIC === '1')
|
|
25
|
+
return false;
|
|
26
|
+
try {
|
|
27
|
+
const gb = os.totalmem() / 1024 / 1024 / 1024;
|
|
28
|
+
const cores = os.cpus().length;
|
|
29
|
+
const mhz = os.cpus()[0]?.speed || 0;
|
|
30
|
+
// Atom = ~1.6 GHz, 4GB → static
|
|
31
|
+
if (gb < 8)
|
|
32
|
+
return false;
|
|
33
|
+
if (cores < 4)
|
|
34
|
+
return false;
|
|
35
|
+
if (mhz > 0 && mhz < 2200)
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
catch { }
|
|
39
|
+
return true;
|
|
40
|
+
}
|
|
19
41
|
// ─────────────────────────────────────────────
|
|
20
|
-
// BLYUE — 44 cols wide
|
|
42
|
+
// BLYUE — 44 cols wide (all lines same length)
|
|
21
43
|
// ─────────────────────────────────────────────
|
|
22
44
|
const BLYUE_BIG = [
|
|
23
45
|
'██████╗ ██╗ ██╗ ██╗ ██╗ ██╗ ███████╗',
|
|
@@ -34,45 +56,36 @@ const BLYUE_SMALL = [
|
|
|
34
56
|
'|___/|____|\\___/ \\___/|___|',
|
|
35
57
|
];
|
|
36
58
|
// ─────────────────────────────────────────────
|
|
37
|
-
// CODE — 33 cols wide,
|
|
59
|
+
// CODE — 33 cols wide, indented 6 spaces to center under 44-wide BLYUE
|
|
38
60
|
// ─────────────────────────────────────────────
|
|
39
61
|
const CODE_BIG = [
|
|
40
|
-
'
|
|
41
|
-
'
|
|
42
|
-
'
|
|
43
|
-
'
|
|
44
|
-
'
|
|
45
|
-
'
|
|
62
|
+
' ██████╗ ██████╗ ██████╗ ███████╗',
|
|
63
|
+
' ██╔════╝██╔═══██╗██╔══██╗██╔════╝',
|
|
64
|
+
' ██║ ██║ ██║██║ ██║█████╗ ',
|
|
65
|
+
' ██║ ██║ ██║██║ ██║██╔══╝ ',
|
|
66
|
+
' ╚██████╗╚██████╔╝██████╔╝███████╗',
|
|
67
|
+
' ╚═════╝ ╚═════╝ ╚═════╝ ╚══════╝',
|
|
46
68
|
];
|
|
47
69
|
const CODE_SMALL = [
|
|
48
|
-
'
|
|
49
|
-
'
|
|
70
|
+
' █▀▀ █▀█ █▀▄ █▀▀',
|
|
71
|
+
' █▄▄ █▄█ █▄▀ ██▄',
|
|
50
72
|
];
|
|
51
|
-
export const Banner = (
|
|
73
|
+
export const Banner = () => {
|
|
52
74
|
const { stdout } = useStdout();
|
|
53
75
|
const width = stdout?.columns ?? 80;
|
|
54
76
|
const wide = width >= 60;
|
|
55
77
|
const blyue = wide ? BLYUE_BIG : BLYUE_SMALL;
|
|
56
78
|
const code = wide ? CODE_BIG : CODE_SMALL;
|
|
79
|
+
const [animate] = useState(() => shouldAnimate());
|
|
57
80
|
const [t, setT] = useState(0);
|
|
58
|
-
const [frozen, setFrozen] = useState(freezeAfter <= 0);
|
|
59
|
-
// Animation tick — 100ms = 10fps, no flicker
|
|
60
81
|
useEffect(() => {
|
|
61
|
-
if (
|
|
82
|
+
if (!animate)
|
|
62
83
|
return;
|
|
63
|
-
const interval = setInterval(() =>
|
|
64
|
-
setT((v) => (v + 1 / 320) % 1); // half-speed gradient
|
|
65
|
-
}, 100);
|
|
84
|
+
const interval = setInterval(() => setT((v) => (v + 1 / 320) % 1), 120);
|
|
66
85
|
return () => clearInterval(interval);
|
|
67
|
-
}, [
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
if (freezeAfter <= 0)
|
|
71
|
-
return;
|
|
72
|
-
const timer = setTimeout(() => setFrozen(true), freezeAfter);
|
|
73
|
-
return () => clearTimeout(timer);
|
|
74
|
-
}, [freezeAfter]);
|
|
75
|
-
const brand = hueAt(t);
|
|
86
|
+
}, [animate]);
|
|
87
|
+
const baseHue = animate ? t : 0.1;
|
|
88
|
+
const brand = hueAt(baseHue);
|
|
76
89
|
const version = getVersion();
|
|
77
|
-
return (_jsxs(Box, { flexDirection: "column", children: [_jsx(MakerMark, { color: brand }), _jsx(Text, { children: " " }), blyue.map((line, i) => (_jsx(Text, { color: hueAt((
|
|
90
|
+
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: " " })] }));
|
|
78
91
|
};
|
package/dist/ui/RocketBar.js
CHANGED
|
@@ -1,27 +1,53 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useState, useEffect } from 'react';
|
|
3
3
|
import { Text } from 'ink';
|
|
4
|
+
import os from 'os';
|
|
4
5
|
import { theme } from './theme.js';
|
|
5
6
|
import { hueAt } from './animColor.js';
|
|
7
|
+
function shouldAnimate() {
|
|
8
|
+
if (process.env.BLYUE_ANIMATE === '1')
|
|
9
|
+
return true;
|
|
10
|
+
if (process.env.BLYUE_STATIC === '1')
|
|
11
|
+
return false;
|
|
12
|
+
try {
|
|
13
|
+
const gb = os.totalmem() / 1024 / 1024 / 1024;
|
|
14
|
+
const cores = os.cpus().length;
|
|
15
|
+
const mhz = os.cpus()[0]?.speed || 0;
|
|
16
|
+
if (gb < 8)
|
|
17
|
+
return false;
|
|
18
|
+
if (cores < 4)
|
|
19
|
+
return false;
|
|
20
|
+
if (mhz > 0 && mhz < 2200)
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
catch { }
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
6
26
|
export const RocketBar = ({ label, loading, width }) => {
|
|
27
|
+
const [animate] = useState(() => shouldAnimate());
|
|
7
28
|
const [t, setT] = useState(0);
|
|
8
29
|
const [pos, setPos] = useState(0);
|
|
9
|
-
// Animated hue (matches banner)
|
|
10
30
|
useEffect(() => {
|
|
11
|
-
|
|
31
|
+
if (!animate)
|
|
32
|
+
return;
|
|
33
|
+
const int = setInterval(() => setT((v) => (v + 0.00625) % 1), 120);
|
|
12
34
|
return () => clearInterval(int);
|
|
13
|
-
}, []);
|
|
14
|
-
const fixed = 5 + label.length;
|
|
35
|
+
}, [animate]);
|
|
36
|
+
const fixed = 5 + label.length;
|
|
15
37
|
const midLen = Math.max(0, width - fixed);
|
|
16
|
-
// Rocket position animation
|
|
17
38
|
useEffect(() => {
|
|
18
39
|
if (!loading || midLen < 6)
|
|
19
40
|
return;
|
|
41
|
+
// Static mode: no rocket motion, just fixed at 1/3 position
|
|
42
|
+
if (!animate) {
|
|
43
|
+
setPos(Math.floor(midLen / 3));
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
20
46
|
const track = midLen - 2;
|
|
21
|
-
const int = setInterval(() => setPos((p) => (p + 1) % track),
|
|
47
|
+
const int = setInterval(() => setPos((p) => (p + 1) % track), 90);
|
|
22
48
|
return () => clearInterval(int);
|
|
23
|
-
}, [loading, midLen]);
|
|
24
|
-
const hue = hueAt(t);
|
|
49
|
+
}, [loading, midLen, animate]);
|
|
50
|
+
const hue = animate ? hueAt(t) : hueAt(0.1);
|
|
25
51
|
if (!loading || midLen < 6) {
|
|
26
52
|
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) + '╮' })] }));
|
|
27
53
|
}
|