A fast, keyboard-driven TUI API client & webhook inspector. No cloud, no Electron, 100% local-first.
test(ci): add automated test suites and GitHub issue templates
4yk5043f7156ab0d
diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.ymlnew file mode 100644index 0000000..bd64a69--- /dev/null+++ b/.github/ISSUE_TEMPLATE/bug_report.yml@@ -0,0 +1,46 @@+name: Bug Report π+description: Create a report to help us improve Ghostman+title: "[BUG] "+labels: ["bug"]+body:+ - type: markdown+ attributes:+ value: |+ Thanks for taking the time to report an issue! Please provide as much context as possible.+ - type: textarea+ id: description+ attributes:+ label: Describe the Bug+ description: A clear and concise description of what the bug is.+ placeholder: What went wrong?+ validations:+ required: true+ - type: textarea+ id: reproduction+ attributes:+ label: Steps to Reproduce+ description: How can we reproduce this behavior?+ placeholder: |+ 1. Open Ghostman+ 2. Set method to 'POST'+ 3. Click '...'+ 4. See error+ validations:+ required: true+ - type: dropdown+ id: os+ attributes:+ label: Operating System+ options:+ - Windows+ - macOS+ - Linux+ validations:+ required: true+ - type: input+ id: python-version+ attributes:+ label: Python Version+ placeholder: "e.g. Python 3.11.4"+ validations:+ required: falsediff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.ymlnew file mode 100644index 0000000..60f9dc0--- /dev/null+++ b/.github/ISSUE_TEMPLATE/feature_request.yml@@ -0,0 +1,32 @@+name: Feature Request π‘+description: Suggest an idea or enhancement for Ghostman+title: "[FEATURE] "+labels: ["enhancement"]+body:+ - type: markdown+ attributes:+ value: |+ Have an idea to make Ghostman even better? We'd love to hear it!+ - type: textarea+ id: problem+ attributes:+ label: Problem Statement+ description: Is your feature request related to a problem or limitation?+ placeholder: "I'm always frustrated when..."+ validations:+ required: false+ - type: textarea+ id: solution+ attributes:+ label: Proposed Solution+ description: Describe the solution you'd like to see implemented.+ placeholder: "It would be great if Ghostman could..."+ validations:+ required: true+ - type: textarea+ id: alternatives+ attributes:+ label: Alternatives Considered+ description: Any alternative solutions or features you've considered?+ validations:+ required: falsediff --git a/.github/workflows/tests.yml b/.github/workflows/tests.ymlnew file mode 100644index 0000000..4c30fb3--- /dev/null+++ b/.github/workflows/tests.yml@@ -0,0 +1,34 @@+name: CI Tests++on:+ push:+ branches: [ main ]+ pull_request:+ branches: [ main ]++jobs:+ test:+ runs-on: ${{ matrix.os }}+ strategy:+ fail-fast: false+ matrix:+ os: [ubuntu-latest, windows-latest, macos-latest]+ python-version: ["3.10", "3.11", "3.12"]++ steps:+ - uses: actions/checkout@v4++ - name: Set up Python ${{ matrix.python-version }}+ uses: actions/setup-python@v5+ with:+ python-version: ${{ matrix.python-version }}+ cache: 'pip'++ - name: Install dependencies+ run: |+ python -m pip install --upgrade pip+ pip install -r requirements.txt++ - name: Run Test Suite+ run: |+ python tests/test_all.pydiff --git a/CONTRIBUTING.md b/CONTRIBUTING.mdnew file mode 100644index 0000000..aade7b1--- /dev/null+++ b/CONTRIBUTING.md@@ -0,0 +1,59 @@+# Contributing to Ghostman π»++Thank you for your interest in contributing to Ghostman! We welcome contributions, bug reports, and ideas from everyone.++---++## π οΈ Development Setup++1. **Fork and Clone the repository:**+ ```bash+ git clone https://github.com/4yk5/Ghostman.git+ cd Ghostman+ ```++2. **Create a virtual environment (optional but recommended):**+ ```bash+ python -m venv venv+ # On Windows:+ venv\Scripts\activate+ # On macOS/Linux:+ source venv/bin/activate+ ```++3. **Install dependencies:**+ ```bash+ pip install -r requirements.txt+ ```++4. **Run Ghostman locally:**+ ```bash+ python main.py+ ```++---++## π§ͺ Running Tests++Before submitting a Pull Request, always make sure all tests pass cleanly:++```bash+python tests/test_all.py+```++---++## π‘ How to Contribute++- **Report Bugs:** Open an issue using our [Bug Report Template](https://github.com/4yk5/Ghostman/issues/new?template=bug_report.yml).+- **Suggest Features:** Have an idea? Submit a [Feature Request](https://github.com/4yk5/Ghostman/issues/new?template=feature_request.yml).+- **Submit Pull Requests:**+ 1. Fork the repo and create your branch from `main` (`git checkout -b feature/awesome-feature`).+ 2. Keep code clean, readable, and follow the existing TUI architecture.+ 3. Ensure all tests pass.+ 4. Submit your Pull Request with a clear description of the changes!++---++## π License+By contributing to Ghostman, you agree that your contributions will be licensed under the [MIT License](LICENSE).diff --git a/SECURITY.md b/SECURITY.mdnew file mode 100644index 0000000..f94e4a4--- /dev/null+++ b/SECURITY.md@@ -0,0 +1,19 @@+# Security Policy++## Supported Versions++| Version | Supported |+| ------- | ------------------ |+| 0.1.x | :white_check_mark: |++---++## Reporting a Vulnerability++Security is paramount for local-first developer tools. If you discover a security vulnerability within Ghostman:++1. **Do not disclose publicly** in an open issue.+2. Please report security issues privately via GitHub Security Advisories or reach out directly to the maintainer.+3. Include detailed steps to reproduce the vulnerability.++We take all security reports seriously and will investigate, patch, and release a fix promptly.diff --git a/tests/test_all.py b/tests/test_all.pynew file mode 100644index 0000000..6edd029--- /dev/null+++ b/tests/test_all.py@@ -0,0 +1,90 @@+import asyncio+import os+import sys+import httpx++sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))++if sys.platform == "win32":+ try:+ sys.stdout.reconfigure(encoding="utf-8")+ sys.stderr.reconfigure(encoding="utf-8")+ except Exception:+ pass++from app import GhostmanApp+from network import NetworkEngine+from webhook_server import WebhookServer+from storage import StorageManager+from textual.widgets import Input, TextArea, Select, ListView, Tabs++async def run_tests():+ print("Running Ghostman test suite...")++ # Storage+ sm = StorageManager()+ cols = sm.load_collections()+ assert len(cols) > 0, "Collections failed to initialize"+ print(" [+] Storage: OK")++ # Network engine+ net = NetworkEngine()+ r = await net.execute_request("GET", "https://jsonplaceholder.typicode.com/posts/1")+ assert r["success"] and r["status_code"] == 200, "Network GET failed"++ r_post = await net.execute_request("POST", "https://jsonplaceholder.typicode.com/posts", body='{"test": 1}')+ assert r_post["success"], "Network POST failed"++ r_fail = await net.execute_request("GET", "invalid-target")+ assert not r_fail["success"], "Error handling check failed"+ print(" [+] Network Engine: OK")++ # Webhook server+ received = []+ ws = WebhookServer(port=9098, on_hook_received=lambda h: received.append(h))+ await ws.start()++ async with httpx.AsyncClient() as c:+ resp = await c.post("http://127.0.0.1:9098/test", json={"ping": "pong"})+ assert resp.status_code == 200++ await asyncio.sleep(0.1)+ assert len(received) == 1 and received[0]["path"] == "/test"+ await ws.stop()+ print(" [+] Webhook Server: OK")++ # TUI Interactions+ app = GhostmanApp()+ async with app.run_test() as pilot:+ # Save request integrity+ save_btn = app.query_one("#save-btn")+ await pilot.click(save_btn)+ await pilot.pause(0.2)+ await pilot.click(save_btn)+ await pilot.pause(0.2)++ # New request action+ new_btn = app.query_one("#new-req-btn")+ await pilot.click(new_btn)+ await pilot.pause(0.1)+ assert app.query_one("#url-input", Input).value == ""++ # Execute request+ app.query_one("#url-input", Input).value = "https://jsonplaceholder.typicode.com/posts/1"+ await pilot.press("ctrl+s")+ await pilot.pause(1.0)+ assert app.query_one("#tab-response-pane").display++ # Webhook toggle via hotkey+ await pilot.press("ctrl+w")+ await pilot.pause(0.2)+ assert app.webhook_server.is_running+ await pilot.press("ctrl+w")+ await pilot.pause(0.2)+ assert not app.webhook_server.is_running+ print(" [+] TUI Interactions: OK")++ print("\nAll tests passed successfully.")++if __name__ == "__main__":+ asyncio.run(run_tests())