Skip to content

Commit

Permalink
hide chat command from help (#668)
Browse files Browse the repository at this point in the history
(cherry picked from commit 63075ae)
  • Loading branch information
tiagobcx authored and OrShamirCM committed Mar 11, 2024
1 parent 1aac5dd commit c71a25c
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
pull_request:

env:
GO_VERSION: '1.21.5'
GO_VERSION: '1.21.8'

jobs:
unit-tests:
Expand Down
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/checkmarx/ast-cli

go 1.21.5
go 1.21.8

require (
github.com/MakeNowJust/heredoc v1.0.0
Expand All @@ -15,7 +15,7 @@ require (
github.com/spf13/cobra v1.8.0
github.com/spf13/viper v1.18.2
github.com/tomnomnom/linkheader v0.0.0-20180905144013-02ca5825eb80
golang.org/x/crypto v0.18.0
golang.org/x/crypto v0.21.0
golang.org/x/text v0.14.0
gotest.tools v2.2.0+incompatible
)
Expand All @@ -39,7 +39,7 @@ require (
go.uber.org/atomic v1.9.0 // indirect
go.uber.org/multierr v1.9.0 // indirect
golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect
golang.org/x/sys v0.16.0 // indirect
golang.org/x/sys v0.18.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
10 changes: 10 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,20 @@ go.uber.org/multierr v1.9.0 h1:7fIwc/ZtS0q++VgcfqFDxSBZVv/Xo49/SYnDFupUwlI=
go.uber.org/multierr v1.9.0/go.mod h1:X2jQV1h+kxSjClGpnseKVIxpmcjrj7MNnI0bnlfKTVQ=
golang.org/x/crypto v0.18.0 h1:PGVlW0xEltQnzFZ55hkuX5+KLyrMYhHld1YHO4AKcdc=
golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg=
golang.org/x/crypto v0.20.0 h1:jmAMJJZXr5KiCw05dfYK9QnqaqKLYXijU23lsEdcQqg=
golang.org/x/crypto v0.20.0/go.mod h1:Xwo95rrVNIoSMx9wa1JroENMToLWn3RNVrTBpLHgZPQ=
golang.org/x/crypto v0.20.1-0.20240228204720-0d2316b26734 h1:HutZC8sRIg57ztz3rVaQYl4yxgM+UF0Jal0kAWUSeFU=
golang.org/x/crypto v0.20.1-0.20240228204720-0d2316b26734/go.mod h1:Xwo95rrVNIoSMx9wa1JroENMToLWn3RNVrTBpLHgZPQ=
golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA=
golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs=
golang.org/x/exp v0.0.0-20230905200255-921286631fa9 h1:GoHiUyI/Tp2nVkLI2mCxVkOjsbSXD66ic0XW0js0R9g=
golang.org/x/exp v0.0.0-20230905200255-921286631fa9/go.mod h1:S2oDrQGGwySpoQPVqRShND87VCbxmc6bL1Yd2oYrm6k=
golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU=
golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y=
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4=
golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
Expand Down
9 changes: 5 additions & 4 deletions internal/commands/chat-kics.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,11 @@ type OutputModel struct {

func ChatKicsSubCommand(chatWrapper wrappers.ChatWrapper) *cobra.Command {
chatKicsCmd := &cobra.Command{
Use: "kics",
Short: "Chat about KICS result with OpenAI models",
Long: "Chat about KICS result with OpenAI models",
RunE: runChatKics(chatWrapper),
Use: "kics",
Short: "Chat about KICS result with OpenAI models",
Long: "Chat about KICS result with OpenAI models",
Hidden: true,
RunE: runChatKics(chatWrapper),
}

chatKicsCmd.Flags().String(params.ChatAPIKey, "", "OpenAI API key")
Expand Down
9 changes: 5 additions & 4 deletions internal/commands/chat-sast.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,11 @@ const AiGuidedRemediationDisabledError = "The AI Guided Remediation is disabled

func ChatSastSubCommand(chatWrapper wrappers.ChatWrapper, tenantWrapper wrappers.TenantConfigurationWrapper) *cobra.Command {
chatSastCmd := &cobra.Command{
Use: "sast",
Short: "OpenAI-based SAST results remediation",
Long: "Use OpenAI models to remediate SAST results and chat about them",
RunE: runChatSast(chatWrapper, tenantWrapper),
Use: "sast",
Short: "OpenAI-based SAST results remediation",
Long: "Use OpenAI models to remediate SAST results and chat about them",
Hidden: true,
RunE: runChatSast(chatWrapper, tenantWrapper),
}

chatSastCmd.Flags().String(params.ChatAPIKey, "", "OpenAI API key")
Expand Down
7 changes: 4 additions & 3 deletions internal/commands/chat.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ const (

func NewChatCommand(chatWrapper wrappers.ChatWrapper, tenantWrapper wrappers.TenantConfigurationWrapper) *cobra.Command {
chatCmd := &cobra.Command{
Use: "chat",
Short: "Chat with OpenAI models",
Long: "Chat with OpenAI models regarding KICS or SAST results",
Use: "chat",
Short: "Chat with OpenAI models",
Long: "Chat with OpenAI models regarding KICS or SAST results",
Hidden: true,
}
chatKicsCmd := ChatKicsSubCommand(chatWrapper)
chatSastCmd := ChatSastSubCommand(chatWrapper, tenantWrapper)
Expand Down
6 changes: 4 additions & 2 deletions internal/commands/util/help.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@ func RootHelpFunc(command *cobra.Command) {
var commands []string

for _, c := range command.Commands() {
s := rightPad(c.Name()+":", c.NamePadding()) + c.Short
commands = append(commands, s)
if !c.Hidden {
s := rightPad(c.Name()+":", c.NamePadding()) + c.Short
commands = append(commands, s)
}
}

type helpEntry struct {
Expand Down

0 comments on commit c71a25c

Please sign in to comment.