free-claude-code/api
Brandy Good 51112a4cf3
Some checks are pending
CI / checks (push) Waiting to run
fix: only strip valid env assignments in command parsing (#229)
## What changed
This updates the command parsing helpers to recognize leading
environment assignments only when they match shell-style variable syntax
like `FOO=bar`. The previous implementation treated any leading token
containing `=` as an env assignment, which could misclassify real
commands or file paths that happen to include `=`. Both
`_strip_env_assignments()` and `extract_command_prefix()` now share the
same validation helper so their behavior stays consistent.

## Why it matters
These helpers are used by fast-path request optimizations, so incorrect
prefix detection can bypass normal handling with the wrong result.
Restricting env stripping to valid assignment tokens fixes false
positives without changing the public API or the response format.

## How it was tested
I validated the updated logic against representative inputs such as
`FOO=bar git status`, plain commands like `git status`, and malformed or
path-like tokens containing `=` that should not be treated as env
assignments. The change is isolated to parsing logic and does not
introduce new dependencies.

---------

Co-authored-by: genoshide <genoshide@users.noreply.github.com>
2026-04-27 18:34:48 -07:00
..
models Major refactor: API, providers, messaging, and Anthropic protocol 2026-04-26 03:01:14 -07:00
web_tools feat(deepseek): use native Anthropic Messages transport 2026-04-26 12:03:21 -07:00
__init__.py Major refactor: API, providers, messaging, and Anthropic protocol 2026-04-26 03:01:14 -07:00
app.py Major refactor: API, providers, messaging, and Anthropic protocol 2026-04-26 03:01:14 -07:00
command_utils.py fix: only strip valid env assignments in command parsing (#229) 2026-04-27 18:34:48 -07:00
dependencies.py Major refactor: API, providers, messaging, and Anthropic protocol 2026-04-26 03:01:14 -07:00
detection.py Major refactor: API, providers, messaging, and Anthropic protocol 2026-04-26 03:01:14 -07:00
model_router.py Add per-model thinking toggles 2026-04-25 20:51:07 -07:00
optimization_handlers.py refactor: remove OpenRouter rollback, shims, and redundant layers 2026-04-24 21:08:38 -07:00
routes.py feat: Anthropic web server tools, provider metadata, messaging hardening 2026-04-24 23:01:14 -07:00
runtime.py Major refactor: API, providers, messaging, and Anthropic protocol 2026-04-26 03:01:14 -07:00
services.py feat(deepseek): use native Anthropic Messages transport 2026-04-26 12:03:21 -07:00
validation_log.py Major refactor: API, providers, messaging, and Anthropic protocol 2026-04-26 03:01:14 -07:00
web_server_tools.py Major refactor: API, providers, messaging, and Anthropic protocol 2026-04-26 03:01:14 -07:00