@akiojin/claude-worktree
Version:
Interactive Git worktree manager for Claude Code with graphical branch selection
52 lines • 1.54 kB
JavaScript
/**
* GitHub操作のビジネスロジックを管理するService
*/
export class GitHubService {
repository;
constructor(repository) {
this.repository = repository;
}
async isAvailable() {
return await this.repository.isAvailable();
}
async checkAuthentication() {
return await this.repository.isAuthenticated();
}
async getMergedPullRequests() {
// リモート情報を更新
await this.repository.fetchRemoteUpdates();
const prs = await this.repository.fetchPullRequests({
state: 'merged',
limit: 100
});
return prs
.filter(pr => pr.mergedAt !== null)
.map(pr => ({
number: pr.number,
title: pr.title,
branch: pr.headRefName,
mergedAt: pr.mergedAt, // filterで null を除外済み
author: pr.author?.login || 'unknown'
}));
}
async getPullRequestByBranch(branchName) {
const prs = await this.repository.fetchPullRequests({
head: branchName,
state: 'all',
limit: 1
});
if (prs.length === 0 || !prs[0]) {
return null;
}
const pr = prs[0];
return {
number: pr.number,
title: pr.title,
state: pr.state,
branch: pr.headRefName,
mergedAt: pr.mergedAt,
author: pr.author?.login || 'unknown'
};
}
}
//# sourceMappingURL=github.service.js.map