Skip to content

fix(doc-gardening): remove git operations from lint path - #2342

Draft
felladrin wants to merge 4 commits into
mainfrom
fix/doc-gardening-lint-safety
Draft

fix(doc-gardening): remove git operations from lint path#2342
felladrin wants to merge 4 commits into
mainfrom
fix/doc-gardening-lint-safety

Conversation

@felladrin

Copy link
Copy Markdown
Owner

Problem

npm run lint runs scripts/doc-gardening.cjs, which unconditionally calls createFixupPRs(). That function:

  1. git checkout -b doc-gardening-<timestamp> — switches your branch, carrying your working tree onto a new branch.
  2. applyFix — rewrites offending docs, replacing broken links with [REMOVED BROKEN LINK].
  3. git add . — stages everything in the tree, including unrelated work.
  4. git commit -m "docs: fix documentation issues found by doc gardening" — commits it all.

Despite the name, it never opens a PR; it prints the git push and gh pr create commands for you to run manually.

Solution

  • garden() no longer calls createFixupPRs() unconditionally.
  • The automated fix-up is now behind an explicit --fix flag.
  • --fix also requires a clean working tree (checked via git status --porcelain) so it can never sweep unrelated changes into a commit.
  • Broken relative links now fail lint with exit code 1 and a message naming the file and target.
  • The freshness check already reports stale docs; no change needed there.

Acceptance criteria

  • npm run lint never runs git checkout, git add or git commit.
  • A broken relative link in docs/ fails lint with a message naming the file and the target.
  • The freshness check reports stale docs (already worked; body was not empty).

function runGarden(args = [], cwd = __dirname) {
const cmd = `node ${SCRIPT_PATH} ${args.join(" ")}`;
try {
const output = execSync(cmd, { cwd, encoding: "utf8", stdio: "pipe" });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants