feat(newsletter): report post entry tally after each URL add

This commit is contained in:
tiennm99 committed 2026-09-11 17:33:46 +07:00
1 parent edff23f0e3
commit f759f7a8ba
8 files changed
+139

No files matched your search

+2
View File
@@ -84,7 +84,9 @@ Create `### Bonus` / `**Images:**` if missing.
📄 content/post/YYYY/MM/DD/index.md
🏷️ label: "[label]" (source: candidate-pick | caption | user-input; post: [postTitle])
🖼️ [clean_image_url]
📊 [tally]
```
The tally comes from `post-stats` — see *Post tally* in the shared post mechanics.
## Checklist
+2
View File
@@ -35,7 +35,9 @@ Trust `route: article`; skip if `duplicate` or not `accessible`.
✅ Article added to Newsletter #[number]
📄 content/post/YYYY/MM/DD/index.md
🔗 [clean_url]
📊 [tally]
```
The tally comes from `post-stats` — see *Post tally* in the shared post mechanics.
## Checklist
+11
View File
@@ -59,10 +59,19 @@ Act on the user's choice. If they choose add/update, proceed to design that skil
### 5. Final report
Close with the target post's TL;DR tally, then the per-URL detail. Read the tally from the post itself so it reflects everything the post now holds, not just this batch:
```bash
go run ./scripts/newsletter post-stats content/post/YYYY/MM/DD/index.md
```
Aggregate across all URLs:
```
✅ Newsletter URL Dispatch Complete
📊 Newsletter #[number]: [articles] articles · [videos] videos · [images] images
(omit zero counts; documents too when present)
✅ Dispatched: [count]
- [count] → mt-add-post (articles)
- [count] → mt-add-video (YouTube)
@@ -75,6 +84,8 @@ Aggregate across all URLs:
- [url] (route: [route]): [user decision]
```
The tally is report-only — never write it into `index.md`. See *Post tally* in `references/newsletter-post-mechanics.md`.
## Notes
- Handlers (`mt-add-post`, `mt-add-video`, `mt-add-image`) remain directly invocable for single-purpose use, but `mt-add-url` is the normal entry point when a user pastes a URL.
@@ -83,6 +83,23 @@ If the post has **no `### Bonus`** yet:
```
When a subsection (e.g. `**Videos:**`) already exists, append under it; otherwise create it. Keep subsections in this order: **Images** → **Videos** → **Documents**.
## 4a. Post tally (report line)
After every successful insertion, report the target post's running totals so the user can see what the post now holds:
```bash
go run ./scripts/newsletter post-stats content/post/YYYY/MM/DD/index.md
```
Output (JSON): `{ post, newsletter, articles, images, videos, documents, total }`.
Render it as a single TL;DR line in the handler's report, omitting zero counts:
```
📊 4 articles · 2 videos · 1 image
```
Use the counts the command returns — do not tally by hand. This is a **report-only** line: never write it into `index.md`.
## 5. Post content language guidelines
These rules apply only to text written into `content/post/**/index.md`. Keep user-facing questions, status updates, reports, and final responses in English unless the user explicitly requests another language.
+2
View File
@@ -48,7 +48,9 @@ A clean YouTube URL (passed by `mt-add-url`, or given directly).
✅ Video added to Newsletter #[number] (Bonus → Videos)
📄 content/post/YYYY/MM/DD/index.md
🎬 [Vietnamese title] — [clean_url]
📊 [tally]
```
The tally comes from `post-stats` — see *Post tally* in the shared post mechanics.
## Checklist