dayfile 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (205) hide show
  1. dayfile-0.1.0/.dockerignore +9 -0
  2. dayfile-0.1.0/.github/ISSUE_TEMPLATE/bug_report.md +12 -0
  3. dayfile-0.1.0/.github/ISSUE_TEMPLATE/config.yml +5 -0
  4. dayfile-0.1.0/.github/PULL_REQUEST_TEMPLATE.md +7 -0
  5. dayfile-0.1.0/.github/dependabot.yml +10 -0
  6. dayfile-0.1.0/.github/workflows/ci.yml +30 -0
  7. dayfile-0.1.0/.github/workflows/publish.yml +17 -0
  8. dayfile-0.1.0/.gitignore +14 -0
  9. dayfile-0.1.0/CHANGELOG.md +57 -0
  10. dayfile-0.1.0/CLAUDE.md +74 -0
  11. dayfile-0.1.0/CODE_OF_CONDUCT.md +7 -0
  12. dayfile-0.1.0/CONTRIBUTING.md +16 -0
  13. dayfile-0.1.0/Dockerfile +15 -0
  14. dayfile-0.1.0/LICENSE +661 -0
  15. dayfile-0.1.0/PKG-INFO +160 -0
  16. dayfile-0.1.0/README.md +125 -0
  17. dayfile-0.1.0/SECURITY.md +13 -0
  18. dayfile-0.1.0/deploy/cloud/.env.example +20 -0
  19. dayfile-0.1.0/deploy/cloud/Caddyfile +65 -0
  20. dayfile-0.1.0/deploy/cloud/README.md +58 -0
  21. dayfile-0.1.0/deploy/cloud/backup-tenants.sh +72 -0
  22. dayfile-0.1.0/deploy/cloud/cloud-init.yaml +71 -0
  23. dayfile-0.1.0/deploy/cloud/compose.yaml +89 -0
  24. dayfile-0.1.0/deploy/cloud/harden-dns.py +189 -0
  25. dayfile-0.1.0/deploy/cloud/litestream.yml +18 -0
  26. dayfile-0.1.0/deploy/cloud/restore-drill.sh +33 -0
  27. dayfile-0.1.0/deploy/cloud/set-ping-urls.sh +44 -0
  28. dayfile-0.1.0/deploy/cloud/setup-backup.sh +61 -0
  29. dayfile-0.1.0/deploy/cloud/setup-drill-config.sh +58 -0
  30. dayfile-0.1.0/deploy/cloud/setup-github.sh +32 -0
  31. dayfile-0.1.0/deploy/cloud/setup-uptimerobot.sh +31 -0
  32. dayfile-0.1.0/deploy/cloud/smoke-test.sh +75 -0
  33. dayfile-0.1.0/deploy/cloud/systemd/dayfile-backup.service +14 -0
  34. dayfile-0.1.0/deploy/cloud/systemd/dayfile-backup.timer +10 -0
  35. dayfile-0.1.0/deploy/cloud/systemd/dayfile-heartbeat.service +11 -0
  36. dayfile-0.1.0/deploy/cloud/systemd/dayfile-heartbeat.timer +9 -0
  37. dayfile-0.1.0/deploy/cloud/systemd/dayfile-purge.service +7 -0
  38. dayfile-0.1.0/deploy/cloud/systemd/dayfile-purge.timer +10 -0
  39. dayfile-0.1.0/deploy/selfhost/Caddyfile +7 -0
  40. dayfile-0.1.0/deploy/selfhost/README.md +34 -0
  41. dayfile-0.1.0/deploy/selfhost/compose.yaml +43 -0
  42. dayfile-0.1.0/deploy/selfhost/dayfile-email.service +14 -0
  43. dayfile-0.1.0/deploy/selfhost/dayfile-notify.service +15 -0
  44. dayfile-0.1.0/deploy/selfhost/dayfile.service +12 -0
  45. dayfile-0.1.0/docs/CLOUD.md +68 -0
  46. dayfile-0.1.0/docs/ROADMAP.md +116 -0
  47. dayfile-0.1.0/docs/SPEC.md +337 -0
  48. dayfile-0.1.0/docs/design/README.md +43 -0
  49. dayfile-0.1.0/docs/design/backups-and-restore.md +100 -0
  50. dayfile-0.1.0/docs/design/dns-and-mail.md +94 -0
  51. dayfile-0.1.0/docs/design/feed-icons.md +39 -0
  52. dayfile-0.1.0/docs/design/going-public.md +65 -0
  53. dayfile-0.1.0/docs/design/legal-review.md +80 -0
  54. dayfile-0.1.0/docs/design/m16-accounts.md +209 -0
  55. dayfile-0.1.0/docs/design/monitoring.md +73 -0
  56. dayfile-0.1.0/docs/img/access.svg +34 -0
  57. dayfile-0.1.0/docs/img/architecture.svg +112 -0
  58. dayfile-0.1.0/docs/img/lifecycle.svg +31 -0
  59. dayfile-0.1.0/docs/img/logo-mark.svg +9 -0
  60. dayfile-0.1.0/docs/img/logo.svg +9 -0
  61. dayfile-0.1.0/docs/ops/drills.md +9 -0
  62. dayfile-0.1.0/docs/ops/launch-checklist.md +84 -0
  63. dayfile-0.1.0/examples/events.jsonl +8 -0
  64. dayfile-0.1.0/pyproject.toml +80 -0
  65. dayfile-0.1.0/schema/event.schema.json +97 -0
  66. dayfile-0.1.0/schema.sql +191 -0
  67. dayfile-0.1.0/src/dayfile/__init__.py +1 -0
  68. dayfile-0.1.0/src/dayfile/admin.py +467 -0
  69. dayfile-0.1.0/src/dayfile/app.py +676 -0
  70. dayfile-0.1.0/src/dayfile/auth/__init__.py +0 -0
  71. dayfile-0.1.0/src/dayfile/auth/tokens.py +159 -0
  72. dayfile-0.1.0/src/dayfile/cli.py +757 -0
  73. dayfile-0.1.0/src/dayfile/cloudevents.py +130 -0
  74. dayfile-0.1.0/src/dayfile/db.py +314 -0
  75. dayfile-0.1.0/src/dayfile/feeds.py +124 -0
  76. dayfile-0.1.0/src/dayfile/gen/__init__.py +0 -0
  77. dayfile-0.1.0/src/dayfile/gen/digest.py +72 -0
  78. dayfile-0.1.0/src/dayfile/gen/weather.py +91 -0
  79. dayfile-0.1.0/src/dayfile/heartbeats.py +236 -0
  80. dayfile-0.1.0/src/dayfile/icons.py +11 -0
  81. dayfile-0.1.0/src/dayfile/ingest/__init__.py +0 -0
  82. dayfile-0.1.0/src/dayfile/ingest/core.py +147 -0
  83. dayfile-0.1.0/src/dayfile/ingest/email_in.py +253 -0
  84. dayfile-0.1.0/src/dayfile/logsafe.py +38 -0
  85. dayfile-0.1.0/src/dayfile/mcp_http.py +218 -0
  86. dayfile-0.1.0/src/dayfile/mcp_server.py +208 -0
  87. dayfile-0.1.0/src/dayfile/models.py +43 -0
  88. dayfile-0.1.0/src/dayfile/notify/__init__.py +0 -0
  89. dayfile-0.1.0/src/dayfile/notify/ntfy.py +39 -0
  90. dayfile-0.1.0/src/dayfile/notify/scheduler.py +97 -0
  91. dayfile-0.1.0/src/dayfile/ratelimit.py +73 -0
  92. dayfile-0.1.0/src/dayfile/render/__init__.py +0 -0
  93. dayfile-0.1.0/src/dayfile/render/atom.py +96 -0
  94. dayfile-0.1.0/src/dayfile/render/jsonfeed.py +58 -0
  95. dayfile-0.1.0/src/dayfile/render/query.py +78 -0
  96. dayfile-0.1.0/src/dayfile/signing.py +197 -0
  97. dayfile-0.1.0/src/dayfile/static/favicon.ico +0 -0
  98. dayfile-0.1.0/src/dayfile/static/favicon.svg +7 -0
  99. dayfile-0.1.0/src/dayfile/static/icon-512.png +0 -0
  100. dayfile-0.1.0/src/dayfile/static/icon-64.png +0 -0
  101. dayfile-0.1.0/src/dayfile/stats.py +68 -0
  102. dayfile-0.1.0/src/dayfile/tenancy.py +319 -0
  103. dayfile-0.1.0/src/dayfile/timefmt.py +44 -0
  104. dayfile-0.1.0/src/dayfile/ulid.py +13 -0
  105. dayfile-0.1.0/src/dayfile/web/__init__.py +7 -0
  106. dayfile-0.1.0/src/dayfile/web/accounts/__init__.py +5 -0
  107. dayfile-0.1.0/src/dayfile/web/accounts/control.py +142 -0
  108. dayfile-0.1.0/src/dayfile/web/accounts/github.py +125 -0
  109. dayfile-0.1.0/src/dayfile/web/accounts/grants.py +286 -0
  110. dayfile-0.1.0/src/dayfile/web/accounts/store.py +774 -0
  111. dayfile-0.1.0/src/dayfile/web/admin.py +112 -0
  112. dayfile-0.1.0/src/dayfile/web/app.py +1583 -0
  113. dayfile-0.1.0/src/dayfile/web/client.py +123 -0
  114. dayfile-0.1.0/src/dayfile/web/creds.py +45 -0
  115. dayfile-0.1.0/src/dayfile/web/demo.py +64 -0
  116. dayfile-0.1.0/src/dayfile/web/history.py +83 -0
  117. dayfile-0.1.0/src/dayfile/web/oauth.py +378 -0
  118. dayfile-0.1.0/src/dayfile/web/present.py +160 -0
  119. dayfile-0.1.0/src/dayfile/web/static/fonts/fonts.NOTICE +195 -0
  120. dayfile-0.1.0/src/dayfile/web/static/fonts/jetbrains-mono-variable-latin.woff2 +0 -0
  121. dayfile-0.1.0/src/dayfile/web/static/fonts/source-sans-3-variable-latin.woff2 +0 -0
  122. dayfile-0.1.0/src/dayfile/web/static/htmx.NOTICE +5 -0
  123. dayfile-0.1.0/src/dayfile/web/static/htmx.min.js +1 -0
  124. dayfile-0.1.0/src/dayfile/web/static/icons.NOTICE +9 -0
  125. dayfile-0.1.0/src/dayfile/web/static/log.js +15 -0
  126. dayfile-0.1.0/src/dayfile/web/static/settings.js +12 -0
  127. dayfile-0.1.0/src/dayfile/web/static/site.css +369 -0
  128. dayfile-0.1.0/src/dayfile/web/static/tokens.js +8 -0
  129. dayfile-0.1.0/src/dayfile/web/templates/_diagram.html +36 -0
  130. dayfile-0.1.0/src/dayfile/web/templates/_event.html +36 -0
  131. dayfile-0.1.0/src/dayfile/web/templates/_feedtabs.html +1 -0
  132. dayfile-0.1.0/src/dayfile/web/templates/_filters.html +13 -0
  133. dayfile-0.1.0/src/dayfile/web/templates/_new.html +2 -0
  134. dayfile-0.1.0/src/dayfile/web/templates/_post_form.html +10 -0
  135. dayfile-0.1.0/src/dayfile/web/templates/account.html +17 -0
  136. dayfile-0.1.0/src/dayfile/web/templates/base.html +33 -0
  137. dayfile-0.1.0/src/dayfile/web/templates/deleted.html +7 -0
  138. dayfile-0.1.0/src/dayfile/web/templates/demo.html +19 -0
  139. dayfile-0.1.0/src/dayfile/web/templates/docs.html +174 -0
  140. dayfile-0.1.0/src/dayfile/web/templates/error.html +7 -0
  141. dayfile-0.1.0/src/dayfile/web/templates/feeds.html +42 -0
  142. dayfile-0.1.0/src/dayfile/web/templates/heartbeats.html +29 -0
  143. dayfile-0.1.0/src/dayfile/web/templates/index.html +109 -0
  144. dayfile-0.1.0/src/dayfile/web/templates/log.html +48 -0
  145. dayfile-0.1.0/src/dayfile/web/templates/login.html +20 -0
  146. dayfile-0.1.0/src/dayfile/web/templates/oauth_consent.html +18 -0
  147. dayfile-0.1.0/src/dayfile/web/templates/post.html +8 -0
  148. dayfile-0.1.0/src/dayfile/web/templates/pricing.html +40 -0
  149. dayfile-0.1.0/src/dayfile/web/templates/privacy.html +49 -0
  150. dayfile-0.1.0/src/dayfile/web/templates/revoke.html +7 -0
  151. dayfile-0.1.0/src/dayfile/web/templates/settings.html +100 -0
  152. dayfile-0.1.0/src/dayfile/web/templates/signed_in.html +7 -0
  153. dayfile-0.1.0/src/dayfile/web/templates/signup.html +15 -0
  154. dayfile-0.1.0/src/dayfile/web/templates/status.html +45 -0
  155. dayfile-0.1.0/src/dayfile/web/templates/terms.html +41 -0
  156. dayfile-0.1.0/src/dayfile/web/templates/token_new.html +19 -0
  157. dayfile-0.1.0/src/dayfile/web/templates/tokens.html +44 -0
  158. dayfile-0.1.0/src/dayfile/web/uptimerobot.py +141 -0
  159. dayfile-0.1.0/tests/helpers.py +79 -0
  160. dayfile-0.1.0/tests/test_accounts.py +152 -0
  161. dayfile-0.1.0/tests/test_accounts_cli.py +112 -0
  162. dayfile-0.1.0/tests/test_accounts_web.py +388 -0
  163. dayfile-0.1.0/tests/test_admin_api.py +329 -0
  164. dayfile-0.1.0/tests/test_api.py +319 -0
  165. dayfile-0.1.0/tests/test_auth.py +375 -0
  166. dayfile-0.1.0/tests/test_boundaries.py +62 -0
  167. dayfile-0.1.0/tests/test_cli.py +96 -0
  168. dayfile-0.1.0/tests/test_cli_tenant.py +163 -0
  169. dayfile-0.1.0/tests/test_cloudevents.py +282 -0
  170. dayfile-0.1.0/tests/test_dashboard.py +1255 -0
  171. dayfile-0.1.0/tests/test_db.py +95 -0
  172. dayfile-0.1.0/tests/test_deploy.py +562 -0
  173. dayfile-0.1.0/tests/test_email_in.py +153 -0
  174. dayfile-0.1.0/tests/test_favicon.py +76 -0
  175. dayfile-0.1.0/tests/test_feed.py +233 -0
  176. dayfile-0.1.0/tests/test_feeds.py +330 -0
  177. dayfile-0.1.0/tests/test_gen.py +255 -0
  178. dayfile-0.1.0/tests/test_harden_dns.py +110 -0
  179. dayfile-0.1.0/tests/test_heartbeats.py +131 -0
  180. dayfile-0.1.0/tests/test_http.py +85 -0
  181. dayfile-0.1.0/tests/test_idle.py +146 -0
  182. dayfile-0.1.0/tests/test_ingest.py +134 -0
  183. dayfile-0.1.0/tests/test_lifecycle.py +306 -0
  184. dayfile-0.1.0/tests/test_limits.py +285 -0
  185. dayfile-0.1.0/tests/test_mcp_http.py +115 -0
  186. dayfile-0.1.0/tests/test_mcp_server.py +87 -0
  187. dayfile-0.1.0/tests/test_models.py +69 -0
  188. dayfile-0.1.0/tests/test_notify.py +237 -0
  189. dayfile-0.1.0/tests/test_oauth.py +358 -0
  190. dayfile-0.1.0/tests/test_ops.py +84 -0
  191. dayfile-0.1.0/tests/test_present.py +53 -0
  192. dayfile-0.1.0/tests/test_query.py +79 -0
  193. dayfile-0.1.0/tests/test_release_cursor.py +203 -0
  194. dayfile-0.1.0/tests/test_render.py +188 -0
  195. dayfile-0.1.0/tests/test_signing.py +288 -0
  196. dayfile-0.1.0/tests/test_stats.py +101 -0
  197. dayfile-0.1.0/tests/test_status_history.py +46 -0
  198. dayfile-0.1.0/tests/test_tenancy.py +409 -0
  199. dayfile-0.1.0/tests/test_timefmt.py +38 -0
  200. dayfile-0.1.0/tests/test_token_cli.py +56 -0
  201. dayfile-0.1.0/tests/test_ulid.py +24 -0
  202. dayfile-0.1.0/tests/test_uptimerobot.py +74 -0
  203. dayfile-0.1.0/tests/test_web.py +800 -0
  204. dayfile-0.1.0/tests/test_writers.py +275 -0
  205. dayfile-0.1.0/uv.lock +1181 -0
