文件历史

5 次代码提交

作者 SHA1 备注 提交日期
Ali Khokhar d98a6b0ca0 Add a native FCC desktop launcher for Windows and macOS (#1225)
## Problem

Free Claude Code currently has to remain attached to a terminal, so
closing that window stops the proxy and users have no native way to
reopen Admin or control the background server. The contributed Windows
wrapper also would have introduced a second bundled server lifecycle
instead of reusing FCC's cleanup and restart ownership. Fixes #1147.

## Changes

| Before | After |
| --- | --- |
| Users keep `fcc-server` running in a terminal. | Windows and macOS
users can launch a console-free FCC Desktop host from a
desktop/application shortcut and control it from the tray or menu bar. |
| A wrapper would need to spawn and terminate a child server. | The
terminal and desktop paths share one in-process supervisor, one graceful
runtime shutdown path, and an OS-held singleton lock. |
| Installers manage only command entry points. | Windows installs
desktop and Start-menu shortcuts; macOS installs a per-user app bundle
and owned desktop link; uninstallers remove only those FCC artifacts. |
| Desktop behavior had no contract coverage. | Lifecycle, duplicate
launch, restart/quit, GUI packaging, Windows shortcuts, macOS bundle
creation, quoting, and ownership boundaries are covered alongside the
full CI suite. |

<!-- greptile_comment -->

<details open><summary><h3>Greptile Summary</h3></summary>

This PR adds a native FCC desktop launcher for Windows and macOS. The
main changes are:

- A shared server supervisor for terminal and desktop launches.
- A singleton desktop host with tray or menu-bar controls.
- Windows shortcuts and a per-user macOS app bundle.
- Ownership checks for launcher installation and removal.
- Tests for lifecycle, packaging, shortcuts, and uninstall behavior.
</details>

<h3>Confidence Score: 5/5</h3>

This looks safe to merge.

Startup restart requests are reserved before the worker starts. macOS
bundle operations verify ownership before modifying or deleting files.
Windows shortcut operations verify their targets before replacement or
removal.

No blocking issues were found in the updated code.

<details><summary><h3><a href="https://www.greptile.com/trex"><img
alt="T-Rex"
src="https://greptile-static-assets.s3.amazonaws.com/trex/trex_green.svg"
height="20" align="absmiddle"></a> T-Rex Logs</h3></summary>

**What T-Rex did**
- Compared the pre-change contract test results against the parent
commit f81af55630aa1adb518b748b9e6985c73c4c4775 and observed 3 failures
and 4 passes, indicating the missing scheduled-startup lifecycle
contract.
- Executed the after-state contract validation with uv run pytest -n 0
tests/cli/test\_desktop.py -q and confirmed the run finished with 7
passes and an exit code of 0.
- Verified that no real proxy or native GUI dependency was started
during the after-state run.
- Inspected the two log artifacts that accompany the proof to
corroborate the test outcomes.

<a
href="https://app.greptile.com/trex/runs/15235588/artifacts"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/ViewAllArtifactsDark.svg?v=4"><source
media="(prefers-color-scheme: light)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/ViewAllArtifacts.svg?v=4"><img
alt="View all artifacts"
src="https://greptile-static-assets.s3.amazonaws.com/badges/ViewAllArtifacts.svg?v=4"></picture></a>

<sub><a href="https://www.greptile.com/trex"><img alt="T-Rex"
src="https://greptile-static-assets.s3.amazonaws.com/trex/trex_green.svg"
height="14" align="absmiddle"></a> Ran code and verified through
T-Rex</sub>
</details>

<details open><summary><h3>Important Files Changed</h3></summary>

| Filename | Overview |
|----------|----------|
| src/free_claude_code/cli/commands.py | Adds the shared server
supervisor and scheduled-run state for startup restart requests. |
| src/free_claude_code/cli/desktop.py | Adds singleton locking and
coordinates the tray loop with the server worker. |
| scripts/install.sh | Creates the macOS app bundle only when an
existing bundle is FCC-owned. |
| scripts/uninstall.sh | Removes the macOS launcher only on macOS and
only with the expected ownership marker. |
| scripts/install.ps1 | Creates Windows shortcuts while preserving
shortcuts with unrelated targets. |
| scripts/uninstall.ps1 | Removes Windows shortcuts only when their
targets match an FCC desktop entry point. |

</details>

<sub>Reviews (3): Last reviewed commit: ["fix: coalesce desktop startup
restarts"](https://github.com/alishahryar1/free-claude-code/commit/b9554729770e08a58818d677de39757c751e760e)
| [Re-trigger
Greptile](https://app.greptile.com/api/retrigger?id=45925660)</sub>

<!-- /greptile_comment -->
2026-07-21 05:48:17 -07:00
Ali Khokhar fa39a1d45a Fail safely when FCC is running during installation (#1182)
## Problem

A running Free Claude Code command can make `uv tool install --force`
fail after partially deleting the installed tool environment. The
installers did not detect this precondition, and the POSIX fallback
relied on truncated process names.

## Changes

| Before | After |
| --- | --- |
| Installers entered tool replacement while FCC commands were running. |
Installers report matching FCC commands and PIDs, then exit before
mutation. |
| A process starting during client or uv setup could reach tool
replacement. | Installers recheck immediately before `uv tool install`.
|
| The no-`pgrep` fallback compared truncated `comm` names. | Install and
uninstall fallbacks match full command lines. |
| Running-process coverage existed only for uninstallers. |
Cross-platform tests cover every FCC entry point, late starts, similar
names, and fallback detection. |
| The package version was 4.8.7. | The package version is 4.8.8. |

<!-- greptile_comment -->

<details open><summary><h3>Greptile Summary</h3></summary>

This PR prevents tool replacement while Free Claude Code commands are
running. The main changes are:

- Adds early and pre-install process checks to both installers.
- Uses full process arguments in the POSIX fallback.
- Adds tests for all FCC commands, late process starts, and similarly
named processes.
- Bumps the package version to 4.8.8.
</details>

<h3>Confidence Score: 5/5</h3>

This looks safe to merge.

The updated fallback checks full process arguments instead of the
truncated process name. Tests cover direct and interpreter-launched
command lines. No blocking issues were found in the updated code.

<details><summary><h3><a href="https://www.greptile.com/trex"><img
alt="T-Rex"
src="https://greptile-static-assets.s3.amazonaws.com/trex/trex_green.svg"
height="20" align="absmiddle"></a> T-Rex Logs</h3></summary>

**What T-Rex did**
- Before the changes, the parent installer failed all six
active-entry-point checks and the late-start check (7 failed, 1 passed).
- After applying the changes, the installer passed all eight targeted
tests (8 passed, 70 deselected, exit code 0).
- The harness assertions verified that blocking cases do not mutate
state and the late-start case never invokes the uv tool install.

<a
href="https://app.greptile.com/trex/runs/14936764/artifacts"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/ViewAllArtifactsDark.svg?v=4"><source
media="(prefers-color-scheme: light)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/ViewAllArtifacts.svg?v=4"><img
alt="View all artifacts"
src="https://greptile-static-assets.s3.amazonaws.com/badges/ViewAllArtifacts.svg?v=4"></picture></a>

<sub><a href="https://www.greptile.com/trex"><img alt="T-Rex"
src="https://greptile-static-assets.s3.amazonaws.com/trex/trex_green.svg"
height="14" align="absmiddle"></a> Ran code and verified through
T-Rex</sub>
</details>

<details open><summary><h3>Important Files Changed</h3></summary>

| Filename | Overview |
|----------|----------|
| scripts/install.sh | Adds early and late process guards with
full-command-line fallback matching. |
| scripts/uninstall.sh | Replaces truncated process-name matching with
PID and argument inspection. |
| scripts/install.ps1 | Adds running-process checks before setup and
tool replacement. |
| tests/scripts/test_installers.py | Covers all FCC commands, late
process starts, similar names, and POSIX fallback matching. |
| tests/scripts/test_uninstallers.py | Covers full-command-line matching
in the POSIX uninstaller fallback. |

</details>

<sub>Reviews (2): Last reviewed commit: ["Fail safely when FCC is
running during
i..."](https://github.com/alishahryar1/free-claude-code/commit/589d983bc936ae28c914b7cb713c6b0775ab8a39)
| [Re-trigger
Greptile](https://app.greptile.com/api/retrigger?id=45286907)</sub>

<!-- /greptile_comment -->
2026-07-17 22:51:26 -07:00
Ali Khokhar 2fe2ba82d2 Add Pi as a first-class FCC client (#1088)
## Problem

FCC had no first-class Pi path, so Pi users had to maintain provider
configuration themselves. FCC's installers and ownership docs also
covered only Claude Code and Codex.

## Changes

| Before | After |
| --- | --- |
| Pi required persistent user-managed provider configuration. | `fcc-pi`
registers an ephemeral FCC provider from the live model catalog and
leaves Pi-owned state untouched. |
| Client launchers normalized blank proxy authentication separately. |
Claude, Codex, and Pi share one neutral proxy-auth policy. |
| FCC installers and uninstallers did not account for Pi. | Installers
delegate missing Pi setup to its official platform installer, while
uninstallers remove only `fcc-pi` and preserve native Pi. |
| Pi compatibility had no executable FCC contract. | Deterministic
launcher and lifecycle coverage plus a real Pi 0.80.6 smoke verify model
discovery and `/v1/messages` end to end. |

<!-- greptile_comment -->

<details open><summary><h3>Greptile Summary</h3></summary>

This PR adds Pi as a supported FCC client. The main changes are:

- A new `fcc-pi` launcher and bundled Pi extension.
- Shared proxy-auth handling for client launchers.
- Pi installation, verification, and uninstall coverage in platform
scripts.
- Pi-focused tests, smoke coverage, and user documentation.
</details>


<h3>Confidence Score: 5/5</h3>

This looks safe to merge.

No blocking issues found in the changed code.

None.

<details><summary><h3><a href="https://www.greptile.com/trex"><img
alt="T-Rex"
src="https://greptile-static-assets.s3.amazonaws.com/trex/trex_green.svg"
height="20" align="absmiddle"></a> T-Rex Logs</h3></summary>

**What T-Rex did**
- Ran the targeted pytest command and confirmed deterministic success
with 27 passed in 2.68s and EXIT\_CODE: 0.
- Analyzed the blocker log and determined that Pi CLI and live-smoke
prerequisites are missing, blocking external Pi execution; uv is
available and provider smoke models are discoverable, narrowing the
issue to Pi CLI plus live-smoke opt-in.

<a
href="https://app.greptile.com/trex/runs/14192651/artifacts"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/ViewAllArtifactsDark.svg?v=4"><source
media="(prefers-color-scheme: light)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/ViewAllArtifacts.svg?v=4"><img
alt="View all artifacts"
src="https://greptile-static-assets.s3.amazonaws.com/badges/ViewAllArtifacts.svg?v=4"></picture></a>

<sub><a href="https://www.greptile.com/trex"><img alt="T-Rex"
src="https://greptile-static-assets.s3.amazonaws.com/trex/trex_green.svg"
height="14" align="absmiddle"></a> Ran code and verified through
T-Rex</sub>
</details>


<details open><summary><h3>Important Files Changed</h3></summary>




| Filename | Overview |
|----------|----------|
| src/free_claude_code/cli/launchers/pi.py | Adds the `fcc-pi` launcher,
Pi capability checks, passthrough handling, extension loading, and
FCC-scoped environment setup. |
| src/free_claude_code/cli/launchers/pi_extension.ts | Adds the Pi
extension that fetches FCC models and registers a process-local
Anthropic Messages provider. |
| scripts/install.sh | Adds Pi install, PATH refresh, capability
verification, and `fcc-pi` command checks for POSIX installs. |
| scripts/install.ps1 | Adds Pi install, PATH refresh, capability
verification, and `fcc-pi` command checks for Windows installs. |
| pyproject.toml | Registers the `fcc-pi` console script and bumps the
package version. |

</details>


<!-- greptile_failed_comments -->
<h3>Comments Outside Diff (1)</h3>

1. General comment 

<a href="#"><img alt="P1"
src="https://greptile-static-assets.s3.amazonaws.com/badges/p1.svg?v=9"
align="top"></a> **Pi entrypoint contract test fails due install-hint
mismatch**

   - **Bug**
- The narrow Pi launcher/entrypoint test selection fails on current
HEAD. `test_launch_pi_rejects_unrelated_pi_binary` expects stderr to
include the Windows PowerShell install URL `https://pi.dev/install.ps1`,
but the launcher emitted the POSIX install command `curl -fsSL
https://pi.dev/install.sh | sh` in this Linux sandbox.
   - **Cause**
- The Pi launcher's incompatible-binary error path and the test contract
disagree about which platform-specific install hint should be emitted
for this scenario.
   - **Fix**
- Align the Pi launcher contract with the test expectation: either
update the launcher to emit the expected platform-specific hint for the
mocked scenario, or update the test to assert the correct hint for the
active/mocked platform. Then rerun `uv run --frozen pytest -q
tests/cli/test_entrypoints.py -k 'pi'`.

<sub><a href="https://www.greptile.com/trex"><img alt="T-Rex"
src="https://greptile-static-assets.s3.amazonaws.com/trex/trex_green.svg"
height="14" align="absmiddle"></a> Ran code and verified through
T-Rex</sub>
<!-- /greptile_failed_comments -->

<sub>Reviews (3): Last reviewed commit: ["Add first-class Pi client
integration"](https://github.com/alishahryar1/free-claude-code/commit/cd5c335f8cf2dee93d927496d7cabbffec86f169)
| [Re-trigger
Greptile](https://app.greptile.com/api/retrigger?id=43721088)</sub>

<!-- /greptile_comment -->
2026-07-12 20:54:57 -07:00
Ali Khokhar ee15ce4122 Make installers native, fail-fast, and verifiable (#1086)
## Problem

The install and uninstall scripts mixed tool ownership, relied on npm
and package-manager detection, and could report success after native
commands or FCC removal failed. Users could be left without runnable FCC
commands or lose `~/.fcc` while the FCC tool remained. Fixes #547, #753,
#908, #942, #952, #1078, and #1080.

## Changes

| Before | After |
| --- | --- |
| Missing Claude Code and Codex were installed through global npm. |
Missing clients use their official native installers without requiring
Node.js or npm. |
| Existing uv installations were updated through package-manager
detection. | Compatible uv installations are preserved; missing or
obsolete uv uses Astral's standalone installer. |
| Python 3.14 was installed as a separate step. | `uv tool install
--python 3.14.0` owns Python selection and FCC installation together. |
| PowerShell relied on `$ErrorActionPreference` and process metadata. |
Native exits are checked explicitly and the PowerShell host resolves
through `$PSHOME` with a PATH fallback. |
| Missing Git surfaced late during `uv tool install`. | Git is verified
before any installation mutation. |
| PATH setup and FCC entry points were trusted after installation. |
Persistent PATH setup, FCC entry points, and `fcc-server --version` must
verify before success. |
| Missing uv caused uninstall to skip FCC removal and still delete
`~/.fcc`. | Missing uv stops uninstall before configuration is touched.
|
| FCC removal trusted `uv tool uninstall` without checking commands. |
All five FCC entry points must be absent before `~/.fcc` is deleted. |
| Dry runs printed successful installation or removal messages. | Dry
runs execute no mutations and report that no changes were made. |
| Installer tests inspected source strings. | Hermetic POSIX, PowerShell
5.1, and PowerShell 7 scenarios execute success and failure branches. |
| README commands used GitHub HTML redirects or direct `iex` pipelines.
| README commands use raw URLs and parameter-safe PowerShell script
blocks. |

<!-- greptile_comment -->

<details open><summary><h3>Greptile Summary</h3></summary>

This PR makes the installer and uninstaller flows native, fail-fast, and
verified. The main changes are:

- Native Claude Code, Codex, and uv installer paths.
- Git and command-exit checks before install mutations continue.
- FCC installation through `uv tool install --python 3.14.0`.
- PATH persistence and FCC entrypoint verification before install
success.
- Verified uv-tool removal before deleting `~/.fcc/`.
- Raw GitHub README commands and expanded installer tests.
</details>

<h3>Confidence Score: 5/5</h3>

This looks safe to merge.

No blocking issues found in the changed code.

No files need attention.

<details><summary><h3><a href="https://www.greptile.com/trex"><img
alt="T-Rex"
src="https://greptile-static-assets.s3.amazonaws.com/trex/trex_green.svg"
height="20" align="absmiddle"></a> T-Rex Logs</h3></summary>

**What T-Rex did**
- T-Rex reviewed the general-contract-validation-proof and confirmed the
installer validation log records the exact commands, working directory,
PowerShell availability checks, pytest summary, skip indicators, and
exit code.
- T-Rex verified from the log that there were no installer/uninstaller
failures observed in the hermetic POSIX test path.
- T-Rex identified the installer-validation.log as the primary artifact
supporting this validation and noted it as the key evidence for
reviewers to inspect.

<a
href="https://app.greptile.com/trex/runs/14183505/artifacts"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/ViewAllArtifactsDark.svg?v=4"><source
media="(prefers-color-scheme: light)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/ViewAllArtifacts.svg?v=4"><img
alt="View all artifacts"
src="https://greptile-static-assets.s3.amazonaws.com/badges/ViewAllArtifacts.svg?v=4"></picture></a>

<sub><a href="https://www.greptile.com/trex"><img alt="T-Rex"
src="https://greptile-static-assets.s3.amazonaws.com/trex/trex_green.svg"
height="14" align="absmiddle"></a> Ran code and verified through
T-Rex</sub>
</details>

<details open><summary><h3>Important Files Changed</h3></summary>

| Filename | Overview |
|----------|----------|
| scripts/install.ps1 | Adds native installer execution, PowerShell
executable fallback, fail-fast command handling, uv checks, and FCC
verification. |
| scripts/install.sh | Adds native installer downloads, prerequisite
checks, uv handling, Python selection, and FCC entrypoint verification.
|
| scripts/uninstall.ps1 | Verifies uv tool removal and FCC entrypoint
absence before purging Windows user data. |
| scripts/uninstall.sh | Verifies uv tool removal and FCC entrypoint
absence before purging POSIX user data. |
| tests/scripts/test_installers.py | Replaces source-string checks with
hermetic installer success and failure scenarios. |
| tests/scripts/test_uninstallers.py | Adds hermetic uninstaller
scenarios for verified removal, idempotency, dry runs, and failed
cleanup. |
| README.md | Updates install and uninstall commands to raw script URLs
and scriptblock PowerShell invocation. |
| pyproject.toml | Bumps the package patch version for the installer
changes. |
| uv.lock | Reflects the updated package version. |

</details>

<sub>Reviews (3): Last reviewed commit: ["Make FCC uninstall fail-fast
and
verifia..."](https://github.com/alishahryar1/free-claude-code/commit/031e79fa4990606c4eb04dcc3980458e560167e4)
| [Re-trigger
Greptile](https://app.greptile.com/api/retrigger?id=43701775)</sub>

<!-- /greptile_comment -->
2026-07-12 18:14:24 -07:00
Ali Khokhar c51a15608d Add FCC uninstall scripts (#836) 2026-06-17 01:43:28 -07:00