@muverse/core 0.1.9 → 0.1.10

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.
@@ -2,14 +2,21 @@ import groovy.json.JsonOutput
2
2
  import groovy.json.JsonGenerator
3
3
 
4
4
  /**
5
- * Computes the qualified property name for a project's version in gradle.properties.
6
- * Returns "version" for root, "{name}.version" for subprojects.
5
+ * Computes the qualified version property name for the project.
6
+ * Checks for "<projectName>.version" first, then falls back to "version".
7
7
  */
8
8
  fun Project.qualifiedVersionProperty(): String {
9
- val name = if (path.contains(":")) path.split(':').last() else ""
10
- return if (name.isEmpty()) "version" else "${name}.version"
9
+ val candidates = listOf("${name}.version", "version")
10
+ return candidates.firstOrNull(::hasProperty) ?: "version"
11
11
  }
12
12
 
13
+ /**
14
+ * Retrieves the qualified version value for the project.
15
+ * Uses the qualified version property name to find the property value.
16
+ */
17
+ fun Project.qualifiedVersion(): String =
18
+ qualifiedVersionProperty().run(::findProperty) as String
19
+
13
20
  gradle.rootProject {
14
21
  /**
15
22
  * Collects and outputs project structure information as JSON.
@@ -79,8 +86,8 @@ gradle.rootProject {
79
86
  val path = if (relativePath.isEmpty()) "." else relativePath
80
87
  val version = if (project.version == "unspecified") null else project.version
81
88
  val type = if (project == gradle.rootProject) "root" else "module"
82
- val versionPropertyKey = project.qualifiedVersionProperty()
83
- val versionFromProperty = (project.findProperty(versionPropertyKey) as? String)?.takeIf {
89
+ val versionProperty = project.qualifiedVersionProperty()
90
+ val versionFromProperty = project.qualifiedVersion().takeIf {
84
91
  it.isNotBlank() && it != "unspecified"
85
92
  }
86
93
 
@@ -90,6 +97,7 @@ gradle.rootProject {
90
97
  "type" to type,
91
98
  "name" to project.name,
92
99
  "declaredVersion" to (versionFromProperty != null)
100
+ "versionProperty" to versionProperty
93
101
  )
94
102
  }
95
103
  projectData
@@ -122,6 +130,7 @@ gradle.rootProject {
122
130
  "type" to projectInfo["type"],
123
131
  "name" to projectInfo["name"],
124
132
  "declaredVersion" to projectInfo["declaredVersion"]
133
+ "versionProperty" to projectInfo["versionProperty"]
125
134
  )
126
135
  }
127
136
 
@@ -1,6 +1,7 @@
1
1
  import { ModuleSystemFactory } from "../../../services/module-system-factory.js";
2
2
  import { ModuleDetector } from "../../../services/module-detector.js";
3
3
  import { VersionUpdateStrategy } from "../../../services/version-update-strategy.js";
4
+ import { ModuleRegistry } from "../../../services/module-registry.js";
4
5
  /**
5
6
  * Factory for creating Gradle-specific module system components.
6
7
  * Creates module detector and version update strategy instances.
@@ -18,6 +19,6 @@ export declare class GradleModuleSystemFactory implements ModuleSystemFactory {
18
19
  * Creates a Gradle-specific version update strategy.
19
20
  * @returns GradleVersionUpdateStrategy instance configured with the repository root
20
21
  */
21
- createVersionUpdateStrategy(): VersionUpdateStrategy;
22
+ createVersionUpdateStrategy(moduleRegistry: ModuleRegistry): VersionUpdateStrategy;
22
23
  }
23
24
  //# sourceMappingURL=gradle-module-system-factory.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"gradle-module-system-factory.d.ts","sourceRoot":"","sources":["../../../../src/adapters/gradle/services/gradle-module-system-factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,4CAA4C,CAAC;AACjF,OAAO,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AACtE,OAAO,EAAE,qBAAqB,EAAE,MAAM,8CAA8C,CAAC;AAIrF;;;GAGG;AACH,qBAAa,yBAA0B,YAAW,mBAAmB;IAEvD,OAAO,CAAC,QAAQ,CAAC,QAAQ;IADrC,sDAAsD;gBACzB,QAAQ,EAAE,MAAM;IAE7C;;;OAGG;IACH,cAAc,IAAI,cAAc;IAIhC;;;OAGG;IACH,2BAA2B,IAAI,qBAAqB;CAGrD"}
