agentleFS
tomasz-tomczyktomasz-tomczyk/crit/.cursor/rules/proxy-auth-transport.mdc

crit / rules

Cursor rule1.2k starsChanged 2 months agoMITView on GitHub

crit — proxy auth transport

Trending

Less talk lately.about the whole repository

Dec 2025: 0 mentionsJan 2026: 0 mentionsFeb 2026: 0 mentionsMar 2026: 2 mentionsApr 2026: 1 mentionMay 2026: 1 mentionJun 2026: 9 mentionsJul 2026: 10 mentionsAug 2026: 11 mentionsSep 2026: 11 mentionsOct 2026: 5 mentionsNov 2026: 0 mentions
Dec 2025Jun 2026Nov 2026
Mentions a month of the tomasz-tomczyk/crit repository that our weekly crawl found. There is no adoption data for this file yet.

Who's talking about tomasz-tomczyk/crit

The biggest 5 of 50 mentions linking to the repository that our crawl found. Each line is their own headline.

See all 50

Talked about on GitHub, Bluesky and Hacker News (50 times).

On GitHub · 46

41 more on GitHub

On Hacker News · 1

The file

We split this proxy-auth-transport.mdc into the rules it gives an agent

8 rules. About 0 are common, 0 are distinctive, and 8 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 8

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Every CLI command or browser UI action that calls a crit-web API must work in both modes:

    line 12
  2. Very specific:

    When adding a new crit-web interaction:

    line 16
  3. Very specific:

    Add the direct HTTP path in Go (share.go or relevant file)

    line 17
  4. Very specific:

    Add a server endpoint that returns the payload for the popup relay (server.go)

    line 18
  5. Very specific:

    Add a popup handler in crit-web/assets/js/share_receiver/handlers.js (note: the directory/route is named share_receiver / /share-receiver — …

    line 19
  6. Very specific:

    Add the relay call in web/app.js gated on proxy_auth

    line 20
  7. Very specific:

    When proxy_auth: true (global config), crit-web sits behind an SSO reverse proxy.

    line 28
  8. Very specific:

    When adding a new crit-web interaction, decide which surface owns it:

    line 47

≈ “Common” is an estimate: at least 1 in 5 of the 3,030 Cursor rule files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
proxy-auth-transport.mdc
---
description: crit — proxy auth transport
alwaysApply: false
---

# Proxy Auth Transport Rules



## Rule 1: Both transport modes required

Every CLI command or browser UI action that calls a crit-web API must work in both modes:
- **Direct** (default): Go server makes HTTP requests with bearer token
- **Browser relay** (`proxy_auth: true`): Browser popup mediates the same API call through an authenticated session

When adding a new crit-web interaction:
1. Add the direct HTTP path in Go (share.go or relevant file)
2. Add a server endpoint that returns the payload for the popup relay (server.go)
3. Add a popup handler in `crit-web/assets/js/share_receiver/handlers.js` (note: the directory/route is named `share_receiver` / `/share-receiver` — this describes what the component *does* (receives share data), while `proxy_auth` describes *why* it's needed. Both names are correct at their level.)
4. Add the relay call in `web/app.js` gated on `proxy_auth`

## Rule 2: Relay is transport, not protocol

The popup relay must hit the **same crit-web API endpoints** with the **same payload shapes** as the direct path. No relay-specific endpoints on crit-web. The popup handlers are same-origin fetch proxies.

## Rule 3: Terminal CLI commands cannot use direct HTTP when proxy_auth is on

When `proxy_auth: true` (global config), crit-web sits behind an SSO reverse proxy. The terminal cannot complete that auth flow — only the browser can (via the `/share-receiver` popup relay).

**Terminal subcommands** that HTTP-call crit-web directly (today: `crit share`, `crit fetch`, `crit unpublish`) must call `checkProxyAuthCLIAllowed("crit <cmd>")` at the top of their `Run*` entrypoint and exit with the shared error message. Do not attempt the network call.

**Browser UI actions** (Share / Pull / Unpublish / Re-share buttons in the review page) must still work: implement both transports per Rule 1 — direct when `proxy_auth` is false, popup relay when true (`web/crit-share.js` + crit-web `share_receiver/handlers.js`).

Direct (non-proxy_auth) browser actions must go through the **local Go server**, never `fetch(shareURL + …)` cross-origin:

| Action    | Local endpoint                          |
|-----------|-----------------------------------------|
| Share     | `POST /api/share`                       |
| Pull      | `POST /api/share/pull`                  |
| Re-share  | `POST /api/share/reshare`               |
| Unpublish | `DELETE /api/share-url`                 |

(The Go handlers attach the bearer token and talk to crit-web. Cross-origin browser fetches fail CORS on selfhosted+OAuth instances because preflight has no `Authorization`, and even with CORS fixed the browser never sends the token.)

The `share-transport` Playwright project (`test/e2e/tests/share-transport.sharetransport.spec.ts`) drives these three actions against a stub crit-web on a different origin and fails if the page issues any request to it, so a regression to cross-origin fetches is caught in CI. Extend that spec when you add a browser action that talks to crit-web.

When adding a **new** crit-web interaction, decide which surface owns it:
- **Browser-only** (like today's share/pull/unpublish behind SSO): block the terminal path with `checkProxyAuthCLIAllowed`; add relay handler + frontend branch.
- **Terminal-only** (rare): document that it won't work behind SSO, or don't add it.
- **Both**: direct Go HTTP path + browser relay path; terminal path still blocked when `proxy_auth` is on unless you have a non-HTTP auth story.

Integration tests that spawn the `crit` binary must isolate config — use `runCritCmd` / `runCritCmdWithHome` with a temp `HOME`, not the developer's real `~/.crit.config.json`.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.