@@ -0,0 +1,9 @@
1
+ .venv
2
+ .git
3
+ .env
4
+ *.db*
5
+ __pycache__
6
+ .pytest_cache
7
+ .ruff_cache
8
+ tests
9
+ docs
@@ -0,0 +1,12 @@
1
+ ---
2
+ name: Bug report
3
+ about: Something does not work as documented
4
+ ---
5
+
6
+ **What happened, and what you expected**
7
+
8
+ **Steps to reproduce** (a request, a command, or a failing test)
9
+
10
+ **Version** (`pip show dayfile`, or the commit) and how you run it (self-hosted, Docker, dayfile.app)
11
+
12
+ Security problems: do not file them here. See SECURITY.md.
@@ -0,0 +1,5 @@
1
+ blank_issues_enabled: true
2
+ contact_links:
3
+ - name: Security vulnerability
4
+ url: https://github.com/dayfile/dayfile/security/advisories/new
5
+ about: Report privately. Do not open a public issue.
@@ -0,0 +1,7 @@
1
+ ## What and why
2
+
3
+ ## Checklist
4
+ - [ ] Test written first for anything covered by an invariant in CLAUDE.md
5
+ - [ ] `docs/SPEC.md` updated if behavior changed
6
+ - [ ] `uv run pytest` and `uv run ruff check . && uv run ruff format --check .` are clean
7
+ - [ ] No new dependency (ask first)
@@ -0,0 +1,10 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: github-actions
4
+ directory: /
5
+ schedule:
6
+ interval: weekly
7
+ - package-ecosystem: uv
8
+ directory: /
9
+ schedule:
10
+ interval: weekly
@@ -0,0 +1,30 @@
1
+ name: ci
2
+ on:
3
+ push:
4
+ pull_request:
5
+ permissions:
6
+ contents: read
7
+ jobs:
8
+ test:
9
+ runs-on: ubuntu-latest
10
+ strategy:
11
+ fail-fast: false
12
+ matrix:
13
+ python: ["3.11", "3.12", "3.13", "3.14", "3.15"]
14
+ steps:
15
+ - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
16
+ with:
17
+ persist-credentials: false
18
+ - uses: astral-sh/setup-uv@d4b2f3b6ecc6e67c4457f6d3e41ec42d3d0fcb86 # v5
19
+ - run: uv sync --python ${{ matrix.python }}
20
+ - run: uv run ruff check . && uv run ruff format --check .
21
+ - run: uv run pytest -q
22
+ audit:
23
+ runs-on: ubuntu-latest
24
+ steps:
25
+ - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
26
+ with:
27
+ persist-credentials: false
28
+ - uses: astral-sh/setup-uv@d4b2f3b6ecc6e67c4457f6d3e41ec42d3d0fcb86 # v5
29
+ - run: uv export --frozen --no-emit-project -o /tmp/requirements.txt >/dev/null
30
+ - run: uvx pip-audit --disable-pip --no-deps -r /tmp/requirements.txt
@@ -0,0 +1,17 @@
1
+ # Publishes to PyPI when a GitHub release is published. Uses PyPI trusted publishing (no token):
2
+ # on pypi.org add this repository, workflow `publish.yml` and environment `pypi` as a trusted publisher.
3
+ name: publish
4
+ on:
5
+ release:
6
+ types: [published]
7
+ jobs:
8
+ pypi:
9
+ runs-on: ubuntu-latest
10
+ environment: pypi
11
+ permissions:
12
+ id-token: write
13
+ steps:
14
+ - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
15
+ - uses: astral-sh/setup-uv@d4b2f3b6ecc6e67c4457f6d3e41ec42d3d0fcb86 # v5
16
+ - run: uv build
17
+ - run: uv publish --trusted-publishing always
@@ -0,0 +1,14 @@
1
+ .venv/
2
+ __pycache__/
3
+ *.db
4
+ *.db-wal
5
+ *.db-shm
6
+ .pytest_cache/
7
+ .ruff_cache/
8
+ .env
9
+ chatgpt*.txt
10
+ gemini*.txt
11
+ mcp_tokens.txt
12
+
13
+ # operator handbook: private, kept in the maintainer checkout only
14
+ docs/ops/README.md
@@ -0,0 +1,57 @@
1
+ # Changelog
2
+
3
+ ## 0.1.0 (first public release)
4
+
5
+ - A deleted account lets go of its GitHub identity, so the same GitHub account can sign up again as a new, empty account (before: "This account can't sign in", with no way back without an operator).
6
+ - Backup: a failed run pings `$BACKUP_PING_URL/fail` (healthchecks.io style). The heartbeat timer can ping `$HEARTBEAT_PING_URL` after each good run.
7
+ - Heartbeats: say how often a source or tag should report (`24h`, `7d`) and dayfile writes an open `heartbeat` to-do when it goes quiet, closing it when the source returns. Schema version 11 (a `heartbeats` table, added to existing databases on connect). `dayfile heartbeat check`, run every minute by `deploy/cloud/systemd/dayfile-heartbeat.timer`; admin API and a Heartbeats tab on the Feeds page.
8
+ - A log at or near its event or storage limit says so on the Log page, and a refused post points to Settings. New *Start a fresh log* in Settings erases the log and recreates it empty under the same name (the way out for an append-only log that is full). The "account deleted" page no longer mixes two text sizes.
9
+ - Deleting an account erases the log at once (no 30-day trash); only encrypted backups remain, and they age out within 14 days. The operator command `dayfile tenant delete` still moves to `.trash/`. Admin API: `DELETE /tenants/{slug}?erase=true`.
10
+ - Hosted MCP: every log serves MCP at `https://<you>.dayfile.cloud/mcp` and dayfile.app is an OAuth 2.1 authorization server (dynamic client registration, S256 PKCE, rotating refresh tokens), so Claude can connect from Customize, Connectors with a Connect button. Choose read and write or read only when approving; manage and disconnect under Tokens. New `DAYFILE_MCP` and `DAYFILE_OAUTH_ISSUER`; the image now includes the `mcp` extra.
11
+ - MCP: a retract tool.
12
+ - `DAYFILE_TOKEN` is now `DAYFILE_WRITE_TOKEN` (for `dayfile add` and `dayfile mcp`).
13
+ - The log reader clamps long event bodies behind "Read more".
14
+ - The nightly backup now includes the accounts database (`accounts.accounts.db.gz`); `dayfile tenant verify-backup` checks it.
15
+ - `GET /usage` on a log: events and bytes used against its limits, for a read token.
16
+ - The status page shows uptime, daily bars and incidents measured independently by UptimeRobot (credited), falling back to a labeled internal check. `deploy/cloud/setup-uptimerobot.sh` stores the read-only key; `DAYFILE_STATUS_MONITORS` picks which monitors to show.
17
+ - `/status`: JSON on the API (`https://dayfile.cloud/status`) and a readable status page at dayfile.app, linked from the footer.
18
+ - `dayfile mcp`: an MCP server on stdio (optional extra `dayfile[mcp]`, new dependency `mcp`) with tools to list and get events, add an event, close a to-do and retract an event. It uses a read token (`DAYFILE_READ_TOKEN`) and a write token (`DAYFILE_WRITE_TOKEN`). `/healthz` on the API also answers HEAD.
19
+ - Per-log storage quota (`max_bytes`, 25 MiB on the free beta plan, `tenant limit --max-bytes`, shown in Settings) and a cap of 60 new accounts an hour.
20
+ - Landing page rewritten around the outcome ("One log for your scripts, apps and agents."), with use cases, a "Your data, your control" section and a public `/demo` example log. An empty log now shows how to send the first event.
21
+ - Signup is open: signing in with GitHub and accepting the terms is enough, and the site says it is in beta (`DAYFILE_SIGNUP=invite` brings the invite-code step back; the cloud compose file defaults to `open`). The log filter takes several tags (all must match). Delete account is red. The footer is laid out left, center, right.
22
+ - Breaking: events no longer have a `type`. The tag `todo` makes an event a to-do (open until closed); every other event has no status. The `type=` filter, the `type` column and the post form's State menu are gone. Housekeeping events carry the tag `dayfile-admin` instead of a type. CloudEvents export always sets `type` to `app.dayfile.event`; a foreign event's `type` is imported as a tag. `dayfile add` gained `--todo` (and `--due` implies it). Schema version 10: existing databases must be recreated.
23
+ - M0 to M8: event log, HTTP ingest, JSON Feed and Atom views, lifecycle, tokens and audiences,
24
+ ntfy notifications, generators, Ed25519 signing, CloudEvents.
25
+ - M9: write credentials and rate limit, release cursor for time-released events, IMAP IDLE with a
26
+ persisted cursor, reversible lifecycle events.
27
+ - M10a: `/healthz`, `dayfile backup`, Docker and Caddy deployment.
28
+ - Licensed under AGPL-3.0-only.
29
+ - `dayfile add --db` (direct operator mode); packaged wheel now includes the schema files so `pip install` works.
30
+ - M11: native JSON API (`GET /events`, `/events/{id}`, long-poll, SSE stream). Fixed: JSON Feed and Atom ETags changed on every request (conditional GET never matched).
31
+ - M12: tenancy seam (`DAYFILE_TENANTS_DIR`, one SQLite file per subdomain), suspension, event quota, per-tenant write limit, 1 MiB request body limit, `dayfile tenant` commands, `/internal/tls-ask` hook. Single-tenant behaviour is unchanged.
32
+ - M15: web app for `dayfile.app` (`dayfile.web`): landing, docs, draft terms and privacy, and a read-only log viewer that signs in with a read token. Runs in its own container with no tenant files. New dependencies: `jinja2`, `python-multipart`. The static holding page is gone.
33
+ - Favicon: `/favicon.svg` and `/favicon.ico` on every host; the cloud profile also serves a static holding page and the same icons on `dayfile.app` (`DAYFILE_SITE_DOMAIN`).
34
+ - M13: `deploy/` split into `selfhost/` and `cloud/` profiles; tenant backup script, Litestream config, cloud Caddyfile; `docs/CLOUD.md`.
35
+ - M14: per-token read rate limit (300/60 s) and a cap of 8 held streams and long-polls, both answering 429 with Retry-After.
36
+ - Cloud profile prep: dayfile.cloud for tenants and dayfile.app for the site, `cloud-init.yaml` for the Droplet, `smoke-test.sh` for after first boot, `team@dayfile.app` as the security contact.
37
+ - Feeds advertise the dayfile icon (JSON Feed `icon`/`favicon`, Atom `<icon>`), served as PNGs on every host.
38
+ - Web: visual refresh (hero with a log mock-up, cards, code samples, amber accents, status-coloured events).
39
+ - Web: bundled fonts (later replaced by Source Sans 3 and JetBrains Mono) (SIL OFL, served from the same origin, CSP gains `font-src 'self'`); the homepage now points at invite sign-in.
40
+ - Quick post: `POST /events` accepts just `{"title": ...}`; the server fills id, type, time and (for a one-source write token) the source.
41
+ - The web app's libraries (jinja2, python-multipart) are an optional extra, `dayfile[web]`; a test keeps the core free of web imports.
42
+ - M16a: accounts store (`dayfile.web.accounts`), invite codes (hashed, single-use by default, atomic redemption) and the `python -m dayfile.web.admin` operator CLI. Not wired into the site yet.
43
+ - Cloud profile: every service rotates its Docker logs (10 MB x 3); `exim4` is not needed on the host.
44
+ - M16b: admin API under `/internal/admin/` (tenants, tokens, suspend, delete) behind a shared-secret file, `dayfile.admin` events in the tenant log, token `last_used` (schema 8).
45
+ - Cloud profile: `setup-backup.sh` writes the root-only rclone config (Spaces key plus encryption password and salt) from hidden prompts and proves it with an encrypted round trip.
46
+ - Backups: `dayfile tenant backup-all` stages verified copies and each tenant.json inside the container; `backup-tenants.sh` uploads them from the host; systemd service and timer run it nightly.
47
+ - M17: named feeds (`/f/<name>.json|.atom|.cloudevents`, bare `/f/<name>` and `/feed` give JSON Feed), per-feed private or public visibility, anonymous reads of public feeds (events labelled `public` only, short public cache, own rate budget), `public` events visible to all readers, `dayfile feed` commands and admin API routes.
48
+ - M16c: sign in with GitHub (OAuth with PKCE, no scope), opaque server-side sessions, invite-code signup with terms acceptance, a minimal account page. Off until a GitHub OAuth app is configured.
49
+ - M16d: account dashboard: choose a permanent log name (creates the tenant through the admin API), create and revoke tokens, create and publish feeds, open the viewer. The admin secret is wired between the API and web containers.
50
+ - Usernames can be changed (the old name is held for its owner for one day); the homepage card says you.dayfile.cloud.
51
+ - Web: the header shows Account or Your log when signed in; the homepage card is tilted a little more.
52
+ - Web: the signed-in layout is Log, Feeds, Tokens and Settings (a gear); the Log has a Post button that opens a dialog, cards with a relative time, a short id, colored status, tags and Markdown details, and a History of closing steps with Undo. Docs open with a diagram of logs, tokens and feeds; the footer has the docs link, copyright and email and GitHub icons.
53
+ - `type` is optional. Only a `todo` has a status (`open`, then `closed`); other events have none (`status=none`). `status=done` is still accepted as `closed`. A closing, replacing or retracting event may omit `title` and inherits its target's.
54
+ - The service's own housekeeping records (`dayfile.admin`) are left out of feeds and the Log unless asked for.
55
+ - Source Sans 3 and JetBrains Mono are the site fonts (SIL OFL); the repository moved to the `dayfile` GitHub organization.
56
+ - M16e: Settings can download the whole log (gzipped SQLite, integrity-checked) and delete the account (type the username); `dayfile tenant purge` and a weekly timer remove deleted logs after 30 days; terms and privacy describe it.
57
+ - Backups: `dayfile tenant verify-backup DIR` and `deploy/cloud/restore-drill.sh` (read-only restore drill, prints the elapsed time); results go in `docs/ops/drills.md`.
@@ -0,0 +1,74 @@
1
+ # dayfile
2
+
3
+ A personal, append-only event log exposed as feed views (Atom, JSON Feed). Events arrive from many sources (email, SMS, webhooks, cron generators, devices, agents). The log is the source of truth. Feeds are projections of it, addressed by URL queries such as `/feed.json?tag=todo&status=open&within=7d`.
4
+
5
+ Operations (servers, DNS, monitoring, secrets, rebuild from zero, incidents) are in `docs/ops/README.md` (the operator's private handbook: kept out of git, so it exists only in the maintainer's checkout). Read `docs/SPEC.md` for the event model and `docs/ROADMAP.md` for the milestones. Build one milestone at a time.
6
+
7
+ ## Stack (override here if you change it)
8
+
9
+ - Python 3.11 or newer (tested on 3.11 to 3.15), `uv` for env and deps
10
+ - FastAPI + uvicorn for HTTP
11
+ - stdlib `sqlite3`, no ORM; schema lives in `schema.sql`
12
+ - `jsonschema` for envelope validation, schema in `schema/event.schema.json`
13
+ - `cryptography` (Ed25519) and `rfc8785` (JSON canonicalization) for signing, from milestone M7
14
+ - `jinja2` and `python-multipart` for the web app (`src/dayfile/web`, M15), an optional extra: `pip install dayfile[web]`; htmx is vendored, not installed. Core code never imports `dayfile.web` (tests/test_boundaries.py)
15
+ - `pytest` for tests, `ruff` for lint and format
16
+ - Ask before adding any other dependency.
17
+
18
+ ## Commands (create these as part of M0)
19
+
20
+ ```
21
+ uv sync
22
+ uv run pytest
23
+ uv run ruff check . && uv run ruff format --check .
24
+ uv run uvicorn dayfile.app:app --reload
25
+ ```
26
+
27
+ ## Planned layout
28
+
29
+ ```
30
+ src/dayfile/
31
+ app.py FastAPI app and routes
32
+ db.py connection setup, schema load, queries
33
+ models.py event dataclasses and validation helpers
34
+ timefmt.py UTC normalization and the one allowed timestamp format
35
+ ingest/ adapters: http, email (IMAP), sms-gateway, cli
36
+ render/ atom.py, jsonfeed.py, query parsing
37
+ auth/ tokens, audience resolution
38
+ notify/ ntfy publisher, scheduler loop
39
+ gen/ generators: weather, digests
40
+ tests/
41
+ schema.sql
42
+ schema/event.schema.json
43
+ examples/events.jsonl
44
+ docs/
45
+ ```
46
+
47
+ ## Invariants (do not break these; add a test for each)
48
+
49
+ 1. **Append-only.** Events are never updated or deleted. Triggers in `schema.sql` enforce it. State changes are new events that point back through `refs`.
50
+ 2. **One timestamp format.** UTC, `YYYY-MM-DDTHH:MM:SSZ`, normalized at ingest. The SQL CHECK constraints reject anything else. String order then equals time order.
51
+ 3. **Paginate by `seq`**, never by timestamp. Late-arriving items with old `occurred_at` must not be skipped by readers.
52
+ 4. **Time release.** A feed shows an event only when `visible_at <= now` and it is not past `expires_at`.
53
+ 5. **Idempotent ingest.** `UNIQUE (source_id, source_ref)`. Re-delivering the same email or webhook is a no-op that returns the existing event.
54
+ 6. **Plain-text fallback.** Every event has a `title`. Renderers work with `title` and `body` alone, ignoring `payload`.
55
+ 7. **Deny by default.** A missing or empty `audience` means `["self"]`. A request's audience comes from its credential, never from the URL.
56
+ 8. **No cross-credential cache leaks.** Any response whose content depends on the credential sends `Cache-Control: private`, `Vary: Authorization`, and an ETag that includes the caller's identity.
57
+ 9. **Never log secrets.** Tokens are stored hashed. Log token ids, never token values.
58
+ 10. **Signatures cover the canonical form** (RFC 8785) of the event minus `sig`. Server-assigned fields (`seq`, `recorded_at`) stay outside the signature.
59
+
60
+ ## Known tradeoff
61
+
62
+ Feed readers rarely send custom headers, so v0 accepts a per-feed token in the URL path (`/t/<token>/feed.json`). Mitigations: store only a hash, make tokens expire, scope each token to a set of audience labels, support revocation, and support the `Authorization: Bearer` header for programmatic clients. Treat the URL-token path as a compatibility layer to replace later (see M8).
63
+
64
+ ## Conventions
65
+
66
+ - There is no event `type`. The tag `todo` makes an event a to-do (open until closed). Housekeeping events carry the tag `dayfile-admin`.
67
+ - Event ids are ULIDs. For email, derive `source_ref` from a hash of `Message-ID`.
68
+ - Write the test first for any behavior listed in the invariants.
69
+ - Keep functions small and typed. Public functions get a one-line docstring.
70
+ - Commit per milestone step with a message that names the milestone (`M2: atom renderer`).
71
+
72
+ ## Definition of done for a milestone
73
+
74
+ All acceptance criteria in `docs/ROADMAP.md` pass, `pytest` and `ruff` are clean, and `docs/SPEC.md` matches the behavior. Update the spec in the same commit as any behavior change.
@@ -0,0 +1,7 @@
1
+ # Code of conduct
2
+
3
+ Be respectful and constructive. Critique code and ideas, not people. Harassment, discrimination,
4
+ and personal attacks are not welcome in issues, pull requests, or any project space.
5
+
6
+ Maintainers may edit or remove contributions, and block participants, that break these rules.
7
+ Report a problem to team@dayfile.app; reports are handled privately.
@@ -0,0 +1,16 @@
1
+ # Contributing
2
+
3
+ Thanks for helping. Read `docs/SPEC.md` (the event model) and `CLAUDE.md` (the invariants: append-only,
4
+ one timestamp format, seq cursors, deny-by-default audiences, no secret logging).
5
+
6
+ ```
7
+ uv sync
8
+ uv run pytest
9
+ uv run ruff check . && uv run ruff format --check .
10
+ ```
11
+
12
+ - Write the test first for anything covered by an invariant, and update `docs/SPEC.md` in the same change.
13
+ - One milestone-sized change per pull request; commit messages name the step (`M10: ...`).
14
+ - Ask before adding a dependency. The runtime set is deliberately small.
15
+ - By contributing you agree that your work is licensed under AGPL-3.0-only, the project license.
16
+ - Security problems: see `SECURITY.md`, not a public issue.
@@ -0,0 +1,15 @@
1
+ FROM python:3.15-slim
2
+ COPY --from=ghcr.io/astral-sh/uv:0.5 /uv /usr/local/bin/uv
3
+ WORKDIR /app
4
+ COPY pyproject.toml uv.lock README.md ./
5
+ COPY src ./src
6
+ COPY schema.sql ./
7
+ COPY schema ./schema
8
+ RUN uv sync --frozen --no-dev --extra web --extra mcp # one image: the API, the web app and /mcp
9
+ RUN useradd --system --create-home --uid 10001 dayfile && mkdir /data && chown dayfile /data
10
+ USER dayfile
11
+ ENV DAYFILE_DB=/data/dayfile.db PATH="/app/.venv/bin:$PATH"
12
+ VOLUME /data
13
+ EXPOSE 8000
14
+ HEALTHCHECK --interval=30s --timeout=3s CMD python -c "import urllib.request as u; u.urlopen('http://127.0.0.1:8000/healthz', timeout=2)"
15
+ CMD ["uvicorn", "dayfile.app:app", "--host", "0.0.0.0", "--port", "8000", "--proxy-headers"]