agy-insights 0.3.0 → 0.4.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.es.md +169 -0
- package/README.md +91 -76
- package/agy-insights.example.json +2 -2
- package/agy-insights.js +16 -25
- package/docs/how-it-works.md +98 -0
- package/lib/findings.js +45 -61
- package/lib/fixes.js +10 -9
- package/lib/history.js +6 -6
- package/lib/i18n.js +293 -0
- package/lib/map.js +8 -7
- package/lib/report.js +47 -45
- package/package.json +8 -4
- package/docs/como-funciona.md +0 -88
package/README.es.md
ADDED
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
# agy-insights
|
|
2
|
+
|
|
3
|
+
[English](README.md) · **Español**
|
|
4
|
+
|
|
5
|
+
Te muestra qué contexto le estás mandando a **Antigravity** de forma repetida o innecesaria, a partir del historial que Antigravity CLI guarda en tu equipo. Tú decides qué hacer con ello.
|
|
6
|
+
|
|
7
|
+
- Se ejecuta solo en tu máquina y no envía nada a ningún sitio.
|
|
8
|
+
- No cambia nada: te dice qué pegar y dónde, y lo haces tú si quieres.
|
|
9
|
+
- Solo propone mecanismos oficiales de Antigravity.
|
|
10
|
+
- Funciona con cualquier editor, en Windows, macOS y Linux.
|
|
11
|
+
|
|
12
|
+
```sh
|
|
13
|
+
npx agy-insights # informe HTML en el navegador
|
|
14
|
+
npx agy-insights --text # resumen en la terminal
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Solo necesitas Node.js 20 o superior y haber usado Antigravity CLI (`agy`) en el equipo. La salida sale en español o en inglés según el idioma del sistema; puedes forzarlo con `--lang es` o `--lang en`.
|
|
18
|
+
|
|
19
|
+
## Por qué
|
|
20
|
+
|
|
21
|
+
Cada fichero que lee el agente y cada salida de comando entra en el contexto y se reenvía en los turnos siguientes de la conversación. La cuota es una bolsa común, así que cada lectura innecesaria la gasta para todos. Esta herramienta te enseña dónde se va ese contexto: relecturas, carpetas de compilación, salidas de tests enormes y sesiones demasiado largas.
|
|
22
|
+
|
|
23
|
+
## Requisitos
|
|
24
|
+
|
|
25
|
+
- **Node.js 20 o superior** (`node --version`).
|
|
26
|
+
- Haber usado **Antigravity CLI** (`agy`) en este equipo. El historial está en `~/.gemini/antigravity-cli/conversations` (en Windows, `%USERPROFILE%\.gemini\antigravity-cli\conversations`).
|
|
27
|
+
|
|
28
|
+
## Instalar
|
|
29
|
+
|
|
30
|
+
No tiene dependencias. Elige una forma:
|
|
31
|
+
|
|
32
|
+
**Con `npx`, sin instalar nada:**
|
|
33
|
+
|
|
34
|
+
```sh
|
|
35
|
+
npx agy-insights
|
|
36
|
+
npx agy-insights --text
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Para fijar una versión: `npx agy-insights@0.4.0`.
|
|
40
|
+
|
|
41
|
+
**Instalándolo globalmente:**
|
|
42
|
+
|
|
43
|
+
```sh
|
|
44
|
+
npm install -g agy-insights
|
|
45
|
+
agy-insights
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
**Clonando el repositorio:**
|
|
49
|
+
|
|
50
|
+
```sh
|
|
51
|
+
git clone https://github.com/migohe14/agy-insights.git
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Y ejecútalo con `node agy-insights/agy-insights.js` en lugar de `npx agy-insights`. Para actualizar: `git pull` dentro de la carpeta.
|
|
55
|
+
|
|
56
|
+
## Usar
|
|
57
|
+
|
|
58
|
+
```sh
|
|
59
|
+
npx agy-insights
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Analiza todo tu historial, guarda un informe HTML en la carpeta temporal y lo abre en el navegador.
|
|
63
|
+
|
|
64
|
+
| Para… | Ejecuta |
|
|
65
|
+
|---|---|
|
|
66
|
+
| Ver solo un proyecto | `npx agy-insights --project C:\dev\mi-proyecto` |
|
|
67
|
+
| Ver el proyecto de la carpeta actual | `npx agy-insights --project .` |
|
|
68
|
+
| Un resumen en la terminal | `npx agy-insights --text` |
|
|
69
|
+
| El resumen con rutas y exclusiones | `npx agy-insights --text --paths` |
|
|
70
|
+
| Un mapa del proyecto para pegar en `AGENTS.md` (carpetas, ficheros grandes, carpetas generadas; ~20 líneas aunque el repo sea grande) | `npx agy-insights --map --project <carpeta>` |
|
|
71
|
+
| Elegir el idioma (español o inglés) | `npx agy-insights --lang es` |
|
|
72
|
+
| Guardar el informe en otro sitio | `npx agy-insights --out informe.html --no-open` |
|
|
73
|
+
| Ver todas las opciones | `npx agy-insights --help` |
|
|
74
|
+
|
|
75
|
+
El informe da dos cifras:
|
|
76
|
+
|
|
77
|
+
- **Consumo real**: los tokens que Antigravity anota en el registro de cada conversación (`~/.gemini/antigravity-cli/brain/<id>/.system_generated/logs/transcript.jsonl`), subagentes incluidos. Se muestra sin caché y con caché, porque no sabemos si la cuota cuenta igual la caché. Es la cifra que sirve para comparar entre compañeros.
|
|
78
|
+
- **«~tokens»**: estimados a partir del tamaño guardado de cada paso. Sirven para comparar qué ficheros, carpetas o comandos pesan más, pero se quedan cortos frente al consumo real, porque cada llamada al modelo vuelve a enviar el contexto acumulado.
|
|
79
|
+
|
|
80
|
+
## Leer el informe
|
|
81
|
+
|
|
82
|
+
Arriba están los totales. Debajo, **Qué está pasando** reúne los hallazgos; al final, el detalle por proyecto, tipo de fichero, carpeta, fichero, herramienta y comando. El proyecto de cada fichero se detecta por su carpeta `.git`.
|
|
83
|
+
|
|
84
|
+
| Hallazgo | Qué significa | Qué hacer |
|
|
85
|
+
|---|---|---|
|
|
86
|
+
| El agente vuelve a leer lo que ya tenía | Lee otra vez un trozo de fichero que ya estaba en la conversación | Sesiones más cortas, una por tarea, o `/compact`. No excluyas el fichero: lo necesita. |
|
|
87
|
+
| Ficheros generados, compilados o de dependencias | Lecturas de `bin/`, `obj/`, `dist/`, `node_modules`, migraciones, lockfiles o logs | Si no hacían falta, exclúyelos (ver abajo) |
|
|
88
|
+
| Los mismos ficheros entran en muchas sesiones | Un fichero se lee en varias conversaciones distintas | Si es código central es normal; si es grande, dile al agente qué parte mirar |
|
|
89
|
+
| Comandos con salidas muy largas | La salida de tests o builds entra entera | Pide ejecutar solo el test o proyecto afectado |
|
|
90
|
+
| Sesiones muy largas | Todo lo acumulado se reenvía en cada turno | Una conversación nueva por tarea |
|
|
91
|
+
|
|
92
|
+
## Excluir algo
|
|
93
|
+
|
|
94
|
+
Despliega **Cómo excluirlo** en una propuesta. Verás el fichero exacto, dónde va el texto y un botón **Copiar**. Hay tres opciones, de más a menos fuerte:
|
|
95
|
+
|
|
96
|
+
### 1. Denegar la lectura (permiso de Antigravity)
|
|
97
|
+
|
|
98
|
+
Es lo único que impide de verdad que el agente lea una ruta. Usa los [permisos oficiales](https://antigravity.google/docs/permissions).
|
|
99
|
+
|
|
100
|
+
1. Abre `~/.gemini/antigravity-cli/settings.json` (en Windows, `%USERPROFILE%\.gemini\antigravity-cli\settings.json`).
|
|
101
|
+
2. Pega la regla dentro de `"permissions"` → `"deny"`. Si no existen, créalas; si existen, añade la regla sin borrar nada:
|
|
102
|
+
|
|
103
|
+
```json
|
|
104
|
+
{
|
|
105
|
+
"model": "Gemini 3.8 Flash (Medium)",
|
|
106
|
+
"permissions": {
|
|
107
|
+
"deny": [
|
|
108
|
+
"read_file(C:\\dev\\mi-proyecto\\src\\Infra\\obj)"
|
|
109
|
+
]
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
3. Guarda y reinicia `agy`.
|
|
115
|
+
|
|
116
|
+
Denegar la lectura de una ruta también impide escribir en ella, y la regla vale para todos tus proyectos. Úsala para carpetas que el agente no deba tocar nunca, como salidas de compilación.
|
|
117
|
+
|
|
118
|
+
### 2. `.antigravityignore`
|
|
119
|
+
|
|
120
|
+
Es el fichero de exclusión de Antigravity, en la raíz del proyecto. Su efecto no está documentado: está confirmado que oculta los ficheros del autocompletado con `@`, pero no que impida al agente leerlos.
|
|
121
|
+
|
|
122
|
+
### 3. Regla en `AGENTS.md`
|
|
123
|
+
|
|
124
|
+
Una línea en el `AGENTS.md` del proyecto, pidiendo al modelo que no lea algo o que limite una salida. Es una indicación, no un bloqueo. Las reglas se envían en cada petición y también gastan tokens, así que mantenlas cortas. `AGENTS.md` suele estar en el repositorio del equipo: revisa el cambio antes de subirlo.
|
|
125
|
+
|
|
126
|
+
## Configurar
|
|
127
|
+
|
|
128
|
+
Copia `agy-insights.example.json` a `~/.agy-insights.json` (o pásalo con `--config`) y ajústalo. Es tu configuración personal:
|
|
129
|
+
|
|
130
|
+
| Clave | Para qué sirve | Por defecto |
|
|
131
|
+
|---|---|---|
|
|
132
|
+
| `lang` | Idioma de la salida: `es` o `en` (`--lang` tiene prioridad) | el del sistema |
|
|
133
|
+
| `conversationsDir` | Otra carpeta de historial | la de Antigravity CLI |
|
|
134
|
+
| `customKinds` | Tipos de fichero propios: `{ "regex": "etiqueta" }` | ninguno |
|
|
135
|
+
| `crossSessionMin` | A partir de cuántas conversaciones avisa de un fichero repetido | 3 |
|
|
136
|
+
| `heavyOutputTokens` | A partir de qué tamaño medio avisa de un comando | 2000 |
|
|
137
|
+
| `longSessionTokens` | A partir de qué tamaño avisa de una sesión larga | 100000 |
|
|
138
|
+
|
|
139
|
+
## Privacidad
|
|
140
|
+
|
|
141
|
+
- Todo se calcula en tu equipo; no se envía nada.
|
|
142
|
+
- El historial se lee desde una copia temporal y nunca se modifica.
|
|
143
|
+
- No escribe en `~/.gemini`, no instala hooks ni plugins y no toca tu `.gitignore` ni tus proyectos.
|
|
144
|
+
- Lo único que escribe es el informe HTML, en la carpeta temporal o donde digas con `--out`.
|
|
145
|
+
- El informe contiene rutas de tus proyectos. No lo compartas sin revisarlo.
|
|
146
|
+
- **No compartas los ficheros `.db` del historial**: contienen el código que leyó el agente.
|
|
147
|
+
|
|
148
|
+
## Deshacer
|
|
149
|
+
|
|
150
|
+
- **Permiso**: borra la línea `read_file(…)` de `"deny"` en `settings.json` y reinicia `agy`.
|
|
151
|
+
- **.antigravityignore y AGENTS.md**: borra las líneas que añadiste.
|
|
152
|
+
|
|
153
|
+
## Problemas frecuentes
|
|
154
|
+
|
|
155
|
+
**«No hay conversaciones»**. Si usaste `--project`, puede que trabajaras con Antigravity desde otra carpeta: prueba sin `--project`. Si tampoco aparecen, comprueba que existe la carpeta del historial.
|
|
156
|
+
|
|
157
|
+
**«No se reconoce el formato del historial»**. Probablemente una versión nueva de Antigravity ha cambiado cómo guarda las conversaciones. Ejecuta `npx agy-insights@latest`; si sigue igual, [abre una incidencia](https://github.com/migohe14/agy-insights/issues).
|
|
158
|
+
|
|
159
|
+
**Uso la app o el IDE de Antigravity, no el CLI**. Por ahora solo se lee el historial del CLI.
|
|
160
|
+
|
|
161
|
+
**El navegador no se abre**. La ruta del informe aparece en la terminal; ábrela a mano.
|
|
162
|
+
|
|
163
|
+
## Estado
|
|
164
|
+
|
|
165
|
+
Versión piloto. El formato del historial de Antigravity no está documentado, así que algunos datos pueden fallar con versiones nuevas. Si ves algo raro, [abre una incidencia](https://github.com/migohe14/agy-insights/issues). Para contribuir, mira [docs/how-it-works.md](docs/how-it-works.md) (en inglés).
|
|
166
|
+
|
|
167
|
+
## Licencia
|
|
168
|
+
|
|
169
|
+
[MIT](LICENSE)
|
package/README.md
CHANGED
|
@@ -1,154 +1,169 @@
|
|
|
1
1
|
# agy-insights
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**English** · [Español](README.es.md)
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
- No cambia nada: te dice qué pegar y dónde, y lo haces tú si quieres.
|
|
7
|
-
- Solo propone mecanismos oficiales de Antigravity.
|
|
8
|
-
- Funciona con cualquier editor, en Windows, macOS y Linux.
|
|
5
|
+
Shows which context you are sending to **Antigravity** repeatedly or needlessly, based on the history Antigravity CLI keeps on your machine. You decide what to do about it.
|
|
9
6
|
|
|
10
|
-
|
|
7
|
+
- Runs only on your machine and sends nothing anywhere.
|
|
8
|
+
- Changes nothing: it tells you what to paste and where, and you do it if you want.
|
|
9
|
+
- Only proposes official Antigravity mechanisms.
|
|
10
|
+
- Works with any editor, on Windows, macOS and Linux.
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
```sh
|
|
13
|
+
npx agy-insights # HTML report in the browser
|
|
14
|
+
npx agy-insights --text # summary in the terminal
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
All you need is Node.js 20 or later and to have used Antigravity CLI (`agy`) on this machine. The output is in English or Spanish, following your system language; force it with `--lang en` or `--lang es`.
|
|
18
|
+
|
|
19
|
+
## Why
|
|
13
20
|
|
|
14
|
-
|
|
21
|
+
Every file the agent reads and every command output enters the context and is resent on the following turns of the conversation. Quota is a shared pool, so every unnecessary read spends it for everyone. This tool shows you where that context goes: re-reads, build folders, huge test outputs and sessions that run too long.
|
|
15
22
|
|
|
16
|
-
|
|
17
|
-
- Haber usado **Antigravity CLI** (`agy`) en este equipo. El historial está en `~/.gemini/antigravity-cli/conversations` (en Windows, `%USERPROFILE%\.gemini\antigravity-cli\conversations`).
|
|
23
|
+
## Requirements
|
|
18
24
|
|
|
19
|
-
|
|
25
|
+
- **Node.js 20 or later** (`node --version`).
|
|
26
|
+
- Having used **Antigravity CLI** (`agy`) on this machine. The history lives in `~/.gemini/antigravity-cli/conversations` (on Windows, `%USERPROFILE%\.gemini\antigravity-cli\conversations`).
|
|
20
27
|
|
|
21
|
-
|
|
28
|
+
## Install
|
|
22
29
|
|
|
23
|
-
|
|
30
|
+
It has no dependencies. Pick one:
|
|
31
|
+
|
|
32
|
+
**With `npx`, nothing to install:**
|
|
24
33
|
|
|
25
34
|
```sh
|
|
26
35
|
npx agy-insights
|
|
27
36
|
npx agy-insights --text
|
|
28
37
|
```
|
|
29
38
|
|
|
30
|
-
|
|
39
|
+
To pin a version: `npx agy-insights@0.4.0`.
|
|
31
40
|
|
|
32
|
-
**
|
|
41
|
+
**Globally:**
|
|
33
42
|
|
|
34
43
|
```sh
|
|
35
44
|
npm install -g agy-insights
|
|
36
45
|
agy-insights
|
|
37
46
|
```
|
|
38
47
|
|
|
39
|
-
**
|
|
48
|
+
**From the repository:**
|
|
40
49
|
|
|
41
50
|
```sh
|
|
42
51
|
git clone https://github.com/migohe14/agy-insights.git
|
|
43
52
|
```
|
|
44
53
|
|
|
45
|
-
|
|
54
|
+
Then run it with `node agy-insights/agy-insights.js` instead of `npx agy-insights`. To update: `git pull` inside the folder.
|
|
46
55
|
|
|
47
|
-
##
|
|
56
|
+
## Usage
|
|
48
57
|
|
|
49
58
|
```sh
|
|
50
|
-
|
|
59
|
+
npx agy-insights
|
|
51
60
|
```
|
|
52
61
|
|
|
53
|
-
|
|
62
|
+
Analyzes your whole history, saves an HTML report in the temp folder and opens it in the browser.
|
|
54
63
|
|
|
55
|
-
|
|
|
64
|
+
| To… | Run |
|
|
56
65
|
|---|---|
|
|
57
|
-
|
|
|
58
|
-
|
|
|
59
|
-
|
|
|
60
|
-
|
|
|
61
|
-
|
|
|
62
|
-
|
|
|
63
|
-
|
|
|
66
|
+
| See only one project | `npx agy-insights --project C:\dev\my-project` |
|
|
67
|
+
| See the project in the current folder | `npx agy-insights --project .` |
|
|
68
|
+
| Get a summary in the terminal | `npx agy-insights --text` |
|
|
69
|
+
| Get the summary with paths and exclusions | `npx agy-insights --text --paths` |
|
|
70
|
+
| Get a project map to paste into `AGENTS.md` (folders, large files, generated folders; ~20 lines even for a large repo) | `npx agy-insights --map --project <folder>` |
|
|
71
|
+
| Choose the language (English or Spanish) | `npx agy-insights --lang es` |
|
|
72
|
+
| Save the report somewhere else | `npx agy-insights --out report.html --no-open` |
|
|
73
|
+
| See all options | `npx agy-insights --help` |
|
|
64
74
|
|
|
65
|
-
|
|
75
|
+
The report gives two figures:
|
|
66
76
|
|
|
67
|
-
- **
|
|
68
|
-
-
|
|
77
|
+
- **Real usage**: the tokens Antigravity records in each conversation's log (`~/.gemini/antigravity-cli/brain/<id>/.system_generated/logs/transcript.jsonl`), subagents included. It is shown with and without cache, because it is unknown whether the quota counts cache the same way. This is the figure to compare between teammates.
|
|
78
|
+
- **"~tokens"**: estimated from the stored size of each step. Useful to compare which files, folders or commands weigh the most, but they fall short of real usage, because every model call resends the accumulated context.
|
|
69
79
|
|
|
70
|
-
##
|
|
80
|
+
## Reading the report
|
|
71
81
|
|
|
72
|
-
|
|
82
|
+
The totals are at the top. Below, **What's happening** lists the findings; at the end, the details by project, file type, folder, file, tool and command. The project of each file is detected through its `.git` folder.
|
|
73
83
|
|
|
74
|
-
|
|
|
84
|
+
| Finding | What it means | What to do |
|
|
75
85
|
|---|---|---|
|
|
76
|
-
|
|
|
77
|
-
|
|
|
78
|
-
|
|
|
79
|
-
|
|
|
80
|
-
|
|
|
86
|
+
| The agent re-reads what it already had | It reads again a chunk of a file that was already in the conversation | Shorter sessions, one per task, or `/compact`. Don't exclude the file: the agent needs it. |
|
|
87
|
+
| Generated, build or dependency files are being read | Reads from `bin/`, `obj/`, `dist/`, `node_modules`, migrations, lockfiles or logs | If they weren't needed, exclude them (see below) |
|
|
88
|
+
| The same files enter many sessions | A file is read in several different conversations | Normal for core code; if it is large, tell the agent which part to look at |
|
|
89
|
+
| Commands with very long output | The full output of tests or builds enters the context | Ask it to run only the affected test or project |
|
|
90
|
+
| Very long sessions | Everything accumulated is resent on every turn | A new conversation per task |
|
|
81
91
|
|
|
82
|
-
##
|
|
92
|
+
## Excluding something
|
|
83
93
|
|
|
84
|
-
|
|
94
|
+
Expand **How to exclude it** on a proposal. You'll see the exact file, where the text goes and a **Copy** button. There are three options, from strongest to weakest:
|
|
85
95
|
|
|
86
|
-
### 1.
|
|
96
|
+
### 1. Deny reading it (Antigravity permission)
|
|
87
97
|
|
|
88
|
-
|
|
98
|
+
This is the only thing that actually stops the agent from reading a path. It uses the [official permissions](https://antigravity.google/docs/permissions).
|
|
89
99
|
|
|
90
|
-
1.
|
|
91
|
-
2.
|
|
100
|
+
1. Open `~/.gemini/antigravity-cli/settings.json` (on Windows, `%USERPROFILE%\.gemini\antigravity-cli\settings.json`).
|
|
101
|
+
2. Paste the rule inside `"permissions"` → `"deny"`. Create them if they don't exist; if they do, add the rule without removing anything:
|
|
92
102
|
|
|
93
103
|
```json
|
|
94
104
|
{
|
|
95
105
|
"model": "Gemini 3.8 Flash (Medium)",
|
|
96
106
|
"permissions": {
|
|
97
107
|
"deny": [
|
|
98
|
-
"read_file(C:\\dev\\
|
|
108
|
+
"read_file(C:\\dev\\my-project\\src\\Infra\\obj)"
|
|
99
109
|
]
|
|
100
110
|
}
|
|
101
111
|
}
|
|
102
112
|
```
|
|
103
113
|
|
|
104
|
-
3.
|
|
114
|
+
3. Save and restart `agy`.
|
|
105
115
|
|
|
106
|
-
|
|
116
|
+
Denying reads on a path also blocks writing to it, and the rule applies to all your projects. Use it for folders the agent should never touch, such as build output.
|
|
107
117
|
|
|
108
118
|
### 2. `.antigravityignore`
|
|
109
119
|
|
|
110
|
-
|
|
120
|
+
Antigravity's exclusion file, at the project root. Its effect is undocumented: it is confirmed to hide files from `@` completion, but not to stop the agent from reading them.
|
|
111
121
|
|
|
112
|
-
### 3.
|
|
122
|
+
### 3. A rule in `AGENTS.md`
|
|
113
123
|
|
|
114
|
-
|
|
124
|
+
A line in the project's `AGENTS.md` asking the model not to read something or to limit an output. It is an instruction, not a block. Rules are sent with every request and cost tokens too, so keep them short. `AGENTS.md` usually lives in the team repository: review the change before pushing it.
|
|
115
125
|
|
|
116
|
-
##
|
|
126
|
+
## Configuration
|
|
117
127
|
|
|
118
|
-
|
|
128
|
+
Copy `agy-insights.example.json` to `~/.agy-insights.json` (or pass it with `--config`) and adjust it. It is your personal configuration:
|
|
119
129
|
|
|
120
|
-
|
|
|
130
|
+
| Key | What it does | Default |
|
|
121
131
|
|---|---|---|
|
|
122
|
-
| `
|
|
123
|
-
| `
|
|
124
|
-
| `
|
|
125
|
-
| `
|
|
126
|
-
| `
|
|
132
|
+
| `lang` | Output language: `en` or `es` (`--lang` takes precedence) | the system's |
|
|
133
|
+
| `conversationsDir` | Another history folder | Antigravity CLI's |
|
|
134
|
+
| `customKinds` | Your own file types: `{ "regex": "label" }` | none |
|
|
135
|
+
| `crossSessionMin` | From how many conversations a repeated file is reported | 3 |
|
|
136
|
+
| `heavyOutputTokens` | From what average size a command is reported | 2000 |
|
|
137
|
+
| `longSessionTokens` | From what size a session is reported as long | 100000 |
|
|
138
|
+
|
|
139
|
+
## Privacy
|
|
140
|
+
|
|
141
|
+
- Everything is computed on your machine; nothing is sent.
|
|
142
|
+
- The history is read from a temporary copy and never modified.
|
|
143
|
+
- It does not write to `~/.gemini`, installs no hooks or plugins, and does not touch your `.gitignore` or your projects.
|
|
144
|
+
- The only thing it writes is the HTML report, in the temp folder or wherever `--out` says.
|
|
145
|
+
- The report contains paths from your projects. Review it before sharing.
|
|
146
|
+
- **Don't share the history `.db` files**: they contain the code the agent read.
|
|
127
147
|
|
|
128
|
-
##
|
|
148
|
+
## Undo
|
|
129
149
|
|
|
130
|
-
-
|
|
131
|
-
-
|
|
132
|
-
- No escribe en `~/.gemini`, no instala hooks ni plugins y no toca tu `.gitignore` ni tus proyectos.
|
|
133
|
-
- Lo único que escribe es el informe HTML, en la carpeta temporal o donde digas con `--out`.
|
|
134
|
-
- El informe contiene rutas de tus proyectos. No lo compartas sin revisarlo.
|
|
135
|
-
- **No compartas los ficheros `.db` del historial**: contienen el código que leyó el agente, a menudo de cliente.
|
|
150
|
+
- **Permission**: remove the `read_file(…)` line from `"deny"` in `settings.json` and restart `agy`.
|
|
151
|
+
- **.antigravityignore and AGENTS.md**: remove the lines you added.
|
|
136
152
|
|
|
137
|
-
##
|
|
153
|
+
## Troubleshooting
|
|
138
154
|
|
|
139
|
-
|
|
140
|
-
- **.antigravityignore y AGENTS.md**: borra las líneas que añadiste.
|
|
155
|
+
**"No conversations"**. If you used `--project`, you may have worked with Antigravity from another folder: try without `--project`. If they still don't show up, check that the history folder exists.
|
|
141
156
|
|
|
142
|
-
|
|
157
|
+
**"The history format is not recognized"**. A new Antigravity version has probably changed how it stores conversations. Run `npx agy-insights@latest`; if it persists, [open an issue](https://github.com/migohe14/agy-insights/issues).
|
|
143
158
|
|
|
144
|
-
|
|
159
|
+
**I use the Antigravity app or IDE, not the CLI**. For now only the CLI history is read.
|
|
145
160
|
|
|
146
|
-
|
|
161
|
+
**The browser doesn't open**. The report path is printed in the terminal; open it manually.
|
|
147
162
|
|
|
148
|
-
|
|
163
|
+
## Status
|
|
149
164
|
|
|
150
|
-
|
|
165
|
+
Pilot version. Antigravity's history format is undocumented, so some data may break with new versions. If you see something odd, [open an issue](https://github.com/migohe14/agy-insights/issues). To contribute, see [docs/how-it-works.md](docs/how-it-works.md).
|
|
151
166
|
|
|
152
|
-
##
|
|
167
|
+
## License
|
|
153
168
|
|
|
154
|
-
|
|
169
|
+
[MIT](LICENSE)
|
package/agy-insights.js
CHANGED
|
@@ -10,29 +10,14 @@ const { analyze, DEFAULT_DIR } = require('./lib/history');
|
|
|
10
10
|
const { findings, DEFAULTS } = require('./lib/findings');
|
|
11
11
|
const report = require('./lib/report');
|
|
12
12
|
const { buildMap } = require('./lib/map');
|
|
13
|
-
|
|
14
|
-
const HELP = `Uso: agy-insights [opciones] (o npx …, o node agy-insights.js)
|
|
15
|
-
|
|
16
|
-
Analiza tu historial de Antigravity CLI y abre un informe en el navegador.
|
|
17
|
-
|
|
18
|
-
Opciones:
|
|
19
|
-
--project <carpeta> Solo conversaciones que tocaron ese proyecto ("." = carpeta actual)
|
|
20
|
-
--text Resumen en la terminal en vez del informe HTML
|
|
21
|
-
--paths Con --text, muestra rutas y las exclusiones propuestas
|
|
22
|
-
--map Imprime un mapa del proyecto (--project, o la carpeta actual) para AGENTS.md
|
|
23
|
-
--out <fichero> Dónde guardar el informe HTML (por defecto, en la carpeta temporal)
|
|
24
|
-
--no-open No abrir el navegador
|
|
25
|
-
--dir <carpeta> Otra carpeta de historial (por defecto ${DEFAULT_DIR})
|
|
26
|
-
--config <fichero> Configuración (por defecto ~/.agy-insights.json si existe)
|
|
27
|
-
--help Esta ayuda
|
|
28
|
-
`;
|
|
13
|
+
const { t, setLang, detect } = require('./lib/i18n');
|
|
29
14
|
|
|
30
15
|
function parseArgs(argv) {
|
|
31
16
|
const opts = { open: true };
|
|
32
17
|
for (let i = 0; i < argv.length; i++) {
|
|
33
18
|
const a = argv[i];
|
|
34
19
|
const value = () => {
|
|
35
|
-
if (i + 1 >= argv.length) fail(
|
|
20
|
+
if (i + 1 >= argv.length) fail(t.missingValue(a));
|
|
36
21
|
return argv[++i];
|
|
37
22
|
};
|
|
38
23
|
if (a === '--help' || a === '-h') opts.help = true;
|
|
@@ -44,7 +29,8 @@ function parseArgs(argv) {
|
|
|
44
29
|
else if (a === '--no-open') opts.open = false;
|
|
45
30
|
else if (a === '--dir') opts.dir = path.resolve(value());
|
|
46
31
|
else if (a === '--config') opts.config = path.resolve(value());
|
|
47
|
-
else
|
|
32
|
+
else if (a === '--lang') opts.lang = value();
|
|
33
|
+
else fail(t.unknownOption(a));
|
|
48
34
|
}
|
|
49
35
|
return opts;
|
|
50
36
|
}
|
|
@@ -60,13 +46,13 @@ function fail(msg) {
|
|
|
60
46
|
function loadConfig(file) {
|
|
61
47
|
const target = file || path.join(os.homedir(), '.agy-insights.json');
|
|
62
48
|
if (!fs.existsSync(target)) {
|
|
63
|
-
if (file) fail(
|
|
49
|
+
if (file) fail(t.configNotFound(file));
|
|
64
50
|
return {};
|
|
65
51
|
}
|
|
66
52
|
try {
|
|
67
53
|
return JSON.parse(fs.readFileSync(target, 'utf8'));
|
|
68
54
|
} catch (e) {
|
|
69
|
-
return fail(
|
|
55
|
+
return fail(t.cannotRead(target, e.message));
|
|
70
56
|
}
|
|
71
57
|
}
|
|
72
58
|
|
|
@@ -80,9 +66,14 @@ function openInBrowser(file) {
|
|
|
80
66
|
}
|
|
81
67
|
|
|
82
68
|
async function main() {
|
|
83
|
-
const
|
|
84
|
-
|
|
69
|
+
const argv = process.argv.slice(2);
|
|
70
|
+
// Language first, so that option errors are already in it.
|
|
71
|
+
if (!(argv.includes('--lang') && setLang(argv[argv.indexOf('--lang') + 1]))) setLang(detect());
|
|
72
|
+
const opts = parseArgs(argv);
|
|
73
|
+
if (opts.lang && !setLang(opts.lang)) fail(t.badLang(opts.lang));
|
|
74
|
+
if (opts.help) return console.log(t.help(DEFAULT_DIR));
|
|
85
75
|
const cfg = loadConfig(opts.config);
|
|
76
|
+
if (!opts.lang && cfg.lang && !setLang(cfg.lang)) fail(t.badLang(cfg.lang));
|
|
86
77
|
|
|
87
78
|
if (opts.map) opts.project = opts.project || process.cwd();
|
|
88
79
|
const r = await analyze({
|
|
@@ -93,7 +84,7 @@ async function main() {
|
|
|
93
84
|
if (opts.map) {
|
|
94
85
|
const m = buildMap(opts.project, { ...cfg.map, history: r.files });
|
|
95
86
|
console.log(m.block);
|
|
96
|
-
return console.error(
|
|
87
|
+
return console.error(t.mapDone(m.tokens, path.join(opts.project, 'AGENTS.md')));
|
|
97
88
|
}
|
|
98
89
|
const found = findings(r, {
|
|
99
90
|
crossSessionMin: cfg.crossSessionMin ?? DEFAULTS.crossSessionMin,
|
|
@@ -104,10 +95,10 @@ async function main() {
|
|
|
104
95
|
if (opts.text) return process.stdout.write(report.text(r, found, { scope: opts.project, paths: opts.paths }));
|
|
105
96
|
|
|
106
97
|
const stamp = new Date().toISOString().slice(0, 16).replace(/[-:T]/g, '');
|
|
107
|
-
const out = opts.out || path.join(os.tmpdir(), 'agy-insights',
|
|
98
|
+
const out = opts.out || path.join(os.tmpdir(), 'agy-insights', `${t.reportName}-${stamp}.html`);
|
|
108
99
|
fs.mkdirSync(path.dirname(out), { recursive: true });
|
|
109
100
|
fs.writeFileSync(out, report.html(r, found, { scope: opts.project }));
|
|
110
|
-
console.log(
|
|
101
|
+
console.log(t.done(r.conversations, found.length, out));
|
|
111
102
|
if (opts.open) openInBrowser(out);
|
|
112
103
|
}
|
|
113
104
|
|