supcoflow 0.7.0 → 0.8.1

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 CHANGED
@@ -1,219 +1,296 @@
1
1
  # supcoflow
2
2
 
3
- La terminal de [Supcoflow](https://app.supcoflow.dev): iniciar sesión y manejar el chat de soporte
4
- desde la consola, o desde un asistente de código que corre comandos por vos.
3
+ The [Supcoflow](https://app.supcoflow.dev) terminal: sign in and manage the support chat from the console,
4
+ or from a code assistant that runs the commands for you.
5
5
 
6
- Trae iniciar y cerrar sesión, ver con qué cuenta estás, conectar el repo con la App de GitHub,
7
- crear su proyecto, configurar el chat, ponerlo en la app y probar que un problema llega hasta un issue.
6
+ It signs you in and out, shows which account you are using, connects the repo with the GitHub App, creates
7
+ its project, configures the chat, puts it in the app, and checks that a problem reaches an issue.
8
8
 
9
- ## Instalar
9
+ ## Install
10
10
 
11
- Hace falta Node 24 o más nuevo.
11
+ Node 24 or newer is required.
12
12
 
13
13
  ```bash
14
14
  npx supcoflow login
15
15
  ```
16
16
 
17
- ## Los comandos
17
+ ## The commands
18
18
 
19
- | Comando | Qué hace |
19
+ The command names are in English. The Spanish names of 0.7.0 (`quien-soy`, `guia publicar`,
20
+ `--autorizo-gasto`, `--modo relevar|guardar`…) still work as hidden aliases; `describe` and `--help` only show
21
+ the English ones.
22
+
23
+ | Command | What it does |
20
24
  |---|---|
21
- | `supcoflow login` | Te muestra un enlace y un código; lo aprobás en la consola y la terminal queda con su clave. |
22
- | `supcoflow login --start` | El primer paso, solo: pide el código y sale 5 con el enlace para aprobarlo. |
23
- | `supcoflow login --wait` | El segundo paso: espera la aprobación hasta 90 s. Si todavía no llegó, sale 5: volvé a correrlo. |
24
- | `supcoflow logout` | Revoca la clave en uso y la borra de esta máquina. |
25
- | `supcoflow quien-soy` | Con qué clave anda la terminal, a nombre de quién y en qué equipo. |
26
- | `supcoflow repo conectar` | Conecta el repo de esta carpeta con la App de GitHub: te da un enlace, lo confirmás en la consola. Sin terminal, `--start` y después `--wait`, como `login`. |
27
- | `supcoflow proyecto crear` | Crea (o reusa) el proyecto del repo ya conectado y lo anota en `.supcoflow/proyecto.json`. Si el motor no deduce los comandos, `--install "…" --test "…"`. |
28
- | `supcoflow proyecto ver` | El proyecto del repo: rama, comandos y el estado de la App de GitHub. |
29
- | `supcoflow guia revisar` | Revisa `.supcoflow/guia.md` contra el motor sin publicar nada. |
30
- | `supcoflow guia publicar` | Sube `.supcoflow/guia.md` directo (con el commit y la rama que declara tu clon, no verificados en GitHub). `--desde-github` verifica contra la rama principal en vez de subir el archivo. |
31
- | `supcoflow guia ver` | Muestra la guía activa, de dónde viene y si la rama sigue al día. |
32
- | `supcoflow guia usar --origen repo\|agente` | Elige cuál guía queda activa. |
33
- | `supcoflow widget` | Lo que hay que pegar en la app para tener el chat (ver «Poner el chat en la app»). |
34
- | `supcoflow instalacion anotar --skill 0.1.0` | Anota en `.supcoflow/instalacion.json` con qué versiones se instaló el chat. |
35
- | `supcoflow describir --json` | Todo el contrato (comandos, flags, facultades de la clave, códigos) en una línea de JSON. |
36
-
37
- `supcoflow --help` (o `supcoflow <comando> --help`) muestra la ayuda con ejemplos. Los comandos de
38
- repo y proyecto toman el repo del `origin` de la carpeta; `--repo owner/repo` lo elige a mano.
39
-
40
- ### De cero a un proyecto
41
-
42
- 1. `supcoflow login`: aprobás el código en la consola.
43
- 2. `supcoflow repo conectar`: instalás la App en GitHub si hace falta y tocás Confirmar.
44
- 3. `supcoflow proyecto crear`: queda el proyecto y `.supcoflow/proyecto.json` para commitear.
45
- 4. `supcoflow proyecto ver`: para revisar cómo quedó.
46
-
47
- ### Ejemplos
25
+ | `supcoflow login` | Shows a link and a code; you approve it in the console and the terminal keeps its key. |
26
+ | `supcoflow login --start` | The first step alone: asks for the code and exits 5 with the link to approve it. |
27
+ | `supcoflow login --wait` | The second step: waits for the approval up to 90 s. If it hasn't arrived, exits 5: run it again. |
28
+ | `supcoflow logout` | Revokes the key in use and deletes it from this machine. |
29
+ | `supcoflow whoami` | Which key the terminal runs with, on whose behalf and in which team. |
30
+ | `supcoflow repo connect` | Connects this folder's repo with the GitHub App: it gives you a link and you confirm it in the console. Without a terminal, `--start` and then `--wait`, like `login`. |
31
+ | `supcoflow project create` | Creates (or reuses) the project of the connected repo and records it in `.supcoflow/proyecto.json`. If the engine can't work out the commands, `--install "…" --test "…"`. |
32
+ | `supcoflow project show` | The repo's project: branch, commands and the state of the GitHub App, starting with who you are: «You're @login in team T; repo O/R; project P (existing)». |
33
+ | `supcoflow guide check` | Checks `.supcoflow/guide.md` against the engine without publishing anything. |
34
+ | `supcoflow guide publish` | Uploads `.supcoflow/guide.md` directly (with the commit and branch your clone declares, not verified in GitHub). `--from-github` verifies against the main branch instead of uploading the file. |
35
+ | `supcoflow guide show` | Shows the active guide, where it comes from, which file it was read from and whether the branch is still up to date. |
36
+ | `supcoflow guide use --source repo\|agent` | Chooses which guide is active. |
37
+ | `supcoflow guide versions` | The guide that governs now and the repo's publications, newest first; at most one says «live». |
38
+ | `supcoflow widget` | What to paste into the app to get the chat (see «Put the chat in the app»). |
39
+ | `supcoflow install record --skill 0.3.1 --file app/_supcoflow/support-chat.tsx` | Records in `.supcoflow/instalacion.json` which versions the chat was installed with and which file it lives in. |
40
+ | `supcoflow diagnose` | Free: how far the installation is (N of 6) and whether a test would go in (including whether this machine can save the test request). |
41
+ | `supcoflow test` | The end-to-end test (see «Test the installation»). |
42
+ | `supcoflow describe --json` | The whole contract (commands, flags, key capabilities, codes) in one line of JSON. |
43
+
44
+ `supcoflow --help` (or `supcoflow <command> --help`) shows the help with examples. The repo and project commands
45
+ take the repo from the folder's `origin`; `--repo owner/repo` picks it by hand.
46
+
47
+ ### When the `origin` isn't a GitHub address
48
+
49
+ The terminal only recognizes `origin` when its host is exactly `github.com` (`https://github.com/o/r`,
50
+ `git@github.com:o/r.git`, `ssh://git@github.com/o/r`). If yours is an SSH alias (`git@github-work:o/r.git`) or
51
+ another server, it never runs `ssh` or reads your SSH configuration (it could run programs of yours). You tell it
52
+ once, in your own clone, which GitHub repo this is:
48
53
 
49
54
  ```bash
50
- # Una persona frente a la terminal
51
- supcoflow login
52
-
53
- # Un asistente, sin terminal interactiva: dos pasos
54
- supcoflow login --start --json # sale 5 con verification_uri_complete y user_code
55
- supcoflow login --wait --json # sale 5 mientras la persona no apruebe; 0 cuando aprueba
55
+ git remote add supcoflow https://github.com/owner/repo.git # it's never fetched
56
+ ```
56
57
 
57
- supcoflow repo conectar --start --json # sale 5 con la url para confirmar
58
- supcoflow repo conectar --wait --json # sale 5 mientras nadie confirme; 0 conectado
59
- supcoflow proyecto crear --json # 4 si hay un .supcoflow/proyecto.json distinto (no lo pisa)
60
- supcoflow proyecto crear --install "pnpm i" --test "pnpm test"
61
- supcoflow proyecto ver --json
58
+ A remote called `supcoflow` with those same strict forms ties the clone to that repo for every command. If `origin`
59
+ is a GitHub address, `origin` wins. The error says the exact command to run. With `--repo owner/repo`, the commands
60
+ that read or write a file of the clone (`guide check`, `guide publish`, `install record`) only use this clone if it is
61
+ that repo; otherwise they exit 3 saying what the clone is, without asking the engine. (`project create --repo` keeps
62
+ creating or reusing the project; when this clone is not that repo it does so without reading or writing this clone's
63
+ `.supcoflow/proyecto.json`, and when it is that repo it reads and records the file as usual.)
62
64
 
63
- supcoflow quien-soy --json
64
- supcoflow logout --dry-run # qué revocaría, sin revocar nada
65
- ```
65
+ ### Is this repo the one for this account?
66
66
 
67
- ## Configurar
67
+ Every command that acts on the repo's project first checks what it can see, and exits 4 `contexto_incoherente` (with a
68
+ `motivo`) without touching anything when it doesn't add up:
68
69
 
69
- Con el repo ya conectado y su proyecto creado, se configura el chat sin entrar a la consola (la clave
70
- tiene que ser de sesión, no de consulta). Todos toman el repo del `origin`, o `--repo owner/repo`, y
71
- los que escriben aceptan `--dry-run`.
70
+ - `proyecto_del_clon_distinto`: `.supcoflow/proyecto.json` notes a project your key doesn't see for this repo. Check
71
+ which account you signed in with (`supcoflow whoami`), or review that old file.
72
+ - `archivo_del_clon_ilegible`: that file exists but can't be read or understood (its content is never printed).
73
+ - `dueno_distinto_del_login` (only when this repo has no project yet, in `project show` and `project create`; `show` stops the walk-through before `repo connect`): the repo's owner on GitHub isn't the GitHub login of your
74
+ key. It is a *possible* mismatch (the engine compares GitHub's number, and a login can be renamed): sign in to the
75
+ console with GitHub again, or as the owner. If your key comes from `SUPCOFLOW_TOKEN`, that variable wins over a new
76
+ login, and the terminal doesn't touch it.
77
+ - `sin_github` (only when this repo has no project yet, in `project show` and `project create`): the account was signed in by email; connecting a repo needs GitHub.
72
78
 
73
- | Comando | Qué hace |
74
- |---|---|
75
- | `supcoflow catalogo` | Qué se puede configurar y con qué valores. |
76
- | `supcoflow configuracion` | Chat, sitios, marca y acuerdo de datos del proyecto. |
77
- | `supcoflow chat prender` / `chat apagar` | Prende o apaga el chat (hace falta una guía: publicá la del repo con `supcoflow guia publicar` o generá y aprobá la de nuestro agente en Brain). |
78
- | `supcoflow chat marca --titulo "Ayuda" --tema acento=#0a7` | Título, saludo y colores; lo no nombrado queda igual. |
79
- | `supcoflow chat logo --archivo logo.png` | Sube el logo (.png, .jpg o .webp, hasta 200 KB). |
80
- | `supcoflow sitios agregar\|quitar --sitio https://app.ejemplo.com` | Sitios desde los que carga el chat. |
81
- | `supcoflow datos fijar --permitir usuario_id,atributo:plan` | Acuerdo de datos: frena lo que se guarda y lo que lee la IA que releva; no cubre lo que ve la IA del chat mientras conversa. |
82
- | `supcoflow politica fijar --modo guardar` | Qué hace el motor con un problema que llega por el chat: `relevar` (gasta) o `guardar`. Guardar frena sólo lo automático del chat; una persona puede pedir el relevamiento desde la consola, y cuesta. |
83
- | `supcoflow claves crear --nombre ci --guardar-en ~/ci.key` | Clave de consulta para CI: el secreto queda sólo en ese archivo (0600, fuera de un repo), nunca en la salida. |
84
- | `supcoflow claves listar` / `claves revocar --id cla_…` | Ver y revocar claves de consulta. |
85
-
86
- ## La guía
87
-
88
- La guía le cuenta al chat qué hace cada pantalla de tu producto. Vive en el repo, en
89
- `.supcoflow/guia.md` (en la raíz). El flujo, en este orden:
90
-
91
- 1. `supcoflow guia revisar`: la revisa contra el motor sin publicar nada (si está mal armada, sale 3 con la línea de cada error).
92
- 2. `supcoflow guia publicar`: sube el archivo directo y queda como guía activa. Manda también el commit y la rama de tu
93
- clon (`git rev-parse HEAD`, si hay git y commits; si no, va sin commit): son declarados por la terminal, no
94
- verificados en GitHub, y así se muestran. Repetir con el mismo archivo no duplica.
95
- 3. Opcional, `supcoflow guia publicar --desde-github`: no sube el archivo; manda su huella y el motor la compara con la
96
- de la rama principal de GitHub (commit verificado). Si todavía no está subida (o la rama tiene otra), sale 5:
97
- subí la guía a la rama principal y volvé a correr.
98
-
99
- `supcoflow guia ver` muestra la guía activa y si la rama sigue al día (`al_dia` en el JSON);
100
- `supcoflow guia usar --origen repo|agente` elige cuál queda activa cuando hay una del repo y otra de nuestro agente.
101
- Todos toman el repo del `origin`, o `--repo owner/repo` (con `revisar` y `publicar`, sin clon local de ese repo sale 3 `falta_guia`: la guía se lee del archivo); `revisar`, `publicar` y `usar` aceptan `--dry-run`; `--desde-github` es sólo de `publicar`.
102
-
103
- El formato de `.supcoflow/guia.md`:
79
+ A project that already exists is never blocked for belonging to another person of the team. This doesn't see a project
80
+ of the same repo in another team when the clone doesn't note it.
104
81
 
105
- ```markdown
106
- # Guía de Mi App ← opcional; se ignora
107
-
108
- ## Facturas ← una sección por pantalla o función (1 a 60). Nombre: 1–120 caracteres
109
- Para qué sirve: Ver y pagar las facturas del mes. ← obligatorio, 1–600
110
- Qué puede hacer el usuario: Descargar el PDF, pagar con ← obligatorio, 1–600; puede seguir
111
- tarjeta y ver el historial. en las líneas de abajo
112
- Problemas comunes: ← opcional; hasta 10, cada uno 1–300
113
- - El botón Pagar no responde con tarjetas de débito.
114
- - El PDF sale en blanco en Safari.
115
- ```
82
+ ### From zero to a project
116
83
 
117
- - Las etiquetas se reconocen al principio de la línea, sin distinguir mayúsculas y con o sin tildes
118
- («Para que sirve:» vale). Una línea que no es etiqueta continúa el campo anterior (se une con un espacio).
119
- - Texto antes del primer `## ` que no sea el `# ` del título → error. Una etiqueta repetida en una sección →
120
- error. Una línea con `<` o `>` → error. Más de 64 KB → `guia_muy_grande`.
84
+ 1. `supcoflow login`: you approve the code in the console.
85
+ 2. `supcoflow repo connect`: you install the App on GitHub if needed and tap Confirm.
86
+ 3. `supcoflow project create`: the project is created and `.supcoflow/proyecto.json` is left to commit.
87
+ 4. `supcoflow project show`: to check how it ended up.
121
88
 
122
- ## Poner el chat en la app
89
+ ### Examples
123
90
 
124
- `supcoflow widget` muestra lo que hay que pegar, armado por el motor con los ids de tu proyecto (no los
125
- copies a mano: un id mal copiado deja el chat invisible sin ningún error). No escribe archivos de la app:
91
+ ```bash
92
+ # A person at the terminal
93
+ supcoflow login
126
94
 
127
- 1. El paquete con su versión exacta (`npm i @supcoflow/chat@… --save-exact`, o lo mismo con tu gestor).
128
- 2. **Next.js (App Router):** un archivo envoltorio en la ruta que sugiere el motor
129
- (`app/_supcoflow/chat-de-soporte.tsx`; si la app usa `src/app`, dentro de `src/app`), con el contenido
130
- tal cual. Hace falta porque el componente del chat usa hooks de React y no trae `"use client"`, y un
131
- `layout.tsx` es de servidor por defecto: importarlo directo ahí no anda. El envoltorio es esa directiva
132
- más el componente con los ids.
133
- 3. Usar el envoltorio en el layout que cubre las pantallas donde se traban tus usuarios.
134
- 4. Si la app tiene una política de contenido (CSP) con `connect-src`, agregarle el origen del chat
135
- conservando lo que ya tiene (una segunda `connect-src` se ignora).
95
+ # An assistant, without an interactive terminal: two steps
96
+ supcoflow login --start --json # exits 5 with verification_uri_complete and user_code
97
+ supcoflow login --wait --json # exits 5 until the person approves; 0 when they do
136
98
 
137
- La línea de `<script>` que también muestra está disponible pero no probada en una app real, y no es
138
- para Next.js. `supcoflow widget --json` devuelve el objeto del motor tal cual.
99
+ supcoflow repo connect --start --json # exits 5 with the URL to confirm
100
+ supcoflow repo connect --wait --json # exits 5 until someone confirms; 0 connected
101
+ supcoflow project create --json # 4 if there is a different .supcoflow/proyecto.json (it doesn't overwrite)
102
+ supcoflow project create --install "pnpm i" --test "pnpm test"
103
+ supcoflow project show --json
139
104
 
140
- Después, `supcoflow instalacion anotar --skill <versión> [--app <carpeta>]` deja en
141
- `.supcoflow/instalacion.json` (para commitear) con qué versiones quedó: la skill, la terminal, el chat
142
- declarado e instalado, y la configuración del proyecto. Nunca lleva un secreto ni una fecha; repetirlo
143
- sin cambios no lo toca, y si el archivo tiene cambios sin commit sale 4 y no lo pisa.
105
+ supcoflow whoami --json
106
+ supcoflow logout --dry-run # what it would revoke, without revoking anything
107
+ ```
144
108
 
145
- ## Probar la instalación
109
+ ## Configure
146
110
 
147
- Con el chat puesto, dos comandos dicen si un problema que entra por el chat llega hasta un issue. Los dos
148
- toman el repo del `origin`, o `--repo owner/repo`.
111
+ With the repo connected and its project created, the chat is configured without entering the console (the key
112
+ has to be a session key, not a read-only one). All of them take the repo from the `origin`, or `--repo
113
+ owner/repo`, and the ones that write accept `--dry-run`.
149
114
 
150
- | Comando | Qué hace |
115
+ | Command | What it does |
151
116
  |---|---|
152
- | `supcoflow diagnosticar` | Gratis y sin escribir nada: revisa instalación de GitHub, sitios, chat, guía, política, saldo del mes y pruebas abiertas. Sale 0 si está todo listo, 4 si algo hay que arreglar (con cada punto). |
153
- | `supcoflow probar` | Sin `--autorizo-gasto` no manda nada: sale 4 con el techo de la prueba, el saldo, el tope y lo comprometido del mes. |
154
- | `supcoflow probar --autorizo-gasto` | Pide la prueba: el problema entra por la misma puerta que el chat y corre un relevamiento que **gasta** hasta el techo que mostró el motor (con la política `guardar` llega hasta el caso guardado y no gasta). Sale 5 con el id. `--mensaje "…"` usa un texto propio. |
155
- | `supcoflow probar --wait` | Sigue la última prueba hasta 90 s: 5 mientras corre (volvé a llamarlo), 0 con el issue, 4 si hay que mirarla en la consola (trae el enlace). El cobro se muestra como esté: `pendiente` justo al cerrar, nunca 0. `--prueba prb_…` sigue otra. |
156
- | `supcoflow probar --dry-run --autorizo-gasto` | Lo que haría (proyecto, techo, saldo, política), sin pedir nada. |
157
-
158
- Si la respuesta del motor no llega, el pedido queda guardado en esta máquina (fuera del repo, junto a las
159
- credenciales): repetir `supcoflow probar --autorizo-gasto` retoma **la misma** prueba en vez de pedir otra.
160
- Mientras haya un pedido sin confirmar, otro `--mensaje` sale 4 `intento_pendiente`. La prueba va con la clave
161
- personal de `supcoflow login`; una clave de consulta no puede pedirla. Una sola prueba abierta por proyecto: otra
162
- sale 4 `prueba_en_curso` con el id de la abierta. El issue de una prueba queda abierto y rotulado como prueba.
117
+ | `supcoflow catalog` | What can be configured and with which values. |
118
+ | `supcoflow config` | The project's chat, sites, brand and data agreement. |
119
+ | `supcoflow chat on` / `chat off` | Turns the chat on or off (a guide is needed: publish the repo's with `supcoflow guide publish`, or generate and approve our agent's in Brain). |
120
+ | `supcoflow chat brand --title "Help" --theme acento=#0a7` | Title, greeting and colors; whatever isn't named stays as it was. The `--theme` keys are the API's: `acento`, `fondo`, `texto`, `textoSuave`, `radio`, `fuente`. |
121
+ | `supcoflow chat logo --file logo.png` | Uploads the logo (.png, .jpg or .webp, up to 200 KB). |
122
+ | `supcoflow sites add\|remove --site https://app.example.com` | Sites the chat loads from. |
123
+ | `supcoflow data set --allow user_id,attribute:plan` | Data agreement: it limits what is saved and what the AI that investigates reads; it doesn't cover what the chat's AI sees while it talks. The values are `user_id`, `user_role`, `page_and_browser`, `screenshots`, `elements`, `email`, `attribute:<name>` or `nothing`. |
124
+ | `supcoflow policy set --mode save` | What the engine does with a problem that comes in through the chat: `investigate` (spends) or `save`. Saving only stops what the chat does automatically; a person can still ask for the investigation from the console, and it costs. |
125
+ | `supcoflow keys create --name ci --save-to ~/ci.key` | Read-only key for CI: the secret stays only in that file (0600, outside a repo), never in the output. |
126
+ | `supcoflow keys list` / `keys revoke --id cla_…` | List and revoke read-only keys. |
127
+
128
+ ## The guide
129
+
130
+ The guide tells the chat what each screen of your product does. It lives in the repo, in
131
+ `.supcoflow/guide.md` (at the root). The flow, in this order:
132
+
133
+ 1. `supcoflow guide check`: checks it against the engine without publishing anything (if it is badly formed it exits 3 with the line of each error).
134
+ 2. `supcoflow guide publish`: uploads the file directly and it becomes the active guide. It also sends your clone's
135
+ commit and branch (`git rev-parse HEAD`, if there is git and commits; otherwise it goes without a commit): they are
136
+ declared by the terminal, not verified in GitHub, and are shown that way. It also sends the file it actually read.
137
+ Repeating with the same file doesn't duplicate it.
138
+ 3. Optional, `supcoflow guide publish --from-github`: it doesn't upload the file; it sends its fingerprint and the
139
+ engine compares it with the main branch's on GitHub (verified commit). If it isn't pushed yet (or the branch has
140
+ another one), it exits 5: push the guide to the main branch and run again.
141
+
142
+ **The old file name.** Until 0.7.0 the file was `.supcoflow/guia.md`. If `guide.md` doesn't exist and `guia.md` does,
143
+ the terminal reads `guia.md` and says so («rename it to `guide.md`»); it never renames or deletes your files. If both
144
+ exist, `guide.md` wins and the terminal says `guia.md` is ignored. If `guide.md` exists but can't be read, or is
145
+ badly formed, that is an error: it never falls back to the old one.
146
+
147
+ `supcoflow guide show` shows the active guide, the file it was read from and whether the branch is still up to date
148
+ (`al_dia` in the JSON); `supcoflow guide versions` lists the guide that governs now and the repo's publications;
149
+ `supcoflow guide use --source repo|agent` chooses which one is active when there is one from the repo and one from
150
+ our agent. All of them take the repo from the `origin` (or a `supcoflow` remote, see above), or `--repo owner/repo`
151
+ (with `check` and `publish`, if this clone isn't that repo it exits 3 `falta_guia` saying what the clone is: the guide
152
+ is read from the file); `check`, `publish` and `use` accept `--dry-run`; `--from-github` is only for `publish`.
153
+
154
+ The format of `.supcoflow/guide.md`:
163
155
 
164
- ## Con un asistente
156
+ ```markdown
157
+ # My App guide ← optional; ignored
158
+
159
+ ## Invoices ← one section per screen or function (1 to 60). Name: 1–120 characters
160
+ What it's for: See and pay the month's invoices. ← required, 1–600
161
+ What users can do: Download the PDF, pay by card and see the ← required, 1–600; it can continue
162
+ history. on the lines below
163
+ Common problems: ← optional; up to 10, each 1–300
164
+ - The Pay button does nothing with debit cards.
165
+ - The PDF comes out blank in Safari.
166
+ Where: /invoices ← optional; the page's path, starts with /
167
+ ```
165
168
 
166
- Si usás un asistente de código como Claude Code, la skill de Supcoflow hace todo el camino
167
- por vos: sesión, proyecto, configuración, guía, el chat en la app y el resumen.
169
+ - Labels are recognized at the start of the line, ignoring case. The Spanish labels of 0.7.0 (`Para qué sirve:`,
170
+ `Qué puede hacer el usuario:`, `Problemas comunes:`) are still accepted. A line that isn't a label continues the
171
+ previous field (joined with a space).
172
+ - Text before the first `## ` that isn't the `# ` title → error. A repeated label in a section → error. A line with
173
+ `<` or `>` → error. More than 64 KB → `guia_muy_grande`.
174
+
175
+ ## Put the chat in the app
176
+
177
+ `supcoflow widget` shows what to paste, built by the engine with your project's ids (don't copy them by hand: a
178
+ wrongly copied id leaves the chat invisible without any error). It writes no files of the app:
179
+
180
+ 1. The package with its exact version (`npm i @supcoflow/chat@… --save-exact`, or the same with your package manager).
181
+ 2. **Next.js (App Router):** a wrapper file at the path the engine suggests (`nextjs.archivo_sugerido`, today
182
+ `app/_supcoflow/support-chat.tsx`; if the app uses `src/app`, inside `src/app`), with the content as is. If the
183
+ chat is already installed under an earlier name (`nextjs.archivos_anteriores`, for example
184
+ `app/_supcoflow/chat-de-soporte.tsx`), update that file in place instead of creating a second one. The wrapper is
185
+ needed because the chat component uses React hooks and doesn't ship `"use client"`, and a `layout.tsx` is a server
186
+ component by default: importing it directly there doesn't work.
187
+ 3. Use the wrapper in the layout that covers the screens where your users get stuck.
188
+ 4. If the app has a Content Security Policy (CSP) with `connect-src`, add the chat's origin to it, keeping what it
189
+ already has (a second `connect-src` is ignored).
190
+
191
+ The `<script>` line it also shows is available but not tested in a real app, and is not for Next.js.
192
+ `supcoflow widget --json` returns the engine's object as is.
193
+
194
+ Then, `supcoflow install record --skill <version> [--app <folder>] [--file <path>]` leaves in
195
+ `.supcoflow/instalacion.json` (to commit) which versions it ended up with: the skill, the terminal, the chat declared
196
+ and installed, the project configuration and, with `--file`, the file the chat lives in (a path relative to the repo
197
+ root, with no `..`, and not a symlink). The file is version 2; a version 1 file (from 0.7.0) is read without error as
198
+ «no file recorded». Running it again without `--file` keeps the file already recorded. It never contains a secret or
199
+ a date; repeating it without changes doesn't touch it, and if the file has uncommitted changes it exits 4 and doesn't
200
+ overwrite it.
201
+
202
+ ## Test the installation
203
+
204
+ With the chat in place, two commands say whether a problem that comes in through the chat reaches an issue. Both take
205
+ the repo from the `origin`, or `--repo owner/repo`.
206
+
207
+ | Command | What it does |
208
+ |---|---|
209
+ | `supcoflow diagnose` | Free and writes nothing. It prints «Checked sign-in, repo, GitHub App, allowed sites, chat and guide: N of 6, at no cost.» and, apart, «Ready for a test: yes / no, because …» with the policy, the month's balance and open tests. Exits 0 if everything is ready, 4 if something needs fixing (with each point). `--json` gives `instalacion: { ok, total: 6, puntos }` and `prueba: { listo, puntos }`. |
210
+ | `supcoflow test` | Without `--authorize-spend` it sends nothing: it exits 4 with the test's ceiling, the balance, the cap and what is committed this month, and the exact command to launch it. It also says, before you authorize anything, whether this machine can save the test request (`maquina: { ok, impedimentos }`) and any request still waiting for confirmation (`intento_pendiente: { techo_usd, politica }`). |
211
+ | `supcoflow test --authorize-spend --ceiling 2 --expect-policy investigate` | Requests the test: the problem comes in through the same door as the chat and runs an investigation that **spends** up to the ceiling you authorize (with the `save` policy it goes as far as the saved case and doesn't spend). Exits 5 with the id. `--message "…"` uses your own text. |
212
+ | `supcoflow test --wait` | Follows the last test up to 90 s: 5 while it runs (call it again), 0 with the issue, 4 if it needs a look in the console (it brings the link). The charge is shown as it is: `pendiente` right at the close, never 0. `--test-id prb_…` follows another one. |
213
+ | `supcoflow test --dry-run --authorize-spend --ceiling 2 --expect-policy investigate` | What it would do (project, ceiling, balance, policy), without requesting anything. |
214
+
215
+ `--ceiling` is the number you were shown and `--expect-policy` the policy you were offered: both travel in the request
216
+ and the terminal doesn't re-read anything to choose them. If the ceiling or the policy changed in the meantime, it
217
+ exits 4 `techo_distinto` / `politica_distinta` with the new values and doesn't retry: ask again. The old
218
+ `probar --autorizo-gasto` alias also needs `--ceiling` now (an alias can't widen what you authorized); if you need the
219
+ old behavior, use supcoflow 0.7.0.
220
+
221
+ If the engine's answer doesn't arrive, the request stays saved on this machine (outside the repo, next to the
222
+ credentials): repeating the same `supcoflow test --authorize-spend …` picks up **the same** test instead of
223
+ requesting another. While a request is unconfirmed, another `--message`, `--ceiling` or `--expect-policy` exits 4
224
+ `intento_pendiente`. The test goes with the personal key of `supcoflow login`; a read-only key can't request it. One
225
+ open test per project: another one exits 4 `prueba_en_curso` with the id of the open one. A test's issue stays open and
226
+ is marked as a test.
227
+
228
+ **If your home folder is a git repo.** The request is saved in `~/.config/supcoflow/pruebas.json` (it carries the
229
+ ceiling, the policy and, if you passed one, your `--message`). That is allowed inside a repo only when git itself says
230
+ it ignores the file and doesn't track it: the first time, the terminal creates a `.gitignore` containing `*` in that
231
+ folder (only if there isn't one; it never edits yours), and then asks git (`git check-ignore`) about the file and its
232
+ `.tmp`, for every repo that contains the written or the real path. A file that is already tracked or added to the index
233
+ is refused with the exact `git rm --cached …` to run (the terminal never runs it or deletes anything of yours), and so
234
+ is a missing or failing git. The same goes for every write or delete of `idempotencia.json`. `diagnose` and `test`
235
+ check all this (and permissions, broken links and unreadable files) **before** you authorize, without writing
236
+ anything: «no obstacle found» is a check, not a promise that the disk won't fill up later. The credentials don't use
237
+ this exception: inside a repo they are still refused.
238
+
239
+ ## With an assistant
240
+
241
+ If you use a code assistant such as Claude Code, the Supcoflow skill does the whole path for you: session, project,
242
+ configuration, guide, the chat in the app and the summary.
168
243
 
169
244
  ```bash
170
245
  npx skills add supcoflow/skills
171
246
  ```
172
247
 
173
- Y en el asistente: `/supcoflow go`. Las decisiones sobre los datos de tus usuarios y qué pasa con cada
174
- problema te las pregunta siempre; no sube nada a GitHub.
248
+ And in the assistant: `/supcoflow go`. It always asks you about your users' data and what happens with each problem;
249
+ it doesn't push anything to GitHub.
175
250
 
176
- ## El contrato
251
+ ## The contract
177
252
 
178
- Pensado para que lo lea un programa, no sólo una persona:
253
+ Made to be read by a program, not only by a person:
179
254
 
180
- - **`--json`**: el resultado sale por stdout en **una línea** de JSON; los avisos van por stderr.
181
- Los errores también: `{"ok":false,"error":"…","message":"…"}`, con su código de salida.
182
- - **Sin preguntas sin terminal interactiva** (o con `--json`): si falta un dato, sale 3 diciendo qué
183
- flag usar. `supcoflow login` sin terminal sale 3 y te indica el camino en dos pasos.
184
- - **`--dry-run`** donde se puede simular (`login`, `login --start`, `logout`, `repo conectar --start`,
185
- `proyecto crear`, `guia revisar`, `guia publicar`, `guia usar`, `instalacion anotar`). `login --wait
186
- --dry-run` sale 3: sondear consume el código y no hay cómo simularlo.
255
+ - **`--json`**: the result goes out on stdout as **one line** of JSON; warnings go to stderr. Errors too:
256
+ `{"ok":false,"error":"…","message":"…"}`, with their exit code. The `error` codes are stable identifiers (some are in
257
+ Spanish, like `falta_guia`); the `message` of the engine's answers is printed as it arrives.
258
+ - **No questions without an interactive terminal** (or with `--json`): if something is missing, it exits 3 saying which
259
+ flag to use. `supcoflow login` without a terminal exits 3 and points you to the two-step path.
260
+ - **`--dry-run`** wherever it can be simulated (`login`, `login --start`, `logout`, `repo connect --start`,
261
+ `project create`, `guide check`, `guide publish`, `guide use`, `install record`, `test`). `login --wait --dry-run`
262
+ exits 3: polling consumes the code and there is no way to simulate it.
187
263
 
188
- | Código | Quiere decir |
264
+ | Code | It means |
189
265
  |---|---|
190
266
  | 0 | ok |
191
- | 1 | inesperado |
192
- | 2 | falta login |
193
- | 3 | entrada inválida |
194
- | 4 | hace falta una persona |
195
- | 5 | esperando a una persona: volvé a llamar |
196
- | 6 | tope alcanzado |
197
-
198
- ## Dónde queda la clave
199
-
200
- - En el **llavero del sistema** (Keychain en macOS, Secret Service con `secret-tool` en Linux).
201
- - Si no hay llavero, en `~/.config/supcoflow/credenciales.json` (o `$XDG_CONFIG_HOME/supcoflow/…`)
202
- con permisos `0600`, y la terminal te avisa.
203
- - **Nunca dentro de un repo de git**: si ese archivo cayera dentro de uno (un `HOME` que es un repo
204
- de dotfiles, por ejemplo), no guarda nada y te pide usar el llavero o `SUPCOFLOW_TOKEN`.
205
- - **`SUPCOFLOW_TOKEN`** tiene prioridad sobre lo guardado: sirve para CI y para la nube.
206
- - La clave nunca sale en un log ni en una salida `--json`.
207
- - `proyecto crear` guarda su clave de idempotencia (no es un secreto: sólo evita crear dos veces si se
208
- pierde la respuesta) en `idempotencia.json`, al lado de las credenciales y con los mismos permisos.
209
-
210
- Cuando iniciás sesión de nuevo, la clave anterior se revoca recién cuando la nueva quedó guardada; si
211
- no se pudo revocar, queda anotada y se reintenta en el próximo `login` o `logout`.
212
-
213
- ## La API es fija
214
-
215
- La terminal habla siempre con `https://app.supcoflow.dev`. Ningún archivo del repo puede cambiar
216
- eso, así que clonar un repo ajeno y correr `supcoflow` no manda tu clave a otro servidor. Para
217
- desarrollo, sólo la variable de entorno `SUPCOFLOW_API_URL` la mueve (`https`, o `http` contra
218
- `localhost`), y lo guardado queda atado a la API que lo emitió: una clave de un motor local nunca
219
- viaja a producción.
267
+ | 1 | unexpected |
268
+ | 2 | login needed |
269
+ | 3 | invalid input |
270
+ | 4 | a person is needed |
271
+ | 5 | waiting for a person: call again |
272
+ | 6 | limit reached |
273
+
274
+ ## Where the key is kept
275
+
276
+ - In the **system keychain** (Keychain on macOS, Secret Service with `secret-tool` on Linux).
277
+ - If there is no keychain, in `~/.config/supcoflow/credenciales.json` (or `$XDG_CONFIG_HOME/supcoflow/…`) with `0600`
278
+ permissions, and the terminal warns you.
279
+ - **Never inside a git repo**: if that file would land inside one (a `HOME` that is a dotfiles repo, for example), it
280
+ saves nothing and asks you to use the keychain or `SUPCOFLOW_TOKEN`. (The test request and the idempotency key are
281
+ the only things with an exception: see «Test the installation».)
282
+ - **`SUPCOFLOW_TOKEN`** takes priority over what is saved: it is for CI and the cloud.
283
+ - The key never appears in a log or in a `--json` output.
284
+ - `project create` keeps its idempotency key (it isn't a secret: it only avoids creating twice if the answer is lost)
285
+ in `idempotencia.json`, next to the credentials and with the same permissions. Inside a repo it is saved only if git
286
+ ignores it and doesn't track it; otherwise the terminal says so and goes on without saving it.
287
+
288
+ When you sign in again, the previous key is revoked only after the new one is saved; if it couldn't be revoked, it is
289
+ noted down and retried on the next `login` or `logout`.
290
+
291
+ ## The API is fixed
292
+
293
+ The terminal always talks to `https://app.supcoflow.dev`. No file in the repo can change that, so cloning someone
294
+ else's repo and running `supcoflow` doesn't send your key to another server. For development, only the
295
+ `SUPCOFLOW_API_URL` environment variable moves it (`https`, or `http` against `localhost`), and what is saved stays
296
+ tied to the API that issued it: a key from a local engine never travels to production.
package/dist/alias.js ADDED
@@ -0,0 +1,60 @@
1
+ // Los nombres que la terminal tenía hasta la 0.7.0 (castellano). Siguen funcionando como alias, pero no salen en
2
+ // `describe` ni en la ayuda: el nombre canónico es el inglés. Todo el castellano de nombres vive acá, en un
3
+ // solo archivo, para que la alarma de textos (`test/textos-en-ingles.test.ts`) pueda dejarlo afuera.
4
+ // El comando viejo (completo, de una o dos palabras) → el canónico.
5
+ export const COMANDOS_VIEJOS = {
6
+ "quien-soy": "whoami",
7
+ describir: "describe",
8
+ "repo conectar": "repo connect",
9
+ "proyecto crear": "project create",
10
+ "proyecto ver": "project show",
11
+ catalogo: "catalog",
12
+ configuracion: "config",
13
+ "chat prender": "chat on",
14
+ "chat apagar": "chat off",
15
+ "chat marca": "chat brand",
16
+ "sitios agregar": "sites add",
17
+ "sitios quitar": "sites remove",
18
+ "datos fijar": "data set",
19
+ "politica fijar": "policy set",
20
+ "claves crear": "keys create",
21
+ "claves listar": "keys list",
22
+ "claves revocar": "keys revoke",
23
+ "guia revisar": "guide check",
24
+ "guia publicar": "guide publish",
25
+ "guia ver": "guide show",
26
+ "guia usar": "guide use",
27
+ "instalacion anotar": "install record",
28
+ diagnosticar: "diagnose",
29
+ probar: "test",
30
+ };
31
+ // El flag viejo (sin los guiones) → el canónico.
32
+ export const FLAGS_VIEJOS = {
33
+ "autorizo-gasto": "authorize-spend",
34
+ "desde-github": "from-github",
35
+ permitir: "allow",
36
+ modo: "mode",
37
+ mensaje: "message",
38
+ prueba: "test-id",
39
+ sitio: "site",
40
+ titulo: "title",
41
+ saludo: "greeting",
42
+ tema: "theme",
43
+ archivo: "file",
44
+ nombre: "name",
45
+ "guardar-en": "save-to",
46
+ origen: "source",
47
+ };
48
+ // Los valores viejos de los flags con valores fijos → el canónico. A la API siempre viaja el valor de la API
49
+ // (`relevar`, `guardar`, `agente`, `nada`…): cada comando traduce el que recibe.
50
+ export const POLITICA_VIEJA = { relevar: "investigate", guardar: "save" };
51
+ export const ORIGEN_VIEJO = { repo: "repo", agente: "agent" };
52
+ export const PERMITIDOS_VIEJOS = {
53
+ usuario_id: "user_id",
54
+ usuario_rol: "user_role",
55
+ pagina_y_navegador: "page_and_browser",
56
+ capturas: "screenshots",
57
+ elementos: "elements",
58
+ nada: "nothing",
59
+ };
60
+ export const PREFIJO_VIEJO_DE_ATRIBUTO = "atributo:";