@muverse/core 0.2.10 → 0.2.11
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/dist/git/index.d.ts +5 -7
- package/dist/git/index.d.ts.map +1 -1
- package/dist/git/index.js +18 -13
- package/dist/services/commit-analyzer.d.ts.map +1 -1
- package/dist/services/commit-analyzer.js +4 -1
- package/dist/utils/version.d.ts +1 -1
- package/dist/utils/version.js +1 -1
- package/package.json +1 -1
package/dist/git/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* Provides interfaces for commit analysis, tagging, and conventional commit parsing.
|
|
4
4
|
* Supports monorepo and multi-module projects with module-specific tag management.
|
|
5
5
|
*/
|
|
6
|
+
import { Module } from "../index.js";
|
|
6
7
|
/**
|
|
7
8
|
* Represents a parsed git tag with extracted module and version metadata.
|
|
8
9
|
* Supports module tags (moduleName@version) and general tags (v{version}).
|
|
@@ -79,14 +80,12 @@ export type CommitInfo = {
|
|
|
79
80
|
/**
|
|
80
81
|
* Retrieves all commits for a module since its last release tag.
|
|
81
82
|
* Handles monorepo and single-repo scenarios with path filtering.
|
|
82
|
-
* @param
|
|
83
|
-
* @param moduleName - Module name used for tag searching
|
|
84
|
-
* @param moduleType - 'root' for general tags, 'module' for module-specific tags
|
|
83
|
+
* @param projectInfo - Module information including path and type
|
|
85
84
|
* @param options - Git operation options
|
|
86
85
|
* @param excludePaths - Paths to exclude using git pathspec syntax
|
|
87
86
|
* @returns Promise resolving to array of parsed commits (oldest to newest)
|
|
88
87
|
*/
|
|
89
|
-
export declare function getCommitsSinceLastTag(
|
|
88
|
+
export declare function getCommitsSinceLastTag(projectInfo: Module, options?: GitOptions, excludePaths?: string[]): Promise<CommitInfo[]>;
|
|
90
89
|
/**
|
|
91
90
|
* Retrieves commits within a specific git revision range with path filtering.
|
|
92
91
|
* Uses git's native pathspec syntax for efficient filtering in monorepos.
|
|
@@ -100,12 +99,11 @@ export declare function getCommitsInRange(range: string, pathFilter?: string, op
|
|
|
100
99
|
/**
|
|
101
100
|
* Finds the most recent git tag for a specific module with fallback to general tags.
|
|
102
101
|
* Searches module-specific tags first (moduleName@*), then falls back to general tags.
|
|
103
|
-
* @param
|
|
104
|
-
* @param moduleType - 'root' skips module tags, 'module' tries module tags first
|
|
102
|
+
* @param projectInfo - Module information for tag pattern construction
|
|
105
103
|
* @param options - Git operation options
|
|
106
104
|
* @returns Most recent tag name or null if no tags exist
|
|
107
105
|
*/
|
|
108
|
-
export declare function getLastTagForModule(
|
|
106
|
+
export declare function getLastTagForModule(projectInfo: Module, options?: GitOptions): Promise<string | null>;
|
|
109
107
|
/**
|
|
110
108
|
* Retrieves all git tags in the repository with parsed metadata.
|
|
111
109
|
* Returns array with tag name, commit hash, and parsed module/version information.
|
package/dist/git/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/git/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/git/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAUrC;;;GAGG;AACH,MAAM,MAAM,MAAM,GAAG;IACnB,4EAA4E;IAC5E,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,yDAAyD;IACzD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB;;;OAGG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;CAC3B,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB;;;;OAIG;IACH,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,UAAU,GA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AO,GAAE,UAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CActE;AAiED;;;;;GAKG;AACH,wBAAsB,uBAAuB,CAC3C,OAAO,GAAE,UAAe,GACvB,OAAO,CAAC,OAAO,CAAC,CAmBlB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,gBAAgB,CACpC,OAAO,GAAE,UAAe,GACvB,OAAO,CAAC,MAAM,CAAC,CAiBjB;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAsB,wBAAwB,CAC5C,OAAO,GAAE,UAAe,GACvB,OAAO,CAAC,MAAM,CAAC,CAmBjB;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,eAAe,CAAC,OAAO,GAAE,UAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAY7E;AAED;;;;;;;GAOG;AACH,wBAAsB,aAAa,CACjC,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,UAAe,GACvB,OAAO,CAAC,IAAI,CAAC,CAYf;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,WAAW,CAAC,OAAO,GAAE,UAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAYzE;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAsB,kBAAkB,CACtC,OAAO,GAAE,UAAe,GACvB,OAAO,CAAC,OAAO,CAAC,CAkBlB"}
|
package/dist/git/index.js
CHANGED
|
@@ -16,31 +16,31 @@ const commitParser = new CommitParser({
|
|
|
16
16
|
/**
|
|
17
17
|
* Retrieves all commits for a module since its last release tag.
|
|
18
18
|
* Handles monorepo and single-repo scenarios with path filtering.
|
|
19
|
-
* @param
|
|
20
|
-
* @param moduleName - Module name used for tag searching
|
|
21
|
-
* @param moduleType - 'root' for general tags, 'module' for module-specific tags
|
|
19
|
+
* @param projectInfo - Module information including path and type
|
|
22
20
|
* @param options - Git operation options
|
|
23
21
|
* @param excludePaths - Paths to exclude using git pathspec syntax
|
|
24
22
|
* @returns Promise resolving to array of parsed commits (oldest to newest)
|
|
25
23
|
*/
|
|
26
|
-
export async function getCommitsSinceLastTag(
|
|
24
|
+
export async function getCommitsSinceLastTag(projectInfo, options = {}, excludePaths = []) {
|
|
27
25
|
// Resolve the working directory, defaulting to current process directory
|
|
28
26
|
const cwd = options.cwd || process.cwd();
|
|
27
|
+
logger.debug(`🔍 Getting commits for module '${projectInfo.name}' at path '${projectInfo.path}' since last tag...`);
|
|
29
28
|
try {
|
|
30
29
|
// Find the most recent tag for this module
|
|
31
30
|
// For root modules, this finds general tags (v1.0.0)
|
|
32
31
|
// For submodules, this finds module-specific tags (module@1.0.0)
|
|
33
|
-
const lastTag = await getLastTagForModule(
|
|
32
|
+
const lastTag = await getLastTagForModule(projectInfo, { cwd });
|
|
33
|
+
logger.debug(`🔍 Last tag for module '${projectInfo.name}' of type '${projectInfo.type}': ${lastTag}`);
|
|
34
34
|
// Build the git revision range
|
|
35
35
|
// If tag exists: 'tag..HEAD' means commits after tag up to HEAD
|
|
36
36
|
// If no tag: empty string means all commits in history
|
|
37
37
|
const range = lastTag ? `${lastTag}..HEAD` : "";
|
|
38
|
-
return getCommitsInRange(range,
|
|
38
|
+
return getCommitsInRange(range, projectInfo.path, { cwd }, excludePaths);
|
|
39
39
|
}
|
|
40
40
|
catch (error) {
|
|
41
41
|
// If tag lookup fails for any reason, fall back to all commits
|
|
42
42
|
// This ensures we always have commit history for version determination
|
|
43
|
-
return getCommitsInRange("",
|
|
43
|
+
return getCommitsInRange("", projectInfo.path, { cwd }, excludePaths);
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
/**
|
|
@@ -55,6 +55,7 @@ export async function getCommitsSinceLastTag(modulePath, moduleName, moduleType,
|
|
|
55
55
|
export async function getCommitsInRange(range, pathFilter, options = {}, excludePaths = []) {
|
|
56
56
|
// Resolve working directory, defaulting to current directory
|
|
57
57
|
const cwd = options.cwd || process.cwd();
|
|
58
|
+
logger.debug(`🔍 Getting commits in range '${range}' with path filter '${pathFilter}' and excluding paths: ${excludePaths.join(", ")}`);
|
|
58
59
|
try {
|
|
59
60
|
// Build git log command with custom format for easy parsing
|
|
60
61
|
// Format: hash, subject, body, delimiter
|
|
@@ -82,6 +83,7 @@ export async function getCommitsInRange(range, pathFilter, options = {}, exclude
|
|
|
82
83
|
args.push(`:(exclude)${excludePath}`);
|
|
83
84
|
}
|
|
84
85
|
}
|
|
86
|
+
logger.debug(`🐙 Executing git command: git ${args.join(" ")}`);
|
|
85
87
|
// Execute git log command
|
|
86
88
|
// Silent mode prevents output pollution in GitHub Actions
|
|
87
89
|
const { stdout } = await execa("git", args, { cwd });
|
|
@@ -162,22 +164,23 @@ function parseGitLog(output) {
|
|
|
162
164
|
/**
|
|
163
165
|
* Finds the most recent git tag for a specific module with fallback to general tags.
|
|
164
166
|
* Searches module-specific tags first (moduleName@*), then falls back to general tags.
|
|
165
|
-
* @param
|
|
166
|
-
* @param moduleType - 'root' skips module tags, 'module' tries module tags first
|
|
167
|
+
* @param projectInfo - Module information for tag pattern construction
|
|
167
168
|
* @param options - Git operation options
|
|
168
169
|
* @returns Most recent tag name or null if no tags exist
|
|
169
170
|
*/
|
|
170
|
-
export async function getLastTagForModule(
|
|
171
|
+
export async function getLastTagForModule(projectInfo, options = {}) {
|
|
171
172
|
// Resolve working directory, defaulting to current directory
|
|
172
173
|
const cwd = options.cwd || process.cwd();
|
|
174
|
+
logger.debug(`🔍 Finding last tag for module '${projectInfo.name}' of type '${projectInfo.type}'...`);
|
|
173
175
|
try {
|
|
174
176
|
// Generate glob pattern for module-specific tags (e.g., 'api@*')
|
|
175
|
-
const moduleTagPattern = getModuleTagPattern(
|
|
176
|
-
// Only search for module-specific tags if it's not root
|
|
177
|
+
const moduleTagPattern = getModuleTagPattern(projectInfo.name);
|
|
178
|
+
// Only search for module-specific tags if it's not root and version is declared
|
|
177
179
|
// Root projects use general tags (v1.0.0) rather than module tags (root@1.0.0)
|
|
178
|
-
if (
|
|
180
|
+
if (projectInfo.type !== "root" && projectInfo.declaredVersion) {
|
|
179
181
|
// Search for module-specific tags with version sorting
|
|
180
182
|
// --sort=-version:refname: Sort by version in descending order (newest first)
|
|
183
|
+
logger.debug(`🐙 Executing git command: git tag -l ${moduleTagPattern} --sort=-version:refname`);
|
|
181
184
|
const { stdout } = await execa("git", ["tag", "-l", moduleTagPattern, "--sort=-version:refname"], {
|
|
182
185
|
cwd,
|
|
183
186
|
});
|
|
@@ -193,6 +196,7 @@ export async function getLastTagForModule(moduleName, moduleType, options = {})
|
|
|
193
196
|
// git describe finds the most recent tag reachable from HEAD
|
|
194
197
|
// --tags: Consider all tags (not just annotated)
|
|
195
198
|
// --abbrev=0: Don't show commit hash suffix
|
|
199
|
+
logger.debug(`🐙 Executing git command: git describe --tags --abbrev=0 HEAD`);
|
|
196
200
|
const { stdout: fallbackOutput } = await execa("git", ["describe", "--tags", "--abbrev=0", "HEAD"], {
|
|
197
201
|
cwd,
|
|
198
202
|
});
|
|
@@ -223,6 +227,7 @@ export async function getAllTags(options = {}) {
|
|
|
223
227
|
// List all tags with custom format to get name and commit hash
|
|
224
228
|
// %(refname:short): Tag name without refs/tags/ prefix
|
|
225
229
|
// %(objectname): Full commit SHA that the tag points to
|
|
230
|
+
logger.debug(`🐙 Executing git command: git tag -l --format=%(refname:short) %(objectname)`);
|
|
226
231
|
const { stdout } = await execa("git", ["tag", "-l", "--format=%(refname:short) %(objectname)"], {
|
|
227
232
|
cwd,
|
|
228
233
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commit-analyzer.d.ts","sourceRoot":"","sources":["../../src/services/commit-analyzer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAA0B,MAAM,iBAAiB,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD;;;;;;GAMG;AACH,qBAAa,cAAc;IAQvB,OAAO,CAAC,QAAQ,CAAC,cAAc;IAC/B,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAR3B;;;;;OAKG;gBAEgB,cAAc,EAAE,cAAc,EAC9B,QAAQ,EAAE,MAAM;IAGnC;;;;;OAKG;IACG,8BAA8B,IAAI,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,UAAU,EAAE,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"commit-analyzer.d.ts","sourceRoot":"","sources":["../../src/services/commit-analyzer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAA0B,MAAM,iBAAiB,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD;;;;;;GAMG;AACH,qBAAa,cAAc;IAQvB,OAAO,CAAC,QAAQ,CAAC,cAAc;IAC/B,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAR3B;;;;;OAKG;gBAEgB,cAAc,EAAE,cAAc,EAC9B,QAAQ,EAAE,MAAM;IAGnC;;;;;OAKG;IACG,8BAA8B,IAAI,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,UAAU,EAAE,CAAC,CAAC;IA4C1E;;;;;;OAMG;IACH,OAAO,CAAC,oBAAoB;IA2B5B;;;;;;OAMG;IACH,OAAO,CAAC,WAAW;CAUpB"}
|
|
@@ -35,7 +35,7 @@ export class CommitAnalyzer {
|
|
|
35
35
|
// This prevents double-counting commits in the module hierarchy
|
|
36
36
|
const childModulePaths = this.findChildModulePaths(projectInfo.path, projectId);
|
|
37
37
|
// Retrieve commits for this module, excluding child modules
|
|
38
|
-
const commits = await getCommitsSinceLastTag(projectInfo
|
|
38
|
+
const commits = await getCommitsSinceLastTag(projectInfo, { cwd: this.repoRoot }, childModulePaths);
|
|
39
39
|
// Store commits for this module
|
|
40
40
|
moduleCommits.set(projectId, commits);
|
|
41
41
|
// Log exclusions for debugging
|
|
@@ -57,6 +57,7 @@ export class CommitAnalyzer {
|
|
|
57
57
|
*/
|
|
58
58
|
findChildModulePaths(modulePath, moduleId) {
|
|
59
59
|
const childPaths = [];
|
|
60
|
+
logger.debug(`🔎 Finding child modules for ${moduleId} at path '${modulePath}'`);
|
|
60
61
|
// Iterate through all modules to find children
|
|
61
62
|
for (const [otherId, otherInfo] of this.moduleRegistry.getModules()) {
|
|
62
63
|
// Skip the module itself
|
|
@@ -65,6 +66,8 @@ export class CommitAnalyzer {
|
|
|
65
66
|
childPaths.push(otherInfo.path);
|
|
66
67
|
}
|
|
67
68
|
}
|
|
69
|
+
logger.debug(`✅ Found ${childPaths.length} child module(s) for ${moduleId}`);
|
|
70
|
+
logger.debug(`Child module paths: ${childPaths.join(", ")}`);
|
|
68
71
|
return childPaths;
|
|
69
72
|
}
|
|
70
73
|
/**
|
package/dist/utils/version.d.ts
CHANGED
package/dist/utils/version.js
CHANGED