Skip to content

Commit 8884a4f

Browse files
committed
add help for commands; add epilog; remove "auth check" command; fix ignore command
1 parent 8c69a5c commit 8884a4f

File tree

18 files changed

+146
-63
lines changed

18 files changed

+146
-63
lines changed

cycode/cli/apps/ai_remediation/__init__.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,19 @@
22

33
from cycode.cli.apps.ai_remediation.ai_remediation_command import ai_remediation_command
44

5-
app = typer.Typer(no_args_is_help=True)
6-
app.command(name='ai-remediation', short_help='Get AI remediation (INTERNAL).', hidden=True)(ai_remediation_command)
5+
app = typer.Typer()
6+
7+
_ai_remediation_epilog = """
8+
Note: AI remediation suggestions are generated automatically and should be reviewed before applying.
9+
"""
10+
11+
app.command(
12+
name='ai-remediation',
13+
short_help='Get AI remediation (INTERNAL).',
14+
epilog=_ai_remediation_epilog,
15+
hidden=True,
16+
no_args_is_help=True,
17+
)(ai_remediation_command)
718

819
# backward compatibility
920
app.command(hidden=True, name='ai_remediation')(ai_remediation_command)

cycode/cli/apps/ai_remediation/ai_remediation_command.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,14 @@ def ai_remediation_command(
1616
bool, typer.Option('--fix', help='Apply fixes to resolve violations. Note: fix could be not available.')
1717
] = False,
1818
) -> None:
19-
"""Get AI remediation (INTERNAL)."""
19+
""":robot: [bold cyan]Get AI-powered remediation for security issues.[/]
20+
21+
This command provides AI-generated remediation guidance for detected security issues.
22+
23+
Example usage:
24+
* `cycode ai-remediation <detection_id>`: View remediation guidance
25+
* `cycode ai-remediation <detection_id> --fix`: Apply suggested fixes
26+
"""
2027
client = get_scan_cycode_client()
2128

2229
try:

cycode/cli/apps/auth/__init__.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
import typer
22

33
from cycode.cli.apps.auth.auth_command import auth_command
4-
from cycode.cli.apps.auth.check_command import check_command
5-
6-
app = typer.Typer(
7-
name='auth',
8-
help='Authenticate your machine to associate the CLI with your Cycode account.',
9-
no_args_is_help=True,
10-
)
11-
app.callback(invoke_without_command=True)(auth_command)
12-
app.command(name='check')(check_command)
4+
5+
_auth_command_docs = 'https://github.com/cycodehq/cycode-cli/blob/main/README.md#using-the-auth-command'
6+
_auth_command_epilog = f"""[bold]Documentation[/]
7+
8+
9+
10+
For more details and advanced usage, visit: [link={_auth_command_docs}]{_auth_command_docs}[/link]
11+
"""
12+
13+
app = typer.Typer(no_args_is_help=False)
14+
app.command(name='auth', epilog=_auth_command_epilog, short_help='Authenticate your machine with Cycode.')(auth_command)

cycode/cli/apps/auth/auth_command.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,18 @@
88

99

1010
def auth_command(ctx: typer.Context) -> None:
11-
"""Authenticates your machine."""
11+
""":key: [bold cyan]Authenticate your machine with Cycode.[/]
12+
13+
This command handles authentication with Cycode's security platform.
14+
15+
Example usage:
16+
* `cycode auth`: Start interactive authentication
17+
* `cycode auth --help`: View authentication options
18+
"""
19+
1220
add_breadcrumb('auth')
1321
printer = ctx.obj.get('console_printer')
1422

15-
if ctx.invoked_subcommand is not None:
16-
# if it is a subcommand, do nothing
17-
return
18-
1923
try:
2024
logger.debug('Starting authentication process')
2125

cycode/cli/apps/auth/auth_common.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
1-
from typing import Optional
2-
3-
import typer
1+
from typing import TYPE_CHECKING, Optional
42

53
from cycode.cli.apps.auth.models import AuthInfo
64
from cycode.cli.exceptions.custom_exceptions import HttpUnauthorizedError, RequestHttpError
75
from cycode.cli.user_settings.credentials_manager import CredentialsManager
86
from cycode.cli.utils.jwt_utils import get_user_and_tenant_ids_from_access_token
97
from cycode.cyclient.cycode_token_based_client import CycodeTokenBasedClient
108

