blyuecode 0.1.4 → 0.1.6

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/ui/Banner.js CHANGED
@@ -1,4 +1,4 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { useState, useEffect } from 'react';
3
3
  import { Box, Text, useStdout } from 'ink';
4
4
  import { readFileSync } from 'fs';
@@ -6,7 +6,6 @@ import { fileURLToPath } from 'url';
6
6
  import { dirname, join } from 'path';
7
7
  import os from 'os';
8
8
  import { hueAt } from './animColor.js';
9
- import { MakerMark } from './MakerMark.js';
10
9
  function getVersion() {
11
10
  try {
12
11
  const here = dirname(fileURLToPath(import.meta.url));
@@ -17,24 +16,24 @@ function getVersion() {
17
16
  return '0.0.0';
18
17
  }
19
18
  }
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')
19
+ function shouldAnimate() {
20
+ if (process.env.BLYUE_ANIMATE === '1')
25
21
  return true;
22
+ if (process.env.BLYUE_STATIC === '1')
23
+ return false;
26
24
  try {
27
- // total RAM in GB
28
25
  const gb = os.totalmem() / 1024 / 1024 / 1024;
29
- if (gb < 6)
30
- return true;
31
- // CPU cores — Atom usually has 2-4
32
26
  const cores = os.cpus().length;
33
- if (cores <= 4 && gb < 8)
34
- return true;
27
+ const mhz = os.cpus()[0]?.speed || 0;
28
+ if (gb < 8)
29
+ return false;
30
+ if (cores < 4)
31
+ return false;
32
+ if (mhz > 0 && mhz < 2200)
33
+ return false;
35
34
  }
36
35
  catch { }
37
- return false;
36
+ return true;
38
37
  }
39
38
  const BLYUE_BIG = [
40
39
  '██████╗ ██╗ ██╗ ██╗ ██╗ ██╗ ███████╗',
@@ -51,36 +50,41 @@ const BLYUE_SMALL = [
51
50
  '|___/|____|\\___/ \\___/|___|',
52
51
  ];
53
52
  const CODE_BIG = [
54
- ' ██████╗ ██████╗ ██████╗ ███████╗',
55
- ' ██╔════╝██╔═══██╗██╔══██╗██╔════╝',
56
- ' ██║ ██║ ██║██║ ██║█████╗ ',
57
- ' ██║ ██║ ██║██║ ██║██╔══╝ ',
58
- ' ╚██████╗╚██████╔╝██████╔╝███████╗',
59
- ' ╚═════╝ ╚═════╝ ╚═════╝ ╚══════╝',
53
+ ' ██████╗ ██████╗ ██████╗ ███████╗',
54
+ ' ██╔════╝██╔═══██╗██╔══██╗██╔════╝',
55
+ ' ██║ ██║ ██║██║ ██║█████╗ ',
56
+ ' ██║ ██║ ██║██║ ██║██╔══╝ ',
57
+ ' ╚██████╗╚██████╔╝██████╔╝███████╗',
58
+ ' ╚═════╝ ╚═════╝ ╚═════╝ ╚══════╝',
60
59
  ];
61
60
  const CODE_SMALL = [
62
- ' █▀▀ █▀█ █▀▄ █▀▀',
63
- ' █▄▄ █▄█ █▄▀ ██▄',
61
+ ' █▀▀ █▀█ █▀▄ █▀▀',
62
+ ' █▄▄ █▄█ █▄▀ ██▄',
64
63
  ];
64
+ const BLYUE_WIDTH = 44;
65
+ const BLYUE_SMALL_WIDTH = 27;
65
66
  export const Banner = () => {
66
67
  const { stdout } = useStdout();
67
68
  const width = stdout?.columns ?? 80;
68
69
  const wide = width >= 60;
69
70
  const blyue = wide ? BLYUE_BIG : BLYUE_SMALL;
70
71
  const code = wide ? CODE_BIG : CODE_SMALL;
71
- const [staticMode] = useState(() => isLowSpec());
72
+ const blockWidth = wide ? BLYUE_WIDTH : BLYUE_SMALL_WIDTH;
73
+ // Left padding to center whole block in terminal
74
+ const leftPad = Math.max(0, Math.floor((width - blockWidth) / 2));
75
+ const pad = ' '.repeat(leftPad);
76
+ const [animate] = useState(() => shouldAnimate());
72
77
  const [t, setT] = useState(0);
73
78
  useEffect(() => {
74
- if (staticMode)
75
- return; // no animation on low-spec
76
- const interval = setInterval(() => {
77
- setT((v) => (v + 1 / 320) % 1);
78
- }, 100);
79
+ if (!animate)
80
+ return;
81
+ const interval = setInterval(() => setT((v) => (v + 1 / 320) % 1), 120);
79
82
  return () => clearInterval(interval);
80
- }, [staticMode]);
81
- // In static mode, use a fixed pleasant hue
82
- const baseHue = staticMode ? 0.15 : t;
83
+ }, [animate]);
84
+ const baseHue = animate ? t : 0.1;
83
85
  const brand = hueAt(baseHue);
84
86
  const version = getVersion();
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: " " })] }));
87
+ return (_jsxs(Box, { flexDirection: "column", children: [_jsxs(Text, { children: [pad, _jsx(MakerMarkInline, { color: brand })] }), _jsx(Text, { children: " " }), blyue.map((line, i) => (_jsx(Text, { color: hueAt((baseHue + i * 0.06) % 1), bold: true, children: pad + line }, 'b' + i))), code.map((line, i) => (_jsx(Text, { color: hueAt((baseHue + i * 0.06 + 0.35) % 1), bold: true, children: pad + line }, 'c' + i))), _jsx(Text, { children: " " }), _jsxs(Text, { children: [pad, _jsx(Text, { color: "gray", children: 'a coding agent · v' + version })] }), _jsx(Text, { children: " " })] }));
86
88
  };
