django-dev-tickets 0.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- django_dev_tickets-0.2.0/.gitignore +14 -0
- django_dev_tickets-0.2.0/LICENSE +21 -0
- django_dev_tickets-0.2.0/PKG-INFO +644 -0
- django_dev_tickets-0.2.0/README.md +620 -0
- django_dev_tickets-0.2.0/pyproject.toml +51 -0
- django_dev_tickets-0.2.0/schema.graphql +187 -0
- django_dev_tickets-0.2.0/src/dev_tickets/__init__.py +3 -0
- django_dev_tickets-0.2.0/src/dev_tickets/actor.py +67 -0
- django_dev_tickets-0.2.0/src/dev_tickets/apps.py +23 -0
- django_dev_tickets-0.2.0/src/dev_tickets/client.py +294 -0
- django_dev_tickets-0.2.0/src/dev_tickets/conf.py +168 -0
- django_dev_tickets-0.2.0/src/dev_tickets/defaults.py +24 -0
- django_dev_tickets-0.2.0/src/dev_tickets/digest.py +125 -0
- django_dev_tickets-0.2.0/src/dev_tickets/endpoints.py +33 -0
- django_dev_tickets-0.2.0/src/dev_tickets/hub.py +136 -0
- django_dev_tickets-0.2.0/src/dev_tickets/lanes.py +128 -0
- django_dev_tickets-0.2.0/src/dev_tickets/management/__init__.py +0 -0
- django_dev_tickets-0.2.0/src/dev_tickets/management/commands/__init__.py +0 -0
- django_dev_tickets-0.2.0/src/dev_tickets/management/commands/devtickets_client.py +86 -0
- django_dev_tickets-0.2.0/src/dev_tickets/management/commands/devtickets_notify.py +17 -0
- django_dev_tickets-0.2.0/src/dev_tickets/mcp.py +410 -0
- django_dev_tickets-0.2.0/src/dev_tickets/migrations/0001_initial.py +195 -0
- django_dev_tickets-0.2.0/src/dev_tickets/migrations/0002_seed_labels.py +16 -0
- django_dev_tickets-0.2.0/src/dev_tickets/migrations/0003_lanes_and_settings.py +81 -0
- django_dev_tickets-0.2.0/src/dev_tickets/migrations/__init__.py +0 -0
- django_dev_tickets-0.2.0/src/dev_tickets/models.py +366 -0
- django_dev_tickets-0.2.0/src/dev_tickets/mutations.py +233 -0
- django_dev_tickets-0.2.0/src/dev_tickets/notify.py +153 -0
- django_dev_tickets-0.2.0/src/dev_tickets/people.py +170 -0
- django_dev_tickets-0.2.0/src/dev_tickets/permissions.py +37 -0
- django_dev_tickets-0.2.0/src/dev_tickets/queries.py +148 -0
- django_dev_tickets-0.2.0/src/dev_tickets/schema.py +14 -0
- django_dev_tickets-0.2.0/src/dev_tickets/service.py +436 -0
- django_dev_tickets-0.2.0/src/dev_tickets/settings_views.py +207 -0
- django_dev_tickets-0.2.0/src/dev_tickets/states.py +157 -0
- django_dev_tickets-0.2.0/src/dev_tickets/templates/dev_tickets/email/digest.html +88 -0
- django_dev_tickets-0.2.0/src/dev_tickets/templates/dev_tickets/email/digest.txt +20 -0
- django_dev_tickets-0.2.0/src/dev_tickets/titles.py +43 -0
- django_dev_tickets-0.2.0/src/dev_tickets/types.py +360 -0
- django_dev_tickets-0.2.0/src/dev_tickets/urls.py +35 -0
- django_dev_tickets-0.2.0/src/dev_tickets/views.py +65 -0
- django_dev_tickets-0.2.0/tests/__init__.py +0 -0
- django_dev_tickets-0.2.0/tests/conftest.py +70 -0
- django_dev_tickets-0.2.0/tests/hubtools.py +82 -0
- django_dev_tickets-0.2.0/tests/settings.py +44 -0
- django_dev_tickets-0.2.0/tests/test_client.py +154 -0
- django_dev_tickets-0.2.0/tests/test_client_command.py +41 -0
- django_dev_tickets-0.2.0/tests/test_hooks.py +142 -0
- django_dev_tickets-0.2.0/tests/test_hub.py +158 -0
- django_dev_tickets-0.2.0/tests/test_mcp.py +89 -0
- django_dev_tickets-0.2.0/tests/test_mcp_import.py +9 -0
- django_dev_tickets-0.2.0/tests/test_people.py +54 -0
- django_dev_tickets-0.2.0/tests/test_settings.py +179 -0
- django_dev_tickets-0.2.0/tests/test_tickets.py +344 -0
- django_dev_tickets-0.2.0/tests/urls.py +3 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 unluckynelson
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,644 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: django-dev-tickets
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: An issue tracker that lives inside your Django app: a kanban board, a report widget and notifications.
|
|
5
|
+
Project-URL: Homepage, https://github.com/unluckynelson/dev-tickets
|
|
6
|
+
Author: unluckynelson
|
|
7
|
+
License-Expression: MIT
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Classifier: Framework :: Django
|
|
10
|
+
Classifier: Framework :: Django :: 5.1
|
|
11
|
+
Classifier: Operating System :: OS Independent
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Requires-Python: >=3.10
|
|
14
|
+
Requires-Dist: django>=5.1
|
|
15
|
+
Requires-Dist: markdown>=3.7
|
|
16
|
+
Requires-Dist: nh3>=0.2.18
|
|
17
|
+
Requires-Dist: strawberry-graphql>=0.240
|
|
18
|
+
Provides-Extra: dev
|
|
19
|
+
Requires-Dist: pytest-django>=4.9; extra == 'dev'
|
|
20
|
+
Requires-Dist: pytest>=8; extra == 'dev'
|
|
21
|
+
Requires-Dist: ruff>=0.6; extra == 'dev'
|
|
22
|
+
Provides-Extra: mcp
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
|
|
25
|
+
<div align="center">
|
|
26
|
+
|
|
27
|
+
# Dev Tickets
|
|
28
|
+
|
|
29
|
+
**An issue tracker that lives inside your app.**
|
|
30
|
+
Your team reports a bug from the page it happened on, and it lands on a kanban board in the same app.
|
|
31
|
+
|
|
32
|
+
A Django app and a Nuxt layer · one versioned release for both
|
|
33
|
+
|
|
34
|
+

