Skip to content

Add initial Context-Engine CLI implementation#183

Merged
m1rl0k merged 18 commits intotestfrom
unified-cli
Jan 17, 2026
Merged

Add initial Context-Engine CLI implementation#183
m1rl0k merged 18 commits intotestfrom
unified-cli

Conversation

@m1rl0k
Copy link
Collaborator

@m1rl0k m1rl0k commented Jan 17, 2026

Introduces the Context-Engine CLI with commands for semantic code search, indexing, configuration management, shell completions, and more. Adds installation and usage documentation, project metadata, dependencies, and command handlers for answer, search, index, prune, config, lifecycle, and completion. Includes support files for shell completions, demos, output formatting, and utility functions.

Introduces the Context-Engine CLI with commands for semantic code search, indexing, configuration management, shell completions, and more. Adds installation and usage documentation, project metadata, dependencies, and command handlers for answer, search, index, prune, config, lifecycle, and completion. Includes support files for shell completions, demos, output formatting, and utility functions.
Changed the GitHub repository link in the CLI help message to point to the correct project URL.
@augmentcode
Copy link

augmentcode bot commented Jan 17, 2026

🤖 Augment PR Summary

Summary: Adds an initial Python-based ctx/ctx-cli command-line interface for interacting with Context-Engine’s MCP services.

Changes:

  • Introduces a new pyproject.toml with packaging metadata, runtime dependencies, entry points, and package-data for shell completion assets.
  • Adds a new scripts/ctx_cli package with an argparse-based main entrypoint and modular command registration.
  • Implements CLI commands for lifecycle management (up/down/restart), indexing & pruning, semantic search, LLM answers with citations, status/doctor diagnostics, init/quickstart flows, config management, collections management, and IDE bridge config generation.
  • Adds shell completion scripts (bash/zsh/fish) and a small test harness for validating completion generation.
  • Provides utility modules for Docker Compose orchestration, config file handling (.ctxrc), and an HTTP JSON-RPC MCP client with session handshake support.

Technical Notes: The CLI uses Rich when available for formatted output, and centralizes MCP calls through MCPClient (including MCP session initialization and SSE parsing).

🤖 Was this summary useful? React with 👍 or 👎

Copy link

@augmentcode augmentcode bot left a comment

Choose a reason for hiding this comment

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

Review completed. 6 suggestions posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

Deleted the INSTALLATION.md file containing installation and CLI usage instructions. This may indicate a migration of documentation or a change in how installation guidance is provided.
Replaces direct HTTP JSON-RPC requests and manual response parsing in answer.py, index.py, and search.py with the MCPClient utility, which now handles the MCP session handshake and response parsing automatically. Removes redundant parse_mcp_response functions and updates error handling to use MCPError. Improves maintainability and reliability of MCP tool interactions.
Refines logic for setting the 'collection' parameter to only use environment variable if explicitly set, otherwise defers to server auto-detection. Enhances error handling to support both string and dict error formats, and updates source label formatting in output.
Introduces new commands: 'bridge' for IDE config generation and bridge status, 'collections' for Qdrant collection management, and 'doctor' for comprehensive health checks. Updates the README with detailed command documentation and quickstart instructions. Refactors command registration in __init__.py, removes deprecated demo and test scripts, and improves answer.py response parsing.
Replaces Typer-based argument parsing with standard Python arguments in CLI commands, improving compatibility and simplifying error handling. Adds environment and .env file support for service URLs, enhances collection resolution for search/prune commands, and updates bash completions to match new flags. Introduces a 'quiet' option to docker compose runner and improves config file handling for default collection. Minor improvements to health checks and IDE config generation.
Enhanced collection resolution in answer.py to check explicit flag, environment variable, and config file in order. Updated collections.py to persist default collection selection in .ctxrc using ConfigManager, ensuring future CLI invocations use the selected collection.
@m1rl0k
Copy link
Collaborator Author

m1rl0k commented Jan 17, 2026

augment review

Replaces sys.exit calls with return statements to allow the prune function to return exit codes instead of terminating the process. This improves testability and integration with other code by handling errors and cancellations more gracefully.
Copy link

@augmentcode augmentcode bot left a comment

Choose a reason for hiding this comment

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

Review completed. 2 suggestions posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

Refactors the index command to robustly resolve and validate paths, supporting subdirectory indexing and enforcing workspace boundaries via HOST_INDEX_PATH. Updates quickstart to prompt for and handle multiple paths, symlinking as needed, and accumulates indexing statistics across multiple repositories. Adds CLI tests for config and path resolution behaviors, and updates main CLI usage to use 'ctx' instead of 'ctx-cli'.
Refactors and extends the quickstart indexing logic to support multi-repo mode, explicit path handling, and importing/copying repositories outside the mounted workspace. Adds the --import-repos flag, improves collection detection, and introduces comprehensive tests for multi-repo, explicit path, and import scenarios.
Refactored CLI commands to gracefully handle absence of the 'rich' library, providing fallback plain output where appropriate. Updated subprocess execution in doctor.py to avoid shell=True for security. Fixed a formatting bug in collections.py. Improved quickstart.py to only create separate collections for actual git repositories. Ensured proper socket closure in docker.py health checks.
Tests now create .git directories to ensure paths are treated as separate repositories. DummyClient mocks have been updated to simulate successful indexing by returning non-zero counts and changed file stats. Environment variables are set more explicitly to match test scenarios.
Adds logic to ensure that each collection is only recreated once during the indexing process. Subsequent targets for the same collection will use an update action instead of recreate, avoiding redundant recreation operations.
Introduces new CLI commands for symbol graph navigation, memory store/search, and structural code pattern search. Updates README and command registration to document and enable these features.
Introduces the `sync` command for uploading and syncing workspaces to a remote Context-Engine server, including watch mode and git history options. Adds centralized UI helpers using Rich for consistent output, updates CLI error handling, and improves logical repo reuse feature flag behavior. Documentation and command registration are updated to reflect new functionality.
Introduces a .indexignore file to exclude cosqa*.json files and the dev-workspace directory from indexing. This helps prevent unnecessary files and directories from being indexed in the main Context-Engine repository.
Logical repo reuse is now disabled by default and explicitly enabled for CLI indexing and sync operations via ensure_logical_repo_reuse_for_cli(). The status command now reports graph backend status for Qdrant and Neo4j, including edge and node counts. ConfigManager now supports MCP_* environment variable overrides for endpoint URLs. Minor improvements to error handling and documentation.
@m1rl0k m1rl0k merged commit 8e85060 into test Jan 17, 2026
1 check passed
@m1rl0k m1rl0k deleted the unified-cli branch January 23, 2026 13:20
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