89
+ // Inline version of MakerMark so it aligns inside the padded Text
90
+ const MakerMarkInline = ({ color }) => (_jsxs(_Fragment, { children: [_jsx(Text, { color: color, bold: true, children: "\u25C6 " }), _jsx(Text, { color: color, bold: true, children: "L U M E N" })] }));
@@ -1,41 +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';
6
- import os from 'os';
7
- function isSlow() {
8
- if (process.env.BLYUE_STATIC === '1')
7
+ function shouldAnimate() {
8
+ if (process.env.BLYUE_ANIMATE === '1')
9
9
  return true;
10
+ if (process.env.BLYUE_STATIC === '1')
11
+ return false;
10
12
  try {
11
- return os.totalmem() / 1024 / 1024 / 1024 < 6;
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;
12
22
  }
13
23
  catch { }
14
- return false;
24
+ return true;
15
25
  }
16
26
  export const RocketBar = ({ label, loading, width }) => {
17
- const [slow] = useState(() => isSlow());
27
+ const [animate] = useState(() => shouldAnimate());
18
28
  const [t, setT] = useState(0);
19
29
  const [pos, setPos] = useState(0);
20
- // Slower tick on low-spec machines
21
- const tickMs = slow ? 200 : 50;
22
- const rocketMs = slow ? 200 : 65;
23
30
  useEffect(() => {
24
- if (slow)
25
- return; // no hue cycling on slow hardware
26
- const int = setInterval(() => setT((v) => (v + 0.00625) % 1), tickMs);
31
+ if (!animate)
32
+ return;
33
+ const int = setInterval(() => setT((v) => (v + 0.00625) % 1), 120);
27
34
  return () => clearInterval(int);
28
- }, [slow, tickMs]);
35
+ }, [animate]);
29
36
  const fixed = 5 + label.length;
30
37
  const midLen = Math.max(0, width - fixed);
31
38
  useEffect(() => {
32
39
  if (!loading || midLen < 6)
33
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
+ }
34
46
  const track = midLen - 2;
35
- const int = setInterval(() => setPos((p) => (p + 1) % track), rocketMs);
47
+ const int = setInterval(() => setPos((p) => (p + 1) % track), 90);
36
48
  return () => clearInterval(int);
37
- }, [loading, midLen, rocketMs]);
38
- const hue = hueAt(t);
49
+ }, [loading, midLen, animate]);
50
+ const hue = animate ? hueAt(t) : hueAt(0.1);
39
51
  if (!loading || midLen < 6) {
40
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) + '╮' })] }));
41
53
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "blyuecode",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "description": "BLYUE Code — a coding agent by Lumen",
5
5
  "type": "module",
6
6
  "license": "MIT",