|
|
35
|
+
|
|
36
|
+
</div>
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
> **Status: 0.x, pre-release.** Dev Tickets runs in production inside
|
|
41
|
+
> [AutoRoster](https://autoroster.co.za), where it replaced Linear in November 2026, and is
|
|
42
|
+
> now extracted here. Standalone, hub and client modes all work and run together in the
|
|
43
|
+
> [playground](#development). Nothing is on PyPI or npm until `v1.0.0`; until then,
|
|
44
|
+
> settings and names may still change.
|
|
45
|
+
|
|
46
|
+
## Why
|
|
47
|
+
|
|
48
|
+
External trackers have two costs that add up. First, every tester needs a paid seat,
|
|
49
|
+
so reports end up filed by one shared account and nobody can tell who reported what.
|
|
50
|
+
Second, a report written outside the app loses where it came from: which page, which
|
|
51
|
+
customer, and what was on the screen.
|
|
52
|
+
|
|
53
|
+
Dev Tickets stays inside the app:
|
|
54
|
+
|
|
55
|
+
- **Report from where you are.** A floating button on every page opens a short form. The
|
|
56
|
+
page URL and the customer you are working in are attached automatically. Paste a
|
|
57
|
+
screenshot, or draw on the live page and attach that.
|
|
58
|
+
- **Everyone is a real person.** The reporter, assignee and commenters are your app's own
|
|
59
|
+
users, so the person who reported a bug is the one told when it is fixed.
|
|
60
|
+
- **No seats and no sync.** The tickets are rows in your own database, or in one hub that
|
|
61
|
+
all your environments share (see below).
|
|
62
|
+
|
|
63
|
+
## Features
|
|
64
|
+
|
|
65
|
+
| Feature | What it does |
|
|
66
|
+
| --- | --- |
|
|
67
|
+
| **Kanban board** | Triage → Backlog → Todo → In Progress → Done out of the box; Canceled and Duplicate sit off the board. Drag cards between lanes. Search, filter by reporter / assignee / priority / label, and choose the sort order. |
|
|
68
|
+
| **Settings on the board** | A gear in the board's corner: add, rename, retype, reorder and remove lanes; edit labels; switch your email on or off; and set this install up as standalone, hub or client, including the hub's keys. See [Settings](#settings). |
|
|
69
|
+
| **Deep links** | The open ticket is part of the URL (`/admin/dev-tickets/APP-12`), so a link pastes straight into chat. |
|
|
70
|
+
| **Report widget** | A floating button on every page. Records the page URL and the context you were working in, and takes pasted screenshots and files. |
|
|
71
|
+
| **Highlight on page** | Draw arrows, boxes, circles or freehand on the live page. A screenshot of the marked-up page is attached to the ticket. |
|
|
72
|
+
| **AI titles (optional)** | Write a description and the title is written for you. Plug in any model; without one, the first words of the description become the title. |
|
|
73
|
+
| **Markdown everywhere** | Descriptions and comments use a formatting toolbar, and are rendered and sanitised on the server. |
|
|
74
|
+
| **Links between tickets** | *related*, *blocks* / *blocked by*, *duplicate of*. |
|
|
75
|
+
| **Full history** | Every change is recorded as an event: state, priority, assignee, labels, title, description, comments. |
|
|
76
|
+
| **Notifications** | A bell in your header. Reporter, assignee and commenters follow a ticket automatically, and anyone can follow or unfollow. Each person can switch email on or off. |
|
|
77
|
+
| **Email digest** | Anything still unread after 2 minutes goes out as one email, so someone with the app open gets no mail at all. A run of changes arrives as one message, not ten. |
|
|
78
|
+
| **Attachments** | Images and PDFs open inline; anything else downloads, so an uploaded HTML or SVG file can never run script on your domain. Up to 15 MB each. |
|
|
79
|
+
| **AI assistant tools (MCP)** | `tickets_list`, `tickets_get`, `tickets_create`, `tickets_update`, `tickets_comment`, `tickets_link`, `tickets_unlink`, `tickets_team`. Claude, ChatGPT and other assistants can triage and update tickets. |
|
|
80
|
+
| **Shared across environments** | Run one *hub*, and dev, staging and production all file into the same board over an API (see [One board for every environment](#one-board-for-every-environment)). |
|
|
81
|
+
|
|
82
|
+
## Screenshots
|
|
83
|
+
|
|
84
|
+
<table>
|
|
85
|
+
<tr>
|
|
86
|
+
<td width="60%"><img src="https://raw.githubusercontent.com/unluckynelson/dev-tickets/v0.2.0/docs/screenshots/ticket.png" alt="A ticket"><br><sub>A ticket: status, priority, assignee and labels edited in place. The reporter, page and context come from the widget.</sub></td>
|
|
87
|
+
<td width="40%"><img src="https://raw.githubusercontent.com/unluckynelson/dev-tickets/v0.2.0/docs/screenshots/widget.png" alt="The report widget"><br><sub>The report widget: just a description. The page is attached and the title is written for you.</sub><br><br><img src="https://raw.githubusercontent.com/unluckynelson/dev-tickets/v0.2.0/docs/screenshots/notifications.png" alt="Notifications"><br><sub>The bell: what changed on tickets you follow.</sub></td>
|
|
88
|
+
</tr>
|
|
89
|
+
<tr>
|
|
90
|
+
<td colspan="2"><img src="https://raw.githubusercontent.com/unluckynelson/dev-tickets/v0.2.0/docs/screenshots/highlight.png" alt="Highlight on page"><br><sub>Highlight on page: mark the problem on the live page. A screenshot of it is attached to the ticket.</sub></td>
|
|
91
|
+
</tr>
|
|
92
|
+
</table>
|
|
93
|
+
|
|
94
|
+
## What's in the box
|
|
95
|
+
|
|
96
|
+
```
|
|
97
|
+
dev-tickets/
|
|
98
|
+
├── python/ django-dev-tickets → pip (import dev_tickets)
|
|
99
|
+
├── nuxt/ nuxt-dev-tickets → npm (a Nuxt layer)
|
|
100
|
+
├── playground/ a minimal Django + Nuxt app for development and screenshots
|
|
101
|
+
└── docs/
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Both packages are released together under one version number. `django-dev-tickets 1.4.2`
|
|
105
|
+
and `nuxt-dev-tickets 1.4.2` are always built to work together.
|
|
106
|
+
|
|
107
|
+
**Requirements:** Python 3.10+, Django 5.1+, Strawberry GraphQL 0.240+ · Node 22+,
|
|
108
|
+
Nuxt 4, PrimeVue 4.
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
## Quick start
|
|
113
|
+
|
|
114
|
+
### 1. Backend
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
pip install django-dev-tickets
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
```python
|
|
121
|
+
# settings.py
|
|
122
|
+
INSTALLED_APPS = [
|
|
123
|
+
# ...
|
|
124
|
+
"dev_tickets",
|
|
125
|
+
]
|
|
126
|
+
|
|
127
|
+
DEV_TICKETS = {
|
|
128
|
+
"PREFIX": "APP", # tickets are APP-1, APP-2, ...
|
|
129
|
+
"BOARD_URL": "https://app.example.com/admin/dev-tickets",
|
|
130
|
+
}
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
```python
|
|
134
|
+
# urls.py
|
|
135
|
+
from django.urls import include, path
|
|
136
|
+
|
|
137
|
+
urlpatterns = [
|
|
138
|
+
# ...
|
|
139
|
+
path("", include("dev_tickets.urls")), # /devtickets/graphql/ and /devtickets-files/
|
|
140
|
+
]
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
python manage.py migrate dev_tickets
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
Send the email digest once a minute, from cron, a systemd timer or Celery beat:
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
python manage.py devtickets_notify
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### 2. Frontend
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
npm install nuxt-dev-tickets
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
```ts
|
|
160
|
+
// nuxt.config.ts
|
|
161
|
+
export default defineNuxtConfig({
|
|
162
|
+
extends: ['nuxt-dev-tickets'],
|
|
163
|
+
runtimeConfig: {
|
|
164
|
+
public: {
|
|
165
|
+
devTickets: {
|
|
166
|
+
endpoint: 'http://localhost:8000/devtickets/graphql/',
|
|
167
|
+
},
|
|
168
|
+
},
|
|
169
|
+
},
|
|
170
|
+
})
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
Pick the board's URL yourself by adding a page:
|
|
174
|
+
|
|
175
|
+
```vue
|
|
176
|
+
<!-- pages/admin/dev-tickets/[[id]].vue -->
|
|
177
|
+
<template>
|
|
178
|
+
<DevTicketBoard base-path="/admin/dev-tickets" />
|
|
179
|
+
</template>
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
Then put the widget and the bell where they belong in your layout:
|
|
183
|
+
|
|
184
|
+
```vue
|
|
185
|
+
<!-- layouts/default.vue -->
|
|
186
|
+
<template>
|
|
187
|
+
<header>
|
|
188
|
+
<!-- ... -->
|
|
189
|
+
<DevTicketBell />
|
|
190
|
+
</header>
|
|
191
|
+
<slot />
|
|
192
|
+
<DevTicketWidget />
|
|
193
|
+
</template>
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
Both hide themselves for users who may not use Dev Tickets. That's it.
|
|
197
|
+
|
|
198
|
+
### 3. Tell it who your users are
|
|
199
|
+
|
|
200
|
+
The package asks your app three questions, each as a dotted path to a function. All three
|
|
201
|
+
have sensible defaults:
|
|
202
|
+
|
|
203
|
+
```python
|
|
204
|
+
DEV_TICKETS = {
|
|
205
|
+
# Who may see the board, file tickets and be assigned. Default: is_superuser.
|
|
206
|
+
"CAN_ACCESS": "myapp.devtickets.can_access", # (user) -> bool
|
|
207
|
+
|
|
208
|
+
# Shown on a ticket as "Reported by Maya in <context>". Default: none.
|
|
209
|
+
"CONTEXT_LABEL": "myapp.devtickets.current_company", # (request) -> str
|
|
210
|
+
|
|
211
|
+
# Writes a title from the description. Default: the first line.
|
|
212
|
+
"TITLE_GENERATOR": "myapp.devtickets.ai_title", # (description, request) -> str
|
|
213
|
+
}
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
```python
|
|
217
|
+
# myapp/devtickets.py
|
|
218
|
+
def can_access(user) -> bool:
|
|
219
|
+
return user.is_active and user.groups.filter(name="Product team").exists()
|
|
220
|
+
|
|
221
|
+
def current_company(request) -> str:
|
|
222
|
+
return request.user.company.name if request.user.is_authenticated else ""
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
---
|
|
226
|
+
|
|
227
|
+
## Configuration reference
|
|
228
|
+
|
|
229
|
+
All settings live in one `DEV_TICKETS` dict.
|
|
230
|
+
|
|
231
|
+
| Setting | Default | What it does |
|
|
232
|
+
| --- | --- | --- |
|
|
233
|
+
| `MODE` | `"standalone"` | `standalone`, `hub` or `client`. See [below](#one-board-for-every-environment). |
|
|
234
|
+
| `PREFIX` | `"DEV"` | Identifier prefix: `DEV-12`. |
|
|
235
|
+
| `BOARD_URL` | `""` | Absolute URL of the board, used for links in emails. |
|
|
236
|
+
| `CAN_ACCESS` | active superusers | `(user) -> bool`. Who may see the board, file tickets and get notifications. |
|
|
237
|
+
| `CAN_CONFIGURE` | `CAN_ACCESS` | `(user) -> bool`. Who may change the connection (mode, hub, keys) in Settings. |
|
|
238
|
+
| `TEAM` | active superusers | `() -> QuerySet` of users. Who can be assigned a ticket. |
|
|
239
|
+
| `TEAM_NAME` | `"Dev"` | Shown on the board. |
|
|
240
|
+
| `CONTEXT_LABEL` | none | `(request) -> str`. The tenant, company or workspace a ticket was filed from. |
|
|
241
|
+
| `TITLE_GENERATOR` | first line | `(description, request) -> str`. Raise or return `""` to fall back. |
|
|
242
|
+
| `SEND_MAIL` | Django `send_mail` | `(subject, text, html, to) -> None`. Plug in your own templated mailer. |
|
|
243
|
+
| `EMAIL_AFTER` | `120` | Seconds a notification must stay unread before it is emailed. |
|
|
244
|
+
| `STORAGE` | `"default"` | Name of the `STORAGES` entry used for attachments. |
|
|
245
|
+
| `MAX_ATTACHMENT_MB` | `15` | |
|
|
246
|
+
| `DEFAULT_ASSIGNEE` | none | Username or email that new tickets are assigned to. |
|
|
247
|
+
| `HUB_URL` | — | `client` mode: the hub's base URL. |
|
|
248
|
+
| `HUB_API_KEY` | — | `client` mode: this environment's key. Keep it in the environment, never in git. |
|
|
249
|
+
| `SOURCE` | — | `client` mode: shown on each ticket, e.g. `"staging"`. |
|
|
250
|
+
| `HUB_TIMEOUT` | `10` | `client` mode: seconds to wait for the hub. |
|
|
251
|
+
| `AVATAR` | none | `(user) -> str \| None`. A picture URL, sent to the hub with the person. |
|
|
252
|
+
|
|
253
|
+
`MODE`, `HUB_URL`, `HUB_API_KEY` and `SOURCE` may also be left out and set in the board's
|
|
254
|
+
Settings → Connection instead, where they are stored in the database. Whatever
|
|
255
|
+
`DEV_TICKETS` sets wins, and shows in Settings as locked.
|
|
256
|
+
|
|
257
|
+
Frontend (`runtimeConfig.public.devTickets`):
|
|
258
|
+
|
|
259
|
+
| Key | What it does |
|
|
260
|
+
| --- | --- |
|
|
261
|
+
| `endpoint` | Your backend's `/devtickets/graphql/`. In every mode, the browser talks only to its own backend. |
|
|
262
|
+
| `csrfUrl` | Optional. A URL to `GET` once so Django issues the CSRF cookie. |
|
|
263
|
+
|
|
264
|
+
## Settings
|
|
265
|
+
|
|
266
|
+
The gear in the board's top-right corner opens Settings. `?settings=lanes` (or `labels`,
|
|
267
|
+
`notifications`, `connection`) on the board's URL opens it on that tab; the bell's
|
|
268
|
+
"Notification settings" link uses that.
|
|
269
|
+
|
|
270
|
+
- **Lanes.** Each lane has a name, a type and an *on board* switch, and lanes run in the
|
|
271
|
+
order listed. Tickets store a lane's fixed key, so renaming a lane moves nothing. The
|
|
272
|
+
**type** carries the meaning: *completed*, *canceled* and *duplicate* lanes close a
|
|
273
|
+
ticket, and changing a lane to or from one of those opens or closes the tickets in it.
|
|
274
|
+
New tickets land in the first lane on the board, and a ticket marked a duplicate moves
|
|
275
|
+
to the first *duplicate* lane. Removing a lane that still holds tickets asks where to
|
|
276
|
+
move them; each gets a history entry and nobody is notified. The board always keeps one
|
|
277
|
+
lane. In client mode the lanes are the hub's.
|
|
278
|
+
- **Labels.** Name and colour; saved as you type.
|
|
279
|
+
- **Notifications.** Your own email digest on or off.
|
|
280
|
+
- **Connection.** Standalone, hub or client. As a client, enter the hub's address, the
|
|
281
|
+
key the hub made for this environment and a name for it; the connection is tried
|
|
282
|
+
before it is saved, so a typo cannot leave the board unreachable. As a hub, make,
|
|
283
|
+
rotate, revoke or set read-only the keys other environments use. A new key is shown
|
|
284
|
+
once. Only users passing `CAN_CONFIGURE` may change it, through `devtickets/settings/`
|
|
285
|
+
on the install itself, never forwarded to a hub.
|
|
286
|
+
|
|
287
|
+
---
|
|
288
|
+
|
|
289
|
+
## One board for every environment
|
|
290
|
+
|
|
291
|
+
A standalone install keeps tickets in each environment's own database, so a bug filed on
|
|
292
|
+
staging is invisible from production, and a database restore from production onto
|
|
293
|
+
staging overwrites staging's tickets. Most teams want **one board**, wherever a ticket
|
|
294
|
+
was filed from.
|
|
295
|
+
|
|
296
|
+
Dev Tickets does this over an **API, not a shared database connection**. One deployment is
|
|
297
|
+
the **hub** and owns the tickets. Every other environment runs as a **client** and forwards
|
|
298
|
+
everything to the hub.
|
|
299
|
+
|
|
300
|
+
```mermaid
|
|
301
|
+
flowchart LR
|
|
302
|
+
subgraph dev["Local dev"]
|
|
303
|
+
B1[Browser] --> C1[Django<br/>MODE=client]
|
|
304
|
+
end
|
|
305
|
+
subgraph staging["Staging"]
|
|
306
|
+
B2[Browser] --> C2[Django<br/>MODE=client]
|
|
307
|
+
end
|
|
308
|
+
subgraph prod["Production"]
|
|
309
|
+
B3[Browser] --> H[Django<br/>MODE=hub]
|
|
310
|
+
H --> DB[(tickets)]
|
|
311
|
+
end
|
|
312
|
+
C1 -- "HTTPS + API key" --> H
|
|
313
|
+
C2 -- "HTTPS + API key" --> H
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
**Why an API and not a second `DATABASES` entry:**
|
|
317
|
+
|
|
318
|
+
- **Users differ in each environment.** User 7 on staging is not user 7 in production, so a
|
|
319
|
+
foreign key cannot cross environments. Tickets point at **people** instead: a small table
|
|
320
|
+
of name, email and avatar, matched on **email** (case-insensitive). A client says who is
|
|
321
|
+
acting, and the hub finds or creates that person. Someone who signs in to the hub itself
|
|
322
|
+
and also files from staging under the same address is **one person**, with one bell.
|
|
323
|
+
- **No database credentials leave the hub.** A laptop holds an API key that can be revoked
|
|
324
|
+
on its own, not a password for the production database.
|
|
325
|
+
- **Email goes out once.** Only the hub sends digests, so three environments never send
|
|
326
|
+
the same notification three times.
|
|
327
|
+
- **Attachments live in one place.** A client streams uploads through to the hub, so a
|
|
328
|
+
screenshot filed from a laptop can still be opened from production.
|
|
329
|
+
|
|
330
|
+
A client still installs the app and runs its migrations, so the package is the same
|
|
331
|
+
everywhere, but its ticket tables stay empty.
|
|
332
|
+
|
|
333
|
+
### Setting it up
|
|
334
|
+
|
|
335
|
+
The quickest way is in the board's [Settings](#settings) → Connection: choose **Hub**
|
|
336
|
+
on the hub, make a key for each environment there, then choose **Client** on each
|
|
337
|
+
environment and paste the hub's address and its key. The rest of this section does the
|
|
338
|
+
same in settings files and commands, which suits environments built from code.
|
|
339
|
+
|
|
340
|
+
**On the hub** (usually production, or a small deployment of its own). A hub is a
|
|
341
|
+
standalone install that also answers the API: its own users use the board exactly as
|
|
342
|
+
before.
|
|
343
|
+
|
|
344
|
+
```python
|
|
345
|
+
DEV_TICKETS = {
|
|
346
|
+
"MODE": "hub",
|
|
347
|
+
"PREFIX": "APP",
|
|
348
|
+
"BOARD_URL": "https://app.example.com/admin/dev-tickets",
|
|
349
|
+
}
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
```bash
|
|
353
|
+
python manage.py devtickets_client add staging # prints the key once
|
|
354
|
+
python manage.py devtickets_client add dev-maya --source laptop
|
|
355
|
+
python manage.py devtickets_client add demo --read-only
|
|
356
|
+
python manage.py devtickets_client list # name, source, key prefix, last used
|
|
357
|
+
python manage.py devtickets_client rotate staging # new key; the old one stops working
|
|
358
|
+
python manage.py devtickets_client revoke dev-maya
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
A key is `dt_` plus 43 random characters. The hub stores only its SHA-256 and its first
|
|
362
|
+
8 characters (so `list` can tell keys apart). `--source` is the label stamped on what the
|
|
363
|
+
client files; it defaults to the client's name.
|
|
364
|
+
|
|
365
|
+
**On each client:**
|
|
366
|
+
|
|
367
|
+
```python
|
|
368
|
+
DEV_TICKETS = {
|
|
369
|
+
"MODE": "client",
|
|
370
|
+
"HUB_URL": "https://app.example.com",
|
|
371
|
+
"HUB_API_KEY": env("DEV_TICKETS_HUB_KEY"),
|
|
372
|
+
"SOURCE": "staging",
|
|
373
|
+
# optional
|
|
374
|
+
"HUB_TIMEOUT": 10, # seconds
|
|
375
|
+
"AVATAR": "myapp.devtickets.avatar", # (user) -> URL or None
|
|
376
|
+
}
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
A client refuses to start without `HUB_URL`, `HUB_API_KEY` and `SOURCE`, and names the
|
|
380
|
+
ones that are missing.
|
|
381
|
+
|
|
382
|
+
Nothing changes in the frontend, and the URLs stay the same. The browser keeps talking to
|
|
383
|
+
its own backend with its own session cookie. For each request the client:
|
|
384
|
+
|
|
385
|
+
1. checks `CAN_ACCESS` against its own user. Someone refused, signed out, or without an
|
|
386
|
+
email address is answered locally and never reaches the hub: `devSupportConfig`
|
|
387
|
+
returns `enabled: false`, and everything else is refused with the usual message
|
|
388
|
+
("Your account needs an email address to use dev tickets" for the last case);
|
|
389
|
+
2. forwards the request to the hub with its key, the user's email, name and avatar,
|
|
390
|
+
whether the `TEAM` hook includes them, and the `CONTEXT_LABEL`;
|
|
391
|
+
3. returns the hub's answer as it came. If the hub is down, answers with a 5xx or takes
|
|
392
|
+
longer than `HUB_TIMEOUT`, the browser gets HTTP 502 with "The ticket hub is
|
|
393
|
+
unreachable. Try again in a moment." and the detail goes to the log.
|
|
394
|
+
|
|
395
|
+
The API key never reaches a browser, and no CORS or cross-site cookies are involved.
|
|
396
|
+
Uploads are checked against `MAX_ATTACHMENT_MB` before they are sent, and downloads are
|
|
397
|
+
streamed through with the hub's content type and disposition.
|
|
398
|
+
|
|
399
|
+
On the hub, tickets, comments and changes made through a client carry its `source`. The
|
|
400
|
+
ticket dialog shows it as "· from staging", and the digest email as "Through".
|
|
401
|
+
|
|
402
|
+
A client does not send mail (`devtickets_notify` says so and exits) and does not hand out
|
|
403
|
+
keys. Connect AI assistants to the hub: `register_tools` refuses in client mode.
|
|
404
|
+
|
|
405
|
+
### Who can be assigned
|
|
406
|
+
|
|
407
|
+
The assignee list is everyone the hub's `TEAM` hook returns, plus every person a client
|
|
408
|
+
said is on *its* team. For a person linked to a hub user, the hub's own hooks decide and a
|
|
409
|
+
client cannot override them.
|
|
410
|
+
|
|
411
|
+
### What a client key can do
|
|
412
|
+
|
|
413
|
+
A client key can **act as any person it names**: the hub trusts the client to have
|
|
414
|
+
checked who is signed in. The hub's `CAN_ACCESS` applies only to the hub's own users. So
|
|
415
|
+
treat a key like a database password:
|
|
416
|
+
|
|
417
|
+
- Give **every environment, and every developer's laptop, its own key**, so revoking
|
|
418
|
+
one affects nobody else.
|
|
419
|
+
- Every ticket, comment and change records the **source** that made it.
|
|
420
|
+
- A read-only key (`--read-only`) can read the board but is refused every mutation and
|
|
421
|
+
upload. This suits a demo environment.
|
|
422
|
+
|
|
423
|
+
### The hub API
|
|
424
|
+
|
|
425
|
+
The client uses it, and other tools can too. It exists only when `MODE = "hub"` (404
|
|
426
|
+
otherwise) and is CSRF-exempt.
|
|
427
|
+
|
|
428
|
+
```
|
|
429
|
+
POST /devtickets/api/v1/graphql/ the same GraphQL schema as the board
|
|
430
|
+
POST /devtickets/api/v1/files/<APP-12>/ multipart, one or more "file" fields
|
|
431
|
+
GET /devtickets/api/v1/files/attachment/<id>/ ?download=1 to force a download
|
|
432
|
+
|
|
433
|
+
Authorization: Bearer <client key>
|
|
434
|
+
X-Dev-Tickets-Actor: {"email": "maya@example.com", "name": "Maya Okafor",
|
|
435
|
+
"avatar": "https://…", "team": true}
|
|
436
|
+
X-Dev-Tickets-Context: Acme%20Logistics (CONTEXT_LABEL, UTF-8, percent-encoded)
|
|
437
|
+
```
|
|
438
|
+
|
|
439
|
+
The actor header is required on every request, and so is its `email`.
|
|
440
|
+
|
|
441
|
+
| Answer | When |
|
|
442
|
+
| --- | --- |
|
|
443
|
+
| `401 {"errors": [{"message": …}]}` | No key, an unknown key, or a revoked one. |
|
|
444
|
+
| `400 {"errors": [{"message": …}]}` | The actor header is missing, is not JSON, or has no email. |
|
|
445
|
+
| GraphQL error "This hub client's key is read-only." | A mutation with a read-only key. A read-only upload gets 403. |
|
|
446
|
+
|
|
447
|
+
`last_used_at` is updated at most once a minute per key. Breaking changes will get a new
|
|
448
|
+
path (`/api/v2/`).
|
|
449
|
+
|
|
450
|
+
### Trying it locally
|
|
451
|
+
|
|
452
|
+
```bash
|
|
453
|
+
./playground/run.sh --client
|
|
454
|
+
```
|
|
455
|
+
|
|
456
|
+
This starts the playground hub (Django :8300, Nuxt :3300) and a client beside it (Django
|
|
457
|
+
:8301 with `playground-client.sqlite3`, Nuxt :3301). On the first run it makes the
|
|
458
|
+
`client-demo` key on the hub and keeps it in `playground/backend/.client-key`
|
|
459
|
+
(gitignored). The client's people are Priya Shah, who exists only there, and a Maya who
|
|
460
|
+
shares the hub Maya's address. Sign in at <http://localhost:3301/playground/>, file a
|
|
461
|
+
ticket, and it appears on the hub's board at <http://localhost:3300> marked
|
|
462
|
+
"from client-demo".
|
|
463
|
+
|
|
464
|
+
```bash
|
|
465
|
+
./playground/run.sh --open
|
|
466
|
+
```
|
|
467
|
+
|
|
468
|
+
The same hub, beside an install with no mode set at all (Django :8302, Nuxt :3302). Make
|
|
469
|
+
a key in the hub's Settings → Connection, then on <http://localhost:3302/playground/>
|
|
470
|
+
choose Client, enter `http://localhost:3300` and that key, and save.
|
|
471
|
+
|
|
472
|
+
---
|
|
473
|
+
|
|
474
|
+
## AI assistants (MCP)
|
|
475
|
+
|
|
476
|
+
```bash
|
|
477
|
+
pip install "django-dev-tickets[mcp]"
|
|
478
|
+
```
|
|
479
|
+
|
|
480
|
+
The tools are plain functions over the same service layer the UI uses, so every change an
|
|
481
|
+
assistant makes is validated, recorded in the history and notified exactly as if a person
|
|
482
|
+
had made it. Register them with the MCP server you already run:
|
|
483
|
+
|
|
484
|
+
```python
|
|
485
|
+
from dev_tickets.mcp import register_tools
|
|
486
|
+
|
|
487
|
+
register_tools(my_mcp_server, prefix="tickets_")
|
|
488
|
+
```
|
|
489
|
+
|
|
490
|
+
| Tool | What it does |
|
|
491
|
+
| --- | --- |
|
|
492
|
+
| `tickets_team` | Who can hold a ticket, and the states, priorities and labels. |
|
|
493
|
+
| `tickets_list` | Search and filter. |
|
|
494
|
+
| `tickets_get` | One ticket in full: description, comments, history, links, followers. |
|
|
495
|
+
| `tickets_create` | File a ticket. |
|
|
496
|
+
| `tickets_update` | State, priority, assignee, labels, title, description. |
|
|
497
|
+
| `tickets_comment` | Reply on a ticket. |
|
|
498
|
+
| `tickets_link` / `tickets_unlink` | Related, blocks, duplicate of. |
|
|
499
|
+
|
|
500
|
+
In client mode `register_tools` refuses (`ImproperlyConfigured`): the tickets live on the
|
|
501
|
+
hub, so connect assistants to the hub's MCP server. Every environment's tickets are there.
|
|
502
|
+
|
|
503
|
+
---
|
|
504
|
+
|
|
505
|
+
## Security notes
|
|
506
|
+
|
|
507
|
+
- **Access is decided by your app** (`CAN_ACCESS`), on every query, mutation, file and
|
|
508
|
+
API call. Nothing is public.
|
|
509
|
+
- **Uploads are never trusted.** Only images and PDFs are served inline. Everything else
|
|
510
|
+
is sent as a download, because an HTML or SVG file opened on your domain would run
|
|
511
|
+
script with the viewer's session.
|
|
512
|
+
- **Markdown is sanitised on the server** ([nh3](https://github.com/messense/nh3)) before
|
|
513
|
+
it is stored or emailed.
|
|
514
|
+
- **Each change is one transaction** with its history event, so the board and the
|
|
515
|
+
history cannot disagree.
|
|
516
|
+
- **Proxy prefixes.** If a reverse proxy sends only some paths to Django, add
|
|
517
|
+
`/devtickets/` and `/devtickets-files/` to it. If you don't, uploads go to your frontend
|
|
518
|
+
server and fail with an error that doesn't mention Dev Tickets.
|
|
519
|
+
|
|
520
|
+
---
|
|
521
|
+
|
|
522
|
+
## Versioning and updates
|
|
523
|
+
|
|
524
|
+
Dev Tickets follows [Semantic Versioning](https://semver.org). One tag releases both
|
|
525
|
+
packages:
|
|
526
|
+
|
|
527
|
+
| Change | Version | What you do |
|
|
528
|
+
| --- | --- | --- |
|
|
529
|
+
| Bug fix | `1.4.1 → 1.4.2` | Update. |
|
|
530
|
+
| New feature, additive migration, new optional setting | `1.4 → 1.5` | Update and run `migrate`. |
|
|
531
|
+
| Breaking setting, removed API, a migration that rewrites data | `1 → 2` | Read [CHANGELOG.md](https://github.com/unluckynelson/dev-tickets/blob/v0.2.0/CHANGELOG.md) first. |
|
|
532
|
+
|
|
533
|
+
Within a major version, migrations only add things, so a hub can run ahead of its
|
|
534
|
+
clients.
|
|
535
|
+
|
|
536
|
+
### Getting every update into every app
|
|
537
|
+
|
|
538
|
+
Let a bot open the upgrade PR in each app that uses Dev Tickets, so every release reaches
|
|
539
|
+
all of them and each app's CI tests it before it ships. Add
|
|
540
|
+
[Renovate](https://docs.renovatebot.com) to each app's repository:
|
|
541
|
+
|
|
542
|
+
```json
|
|
543
|
+
{
|
|
544
|
+
"extends": ["config:recommended"],
|
|
545
|
+
"packageRules": [
|
|
546
|
+
{
|
|
547
|
+
"matchPackageNames": ["django-dev-tickets", "nuxt-dev-tickets"],
|
|
548
|
+
"groupName": "dev-tickets",
|
|
549
|
+
"automerge": false
|
|
550
|
+
}
|
|
551
|
+
]
|
|
552
|
+
}
|
|
553
|
+
```
|
|
554
|
+
|
|
555
|
+
The `groupName` keeps the backend and frontend upgrade in **one PR**, so they never drift
|
|
556
|
+
apart. Dependabot works too, but it opens one PR per ecosystem.
|
|
557
|
+
|
|
558
|
+
Updates are deliberately not deployed without a PR: a release can carry a migration, and
|
|
559
|
+
a migration should go through the same review and deploy as the rest of your code.
|
|
560
|
+
|
|
561
|
+
---
|
|
562
|
+
|
|
563
|
+
## Development
|
|
564
|
+
|
|
565
|
+
```bash
|
|
566
|
+
git clone https://github.com/unluckynelson/dev-tickets
|
|
567
|
+
cd dev-tickets
|
|
568
|
+
|
|
569
|
+
# backend
|
|
570
|
+
cd python && python3 -m venv .venv && .venv/bin/pip install -e ".[dev,mcp]"
|
|
571
|
+
.venv/bin/pytest && .venv/bin/ruff check . # SQLite, no database server needed
|
|
572
|
+
|
|
573
|
+
# frontend
|
|
574
|
+
cd ../nuxt && npm install && npm run lint && npm run typecheck
|
|
575
|
+
|
|
576
|
+
# both, wired together, with sample data
|
|
577
|
+
cd .. && ./playground/run.sh # http://localhost:3300/playground/
|
|
578
|
+
```
|
|
579
|
+
|
|
580
|
+
The playground is Django from `python/` on :8300 and the layer's own Nuxt app
|
|
581
|
+
(`nuxt/.playground`) on :3300, which proxies the backend's paths so the browser sees one
|
|
582
|
+
origin. It seeds the sample team and tickets from the screenshots above. Open
|
|
583
|
+
`http://localhost:3300/playground/` and pick a person to sign in as (Sign out shows what
|
|
584
|
+
someone without access sees). Delete `playground/backend/playground.sqlite3` and
|
|
585
|
+
`.seeded` to start again.
|
|
586
|
+
|
|
587
|
+
### Releasing
|
|
588
|
+
|
|
589
|
+
Write the notes under `## [Unreleased]` in [CHANGELOG.md](https://github.com/unluckynelson/dev-tickets/blob/v0.2.0/CHANGELOG.md) as you go, then:
|
|
590
|
+
|
|
591
|
+
```bash
|
|
592
|
+
scripts/release.sh 1.5.0 --dry-run # every check, nothing written
|
|
593
|
+
scripts/release.sh 1.5.0 # bump, changelog, commit "Release v1.5.0", tag v1.5.0
|
|
594
|
+
git push --follow-tags # this is what publishes
|
|
595
|
+
```
|
|
596
|
+
|
|
597
|
+
`release.sh` refuses unless the tree is clean, you are on an up-to-date `main`, the
|
|
598
|
+
version is newer than the current one, the tag is free and the changelog has notes. It
|
|
599
|
+
then runs the same checks as CI. It writes the version into all four places that hold
|
|
600
|
+
it (`python/pyproject.toml`, `dev_tickets/__init__.py`, `nuxt/package.json` and its
|
|
601
|
+
lock), and `scripts/check-versions.sh` fails CI if they ever disagree. Nothing leaves
|
|
602
|
+
your machine until you push, so a bad release is undone with
|
|
603
|
+
`git tag -d v1.5.0 && git reset --hard HEAD~1`.
|
|
604
|
+
|
|
605
|
+
Pushing the tag runs [`.github/workflows/release.yml`](https://github.com/unluckynelson/dev-tickets/blob/v0.2.0/.github/workflows/release.yml):
|
|
606
|
+
|
|
607
|
+
1. checks that the tag, both packages and the changelog agree;
|
|
608
|
+
2. runs the full CI suite (Python 3.10 to 3.13, Django 5.1 and 5.2, lint, typecheck, build);
|
|
609
|
+
3. builds and publishes `django-dev-tickets` to PyPI and `nuxt-dev-tickets` to npm, with
|
|
610
|
+
the README's links pinned to the tag so the screenshots show on both sites;
|
|
611
|
+
4. makes the GitHub release from that version's changelog section.
|
|
612
|
+
|
|
613
|
+
A version with a suffix (`1.5.0-rc.1`) is published as a pre-release: npm's `next` tag,
|
|
614
|
+
never `latest`, so nobody upgrades to it by accident.
|
|
615
|
+
|
|
616
|
+
**One-time setup before the first release:**
|
|
617
|
+
|
|
618
|
+
- **PyPI:** add a [trusted publisher](https://docs.pypi.org/trusted-publishers/) for
|
|
619
|
+
`django-dev-tickets`: owner `unluckynelson`, repository `dev-tickets`, workflow
|
|
620
|
+
`release.yml`, environment `pypi`. No PyPI token is stored anywhere.
|
|
621
|
+
- **npm:** add a [trusted publisher](https://docs.npmjs.com/trusted-publishers) for
|
|
622
|
+
`nuxt-dev-tickets`, which npm allows only once the package exists (a `0.0.0-stage`
|
|
623
|
+
placeholder holds the name until the first release): `npm trust github nuxt-dev-tickets --repo unluckynelson/dev-tickets
|
|
624
|
+
--file release.yml --env npm --allow-publish`. Then, in the package's settings on
|
|
625
|
+
npmjs.com, require two-factor authentication and disallow tokens. No npm token is
|
|
626
|
+
stored anywhere either.
|
|
627
|
+
- **GitHub:** create the environments `pypi` and `npm` (Settings → Environments). Add
|
|
628
|
+
yourself as a required reviewer if every publish should wait for your approval.
|
|
629
|
+
|
|
630
|
+
## Roadmap
|
|
631
|
+
|
|
632
|
+
- [x] Extract the backend from AutoRoster into `python/`, with tests
|
|
633
|
+
- [x] Extract the Nuxt layer into `nuxt/`
|
|
634
|
+
- [x] Playground app
|
|
635
|
+
- [x] Hub / client mode and the v1 API
|
|
636
|
+
- [x] Release workflow (PyPI + npm on tag)
|
|
637
|
+
- [ ] AutoRoster moved onto the package: `v1.0.0`
|
|
638
|
+
- [ ] Projects: several apps on one hub
|
|
639
|
+
- [ ] Webhooks (Slack, Discord) on state changes
|
|
640
|
+
|
|
641
|
+
## License
|
|
642
|
+
|
|
643
|
+
[MIT](https://github.com/unluckynelson/dev-tickets/blob/v0.2.0/LICENSE): free to use, change and redistribute, commercially or not, as long as
|
|
644
|
+
the copyright notice stays with it.
|