@promovaweb/ebookfy 0.1.1 → 0.3.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.
Files changed (3) hide show
  1. package/README.md +7 -4
  2. package/dist/bin/main.js +451 -177
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -15,11 +15,12 @@ ebookfy --version
15
15
 
16
16
  ## Primeiro livro
17
17
 
18
- Use o template privado com acesso ao repositório da organização. A primeira execução pode usar o livro de exemplo como está.
18
+ Em um repositório vazio, execute `ebookfy init`. Para começar em uma pasta nova, siga o exemplo abaixo. O Git precisa ter acesso ao [starter kit privado](https://github.com/promovaweb/ebookfy-starter-kit). O comando copia a ficha, o capítulo ilustrado, os materiais editoriais e as skills já instaladas.
19
19
 
20
20
  ```bash
21
- gh repo clone promovaweb/ebookfy-starter-kit meu-livro
21
+ git init meu-livro
22
22
  cd meu-livro
23
+ ebookfy init
23
24
  ebookfy info
24
25
  ebookfy
25
26
  ebookfy build
@@ -27,7 +28,9 @@ ebookfy build
27
28
 
28
29
  Edite `ebook.toml` na raiz para definir autoria, capa, ordem dos capítulos, pasta de saída e formatos. Cada capítulo tem seu próprio `CHAPTER.md` e pode guardar figuras na pasta `imagens/` ao lado do texto. O CLI imprime os caminhos dos arquivos gerados.
29
30
 
30
- ![TUI do Ebookfy com a ficha editorial e o sumário do manual](manual/07-terminal/imagens/tui-livro.png)
31
+ Na aba **Livro**, escolha uma opção com as setas e abra com Enter ou com um clique. Use `f` para a ficha, `c` para capítulos, `a` para os arquivos gerados e `g` para o guia.
32
+
33
+ ![Menu da TUI com as quatro opções e o sumário do manual](manual/07-terminal/imagens/tui-livro.png)
31
34
 
32
35
  ## Skills e documentação
33
36
 
@@ -37,7 +40,7 @@ O starter kit já traz as skills numeradas. Para instalá-las em outro projeto,
37
40
  npx skills add promovaweb/ebookfy -a universal -a claude-code -a codex -a opencode -y
38
41
  ```
39
42
 
40
- Consulte o [manual editável](manual/01-primeira-edicao/CHAPTER.md), a [documentação completa](docs/README.md) ou baixe o [PDF](ebook/manual-ebookfy-v0.1.1.pdf), o [EPUB](ebook/manual-ebookfy-v0.1.1.epub) e o [MOBI](ebook/manual-ebookfy-v0.1.1.mobi). Em automações, use `ebookfy info --json`. A referência embutida está disponível com `ebookfy --skill`.
43
+ Consulte o [manual editável](manual/01-primeira-edicao/CHAPTER.md), a [documentação completa](docs/README.md) ou baixe o [PDF](ebook/manual-ebookfy-v0.3.0.pdf), o [EPUB](ebook/manual-ebookfy-v0.3.0.epub) e o [MOBI](ebook/manual-ebookfy-v0.3.0.mobi). Em automações, use `ebookfy info --json`. A referência embutida está disponível com `ebookfy --skill`.
41
44
 
42
45
  ## Feito com
43
46
 
package/dist/bin/main.js CHANGED
@@ -99,7 +99,7 @@ var package_default;
99
99
  var init_package = __esm(() => {
100
100
  package_default = {
101
101
  name: "@promovaweb/ebookfy",
102
- version: "0.1.1",
102
+ version: "0.3.0",
103
103
  description: "Organize cap\xEDtulos e exporte seu ebook em PDF, EPUB e MOBI.",
104
104
  type: "module",
105
105
  private: false,
@@ -438,8 +438,9 @@ npm install -g @promovaweb/ebookfy
438
438
  pandoc --version
439
439
  weasyprint --version
440
440
  ebook-convert --version
441
- gh repo clone promovaweb/ebookfy-starter-kit meu-livro
441
+ git init meu-livro
442
442
  cd meu-livro
443
+ ebookfy init
443
444
  ebookfy info
444
445
  ~~~
445
446
 
@@ -454,7 +455,7 @@ Abra o PDF na pasta indicada em [output]. Siga um item do sum\xE1rio e veja onde
454
455
 
455
456
  ## Transformar o exemplo no seu livro
456
457
 
457
- Suponha que voc\xEA v\xE1 distribuir um caderno de oficina. Comece com uma c\xF3pia do starter kit. No GitHub, o bot\xE3o **Use this template** cria um reposit\xF3rio para o seu livro. Se usar o comando de clone acima, o remoto ainda aponta para o starter kit. Confira \`git remote -v\` antes de enviar altera\xE7\xF5es.
458
+ Suponha que voc\xEA v\xE1 distribuir um caderno de oficina. Use \`ebookfy init\` dentro do seu reposit\xF3rio vazio. O comando obt\xE9m a edi\xE7\xE3o v0.1.0 do starter kit pelo Git autenticado, preserva o diret\xF3rio .git do projeto e instala o conte\xFAdo do modelo, inclusive as 15 skills. Confira a ficha com \`ebookfy info\` e veja os arquivos novos com \`git status --short\`. Uma pasta vazia sem Git tamb\xE9m aceita o comando. Se houver um README ou outro arquivo na pasta, o CLI informa o nome encontrado e encerra a opera\xE7\xE3o.
458
459
 
459
460
  Na ficha, escreva \`title = "Caderno da oficina"\`, \`slug = "caderno-da-oficina"\` e um identificador pr\xF3prio em \`identifier\`. O t\xEDtulo aparece na ficha e nos metadados. O slug entra no nome do arquivo. O identificador acompanha a obra no cat\xE1logo. Registre a autoria antes de gerar a capa para que o nome no desenho coincida com o nome que aparece no leitor digital.
460
461
 
@@ -772,7 +773,7 @@ var init_topics = __esm(() => {
772
773
  // docs/README.md
773
774
  var README_default = `# Documenta\xE7\xE3o do Ebookfy
774
775
 
775
- Use o [starter kit privado](https://github.com/promovaweb/ebookfy-starter-kit) para criar um projeto com uma ficha TOML, um cap\xEDtulo ilustrado e as 15 skills instaladas. Para come\xE7ar com o livro de exemplo, instale o CLI e siga o primeiro guia. Se j\xE1 tem um manuscrito, comece pelo guia de migra\xE7\xE3o.
776
+ Use o [starter kit privado](https://github.com/promovaweb/ebookfy-starter-kit) para criar um projeto com uma ficha TOML, um cap\xEDtulo ilustrado e as 15 skills instaladas. Para iniciar um reposit\xF3rio vazio com o livro de exemplo, instale o CLI e execute \`ebookfy init\` na raiz. Se j\xE1 tem um manuscrito, comece pelo guia de migra\xE7\xE3o.
776
777
 
777
778
  ## Produzir o livro
778
779
 
@@ -800,7 +801,7 @@ Para consultar o guia editorial no pr\xF3prio terminal, execute \`ebookfy --skil
800
801
 
801
802
  ## Ler o manual completo
802
803
 
803
- O manual re\xFAne os doze guias na ordem configurada no TOML do framework. Escolha [PDF](../ebook/manual-ebookfy-v0.1.1.pdf) para p\xE1ginas fixas, [EPUB](../ebook/manual-ebookfy-v0.1.1.epub) para ajustar a fonte no leitor ou [MOBI](../ebook/manual-ebookfy-v0.1.1.mobi) para leitores compat\xEDveis.
804
+ O manual re\xFAne os doze guias na ordem configurada no TOML do framework. Escolha [PDF](../ebook/manual-ebookfy-v0.3.0.pdf) para p\xE1ginas fixas, [EPUB](../ebook/manual-ebookfy-v0.3.0.epub) para ajustar a fonte no leitor ou [MOBI](../ebook/manual-ebookfy-v0.3.0.mobi) para leitores compat\xEDveis.
804
805
  `;
805
806
  var init_README = () => {};
806
807
 
@@ -809,38 +810,7 @@ var CHAPTER_default7 = "# Consultar os comandos e a sa\xEDda JSON\n\n## Conven\x
809
810
  var init_CHAPTER7 = () => {};
810
811
 
811
812
  // manual/07-terminal/CHAPTER.md
812
- var CHAPTER_default8 = `# Usar a interface de terminal
813
-
814
- Abra um terminal na pasta do livro ou dentro de um cap\xEDtulo e execute \`ebookfy\`. Para abrir diretamente a ficha quando sua prefer\xEAncia inicial aponta para outra aba, use \`ebookfy tui --tab overview\`. O aplicativo l\xEA o TOML do projeto e os t\xEDtulos dos arquivos de cap\xEDtulo.
815
-
816
- ![Ficha do Manual do Ebookfy com autoria, edi\xE7\xE3o, tr\xEAs formatos e os doze cap\xEDtulos na ordem configurada](imagens/tui-livro.png)
817
-
818
- Na captura, a aba **Livro** est\xE1 selecionada. A primeira linha do terminal identifica o aplicativo e seu runtime. Dentro do quadro, **Edi\xE7\xE3o** pertence ao livro. A lista numerada reproduz a ordem declarada em \`[[chapters]]\`, e o rodap\xE9 informa a quantidade de cap\xEDtulos carregados.
819
-
820
- ## Conferir uma altera\xE7\xE3o durante a escrita
821
-
822
- Mantenha a TUI aberta e edite o t\xEDtulo de um cap\xEDtulo em outro terminal ou no editor. Salve o arquivo, volte \xE0 aba Livro e pressione \`r\`. Confira o novo t\xEDtulo na mesma posi\xE7\xE3o da lista. Depois, mova a tabela desse cap\xEDtulo no TOML e salve. A aba acompanha mudan\xE7as na configura\xE7\xE3o e permite conferir a nova ordem antes de compilar.
823
-
824
- | A\xE7\xE3o | Atalho |
825
- | --- | --- |
826
- | Abrir Livro, Prefer\xEAncias, Credenciais, Docs ou Sobre | Teclas de \`1\` a \`5\`, conforme a barra superior |
827
- | Avan\xE7ar ou voltar uma aba | Setas direita e esquerda ou \`]\` e \`[\` |
828
- | Alternar o foco entre pain\xE9is | \`Tab\` e \`Shift+Tab\` |
829
- | Abrir a lista de comandos da interface | \`Ctrl+K\` ou \`:\` |
830
- | Ver a ajuda de teclado e mouse | \`?\` |
831
- | Fechar um di\xE1logo | \`Esc\` |
832
- | Sair da TUI | \`q\` na tela principal |
833
-
834
- ## Consultar o manual sem sair do terminal
835
-
836
- Pressione \`4\` para abrir **Docs** ou execute \`ebookfy tui --tab docs\` diretamente no terminal. Use \`t\` para escolher um t\xF3pico. As setas para cima e para baixo percorrem o texto. \`PageUp\` e \`PageDown\` percorrem trechos maiores. Consulte o t\xF3pico de configura\xE7\xE3o para ajustar prefer\xEAncias pessoais ou a refer\xEAncia de comandos para conferir argumentos e op\xE7\xF5es.
837
-
838
- ![Aba Docs com o t\xF3pico ebook selecionado e o guia da primeira edi\xE7\xE3o aberto ao lado do \xEDndice](imagens/tui-docs.png)
839
-
840
- Em um script, use \`ebookfy info --json\` para ler a ficha sem abrir a TUI. A op\xE7\xE3o \xE9 apropriada para uma etapa de integra\xE7\xE3o cont\xEDnua que precisa extrair a lista de cap\xEDtulos ou os formatos antes do build.
841
-
842
- O t\xF3pico \`ebook\` re\xFAne os guias de instala\xE7\xE3o, configura\xE7\xE3o, cap\xEDtulos, migra\xE7\xE3o, exporta\xE7\xE3o e skills editoriais. Ele acompanha o aplicativo instalado. Voc\xEA pode consult\xE1-lo mesmo que apenas o manuscrito e o CLI estejam dispon\xEDveis na m\xE1quina.
843
- `;
813
+ var CHAPTER_default8 = "# Usar a interface de terminal\n\nAbra um terminal na pasta do livro ou dentro de um cap\xEDtulo e execute `ebookfy`. Para abrir diretamente o menu do livro quando sua prefer\xEAncia inicial aponta para outra aba, use `ebookfy tui --tab overview`. O aplicativo l\xEA o TOML do projeto e os t\xEDtulos dos arquivos de cap\xEDtulo.\n\n![Menu do livro ao lado do sum\xE1rio do Manual do Ebookfy](imagens/tui-livro.png)\n\nUse as setas para cima e para baixo para escolher uma op\xE7\xE3o. O marcador `>` indica a sele\xE7\xE3o. Pressione Enter ou clique no nome para abrir. Em terminais com 80 colunas ou mais, o sum\xE1rio aparece ao lado do menu. Em uma janela mais estreita, abra **Cap\xEDtulos** para consultar a mesma lista.\n\n| Op\xE7\xE3o | Tecla | O que voc\xEA encontra |\n| --- | --- | --- |\n| Ficha editorial | `f` | Autoria, editora, edi\xE7\xE3o, data, idioma, identificador e descri\xE7\xE3o do livro aberto. |\n| Cap\xEDtulos | `c` | T\xEDtulos na ordem de `[[chapters]]` e caminho de cada arquivo Markdown para edi\xE7\xE3o. |\n| Arquivos de sa\xEDda | `a` | Formatos da edi\xE7\xE3o e caminho de cada arquivo. **A gerar** indica que o arquivo ainda falta. **Dispon\xEDvel** indica que ele existe na pasta configurada. |\n| Guia do Ebookfy | `g` | Documenta\xE7\xE3o embutida e \xEDndice de assuntos na aba Docs. |\n\nNas tr\xEAs consultas do livro, pressione Esc para voltar ao menu. Para verificar uma exporta\xE7\xE3o, pressione `a`, execute `ebookfy build` em outro terminal e pressione `r`. Um arquivo dispon\xEDvel pode pertencer a uma compila\xE7\xE3o anterior. Gere a edi\xE7\xE3o novamente depois de editar o manuscrito.\n\n## Conferir uma altera\xE7\xE3o durante a escrita\n\nMantenha a TUI aberta e edite o t\xEDtulo de um cap\xEDtulo em outro terminal ou no editor. Salve o arquivo, volte \xE0 aba Livro e pressione `r`. Confira o novo t\xEDtulo na mesma posi\xE7\xE3o da lista. Depois, mova a tabela desse cap\xEDtulo no TOML e salve. A aba acompanha mudan\xE7as na configura\xE7\xE3o e permite conferir a nova ordem antes de compilar.\n\n| A\xE7\xE3o | Atalho |\n| --- | --- |\n| Abrir Livro, Prefer\xEAncias, Credenciais, Docs ou Sobre | Teclas de `1` a `5`, conforme a barra superior |\n| Avan\xE7ar ou voltar uma aba | Setas direita e esquerda ou `]` e `[` |\n| Alternar o foco entre pain\xE9is | `Tab` e `Shift+Tab` |\n| Abrir a lista de comandos da interface | `Ctrl+K` ou `:` |\n| Ver a ajuda de teclado e mouse | `?` |\n| Fechar um di\xE1logo | `Esc` |\n| Sair da TUI | `q` na tela principal |\n\n## Consultar o manual sem sair do terminal\n\nPressione `4` para abrir **Docs** ou execute `ebookfy tui --tab docs` diretamente no terminal. Use `t` para escolher um t\xF3pico. As setas para cima e para baixo percorrem o texto. `PageUp` e `PageDown` percorrem trechos maiores. Consulte o t\xF3pico de configura\xE7\xE3o para ajustar prefer\xEAncias pessoais ou a refer\xEAncia de comandos para conferir argumentos e op\xE7\xF5es.\n\n![Aba Docs com o t\xF3pico ebook selecionado e o guia da primeira edi\xE7\xE3o aberto ao lado do \xEDndice](imagens/tui-docs.png)\n\nEm um script, use `ebookfy info --json` para ler a ficha sem abrir a TUI. A op\xE7\xE3o \xE9 apropriada para uma etapa de integra\xE7\xE3o cont\xEDnua que precisa extrair a lista de cap\xEDtulos ou os formatos antes do build.\n\nO t\xF3pico `ebook` re\xFAne os guias de instala\xE7\xE3o, configura\xE7\xE3o, cap\xEDtulos, migra\xE7\xE3o, exporta\xE7\xE3o e skills editoriais. Ele acompanha o aplicativo instalado. Voc\xEA pode consult\xE1-lo mesmo que apenas o manuscrito e o CLI estejam dispon\xEDveis na m\xE1quina.\n";
844
814
  var init_CHAPTER8 = () => {};
845
815
 
846
816
  // manual/09-agentes/CHAPTER.md
@@ -1320,6 +1290,76 @@ var init_book = __esm(() => {
1320
1290
  };
1321
1291
  });
1322
1292
 
1293
+ // src/cli/commands/init.ts
1294
+ import { spawnSync as spawnSync2 } from "child_process";
1295
+ import { mkdirSync as mkdirSync3, readdirSync, renameSync as renameSync2, rmSync as rmSync2 } from "fs";
1296
+ import { join as join3 } from "path";
1297
+ function conferirDestino(destino, duranteCopia = false) {
1298
+ const ocupado = readdirSync(destino).find((nome) => nome !== ".git" && !(duranteCopia && nome === reserva));
1299
+ if (ocupado)
1300
+ throw error.usage("Execute ebookfy init em uma pasta vazia. Entrada encontrada: " + ocupado);
1301
+ }
1302
+ var repositorio = "https://github.com/promovaweb/ebookfy-starter-kit.git", versao = "v0.1.0", reserva = ".ebookfy-init", init;
1303
+ var init_init = __esm(() => {
1304
+ init_errors();
1305
+ init_exit_codes();
1306
+ init = {
1307
+ name: "init",
1308
+ description: "Inicia um livro na pasta atual usando o starter kit privado da Promovaweb.",
1309
+ examples: ["ebookfy init", "ebookfy init --json"],
1310
+ exitCodes: [ExitCode.NOT_FOUND, ExitCode.NETWORK_OR_API],
1311
+ run() {
1312
+ const destino = process.cwd();
1313
+ conferirDestino(destino);
1314
+ const temporaria = join3(destino, reserva);
1315
+ mkdirSync3(temporaria);
1316
+ const modelo = join3(temporaria, "modelo");
1317
+ const instalados = [];
1318
+ try {
1319
+ const git = spawnSync2("git", [
1320
+ "clone",
1321
+ "--quiet",
1322
+ "--depth",
1323
+ "1",
1324
+ "--branch",
1325
+ versao,
1326
+ repositorio,
1327
+ modelo
1328
+ ], { encoding: "utf8", env: { ...process.env, GIT_TERMINAL_PROMPT: "0" } });
1329
+ if (git.error?.code === "ENOENT")
1330
+ throw error.notFound("Instale o Git e execute ebookfy init novamente.");
1331
+ if (git.error || git.status !== 0) {
1332
+ throw error.network("Falha ao obter o starter kit privado. Confira sua conex\xE3o e o acesso com git ls-remote " + repositorio);
1333
+ }
1334
+ conferirDestino(destino, true);
1335
+ for (const nome of readdirSync(modelo)) {
1336
+ if (nome === ".git")
1337
+ continue;
1338
+ renameSync2(join3(modelo, nome), join3(destino, nome));
1339
+ instalados.push(nome);
1340
+ }
1341
+ const data = {
1342
+ diretorio: destino,
1343
+ template: repositorio,
1344
+ versao,
1345
+ entradas: instalados
1346
+ };
1347
+ return {
1348
+ data,
1349
+ text: "Livro iniciado em " + destino + `
1350
+ Edite ebook.toml, confira a ficha com ebookfy info e exporte com ebookfy build.`
1351
+ };
1352
+ } catch (falha) {
1353
+ for (const nome of instalados.reverse())
1354
+ renameSync2(join3(destino, nome), join3(modelo, nome));
1355
+ throw falha;
1356
+ } finally {
1357
+ rmSync2(temporaria, { recursive: true, force: true });
1358
+ }
1359
+ }
1360
+ };
1361
+ });
1362
+
1323
1363
  // src/cli/commands/about.ts
1324
1364
  function aboutData() {
1325
1365
  return {
@@ -1583,9 +1623,9 @@ var init_crypto = __esm(() => {
1583
1623
  });
1584
1624
 
1585
1625
  // src/config/credentials.ts
1586
- import { readFileSync as readFileSync4, writeFileSync as writeFileSync4, unlinkSync, mkdtempSync as mkdtempSync2, renameSync as renameSync2, rmSync as rmSync2, chmodSync as chmodSync2 } from "fs";
1626
+ import { readFileSync as readFileSync4, writeFileSync as writeFileSync4, unlinkSync, mkdtempSync as mkdtempSync2, renameSync as renameSync3, rmSync as rmSync3, chmodSync as chmodSync2 } from "fs";
1587
1627
  import { randomBytes as randomBytes2 } from "crypto";
1588
- import { join as join3 } from "path";
1628
+ import { join as join4 } from "path";
1589
1629
  function validateName(name) {
1590
1630
  const clean = name.trim().toLowerCase();
1591
1631
  if (!NAME_PATTERN.test(clean)) {
@@ -1712,24 +1752,24 @@ function rotateMasterKey(fromEnv = false) {
1712
1752
  let replaced = false;
1713
1753
  let retainBackup = false;
1714
1754
  try {
1715
- staging = mkdtempSync2(join3(paths.base(), ".rotate-"));
1755
+ staging = mkdtempSync2(join4(paths.base(), ".rotate-"));
1716
1756
  chmodSync2(staging, 448);
1717
1757
  if (previous)
1718
- writeFileSync4(join3(staging, "previous.key"), previous, { mode: 384 });
1719
- const stagedKey = join3(staging, "master.key");
1720
- const stagedVault = join3(staging, "credentials.json");
1758
+ writeFileSync4(join4(staging, "previous.key"), previous, { mode: 384 });
1759
+ const stagedKey = join4(staging, "master.key");
1760
+ const stagedVault = join4(staging, "credentials.json");
1721
1761
  writeFileSync4(stagedKey, `${fresh.toString("hex")}
1722
1762
  `, { mode: 384 });
1723
1763
  writeFileSync4(stagedVault, `${JSON.stringify(envelope, null, 2)}
1724
1764
  `, { mode: 384 });
1725
- renameSync2(stagedKey, keyPath);
1765
+ renameSync3(stagedKey, keyPath);
1726
1766
  replaced = true;
1727
- renameSync2(stagedVault, paths.credentials());
1767
+ renameSync3(stagedVault, paths.credentials());
1728
1768
  } catch {
1729
1769
  if (replaced) {
1730
1770
  try {
1731
1771
  if (previous)
1732
- renameSync2(join3(staging, "previous.key"), keyPath);
1772
+ renameSync3(join4(staging, "previous.key"), keyPath);
1733
1773
  else
1734
1774
  unlinkSync(keyPath);
1735
1775
  } catch {
@@ -1740,7 +1780,7 @@ function rotateMasterKey(fromEnv = false) {
1740
1780
  throw error.credentials("Could not rotate the master key; the vault was not changed.");
1741
1781
  } finally {
1742
1782
  if (staging && !retainBackup)
1743
- rmSync2(staging, { recursive: true, force: true });
1783
+ rmSync3(staging, { recursive: true, force: true });
1744
1784
  }
1745
1785
  if (!fromEnv)
1746
1786
  delete process.env[MASTER_KEY_VARIABLE];
@@ -2419,6 +2459,8 @@ function terminalTheme(colors) {
2419
2459
  error: ref(slots.error),
2420
2460
  barBackground: RGBA.defaultBackground(),
2421
2461
  barText: ref(slots.textDim),
2462
+ headerBackground: ref(slots.accent),
2463
+ headerText: ref(slots.keyText),
2422
2464
  keyBackground: ref(slots.accent),
2423
2465
  keyText: ref(slots.keyText)
2424
2466
  };
@@ -2479,23 +2521,25 @@ var init_theme = __esm(() => {
2479
2521
  themes = {
2480
2522
  night: {
2481
2523
  name: "night",
2482
- background: "#1a1b26",
2483
- surface: "#1f2335",
2484
- surfaceHigh: "#24283b",
2485
- border: "#3b4261",
2486
- borderActive: "#7aa2f7",
2487
- text: "#c0caf5",
2488
- textDim: "#565f89",
2489
- textStrong: "#e0e6ff",
2490
- accent: "#7aa2f7",
2491
- accentSecondary: "#bb9af7",
2524
+ background: "#000A0E",
2525
+ surface: "#001117",
2526
+ surfaceHigh: "#03212A",
2527
+ border: "#5F7D8C",
2528
+ borderActive: "#5EEDE1",
2529
+ text: "#F2F8F9",
2530
+ textDim: "#B2C6CE",
2531
+ textStrong: "#F2F8F9",
2532
+ accent: "#5EEDE1",
2533
+ accentSecondary: "#C4B5FD",
2492
2534
  ok: "#9ece6a",
2493
- warn: "#e0af68",
2535
+ warn: "#FCD34D",
2494
2536
  error: "#f7768e",
2495
- barBackground: "#16161e",
2496
- barText: "#a9b1d6",
2497
- keyBackground: "#3d59a1",
2498
- keyText: "#ffffff"
2537
+ barBackground: "#001117",
2538
+ barText: "#B2C6CE",
2539
+ headerBackground: "#6D28D9",
2540
+ headerText: "#FFFFFF",
2541
+ keyBackground: "#5EEDE1",
2542
+ keyText: "#001117"
2499
2543
  },
2500
2544
  day: {
2501
2545
  name: "day",
@@ -2505,16 +2549,18 @@ var init_theme = __esm(() => {
2505
2549
  border: "#a8aecb",
2506
2550
  borderActive: "#2e7de9",
2507
2551
  text: "#3760bf",
2508
- textDim: "#848cb5",
2552
+ textDim: "#46506A",
2509
2553
  textStrong: "#1b2a5e",
2510
2554
  accent: "#2e7de9",
2511
- accentSecondary: "#9854f1",
2512
- ok: "#587539",
2513
- warn: "#8c6c3e",
2555
+ accentSecondary: "#64349A",
2556
+ ok: "#365918",
2557
+ warn: "#734C13",
2514
2558
  error: "#f52a65",
2515
2559
  barBackground: "#c4c8da",
2516
2560
  barText: "#3760bf",
2517
- keyBackground: "#2e7de9",
2561
+ headerBackground: "#512A88",
2562
+ headerText: "#FFFFFF",
2563
+ keyBackground: "#234CAB",
2518
2564
  keyText: "#ffffff"
2519
2565
  }
2520
2566
  };
@@ -2543,13 +2589,13 @@ var init_theme = __esm(() => {
2543
2589
  // src/tui/icons.ts
2544
2590
  import { existsSync as existsSync3 } from "fs";
2545
2591
  import { homedir as homedir2 } from "os";
2546
- import { join as join4 } from "path";
2592
+ import { join as join5 } from "path";
2547
2593
  function detectIconSet({ env, home = homedir2(), exists = existsSync3 }) {
2548
2594
  const term = env.TERM ?? "";
2549
2595
  const program = (env.TERM_PROGRAM ?? "").toLowerCase();
2550
2596
  if (term === "linux" || term === "dumb")
2551
2597
  return "ascii";
2552
- if (program === "ghostty" || program === "wezterm" || term === "xterm-ghostty" || term === "xterm-kitty" || term === "wezterm" || env.GHOSTTY_RESOURCES_DIR || env.KITTY_WINDOW_ID || env.WEZTERM_PANE || env.OMARCHY_PATH || exists(join4(home, ".local", "share", "omarchy"))) {
2598
+ if (program === "ghostty" || program === "wezterm" || term === "xterm-ghostty" || term === "xterm-kitty" || term === "wezterm" || env.GHOSTTY_RESOURCES_DIR || env.KITTY_WINDOW_ID || env.WEZTERM_PANE || env.OMARCHY_PATH || exists(join5(home, ".local", "share", "omarchy"))) {
2553
2599
  return "nerd";
2554
2600
  }
2555
2601
  return "unicode";
@@ -2880,8 +2926,8 @@ class Overlays {
2880
2926
  resolve(value);
2881
2927
  };
2882
2928
  const paint = this.buttons(body, [
2883
- { key: "y", label: options.confirmLabel ?? "Confirm", danger: options.danger, run: () => answer(true) },
2884
- { key: "Esc", label: "Cancel", run: () => answer(false) }
2929
+ { key: "y", label: options.confirmLabel ?? "Confirmar", danger: options.danger, run: () => answer(true) },
2930
+ { key: "Esc", label: "Cancelar", run: () => answer(false) }
2885
2931
  ], () => focus);
2886
2932
  return {
2887
2933
  onKey: (key) => {
@@ -2941,7 +2987,7 @@ class Overlays {
2941
2987
  close();
2942
2988
  resolve(undefined);
2943
2989
  };
2944
- this.buttons(body, [{ key: "Enter", label: "OK", run: submit }, { key: "Esc", label: "Cancel", run: cancel }], () => 0);
2990
+ this.buttons(body, [{ key: "Enter", label: "OK", run: submit }, { key: "Esc", label: "Cancelar", run: cancel }], () => 0);
2945
2991
  render();
2946
2992
  return {
2947
2993
  onKey: (key) => {
@@ -3096,7 +3142,7 @@ class Overlays {
3096
3142
  list.setItems(options.items.map((text) => ({ text })));
3097
3143
  for (let i = 0;i < (options.initial ?? 0); i++)
3098
3144
  list.key({ name: "down" }, false);
3099
- body.add(new TextRenderable(this.renderer, { content: "\u2191\u2193 move \xB7 Enter choose \xB7 Esc cancel", fg: this.theme.textDim, wrapMode: "none", selectable: false }));
3145
+ body.add(new TextRenderable(this.renderer, { content: "\u2191\u2193 escolher \xB7 Enter abrir \xB7 Esc voltar", fg: this.theme.textDim, wrapMode: "none", selectable: false }));
3100
3146
  return {
3101
3147
  onKey: (key) => {
3102
3148
  if (key.name === "escape") {
@@ -3140,7 +3186,7 @@ class Overlays {
3140
3186
  field.content = `${this.icons.select || ">"} ${query}\u258F`;
3141
3187
  filtered = entries.filter((entry) => matches(query, entry.label));
3142
3188
  list.setItems(filtered.map((entry) => ({ text: withIcon(this.icons, entry.icon ?? "select", entry.label), hint: entry.hint })));
3143
- empty.content = filtered.length ? `${filtered.length} command(s) \xB7 Enter run \xB7 Esc close` : "No command matches";
3189
+ empty.content = filtered.length ? `${filtered.length} comando(s) \xB7 Enter executar \xB7 Esc voltar` : "Nenhum comando encontrado";
3144
3190
  };
3145
3191
  update();
3146
3192
  return {
@@ -3918,57 +3964,281 @@ var init_about2 = __esm(() => {
3918
3964
  });
3919
3965
 
3920
3966
  // src/tui/screens/overview.ts
3921
- import { resolve as resolve3 } from "path";
3922
- var overviewScreen;
3923
- var init_overview = __esm(() => {
3924
- init_project();
3925
- init_components();
3926
- overviewScreen = {
3967
+ import { statSync as statSync4 } from "fs";
3968
+ import { join as join6, resolve as resolve3 } from "path";
3969
+ import { BoxRenderable as BoxRenderable4, TextAttributes as TextAttributes3, TextRenderable as TextRenderable4 } from "@opentui/core";
3970
+ function sumario(ctx, livro, caminhos) {
3971
+ const lista = scrollPanel(ctx.renderer, ctx.theme, {
3972
+ title: caminhos ? "Cap\xEDtulos e fontes" : "Sum\xE1rio",
3973
+ flexGrow: 1
3974
+ });
3975
+ for (const [i, capitulo] of livro.chapters.entries()) {
3976
+ const linha = new BoxRenderable4(ctx.renderer, {
3977
+ flexDirection: "row",
3978
+ flexShrink: 0,
3979
+ gap: 1
3980
+ });
3981
+ linha.add(new TextRenderable4(ctx.renderer, {
3982
+ content: String(i + 1).padStart(2, "0"),
3983
+ fg: ctx.theme.accentSecondary,
3984
+ flexShrink: 0
3985
+ }));
3986
+ linha.add(new TextRenderable4(ctx.renderer, {
3987
+ content: capitulo.title,
3988
+ fg: ctx.theme.text,
3989
+ flexShrink: 1,
3990
+ minWidth: 0
3991
+ }));
3992
+ lista.add(linha);
3993
+ if (caminhos)
3994
+ lista.add(dim(ctx.renderer, ctx.theme, capitulo.file));
3995
+ }
3996
+ return lista;
3997
+ }
3998
+ function criarTelaLivro() {
3999
+ let selecionado = 0;
4000
+ let detalhe = false;
4001
+ let pintar;
4002
+ let temLivro = false;
4003
+ let rolagem;
4004
+ function abrir(ctx, i) {
4005
+ if (i === 3) {
4006
+ ctx.goTo("docs");
4007
+ return;
4008
+ }
4009
+ if (!temLivro)
4010
+ return;
4011
+ selecionado = i;
4012
+ detalhe = true;
4013
+ ctx.refresh();
4014
+ }
4015
+ function voltar(ctx) {
4016
+ detalhe = false;
4017
+ ctx.refresh();
4018
+ }
4019
+ return {
3927
4020
  id: "overview",
3928
4021
  title: "Livro",
3929
4022
  icon: "overview",
3930
- description: "Ficha editorial e ordem de leitura",
4023
+ description: "Menu do livro, cap\xEDtulos e arquivos da edi\xE7\xE3o",
3931
4024
  watch: () => [resolve3(localizarLivro() ?? process.cwd(), "ebook.toml")],
3932
4025
  actions: [
3933
4026
  {
3934
4027
  keys: ["r"],
3935
- description: "recarregar",
4028
+ description: "atualizar",
3936
4029
  icon: "refresh",
3937
4030
  run: (ctx) => ctx.refresh()
3938
4031
  }
3939
4032
  ],
4033
+ onKey(tecla, ctx) {
4034
+ if (detalhe && (tecla === "escape" || tecla === "backspace")) {
4035
+ voltar(ctx);
4036
+ return true;
4037
+ }
4038
+ const indice = opcoes.findIndex((op) => op.atalho === tecla);
4039
+ if (indice >= 0 && (temLivro || indice === 3)) {
4040
+ abrir(ctx, indice);
4041
+ return true;
4042
+ }
4043
+ if (!temLivro)
4044
+ return false;
4045
+ if (tecla === "up" || tecla === "down") {
4046
+ const delta = tecla === "down" ? 1 : -1;
4047
+ if (detalhe)
4048
+ rolagem?.scrollBy(delta);
4049
+ else {
4050
+ selecionado = (selecionado + delta + opcoes.length) % opcoes.length;
4051
+ pintar?.();
4052
+ }
4053
+ return true;
4054
+ }
4055
+ if (!detalhe && (tecla === "return" || tecla === "space")) {
4056
+ abrir(ctx, selecionado);
4057
+ return true;
4058
+ }
4059
+ return false;
4060
+ },
3940
4061
  mount(ctx) {
3941
- const painel = scrollPanel(ctx.renderer, ctx.theme, {
3942
- title: "Ficha do ebook",
4062
+ const { renderer, theme } = ctx;
4063
+ const raiz = new BoxRenderable4(renderer, {
4064
+ flexDirection: "column",
3943
4065
  flexGrow: 1,
3944
- active: true
4066
+ minHeight: 0,
4067
+ gap: ctx.space.gapY
3945
4068
  });
4069
+ pintar = undefined;
4070
+ rolagem = undefined;
4071
+ let livro;
3946
4072
  try {
3947
- const livro = resumo();
3948
- painel.add(keyValueTable(ctx.renderer, ctx.theme, [
3949
- ["T\xEDtulo", livro.title],
3950
- ["Autoria", livro.authors.join(", ")],
3951
- ["Editora", livro.publisher],
3952
- ["Edi\xE7\xE3o", livro.version],
3953
- ["Idioma", livro.language],
3954
- ["Formatos", livro.output.formats.join(", ")],
3955
- ...livro.chapters.map((c, i) => [
3956
- String(i + 1),
3957
- c.title
3958
- ])
3959
- ]));
3960
- ctx.status(livro.chapters.length + " cap\xEDtulos");
4073
+ livro = resumo();
4074
+ temLivro = true;
3961
4075
  } catch (erro) {
3962
- painel.add(dim(ctx.renderer, ctx.theme, String(erro)));
3963
- ctx.status("Confira ebook.toml na raiz do projeto");
4076
+ temLivro = false;
4077
+ detalhe = false;
4078
+ const aviso = scrollPanel(renderer, theme, {
4079
+ title: "Abrir um livro",
4080
+ flexGrow: 1
4081
+ });
4082
+ aviso.add(heading(renderer, theme, "Projeto indispon\xEDvel"));
4083
+ aviso.add(dim(renderer, theme, erro instanceof Error ? erro.message : String(erro)));
4084
+ aviso.add(dim(renderer, theme, "Para come\xE7ar em uma pasta vazia, execute ebookfy init."));
4085
+ aviso.add(button(renderer, theme, {
4086
+ key: "g",
4087
+ label: "Abrir guia",
4088
+ onPress: () => ctx.goTo("docs")
4089
+ }));
4090
+ raiz.add(aviso);
4091
+ ctx.status("Projeto indispon\xEDvel");
4092
+ return raiz;
4093
+ }
4094
+ raiz.add(heading(renderer, theme, fitText(livro.title, renderer.width - 2 * ctx.space.pageX)));
4095
+ const formatos = livro.output.formats.map((f) => f.toUpperCase()).join(" / ");
4096
+ raiz.add(dim(renderer, theme, fitText(livro.publisher + " \xB7 v" + livro.version + " \xB7 " + formatos, renderer.width - 2 * ctx.space.pageX)));
4097
+ if (detalhe) {
4098
+ raiz.add(button(renderer, theme, {
4099
+ key: "Esc",
4100
+ label: "Voltar ao menu",
4101
+ onPress: () => voltar(ctx)
4102
+ }));
4103
+ const painel = selecionado === 1 ? sumario(ctx, livro, true) : scrollPanel(renderer, theme, {
4104
+ title: opcoes[selecionado].nome,
4105
+ flexGrow: 1
4106
+ });
4107
+ if (selecionado === 0) {
4108
+ painel.add(keyValueTable(renderer, theme, [
4109
+ ["Autoria", livro.authors.join(", ")],
4110
+ ["Editora", livro.publisher],
4111
+ ["Edi\xE7\xE3o", livro.version],
4112
+ ["Data", livro.date],
4113
+ ["Idioma", livro.language],
4114
+ ["Identificador", livro.identifier]
4115
+ ]));
4116
+ painel.add(dim(renderer, theme, livro.description));
4117
+ }
4118
+ if (selecionado === 2) {
4119
+ const pasta = localizarLivro();
4120
+ for (const formato of livro.output.formats) {
4121
+ const caminho = join6(livro.output.directory, livro.slug + "-v" + livro.version + "." + formato);
4122
+ const existe = statSync4(join6(pasta, caminho), {
4123
+ throwIfNoEntry: false
4124
+ })?.isFile();
4125
+ painel.add(new TextRenderable4(renderer, {
4126
+ content: formato.toUpperCase() + " " + (existe ? "Dispon\xEDvel" : "A gerar"),
4127
+ fg: existe ? theme.ok : theme.warn
4128
+ }));
4129
+ painel.add(dim(renderer, theme, caminho));
4130
+ }
4131
+ painel.add(heading(renderer, theme, "Gerar a edi\xE7\xE3o: ebookfy build"));
4132
+ }
4133
+ rolagem = painel.body;
4134
+ raiz.add(painel);
4135
+ ctx.status(opcoes[selecionado].nome);
4136
+ return raiz;
3964
4137
  }
3965
- return painel;
4138
+ const compacto = ctx.layout() === "compact";
4139
+ const corpo = new BoxRenderable4(renderer, {
4140
+ flexDirection: "row",
4141
+ flexGrow: 1,
4142
+ minHeight: 0,
4143
+ gap: ctx.space.gapX
4144
+ });
4145
+ const menu = scrollPanel(renderer, theme, {
4146
+ title: "Menu do livro",
4147
+ width: compacto ? "100%" : 32,
4148
+ flexGrow: 0,
4149
+ active: true
4150
+ });
4151
+ const linhas = opcoes.map((op, i) => {
4152
+ const item = new BoxRenderable4(renderer, {
4153
+ flexDirection: "column",
4154
+ flexShrink: 0,
4155
+ marginTop: i > 0 && !compacto ? 1 : 0
4156
+ });
4157
+ const rotulo = new TextRenderable4(renderer, {
4158
+ height: 1,
4159
+ attributes: TextAttributes3.BOLD,
4160
+ selectable: false
4161
+ });
4162
+ item.add(rotulo);
4163
+ item.add(new TextRenderable4(renderer, {
4164
+ content: " " + op.dica,
4165
+ fg: theme.textDim,
4166
+ selectable: false,
4167
+ height: 1
4168
+ }));
4169
+ menu.add(item);
4170
+ const atualizar = () => {
4171
+ const atual = i === selecionado;
4172
+ rotulo.content = (atual ? "> " : " ") + withIcon(ctx.icons, op.icone, op.nome) + " [" + op.atalho + "]";
4173
+ rotulo.fg = atual ? theme.keyText : theme[op.cor];
4174
+ rotulo.bg = atual ? theme.keyBackground : theme.surface;
4175
+ };
4176
+ clickable(renderer, item, {
4177
+ onClick: () => abrir(ctx, i),
4178
+ onHover: (ativo) => {
4179
+ if (ativo) {
4180
+ selecionado = i;
4181
+ pintar?.();
4182
+ }
4183
+ }
4184
+ });
4185
+ return { item, atualizar };
4186
+ });
4187
+ pintar = () => {
4188
+ for (const linha of linhas)
4189
+ linha.atualizar();
4190
+ menu.body.scrollChildIntoView(linhas[selecionado].item.id);
4191
+ };
4192
+ pintar();
4193
+ corpo.add(menu);
4194
+ if (!compacto)
4195
+ corpo.add(sumario(ctx, livro, false));
4196
+ raiz.add(corpo);
4197
+ ctx.status("\u2191\u2193 escolher \xB7 Enter abrir");
4198
+ return raiz;
3966
4199
  }
3967
4200
  };
4201
+ }
4202
+ var opcoes, overviewScreen;
4203
+ var init_overview = __esm(() => {
4204
+ init_project();
4205
+ init_components();
4206
+ init_icons();
4207
+ opcoes = [
4208
+ {
4209
+ nome: "Ficha editorial",
4210
+ atalho: "f",
4211
+ icone: "user",
4212
+ cor: "accent",
4213
+ dica: "Autoria, editora e edi\xE7\xE3o"
4214
+ },
4215
+ {
4216
+ nome: "Cap\xEDtulos",
4217
+ atalho: "c",
4218
+ icone: "list",
4219
+ cor: "accentSecondary",
4220
+ dica: "Ordem de leitura e fontes"
4221
+ },
4222
+ {
4223
+ nome: "Arquivos de sa\xEDda",
4224
+ atalho: "a",
4225
+ icone: "state",
4226
+ cor: "ok",
4227
+ dica: "PDF, EPUB e MOBI"
4228
+ },
4229
+ {
4230
+ nome: "Guia do Ebookfy",
4231
+ atalho: "g",
4232
+ icone: "docs",
4233
+ cor: "warn",
4234
+ dica: "Consultar o manual"
4235
+ }
4236
+ ];
4237
+ overviewScreen = criarTelaLivro();
3968
4238
  });
3969
4239
 
3970
4240
  // src/tui/screens/settings.ts
3971
- import { BoxRenderable as BoxRenderable4, TextRenderable as TextRenderable4 } from "@opentui/core";
4241
+ import { BoxRenderable as BoxRenderable5, TextRenderable as TextRenderable5 } from "@opentui/core";
3972
4242
  function createSettingsScreen() {
3973
4243
  let grid;
3974
4244
  let rows = [];
@@ -4103,7 +4373,7 @@ Accepted: ${def.values?.join(", ")}` : ""}`;
4103
4373
  value: String(value),
4104
4374
  default: String(definitionOf(key)?.default ?? "\u2014")
4105
4375
  }));
4106
- const root = new BoxRenderable4(renderer, {
4376
+ const root = new BoxRenderable5(renderer, {
4107
4377
  flexDirection: ctx.layout() === "compact" ? "column" : "row",
4108
4378
  gap: ctx.layout() === "compact" ? ctx.space.gapY : ctx.space.gapX,
4109
4379
  height: Math.min(renderer.height - (ctx.layout() === "compact" ? 4 : 8), ctx.layout() === "compact" ? 17 : rows.length + 6),
@@ -4116,7 +4386,7 @@ Accepted: ${def.values?.join(", ")}` : ""}`;
4116
4386
  height: ctx.layout() === "compact" ? 6 : undefined,
4117
4387
  flexGrow: 0
4118
4388
  });
4119
- const text = new TextRenderable4(renderer, {
4389
+ const text = new TextRenderable5(renderer, {
4120
4390
  fg: theme.text,
4121
4391
  wrapMode: "word"
4122
4392
  });
@@ -4161,7 +4431,7 @@ var init_settings2 = __esm(() => {
4161
4431
  });
4162
4432
 
4163
4433
  // src/tui/screens/credentials.ts
4164
- import { BoxRenderable as BoxRenderable5 } from "@opentui/core";
4434
+ import { BoxRenderable as BoxRenderable6 } from "@opentui/core";
4165
4435
  function createCredentialsScreen() {
4166
4436
  let grid;
4167
4437
  let rows = [];
@@ -4275,7 +4545,7 @@ function createCredentialsScreen() {
4275
4545
  const vault = vaultStatus();
4276
4546
  current = rows.find((row) => row.name === current)?.name ?? rows[0]?.name ?? "";
4277
4547
  ctx.status(`${rows.length} credential${rows.length === 1 ? "" : "s"} \xB7 master key: ${vault.masterKeySource}`);
4278
- const root = new BoxRenderable5(renderer, {
4548
+ const root = new BoxRenderable6(renderer, {
4279
4549
  flexDirection: ctx.layout() === "compact" ? "column" : "row",
4280
4550
  gap: ctx.layout() === "compact" ? ctx.space.gapY : ctx.space.gapX,
4281
4551
  height: Math.min(renderer.height - (ctx.layout() === "compact" ? 4 : 8), Math.max(8 + ctx.space.cardPadY * 2, rows.length + 4 + ctx.space.cardPadY * 2)),
@@ -4349,7 +4619,7 @@ var init_credentials3 = __esm(() => {
4349
4619
 
4350
4620
  // src/tui/screens/docs.ts
4351
4621
  import {
4352
- BoxRenderable as BoxRenderable6,
4622
+ BoxRenderable as BoxRenderable7,
4353
4623
  MarkdownRenderable,
4354
4624
  SyntaxStyle
4355
4625
  } from "@opentui/core";
@@ -4398,8 +4668,8 @@ function createDocsScreen() {
4398
4668
  let loadTopic;
4399
4669
  async function choose(ctx) {
4400
4670
  const selected = await ctx.choose({
4401
- title: "Documentation topic",
4402
- items: SKILL_TOPICS,
4671
+ title: "Escolher assunto",
4672
+ items: nomes,
4403
4673
  initial: topic
4404
4674
  });
4405
4675
  if (selected !== undefined)
@@ -4418,19 +4688,19 @@ function createDocsScreen() {
4418
4688
  id: "docs",
4419
4689
  title: "Docs",
4420
4690
  icon: "docs",
4421
- description: "Read the embedded documentation",
4691
+ description: "Consultar o manual no terminal",
4422
4692
  actions: [
4423
- { keys: ["t"], description: "choose topic", icon: "docs", run: choose },
4693
+ { keys: ["t"], description: "assuntos", icon: "docs", run: choose },
4424
4694
  {
4425
4695
  keys: ["up", "k"],
4426
- description: "scroll up",
4696
+ description: "rolar para cima",
4427
4697
  icon: "select",
4428
4698
  hidden: true,
4429
4699
  run: () => scroll(-1)
4430
4700
  },
4431
4701
  {
4432
4702
  keys: ["down", "j"],
4433
- description: "scroll down",
4703
+ description: "rolar para baixo",
4434
4704
  icon: "select",
4435
4705
  hidden: true,
4436
4706
  run: () => scroll(1)
@@ -4472,13 +4742,13 @@ function createDocsScreen() {
4472
4742
  },
4473
4743
  mount(ctx) {
4474
4744
  const { renderer, theme, icons } = ctx;
4475
- const root2 = new BoxRenderable6(renderer, {
4745
+ const root2 = new BoxRenderable7(renderer, {
4476
4746
  flexDirection: "row",
4477
4747
  flexGrow: 1,
4478
4748
  minHeight: 0,
4479
4749
  gap: ctx.space.gapX
4480
4750
  });
4481
- const host = new BoxRenderable6(renderer, {
4751
+ const host = new BoxRenderable7(renderer, {
4482
4752
  flexDirection: "column",
4483
4753
  flexGrow: 1,
4484
4754
  minWidth: 0,
@@ -4515,7 +4785,7 @@ function createDocsScreen() {
4515
4785
  clear();
4516
4786
  host.add(stateView(renderer, theme, icons, {
4517
4787
  kind: "loading",
4518
- title: "Loading documentation"
4788
+ title: "Carregando o manual"
4519
4789
  }));
4520
4790
  ctx.status(`docs: ${selected}`);
4521
4791
  try {
@@ -4524,7 +4794,7 @@ function createDocsScreen() {
4524
4794
  return;
4525
4795
  const content = normalizeMarkdown(skillText(root, selected)).replace(/^# [^\n]+\n+/, "");
4526
4796
  clear();
4527
- const card = scrollPanel(renderer, theme, { title: selected, active: true });
4797
+ const card = scrollPanel(renderer, theme, { title: rotulos[selected], active: true });
4528
4798
  document = card.body;
4529
4799
  document.add(new MarkdownRenderable(renderer, {
4530
4800
  content,
@@ -4538,11 +4808,11 @@ function createDocsScreen() {
4538
4808
  if (request !== generation || root2.isDestroyed || renderer.isDestroyed)
4539
4809
  return;
4540
4810
  clear();
4541
- ctx.notify(error instanceof Error ? error.message : "Unable to load documentation", "error");
4811
+ ctx.notify(error instanceof Error ? error.message : "Falha ao carregar o manual", "error");
4542
4812
  host.add(stateView(renderer, theme, icons, {
4543
4813
  kind: "error",
4544
- title: "Unable to load documentation",
4545
- action: { key: "t", label: "choose topic", onPress: chooseTopic }
4814
+ title: "Falha ao carregar o manual",
4815
+ action: { key: "t", label: "assuntos", onPress: chooseTopic }
4546
4816
  }));
4547
4817
  }
4548
4818
  }
@@ -4553,8 +4823,8 @@ function createDocsScreen() {
4553
4823
  topicIndex = undefined;
4554
4824
  if (ctx.layout() !== "compact") {
4555
4825
  const index = listPanel(renderer, theme, {
4556
- title: "Topics",
4557
- items: [...SKILL_TOPICS],
4826
+ title: "Assuntos",
4827
+ items: nomes,
4558
4828
  onSelect: selectTopic
4559
4829
  });
4560
4830
  topicIndex = index;
@@ -4570,10 +4840,12 @@ function createDocsScreen() {
4570
4840
  }
4571
4841
  };
4572
4842
  }
4573
- var docsScreen;
4843
+ var rotulos, nomes, docsScreen;
4574
4844
  var init_docs = __esm(() => {
4575
4845
  init_skill();
4576
4846
  init_components();
4847
+ rotulos = { ebook: "Produzir um ebook", cli: "Linha de comando", tui: "Interface do terminal", mcp: "Conectar agentes", config: "Configura\xE7\xE3o local", "exit-codes": "C\xF3digos de sa\xEDda", reference: "Refer\xEAncia completa" };
4848
+ nomes = SKILL_TOPICS.map((topico) => rotulos[topico]);
4577
4849
  docsScreen = createDocsScreen();
4578
4850
  });
4579
4851
 
@@ -4592,9 +4864,9 @@ var init_screens = __esm(() => {
4592
4864
  import { watch as watchFile, existsSync as existsSync4 } from "fs";
4593
4865
  import { basename as basename2, dirname as dirname3 } from "path";
4594
4866
  import {
4595
- BoxRenderable as BoxRenderable7,
4596
- TextRenderable as TextRenderable5,
4597
- TextAttributes as TextAttributes3,
4867
+ BoxRenderable as BoxRenderable8,
4868
+ TextRenderable as TextRenderable6,
4869
+ TextAttributes as TextAttributes4,
4598
4870
  createCliRenderer
4599
4871
  } from "@opentui/core";
4600
4872
  function layoutFor(width) {
@@ -4662,28 +4934,28 @@ async function mountTui(renderer, options = {}, theme = currentTheme()) {
4662
4934
  if (!renderer.isDestroyed)
4663
4935
  renderer.destroy();
4664
4936
  };
4665
- const app = new BoxRenderable7(renderer, {
4937
+ const app = new BoxRenderable8(renderer, {
4666
4938
  width: "100%",
4667
4939
  height: "100%",
4668
4940
  flexDirection: "column",
4669
4941
  backgroundColor: theme.background
4670
4942
  });
4671
- const header = new BoxRenderable7(renderer, { height: 1, flexDirection: "row", paddingLeft: initialSpace.pageX, paddingRight: initialSpace.pageX, gap: controlSpacing.gap });
4672
- const brand = new BoxRenderable7(renderer, { flexDirection: "row", flexShrink: 0 });
4673
- brand.add(new TextRenderable5(renderer, { content: `${glyphs.block} `, fg: theme.accent, selectable: false }));
4674
- brand.add(new TextRenderable5(renderer, { content: manifest.title, fg: theme.textStrong, attributes: TextAttributes3.BOLD }));
4675
- brand.add(new TextRenderable5(renderer, { content: ` v${manifest.version}`, fg: theme.textDim }));
4943
+ const header = new BoxRenderable8(renderer, { backgroundColor: theme.headerBackground, height: 1, flexDirection: "row", paddingLeft: initialSpace.pageX, paddingRight: initialSpace.pageX, gap: controlSpacing.gap });
4944
+ const brand = new BoxRenderable8(renderer, { flexDirection: "row", flexShrink: 0 });
4945
+ brand.add(new TextRenderable6(renderer, { content: `${glyphs.block} `, fg: theme.headerText, selectable: false }));
4946
+ brand.add(new TextRenderable6(renderer, { content: manifest.title + " Produ\xE7\xE3o de ebooks", fg: theme.headerText, attributes: TextAttributes4.BOLD }));
4947
+ brand.add(new TextRenderable6(renderer, { content: ` v${manifest.version}`, fg: theme.headerText }));
4676
4948
  header.add(brand);
4677
- header.add(new BoxRenderable7(renderer, { flexGrow: 1 }));
4678
- const platform = new TextRenderable5(renderer, {
4949
+ header.add(new BoxRenderable8(renderer, { flexGrow: 1 }));
4950
+ const platform = new TextRenderable6(renderer, {
4679
4951
  content: `${process.platform}-${process.arch} \xB7 Bun ${Bun.version}`,
4680
- fg: theme.textDim,
4952
+ fg: theme.headerText,
4681
4953
  flexShrink: 0,
4682
4954
  wrapMode: "none"
4683
4955
  });
4684
4956
  header.add(platform);
4685
4957
  app.add(header);
4686
- const tabBar = new BoxRenderable7(renderer, {
4958
+ const tabBar = new BoxRenderable8(renderer, {
4687
4959
  height: 1,
4688
4960
  flexDirection: "row",
4689
4961
  paddingLeft: initialSpace.pageX,
@@ -4698,9 +4970,9 @@ async function mountTui(renderer, options = {}, theme = currentTheme()) {
4698
4970
  });
4699
4971
  let hovered = -1;
4700
4972
  const tabItems = screens.map((screen, index) => {
4701
- const label = new TextRenderable5(renderer, { content: "", fg: theme.textDim, wrapMode: "none", selectable: false });
4702
- const item = new BoxRenderable7(renderer, { flexDirection: "column", flexShrink: 0 });
4703
- const indicator = new TextRenderable5(renderer, { content: "", height: 1, fg: theme.accent, selectable: false, wrapMode: "none" });
4973
+ const label = new TextRenderable6(renderer, { content: "", fg: theme.textDim, wrapMode: "none", selectable: false });
4974
+ const item = new BoxRenderable8(renderer, { flexDirection: "column", flexShrink: 0 });
4975
+ const indicator = new TextRenderable6(renderer, { content: "", height: 1, fg: theme.accent, selectable: false, wrapMode: "none" });
4704
4976
  item.add(label);
4705
4977
  item.add(indicator);
4706
4978
  clickable(renderer, item, {
@@ -4713,25 +4985,25 @@ async function mountTui(renderer, options = {}, theme = currentTheme()) {
4713
4985
  tabBar.add(item);
4714
4986
  return { item, label, indicator, screen, index };
4715
4987
  });
4716
- const headerGap = new BoxRenderable7(renderer, { height: initialSpace.pageY, flexShrink: 0 });
4988
+ const headerGap = new BoxRenderable8(renderer, { height: initialSpace.pageY, flexShrink: 0 });
4717
4989
  app.add(headerGap);
4718
4990
  app.add(tabBar);
4719
- const tabGap = new BoxRenderable7(renderer, { height: initialSpace.pageY, flexShrink: 0 });
4991
+ const tabGap = new BoxRenderable8(renderer, { height: initialSpace.pageY, flexShrink: 0 });
4720
4992
  app.add(tabGap);
4721
- const content = new BoxRenderable7(renderer, { flexGrow: 1, flexDirection: "column", paddingLeft: initialSpace.pageX, paddingRight: initialSpace.pageX, minHeight: 0 });
4993
+ const content = new BoxRenderable8(renderer, { flexGrow: 1, flexDirection: "column", paddingLeft: initialSpace.pageX, paddingRight: initialSpace.pageX, minHeight: 0 });
4722
4994
  app.add(content);
4723
- const tooSmall = new BoxRenderable7(renderer, { flexGrow: 1, alignItems: "center", justifyContent: "center", flexDirection: "column" });
4724
- const tooSmallText = new TextRenderable5(renderer, { content: "", fg: theme.warn, selectable: false });
4995
+ const tooSmall = new BoxRenderable8(renderer, { flexGrow: 1, alignItems: "center", justifyContent: "center", flexDirection: "column" });
4996
+ const tooSmallText = new TextRenderable6(renderer, { content: "", fg: theme.warn, selectable: false });
4725
4997
  tooSmall.add(tooSmallText);
4726
- tooSmall.add(new TextRenderable5(renderer, { content: "Enlarge the window or press q to quit.", fg: theme.textDim, selectable: false }));
4727
- const contentGap = new BoxRenderable7(renderer, { height: initialSpace.pageY, flexShrink: 0 });
4998
+ tooSmall.add(new TextRenderable6(renderer, { content: "Amplie o terminal ou pressione q para sair.", fg: theme.textDim, selectable: false }));
4999
+ const contentGap = new BoxRenderable8(renderer, { height: initialSpace.pageY, flexShrink: 0 });
4728
5000
  app.add(contentGap);
4729
- const bar = new BoxRenderable7(renderer, { height: 1, flexDirection: "row", paddingLeft: initialSpace.pageX, paddingRight: initialSpace.pageX, gap: controlSpacing.gap });
4730
- const statusText = new TextRenderable5(renderer, { content: "", fg: theme.textDim, wrapMode: "none", flexShrink: 1, minWidth: 0, selectable: false });
4731
- let barItems = new BoxRenderable7(renderer, { flexDirection: "row", gap: controlSpacing.gap, flexGrow: 1, flexShrink: 1, minWidth: 0 });
4732
- const paletteHint = new BoxRenderable7(renderer, { flexDirection: "row", flexShrink: 0, width: 12 });
4733
- paletteHint.add(new TextRenderable5(renderer, { content: "^K", fg: theme.accent, attributes: TextAttributes3.BOLD, selectable: false }));
4734
- const paletteLabel = new TextRenderable5(renderer, { content: " commands", fg: theme.textDim, selectable: false });
5001
+ const bar = new BoxRenderable8(renderer, { height: 1, flexDirection: "row", paddingLeft: initialSpace.pageX, paddingRight: initialSpace.pageX, gap: controlSpacing.gap });
5002
+ const statusText = new TextRenderable6(renderer, { content: "", fg: theme.textDim, wrapMode: "none", flexShrink: 1, minWidth: 0, selectable: false });
5003
+ let barItems = new BoxRenderable8(renderer, { flexDirection: "row", gap: controlSpacing.gap, flexGrow: 1, flexShrink: 1, minWidth: 0 });
5004
+ const paletteHint = new BoxRenderable8(renderer, { flexDirection: "row", flexShrink: 0, width: 12 });
5005
+ paletteHint.add(new TextRenderable6(renderer, { content: "^K", fg: theme.accent, attributes: TextAttributes4.BOLD, selectable: false }));
5006
+ const paletteLabel = new TextRenderable6(renderer, { content: " comandos", fg: theme.textDim, selectable: false });
4735
5007
  paletteHint.add(paletteLabel);
4736
5008
  clickable(renderer, paletteHint, {
4737
5009
  onClick: () => openPalette(),
@@ -4801,8 +5073,8 @@ async function mountTui(renderer, options = {}, theme = currentTheme()) {
4801
5073
  }
4802
5074
  };
4803
5075
  const globalActions = [
4804
- { keys: ["?"], description: "help", icon: "help", run: () => openHelp() },
4805
- { keys: ["q", "escape"], description: "quit", icon: "quit", run: () => quit() }
5076
+ { keys: ["?"], description: "ajuda", icon: "help", run: () => openHelp() },
5077
+ { keys: ["q", "escape"], description: "sair", icon: "quit", run: () => quit() }
4806
5078
  ];
4807
5079
  const screenActions = () => {
4808
5080
  const screen = active();
@@ -4826,15 +5098,16 @@ async function mountTui(renderer, options = {}, theme = currentTheme()) {
4826
5098
  const text = `${number}${title}`;
4827
5099
  label.content = text;
4828
5100
  indicator.content = selected ? "\u2501".repeat(Bun.stringWidth(text)) : "";
4829
- label.fg = selected ? theme.accent : index === hovered ? theme.text : theme.textDim;
4830
- label.attributes = selected ? TextAttributes3.BOLD : TextAttributes3.NONE;
5101
+ label.bg = selected ? theme.keyBackground : theme.background;
5102
+ label.fg = selected ? theme.keyText : index === hovered ? theme.text : theme.textDim;
5103
+ label.attributes = selected ? TextAttributes4.BOLD : TextAttributes4.NONE;
4831
5104
  item.backgroundColor = theme.background;
4832
5105
  }
4833
5106
  };
4834
5107
  const barItem = (action) => {
4835
- const item = new BoxRenderable7(renderer, { flexDirection: "row", flexShrink: 0, width: Bun.stringWidth(keyLabel(action)) + Bun.stringWidth(action.description) + 1 });
4836
- const text = new TextRenderable5(renderer, { content: ` ${action.description}`, fg: theme.textDim, selectable: false });
4837
- item.add(new TextRenderable5(renderer, { content: keyLabel(action), fg: theme.accent, attributes: TextAttributes3.BOLD, selectable: false }));
5108
+ const item = new BoxRenderable8(renderer, { flexDirection: "row", flexShrink: 0, width: Bun.stringWidth(keyLabel(action)) + Bun.stringWidth(action.description) + 1 });
5109
+ const text = new TextRenderable6(renderer, { content: ` ${action.description}`, fg: theme.textDim, selectable: false });
5110
+ item.add(new TextRenderable6(renderer, { content: keyLabel(action), fg: theme.accent, attributes: TextAttributes4.BOLD, selectable: false }));
4838
5111
  item.add(text);
4839
5112
  clickable(renderer, item, {
4840
5113
  onClick: () => runAction(action),
@@ -4849,7 +5122,7 @@ async function mountTui(renderer, options = {}, theme = currentTheme()) {
4849
5122
  fitStatus();
4850
5123
  barItems.destroyRecursively();
4851
5124
  bar.remove(paletteHint);
4852
- barItems = new BoxRenderable7(renderer, { flexDirection: "row", gap: controlSpacing.gap, flexGrow: 1, flexShrink: 1, minWidth: 0 });
5125
+ barItems = new BoxRenderable8(renderer, { flexDirection: "row", gap: controlSpacing.gap, flexGrow: 1, flexShrink: 1, minWidth: 0 });
4853
5126
  const own = currentLayout === "compact" ? [] : screenActions().filter((action) => !action.hidden);
4854
5127
  const statusWidth = statusText.visible ? statusText.width + 2 : 0;
4855
5128
  const paletteWidth = paletteHint.width;
@@ -4953,7 +5226,7 @@ async function mountTui(renderer, options = {}, theme = currentTheme()) {
4953
5226
  }
4954
5227
  screens.forEach((target, index) => {
4955
5228
  if (index !== activeIndex)
4956
- entries.push({ label: `Go to ${target.title}`, hint: index < 9 ? String(index + 1) : undefined, icon: target.icon, run: () => show(index) });
5229
+ entries.push({ label: `Abrir ${target.title}`, hint: index < 9 ? String(index + 1) : undefined, icon: target.icon, run: () => show(index) });
4957
5230
  });
4958
5231
  screens.forEach((target, index) => {
4959
5232
  if (index === activeIndex)
@@ -4969,9 +5242,9 @@ async function mountTui(renderer, options = {}, theme = currentTheme()) {
4969
5242
  });
4970
5243
  }
4971
5244
  });
4972
- entries.push({ label: "Reload this screen", icon: "refresh", run: () => remount() });
4973
- entries.push({ label: "Help: keys and mouse", hint: "?", icon: "help", run: () => openHelp() });
4974
- entries.push({ label: "Quit", hint: "q", icon: "quit", run: () => quit() });
5245
+ entries.push({ label: "Atualizar esta tela", icon: "refresh", run: () => remount() });
5246
+ entries.push({ label: "Ajuda de teclado e mouse", hint: "?", icon: "help", run: () => openHelp() });
5247
+ entries.push({ label: "Sair", hint: "q", icon: "quit", run: () => quit() });
4975
5248
  overlays.palette(entries);
4976
5249
  };
4977
5250
  const openHelp = () => {
@@ -4987,20 +5260,20 @@ async function mountTui(renderer, options = {}, theme = currentTheme()) {
4987
5260
  sections.push({
4988
5261
  title: "Global",
4989
5262
  rows: [
4990
- { key: "Ctrl+K :", description: "command palette", icon: "keyboard", run: () => openPalette() },
4991
- { key: "\u2190 \u2192 [ ]", description: "previous / next tab", icon: "tabs", run: () => step(1) },
4992
- { key: `1 \u2026 ${Math.min(9, screens.length)}`, description: "go to the tab with that number" },
4993
- { key: "Tab Shift+Tab", description: "next / previous panel" },
4994
- { key: "Esc", description: "close a dialog; quit when none is open", icon: "close" },
4995
- { key: "q Ctrl+C", description: "quit", icon: "quit", run: () => quit() }
5263
+ { key: "Ctrl+K :", description: "menu de comandos", icon: "keyboard", run: () => openPalette() },
5264
+ { key: "\u2190 \u2192 [ ]", description: "aba anterior ou seguinte", icon: "tabs", run: () => step(1) },
5265
+ { key: `1 \u2026 ${Math.min(9, screens.length)}`, description: "abrir aba pelo n\xFAmero" },
5266
+ { key: "Tab Shift+Tab", description: "alternar painel" },
5267
+ { key: "Esc", description: "voltar ou fechar o di\xE1logo", icon: "close" },
5268
+ { key: "q Ctrl+C", description: "sair", icon: "quit", run: () => quit() }
4996
5269
  ]
4997
5270
  });
4998
5271
  sections.push({
4999
5272
  title: "Mouse",
5000
5273
  rows: [
5001
- { key: "click", description: "tab, bar item, button, row, dialog button" },
5002
- { key: "wheel", description: "scroll a list; over the tabs, switch tab" },
5003
- { key: "Shift+drag", description: "select text in most terminals" }
5274
+ { key: "click", description: "abrir aba, item ou bot\xE3o" },
5275
+ { key: "wheel", description: "rolar lista ou alternar aba" },
5276
+ { key: "Shift+drag", description: "selecionar texto" }
5004
5277
  ]
5005
5278
  });
5006
5279
  overlays.help(sections);
@@ -5034,7 +5307,7 @@ async function mountTui(renderer, options = {}, theme = currentTheme()) {
5034
5307
  content.add(node);
5035
5308
  }
5036
5309
  }
5037
- tooSmallText.content = withIcon(icons, "warn", `Terminal too small: ${renderer.width}\xD7${renderer.height}, needs ${MIN_WIDTH}\xD7${MIN_HEIGHT}.`);
5310
+ tooSmallText.content = withIcon(icons, "warn", `Terminal pequeno: ${renderer.width}\xD7${renderer.height}, m\xEDnimo ${MIN_WIDTH}\xD7${MIN_HEIGHT}.`);
5038
5311
  if (nextLayout !== currentLayout) {
5039
5312
  currentLayout = nextLayout;
5040
5313
  for (const screen of screens)
@@ -5092,7 +5365,7 @@ async function mountTui(renderer, options = {}, theme = currentTheme()) {
5092
5365
  }
5093
5366
  restartWatchers();
5094
5367
  remount();
5095
- context.notify("Updated from disk", "info");
5368
+ context.notify("Dados atualizados", "info");
5096
5369
  };
5097
5370
  watchTimer = setTimeout(update, 250);
5098
5371
  }));
@@ -5404,6 +5677,7 @@ var init_completion2 = __esm(() => {
5404
5677
  var root;
5405
5678
  var init_commands = __esm(() => {
5406
5679
  init_book();
5680
+ init_init();
5407
5681
  init_manifest();
5408
5682
  init_about();
5409
5683
  init_config();
@@ -5416,7 +5690,7 @@ var init_commands = __esm(() => {
5416
5690
  root = {
5417
5691
  name: manifest.bin,
5418
5692
  description: manifest.description,
5419
- subcommands: [info, build, tuiCommand, aboutCommand, configCommand, credentialsCommand, mcpCommand, createSkillCommand(() => root), doctorCommand, createCompletionCommand(() => root)],
5693
+ subcommands: [init, info, build, tuiCommand, aboutCommand, configCommand, credentialsCommand, mcpCommand, createSkillCommand(() => root), doctorCommand, createCompletionCommand(() => root)],
5420
5694
  examples: [
5421
5695
  `${manifest.bin}`,
5422
5696
  `${manifest.bin} about --json`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promovaweb/ebookfy",
3
- "version": "0.1.1",
3
+ "version": "0.3.0",
4
4
  "description": "Organize capítulos e exporte seu ebook em PDF, EPUB e MOBI.",
5
5
  "type": "module",
6
6
  "private": false,