create-next-pro-cli 0.1.31 → 0.1.33

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-next-pro-cli",
3
- "version": "0.1.31",
3
+ "version": "0.1.33",
4
4
  "description": "Advanced Next.js project scaffolder with i18n, Tailwind, App Router and more.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -40,6 +40,7 @@
40
40
  "typecheck": "tsc --project tsconfig.json --noEmit",
41
41
  "language:check": "bun scripts/check-public-language.ts",
42
42
  "test": "bun test",
43
+ "audit": "bun templates/Projects/default/scripts/audit.ts",
43
44
  "clean": "rm -rf dist",
44
45
  "build": "bun run clean && bun run build:node && bun run build:bun && cp scripts/create-next-pro dist/create-next-pro && chmod +x dist/create-next-pro",
45
46
  "build:node": "tsup",
@@ -60,13 +61,13 @@
60
61
  ]
61
62
  },
62
63
  "overrides": {
63
- "brace-expansion": "2.0.3",
64
+ "brace-expansion": "2.1.2",
64
65
  "esbuild": "0.28.1",
65
- "fast-uri": "3.1.2",
66
+ "fast-uri": "3.1.4",
66
67
  "glob": "10.5.0",
67
- "js-yaml": "5.2.1",
68
+ "js-yaml": "5.2.2",
68
69
  "picomatch": "4.0.5",
69
- "postcss": "8.5.17",
70
+ "postcss": "8.5.23",
70
71
  "rollup": "4.62.2",
71
72
  "vite": "8.1.5"
72
73
  },
@@ -1,11 +1,5 @@
1
- import React from "react";
1
+ import type { ReactNode } from "react";
2
2
 
