@mnci/cli 4.43.0 → 4.44.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
@@ -513,6 +513,7 @@ packages under mnci (the plan is #383). So far it is **report mode only and chan
513
513
  ```bash
514
514
  mnci adopt # what was found, what blocks, what clears each
515
515
  mnci adopt --json # the same, as one document
516
+ mnci adopt --tags # step (#379): create the baseline release tags, locally
516
517
  ```
517
518
 
518
519
  It reads git and the filesystem (no Nx, no install, no network) and reports the package manager, the
@@ -522,6 +523,12 @@ and the root files that are yours (`CLAUDE.md`, `AGENTS.md`). A **blocker** (not
522
523
  uncommitted changes, a package manager other than npm, no projects) makes it exit non-zero; a **warning**
523
524
  names the later adoption step that clears it. Each later step is its own issue under #383.
524
525
 
526
+ **`--tags`** keeps a release from restarting below what was already published. When a project's name changed
527
+ (for example `mysql` became `@auto/mysql`), `nx release` finds no tag under the new name and versions from the
528
+ disk version. `mnci adopt --tags` creates, for each such project, a lightweight tag under the new name on the
529
+ commit of the old one (`@auto/mysql@1.12.11` on `mysql@1.12.11`). It is local and idempotent, never moves a tag,
530
+ and prints the `git push` for you to run: publishing tags changes the remote, so that stays your decision.
531
+
525
532
  ## `mnci upgrade`: re-applying the overlay to an existing workspace
526
533
 
527
534
  Every fix to `workspace-overlay/overlay.use-case.ts` — a release-config correction, a CI guard rewritten,
package/dist/cli.js CHANGED
@@ -8485,6 +8485,21 @@ function runDoctor(workspaceRoot, options = {}) {
8485
8485
  process.exitCode = 1;
8486
8486
  }
8487
8487
 
8488
+ // src/repository-adoption/create-baseline-tags.use-case.ts
8489
+ function createBaselineTags(repositoryRoot, stranded) {
8490
+ const result = { created: [], existing: [], failed: [] };
8491
+ for (const entry of stranded) {
8492
+ const present = runCapture("git", ["rev-parse", "--verify", "--quiet", `refs/tags/${entry.newTag}`], repositoryRoot);
8493
+ if (present.status === 0) {
8494
+ result.existing.push(entry.newTag);
8495
+ continue;
8496
+ }
8497
+ const made = runCapture("git", ["tag", entry.newTag, `${entry.oldTag}^{commit}`], repositoryRoot);
8498
+ (made.status === 0 ? result.created : result.failed).push(entry.newTag);
8499
+ }
8500
+ return result;
8501
+ }
8502
+
8488
8503
  // src/repository-adoption/inspect-repository.use-case.ts
8489
8504
  var import_node_fs31 = require("fs");
8490
8505
  var import_node_path36 = require("path");
@@ -8594,6 +8609,10 @@ function reportAdoption(repositoryRoot) {
8594
8609
  }
8595
8610
  function runAdopt(repositoryRoot, options = {}) {
8596
8611
  const report = reportAdoption(repositoryRoot);
8612
+ if (options.tags === true) {
8613
+ runBaselineTags(repositoryRoot, report);
8614
+ return;
8615
+ }
8597
8616
  if (!report.ready) {
8598
8617
  process.exitCode = 1;
8599
8618
  }
@@ -8618,6 +8637,35 @@ function runAdopt(repositoryRoot, options = {}) {
8618
8637
  logger.error("Adoption is blocked. Clear the blockers above and run the report again.");
8619
8638
  }
8620
8639
  }
8640
+ function runBaselineTags(repositoryRoot, report) {
8641
+ if (!report.facts.isGitRepo) {
8642
+ logger.error("This directory is not a git repository, so there are no tags to baseline.");
8643
+ process.exitCode = 1;
8644
+ return;
8645
+ }
8646
+ const { strandedTags } = report.facts;
8647
+ if (strandedTags.length === 0) {
8648
+ logger.success("No project has release tags stranded under an old name. Nothing to baseline.");
8649
+ return;
8650
+ }
8651
+ const result = createBaselineTags(repositoryRoot, strandedTags);
8652
+ for (const tag of result.created) {
8653
+ logger.success(`created ${tag}`);
8654
+ }
8655
+ for (const tag of result.existing) {
8656
+ logger.info(`${tag} already exists, left alone`);
8657
+ }
8658
+ for (const tag of result.failed) {
8659
+ logger.error(`could not create ${tag}: its old tag does not resolve to a commit`);
8660
+ }
8661
+ if (result.failed.length > 0) {
8662
+ process.exitCode = 1;
8663
+ }
8664
+ if (result.created.length > 0) {
8665
+ logger.info(`Local only. Publish them when you are ready: git push origin ${result.created.map((tag) => JSON.stringify(tag)).join(" ")}`);
8666
+ logger.info("A tag made under the new name at a LOWER version (for example @scope/x@0.0.5) stays; the baseline outranks it, and removing it from the remote is your call.");
8667
+ }
8668
+ }
8621
8669
 
8622
8670
  // src/command-catalog/command-groups.config.ts
8623
8671
  var COMMAND_GROUPS = {
@@ -9273,7 +9321,7 @@ function buildProgram(cliVersion) {
9273
9321
  ).option("--json", "print the findings as one JSON document, each with its remedy").action((options) => {
9274
9322
  runDoctor(process.cwd(), options);
9275
9323
  });
9276
- program.command("adopt").description("Read an existing repository and report what bringing it under mnci would involve: blockers, warnings and the step that clears each. Read-only; exits non-zero when something blocks").option("--json", "print the report as one JSON document").action((options) => {
9324
+ program.command("adopt").description("Read an existing repository and report what bringing it under mnci would involve: blockers, warnings and the step that clears each. Read-only unless a step flag is given; exits non-zero when something blocks").option("--json", "print the report as one JSON document").option("--tags", "create, locally, the baseline tag each project whose release tags are stranded under an old name needs; nothing is pushed").action((options) => {
9277
9325
  runAdopt(process.cwd(), options);
9278
9326
  });
9279
9327
  program.command("ci").addArgument(new import_commander.Argument("<phase>", "which phase of the pipeline to run").choices(CI_PHASES)).description(