feat(server): port /describe and /improve tools + real analytics

Phase 8 (extras) complete:
- describe.ts — full port of pr_description: type/title/description/diagram/
  per-file walkthrough table, PATCH /pulls to update description, optional
  labels. Verified live: PR #19 body updated with AI description (Type,
  Description bullets, mermaid diagram, file walkthrough table).
- improve.ts — full port of pr_code_suggestions summarize path:
  getPrMultiDiffs chunking, parallel LLM calls, score filtering, category
  table with unified diff snippets + persistent comment with history.
  Verified live: persistent update of existing '## PR Code Suggestions ✨'
  comment (updated_at 07:26:53) with new table.
- prompts.ts — verbatim pr_description_prompts.toml + code_suggestions prompts
- github.ts — getLineLink (SHA-256 diff anchor like pr_agent), getLabels,
  updateDescription (pulls.update); getPrMultiDiffs in diff.ts
- index.ts — real analytics: readLegacy pr-agent.*.log files (mtime-sorted,
  fixes pid-filename ordering bug), logReviewEvent writes legacy-format
  events, /api/metrics + /api/analytics now serve real data (427 events,
  per-command breakdown)
- cli.ts — --tool review|describe|improve
- tests 16/16, tsc clean
This commit is contained in:
asepharyana committed 2026-09-21 14:36:02 +07:00
1 parent bc69998d8e
commit 608b52a0e5
9 files changed
+1456 -10

No files matched your search

+17
View File
@@ -36,6 +36,12 @@ export interface Config {
prDescription: {
maxAiCalls: number;
enableLargePrHandling: boolean;
enablePrType: boolean;
enablePrDescription: boolean;
enablePrDiagram: boolean;
publishDescriptionAsComment: boolean;
publishLabels: boolean;
finalUpdateMessage: boolean;
};
// git/diff
patchExtraLinesBefore: number;
@@ -141,6 +147,17 @@ export function loadConfig(): Config {
maxAiCalls: envInt("PR_AGENT_MAX_AI_CALLS", 4),
enableLargePrHandling:
(env.PR_AGENT_LARGE_PR_HANDLING ?? "true").toLowerCase() === "true",
enablePrType: (env.PR_AGENT_DESC_ENABLE_TYPE ?? "true").toLowerCase() === "true",
enablePrDescription:
(env.PR_AGENT_DESC_ENABLE_DESCRIPTION ?? "true").toLowerCase() === "true",
enablePrDiagram:
(env.PR_AGENT_DESC_ENABLE_DIAGRAM ?? "true").toLowerCase() === "true",
publishDescriptionAsComment:
(env.PR_AGENT_DESC_PUBLISH_AS_COMMENT ?? "false").toLowerCase() === "true",
publishLabels:
(env.PR_AGENT_DESC_PUBLISH_LABELS ?? "false").toLowerCase() === "true",
finalUpdateMessage:
(env.PR_AGENT_DESC_FINAL_UPDATE ?? "true").toLowerCase() === "true",
},
patchExtraLinesBefore: envInt("PR_AGENT_PATCH_EXTRA_BEFORE", 5),
patchExtraLinesAfter: envInt("PR_AGENT_PATCH_EXTRA_AFTER", 1),