1e done: compressed to a pointer at the API and tests. Generated-by: Claude Opus 5.5
149 lines
7.7 KiB
Markdown
149 lines
7.7 KiB
Markdown
# capsite goal tree
|
|
|
|
Nested checkboxes form the goal tree itself: 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; [the capsite notes](capsite-notes.md) carry the background
|
|
narrative.
|
|
|
|
- [ ] **EmDash site (madmode) collects diigo.com bookmarks; credentials
|
|
held by the host, never inside the plugin** (background:
|
|
[the capsite notes](capsite-notes.md); after step 2, expands to
|
|
[bib sync #195](https://github.com/dckc/madmode-blog/issues/195))
|
|
|
|
- [x] Credential discipline: no worker secrets; the cookie lives only
|
|
in webapp's DO storage, ids are held by the user
|
|
([AGENTS.md](AGENTS.md), secrets section).
|
|
- [x] **1. Cookie-path dump worker**: port of mm-diigo's diigo-dump.mjs
|
|
(verified 2026-10-06: 200, `total: 1674`); evolved into 1c.
|
|
- [x] **1b. webapp DO factory** ([webapp/README.md](webapp/README.md));
|
|
mint verified end-to-end in dev 2026-10-07 (via 1c). Prod mint is
|
|
goal 5.
|
|
|
|
- [x] **1c. diigo-dump evolves into a bookmark cache**
|
|
([diigo-cache/README.md](diigo-cache/README.md); design in the
|
|
JSDoc of `src/cache.ts`, `src/index.ts`, `src/pm-save.ts`):
|
|
- [x] 1c-i. Two independent page caches, private and public
|
|
(`PagedCache`, `DiigoCache`, `PublicCache`).
|
|
- [x] 1c-ii. Create flow on one port: `/_connect` → `/_mint`
|
|
→ `/_wire` (`mintPage`, `proxyMint`, `wire`).
|
|
- [x] 1c-iii. Ids saved by explicit user action under the
|
|
holder's petname (`pmSave`); pages show a fingerprint
|
|
(`nick`).
|
|
- [x] 1c-iv. Verified against live diigo in dev, 2026-10-07:
|
|
create, dump, publish; `/public/dckc-madmode?page=4` →
|
|
`cache: HIT`.
|
|
- [x] 1c-v. Tests: `pnpm lint && pnpm test` (the real worker +
|
|
DOs against [a fake webapp](diigo-cache/tests/fake-webapp.js)).
|
|
|
|
- [ ] **1d. Date windows and search on the public page**, toward the
|
|
weekly PESOS roundup of [#23](https://github.com/dckc/madmode-blog/issues/23)
|
|
(a week's permalink: `in=2026-W41`). One filter, two spellings:
|
|
devs pass `{ days: 7, q: "#weekly" }`, URLs the same fields;
|
|
`q` takes gmail/Slack/GitHub operators. UTC, ISO weeks, half-open
|
|
windows; a fetch budget per request. Design: the API in
|
|
`diigo-cache/src/query.ts` and the skipped suites in
|
|
`tests/query.test.ts` and `tests/caches.test.ts` ("public page
|
|
filters"); done when they're unskipped and green.
|
|
|
|
- [x] **1e. Fill job: a button that grabs every page** into a cache
|
|
(`POST /_fill`; `startFill`/`fillStatus`/`stopFill` in
|
|
`diigo-cache/src/cache.ts`; `tests/fill.test.ts`).
|
|
|
|
- [ ] **2. madmode collects real bookmarks via the webapp cookie path**
|
|
(the API-key path is dead: [evidence in the notes](capsite-notes.md#where-the-diigo-credentials-go))
|
|
- [ ] 2-i. Plugin rides the cache: plugin's sync calls
|
|
diigo-cache's DiigoBridge (cache id by wiring, not
|
|
secret); cookie + host gate stay host-side.
|
|
- [ ] 2-ii. Plugin "Sync now" succeeds: status 200, bookmarks
|
|
stored (admin at /_emdash/admin → Diigo Sync).
|
|
- [ ] 2-iii. Cookie-expiry story for cron: rotation is manual
|
|
(re-create via the home page form; the cache id rotates
|
|
with it) unless we automate it later.
|
|
- [ ] **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-cache: deploy + first create against prod
|
|
(ids → password manager; no worker secret put needed);
|
|
rate-limit the public routes first (diigo-cache README,
|
|
"Deployment concern").
|
|
- [ ] 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-cache + webapp in one workerd):
|
|
|
|
cd ~/oros-bots/capsite/diigo-cache
|
|
pnpm dev # → http://localhost:8787
|
|
# webapp rides along (binding-only)
|
|
|
|
First connect (or re-connect after cookie expiry) — browser flow, two steps:
|
|
|
|
open http://localhost:8787/
|
|
# 1. "mint the diigo session at webapp" → webapp's own mint form
|
|
# (diigo-prefilled, served on :8787); paste the Cookie header from
|
|
# diigo.com devtools → mint (the cookie transits diigo-cache as an
|
|
# opaque relay into webapp's DO only)
|
|
# 2. the wire step: webapp id pre-filled, choose public|private →
|
|
# cacheId; copy the ids somewhere you control (password manager),
|
|
# paste the cacheId into the dump form
|
|
# (no .dev.vars, no restarts: ids ride the form POSTs / your paste)
|
|
|
|
Terminal flow (the same shape, scripted):
|
|
|
|
wid=$(curl -s -X POST http://localhost:8787/_mint --data-urlencode \
|
|
'url=https://www.diigo.com/interact_api/' --data-urlencode \
|
|
'headers={"user-agent":"Mozilla/5.0","x-requested-with":"XMLHttpRequest","cookie":"<paste>"}' \
|
|
--data-urlencode 'msPerCall=500' -D - -o /dev/null | grep -i x-webapp-id)
|
|
curl -s -X POST http://localhost:8787/_wire -H 'content-type: application/json' \
|
|
-d "{\"webappId\":\"<from $wid>\",\"mode\":\"private\"}"
|
|
|
|
Then: enter a page number, dump → JSON rows with a `cache: HIT/MISS`
|
|
line (a repeat page is answered from DO sqlite storage). GET / is inert
|
|
(dumps happen only on POST submits). Public pages:
|
|
/public/<username>?page=n (each page fills from diigo on first visit).
|
|
A private-only cache can be published later from its created page
|
|
(`POST /_publish`, cache id in the body).
|
|
|
|
Checks: `cd diigo-cache && pnpm lint && pnpm test`.
|
|
|
|
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
|
|
|
|
## Working rules
|
|
|
|
Agent working rules are in [AGENTS.md](AGENTS.md) — dev servers are the
|
|
user's job; durable state (loud about breaking changes); secrets
|
|
discipline; keep config types generated. They apply
|
|
to every goal in this tree.
|
|
|
|
## Pointers
|
|
|
|
- [the capsite notes](capsite-notes.md) — the original goal and the EmDash
|
|
native-plugin wiring details
|
|
- [docs/webkeys.md](docs/webkeys.md) — the Waterken URL-capability
|
|
pattern, abstracted from the E-on-Java sources (bearer secrets,
|
|
YURL32, secret≠address); the reason ids never ride URLs
|
|
- [the mm-diigo diigo-bak scripts](https://github.com/dckc/mm-diigo) —
|
|
provenance of the fluent client and dump generator (`projects/diigo-bak/`:
|
|
WebApp.js, diigo-dump.mjs, diigo-interact.mjs; mm-diigo commit 7dbb367,
|
|
Oct 6 2026)
|
|
- [webapp/README.md](webapp/README.md) — HTTP + RPC surfaces of the
|
|
factory worker; open TODO on the mint-form placement
|
|
- [diigo-cache/README.md](diigo-cache/README.md) — the cache worker:
|
|
create flow, the two DOs, run/deploy details |