Skip to content

Share feature#2

Merged
tomasz-tomczyk merged 13 commits intomainfrom
feature/share
Feb 19, 2026
Merged

Share feature#2
tomasz-tomczyk merged 13 commits intomainfrom
feature/share

Conversation

@tomasz-tomczyk
Copy link
Copy Markdown
Owner

Share feature

  • Added a Share button that POSTs the document + comments to a crit-web instance
  • The share URL and delete_token are persisted to .comments.json for resume support
  • Added an Unpublish button that calls the remote DELETE endpoint and clears local state
  • Added DELETE /api/share-url backend endpoint; GET /api/config now exposes delete_token
  • Default share URL set to crit.live

Locally, body size limit increased to 10MB

tomasz-tomczyk and others added 13 commits February 18, 2026 20:03
- --share-url CLI flag (falls back to CRIT_SHARE_URL env var) wires
  the hosted service URL into the frontend via GET /api/config
- Share button appears in header only when a share URL is configured;
  POSTs {content, filename, comments} to {shareURL}/api/reviews
- Success: shows URL banner with Copy link button
- Error: shows error banner with Retry button
- Body limit raised from 1MB to 10MB on comment endpoints

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Remove hardcoded data-theme="dark" from <html>
- :root provides dark values as fallback (unknown/legacy browsers)
- @media (prefers-color-scheme: light) overrides for OS-light when no explicit theme
- Theme toggle cycles system → dark → light → system (◐ / ☽ / ☼)
  with localStorage persistence via 'crit-theme' key
- getMermaidTheme() checks window.matchMedia when no data-theme is set
- Share URL defaults to https://crit.live; overridable via CRIT_SHARE_URL env
  or --share-url flag

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…riven)

Port the Phoenix Layouts.theme_toggle pill to vanilla HTML/CSS — same visual
metaphor: system / light / dark trio, sliding indicator, accent-colored active
button. Indicator position driven purely by CSS (html[data-theme] selector)
so it works even before JS runs. Heroicons SVGs inlined directly.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Replace old .theme-toggle grid rule with .theme-pill in mobile breakpoint
  so the pill is correctly placed (col 3, row 1) instead of stretching
- Add ShareURL field to CommentsFile persisted in .comments.json
- Load sharedURL before hash check so it survives file changes
- Add GetSharedURL/SetSharedURL methods; WriteFiles snapshots sharedURL
- Add POST /api/share-url endpoint; expose hosted_url in GET /api/config
- On init: show share banner if URL already persisted
- On Share click: show existing URL if already shared instead of re-posting

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- document_test: TestSetGetSharedURL, TestSharedURL_PersistedAndLoaded,
  TestSharedURL_PersistsWhenStale, TestWriteFiles_SharedURLOnlyCreatesFile
- server_test: TestGetConfig, TestGetConfig_MethodNotAllowed,
  TestPostShareURL, TestPostShareURL_MethodNotAllowed,
  TestPostShareURL_EmptyURL, TestPostShareURL_InvalidJSON
- Register /api/config and /api/share-url in newTestServer helper

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Share notice:
- Neutral background instead of green tint
- URL gets a dark chip background
- Copy link button uses new btn-success (green outline)
- Unpublish stays red, Dismiss stays neutral

Agent prompt panel (crit-web):
- "Get prompt" button in header toggles panel
- Shows export URL as a copyable prompt block
- Copy button shows "✓ Copied" feedback for 2s

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@tomasz-tomczyk tomasz-tomczyk merged commit f9d4c82 into main Feb 19, 2026
@tomasz-tomczyk tomasz-tomczyk deleted the feature/share branch February 20, 2026 20:52
tomasz-tomczyk pushed a commit that referenced this pull request Apr 29, 2026
Spec §E "Re-anchoring" trigger #2: re-opening `crit --pr 123` after the PR
head moved should re-anchor existing comments. The in-SetFocus reanchor
branch only fires for range→range transitions; on boot the prior focus is
FocusWorkingTree, so the branch is skipped and stored comments retain their
old HeadSHA — invisible to visibleInFocus and flagged Stale.

Adds Session.ReanchorOnBoot(focus) — walks the on-disk review file for
comments whose HeadSHA differs from the new focus's HeadSHA, runs
reanchorComments per unique old SHA, persists, reloads in-memory state, and
emits the same `reanchor` SSE event as the SetFocus path.

applySessionOverrides invokes it after SetFocus (and only on success — a
failed SetFocus already leaves working-tree state intact and reports via
stderr; reanchoring after a failure would mutate disk based on a focus
that's not actually adopted).

Test: TestReanchorOnBoot constructs a real two-commit fixture where target
content moves from line 2 to line 4, seeds a comment at oldHead/line 2,
then SetFocus(newHead) + ReanchorOnBoot(focus) and asserts the comment is
re-anchored to line 4 with HeadSHA updated and Stale=false.
TestReanchorOnBoot_NoOp covers the working-tree and empty-comment paths.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
tomasz-tomczyk added a commit that referenced this pull request Apr 29, 2026
…pe test

Bundle of low-risk improvements flagged by the independent review:

Popover keyboard + a11y
- Add `role="listbox"` to the focus-picker list and `role="option"` +
  `aria-selected` + `tabindex="-1"` to each item, matching the listbox
  pattern the popover already implies via aria-haspopup.
- Add Escape handler that closes the popover and returns focus to the
  trigger button — same pattern as the commit-picker.

Stable test attributes
- `data-label` on each picker item (lifts the label out of rendered DOM
  children, replacing brittle `evaluate(() => innerText)` reads in
  focus-picker spec).
- `data-focus-kind` on each item, replacing the substring-match selector
  `[data-focus-payload*="working_tree"]` which would false-positive on any
  payload that happened to contain that string.

Brittle test fixes
- comment-stale spec: replace `stackOrdered[1]` with a feat-b-relative
  lookup so fixture growth doesn't silently shift the test.

Net new coverage
- scope-toggle-files: new test asserts a layer-scoped comment is hidden
  in full-stack and reappears when the user flips back. This is the
  lossless-visibility invariant — the only regression test against
  accidentally serialising scope-filtered comments out to disk.

Skipped from the polish list (with reasons):
- Branches-section base_sha precompute (#2) — server-side change, owned
  by go-expert; would be a separate ticket.
- Pre-feature comment WT-only test (#6) and /api/focus error-rollback
  toast test (#7) — both require fixture or daemon-state changes that
  exceed the 30-min budget for "polish".

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant