Skip to content

fix: prompt for catalog provider API keys and clarify update behavior - #7

Merged
elkaix merged 10 commits into
mainfrom
fix/provider-login-and-update-ux
Aug 4, 2026
Merged

fix: prompt for catalog provider API keys and clarify update behavior#7
elkaix merged 10 commits into
mainfrom
fix/provider-login-and-update-ux

Conversation

@elkaix

@elkaix elkaix commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Related Issue

No linked issue — problem explained below.

Problem

Connecting a provider from the models.dev catalog in /login or /provider failed with Environment variable "X" is not set or is empty. instead of asking for an API key. The same gate also broke the OpenAI (API key) and Anthropic (API key) login entries, which route through the same path, and pythinker provider catalog add had no way to pass a key directly. Separately, the update banner and /update implied Homebrew installs auto-update when they deliberately do not, and the native install scripts pointed at nonexistent release assets.

What changed

  • Catalog provider login now falls back to the API key input dialog when the provider's environment variable is unset or empty, and stores the entered key in config.toml via the existing api_key provider field. When the env var is set, behavior is unchanged.
  • pythinker provider catalog add gains --api-key <key>, taking precedence over --api-key-env and the catalog's declared env var; error messages now mention the flag.
  • /update and the startup update notice state that Homebrew installs do not auto-update and show the native installer command for automatic background updates.
  • The native install scripts download the correct published release assets.
  • Site: legacy downloads popup and Python download milestone highlight.

Tests: new coverage for the prompt fallback (env set / unset / undeclared / cancelled) in the TUI, and for --api-key precedence and Commander wiring in the CLI. Full suite green.

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue, or explained the problem above.
  • I have added tests that prove my feature works.
  • Ran gen-changesets skill, or this PR needs no changeset.
  • Ran gen-docs skill, or this PR needs no doc update.

Summary by CodeRabbit

  • New Features

    • Catalog provider setup now accepts API keys interactively or through --api-key.
    • Native installers download verified, architecture-specific release packages on macOS, Linux, and Windows.
    • Added a dismissible community download milestone popup to the website.
    • Updated installation guidance, including Homebrew recommendations for automatic updates.
  • Bug Fixes

    • Provider login no longer fails when the configured API-key environment variable is missing or empty.
  • Documentation

    • Updated architecture imagery and installation messaging.

elkaix added 6 commits August 3, 2026 21:45
install.sh and install.ps1 were carried over from the Python pythinker-cli
repo: they resolved v-prefixed tags and downloaded pythinker-VERSION-.tar.gz
/ PythinkerSetup-.exe assets that this repo never publishes, so both
installers polled GitHub for ~6 minutes and failed without downloading.

Resolve the version from the CDN latest file (GitHub API fallback), download
pythinker-code-<target>.zip from the @pythoughts/pythinker-code@X.Y.Z release
tag, verify SHA-256, and install the extracted binary. Windows now extracts
pythinker.exe to LOCALAPPDATA\Programs\Pythinker and persists it on the
user PATH instead of running the removed Inno Setup installer.
Catalog provider login (TUI /login and /provider, and openai-api /
anthropic-api which route through the same path) failed with
'Environment variable X is not set or is empty' instead of asking for a
key. Fall back to the API key dialog and store the literal key via
applyCatalogProvider's existing apiKey field. The CLI command
'pythinker provider catalog add' gains --api-key for the same case.
Homebrew is deliberately excluded from background auto-install
(canAutoInstall), matching gh and Claude Code, but /update and the
startup notice implied auto-update exists. Both now state the brew
upgrade command and point to the native installer for automatic
background updates. ManualUpdateResult carries the install source so
the TUI can branch on it.
@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in: 36 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 7387484f-1294-4e85-9966-c1d76c187f2a

📥 Commits

Reviewing files that changed from the base of the PR and between a661a10 and f9a25e7.

📒 Files selected for processing (3)
  • .changeset/old-node-launch-guard.md
  • apps/pythinker-code/src/launcher.ts
  • apps/pythinker-web/public/install.ps1
📝 Walkthrough

Walkthrough

The change adds catalog API-key prompting and literal CLI key support, updates Unix and Windows native installers to use published ZIP assets, adds Homebrew update guidance, and introduces site presentation changes.

Changes

Catalog credentials

