@mikitasazan/notify 1.7.0 → 1.8.1
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 +1 -1
- package/dist/cli.js +73 -61
- package/dist/events.d.ts +142 -118
- package/dist/events.js +23 -21
- package/dist/render.d.ts +48 -45
- package/dist/render.js +233 -198
- package/dist/routes.d.ts +31 -27
- package/dist/routes.js +25 -20
- package/package.json +1 -1
package/dist/render.d.ts
CHANGED
|
@@ -1,56 +1,59 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
2
|
+
* One renderer per event type, all built on one skeleton — approved by
|
|
3
|
+
* the owner on 20.08.2026 after ~15 live rounds in the test forum:
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
5
|
+
* #type #instance
|
|
6
|
+
* icon <b>Type:</b> action
|
|
7
7
|
*
|
|
8
|
-
* <b
|
|
9
|
-
* <blockquote
|
|
8
|
+
* <b>Label:</b> value
|
|
9
|
+
* <blockquote>quoted text from someone else — commit body, task body</blockquote>
|
|
10
10
|
*
|
|
11
|
-
* <i><u
|
|
12
|
-
* <b>#N (overdue):</b> <a
|
|
11
|
+
* <i><u>Group</u></i>
|
|
12
|
+
* <b>#N (overdue):</b> <a>title</a>
|
|
13
13
|
*
|
|
14
|
-
* <b
|
|
14
|
+
* <b>Label:</b> value ← actions/directions
|
|
15
15
|
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
16
|
+
* Three levels of styling, never mixed: a field is a bold, capitalized
|
|
17
|
+
* label plus a plain value; a group is italic+underline, no bold and no
|
|
18
|
+
* colon; line 2 (the type) follows the same field rule. A blank line
|
|
19
|
+
* separates BLOCKS BY MEANING (header / body / actions), not mechanically
|
|
20
|
+
* after every line.
|
|
21
21
|
*/
|
|
22
22
|
import { type NotifyEvent } from './events.ts';
|
|
23
|
-
/**
|
|
23
|
+
/** Escapes EVERYTHING that comes from outside — only the template adds tags. */
|
|
24
24
|
export declare const esc: (v: unknown) => string;
|
|
25
25
|
/**
|
|
26
|
-
* Telegram
|
|
27
|
-
*
|
|
26
|
+
* Telegram cuts a message at 4096 characters — we cut it ourselves first,
|
|
27
|
+
* on a line boundary where possible.
|
|
28
28
|
*
|
|
29
|
-
*
|
|
30
|
-
* 1.
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
29
|
+
* Two traps, both caused a SILENT loss of the message:
|
|
30
|
+
* 1. Cutting strictly at the last `\n` does not work: if a long chunk runs
|
|
31
|
+
* as one line (a stack trace, command output — the most common `detail`
|
|
32
|
+
* on an incident), the last line break sits BEFORE it, and the whole
|
|
33
|
+
* content got dropped — only the heading arrived, with not a single
|
|
34
|
+
* fact about what broke.
|
|
35
|
+
* 2. Cutting in the middle of an HTML tag or entity does not work either:
|
|
36
|
+
* Telegram replies `400 can't parse entities`, and we treat a 4xx as a
|
|
37
|
+
* permanent error and do not retry — the message disappeared for good.
|
|
37
38
|
*/
|
|
38
39
|
export declare const clampMessage: (text: string, limit?: number) => string;
|
|
39
40
|
export declare const slug: (raw: string) => string;
|
|
40
41
|
/**
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
42
|
+
* The instance tag: exactly which concrete event this is (branch,
|
|
43
|
+
* environment, task, number) — the parser uses it to match a 🔴 against a
|
|
44
|
+
* later green card of the SAME instance. An explicit `key` always wins;
|
|
45
|
+
* without one, it is derived from the type's most stable fields (branch/
|
|
46
|
+
* environment outrank the title, because a recurring task's title does not
|
|
47
|
+
* change, while for a report the title is exactly the one stable field it
|
|
48
|
+
* has).
|
|
47
49
|
*/
|
|
48
50
|
export declare const eventKey: (e: NotifyEvent) => string;
|
|
49
51
|
/**
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
52
|
+
* The third tag is the OUTCOME, and it is always there. The owner: "I'm
|
|
53
|
+
* missing a fail tag or something like it, so failures can be grouped and
|
|
54
|
+
* ok can be grouped." One tap in Telegram collects every failure of a
|
|
55
|
+
* project at once, no matter what type it arrived as — a deploy, a check,
|
|
56
|
+
* a scheduled task, an incident.
|
|
54
57
|
*
|
|
55
58
|
* The value comes from the ICON, never from the status word. The icon is
|
|
56
59
|
* already the single source of truth for the sound, and a second list of "what
|
|
@@ -65,18 +68,18 @@ export declare const eventKey: (e: NotifyEvent) => string;
|
|
|
65
68
|
export declare const OUTCOME_TAG: Readonly<Record<string, string>>;
|
|
66
69
|
export declare const outcomeTag: (e: NotifyEvent) => string;
|
|
67
70
|
/**
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
71
|
+
* The tag line for free-form HTML (`sendReport`). The tag is the owner's
|
|
72
|
+
* FILTER, and it has nothing to do with the body's format: a daily report
|
|
73
|
+
* stays free-form text, but stops being the one card with no tags. The key
|
|
74
|
+
* used to hang off the tail as `<i><code>#key</code></i>` — that is the old
|
|
75
|
+
* format, from before tags moved to the first line.
|
|
73
76
|
*/
|
|
74
77
|
export declare const reportTags: (key: string) => string;
|
|
75
78
|
/**
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
79
|
+
* Renders an event into finished HTML text, cut to Telegram's limit.
|
|
80
|
+
* Tags are the FIRST line, added before the cut (not after, as before):
|
|
81
|
+
* they carry both the human filter and the parser's machine key — a card
|
|
82
|
+
* cut without them would be not only unclickable but invisible to the
|
|
83
|
+
* parser on exactly the longest, meaning the most important, messages.
|
|
81
84
|
*/
|
|
82
85
|
export declare const render: (e: NotifyEvent) => string;
|