Skip to content

Commit 1ce1268

Browse files
committed
feat(wiki): add local authoring workflow
- add the docs/wiki submodule, local MkDocs build scripts, and a GitHub Pages workflow for wiki publishing - add cargo wiki commands through xtask and document the local wiki lint/build flow in the README files - add the CRIEW wiki authoring skill and record the rewritten wiki home page commit in the submodule pointer Signed-off-by: Chen Miao <chenmiao.ku@gmail.com>
1 parent e521463 commit 1ce1268

File tree

20 files changed

+1107
-0
lines changed

20 files changed

+1107
-0
lines changed

.cargo/config.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[alias]
2+
wiki = "run --quiet -p xtask --"
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
---
2+
name: criew-wiki-authoring
3+
description: Write and revise pages under `docs/wiki` for the CRIEW GitHub wiki and its MkDocs-backed GitHub Pages site. Use when Codex needs to create, expand, reorganize, or review CRIEW wiki pages such as `Home.md`, `_Sidebar.md`, `_Footer.md`, or topic pages, and when the output or workflow must follow GitHub wiki conventions, the local MkDocs pipeline, and a pragmatic, kernel-documentation writing style.
4+
---
5+
6+
# Criew Wiki Authoring
7+
8+
## Overview
9+
10+
Write CRIEW wiki pages as maintainer documentation.
11+
Treat `docs/wiki/` as the source GitHub wiki repository, and treat the published website as a derived MkDocs build driven from the main `CRIEW` repository.
12+
Keep the source compatible with both GitHub wiki rendering and the local Pages build pipeline, and prefer a direct, technical style over narrative or marketing copy.
13+
14+
## Follow This Workflow
15+
16+
1. Confirm the source of truth before writing.
17+
- Read the code, README, spec, config example, or architecture note that defines the behavior.
18+
- Prefer `README.md`, `README-zh.md`, `docs/architecture/design.md`, `docs/specs/`, and `docs/reference/config.example.toml` depending on the topic.
19+
- Do not invent commands, defaults, limitations, or workflows.
20+
21+
2. Check the wiki context.
22+
- List the existing pages in `docs/wiki/` before creating or renaming a page.
23+
- Treat `docs/wiki/` as a separate Git repository. Use `git -C docs/wiki ...` when checking history or status.
24+
- Read `references/publish-workflow.md` before changing local preview, staging, or deployment behavior.
25+
- Keep `Home.md` as the landing page and update it when a new top-level page changes how readers enter the wiki.
26+
- Read `references/style-guide.md` for page rules.
27+
- Read `references/page-patterns.md` when choosing a page shape.
28+
29+
3. Choose the smallest page that fits the job.
30+
- Use a short reference page for stable facts and concepts.
31+
- Use a workflow page for operator tasks with prerequisites and ordered steps.
32+
- Use a troubleshooting page for symptoms, likely causes, and recovery actions.
33+
- Split a page once it starts carrying more than one primary purpose.
34+
35+
4. Draft in GitHub wiki form.
36+
- Use page names and filenames that are stable, literal, and easy to scan.
37+
- Prefer normal Markdown links such as `[Configuration](Configuration.md)` because they work in both GitHub wiki and MkDocs.
38+
- Treat `[[Page Name]]` and `[[Page Name|Link text]]` as compatibility syntax only. The local staging script rewrites them for MkDocs, but new content should not depend on that rewrite when a Markdown link is clear enough.
39+
- Use full GitHub URLs when linking from the wiki back into the main CRIEW repository, because the wiki is a separate repository.
40+
- Add `_Sidebar.md` or `_Footer.md` only when shared navigation or repeated context is materially useful.
41+
42+
5. Check the publish path before finishing.
43+
- Local copy lint goes through `./scripts/wiki-lint.sh`.
44+
- Local preview and local build go through `./scripts/wiki-site.sh serve` and `./scripts/wiki-site.sh build`.
45+
- The staging step copies `docs/wiki/` into `target/wiki-docs/`, turns `Home.md` into the MkDocs `index.md`, excludes special wiki-only files such as `_Sidebar.md` and `_Footer.md`, and normalizes source-only links.
46+
- The published website is built from `mkdocs.yml` and deployed by `.github/workflows/wiki-pages.yml`.
47+
- The lint script requires `autocorrect`. If it is missing, the script downloads a local copy into `target/wiki-venv/bin/` and then reruns the check.
48+
- Treat a clean `./scripts/wiki-lint.sh` result as part of done for every wiki page this skill creates or edits.
49+
- Because `docs/wiki` is a submodule, the main repository deploys the pinned wiki commit, not the remote wiki repository's latest HEAD. A new wiki commit reaches GitHub Pages only after the CRIEW repository updates the `docs/wiki` submodule pointer.
50+
51+
6. Draft in kernel-documentation style.
52+
- Lead with scope and purpose.
53+
- Prefer active voice, short sentences, and concrete nouns.
54+
- State prerequisites, constraints, and side effects before optional detail.
55+
- Prefer commands, paths, config keys, and observable outcomes over abstract explanation.
56+
- Avoid filler, advocacy, roadmap prose, and vague adjectives such as `simple`, `easy`, `powerful`, or `seamless`.
57+
- Name conditions directly when behavior depends on mode, configuration, or state.
58+
59+
7. Review before finishing.
60+
- Verify commands, file paths, environment variables, config keys, and feature names against the repository.
61+
- Keep language consistent within the page. Match the page's existing language unless the user requests a change.
62+
- Check that headings are informative, examples are minimal, and links resolve to the intended wiki page or repository URL.
63+
- Run `./scripts/wiki-lint.sh` for every text change and revise the page until it passes. If the environment prevents the check, report that explicitly instead of assuming the page is clean.
64+
- When page structure or links changed, run `./scripts/wiki-site.sh build` if the environment allows it.
65+
66+
## Apply These Page Rules
67+
68+
- Start each page with a short paragraph that states what the page covers and when to use it.
69+
- Prefer headings such as `Prerequisites`, `Workflow`, `Configuration`, `Troubleshooting`, `Limitations`, and `See also` when they fit the content.
70+
- Keep heading depth shallow unless the page genuinely needs more structure.
71+
- Keep lists parallel and action-oriented.
72+
- Use fenced code blocks for commands, config fragments, and sample output.
73+
- Keep examples minimal but real.
74+
- Write copy that passes `autocorrect`; treat lint failures as defects that need wording changes before the page is considered complete.
75+
- Preserve CRIEW naming: use `CRIEW` for the project and `criew` for the binary, crate, config file, runtime directory, and environment variables.
76+
77+
## Use The References
78+
79+
- `references/style-guide.md`: GitHub wiki constraints, linking rules, and writing expectations.
80+
- `references/page-patterns.md`: Reusable page skeletons for `Home.md`, workflow pages, reference pages, and troubleshooting pages.
81+
- `references/publish-workflow.md`: The `docs/wiki -> MkDocs -> GitHub Pages` pipeline, local preview commands, and submodule publication constraints.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
interface:
2+
display_name: "CRIEW Wiki"
3+
short_description: "CRIEW GitHub wiki authoring guide"
4+
default_prompt: "Use $criew-wiki-authoring to draft or revise pages under docs/wiki in the CRIEW GitHub wiki style."
Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
# CRIEW Wiki Page Patterns
2+
3+
## Home Page
4+
5+
Use this when editing `Home.md`.
6+
7+
```md
8+
# CRIEW Wiki
9+
10+
Briefly state what the wiki covers and who should read it.
11+
12+
## Start here
13+
14+
- [Install and setup](Install-and-Setup.md)
15+
- [Configuration](Configuration.md)
16+
- [Patch workflow](Patch-Workflow.md)
17+
- [Troubleshooting](Troubleshooting.md)
18+
19+
## Topic map
20+
21+
### User workflows
22+
23+
- [Sync mail](Sync-Mail.md)
24+
- [Review and reply](Review-and-Reply.md)
25+
- [Apply patches](Apply-Patches.md)
26+
27+
### Reference
28+
29+
- [Configuration reference](Configuration-Reference.md)
30+
- [Key concepts](Key-Concepts.md)
31+
32+
### Development
33+
34+
- [CRIEW repository](https://github.com/ChenMiaoi/CRIEW)
35+
- [Contributor notes](Contributor-Notes.md)
36+
```
37+
38+
## Workflow Page
39+
40+
Use this for task-oriented pages.
41+
42+
```md
43+
# Page Title
44+
45+
State the task, operator, and expected outcome.
46+
47+
## Prerequisites
48+
49+
- Required environment, files, or state.
50+
51+
## Workflow
52+
53+
1. Run the first command or enter the first screen.
54+
2. Describe the expected result.
55+
3. Continue with the next observable step.
56+
57+
## Verify the result
58+
59+
- State what success looks like.
60+
61+
## Troubleshooting
62+
63+
- Common failure mode and the next action.
64+
65+
## See also
66+
67+
- [Related page](Related-Page.md)
68+
```
69+
70+
## Reference Page
71+
72+
Use this for concepts, settings, or stable behavior.
73+
74+
```md
75+
# Page Title
76+
77+
State the scope and the object being described.
78+
79+
## Overview
80+
81+
Brief definition or behavioral summary.
82+
83+
## Fields or options
84+
85+
- `key_name`: State meaning, accepted values, and important default behavior.
86+
87+
## Constraints
88+
89+
- State limits, invariants, or caveats.
90+
91+
## Related behavior
92+
93+
- Explain how this topic affects adjacent workflows.
94+
```
95+
96+
## Troubleshooting Page
97+
98+
Use this for failure-driven guidance.
99+
100+
```md
101+
# Page Title
102+
103+
State the symptom or failure class this page covers.
104+
105+
## Symptoms
106+
107+
- Observable error, UI state, or command output.
108+
109+
## Likely causes
110+
111+
- Most common cause first.
112+
113+
## Recovery steps
114+
115+
1. Verify the suspected cause.
116+
2. Apply the fix.
117+
3. Confirm recovery.
118+
119+
## Escalation
120+
121+
- State when the user should stop and inspect code, logs, or configuration in more detail.
122+
```
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# CRIEW Wiki Publish Workflow
2+
3+
## Pipeline
4+
5+
The publication path is:
6+
7+
`docs/wiki` source repo -> `scripts/prepare-wiki-site.py` staging -> `mkdocs.yml` build -> `.github/workflows/wiki-pages.yml` deploy -> GitHub Pages
8+
9+
This means the source of truth stays in the GitHub wiki repository, while the published website is generated from the main `CRIEW` repository.
10+
11+
## Local Commands
12+
13+
- `./scripts/wiki-lint.sh`: Check wiki copy with `autocorrect`. If the command is missing, the script downloads a local copy into `target/wiki-venv/bin/`.
14+
- `./scripts/wiki-site.sh prepare`: Stage the wiki into `target/wiki-docs` without installing MkDocs.
15+
- `./scripts/wiki-site.sh serve`: Stage the wiki, install MkDocs into `target/wiki-venv`, and start a local preview server on `0.0.0.0:8000` by default. Override the bind address with `CRIEW_WIKI_DEV_ADDR`.
16+
- `./scripts/wiki-site.sh build`: Stage the wiki, install MkDocs into `target/wiki-venv`, and build `target/wiki-site`.
17+
18+
Treat `./scripts/wiki-lint.sh` as mandatory for wiki content changes.
19+
Do not consider a new or edited wiki page complete until the copy passes the lint check, unless the environment prevents running the command and that limitation is reported.
20+
21+
## What The Staging Step Does
22+
23+
- Copy published wiki content from `docs/wiki/` into `target/wiki-docs/`.
24+
- Rewrite `Home.md` into the MkDocs landing page `index.md`.
25+
- Skip GitHub wiki helper files such as `_Sidebar.md` and `_Footer.md`.
26+
- Rewrite legacy `[[Page]]` wiki links into Markdown links that MkDocs can resolve.
27+
28+
## CI And Deployment
29+
30+
- `.github/workflows/wiki-pages.yml` runs `./scripts/wiki-lint.sh` before it builds the site on pull requests that touch the wiki publish pipeline.
31+
- The same workflow deploys to GitHub Pages on pushes to `develop`.
32+
- The workflow uploads the rendered site from `target/wiki-site`.
33+
- This CI step is the enforcement point for the same copy rules that the skill expects locally. Write pages to pass the lint check before handing the change off.
34+
35+
## Submodule Constraint
36+
37+
`docs/wiki` is a Git submodule in the main repository.
38+
That means the GitHub Pages deployment uses the wiki commit pinned by the main `CRIEW` repository.
39+
If the standalone wiki repository advances but the main repository does not update the `docs/wiki` gitlink, GitHub Pages will keep publishing the older pinned wiki snapshot.
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# CRIEW Wiki Style Guide
2+
3+
## GitHub Wiki Constraints
4+
5+
- Treat `docs/wiki/` as the source wiki repository, not as a normal docs folder inside the main repo.
6+
- Treat the published website as a derived MkDocs build from the main `CRIEW` repository.
7+
- Keep `Home.md` as the landing page.
8+
- Use `_Sidebar.md` for shared navigation only when the page set is large enough to justify it.
9+
- Use `_Footer.md` only for short, repeated context such as related links or maintenance notes.
10+
- Prefer Markdown pages unless the existing page already uses another supported markup.
11+
- Avoid syntax that GitHub wikis do not support well, such as definition lists, table-of-contents directives, transclusion, or heavy indentation tricks.
12+
13+
## Page Naming
14+
15+
- Use stable, descriptive page names.
16+
- Keep filenames portable. Avoid characters that are awkward in URLs or file systems.
17+
- Match the filename to the page topic instead of using vague names such as `Notes` or `Misc`.
18+
- Rename pages only when the old name is clearly wrong or blocks navigation.
19+
20+
## Linking Rules
21+
22+
- Prefer standard Markdown links for internal page links, for example `[Configuration](Configuration.md)`.
23+
- Keep `[[Page Name]]` or `[[Page Name|Link text]]` only as compatibility syntax for older pages. `scripts/prepare-wiki-site.py` rewrites them during MkDocs staging.
24+
- Use normal Markdown links for external URLs.
25+
- Use full GitHub URLs when linking from the wiki to files, directories, issues, or pull requests in the main `CRIEW` repository.
26+
- Do not rely on repository-relative paths from the wiki back to the main repo. The wiki is a separate repository, so those links are easy to break.
27+
- Keep link text explicit. Prefer the destination's role over generic text such as `here` or `more`.
28+
29+
## Writing Style
30+
31+
- State what the page is for in the opening paragraph.
32+
- Prefer direct statements over explanation-first prose.
33+
- Put prerequisites before steps.
34+
- Put limitations and side effects near the action that triggers them.
35+
- Prefer one fact per sentence when the topic is operational.
36+
- Use active voice and imperative steps for procedures.
37+
- Avoid marketing tone, vision statements, and rhetorical fillers.
38+
- Avoid unexplained claims such as `fast`, `simple`, `robust`, or `advanced`.
39+
- Keep wording compatible with `autocorrect`. If lint flags a phrase, rewrite the sentence instead of suppressing the check.
40+
41+
## Evidence And Accuracy
42+
43+
- Verify commands, config keys, and paths against the current repository state.
44+
- Cite the real source in prose when the behavior comes from a spec, config example, or code path.
45+
- Call out assumptions explicitly if the repository does not prove them.
46+
- Prefer a small verified page over a broad speculative page.
47+
- Run `./scripts/wiki-lint.sh` after every copy edit and treat a clean result as required for completion. If the environment prevents the check, report that gap explicitly.
48+
49+
## Page Maintenance
50+
51+
- Update `Home.md` when a new page changes the top-level information architecture.
52+
- Merge or split pages when navigation starts to hide the main task flow.
53+
- Keep the lint path working: `./scripts/wiki-lint.sh` installs `autocorrect` on demand when the binary is missing.
54+
- Run `./scripts/wiki-site.sh build` after link or structure changes when the environment allows it.
55+
- Remove stale TODO text before finishing.

