@nicocroce/flowbrain 0.0.0-stage → 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/CHANGELOG.md +14 -0
- package/LICENSE +202 -0
- package/README.es.md +141 -0
- package/README.md +140 -2
- package/SCHEMA.md +409 -0
- package/dist/flowbrain.mjs +22308 -0
- package/dist/tree-sitter-php.wasm +0 -0
- package/package.json +48 -4
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Cambios
|
|
2
|
+
|
|
3
|
+
## 0.1.0 · 2026-11-24
|
|
4
|
+
|
|
5
|
+
Primera versión publicada, como `@nicocroce/flowbrain` (el comando es `flowbrain`).
|
|
6
|
+
|
|
7
|
+
- `flowbrain install`: configura el proyecto, detecta los repositorios, arma uno o varios cerebros, indexa y deja hooks y comandos de Claude Code.
|
|
8
|
+
- Parsers determinísticos para TypeScript/JavaScript (React, React Native, Vue, Svelte, Astro, Next, Nest, Express), PHP (Laravel, Symfony), OpenAPI, esquemas de base de datos e infraestructura (Docker, CI, Kubernetes, Helm, Terraform, serverless).
|
|
9
|
+
- Extractores del proyecto escritos por el agente y verificados por FlowBrain, para lo que los parsers no entienden.
|
|
10
|
+
- Servidor MCP (`flowbrain serve`) con 16 herramientas, más `conexiones` con varios cerebros.
|
|
11
|
+
- Varios cerebros en un proyecto con `flowbrain.yaml`: las consultas cruzan entre servicios.
|
|
12
|
+
- Visor web en localhost: mapa, funcionalidades, pantallas, contratos, especificaciones, impacto, fidelidad y pedido de tests en lote.
|
|
13
|
+
- Comandos de Claude Code `/flowbrain-study`, `/flowbrain-index`, `/flowbrain-features`, `/flowbrain-specs` y `/flowbrain-tests`.
|
|
14
|
+
- La gramática de PHP viaja como `.wasm` dentro del paquete: la instalación no compila nada nativo.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/README.es.md
ADDED
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
# FlowBrain
|
|
2
|
+
|
|
3
|
+
[English](README.md) · **Español**
|
|
4
|
+
|
|
5
|
+
> **¿Qué entiende la IA sobre tu proyecto?** FlowBrain lo deja a la vista para que lo verifiques y lo corrijas, y así cada respuesta sea más determinística. Empezá por la [guía](https://github.com/NicoCroce/FlowBrain/blob/main/docs/GUIA.md).
|
|
6
|
+
|
|
7
|
+
FlowBrain arma un **grafo de conocimiento de tu sistema** para que un agente de código (Claude Code, Codex, OpenCode u otro) entienda el producto antes de tocarlo: qué funcionalidades tiene, qué pantallas las forman, qué endpoints llaman, qué métodos ejecutan, qué tablas tocan y **qué se rompe si algo cambia**, también entre repositorios y servicios distintos.
|
|
8
|
+
|
|
9
|
+
- **Lee el código, no adivina.** Los parsers leen TypeScript/JavaScript (React, React Native, Vue, Svelte, Astro, Next, Nest, Express…), PHP, OpenAPI, esquemas de base de datos e infraestructura (Docker, CI, Kubernetes, Helm, Terraform, serverless). Lo que un parser no entiende lo completa tu agente: estudia el repo y escribe *extractores* que FlowBrain verifica dato por dato.
|
|
10
|
+
- **Determinístico.** Ninguna consulta llama a un LLM. Cada dato cita su evidencia (`repo:ruta#Ln`), así el agente abre el archivo justo en vez de recorrer el repo con grep.
|
|
11
|
+
- **Para agentes y para personas.** Servidor MCP, hooks de Claude Code, CLI y un visor web con mapa, funcionalidades, especificaciones e impacto.
|
|
12
|
+
|
|
13
|
+
## Instalación
|
|
14
|
+
|
|
15
|
+
Parado en la carpeta del proyecto (la que tiene tus repos adentro, o un repo solo):
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npx @nicocroce/flowbrain install
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
O instalado global, para tener el comando `flowbrain` siempre a mano:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
npm i -g @nicocroce/flowbrain
|
|
25
|
+
flowbrain install
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
El paquete se llama `@nicocroce/flowbrain`, pero el comando es `flowbrain`. La instalación no compila nada nativo: no corre scripts de instalación.
|
|
29
|
+
|
|
30
|
+
## Cómo se usa
|
|
31
|
+
|
|
32
|
+
### 1. `flowbrain install`
|
|
33
|
+
|
|
34
|
+
- Deja los hooks y los comandos de Claude Code. Con `npx` no queda el comando `flowbrain` en el PATH: para tenerlo, instalalo global (`npm i -g @nicocroce/flowbrain`); si no, cada comando de esta guía se corre como `npx @nicocroce/flowbrain …`.
|
|
35
|
+
- Crea `.flowbrain/` en el proyecto, te muestra los repositorios que encontró (con su tecnología) y pregunta si va **un cerebro por repo** o **uno solo** para todo. Sin preguntar: `--repos <carpeta>` y `--split` o `--single`.
|
|
36
|
+
- Indexa todo y deja el visor en `.flowbrain/flowbrain.html`.
|
|
37
|
+
- Imprime la línea para conectar el MCP.
|
|
38
|
+
|
|
39
|
+
Los hooks y el MCP quedan apuntando a una versión fija (`npx -y @nicocroce/flowbrain@<versión>`), para que una publicación nueva no cambie nada sin aviso. Volver a correr `flowbrain install` actualiza.
|
|
40
|
+
|
|
41
|
+
### 2. El menú
|
|
42
|
+
|
|
43
|
+
Después, en el proyecto o en cualquiera de sus subrepos:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
flowbrain
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Abre un menú en la terminal: configurar el proyecto, analizarlo completo con el agente que elijas, reindexar, abrir el visor, ver el estado, conectar el MCP a un agente y actualizar FlowBrain. Si lo cortás a mitad, la próxima vez sigue desde el primer paso pendiente.
|
|
50
|
+
|
|
51
|
+
### 3. El visor en localhost
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
flowbrain viewer --serve
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Lo sirve en `http://127.0.0.1:4780` (o el siguiente puerto libre). Muestra el mapa del sistema, las funcionalidades, pantallas, contratos, especificaciones, impacto y qué tan entendido quedó cada archivo. Desde ahí se puede corregir: sumar un archivo a una funcionalidad, confirmar reglas, declarar llamadas y **pedir tests** (ver abajo). Todo lo que guarda son archivos del cerebro, versionables.
|
|
58
|
+
|
|
59
|
+
### 4. El MCP en tu agente
|
|
60
|
+
|
|
61
|
+
En Claude Code, para todos tus proyectos:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
claude mcp add --scope user flowbrain -- npx -y @nicocroce/flowbrain@0.1.0 serve --sync
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
En Codex:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
codex mcp add flowbrain -- npx -y @nicocroce/flowbrain@0.1.0 serve --sync
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Cualquier otro cliente MCP (OpenCode, Cursor, etc.): el comando es `npx -y @nicocroce/flowbrain@0.1.0 serve --sync` por stdio. El menú (`flowbrain` → *Conectar un agente*) lo registra por vos en el que elijas. Con `--sync` el servidor reindexa los repos que avanzaron antes de responder.
|
|
74
|
+
|
|
75
|
+
### 5. Varios cerebros: `flowbrain.yaml`
|
|
76
|
+
|
|
77
|
+
En un proyecto con varios servicios (un front, una API, un backend viejo, workers…), cada uno puede ser un cerebro y `.flowbrain/flowbrain.yaml` dice cuáles hay y cómo se comunican: qué base de URL va a qué servicio. Con eso las consultas cruzan de cerebro en cerebro: cambiar una tabla de un servicio llega a la pantalla del front que, pasando por otra API, termina escribiendo en ella.
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
flowbrain brains # cerebros del registro y su estado
|
|
81
|
+
flowbrain brains apply # crea e indexa los que falten
|
|
82
|
+
flowbrain connections # qué viaja entre cerebros
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Herramientas del MCP
|
|
86
|
+
|
|
87
|
+
| Herramienta | Para qué |
|
|
88
|
+
|---|---|
|
|
89
|
+
| `buscar_nodo` | Encontrar algo cuando no sabés su id: una clase, un método, una palabra. |
|
|
90
|
+
| `recorrer_grafo` | Vecinos de un nodo por tipo de relación. |
|
|
91
|
+
| `funcionalidad` | Qué hace una funcionalidad de producto: endpoints, pantallas, datos y relaciones. |
|
|
92
|
+
| `pantalla` | Una pantalla del front de punta a punta: de dónde se llega, a dónde lleva, qué llama del back. |
|
|
93
|
+
| `recorrido` | Qué ejecuta un endpoint o un método, paso a paso, y qué toca cada paso. |
|
|
94
|
+
| `contrato_de` | Qué recibe y devuelve un endpoint, y quién lo llama. |
|
|
95
|
+
| `quien_llama` | Quién llama a un método o a una clase. |
|
|
96
|
+
| `impacto` | Qué se rompe si cambia una tabla, un endpoint, un servicio o una funcionalidad. |
|
|
97
|
+
| `riesgo` | Alcance de un cambio concreto: un diff o unos archivos. |
|
|
98
|
+
| `trazar` | Por dónde viaja un dato entre servicios. |
|
|
99
|
+
| `deriva` | Endpoints que nadie llama y llamadas que nadie atiende, campo por campo. |
|
|
100
|
+
| `paridad` | Qué falta migrar de un servicio a otro. |
|
|
101
|
+
| `infra` | Cómo se construye, despliega y configura un servicio: imagen, pipeline, variables, proxy, Kubernetes, Helm, Terraform, serverless. |
|
|
102
|
+
| `especificaciones` | Qué tiene que cumplir una funcionalidad (reglas de negocio y de producto), qué archivo lo cumple y qué test lo verifica. |
|
|
103
|
+
| `sin_asociar` | Archivos que no son de ninguna funcionalidad y a cuál conviene asociar cada uno. |
|
|
104
|
+
| `fidelidad` | Qué tan confiable es lo que el grafo dice de un archivo o una funcionalidad, y qué falta completar. |
|
|
105
|
+
| `conexiones` | Qué llamadas cruzan entre cerebros (solo con varios cerebros). |
|
|
106
|
+
|
|
107
|
+
Las mismas consultas están en la CLI: `flowbrain search`, `feature`, `screen`, `flow`, `contract`, `callers`, `impact`, `risk`, `trace`, `drift`, `parity`, `infra`, `specs`, `unassigned`, `fidelity`. Por ejemplo `git diff | flowbrain risk --diff -`. `flowbrain --help` las lista todas.
|
|
108
|
+
|
|
109
|
+
## Comandos de Claude Code
|
|
110
|
+
|
|
111
|
+
`install` deja estos comandos en Claude Code. Se corren en orden la primera vez (el menú, con *Analizar el proyecto completo*, los encadena):
|
|
112
|
+
|
|
113
|
+
| Comando | Qué hace |
|
|
114
|
+
|---|---|
|
|
115
|
+
| `/flowbrain-study` | Estudia cómo está hecho cada repo y escribe los extractores que completan lo que los parsers no vieron. |
|
|
116
|
+
| `/flowbrain-index` | Analiza la comunicación real entre servicios: a qué servicio va cada llamada, con evidencia. |
|
|
117
|
+
| `/flowbrain-features` | Deduce y completa las funcionalidades de producto de cada cerebro. |
|
|
118
|
+
| `/flowbrain-specs` | Deduce las especificaciones de negocio y de producto de cada funcionalidad. |
|
|
119
|
+
| `/flowbrain-tests` | Resuelve cada regla: la verifica con un test, o informa por qué no se puede o si el código no la cumple. |
|
|
120
|
+
|
|
121
|
+
Con otro agente, las mismas instrucciones salen de `flowbrain coverage --guide`, `evidence --guide`, `feature --guide` y `specs --guide`.
|
|
122
|
+
|
|
123
|
+
## Pedir tests
|
|
124
|
+
|
|
125
|
+
En la pantalla Especificaciones del visor se eligen reglas y se piden sus tests en lote: FlowBrain abre tu agente por repo, con el proveedor y el modelo que elijas, y cada regla vuelve verificada por un test, para decidir (la regla puede estar mal) o para desarrollo (el código no la cumple). FlowBrain nunca cambia el código de producción.
|
|
126
|
+
|
|
127
|
+
## Requisitos
|
|
128
|
+
|
|
129
|
+
- **Node ≥ 20.**
|
|
130
|
+
- **Claude Code**, opcional: hace falta para el análisis completo (`/flowbrain-*`) y para pedir tests desde el visor. Sin él, el índice, el visor, la CLI y el MCP funcionan igual, y el análisis se puede hacer con otro agente pegando las guías.
|
|
131
|
+
|
|
132
|
+
## Diagnóstico
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
flowbrain doctor # grafo, índice, clones, hooks y MCP registrados (solo lee)
|
|
136
|
+
flowbrain status # repos al día, conteos y huecos conocidos
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
El contrato del grafo está en `SCHEMA.md`, dentro del paquete. Código y reportes: [github.com/NicoCroce/FlowBrain](https://github.com/NicoCroce/FlowBrain).
|
|
140
|
+
|
|
141
|
+
Licencia Apache-2.0.
|
package/README.md
CHANGED
|
@@ -1,3 +1,141 @@
|
|
|
1
|
-
#
|
|
1
|
+
# FlowBrain
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**English** · [Español](README.es.md)
|
|
4
|
+
|
|
5
|
+
> **What does the AI understand about your project?** FlowBrain puts it in plain sight so you can verify it and correct it, making every answer more deterministic. Start with the [guide](https://github.com/NicoCroce/FlowBrain/blob/main/docs/GUIDE.md).
|
|
6
|
+
|
|
7
|
+
FlowBrain builds a **knowledge graph of your system** so a coding agent (Claude Code, Codex, OpenCode or another) understands the product before touching it: which features it has, which screens make them up, which endpoints they call, which methods run, which tables they touch and **what breaks if something changes**, across different repositories and services too.
|
|
8
|
+
|
|
9
|
+
- **It reads the code, it does not guess.** Parsers read TypeScript/JavaScript (React, React Native, Vue, Svelte, Astro, Next, Nest, Express…), PHP, OpenAPI, database schemas and infrastructure (Docker, CI, Kubernetes, Helm, Terraform, serverless). Whatever a parser does not understand is completed by your agent: it studies the repo and writes *extractors* that FlowBrain checks fact by fact.
|
|
10
|
+
- **Deterministic.** No query calls an LLM. Every fact cites its evidence (`repo:path#Ln`), so the agent opens the exact file instead of grepping the repo.
|
|
11
|
+
- **For agents and for people.** MCP server, Claude Code hooks, CLI and a web viewer with a map, features, specifications and impact.
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
From the project folder (the one with your repos inside, or a single repo):
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npx @nicocroce/flowbrain install
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Or installed globally, to always have the `flowbrain` command at hand:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
npm i -g @nicocroce/flowbrain
|
|
25
|
+
flowbrain install
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
The package is called `@nicocroce/flowbrain`, but the command is `flowbrain`. Installing compiles nothing native: it runs no install scripts.
|
|
29
|
+
|
|
30
|
+
## How to use it
|
|
31
|
+
|
|
32
|
+
### 1. `flowbrain install`
|
|
33
|
+
|
|
34
|
+
- Sets up the Claude Code hooks and commands. With `npx` the `flowbrain` command does not stay on the PATH: to have it, install it globally (`npm i -g @nicocroce/flowbrain`); otherwise, run every command in this guide as `npx @nicocroce/flowbrain …`.
|
|
35
|
+
- Creates `.flowbrain/` in the project, shows you the repositories it found (with their technology) and asks whether there is **one brain per repo** or **a single one** for everything. Without asking: `--repos <folder>` and `--split` or `--single`.
|
|
36
|
+
- Indexes everything and leaves the viewer in `.flowbrain/flowbrain.html`.
|
|
37
|
+
- Prints the line to connect the MCP server.
|
|
38
|
+
|
|
39
|
+
Hooks and the MCP server point to a fixed version (`npx -y @nicocroce/flowbrain@<version>`), so a new release changes nothing without notice. Running `flowbrain install` again updates.
|
|
40
|
+
|
|
41
|
+
### 2. The menu
|
|
42
|
+
|
|
43
|
+
After that, in the project or in any of its sub-repos:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
flowbrain
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
It opens a terminal menu: set up the project, analyze it fully with the agent you choose, re-index, open the viewer, see the status, connect the MCP server to an agent and update FlowBrain. If you stop halfway, next time it resumes from the first pending step.
|
|
50
|
+
|
|
51
|
+
### 3. The viewer on localhost
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
flowbrain viewer --serve
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
It serves it on `http://127.0.0.1:4780` (or the next free port). It shows the map of the system, the features, screens, contracts, specifications, impact and how well each file is understood. From there you can correct things: add a file to a feature, confirm rules, declare calls and **request tests** (see below). Everything it saves are brain files, versionable.
|
|
58
|
+
|
|
59
|
+
### 4. The MCP server in your agent
|
|
60
|
+
|
|
61
|
+
In Claude Code, for all your projects:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
claude mcp add --scope user flowbrain -- npx -y @nicocroce/flowbrain@0.1.0 serve --sync
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
In Codex:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
codex mcp add flowbrain -- npx -y @nicocroce/flowbrain@0.1.0 serve --sync
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Any other MCP client (OpenCode, Cursor, etc.): the command is `npx -y @nicocroce/flowbrain@0.1.0 serve --sync` over stdio. The menu (`flowbrain` → *Connect an agent*) registers it for you in the one you pick. With `--sync` the server re-indexes the repos that moved forward before answering.
|
|
74
|
+
|
|
75
|
+
### 5. Several brains: `flowbrain.yaml`
|
|
76
|
+
|
|
77
|
+
In a project with several services (a front end, an API, a legacy back end, workers…), each one can be a brain, and `.flowbrain/flowbrain.yaml` says which ones exist and how they communicate: which base URL goes to which service. With that, queries cross from brain to brain: changing a table in one service reaches the front-end screen that, through another API, ends up writing to it.
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
flowbrain brains # brains in the registry and their state
|
|
81
|
+
flowbrain brains apply # creates and indexes the missing ones
|
|
82
|
+
flowbrain connections # what travels between brains
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## MCP tools
|
|
86
|
+
|
|
87
|
+
| Tool | What for |
|
|
88
|
+
|---|---|
|
|
89
|
+
| `buscar_nodo` | Find something when you do not know its id: a class, a method, a word. |
|
|
90
|
+
| `recorrer_grafo` | Neighbors of a node by relationship type. |
|
|
91
|
+
| `funcionalidad` | What a product feature does: endpoints, screens, data and relationships. |
|
|
92
|
+
| `pantalla` | A front-end screen end to end: where you arrive from, where it leads, what it calls in the back end. |
|
|
93
|
+
| `recorrido` | What an endpoint or method runs, step by step, and what each step touches. |
|
|
94
|
+
| `contrato_de` | What an endpoint receives and returns, and who calls it. |
|
|
95
|
+
| `quien_llama` | Who calls a method or a class. |
|
|
96
|
+
| `impacto` | What breaks if a table, an endpoint, a service or a feature changes. |
|
|
97
|
+
| `riesgo` | Scope of a concrete change: a diff or some files. |
|
|
98
|
+
| `trazar` | Where a piece of data travels between services. |
|
|
99
|
+
| `deriva` | Endpoints nobody calls and calls nobody serves, field by field. |
|
|
100
|
+
| `paridad` | What is left to migrate from one service to another. |
|
|
101
|
+
| `infra` | How a service is built, deployed and configured: image, pipeline, variables, proxy, Kubernetes, Helm, Terraform, serverless. |
|
|
102
|
+
| `especificaciones` | What a feature must comply with (business and product rules), which file implements it and which test verifies it. |
|
|
103
|
+
| `sin_asociar` | Files that belong to no feature and which one each should join. |
|
|
104
|
+
| `fidelidad` | How reliable what the graph says about a file or a feature is, and what is left to complete. |
|
|
105
|
+
| `conexiones` | Which calls cross between brains (only with several brains). |
|
|
106
|
+
|
|
107
|
+
The same queries are in the CLI: `flowbrain search`, `feature`, `screen`, `flow`, `contract`, `callers`, `impact`, `risk`, `trace`, `drift`, `parity`, `infra`, `specs`, `unassigned`, `fidelity`. For example `git diff | flowbrain risk --diff -`. `flowbrain --help` lists them all.
|
|
108
|
+
|
|
109
|
+
## Claude Code commands
|
|
110
|
+
|
|
111
|
+
`install` adds these commands to Claude Code. The first time they run in order (the menu, with *Analyze the whole project*, chains them):
|
|
112
|
+
|
|
113
|
+
| Command | What it does |
|
|
114
|
+
|---|---|
|
|
115
|
+
| `/flowbrain-study` | Studies how each repo is built and writes the extractors that complete what the parsers did not see. |
|
|
116
|
+
| `/flowbrain-index` | Analyzes the real communication between services: which service each call goes to, with evidence. |
|
|
117
|
+
| `/flowbrain-features` | Deduces and completes the product features of each brain. |
|
|
118
|
+
| `/flowbrain-specs` | Deduces the business and product specifications of each feature. |
|
|
119
|
+
| `/flowbrain-tests` | Resolves each rule: verifies it with a test, or reports why it cannot be done or whether the code does not comply. |
|
|
120
|
+
|
|
121
|
+
With another agent, the same instructions come from `flowbrain coverage --guide`, `evidence --guide`, `feature --guide` and `specs --guide`.
|
|
122
|
+
|
|
123
|
+
## Requesting tests
|
|
124
|
+
|
|
125
|
+
In the viewer's Specifications screen you pick rules and request their tests in bulk: FlowBrain opens your agent per repo, with the provider and model you choose, and each rule comes back verified by a test, to decide (the rule may be wrong) or for development (the code does not comply). FlowBrain never changes production code.
|
|
126
|
+
|
|
127
|
+
## Requirements
|
|
128
|
+
|
|
129
|
+
- **Node ≥ 20.**
|
|
130
|
+
- **Claude Code**, optional: needed for the full analysis (`/flowbrain-*`) and to request tests from the viewer. Without it, the index, the viewer, the CLI and the MCP server work the same, and the analysis can be done with another agent by pasting the guides.
|
|
131
|
+
|
|
132
|
+
## Diagnostics
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
flowbrain doctor # graph, index, clones, registered hooks and MCP (read-only)
|
|
136
|
+
flowbrain status # repos up to date, counts and known gaps
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
The graph contract is in `SCHEMA.md`, inside the package. Code and issues: [github.com/NicoCroce/FlowBrain](https://github.com/NicoCroce/FlowBrain).
|
|
140
|
+
|
|
141
|
+
Apache-2.0 license.
|