@andypai/agent-kanban 0.3.0 → 0.3.2
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 +34 -5
- package/package.json +1 -1
- package/src/__tests__/activity.test.ts +2 -2
- package/src/__tests__/api.test.ts +3 -3
- package/src/__tests__/commands/board.test.ts +3 -3
- package/src/__tests__/commands/bulk.test.ts +3 -3
- package/src/__tests__/commands/column.test.ts +4 -4
- package/src/__tests__/conflict.test.ts +3 -3
- package/src/__tests__/db.test.ts +2 -2
- package/src/__tests__/id.test.ts +1 -1
- package/src/__tests__/index.test.ts +3 -3
- package/src/__tests__/jira-adf.test.ts +270 -4
- package/src/__tests__/jira-cache.test.ts +1 -1
- package/src/__tests__/jira-client.test.ts +2 -2
- package/src/__tests__/jira-provider-comment.test.ts +3 -3
- package/src/__tests__/jira-provider-mutations.test.ts +4 -4
- package/src/__tests__/jira-provider-read.test.ts +52 -6
- package/src/__tests__/jira-wiring.test.ts +3 -3
- package/src/__tests__/linear-cache-description-activity.test.ts +1 -1
- package/src/__tests__/linear-provider-comment.test.ts +2 -2
- package/src/__tests__/linear-provider-sync.test.ts +4 -9
- package/src/__tests__/local-provider-comment.test.ts +2 -2
- package/src/__tests__/mcp-core.test.ts +4 -4
- package/src/__tests__/mcp-server.test.ts +3 -3
- package/src/__tests__/metrics.test.ts +2 -2
- package/src/__tests__/output.test.ts +1 -1
- package/src/__tests__/provider-capabilities.test.ts +40 -0
- package/src/__tests__/server.test.ts +3 -10
- package/src/__tests__/webhooks.test.ts +6 -6
- package/src/activity.ts +2 -2
- package/src/api.ts +3 -3
- package/src/commands/board.ts +4 -4
- package/src/commands/bulk.ts +4 -4
- package/src/commands/column.ts +4 -4
- package/src/commands/mcp.ts +3 -3
- package/src/config.ts +1 -1
- package/src/db.ts +4 -4
- package/src/index.ts +13 -19
- package/src/mcp/core.ts +4 -4
- package/src/mcp/errors.ts +1 -1
- package/src/mcp/index.ts +6 -6
- package/src/mcp/server.ts +3 -3
- package/src/mcp/types.ts +2 -2
- package/src/metrics.ts +1 -1
- package/src/output.ts +1 -1
- package/src/providers/capabilities.ts +21 -31
- package/src/providers/errors.ts +1 -1
- package/src/providers/index.ts +6 -6
- package/src/providers/jira-adf.ts +116 -12
- package/src/providers/jira-cache.ts +1 -1
- package/src/providers/jira-client.ts +2 -2
- package/src/providers/jira.ts +9 -14
- package/src/providers/linear-cache.ts +1 -1
- package/src/providers/linear-client.ts +3 -6
- package/src/providers/linear.ts +8 -13
- package/src/providers/local.ts +8 -8
- package/src/providers/types.ts +2 -2
- package/src/server.ts +2 -2
- package/src/types.ts +1 -0
|
@@ -3,9 +3,9 @@ import { Database } from 'bun:sqlite'
|
|
|
3
3
|
import { mkdtempSync, rmSync } from 'node:fs'
|
|
4
4
|
import { tmpdir } from 'node:os'
|
|
5
5
|
import { join } from 'node:path'
|
|
6
|
-
import { ErrorCode, KanbanError } from '../errors
|
|
7
|
-
import { run } from '../index
|
|
8
|
-
import { createProvider } from '../providers/index
|
|
6
|
+
import { ErrorCode, KanbanError } from '../errors'
|
|
7
|
+
import { run } from '../index'
|
|
8
|
+
import { createProvider } from '../providers/index'
|
|
9
9
|
|
|
10
10
|
const ENV_KEYS = [
|
|
11
11
|
'KANBAN_PROVIDER',
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { afterEach, beforeEach, describe, expect, test } from 'bun:test'
|
|
2
2
|
import { Database } from 'bun:sqlite'
|
|
3
|
-
import { LinearProvider } from '../providers/linear
|
|
3
|
+
import { LinearProvider } from '../providers/linear'
|
|
4
4
|
import {
|
|
5
5
|
initLinearCacheSchema,
|
|
6
6
|
replaceStates,
|
|
7
7
|
saveSyncMeta,
|
|
8
8
|
upsertIssues,
|
|
9
|
-
} from '../providers/linear-cache
|
|
9
|
+
} from '../providers/linear-cache'
|
|
10
10
|
|
|
11
11
|
let db: Database
|
|
12
12
|
let originalFetch: typeof fetch
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { afterEach, beforeEach, describe, expect, test } from 'bun:test'
|
|
2
2
|
import { Database } from 'bun:sqlite'
|
|
3
|
-
import { LinearProvider } from '../providers/linear
|
|
3
|
+
import { LinearProvider } from '../providers/linear'
|
|
4
4
|
import {
|
|
5
5
|
getCachedTasks,
|
|
6
6
|
initLinearCacheSchema,
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
replaceStates,
|
|
9
9
|
saveSyncMeta,
|
|
10
10
|
upsertIssues,
|
|
11
|
-
} from '../providers/linear-cache
|
|
11
|
+
} from '../providers/linear-cache'
|
|
12
12
|
|
|
13
13
|
let db: Database
|
|
14
14
|
let originalFetch: typeof fetch
|
|
@@ -38,7 +38,6 @@ function linearIssue(
|
|
|
38
38
|
state: { id: string; name: string; position: number }
|
|
39
39
|
labels: { nodes: Array<{ id: string; name: string }> }
|
|
40
40
|
comments: {
|
|
41
|
-
totalCount?: number
|
|
42
41
|
nodes: Array<{ id: string }>
|
|
43
42
|
pageInfo?: { hasNextPage: boolean; endCursor: string | null }
|
|
44
43
|
}
|
|
@@ -57,7 +56,7 @@ function linearIssue(
|
|
|
57
56
|
project: null,
|
|
58
57
|
state: { id: 'state-1', name: 'Todo', position: 0 },
|
|
59
58
|
labels: { nodes: [] },
|
|
60
|
-
comments: {
|
|
59
|
+
comments: { nodes: [], pageInfo: { hasNextPage: false, endCursor: null } },
|
|
61
60
|
...overrides,
|
|
62
61
|
}
|
|
63
62
|
}
|
|
@@ -162,7 +161,6 @@ describe('LinearProvider sync', () => {
|
|
|
162
161
|
state: { id: 'state-1', name: 'Todo', position: 0 },
|
|
163
162
|
labels: { nodes: [] },
|
|
164
163
|
comments: {
|
|
165
|
-
totalCount: 0,
|
|
166
164
|
nodes: [],
|
|
167
165
|
pageInfo: { hasNextPage: false, endCursor: null },
|
|
168
166
|
},
|
|
@@ -258,9 +256,7 @@ describe('LinearProvider sync', () => {
|
|
|
258
256
|
JSON.stringify({
|
|
259
257
|
data: {
|
|
260
258
|
issues: {
|
|
261
|
-
nodes: [
|
|
262
|
-
linearIssue({ comments: { totalCount: 2, nodes: [{ id: 'c1' }, { id: 'c2' }] } }),
|
|
263
|
-
],
|
|
259
|
+
nodes: [linearIssue({ comments: { nodes: [{ id: 'c1' }, { id: 'c2' }] } })],
|
|
264
260
|
pageInfo: { hasNextPage: false, endCursor: null },
|
|
265
261
|
},
|
|
266
262
|
},
|
|
@@ -368,7 +364,6 @@ describe('LinearProvider sync', () => {
|
|
|
368
364
|
nodes: [
|
|
369
365
|
linearIssue({
|
|
370
366
|
comments: {
|
|
371
|
-
totalCount: 7,
|
|
372
367
|
nodes: Array.from({ length: 7 }, (_, index) => ({ id: `c${index}` })),
|
|
373
368
|
},
|
|
374
369
|
}),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { beforeEach, describe, expect, test } from 'bun:test'
|
|
2
2
|
import { Database } from 'bun:sqlite'
|
|
3
|
-
import { initSchema, seedDefaultColumns, addTask } from '../db
|
|
4
|
-
import { LocalProvider } from '../providers/local
|
|
3
|
+
import { initSchema, seedDefaultColumns, addTask } from '../db'
|
|
4
|
+
import { LocalProvider } from '../providers/local'
|
|
5
5
|
|
|
6
6
|
let db: Database
|
|
7
7
|
let provider: LocalProvider
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { beforeEach, describe, expect, test } from 'bun:test'
|
|
2
2
|
import { Database } from 'bun:sqlite'
|
|
3
|
-
import { addTask, initSchema, seedDefaultColumns } from '../db
|
|
4
|
-
import { createTrackerCore } from '../mcp/core
|
|
5
|
-
import { TrackerMcpError } from '../mcp/errors
|
|
6
|
-
import { LocalProvider } from '../providers/local
|
|
3
|
+
import { addTask, initSchema, seedDefaultColumns } from '../db'
|
|
4
|
+
import { createTrackerCore } from '../mcp/core'
|
|
5
|
+
import { TrackerMcpError } from '../mcp/errors'
|
|
6
|
+
import { LocalProvider } from '../providers/local'
|
|
7
7
|
|
|
8
8
|
interface TestScope {
|
|
9
9
|
actor: string
|
|
@@ -2,9 +2,9 @@ import { afterEach, beforeEach, describe, expect, test } from 'bun:test'
|
|
|
2
2
|
import { Database } from 'bun:sqlite'
|
|
3
3
|
import { Client } from '@modelcontextprotocol/sdk/client'
|
|
4
4
|
import { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js'
|
|
5
|
-
import { addTask, initSchema, seedDefaultColumns } from '../db
|
|
6
|
-
import { createTrackerCore, createTrackerMcpServer, TrackerMcpError } from '../mcp/index
|
|
7
|
-
import { LocalProvider } from '../providers/local
|
|
5
|
+
import { addTask, initSchema, seedDefaultColumns } from '../db'
|
|
6
|
+
import { createTrackerCore, createTrackerMcpServer, TrackerMcpError } from '../mcp/index'
|
|
7
|
+
import { LocalProvider } from '../providers/local'
|
|
8
8
|
|
|
9
9
|
interface TestScope {
|
|
10
10
|
actor: string
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { describe, expect, test, beforeEach } from 'bun:test'
|
|
2
2
|
import { Database } from 'bun:sqlite'
|
|
3
|
-
import { initSchema, seedDefaultColumns, addTask } from '../db
|
|
4
|
-
import { getBoardMetrics } from '../metrics
|
|
3
|
+
import { initSchema, seedDefaultColumns, addTask } from '../db'
|
|
4
|
+
import { getBoardMetrics } from '../metrics'
|
|
5
5
|
|
|
6
6
|
let db: Database
|
|
7
7
|
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { describe, expect, test } from 'bun:test'
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
JIRA_CAPABILITIES,
|
|
5
|
+
LINEAR_CAPABILITIES,
|
|
6
|
+
LOCAL_CAPABILITIES,
|
|
7
|
+
} from '../providers/capabilities'
|
|
8
|
+
|
|
9
|
+
describe('provider capabilities', () => {
|
|
10
|
+
test('remote providers share the same read/write baseline', () => {
|
|
11
|
+
expect(LINEAR_CAPABILITIES).toEqual(JIRA_CAPABILITIES)
|
|
12
|
+
expect(LINEAR_CAPABILITIES).toEqual({
|
|
13
|
+
taskCreate: true,
|
|
14
|
+
taskUpdate: true,
|
|
15
|
+
taskMove: true,
|
|
16
|
+
taskDelete: false,
|
|
17
|
+
comment: true,
|
|
18
|
+
activity: false,
|
|
19
|
+
metrics: false,
|
|
20
|
+
columnCrud: false,
|
|
21
|
+
bulk: false,
|
|
22
|
+
configEdit: false,
|
|
23
|
+
})
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
test('local provider exposes the full local board surface', () => {
|
|
27
|
+
expect(LOCAL_CAPABILITIES).toEqual({
|
|
28
|
+
taskCreate: true,
|
|
29
|
+
taskUpdate: true,
|
|
30
|
+
taskMove: true,
|
|
31
|
+
taskDelete: true,
|
|
32
|
+
comment: true,
|
|
33
|
+
activity: true,
|
|
34
|
+
metrics: true,
|
|
35
|
+
columnCrud: true,
|
|
36
|
+
bulk: true,
|
|
37
|
+
configEdit: true,
|
|
38
|
+
})
|
|
39
|
+
})
|
|
40
|
+
})
|
|
@@ -1,13 +1,6 @@
|
|
|
1
1
|
import { afterEach, describe, expect, test } from 'bun:test'
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
BoardConfig,
|
|
5
|
-
BoardMetrics,
|
|
6
|
-
BoardView,
|
|
7
|
-
Column,
|
|
8
|
-
Task,
|
|
9
|
-
} from '../types.ts'
|
|
10
|
-
import { startServer, type StartedServer } from '../server.ts'
|
|
2
|
+
import type { BoardBootstrap, BoardConfig, BoardMetrics, BoardView, Column, Task } from '../types'
|
|
3
|
+
import { startServer, type StartedServer } from '../server'
|
|
11
4
|
import type {
|
|
12
5
|
CreateTaskInput,
|
|
13
6
|
KanbanProvider,
|
|
@@ -15,7 +8,7 @@ import type {
|
|
|
15
8
|
ProviderSyncStatus,
|
|
16
9
|
TaskListFilters,
|
|
17
10
|
UpdateTaskInput,
|
|
18
|
-
} from '../providers/types
|
|
11
|
+
} from '../providers/types'
|
|
19
12
|
|
|
20
13
|
const emptyBoard: BoardView = { columns: [] }
|
|
21
14
|
const emptyConfig: BoardConfig = { members: [], projects: [], provider: 'local' }
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { beforeEach, afterEach, describe, expect, test } from 'bun:test'
|
|
2
2
|
import { Database } from 'bun:sqlite'
|
|
3
3
|
import { createHmac } from 'node:crypto'
|
|
4
|
-
import { verifyHmacSha256 } from '../webhooks
|
|
5
|
-
import { JiraProvider, type JiraProviderConfig } from '../providers/jira
|
|
6
|
-
import { JiraClient } from '../providers/jira-client
|
|
7
|
-
import { LinearProvider } from '../providers/linear
|
|
4
|
+
import { verifyHmacSha256 } from '../webhooks'
|
|
5
|
+
import { JiraProvider, type JiraProviderConfig } from '../providers/jira'
|
|
6
|
+
import { JiraClient } from '../providers/jira-client'
|
|
7
|
+
import { LinearProvider } from '../providers/linear'
|
|
8
8
|
import {
|
|
9
9
|
getCachedActivity,
|
|
10
10
|
getCachedTasks as getCachedJiraTasks,
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
saveTeamInfo,
|
|
14
14
|
replaceJiraColumns,
|
|
15
15
|
upsertJiraIssues,
|
|
16
|
-
} from '../providers/jira-cache
|
|
16
|
+
} from '../providers/jira-cache'
|
|
17
17
|
import {
|
|
18
18
|
getCachedTasks as getCachedLinearTasks,
|
|
19
19
|
initLinearCacheSchema,
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
replaceStates,
|
|
22
22
|
saveSyncMeta,
|
|
23
23
|
upsertIssues,
|
|
24
|
-
} from '../providers/linear-cache
|
|
24
|
+
} from '../providers/linear-cache'
|
|
25
25
|
|
|
26
26
|
function hmac(secret: string, body: string): string {
|
|
27
27
|
return createHmac('sha256', secret).update(body).digest('hex')
|
package/src/activity.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Database } from 'bun:sqlite'
|
|
2
|
-
import { generateId } from './id
|
|
3
|
-
import type { ActivityEntry, ActivityAction } from './types
|
|
2
|
+
import { generateId } from './id'
|
|
3
|
+
import type { ActivityEntry, ActivityAction } from './types'
|
|
4
4
|
|
|
5
5
|
export function logActivity(
|
|
6
6
|
db: Database,
|
package/src/api.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { KanbanError, ErrorCode } from './errors
|
|
2
|
-
import type { BoardConfig, CliOutput, Task } from './types
|
|
3
|
-
import type { CreateTaskInput, UpdateTaskInput, KanbanProvider } from './providers/types
|
|
1
|
+
import { KanbanError, ErrorCode } from './errors'
|
|
2
|
+
import type { BoardConfig, CliOutput, Task } from './types'
|
|
3
|
+
import type { CreateTaskInput, UpdateTaskInput, KanbanProvider } from './providers/types'
|
|
4
4
|
|
|
5
5
|
export type WsEvent =
|
|
6
6
|
| { type: 'task:upsert'; task: Task; columnName: string }
|
package/src/commands/board.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { Database } from 'bun:sqlite'
|
|
2
|
-
import { initSchema, seedDefaultColumns, isInitialized, resetBoard } from '../db
|
|
3
|
-
import { ErrorCode, KanbanError } from '../errors
|
|
4
|
-
import { success } from '../output
|
|
5
|
-
import type { CliOutput } from '../types
|
|
2
|
+
import { initSchema, seedDefaultColumns, isInitialized, resetBoard } from '../db'
|
|
3
|
+
import { ErrorCode, KanbanError } from '../errors'
|
|
4
|
+
import { success } from '../output'
|
|
5
|
+
import type { CliOutput } from '../types'
|
|
6
6
|
|
|
7
7
|
export function boardInit(db: Database): CliOutput {
|
|
8
8
|
if (isInitialized(db)) {
|
package/src/commands/bulk.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { Database } from 'bun:sqlite'
|
|
2
|
-
import { bulkMoveAll, bulkClearDone } from '../db
|
|
3
|
-
import { ErrorCode, KanbanError } from '../errors
|
|
4
|
-
import { success } from '../output
|
|
5
|
-
import type { CliOutput } from '../types
|
|
2
|
+
import { bulkMoveAll, bulkClearDone } from '../db'
|
|
3
|
+
import { ErrorCode, KanbanError } from '../errors'
|
|
4
|
+
import { success } from '../output'
|
|
5
|
+
import type { CliOutput } from '../types'
|
|
6
6
|
|
|
7
7
|
export function bulkMoveAllCmd(db: Database, args: { from?: string; to?: string }): CliOutput {
|
|
8
8
|
if (!args.from || !args.to) {
|
package/src/commands/column.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { Database } from 'bun:sqlite'
|
|
2
|
-
import { addColumn, listColumns, renameColumn, reorderColumn, deleteColumn } from '../db
|
|
3
|
-
import { ErrorCode, KanbanError } from '../errors
|
|
4
|
-
import { success } from '../output
|
|
5
|
-
import type { CliOutput } from '../types
|
|
2
|
+
import { addColumn, listColumns, renameColumn, reorderColumn, deleteColumn } from '../db'
|
|
3
|
+
import { ErrorCode, KanbanError } from '../errors'
|
|
4
|
+
import { success } from '../output'
|
|
5
|
+
import type { CliOutput } from '../types'
|
|
6
6
|
|
|
7
7
|
export function columnAdd(
|
|
8
8
|
db: Database,
|
package/src/commands/mcp.ts
CHANGED
|
@@ -6,9 +6,9 @@ import {
|
|
|
6
6
|
type CallToolResult,
|
|
7
7
|
} from '@modelcontextprotocol/sdk/types.js'
|
|
8
8
|
import { AjvJsonSchemaValidator } from '@modelcontextprotocol/sdk/validation/ajv'
|
|
9
|
-
import { createTrackerCore, defaultTools, TrackerMcpError } from '../mcp/index
|
|
10
|
-
import type { TrackerMcpPolicy, TrackerMcpTool } from '../mcp/index
|
|
11
|
-
import type { KanbanProvider } from '../providers/types
|
|
9
|
+
import { createTrackerCore, defaultTools, TrackerMcpError } from '../mcp/index'
|
|
10
|
+
import type { TrackerMcpPolicy, TrackerMcpTool } from '../mcp/index'
|
|
11
|
+
import type { KanbanProvider } from '../providers/types'
|
|
12
12
|
|
|
13
13
|
type LocalScope = Record<string, never>
|
|
14
14
|
|
package/src/config.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { readFileSync, writeFileSync, renameSync } from 'node:fs'
|
|
2
2
|
import { dirname, join } from 'node:path'
|
|
3
|
-
import type { BoardConfig } from './types
|
|
3
|
+
import type { BoardConfig } from './types'
|
|
4
4
|
|
|
5
5
|
const DEFAULT_CONFIG: BoardConfig = { members: [], projects: [] }
|
|
6
6
|
|
package/src/db.ts
CHANGED
|
@@ -2,10 +2,10 @@ import { Database } from 'bun:sqlite'
|
|
|
2
2
|
import { existsSync, mkdirSync } from 'node:fs'
|
|
3
3
|
import { homedir } from 'node:os'
|
|
4
4
|
import { join } from 'node:path'
|
|
5
|
-
import { generateId } from './id
|
|
6
|
-
import { ErrorCode, KanbanError } from './errors
|
|
7
|
-
import type { BoardView, Column, Priority, Task, TaskComment, TaskWithColumn } from './types
|
|
8
|
-
import { logActivity, enterColumn, exitColumn } from './activity
|
|
5
|
+
import { generateId } from './id'
|
|
6
|
+
import { ErrorCode, KanbanError } from './errors'
|
|
7
|
+
import type { BoardView, Column, Priority, Task, TaskComment, TaskWithColumn } from './types'
|
|
8
|
+
import { logActivity, enterColumn, exitColumn } from './activity'
|
|
9
9
|
|
|
10
10
|
const DEFAULT_COLUMNS = [
|
|
11
11
|
{ name: 'recurring', position: 0 },
|
package/src/index.ts
CHANGED
|
@@ -2,22 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
import { parseArgs } from 'node:util'
|
|
4
4
|
import { Database } from 'bun:sqlite'
|
|
5
|
-
import { KanbanError, ErrorCode } from './errors
|
|
6
|
-
import { formatOutput, error, success } from './output
|
|
7
|
-
import { openDb, getDbPath, initSchema, migrateSchema, seedDefaultColumns } from './db
|
|
8
|
-
import { boardInit, boardReset } from './commands/board
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
} from './commands/column.ts'
|
|
16
|
-
import { bulkClearDoneCmd, bulkMoveAllCmd } from './commands/bulk.ts'
|
|
17
|
-
import { getConfigPath, loadConfig, saveConfig } from './config.ts'
|
|
18
|
-
import type { CliOutput, Priority } from './types.ts'
|
|
19
|
-
import { createProvider } from './providers/index.ts'
|
|
20
|
-
import { unsupportedOperation } from './providers/errors.ts'
|
|
5
|
+
import { KanbanError, ErrorCode } from './errors'
|
|
6
|
+
import { formatOutput, error, success } from './output'
|
|
7
|
+
import { openDb, getDbPath, initSchema, migrateSchema, seedDefaultColumns } from './db'
|
|
8
|
+
import { boardInit, boardReset } from './commands/board'
|
|
9
|
+
import { columnAdd, columnDelete, columnList, columnRename, columnReorder } from './commands/column'
|
|
10
|
+
import { bulkClearDoneCmd, bulkMoveAllCmd } from './commands/bulk'
|
|
11
|
+
import { getConfigPath, loadConfig, saveConfig } from './config'
|
|
12
|
+
import type { CliOutput, Priority } from './types'
|
|
13
|
+
import { createProvider } from './providers/index'
|
|
14
|
+
import { unsupportedOperation } from './providers/errors'
|
|
21
15
|
|
|
22
16
|
interface ParsedArgs {
|
|
23
17
|
values: Record<string, unknown>
|
|
@@ -415,7 +409,7 @@ if (import.meta.main) {
|
|
|
415
409
|
const db = openDb(dbPath)
|
|
416
410
|
migrateSchema(db)
|
|
417
411
|
const provider = createProvider(db, dbPath)
|
|
418
|
-
const { startStdioMcpServer } = await import('./commands/mcp
|
|
412
|
+
const { startStdioMcpServer } = await import('./commands/mcp')
|
|
419
413
|
await startStdioMcpServer(provider)
|
|
420
414
|
} else if (argv[0] === 'serve') {
|
|
421
415
|
const opts = parseServeArgs(argv)
|
|
@@ -424,11 +418,11 @@ if (import.meta.main) {
|
|
|
424
418
|
const db = openDb(dbPath)
|
|
425
419
|
migrateSchema(db)
|
|
426
420
|
const provider = createProvider(db, dbPath)
|
|
427
|
-
const { startServer } = await import('./server
|
|
421
|
+
const { startServer } = await import('./server')
|
|
428
422
|
startServer(provider, opts.port)
|
|
429
423
|
|
|
430
424
|
if (opts.tunnel) {
|
|
431
|
-
const { startCloudflareTunnel } = await import('./tunnel
|
|
425
|
+
const { startCloudflareTunnel } = await import('./tunnel')
|
|
432
426
|
try {
|
|
433
427
|
const handle = startCloudflareTunnel(opts.port)
|
|
434
428
|
const shutdown = (): void => {
|
package/src/mcp/core.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { KanbanProvider } from '../providers/types
|
|
2
|
-
import type { Task, TaskComment } from '../types
|
|
3
|
-
import { TrackerMcpError, toTrackerMcpError } from './errors
|
|
4
|
-
import type { TrackerMcpHooks, TrackerMcpPolicy } from './types
|
|
1
|
+
import type { KanbanProvider } from '../providers/types'
|
|
2
|
+
import type { Task, TaskComment } from '../types'
|
|
3
|
+
import { TrackerMcpError, toTrackerMcpError } from './errors'
|
|
4
|
+
import type { TrackerMcpHooks, TrackerMcpPolicy } from './types'
|
|
5
5
|
|
|
6
6
|
export interface TrackerCore<TScope> {
|
|
7
7
|
notifyAuthFailure(input: {
|
package/src/mcp/errors.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { McpError, ErrorCode as JsonRpcErrorCode } from '@modelcontextprotocol/sdk/types.js'
|
|
2
|
-
import { ErrorCode, type ErrorCodeValue, KanbanError } from '../errors
|
|
2
|
+
import { ErrorCode, type ErrorCodeValue, KanbanError } from '../errors'
|
|
3
3
|
|
|
4
4
|
export type TrackerMcpErrorCode =
|
|
5
5
|
| 'auth_failed'
|
package/src/mcp/index.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { createTrackerCore } from './core
|
|
2
|
-
export { createTrackerMcpServer } from './server
|
|
3
|
-
export { TrackerMcpError, type TrackerMcpErrorCode } from './errors
|
|
4
|
-
export type { TrackerCore } from './core
|
|
1
|
+
export { createTrackerCore } from './core'
|
|
2
|
+
export { createTrackerMcpServer } from './server'
|
|
3
|
+
export { TrackerMcpError, type TrackerMcpErrorCode } from './errors'
|
|
4
|
+
export type { TrackerCore } from './core'
|
|
5
5
|
export type {
|
|
6
6
|
TrackerMcpAuthResolver,
|
|
7
7
|
TrackerMcpHooks,
|
|
@@ -9,5 +9,5 @@ export type {
|
|
|
9
9
|
TrackerMcpServer,
|
|
10
10
|
TrackerMcpTool,
|
|
11
11
|
TrackerMcpToolHandlerContext,
|
|
12
|
-
} from './types
|
|
13
|
-
export { defaultTools } from './server
|
|
12
|
+
} from './types'
|
|
13
|
+
export { defaultTools } from './server'
|
package/src/mcp/server.ts
CHANGED
|
@@ -13,9 +13,9 @@ import type {
|
|
|
13
13
|
JsonSchemaValidatorResult,
|
|
14
14
|
JsonSchemaType,
|
|
15
15
|
} from '@modelcontextprotocol/sdk/validation'
|
|
16
|
-
import type { TrackerCore } from './core
|
|
17
|
-
import { TrackerMcpError, toMcpError, toTrackerMcpError, trackerMcpJsonRpcCode } from './errors
|
|
18
|
-
import type { TrackerMcpAuthResolver, TrackerMcpServer, TrackerMcpTool } from './types
|
|
16
|
+
import type { TrackerCore } from './core'
|
|
17
|
+
import { TrackerMcpError, toMcpError, toTrackerMcpError, trackerMcpJsonRpcCode } from './errors'
|
|
18
|
+
import type { TrackerMcpAuthResolver, TrackerMcpServer, TrackerMcpTool } from './types'
|
|
19
19
|
|
|
20
20
|
const EMPTY_OBJECT_SCHEMA = {
|
|
21
21
|
type: 'object',
|
package/src/mcp/types.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ToolAnnotations } from '@modelcontextprotocol/sdk/types.js'
|
|
2
2
|
import type { JsonSchemaType } from '@modelcontextprotocol/sdk/validation'
|
|
3
|
-
import type { TaskComment } from '../types
|
|
4
|
-
import type { TrackerMcpError, TrackerMcpErrorCode } from './errors
|
|
3
|
+
import type { TaskComment } from '../types'
|
|
4
|
+
import type { TrackerMcpError, TrackerMcpErrorCode } from './errors'
|
|
5
5
|
|
|
6
6
|
export type TrackerMcpAuthResolver<TScope> = (ctx: {
|
|
7
7
|
request: Request
|
package/src/metrics.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Database } from 'bun:sqlite'
|
|
2
|
-
import type { ActivityEntry, BoardMetrics } from './types
|
|
2
|
+
import type { ActivityEntry, BoardMetrics } from './types'
|
|
3
3
|
|
|
4
4
|
function getDistinctTaskFieldValues(db: Database, field: 'assignee' | 'project'): string[] {
|
|
5
5
|
return (
|
package/src/output.ts
CHANGED
|
@@ -1,40 +1,30 @@
|
|
|
1
|
-
import type { ProviderCapabilities } from '../types
|
|
1
|
+
import type { ProviderCapabilities } from '../types'
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
function capabilities(overrides: Partial<ProviderCapabilities> = {}): ProviderCapabilities {
|
|
4
|
+
return {
|
|
5
|
+
taskCreate: true,
|
|
6
|
+
taskUpdate: true,
|
|
7
|
+
taskMove: true,
|
|
8
|
+
taskDelete: false,
|
|
9
|
+
comment: true,
|
|
10
|
+
activity: false,
|
|
11
|
+
metrics: false,
|
|
12
|
+
columnCrud: false,
|
|
13
|
+
bulk: false,
|
|
14
|
+
configEdit: false,
|
|
15
|
+
...overrides,
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const LOCAL_CAPABILITIES: ProviderCapabilities = capabilities({
|
|
7
20
|
taskDelete: true,
|
|
8
|
-
comment: true,
|
|
9
21
|
activity: true,
|
|
10
22
|
metrics: true,
|
|
11
23
|
columnCrud: true,
|
|
12
24
|
bulk: true,
|
|
13
25
|
configEdit: true,
|
|
14
|
-
}
|
|
26
|
+
})
|
|
15
27
|
|
|
16
|
-
export const LINEAR_CAPABILITIES: ProviderCapabilities =
|
|
17
|
-
taskCreate: true,
|
|
18
|
-
taskUpdate: true,
|
|
19
|
-
taskMove: true,
|
|
20
|
-
taskDelete: false,
|
|
21
|
-
comment: true,
|
|
22
|
-
activity: false,
|
|
23
|
-
metrics: false,
|
|
24
|
-
columnCrud: false,
|
|
25
|
-
bulk: false,
|
|
26
|
-
configEdit: false,
|
|
27
|
-
}
|
|
28
|
+
export const LINEAR_CAPABILITIES: ProviderCapabilities = capabilities()
|
|
28
29
|
|
|
29
|
-
export const JIRA_CAPABILITIES: ProviderCapabilities =
|
|
30
|
-
taskCreate: true,
|
|
31
|
-
taskUpdate: true,
|
|
32
|
-
taskMove: true,
|
|
33
|
-
taskDelete: false,
|
|
34
|
-
comment: true,
|
|
35
|
-
activity: false,
|
|
36
|
-
metrics: false,
|
|
37
|
-
columnCrud: false,
|
|
38
|
-
bulk: false,
|
|
39
|
-
configEdit: false,
|
|
40
|
-
}
|
|
30
|
+
export const JIRA_CAPABILITIES: ProviderCapabilities = capabilities()
|
package/src/providers/errors.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ErrorCode, type ErrorCodeValue, KanbanError } from '../errors
|
|
1
|
+
import { ErrorCode, type ErrorCodeValue, KanbanError } from '../errors'
|
|
2
2
|
|
|
3
3
|
export function unsupportedOperation(message: string): never {
|
|
4
4
|
throw new KanbanError(ErrorCode.UNSUPPORTED_OPERATION, message)
|
package/src/providers/index.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { Database } from 'bun:sqlite'
|
|
2
|
-
import { getDbPath, initSchema, seedDefaultColumns } from '../db
|
|
3
|
-
import { providerNotConfigured } from './errors
|
|
4
|
-
import { JiraProvider } from './jira
|
|
5
|
-
import { LinearProvider } from './linear
|
|
6
|
-
import { LocalProvider } from './local
|
|
7
|
-
import type { KanbanProvider } from './types
|
|
2
|
+
import { getDbPath, initSchema, seedDefaultColumns } from '../db'
|
|
3
|
+
import { providerNotConfigured } from './errors'
|
|
4
|
+
import { JiraProvider } from './jira'
|
|
5
|
+
import { LinearProvider } from './linear'
|
|
6
|
+
import { LocalProvider } from './local'
|
|
7
|
+
import type { KanbanProvider } from './types'
|
|
8
8
|
|
|
9
9
|
export function createProvider(db: Database, dbPath = getDbPath()): KanbanProvider {
|
|
10
10
|
const providerType = (process.env['KANBAN_PROVIDER'] ?? 'local') as 'local' | 'linear' | 'jira'
|