linear-github-cli 1.1.2 → 1.1.5

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.
@@ -53,13 +53,10 @@ async function createParentIssue() {
53
53
  const githubProject = await inputHandler.selectProject(repo);
54
54
  // Step 4: Create GitHub issue
55
55
  console.log('\n🚀 Creating GitHub issue...');
56
- const body = details.dueDate
57
- ? `Due Date: ${details.dueDate}\n\n${details.description}`
58
- : details.description;
59
56
  const issue = await githubClient.createIssue({
60
57
  repo,
61
58
  title: details.title,
62
- body,
59
+ body: details.description,
63
60
  labels: details.labels,
64
61
  assignees: ['@me'],
65
62
  project: githubProject || undefined,
@@ -54,31 +54,16 @@ async function createSubIssue() {
54
54
  const details = await inputHandler.promptIssueDetails(repo);
55
55
  // Step 4: Create sub-issue
56
56
  console.log('\n🚀 Creating sub-issue...');
57
- const body = details.dueDate
58
- ? `Due Date: ${details.dueDate}\n\n${details.description}`
59
- : details.description;
60
57
  const subIssue = await githubClient.createSubIssue({
61
58
  repo,
62
59
  parentIssueNumber,
63
60
  title: details.title,
64
- body,
61
+ body: details.description,
65
62
  labels: details.labels,
66
63
  assignees: ['@me'],
67
64
  });
68
65
  console.log(`✅ Sub-Issue #${subIssue.number} created: ${subIssue.url}`);
69
66
  console.log(` Parent: #${parentIssueNumber}`);
70
- // Set GitHub Project date fields if dates are provided
71
- if (details.dueDate || details.startDate) {
72
- console.log('\n📅 Setting GitHub Project date fields...');
73
- // sub-issueから直接プロジェクト情報を取得(Auto-add sub-issues to projectが有効な場合)
74
- const projectName = await githubClient.getIssueProject(repo, subIssue.id);
75
- if (projectName) {
76
- await githubClient.setProjectDateFields(repo, projectName, subIssue.id, details.dueDate || undefined, details.startDate || undefined);
77
- }
78
- else {
79
- console.log(' ⚠️ Sub-issue has no GitHub Project. Skipping date field setting.');
80
- }
81
- }
82
67
  // Step 5: Wait for Linear sync, then update metadata
83
68
  console.log('\n⏳ Waiting for Linear sync (5 seconds)...');
84
69
  await new Promise(resolve => setTimeout(resolve, 5000));
@@ -138,6 +123,14 @@ async function createSubIssue() {
138
123
  console.log(` Due date: ${details.dueDate}`);
139
124
  }
140
125
  console.log(' Status: Will be updated automatically via PR integration');
126
+ // Set GitHub Project date fields if parent project is available and dates are provided
127
+ if (parentProjectName && (details.dueDate || details.startDate)) {
128
+ console.log('\n📅 Setting GitHub Project date fields...');
129
+ // Wait additional time for GitHub Actions to sync project assignment
130
+ console.log(' ⏳ Waiting for GitHub Actions sync (3 seconds)...');
131
+ await new Promise(resolve => setTimeout(resolve, 3000));
132
+ await githubClient.setProjectDateFields(repo, parentProjectName, subIssue.id, details.dueDate || undefined, details.startDate || undefined);
133
+ }
141
134
  }
142
135
  else {
143
136
  console.log('⚠️ Failed to update Linear issue metadata. You can update it manually in Linear.');
@@ -46,7 +46,16 @@ class GitHubClientWrapper {
46
46
  (params.labels && params.labels.length > 0 ? `--label "${params.labels.join(',')}" ` : '') +
47
47
  (params.assignees && params.assignees.length > 0 ? `--assignee "${params.assignees.join(',')}" ` : '') +
48
48
  (params.project ? `--project "${params.project}" ` : '');
49
- const output = (0, child_process_1.execSync)(command, { encoding: 'utf-8' });
49
+ let output;
50
+ try {
51
+ output = (0, child_process_1.execSync)(command, { encoding: 'utf-8' });
52
+ }
53
+ catch (error) {
54
+ const errorMessage = error?.stderr?.toString().trim() || error?.message || String(error);
55
+ throw new Error(`Failed to create GitHub issue.\n` +
56
+ `Reason: ${errorMessage}\n` +
57
+ `Please review the issue body and try again.`);
58
+ }
50
59
  // Parse URL from output: "https://github.com/owner/repo/issues/123"
51
60
  const urlMatch = output.match(/https:\/\/github\.com\/[^\/]+\/[^\/]+\/issues\/(\d+)/);
52
61
  if (!urlMatch) {
@@ -534,14 +543,14 @@ class GitHubClientWrapper {
534
543
  }
535
544
  }
536
545
  /**
537
- * Get GitHub Project name from issue ID
546
+ * Get GitHub Project name from issue number
538
547
  */
539
- async getIssueProject(repo, issueId) {
548
+ async getIssueProject(repo, issueNumber) {
540
549
  try {
541
550
  const [owner, name] = repo.split('/');
542
551
  const query = `query {
543
552
  repository(owner: "${owner}", name: "${name}") {
544
- issue(id: "${issueId}") {
553
+ issue(number: ${issueNumber}) {
545
554
  projectItems(first: 10) {
546
555
  nodes {
547
556
  project {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "linear-github-cli",
3
- "version": "1.1.2",
3
+ "version": "1.1.5",
4
4
  "description": "CLI tool for creating GitHub issues with Linear integration",
5
5
  "main": "dist/cli.js",
6
6
  "bin": {