-
Notifications
You must be signed in to change notification settings - Fork 122
Make Claude Pilot Great Again #56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
82cccbc
fix: Updated installer to not overwrite any user settings and use pro…
maxritter dd6fa76
feat: Compaction-based Endless Mode, friction fixes, and rules overhaul
maxritter 099778d
fix: Stop misattributing Claude Code's auto-compaction as a Pilot fea…
maxritter 08ed28b
fix: Various bugfixes and improvements
maxritter 47e6dd9
fix: auto-rebase worktree branch onto base before squash merge
maxritter fb8fe73
fix: rebrand Intelligent Context to Persistent Memory, fix license ac…
maxritter File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -227,6 +227,7 @@ CLAUDE.md | |
| .playwright-*/ | ||
| .vercel | ||
| .mcp.json | ||
| mcp_servers.json | ||
| .env** | ||
| playwright/ | ||
| .claude.backup.* | ||
|
|
||
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,118 @@ | ||
| import React, { useState, useCallback } from 'react'; | ||
| import type { LicenseResponse } from '../../../services/worker/http/routes/LicenseRoutes.js'; | ||
|
|
||
| interface LicenseGateProps { | ||
| license: LicenseResponse | null; | ||
| onActivated: () => void; | ||
| } | ||
|
|
||
| export function LicenseGate({ license, onActivated }: LicenseGateProps) { | ||
| const [key, setKey] = useState(''); | ||
| const [error, setError] = useState<string | null>(null); | ||
| const [isSubmitting, setIsSubmitting] = useState(false); | ||
|
|
||
| const handleSubmit = useCallback(async () => { | ||
| const trimmed = key.trim(); | ||
| if (!trimmed) return; | ||
|
|
||
| setError(null); | ||
| setIsSubmitting(true); | ||
|
|
||
| try { | ||
| const res = await fetch('/api/license/activate', { | ||
| method: 'POST', | ||
| headers: { 'Content-Type': 'application/json' }, | ||
| body: JSON.stringify({ key: trimmed }), | ||
| }); | ||
| const data = await res.json(); | ||
|
|
||
| if (data.success) { | ||
| setKey(''); | ||
| setError(null); | ||
| onActivated(); | ||
| } else { | ||
| setError(data.error ?? 'Activation failed'); | ||
| } | ||
| } catch { | ||
| setError('Connection failed. Is the Pilot worker running?'); | ||
| } finally { | ||
| setIsSubmitting(false); | ||
| } | ||
| }, [key, onActivated]); | ||
|
|
||
| const handleKeyDown = useCallback((e: React.KeyboardEvent) => { | ||
| if (e.key === 'Enter' && !isSubmitting) { | ||
| handleSubmit(); | ||
| } | ||
| }, [handleSubmit, isSubmitting]); | ||
|
|
||
| const isExpired = license?.isExpired === true; | ||
| const title = isExpired ? 'License Expired' : 'License Required'; | ||
| const subtitle = isExpired | ||
| ? 'Your Claude Pilot license has expired. Please activate a new license to continue using the Console.' | ||
| : 'Claude Pilot Console requires an active license or trial. Activate your license key below to get started.'; | ||
|
|
||
| return ( | ||
| <div className="min-h-screen flex items-center justify-center bg-base-200 p-4"> | ||
| <div className="card bg-base-100 shadow-xl w-full max-w-md"> | ||
| <div className="card-body items-center text-center gap-4"> | ||
| <div className="text-5xl mb-2"> | ||
| {isExpired ? '\u{1F6AB}' : '\u{1F512}'} | ||
| </div> | ||
|
|
||
| <h1 className="card-title text-2xl">{title}</h1> | ||
| <p className="text-base-content/60 text-sm">{subtitle}</p> | ||
|
|
||
| <div className="w-full space-y-3 mt-2"> | ||
| <input | ||
| type="text" | ||
| className="input input-bordered w-full" | ||
| placeholder="Enter your license key" | ||
| value={key} | ||
| onChange={(e) => { setKey(e.target.value); setError(null); }} | ||
| onKeyDown={handleKeyDown} | ||
| disabled={isSubmitting} | ||
| autoFocus | ||
| /> | ||
|
|
||
| {error && ( | ||
| <p className="text-error text-sm text-left">{error}</p> | ||
| )} | ||
|
|
||
| <button | ||
| className="btn btn-primary w-full" | ||
| onClick={handleSubmit} | ||
| disabled={isSubmitting || !key.trim()} | ||
| > | ||
| {isSubmitting ? 'Activating...' : 'Activate License'} | ||
| </button> | ||
| </div> | ||
|
|
||
| <div className="divider text-base-content/40 text-xs my-1">or</div> | ||
|
|
||
| <a | ||
| href="https://claude-pilot.com/#pricing" | ||
| target="_blank" | ||
| rel="noopener noreferrer" | ||
| className="btn btn-outline btn-sm w-full" | ||
| > | ||
| Get a License | ||
| </a> | ||
|
|
||
| <p className="text-base-content/40 text-xs mt-2"> | ||
| Visit{' '} | ||
| <a | ||
| href="https://claude-pilot.com" | ||
| target="_blank" | ||
| rel="noopener noreferrer" | ||
| className="text-primary hover:underline" | ||
| > | ||
| claude-pilot.com | ||
| </a> | ||
| {' '}to learn more about Claude Pilot. | ||
| </p> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| ); | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,96 @@ | ||
| /** | ||
| * Tests for LicenseGate component | ||
| * | ||
| * Tests the full-page license gate screen that blocks console access | ||
| * when no valid license is present. | ||
| */ | ||
| import { describe, it, expect } from "bun:test"; | ||
| import React from "react"; | ||
| import { renderToStaticMarkup } from "react-dom/server"; | ||
| import { LicenseGate } from "../../src/ui/viewer/components/LicenseGate.js"; | ||
| import type { LicenseResponse } from "../../src/services/worker/http/routes/LicenseRoutes.js"; | ||
|
|
||
| function renderGate(license: LicenseResponse | null) { | ||
| return renderToStaticMarkup( | ||
| React.createElement(LicenseGate, { license, onActivated: () => {} }), | ||
| ); | ||
| } | ||
|
|
||
| describe("LicenseGate", () => { | ||
| it("should render license required title when no license", () => { | ||
| const html = renderGate({ | ||
| valid: false, | ||
| tier: null, | ||
| email: null, | ||
| daysRemaining: null, | ||
| isExpired: false, | ||
| }); | ||
|
|
||
| expect(html).toContain("License Required"); | ||
| expect(html).toContain("Enter your license key"); | ||
| }); | ||
|
|
||
| it("should render expired title when license is expired", () => { | ||
| const html = renderGate({ | ||
| valid: false, | ||
| tier: "trial", | ||
| email: "user@example.com", | ||
| daysRemaining: null, | ||
| isExpired: true, | ||
| }); | ||
|
|
||
| expect(html).toContain("License Expired"); | ||
| expect(html).toContain("has expired"); | ||
| }); | ||
|
|
||
| it("should contain activation input", () => { | ||
| const html = renderGate(null); | ||
|
|
||
| expect(html).toContain("Enter your license key"); | ||
| expect(html).toContain("Activate License"); | ||
| }); | ||
|
|
||
| it("should contain link to pricing page", () => { | ||
| const html = renderGate(null); | ||
|
|
||
| expect(html).toContain("claude-pilot.com/#pricing"); | ||
| expect(html).toContain("Get a License"); | ||
| }); | ||
|
|
||
| it("should contain link to main site", () => { | ||
| const html = renderGate(null); | ||
|
|
||
| expect(html).toContain("claude-pilot.com"); | ||
| }); | ||
|
|
||
| it("should render activate button as disabled by default (empty key)", () => { | ||
| const html = renderGate(null); | ||
|
|
||
| expect(html).toContain("disabled"); | ||
| expect(html).toContain("Activate License"); | ||
| }); | ||
|
|
||
| it("should use lock icon for no license", () => { | ||
| const html = renderGate({ | ||
| valid: false, | ||
| tier: null, | ||
| email: null, | ||
| daysRemaining: null, | ||
| isExpired: false, | ||
| }); | ||
|
|
||
| expect(html).toContain("\u{1F512}"); | ||
| }); | ||
|
|
||
| it("should use prohibited icon for expired license", () => { | ||
| const html = renderGate({ | ||
| valid: false, | ||
| tier: "trial", | ||
| email: null, | ||
| daysRemaining: null, | ||
| isExpired: true, | ||
| }); | ||
|
|
||
| expect(html).toContain("\u{1F6AB}"); | ||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Non-2xx responses produce a misleading error message.
If the server returns a 500 or other non-2xx status with a non-JSON body,
res.json()will throw and the catch block shows "Connection failed. Is the Pilot worker running?" — which is misleading for server errors. Checkres.okfirst.Proposed fix
const res = await fetch('/api/license/activate', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ key: trimmed }), }); + if (!res.ok) { + setError(`Server error (${res.status}). Please try again.`); + return; + } const data = await res.json();📝 Committable suggestion
🤖 Prompt for AI Agents