Skip to content
Merged
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
5 changes: 3 additions & 2 deletions cmd/hx/fixtures/hx.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
build: go build -o hx .
exec: hx --har "{{ .name | strings.Slug }}.har"
build: echo $GIT_ROOT_DIR==$CWD && pwd && cd $GIT_ROOT_DIR && pwd && go build -o hx .
cwd: cmd/hx
exec: $GIT_ROOT_DIR/hx --har "{{ .name | strings.Slug }}.har"
Comment on lines +2 to +4
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify where the CLI main package lives and whether root package is main.
# Expected: main package under cmd/hx; if root is not main, current build command is incorrect.

echo "== package declarations (root and cmd/hx) =="
rg -n '^\s*package\s+main\b|^\s*package\s+' *.go cmd/hx/*.go cmd/hx/**/*.go

echo
echo "== current fixture build/exec lines =="
rg -n '^(build|cwd|exec):' cmd/hx/fixtures/hx.md

Repository: flanksource/commons

Length of output: 686


🏁 Script executed:

#!/bin/bash
# Check if root has any Go files
echo "== Go files at repo root =="
ls -la *.go 2>/dev/null || echo "(No Go files at root)"

echo
echo "== Directory structure around cmd/hx =="
tree -L 2 -I 'node_modules|.git|vendor' cmd/hx/ 2>/dev/null || find cmd/hx -maxdepth 2 -type f -name '*.go' | head -20

Repository: flanksource/commons

Length of output: 417


Build target is incorrect and will fail to produce the CLI binary.

After cd $GIT_ROOT_DIR, the command go build -o hx . attempts to build the root directory, which contains no Go files. The CLI entrypoint is in cmd/hx/ (main.go and root.go are both package main). This build command must target the correct package.

Fix
-build: echo $GIT_ROOT_DIR==$CWD && pwd &&  cd $GIT_ROOT_DIR && pwd && go build -o hx .
+build: cd "$GIT_ROOT_DIR" && go build -o hx ./cmd/hx
 cwd: cmd/hx
 exec: $GIT_ROOT_DIR/hx --har "{{ .name | strings.Slug  }}.har"
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@cmd/hx/fixtures/hx.md` around lines 2 - 4, The build step in the fixture uses
`cd $GIT_ROOT_DIR` then runs `go build -o hx .`, which targets the repository
root (no Go files) and fails; update the build command so it builds the CLI
package instead (either change the build target to the package path for the CLI,
e.g. ./cmd/hx, or `cd` into cmd/hx before running `go build -o hx .`) — modify
the line containing `go build -o hx .` (refer to the build/exec block that
references GIT_ROOT_DIR and CWD) to point to the correct package.

---

# hx CLI Fixture Tests
Expand Down
9 changes: 5 additions & 4 deletions cmd/hx/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.25.1

require (
github.com/aws/aws-sdk-go-v2/config v1.32.9
github.com/flanksource/clicky v1.19.0
github.com/flanksource/clicky v1.21.1
github.com/flanksource/commons v1.47.2
github.com/spf13/cobra v1.10.2
github.com/stretchr/testify v1.11.1
Expand All @@ -15,6 +15,7 @@ require (
cel.dev/expr v0.25.1 // indirect
github.com/Masterminds/goutils v1.1.1 // indirect
github.com/Masterminds/semver/v3 v3.4.0 // indirect
github.com/Snawoot/go-http-digest-auth-client v1.1.3 // indirect
github.com/ajstarks/svgo v0.0.0-20211024235047-1546f124cd8b // indirect
github.com/alecthomas/chroma/v2 v2.23.1 // indirect
github.com/antlr4-go/antlr/v4 v4.13.1 // indirect
Expand Down Expand Up @@ -49,8 +50,8 @@ require (
github.com/dlclark/regexp2 v1.11.5 // indirect
github.com/emirpasic/gods/v2 v2.0.0-alpha // indirect
github.com/fatih/color v1.18.0 // indirect
github.com/flanksource/gomplate/v3 v3.24.71 // indirect
github.com/flanksource/is-healthy v1.0.85 // indirect
github.com/flanksource/gomplate/v3 v3.24.74 // indirect
github.com/flanksource/is-healthy v1.0.86 // indirect
github.com/flanksource/kubectl-neat v1.0.4 // indirect
github.com/fsnotify/fsnotify v1.9.0 // indirect
github.com/fxamacker/cbor/v2 v2.9.0 // indirect
Expand Down Expand Up @@ -172,4 +173,4 @@ require (
sigs.k8s.io/yaml v1.6.0 // indirect
)

replace github.com/flanksource/commons => ../..
// replace github.com/flanksource/commons => ../..
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify that cmd/hx imports commons packages while local replace is disabled.
# Expected: imports exist + replace is commented, confirming potential mismatch risk.

echo "== Imports from github.com/flanksource/commons in cmd/hx =="
rg -n 'github\.com/flanksource/commons(/|")' cmd/hx/*.go cmd/hx/**/*.go

echo
echo "== commons dependency and replace directive state in cmd/hx/go.mod =="
rg -n 'github\.com/flanksource/commons v|^\s*replace github\.com/flanksource/commons|^\s*//\s*replace github\.com/flanksource/commons' cmd/hx/go.mod

Repository: flanksource/commons

Length of output: 615


Re-enable the commons replace directive in cmd/hx/go.mod.

The replace at line 176 is commented out, causing cmd/hx to resolve github.com/flanksource/commons from the published v1.47.2 (line 8) instead of local sources. However, cmd/hx/root.go imports multiple commons subpackages (output, parse, har, http, middlewares), so disabling the replace means any changes to commons in this PR won't be tested by cmd/hx builds or tests. Uncomment the replace directive to ensure cmd/hx uses the PR's local commons code.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@cmd/hx/go.mod` at line 176, Uncomment the replace directive in cmd/hx/go.mod
so the module uses the local commons sources; specifically restore the line
replacing github.com/flanksource/commons with ../.. (undo the commented "//
replace github.com/flanksource/commons => ../..") so cmd/hx (which imports
commons subpackages in cmd/hx/root.go like output, parse, har, http,
middlewares) will build and test against the PR's local commons changes.

