@open-cr-agent/vcs-github 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/adapter.js CHANGED
@@ -62,6 +62,9 @@ export class GitHubAdapter {
62
62
  const match = OVERRIDE.exec(c.body);
63
63
  if (!match || !login || login === author || this.isBot(login))
64
64
  continue;
65
+ // ocra's own summary is never a command, whichever account posted it.
66
+ if (c.body.includes(SUMMARY_MARKER))
67
+ continue;
65
68
  const [, commit = "", reason = ""] = match;
66
69
  // The full commit id: a short prefix can be matched by a new commit.
67
70
  if (commit.toLowerCase() !== pr.head.sha)
package/dist/render.js CHANGED
@@ -46,18 +46,25 @@ const VERDICT = {
46
46
  significant_concerns: "🛑 Significant concerns",
47
47
  };
48
48
  // Model text is untrusted: it may not close our markup, mention people,
49
- // pull in images, or render as a link that says one thing and goes elsewhere
50
- // (a bot comment lends it credibility). Inline links lose their `](`, and
51
- // every `]:` is escaped, so no link reference definition (`[1]: https://…`)
52
- // can form, at line start or inside a blockquote or list item, and no
53
- // reference-style link (`[x][1]`, `[x][]`, `[1]`) has anything to resolve to.
54
- // Bare URLs still show as text.
49
+ // pull in images, spell one of ocra's commands (`/ocra …`, which would count
50
+ // if ocra posted as a person with write access), or become a link at all. A
51
+ // pull request can plant an address for a reviewer to repeat (the adversarial
52
+ // probe saw one), and a bot comment lends it credibility. Inline links lose
53
+ // their `](`, and every `]:` is escaped, so no link reference definition
54
+ // (`[1]: https://…`) can form, at line start or inside a blockquote or list
55
+ // item, and no reference-style link (`[x][1]`, `[x][]`, `[1]`) has anything
56
+ // to resolve to. Web addresses get a zero-width space in their scheme or
57
+ // after `www`, which GitHub's autolinking needs intact, so they read the
58
+ // same and stay text; email addresses already lose theirs at the `@`.
55
59
  export function safeMarkdown(text) {
56
60
  return text
57
61
  .replaceAll("<!--", "&lt;!--")
58
62
  .replace(/<\/?[a-zA-Z][^>]*>/g, (tag) => tag.replaceAll("<", "&lt;"))
59
63
  .replace(/@(?=[A-Za-z0-9-])/g, "@\u200b")
60
64
  .replace(/!\[/g, "!\u200b[")
65
+ .replace(/\/(?=ocra)/gi, "/\u200b")
66
+ .replace(/\b(https?|ftp)(?=:\/\/)/gi, "$1\u200b")
67
+ .replace(/\bwww(?=\.)/gi, "www\u200b")
61
68
  .replaceAll("](", "]\\(")
62
69
  .replaceAll("]:", "]\\:");
63
70
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-cr-agent/vcs-github",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "GitHub pull request adapter for Open-CR-Agent",
5
5
  "keywords": [
6
6
  "code-review",
@@ -30,7 +30,7 @@
30
30
  "!dist/**/*.map"
31
31
  ],
32
32
  "dependencies": {
33
- "@open-cr-agent/core": "0.1.1",
33
+ "@open-cr-agent/core": "0.1.2",
34
34
  "zod": "^4.6.5"
35
35
  },
36
36
  "publishConfig": {