Skip to content

feat: config docs generator #6171

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 25 commits into from
Jun 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
a6f68bd
Add config-docs-generator tool for automated documentation generation
Jiloc Jun 3, 2025
5d74eee
move Dockerfile to the right folder
Jiloc Jun 3, 2025
5f353cb
clippy and fmt
Jiloc Jun 3, 2025
0ad7569
add support for @required and @units annotations. Implement parsing f…
Jiloc Jun 4, 2025
e5b6f92
add documentation of format
Jiloc Jun 4, 2025
dcef804
improve html formatting
Jiloc Jun 4, 2025
d2a0bfa
Merge branch 'chore/enhance-config-docs' into feat/config-docs-generator
Jiloc Jun 4, 2025
d5084f9
update configuration-reference.md
Jiloc Jun 4, 2025
4aeb7c1
Merge branch 'chore/enhance-config-docs' into feat/config-docs-generator
Jiloc Jun 4, 2025
fe86039
update reference
Jiloc Jun 4, 2025
a2b1508
add custom section mappings and template support
Jiloc Jun 6, 2025
51c0e10
fix tests
Jiloc Jun 6, 2025
cb07367
Merge branch 'chore/enhance-config-docs' into feat/config-docs-generator
Jiloc Jun 10, 2025
90de815
update generated docs
Jiloc Jun 10, 2025
31beefe
remove CARGO_HOME from dockerfile
Jiloc Jun 10, 2025
c2212a2
simplify json parsing logic
Jiloc Jun 10, 2025
45917e4
improve test coverage
Jiloc Jun 10, 2025
d40be62
make required parsing strict. only true/false
Jiloc Jun 10, 2025
39ddc9c
use mapping file for TARGET_STRUCTS
Jiloc Jun 12, 2025
01005ce
Merge branch 'develop' into feat/config-docs-generator
Jiloc Jun 13, 2025
5e5e6a2
do not run docker as root
Jiloc Jun 16, 2025
358fe35
remove generated configuration documentation
Jiloc Jun 16, 2025
e36db35
Merge branch 'develop' into feat/config-docs-generator
Jiloc Jun 16, 2025
0366c26
add prerequisites for running locally
Jiloc Jun 17, 2025
826c7cc
generate docs in target folder
Jiloc Jun 17, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ testnet/index.html
/testnet/helium/target/
/contrib/tools/puppet-chain/target/
/contrib/core-contract-tests/.cache/
/contrib/tools/config-docs-generator/target/

# These are backup files generated by rustfmt
**/*.rs.bk
Expand Down
86 changes: 86 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ members = [
"contrib/tools/relay-server",
"libsigner",
"stacks-signer",
"testnet/stacks-node"]
"testnet/stacks-node",
"contrib/tools/config-docs-generator"]

# Dependencies we want to keep the same between workspace members
[workspace.dependencies]
Expand Down
30 changes: 30 additions & 0 deletions contrib/tools/config-docs-generator/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
[package]
name = "config-docs-generator"
version = "0.1.0"
edition = "2024"

[[bin]]
name = "extract-docs"
path = "src/extract_docs.rs"

[[bin]]
name = "generate-markdown"
path = "src/generate_markdown.rs"

# Add integration test configuration
[[test]]
name = "integration"
path = "tests/integration.rs"

[dependencies]
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
clap = { version = "4.0", features = ["derive"] }
regex = "1.0"
anyhow = "1.0"
once_cell = "1.18"

# Add test dependencies
[dev-dependencies]
tempfile = "3.0"
assert_cmd = "2.0"
38 changes: 38 additions & 0 deletions contrib/tools/config-docs-generator/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Use a specific nightly toolchain for reproducible builds
FROM rustlang/rust@sha256:04690ffa09cddd358b349272173155319f384e57816614eea0840ec7f9422862

RUN apt-get update -y \
&& apt-get install -y --no-install-recommends \
jq \
&& rm -rf /var/lib/apt/lists/*

# Set the working directory for building
WORKDIR /build

# Copy the entire project root to preserve structure
# Copy from three levels up (project root) to maintain the directory structure
COPY ../../../ /build

RUN useradd -ms /bin/bash docs-builder
RUN chown docs-builder -R /build
USER docs-builder

# Pre-build the config-docs-generator binaries during image build
RUN cargo build --package config-docs-generator --release

# Set the working directory where the project will be mounted at runtime
WORKDIR /project_root

# Set environment variables for generate-config-docs.sh
ENV PROJECT_ROOT=/project_root \
CARGO_TARGET_DIR=/tmp/stacks-config-docs/target \
TEMP_DIR=/tmp/stacks-config-docs/doc-generation \
EXTRACT_DOCS_BIN=/build/target/release/extract-docs \
GENERATE_MARKDOWN_BIN=/build/target/release/generate-markdown \
OUTPUT_DIR=/project_root/target/generated-docs \
SKIP_BUILD=true

# Create the Docker-specific temp directory
RUN mkdir -p /tmp/stacks-config-docs

ENTRYPOINT ["/build/generate-config-docs.sh"]
Loading
Loading