@mikitasazan/notify 1.4.4 → 1.4.5
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/cli-flags.js +2 -1
- package/dist/cli.js +16 -5
- package/dist/render.js +27 -14
- package/package.json +1 -1
package/dist/cli-flags.js
CHANGED
|
@@ -12,7 +12,8 @@ export const KNOWN_FLAGS = new Set([
|
|
|
12
12
|
'action', 'actor', 'assignee', 'author', 'body', 'branch', 'commit',
|
|
13
13
|
'id', 'opened', 'reason', 'workdir',
|
|
14
14
|
'command', 'command-note', 'commit-body', 'commit-title', 'commit-url', 'detail',
|
|
15
|
-
'expected', 'filename', 'item',
|
|
15
|
+
'expected', 'filename', 'item',
|
|
16
|
+
'item-group', 'job', 'key', 'last-seen', 'line', 'logs', 'note',
|
|
16
17
|
'number', 'path', 'period', 'project', 'reviewer', 'stat', 'status',
|
|
17
18
|
'target', 'title', 'url', 'via', 'workflow-name', 'workflow-url',
|
|
18
19
|
// Флаги без значения. Живут здесь же, чтобы разбор и список не разошлись.
|
package/dist/cli.js
CHANGED
|
@@ -101,11 +101,22 @@ const num = (key) => {
|
|
|
101
101
|
}
|
|
102
102
|
return n;
|
|
103
103
|
};
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
104
|
+
/**
|
|
105
|
+
* `--item "текст"` или `--item "текст|https://ссылка"`.
|
|
106
|
+
*
|
|
107
|
+
* Имя группы у позиции нельзя передать так же, как у `--stat`: черта здесь
|
|
108
|
+
* уже занята ссылкой. Поэтому `--item-group "Red checks"` — одно имя на все
|
|
109
|
+
* позиции этого вызова. Списки у отправителей однородные (красные проверки,
|
|
110
|
+
* выключенные процессы), а разнородный список — это `--json`.
|
|
111
|
+
*/
|
|
112
|
+
const items = () => {
|
|
113
|
+
const name = flags.get('item-group')?.[0];
|
|
114
|
+
return (flags.get('item') ?? []).map((raw) => {
|
|
115
|
+
const idx = raw.lastIndexOf('|');
|
|
116
|
+
const base = idx === -1 ? { text: raw } : { text: raw.slice(0, idx), url: raw.slice(idx + 1) };
|
|
117
|
+
return name ? { ...base, group: name } : base;
|
|
118
|
+
});
|
|
119
|
+
};
|
|
109
120
|
/**
|
|
110
121
|
* `--stat "label=value"`, и с 25.08.2026 — `--stat "Group | label=value"`:
|
|
111
122
|
* имя группы, вертикальная черта, ярлык. Черта выбрана потому, что её нет ни
|
package/dist/render.js
CHANGED
|
@@ -164,7 +164,11 @@ const fieldCode = (label, value) => value ? `<b>${esc(cap(label))}:</b> <code>${
|
|
|
164
164
|
*/
|
|
165
165
|
const fieldRun = (value, why) => {
|
|
166
166
|
const explain = field('To do', why);
|
|
167
|
-
|
|
167
|
+
// Без значка. `▶` был единственным символом такого рода на все двадцать
|
|
168
|
+
// видов карточек, и владелец справедливо спросил, что он значит: ничего,
|
|
169
|
+
// чего не сказала бы строка `To do:` над ним и моноширинный шрифт под ним —
|
|
170
|
+
// Telegram делает такую строку копируемой по нажатию сам.
|
|
171
|
+
return value && explain !== null ? [explain, `<code>${esc(value)}</code>`] : [];
|
|
168
172
|
};
|
|
169
173
|
/** Заголовок группы: курсив + подчёркивание, без жирности, без двоеточия. */
|
|
170
174
|
const group = (name) => `<i><u>${esc(cap(name))}</u></i>`;
|
|
@@ -391,18 +395,23 @@ const renderJob = (e) => {
|
|
|
391
395
|
const icon = iconFor(e);
|
|
392
396
|
const hasItems = (e.items ?? []).length > 0;
|
|
393
397
|
const disabledList = hasItems && e.status === 'disabled';
|
|
398
|
+
// The NAME goes on the type line, the way `Report:` and `Issue:` carry
|
|
399
|
+
// theirs. It used to sit a line below under a second label, `Task:`, and
|
|
400
|
+
// the owner asked what a task is doing on a card headed Job — nothing: they
|
|
401
|
+
// were two words for one thing, and the outcome that took the first line is
|
|
402
|
+
// already the icon, and now the third tag too.
|
|
403
|
+
//
|
|
404
|
+
// `disabled` and `silent` keep a word of their own. A red mark reads as
|
|
405
|
+
// "it broke", and neither of those is that: one was switched off on purpose
|
|
406
|
+
// and the other has not been heard from at all.
|
|
407
|
+
const state = e.status === 'disabled'
|
|
408
|
+
? 'switched off, not broken'
|
|
409
|
+
: e.status === 'silent'
|
|
410
|
+
? 'no word from it at all'
|
|
411
|
+
: undefined;
|
|
394
412
|
return join([
|
|
395
|
-
typeLine(icon, 'Job', e.
|
|
396
|
-
'',
|
|
397
|
-
// The name is NOT the type line: line 2 is `Job: fail` by the format's own
|
|
398
|
-
// rule, so the name is its own field. Called `Task:` and not `Job:` because
|
|
399
|
-
// repeating the label of the line right above it reads as a mistake.
|
|
400
|
-
// Until now the name was dropped entirely — every caller passed it and the
|
|
401
|
-
// owner only ever saw it as the small grey instance tag.
|
|
402
|
-
// The run link rides on the task's own name. It used to sit at the bottom
|
|
403
|
-
// as `Workflow: open` — every job caller passes a URL and none passes a
|
|
404
|
-
// workflow name, so that row was the bare verb the owner objected to.
|
|
405
|
-
fieldLink('Task', e.workflowUrl ?? e.url, e.job),
|
|
413
|
+
typeLine(icon, 'Job', e.job, e.workflowUrl ?? e.url),
|
|
414
|
+
field('State', state),
|
|
406
415
|
field('Reason', e.note),
|
|
407
416
|
field('Expected', e.expected),
|
|
408
417
|
// `Last run` when the task is alive, `Last seen` when it is not: the same
|
|
@@ -438,7 +447,11 @@ const renderReport = (e) => {
|
|
|
438
447
|
// уточняет вторую строку, живёт рядом с ней, а не в блоке фактов.
|
|
439
448
|
// Владелец: «период пошёл не туда, он же должен быть рядом с датой».
|
|
440
449
|
field('Period', e.period),
|
|
441
|
-
|
|
450
|
+
// Строки БЕЗ группы идут вплотную к шапке, а не отдельным куском под
|
|
451
|
+
// пустой строкой: это факты про сам отчёт — период, номер, — а не про
|
|
452
|
+
// то, о чём он. Владелец: «number отдельно и период отдельно, непонятно,
|
|
453
|
+
// куда их относить». `labelled` сам ставит пустую строку перед первой
|
|
454
|
+
// группой, поэтому её здесь больше нет.
|
|
442
455
|
...numbers,
|
|
443
456
|
body.length > 0 ? '' : null,
|
|
444
457
|
...body
|
|
@@ -451,7 +464,7 @@ const renderReport = (e) => {
|
|
|
451
464
|
typeLine(iconFor(e), 'Report', e.title, e.url),
|
|
452
465
|
// Вплотную к названию — см. соседнюю ветку.
|
|
453
466
|
field('Period', e.period),
|
|
454
|
-
|
|
467
|
+
// Вплотную к шапке — см. соседнюю ветку.
|
|
455
468
|
...labelled(e.lines),
|
|
456
469
|
items.length > 0 ? '' : null,
|
|
457
470
|
...items
|
package/package.json
CHANGED