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,126 +1,136 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.getRepositoryUrl = exports.getRepositoryName = exports.getCurrentGitUser = exports.parseGitCommits = exports.parseCommitData = exports.getCommitHistory = void 0;
27
- const child_process_1 = require("child_process");
28
- const path = __importStar(require("path"));
29
- const GIT_LOG_FORMAT = '--pretty=format:"%H|%an|%aI|%s"';
30
- const getCommitHistory = (repoPath) => {
31
- try {
32
- const output = (0, child_process_1.execSync)(`git log ${GIT_LOG_FORMAT}`, {
33
- cwd: repoPath,
34
- encoding: 'utf-8',
35
- maxBuffer: 50 * 1024 * 1024, // 50MB buffer for large repos
36
- });
37
- return output;
38
- }
39
- catch (error) {
40
- throw new Error(`Error retrieving commit history: ${error.message}`);
41
- }
42
- };
43
- exports.getCommitHistory = getCommitHistory;
44
- const parseCommitData = (commitData) => {
45
- if (!commitData || commitData.trim() === '') {
46
- return [];
47
- }
48
- return commitData.split('\n')
49
- .filter(line => line.trim())
50
- .map(line => {
51
- const parts = line.split('|');
52
- if (parts.length < 4) {
53
- return null;
54
- }
55
- const [hash, author, date, ...messageParts] = parts;
56
- const message = messageParts.join('|'); // Rejoin in case message contains |
57
- return { hash, author, date, message };
58
- })
59
- .filter((commit) => commit !== null &&
60
- Boolean(commit.hash) &&
61
- Boolean(commit.author) &&
62
- Boolean(commit.date));
63
- };
64
- exports.parseCommitData = parseCommitData;
65
- const parseGitCommits = (repoPath) => {
66
- const commitHistory = (0, exports.getCommitHistory)(repoPath);
67
- return (0, exports.parseCommitData)(commitHistory);
68
- };
69
- exports.parseGitCommits = parseGitCommits;
70
- const getCurrentGitUser = (repoPath) => {
71
- try {
72
- const name = (0, child_process_1.execSync)('git config user.name', {
73
- cwd: repoPath,
74
- encoding: 'utf-8',
75
- }).trim();
76
- return name || 'Unknown';
77
- }
78
- catch (error) {
79
- return 'Unknown';
80
- }
81
- };
82
- exports.getCurrentGitUser = getCurrentGitUser;
83
- const getRepositoryName = (repoPath) => {
84
- try {
85
- // Try to get from remote URL first
86
- const remoteUrl = (0, child_process_1.execSync)('git config --get remote.origin.url', {
87
- cwd: repoPath,
88
- encoding: 'utf-8',
89
- }).trim();
90
- if (remoteUrl) {
91
- // Extract repo name from URL (e.g., "owner/repo" or just "repo")
92
- const match = remoteUrl.match(/([^\/]+\/[^\/]+?)(\.git)?$/) || remoteUrl.match(/([^\/]+?)(\.git)?$/);
93
- if (match) {
94
- return match[1].replace('.git', '');
95
- }
96
- }
97
- }
98
- catch (error) {
99
- // If git remote fails, fall back to directory name
100
- }
101
- // Fallback to directory name
102
- return path.basename(path.resolve(repoPath));
103
- };
104
- exports.getRepositoryName = getRepositoryName;
105
- const getRepositoryUrl = (repoPath) => {
106
- try {
107
- const remoteUrl = (0, child_process_1.execSync)('git config --get remote.origin.url', {
108
- cwd: repoPath,
109
- encoding: 'utf-8',
110
- }).trim();
111
- if (remoteUrl) {
112
- // Convert SSH URL to HTTPS for display
113
- if (remoteUrl.startsWith('git@')) {
114
- return remoteUrl
115
- .replace(/^git@([^:]+):/, 'https://$1/')
116
- .replace(/\.git$/, '');
117
- }
118
- return remoteUrl.replace(/\.git$/, '');
119
- }
120
- }
121
- catch (error) {
122
- // No remote URL available
123
- }
124
- return '';
125
- };
126
- exports.getRepositoryUrl = getRepositoryUrl;
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.getRepositoryUrl = exports.getRepositoryName = exports.getCurrentGitUser = exports.parseGitCommits = exports.parseCommitData = exports.getCommitHistory = void 0;
37
+ const child_process_1 = require("child_process");
38
+ const path = __importStar(require("path"));
39
+ const GIT_LOG_FORMAT = '--pretty=format:"%H|%an|%aI|%s"';
40
+ const getCommitHistory = (repoPath) => {
41
+ try {
42
+ const output = (0, child_process_1.execSync)(`git log ${GIT_LOG_FORMAT}`, {
43
+ cwd: repoPath,
44
+ encoding: 'utf-8',
45
+ maxBuffer: 50 * 1024 * 1024, // 50MB buffer for large repos
46
+ });
47
+ return output;
48
+ }
49
+ catch (error) {
50
+ throw new Error(`Error retrieving commit history: ${error.message}`);
51
+ }
52
+ };
53
+ exports.getCommitHistory = getCommitHistory;
54
+ const parseCommitData = (commitData) => {
55
+ if (!commitData || commitData.trim() === '') {
56
+ return [];
57
+ }
58
+ return commitData.split('\n')
59
+ .filter(line => line.trim())
60
+ .map(line => {
61
+ const parts = line.split('|');
62
+ if (parts.length < 4) {
63
+ return null;
64
+ }
65
+ const [hash, author, date, ...messageParts] = parts;
66
+ const message = messageParts.join('|'); // Rejoin in case message contains |
67
+ return { hash, author, date, message };
68
+ })
69
+ .filter((commit) => commit !== null &&
70
+ Boolean(commit.hash) &&
71
+ Boolean(commit.author) &&
72
+ Boolean(commit.date));
73
+ };
74
+ exports.parseCommitData = parseCommitData;
75
+ const parseGitCommits = (repoPath) => {
76
+ const commitHistory = (0, exports.getCommitHistory)(repoPath);
77
+ return (0, exports.parseCommitData)(commitHistory);
78
+ };
79
+ exports.parseGitCommits = parseGitCommits;
80
+ const getCurrentGitUser = (repoPath) => {
81
+ try {
82
+ const name = (0, child_process_1.execSync)('git config user.name', {
83
+ cwd: repoPath,
84
+ encoding: 'utf-8',
85
+ }).trim();
86
+ return name || 'Unknown';
87
+ }
88
+ catch (error) {
89
+ return 'Unknown';
90
+ }
91
+ };
92
+ exports.getCurrentGitUser = getCurrentGitUser;
93
+ const getRepositoryName = (repoPath) => {
94
+ try {
95
+ // Try to get from remote URL first
96
+ const remoteUrl = (0, child_process_1.execSync)('git config --get remote.origin.url', {
97
+ cwd: repoPath,
98
+ encoding: 'utf-8',
99
+ }).trim();
100
+ if (remoteUrl) {
101
+ // Extract repo name from URL (e.g., "owner/repo" or just "repo")
102
+ const match = remoteUrl.match(/([^\/]+\/[^\/]+?)(\.git)?$/) || remoteUrl.match(/([^\/]+?)(\.git)?$/);
103
+ if (match) {
104
+ return match[1].replace('.git', '');
105
+ }
106
+ }
107
+ }
108
+ catch (error) {
109
+ // If git remote fails, fall back to directory name
110
+ }
111
+ // Fallback to directory name
112
+ return path.basename(path.resolve(repoPath));
113
+ };
114
+ exports.getRepositoryName = getRepositoryName;
115
+ const getRepositoryUrl = (repoPath) => {
116
+ try {
117
+ const remoteUrl = (0, child_process_1.execSync)('git config --get remote.origin.url', {
118
+ cwd: repoPath,
119
+ encoding: 'utf-8',
120
+ }).trim();
121
+ if (remoteUrl) {
122
+ // Convert SSH URL to HTTPS for display
123
+ if (remoteUrl.startsWith('git@')) {
124
+ return remoteUrl
125
+ .replace(/^git@([^:]+):/, 'https://$1/')
126
+ .replace(/\.git$/, '');
127
+ }
128
+ return remoteUrl.replace(/\.git$/, '');
129
+ }
130
+ }
131
+ catch (error) {
132
+ // No remote URL available
133
+ }
134
+ return '';
135
+ };
136
+ exports.getRepositoryUrl = getRepositoryUrl;