atril-mcp 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.es.md +186 -0
- package/README.md +196 -2
- package/dist/animaciones.js +135 -0
- package/dist/cientifica.js +145 -0
- package/dist/dibujo.js +314 -0
- package/dist/edicion.js +185 -0
- package/dist/estructura.js +75 -0
- package/dist/formato.js +140 -0
- package/dist/grafica_cientifica.py +192 -0
- package/dist/herramientas.js +362 -0
- package/dist/index.js +469 -0
- package/dist/keynote.js +79 -0
- package/dist/revision.js +185 -0
- package/dist/tema.js +88 -0
- package/dist/trabajo.js +50 -0
- package/dist/visuales.js +361 -0
- package/package.json +65 -4
- package/tema/construir_plantilla.cjs +229 -0
- package/tema/importar_plantilla.ts +31 -0
- package/temas/README.md +59 -0
- package/temas/noche/plantilla.key +0 -0
- package/temas/noche/plantilla.pptx +0 -0
- package/temas/noche/recursos/portada.png +0 -0
- package/temas/noche/tema.json +15 -0
- package/temas/papel/plantilla.key +0 -0
- package/temas/papel/plantilla.pptx +0 -0
- package/temas/papel/recursos/portada.png +0 -0
- package/temas/papel/tema.json +15 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Edgar Peralta
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.es.md
ADDED
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
# Atril (español)
|
|
2
|
+
|
|
3
|
+
[English README](README.md)
|
|
4
|
+
|
|
5
|
+
**Servidor MCP para que Claude haga presentaciones de Keynote**: crearlas con un formato
|
|
6
|
+
consistente, leerlas, editarlas, animarlas, revisarlas y exportarlas. Pensado para trabajo
|
|
7
|
+
científico y académico: ecuaciones en LaTeX real, gráficas científicas con barras de error y
|
|
8
|
+
escalas logarítmicas, figuras con pie de origen y una revisión automática antes de presentar.
|
|
9
|
+
|
|
10
|
+
> Los nombres de las herramientas están en español; sus descripciones MCP, en inglés.
|
|
11
|
+
|
|
12
|
+
Estado: **en desarrollo** (0.1). Probado con Keynote Creator Studio 15.3.1 en macOS 26.
|
|
13
|
+
|
|
14
|
+
## Qué puede hacer
|
|
15
|
+
|
|
16
|
+
- **Formato con temas:** `crear_con_formato` y una herramienta por tipo de diapositiva
|
|
17
|
+
(portada, divisor, contenido, figura, tabla, cierre). El tema fija paleta, tipografías y
|
|
18
|
+
fondos; trae dos (`noche`, oscuro, y `papel`, claro) y puedes crear el tuyo.
|
|
19
|
+
- **Contenido:** tablas con estilo, gráficas nativas de Keynote, ecuaciones LaTeX
|
|
20
|
+
(vectoriales), gráficas científicas con matplotlib, figuras con la paleta (rectángulos,
|
|
21
|
+
flechas, estrellas, bocadillos…), cifras destacadas, tarjetas, agenda y video.
|
|
22
|
+
- **Animación:** viñetas que entran una por clic, Magic Move (aparecer, mover, escalar,
|
|
23
|
+
resaltar, revelar series), 44 transiciones.
|
|
24
|
+
- **Edición:** buscar y reemplazar en toda la presentación, alinear y distribuir objetos,
|
|
25
|
+
fusionar y ordenar celdas, mover, ocultar o borrar diapositivas.
|
|
26
|
+
- **Revisión:** `revisar_presentacion` reporta texto fuera de la diapositiva, cuerpo que
|
|
27
|
+
Keynote encoge, contraste bajo (medido en la imagen real), figuras sin pie de origen,
|
|
28
|
+
textos de muestra sobrantes, letra pequeña y diapositivas sin notas.
|
|
29
|
+
- **Exportar:** PDF (también con las notas debajo de cada diapositiva), PowerPoint, PNG,
|
|
30
|
+
JPEG, video, HTML, Keynote ’09 y GIF animado.
|
|
31
|
+
|
|
32
|
+
**Tus archivos nunca se modifican:** Atril trabaja sobre copias en su carpeta de trabajo.
|
|
33
|
+
|
|
34
|
+
## Requisitos
|
|
35
|
+
|
|
36
|
+
- macOS con Keynote. Atril lo controla por AppleScript/JXA: la primera vez macOS pide
|
|
37
|
+
permiso de Automatización para controlar Keynote.
|
|
38
|
+
- Node ≥ 23.6 (corre TypeScript directo, sin compilar).
|
|
39
|
+
- Opcionales:
|
|
40
|
+
- `ecuacion`: TeX Live o MacTeX (`pdflatex`).
|
|
41
|
+
- `grafica_cientifica`: Python 3 con matplotlib y numpy (`ATRIL_PYTHON` para elegir el
|
|
42
|
+
intérprete).
|
|
43
|
+
- Exportar a GIF y las pruebas de video: ffmpeg.
|
|
44
|
+
|
|
45
|
+
## Instalación
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
git clone https://github.com/edgarperatla-create/atril-mcp.git
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
cd atril-mcp && npm install
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Registrar en Claude Code (alcance de usuario: lo ven todas las sesiones):
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
claude mcp add --scope user atril -- node "$PWD/src/index.ts"
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Con otro tema o carpeta de trabajo:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
claude mcp add --scope user atril -e ATRIL_TEMA=papel -e ATRIL_DIR="$HOME/Presentaciones/Atril" -- node "$PWD/src/index.ts"
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
| Variable | Qué fija | Por omisión |
|
|
68
|
+
|---|---|---|
|
|
69
|
+
| `ATRIL_TEMA` | nombre de un tema de `temas/` o ruta a la carpeta de un tema | `noche` |
|
|
70
|
+
| `ATRIL_DIR` | carpeta de trabajo (`copias/`, `salidas/`, `vistas/`…) | `~/Atril` |
|
|
71
|
+
| `ATRIL_PYTHON` | Python con matplotlib para `grafica_cientifica` | el primero que encuentre |
|
|
72
|
+
|
|
73
|
+
## Cómo pedir una presentación
|
|
74
|
+
|
|
75
|
+
Basta con decirle a Claude qué quieres; las instrucciones del servidor le enseñan el flujo
|
|
76
|
+
(crear con formato, una herramienta por diapositiva, mirar cada una, revisar y exportar):
|
|
77
|
+
|
|
78
|
+
> Hazme una presentación de 10 diapositivas sobre el avance del proyecto: portada, un
|
|
79
|
+
> divisor por sección, las figuras de `figuras/` con su pie de origen, la ecuación del
|
|
80
|
+
> estimador, notas con el guion y viñetas animadas en las conclusiones. Expórtala a PDF.
|
|
81
|
+
|
|
82
|
+
> Abre `charla.pptx` y dime qué diapositivas tienen texto encogido o figuras sin pie de
|
|
83
|
+
> origen.
|
|
84
|
+
|
|
85
|
+
## Temas
|
|
86
|
+
|
|
87
|
+
Un tema es una carpeta con `tema.json`: roles de color (fondo, tarjeta, título, texto,
|
|
88
|
+
acento…), tipografías de títulos y de texto, fondo de portada (degradado o imagen con velo)
|
|
89
|
+
y si las figuras deben llevar pie de origen. `npm run plantilla -- <tema>` genera su
|
|
90
|
+
plantilla de Keynote. Detalles y ejemplo en [`temas/README.md`](temas/README.md).
|
|
91
|
+
|
|
92
|
+
## Herramientas
|
|
93
|
+
|
|
94
|
+
| Herramienta | Qué hace |
|
|
95
|
+
|---|---|
|
|
96
|
+
| `listar_presentaciones_abiertas` | id, nombre, archivo, diapositivas, tema, tamaño, si es editable |
|
|
97
|
+
| `abrir` | abre una copia de un `.key`/`.pptx`/`.ppt` |
|
|
98
|
+
| `crear` | presentación nueva con un tema de Keynote; la guarda en la carpeta de trabajo |
|
|
99
|
+
| `leer_presentacion` | por diapositiva: diseño, título, cuerpo, notas, transición, objetos (con `detalle`: posiciones y celdas) |
|
|
100
|
+
| `agregar_diapositiva`, `poner_texto`, `notas` | diapositivas, textos y notas del presentador |
|
|
101
|
+
| `exportar` | PDF, PPTX, PNG, JPEG, video, HTML, Keynote ’09 o GIF; `etapas` (un paso de animación por imagen); PDF `con_notas` |
|
|
102
|
+
| `ver_diapositiva` | imagen de una diapositiva, para que Claude la revise |
|
|
103
|
+
| `guardar`, `cerrar` | solo para presentaciones de la carpeta de trabajo |
|
|
104
|
+
| `crear_con_formato` | presentación nueva con el tema activo (trae prototipos ocultos al final) |
|
|
105
|
+
| `diapositiva_portada` / `_divisor` / `_contenido` / `_figura` / `_tabla` / `_cierre` | una diapositiva del formato; la figura va sobre tarjeta blanca con pie de origen |
|
|
106
|
+
| `grafica` | gráfica nativa de Keynote (17 tipos) con la paleta y leyenda |
|
|
107
|
+
| `grafica_cientifica` | matplotlib → PDF vectorial: barras de error, cotas, log/symlog, bandas, histogramas, segundo eje, fórmulas `$…$` |
|
|
108
|
+
| `tabla`, `editar_celdas`, `tabla_estructura` | tabla con el estilo del tema; editar; fusionar, ordenar, filas y columnas |
|
|
109
|
+
| `ecuacion` | LaTeX real (amsmath y paquetes extra) como imagen vectorial |
|
|
110
|
+
| `forma` | figuras vectoriales con la paleta y texto encima |
|
|
111
|
+
| `cifras_destacadas`, `tarjetas_numeradas`, `agenda`, `diapositiva_video` | componentes del formato |
|
|
112
|
+
| `estilo_texto` | tipografía (de títulos o de texto), tamaño, color, negrita, cursiva |
|
|
113
|
+
| `transicion`, `revelar_por_pasos`, `animar_cambio`, `revelar_series` | transiciones y animaciones con Magic Move |
|
|
114
|
+
| `insertar_medio`, `linea`, `duplicar_diapositiva`, `mover_objeto`, `borrar_objeto` | medios y objetos |
|
|
115
|
+
| `alinear_objetos`, `distribuir_objetos`, `bloquear_objeto` | disposición |
|
|
116
|
+
| `buscar_reemplazar` | en textos, notas y celdas de toda la presentación |
|
|
117
|
+
| `borrar_diapositiva`, `mover_diapositiva`, `ocultar_diapositiva` | manejo de diapositivas (los prototipos están protegidos) |
|
|
118
|
+
| `diapositivas_desde_imagenes` | una diapositiva por imagen |
|
|
119
|
+
| `revisar_presentacion` | reporte de problemas por gravedad, con hoja de contacto |
|
|
120
|
+
| `presentar` | iniciar, avanzar, retroceder, detener (ocupa la pantalla) |
|
|
121
|
+
|
|
122
|
+
## Reglas que el código hace cumplir
|
|
123
|
+
|
|
124
|
+
- **Copias, siempre.** `abrir` copia el archivo a la carpeta de trabajo antes de abrirlo.
|
|
125
|
+
- **Solo es editable lo que tiene archivo dentro de la carpeta de trabajo.** Lo demás (tus
|
|
126
|
+
presentaciones, documentos sin guardar) se puede leer, ver y exportar, pero no modificar,
|
|
127
|
+
guardar ni cerrar.
|
|
128
|
+
- **Nada de borradores en iCloud:** `crear` y `crear_con_formato` guardan de inmediato en la
|
|
129
|
+
carpeta de trabajo (sin archivo, Keynote deja un `Untitled N.key` en iCloud al exportar).
|
|
130
|
+
- **Exportar nunca sobrescribe**: agrega `_2`, `_3`…
|
|
131
|
+
- Los textos y rutas viajan como argumentos de `osascript`, nunca interpolados en los scripts.
|
|
132
|
+
LaTeX se compila sin shell-escape y sin `\input`.
|
|
133
|
+
|
|
134
|
+
## Límites de Keynote por script
|
|
135
|
+
|
|
136
|
+
No se pueden fijar por script: el relleno de las figuras nativas, el espaciado de letras, la
|
|
137
|
+
alineación de párrafo, subíndices en texto, el color de cada serie de una gráfica nativa, los
|
|
138
|
+
bordes de tabla, los enlaces entre diapositivas, agrupar objetos o el orden de apilado. Atril
|
|
139
|
+
rodea varios: figuras y ecuaciones vectoriales, prototipos en la plantilla, Magic Move para
|
|
140
|
+
animar, leyendas propias. Duplicar o mover diapositivas **entre dos documentos** cierra Keynote
|
|
141
|
+
de golpe: Atril no lo hace. Detalles técnicos en [`CLAUDE.md`](CLAUDE.md).
|
|
142
|
+
|
|
143
|
+
## Desarrollo
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
npm run check
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
Las pruebas hablan con el servidor por MCP real (stdio), abren Keynote y usan su propia carpeta
|
|
150
|
+
de trabajo en `trabajo/` (con archivos de prueba sintéticos que generan ellas mismas):
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
node test/fase1.ts
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
node test/fase2.ts
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
`fase1` núcleo · `fase2` formato (`ATRIL_TEMA=papel` para el tema claro) · `fase3` gráficas,
|
|
161
|
+
tablas, transiciones y medios · `fase4` animaciones · `fase5` revisión · `fase6` ecuaciones,
|
|
162
|
+
figuras y componentes · `fase8` edición y exportación · `fase9` gráficas científicas.
|
|
163
|
+
`test/arranque_frio.ts` **cierra Keynote** (se niega si hay documentos abiertos).
|
|
164
|
+
|
|
165
|
+
## Seguridad
|
|
166
|
+
|
|
167
|
+
Atril controla Keynote en tu Mac con permisos de Automatización. Solo modifica archivos dentro
|
|
168
|
+
de su carpeta de trabajo, pero **puede leer cualquier archivo que se le indique** (por ejemplo,
|
|
169
|
+
`abrir` o `insertar_medio`). Si un texto malicioso engañara a Claude (inyección de prompt
|
|
170
|
+
desde una página, un correo o un documento), en teoría podría meter un archivo local en una
|
|
171
|
+
presentación; el archivo no sale de tu Mac a menos que compartas esa presentación. Revisa lo
|
|
172
|
+
que Claude va a insertar antes de compartir una presentación, y no le pidas trabajar con
|
|
173
|
+
material de fuentes en las que no confías.
|
|
174
|
+
|
|
175
|
+
Para reportar un problema de seguridad, abre un issue sin detalles sensibles o escribe al
|
|
176
|
+
autor por GitHub.
|
|
177
|
+
|
|
178
|
+
## Soporte
|
|
179
|
+
|
|
180
|
+
Es un proyecto personal que se mantiene en el tiempo libre: los issues y pull requests son
|
|
181
|
+
bienvenidos, pero no hay compromiso de respuesta ni de fechas. Probado solo con la versión de
|
|
182
|
+
Keynote y macOS indicadas arriba.
|
|
183
|
+
|
|
184
|
+
## Licencia
|
|
185
|
+
|
|
186
|
+
MIT. Ver [`LICENSE`](LICENSE).
|
package/README.md
CHANGED
|
@@ -1,3 +1,197 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Atril
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**An MCP server that lets Claude build Apple Keynote presentations**: create them with a
|
|
4
|
+
consistent theme, read, edit, animate, review and export them. Built for scientific and
|
|
5
|
+
academic work: real LaTeX equations, scientific charts with error bars and log scales,
|
|
6
|
+
figures with source lines, and an automatic quality review before you present.
|
|
7
|
+
|
|
8
|
+
[Español](README.es.md) · Status: **in development** (0.1). Tested with Keynote Creator Studio
|
|
9
|
+
15.3.1 on macOS 26. macOS only.
|
|
10
|
+
|
|
11
|
+
> Tool names are in Spanish (e.g. `crear_con_formato`, `diapositiva_figura`); their
|
|
12
|
+
> descriptions, parameters' help and the server instructions that Claude reads are in English.
|
|
13
|
+
> A glossary is in [Tools](#tools).
|
|
14
|
+
|
|
15
|
+
## What it can do
|
|
16
|
+
|
|
17
|
+
- **Themed formatting:** `crear_con_formato` plus one tool per slide type (title, section
|
|
18
|
+
divider, content, figure, table, closing). A theme fixes palette, fonts and backgrounds; two
|
|
19
|
+
are included (`noche`, dark, and `papel`, light) and you can write your own.
|
|
20
|
+
- **Content:** styled tables, native Keynote charts, vector LaTeX equations, matplotlib
|
|
21
|
+
scientific charts, palette shapes (rectangles, arrows, stars, speech bubbles…), highlighted
|
|
22
|
+
figures, cards, agenda and video.
|
|
23
|
+
- **Animation:** bullets that enter one per click, Magic Move (appear, move, scale, highlight,
|
|
24
|
+
reveal series), 44 transitions.
|
|
25
|
+
- **Editing:** find and replace across the deck, align and distribute objects, merge and sort
|
|
26
|
+
table cells, move, hide or delete slides.
|
|
27
|
+
- **Review:** `revisar_presentacion` reports text outside the slide, body text Keynote
|
|
28
|
+
shrinks, low contrast (measured on the rendered image), figures without a source line,
|
|
29
|
+
leftover placeholder text, tiny fonts and slides without speaker notes.
|
|
30
|
+
- **Export:** PDF (also with notes under each slide), PowerPoint, PNG, JPEG, video, HTML,
|
|
31
|
+
Keynote '09 and animated GIF.
|
|
32
|
+
|
|
33
|
+
**Your files are never modified:** Atril works on copies in its own working folder.
|
|
34
|
+
|
|
35
|
+
## Requirements
|
|
36
|
+
|
|
37
|
+
- macOS with Keynote. Atril drives it through AppleScript/JXA; the first time, macOS asks for
|
|
38
|
+
Automation permission to control Keynote.
|
|
39
|
+
- Node ≥ 23.6 (runs TypeScript directly, no build step).
|
|
40
|
+
- Optional:
|
|
41
|
+
- `ecuacion`: TeX Live or MacTeX (`pdflatex`).
|
|
42
|
+
- `grafica_cientifica`: Python 3 with matplotlib and numpy (`ATRIL_PYTHON` picks the
|
|
43
|
+
interpreter).
|
|
44
|
+
- GIF export and the video tests: ffmpeg.
|
|
45
|
+
|
|
46
|
+
## Install
|
|
47
|
+
|
|
48
|
+
From a clone:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
git clone https://github.com/edgarperatla-create/atril-mcp.git
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
cd atril-mcp && npm install
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Register it in Claude Code (user scope: every session sees it):
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
claude mcp add --scope user atril -- node "$PWD/src/index.ts"
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
With another theme or working folder:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
claude mcp add --scope user atril -e ATRIL_TEMA=papel -e ATRIL_DIR="$HOME/Presentations/Atril" -- node "$PWD/src/index.ts"
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Once published to npm, no clone is needed:
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
claude mcp add --scope user atril -- npx -y atril-mcp
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
| Variable | What it sets | Default |
|
|
77
|
+
|---|---|---|
|
|
78
|
+
| `ATRIL_TEMA` | name of a theme in `temas/`, or a path to a theme folder | `noche` |
|
|
79
|
+
| `ATRIL_DIR` | working folder (`copias/`, `salidas/`, `vistas/`…) | `~/Atril` |
|
|
80
|
+
| `ATRIL_PYTHON` | Python with matplotlib for `grafica_cientifica` | first one found |
|
|
81
|
+
|
|
82
|
+
## How to ask for a deck
|
|
83
|
+
|
|
84
|
+
Just tell Claude what you want; the server instructions teach it the workflow (create with
|
|
85
|
+
the theme, one tool per slide, look at each one, review, export):
|
|
86
|
+
|
|
87
|
+
> Make me a 10-slide deck on the project status: title slide, a divider per section, the
|
|
88
|
+
> figures in `figures/` with their source lines, the estimator's equation, speaker notes with
|
|
89
|
+
> the script and animated bullets in the conclusions. Export it to PDF.
|
|
90
|
+
|
|
91
|
+
> Open `talk.pptx` and tell me which slides have shrunken text or figures without a source
|
|
92
|
+
> line.
|
|
93
|
+
|
|
94
|
+
Slide text is written in whatever language you ask for; only tool names are Spanish.
|
|
95
|
+
|
|
96
|
+
## Themes
|
|
97
|
+
|
|
98
|
+
A theme is a folder with `tema.json`: color roles (background, card, title, text, accent…),
|
|
99
|
+
title and body fonts, the cover background (gradient or image with veil) and whether figures
|
|
100
|
+
must carry a source line. `npm run plantilla -- <theme>` builds its Keynote template. Details
|
|
101
|
+
and an example in [`temas/README.md`](temas/README.md).
|
|
102
|
+
|
|
103
|
+
## Tools
|
|
104
|
+
|
|
105
|
+
Tool names are Spanish; the glossary shows what each one is.
|
|
106
|
+
|
|
107
|
+
| Tool | What it does |
|
|
108
|
+
|---|---|
|
|
109
|
+
| `listar_presentaciones_abiertas` (list open) | id, name, file, slides, theme, size, whether editable |
|
|
110
|
+
| `abrir` (open) | opens a copy of a `.key`/`.pptx`/`.ppt` |
|
|
111
|
+
| `crear` (create) | new presentation with a built-in Keynote theme, saved in the working folder |
|
|
112
|
+
| `leer_presentacion` (read) | per slide: layout, title, body, notes, transition, objects (with `detalle`: positions and cells) |
|
|
113
|
+
| `agregar_diapositiva`, `poner_texto`, `notas` | slides, text and speaker notes |
|
|
114
|
+
| `exportar` (export) | PDF, PPTX, PNG, JPEG, video, HTML, Keynote '09 or GIF; `etapas` (one animation step per image); PDF `con_notas` |
|
|
115
|
+
| `ver_diapositiva` (view slide) | image of a slide, so Claude can inspect it |
|
|
116
|
+
| `guardar`, `cerrar` (save, close) | only for presentations in the working folder |
|
|
117
|
+
| `crear_con_formato` (create with theme) | new presentation with the active theme (hidden prototypes at the end) |
|
|
118
|
+
| `diapositiva_portada` / `_divisor` / `_contenido` / `_figura` / `_tabla` / `_cierre` | title / divider / content / figure / table / closing slide; figures go on a white card with a source line |
|
|
119
|
+
| `grafica` (chart) | native Keynote chart (17 types) with the palette and legend |
|
|
120
|
+
| `grafica_cientifica` (scientific chart) | matplotlib → vector PDF: error bars, upper limits, log/symlog, bands, histograms, second axis, `$…$` formulas |
|
|
121
|
+
| `tabla`, `editar_celdas`, `tabla_estructura` | themed table; edit cells; merge, sort, add/remove rows and columns |
|
|
122
|
+
| `ecuacion` (equation) | real LaTeX (amsmath and extra packages) as a vector image |
|
|
123
|
+
| `forma` (shape) | vector shapes in the palette with text on top |
|
|
124
|
+
| `cifras_destacadas`, `tarjetas_numeradas`, `agenda`, `diapositiva_video` | theme components |
|
|
125
|
+
| `estilo_texto` (text style) | title/body font, size, color, bold, italic |
|
|
126
|
+
| `transicion`, `revelar_por_pasos`, `animar_cambio`, `revelar_series` | transitions and Magic Move animations |
|
|
127
|
+
| `insertar_medio`, `linea`, `duplicar_diapositiva`, `mover_objeto`, `borrar_objeto` | media and objects |
|
|
128
|
+
| `alinear_objetos`, `distribuir_objetos`, `bloquear_objeto` | layout (align, distribute, lock) |
|
|
129
|
+
| `buscar_reemplazar` (find/replace) | across text, notes and table cells of the whole deck |
|
|
130
|
+
| `borrar_diapositiva`, `mover_diapositiva`, `ocultar_diapositiva` | slide management (prototypes are protected) |
|
|
131
|
+
| `diapositivas_desde_imagenes` | one slide per image |
|
|
132
|
+
| `revisar_presentacion` (review) | problem report by severity, with a contact sheet |
|
|
133
|
+
| `presentar` (present) | start, next, previous, stop (takes over the screen) |
|
|
134
|
+
|
|
135
|
+
## Rules the code enforces
|
|
136
|
+
|
|
137
|
+
- **Copies, always.** `abrir` copies the file into the working folder before opening it.
|
|
138
|
+
- **Only what has a file inside the working folder is editable.** Everything else (your own
|
|
139
|
+
presentations, unsaved documents) can be read, viewed and exported, but not modified, saved
|
|
140
|
+
or closed.
|
|
141
|
+
- **No iCloud drafts:** `crear` and `crear_con_formato` save immediately in the working folder
|
|
142
|
+
(otherwise Keynote leaves an `Untitled N.key` in iCloud on export).
|
|
143
|
+
- **Export never overwrites**: it appends `_2`, `_3`…
|
|
144
|
+
- Texts and paths travel as `osascript` arguments, never interpolated into scripts. LaTeX is
|
|
145
|
+
compiled without shell-escape and without `\input`.
|
|
146
|
+
|
|
147
|
+
## Keynote scripting limits
|
|
148
|
+
|
|
149
|
+
Not settable by script: native shape fill, letter spacing, paragraph alignment, subscripts in
|
|
150
|
+
text, the color of each series in a native chart, table borders, slide links, grouping, and
|
|
151
|
+
z-order. Atril works around several: vector shapes and equations, prototypes in the template,
|
|
152
|
+
Magic Move for animation, custom legends. Duplicating or moving slides **between two
|
|
153
|
+
documents** crashes Keynote, so Atril never does it. Technical details in
|
|
154
|
+
[`CLAUDE.md`](CLAUDE.md) (Spanish).
|
|
155
|
+
|
|
156
|
+
## Development
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
npm run check
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
Tests talk to the server over real MCP (stdio), open Keynote and use their own working folder
|
|
163
|
+
in `trabajo/` (with synthetic fixtures they generate themselves):
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
node test/fase1.ts
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
```bash
|
|
170
|
+
node test/fase2.ts
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
`fase1` core · `fase2` theme format (`ATRIL_TEMA=papel` for the light theme) · `fase3` charts,
|
|
174
|
+
tables, transitions and media · `fase4` animations · `fase5` review · `fase6` equations,
|
|
175
|
+
shapes and components · `fase8` editing and export · `fase9` scientific charts.
|
|
176
|
+
`test/arranque_frio.ts` **quits Keynote** (it refuses if documents are open).
|
|
177
|
+
|
|
178
|
+
## Security
|
|
179
|
+
|
|
180
|
+
Atril controls Keynote on your Mac with Automation permission. It only modifies files inside
|
|
181
|
+
its working folder, but it **can read any file it is pointed at** (for example through `abrir`
|
|
182
|
+
or `insertar_medio`). If malicious text tricked Claude (prompt injection from a web page, an
|
|
183
|
+
email or a document), it could in theory put a local file into a presentation; the file does
|
|
184
|
+
not leave your Mac unless you share that presentation. Check what Claude is about to insert
|
|
185
|
+
before sharing a deck, and don't ask it to work with material from sources you don't trust.
|
|
186
|
+
|
|
187
|
+
To report a security issue, open an issue without sensitive details or contact the author on
|
|
188
|
+
GitHub.
|
|
189
|
+
|
|
190
|
+
## Support
|
|
191
|
+
|
|
192
|
+
A personal project maintained in spare time: issues and pull requests are welcome, but there
|
|
193
|
+
is no commitment on response or dates. Tested only with the Keynote and macOS versions above.
|
|
194
|
+
|
|
195
|
+
## License
|
|
196
|
+
|
|
197
|
+
MIT. See [`LICENSE`](LICENSE).
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
// Animaciones dentro de la diapositiva con Magic Move. Keynote no expone los
|
|
2
|
+
// builds a scripts, pero sí las transiciones: se duplica la diapositiva, se cambia la copia
|
|
3
|
+
// y Magic Move anima la diferencia. Verificado con video:
|
|
4
|
+
// aparecer/desaparecer (fundido), mover, escalar, girar, atenuar y cambiar color de texto.
|
|
5
|
+
import { editable } from "./herramientas.js";
|
|
6
|
+
import { applescript, jxa } from "./keynote.js";
|
|
7
|
+
import { duplicarDiapositiva, grafica, transicion } from "./visuales.js";
|
|
8
|
+
const CLASES = {
|
|
9
|
+
texto: ["text item", "textItems"], figura: ["shape", "shapes"], imagen: ["image", "images"],
|
|
10
|
+
video: ["movie", "movies"], audio: ["audio clip", "audioClips"], tabla: ["table", "tables"],
|
|
11
|
+
grafica: ["chart", "charts"], linea: ["line", "lines"], grupo: ["group", "groups"],
|
|
12
|
+
};
|
|
13
|
+
export const TIPOS_OBJETO = Object.keys(CLASES);
|
|
14
|
+
async function conteos(id, n) {
|
|
15
|
+
return jxa(`
|
|
16
|
+
const s = diapositiva(doc(p.id), p.n);
|
|
17
|
+
const r = {};
|
|
18
|
+
for (const [tipo, col] of Object.entries(p.cols)) r[tipo] = intento(() => s[col]().length, 0);
|
|
19
|
+
return r;`, { id, n, cols: Object.fromEntries(TIPOS_OBJETO.map((t) => [t, CLASES[t][1]])) });
|
|
20
|
+
}
|
|
21
|
+
function validar(refs, c, n) {
|
|
22
|
+
for (const r of refs) {
|
|
23
|
+
if (!CLASES[r.tipo])
|
|
24
|
+
throw new Error(`Tipo desconocido "${r.tipo}". Tipos: ${TIPOS_OBJETO.join(", ")}`);
|
|
25
|
+
if (!(r.indice >= 1 && r.indice <= c[r.tipo]))
|
|
26
|
+
throw new Error(`No hay ${r.tipo} ${r.indice} en la diapositiva ${n} (hay ${c[r.tipo]})`);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
/** Borra objetos de una diapositiva; de mayor a menor índice para que no se corran. */
|
|
30
|
+
async function borrar(id, n, refs) {
|
|
31
|
+
const orden = [...refs].sort((a, b) => a.tipo === b.tipo ? b.indice - a.indice : a.tipo.localeCompare(b.tipo));
|
|
32
|
+
for (const r of orden) {
|
|
33
|
+
// El delete() de JXA falla con -10000; el de AppleScript no.
|
|
34
|
+
await applescript(`tell slide ((item 2 of argv) as integer) of document id (item 1 of argv)
|
|
35
|
+
delete ${CLASES[r.tipo][0]} ((item 3 of argv) as integer)
|
|
36
|
+
end tell`, [id, String(n), String(r.indice)]);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
export async function borrarObjeto(ref, n, tipo, indice) {
|
|
40
|
+
const d = await editable(ref);
|
|
41
|
+
validar([{ tipo, indice }], await conteos(d.id, n), n);
|
|
42
|
+
await borrar(d.id, n, [{ tipo, indice }]);
|
|
43
|
+
return { documento: d.nombre, diapositiva: n, borrado: { tipo, indice }, quedan: await conteos(d.id, n) };
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Los objetos aparecen en el orden de `pasos` (cada paso, uno o varios objetos a la vez).
|
|
47
|
+
* La diapositiva n queda como la versión final y se insertan antes sus versiones parciales:
|
|
48
|
+
* de n a n + pasos.length, todas unidas por Magic Move.
|
|
49
|
+
*/
|
|
50
|
+
export async function revelarPorPasos(ref, n, pasos, duracion = 1) {
|
|
51
|
+
const d = await editable(ref);
|
|
52
|
+
if (!pasos.length || pasos.some((p) => !p.length))
|
|
53
|
+
throw new Error("Cada paso necesita al menos un objeto");
|
|
54
|
+
const todos = pasos.flat();
|
|
55
|
+
validar(todos, await conteos(d.id, n), n);
|
|
56
|
+
const clave = (r) => `${r.tipo}:${r.indice}`;
|
|
57
|
+
if (new Set(todos.map(clave)).size !== todos.length)
|
|
58
|
+
throw new Error("Un objeto aparece en más de un paso");
|
|
59
|
+
const k = pasos.length;
|
|
60
|
+
// Copias idénticas: n, n+1, …, n+k. La n+j muestra solo los pasos anteriores a j.
|
|
61
|
+
for (let j = 0; j < k; j++)
|
|
62
|
+
await duplicarDiapositiva(d.id, n);
|
|
63
|
+
for (let j = 0; j < k; j++)
|
|
64
|
+
await borrar(d.id, n + j, pasos.slice(j).flat());
|
|
65
|
+
for (let j = 0; j < k; j++)
|
|
66
|
+
await transicion(d.id, n + j, "magic move", duracion);
|
|
67
|
+
return { documento: d.nombre, diapositivas: Array.from({ length: k + 1 }, (_, j) => n + j), pasos: k };
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Anima cambios de un objeto: duplica la diapositiva n, aplica los cambios en la copia (n+1)
|
|
71
|
+
* y pone Magic Move de n a n+1. Mover y escalar (x, y, ancho, alto), girar (rotacion en
|
|
72
|
+
* grados), atenuar (opacidad 0–100) y resaltar (color_texto, hex, en textos).
|
|
73
|
+
*/
|
|
74
|
+
export async function animarCambio(ref, n, cambios, duracion = 1) {
|
|
75
|
+
const d = await editable(ref);
|
|
76
|
+
if (!cambios.length)
|
|
77
|
+
throw new Error("Hace falta al menos un cambio");
|
|
78
|
+
validar(cambios, await conteos(d.id, n), n);
|
|
79
|
+
for (const c of cambios) {
|
|
80
|
+
if (c.color_texto !== undefined && !/^[0-9a-f]{6}$/i.test(c.color_texto))
|
|
81
|
+
throw new Error(`color_texto debe ser hex de 6 dígitos (recibí "${c.color_texto}")`);
|
|
82
|
+
if (c.color_texto !== undefined && !["texto", "figura"].includes(c.tipo))
|
|
83
|
+
throw new Error("color_texto solo aplica a texto o figura");
|
|
84
|
+
if (c.opacidad !== undefined && !(c.opacidad >= 0 && c.opacidad <= 100))
|
|
85
|
+
throw new Error("opacidad va de 0 a 100");
|
|
86
|
+
}
|
|
87
|
+
const { copia } = await duplicarDiapositiva(d.id, n);
|
|
88
|
+
const resultado = await jxa(`
|
|
89
|
+
const d = doc(p.id); fueraDeVista(d, p.n);
|
|
90
|
+
const s = diapositiva(d, p.n);
|
|
91
|
+
const hex = (h) => [0, 2, 4].map((i) => parseInt(h.slice(i, i + 2), 16) * 257);
|
|
92
|
+
const r = p.cambios.map((c) => {
|
|
93
|
+
const o = s[p.cols[c.tipo]][c.indice - 1];
|
|
94
|
+
if (c.ancho != null) o.width = c.ancho;
|
|
95
|
+
if (c.alto != null) o.height = c.alto;
|
|
96
|
+
if (c.x != null || c.y != null) { const q = o.position(); o.position = { x: c.x ?? q.x, y: c.y ?? q.y }; }
|
|
97
|
+
if (c.rotacion != null) o.rotation = Math.round(((c.rotacion % 360) + 360) % 360);
|
|
98
|
+
if (c.opacidad != null) o.opacity = Math.round(c.opacidad);
|
|
99
|
+
if (c.color_texto != null) o.objectText.color = hex(c.color_texto);
|
|
100
|
+
const q = o.position();
|
|
101
|
+
return { tipo: c.tipo, indice: c.indice, x: q.x, y: q.y, ancho: o.width(), alto: o.height() };
|
|
102
|
+
});
|
|
103
|
+
aLaVista(d, p.n);
|
|
104
|
+
return r;`, { id: d.id, n: copia, cambios, cols: Object.fromEntries(TIPOS_OBJETO.map((t) => [t, CLASES[t][1]])) });
|
|
105
|
+
await transicion(d.id, n, "magic move", duracion);
|
|
106
|
+
return { documento: d.nombre, de: n, a: copia, cambios: resultado };
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Gráfica cuyas series entran una por una: la diapositiva n lleva la primera serie y cada
|
|
110
|
+
* copia agrega la siguiente, con Magic Move entre ellas. Por script no se puede fijar el
|
|
111
|
+
* máximo del eje, así que el eje se reescala entre pasos.
|
|
112
|
+
*/
|
|
113
|
+
export async function revelarSeries(ref, n, tipo, categorias, series, caja = {}, duracion = 1) {
|
|
114
|
+
const d = await editable(ref);
|
|
115
|
+
if (tipo.startsWith("pastel") || tipo === "dispersion")
|
|
116
|
+
throw new Error("revelar_series es para barras, líneas o áreas");
|
|
117
|
+
if (series.length < 2)
|
|
118
|
+
throw new Error("revelar_series necesita al menos dos series");
|
|
119
|
+
await grafica(d.id, n, tipo, categorias, series.slice(0, 1), caja);
|
|
120
|
+
const diapositivas = [n];
|
|
121
|
+
for (let k = 2; k <= series.length; k++) {
|
|
122
|
+
const { copia } = await duplicarDiapositiva(d.id, diapositivas[diapositivas.length - 1]);
|
|
123
|
+
// Fuera la gráfica y la leyenda anterior (textos "■ …"); entra la de k series.
|
|
124
|
+
await applescript(`tell slide ((item 2 of argv) as integer) of document id (item 1 of argv)
|
|
125
|
+
delete every chart
|
|
126
|
+
repeat with i from (count of text items) to 1 by -1
|
|
127
|
+
if (object text of text item i) starts with "■ " then delete text item i
|
|
128
|
+
end repeat
|
|
129
|
+
end tell`, [d.id, String(copia)]);
|
|
130
|
+
await grafica(d.id, copia, tipo, categorias, series.slice(0, k), caja);
|
|
131
|
+
await transicion(d.id, diapositivas[diapositivas.length - 1], "magic move", duracion);
|
|
132
|
+
diapositivas.push(copia);
|
|
133
|
+
}
|
|
134
|
+
return { documento: d.nombre, diapositivas, series: series.map((s) => s.nombre) };
|
|
135
|
+
}
|