@lugom.io/hefesto 0.3.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/agents/hefesto-argos.md +51 -237
- package/agents/hefesto-athena.md +59 -339
- package/agents/hefesto-hermes.md +39 -71
- package/bin/install.js +105 -69
- package/hooks/hefesto-check-update.cjs +32 -11
- package/hooks/hefesto-statusline.cjs +8 -17
- package/hooks/hefesto-workflow.cjs +68 -0
- package/package.json +12 -2
- package/skills/hefesto-context/SKILL.md +59 -26
- package/skills/hefesto-debug/SKILL.md +54 -0
- package/skills/hefesto-design/SKILL.md +133 -143
- package/skills/hefesto-execute/SKILL.md +133 -0
- package/skills/hefesto-init/SKILL.md +94 -59
- package/skills/hefesto-init/references/api.md +116 -0
- package/skills/hefesto-init/references/cli.md +91 -0
- package/skills/hefesto-init/references/mobile.md +69 -0
- package/skills/hefesto-init/references/web.md +246 -0
- package/skills/hefesto-new-feature/SKILL.md +75 -41
- package/skills/hefesto-security/SKILL.md +89 -0
- package/skills/hefesto-security/references/boundaries-and-bypasses.md +152 -0
- package/skills/hefesto-security/references/secrets-detection.md +121 -0
- package/skills/hefesto-security/references/severity-and-judgment.md +176 -0
- package/skills/hefesto-simplify/SKILL.md +82 -0
- package/templates/TPL-CLAUDE.md +54 -0
- package/templates/TPL-CONFIG.json +19 -0
- package/templates/TPL-DESIGN.md +305 -0
- package/templates/{FEATURE.md → TPL-FEATURE.md} +13 -6
- package/templates/TPL-PROJECT.md +50 -0
- package/templates/{RECON.md → TPL-RECON.md} +10 -4
- package/templates/{RESEARCH.md → TPL-RESEARCH.md} +15 -15
- package/templates/TPL-SECURITY.md +42 -0
- package/templates/TPL-SIMPLIFY.md +40 -0
- package/templates/{STATE.md → TPL-STATE.md} +0 -6
- package/templates/TPL-VERDICT.md +34 -0
- package/skills/hefesto-design/data/animations.csv +0 -21
- package/skills/hefesto-design/data/anti-patterns.csv +0 -41
- package/skills/hefesto-design/data/charts.csv +0 -26
- package/skills/hefesto-design/data/colors.csv +0 -108
- package/skills/hefesto-design/data/components.csv +0 -31
- package/skills/hefesto-design/data/google-fonts.csv +0 -56
- package/skills/hefesto-design/data/icons.csv +0 -23
- package/skills/hefesto-design/data/landing-pages.csv +0 -28
- package/skills/hefesto-design/data/products.csv +0 -46
- package/skills/hefesto-design/data/spacing.csv +0 -16
- package/skills/hefesto-design/data/styles.csv +0 -53
- package/skills/hefesto-design/data/typography.csv +0 -41
- package/skills/hefesto-design/data/ux-rules.csv +0 -61
- package/skills/hefesto-design/references/accessibility.md +0 -335
- package/skills/hefesto-design/references/aesthetics.md +0 -343
- package/skills/hefesto-design/references/anti-patterns.md +0 -107
- package/skills/hefesto-design/references/checklist.md +0 -66
- package/skills/hefesto-design/references/color-psychology.md +0 -203
- package/skills/hefesto-design/references/component-specs.md +0 -318
- package/skills/hefesto-design/references/polish.md +0 -339
- package/skills/hefesto-design/references/token-architecture.md +0 -394
- package/skills/hefesto-design/references/ux-rules.md +0 -349
- package/skills/hefesto-design/scripts/__pycache__/audit.cpython-314.pyc +0 -0
- package/skills/hefesto-design/scripts/__pycache__/contrast.cpython-314.pyc +0 -0
- package/skills/hefesto-design/scripts/__pycache__/core.cpython-314.pyc +0 -0
- package/skills/hefesto-design/scripts/__pycache__/design_system.cpython-314.pyc +0 -0
- package/skills/hefesto-design/scripts/__pycache__/search.cpython-314.pyc +0 -0
- package/skills/hefesto-design/scripts/__pycache__/validate_tokens.cpython-314.pyc +0 -0
- package/skills/hefesto-design/scripts/audit.py +0 -450
- package/skills/hefesto-design/scripts/contrast.py +0 -195
- package/skills/hefesto-design/scripts/core.py +0 -155
- package/skills/hefesto-design/scripts/design_system.py +0 -311
- package/skills/hefesto-design/scripts/search.py +0 -235
- package/skills/hefesto-design/scripts/validate_tokens.py +0 -274
- package/skills/hefesto-update/SKILL.md +0 -34
- package/templates/DESIGN.md +0 -137
- package/templates/PROJECT.md +0 -28
- package/templates/ROADMAP.md +0 -23
- package/templates/VERDICT.md +0 -52
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: hefesto-execute
|
|
3
|
+
description: >
|
|
4
|
+
Executa a implementação de uma feature Hefesto. Decompõe em fases atômicas, roda verificação
|
|
5
|
+
após cada fase, e invoca Argos para QA final (max 3 iterações).
|
|
6
|
+
Usar com: /hefesto-execute [FEAT-NNN]. Requer feature com status "ready" ou "active".
|
|
7
|
+
Para criar o spec da feature, usar /hefesto-new-feature primeiro.
|
|
8
|
+
user-invocable: true
|
|
9
|
+
disable-model-invocation: true
|
|
10
|
+
argument-hint: '[FEAT-NNN]'
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# Hefesto Execute
|
|
14
|
+
|
|
15
|
+
Executa a implementação de uma feature, do reconhecimento à validação final.
|
|
16
|
+
|
|
17
|
+
Ciclo: identificar feature → reconhecer codebase → detectar verificação → executar fases → validar com Argos → QA loop → concluir.
|
|
18
|
+
|
|
19
|
+
## Pré-requisitos
|
|
20
|
+
|
|
21
|
+
Verificar se `.hefesto/` existe. Se não, sugerir `/hefesto-init`.
|
|
22
|
+
|
|
23
|
+
## Workflow
|
|
24
|
+
|
|
25
|
+
### Fase 1 — Identificar Feature
|
|
26
|
+
|
|
27
|
+
1. Se argumento `FEAT-NNN` fornecido, buscar em `.hefesto/features/FEAT-NNN-*.md`
|
|
28
|
+
2. Senão, ler `.hefesto/STATE.md` → feature ativa
|
|
29
|
+
3. Se nenhuma feature ativa: listar features `ready`, apresentar via seletor interativo. Se não houver, sugerir `/hefesto-new-feature`
|
|
30
|
+
4. Validar status:
|
|
31
|
+
- `ready` ou `active` → prosseguir
|
|
32
|
+
- `draft` → "Promova para ready antes de executar"
|
|
33
|
+
- `done` → informar e sair
|
|
34
|
+
- `blocked` → informar, seletor: desbloquear (status → `ready`) / cancelar (mantém `blocked`)
|
|
35
|
+
|
|
36
|
+
### Fase 2 — Reconhecimento
|
|
37
|
+
|
|
38
|
+
Sempre delegar para `hefesto-hermes` com: ID, título, requisitos, fases. O Hermes calibra a profundidade automaticamente — features simples recebem relatório curto, complexas recebem mapeamento completo. Usar output para informar execução: padrões, pontos de integração, ordem de ataque.
|
|
39
|
+
|
|
40
|
+
**Dispatch paralelo**: se a feature também precisa de pesquisa, Athena e Hermes podem rodar simultaneamente — exceto quando a pesquisa pode mudar a abordagem (executar Athena primeiro).
|
|
41
|
+
|
|
42
|
+
### Fase 3 — Detectar Verificação
|
|
43
|
+
|
|
44
|
+
1. Ler `.hefesto/config.json` → `verification`
|
|
45
|
+
2. Se `commands` vazio e `auto_detect` true:
|
|
46
|
+
- Ler `package.json`, buscar scripts: `test`, `lint`, `typecheck`, `tsc`, `check`, `format:check`
|
|
47
|
+
- Seletor: "Detectei estes comandos: [lista]. Confirmar?" (Sim / Editar / Pular)
|
|
48
|
+
3. Se nada detectado, perguntar ao usuário
|
|
49
|
+
4. Salvar em `config.json → verification.commands` e frontmatter da feature
|
|
50
|
+
|
|
51
|
+
### Fase 4 — Executar Fases
|
|
52
|
+
|
|
53
|
+
Para **cada Fase** da seção "Implementação" da feature:
|
|
54
|
+
|
|
55
|
+
#### Fases em paralelo (quando aplicável)
|
|
56
|
+
|
|
57
|
+
Critérios (TODOS devem ser verdadeiros): sem arquivos compartilhados, sem dependência de dados, verificação independente. Na dúvida, sequencial.
|
|
58
|
+
|
|
59
|
+
#### 4.1 Preparar
|
|
60
|
+
|
|
61
|
+
- Ler tarefas, avaliar granularidade (2-5 min cada)
|
|
62
|
+
- Se primeira fase: status → `active`, atualizar STATE.md
|
|
63
|
+
|
|
64
|
+
#### 4.2 Executar tarefas
|
|
65
|
+
|
|
66
|
+
Executar no contexto principal (sem subagents para implementação). Para cada tarefa:
|
|
67
|
+
|
|
68
|
+
1. **Implementar**: ler arquivos antes de modificar, seguir padrões do Hermes
|
|
69
|
+
2. **Self-review inline** (~30s):
|
|
70
|
+
- [ ] Requisito(s) atendido(s)?
|
|
71
|
+
- [ ] Nenhum placeholder/TODO no código?
|
|
72
|
+
- [ ] Segue padrões do codebase?
|
|
73
|
+
- [ ] Escopo respeitado?
|
|
74
|
+
- [ ] Nenhuma lógica duplicada? (Grep antes de criar helpers)
|
|
75
|
+
- [ ] Se tarefa visual e `.hefesto/DESIGN.md` existe: valores seguem o contrato?
|
|
76
|
+
3. Se falhar, corrigir antes de prosseguir
|
|
77
|
+
4. Marcar tarefa concluída no checklist
|
|
78
|
+
|
|
79
|
+
#### 4.3 Verification Gate
|
|
80
|
+
|
|
81
|
+
Após todas as tarefas da fase:
|
|
82
|
+
|
|
83
|
+
1. Rodar cada `verification_command` via Bash
|
|
84
|
+
2. Se falhar: analisar erro, auto-fix, re-rodar. **Max 3 tentativas**
|
|
85
|
+
3. Se falhar após retries: marcar blocker em STATE.md, informar usuário, sugerir `/hefesto-debug`. Não prosseguir
|
|
86
|
+
4. **Stuck detection**: mesmo erro 3x = PARAR e pedir orientação
|
|
87
|
+
|
|
88
|
+
#### 4.4 Atualizar Tracking
|
|
89
|
+
|
|
90
|
+
1. Incrementar `phases_done` no frontmatter
|
|
91
|
+
2. Atualizar STATE.md (barra de progresso, fase atual)
|
|
92
|
+
|
|
93
|
+
### Fase 4.5 — Revisão de Qualidade e Segurança
|
|
94
|
+
|
|
95
|
+
Após todas as fases de implementação, antes do Argos:
|
|
96
|
+
|
|
97
|
+
1. `/hefesto-simplify` nos arquivos modificados
|
|
98
|
+
2. `/hefesto-security` nos mesmos arquivos
|
|
99
|
+
3. Re-rodar verificação se fixes aplicados
|
|
100
|
+
4. Pular se o usuário pedir para acelerar
|
|
101
|
+
|
|
102
|
+
### Fase 5 — Validação (Argos)
|
|
103
|
+
|
|
104
|
+
Após TODAS as fases executadas: delegar para `hefesto-argos` com feature ID, fases, paths. Aguardar veredicto.
|
|
105
|
+
|
|
106
|
+
### Fase 6 — QA Loop
|
|
107
|
+
|
|
108
|
+
O protocolo detalhado do QA loop (foco em itens falhos, detecção de regressão, campos do veredicto) está em `hefesto-argos`. Aqui, o fluxo de decisão:
|
|
109
|
+
|
|
110
|
+
**Se `needs-work`:**
|
|
111
|
+
|
|
112
|
+
1. Incrementar `qa_iterations` no frontmatter
|
|
113
|
+
2. Se `qa_iterations >= 3`: **PARAR** — problema arquitetural. Sugerir `/hefesto-debug`. Atualizar STATE.md
|
|
114
|
+
3. Se < 3: aplicar fixes, re-rodar verificação, re-delegar para Argos com veredicto anterior
|
|
115
|
+
|
|
116
|
+
**Se `approved` ou `approved-with-notes`:**
|
|
117
|
+
|
|
118
|
+
1. Status → `done`, limpar feature ativa em STATE.md
|
|
119
|
+
2. Se `approved-with-notes`: exibir notas ao usuário
|
|
120
|
+
|
|
121
|
+
### Fase 7 — Wrap Up
|
|
122
|
+
|
|
123
|
+
1. Atualizar STATE.md (posição, última atividade, continuidade)
|
|
124
|
+
2. Exibir resumo: feature, fases executadas, iterações QA, veredicto
|
|
125
|
+
3. Sugerir `/hefesto-new-feature` para a próxima
|
|
126
|
+
|
|
127
|
+
## Regras
|
|
128
|
+
|
|
129
|
+
- **Implementação no contexto principal** — subagents só para Hermes (recon) e Argos (validação)
|
|
130
|
+
- **Self-review após cada tarefa**, verification gate após cada fase
|
|
131
|
+
- **QA loop max 3 iterações** — regressão = `needs-work` obrigatório
|
|
132
|
+
- **STATE.md atualizado** a cada mudança significativa
|
|
133
|
+
- **Campos ausentes**: inicializar com defaults (qa_iterations: 0, last_verdict: null)
|
|
@@ -1,70 +1,105 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: hefesto-init
|
|
3
|
-
description:
|
|
3
|
+
description: >
|
|
4
|
+
Inicializa um projeto com Hefesto. Dois modos: (1) projeto novo — scaffold com stack
|
|
5
|
+
pré-definida (web/cli/api/mobile); (2) projeto existente — analisa codebase, cria .hefesto/
|
|
6
|
+
e gera CLAUDE.md.
|
|
7
|
+
Usar com: /hefesto-init.
|
|
4
8
|
user-invocable: true
|
|
5
9
|
disable-model-invocation: true
|
|
6
10
|
---
|
|
7
11
|
|
|
8
12
|
# Hefesto Init
|
|
9
13
|
|
|
10
|
-
Inicializa a estrutura `.hefesto
|
|
11
|
-
|
|
12
|
-
##
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
-
|
|
19
|
-
-
|
|
20
|
-
3.
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
14
|
+
Inicializa um projeto com a estrutura `.hefesto/`, gera `CLAUDE.md` e, opcionalmente, faz scaffold do código base. Para projetos existentes, faz uma varredura automática do codebase para detectar stack, plataforma, convenções e comandos.
|
|
15
|
+
|
|
16
|
+
## Fluxo
|
|
17
|
+
|
|
18
|
+
### Fase 1 — Verificar estado
|
|
19
|
+
|
|
20
|
+
1. Verificar se `.hefesto/` já existe (`Bash: ls .hefesto/ 2>/dev/null`)
|
|
21
|
+
2. Se existir:
|
|
22
|
+
- Ler `.hefesto/PROJECT.md` — se contém `{{PROJECT_NAME}}` → install fresco, prosseguir
|
|
23
|
+
- Senão → já configurado. Seletor: **Reinicializar** (apaga e recria, avisa sobre features existentes) / **Atualizar** (re-varredura, preserva features/) / **Cancelar**
|
|
24
|
+
3. Se não existir → Fase 2
|
|
25
|
+
|
|
26
|
+
### Fase 2 — Tipo de projeto
|
|
27
|
+
|
|
28
|
+
Seletor: **Novo** → Fase 3A | **Existente** → Fase 3B.1
|
|
29
|
+
|
|
30
|
+
### Fase 3A — Scaffold de projeto novo
|
|
31
|
+
|
|
32
|
+
1. Seletor de **plataforma**:
|
|
33
|
+
- `web` — Next.js + TypeScript + TailwindCSS + shadcn/ui
|
|
34
|
+
- `cli` — Node.js + TypeScript + ES Modules
|
|
35
|
+
- `api` — Node.js + TypeScript + Fastify
|
|
36
|
+
- `mobile` — React Native + Expo + NativeWind
|
|
37
|
+
|
|
38
|
+
2. Ler `references/{plataforma}.md` (relativo a esta skill)
|
|
39
|
+
3. Executar scaffold conforme a referência
|
|
40
|
+
4. Coletar do usuário: **Nome** (sugerir dir atual), **Descrição** (2-3 frases), **Valor central**, **Prazo/restrições**
|
|
41
|
+
|
|
42
|
+
### Fase 3B.1 — Varredura do codebase
|
|
43
|
+
|
|
44
|
+
Análise rápida (~10 reads) para detectar informações do projeto:
|
|
45
|
+
|
|
46
|
+
**Passo 1 — Manifesto**: Glob por `package.json`, `pyproject.toml`, `go.mod`, `Cargo.toml`, `Gemfile`, `pom.xml`, `pubspec.yaml`. Se nenhum → modo manual (Fase 3B.2).
|
|
47
|
+
|
|
48
|
+
**Passo 2 — Identidade**: Nome, descrição, dependências, scripts do manifesto. Fallback: README.md (primeiras 30 linhas).
|
|
49
|
+
|
|
50
|
+
**Passo 3 — Linguagem** (por prioridade): tsconfig.json → TypeScript | jsconfig.json/package.json → JavaScript | pyproject.toml/requirements.txt → Python | go.mod → Go | Cargo.toml → Rust | Gemfile → Ruby | pubspec.yaml → Dart. Se ambíguo, contar arquivos por extensão.
|
|
51
|
+
|
|
52
|
+
**Passo 4 — Plataforma**: Inferir das dependências — frameworks web → `web`, react-native/expo → `mobile`, express/fastify/flask/etc sem frontend → `api`, campo bin → `cli`, exports sem bin/web → `library`, frontend + backend → `fullstack`, nenhum → `other`.
|
|
53
|
+
|
|
54
|
+
**Passo 5 — Monorepo**: workspaces em package.json, lerna.json, nx.json, turbo.json, pnpm-workspace.yaml.
|
|
55
|
+
|
|
56
|
+
**Passo 6 — Comandos**: Extrair de package.json scripts (dev, build, test, lint, format) ou Makefile.
|
|
57
|
+
|
|
58
|
+
**Passo 7 — Arquitetura**: Listar dirs em `src/` — features/modules/domains → feature-based | controllers/services/models → layered | app/pages → file-based routing. Detectar formatação: Prettier, ESLint, Biome, EditorConfig.
|
|
59
|
+
|
|
60
|
+
### Fase 3B.2 — Confirmação
|
|
61
|
+
|
|
62
|
+
Apresentar resultado da varredura em tabela (Campo | Detectado | Fonte). O usuário confirma ou ajusta.
|
|
63
|
+
|
|
64
|
+
Perguntar apenas o não-detectável: **Valor central** (sempre), **Prazo** (sempre), **Descrição** (se não detectada). Se varredura pulada, coletar tudo manualmente.
|
|
65
|
+
|
|
66
|
+
### Fase 4 — Criar estrutura .hefesto/
|
|
67
|
+
|
|
68
|
+
Criar os artefatos listados em `/hefesto-context` (seção "Estrutura `.hefesto/`"): `PROJECT.md`, `STATE.md`, `config.json`, `features/`, `research/`.
|
|
69
|
+
|
|
70
|
+
### Fase 5 — Preencher arquivos
|
|
71
|
+
|
|
72
|
+
Ler os templates em `.hefesto/templates/TPL-*.md` (já copiados pelo instalador) e substituir os placeholders `{{...}}` com os dados coletados.
|
|
73
|
+
|
|
74
|
+
**PROJECT.md**: Dados do projeto, valor central, stack, convenções. Para projetos novos, copiar convenções do reference file. Para existentes, gerar da varredura. Preencher `{{RECIPES}}` com a seção "Receitas" do reference file do preset — lista curta com nome e quando usar cada receita.
|
|
75
|
+
|
|
76
|
+
**STATE.md**: Data e foco inicial.
|
|
77
|
+
|
|
78
|
+
**config.json**: Atualizar seção `project` (name, description, platform, lang, monorepo). Valores vêm do preset (novos) ou da varredura (existentes). Não alterar demais seções.
|
|
79
|
+
|
|
80
|
+
**verification.commands**: Preencher com comandos detectados (test, lint, typecheck). Para projetos novos, usar padrão do preset. Se nada detectado, deixar vazio com `auto_detect: true`.
|
|
81
|
+
|
|
82
|
+
### Fase 5B — Gerar CLAUDE.md
|
|
83
|
+
|
|
84
|
+
Ler template `TPL-CLAUDE.md` e substituir placeholders com dados coletados.
|
|
85
|
+
|
|
86
|
+
Se CLAUDE.md existir: seletor **Substituir** / **Mesclar** (adicionar seção Hefesto) / **Pular**.
|
|
87
|
+
|
|
88
|
+
Para projetos novos: usar dados do reference file. Para existentes: usar resultado da varredura.
|
|
89
|
+
|
|
90
|
+
Princípios: conciso, sem repetição do PROJECT.md, sem obviedades, comandos acionáveis.
|
|
91
|
+
|
|
92
|
+
### Fase 6 — MCP Context7
|
|
93
|
+
|
|
94
|
+
Se o projeto usa dependências externas (frameworks, bibliotecas, SDKs): verificar `.mcp.json` para `context7`. Se não existir, sugerir configuração para o usuário. Se o projeto não tem dependências externas, pular.
|
|
95
|
+
|
|
96
|
+
### Fase 7 — Resultado
|
|
97
|
+
|
|
98
|
+
Informar o que foi criado. Sugerir `/hefesto-new-feature`. Se plataforma `web` ou `mobile`, sugerir também `/hefesto-design` para definir o contrato visual.
|
|
64
99
|
|
|
65
100
|
## Notas
|
|
66
101
|
|
|
67
|
-
-
|
|
68
|
-
-
|
|
69
|
-
-
|
|
70
|
-
-
|
|
102
|
+
- Se usuário disser "decide você", fazer escolha razoável e justificar
|
|
103
|
+
- **Atualizar**: não executar scaffold, apenas re-varredura + update dos arquivos .hefesto/
|
|
104
|
+
- Varredura deve ser rápida (~10 reads)
|
|
105
|
+
- CLAUDE.md gerado deve ser conciso — apenas o não derivável do código
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
# Preset: API
|
|
2
|
+
|
|
3
|
+
## Stack
|
|
4
|
+
|
|
5
|
+
- Node.js + TypeScript
|
|
6
|
+
- Fastify
|
|
7
|
+
- ES Modules
|
|
8
|
+
- pnpm (package manager)
|
|
9
|
+
|
|
10
|
+
## Scaffold
|
|
11
|
+
|
|
12
|
+
### 1. Inicializar projeto
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
pnpm init
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
### 2. Configurar package.json
|
|
19
|
+
|
|
20
|
+
Editar o `package.json` gerado:
|
|
21
|
+
|
|
22
|
+
- Adicionar `"type": "module"`
|
|
23
|
+
- Adicionar scripts:
|
|
24
|
+
```json
|
|
25
|
+
"scripts": {
|
|
26
|
+
"dev": "tsx watch src/server.ts",
|
|
27
|
+
"build": "tsc",
|
|
28
|
+
"start": "node dist/server.js"
|
|
29
|
+
}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### 3. Instalar dependências
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
pnpm add fastify
|
|
36
|
+
pnpm add -D typescript @types/node tsx
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### 4. Criar tsconfig.json
|
|
40
|
+
|
|
41
|
+
Criar `tsconfig.json` com:
|
|
42
|
+
|
|
43
|
+
```json
|
|
44
|
+
{
|
|
45
|
+
"compilerOptions": {
|
|
46
|
+
"target": "ES2022",
|
|
47
|
+
"module": "NodeNext",
|
|
48
|
+
"moduleResolution": "NodeNext",
|
|
49
|
+
"outDir": "./dist",
|
|
50
|
+
"rootDir": "./src",
|
|
51
|
+
"strict": true,
|
|
52
|
+
"declaration": true,
|
|
53
|
+
"esModuleInterop": true,
|
|
54
|
+
"skipLibCheck": true,
|
|
55
|
+
"forceConsistentCasingInFileNames": true
|
|
56
|
+
},
|
|
57
|
+
"include": ["src/**/*"],
|
|
58
|
+
"exclude": ["node_modules", "dist"]
|
|
59
|
+
}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### 5. Criar estrutura de diretórios e arquivos
|
|
63
|
+
|
|
64
|
+
```
|
|
65
|
+
src/
|
|
66
|
+
├── server.ts
|
|
67
|
+
└── routes/
|
|
68
|
+
└── health.ts
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### 6. Criar src/server.ts
|
|
72
|
+
|
|
73
|
+
```typescript
|
|
74
|
+
import Fastify from 'fastify';
|
|
75
|
+
import { healthRoutes } from './routes/health.js';
|
|
76
|
+
|
|
77
|
+
const app = Fastify({ logger: true });
|
|
78
|
+
|
|
79
|
+
app.register(healthRoutes);
|
|
80
|
+
|
|
81
|
+
app.listen({ port: 3000, host: '0.0.0.0' }, (err) => {
|
|
82
|
+
if (err) {
|
|
83
|
+
app.log.error(err);
|
|
84
|
+
process.exit(1);
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### 7. Criar src/routes/health.ts
|
|
90
|
+
|
|
91
|
+
```typescript
|
|
92
|
+
import { FastifyInstance } from 'fastify';
|
|
93
|
+
|
|
94
|
+
export async function healthRoutes(app: FastifyInstance) {
|
|
95
|
+
app.get('/health', async () => {
|
|
96
|
+
return { status: 'ok' };
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### 8. Estrutura resultante esperada
|
|
102
|
+
|
|
103
|
+
```
|
|
104
|
+
src/
|
|
105
|
+
├── server.ts
|
|
106
|
+
└── routes/
|
|
107
|
+
└── health.ts
|
|
108
|
+
tsconfig.json
|
|
109
|
+
package.json
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## config.json
|
|
113
|
+
|
|
114
|
+
- platform: "api"
|
|
115
|
+
- lang: "typescript"
|
|
116
|
+
- monorepo: false
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# Preset: CLI
|
|
2
|
+
|
|
3
|
+
## Stack
|
|
4
|
+
|
|
5
|
+
- Node.js + TypeScript
|
|
6
|
+
- ES Modules
|
|
7
|
+
- pnpm (package manager)
|
|
8
|
+
|
|
9
|
+
## Scaffold
|
|
10
|
+
|
|
11
|
+
### 1. Inicializar projeto
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
pnpm init
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
### 2. Configurar package.json
|
|
18
|
+
|
|
19
|
+
Editar o `package.json` gerado:
|
|
20
|
+
|
|
21
|
+
- Adicionar `"type": "module"`
|
|
22
|
+
- Adicionar campo `"bin"`: `{ "<nome-do-projeto>": "./dist/cli.js" }`
|
|
23
|
+
- Adicionar scripts:
|
|
24
|
+
```json
|
|
25
|
+
"scripts": {
|
|
26
|
+
"build": "tsc",
|
|
27
|
+
"dev": "tsc --watch",
|
|
28
|
+
"start": "node dist/cli.js"
|
|
29
|
+
}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### 3. Instalar TypeScript
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
pnpm add -D typescript @types/node
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### 4. Criar tsconfig.json
|
|
39
|
+
|
|
40
|
+
Criar `tsconfig.json` com:
|
|
41
|
+
|
|
42
|
+
```json
|
|
43
|
+
{
|
|
44
|
+
"compilerOptions": {
|
|
45
|
+
"target": "ES2022",
|
|
46
|
+
"module": "NodeNext",
|
|
47
|
+
"moduleResolution": "NodeNext",
|
|
48
|
+
"outDir": "./dist",
|
|
49
|
+
"rootDir": "./src",
|
|
50
|
+
"strict": true,
|
|
51
|
+
"declaration": true,
|
|
52
|
+
"esModuleInterop": true,
|
|
53
|
+
"skipLibCheck": true,
|
|
54
|
+
"forceConsistentCasingInFileNames": true
|
|
55
|
+
},
|
|
56
|
+
"include": ["src/**/*"],
|
|
57
|
+
"exclude": ["node_modules", "dist"]
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### 5. Criar estrutura de diretórios e arquivos
|
|
62
|
+
|
|
63
|
+
```
|
|
64
|
+
src/
|
|
65
|
+
└── cli.ts ← entry point
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### 6. Criar src/cli.ts
|
|
69
|
+
|
|
70
|
+
```typescript
|
|
71
|
+
#!/usr/bin/env node
|
|
72
|
+
|
|
73
|
+
console.log('<nome-do-projeto> v0.1.0');
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Substituir `<nome-do-projeto>` pelo nome real do projeto.
|
|
77
|
+
|
|
78
|
+
### 7. Estrutura resultante esperada
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
src/
|
|
82
|
+
└── cli.ts
|
|
83
|
+
tsconfig.json
|
|
84
|
+
package.json
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## config.json
|
|
88
|
+
|
|
89
|
+
- platform: "cli"
|
|
90
|
+
- lang: "typescript"
|
|
91
|
+
- monorepo: false
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# Preset: Mobile
|
|
2
|
+
|
|
3
|
+
## Stack
|
|
4
|
+
|
|
5
|
+
- React Native + Expo + TypeScript
|
|
6
|
+
- Expo Router (navegação file-based)
|
|
7
|
+
- NativeWind (TailwindCSS para React Native)
|
|
8
|
+
|
|
9
|
+
## Scaffold
|
|
10
|
+
|
|
11
|
+
### 1. Criar projeto Expo
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npx create-expo-app@latest . --template tabs
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Se o diretório não estiver vazio, apresentar ao usuário via seletor interativo: **Criar num subdiretório** / **Limpar primeiro**.
|
|
18
|
+
|
|
19
|
+
### 2. Instalar NativeWind
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npx expo install nativewind tailwindcss
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### 3. Configurar TailwindCSS
|
|
26
|
+
|
|
27
|
+
Criar `tailwind.config.js`:
|
|
28
|
+
|
|
29
|
+
```javascript
|
|
30
|
+
/** @type {import('tailwindcss').Config} */
|
|
31
|
+
module.exports = {
|
|
32
|
+
content: ['./app/**/*.{ts,tsx}', './components/**/*.{ts,tsx}'],
|
|
33
|
+
presets: [require('nativewind/preset')],
|
|
34
|
+
theme: {
|
|
35
|
+
extend: {},
|
|
36
|
+
},
|
|
37
|
+
plugins: [],
|
|
38
|
+
};
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Adicionar o plugin do NativeWind no `babel.config.js` (se existir) ou em `metro.config.js` conforme a documentação do NativeWind para a versão instalada.
|
|
42
|
+
|
|
43
|
+
### 4. Limpar boilerplate
|
|
44
|
+
|
|
45
|
+
- Simplificar as tabs de exemplo — manter a estrutura mas substituir o conteúdo.
|
|
46
|
+
- Substituir o conteúdo da tab Home por uma tela limpa com o nome do projeto centralizado.
|
|
47
|
+
- Remover assets de exemplo desnecessários.
|
|
48
|
+
|
|
49
|
+
### 5. Estrutura resultante esperada
|
|
50
|
+
|
|
51
|
+
```
|
|
52
|
+
app/
|
|
53
|
+
├── (tabs)/
|
|
54
|
+
│ ├── index.tsx ← Home limpa com nome do projeto
|
|
55
|
+
│ ├── _layout.tsx ← Tab layout
|
|
56
|
+
│ └── explore.tsx ← Tab secundária
|
|
57
|
+
├── _layout.tsx ← Root layout
|
|
58
|
+
└── +not-found.tsx
|
|
59
|
+
assets/
|
|
60
|
+
components/
|
|
61
|
+
constants/
|
|
62
|
+
hooks/
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## config.json
|
|
66
|
+
|
|
67
|
+
- platform: "mobile"
|
|
68
|
+
- lang: "typescript"
|
|
69
|
+
- monorepo: false
|