.github/workflows/wiki-pages.yml

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
name: Wiki Pages
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- .github/workflows/wiki-pages.yml
7+
- .gitmodules
8+
- docs/wiki
9+
- docs/wiki-requirements.txt
10+
- mkdocs.yml
11+
- scripts/prepare-wiki-site.py
12+
- scripts/wiki-lint.sh
13+
- scripts/wiki-site.sh
14+
push:
15+
branches:
16+
- develop
17+
paths:
18+
- .github/workflows/wiki-pages.yml
19+
- .gitmodules
20+
- docs/wiki
21+
- docs/wiki-requirements.txt
22+
- mkdocs.yml
23+
- scripts/prepare-wiki-site.py
24+
- scripts/wiki-lint.sh
25+
- scripts/wiki-site.sh
26+
workflow_dispatch:
27+
28+
permissions:
29+
contents: read
30+
31+
concurrency:
32+
group: wiki-pages
33+
cancel-in-progress: true
34+
35+
jobs:
36+
build:
37+
runs-on: ubuntu-latest
38+
39+
steps:
40+
- name: Checkout
41+
uses: actions/checkout@v5
42+
with:
43+
fetch-depth: 0
44+
submodules: recursive
45+
46+
- name: Setup Python
47+
uses: actions/setup-python@v5
48+
with:
49+
python-version: '3.12'
50+
51+
- name: Configure GitHub Pages
52+
uses: actions/configure-pages@v5
53+
54+
- name: Lint wiki copy
55+
run: ./scripts/wiki-lint.sh
56+
57+
- name: Build wiki site
58+
run: ./scripts/wiki-site.sh build
59+
60+
- name: Upload GitHub Pages artifact
61+
uses: actions/upload-pages-artifact@v4
62+
with:
63+
path: target/wiki-site
64+
65+
deploy:
66+
if: github.event_name == 'push' && github.ref == 'refs/heads/develop'
67+
needs: build
68+
runs-on: ubuntu-latest
69+
permissions:
70+
contents: read
71+
pages: write
72+
id-token: write
73+
environment:
74+
name: github-pages
75+
url: ${{ steps.deployment.outputs.page_url }}
76+
77+
steps:
78+
- name: Deploy to GitHub Pages
79+
id: deployment
80+
uses: actions/deploy-pages@v4

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
[submodule "vendor/b4"]
22
path = vendor/b4
33
url = https://github.com/mricon/b4.git
4+
[submodule "docs/wiki"]
5+
path = docs/wiki
6+
url = https://github.com/ChenMiaoi/CRIEW.wiki.git

0 commit comments

Comments
 (0)