@nimbuslab/cli 0.1.2 → 0.1.4

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/dist/index.js CHANGED
@@ -784,11 +784,12 @@ var import_picocolors3 = __toESM(require_picocolors(), 1);
784
784
  var {$: $2 } = globalThis.Bun;
785
785
  import { rm } from "fs/promises";
786
786
  import { join } from "path";
787
- var TEMPLATE_REPO = "git@github.com:nimbuslab-templates/fast-by-nimbuslab.git";
787
+ var TEMPLATE_REPO = "nimbuslab-templates/fast-by-nimbuslab";
788
788
  async function create(args) {
789
789
  const checkCmd = process.platform === "win32" ? "where" : "which";
790
790
  const hasBun = await $2`${checkCmd} bun`.quiet().then(() => true).catch(() => false);
791
791
  const hasGit = await $2`${checkCmd} git`.quiet().then(() => true).catch(() => false);
792
+ const hasGh = await $2`${checkCmd} gh`.quiet().then(() => true).catch(() => false);
792
793
  if (!hasBun) {
793
794
  console.log(import_picocolors3.default.red("Erro: Bun nao encontrado."));
794
795
  console.log(import_picocolors3.default.dim("Instale em: https://bun.sh"));
@@ -806,6 +807,24 @@ async function create(args) {
806
807
  console.log(import_picocolors3.default.dim("Instale git para continuar."));
807
808
  process.exit(1);
808
809
  }
810
+ if (!hasGh) {
811
+ console.log(import_picocolors3.default.red("Erro: GitHub CLI (gh) nao encontrado."));
812
+ console.log(import_picocolors3.default.dim("Instale em: https://cli.github.com"));
813
+ console.log();
814
+ if (process.platform === "win32") {
815
+ console.log(import_picocolors3.default.cyan("winget install GitHub.cli"));
816
+ } else {
817
+ console.log(import_picocolors3.default.cyan("sudo apt install gh # ou brew install gh"));
818
+ }
819
+ console.log();
820
+ process.exit(1);
821
+ }
822
+ const ghAuth = await $2`gh auth status`.quiet().then(() => true).catch(() => false);
823
+ if (!ghAuth) {
824
+ console.log(import_picocolors3.default.red("Erro: GitHub CLI nao autenticado."));
825
+ console.log(import_picocolors3.default.dim("Execute: gh auth login"));
826
+ process.exit(1);
827
+ }
809
828
  const hasYes = args.includes("-y") || args.includes("--yes");
810
829
  const projectName = args.find((a) => !a.startsWith("-"));
811
830
  Ie(import_picocolors3.default.bgCyan(import_picocolors3.default.black(" Novo Projeto nimbuslab ")));
@@ -889,12 +908,12 @@ async function createProject(config) {
889
908
  const s = Y2();
890
909
  s.start("Clonando template...");
891
910
  try {
892
- await $2`git clone --depth 1 ${TEMPLATE_REPO} ${config.name}`.quiet();
911
+ await $2`gh repo clone ${TEMPLATE_REPO} ${config.name} -- --depth 1`.quiet();
893
912
  await rm(join(config.name, ".git"), { recursive: true, force: true });
894
913
  s.stop("Template clonado");
895
914
  } catch (error) {
896
915
  s.stop("Erro ao clonar template");
897
- throw new Error("Falha ao clonar template. Verifique sua conexao.");
916
+ throw new Error("Falha ao clonar template. Verifique se tem acesso ao repositorio.");
898
917
  }
899
918
  s.start("Configurando projeto...");
900
919
  try {
@@ -958,14 +977,14 @@ var LOGO = `
958
977
  \u2588\u2588\u2554\u2588\u2588\u2557 \u2588\u2588\u2551\u2588\u2588\u2551\u2588\u2588\u2554\u2588\u2588\u2588\u2588\u2554\u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557
959
978
  \u2588\u2588\u2551\u255A\u2588\u2588\u2557\u2588\u2588\u2551\u2588\u2588\u2551\u2588\u2588\u2551\u255A\u2588\u2588\u2554\u255D\u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2551 \u2588\u2588\u2551\u255A\u2550\u2550\u2550\u2550\u2588\u2588\u2551
960
979
  \u2588\u2588\u2551 \u255A\u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2551\u2588\u2588\u2551 \u255A\u2550\u255D \u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u255A\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551
961
- \u255A\u2550\u255D \u255A\u2550\u2550\u2550\u255D\u255A\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u255D\u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D
962
- `;
980
+ \u255A\u2550\u255D \u255A\u2550\u2550\u2550\u255D\u255A\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u255D\u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D`;
963
981
  async function main() {
964
982
  const args = process.argv.slice(2);
965
983
  const command = args[0];
966
984
  console.log(import_picocolors4.default.cyan(LOGO));
967
- console.log(import_picocolors4.default.dim(` CLI da nimbuslab - Crie projetos incr\xEDveis
968
- `));
985
+ console.log(import_picocolors4.default.white(" CLI da nimbuslab"));
986
+ console.log(import_picocolors4.default.dim(" Crie projetos incriveis"));
987
+ console.log();
969
988
  if (!command || command === "create") {
970
989
  await create(args.slice(1));
971
990
  } else if (command === "help" || command === "--help" || command === "-h") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nimbuslab/cli",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "CLI para criar projetos nimbuslab",
5
5
  "type": "module",
6
6
  "bin": {
@@ -4,7 +4,7 @@ import { $} from "bun"
4
4
  import { rm } from "node:fs/promises"
5
5
  import { join } from "node:path"
6
6
 
7
- const TEMPLATE_REPO = "git@github.com:nimbuslab-templates/fast-by-nimbuslab.git"
7
+ const TEMPLATE_REPO = "nimbuslab-templates/fast-by-nimbuslab"
8
8
 
9
9
  interface ProjectConfig {
10
10
  name: string
@@ -18,6 +18,7 @@ export async function create(args: string[]) {
18
18
  const checkCmd = process.platform === "win32" ? "where" : "which"
19
19
  const hasBun = await $`${checkCmd} bun`.quiet().then(() => true).catch(() => false)
20
20
  const hasGit = await $`${checkCmd} git`.quiet().then(() => true).catch(() => false)
21
+ const hasGh = await $`${checkCmd} gh`.quiet().then(() => true).catch(() => false)
21
22
 
22
23
  if (!hasBun) {
23
24
  console.log(pc.red("Erro: Bun nao encontrado."))
@@ -38,6 +39,27 @@ export async function create(args: string[]) {
38
39
  process.exit(1)
39
40
  }
40
41
 
42
+ if (!hasGh) {
43
+ console.log(pc.red("Erro: GitHub CLI (gh) nao encontrado."))
44
+ console.log(pc.dim("Instale em: https://cli.github.com"))
45
+ console.log()
46
+ if (process.platform === "win32") {
47
+ console.log(pc.cyan("winget install GitHub.cli"))
48
+ } else {
49
+ console.log(pc.cyan("sudo apt install gh # ou brew install gh"))
50
+ }
51
+ console.log()
52
+ process.exit(1)
53
+ }
54
+
55
+ // Verifica se gh esta autenticado
56
+ const ghAuth = await $`gh auth status`.quiet().then(() => true).catch(() => false)
57
+ if (!ghAuth) {
58
+ console.log(pc.red("Erro: GitHub CLI nao autenticado."))
59
+ console.log(pc.dim("Execute: gh auth login"))
60
+ process.exit(1)
61
+ }
62
+
41
63
  const hasYes = args.includes("-y") || args.includes("--yes")
42
64
  const projectName = args.find(a => !a.startsWith("-"))
43
65
 
@@ -134,15 +156,15 @@ async function promptConfig(initialName?: string): Promise<ProjectConfig | symbo
134
156
  async function createProject(config: ProjectConfig) {
135
157
  const s = p.spinner()
136
158
 
137
- // Clone template
159
+ // Clone template usando gh (funciona com token OAuth)
138
160
  s.start("Clonando template...")
139
161
  try {
140
- await $`git clone --depth 1 ${TEMPLATE_REPO} ${config.name}`.quiet()
162
+ await $`gh repo clone ${TEMPLATE_REPO} ${config.name} -- --depth 1`.quiet()
141
163
  await rm(join(config.name, ".git"), { recursive: true, force: true })
142
164
  s.stop("Template clonado")
143
165
  } catch (error) {
144
166
  s.stop("Erro ao clonar template")
145
- throw new Error("Falha ao clonar template. Verifique sua conexao.")
167
+ throw new Error("Falha ao clonar template. Verifique se tem acesso ao repositorio.")
146
168
  }
147
169
 
148
170
  // Update package.json
@@ -165,15 +187,21 @@ async function createProject(config: ProjectConfig) {
165
187
  s.stop("Configuracao fast+ preparada")
166
188
  }
167
189
 
168
- // Git init
190
+ // Git init with full branch flow: main → staging → develop
169
191
  if (config.git) {
170
192
  s.start("Inicializando Git...")
171
193
  try {
172
194
  const cwd = config.name
173
- await $`git init`.cwd(cwd).quiet()
195
+ // Init with main branch (not master)
196
+ await $`git init -b main`.cwd(cwd).quiet()
174
197
  await $`git add -A`.cwd(cwd).quiet()
175
198
  await $`git commit -m "chore: setup inicial via nimbus create"`.cwd(cwd).quiet()
176
- s.stop("Git inicializado")
199
+
200
+ // Create branch flow: main → staging → develop
201
+ await $`git checkout -b staging`.cwd(cwd).quiet()
202
+ await $`git checkout -b develop`.cwd(cwd).quiet()
203
+
204
+ s.stop("Git inicializado (main -> staging -> develop)")
177
205
  } catch (error) {
178
206
  s.stop("Erro ao inicializar Git")
179
207
  }
@@ -205,11 +233,22 @@ function showNextSteps(config: ProjectConfig) {
205
233
  console.log(` ${pc.cyan("bun")} dev`)
206
234
  console.log()
207
235
 
236
+ // Git flow info
237
+ if (config.git) {
238
+ console.log(pc.dim(" Git flow: main -> staging -> develop (branch atual)"))
239
+ console.log()
240
+ }
241
+
208
242
  if (config.type === "fast+") {
209
243
  console.log(pc.dim(" Dica: Execute 'bun setup' e escolha fast+ para configurar backend"))
210
244
  console.log()
211
245
  }
212
246
 
247
+ // Dica para configurar GitHub no bun setup
248
+ console.log(pc.yellow(" Dica: No 'bun setup', voce pode criar o repositorio GitHub."))
249
+ console.log(pc.dim(" Copie a URL gerada para configurar o remote do projeto."))
250
+ console.log()
251
+
213
252
  console.log(pc.dim(" Documentacao: https://github.com/nimbuslab/fast-by-nimbuslab"))
214
253
  console.log()
215
254
  }
package/src/index.ts CHANGED
@@ -10,15 +10,16 @@ const LOGO = `
10
10
  ██╔██╗ ██║██║██╔████╔██║██████╔╝██║ ██║███████╗
11
11
  ██║╚██╗██║██║██║╚██╔╝██║██╔══██╗██║ ██║╚════██║
12
12
  ██║ ╚████║██║██║ ╚═╝ ██║██████╔╝╚██████╔╝███████║
13
- ╚═╝ ╚═══╝╚═╝╚═╝ ╚═╝╚═════╝ ╚═════╝ ╚══════╝
14
- `
13
+ ╚═╝ ╚═══╝╚═╝╚═╝ ╚═╝╚═════╝ ╚═════╝ ╚══════╝`
15
14
 
16
15
  async function main() {
17
16
  const args = process.argv.slice(2)
18
17
  const command = args[0]
19
18
 
20
19
  console.log(pc.cyan(LOGO))
21
- console.log(pc.dim(" CLI da nimbuslab - Crie projetos incríveis\n"))
20
+ console.log(pc.white(" CLI da nimbuslab"))
21
+ console.log(pc.dim(" Crie projetos incriveis"))
22
+ console.log()
22
23
 
23
24
  if (!command || command === "create") {
24
25
  await create(args.slice(1))
package/bun.lock DELETED
@@ -1,38 +0,0 @@
1
- {
2
- "lockfileVersion": 1,
3
- "configVersion": 1,
4
- "workspaces": {
5
- "": {
6
- "name": "nimbus-cli",
7
- "dependencies": {
8
- "@clack/prompts": "^0.11.0",
9
- "picocolors": "^1.1.1",
10
- },
11
- "devDependencies": {
12
- "@types/bun": "latest",
13
- },
14
- "peerDependencies": {
15
- "typescript": "^5",
16
- },
17
- },
18
- },
19
- "packages": {
20
- "@clack/core": ["@clack/core@0.5.0", "", { "dependencies": { "picocolors": "^1.0.0", "sisteransi": "^1.0.5" } }, "sha512-p3y0FIOwaYRUPRcMO7+dlmLh8PSRcrjuTndsiA0WAFbWES0mLZlrjVoBRZ9DzkPFJZG6KGkJmoEAY0ZcVWTkow=="],
21
-
22
- "@clack/prompts": ["@clack/prompts@0.11.0", "", { "dependencies": { "@clack/core": "0.5.0", "picocolors": "^1.0.0", "sisteransi": "^1.0.5" } }, "sha512-pMN5FcrEw9hUkZA4f+zLlzivQSeQf5dRGJjSUbvVYDLvpKCdQx5OaknvKzgbtXOizhP+SJJJjqEbOe55uKKfAw=="],
23
-
24
- "@types/bun": ["@types/bun@1.3.6", "", { "dependencies": { "bun-types": "1.3.6" } }, "sha512-uWCv6FO/8LcpREhenN1d1b6fcspAB+cefwD7uti8C8VffIv0Um08TKMn98FynpTiU38+y2dUO55T11NgDt8VAA=="],
25
-
26
- "@types/node": ["@types/node@25.0.10", "", { "dependencies": { "undici-types": "~7.16.0" } }, "sha512-zWW5KPngR/yvakJgGOmZ5vTBemDoSqF3AcV/LrO5u5wTWyEAVVh+IT39G4gtyAkh3CtTZs8aX/yRM82OfzHJRg=="],
27
-
28
- "bun-types": ["bun-types@1.3.6", "", { "dependencies": { "@types/node": "*" } }, "sha512-OlFwHcnNV99r//9v5IIOgQ9Uk37gZqrNMCcqEaExdkVq3Avwqok1bJFmvGMCkCE0FqzdY8VMOZpfpR3lwI+CsQ=="],
29
-
30
- "picocolors": ["picocolors@1.1.1", "", {}, "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA=="],
31
-
32
- "sisteransi": ["sisteransi@1.0.5", "", {}, "sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg=="],
33
-
34
- "typescript": ["typescript@5.9.3", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw=="],
35
-
36
- "undici-types": ["undici-types@7.16.0", "", {}, "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw=="],
37
- }
38
- }