Skip to content

Conversation

@thoom
Copy link
Owner

@thoom thoom commented May 31, 2025

Adding several big features:

  1. Basic Auth support (Fixes Support for Basic Auth #48)
  2. Form Data (Fixes Add support for form data. #28)
  3. Multipart Form (new!)
  4. Go templating in payloads. (Fixes Allow payload to be dynamically generated using Go templates #33)

thoom added 7 commits May 30, 2025 19:38
…actions/create-release@v1 with softprops/action-gh-release@v2 - Replace multiple actions/upload-release-asset@v1 steps with single release action - Eliminates set-output deprecation warnings - Simplifies workflow while maintaining same functionality
@thoom thoom requested a review from Copilot May 31, 2025 03:48
Copy link

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 introduces several new features for version 1.0-beta including Go template processing for payloads, enhanced form data handling (supporting both URL-encoded and multipart forms), and Basic Auth support. Key changes include:

  • Adding functions for parsing and processing Go templates.
  • Implementing form data processing with support for file uploads via multipart encoding.
  • Enhancing client configuration and request creation to support both client certificate and Basic Auth.

Reviewed Changes

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

Show a summary per file
File Description
template/template.go Introduces Go templating functions and CLI variable parsing for payload processing.
output/output_test.go & output.go Adds tests and new functionality for printing version and update information.
form/form.go Implements form data parsing and conversion to both URL-encoded and multipart formats.
examples/* Provides sample templates and payloads demonstrating the new templating and form data formats.
config/config.go & config_test.go Updates configuration structures and error handling to include basic auth and field trimming.
client/* Modifies client request creation, TLS configuration, and adds Basic Auth handling.
.github/workflows/main.yml Upgrades GitHub Actions versions for creating releases and uploading assets.

@thoom thoom requested a review from Copilot May 31, 2025 04:17
Copy link

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

Adds support for Basic Auth, form data handling (URL‐encoded and multipart), Go templating in payloads, and version update notifications.

  • Implements ParseTemplateVars and ProcessTemplate for Go‐templating files and stdin
  • Adds FormData parsing/encoding in form/form.go and ProcessFormData
  • Extends config and client to include Basic Auth, updates CreateRequest/BuildClientAuth for credentials
  • Introduces PrintVersionWithUpdates and update‐check logic in client/updates.go

Reviewed Changes

Copilot reviewed 21 out of 21 changed files in this pull request and generated no comments.

Show a summary per file
File Description
template/template.go New functions for parsing CLI vars and processing Go templates
form/form.go Parsing and encoding of form fields and file uploads
output/output.go Adds PrintVersionWithUpdates
output/output_test.go Updates version tests to cover new behavior
config/config.go Adds Username/Password fields, UseBasicAuth, and cleanup
config/config_test.go Tests for Basic Auth loading and trimming whitespace
client/client.go Updates CreateRequest, TLS setup, and BuildClientAuth
client/client_test.go Updates tests for new BuildClientAuth signature and Basic Auth
client/updates.go New GitHub update‐check implementation
.github/workflows/main.yml Bumps GitHub Actions versions for release creation/upload
Comments suppressed due to low confidence (5)

form/form.go:21

  • Consider adding unit tests for ParseFormData, ToURLEncoded, ToMultipart, and ProcessFormData to ensure correct parsing and encoding of both fields and file uploads.
func ParseFormData(data []byte) (*FormData, error) {

template/template.go:17

  • Add tests for ParseTemplateVars and ProcessTemplate to verify variable parsing and correct template rendering, including edge cases (e.g., missing = or undefined vars).
func ParseTemplateVars(vars []string) map[string]string {

client/updates.go:43

  • [nitpick] The local variable url shadows the common url package and is generic; consider renaming to apiURL or endpoint to improve clarity.
url := "https://api.github.com/repos/thoom/gulp/releases/latest"

client/client.go:195

  • [nitpick] The BuildClientAuth signature has many positional parameters which can be confusing. Consider refactoring to use a struct or functional options for clearer caller intent.
func BuildClientAuth(clientCert, clientCertKey, clientCA, basicAuthUser, basicAuthPass string, clientCertConfig config.ClientAuth) config.ClientAuth {

config/config.go:144

  • The example YAML shows two separate client_auth sections (one for certs and one for Basic Auth), which is invalid YAML. Combine all authentication fields under a single client_auth block to avoid confusion.
client_auth:

@thoom thoom requested a review from Copilot May 31, 2025 04:36

This comment was marked as outdated.

@sonarqubecloud
Copy link

@thoom thoom requested a review from Copilot June 29, 2025 04:40
@thoom thoom marked this pull request as draft June 29, 2025 04:41
Copy link

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 implements the 1.0-beta release, adding support for HTTP Basic Auth, form and multipart form data, and Go templating in payloads across the CLI and UI.

  • Add Basic Auth configuration and parsing
  • Support form data and multipart form requests
  • Integrate Go templating in request payloads

Reviewed Changes

Copilot reviewed 56 out of 59 changed files in this pull request and generated no comments.

Show a summary per file
File Description
ui/server.go New HTTP server endpoints for templates and execution
ui/server_test.go Tests covering server routes and output parsing
ui/frontend/**/* New React-based UI (TS, components, styles, API client)
template/template.go & .yaml tests Go templating engine for payload files and stdin
output/output.go & tests Enhanced colored block output with terminal width logic
sonar-project.properties Updated SonarQube inclusions/exclusions
scripts/build.sh, deploy.sh Removed legacy build/deploy scripts
Comments suppressed due to low confidence (4)

ui/server.go:269

  • The single-template endpoint currently expects a ?path= query parameter, but the front-end uses a path parameter (e.g., /api/template/<path>). Consider parsing r.URL.Path in the handler or changing the client to include ?path= so both sides match.
	http.HandleFunc("/api/template/", s.handleTemplate)

output/output.go:62

  • [nitpick] There's a placeholder comment (// do something) left in PrintBlock. Remove or replace it with a meaningful note to keep the code clean.
	for _, v := range pieces {

sonar-project.properties:6

  • [nitpick] The inclusion/exclusion patterns overlap heavily and may inadvertently include non-Go files in analysis. Simplify the rules to clearly include only .go files and exclude frontend assets in one place.
# Only analyze Go files

@thoom
Copy link
Owner Author

thoom commented Oct 21, 2025

@gemini-code-assist review

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This is a massive and impressive update that modernizes the tool significantly. The introduction of a proper CLI framework with cobra, a structured Makefile, and powerful features like templating, form data handling, and a web UI are excellent additions. The code has been substantially refactored for better modularity and readability, especially in the client and config packages. The documentation is also greatly improved with detailed guides and examples. I've found a couple of critical issues in the new Makefile and the ui server backend that would prevent parts of the new functionality from working, but they should be straightforward to fix. Overall, this is a fantastic leap forward for the project.

build: frontend
@echo "Building $(BINARY_NAME)..."
@mkdir -p $(BUILD_DIR)
CGO_ENABLED=0 go build -ldflags="$(LDFLAGS)" -o $(BUILD_DIR)/$(BINARY_NAME) $(MAIN_PATH)

Choose a reason for hiding this comment

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

critical

The build target uses a variable $(MAIN_PATH) which is not defined in this Makefile. This will cause the make build command to fail. Based on the other build targets, it seems you intend to build the main package in the current directory. You can simply remove this undefined variable.

CGO_ENABLED=0 go build -ldflags="$(LDFLAGS)" -o $(BUILD_DIR)/$(BINARY_NAME)

Comment on lines +339 to 344
// Load configuration
loadedConfig, err := config.LoadConfiguration(configFile)
if err != nil {
return err
}
gulpConfig = loadedConfig

Choose a reason for hiding this comment

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

critical

The arguments being passed to the gulp binary from the UI server are incorrect according to the new CLI structure defined in main.go using cobra. Specifically:

  1. The -p flag for the template path is not defined. You should use --template.
  2. The -u flag for the URL is not defined. You should use --url.
  3. The --json-output flag is not defined. To get the structured JSON for the UI, you should use --output ui.

I've provided a suggestion to fix the argument construction.

Suggested change
// Load configuration
loadedConfig, err := config.LoadConfiguration(configFile)
if err != nil {
return err
}
gulpConfig = loadedConfig
args := []string{
"--template", templateFullPath,
"--url", req.URL,
"--method", req.Method,
"--output", "ui",
}

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.

Support for Basic Auth Allow payload to be dynamically generated using Go templates Add support for form data.

2 participants