repo-wrapped 0.0.3 → 0.0.5
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/commands/generate.js +104 -95
- package/dist/constants/chronotypes.js +23 -23
- package/dist/constants/colors.js +18 -18
- package/dist/constants/index.js +18 -18
- package/dist/formatters/index.js +17 -17
- package/dist/formatters/timeFormatter.js +28 -29
- package/dist/generators/html/templates/achievementsSection.js +42 -43
- package/dist/generators/html/templates/commitQualitySection.js +25 -26
- package/dist/generators/html/templates/contributionGraph.js +64 -48
- package/dist/generators/html/templates/impactSection.js +19 -20
- package/dist/generators/html/templates/knowledgeSection.js +86 -87
- package/dist/generators/html/templates/streakSection.js +8 -9
- package/dist/generators/html/templates/timePatternsSection.js +45 -46
- package/dist/generators/html/utils/colorUtils.js +61 -21
- package/dist/generators/html/utils/commitMapBuilder.js +23 -24
- package/dist/generators/html/utils/dateRangeCalculator.js +56 -57
- package/dist/generators/html/utils/developerStatsCalculator.js +28 -29
- package/dist/generators/html/utils/scriptLoader.js +15 -16
- package/dist/generators/html/utils/styleLoader.js +17 -18
- package/dist/generators/html/utils/weekGrouper.js +27 -28
- package/dist/index.js +78 -78
- package/dist/types/index.js +2 -2
- package/dist/utils/achievementDefinitions.js +433 -433
- package/dist/utils/achievementEngine.js +169 -170
- package/dist/utils/commitQualityAnalyzer.js +367 -368
- package/dist/utils/fileHotspotAnalyzer.js +269 -270
- package/dist/utils/gitParser.js +136 -126
- package/dist/utils/htmlGenerator.js +245 -233
- package/dist/utils/impactAnalyzer.js +247 -248
- package/dist/utils/knowledgeDistributionAnalyzer.js +380 -374
- package/dist/utils/matrixGenerator.js +369 -350
- package/dist/utils/slideGenerator.js +170 -171
- package/dist/utils/streakCalculator.js +134 -135
- package/dist/utils/timePatternAnalyzer.js +304 -305
- package/dist/utils/wrappedDisplay.js +124 -115
- package/dist/utils/wrappedGenerator.js +376 -377
- package/dist/utils/wrappedHtmlGenerator.js +105 -106
- package/package.json +10 -10
|
@@ -1,57 +1,56 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Calculates date ranges from the entire commit history (first to last commit)
|
|
28
|
-
*/
|
|
29
|
-
function calculateDateRangesFromCommits(commits) {
|
|
30
|
-
if (commits.length === 0) {
|
|
31
|
-
const now = new Date();
|
|
32
|
-
return {
|
|
33
|
-
startDate: now,
|
|
34
|
-
endDate: now,
|
|
35
|
-
weekStartDate: (0, date_fns_1.startOfWeek)(now, { weekStartsOn: 0 }),
|
|
36
|
-
weekEndDate: (0, date_fns_1.endOfWeek)(now, { weekStartsOn: 0 })
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
// Sort commits by date to find first and last
|
|
40
|
-
const sortedCommits = [...commits].sort((a, b) => new Date(a.date).getTime() - new Date(b.date).getTime());
|
|
41
|
-
const firstCommitDate = new Date(sortedCommits[0].date);
|
|
42
|
-
const lastCommitDate = new Date(sortedCommits[sortedCommits.length - 1].date);
|
|
43
|
-
// Use start of month for first commit and today/last commit date for end
|
|
44
|
-
const now = new Date();
|
|
45
|
-
const startDate = (0, date_fns_1.startOfMonth)(firstCommitDate);
|
|
46
|
-
const endDate = lastCommitDate > now ? lastCommitDate : now;
|
|
47
|
-
// Get the full week range (start on Sunday, end on Saturday)
|
|
48
|
-
const weekStartDate = (0, date_fns_1.startOfWeek)(startDate, { weekStartsOn: 0 });
|
|
49
|
-
const weekEndDate = (0, date_fns_1.endOfWeek)(endDate, { weekStartsOn: 0 });
|
|
50
|
-
return {
|
|
51
|
-
startDate,
|
|
52
|
-
endDate,
|
|
53
|
-
weekStartDate,
|
|
54
|
-
weekEndDate
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
exports.calculateDateRangesFromCommits = calculateDateRangesFromCommits;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.calculateDateRanges = calculateDateRanges;
|
|
4
|
+
exports.calculateDateRangesFromCommits = calculateDateRangesFromCommits;
|
|
5
|
+
const date_fns_1 = require("date-fns");
|
|
6
|
+
/**
|
|
7
|
+
* Calculates date ranges for the visualization
|
|
8
|
+
*/
|
|
9
|
+
function calculateDateRanges(year, monthsToShow) {
|
|
10
|
+
const now = new Date();
|
|
11
|
+
const isCurrentYear = year === now.getFullYear();
|
|
12
|
+
// Calculate the end date (today if current year, or end of December for past years)
|
|
13
|
+
const endDate = isCurrentYear ? now : new Date(year, 11, 31);
|
|
14
|
+
// Calculate start date (N months back from end date)
|
|
15
|
+
const startDate = (0, date_fns_1.startOfMonth)((0, date_fns_1.subMonths)(endDate, monthsToShow - 1));
|
|
16
|
+
// Get the full week range (start on Sunday, end on Saturday)
|
|
17
|
+
const weekStartDate = (0, date_fns_1.startOfWeek)(startDate, { weekStartsOn: 0 });
|
|
18
|
+
const weekEndDate = (0, date_fns_1.endOfWeek)(endDate, { weekStartsOn: 0 });
|
|
19
|
+
return {
|
|
20
|
+
startDate,
|
|
21
|
+
endDate,
|
|
22
|
+
weekStartDate,
|
|
23
|
+
weekEndDate
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Calculates date ranges from the entire commit history (first to last commit)
|
|
28
|
+
*/
|
|
29
|
+
function calculateDateRangesFromCommits(commits) {
|
|
30
|
+
if (commits.length === 0) {
|
|
31
|
+
const now = new Date();
|
|
32
|
+
return {
|
|
33
|
+
startDate: now,
|
|
34
|
+
endDate: now,
|
|
35
|
+
weekStartDate: (0, date_fns_1.startOfWeek)(now, { weekStartsOn: 0 }),
|
|
36
|
+
weekEndDate: (0, date_fns_1.endOfWeek)(now, { weekStartsOn: 0 })
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
// Sort commits by date to find first and last
|
|
40
|
+
const sortedCommits = [...commits].sort((a, b) => new Date(a.date).getTime() - new Date(b.date).getTime());
|
|
41
|
+
const firstCommitDate = new Date(sortedCommits[0].date);
|
|
42
|
+
const lastCommitDate = new Date(sortedCommits[sortedCommits.length - 1].date);
|
|
43
|
+
// Use start of month for first commit and today/last commit date for end
|
|
44
|
+
const now = new Date();
|
|
45
|
+
const startDate = (0, date_fns_1.startOfMonth)(firstCommitDate);
|
|
46
|
+
const endDate = lastCommitDate > now ? lastCommitDate : now;
|
|
47
|
+
// Get the full week range (start on Sunday, end on Saturday)
|
|
48
|
+
const weekStartDate = (0, date_fns_1.startOfWeek)(startDate, { weekStartsOn: 0 });
|
|
49
|
+
const weekEndDate = (0, date_fns_1.endOfWeek)(endDate, { weekStartsOn: 0 });
|
|
50
|
+
return {
|
|
51
|
+
startDate,
|
|
52
|
+
endDate,
|
|
53
|
+
weekStartDate,
|
|
54
|
+
weekEndDate
|
|
55
|
+
};
|
|
56
|
+
}
|
|
@@ -1,29 +1,28 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.calculateDeveloperStats =
|
|
4
|
-
/**
|
|
5
|
-
* Calculates statistics for each developer from commits within a date range
|
|
6
|
-
*/
|
|
7
|
-
function calculateDeveloperStats(commits, startDate, endDate) {
|
|
8
|
-
const developerStats = new Map();
|
|
9
|
-
commits.forEach(commit => {
|
|
10
|
-
const commitDate = new Date(commit.date);
|
|
11
|
-
if (commitDate >= startDate && commitDate <= endDate) {
|
|
12
|
-
if (!developerStats.has(commit.author)) {
|
|
13
|
-
developerStats.set(commit.author, {
|
|
14
|
-
commits: 0,
|
|
15
|
-
firstCommit: commitDate,
|
|
16
|
-
lastCommit: commitDate
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
const stats = developerStats.get(commit.author);
|
|
20
|
-
stats.commits++;
|
|
21
|
-
if (commitDate < stats.firstCommit)
|
|
22
|
-
stats.firstCommit = commitDate;
|
|
23
|
-
if (commitDate > stats.lastCommit)
|
|
24
|
-
stats.lastCommit = commitDate;
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
return developerStats;
|
|
28
|
-
}
|
|
29
|
-
exports.calculateDeveloperStats = calculateDeveloperStats;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.calculateDeveloperStats = calculateDeveloperStats;
|
|
4
|
+
/**
|
|
5
|
+
* Calculates statistics for each developer from commits within a date range
|
|
6
|
+
*/
|
|
7
|
+
function calculateDeveloperStats(commits, startDate, endDate) {
|
|
8
|
+
const developerStats = new Map();
|
|
9
|
+
commits.forEach(commit => {
|
|
10
|
+
const commitDate = new Date(commit.date);
|
|
11
|
+
if (commitDate >= startDate && commitDate <= endDate) {
|
|
12
|
+
if (!developerStats.has(commit.author)) {
|
|
13
|
+
developerStats.set(commit.author, {
|
|
14
|
+
commits: 0,
|
|
15
|
+
firstCommit: commitDate,
|
|
16
|
+
lastCommit: commitDate
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
const stats = developerStats.get(commit.author);
|
|
20
|
+
stats.commits++;
|
|
21
|
+
if (commitDate < stats.firstCommit)
|
|
22
|
+
stats.firstCommit = commitDate;
|
|
23
|
+
if (commitDate > stats.lastCommit)
|
|
24
|
+
stats.lastCommit = commitDate;
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
return developerStats;
|
|
28
|
+
}
|
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.loadScripts =
|
|
4
|
-
const fs_1 = require("fs");
|
|
5
|
-
const path_1 = require("path");
|
|
6
|
-
function loadScripts() {
|
|
7
|
-
const scriptsDir = (0, path_1.join)(__dirname, '..', 'scripts');
|
|
8
|
-
const tabs = (0, fs_1.readFileSync)((0, path_1.join)(scriptsDir, 'tabs.js'), 'utf-8');
|
|
9
|
-
const tooltip = (0, fs_1.readFileSync)((0, path_1.join)(scriptsDir, 'tooltip.js'), 'utf-8');
|
|
10
|
-
const modal = (0, fs_1.readFileSync)((0, path_1.join)(scriptsDir, 'modal.js'), 'utf-8');
|
|
11
|
-
const navigation = (0, fs_1.readFileSync)((0, path_1.join)(scriptsDir, 'navigation.js'), 'utf-8');
|
|
12
|
-
const exportScript = (0, fs_1.readFileSync)((0, path_1.join)(scriptsDir, 'export.js'), 'utf-8');
|
|
13
|
-
const knowledge = (0, fs_1.readFileSync)((0, path_1.join)(scriptsDir, 'knowledge.js'), 'utf-8');
|
|
14
|
-
return `${tabs}\n\n${tooltip}\n\n${modal}\n\n${navigation}\n\n${exportScript}\n\n${knowledge}`;
|
|
15
|
-
}
|
|
16
|
-
exports.loadScripts = loadScripts;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.loadScripts = loadScripts;
|
|
4
|
+
const fs_1 = require("fs");
|
|
5
|
+
const path_1 = require("path");
|
|
6
|
+
function loadScripts() {
|
|
7
|
+
const scriptsDir = (0, path_1.join)(__dirname, '..', 'scripts');
|
|
8
|
+
const tabs = (0, fs_1.readFileSync)((0, path_1.join)(scriptsDir, 'tabs.js'), 'utf-8');
|
|
9
|
+
const tooltip = (0, fs_1.readFileSync)((0, path_1.join)(scriptsDir, 'tooltip.js'), 'utf-8');
|
|
10
|
+
const modal = (0, fs_1.readFileSync)((0, path_1.join)(scriptsDir, 'modal.js'), 'utf-8');
|
|
11
|
+
const navigation = (0, fs_1.readFileSync)((0, path_1.join)(scriptsDir, 'navigation.js'), 'utf-8');
|
|
12
|
+
const exportScript = (0, fs_1.readFileSync)((0, path_1.join)(scriptsDir, 'export.js'), 'utf-8');
|
|
13
|
+
const knowledge = (0, fs_1.readFileSync)((0, path_1.join)(scriptsDir, 'knowledge.js'), 'utf-8');
|
|
14
|
+
return `${tabs}\n\n${tooltip}\n\n${modal}\n\n${navigation}\n\n${exportScript}\n\n${knowledge}`;
|
|
15
|
+
}
|
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.loadStyles =
|
|
4
|
-
const fs_1 = require("fs");
|
|
5
|
-
const path_1 = require("path");
|
|
6
|
-
/**
|
|
7
|
-
* Loads all CSS files and returns them as a concatenated string
|
|
8
|
-
* for inlining in the HTML output
|
|
9
|
-
*/
|
|
10
|
-
function loadStyles() {
|
|
11
|
-
const stylesDir = (0, path_1.join)(__dirname, '../styles');
|
|
12
|
-
const baseCSS = (0, fs_1.readFileSync)((0, path_1.join)(stylesDir, 'base.css'), 'utf-8');
|
|
13
|
-
const componentsCSS = (0, fs_1.readFileSync)((0, path_1.join)(stylesDir, 'components.css'), 'utf-8');
|
|
14
|
-
const achievementsCSS = (0, fs_1.readFileSync)((0, path_1.join)(stylesDir, 'achievements.css'), 'utf-8');
|
|
15
|
-
const knowledgeCSS = (0, fs_1.readFileSync)((0, path_1.join)(stylesDir, 'knowledge.css'), 'utf-8');
|
|
16
|
-
return `${baseCSS}\n\n${componentsCSS}\n\n${achievementsCSS}\n\n${knowledgeCSS}`;
|
|
17
|
-
}
|
|
18
|
-
exports.loadStyles = loadStyles;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.loadStyles = loadStyles;
|
|
4
|
+
const fs_1 = require("fs");
|
|
5
|
+
const path_1 = require("path");
|
|
6
|
+
/**
|
|
7
|
+
* Loads all CSS files and returns them as a concatenated string
|
|
8
|
+
* for inlining in the HTML output
|
|
9
|
+
*/
|
|
10
|
+
function loadStyles() {
|
|
11
|
+
const stylesDir = (0, path_1.join)(__dirname, '../styles');
|
|
12
|
+
const baseCSS = (0, fs_1.readFileSync)((0, path_1.join)(stylesDir, 'base.css'), 'utf-8');
|
|
13
|
+
const componentsCSS = (0, fs_1.readFileSync)((0, path_1.join)(stylesDir, 'components.css'), 'utf-8');
|
|
14
|
+
const achievementsCSS = (0, fs_1.readFileSync)((0, path_1.join)(stylesDir, 'achievements.css'), 'utf-8');
|
|
15
|
+
const knowledgeCSS = (0, fs_1.readFileSync)((0, path_1.join)(stylesDir, 'knowledge.css'), 'utf-8');
|
|
16
|
+
return `${baseCSS}\n\n${componentsCSS}\n\n${achievementsCSS}\n\n${knowledgeCSS}`;
|
|
17
|
+
}
|
|
@@ -1,28 +1,27 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
currentWeek
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Gets day labels for the contribution graph
|
|
24
|
-
*/
|
|
25
|
-
function getDayLabels() {
|
|
26
|
-
return ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
|
|
27
|
-
}
|
|
28
|
-
exports.getDayLabels = getDayLabels;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.groupDaysIntoWeeks = groupDaysIntoWeeks;
|
|
4
|
+
exports.getDayLabels = getDayLabels;
|
|
5
|
+
const date_fns_1 = require("date-fns");
|
|
6
|
+
/**
|
|
7
|
+
* Groups days into weeks for the contribution graph
|
|
8
|
+
*/
|
|
9
|
+
function groupDaysIntoWeeks(startDate, endDate) {
|
|
10
|
+
const days = (0, date_fns_1.eachDayOfInterval)({ start: startDate, end: endDate });
|
|
11
|
+
const weeks = [];
|
|
12
|
+
let currentWeek = [];
|
|
13
|
+
days.forEach(day => {
|
|
14
|
+
currentWeek.push(day);
|
|
15
|
+
if (currentWeek.length === 7) {
|
|
16
|
+
weeks.push(currentWeek);
|
|
17
|
+
currentWeek = [];
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
return weeks;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Gets day labels for the contribution graph
|
|
24
|
+
*/
|
|
25
|
+
function getDayLabels() {
|
|
26
|
+
return ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
|
|
27
|
+
}
|
package/dist/index.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
"use strict";
|
|
3
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
-
};
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
const chalk_1 = __importDefault(require("chalk"));
|
|
8
|
-
const child_process_1 = require("child_process");
|
|
9
|
-
const commander_1 = require("commander");
|
|
10
|
-
const ora_1 = __importDefault(require("ora"));
|
|
11
|
-
const generate_js_1 = require("./commands/generate.js");
|
|
12
|
-
const slideGenerator_js_1 = require("./utils/slideGenerator.js");
|
|
13
|
-
const wrappedDisplay_js_1 = require("./utils/wrappedDisplay.js");
|
|
14
|
-
const wrappedGenerator_js_1 = require("./utils/wrappedGenerator.js");
|
|
15
|
-
const wrappedHtmlGenerator_js_1 = require("./utils/wrappedHtmlGenerator.js");
|
|
16
|
-
const program = new commander_1.Command();
|
|
17
|
-
program
|
|
18
|
-
.name('repo-wrapped')
|
|
19
|
-
.description('Generate Git repository analytics and visualizations')
|
|
20
|
-
.version('1.0.0')
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
+
};
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
8
|
+
const child_process_1 = require("child_process");
|
|
9
|
+
const commander_1 = require("commander");
|
|
10
|
+
const ora_1 = __importDefault(require("ora"));
|
|
11
|
+
const generate_js_1 = require("./commands/generate.js");
|
|
12
|
+
const slideGenerator_js_1 = require("./utils/slideGenerator.js");
|
|
13
|
+
const wrappedDisplay_js_1 = require("./utils/wrappedDisplay.js");
|
|
14
|
+
const wrappedGenerator_js_1 = require("./utils/wrappedGenerator.js");
|
|
15
|
+
const wrappedHtmlGenerator_js_1 = require("./utils/wrappedHtmlGenerator.js");
|
|
16
|
+
const program = new commander_1.Command();
|
|
17
|
+
program
|
|
18
|
+
.name('repo-wrapped')
|
|
19
|
+
.description('Generate Git repository analytics and visualizations')
|
|
20
|
+
.version('1.0.0')
|
|
21
21
|
.addHelpText('after', `
|
|
22
22
|
Commands:
|
|
23
23
|
generate [path] Generate commit visualization (default command)
|
|
@@ -39,61 +39,61 @@ Examples:
|
|
|
39
39
|
repo-wrapped generate . --html
|
|
40
40
|
repo-wrapped generate . --all --html --deep-analysis
|
|
41
41
|
repo-wrapped wrapped 2025 . --html
|
|
42
|
-
`);
|
|
43
|
-
program
|
|
44
|
-
.command('generate')
|
|
45
|
-
.description('Generate a commit visualization for a repository')
|
|
46
|
-
.argument('[path]', 'Path to the git repository', '.')
|
|
47
|
-
.option('-y, --year <year>', 'Year to analyze', String(new Date().getFullYear()))
|
|
48
|
-
.option('-m, --months <months>', 'Number of months to show (default: 12)', '12')
|
|
49
|
-
.option('-a, --all', 'Analyze entire repository lifetime')
|
|
50
|
-
.option('--html', 'Generate HTML output and open in browser')
|
|
51
|
-
.option('--body-check', 'Include commit body in quality scoring')
|
|
52
|
-
.option('--deep-analysis', 'Enable file-level analysis for detailed knowledge distribution')
|
|
53
|
-
.action(generate_js_1.generateMatrix);
|
|
54
|
-
program
|
|
55
|
-
.command('wrapped')
|
|
56
|
-
.description('Generate a Year in Code summary (like Spotify Wrapped)')
|
|
57
|
-
.argument('[year]', 'Year to summarize', String(new Date().getFullYear()))
|
|
58
|
-
.argument('[path]', 'Path to the git repository', '.')
|
|
59
|
-
.option('--html', 'Generate HTML slideshow and open in browser')
|
|
60
|
-
.option('--compare', 'Compare with previous year')
|
|
61
|
-
.action(async (year, path, options) => {
|
|
62
|
-
const spinner = (0, ora_1.default)('Analyzing your year in code...').start();
|
|
63
|
-
try {
|
|
64
|
-
const yearNum = parseInt(year, 10);
|
|
65
|
-
const currentYear = new Date().getFullYear();
|
|
66
|
-
if (isNaN(yearNum) || yearNum < 2000 || yearNum > currentYear + 1) {
|
|
67
|
-
spinner.fail(chalk_1.default.red(`Invalid year: ${year}`));
|
|
68
|
-
process.exit(1);
|
|
69
|
-
}
|
|
70
|
-
// Generate wrapped summary
|
|
71
|
-
const summary = (0, wrappedGenerator_js_1.generateYearWrapped)(yearNum, path, options.compare || false);
|
|
72
|
-
spinner.succeed(chalk_1.default.green('Analysis complete!'));
|
|
73
|
-
if (options.html) {
|
|
74
|
-
// Generate HTML
|
|
75
|
-
const htmlPath = (0, wrappedHtmlGenerator_js_1.generateWrappedHTML)(summary);
|
|
76
|
-
console.log(chalk_1.default.green(`\n✨ HTML slideshow generated: ${htmlPath}`));
|
|
77
|
-
// Open in browser
|
|
78
|
-
const platform = process.platform;
|
|
79
|
-
const openCommand = platform === 'win32' ? 'start' : platform === 'darwin' ? 'open' : 'xdg-open';
|
|
80
|
-
(0, child_process_1.execSync)(`${openCommand} "${htmlPath}"`, { stdio: 'ignore' });
|
|
81
|
-
}
|
|
82
|
-
else {
|
|
83
|
-
// Generate slides
|
|
84
|
-
const slides = (0, slideGenerator_js_1.generateSlides)(summary);
|
|
85
|
-
// Display interactive slideshow
|
|
86
|
-
console.log();
|
|
87
|
-
(0, wrappedDisplay_js_1.displayWrappedSlideshow)(slides);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
catch (error) {
|
|
91
|
-
spinner.fail(chalk_1.default.red('Failed to generate wrapped summary'));
|
|
92
|
-
console.error(chalk_1.default.red(error.message));
|
|
93
|
-
process.exit(1);
|
|
94
|
-
}
|
|
95
|
-
});
|
|
96
|
-
program.parse(process.argv);
|
|
97
|
-
if (!process.argv.slice(2).length) {
|
|
98
|
-
program.outputHelp();
|
|
99
|
-
}
|
|
42
|
+
`);
|
|
43
|
+
program
|
|
44
|
+
.command('generate')
|
|
45
|
+
.description('Generate a commit visualization for a repository')
|
|
46
|
+
.argument('[path]', 'Path to the git repository', '.')
|
|
47
|
+
.option('-y, --year <year>', 'Year to analyze', String(new Date().getFullYear()))
|
|
48
|
+
.option('-m, --months <months>', 'Number of months to show (default: 12)', '12')
|
|
49
|
+
.option('-a, --all', 'Analyze entire repository lifetime')
|
|
50
|
+
.option('--html', 'Generate HTML output and open in browser')
|
|
51
|
+
.option('--body-check', 'Include commit body in quality scoring')
|
|
52
|
+
.option('--deep-analysis', 'Enable file-level analysis for detailed knowledge distribution')
|
|
53
|
+
.action(generate_js_1.generateMatrix);
|
|
54
|
+
program
|
|
55
|
+
.command('wrapped')
|
|
56
|
+
.description('Generate a Year in Code summary (like Spotify Wrapped)')
|
|
57
|
+
.argument('[year]', 'Year to summarize', String(new Date().getFullYear()))
|
|
58
|
+
.argument('[path]', 'Path to the git repository', '.')
|
|
59
|
+
.option('--html', 'Generate HTML slideshow and open in browser')
|
|
60
|
+
.option('--compare', 'Compare with previous year')
|
|
61
|
+
.action(async (year, path, options) => {
|
|
62
|
+
const spinner = (0, ora_1.default)('Analyzing your year in code...').start();
|
|
63
|
+
try {
|
|
64
|
+
const yearNum = parseInt(year, 10);
|
|
65
|
+
const currentYear = new Date().getFullYear();
|
|
66
|
+
if (isNaN(yearNum) || yearNum < 2000 || yearNum > currentYear + 1) {
|
|
67
|
+
spinner.fail(chalk_1.default.red(`Invalid year: ${year}`));
|
|
68
|
+
process.exit(1);
|
|
69
|
+
}
|
|
70
|
+
// Generate wrapped summary
|
|
71
|
+
const summary = (0, wrappedGenerator_js_1.generateYearWrapped)(yearNum, path, options.compare || false);
|
|
72
|
+
spinner.succeed(chalk_1.default.green('Analysis complete!'));
|
|
73
|
+
if (options.html) {
|
|
74
|
+
// Generate HTML
|
|
75
|
+
const htmlPath = (0, wrappedHtmlGenerator_js_1.generateWrappedHTML)(summary);
|
|
76
|
+
console.log(chalk_1.default.green(`\n✨ HTML slideshow generated: ${htmlPath}`));
|
|
77
|
+
// Open in browser
|
|
78
|
+
const platform = process.platform;
|
|
79
|
+
const openCommand = platform === 'win32' ? 'start' : platform === 'darwin' ? 'open' : 'xdg-open';
|
|
80
|
+
(0, child_process_1.execSync)(`${openCommand} "${htmlPath}"`, { stdio: 'ignore' });
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
// Generate slides
|
|
84
|
+
const slides = (0, slideGenerator_js_1.generateSlides)(summary);
|
|
85
|
+
// Display interactive slideshow
|
|
86
|
+
console.log();
|
|
87
|
+
(0, wrappedDisplay_js_1.displayWrappedSlideshow)(slides);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
catch (error) {
|
|
91
|
+
spinner.fail(chalk_1.default.red('Failed to generate wrapped summary'));
|
|
92
|
+
console.error(chalk_1.default.red(error.message));
|
|
93
|
+
process.exit(1);
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
program.parse(process.argv);
|
|
97
|
+
if (!process.argv.slice(2).length) {
|
|
98
|
+
program.outputHelp();
|
|
99
|
+
}
|
package/dist/types/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|