@habitat-ai/cli 0.5.6 → 0.5.7

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
@@ -39,4 +39,10 @@ Later package releases use ordinary Nx migrations:
39
39
 
40
40
  ```sh
41
41
  bunx nx migrate @habitat-ai/cli@latest
42
+ bun install
43
+ bunx nx migrate --run-migrations
42
44
  ```
45
+
46
+ The first command updates the fixed CLI/SDK pair and writes any applicable
47
+ Habitat migrations. The final command applies those package-owned repository
48
+ changes; no consumer copies or independently maintains the preset wiring.
@@ -0,0 +1,3 @@
1
+ import { type GeneratorCallback, type Tree } from "@nx/devkit";
2
+ /** Advances an existing Bun/Nx consumer through Habitat's canonical preset. */
3
+ export default function migrateRepositoryFoundation(tree: Tree): GeneratorCallback | undefined;
@@ -0,0 +1,49 @@
1
+ import { isDeepStrictEqual } from "node:util";
2
+ import { installPackagesTask, readJson, writeJson, } from "@nx/devkit";
3
+ import { initializeHabitatBunRepository } from "../nx/repository-preset.js";
4
+ import { habitatConsumerBinding } from "../nx-generators.js";
5
+ const PREVIOUS_CHECK_TARGET = {
6
+ cache: false,
7
+ dependsOn: [
8
+ { projects: ["habitat"], target: "lint" },
9
+ "typecheck",
10
+ "verify",
11
+ "check:policy",
12
+ "^check",
13
+ ],
14
+ outputs: [],
15
+ };
16
+ const FIRST_PRESET_NX_VERSION = "23.1.0";
17
+ const CURRENT_NX_VERSION = "23.1.1";
18
+ function normalizeFirstPresetNxVersions(tree) {
19
+ const packageJson = readJson(tree, "package.json");
20
+ const previousNx = packageJson.devDependencies?.nx === FIRST_PRESET_NX_VERSION;
21
+ const previousWorkspace = packageJson.devDependencies?.["@nx/workspace"] === FIRST_PRESET_NX_VERSION;
22
+ if (!previousNx && !previousWorkspace)
23
+ return;
24
+ const devDependencies = { ...packageJson.devDependencies };
25
+ if (previousNx)
26
+ devDependencies.nx = CURRENT_NX_VERSION;
27
+ if (previousWorkspace)
28
+ devDependencies["@nx/workspace"] = CURRENT_NX_VERSION;
29
+ writeJson(tree, "package.json", { ...packageJson, devDependencies });
30
+ }
31
+ function removePreviousCheckTarget(tree) {
32
+ const nxJson = readJson(tree, "nx.json");
33
+ if (!isDeepStrictEqual(nxJson.targetDefaults?.check, PREVIOUS_CHECK_TARGET))
34
+ return;
35
+ const targetDefaults = { ...nxJson.targetDefaults };
36
+ delete targetDefaults.check;
37
+ writeJson(tree, "nx.json", { ...nxJson, targetDefaults });
38
+ }
39
+ /** Advances an existing Bun/Nx consumer through Habitat's canonical preset. */
40
+ export default function migrateRepositoryFoundation(tree) {
41
+ normalizeFirstPresetNxVersions(tree);
42
+ removePreviousCheckTarget(tree);
43
+ const result = initializeHabitatBunRepository(tree, habitatConsumerBinding, {
44
+ packageManager: "bun",
45
+ });
46
+ if (!result.packageChanged)
47
+ return undefined;
48
+ return () => installPackagesTask(tree, false, "", "bun");
49
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "$schema": "https://json-schema.org/schema",
3
+ "generators": {
4
+ "0-5-7-repository-foundation": {
5
+ "version": "0.5.7",
6
+ "description": "Converge an existing Habitat consumer on the released repository foundation.",
7
+ "cli": "nx",
8
+ "implementation": "./dist/migrations/0-5-7-repository-foundation"
9
+ }
10
+ }
11
+ }
@@ -99,5 +99,5 @@
99
99
  ]
100
100
  }
101
101
  },
102
- "version": "0.5.6"
102
+ "version": "0.5.7"
103
103
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@habitat-ai/cli",
3
- "version": "0.5.6",
3
+ "version": "0.5.7",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",
@@ -21,6 +21,7 @@
21
21
  "generators",
22
22
  "generators.json",
23
23
  "generators.schema.json",
24
+ "migrations.json",
24
25
  "preset.schema.json",
25
26
  "README.md",
26
27
  "oclif.manifest.json",
@@ -31,6 +32,7 @@
31
32
  },
32
33
  "generators": "./generators.json",
33
34
  "nx-migrations": {
35
+ "migrations": "./migrations.json",
34
36
  "packageGroup": [
35
37
  "@habitat-ai/sdk"
36
38
  ]
@@ -58,7 +60,7 @@
58
60
  "test": "vitest run --project habitat-cli"
59
61
  },
60
62
  "dependencies": {
61
- "@habitat-ai/sdk": "0.5.6",
63
+ "@habitat-ai/sdk": "0.5.7",
62
64
  "@nx/devkit": "23.1.1",
63
65
  "@oclif/core": "^4.13.2",
64
66
  "@oclif/plugin-help": "^6.2.27",