@kgdiff/cli 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +198 -2
- package/dist/apply-command.d.ts +34 -0
- package/dist/apply-command.d.ts.map +1 -0
- package/dist/apply-command.js +135 -0
- package/dist/apply-command.js.map +1 -0
- package/dist/args.d.ts +96 -0
- package/dist/args.d.ts.map +1 -0
- package/dist/args.js +463 -0
- package/dist/args.js.map +1 -0
- package/dist/bin.d.ts +3 -0
- package/dist/bin.d.ts.map +1 -0
- package/dist/bin.js +17 -0
- package/dist/bin.js.map +1 -0
- package/dist/diff-command.d.ts +29 -0
- package/dist/diff-command.d.ts.map +1 -0
- package/dist/diff-command.js +236 -0
- package/dist/diff-command.js.map +1 -0
- package/dist/errors.d.ts +48 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +92 -0
- package/dist/errors.js.map +1 -0
- package/dist/help.d.ts +11 -0
- package/dist/help.d.ts.map +1 -0
- package/dist/help.js +247 -0
- package/dist/help.js.map +1 -0
- package/dist/html.d.ts +53 -0
- package/dist/html.d.ts.map +1 -0
- package/dist/html.js +107 -0
- package/dist/html.js.map +1 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +24 -0
- package/dist/index.js.map +1 -0
- package/dist/inputs.d.ts +54 -0
- package/dist/inputs.d.ts.map +1 -0
- package/dist/inputs.js +204 -0
- package/dist/inputs.js.map +1 -0
- package/dist/io.d.ts +64 -0
- package/dist/io.d.ts.map +1 -0
- package/dist/io.js +2 -0
- package/dist/io.js.map +1 -0
- package/dist/locale.d.ts +58 -0
- package/dist/locale.d.ts.map +1 -0
- package/dist/locale.js +121 -0
- package/dist/locale.js.map +1 -0
- package/dist/main.d.ts +10 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/main.js +51 -0
- package/dist/main.js.map +1 -0
- package/dist/markdown.d.ts +30 -0
- package/dist/markdown.d.ts.map +1 -0
- package/dist/markdown.js +93 -0
- package/dist/markdown.js.map +1 -0
- package/dist/model.d.ts +63 -0
- package/dist/model.d.ts.map +1 -0
- package/dist/model.js +151 -0
- package/dist/model.js.map +1 -0
- package/dist/node-io.d.ts +12 -0
- package/dist/node-io.d.ts.map +1 -0
- package/dist/node-io.js +135 -0
- package/dist/node-io.js.map +1 -0
- package/dist/output.d.ts +27 -0
- package/dist/output.d.ts.map +1 -0
- package/dist/output.js +50 -0
- package/dist/output.js.map +1 -0
- package/dist/overwrite.d.ts +14 -0
- package/dist/overwrite.d.ts.map +1 -0
- package/dist/overwrite.js +55 -0
- package/dist/overwrite.js.map +1 -0
- package/dist/report.d.ts +52 -0
- package/dist/report.d.ts.map +1 -0
- package/dist/report.js +64 -0
- package/dist/report.js.map +1 -0
- package/dist/style.d.ts +46 -0
- package/dist/style.d.ts.map +1 -0
- package/dist/style.js +140 -0
- package/dist/style.js.map +1 -0
- package/dist/summary.d.ts +40 -0
- package/dist/summary.d.ts.map +1 -0
- package/dist/summary.js +352 -0
- package/dist/summary.js.map +1 -0
- package/dist/version.d.ts +6 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +19 -0
- package/dist/version.js.map +1 -0
- package/dist/width.d.ts +45 -0
- package/dist/width.d.ts.map +1 -0
- package/dist/width.js +232 -0
- package/dist/width.js.map +1 -0
- package/package.json +56 -3
- package/src/apply-command.ts +201 -0
- package/src/args.ts +605 -0
- package/src/bin.ts +22 -0
- package/src/diff-command.ts +299 -0
- package/src/errors.ts +131 -0
- package/src/help.ts +286 -0
- package/src/html.ts +145 -0
- package/src/index.ts +71 -0
- package/src/inputs.ts +264 -0
- package/src/io.ts +68 -0
- package/src/locale.ts +177 -0
- package/src/main.ts +56 -0
- package/src/markdown.ts +119 -0
- package/src/model.ts +181 -0
- package/src/node-io.ts +146 -0
- package/src/output.ts +81 -0
- package/src/overwrite.ts +75 -0
- package/src/report.ts +101 -0
- package/src/style.ts +164 -0
- package/src/summary.ts +440 -0
- package/src/version.ts +21 -0
- package/src/width.ts +222 -0
package/dist/summary.js
ADDED
|
@@ -0,0 +1,352 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Terminal outputs: the default summary (header, counters, diffstat bar, hunk list), `--stat`
|
|
3
|
+
* and `--name-status` (docs/cli.md §Terminal summary).
|
|
4
|
+
*
|
|
5
|
+
* Every line is laid out on plain text first (measured with `stringWidth`, truncated with an
|
|
6
|
+
* ellipsis) and painted last, so alignment holds with and without color and with CJK labels.
|
|
7
|
+
*/
|
|
8
|
+
import { formatHunk } from '@kgdiff/core';
|
|
9
|
+
import { formatInt, messages } from './locale.js';
|
|
10
|
+
import { apportion, COUNTER_PHASES, groupByPhase, hunkFamily, hunkGlyph, nameStatus, overview, PHASE_FAMILY, PHASE_GLYPH, } from './model.js';
|
|
11
|
+
import { padEnd, padStart, sanitize, stringWidth, truncate, wrap } from './width.js';
|
|
12
|
+
const INDENT = ' ';
|
|
13
|
+
const BRAND = 'kgdiff';
|
|
14
|
+
/** The layout never stretches beyond what it needs, nor below this width. */
|
|
15
|
+
const COMFORT_WIDTH = 72;
|
|
16
|
+
const MAX_BAR = 50;
|
|
17
|
+
const COLUMN_GAP = 3;
|
|
18
|
+
/** Narrowest title column worth keeping a family column for. */
|
|
19
|
+
const MIN_TITLE = 16;
|
|
20
|
+
/**
|
|
21
|
+
* Room kept for the summary after the family label before titles are truncated (at most a
|
|
22
|
+
* quarter of the line).
|
|
23
|
+
*/
|
|
24
|
+
const MIN_SUMMARY = 22;
|
|
25
|
+
/** `179 → 184 nodes · 351 → 353 edges` (single numbers when a count did not change). */
|
|
26
|
+
export function totalsText(diff, m) {
|
|
27
|
+
const { before, after } = diff.stats;
|
|
28
|
+
return m.totals([before.nodes, after.nodes], [before.edges, after.edges]);
|
|
29
|
+
}
|
|
30
|
+
/** Left and right text on one line, right-aligned to `width`; wraps the right part if needed. */
|
|
31
|
+
function spread(left, right, width) {
|
|
32
|
+
const gap = width - stringWidth(left.plain) - stringWidth(right.plain);
|
|
33
|
+
if (!right.plain)
|
|
34
|
+
return [left.painted];
|
|
35
|
+
if (gap >= COLUMN_GAP)
|
|
36
|
+
return [left.painted + ' '.repeat(gap) + right.painted];
|
|
37
|
+
const room = width - INDENT.length;
|
|
38
|
+
return [
|
|
39
|
+
left.painted,
|
|
40
|
+
INDENT + (stringWidth(right.plain) <= room ? right.painted : truncate(right.plain, room)),
|
|
41
|
+
];
|
|
42
|
+
}
|
|
43
|
+
function headerLines(diff, title, ctx, width) {
|
|
44
|
+
const m = messages(ctx.locale);
|
|
45
|
+
const { paint } = ctx;
|
|
46
|
+
const right = totalsText(diff, m);
|
|
47
|
+
const fixed = BRAND.length + 2;
|
|
48
|
+
const fitsBeside = width - fixed - COLUMN_GAP - stringWidth(right) >= 12;
|
|
49
|
+
const titleRoom = fitsBeside ? width - fixed - COLUMN_GAP - stringWidth(right) : width - fixed;
|
|
50
|
+
const shown = truncate(sanitize(title), titleRoom);
|
|
51
|
+
const left = {
|
|
52
|
+
plain: `${BRAND} ${shown}`,
|
|
53
|
+
painted: `${paint.bold(paint.tone('accent', BRAND))} ${paint.bold(shown)}`,
|
|
54
|
+
};
|
|
55
|
+
return spread(left, { plain: right, painted: paint.dim(right) }, width);
|
|
56
|
+
}
|
|
57
|
+
function counterItems(ov, m, paint) {
|
|
58
|
+
const items = [];
|
|
59
|
+
for (const phase of COUNTER_PHASES) {
|
|
60
|
+
const n = ov.phases[phase].hunks;
|
|
61
|
+
if (n === 0)
|
|
62
|
+
continue;
|
|
63
|
+
const count = `${PHASE_GLYPH[phase]}${formatInt(n)}`;
|
|
64
|
+
items.push({
|
|
65
|
+
plain: `${count} ${m.counter[phase]}`,
|
|
66
|
+
painted: `${paint.bold(paint.tone(PHASE_FAMILY[phase], count))} ${m.counter[phase]}`,
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
return items;
|
|
70
|
+
}
|
|
71
|
+
const COUNTER_GAP = ' ';
|
|
72
|
+
/** Counter items joined on one line, or wrapped over several lines to fit `room`. */
|
|
73
|
+
function counterLines(items, room) {
|
|
74
|
+
const lines = [];
|
|
75
|
+
for (const item of items) {
|
|
76
|
+
const line = lines[lines.length - 1];
|
|
77
|
+
const width = line ? stringWidth(line.plain.join(COUNTER_GAP)) + COUNTER_GAP.length : 0;
|
|
78
|
+
if (line && width + stringWidth(item.plain) <= room) {
|
|
79
|
+
line.plain.push(item.plain);
|
|
80
|
+
line.painted.push(item.painted);
|
|
81
|
+
}
|
|
82
|
+
else
|
|
83
|
+
lines.push({ plain: [item.plain], painted: [item.painted] });
|
|
84
|
+
}
|
|
85
|
+
return lines.map((l) => ({
|
|
86
|
+
plain: l.plain.join(COUNTER_GAP),
|
|
87
|
+
painted: l.painted.join(COUNTER_GAP),
|
|
88
|
+
}));
|
|
89
|
+
}
|
|
90
|
+
/** Proportional diffstat bar: one segment per phase, sized by changed elements. */
|
|
91
|
+
export function diffstatBar(ov, width, paint) {
|
|
92
|
+
const cells = apportion(COUNTER_PHASES.map((p) => ov.phases[p].changes), Math.min(ov.changes, Math.max(10, Math.min(MAX_BAR, width - INDENT.length * 2))));
|
|
93
|
+
return COUNTER_PHASES.map((phase, i) => {
|
|
94
|
+
const n = cells[i];
|
|
95
|
+
if (n === 0)
|
|
96
|
+
return '';
|
|
97
|
+
return paint.level === 0
|
|
98
|
+
? PHASE_GLYPH[phase].repeat(n)
|
|
99
|
+
: paint.tone(PHASE_FAMILY[phase], '█'.repeat(n));
|
|
100
|
+
}).join('');
|
|
101
|
+
}
|
|
102
|
+
function statLines(ov, ctx, width) {
|
|
103
|
+
const m = messages(ctx.locale);
|
|
104
|
+
const right = m.changes(ov.changes, ov.hunks);
|
|
105
|
+
const rows = counterLines(counterItems(ov, m, ctx.paint), width - INDENT.length);
|
|
106
|
+
const lines = rows.slice(0, -1).map((r) => INDENT + r.painted);
|
|
107
|
+
const last = rows[rows.length - 1] ?? { plain: '', painted: '' };
|
|
108
|
+
lines.push(...spread({ plain: INDENT + last.plain, painted: INDENT + last.painted }, { plain: right, painted: ctx.paint.dim(right) }, width));
|
|
109
|
+
lines.push(INDENT + diffstatBar(ov, width, ctx.paint));
|
|
110
|
+
return lines;
|
|
111
|
+
}
|
|
112
|
+
function identicalLines(diff, ctx, width) {
|
|
113
|
+
const m = messages(ctx.locale);
|
|
114
|
+
const { paint } = ctx;
|
|
115
|
+
const detail = m.identicalDetail(diff.stats.after.nodes, diff.stats.after.edges);
|
|
116
|
+
const head = `✓ ${m.identical}`;
|
|
117
|
+
const room = width - INDENT.length;
|
|
118
|
+
if (stringWidth(head) + 2 + stringWidth(detail) <= room) {
|
|
119
|
+
return [
|
|
120
|
+
`${INDENT}${paint.tone('added', '✓')} ${paint.bold(m.identical)} ${paint.dim(detail)}`,
|
|
121
|
+
];
|
|
122
|
+
}
|
|
123
|
+
return [
|
|
124
|
+
`${INDENT}${paint.tone('added', '✓')} ${paint.bold(m.identical)}`,
|
|
125
|
+
...wrap(detail, room).map((line) => INDENT + paint.dim(line)),
|
|
126
|
+
];
|
|
127
|
+
}
|
|
128
|
+
function rowsOf(diff, hunks, ctx) {
|
|
129
|
+
const m = messages(ctx.locale);
|
|
130
|
+
return hunks.map((hunk) => {
|
|
131
|
+
const { title, subtitle } = formatHunk(hunk, diff, ctx.locale);
|
|
132
|
+
return {
|
|
133
|
+
hunk,
|
|
134
|
+
glyph: hunkGlyph(hunk),
|
|
135
|
+
title: sanitize(title),
|
|
136
|
+
family: m.family[hunkFamily(hunk)],
|
|
137
|
+
subtitle: sanitize(subtitle),
|
|
138
|
+
};
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
const rightText = (row) => row.subtitle ? `${row.family} · ${row.subtitle}` : row.family;
|
|
142
|
+
/** Natural width of the hunk list (before any truncation). */
|
|
143
|
+
function listWidth(rows) {
|
|
144
|
+
let title = 0;
|
|
145
|
+
let right = 0;
|
|
146
|
+
for (const row of rows) {
|
|
147
|
+
title = Math.max(title, stringWidth(row.title));
|
|
148
|
+
right = Math.max(right, stringWidth(rightText(row)));
|
|
149
|
+
}
|
|
150
|
+
return INDENT.length + 2 + title + COLUMN_GAP + right;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Column widths for the hunk list. Titles come first: they get all the room they need as long
|
|
154
|
+
* as the family column keeps its family label plus a short summary; the summaries take the rest.
|
|
155
|
+
* Below ~40 columns the family column is dropped.
|
|
156
|
+
*/
|
|
157
|
+
function listColumns(rows, width) {
|
|
158
|
+
const room = width - INDENT.length - 2 - COLUMN_GAP;
|
|
159
|
+
let maxTitle = 0;
|
|
160
|
+
let maxRight = 0;
|
|
161
|
+
let maxFamily = 0;
|
|
162
|
+
for (const row of rows) {
|
|
163
|
+
maxTitle = Math.max(maxTitle, stringWidth(row.title));
|
|
164
|
+
maxRight = Math.max(maxRight, stringWidth(rightText(row)));
|
|
165
|
+
maxFamily = Math.max(maxFamily, stringWidth(row.family));
|
|
166
|
+
}
|
|
167
|
+
if (maxTitle + maxRight <= room)
|
|
168
|
+
return { title: maxTitle, right: maxRight };
|
|
169
|
+
if (room - maxFamily < MIN_TITLE)
|
|
170
|
+
return { title: width - INDENT.length - 2, right: 0 };
|
|
171
|
+
const minRight = Math.min(maxRight, maxFamily + Math.min(MIN_SUMMARY, Math.floor(room / 4)));
|
|
172
|
+
const title = Math.max(MIN_TITLE, Math.min(maxTitle, room - minRight));
|
|
173
|
+
return { title, right: Math.max(maxFamily, Math.min(maxRight, room - title)) };
|
|
174
|
+
}
|
|
175
|
+
function renderRow(row, cols, ctx) {
|
|
176
|
+
const { paint } = ctx;
|
|
177
|
+
const tone = hunkFamily(row.hunk);
|
|
178
|
+
const glyph = paint.tone(tone, row.glyph);
|
|
179
|
+
if (cols.right === 0)
|
|
180
|
+
return `${INDENT}${glyph} ${truncate(row.title, cols.title)}`;
|
|
181
|
+
const title = padEnd(truncate(row.title, cols.title), cols.title);
|
|
182
|
+
const familyWidth = stringWidth(row.family);
|
|
183
|
+
const restRoom = cols.right - familyWidth;
|
|
184
|
+
const rest = row.subtitle && restRoom >= 6 ? truncate(` · ${row.subtitle}`, restRoom) : '';
|
|
185
|
+
return (`${INDENT}${glyph} ${title}${' '.repeat(COLUMN_GAP)}` +
|
|
186
|
+
`${paint.tone(tone, row.family)}${paint.dim(rest)}`);
|
|
187
|
+
}
|
|
188
|
+
/** Line width for a layout whose content naturally needs `natural` columns. */
|
|
189
|
+
function layoutWidth(natural, available) {
|
|
190
|
+
return Math.min(available, Math.max(natural, COMFORT_WIDTH));
|
|
191
|
+
}
|
|
192
|
+
function headerNatural(diff, title, ctx, ov) {
|
|
193
|
+
const m = messages(ctx.locale);
|
|
194
|
+
const header = BRAND.length + 2 + stringWidth(sanitize(title)) + COLUMN_GAP;
|
|
195
|
+
const counters = INDENT.length +
|
|
196
|
+
stringWidth(counterItems(ov, m, ctx.paint)
|
|
197
|
+
.map((i) => i.plain)
|
|
198
|
+
.join(COUNTER_GAP)) +
|
|
199
|
+
COLUMN_GAP;
|
|
200
|
+
return Math.max(header + stringWidth(totalsText(diff, m)), counters + stringWidth(m.changes(ov.changes, ov.hunks)));
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* The default terminal output: header (title, node and edge totals), per-phase counters, a
|
|
204
|
+
* proportional diffstat bar, then the hunks grouped by phase with glyph, title and a family /
|
|
205
|
+
* summary column. At most `ctx.limit` hunks are listed (0 = all), then "… and N more".
|
|
206
|
+
*/
|
|
207
|
+
export function renderSummary(diff, title, ctx) {
|
|
208
|
+
const ov = overview(diff);
|
|
209
|
+
if (ov.hunks === 0) {
|
|
210
|
+
const width = layoutWidth(headerNatural(diff, title, ctx, ov), ctx.width);
|
|
211
|
+
return `${[...headerLines(diff, title, ctx, width), '', ...identicalLines(diff, ctx, width)].join('\n')}\n`;
|
|
212
|
+
}
|
|
213
|
+
const m = messages(ctx.locale);
|
|
214
|
+
const groups = groupByPhase(diff.hunks);
|
|
215
|
+
let shown = 0;
|
|
216
|
+
const budget = ctx.limit > 0 ? ctx.limit : Number.POSITIVE_INFINITY;
|
|
217
|
+
const listed = groups.map((g) => {
|
|
218
|
+
const take = g.hunks.slice(0, Math.max(0, budget - shown));
|
|
219
|
+
shown += take.length;
|
|
220
|
+
return { phase: g.phase, total: g.hunks.length, rows: rowsOf(diff, take, ctx) };
|
|
221
|
+
});
|
|
222
|
+
const allRows = listed.flatMap((g) => g.rows);
|
|
223
|
+
const width = layoutWidth(Math.max(headerNatural(diff, title, ctx, ov), listWidth(allRows)), ctx.width);
|
|
224
|
+
const cols = listColumns(allRows, width);
|
|
225
|
+
const lines = [...headerLines(diff, title, ctx, width), '', ...statLines(ov, ctx, width), ''];
|
|
226
|
+
for (const group of listed) {
|
|
227
|
+
if (group.rows.length === 0)
|
|
228
|
+
continue;
|
|
229
|
+
lines.push(`${INDENT}${ctx.paint.bold(m.phase[group.phase])} ${ctx.paint.dim(formatInt(group.total))}`);
|
|
230
|
+
for (const row of group.rows)
|
|
231
|
+
lines.push(renderRow(row, cols, ctx));
|
|
232
|
+
}
|
|
233
|
+
const hidden = ov.hunks - shown;
|
|
234
|
+
if (hidden > 0) {
|
|
235
|
+
const more = `${m.more(hidden)} · ${m.moreHint}`;
|
|
236
|
+
lines.push(INDENT + ctx.paint.dim(truncate(more, width - INDENT.length)));
|
|
237
|
+
}
|
|
238
|
+
return `${lines.join('\n')}\n`;
|
|
239
|
+
}
|
|
240
|
+
const MAX_TYPE_ROWS = 12;
|
|
241
|
+
const MAX_TYPE_NAME = 28;
|
|
242
|
+
/**
|
|
243
|
+
* `--stat`: header, counters and bar, a nodes / edges × added / removed / modified / unchanged
|
|
244
|
+
* table, and a git-style per-type breakdown (`+` added, `−` removed, `~` modified nodes).
|
|
245
|
+
*/
|
|
246
|
+
export function renderStat(diff, title, ctx) {
|
|
247
|
+
const ov = overview(diff);
|
|
248
|
+
const width = layoutWidth(headerNatural(diff, title, ctx, ov), ctx.width);
|
|
249
|
+
const lines = [...headerLines(diff, title, ctx, width), ''];
|
|
250
|
+
if (ov.hunks === 0)
|
|
251
|
+
return `${[...lines, ...identicalLines(diff, ctx, width)].join('\n')}\n`;
|
|
252
|
+
lines.push(...statLines(ov, ctx, width), '');
|
|
253
|
+
lines.push(...countsTable(diff, ctx, width), '');
|
|
254
|
+
lines.push(...typeLines(diff, ctx, width));
|
|
255
|
+
return `${lines.join('\n')}\n`;
|
|
256
|
+
}
|
|
257
|
+
/** Node / edge counts; columns are dropped from the right when the line is too narrow. */
|
|
258
|
+
function countsTable(diff, ctx, width) {
|
|
259
|
+
const m = messages(ctx.locale);
|
|
260
|
+
const { paint } = ctx;
|
|
261
|
+
const { nodes, edges } = diff.stats;
|
|
262
|
+
const all = [
|
|
263
|
+
{ label: m.table.added, key: 'added', tone: 'added' },
|
|
264
|
+
{ label: m.table.removed, key: 'removed', tone: 'removed' },
|
|
265
|
+
{ label: m.table.modified, key: 'modified', tone: 'content' },
|
|
266
|
+
{ label: m.table.unchanged, key: 'unchanged', tone: undefined },
|
|
267
|
+
];
|
|
268
|
+
const rows = [
|
|
269
|
+
{ label: m.table.nodes, counts: nodes },
|
|
270
|
+
{ label: m.table.edges, counts: edges },
|
|
271
|
+
];
|
|
272
|
+
const labelWidth = Math.max(...rows.map((r) => stringWidth(r.label)));
|
|
273
|
+
const widthOf = (c) => Math.max(stringWidth(c.label), ...rows.map((r) => formatInt(r.counts[c.key]).length));
|
|
274
|
+
const columns = [...all];
|
|
275
|
+
while (columns.length > 1 &&
|
|
276
|
+
INDENT.length + labelWidth + columns.reduce((sum, c) => sum + 2 + widthOf(c), 0) > width) {
|
|
277
|
+
columns.pop();
|
|
278
|
+
}
|
|
279
|
+
const widths = columns.map(widthOf);
|
|
280
|
+
const head = INDENT +
|
|
281
|
+
' '.repeat(labelWidth) +
|
|
282
|
+
columns.map((c, i) => ` ${padStart(c.label, widths[i])}`).join('');
|
|
283
|
+
const body = rows.map((r) => INDENT +
|
|
284
|
+
padEnd(r.label, labelWidth) +
|
|
285
|
+
columns
|
|
286
|
+
.map((c, i) => {
|
|
287
|
+
const n = r.counts[c.key];
|
|
288
|
+
const cell = padStart(formatInt(n), widths[i]);
|
|
289
|
+
return ` ${c.tone && n > 0 ? paint.tone(c.tone, cell) : cell}`;
|
|
290
|
+
})
|
|
291
|
+
.join(''));
|
|
292
|
+
return [paint.dim(head), ...body];
|
|
293
|
+
}
|
|
294
|
+
function typeLines(diff, ctx, width) {
|
|
295
|
+
const m = messages(ctx.locale);
|
|
296
|
+
const { paint } = ctx;
|
|
297
|
+
const changed = diff.stats.byType.filter((t) => t.added + t.removed + t.modified > 0);
|
|
298
|
+
if (changed.length === 0)
|
|
299
|
+
return [];
|
|
300
|
+
const shown = changed.slice(0, MAX_TYPE_ROWS);
|
|
301
|
+
const totals = shown.map((t) => t.added + t.removed + t.modified);
|
|
302
|
+
const countRoom = Math.max(...totals.map((n) => formatInt(n).length));
|
|
303
|
+
// Names give way first on narrow lines: indent, two spaces, count, space, ≥ 4 bar cells.
|
|
304
|
+
const nameRoom = Math.max(4, Math.min(MAX_TYPE_NAME, width - INDENT.length - 2 - countRoom - 1 - 4));
|
|
305
|
+
const names = shown.map((t) => truncate(sanitize(t.type) || m.untyped, nameRoom));
|
|
306
|
+
const nameWidth = Math.max(...names.map(stringWidth));
|
|
307
|
+
const countWidth = Math.max(...totals.map((n) => formatInt(n).length));
|
|
308
|
+
const maxTotal = Math.max(...totals);
|
|
309
|
+
const barRoom = Math.max(1, Math.min(30, width - INDENT.length - nameWidth - countWidth - 3));
|
|
310
|
+
const lines = [INDENT + paint.bold(m.byType)];
|
|
311
|
+
shown.forEach((t, i) => {
|
|
312
|
+
const total = totals[i];
|
|
313
|
+
const size = maxTotal <= barRoom ? total : Math.max(1, Math.round((total / maxTotal) * barRoom));
|
|
314
|
+
const [a, r, mod] = apportion([t.added, t.removed, t.modified], size);
|
|
315
|
+
const bar = paint.tone('added', '+'.repeat(a ?? 0)) +
|
|
316
|
+
paint.tone('removed', '−'.repeat(r ?? 0)) +
|
|
317
|
+
paint.tone('content', '~'.repeat(mod ?? 0));
|
|
318
|
+
lines.push(`${INDENT}${padEnd(names[i], nameWidth)} ${padStart(formatInt(total), countWidth)} ${bar}`);
|
|
319
|
+
});
|
|
320
|
+
if (changed.length > shown.length) {
|
|
321
|
+
lines.push(INDENT +
|
|
322
|
+
paint.dim(truncate(m.moreTypes(changed.length - shown.length), width - INDENT.length)));
|
|
323
|
+
}
|
|
324
|
+
return lines;
|
|
325
|
+
}
|
|
326
|
+
/**
|
|
327
|
+
* `--name-status`: one line per hunk in review order: status letter, anchor id, title.
|
|
328
|
+
* Tab-separated (scriptable) unless `aligned`, which pads the columns for a terminal.
|
|
329
|
+
*/
|
|
330
|
+
export function renderNameStatus(diff, ctx, aligned) {
|
|
331
|
+
if (diff.hunks.length === 0)
|
|
332
|
+
return '';
|
|
333
|
+
const rows = diff.hunks.map((hunk) => ({
|
|
334
|
+
hunk,
|
|
335
|
+
letter: nameStatus(hunk, diff),
|
|
336
|
+
id: sanitize(hunk.anchor),
|
|
337
|
+
title: sanitize(formatHunk(hunk, diff, ctx.locale).title),
|
|
338
|
+
}));
|
|
339
|
+
const { paint } = ctx;
|
|
340
|
+
if (!aligned) {
|
|
341
|
+
return `${rows.map((r) => `${paint.tone(hunkFamily(r.hunk), r.letter)}\t${r.id}\t${r.title}`).join('\n')}\n`;
|
|
342
|
+
}
|
|
343
|
+
const idWidth = Math.min(rows.reduce((max, r) => Math.max(max, stringWidth(r.id)), 0), Math.max(8, Math.floor(ctx.width / 3)));
|
|
344
|
+
const titleRoom = Math.max(1, ctx.width - 1 - 2 - idWidth - 2);
|
|
345
|
+
return `${rows
|
|
346
|
+
.map((r) => {
|
|
347
|
+
const id = padEnd(truncate(r.id, idWidth), idWidth);
|
|
348
|
+
return `${paint.bold(paint.tone(hunkFamily(r.hunk), r.letter))} ${paint.dim(id)} ${truncate(r.title, titleRoom)}`;
|
|
349
|
+
})
|
|
350
|
+
.join('\n')}\n`;
|
|
351
|
+
}
|
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AAC,CACvC,CAAC;IACF,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,KAAK,GAAG,CAAC,GAAG,CAAC,GAAG,OAAO,GAAG,CAAC,CAAC,CAAC;IAC/D,OAAO,GAAG,IAAI;SACX,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;QACT,MAAM,EAAE,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,CAAC;QACpD,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,EAAE,SAAS,CAAC,EAAE,CAAC;IACtH,CAAC,CAAC;SACD,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;AACpB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,wBAAgB,UAAU,IAAI,MAAM,CAYnC"}
|
package/dist/version.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
2
|
+
let cached;
|
|
3
|
+
/**
|
|
4
|
+
* The CLI version from its package.json (one directory above both `src/` and `dist/`).
|
|
5
|
+
* Read lazily and once.
|
|
6
|
+
*/
|
|
7
|
+
export function cliVersion() {
|
|
8
|
+
if (cached === undefined) {
|
|
9
|
+
try {
|
|
10
|
+
const pkg = JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8'));
|
|
11
|
+
cached = typeof pkg.version === 'string' ? pkg.version : '0.0.0';
|
|
12
|
+
}
|
|
13
|
+
catch {
|
|
14
|
+
cached = '0.0.0';
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
return cached;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=version.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,IAAI,MAA0B,CAAC;AAE/B;;;GAGG;AACH,MAAM,UAAU,UAAU;IACxB,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QACzB,IAAI,CAAC;YACH,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,GAAG,CAAC,iBAAiB,EAAE,OAAO,IAAI,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,CAEvF,CAAC;YACF,MAAM,GAAG,OAAO,GAAG,CAAC,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC;QACnE,CAAC;QAAC,MAAM,CAAC;YACP,MAAM,GAAG,OAAO,CAAC;QACnB,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/dist/width.d.ts
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Terminal display width of text (East Asian Width, combining marks, emoji) and the helpers
|
|
3
|
+
* built on it: sanitizing untrusted labels, truncating with an ellipsis and padding.
|
|
4
|
+
*
|
|
5
|
+
* Widths follow what modern terminals render: CJK / fullwidth / emoji-presentation characters
|
|
6
|
+
* take two columns, combining marks, joiners and variation selectors none, East Asian
|
|
7
|
+
* "ambiguous" characters (`→`, `·`, `…`, box drawing) one. Measurement is per grapheme cluster
|
|
8
|
+
* (`Intl.Segmenter`), so `é` (e + U+0301), a ZWJ emoji sequence, a flag and a keycap
|
|
9
|
+
* are each measured as one unit.
|
|
10
|
+
*/
|
|
11
|
+
/** True when the code point is East Asian Wide or Fullwidth. O(log n). */
|
|
12
|
+
export declare function isWideCodePoint(cp: number): boolean;
|
|
13
|
+
/** Display width of one grapheme cluster: 0, 1 or 2 columns. */
|
|
14
|
+
export declare function graphemeWidth(grapheme: string): number;
|
|
15
|
+
/** Grapheme clusters of `text` (code points as a fallback when `Intl.Segmenter` is missing). */
|
|
16
|
+
export declare function graphemes(text: string): string[];
|
|
17
|
+
/** Display width of `text` in terminal columns. Text must not contain ANSI escape sequences. */
|
|
18
|
+
export declare function stringWidth(text: string): number;
|
|
19
|
+
/** Replace invisible and bidirectional control characters with a visible `⟨U+202E⟩`. */
|
|
20
|
+
export declare function revealInvisible(text: string): string;
|
|
21
|
+
/**
|
|
22
|
+
* Make untrusted text (labels, ids, file names, parser messages) safe to print on one
|
|
23
|
+
* terminal line: tabs and line breaks become spaces, other C0 controls (notably ESC, which
|
|
24
|
+
* could inject escape sequences or hyperlinks) become control pictures (`␛`), C1 controls
|
|
25
|
+
* U+FFFD, and invisible or bidirectional controls a visible `⟨U+202E⟩`.
|
|
26
|
+
*/
|
|
27
|
+
export declare function sanitize(text: string): string;
|
|
28
|
+
/** `sanitize` line by line, keeping line breaks (stack traces). */
|
|
29
|
+
export declare function sanitizeLines(text: string): string;
|
|
30
|
+
/**
|
|
31
|
+
* Truncate `text` to at most `max` columns, ending with `…` when something was cut. Never
|
|
32
|
+
* splits a grapheme; a wide character that does not fit is dropped whole (the result may then
|
|
33
|
+
* be one column narrower than `max`). Returns '' for `max` ≤ 0.
|
|
34
|
+
*/
|
|
35
|
+
export declare function truncate(text: string, max: number, ellipsis?: string): string;
|
|
36
|
+
/** Pad `text` with spaces on the right to `width` columns (no-op when already wider). */
|
|
37
|
+
export declare function padEnd(text: string, width: number): string;
|
|
38
|
+
/** Pad `text` with spaces on the left to `width` columns (no-op when already wider). */
|
|
39
|
+
export declare function padStart(text: string, width: number): string;
|
|
40
|
+
/**
|
|
41
|
+
* Greedy word wrap to `width` columns. Breaks at spaces; CJK text (no spaces) breaks between
|
|
42
|
+
* graphemes. Lines never exceed `width` unless a single grapheme is wider.
|
|
43
|
+
*/
|
|
44
|
+
export declare function wrap(text: string, width: number): string[];
|
|
45
|
+
//# sourceMappingURL=width.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"width.d.ts","sourceRoot":"","sources":["../src/width.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AA4BH,0EAA0E;AAC1E,wBAAgB,eAAe,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAanD;AAOD,gEAAgE;AAChE,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAgBtD;AAID,gGAAgG;AAChG,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAiBhD;AAID,gGAAgG;AAChG,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAKhD;AAcD,wFAAwF;AACxF,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAKpD;AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAU7C;AAED,mEAAmE;AACnE,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAElD;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,SAAM,GAAG,MAAM,CAc1E;AAED,yFAAyF;AACzF,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAG1D;AAED,wFAAwF;AACxF,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAG5D;AAED;;;GAGG;AACH,wBAAgB,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAgC1D"}
|