Skip to content
Open
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
38 changes: 25 additions & 13 deletions cmd/dev.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,24 +126,35 @@ Examples:
log.Fatal("failed to find available port: %s", err)
}

connectProxyPort, _ := cmd.Flags().GetInt("proxy-port")
if connectProxyPort < 0 || connectProxyPort > 65535 {
log.Fatal("invalid --proxy-port: %d (must be 0-65535)", connectProxyPort)
}
var connectProxyPortPtr *uint
if connectProxyPort > 0 {
port := uint(connectProxyPort)
connectProxyPortPtr = &port
}

server, err := dev.New(dev.ServerArgs{
APIURL: apiUrl,
APIKey: apiKey,
Hostname: endpoint.Hostname,
Config: &gravity.Config{
Context: ctx,
Logger: log,
Version: Version,
OrgID: orgId,
Project: theproject,
EndpointID: endpoint.ID,
URL: gravityUrl,
SDKKey: project.Secrets["AGENTUITY_SDK_KEY"],
ProxyPort: uint(proxyPort),
AgentPort: uint(agentPort),
Ephemeral: true,
ClientName: "cli/devmode",
DynamicHostname: true,
Context: ctx,
Logger: log,
Version: Version,
OrgID: orgId,
Project: theproject,
EndpointID: endpoint.ID,
URL: gravityUrl,
SDKKey: project.Secrets["AGENTUITY_SDK_KEY"],
ProxyPort: uint(proxyPort),
AgentPort: uint(agentPort),
ConnectProxyPort: connectProxyPortPtr,
Ephemeral: true,
ClientName: "cli/devmode",
DynamicHostname: true,
},
})
if err != nil {
Expand Down Expand Up @@ -308,6 +319,7 @@ func init() {
rootCmd.AddCommand(devCmd)
devCmd.Flags().StringP("dir", "d", ".", "The directory to run the development server in")
devCmd.Flags().Int("port", 0, "The port to run the development server on (uses project default if not provided)")
devCmd.Flags().Int("proxy-port", 19081, "The port to run the HTTP CONNECT proxy server on (disabled if zero)")
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Default should be disabled to match PR description and avoid unexpected proxy start

The flag help says “disabled if zero,” but default 19081 enables it by default. Consider defaulting to 0.

Apply this diff:

-	devCmd.Flags().Int("proxy-port", 19081, "The port to run the HTTP CONNECT proxy server on (disabled if zero)")
+	devCmd.Flags().Int("proxy-port", 0, "The port to run the HTTP CONNECT proxy server on (disabled if zero)")
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
devCmd.Flags().Int("proxy-port", 19081, "The port to run the HTTP CONNECT proxy server on (disabled if zero)")
devCmd.Flags().Int("proxy-port", 0, "The port to run the HTTP CONNECT proxy server on (disabled if zero)")
🤖 Prompt for AI Agents
In cmd/dev.go around line 320, the proxy-port flag currently defaults to 19081
which contradicts the help text saying "disabled if zero"; change the flag's
default value from 19081 to 0 so the proxy is disabled by default, leaving the
flag name, type, and help string unchanged.

devCmd.Flags().Bool("no-build", false, "Do not build the project before running it (useful for debugging)")
devCmd.Flags().MarkHidden("no-build")
}
Loading
Loading