Commit Graph
37 Commits
Author SHA1 Message Date
Ivan PereiraandGitHub 692d39e618 Merge pull request #3 from ivanrvpereira/issue-2-expose-model-preference
feat: expose model preference and incognito as configurable parameters
2026-03-22 00:25:55 +02:00
Ivan Pereira e1a0a17f04 docs: add CHANGELOG.md 2026-03-21 21:34:17 +00:00
Ivan Pereira 0f301e7f47 fix(test): isolate tests from mock.module cache pollution
mock.module() in index-execute.test.ts permanently poisons Bun's
module cache — mock.restore() does not undo it in Bun 1.3.11.

Use cache-busted dynamic imports (../src/mod.ts?t=${Date.now()}) in
beforeEach for the three affected test files so each test gets a
fresh, unpoisoned module instance.
2026-03-21 21:29:00 +00:00
Ivan Pereira 96a3246d1e fix(search): restore error rendering and safe error handling
- Re-add isError flag to error details so renderPerplexityResult
  shows error styling instead of green success rows
- Use errorMessage() for unknown errors instead of unsafe cast
- Trim whitespace-only PI_PERPLEXITY_MODEL env var values
- Add comment explaining clearToken() on AUTH rejection
2026-03-21 21:28:51 +00:00
Ivan Pereira fcc7613edc fix(config): simplify current model label 2026-03-21 21:02:44 +00:00
Ivan Pereira 041d30651a fix(config): apply defaults to perplexity UI 2026-03-21 20:54:41 +00:00
Ivan Pereira 11c543c0de 0.1.3 2026-02-23 18:07:48 +00:00
Ivan Pereira 89b4ea50d0 Add pi-extension keyword 2026-02-23 18:07:36 +00:00
Ivan Pereira a9007cd69a 0.1.2 2026-02-23 12:58:02 +00:00
Ivan PereiraandGitHub 2d5bf1ef75 Simplify README description for pi extension 2026-02-23 12:49:07 +00:00
Ivan Pereira 6ef681adb1 Fix install commands in README 2026-02-23 12:43:58 +00:00
Ivan Pereira 048ec32a3c Strip v prefix in version check 2026-02-23 12:40:55 +00:00
Ivan Pereira 12dcd11384 Fix tag pattern to match v-prefixed tags 2026-02-23 12:40:43 +00:00
Ivan Pereira ef81cdee18 0.1.1 2026-02-23 12:40:25 +00:00
Ivan Pereira 29723c50e3 Upgrade npm to latest before publish for OIDC support 2026-02-23 12:36:34 +00:00
Ivan Pereira 6737807356 Switch to OIDC trusted publishing, drop NPM_TOKEN 2026-02-23 12:35:44 +00:00
Ivan Pereira 10c2b1cf6b Add npm publish GitHub Actions workflow 2026-02-23 12:32:53 +00:00
Ivan Pereira f375b9bf9c Remove ToS link from disclaimer 2026-02-23 12:22:52 +00:00
Ivan Pereira 66f4fee0a7 Remove architecture doc 2026-02-23 11:16:50 +00:00
Ivan Pereira 45dcfe21d9 Remove project structure from README 2026-02-23 11:16:22 +00:00
Ivan Pereira 3f7fda1e2c Add disclaimer to README 2026-02-23 11:15:18 +00:00
Ivan Pereira 560ff5df75 Rewrite README for GitHub 2026-02-23 11:06:24 +00:00
Ivan Pereira 043c83a722 Add npm publish metadata and MIT license 2026-02-23 11:06:22 +00:00
Ivan Pereira 4a49cbf930 Replace real captured JWE token with fake fixture
The REAL_JWE_TOKEN constant in otp-flow.test.ts contained an actual
token captured from a live Perplexity auth response. Replace with a
structurally valid but non-functional placeholder.
2026-02-23 10:51:40 +00:00
Ivan Pereira a01f0681a0 Document design decisions; update plan to reflect dropped jwt.ts 2026-02-23 10:49:49 +00:00
Ivan Pereira 431a814e9a Add asPositiveInteger helper, use for limit display 2026-02-23 10:49:46 +00:00
Ivan Pereira 56ef5533a3 Standardize ellipsis to … in snippet truncation 2026-02-23 10:49:43 +00:00
Ivan Pereira 909145de94 Remove closure cancel flags from login command
canceledAtEmailPrompt and canceledAtOtpPrompt were closure booleans
set inside prompt callbacks to detect user cancellation after the
fact. Fragile if authenticate ever retries prompts or changes order.

In the command context both prompt functions are always provided, so
AuthError(NO_TOKEN) unambiguously means the user declined to enter
required input. Check the error code directly instead.
2026-02-23 10:49:39 +00:00
Ivan Pereira 63eb22316a Replace brittle error text detection with isError flag
renderPerplexityResult was pattern-matching content text prefixes
to decide whether to render in error style. This was tightly coupled
to exact message strings in index.ts — a wording change would
silently break the error styling.

Set isError: true in details on every error return path in execute,
and check details.isError in the renderer instead.
2026-02-23 10:49:33 +00:00
Ivan Pereira 2c5b558271 Extract shared Perplexity API constants to src/constants.ts
PERPLEXITY_USER_AGENT and PERPLEXITY_API_VERSION were duplicated
in auth/login.ts and search/client.ts. Centralise both so updates
only need to happen in one place.
2026-02-23 10:49:23 +00:00
Ivan Pereira 76dbc20064 Harden token storage and declare Bun runtime
Enforce 0600 permissions after every auth token write so existing files
with broader modes are corrected.

Add a regression test for the permission hardening path and document the
Bun runtime dependency used by the Node/jiti search subprocess path.
Also declare bun in package dependencies and engines.
2026-02-23 10:47:05 +00:00
Ivan Pereira a3ddb02a65 Add README 2026-02-18 08:06:19 +00:00
Ivan Pereira 501935fe1c Simplify auth and search client, drop local JWT expiry tracking
Auth:
- Remove jwt.ts — stop decoding JWT exp claims locally
- Simplify OTP login: direct token extraction from verify response,
  remove CookieJar, BFS token extraction, session fallback, CF bypass
- Storage: drop expires field, store token-only; clear on 401/403
- Single auth path: try stored token → macOS app → OTP fallback

Search client:
- Remove Cloudflare subprocess fallback (fetchViaBunRuntime)
- Remove streamFromText, isCloudflareChallenge, BunFetchResult
- Simplify SSE fetch to single fetch() call with abort signal
- Let server validate tokens; clear cache on auth errors

Render:
- Extract shared utilities (asString, truncate) to render/util.ts
- Simplify call.ts and result.ts to import from shared module

Tests:
- Remove jwt.test.ts (module deleted)
- Add otp-flow.test.ts for email OTP authentication
- Simplify login and client tests for reduced code paths

Add debug scripts and plan documents.
2026-02-18 08:03:39 +00:00
Ivan Pereira f42531b07c Implement perplexity login/render modules and harden OAuth search flow 2026-02-17 08:25:56 +00:00
Ivan Pereira 39b8ee6b57 Add OTP fallback auth and progress handoff log 2026-02-16 18:51:09 +00:00
Ivan Pereira 86b0c37a08 Add .gitignore, untrack .env and node_modules 2026-02-16 18:44:09 +00:00
Ivan Pereira 47878d9962 Initial commit 2026-02-16 18:42:03 +00:00