@diafunc/cli 0.1.1 → 0.2.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/dist/bin/diafunc.js
CHANGED
|
@@ -1,9 +1,114 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
|
-
createProgram
|
|
4
|
-
|
|
3
|
+
createProgram,
|
|
4
|
+
package_default
|
|
5
|
+
} from "../chunk-YNIZ5WGU.js";
|
|
6
|
+
|
|
7
|
+
// src/splash.ts
|
|
8
|
+
import chalk from "chalk";
|
|
9
|
+
var MASK = [
|
|
10
|
+
row(" \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 "),
|
|
11
|
+
// 0 flat top
|
|
12
|
+
row(" \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 "),
|
|
13
|
+
// 1
|
|
14
|
+
row(" \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 "),
|
|
15
|
+
// 2
|
|
16
|
+
row("\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588"),
|
|
17
|
+
// 3 shoulder (max width)
|
|
18
|
+
row("\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588"),
|
|
19
|
+
// 4 shoulder
|
|
20
|
+
row(" \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 "),
|
|
21
|
+
// 5
|
|
22
|
+
row(" \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 "),
|
|
23
|
+
// 6
|
|
24
|
+
row(" \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 "),
|
|
25
|
+
// 7
|
|
26
|
+
row(" \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 "),
|
|
27
|
+
// 8
|
|
28
|
+
row(" \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 "),
|
|
29
|
+
// 9
|
|
30
|
+
row(" \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 "),
|
|
31
|
+
// 10
|
|
32
|
+
row(" \u2588\u2588\u2588\u2588\u2588\u2588 "),
|
|
33
|
+
// 11
|
|
34
|
+
row(" \u2588\u2588\u2588\u2588 "),
|
|
35
|
+
// 12
|
|
36
|
+
row(" \u2588\u2588 ")
|
|
37
|
+
// 13 tip
|
|
38
|
+
];
|
|
39
|
+
function row(s) {
|
|
40
|
+
return Array.from(s).map((c) => c !== " ");
|
|
41
|
+
}
|
|
42
|
+
var LIGHT = [71, 117, 184];
|
|
43
|
+
var DARK = [45, 45, 93];
|
|
44
|
+
function gradientHex(pixelRow, pixelRows) {
|
|
45
|
+
const center = (pixelRows - 1) / 2;
|
|
46
|
+
const t = Math.abs(pixelRow - center) / center;
|
|
47
|
+
const r = Math.round(DARK[0] + (LIGHT[0] - DARK[0]) * t);
|
|
48
|
+
const g = Math.round(DARK[1] + (LIGHT[1] - DARK[1]) * t);
|
|
49
|
+
const b = Math.round(DARK[2] + (LIGHT[2] - DARK[2]) * t);
|
|
50
|
+
return "#" + [r, g, b].map((v) => v.toString(16).padStart(2, "0")).join("");
|
|
51
|
+
}
|
|
52
|
+
function renderGem() {
|
|
53
|
+
const pixelRows = MASK.length;
|
|
54
|
+
const cols = MASK[0].length;
|
|
55
|
+
const charRows = pixelRows / 2;
|
|
56
|
+
const lines = [];
|
|
57
|
+
for (let c = 0; c < charRows; c++) {
|
|
58
|
+
let line = "";
|
|
59
|
+
for (let x = 0; x < cols; x++) {
|
|
60
|
+
const top = MASK[2 * c][x];
|
|
61
|
+
const bot = MASK[2 * c + 1][x];
|
|
62
|
+
const topHex = gradientHex(2 * c, pixelRows);
|
|
63
|
+
const botHex = gradientHex(2 * c + 1, pixelRows);
|
|
64
|
+
if (top && bot) {
|
|
65
|
+
line += chalk.hex(topHex).bgHex(botHex)("\u2580");
|
|
66
|
+
} else if (top) {
|
|
67
|
+
line += chalk.hex(topHex)("\u2580");
|
|
68
|
+
} else if (bot) {
|
|
69
|
+
line += chalk.hex(botHex)("\u2584");
|
|
70
|
+
} else {
|
|
71
|
+
line += " ";
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
lines.push(line);
|
|
75
|
+
}
|
|
76
|
+
return lines;
|
|
77
|
+
}
|
|
78
|
+
var WORDMARK = [
|
|
79
|
+
" ____ _ __ ",
|
|
80
|
+
"| _ \\(_) __ _ / _|_ _ _ __ ___ ",
|
|
81
|
+
"| | | | |/ _` | |_| | | | '_ \\ / __|",
|
|
82
|
+
"| |_| | | (_| | _| |_| | | | | (__ ",
|
|
83
|
+
"|____/|_|\\__,_|_| \\__,_|_| |_|\\___|"
|
|
84
|
+
];
|
|
85
|
+
var GAP = " ";
|
|
86
|
+
function showSplash() {
|
|
87
|
+
const brand = chalk.hex("#4775B8");
|
|
88
|
+
const gem = renderGem();
|
|
89
|
+
const wordmarkOffset = Math.floor((gem.length - WORDMARK.length) / 2);
|
|
90
|
+
console.log();
|
|
91
|
+
for (let i = 0; i < gem.length; i++) {
|
|
92
|
+
const w = i - wordmarkOffset;
|
|
93
|
+
const text = w >= 0 && w < WORDMARK.length ? WORDMARK[w] : "";
|
|
94
|
+
console.log(gem[i] + GAP + brand.bold(text));
|
|
95
|
+
}
|
|
96
|
+
console.log();
|
|
97
|
+
console.log(
|
|
98
|
+
" " + chalk.bold("CLI") + chalk.dim(` v${package_default.version}`) + chalk.dim(" \xB7 https://diafunc.com")
|
|
99
|
+
);
|
|
100
|
+
console.log();
|
|
101
|
+
console.log(
|
|
102
|
+
chalk.dim(" Run 'diafunc --help' for usage, or 'diafunc auth login' to get started.")
|
|
103
|
+
);
|
|
104
|
+
console.log();
|
|
105
|
+
}
|
|
5
106
|
|
|
6
107
|
// bin/diafunc.ts
|
|
108
|
+
if (process.argv.length <= 2 && process.stdout.isTTY) {
|
|
109
|
+
showSplash();
|
|
110
|
+
process.exit(0);
|
|
111
|
+
}
|
|
7
112
|
var program = createProgram();
|
|
8
113
|
program.parseAsync(process.argv);
|
|
9
114
|
//# sourceMappingURL=diafunc.js.map
|
package/dist/bin/diafunc.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../bin/diafunc.ts"],"sourcesContent":["import { createProgram } from '../src/index.js';\n\nconst program = createProgram();\nprogram.parseAsync(process.argv);\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/splash.ts","../../bin/diafunc.ts"],"sourcesContent":["import chalk from 'chalk';\nimport pkg from '../package.json' with { type: 'json' };\n\n// Diafunc gem logo rendered with a pixel mask + vertical gradient.\n//\n// The silhouette approximates app/src/assets/images/logos/icon.svg: flat top at\n// ~60% width, widening to shoulder points, tapering to a bottom tip.\n//\n// Each character cell packs two vertical pixels. By using ▀ with an independent\n// foreground (upper pixel) and background (lower pixel) color, we get 2×\n// vertical color resolution — enough for a smooth gradient across 14 pixel\n// rows in only 7 character rows. The gradient mirrors the SVG's linearGradient\n// stops: lighter at the top and bottom, darker in the middle (polished-gem\n// highlight effect).\n\n// 14 rows × 20 cols pixel mask. true = filled, false = empty.\n// Silhouette: flat top (60% wide), widening to shoulders (row 3, full width),\n// then tapering to a single-pixel tip.\nconst MASK: readonly (readonly boolean[])[] = [\n row(' ████████████ '), // 0 flat top\n row(' ██████████████ '), // 1\n row(' ██████████████████ '), // 2\n row('████████████████████'), // 3 shoulder (max width)\n row('████████████████████'), // 4 shoulder\n row(' ██████████████████ '), // 5\n row(' ████████████████ '), // 6\n row(' ██████████████ '), // 7\n row(' ████████████ '), // 8\n row(' ██████████ '), // 9\n row(' ████████ '), // 10\n row(' ██████ '), // 11\n row(' ████ '), // 12\n row(' ██ '), // 13 tip\n];\n\nfunction row(s: string): boolean[] {\n // Any non-space character counts as filled.\n return Array.from(s).map((c) => c !== ' ');\n}\n\n// Gradient endpoints: light blue from the SVG stops, dark blue in the middle.\nconst LIGHT: readonly [number, number, number] = [0x47, 0x75, 0xb8]; // #4775B8\nconst DARK: readonly [number, number, number] = [0x2d, 0x2d, 0x5d]; // #2D2D5D\n\nfunction gradientHex(pixelRow: number, pixelRows: number): string {\n // t = 0 at vertical center, 1 at top/bottom edges.\n const center = (pixelRows - 1) / 2;\n const t = Math.abs(pixelRow - center) / center;\n const r = Math.round(DARK[0] + (LIGHT[0] - DARK[0]) * t);\n const g = Math.round(DARK[1] + (LIGHT[1] - DARK[1]) * t);\n const b = Math.round(DARK[2] + (LIGHT[2] - DARK[2]) * t);\n return '#' + [r, g, b].map((v) => v.toString(16).padStart(2, '0')).join('');\n}\n\nfunction renderGem(): string[] {\n const pixelRows = MASK.length;\n const cols = MASK[0].length;\n const charRows = pixelRows / 2;\n const lines: string[] = [];\n\n for (let c = 0; c < charRows; c++) {\n let line = '';\n for (let x = 0; x < cols; x++) {\n const top = MASK[2 * c][x];\n const bot = MASK[2 * c + 1][x];\n const topHex = gradientHex(2 * c, pixelRows);\n const botHex = gradientHex(2 * c + 1, pixelRows);\n\n if (top && bot) {\n line += chalk.hex(topHex).bgHex(botHex)('▀');\n } else if (top) {\n line += chalk.hex(topHex)('▀');\n } else if (bot) {\n line += chalk.hex(botHex)('▄');\n } else {\n line += ' ';\n }\n }\n lines.push(line);\n }\n return lines;\n}\n\n// \"Diafunc\" in figlet \"standard\" font, rendered in a single brand color\n// alongside the gem (a gradient on thin text glyphs would look noisy).\nconst WORDMARK: readonly string[] = [\n ' ____ _ __ ',\n '| _ \\\\(_) __ _ / _|_ _ _ __ ___ ',\n \"| | | | |/ _` | |_| | | | '_ \\\\ / __|\",\n '| |_| | | (_| | _| |_| | | | | (__ ',\n '|____/|_|\\\\__,_|_| \\\\__,_|_| |_|\\\\___|',\n];\n\nconst GAP = ' ';\n\nexport function showSplash(): void {\n const brand = chalk.hex('#4775B8');\n const gem = renderGem();\n\n // Center the 5-row wordmark vertically against the 7-row gem.\n const wordmarkOffset = Math.floor((gem.length - WORDMARK.length) / 2);\n\n console.log();\n for (let i = 0; i < gem.length; i++) {\n const w = i - wordmarkOffset;\n const text = w >= 0 && w < WORDMARK.length ? WORDMARK[w] : '';\n console.log(gem[i] + GAP + brand.bold(text));\n }\n console.log();\n console.log(\n ' ' +\n chalk.bold('CLI') +\n chalk.dim(` v${pkg.version}`) +\n chalk.dim(' · https://diafunc.com'),\n );\n console.log();\n console.log(\n chalk.dim(\" Run 'diafunc --help' for usage, or 'diafunc auth login' to get started.\"),\n );\n console.log();\n}\n","import { createProgram } from '../src/index.js';\nimport { showSplash } from '../src/splash.js';\n\nif (process.argv.length <= 2 && process.stdout.isTTY) {\n showSplash();\n process.exit(0);\n}\n\nconst program = createProgram();\nprogram.parseAsync(process.argv);\n"],"mappings":";;;;;;AAAA,OAAO,WAAW;AAkBlB,IAAM,OAAwC;AAAA,EAC5C,IAAI,kFAAsB;AAAA;AAAA,EAC1B,IAAI,4FAAsB;AAAA;AAAA,EAC1B,IAAI,gHAAsB;AAAA;AAAA,EAC1B,IAAI,0HAAsB;AAAA;AAAA,EAC1B,IAAI,0HAAsB;AAAA;AAAA,EAC1B,IAAI,gHAAsB;AAAA;AAAA,EAC1B,IAAI,sGAAsB;AAAA;AAAA,EAC1B,IAAI,4FAAsB;AAAA;AAAA,EAC1B,IAAI,kFAAsB;AAAA;AAAA,EAC1B,IAAI,wEAAsB;AAAA;AAAA,EAC1B,IAAI,8DAAsB;AAAA;AAAA,EAC1B,IAAI,oDAAsB;AAAA;AAAA,EAC1B,IAAI,0CAAsB;AAAA;AAAA,EAC1B,IAAI,gCAAsB;AAAA;AAC5B;AAEA,S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