documentation-sync
Synchronize version numbers across any project type using version file adapters
What this skill does
# Documentation Sync
## Purpose
Updates version numbers in version files (using appropriate adapters) and documentation files for any project type. Supports Node.js, Python, Rust, Go, Java, generic projects, and Claude Code plugins. Handles multiple version files and documentation references.
## Input Context
Requires:
- **Project Configuration**: Output from `detect-project-type` skill
- **Old Version**: Previous version string (e.g., "1.1.0")
- **New Version**: New version string (e.g., "1.2.0")
## Workflow
### 1. Load Project Configuration
Use configuration from `detect-project-type`:
- `version_files` - List of version files with adapters
- `documentation_files` - Files to search for version references
- `project_type` - Determines file update strategy
### 2. Update Version Files
For each version file, use the appropriate adapter to update the version.
See [Version Adapters Reference](../../docs/version-adapters.md) for implementation details.
**JSON files (package.json, plugin.json, etc.):**
```bash
file="package.json"
old_version="1.1.0"
new_version="1.2.0"
# Update using jq
jq --indent 2 ".version = \"$new_version\"" "$file" > tmp.json && mv tmp.json "$file"
# Verify update
updated_version=$(jq -r '.version' "$file")
if [ "$updated_version" = "$new_version" ]; then
echo "✓ Updated $file: $old_version → $new_version"
else
echo "✗ Failed to update $file"
fi
```
**TOML files (Cargo.toml, pyproject.toml):**
```bash
file="Cargo.toml"
# Update version in [package] section
sed -i '/^\[package\]/,/^\[/ s/^version = ".*"/version = "'"$new_version"'"/' "$file"
# For pyproject.toml [project] section
sed -i '/^\[project\]/,/^\[/ s/^version = ".*"/version = "'"$new_version"'"/' pyproject.toml
# For pyproject.toml [tool.poetry] section
sed -i '/^\[tool.poetry\]/,/^\[/ s/^version = ".*"/version = "'"$new_version"'"/' pyproject.toml
# Verify
updated_version=$(grep '^version = ' "$file" | head -1 | sed 's/version = "\(.*\)"/\1/')
```
**Python __version__.py files:**
```bash
file="src/mypackage/__version__.py"
# Update __version__ variable
sed -i 's/^__version__ = ".*"/__version__ = "'"$new_version"'"/' "$file"
# Verify
updated_version=$(grep '^__version__ = ' "$file" | sed 's/__version__ = "\(.*\)"/\1/')
```
**Text files (VERSION, version.txt):**
```bash
file="VERSION"
# Simply write new version
echo "$new_version" > "$file"
# Verify
updated_version=$(cat "$file" | tr -d '[:space:]')
```
**Gradle files:**
```bash
# gradle.properties
sed -i 's/^version=.*/version='"$new_version"'/' gradle.properties
# build.gradle (single quotes)
sed -i "s/^version = '.*'/version = '${new_version}'/" build.gradle
# build.gradle (double quotes)
sed -i 's/^version = ".*"/version = "'"$new_version"'"/' build.gradle
```
**Maven pom.xml:**
```bash
# Replace first <version> tag (project version)
sed -i '0,/<version>.*<\/version>/s//<version>'"$new_version"'<\/version>/' pom.xml
```
**Multiple version files:**
Update all files in sequence, tracking successes and failures:
```bash
updated_files=()
failed_files=()
for version_file_config in "${version_files[@]}"; do
file_path="${version_file_config[path]}"
adapter="${version_file_config[adapter]}"
# Update using appropriate adapter
case "$adapter" in
"json")
jq --indent 2 ".version = \"$new_version\"" "$file_path" > tmp.json && mv tmp.json "$file_path"
;;
"toml")
# ... toml update logic
;;
"python-file")
# ... python file update logic
;;
# ... other adapters
esac
# Verify update succeeded
if verify_version_updated "$file_path" "$new_version"; then
updated_files+=("$file_path")
else
failed_files+=("$file_path")
fi
done
```
### 3. Update Documentation Files
Search documentation files for version references and update them.
Use `documentation_files` from configuration (default: `["README.md"]`, supports globs).
**Find all documentation files:**
```bash
doc_files=()
for pattern in "${documentation_files[@]}"; do
# Expand glob patterns
if [[ "$pattern" == *"*"* ]]; then
# Use find for glob patterns like "docs/**/*.md"
while IFS= read -r file; do
doc_files+=("$file")
done < <(find . -path "./$pattern" -type f)
else
# Direct file path
if [ -f "$pattern" ]; then
doc_files+=("$pattern")
fi
done
done
```
**For each documentation file, perform context-aware version replacement:**
```bash
for doc_file in "${doc_files[@]}"; do
echo "Processing $doc_file..."
# Create backup
cp "$doc_file" "${doc_file}.bak"
# Perform replacements (context-aware)
# 1. Version badges (shields.io, etc.)
sed -i "s/version-${old_version//./-}/version-${new_version//./-}/g" "$doc_file"
sed -i "s/v${old_version}-/v${new_version}-/g" "$doc_file"
# 2. Installation commands
# npm install [email protected] → [email protected]
sed -i "s/@${old_version}/@${new_version}/g" "$doc_file"
# pip install package==1.1.0 → package==1.2.0
sed -i "s/==${old_version}/==${new_version}/g" "$doc_file"
# cargo add [email protected] → [email protected]
# (already covered by @version pattern)
# 3. Git tag references
# v1.1.0 → v1.2.0 (when followed by space, ), or end of line)
sed -i "s/v${old_version}\([^0-9]\)/v${new_version}\1/g" "$doc_file"
sed -i "s/v${old_version}$/v${new_version}/g" "$doc_file"
# 4. Standalone version numbers in specific contexts
# "Version 1.1.0" → "Version 1.2.0"
sed -i "s/Version ${old_version}/Version ${new_version}/g" "$doc_file"
sed -i "s/version ${old_version}/version ${new_version}/g" "$doc_file"
# 5. In code blocks (more conservative - only in known safe contexts)
# Only replace if part of package reference
sed -i "s/\"${old_version}\"/\"${new_version}\"/g" "$doc_file"
sed -i "s/'${old_version}'/'${new_version}'/g" "$doc_file"
# Count changes
changes=$(diff -u "${doc_file}.bak" "$doc_file" | grep '^[-+]' | wc -l)
if [ $changes -gt 0 ]; then
echo "✓ Updated $doc_file ($changes lines changed)"
rm "${doc_file}.bak"
else
echo " No version references found in $doc_file"
mv "${doc_file}.bak" "$doc_file" # Restore original
fi
done
```
**Conservative replacement strategy:**
- Only replace version strings in known safe contexts
- Avoid replacing arbitrary numbers (could be dates, IDs, etc.)
- Use word boundaries and context markers
- Verify replacements made sense (count changes, show diff)
### 4. Project-Specific Updates
Some project types have additional files to update:
**Node.js (package-lock.json):**
```bash
if [ -f "package-lock.json" ]; then
# Update version in lockfile (both root and package entry)
jq ".version = \"$new_version\"" package-lock.json > tmp.json && mv tmp.json package-lock.json
jq ".packages[\"\"].version = \"$new_version\"" package-lock.json > tmp.json && mv tmp.json package-lock.json
fi
```
**Python (setuptools-scm):**
If using setuptools-scm, version is managed by git tags - no file updates needed.
**Rust (Cargo.lock):**
If exists, update with:
```bash
cargo update --workspace
```
**Go:**
No files to update - versions managed by git tags only.
### 5. Generate Git Diff
Create a summary of all changes:
```bash
# Stage all modified files
git add -u
# Generate diff
git diff --cached > /tmp/release-diff.patch
# Display summary
echo "Files modified:"
git diff --cached --name-only
echo ""
echo "Diff summary:"
git diff --cached --stat
```
### 6. Validation
Verify all updates were successful:
```bash
validation_errors=()
# Check each version file
for file in "${updated_files[@]}"; do
actual_version=$(read_version_from_file "$file")
if [ "$actual_version" != "$new_version" ]; then
validation_errors+=("$file: expected $new_version, got $actual_version")
fi
done
# If any errors, return them
if [ ${#validation_errors[@]} -gt 0 ]; then
echo "✗ Validation failed:"
printf '%s\n' "${validation_errors[@]}"
exit 1
fi
```
## Output Format
Return:
```json
{
"files_updated": [
"packaRelated in General
modeling-omnistudio-epc-catalog
IncludedSalesforce Industries CME EPC product-modeling skill for Product2-based catalog creation. Use when creating EPC products, configuring product attributes, building offer bundles with Product Child Items, or reviewing EPC DataPack JSON metadata for product catalog changes. TRIGGER when: user creates or updates Product2 EPC records, AttributeAssignment payloads, AttributeMetadata/AttributeDefaultValues, Offer bundles, or ProductChildItem relationships. DO NOT TRIGGER when: designing OmniScripts/FlexCards/Integration Procedures (use building-omnistudio-omniscript, building-omnistudio-flexcard, or building-omnistudio-integration-procedure), implementing Apex business logic (use generating-apex), or troubleshooting deployment pipelines (use deploying-metadata).
relationship-science-coach
IncludedUse this skill for direct, practical adult relationship coaching: couples conflict, repair, trust, marriage, dating, flirting, attachment patterns, emotional connection, sex, desire differences, eroticism, kink negotiation, affection, love languages, breakups, and long-term passion. Draw on Gottman, EFT and Hold Me Tight, attachment science, modern sex research, Perel, Nagoski, Kerner, Schnarch, Love and Stosny, and flexible love-language tools. Be concrete and low-hedge. Redirect only for imminent danger, abuse, coercive control, minors, non-consent, self-harm, stalking, or medical/legal/psychiatric decisions.
building-sf-integrations
IncludedSalesforce integration architecture and runtime plumbing with 120-point scoring. Use this skill to set up Named Credentials, External Credentials, External Services, REST/SOAP callout patterns, Platform Events, and Change Data Capture. TRIGGER when: user sets up Named Credentials, External Services, REST/SOAP callouts, Platform Events, CDC, or touches .namedCredential-meta.xml files. DO NOT TRIGGER when: Connected App/OAuth config (use configuring-connected-apps), Apex-only logic (use generating-apex), or data import/export (use handling-sf-data).
venue-templates
IncludedAccess comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
let-fate-decide
IncludedDraws the 12 Houses of the Zodiac Tarot spread to inject entropy into planning when prompts are vague, ambiguous, or casually delegated. Interprets the spread to guide next steps. Use when the user says 'let fate decide', 'YOLO', 'whatever', 'idk', or other nonchalant phrases, makes Yu-Gi-Oh references, or when you are about to arbitrarily pick between multiple reasonable approaches. Prefer over ask-questions-if-underspecified when the user's tone is casual or playful rather than precision-seeking.
net-ops
IncludedCross-platform network troubleshooting (Windows, macOS, Linux) via local or remote shell. Use for: DNS broken, can't resolve hostnames, nslookup/dig works but apps fail, NRPT, WFP, scutil, /etc/resolver, systemd-resolved, /etc/resolv.conf, NetworkManager, VPN DNS leak residue (ProtonVPN/Mullvad/WireGuard/AnyConnect), AV/firewall blocking DNS or DoH, Tailscale DNS interaction, intermittent connectivity, remote diagnostics over SSH.