1
+ {"version":3,"file":"gradle-module-system-factory.d.ts","sourceRoot":"","sources":["../../../../src/adapters/gradle/services/gradle-module-system-factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,4CAA4C,CAAC;AACjF,OAAO,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AACtE,OAAO,EAAE,qBAAqB,EAAE,MAAM,8CAA8C,CAAC;AAGrF,OAAO,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AAEtE;;;GAGG;AACH,qBAAa,yBAA0B,YAAW,mBAAmB;IAEvD,OAAO,CAAC,QAAQ,CAAC,QAAQ;IADrC,sDAAsD;gBACzB,QAAQ,EAAE,MAAM;IAE7C;;;OAGG;IACH,cAAc,IAAI,cAAc;IAIhC;;;OAGG;IACH,2BAA2B,CAAC,cAAc,EAAE,cAAc,GAAG,qBAAqB;CAGnF"}
@@ -21,7 +21,7 @@ export class GradleModuleSystemFactory {
21
21
  * Creates a Gradle-specific version update strategy.
22
22
  * @returns GradleVersionUpdateStrategy instance configured with the repository root
23
23
  */
24
- createVersionUpdateStrategy() {
25
- return new GradleVersionUpdateStrategy(this.repoRoot);
24
+ createVersionUpdateStrategy(moduleRegistry) {
25
+ return new GradleVersionUpdateStrategy(this.repoRoot, moduleRegistry);
26
26
  }
27
27
  }
@@ -1,16 +1,18 @@
1
1
  import { VersionUpdateStrategy } from "../../../services/version-update-strategy.js";
2
+ import { ModuleRegistry } from '../../../services/module-registry.js';
2
3
  /**
3
4
  * Gradle-specific implementation for version update operations.
4
5
  * Updates module versions by modifying gradle.properties file.
5
6
  */
6
7
  export declare class GradleVersionUpdateStrategy implements VersionUpdateStrategy {
8
+ private readonly moduleRegistry;
7
9
  /** Absolute path to the gradle.properties file. */
8
10
  private readonly versionFilePath;
9
11
  /**
10
12
  * Creates a new Gradle version update strategy.
11
13
  * @param repoRoot - Absolute path to the repository root directory
12
14
  */
13
- constructor(repoRoot: string);
15
+ constructor(repoRoot: string, moduleRegistry: ModuleRegistry);
14
16
  /**
15
17
  * Writes version updates for multiple modules to gradle.properties.
16
18
  * @param moduleVersions - Map of module IDs to new version strings
@@ -1 +1 @@
1
- {"version":3,"file":"gradle-version-update-strategy.d.ts","sourceRoot":"","sources":["../../../../src/adapters/gradle/services/gradle-version-update-strategy.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,8CAA8C,CAAC;AAKrF;;;GAGG;AACH,qBAAa,2BAA4B,YAAW,qBAAqB;IACvE,mDAAmD;IACnD,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAS;IAEzC;;;OAGG;gBACS,QAAQ,EAAE,MAAM;IAI5B;;;;OAIG;IACG,mBAAmB,CAAC,cAAc,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;CAc9E"}
1
+ {"version":3,"file":"gradle-version-update-strategy.d.ts","sourceRoot":"","sources":["../../../../src/adapters/gradle/services/gradle-version-update-strategy.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,8CAA8C,CAAC;AAGrF,OAAO,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AAEtE;;;GAGG;AACH,qBAAa,2BAA4B,YAAW,qBAAqB;IAQzC,OAAO,CAAC,QAAQ,CAAC,cAAc;IAP7D,mDAAmD;IACnD,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAS;IAEzC;;;OAGG;gBACS,QAAQ,EAAE,MAAM,EAAmB,cAAc,EAAE,cAAc;IAI7E;;;;OAIG;IACG,mBAAmB,CAAC,cAAc,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;CAgB9E"}
@@ -1,5 +1,4 @@
1
1
  import { join } from 'path';
2
- import { moduleIdToVersionPropertyName } from '../gradle-properties.js';
3
2
  import { upsertProperties } from '../../../utils/properties.js';
4
3
  import { GRADLE_PROPERTIES_FILE } from '../constants.js';
5
4
  /**
@@ -7,13 +6,15 @@ import { GRADLE_PROPERTIES_FILE } from '../constants.js';
7
6
  * Updates module versions by modifying gradle.properties file.
8
7
  */
9
8
  export class GradleVersionUpdateStrategy {
9
+ moduleRegistry;
10
10
  /** Absolute path to the gradle.properties file. */
11
11
  versionFilePath;
12
12
  /**
13
13
  * Creates a new Gradle version update strategy.
14
14
  * @param repoRoot - Absolute path to the repository root directory
15
15
  */
16
- constructor(repoRoot) {
16
+ constructor(repoRoot, moduleRegistry) {
17
+ this.moduleRegistry = moduleRegistry;
17
18
  this.versionFilePath = join(repoRoot, GRADLE_PROPERTIES_FILE);
18
19
  }
19
20
  /**
@@ -26,7 +27,8 @@ export class GradleVersionUpdateStrategy {
26
27
  // Example: ':app' → 'app.version', ':' → 'version'
27
28
  const propertyUpdates = new Map();
28
29
  for (const [moduleId, versionString] of moduleVersions) {
29
- const propertyName = moduleIdToVersionPropertyName(moduleId);
30
+ const module = this.moduleRegistry.getModule(moduleId);
31
+ const propertyName = module['versionProperty'];
30
32
  propertyUpdates.set(propertyName, versionString);
31
33
  }
32
34
  // Write all properties to gradle.properties file in one atomic operation
@@ -17,7 +17,7 @@ export type Module = {
17
17
  readonly version: SemVer;
18
18
  /** Whether the version is explicitly declared in build configuration (vs inherited). */
19
19
  readonly declaredVersion: boolean;
20
- };
20
+ } & Record<string, unknown>;
21
21
  /**
22
22
  * Structured representation of project information after processing.
23
23
  * Provides efficient access to module information through arrays and maps.
@@ -1 +1 @@
1
- {"version":3,"file":"project-information.d.ts","sourceRoot":"","sources":["../../src/adapters/project-information.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC;;GAEG;AACH,MAAM,MAAM,MAAM,GAAG;IACnB,4FAA4F;IAC5F,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IAEpB,yCAAyC;IACzC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB,yEAAyE;IACzE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB,oFAAoF;IACpF,QAAQ,CAAC,IAAI,EAAE,QAAQ,GAAG,MAAM,CAAC;IAEjC,oEAAoE;IACpE,Q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MAAM,GAAG,SAAS,CAAC;CAClC,CAAC"}
@@ -1,4 +1,5 @@
1
1
  import { ModuleDetector } from "./module-detector.js";
2
+ import { ModuleRegistry } from "./module-registry.js";
2
3
  import { VersionUpdateStrategy } from "./version-update-strategy.js";
3
4
  /**
4
5
  * Factory for creating build system-specific module components.
@@ -19,6 +20,6 @@ export interface ModuleSystemFactory {
19
20
  *
20
21
  * @returns {@link VersionUpdateStrategy} configured for this build system
21
22
  */
22
- createVersionUpdateStrategy(): VersionUpdateStrategy;
23
+ createVersionUpdateStrategy(moduleRegistry: ModuleRegistry): VersionUpdateStrategy;
23
24
  }
24
25
  //# sourceMappingURL=module-system-factory.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"module-system-factory.d.ts","sourceRoot":"","sources":["../../src/services/module-system-factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAErE;;;;;;GAMG;AACH,MAAM,WAAW,mBAAmB;IAClC;;;;OAIG;IACH,cAAc,IAAI,cAAc,CAAC;IAEjC;;;;OAIG;IACH,2BAA2B,IAAI,qBAAqB,CAAC;CACtD"}
1
+ {"version":3,"file":"module-system-factory.d.ts","sourceRoot":"","sources":["../../src/services/module-system-factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAErE;;;;;;GAMG;AACH,MAAM,WAAW,mBAAmB;IAClC;;;;OAIG;IACH,cAAc,IAAI,cAAc,CAAC;IAEjC;;;;OAIG;IACH,2BAA2B,CACzB,cAAc,EAAE,cAAc,GAC7B,qBAAqB,CAAC;CAC1B"}
@@ -151,7 +151,7 @@ export class VerseRunner {
151
151
  };
152
152
  }
153
153
  // Create version manager
154
- const versionUpdateStrategy = this.moduleSystemFactory.createVersionUpdateStrategy();
154
+ const versionUpdateStrategy = this.moduleSystemFactory.createVersionUpdateStrategy(this.moduleRegistry);
155
155
  this.versionManager = new VersionManager(this.moduleRegistry, versionUpdateStrategy);
156
156
  // Initialize version applier and apply changes
157
157
  const versionApplierOptions = {
@@ -13,17 +13,17 @@ import { VersionUpdateStrategy } from "./version-update-strategy.js";
13
13
  * Validates modules against {@link ModuleRegistry}.
14
14
  */
15
15
  export declare class VersionManager {
16
- private readonly hierarchyManager;
16
+ private readonly moduleRegistry;
17
17
  private readonly strategy;
18
18
  /** Pending version updates awaiting commit (module ID → version string). */
19
19
  private readonly pendingUpdates;
20
20
  /**
21
21
  * Creates a new VersionManager.
22
22
  *
23
- * @param hierarchyManager - Module registry for validation
23
+ * @param moduleRegistry - Module registry for validation
24
24
  * @param strategy - Build system-specific strategy for writing updates
25
25
  */
26
- constructor(hierarchyManager: ModuleRegistry, strategy: VersionUpdateStrategy);
26
+ constructor(moduleRegistry: ModuleRegistry, strategy: VersionUpdateStrategy);
27
27
  /**
28
28
  * Stages a version update for a module without persisting to files.
29
29
  *
@@ -1 +1 @@
1
- {"version":3,"file":"version-manager.d.ts","sourceRoot":"","sources":["../../src/services/version-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAGrE;;;;;;;;;;GAUG;AACH,qBAAa,cAAc;IAWvB,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IACjC,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAX3B,4EAA4E;IAC5E,OAAO,CAAC,QAAQ,CAAC,cAAc,CAA6B;IAE5D;;;;;OAKG;gBAEgB,gBAAgB,EAAE,cAAc,EAChC,QAAQ,EAAE,qBAAqB;IAGlD;;;;;;OAM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SemVer } from "../semver/index.js";
11
11
  * Validates modules against {@link ModuleRegistry}.
12
12
  */
13
13
  export class VersionManager {
14
- hierarchyManager;
14
+ moduleRegistry;
15
15
  strategy;
16
16
  /** Pending version updates awaiting commit (module ID → version string). */
17
17
  pendingUpdates = new Map();
18
18
  /**
19
19
  * Creates a new VersionManager.
20
20
  *
21
- * @param hierarchyManager - Module registry for validation
21
+ * @param moduleRegistry - Module registry for validation
22
22
  * @param strategy - Build system-specific strategy for writing updates
23
23
  */
24
- constructor(hierarchyManager, strategy) {
25
- this.hierarchyManager = hierarchyManager;
24
+ constructor(moduleRegistry, strategy) {
25
+ this.moduleRegistry = moduleRegistry;
26
26
  this.strategy = strategy;
27
27
  }
28
28
  /**
@@ -34,7 +34,7 @@ export class VersionManager {
34
34
  */
35
35
  updateVersion(moduleId, newVersion) {
36
36
  // Validate module exists in registry
37
- if (!this.hierarchyManager.hasModule(moduleId)) {
37
+ if (!this.moduleRegistry.hasModule(moduleId)) {
38
38
  throw new Error(`Module ${moduleId} not found`);
39
39
  }
40
40
  // Convert SemVer to string if needed, otherwise use string directly
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@muverse/core",
3
- "version": "0.1.9",
3
+ "version": "0.1.10",
4
4
  "description": "Version Engine for Repo Semantic Evolution (Core Library)",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -1,15 +0,0 @@
1
- /**
2
- * Converts a gradle.properties version property name to a Gradle module ID.
3
- * @param propertyName - Version property name from gradle.properties
4
- * @returns Corresponding Gradle module ID
5
- */
6
- export declare function versionPropertyNameToModuleId(propertyName: string): string;
7
- /**
8
- * Converts a Gradle module ID to a gradle.properties version property name.
9
- * Uses only the last component of the module path (e.g., ':lib:core' → 'core.version').
10
- * @param moduleId - Gradle module ID (e.g., ':', ':app', ':lib:core')
11
- * @returns Corresponding property name for gradle.properties
12
- * @throws {Error} If the module ID is invalid or cannot be parsed
13
- */
14
- export declare function moduleIdToVersionPropertyName(moduleId: string): string;
15
- //# sourceMappingURL=gradle-properties.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"gradle-properties.d.ts","sourceRoot":"","sources":["../../../src/adapters/gradle/gradle-properties.ts"],"names":[],"mappings":"AAeA;;;;GAIG;AACH,wBAAgB,6BAA6B,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAW1E;AAED;;;;;;GAMG;AACH,wBAAgB,6BAA6B,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAgBtE"}
@@ -1,46 +0,0 @@
1
- /** Gradle module identifier for the root project (':'). */
2
- const ROOT_MODULE_ID = ':';
3
- /** Property name for version configuration in gradle.properties ('version'). */
4
- const VERSION = 'version';
5
- /** Separator character used in Gradle module identifiers (':'). */
6
- const MODULE_SEPARATOR = ':';
7
- /** Separator character used in gradle.properties property names ('.'). */
8
- const DOT_SEPARATOR = '.';
9
- /** Regular expression to match and remove the '.version' suffix. */
10
- const VERSION_REGEX = /\.version$/;
11
- /**
12
- * Converts a gradle.properties version property name to a Gradle module ID.
13
- * @param propertyName - Version property name from gradle.properties
14
- * @returns Corresponding Gradle module ID
15
- */
16
- export function versionPropertyNameToModuleId(propertyName) {
17
- // Handle root project special case
18
- if (propertyName === VERSION) {
19
- return ROOT_MODULE_ID;
20
- }
21
- // Remove '.version' suffix
22
- const nameWithoutSuffix = propertyName.replace(VERSION_REGEX, '');
23
- // Convert dot-separated to colon-separated module path: "x.y" -> ":x:y"
24
- return `${ROOT_MODULE_ID}${nameWithoutSuffix.replaceAll(DOT_SEPARATOR, MODULE_SEPARATOR)}`;
25
- }
26
- /**
27
- * Converts a Gradle module ID to a gradle.properties version property name.
28
- * Uses only the last component of the module path (e.g., ':lib:core' → 'core.version').
29
- * @param moduleId - Gradle module ID (e.g., ':', ':app', ':lib:core')
30
- * @returns Corresponding property name for gradle.properties
31
- * @throws {Error} If the module ID is invalid or cannot be parsed
32
- */
33
- export function moduleIdToVersionPropertyName(moduleId) {
34
- // Handle root project special case
35
- if (moduleId === ROOT_MODULE_ID) {
36
- return VERSION;
37
- }
38
- // Split by module separator and get the last component (module name)
39
- const name = moduleId.split(MODULE_SEPARATOR).at(-1);
40
- // Validate that we got a valid module name
41
- if (!name) {
42
- throw new Error(`Invalid module ID: ${moduleId}`);
43
- }
44
- // Return property name: {name}.version
45
- return `${name}.${VERSION}`;
46
- }