Skip to content

Commit c1cecb0

Browse files
authored
Merge pull request #25 from codesyntax/docs
Docs
2 parents 41c902e + 27b709e commit c1cecb0

33 files changed

Lines changed: 2996 additions & 14 deletions

.github/workflows/docs.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: "Publish Documentation"
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- 'docs/**'
9+
- '.github/workflows/docs.yml'
10+
workflow_dispatch:
11+
12+
permissions:
13+
contents: read
14+
pages: write
15+
id-token: write
16+
17+
concurrency:
18+
group: "pages"
19+
cancel-in-progress: false
20+
21+
jobs:
22+
build:
23+
name: "Build Docs"
24+
runs-on: ubuntu-latest
25+
steps:
26+
- name: Checkout repository
27+
uses: actions/checkout@v4
28+
29+
- name: Install uv
30+
uses: astral-sh/setup-uv@v5
31+
with:
32+
enable-cache: true
33+
cache-dependency-glob: "docs/uv.lock"
34+
35+
- name: Build documentation
36+
run: |
37+
cd docs
38+
make html
39+
40+
- name: Upload artifact
41+
uses: actions/upload-pages-artifact@v3
42+
with:
43+
path: docs/_build/html
44+
45+
deploy:
46+
name: "Deploy to GitHub Pages"
47+
needs: build
48+
environment:
49+
name: github-pages
50+
url: ${{ steps.deployment.outputs.page_url }}
51+
runs-on: ubuntu-latest
52+
steps:
53+
- name: Deploy to GitHub Pages
54+
id: deployment
55+
uses: actions/deploy-pages@v4

AGENTS.md

Lines changed: 34 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,13 @@ This project uses `make` as the primary task runner, backed by `uv` for Python e
1212
make install
1313
```
1414
*(Always recommend `make install` to users. It handles all dependencies, `uv venv`, and setup. NEVER recommend using `pip install` or `uv pip` directly.)*
15+
- **Sync dependencies**: `make sync`
1516
- **Start the Plone instance**:
1617
```bash
1718
make start
1819
```
1920
- **Clean the environment** (without removing data): `make clean`
21+
- **Remove all content**: `make remove-data`
2022
- **Create a new site**: `make create-site`
2123

2224
### Linting and Formatting
@@ -34,11 +36,11 @@ Tests are written using `pytest` and `plone.app.testing`.
3436
- **Run tests with coverage**: `make test-coverage`
3537
- **Run a single test file**:
3638
```bash
37-
./.venv/bin/pytest src/cs_dynamicpages/tests/test_ct_dynamic_page_folder.py
39+
./.venv/bin/pytest src/cs_dynamicpages/tests/test_file.py
3840
```
3941
- **Run a specific test method/class**:
4042
```bash
41-
./.venv/bin/pytest src/cs_dynamicpages/tests/test_ct_dynamic_page_folder.py::DynamicPageFolderIntegrationTest::test_ct_dynamic_page_folder_adding
43+
./.venv/bin/pytest src/cs_dynamicpages/tests/test_file.py::TestClass::test_method
4244
```
4345

4446
---
@@ -49,24 +51,23 @@ Tests are written using `pytest` and `plone.app.testing`.
4951
- **Line Length**: 88 characters (configured in `pyproject.toml`).
5052
- **Python Version**: Target Python 3.10 (`>=3.10,<3.14`).
5153
- **Imports**: Formatted using `ruff`'s `isort` rules.
52-
- Case-insensitive sorting.
53-
- Force single-line imports (`from X import Y` on separate lines for each `Y`).
54+
- Case-insensitive sorting, force single-line imports (`from X import Y` on separate lines).
5455
- No sections (all imports sorted alphabetically regardless of third-party/stdlib).
5556
- 2 blank lines after imports, 1 blank line between types.
56-
- **Exceptions**: Ignore `E731` (DoNotAssignLambda). Use `# noqa` only when absolutely necessary and document why.
57+
- **Exceptions**: Ignore `E731` (DoNotAssignLambda). Use `# noqa` only when necessary.
5758

