@mnci/cli 4.52.0 → 4.54.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
@@ -657,6 +678,14 @@ default the newest published in the major already in use (`--nx <version>` overr
657
678
  `npm audit fix` (never `--force`) until `mnci ci audit` passes, up to four passes. Run on a copy of a real
658
679
  hand-built workspace it moved Nx 23.1.1 to 23.3.0 and the audit gate passed after one pass.
659
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
+
660
689
  **`--kinds`** records each project's mnci kind as a `type:<kind>` tag, in its `project.json` or the `nx.tags` of
661
690
  its `package.json` (`mnci projects` shows it). The kind is read from the project itself: an `index.html` next to
662
691
  React, an `engines.vscode`, an `OutputType` of `Exe`, a `package main`, `lib/main.dart`. Where two kinds fit (a
@@ -683,8 +712,8 @@ refuses an unclean git tree, takes the same flags (`--scope`, `--registry`, `--o
683
712
  `--test-runner` from what the repository already has (its pipeline files, `jest` or `vitest` in the root
684
713
  manifest). The existing pipeline goes through the legacy migration: steps mnci does not recognise are kept in
685
714
  the three `# mnci:slot` blocks, the ones it does are replaced by `mnci ci <phase>`, and what cannot be carried
686
- over is listed. Scope, registry and agent have no safe guess, so they are asked for by flag. Adopt does not
687
- 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.
688
717
 
689
718
  ## `mnci upgrade`: re-applying the overlay to an existing workspace
690
719
 
@@ -1660,7 +1689,7 @@ release version --dry-run`), which wins over the workspace's default
1660
1689
  every Python project workspace-wide (the workspace-wide install above) —
1661
1690
  both skipped cleanly when the workspace has no Python projects.
1662
1691
 
1663
- ## Go (`@nx-go/nx-go` — one root `go.mod`, golangci-lint + `go test`)
1692
+ ## Go (`@nx-go/nx-go` — a `go.mod` per project, a root `go.work`, golangci-lint + `go test`)
1664
1693
 
1665
1694
  Requires **Go 1.21+** on the machine and on the build agent; `mnci add go-*`
1666
1695
  fails fast with an install link when `go` is not on the `PATH`. The generated
@@ -1673,14 +1702,14 @@ pipeline installs `golangci-lint` itself (see below).
1673
1702
  | `go-lib` | `packages/<name>` | publishable **by git tag** — see below; lint + test targets only |
1674
1703
  | `go-internal-lib` | `libs/<name>` | private shared code, lint + test only — a non-`main` package produces no binary |
1675
1704
 
1676
- - **One root `go.mod`**, matching how TS uses one root `package.json` and
1677
- Python one root `requirements-dev.txt`. `project-scaffolding/go.use-case.ts` bootstraps it on the
1678
- first Go `add` by running the plugin's `init` then `convert-to-one-mod`
1679
- generators, in that order — `convert-to-one-mod` refuses once `go.work`
1680
- lists any module, so it has to happen before the first Go project exists.
1681
- Every Go project then shares that module and imports its siblings as
1682
- `<module>/libs/<name>/<slice>`, with no per-project manifests and no
1683
- `replace` directives.
1705
+ - **One `go.mod` per project, and a root `go.work` mnci owns** (#289), so a Go
1706
+ project's dependencies are declared in that project, like every other
1707
+ language's. `project-scaffolding/go.use-case.ts` bootstraps the workspace on
1708
+ the first Go `add` with the plugin's `init` (no `convert-to-one-mod`); each
1709
+ generator then writes its own `go.mod`, whose module line mnci rewrites to
1710
+ `<host>/<org>/<repo>/<dir>` from the git origin. Siblings import each other
1711
+ by that path, and `go.work` resolves them locally, with no `replace`
1712
+ directives.
1684
1713
  - **A Go library is a capability of slice packages.** The plugin's library
1685
1714
  generator writes `<name>.go` at the project root, which makes the root
1686
1715
  package the whole library. mnci replaces it with a root `doc.go` and moves
@@ -1694,16 +1723,17 @@ pipeline installs `golangci-lint` itself (see below).
1694
1723
  plants a failing test and a lint finding in a nested package and asserts
1695
1724
  both fail the project target, so a plugin change that stopped recursing
1696
1725
  would surface there rather than as a silently green lib.
1697
- - **The `go.work` multi-module layout was rejected deliberately.** Besides
1698
- splitting dependencies across per-project manifests, it is brittle: a
1699
- single stale `use` entry — a project directory removed by hand — makes
1700
- `go list -m -json` fail, and that breaks the **entire** Nx project graph,
1701
- not just the Go projects. Verified empirically.
1726
+ - **The `go.work` multi-module layout was first rejected and then adopted**
1727
+ (#289), because per-project dependencies are the point. Its one hazard is
1728
+ real: a single stale `use` entry — a project directory removed by hand —
1729
+ makes `go list -m -json` fail, and that breaks the **entire** Nx project
1730
+ graph, not just the Go projects. `mnci doctor` fails on one and names the
1731
+ line to remove.
1702
1732
  - **Targets are written explicitly** rather than inferred. `@nx-go/nx-go`
1703
- supplies `build`/`test`/`lint` by inference, but keys that inference on a
1704
- per-project `go.mod` — which single-module mode does not have, so nothing
1705
- is inferred. mnci writes them into `project.json` instead, as it already
1706
- does for most kinds.
1733
+ supplies `build`/`test`/`lint` by inference, but mnci writes them into
1734
+ `project.json` explicitly so lint is pinned to `golangci-lint` (the plugin's
1735
+ default is `go fmt`, which only reformats), as it already does for most
1736
+ kinds.
1707
1737
  - **The project graph is still inferred, so `affected` is correct.** What the
1708
1738
  plugin does not infer is targets; it still derives the _graph_ from imports.
1709
1739
  An app that imports `libs/<name>/<slice>` depends on that lib, transitively,