From 9b1a14c9bbe5797e67fb7c7790c20c492ad43637 Mon Sep 17 00:00:00 2001 From: Nikolay Gagarinov Date: Tue, 12 May 2026 22:21:40 +0500 Subject: [PATCH] add rumdl --- CLAUDE.md | 35 +++++++++++++++++++++++++++++++++++ Dockerfile | 4 +++- common/.rumdl.toml | 3 +++ common/common.mk | 9 +++++++-- 4 files changed, 48 insertions(+), 3 deletions(-) create mode 100644 CLAUDE.md create mode 100644 common/.rumdl.toml diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..2f4020f --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,35 @@ +# CLAUDE.md + +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. + +## Commands + +```bash +make build # docker buildx build -t hexletbasics/base-image . +make push # docker push hexletbasics/base-image +``` + +Validation (used by derived images via `common/common.mk`): + +```bash +make check # runs all checks: description-lint, schema-validate, test +make description-lint # yamllint on module description YAML files +make schema-validate # ajv-cli validates spec/language/module/lesson YAML against JSON schemas +make test # runs tests in all module Makefiles +``` + +## Architecture + +This is a Docker base image for HexletBasics's coding exercise platform. Derived images extend it with language-specific runtimes (Python, Ruby, Java, etc.). + +**Base image** (`Dockerfile`): built from `node:25-slim`, includes pnpm, python3, git, jq, yamllint, yq, ajv-cli. Published to DockerHub as `hexletbasics/base-image:latest`. + +**Multi-arch strategy**: amd64 is built and pushed on every push to `main` (GitHub Actions). arm64 is built nightly on an ARM64 runner. A combined multi-arch manifest is created and pushed as `:latest` after the nightly arm64 build. + +**`common/` directory**: copied into derived images at `/opt/basics/common`. Contains: +- JSON schemas (`spec.json`, `module.json`, `language.json`, `lesson.json`) for validating course content YAML +- Validation shell scripts in `common/bin/` that call `ajv-cli` +- `common.mk` — a shared Makefile included by derived image repos to run the full validation chain +- `yamllint.yml` — shared yamllint config (line-length checks disabled) + +Derived image repos include `common.mk` via `include /opt/basics/common/common.mk` and rely on this image being available on DockerHub. diff --git a/Dockerfile b/Dockerfile index daed4f0..7a00958 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,7 +5,7 @@ ENV LANG=C.UTF-8 ENV LC_ALL=C.UTF-8 ENV DEBIAN_FRONTEND=noninteractive ENV PNPM_HOME="/pnpm" -ENV PATH="$PNPM_HOME:$PATH" +ENV PATH="$PNPM_HOME/bin:$PNPM_HOME:$PATH" RUN rm -f /etc/apt/apt.conf.d/docker-clean \ && echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache @@ -22,4 +22,6 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ RUN pnpm install -g ajv-cli +RUN pip install rumdl --break-system-packages + COPY ./common /opt/basics/common diff --git a/common/.rumdl.toml b/common/.rumdl.toml new file mode 100644 index 0000000..80517ec --- /dev/null +++ b/common/.rumdl.toml @@ -0,0 +1,3 @@ +# TODO: move to base image +[global] +disable = ["MD013", "MD041", "MD033"] diff --git a/common/common.mk b/common/common.mk index 16be346..54aaea9 100755 --- a/common/common.mk +++ b/common/common.mk @@ -1,6 +1,6 @@ COMMON_DIR := /opt/basics/common -check: description-lint code-lint schema-validate test +check: description-lint code-lint schema-validate markdown-lint test description-lint: yamllint modules -c $(COMMON_DIR)/yamllint.yml @@ -8,7 +8,12 @@ description-lint: test: @(for i in $$(find modules/** -type f -name Makefile); do make test -C $$(dirname $$i) || exit 1; done) -# TODO: add markdown linter and spellckeck (languagetool) +markdown-lint: + rumdl check --config $(COMMON_DIR)/.rumdl.toml modules + +markdown-lint-fix: + rumdl fmt --config $(COMMON_DIR)/.rumdl.toml modules + schema-validate: @$(COMMON_DIR)/bin/validate-spec.sh @$(COMMON_DIR)/bin/validate-language.sh