@muverse/core 0.2.10 → 0.3.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/dist/changelog/index.d.ts +6 -21
- package/dist/changelog/index.d.ts.map +1 -1
- package/dist/changelog/index.js +52 -138
- package/dist/config/index.d.ts +3 -3
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +5 -3
- package/dist/git/index.d.ts +110 -8
- package/dist/git/index.d.ts.map +1 -1
- package/dist/git/index.js +177 -56
- package/dist/services/changelog-generator.d.ts +5 -2
- package/dist/services/changelog-generator.d.ts.map +1 -1
- package/dist/services/changelog-generator.js +8 -5
- package/dist/services/commit-analyzer.d.ts +6 -3
- package/dist/services/commit-analyzer.d.ts.map +1 -1
- package/dist/services/commit-analyzer.js +7 -4
- package/dist/services/version-bumper.d.ts +5 -2
- package/dist/services/version-bumper.d.ts.map +1 -1
- package/dist/services/version-bumper.js +1 -1
- package/dist/utils/commits.d.ts +2 -2
- package/dist/utils/commits.d.ts.map +1 -1
- package/dist/utils/commits.js +1 -1
- package/dist/utils/version.d.ts +1 -1
- package/dist/utils/version.d.ts.map +1 -1
- package/dist/utils/version.js +1 -1
- package/package.json +2 -1
|
@@ -1,27 +1,12 @@
|
|
|
1
1
|
import { ModuleChangeResult } from "../services/version-applier.js";
|
|
2
|
-
import {
|
|
3
|
-
export type ChangelogEntry = {
|
|
4
|
-
readonly moduleResult: ModuleChangeResult;
|
|
5
|
-
readonly version: string;
|
|
6
|
-
readonly date: string;
|
|
7
|
-
readonly changes: {
|
|
8
|
-
readonly breaking: CommitInfo[];
|
|
9
|
-
readonly features: CommitInfo[];
|
|
10
|
-
readonly fixes: CommitInfo[];
|
|
11
|
-
readonly other: CommitInfo[];
|
|
12
|
-
};
|
|
13
|
-
};
|
|
14
|
-
export type ChangelogOptions = {
|
|
15
|
-
readonly includeCommitHashes: boolean;
|
|
16
|
-
readonly includeScopes: boolean;
|
|
17
|
-
readonly groupByType: boolean;
|
|
18
|
-
};
|
|
19
|
-
/** Generate changelog content for a module. */
|
|
20
|
-
export declare function generateChangelog(moduleResult: ModuleChangeResult, commits: CommitInfo[], options?: ChangelogOptions): Promise<string>;
|
|
2
|
+
import { Commit } from "conventional-commits-parser";
|
|
21
3
|
/** Update or create a changelog file for a module. */
|
|
22
|
-
export declare function updateChangelogFile(
|
|
4
|
+
export declare function updateChangelogFile(changelogContent: string, changelogPath: string, prependPlaceholder: string): Promise<void>;
|
|
23
5
|
/** Generate changelog for multiple modules. */
|
|
24
|
-
export declare function generateChangelogsForModules(moduleResults: ModuleChangeResult[], getCommitsForModule: (moduleId: string) => Promise<
|
|
6
|
+
export declare function generateChangelogsForModules(moduleResults: ModuleChangeResult[], getCommitsForModule: (moduleId: string) => Promise<{
|
|
7
|
+
commits: Commit[];
|
|
8
|
+
lastTag: string | null;
|
|
9
|
+
}>, repoRoot: string): Promise<string[]>;
|
|
25
10
|
/** Generate a root changelog that summarizes all module changes. */
|
|
26
11
|
export declare function generateRootChangelog(moduleResults: ModuleChangeResult[], repoRoot: string): Promise<string>;
|
|
27
12
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/changelog/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/changelog/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAGpE,OAAO,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AAIrD,sDAAsD;AACtD,wBAAsB,mBAAmB,CACvC,gBAAgB,EAAE,MAAM,EACxB,aAAa,EAAE,MAAM,EACrB,kBAAkB,EAAE,MAAM,GACzB,OAAO,CAAC,IAAI,CAAC,CAWf;AAsBD,+CAA+C;AAC/C,wBAAsB,4BAA4B,CAChD,aAAa,EAAE,kBAAkB,EAAE,EACnC,mBAAmB,EAAE,CACnB,QAAQ,EAAE,MAAM,KACb,OAAO,CAAC;IAAE,OAAO,EAAE,MAAM,EAAE,CAAC;IAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAAC,EAC3D,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,MAAM,EAAE,CAAC,CAgEnB;AAED,oEAAoE;AACpE,wBAAsB,qBAAqB,CACzC,aAAa,EAAE,kBAAkB,EAAE,EACnC,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,MAAM,CAAC,CA4DjB"}
|
package/dist/changelog/index.js
CHANGED
|
@@ -1,150 +1,64 @@
|
|
|
1
1
|
import { promises as fs } from "fs";
|
|
2
|
-
import { join } from "path";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
groupByType: true,
|
|
8
|
-
}) {
|
|
9
|
-
const entry = {
|
|
10
|
-
moduleResult,
|
|
11
|
-
version: moduleResult.to,
|
|
12
|
-
date: new Date().toISOString().split("T")[0], // YYYY-MM-DD format
|
|
13
|
-
changes: {
|
|
14
|
-
breaking: [],
|
|
15
|
-
features: [],
|
|
16
|
-
fixes: [],
|
|
17
|
-
other: [],
|
|
18
|
-
},
|
|
19
|
-
};
|
|
20
|
-
// Categorize commits
|
|
21
|
-
for (const commit of commits) {
|
|
22
|
-
if (commit.breaking) {
|
|
23
|
-
entry.changes.breaking.push(commit);
|
|
24
|
-
}
|
|
25
|
-
else if (commit.type === "feat") {
|
|
26
|
-
entry.changes.features.push(commit);
|
|
27
|
-
}
|
|
28
|
-
else if (commit.type === "fix") {
|
|
29
|
-
entry.changes.fixes.push(commit);
|
|
30
|
-
}
|
|
31
|
-
else if (["perf", "refactor", "style"].includes(commit.type)) {
|
|
32
|
-
entry.changes.other.push(commit);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
return formatChangelogEntry(entry, options);
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Format changelog entry as markdown
|
|
39
|
-
*/
|
|
40
|
-
function formatChangelogEntry(entry, options) {
|
|
41
|
-
const version = entry.version;
|
|
42
|
-
let changelog = `## [${version}] - ${entry.date}\n\n`;
|
|
43
|
-
// Breaking changes first
|
|
44
|
-
if (entry.changes.breaking.length > 0) {
|
|
45
|
-
changelog += "### 💥 BREAKING CHANGES\n\n";
|
|
46
|
-
for (const commit of entry.changes.breaking) {
|
|
47
|
-
changelog += formatCommitLine(commit, options) + "\n";
|
|
48
|
-
}
|
|
49
|
-
changelog += "\n";
|
|
50
|
-
}
|
|
51
|
-
// Features
|
|
52
|
-
if (entry.changes.features.length > 0) {
|
|
53
|
-
changelog += "### ✨ Features\n\n";
|
|
54
|
-
for (const commit of entry.changes.features) {
|
|
55
|
-
changelog += formatCommitLine(commit, options) + "\n";
|
|
56
|
-
}
|
|
57
|
-
changelog += "\n";
|
|
58
|
-
}
|
|
59
|
-
// Bug fixes
|
|
60
|
-
if (entry.changes.fixes.length > 0) {
|
|
61
|
-
changelog += "### 🐛 Bug Fixes\n\n";
|
|
62
|
-
for (const commit of entry.changes.fixes) {
|
|
63
|
-
changelog += formatCommitLine(commit, options) + "\n";
|
|
64
|
-
}
|
|
65
|
-
changelog += "\n";
|
|
66
|
-
}
|
|
67
|
-
// Other changes
|
|
68
|
-
if (entry.changes.other.length > 0) {
|
|
69
|
-
changelog += "### 🔧 Other Changes\n\n";
|
|
70
|
-
for (const commit of entry.changes.other) {
|
|
71
|
-
changelog += formatCommitLine(commit, options) + "\n";
|
|
72
|
-
}
|
|
73
|
-
changelog += "\n";
|
|
74
|
-
}
|
|
75
|
-
return changelog;
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* Format a single commit line
|
|
79
|
-
*/
|
|
80
|
-
function formatCommitLine(commit, options) {
|
|
81
|
-
let line = "- ";
|
|
82
|
-
// Add scope if available and enabled
|
|
83
|
-
if (options.includeScopes && commit.scope) {
|
|
84
|
-
line += `**${commit.scope}**: `;
|
|
85
|
-
}
|
|
86
|
-
// Add subject
|
|
87
|
-
line += commit.subject;
|
|
88
|
-
// Add hash if enabled
|
|
89
|
-
if (options.includeCommitHashes) {
|
|
90
|
-
line += ` (${commit.hash.substring(0, 7)})`;
|
|
91
|
-
}
|
|
92
|
-
return line;
|
|
93
|
-
}
|
|
2
|
+
import path, { join } from "path";
|
|
3
|
+
import { writeChangelogString } from "conventional-changelog-writer";
|
|
4
|
+
import { logger } from "../utils/logger.js";
|
|
5
|
+
import { exists } from "../utils/file.js";
|
|
6
|
+
import { getCurrentRepoUrl, parseRepoUrl } from "../git/index.js";
|
|
94
7
|
/** Update or create a changelog file for a module. */
|
|
95
|
-
export async function updateChangelogFile(
|
|
96
|
-
|
|
97
|
-
|
|
8
|
+
export async function updateChangelogFile(changelogContent, changelogPath, prependPlaceholder) {
|
|
9
|
+
let fileContent = changelogContent;
|
|
10
|
+
if (await exists(changelogPath)) {
|
|
11
|
+
logger.info(`Updating existing changelog at ${changelogPath}...`);
|
|
98
12
|
// Try to read existing changelog
|
|
99
13
|
const existingContent = await fs.readFile(changelogPath, "utf8");
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
let insertIndex = 0;
|
|
103
|
-
// Find the first ## heading or the end of initial content
|
|
104
|
-
for (let i = 0; i < lines.length; i++) {
|
|
105
|
-
if (lines[i].startsWith("## ")) {
|
|
106
|
-
insertIndex = i;
|
|
107
|
-
break;
|
|
108
|
-
}
|
|
109
|
-
if (i === 0 && lines[i].startsWith("# ")) {
|
|
110
|
-
// Skip the main heading
|
|
111
|
-
continue;
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
// Insert the new changelog entry
|
|
115
|
-
const beforeInsert = lines.slice(0, insertIndex);
|
|
116
|
-
const afterInsert = lines.slice(insertIndex);
|
|
117
|
-
const updatedContent = [
|
|
118
|
-
...beforeInsert,
|
|
119
|
-
changelogContent.trim(),
|
|
120
|
-
"",
|
|
121
|
-
...afterInsert,
|
|
122
|
-
].join("\n");
|
|
123
|
-
await fs.writeFile(changelogPath, updatedContent, "utf8");
|
|
14
|
+
const newContent = prependPlaceholder + "\n\n" + changelogContent;
|
|
15
|
+
fileContent = existingContent.replace(prependPlaceholder, newContent);
|
|
124
16
|
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
throw error;
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
return changelogPath;
|
|
17
|
+
await fs.writeFile(changelogPath, fileContent, "utf8");
|
|
18
|
+
}
|
|
19
|
+
async function buildContextRepository(options = {}) {
|
|
20
|
+
const repoUrl = await getCurrentRepoUrl(options);
|
|
21
|
+
const { host, owner, repo } = parseRepoUrl(repoUrl);
|
|
22
|
+
return {
|
|
23
|
+
repoUrl: `https://${host}/${owner}/${repo}`,
|
|
24
|
+
host: `https://${host}`,
|
|
25
|
+
owner,
|
|
26
|
+
repository: repo,
|
|
27
|
+
};
|
|
140
28
|
}
|
|
141
29
|
/** Generate changelog for multiple modules. */
|
|
142
|
-
export async function generateChangelogsForModules(moduleResults, getCommitsForModule, repoRoot
|
|
30
|
+
export async function generateChangelogsForModules(moduleResults, getCommitsForModule, repoRoot) {
|
|
143
31
|
const changelogPaths = [];
|
|
32
|
+
const configPath = path.resolve(repoRoot, "changelog.config.js");
|
|
33
|
+
if (!(await exists(configPath))) {
|
|
34
|
+
throw new Error(`Missing required changelog configuration file at ${configPath}`);
|
|
35
|
+
}
|
|
36
|
+
logger.info(`Loading changelog configuration from ${configPath}...`);
|
|
37
|
+
const userConfig = (await import(configPath)).default;
|
|
38
|
+
const prependPlaceholder = userConfig.context.prependPlaceholder;
|
|
39
|
+
if (!prependPlaceholder) {
|
|
40
|
+
throw new Error("Missing required context property 'prependPlaceholder' in changelog.config.js");
|
|
41
|
+
}
|
|
42
|
+
const contextRepository = await buildContextRepository({ cwd: repoRoot });
|
|
144
43
|
for (const moduleResult of moduleResults) {
|
|
145
|
-
const commits = await getCommitsForModule(moduleResult.id);
|
|
146
|
-
|
|
147
|
-
|
|
44
|
+
const { commits, lastTag } = await getCommitsForModule(moduleResult.id);
|
|
45
|
+
if (commits.length === 0) {
|
|
46
|
+
logger.info(`No commits to include in changelog for module ${moduleResult.id}, skipping...`);
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
const changelogPath = join(repoRoot, moduleResult.path, "CHANGELOG.md");
|
|
50
|
+
let prepend = true;
|
|
51
|
+
if (await exists(changelogPath)) {
|
|
52
|
+
prepend = false;
|
|
53
|
+
}
|
|
54
|
+
const changelogContent = await writeChangelogString(commits, {
|
|
55
|
+
lastTag: lastTag || undefined,
|
|
56
|
+
...contextRepository,
|
|
57
|
+
...userConfig.context,
|
|
58
|
+
prepend,
|
|
59
|
+
}, userConfig.options);
|
|
60
|
+
logger.info(changelogContent);
|
|
61
|
+
await updateChangelogFile(changelogContent, changelogPath, prependPlaceholder);
|
|
148
62
|
changelogPaths.push(changelogPath);
|
|
149
63
|
}
|
|
150
64
|
return changelogPaths;
|
package/dist/config/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { BumpType } from "../semver/index.js";
|
|
3
|
+
import { Commit } from "conventional-commits-parser";
|
|
3
4
|
/**
|
|
4
5
|
* Zod schema for DependencyRules configuration.
|
|
5
6
|
* Validates that dependency cascade rules use valid bump types.
|
|
@@ -97,12 +98,11 @@ export type NodeJSConfig = z.infer<typeof nodeJSConfigSchema>;
|
|
|
97
98
|
export declare const DEFAULT_CONFIG: Config;
|
|
98
99
|
/**
|
|
99
100
|
* Determines the bump type for a commit based on its type and breaking change flag.
|
|
100
|
-
* @param
|
|
101
|
-
* @param isBreaking - Whether the commit contains breaking changes
|
|
101
|
+
* @param commit - The commit to evaluate
|
|
102
102
|
* @param config - Configuration containing commit type mappings
|
|
103
103
|
* @returns The bump type to apply ('major', 'minor', 'patch', or 'none')
|
|
104
104
|
*/
|
|
105
|
-
export declare function getBumpTypeForCommit(
|
|
105
|
+
export declare function getBumpTypeForCommit(commit: Commit, config: Config): BumpType;
|
|
106
106
|
/**
|
|
107
107
|
* Determines how a module should be bumped when one of its dependencies changes.
|
|
108
108
|
* Uses dependency cascade rules from configuration to propagate version changes.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AAqBrD;;;GAGG;AACH,QAAA,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;iBAIzB,CAAC;AAEH;;;GAGG;AACH,QAAA,MAAM,kBAAkB;;;iBAGtB,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAKvB,CAAC;AAEH;;;GAGG;AACH,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAElD;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEpE;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE9D;;;GAGG;AACH,eAAO,MAAM,cAAc,EAAE,MAmB5B,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,QAAQ,CAe7E;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CACnC,kBAAkB,EAAE,QAAQ,EAC5B,MAAM,EAAE,MAAM,GACb,QAAQ,CAaV;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,MAAM,MAAM,EACrD,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,CAAC,GACb,MAAM,CAAC,CAAC,CAAC,CAEX"}
|
package/dist/config/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { isBreakingCommit } from "../git/index.js";
|
|
2
3
|
/**
|
|
3
4
|
* Zod schema for BumpType values.
|
|
4
5
|
* Used for validation in configuration files.
|
|
@@ -69,15 +70,16 @@ export const DEFAULT_CONFIG = {
|
|
|
69
70
|
};
|
|
70
71
|
/**
|
|
71
72
|
* Determines the bump type for a commit based on its type and breaking change flag.
|
|
72
|
-
* @param
|
|
73
|
-
* @param isBreaking - Whether the commit contains breaking changes
|
|
73
|
+
* @param commit - The commit to evaluate
|
|
74
74
|
* @param config - Configuration containing commit type mappings
|
|
75
75
|
* @returns The bump type to apply ('major', 'minor', 'patch', or 'none')
|
|
76
76
|
*/
|
|
77
|
-
export function getBumpTypeForCommit(
|
|
77
|
+
export function getBumpTypeForCommit(commit, config) {
|
|
78
|
+
const isBreaking = isBreakingCommit(commit);
|
|
78
79
|
if (isBreaking) {
|
|
79
80
|
return "major";
|
|
80
81
|
}
|
|
82
|
+
const commitType = commit.type || "unknown";
|
|
81
83
|
const configuredBump = config.commitTypes[commitType];
|
|
82
84
|
if (configuredBump === "ignore") {
|
|
83
85
|
return "none";
|
package/dist/git/index.d.ts
CHANGED
|
@@ -3,6 +3,8 @@
|
|
|
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 { Commit } from "conventional-commits-parser";
|
|
7
|
+
import { Module } from "../index.js";
|
|
6
8
|
/**
|
|
7
9
|
* Represents a parsed git tag with extracted module and version metadata.
|
|
8
10
|
* Supports module tags (moduleName@version) and general tags (v{version}).
|
|
@@ -75,18 +77,20 @@ export type CommitInfo = {
|
|
|
75
77
|
* Not currently extracted by the parser but reserved for future use.
|
|
76
78
|
*/
|
|
77
79
|
readonly module?: string;
|
|
80
|
+
readonly parsed?: Commit;
|
|
78
81
|
};
|
|
79
82
|
/**
|
|
80
83
|
* Retrieves all commits for a module since its last release tag.
|
|
81
84
|
* 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
|
|
85
|
+
* @param projectInfo - Module information including path and type
|
|
85
86
|
* @param options - Git operation options
|
|
86
87
|
* @param excludePaths - Paths to exclude using git pathspec syntax
|
|
87
88
|
* @returns Promise resolving to array of parsed commits (oldest to newest)
|
|
88
89
|
*/
|
|
89
|
-
export declare function getCommitsSinceLastTag(
|
|
90
|
+
export declare function getCommitsSinceLastTag(projectInfo: Module, options?: GitOptions, excludePaths?: string[]): Promise<{
|
|
91
|
+
commits: Commit[];
|
|
92
|
+
lastTag: string | null;
|
|
93
|
+
}>;
|
|
90
94
|
/**
|
|
91
95
|
* Retrieves commits within a specific git revision range with path filtering.
|
|
92
96
|
* Uses git's native pathspec syntax for efficient filtering in monorepos.
|
|
@@ -96,16 +100,16 @@ export declare function getCommitsSinceLastTag(modulePath: string, moduleName: s
|
|
|
96
100
|
* @param excludePaths - Paths to exclude using ':(exclude)path' syntax
|
|
97
101
|
* @returns Promise resolving to array of parsed commits (oldest to newest)
|
|
98
102
|
*/
|
|
99
|
-
export declare function getCommitsInRange(range: string, pathFilter?: string, options?: GitOptions, excludePaths?: string[]): Promise<
|
|
103
|
+
export declare function getCommitsInRange(range: string, pathFilter?: string, options?: GitOptions, excludePaths?: string[]): Promise<Commit[]>;
|
|
104
|
+
export declare function isBreakingCommit(commit: Commit): boolean;
|
|
100
105
|
/**
|
|
101
106
|
* Finds the most recent git tag for a specific module with fallback to general tags.
|
|
102
107
|
* 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
|
|
108
|
+
* @param projectInfo - Module information for tag pattern construction
|
|
105
109
|
* @param options - Git operation options
|
|
106
110
|
* @returns Most recent tag name or null if no tags exist
|
|
107
111
|
*/
|
|
108
|
-
export declare function getLastTagForModule(
|
|
112
|
+
export declare function getLastTagForModule(projectInfo: Module, options?: GitOptions): Promise<string | null>;
|
|
109
113
|
/**
|
|
110
114
|
* Retrieves all git tags in the repository with parsed metadata.
|
|
111
115
|
* Returns array with tag name, commit hash, and parsed module/version information.
|
|
@@ -250,4 +254,102 @@ export declare function pushCommits(options?: GitOptions): Promise<void>;
|
|
|
250
254
|
* Unlike `isWorkingDirectoryClean()`, this function throws on errors.
|
|
251
255
|
*/
|
|
252
256
|
export declare function hasChangesToCommit(options?: GitOptions): Promise<boolean>;
|
|
257
|
+
export declare function getCurrentRepoUrl(options?: GitOptions): Promise<string>;
|
|
258
|
+
/**
|
|
259
|
+
* Parses a git repository URL (SSH or HTTP/HTTPS) and extracts its components.
|
|
260
|
+
*
|
|
261
|
+
* Supports multiple URL formats:
|
|
262
|
+
* - SSH: `git@github.com:owner/repo.git`
|
|
263
|
+
* - HTTPS: `https://github.com/owner/repo.git`
|
|
264
|
+
* - HTTP: `http://github.com/owner/repo.git`
|
|
265
|
+
*
|
|
266
|
+
* @param repoUrl - The repository URL to parse
|
|
267
|
+
* @returns Object containing host, owner, and repo name
|
|
268
|
+
* @throws {Error} If URL format is invalid or cannot be parsed
|
|
269
|
+
* @internal
|
|
270
|
+
*/
|
|
271
|
+
export declare function parseRepoUrl(repoUrl: string): {
|
|
272
|
+
host: string;
|
|
273
|
+
owner: string;
|
|
274
|
+
repo: string;
|
|
275
|
+
};
|
|
276
|
+
/**
|
|
277
|
+
* Retrieves the current repository URL and converts it to HTTPS format.
|
|
278
|
+
*
|
|
279
|
+
* This function is useful for:
|
|
280
|
+
* - Generating consistent HTTPS URLs for documentation
|
|
281
|
+
* - Creating web links to the repository
|
|
282
|
+
* - CI/CD systems that prefer HTTPS over SSH
|
|
283
|
+
*
|
|
284
|
+
* Converts SSH URLs (git@github.com:owner/repo.git) to HTTPS format
|
|
285
|
+
* (https://github.com/owner/repo.git).
|
|
286
|
+
*
|
|
287
|
+
* @param options - Git operation options, primarily for specifying working directory.
|
|
288
|
+
*
|
|
289
|
+
* @returns Promise resolving to the repository URL in HTTPS format.
|
|
290
|
+
*
|
|
291
|
+
* @throws {Error} If:
|
|
292
|
+
* - Unable to get remote URL
|
|
293
|
+
* - URL format is invalid
|
|
294
|
+
* - Not in a git repository
|
|
295
|
+
*/
|
|
296
|
+
export declare function getRepoUrlAsHttps(options?: GitOptions): Promise<string>;
|
|
297
|
+
/**
|
|
298
|
+
* Extracts the hostname from the current repository's remote URL.
|
|
299
|
+
*
|
|
300
|
+
* Returns the hosting service domain (e.g., 'github.com', 'gitlab.com',
|
|
301
|
+
* 'bitbucket.org', or custom Git server hostname).
|
|
302
|
+
*
|
|
303
|
+
* Supports both SSH and HTTP/HTTPS URL formats.
|
|
304
|
+
*
|
|
305
|
+
* @param options - Git operation options, primarily for specifying working directory.
|
|
306
|
+
*
|
|
307
|
+
* @returns Promise resolving to the repository host (e.g., 'github.com').
|
|
308
|
+
*
|
|
309
|
+
* @throws {Error} If:
|
|
310
|
+
* - Unable to get remote URL
|
|
311
|
+
* - URL format is invalid
|
|
312
|
+
* - Not in a git repository
|
|
313
|
+
*/
|
|
314
|
+
export declare function getRepoHost(options?: GitOptions): Promise<string>;
|
|
315
|
+
/**
|
|
316
|
+
* Extracts the repository owner/organization name from the current repository's remote URL.
|
|
317
|
+
*
|
|
318
|
+
* Returns the account or organization that owns the repository.
|
|
319
|
+
* For example:
|
|
320
|
+
* - `git@github.com:microsoft/vscode.git` → 'microsoft'
|
|
321
|
+
* - `https://github.com/facebook/react.git` → 'facebook'
|
|
322
|
+
*
|
|
323
|
+
* Supports both SSH and HTTP/HTTPS URL formats.
|
|
324
|
+
*
|
|
325
|
+
* @param options - Git operation options, primarily for specifying working directory.
|
|
326
|
+
*
|
|
327
|
+
* @returns Promise resolving to the repository owner name.
|
|
328
|
+
*
|
|
329
|
+
* @throws {Error} If:
|
|
330
|
+
* - Unable to get remote URL
|
|
331
|
+
* - URL format is invalid
|
|
332
|
+
* - Not in a git repository
|
|
333
|
+
*/
|
|
334
|
+
export declare function getRepoOwner(options?: GitOptions): Promise<string>;
|
|
335
|
+
/**
|
|
336
|
+
* Extracts the repository name from the current repository's remote URL.
|
|
337
|
+
*
|
|
338
|
+
* Returns the name of the repository without the owner prefix or .git suffix.
|
|
339
|
+
* For example:
|
|
340
|
+
* - `git@github.com:microsoft/vscode.git` → 'vscode'
|
|
341
|
+
* - `https://github.com/facebook/react.git` → 'react'
|
|
342
|
+
*
|
|
343
|
+
* Supports both SSH and HTTP/HTTPS URL formats.
|
|
344
|
+
*
|
|
345
|
+
* @param options - Git operation options, primarily for specifying working directory.
|
|
346
|
+
*
|
|
347
|
+
* @returns Promise resolving to the repository name.
|
|
348
|
+
*
|
|
349
|
+
* @throws {Error} If:
|
|
350
|
+
* - Unable to get remote URL
|
|
351
|
+
* - URL format is invalid
|
|
352
|
+
* - Not in a git repository
|
|
353
|
+
*/
|
|
354
|
+
export declare function getRepoName(options?: GitOptions): Promise<string>;
|
|
253
355
|
//# sourceMappingURL=index.d.ts.map
|
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":"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"}
|
package/dist/git/index.js
CHANGED
|
@@ -16,31 +16,33 @@ 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
|
-
|
|
38
|
+
const commits = await getCommitsInRange(range, projectInfo.path, { cwd }, excludePaths);
|
|
39
|
+
return { commits, lastTag };
|
|
39
40
|
}
|
|
40
41
|
catch (error) {
|
|
41
42
|
// If tag lookup fails for any reason, fall back to all commits
|
|
42
43
|
// This ensures we always have commit history for version determination
|
|
43
|
-
|
|
44
|
+
const commits = await getCommitsInRange("", projectInfo.path, { cwd }, excludePaths);
|
|
45
|
+
return { commits, lastTag: null };
|
|
44
46
|
}
|
|
45
47
|
}
|
|
46
48
|
/**
|
|
@@ -55,10 +57,14 @@ export async function getCommitsSinceLastTag(modulePath, moduleName, moduleType,
|
|
|
55
57
|
export async function getCommitsInRange(range, pathFilter, options = {}, excludePaths = []) {
|
|
56
58
|
// Resolve working directory, defaulting to current directory
|
|
57
59
|
const cwd = options.cwd || process.cwd();
|
|
60
|
+
logger.debug(`🔍 Getting commits in range '${range}' with path filter '${pathFilter}' and excluding paths: ${excludePaths.join(", ")}`);
|
|
58
61
|
try {
|
|
59
62
|
// Build git log command with custom format for easy parsing
|
|
60
63
|
// Format: hash, subject, body, delimiter
|
|
61
|
-
const args = [
|
|
64
|
+
const args = [
|
|
65
|
+
"log",
|
|
66
|
+
"--format=%s%n%b%n-hash-%n%H%n-decorations-%n%D%n-authorName-%n%an%n-authorEmail-%n%ae%n-committerName-%n%cn%n-committerEmail-%n%ce%n---COMMIT-END---",
|
|
67
|
+
];
|
|
62
68
|
// Only add range if it's not empty
|
|
63
69
|
// Empty range means "all commits" which is valid
|
|
64
70
|
if (range.trim()) {
|
|
@@ -82,6 +88,7 @@ export async function getCommitsInRange(range, pathFilter, options = {}, exclude
|
|
|
82
88
|
args.push(`:(exclude)${excludePath}`);
|
|
83
89
|
}
|
|
84
90
|
}
|
|
91
|
+
logger.debug(`🐙 Executing git command: git ${args.join(" ")}`);
|
|
85
92
|
// Execute git log command
|
|
86
93
|
// Silent mode prevents output pollution in GitHub Actions
|
|
87
94
|
const { stdout } = await execa("git", args, { cwd });
|
|
@@ -96,10 +103,10 @@ export async function getCommitsInRange(range, pathFilter, options = {}, exclude
|
|
|
96
103
|
}
|
|
97
104
|
}
|
|
98
105
|
/**
|
|
99
|
-
* Parses raw git log output into structured
|
|
106
|
+
* Parses raw git log output into structured Commit objects with Conventional Commits analysis.
|
|
100
107
|
* Resilient to parsing failures - classifies non-conventional commits as 'unknown' type.
|
|
101
108
|
* @param output - Raw git log output using custom format
|
|
102
|
-
* @returns Array of parsed
|
|
109
|
+
* @returns Array of parsed Commit objects (empty if no valid commits)
|
|
103
110
|
* @internal
|
|
104
111
|
*/
|
|
105
112
|
function parseGitLog(output) {
|
|
@@ -115,69 +122,38 @@ function parseGitLog(output) {
|
|
|
115
122
|
.split("---COMMIT-END---")
|
|
116
123
|
.filter((block) => block.trim());
|
|
117
124
|
for (const block of commitBlocks) {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
if (lines.length < 2) {
|
|
122
|
-
logger.debug(`Skipping malformed commit block:\n${block}`);
|
|
123
|
-
continue;
|
|
124
|
-
}
|
|
125
|
-
// Extract structured data from the block
|
|
126
|
-
const hash = lines[0]; // Line 1: commit SHA
|
|
127
|
-
const subject = lines[1]; // Line 2: commit message subject
|
|
128
|
-
const body = lines.slice(2).join("\n").trim(); // Remaining: commit body
|
|
129
|
-
logger.debug(`Processing commit ${hash} with subject: ${subject}`);
|
|
130
|
-
logger.debug(`Commit body:\n${body}`);
|
|
131
|
-
try {
|
|
132
|
-
// Parse using Conventional Commits specification
|
|
133
|
-
// Combines subject and body for full context (breaking changes may be in body)
|
|
134
|
-
const parsed = commitParser.parse(subject + "\n\n" + body);
|
|
135
|
-
logger.debug(`Parsed commit ${hash}: ${JSON.stringify(parsed)}`);
|
|
136
|
-
// Build CommitInfo from parsed data
|
|
137
|
-
commits.push({
|
|
138
|
-
hash,
|
|
139
|
-
type: parsed.type || "unknown", // Default to 'unknown' if type missing
|
|
140
|
-
scope: parsed.scope || undefined,
|
|
141
|
-
subject: parsed.subject || subject, // Fallback to raw subject if parsing fails
|
|
142
|
-
body: body || undefined,
|
|
143
|
-
// Check if any note has title 'BREAKING CHANGE'
|
|
144
|
-
breaking: parsed.notes?.some((note) => note.title === "BREAKING CHANGE") ||
|
|
145
|
-
false,
|
|
146
|
-
});
|
|
147
|
-
}
|
|
148
|
-
catch (error) {
|
|
149
|
-
// If conventional commits parsing fails, treat as unknown type
|
|
150
|
-
// This ensures non-conventional commits don't break the system
|
|
151
|
-
commits.push({
|
|
152
|
-
hash,
|
|
153
|
-
type: "unknown",
|
|
154
|
-
subject,
|
|
155
|
-
body: body || undefined,
|
|
156
|
-
breaking: false,
|
|
157
|
-
});
|
|
125
|
+
const parsed = commitParser.parse(block);
|
|
126
|
+
if (!parsed.hash) {
|
|
127
|
+
throw new Error("Parsed commit is missing hash");
|
|
158
128
|
}
|
|
129
|
+
logger.debug(`Parsed commit ${parsed.hash}: ${JSON.stringify(parsed)}`);
|
|
130
|
+
commits.push(parsed);
|
|
159
131
|
}
|
|
160
132
|
return commits;
|
|
161
133
|
}
|
|
134
|
+
export function isBreakingCommit(commit) {
|
|
135
|
+
return (commit?.notes?.some((note) => note.title === "BREAKING CHANGE") || false);
|
|
136
|
+
}
|
|
162
137
|
/**
|
|
163
138
|
* Finds the most recent git tag for a specific module with fallback to general tags.
|
|
164
139
|
* 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
|
|
140
|
+
* @param projectInfo - Module information for tag pattern construction
|
|
167
141
|
* @param options - Git operation options
|
|
168
142
|
* @returns Most recent tag name or null if no tags exist
|
|
169
143
|
*/
|
|
170
|
-
export async function getLastTagForModule(
|
|
144
|
+
export async function getLastTagForModule(projectInfo, options = {}) {
|
|
171
145
|
// Resolve working directory, defaulting to current directory
|
|
172
146
|
const cwd = options.cwd || process.cwd();
|
|
147
|
+
logger.debug(`🔍 Finding last tag for module '${projectInfo.name}' of type '${projectInfo.type}'...`);
|
|
173
148
|
try {
|
|
174
149
|
// 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
|
|
150
|
+
const moduleTagPattern = getModuleTagPattern(projectInfo.name);
|
|
151
|
+
// Only search for module-specific tags if it's not root and version is declared
|
|
177
152
|
// Root projects use general tags (v1.0.0) rather than module tags (root@1.0.0)
|
|
178
|
-
if (
|
|
153
|
+
if (projectInfo.type !== "root" && projectInfo.declaredVersion) {
|
|
179
154
|
// Search for module-specific tags with version sorting
|
|
180
155
|
// --sort=-version:refname: Sort by version in descending order (newest first)
|
|
156
|
+
logger.debug(`🐙 Executing git command: git tag -l ${moduleTagPattern} --sort=-version:refname`);
|
|
181
157
|
const { stdout } = await execa("git", ["tag", "-l", moduleTagPattern, "--sort=-version:refname"], {
|
|
182
158
|
cwd,
|
|
183
159
|
});
|
|
@@ -193,6 +169,7 @@ export async function getLastTagForModule(moduleName, moduleType, options = {})
|
|
|
193
169
|
// git describe finds the most recent tag reachable from HEAD
|
|
194
170
|
// --tags: Consider all tags (not just annotated)
|
|
195
171
|
// --abbrev=0: Don't show commit hash suffix
|
|
172
|
+
logger.debug(`🐙 Executing git command: git describe --tags --abbrev=0 HEAD`);
|
|
196
173
|
const { stdout: fallbackOutput } = await execa("git", ["describe", "--tags", "--abbrev=0", "HEAD"], {
|
|
197
174
|
cwd,
|
|
198
175
|
});
|
|
@@ -223,6 +200,7 @@ export async function getAllTags(options = {}) {
|
|
|
223
200
|
// List all tags with custom format to get name and commit hash
|
|
224
201
|
// %(refname:short): Tag name without refs/tags/ prefix
|
|
225
202
|
// %(objectname): Full commit SHA that the tag points to
|
|
203
|
+
logger.debug(`🐙 Executing git command: git tag -l --format=%(refname:short) %(objectname)`);
|
|
226
204
|
const { stdout } = await execa("git", ["tag", "-l", "--format=%(refname:short) %(objectname)"], {
|
|
227
205
|
cwd,
|
|
228
206
|
});
|
|
@@ -579,3 +557,146 @@ export async function hasChangesToCommit(options = {}) {
|
|
|
579
557
|
throw new Error(`Failed to check git status: ${error}`);
|
|
580
558
|
}
|
|
581
559
|
}
|
|
560
|
+
export async function getCurrentRepoUrl(options = {}) {
|
|
561
|
+
// Resolve working directory
|
|
562
|
+
const cwd = options.cwd || process.cwd();
|
|
563
|
+
try {
|
|
564
|
+
// Get the URL of the 'origin' remote
|
|
565
|
+
const { stdout } = await execa("git", ["remote", "get-url", "origin"], {
|
|
566
|
+
cwd,
|
|
567
|
+
});
|
|
568
|
+
return stdout.trim();
|
|
569
|
+
}
|
|
570
|
+
catch (error) {
|
|
571
|
+
throw new Error(`Failed to get repository URL: ${error}`);
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
/**
|
|
575
|
+
* Parses a git repository URL (SSH or HTTP/HTTPS) and extracts its components.
|
|
576
|
+
*
|
|
577
|
+
* Supports multiple URL formats:
|
|
578
|
+
* - SSH: `git@github.com:owner/repo.git`
|
|
579
|
+
* - HTTPS: `https://github.com/owner/repo.git`
|
|
580
|
+
* - HTTP: `http://github.com/owner/repo.git`
|
|
581
|
+
*
|
|
582
|
+
* @param repoUrl - The repository URL to parse
|
|
583
|
+
* @returns Object containing host, owner, and repo name
|
|
584
|
+
* @throws {Error} If URL format is invalid or cannot be parsed
|
|
585
|
+
* @internal
|
|
586
|
+
*/
|
|
587
|
+
export function parseRepoUrl(repoUrl) {
|
|
588
|
+
// Handle SSH format: git@github.com:owner/repo.git
|
|
589
|
+
const sshMatch = repoUrl.match(/^git@([^:]+):(.+?)\/([^/]+?)(\.git)?$/);
|
|
590
|
+
if (sshMatch) {
|
|
591
|
+
return {
|
|
592
|
+
host: sshMatch[1],
|
|
593
|
+
owner: sshMatch[2],
|
|
594
|
+
repo: sshMatch[3],
|
|
595
|
+
};
|
|
596
|
+
}
|
|
597
|
+
// Handle HTTP/HTTPS format: https://github.com/owner/repo.git
|
|
598
|
+
const httpsMatch = repoUrl.match(/^https?:\/\/([^/]+)\/(.+?)\/([^/]+?)(\.git)?$/);
|
|
599
|
+
if (httpsMatch) {
|
|
600
|
+
return {
|
|
601
|
+
host: httpsMatch[1],
|
|
602
|
+
owner: httpsMatch[2],
|
|
603
|
+
repo: httpsMatch[3],
|
|
604
|
+
};
|
|
605
|
+
}
|
|
606
|
+
throw new Error(`Invalid repository URL format: ${repoUrl}`);
|
|
607
|
+
}
|
|
608
|
+
/**
|
|
609
|
+
* Retrieves the current repository URL and converts it to HTTPS format.
|
|
610
|
+
*
|
|
611
|
+
* This function is useful for:
|
|
612
|
+
* - Generating consistent HTTPS URLs for documentation
|
|
613
|
+
* - Creating web links to the repository
|
|
614
|
+
* - CI/CD systems that prefer HTTPS over SSH
|
|
615
|
+
*
|
|
616
|
+
* Converts SSH URLs (git@github.com:owner/repo.git) to HTTPS format
|
|
617
|
+
* (https://github.com/owner/repo.git).
|
|
618
|
+
*
|
|
619
|
+
* @param options - Git operation options, primarily for specifying working directory.
|
|
620
|
+
*
|
|
621
|
+
* @returns Promise resolving to the repository URL in HTTPS format.
|
|
622
|
+
*
|
|
623
|
+
* @throws {Error} If:
|
|
624
|
+
* - Unable to get remote URL
|
|
625
|
+
* - URL format is invalid
|
|
626
|
+
* - Not in a git repository
|
|
627
|
+
*/
|
|
628
|
+
export async function getRepoUrlAsHttps(options = {}) {
|
|
629
|
+
const repoUrl = await getCurrentRepoUrl(options);
|
|
630
|
+
const { host, owner, repo } = parseRepoUrl(repoUrl);
|
|
631
|
+
return `https://${host}/${owner}/${repo}.git`;
|
|
632
|
+
}
|
|
633
|
+
/**
|
|
634
|
+
* Extracts the hostname from the current repository's remote URL.
|
|
635
|
+
*
|
|
636
|
+
* Returns the hosting service domain (e.g., 'github.com', 'gitlab.com',
|
|
637
|
+
* 'bitbucket.org', or custom Git server hostname).
|
|
638
|
+
*
|
|
639
|
+
* Supports both SSH and HTTP/HTTPS URL formats.
|
|
640
|
+
*
|
|
641
|
+
* @param options - Git operation options, primarily for specifying working directory.
|
|
642
|
+
*
|
|
643
|
+
* @returns Promise resolving to the repository host (e.g., 'github.com').
|
|
644
|
+
*
|
|
645
|
+
* @throws {Error} If:
|
|
646
|
+
* - Unable to get remote URL
|
|
647
|
+
* - URL format is invalid
|
|
648
|
+
* - Not in a git repository
|
|
649
|
+
*/
|
|
650
|
+
export async function getRepoHost(options = {}) {
|
|
651
|
+
const repoUrl = await getCurrentRepoUrl(options);
|
|
652
|
+
const { host } = parseRepoUrl(repoUrl);
|
|
653
|
+
return host;
|
|
654
|
+
}
|
|
655
|
+
/**
|
|
656
|
+
* Extracts the repository owner/organization name from the current repository's remote URL.
|
|
657
|
+
*
|
|
658
|
+
* Returns the account or organization that owns the repository.
|
|
659
|
+
* For example:
|
|
660
|
+
* - `git@github.com:microsoft/vscode.git` → 'microsoft'
|
|
661
|
+
* - `https://github.com/facebook/react.git` → 'facebook'
|
|
662
|
+
*
|
|
663
|
+
* Supports both SSH and HTTP/HTTPS URL formats.
|
|
664
|
+
*
|
|
665
|
+
* @param options - Git operation options, primarily for specifying working directory.
|
|
666
|
+
*
|
|
667
|
+
* @returns Promise resolving to the repository owner name.
|
|
668
|
+
*
|
|
669
|
+
* @throws {Error} If:
|
|
670
|
+
* - Unable to get remote URL
|
|
671
|
+
* - URL format is invalid
|
|
672
|
+
* - Not in a git repository
|
|
673
|
+
*/
|
|
674
|
+
export async function getRepoOwner(options = {}) {
|
|
675
|
+
const repoUrl = await getCurrentRepoUrl(options);
|
|
676
|
+
const { owner } = parseRepoUrl(repoUrl);
|
|
677
|
+
return owner;
|
|
678
|
+
}
|
|
679
|
+
/**
|
|
680
|
+
* Extracts the repository name from the current repository's remote URL.
|
|
681
|
+
*
|
|
682
|
+
* Returns the name of the repository without the owner prefix or .git suffix.
|
|
683
|
+
* For example:
|
|
684
|
+
* - `git@github.com:microsoft/vscode.git` → 'vscode'
|
|
685
|
+
* - `https://github.com/facebook/react.git` → 'react'
|
|
686
|
+
*
|
|
687
|
+
* Supports both SSH and HTTP/HTTPS URL formats.
|
|
688
|
+
*
|
|
689
|
+
* @param options - Git operation options, primarily for specifying working directory.
|
|
690
|
+
*
|
|
691
|
+
* @returns Promise resolving to the repository name.
|
|
692
|
+
*
|
|
693
|
+
* @throws {Error} If:
|
|
694
|
+
* - Unable to get remote URL
|
|
695
|
+
* - URL format is invalid
|
|
696
|
+
* - Not in a git repository
|
|
697
|
+
*/
|
|
698
|
+
export async function getRepoName(options = {}) {
|
|
699
|
+
const repoUrl = await getCurrentRepoUrl(options);
|
|
700
|
+
const { repo } = parseRepoUrl(repoUrl);
|
|
701
|
+
return repo;
|
|
702
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ModuleChangeResult } from "./version-applier.js";
|
|
2
|
-
import {
|
|
2
|
+
import { Commit } from "conventional-commits-parser";
|
|
3
3
|
export type ChangelogGeneratorOptions = {
|
|
4
4
|
generateChangelog: boolean;
|
|
5
5
|
repoRoot: string;
|
|
@@ -8,6 +8,9 @@ export type ChangelogGeneratorOptions = {
|
|
|
8
8
|
export declare class ChangelogGenerator {
|
|
9
9
|
private readonly options;
|
|
10
10
|
constructor(options: ChangelogGeneratorOptions);
|
|
11
|
-
generateChangelogs(moduleResults: ModuleChangeResult[], moduleCommits: Map<string,
|
|
11
|
+
generateChangelogs(moduleResults: ModuleChangeResult[], moduleCommits: Map<string, {
|
|
12
|
+
commits: Commit[];
|
|
13
|
+
lastTag: string | null;
|
|
14
|
+
}>): Promise<string[]>;
|
|
12
15
|
}
|
|
13
16
|
//# sourceMappingURL=changelog-generator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"changelog-generator.d.ts","sourceRoot":"","sources":["../../src/services/changelog-generator.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"changelog-generator.d.ts","sourceRoot":"","sources":["../../src/services/changelog-generator.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AAErD,MAAM,MAAM,yBAAyB,GAAG;IACtC,iBAAiB,EAAE,OAAO,CAAC;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF,qBAAa,kBAAkB;IACjB,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAAP,OAAO,EAAE,yBAAyB;IAEzD,kBAAkB,CACtB,aAAa,EAAE,kBAAkB,EAAE,EACnC,aAAa,EAAE,GAAG,CAAC,MAAM,EAAE;QAAE,OAAO,EAAE,MAAM,EAAE,CAAC;QAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC,GACxE,OAAO,CAAC,MAAM,EAAE,CAAC;CAiCrB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { logger } from "../utils/logger.js";
|
|
2
|
-
import { generateChangelogsForModules
|
|
2
|
+
import { generateChangelogsForModules } from "../changelog/index.js";
|
|
3
3
|
export class ChangelogGenerator {
|
|
4
4
|
options;
|
|
5
5
|
constructor(options) {
|
|
@@ -16,10 +16,13 @@ export class ChangelogGenerator {
|
|
|
16
16
|
return [];
|
|
17
17
|
}
|
|
18
18
|
// Generate individual module changelogs
|
|
19
|
-
const changelogPaths = await generateChangelogsForModules(moduleResults, async (moduleId) => moduleCommits.get(moduleId) || [], this.options.repoRoot);
|
|
20
|
-
|
|
21
|
-
const rootChangelogPath = await generateRootChangelog(
|
|
22
|
-
|
|
19
|
+
const changelogPaths = await generateChangelogsForModules(moduleResults, async (moduleId) => moduleCommits.get(moduleId) || { commits: [], lastTag: null }, this.options.repoRoot);
|
|
20
|
+
/*// Generate root changelog
|
|
21
|
+
const rootChangelogPath = await generateRootChangelog(
|
|
22
|
+
moduleResults,
|
|
23
|
+
this.options.repoRoot,
|
|
24
|
+
);
|
|
25
|
+
changelogPaths.push(rootChangelogPath);*/
|
|
23
26
|
logger.info(`📝 Generated ${changelogPaths.length} changelog files`);
|
|
24
27
|
return changelogPaths;
|
|
25
28
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { CommitInfo } from "../git/index.js";
|
|
2
1
|
import { ModuleRegistry } from "./module-registry.js";
|
|
2
|
+
import { Commit } from "conventional-commits-parser";
|
|
3
3
|
/**
|
|
4
4
|
* Analyzes git commits for each module, preventing double-counting in hierarchical structures.
|
|
5
5
|
*
|
|
@@ -20,10 +20,13 @@ export declare class CommitAnalyzer {
|
|
|
20
20
|
/**
|
|
21
21
|
* Analyzes commits since the last release for all modules.
|
|
22
22
|
*
|
|
23
|
-
* @returns Map of module ID to array of {@link
|
|
23
|
+
* @returns Map of module ID to array of {@link Commit} objects
|
|
24
24
|
* @throws {Error} If git operations fail
|
|
25
25
|
*/
|
|
26
|
-
analyzeCommitsSinceLastRelease(): Promise<Map<string,
|
|
26
|
+
analyzeCommitsSinceLastRelease(): Promise<Map<string, {
|
|
27
|
+
commits: Commit[];
|
|
28
|
+
lastTag: string | null;
|
|
29
|
+
}>>;
|
|
27
30
|
/**
|
|
28
31
|
* Finds all child module paths for exclusion during commit analysis.
|
|
29
32
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commit-analyzer.d.ts","sourceRoot":"","sources":["../../src/services/commit-analyzer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"commit-analyzer.d.ts","sourceRoot":"","sources":["../../src/services/commit-analyzer.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AAErD;;;;;;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,CAC7C,GAAG,CAAC,MAAM,EAAE;QAAE,OAAO,EAAE,MAAM,EAAE,CAAC;QAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC,CAC3D;IA+CD;;;;;;OAMG;IACH,OAAO,CAAC,oBAAoB;IA2B5B;;;;;;OAMG;IACH,OAAO,CAAC,WAAW;CAUpB"}
|
|
@@ -23,7 +23,7 @@ export class CommitAnalyzer {
|
|
|
23
23
|
/**
|
|
24
24
|
* Analyzes commits since the last release for all modules.
|
|
25
25
|
*
|
|
26
|
-
* @returns Map of module ID to array of {@link
|
|
26
|
+
* @returns Map of module ID to array of {@link Commit} objects
|
|
27
27
|
* @throws {Error} If git operations fail
|
|
28
28
|
*/
|
|
29
29
|
async analyzeCommitsSinceLastRelease() {
|
|
@@ -35,16 +35,16 @@ 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, lastTag } = await getCommitsSinceLastTag(projectInfo, { cwd: this.repoRoot }, childModulePaths);
|
|
39
39
|
// Store commits for this module
|
|
40
|
-
moduleCommits.set(projectId, commits);
|
|
40
|
+
moduleCommits.set(projectId, { commits, lastTag });
|
|
41
41
|
// Log exclusions for debugging
|
|
42
42
|
if (childModulePaths.length > 0) {
|
|
43
43
|
logger.debug(`🔍 Module ${projectInfo.id} excludes ${childModulePaths.length} child module(s): ${childModulePaths.join(", ")}`);
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
// Calculate and log summary statistics
|
|
47
|
-
const totalCommits = Array.from(moduleCommits.values()).reduce((sum,
|
|
47
|
+
const totalCommits = Array.from(moduleCommits.values()).reduce((sum, info) => sum + info.commits.length, 0);
|
|
48
48
|
logger.info(`📊 Analyzed ${totalCommits} commits across ${moduleCommits.size} modules`);
|
|
49
49
|
return moduleCommits;
|
|
50
50
|
}
|
|
@@ -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
|
/**
|
|
@@ -6,10 +6,10 @@
|
|
|
6
6
|
import { Config } from "../config/index.js";
|
|
7
7
|
import { ModuleRegistry } from "./module-registry.js";
|
|
8
8
|
import { BumpType } from "../semver/index.js";
|
|
9
|
-
import { CommitInfo } from "../git/index.js";
|
|
10
9
|
import { SemVer } from "semver";
|
|
11
10
|
import { AdapterMetadata } from "./adapter-identifier.js";
|
|
12
11
|
import { Module } from "../adapters/project-information.js";
|
|
12
|
+
import { Commit } from "conventional-commits-parser";
|
|
13
13
|
/**
|
|
14
14
|
* Configuration options for the version bumper service.
|
|
15
15
|
*/
|
|
@@ -75,7 +75,10 @@ export declare class VersionBumper {
|
|
|
75
75
|
* @returns Promise resolving to array of processed module changes (only modules that need updates)
|
|
76
76
|
* @throws {Error} If git operations fail
|
|
77
77
|
*/
|
|
78
|
-
calculateVersionBumps(moduleCommits: Map<string,
|
|
78
|
+
calculateVersionBumps(moduleCommits: Map<string, {
|
|
79
|
+
commits: Commit[];
|
|
80
|
+
lastTag: string | null;
|
|
81
|
+
}>): Promise<ProcessedModuleChange[]>;
|
|
79
82
|
/**
|
|
80
83
|
* Calculates initial version bump types for all modules based on commits.
|
|
81
84
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version-bumper.d.ts","sourceRoot":"","sources":["../../src/services/version-bumper.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,MAAM,EAAyB,MAAM,oBAAoB,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,OAAO,EAOL,QAAQ,EACT,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"version-bumper.d.ts","sourceRoot":"","sources":["../../src/services/version-bumper.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,MAAM,EAAyB,MAAM,oBAAoB,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,OAAO,EAOL,QAAQ,EACT,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE1D,OAAO,EAAE,MAAM,EAAE,MAAM,oCAAoC,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AAErD;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC,qEAAqE;IACrE,cAAc,EAAE,OAAO,CAAC;IACxB,wEAAwE;IACxE,aAAa,EAAE,OAAO,CAAC;IACvB,8DAA8D;IAC9D,gBAAgB,EAAE,OAAO,CAAC;IAC1B,8DAA8D;IAC9D,cAAc,EAAE,OAAO,CAAC;IACxB,gEAAgE;IAChE,OAAO,EAAE,eAAe,CAAC;IACzB,+DAA+D;IAC/D,iBAAiB,EAAE,OAAO,CAAC;IAC3B,gEAAgE;IAChE,YAAY,EAAE,MAAM,CAAC;IACrB,sDAAsD;IACtD,QAAQ,EAAE,MAAM,CAAC;IACjB,6DAA6D;IAC7D,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAsBF;;;GAGG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC,iDAAiD;IACjD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,gDAAgD;IAChD,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,wFAAwF;IACxF,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,sEAAsE;IACtE,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,iCAAiC;IACjC,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;CAC/B,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,YAAY,GACpB,SAAS,GACT,YAAY,GACZ,SAAS,GACT,sBAAsB,GACtB,gBAAgB,GAChB,iBAAiB,CAAC;AAEtB;;;;GAIG;AACH,qBAAa,aAAa;IAOtB,OAAO,CAAC,QAAQ,CAAC,cAAc;IAC/B,OAAO,CAAC,QAAQ,CAAC,OAAO;IAP1B;;;;OAIG;gBAEgB,cAAc,EAAE,cAAc,EAC9B,OAAO,EAAE,oBAAoB;IAGhD;;;;;;;OAOG;IACG,qBAAqB,CACzB,aAAa,EAAE,GAAG,CAAC,MAAM,EAAE;QAAE,OAAO,EAAE,MAAM,EAAE,CAAC;QAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC,GACxE,OAAO,CAAC,qBAAqB,EAAE,CAAC;IAuCnC;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,OAAO,CAAC,qBAAqB;IA6C7B;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,OAAO,CAAC,uBAAuB;IAgG/B;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACH,OAAO,CAAC,wBAAwB;CAgFjC"}
|
|
@@ -82,7 +82,7 @@ export class VersionBumper {
|
|
|
82
82
|
const processingModuleChanges = [];
|
|
83
83
|
// Iterate through ALL modules in the registry
|
|
84
84
|
for (const [projectId, projectInfo] of this.moduleRegistry.getModules()) {
|
|
85
|
-
const commits = moduleCommits.get(projectId) || [];
|
|
85
|
+
const commits = moduleCommits.get(projectId)?.commits || [];
|
|
86
86
|
// Determine bump type from commits only
|
|
87
87
|
// Uses Conventional Commits spec to analyze commit types
|
|
88
88
|
const bumpType = calculateBumpFromCommits(commits, this.options.config);
|
package/dist/utils/commits.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { Commit } from "conventional-commits-parser";
|
|
1
2
|
import { Config } from "../config/index.js";
|
|
2
|
-
import { CommitInfo } from "../git/index.js";
|
|
3
3
|
import { BumpType } from "../semver/index.js";
|
|
4
4
|
/**
|
|
5
5
|
* Calculates the overall semantic version bump type from a collection of commits.
|
|
@@ -8,5 +8,5 @@ import { BumpType } from "../semver/index.js";
|
|
|
8
8
|
* @param config - Configuration containing commit type mappings
|
|
9
9
|
* @returns The highest BumpType required across all commits
|
|
10
10
|
*/
|
|
11
|
-
export declare function calculateBumpFromCommits(commits:
|
|
11
|
+
export declare function calculateBumpFromCommits(commits: Commit[], config: Config): BumpType;
|
|
12
12
|
//# sourceMappingURL=commits.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commits.d.ts","sourceRoot":"","sources":["../../src/utils/commits.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"commits.d.ts","sourceRoot":"","sources":["../../src/utils/commits.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AACrD,OAAO,EAAwB,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAe,MAAM,oBAAoB,CAAC;AAE3D;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,MAAM,EAAE,EACjB,MAAM,EAAE,MAAM,GACb,QAAQ,CAiBV"}
|
package/dist/utils/commits.js
CHANGED
|
@@ -12,7 +12,7 @@ export function calculateBumpFromCommits(commits, config) {
|
|
|
12
12
|
const bumpTypes = [];
|
|
13
13
|
// Analyze each commit and determine its version impact
|
|
14
14
|
for (const commit of commits) {
|
|
15
|
-
const bumpType = getBumpTypeForCommit(commit
|
|
15
|
+
const bumpType = getBumpTypeForCommit(commit, config);
|
|
16
16
|
// Only include commits that require a version bump
|
|
17
17
|
if (bumpType !== "none") {
|
|
18
18
|
bumpTypes.push(bumpType);
|
package/dist/utils/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/utils/version.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/utils/version.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,OAAO,UAAU,CAAC;AAC/B,eAAO,MAAM,YAAY,kBAAkB,CAAC"}
|
package/dist/utils/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@muverse/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Version Engine for Repo Semantic Evolution (Core Library)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -45,6 +45,7 @@
|
|
|
45
45
|
],
|
|
46
46
|
"types": "dist/index.d.ts",
|
|
47
47
|
"dependencies": {
|
|
48
|
+
"conventional-changelog-writer": "^8.2.0",
|
|
48
49
|
"conventional-commits-parser": "^6.2.1",
|
|
49
50
|
"cosmiconfig": "^9.0.0",
|
|
50
51
|
"deepmerge": "^4.3.1",
|