Skip to content

Commit 11d0879

Browse files
committed
CM-58022-format
1 parent 5adc5c4 commit 11d0879

File tree

10 files changed

+105
-104
lines changed

10 files changed

+105
-104
lines changed

cycode/cli/apps/ai_guardrails/hooks_manager.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def is_cycode_hook_entry(entry: dict) -> bool:
6666

6767

6868
def install_hooks(
69-
scope: str = 'user', repo_path: Optional[Path] = None, ide: AIIDEType = DEFAULT_IDE
69+
scope: str = 'user', repo_path: Optional[Path] = None, ide: AIIDEType = DEFAULT_IDE
7070
) -> tuple[bool, str]:
7171
"""
7272
Install Cycode AI guardrails hooks.
@@ -110,7 +110,7 @@ def install_hooks(
110110

111111

112112
def uninstall_hooks(
113-
scope: str = 'user', repo_path: Optional[Path] = None, ide: AIIDEType = DEFAULT_IDE
113+
scope: str = 'user', repo_path: Optional[Path] = None, ide: AIIDEType = DEFAULT_IDE
114114
) -> tuple[bool, str]:
115115
"""
116116
Remove Cycode AI guardrails hooks.

cycode/cli/apps/ai_guardrails/install_command.py

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -17,33 +17,33 @@
1717

1818

1919
def install_command(
20-
ctx: typer.Context,
21-
scope: Annotated[
22-
str,
23-
typer.Option(
24-
'--scope',
25-
'-s',
26-
help='Installation scope: "user" for all projects, "repo" for current repository only.',
27-
),
28-
] = 'user',
29-
ide: Annotated[
30-
str,
31-
typer.Option(
32-
'--ide',
33-
help='IDE to install hooks for (e.g., "cursor"). Defaults to cursor.',
34-
),
35-
] = 'cursor',
36-
repo_path: Annotated[
37-
Optional[Path],
38-
typer.Option(
39-
'--repo-path',
40-
help='Repository path for repo-scoped installation (defaults to current directory).',
41-
exists=True,
42-
file_okay=False,
43-
dir_okay=True,
44-
resolve_path=True,
45-
),
46-
] = None,
20+
ctx: typer.Context,
21+
scope: Annotated[
22+
str,
23+
typer.Option(
24+
'--scope',
25+
'-s',
26+
help='Installation scope: "user" for all projects, "repo" for current repository only.',
27+
),
28+
] = 'user',
29+
ide: Annotated[
30+
str,
31+
typer.Option(
32+
'--ide',
33+
help='IDE to install hooks for (e.g., "cursor"). Defaults to cursor.',
34+
),
35+
] = 'cursor',
36+
repo_path: Annotated[
37+
Optional[Path],
38+
typer.Option(
39+
'--repo-path',
40+
help='Repository path for repo-scoped installation (defaults to current directory).',
41+
exists=True,
42+
file_okay=False,
43+
dir_okay=True,
44+
resolve_path=True,
45+
),
46+
] = None,
4747
) -> None:
4848
"""Install AI guardrails hooks for supported IDEs.
4949

cycode/cli/apps/ai_guardrails/status_command.py

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -13,33 +13,33 @@
1313

1414

1515
def status_command(
16-
ctx: typer.Context,
17-
scope: Annotated[
18-
str,
19-
typer.Option(
20-
'--scope',
21-
'-s',
22-
help='Check scope: "user", "repo", or "all" for both.',
23-
),
24-
] = 'all',
25-
ide: Annotated[
26-
str,
27-
typer.Option(
28-
'--ide',
29-
help='IDE to check status for (e.g., "cursor"). Defaults to cursor.',
30-
),
31-
] = 'cursor',
32-
repo_path: Annotated[
33-
Optional[Path],
34-
typer.Option(
35-
'--repo-path',
36-
help='Repository path for repo-scoped status (defaults to current directory).',
37-
exists=True,
38-
file_okay=False,
39-
dir_okay=True,
40-
resolve_path=True,
41-
),
42-
] = None,
16+
ctx: typer.Context,
17+
scope: Annotated[
18+
str,
19+
typer.Option(
20+
'--scope',
21+
'-s',
22+
help='Check scope: "user", "repo", or "all" for both.',
23+
),
24+
] = 'all',
25+
ide: Annotated[
26+
str,
27+
typer.Option(
28+
'--ide',
29+
help='IDE to check status for (e.g., "cursor"). Defaults to cursor.',
30+
),
31+
] = 'cursor',
32+
repo_path: Annotated[
33+
Optional[Path],
34+
typer.Option(
35+
'--repo-path',
36+
help='Repository path for repo-scoped status (defaults to current directory).',
37+
exists=True,
38+
file_okay=False,
39+
dir_okay=True,
40+
resolve_path=True,
41+
),
42+
] = None,
4343
) -> None:
4444
"""Show AI guardrails hook installation status.
4545

cycode/cli/apps/ai_guardrails/uninstall_command.py

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -17,33 +17,33 @@
1717

1818

