Skip to content

Commit b0318a0

Browse files
committed
Address PR review feedback for issue #2169
- Use existing strip_ansi helper from conftest instead of duplicating ANSI escape pattern - Properly escape ai_commands_dir with shlex.quote() to handle paths with spaces - Add shlex import to support proper command-line argument escaping
1 parent fa5c530 commit b0318a0

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

src/specify_cli/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import json
3434
import json5
3535
import stat
36+
import shlex
3637
import yaml
3738
from pathlib import Path
3839
from typing import Any, Optional
@@ -102,7 +103,7 @@ def _build_integration_equivalent(
102103
parts = [f"--integration {integration_key}"]
103104
if integration_key == "generic" and ai_commands_dir:
104105
parts.append(
105-
f'--integration-options="--commands-dir {ai_commands_dir}"'
106+
f'--integration-options="--commands-dir {shlex.quote(ai_commands_dir)}"'
106107
)
107108
return " ".join(parts)
108109

tests/integrations/test_cli.py

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

33
import json
44
import os
5-
import re
65

76
import yaml
87

8+
from tests.conftest import strip_ansi
9+
910

1011
def _normalize_cli_output(output: str) -> str:
11-
output = re.sub(r"\x1b\[[0-9;]*m", "", output)
12-
output = re.sub(r"\s+", " ", output)
12+
output = strip_ansi(output)
13+
output = " ".join(output.split())
1314
return output.strip()
1415

1516

0 commit comments

Comments
 (0)