@@ -1,188 +0,0 @@
1----
2-name: write-blog-post
3-description: >-
4- Write a dev update blog post for sacenox.github.io. Use when the user asks
5- to write, draft, or publish a blog post, dev log, or project update.
6- Scans git history across github projects, writes a Jekyll post matching
7- existing tone, and commits/pushes. Triggers on: blog post, dev update,
8- dev log, write a post, publish update, project recap.
9-compatibility: Requires shell access. Expects ~/src/sacenox.github.io to be a Jekyll blog repo.
10----
11-
12-# Write a Dev Update Blog Post
13-
14-Generate a lighthearted dev update post for the sacenox.github.io Jekyll blog by scanning recent git activity across projects.
15-
16-## Privacy and scope guardrails
17-
18-- Treat this as a publishing workflow: anything gathered may end up on the public internet.
19-- Only inspect the blog repo at `~/src/sacenox.github.io` for existing posts and for writing the new post.
20-- For project activity, use only public GitHub data via `gh`. Do **not** inspect local project directories, local git logs, working trees, dotfiles, untracked files, or private repos.
21-- Do **not** use local fallbacks such as `find ~/src`, `git -C ~/src/<repo> ...`, or reading files from other project folders.
22-- If GitHub data is unavailable, incomplete, or confusing, ask the user before using any non-public or local source.
23-- Never include information from unpublished local changes or private computer state unless the user explicitly provides or authorizes it for the post.
24-- Only commit or push when the user explicitly asks. For a dry run, write the post locally and stop.
25-
26-## Prerequisites
27-
28-- `~/src/sacenox.github.io` exists and is a git repo with `_posts/` directory
29-- `gh` command is available in shell and authenticated
30-
31-## Procedure
32-
33-### 1. Identify the last post and its date
34-
35-```bash
36-ls ~/src/sacenox.github.io/_posts/ | sort | tail -1
37-```
38-
39-Read that file to understand:
40-- **Date cutoff** — only gather git history *after* that post's date
41-- **Voice and tone** — match the existing style (casual, technical, self-deprecating humor)
42-- **Front matter format** — use the same `layout`, `title`, `description` fields
43-
44-### 2. Scan recent activity across public GitHub repos
45-
46-Use the GitHub CLI as the source of truth. Do not fall back to local clones.
47-
48-Important `gh api` footgun: when query fields are supplied with `-f`/`--field`, `gh api` defaults to `POST`. For GitHub REST read endpoints like commits and tags, always pass `--method GET` before `-f ...`.
49-
50-First, smoke-test auth and list the public personal repos owned by the authenticated account, excluding `sacenox.github.io`:
51-
52-```bash
53-GH_USER="$(gh api --method GET user --jq .login)"
54-
55-gh repo list "$GH_USER" \
56- --visibility=public \
57- --no-archived \
58- --limit 200 \
59- --json nameWithOwner,name,isArchived,isPrivate,isInOrganization,pushedAt,url \
60- --jq '.[] | select(.name != "sacenox.github.io") | select(.isArchived == false) | select(.isPrivate == false) | select(.isInOrganization == false) | [.nameWithOwner, .pushedAt, .url] | @tsv'
61-```
62-
63-Then inspect recent activity since the last post date. Replace `YYYY-MM-DD` with the date of the last post:
64-
65-```bash
66-set -euo pipefail
67-
68-GH_USER="$(gh api --method GET user --jq .login)"
69-SINCE="YYYY-MM-DD"
70-SINCE_TS="${SINCE}T00:00:00Z"
71-
72-gh repo list "$GH_USER" \
73- --visibility=public \
74- --no-archived \
75- --limit 200 \
76- --json nameWithOwner,name,isArchived,isPrivate,isInOrganization,pushedAt,url \
77- --jq '.[] | select(.name != "sacenox.github.io") | select(.isArchived == false) | select(.isPrivate == false) | select(.isInOrganization == false) | [.nameWithOwner, .pushedAt, .url] | @tsv' |
78-while IFS=$'\t' read -r repo pushed_at url; do
79- [ -n "${repo:-}" ] || continue
80-
81- if ! commits="$(gh api --method GET "repos/$repo/commits" \
82- -f since="$SINCE_TS" \
83- -f per_page=100 \
84- --paginate \
85- --jq '.[] | "\(.sha[0:7]) \(.commit.author.date) \(.commit.message | split("\n")[0])"' 2>/dev/null)"; then
86- echo "WARN: failed to fetch commits for $repo; skipping" >&2
87- continue
88- fi
89-
90- count="$(printf '%s\n' "$commits" | awk 'NF { n++ } END { print n + 0 }')"
91- [ "$count" -gt 0 ] || continue
92-
93- echo "=== $repo ==="
94- echo "URL: $url"
95- echo "Pushed: $pushed_at"
96- echo "Commit count since $SINCE: $count"
97- echo "Recent commits:"
98- printf '%s\n' "$commits" | awk 'NR <= 20 { print }'
99-
100- releases="$(gh release list \
101- --repo "$repo" \
102- --limit 10 \
103- --json tagName,publishedAt,isPrerelease,isLatest \
104- --jq '.[] | "\(.tagName) \(.publishedAt)\(if .isPrerelease then " prerelease" else "" end)\(if .isLatest then " latest" else "" end)"' 2>/dev/null || true)"
105- if [ -n "$releases" ]; then
106- echo "Releases:"
107- printf '%s\n' "$releases" | awk 'NR <= 10 { print }'
108- else
109- tags="$(gh api --method GET "repos/$repo/tags" \
110- -f per_page=10 \
111- --jq '.[] | .name' 2>/dev/null || true)"
112- if [ -n "$tags" ]; then
113- echo "Latest tags:"
114- printf '%s\n' "$tags" | awk 'NR <= 10 { print }'
115- fi
116- fi
117-
118- echo
119-done
120-```
121-
122-Focus on:
123-- **Feature commits** (`feat:` prefix) — these are the headlines
124-- **Notable fixes** (`fix:` prefix) — especially funny or hard-won bugs
125-- **Release tags** — releases from `gh release list`, or latest tag names from the GitHub API when releases do not exist; do not call a tag "recent" unless the output includes a date that supports it
126-- **Commit volume** — count commits since `YYYY-MM-DD`
127-- **Recently pushed repos** — public repos with meaningful activity since the previous post
128-
129-### 3. Identify the main project and themes
130-
131-The user will typically tell you what to focus on. If not, pick the project with the most commits since the last post. Look for:
132-- Release milestones (RC → stable, version bumps)
133-- New libraries or tools that were born
134-- Amusing bug stories (one-line fix, long debugging session)
135-- Side projects that got some love
136-
137-### 4. Write the post
138-
139-**File naming:** `YYYY-MM-DD-<slug>.md` where the date is today.
140-
141-**Idempotency check** — before creating, check if today's post already exists:
142-
143-```bash
144-existing=$(ls ~/src/sacenox.github.io/_posts/ | grep "^$(date +%Y-%m-%d)" || true)
145-```
146-
147-If a post for today exists and covers the same topic, update it in place rather than creating a duplicate. If it covers a different topic, use a distinct slug.
148-
149-**Front matter template:**
150-
151-```yaml
152----
153-layout: post
154-title: slug-style-title-with-hyphens
155-description: One sentence summary, max ~160 chars for SEO.
156----
157-```
158-
159-**Content guidelines:**
160-- Start with an `# H1` title (can differ from the slug — use natural language)
161-- Reference the previous post with a relative link: `[text](/posts/<previous-title-slug>/)`
162-- Use `##` sections to break up the narrative
163-- Include a stats table if there are interesting numbers
164-- End with install/try-it instructions and a link to the GitHub repo
165-- Keep it under 150 lines of markdown
166-- Tone: fun, lighthearted, first-person. Technical but not dry.
167-
168-### 5. Verify and commit
169-
170-```bash
171-cd ~/src/sacenox.github.io
172-
173-# Stage and commit
174-git add _posts/YYYY-MM-DD-<slug>.md
175-git commit -m "Add post: <short title>"
176-
177-# Push
178-git push origin main
179-```
180-
181-## Gotchas
182-
183-- **Title field is a slug**, not a human-readable title. The `# H1` inside the post is the display title.
184-- **Permalink format** is `/posts/:title/` — the `:title` comes from the slug in the `title` front matter field. Link to other posts using this pattern.
185-- **Don't invent GitHub URLs** — only link to repos using the `url` returned by `gh repo list`, or verify with `gh repo view OWNER/REPO --json url --jq .url`. Do not check local remotes outside the blog repo.
186-- **Date in filename must match today** — Jekyll won't render future-dated posts by default.
187-- Posts are **not** auto-deployed by n8n anymore; manual `git push` is the deploy step.
188-- Make sure to only include **public** and personal (not from an organization) repositories in the post.