@fiodos/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/LICENSE +77 -0
- package/README.md +128 -0
- package/package.json +30 -0
- package/src/aiAnalyze.js +469 -0
- package/src/ast.js +263 -0
- package/src/collect.js +115 -0
- package/src/graph.js +160 -0
- package/src/index.js +667 -0
- package/src/llm.js +144 -0
- package/src/loadEnv.js +81 -0
- package/src/patterns.js +28 -0
- package/src/postWireTest.js +91 -0
- package/src/renderProbe.js +333 -0
- package/src/renderProbeVue.js +136 -0
- package/src/routes.js +81 -0
- package/src/verify.js +172 -0
- package/src/verifyWire.js +215 -0
- package/src/wireHandlers.js +1789 -0
- package/src/wireWeb.js +295 -0
- package/src/wireWebMount.js +435 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
Fiodos SDK License Agreement
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Fiodos / Rodrigo Martínez. All rights reserved.
|
|
4
|
+
|
|
5
|
+
This is a proprietary, commercial software license. It is NOT an open-source
|
|
6
|
+
license. Please read it carefully before installing or using the Software.
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
"Software" means the Fiodos SDK packages (including, without limitation, the
|
|
10
|
+
@fiodos/* npm packages and the fiodos_flutter package) together with any
|
|
11
|
+
accompanying files, documentation, and updates provided by the Licensor.
|
|
12
|
+
"Service" means the hosted Fiodos backend, APIs, and related services
|
|
13
|
+
operated by the Licensor.
|
|
14
|
+
"Licensor" means Fiodos / Rodrigo Martínez (and, once incorporated, the
|
|
15
|
+
company that succeeds to these rights).
|
|
16
|
+
"You" means the individual or legal entity that installs or uses the
|
|
17
|
+
Software.
|
|
18
|
+
|
|
19
|
+
2. Grant of License.
|
|
20
|
+
Subject to Your continued compliance with this Agreement, the Licensor grants
|
|
21
|
+
You a limited, non-exclusive, non-transferable, non-sublicensable, and
|
|
22
|
+
revocable license to install and use the Software solely for the purpose of
|
|
23
|
+
integrating with and accessing the Fiodos Service from within Your own
|
|
24
|
+
applications.
|
|
25
|
+
|
|
26
|
+
3. Restrictions.
|
|
27
|
+
Except as expressly permitted in Section 2, You may NOT, in whole or in part:
|
|
28
|
+
(a) copy the Software, except for the copying strictly necessary to install
|
|
29
|
+
and run it for its intended purpose;
|
|
30
|
+
(b) modify, adapt, translate, or create derivative works of the Software;
|
|
31
|
+
(c) redistribute, publish, sublicense, sell, rent, lease, lend, or otherwise
|
|
32
|
+
make the Software available to any third party as a standalone item;
|
|
33
|
+
(d) reverse engineer, decompile, or disassemble the Software, or attempt to
|
|
34
|
+
derive its source code, except and only to the extent that this
|
|
35
|
+
restriction is expressly prohibited by applicable law;
|
|
36
|
+
(e) remove, obscure, or alter any copyright, trademark, or other proprietary
|
|
37
|
+
notices contained in the Software; or
|
|
38
|
+
(f) use the Software, or any portion of it, to develop, train, or assist in
|
|
39
|
+
developing a product or service that competes with Fiodos.
|
|
40
|
+
|
|
41
|
+
4. Reservation of Rights.
|
|
42
|
+
The Software is licensed, not sold. All right, title, and interest in and to
|
|
43
|
+
the Software, including all related intellectual property rights, are and
|
|
44
|
+
shall remain the exclusive property of the Licensor. All rights not expressly
|
|
45
|
+
granted to You under this Agreement are reserved by the Licensor.
|
|
46
|
+
|
|
47
|
+
5. Termination.
|
|
48
|
+
This license terminates automatically and immediately if You breach any term
|
|
49
|
+
of this Agreement. Upon termination, You must cease all use of the Software
|
|
50
|
+
and delete all copies in Your possession or control. Sections 3, 4, 6, and 7
|
|
51
|
+
survive termination.
|
|
52
|
+
|
|
53
|
+
6. Disclaimer of Warranty.
|
|
54
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
55
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
56
|
+
FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT.
|
|
57
|
+
|
|
58
|
+
7. Limitation of Liability.
|
|
59
|
+
TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, IN NO EVENT SHALL THE
|
|
60
|
+
LICENSOR BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER LIABILITY, WHETHER IN AN
|
|
61
|
+
ACTION OF CONTRACT, TORT, OR OTHERWISE, ARISING FROM, OUT OF, OR IN CONNECTION
|
|
62
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
63
|
+
|
|
64
|
+
8. Contact.
|
|
65
|
+
For licensing inquiries, contact Rodrigo Martínez (Fiodos).
|
|
66
|
+
|
|
67
|
+
--------------------------------------------------------------------------------
|
|
68
|
+
|
|
69
|
+
Nota (ES) — Licencia propietaria:
|
|
70
|
+
Se permite INSTALAR y USAR el SDK únicamente para integrar y acceder al servicio
|
|
71
|
+
Fiodos desde tus propias aplicaciones. Quedan PROHIBIDOS: copiar el código (salvo
|
|
72
|
+
la copia imprescindible para instalarlo y ejecutarlo), modificarlo, redistribuirlo,
|
|
73
|
+
sublicenciarlo, venderlo, hacer ingeniería inversa o crear obras derivadas o un
|
|
74
|
+
producto que compita con Fiodos. El software se licencia, no se vende; todos los
|
|
75
|
+
derechos no concedidos expresamente quedan reservados al Licenciante. Este texto
|
|
76
|
+
corresponde a la fase de pruebas y será revisado por un abogado al constituir la
|
|
77
|
+
sociedad.
|
package/README.md
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
# @fiodos/auto-manifest — motor de auto-detección (v3, AI-first)
|
|
2
|
+
|
|
3
|
+
Motor que analiza una app Expo/React Native y genera un borrador de `AppManifest`
|
|
4
|
+
(esquema real de `@fiodos/core`). **La IA lee el código fuente directamente** y
|
|
5
|
+
propone rutas y acciones con evidencia obligatoria; una verificación mecánica de
|
|
6
|
+
salida confirma que cada claim existe de verdad en el código antes de aceptarlo.
|
|
7
|
+
|
|
8
|
+
> v2 funcionaba al revés (detector estático de candidatos → IA solo curaba) y
|
|
9
|
+
> fallaba a cero cuando el detector no entendía el patrón de estado de la app
|
|
10
|
+
> (p. ej. React Context). En v3 la mecánica ya no es portero de entrada: solo
|
|
11
|
+
> revisor de salida.
|
|
12
|
+
|
|
13
|
+
## Instalación y uso (como lo hace un desarrollador)
|
|
14
|
+
|
|
15
|
+
El CLI se publica en npm como **`@fiodos/cli`** (binario `fiodos`). El comando
|
|
16
|
+
que el dashboard muestra para integrar el orbe en una web:
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
cd /ruta/a/tu/web
|
|
20
|
+
npx @fiodos/cli analyze . --publish --api-key fyd_xxx
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Eso analiza el código, publica el manifest en tu proyecto Fiodos y te ofrece
|
|
24
|
+
cablear el orbe `<FiodosAgent/>` en tu app.
|
|
25
|
+
|
|
26
|
+
Opciones de análisis:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
# Análisis alojado (POR DEFECTO): la IA corre en el backend de Fiodos con
|
|
30
|
+
# NUESTRA clave; no necesitas clave de IA propia. Tu código pasa por el backend
|
|
31
|
+
# de Fiodos de camino a la IA (ver Privacidad).
|
|
32
|
+
npx @fiodos/cli analyze . --publish --api-key fyd_xxx
|
|
33
|
+
|
|
34
|
+
# Clave propia (PRIVADO): la IA corre en tu máquina con TU clave; el código va
|
|
35
|
+
# directo a la IA y NUNCA pasa por Fiodos. Requiere ANTHROPIC_API_KEY (o
|
|
36
|
+
# OPENAI_API_KEY si usas --model gpt-…).
|
|
37
|
+
npx @fiodos/cli analyze . --publish --api-key fyd_xxx --own-ai-key
|
|
38
|
+
|
|
39
|
+
# Solo estático (sin IA): rutas, sin acciones; no se envía código a ningún sitio.
|
|
40
|
+
npx @fiodos/cli analyze . --publish --api-key fyd_xxx --no-llm
|
|
41
|
+
|
|
42
|
+
# Backend local (desarrollo):
|
|
43
|
+
npx @fiodos/cli analyze . --publish --api-key fyd_xxx --api-url http://localhost:8000
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
> Alternativa SIN IA — instalación manual: el flujo base de cualquier SDK
|
|
47
|
+
> siempre funciona y no requiere IA ni clave de proveedor:
|
|
48
|
+
> `npm install @fiodos/react @fiodos/core` y montar `<FiodosAgent/>` (el
|
|
49
|
+
> dashboard da los pasos). El `analyze` con IA es el extra que detecta y cablea
|
|
50
|
+
> las acciones automáticamente, no el único camino.
|
|
51
|
+
|
|
52
|
+
## Privacidad — léelo antes de vender esto
|
|
53
|
+
|
|
54
|
+
Sé transparente con dónde va el código en CADA modo:
|
|
55
|
+
|
|
56
|
+
1. **Publicación (`--publish`): el código NUNCA viaja.** Solo el `manifest.json`
|
|
57
|
+
resultante + metadatos pequeños (motor, modelo, contadores). El endpoint de
|
|
58
|
+
publicación solo acepta JSON con esquema de `AppManifest`.
|
|
59
|
+
2. **Análisis con IA — depende del modo:**
|
|
60
|
+
- **Alojado (por defecto):** el código fuente **SÍ pasa por el backend de
|
|
61
|
+
Fiodos**, que lo reenvía al proveedor de IA con **nuestra** clave. Se
|
|
62
|
+
mantiene en memoria solo durante la llamada; **no se guarda ni se loguea**.
|
|
63
|
+
Cómodo (sin clave propia) pero el código toca nuestros servidores.
|
|
64
|
+
- **`--own-ai-key` (privado):** el código va **directo de tu máquina al
|
|
65
|
+
proveedor de IA** con **tu** clave; **no toca el backend de Fiodos**. Para
|
|
66
|
+
clientes sensibles (banca, salud) que no quieren que el código pase por
|
|
67
|
+
nosotros.
|
|
68
|
+
- **`--no-llm`:** no se envía código a ningún sitio (solo rutas estáticas).
|
|
69
|
+
|
|
70
|
+
En modo alojado, el coste del análisis lo asume Fiodos (parte de la
|
|
71
|
+
suscripción) y está limitado por la cuota del plan (server-side). En
|
|
72
|
+
`--own-ai-key`, el coste es del desarrollador (su key, su proveedor).
|
|
73
|
+
`files-sent.json` deja auditado exactamente qué archivos entraron en el prompt.
|
|
74
|
+
|
|
75
|
+
## Arquitectura (v3)
|
|
76
|
+
|
|
77
|
+
| Paso | Módulo | Qué hace | Rol |
|
|
78
|
+
| --- | --- | --- | --- |
|
|
79
|
+
| 1 | `src/routes.js` | Escaneo estático del árbol expo-router (grupos `(x)`, `index`, `[param]`) | Hechos baratos + ground truth del verificador |
|
|
80
|
+
| 2 | `src/collect.js` | Selección de archivos **por reglas** (extensión/ruta, nunca análisis): excluye deps/nativo/tests/configs; si la app excede el presupuesto (`--max-input-tokens`, 150K por defecto) prioriza pantallas→estado→servicios→UI y reporta lo omitido | No puede "fallar a cero" |
|
|
81
|
+
| 3 | `src/aiAnalyze.js` | **UNA llamada**: el modelo lee el código completo y propone manifest + evidencia por ítem (`{file, symbol}`) + `uncertain` | La IA lidera |
|
|
82
|
+
| 4 | `src/verify.js` | Revisor de salida: el archivo de evidencia debe existir entre los enviados, el handler/símbolo debe aparecer como identificador real en ese archivo, la ruta debe existir en el escaneo del paso 1. Lo no probado se **elimina** y queda en `provenance.json` | Anti-alucinación |
|
|
83
|
+
| 5 | core | `validateManifest` real de `@fiodos/core` | Gate final |
|
|
84
|
+
|
|
85
|
+
## Salvaguardas anti-alucinación
|
|
86
|
+
|
|
87
|
+
- El prompt exige evidencia (`file` + `symbol`) por cada acción y prohíbe
|
|
88
|
+
explícitamente "acciones que apps así suelen tener".
|
|
89
|
+
- El verificador mecánico descarta cualquier acción cuyo archivo o símbolo no
|
|
90
|
+
exista de verdad, y cualquier ruta fuera del escaneo del filesystem.
|
|
91
|
+
- Una acción descartada queda registrada con su motivo en `provenance.json` —
|
|
92
|
+
nunca se publica.
|
|
93
|
+
- Intents duplicados ruta/acción se resuelven determinísticamente; tipos de
|
|
94
|
+
parámetros se normalizan a `string|number|boolean`.
|
|
95
|
+
- Resultado medido en QuickBite: 8/8 acciones reales detectadas, 8/8 con
|
|
96
|
+
evidencia verificada, 0 alucinadas (v2 detectaba 0).
|
|
97
|
+
|
|
98
|
+
## Coste real medido (junio 2026, gpt-5)
|
|
99
|
+
|
|
100
|
+
| App | Archivos | Tokens entrada | Coste |
|
|
101
|
+
| --- | --- | --- | --- |
|
|
102
|
+
| QuickBite | 36 | ~23K | **$0.09** |
|
|
103
|
+
| aarnote | 24 | ~19K | $0.09 |
|
|
104
|
+
| finance-mobile | 65 | ~23K | $0.08 |
|
|
105
|
+
| styk | 98 | ~50K | $0.15 |
|
|
106
|
+
|
|
107
|
+
Céntimos por análisis, una vez, pagados por el desarrollador con su key.
|
|
108
|
+
|
|
109
|
+
## Salida
|
|
110
|
+
|
|
111
|
+
| Archivo | Contenido |
|
|
112
|
+
| --- | --- |
|
|
113
|
+
| `manifest.json` | `AppManifest` (esquema `@fiodos/core`), verificado y validado |
|
|
114
|
+
| `provenance.json` | Por cada ruta/acción: verificación superada o motivo de descarte |
|
|
115
|
+
| `evidence.json` | Evidencia declarada por el modelo + sus dudas (`uncertain`) |
|
|
116
|
+
| `usage.json` | Tokens reales de la API + coste en USD del análisis |
|
|
117
|
+
| `files-sent.json` | Exactamente qué archivos entraron en el prompt (y cuáles se omitieron) |
|
|
118
|
+
|
|
119
|
+
## Limitaciones conocidas
|
|
120
|
+
|
|
121
|
+
- Solo expo-router (no react-navigation puro).
|
|
122
|
+
- Apps muy grandes: lo que exceda el presupuesto de entrada se omite por
|
|
123
|
+
prioridad y el modelo lo declara en `uncertain` (sube el presupuesto con
|
|
124
|
+
`--max-input-tokens` si lo necesitas).
|
|
125
|
+
- La salida del modelo es no determinista: dos ejecuciones pueden diferir en
|
|
126
|
+
decisiones marginales (labels, examples).
|
|
127
|
+
- Resultado = **borrador para revisión humana en el dashboard**, no manifest de
|
|
128
|
+
producción.
|
package/package.json
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@fiodos/cli",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Fiodos CLI — analyzes your app's source code and generates the in-app voice-agent manifest, then wires the orb. Powers `npx @fiodos/cli analyze`.",
|
|
5
|
+
"type": "commonjs",
|
|
6
|
+
"bin": {
|
|
7
|
+
"fiodos": "src/index.js"
|
|
8
|
+
},
|
|
9
|
+
"main": "src/index.js",
|
|
10
|
+
"files": [
|
|
11
|
+
"src",
|
|
12
|
+
"LICENSE",
|
|
13
|
+
"README.md"
|
|
14
|
+
],
|
|
15
|
+
"scripts": {
|
|
16
|
+
"analyze": "node src/index.js"
|
|
17
|
+
},
|
|
18
|
+
"engines": {
|
|
19
|
+
"node": ">=18"
|
|
20
|
+
},
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"@fiodos/core": "^0.1.0",
|
|
23
|
+
"esbuild": "^0.28.1",
|
|
24
|
+
"jsdom": "^24.0.0"
|
|
25
|
+
},
|
|
26
|
+
"license": "SEE LICENSE IN LICENSE",
|
|
27
|
+
"publishConfig": {
|
|
28
|
+
"access": "public"
|
|
29
|
+
}
|
|
30
|
+
}
|