3
- export default function templateLayout({
4
- children,
5
- params,
6
- }: {
7
- children: React.ReactNode;
8
- params: { locale: string };
9
- }) {
3
+ export default function templateLayout({ children }: { children: ReactNode }) {
10
4
  return children;
11
5
  }
@@ -5,12 +5,12 @@ import BackButton from "@/ui/_global/BackButton";
5
5
  export default function template() {
6
6
  const t = useTranslations("template");
7
7
  return (
8
- <main className="py-8 px-4 max-w-3xl mx-auto">
8
+ <main className="px-4 pb-8 pt-24 max-w-3xl mx-auto">
9
9
  <div className="flex items-center justify-between mb-6">
10
10
  <h1 className="text-2xl font-bold">{t("title")}</h1>
11
11
  <BackButton />
12
12
  </div>
13
- <p className="text-muted mb-8">{t("description")}</p>
13
+ <p className="text-muted-foreground mb-8">{t("description")}</p>
14
14
  <section className="grid grid-cols-1 md:grid-cols-2 gap-6"></section>
15
15
  </main>
16
16
  );
@@ -0,0 +1,17 @@
1
+ "use client";
2
+ import { useTranslations } from "next-intl";
3
+ import BackButton from "@/ui/_global/BackButton";
4
+
5
+ export default function template() {
6
+ const t = useTranslations("template");
7
+ return (
8
+ <section className="px-4 pb-8 pt-24 max-w-3xl mx-auto">
9
+ <div className="flex items-center justify-between mb-6">
10
+ <h1 className="text-2xl font-bold">{t("title")}</h1>
11
+ <BackButton />
12
+ </div>
13
+ <p className="text-muted-foreground mb-8">{t("description")}</p>
14
+ <section className="grid grid-cols-1 md:grid-cols-2 gap-6"></section>
15
+ </section>
16
+ );
17
+ }
@@ -9,15 +9,15 @@ description: Add a global or page-scoped UI component to a generated create-next
9
9
 
10
10
  - Work from the generated project root containing `cnp.config.json`.
11
11
  - Use one safe component-name segment.
12
- - Use a simple or `Parent.Child` page scope when `--page` is present.
12
+ - Use a simple or `Parent.Child` page scope when `--page` is present, and identify its existing route area explicitly.
13
13
 
14
14
  ## Command
15
15
 
16
16
  ```bash
17
- create-next-pro addcomponent <Component> [--page <Page|Parent.Child>] [--json]
17
+ create-next-pro addcomponent <Component> [--page <Page|Parent.Child> --area <public|user>] [--json]
18
18
  ```
19
19
 
20
- `-P` is the short form of `--page`. The option requires a page name.
20
+ `-P` is the short form of `--page`. The option requires a page name and `--area`. A global component must not receive `--area`. Area values are exact lowercase values and `--area=value` is not supported.
21
21
 
22
22
  ## Effects
23
23
 
@@ -26,17 +26,17 @@ Without `--page`, the command creates:
26
26
  - `src/ui/_global/<Component>.tsx`
27
27
  - a `<Component>` key in `messages/<locale>/_global_ui.json`
28
28
 
29
- With `--page Account.Security`, the command creates:
29
+ With `--page Account.Security --area user`, the command first resolves exactly that page in the area-aware route catalog, then creates:
30
30
 
31
31
  - `src/ui/Account/Security/<Component>.tsx`
32
32
  - a `<Component>` key in the `Account.Security` translation namespace
33
33
 
34
- The component name is normalized to a TypeScript identifier. Existing component code and existing message keys are preserved and reported as `unchanged`.
34
+ The component name is normalized to a TypeScript identifier. Existing component code and existing message keys are preserved and reported as `unchanged`. Missing pages return `TARGET_NOT_FOUND`; flat, unknown-group, or ambiguous routes return `INCONSISTENT_ROUTE` before any write.
35
35
 
36
36
  ## Workflow
37
37
 
38
38
  1. Decide whether the component is global or owned by one page.
39
- 2. Verify the page scope and translation namespace when using `--page`.
39
+ 2. Verify the page scope, area, and translation namespace when using `--page`.
40
40
  3. Run the complete command with `--json`.
41
41
  4. Inspect the component and per-locale message events.
42
42
  5. Implement the component behavior and review all generated translations.
@@ -53,7 +53,7 @@ create-next-pro addcomponent Alert
53
53
  Create a component for a nested page:
54
54
 
55
55
  ```bash
56
- create-next-pro addcomponent PasswordForm --page Account.Security --json
56
+ create-next-pro addcomponent PasswordForm --page Account.Security --area user --json
57
57
  ```
58
58
 
59
59
  ## Validate
@@ -9,14 +9,17 @@ description: Add a simple or Parent.Child page to a generated create-next-pro pr
9
9
 
10
10
  - Work from the generated project root containing `cnp.config.json`.
11
11
  - Use a safe logical page name with one segment or exactly `Parent.Child`.
12
- - Inspect the requested route and UI scope before generating files.
12
+ - Choose the route area explicitly: `public` uses the public layout, while `user` uses the authenticated user layout.
13
+ - Inspect the requested route and UI scope before generating files. A logical page name can belong to only one area.
13
14
 
14
15
  ## Command
15
16
 
16
17
  ```bash
17
- create-next-pro addpage <Page|Parent.Child> [options] [--json]
18
+ create-next-pro addpage <Page|Parent.Child> --area <public|user> [options] [--json]
18
19
  ```
19
20
 
21
+ `--area` accepts only the exact lowercase values `public` and `user`. It may appear before or after the page name, but it cannot be repeated or written as `--area=value`. With no page name, human mode asks for both the name and area; JSON mode requires both explicitly.
22
+
20
23
  With no file options, the command selects `layout`, `page`, and `loading`.
21
24
 
22
25
  | Long option | Short option | Generated route file |
@@ -35,18 +38,22 @@ Short options can be combined, for example `-PLl`. Unknown options fail with `IN
35
38
 
36
39
  ## Effects
37
40
 
38
- For `Account.Security`, expect resources under:
41
+ For `Account.Security --area user`, expect resources under:
39
42
 
40
- - `src/app/[locale]/Account/Security/`
43
+ - `src/app/[locale]/(user)/Account/Security/`
41
44
  - `src/ui/Account/Security/page-ui.tsx`
42
45
  - `messages/<locale>/Account.json` at the `Security` namespace
43
46
  - `messages/<locale>.ts` when the message file needs registration
44
47
 
45
- The command creates only missing code files and preserves existing ones as `unchanged`. It prepares all required templates and locale updates before writing.
48
+ The route area affects only the App Router path and layout. UI and message paths remain area-independent. Public page UI uses its own `<main>` landmark; user page UI uses `<section>` because the user layout already provides `<main>`.
49
+
50
+ The generated page-level `layout.tsx` accepts only `children` because it does not read route parameters. If you customize it to read the locale under Next.js 16, make the component asynchronous, type `params` as `Promise<{ locale: string }>` and await it before use.
51
+
52
+ The command creates only missing code files and preserves existing ones as `unchanged`. Repeating the command in the same area is idempotent and can add requested missing route files. Requesting the same logical page in the other area fails with `TARGET_EXISTS`. Flat historical routes or ambiguous route definitions fail with `INCONSISTENT_ROUTE` before any write.
46
53
 
47
54
  ## Workflow
48
55
 
49
- 1. Select the logical page name and only the required route file options.
56
+ 1. Select the logical page name, area, and only the required route file options.
50
57
  2. Run the command with `--json`.
51
58
  3. Inspect route, UI, translation, and aggregator events separately.
52
59
  4. Review every generated UI and route file.
@@ -58,19 +65,19 @@ The command creates only missing code files and preserves existing ones as `unch
58
65
  Create the default page resources:
59
66
 
60
67
  ```bash
61
- create-next-pro addpage Profile
68
+ create-next-pro addpage Profile --area public
62
69
  ```
63
70
 
64
71
  Create only `page.tsx`, `layout.tsx`, and the page UI for a nested page:
65
72
 
66
73
  ```bash
67
- create-next-pro addpage Account.Security -PL --json
74
+ create-next-pro addpage Account.Security --area user -PL --json
68
75
  ```
69
76
 
70
77
  Create an error and not-found boundary:
71
78
 
72
79
  ```bash
73
- create-next-pro addpage Checkout --error --not-found --json
80
+ create-next-pro addpage Checkout --area public --error --not-found --json
74
81
  ```
75
82
 
76
83
  ## Validate
@@ -82,3 +89,5 @@ bun run check
82
89
  ```
83
90
 
84
91
  Confirm every `created` or `updated` event path exists. A repeated command should preserve existing code and normally report those resources as `unchanged`.
92
+
93
+ When a generated or customized layout reads route parameters, include `next build` in validation so Next.js checks the inferred `LayoutProps` contract.
@@ -9,16 +9,17 @@ description: Remove a catalogued page and its associated route, UI, and message
9
9
 
10
10
  - Work from the generated project root containing `cnp.config.json`.
11
11
  - Confirm the target is a page that contains an actual `page.tsx` and appears in the CLI page catalog.
12
+ - Confirm whether the page belongs to the `public` or `user` route area.
12
13
  - Review uncommitted work and references to the route before deletion.
13
14
  - Use a simple logical name or `Parent.Child`, never a filesystem path.
14
15
 
15
16
  ## Command
16
17
 
17
18
  ```bash
18
- create-next-pro rmpage [Page|Parent.Child] [--json]
19
+ create-next-pro rmpage [Page|Parent.Child] [--area <public|user>] [--json]
19
20
  ```
20
21
 
21
- Without a name, human mode displays an autocomplete tree and asks for confirmation. JSON mode requires the explicit page name and never prompts.
22
+ With a page name, `--area` is required. Without a name, human mode displays an autocomplete tree grouped as `Public > ...` and `User > ...`, then asks for confirmation. Passing only `--area` filters that menu. JSON mode requires the explicit page name and area and never prompts. Area values are exact lowercase values and `--area=value` is not supported.
22
23
 
23
24
  ## Effects
24
25
 
@@ -29,11 +30,11 @@ The command can remove:
29
30
  - a top-level locale JSON file and its aggregator registration; or
30
31
  - only the nested message key for `Parent.Child`.
31
32
 
32
- The page catalog excludes technical directories and routes without `page.tsx`. Resolution and deletion remain confined to the project. Shared parents and unrelated files are preserved.
33
+ The page catalog excludes technical directories and routes without `page.tsx`. Resolution uses the exact `{area, logicalName}` pair and deletion remains confined to the project. Shared parents and unrelated files are preserved. Flat historical routes, unknown route groups, and ambiguous route definitions fail with `INCONSISTENT_ROUTE` and are never deleted automatically.
33
34
 
34
35
  ## Workflow
35
36
 
36
- 1. Discover the target with human autocomplete or confirm its logical name from the project structure.
37
+ 1. Discover the target with the area-aware human autocomplete or confirm its logical name and area from the project structure.
37
38
  2. Inspect references, navigation entries, tests, and uncommitted changes that may depend on the page.
38
39
  3. Prefer an explicit name with `--json` for agentic deletion.
39
40
  4. Require a successful result and inspect every `deleted`, `updated`, and `unchanged` event.
@@ -52,7 +53,7 @@ create-next-pro rmpage
52
53
  Remove a nested page non-interactively:
53
54
 
54
55
  ```bash
55
- create-next-pro rmpage Account.Security --json
56
+ create-next-pro rmpage Account.Security --area user --json
56
57
  ```
57
58
 
58
59
  ## Validate
@@ -63,4 +64,4 @@ bun run check
63
64
  # or: pnpm run check
64
65
  ```
65
66
 
66
- Treat `TARGET_NOT_FOUND` as a request or state mismatch. Do not substitute a filesystem deletion command, and do not infer deletion from exit code alone.
67
+ Treat `TARGET_NOT_FOUND` as a request or state mismatch. Treat `INCONSISTENT_ROUTE` as a request for manual route inspection, not permission to remove a flat or ambiguous route. Do not substitute a filesystem deletion command, and do not infer deletion from exit code alone.
@@ -42,7 +42,6 @@ jobs:
42
42
  pnpm install --no-frozen-lockfile
43
43
  fi
44
44
  - run: ${{ matrix.manager }} run check
45
- - run: ${{ matrix.manager }} run audit
46
45
  - name: Validate an isolated consumer
47
46
  env:
48
47
  CNP_PACKAGE_MANAGER: ${{ matrix.manager }}
@@ -53,3 +52,5 @@ jobs:
53
52
  - name: Run visual integration tests without Bun
54
53
  if: matrix.manager == 'npm'
55
54
  run: npm run test:e2e
55
+ - name: Run blocking security audit
56
+ run: ${{ matrix.manager }} run audit
@@ -51,21 +51,22 @@ Do not commit an additional lockfile unless the project has intentionally change
51
51
  - Use `.env.example` as the public development contract. Create a local file with `cp .env.example .env`, then replace credentials for production.
52
52
  - Use `--force` only after resolving and inspecting the exact destination. It deletes the existing child destination before scaffolding.
53
53
  - Pass logical names, not filesystem paths. Names use safe dot-separated segments such as `account.security`; never pass absolute paths, slashes, empty segments, or `..`.
54
+ - Select `--area public` or `--area user` explicitly for page creation, direct page removal, and page-scoped components. A route area controls the layout and authorization boundary without changing the public URL.
54
55
  - Preserve existing source files. The add commands report existing resources as `unchanged` instead of overwriting them.
55
- - Use `rmpage` only for a page returned by the CLI page catalog, and inspect deletion events before making follow-up edits.
56
+ - Use `rmpage` only for a page returned by the area-aware CLI page catalog, and inspect deletion events before making follow-up edits.
56
57
 
57
58
  ## CLI operations
58
59
 
59
60
  | Operation | Purpose | Skill |
60
61
  | ---------------- | --------------------------------------------------------------- | ------------------------------------------------------------------------------------------- |
61
62
  | Create a project | Scaffold the complete Next.js project in a new child directory. | [`$create-next-pro-create-project`](.agents/skills/create-next-pro-create-project/SKILL.md) |
62
- | `addpage` | Add a route, page UI, and localized message resources. | [`$create-next-pro-addpage`](.agents/skills/create-next-pro-addpage/SKILL.md) |
63
- | `addcomponent` | Add a global or page-scoped UI component and messages. | [`$create-next-pro-addcomponent`](.agents/skills/create-next-pro-addcomponent/SKILL.md) |
63
+ | `addpage` | Add an explicitly zoned route, page UI, and localized messages. | [`$create-next-pro-addpage`](.agents/skills/create-next-pro-addpage/SKILL.md) |
64
+ | `addcomponent` | Add a global or area-qualified page component and messages. | [`$create-next-pro-addcomponent`](.agents/skills/create-next-pro-addcomponent/SKILL.md) |
64
65
  | `addlib` | Add a library directory or a library module and export. | [`$create-next-pro-addlib`](.agents/skills/create-next-pro-addlib/SKILL.md) |
65
66
  | `addapi` | Add an App Router API route handler. | [`$create-next-pro-addapi`](.agents/skills/create-next-pro-addapi/SKILL.md) |
66
67
  | `addlanguage` | Copy and register a new locale that must then be translated. | [`$create-next-pro-addlanguage`](.agents/skills/create-next-pro-addlanguage/SKILL.md) |
67
68
  | `addtext` | Set one translation path across all configured locales. | [`$create-next-pro-addtext`](.agents/skills/create-next-pro-addtext/SKILL.md) |
68
- | `rmpage` | Remove a catalogued page and its associated resources safely. | [`$create-next-pro-rmpage`](.agents/skills/create-next-pro-rmpage/SKILL.md) |
69
+ | `rmpage` | Remove one area-qualified page and its resources safely. | [`$create-next-pro-rmpage`](.agents/skills/create-next-pro-rmpage/SKILL.md) |
69
70
 
70
71
  ## Global options
71
72
 
@@ -75,6 +76,13 @@ Do not commit an additional lockfile unless the project has intentionally change
75
76
  - `--help`: display public command help.
76
77
  - `--version` or `-v`: display the CLI version.
77
78
 
79
+ ## Page-area option
80
+
81
+ - `--area public`: target the public route group and layout.
82
+ - `--area user`: target the authenticated user route group and layout.
83
+ - The option is required for direct `addpage`, direct `rmpage`, and `addcomponent --page` commands. It is rejected for global components.
84
+ - Do not infer an area from a page name or persist one as a project-wide default.
85
+
78
86
  ## Finish every mutation
79
87
 
80
88
  1. Inspect the CLI result and all changed paths.
@@ -101,6 +101,18 @@ skills under `.agents/skills` document project creation and every public
101
101
  with `--json`, inspect all reported events and complete every required next
102
102
  step before running the project checks.
103
103
 
104
+ Page operations use explicit route areas. Pass `--area public` or `--area user`
105
+ to direct `addpage` and `rmpage` commands and to `addcomponent --page`. The
106
+ interactive page flows expose the same area-aware catalog. Areas select a route
107
+ layout without changing the public URL; see the linked command skills for the
108
+ complete contract.
109
+
110
+ Page-level layouts generated by the CLI accept only `children` when they do not
111
+ read route parameters. A customized Next.js 16 layout that reads the locale must
112
+ type `params` as `Promise<{ locale: string }>` and await it. Projects created
113
+ with `create-next-pro-cli@0.1.32` should remove the obsolete synchronous
114
+ `params` property when unused, or migrate it to this asynchronous contract.
115
+
104
116
  ## Template Features
105
117
 
106
118
  - Next.js 16 App Router