Skip to content

fix: preserve literal CLI search patterns on Windows - #322

Open
laozidabo wants to merge 1 commit into
cocoindex-io:mainfrom
laozidabo:fix/windows-cli-glob-arguments
Open

laozidabo wants to merge 1 commit into
cocoindex-io:mainfrom
laozidabo:fix/windows-cli-glob-arguments

Conversation

@laozidabo

@laozidabo laozidabo commented Oct 26, 2026 •

Copy link
Copy Markdown

Fixes #321.

On Windows, Typer expands sys.argv against local files before parsing it. With docs/a.md and docs/b.md present, ccc search "some query" --path "docs/*" loses its glob filter and appends a filename to the query.

Route the installed ccc command and python -m cocoindex_code.cli through one main() that calls app(windows_expand_args=False). This preserves literal search patterns. The legacy cocoindex-code MCP entry point is unchanged. The flag disables Windows automatic argument expansion as a whole, including glob, tilde, and environment-variable expansion.

Add four regression cases covering both public CLI entry points with ordinary and glob-shaped query strings. They use real argv parsing and matching local files, simulate Typer's Windows branch without changing the process-wide OS, and intercept the search request before starting a daemon or model.

Validation:

  • Before the fix: all four new regression cases fail because filenames replace or contaminate the arguments.
  • After the fix: tests/test_cli_entrypoint.py and tests/test_cli_helpers.py pass (39 tests) on Linux/Python 3.11 with the locked runtime dependencies.
  • Ruff lint/format and git diff --check pass.
  • Full uv run prek run --all-files passes on Linux/Python 3.11: formatting, lint, secret scanning, dependency-lock validation, mypy, and the configured pytest suite. Docker E2E tests are excluded by the project's default configuration.
  • No native Windows run has been performed locally.

AI assistance: OpenAI Codex investigated, implemented, and tested this change on behalf of @laozidabo. The account owner has not personally written or technically reviewed the code.

@laozidabo
laozidabo marked this pull request as ready for review October 26, 2026 03:36

This branch has not been deployed

No deployments
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.

ccc search --path returns no results on Windows: Click expands the glob against the filesystem

1 participant