feat(prd-1): implement M7 - entry point + mode handler integration
- Tag mode routes to fetchForgejoData vs fetchGitHubData based on platform - createInitialComment auto-detects platform for Forgejo spinner/URL format - update-comment-link uses updateForgejoCommentBody + Forgejo PR compare URL - update-with-branch uses platform-aware branch/job-run link formatting - Agent mode needed NO changes (token in run.ts, rest uses Octokit REST) - 11 new integration tests in test/m7-integration.test.ts - 785 tests pass, typecheck clean, format clean Progress: 78% complete (7/9 milestones) - M3, M8, M9 remaining Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
ce1459fe7f
commit
88401255be
7 files changed
+315
-29
No files matched your search
@@ -7,6 +7,11 @@ import {
|
||||
updateCommentBody,
|
||||
type CommentUpdateInput,
|
||||
} from "../github/operations/comment-logic";
|
||||
import {
|
||||
updateForgejoCommentBody,
|
||||
createForgejoPrCompareUrl,
|
||||
} from "../forgejo/comment-logic";
|
||||
import { detectPlatform } from "../platform/detector";
|
||||
import {
|
||||
parseGitHubContext,
|
||||
isPullRequestReviewCommentEvent,
|
||||
@@ -46,6 +51,7 @@ export async function updateCommentLink(
|
||||
} = params;
|
||||
|
||||
const { owner, repo } = context.repository;
|
||||
const platform = detectPlatform();
|
||||
|
||||
const serverUrl = GITHUB_SERVER_URL;
|
||||
const jobUrl = `${serverUrl}/${owner}/${repo}/actions/runs/${process.env.GITHUB_RUN_ID}`;
|
||||
@@ -145,13 +151,26 @@ export async function updateCommentLink(
|
||||
(comparison.files && comparison.files.length > 0)
|
||||
) {
|
||||
const entityType = context.isPR ? "PR" : "Issue";
|
||||
const prTitle = encodeURIComponent(
|
||||
`${entityType} #${context.entityNumber}: Changes from Claude`,
|
||||
);
|
||||
const prBody = encodeURIComponent(
|
||||
`This PR addresses ${entityType.toLowerCase()} #${context.entityNumber}\n\nGenerated with [Claude Code](https://claude.ai/code)`,
|
||||
);
|
||||
const prUrl = `${serverUrl}/${owner}/${repo}/compare/${baseBranch}...${claudeBranch}?quick_pull=1&title=${prTitle}&body=${prBody}`;
|
||||
const titleText = `${entityType} #${context.entityNumber}: Changes from Claude`;
|
||||
const bodyText = `This PR addresses ${entityType.toLowerCase()} #${context.entityNumber}\n\nGenerated with [Claude Code](https://claude.ai/code)`;
|
||||
|
||||
let prUrl: string;
|
||||
if (platform === "forgejo") {
|
||||
// Forgejo doesn't support quick_pull=1
|
||||
prUrl = createForgejoPrCompareUrl(
|
||||
serverUrl,
|
||||
owner,
|
||||
repo,
|
||||
baseBranch,
|
||||
claudeBranch,
|
||||
titleText,
|
||||
bodyText,
|
||||
);
|
||||
} else {
|
||||
const prTitle = encodeURIComponent(titleText);
|
||||
const prBody = encodeURIComponent(bodyText);
|
||||
prUrl = `${serverUrl}/${owner}/${repo}/compare/${baseBranch}...${claudeBranch}?quick_pull=1&title=${prTitle}&body=${prBody}`;
|
||||
}
|
||||
prLink = `\n[Create a PR](${prUrl})`;
|
||||
}
|
||||
} catch (error) {
|
||||
@@ -217,7 +236,10 @@ export async function updateCommentLink(
|
||||
errorDetails,
|
||||
};
|
||||
|
||||
const updatedBody = updateCommentBody(commentInput);
|
||||
const updatedBody =
|
||||
platform === "forgejo"
|
||||
? updateForgejoCommentBody(commentInput)
|
||||
: updateCommentBody(commentInput);
|
||||
|
||||
try {
|
||||
await updateClaudeComment(octokit.rest, {
|
||||
|
||||
Reference in new issue
Block a user