Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lua/opencode/cli/process/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ local M = {}
---Retrieval is platform-dependent.
---@class opencode.cli.process.Process
---@field pid number
---@field port number
---@field port number?
Copy link

Copilot AI Mar 7, 2026

Choose a reason for hiding this comment

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

For class fields, this repo commonly marks optional fields with ---@field name? type (e.g. opencode.cli.server.Opts.port? number in cli/server.lua). To keep annotations consistent, consider changing this to ---@field port? number.

Suggested change
---@field port number?
---@field port? number

Copilot uses AI. Check for mistakes.

---@return opencode.cli.process.Process[]
function M.get()
Expand Down
5 changes: 4 additions & 1 deletion lua/opencode/cli/server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,13 @@ local M = {}

---Verify that an `opencode` process is responding on the given port,
---and fetch some details about it.
Copy link

Copilot AI Mar 7, 2026

Choose a reason for hiding this comment

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

The function-level doc comment still reads like a port is always provided. Since port is now optional and the promise is rejected when it’s missing, it would be clearer to document that behavior (and why) in the comment above get_server.

Suggested change
---and fetch some details about it.
---and fetch some details about it.
---If `port` is `nil`, the returned promise is rejected immediately with a message
---indicating that this process is not listening on any port; this function does
---not perform any port discovery, and callers must supply a known listening port.

Copilot uses AI. Check for mistakes.
---@param port number
---@param port number?
---@return Promise<opencode.cli.server.Server>
local function get_server(port)
local Promise = require("opencode.promise")
if not port then
return Promise.reject("This process is not listening on any port.")
end
return Promise
.new(function(resolve, reject)
require("opencode.cli.client").get_path(port, function(path)
Expand Down