feat: コミットレポートツール(コミネコ)初期コミット

Made-with: Cursor
This commit is contained in:
hiroki ito
2026-04-03 19:31:32 +09:00
commit c872debe4b
29 changed files with 4344 additions and 0 deletions
@@ -0,0 +1,45 @@
function getYesterdayJST() {
const now = new Date();
const jstOffset = 9 * 60 * 60 * 1000;
const jstNow = new Date(now.getTime() + jstOffset);
const yesterday = new Date(jstNow);
yesterday.setUTCDate(yesterday.getUTCDate() - 1);
const year = yesterday.getUTCFullYear();
const month = yesterday.getUTCMonth();
const day = yesterday.getUTCDate();
const start = new Date(Date.UTC(year, month, day, 0, 0, 0));
start.setTime(start.getTime() - jstOffset);
const end = new Date(Date.UTC(year, month, day, 23, 59, 59));
end.setTime(end.getTime() - jstOffset);
const dateStr = `${year}-${String(month + 1).padStart(2, '0')}-${String(day).padStart(2, '0')}`;
return {
date: dateStr,
startUTC: start.toISOString().replace('.000Z', 'Z'),
endUTC: end.toISOString().replace('.000Z', 'Z')
};
}
function getTargetDateJST(dateStr) {
const [year, month, day] = dateStr.split('-').map(Number);
const jstOffset = 9 * 60 * 60 * 1000;
const start = new Date(Date.UTC(year, month - 1, day, 0, 0, 0));
start.setTime(start.getTime() - jstOffset);
const end = new Date(Date.UTC(year, month - 1, day, 23, 59, 59));
end.setTime(end.getTime() - jstOffset);
return {
date: dateStr,
startUTC: start.toISOString().replace('.000Z', 'Z'),
endUTC: end.toISOString().replace('.000Z', 'Z')
};
}
module.exports = { getYesterdayJST, getTargetDateJST };
@@ -0,0 +1,30 @@
const crypto = require('crypto');
function normalizeCommits(rawCommits) {
return rawCommits.map(commit => {
let author;
if (commit.author?.login && commit.author?.avatar_url) {
author = { login: commit.author.login, avatar_url: commit.author.avatar_url };
} else {
const email = commit.commit?.author?.email || '';
const name = commit.commit?.author?.name || 'Unknown';
const hash = email
? crypto.createHash('md5').update(email.toLowerCase().trim()).digest('hex')
: '00000000000000000000000000000000';
author = {
login: name,
avatar_url: `https://www.gravatar.com/avatar/${hash}?d=identicon&s=80`
};
console.error(`[Avatar] フォールバック: ${name} (${commit.sha.substring(0, 7)})`);
}
return {
sha: commit.sha,
message: commit.commit.message,
date: commit.commit.author.date,
author,
html_url: commit.html_url
};
});
}
module.exports = { normalizeCommits };