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.
Files changed (38) hide show
  1. package/dist/commands/generate.js +104 -95
  2. package/dist/constants/chronotypes.js +23 -23
  3. package/dist/constants/colors.js +18 -18
  4. package/dist/constants/index.js +18 -18
  5. package/dist/formatters/index.js +17 -17
  6. package/dist/formatters/timeFormatter.js +28 -29
  7. package/dist/generators/html/templates/achievementsSection.js +42 -43
  8. package/dist/generators/html/templates/commitQualitySection.js +25 -26
  9. package/dist/generators/html/templates/contributionGraph.js +64 -48
  10. package/dist/generators/html/templates/impactSection.js +19 -20
  11. package/dist/generators/html/templates/knowledgeSection.js +86 -87
  12. package/dist/generators/html/templates/streakSection.js +8 -9
  13. package/dist/generators/html/templates/timePatternsSection.js +45 -46
  14. package/dist/generators/html/utils/colorUtils.js +61 -21
  15. package/dist/generators/html/utils/commitMapBuilder.js +23 -24
  16. package/dist/generators/html/utils/dateRangeCalculator.js +56 -57
  17. package/dist/generators/html/utils/developerStatsCalculator.js +28 -29
  18. package/dist/generators/html/utils/scriptLoader.js +15 -16
  19. package/dist/generators/html/utils/styleLoader.js +17 -18
  20. package/dist/generators/html/utils/weekGrouper.js +27 -28
  21. package/dist/index.js +78 -78
  22. package/dist/types/index.js +2 -2
  23. package/dist/utils/achievementDefinitions.js +433 -433
  24. package/dist/utils/achievementEngine.js +169 -170
  25. package/dist/utils/commitQualityAnalyzer.js +367 -368
  26. package/dist/utils/fileHotspotAnalyzer.js +269 -270
  27. package/dist/utils/gitParser.js +136 -126
  28. package/dist/utils/htmlGenerator.js +245 -233
  29. package/dist/utils/impactAnalyzer.js +247 -248
  30. package/dist/utils/knowledgeDistributionAnalyzer.js +380 -374
  31. package/dist/utils/matrixGenerator.js +369 -350
  32. package/dist/utils/slideGenerator.js +170 -171
  33. package/dist/utils/streakCalculator.js +134 -135
  34. package/dist/utils/timePatternAnalyzer.js +304 -305
  35. package/dist/utils/wrappedDisplay.js +124 -115
  36. package/dist/utils/wrappedGenerator.js +376 -377
  37. package/dist/utils/wrappedHtmlGenerator.js +105 -106
  38. package/package.json +10 -10
