mirror of
https://github.com/mattermost/mattermost.git
synced 2026-11-04 13:16:45 -06:00
* docs: draft pages from merged Docs/Needed via author personas When a PR merges still carrying Docs/Needed, read the gap sticky comment, author MDX with the matching audience personas (pre-reviewed in-loop), and open docs/pr-<n>. Closing that draft flips Docs/Needed to Docs/Done. Retires the cross-repo docs-needed.yml workflow. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(docs-ai): harden writer fence parse, version check, and brief fallback Match CodeRabbit findings that still hold: outer fences of equal length so nested code samples survive; require the milestone version (not any vX.Y); fall back to PR evidence when the gap sticky is missing; narrow the App token. Keep pull_request (not pull_request_target) to match the gap pipeline's fork posture. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(docs-ai): tighten author path scope, ERROR halt, and sync provenance Restrict each author pass to its group targets; fail the loop on review ERROR instead of opening a half-reviewed draft; require same-repo head and DOCS_AI_BOT_LOGIN before flipping Docs/Done. Also cover additionsDiff edge cases and longest-prefix author matching. Co-authored-by: Cursor <cursoragent@cursor.com> * docs: lift observability and parity guidance into docs-writer prompt Carry the useful bits from draft_docs.md without restoring triage: parity vs net-new as a one-line scope rule, plus when to document logs/metrics. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(docs-ai): require author passes to cover every group target Emitted ⊆ allowlist was not enough — an incomplete pass could drop a named page. Reject initial omissions; keep prior groupFiles when a revision fails to re-emit every target. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(docs-ai): harden revision limit, impact paths, and anchor reject Validate DOCS_AI_MAX_REVISIONS as a non-negative integer; filter gap impact locations to allowed .md/.mdx before grouping; keep the prior pass when a revision drops the milestone version anchor. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(docs-ai): drop AI-Drafted label; frame unknown versions Identify drafts by App authorship instead of Docs/AI-Drafted. Require "From Mattermost [NOT PRESENT — …]" for unknown releases, and replace the DEBUG observability example with admin-facing cases. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(docs-ai): address writer review on sync, paths, and author context Require draft merge before Docs/Done, filter deny-listed paths at extraction, prefer branch provenance, pass existing pages into the author prompt, and tighten workflow input/credential handling. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(docs-ai): keep full page context on author and revision passes Reject oversized pages instead of truncating them, feed the in-memory draft into revision prompts, and tighten line-based MDX import/export checks. Co-authored-by: Cursor <cursoragent@cursor.com> --------- Co-authored-by: Cursor <cursoragent@cursor.com>
31 lines
916 B
JavaScript
31 lines
916 B
JavaScript
/*
|
|
* Synthesise an all-additions unified diff so pre-open persona review takes the
|
|
* same prompt shape as docs-review.yml's git diff.
|
|
*/
|
|
|
|
export function additionsDiff(files) {
|
|
const chunks = [];
|
|
for (const {path, content} of files) {
|
|
const lines = content === ''
|
|
? []
|
|
: (() => {
|
|
const body = content.endsWith('\n') ? content : `${content}\n`;
|
|
const parts = body.split('\n');
|
|
// Trailing empty from the final newline — drop it so +++ counts match.
|
|
if (parts.at(-1) === '') parts.pop();
|
|
return parts;
|
|
})();
|
|
|
|
const n = lines.length;
|
|
chunks.push(
|
|
`diff --git a/${path} b/${path}`,
|
|
`new file mode 100644`,
|
|
`--- /dev/null`,
|
|
`+++ b/${path}`,
|
|
n === 0 ? `@@ -0,0 +0,0 @@` : `@@ -0,0 +1,${n} @@`,
|
|
...lines.map((l) => `+${l}`),
|
|
);
|
|
}
|
|
return chunks.join('\n') + (chunks.length ? '\n' : '');
|
|
}
|