nonotify 0.1.11 → 0.1.12

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 ADDED
@@ -0,0 +1,185 @@
1
+ # nnt
2
+
3
+ А terminal-first notifier built with [incur](https://github.com/wevm/incur). Use it to send yourself messages from the terminal, including from coding agents and CI jobs.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install -g nonotify
9
+ ```
10
+
11
+ After installation, `nnt` is available globally.
12
+
13
+ ## Add profile
14
+
15
+ ```bash
16
+ nnt profile add
17
+ ```
18
+
19
+ Flow:
20
+
21
+ 1. Enter profile name.
22
+ 2. Enter Telegram bot token.
23
+ 3. Send any message to your bot in Telegram.
24
+ 4. CLI captures `chatId`, shows connected Telegram `username`, stores the profile, and sends a confirmation message back to chat.
25
+
26
+ The first profile becomes default profile automatically.
27
+
28
+ ## Send messages
29
+
30
+ Send with the default profile:
31
+
32
+ ```bash
33
+ nnt "Cool message using nnt"
34
+ ```
35
+
36
+ Send with a specific profile:
37
+
38
+ ```bash
39
+ nnt "some urgent message" --profile=important
40
+ ```
41
+
42
+ Typical agent usage:
43
+
44
+ ```bash
45
+ # User: Complete a long task, while I'm away, when finish notify me via nnt
46
+ # Agent: *working*
47
+ # Agent after task completed:
48
+ nnt "Very long task finished. All tests passed, check out result"
49
+ ```
50
+
51
+ ## Install skills
52
+
53
+ You can install agent skills for your agents:
54
+
55
+ ```bash
56
+ nnt skills add # install skills globally
57
+ cp ~/.agents/skills/nnt-* ./.agents/skills/ # install in current project
58
+ ```
59
+
60
+ ## Manage profiles
61
+
62
+ List profiles:
63
+
64
+ ```bash
65
+ nnt profile list
66
+ ```
67
+
68
+ Show the default profile:
69
+
70
+ ```bash
71
+ nnt profile default
72
+ ```
73
+
74
+ Set the default profile:
75
+
76
+ ```bash
77
+ nnt profile default important-profile
78
+ ```
79
+
80
+ Edit a profile (rename, token/chat update, reconnect):
81
+
82
+ ```bash
83
+ nnt profile edit
84
+ nnt profile edit important-profile
85
+ nnt profile edit important-profile --newName=critical-profile
86
+ nnt profile edit critical-profile --botToken=123:abc
87
+ nnt profile edit critical-profile --reconnect
88
+ ```
89
+
90
+ `nnt profile edit` starts interactive mode and prompts you to select a profile first.
91
+
92
+ Delete profile:
93
+
94
+ ```bash
95
+ nnt profile delete critical-profile
96
+ ```
97
+
98
+ By default, profile commands print human-readable output in terminal. For strict, machine-friendly output, use format flags:
99
+
100
+ ```bash
101
+ nnt profile list --format json
102
+ nnt profile default --format=md
103
+ ```
104
+
105
+ ## OpenCode plugin
106
+
107
+ There is also the [nonotify-opencode](https://www.npmjs.com/package/nonotify-opencode) plugin that automatically sends you important notifications via `nnt` when you use [OpenCode](https://github.com/anomalyco/opencode). Learn more [here](https://github.com/noartem/nnt/tree/main/nonotify-opencode).
108
+
109
+ ## Config location
110
+
111
+ Config is stored as JSON at `<config-dir>/nnt.json`.
112
+
113
+ - Default config dir: `~/.config/nnt`
114
+ - Default config path: `~/.config/nnt/nnt.json`
115
+ - To override it, set `NNT_CONFIG_DIR`
116
+
117
+ Example:
118
+
119
+ ```bash
120
+ export NNT_CONFIG_DIR="$HOME/.custom-config/custom-nnt"
121
+ ```
122
+
123
+ If you run coding agents in a container, mount the config directory as read-only:
124
+
125
+ ```yaml
126
+ services:
127
+ app:
128
+ environment:
129
+ - NNT_CONFIG_DIR=/var/nnt
130
+ volumes:
131
+ - ${HOME}/.config/nnt:/var/nnt:ro
132
+ ```
133
+
134
+ ## API
135
+
136
+ You can integrate `nnt` into your application. Useful when buildling extensions for coding agents. The `Notifier` automaticly loads profile information, so you can send messages easily.
137
+
138
+ ```ts
139
+ import { Notifier } from "nonotify";
140
+
141
+ const notifier = new Notifier();
142
+
143
+ await notifier.send({
144
+ message: "Build finished successfully",
145
+ });
146
+ ```
147
+
148
+ Notifier loads config using `EnvConfigLoader` by default, but you can also pass profile data directly.
149
+
150
+ ```ts
151
+ import { Notifier } from "nonotify";
152
+
153
+ const notifier = new Notifier({
154
+ defaultProfile: "dev",
155
+ profiles: [
156
+ {
157
+ name: "dev",
158
+ botToken: process.env.TELEGRAM_BOT_TOKEN!,
159
+ chatId: process.env.TELEGRAM_CHAT_ID!,
160
+ },
161
+ ],
162
+ });
163
+
164
+ await notifier.send({
165
+ profile: "dev",
166
+ message: "Task completed",
167
+ });
168
+
169
+ console.log(notifier.profiles);
170
+ ```
171
+
172
+ ## Monorepo release flow
173
+
174
+ This repository is an npm workspaces monorepo with automated releases via Changesets.
175
+
176
+ - Every user-facing package change should include a changeset:
177
+
178
+ ```bash
179
+ npx changeset
180
+ ```
181
+
182
+ - Release automation behavior:
183
+ - on `main`, GitHub Actions creates/updates a release PR with version bumps and changelogs;
184
+ - after merging that PR, Actions publishes changed packages to npm;
185
+ - Git tags and GitHub Releases are created automatically.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nonotify",
3
- "version": "0.1.11",
3
+ "version": "0.1.12",
4
4
  "description": "nnt CLI for Telegram notifications",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -18,11 +18,12 @@
18
18
  "scripts": {
19
19
  "prettier:check": "npx prettier --check \"src/**/*.ts\"",
20
20
  "prettier:fix": "npx prettier --write \"src/**/*.ts\"",
21
+ "copy:readme": "node ./scripts/copy-readme.mjs",
21
22
  "check": "npm run prettier:check",
22
23
  "fix": "npm run prettier:fix",
23
24
  "test": "npm run check",
24
25
  "build": "tsc -p tsconfig.json",
25
- "prepublishOnly": "npm run build",
26
+ "prepublishOnly": "npm run copy:readme && npm run build",
26
27
  "dev": "tsx src/cli.ts",
27
28
  "start": "node dist/cli.js"
28
29
  },
@@ -0,0 +1,11 @@
1
+ import { copyFile, mkdir } from "node:fs/promises";
2
+ import path from "node:path";
3
+ import { fileURLToPath } from "node:url";
4
+
5
+ const scriptDir = path.dirname(fileURLToPath(import.meta.url));
6
+ const packageDir = path.resolve(scriptDir, "..");
7
+ const sourceReadme = path.resolve(packageDir, "..", "README.md");
8
+ const targetReadme = path.resolve(packageDir, "README.md");
9
+
10
+ await mkdir(packageDir, { recursive: true });
11
+ await copyFile(sourceReadme, targetReadme);