openspec-stat 1.3.4 → 1.4.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/README.md +2 -1
- package/README.zh-CN.md +2 -1
- package/dist/esm/branch-selector.js +87 -214
- package/dist/esm/cli.js +14 -64
- package/dist/esm/commands/init.js +17 -44
- package/dist/esm/commands/multi.js +123 -180
- package/dist/esm/commands/single.js +143 -152
- package/dist/esm/config.js +22 -64
- package/dist/esm/formatters.js +285 -520
- package/dist/esm/git-analyzer.js +116 -354
- package/dist/esm/i18n/index.js +22 -10
- package/dist/esm/i18n/locales/en.json +43 -43
- package/dist/esm/i18n/locales/zh-CN.json +43 -43
- package/dist/esm/multi/config-validator.d.ts +1 -1
- package/dist/esm/multi/config-validator.js +25 -26
- package/dist/esm/multi/config-wizard.js +217 -459
- package/dist/esm/multi/multi-repo-analyzer.d.ts +11 -1
- package/dist/esm/multi/multi-repo-analyzer.js +228 -426
- package/dist/esm/stats-aggregator.js +115 -193
- package/dist/esm/time-utils.js +11 -17
- package/dist/esm/ui/spinner.d.ts +12 -0
- package/dist/esm/ui/spinner.js +38 -0
- package/package.json +21 -7
- package/dist/cjs/branch-selector.d.ts +0 -7
- package/dist/cjs/branch-selector.js +0 -128
- package/dist/cjs/cli.d.ts +0 -2
- package/dist/cjs/cli.js +0 -19
- package/dist/cjs/commands/init.d.ts +0 -7
- package/dist/cjs/commands/init.js +0 -58
- package/dist/cjs/commands/multi.d.ts +0 -16
- package/dist/cjs/commands/multi.js +0 -172
- package/dist/cjs/commands/single.d.ts +0 -2
- package/dist/cjs/commands/single.js +0 -148
- package/dist/cjs/config.d.ts +0 -3
- package/dist/cjs/config.js +0 -66
- package/dist/cjs/formatters.d.ts +0 -7
- package/dist/cjs/formatters.js +0 -482
- package/dist/cjs/git-analyzer.d.ts +0 -11
- package/dist/cjs/git-analyzer.js +0 -165
- package/dist/cjs/i18n/index.d.ts +0 -7
- package/dist/cjs/i18n/index.js +0 -84
- package/dist/cjs/i18n/locales/en.json +0 -154
- package/dist/cjs/i18n/locales/zh-CN.json +0 -154
- package/dist/cjs/index.d.ts +0 -6
- package/dist/cjs/index.js +0 -50
- package/dist/cjs/multi/config-validator.d.ts +0 -3
- package/dist/cjs/multi/config-validator.js +0 -130
- package/dist/cjs/multi/config-wizard.d.ts +0 -50
- package/dist/cjs/multi/config-wizard.js +0 -331
- package/dist/cjs/multi/multi-repo-analyzer.d.ts +0 -14
- package/dist/cjs/multi/multi-repo-analyzer.js +0 -210
- package/dist/cjs/stats-aggregator.d.ts +0 -7
- package/dist/cjs/stats-aggregator.js +0 -155
- package/dist/cjs/time-utils.d.ts +0 -6
- package/dist/cjs/time-utils.js +0 -55
- package/dist/cjs/types.d.ts +0 -136
- package/dist/cjs/types.js +0 -17
package/dist/esm/formatters.js
CHANGED
|
@@ -1,554 +1,319 @@
|
|
|
1
|
-
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
-
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
3
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
4
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
5
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
6
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
7
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
8
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
9
|
-
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
10
1
|
import Table from 'cli-table3';
|
|
11
2
|
import chalk from 'chalk';
|
|
12
3
|
import { t } from "./i18n/index.js";
|
|
13
|
-
export
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
})
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
4
|
+
export class OutputFormatter {
|
|
5
|
+
formatTable(result, verbose = false, showContributors = true) {
|
|
6
|
+
let output = '';
|
|
7
|
+
output += chalk.bold(t('output.title'));
|
|
8
|
+
output += chalk.gray(t('output.timeRange', {
|
|
9
|
+
since: result.timeRange.since.toLocaleString('zh-CN', {
|
|
10
|
+
hour12: false
|
|
11
|
+
}),
|
|
12
|
+
until: result.timeRange.until.toLocaleString('zh-CN', {
|
|
13
|
+
hour12: false
|
|
14
|
+
})
|
|
15
|
+
}));
|
|
16
|
+
output += chalk.gray(t('output.branches', {
|
|
17
|
+
branches: result.branches.join(', ')
|
|
18
|
+
}));
|
|
19
|
+
output += chalk.gray(t('output.totalCommits', {
|
|
20
|
+
count: String(result.totalCommits)
|
|
21
|
+
}));
|
|
22
|
+
|
|
23
|
+
// Proposal Summary Table
|
|
24
|
+
if (result.proposals.size > 0) {
|
|
25
|
+
output += chalk.bold.magenta(`\n${t('output.proposalSummary')}\n`);
|
|
26
|
+
const proposalTable = new Table({
|
|
27
|
+
head: [chalk.magenta(t('table.proposal')), chalk.magenta(t('table.commits')), chalk.magenta(t('table.contributors')), chalk.magenta(t('table.codeFiles')), chalk.magenta(t('table.additions')), chalk.magenta(t('table.deletions')), chalk.magenta(t('table.netChanges'))],
|
|
28
|
+
style: {
|
|
29
|
+
head: [],
|
|
30
|
+
border: []
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
const sortedProposals = Array.from(result.proposals.values()).sort((a, b) => b.netChanges - a.netChanges);
|
|
34
|
+
for (const proposalStats of sortedProposals) {
|
|
35
|
+
const contributors = Array.from(proposalStats.contributors).join(', ');
|
|
36
|
+
const proposalName = proposalStats.multiProposalCommits > 0 ? `${proposalStats.proposal} ${chalk.yellow('!')}` : proposalStats.proposal;
|
|
37
|
+
proposalTable.push([proposalName, proposalStats.commits.toString(), contributors, proposalStats.codeFilesChanged.toString(), chalk.green(`+${proposalStats.additions}`), chalk.red(`-${proposalStats.deletions}`), proposalStats.netChanges >= 0 ? chalk.green(`+${proposalStats.netChanges}`) : chalk.red(`${proposalStats.netChanges}`)]);
|
|
38
|
+
}
|
|
39
|
+
output += proposalTable.toString() + '\n';
|
|
40
|
+
const hasMultiProposalCommits = Array.from(result.proposals.values()).some(p => p.multiProposalCommits > 0);
|
|
41
|
+
if (hasMultiProposalCommits) {
|
|
42
|
+
output += chalk.yellow(`\n${t('output.multiProposalWarning')}\n`);
|
|
43
|
+
const affectedProposals = Array.from(result.proposals.values()).filter(p => p.multiProposalCommits > 0).map(p => ` • ${p.proposal}: ${p.multiProposalCommits}/${p.commits} commits ${t('output.sharedWithOthers')}`).join('\n');
|
|
44
|
+
output += chalk.gray(affectedProposals + '\n');
|
|
45
|
+
}
|
|
38
46
|
|
|
39
|
-
// Proposal
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
47
|
+
// Proposal summary totals
|
|
48
|
+
const totalProposals = result.proposals.size;
|
|
49
|
+
const totalProposalCommits = Array.from(result.proposals.values()).reduce((sum, p) => sum + p.commits, 0);
|
|
50
|
+
const totalProposalFiles = Array.from(result.proposals.values()).reduce((sum, p) => sum + p.codeFilesChanged, 0);
|
|
51
|
+
const totalProposalAdditions = Array.from(result.proposals.values()).reduce((sum, p) => sum + p.additions, 0);
|
|
52
|
+
const totalProposalDeletions = Array.from(result.proposals.values()).reduce((sum, p) => sum + p.deletions, 0);
|
|
53
|
+
const totalProposalNetChanges = Array.from(result.proposals.values()).reduce((sum, p) => sum + p.netChanges, 0);
|
|
54
|
+
output += chalk.cyan('─'.repeat(80)) + '\n';
|
|
55
|
+
output += chalk.bold.cyan(t('output.proposalTotal', {
|
|
56
|
+
count: totalProposals.toString(),
|
|
57
|
+
commits: totalProposalCommits.toString(),
|
|
58
|
+
files: totalProposalFiles.toString(),
|
|
59
|
+
additions: totalProposalAdditions.toString(),
|
|
60
|
+
deletions: totalProposalDeletions.toString(),
|
|
61
|
+
netChanges: totalProposalNetChanges.toString()
|
|
62
|
+
}));
|
|
63
|
+
output += chalk.cyan('─'.repeat(80)) + '\n';
|
|
64
|
+
}
|
|
65
|
+
output += chalk.bold.cyan(`\n${t('output.authorSummary')}\n`);
|
|
66
|
+
const sortedAuthors = Array.from(result.authors.values()).sort((a, b) => b.commits - a.commits);
|
|
67
|
+
if (!showContributors) {
|
|
68
|
+
// Show only summary when showContributors is false
|
|
69
|
+
const totalAuthors = sortedAuthors.length;
|
|
70
|
+
const totalCommits = sortedAuthors.reduce((sum, s) => sum + s.commits, 0);
|
|
71
|
+
const totalProposalsSet = new Set();
|
|
72
|
+
sortedAuthors.forEach(s => s.openspecProposals.forEach(p => totalProposalsSet.add(p)));
|
|
73
|
+
const totalFiles = sortedAuthors.reduce((sum, s) => sum + s.codeFilesChanged, 0);
|
|
74
|
+
const totalAdditions = sortedAuthors.reduce((sum, s) => sum + s.additions, 0);
|
|
75
|
+
const totalDeletions = sortedAuthors.reduce((sum, s) => sum + s.deletions, 0);
|
|
76
|
+
const totalNetChanges = sortedAuthors.reduce((sum, s) => sum + s.netChanges, 0);
|
|
77
|
+
const summaryTable = new Table({
|
|
78
|
+
head: [chalk.cyan(t('table.contributors')), chalk.cyan(t('table.commits')), chalk.cyan(t('table.proposals')), chalk.cyan(t('table.codeFiles')), chalk.cyan(t('table.additions')), chalk.cyan(t('table.deletions')), chalk.cyan(t('table.netChanges'))],
|
|
79
|
+
style: {
|
|
80
|
+
head: [],
|
|
81
|
+
border: []
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
summaryTable.push([totalAuthors.toString(), totalCommits.toString(), totalProposalsSet.size.toString(), totalFiles.toString(), chalk.green(`+${totalAdditions}`), chalk.red(`-${totalDeletions}`), totalNetChanges >= 0 ? chalk.green(`+${totalNetChanges}`) : chalk.red(`${totalNetChanges}`)]);
|
|
85
|
+
output += summaryTable.toString() + '\n';
|
|
86
|
+
output += chalk.gray(t('output.contributorHint')) + '\n';
|
|
87
|
+
return output;
|
|
88
|
+
}
|
|
89
|
+
for (const stats of sortedAuthors) {
|
|
90
|
+
output += chalk.bold.cyan(`\n${stats.author}\n`);
|
|
91
|
+
if (stats.branchStats && stats.branchStats.size > 0) {
|
|
92
|
+
const branchTable = new Table({
|
|
93
|
+
head: [chalk.cyan(t('table.branch')), chalk.cyan(t('table.commits')), chalk.cyan(t('table.proposals')), chalk.cyan(t('table.codeFiles')), chalk.cyan(t('table.additions')), chalk.cyan(t('table.deletions')), chalk.cyan(t('table.netChanges'))],
|
|
44
94
|
style: {
|
|
45
95
|
head: [],
|
|
46
96
|
border: []
|
|
47
97
|
}
|
|
48
98
|
});
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
var _iterator = _createForOfIteratorHelper(sortedProposals),
|
|
53
|
-
_step;
|
|
54
|
-
try {
|
|
55
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
56
|
-
var proposalStats = _step.value;
|
|
57
|
-
var contributors = Array.from(proposalStats.contributors).join(', ');
|
|
58
|
-
var proposalName = proposalStats.multiProposalCommits > 0 ? "".concat(proposalStats.proposal, " ").concat(chalk.yellow('⚠')) : proposalStats.proposal;
|
|
59
|
-
proposalTable.push([proposalName, proposalStats.commits.toString(), contributors, proposalStats.codeFilesChanged.toString(), chalk.green("+".concat(proposalStats.additions)), chalk.red("-".concat(proposalStats.deletions)), proposalStats.netChanges >= 0 ? chalk.green("+".concat(proposalStats.netChanges)) : chalk.red("".concat(proposalStats.netChanges))]);
|
|
60
|
-
}
|
|
61
|
-
} catch (err) {
|
|
62
|
-
_iterator.e(err);
|
|
63
|
-
} finally {
|
|
64
|
-
_iterator.f();
|
|
65
|
-
}
|
|
66
|
-
output += proposalTable.toString() + '\n';
|
|
67
|
-
var hasMultiProposalCommits = Array.from(result.proposals.values()).some(function (p) {
|
|
68
|
-
return p.multiProposalCommits > 0;
|
|
69
|
-
});
|
|
70
|
-
if (hasMultiProposalCommits) {
|
|
71
|
-
output += chalk.yellow("\n\u26A0 ".concat(t('output.multiProposalWarning'), "\n"));
|
|
72
|
-
var affectedProposals = Array.from(result.proposals.values()).filter(function (p) {
|
|
73
|
-
return p.multiProposalCommits > 0;
|
|
74
|
-
}).map(function (p) {
|
|
75
|
-
return " \u2022 ".concat(p.proposal, ": ").concat(p.multiProposalCommits, "/").concat(p.commits, " commits ").concat(t('output.sharedWithOthers'));
|
|
76
|
-
}).join('\n');
|
|
77
|
-
output += chalk.gray(affectedProposals + '\n');
|
|
99
|
+
const sortedBranches = Array.from(stats.branchStats.values()).sort((a, b) => b.commits - a.commits);
|
|
100
|
+
for (const branchStat of sortedBranches) {
|
|
101
|
+
branchTable.push([branchStat.branch, branchStat.commits.toString(), branchStat.openspecProposals.size.toString(), branchStat.codeFilesChanged.toString(), chalk.green(`+${branchStat.additions}`), chalk.red(`-${branchStat.deletions}`), branchStat.netChanges >= 0 ? chalk.green(`+${branchStat.netChanges}`) : chalk.red(`${branchStat.netChanges}`)]);
|
|
78
102
|
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
}, 0);
|
|
85
|
-
var totalProposalFiles = Array.from(result.proposals.values()).reduce(function (sum, p) {
|
|
86
|
-
return sum + p.codeFilesChanged;
|
|
87
|
-
}, 0);
|
|
88
|
-
var totalProposalAdditions = Array.from(result.proposals.values()).reduce(function (sum, p) {
|
|
89
|
-
return sum + p.additions;
|
|
90
|
-
}, 0);
|
|
91
|
-
var totalProposalDeletions = Array.from(result.proposals.values()).reduce(function (sum, p) {
|
|
92
|
-
return sum + p.deletions;
|
|
93
|
-
}, 0);
|
|
94
|
-
var totalProposalNetChanges = Array.from(result.proposals.values()).reduce(function (sum, p) {
|
|
95
|
-
return sum + p.netChanges;
|
|
96
|
-
}, 0);
|
|
97
|
-
output += chalk.cyan('─'.repeat(80)) + '\n';
|
|
98
|
-
output += chalk.bold.cyan(t('output.proposalTotal', {
|
|
99
|
-
count: totalProposals.toString(),
|
|
100
|
-
commits: totalProposalCommits.toString(),
|
|
101
|
-
files: totalProposalFiles.toString(),
|
|
102
|
-
additions: totalProposalAdditions.toString(),
|
|
103
|
-
deletions: totalProposalDeletions.toString(),
|
|
104
|
-
netChanges: totalProposalNetChanges.toString()
|
|
105
|
-
}));
|
|
106
|
-
output += chalk.cyan('─'.repeat(80)) + '\n';
|
|
107
|
-
}
|
|
108
|
-
output += chalk.bold.cyan("\n".concat(t('output.authorSummary'), "\n"));
|
|
109
|
-
var sortedAuthors = Array.from(result.authors.values()).sort(function (a, b) {
|
|
110
|
-
return b.commits - a.commits;
|
|
111
|
-
});
|
|
112
|
-
if (!showContributors) {
|
|
113
|
-
// Show only summary when showContributors is false
|
|
114
|
-
var totalAuthors = sortedAuthors.length;
|
|
115
|
-
var totalCommits = sortedAuthors.reduce(function (sum, s) {
|
|
116
|
-
return sum + s.commits;
|
|
117
|
-
}, 0);
|
|
118
|
-
var totalProposalsSet = new Set();
|
|
119
|
-
sortedAuthors.forEach(function (s) {
|
|
120
|
-
return s.openspecProposals.forEach(function (p) {
|
|
121
|
-
return totalProposalsSet.add(p);
|
|
122
|
-
});
|
|
123
|
-
});
|
|
124
|
-
var totalFiles = sortedAuthors.reduce(function (sum, s) {
|
|
125
|
-
return sum + s.codeFilesChanged;
|
|
126
|
-
}, 0);
|
|
127
|
-
var totalAdditions = sortedAuthors.reduce(function (sum, s) {
|
|
128
|
-
return sum + s.additions;
|
|
129
|
-
}, 0);
|
|
130
|
-
var totalDeletions = sortedAuthors.reduce(function (sum, s) {
|
|
131
|
-
return sum + s.deletions;
|
|
132
|
-
}, 0);
|
|
133
|
-
var totalNetChanges = sortedAuthors.reduce(function (sum, s) {
|
|
134
|
-
return sum + s.netChanges;
|
|
135
|
-
}, 0);
|
|
136
|
-
var summaryTable = new Table({
|
|
137
|
-
head: [chalk.cyan(t('table.contributors')), chalk.cyan(t('table.commits')), chalk.cyan(t('table.proposals')), chalk.cyan(t('table.codeFiles')), chalk.cyan(t('table.additions')), chalk.cyan(t('table.deletions')), chalk.cyan(t('table.netChanges'))],
|
|
103
|
+
branchTable.push([chalk.bold.yellow(t('table.totalDeduplicated')), chalk.bold(stats.commits.toString()), chalk.bold(stats.openspecProposals.size.toString()), chalk.bold(stats.codeFilesChanged.toString()), chalk.bold.green(`+${stats.additions}`), chalk.bold.red(`-${stats.deletions}`), stats.netChanges >= 0 ? chalk.bold.green(`+${stats.netChanges}`) : chalk.bold.red(`${stats.netChanges}`)]);
|
|
104
|
+
output += branchTable.toString() + '\n';
|
|
105
|
+
} else {
|
|
106
|
+
const simpleTable = new Table({
|
|
107
|
+
head: [chalk.cyan(t('table.period')), chalk.cyan(t('table.commits')), chalk.cyan(t('table.proposals')), chalk.cyan(t('table.codeFiles')), chalk.cyan(t('table.additions')), chalk.cyan(t('table.deletions')), chalk.cyan(t('table.netChanges'))],
|
|
138
108
|
style: {
|
|
139
109
|
head: [],
|
|
140
110
|
border: []
|
|
141
111
|
}
|
|
142
112
|
});
|
|
143
|
-
|
|
144
|
-
output +=
|
|
145
|
-
output += chalk.gray(t('output.contributorHint')) + '\n';
|
|
146
|
-
return output;
|
|
113
|
+
simpleTable.push([stats.statisticsPeriod || '-', stats.commits.toString(), stats.openspecProposals.size.toString(), stats.codeFilesChanged.toString(), chalk.green(`+${stats.additions}`), chalk.red(`-${stats.deletions}`), stats.netChanges >= 0 ? chalk.green(`+${stats.netChanges}`) : chalk.red(`${stats.netChanges}`)]);
|
|
114
|
+
output += simpleTable.toString() + '\n';
|
|
147
115
|
}
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
var stats = _step2.value;
|
|
153
|
-
output += chalk.bold.cyan("\n".concat(stats.author, "\n"));
|
|
154
|
-
if (stats.branchStats && stats.branchStats.size > 0) {
|
|
155
|
-
var branchTable = new Table({
|
|
156
|
-
head: [chalk.cyan(t('table.branch')), chalk.cyan(t('table.commits')), chalk.cyan(t('table.proposals')), chalk.cyan(t('table.codeFiles')), chalk.cyan(t('table.additions')), chalk.cyan(t('table.deletions')), chalk.cyan(t('table.netChanges'))],
|
|
157
|
-
style: {
|
|
158
|
-
head: [],
|
|
159
|
-
border: []
|
|
160
|
-
}
|
|
161
|
-
});
|
|
162
|
-
var sortedBranches = Array.from(stats.branchStats.values()).sort(function (a, b) {
|
|
163
|
-
return b.commits - a.commits;
|
|
164
|
-
});
|
|
165
|
-
var _iterator3 = _createForOfIteratorHelper(sortedBranches),
|
|
166
|
-
_step3;
|
|
167
|
-
try {
|
|
168
|
-
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
169
|
-
var branchStat = _step3.value;
|
|
170
|
-
branchTable.push([branchStat.branch, branchStat.commits.toString(), branchStat.openspecProposals.size.toString(), branchStat.codeFilesChanged.toString(), chalk.green("+".concat(branchStat.additions)), chalk.red("-".concat(branchStat.deletions)), branchStat.netChanges >= 0 ? chalk.green("+".concat(branchStat.netChanges)) : chalk.red("".concat(branchStat.netChanges))]);
|
|
171
|
-
}
|
|
172
|
-
} catch (err) {
|
|
173
|
-
_iterator3.e(err);
|
|
174
|
-
} finally {
|
|
175
|
-
_iterator3.f();
|
|
176
|
-
}
|
|
177
|
-
branchTable.push([chalk.bold.yellow(t('table.totalDeduplicated')), chalk.bold(stats.commits.toString()), chalk.bold(stats.openspecProposals.size.toString()), chalk.bold(stats.codeFilesChanged.toString()), chalk.bold.green("+".concat(stats.additions)), chalk.bold.red("-".concat(stats.deletions)), stats.netChanges >= 0 ? chalk.bold.green("+".concat(stats.netChanges)) : chalk.bold.red("".concat(stats.netChanges))]);
|
|
178
|
-
output += branchTable.toString() + '\n';
|
|
179
|
-
} else {
|
|
180
|
-
var simpleTable = new Table({
|
|
181
|
-
head: [chalk.cyan(t('table.period')), chalk.cyan(t('table.commits')), chalk.cyan(t('table.proposals')), chalk.cyan(t('table.codeFiles')), chalk.cyan(t('table.additions')), chalk.cyan(t('table.deletions')), chalk.cyan(t('table.netChanges'))],
|
|
182
|
-
style: {
|
|
183
|
-
head: [],
|
|
184
|
-
border: []
|
|
185
|
-
}
|
|
186
|
-
});
|
|
187
|
-
simpleTable.push([stats.statisticsPeriod || '-', stats.commits.toString(), stats.openspecProposals.size.toString(), stats.codeFilesChanged.toString(), chalk.green("+".concat(stats.additions)), chalk.red("-".concat(stats.deletions)), stats.netChanges >= 0 ? chalk.green("+".concat(stats.netChanges)) : chalk.red("".concat(stats.netChanges))]);
|
|
188
|
-
output += simpleTable.toString() + '\n';
|
|
189
|
-
}
|
|
190
|
-
if (verbose && stats.openspecProposals.size > 0) {
|
|
191
|
-
output += chalk.gray(t('output.proposals', {
|
|
192
|
-
proposals: Array.from(stats.openspecProposals).join(', ')
|
|
193
|
-
}));
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
} catch (err) {
|
|
197
|
-
_iterator2.e(err);
|
|
198
|
-
} finally {
|
|
199
|
-
_iterator2.f();
|
|
116
|
+
if (verbose && stats.openspecProposals.size > 0) {
|
|
117
|
+
output += chalk.gray(t('output.proposals', {
|
|
118
|
+
proposals: Array.from(stats.openspecProposals).join(', ')
|
|
119
|
+
}));
|
|
200
120
|
}
|
|
201
|
-
return output;
|
|
202
121
|
}
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
}, 0),
|
|
236
|
-
totalCodeFiles: Array.from(result.proposals.values()).reduce(function (sum, p) {
|
|
237
|
-
return sum + p.codeFilesChanged;
|
|
238
|
-
}, 0),
|
|
239
|
-
totalAdditions: Array.from(result.proposals.values()).reduce(function (sum, p) {
|
|
240
|
-
return sum + p.additions;
|
|
241
|
-
}, 0),
|
|
242
|
-
totalDeletions: Array.from(result.proposals.values()).reduce(function (sum, p) {
|
|
243
|
-
return sum + p.deletions;
|
|
244
|
-
}, 0),
|
|
245
|
-
totalNetChanges: Array.from(result.proposals.values()).reduce(function (sum, p) {
|
|
246
|
-
return sum + p.netChanges;
|
|
247
|
-
}, 0)
|
|
248
|
-
}
|
|
122
|
+
return output;
|
|
123
|
+
}
|
|
124
|
+
formatJSON(result, showContributors = true) {
|
|
125
|
+
const sortedAuthors = Array.from(result.authors.values());
|
|
126
|
+
const data = {
|
|
127
|
+
timeRange: {
|
|
128
|
+
since: result.timeRange.since.toISOString(),
|
|
129
|
+
until: result.timeRange.until.toISOString()
|
|
130
|
+
},
|
|
131
|
+
branches: result.branches,
|
|
132
|
+
totalCommits: result.totalCommits,
|
|
133
|
+
proposals: {
|
|
134
|
+
items: Array.from(result.proposals.values()).map(stats => ({
|
|
135
|
+
proposal: stats.proposal,
|
|
136
|
+
commits: stats.commits,
|
|
137
|
+
contributors: Array.from(stats.contributors),
|
|
138
|
+
contributorCount: stats.contributors.size,
|
|
139
|
+
codeFilesChanged: stats.codeFilesChanged,
|
|
140
|
+
additions: stats.additions,
|
|
141
|
+
deletions: stats.deletions,
|
|
142
|
+
netChanges: stats.netChanges,
|
|
143
|
+
multiProposalCommits: stats.multiProposalCommits,
|
|
144
|
+
hasSharedCommits: stats.multiProposalCommits > 0,
|
|
145
|
+
sharedCommitHashes: Array.from(stats.sharedCommitHashes)
|
|
146
|
+
})),
|
|
147
|
+
summary: {
|
|
148
|
+
totalProposals: result.proposals.size,
|
|
149
|
+
totalCommits: Array.from(result.proposals.values()).reduce((sum, p) => sum + p.commits, 0),
|
|
150
|
+
totalCodeFiles: Array.from(result.proposals.values()).reduce((sum, p) => sum + p.codeFilesChanged, 0),
|
|
151
|
+
totalAdditions: Array.from(result.proposals.values()).reduce((sum, p) => sum + p.additions, 0),
|
|
152
|
+
totalDeletions: Array.from(result.proposals.values()).reduce((sum, p) => sum + p.deletions, 0),
|
|
153
|
+
totalNetChanges: Array.from(result.proposals.values()).reduce((sum, p) => sum + p.netChanges, 0)
|
|
249
154
|
}
|
|
250
|
-
};
|
|
251
|
-
if (showContributors) {
|
|
252
|
-
data.authors = sortedAuthors.map(function (stats) {
|
|
253
|
-
var _stats$lastCommitDate;
|
|
254
|
-
return {
|
|
255
|
-
author: stats.author,
|
|
256
|
-
commits: stats.commits,
|
|
257
|
-
openspecProposals: Array.from(stats.openspecProposals),
|
|
258
|
-
proposalCount: stats.openspecProposals.size,
|
|
259
|
-
codeFilesChanged: stats.codeFilesChanged,
|
|
260
|
-
additions: stats.additions,
|
|
261
|
-
deletions: stats.deletions,
|
|
262
|
-
netChanges: stats.netChanges,
|
|
263
|
-
lastCommitDate: (_stats$lastCommitDate = stats.lastCommitDate) === null || _stats$lastCommitDate === void 0 ? void 0 : _stats$lastCommitDate.toISOString()
|
|
264
|
-
};
|
|
265
|
-
});
|
|
266
|
-
} else {
|
|
267
|
-
var totalProposalsSet = new Set();
|
|
268
|
-
sortedAuthors.forEach(function (s) {
|
|
269
|
-
return s.openspecProposals.forEach(function (p) {
|
|
270
|
-
return totalProposalsSet.add(p);
|
|
271
|
-
});
|
|
272
|
-
});
|
|
273
|
-
data.authorsSummary = {
|
|
274
|
-
totalContributors: sortedAuthors.length,
|
|
275
|
-
totalCommits: sortedAuthors.reduce(function (sum, s) {
|
|
276
|
-
return sum + s.commits;
|
|
277
|
-
}, 0),
|
|
278
|
-
totalProposals: totalProposalsSet.size,
|
|
279
|
-
totalCodeFiles: sortedAuthors.reduce(function (sum, s) {
|
|
280
|
-
return sum + s.codeFilesChanged;
|
|
281
|
-
}, 0),
|
|
282
|
-
totalAdditions: sortedAuthors.reduce(function (sum, s) {
|
|
283
|
-
return sum + s.additions;
|
|
284
|
-
}, 0),
|
|
285
|
-
totalDeletions: sortedAuthors.reduce(function (sum, s) {
|
|
286
|
-
return sum + s.deletions;
|
|
287
|
-
}, 0),
|
|
288
|
-
totalNetChanges: sortedAuthors.reduce(function (sum, s) {
|
|
289
|
-
return sum + s.netChanges;
|
|
290
|
-
}, 0)
|
|
291
|
-
};
|
|
292
155
|
}
|
|
293
|
-
|
|
156
|
+
};
|
|
157
|
+
if (showContributors) {
|
|
158
|
+
data.authors = sortedAuthors.map(stats => ({
|
|
159
|
+
author: stats.author,
|
|
160
|
+
commits: stats.commits,
|
|
161
|
+
openspecProposals: Array.from(stats.openspecProposals),
|
|
162
|
+
proposalCount: stats.openspecProposals.size,
|
|
163
|
+
codeFilesChanged: stats.codeFilesChanged,
|
|
164
|
+
additions: stats.additions,
|
|
165
|
+
deletions: stats.deletions,
|
|
166
|
+
netChanges: stats.netChanges,
|
|
167
|
+
lastCommitDate: stats.lastCommitDate?.toISOString()
|
|
168
|
+
}));
|
|
169
|
+
} else {
|
|
170
|
+
const totalProposalsSet = new Set();
|
|
171
|
+
sortedAuthors.forEach(s => s.openspecProposals.forEach(p => totalProposalsSet.add(p)));
|
|
172
|
+
data.authorsSummary = {
|
|
173
|
+
totalContributors: sortedAuthors.length,
|
|
174
|
+
totalCommits: sortedAuthors.reduce((sum, s) => sum + s.commits, 0),
|
|
175
|
+
totalProposals: totalProposalsSet.size,
|
|
176
|
+
totalCodeFiles: sortedAuthors.reduce((sum, s) => sum + s.codeFilesChanged, 0),
|
|
177
|
+
totalAdditions: sortedAuthors.reduce((sum, s) => sum + s.additions, 0),
|
|
178
|
+
totalDeletions: sortedAuthors.reduce((sum, s) => sum + s.deletions, 0),
|
|
179
|
+
totalNetChanges: sortedAuthors.reduce((sum, s) => sum + s.netChanges, 0)
|
|
180
|
+
};
|
|
294
181
|
}
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
var rows = [];
|
|
182
|
+
return JSON.stringify(data, null, 2);
|
|
183
|
+
}
|
|
184
|
+
formatCSV(result, showContributors = true) {
|
|
185
|
+
const rows = [];
|
|
300
186
|
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
try {
|
|
310
|
-
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
311
|
-
var _stats = _step4.value;
|
|
312
|
-
var contributors = Array.from(_stats.contributors).join(';');
|
|
313
|
-
rows.push([_stats.proposal, _stats.commits, "\"".concat(contributors, "\""), _stats.codeFilesChanged, _stats.additions, _stats.deletions, _stats.netChanges].join(','));
|
|
314
|
-
}
|
|
187
|
+
// Proposal summary section
|
|
188
|
+
rows.push(`\n# ${t('output.proposalSummary')}`);
|
|
189
|
+
rows.push(`${t('table.proposal')},${t('table.commits')},${t('table.contributors')},${t('table.codeFiles')},${t('table.additions')},${t('table.deletions')},${t('table.netChanges')}`);
|
|
190
|
+
const sortedProposals = Array.from(result.proposals.values()).sort((a, b) => b.netChanges - a.netChanges);
|
|
191
|
+
for (const stats of sortedProposals) {
|
|
192
|
+
const contributors = Array.from(stats.contributors).join(';');
|
|
193
|
+
rows.push([stats.proposal, stats.commits, `"${contributors}"`, stats.codeFilesChanged, stats.additions, stats.deletions, stats.netChanges].join(','));
|
|
194
|
+
}
|
|
315
195
|
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
}, 0);
|
|
332
|
-
var totalProposalDeletions = Array.from(result.proposals.values()).reduce(function (sum, p) {
|
|
333
|
-
return sum + p.deletions;
|
|
334
|
-
}, 0);
|
|
335
|
-
var totalProposalNetChanges = Array.from(result.proposals.values()).reduce(function (sum, p) {
|
|
336
|
-
return sum + p.netChanges;
|
|
337
|
-
}, 0);
|
|
338
|
-
rows.push('');
|
|
339
|
-
rows.push("# ".concat(t('output.proposalTotalLabel')));
|
|
340
|
-
rows.push("".concat(t('table.proposals'), ",").concat(totalProposals));
|
|
341
|
-
rows.push("".concat(t('table.commits'), ",").concat(totalProposalCommits));
|
|
342
|
-
rows.push("".concat(t('table.codeFiles'), ",").concat(totalProposalFiles));
|
|
343
|
-
rows.push("".concat(t('table.additions'), ",").concat(totalProposalAdditions));
|
|
344
|
-
rows.push("".concat(t('table.deletions'), ",").concat(totalProposalDeletions));
|
|
345
|
-
rows.push("".concat(t('table.netChanges'), ",").concat(totalProposalNetChanges));
|
|
196
|
+
// Proposal totals
|
|
197
|
+
const totalProposals = result.proposals.size;
|
|
198
|
+
const totalProposalCommits = Array.from(result.proposals.values()).reduce((sum, p) => sum + p.commits, 0);
|
|
199
|
+
const totalProposalFiles = Array.from(result.proposals.values()).reduce((sum, p) => sum + p.codeFilesChanged, 0);
|
|
200
|
+
const totalProposalAdditions = Array.from(result.proposals.values()).reduce((sum, p) => sum + p.additions, 0);
|
|
201
|
+
const totalProposalDeletions = Array.from(result.proposals.values()).reduce((sum, p) => sum + p.deletions, 0);
|
|
202
|
+
const totalProposalNetChanges = Array.from(result.proposals.values()).reduce((sum, p) => sum + p.netChanges, 0);
|
|
203
|
+
rows.push('');
|
|
204
|
+
rows.push(`# ${t('output.proposalTotalLabel')}`);
|
|
205
|
+
rows.push(`${t('table.proposals')},${totalProposals}`);
|
|
206
|
+
rows.push(`${t('table.commits')},${totalProposalCommits}`);
|
|
207
|
+
rows.push(`${t('table.codeFiles')},${totalProposalFiles}`);
|
|
208
|
+
rows.push(`${t('table.additions')},${totalProposalAdditions}`);
|
|
209
|
+
rows.push(`${t('table.deletions')},${totalProposalDeletions}`);
|
|
210
|
+
rows.push(`${t('table.netChanges')},${totalProposalNetChanges}`);
|
|
346
211
|
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
});
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
_step5;
|
|
356
|
-
try {
|
|
357
|
-
for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
|
|
358
|
-
var _stats$lastCommitDate2;
|
|
359
|
-
var stats = _step5.value;
|
|
360
|
-
var proposals = Array.from(stats.openspecProposals).join(';');
|
|
361
|
-
rows.push([stats.author, stats.statisticsPeriod || '-', stats.commits, stats.openspecProposals.size, "\"".concat(proposals, "\""), stats.codeFilesChanged, stats.additions, stats.deletions, stats.netChanges, ((_stats$lastCommitDate2 = stats.lastCommitDate) === null || _stats$lastCommitDate2 === void 0 ? void 0 : _stats$lastCommitDate2.toISOString()) || ''].join(','));
|
|
362
|
-
}
|
|
363
|
-
} catch (err) {
|
|
364
|
-
_iterator5.e(err);
|
|
365
|
-
} finally {
|
|
366
|
-
_iterator5.f();
|
|
367
|
-
}
|
|
368
|
-
} else {
|
|
369
|
-
rows.push("".concat(t('table.contributors'), ",").concat(t('table.commits'), ",").concat(t('table.proposals'), ",").concat(t('table.codeFiles'), ",").concat(t('table.additions'), ",").concat(t('table.deletions'), ",").concat(t('table.netChanges')));
|
|
370
|
-
var totalProposalsSet = new Set();
|
|
371
|
-
sortedAuthors.forEach(function (s) {
|
|
372
|
-
return s.openspecProposals.forEach(function (p) {
|
|
373
|
-
return totalProposalsSet.add(p);
|
|
374
|
-
});
|
|
375
|
-
});
|
|
376
|
-
rows.push([sortedAuthors.length, sortedAuthors.reduce(function (sum, s) {
|
|
377
|
-
return sum + s.commits;
|
|
378
|
-
}, 0), totalProposalsSet.size, sortedAuthors.reduce(function (sum, s) {
|
|
379
|
-
return sum + s.codeFilesChanged;
|
|
380
|
-
}, 0), sortedAuthors.reduce(function (sum, s) {
|
|
381
|
-
return sum + s.additions;
|
|
382
|
-
}, 0), sortedAuthors.reduce(function (sum, s) {
|
|
383
|
-
return sum + s.deletions;
|
|
384
|
-
}, 0), sortedAuthors.reduce(function (sum, s) {
|
|
385
|
-
return sum + s.netChanges;
|
|
386
|
-
}, 0)].join(','));
|
|
387
|
-
rows.push('');
|
|
388
|
-
rows.push("# ".concat(t('output.contributorHint')));
|
|
212
|
+
// Author summary section
|
|
213
|
+
rows.push(`\n# ${t('output.authorSummary')}`);
|
|
214
|
+
const sortedAuthors = Array.from(result.authors.values()).sort((a, b) => b.commits - a.commits);
|
|
215
|
+
if (showContributors) {
|
|
216
|
+
rows.push(`${t('table.author')},${t('table.period')},${t('table.commits')},${t('table.proposalsCount')},${t('table.proposalsList')},${t('table.codeFiles')},${t('table.additions')},${t('table.deletions')},${t('table.netChanges')},${t('table.lastCommitDate')}`);
|
|
217
|
+
for (const stats of sortedAuthors) {
|
|
218
|
+
const proposals = Array.from(stats.openspecProposals).join(';');
|
|
219
|
+
rows.push([stats.author, stats.statisticsPeriod || '-', stats.commits, stats.openspecProposals.size, `"${proposals}"`, stats.codeFilesChanged, stats.additions, stats.deletions, stats.netChanges, stats.lastCommitDate?.toISOString() || ''].join(','));
|
|
389
220
|
}
|
|
390
|
-
|
|
221
|
+
} else {
|
|
222
|
+
rows.push(`${t('table.contributors')},${t('table.commits')},${t('table.proposals')},${t('table.codeFiles')},${t('table.additions')},${t('table.deletions')},${t('table.netChanges')}`);
|
|
223
|
+
const totalProposalsSet = new Set();
|
|
224
|
+
sortedAuthors.forEach(s => s.openspecProposals.forEach(p => totalProposalsSet.add(p)));
|
|
225
|
+
rows.push([sortedAuthors.length, sortedAuthors.reduce((sum, s) => sum + s.commits, 0), totalProposalsSet.size, sortedAuthors.reduce((sum, s) => sum + s.codeFilesChanged, 0), sortedAuthors.reduce((sum, s) => sum + s.additions, 0), sortedAuthors.reduce((sum, s) => sum + s.deletions, 0), sortedAuthors.reduce((sum, s) => sum + s.netChanges, 0)].join(','));
|
|
226
|
+
rows.push('');
|
|
227
|
+
rows.push(`# ${t('output.contributorHint')}`);
|
|
391
228
|
}
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
});
|
|
229
|
+
return rows.join('\n');
|
|
230
|
+
}
|
|
231
|
+
formatMarkdown(result, showContributors = true) {
|
|
232
|
+
let md = '';
|
|
233
|
+
md += t('markdown.title');
|
|
234
|
+
md += t('markdown.timeRange', {
|
|
235
|
+
since: result.timeRange.since.toLocaleString('zh-CN', {
|
|
236
|
+
hour12: false
|
|
237
|
+
}),
|
|
238
|
+
until: result.timeRange.until.toLocaleString('zh-CN', {
|
|
239
|
+
hour12: false
|
|
240
|
+
})
|
|
241
|
+
});
|
|
242
|
+
md += t('markdown.branches', {
|
|
243
|
+
branches: result.branches.join(', ')
|
|
244
|
+
});
|
|
245
|
+
md += t('markdown.totalCommits', {
|
|
246
|
+
count: String(result.totalCommits)
|
|
247
|
+
});
|
|
412
248
|
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
|
|
424
|
-
var _stats3 = _step6.value;
|
|
425
|
-
var contributors = Array.from(_stats3.contributors).join(', ');
|
|
426
|
-
var proposalName = _stats3.multiProposalCommits > 0 ? "".concat(_stats3.proposal, " \u26A0\uFE0F") : _stats3.proposal;
|
|
427
|
-
md += "| ".concat(proposalName, " | ").concat(_stats3.commits, " | ").concat(contributors, " | ").concat(_stats3.codeFilesChanged, " | +").concat(_stats3.additions, " | -").concat(_stats3.deletions, " | ").concat(_stats3.netChanges >= 0 ? '+' : '').concat(_stats3.netChanges, " |\n");
|
|
428
|
-
}
|
|
249
|
+
// Proposal summary
|
|
250
|
+
md += `\n## ${t('output.proposalSummary')}\n\n`;
|
|
251
|
+
md += `| ${t('table.proposal')} | ${t('table.commits')} | ${t('table.contributors')} | ${t('table.codeFiles')} | ${t('table.additions')} | ${t('table.deletions')} | ${t('table.netChanges')} |\n`;
|
|
252
|
+
md += '|--------|---------|-------------|------------|-----------|-----------|-------------|\n';
|
|
253
|
+
const sortedProposals = Array.from(result.proposals.values()).sort((a, b) => b.netChanges - a.netChanges);
|
|
254
|
+
for (const stats of sortedProposals) {
|
|
255
|
+
const contributors = Array.from(stats.contributors).join(', ');
|
|
256
|
+
const proposalName = stats.multiProposalCommits > 0 ? `${stats.proposal} !` : stats.proposal;
|
|
257
|
+
md += `| ${proposalName} | ${stats.commits} | ${contributors} | ${stats.codeFilesChanged} | +${stats.additions} | -${stats.deletions} | ${stats.netChanges >= 0 ? '+' : ''}${stats.netChanges} |\n`;
|
|
258
|
+
}
|
|
429
259
|
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
return sum + p.netChanges;
|
|
451
|
-
}, 0);
|
|
452
|
-
md += "\n**".concat(t('output.proposalTotalLabel'), "**\n");
|
|
453
|
-
md += "- ".concat(t('table.proposals'), ": ").concat(totalProposals, "\n");
|
|
454
|
-
md += "- ".concat(t('table.commits'), ": ").concat(totalProposalCommits, "\n");
|
|
455
|
-
md += "- ".concat(t('table.codeFiles'), ": ").concat(totalProposalFiles, "\n");
|
|
456
|
-
md += "- ".concat(t('table.additions'), ": +").concat(totalProposalAdditions, "\n");
|
|
457
|
-
md += "- ".concat(t('table.deletions'), ": -").concat(totalProposalDeletions, "\n");
|
|
458
|
-
md += "- ".concat(t('table.netChanges'), ": ").concat(totalProposalNetChanges >= 0 ? '+' : '').concat(totalProposalNetChanges, "\n");
|
|
459
|
-
var hasMultiProposalCommits = Array.from(result.proposals.values()).some(function (p) {
|
|
460
|
-
return p.multiProposalCommits > 0;
|
|
461
|
-
});
|
|
462
|
-
if (hasMultiProposalCommits) {
|
|
463
|
-
md += "\n> \u26A0\uFE0F **".concat(t('output.multiProposalWarning'), "**\n>\n");
|
|
464
|
-
var affectedProposals = Array.from(result.proposals.values()).filter(function (p) {
|
|
465
|
-
return p.multiProposalCommits > 0;
|
|
466
|
-
});
|
|
467
|
-
var _iterator7 = _createForOfIteratorHelper(affectedProposals),
|
|
468
|
-
_step7;
|
|
469
|
-
try {
|
|
470
|
-
for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
|
|
471
|
-
var p = _step7.value;
|
|
472
|
-
md += "> - ".concat(p.proposal, ": ").concat(p.multiProposalCommits, "/").concat(p.commits, " commits ").concat(t('output.sharedWithOthers'), "\n");
|
|
473
|
-
}
|
|
474
|
-
} catch (err) {
|
|
475
|
-
_iterator7.e(err);
|
|
476
|
-
} finally {
|
|
477
|
-
_iterator7.f();
|
|
478
|
-
}
|
|
479
|
-
md += '\n';
|
|
260
|
+
// Proposal totals
|
|
261
|
+
const totalProposals = result.proposals.size;
|
|
262
|
+
const totalProposalCommits = Array.from(result.proposals.values()).reduce((sum, p) => sum + p.commits, 0);
|
|
263
|
+
const totalProposalFiles = Array.from(result.proposals.values()).reduce((sum, p) => sum + p.codeFilesChanged, 0);
|
|
264
|
+
const totalProposalAdditions = Array.from(result.proposals.values()).reduce((sum, p) => sum + p.additions, 0);
|
|
265
|
+
const totalProposalDeletions = Array.from(result.proposals.values()).reduce((sum, p) => sum + p.deletions, 0);
|
|
266
|
+
const totalProposalNetChanges = Array.from(result.proposals.values()).reduce((sum, p) => sum + p.netChanges, 0);
|
|
267
|
+
md += `\n**${t('output.proposalTotalLabel')}**\n`;
|
|
268
|
+
md += `- ${t('table.proposals')}: ${totalProposals}\n`;
|
|
269
|
+
md += `- ${t('table.commits')}: ${totalProposalCommits}\n`;
|
|
270
|
+
md += `- ${t('table.codeFiles')}: ${totalProposalFiles}\n`;
|
|
271
|
+
md += `- ${t('table.additions')}: +${totalProposalAdditions}\n`;
|
|
272
|
+
md += `- ${t('table.deletions')}: -${totalProposalDeletions}\n`;
|
|
273
|
+
md += `- ${t('table.netChanges')}: ${totalProposalNetChanges >= 0 ? '+' : ''}${totalProposalNetChanges}\n`;
|
|
274
|
+
const hasMultiProposalCommits = Array.from(result.proposals.values()).some(p => p.multiProposalCommits > 0);
|
|
275
|
+
if (hasMultiProposalCommits) {
|
|
276
|
+
md += `\n> **${t('output.multiProposalWarning')}**\n>\n`;
|
|
277
|
+
const affectedProposals = Array.from(result.proposals.values()).filter(p => p.multiProposalCommits > 0);
|
|
278
|
+
for (const p of affectedProposals) {
|
|
279
|
+
md += `> - ${p.proposal}: ${p.multiProposalCommits}/${p.commits} commits ${t('output.sharedWithOthers')}\n`;
|
|
480
280
|
}
|
|
281
|
+
md += '\n';
|
|
282
|
+
}
|
|
481
283
|
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
})
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
md += '
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
} catch (err) {
|
|
498
|
-
_iterator8.e(err);
|
|
499
|
-
} finally {
|
|
500
|
-
_iterator8.f();
|
|
501
|
-
}
|
|
502
|
-
md += t('markdown.proposalDetails');
|
|
503
|
-
var _iterator9 = _createForOfIteratorHelper(sortedAuthors),
|
|
504
|
-
_step9;
|
|
505
|
-
try {
|
|
506
|
-
for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
|
|
507
|
-
var _stats2 = _step9.value;
|
|
508
|
-
if (_stats2.openspecProposals.size > 0) {
|
|
509
|
-
md += "### ".concat(_stats2.author, "\n\n");
|
|
510
|
-
for (var _i = 0, _Array$from = Array.from(_stats2.openspecProposals); _i < _Array$from.length; _i++) {
|
|
511
|
-
var proposal = _Array$from[_i];
|
|
512
|
-
md += "- ".concat(proposal, "\n");
|
|
513
|
-
}
|
|
514
|
-
md += '\n';
|
|
515
|
-
}
|
|
284
|
+
// Author summary
|
|
285
|
+
md += `\n## ${t('output.authorSummary')}\n\n`;
|
|
286
|
+
const sortedAuthors = Array.from(result.authors.values()).sort((a, b) => b.commits - a.commits);
|
|
287
|
+
if (showContributors) {
|
|
288
|
+
md += `| ${t('table.author')} | ${t('table.period')} | ${t('table.commits')} | ${t('table.proposals')} | ${t('table.codeFiles')} | ${t('table.additions')} | ${t('table.deletions')} | ${t('table.netChanges')} |\n`;
|
|
289
|
+
md += '|--------|--------|---------|-----------|------------|-----------|-----------|-------------|\n';
|
|
290
|
+
for (const stats of sortedAuthors) {
|
|
291
|
+
md += `| ${stats.author} | ${stats.statisticsPeriod || '-'} | ${stats.commits} | ${stats.openspecProposals.size} | ${stats.codeFilesChanged} | +${stats.additions} | -${stats.deletions} | ${stats.netChanges >= 0 ? '+' : ''}${stats.netChanges} |\n`;
|
|
292
|
+
}
|
|
293
|
+
md += t('markdown.proposalDetails');
|
|
294
|
+
for (const stats of sortedAuthors) {
|
|
295
|
+
if (stats.openspecProposals.size > 0) {
|
|
296
|
+
md += `### ${stats.author}\n\n`;
|
|
297
|
+
for (const proposal of Array.from(stats.openspecProposals)) {
|
|
298
|
+
md += `- ${proposal}\n`;
|
|
516
299
|
}
|
|
517
|
-
|
|
518
|
-
_iterator9.e(err);
|
|
519
|
-
} finally {
|
|
520
|
-
_iterator9.f();
|
|
300
|
+
md += '\n';
|
|
521
301
|
}
|
|
522
|
-
} else {
|
|
523
|
-
md += "| ".concat(t('table.contributors'), " | ").concat(t('table.commits'), " | ").concat(t('table.proposals'), " | ").concat(t('table.codeFiles'), " | ").concat(t('table.additions'), " | ").concat(t('table.deletions'), " | ").concat(t('table.netChanges'), " |\n");
|
|
524
|
-
md += '|------------|---------|-----------|------------|-----------|-----------|-------------|\n';
|
|
525
|
-
var totalProposalsSet = new Set();
|
|
526
|
-
sortedAuthors.forEach(function (s) {
|
|
527
|
-
return s.openspecProposals.forEach(function (p) {
|
|
528
|
-
return totalProposalsSet.add(p);
|
|
529
|
-
});
|
|
530
|
-
});
|
|
531
|
-
var totalAuthors = sortedAuthors.length;
|
|
532
|
-
var totalCommits = sortedAuthors.reduce(function (sum, s) {
|
|
533
|
-
return sum + s.commits;
|
|
534
|
-
}, 0);
|
|
535
|
-
var totalFiles = sortedAuthors.reduce(function (sum, s) {
|
|
536
|
-
return sum + s.codeFilesChanged;
|
|
537
|
-
}, 0);
|
|
538
|
-
var totalAdditions = sortedAuthors.reduce(function (sum, s) {
|
|
539
|
-
return sum + s.additions;
|
|
540
|
-
}, 0);
|
|
541
|
-
var totalDeletions = sortedAuthors.reduce(function (sum, s) {
|
|
542
|
-
return sum + s.deletions;
|
|
543
|
-
}, 0);
|
|
544
|
-
var totalNetChanges = sortedAuthors.reduce(function (sum, s) {
|
|
545
|
-
return sum + s.netChanges;
|
|
546
|
-
}, 0);
|
|
547
|
-
md += "| ".concat(totalAuthors, " | ").concat(totalCommits, " | ").concat(totalProposalsSet.size, " | ").concat(totalFiles, " | +").concat(totalAdditions, " | -").concat(totalDeletions, " | ").concat(totalNetChanges >= 0 ? '+' : '').concat(totalNetChanges, " |\n");
|
|
548
|
-
md += "\n*".concat(t('output.contributorHint'), "*\n");
|
|
549
302
|
}
|
|
550
|
-
|
|
303
|
+
} else {
|
|
304
|
+
md += `| ${t('table.contributors')} | ${t('table.commits')} | ${t('table.proposals')} | ${t('table.codeFiles')} | ${t('table.additions')} | ${t('table.deletions')} | ${t('table.netChanges')} |\n`;
|
|
305
|
+
md += '|------------|---------|-----------|------------|-----------|-----------|-------------|\n';
|
|
306
|
+
const totalProposalsSet = new Set();
|
|
307
|
+
sortedAuthors.forEach(s => s.openspecProposals.forEach(p => totalProposalsSet.add(p)));
|
|
308
|
+
const totalAuthors = sortedAuthors.length;
|
|
309
|
+
const totalCommits = sortedAuthors.reduce((sum, s) => sum + s.commits, 0);
|
|
310
|
+
const totalFiles = sortedAuthors.reduce((sum, s) => sum + s.codeFilesChanged, 0);
|
|
311
|
+
const totalAdditions = sortedAuthors.reduce((sum, s) => sum + s.additions, 0);
|
|
312
|
+
const totalDeletions = sortedAuthors.reduce((sum, s) => sum + s.deletions, 0);
|
|
313
|
+
const totalNetChanges = sortedAuthors.reduce((sum, s) => sum + s.netChanges, 0);
|
|
314
|
+
md += `| ${totalAuthors} | ${totalCommits} | ${totalProposalsSet.size} | ${totalFiles} | +${totalAdditions} | -${totalDeletions} | ${totalNetChanges >= 0 ? '+' : ''}${totalNetChanges} |\n`;
|
|
315
|
+
md += `\n*${t('output.contributorHint')}*\n`;
|
|
551
316
|
}
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
}
|
|
317
|
+
return md;
|
|
318
|
+
}
|
|
319
|
+
}
|