dingtalk-pingo 0.1.0 → 0.2.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/README.md +102 -13
- package/dist/pingo.js +948 -48
- package/package.json +1 -1
- package/skills/pingo/SKILL.md +45 -10
- package/skills/pingo-follow/SKILL.md +19 -0
package/README.md
CHANGED
|
@@ -77,7 +77,11 @@ chmod 600 ~/.pingo/config.yaml
|
|
|
77
77
|
device:
|
|
78
78
|
id: work-mac
|
|
79
79
|
name: Work Mac
|
|
80
|
-
icon: "🏢"
|
|
80
|
+
icon: "🏢" # shown in Markdown/text messages
|
|
81
|
+
avatar: "https://example.com/work-mac.png" # optional, card messages only (http(s) URL)
|
|
82
|
+
|
|
83
|
+
card:
|
|
84
|
+
templateId: "<your card template id>" # optional; enables card messages (see "Card messages")
|
|
81
85
|
|
|
82
86
|
dingtalk:
|
|
83
87
|
clientId: <your AppKey>
|
|
@@ -87,7 +91,7 @@ dingtalk:
|
|
|
87
91
|
|
|
88
92
|
message:
|
|
89
93
|
defaultType: info
|
|
90
|
-
preferredFormat:
|
|
94
|
+
preferredFormat: card # card | markdown | text (default: card if card.templateId is set, else markdown)
|
|
91
95
|
fallbackFormat: text
|
|
92
96
|
timeoutMs: 10000
|
|
93
97
|
|
|
@@ -99,7 +103,8 @@ templates: # optional: override the built-in templates
|
|
|
99
103
|
Credentials can also come from environment variables, which take
|
|
100
104
|
precedence over the file: `DINGTALK_CLIENT_ID`, `DINGTALK_CLIENT_SECRET`,
|
|
101
105
|
`DINGTALK_ROBOT_CODE`, `DINGTALK_USER_ID`, plus `PINGO_DEVICE_ID`,
|
|
102
|
-
`PINGO_DEVICE_NAME`, `PINGO_DEVICE_ICON` for device
|
|
106
|
+
`PINGO_DEVICE_NAME`, `PINGO_DEVICE_ICON`, `PINGO_DEVICE_AVATAR` for device
|
|
107
|
+
identity and `PINGO_CARD_TEMPLATE_ID` for the card template. This is
|
|
103
108
|
useful in CI or containers where you don't want a config file at all.
|
|
104
109
|
|
|
105
110
|
If you run multiple machines against the same robot (e.g. a work laptop
|
|
@@ -124,10 +129,90 @@ pingo send --type warning --action-required --message "Please review the token p
|
|
|
124
129
|
pingo send --markdown ./report.md --type success # body from a Markdown file
|
|
125
130
|
pingo send --message "preview this" --dry-run # preview only, no credentials needed
|
|
126
131
|
pingo send --message "x" --json # machine-readable output
|
|
132
|
+
|
|
133
|
+
pingo send --title "Checkout page" --message "After the fix" --image ./shot.png
|
|
134
|
+
pingo send --message "Repro recording" --video ./repro.mp4
|
|
135
|
+
pingo send --message "PR is ready" --link "Open PR=https://github.com/org/repo/pull/1"
|
|
136
|
+
pingo update <cardId> --type success --title "Tests passing" --message "195/195"
|
|
127
137
|
```
|
|
128
138
|
|
|
129
139
|
Run `pingo --help` for the full option list.
|
|
130
140
|
|
|
141
|
+
## Card messages
|
|
142
|
+
|
|
143
|
+
With a card template configured, every message is a DingTalk card whose
|
|
144
|
+
header shows the sender — the machine's avatar and name, plus the agent and
|
|
145
|
+
project — so messages from several machines sharing one robot are easy to
|
|
146
|
+
tell apart. Below the header come the title, the Markdown body, any images
|
|
147
|
+
and optional link buttons.
|
|
148
|
+
|
|
149
|
+
To enable cards:
|
|
150
|
+
|
|
151
|
+
1. Grant your app the **`Card.Instance.Write`** permission in the DingTalk
|
|
152
|
+
developer console.
|
|
153
|
+
2. Create a message card template in the card editor at
|
|
154
|
+
<https://open-dev.dingtalk.com/fe/card>, linked to your app. There is no
|
|
155
|
+
public API for creating templates; it is done in the web editor. Lay it out
|
|
156
|
+
as "avatar + sender name" on the first row, the title below, then a
|
|
157
|
+
Markdown/rich-text block and a button group. Bind these variables (names and
|
|
158
|
+
types must match exactly):
|
|
159
|
+
|
|
160
|
+
- `avatar` — plain text (image URL)
|
|
161
|
+
- `senderName` — plain text
|
|
162
|
+
- `title` — plain text
|
|
163
|
+
- `content` — rich text (Markdown)
|
|
164
|
+
- `btns` — button group
|
|
165
|
+
- optional: `date` — plain text (shown when `--date` is used)
|
|
166
|
+
- optional: `chart` — chart variable (shown when `--chart` is used)
|
|
167
|
+
|
|
168
|
+
3. Publish the template, then set `card.templateId` (and optionally
|
|
169
|
+
`device.avatar`) in `~/.pingo/config.yaml`.
|
|
170
|
+
|
|
171
|
+
Card-only options:
|
|
172
|
+
|
|
173
|
+
- `--date "<text>"` fills the `date` variable (Pingo does not format it).
|
|
174
|
+
- `--chart <file.json>` fills the `chart` variable. The file holds a chart
|
|
175
|
+
object: `type` is `lineChart`, `histogram` or `pieChart`, `data` is a
|
|
176
|
+
non-empty array, `config` is optional. See DingTalk's
|
|
177
|
+
[chart variable](https://open.dingtalk.com/document/isvapp/chart-variable)
|
|
178
|
+
protocol. Example: `{"type":"lineChart","data":[{"x":"N0","type":"line","y":48}]}`.
|
|
179
|
+
- Both are rejected with `--format markdown|text`, and both work with
|
|
180
|
+
`pingo update`.
|
|
181
|
+
- Tables: put a Markdown table in `--message`/`--markdown`. It renders only if
|
|
182
|
+
the template's `content` component uses DingTalk's newer Markdown variable;
|
|
183
|
+
the older one has no table support.
|
|
184
|
+
|
|
185
|
+
Templates belong to your own DingTalk app; Pingo does not ship one. If the
|
|
186
|
+
card is rejected (wrong template ID, missing permission), Pingo falls back to
|
|
187
|
+
a Markdown message and says why in its output. Timeouts are never retried or
|
|
188
|
+
downgraded, to avoid duplicate messages.
|
|
189
|
+
|
|
190
|
+
`pingo send --json` returns a `cardId` for card messages. `pingo update
|
|
191
|
+
<cardId>` changes that card in place: `--type`/`--title` regenerate the title;
|
|
192
|
+
`--message`/`--markdown`/`--image`/`--action-required` replace the whole body
|
|
193
|
+
(pass the full text); `--agent`/`--project` update the sender line; `--link`
|
|
194
|
+
replaces the buttons. Unspecified fields are left as they were. An update never
|
|
195
|
+
falls back to sending a new message.
|
|
196
|
+
|
|
197
|
+
## Sending images and videos
|
|
198
|
+
|
|
199
|
+
- `--image <file>`: png, jpg, gif or bmp; up to 5 per message, 10 MiB each;
|
|
200
|
+
the file content must match the extension. In a card, images appear inside
|
|
201
|
+
the card; in Markdown/text messages they follow as separate image messages.
|
|
202
|
+
- `--video <file.mp4>`: one mp4 per message, up to 19 MiB (DingTalk's upload
|
|
203
|
+
limit is just under 20 MiB). It is sent as a separate video message right
|
|
204
|
+
after the main message. The duration is read from the mp4 itself.
|
|
205
|
+
- `--cover <image>`: video cover. Without it, Pingo grabs a frame with `ffmpeg`
|
|
206
|
+
if it is installed (optional, not a dependency); otherwise it generates a
|
|
207
|
+
plain gradient cover whose colour is derived from `device.id`.
|
|
208
|
+
- `--image` / `--video` always come with `--message` or `--markdown`.
|
|
209
|
+
- Files are uploaded to DingTalk's media service before anything is sent; if an
|
|
210
|
+
upload fails, nothing is sent. If a later part of a multi-part send fails,
|
|
211
|
+
the output lists what was and was not delivered, and nothing is resent.
|
|
212
|
+
|
|
213
|
+
Screenshots and screen recordings can capture more than intended — check them
|
|
214
|
+
for secrets or private data before sending.
|
|
215
|
+
|
|
131
216
|
## AI agent skills
|
|
132
217
|
|
|
133
218
|
The package ships two [Agent Skills](https://developers.openai.com/codex/skills/create-skill)
|
|
@@ -205,13 +290,12 @@ updated `dist/pingo.js` — `npm run check:dist` verifies they match, and
|
|
|
205
290
|
|
|
206
291
|
## Status
|
|
207
292
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
Image/screenshot sending is not implemented yet.
|
|
293
|
+
Version 0.2 adds card messages, in-place card updates, images, mp4 videos and
|
|
294
|
+
link buttons. Text/Markdown sending, cards, card updates, image upload and
|
|
295
|
+
sending, and video sending were each verified against a live DingTalk robot;
|
|
296
|
+
everything is covered by unit tests. How reliably each AI tool follows
|
|
297
|
+
`pingo-follow` has not been verified end to end yet (see below). File
|
|
298
|
+
attachments are not supported.
|
|
215
299
|
|
|
216
300
|
## Known limitations
|
|
217
301
|
|
|
@@ -242,6 +326,11 @@ Image/screenshot sending is not implemented yet.
|
|
|
242
326
|
globally installed package. After changing Node version or moving the
|
|
243
327
|
global `node_modules` directory, re-run `pingo skills install` to
|
|
244
328
|
repair them.
|
|
245
|
-
- **
|
|
246
|
-
|
|
247
|
-
|
|
329
|
+
- **Cards and notifications.** Whether updating a card in place re-notifies
|
|
330
|
+
the phone, and what the chat list shows as the preview of a card message,
|
|
331
|
+
are not yet verified; `pingo-follow` therefore sends approval requests and
|
|
332
|
+
final reports as new messages.
|
|
333
|
+
- **Card body limit.** The card body uses the same conservative 8000-byte local
|
|
334
|
+
limit as Markdown; DingTalk's real limit for cards has not been measured.
|
|
335
|
+
- **Videos.** Only mp4 has been tested. Videos are never embedded in cards.
|
|
336
|
+
- **No file attachments** yet.
|