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 +253 -176
- package/dist/alias.js +60 -0
- package/dist/api.js +41 -19
- package/dist/argumentos.js +92 -85
- package/dist/cli.js +40 -35
- package/dist/comandos/clave-vigente.js +2 -2
- package/dist/comandos/claves.js +25 -25
- package/dist/comandos/configurar.js +40 -40
- package/dist/comandos/contexto.js +102 -0
- package/dist/comandos/datos-y-politica.js +35 -23
- package/dist/comandos/describir.js +162 -152
- package/dist/comandos/guia.js +150 -62
- package/dist/comandos/instalacion.js +73 -41
- package/dist/comandos/login.js +25 -24
- package/dist/comandos/logout.js +17 -16
- package/dist/comandos/probar.js +177 -64
- package/dist/comandos/proyecto-del-repo.js +12 -2
- package/dist/comandos/proyecto.js +48 -34
- package/dist/comandos/quien-soy.js +8 -7
- package/dist/comandos/repo-conectar.js +9 -9
- package/dist/comandos/widget.js +9 -5
- package/dist/diagnostico.js +51 -0
- package/dist/entorno.js +57 -26
- package/dist/flags-por-comando.js +25 -21
- package/dist/guardado/archivo.js +2 -2
- package/dist/guardado/index.js +12 -8
- package/dist/guardado/llavero.js +5 -5
- package/dist/guardado/lugar.js +63 -0
- package/dist/guardado/protegido.js +38 -0
- package/dist/guardado/repo.js +98 -0
- package/dist/guia.js +3 -1
- package/dist/idempotencia.js +16 -28
- package/dist/instalacion.js +50 -11
- package/dist/lectura.js +10 -0
- package/dist/pruebas-guardadas.js +40 -22
- package/dist/repo-local.js +95 -13
- package/dist/secreto-a-archivo.js +6 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,219 +1,296 @@
|
|
|
1
1
|
# supcoflow
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
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
|
-
|
|
7
|
-
|
|
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
|
-
##
|
|
9
|
+
## Install
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
Node 24 or newer is required.
|
|
12
12
|
|
|
13
13
|
```bash
|
|
14
14
|
npx supcoflow login
|
|
15
15
|
```
|
|
16
16
|
|
|
17
|
-
##
|
|
17
|
+
## The commands
|
|
18
18
|
|
|
19
|
-
|
|
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` |
|
|
22
|
-
| `supcoflow login --start` |
|
|
23
|
-
| `supcoflow login --wait` |
|
|
24
|
-
| `supcoflow logout` |
|
|
25
|
-
| `supcoflow
|
|
26
|
-
| `supcoflow repo
|
|
27
|
-
| `supcoflow
|
|
28
|
-
| `supcoflow
|
|
29
|
-
| `supcoflow
|
|
30
|
-
| `supcoflow
|
|
31
|
-
| `supcoflow
|
|
32
|
-
| `supcoflow
|
|
33
|
-
| `supcoflow
|
|
34
|
-
| `supcoflow
|
|
35
|
-
| `supcoflow
|
|
36
|
-
|
|
37
|
-
`supcoflow
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
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
|
-
|
|
51
|
-
|
|
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
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
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
|
-
|
|
64
|
-
supcoflow logout --dry-run # qué revocaría, sin revocar nada
|
|
65
|
-
```
|
|
65
|
+
### Is this repo the one for this account?
|
|
66
66
|
|
|
67
|
-
|
|
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
|
-
|
|
70
|
-
|
|
71
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
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
|
-
|
|
89
|
+
### Examples
|
|
123
90
|
|
|
124
|
-
|
|
125
|
-
|
|
91
|
+
```bash
|
|
92
|
+
# A person at the terminal
|
|
93
|
+
supcoflow login
|
|
126
94
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
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
|
-
|
|
138
|
-
|
|
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
|
-
|
|
141
|
-
|
|
142
|
-
|
|
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
|
-
##
|
|
109
|
+
## Configure
|
|
146
110
|
|
|
147
|
-
|
|
148
|
-
|
|
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
|
-
|
|
|
115
|
+
| Command | What it does |
|
|
151
116
|
|---|---|
|
|
152
|
-
| `supcoflow
|
|
153
|
-
| `supcoflow
|
|
154
|
-
| `supcoflow
|
|
155
|
-
| `supcoflow
|
|
156
|
-
| `supcoflow
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
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
|
-
|
|
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
|
-
|
|
167
|
-
|
|
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
|
-
|
|
174
|
-
|
|
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
|
-
##
|
|
251
|
+
## The contract
|
|
177
252
|
|
|
178
|
-
|
|
253
|
+
Made to be read by a program, not only by a person:
|
|
179
254
|
|
|
180
|
-
- **`--json`**:
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
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
|
-
|
|
|
264
|
+
| Code | It means |
|
|
189
265
|
|---|---|
|
|
190
266
|
| 0 | ok |
|
|
191
|
-
| 1 |
|
|
192
|
-
| 2 |
|
|
193
|
-
| 3 |
|
|
194
|
-
| 4 |
|
|
195
|
-
| 5 |
|
|
196
|
-
| 6 |
|
|
197
|
-
|
|
198
|
-
##
|
|
199
|
-
|
|
200
|
-
-
|
|
201
|
-
-
|
|
202
|
-
|
|
203
|
-
- **
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
-
|
|
207
|
-
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
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:";
|