mirror of
https://github.com/tiennm99/blog.git
synced 2026-10-11 03:13:10 +00:00
One Go binary with a subcommand per former script, invoked as 'go run ./scripts/newsletter <command>' from repo root. Stdlib only; publications config embedded via go:embed (go run recompiles on edit). Behavior parity verified side-by-side before deleting the JS — see plans/reports/parity-260818-newsletter-go-migration-report.md. Permissions: allow 'Bash(go *)', drop 'Bash(node *)' and the redundant 'Write(content)' rule (Edit rules cover all file-editing tools).
2.9 KiB
2.9 KiB
Phase 3 — Cutover, Docs, Cleanup
Context
Phase 2 passed. Replace every node scripts/newsletter/<name>.js invocation with go run ./scripts/newsletter <name-without-.js>, update prose, delete JS.
Call Sites to Update (verified by grep, 2026-08-18)
| File | Lines | Change |
|---|---|---|
.claude/skills/mt-add-url/SKILL.md |
23 | add-url invocation |
.claude/skills/mt-add-post/SKILL.md |
16 | add-url invocation |
.claude/skills/mt-add-video/SKILL.md |
22 | add-url invocation |
.claude/skills/mt-add-image/SKILL.md |
24, 30, 37, 41 | detect-image-source, add-url, find-substack-post (×2, incl. --deep) |
.claude/skills/mt-add-tags/SKILL.md |
53 | list-existing-tags invocation |
.claude/skills/mt-webfetch/SKILL.md |
31, 73 | fetch-via-defuddle invocation |
.claude/skills/mt-add-url/references/newsletter-post-mechanics.md |
21 | find-newsletter-number invocation |
AGENTS.md |
42–52 | Shared Engine block: command list + prose "plain Node (stdlib only, no deps)" → "Go (stdlib only, go run, no deps)" |
README.md |
~42 | shared-engine sentence mentioning node |
docs/multi-tool-usage.md |
3, 13 | "all three call node scripts/newsletter/*.js" → Go invocation |
.agents/skills/ Codex adapters reference the .claude/skills/ SKILL.md files, not the scripts directly — verify with a final grep, no direct edits expected.
Steps
- Update all call sites above (mechanical string replacement per file; keep surrounding comments like
# expect route:imageintact). - Add
"Bash(go *)"to.claude/settings.jsonpermissions allow (alphabetical position). LeaveBash(node *)pending the plan's open question 1. - Delete
scripts/newsletter/*.js(all 8). Keepconfig/substack-publications.json. - Verify:
grep -rn "node scripts/newsletter\|newsletter/[a-z-]*\.js" .claude .agents AGENTS.md README.md docs scripts→ only the go:embed reference to the config JSON may remain. - Run each of the 6 Go subcommands once from repo root as a smoke test.
hugo --quiet(orhugo serverspot check) to confirm the site build is untouched by rootgo.mod.- Commit as
refactor(scripts): migrate newsletter engine from Node to Go(conventional, no AI references). Run the pre-commit tag check per Git Workflow Rules — no post content changes expected, so it should be a no-op.
Docs Policy Check
Per documentation-management rules this change affects commands + architecture docs → AGENTS.md, README.md, docs/multi-tool-usage.md updates above are required; no changelog file exists in this repo, so nothing more.
Risks / Rollback
- Risk: an AI tool (Codex/OpenCode) with a cold Go build cache sees a slow first
go run(~1–3 s compile). Acceptable; subsequent runs are cached. - Rollback:
git revertthe cutover commit — JS engine and call sites restore together (single commit contains both).