@andypai/agent-kanban 0.3.6 → 0.3.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@andypai/agent-kanban",
3
- "version": "0.3.6",
3
+ "version": "0.3.7",
4
4
  "description": "Agent-friendly kanban board CLI. Manage tasks via bash commands, parse structured JSON output.",
5
5
  "homepage": "https://github.com/abpai/agent-kanban#readme",
6
6
  "repository": {
@@ -181,6 +181,13 @@ describe('plainTextToAdf / adfToPlainText', () => {
181
181
  expect(adfToPlainText(doc)).toBe('before\n\nafter')
182
182
  })
183
183
 
184
+ test('Jira webhook plain string descriptions pass through unchanged', () => {
185
+ const description =
186
+ '*Repo:* https://github.com/abpai/smoke-test\n\nPlease make one minimal change.'
187
+
188
+ expect(adfToPlainText(description)).toBe(description)
189
+ })
190
+
184
191
  test('strong + link marks survive on read as markdown', () => {
185
192
  const doc: AdfDocument = {
186
193
  version: 1,
@@ -139,6 +139,45 @@ describe('Jira webhook', () => {
139
139
  expect(tasks.find((t) => t.externalRef === 'ENG-100')?.title).toBe('New issue')
140
140
  })
141
141
 
142
+ test('issue_created accepts Jira webhook string descriptions', async () => {
143
+ const db = new Database(':memory:')
144
+ seedJira(db)
145
+ delete process.env['JIRA_WEBHOOK_SECRET']
146
+ const client = new JiraClient({
147
+ baseUrl: jiraConfig.baseUrl,
148
+ email: jiraConfig.email,
149
+ apiToken: jiraConfig.apiToken,
150
+ })
151
+ const provider = new JiraProvider(db, jiraConfig, client)
152
+ const description = '*Repo:* https://github.com/abpai/smoke-test\n\nString webhook body.'
153
+ const body = JSON.stringify({
154
+ webhookEvent: 'jira:issue_created',
155
+ issue: {
156
+ id: '101',
157
+ key: 'ENG-101',
158
+ fields: {
159
+ summary: 'String description issue',
160
+ description,
161
+ status: { id: '1', name: 'To Do' },
162
+ issuetype: { id: '10000', name: 'Task' },
163
+ assignee: null,
164
+ labels: ['alpha'],
165
+ comment: { total: 0 },
166
+ created: '2025-02-01T00:00:00.000Z',
167
+ updated: '2025-02-01T00:00:00.000Z',
168
+ project: { id: '1', key: 'ENG' },
169
+ },
170
+ },
171
+ })
172
+
173
+ const result = await provider.handleWebhook({ headers: {}, rawBody: body })
174
+
175
+ expect(result.handled).toBe(true)
176
+ expect(getCachedJiraTasks(db).find((t) => t.externalRef === 'ENG-101')?.description).toBe(
177
+ description,
178
+ )
179
+ })
180
+
142
181
  test('issue_deleted removes the task', async () => {
143
182
  const db = new Database(':memory:')
144
183
  seedJira(db)
@@ -434,6 +434,8 @@ function renderBlocks(nodes: AdfBlockNode[]): string {
434
434
  return out.join('\n\n')
435
435
  }
436
436
 
437
- export function adfToPlainText(doc: AdfDocument): string {
437
+ export function adfToPlainText(doc: AdfDocument | string | null | undefined): string {
438
+ if (typeof doc === 'string') return doc
439
+ if (!doc || !Array.isArray(doc.content)) return ''
438
440
  return renderBlocks(doc.content)
439
441
  }