Document design decisions; update plan to reflect dropped jwt.ts

This commit is contained in:
Ivan Pereira
2026-02-23 10:49:49 +00:00
parent 431a814e9a
commit a01f0681a0
3 changed files with 17 additions and 6 deletions
+9
View File
@@ -0,0 +1,9 @@
# Design Decisions
## AUTH errors do not auto-clear the cached token
When Perplexity returns 401/403 and `SearchError("AUTH")` is thrown, `src/index.ts` returns an error message directing the user to run `/perplexity-login --force`. It does **not** call `clearToken()` automatically.
**Rationale:** A 401 can be transient — network blip, Cloudflare hiccup, clock skew. Auto-clearing on every 4xx would silently discard a still-valid token and force unnecessary re-authentication. The user decides when to re-login. `/perplexity-login --force` clears and re-authenticates in one explicit step.
The token is only cleared when the user explicitly requests it (`--force`) or calls `clearToken()` directly (e.g. in tests or future tooling).