1919
def uninstall_command(
20-
ctx: typer.Context,
21-
scope: Annotated[
22-
str,
23-
typer.Option(
24-
'--scope',
25-
'-s',
26-
help='Uninstall scope: "user" for user-level hooks, "repo" for repository-level hooks.',
27-
),
28-
] = 'user',
29-
ide: Annotated[
30-
str,
31-
typer.Option(
32-
'--ide',
33-
help='IDE to uninstall hooks from (e.g., "cursor"). Defaults to cursor.',
34-
),
35-
] = 'cursor',
36-
repo_path: Annotated[
37-
Optional[Path],
38-
typer.Option(
39-
'--repo-path',
40-
help='Repository path for repo-scoped uninstallation (defaults to current directory).',
41-
exists=True,
42-
file_okay=False,
43-
dir_okay=True,
44-
resolve_path=True,
45-
),
46-
] = None,
20+
ctx: typer.Context,
21+
scope: Annotated[
22+
str,
23+
typer.Option(
24+
'--scope',
25+
'-s',
26+
help='Uninstall scope: "user" for user-level hooks, "repo" for repository-level hooks.',
27+
),
28+
] = 'user',
29+
ide: Annotated[
30+
str,
31+
typer.Option(
32+
'--ide',
33+
help='IDE to uninstall hooks from (e.g., "cursor"). Defaults to cursor.',
34+
),
35+
] = 'cursor',
36+
repo_path: Annotated[
37+
Optional[Path],
38+
typer.Option(
39+
'--repo-path',
40+
help='Repository path for repo-scoped uninstallation (defaults to current directory).',
41+
exists=True,
42+
file_okay=False,
43+
dir_okay=True,
44+
resolve_path=True,
45+
),
46+
] = None,
4747
) -> None:
4848
"""Remove AI guardrails hooks from supported IDEs.
4949

cycode/cli/apps/scan/prompt/handlers.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@ def handle_before_submit_prompt(ctx: typer.Context, payload: AIHookPayload, poli
6262
violation_summary, scan_id = _scan_text_for_secrets(ctx, clipped, timeout_ms)
6363

6464
if (
65-
violation_summary
66-
and get_policy_value(prompt_config, 'action', default='block') == 'block'
67-
and mode == 'block'
65+
violation_summary
66+
and get_policy_value(prompt_config, 'action', default='block') == 'block'
67+
and mode == 'block'
6868
):
6969
outcome = AIHookOutcome.BLOCKED
7070
block_reason = BlockReason.SECRETS_IN_PROMPT
@@ -256,7 +256,7 @@ def _setup_scan_context(ctx: typer.Context) -> typer.Context:
256256

257257

258258
def _perform_scan(
259-
ctx: typer.Context, documents: list[Document], scan_parameters: dict, timeout_seconds: float
259+
ctx: typer.Context, documents: list[Document], scan_parameters: dict, timeout_seconds: float
260260
) -> tuple[Optional[str], Optional[str]]:
261261
"""
262262
Perform a scan on documents and extract results.

cycode/cli/apps/scan/prompt/prompt_command.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,15 @@
2828

2929

3030
def prompt_command(
31-
ctx: typer.Context,
32-
ide: Annotated[
33-
str,
34-
typer.Option(
35-
'--ide',
36-
help='IDE that sent the payload (e.g., "cursor"). Defaults to cursor.',
37-
hidden=True,
38-
),
39-
] = 'cursor',
31+
ctx: typer.Context,
32+
ide: Annotated[
33+
str,
34+
typer.Option(
35+
'--ide',
36+
help='IDE that sent the payload (e.g., "cursor"). Defaults to cursor.',
37+
hidden=True,
38+
),
39+
] = 'cursor',
4040
) -> None:
4141
"""Handle AI guardrails hooks from supported IDEs.
4242

cycode/cyclient/ai_security_manager_client.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,12 @@ def create_conversation(self, payload: 'AIHookPayload') -> Optional[str]:
5151
return conversation_id
5252

5353
def create_event(
54-
self,
55-
payload: 'AIHookPayload',
56-
event_type: 'AiHookEventType',
57-
outcome: 'AIHookOutcome',
58-
scan_id: Optional[str] = None,
59-
block_reason: Optional['BlockReason'] = None,
54+
self,
55+
payload: 'AIHookPayload',
56+
event_type: 'AiHookEventType',
57+
outcome: 'AIHookOutcome',
58+
scan_id: Optional[str] = None,
59+
block_reason: Optional['BlockReason'] = None,
6060
) -> None:
6161
"""Create an AI hook event from hook payload."""
6262
conversation_id = payload.conversation_id

cycode/cyclient/client_creator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def create_import_sbom_client(
5757

5858

5959
def create_ai_security_manager_client(
60-
client_id: str, client_secret: Optional[str] = None, _: bool = False, id_token: Optional[str] = None
60+
client_id: str, client_secret: Optional[str] = None, _: bool = False, id_token: Optional[str] = None
6161
) -> AISecurityManagerClient:
6262
if dev_mode:
6363
client = CycodeDevBasedClient(DEV_CYCODE_API_URL)

tests/cli/commands/scan/prompt/test_handlers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ def test_handle_before_submit_prompt_scan_failure_fail_open(mock_scan, mock_ctx,
130130

131131
@patch('cycode.cli.apps.scan.prompt.handlers._scan_text_for_secrets')
132132
def test_handle_before_submit_prompt_scan_failure_fail_closed(
133-
mock_scan, mock_ctx, mock_payload, default_policy
133+
mock_scan, mock_ctx, mock_payload, default_policy
134134
) -> None:
135135
"""Test that scan failure with fail_open=False blocks the prompt."""
136136
mock_scan.side_effect = RuntimeError('Scan failed')

tests/cli/commands/scan/prompt/test_policy.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ def test_load_policy_with_repo_config(tmp_path: Path) -> None:
161161
repo_config.write_text('mode: block\nprompt:\n enabled: false\n')
162162

163163
with patch('cycode.cli.apps.scan.prompt.policy.load_yaml_file') as mock_load:
164+
164165
def side_effect(path: Path):
165166
if path == repo_config:
166167
return {'mode': 'block', 'prompt': {'enabled': False}}

0 commit comments

Comments
 (0)