Skip to content

feat(pr-contract): add --body-file pre-publish mode and context-aware parser#82

Merged
ArchonVII merged 2 commits into
mainfrom
fix/pr-contract-body-file
Jun 16, 2026
Merged

feat(pr-contract): add --body-file pre-publish mode and context-aware parser#82
ArchonVII merged 2 commits into
mainfrom
fix/pr-contract-body-file

Conversation

@ArchonVII

Copy link
Copy Markdown
Owner

Summary

  • Add a --body-file <path|-> (stdin) input mode to scripts/pr-contract.mjs so the same validator can run on a locally drafted body before a PR exists, not only against a remote PR via gh.
  • Make the scaffolding-token and generic-verification scans context-aware (still strict): HTML comments are ignored by the scaffolding-token scan; fenced/inline code and quoted text are ignored by the generic scan on free prose. Checked checkbox claims and evidence-field scaffolding markers still hard-fail.
  • Add --help/usage to pr-contract.mjs, agent-pr-ready.mjs, and agent-close-preflight.mjs.

This is the keystone slice (GW-A) of the closeout-contract repair: one validator, identical rules before and after PR creation. This PR's own body was drafted and validated locally with the new --body-file mode before creation.

Verification

  • vitest run scripts/pr-contract.test.mjs

    command: node node_modules/vitest/vitest.mjs run scripts/pr-contract.test.mjs
    location: local
    result: 19 passed (12 existing + 7 acceptance-table + 2 body-file pre-publish)
    timestamp: 2026-06-15T16:56:00Z
    
  • node scripts/pr-contract.mjs --body-file - (drafted body, no PR)

    command: node scripts/pr-contract.mjs --body-file - --title ... --branch ... --files-json ...
    location: local
    result: contract satisfied, exit 0
    timestamp: 2026-06-15T17:05:00Z
    

Verification Notes

The full local suite was run with the repo's vitest binary; the only failing file is the pre-existing doc-policy-lint.test.mjs parse error, which is independent of this change (it does not reference pr-contract). The new fixtures assert the strict cases (a leftover scaffolding marker in visible prose, an evidence-field marker, and a checked tests passed claim all still fail) alongside the relaxed cases (the template's own instructional HTML comment, a command cited in inline code, and a diagnostic quoted in a fenced block now pass).

Docs / Changelog

  • .changelog/unreleased/81-pr-contract-body-file.md records the added --body-file mode, the --help output, and the context-aware parser change.
  • AGENTS.md and the closeout-contract page are handled in the separate repo-template DOC slice.

Refs #81

ArchonVII and others added 2 commits June 15, 2026 17:00
… parser

Validate a drafted PR body before the PR exists (--body-file <path|->), so the
same validator runs identically before and after creation — removes the
push->create->amend->re-scan loop. Make placeholder/generic scans context-aware
(mask HTML comments; mask fenced/inline code and quoted text in free prose)
while still failing visible-prose claims and evidence-field placeholders. Add
--help to pr-contract/agent-pr-ready/agent-close-preflight. Acceptance fixtures
included, with the "still fails" cases.

Refs #81

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- Assert the --body-file reject test fails specifically with
  placeholder_text; it was reason-blind (any failure satisfied exit 1).
- Add a blockquote-masking acceptance case so the maskCodeAndQuotes
  ">" branch is locked (only fenced/inline spans were covered before).

Refs #81

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@ArchonVII
ArchonVII marked this pull request as ready for review June 16, 2026 01:05
@ArchonVII
ArchonVII merged commit f0dbb3c into main Jun 16, 2026
1 check passed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bf64c6d8ee

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@@ -0,0 +1,14 @@
### Added

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Add the required repo update log entry

This commit changes scripts and tests, so the repo-level AGENTS.md rule under “Repo update log” applies: code/config/behavior changes must append an entry to docs/repo-update-log.md before review. The diff adds a changelog fragment but no operational ledger entry, which leaves the PR failing the repo’s documented closeout/audit requirement; add the entry with issue/PR, branch, changed paths, verification, and propagation status.

Useful? React with 👍 / 👎.

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.

1 participant