Layer / File(s) Summary
CLI API-key handling
apps/pythinker-code/src/cli/sub/provider.ts, apps/pythinker-code/test/cli/provider.test.ts, .changeset/catalog-provider-api-key-prompt.md
Catalog provider creation accepts --api-key, prioritizes it over --api-key-env, and stores the selected credential form.
Interactive catalog login
apps/pythinker-code/src/tui/commands/auth.ts, apps/pythinker-code/test/tui/commands/auth.test.ts, apps/pythinker-code/test/tui/pythinker-tui-startup.test.ts
Login prompts for a key when the environment variable is unavailable, records the credential source, and stops without changes when cancelled.

Native installers and updates

Layer / File(s) Summary
Unix native installer
apps/pythinker-web/public/install.sh, .changeset/native-install-script-assets.md
The Unix installer resolves encoded releases, downloads and verifies ZIP assets, extracts the executable, and removes the legacy marker.
Windows native installer
apps/pythinker-web/public/install.ps1
The PowerShell installer selects x64 or ARM64 assets, extracts pythinker.exe, installs it, and updates PATH.
Update-source guidance
apps/pythinker-code/src/cli/update/preflight.ts, apps/pythinker-code/src/tui/commands/info.ts, apps/pythinker-code/test/cli/update/preflight.test.ts, .changeset/homebrew-update-hint.md
Manual update results carry the installation source. Homebrew messages include the native installer command.
Installer validation
.github/workflows/install-smoke.yml, _typos.toml
The PowerShell parser check initializes its error collection, and iterm is accepted by the spelling configuration.

Site presentation and documentation

Layer / File(s) Summary
Download milestone popup
apps/site/src/App.vue, apps/site/src/components/LegacyDownloadsPopup.vue
The site renders a dismissible, responsive download milestone popup with accessibility and reduced-motion support.
Installation presentation
apps/site/src/components/InstallCommand.vue, apps/site/src/components/AgentLoop.vue
The install trigger text changes to “Get started,” and the agent-loop layout adds padding and SVG overflow handling.
Architecture documentation
README.md
The architecture section uses docs/media/Architecture.webp instead of an inline Mermaid diagram.

Estimated code review effort: 4 (Complex) | ~45 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title uses the required fix prefix, imperative mood, and is 69 characters long while accurately summarizing the main changes.
Description check ✅ Passed The description includes all required sections, explains the problem and changes, and marks each checklist item as complete.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Comment @coderabbitai help to get the list of available commands.

Allowlist 'iterm' (iTerm2 identifier) for the whole-repo spell check,
and initialize the pwsh error variable in the install-script smoke so
ParseFile's [ref] argument is valid.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/pythinker-code/test/tui/commands/auth.test.ts`:
- Around line 116-125: Update the cancellation test around
connectCatalogProvider to assert that setConfig was not called, in addition to
verifying the provider remains unset and model selection is skipped. Ensure the
setConfig mock is reset or available before the test so the assertion
specifically detects configuration writes during the cancelled key-prompt flow.

In `@apps/pythinker-web/public/install.ps1`:
- Around line 458-459: Update the architecture selection near $archLabel to
accept only RuntimeInformation OSArchitecture values X64 and Arm64, mapping them
to x64 and arm64 respectively; reject X86 and any other or future value before
assigning $target or constructing the asset URL.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 89c2d424-c237-4cf5-844d-fb1a69ef611e

📥 Commits

Reviewing files that changed from the base of the PR and between 792615a and 3d237a4.

