diff --git a/.gitignore b/.gitignore index e6aa663..fab0d5d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .DS_Store +__pycache__/ .ralph .serena diff --git a/architect-review/action.yml b/architect-review/action.yml index 833c052..ec9bce8 100644 --- a/architect-review/action.yml +++ b/architect-review/action.yml @@ -281,6 +281,8 @@ runs: - Then a short summary of the architectural analysis - Then "阻塞项" / "Blocking Issues" listing architecture issues that should block merge; if none, write "阻塞项:无" / "Blocking Issues: None" - Then "建议项" / "Suggestions" listing non-blocking architecture improvements; if none, write "建议项:无" / "Suggestions: None" + + IMPORTANT: Never use #N format (e.g. #1, #2) to number items. GitHub auto-converts #N to issue/PR references. Use 1. 2. 3. or - list format instead. 请勿使用 #N 格式编号,GitHub 会将其转为 issue/PR 引用。 PROMPT_EOF ) fi diff --git a/feature-missing/action.yml b/feature-missing/action.yml index 6cee946..7ae5309 100644 --- a/feature-missing/action.yml +++ b/feature-missing/action.yml @@ -112,6 +112,8 @@ inputs: Minor gaps, nice-to-have features, or documentation discrepancies. For each gap: describe what's missing, reference the relevant spec section, and suggest where the implementation should be added. - If verdict is "无遗漏" / "NO GAPS", briefly confirm all spec items are covered — do NOT include any severity sections. + + IMPORTANT: Never use #N format (e.g. #1, #2) to number items. GitHub auto-converts #N to issue/PR references. Use 1. 2. 3. or - list format instead. 请勿使用 #N 格式编号,GitHub 会将其转为 issue/PR 引用。 use-github-token: description: Value exported as USE_GITHUB_TOKEN before running `opencode github run`. required: false diff --git a/github-run-opencode/run-github-opencode.py b/github-run-opencode/run-github-opencode.py index 2060001..1d0c847 100755 --- a/github-run-opencode/run-github-opencode.py +++ b/github-run-opencode/run-github-opencode.py @@ -458,6 +458,12 @@ def _main() -> int: zh_instruction = ( "\n\n请使用中文回复。所有分析和说明均使用中文。" "对于 prompt 中列出的判定关键词,使用其中文版本。" + "\n请勿使用 #N 格式(如 #1、#2)编号,GitHub 会自动将其转换为 issue/PR 引用。请使用 1. 2. 3. 或 - 的列表格式。" + ) + en_hash_instruction = ( + " Never use #N format (e.g. #1, #2) to number items — " + "GitHub auto-converts #N to issue/PR references. " + "Use 1. 2. 3. or - list format instead." ) if existing_prompt: if language == "en": @@ -466,6 +472,7 @@ def _main() -> int: + "\n\nIMPORTANT: Respond entirely in English. " "Use English for all analysis, explanations, and output. " "For any verdict keywords listed in the prompt, use their English equivalents." + + en_hash_instruction )) elif language == "zh": set_env("PROMPT", existing_prompt + zh_instruction) diff --git a/multi-review/reviewers/architecture.yaml b/multi-review/reviewers/architecture.yaml index b0f8573..4481422 100644 --- a/multi-review/reviewers/architecture.yaml +++ b/multi-review/reviewers/architecture.yaml @@ -29,3 +29,5 @@ prompt: | - Then a short summary of architecture analysis - Then "阻塞项" / "Blocking Issues" listing architecture issues that must block merge; if none, write "阻塞项:无" / "Blocking Issues: None" - Then "建议项" / "Suggestions" listing non-blocking architecture improvements; if none, write "建议项:无" / "Suggestions: None" + + IMPORTANT: Never use #N format (e.g. #1, #2) to number items. GitHub auto-converts #N to issue/PR references. Use 1. 2. 3. or - list format instead. 请勿使用 #N 格式编号,GitHub 会将其转为 issue/PR 引用。 diff --git a/multi-review/reviewers/performance.yaml b/multi-review/reviewers/performance.yaml index f5385f9..0afeb61 100644 --- a/multi-review/reviewers/performance.yaml +++ b/multi-review/reviewers/performance.yaml @@ -30,3 +30,5 @@ prompt: | - Then a short summary of performance analysis - Then "阻塞项" / "Blocking Issues" listing performance issues that must block merge; if none, write "阻塞项:无" / "Blocking Issues: None" - Then "建议项" / "Suggestions" listing non-blocking performance improvements; if none, write "建议项:无" / "Suggestions: None" + + IMPORTANT: Never use #N format (e.g. #1, #2) to number items. GitHub auto-converts #N to issue/PR references. Use 1. 2. 3. or - list format instead. 请勿使用 #N 格式编号,GitHub 会将其转为 issue/PR 引用。 diff --git a/multi-review/reviewers/quality.yaml b/multi-review/reviewers/quality.yaml index 3cc75ef..82d41b7 100644 --- a/multi-review/reviewers/quality.yaml +++ b/multi-review/reviewers/quality.yaml @@ -28,3 +28,5 @@ prompt: | - Then a short summary - Then "阻塞项" / "Blocking Issues" listing required fixes for merge; if none, write "阻塞项:无" / "Blocking Issues: None" - Then "建议项" / "Suggestions" listing non-blocking improvements; if none, write "建议项:无" / "Suggestions: None" + + IMPORTANT: Never use #N format (e.g. #1, #2) to number items. GitHub auto-converts #N to issue/PR references. Use 1. 2. 3. or - list format instead. 请勿使用 #N 格式编号,GitHub 会将其转为 issue/PR 引用。 diff --git a/multi-review/reviewers/security.yaml b/multi-review/reviewers/security.yaml index af3cc8b..5fb3e82 100644 --- a/multi-review/reviewers/security.yaml +++ b/multi-review/reviewers/security.yaml @@ -29,3 +29,5 @@ prompt: | - Then a short summary of security analysis - Then "阻塞项" / "Blocking Issues" listing security issues that must block merge; if none, write "阻塞项:无" / "Blocking Issues: None" - Then "建议项" / "Suggestions" listing non-blocking security improvements; if none, write "建议项:无" / "Suggestions: None" + + IMPORTANT: Never use #N format (e.g. #1, #2) to number items. GitHub auto-converts #N to issue/PR references. Use 1. 2. 3. or - list format instead. 请勿使用 #N 格式编号,GitHub 会将其转为 issue/PR 引用。 diff --git a/multi-review/src/orchestrator.ts b/multi-review/src/orchestrator.ts index 5f64d75..37462cc 100644 --- a/multi-review/src/orchestrator.ts +++ b/multi-review/src/orchestrator.ts @@ -25,7 +25,9 @@ Your task is to synthesize them into a single deduplicated report. - 第一行:最终决策(可合并 / CAN MERGE、有条件合并 / CONDITIONAL MERGE、不可合并 / CANNOT MERGE) - 然后简要总结 - "阻塞项" / "Blocking Issues"列出合并前必须修复的问题;如无,写"阻塞项:无" / "Blocking Issues: None" -- "建议项" / "Suggestions"列出非阻塞改进建议;如无,写"建议项:无" / "Suggestions: None"`; +- "建议项" / "Suggestions"列出非阻塞改进建议;如无,写"建议项:无" / "Suggestions: None" + +IMPORTANT: Never use #N format (e.g. #1, #2) to number items in your output. GitHub auto-converts #N to issue/PR references. Use 1. 2. 3. or - list format instead. 请勿使用 #N 格式编号,GitHub 会将其转为 issue/PR 引用。`; function extractText(messages: Array<{ info: { role: string }; parts: Array<{ type: string; text?: string }> }>): string { return messages diff --git a/multi-review/src/platform.ts b/multi-review/src/platform.ts index 87d7dea..d0dd218 100644 --- a/multi-review/src/platform.ts +++ b/multi-review/src/platform.ts @@ -148,22 +148,31 @@ function fetchAllGiteaComments(baseUrl: string, token: string): Array<{ id: numb return allComments; } +// ── Escape #N references ───────────────────────────────────────────── + +const HASH_NUM_RE = /(^|\s)#(\d{1,6})(?=[\s:.]|$)/gm; + +function escapeHashReferences(text: string): string { + return text.replace(HASH_NUM_RE, "$1#​$2"); +} + // ── Post PR comment (with PR-context guard) ─────────────────────────── export function postPRComment(body: string): void { + const escaped = escapeHashReferences(body); const prNumber = resolvePRNumber(); if (!prNumber) { console.log("Not in PR context, printing review to stdout:"); console.log("---"); - console.log(body); + console.log(escaped); return; } const platform = detectPlatform(); if (platform === "github") { - postCommentGithub(prNumber, body); + postCommentGithub(prNumber, escaped); } else { - postCommentGitea(prNumber, body); + postCommentGitea(prNumber, escaped); } } diff --git a/multi-review/src/reviewers.ts b/multi-review/src/reviewers.ts index 096f8bc..ae6009d 100644 --- a/multi-review/src/reviewers.ts +++ b/multi-review/src/reviewers.ts @@ -42,9 +42,11 @@ export function loadReviewers(opts: { const team = parseTeam(teamStr); const language = (env("MULTI_REVIEW_LANGUAGE") || "zh").trim().toLowerCase(); + const hashAvoidZh = "\n请勿使用 #N 格式(如 #1、#2)编号,GitHub 会自动将其转换为 issue/PR 引用。请使用 1. 2. 3. 或 - 的列表格式。"; + const hashAvoidEn = "\nNever use #N format (e.g. #1, #2) to number items — GitHub auto-converts #N to issue/PR references. Use 1. 2. 3. or - list format instead."; const langInstruction = language === "en" - ? "\n\nIMPORTANT: Respond entirely in English. Use English for all analysis, explanations, and output. For any verdict keywords listed in the prompt, use their English equivalents." - : "\n\n请使用中文回复。所有分析和说明均使用中文。对于 prompt 中列出的判定关键词,使用其中文版本。"; + ? "\n\nIMPORTANT: Respond entirely in English. Use English for all analysis, explanations, and output. For any verdict keywords listed in the prompt, use their English equivalents." + hashAvoidEn + : "\n\n请使用中文回复。所有分析和说明均使用中文。对于 prompt 中列出的判定关键词,使用其中文版本。" + hashAvoidZh; const reviewers: Reviewer[] = []; for (const [name, count] of team) { diff --git a/review/action.yml b/review/action.yml index 6c60ff5..47f7916 100644 --- a/review/action.yml +++ b/review/action.yml @@ -108,6 +108,8 @@ inputs: - Then a short summary - Then "阻塞项" / "Blocking Issues" listing required fixes for merge; if none, write "阻塞项:无" / "Blocking Issues: None" - Then "建议项" / "Suggestions" listing non-blocking improvements; if none, write "建议项:无" / "Suggestions: None" + + IMPORTANT: Never use #N format (e.g. #1, #2) to number items. GitHub auto-converts #N to issue/PR references. Use 1. 2. 3. or - list format instead. 请勿使用 #N 格式编号,GitHub 会将其转为 issue/PR 引用。 use-github-token: description: Value exported as USE_GITHUB_TOKEN before running `opencode github run`. required: false diff --git a/spec-coverage/action.yml b/spec-coverage/action.yml index 15c8023..e692f8e 100644 --- a/spec-coverage/action.yml +++ b/spec-coverage/action.yml @@ -124,6 +124,8 @@ inputs: Minor gaps — documentation, non-essential features, or nice-to-haves. For each gap: quote the spec task verbatim, describe what's missing in the implementation, and suggest which file(s) should be modified. - If verdict is "全覆盖" / "FULL COVERAGE", briefly confirm all spec tasks are covered — do NOT include any severity sections. + + IMPORTANT: Never use #N format (e.g. #1, #2) to number items. GitHub auto-converts #N to issue/PR references. Use 1. 2. 3. or - list format instead. 请勿使用 #N 格式编号,GitHub 会将其转为 issue/PR 引用。 use-github-token: description: Value exported as USE_GITHUB_TOKEN before running `opencode github run`. required: false