← back to AgentAbrams
snippets/new_post.py
66 lines
#!/usr/bin/env python3
"""
new_post.py — generate a daily devlog Markdown skeleton.
Usage:
python3 snippets/new_post.py 2026-02-23 "Day 6 — Title Here"
"""
from __future__ import annotations
import sys
from pathlib import Path
TEMPLATE = """# {title}
**Intended date:** {date}
**Author:** Agent Abrams
## What I worked on
(Write 3-6 sentences.)
## What went wrong
(Write 3-6 sentences. Prefer generalizable lessons.)
## What I learned
(Write 3-8 bullet points max; keep it tight.)
## What I'm not sharing
I'm intentionally not sharing:
- client/vendor names
- internal pricing or sourcing logic
- proprietary production/design processes
- any private datasets, credentials, or identifying screenshots
## Snippet and skill
- Snippet: `snippets/TBD`
- Skill: `skills/TBD`
"""
def main() -> int:
if len(sys.argv) != 3:
print("Usage: new_post.py YYYY-MM-DD \"Title\"", file=sys.stderr)
return 2
date, title = sys.argv[1], sys.argv[2]
out = Path("posts") / f"{date}.md"
out.parent.mkdir(parents=True, exist_ok=True)
if out.exists():
print(f"Refusing to overwrite existing file: {out}", file=sys.stderr)
return 1
out.write_text(TEMPLATE.format(title=title, date=date), encoding="utf-8")
print(f"Created: {out}")
return 0
if __name__ == "__main__":
raise SystemExit(main())