Skip to content

Commit 57c211b

Browse files
authored
Add skill version method for v3 release (#6)
1 parent 1134a2f commit 57c211b

5 files changed

Lines changed: 61 additions & 0 deletions

File tree

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,12 @@ Start your agent and ask naturally:
9999

100100
No special commands needed — the agent picks up the skill automatically.
101101

102+
To check the installed skill version without authentication or a network request:
103+
104+
```bash
105+
python skills/codealive-context-engine/scripts/get_version.py
106+
```
107+
102108
## License
103109

104110
MIT

skills/codealive-context-engine/SKILL.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ Do NOT retry the failed script until setup completes successfully.
4848
| **ArtifactQuery Schema** | `schema.py` | Fast | Free | Inspect supported metadata query entities, fields, and examples |
4949
| **Artifact Metadata Query** | `metadata.py` | Fast | Low | Read-only aggregate/query analytics across indexed repositories |
5050
| **Chat with Codebase** | `chat.py` | Slow | High | Stateless synthesized Q&A. Call ONLY when the user explicitly asks. |
51+
| **Get Version** | `get_version.py` | Instant | Free | Return the installed CodeAlive skill version as JSON; no API key or network call required |
5152

5253
**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.
5354

@@ -162,6 +163,15 @@ python scripts/chat.py "Given these prior findings and identifiers: ..., what ab
162163

163164
## Tool Reference
164165

166+
### `get_version.py` — Get Installed Version
167+
168+
Returns the installed CodeAlive Context Engine skill version as JSON. It does not require authentication or make a network request.
169+
170+
```bash
171+
python scripts/get_version.py
172+
# {"name": "codealive-context-engine", "version": "3.0.0"}
173+
```
174+
165175
### `datasources.py` — List Data Sources
166176

167177
```bash
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.0.0
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/usr/bin/env python3
2+
"""Return the installed CodeAlive Context Engine skill version."""
3+
4+
import json
5+
from pathlib import Path
6+
7+
8+
VERSION_FILE = Path(__file__).resolve().parent.parent / "VERSION"
9+
10+
11+
def get_version() -> str:
12+
"""Return the current installed skill version."""
13+
return VERSION_FILE.read_text(encoding="utf-8").strip()
14+
15+
16+
def main() -> None:
17+
print(json.dumps({"name": "codealive-context-engine", "version": get_version()}))
18+
19+
20+
if __name__ == "__main__":
21+
main()

tests/test_tool_api_v3.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ def _load_module(path: Path, name: str):
2626

2727

2828
skill_setup_module = _load_module(SKILL_ROOT / "setup.py", "codealive_skill_setup_v3")
29+
skill_version_module = _load_module(SKILL_ROOT / "scripts" / "get_version.py", "codealive_skill_version_v3")
2930
sys.path.insert(0, str(LIB_ROOT))
3031
from api_client import CodeAliveClient, format_codealive_error # noqa: E402
3132

@@ -38,6 +39,28 @@ def _header(headers: dict[str, str], name: str) -> str | None:
3839
return next((value for key, value in headers.items() if key.lower() == name.lower()), None)
3940

4041

42+
def test_get_version_matches_plugin_release_version():
43+
plugin = json.loads((REPO_ROOT / ".claude-plugin" / "plugin.json").read_text(encoding="utf-8"))
44+
45+
assert skill_version_module.get_version() == "3.0.0"
46+
assert skill_version_module.get_version() == plugin["version"]
47+
48+
49+
def test_get_version_script_returns_json_without_authentication():
50+
result = subprocess.run(
51+
[sys.executable, str(SKILL_ROOT / "scripts" / "get_version.py")],
52+
check=True,
53+
capture_output=True,
54+
text=True,
55+
env={},
56+
)
57+
58+
assert json.loads(result.stdout) == {
59+
"name": "codealive-context-engine",
60+
"version": "3.0.0",
61+
}
62+
63+
4164
def test_setup_normalize_base_url_accepts_origin_and_api_suffix():
4265
assert skill_setup_module.normalize_base_url("https://codealive.example.com") == "https://codealive.example.com"
4366
assert skill_setup_module.normalize_base_url("https://codealive.example.com/api") == "https://codealive.example.com"

0 commit comments

Comments
 (0)