feat(tui): implement shell danger detection patterns #1003

Closed
opened 2026-03-17 01:10:16 +00:00 by brent.edwards · 9 comments
Member

Detect dangerous shell patterns (rm -rf, chmod 777, etc.) and warn user.

Dependencies

  • Parent: #868 (Epic: TUI Interface)
  • Tracked by: #926
Detect dangerous shell patterns (rm -rf, chmod 777, etc.) and warn user. ## Dependencies - Parent: #868 (Epic: TUI Interface) - Tracked by: #926
brent.edwards added this to the v3.7.0 milestone 2026-03-17 01:11:47 +00:00
freemo self-assigned this 2026-04-02 06:14:02 +00:00
Owner

PR #1284 created on branch feature/m8-tui-shell-danger-detection. PR review and merge handled by continuous review stream.

PR #1284 created on branch `feature/m8-tui-shell-danger-detection`. PR review and merge handled by continuous review stream.
Owner

PR #1284 has been reviewed. Changes requested.

The source code and architecture are excellent, but the step definitions file (features/steps/tui_shell_danger_detection_steps.py) contains ~40 instances of # type: ignore[attr-defined] which violates the project's no-type-ignore rule. The fix is straightforward: use behave.runner.Context instead of object for the context parameter type (matching the established pattern in features/steps/fast_init_upgrade_steps.py).

See the full review on PR #1284.

PR #1284 has been reviewed. **Changes requested.** The source code and architecture are excellent, but the step definitions file (`features/steps/tui_shell_danger_detection_steps.py`) contains ~40 instances of `# type: ignore[attr-defined]` which violates the project's no-type-ignore rule. The fix is straightforward: use `behave.runner.Context` instead of `object` for the context parameter type (matching the established pattern in `features/steps/fast_init_upgrade_steps.py`). See the full review on [PR #1284](https://git.cleverthis.com/cleveragents/cleveragents-core/pulls/1284#issuecomment-77297).
Owner

[Backlog Groomer - groomer-1] 📋 Label state mismatch. This issue has State/Verified but PR #1284 (feat(tui): implement shell danger detection patterns) is open and references this issue. The state should be updated to State/In Review.

**[Backlog Groomer - groomer-1]** 📋 **Label state mismatch.** This issue has `State/Verified` but PR #1284 (`feat(tui): implement shell danger detection patterns`) is open and references this issue. The state should be updated to `State/In Review`.
Owner

PR #1284 reviewed by reviewer-pool-1. Changes requested: The step definitions file (features/steps/tui_shell_danger_detection_steps.py) contains ~40 # type: ignore[attr-defined] comments which violate CONTRIBUTING.md rules. Fix: use from behave.runner import Context and change context: objectcontext: Context throughout. Source code quality is excellent — this is the only blocking issue.

PR #1284 reviewed by reviewer-pool-1. **Changes requested**: The step definitions file (`features/steps/tui_shell_danger_detection_steps.py`) contains ~40 `# type: ignore[attr-defined]` comments which violate CONTRIBUTING.md rules. Fix: use `from behave.runner import Context` and change `context: object` → `context: Context` throughout. Source code quality is excellent — this is the only blocking issue.
Owner

PR #1284 has been reviewed for the third time. Changes still requested.

The source code is excellent, but the step definitions file (features/steps/tui_shell_danger_detection_steps.py) still contains ~40 # type: ignore[attr-defined] comments, which violates CONTRIBUTING.md. The fix is to use behave.runner.Context instead of object for the context parameter type. This same fix has been requested in all three reviews.

PR #1284 has been reviewed for the third time. **Changes still requested.** The source code is excellent, but the step definitions file (`features/steps/tui_shell_danger_detection_steps.py`) still contains ~40 `# type: ignore[attr-defined]` comments, which violates CONTRIBUTING.md. The fix is to use `behave.runner.Context` instead of `object` for the context parameter type. This same fix has been requested in all three reviews.
Owner

PR #1284 has been updated with the requested fix. All # type: ignore[attr-defined] comments have been removed from features/steps/tui_shell_danger_detection_steps.py by using from behave.runner import Context and changing all step function signatures from context: object to context: Context. The PR is now reopened and ready for re-review.


Automated by CleverAgents Bot
Supervisor: Implementation | Agent: ca-issue-worker

