Skip to content

Add --version/-v CLI flag#56

Open
Copilot wants to merge 2 commits intomainfrom
copilot/add-cli-command-version-check
Open

Add --version/-v CLI flag#56
Copilot wants to merge 2 commits intomainfrom
copilot/add-cli-command-version-check

Conversation

Copy link
Contributor

Copilot AI commented Feb 5, 2026

Adds version checking via contextinator --version or contextinator -v. Version is sourced from setuptools-scm, which generates it from git tags during build.

Changes

  • Import __version__ from package __init__.py
  • Add --version/-v argument with action="version" to argparse

Behavior

$ contextinator --version
contextinator 1.2.3

$ contextinator -v
contextinator 1.2.3

Development builds show 0.0.0+unknown when no git tag is present. Release builds automatically display the tag version via setuptools-scm's write_to directive in pyproject.toml.

Original prompt

This section details on the original issue you should resolve

<issue_title>No CLI command to check version</issue_title>
<issue_description>So; the thing is when we ran into an error with Contextinator then if when we want to check the current version then there is no easy way todo it.

Here's what the new command should look like:

contextinator --version
contextinator --v

One problem that can happen while making this:

  • in the code we haven't hardcoded the version anywhere, the versioning is tied to our github-relases. so need to find a way that it automatically gets the version that it is bundled up while the release.</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.


Summary by cubic

Adds a CLI command to print the installed Contextinator version: contextinator --version and contextinator -v.

  • New Features
    • Uses the package’s version derived from git tags at build time (no hardcoding).
    • Prints "contextinator X.Y.Z" and exits with code 0.

Written for commit 0437e10. Summary will update on new commits.

Co-authored-by: SwarnenduG07 <141937171+SwarnenduG07@users.noreply.github.com>
Copilot AI changed the title [WIP] Add CLI command to check version of Contextinator Add --version/-v CLI flag Feb 5, 2026
Copilot AI requested a review from SwarnenduG07 February 5, 2026 07:37
@SwarnenduG07 SwarnenduG07 marked this pull request as ready for review February 5, 2026 07:38
Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 1 file

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="src/contextinator/cli.py">

<violation number="1" location="src/contextinator/cli.py:9">
P2: Importing `__version__` from the package `__init__` triggers heavy module imports; `--version` should avoid loading chunking/embedding/vectorstore modules. Import the version directly (e.g., from the generated `_version.py`) with a fallback instead.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

import os
from .chunking import chunk_repository
from .config import get_storage_path
from . import __version__
Copy link

@cubic-dev-ai cubic-dev-ai bot Feb 5, 2026

Choose a reason for hiding this comment

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

P2: Importing __version__ from the package __init__ triggers heavy module imports; --version should avoid loading chunking/embedding/vectorstore modules. Import the version directly (e.g., from the generated _version.py) with a fallback instead.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/contextinator/cli.py, line 9:

<comment>Importing `__version__` from the package `__init__` triggers heavy module imports; `--version` should avoid loading chunking/embedding/vectorstore modules. Import the version directly (e.g., from the generated `_version.py`) with a fallback instead.</comment>

<file context>
@@ -6,6 +6,7 @@
 import os
 from .chunking import chunk_repository
 from .config import get_storage_path
+from . import __version__
 
 
</file context>
Suggested change
from . import __version__
try:
from ._version import version as __version__
except ImportError:
__version__ = "0.0.0+unknown"
Fix with Cubic

@iamDyeus
Copy link
Collaborator

iamDyeus commented Feb 9, 2026

I doubt this won't work; since we're using github tags for versioning.

We decide to like manually to update the version in our system too.
or we build some kind of tunnel which does it

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.

No CLI command to check version

3 participants