feat(registry): add automated channels aggregator and initial index
This commit is contained in:
@@ -0,0 +1,4 @@
|
|||||||
|
[
|
||||||
|
"https://git.luxhebros.com/beerslayer/lex.git",
|
||||||
|
"https://git.luxhebros.com/simonthecoder/sec.git"
|
||||||
|
]
|
||||||
@@ -0,0 +1,88 @@
|
|||||||
|
{
|
||||||
|
"schema_version": "1.0.0",
|
||||||
|
"updated_at": "2026-10-03T00:44:23.267050+00:00",
|
||||||
|
"total_applets": 2,
|
||||||
|
"applets": {
|
||||||
|
"lex": {
|
||||||
|
"id": "lex",
|
||||||
|
"name": "Lex",
|
||||||
|
"display_name": "LEX - Offline CLI Dictionary & Context Assistant",
|
||||||
|
"description": "Brutally fast, offline CLI dictionary engine powered by WordNet & Wiktionary FTS5.",
|
||||||
|
"version": "1.1.0",
|
||||||
|
"stage": "Beta",
|
||||||
|
"author": "BeerSlayer <slayer@luxhebros.com>",
|
||||||
|
"license": "MIT",
|
||||||
|
"runtime": "python",
|
||||||
|
"entrypoint": "main.py",
|
||||||
|
"shims": [
|
||||||
|
"lex"
|
||||||
|
],
|
||||||
|
"network": "offline",
|
||||||
|
"dependencies": [
|
||||||
|
"rich>=13.0.0"
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"dictionary",
|
||||||
|
"offline",
|
||||||
|
"wordnet",
|
||||||
|
"wiktionary",
|
||||||
|
"turkish",
|
||||||
|
"english",
|
||||||
|
"fast",
|
||||||
|
"fuzzy"
|
||||||
|
],
|
||||||
|
"features": [
|
||||||
|
"Offline WordNet 3.0 English Lexicon (206k+ entries)",
|
||||||
|
"Offline Wiktionary Turkish-to-English Lexicon (45k+ entries)",
|
||||||
|
"Sub-millisecond automatic language detection (EN <-> TR)",
|
||||||
|
"3-Stage Candidate Pruning & Fuzzy Search (Levenshtein / SequenceMatcher)",
|
||||||
|
"Centralized JSON Message and UI Catalog"
|
||||||
|
],
|
||||||
|
"repo_url": "https://git.luxhebros.com/beerslayer/lex.git",
|
||||||
|
"clone_url": "https://git.luxhebros.com/beerslayer/lex.git",
|
||||||
|
"download_url": "https://git.luxhebros.com/beerslayer/lex/archive/main.zip",
|
||||||
|
"owner": "beerslayer"
|
||||||
|
},
|
||||||
|
"sec": {
|
||||||
|
"id": "sec",
|
||||||
|
"name": "Sec",
|
||||||
|
"display_name": "SEC - Ergonomic CLI Cheat Sheet & Code Snippet Assistant",
|
||||||
|
"description": "Ergonomic, heuristic-routed CLI cheat sheet and code snippet assistant powered by cheat.sh.",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"stage": "Alpha",
|
||||||
|
"author": "Simon the Coder <simon@luxhebros.com>",
|
||||||
|
"license": "MIT",
|
||||||
|
"runtime": "python",
|
||||||
|
"entrypoint": "main.py",
|
||||||
|
"shims": [
|
||||||
|
"sec"
|
||||||
|
],
|
||||||
|
"network": "live",
|
||||||
|
"dependencies": [
|
||||||
|
"requests>=2.28.0",
|
||||||
|
"rich>=13.0.0"
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"cheatsheet",
|
||||||
|
"snippets",
|
||||||
|
"cheat.sh",
|
||||||
|
"routing",
|
||||||
|
"clipboard",
|
||||||
|
"productivity",
|
||||||
|
"python",
|
||||||
|
"bash"
|
||||||
|
],
|
||||||
|
"features": [
|
||||||
|
"Ergonomic left-hand QWERTY command invocation (optimized for dropdown terminals)",
|
||||||
|
"Deterministic multi-token candidate URL permutation and developer synonym expansion",
|
||||||
|
"Dual-mode native Win32/POSIX clipboard integration (-c for code only, -c a for full snippet)",
|
||||||
|
"Offline query caching in local SQLite database",
|
||||||
|
"Centralized JSON UI and interaction catalog"
|
||||||
|
],
|
||||||
|
"repo_url": "https://git.luxhebros.com/simonthecoder/sec.git",
|
||||||
|
"clone_url": "https://git.luxhebros.com/simonthecoder/sec.git",
|
||||||
|
"download_url": "https://git.luxhebros.com/simonthecoder/sec/archive/main.zip",
|
||||||
|
"owner": "simonthecoder"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
import json
|
||||||
|
from datetime import datetime, timezone
|
||||||
|
from pathlib import Path
|
||||||
|
from urllib.parse import urlparse
|
||||||
|
import requests
|
||||||
|
|
||||||
|
|
||||||
|
def build_registry_index(channels_file: Path, output_file: Path) -> dict:
|
||||||
|
if not channels_file.exists():
|
||||||
|
return {}
|
||||||
|
|
||||||
|
with open(channels_file, "r", encoding="utf-8") as f:
|
||||||
|
channels = json.load(f)
|
||||||
|
|
||||||
|
applets_catalog = {}
|
||||||
|
|
||||||
|
for repo_url in channels:
|
||||||
|
# Parse owner and repo name from url (e.g. https://git.luxhebros.com/beerslayer/lex.git)
|
||||||
|
clean_url = repo_url.rstrip("/")
|
||||||
|
if clean_url.endswith(".git"):
|
||||||
|
clean_url = clean_url[:-4]
|
||||||
|
|
||||||
|
parsed = urlparse(clean_url)
|
||||||
|
parts = [p for p in parsed.path.split("/") if p]
|
||||||
|
if len(parts) < 2:
|
||||||
|
continue
|
||||||
|
|
||||||
|
owner, repo_name = parts[-2], parts[-1]
|
||||||
|
base_api_url = f"{parsed.scheme}://{parsed.netloc}/api/v1/repos/{owner}/{repo_name}/raw/manifest.json"
|
||||||
|
|
||||||
|
try:
|
||||||
|
resp = requests.get(base_api_url, timeout=5)
|
||||||
|
if resp.status_code == 200:
|
||||||
|
manifest_data = resp.json()
|
||||||
|
applet_id = manifest_data.get("id", repo_name.lower())
|
||||||
|
|
||||||
|
manifest_data["repo_url"] = repo_url
|
||||||
|
manifest_data["clone_url"] = f"{parsed.scheme}://{parsed.netloc}/{owner}/{repo_name}.git"
|
||||||
|
manifest_data["download_url"] = f"{parsed.scheme}://{parsed.netloc}/{owner}/{repo_name}/archive/main.zip"
|
||||||
|
manifest_data["owner"] = owner
|
||||||
|
|
||||||
|
applets_catalog[applet_id] = manifest_data
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
|
||||||
|
index_data = {
|
||||||
|
"schema_version": "1.0.0",
|
||||||
|
"updated_at": datetime.now(timezone.utc).isoformat(),
|
||||||
|
"total_applets": len(applets_catalog),
|
||||||
|
"applets": applets_catalog,
|
||||||
|
}
|
||||||
|
|
||||||
|
output_file.parent.mkdir(parents=True, exist_ok=True)
|
||||||
|
with open(output_file, "w", encoding="utf-8") as f:
|
||||||
|
json.dump(index_data, f, indent=2, ensure_ascii=False)
|
||||||
|
|
||||||
|
return index_data
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
base_dir = Path(__file__).resolve().parent.parent
|
||||||
|
channels_path = base_dir / "registry" / "channels.json"
|
||||||
|
index_path = base_dir / "registry" / "index.json"
|
||||||
|
result = build_registry_index(channels_path, index_path)
|
||||||
|
print(f"Registry index built successfully with {len(result.get('applets', {}))} applets.")
|
||||||
Reference in New Issue
Block a user