⛔ Files ignored due to path filters (1)
  • docs/media/Architecture.webp is excluded by !**/*.webp
📒 Files selected for processing (18)
  • .changeset/catalog-provider-api-key-prompt.md
  • .changeset/homebrew-update-hint.md
  • .changeset/native-install-script-assets.md
  • README.md
  • apps/pythinker-code/src/cli/sub/provider.ts
  • apps/pythinker-code/src/cli/update/preflight.ts
  • apps/pythinker-code/src/tui/commands/auth.ts
  • apps/pythinker-code/src/tui/commands/info.ts
  • apps/pythinker-code/test/cli/provider.test.ts
  • apps/pythinker-code/test/cli/update/preflight.test.ts
  • apps/pythinker-code/test/tui/commands/auth.test.ts
  • apps/pythinker-code/test/tui/pythinker-tui-startup.test.ts
  • apps/pythinker-web/public/install.ps1
  • apps/pythinker-web/public/install.sh
  • apps/site/src/App.vue
  • apps/site/src/components/AgentLoop.vue
  • apps/site/src/components/InstallCommand.vue
  • apps/site/src/components/LegacyDownloadsPopup.vue

Comment thread apps/pythinker-code/test/tui/commands/auth.test.ts
Comment thread apps/pythinker-web/public/install.ps1 Outdated
Reject unsupported Windows architectures in the install script instead
of defaulting to x64, and assert that cancelling the API key prompt
writes no configuration.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
apps/pythinker-web/public/install.ps1 (1)

500-503: 🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

Handle a running pythinker.exe during manual installs. Windows pythinker upgrade prints the install.ps1 command and does not launch it. However, direct copying can fail if another process holds pythinker.exe; stop the process or use staged replacement.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/pythinker-web/public/install.ps1` around lines 500 - 503, Update the
manual installation flow around the binary Copy-Item to handle an
already-running pythinker.exe, stopping the relevant process or using a staged
replacement before copying the new binary into installDir. Preserve the existing
destination path and Phase-Ok "Installing" completion behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/pythinker-web/public/install.ps1`:
- Around line 458-463: Update the architecture detection immediately before the
$archLabel switch to identify the native Windows ARM64 platform even when the
current PowerShell process is emulated as x64, using a runtime-independent
signal or an explicit supported-runtime requirement. Ensure native ARM64 selects
'arm64', genuine x64 selects 'x64', and unsupported architectures still call
Fail.

---

Outside diff comments:
In `@apps/pythinker-web/public/install.ps1`:
- Around line 500-503: Update the manual installation flow around the binary
Copy-Item to handle an already-running pythinker.exe, stopping the relevant
process or using a staged replacement before copying the new binary into
installDir. Preserve the existing destination path and Phase-Ok "Installing"
completion behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: a62f5e09-25c1-4630-b5fa-26245437fac6

📥 Commits

Reviewing files that changed from the base of the PR and between 0a01fd0 and a661a10.

📒 Files selected for processing (2)
  • apps/pythinker-code/test/tui/commands/auth.test.ts
  • apps/pythinker-web/public/install.ps1
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/pythinker-code/test/tui/commands/auth.test.ts

Comment thread apps/pythinker-web/public/install.ps1 Outdated
elkaix added 2 commits August 3, 2026 22:28
npm installs the CLI on any Node version (engines is a warning for
consumers), but the TUI requires node:ffi via --experimental-ffi, which
Node 24 does not have — the re-exec died with 'bad option'. Check the
runtime version before re-exec and print the requirement plus the
native-installer alternative.
An x64-emulated PowerShell on Windows ARM64 reports OSArchitecture=X64
and would install the x64 build. Read the machine architecture from the
Session Manager registry key (with env-var fallback), which reports the
hardware architecture regardless of process emulation.
@elkaix
elkaix merged commit d396320 into main Aug 4, 2026
9 of 10 checks passed
@elkaix
elkaix deleted the fix/provider-login-and-update-ux branch August 4, 2026 02:40
elkaix pushed a commit that referenced this pull request Aug 4, 2026
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## @pythoughts/pythinker-code@0.6.1

### Patch Changes

- [#7](#7)
[`d396320`](d396320)
- Prompt for an API key when connecting a catalog provider whose
environment variable is not set, instead of failing with "Environment
variable is not set or is empty". Applies to `/login`, `/provider`, and
`pythinker provider catalog add`, which now also accepts `--api-key
<key>`.

- [#7](#7)
[`d396320`](d396320)
- Explain in `/update` and the startup update notice that Homebrew
installs do not auto-update, and point to the native installer for
automatic background updates.

- [#7](#7)
[`d396320`](d396320)
- Point the native install scripts at the published release assets.

- [#7](#7)
[`d396320`](d396320)
- Show a clear requirement message with the native-installer alternative
when the CLI is launched on Node.js older than 26.4, instead of failing
with a cryptic flag error.

- [#8](#8)
[`9b1b195`](9b1b195)
- Fix the CLI failing to start on Windows with "process.execve is
unavailable" by using the spawn fallback instead of calling execve
there.

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.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