Files
captoys/capsite-checklist.md
T
Connolly e1c3e9b5c6 docs: checklist to goal tree
Explicit tree semantics in the header: a goal is checked only when all
its children are (leaves: when verified). Architecture sketch moved out
(its content already lives in capsite-notes.md + per-worker READMEs;
duplicates would drift) — the tree's items carry just enough provenance
to stay self-contained. Adds 1b-i/1b-ii mint-loop subgoals and the 2-iii
decision point (API key vs cookie path for the plugin) surfaced this
session; hard rules + run instructions retained.

Generated-by: opencode (GLM)
2026-10-06 23:33:28 -05:00

116 lines
5.8 KiB
Markdown

# capsite goal tree
Nested checkboxes form a goal tree: each `- [ ]` is a goal; its indented
children are the subgoals/steps that must pass before it (an item is only
checked when **all** its children are checked — or, for leaf items, when
it has passed verification itself). Working notes live under each goal;
`capsite-notes.md` carries the background narrative.
## the goal tree
- [ ] **EmDash site (madmode) collects diigo.com bookmarks; credentials
held by the host, never inside the plugin** (background:
capsite-notes.md; after step 2, expands to bib sync #195)
- [x] Credential discipline established: cookies/keys/secrets live in
Worker secrets or DO storage, never in source, config, or the
plugin. (`.dev.vars` gitignored: only `DIIGO_WEB_ID`;
cookie lives in the webapp DO's storage since the 1b split.)
- [x] **1. Cookie-path dump worker** (`diigo-dump/`): port of
mm-diigo's diigo-dump.mjs. GET inert, dump only on POST.
Verified 2026-10-06: 200, `total: 1674`. (Scrubbed: static
API-key ping worker 401'd — the cookie path was the one that
worked; see the API-key subgoal below for where that left us.)
- [x] **1b. webapp DO factory** (`webapp/`): credentialed authority
in a Durable Object; ids are bearer capabilities (not logged);
factory worker is site-agnostic; consumer holds only the id.
Dev wiring verified: `pnpm dev` boots both, home + /_connect
answer on :8787.
- [ ] 1b-i. Mint through the running dev server end-to-end:
POST /_mint (or /_connect page) with a fresh cookie →
id → dump page 1 through the DO → 200/items.
(Everything up to mint is verified; this closes the loop.)
- [ ] 1b-ii. Prod mint + handoff: deploy both, mint against
prod, `wrangler secret put DIIGO_WEB_ID`, dump a page.
- [ ] **2. madmode collects real bookmarks** (the API-key path)
- [ ] 2-i. Real API key: fetch from
https://www.diigo.com/settings/api; put in
`madmode/.dev.vars` (placeholder now; 401s).
- [ ] 2-ii. Plugin "Sync now" succeeds: status 200, bookmarks
stored (admin at /_emdash/admin → Diigo Sync).
- [ ] 2-iii. DECISION POINT: if the API-key path stays 401,
consider riding the plugin on the webapp cookie path
instead (plugin already declares the host gate; the DO
would hold the cookie). Prefer the API key if it works —
a static key beats a session cookie for cron.
- [ ] **3. `/bookmarks` renders real data** after a sync — titles/tags at
http://localhost:4321/bookmarks.
- [ ] **4. Cron sync** works locally without errors (`0 */6 * * *` in
`_emdash_cron_tasks`).
- [ ] **5. Deployed end-to-end** (order matters; webapp first):
- [ ] 5-i. webapp: `cd webapp && npx wrangler deploy`
- [ ] 5-ii. diigo-dump: deploy + prod mint + `wrangler secret
put DIIGO_WEB_ID` (id from x-diigo-web-id header)
- [ ] 5-iii. madmode: `pnpm wrangler deploy`, secrets via
`wrangler secret put`; plugin "Sync now" against prod
- [ ] **6. bib sync #195**: repeat the pattern for the next
read-access need.
- [ ] **webapp graduates from prototype** (optional; only if it earns it)
- [ ] TODO(webapp): one canonical mint form — proxy-page (current) vs
running webapp as the primary worker so its own port serves the
form directly; revisit as the UI grows.
- [ ] @endo/errors for structured error details (needs node_modules).
## How to run (continuation prompts)
Dev (diigo-dump + webapp in one workerd):
cd ~/oros-bots/capsite/diigo-dump
pnpm dev # → http://localhost:8787
# webapp rides along (binding-only)
First connect (or re-connect after cookie expiry) — browser flow, primary:
open http://localhost:8787/_connect
# paste the Cookie header from diigo.com devtools; mint
# success page shows a copy button for the id
# add DIIGO_WEB_ID="<id>" to diigo-dump/.dev.vars (only the id lives
# on disk; the cookie lives in the DO's storage)
# restart wrangler (pnpm dev) to pick it up
Terminal flow (superseded by the page; needs a display):
pnpm -s diigo-login >> .dev.vars # askpass prompt; appends the id line
# (.dev.vars: pnpm stdout noise can
# interleave; grep ^DIIGO_ to clean)
Then: enter a page number on the home page, dump → JSON items. GET /
is inert (no accidental fetches; dumps happen only on POST submits).
madmode (EmDash site; separate worker, separate concerns):
cd ~/oros-bots/capsite/madmode && pnpm dev # → :4321
# admin at /_emdash/admin; dev-bypass auth helper:
# /_emdash/api/setup/dev-bypass?redirect=/_emdash/admin
## Hard rules (learned 2026-10-06/07; keep them)
- The ASSISTANT never runs wrangler/astro dev servers; the user does
(assistant watches work happen via .tmp/capsite.script; one-shot
codegen like `wrangler types` is fine).
- Worker secrets never in source/config; `.dev.vars` (gitignored) locally,
`wrangler secret put` deployed. Since the DO split, only DIIGO_WEB_ID
is a diigo-dump secret at all.
- Error messages must not contain header or param values (they cross RPC
as exceptions and land in logs); URLs appear query-stripped.
- `wrangler types` after any wrangler.jsonc change (generated
worker-configuration.d.ts is gitignored).
## Pointers
- capsite-notes.md — the original goal + EmDash wiring details
- ../mm-diigo/projects/diigo-bak/ — provenance of the fluent client and
dump generator (WebApp.js, diigo-dump.mjs, diigo-interact.mjs;
commit 7dbb367, Oct 6 2026)
- webapp/README.md, diigo-dump/README.md — per-worker details