@@ -1,135 +1,134 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getStreakMotivation = exports.calculateStreaks = void 0;
4
- const date_fns_1 = require("date-fns");
5
- function calculateStreaks(commits, startDate, endDate) {
6
- // Create set of unique commit dates
7
- const commitDates = new Set();
8
- commits.forEach(commit => {
9
- const commitDate = new Date(commit.date);
10
- if (commitDate >= startDate && commitDate <= endDate) {
11
- commitDates.add((0, date_fns_1.format)(commitDate, 'yyyy-MM-dd'));
12
- }
13
- });
14
- // Calculate total days and active days
15
- const totalDays = (0, date_fns_1.differenceInDays)(endDate, startDate) + 1;
16
- const totalActiveDays = commitDates.size;
17
- const activeDayPercentage = totalDays > 0 ? (totalActiveDays / totalDays) * 100 : 0;
18
- // Find all streaks
19
- const streaks = [];
20
- let currentStreakDays = 0;
21
- let currentStreakStart = null;
22
- const allDays = (0, date_fns_1.eachDayOfInterval)({ start: startDate, end: endDate });
23
- for (const date of allDays) {
24
- const dateKey = (0, date_fns_1.format)(date, 'yyyy-MM-dd');
25
- if (commitDates.has(dateKey)) {
26
- if (currentStreakDays === 0) {
27
- currentStreakStart = date;
28
- }
29
- currentStreakDays++;
30
- }
31
- else {
32
- if (currentStreakDays > 0 && currentStreakStart) {
33
- streaks.push({
34
- days: currentStreakDays,
35
- startDate: currentStreakStart,
36
- endDate: (0, date_fns_1.subDays)(date, 1)
37
- });
38
- currentStreakDays = 0;
39
- currentStreakStart = null;
40
- }
41
- }
42
- }
43
- // Handle streak that extends to end date
44
- if (currentStreakDays > 0 && currentStreakStart) {
45
- streaks.push({
46
- days: currentStreakDays,
47
- startDate: currentStreakStart,
48
- endDate: endDate
49
- });
50
- }
51
- // Find longest streak
52
- const longestStreak = streaks.length > 0
53
- ? streaks.reduce((longest, current) => current.days > longest.days ? current : longest)
54
- : { days: 0, startDate: startDate, endDate: startDate };
55
- // Determine current streak (from today or most recent commit going backward)
56
- const today = new Date();
57
- const todayKey = (0, date_fns_1.format)(today, 'yyyy-MM-dd');
58
- let currentStreak;
59
- if (commitDates.has(todayKey)) {
60
- // Today has a commit, find streak from today backward
61
- let streakDays = 0;
62
- let checkDate = today;
63
- while (commitDates.has((0, date_fns_1.format)(checkDate, 'yyyy-MM-dd'))) {
64
- streakDays++;
65
- checkDate = (0, date_fns_1.subDays)(checkDate, 1);
66
- if (checkDate < startDate)
67
- break;
68
- }
69
- currentStreak = {
70
- days: streakDays,
71
- startDate: (0, date_fns_1.subDays)(today, streakDays - 1),
72
- endDate: today,
73
- isActive: true
74
- };
75
- }
76
- else {
77
- // No commit today, check if yesterday had commit (streak just broke)
78
- const yesterday = (0, date_fns_1.subDays)(today, 1);
79
- const yesterdayKey = (0, date_fns_1.format)(yesterday, 'yyyy-MM-dd');
80
- if (commitDates.has(yesterdayKey)) {
81
- let streakDays = 0;
82
- let checkDate = yesterday;
83
- while (commitDates.has((0, date_fns_1.format)(checkDate, 'yyyy-MM-dd'))) {
84
- streakDays++;
85
- checkDate = (0, date_fns_1.subDays)(checkDate, 1);
86
- if (checkDate < startDate)
87
- break;
88
- }
89
- currentStreak = {
90
- days: streakDays,
91
- startDate: (0, date_fns_1.subDays)(yesterday, streakDays - 1),
92
- endDate: yesterday,
93
- isActive: false
94
- };
95
- }
96
- else {
97
- // No recent streak
98
- currentStreak = {
99
- days: 0,
100
- startDate: today,
101
- endDate: today,
102
- isActive: false
103
- };
104
- }
105
- }
106
- return {
107
- currentStreak,
108
- longestStreak,
109
- totalActiveDays,
110
- totalDays,
111
- activeDayPercentage,
112
- streaks
113
- };
114
- }
115
- exports.calculateStreaks = calculateStreaks;
116
- function getStreakMotivation(days, isActive) {
117
- if (days === 0) {
118
- return "Start building momentum today";
119
- }
120
- if (!isActive) {
121
- return `Your ${days}-day streak ended. Time for a fresh start.`;
122
- }
123
- if (days >= 61)
124
- return "Outstanding consistency";
125
- if (days >= 31)
126
- return "Exceptional dedication";
127
- if (days >= 15)
128
- return "Strong momentum 🔥";
129
- if (days >= 8)
130
- return "Solid consistency";
131
- if (days >= 4)
132
- return "Building momentum";
133
- return "Just getting started";
134
- }
135
- exports.getStreakMotivation = getStreakMotivation;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.calculateStreaks = calculateStreaks;
4
+ exports.getStreakMotivation = getStreakMotivation;
5
+ const date_fns_1 = require("date-fns");
6
+ function calculateStreaks(commits, startDate, endDate) {
7
+ // Create set of unique commit dates
8
+ const commitDates = new Set();
9
+ commits.forEach(commit => {
10
+ const commitDate = new Date(commit.date);
11
+ if (commitDate >= startDate && commitDate <= endDate) {
12
+ commitDates.add((0, date_fns_1.format)(commitDate, 'yyyy-MM-dd'));
13
+ }
14
+ });
15
+ // Calculate total days and active days
16
+ const totalDays = (0, date_fns_1.differenceInDays)(endDate, startDate) + 1;
17
+ const totalActiveDays = commitDates.size;
18
+ const activeDayPercentage = totalDays > 0 ? (totalActiveDays / totalDays) * 100 : 0;
19
+ // Find all streaks
20
+ const streaks = [];
21
+ let currentStreakDays = 0;
22
+ let currentStreakStart = null;
23
+ const allDays = (0, date_fns_1.eachDayOfInterval)({ start: startDate, end: endDate });
24
+ for (const date of allDays) {
25
+ const dateKey = (0, date_fns_1.format)(date, 'yyyy-MM-dd');
26
+ if (commitDates.has(dateKey)) {
27
+ if (currentStreakDays === 0) {
28
+ currentStreakStart = date;
29
+ }
30
+ currentStreakDays++;
31
+ }
32
+ else {
33
+ if (currentStreakDays > 0 && currentStreakStart) {
34
+ streaks.push({
35
+ days: currentStreakDays,
36
+ startDate: currentStreakStart,
37
+ endDate: (0, date_fns_1.subDays)(date, 1)
38
+ });
39
+ currentStreakDays = 0;
40
+ currentStreakStart = null;
41
+ }
42
+ }
43
+ }
44
+ // Handle streak that extends to end date
45
+ if (currentStreakDays > 0 && currentStreakStart) {
46
+ streaks.push({
47
+ days: currentStreakDays,
48
+ startDate: currentStreakStart,
49
+ endDate: endDate
50
+ });
51
+ }
52
+ // Find longest streak
53
+ const longestStreak = streaks.length > 0
54
+ ? streaks.reduce((longest, current) => current.days > longest.days ? current : longest)
55
+ : { days: 0, startDate: startDate, endDate: startDate };
56
+ // Determine current streak (from today or most recent commit going backward)
57
+ const today = new Date();
58
+ const todayKey = (0, date_fns_1.format)(today, 'yyyy-MM-dd');
59
+ let currentStreak;
60
+ if (commitDates.has(todayKey)) {
61
+ // Today has a commit, find streak from today backward
62
+ let streakDays = 0;
63
+ let checkDate = today;
64
+ while (commitDates.has((0, date_fns_1.format)(checkDate, 'yyyy-MM-dd'))) {
65
+ streakDays++;
66
+ checkDate = (0, date_fns_1.subDays)(checkDate, 1);
67
+ if (checkDate < startDate)
68
+ break;
69
+ }
70
+ currentStreak = {
71
+ days: streakDays,
72
+ startDate: (0, date_fns_1.subDays)(today, streakDays - 1),
73
+ endDate: today,
74
+ isActive: true
75
+ };
76
+ }
77
+ else {
78
+ // No commit today, check if yesterday had commit (streak just broke)
79
+ const yesterday = (0, date_fns_1.subDays)(today, 1);
80
+ const yesterdayKey = (0, date_fns_1.format)(yesterday, 'yyyy-MM-dd');
81
+ if (commitDates.has(yesterdayKey)) {
82
+ let streakDays = 0;
83
+ let checkDate = yesterday;
84
+ while (commitDates.has((0, date_fns_1.format)(checkDate, 'yyyy-MM-dd'))) {
85
+ streakDays++;
86
+ checkDate = (0, date_fns_1.subDays)(checkDate, 1);
87
+ if (checkDate < startDate)
88
+ break;
89
+ }
90
+ currentStreak = {
91
+ days: streakDays,
92
+ startDate: (0, date_fns_1.subDays)(yesterday, streakDays - 1),
93
+ endDate: yesterday,
94
+ isActive: false
95
+ };
96
+ }
97
+ else {
98
+ // No recent streak
99
+ currentStreak = {
100
+ days: 0,
101
+ startDate: today,
102
+ endDate: today,
103
+ isActive: false
104
+ };
105
+ }
106
+ }
107
+ return {
108
+ currentStreak,
109
+ longestStreak,
110
+ totalActiveDays,
111
+ totalDays,
112
+ activeDayPercentage,
113
+ streaks
114
+ };
115
+ }
116
+ function getStreakMotivation(days, isActive) {
117
+ if (days === 0) {
118
+ return "Start building momentum today";
119
+ }
120
+ if (!isActive) {
121
+ return `Your ${days}-day streak ended. Time for a fresh start.`;
122
+ }
123
+ if (days >= 61)
124
+ return "Outstanding consistency";
125
+ if (days >= 31)
126
+ return "Exceptional dedication";
127
+ if (days >= 15)
128
+ return "Strong momentum 🔥";
129
+ if (days >= 8)
130
+ return "Solid consistency";
131
+ if (days >= 4)
132
+ return "Building momentum";
133
+ return "Just getting started";
134
+ }