lockthard-cli 0.2.6__tar.gz → 0.2.8__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {lockthard_cli-0.2.6 → lockthard_cli-0.2.8}/PKG-INFO +25 -19
- {lockthard_cli-0.2.6 → lockthard_cli-0.2.8}/README.md +21 -15
- {lockthard_cli-0.2.6 → lockthard_cli-0.2.8}/lockthard_cli/SKILL.md +34 -31
- lockthard_cli-0.2.8/lockthard_cli/__init__.py +5 -0
- {lockthard_cli-0.2.6 → lockthard_cli-0.2.8}/lockthard_cli/auth.py +2 -2
- {lockthard_cli-0.2.6 → lockthard_cli-0.2.8}/lockthard_cli/cli.py +15 -15
- {lockthard_cli-0.2.6 → lockthard_cli-0.2.8}/lockthard_cli/client.py +1 -1
- {lockthard_cli-0.2.6 → lockthard_cli-0.2.8}/lockthard_cli/config.py +32 -21
- {lockthard_cli-0.2.6 → lockthard_cli-0.2.8}/lockthard_cli/formatters.py +16 -16
- {lockthard_cli-0.2.6 → lockthard_cli-0.2.8}/lockthard_cli.egg-info/PKG-INFO +25 -19
- {lockthard_cli-0.2.6 → lockthard_cli-0.2.8}/lockthard_cli.egg-info/entry_points.txt +1 -0
- {lockthard_cli-0.2.6 → lockthard_cli-0.2.8}/pyproject.toml +5 -4
- lockthard_cli-0.2.6/lockthard_cli/__init__.py +0 -5
- {lockthard_cli-0.2.6 → lockthard_cli-0.2.8}/lockthard_cli.egg-info/SOURCES.txt +0 -0
- {lockthard_cli-0.2.6 → lockthard_cli-0.2.8}/lockthard_cli.egg-info/dependency_links.txt +0 -0
- {lockthard_cli-0.2.6 → lockthard_cli-0.2.8}/lockthard_cli.egg-info/requires.txt +0 -0
- {lockthard_cli-0.2.6 → lockthard_cli-0.2.8}/lockthard_cli.egg-info/top_level.txt +0 -0
- {lockthard_cli-0.2.6 → lockthard_cli-0.2.8}/setup.cfg +0 -0
- {lockthard_cli-0.2.6 → lockthard_cli-0.2.8}/tests/test_cli.py +0 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: lockthard-cli
|
|
3
|
-
Version: 0.2.
|
|
4
|
-
Summary: CLI and AI agent client for
|
|
5
|
-
Author-email:
|
|
3
|
+
Version: 0.2.8
|
|
4
|
+
Summary: CLI and AI agent client for LOKTAR — query 2100+ curated AI tools across 86+ tablets
|
|
5
|
+
Author-email: Loktar Team <info@loktar.cc>
|
|
6
6
|
License: MIT
|
|
7
7
|
Project-URL: Homepage, https://loktar.cc
|
|
8
|
-
Keywords: cli,ai-tools,agents,mcp,lockthard
|
|
8
|
+
Keywords: cli,ai-tools,agents,mcp,loktar,lockthard
|
|
9
9
|
Classifier: Development Status :: 4 - Beta
|
|
10
10
|
Classifier: Environment :: Console
|
|
11
11
|
Classifier: Intended Audience :: Developers
|
|
@@ -20,16 +20,18 @@ Requires-Dist: click>=8.1.0
|
|
|
20
20
|
Requires-Dist: requests>=2.28.0
|
|
21
21
|
Requires-Dist: rich>=13.0.0
|
|
22
22
|
|
|
23
|
-
#
|
|
23
|
+
# LOKTAR CLI (`loktar`)
|
|
24
24
|
|
|
25
|
-
A super efficient, scriptable command-line interface and AI agent client for **
|
|
25
|
+
A super efficient, scriptable command-line interface and AI agent client for **LOKTAR** (https://loktar.cc).
|
|
26
26
|
|
|
27
|
-
Allows both human developers and autonomous AI agents (Claude Code, Antigravity, Aider, Cursor, etc.) to query, search, and inspect
|
|
27
|
+
Allows both human developers and autonomous AI agents (Claude Code, Antigravity, Aider, Cursor, etc.) to query, search, and inspect 86+ tablets and 2100+ AI tools with minimum token usage and zero prompt overhead.
|
|
28
|
+
|
|
29
|
+
*(Note: The command `lockthard` is also provided as a fully compatible alias)*
|
|
28
30
|
|
|
29
31
|
## Installation
|
|
30
32
|
|
|
31
33
|
```bash
|
|
32
|
-
pip install lockthard-cli
|
|
34
|
+
pip install --upgrade lockthard-cli
|
|
33
35
|
```
|
|
34
36
|
|
|
35
37
|
Or run without installing:
|
|
@@ -45,40 +47,44 @@ Get your API key from [loktar.cc](https://loktar.cc).
|
|
|
45
47
|
|
|
46
48
|
- **For AI Agents & CI/CD:**
|
|
47
49
|
```bash
|
|
48
|
-
export
|
|
50
|
+
export LOKTAR_API_KEY="lk_your_token_here"
|
|
51
|
+
# (LOCKTHARD_API_KEY is also supported as fallback)
|
|
49
52
|
```
|
|
50
53
|
- **Interactive Browser Login (Humans):**
|
|
51
54
|
```bash
|
|
52
|
-
|
|
55
|
+
loktar login
|
|
53
56
|
```
|
|
54
57
|
- **Manual Login:**
|
|
55
58
|
```bash
|
|
56
|
-
|
|
59
|
+
loktar login --token "lk_your_token_here"
|
|
57
60
|
```
|
|
58
61
|
|
|
59
62
|
### 2. Commands
|
|
60
63
|
|
|
61
64
|
```bash
|
|
62
65
|
# Ping service
|
|
63
|
-
|
|
66
|
+
loktar ping
|
|
64
67
|
|
|
65
|
-
# Search tools (returns concise
|
|
66
|
-
|
|
68
|
+
# Search tools (returns concise table)
|
|
69
|
+
loktar search "ocr"
|
|
67
70
|
|
|
68
71
|
# Search tools in raw JSON (for agents / jq)
|
|
69
|
-
|
|
72
|
+
loktar -j search "ocr"
|
|
70
73
|
|
|
71
74
|
# List all tablets
|
|
72
|
-
|
|
75
|
+
loktar tablets list
|
|
73
76
|
|
|
74
77
|
# Inspect a specific tablet
|
|
75
|
-
|
|
78
|
+
loktar tablets get ocr
|
|
76
79
|
|
|
77
80
|
# Inspect tool details
|
|
78
|
-
|
|
81
|
+
loktar tools get "Chandra OCR"
|
|
79
82
|
|
|
80
83
|
# Display CLI agent guide
|
|
81
|
-
|
|
84
|
+
loktar guide
|
|
85
|
+
|
|
86
|
+
# Display full agent skill
|
|
87
|
+
loktar skill
|
|
82
88
|
```
|
|
83
89
|
|
|
84
90
|
## Options
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
#
|
|
1
|
+
# LOKTAR CLI (`loktar`)
|
|
2
2
|
|
|
3
|
-
A super efficient, scriptable command-line interface and AI agent client for **
|
|
3
|
+
A super efficient, scriptable command-line interface and AI agent client for **LOKTAR** (https://loktar.cc).
|
|
4
4
|
|
|
5
|
-
Allows both human developers and autonomous AI agents (Claude Code, Antigravity, Aider, Cursor, etc.) to query, search, and inspect
|
|
5
|
+
Allows both human developers and autonomous AI agents (Claude Code, Antigravity, Aider, Cursor, etc.) to query, search, and inspect 86+ tablets and 2100+ AI tools with minimum token usage and zero prompt overhead.
|
|
6
|
+
|
|
7
|
+
*(Note: The command `lockthard` is also provided as a fully compatible alias)*
|
|
6
8
|
|
|
7
9
|
## Installation
|
|
8
10
|
|
|
9
11
|
```bash
|
|
10
|
-
pip install lockthard-cli
|
|
12
|
+
pip install --upgrade lockthard-cli
|
|
11
13
|
```
|
|
12
14
|
|
|
13
15
|
Or run without installing:
|
|
@@ -23,40 +25,44 @@ Get your API key from [loktar.cc](https://loktar.cc).
|
|
|
23
25
|
|
|
24
26
|
- **For AI Agents & CI/CD:**
|
|
25
27
|
```bash
|
|
26
|
-
export
|
|
28
|
+
export LOKTAR_API_KEY="lk_your_token_here"
|
|
29
|
+
# (LOCKTHARD_API_KEY is also supported as fallback)
|
|
27
30
|
```
|
|
28
31
|
- **Interactive Browser Login (Humans):**
|
|
29
32
|
```bash
|
|
30
|
-
|
|
33
|
+
loktar login
|
|
31
34
|
```
|
|
32
35
|
- **Manual Login:**
|
|
33
36
|
```bash
|
|
34
|
-
|
|
37
|
+
loktar login --token "lk_your_token_here"
|
|
35
38
|
```
|
|
36
39
|
|
|
37
40
|
### 2. Commands
|
|
38
41
|
|
|
39
42
|
```bash
|
|
40
43
|
# Ping service
|
|
41
|
-
|
|
44
|
+
loktar ping
|
|
42
45
|
|
|
43
|
-
# Search tools (returns concise
|
|
44
|
-
|
|
46
|
+
# Search tools (returns concise table)
|
|
47
|
+
loktar search "ocr"
|
|
45
48
|
|
|
46
49
|
# Search tools in raw JSON (for agents / jq)
|
|
47
|
-
|
|
50
|
+
loktar -j search "ocr"
|
|
48
51
|
|
|
49
52
|
# List all tablets
|
|
50
|
-
|
|
53
|
+
loktar tablets list
|
|
51
54
|
|
|
52
55
|
# Inspect a specific tablet
|
|
53
|
-
|
|
56
|
+
loktar tablets get ocr
|
|
54
57
|
|
|
55
58
|
# Inspect tool details
|
|
56
|
-
|
|
59
|
+
loktar tools get "Chandra OCR"
|
|
57
60
|
|
|
58
61
|
# Display CLI agent guide
|
|
59
|
-
|
|
62
|
+
loktar guide
|
|
63
|
+
|
|
64
|
+
# Display full agent skill
|
|
65
|
+
loktar skill
|
|
60
66
|
```
|
|
61
67
|
|
|
62
68
|
## Options
|
|
@@ -1,31 +1,33 @@
|
|
|
1
1
|
---
|
|
2
|
-
name:
|
|
3
|
-
description: "
|
|
4
|
-
version: 0.2.
|
|
2
|
+
name: loktar
|
|
3
|
+
description: "LOKTAR CLI — query 2100+ curated AI tools across 86+ tablets. Search, browse tablets, get tool details, and investigate repos. Designed for both humans and AI agents."
|
|
4
|
+
version: 0.2.8
|
|
5
5
|
metadata:
|
|
6
6
|
hermes:
|
|
7
|
-
tags: [lockthard, tools, ai, search, tablets, mcp]
|
|
7
|
+
tags: [loktar, lockthard, tools, ai, search, tablets, mcp]
|
|
8
8
|
homepage: https://loktar.cc
|
|
9
9
|
---
|
|
10
10
|
|
|
11
|
-
#
|
|
11
|
+
# LOKTAR CLI
|
|
12
12
|
|
|
13
|
-
CLI para consultar el directorio de herramientas IA de
|
|
13
|
+
CLI para consultar el directorio de herramientas IA de LOKTAR (2100+ herramientas, 86+ tablets). Diseñada para humanos (tablas Rich) y agentes IA (JSON limpio).
|
|
14
|
+
*Nota: El comando `lockthard` se mantiene disponible como alias compatible.*
|
|
14
15
|
|
|
15
16
|
## Autenticación
|
|
16
17
|
|
|
17
18
|
```bash
|
|
18
19
|
# Opción 1: Variable de entorno (recomendado para agentes)
|
|
19
|
-
export
|
|
20
|
+
export LOKTAR_API_KEY="lk_tu_token"
|
|
21
|
+
# (También soporta LOCKTHARD_API_KEY como fallback)
|
|
20
22
|
|
|
21
23
|
# Opción 2: Login con token
|
|
22
|
-
|
|
24
|
+
loktar login --token lk_tu_token
|
|
23
25
|
|
|
24
26
|
# Opción 3: Login interactivo (abre navegador)
|
|
25
|
-
|
|
27
|
+
loktar login
|
|
26
28
|
```
|
|
27
29
|
|
|
28
|
-
Token guardado en `~/.lockthard/credentials.json`
|
|
30
|
+
Token guardado en `~/.loktar/credentials.json` (o fallback `~/.lockthard/credentials.json`) con permisos 0600.
|
|
29
31
|
|
|
30
32
|
## Flag JSON (`-j` / `--json`)
|
|
31
33
|
|
|
@@ -34,27 +36,28 @@ Para agentes IA: **siempre usa `-j`** para recibir JSON limpio sin formato ANSI.
|
|
|
34
36
|
El flag funciona tanto a nivel global como en cualquier subcommand:
|
|
35
37
|
|
|
36
38
|
```bash
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
loktar -j tablets list # ✅ global
|
|
40
|
+
loktar tablets list -j # ✅ en subcommand
|
|
41
|
+
loktar -j tablets get vector-knowledge-base # ✅
|
|
42
|
+
loktar tablets get vector-knowledge-base -j # ✅
|
|
41
43
|
```
|
|
42
44
|
|
|
43
45
|
## Comandos
|
|
44
46
|
|
|
45
47
|
| Comando | Descripción |
|
|
46
48
|
|---|---|
|
|
47
|
-
| `
|
|
48
|
-
| `
|
|
49
|
-
| `
|
|
50
|
-
| `
|
|
51
|
-
| `
|
|
52
|
-
| `
|
|
53
|
-
| `
|
|
49
|
+
| `loktar ping` | Verificar conexión y autenticación |
|
|
50
|
+
| `loktar -j search "<query>"` | Buscar herramientas por palabra clave |
|
|
51
|
+
| `loktar -j tablets list` | Listar todos los tablets disponibles |
|
|
52
|
+
| `loktar -j tablets get <tablet_id>` | Ver herramientas de un tablet |
|
|
53
|
+
| `loktar -j tools get "<tool_id>"` | Detalles de una herramienta específica |
|
|
54
|
+
| `loktar -j cli-tools` | Listar herramientas CLI dedicadas |
|
|
55
|
+
| `loktar guide` | Guía rápida para agentes |
|
|
56
|
+
| `loktar skill` | Muestra esta SKILL.md completa |
|
|
54
57
|
|
|
55
58
|
## Estructura de un Tablet
|
|
56
59
|
|
|
57
|
-
Cada tablet es una colección curada de herramientas agrupadas por temática. Al obtener un tablet (`
|
|
60
|
+
Cada tablet es una colección curada de herramientas agrupadas por temática. Al obtener un tablet (`loktar -j tablets get <id>`), recibes:
|
|
58
61
|
|
|
59
62
|
```json
|
|
60
63
|
{
|
|
@@ -95,27 +98,27 @@ Descripción: (vacía)
|
|
|
95
98
|
|
|
96
99
|
## Flujo de trabajo recomendado para agentes
|
|
97
100
|
|
|
98
|
-
1. `
|
|
99
|
-
2. `
|
|
100
|
-
3. `
|
|
101
|
+
1. `loktar ping` — verificar auth
|
|
102
|
+
2. `loktar -j tablets list` — ver tablets disponibles
|
|
103
|
+
3. `loktar -j tablets get <id>` — explorar herramientas de un tablet relevante
|
|
101
104
|
4. Para cada herramienta interesante: **ir al repo/URL y leer documentación**
|
|
102
|
-
5. `
|
|
105
|
+
5. `loktar -j tools get "<nombre>"` — detalles específicos con snippets si se necesitan
|
|
103
106
|
|
|
104
107
|
## Ejemplos de uso
|
|
105
108
|
|
|
106
109
|
```bash
|
|
107
110
|
# Buscar herramientas de OCR
|
|
108
|
-
|
|
111
|
+
loktar -j search "ocr"
|
|
109
112
|
|
|
110
113
|
# Ver todo el tablet de cybersecurity
|
|
111
|
-
|
|
114
|
+
loktar -j tablets get cybersecurity
|
|
112
115
|
|
|
113
116
|
# Ver detalles de una herramienta específica
|
|
114
|
-
|
|
117
|
+
loktar -j tools get "Graphify"
|
|
115
118
|
|
|
116
119
|
# Listar herramientas CLI
|
|
117
|
-
|
|
120
|
+
loktar -j cli-tools
|
|
118
121
|
|
|
119
122
|
# Verificar que todo funciona
|
|
120
|
-
|
|
123
|
+
loktar ping
|
|
121
124
|
```
|
|
@@ -41,7 +41,7 @@ class OAuthCallbackHandler(http.server.BaseHTTPRequestHandler):
|
|
|
41
41
|
title="¡Autenticación Exitosa!",
|
|
42
42
|
body="""
|
|
43
43
|
<h2 style='color: #10B981;'>¡Autenticación Exitosa!</h2>
|
|
44
|
-
<p>La CLI de <strong>
|
|
44
|
+
<p>La CLI de <strong>LOKTAR</strong> ha sido conectada correctamente a tu cuenta.</p>
|
|
45
45
|
<p>Ya puedes cerrar esta ventana y regresar a tu terminal.</p>
|
|
46
46
|
"""
|
|
47
47
|
)
|
|
@@ -129,7 +129,7 @@ def perform_browser_login(api_url: str, timeout_seconds: int = 120) -> Tuple[boo
|
|
|
129
129
|
except Exception as e:
|
|
130
130
|
return False, f"No se pudo iniciar el servidor local en el puerto {port}: {e}"
|
|
131
131
|
|
|
132
|
-
print(f"Abriendo el navegador para autenticar en
|
|
132
|
+
print(f"Abriendo el navegador para autenticar en LOKTAR...")
|
|
133
133
|
print(f"URL: {auth_url}\n")
|
|
134
134
|
try:
|
|
135
135
|
webbrowser.open(auth_url)
|
|
@@ -35,16 +35,16 @@ def _get_as_json(ctx: click.Context, local_flag: bool) -> bool:
|
|
|
35
35
|
|
|
36
36
|
|
|
37
37
|
@click.group(invoke_without_command=False,
|
|
38
|
-
epilog="Primer uso:
|
|
39
|
-
@click.option("--url", "-u", default=None, help="Base URL del servidor
|
|
38
|
+
epilog="Primer uso: loktar skill | Para agentes: loktar -j skill")
|
|
39
|
+
@click.option("--url", "-u", default=None, help="Base URL del servidor LOKTAR (default: https://loktar.cc).")
|
|
40
40
|
@click.option("--token", "-t", default=None, help="API Key / Token de autenticación (lk_...).")
|
|
41
41
|
@click.option("--json", "-j", "as_json", is_flag=True, help="Salida en JSON bruto (ideal para scripts y agentes).")
|
|
42
|
-
@click.version_option(version=__version__, prog_name="
|
|
42
|
+
@click.version_option(version=__version__, prog_name="loktar")
|
|
43
43
|
@click.pass_context
|
|
44
44
|
def cli(ctx: click.Context, url: Optional[str], token: Optional[str], as_json: bool):
|
|
45
|
-
"""
|
|
45
|
+
"""LOKTAR CLI - Cliente super eficiente de herramientas IA para humanos y agentes.
|
|
46
46
|
|
|
47
|
-
Primer uso:
|
|
47
|
+
Primer uso: loktar skill | Para agentes: loktar -j skill
|
|
48
48
|
"""
|
|
49
49
|
resolved_url = resolve_api_url(url)
|
|
50
50
|
resolved_token = resolve_token(token)
|
|
@@ -61,7 +61,7 @@ Primer uso: lockthard skill | Para agentes: lockthard -j skill
|
|
|
61
61
|
help="Salida en JSON bruto (ideal para scripts y agentes).")
|
|
62
62
|
@click.pass_context
|
|
63
63
|
def ping(ctx: click.Context, as_json_local: bool):
|
|
64
|
-
"""Verifica la conectividad con el servidor de
|
|
64
|
+
"""Verifica la conectividad con el servidor de LOKTAR y el estado del token."""
|
|
65
65
|
client: LockthardClient = ctx.obj["client"]
|
|
66
66
|
as_json = _get_as_json(ctx, as_json_local)
|
|
67
67
|
try:
|
|
@@ -76,22 +76,22 @@ def ping(ctx: click.Context, as_json_local: bool):
|
|
|
76
76
|
@click.option("--manual", "-m", is_flag=True, help="Modo interactivo en consola (sin abrir navegador).")
|
|
77
77
|
@click.pass_context
|
|
78
78
|
def login(ctx: click.Context, token: Optional[str], manual: bool):
|
|
79
|
-
"""Inicia sesión en
|
|
79
|
+
"""Inicia sesión en LOKTAR (Browser OAuth, Token o Interactivo)."""
|
|
80
80
|
api_url = ctx.obj["url"]
|
|
81
81
|
|
|
82
82
|
# 1. Direct token via flag
|
|
83
83
|
if token and token.strip():
|
|
84
84
|
save_credentials(api_key=token.strip(), api_url=api_url)
|
|
85
|
-
click.secho("✓ API Key guardada correctamente en ~/.
|
|
85
|
+
click.secho("✓ API Key guardada correctamente en ~/.loktar/credentials.json", fg="green")
|
|
86
86
|
return
|
|
87
87
|
|
|
88
88
|
# 2. Manual prompt via flag
|
|
89
89
|
if manual:
|
|
90
|
-
token_input = click.prompt("Pega tu API Key de
|
|
90
|
+
token_input = click.prompt("Pega tu API Key de LOKTAR (lk_...)", hide_input=True)
|
|
91
91
|
if not token_input or not token_input.strip():
|
|
92
92
|
_handle_error(LockthardError("Token vacío."))
|
|
93
93
|
save_credentials(api_key=token_input.strip(), api_url=api_url)
|
|
94
|
-
click.secho("✓ API Key guardada correctamente en ~/.
|
|
94
|
+
click.secho("✓ API Key guardada correctamente en ~/.loktar/credentials.json", fg="green")
|
|
95
95
|
return
|
|
96
96
|
|
|
97
97
|
# 3. Interactive Browser Login
|
|
@@ -101,14 +101,14 @@ def login(ctx: click.Context, token: Optional[str], manual: bool):
|
|
|
101
101
|
click.secho(f"✓ {msg}", fg="green")
|
|
102
102
|
else:
|
|
103
103
|
click.secho(f"✗ {msg}", fg="yellow")
|
|
104
|
-
click.echo("Puedes autenticarte manualmente con:
|
|
104
|
+
click.echo("Puedes autenticarte manualmente con: loktar login --token lk_tu_token")
|
|
105
105
|
|
|
106
106
|
|
|
107
107
|
@cli.command()
|
|
108
108
|
def logout():
|
|
109
109
|
"""Cierra la sesión y elimina las credenciales locales."""
|
|
110
110
|
if clear_credentials():
|
|
111
|
-
click.secho("✓ Sesión cerrada y credenciales eliminadas (~/.
|
|
111
|
+
click.secho("✓ Sesión cerrada y credenciales eliminadas (~/.loktar/credentials.json).", fg="green")
|
|
112
112
|
else:
|
|
113
113
|
click.echo("No había ninguna sesión activa guardada.")
|
|
114
114
|
|
|
@@ -121,7 +121,7 @@ def logout():
|
|
|
121
121
|
@click.option("--limit", "-l", default=20, type=int, help="Límite de resultados (default: 20).")
|
|
122
122
|
@click.pass_context
|
|
123
123
|
def search(ctx: click.Context, as_json_local: bool, query: str, tablet: Optional[str], limit: int):
|
|
124
|
-
"""Busca herramientas por palabra clave en
|
|
124
|
+
"""Busca herramientas por palabra clave en LOKTAR."""
|
|
125
125
|
client: LockthardClient = ctx.obj["client"]
|
|
126
126
|
as_json = _get_as_json(ctx, as_json_local)
|
|
127
127
|
try:
|
|
@@ -133,7 +133,7 @@ def search(ctx: click.Context, as_json_local: bool, query: str, tablet: Optional
|
|
|
133
133
|
|
|
134
134
|
@cli.group()
|
|
135
135
|
def tablets():
|
|
136
|
-
"""Comandos para explorar las tablets de
|
|
136
|
+
"""Comandos para explorar las tablets de LOKTAR."""
|
|
137
137
|
pass
|
|
138
138
|
|
|
139
139
|
|
|
@@ -197,7 +197,7 @@ def get_tool_cmd(ctx: click.Context, as_json_local: bool, tool_id: str):
|
|
|
197
197
|
help="Salida en JSON bruto (ideal para scripts y agentes).")
|
|
198
198
|
@click.pass_context
|
|
199
199
|
def cli_tools_cmd(ctx: click.Context, as_json_local: bool):
|
|
200
|
-
"""Lista las herramientas especializadas de línea de comandos en
|
|
200
|
+
"""Lista las herramientas especializadas de línea de comandos en LOKTAR."""
|
|
201
201
|
client: LockthardClient = ctx.obj["client"]
|
|
202
202
|
as_json = _get_as_json(ctx, as_json_local)
|
|
203
203
|
try:
|
|
@@ -53,7 +53,7 @@ class LockthardClient:
|
|
|
53
53
|
url = f"{self.base_url}/api/mcp"
|
|
54
54
|
resp = self._session.post(url, json=payload, timeout=self.timeout)
|
|
55
55
|
if resp.status_code == 401:
|
|
56
|
-
raise LockthardError("No autorizado: Token inválido. Inicia sesión con '
|
|
56
|
+
raise LockthardError("No autorizado: Token inválido. Inicia sesión con 'loktar login'.")
|
|
57
57
|
resp.raise_for_status()
|
|
58
58
|
data = resp.json()
|
|
59
59
|
if "error" in data:
|
|
@@ -5,25 +5,29 @@ from pathlib import Path
|
|
|
5
5
|
from typing import Dict, Any, Optional
|
|
6
6
|
|
|
7
7
|
DEFAULT_API_URL = "https://loktar.cc"
|
|
8
|
-
CONFIG_DIR_NAME = ".
|
|
8
|
+
CONFIG_DIR_NAME = ".loktar"
|
|
9
|
+
FALLBACK_CONFIG_DIR_NAME = ".lockthard"
|
|
9
10
|
CREDENTIALS_FILE_NAME = "credentials.json"
|
|
10
11
|
|
|
11
12
|
|
|
12
13
|
def get_config_dir() -> Path:
|
|
13
|
-
"""Return the configuration directory path (~/.lockthard)."""
|
|
14
|
+
"""Return the configuration directory path (~/.loktar or fallback ~/.lockthard)."""
|
|
14
15
|
home = Path.home()
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
primary = home / CONFIG_DIR_NAME
|
|
17
|
+
fallback = home / FALLBACK_CONFIG_DIR_NAME
|
|
18
|
+
if not primary.exists() and fallback.exists():
|
|
19
|
+
return fallback
|
|
20
|
+
primary.mkdir(parents=True, exist_ok=True)
|
|
21
|
+
return primary
|
|
18
22
|
|
|
19
23
|
|
|
20
24
|
def get_credentials_path() -> Path:
|
|
21
|
-
"""Return the credentials file path (~/.
|
|
25
|
+
"""Return the credentials file path (~/.loktar/credentials.json)."""
|
|
22
26
|
return get_config_dir() / CREDENTIALS_FILE_NAME
|
|
23
27
|
|
|
24
28
|
|
|
25
29
|
def load_credentials() -> Dict[str, Any]:
|
|
26
|
-
"""Load credentials from ~/.
|
|
30
|
+
"""Load credentials from ~/.loktar/credentials.json if exists."""
|
|
27
31
|
path = get_credentials_path()
|
|
28
32
|
if not path.exists():
|
|
29
33
|
return {}
|
|
@@ -36,7 +40,11 @@ def load_credentials() -> Dict[str, Any]:
|
|
|
36
40
|
|
|
37
41
|
def save_credentials(api_key: str, email: Optional[str] = None, api_url: Optional[str] = None) -> Path:
|
|
38
42
|
"""Save credentials securely with restricted permissions (0600 on POSIX)."""
|
|
39
|
-
|
|
43
|
+
home = Path.home()
|
|
44
|
+
primary_dir = home / CONFIG_DIR_NAME
|
|
45
|
+
primary_dir.mkdir(parents=True, exist_ok=True)
|
|
46
|
+
path = primary_dir / CREDENTIALS_FILE_NAME
|
|
47
|
+
|
|
40
48
|
data = load_credentials()
|
|
41
49
|
data["api_key"] = api_key.strip()
|
|
42
50
|
if email:
|
|
@@ -59,27 +67,30 @@ def save_credentials(api_key: str, email: Optional[str] = None, api_url: Optiona
|
|
|
59
67
|
|
|
60
68
|
def clear_credentials() -> bool:
|
|
61
69
|
"""Remove the credentials file on logout."""
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
+
removed = False
|
|
71
|
+
home = Path.home()
|
|
72
|
+
for dname in (CONFIG_DIR_NAME, FALLBACK_CONFIG_DIR_NAME):
|
|
73
|
+
path = home / dname / CREDENTIALS_FILE_NAME
|
|
74
|
+
if path.exists():
|
|
75
|
+
try:
|
|
76
|
+
path.unlink()
|
|
77
|
+
removed = True
|
|
78
|
+
except OSError:
|
|
79
|
+
pass
|
|
80
|
+
return removed
|
|
70
81
|
|
|
71
82
|
|
|
72
83
|
def resolve_token(token_flag: Optional[str] = None) -> Optional[str]:
|
|
73
84
|
"""
|
|
74
85
|
Resolve API key token in precedence order:
|
|
75
86
|
1. Direct CLI argument / flag (--token)
|
|
76
|
-
2. Environment variable LOCKTHARD_API_KEY
|
|
77
|
-
3. Saved credentials (~/.lockthard/credentials.json)
|
|
87
|
+
2. Environment variable LOKTAR_API_KEY (or LOCKTHARD_API_KEY)
|
|
88
|
+
3. Saved credentials (~/.loktar/credentials.json or ~/.lockthard/credentials.json)
|
|
78
89
|
"""
|
|
79
90
|
if token_flag and token_flag.strip():
|
|
80
91
|
return token_flag.strip()
|
|
81
92
|
|
|
82
|
-
env_token = os.environ.get("LOCKTHARD_API_KEY")
|
|
93
|
+
env_token = os.environ.get("LOKTAR_API_KEY") or os.environ.get("LOCKTHARD_API_KEY")
|
|
83
94
|
if env_token and env_token.strip():
|
|
84
95
|
return env_token.strip()
|
|
85
96
|
|
|
@@ -95,14 +106,14 @@ def resolve_api_url(url_flag: Optional[str] = None) -> str:
|
|
|
95
106
|
"""
|
|
96
107
|
Resolve API Base URL in precedence order:
|
|
97
108
|
1. Direct CLI argument / flag (--url)
|
|
98
|
-
2. Environment variable LOCKTHARD_API_URL
|
|
109
|
+
2. Environment variable LOKTAR_API_URL (or LOCKTHARD_API_URL)
|
|
99
110
|
3. Saved credentials api_url
|
|
100
111
|
4. Default (https://loktar.cc)
|
|
101
112
|
"""
|
|
102
113
|
if url_flag and url_flag.strip():
|
|
103
114
|
return url_flag.strip().rstrip("/")
|
|
104
115
|
|
|
105
|
-
env_url = os.environ.get("LOCKTHARD_API_URL")
|
|
116
|
+
env_url = os.environ.get("LOKTAR_API_URL") or os.environ.get("LOCKTHARD_API_URL")
|
|
106
117
|
if env_url and env_url.strip():
|
|
107
118
|
return env_url.strip().rstrip("/")
|
|
108
119
|
|
|
@@ -38,10 +38,10 @@ def print_ping_result(data: Dict[str, Any], as_json: bool = False):
|
|
|
38
38
|
|
|
39
39
|
if HAS_RICH and console:
|
|
40
40
|
if status == "ok" and auth:
|
|
41
|
-
console.print("[bold green]✓ Servidor
|
|
41
|
+
console.print("[bold green]✓ Servidor LOKTAR activo y token autenticado correctamente.[/bold green]")
|
|
42
42
|
elif status == "ok":
|
|
43
|
-
console.print("[bold yellow]! Servidor
|
|
44
|
-
console.print("[dim]Usa '
|
|
43
|
+
console.print("[bold yellow]! Servidor LOKTAR activo (Sesión no autenticada).[/bold yellow]")
|
|
44
|
+
console.print("[dim]Usa 'loktar login' o exporta LOKTAR_API_KEY para autenticar.[/dim]")
|
|
45
45
|
else:
|
|
46
46
|
console.print(f"[bold red]✗ Error de conexión: {data.get('error', 'Desconocido')}[/bold red]")
|
|
47
47
|
else:
|
|
@@ -58,7 +58,7 @@ def print_tablets_list(tablets: List[Dict[str, Any]], as_json: bool = False):
|
|
|
58
58
|
return
|
|
59
59
|
|
|
60
60
|
if HAS_RICH and console:
|
|
61
|
-
table = Table(title=f"
|
|
61
|
+
table = Table(title=f"LOKTAR Tablets ({len(tablets)})", show_header=True, header_style="bold magenta")
|
|
62
62
|
table.add_column("ID / Slug", style="cyan", no_wrap=True)
|
|
63
63
|
table.add_column("Título", style="bold white")
|
|
64
64
|
table.add_column("Categoría", style="yellow")
|
|
@@ -216,16 +216,16 @@ def print_cli_tools(tools: List[Dict[str, Any]], as_json: bool = False):
|
|
|
216
216
|
|
|
217
217
|
def print_agent_guide():
|
|
218
218
|
guide_md = """
|
|
219
|
-
#
|
|
219
|
+
# LOKTAR CLI - Guía para Agentes de IA
|
|
220
220
|
|
|
221
|
-
Bienvenido a la CLI de **
|
|
221
|
+
Bienvenido a la CLI de **LOKTAR**. Esta interfaz permite a Agentes de IA (Claude Code, Antigravity, Aider, Cursor) consultar la base de datos de 1200+ herramientas IA con mínimo consumo de tokens.
|
|
222
222
|
|
|
223
223
|
## SKILL Completa
|
|
224
224
|
|
|
225
225
|
Para obtener la guía completa optimizada para agentes, ejecuta:
|
|
226
226
|
|
|
227
227
|
```bash
|
|
228
|
-
|
|
228
|
+
loktar skill
|
|
229
229
|
```
|
|
230
230
|
|
|
231
231
|
Esto imprime la SKILL.md con toda la referencia: comandos, estructura de tablets, flujo de trabajo y ejemplos.
|
|
@@ -235,21 +235,21 @@ Esto imprime la SKILL.md con toda la referencia: comandos, estructura de tablets
|
|
|
235
235
|
1. **Usa el flag `-j` (posicion global o en subcommand):**
|
|
236
236
|
Devuelve datos limpios y estructurados en JSON.
|
|
237
237
|
```bash
|
|
238
|
-
|
|
239
|
-
|
|
238
|
+
loktar -j search "ocr"
|
|
239
|
+
loktar tablets list -j
|
|
240
240
|
```
|
|
241
241
|
|
|
242
242
|
2. **Flujo de Trabajo Recomendado:**
|
|
243
|
-
- `
|
|
244
|
-
- `
|
|
245
|
-
- `
|
|
246
|
-
- `
|
|
247
|
-
- `
|
|
243
|
+
- `loktar ping`: Verificar conexión y autenticación.
|
|
244
|
+
- `loktar tablets list`: Ver todos los tablets y categorías disponibles.
|
|
245
|
+
- `loktar search "<termino>"`: Buscar herramientas por palabras clave.
|
|
246
|
+
- `loktar tablets get <id>`: Obtener todas las herramientas de un tablet específico.
|
|
247
|
+
- `loktar tools get "<nombre>"`: Ver detalles y comandos exactos de una herramienta.
|
|
248
248
|
|
|
249
249
|
3. **Autenticación en Agentes:**
|
|
250
|
-
Define la variable de entorno `
|
|
250
|
+
Define la variable de entorno `LOKTAR_API_KEY`:
|
|
251
251
|
```bash
|
|
252
|
-
export
|
|
252
|
+
export LOKTAR_API_KEY="lk_tu_token_aqui"
|
|
253
253
|
```
|
|
254
254
|
"""
|
|
255
255
|
if HAS_RICH and console:
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: lockthard-cli
|
|
3
|
-
Version: 0.2.
|
|
4
|
-
Summary: CLI and AI agent client for
|
|
5
|
-
Author-email:
|
|
3
|
+
Version: 0.2.8
|
|
4
|
+
Summary: CLI and AI agent client for LOKTAR — query 2100+ curated AI tools across 86+ tablets
|
|
5
|
+
Author-email: Loktar Team <info@loktar.cc>
|
|
6
6
|
License: MIT
|
|
7
7
|
Project-URL: Homepage, https://loktar.cc
|
|
8
|
-
Keywords: cli,ai-tools,agents,mcp,lockthard
|
|
8
|
+
Keywords: cli,ai-tools,agents,mcp,loktar,lockthard
|
|
9
9
|
Classifier: Development Status :: 4 - Beta
|
|
10
10
|
Classifier: Environment :: Console
|
|
11
11
|
Classifier: Intended Audience :: Developers
|
|
@@ -20,16 +20,18 @@ Requires-Dist: click>=8.1.0
|
|
|
20
20
|
Requires-Dist: requests>=2.28.0
|
|
21
21
|
Requires-Dist: rich>=13.0.0
|
|
22
22
|
|
|
23
|
-
#
|
|
23
|
+
# LOKTAR CLI (`loktar`)
|
|
24
24
|
|
|
25
|
-
A super efficient, scriptable command-line interface and AI agent client for **
|
|
25
|
+
A super efficient, scriptable command-line interface and AI agent client for **LOKTAR** (https://loktar.cc).
|
|
26
26
|
|
|
27
|
-
Allows both human developers and autonomous AI agents (Claude Code, Antigravity, Aider, Cursor, etc.) to query, search, and inspect
|
|
27
|
+
Allows both human developers and autonomous AI agents (Claude Code, Antigravity, Aider, Cursor, etc.) to query, search, and inspect 86+ tablets and 2100+ AI tools with minimum token usage and zero prompt overhead.
|
|
28
|
+
|
|
29
|
+
*(Note: The command `lockthard` is also provided as a fully compatible alias)*
|
|
28
30
|
|
|
29
31
|
## Installation
|
|
30
32
|
|
|
31
33
|
```bash
|
|
32
|
-
pip install lockthard-cli
|
|
34
|
+
pip install --upgrade lockthard-cli
|
|
33
35
|
```
|
|
34
36
|
|
|
35
37
|
Or run without installing:
|
|
@@ -45,40 +47,44 @@ Get your API key from [loktar.cc](https://loktar.cc).
|
|
|
45
47
|
|
|
46
48
|
- **For AI Agents & CI/CD:**
|
|
47
49
|
```bash
|
|
48
|
-
export
|
|
50
|
+
export LOKTAR_API_KEY="lk_your_token_here"
|
|
51
|
+
# (LOCKTHARD_API_KEY is also supported as fallback)
|
|
49
52
|
```
|
|
50
53
|
- **Interactive Browser Login (Humans):**
|
|
51
54
|
```bash
|
|
52
|
-
|
|
55
|
+
loktar login
|
|
53
56
|
```
|
|
54
57
|
- **Manual Login:**
|
|
55
58
|
```bash
|
|
56
|
-
|
|
59
|
+
loktar login --token "lk_your_token_here"
|
|
57
60
|
```
|
|
58
61
|
|
|
59
62
|
### 2. Commands
|
|
60
63
|
|
|
61
64
|
```bash
|
|
62
65
|
# Ping service
|
|
63
|
-
|
|
66
|
+
loktar ping
|
|
64
67
|
|
|
65
|
-
# Search tools (returns concise
|
|
66
|
-
|
|
68
|
+
# Search tools (returns concise table)
|
|
69
|
+
loktar search "ocr"
|
|
67
70
|
|
|
68
71
|
# Search tools in raw JSON (for agents / jq)
|
|
69
|
-
|
|
72
|
+
loktar -j search "ocr"
|
|
70
73
|
|
|
71
74
|
# List all tablets
|
|
72
|
-
|
|
75
|
+
loktar tablets list
|
|
73
76
|
|
|
74
77
|
# Inspect a specific tablet
|
|
75
|
-
|
|
78
|
+
loktar tablets get ocr
|
|
76
79
|
|
|
77
80
|
# Inspect tool details
|
|
78
|
-
|
|
81
|
+
loktar tools get "Chandra OCR"
|
|
79
82
|
|
|
80
83
|
# Display CLI agent guide
|
|
81
|
-
|
|
84
|
+
loktar guide
|
|
85
|
+
|
|
86
|
+
# Display full agent skill
|
|
87
|
+
loktar skill
|
|
82
88
|
```
|
|
83
89
|
|
|
84
90
|
## Options
|
|
@@ -4,15 +4,15 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "lockthard-cli"
|
|
7
|
-
version = "0.2.
|
|
8
|
-
description = "CLI and AI agent client for
|
|
7
|
+
version = "0.2.8"
|
|
8
|
+
description = "CLI and AI agent client for LOKTAR — query 2100+ curated AI tools across 86+ tablets"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = { text = "MIT" }
|
|
11
11
|
requires-python = ">=3.10"
|
|
12
12
|
authors = [
|
|
13
|
-
{ name = "
|
|
13
|
+
{ name = "Loktar Team", email = "info@loktar.cc" }
|
|
14
14
|
]
|
|
15
|
-
keywords = ["cli", "ai-tools", "agents", "mcp", "lockthard"]
|
|
15
|
+
keywords = ["cli", "ai-tools", "agents", "mcp", "loktar", "lockthard"]
|
|
16
16
|
classifiers = [
|
|
17
17
|
"Development Status :: 4 - Beta",
|
|
18
18
|
"Environment :: Console",
|
|
@@ -33,6 +33,7 @@ dependencies = [
|
|
|
33
33
|
Homepage = "https://loktar.cc"
|
|
34
34
|
|
|
35
35
|
[project.scripts]
|
|
36
|
+
loktar = "lockthard_cli.cli:main"
|
|
36
37
|
lockthard = "lockthard_cli.cli:main"
|
|
37
38
|
|
|
38
39
|
[tool.setuptools.packages.find]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|