* Builds a JQL clause restricting issues to the given project keys. * Single key uses `project = "X"`; multiple keys use `project in ("X","Y")`. * Each key is escaped for inclusion in a JQL double-quoted string.
(projectKeys: string[])
| 16 | * Each key is escaped for inclusion in a JQL double-quoted string. |
| 17 | */ |
| 18 | function buildProjectClause(projectKeys: string[]): string { |
| 19 | const escapeKey = (key: string) => key.replace(/\\/g, '\\\\').replace(/"/g, '\\"') |
| 20 | if (projectKeys.length === 1) { |
| 21 | return `project = "${escapeKey(projectKeys[0])}"` |
| 22 | } |
| 23 | const list = projectKeys.map((k) => `"${escapeKey(k)}"`).join(',') |
| 24 | return `project in (${list})` |
| 25 | } |
| 26 | |
| 27 | /** |
| 28 | * Builds a plain-text representation of a Jira issue for knowledge base indexing. |