@simple-auth-kit/cli 1.1.0 → 1.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
@@ -22,7 +22,8 @@ npx @simple-auth-kit/cli add <combo> [--workspaces] # install a specific combo
22
22
  npx @simple-auth-kit/cli add # guided picker, same flow as init (no config write)
23
23
  npx @simple-auth-kit/cli update [--check] # re-installs whatever add last recorded — no args needed
24
24
  npx @simple-auth-kit/cli diff # shows the actual content diff for every file that differs from the registry (api combos only)
25
- npx @simple-auth-kit/cli # full command/flag reference + available combos
25
+ npx @simple-auth-kit/cli # bare, in a real terminal: same guided picker as `add`
26
+ npx @simple-auth-kit/cli --help # full command/flag reference + available combos
26
27
  ```
27
28
 
28
29
  `--into <path>` targets any directory (defaults to the current one). In a real terminal,
@@ -37,13 +38,30 @@ none found); override it with `--pm <npm|pnpm|yarn|bun>`, or skip the install en
37
38
 
38
39
  ## Available combos
39
40
 
40
- | Kind | Combo | Installs as |
41
- |---|---|---|
42
- | `api` | `nestjs-prisma`, `nestjs-drizzle`, `express-prisma`, `express-drizzle` | merged into `src/lib/auth` of an existing project (the Prisma/Drizzle config + schema land at the project root instead — see below) |
43
- | `admin` | `admin-nextjs`, `admin-react` | a whole new standalone app, scaffolded at the target (refuses a non-empty target unless `--force`) |
44
- | `mobile` | `mobile-expo`, `mobile-bare-rn` | a whole new standalone app, scaffolded at the target (same non-empty-target rule) |
41
+ Add `--workspaces` to any of these for the workspaces variant.
45
42
 
46
- Add `--workspaces` to any `api`/`admin`/`mobile` combo for the workspaces variant.
43
+ **`api`** merged into `src/lib/auth` of an existing project (the Prisma/Drizzle config +
44
+ schema land at the project root instead — see below):
45
+ ```bash
46
+ npx @simple-auth-kit/cli add nestjs-prisma --into .
47
+ npx @simple-auth-kit/cli add nestjs-drizzle --into .
48
+ npx @simple-auth-kit/cli add express-prisma --into .
49
+ npx @simple-auth-kit/cli add express-drizzle --into .
50
+ ```
51
+
52
+ **`admin`** — a whole new standalone app, scaffolded at the target (refuses a non-empty target
53
+ unless `--force`):
54
+ ```bash
55
+ npx @simple-auth-kit/cli add admin-nextjs --into ./admin
56
+ npx @simple-auth-kit/cli add admin-react --into ./admin
57
+ ```
58
+
59
+ **`mobile`** — a whole new standalone app, scaffolded at the target (same non-empty-target
60
+ rule):
61
+ ```bash
62
+ npx @simple-auth-kit/cli add mobile-expo --into ./mobile
63
+ npx @simple-auth-kit/cli add mobile-bare-rn --into ./mobile
64
+ ```
47
65
 
48
66
  ## Your own database models are safe
49
67
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@simple-auth-kit/cli",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "license": "MIT",
5
5
  "description": "simple-auth-kit add <combo> — copies registry source (backend combos, admin consoles, mobile apps) into a consumer repo, shadcn-CLI-style. Nothing is ever installed as a runtime dependency of the consumer.",
6
6
  "bin": {
@@ -43,7 +43,7 @@ const KIND_LABELS: Record<Kind, string> = { api: "API (backend)", admin: "Admin
43
43
  const KIND_FRAMEWORK_NOUN: Record<Kind, string> = { api: "API stack", admin: "admin framework", mobile: "mobile framework" };
44
44
 
45
45
  /** Flags that take no value. Everything else consumes the next argv entry. */
46
- const BOOLEAN_FLAGS = new Set(["workspaces", "force", "check", "config-only", "skip-install"]);
46
+ const BOOLEAN_FLAGS = new Set(["workspaces", "force", "check", "config-only", "skip-install", "help"]);
47
47
 
48
48
  interface SimpleAuthKitConfig {
49
49
  path: string;
@@ -785,10 +785,47 @@ async function cmdDiff(targetRoot: string) {
785
785
  }
786
786
  }
787
787
 
788
+ async function printUsage(exitCode: number) {
789
+ const registry = await loadRegistry();
790
+ console.log("Usage: simple-auth-kit <init|add|update|diff> [...]");
791
+ console.log(` init [--config-only] [--kind ...] [--into <path>] (fresh setup: guided "what do you need" picker, like bare "add")`);
792
+ console.log(` --config-only: just write .simple-auth-kit.json and stop, no install`);
793
+ console.log(` add <combo> [--workspaces] [--force] [--skip-install] [--into <path>] [--path <dir>] [--alias <alias>]`);
794
+ console.log(` add [--kind api,admin,mobile] [--framework <name>,...] [--workspaces] [--into <path>] [--name <appName>]`);
795
+ console.log(` (bare "add", or "add" with --kind but no combo, launches a guided prompt for whatever's missing)`);
796
+ console.log(` update [--check] [--force] [--skip-install] [--into <path>] (re-installs whatever combo+variant auth.lock.json already records)`);
797
+ console.log(` --check: report what would change, without writing anything (merge-mode combos only)`);
798
+ console.log(` diff [--into <path>] (shows the actual content diff for every tracked file that differs from the current registry — read-only; merge-mode combos only)`);
799
+ console.log(` In a TTY, without --force or --check: a file changed locally since install prompts to overwrite, per file.`);
800
+ console.log(` --skip-install: don't run the package manager after copying files — the default is to install for you, shadcn-\`add\`-style.`);
801
+ console.log(` --pm <npm|pnpm|yarn|bun>: which package manager to install with — default: detected from a lockfile in the target directory, npm if none found.`);
802
+ console.log(`\nAvailable combos:`);
803
+ for (const kind of ["api", "admin", "mobile"] as Kind[]) {
804
+ const names = combosByKind(registry, kind).map(([name]) => name);
805
+ if (names.length) console.log(` ${KIND_LABELS[kind]}: ${names.join(", ")}`);
806
+ }
807
+ console.log(`\nVariants (choose one at install time):`);
808
+ for (const [name, variant] of Object.entries(registry.variants)) {
809
+ console.log(` ${name}${variant.flag ? ` (${variant.flag})` : " (default)"} — ${variant.description}`);
810
+ }
811
+ process.exitCode = exitCode;
812
+ }
813
+
788
814
  async function main() {
789
815
  const { command, positional, flags } = parseArgs(process.argv.slice(2));
790
816
  const targetRoot = resolve(process.cwd(), flagString(flags.into) ?? ".");
791
817
 
818
+ if (command === "--help" || command === "-h" || command === "help" || flags.help === true) {
819
+ await printUsage(0);
820
+ return;
821
+ }
822
+ if (!command && isTTY()) {
823
+ // Bare `npx @simple-auth-kit/cli` in a real terminal — go straight to the guided picker
824
+ // (same flow as `add` with no combo) instead of just printing help text.
825
+ await cmdCreate(targetRoot, flags);
826
+ return;
827
+ }
828
+
792
829
  switch (command) {
793
830
  case "init":
794
831
  await cmdInit(targetRoot, flags);
@@ -809,31 +846,8 @@ async function main() {
809
846
  case "diff":
810
847
  await cmdDiff(targetRoot);
811
848
  break;
812
- default: {
813
- const registry = await loadRegistry();
814
- console.log("Usage: simple-auth-kit <init|add|update|diff> [...]");
815
- console.log(` init [--config-only] [--kind ...] [--into <path>] (fresh setup: guided "what do you need" picker, like bare "add")`);
816
- console.log(` --config-only: just write .simple-auth-kit.json and stop, no install`);
817
- console.log(` add <combo> [--workspaces] [--force] [--skip-install] [--into <path>] [--path <dir>] [--alias <alias>]`);
818
- console.log(` add [--kind api,admin,mobile] [--framework <name>,...] [--workspaces] [--into <path>] [--name <appName>]`);
819
- console.log(` (bare "add", or "add" with --kind but no combo, launches a guided prompt for whatever's missing)`);
820
- console.log(` update [--check] [--force] [--skip-install] [--into <path>] (re-installs whatever combo+variant auth.lock.json already records)`);
821
- console.log(` --check: report what would change, without writing anything (merge-mode combos only)`);
822
- console.log(` diff [--into <path>] (shows the actual content diff for every tracked file that differs from the current registry — read-only; merge-mode combos only)`);
823
- console.log(` In a TTY, without --force or --check: a file changed locally since install prompts to overwrite, per file.`);
824
- console.log(` --skip-install: don't run the package manager after copying files — the default is to install for you, shadcn-\`add\`-style.`);
825
- console.log(` --pm <npm|pnpm|yarn|bun>: which package manager to install with — default: detected from a lockfile in the target directory, npm if none found.`);
826
- console.log(`\nAvailable combos:`);
827
- for (const kind of ["api", "admin", "mobile"] as Kind[]) {
828
- const names = combosByKind(registry, kind).map(([name]) => name);
829
- if (names.length) console.log(` ${KIND_LABELS[kind]}: ${names.join(", ")}`);
830
- }
831
- console.log(`\nVariants (choose one at install time):`);
832
- for (const [name, variant] of Object.entries(registry.variants)) {
833
- console.log(` ${name}${variant.flag ? ` (${variant.flag})` : " (default)"} — ${variant.description}`);
834
- }
835
- process.exitCode = command ? 1 : 0;
836
- }
849
+ default:
850
+ await printUsage(command ? 1 : 0);
837
851
  }
838
852
  }
839
853