linear-github-cli 1.1.5 → 1.2.1
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/create-parent.js +13 -3
- package/dist/commands/create-sub.js +22 -4
- package/dist/input-handler.js +19 -4
- package/dist/linear-client.js +20 -0
- package/package.json +1 -1
|
@@ -68,9 +68,19 @@ async function createParentIssue() {
|
|
|
68
68
|
await githubClient.setProjectDateFields(repo, githubProject, issue.id, details.dueDate || undefined, details.startDate || undefined);
|
|
69
69
|
}
|
|
70
70
|
// Step 5: Wait for Linear sync, then update metadata
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
const
|
|
71
|
+
const linearSyncDelayMs = 500;
|
|
72
|
+
const linearSyncMaxWaitMs = 10000;
|
|
73
|
+
const linearSyncMaxAttempts = Math.floor(linearSyncMaxWaitMs / linearSyncDelayMs) + 1;
|
|
74
|
+
console.log('\n⏳ Waiting for Linear sync (polling for up to 10s)...');
|
|
75
|
+
const linearIssueId = await linearClient.waitForIssueByGitHubUrl(issue.url, {
|
|
76
|
+
maxAttempts: linearSyncMaxAttempts,
|
|
77
|
+
delayMs: linearSyncDelayMs,
|
|
78
|
+
onRetry: (attempt, maxAttempts, delayMs) => {
|
|
79
|
+
if (attempt % 5 === 0) {
|
|
80
|
+
console.log(` ⏳ Linear issue not found yet, retrying in ${delayMs}ms... (${attempt}/${maxAttempts - 1})`);
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
});
|
|
74
84
|
if (linearIssueId) {
|
|
75
85
|
console.log('✅ Found Linear issue, updating metadata...');
|
|
76
86
|
// Auto-find Linear project if GitHub project was selected
|
|
@@ -65,15 +65,33 @@ async function createSubIssue() {
|
|
|
65
65
|
console.log(`✅ Sub-Issue #${subIssue.number} created: ${subIssue.url}`);
|
|
66
66
|
console.log(` Parent: #${parentIssueNumber}`);
|
|
67
67
|
// Step 5: Wait for Linear sync, then update metadata
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
const
|
|
68
|
+
const linearSyncDelayMs = 500;
|
|
69
|
+
const linearSyncMaxWaitMs = 10000;
|
|
70
|
+
const linearSyncMaxAttempts = Math.floor(linearSyncMaxWaitMs / linearSyncDelayMs) + 1;
|
|
71
|
+
console.log('\n⏳ Waiting for Linear sync (polling for up to 10s)...');
|
|
72
|
+
const linearIssueId = await linearClient.waitForIssueByGitHubUrl(subIssue.url, {
|
|
73
|
+
maxAttempts: linearSyncMaxAttempts,
|
|
74
|
+
delayMs: linearSyncDelayMs,
|
|
75
|
+
onRetry: (attempt, maxAttempts, delayMs) => {
|
|
76
|
+
if (attempt % 5 === 0) {
|
|
77
|
+
console.log(` ⏳ Linear issue not found yet, retrying in ${delayMs}ms... (${attempt}/${maxAttempts - 1})`);
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
});
|
|
71
81
|
if (linearIssueId) {
|
|
72
82
|
console.log('✅ Found Linear issue, updating metadata...');
|
|
73
83
|
// Get parent issue to check if it has a project
|
|
74
84
|
const parentIssueUrl = `https://github.com/${repo}/issues/${parentIssueNumber}`;
|
|
75
85
|
console.log(` Looking for parent issue's Linear project...`);
|
|
76
|
-
const parentLinearIssueId = await linearClient.
|
|
86
|
+
const parentLinearIssueId = await linearClient.waitForIssueByGitHubUrl(parentIssueUrl, {
|
|
87
|
+
maxAttempts: 6,
|
|
88
|
+
delayMs: 500,
|
|
89
|
+
onRetry: (attempt, maxAttempts, delayMs) => {
|
|
90
|
+
if (attempt % 3 === 0) {
|
|
91
|
+
console.log(` ⏳ Parent Linear issue not found yet, retrying in ${delayMs}ms... (${attempt}/${maxAttempts - 1})`);
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
});
|
|
77
95
|
let linearProjectId = null;
|
|
78
96
|
let parentProjectName = null;
|
|
79
97
|
if (parentLinearIssueId) {
|
package/dist/input-handler.js
CHANGED
|
@@ -154,9 +154,13 @@ class InputHandler {
|
|
|
154
154
|
validate: (input) => input.length > 0 || 'Title is required',
|
|
155
155
|
},
|
|
156
156
|
{
|
|
157
|
-
type: '
|
|
158
|
-
name: '
|
|
159
|
-
message: '
|
|
157
|
+
type: 'input',
|
|
158
|
+
name: 'descriptionAction',
|
|
159
|
+
message: 'Body [(e) to launch vim, enter to skip]:',
|
|
160
|
+
validate: (input) => {
|
|
161
|
+
const value = input.trim().toLowerCase();
|
|
162
|
+
return value === '' || value === 'e' || 'Enter "e" to edit or press enter to skip';
|
|
163
|
+
},
|
|
160
164
|
},
|
|
161
165
|
{
|
|
162
166
|
type: 'input',
|
|
@@ -190,9 +194,20 @@ class InputHandler {
|
|
|
190
194
|
},
|
|
191
195
|
},
|
|
192
196
|
]);
|
|
197
|
+
let description = '';
|
|
198
|
+
if (answers.descriptionAction.trim().toLowerCase() === 'e') {
|
|
199
|
+
const { description: editedDescription } = await inquirer_1.default.prompt([
|
|
200
|
+
{
|
|
201
|
+
type: 'editor',
|
|
202
|
+
name: 'description',
|
|
203
|
+
message: 'Issue description:',
|
|
204
|
+
},
|
|
205
|
+
]);
|
|
206
|
+
description = editedDescription || '';
|
|
207
|
+
}
|
|
193
208
|
return {
|
|
194
209
|
title: answers.title,
|
|
195
|
-
description
|
|
210
|
+
description,
|
|
196
211
|
dueDate: answers.dueDate || '',
|
|
197
212
|
startDate: answers.startDate || '',
|
|
198
213
|
labels: answers.labels || [],
|
package/dist/linear-client.js
CHANGED
|
@@ -184,6 +184,26 @@ class LinearClientWrapper {
|
|
|
184
184
|
});
|
|
185
185
|
return issues.nodes[0]?.id || null;
|
|
186
186
|
}
|
|
187
|
+
async waitForIssueByGitHubUrl(githubUrl, options = {}) {
|
|
188
|
+
const delayMs = options.delayMs ?? 5000;
|
|
189
|
+
const maxAttempts = options.maxAttempts;
|
|
190
|
+
for (let attempt = 1;; attempt++) {
|
|
191
|
+
const issueId = await this.findIssueByGitHubUrl(githubUrl);
|
|
192
|
+
if (issueId) {
|
|
193
|
+
return issueId;
|
|
194
|
+
}
|
|
195
|
+
if (maxAttempts !== undefined && attempt >= maxAttempts) {
|
|
196
|
+
return null;
|
|
197
|
+
}
|
|
198
|
+
options.onRetry?.(attempt, maxAttempts ?? Number.POSITIVE_INFINITY, delayMs);
|
|
199
|
+
if (delayMs > 0) {
|
|
200
|
+
await new Promise(resolve => setTimeout(resolve, delayMs));
|
|
201
|
+
}
|
|
202
|
+
else {
|
|
203
|
+
await new Promise(resolve => setTimeout(resolve, 0));
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
187
207
|
async getIssueIdentifier(issueId) {
|
|
188
208
|
try {
|
|
189
209
|
const issue = await this.client.issue(issueId);
|