You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .claude/skills/docs/SKILL.md
+7-6Lines changed: 7 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
name: docs
3
3
description: Update, review, or build the Sphinx documentation for Democrasite
4
4
disable-model-invocation: true
5
-
argument-hint: "[what to update or check, e.g. 'review for accuracy' or 'add activitypub section']"
5
+
argument-hint: "[what to update or check, e.g. 'review for accuracy' or 'add social section']"
6
6
---
7
7
8
8
## Task
@@ -30,7 +30,7 @@ docs/
30
30
├── democrasite.webiscite.views.rst
31
31
├── democrasite.webiscite.api.rst
32
32
├── democrasite.users.rst
33
-
├── democrasite.activitypub.rst
33
+
├── democrasite.social.rst
34
34
└── … (one file per module)
35
35
```
36
36
@@ -41,14 +41,15 @@ All run from the `docs/` directory (or with `make -C docs <target>`):
41
41
| Command | What it does |
42
42
|---|---|
43
43
|`make apidocs`| Regenerate all `docs/api/*.rst` from source using sphinx-apidoc. Run this whenever Python modules are added or removed. |
44
-
|`make livehtml`| Build docs and serve with live reload at http://localhost:9000. Requires the docs Docker container (`docker compose -f docker-compose.docs.yml up`). |
44
+
|`make livehtml`| Build docs and serve with live reload at http://localhost:9000. Run inside the `docs` service (started with `just up`; see `docker-compose.local.yml`). |
45
45
|`make clean`| Remove `_build/` and `api/` directories for a fresh build. |
46
46
|`make html`| One-off HTML build into `_build/html/`. |
47
47
48
-
To serve with live reload locally (in Docker):
48
+
To serve with live reload locally (in Docker), start the stack so the `docs` service runs (from repo root):
49
49
```
50
-
docker compose -f docker-compose.docs.yml up
50
+
just up
51
51
```
52
+
The `docs` container runs `make livehtml` via `compose/local/django/start-docs`.
52
53
53
54
To regenerate API docs locally (sphinx-apidoc must be installed):
54
55
```
@@ -98,7 +99,7 @@ Line length: 88 characters (enforced by ruff). Wrap long docstring lines to stay
98
99
-`:class:\`~democrasite.webiscite.models.Bill\`` — class link
99
100
-`:func:\`~democrasite.webiscite.tasks.submit_bill\`` — function link
100
101
-`:meth:\`~democrasite.webiscite.webhooks.PullRequestHandler.opened\`` — method link
101
-
3. Verify the build: `docker compose -f docker-compose.docs.yml up`
102
+
3. Verify the build: `just up` and open http://localhost:9000/
102
103
103
104
### Adding a new Python module
104
105
1. Write a module-level docstring at the top of the file
Copy file name to clipboardExpand all lines: CLAUDE.md
+11-9Lines changed: 11 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,7 +22,7 @@ All development uses Docker. The `justfile` sets `COMPOSE_FILE=docker-compose.lo
22
22
just build # Build Docker images
23
23
just up # Start all containers
24
24
just down # Stop containers
25
-
just test# Run pytest suite
25
+
just test<args># Run pytest suite
26
26
just lint # Run pre-commit hooks
27
27
just typecheck # Run mypy
28
28
just manage <args># Run manage.py (e.g., just manage makemigrations)
@@ -31,16 +31,18 @@ just coverage # Run tests with coverage + open HTML report
31
31
just shell # Bash shell in django container
32
32
just pyshell # Django shell_plus (IPython)
33
33
just run <cmd># Execute arbitrary command in django container
34
-
just loaddata # Load fixtures (democrasite + activitypub)
34
+
just loaddata # Load fixtures (democrasite + social)
35
35
```
36
36
37
-
To run a single test file or test:
37
+
To run a single test:
38
38
39
39
```bash
40
-
just run pytest democrasite/webiscite/tests/test_models.py
41
-
just run pytest democrasite/webiscite/tests/test_models.py::TestBill::test_method_name -v
40
+
just test democrasite/webiscite/tests/test_models.py::TestBill::test_method_name -v
42
41
```
43
42
43
+
For any `just` command, prefer running outside the sandbox to avoid `docker.sock`
44
+
permission errors. If `just` is not found, run `conda env democrasite` first.
45
+
44
46
Pytest is configured with `--ds=config.settings.test --reuse-db` in `pyproject.toml`.
45
47
46
48
## Architecture
@@ -49,7 +51,7 @@ Pytest is configured with `--ds=config.settings.test --reuse-db` in `pyproject.t
49
51
50
52
-**`democrasite/webiscite/`** — Core app. Models: `PullRequest`, `Bill`, `Vote`. Handles GitHub webhooks, voting logic, constitution enforcement, and Celery tasks for auto-merging.
51
53
-**`democrasite/users/`** — Custom `User` model (extends `AbstractUser` with single `name` field instead of first/last). OAuth integration.
52
-
-**`democrasite/activitypub/`** — ActivityPub federation. Models: `Person` (linked to User with keypair), `Follow`.
54
+
-**`democrasite/social/`** — Social network for short notes. Models: `Person` (linked to User with keypair), `Follow`.
53
55
54
56
### Configuration
55
57
@@ -60,9 +62,9 @@ Pytest is configured with `--ds=config.settings.test --reuse-db` in `pyproject.t
60
62
61
63
### Key Patterns
62
64
63
-
-**Constitution system** (`webiscite/constitution.py`, `constitution.json`): Maps files to protected line ranges. PRs touching protected code become "constitutional" bills requiring supermajority. Line numbers auto-update after merges.
64
-
-**Bill lifecycle**: OPEN → APPROVED/REJECTED/FAILED/CLOSED. Each Bill has a OneToOne to a Celery `PeriodicTask` that runs `submit_bill()` at voting period end.
-**Constitution system** (`democrasite/webiscite/constitution.py`, repo-root`constitution.json`): Maps files to protected line ranges. PRs touching protected code become "constitutional" bills requiring supermajority. Line numbers auto-update after merges.
66
+
-**Bill lifecycle**: Draft PRs yield `DRAFT` bills until `ready_for_review`; then `OPEN` → APPROVED/REJECTED/FAILED/CLOSED (or `AMENDED` if the PR branch changes during voting). Each Bill has a OneToOne to a Celery Beat`PeriodicTask` that runs `submit_bill()` at voting period end.
67
+
-**Webhook flow** (`democrasite/webiscite/webhooks.py`): GitHub `pull_request` webhooks (open, reopen, close, synchronize, ready_for_review, etc.) → HMAC validation → create/update `PullRequest`and `Bill` as appropriate. `push` and `ping` are accepted with minimal handling.
66
68
-**Vote constraints**: One vote per user per bill (DB unique constraint). Votes can be changed.
67
69
-**Audit trail**: `django-simple-history` tracks changes on key models.
0 commit comments