| allowed-tools | auto-approve | description |
|---|---|---|
Bash(git branch:*), Bash(git log:*), Bash(git status:*), Bash(curl:*), Bash(jq:*), Bash(echo:*), Bash(base64:*) |
true |
Update wpfusion.com documentation after implementing a feature using WordPress REST API |
- Current branch: !
git branch --show-current - Recent commits: !
git log --oneline -5 - Current changes: !
git status --porcelain - Scratchpad status: @.cursor/scratchpad.md
- Available documentation endpoints: !
curl -s -H "Authorization: Basic $(echo -n "$WPF_DOCS_USER:$WPF_DOCS_PASSWORD" | base64)" "$WPF_DOCS_URL/wp-json/wp/v2" | jq -r 'keys[]' | grep -E "(doc|page|post)" || echo "Standard endpoints available" - Recent documentation updates: !
curl -s -H "Authorization: Basic $(echo -n "$WPF_DOCS_USER:$WPF_DOCS_PASSWORD" | base64)" "$WPF_DOCS_URL/wp-json/wp/v2/posts?per_page=3&orderby=modified&order=desc" | jq -r '.[] | "\(.id): \(.title.rendered) (modified: \(.modified))"' || echo "Unable to fetch recent posts"
Update the documentation on wpfusion.com for the feature: $ARGUMENTS
- Analyze the implemented feature based on the git context and scratchpad
- Search existing documentation using REST API to find relevant content:
!curl -s -H "Authorization: Basic $(echo -n "$WPF_DOCS_USER:$WPF_DOCS_PASSWORD" | base64)" "$WPF_DOCS_URL/wp-json/wp/v2/posts?search=FEATURE_NAME&per_page=10" | jq -r '.[] | "\(.id): \(.title.rendered)"'
- Fetch current content of identified documentation:
!curl -s -H "Authorization: Basic $(echo -n "$WPF_DOCS_USER:$WPF_DOCS_PASSWORD" | base64)" "$WPF_DOCS_URL/wp-json/wp/v2/posts/POST_ID" | jq -r '.content.rendered'
- Draft the documentation updates following wpfusion.com writing style
- Update documentation via REST API POST/PUT requests
- Verify update by checking the public URL once (skip REST API re-fetch and timestamp checks)
Search for existing documentation:
# Search posts by keyword
!curl -s -H "Authorization: Basic $(echo -n "$WPF_DOCS_USER:$WPF_DOCS_PASSWORD" | base64)" \
"$WPF_DOCS_URL/wp-json/wp/v2/posts?search=$SEARCH_TERM&per_page=10" | \
jq -r '.[] | "\(.id): \(.title.rendered) - \(.link)"'Get specific post content:
# Fetch post by ID
!curl -s -H "Authorization: Basic $(echo -n "$WPF_DOCS_USER:$WPF_DOCS_PASSWORD" | base64)" \
"$WPF_DOCS_URL/wp-json/wp/v2/posts/$POST_ID" | \
jq -r '.content.rendered'Update post content:
# Update existing post (API response with post ID confirms success)
!curl -s -X PUT \
-H "Authorization: Basic $(echo -n "$WPF_DOCS_USER:$WPF_DOCS_PASSWORD" | base64)" \
-H "Content-Type: application/json" \
-d '{"content":"NEW_CONTENT_HTML"}' \
"$WPF_DOCS_URL/wp-json/wp/v2/posts/$POST_ID" | jq -r '.id // "Update failed"'/wp-json/wp/v2/posts- Blog posts/announcements/wp-json/wp/v2/pages- Static pages/wp-json/wp/v2/documentation- Documentation posts (if custom post type exists)/wp-json/wp/v2/categories- Post categories
- Uses WordPress Application Passwords stored in environment variables
- Required env vars:
WPF_DOCS_URL,WPF_DOCS_USER,WPF_DOCS_PASSWORD - Scope permissions to documentation updates only
# Basic authentication header
AUTH_HEADER="Authorization: Basic $(echo -n "$WPF_DOCS_USER:$WPF_DOCS_PASSWORD" | base64)"
# Example API call
curl -H "$AUTH_HEADER" \
-H "Content-Type: application/json" \
-X GET "$WPF_DOCS_URL/wp-json/wp/v2/posts"- Follow existing wpfusion.com writing patterns
- Be concise and action-oriented
- Include practical examples where relevant
- Match the tone from existing feature announcements
When including code examples, use this HTML syntax for the syntax highlighter:
<pre><code class="language-php">if ( wpf_has_tag( 'New Customer' ) && ! wpf_has_tag( 'Watched Intro Video' ) ) {
echo "Welcome to our site! Please watch our introduction video here:";
}
</code></pre>Important formatting rules:
- Use
<pre><code class="language-php">for PHP code blocks - HTML entities:
&becomes&,<becomes<,>becomes> - Maintain original indentation (tabs preferred)
- Include realistic, practical examples that users can copy-paste
- Use proper WordPress/WP Fusion function names and patterns
- Update confirmation: REST API PUT response returning post ID confirms success
- Single verification: Check public URL once to confirm changes are live
- Skip redundant checks: Don't re-fetch via REST API or check timestamps
- Verify the feature is complete and tested
- Ensure changelog entry exists in readme.txt
- Confirm the feature aligns with existing documentation structure
- Preview changes before publishing