|
| 1 | +# github2stackfield |
| 2 | + |
| 3 | +**github2stackfield** is an x0 web application that bridges **GitHub Issues** with **Stackfield Tasks**. |
| 4 | +It lets you search GitHub issues, inspect their details, and create corresponding Stackfield tasks — all from a clean, Bootstrap-styled browser frontend. |
| 5 | + |
| 6 | +--- |
| 7 | + |
| 8 | +## Architecture |
| 9 | + |
| 10 | +| Layer | Technology | |
| 11 | +|---|---| |
| 12 | +| Browser frontend | [x0 JavaScript framework](https://github.com/WEBcodeX1/x0) with Bootstrap default theme | |
| 13 | +| Backend services | Python WSGI scripts via [python-micro-esb](https://github.com/clauspruefer/python-micro-esb) | |
| 14 | +| Database | PostgreSQL (shared x0 instance) | |
| 15 | +| Deployment | Apache2 + mod_wsgi (Docker or bare-metal) | |
| 16 | + |
| 17 | +--- |
| 18 | + |
| 19 | +## Screens |
| 20 | + |
| 21 | +### Screen 1 — User Credentials |
| 22 | +Configure and verify API access for both platforms. |
| 23 | + |
| 24 | +- **GitHub API Credentials** — enter your GitHub username and Personal Access Token. |
| 25 | + Click *Verify GitHub Credentials* to validate and store them. |
| 26 | +- **Stackfield API Credentials** — enter your Stackfield e-mail and API token. |
| 27 | + Click *Verify Stackfield Credentials* to validate and store them. |
| 28 | + |
| 29 | +### Screen 2 — Issue / Task Mapping |
| 30 | +Search GitHub issues and select one to map to Stackfield. |
| 31 | + |
| 32 | +1. Enter the target repository (`owner/repository`) and an optional search term. |
| 33 | +2. Click **Search Issues** — results populate the issue list below. |
| 34 | +3. Right-click any row and select **Connect Stackfield Task** to navigate to Screen 3. |
| 35 | + |
| 36 | +### Screen 3 — Connect Stackfield Task |
| 37 | +Review the selected GitHub issue and create a Stackfield task. |
| 38 | + |
| 39 | +- **GitHub Issue Properties** — read-only fields: issue number, state, title, URL. |
| 40 | +- **Stackfield Task Mapping** — editable fields pre-populated from the issue: |
| 41 | + - *Stackfield Room ID* — the target Stackfield room / channel identifier. |
| 42 | + - *Task Title* — editable, defaults to the GitHub issue title. |
| 43 | + - *Description* — editable, defaults to the GitHub issue body. |
| 44 | + - *Priority* — Low / Medium / High / Urgent. |
| 45 | +- Click **Create New Stackfield Task** — a new task is created in Stackfield via the REST API. |
| 46 | + |
| 47 | +--- |
| 48 | + |
| 49 | +## Prerequisites |
| 50 | + |
| 51 | +| Requirement | Notes | |
| 52 | +|---|---| |
| 53 | +| Docker Engine | With Compose V2 (`docker compose`) | |
| 54 | +| GitHub Personal Access Token | Needs `repo` scope for private repos, `public_repo` for public | |
| 55 | +| Stackfield API token | See Stackfield workspace settings → Integrations → API | |
| 56 | + |
| 57 | +--- |
| 58 | + |
| 59 | +## Docker (quick start) |
| 60 | + |
| 61 | +The application uses the official x0 container images: |
| 62 | + |
| 63 | +- **`ghcr.io/webcodex1/x0-app`** — Apache2 + mod_wsgi web application server with the x0 JavaScript framework pre-installed ([packages page](https://github.com/WEBcodeX1/x0/pkgs/container/x0-app)) |
| 64 | +- **`ghcr.io/webcodex1/x0-db`** — PostgreSQL 16 database with the x0 schema pre-installed ([packages page](https://github.com/WEBcodeX1/x0/pkgs/container/x0-db)) |
| 65 | + |
| 66 | +Both custom images are built automatically on `docker compose up --build`: |
| 67 | + |
| 68 | +- `docker/Dockerfile` extends `ghcr.io/webcodex1/x0-app` and copies all static files, Python WSGI scripts, and the Apache2 config snippet into the image. |
| 69 | +- `docker/Dockerfile.db` extends `ghcr.io/webcodex1/x0-db` and runs the github2stackfield SQL init scripts (`database/0*.sql`) against the x0 database on first start. |
| 70 | + |
| 71 | +```bash |
| 72 | +cd docker |
| 73 | +docker compose up --build |
| 74 | +``` |
| 75 | + |
| 76 | +Then open [http://localhost:8080/?appid=github2sf](http://localhost:8080/?appid=github2sf). |
| 77 | + |
| 78 | +No further manual configuration is required. |
| 79 | + |
| 80 | +--- |
| 81 | + |
| 82 | +## Project structure |
| 83 | + |
| 84 | +``` |
| 85 | +github2stackfield/ |
| 86 | +├── static/ |
| 87 | +│ ├── menu.json # x0 navigation menu definition |
| 88 | +│ ├── object.json # x0 UI objects (formfields, lists, buttons …) |
| 89 | +│ └── skeleton.json # x0 screen layout |
| 90 | +├── python/ |
| 91 | +│ ├── service_implementation.py # GitHubService + StackfieldService ClassHandlers |
| 92 | +│ ├── user_routing.py # python-micro-esb ServiceRouter routing functions |
| 93 | +│ ├── VerifyGitHubCredentials.py # WSGI – verify GitHub credentials |
| 94 | +│ ├── VerifyStackfieldCredentials.py # WSGI – verify Stackfield credentials |
| 95 | +│ ├── SearchGitHubIssues.py # WSGI – search issues, populate list |
| 96 | +│ ├── GetGitHubIssueDetails.py # WSGI – fetch issue details for Screen 3 |
| 97 | +│ ├── CreateStackfieldTask.py # WSGI – create Stackfield task |
| 98 | +│ ├── POSTData.py # x0 POST body reader helper |
| 99 | +│ └── StdoutLogger.py # logging helper |
| 100 | +├── database/ |
| 101 | +│ ├── 01-create-schema.sql # github2sf schema + tables |
| 102 | +│ ├── 02-insert-config.sql # x0 app configuration rows |
| 103 | +│ └── 03-insert-text.sql # UI text / i18n entries |
| 104 | +├── docker/ |
| 105 | +│ ├── Dockerfile # extends x0-app, bakes in static/ python/ apache2.conf |
| 106 | +│ ├── Dockerfile.db # extends x0-db, auto-inits github2sf schema on startup |
| 107 | +│ ├── docker-compose.yml |
| 108 | +│ ├── db-init.sh # startup script used by Dockerfile.db |
| 109 | +│ └── apache2.conf |
| 110 | +└── README.md |
| 111 | +``` |
| 112 | + |
| 113 | +--- |
| 114 | + |
| 115 | +## python-micro-esb integration |
| 116 | + |
| 117 | +The backend services are built on the [python-micro-esb](https://github.com/clauspruefer/python-micro-esb) framework: |
| 118 | + |
| 119 | +- **`service_implementation.py`** — contains `GitHubService` and `StackfieldService`, both subclassing `microesb.ClassHandler`. Each class exposes service methods (`verify`, `search_issues`, `get_issue_details`, `create_task`). |
| 120 | +- **`user_routing.py`** — routing functions consumed by `ServiceRouter.send()`. Each function instantiates the appropriate service class, calls the relevant method, and returns the result. |
| 121 | +- **WSGI scripts** — thin wrappers that read the x0 POST payload, call `ServiceRouter.send()`, and return JSON to the x0 frontend. |
| 122 | + |
| 123 | +--- |
| 124 | + |
| 125 | +## Stackfield API notes |
| 126 | + |
| 127 | +Stackfield's REST API is available at `https://www.stackfield.com/api/v1/`. |
| 128 | +Key endpoints used: |
| 129 | + |
| 130 | +| Endpoint | Purpose | |
| 131 | +|---|---| |
| 132 | +| `GET /v1/user` | Verify credentials | |
| 133 | +| `POST /v1/rooms/{room_id}/tasks` | Create a new task | |
| 134 | + |
| 135 | +The **Room ID** can be found in Stackfield under *Room settings → General → Room ID* or via the URL slug. |
| 136 | + |
| 137 | +--- |
| 138 | + |
| 139 | +## License |
| 140 | + |
| 141 | +See [LICENSE](LICENSE). |
0 commit comments