Skip to content

Conversation

@Hona
Copy link
Collaborator

@Hona Hona commented Dec 19, 2025

I wasn't happy that we couldn't reuse the test script so I refactored a bit

image

the opencode server seemed to hold the process open and I had to ctrl+c to exit. the change fixes that too.

Copilot AI review requested due to automatic review settings December 19, 2025 01:38
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the changelog generation logic to enable it to run independently as a standalone script, while also fixing an issue where the opencode server process held scripts open after completion.

Key changes:

  • Extracted changelog generation logic from publish.ts into a new reusable script/changelog.ts module with a standalone CLI runner
  • Made server.close() and TUI close() methods return promises that properly await process termination
  • Updated documentation to reflect the new async close() API

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
script/changelog.ts New module that extracts all changelog generation logic with a standalone runner that accepts previous/current git refs as CLI arguments
script/publish.ts Simplified to delegate changelog generation to the new module, removing ~150 lines of inline logic
packages/sdk/js/src/server.ts Changed close() methods to return promises that resolve when the process exits, fixing the hanging process issue
packages/web/src/content/docs/sdk.mdx Updated documentation example to await the now-async close() method
Comments suppressed due to low confidence (2)

packages/sdk/js/src/server.ts:92

  • The close method could hang indefinitely if the process fails to exit after kill() is called. Consider adding a timeout to forcefully resolve the promise or use SIGKILL as a fallback after a grace period.
    close() {
      proc.kill("SIGKILL")
    },
  }
}

export function createOpencodeTui(options?: TuiOptions) {
  const args = []

packages/sdk/js/src/server.ts:131

  • The close method could hang indefinitely if the process fails to exit after kill() is called. Consider adding a timeout to forcefully resolve the promise or use SIGKILL as a fallback after a grace period.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

const compare =
await $`gh api "/repos/sst/opencode/compare/${previous}...${current}" --jq '.commits[] | {sha: .sha, login: .author.login, message: .commit.message}'`
.text()
.catch(() => "")
Copy link

Copilot AI Dec 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Silently catching and ignoring GitHub API errors could lead to generating an incomplete changelog with missing author information. Consider logging the error or handling the failure more explicitly, especially since this affects the quality of the generated changelog.

Suggested change
.catch(() => "")
.catch((error) => {
console.error(
`Failed to fetch commit authors from GitHub API for changelog generation between ${previous} and ${current}:`,
error,
)
return ""
})

Copilot uses AI. Check for mistakes.
@rekram1-node rekram1-node merged commit 0f3577e into anomalyco:dev Dec 19, 2025
3 checks passed
rekram1-node added a commit that referenced this pull request Dec 19, 2025
rekram1-node added a commit that referenced this pull request Dec 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants