Enhance/complete suite - #2
Open
GizzZmo wants to merge 151 commits into
Open
Conversation
Co-authored-by: GizzZmo <8039975+GizzZmo@users.noreply.github.com>
…f-9d592af2ab96 Major refactor: Transform AI Shell into a professional Python package with enhanced security and maintainability
Co-authored-by: GizzZmo <8039975+GizzZmo@users.noreply.github.com>
…f-dd10b9c0136e Complete documentation rewrite and enhancement
Co-authored-by: GizzZmo <8039975+GizzZmo@users.noreply.github.com>
…e-f73f421220a7
Co-authored-by: GizzZmo <8039975+GizzZmo@users.noreply.github.com>
Co-authored-by: GizzZmo <8039975+GizzZmo@users.noreply.github.com>
…2-9af6f7b55b72 Fix CI workflow by removing Python 3.8 support due to dependency incompatibility
…docs, and automation Co-authored-by: GizzZmo <8039975+GizzZmo@users.noreply.github.com>
…c-51a1e2c873da Implement comprehensive GitHub workflow system for CI/CD, security, and automation
Co-authored-by: GizzZmo <8039975+GizzZmo@users.noreply.github.com>
…7-0b18cc817827 Add MIT License file to complete licensing setup
Co-authored-by: GizzZmo <8039975+GizzZmo@users.noreply.github.com>
Co-authored-by: GizzZmo <8039975+GizzZmo@users.noreply.github.com>
…6-396229e87405
Co-authored-by: GizzZmo <8039975+GizzZmo@users.noreply.github.com>
…ing capabilities Co-authored-by: GizzZmo <8039975+GizzZmo@users.noreply.github.com>
- ai_shell/plugins/ with ToolPlugin base, registry, auto-discovery - Built-in: Metasploit, Wapiti, Nmap, Docker - Dynamic mode menu + generic run_plugin() PTY runner - docs/PLUGINS.md
…sets Fix distribution asset build by packaging requirements.txt in sdist
There was a problem hiding this comment.
Pull request overview
This PR introduces a full “AI Shell” Python package (CLI + config/LLM/executor/UI + plugin framework), alongside a broad GitHub automation layer (CI, docs, security, release, performance, status dashboard) and a large documentation/template set to standardize contribution and maintenance.
Changes:
- Added the
ai_shell/application (CLI entrypoint, config system, LLM providers, command execution w/ safety checks, UI helpers) plus a plugin system with multiple built-in tool assistants. - Added a comprehensive test suite and supporting test fixtures.
- Added multiple GitHub Actions workflows (CI, docs validation + Pages, security scanning, release automation, performance benchmarks, auto-labeling, and workflow status reporting) plus contributor templates and Dependabot config.
Reviewed changes
Copilot reviewed 58 out of 60 changed files in this pull request and generated 12 comments.
Show a summary per file
| File | Description |
|---|---|
| WORKFLOW_SYSTEM.md | Documents intended workflow automation coverage. |
| WORKFLOW_STATUS.md | Generated workflow status dashboard snapshot. |
| tests/test_ui.py | UI formatting and banner/menu output tests. |
| tests/test_security.py | SecurityChecker behavior tests. |
| tests/test_executor.py | CommandExecutor/SecurityChecker/TrainingDataLogger tests. |
| tests/test_config.py | Config get/set/load/save tests. |
| tests/conftest.py | Pytest fixtures for temp config files/dirs. |
| setup.py | Packaging metadata and install entrypoint. |
| SECURITY.md | Security policy document (currently template). |
| requirements.txt | Runtime dependencies (requests, genai, PyYAML, colorama). |
| README.md | Major README rewrite and workflow overview. |
| LICENSE | Adds MIT license text. |
| docs/USAGE.md | CLI usage and flags reference. |
| docs/TROUBLESHOOTING.md | Troubleshooting guide for setup/providers/security. |
| docs/PLUGINS.md | Plugin usage and authoring guide. |
| docs/EXAMPLES.md | Example/tutorial content for common workflows. |
| docs/CONFIGURATION.md | Detailed configuration reference. |
| docs/ARCHITECTURE.md | High-level architecture and data-flow documentation. |
| CONTRIBUTING.md | Contribution guidelines and dev workflow. |
| config.yaml.example | Example runtime configuration file. |
| CHANGELOG.md | Changelog scaffold and release guidelines. |
| ai_shell/ui.py | Terminal colors, banner, and UI helpers. |
| ai_shell/plugins/wapiti.py | Wapiti assistant plugin definition. |
| ai_shell/plugins/trivy.py | Trivy assistant plugin definition. |
| ai_shell/plugins/terraform.py | Terraform/OpenTofu assistant plugin definition. |
| ai_shell/plugins/systemd.py | systemd assistant plugin definition. |
| ai_shell/plugins/pulumi.py | Pulumi assistant plugin definition. |
| ai_shell/plugins/postgres.py | Postgres/psql assistant plugin definition. |
| ai_shell/plugins/podman.py | Podman assistant plugin definition. |
| ai_shell/plugins/nmap.py | Nmap assistant plugin definition. |
| ai_shell/plugins/network.py | Network diagnostics assistant plugin definition. |
| ai_shell/plugins/metasploit.py | Metasploit assistant plugin definition. |
| ai_shell/plugins/kubectl.py | Kubernetes assistant plugin definition. |
| ai_shell/plugins/helm.py | Helm assistant plugin definition. |
| ai_shell/plugins/git.py | Git assistant plugin definition. |
| ai_shell/plugins/docker.py | Docker assistant plugin definition. |
| ai_shell/plugins/base.py | Plugin base types + registry + discovery. |
| ai_shell/plugins/aws.py | AWS CLI assistant plugin definition. |
| ai_shell/plugins/ansible.py | Ansible assistant plugin definition. |
| ai_shell/plugins/init.py | Plugin package exports + auto-discovery trigger. |
| ai_shell/main.py | CLI entrypoint, mode/provider selection, PTY loops. |
| ai_shell/llm.py | Gemini + Ollama providers and prompt utilities. |
| ai_shell/executor.py | Command validation, confirmation, execution, training logging. |
| ai_shell/config.py | YAML/env/default configuration management. |
| ai_shell/init.py | Package metadata and __version__. |
| .gitignore | Python/build/log/test artifact ignores. |
| .github/workflows/status.yml | Workflow that regenerates WORKFLOW_STATUS.md. |
| .github/workflows/security.yml | CodeQL + dependency + secrets + license checks. |
| .github/workflows/release.yml | Tag-driven validation/release/PyPI publish workflow. |
| .github/workflows/performance.yml | Benchmarks + resource monitoring workflow. |
| .github/workflows/documentation.yml | Markdown/link validation + MkDocs build + Pages deploy. |
| .github/workflows/deployment-assets.yml | Build dist assets and attach to GitHub Releases. |
| .github/workflows/ci.yml | Matrix CI for tests/lint/format/coverage + install check. |
| .github/workflows/auto-label.yml | Issue/PR auto-labeling based on content/changed files. |
| .github/pull_request_template.md | PR checklist/template. |
| .github/ISSUE_TEMPLATE/security.md | Security issue template (private reporting guidance). |
| .github/ISSUE_TEMPLATE/feature_request.md | Feature request issue template. |
| .github/ISSUE_TEMPLATE/config.yml | Issue template chooser + contact links. |
| .github/ISSUE_TEMPLATE/bug_report.md | Bug report issue template. |
| .github/dependabot.yml | Dependabot updates for pip + GitHub Actions. |
Suppressed comments (2)
.github/workflows/release.yml:121
actions/upload-release-assetexpects a single file path;asset_path: dist/is a directory and will fail. Using a release action that supports globs (e.g.,softprops/action-gh-release) is the simplest way to upload all built artifacts.
- name: Upload Release Assets
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: dist/
asset_name: ai-shell-${{ steps.changelog.outputs.current_tag }}-py3-none-any.whl
asset_content_type: application/zip
README.md:331
- The README opens a fenced code block for an example but never closes it, which will break Markdown rendering and can cause the docs workflow’s markdown validation/link checks to fail. Consider switching this to an indented code block (or fully close the fence).
**⚠️ Disclaimer**: AI Shell executes system commands. Always review commands before execution and use appropriate security measures. The developers are not responsible for any damage caused by misuse of this tool.
```bash
You: ? search for exploits related to the log4j vulnerability
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| name: str = "" # human name shown in menus | ||
| description: str = "" # one-line description | ||
| system_prompt: str = "" # LLM system prompt for this tool | ||
| start_command: List[str] = field(default_factory=lambda: ["bash"]) # command to exec in PTY |
Comment on lines
+102
to
+104
| - name: Create GitHub Release | ||
| uses: actions/create-release@v1 | ||
| env: |
Comment on lines
+113
to
+125
| - name: Validate code examples in docs | ||
| run: | | ||
| python -c " | ||
| import re, ast, glob | ||
| for f in glob.glob('**/*.md', recursive=True): | ||
| if '/.git/' not in f and '/node_modules/' not in f: | ||
| with open(f) as file: content = file.read() | ||
| blocks = re.findall(r'```python\n(.*?)\n```', content, re.DOTALL) | ||
| for i, block in enumerate(blocks): | ||
| if any(x in block for x in ['import', 'def ', 'class ']): | ||
| try: ast.parse(block); print(f'✅ Code block {i+1} in {f} OK') | ||
| except SyntaxError as e: print(f'❌ Syntax error in {f}: {e}') | ||
| " |
Comment on lines
+279
to
+281
| config.set("llm.local.host", host) | ||
| config.set("llm.local.port", int(port)) | ||
| config.set("llm.local.model", selected_model["name"]) |
Comment on lines
+16
to
+20
| ## How to Report | ||
|
|
||
| 1. **Email**: Send details to [maintainer@example.com] (replace with actual email) | ||
| 2. **Include**: | ||
| - Description of the vulnerability |
Comment on lines
+43
to
+51
| def print_banner(): | ||
| """Print the application banner.""" | ||
| banner = f""" | ||
| {colors.SUCCESS}╔══════════════════════════════════════════════════════════════╗ | ||
| ║ AI-Powered Shell Assistant ║ | ||
| ║ Your Command-Line Copilot v0.1.0 ║ | ||
| ╚══════════════════════════════════════════════════════════════╝{colors.RESET} | ||
| """ | ||
| print(banner) |
Comment on lines
+68
to
+75
| def test_print_banner(self): | ||
| """Test banner printing.""" | ||
| with patch("sys.stdout", new_callable=io.StringIO) as mock_stdout: | ||
| print_banner() | ||
| output = mock_stdout.getvalue() | ||
| assert "AI-Powered Shell Assistant" in output | ||
| assert "v0.1.0" in output | ||
|
|
Comment on lines
+1
to
+5
| name: Security | ||
|
|
||
| on: | ||
| push: | ||
| branches: [ main, master ] |
Comment on lines
+64
to
+83
| ```bash | ||
| # Start Metasploit mode | ||
| Assistant: I can help you find SMB vulnerabilities. Try this search command: | ||
|
|
||
| ```bash | ||
| search type:exploit platform:windows service:smb | ||
| ``` | ||
|
|
||
| Assistant: To set up a listener for a reverse shell, use the multi/handler module: | ||
|
|
||
| ```bash | ||
| use exploit/multi/handler | ||
| set PAYLOAD windows/meterpreter/reverse_tcp | ||
| set LHOST your_ip_address | ||
| set LPORT 4444 | ||
| run | ||
| ``` | ||
|
|
||
| This creates a listener on port 4444 that will catch reverse connections. | ||
| ``` |
Comment on lines
+122
to
+125
| # Merge with defaults | ||
| default_config = self._get_default_config() | ||
| default_config.update(config) | ||
| return default_config |
…86-396229e87405 Copilot/fix 8c034b60 de28 48d7 9c86 396229e87405
…tation docs: comprehensive documentation update - fix examples, accuracy, an…
| from typing import Optional, Dict, Any | ||
|
|
||
| from .config import get_config | ||
| from .ui import format_info, format_error |
| self.training_logger.log_training_pair(user_prompt, command, "positive") | ||
| elif feedback == "n": | ||
| self.training_logger.log_training_pair(user_prompt, command, "negative") | ||
| except (KeyboardInterrupt, EOFError): |
| ) | ||
| else: | ||
| print(format_error(f"Correction rejected: {warning}")) | ||
| except (KeyboardInterrupt, EOFError): |
| import logging | ||
| import os | ||
| import pty | ||
| import select |
Comment on lines
+47
to
+55
| from .llm import ( | ||
| get_llm_provider, | ||
| GeminiProvider, | ||
| LocalLLMProvider, | ||
| ASSISTANT_SYSTEM_PROMPT, | ||
| METASPLOIT_SYSTEM_PROMPT, | ||
| WAPITI_SYSTEM_PROMPT, | ||
| extract_command_from_response, | ||
| ) |
|
|
||
| import tempfile | ||
| import json | ||
| import subprocess |
| import tempfile | ||
| import json | ||
| import subprocess | ||
| from pathlib import Path |
| @@ -0,0 +1,222 @@ | |||
| """Security validation tests for AI Shell.""" | |||
|
|
|||
| import pytest | |||
| """Tests for AI Shell UI module.""" | ||
|
|
||
| import io | ||
| import sys |
| with patch("ai_shell.ui.COLORAMA_AVAILABLE", False): | ||
| # Re-import to get fallback behavior | ||
| import importlib | ||
| import ai_shell.ui |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces a comprehensive set of improvements to the project's GitHub repository automation, issue, and pull request management. The main changes include the addition of GitHub Actions workflows for CI, deployment, and auto-labeling, new issue and pull request templates for better reporting and triage, and configuration for Dependabot and community support links. These enhancements are designed to streamline contributions, improve code quality, and ensure consistent maintenance.
Automation and CI/CD:
.github/workflows/ci.yml) that runs tests, linting, formatting checks, and uploads coverage reports across multiple OS and Python versions..github/workflows/deployment-assets.yml) to build and upload Python distribution assets and automatically attach them to GitHub releases on tag pushes..github/workflows/auto-label.yml) to automatically assign labels to issues and pull requests based on content and file changes.Issue and PR Templates:
.github/ISSUE_TEMPLATE/bug_report.md,feature_request.md,security.md). [1] [2] [3].github/pull_request_template.md) to guide contributors in documenting, testing, and reviewing their changes.Dependency Management and Community Support:
.github/dependabot.yml) for automated dependency and GitHub Actions updates..github/ISSUE_TEMPLATE/config.yml).These changes collectively enhance the project's maintainability, security, and contributor experience.