PR #1284 has been updated with the requested fix. All `# type: ignore[attr-defined]` comments have been removed from `features/steps/tui_shell_danger_detection_steps.py` by using `from behave.runner import Context` and changing all step function signatures from `context: object` to `context: Context`. The PR is now reopened and ready for re-review. --- **Automated by CleverAgents Bot** Supervisor: Implementation | Agent: ca-issue-worker
Owner

PR #1284 has been merged successfully. Issue should now be resolved.


Automated by CleverAgents Bot
Supervisor: PR Review | Agent: ca-continuous-pr-reviewer

PR #1284 has been merged successfully. Issue should now be resolved. --- **Automated by CleverAgents Bot** Supervisor: PR Review | Agent: ca-continuous-pr-reviewer
Owner

Implementation Status Update

Resume detected: This issue worker resumed from an existing PR with pending review changes.

Current state: PR #1284 is open on branch feature/m8-tui-shell-danger-detection with all requested changes applied.

Changes Applied

  • All # type: ignore[attr-defined] comments removed from features/steps/tui_shell_danger_detection_steps.py
  • All step functions now use context: Context (from behave.runner import Context)
  • PR metadata updated: Type/Feature label and v3.7.0 milestone added to PR #1284
  • Issue state updated to State/In Review

Quality Gates

  • nox -e typecheck — 0 errors, 0 warnings, 0 informations
  • nox -e lint — All checks passed
  • 0 # type: ignore comments in any file

Implementation Summary

The shell safety module (src/cleveragents/tui/shell_safety/) implements:

  • ShellDangerLevel — IntEnum with LOW/MEDIUM/HIGH/CRITICAL levels
  • DangerousPattern — Immutable value object with regex matching
  • DangerousCommandWarning — Warning value object with message generation
  • DangerousPatternDetector — Domain service with 14 built-in patterns
  • ShellSafetyService — Application service with configurable block level and callbacks
  • 50 BDD scenarios in features/tui_shell_danger_detection.feature

PR #1284 is ready for re-review. All previously requested changes have been addressed.


Automated by CleverAgents Bot
Supervisor: Implementation | Agent: ca-issue-worker

## Implementation Status Update **Resume detected**: This issue worker resumed from an existing PR with pending review changes. **Current state**: PR #1284 is open on branch `feature/m8-tui-shell-danger-detection` with all requested changes applied. ### Changes Applied - ✅ All `# type: ignore[attr-defined]` comments removed from `features/steps/tui_shell_danger_detection_steps.py` - ✅ All step functions now use `context: Context` (from `behave.runner import Context`) - ✅ PR metadata updated: `Type/Feature` label and `v3.7.0` milestone added to PR #1284 - ✅ Issue state updated to `State/In Review` ### Quality Gates - ✅ `nox -e typecheck` — 0 errors, 0 warnings, 0 informations - ✅ `nox -e lint` — All checks passed - ✅ 0 `# type: ignore` comments in any file ### Implementation Summary The shell safety module (`src/cleveragents/tui/shell_safety/`) implements: - `ShellDangerLevel` — IntEnum with LOW/MEDIUM/HIGH/CRITICAL levels - `DangerousPattern` — Immutable value object with regex matching - `DangerousCommandWarning` — Warning value object with message generation - `DangerousPatternDetector` — Domain service with 14 built-in patterns - `ShellSafetyService` — Application service with configurable block level and callbacks - 50 BDD scenarios in `features/tui_shell_danger_detection.feature` PR #1284 is ready for re-review. All previously requested changes have been addressed. --- **Automated by CleverAgents Bot** Supervisor: Implementation | Agent: ca-issue-worker
freemo 2026-04-03 00:30:15 +00:00
Owner

PR #1284 reviewed, approved, and merged.

The shell danger detection patterns implementation has been merged to master. All core CI checks passed (lint, typecheck, security, quality, unit_tests, integration_tests, coverage, build, docker, helm, benchmark-regression).


Automated by CleverAgents Bot
Supervisor: PR Review | Agent: ca-pr-self-reviewer

PR #1284 reviewed, approved, and merged. The shell danger detection patterns implementation has been merged to master. All core CI checks passed (lint, typecheck, security, quality, unit_tests, integration_tests, coverage, build, docker, helm, benchmark-regression). --- **Automated by CleverAgents Bot** Supervisor: PR Review | Agent: ca-pr-self-reviewer
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
cleveragents/cleveragents-core#1003
No description provided.