greenlitlab 0.4.1 → 0.4.2
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/CHANGELOG.md +4 -0
- package/bin/greenlit.mjs +6 -1
- package/package.json +1 -1
- package/server.json +2 -2
- package/src/welcome.mjs +99 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.4.2 (10 November 2026)
|
|
4
|
+
|
|
5
|
+
- A welcome screen: `npx greenlitlab` on its own, in a wide terminal, now shows a pixel-art signal on green and the four commands that matter. `--help` still prints the full reference, and pipes, CI, `NO_COLOR` and narrow windows get it too.
|
|
6
|
+
|
|
3
7
|
## 0.4.1 (10 November 2026)
|
|
4
8
|
|
|
5
9
|
`scan`, after running it on real projects:
|
package/bin/greenlit.mjs
CHANGED
|
@@ -54,7 +54,12 @@ try {
|
|
|
54
54
|
if (opt.version) {
|
|
55
55
|
console.log(VERSION);
|
|
56
56
|
} else if (opt.help || !positionals[0]) {
|
|
57
|
-
|
|
57
|
+
// On its own in a wide terminal, Greenlit says hello with its welcome screen; --help, pipes, CI,
|
|
58
|
+
// NO_COLOR and narrow windows get the full plain help.
|
|
59
|
+
const { welcome } = await import("../src/welcome.mjs");
|
|
60
|
+
const hello = opt.help ? "" : welcome({ version: VERSION });
|
|
61
|
+
if (hello) process.stdout.write(hello);
|
|
62
|
+
else console.log(HELP);
|
|
58
63
|
} else if (positionals[0] === "mcp") {
|
|
59
64
|
const { serve } = await import("../src/mcp.mjs");
|
|
60
65
|
await serve({ version: VERSION });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "greenlitlab",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.2",
|
|
4
4
|
"description": "Is your AI-built app safe to launch? A grade from A to F for apps built with Lovable, Bolt, v0, Replit or Emergent, with a fix prompt for every problem. Checks leaks, open data and launch basics.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
package/server.json
CHANGED
|
@@ -5,12 +5,12 @@
|
|
|
5
5
|
"description": "Grade apps built with Lovable, Bolt, v0 or Replit A to F, with a fix prompt for every problem.",
|
|
6
6
|
"websiteUrl": "https://greenlit.priberry.com",
|
|
7
7
|
"repository": { "url": "https://github.com/priberry-data/greenlitlab", "source": "github" },
|
|
8
|
-
"version": "0.4.
|
|
8
|
+
"version": "0.4.2",
|
|
9
9
|
"packages": [
|
|
10
10
|
{
|
|
11
11
|
"registryType": "npm",
|
|
12
12
|
"identifier": "greenlitlab",
|
|
13
|
-
"version": "0.4.
|
|
13
|
+
"version": "0.4.2",
|
|
14
14
|
"transport": { "type": "stdio" },
|
|
15
15
|
"packageArguments": [{ "type": "positional", "value": "mcp" }]
|
|
16
16
|
}
|
package/src/welcome.mjs
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
// The welcome screen: a signal on green beside a night road, drawn in the terminal with half-block
|
|
2
|
+
// characters, two pixels to a character cell. Shown only to a real terminal that is wide enough; never in
|
|
3
|
+
// pipes, CI, or with NO_COLOR, where the plain help is printed instead.
|
|
4
|
+
|
|
5
|
+
// --- a very small pixel painter ---------------------------------------------------------------------
|
|
6
|
+
const rgb = (hex) => [1, 3, 5].map((i) => parseInt(hex.slice(i, i + 2), 16));
|
|
7
|
+
// 24-bit colour where the terminal says it has it; otherwise the nearest of the 216 colours every terminal has.
|
|
8
|
+
const colour = (hex, layer, truecolor) => {
|
|
9
|
+
const [r, g, b] = rgb(hex);
|
|
10
|
+
if (truecolor) return `${layer};2;${r};${g};${b}`;
|
|
11
|
+
// Near-greys go to the 24-step grey ramp, so a dark grey stays grey instead of turning teal.
|
|
12
|
+
if (Math.max(r, g, b) - Math.min(r, g, b) < 24) return `${layer};5;${232 + Math.max(0, Math.min(23, Math.round(((r + g + b) / 3 - 8) / 10)))}`;
|
|
13
|
+
const q = (v) => (v < 48 ? 0 : v < 115 ? 1 : Math.min(5, Math.round((v - 35) / 40)));
|
|
14
|
+
return `${layer};5;${16 + 36 * q(r) + 6 * q(g) + q(b)}`;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export const canvas = (w, h) => Array.from({ length: h }, () => Array(w).fill("."));
|
|
18
|
+
export const blit = (c, sprite, x, y) => {
|
|
19
|
+
sprite.forEach((row, j) => [...row].forEach((ch, i) => ch !== "." && c[y + j]?.[x + i] !== undefined && (c[y + j][x + i] = ch)));
|
|
20
|
+
return c;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
// Each line of text holds two rows of pixels: the upper half-block takes the top pixel's colour as its
|
|
24
|
+
// foreground and the bottom pixel's as its background.
|
|
25
|
+
export function paint(c, palette, truecolor) {
|
|
26
|
+
const lines = [];
|
|
27
|
+
for (let y = 0; y < c.length; y += 2) {
|
|
28
|
+
let line = "";
|
|
29
|
+
for (let x = 0; x < c[0].length; x++) {
|
|
30
|
+
const top = palette[c[y][x]];
|
|
31
|
+
const bottom = palette[c[y + 1]?.[x]];
|
|
32
|
+
if (!top && !bottom) line += "\x1b[0m ";
|
|
33
|
+
else if (top && bottom) line += `\x1b[0;${colour(top, 38, truecolor)};${colour(bottom, 48, truecolor)}m▀`;
|
|
34
|
+
else if (top) line += `\x1b[0;${colour(top, 38, truecolor)}m▀`;
|
|
35
|
+
else line += `\x1b[0;${colour(bottom, 38, truecolor)}m▄`;
|
|
36
|
+
}
|
|
37
|
+
lines.push(`${line}\x1b[0m`);
|
|
38
|
+
}
|
|
39
|
+
return lines;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export const canShow = (stream, env, width) => Boolean(stream.isTTY && !env.NO_COLOR && !env.CI && env.TERM !== "dumb" && (stream.columns ?? 80) >= width);
|
|
43
|
+
|
|
44
|
+
// --- Greenlit's scene -------------------------------------------------------------------------------
|
|
45
|
+
const SIGNAL = [
|
|
46
|
+
"....eeeeee....",
|
|
47
|
+
"...ehhhhhhe...",
|
|
48
|
+
"...hhrrrrhh...",
|
|
49
|
+
"...hrrrrrrh...",
|
|
50
|
+
"...hrrrrrrh...",
|
|
51
|
+
"...hhrrrrhh...",
|
|
52
|
+
"...hhhhhhhh...",
|
|
53
|
+
"...hhaaaahh...",
|
|
54
|
+
"...haaaaaah...",
|
|
55
|
+
"...haaaaaah...",
|
|
56
|
+
"...hhaaaahh...",
|
|
57
|
+
"...hhhhhhhh...",
|
|
58
|
+
"..GhhgggghhG..",
|
|
59
|
+
".GGhgLLggghGG.",
|
|
60
|
+
".GGhgLgggghGG.",
|
|
61
|
+
"..GhhgggghhG..",
|
|
62
|
+
"...hhhhhhhh...",
|
|
63
|
+
"...ehhhhhhe...",
|
|
64
|
+
"....eeppee....",
|
|
65
|
+
"......pp......",
|
|
66
|
+
"......pp......",
|
|
67
|
+
"......pp......",
|
|
68
|
+
];
|
|
69
|
+
const PALETTE = { e: "#4a524c", h: "#262b27", r: "#5a2420", a: "#5c4716", g: "#3dff8a", L: "#d6ffe6", G: "#1a7a2e", p: "#3a403b", d: "#2f3430", m: "#6c726e", s: "#8b918d", S: "#f1f3f1" };
|
|
70
|
+
|
|
71
|
+
export function scene() {
|
|
72
|
+
const c = canvas(26, 24);
|
|
73
|
+
blit(c, SIGNAL, 1, 0);
|
|
74
|
+
// The road: a kerb line and lane dashes running away to the right.
|
|
75
|
+
for (let x = 0; x < 26; x++) c[22][x] = "d";
|
|
76
|
+
for (const x of [15, 16, 17, 21, 22]) c[23][x] = "m";
|
|
77
|
+
// A few stars, one of them bright.
|
|
78
|
+
for (const [x, y, ch] of [[18, 2, "s"], [23, 5, "S"], [16, 9, "s"], [21, 13, "s"], [24, 17, "s"], [17, 18, "s"]]) c[y][x] = ch;
|
|
79
|
+
return c;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export function welcome({ version = "", stream = process.stdout, env = process.env } = {}) {
|
|
83
|
+
if (!canShow(stream, env, 90)) return "";
|
|
84
|
+
const truecolor = /truecolor|24bit/i.test(env.COLORTERM ?? "");
|
|
85
|
+
const art = paint(scene(), PALETTE, truecolor);
|
|
86
|
+
// The words use the terminal's own text colours, so they read on a dark or a light background.
|
|
87
|
+
const off = "\x1b[0m", bold = "\x1b[1m", faint = "\x1b[2m", go = "\x1b[32m";
|
|
88
|
+
const cmd = (c, note) => `${go}$${off} ${c}${" ".repeat(Math.max(2, 34 - c.length))}${faint}${note}${off}`;
|
|
89
|
+
const text = {
|
|
90
|
+
2: `${bold}greenl${go}i${off}${bold}t${off}${version ? ` ${faint}v${version}${off}` : ""}`,
|
|
91
|
+
3: "Know it's safe before you launch.",
|
|
92
|
+
5: cmd("npx greenlitlab myapp.lovable.app", "grade your app"),
|
|
93
|
+
6: cmd("npx greenlitlab <url> --mine", "your own app, deeper"),
|
|
94
|
+
7: cmd("npx greenlitlab scan", "your project's files"),
|
|
95
|
+
8: cmd("npx greenlitlab questions", "what only you know"),
|
|
96
|
+
10: `${faint}--help for everything · greenlit.priberry.com${off}`,
|
|
97
|
+
};
|
|
98
|
+
return ["", ...art.map((line, i) => ` ${line} ${text[i] ?? ""}`.trimEnd()), ""].join("\n") + "\n";
|
|
99
|
+
}
|