@roilab/crm-cli 0.8.3 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +43 -0
- package/SKILL.md +82 -5
- package/SURFACE.txt +20 -0
- package/dist/bin/crm.js +2 -0
- package/dist/bin/crm.js.map +1 -1
- package/dist/src/commands/comment.js +58 -3
- package/dist/src/commands/comment.js.map +1 -1
- package/dist/src/commands/generic.js +211 -0
- package/dist/src/commands/generic.js.map +1 -1
- package/dist/src/commands/marketplace.js +158 -0
- package/dist/src/commands/marketplace.js.map +1 -0
- package/dist/src/commands/rank.js +15 -0
- package/dist/src/commands/rank.js.map +1 -1
- package/dist/src/commands/task.js +163 -4
- package/dist/src/commands/task.js.map +1 -1
- package/package.json +58 -58
package/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,49 @@ Todos los cambios notables se documentan aquí. El formato sigue
|
|
|
8
8
|
|
|
9
9
|
_Ningún cambio pendiente todavía._
|
|
10
10
|
|
|
11
|
+
## [0.9.0] — 2026-06-04
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
|
|
15
|
+
- **`crm marketplace`** — comparador de precios de backlinks multi-proveedor
|
|
16
|
+
(Fase 35): `compare` (precios por dominio ordenados por ahorro), `domain
|
|
17
|
+
<rootDomain>` (precios de un dominio en todos los proveedores), `providers`
|
|
18
|
+
(estado de sync + credenciales), `import` (alta de listados por `--file`/stdin)
|
|
19
|
+
y `scrape` (encola un scraping bajo demanda).
|
|
20
|
+
- **`crm task attach list|add|remove`** — gestión incremental de adjuntos de
|
|
21
|
+
una tarea, sin reemplazar la lista entera.
|
|
22
|
+
- **`crm comment update --id <commentId>`** — edita el contenido de un
|
|
23
|
+
comentario existente (solo autor o owner/admin).
|
|
24
|
+
- **`--body-file <path>`** en `crm comment create` y `crm comment update` — lee
|
|
25
|
+
el cuerpo desde un fichero como UTF-8. Robusto frente a saltos de línea
|
|
26
|
+
dobles, backticks/fenced code y acentos que el shell rompería al pasarlos por
|
|
27
|
+
`--body`.
|
|
28
|
+
|
|
29
|
+
### Fixed
|
|
30
|
+
|
|
31
|
+
- `comments.update` ahora devuelve su resultado para que `PATCH /comments/:id`
|
|
32
|
+
deje de responder 500.
|
|
33
|
+
|
|
34
|
+
## [0.8.4] — 2026-05-19
|
|
35
|
+
|
|
36
|
+
### Added
|
|
37
|
+
|
|
38
|
+
- **`crm rank reconcile --domain <id> [--dry-run]`** — compara las
|
|
39
|
+
keywords locales `active` del dominio contra la lista del proyecto en
|
|
40
|
+
Ahrefs y marca como `orphan` las que ya no están en la API. Endpoint
|
|
41
|
+
GRATIS (0 unidades). Con `--dry-run` sólo devuelve el reporte sin
|
|
42
|
+
escribir. Útil tras importar listas grandes o después de borrar KWs
|
|
43
|
+
manualmente desde la UI de Ahrefs.
|
|
44
|
+
|
|
45
|
+
### Fixed
|
|
46
|
+
|
|
47
|
+
- El reconcile cron (`internal.rankTrackerSync.reconcileProjectKeywords`)
|
|
48
|
+
ahora matchea local↔Ahrefs por `keyword|country` + `keyword|language_code`
|
|
49
|
+
+ fallback por texto, antes sólo por `country` (que no existe en la
|
|
50
|
+
respuesta de Ahrefs). Además incorpora safety guard: si el diff propone
|
|
51
|
+
marcar >25% de las KW activas como orphan en una pasada, aborta y
|
|
52
|
+
loguea — protege contra cambios de shape inesperados en la API.
|
|
53
|
+
|
|
11
54
|
## [0.8.3] — 2026-05-19
|
|
12
55
|
|
|
13
56
|
### Added
|
package/SKILL.md
CHANGED
|
@@ -146,6 +146,19 @@ Errors **always** appear on stderr with full envelope, bypassing `--jq`. Exit co
|
|
|
146
146
|
|
|
147
147
|
**Rule of thumb**: if the change is hard to reverse (deleting work, merging branches of logic, sending external messages, big content rewrites), pass `--shadow` even if your default is autonomous. Low-stakes routine updates (status nudges, agent_log comments, tag adjustments) can run autonomously.
|
|
148
148
|
|
|
149
|
+
7. **After every write that returns an id, surface the full dashboard URL to the human.** When you report a `create` or `update` result back in chat, paste the complete `https://crm.roilab.es/dashboard/<entity>/<id>` URL alongside the id so the human can copy-paste it straight into the browser. The CLI envelope returns the id in `data.id` (and `data._id` for tasks). Build the URL with the API root from the active profile (default `https://crm.roilab.es`; check `crm doctor` if unsure).
|
|
150
|
+
|
|
151
|
+
| Entity | URL template |
|
|
152
|
+
|---|---|
|
|
153
|
+
| Task | `https://crm.roilab.es/dashboard/tasks?taskId=<id>` |
|
|
154
|
+
| Backlink | `https://crm.roilab.es/dashboard/backlinks/<id>` |
|
|
155
|
+
| Domain | `https://crm.roilab.es/dashboard/domains/<id>` |
|
|
156
|
+
| Client | `https://crm.roilab.es/dashboard/clients/<id>` |
|
|
157
|
+
| Chat thread | `https://crm.roilab.es/dashboard/chat?t=<threadId>` |
|
|
158
|
+
| Chat message (deep link) | `https://crm.roilab.es/dashboard/chat?m=<messageId>` |
|
|
159
|
+
|
|
160
|
+
**Do NOT confuse this with `[[feedback_task_refs_use_chip_syntax]]`**: inside task descriptions, comments, and chat bodies you still use `#[Title](taskId)` chips, never raw dashboard URLs. The dashboard URL goes only in your chat reply to the human reviewing your work — that is where they need a one-click destination.
|
|
161
|
+
|
|
149
162
|
## Mentioning humans + linking tasks
|
|
150
163
|
|
|
151
164
|
Comments and task descriptions are markdown. Two special syntaxes — both
|
|
@@ -159,6 +172,40 @@ already wired up to fan out the right side effects when the row lands live:
|
|
|
159
172
|
/ duplicate-of / follow-up). Updates the target's "Referenced by" panel.
|
|
160
173
|
No notification fires — purely a graph operation.
|
|
161
174
|
|
|
175
|
+
### Anti-pattern: NEVER reference a task by bare id
|
|
176
|
+
|
|
177
|
+
Whenever you mention another task — in a description, a comment, a
|
|
178
|
+
`## Tareas relacionadas` block, an audit trail, anywhere markdown is
|
|
179
|
+
rendered — use the chip syntax `#[Título](taskId)`. **A bare id in
|
|
180
|
+
backticks is dead text**: no clickable link, no graph edge, no
|
|
181
|
+
"Referenced by" entry, and human readers have to copy-paste it into the
|
|
182
|
+
URL bar to navigate.
|
|
183
|
+
|
|
184
|
+
```markdown
|
|
185
|
+
❌ Bad — `m172v5tesszx27fhbfmj7abb45868z64` — "Modificar hreflang en dominio .NET"
|
|
186
|
+
❌ Bad — https://crm.roilab.es/dashboard/tasks?taskId=m172v5tesszx27fhbfmj7abb45868z64
|
|
187
|
+
✅ Good — #[Modificar hreflang en dominio .NET](m172v5tesszx27fhbfmj7abb45868z64)
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
This applies equally to inline mentions and to lists. A `## Tareas
|
|
191
|
+
relacionadas` bullet must lead with the chip, not with the id:
|
|
192
|
+
|
|
193
|
+
```markdown
|
|
194
|
+
- #[Eliminar hreflang chile de la home y ajustar hreflang es](m1716nym1jej9vevfnmgp6yzhn869vbz) (done 2024-05-30) → quitó `hreflang="es-CL"`…
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
Special characters in the title (`[`, `]`, parens) must be backslash-escaped
|
|
198
|
+
so the markdown round-trips through the tokenizer:
|
|
199
|
+
|
|
200
|
+
```markdown
|
|
201
|
+
#[\[GB\] Eliminar hreflangs apuntando hacia growbarato.it](m1767y1wqrz93q3kvqtej350398695fj)
|
|
202
|
+
#[Añadir nuevo schema Carousel \(ItemList\) en categorías](m178j0p99dwmfcwy37c0jr9t3s86819z)
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
When you don't know the title off the top of your head, **resolve it
|
|
206
|
+
first** — see the next subsection. Don't fall back to a bare id "for now";
|
|
207
|
+
you'll forget to come back.
|
|
208
|
+
|
|
162
209
|
### Resolve IDs before composing
|
|
163
210
|
|
|
164
211
|
Don't hand-roll memberIds or taskIds. Use the resolver helpers; they exit
|
|
@@ -294,16 +341,27 @@ storage). Reglas y límites compartidos:
|
|
|
294
341
|
- **Cuidado con `task update --file`**: la lista de adjuntos es REEMPLAZO,
|
|
295
342
|
no merge. Los archivos previos desaparecen. Para vaciar explícitamente, usa
|
|
296
343
|
`--clear-files`; para conservar los previos hay que pasarlos también.
|
|
344
|
+
- **Para añadir/quitar UN archivo sin tocar el resto** usa `task attach` en vez
|
|
345
|
+
de `task update --file` (que reemplaza toda la lista):
|
|
346
|
+
- `crm task attach list <taskId>` — lista los adjuntos (con su `_id`).
|
|
347
|
+
- `crm task attach add <taskId> --file <ruta...>` — añade sin clobber.
|
|
348
|
+
- `crm task attach remove <taskId> <attachmentId>` — quita uno por id.
|
|
349
|
+
Tope: 50 archivos/tarea. Los clientes pueden adjuntar a tareas que ven.
|
|
297
350
|
|
|
298
351
|
```bash
|
|
299
352
|
# Chat
|
|
300
353
|
crm chat send "$TID" --body "captura del 404" --file ./bug.png
|
|
301
354
|
crm chat reply <msgId> --thread "$TID" --file ./report.pdf --file ./logs.txt
|
|
302
355
|
|
|
303
|
-
# Tarea
|
|
356
|
+
# Tarea — en la creación / reemplazo total
|
|
304
357
|
crm task create --title "Migración H1" --domain dom_xyz --file ./brief.pdf
|
|
305
358
|
crm task update tsk_abc --file ./new-spec.pdf --clear-files
|
|
306
359
|
|
|
360
|
+
# Tarea — gestión incremental de adjuntos (sin reemplazar la lista)
|
|
361
|
+
crm task attach add tsk_abc --file ./extra.pdf --file ./shot.png
|
|
362
|
+
crm task attach list tsk_abc
|
|
363
|
+
crm task attach remove tsk_abc att_xyz
|
|
364
|
+
|
|
307
365
|
# Comentario
|
|
308
366
|
crm comment create --task tsk_abc --kind decision \
|
|
309
367
|
--body "Cerrado: ver diff y screenshots" \
|
|
@@ -325,9 +383,11 @@ crm task create \
|
|
|
325
383
|
--description "Current H1 buries the value prop; replace with 'Plans that scale with you'." \
|
|
326
384
|
--idempotency-key 01HY8X...
|
|
327
385
|
|
|
328
|
-
# Log change events after shipping —
|
|
329
|
-
#
|
|
330
|
-
#
|
|
386
|
+
# Log change events after shipping — SOLO en tareas de Redacción (kind:
|
|
387
|
+
# "content"). Las tareas generales no registran cambios on-page y el backend
|
|
388
|
+
# los rechaza. No hay verbo CLI todavía; hit the REST endpoint directly:
|
|
389
|
+
# POST /api/v1/domains/<domainId>/changes (autogenerates an idempotency key
|
|
390
|
+
# per call; same envelope contract).
|
|
331
391
|
|
|
332
392
|
# Search across everything
|
|
333
393
|
crm search "meta title" --kind change --domain dom_xyz --limit 5
|
|
@@ -384,7 +444,7 @@ Prefer 1 over 2 when it answers the question — Tinybird reads don't touch prov
|
|
|
384
444
|
- **Scope comments are useful**: if a task has a scoped propertyLink (via `scopeId`), use `crm scope get <id>` to see the fingerprint + filters before assuming the KPI measurement window.
|
|
385
445
|
- **Provider tokens never reach you**. The CLI forwards `--filters`, `--start`, `--end` through our REST layer; Convex decrypts and calls GSC / GA4 / Bing server-side. If you need a shape our wrappers don't cover, open an endpoint — don't try to exfiltrate tokens.
|
|
386
446
|
- **Bing daily feed has no per-query/per-page breakdown**. `crm bing query` returns the aggregate with a `meta.note` saying so.
|
|
387
|
-
- Web UI paths: `/dashboard/tasks
|
|
447
|
+
- Web UI paths: `/dashboard/tasks?taskId=<id>` for a specific task, `/dashboard/inbox` for your review queue, `/developers` for the endpoint catalog, `/dashboard/settings?tab=api-usage` for the provider-API usage log.
|
|
388
448
|
|
|
389
449
|
## Task participants — assignees vs collaborators
|
|
390
450
|
|
|
@@ -441,6 +501,23 @@ crm backlink rejection-report --client cli_xyz --since-days 90
|
|
|
441
501
|
|
|
442
502
|
Reasons are a closed catalog (`spammy_source | wrong_anchor | wrong_target | nofollow_unexpected | dead_on_arrival | duplicate | policy_violation | other`) — server validates and notifies the original creator.
|
|
443
503
|
|
|
504
|
+
## Perfiles sociales (`crm social`)
|
|
505
|
+
|
|
506
|
+
Los handles sociales de cada dominio (y los de marca global del cliente) viven en una tabla propia. Léelos antes de redactar contenido social o de proponer diversificación de enlaces — saber qué cuentas existen evita inventar handles.
|
|
507
|
+
|
|
508
|
+
```bash
|
|
509
|
+
crm social list --domain dom_xyz # perfiles de un sitio
|
|
510
|
+
crm social list --client cli_abc # + handles de marca sin dominio
|
|
511
|
+
crm social create --domain dom_xyz --platform instagram --handle growbarato \
|
|
512
|
+
--url https://instagram.com/growbarato --primary
|
|
513
|
+
crm social create --client cli_abc --platform other --label Crunchbase \
|
|
514
|
+
--url https://www.crunchbase.com/organization/growbarato
|
|
515
|
+
crm social update soc_123 --notes "Cuenta oficial verificada"
|
|
516
|
+
crm social delete soc_123 # archiva (borrado suave, restaurable)
|
|
517
|
+
```
|
|
518
|
+
|
|
519
|
+
Reglas: indica `--domain` (perfil del sitio) **o** `--client` (handle de marca sin sitio concreto). `platform` es un catálogo cerrado (`instagram | facebook | x | youtube | tiktok | linkedin | pinterest | threads | trustpilot | other`); `other` exige `--label`. El handle se normaliza quitando la `@`. `--internal-notes` queda staff-only (no se muestra al cliente). Scope `social:write` — staff-only.
|
|
520
|
+
|
|
444
521
|
## Bulk approve / reject your queue
|
|
445
522
|
|
|
446
523
|
`crm review` supports bulk operations via stdin (NDJSON or `kind:id` tokens, ≤100 per call):
|
package/SURFACE.txt
CHANGED
|
@@ -51,6 +51,12 @@ CMD crm task assets <id>
|
|
|
51
51
|
CMD crm task link-backlink <task-id> <backlink-id> --unlink
|
|
52
52
|
CMD crm task link-offer <task-id> <offer-id> --unlink
|
|
53
53
|
CMD crm task complete-with-evidence <task-id> --asset <kind:id> --comment <id>
|
|
54
|
+
# `task attach` — add/remove/list files INDIVIDUALLY (no clobber, unlike
|
|
55
|
+
# `task update --file` which replaces the whole list). `attach remove` takes the
|
|
56
|
+
# attachment id from `attach list`. Máx 10 MB/archivo, máx 50 archivos/tarea.
|
|
57
|
+
CMD crm task attach list <taskId>
|
|
58
|
+
CMD crm task attach add <taskId> --file <path...>
|
|
59
|
+
CMD crm task attach remove <taskId> <attachmentId>
|
|
54
60
|
|
|
55
61
|
CMD crm comment list <taskId>
|
|
56
62
|
# `--body` opcional si pasas `--file`. `--file <path>` repetible para varios
|
|
@@ -87,9 +93,15 @@ CMD crm client profile-set <id> --ceo-name <text> --ceo-role <text> --industry <
|
|
|
87
93
|
CMD crm domain list --client <id>
|
|
88
94
|
CMD crm domain get <id>
|
|
89
95
|
CMD crm domain metrics <id> --start <date> --end <date>
|
|
96
|
+
CMD crm domain create --name <name> --url <url> --client <id> --favicon <url> --primary-metric <id> --currency <code>
|
|
90
97
|
CMD crm domain profile <id>
|
|
91
98
|
CMD crm domain profile-set <id> --positioning <text> --tone-override <text> --audience-override <text> --content-guidelines <text> --brief <md> --internal-notes <md>
|
|
92
99
|
|
|
100
|
+
# property — fuente de datos individual (GSC site, GA4 property, Bing site, Ads
|
|
101
|
+
# account, GBP location). Si pasas --account + source ingestible (gsc/ga4/bing)
|
|
102
|
+
# se programa una ingesta inmediata de hasta 16 meses. Owner/admin only.
|
|
103
|
+
CMD crm property create --source-type <gsc|ga4|bing|ads|gbp> --identifier <id> --display-name <name> --client <id> --domain <id> --account <id> --backfill <date> --favicon <url> --currency <code> --website-url <url>
|
|
104
|
+
|
|
93
105
|
CMD crm backlink list --domain <id> --status <status>
|
|
94
106
|
CMD crm backlink lost --domain <id> --since <iso>
|
|
95
107
|
CMD crm backlink list-tasks <backlink-id>
|
|
@@ -103,6 +115,14 @@ CMD crm backlink rejection-report --domain <id> --client <id> --since-days <n>
|
|
|
103
115
|
|
|
104
116
|
CMD crm offer list-tasks <offer-id>
|
|
105
117
|
|
|
118
|
+
# Social profiles (Phase 44) — store + manage a domain's / client's handles.
|
|
119
|
+
# `--domain` for a site's profile, `--client` for a brand-level handle.
|
|
120
|
+
# platform=other requires `--label`. Staff-only.
|
|
121
|
+
CMD crm social list --domain <id> --client <id> --archived
|
|
122
|
+
CMD crm social create --platform <instagram|facebook|x|youtube|tiktok|linkedin|pinterest|threads|trustpilot|other> --url <url> --domain <id> --client <id> --handle <h> --label <l> --primary --order <n> --notes <t> --internal-notes <t>
|
|
123
|
+
CMD crm social update <id> --platform <p> --url <url> --handle <h> --label <l> --primary --order <n> --notes <t> --internal-notes <t>
|
|
124
|
+
CMD crm social delete <id>
|
|
125
|
+
|
|
106
126
|
CMD crm change list --domain <id> --url <url> --since <iso>
|
|
107
127
|
|
|
108
128
|
CMD crm scope list --domain <id> --kind <saved|ephemeral>
|
package/dist/bin/crm.js
CHANGED
|
@@ -23,6 +23,7 @@ import { registerMention } from "../src/commands/mention.js";
|
|
|
23
23
|
import { registerTime } from "../src/commands/time.js";
|
|
24
24
|
import { registerRank } from "../src/commands/rank.js";
|
|
25
25
|
import { registerReport } from "../src/commands/report.js";
|
|
26
|
+
import { registerMarketplace } from "../src/commands/marketplace.js";
|
|
26
27
|
import { maybeNudgeFromCache, readInstalledVersion, refreshCacheInBackground, } from "../src/utils/version-check.js";
|
|
27
28
|
const program = new Command();
|
|
28
29
|
program
|
|
@@ -46,6 +47,7 @@ registerSkill(program);
|
|
|
46
47
|
registerTime(program);
|
|
47
48
|
registerRank(program);
|
|
48
49
|
registerReport(program);
|
|
50
|
+
registerMarketplace(program);
|
|
49
51
|
registerCommands(program);
|
|
50
52
|
registerDoctor(program);
|
|
51
53
|
// Nudge basado en cache: instantáneo, sin red. `crm doctor` refresca contra npm.
|
package/dist/bin/crm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"crm.js","sourceRoot":"","sources":["../../bin/crm.ts"],"names":[],"mappings":";AACA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,C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AC;AAC7B,gBAAgB,CAAC,OAAO,CAAC,CAAC;AAC1B,cAAc,CAAC,OAAO,CAAC,CAAC;AAExB,iFAAiF;AACjF,mBAAmB,EAAE,CAAC;AACtB,8EAA8E;AAC9E,0EAA0E;AAC1E,+BAA+B;AAC/B,wBAAwB,EAAE,CAAC;AAE3B,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;IAC7C,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,aAAa,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACxF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
/** `crm comment` — list + create comments on a task. */
|
|
1
|
+
/** `crm comment` — list + create + update comments on a task. */
|
|
2
|
+
import { readFileSync } from "node:fs";
|
|
2
3
|
import { run } from "../transport/run.js";
|
|
3
4
|
import { EXIT } from "../types.js";
|
|
4
5
|
import { uploadGenericFiles } from "../lib/fileUpload.js";
|
|
@@ -23,14 +24,28 @@ export function registerComment(program) {
|
|
|
23
24
|
.description("Añade un comentario (acepta adjuntos con --file). Los agentes usan kind=agent_log por defecto.")
|
|
24
25
|
.requiredOption("--task <id>", "id de tarea")
|
|
25
26
|
.option("--body <text>", "cuerpo del comentario (markdown + @menciones + #refs-de-tarea) — opcional si se adjunta --file")
|
|
27
|
+
.option("--body-file <path>", "lee el cuerpo desde un fichero — úsalo cuando el body lleve backticks/fenced code blocks o acentos que el shell rompería (se lee como UTF-8)")
|
|
26
28
|
.option("--kind <kind>", "note | agent_log | decision (los agentes usan agent_log por defecto)")
|
|
27
29
|
.option("--file <path...>", "ruta a un archivo a adjuntar — repite la bandera para varios (máx 10 MB cada uno; aviso a partir de 2 MB)")
|
|
28
30
|
.action(async (opts, cmd) => {
|
|
29
31
|
const flags = readFlags(cmd);
|
|
30
32
|
const files = opts.file ?? [];
|
|
31
|
-
|
|
33
|
+
let body = opts.body ?? "";
|
|
34
|
+
if (opts.bodyFile) {
|
|
35
|
+
if (opts.body !== undefined) {
|
|
36
|
+
process.stderr.write("[USO] No combines --body y --body-file — elige uno.\n");
|
|
37
|
+
process.exit(EXIT.USAGE);
|
|
38
|
+
}
|
|
39
|
+
try {
|
|
40
|
+
body = readFileSync(opts.bodyFile, "utf8");
|
|
41
|
+
}
|
|
42
|
+
catch (err) {
|
|
43
|
+
process.stderr.write(`[USO] No se pudo leer --body-file ${opts.bodyFile}: ${err.message}\n`);
|
|
44
|
+
process.exit(EXIT.USAGE);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
32
47
|
if (body.trim().length === 0 && files.length === 0) {
|
|
33
|
-
process.stderr.write("[USO] Especifica --body, --file, o
|
|
48
|
+
process.stderr.write("[USO] Especifica --body, --body-file, --file, o una combinación.\n");
|
|
34
49
|
process.exit(EXIT.USAGE);
|
|
35
50
|
}
|
|
36
51
|
const attachments = await uploadGenericFiles(files, flags.profile);
|
|
@@ -53,5 +68,45 @@ export function registerComment(program) {
|
|
|
53
68
|
asAgent: flags.asAgent,
|
|
54
69
|
});
|
|
55
70
|
});
|
|
71
|
+
comment
|
|
72
|
+
.command("update")
|
|
73
|
+
.description("Edita el contenido de un comentario existente. Solo el autor o owner/admin pueden editar.")
|
|
74
|
+
.requiredOption("--id <commentId>", "id del comentario a editar")
|
|
75
|
+
.option("--body <text>", "nuevo cuerpo (markdown + @menciones + #refs-de-tarea). Alternativa a --body-file.")
|
|
76
|
+
.option("--body-file <path>", "lee el nuevo cuerpo desde un fichero — úsalo cuando el body lleve backticks/fenced code blocks que el shell rompería")
|
|
77
|
+
.action(async (opts, cmd) => {
|
|
78
|
+
const flags = readFlags(cmd);
|
|
79
|
+
let body = opts.body ?? "";
|
|
80
|
+
if (opts.bodyFile) {
|
|
81
|
+
if (opts.body !== undefined) {
|
|
82
|
+
process.stderr.write("[USO] No combines --body y --body-file — elige uno.\n");
|
|
83
|
+
process.exit(EXIT.USAGE);
|
|
84
|
+
}
|
|
85
|
+
try {
|
|
86
|
+
body = readFileSync(opts.bodyFile, "utf8");
|
|
87
|
+
}
|
|
88
|
+
catch (err) {
|
|
89
|
+
process.stderr.write(`[USO] No se pudo leer --body-file ${opts.bodyFile}: ${err.message}\n`);
|
|
90
|
+
process.exit(EXIT.USAGE);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
if (body.trim().length === 0) {
|
|
94
|
+
process.stderr.write("[USO] Cuerpo vacío. Pasa --body o --body-file con contenido.\n");
|
|
95
|
+
process.exit(EXIT.USAGE);
|
|
96
|
+
}
|
|
97
|
+
await run({
|
|
98
|
+
method: "PATCH",
|
|
99
|
+
path: `/comments/${encodeURIComponent(opts.id)}`,
|
|
100
|
+
request: {
|
|
101
|
+
body: { content: body },
|
|
102
|
+
idempotencyKey: flags.idempotencyKey,
|
|
103
|
+
},
|
|
104
|
+
output: outputFromFlags(flags),
|
|
105
|
+
profile: flags.profile,
|
|
106
|
+
waitForApproval: flags.waitForApproval,
|
|
107
|
+
waitTimeoutMs: parseDurationMs(flags.timeout),
|
|
108
|
+
asAgent: flags.asAgent,
|
|
109
|
+
});
|
|
110
|
+
});
|
|
56
111
|
}
|
|
57
112
|
//# sourceMappingURL=comment.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"comment.js","sourceRoot":"","sources":["../../../src/commands/comment.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"comment.js","sourceRoot":"","sources":["../../../src/commands/comment.ts"],"names":[],"mappings":"AAAA,iEAAiE;AAGjE,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,C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,IAAI,CAAC,QAAQ,KAAM,GAAa,CAAC,OAAO,IAAI,CAClF,CAAC;gBACF,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAC3B,CAAC;QACH,CAAC;QACD,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC7B,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,gEAAgE,CACjE,CAAC;YACF,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC3B,CAAC;QACD,MAAM,GAAG,CAAC;YACR,MAAM,EAAE,OAAO;YACf,IAAI,EAAE,aAAa,kBAAkB,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE;YAChD,OAAO,EAAE;gBACP,IAAI,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;gBACvB,cAAc,EAAE,KAAK,CAAC,cAAc;aACrC;YACD,MAAM,EAAE,eAAe,CAAC,KAAK,CAAC;YAC9B,OAAO,EAAE,KAAK,CAAC,OAAO;YACtB,eAAe,EAAE,KAAK,CAAC,eAAe;YACtC,aAAa,EAAE,eAAe,CAAC,KAAK,CAAC,OAAO,CAAC;YAC7C,OAAO,EAAE,KAAK,CAAC,OAAO;SACvB,CAAC,CAAC;IACL,CAAC,CACF,CAAC;AACN,CAAC"}
|
|
@@ -69,6 +69,83 @@ export function registerGeneric(program) {
|
|
|
69
69
|
profile: flags.profile,
|
|
70
70
|
});
|
|
71
71
|
});
|
|
72
|
+
domain
|
|
73
|
+
.command("create")
|
|
74
|
+
.description("Crea un dominio nuevo. Members deben pasar --client; owner/admin pueden dejarlo huérfano (no recomendado).")
|
|
75
|
+
.requiredOption("--name <name>", "nombre legible (ej: 'Acme Corp')")
|
|
76
|
+
.requiredOption("--url <url>", "URL normalizada (ej: 'example.com' o 'example.com/blog')")
|
|
77
|
+
.option("--client <id>", "id del cliente al que pertenece el dominio")
|
|
78
|
+
.option("--favicon <url>", "URL del favicon")
|
|
79
|
+
.option("--primary-metric <id>", "métrica primaria (por defecto 'gsc:clicks')")
|
|
80
|
+
.option("--currency <code>", "código ISO de moneda (ej: 'EUR', 'USD')")
|
|
81
|
+
.action(async (opts, cmd) => {
|
|
82
|
+
const flags = readFlags(cmd);
|
|
83
|
+
await run({
|
|
84
|
+
method: "POST",
|
|
85
|
+
path: "/domains",
|
|
86
|
+
request: {
|
|
87
|
+
body: {
|
|
88
|
+
name: opts.name,
|
|
89
|
+
url: opts.url,
|
|
90
|
+
clientId: opts.client,
|
|
91
|
+
favicon: opts.favicon,
|
|
92
|
+
primaryMetricId: opts.primaryMetric,
|
|
93
|
+
currencyCode: opts.currency,
|
|
94
|
+
},
|
|
95
|
+
idempotencyKey: flags.idempotencyKey,
|
|
96
|
+
},
|
|
97
|
+
output: outputFromFlags(flags),
|
|
98
|
+
profile: flags.profile,
|
|
99
|
+
asAgent: flags.asAgent,
|
|
100
|
+
});
|
|
101
|
+
});
|
|
102
|
+
// ── property (data-source unit: GSC site, GA4 property, Bing site)
|
|
103
|
+
const property = program
|
|
104
|
+
.command("property")
|
|
105
|
+
.description("Properties — unidades de fuente (GSC / GA4 / Bing / Ads / GBP)");
|
|
106
|
+
property
|
|
107
|
+
.command("create")
|
|
108
|
+
.description("Crea una property nueva. Si pasas --account + source ingestible (gsc/ga4/bing) programa una ingesta inmediata de hasta 16 meses. Owner/admin only.")
|
|
109
|
+
.requiredOption("--source-type <type>", "gsc | ga4 | bing | ads | gbp")
|
|
110
|
+
.requiredOption("--identifier <id>", "identificador en la fuente: URL para GSC ('sc-domain:example.com' o 'https://example.com/'), property ID para GA4, URL para Bing")
|
|
111
|
+
.requiredOption("--display-name <name>", "nombre legible")
|
|
112
|
+
.option("--client <id>", "id del cliente")
|
|
113
|
+
.option("--domain <id>", "id del dominio padre")
|
|
114
|
+
.option("--account <id>", "id de la cuenta conectada (Google / Microsoft)")
|
|
115
|
+
.option("--backfill <date>", "fecha mínima de backfill (YYYY-MM-DD)")
|
|
116
|
+
.option("--favicon <url>", "URL del favicon")
|
|
117
|
+
.option("--currency <code>", "código ISO de moneda nativa")
|
|
118
|
+
.option("--website-url <url>", "URL del sitio web (relevante para GA4)")
|
|
119
|
+
.action(async (opts, cmd) => {
|
|
120
|
+
const flags = readFlags(cmd);
|
|
121
|
+
const allowed = ["gsc", "ga4", "bing", "ads", "gbp"];
|
|
122
|
+
if (!allowed.includes(opts.sourceType)) {
|
|
123
|
+
process.stderr.write(`error: --source-type debe ser uno de ${allowed.join(", ")}\n`);
|
|
124
|
+
process.exit(2);
|
|
125
|
+
}
|
|
126
|
+
await run({
|
|
127
|
+
method: "POST",
|
|
128
|
+
path: "/properties",
|
|
129
|
+
request: {
|
|
130
|
+
body: {
|
|
131
|
+
sourceType: opts.sourceType,
|
|
132
|
+
propertyIdentifier: opts.identifier,
|
|
133
|
+
displayName: opts.displayName,
|
|
134
|
+
clientId: opts.client,
|
|
135
|
+
domainId: opts.domain,
|
|
136
|
+
connectedAccountId: opts.account,
|
|
137
|
+
backfillDate: opts.backfill,
|
|
138
|
+
favicon: opts.favicon,
|
|
139
|
+
currencyCode: opts.currency,
|
|
140
|
+
websiteUrl: opts.websiteUrl,
|
|
141
|
+
},
|
|
142
|
+
idempotencyKey: flags.idempotencyKey,
|
|
143
|
+
},
|
|
144
|
+
output: outputFromFlags(flags),
|
|
145
|
+
profile: flags.profile,
|
|
146
|
+
asAgent: flags.asAgent,
|
|
147
|
+
});
|
|
148
|
+
});
|
|
72
149
|
// ── backlinks
|
|
73
150
|
const backlink = program.command("backlink").description("Backlinks trackeados (cacheados desde Ahrefs)");
|
|
74
151
|
backlink
|
|
@@ -226,6 +303,140 @@ export function registerGeneric(program) {
|
|
|
226
303
|
profile: flags.profile,
|
|
227
304
|
});
|
|
228
305
|
});
|
|
306
|
+
// ── social profiles (Phase 44)
|
|
307
|
+
const SOCIAL_PLATFORMS = [
|
|
308
|
+
"instagram",
|
|
309
|
+
"facebook",
|
|
310
|
+
"x",
|
|
311
|
+
"youtube",
|
|
312
|
+
"tiktok",
|
|
313
|
+
"linkedin",
|
|
314
|
+
"pinterest",
|
|
315
|
+
"threads",
|
|
316
|
+
"trustpilot",
|
|
317
|
+
"other",
|
|
318
|
+
];
|
|
319
|
+
const social = program
|
|
320
|
+
.command("social")
|
|
321
|
+
.description("Perfiles sociales de dominios / clientes (handles + URLs)");
|
|
322
|
+
social
|
|
323
|
+
.command("list")
|
|
324
|
+
.description("Lista los perfiles sociales. Acota con --domain o --client; sin filtro devuelve todo el workspace.")
|
|
325
|
+
.option("--domain <id>", "acota a un dominio")
|
|
326
|
+
.option("--client <id>", "acota a un cliente (incluye handles de marca sin dominio)")
|
|
327
|
+
.option("--archived", "incluye perfiles archivados")
|
|
328
|
+
.action(async (opts, cmd) => {
|
|
329
|
+
const flags = readFlags(cmd);
|
|
330
|
+
await run({
|
|
331
|
+
method: "GET",
|
|
332
|
+
path: "/social",
|
|
333
|
+
request: {
|
|
334
|
+
query: {
|
|
335
|
+
domainId: opts.domain,
|
|
336
|
+
clientId: opts.client,
|
|
337
|
+
includeArchived: opts.archived ? true : undefined,
|
|
338
|
+
},
|
|
339
|
+
},
|
|
340
|
+
output: outputFromFlags(flags),
|
|
341
|
+
profile: flags.profile,
|
|
342
|
+
});
|
|
343
|
+
});
|
|
344
|
+
social
|
|
345
|
+
.command("create")
|
|
346
|
+
.description("Crea un perfil social. Indica --domain (perfil del sitio) o --client (handle de marca). platform=other requiere --label.")
|
|
347
|
+
.requiredOption("--platform <p>", `plataforma: ${SOCIAL_PLATFORMS.join(" | ")}`)
|
|
348
|
+
.requiredOption("--url <url>", "URL completa del perfil (https://...)")
|
|
349
|
+
.option("--domain <id>", "dominio al que pertenece el perfil")
|
|
350
|
+
.option("--client <id>", "cliente (handle de marca sin dominio concreto)")
|
|
351
|
+
.option("--handle <h>", "handle sin la @ (p.ej. growbarato)")
|
|
352
|
+
.option("--label <l>", "etiqueta cuando platform=other (p.ej. Crunchbase)")
|
|
353
|
+
.option("--primary", "marca este perfil como el canónico")
|
|
354
|
+
.option("--order <n>", "orden de visualización", (v) => parseInt(v, 10))
|
|
355
|
+
.option("--notes <t>", "notas visibles también para el cliente")
|
|
356
|
+
.option("--internal-notes <t>", "notas internas (staff-only)")
|
|
357
|
+
.action(async (opts, cmd) => {
|
|
358
|
+
const flags = readFlags(cmd);
|
|
359
|
+
if (!SOCIAL_PLATFORMS.includes(opts.platform)) {
|
|
360
|
+
process.stderr.write(`error: --platform debe ser uno de ${SOCIAL_PLATFORMS.join(", ")}\n`);
|
|
361
|
+
process.exit(2);
|
|
362
|
+
}
|
|
363
|
+
await run({
|
|
364
|
+
method: "POST",
|
|
365
|
+
path: "/social",
|
|
366
|
+
request: {
|
|
367
|
+
body: {
|
|
368
|
+
platform: opts.platform,
|
|
369
|
+
url: opts.url,
|
|
370
|
+
domainId: opts.domain,
|
|
371
|
+
clientId: opts.client,
|
|
372
|
+
handle: opts.handle,
|
|
373
|
+
customPlatformLabel: opts.label,
|
|
374
|
+
isPrimary: opts.primary,
|
|
375
|
+
displayOrder: opts.order,
|
|
376
|
+
notes: opts.notes,
|
|
377
|
+
internalNotes: opts.internalNotes,
|
|
378
|
+
},
|
|
379
|
+
idempotencyKey: flags.idempotencyKey,
|
|
380
|
+
},
|
|
381
|
+
output: outputFromFlags(flags),
|
|
382
|
+
profile: flags.profile,
|
|
383
|
+
asAgent: flags.asAgent,
|
|
384
|
+
});
|
|
385
|
+
});
|
|
386
|
+
social
|
|
387
|
+
.command("update")
|
|
388
|
+
.description("Actualiza un perfil social. Campos omitidos se dejan igual.")
|
|
389
|
+
.argument("<id>", "id del perfil social")
|
|
390
|
+
.option("--platform <p>", `plataforma: ${SOCIAL_PLATFORMS.join(" | ")}`)
|
|
391
|
+
.option("--url <url>", "URL completa del perfil")
|
|
392
|
+
.option("--handle <h>", "handle sin la @")
|
|
393
|
+
.option("--label <l>", "etiqueta cuando platform=other")
|
|
394
|
+
.option("--primary", "marca como canónico")
|
|
395
|
+
.option("--order <n>", "orden de visualización", (v) => parseInt(v, 10))
|
|
396
|
+
.option("--notes <t>", "notas visibles para el cliente")
|
|
397
|
+
.option("--internal-notes <t>", "notas internas (staff-only)")
|
|
398
|
+
.action(async (id, opts, cmd) => {
|
|
399
|
+
const flags = readFlags(cmd);
|
|
400
|
+
if (opts.platform && !SOCIAL_PLATFORMS.includes(opts.platform)) {
|
|
401
|
+
process.stderr.write(`error: --platform debe ser uno de ${SOCIAL_PLATFORMS.join(", ")}\n`);
|
|
402
|
+
process.exit(2);
|
|
403
|
+
}
|
|
404
|
+
await run({
|
|
405
|
+
method: "PATCH",
|
|
406
|
+
path: `/social/${encodeURIComponent(id)}`,
|
|
407
|
+
request: {
|
|
408
|
+
body: {
|
|
409
|
+
platform: opts.platform,
|
|
410
|
+
url: opts.url,
|
|
411
|
+
handle: opts.handle,
|
|
412
|
+
customPlatformLabel: opts.label,
|
|
413
|
+
isPrimary: opts.primary,
|
|
414
|
+
displayOrder: opts.order,
|
|
415
|
+
notes: opts.notes,
|
|
416
|
+
internalNotes: opts.internalNotes,
|
|
417
|
+
},
|
|
418
|
+
idempotencyKey: flags.idempotencyKey,
|
|
419
|
+
},
|
|
420
|
+
output: outputFromFlags(flags),
|
|
421
|
+
profile: flags.profile,
|
|
422
|
+
asAgent: flags.asAgent,
|
|
423
|
+
});
|
|
424
|
+
});
|
|
425
|
+
social
|
|
426
|
+
.command("delete")
|
|
427
|
+
.description("Archiva un perfil social (borrado suave, restaurable desde la UI).")
|
|
428
|
+
.argument("<id>", "id del perfil social")
|
|
429
|
+
.action(async (id, _opts, cmd) => {
|
|
430
|
+
const flags = readFlags(cmd);
|
|
431
|
+
await run({
|
|
432
|
+
method: "DELETE",
|
|
433
|
+
path: `/social/${encodeURIComponent(id)}`,
|
|
434
|
+
request: { idempotencyKey: flags.idempotencyKey },
|
|
435
|
+
output: outputFromFlags(flags),
|
|
436
|
+
profile: flags.profile,
|
|
437
|
+
asAgent: flags.asAgent,
|
|
438
|
+
});
|
|
439
|
+
});
|
|
229
440
|
// ── change events
|
|
230
441
|
const change = program.command("change").description("Log de cambios SEO on-page");
|
|
231
442
|
change
|