diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e58cf16..b1e3207 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,7 +7,7 @@ on: branches: [ main ] jobs: - lint: + lint-ruff: name: Lint (Ruff) runs-on: ubuntu-latest steps: @@ -23,9 +23,25 @@ jobs: - name: Run Ruff run: ruff check . + lint-flake8: + name: Lint (Flake8) + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.10' + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements-dev.txt + - name: Run Flake8 + run: flake8 . + test-linux: name: Test (Linux) - needs: lint + needs: [lint-ruff, lint-flake8] runs-on: ubuntu-latest strategy: matrix: @@ -47,7 +63,7 @@ jobs: test-windows: name: Test (Windows) - needs: lint + needs: [lint-ruff, lint-flake8] runs-on: windows-latest strategy: matrix: @@ -69,7 +85,7 @@ jobs: test-macos: name: Test (macOS) - needs: lint + needs: [lint-ruff, lint-flake8] runs-on: macos-latest strategy: matrix: diff --git a/requirements-dev.txt b/requirements-dev.txt index 2327f42..22b032b 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,4 +1,5 @@ pytest ruff +flake8 build twine diff --git a/shellmind/ai.py b/shellmind/ai.py index 700db38..ca90b52 100644 --- a/shellmind/ai.py +++ b/shellmind/ai.py @@ -84,7 +84,11 @@ def _trim_history(messages: list[dict]) -> None: def _direct_shell_command(text: str) -> str | None: if text.startswith("!"): - return text[1:].strip() + cmd = text[1:].strip() + for prefix in ["shell ", "run "]: + if cmd.startswith(prefix): + return cmd[len(prefix):].strip() + return cmd return None