selfdoc 0.3.1__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.
- selfdoc-0.3.1/.claude/settings.json +3 -0
- selfdoc-0.3.1/.github/workflows/ci.yml +22 -0
- selfdoc-0.3.1/.github/workflows/publish.yml +30 -0
- selfdoc-0.3.1/.gitignore +34 -0
- selfdoc-0.3.1/.rlsbl/bases/.claude/settings.json +3 -0
- selfdoc-0.3.1/.rlsbl/bases/.github/workflows/ci.yml +22 -0
- selfdoc-0.3.1/.rlsbl/bases/.github/workflows/publish.yml +30 -0
- selfdoc-0.3.1/.rlsbl/bases/.gitignore +14 -0
- selfdoc-0.3.1/.rlsbl/bases/.rlsbl/hooks/post-release.sh +8 -0
- selfdoc-0.3.1/.rlsbl/bases/.rlsbl/hooks/pre-release.sh +31 -0
- selfdoc-0.3.1/.rlsbl/bases/CLAUDE.md +20 -0
- selfdoc-0.3.1/.rlsbl/hashes.json +8 -0
- selfdoc-0.3.1/.rlsbl/hooks/post-release.sh +14 -0
- selfdoc-0.3.1/.rlsbl/hooks/pre-release.sh +31 -0
- selfdoc-0.3.1/.rlsbl/version +1 -0
- selfdoc-0.3.1/CHANGELOG.md +103 -0
- selfdoc-0.3.1/CLAUDE.md +44 -0
- selfdoc-0.3.1/LICENSE +21 -0
- selfdoc-0.3.1/PKG-INFO +197 -0
- selfdoc-0.3.1/README.md +181 -0
- selfdoc-0.3.1/bin/cli.js +16 -0
- selfdoc-0.3.1/demo/index.html +2106 -0
- selfdoc-0.3.1/docs/index.md +46 -0
- selfdoc-0.3.1/package.json +25 -0
- selfdoc-0.3.1/pyproject.toml +31 -0
- selfdoc-0.3.1/selfdoc/__init__.py +45 -0
- selfdoc-0.3.1/selfdoc/__main__.py +3 -0
- selfdoc-0.3.1/selfdoc/build.py +1280 -0
- selfdoc-0.3.1/selfdoc/check.py +835 -0
- selfdoc-0.3.1/selfdoc/cli.py +538 -0
- selfdoc-0.3.1/selfdoc/config.py +205 -0
- selfdoc-0.3.1/selfdoc/deploy.py +177 -0
- selfdoc-0.3.1/selfdoc/directives.py +169 -0
- selfdoc-0.3.1/selfdoc/extractors/__init__.py +0 -0
- selfdoc-0.3.1/selfdoc/extractors/go.py +972 -0
- selfdoc-0.3.1/selfdoc/extractors/python.py +828 -0
- selfdoc-0.3.1/selfdoc/extractors/typescript.py +1093 -0
- selfdoc-0.3.1/selfdoc/html.py +2253 -0
- selfdoc-0.3.1/selfdoc/resolver.py +135 -0
- selfdoc-0.3.1/selfdoc/themes/__init__.py +34 -0
- selfdoc-0.3.1/selfdoc/themes/minimal.css +1756 -0
- selfdoc-0.3.1/selfdoc.json +10 -0
- selfdoc-0.3.1/tests/test_build.py +4246 -0
- selfdoc-0.3.1/tests/test_check.py +1586 -0
- selfdoc-0.3.1/tests/test_cli.py +214 -0
- selfdoc-0.3.1/tests/test_config.py +559 -0
- selfdoc-0.3.1/tests/test_custom_directives.py +155 -0
- selfdoc-0.3.1/tests/test_demo_panel.py +1023 -0
- selfdoc-0.3.1/tests/test_directives.py +201 -0
- selfdoc-0.3.1/tests/test_go_extractor.py +521 -0
- selfdoc-0.3.1/tests/test_python_extractor.py +458 -0
- selfdoc-0.3.1/tests/test_ts_extractor.py +582 -0
- selfdoc-0.3.1/todo/.done/seo-geo-audit.md +255 -0
- selfdoc-0.3.1/todo/seo-linting-gaps.md +66 -0
- selfdoc-0.3.1/todo/styling-and-release.md +38 -0
- selfdoc-0.3.1/uv.lock +882 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
strategy:
|
|
13
|
+
matrix:
|
|
14
|
+
node-version: [20, 22, 24]
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@v6
|
|
17
|
+
- uses: actions/setup-node@v6
|
|
18
|
+
with:
|
|
19
|
+
node-version: ${{ matrix.node-version }}
|
|
20
|
+
- run: node -e "require('./package.json')"
|
|
21
|
+
- run: npm test --if-present
|
|
22
|
+
- run: npm audit --audit-level=moderate || true
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
name: Publish
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
|
|
7
|
+
permissions:
|
|
8
|
+
contents: read
|
|
9
|
+
id-token: write
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
npm:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
steps:
|
|
15
|
+
- uses: actions/checkout@v6
|
|
16
|
+
- uses: actions/setup-node@v6
|
|
17
|
+
with:
|
|
18
|
+
node-version: 24
|
|
19
|
+
registry-url: https://registry.npmjs.org
|
|
20
|
+
- run: npm publish --provenance --access public
|
|
21
|
+
env:
|
|
22
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
23
|
+
|
|
24
|
+
pypi:
|
|
25
|
+
runs-on: ubuntu-latest
|
|
26
|
+
steps:
|
|
27
|
+
- uses: actions/checkout@v6
|
|
28
|
+
- uses: astral-sh/setup-uv@v7
|
|
29
|
+
- run: uv build
|
|
30
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
selfdoc-0.3.1/.gitignore
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
*.egg-info/
|
|
6
|
+
dist/
|
|
7
|
+
build/
|
|
8
|
+
*.egg
|
|
9
|
+
.venv/
|
|
10
|
+
venv/
|
|
11
|
+
.eggs/
|
|
12
|
+
|
|
13
|
+
# Node
|
|
14
|
+
node_modules/
|
|
15
|
+
npm-debug.log*
|
|
16
|
+
|
|
17
|
+
# IDE
|
|
18
|
+
.idea/
|
|
19
|
+
.vscode/
|
|
20
|
+
*.swp
|
|
21
|
+
*.swo
|
|
22
|
+
|
|
23
|
+
# OS
|
|
24
|
+
.DS_Store
|
|
25
|
+
Thumbs.db
|
|
26
|
+
|
|
27
|
+
# Docs build output
|
|
28
|
+
docs/_build/
|
|
29
|
+
|
|
30
|
+
# Wrangler
|
|
31
|
+
.wrangler/
|
|
32
|
+
|
|
33
|
+
# rlsbl
|
|
34
|
+
.rlsbl/lock
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
strategy:
|
|
13
|
+
matrix:
|
|
14
|
+
node-version: [20, 22, 24]
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@v6
|
|
17
|
+
- uses: actions/setup-node@v6
|
|
18
|
+
with:
|
|
19
|
+
node-version: ${{ matrix.node-version }}
|
|
20
|
+
- run: node -e "require('./package.json')"
|
|
21
|
+
- run: npm test --if-present
|
|
22
|
+
- run: npm audit --audit-level=moderate || true
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
name: Publish
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
|
|
7
|
+
permissions:
|
|
8
|
+
contents: read
|
|
9
|
+
id-token: write
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
npm:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
steps:
|
|
15
|
+
- uses: actions/checkout@v6
|
|
16
|
+
- uses: actions/setup-node@v6
|
|
17
|
+
with:
|
|
18
|
+
node-version: 24
|
|
19
|
+
registry-url: https://registry.npmjs.org
|
|
20
|
+
- run: npm publish --provenance --access public
|
|
21
|
+
env:
|
|
22
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
23
|
+
|
|
24
|
+
pypi:
|
|
25
|
+
runs-on: ubuntu-latest
|
|
26
|
+
steps:
|
|
27
|
+
- uses: actions/checkout@v6
|
|
28
|
+
- uses: astral-sh/setup-uv@v7
|
|
29
|
+
- run: uv build
|
|
30
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Post-release hook. Runs after a successful release (non-fatal).
|
|
3
|
+
# Environment: RLSBL_VERSION is set to the released version.
|
|
4
|
+
# Customize this for your project (e.g., local install, deploy, notify).
|
|
5
|
+
|
|
6
|
+
set -euo pipefail
|
|
7
|
+
|
|
8
|
+
echo "Post-release: v$RLSBL_VERSION"
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Pre-release validation hook.
|
|
3
|
+
# Runs before rlsbl creates a release. Exit non-zero to abort.
|
|
4
|
+
# Detects project type and runs appropriate checks automatically.
|
|
5
|
+
|
|
6
|
+
set -euo pipefail
|
|
7
|
+
|
|
8
|
+
echo "Running pre-release checks..."
|
|
9
|
+
|
|
10
|
+
if [ -f go.mod ]; then
|
|
11
|
+
echo " Go: vet + build + test"
|
|
12
|
+
go vet ./...
|
|
13
|
+
go build ./...
|
|
14
|
+
go test ./... -race -short -count=1
|
|
15
|
+
fi
|
|
16
|
+
|
|
17
|
+
if [ -f pyproject.toml ]; then
|
|
18
|
+
echo " Python: pytest"
|
|
19
|
+
if command -v uv &>/dev/null; then
|
|
20
|
+
uv run pytest
|
|
21
|
+
elif command -v pytest &>/dev/null; then
|
|
22
|
+
pytest
|
|
23
|
+
fi
|
|
24
|
+
fi
|
|
25
|
+
|
|
26
|
+
if [ -f package.json ] && node -e "process.exit(require('./package.json').scripts?.test ? 0 : 1)" 2>/dev/null; then
|
|
27
|
+
echo " npm: test"
|
|
28
|
+
npm test
|
|
29
|
+
fi
|
|
30
|
+
|
|
31
|
+
echo "Pre-release checks passed."
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# selfdoc
|
|
2
|
+
|
|
3
|
+
## Release workflow
|
|
4
|
+
|
|
5
|
+
This project uses [rlsbl](https://github.com/smm-h/rlsbl) for release orchestration.
|
|
6
|
+
|
|
7
|
+
- Update CHANGELOG.md with a `## X.Y.Z` entry describing changes
|
|
8
|
+
- Run `rlsbl release [patch|minor|major]` to bump version and create a GitHub Release
|
|
9
|
+
- CI handles publishing automatically via the publish workflow
|
|
10
|
+
- Never publish manually — always use `rlsbl release`
|
|
11
|
+
- Requires NPM_TOKEN secret on GitHub (Settings > Secrets > Actions)
|
|
12
|
+
- Use `rlsbl release --dry-run` to preview a release without making changes
|
|
13
|
+
|
|
14
|
+
## Conventions
|
|
15
|
+
|
|
16
|
+
- No tokens or secrets in command-line arguments (use env vars or config files)
|
|
17
|
+
- All file writes to shared state should be atomic (write to tmp, then rename)
|
|
18
|
+
- External calls (APIs, CLI tools) must have timeouts and graceful fallbacks
|
|
19
|
+
- Use `npm link` (npm) or `uv pip install -e .` (Python) for local development
|
|
20
|
+
- CI runs smoke tests on every push; manual testing for UI/UX changes
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
{
|
|
2
|
+
".github/workflows/ci.yml": "83903a715b1d07683962b041e8f56727440e239070eb055995b5f6c863dfa813",
|
|
3
|
+
".github/workflows/publish.yml": "ff275580a98127104d28ce4a9b2992ce6a30a5d96de9bfcaa1b95bee97e5e2da",
|
|
4
|
+
"CLAUDE.md": "10cacc0e23da91fa5d18765bea4c1195cc3cfcbf9725bae882bdd84f545a12d0",
|
|
5
|
+
".rlsbl/hooks/pre-release.sh": "9bae4134d0a4c302287766f9a4a2923b6c5706d2cc7078f553fec843b8cd5a06",
|
|
6
|
+
".rlsbl/hooks/post-release.sh": "b455f8511e0b2655509ecf5dcb0ab7da5bb7c961f47910ff8e00cab5bd51f833",
|
|
7
|
+
".claude/settings.json": "78922a784ee78e9e50587e93628cd3b9d4dfbe49087adc4514e6781cea38cbb9"
|
|
8
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Post-release hook. Runs after a successful release (non-fatal).
|
|
3
|
+
# Environment: RLSBL_VERSION is set to the released version.
|
|
4
|
+
# Customize this for your project (e.g., local install, deploy, notify).
|
|
5
|
+
|
|
6
|
+
set -euo pipefail
|
|
7
|
+
|
|
8
|
+
echo "Post-release: v$RLSBL_VERSION"
|
|
9
|
+
|
|
10
|
+
if command -v selfdoc &>/dev/null && [ -f selfdoc.json ]; then
|
|
11
|
+
[ -f ~/Projects/.env ] && set -a && source ~/Projects/.env && set +a
|
|
12
|
+
echo "Building and deploying docs..."
|
|
13
|
+
selfdoc build && selfdoc deploy
|
|
14
|
+
fi
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Pre-release validation hook.
|
|
3
|
+
# Runs before rlsbl creates a release. Exit non-zero to abort.
|
|
4
|
+
# Detects project type and runs appropriate checks automatically.
|
|
5
|
+
|
|
6
|
+
set -euo pipefail
|
|
7
|
+
|
|
8
|
+
echo "Running pre-release checks..."
|
|
9
|
+
|
|
10
|
+
if [ -f go.mod ]; then
|
|
11
|
+
echo " Go: vet + build + test"
|
|
12
|
+
go vet ./...
|
|
13
|
+
go build ./...
|
|
14
|
+
go test ./... -race -short -count=1
|
|
15
|
+
fi
|
|
16
|
+
|
|
17
|
+
if [ -f pyproject.toml ]; then
|
|
18
|
+
echo " Python: pytest"
|
|
19
|
+
if command -v uv &>/dev/null; then
|
|
20
|
+
uv run pytest
|
|
21
|
+
elif command -v pytest &>/dev/null; then
|
|
22
|
+
pytest
|
|
23
|
+
fi
|
|
24
|
+
fi
|
|
25
|
+
|
|
26
|
+
if [ -f package.json ] && node -e "process.exit(require('./package.json').scripts?.test ? 0 : 1)" 2>/dev/null; then
|
|
27
|
+
echo " npm: test"
|
|
28
|
+
npm test
|
|
29
|
+
fi
|
|
30
|
+
|
|
31
|
+
echo "Pre-release checks passed."
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0.21.2
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.3.1
|
|
4
|
+
|
|
5
|
+
- npm package renamed from `selfdoc` to `selfdocumenting` (npm blocks `selfdoc` due to similarity with abandoned `self-doc` package). Install via `npm install -g selfdocumenting` or `npx selfdocumenting`. The CLI command remains `selfdoc`.
|
|
6
|
+
|
|
7
|
+
## 0.3.0
|
|
8
|
+
|
|
9
|
+
### Breaking Changes
|
|
10
|
+
|
|
11
|
+
- `base_url` is now a required field in `selfdoc.json` (previously optional)
|
|
12
|
+
- Frontmatter `description` is now required on every page (auto-extraction removed); missing description is a build error
|
|
13
|
+
- `selfdoc build` now fails on SEO lint warnings
|
|
14
|
+
|
|
15
|
+
### Added
|
|
16
|
+
|
|
17
|
+
- Subdirectory-based nested nav groups with collapsible sidebar sections, localStorage persistence, and frontmatter overrides (`nav_group`, `nav_order`)
|
|
18
|
+
- Configurable search trigger via `search` config field: `"icon"` (magnifying glass button), `"bar"` (text input with Cmd+K hint), or `"hidden"`
|
|
19
|
+
- Functional feedback widget via `feedback` config field with webhook POST and Google Analytics event support
|
|
20
|
+
- Atom feed generation (`feed.xml`) with auto-discovery `<link>` tag in `<head>`
|
|
21
|
+
- Definition list syntax (`term\n: definition`) with glossary styling and DefinedTerm JSON-LD
|
|
22
|
+
- Inline stat markup (`==value==`) producing semantic `<data>` elements
|
|
23
|
+
- Code tabs for switching between language variants with localStorage persistence
|
|
24
|
+
- Git branch auto-detection for edit links; configurable via `branch` config field
|
|
25
|
+
- Edit link shown at both top and bottom of content area
|
|
26
|
+
- Rich OG card PNG generation with text overlay via predraw (optional dependency)
|
|
27
|
+
- SEO lint framework with 15 rules covering headings, descriptions, images, contrast, and structured data
|
|
28
|
+
- JSON-LD structured data: TechArticle, BreadcrumbList, WebSite, SoftwareSourceCode, Organization/Person, ItemList, DefinedTermSet
|
|
29
|
+
- Open Graph and Twitter Card meta tags with `og:locale`, `og:image:alt`, and auto-generated social card images
|
|
30
|
+
- `robots.txt` with explicit AI crawler permissions (GPTBot, ClaudeBot, PerplexityBot, etc.)
|
|
31
|
+
- `llms.txt` and `llms-full.txt` for AI documentation ingestion
|
|
32
|
+
- Visible "Last updated" dates with `<time>` elements, `dateModified` in JSON-LD, and sitemap `lastmod`
|
|
33
|
+
- `selfdoc check --ignore SEO007,SEO008` to suppress specific lint rules
|
|
34
|
+
- `selfdoc check --format json` for machine-readable output
|
|
35
|
+
- `selfdoc check` reports undocumented public symbols when coverage is below 100%
|
|
36
|
+
- Color-coded `selfdoc check` output (green/yellow/red by severity)
|
|
37
|
+
- `lint_ignore` config field for project-level lint rule suppression
|
|
38
|
+
- New config fields: `lang` (BCP 47), `author`, `twitter`, `branch`, `search`, `feedback`
|
|
39
|
+
|
|
40
|
+
### Fixed
|
|
41
|
+
|
|
42
|
+
- Edit link and "Last updated" date no longer run together (flex layout with gap)
|
|
43
|
+
- Sticky table headers no longer hide behind the fixed topbar
|
|
44
|
+
- Search shows "No results" message instead of blank space
|
|
45
|
+
- Search dialog closes when clicking a result link
|
|
46
|
+
- Copy button now always visible on code blocks (was hidden until hover, invisible on touch)
|
|
47
|
+
- Fixed dark mode contrast for all accent colors
|
|
48
|
+
- Fixed breadcrumb intermediate links pointing to non-existent directory index pages
|
|
49
|
+
- Fixed code-block hover shadow invisible in dark mode
|
|
50
|
+
|
|
51
|
+
### Improved
|
|
52
|
+
|
|
53
|
+
- Build-time Pygments syntax highlighting (replaced client-side highlight.js)
|
|
54
|
+
- Build-time CSS, JS, and HTML minification with critical CSS inlining
|
|
55
|
+
- Gzip and Brotli pre-compression of build output
|
|
56
|
+
- Search JS externalized to `search.js` with lazy index loading
|
|
57
|
+
- Conditional JS inclusion based on page content
|
|
58
|
+
- ARIA labels on sidebar nav, TOC nav, and search dialog
|
|
59
|
+
- Dynamic theme toggle ARIA label indicating current state
|
|
60
|
+
- Roving tabindex on code tabs per WAI-ARIA pattern
|
|
61
|
+
- Table `<caption>` derived from preceding heading for screen readers
|
|
62
|
+
- 44px minimum touch targets on all interactive elements
|
|
63
|
+
- Heading anchors visible on touch devices
|
|
64
|
+
- Admonition icons (distinct SVG per type: info, lightbulb, warning triangle, octagon, exclamation)
|
|
65
|
+
- Card-style prev/next navigation links
|
|
66
|
+
- Styled generic `<details>/<summary>` in content
|
|
67
|
+
- Styled standalone `<dfn>` tags outside glossary context
|
|
68
|
+
- RSS feed link in site footer
|
|
69
|
+
- Fragment highlight animation when navigating to `#section` URLs
|
|
70
|
+
- Print stylesheet: 2cm margins, forced light colors, hidden breadcrumbs, code wrapping
|
|
71
|
+
- Topbar truncates long project names with ellipsis
|
|
72
|
+
- Security headers and trailing slash redirects for Cloudflare Pages
|
|
73
|
+
|
|
74
|
+
## 0.2.0
|
|
75
|
+
|
|
76
|
+
### Added
|
|
77
|
+
|
|
78
|
+
- Theme system with per-project theming via `"theme"` in selfdoc.json and optional `docs/custom.css` overrides
|
|
79
|
+
- Minimal theme: clean typography, dark mode, high-contrast, and reduced-motion variants (all auto-detected from OS preferences)
|
|
80
|
+
- Top bar with project name and version badge
|
|
81
|
+
- Heading anchor links for deep linking
|
|
82
|
+
- Syntax highlighting via highlight.js (light + dark themes)
|
|
83
|
+
- Google-style docstring formatting (Args, Returns, Raises rendered as structured lists)
|
|
84
|
+
|
|
85
|
+
### Fixed
|
|
86
|
+
|
|
87
|
+
- Heading hierarchy: directive expansions use h2/h3/h4 instead of injecting h1
|
|
88
|
+
- Module name mangling (`selfdoc.extractorsthon` bug)
|
|
89
|
+
- Nested `_build/_build` recursion when rebuilding
|
|
90
|
+
- Deploy supports `CF_ACCOUNT_ID` and `CF_PAGES_API_TOKEN` env var names (remapped to wrangler's expected names)
|
|
91
|
+
- CSS extracted to cacheable `style.css` instead of inlined per page
|
|
92
|
+
|
|
93
|
+
## 0.1.0
|
|
94
|
+
|
|
95
|
+
- Code-aware static site generator
|
|
96
|
+
- `:::directive` syntax for embedding code-extracted content
|
|
97
|
+
- Python, Go, TypeScript/JS extractors
|
|
98
|
+
- 5 built-in directives (module, schema, test, cli, config)
|
|
99
|
+
- Custom directive plugins
|
|
100
|
+
- `selfdoc check` coverage analysis
|
|
101
|
+
- HTML generation with responsive CSS
|
|
102
|
+
- Deploy to Cloudflare Pages + GitHub Pages
|
|
103
|
+
- SSE live reload in `selfdoc serve`
|
selfdoc-0.3.1/CLAUDE.md
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# selfdoc
|
|
2
|
+
|
|
3
|
+
Code-aware static site generator that resolves `:::directive` blocks in Markdown templates into content extracted from source code. Supports Python, Go, and TypeScript/JavaScript.
|
|
4
|
+
|
|
5
|
+
## Conventions
|
|
6
|
+
|
|
7
|
+
- Pure Python, zero runtime dependencies (stdlib only)
|
|
8
|
+
- Build system: hatchling
|
|
9
|
+
- Development: `uv` for all Python tooling (`uv sync`, `uv run`, `uv add`)
|
|
10
|
+
- Local development install: `uv pip install -e .`
|
|
11
|
+
- npm package is a thin Node wrapper (`bin/cli.js`) that delegates to `python3 -m selfdoc`
|
|
12
|
+
- File writes to shared state use atomic write (write to tmp, then `os.replace`)
|
|
13
|
+
- External calls (subprocess, network) must have timeouts
|
|
14
|
+
|
|
15
|
+
## Release workflow
|
|
16
|
+
|
|
17
|
+
This project uses [rlsbl](https://github.com/smm-h/rlsbl) for release orchestration.
|
|
18
|
+
|
|
19
|
+
- Update CHANGELOG.md with a `## X.Y.Z` entry describing changes
|
|
20
|
+
- Run `rlsbl release [patch|minor|major]` to bump version and create a GitHub Release
|
|
21
|
+
- CI handles publishing automatically via the publish workflow
|
|
22
|
+
- Never publish manually -- always use `rlsbl release`
|
|
23
|
+
- Requires NPM_TOKEN secret on GitHub (Settings > Secrets > Actions)
|
|
24
|
+
- Use `rlsbl release --dry-run` to preview a release without making changes
|
|
25
|
+
|
|
26
|
+
## Testing
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
uv run pytest
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Tests live in `tests/` and cover config loading, directive parsing, the build pipeline, and language-specific extractors (Python, Go).
|
|
33
|
+
|
|
34
|
+
## Architecture
|
|
35
|
+
|
|
36
|
+
- **Directive parser** (`selfdoc/directives.py`): state machine that tracks fenced code blocks and `:::name arg` / `:::` pairs. Two entry points: `parse_directives` (extract) and `resolve_directives` (replace in-place with resolver output).
|
|
37
|
+
- **Resolver** (`selfdoc/resolver.py`): factory that returns a `(name, arg, body) -> str` callable. Custom directives (from `selfdoc.json`) are checked first; otherwise dispatches to the language-specific extractor.
|
|
38
|
+
- **Extractors** (`selfdoc/extractors/`): per-language modules (`python.py`, `go.py`, `typescript.py`). Python uses `ast`; Go and TypeScript use regex-based parsing. Each extractor handles all 5 built-in directives (module, schema, test, cli, config).
|
|
39
|
+
- **Build** (`selfdoc/build.py`): scans `docs/` for `.md` templates, runs `resolve_directives` on each, converts to HTML, writes to output directory.
|
|
40
|
+
- **HTML** (`selfdoc/html.py`): built-in Markdown-to-HTML converter (no dependencies). Produces a static site with sidebar navigation and responsive CSS.
|
|
41
|
+
- **Config** (`selfdoc/config.py`): loads and validates `selfdoc.json`. Valid languages: python, go, typescript, javascript. Valid deploy providers: cloudflare-pages, github-pages.
|
|
42
|
+
- **Deploy** (`selfdoc/deploy.py`): Cloudflare Pages (via wrangler CLI) and GitHub Pages (force-push to gh-pages branch).
|
|
43
|
+
- **Check** (`selfdoc/check.py`): validates all directives resolve without error; computes documentation coverage (Python only: public symbol count vs. documented symbols).
|
|
44
|
+
- **CLI** (`selfdoc/cli.py`): argparse-based, subcommands: init, build, serve, deploy, check. Serve uses SSE-based live reload with mtime polling.
|
selfdoc-0.3.1/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 smm-h
|
|
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.
|
selfdoc-0.3.1/PKG-INFO
ADDED
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: selfdoc
|
|
3
|
+
Version: 0.3.1
|
|
4
|
+
Summary: Code-aware static site generator with directive-based content extraction
|
|
5
|
+
Project-URL: Repository, https://github.com/smm-h/selfdoc
|
|
6
|
+
Author: smm-h
|
|
7
|
+
License-Expression: MIT
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Keywords: docstring,documentation,jsdoc,rlsbl,selfdoc,static-site-generator
|
|
10
|
+
Requires-Python: >=3.11
|
|
11
|
+
Provides-Extra: og
|
|
12
|
+
Requires-Dist: predraw>=0.2.0; extra == 'og'
|
|
13
|
+
Provides-Extra: perf
|
|
14
|
+
Requires-Dist: brotli>=1.1; extra == 'perf'
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
|
|
17
|
+
# selfdoc
|
|
18
|
+
|
|
19
|
+
Code-aware static site generator that resolves `:::directive` blocks in Markdown templates into live content extracted from your source code.
|
|
20
|
+
|
|
21
|
+
Supports Python, Go, and TypeScript/JavaScript. Zero runtime dependencies -- pure Python stdlib.
|
|
22
|
+
|
|
23
|
+
## Install
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
pip install selfdoc
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
or via npm (delegates to Python under the hood):
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
npm install -g selfdoc
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Requires Python 3.11+.
|
|
36
|
+
|
|
37
|
+
## Quick start
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
# Initialize in an existing project (auto-detects language)
|
|
41
|
+
selfdoc init
|
|
42
|
+
|
|
43
|
+
# Edit docs/index.md -- add directives referencing your code
|
|
44
|
+
# (see Directive syntax below)
|
|
45
|
+
|
|
46
|
+
# Build HTML output
|
|
47
|
+
selfdoc build
|
|
48
|
+
|
|
49
|
+
# Serve locally with live reload
|
|
50
|
+
selfdoc serve
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Directive syntax
|
|
54
|
+
|
|
55
|
+
Directives are fenced blocks in your Markdown templates. They get replaced with content extracted from your source code at build time.
|
|
56
|
+
|
|
57
|
+
```
|
|
58
|
+
:::name arg
|
|
59
|
+
:::
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Everything between `:::name arg` and the closing `:::` is the directive body (optional, depends on the directive). Directives inside fenced code blocks are ignored.
|
|
63
|
+
|
|
64
|
+
## Built-in directives
|
|
65
|
+
|
|
66
|
+
| Directive | Arg | Description |
|
|
67
|
+
| --------- | --- | ----------- |
|
|
68
|
+
| `module` | dotted.path or file path | Extract module/package docstrings, exported functions, classes |
|
|
69
|
+
| `schema` | file.json or module ClassName | Extract dataclass fields or JSON keys as a table |
|
|
70
|
+
| `test` | file_path [TestName] | Embed test source code (whole file or specific function/class) |
|
|
71
|
+
| `cli` | module path | Extract CLI help/usage text and flag definitions |
|
|
72
|
+
| `config` | file path | Render JSON/TOML config files as key-value tables |
|
|
73
|
+
|
|
74
|
+
Example -- embed the API docs for a Python module:
|
|
75
|
+
|
|
76
|
+
```markdown
|
|
77
|
+
## API Reference
|
|
78
|
+
|
|
79
|
+
:::module selfdoc.config
|
|
80
|
+
:::
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Example -- show a JSON schema as a table:
|
|
84
|
+
|
|
85
|
+
```markdown
|
|
86
|
+
:::schema selfdoc.json
|
|
87
|
+
:::
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Custom directives
|
|
91
|
+
|
|
92
|
+
Register custom directives in `selfdoc.json` under the `directives` key. Each entry maps a directive name to a Python script (relative to project root) that exports a `resolve(arg, config)` function returning a Markdown string.
|
|
93
|
+
|
|
94
|
+
```json
|
|
95
|
+
{
|
|
96
|
+
"directives": {
|
|
97
|
+
"changelog": "scripts/changelog_directive.py"
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Script interface:
|
|
103
|
+
|
|
104
|
+
```python
|
|
105
|
+
def resolve(arg: str, config: dict) -> str:
|
|
106
|
+
"""Return Markdown string to replace the directive block."""
|
|
107
|
+
...
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Use in templates:
|
|
111
|
+
|
|
112
|
+
```markdown
|
|
113
|
+
:::changelog v1.0.0
|
|
114
|
+
:::
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Custom directives take priority over built-in names.
|
|
118
|
+
|
|
119
|
+
## Configuration
|
|
120
|
+
|
|
121
|
+
`selfdoc.json` at the project root:
|
|
122
|
+
|
|
123
|
+
```json
|
|
124
|
+
{
|
|
125
|
+
"language": "python",
|
|
126
|
+
"source": ["selfdoc/"],
|
|
127
|
+
"docs": "docs/",
|
|
128
|
+
"output": "docs/_build/",
|
|
129
|
+
"deploy": {
|
|
130
|
+
"provider": "cloudflare-pages",
|
|
131
|
+
"project": "my-docs"
|
|
132
|
+
},
|
|
133
|
+
"directives": {}
|
|
134
|
+
}
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
| Field | Required | Default | Description |
|
|
138
|
+
| ----- | -------- | ------- | ----------- |
|
|
139
|
+
| `language` | yes | -- | `python`, `go`, `typescript`, or `javascript` |
|
|
140
|
+
| `source` | yes | -- | List of source directories to scan |
|
|
141
|
+
| `docs` | no | `docs/` | Directory containing Markdown templates |
|
|
142
|
+
| `output` | no | `docs/_build/` | Directory for generated HTML output |
|
|
143
|
+
| `deploy` | no | -- | Deploy provider config (see Deploy below) |
|
|
144
|
+
| `directives` | no | `{}` | Custom directive script mappings |
|
|
145
|
+
|
|
146
|
+
`selfdoc init` auto-detects language and source paths from project files (pyproject.toml, go.mod, tsconfig.json, package.json).
|
|
147
|
+
|
|
148
|
+
## Commands
|
|
149
|
+
|
|
150
|
+
| Command | Description |
|
|
151
|
+
| ------- | ----------- |
|
|
152
|
+
| `selfdoc init` | Initialize selfdoc in the current project (creates selfdoc.json + starter template) |
|
|
153
|
+
| `selfdoc build` | Resolve directives and generate HTML to the output directory |
|
|
154
|
+
| `selfdoc serve [--port PORT]` | Serve built docs locally with SSE-based live reload (default port 8000) |
|
|
155
|
+
| `selfdoc deploy` | Deploy docs to the configured provider |
|
|
156
|
+
| `selfdoc check` | Validate all directives resolve successfully; report documentation coverage |
|
|
157
|
+
|
|
158
|
+
## Deploy
|
|
159
|
+
|
|
160
|
+
### Cloudflare Pages
|
|
161
|
+
|
|
162
|
+
Requires the [Wrangler CLI](https://developers.cloudflare.com/workers/wrangler/) installed and authenticated.
|
|
163
|
+
|
|
164
|
+
```json
|
|
165
|
+
{
|
|
166
|
+
"deploy": {
|
|
167
|
+
"provider": "cloudflare-pages",
|
|
168
|
+
"project": "my-docs-project"
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
```bash
|
|
174
|
+
selfdoc build && selfdoc deploy
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
### GitHub Pages
|
|
178
|
+
|
|
179
|
+
Pushes the output directory to the `gh-pages` branch via force-push.
|
|
180
|
+
|
|
181
|
+
```json
|
|
182
|
+
{
|
|
183
|
+
"deploy": {
|
|
184
|
+
"provider": "github-pages"
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
Enable GitHub Pages in your repo settings (source: `gh-pages` branch).
|
|
190
|
+
|
|
191
|
+
## Integration with rlsbl
|
|
192
|
+
|
|
193
|
+
When [rlsbl](https://github.com/smm-h/rlsbl) detects a `selfdoc.json` in the project, it can trigger `selfdoc build` and `selfdoc deploy` as part of the release lifecycle via the `.rlsbl/hooks/post-release.sh` hook.
|
|
194
|
+
|
|
195
|
+
## License
|
|
196
|
+
|
|
197
|
+
MIT
|