create-next-pro-cli 0.1.27 → 0.1.28

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
@@ -117,6 +117,8 @@ create-next-pro rmpage account.security
117
117
  create-next-pro rmpage
118
118
  ```
119
119
 
120
+ `addlanguage` copies every message file from the configured default locale. The command reports each copied path and emits a required `translate` next step: the copied source-language text must be translated before the locale is ready to ship.
121
+
120
122
  `addpage` creates `layout`, `page`, and `loading` files by default. Available long options are `--layout`, `--page`, `--loading`, `--not-found`, `--error`, `--global-error`, `--route`, `--template`, and `--default`. The historical short forms remain available.
121
123
 
122
124
  `rmpage` only lists routes that contain an actual `page.tsx`. Next.js route groups and technical directories are hidden. Removal is confined to the project and preserves shared parent directories and unrelated files.
@@ -200,9 +202,11 @@ create-next-pro-cli/
200
202
  │ ├── cli/
201
203
  │ │ ├── completion.ts
202
204
  │ │ ├── onboarding.ts
205
+ │ │ ├── output.ts
203
206
  │ │ └── registry.ts
204
207
  │ ├── core/
205
208
  │ │ ├── contracts.ts
209
+ │ │ ├── operations.ts
206
210
  │ │ ├── page-catalog.ts
207
211
  │ │ ├── project-paths.ts
208
212
  │ │ └── template-manifest.ts
@@ -222,10 +226,11 @@ create-next-pro-cli/
222
226
  │ ├── index.ts
223
227
  │ └── scaffold.ts
224
228
  ├── templates/
225
- │ ├── Components/
226
- │ ├── Pages/
229
+ │ ├── Component/
230
+ │ ├── Page/
227
231
  │ ├── Projects/default/
228
- └── Routes/
232
+ ├── Api/
233
+ │ └── Lib/
229
234
  ├── create-next-pro-completion.sh
230
235
  ├── create-next-pro-completion.zsh
231
236
  ├── package.json
@@ -239,10 +244,82 @@ The CLI registry resolves commands to a shared asynchronous interface. The core
239
244
  ```text
240
245
  --help Show help
241
246
  --version, -v Show the version
247
+ --json Emit one deterministic JSON document
242
248
  --reconfigure Run CLI configuration again
243
249
  --force Replace an existing project destination
244
250
  ```
245
251
 
252
+ `--json` can appear before or after a command. It disables prompts, colors, banners, and incidental logs. Standard output contains exactly one JSON document followed by a newline, while standard error remains empty even when the command fails. Internal shell completion continues to use its separate line-based protocol.
253
+
254
+ ## Human and agent output
255
+
256
+ Human output names every created, copied, updated, deleted, unchanged, or skipped resource with an absolute path. It ends with a summary and only the next steps that are still required. For example, adding a locale clearly reports that its messages were copied from the source locale:
257
+
258
+ ```text
259
+ COPIED translation-messages: /workspace/my-app/messages/de/dashboard.json from /workspace/my-app/messages/en/dashboard.json (locale="de", sourceLocale="en")
260
+ UPDATED messages-registry: /workspace/my-app/src/lib/i18n/messages.ts
261
+ SUCCESS: Added locale "de" by copying 7 files from "en".
262
+ NEXT [translate]: Translate every copied message from en to de; the copied text is not ready for delivery.
263
+ /workspace/my-app/messages/de/dashboard.json
264
+ ```
265
+
266
+ Agentic usage adds `--json`:
267
+
268
+ ```bash
269
+ create-next-pro addapi health --json
270
+ ```
271
+
272
+ The versioned document has stable status, event, next-step, and error fields:
273
+
274
+ ```json
275
+ {
276
+ "schemaVersion": 1,
277
+ "command": "addapi",
278
+ "status": "success",
279
+ "exitCode": 0,
280
+ "summary": "Added API route \"health\".",
281
+ "projectRoot": "/workspace/my-app",
282
+ "events": [
283
+ {
284
+ "sequence": 1,
285
+ "action": "created",
286
+ "resource": "directory",
287
+ "role": "api-directory",
288
+ "scope": "project",
289
+ "path": "src/app/api/health"
290
+ },
291
+ {
292
+ "sequence": 2,
293
+ "action": "created",
294
+ "resource": "file",
295
+ "role": "api-route",
296
+ "scope": "project",
297
+ "path": "src/app/api/health/route.ts"
298
+ }
299
+ ],
300
+ "nextSteps": [
301
+ {
302
+ "kind": "review",
303
+ "required": true,
304
+ "message": "Replace the example response and review validation and authentication.",
305
+ "paths": [
306
+ {
307
+ "scope": "project",
308
+ "path": "src/app/api/health/route.ts"
309
+ }
310
+ ]
311
+ }
312
+ ],
313
+ "error": null
314
+ }
315
+ ```
316
+
317
+ Paths inside events and next steps are relative to their named scope. Applicable absolute roots are exposed as `projectRoot`, `configRoot`, and `homeRoot`. Events never contain file contents, environment values, credentials, or secrets.
318
+
319
+ Command statuses are `success`, `unchanged`, `cancelled`, and `failed`. Successful mutations, idempotent no-op results, and user cancellations exit with code `0`; only `failed` exits with code `1`. Stable error codes include `INVALID_ARGUMENT`, `CONFIG_NOT_FOUND`, `I18N_DISABLED`, `TARGET_EXISTS`, `TARGET_NOT_FOUND`, `TEMPLATE_MISSING`, `UNSAFE_PATH`, `INCONSISTENT_LOCALE`, `FILESYSTEM_ERROR`, `INTERACTIVE_INPUT_REQUIRED`, and `ONBOARDING_REQUIRED`.
320
+
321
+ Interactive input is never attempted in JSON mode. Pass every required argument explicitly. On a new machine, run the CLI once without `--json` to complete onboarding; `--reconfigure --json` is intentionally rejected.
322
+
246
323
  ## Environment and security
247
324
 
248
325
  Generated projects contain `.env.example`, never the template's local `.env`. Copy it before configuring Auth.js: