@andypai/agent-kanban 0.3.4 → 0.3.6
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 +24 -17
- package/package.json +3 -2
- package/src/__tests__/api.test.ts +3 -3
- package/src/__tests__/index.test.ts +22 -2
- package/src/__tests__/jira-wiring.test.ts +47 -17
- package/src/__tests__/postgres-jira-provider.test.ts +315 -0
- package/src/__tests__/postgres-linear-provider.test.ts +309 -0
- package/src/__tests__/postgres-local-provider.test.ts +129 -0
- package/src/__tests__/storage-config.test.ts +39 -0
- package/src/__tests__/webhooks.test.ts +39 -3
- package/src/index.ts +65 -28
- package/src/provider-runtime.ts +110 -0
- package/src/providers/index.ts +16 -39
- package/src/providers/jira.ts +10 -5
- package/src/providers/linear.ts +2 -2
- package/src/providers/postgres-jira.ts +1193 -0
- package/src/providers/postgres-linear.ts +1088 -0
- package/src/providers/postgres-local.ts +611 -0
- package/src/server.ts +2 -2
- package/src/storage-config.ts +41 -0
- package/src/sync-config.ts +5 -2
- package/src/tracker-config.ts +104 -0
- package/src/webhooks.ts +14 -0
package/src/index.ts
CHANGED
|
@@ -4,14 +4,17 @@ import { parseArgs } from 'node:util'
|
|
|
4
4
|
import { Database } from 'bun:sqlite'
|
|
5
5
|
import { KanbanError, ErrorCode } from './errors'
|
|
6
6
|
import { formatOutput, error, success } from './output'
|
|
7
|
-
import {
|
|
7
|
+
import { getDbPath, initSchema, seedDefaultColumns } from './db'
|
|
8
8
|
import { boardInit, boardReset } from './commands/board'
|
|
9
9
|
import { columnAdd, columnDelete, columnList, columnRename, columnReorder } from './commands/column'
|
|
10
10
|
import { bulkClearDoneCmd, bulkMoveAllCmd } from './commands/bulk'
|
|
11
11
|
import { getConfigPath, loadConfig, saveConfig } from './config'
|
|
12
12
|
import type { CliOutput, Priority } from './types'
|
|
13
|
-
import { createProvider } from './providers/index'
|
|
14
13
|
import { unsupportedOperation } from './providers/errors'
|
|
14
|
+
import { openKanbanRuntime } from './provider-runtime'
|
|
15
|
+
import { trackerConfigFromEnv } from './tracker-config'
|
|
16
|
+
import type { KanbanProvider } from './providers/types'
|
|
17
|
+
import { resolvePollingSyncIntervalMs } from './sync-config'
|
|
15
18
|
|
|
16
19
|
interface ParsedArgs {
|
|
17
20
|
values: Record<string, unknown>
|
|
@@ -48,7 +51,7 @@ function requireLocalProvider(providerType: string, feature: string): void {
|
|
|
48
51
|
}
|
|
49
52
|
|
|
50
53
|
async function routeTask(
|
|
51
|
-
provider:
|
|
54
|
+
provider: KanbanProvider,
|
|
52
55
|
action: string | undefined,
|
|
53
56
|
positionals: string[],
|
|
54
57
|
values: Record<string, unknown>,
|
|
@@ -140,7 +143,7 @@ async function routeTask(
|
|
|
140
143
|
}
|
|
141
144
|
|
|
142
145
|
async function routeComment(
|
|
143
|
-
provider:
|
|
146
|
+
provider: KanbanProvider,
|
|
144
147
|
action: string | undefined,
|
|
145
148
|
positionals: string[],
|
|
146
149
|
): Promise<CliOutput> {
|
|
@@ -224,7 +227,7 @@ function routeBulk(
|
|
|
224
227
|
}
|
|
225
228
|
|
|
226
229
|
async function routeConfig(
|
|
227
|
-
provider:
|
|
230
|
+
provider: KanbanProvider,
|
|
228
231
|
dbPath: string,
|
|
229
232
|
action: string | undefined,
|
|
230
233
|
positionals: string[],
|
|
@@ -288,7 +291,7 @@ async function routeConfig(
|
|
|
288
291
|
|
|
289
292
|
async function routeBoard(
|
|
290
293
|
db: Database,
|
|
291
|
-
provider:
|
|
294
|
+
provider: KanbanProvider,
|
|
292
295
|
action: string | undefined,
|
|
293
296
|
): Promise<CliOutput> {
|
|
294
297
|
switch (action) {
|
|
@@ -316,23 +319,29 @@ async function run(argv: string[]): Promise<{ output: CliOutput; exitCode: numbe
|
|
|
316
319
|
return { output: { ok: true, data: { message: HELP_TEXT } }, exitCode: 0 }
|
|
317
320
|
}
|
|
318
321
|
|
|
319
|
-
const
|
|
320
|
-
|
|
321
|
-
|
|
322
|
+
const runtime = await openKanbanRuntime({
|
|
323
|
+
dbPath: (values.db as string | undefined) ?? getDbPath(),
|
|
324
|
+
})
|
|
322
325
|
|
|
323
326
|
try {
|
|
324
|
-
const provider
|
|
327
|
+
const { provider, sqliteDb, dbPath } = runtime
|
|
325
328
|
const group = positionals[0]
|
|
326
329
|
const action = positionals[1]
|
|
327
330
|
|
|
328
331
|
if (!group) {
|
|
329
|
-
return { output: await routeBoard(
|
|
332
|
+
if (sqliteDb) return { output: await routeBoard(sqliteDb, provider, undefined), exitCode: 0 }
|
|
333
|
+
return { output: success(await provider.getBoard()), exitCode: 0 }
|
|
330
334
|
}
|
|
331
335
|
|
|
332
336
|
let output: CliOutput
|
|
333
337
|
switch (group) {
|
|
334
338
|
case 'board':
|
|
335
|
-
|
|
339
|
+
if (sqliteDb) {
|
|
340
|
+
output = await routeBoard(sqliteDb, provider, action)
|
|
341
|
+
} else {
|
|
342
|
+
if (action === 'view' || action === undefined) output = success(await provider.getBoard())
|
|
343
|
+
else unsupportedOperation(`board ${action} is not available with KANBAN_STORAGE=postgres`)
|
|
344
|
+
}
|
|
336
345
|
break
|
|
337
346
|
case 'task':
|
|
338
347
|
output = await routeTask(provider, action, positionals, values)
|
|
@@ -341,13 +350,24 @@ async function run(argv: string[]): Promise<{ output: CliOutput; exitCode: numbe
|
|
|
341
350
|
output = await routeComment(provider, action, positionals)
|
|
342
351
|
break
|
|
343
352
|
case 'column':
|
|
344
|
-
|
|
353
|
+
if (!sqliteDb)
|
|
354
|
+
unsupportedOperation('Column commands are not available with KANBAN_STORAGE=postgres')
|
|
355
|
+
output = routeColumn(sqliteDb, provider.type, action, positionals, values)
|
|
345
356
|
break
|
|
346
357
|
case 'bulk':
|
|
347
|
-
|
|
358
|
+
if (!sqliteDb)
|
|
359
|
+
unsupportedOperation('Bulk commands are not available with KANBAN_STORAGE=postgres')
|
|
360
|
+
output = routeBulk(sqliteDb, provider.type, action, positionals)
|
|
348
361
|
break
|
|
349
362
|
case 'config':
|
|
350
|
-
|
|
363
|
+
if (sqliteDb) {
|
|
364
|
+
output = await routeConfig(provider, dbPath, action, positionals, values)
|
|
365
|
+
} else {
|
|
366
|
+
if (action === 'show' || action === undefined)
|
|
367
|
+
output = success(await provider.getConfig())
|
|
368
|
+
else
|
|
369
|
+
unsupportedOperation(`config ${action} is not available with KANBAN_STORAGE=postgres`)
|
|
370
|
+
}
|
|
351
371
|
break
|
|
352
372
|
default:
|
|
353
373
|
throw new KanbanError(ErrorCode.UNKNOWN_COMMAND, `Unknown command group '${group}'`)
|
|
@@ -355,7 +375,7 @@ async function run(argv: string[]): Promise<{ output: CliOutput; exitCode: numbe
|
|
|
355
375
|
|
|
356
376
|
return { output, exitCode: 0 }
|
|
357
377
|
} finally {
|
|
358
|
-
|
|
378
|
+
await runtime.close()
|
|
359
379
|
}
|
|
360
380
|
}
|
|
361
381
|
|
|
@@ -397,18 +417,19 @@ Commands:
|
|
|
397
417
|
config add-project <name> Add project
|
|
398
418
|
config remove-project <name> Remove project
|
|
399
419
|
|
|
400
|
-
serve Start web dashboard [--port 3000]
|
|
420
|
+
serve Start web dashboard [--port 3000] [--sync-interval-ms ms]
|
|
401
421
|
mcp Run as an MCP server over stdio (for Claude Desktop, etc.)
|
|
402
422
|
|
|
403
423
|
Options:
|
|
404
424
|
--pretty Human-readable output (default: JSON)
|
|
405
|
-
--db <path>
|
|
425
|
+
--db <path> SQLite database path (default: local ./.kanban if present, else ~/.kanban if present, else create ./.kanban)
|
|
406
426
|
--project <n> Filter/set project
|
|
407
427
|
-h, --help Show this help`
|
|
408
428
|
|
|
409
429
|
export interface ServeOptions {
|
|
410
430
|
db?: string
|
|
411
431
|
port: number
|
|
432
|
+
syncIntervalMs?: number
|
|
412
433
|
tunnel: boolean
|
|
413
434
|
}
|
|
414
435
|
|
|
@@ -418,6 +439,7 @@ export function parseServeArgs(argv: string[]): ServeOptions {
|
|
|
418
439
|
options: {
|
|
419
440
|
db: { type: 'string' },
|
|
420
441
|
port: { type: 'string' },
|
|
442
|
+
'sync-interval-ms': { type: 'string' },
|
|
421
443
|
tunnel: { type: 'boolean', default: false },
|
|
422
444
|
},
|
|
423
445
|
strict: false,
|
|
@@ -429,10 +451,17 @@ export function parseServeArgs(argv: string[]): ServeOptions {
|
|
|
429
451
|
return {
|
|
430
452
|
db: values.db as string | undefined,
|
|
431
453
|
port,
|
|
454
|
+
...(values['sync-interval-ms']
|
|
455
|
+
? { syncIntervalMs: parseSyncIntervalMs(values['sync-interval-ms'] as string) }
|
|
456
|
+
: {}),
|
|
432
457
|
tunnel: Boolean(values.tunnel),
|
|
433
458
|
}
|
|
434
459
|
}
|
|
435
460
|
|
|
461
|
+
function parseSyncIntervalMs(raw: string): number {
|
|
462
|
+
return resolvePollingSyncIntervalMs(raw, { label: '--sync-interval-ms' })
|
|
463
|
+
}
|
|
464
|
+
|
|
436
465
|
export interface McpOptions {
|
|
437
466
|
db?: string
|
|
438
467
|
}
|
|
@@ -452,21 +481,29 @@ if (import.meta.main) {
|
|
|
452
481
|
|
|
453
482
|
if (argv[0] === 'mcp') {
|
|
454
483
|
const opts = parseMcpArgs(argv)
|
|
455
|
-
const
|
|
456
|
-
const db = openDb(dbPath)
|
|
457
|
-
migrateSchema(db)
|
|
458
|
-
const provider = createProvider(db, dbPath)
|
|
484
|
+
const runtime = await openKanbanRuntime({ dbPath: opts.db ?? getDbPath() })
|
|
459
485
|
const { startStdioMcpServer } = await import('./commands/mcp')
|
|
460
|
-
|
|
486
|
+
try {
|
|
487
|
+
await startStdioMcpServer(runtime.provider)
|
|
488
|
+
} finally {
|
|
489
|
+
await runtime.close()
|
|
490
|
+
}
|
|
461
491
|
} else if (argv[0] === 'serve') {
|
|
462
492
|
const opts = parseServeArgs(argv)
|
|
463
493
|
|
|
464
|
-
const
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
494
|
+
const runtime = await openKanbanRuntime({
|
|
495
|
+
dbPath: opts.db ?? getDbPath(),
|
|
496
|
+
...(opts.syncIntervalMs !== undefined
|
|
497
|
+
? {
|
|
498
|
+
tracker: {
|
|
499
|
+
...trackerConfigFromEnv(process.env),
|
|
500
|
+
syncIntervalMs: opts.syncIntervalMs,
|
|
501
|
+
},
|
|
502
|
+
}
|
|
503
|
+
: {}),
|
|
504
|
+
})
|
|
468
505
|
const { startServer } = await import('./server')
|
|
469
|
-
startServer(provider, opts.port)
|
|
506
|
+
startServer(runtime.provider, opts.port, { syncIntervalMs: runtime.syncIntervalMs })
|
|
470
507
|
|
|
471
508
|
if (opts.tunnel) {
|
|
472
509
|
const { startCloudflareTunnel } = await import('./tunnel')
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { Database } from 'bun:sqlite'
|
|
2
|
+
import postgres from 'postgres'
|
|
3
|
+
|
|
4
|
+
import { getDbPath, migrateSchema, openDb } from './db'
|
|
5
|
+
import { unsupportedOperation } from './providers/errors'
|
|
6
|
+
import { createProvider } from './providers/index'
|
|
7
|
+
import { PostgresJiraProvider } from './providers/postgres-jira'
|
|
8
|
+
import { PostgresLinearProvider } from './providers/postgres-linear'
|
|
9
|
+
import { PostgresLocalProvider } from './providers/postgres-local'
|
|
10
|
+
import type { KanbanProvider } from './providers/types'
|
|
11
|
+
import { resolveKanbanStorageConfig } from './storage-config'
|
|
12
|
+
import type { KanbanStorageConfig } from './storage-config'
|
|
13
|
+
import { trackerConfigFromEnv, type TrackerConfig } from './tracker-config'
|
|
14
|
+
|
|
15
|
+
export interface KanbanRuntime {
|
|
16
|
+
provider: KanbanProvider
|
|
17
|
+
dbPath: string
|
|
18
|
+
trackerConfig: TrackerConfig
|
|
19
|
+
sqliteDb?: Database
|
|
20
|
+
syncIntervalMs?: number
|
|
21
|
+
close(): Promise<void>
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export async function openKanbanRuntime(
|
|
25
|
+
opts: { dbPath?: string; storage?: KanbanStorageConfig; tracker?: TrackerConfig } = {},
|
|
26
|
+
): Promise<KanbanRuntime> {
|
|
27
|
+
const dbPath = opts.dbPath ?? getDbPath()
|
|
28
|
+
const storage =
|
|
29
|
+
opts.storage ?? resolveKanbanStorageConfig(process.env, { defaultSqlitePath: dbPath })
|
|
30
|
+
const trackerConfig = opts.tracker ?? trackerConfigFromEnv(process.env)
|
|
31
|
+
|
|
32
|
+
if (storage.mode === 'postgres') {
|
|
33
|
+
const sql = postgres(storage.databaseUrl, { max: 5, onnotice: () => {} })
|
|
34
|
+
if (trackerConfig.provider === 'local') {
|
|
35
|
+
const provider = new PostgresLocalProvider(sql, trackerConfig)
|
|
36
|
+
await provider.initialize()
|
|
37
|
+
return {
|
|
38
|
+
provider,
|
|
39
|
+
dbPath,
|
|
40
|
+
trackerConfig,
|
|
41
|
+
syncIntervalMs: trackerConfig.syncIntervalMs,
|
|
42
|
+
async close() {
|
|
43
|
+
await sql.end({ timeout: 1 })
|
|
44
|
+
},
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
if (trackerConfig.provider === 'jira') {
|
|
48
|
+
const provider = new PostgresJiraProvider(sql, {
|
|
49
|
+
baseUrl: trackerConfig.baseUrl,
|
|
50
|
+
email: trackerConfig.email,
|
|
51
|
+
apiToken: trackerConfig.apiToken,
|
|
52
|
+
projectKey: trackerConfig.projectKey,
|
|
53
|
+
...(trackerConfig.boardId !== undefined ? { boardId: trackerConfig.boardId } : {}),
|
|
54
|
+
defaultIssueType: trackerConfig.defaultIssueType ?? 'Task',
|
|
55
|
+
pollingSyncIntervalMs: trackerConfig.syncIntervalMs,
|
|
56
|
+
})
|
|
57
|
+
await provider.initialize()
|
|
58
|
+
return {
|
|
59
|
+
provider,
|
|
60
|
+
dbPath,
|
|
61
|
+
trackerConfig,
|
|
62
|
+
syncIntervalMs: trackerConfig.syncIntervalMs,
|
|
63
|
+
async close() {
|
|
64
|
+
await sql.end({ timeout: 1 })
|
|
65
|
+
},
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
if (trackerConfig.provider === 'linear') {
|
|
69
|
+
const provider = new PostgresLinearProvider(
|
|
70
|
+
sql,
|
|
71
|
+
trackerConfig.teamId,
|
|
72
|
+
trackerConfig.apiKey,
|
|
73
|
+
trackerConfig.syncIntervalMs,
|
|
74
|
+
)
|
|
75
|
+
await provider.initialize()
|
|
76
|
+
return {
|
|
77
|
+
provider,
|
|
78
|
+
dbPath,
|
|
79
|
+
trackerConfig,
|
|
80
|
+
syncIntervalMs: trackerConfig.syncIntervalMs,
|
|
81
|
+
async close() {
|
|
82
|
+
await sql.end({ timeout: 1 })
|
|
83
|
+
},
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
try {
|
|
87
|
+
const _exhaustive: never = trackerConfig
|
|
88
|
+
unsupportedOperation(
|
|
89
|
+
`KANBAN_STORAGE=postgres currently supports KANBAN_PROVIDER=local, linear, or jira in agent-kanban.`,
|
|
90
|
+
)
|
|
91
|
+
void _exhaustive
|
|
92
|
+
} catch (err) {
|
|
93
|
+
await sql.end({ timeout: 1 })
|
|
94
|
+
throw err
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
const db = openDb(storage.sqlitePath)
|
|
99
|
+
migrateSchema(db)
|
|
100
|
+
return {
|
|
101
|
+
provider: createProvider(db, trackerConfig, storage.sqlitePath),
|
|
102
|
+
dbPath: storage.sqlitePath,
|
|
103
|
+
trackerConfig,
|
|
104
|
+
sqliteDb: db,
|
|
105
|
+
syncIntervalMs: trackerConfig.syncIntervalMs,
|
|
106
|
+
async close() {
|
|
107
|
+
db.close()
|
|
108
|
+
},
|
|
109
|
+
}
|
|
110
|
+
}
|
package/src/providers/index.ts
CHANGED
|
@@ -1,52 +1,29 @@
|
|
|
1
1
|
import type { Database } from 'bun:sqlite'
|
|
2
2
|
import { getDbPath, initSchema, seedDefaultColumns } from '../db'
|
|
3
|
-
import { providerNotConfigured } from './errors'
|
|
4
3
|
import { JiraProvider } from './jira'
|
|
5
4
|
import { LinearProvider } from './linear'
|
|
6
5
|
import { LocalProvider } from './local'
|
|
6
|
+
import type { TrackerConfig } from '../tracker-config'
|
|
7
7
|
import type { KanbanProvider } from './types'
|
|
8
|
-
import { resolvePollingSyncIntervalMs } from '../sync-config'
|
|
9
8
|
|
|
10
|
-
export function createProvider(
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
providerNotConfigured(
|
|
18
|
-
'LINEAR_API_KEY and LINEAR_TEAM_ID are required when KANBAN_PROVIDER=linear',
|
|
19
|
-
)
|
|
20
|
-
}
|
|
21
|
-
return new LinearProvider(db, teamId!, apiKey!, resolvePollingSyncIntervalMs())
|
|
9
|
+
export function createProvider(
|
|
10
|
+
db: Database,
|
|
11
|
+
config: TrackerConfig,
|
|
12
|
+
dbPath = getDbPath(),
|
|
13
|
+
): KanbanProvider {
|
|
14
|
+
if (config.provider === 'linear') {
|
|
15
|
+
return new LinearProvider(db, config.teamId, config.apiKey, config.syncIntervalMs)
|
|
22
16
|
}
|
|
23
17
|
|
|
24
|
-
if (
|
|
25
|
-
const baseUrl = process.env['JIRA_BASE_URL']
|
|
26
|
-
const email = process.env['JIRA_EMAIL']
|
|
27
|
-
const apiToken = process.env['JIRA_API_TOKEN']
|
|
28
|
-
const projectKey = process.env['JIRA_PROJECT_KEY']
|
|
29
|
-
const missing: string[] = []
|
|
30
|
-
if (!baseUrl) missing.push('JIRA_BASE_URL')
|
|
31
|
-
if (!email) missing.push('JIRA_EMAIL')
|
|
32
|
-
if (!apiToken) missing.push('JIRA_API_TOKEN')
|
|
33
|
-
if (!projectKey) missing.push('JIRA_PROJECT_KEY')
|
|
34
|
-
if (missing.length > 0) {
|
|
35
|
-
providerNotConfigured(
|
|
36
|
-
`${missing.join(', ')} ${missing.length === 1 ? 'is' : 'are'} required when KANBAN_PROVIDER=jira`,
|
|
37
|
-
)
|
|
38
|
-
}
|
|
39
|
-
const boardIdRaw = process.env['JIRA_BOARD_ID']
|
|
40
|
-
const boardId = boardIdRaw ? Number.parseInt(boardIdRaw, 10) : undefined
|
|
41
|
-
const defaultIssueType = process.env['JIRA_ISSUE_TYPE'] ?? 'Task'
|
|
18
|
+
if (config.provider === 'jira') {
|
|
42
19
|
return new JiraProvider(db, {
|
|
43
|
-
baseUrl: baseUrl
|
|
44
|
-
email: email
|
|
45
|
-
apiToken: apiToken
|
|
46
|
-
projectKey: projectKey
|
|
47
|
-
boardId:
|
|
48
|
-
defaultIssueType,
|
|
49
|
-
pollingSyncIntervalMs:
|
|
20
|
+
baseUrl: config.baseUrl,
|
|
21
|
+
email: config.email,
|
|
22
|
+
apiToken: config.apiToken,
|
|
23
|
+
projectKey: config.projectKey,
|
|
24
|
+
...(config.boardId !== undefined ? { boardId: config.boardId } : {}),
|
|
25
|
+
defaultIssueType: config.defaultIssueType ?? 'Task',
|
|
26
|
+
pollingSyncIntervalMs: config.syncIntervalMs,
|
|
50
27
|
})
|
|
51
28
|
}
|
|
52
29
|
|
package/src/providers/jira.ts
CHANGED
|
@@ -11,7 +11,12 @@ import type {
|
|
|
11
11
|
TaskComment,
|
|
12
12
|
Task,
|
|
13
13
|
} from '../types'
|
|
14
|
-
import {
|
|
14
|
+
import {
|
|
15
|
+
headerLower,
|
|
16
|
+
verifySha256HmacSignatureHeader,
|
|
17
|
+
type WebhookRequest,
|
|
18
|
+
type WebhookResult,
|
|
19
|
+
} from '../webhooks'
|
|
15
20
|
import { adfToPlainText, plainTextToAdf, type AdfDocument } from './jira-adf'
|
|
16
21
|
import { JIRA_CAPABILITIES } from './capabilities'
|
|
17
22
|
import { providerUpstreamError, unsupportedOperation } from './errors'
|
|
@@ -49,7 +54,7 @@ import type {
|
|
|
49
54
|
TaskListFilters,
|
|
50
55
|
UpdateTaskInput,
|
|
51
56
|
} from './types'
|
|
52
|
-
import {
|
|
57
|
+
import { DEFAULT_POLLING_SYNC_INTERVAL_MS } from '../sync-config'
|
|
53
58
|
|
|
54
59
|
const FULL_RECONCILE_INTERVAL_MS = 5 * 60_000
|
|
55
60
|
|
|
@@ -92,7 +97,7 @@ export class JiraProvider implements KanbanProvider {
|
|
|
92
97
|
client?: JiraClient,
|
|
93
98
|
) {
|
|
94
99
|
initJiraCacheSchema(db)
|
|
95
|
-
this.pollingSyncIntervalMs = config.pollingSyncIntervalMs ??
|
|
100
|
+
this.pollingSyncIntervalMs = config.pollingSyncIntervalMs ?? DEFAULT_POLLING_SYNC_INTERVAL_MS
|
|
96
101
|
this.client =
|
|
97
102
|
client ??
|
|
98
103
|
new JiraClient({
|
|
@@ -712,8 +717,8 @@ export class JiraProvider implements KanbanProvider {
|
|
|
712
717
|
async handleWebhook(payload: WebhookRequest): Promise<WebhookResult> {
|
|
713
718
|
const secret = process.env['JIRA_WEBHOOK_SECRET']
|
|
714
719
|
if (secret) {
|
|
715
|
-
const sig = headerLower(payload.headers, 'x-hub-signature
|
|
716
|
-
if (!
|
|
720
|
+
const sig = headerLower(payload.headers, 'x-hub-signature')
|
|
721
|
+
if (!verifySha256HmacSignatureHeader(secret, payload.rawBody, sig)) {
|
|
717
722
|
return { handled: false, unauthorized: true, message: 'Invalid signature' }
|
|
718
723
|
}
|
|
719
724
|
}
|
package/src/providers/linear.ts
CHANGED
|
@@ -41,7 +41,7 @@ import type {
|
|
|
41
41
|
TaskListFilters,
|
|
42
42
|
UpdateTaskInput,
|
|
43
43
|
} from './types'
|
|
44
|
-
import {
|
|
44
|
+
import { DEFAULT_POLLING_SYNC_INTERVAL_MS } from '../sync-config'
|
|
45
45
|
|
|
46
46
|
const FULL_RECONCILIATION_INTERVAL_MS = 5 * 60_000
|
|
47
47
|
|
|
@@ -81,7 +81,7 @@ export class LinearProvider implements KanbanProvider {
|
|
|
81
81
|
private readonly db: Database,
|
|
82
82
|
private readonly teamId: string,
|
|
83
83
|
apiKey: string,
|
|
84
|
-
private readonly pollingSyncIntervalMs =
|
|
84
|
+
private readonly pollingSyncIntervalMs = DEFAULT_POLLING_SYNC_INTERVAL_MS,
|
|
85
85
|
) {
|
|
86
86
|
initLinearCacheSchema(db)
|
|
87
87
|
this.client = new LinearClient(apiKey)
|