@supaku/agentfactory-cli 0.7.12 → 0.7.14
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"governor-dependencies.d.ts","sourceRoot":"","sources":["../../../src/lib/governor-dependencies.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAA;AACpE,OAAO,KAAK,EACV,oBAAoB,EAGrB,MAAM,sBAAsB,CAAA;AAgC7B,MAAM,WAAW,sBAAsB;IACrC,YAAY,EAAE,iBAAiB,CAAA;CAChC;
|
|
1
|
+
{"version":3,"file":"governor-dependencies.d.ts","sourceRoot":"","sources":["../../../src/lib/governor-dependencies.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAA;AACpE,OAAO,KAAK,EACV,oBAAoB,EAGrB,MAAM,sBAAsB,CAAA;AAgC7B,MAAM,WAAW,sBAAsB;IACrC,YAAY,EAAE,iBAAiB,CAAA;CAChC;AA6BD;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,sBAAsB,GAC7B,oBAAoB,CAqQtB"}
|
|
@@ -40,43 +40,6 @@ function actionToWorkType(action) {
|
|
|
40
40
|
return 'development';
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
|
-
// ---------------------------------------------------------------------------
|
|
44
|
-
// Factory
|
|
45
|
-
// ---------------------------------------------------------------------------
|
|
46
|
-
// ---------------------------------------------------------------------------
|
|
47
|
-
// Terminal statuses (issues in these states are excluded from scans)
|
|
48
|
-
// ---------------------------------------------------------------------------
|
|
49
|
-
const TERMINAL_STATUSES = ['Accepted', 'Canceled', 'Duplicate'];
|
|
50
|
-
// ---------------------------------------------------------------------------
|
|
51
|
-
// Helpers
|
|
52
|
-
// ---------------------------------------------------------------------------
|
|
53
|
-
/**
|
|
54
|
-
* Convert a Linear SDK Issue to a GovernorIssue.
|
|
55
|
-
* Resolves lazy-loaded relations (state, labels, parent, project).
|
|
56
|
-
*
|
|
57
|
-
* Uses `unknown` + explicit casts to avoid importing `Issue` from
|
|
58
|
-
* `@linear/sdk`, keeping the CLI package dependency graph clean.
|
|
59
|
-
*/
|
|
60
|
-
async function sdkIssueToGovernorIssue(issue) {
|
|
61
|
-
// The Linear SDK Issue type uses LinearFetch (thenable) for lazy-loaded relations.
|
|
62
|
-
// We cast to `any` to access these properties without importing the SDK types.
|
|
63
|
-
const i = issue;
|
|
64
|
-
const state = await i.state;
|
|
65
|
-
const labels = await i.labels();
|
|
66
|
-
const parent = await i.parent;
|
|
67
|
-
const project = await i.project;
|
|
68
|
-
return {
|
|
69
|
-
id: i.id,
|
|
70
|
-
identifier: i.identifier,
|
|
71
|
-
title: i.title,
|
|
72
|
-
description: i.description ?? undefined,
|
|
73
|
-
status: state?.name ?? 'Backlog',
|
|
74
|
-
labels: labels.nodes.map((l) => l.name),
|
|
75
|
-
createdAt: i.createdAt.getTime(),
|
|
76
|
-
parentId: parent?.id,
|
|
77
|
-
project: project?.name,
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
43
|
/**
|
|
81
44
|
* Create real GovernorDependencies backed by the Linear SDK and Redis.
|
|
82
45
|
*
|
|
@@ -85,24 +48,34 @@ async function sdkIssueToGovernorIssue(issue) {
|
|
|
85
48
|
*/
|
|
86
49
|
export function createRealDependencies(config) {
|
|
87
50
|
const processingState = new RedisProcessingStateStorage();
|
|
51
|
+
// Cache of parent issue IDs populated by listIssues() single GraphQL query.
|
|
52
|
+
// Eliminates per-issue isParentIssue() API calls during governor scans.
|
|
53
|
+
const parentIssueIds = new Set();
|
|
88
54
|
return {
|
|
89
55
|
// -----------------------------------------------------------------------
|
|
90
|
-
// 1. listIssues -- scan Linear project
|
|
56
|
+
// 1. listIssues -- scan Linear project using single GraphQL query
|
|
91
57
|
// -----------------------------------------------------------------------
|
|
92
58
|
listIssues: async (project) => {
|
|
93
59
|
try {
|
|
94
|
-
const
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
const results = [];
|
|
102
|
-
for (const issue of issueConnection.nodes) {
|
|
103
|
-
results.push(await sdkIssueToGovernorIssue(issue));
|
|
60
|
+
const rawIssues = await config.linearClient.listProjectIssues(project);
|
|
61
|
+
// Cache parent issue IDs for isParentIssue() lookups
|
|
62
|
+
parentIssueIds.clear();
|
|
63
|
+
for (const issue of rawIssues) {
|
|
64
|
+
if (issue.childCount > 0) {
|
|
65
|
+
parentIssueIds.add(issue.id);
|
|
66
|
+
}
|
|
104
67
|
}
|
|
105
|
-
return
|
|
68
|
+
return rawIssues.map((issue) => ({
|
|
69
|
+
id: issue.id,
|
|
70
|
+
identifier: issue.identifier,
|
|
71
|
+
title: issue.title,
|
|
72
|
+
description: issue.description,
|
|
73
|
+
status: issue.status,
|
|
74
|
+
labels: issue.labels,
|
|
75
|
+
createdAt: issue.createdAt,
|
|
76
|
+
parentId: issue.parentId,
|
|
77
|
+
project: issue.project,
|
|
78
|
+
}));
|
|
106
79
|
}
|
|
107
80
|
catch (err) {
|
|
108
81
|
log.error('listIssues failed', {
|
|
@@ -147,9 +120,13 @@ export function createRealDependencies(config) {
|
|
|
147
120
|
}
|
|
148
121
|
},
|
|
149
122
|
// -----------------------------------------------------------------------
|
|
150
|
-
// 4. isParentIssue -- check
|
|
123
|
+
// 4. isParentIssue -- check cache first, fall back to API
|
|
151
124
|
// -----------------------------------------------------------------------
|
|
152
125
|
isParentIssue: async (issueId) => {
|
|
126
|
+
// Check cached parent IDs from listIssues (populated by single GraphQL query)
|
|
127
|
+
if (parentIssueIds.has(issueId))
|
|
128
|
+
return true;
|
|
129
|
+
// Fall back to API for issues not in the last scan (e.g., webhook-driven)
|
|
153
130
|
try {
|
|
154
131
|
return await config.linearClient.isParentIssue(issueId);
|
|
155
132
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@supaku/agentfactory-cli",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.14",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "CLI tools for AgentFactory — local orchestrator, remote worker, queue admin",
|
|
6
6
|
"author": "Supaku (https://supaku.com)",
|
|
@@ -89,9 +89,9 @@
|
|
|
89
89
|
],
|
|
90
90
|
"dependencies": {
|
|
91
91
|
"dotenv": "^17.2.3",
|
|
92
|
-
"@supaku/agentfactory
|
|
93
|
-
"@supaku/agentfactory": "0.7.
|
|
94
|
-
"@supaku/agentfactory-linear": "0.7.
|
|
92
|
+
"@supaku/agentfactory": "0.7.14",
|
|
93
|
+
"@supaku/agentfactory-server": "0.7.14",
|
|
94
|
+
"@supaku/agentfactory-linear": "0.7.14"
|
|
95
95
|
},
|
|
96
96
|
"devDependencies": {
|
|
97
97
|
"@types/node": "^22.5.4",
|