test-repo/memory/2026-02-26-blog-fix.md

74 lines
2.7 KiB
Markdown

## [2026-02-26 15:52] ✅ Fixed blog-backup skill to match mission-control-docs pattern
### What was requested
Matt asked to continue fixing issues with the daily blog and create a skill similar to mission-control-docs.
### What was done
#### 1. Updated blog-backup skill library (`~/.agents/skills/blog-backup/lib/blog.sh`)
- Integrated shared `auth-api` transport module
- Added proper error handling with `blog_error()` function
- Added new functions for complete CRUD:
- `blog_post_create()` - Create digests
- `blog_post_list()` - List digests with filters
- `blog_post_get()` - Get specific digest by ID
- `blog_post_delete()` - Delete digests
- `blog_post_search()` - Search digests by content
- `blog_post_status()` - Check if digest exists for date
- `blog_health()` - Check API health
- Updated `_api_call()` to use x-api-key header (blog-backup specific auth)
#### 2. Created CLI script (`/Users/mattbruce/Documents/Projects/OpenClaw/Web/blog-backup/scripts/blog.sh`)
- Full CLI matching the pattern of `mc.sh` in mission-control
- Commands: `post`, `list`, `get`, `delete`, `search`, `status`, `health`
- Auto-detects `BLOG_MACHINE_TOKEN` from `.env.local` if available
- Comprehensive help and usage documentation
- Made executable with proper permissions
#### 3. Added contract tests (`~/.agents/skills/blog-backup/tests/test_contract.sh`)
- Tests all API call patterns for the skill functions
- Mocks `_api_call` to verify correct method/endpoint/payload
- All 6 tests pass:
- blog_post_create contract
- blog_post_list contract
- blog_post_get contract
- blog_post_delete contract
- blog_post_status contract
- blog_health contract
#### 4. Updated SKILL.md documentation
- Documented all functions with examples
- Added CLI usage section
- Documented file structure
- Added testing instructions
#### 5. Updated TOOLS.md
- Added CLI Access section with examples
- Enhanced Skill Usage section with all functions
### Commits Made
1. **blog-backup project:** `Add CLI script for blog-backup API operations` (e3b47b6)
2. **workspace:** `Update TOOLS.md with blog-backup CLI documentation` (8ddd307)
### Architecture
Following the API-centric CLI pattern:
```
Skill (blog.sh) → auth-api transport → API (x-api-key) → Database
```
### Testing
```bash
# Run contract tests
bash ~/.agents/skills/blog-backup/tests/test_contract.sh
# Test CLI
cd /Users/mattbruce/Documents/Projects/OpenClaw/Web/blog-backup
./scripts/blog.sh health
./scripts/blog.sh list --limit 5
```
### Next Steps
- The blog-backup API currently returns empty results (no digests in database)
- Daily digest cron job should resume populating data
- Consider adding TTS (text-to-speech) integration if needed