diff --git a/README.md b/README.md index 292b6de..ed17bc5 100644 --- a/README.md +++ b/README.md @@ -99,6 +99,12 @@ Start your agent and ask naturally: No special commands needed — the agent picks up the skill automatically. +To check the installed skill version without authentication or a network request: + +```bash +python skills/codealive-context-engine/scripts/get_version.py +``` + ## License MIT diff --git a/skills/codealive-context-engine/SKILL.md b/skills/codealive-context-engine/SKILL.md index 68ae6fe..28548f7 100644 --- a/skills/codealive-context-engine/SKILL.md +++ b/skills/codealive-context-engine/SKILL.md @@ -48,6 +48,7 @@ Do NOT retry the failed script until setup completes successfully. | **ArtifactQuery Schema** | `schema.py` | Fast | Free | Inspect supported metadata query entities, fields, and examples | | **Artifact Metadata Query** | `metadata.py` | Fast | Low | Read-only aggregate/query analytics across indexed repositories | | **Chat with Codebase** | `chat.py` | Slow | High | Stateless synthesized Q&A. Call ONLY when the user explicitly asks. | +| **Get Version** | `get_version.py` | Instant | Free | Return the installed CodeAlive skill version as JSON; no API key or network call required | **Cost guidance:** `semantic_search` and `grep_search` are the default starting point — fast and cheap. Use `fetch_artifacts` to load full source and `get_artifact_relationships` to trace call graphs. All four tools are low-cost. @@ -162,6 +163,15 @@ python scripts/chat.py "Given these prior findings and identifiers: ..., what ab ## Tool Reference +### `get_version.py` — Get Installed Version + +Returns the installed CodeAlive Context Engine skill version as JSON. It does not require authentication or make a network request. + +```bash +python scripts/get_version.py +# {"name": "codealive-context-engine", "version": "3.0.0"} +``` + ### `datasources.py` — List Data Sources ```bash diff --git a/skills/codealive-context-engine/VERSION b/skills/codealive-context-engine/VERSION new file mode 100644 index 0000000..4a36342 --- /dev/null +++ b/skills/codealive-context-engine/VERSION @@ -0,0 +1 @@ +3.0.0 diff --git a/skills/codealive-context-engine/scripts/get_version.py b/skills/codealive-context-engine/scripts/get_version.py new file mode 100755 index 0000000..44ee48c --- /dev/null +++ b/skills/codealive-context-engine/scripts/get_version.py @@ -0,0 +1,21 @@ +#!/usr/bin/env python3 +"""Return the installed CodeAlive Context Engine skill version.""" + +import json +from pathlib import Path + + +VERSION_FILE = Path(__file__).resolve().parent.parent / "VERSION" + + +def get_version() -> str: + """Return the current installed skill version.""" + return VERSION_FILE.read_text(encoding="utf-8").strip() + + +def main() -> None: + print(json.dumps({"name": "codealive-context-engine", "version": get_version()})) + + +if __name__ == "__main__": + main() diff --git a/tests/test_tool_api_v3.py b/tests/test_tool_api_v3.py index 740479b..aa8e0f2 100644 --- a/tests/test_tool_api_v3.py +++ b/tests/test_tool_api_v3.py @@ -26,6 +26,7 @@ def _load_module(path: Path, name: str): skill_setup_module = _load_module(SKILL_ROOT / "setup.py", "codealive_skill_setup_v3") +skill_version_module = _load_module(SKILL_ROOT / "scripts" / "get_version.py", "codealive_skill_version_v3") sys.path.insert(0, str(LIB_ROOT)) from api_client import CodeAliveClient, format_codealive_error # noqa: E402 @@ -38,6 +39,28 @@ def _header(headers: dict[str, str], name: str) -> str | None: return next((value for key, value in headers.items() if key.lower() == name.lower()), None) +def test_get_version_matches_plugin_release_version(): + plugin = json.loads((REPO_ROOT / ".claude-plugin" / "plugin.json").read_text(encoding="utf-8")) + + assert skill_version_module.get_version() == "3.0.0" + assert skill_version_module.get_version() == plugin["version"] + + +def test_get_version_script_returns_json_without_authentication(): + result = subprocess.run( + [sys.executable, str(SKILL_ROOT / "scripts" / "get_version.py")], + check=True, + capture_output=True, + text=True, + env={}, + ) + + assert json.loads(result.stdout) == { + "name": "codealive-context-engine", + "version": "3.0.0", + } + + def test_setup_normalize_base_url_accepts_origin_and_api_suffix(): assert skill_setup_module.normalize_base_url("https://codealive.example.com") == "https://codealive.example.com" assert skill_setup_module.normalize_base_url("https://codealive.example.com/api") == "https://codealive.example.com"