diff --git a/.github/workflows/lint-docs.yml b/.github/workflows/lint-docs.yml new file mode 100644 index 0000000..1044bba --- /dev/null +++ b/.github/workflows/lint-docs.yml @@ -0,0 +1,28 @@ +name: Lint Documentation + +on: + pull_request: + paths: + - 'docs/**' + - '*_versioned_docs/**' + - 'README.md' + - '.vale.ini' + - 'styles/**' + +jobs: + vale: + name: Vale + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Vale Linter + uses: errata-ai/vale-action@reviewdog + with: + files: docs + fail_on_error: true + filter_mode: added + reporter: github-pr-review + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.gitignore b/.gitignore index e81c415..ce8f35d 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,7 @@ yarn-error.log* # VSCode Settings .vscode .history/ + +# Vale packages (downloaded by `vale sync`) +styles/Google/ +styles/write-good/ diff --git a/.vale.ini b/.vale.ini new file mode 100644 index 0000000..cb94162 --- /dev/null +++ b/.vale.ini @@ -0,0 +1,29 @@ +# Vale configuration for Source Network documentation site +# Documentation linter based on brand guidelines +StylesPath = styles +MinAlertLevel = suggestion +Packages = Google, write-good +Vocab = DefraDB + +[*] +BasedOnStyles = Vale, Google, write-good, DefraDB +# Disable Vale.Terms - we use custom DefraDB.ProductNames and DefraDB.TechTerms instead +Vale.Terms = NO + +[*.{md,mdx}] +BasedOnStyles = Vale, Google, write-good, DefraDB +Vale.Terms = NO + +# CLI reference docs - relax some rules +[docs/defradb/references/cli/*.md] +Google.Headings = suggestion +DefraDB.Hedging = suggestion + +# Release notes - allow different voice +[docs/*/release?notes/*.md] +DefraDB.Voice = NO +DefraDB.CorporateSpeak = suggestion + +# Versioned docs - same rules as main docs +[*_versioned_docs/**/*.{md,mdx}] +BasedOnStyles = Vale, Google, write-good, DefraDB diff --git a/Makefile b/Makefile index f7e2845..7bb4883 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY: version\:replace help +.PHONY: version\:replace help lint\:docs lint\:docs\:strict vale\:sync deps\:lint-docs # Color codes for output RED := \033[0;31m @@ -11,20 +11,23 @@ NC := \033[0m # No Color VALID_PROJECTS := defradb sourcehub orbis lensvm help: - @echo "$(BLUE)Docusaurus Version Management$(NC)" + @echo "$(BLUE)Source Network Documentation Tools$(NC)" @echo "" - @echo "$(GREEN)Available commands:$(NC)" + @echo "$(GREEN)Version Management:$(NC)" @echo " make version:replace PROJECT= VERSION=" + @echo " Regenerates and replaces Docusaurus versioned docs for a specific version" + @echo " PROJECT: defradb, sourcehub, orbis, lensvm" + @echo " VERSION: must exist in _versions.json" @echo "" - @echo "$(GREEN)Description:$(NC)" - @echo " Regenerates and replaces Docusaurus versioned docs for a specific version" + @echo "$(GREEN)Documentation Linting:$(NC)" + @echo " make deps:lint-docs - Install Vale documentation linter" + @echo " make vale:sync - Sync Vale style packages" + @echo " make lint:docs - Run Vale on all documentation (all levels)" + @echo " make lint:docs:strict - Run Vale (errors only)" @echo "" - @echo "$(GREEN)Arguments:$(NC)" - @echo " PROJECT - Project name (defradb, sourcehub, orbis, lensvm)" - @echo " VERSION - Version identifier (must exist in _versions.json)" - @echo "" - @echo "$(GREEN)Example:$(NC)" + @echo "$(GREEN)Examples:$(NC)" @echo " make version:replace PROJECT=defradb VERSION=0.19.0" + @echo " make lint:docs" @echo "" version\:replace: @@ -145,3 +148,35 @@ version\:replace: @echo " 2. Test the docs locally with: npm run start" @echo " 3. Commit the changes when satisfied" @echo "" + +# ============================================================================ +# Vale Documentation Linting +# ============================================================================ + +deps\:lint-docs: + @echo "$(BLUE)Installing Vale documentation linter...$(NC)" + @if command -v vale >/dev/null 2>&1; then \ + echo "$(GREEN)✓ Vale is already installed$(NC)"; \ + vale --version; \ + else \ + echo "$(YELLOW)Installing Vale via Homebrew...$(NC)"; \ + brew install vale; \ + fi + +vale\:sync: + @echo "$(BLUE)Syncing Vale style packages...$(NC)" + @vale sync + @echo "$(GREEN)✓ Vale packages synced$(NC)" + +lint\:docs: vale\:sync + @echo "$(BLUE)Running Vale documentation linter...$(NC)" + @echo "" + @vale --minAlertLevel=suggestion docs README.md || true + @echo "" + @echo "$(GREEN)Linting complete.$(NC)" + @echo "$(YELLOW)Note: Run 'make lint:docs:strict' to see only errors.$(NC)" + +lint\:docs\:strict: vale\:sync + @echo "$(BLUE)Running Vale documentation linter (errors only)...$(NC)" + @echo "" + @vale --minAlertLevel=error docs README.md diff --git a/README.md b/README.md index 197673a..79e38fb 100644 --- a/README.md +++ b/README.md @@ -19,12 +19,12 @@ Most changes are reflected live without having to restart the server. This website is built using [Docusaurus 2](https://docusaurus.io/). -Documentation is written using [common markdown syntax](https://commonmark.org/help/) or [MDX syntax](https://mdxjs.com/docs/what-is-mdx/#mdx-syntax) - the file extension will determine the syntax (.md for common markdown and .mdx for MDX). +Documentation is written using [common markdown syntax](https://commonmark.org/help/) or [MDX syntax](https://mdxjs.com/docs/what-is-mdx/#mdx-syntax). Use `.md` files for common markdown and `.mdx` files for MDX. ## Deployment -The website is automatically deployed using Cloudfare Pages. +The website is automatically deployed using Cloudflare Pages. ## Contributing -Feedback and pull requests appreciated! \ No newline at end of file +Feedback and pull requests appreciated. \ No newline at end of file diff --git a/styles/DefraDB/Acronyms.yml b/styles/DefraDB/Acronyms.yml new file mode 100644 index 0000000..89bbdc4 --- /dev/null +++ b/styles/DefraDB/Acronyms.yml @@ -0,0 +1,46 @@ +extends: conditional +message: "Define acronym '%s' on first use in this document" +level: warning +link: https://docs.source.network +scope: text +ignorecase: true +first: '\b([A-Z]{2,})\b' +second: '(?:[A-Z][a-z][\w\-]+ )+\(([A-Z]{2,})\)' +exceptions: + # Common acronyms that don't need definition + - API + - CLI + - HTTP + - HTTPS + - JSON + - REST + - SQL + - URL + - UI + - UX + - ID + - SDK + - TLS + - SSL + - TCP + - UDP + - IP + - DNS + - SSH + - CPU + - RAM + - I/O + - OS + + # DefraDB-specific acronyms + - CRUD + - CORS + - P2P + - IoT + - NAT + - DHT + - RPC + - AMI + - DSL + - ACP + - DQL diff --git a/styles/DefraDB/CorporateSpeak.yml b/styles/DefraDB/CorporateSpeak.yml new file mode 100644 index 0000000..f93191c --- /dev/null +++ b/styles/DefraDB/CorporateSpeak.yml @@ -0,0 +1,29 @@ +extends: existence +message: "Avoid corporate buzzword '%s' - be specific and direct instead" +level: warning +link: https://docs.source.network +ignorecase: true +scope: text +tokens: + # Corporate buzzwords from brand guidelines + - leverage + - leveraging + - synergy + - synergistic + - synergies + - cutting-edge + - revolutionary + - revolutionize + - unparalleled + - best-in-class + - world-class + - paradigm shift + - next-generation + - enterprise-grade + - mission-critical + - turnkey + - seamlessly + - holistic + - robust solution + - comprehensive solution + - end-to-end solution diff --git a/styles/DefraDB/GrandioseClaims.yml b/styles/DefraDB/GrandioseClaims.yml new file mode 100644 index 0000000..b176515 --- /dev/null +++ b/styles/DefraDB/GrandioseClaims.yml @@ -0,0 +1,22 @@ +extends: existence +message: "Avoid unsupported claim '%s' - provide specific evidence or proof instead" +level: warning +link: https://docs.source.network +ignorecase: true +scope: text +nonword: true +tokens: + - the best + - the leading + - the most secure + - the fastest + - the only + - the ultimate + - the perfect + - the ideal + - industry-leading + - market-leading + - award-winning + - groundbreaking + - 'number one' + - '#1' diff --git a/styles/DefraDB/Headings.yml b/styles/DefraDB/Headings.yml new file mode 100644 index 0000000..d689c90 --- /dev/null +++ b/styles/DefraDB/Headings.yml @@ -0,0 +1,49 @@ +extends: capitalization +message: "Headings should use title case: '%s'" +level: suggestion +link: https://docs.source.network +scope: heading +match: $title +style: AP +exceptions: + # Product names + - DefraDB + - SourceHub + - Orbis + - LensVM + + # Technology names + - MongoDB + - PostgreSQL + - GraphQL + - IPFS + - libp2p + - WebAssembly + + # Terms with specific casing + - edge-first + - local-first + - open source + - open web + - iOS + - macOS + - JavaScript + - TypeScript + + # Acronyms + - API + - CLI + - SDK + - HTTP + - JSON + - REST + - SQL + - CRUD + - CORS + - P2P + - IoT + - ACP + - DQL + - CRDT + - DAG + - CID diff --git a/styles/DefraDB/Hedging.yml b/styles/DefraDB/Hedging.yml new file mode 100644 index 0000000..13fe005 --- /dev/null +++ b/styles/DefraDB/Hedging.yml @@ -0,0 +1,32 @@ +extends: existence +message: "Remove hedging word '%s' - be direct and confident" +level: suggestion +link: https://docs.source.network +ignorecase: true +scope: text +tokens: + # Weak qualifiers that undermine technical writing + - simply + - just + - easily + - easy + - obviously + - clearly + - basically + - actually + - really + - very + - quite + - rather + - somewhat + - fairly + - kind of + - sort of +exceptions: + # Allow "just" in time contexts + - just released + - just shipped + - just launched + # Allow "simply" in specific technical contexts + - simply put + - put simply diff --git a/styles/DefraDB/NoteFormat.yml b/styles/DefraDB/NoteFormat.yml new file mode 100644 index 0000000..320e1b6 --- /dev/null +++ b/styles/DefraDB/NoteFormat.yml @@ -0,0 +1,17 @@ +extends: existence +message: "Use standard note format: '**Note:** text' instead of '%s'" +level: suggestion +link: https://docs.source.network +ignorecase: false +scope: text +nonword: true +tokens: + - 'Note:' + - 'NOTE:' + - '\*Note\*:' + - '\*NOTE\*:' +raw: + - '^Note: ' + - '^NOTE: ' + - '^\*Note\*: ' + - '^\*NOTE\*: ' diff --git a/styles/DefraDB/PreferredTerms.yml b/styles/DefraDB/PreferredTerms.yml new file mode 100644 index 0000000..5ab1de5 --- /dev/null +++ b/styles/DefraDB/PreferredTerms.yml @@ -0,0 +1,23 @@ +extends: substitution +message: "Consider using '%s' instead of '%s' for brand consistency" +level: suggestion +link: https://docs.source.network +ignorecase: true +swap: + # Preferred brand terminology from guidelines + blockchain: trust protocol|trust layer + whitelist: allow list + blacklist: deny list + master: primary|main + slave: replica|secondary + + # Database terminology + db: database + NoSQL: NoSQL database + + # Simplification + utilize: use + utilizes: uses + utilization: use + facilitate: help|enable + facilitates: helps|enables diff --git a/styles/DefraDB/ProductNames.yml b/styles/DefraDB/ProductNames.yml new file mode 100644 index 0000000..12d192b --- /dev/null +++ b/styles/DefraDB/ProductNames.yml @@ -0,0 +1,27 @@ +extends: substitution +message: "Use '%s' instead of '%s' for correct product branding" +level: error +link: https://docs.source.network +ignorecase: false +swap: + # Product name corrections + defraDB: DefraDB + defra DB: DefraDB + defra: DefraDB + Source Hub: SourceHub + Sourcehub: SourceHub + source hub: SourceHub + + # Technology name corrections + Mongodb: MongoDB + mongo: MongoDB + mongo db: MongoDB + Postgres: PostgreSQL + postgres: PostgreSQL + postgres sql: PostgreSQL + Graphql: GraphQL + graphql: GraphQL + Typescript: TypeScript + typescript: TypeScript + Javascript: JavaScript + javascript: JavaScript diff --git a/styles/DefraDB/SourceStack.yml b/styles/DefraDB/SourceStack.yml new file mode 100644 index 0000000..6ed70fd --- /dev/null +++ b/styles/DefraDB/SourceStack.yml @@ -0,0 +1,10 @@ +extends: substitution +message: "Use 'Source stack' instead of '%s' - Source is a stack, not a platform" +level: warning +link: https://docs.source.network +ignorecase: false +swap: + Source platform: Source stack + the Source platform: the Source stack + our platform: our stack + the platform: the stack diff --git a/styles/DefraDB/TechTerms.yml b/styles/DefraDB/TechTerms.yml new file mode 100644 index 0000000..4675581 --- /dev/null +++ b/styles/DefraDB/TechTerms.yml @@ -0,0 +1,25 @@ +extends: substitution +message: "Use '%s' instead of '%s' for correct technical terminology" +level: error +link: https://docs.source.network +ignorecase: false +swap: + # Edge computing terms (must be lowercase) + Edge-first software: edge-first software + Edge-First Software: edge-first software + Local-first software: local-first software + Local-First Software: local-first software + Local-first Software: local-first software + Edge Compute: edge compute + Edge compute: edge compute + Open Source: open source + Open Web: open web + + # Terms that should be capitalized + edge ai: Edge AI + internet of things: Internet of Things + big tech: Big Tech + + # Web3 terminology + dweb: Dweb + DWeb: Dweb diff --git a/styles/DefraDB/Voice.yml b/styles/DefraDB/Voice.yml new file mode 100644 index 0000000..7d9cd67 --- /dev/null +++ b/styles/DefraDB/Voice.yml @@ -0,0 +1,18 @@ +extends: existence +message: "Speak TO developers (second person) not ABOUT them - use 'you' instead of '%s'" +level: suggestion +link: https://docs.source.network +ignorecase: true +scope: paragraph +raw: + - '(?:the )?developers? (?:will|can|should|must|need to|want to|think|believe|feel)' + - '(?:the )?users? (?:will|can|should|must|need to|want to|think|believe|feel)' + - 'allows? (?:the )?developers? to' + - 'enables? (?:the )?developers? to' +exceptions: + # Allow in specific contexts + - "if developers" + - "when developers" + - "as developers" + - "help developers" + - "for developers" diff --git a/styles/config/vocabularies/DefraDB/accept.txt b/styles/config/vocabularies/DefraDB/accept.txt new file mode 100644 index 0000000..5f84120 --- /dev/null +++ b/styles/config/vocabularies/DefraDB/accept.txt @@ -0,0 +1,242 @@ +# DefraDB Vocabulary - Accepted Terms +# These terms are considered correct and will not be flagged by Vale.Terms +# Lines starting with # are comments. +# Regex patterns are supported for case variations. + +# Product Names +DefraDB +defra +Defra +SourceHub +Orbis +LensVM +Sourcerers + +# External Products & Services +Cloudflare +GitHub +github +Akash +DGraph +vite +Vite + +# Technical Terms - Database Technologies +MongoDB +PostgreSQL +GraphQL +graphQL +ArangoDB +CouchDB +Redis +config +Config +param +Param +params +Params + +# Technical Terms - Edge Computing +edge-first +Edge-first +local-first +Local-first +Edge AI +edge AI +edge compute +Edge compute +edge computing +Edge computing +edge environments +Edge environments +edge devices +Edge devices + +# Technical Terms - Distributed Systems +distributed environments +Distributed environments +peer-to-peer +Peer-to-Peer +P2P +p2p +CRDT +CRDTs +crdt +Merkle +merkle +Merkle-CRDT +Merkle CRDT +DAG +dag +IPFS +ipfs +IPLD +libp2p +LibP2P +deduplicated +deduplication +Deduplicated +Deduplication +whitepaper +Whitepaper +pubsub +Pubsub +PubSub +subnet +subnets +Subnet +Subnets + +# Technical Terms - Web3 & Decentralization +Web3 +Dweb +blockchain +Blockchain +decentralized +Decentralized +trustless +Trustless +permissionless +Permissionless +smart contract +smart contracts +Smart contract +Smart contracts +Ethereum +Bitcoin +Filecoin +Polkadot +Cosmos +testnet +Testnet +mainnet +Mainnet + +# Technical Terms - Access Control +userset +Userset +usersets +Usersets +reachability +Reachability + +# Technical Terms - Cryptography & Identity +keypair +Keypair +keypairs +Keypairs + +# Technical Terms - General Programming +WebAssembly +wasm +Wasm +WASM +TypeScript +JavaScript +DQL +gql +Gql +GQL +stdin +Stdin +stdout +Stdout +tx +txn +Tx +Txn +repo +Repo +repos +Repos +func +funcs +Func +Funcs +groupBy +GroupBy +getall +Getall +fieldId +FieldId +dockey +Dockey +docID +docIDs +DocID +DocIDs +lookup +lookups +Lookup +Lookups +readme +Readme +README +inorder +Inorder + +# Acronyms & Abbreviations (both cases for code contexts) +API +APIs +api +CLI +cli +SDK +sdk +HTTP +http +HTTPS +https +JSON +json +REST +rest +CRUD +TLS +CORS +SQL +sql +IoT +DHT +DHTs +dht +RPC +rpc +NAT +AMI +DSL +ACP +acp +CID +CIDs +cid + +# License acronyms (Creative Commons) +CC +BY +SA + +# File extensions and formats +mdx +Mdx +MDX + +# Industry Terms +Big Tech +Internet of Things +open source +open web + +# Brand-Specific Terms +cloud-last +trust protocol +trust layer +data sovereignty + +# Docusaurus-specific +Docusaurus + +# Author names (from docs examples) +Grisham +Zanzi +[Cc]onnor diff --git a/styles/config/vocabularies/DefraDB/reject.txt b/styles/config/vocabularies/DefraDB/reject.txt new file mode 100644 index 0000000..e29840a --- /dev/null +++ b/styles/config/vocabularies/DefraDB/reject.txt @@ -0,0 +1,35 @@ +# DefraDB Vocabulary - Rejected Terms +# These terms should be avoided and will be flagged as errors. +# Lines starting with # are comments. + +# Incorrect Product Name Variations +Defra(?!DB) +defraDB +defra DB +Source Hub +Sourcehub +source hub + +# Hedging Language (flagged by separate rule, listed here for reference) +simply +just +easily +obviously +clearly +basically + +# Weak Qualifiers +very +really +quite +rather +somewhat +fairly + +# Corporate Buzzwords (flagged by separate rule) +leverage +synergy +synergistic +paradigm shift +best-in-class +world-class