create-kontrolia-auth 2.1.0 → 2.2.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/README.md CHANGED
@@ -40,6 +40,7 @@ pnpm --filter create-kontrolia-auth dev
40
40
  | ------------------------------------- | ----------------------------------------------------------------------------- |
41
41
  | `npx create-kontrolia-auth [carpeta]` | Instalación completa (el flujo de arriba). |
42
42
  | `npx create-kontrolia-auth update` | Descarga el código nuevo (`git pull`) sobre una copia ya instalada, instala dependencias, y aplica las migraciones nuevas. |
43
+ | `npx create-kontrolia-auth deploy` | Va directo al paso de despliegue (URLs, cliente OAuth, `.env.local`, creación automática en Vercel) sin repetir las preguntas de base de datos ni de aplicación — para cuando ya tienes todo corriendo y solo quieres (re)conectar auth-server o admin-panel a un nuevo destino. |
43
44
  | `npx create-kontrolia-auth migrate` | Aplica/re-aplica las migraciones contra una base existente. |
44
45
  | `npx create-kontrolia-auth doctor` | Solo revisa que tengas Node, pnpm, git y Docker. |
45
46
 
package/dist/index.js CHANGED
@@ -6,6 +6,7 @@ import { askDatabaseStep } from "./steps/database.js";
6
6
  import { askDeploymentStep } from "./steps/deployment.js";
7
7
  import { bringUpAndMigrate } from "./utils/docker.js";
8
8
  import { runPreflight } from "./utils/preflight.js";
9
+ import { textOrExit } from "./utils/prompts.js";
9
10
  import { ensureRepo, isInsideRepo } from "./utils/scaffold.js";
10
11
  import { pullLatest } from "./utils/update.js";
11
12
  /** Applies the schema against an already-reachable database, with a spinner. */
@@ -86,6 +87,31 @@ async function runUpdateCommand() {
86
87
  ? "Listo. Si despliegas con Docker: `docker compose -f docker/docker-compose.yml up -d --build`. Si usas Vercel/Railway/Render/Coolify, vuelve a desplegar (push a tu rama, o su CLI) para que tomen el código nuevo."
87
88
  : "El código ya está actualizado, pero revisa el error de las migraciones antes de redesplegar.");
88
89
  }
90
+ /**
91
+ * `create-kontrolia-auth deploy` — jumps straight to the deployment step
92
+ * (URLs, OAuth client, .env.local generation, and the Vercel auto-create
93
+ * offer) without repeating the database/application questions. For anyone
94
+ * who already has everything running and just wants to (re)connect a
95
+ * deploy target — e.g. adding admin-panel after auth-server was already
96
+ * deployed. Doesn't persist Supabase credentials anywhere between runs, so
97
+ * it still has to ask for them once here.
98
+ */
99
+ async function runDeployCommand() {
100
+ console.clear();
101
+ p.intro("KontrolIA Auth — desplegar auth-server / admin-panel");
102
+ if (!isInsideRepo(process.cwd())) {
103
+ p.log.error("Corre esto dentro de la carpeta donde instalaste KontrolIA Auth (la que tiene docker/docker-compose.yml).");
104
+ p.outro("Nada que hacer aquí.");
105
+ process.exitCode = 1;
106
+ return;
107
+ }
108
+ const supabaseUrl = await textOrExit("URL de tu proyecto Supabase", "https://tu-proyecto.supabase.co");
109
+ const anonKey = await textOrExit("Anon/public key");
110
+ const serviceRoleKey = await textOrExit("Service role key (server-only, nunca la expongas al navegador)");
111
+ const db = { mode: "existing", databaseUrl: "", supabaseUrl, anonKey, serviceRoleKey };
112
+ await askDeploymentStep(process.cwd(), db);
113
+ p.outro("Listo.");
114
+ }
89
115
  /** Default flow: preflight → (scaffold if outside repo) → DB → migrate → app → deploy. */
