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

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/README.md CHANGED
@@ -243,23 +243,23 @@ A label that a write sets and the repository lacks is made first. A label made,
243
243
 
244
244
  The tools have the names and schemas of the Linear tracker's tools, so the default workflows call them the same way once GitHub is a tracker of the project:
245
245
 
246
- | Tool | What it does |
247
- | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
248
- | `comment` | `comment` of the port, with an optional `link` on its own line |
249
- | `move` | `move` of the port, answering `{ column }` |
250
- | `close` | closes the issue as completed, answering `{ state: "done" }` |
251
- | `create_card` | `create_card` of the port, answering `{ id, url }` |
252
- | `park` | moves the issue to `intake` from any state, then writes `waits_for = <card>` into its block, a `request` block when it has none; an issue out of scope is skipped with nothing written |
253
- | `release_follow_ups` | searches the open issues for `waits_for = <card>`, reads each block, and moves each one in `intake` to `ready`, or to `column` (`waiting_on_person` after a close with no merge) |
254
- | `count_sighting` | raises `occurrences` and `last_seen` in the issue's block; a retry with the same `seen_at` writes nothing, and an issue with no block is not written. The sightings of one issue, from this tool and from `create_card`, are counted one at a time |
255
- | `set_priority` | adds the label `priority:<priority>` that the analysis gave; `skipped` when the issue has a `priority:` label already, which stays |
256
- | `retitle` | for an issue a feeder filed (its block names `decided.opened_by`), sets the title to the first sentence of `text`, cut at a word to 100 characters, after `title_prefix`, and changes nothing else: the block keeps the feeder's title in `decided.filed_as`, and a new title alone starts no run again; `skipped` for an issue a person wrote, or one already titled so |
257
- | `batch_cards` | searches the open issues for `batch = <batch>`, and keeps at most 20 in scope whose `decided.batch` is the batch, leaving out `except`; with `only`, the others are `skipped` |
258
- | `find_cards` | searches the open issues in scope for the first 200 characters of `text`, without quotes or colons; with `except`, only issues made before that card |
259
- | `hand_back` | assigns the issue to the newest person who assigned it to EDGAR (`GET .../issues/{n}/events?per_page=100`), else to its writer, never EDGAR, an App or a bot, and adds `edgar:waiting` with `POST .../issues/{n}/labels`, made in the repository when it is missing; `skipped` when nobody can be given it |
260
- | `mark_seen` | adds an eyes reaction to the issue with `POST .../issues/{n}/reactions`, answering `{ id }`; GitHub keeps one reaction of a kind for each account, so a repeat adds none |
261
- | `update_description` | replaces the issue's body and keeps its block; `restore_description` undoes it and `find_description` is its lookup |
262
- | `assign` | sets the issue's one assignee to a login, `me` for EDGAR, or nobody for an empty text; `restore_assignee` undoes it and `find_assignee` is its lookup; a login that GitHub does not have is `not_found` |
246
+ | Tool | What it does |
247
+ | -------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
248
+ | `comment` | `comment` of the port, with an optional `link` on its own line |
249
+ | `move` | `move` of the port, answering `{ column }` |
250
+ | `close` | closes the issue as completed, answering `{ state: "done" }` |
251
+ | `create_card` | `create_card` of the port, answering `{ id, url }` |
252
+ | `park` | moves the issue to `intake` from any state, then writes `waits_for = <card>` into its block, a `request` block when it has none; an issue out of scope is skipped with nothing written |
253
+ | `release_follow_ups` | searches the open issues for `waits_for = <card>`, reads each block, and moves each one in `intake` to `ready`, or to `column` (`waiting_on_person` after a close with no merge) |
254
+ | `count_sighting` | raises `occurrences` and `last_seen` in the issue's block; a retry with the same `seen_at` writes nothing, and an issue with no block is not written. The sightings of one issue, from this tool and from `create_card`, are counted one at a time |
255
+ | `set_priority` | adds the label `priority:<priority>` that the analysis gave; `skipped` when the issue has a `priority:` label already, which stays |
256
+ | `retitle` | for an issue a feeder filed (its block names `decided.opened_by`), sets the title to the first sentence of `text`, after `title_prefix`, and changes nothing else: the block keeps the feeder's title in `decided.filed_as`, and a new title alone starts no run again; `skipped` for an issue a person wrote, one already titled so, or a `text` over 100 characters or with an ellipsis, so a cut title is never written |
257
+ | `batch_cards` | searches the open issues for `batch = <batch>`, and keeps at most 20 in scope whose `decided.batch` is the batch, leaving out `except`; with `only`, the others are `skipped` |
258
+ | `find_cards` | searches the open issues in scope for the first 200 characters of `text`, without quotes or colons; with `except`, only issues made before that card |
259
+ | `hand_back` | assigns the issue to the newest person who assigned it to EDGAR (`GET .../issues/{n}/events?per_page=100`), else to its writer, never EDGAR, an App or a bot, and adds `edgar:waiting` with `POST .../issues/{n}/labels`, made in the repository when it is missing; `skipped` when nobody can be given it |
260
+ | `mark_seen` | adds an eyes reaction to the issue with `POST .../issues/{n}/reactions`, answering `{ id }`; GitHub keeps one reaction of a kind for each account, so a repeat adds none |
261
+ | `update_description` | replaces the issue's body and keeps its block; `restore_description` undoes it and `find_description` is its lookup |
262
+ | `assign` | sets the issue's one assignee to a login, `me` for EDGAR, or nobody for an empty text; `restore_assignee` undoes it and `find_assignee` is its lookup; a login that GitHub does not have is `not_found` |
263
263
 
264
264
  The search tools call `GET /search/issues?q=<words> is:issue is:open repo:<each repository>&per_page=<n>`. GitHub's search has its own rate limit of 30 requests a minute.
265
265
 
@@ -91,8 +91,9 @@ export function redBranchCards(home, base, runs) {
91
91
  }
92
92
  /** The card of EDGAR's own pull request whose checks went red: lane `fix`, naming the card the pull request belongs to. */
93
93
  export function redPullCard(home, pull, runs) {
94
- const card = cardOf(pull.head.ref);
95
- if (card === null)
94
+ // A branch name holds the card id in lower case; the tracker writes it in upper case and links only that.
95
+ const card = cardOf(pull.head.ref)?.toUpperCase();
96
+ if (card === undefined)
96
97
  return undefined;
97
98
  const checks = checksOf({ total_count: runs.length, check_runs: [...runs] }, { statuses: [] });
98
99
  if (!checks.some((c) => c.state === "failed"))
@@ -647,7 +647,7 @@ export const retitleTool = {
647
647
  text: z
648
648
  .string()
649
649
  .min(1)
650
- .describe("a stage's summary of the card; its first sentence becomes the title"),
650
+ .describe("a short title in plain words, such as classify's; its first sentence becomes the title, unless it is over 100 characters or has an ellipsis"),
651
651
  }),
652
652
  output: z.object({ id: z.string(), title: z.string() }),
653
653
  };
@@ -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.8",
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.8",
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.8",
27
+ "@kana-ai/edgar-sdk": "0.1.8",
28
28
  "zod": "4.6.7"
29
29
  },
30
30
  "devDependencies": {
@@ -9,7 +9,7 @@
9
9
  "text": {
10
10
  "type": "string",
11
11
  "minLength": 1,
12
- "description": "a stage's summary of the card; its first sentence becomes the title"
12
+ "description": "a short title in plain words, such as classify's; its first sentence becomes the title, unless it is over 100 characters or has an ellipsis"
13
13
  }
14
14
  },
15
15
  "required": ["card", "text"]