@hy-sde-org/dsh-git 0.1.1-rc.2 → 0.1.2-rc.1
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/LICENSE +4 -5
- package/README.md +13 -3
- package/dist/conventional/commit-types-data.d.ts +23 -0
- package/dist/conventional/commit-types-data.d.ts.map +1 -0
- package/dist/conventional/commit-types-data.js +437 -0
- package/dist/conventional/commit-types-data.js.map +1 -0
- package/dist/conventional/commit-types.d.ts +63 -0
- package/dist/conventional/commit-types.d.ts.map +1 -0
- package/dist/conventional/commit-types.js +236 -0
- package/dist/conventional/commit-types.js.map +1 -0
- package/dist/conventional/index.d.ts +19 -0
- package/dist/conventional/index.d.ts.map +1 -0
- package/dist/conventional/index.js +19 -0
- package/dist/conventional/index.js.map +1 -0
- package/dist/conventional/normalization.d.ts +59 -0
- package/dist/conventional/normalization.d.ts.map +1 -0
- package/dist/conventional/normalization.js +355 -0
- package/dist/conventional/normalization.js.map +1 -0
- package/dist/conventional/text.d.ts +20 -0
- package/dist/conventional/text.d.ts.map +1 -0
- package/dist/conventional/text.js +51 -0
- package/dist/conventional/text.js.map +1 -0
- package/dist/conventional/types.d.ts +35 -0
- package/dist/conventional/types.d.ts.map +1 -0
- package/dist/conventional/types.js +8 -0
- package/dist/conventional/types.js.map +1 -0
- package/dist/conventional/validation-data.d.ts +22 -0
- package/dist/conventional/validation-data.d.ts.map +1 -0
- package/dist/conventional/validation-data.js +2543 -0
- package/dist/conventional/validation-data.js.map +1 -0
- package/dist/conventional/validation.d.ts +89 -0
- package/dist/conventional/validation.d.ts.map +1 -0
- package/dist/conventional/validation.js +343 -0
- package/dist/conventional/validation.js.map +1 -0
- package/dist/diff.d.ts +1 -1
- package/dist/diff.d.ts.map +1 -1
- package/dist/diff.js +18 -5
- package/dist/diff.js.map +1 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/dist/repo-lock.d.ts +26 -0
- package/dist/repo-lock.d.ts.map +1 -0
- package/dist/repo-lock.js +53 -0
- package/dist/repo-lock.js.map +1 -0
- package/dist/service.d.ts +10 -3
- package/dist/service.d.ts.map +1 -1
- package/dist/service.js +27 -14
- package/dist/service.js.map +1 -1
- package/dist/types.d.ts +2 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +1 -1
- package/dist/vcs.d.ts +149 -0
- package/dist/vcs.d.ts.map +1 -0
- package/dist/vcs.js +209 -0
- package/dist/vcs.js.map +1 -0
- package/dist/worktree.d.ts +269 -0
- package/dist/worktree.d.ts.map +1 -0
- package/dist/worktree.js +642 -0
- package/dist/worktree.js.map +1 -0
- package/examples/agent-preset/agent.cordis.yml +1 -1
- package/examples/agent-preset/preset.yml +1 -1
- package/package.json +30 -11
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Conventional-commit type vocabulary and coercion.
|
|
3
|
+
* Direct port of omp's `commit/conventional/commit-types.ts`, fed by the
|
|
4
|
+
* verbatim `commit_types.json` resource (see `./commit-types-data.ts`).
|
|
5
|
+
* @module @hy-sde-org/dsh-git/conventional/commit-types
|
|
6
|
+
*/
|
|
7
|
+
import { COMMIT_TYPES_RESOURCE } from "./commit-types-data.js";
|
|
8
|
+
const isRecord = (value) => typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
9
|
+
const isScalar = (value) => typeof value === 'string' ||
|
|
10
|
+
typeof value === 'number' ||
|
|
11
|
+
typeof value === 'boolean' ||
|
|
12
|
+
typeof value === 'bigint' ||
|
|
13
|
+
typeof value === 'symbol';
|
|
14
|
+
/** Stringify like `String(value)` without object-typed `String(...)` call sites. */
|
|
15
|
+
function toDisplayString(value) {
|
|
16
|
+
if (value === null)
|
|
17
|
+
return 'null';
|
|
18
|
+
if (value === undefined)
|
|
19
|
+
return 'undefined';
|
|
20
|
+
if (isScalar(value))
|
|
21
|
+
return String(value);
|
|
22
|
+
return value.toString();
|
|
23
|
+
}
|
|
24
|
+
/** Conventional commit types in llm-git's canonical classification order. */
|
|
25
|
+
export const COMMIT_TYPE_ORDER = [
|
|
26
|
+
'feat', 'fix', 'refactor', 'docs', 'test', 'chore', 'style', 'perf', 'build', 'ci', 'revert',
|
|
27
|
+
'deps', 'security', 'config', 'ux', 'release', 'hotfix', 'infra', 'init', 'merge', 'hack', 'wip',
|
|
28
|
+
];
|
|
29
|
+
const COMMIT_TYPE_SET = {};
|
|
30
|
+
for (const type of COMMIT_TYPE_ORDER)
|
|
31
|
+
COMMIT_TYPE_SET[type] = true;
|
|
32
|
+
const TYPE_ALIASES = new Map();
|
|
33
|
+
for (const entry of COMMIT_TYPES_RESOURCE.types) {
|
|
34
|
+
if (!isCommitType(entry.name))
|
|
35
|
+
continue;
|
|
36
|
+
for (const alias of entry.aliases)
|
|
37
|
+
TYPE_ALIASES.set(alias.toLowerCase(), entry.name);
|
|
38
|
+
}
|
|
39
|
+
const CHANGELOG_CATEGORY_BY_NAME = {
|
|
40
|
+
'breaking changes': 'Breaking Changes',
|
|
41
|
+
breaking: 'Breaking Changes',
|
|
42
|
+
added: 'Added',
|
|
43
|
+
changed: 'Changed',
|
|
44
|
+
deprecated: 'Deprecated',
|
|
45
|
+
removed: 'Removed',
|
|
46
|
+
fixed: 'Fixed',
|
|
47
|
+
security: 'Security',
|
|
48
|
+
};
|
|
49
|
+
const NULL_SCOPE_MARKERS = { null: true, none: true, 'n/a': true };
|
|
50
|
+
/**
|
|
51
|
+
* Return whether a string is an accepted conventional commit type.
|
|
52
|
+
* @param value - any candidate type string.
|
|
53
|
+
* @returns true when `value` is one of the 22 canonical types.
|
|
54
|
+
*/
|
|
55
|
+
export function isCommitType(value) {
|
|
56
|
+
return COMMIT_TYPE_SET[value] === true;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Resolve a canonical commit type or configured alias.
|
|
60
|
+
* @param raw - a type, alias, or mixed-case type name.
|
|
61
|
+
* @returns the canonical type, or `undefined` when unresolvable.
|
|
62
|
+
*/
|
|
63
|
+
export function canonicalCommitType(raw) {
|
|
64
|
+
const normalized = raw.trim().toLowerCase();
|
|
65
|
+
if (isCommitType(normalized))
|
|
66
|
+
return normalized;
|
|
67
|
+
return TYPE_ALIASES.get(normalized);
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Resolve a model-emitted type, falling back to `chore` when unknown.
|
|
71
|
+
* @param raw - a type, alias, or mixed-case type name.
|
|
72
|
+
* @returns the canonical type (never `undefined`).
|
|
73
|
+
*/
|
|
74
|
+
export function coerceCommitType(raw) {
|
|
75
|
+
return canonicalCommitType(raw) ?? 'chore';
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Resolve a model-emitted scope using llm-git's lossy two-segment normalization.
|
|
79
|
+
* @param raw - raw scope string or value.
|
|
80
|
+
* @returns the normalized scope, or `null` when empty/`none`/`n/a`.
|
|
81
|
+
*/
|
|
82
|
+
export function coerceOptionalScope(raw) {
|
|
83
|
+
if (raw === null || raw === undefined)
|
|
84
|
+
return null;
|
|
85
|
+
const trimmed = toDisplayString(raw).trim();
|
|
86
|
+
if (!trimmed || NULL_SCOPE_MARKERS[trimmed.toLowerCase()])
|
|
87
|
+
return null;
|
|
88
|
+
const segments = [];
|
|
89
|
+
for (const segment of trimmed.replaceAll('\\', '/').toLowerCase().split('/')) {
|
|
90
|
+
const cleaned = sanitizeScopeSegment(segment);
|
|
91
|
+
if (cleaned)
|
|
92
|
+
segments.push(cleaned);
|
|
93
|
+
if (segments.length === 2)
|
|
94
|
+
break;
|
|
95
|
+
}
|
|
96
|
+
return segments.length > 0 ? segments.join('/') : null;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Render the configured commit-type vocabulary (for analysis prompts).
|
|
100
|
+
* @returns one `- type: description (hint)` line per type, then the classifier hint.
|
|
101
|
+
*/
|
|
102
|
+
export function formatTypesDescription() {
|
|
103
|
+
const lines = [];
|
|
104
|
+
for (const entry of COMMIT_TYPES_RESOURCE.types) {
|
|
105
|
+
if (!isCommitType(entry.name))
|
|
106
|
+
continue;
|
|
107
|
+
let line = `- ${entry.name}: ${entry.description}`.trimEnd();
|
|
108
|
+
if (entry.hint)
|
|
109
|
+
line += ` (${entry.hint})`;
|
|
110
|
+
lines.push(line);
|
|
111
|
+
}
|
|
112
|
+
const classifierHint = COMMIT_TYPES_RESOURCE.classifier_hint.trim();
|
|
113
|
+
if (classifierHint)
|
|
114
|
+
lines.push(classifierHint);
|
|
115
|
+
return lines.join('\n');
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Normalize raw model analysis into the conventional commit domain.
|
|
119
|
+
* @param input - the raw analysis (`type`, optional `scope`/`summary`/`details`/`issueRefs`).
|
|
120
|
+
* @returns the normalized {@link ConventionalAnalysis}.
|
|
121
|
+
*/
|
|
122
|
+
export function conventionalAnalysis(input) {
|
|
123
|
+
const type = canonicalCommitType(input.type);
|
|
124
|
+
if (!type)
|
|
125
|
+
throw new Error(`Invalid commit type: ${input.type}`);
|
|
126
|
+
const summaryValue = typeof input.summary === 'string' ? input.summary : undefined;
|
|
127
|
+
return {
|
|
128
|
+
type,
|
|
129
|
+
scope: coerceOptionalScope(input.scope),
|
|
130
|
+
...(summaryValue !== undefined ? { summary: summaryValue } : {}),
|
|
131
|
+
details: normalizeDetails(input.details),
|
|
132
|
+
issueRefs: stringsFrom(input.issueRefs),
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Build a normalized conventional commit value.
|
|
137
|
+
* @param input - a raw commit (`type`, optional `scope`/`body`/`footers`, required `summary`).
|
|
138
|
+
* @returns the normalized {@link ConventionalCommit}.
|
|
139
|
+
*/
|
|
140
|
+
export function conventionalCommit(input) {
|
|
141
|
+
const type = canonicalCommitType(input.type);
|
|
142
|
+
if (!type)
|
|
143
|
+
throw new Error(`Invalid commit type: ${input.type}`);
|
|
144
|
+
const scope = coerceOptionalScope(input.scope);
|
|
145
|
+
if (!input.summary.trim())
|
|
146
|
+
throw new Error('Commit summary cannot be empty');
|
|
147
|
+
return {
|
|
148
|
+
type,
|
|
149
|
+
scope,
|
|
150
|
+
summary: input.summary,
|
|
151
|
+
body: [...(input.body ?? [])],
|
|
152
|
+
footers: [...(input.footers ?? [])],
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
function sanitizeScopeSegment(segment) {
|
|
156
|
+
const out = [];
|
|
157
|
+
let lastWasSeparator = false;
|
|
158
|
+
for (const char of segment.trim()) {
|
|
159
|
+
if (/^[a-z0-9]$/.test(char)) {
|
|
160
|
+
out.push(char);
|
|
161
|
+
lastWasSeparator = false;
|
|
162
|
+
}
|
|
163
|
+
else if (char === '-' || char === '_') {
|
|
164
|
+
if (out.length > 0 && !lastWasSeparator) {
|
|
165
|
+
out.push(char);
|
|
166
|
+
lastWasSeparator = true;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
else if ((/\s/.test(char) || char === '.') && out.length > 0 && !lastWasSeparator) {
|
|
170
|
+
out.push('-');
|
|
171
|
+
lastWasSeparator = true;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
const cleaned = out.join('').replace(/^[-_]+|[-_]+$/g, '');
|
|
175
|
+
return cleaned || null;
|
|
176
|
+
}
|
|
177
|
+
function normalizeDetails(value) {
|
|
178
|
+
const values = Array.isArray(value) ? value : typeof value === 'string' ? [value] : [];
|
|
179
|
+
const details = [];
|
|
180
|
+
for (const item of values) {
|
|
181
|
+
if (typeof item === 'string') {
|
|
182
|
+
if (item)
|
|
183
|
+
details.push({ text: item, userVisible: false });
|
|
184
|
+
continue;
|
|
185
|
+
}
|
|
186
|
+
if (!isRecord(item) || item.text === null || item.text === undefined)
|
|
187
|
+
continue;
|
|
188
|
+
const text = toDisplayString(item.text);
|
|
189
|
+
if (!text)
|
|
190
|
+
continue;
|
|
191
|
+
const category = typeof item.changelog_category === 'string' ? changelogCategory(item.changelog_category) : undefined;
|
|
192
|
+
const userVisible = typeof item.user_visible === 'boolean' ? item.user_visible : false;
|
|
193
|
+
details.push(userVisible && category !== undefined
|
|
194
|
+
? { text, changelogCategory: category, userVisible }
|
|
195
|
+
: { text, userVisible });
|
|
196
|
+
}
|
|
197
|
+
return details;
|
|
198
|
+
}
|
|
199
|
+
function changelogCategory(raw) {
|
|
200
|
+
const category = CHANGELOG_CATEGORY_BY_NAME[raw.trim().toLowerCase()];
|
|
201
|
+
if (!category)
|
|
202
|
+
throw new Error(`Unknown changelog category: ${raw}`);
|
|
203
|
+
return category;
|
|
204
|
+
}
|
|
205
|
+
function stringsFrom(value) {
|
|
206
|
+
if (value === null || value === undefined)
|
|
207
|
+
return [];
|
|
208
|
+
if (typeof value === 'string') {
|
|
209
|
+
const trimmed = value.trim();
|
|
210
|
+
if (trimmed.startsWith('[')) {
|
|
211
|
+
try {
|
|
212
|
+
return stringsFrom(JSON.parse(trimmed));
|
|
213
|
+
}
|
|
214
|
+
catch {
|
|
215
|
+
// not JSON — fall through to line splitting
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
return value
|
|
219
|
+
.split(/\r?\n/)
|
|
220
|
+
.map(line => line.trim())
|
|
221
|
+
.filter(Boolean);
|
|
222
|
+
}
|
|
223
|
+
if (Array.isArray(value))
|
|
224
|
+
return value.flatMap(stringsFrom);
|
|
225
|
+
if (isRecord(value)) {
|
|
226
|
+
const strings = [];
|
|
227
|
+
for (const key in value) {
|
|
228
|
+
const inner = value[key];
|
|
229
|
+
const innerValues = stringsFrom(inner);
|
|
230
|
+
strings.push(...(innerValues.length === 0 ? [key] : innerValues.map(item => `${key}: ${item}`)));
|
|
231
|
+
}
|
|
232
|
+
return strings;
|
|
233
|
+
}
|
|
234
|
+
return [toDisplayString(value)];
|
|
235
|
+
}
|
|
236
|
+
//# sourceMappingURL=commit-types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commit-types.js","sourceRoot":"","sources":["../../src/conventional/commit-types.ts"],"names":[],"mappings":"AA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AAC,GAAG,CAAC,WAAW,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,GAAG,KAAK,IAAI,EAAE,CAAC,CAAC,CAAC,CAAA;QAClG,CAAC;QACD,OAAO,OAAO,CAAA;IAChB,CAAC;IACD,OAAO,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,CAAA;AACjC,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Conventional-commit vocabulary, normalization, and validation.
|
|
3
|
+
* TS port of omp's unified `commit/conventional/` service's deterministic
|
|
4
|
+
* surface — the vocabulary (`commit-types`), Unicode/message normalization
|
|
5
|
+
* (`normalization`, `text`), and the llm-git validation rules (`validation`)
|
|
6
|
+
* with their data tables (`*-data`). The LLM-generation halves (inference,
|
|
7
|
+
* map-reduce, prompt rendering, cache) are not ported: the fork's commit
|
|
8
|
+
* tools author the plan between two tool calls instead of running a hidden
|
|
9
|
+
* model session.
|
|
10
|
+
* @module @hy-sde-org/dsh-git/conventional
|
|
11
|
+
*/
|
|
12
|
+
export * from './types.ts';
|
|
13
|
+
export * from './commit-types.ts';
|
|
14
|
+
export * from './commit-types-data.ts';
|
|
15
|
+
export * from './normalization.ts';
|
|
16
|
+
export * from './text.ts';
|
|
17
|
+
export * from './validation.ts';
|
|
18
|
+
export * from './validation-data.ts';
|
|
19
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/conventional/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,cAAc,YAAY,CAAA;AAC1B,cAAc,mBAAmB,CAAA;AACjC,cAAc,wBAAwB,CAAA;AACtC,cAAc,oBAAoB,CAAA;AAClC,cAAc,WAAW,CAAA;AACzB,cAAc,iBAAiB,CAAA;AAC/B,cAAc,sBAAsB,CAAA"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Conventional-commit vocabulary, normalization, and validation.
|
|
3
|
+
* TS port of omp's unified `commit/conventional/` service's deterministic
|
|
4
|
+
* surface — the vocabulary (`commit-types`), Unicode/message normalization
|
|
5
|
+
* (`normalization`, `text`), and the llm-git validation rules (`validation`)
|
|
6
|
+
* with their data tables (`*-data`). The LLM-generation halves (inference,
|
|
7
|
+
* map-reduce, prompt rendering, cache) are not ported: the fork's commit
|
|
8
|
+
* tools author the plan between two tool calls instead of running a hidden
|
|
9
|
+
* model session.
|
|
10
|
+
* @module @hy-sde-org/dsh-git/conventional
|
|
11
|
+
*/
|
|
12
|
+
export * from "./types.js";
|
|
13
|
+
export * from "./commit-types.js";
|
|
14
|
+
export * from "./commit-types-data.js";
|
|
15
|
+
export * from "./normalization.js";
|
|
16
|
+
export * from "./text.js";
|
|
17
|
+
export * from "./validation.js";
|
|
18
|
+
export * from "./validation-data.js";
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/conventional/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,cAAc,YAAY,CAAA;AAC1B,cAAc,mBAAmB,CAAA;AACjC,cAAc,wBAAwB,CAAA;AACtC,cAAc,oBAAoB,CAAA;AAClC,cAAc,WAAW,CAAA;AACzB,cAAc,iBAAiB,CAAA;AAC/B,cAAc,sBAAsB,CAAA"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Conventional-commit message normalization.
|
|
3
|
+
* Direct port of omp's `commit/conventional/normalization.ts`, reduced to the
|
|
4
|
+
* deterministic parts (Unicode normalization, summary verb repair, body
|
|
5
|
+
* cleanup, final formatting) — the token-estimation detail capping uses a
|
|
6
|
+
* configurable budget so it works with or without an LLM pipeline.
|
|
7
|
+
* @module @hy-sde-org/dsh-git/conventional/normalization
|
|
8
|
+
*/
|
|
9
|
+
import type { ConventionalCommit } from './types.ts';
|
|
10
|
+
/** Runtime limits consumed by normalization/validation (llm-git thresholds). */
|
|
11
|
+
export interface ConventionalConfig {
|
|
12
|
+
readonly summaryGuideline: number;
|
|
13
|
+
readonly summarySoftLimit: number;
|
|
14
|
+
readonly summaryHardLimit: number;
|
|
15
|
+
readonly maxDetailTokens: number;
|
|
16
|
+
}
|
|
17
|
+
/** llm-git's standard standard limits, in effect when callers pass `undefined`. */
|
|
18
|
+
export declare const DEFAULT_CONVENTIONAL_CONFIG: ConventionalConfig;
|
|
19
|
+
/**
|
|
20
|
+
* Normalize Unicode punctuation, symbols, fractions, arrows, and spaces.
|
|
21
|
+
* @param text - raw summary/body text.
|
|
22
|
+
* @returns the cleaned ASCII-oriented text.
|
|
23
|
+
*/
|
|
24
|
+
export declare function normalizeCommitUnicode(text: string): string;
|
|
25
|
+
/**
|
|
26
|
+
* Estimate tokens with llm-git's four-UTF-8-bytes rule.
|
|
27
|
+
* @param text - the string to estimate.
|
|
28
|
+
* @returns the estimated token count.
|
|
29
|
+
*/
|
|
30
|
+
export declare function estimateCommitTokens(text: string): number;
|
|
31
|
+
/**
|
|
32
|
+
* Keep the highest-priority details inside the configured token budget.
|
|
33
|
+
* Priority: security/breaking/perf/bug/API keywords, then by length. MUTATES
|
|
34
|
+
* `details` in place (llm-git `cap_commit_details`).
|
|
35
|
+
* @param details - the details array to cap (mutated in place).
|
|
36
|
+
* @param maxTokens - the token budget to respect.
|
|
37
|
+
*/
|
|
38
|
+
export declare function capCommitDetails(details: string[], maxTokens: number): void;
|
|
39
|
+
/**
|
|
40
|
+
* Convert a known leading present-tense summary verb to past tense.
|
|
41
|
+
* @param summary - the summary line to repair.
|
|
42
|
+
* @param commitType - the commit type (drives `refactor` → `restructured`).
|
|
43
|
+
* @returns the repaired summary (unchanged when no repair applies).
|
|
44
|
+
*/
|
|
45
|
+
export declare function normalizeSummaryVerb(summary: string, commitType: string): string;
|
|
46
|
+
/**
|
|
47
|
+
* Normalize summary, body, and footers before final validation.
|
|
48
|
+
* @param message - the raw conventional commit to normalize.
|
|
49
|
+
* @param config - optional limits (defaults to {@link DEFAULT_CONVENTIONAL_CONFIG}).
|
|
50
|
+
* @returns the normalized message (summary verb-repaired, body bulleted).
|
|
51
|
+
*/
|
|
52
|
+
export declare function postProcessCommitMessage(message: ConventionalCommit, config?: ConventionalConfig): ConventionalCommit;
|
|
53
|
+
/**
|
|
54
|
+
* Format a normalized conventional commit as Git commit-message text.
|
|
55
|
+
* @param message - the normalized commit.
|
|
56
|
+
* @returns the rendered commit-message body.
|
|
57
|
+
*/
|
|
58
|
+
export declare function formatConventionalCommit(message: ConventionalCommit): string;
|
|
59
|
+
//# sourceMappingURL=normalization.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalization.d.ts","sourceRoot":"","sources":["../../src/conventional/normalization.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAGpD,gFAAgF;AAChF,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAA;IACjC,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAA;IACjC,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAA;IACjC,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAA;CACjC;AAED,mFAAmF;AACnF,eAAO,MAAM,2BAA2B,EAAE,kBAKzC,CAAA;AAwHD;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE3D;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEzD;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI,CAkC3E;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CA6BhF;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,kBAAkB,EAC3B,MAAM,GAAE,kBAAgD,GACvD,kBAAkB,CAwCpB;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,kBAAkB,GAAG,MAAM,CAM5E"}
|