90
116
  async function runInstall(targetDirArg) {
91
117
  console.clear();
@@ -145,6 +171,8 @@ async function main() {
145
171
  return runDoctor();
146
172
  if (first === "update")
147
173
  return runUpdateCommand();
174
+ if (first === "deploy")
175
+ return runDeployCommand();
148
176
  // `create <dir>` / `install <dir>` / `<dir>` / (nothing) all reach install.
149
177
  const dir = first === "create" || first === "install" ? args[1] : first;
150
178
  return runInstall(dir);
@@ -1 +1 @@
1
- {"version":3,"file":"application.d.ts","sourceRoot":"","sources":["../../src/steps/application.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAYpD;;;;;;GAMG;AACH,wBAAsB,kBAAkB,CAAC,EAAE,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAgG1E"}
1
+ {"version":3,"file":"application.d.ts","sourceRoot":"","sources":["../../src/steps/application.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAYpD;;;;;;GAMG;AACH,wBAAsB,kBAAkB,CAAC,EAAE,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAgG1E"}
@@ -1,5 +1,6 @@
1
1
  import * as p from "@clack/prompts";
2
2
  import { registerApplication } from "@kontrolia/db";
3
+ import { textOrExit } from "../utils/prompts.js";
3
4
  function slugify(name) {
4
5
  return name
5
6
  .trim()
@@ -95,11 +96,3 @@ export async function askApplicationStep(db) {
95
96
  }
96
97
  p.note("Para habilitarla en una organización, entra a admin-panel → \"Aplicaciones\" — cualquier owner/admin puede activarla ahí con un clic.", "Siguiente paso");
97
98
  }
98
- async function textOrExit(message, placeholder) {
99
- const value = await p.text({ message, placeholder });
100
- if (p.isCancel(value)) {
101
- p.cancel("Instalación cancelada.");
102
- process.exit(0);
103
- }
104
- return value;
105
- }
@@ -1 +1 @@
1
- {"version":3,"file":"database.d.ts","sourceRoot":"","sources":["../../src/steps/database.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,UAAU,GAAG,iBAAiB,CAAC;IACrC,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,MAAM,CAAC;CACxB;AAED;;;GAGG;AACH,wBAAsB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,CAmE/E"}
1
+ {"version":3,"file":"database.d.ts","sourceRoot":"","sources":["../../src/steps/database.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,UAAU,GAAG,iBAAiB,CAAC;IACrC,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,MAAM,CAAC;CACxB;AAED;;;GAGG;AACH,wBAAsB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,CAmE/E"}
@@ -2,6 +2,7 @@ import * as p from "@clack/prompts";
2
2
  import { generateJwtSecret } from "../utils/secrets.js";
3
3
  import { generateSupabaseKeys } from "../utils/supabase-keys.js";
4
4
  import { writeEnvFile } from "../utils/files.js";
5
+ import { textOrExit } from "../utils/prompts.js";
5
6
  /**
6
7
  * Question A from the architecture plan: where does Postgres + GoTrue come
7
8
  * from? Two fully independent paths — neither assumes Docker.
@@ -60,11 +61,3 @@ export async function askDatabaseStep(repoRoot) {
60
61
  serviceRoleKey,
61
62
  };
62
63
  }
63
- async function textOrExit(message, placeholder) {
64
- const value = await p.text({ message, placeholder });
65
- if (p.isCancel(value)) {
66
- p.cancel("Instalación cancelada.");
67
- process.exit(0);
68
- }
69
- return value;
70
- }
@@ -0,0 +1,3 @@
1
+ /** A required text prompt — exits cleanly on Ctrl+C instead of returning a cancel symbol to every call site. */
2
+ export declare function textOrExit(message: string, placeholder?: string): Promise<string>;
3
+ //# sourceMappingURL=prompts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../src/utils/prompts.ts"],"names":[],"mappings":"AAEA,gHAAgH;AAChH,wBAAsB,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAOvF"}
@@ -0,0 +1,10 @@
1
+ import * as p from "@clack/prompts";
2
+ /** A required text prompt — exits cleanly on Ctrl+C instead of returning a cancel symbol to every call site. */
3
+ export async function textOrExit(message, placeholder) {
4
+ const value = await p.text({ message, placeholder });
5
+ if (p.isCancel(value)) {
6
+ p.cancel("Instalación cancelada.");
7
+ process.exit(0);
8
+ }
9
+ return value;
10
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-kontrolia-auth",
3
- "version": "2.1.0",
3
+ "version": "2.2.0",
4
4
  "license": "MIT",
5
5
  "description": "Turnkey installer for KontrolIA Auth. `npx create-kontrolia-auth mi-app` checks requirements, downloads the repo, installs deps, and runs a wizard: (1) connect to an existing Supabase project or create a new self-hosted one via Docker; (2) where to deploy auth-server/admin-panel (Docker, Vercel, Railway, Render, Coolify). Also exposes `update`, `migrate` and `doctor` subcommands.",
6
6
  "keywords": [