9+
if TYPE_CHECKING:
10+
from typer import Context
11+
1112

12-
def get_authorization_info(ctx: Optional[typer.Context] = None) -> Optional[AuthInfo]:
13+
def get_authorization_info(ctx: 'Context') -> Optional[AuthInfo]:
1314
printer = ctx.obj.get('console_printer')
1415

1516
client_id, client_secret = CredentialsManager().get_credentials()

cycode/cli/apps/auth/check_command.py

Lines changed: 0 additions & 24 deletions
This file was deleted.

cycode/cli/apps/configure/__init__.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,18 @@
22

33
from cycode.cli.apps.configure.configure_command import configure_command
44

5+
_configure_command_docs = 'https://github.com/cycodehq/cycode-cli/blob/main/README.md#using-the-configure-command'
6+
_configure_command_epilog = f"""[bold]Documentation[/]
7+
8+
9+
10+
For more details and advanced usage, visit: [link={_configure_command_docs}]{_configure_command_docs}[/link]
11+
"""
12+
13+
514
app = typer.Typer(no_args_is_help=True)
6-
app.command(name='configure', short_help='Initial command to configure your CLI client authentication.')(
7-
configure_command
8-
)
15+
app.command(
16+
name='configure',
17+
epilog=_configure_command_epilog,
18+
short_help='Initial command to configure your CLI client authentication.',
19+
)(configure_command)

cycode/cli/apps/configure/configure_command.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,20 @@ def _should_update_value(
2323

2424

2525
def configure_command() -> None:
26-
"""Configure your CLI client authentication manually."""
26+
""":gear: [bold cyan]Configure Cycode CLI settings.[/]
27+
28+
This command allows you to configure various aspects of the Cycode CLI.
29+
30+
Configuration options:
31+
* API URL: The base URL for Cycode's API (for on-premise or EU installations)
32+
* APP URL: The base URL for Cycode's web application (for on-premise or EU installations)
33+
* Client ID: Your Cycode client ID for authentication
34+
* Client Secret: Your Cycode client secret for authentication
35+
36+
Example usage:
37+
* `cycode configure`: Start interactive configuration
38+
* `cycode configure --help`: View configuration options
39+
"""
2740
add_breadcrumb('configure')
2841

2942
global_config_manager = CONFIGURATION_MANAGER.global_config_file_manager

cycode/cli/apps/ignore/ignore_command.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,20 @@ def ignore_command( # noqa: C901
8383
bool, typer.Option('--global', '-g', help='Add an ignore rule to the global CLI config.')
8484
] = False,
8585
) -> None:
86-
"""Ignores a specific value, path or rule ID."""
86+
""":no_entry: [bold cyan]Ignore specific findings or paths in scans.[/]
87+
88+
This command allows you to exclude specific items from Cycode scans, including:
89+
* Paths: Exclude specific files or directories
90+
* Rules: Ignore specific security rules
91+
* Values: Exclude specific sensitive values
92+
* Packages: Ignore specific package versions
93+
* CVEs: Exclude specific vulnerabilities
94+
95+
Example usage:
96+
* `cycode ignore --by-path .env`: Ignore the tests directory
97+
* `cycode ignore --by-rule GUID`: Ignore rule with the specified GUID
98+
* `cycode ignore --by-package [email protected]`: Ignore lodash version 4.17.21
99+
"""
87100
add_breadcrumb('ignore')
88101

89102
all_by_values = [by_value, by_sha, by_path, by_rule, by_package, by_cve]
@@ -145,4 +158,4 @@ def ignore_command( # noqa: C901
145158
'exclusion_value': exclusion_value,
146159
},
147160
)
148-
configuration_manager.add_exclusion(configuration_scope, scan_type, exclusion_type, exclusion_value)
161+
configuration_manager.add_exclusion(configuration_scope, str(scan_type), exclusion_type, exclusion_value)

cycode/cli/apps/report/report_command.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@
55

66

77
def report_command(ctx: typer.Context) -> int:
8-
"""Generate report."""
8+
""":bar_chart: [bold cyan]Generate security reports.[/]
9+
10+
Example usage:
11+
* `cycode report sbom`: Generate SBOM report
12+
"""
913
add_breadcrumb('report')
1014
ctx.obj['progress_bar'] = get_progress_bar(hidden=False, sections=SBOM_REPORT_PROGRESS_BAR_SECTIONS)
1115
return 1

0 commit comments

Comments
 (0)