@proletariat/cli 0.3.58 → 0.3.60
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/dist/commands/{spec → dashboard}/index.d.ts +4 -4
- package/dist/commands/dashboard/index.js +117 -0
- package/dist/commands/dashboard/index.js.map +1 -0
- package/dist/commands/execution/config.js +5 -4
- package/dist/commands/execution/config.js.map +1 -1
- package/dist/commands/execution/stop.js +4 -2
- package/dist/commands/execution/stop.js.map +1 -1
- package/dist/commands/execution/view.js +3 -0
- package/dist/commands/execution/view.js.map +1 -1
- package/dist/commands/init.d.ts +1 -0
- package/dist/commands/init.js +40 -3
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/mcp-server.js +1 -2
- package/dist/commands/mcp-server.js.map +1 -1
- package/dist/commands/{spec/link/index.d.ts → session/exec.d.ts} +5 -3
- package/dist/commands/session/exec.js +205 -0
- package/dist/commands/session/exec.js.map +1 -0
- package/dist/commands/session/index.js +12 -0
- package/dist/commands/session/index.js.map +1 -1
- package/dist/commands/{spec/delete.d.ts → session/inspect.d.ts} +3 -3
- package/dist/commands/session/inspect.js +316 -0
- package/dist/commands/session/inspect.js.map +1 -0
- package/dist/commands/session/peek.d.ts +15 -0
- package/dist/commands/session/peek.js +141 -8
- package/dist/commands/session/peek.js.map +1 -1
- package/dist/commands/session/poke.d.ts +4 -1
- package/dist/commands/session/poke.js +175 -20
- package/dist/commands/session/poke.js.map +1 -1
- package/dist/commands/{spec/link/depends.d.ts → session/restart.d.ts} +6 -4
- package/dist/commands/session/restart.js +320 -0
- package/dist/commands/session/restart.js.map +1 -0
- package/dist/commands/ticket/list.d.ts +10 -0
- package/dist/commands/ticket/list.js +126 -1
- package/dist/commands/ticket/list.js.map +1 -1
- package/dist/commands/tools/add.d.ts +20 -0
- package/dist/commands/tools/add.js +129 -0
- package/dist/commands/tools/add.js.map +1 -0
- package/dist/commands/tools/check.d.ts +10 -0
- package/dist/commands/tools/check.js +75 -0
- package/dist/commands/tools/check.js.map +1 -0
- package/dist/commands/tools/detect.d.ts +11 -0
- package/dist/commands/tools/detect.js +107 -0
- package/dist/commands/tools/detect.js.map +1 -0
- package/dist/commands/tools/index.d.ts +11 -0
- package/dist/commands/tools/index.js +87 -0
- package/dist/commands/tools/index.js.map +1 -0
- package/dist/commands/tools/remove.d.ts +13 -0
- package/dist/commands/tools/remove.js +55 -0
- package/dist/commands/tools/remove.js.map +1 -0
- package/dist/commands/{spec/view.d.ts → trello/configure.d.ts} +6 -6
- package/dist/commands/trello/configure.js +259 -0
- package/dist/commands/trello/configure.js.map +1 -0
- package/dist/commands/{spec/plan.d.ts → trello/import.d.ts} +3 -5
- package/dist/commands/trello/import.js +241 -0
- package/dist/commands/trello/import.js.map +1 -0
- package/dist/commands/{spec/ticket.d.ts → trello/sync.d.ts} +5 -6
- package/dist/commands/trello/sync.js +190 -0
- package/dist/commands/trello/sync.js.map +1 -0
- package/dist/commands/work/start.d.ts +1 -0
- package/dist/commands/work/start.js +17 -39
- package/dist/commands/work/start.js.map +1 -1
- package/dist/lib/dashboard/data.d.ts +64 -0
- package/dist/lib/dashboard/data.js +259 -0
- package/dist/lib/dashboard/data.js.map +1 -0
- package/dist/lib/dashboard/html.d.ts +7 -0
- package/dist/lib/dashboard/html.js +682 -0
- package/dist/lib/dashboard/html.js.map +1 -0
- package/dist/lib/dashboard/server.d.ts +20 -0
- package/dist/lib/dashboard/server.js +114 -0
- package/dist/lib/dashboard/server.js.map +1 -0
- package/dist/lib/events/events.d.ts +26 -2
- package/dist/lib/events/events.js +3 -2
- package/dist/lib/events/events.js.map +1 -1
- package/dist/lib/execution/config.d.ts +8 -0
- package/dist/lib/execution/config.js +83 -4
- package/dist/lib/execution/config.js.map +1 -1
- package/dist/lib/execution/runners.d.ts +36 -3
- package/dist/lib/execution/runners.js +216 -35
- package/dist/lib/execution/runners.js.map +1 -1
- package/dist/lib/execution/spawner.d.ts +2 -0
- package/dist/lib/execution/spawner.js +22 -31
- package/dist/lib/execution/spawner.js.map +1 -1
- package/dist/lib/execution/types.d.ts +26 -5
- package/dist/lib/execution/types.js +24 -0
- package/dist/lib/execution/types.js.map +1 -1
- package/dist/lib/external-issues/adapters.d.ts +17 -0
- package/dist/lib/external-issues/adapters.js +88 -0
- package/dist/lib/external-issues/adapters.js.map +1 -1
- package/dist/lib/external-issues/index.d.ts +1 -0
- package/dist/lib/external-issues/index.js +2 -0
- package/dist/lib/external-issues/index.js.map +1 -1
- package/dist/lib/external-issues/mapping-store.js +1 -1
- package/dist/lib/external-issues/outbound-sync.d.ts +79 -0
- package/dist/lib/external-issues/outbound-sync.js +296 -0
- package/dist/lib/external-issues/outbound-sync.js.map +1 -0
- package/dist/lib/external-issues/trello.d.ts +80 -0
- package/dist/lib/external-issues/trello.js +266 -0
- package/dist/lib/external-issues/trello.js.map +1 -0
- package/dist/lib/external-issues/types.d.ts +3 -3
- package/dist/lib/external-issues/types.js +1 -1
- package/dist/lib/external-issues/types.js.map +1 -1
- package/dist/lib/linear/client.d.ts +4 -3
- package/dist/lib/linear/client.js +185 -122
- package/dist/lib/linear/client.js.map +1 -1
- package/dist/lib/mcp/tools/cli-passthrough.js +77 -0
- package/dist/lib/mcp/tools/cli-passthrough.js.map +1 -1
- package/dist/lib/mcp/tools/index.d.ts +0 -1
- package/dist/lib/mcp/tools/index.js +0 -1
- package/dist/lib/mcp/tools/index.js.map +1 -1
- package/dist/lib/onboarding/detect-tools.d.ts +15 -0
- package/dist/lib/onboarding/detect-tools.js +44 -0
- package/dist/lib/onboarding/detect-tools.js.map +1 -0
- package/dist/lib/onboarding/index.d.ts +2 -0
- package/dist/lib/onboarding/index.js +3 -0
- package/dist/lib/onboarding/index.js.map +1 -0
- package/dist/lib/onboarding/wizard.d.ts +25 -0
- package/dist/lib/onboarding/wizard.js +156 -0
- package/dist/lib/onboarding/wizard.js.map +1 -0
- package/dist/lib/pmo/schema.d.ts +2 -1
- package/dist/lib/pmo/schema.js +3 -1
- package/dist/lib/pmo/schema.js.map +1 -1
- package/dist/lib/pmo/storage/tickets.d.ts +8 -0
- package/dist/lib/pmo/storage/tickets.js +56 -2
- package/dist/lib/pmo/storage/tickets.js.map +1 -1
- package/dist/lib/pmo/sync-manager.js +3 -0
- package/dist/lib/pmo/sync-manager.js.map +1 -1
- package/dist/lib/runners/claude-code-runner.js +6 -0
- package/dist/lib/runners/claude-code-runner.js.map +1 -1
- package/dist/lib/tool-registry/detect.d.ts +20 -0
- package/dist/lib/tool-registry/detect.js +95 -0
- package/dist/lib/tool-registry/detect.js.map +1 -0
- package/dist/lib/tool-registry/index.d.ts +10 -0
- package/dist/lib/tool-registry/index.js +13 -0
- package/dist/lib/tool-registry/index.js.map +1 -0
- package/dist/lib/tool-registry/policy.d.ts +32 -0
- package/dist/lib/tool-registry/policy.js +97 -0
- package/dist/lib/tool-registry/policy.js.map +1 -0
- package/dist/lib/tool-registry/registry.d.ts +42 -0
- package/dist/lib/tool-registry/registry.js +120 -0
- package/dist/lib/tool-registry/registry.js.map +1 -0
- package/dist/lib/tool-registry/spawn.d.ts +50 -0
- package/dist/lib/tool-registry/spawn.js +103 -0
- package/dist/lib/tool-registry/spawn.js.map +1 -0
- package/dist/lib/tool-registry/types.d.ts +56 -0
- package/dist/lib/tool-registry/types.js +109 -0
- package/dist/lib/tool-registry/types.js.map +1 -0
- package/dist/lib/trello/client.d.ts +23 -0
- package/dist/lib/trello/client.js +114 -0
- package/dist/lib/trello/client.js.map +1 -0
- package/dist/lib/trello/config.d.ts +55 -0
- package/dist/lib/trello/config.js +127 -0
- package/dist/lib/trello/config.js.map +1 -0
- package/dist/lib/trello/index.d.ts +5 -0
- package/dist/lib/trello/index.js +5 -0
- package/dist/lib/trello/index.js.map +1 -0
- package/dist/lib/trello/mapper.d.ts +13 -0
- package/dist/lib/trello/mapper.js +71 -0
- package/dist/lib/trello/mapper.js.map +1 -0
- package/dist/lib/trello/sync.d.ts +13 -0
- package/dist/lib/trello/sync.js +38 -0
- package/dist/lib/trello/sync.js.map +1 -0
- package/dist/lib/trello/types.d.ts +53 -0
- package/dist/lib/trello/types.js +2 -0
- package/dist/lib/trello/types.js.map +1 -0
- package/dist/lib/work-source/client.js +17 -0
- package/dist/lib/work-source/client.js.map +1 -1
- package/dist/lib/work-source/config.d.ts +1 -1
- package/dist/lib/work-source/config.js +23 -1
- package/dist/lib/work-source/config.js.map +1 -1
- package/dist/lib/work-source/index.d.ts +1 -0
- package/dist/lib/work-source/index.js +1 -0
- package/dist/lib/work-source/index.js.map +1 -1
- package/dist/lib/work-source/provider-sources.d.ts +113 -0
- package/dist/lib/work-source/provider-sources.js +227 -0
- package/dist/lib/work-source/provider-sources.js.map +1 -0
- package/oclif.manifest.json +4368 -4364
- package/package.json +6 -2
- package/dist/commands/spec/create.d.ts +0 -20
- package/dist/commands/spec/create.js +0 -171
- package/dist/commands/spec/create.js.map +0 -1
- package/dist/commands/spec/delete.js +0 -112
- package/dist/commands/spec/delete.js.map +0 -1
- package/dist/commands/spec/edit.d.ts +0 -23
- package/dist/commands/spec/edit.js +0 -262
- package/dist/commands/spec/edit.js.map +0 -1
- package/dist/commands/spec/index.js +0 -88
- package/dist/commands/spec/index.js.map +0 -1
- package/dist/commands/spec/link/depends.js +0 -87
- package/dist/commands/spec/link/depends.js.map +0 -1
- package/dist/commands/spec/link/index.js +0 -93
- package/dist/commands/spec/link/index.js.map +0 -1
- package/dist/commands/spec/link/remove.d.ts +0 -18
- package/dist/commands/spec/link/remove.js +0 -91
- package/dist/commands/spec/link/remove.js.map +0 -1
- package/dist/commands/spec/list.d.ts +0 -14
- package/dist/commands/spec/list.js +0 -101
- package/dist/commands/spec/list.js.map +0 -1
- package/dist/commands/spec/plan.js +0 -102
- package/dist/commands/spec/plan.js.map +0 -1
- package/dist/commands/spec/ticket.js +0 -144
- package/dist/commands/spec/ticket.js.map +0 -1
- package/dist/commands/spec/view.js +0 -202
- package/dist/commands/spec/view.js.map +0 -1
- package/dist/lib/mcp/tools/spec.d.ts +0 -6
- package/dist/lib/mcp/tools/spec.js +0 -197
- package/dist/lib/mcp/tools/spec.js.map +0 -1
- package/dist/lib/pmo/spec-parser.d.ts +0 -25
- package/dist/lib/pmo/spec-parser.js +0 -206
- package/dist/lib/pmo/spec-parser.js.map +0 -1
- package/dist/lib/pmo/spec-types.d.ts +0 -43
- package/dist/lib/pmo/spec-types.js +0 -8
- package/dist/lib/pmo/spec-types.js.map +0 -1
|
@@ -9,15 +9,15 @@
|
|
|
9
9
|
* Supported external issue sources.
|
|
10
10
|
*
|
|
11
11
|
*/
|
|
12
|
-
export type IssueSource = 'linear' | 'jira' | 'asana' | 'shortcut';
|
|
12
|
+
export type IssueSource = 'linear' | 'jira' | 'asana' | 'shortcut' | 'trello';
|
|
13
13
|
/**
|
|
14
14
|
* All valid issue sources as a const array.
|
|
15
15
|
*/
|
|
16
|
-
export declare const ISSUE_SOURCES: readonly ["linear", "jira", "asana", "shortcut"];
|
|
16
|
+
export declare const ISSUE_SOURCES: readonly ["linear", "jira", "asana", "shortcut", "trello"];
|
|
17
17
|
/**
|
|
18
18
|
* Providers supported by the external execution mapping store.
|
|
19
19
|
*/
|
|
20
|
-
export type ExternalMappingProvider = 'linear' | 'jira' | 'shortcut' | 'asana' | 'monday' | 'pmo';
|
|
20
|
+
export type ExternalMappingProvider = 'linear' | 'jira' | 'shortcut' | 'asana' | 'trello' | 'monday' | 'pmo';
|
|
21
21
|
/**
|
|
22
22
|
* Canonical envelope for external issues/work items.
|
|
23
23
|
*
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
/**
|
|
9
9
|
* All valid issue sources as a const array.
|
|
10
10
|
*/
|
|
11
|
-
export const ISSUE_SOURCES = ['linear', 'jira', 'asana', 'shortcut'];
|
|
11
|
+
export const ISSUE_SOURCES = ['linear', 'jira', 'asana', 'shortcut', 'trello'];
|
|
12
12
|
/**
|
|
13
13
|
* Typed error for external issue operations.
|
|
14
14
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/lib/external-issues/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAYH;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,CAAU,CAAA;AA+
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/lib/external-issues/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAYH;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,CAAU,CAAA;AA+MvF;;GAEG;AACH,MAAM,OAAO,kBAAmB,SAAQ,KAAK;IAElC;IAEA;IACA;IAJT,YACS,IAA4B,EACnC,OAAe,EACR,MAAoB,EACpB,gBAAyC;QAEhD,KAAK,CAAC,OAAO,CAAC,CAAA;QALP,SAAI,GAAJ,IAAI,CAAwB;QAE5B,WAAM,GAAN,MAAM,CAAc;QACpB,qBAAgB,GAAhB,gBAAgB,CAAyB;QAGhD,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAA;IAClC,CAAC;CACF;AAgBD;;;;;GAKG;AACH,MAAM,OAAO,yBAA0B,SAAQ,KAAK;IAEhC;IAEA;IAHlB,YACkB,IAAmC,EACnD,OAAe,EACC,WAAqB;QAErC,KAAK,CAAC,OAAO,CAAC,CAAA;QAJE,SAAI,GAAJ,IAAI,CAA+B;QAEnC,gBAAW,GAAX,WAAW,CAAU;QAGrC,IAAI,CAAC,IAAI,GAAG,2BAA2B,CAAA;IACzC,CAAC;CACF;AAmED;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CAClC,QAAuB,EACvB,QAAwB;IAExB,OAAO;QACL,MAAM,EAAE;YACN,IAAI,EAAE,QAAQ,CAAC,MAAM;YACrB,UAAU,EAAE,QAAQ,CAAC,WAAW;YAChC,WAAW,EAAE,QAAQ,CAAC,YAAY;YAClC,GAAG,EAAE,QAAQ,CAAC,GAAG;YACjB,GAAG,EAAE,QAAQ,CAAC,GAAG;SAClB;QACD,KAAK,EAAE,QAAQ,CAAC,KAAK;QACrB,WAAW,EAAE,QAAQ,CAAC,WAAW;QACjC,MAAM,EAAE,QAAQ,CAAC,MAAM;QACvB,QAAQ,EAAE,QAAQ,CAAC,QAAQ;QAC3B,MAAM,EAAE,QAAQ,CAAC,MAAM;QACvB,UAAU,EAAE,QAAQ,CAAC,WAAW;QAChC,QAAQ,EAAE,QAAQ,CAAC,QAAQ;QAC3B,QAAQ,EAAE,QAAQ,IAAI,IAAI;QAC1B,QAAQ,EAAE,QAAQ,CAAC,SAAS,IAAI,IAAI;KACrC,CAAA;AACH,CAAC"}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Linear API Client
|
|
3
3
|
*
|
|
4
|
-
* Thin wrapper
|
|
5
|
-
*
|
|
4
|
+
* Thin wrapper using direct GraphQL queries for Linear API access.
|
|
5
|
+
* Provides typed access to issues, teams, states, and cycles for the PMO integration.
|
|
6
6
|
*/
|
|
7
7
|
import type { LinearIssue, LinearTeam, LinearWorkflowState, LinearCycle, LinearIssueFilter } from './types.js';
|
|
8
8
|
export declare class LinearClient {
|
|
9
|
-
private
|
|
9
|
+
private apiKey;
|
|
10
10
|
constructor(apiKey: string);
|
|
11
|
+
private query;
|
|
11
12
|
/**
|
|
12
13
|
* Verify the API key is valid and return the authenticated user's organization.
|
|
13
14
|
*/
|
|
@@ -1,33 +1,64 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Linear API Client
|
|
3
3
|
*
|
|
4
|
-
* Thin wrapper
|
|
5
|
-
*
|
|
4
|
+
* Thin wrapper using direct GraphQL queries for Linear API access.
|
|
5
|
+
* Provides typed access to issues, teams, states, and cycles for the PMO integration.
|
|
6
6
|
*/
|
|
7
|
-
|
|
7
|
+
const LINEAR_API_URL = 'https://api.linear.app/graphql';
|
|
8
8
|
export class LinearClient {
|
|
9
|
-
|
|
9
|
+
apiKey;
|
|
10
10
|
constructor(apiKey) {
|
|
11
|
-
this.
|
|
11
|
+
this.apiKey = apiKey;
|
|
12
|
+
}
|
|
13
|
+
async query(gql, variables) {
|
|
14
|
+
const response = await fetch(LINEAR_API_URL, {
|
|
15
|
+
method: 'POST',
|
|
16
|
+
headers: {
|
|
17
|
+
'Content-Type': 'application/json',
|
|
18
|
+
Authorization: this.apiKey,
|
|
19
|
+
},
|
|
20
|
+
body: JSON.stringify({ query: gql, variables }),
|
|
21
|
+
});
|
|
22
|
+
if (!response.ok) {
|
|
23
|
+
throw new Error(`Linear API request failed with status ${response.status}`);
|
|
24
|
+
}
|
|
25
|
+
const result = (await response.json());
|
|
26
|
+
if (result.errors && result.errors.length > 0) {
|
|
27
|
+
throw new Error(`Linear API error: ${result.errors[0].message}`);
|
|
28
|
+
}
|
|
29
|
+
if (!result.data) {
|
|
30
|
+
throw new Error('Linear API returned no data');
|
|
31
|
+
}
|
|
32
|
+
return result.data;
|
|
12
33
|
}
|
|
13
34
|
/**
|
|
14
35
|
* Verify the API key is valid and return the authenticated user's organization.
|
|
15
36
|
*/
|
|
16
37
|
async verify() {
|
|
17
|
-
const
|
|
18
|
-
|
|
38
|
+
const data = await this.query(`
|
|
39
|
+
query {
|
|
40
|
+
viewer { name email }
|
|
41
|
+
organization { name }
|
|
42
|
+
}
|
|
43
|
+
`);
|
|
19
44
|
return {
|
|
20
|
-
organizationName:
|
|
21
|
-
userName: viewer.name,
|
|
22
|
-
email: viewer.email,
|
|
45
|
+
organizationName: data.organization.name,
|
|
46
|
+
userName: data.viewer.name,
|
|
47
|
+
email: data.viewer.email,
|
|
23
48
|
};
|
|
24
49
|
}
|
|
25
50
|
/**
|
|
26
51
|
* List all teams in the workspace.
|
|
27
52
|
*/
|
|
28
53
|
async listTeams() {
|
|
29
|
-
const
|
|
30
|
-
|
|
54
|
+
const data = await this.query(`
|
|
55
|
+
query {
|
|
56
|
+
teams {
|
|
57
|
+
nodes { id key name description }
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
`);
|
|
61
|
+
return data.teams.nodes.map((t) => ({
|
|
31
62
|
id: t.id,
|
|
32
63
|
key: t.key,
|
|
33
64
|
name: t.name,
|
|
@@ -45,9 +76,16 @@ export class LinearClient {
|
|
|
45
76
|
* List workflow states for a team.
|
|
46
77
|
*/
|
|
47
78
|
async listStates(teamId) {
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
|
|
79
|
+
const data = await this.query(`
|
|
80
|
+
query TeamStates($teamId: String!) {
|
|
81
|
+
team(id: $teamId) {
|
|
82
|
+
states {
|
|
83
|
+
nodes { id name type color position }
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
`, { teamId });
|
|
88
|
+
return data.team.states.nodes.map((s) => ({
|
|
51
89
|
id: s.id,
|
|
52
90
|
name: s.name,
|
|
53
91
|
type: s.type,
|
|
@@ -59,14 +97,21 @@ export class LinearClient {
|
|
|
59
97
|
* List cycles for a team.
|
|
60
98
|
*/
|
|
61
99
|
async listCycles(teamId) {
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
|
|
100
|
+
const data = await this.query(`
|
|
101
|
+
query TeamCycles($teamId: String!) {
|
|
102
|
+
team(id: $teamId) {
|
|
103
|
+
cycles {
|
|
104
|
+
nodes { id name number startsAt endsAt }
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
`, { teamId });
|
|
109
|
+
return data.team.cycles.nodes.map((c) => ({
|
|
65
110
|
id: c.id,
|
|
66
111
|
name: c.name ?? `Cycle ${c.number}`,
|
|
67
112
|
number: c.number,
|
|
68
|
-
startsAt: c.startsAt
|
|
69
|
-
endsAt: c.endsAt
|
|
113
|
+
startsAt: c.startsAt ?? '',
|
|
114
|
+
endsAt: c.endsAt ?? '',
|
|
70
115
|
}));
|
|
71
116
|
}
|
|
72
117
|
/**
|
|
@@ -87,8 +132,11 @@ export class LinearClient {
|
|
|
87
132
|
queryFilter.state = { name: { eqIgnoreCase: filter.stateName } };
|
|
88
133
|
}
|
|
89
134
|
if (filter.assigneeMe) {
|
|
90
|
-
|
|
91
|
-
|
|
135
|
+
// Fetch viewer ID first
|
|
136
|
+
const viewerData = await this.query(`
|
|
137
|
+
query { viewer { id } }
|
|
138
|
+
`);
|
|
139
|
+
queryFilter.assignee = { id: { eq: viewerData.viewer.id } };
|
|
92
140
|
}
|
|
93
141
|
else if (filter.assigneeId) {
|
|
94
142
|
queryFilter.assignee = { id: { eq: filter.assigneeId } };
|
|
@@ -102,156 +150,171 @@ export class LinearClient {
|
|
|
102
150
|
if (filter.projectId) {
|
|
103
151
|
queryFilter.project = { id: { eq: filter.projectId } };
|
|
104
152
|
}
|
|
105
|
-
const
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
// eslint-disable-next-line no-await-in-loop
|
|
118
|
-
const labelsConn = await issue.labels();
|
|
119
|
-
// eslint-disable-next-line no-await-in-loop
|
|
120
|
-
const cycle = await issue.cycle;
|
|
121
|
-
// eslint-disable-next-line no-await-in-loop
|
|
122
|
-
const project = await issue.project;
|
|
123
|
-
results.push({
|
|
124
|
-
id: issue.id,
|
|
125
|
-
identifier: issue.identifier,
|
|
126
|
-
title: issue.title,
|
|
127
|
-
description: issue.description ?? undefined,
|
|
128
|
-
priority: issue.priority,
|
|
129
|
-
state: state ? {
|
|
130
|
-
id: state.id,
|
|
131
|
-
name: state.name,
|
|
132
|
-
type: state.type,
|
|
133
|
-
} : { id: '', name: 'Unknown', type: 'backlog' },
|
|
134
|
-
team: team ? {
|
|
135
|
-
id: team.id,
|
|
136
|
-
key: team.key,
|
|
137
|
-
name: team.name,
|
|
138
|
-
} : { id: '', key: '', name: 'Unknown' },
|
|
139
|
-
assignee: assignee ? {
|
|
140
|
-
id: assignee.id,
|
|
141
|
-
name: assignee.name,
|
|
142
|
-
email: assignee.email,
|
|
143
|
-
} : undefined,
|
|
144
|
-
labels: labelsConn.nodes.map((l) => ({
|
|
145
|
-
id: l.id,
|
|
146
|
-
name: l.name,
|
|
147
|
-
color: l.color,
|
|
148
|
-
})),
|
|
149
|
-
cycle: cycle ? {
|
|
150
|
-
id: cycle.id,
|
|
151
|
-
name: cycle.name ?? `Cycle ${cycle.number}`,
|
|
152
|
-
number: cycle.number,
|
|
153
|
-
} : undefined,
|
|
154
|
-
project: project ? {
|
|
155
|
-
id: project.id,
|
|
156
|
-
name: project.name,
|
|
157
|
-
} : undefined,
|
|
158
|
-
estimate: issue.estimate ?? undefined,
|
|
159
|
-
dueDate: issue.dueDate ?? undefined,
|
|
160
|
-
url: issue.url,
|
|
161
|
-
createdAt: issue.createdAt.toISOString(),
|
|
162
|
-
updatedAt: issue.updatedAt.toISOString(),
|
|
163
|
-
});
|
|
153
|
+
const data = await this.query(`
|
|
154
|
+
query Issues($filter: IssueFilter, $first: Int!) {
|
|
155
|
+
issues(filter: $filter, first: $first) {
|
|
156
|
+
nodes {
|
|
157
|
+
id identifier title description priority estimate dueDate url createdAt updatedAt
|
|
158
|
+
state { id name type }
|
|
159
|
+
team { id key name }
|
|
160
|
+
assignee { id name email }
|
|
161
|
+
labels { nodes { id name color } }
|
|
162
|
+
cycle { id name number }
|
|
163
|
+
project { id name }
|
|
164
|
+
}
|
|
164
165
|
}
|
|
165
|
-
|
|
166
|
+
}
|
|
167
|
+
`, { filter: queryFilter, first: filter.limit ?? 50 });
|
|
168
|
+
return data.issues.nodes.map((issue) => ({
|
|
169
|
+
id: issue.id,
|
|
170
|
+
identifier: issue.identifier,
|
|
171
|
+
title: issue.title,
|
|
172
|
+
description: issue.description ?? undefined,
|
|
173
|
+
priority: issue.priority,
|
|
174
|
+
state: issue.state ? {
|
|
175
|
+
id: issue.state.id,
|
|
176
|
+
name: issue.state.name,
|
|
177
|
+
type: issue.state.type,
|
|
178
|
+
} : { id: '', name: 'Unknown', type: 'backlog' },
|
|
179
|
+
team: issue.team ? {
|
|
180
|
+
id: issue.team.id,
|
|
181
|
+
key: issue.team.key,
|
|
182
|
+
name: issue.team.name,
|
|
183
|
+
} : { id: '', key: '', name: 'Unknown' },
|
|
184
|
+
assignee: issue.assignee ? {
|
|
185
|
+
id: issue.assignee.id,
|
|
186
|
+
name: issue.assignee.name,
|
|
187
|
+
email: issue.assignee.email,
|
|
188
|
+
} : undefined,
|
|
189
|
+
labels: issue.labels.nodes.map((l) => ({
|
|
190
|
+
id: l.id,
|
|
191
|
+
name: l.name,
|
|
192
|
+
color: l.color,
|
|
193
|
+
})),
|
|
194
|
+
cycle: issue.cycle ? {
|
|
195
|
+
id: issue.cycle.id,
|
|
196
|
+
name: issue.cycle.name ?? `Cycle ${issue.cycle.number}`,
|
|
197
|
+
number: issue.cycle.number,
|
|
198
|
+
} : undefined,
|
|
199
|
+
project: issue.project ? {
|
|
200
|
+
id: issue.project.id,
|
|
201
|
+
name: issue.project.name,
|
|
202
|
+
} : undefined,
|
|
203
|
+
estimate: issue.estimate ?? undefined,
|
|
204
|
+
dueDate: issue.dueDate ?? undefined,
|
|
205
|
+
url: issue.url,
|
|
206
|
+
createdAt: issue.createdAt,
|
|
207
|
+
updatedAt: issue.updatedAt,
|
|
208
|
+
}));
|
|
166
209
|
}
|
|
167
210
|
/**
|
|
168
211
|
* Fetch a single issue by its identifier (e.g., "ENG-123").
|
|
169
212
|
*/
|
|
170
213
|
async getIssueByIdentifier(identifier) {
|
|
171
|
-
// Parse team key from identifier
|
|
172
214
|
const match = identifier.match(/^([A-Z]+)-(\d+)$/i);
|
|
173
215
|
if (!match)
|
|
174
216
|
return null;
|
|
175
217
|
const [, teamKey, numberStr] = match;
|
|
176
|
-
const
|
|
218
|
+
const data = await this.query(`
|
|
219
|
+
query IssueByIdentifier($filter: IssueFilter!) {
|
|
220
|
+
issues(filter: $filter, first: 1) {
|
|
221
|
+
nodes {
|
|
222
|
+
id identifier title description priority estimate dueDate url createdAt updatedAt
|
|
223
|
+
state { id name type }
|
|
224
|
+
team { id key name }
|
|
225
|
+
assignee { id name email }
|
|
226
|
+
labels { nodes { id name color } }
|
|
227
|
+
cycle { id name number }
|
|
228
|
+
project { id name }
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
`, {
|
|
177
233
|
filter: {
|
|
178
234
|
team: { key: { eq: teamKey.toUpperCase() } },
|
|
179
235
|
number: { eq: parseInt(numberStr, 10) },
|
|
180
236
|
},
|
|
181
|
-
first: 1,
|
|
182
237
|
});
|
|
183
|
-
if (issues.nodes.length === 0)
|
|
238
|
+
if (data.issues.nodes.length === 0)
|
|
184
239
|
return null;
|
|
185
|
-
const issue = issues.nodes[0];
|
|
186
|
-
const state = await issue.state;
|
|
187
|
-
const team = await issue.team;
|
|
188
|
-
const assignee = await issue.assignee;
|
|
189
|
-
const labelsConn = await issue.labels();
|
|
190
|
-
const cycle = await issue.cycle;
|
|
191
|
-
const project = await issue.project;
|
|
240
|
+
const issue = data.issues.nodes[0];
|
|
192
241
|
return {
|
|
193
242
|
id: issue.id,
|
|
194
243
|
identifier: issue.identifier,
|
|
195
244
|
title: issue.title,
|
|
196
245
|
description: issue.description ?? undefined,
|
|
197
246
|
priority: issue.priority,
|
|
198
|
-
state: state ? {
|
|
199
|
-
id: state.id,
|
|
200
|
-
name: state.name,
|
|
201
|
-
type: state.type,
|
|
247
|
+
state: issue.state ? {
|
|
248
|
+
id: issue.state.id,
|
|
249
|
+
name: issue.state.name,
|
|
250
|
+
type: issue.state.type,
|
|
202
251
|
} : { id: '', name: 'Unknown', type: 'backlog' },
|
|
203
|
-
team: team ? {
|
|
204
|
-
id: team.id,
|
|
205
|
-
key: team.key,
|
|
206
|
-
name: team.name,
|
|
252
|
+
team: issue.team ? {
|
|
253
|
+
id: issue.team.id,
|
|
254
|
+
key: issue.team.key,
|
|
255
|
+
name: issue.team.name,
|
|
207
256
|
} : { id: '', key: '', name: 'Unknown' },
|
|
208
|
-
assignee: assignee ? {
|
|
209
|
-
id: assignee.id,
|
|
210
|
-
name: assignee.name,
|
|
211
|
-
email: assignee.email,
|
|
257
|
+
assignee: issue.assignee ? {
|
|
258
|
+
id: issue.assignee.id,
|
|
259
|
+
name: issue.assignee.name,
|
|
260
|
+
email: issue.assignee.email,
|
|
212
261
|
} : undefined,
|
|
213
|
-
labels:
|
|
262
|
+
labels: issue.labels.nodes.map((l) => ({
|
|
214
263
|
id: l.id,
|
|
215
264
|
name: l.name,
|
|
216
265
|
color: l.color,
|
|
217
266
|
})),
|
|
218
|
-
cycle: cycle ? {
|
|
219
|
-
id: cycle.id,
|
|
220
|
-
name: cycle.name ?? `Cycle ${cycle.number}`,
|
|
221
|
-
number: cycle.number,
|
|
267
|
+
cycle: issue.cycle ? {
|
|
268
|
+
id: issue.cycle.id,
|
|
269
|
+
name: issue.cycle.name ?? `Cycle ${issue.cycle.number}`,
|
|
270
|
+
number: issue.cycle.number,
|
|
222
271
|
} : undefined,
|
|
223
|
-
project: project ? {
|
|
224
|
-
id: project.id,
|
|
225
|
-
name: project.name,
|
|
272
|
+
project: issue.project ? {
|
|
273
|
+
id: issue.project.id,
|
|
274
|
+
name: issue.project.name,
|
|
226
275
|
} : undefined,
|
|
227
276
|
estimate: issue.estimate ?? undefined,
|
|
228
277
|
dueDate: issue.dueDate ?? undefined,
|
|
229
278
|
url: issue.url,
|
|
230
|
-
createdAt: issue.createdAt
|
|
231
|
-
updatedAt: issue.updatedAt
|
|
279
|
+
createdAt: issue.createdAt,
|
|
280
|
+
updatedAt: issue.updatedAt,
|
|
232
281
|
};
|
|
233
282
|
}
|
|
234
283
|
/**
|
|
235
284
|
* Update the state of an issue.
|
|
236
285
|
*/
|
|
237
286
|
async updateIssueState(issueId, stateId) {
|
|
238
|
-
await this.
|
|
287
|
+
await this.query(`
|
|
288
|
+
mutation UpdateIssueState($issueId: String!, $stateId: String!) {
|
|
289
|
+
issueUpdate(id: $issueId, input: { stateId: $stateId }) {
|
|
290
|
+
success
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
`, { issueId, stateId });
|
|
239
294
|
}
|
|
240
295
|
/**
|
|
241
296
|
* Add a comment to an issue.
|
|
242
297
|
*/
|
|
243
298
|
async addComment(issueId, body) {
|
|
244
|
-
await this.
|
|
299
|
+
await this.query(`
|
|
300
|
+
mutation CreateComment($issueId: String!, $body: String!) {
|
|
301
|
+
commentCreate(input: { issueId: $issueId, body: $body }) {
|
|
302
|
+
success
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
`, { issueId, body });
|
|
245
306
|
}
|
|
246
307
|
/**
|
|
247
308
|
* Attach a URL to an issue (e.g., a PR link).
|
|
248
309
|
*/
|
|
249
310
|
async attachUrl(issueId, url, title) {
|
|
250
|
-
await this.
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
}
|
|
311
|
+
await this.query(`
|
|
312
|
+
mutation CreateAttachment($issueId: String!, $url: String!, $title: String!) {
|
|
313
|
+
attachmentCreate(input: { issueId: $issueId, url: $url, title: $title }) {
|
|
314
|
+
success
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
`, { issueId, url, title });
|
|
255
318
|
}
|
|
256
319
|
}
|
|
257
320
|
//# sourceMappingURL=client.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/lib/linear/client.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/lib/linear/client.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAUH,MAAM,cAAc,GAAG,gCAAgC,CAAA;AAOvD,MAAM,OAAO,YAAY;IACf,MAAM,CAAQ;IAEtB,YAAY,MAAc;QACxB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;IAEO,KAAK,CAAC,KAAK,CAAI,GAAW,EAAE,SAAmC;QACrE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AE,GAAG,EAAE,KAAK,EAAE,CAAC,CAAA;IAC7B,CAAC;CACF"}
|
|
@@ -340,6 +340,83 @@ export function registerUtilityTools(server, ctx) {
|
|
|
340
340
|
return errorResponse(error);
|
|
341
341
|
}
|
|
342
342
|
});
|
|
343
|
+
strictTool(server, 'session_inspect', 'Comprehensive agent status inspection: git status, PR status, process liveness, recent output, and execution metadata in one call', {
|
|
344
|
+
target: z.string().describe('Agent name or ticket ID to inspect'),
|
|
345
|
+
lines: z.number().optional().describe('Number of output lines to include (default 100)'),
|
|
346
|
+
}, async (params) => {
|
|
347
|
+
try {
|
|
348
|
+
const linesFlag = params.lines ? `--lines ${params.lines}` : '';
|
|
349
|
+
const output = ctx.runCommand(`prlt session inspect ${params.target} ${linesFlag} --json`);
|
|
350
|
+
return textResponse(output);
|
|
351
|
+
}
|
|
352
|
+
catch (error) {
|
|
353
|
+
return errorResponse(error);
|
|
354
|
+
}
|
|
355
|
+
});
|
|
356
|
+
strictTool(server, 'session_exec', 'Execute a shell command in an agent\'s worktree/container context. Returns stdout/stderr as structured output.', {
|
|
357
|
+
target: z.string().describe('Agent name or ticket ID'),
|
|
358
|
+
command: z.string().describe('Shell command to execute in the agent\'s context'),
|
|
359
|
+
timeout: z.number().optional().describe('Command timeout in seconds (default 30)'),
|
|
360
|
+
}, async (params) => {
|
|
361
|
+
try {
|
|
362
|
+
const timeoutFlag = params.timeout ? `--timeout ${params.timeout}` : '';
|
|
363
|
+
const output = ctx.runCommand(`prlt session exec ${params.target} ${timeoutFlag} --json -- ${params.command}`);
|
|
364
|
+
return textResponse(output);
|
|
365
|
+
}
|
|
366
|
+
catch (error) {
|
|
367
|
+
return errorResponse(error);
|
|
368
|
+
}
|
|
369
|
+
});
|
|
370
|
+
strictTool(server, 'session_restart', 'Gracefully restart a stuck or completed agent session. Sends Ctrl-C, waits for clean exit, and re-launches Claude Code.', {
|
|
371
|
+
target: z.string().describe('Agent name or ticket ID to restart'),
|
|
372
|
+
fresh: z.boolean().optional().describe('Reset worktree to branch HEAD before restarting'),
|
|
373
|
+
resume: z.boolean().optional().describe('Continue from where the agent left off'),
|
|
374
|
+
timeout: z.number().optional().describe('Seconds to wait for clean exit (default 15)'),
|
|
375
|
+
}, async (params) => {
|
|
376
|
+
try {
|
|
377
|
+
const freshFlag = params.fresh ? '--fresh' : '';
|
|
378
|
+
const resumeFlag = params.resume ? '--resume' : '';
|
|
379
|
+
const timeoutFlag = params.timeout ? `--timeout ${params.timeout}` : '';
|
|
380
|
+
const output = ctx.runCommand(`prlt session restart ${params.target} ${freshFlag} ${resumeFlag} ${timeoutFlag} --json`);
|
|
381
|
+
return textResponse(output);
|
|
382
|
+
}
|
|
383
|
+
catch (error) {
|
|
384
|
+
return errorResponse(error);
|
|
385
|
+
}
|
|
386
|
+
});
|
|
387
|
+
strictTool(server, 'session_peek', 'View agent tmux pane content without attaching. Returns recent terminal output.', {
|
|
388
|
+
target: z.string().describe('Agent name, ticket ID, or execution ID'),
|
|
389
|
+
lines: z.number().optional().describe('Number of scrollback lines to capture (default 200)'),
|
|
390
|
+
full: z.boolean().optional().describe('Capture entire scrollback buffer'),
|
|
391
|
+
}, async (params) => {
|
|
392
|
+
try {
|
|
393
|
+
const linesFlag = params.lines ? `--lines ${params.lines}` : '';
|
|
394
|
+
const fullFlag = params.full ? '--full' : '';
|
|
395
|
+
const output = ctx.runCommand(`prlt session peek ${params.target} ${linesFlag} ${fullFlag} --json`);
|
|
396
|
+
return textResponse(output);
|
|
397
|
+
}
|
|
398
|
+
catch (error) {
|
|
399
|
+
return errorResponse(error);
|
|
400
|
+
}
|
|
401
|
+
});
|
|
402
|
+
strictTool(server, 'session_poke', 'Send a message to a running agent\'s Claude Code session', {
|
|
403
|
+
target: z.string().describe('Agent name or ticket ID'),
|
|
404
|
+
message: z.string().describe('Message to send to the agent'),
|
|
405
|
+
wait: z.boolean().optional().describe('Wait for response after sending'),
|
|
406
|
+
timeout: z.number().optional().describe('Timeout in seconds for wait mode (default 120)'),
|
|
407
|
+
}, async (params) => {
|
|
408
|
+
try {
|
|
409
|
+
const waitFlag = params.wait ? '--wait' : '';
|
|
410
|
+
const timeoutFlag = params.timeout ? `--timeout ${params.timeout}` : '';
|
|
411
|
+
// Escape the message for shell safety
|
|
412
|
+
const escapedMessage = params.message.replace(/"/g, '\\"');
|
|
413
|
+
const output = ctx.runCommand(`prlt session poke ${params.target} "${escapedMessage}" ${waitFlag} ${timeoutFlag} --json`);
|
|
414
|
+
return textResponse(output);
|
|
415
|
+
}
|
|
416
|
+
catch (error) {
|
|
417
|
+
return errorResponse(error);
|
|
418
|
+
}
|
|
419
|
+
});
|
|
343
420
|
strictTool(server, 'config_show', 'Show configuration', {}, async () => {
|
|
344
421
|
try {
|
|
345
422
|
const output = ctx.runCommand('prlt config');
|