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
9 changes: 6 additions & 3 deletions src/aci/core/path_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,12 @@ def _is_windows_system_directory(resolved: Path, path_str: str) -> bool:
windows_path = PureWindowsPath(path_str)
win_parts = [part.lower() for part in windows_path.parts if part not in ("\\", "/")]

# Strip drive prefix (e.g., "c:") if present.
if win_parts and re.fullmatch(r"[a-z]:", win_parts[0]):
win_parts = win_parts[1:]
# Strip Windows drive/root prefixes (e.g., "c:\\" -> "c:") so the
# first semantic directory component can be matched reliably.
if win_parts:
drive = win_parts[0].rstrip("\\/")
if re.fullmatch(r"[a-z]:", drive):
win_parts = win_parts[1:]

if win_parts and win_parts[0] in WINDOWS_SYSTEM_DIRS:
return True
Expand Down
20 changes: 15 additions & 5 deletions tests/unit/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,20 @@
Tests the basic functionality of CLI commands and error handling.
"""

import re

from typer.testing import CliRunner

from aci.cli import app

runner = CliRunner()


def _plain(text: str) -> str:
"""Remove ANSI escape sequences for stable assertions."""
return re.sub(r"\x1b\[[0-9;]*m", "", text)


class TestCLIHelp:
"""Test CLI help and usage information."""

Expand All @@ -29,17 +36,20 @@ def test_index_help(self):
result = runner.invoke(app, ["index", "--help"])

assert result.exit_code == 0
assert "Directory to index" in result.stdout
assert "--workers" in result.stdout
output = _plain(result.stdout)
assert "Directory to index" in output
assert "workers" in output
assert "-w" in output

def test_search_help(self):
"""Search command help should display options."""
result = runner.invoke(app, ["search", "--help"])

assert result.exit_code == 0
assert "Search query" in result.stdout
assert "--limit" in result.stdout
assert "--filter" in result.stdout
output = _plain(result.stdout)
assert "Search query" in output
assert "limit" in output
assert "filter" in output

def test_update_help(self):
"""Update command help should display options."""
Expand Down