@webjsdev/cli 0.8.3 → 0.8.5

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.
Files changed (2) hide show
  1. package/lib/create.js +50 -35
  2. package/package.json +1 -1
package/lib/create.js CHANGED
@@ -891,41 +891,11 @@ ThemeToggle.register('theme-toggle');
891
891
  CONVENTIONS.md, AGENTS.md, CLAUDE.md
892
892
  `);
893
893
  }
894
- // Auto-install (default). Detect the package manager from the env so
895
- // pnpm / yarn / bun users get their own. Pass `--no-install` (or
896
- // `{ install: false }` to scaffoldApp) to opt out, e.g. for CI tests
897
- // that exercise the scaffold without paying the install cost.
898
- const pm = detectPackageManager();
899
- let installed = false;
900
- if (shouldInstall) {
901
- console.log(`\nRunning '${pm} install' in ${name}/ ...\n`);
902
- installed = runInstall(appDir, pm);
903
- if (!installed) {
904
- console.log(`\n[warn] ${pm} install failed. Run '${pm} install' manually in ${name}/ to finish setup.\n`);
905
- }
906
- }
907
-
908
- // Post-scaffold guidance. Lead with a single copy-paste line so the
909
- // user can move from "scaffold done" to "dev server up" in one
910
- // command. The full-stack and saas templates ship with @webjsdev/ui
911
- // already initialised; the api template has no UI but may add one
912
- // later. Saas needs a one-time prisma migrate before the first run
913
- // (the example User model wants its table to exist).
914
- const installSegment = installed ? '' : `${pm} install && `;
915
- const prismaSegment = isSaas ? `npx prisma migrate dev --name init && ` : '';
916
- const runCommand = `cd ${name} && ${installSegment}${prismaSegment}${pm} run dev`;
917
- const uiNote = isApi
918
- ? `# If you later add a UI to this API project:
919
- # npx webjs ui init && npx webjs ui add button card dialog`
920
- : `npx webjs ui add <name> # add more ui-* components later`;
921
- console.log(`Next steps:
922
- ${runCommand}
923
- # → http://localhost:3000
924
-
925
- Optional:
926
- ${uiNote}
927
-
928
- AI-driven development (enforced for all AI agents):
894
+ // AI-agent guidance comes first so it scrolls past in the terminal
895
+ // (long reading material, not actionable). The actionable run
896
+ // command lands LAST in the output so it is the final thing on
897
+ // screen after the install completes.
898
+ console.log(`AI-driven development (enforced for all AI agents):
929
899
  ✓ Tests auto-generated with every feature
930
900
  ✓ Docs auto-updated with every change
931
901
  ✓ Git merges/pushes to main require approval
@@ -950,4 +920,49 @@ For AI agents, read this before editing scaffolded files:
950
920
  • Need more detail? Full hosted docs are at https://docs.webjs.com
951
921
  (every API, directive, recipe, and deployment guide).
952
922
  `);
923
+
924
+ // Auto-install (default). Detect the package manager from the env so
925
+ // pnpm / yarn / bun users get their own. Pass `--no-install` (or
926
+ // `{ install: false }` to scaffoldApp) to opt out, e.g. for CI tests
927
+ // that exercise the scaffold without paying the install cost.
928
+ const pm = detectPackageManager();
929
+ let installed = false;
930
+ if (shouldInstall) {
931
+ console.log(`Running '${pm} install' in ${name}/ ...\n`);
932
+ installed = runInstall(appDir, pm);
933
+ if (!installed) {
934
+ console.log(`\n[warn] ${pm} install failed. Run '${pm} install' manually in ${name}/ to finish setup.\n`);
935
+ }
936
+ }
937
+
938
+ // Next-steps banner prints LAST so the actionable command is the
939
+ // final thing on screen, never buried above the AI-agent guidance.
940
+ // Single copy-paste line so the user can move from "scaffold done"
941
+ // to "dev server up" in one command. The full-stack and saas
942
+ // templates ship with @webjsdev/ui already initialised; the api
943
+ // template has no UI but may add one later. Saas needs a one-time
944
+ // prisma migrate before the first run (the example User model wants
945
+ // its table to exist).
946
+ const installSegment = installed ? '' : `${pm} install && `;
947
+ const prismaSegment = isSaas ? `npx prisma migrate dev --name init && ` : '';
948
+ const runCommand = `cd ${name} && ${installSegment}${prismaSegment}${pm} run dev`;
949
+ // Use `npx webjsdev ui ...` here, not `npx webjs ui ...`. The bare
950
+ // `webjs` npm name is owned by an unrelated package; `npx webjs
951
+ // <cmd>` would fetch THAT package instead of ours when run outside
952
+ // a project context. `webjsdev` is our unscoped CLI alias; npx's
953
+ // single-bin fallback resolves it to the `webjs` binary, so behaviour
954
+ // matches `@webjsdev/cli` exactly while keeping the command short
955
+ // and unambiguous.
956
+ const uiNote = isApi
957
+ ? `# If you later add a UI to this API project:
958
+ # npx webjsdev ui init && npx webjsdev ui add button card dialog`
959
+ : `npx webjsdev ui add <name> # add more ui-* components later`;
960
+ console.log(`
961
+ Next steps:
962
+ ${runCommand}
963
+ # → http://localhost:3000
964
+
965
+ Optional:
966
+ ${uiNote}
967
+ `);
953
968
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webjsdev/cli",
3
- "version": "0.8.3",
3
+ "version": "0.8.5",
4
4
  "type": "module",
5
5
  "description": "webjs CLI - dev, start, create, db",
6
6
  "bin": {