Skip to content

Commit b9cd87f

Browse files
committed
Merge pull request #344 from cihai/doc-redesign-spring-2026
docs(redesign) — CLI Frontend Skeleton pattern (#344) Restructure cihai-cli documentation to the CLI Frontend Skeleton. Standalone composed homepage with command output examples. CLI index cards. API demoted from homepage. project/ section. sphinx-design added.
2 parents 0556c92 + 6334bae commit b9cd87f

9 files changed

Lines changed: 249 additions & 10 deletions

File tree

docs/cli/index.md

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,33 @@
11
(cli)=
22

3-
# Commands
3+
# CLI Reference
4+
5+
::::{grid} 1 1 2 2
6+
:gutter: 2 2 3 3
7+
8+
:::{grid-item-card} cihai info
9+
:link: info
10+
:link-type: doc
11+
Look up a CJK character by glyph or codepoint.
12+
:::
13+
14+
:::{grid-item-card} cihai reverse
15+
:link: reverse
16+
:link-type: doc
17+
Search definitions for a given term.
18+
:::
19+
20+
:::{grid-item-card} Completions
21+
:link: completion
22+
:link-type: doc
23+
Shell completion for bash, zsh, and tcsh.
24+
:::
25+
26+
::::
427

528
```{toctree}
629
:caption: General
30+
:maxdepth: 1
731
832
info
933
reverse

docs/conf.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,15 @@
3838
"argparse_exemplar", # Custom sphinx-argparse replacement
3939
"sphinx_inline_tabs",
4040
"sphinx_copybutton",
41+
"sphinx_design",
4142
"sphinxext.opengraph",
4243
"sphinxext.rediraffe",
4344
"myst_parser",
4445
"linkify_issues",
4546
]
4647

48+
myst_heading_anchors = 4
49+
4750
myst_enable_extensions = [
4851
"colon_fence",
4952
"substitution",

docs/index.md

Lines changed: 58 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,75 @@
11
(index)=
22

3-
```{include} ../README.md
3+
# cihai-cli
44

5+
Command line frontend for the [cihai](https://cihai.git-pull.com/) CJK language library.
6+
7+
::::{grid} 1 2 3 3
8+
:gutter: 2 2 3 3
9+
10+
:::{grid-item-card} Quickstart
11+
:link: quickstart
12+
:link-type: doc
13+
Install and look up your first character.
14+
:::
15+
16+
:::{grid-item-card} CLI Reference
17+
:link: cli/index
18+
:link-type: doc
19+
Every command, flag, and option.
20+
:::
21+
22+
:::{grid-item-card} Contributing
23+
:link: project/index
24+
:link-type: doc
25+
Development setup, code style, and releases.
26+
:::
27+
28+
::::
29+
30+
## Install
31+
32+
```console
33+
$ pip install cihai-cli
534
```
635

7-
## Contents
36+
```console
37+
$ uv tool install cihai-cli
38+
```
839

9-
```{toctree}
10-
:maxdepth: 2
40+
## At a glance
1141

12-
quickstart
13-
cli/index
42+
Look up a CJK character:
1443

44+
```console
45+
$ cihai info 好
1546
```
1647

48+
```
49+
char: 好
50+
kDefinition: good, excellent, fine; well
51+
kMandarin: hǎo
52+
```
53+
54+
Search definitions:
55+
56+
```console
57+
$ cihai reverse library
58+
```
59+
60+
```
61+
圕: library
62+
```
63+
64+
Data is downloaded automatically on first use via [cihai](https://cihai.git-pull.com/).
65+
1766
```{toctree}
18-
:caption: Project
1967
:hidden:
2068
69+
quickstart
70+
cli/index
2171
api
72+
project/index
2273
history
2374
migration
24-
Developer Guide <https://cihai.git-pull.com/contributing/>
25-
GitHub <https://github.com/cihai/cihai-cli>
2675
```

docs/project/code-style.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Code Style
2+
3+
## Formatting
4+
5+
cihai-cli uses [ruff](https://github.com/astral-sh/ruff) for both linting and formatting.
6+
7+
```console
8+
$ uv run ruff format .
9+
```
10+
11+
```console
12+
$ uv run ruff check . --fix --show-fixes
13+
```
14+
15+
## Type Checking
16+
17+
Strict [mypy](https://mypy-lang.org/) is enforced.
18+
19+
```console
20+
$ uv run mypy
21+
```
22+
23+
## Docstrings
24+
25+
All public functions and methods use NumPy-style docstrings.
26+
27+
## Imports
28+
29+
- Standard library: namespace imports (`import pathlib`, not `from pathlib import Path`)
30+
- Typing: `import typing as t`, access via `t.Optional`, `t.NamedTuple`, etc.
31+
- All files: `from __future__ import annotations`

docs/project/contributing.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Contributing
2+
3+
cihai-cli follows the cihai project's contributing guidelines.
4+
5+
See the [cihai contributing guide](https://cihai.git-pull.com/contributing/) for
6+
development setup, running tests, and submitting pull requests.
7+
8+
## Quick setup
9+
10+
Clone and install in development mode:
11+
12+
```console
13+
$ git clone https://github.com/cihai/cihai-cli.git
14+
```
15+
16+
```console
17+
$ cd cihai-cli
18+
```
19+
20+
```console
21+
$ uv sync --group dev
22+
```
23+
24+
Run the tests:
25+
26+
```console
27+
$ uv run pytest
28+
```

docs/project/index.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
(project)=
2+
3+
# Project
4+
5+
Information for contributors and maintainers.
6+
7+
::::{grid} 1 1 2 2
8+
:gutter: 2 2 3 3
9+
10+
:::{grid-item-card} Contributing
11+
:link: contributing
12+
:link-type: doc
13+
How to get involved and submit changes.
14+
:::
15+
16+
:::{grid-item-card} Code Style
17+
:link: code-style
18+
:link-type: doc
19+
Ruff, mypy, NumPy docstrings, import conventions.
20+
:::
21+
22+
:::{grid-item-card} Releasing
23+
:link: releasing
24+
:link-type: doc
25+
Release checklist and version policy.
26+
:::
27+
28+
::::
29+
30+
```{toctree}
31+
:hidden:
32+
33+
contributing
34+
code-style
35+
releasing
36+
```

docs/project/releasing.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Releasing
2+
3+
## Release Process
4+
5+
Releases are triggered by git tags and published to PyPI via OIDC trusted publishing.
6+
7+
1. Update `CHANGES` with the release notes
8+
9+
2. Bump version in `src/cihai_cli/__about__.py`
10+
11+
3. Commit:
12+
13+
```console
14+
$ git commit -m "cihai-cli <version>"
15+
```
16+
17+
4. Tag:
18+
19+
```console
20+
$ git tag v<version>
21+
```
22+
23+
5. Push:
24+
25+
```console
26+
$ git push && git push --tags
27+
```
28+
29+
6. CI builds and publishes to PyPI automatically via trusted publishing

pyproject.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ dev = [
7171
"gp-libs",
7272
"sphinx-autobuild",
7373
"sphinx-autodoc-typehints",
74+
"sphinx-design",
7475
"sphinx-inline-tabs",
7576
"sphinxext-opengraph",
7677
"sphinx-copybutton",
@@ -104,6 +105,7 @@ docs = [
104105
"gp-libs",
105106
"sphinx-autobuild",
106107
"sphinx-autodoc-typehints",
108+
"sphinx-design",
107109
"sphinx-inline-tabs",
108110
"sphinxext-opengraph",
109111
"sphinx-copybutton",

uv.lock

Lines changed: 37 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)