@mnci/cli 4.51.0 → 4.53.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
@@ -38,7 +38,16 @@ src/
38
38
  workspace-overlay/ the config files mnci owns and rewrites
39
39
  workspace-creation/ mnci new
40
40
  interactive-wizard/ bare mnci: every command and option, asked from the command's own description
41
- repository-adoption/ mnci adopt — bringing an existing repository under mnci, step by step
41
+ repository-adoption/ mnci adopt — the command, which runs the step slices below
42
+ adoption-report/ what adopt reads from a repository and the blockers and warnings it judges
43
+ toolchain-adoption/ adopt --toolchain: retired tooling gone, one Nx version, an audit that passes
44
+ kind-adoption/ adopt --kinds: each project's mnci kind as a type tag
45
+ dependency-adoption/ adopt --dependencies: root runtime dependencies into the projects that import them
46
+ clean-working-tree/ the git precondition every step that changes files shares
47
+ release-tag-lineage/ release tags kept reachable across a rename; doctor, upgrade and adopt all use it
48
+ esm-conversion/ a generated Node app made an ES module (add --esm)
49
+ dev-servers/ mnci dev: several projects started together
50
+ workspace-presets/ mnci new --preset: a whole shape of workspace, wired
42
51
  workspace-upgrade/ mnci upgrade
43
52
  workspace-diagnostics/ mnci doctor
44
53
  project-scaffolding/ mnci add — one use case per kind, plus post-generation repairs
@@ -51,6 +60,18 @@ src/
51
60
  cli-version/ the update check
52
61
  ```
53
62
 
63
+ **Written exception: `src/project-scaffolding/` is over the 12-file review threshold.**
64
+ - *Rule waived:* the folder-size review point (it holds a dispatcher, one file per project kind, and
65
+ `post-generation.use-case.ts`).
66
+ - *Constraint:* every kind calls `registerProjectCommands` (and uses its `ProjectCommands` type) from
67
+ `post-generation.use-case.ts`. A kind moved to a slice of its own would import that back from
68
+ `project-scaffolding` while `project-scaffolding` imports the kind: a cycle, type-only imports included.
69
+ - *Owner:* the repository owner. *Temporary:* it ends when `registerProjectCommands`, `ProjectCommands` and the
70
+ helpers they use move out of `post-generation.use-case.ts` into a `project-commands/` slice; each kind
71
+ (`container` first) can then move into a slice of its own. Splitting a file this size is its own change and needs a
72
+ yes, so it is recorded here and not done as a side effect. The ESM conversion had no such dependency and is
73
+ already its own slice (`esm-conversion/`).
74
+
54
75
  The dependency graph is acyclic and flows one way: `main` → the command
55
76
  slices → the infrastructure slices → `file-system` as a leaf. That is checked,
56
77
  not assumed — and now enforced: the root `eslint.config.mjs` turns on
@@ -507,6 +528,28 @@ from File`), and the curated root scripts.
507
528
  4. Installs the chosen **stack** (see below), `husky` + `@commitlint/*` for
508
529
  real, so versions resolve at generation time.
509
530
 
531
+ ## A whole shape in one step (`mnci new --preset`)
532
+
533
+ Everything else in mnci is per project. `mnci new my-shop --preset web-api` also scaffolds a wired-together shape, so the
534
+ result is a starting point that already runs rather than three projects to connect:
535
+
536
+ | Preset | Adds | Wiring |
537
+ |---|---|---|
538
+ | `web-api` | `libs/shared` (an internal library), `apps/api` (Express) and `apps/web` (React) | the API answers `GET /api/greeting` with the shared library's `greet`; the frontend asks that route and types the answer with the shared `Greeting`; both declare `@<scope>/shared`; Vite forwards `/api` to the API in development |
539
+
540
+ Each project is added through `mnci add`, so it is exactly what `add` makes, and the preset then edits them into one shape:
541
+ the API and the frontend drop their own copy of the sample use case and contract (the library owns them now), each gets a
542
+ spec that matches (written without a mock library, so it runs under Jest or Vitest), and one install, one `nx sync` and one
543
+ format finish it. `mnci dev web api` starts both servers, and asking the frontend's origin for `/api/greeting` returns the
544
+ API's answer through the proxy.
545
+
546
+ A misspelt preset is refused before the workspace is generated, and the wiring edits fail with the file named, not
547
+ silently, if a generator's output ever stops having the text they change. A preset is a starting point to edit: delete what
548
+ you do not need. New presets are an entry in `workspace-presets/preset-catalog.config.ts` plus their wiring.
549
+
550
+ The `web-api preset` e2e section generates one and checks lint, typecheck, test and build for all three projects, the
551
+ specs under Vitest, and the proxied request while both servers run.
552
+
510
553
  ## Starting projects together (`mnci dev`)
511
554
 
512
555
  `<name>:start` starts one project. `mnci dev web api` starts several at once, the usual case being a frontend and the
@@ -635,6 +678,14 @@ default the newest published in the major already in use (`--nx <version>` overr
635
678
  `npm audit fix` (never `--force`) until `mnci ci audit` passes, up to four passes. Run on a copy of a real
636
679
  hand-built workspace it moved Nx 23.1.1 to 23.3.0 and the audit gate passed after one pass.
637
680
 
681
+ When the repository has **no Nx at all** (no `nx.json`), the step sets it up first, through Nx's own commands rather
682
+ than a template of mnci's: `nx init --plugins=skip` writes `nx.json` and installs `nx`, then `nx add @nx/js` and one
683
+ plugin for each of ESLint, Jest and Vitest the root manifest already uses, so the projects get their targets
684
+ inferred. Where a package has its own `lint` or `test` script Nx names the inferred target `eslint:lint` or
685
+ `jest:test` instead, so the script keeps working under its own name. A repository that already has an `nx.json` is
686
+ not touched by this part. The `adoption without nx` e2e section takes a plain npm workspace through it and then
687
+ through `--overlay`.
688
+
638
689
  **`--kinds`** records each project's mnci kind as a `type:<kind>` tag, in its `project.json` or the `nx.tags` of
639
690
  its `package.json` (`mnci projects` shows it). The kind is read from the project itself: an `index.html` next to
640
691
  React, an `engines.vscode`, an `OutputType` of `Exe`, a `package main`, `lib/main.dart`. Where two kinds fit (a
@@ -661,8 +712,8 @@ refuses an unclean git tree, takes the same flags (`--scope`, `--registry`, `--o
661
712
  `--test-runner` from what the repository already has (its pipeline files, `jest` or `vitest` in the root
662
713
  manifest). The existing pipeline goes through the legacy migration: steps mnci does not recognise are kept in
663
714
  the three `# mnci:slot` blocks, the ones it does are replaced by `mnci ci <phase>`, and what cannot be carried
664
- over is listed. Scope, registry and agent have no safe guess, so they are asked for by flag. Adopt does not
665
- install Nx: a repository with no `nx.json` is told to run `npx nx@latest init` first.
715
+ over is listed. Scope, registry and agent have no safe guess, so they are asked for by flag. A repository with no
716
+ `nx.json` is told to run `mnci adopt --toolchain` first, which sets Nx up.
666
717
 
667
718
  ## `mnci upgrade`: re-applying the overlay to an existing workspace
668
719