@kana-ai/edgar-ext-github 0.1.6 → 0.1.7

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.
@@ -28,7 +28,7 @@ export declare function changeNotices(files: readonly {
28
28
  readonly notice: string;
29
29
  }[]): string[];
30
30
  /**
31
- * A pull request's title, `<id>: <title>` for its card, so a reviewer sees the card at a glance. Past 72 characters, the words before a trailing `[tag]` are cut where a word ends, and the tag stays whole: a repository can start a build from a tag in the merge commit's message, which holds the title.
31
+ * A pull request's title, `<id>: <title>` for its card, so a reviewer sees the card at a glance; a title that already starts with the card's id keeps it once. Past 72 characters, the words before a trailing `[tag]` are cut where a word ends, and the tag stays whole: a repository can start a build from a tag in the merge commit's message, which holds the title.
32
32
  */
33
33
  export declare function titleOf(title: string, card: Card | undefined): string;
34
34
  /** The first line of a body for its card: its link, or its id when the card has no address. */
@@ -156,10 +156,11 @@ export function changeNotices(files, largeLines, paths) {
156
156
  /** The longest title, so the merge commit's subject that holds it stays readable in `git log`. */
157
157
  const TITLE_LIMIT = 72;
158
158
  /**
159
- * A pull request's title, `<id>: <title>` for its card, so a reviewer sees the card at a glance. Past 72 characters, the words before a trailing `[tag]` are cut where a word ends, and the tag stays whole: a repository can start a build from a tag in the merge commit's message, which holds the title.
159
+ * A pull request's title, `<id>: <title>` for its card, so a reviewer sees the card at a glance; a title that already starts with the card's id keeps it once. Past 72 characters, the words before a trailing `[tag]` are cut where a word ends, and the tag stays whole: a repository can start a build from a tag in the merge commit's message, which holds the title.
160
160
  */
161
161
  export function titleOf(title, card) {
162
- const full = (card === undefined ? title : `${card.id}: ${title}`).trim().replaceAll(/\s+/g, " ");
162
+ const own = card === undefined ? title : title.trim().replace(idPrefix(card.id), "");
163
+ const full = (card === undefined ? own : `${card.id}: ${own}`).trim().replaceAll(/\s+/g, " ");
163
164
  if (full.length <= TITLE_LIMIT)
164
165
  return full;
165
166
  const tag = /(?: ?\[[^[\]]+\])+$/.exec(full)?.[0] ?? "";
@@ -169,6 +170,9 @@ export function titleOf(title, card) {
169
170
  const kept = (end > 0 ? words.slice(0, end) : words.slice(0, room)).replace(/[\s,;:-]+$/, "");
170
171
  return kept === "" ? tag.trim() : `${kept}${tag}`;
171
172
  }
173
+ function idPrefix(id) {
174
+ return new RegExp(`^${id.replaceAll(/[.*+?^${}()|[\]\\]/g, "\\$&")}\\s*:\\s*`, "i");
175
+ }
172
176
  /** The first line of a body for its card: its link, or its id when the card has no address. */
173
177
  export function cardLine(card) {
174
178
  if (card === undefined)
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "contract": 1,
3
3
  "name": "github",
4
- "version": "0.1.6",
4
+ "version": "0.1.7",
5
5
  "config_schema": "schemas/config.json",
6
6
  "secrets": [
7
7
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kana-ai/edgar-ext-github",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "description": "EDGAR extension for GitHub: push edgar/ branches, open, watch, close and merge pull requests, and track GitHub issues as cards.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -23,8 +23,8 @@
23
23
  ".": "./dist/src/index.js"
24
24
  },
25
25
  "dependencies": {
26
- "@kana-ai/edgar-contracts": "0.1.6",
27
- "@kana-ai/edgar-sdk": "0.1.6",
26
+ "@kana-ai/edgar-contracts": "0.1.7",
27
+ "@kana-ai/edgar-sdk": "0.1.7",
28
28
  "zod": "4.6.7"
29
29
  },
30
30
  "devDependencies": {