Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
10 changes: 10 additions & 0 deletions skills/codealive-context-engine/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions skills/codealive-context-engine/VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.0.0
21 changes: 21 additions & 0 deletions skills/codealive-context-engine/scripts/get_version.py
Original file line number Diff line number Diff line change
@@ -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()
Comment on lines +11 to +13

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

If the VERSION file is missing or unreadable (e.g., due to permission issues or incomplete installation), read_text() will raise an unhandled exception and crash the script. Since this script is a diagnostic utility, it should handle OSError gracefully and return a fallback value like "unknown".

Suggested change
def get_version() -> str:
"""Return the current installed skill version."""
return VERSION_FILE.read_text(encoding="utf-8").strip()
def get_version() -> str:
"""Return the current installed skill version."""
try:
return VERSION_FILE.read_text(encoding="utf-8").strip()
except OSError:
return "unknown"



def main() -> None:
print(json.dumps({"name": "codealive-context-engine", "version": get_version()}))


if __name__ == "__main__":
main()
23 changes: 23 additions & 0 deletions tests/test_tool_api_v3.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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"
Expand Down