16 changes: 10 additions & 6 deletions cmd/hx/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ github.com/Masterminds/goutils v1.1.1 h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJ
github.com/Masterminds/goutils v1.1.1/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU=
github.com/Masterminds/semver/v3 v3.4.0 h1:Zog+i5UMtVoCU8oKka5P7i9q9HgrJeGzI9SA1Xbatp0=
github.com/Masterminds/semver/v3 v3.4.0/go.mod h1:4V+yj/TJE1HU9XfppCwVMZq3I84lprf4nC11bSS5beM=
github.com/Snawoot/go-http-digest-auth-client v1.1.3 h1:Xd/SNBuIUJqotzmxRpbXovBJxmlVZOT19IZZdMdrJ0Q=
github.com/Snawoot/go-http-digest-auth-client v1.1.3/go.mod h1:WiwNiPXTRGyjTGpBtSQJlM2wDPRRPpFGhMkMWpV4uqg=
github.com/ajstarks/deck v0.0.0-20200831202436-30c9fc6549a9/go.mod h1:JynElWSGnm/4RlzPXRlREEwqTHAN3T56Bv2ITsFT3gY=
github.com/ajstarks/deck/generate v0.0.0-20210309230005-c3f852c02e19/go.mod h1:T13YZdzov6OU0A1+RfKZiZN9ca6VeKdBdyDV+BY97Tk=
github.com/ajstarks/svgo v0.0.0-20211024235047-1546f124cd8b h1:slYM766cy2nI3BwyRiyQj/Ud48djTMtMebDqepE95rw=
Expand Down Expand Up @@ -93,12 +95,14 @@ github.com/emirpasic/gods/v2 v2.0.0-alpha h1:dwFlh8pBg1VMOXWGipNMRt8v96dKAIvBeht
github.com/emirpasic/gods/v2 v2.0.0-alpha/go.mod h1:W0y4M2dtBB9U5z3YlghmpuUhiaZT2h6yoeE+C1sCp6A=
github.com/fatih/color v1.18.0 h1:S8gINlzdQ840/4pfAwic/ZE0djQEH3wM94VfqLTZcOM=
github.com/fatih/color v1.18.0/go.mod h1:4FelSpRwEGDpQ12mAdzqdOukCy4u8WUtOY6lkT/6HfU=
github.com/flanksource/clicky v1.19.0 h1:YzGnM8a3WUdYuKvfULkkcuwT4IlKTKzkKcPHUK7Ju+g=
github.com/flanksource/clicky v1.19.0/go.mod h1:Wg30x88982ejUzKqtw+Sm7UMRHTB8bnIQBXHi9s54RU=
github.com/flanksource/gomplate/v3 v3.24.71 h1:c610TQ+YEhA39bJIl5wiG3ynWxyrPlbgu4BoCHxlJfo=
github.com/flanksource/gomplate/v3 v3.24.71/go.mod h1:PMJGo4K81b0TB0FrC8WJDE9+vW3X/zWHQ8eGpCMYXmo=
github.com/flanksource/is-healthy v1.0.85 h1:YHRDwiuaCCeF1fcJwPBwTzkj/2bZINDxDjVuD3Bl2Qo=
github.com/flanksource/is-healthy v1.0.85/go.mod h1:xoEeeCamUiW8fGWGyRaGL9NU4xQzou+sgDC5raguDew=
github.com/flanksource/clicky v1.21.1 h1:Vk/q39QFCp+BEvX+mVfoeyfVP4IvLs18DlI5gMBLRbs=
github.com/flanksource/clicky v1.21.1/go.mod h1:Wg30x88982ejUzKqtw+Sm7UMRHTB8bnIQBXHi9s54RU=
github.com/flanksource/commons v1.47.2 h1:3CE3MHBWM/1rehHDduUR8r55rP8HorbYuiB2LO8Rjmw=
github.com/flanksource/commons v1.47.2/go.mod h1:ouTo/VFVZ/7LKEDWgHLQKdCJsTreDrUOmV0Z3CxZosY=
github.com/flanksource/gomplate/v3 v3.24.74 h1:LR1TGUxbQiZyjPgxP7dElVZi6LzMwBVqyZ3z0FgkMPU=
github.com/flanksource/gomplate/v3 v3.24.74/go.mod h1:l3iet81uj0sje3uMIkAURjOu1E4UErJ3PMVTYhvABCM=
github.com/flanksource/is-healthy v1.0.86 h1:N4oxqdW8/YN7+EmEHk4rStpYXzuGADiMAXP2T75bynw=
github.com/flanksource/is-healthy v1.0.86/go.mod h1:xoEeeCamUiW8fGWGyRaGL9NU4xQzou+sgDC5raguDew=
github.com/flanksource/kubectl-neat v1.0.4 h1:t5/9CqgE84oEtB0KitgJ2+WIeLfD+RhXSxYrqb4X8yI=
github.com/flanksource/kubectl-neat v1.0.4/go.mod h1:Un/Voyh3cmiZNKQrW/TkAl28nAA7vwnwDGVjRErKjOw=
github.com/fsnotify/fsnotify v1.9.0 h1:2Ml+OJNzbYCTzsxtv8vKSFD9PbJjmhYF14k/jKC7S9k=
Expand Down
5 changes: 4 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ require (
github.com/bsm/gomega v1.27.10
github.com/emirpasic/gods/v2 v2.0.0-alpha
github.com/fatih/color v1.18.0
github.com/flanksource/clicky v1.19.0
github.com/flanksource/clicky v1.21.1
github.com/fsnotify/fsnotify v1.9.0
github.com/goccy/go-yaml v1.19.2
github.com/google/go-cmp v0.7.0
Expand Down Expand Up @@ -74,6 +74,7 @@ require (
github.com/charmbracelet/x/term v0.2.2 // indirect
github.com/clipperhouse/displaywidth v0.11.0 // indirect
github.com/clipperhouse/uax29/v2 v2.7.0 // indirect
github.com/creack/pty v1.1.24 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/deckarep/golang-set/v2 v2.8.0 // indirect
github.com/distribution/reference v0.6.0 // indirect
Expand Down Expand Up @@ -187,3 +188,5 @@ require (
golang.org/x/tools v0.42.0 // indirect
google.golang.org/protobuf v1.36.11 // indirect
)

// replace github.com/flanksource/clicky => ../clicky
Loading
Loading