@boy-offi9-inc/tidepull 0.7.7 → 0.7.8

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/README.md CHANGED
@@ -164,7 +164,7 @@ TIDEPULL_THEME=high-contrast tidepull URL # --theme still wins if you also
164
164
 
165
165
  A theme only decides *which* codes are emitted: `--no-color`, `NO_COLOR` and a non-TTY stderr still strip every escape sequence, so redirected output and CI logs stay plain text.
166
166
 
167
- On an interactive terminal the CLI shows a launch banner and a spinner while resolving a URL; quiet, JSON, `-g`, simulate and non-TTY modes suppress both so piped output stays data-only.
167
+ On an interactive terminal the CLI shows a launch banner while a download is queued and a spinner while resolving a URL; a bare call, `--help`, `--version`, quiet, JSON, `-g`, simulate and non-TTY modes show neither, so piped and one-off output stays data-only. The banner is a dash-border box (`⬢ tidepull vX.Y.Z` in the top border) with labeled stat rows — version, stdout policy, detected plugins.
168
168
 
169
169
  From a clone, `node src/cli.ts <args>` runs the TypeScript source directly (Node >= 22.18); `npm run build` emits JS + `.d.ts`.
170
170
 
package/dist/main.js CHANGED
@@ -181,7 +181,8 @@ export async function main(argv) {
181
181
  return 2;
182
182
  }
183
183
  const machineMode = values.quiet || values["dump-json"] || values["get-url"] || values.simulate || values["progress-json"];
