Initial public commit
Daybook: a self-hosted, multi-user Django + DRF app where agents, scripts, or people publish artifacts and each logged-in user browses their own time-ordered, label-filterable feed. This squashes prior local development history (kept privately on a separate branch) into a single clean starting point for the public repository. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
commit
940a703cd7
62 changed files with 5755 additions and 0 deletions
28
scripts/README.md
Normal file
28
scripts/README.md
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
# Daybook Posting Helper
|
||||
|
||||
`scripts/daybook_post.py` is a compatibility wrapper for the canonical zero-dependency helper at `skills/daybook-posting/scripts/daybook_post.py`.
|
||||
|
||||
The helper is for agents and scripts that need to publish artifacts to Daybook without hand-crafting JSON, curl, or multipart requests.
|
||||
|
||||
Configuration:
|
||||
|
||||
```text
|
||||
DAYBOOK_URL=http://127.0.0.1:8001
|
||||
DAYBOOK_TOKEN=your-personal-api-token
|
||||
DAYBOOK_SOURCE=agent
|
||||
```
|
||||
|
||||
`DAYBOOK_TOKEN` is a personal per-user token from Settings → Account in the app, not shared across users.
|
||||
|
||||
Examples:
|
||||
|
||||
```bash
|
||||
python skills/daybook-posting/scripts/daybook_post.py --check
|
||||
python skills/daybook-posting/scripts/daybook_post.py --kind markdown --title "Build Report" --content-file report.md --tags build,report
|
||||
cat report.md | python skills/daybook-posting/scripts/daybook_post.py --kind markdown --title "Build Report"
|
||||
python skills/daybook-posting/scripts/daybook_post.py --kind deck --title "Plan" --content-file deck.html
|
||||
python skills/daybook-posting/scripts/daybook_post.py --file diagram.svg --title "Architecture Diagram"
|
||||
python skills/daybook-posting/scripts/daybook_post.py --file results.csv --as-markdown --title "Results CSV"
|
||||
```
|
||||
|
||||
The artifact browser URL is printed as the final stdout line.
|
||||
16
scripts/daybook_post.py
Normal file
16
scripts/daybook_post.py
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
#!/usr/bin/env python3
|
||||
"""Compatibility wrapper for the Daybook posting helper.
|
||||
|
||||
The canonical helper lives inside the self-contained skill folder:
|
||||
skills/daybook-posting/scripts/daybook_post.py
|
||||
"""
|
||||
|
||||
import runpy
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
HELPER = Path(__file__).resolve().parent.parent / "skills" / "daybook-posting" / "scripts" / "daybook_post.py"
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
runpy.run_path(str(HELPER), run_name="__main__")
|
||||
111
scripts/seed_demo_artifacts.py
Normal file
111
scripts/seed_demo_artifacts.py
Normal file
|
|
@ -0,0 +1,111 @@
|
|||
#!/usr/bin/env python3
|
||||
"""Post one demo artifact of every kind, tagged, dated today.
|
||||
|
||||
Posts through the real ingest API using the existing daybook_post.py helper,
|
||||
so seeded data goes through the same normalization as real agent output.
|
||||
|
||||
Usage (from project root, with the dev server running):
|
||||
python scripts/seed_demo_artifacts.py
|
||||
"""
|
||||
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
from pathlib import Path
|
||||
|
||||
HELPER = Path(__file__).resolve().parent.parent / "skills" / "daybook-posting" / "scripts" / "daybook_post.py"
|
||||
PERSONA = "seed-demo"
|
||||
TAGS = "seed-demo,demo"
|
||||
|
||||
|
||||
def run_post(args):
|
||||
result = subprocess.run([sys.executable, str(HELPER), *args], capture_output=True, text=True)
|
||||
print(result.stdout.strip())
|
||||
if result.returncode != 0:
|
||||
print(result.stderr.strip(), file=sys.stderr)
|
||||
return result.returncode
|
||||
|
||||
|
||||
def post_text(kind, title, content, extra_tag):
|
||||
with tempfile.NamedTemporaryFile("w", suffix=".txt", delete=False, encoding="utf-8") as tmp:
|
||||
tmp.write(content)
|
||||
content_path = tmp.name
|
||||
return run_post([
|
||||
"--kind", kind,
|
||||
"--title", title,
|
||||
"--persona", PERSONA,
|
||||
"--tags", f"{TAGS},{extra_tag}",
|
||||
"--content-file", content_path,
|
||||
])
|
||||
|
||||
|
||||
def post_file(title, file_path, extra_tag):
|
||||
return run_post([
|
||||
"--file", str(file_path),
|
||||
"--title", title,
|
||||
"--persona", PERSONA,
|
||||
"--tags", f"{TAGS},{extra_tag}",
|
||||
])
|
||||
|
||||
|
||||
def main():
|
||||
exit_codes = []
|
||||
|
||||
exit_codes.append(post_text(
|
||||
"markdown",
|
||||
"Seed: Markdown Sample",
|
||||
"# Markdown Sample\n\nThis is a **seed** artifact demonstrating markdown rendering.\n\n- item one\n- item two\n",
|
||||
"markdown",
|
||||
))
|
||||
|
||||
exit_codes.append(post_text(
|
||||
"html_fragment",
|
||||
"Seed: HTML Fragment Sample",
|
||||
"<h2>HTML Fragment</h2><p>This is a seed HTML fragment artifact.</p>",
|
||||
"html-fragment",
|
||||
))
|
||||
|
||||
exit_codes.append(post_text(
|
||||
"html_full",
|
||||
"Seed: Full HTML Sample",
|
||||
"<!doctype html><html><head><title>Seed Full HTML</title></head>"
|
||||
"<body><h1>Full HTML Doc</h1><p>Seed artifact.</p></body></html>",
|
||||
"html-full",
|
||||
))
|
||||
|
||||
exit_codes.append(post_text(
|
||||
"deck",
|
||||
"Seed: Deck Sample",
|
||||
"<section><h1>Slide One</h1><p>Seed deck artifact.</p></section>"
|
||||
"<section><h1>Slide Two</h1><p>More content.</p></section>",
|
||||
"deck",
|
||||
))
|
||||
|
||||
with tempfile.TemporaryDirectory() as tmp_dir:
|
||||
tmp_dir = Path(tmp_dir)
|
||||
|
||||
png_path = tmp_dir / "seed_pixel.png"
|
||||
png_path.write_bytes(bytes.fromhex(
|
||||
"89504e470d0a1a0a0000000d494844520000000100000001080600000"
|
||||
"01f15c4890000000a49444154789c6360000002000155e59a1a0000000049454e44ae426082"
|
||||
))
|
||||
exit_codes.append(post_file("Seed: Image Sample", png_path, "image"))
|
||||
|
||||
pdf_path = tmp_dir / "seed_doc.pdf"
|
||||
pdf_path.write_bytes(
|
||||
b"%PDF-1.1\n1 0 obj<</Type/Catalog/Pages 2 0 R>>endobj\n"
|
||||
b"2 0 obj<</Type/Pages/Kids[3 0 R]/Count 1>>endobj\n"
|
||||
b"3 0 obj<</Type/Page/Parent 2 0 R/MediaBox[0 0 200 200]>>endobj\n"
|
||||
b"trailer<</Root 1 0 R>>\n"
|
||||
)
|
||||
exit_codes.append(post_file("Seed: PDF Sample", pdf_path, "pdf"))
|
||||
|
||||
bin_path = tmp_dir / "seed_data.bin"
|
||||
bin_path.write_bytes(b"\x00\x01\x02\x03seed-binary-data\xff\xfe")
|
||||
exit_codes.append(post_file("Seed: Binary Sample", bin_path, "binary"))
|
||||
|
||||
return 1 if any(exit_codes) else 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
Loading…
Add table
Add a link
Reference in a new issue