5859
### Naming Conventions
5960
- **Classes**: `PascalCase` (e.g., `DynamicPageFolder`).
6061
- **Interfaces**: Prefix with `I` and use `PascalCase` (e.g., `IDynamicPageFolder`).
6162
- **Methods, Variables, and Functions**: `snake_case` (e.g., `dynamic_page_folder_id`).
6263
- **Constants**: `UPPER_SNAKE_CASE` (e.g., `TEST_USER_ID`).
63-
- **Filenames**: `snake_case` for Python and XML files (except specific Zope configurations like `configure.zcml` or specific profiles like `Plone_Site.xml` which follow Plone's exact casing).
64+
- **Filenames**: `snake_case` for Python and XML files (except `configure.zcml` / Plone profiles).
6465

6566
### Types & Schema
6667
- Define Dexterity schemas using `plone.supermodel.model.Schema`.
6768
- Apply `@implementer(IYourInterface)` to your content type classes.
6869
- Explicitly subclass `Container` or `Item` from `plone.dexterity.content`.
69-
- Avoid unnecessary types annotations if Zope schemas already enforce types (`zope.schema`).
70+
- Avoid unnecessary type annotations if Zope schemas already enforce types (`zope.schema`).
7071

7172
### Error Handling
7273
- Use standard Python exceptions or `plone.api.exc` (like `InvalidParameterError`) when using `plone.api`.
@@ -75,7 +76,7 @@ Tests are written using `pytest` and `plone.app.testing`.
7576

7677
### XML, ZCML, and PT
7778
- **XML/ZCML**: Keep it strictly formatted with `zpretty`. Indent with 2 spaces.
78-
- **Page Templates (PT)**: Ensure they are properly formed HTML/XML. Keep logic in the python views, not in the templates.
79+
- **Page Templates (PT)**: Ensure they are properly formed HTML/XML. Keep logic in python views, not templates.
7980

8081
---
8182

@@ -91,8 +92,7 @@ These rules are strictly enforced for AI agents interacting with this Plone repo
9192
- If no docs are found, EXPLICITLY STATE: "I cannot find official documentation for this." Trial and error MUST be labeled: "This requires trial and error - not documented."
9293

9394
2. **Terminal Commands**
94-
- Provide ONE step at a time.
95-
- WAIT for confirmation before moving to the next step.
95+
- Provide ONE step at a time. WAIT for confirmation before moving to the next step.
9696
- Include the full command with all parameters.
9797
- ALWAYS recommend using `make` commands (`make install`, `make start`). NEVER recommend `pip install`, `uv add` or `uv pip` directly.
9898

@@ -109,8 +109,7 @@ These rules are strictly enforced for AI agents interacting with this Plone repo
109109
- In README, review the code if necessary to explain features correctly (e.g. use `- Register a behavior providing additional fields representing contact information` instead of just `- Behavior`).
110110

111111
5. **Internationalization (i18n)**
112-
- All UI strings MUST be translatable.
113-
- Use `cs_dynamicpages` as the i18n domain.
112+
- All UI strings MUST be translatable. Use `cs_dynamicpages` as the i18n domain.
114113
- Example: `_(u"My string")` imported from the project's MessageFactory.
115114
- Run `make i18n` to update `.pot` and `.po` files.
116115

@@ -125,5 +124,26 @@ These rules are strictly enforced for AI agents interacting with this Plone repo
125124
- Acknowledge good ideas and creative solutions.
126125

127126
8. **Definition of Success**
128-
- Success is ONLY a fully functional, tested result.
129-
- Never claim success for partial or broken implementations.
127+
- Success is ONLY a fully functional, tested result. Never claim success for partial or broken implementations.
128+
129+
---
130+
131+
## 4. Engram Persistent Memory — Protocol
132+
133+
You have access to Engram, a persistent memory system that survives across sessions and compactions.
134+
135+
### WHEN TO SAVE (mandatory — not optional)
136+
Call `mem_save` IMMEDIATELY after any of these:
137+
- Bug fix completed
138+
- Architecture or design decision made
139+
- Non-obvious discovery about the codebase
140+
- Configuration change or environment setup
141+
- Pattern established (naming, structure, convention)
142+
- User preference or constraint learned
143+
144+
### WHEN TO SEARCH MEMORY
145+
- Call `mem_context` — checks recent session history (fast, cheap)
146+
- If not found, call `mem_search` with relevant keywords (FTS5 full-text search)
147+
148+
### SESSION CLOSE PROTOCOL (mandatory)
149+
Before ending a session, you MUST call `mem_session_summary` using the structured outline (Goal, Instructions, Discoveries, Accomplished, Next Steps, Relevant Files). This is NOT optional.

docs/.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Python related
2+
*.egg-info
3+
.venv
4+
5+
# Documentation builds
6+
_build
7+
styles/Microsoft

docs/.readthedocs.yaml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# .readthedocs.yaml
2+
# Read the Docs configuration file
3+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
4+
5+
# Required
6+
version: 2
7+
8+
# Set the OS, Python version and other tools you might need
9+
build:
10+
os: ubuntu-22.04
11+
tools:
12+
python: "3.13"
13+
commands:
14+
# Cancel building pull requests when there aren't changes in the docs directory or YAML file.
15+
# You can add any other files or directories that you'd like here as well,
16+
# like your docs requirements file, or other files that will change your docs build.
17+
#
18+
# If there are no changes (git diff exits with 0) we force the command to return with 183.
19+
# This is a special exit code on Read the Docs that will cancel the build immediately.
20+
- |
21+
if [ "$READTHEDOCS_VERSION_TYPE" = "external" ] && git diff --quiet origin/main -- docs/docs/ docs/styles/ .readthedocs.yaml docs/.vale.ini docs/Makefile docs/uv.lock .github/workflows/docs.yml;
22+
then
23+
exit 183;
24+
fi
25+
- cd docs && make rtd-pr-preview

docs/.vale.ini

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
StylesPath = styles
2+
3+
MinAlertLevel = suggestion
4+
5+
Vocab = Base,Plone
6+
7+
Packages = Microsoft
8+
9+
[*]
10+
BasedOnStyles = Vale, Microsoft
11+
Microsoft.Contractions = suggestion
12+
Microsoft.Units = suggestion

docs/LICENSE.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
cs_dynamicpages Copyright 2026, CodeSyntax
2+
3+
The text and illustrations in this website are licensed by the Plone Foundation under a [Creative Commons Attribution 4.0 International](https://creativecommons.org/licenses/by/4.0/) license. Plone and the Plone® logo are registered trademarks of the Plone Foundation, registered in the United States and other countries. For guidelines on the permitted uses of the Plone trademarks, see [https://plone.org/foundation/logo](https://plone.org/foundation/logo). All other trademarks are owned by their respective owners.

docs/Makefile

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
# Makefile for Sphinx documentation
2+
.DEFAULT_GOAL = help
3+
SHELL = bash
4+
5+
# You can set these variables from the command line.
6+
SPHINXOPTS ?=
7+
PAPER ?=
8+
9+
# Internal variables.
10+
GREEN=`tput setaf 2`
11+
RESET=`tput sgr0`
12+
SPHINXBUILD = "$(realpath .venv/bin/sphinx-build)"
13+
DOCS_DIR = ./docs/
14+
BUILDDIR = ./_build
15+
PAPEROPT_a4 = -D latex_paper_size=a4
16+
PAPEROPT_letter = -D latex_paper_size=letter
17+
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) $(DOCS_DIR)
18+
VALEFILES := $(shell find $(DOCS_DIR) -type f -name "*.md" -print)
19+
VALEOPTS ?=
20+
PYTHONVERSION = >=3.11,<3.14
21+
22+
# Add the following 'help' target to your Makefile
23+
# And add help text after each target name starting with '\#\#'
24+
.PHONY: help
25+
help: # This help message
26+
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
27+
28+
29+
# environment management
30+
.venv/bin/python: ## Create Python virtual environment and install package requirements
31+
@uv sync
32+
33+
.PHONY: install
34+
install: .venv/bin/python ## Sync package requirements
35+
36+
37+
.PHONY: init
38+
init: clean clean-python .venv/bin/python ## Clean docs build directory and Python, and initialize Python virtual environment
39+
40+
.PHONY: clean
41+
clean: ## Clean docs build directory
42+
cd $(DOCS_DIR) && rm -rf $(BUILDDIR)/
43+
44+
.PHONY: clean-python
45+
clean-python: clean
46+
rm -rf .venv/
47+
rm -rf *.egg-info
48+
# /environment management
49+
50+
51+
# documentation builders
52+
.PHONY: html
53+
html: .venv/bin/python ## Build html
54+
@uv run sphinx-build -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
55+
@echo
56+
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
57+
58+
.PHONY: livehtml
59+
livehtml: .venv/bin/python ## Rebuild Sphinx documentation on changes, with live-reload in the browser
60+
@uv run sphinx-autobuild \
61+
--ignore "*.swp" \
62+
--port 8050 \
63+
-b html $(DOCS_DIR) "$(BUILDDIR)/html" $(SPHINXOPTS) $(O)
64+
65+
.PHONY: dirhtml
66+
dirhtml: .venv/bin/python
67+
@uv run sphinx-build -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
68+
@echo
69+
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
70+
71+
.PHONY: singlehtml
72+
singlehtml: .venv/bin/python
73+
@uv run sphinx-build -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
74+
@echo
75+
@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
76+
77+
.PHONY: text
78+
text: .venv/bin/python
79+
@uv run sphinx-build -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
80+
@echo
81+
@echo "Build finished. The text files are in $(BUILDDIR)/text."
82+
83+
.PHONY: changes
84+
changes: .venv/bin/python
85+
@uv run sphinx-build -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
86+
@echo
87+
@echo "The overview file is in $(BUILDDIR)/changes."
88+
89+
.PHONY: rtd-prepare
90+
rtd-prepare: ## Prepare environment on Read the Docs
91+
asdf plugin add uv
92+
asdf install uv latest
93+
asdf global uv latest
94+
95+
.PHONY: rtd-pr-preview ## Build pull request previews on Read the Docs
96+
rtd-pr-preview: rtd-prepare .venv/bin/python ## Build pull request preview on Read the Docs
97+
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) ${READTHEDOCS_OUTPUT}/html/
98+
99+
.PHONY: build
100+
build: html ## Build documentation in HTML format
101+
102+
# /documentation builders
103+
104+
105+
# test
106+
.PHONY: linkcheck
107+
linkcheck: .venv/bin/python ## Run linkcheck
108+
@uv run sphinx-build -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
109+
@echo
110+
@echo "Link check complete; look for any errors in the above output " \
111+
"or in $(BUILDDIR)/linkcheck/ ."
112+
113+
.PHONY: linkcheckbroken
114+
linkcheckbroken: .venv/bin/python ## Run linkcheck and show only broken links
115+
@uv run sphinx-build -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck | GREP_COLORS='0;31' grep -wi "broken\|redirect" --color=always | GREP_COLORS='0;31' grep -vi "https://github.com/plone/volto/issues/" --color=always && if test $$? = 0; then exit 1; fi || test $$? = 1
116+
@echo
117+
@echo "Link check complete; look for any errors in the above output " \
118+
"or in $(BUILDDIR)/linkcheck/ ."
119+
120+
.PHONY: doctest
121+
doctest: .venv/bin/python ## Test snippets in the documentation
122+
@uv run sphinx-build -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
123+
@echo "Testing of doctests in the sources finished, look at the " \
124+
"results in $(BUILDDIR)/doctest/output.txt."
125+
126+
.PHONY: vale
127+
vale: .venv/bin/python ## Run Vale style, grammar, and spell checks
128+
@uv run vale sync
129+
@uv run vale --no-wrap $(VALEOPTS) $(VALEFILES)
130+
@echo "Vale is finished; look for any errors in the above output."
131+
@echo
132+
133+
.PHONY: test
134+
test: clean vale linkcheckbroken doctest ## Clean docs build, then run vale, linkcheckbroken, and doctest
135+
136+
.PHONY: all
137+
all: clean vale linkcheckbroken html ## Clean docs build, then run linkcheckbroken, and build html
138+
# /test

0 commit comments

Comments
 (0)