184
- const showBanner = process.stdout.isTTY && !machineMode;
184
+ const interactiveStdout = process.stdout.isTTY && !machineMode && !values["list-extractors"];
185
+ let showBanner = false;
185
186
  const log = new Logger({
186
187
  quiet: values.quiet,
187
188
  verbose: values.verbose,
@@ -236,6 +237,7 @@ export async function main(argv) {
236
237
  log.error(errMsg(e));
237
238
  return e instanceof TidepullError ? e.exitCode : 1;
238
239
  }
240
+ showBanner = interactiveStdout && urls.length > 0;
239
241
  if (showBanner) {
240
242
  const pluginNames = plugins.map((p) => p.name);
241
243
  process.stderr.write(renderBanner(VERSION, theme, !values["no-color"] && shouldUseColor(), pluginNames) + "\n");
@@ -1,2 +1,5 @@
1
1
  import type { Theme } from "./theme.js";
2
+ declare function termWidth(): number;
2
3
  export declare function renderBanner(version: string, theme: Theme, color?: boolean, plugins?: string[], width?: number): string;
4
+ export declare const _visibleWidth: (s: string) => number;
5
+ export { termWidth };
package/dist/ui/banner.js CHANGED
@@ -1,94 +1,40 @@
1
- const GLYPHS = {
2
- t: ["▀█▀ ", " █ ", " ▀ "],
3
- i: ["█ ", "█ ", "▀ "],
4
- d: ["█▀▀▄ ", "█ █ ", "▀▀▀▀ "],
5
- e: ["█▀▀▀ ", "█▀▀ ", "▀▀▀▀ "],
6
- p: ["█▀▀▄ ", "█▀▀ ", "▀ ▀ "],
7
- u: ["█ █ ", "█ █ ", "▀▀▀▀ "],
8
- l: ["█ ", "█ ", "▀▀▀▀ "],
9
- };
10
- function gradientStops(theme) {
11
- switch (theme.name) {
12
- case "amber":
13
- return ["\x1b[93m", "\x1b[93m", "\x1b[33m", "\x1b[33m", "\x1b[33;1m", "\x1b[31m", "\x1b[31;1m", "\x1b[31;1m"];
14
- case "high-contrast":
15
- return ["\x1b[96;1m", "\x1b[96;1m", "\x1b[96;1m", "\x1b[97;1m", "\x1b[97;1m", "\x1b[97;1m", "\x1b[97;1m", "\x1b[97;1m"];
16
- case "tide":
17
- return ["\x1b[96m", "\x1b[96m", "\x1b[36m", "\x1b[36m", "\x1b[36m", "\x1b[92m", "\x1b[92m", "\x1b[92m"];
18
- default:
19
- return [];
20
- }
21
- }
22
- function logo() {
23
- const rows = ["", "", ""];
24
- for (const ch of "tidepull") {
25
- const g = GLYPHS[ch];
26
- for (let r = 0; r < 3; r++)
27
- rows[r] += g[r];
28
- }
29
- return rows.map((r) => r.trimEnd());
1
+ const GLYPH = "\u2b22";
2
+ const visible = (s) => s.replace(/\x1b\[[0-9;]*m/g, "").length;
3
+ function termWidth() {
4
+ return process.stdout.columns ?? 80;
30
5
  }
31
- function infoLines(version, theme, plain, plugins) {
6
+ function infoRows(version, theme, plain, plugins) {
32
7
  const dim = (s) => (plain ? s : theme.dim + s + theme.reset);
33
8
  const ok = (s) => (plain ? s : theme.success + s + theme.reset);
34
9
  const tag = (s) => (plain ? s : theme.tag + s + theme.reset);
35
- const rows = [dim("media downloader"), `${dim("version")} ${ok(`v${version}`)}`, `${dim("stdout")} ${ok("data only")}`];
36
- if (plugins.length)
37
- rows.push(`${dim("plugins")} ${tag(plugins.join(", "))}`);
10
+ const rows = [
11
+ ["media downloader", ok(`v${version}`)],
12
+ ["stdout", ok("data only")],
13
+ ];
14
+ rows.push(["plugins", plugins.length ? tag(plugins.join(", ")) : dim("none")]);
38
15
  return rows;
39
16
  }
40
- function termWidth() {
41
- return process.stdout.columns ?? 80;
42
- }
43
- const visible = (s) => s.replace(/\x1b\[[0-9;]*m/g, "").length;
44
- function chooseLayout(logoWidth, infoWidths, width) {
45
- const maxInfo = Math.max(...infoWidths);
46
- return logoWidth + 3 + maxInfo <= width - 1 ? "side" : "stack";
47
- }
48
17
  export function renderBanner(version, theme, color = true, plugins = [], width) {
49
18
  const plain = !color || !!process.env.NO_COLOR || theme.name === "mono";
50
19
  const paint = (c, s) => (plain ? s : c + s + theme.reset);
51
- const rows = logo();
52
- const logoWidth = Math.max(...rows.map((r) => r.length));
53
- const info = infoLines(version, theme, plain, plugins);
54
- const infoWidths = info.map(visible);
55
- const w = width ?? termWidth();
56
- const layout = chooseLayout(logoWidth, infoWidths, w);
57
- let painted;
58
- if (plain) {
59
- painted = rows;
60
- }
61
- else {
62
- const stops = gradientStops(theme);
63
- const starts = [0, 5, 9, 14, 19, 24, 29, 34];
64
- const widths = [5, 4, 5, 5, 5, 5, 5, 5];
65
- painted = ["", "", ""];
66
- for (let li = 0; li < 8; li++) {
67
- const c = stops[li] ?? theme.accent;
68
- for (let r = 0; r < 3; r++)
69
- painted[r] += paint(c, rows[r].slice(starts[li], starts[li] + widths[li]));
70
- }
71
- for (let r = 0; r < 3; r++)
72
- painted[r] = painted[r].trimEnd() + theme.reset;
73
- }
20
+ const accent = (s) => paint(theme.accent, s);
21
+ const dim = (s) => paint(theme.dim, s);
22
+ const w = Math.max(24, Math.min(width ?? termWidth(), 60));
23
+ const rows = infoRows(version, theme, plain, plugins);
24
+ const LABEL = Math.max(...rows.map(([k]) => k.length)) + 2;
25
+ const inner = w - 2;
74
26
  const lines = [];
75
- if (layout === "side") {
76
- const col = logoWidth + 4;
77
- for (let r = 0; r < 3; r++) {
78
- const pad = Math.max(2, col - visible(painted[r]));
79
- lines.push(painted[r] + " ".repeat(pad) + (info[r] ?? ""));
80
- }
81
- for (let r = 3; r < info.length; r++)
82
- lines.push(" ".repeat(col + 1) + info[r]);
83
- }
84
- else {
85
- lines.push(...painted);
86
- for (const row of info)
87
- lines.push(" " + row);
27
+ const title = `${GLYPH} tidepull` + (plain ? ` v${version}` : ` ${paint(theme.dim, `v${version}`)}`);
28
+ const shownTitle = visible(title) > inner - 4 ? `${GLYPH} tidepull` : title;
29
+ const dash = "\u2500";
30
+ const fill = Math.max(1, inner - visible(shownTitle) - 4);
31
+ lines.push(accent("\u250c\u2500" + " ") + shownTitle + " " + accent(" " + dash.repeat(fill) + "\u2510"));
32
+ for (const [key, value] of rows) {
33
+ const pad = Math.max(0, inner - 2 - LABEL - visible(value));
34
+ lines.push(accent("\u2502") + " " + dim(key.padEnd(LABEL)) + value + " ".repeat(pad) + " " + accent("\u2502"));
88
35
  }
89
- const tag = plain ? "" : theme.tag;
90
- const span = layout === "side" ? logoWidth + 4 + infoWidths[0] : logoWidth;
91
- const waves = Math.max(6, Math.min(30, span - 1));
92
- lines.push(paint(tag, " " + "≈".repeat(waves)));
36
+ lines.push(accent("\u2514" + dash.repeat(inner) + "\u2518"));
93
37
  return lines.join("\n");
94
38
  }
39
+ export const _visibleWidth = visible;
40
+ export { termWidth };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@boy-offi9-inc/tidepull",
3
- "version": "0.7.7",
3
+ "version": "0.7.8",
4
4
  "description": "A minimal, from-scratch media downloader library: extractor plugins, yt-dlp-style format selection, resumable downloads.",
5
5
  "type": "module",
6
6
  "license": "MIT",