theus-cli 0.1.0
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.
- package/README.md +245 -0
- package/bin/theus +30 -0
- package/cli.js +484158 -0
- package/constants/asciiArt/generated.ts +31 -0
- package/constants/asciiArt/index.ts +81 -0
- package/constants/asciiArt/theus-hero.ans +30 -0
- package/constants/asciiArt/theus-hero.txt +44 -0
- package/constants/asciiArt/theus-logo.ans +20 -0
- package/constants/asciiArt/theus-logo.txt +36 -0
- package/constants/asciiArt/theus-vitruvian.ans +33 -0
- package/constants/asciiArt/theus-vitruvian.txt +53 -0
- package/package.json +110 -0
package/README.md
ADDED
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
# THEUS
|
|
2
|
+
|
|
3
|
+
**THEUS HECHO EN PERU**
|
|
4
|
+
**AD ASTRA PER ASPERA**
|
|
5
|
+
Dominio comercial: `theus.pe`
|
|
6
|
+
|
|
7
|
+
Theus es un agente CLI local-first para programar, entender proyectos, levantar memoria de codigo, visualizar grafos y explorar bases de datos. El producto nace para que cada usuario conecte su propio modelo local o su propia API key, sin depender de una marca externa ni de un proveedor unico.
|
|
8
|
+
|
|
9
|
+
Esto ya no es un documento de estudio ni una propuesta de rebrand. Este repositorio es la base del producto Theus.
|
|
10
|
+
|
|
11
|
+
## Que hace Theus
|
|
12
|
+
|
|
13
|
+
- Abre una sesion interactiva desde cualquier proyecto con `theus`.
|
|
14
|
+
- Indexa el proyecto localmente para reducir contexto repetido y mejorar memoria.
|
|
15
|
+
- Levanta una API local en `127.0.0.1` con estado, grafo y esquema de base de datos.
|
|
16
|
+
- Abre un dashboard visual del proyecto con mapa neuronal, archivos, simbolos, entidades, base de datos y memoria.
|
|
17
|
+
- Permite conectar modelos locales, endpoints OpenAI-compatible o proveedores BYOK.
|
|
18
|
+
- Mantiene paquetes propios en `vendor/theus-packages/` para preparar exports SDK, tipos y stubs de producto.
|
|
19
|
+
- Usa identidad Theus: `.theus`, variables `THEUS_*`, dominio `theus.pe` y copy en espanol primero.
|
|
20
|
+
|
|
21
|
+
## Instalacion para usuarios
|
|
22
|
+
|
|
23
|
+
Requisito de runtime: **Bun**. Theus se compila y se ejecuta con Bun (`cli.js` es
|
|
24
|
+
un bundle con target `bun`, no corre bajo Node). Si no tienes Bun, cualquiera de
|
|
25
|
+
las opciones de abajo lo instala por ti, o hazlo manualmente:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
curl -fsSL https://bun.sh/install | bash
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### Opcion A — npm (global)
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
npm install -g theus-cli
|
|
35
|
+
theus --version
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Uso normal:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
cd /ruta/de/tu/proyecto
|
|
42
|
+
theus
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Ejecucion puntual sin instalar (descarga temporal):
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
npx theus-cli --help
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
> Nota: el paquete publica un unico bundle self-contained (`cli.js`) con shebang
|
|
52
|
+
> `#!/usr/bin/env bun`. `npm install -g` crea el enlace `theus` apuntando a ese
|
|
53
|
+
> bundle; necesitas Bun en el PATH para ejecutarlo.
|
|
54
|
+
|
|
55
|
+
### Opcion B — instalador (curl | bash)
|
|
56
|
+
|
|
57
|
+
Instala Bun si falta, clona el CLI, compila el bundle y enlaza `theus` en tu PATH:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
curl -fsSL https://theus.pe/install.sh | bash
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Variables opcionales del instalador: `THEUS_REPO_URL`, `THEUS_REF`, `THEUS_HOME`,
|
|
64
|
+
`THEUS_BIN_DIR`. El script vive en `scripts/install.sh`.
|
|
65
|
+
|
|
66
|
+
### Opcion C — desde el repositorio (desarrollo)
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
bun install
|
|
70
|
+
bun run build # genera cli.js self-contained
|
|
71
|
+
./cli.js --version # o: bun run dev
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Para escribir `theus` desde cualquier proyecto durante el desarrollo, enlaza el
|
|
75
|
+
bundle compilado:
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
ln -sf "$(pwd)/cli.js" /usr/local/bin/theus
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Conectar un modelo
|
|
82
|
+
|
|
83
|
+
Theus lee primero variables `THEUS_*`. Puedes apuntar a Ollama, LM Studio, LiteLLM, OpenRouter, un gateway propio o cualquier servidor OpenAI-compatible.
|
|
84
|
+
|
|
85
|
+
Ejemplo con endpoint local:
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
export THEUS_BASE_URL="http://127.0.0.1:11434/v1"
|
|
89
|
+
export THEUS_MODEL="llama3.1"
|
|
90
|
+
export THEUS_API_KEY="local"
|
|
91
|
+
theus
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Ejemplo con archivo de proveedores:
|
|
95
|
+
|
|
96
|
+
```json
|
|
97
|
+
{
|
|
98
|
+
"providers": [
|
|
99
|
+
{
|
|
100
|
+
"id": "ollama",
|
|
101
|
+
"adapter": "openai-compatible",
|
|
102
|
+
"enabled": true,
|
|
103
|
+
"options": {
|
|
104
|
+
"baseURL": "http://127.0.0.1:11434/v1",
|
|
105
|
+
"model": "llama3.1",
|
|
106
|
+
"apiKey": "local"
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
],
|
|
110
|
+
"policy": {
|
|
111
|
+
"text": ["ollama"]
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
Ruta esperada del archivo:
|
|
117
|
+
|
|
118
|
+
```text
|
|
119
|
+
~/.theus/providers.json
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## Dashboard local
|
|
123
|
+
|
|
124
|
+
Al iniciar Theus dentro de un proyecto, el servicio de inteligencia local:
|
|
125
|
+
|
|
126
|
+
- recorre archivos relevantes,
|
|
127
|
+
- extrae simbolos,
|
|
128
|
+
- construye nodos y relaciones,
|
|
129
|
+
- detecta esquemas SQL/Prisma,
|
|
130
|
+
- guarda indice y memoria bajo `~/.theus/knowledge/`,
|
|
131
|
+
- expone un dashboard local.
|
|
132
|
+
|
|
133
|
+
Endpoints disponibles:
|
|
134
|
+
|
|
135
|
+
```text
|
|
136
|
+
/dashboard
|
|
137
|
+
/api/health
|
|
138
|
+
/api/status
|
|
139
|
+
/api/graph
|
|
140
|
+
/api/database
|
|
141
|
+
/api/db
|
|
142
|
+
/api/schema
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## Login y cuenta Theus
|
|
146
|
+
|
|
147
|
+
El flujo remoto usa la arquitectura OAuth heredada, pero servida por `theus.pe`.
|
|
148
|
+
|
|
149
|
+
```text
|
|
150
|
+
GET https://theus.pe/cai/oauth/authorize
|
|
151
|
+
POST https://theus.pe/v1/oauth/token
|
|
152
|
+
GET https://theus.pe/api/oauth/profile
|
|
153
|
+
GET https://theus.pe/api/oauth/theus_cli/roles
|
|
154
|
+
POST https://theus.pe/api/oauth/theus_cli/create_api_key
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
Uso directo:
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
theus login
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
Ese comando abre `https://theus.pe/cai/oauth/authorize`, recibe el callback local, intercambia `code` por token OAuth y crea una API key Theus para configurar la terminal. La ruta de suscripcion dentro del CLI tambien apunta a `https://theus.pe/cai/oauth/authorize`; no debe abrir dominios externos como flujo principal de producto.
|
|
164
|
+
|
|
165
|
+
Variables utiles:
|
|
166
|
+
|
|
167
|
+
| Variable | Uso |
|
|
168
|
+
| --- | --- |
|
|
169
|
+
| `THEUS_BASE_URL` | URL base del proveedor OpenAI-compatible |
|
|
170
|
+
| `THEUS_OPENAI_BASE_URL` | Alias compatible para proveedor OpenAI-compatible |
|
|
171
|
+
| `THEUS_MODEL` | Modelo principal |
|
|
172
|
+
| `THEUS_OPENAI_MODEL` | Alias compatible de modelo |
|
|
173
|
+
| `THEUS_API_KEY` | API key del proveedor |
|
|
174
|
+
| `THEUS_PROVIDER_ID` | Nombre visible del proveedor activo |
|
|
175
|
+
| `THEUS_DISABLE_MAIN_PROVIDER=1` | Fuerza el motor de compatibilidad |
|
|
176
|
+
| `THEUS_DISABLE_TOOLS=1` | Desactiva tool-calling para endpoints simples |
|
|
177
|
+
| `THEUS_NO_PROJECT_INTELLIGENCE=1` | No levanta indice/API/dashboard |
|
|
178
|
+
| `THEUS_NO_OPEN_DASHBOARD=1` | Levanta API sin abrir el navegador |
|
|
179
|
+
| `PROJECT_API_PORT=65235` | Fija el puerto local |
|
|
180
|
+
| `INDEX_MAX_FILES=2500` | Limite de archivos indexados |
|
|
181
|
+
| `THEUS_ENABLE_OFFICIAL_MARKETPLACE_AUTOINSTALL=1` | Opt-in para marketplace oficial |
|
|
182
|
+
|
|
183
|
+
## Comandos principales
|
|
184
|
+
|
|
185
|
+
| Comando | Proposito |
|
|
186
|
+
| --- | --- |
|
|
187
|
+
| `theus` | Inicia la sesion interactiva |
|
|
188
|
+
| `theus -p "prompt"` | Ejecuta en modo no interactivo |
|
|
189
|
+
| `theus --help` | Muestra ayuda |
|
|
190
|
+
| `/help` | Ayuda dentro del REPL |
|
|
191
|
+
| `/login` | Configuracion de acceso cuando se usa una cuenta remota |
|
|
192
|
+
| `/model` | Seleccion de modelo |
|
|
193
|
+
| `/mcp` | Servidores MCP |
|
|
194
|
+
| `/permissions` | Permisos de herramientas |
|
|
195
|
+
| `/init` | Inicializa documentacion de proyecto |
|
|
196
|
+
|
|
197
|
+
El copy visible debe mantenerse en espanol primero. Cuando haga sentido, una etiqueta corta en ingles puede aparecer como apoyo: `Iniciar / Start`, `Base de datos / Database`, `Mapa neuronal / Neural map`.
|
|
198
|
+
|
|
199
|
+
## Estructura importante
|
|
200
|
+
|
|
201
|
+
```text
|
|
202
|
+
bin/theus launcher local
|
|
203
|
+
entrypoints/cli.tsx entrada del CLI
|
|
204
|
+
main.tsx entrada UI heredada, evitar editar en bloque
|
|
205
|
+
screens/REPL.tsx REPL interactivo
|
|
206
|
+
components/Theus/ banner, menu, setup de proveedor
|
|
207
|
+
services/api/theus.ts router OpenAI-compatible y fallback
|
|
208
|
+
services/projectIntelligence/ API local, dashboard, base de datos visual
|
|
209
|
+
services/knowledge/ indice, memoria y grafo local
|
|
210
|
+
vendor/theus-packages/ paquetes propios SDK/MCP
|
|
211
|
+
types/theus-sdk.d.ts tipos publicos base
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
## Calidad y verificacion
|
|
215
|
+
|
|
216
|
+
Smoke tests recomendados:
|
|
217
|
+
|
|
218
|
+
```bash
|
|
219
|
+
./bin/theus --version
|
|
220
|
+
THEUS_NO_OPEN_DASHBOARD=1 ./bin/theus
|
|
221
|
+
curl http://127.0.0.1:<puerto>/api/status
|
|
222
|
+
curl http://127.0.0.1:<puerto>/api/database
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
El typecheck global todavia arrastra deuda de tipos heredados y stubs reconstruidos. No se debe presentar como verde hasta cerrar esos tipos; los cambios deben validarse con pruebas enfocadas, smoke tests del CLI y verificaciones del dashboard.
|
|
226
|
+
|
|
227
|
+
## Principios de producto
|
|
228
|
+
|
|
229
|
+
- Local-first por defecto.
|
|
230
|
+
- Cada usuario controla su modelo y su llave.
|
|
231
|
+
- Cero marca externa en el copy visible.
|
|
232
|
+
- Identidad Theus coherente: `theus`, `.theus`, `THEUS_*`, `theus.pe`.
|
|
233
|
+
- El dashboard debe explicar el proyecto, no solo dibujar puntos.
|
|
234
|
+
- Las bases de datos se muestran como capa visual real, con tablas, columnas, relaciones y fuente.
|
|
235
|
+
- Las funciones incompletas se nombran como deuda tecnica, no como promesa terminada.
|
|
236
|
+
|
|
237
|
+
## Marca
|
|
238
|
+
|
|
239
|
+
Nombre: **Theus**
|
|
240
|
+
Dominio: **theus.pe**
|
|
241
|
+
Linea: **THEUS HECHO EN PERU**
|
|
242
|
+
Lema: **AD ASTRA PER ASPERA**
|
|
243
|
+
Color base: rojo Peru, blanco, grafito profundo, acentos dorado/verde para grafos y datos.
|
|
244
|
+
|
|
245
|
+
Ultima actualizacion: 2026-07-06
|
package/bin/theus
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Theus launcher — type `theus` to start from any project.
|
|
3
|
+
# Runs the project's Bun entrypoint with the build shims preloaded.
|
|
4
|
+
# Any arguments are passed through, e.g. theus --help or theus -p "hola".
|
|
5
|
+
set -euo pipefail
|
|
6
|
+
|
|
7
|
+
SOURCE="${BASH_SOURCE[0]}"
|
|
8
|
+
while [[ -L "$SOURCE" ]]; do
|
|
9
|
+
DIR="$(cd -P "$(dirname "$SOURCE")" && pwd)"
|
|
10
|
+
SOURCE="$(readlink "$SOURCE")"
|
|
11
|
+
[[ "$SOURCE" != /* ]] && SOURCE="$DIR/$SOURCE"
|
|
12
|
+
done
|
|
13
|
+
PROJ="$(cd -P "$(dirname "$SOURCE")/.." && pwd)"
|
|
14
|
+
|
|
15
|
+
if ! command -v bun >/dev/null 2>&1; then
|
|
16
|
+
echo "theus: Bun no está instalado. Instálalo con: curl -fsSL https://bun.sh/install | bash" >&2
|
|
17
|
+
exit 1
|
|
18
|
+
fi
|
|
19
|
+
|
|
20
|
+
if [[ ! -f "$PROJ/entrypoints/cli.tsx" || ! -f "$PROJ/bun-shims/preload.ts" ]]; then
|
|
21
|
+
echo "theus: no encuentro el runtime en $PROJ" >&2
|
|
22
|
+
exit 1
|
|
23
|
+
fi
|
|
24
|
+
|
|
25
|
+
if [[ "${1:-}" == "login" || "${1:-}" == "signin" || "${1:-}" == "entrar" ]]; then
|
|
26
|
+
shift
|
|
27
|
+
exec bun --preload "$PROJ/bun-shims/preload.ts" "$PROJ/entrypoints/theus-login.ts" "$@"
|
|
28
|
+
fi
|
|
29
|
+
|
|
30
|
+
exec bun --preload "$PROJ/bun-shims/preload.ts" "$PROJ/entrypoints/cli.tsx" "$@"
|