@nimbuslab/cli 0.16.4 → 0.16.7

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/docs/CI-CD.md DELETED
@@ -1,181 +0,0 @@
1
- # CI/CD - Publicacao no npm
2
-
3
- Documentacao do pipeline de publicacao automatica no npm.
4
-
5
- ## Como Funciona
6
-
7
- Ao fazer merge na branch `main`, o GitHub Actions publica automaticamente no npm.
8
-
9
- ```
10
- develop → main → GitHub Actions → npm publish
11
- ```
12
-
13
- ## Workflow
14
-
15
- Arquivo: `.github/workflows/publish.yml`
16
-
17
- ```yaml
18
- name: Publish to npm
19
-
20
- on:
21
- push:
22
- branches:
23
- - main
24
-
25
- jobs:
26
- publish:
27
- runs-on: ubuntu-latest
28
- permissions:
29
- contents: read
30
- id-token: write # Necessario para OIDC
31
-
32
- steps:
33
- - uses: actions/checkout@v4
34
- - uses: oven-sh/setup-bun@v2
35
- - uses: actions/setup-node@v4
36
- with:
37
- node-version: "24"
38
- registry-url: "https://registry.npmjs.org"
39
-
40
- - run: bun install
41
- - run: bun run typecheck
42
- - run: bun run build
43
-
44
- - name: Publish to npm
45
- run: npm publish --access public
46
- env:
47
- NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
48
- ```
49
-
50
- ## Requisitos
51
-
52
- ### 1. Secret NPM_TOKEN
53
-
54
- Configurar no GitHub:
55
- 1. Acesse: `Settings > Secrets and variables > Actions`
56
- 2. Criar secret `NPM_TOKEN` com um Granular Access Token do npm
57
-
58
- Para criar o token no npm:
59
- 1. Acesse: https://www.npmjs.com/settings/tokens
60
- 2. Clique em "Generate New Token" > "Granular Access Token"
61
- 3. Selecione permissao de publish para `@nimbuslab/cli`
62
- 4. Copie o token e adicione como secret no GitHub
63
-
64
- ### 2. Permissoes do Workflow
65
-
66
- O workflow precisa de:
67
- - `contents: read` - para checkout
68
- - `id-token: write` - para OIDC (opcional, mas recomendado)
69
-
70
- ## Fluxo de Release
71
-
72
- 1. Desenvolva na branch `develop`
73
- 2. Atualize a versao no `package.json` e `src/index.ts`
74
- 3. Commit e push: `git push origin develop`
75
- 4. Merge para main:
76
- ```bash
77
- git checkout main
78
- git merge develop
79
- git push origin main
80
- git checkout develop
81
- ```
82
- 5. GitHub Actions publica automaticamente
83
-
84
- ## Versionamento
85
-
86
- Seguimos [Semantic Versioning](https://semver.org/):
87
-
88
- | Tipo | Quando usar | Exemplo |
89
- |------|-------------|---------|
90
- | Patch | Bug fixes | 0.6.3 → 0.6.4 |
91
- | Minor | Novas features | 0.6.3 → 0.7.0 |
92
- | Major | Breaking changes | 0.6.3 → 1.0.0 |
93
-
94
- **IMPORTANTE:** Atualizar a versao em DOIS lugares:
95
- - `package.json` → campo `version`
96
- - `src/index.ts` → constante `CURRENT_VERSION`
97
-
98
- ## Troubleshooting
99
-
100
- ### Erro: "You cannot publish over the previously published versions"
101
-
102
- A versao ja foi publicada. Bump a versao e tente novamente.
103
-
104
- ### Erro: "E401 Unauthorized"
105
-
106
- O token NPM_TOKEN esta invalido ou expirado.
107
- 1. Gere um novo token no npmjs.com
108
- 2. Atualize a secret no GitHub
109
-
110
- ### Erro: "E403 Forbidden"
111
-
112
- O token nao tem permissao de publish.
113
- 1. Verifique se o token tem permissao para `@nimbuslab/cli`
114
- 2. Verifique se voce e maintainer do pacote
115
-
116
- ### CI passa mas versao nao aparece no npm
117
-
118
- Isso pode acontecer quando:
119
- 1. **OIDC sem NODE_AUTH_TOKEN**: O OIDC pode falhar silenciosamente
120
- 2. **Trusted Publisher mal configurado**: Verificar no npmjs.com
121
-
122
- **Solucao**: Sempre usar `NODE_AUTH_TOKEN` como fallback:
123
- ```yaml
124
- - name: Publish to npm
125
- run: npm publish --access public
126
- env:
127
- NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
128
- ```
129
-
130
- ### Verificar se publicou
131
-
132
- ```bash
133
- # Ver ultimas versoes
134
- curl -s "https://registry.npmjs.org/@nimbuslab/cli" | jq '.versions | keys | .[-5:]'
135
-
136
- # Ver versao latest
137
- curl -s "https://registry.npmjs.org/@nimbuslab/cli" | jq -r '.["dist-tags"].latest'
138
- ```
139
-
140
- ## OIDC Trusted Publishing (Opcional)
141
-
142
- O npm suporta autenticacao via OIDC, eliminando necessidade de tokens.
143
-
144
- ### Configuracao no npmjs.com
145
-
146
- 1. Acesse: https://www.npmjs.com/package/@nimbuslab/cli/access
147
- 2. Em "Trusted Publisher", configure:
148
- - Organization: `nimbuslab`
149
- - Repository: `cli`
150
- - Workflow: `publish.yml`
151
-
152
- ### Limitacoes do OIDC
153
-
154
- - Nao funciona para publicar a versao inicial do pacote
155
- - Pode falhar silenciosamente em alguns casos
156
- - Requer `id-token: write` no workflow
157
-
158
- **Recomendacao**: Mesmo usando OIDC, manter `NODE_AUTH_TOKEN` como fallback.
159
-
160
- ## Historico de Problemas
161
-
162
- ### 2026-01-26: Publicacao falhando silenciosamente
163
-
164
- **Problema**: CI mostrava sucesso (`+ @nimbuslab/cli@0.6.x`) mas versao nao aparecia no npm. Tarball retornava 404 com mensagem "Access token expired or revoked".
165
-
166
- **Causa**: OIDC Trusted Publishing falhando silenciosamente. Os tarballs eram criados mas ficavam inacessiveis.
167
-
168
- **Solucao**: Adicionar `NODE_AUTH_TOKEN` como fallback junto com OIDC.
169
-
170
- ```yaml
171
- - name: Publish to npm
172
- run: npm publish --access public
173
- env:
174
- NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
175
- ```
176
-
177
- **Importante**: Mesmo com OIDC configurado, SEMPRE manter o `NODE_AUTH_TOKEN` como fallback. O token deve ser do tipo "Granular Access Token" (nao "Classic", que foi deprecado em dez/2025).
178
-
179
- ---
180
-
181
- *Ultima atualizacao: 2026-01-26*
package/docs/analyze.md DELETED
@@ -1,148 +0,0 @@
1
- # nimbus analyze
2
-
3
- Analisa a stack de um projeto existente e sugere melhorias baseadas na stack nimbuslab.
4
-
5
- ## Uso
6
-
7
- ```bash
8
- # Analisar diretorio atual
9
- nimbus analyze
10
-
11
- # Analisar diretorio especifico
12
- nimbus analyze ./meu-projeto
13
- nimbus analyze ~/www/nimbuslab/projeto
14
-
15
- # Output em JSON (para automacao)
16
- nimbus analyze --json
17
- ```
18
-
19
- ## O que Detecta
20
-
21
- ### Framework
22
- - Next.js (com versao)
23
- - React (standalone)
24
- - Angular
25
- - Vue
26
- - Svelte
27
-
28
- ### Styling
29
- - Tailwind CSS (com versao)
30
- - styled-components
31
- - Emotion
32
- - Sass/SCSS
33
- - Less
34
- - CSS puro
35
-
36
- ### Package Manager
37
- - bun (recomendado)
38
- - pnpm
39
- - npm
40
- - yarn
41
-
42
- ### Monorepo
43
- - Turborepo
44
- - Nx
45
- - Lerna
46
- - Workspaces nativo
47
-
48
- ### Autenticacao
49
- - Better Auth (recomendado)
50
- - NextAuth / Auth.js
51
- - Clerk
52
- - Auth0
53
- - Supabase Auth
54
-
55
- ### Banco de Dados
56
- - Drizzle ORM (recomendado)
57
- - Prisma
58
- - TypeORM
59
- - Mongoose
60
- - pg / mysql2 direto
61
-
62
- ### Outros
63
- - TypeScript (tsconfig.json)
64
- - ESLint
65
- - Prettier
66
-
67
- ## Recomendacoes Automaticas
68
-
69
- O comando gera recomendacoes baseadas na stack nimbuslab:
70
-
71
- | Detectado | Recomendacao |
72
- |-----------|--------------|
73
- | pnpm/npm/yarn | Migrar para bun |
74
- | Next.js < 16 | Atualizar para Next.js 16 |
75
- | React < 19 | Atualizar para React 19 |
76
- | Tailwind < 4 | Atualizar para Tailwind 4 |
77
- | Prisma | Considerar Drizzle ORM |
78
- | NextAuth | Considerar Better Auth |
79
- | Sem auth | Adicionar autenticacao |
80
- | Sem DB | Adicionar banco de dados |
81
-
82
- ## Exemplo de Output
83
-
84
- ```
85
- Analisando projeto...
86
-
87
- Projeto: meu-app v1.0.0
88
-
89
- Stack Detectada:
90
- Framework: nextjs@15.0.2
91
- Styling: tailwind@3.4.1
92
- Package Manager: pnpm
93
- TypeScript: sim
94
- Monorepo: turborepo
95
- Auth: next-auth
96
- Database: prisma
97
-
98
- Recomendacoes:
99
- 1. Migrar pnpm -> bun (nimbus codemod bun)
100
- 2. Atualizar Next.js 15 -> 16 (nimbus upgrade next)
101
- 3. Atualizar React 18 -> 19 (nimbus upgrade react)
102
- 4. Atualizar Tailwind 3 -> 4 (nimbus upgrade tailwind)
103
- 5. Considerar migrar Prisma -> Drizzle (nimbus codemod drizzle)
104
- ```
105
-
106
- ## Output JSON
107
-
108
- Com `--json`, retorna estrutura para automacao:
109
-
110
- ```json
111
- {
112
- "name": "meu-app",
113
- "version": "1.0.0",
114
- "framework": "nextjs",
115
- "frameworkVersion": "15.0.2",
116
- "styling": ["tailwind@3.4.1"],
117
- "packageManager": "pnpm",
118
- "monorepo": "turborepo",
119
- "auth": "next-auth",
120
- "database": "prisma",
121
- "typescript": true,
122
- "recommendations": [
123
- "Migrar pnpm -> bun",
124
- "Atualizar Next.js 15 -> 16"
125
- ]
126
- }
127
- ```
128
-
129
- ## Integracao com Outros Comandos
130
-
131
- ```bash
132
- # Analisar e depois ver plano de upgrade
133
- nimbus analyze
134
- nimbus upgrade --plan
135
-
136
- # Pipeline completo
137
- nimbus analyze ./projeto && nimbus upgrade --plan
138
- ```
139
-
140
- ## Limitacoes
141
-
142
- - Analisa apenas `package.json` e arquivos de config
143
- - Nao analisa codigo-fonte
144
- - Requer projeto Node.js (package.json)
145
-
146
- ---
147
-
148
- [Voltar ao README](../README.md) | [create](./create.md) | [upgrade](./upgrade.md) | [migrate](./migrate.md)
package/docs/create.md DELETED
@@ -1,219 +0,0 @@
1
- # nimbus create
2
-
3
- Cria novo projeto com a stack nimbuslab.
4
-
5
- ---
6
-
7
- ## Uso
8
-
9
- ```bash
10
- nimbus create # Interativo
11
- nimbus create meu-projeto # Com nome
12
- nimbus create meu-projeto --landing # Landing page
13
- nimbus create meu-projeto --app # Web app completo
14
- nimbus create meu-projeto --turborepo # Monorepo
15
- nimbus create meu-pacote --package # Pacote npm
16
- ```
17
-
18
- ---
19
-
20
- ## Templates
21
-
22
- ### Landing Page (`--landing`)
23
-
24
- Stack minima para landing pages de alta conversao.
25
-
26
- | Tecnologia | Versao |
27
- |------------|--------|
28
- | Next.js | 16+ |
29
- | React | 19+ |
30
- | Tailwind CSS | 4+ |
31
- | shadcn/ui | latest |
32
- | TypeScript | 5.7+ |
33
-
34
- **Estrutura:**
35
- ```
36
- app/
37
- ├── page.tsx # Home
38
- ├── layout.tsx # Layout root
39
- └── globals.css # Estilos globais
40
- components/
41
- ├── ui/ # shadcn/ui
42
- ├── hero.tsx
43
- ├── features.tsx
44
- ├── cta.tsx
45
- └── footer.tsx
46
- ```
47
-
48
- **Repo:** [create-next-landing](https://github.com/nimbuslab/create-next-landing)
49
-
50
- ---
51
-
52
- ### Web App (`--app`)
53
-
54
- Landing + autenticacao + banco de dados.
55
-
56
- | Tecnologia | Versao |
57
- |------------|--------|
58
- | Next.js | 16+ |
59
- | React | 19+ |
60
- | Tailwind CSS | 4+ |
61
- | shadcn/ui | latest |
62
- | Better Auth | latest |
63
- | Drizzle ORM | latest |
64
- | Docker | Compose |
65
-
66
- **Estrutura:**
67
- ```
68
- app/
69
- ├── (auth)/ # Rotas autenticacao
70
- │ ├── login/
71
- │ └── register/
72
- ├── (dashboard)/ # Rotas protegidas
73
- │ └── dashboard/
74
- ├── api/ # API routes
75
- └── page.tsx # Landing
76
- components/
77
- ├── ui/ # shadcn/ui
78
- └── auth/ # Componentes auth
79
- lib/
80
- ├── auth.ts # Config Better Auth
81
- └── db.ts # Config Drizzle
82
- ```
83
-
84
- **Repo:** [create-next-app](https://github.com/nimbuslab/create-next-app)
85
-
86
- ---
87
-
88
- ### Turborepo (`--turborepo`)
89
-
90
- Monorepo com apps e packages compartilhados.
91
-
92
- | Tecnologia | Uso |
93
- |------------|-----|
94
- | Turborepo | Build system |
95
- | pnpm | Workspaces |
96
- | TypeScript | Config compartilhada |
97
- | ESLint | Config compartilhada |
98
-
99
- **Estrutura:**
100
- ```
101
- apps/
102
- ├── web/ # App principal
103
- ├── docs/ # Documentacao
104
- └── admin/ # Painel admin
105
- packages/
106
- ├── ui/ # Design system
107
- ├── config/ # Configs (TS, ESLint)
108
- └── utils/ # Utilitarios
109
- ```
110
-
111
- **Repo:** [create-turborepo](https://github.com/nimbuslab/create-turborepo)
112
-
113
- ---
114
-
115
- ### Pacote npm (`--package`)
116
-
117
- Pacote npm pronto para publicar.
118
-
119
- | Tecnologia | Uso |
120
- |------------|-----|
121
- | TypeScript | Linguagem |
122
- | tsup | Build (ESM + CJS) |
123
- | Bun | Runtime e testes |
124
-
125
- **Estrutura:**
126
- ```
127
- meu-pacote/
128
- ├── src/
129
- │ └── index.ts # Entry point
130
- ├── package.json # Configurado para npm
131
- ├── tsconfig.json
132
- ├── tsup.config.ts # Build config
133
- ├── CHANGELOG.md
134
- └── .github/
135
- └── workflows/
136
- └── publish.yml # CI/CD automatico
137
- ```
138
-
139
- **Documentacao completa:** [docs/package.md](./package.md)
140
-
141
- ---
142
-
143
- ## Opcoes
144
-
145
- | Flag | Descricao |
146
- |------|-----------|
147
- | `-y, --yes` | Aceitar todos os padroes |
148
- | `--no-git` | Nao inicializar repositorio Git |
149
- | `--no-install` | Nao instalar dependencias |
150
- | `--template <url>` | Usar template customizado |
151
-
152
- ---
153
-
154
- ## Fluxo Interativo
155
-
156
- Quando executado sem flags, o CLI pergunta:
157
-
158
- 1. **Nome do projeto** - Nome da pasta
159
- 2. **Tipo de projeto** - landing, app ou turborepo
160
- 3. **Tema** - dark, light ou system
161
- 4. **Assistente IA** - Claude, Cursor, Gemini, Copilot, Windsurf
162
- 5. **Criar repo GitHub?** - Se sim, busca orgs do usuario
163
-
164
- ---
165
-
166
- ## Exemplos
167
-
168
- ### Criar landing page rapida
169
-
170
- ```bash
171
- nimbus create meu-site --landing -y
172
- cd meu-site
173
- bun dev
174
- ```
175
-
176
- ### Criar app com banco de dados
177
-
178
- ```bash
179
- nimbus create meu-app --app
180
- cd meu-app
181
- bun setup # Configura Docker + Drizzle
182
- bun dev
183
- ```
184
-
185
- ### Criar monorepo
186
-
187
- ```bash
188
- nimbus create minha-empresa --turborepo
189
- cd minha-empresa
190
- turbo dev
191
- ```
192
-
193
- ---
194
-
195
- ## Pos-criacao
196
-
197
- ### Landing Page
198
-
199
- ```bash
200
- bun dev # Iniciar servidor
201
- ```
202
-
203
- ### Web App
204
-
205
- ```bash
206
- bun setup # Configurar ambiente (Docker, banco)
207
- bun dev # Iniciar servidor
208
- ```
209
-
210
- ### Turborepo
211
-
212
- ```bash
213
- turbo dev # Iniciar todos os apps
214
- turbo build # Build de producao
215
- ```
216
-
217
- ---
218
-
219
- [Voltar ao README](../README.md) | [analyze](./analyze.md) | [upgrade](./upgrade.md) | [migrate](./migrate.md)
package/docs/migrate.md DELETED
@@ -1,177 +0,0 @@
1
- # nimbus migrate
2
-
3
- Migra projetos de outras tecnologias para a stack nimbuslab usando Strangler Fig Pattern.
4
-
5
- > **Status:** Em desenvolvimento - Veja [MIGRATION-ROADMAP.md](../MIGRATION-ROADMAP.md)
6
-
7
- ## Uso
8
-
9
- ```bash
10
- # Ver plano de migracao
11
- nimbus migrate --from=angular --plan
12
-
13
- # Executar migracao (futuro)
14
- nimbus migrate --execute
15
-
16
- # Verificar resultado (futuro)
17
- nimbus migrate --verify
18
- ```
19
-
20
- ## Strangler Fig Pattern
21
-
22
- Padrao criado por Martin Fowler para migrar sistemas sem "big bang rewrite".
23
-
24
- ### Como Funciona
25
-
26
- ```
27
- 1. Sistema Antigo (100% trafego)
28
-
29
- 2. Criar facade/gateway
30
-
31
- 3. Migrar primeira fatia (10% no novo)
32
-
33
- 4. Aumentar gradualmente (50%, 80%, 100%)
34
-
35
- 5. Aposentar sistema antigo
36
- ```
37
-
38
- ### Por que NAO fazer Big Bang?
39
-
40
- | Big Bang | Strangler Fig |
41
- |----------|---------------|
42
- | Alto risco | Risco controlado |
43
- | Tudo ou nada | Entregas continuas |
44
- | Meses sem valor | Valor a cada sprint |
45
- | Rollback impossivel | Rollback facil |
46
-
47
- ## Tipos de Migracao
48
-
49
- ### 1. Upgrade de Versao (Baixo Risco)
50
-
51
- ```
52
- Next.js 15 -> 16
53
- React 18 -> 19
54
- Tailwind 3 -> 4
55
- ```
56
-
57
- **Estrategia:** Codemods automaticos
58
-
59
- ### 2. Mudanca de Stack (Medio Risco)
60
-
61
- ```
62
- pnpm -> bun
63
- Prisma -> Drizzle
64
- NextAuth -> Better Auth
65
- ```
66
-
67
- **Estrategia:** Dual write + feature flags
68
-
69
- ### 3. Mudanca de Tecnologia (Alto Risco)
70
-
71
- ```
72
- Angular -> Next.js
73
- PHP/Laravel -> Next.js
74
- Vue -> React
75
- ```
76
-
77
- **Estrategia:** Strangler Fig completo
78
-
79
- ### 4. Mudanca de Arquitetura (Muito Alto Risco)
80
-
81
- ```
82
- Monolito -> Microservices
83
- Projeto solo -> Monorepo
84
- ```
85
-
86
- **Estrategia:** Strangler Fig + event sourcing
87
-
88
- ## Padroes de Migracao
89
-
90
- ### Feature Flag Migration
91
-
92
- ```typescript
93
- if (featureFlags.newCheckout) {
94
- return <NewCheckout /> // Next.js
95
- } else {
96
- return <LegacyCheckout /> // Angular
97
- }
98
- ```
99
-
100
- ### Dual Write
101
-
102
- ```typescript
103
- async function saveUser(data) {
104
- await legacyDB.save(data) // Sistema antigo
105
- await newDB.save(data) // Sistema novo
106
- }
107
- ```
108
-
109
- ### API Gateway
110
-
111
- ```
112
- Cliente -> Gateway -> /api/v1/* -> Sistema Antigo
113
- -> /api/v2/* -> Sistema Novo
114
- ```
115
-
116
- ## Checklist de Migracao
117
-
118
- ### Pre-Migracao
119
- - [ ] Inventario de features
120
- - [ ] Mapa de dependencias
121
- - [ ] Cobertura de testes
122
- - [ ] Backup completo
123
- - [ ] Branch de migracao
124
- - [ ] CI/CD configurado
125
- - [ ] Feature flags prontos
126
-
127
- ### Durante (por fatia)
128
- - [ ] Fatia isolada
129
- - [ ] Testes primeiro
130
- - [ ] Implementacao
131
- - [ ] Code review
132
- - [ ] Deploy staging
133
- - [ ] Rollout gradual
134
- - [ ] Monitoramento
135
-
136
- ### Pos-Migracao
137
- - [ ] Codigo antigo removido
138
- - [ ] Docs atualizados
139
- - [ ] Retrospectiva
140
-
141
- ## Anti-Patterns
142
-
143
- ### 1. Big Bang Rewrite
144
- **Problema:** Meses sem entregar valor, risco total
145
- **Solucao:** Strangler Fig
146
-
147
- ### 2. Migracao sem Testes
148
- **Problema:** Bugs em producao
149
- **Solucao:** Testes antes de migrar
150
-
151
- ### 3. Dual Write Infinito
152
- **Problema:** Dois sistemas para sempre
153
- **Solucao:** Prazo para aposentar
154
-
155
- ### 4. Ignorar Dados
156
- **Problema:** Inconsistencia
157
- **Solucao:** Event sourcing
158
-
159
- ## Roadmap
160
-
161
- Veja [MIGRATION-ROADMAP.md](../MIGRATION-ROADMAP.md) para milestones detalhadas:
162
-
163
- - **Fase 1:** Fundacao (analyze, upgrade)
164
- - **Fase 2:** Codemods (Tailwind, React, Prisma)
165
- - **Fase 3:** Templates modulares
166
- - **Fase 4:** Migracao assistida
167
- - **Fase 5:** Automacao completa
168
-
169
- ## Referencias
170
-
171
- - [Strangler Fig Pattern - Martin Fowler](https://martinfowler.com/bliki/StranglerFigApplication.html)
172
- - [Codemods API Refactoring](https://martinfowler.com/articles/codemods-api-refactoring.html)
173
- - [ThoughtWorks - Strangler Fig](https://www.thoughtworks.com/insights/articles/embracing-strangler-fig-pattern-legacy-modernization-part-one)
174
-
175
- ---
176
-
177
- [Voltar ao README](../README.md) | [create](./create.md) | [analyze](./analyze.md) | [upgrade](./upgrade.md)