primocode 9.8.0-beta.2 → 9.8.0-beta.21
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 +33 -6
- package/app/ansi.js +55 -0
- package/app/app.css +482 -281
- package/app/app.js +888 -315
- package/app/index.html +176 -101
- package/app/primo-marca.js +58 -1
- package/bin/primocode.js +697 -118
- package/comandos/explicar.md +14 -0
- package/comandos/publicar.md +10 -0
- package/comandos/revisar.md +13 -0
- package/lib/act.js +130 -26
- package/lib/api.js +8 -1
- package/lib/app.js +317 -74
- package/lib/browser.js +79 -3
- package/lib/catalogo.js +11 -3
- package/lib/checkpoint-git.js +218 -0
- package/lib/checkpoint.js +249 -0
- package/lib/claude-engine.js +25 -3
- package/lib/comandos-extra.js +481 -0
- package/lib/comandos.js +104 -0
- package/lib/config.js +21 -4
- package/lib/estudio/acervo-site.js +157 -0
- package/lib/estudio/assets.js +77 -3
- package/lib/estudio/cinema.js +354 -0
- package/lib/estudio/composicao.js +470 -0
- package/lib/estudio/edicao.js +450 -0
- package/lib/estudio/impacto.js +263 -0
- package/lib/estudio/index.js +769 -5
- package/lib/estudio/plano.js +5 -2
- package/lib/estudio/remotion.js +228 -23
- package/lib/estudio/slides.js +34 -30
- package/lib/fala.js +95 -1
- package/lib/local/cerebro.json +361 -180
- package/lib/local/entrada.js +18 -8
- package/lib/local/motor-cli.js +1 -1
- package/lib/mencoes.js +98 -0
- package/lib/offline.js +168 -0
- package/lib/painel.js +291 -0
- package/lib/perigo.js +256 -0
- package/lib/pre-leitura.js +118 -0
- package/lib/repeticao.js +4 -2
- package/lib/skills.js +6 -1
- package/lib/tempos.js +62 -0
- package/lib/ui.js +171 -17
- package/package.json +3 -2
- package/skills/apresentacao-pptx/SKILL.md +52 -0
- package/skills/cartaz-de-arte/LICENSE.txt +202 -0
- package/skills/cartaz-de-arte/SKILL.md +47 -0
- package/skills/criar-skill/LICENSE.txt +202 -0
- package/skills/criar-skill/SKILL.md +49 -0
- package/skills/depurar-de-verdade/LICENSE.txt +21 -0
- package/skills/depurar-de-verdade/SKILL.md +14 -5
- package/skills/design-de-verdade/LICENSE.txt +177 -0
- package/skills/design-de-verdade/SKILL.md +42 -0
- package/skills/documento-word/SKILL.md +57 -0
- package/skills/interface-revisada/SKILL.md +47 -0
- package/skills/me-ensina/LICENSE.txt +21 -0
- package/skills/me-ensina/SKILL.md +27 -0
- package/skills/me-entrevista/LICENSE.txt +21 -0
- package/skills/me-entrevista/SKILL.md +27 -0
- package/skills/motion-de-primeira/SKILL.md +1 -1
- package/skills/pdf-bonito/SKILL.md +48 -0
- package/skills/planilha-excel/SKILL.md +47 -0
- package/skills/react-sem-dor/SKILL.md +48 -0
- package/skills/revisao-antes-de-entregar/LICENSE.txt +21 -0
- package/skills/revisao-antes-de-entregar/SKILL.md +6 -1
- package/skills/site-com-motion/SKILL.md +39 -0
- package/skills/temas-prontos/LICENSE.txt +202 -0
- package/skills/temas-prontos/SKILL.md +50 -0
- package/skills/testar-o-site/LICENSE.txt +202 -0
- package/skills/testar-o-site/SKILL.md +46 -0
- package/skills/video-no-remotion/SKILL.md +48 -0
- package/studio/narrar.py +111 -10
- package/studio/rostos.py +52 -0
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright 2026 Anthropic, PBC.
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
---
|
|
2
|
+
nome: Testar o site
|
|
3
|
+
descricao: testar um site ou app web num navegador de verdade — sobe o servidor, olha antes de agir, clica, digita e lê os erros
|
|
4
|
+
quando: testa, testa o site, testar o site, teste o site, testa a página, testar a página, testa o app, testar o app, teste no navegador, testar no navegador, clica em tudo, no navegador, o que quebrou, quebrou, se funciona, e2e, ponta a ponta, playwright
|
|
5
|
+
autor: adaptado de "webapp-testing" (Anthropic, anthropics/skills, Apache-2.0 — ver LICENSE.txt); refeito para as ferramentas browser_* do PrimoCode
|
|
6
|
+
---
|
|
7
|
+
Teste com o navegador que o PrimoCode controla (`browser_*`), não com um script
|
|
8
|
+
de Playwright: ele já está aqui, sem instalar nada.
|
|
9
|
+
|
|
10
|
+
**1. Qual é o caso?**
|
|
11
|
+
- **HTML solto** (sem servidor): leia o arquivo para achar os seletores e abra
|
|
12
|
+
com `browser_open` passando o caminho do arquivo.
|
|
13
|
+
- **App com servidor** (`npm run dev`, Vite, Next): está rodando? Teste com
|
|
14
|
+
`curl -sI http://localhost:5173`. Não está → suba com `run_in_new_terminal`
|
|
15
|
+
(servidor fica de pé; `run_shell` travaria esperando) e repita o `curl` até
|
|
16
|
+
responder. Front e back separados: suba os dois.
|
|
17
|
+
|
|
18
|
+
**2. Olhe ANTES de agir** (o erro mais comum é procurar o botão antes de a
|
|
19
|
+
página terminar de montar):
|
|
20
|
+
1. `browser_open` na página e leia o que ele devolve: erro de JavaScript,
|
|
21
|
+
recurso que não carregou.
|
|
22
|
+
2. `browser_wait` por um elemento que só existe com a página pronta.
|
|
23
|
+
3. `browser_screenshot` e `browser_read` para ver o que a pessoa vê.
|
|
24
|
+
4. Não sabe os seletores? Descubra com `browser_eval`:
|
|
25
|
+
`[...document.querySelectorAll('button,a,input,select')].map(e =>
|
|
26
|
+
e.tagName + ' ' + (e.innerText || e.name || e.id)).join('\n')`
|
|
27
|
+
|
|
28
|
+
**3. Aja com o que descobriu.** `browser_click` pelo texto visível (mais
|
|
29
|
+
estável) ou pelo seletor; `browser_type` com `selector` nos campos;
|
|
30
|
+
`browser_key` para Enter e Tab. Depois de cada ação que muda a tela, espere
|
|
31
|
+
(`browser_wait`) e CONFIRA o resultado com `browser_read` — clicar não prova que
|
|
32
|
+
funcionou.
|
|
33
|
+
|
|
34
|
+
**4. O que testar, nesta ordem**
|
|
35
|
+
- o caminho principal inteiro, como a pessoa faria (cadastro → login → a ação
|
|
36
|
+
principal);
|
|
37
|
+
- o erro: campo vazio, e-mail inválido, senha errada — aparece uma mensagem?
|
|
38
|
+
- a volta: recarregar a página e usar o voltar do navegador não perdem o estado;
|
|
39
|
+
- o celular: `browser_eval` com `window.innerWidth` diz a largura; confira que
|
|
40
|
+
nada sai da tela.
|
|
41
|
+
|
|
42
|
+
**5. Relate** o que foi testado, o que passou e o que quebrou, cada falha com o
|
|
43
|
+
passo para reproduzir e o print (`browser_screenshot`). Erro no console é
|
|
44
|
+
falha, mesmo com a tela parecendo certa.
|
|
45
|
+
|
|
46
|
+
No fim, desligue o servidor que VOCÊ subiu, e só ele.
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
---
|
|
2
|
+
nome: Vídeo no Remotion
|
|
3
|
+
descricao: como o Remotion pensa (quadro a quadro) e como o Estúdio do PrimoCode usa ele para gerar o vídeo
|
|
4
|
+
quando: remotion, usecurrentframe, interpolate, spring, quadro a quadro, estudio_render, render do vídeo, renderizar o vídeo, renderizar vídeo, vídeo em react, vídeo com código
|
|
5
|
+
autor: PrimoCode
|
|
6
|
+
---
|
|
7
|
+
No Remotion, o vídeo é uma função do número do quadro. Cada quadro é desenhado
|
|
8
|
+
sozinho, fora de ordem e às vezes em paralelo. Tudo que se move sai de
|
|
9
|
+
`useCurrentFrame()` — e de mais nada.
|
|
10
|
+
|
|
11
|
+
**No Estúdio do PrimoCode, comece pelo plano, não pelo código.** O
|
|
12
|
+
`estudio_plano` descreve as cenas e os elementos (texto, forma, imagem, video,
|
|
13
|
+
icone, legenda), com `anima` em quadros-chave medidos em segundos. O Estúdio
|
|
14
|
+
escreve o projeto Remotion na pasta `remotion/` do projeto, e o `estudio_render`
|
|
15
|
+
gera o .mp4 (ou o .pdf, em slides e arte). Quase tudo cabe nas primitivas. Só
|
|
16
|
+
escreva React (elemento `componente`, um arquivo na pasta do projeto) quando
|
|
17
|
+
nenhuma primitiva alcança — e confira no vídeo pronto que ele apareceu.
|
|
18
|
+
|
|
19
|
+
**As regras do quadro a quadro** (valem para qualquer código Remotion):
|
|
20
|
+
- Anime com `interpolate(frame, [ini, fim], [de, para], { extrapolateLeft:
|
|
21
|
+
'clamp', extrapolateRight: 'clamp' })`. Sem `clamp`, o valor segue andando
|
|
22
|
+
depois do fim.
|
|
23
|
+
- Movimento com peso: `spring({ frame, fps, config: { damping: 200 } })`.
|
|
24
|
+
- NUNCA use transição ou animação CSS, `setTimeout`, `setInterval`,
|
|
25
|
+
`requestAnimationFrame`, `Date.now()` nem `Math.random()`. No render eles dão
|
|
26
|
+
tremida, quadro repetido ou um vídeo diferente a cada vez. Para sorteio, use
|
|
27
|
+
`random('uma-semente')` do próprio Remotion.
|
|
28
|
+
- Tempo é segundos × `fps` (de `useVideoConfig()`). Não escreva número de
|
|
29
|
+
quadros supondo 30 fps.
|
|
30
|
+
- Trecho no tempo: `<Sequence from={...} durationInFrames={...}>`. Dentro dela,
|
|
31
|
+
o `frame` recomeça do zero.
|
|
32
|
+
- Arquivo local mora em `public/` e entra com `staticFile('midia/x.png')`. Use
|
|
33
|
+
`<Img>`, `<OffthreadVideo>` e `<Audio>` do Remotion, não as tags cruas: eles
|
|
34
|
+
esperam o arquivo carregar antes de fotografar o quadro.
|
|
35
|
+
- Carregou algo por conta própria (fonte, dado)? `delayRender()` antes e
|
|
36
|
+
`continueRender(handle)` depois. Sem isso, o quadro sai antes e o texto aparece
|
|
37
|
+
na fonte errada.
|
|
38
|
+
|
|
39
|
+
**Formato**: 1920×1080 no horizontal, 1080×1920 para reels e stories, 30 fps. A
|
|
40
|
+
duração da cena vem da narração medida (`estudio_narrar`), nunca de estimativa.
|
|
41
|
+
|
|
42
|
+
**Confira antes de entregar**: abra o .mp4 e assista inteiro uma vez. Os erros de
|
|
43
|
+
sempre são texto cortado na borda, elemento que some antes da hora e áudio fora
|
|
44
|
+
de tempo.
|
|
45
|
+
|
|
46
|
+
**Licença**: o Remotion é grátis para pessoa física e empresa de até 3 pessoas;
|
|
47
|
+
acima disso, precisa de licença paga (remotion.dev/license). Avise quando o
|
|
48
|
+
vídeo for de uma empresa maior.
|
package/studio/narrar.py
CHANGED
|
@@ -200,19 +200,22 @@ def falar_edge(texto, saida, voz, ritmo, tom):
|
|
|
200
200
|
|
|
201
201
|
def falar_elevenlabs(texto, saida, voz):
|
|
202
202
|
"""Só quando há chave. Sem ela, nem se tenta — e não é erro."""
|
|
203
|
-
chave
|
|
204
|
-
|
|
205
|
-
|
|
203
|
+
# A chave mora na variável OU em ~/.primocode/elevenlabs.key — antes só a
|
|
204
|
+
# variável era lida, e a função chamada (elevenlabs.falar) nem existia:
|
|
205
|
+
# a ElevenLabs nunca narrou nada, mesmo com a chave no lugar.
|
|
206
206
|
try:
|
|
207
207
|
sys.path.insert(0, str(AQUI))
|
|
208
|
-
import elevenlabs
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
208
|
+
import elevenlabs
|
|
209
|
+
if not elevenlabs.configurado():
|
|
210
|
+
return None
|
|
211
|
+
dados, segundos = elevenlabs.sintetizar(texto, {"voz": voz})
|
|
212
|
+
if not dados:
|
|
213
|
+
return None
|
|
214
|
+
Path(saida).write_bytes(dados)
|
|
215
|
+
return {"ok": True, "arquivo": str(saida), "motor": "elevenlabs", "segundos": segundos,
|
|
216
|
+
"falas": [{"de": 0, "ate": segundos, "texto": texto}]}
|
|
213
217
|
except Exception:
|
|
214
|
-
|
|
215
|
-
return None
|
|
218
|
+
return None
|
|
216
219
|
|
|
217
220
|
|
|
218
221
|
def comando_falar(args):
|
|
@@ -245,6 +248,97 @@ def comando_falar(args):
|
|
|
245
248
|
return falar_edge(texto, args.saida, v["voz"], ritmo, tom)
|
|
246
249
|
|
|
247
250
|
|
|
251
|
+
# ── o roteiro inteiro, com entonação por parte ─────────────────────────────
|
|
252
|
+
# "A voz está sem entonação." (25/09/2026). Uma chamada só, com o texto todo,
|
|
253
|
+
# sai no mesmo ritmo e no mesmo tom do começo ao fim. Aqui cada parte do
|
|
254
|
+
# roteiro é falada com o registro dela — o gancho mais aceso, o número mais
|
|
255
|
+
# devagar, o fecho mais alto — e as partes são costuradas com um respiro. O
|
|
256
|
+
# tempo de CADA PALAVRA volta junto (WordBoundary do edge-tts): é o que
|
|
257
|
+
# sincroniza a tipografia com a voz.
|
|
258
|
+
REGISTRO = {
|
|
259
|
+
"gancho": {"ritmo": "+6%", "tom": "+3Hz", "respiro": 0.35},
|
|
260
|
+
"numero": {"ritmo": "-7%", "tom": "-1Hz", "respiro": 0.45},
|
|
261
|
+
"contraste": {"ritmo": "+2%", "tom": "+1Hz", "respiro": 0.4},
|
|
262
|
+
"lista": {"ritmo": "+0%", "tom": "+0Hz", "respiro": 0.35},
|
|
263
|
+
"citacao": {"ritmo": "-10%", "tom": "-2Hz", "respiro": 0.5},
|
|
264
|
+
"cta": {"ritmo": "+4%", "tom": "+2Hz", "respiro": 0.2},
|
|
265
|
+
"normal": {"ritmo": "+0%", "tom": "+0Hz", "respiro": 0.3},
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
def _parte_edge(texto, voz, ritmo, tom, saida):
|
|
270
|
+
import asyncio
|
|
271
|
+
import edge_tts
|
|
272
|
+
|
|
273
|
+
async def rodar():
|
|
274
|
+
c = edge_tts.Communicate(texto, voz, rate=ritmo, pitch=tom, boundary="WordBoundary")
|
|
275
|
+
palavras = []
|
|
276
|
+
with open(saida, "wb") as fh:
|
|
277
|
+
async for ch in c.stream():
|
|
278
|
+
if ch["type"] == "audio":
|
|
279
|
+
fh.write(ch["data"])
|
|
280
|
+
elif ch["type"] == "WordBoundary":
|
|
281
|
+
de = ch["offset"] / 1e7
|
|
282
|
+
palavras.append({"de": round(de, 3), "ate": round(de + ch["duration"] / 1e7, 3),
|
|
283
|
+
"texto": ch["text"]})
|
|
284
|
+
return palavras
|
|
285
|
+
return asyncio.run(rodar())
|
|
286
|
+
|
|
287
|
+
|
|
288
|
+
def _duracao(arquivo):
|
|
289
|
+
r = subprocess.run(["ffprobe", "-v", "error", "-show_entries", "format=duration",
|
|
290
|
+
"-of", "csv=p=0", str(arquivo)], capture_output=True, text=True, timeout=30)
|
|
291
|
+
try:
|
|
292
|
+
return float(r.stdout.strip())
|
|
293
|
+
except ValueError:
|
|
294
|
+
return 0.0
|
|
295
|
+
|
|
296
|
+
|
|
297
|
+
def comando_roteiro(args):
|
|
298
|
+
partes = json.loads(Path(args.arquivo).read_text(encoding="utf-8"))
|
|
299
|
+
if not partes:
|
|
300
|
+
return {"ok": False, "error": "o roteiro veio vazio"}
|
|
301
|
+
if not edge_disponivel() and not instalar_edge():
|
|
302
|
+
return {"ok": False, "error": "a narração precisa do pacote edge-tts",
|
|
303
|
+
"comoResolver": f"{sys.executable} -m pip install edge-tts"}
|
|
304
|
+
v = voz_de(args.voz)
|
|
305
|
+
with tempfile.TemporaryDirectory() as tmp:
|
|
306
|
+
lista, trechos, palavras, t = [], [], [], 0.0
|
|
307
|
+
for i, parte in enumerate(partes):
|
|
308
|
+
texto = re.sub(r"\s+", " ", str(parte.get("texto") or "")).strip()
|
|
309
|
+
if not texto:
|
|
310
|
+
trechos.append({"de": round(t, 3), "ate": round(t, 3), "palavras": []})
|
|
311
|
+
continue
|
|
312
|
+
reg = REGISTRO.get(parte.get("registro") or "normal", REGISTRO["normal"])
|
|
313
|
+
mp3 = Path(tmp) / f"p{i:02d}.mp3"
|
|
314
|
+
try:
|
|
315
|
+
ps = _parte_edge(texto, v["voz"], reg["ritmo"], reg["tom"], mp3)
|
|
316
|
+
except Exception as e:
|
|
317
|
+
return {"ok": False, "error": f"a voz falhou na parte {i + 1}: {str(e)[:200]}"}
|
|
318
|
+
dur = _duracao(mp3)
|
|
319
|
+
wav = Path(tmp) / f"p{i:02d}.wav"
|
|
320
|
+
# Cada parte vira wav com o respiro no fim: costurar mp3 direto
|
|
321
|
+
# deixa um clique e um silêncio de enchimento entre as partes.
|
|
322
|
+
subprocess.run(["ffmpeg", "-y", "-loglevel", "error", "-i", str(mp3), "-af",
|
|
323
|
+
f"apad=pad_dur={reg['respiro']}", "-ar", "44100", "-ac", "1", str(wav)],
|
|
324
|
+
capture_output=True, timeout=60)
|
|
325
|
+
lista.append(wav)
|
|
326
|
+
ws = [{"de": round(t + w["de"], 3), "ate": round(t + w["ate"], 3), "texto": w["texto"]} for w in ps]
|
|
327
|
+
palavras += ws
|
|
328
|
+
trechos.append({"de": round(t, 3), "ate": round(t + dur, 3), "palavras": ws})
|
|
329
|
+
t += dur + reg["respiro"]
|
|
330
|
+
roteiro_txt = Path(tmp) / "lista.txt"
|
|
331
|
+
roteiro_txt.write_text("".join(f"file '{w}'\n" for w in lista), encoding="utf-8")
|
|
332
|
+
r = subprocess.run(["ffmpeg", "-y", "-loglevel", "error", "-f", "concat", "-safe", "0",
|
|
333
|
+
"-i", str(roteiro_txt), "-af", "loudnorm=I=-14:TP=-1.5:LRA=9",
|
|
334
|
+
"-c:a", "libmp3lame", "-q:a", "3", str(args.saida)],
|
|
335
|
+
capture_output=True, timeout=180)
|
|
336
|
+
if r.returncode != 0:
|
|
337
|
+
return {"ok": False, "error": (r.stderr or b"").decode("utf-8", "ignore")[-300:]}
|
|
338
|
+
return {"ok": True, "arquivo": str(args.saida), "motor": "edge", "voz": v["voz"],
|
|
339
|
+
"segundos": round(t, 3), "partes": trechos, "palavras": palavras}
|
|
340
|
+
|
|
341
|
+
|
|
248
342
|
def main():
|
|
249
343
|
p = argparse.ArgumentParser(description="Narração do PrimoCode Studio")
|
|
250
344
|
sub = p.add_subparsers(dest="comando", required=True)
|
|
@@ -258,11 +352,18 @@ def main():
|
|
|
258
352
|
f.add_argument("--ritmo", default="")
|
|
259
353
|
f.add_argument("--tom", default="")
|
|
260
354
|
|
|
355
|
+
r = sub.add_parser("roteiro")
|
|
356
|
+
r.add_argument("--arquivo", required=True)
|
|
357
|
+
r.add_argument("--saida", required=True)
|
|
358
|
+
r.add_argument("--voz", default="thalita")
|
|
359
|
+
|
|
261
360
|
sub.add_parser("vozes")
|
|
262
361
|
|
|
263
362
|
args = p.parse_args()
|
|
264
363
|
if args.comando == "vozes":
|
|
265
364
|
saida = {"ok": True, "vozes": VOZES, "estilos": list(ESTILOS.keys())}
|
|
365
|
+
elif args.comando == "roteiro":
|
|
366
|
+
saida = comando_roteiro(args)
|
|
266
367
|
else:
|
|
267
368
|
saida = comando_falar(args)
|
|
268
369
|
|
package/studio/rostos.py
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""rostos.py — onde estão as pessoas em cada foto.
|
|
3
|
+
|
|
4
|
+
"Aparecem três homens ali, ela está cortada, não dá pra ver ninguém."
|
|
5
|
+
(25/09/2026)
|
|
6
|
+
|
|
7
|
+
Foto deitada num vídeo em pé perde dois terços da largura. Recortar pelo
|
|
8
|
+
centro corta as pessoas. Aqui se acha o retângulo que cobre todos os rostos
|
|
9
|
+
da foto (MediaPipe, o mesmo do recorte da pessoa), e o vídeo enquadra nele —
|
|
10
|
+
ou, quando os rostos não cabem no recorte, mostra a foto inteira.
|
|
11
|
+
|
|
12
|
+
Uso:
|
|
13
|
+
python3 rostos.py foto1.webp foto2.jpg …
|
|
14
|
+
Saída (JSON): {"ok": true, "fotos": {"foto1.webp": {"largura", "altura", "n",
|
|
15
|
+
"cx", "cy", "x0", "x1", "y0", "y1"}}} (tudo de 0 a 1)
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
import json
|
|
19
|
+
import sys
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def main():
|
|
23
|
+
try:
|
|
24
|
+
import cv2
|
|
25
|
+
import mediapipe as mp
|
|
26
|
+
except Exception as e: # sem as bibliotecas, ninguém é enquadrado — e não é erro
|
|
27
|
+
print(json.dumps({"ok": False, "error": f"sem mediapipe: {e}"}))
|
|
28
|
+
return
|
|
29
|
+
det = mp.solutions.face_detection.FaceDetection(model_selection=1, min_detection_confidence=0.45)
|
|
30
|
+
fotos = {}
|
|
31
|
+
for caminho in sys.argv[1:]:
|
|
32
|
+
img = cv2.imread(caminho)
|
|
33
|
+
if img is None:
|
|
34
|
+
continue
|
|
35
|
+
h, w = img.shape[:2]
|
|
36
|
+
r = det.process(cv2.cvtColor(img, cv2.COLOR_BGR2RGB))
|
|
37
|
+
caixas = []
|
|
38
|
+
for d in (r.detections or []):
|
|
39
|
+
b = d.location_data.relative_bounding_box
|
|
40
|
+
caixas.append((max(0, b.xmin), max(0, b.ymin), min(1, b.xmin + b.width), min(1, b.ymin + b.height)))
|
|
41
|
+
item = {"largura": w, "altura": h, "n": len(caixas)}
|
|
42
|
+
if caixas:
|
|
43
|
+
x0 = min(c[0] for c in caixas); y0 = min(c[1] for c in caixas)
|
|
44
|
+
x1 = max(c[2] for c in caixas); y1 = max(c[3] for c in caixas)
|
|
45
|
+
item.update({"x0": round(x0, 3), "y0": round(y0, 3), "x1": round(x1, 3), "y1": round(y1, 3),
|
|
46
|
+
"cx": round((x0 + x1) / 2, 3), "cy": round((y0 + y1) / 2, 3)})
|
|
47
|
+
fotos[caminho] = item
|
|
48
|
+
print(json.dumps({"ok": True, "fotos": fotos}))
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
if __name__ == "__main__":
|
|
52
|
+
main()
|