command-cmd 1.0.1 → 1.0.4
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/cmd.js +1646 -13
- package/doc.md +285 -0
- package/docPTBR.md +290 -0
- package/map.md +238 -0
- package/mapPTBR.md +238 -0
- package/package.json +5 -2
package/doc.md
ADDED
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
# command-cmd (English Documentation)
|
|
2
|
+
|
|
3
|
+
`command-cmd` parses AI text commands and runs cursor automation through `robotjs`.
|
|
4
|
+
|
|
5
|
+
Exported functions:
|
|
6
|
+
|
|
7
|
+
- `cmd`
|
|
8
|
+
- `extractFirstCommand`
|
|
9
|
+
- `cursor`
|
|
10
|
+
|
|
11
|
+
## Installation
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install command-cmd
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Import
|
|
18
|
+
|
|
19
|
+
```js
|
|
20
|
+
import { cmd, extractFirstCommand, cursor } from 'command-cmd';
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## 1) `cmd(message)`
|
|
24
|
+
|
|
25
|
+
Extracts command blocks from text.
|
|
26
|
+
|
|
27
|
+
Accepted format:
|
|
28
|
+
|
|
29
|
+
```txt
|
|
30
|
+
[type: open_app, command: tiktok, button: search_bar, seq: 1]
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
For sequential movement:
|
|
34
|
+
|
|
35
|
+
```txt
|
|
36
|
+
[move_sequence, points: 120x220|420x260|800x300, interval: 300, click: between, doubleClick: true]
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Short format is also supported:
|
|
40
|
+
|
|
41
|
+
```txt
|
|
42
|
+
[open_app, command: tiktok, button: skip_ads]
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Returned object:
|
|
46
|
+
|
|
47
|
+
```js
|
|
48
|
+
{
|
|
49
|
+
type: 'open_app',
|
|
50
|
+
command: 'tiktok',
|
|
51
|
+
extra: undefined,
|
|
52
|
+
button: 'skip_ads',
|
|
53
|
+
seq: 1
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## 2) `extractFirstCommand(message)`
|
|
58
|
+
|
|
59
|
+
Returns only the first valid command.
|
|
60
|
+
|
|
61
|
+
Output:
|
|
62
|
+
|
|
63
|
+
```js
|
|
64
|
+
{ type, command, extra, button, points, path, interval, clickDelay, click, doubleClick, seq } | null
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## 3) `cursor(input, options?)`
|
|
68
|
+
|
|
69
|
+
Runs mouse/keyboard actions.
|
|
70
|
+
|
|
71
|
+
`input` can be:
|
|
72
|
+
|
|
73
|
+
- string (internally parsed with `cmd`)
|
|
74
|
+
- one command object
|
|
75
|
+
- array of command objects
|
|
76
|
+
|
|
77
|
+
Accepted object keys:
|
|
78
|
+
|
|
79
|
+
- `type` or `tipo`
|
|
80
|
+
- `command` or `comando`
|
|
81
|
+
- `button` or `botao`
|
|
82
|
+
- `points` or `pontos` (coordinate sequence)
|
|
83
|
+
- `path` or `caminho` or `trajeto` (alias of `points`)
|
|
84
|
+
- `interval` or `intervalo` (ms between points)
|
|
85
|
+
- `clickDelay` or `delayClique` (ms between arriving and click)
|
|
86
|
+
- `click` or `clique` (`none`, `between`, `each`, `first`, `last`)
|
|
87
|
+
- `doubleClick` or `duplo` (true/false)
|
|
88
|
+
- `seq` or `sequencia`
|
|
89
|
+
- `extra`
|
|
90
|
+
|
|
91
|
+
### App and button names (important)
|
|
92
|
+
|
|
93
|
+
You can name apps and buttons however you want.
|
|
94
|
+
|
|
95
|
+
The library uses the name only to resolve keys in `map.json`, with normalization:
|
|
96
|
+
|
|
97
|
+
- case-insensitive;
|
|
98
|
+
- spaces/hyphens converted to `_`;
|
|
99
|
+
- accents removed.
|
|
100
|
+
|
|
101
|
+
Examples that resolve to the same logical key:
|
|
102
|
+
|
|
103
|
+
- `Skip ADS`
|
|
104
|
+
- `skip-ads`
|
|
105
|
+
- `skip_ads`
|
|
106
|
+
|
|
107
|
+
Same idea for app names:
|
|
108
|
+
|
|
109
|
+
- `Tik Tok`
|
|
110
|
+
- `tik-tok`
|
|
111
|
+
- `tik_tok`
|
|
112
|
+
|
|
113
|
+
Example:
|
|
114
|
+
|
|
115
|
+
```js
|
|
116
|
+
const commands = [
|
|
117
|
+
{ type: 'open_app', command: 'youtube', button: 'search_bar', seq: 1 },
|
|
118
|
+
{ type: 'open_app', command: 'youtube', button: 'skip_ads', seq: 1 }
|
|
119
|
+
];
|
|
120
|
+
|
|
121
|
+
const runSummary = await cursor(commands);
|
|
122
|
+
console.log(runSummary);
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## App state flow (open/closed)
|
|
126
|
+
|
|
127
|
+
For app commands (`open_app`, `close_app`), the library uses `map.json`:
|
|
128
|
+
|
|
129
|
+
1. Reads app state (`open` or `closed` / `aberto` or `fechado`).
|
|
130
|
+
2. If already open, it does not open the app again.
|
|
131
|
+
3. Executes mapped button click.
|
|
132
|
+
4. If that button has `setState`, it updates app state in `map.json`.
|
|
133
|
+
|
|
134
|
+
### Automatic `map.json` creation
|
|
135
|
+
|
|
136
|
+
If `map.json` does not exist, the library creates it automatically in the project root (cwd) by default.
|
|
137
|
+
|
|
138
|
+
The generated file includes:
|
|
139
|
+
|
|
140
|
+
- `state` for each app;
|
|
141
|
+
- `buttons` for each app;
|
|
142
|
+
- a default `fechar/close` button for each app (`setState: "fechado"`).
|
|
143
|
+
|
|
144
|
+
This supports flows such as:
|
|
145
|
+
|
|
146
|
+
- "click TikTok search bar"
|
|
147
|
+
- "click YouTube skip ad button"
|
|
148
|
+
|
|
149
|
+
AI output example:
|
|
150
|
+
|
|
151
|
+
```txt
|
|
152
|
+
[open_app, command: tiktok, button: search_bar]
|
|
153
|
+
[open_app, command: youtube, button: skip_ads]
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
## Supported `type` values
|
|
157
|
+
|
|
158
|
+
- `open_app` / `abrir_app`
|
|
159
|
+
- `close_app` / `fechar_app`
|
|
160
|
+
- `click` / `clicar`
|
|
161
|
+
- `double_click` / `clique_duplo`
|
|
162
|
+
- `scroll` / `rolar`
|
|
163
|
+
- `move_sequence` / `mover_sequencia`
|
|
164
|
+
- `skip_ads` / `pular_ads`
|
|
165
|
+
|
|
166
|
+
## Sequential movement (new)
|
|
167
|
+
|
|
168
|
+
Use `move_sequence` to move mouse through 2+ points in order.
|
|
169
|
+
|
|
170
|
+
### Coordinate format
|
|
171
|
+
|
|
172
|
+
Use `points` as:
|
|
173
|
+
|
|
174
|
+
```txt
|
|
175
|
+
100x200|300x260|640x420
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
`:` is also accepted:
|
|
179
|
+
|
|
180
|
+
```txt
|
|
181
|
+
100:200|300:260|640:420
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
### Click behavior between points
|
|
185
|
+
|
|
186
|
+
`click` field:
|
|
187
|
+
|
|
188
|
+
- `none`: no click
|
|
189
|
+
- `between`: click every point except the last
|
|
190
|
+
- `each`: click every point
|
|
191
|
+
- `first`: click only the first point
|
|
192
|
+
- `last`: click only the last point
|
|
193
|
+
|
|
194
|
+
`doubleClick` field:
|
|
195
|
+
|
|
196
|
+
- `true`: use double click when click is triggered
|
|
197
|
+
- `false`: single click
|
|
198
|
+
|
|
199
|
+
`clickDelay` field:
|
|
200
|
+
|
|
201
|
+
- delay (ms) between arriving at a point and clicking that point
|
|
202
|
+
|
|
203
|
+
### AI text example
|
|
204
|
+
|
|
205
|
+
```txt
|
|
206
|
+
[move_sequence, points: 140x260|520x280|980x300, interval: 250, click: between, doubleClick: true]
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
With `clickDelay`:
|
|
210
|
+
|
|
211
|
+
```txt
|
|
212
|
+
[move_sequence, path: 140x260|520x280|980x300, interval: 250, clickDelay: 120, click: between, doubleClick: true]
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
### JS object example (recommended for devs)
|
|
216
|
+
|
|
217
|
+
```js
|
|
218
|
+
await cursor({
|
|
219
|
+
type: 'move_sequence',
|
|
220
|
+
points: [
|
|
221
|
+
{ x: 140, y: 260 },
|
|
222
|
+
{ x: 520, y: 280 },
|
|
223
|
+
{ x: 980, y: 300 }
|
|
224
|
+
],
|
|
225
|
+
interval: 250,
|
|
226
|
+
clickDelay: 120,
|
|
227
|
+
click: 'between',
|
|
228
|
+
doubleClick: true
|
|
229
|
+
});
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
## `cursor` options
|
|
233
|
+
|
|
234
|
+
```js
|
|
235
|
+
{
|
|
236
|
+
mapPath: 'map.json',
|
|
237
|
+
createMapIfMissing: true,
|
|
238
|
+
persistMap: true,
|
|
239
|
+
launchKey: 'command', // set false to disable launcher key tap
|
|
240
|
+
moveSteps: 50,
|
|
241
|
+
moveDelay: 8,
|
|
242
|
+
scrollSteps: 10,
|
|
243
|
+
scrollDelay: 20,
|
|
244
|
+
typeDelay: 50,
|
|
245
|
+
sequenceInterval: 250,
|
|
246
|
+
sequenceClick: 'none',
|
|
247
|
+
sequenceDoubleClick: false,
|
|
248
|
+
defaultClosePoint: { x: 1888, y: 16 }
|
|
249
|
+
}
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
## Dedicated mapper docs
|
|
253
|
+
|
|
254
|
+
Dedicated docs for creating and calibrating `map.json`:
|
|
255
|
+
|
|
256
|
+
- `mapPTBR.md` (PT-BR)
|
|
257
|
+
- `map.md` (English)
|
|
258
|
+
|
|
259
|
+
They explain:
|
|
260
|
+
|
|
261
|
+
- app mapping and coordinates;
|
|
262
|
+
- per-app button mapping;
|
|
263
|
+
- state management with `setState`.
|
|
264
|
+
|
|
265
|
+
## Recommended system prompt (AI -> command)
|
|
266
|
+
|
|
267
|
+
```txt
|
|
268
|
+
You are a technical assistant.
|
|
269
|
+
When you suggest executable actions, output only blocks:
|
|
270
|
+
[type: <type>, command: <app_or_value>, points: <optional_points>, button: <optional_button>, interval: <optional_ms>, clickDelay: <optional_ms_before_click>, click: <optional_mode>, doubleClick: <optional_boolean>, extra: <optional_text>, seq: <optional_integer>]
|
|
271
|
+
|
|
272
|
+
Rules:
|
|
273
|
+
1. Always use square brackets.
|
|
274
|
+
2. One command per block.
|
|
275
|
+
3. seq must be an integer >= 0.
|
|
276
|
+
4. For app interaction, use type open_app and command with app name.
|
|
277
|
+
5. For UI clicks, fill button using a key that exists in map.json.
|
|
278
|
+
6. For sequential movement, use type move_sequence and points in `xXy|xXy|xXy` format.
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
## Important notes
|
|
282
|
+
|
|
283
|
+
- `cursor` requires a desktop environment where `robotjs` works.
|
|
284
|
+
- If `map.json` does not exist and `createMapIfMissing` is `false`, app commands fail.
|
|
285
|
+
- Avoid commas inside `[ ... ]` values because parser splitting uses commas.
|
package/docPTBR.md
ADDED
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
# command-cmd (Documentacao PT-BR)
|
|
2
|
+
|
|
3
|
+
`command-cmd` extrai comandos de texto de IA e executa automacoes com cursor via `robotjs`.
|
|
4
|
+
|
|
5
|
+
Funcoes exportadas:
|
|
6
|
+
|
|
7
|
+
- `cmd`
|
|
8
|
+
- `extractFirstCommand`
|
|
9
|
+
- `cursor`
|
|
10
|
+
|
|
11
|
+
## Instalacao
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install command-cmd
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Importacao (com nomes em PT-BR)
|
|
18
|
+
|
|
19
|
+
```js
|
|
20
|
+
import {
|
|
21
|
+
cmd as extrairComandos,
|
|
22
|
+
extractFirstCommand as extrairPrimeiroComando,
|
|
23
|
+
cursor as executarCursor
|
|
24
|
+
} from 'command-cmd';
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## 1) `cmd(message)`
|
|
28
|
+
|
|
29
|
+
Extrai blocos de comando de um texto.
|
|
30
|
+
|
|
31
|
+
Formato aceito:
|
|
32
|
+
|
|
33
|
+
```txt
|
|
34
|
+
[tipo: abrir_app, comando: tiktok, botao: barra_pesquisa, seq: 1]
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Para movimento sequencial:
|
|
38
|
+
|
|
39
|
+
```txt
|
|
40
|
+
[mover_sequencia, points: 120x220|420x260|800x300, interval: 300, click: between, doubleClick: true]
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Tambem aceita o formato curto que voce pediu:
|
|
44
|
+
|
|
45
|
+
```txt
|
|
46
|
+
[abrir_app, comando: tiktok, botao: pularADS]
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Objeto retornado:
|
|
50
|
+
|
|
51
|
+
```js
|
|
52
|
+
{
|
|
53
|
+
type: 'abrir_app',
|
|
54
|
+
command: 'tiktok',
|
|
55
|
+
extra: undefined,
|
|
56
|
+
button: 'pularADS',
|
|
57
|
+
seq: 1
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## 2) `extractFirstCommand(message)`
|
|
62
|
+
|
|
63
|
+
Retorna apenas o primeiro comando valido.
|
|
64
|
+
|
|
65
|
+
Saida:
|
|
66
|
+
|
|
67
|
+
```js
|
|
68
|
+
{ type, command, extra, button, points, path, interval, clickDelay, click, doubleClick, seq } | null
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## 3) `cursor(input, options?)`
|
|
72
|
+
|
|
73
|
+
Executa os comandos com mouse/teclado.
|
|
74
|
+
|
|
75
|
+
`input` pode ser:
|
|
76
|
+
|
|
77
|
+
- `string` (a funcao chama `cmd` internamente)
|
|
78
|
+
- objeto unico
|
|
79
|
+
- lista de objetos
|
|
80
|
+
|
|
81
|
+
Campos aceitos no objeto:
|
|
82
|
+
|
|
83
|
+
- `type` ou `tipo`
|
|
84
|
+
- `command` ou `comando`
|
|
85
|
+
- `button` ou `botao`
|
|
86
|
+
- `points` ou `pontos` (sequencia de coordenadas)
|
|
87
|
+
- `path` ou `caminho` ou `trajeto` (alias de `points`)
|
|
88
|
+
- `interval` ou `intervalo` (ms entre pontos)
|
|
89
|
+
- `clickDelay` ou `delayClique` (ms entre chegada no ponto e clique)
|
|
90
|
+
- `click` ou `clique` (`none`, `between`, `each`, `first`, `last`)
|
|
91
|
+
- `doubleClick` ou `duplo` (true/false)
|
|
92
|
+
- `seq` ou `sequencia`
|
|
93
|
+
- `extra`
|
|
94
|
+
|
|
95
|
+
### Nome dos apps e botoes (importante)
|
|
96
|
+
|
|
97
|
+
Voce pode chamar apps e botoes como quiser.
|
|
98
|
+
|
|
99
|
+
A lib usa o nome apenas para buscar no `map.json`, aplicando normalizacao:
|
|
100
|
+
|
|
101
|
+
- ignora maiusculas/minusculas;
|
|
102
|
+
- converte espaco/hifen para `_`;
|
|
103
|
+
- remove acentos.
|
|
104
|
+
|
|
105
|
+
Exemplos que viram a mesma chave logica:
|
|
106
|
+
|
|
107
|
+
- `Pular ADS`
|
|
108
|
+
- `pular-ads`
|
|
109
|
+
- `pular_ads`
|
|
110
|
+
|
|
111
|
+
O mesmo vale para nome de app:
|
|
112
|
+
|
|
113
|
+
- `Tik Tok`
|
|
114
|
+
- `tik-tok`
|
|
115
|
+
- `tik_tok`
|
|
116
|
+
|
|
117
|
+
Exemplo com objeto em PT-BR:
|
|
118
|
+
|
|
119
|
+
```js
|
|
120
|
+
const listaDeComandos = [
|
|
121
|
+
{ tipo: 'abrir_app', comando: 'youtube', botao: 'barra_pesquisa', seq: 1 },
|
|
122
|
+
{ tipo: 'abrir_app', comando: 'youtube', botao: 'pularADS', seq: 1 }
|
|
123
|
+
];
|
|
124
|
+
|
|
125
|
+
const resumoDeExecucao = await executarCursor(listaDeComandos);
|
|
126
|
+
console.log(resumoDeExecucao);
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
## Estado de app (aberto/fechado)
|
|
130
|
+
|
|
131
|
+
Para comandos de app (`abrir_app`, `close_app`), a lib usa `map.json`:
|
|
132
|
+
|
|
133
|
+
1. Le o estado atual do app (`aberto` ou `fechado`).
|
|
134
|
+
2. Se ja estiver `aberto`, nao tenta abrir de novo.
|
|
135
|
+
3. Executa o clique no botao mapeado.
|
|
136
|
+
4. Se o botao tiver `setState`, atualiza o estado no `map.json`.
|
|
137
|
+
|
|
138
|
+
### Criacao automatica do `map.json`
|
|
139
|
+
|
|
140
|
+
Se o arquivo `map.json` nao existir, a lib cria automaticamente na raiz do projeto (cwd), por padrao.
|
|
141
|
+
|
|
142
|
+
Esse arquivo inicial ja vem com:
|
|
143
|
+
|
|
144
|
+
- `state` em cada app;
|
|
145
|
+
- `buttons` em cada app;
|
|
146
|
+
- botao `fechar` padrao em cada app (`setState: "fechado"`).
|
|
147
|
+
|
|
148
|
+
Isso permite cenarios como:
|
|
149
|
+
|
|
150
|
+
- "clique na barra de pesquisa do TikTok"
|
|
151
|
+
- "clique no botao de pular anuncio do YouTube"
|
|
152
|
+
|
|
153
|
+
A IA pode converter para:
|
|
154
|
+
|
|
155
|
+
```txt
|
|
156
|
+
[abrir_app, comando: tiktok, botao: barra_pesquisa]
|
|
157
|
+
[abrir_app, comando: youtube, botao: pularADS]
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
## Comandos de `type` suportados
|
|
161
|
+
|
|
162
|
+
- `abrir_app` / `open_app`
|
|
163
|
+
- `fechar_app` / `close_app`
|
|
164
|
+
- `click` / `clicar`
|
|
165
|
+
- `double_click` / `clique_duplo`
|
|
166
|
+
- `scroll` / `rolar`
|
|
167
|
+
- `mover_sequencia` / `move_sequence`
|
|
168
|
+
- `skip_ads` / `pular_ads`
|
|
169
|
+
|
|
170
|
+
## Movimento sequencial (novo)
|
|
171
|
+
|
|
172
|
+
Use `mover_sequencia` para mover o mouse por 2 ou mais coordenadas em ordem.
|
|
173
|
+
|
|
174
|
+
### Formato de coordenadas
|
|
175
|
+
|
|
176
|
+
Use `points` no formato:
|
|
177
|
+
|
|
178
|
+
```txt
|
|
179
|
+
100x200|300x260|640x420
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
Tambem funciona com `:`:
|
|
183
|
+
|
|
184
|
+
```txt
|
|
185
|
+
100:200|300:260|640:420
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
### Controle de clique entre pontos
|
|
189
|
+
|
|
190
|
+
Campo `click`:
|
|
191
|
+
|
|
192
|
+
- `none`: sem clique
|
|
193
|
+
- `between`: clica em cada ponto antes do ultimo
|
|
194
|
+
- `each`: clica em todos os pontos
|
|
195
|
+
- `first`: clica so no primeiro ponto
|
|
196
|
+
- `last`: clica so no ultimo ponto
|
|
197
|
+
|
|
198
|
+
Campo `doubleClick`:
|
|
199
|
+
|
|
200
|
+
- `true`: usa clique duplo quando houver clique
|
|
201
|
+
- `false`: clique simples
|
|
202
|
+
|
|
203
|
+
Campo `clickDelay`:
|
|
204
|
+
|
|
205
|
+
- delay (ms) entre chegada no ponto e clique naquele ponto
|
|
206
|
+
|
|
207
|
+
### Exemplo em texto da IA
|
|
208
|
+
|
|
209
|
+
```txt
|
|
210
|
+
[mover_sequencia, points: 140x260|520x280|980x300, interval: 250, click: between, doubleClick: true]
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
Com `clickDelay`:
|
|
214
|
+
|
|
215
|
+
```txt
|
|
216
|
+
[mover_sequencia, caminho: 140x260|520x280|980x300, interval: 250, clickDelay: 120, click: between, doubleClick: true]
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
### Exemplo em objeto JS (mais facil para o dev)
|
|
220
|
+
|
|
221
|
+
```js
|
|
222
|
+
await executarCursor({
|
|
223
|
+
tipo: 'mover_sequencia',
|
|
224
|
+
pontos: [
|
|
225
|
+
{ x: 140, y: 260 },
|
|
226
|
+
{ x: 520, y: 280 },
|
|
227
|
+
{ x: 980, y: 300 }
|
|
228
|
+
],
|
|
229
|
+
intervalo: 250,
|
|
230
|
+
delayClique: 120,
|
|
231
|
+
clique: 'between',
|
|
232
|
+
duplo: true
|
|
233
|
+
});
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
## Opcoes de `cursor`
|
|
237
|
+
|
|
238
|
+
```js
|
|
239
|
+
{
|
|
240
|
+
mapPath: 'map.json', // caminho do mapeador
|
|
241
|
+
createMapIfMissing: true, // padrao: cria map automaticamente se faltar
|
|
242
|
+
persistMap: true, // salva estado no arquivo
|
|
243
|
+
launchKey: 'command', // use false para nao disparar tecla de launcher
|
|
244
|
+
moveSteps: 50,
|
|
245
|
+
moveDelay: 8,
|
|
246
|
+
scrollSteps: 10,
|
|
247
|
+
scrollDelay: 20,
|
|
248
|
+
typeDelay: 50,
|
|
249
|
+
sequenceInterval: 250, // intervalo padrao do mover_sequencia
|
|
250
|
+
sequenceClick: 'none', // none|between|each|first|last
|
|
251
|
+
sequenceDoubleClick: false, // clique duplo por padrao
|
|
252
|
+
defaultClosePoint: { x: 1888, y: 16 } // botao "fechar" padrao
|
|
253
|
+
}
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
## map.json (doc dedicada)
|
|
257
|
+
|
|
258
|
+
Voce pediu uma doc dedicada para o mapeador. Ela esta aqui:
|
|
259
|
+
|
|
260
|
+
- `mapPTBR.md` (PT-BR)
|
|
261
|
+
- `map.md` (English)
|
|
262
|
+
|
|
263
|
+
Esses arquivos explicam:
|
|
264
|
+
|
|
265
|
+
- como montar `apps`, `buttons` e `state`;
|
|
266
|
+
- como mapear coordenadas;
|
|
267
|
+
- como mapear botoes por app;
|
|
268
|
+
- como usar `setState` para atualizar para `fechado`.
|
|
269
|
+
|
|
270
|
+
## System prompt recomendado (IA -> comando)
|
|
271
|
+
|
|
272
|
+
```txt
|
|
273
|
+
Voce e um assistente tecnico.
|
|
274
|
+
Quando sugerir acao executavel, responda apenas com blocos:
|
|
275
|
+
[tipo: <tipo>, comando: <app_ou_valor>, points: <pontos_opcionais>, botao: <botao_opcional>, interval: <ms_opcional>, clickDelay: <ms_ate_click>, click: <modo_opcional>, doubleClick: <boolean_opcional>, extra: <texto_opcional>, seq: <inteiro_opcional>]
|
|
276
|
+
|
|
277
|
+
Regras:
|
|
278
|
+
1. Use sempre colchetes.
|
|
279
|
+
2. Um comando por bloco.
|
|
280
|
+
3. seq deve ser inteiro >= 0.
|
|
281
|
+
4. Para app, use tipo abrir_app e comando com nome do app.
|
|
282
|
+
5. Quando for clique de elemento de UI, preencha botao com a chave do map.json.
|
|
283
|
+
6. Para movimento sequencial, use tipo mover_sequencia e `points` no formato `xXy|xXy|xXy`.
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
## Observacoes importantes
|
|
287
|
+
|
|
288
|
+
- `cursor` precisa de ambiente desktop com `robotjs`.
|
|
289
|
+
- Se `map.json` nao existir e `createMapIfMissing` for `false`, comandos de app retornam erro.
|
|
290
|
+
- Evite virgulas dentro dos valores do bloco `[ ... ]`, porque o parser divide por virgula.
|