feat: enhance profile command with user lookup, followers/following support, and server visibility
🧾 Summary
This merge request enhances the profile command in Corpus CLI by introducing social features and improving transparency.
Users can now:
- View follower and following counts
- Fetch other user profiles by username
- List followers and following users
- See the active server URL directly in the profile output
✨ Features Implemented
🔹 User Profile Enhancements
- Display follower count
- Display following count
- Works for both current user and other users
🔹 User Lookup
- Fetch profiles using username:
corpus-client profile <username>
- Defaults to current user if no username is provided
🔹 Followers & Following Lists
- Added CLI flags:
corpus-client profile --followers corpus-client profile --following
- Supports username:
corpus-client profile john_doe --followers
- Output includes:
- Total count
- List of usernames
🔹 Server Visibility
- Displays active API server in profile header:
Username: bhavitha Server: https://api.example.com
- Follows same pattern as existing
statuscommand for consistency
💻 CLI Usage
Default Profile
corpus-client profile
Other User Profile
corpus-client profile john_doe
Followers List
corpus-client profile --followers
Following List
corpus-client profile --following
Combined Usage
corpus-client profile john_doe --followers
⚙ ️ Behavior Summary
| Command | Behavior |
|---|---|
profile |
Show current user profile |
profile <username> |
Show specified user profile |
--followers |
List followers |
--following |
List following users |
🏗 ️ Implementation Details
- Extended API layer to support:
- Fetching user by username
- Fetching followers and following lists
- Updated CLI:
- Added optional
usernameargument - Added
--followersand--followingflags
- Added optional
- Output:
- Enhanced
_show_user_table() - Added server URL in profile header
- Maintained consistent Rich formatting
- Enhanced
- Reused existing:
-
State.get_auth()for base_url - Status command pattern for server display
-
📁 Files Changed
-
src/corpus_client_cli/cli.py
→ Updated profile command, flags, and output - API-related functions
→ Added user lookup, followers, and following endpoints - Tests
→ Added coverage for profile, followers, and following features -
README.md
→ Updated CLI usage documentation
🧪 Testing
-
✅ All tests passing -
✅ Tested scenarios:- Current user profile
- Other user profile
- Followers list
- Following list
- Invalid username
- Empty follower/following lists
⚠ ️ Edge Cases Handled
- Invalid username → clear error message
- Empty followers/following → user-friendly message
- Missing fields → safe defaults
- Conflicting flags → validation error
✅ Final Checklist
- Feature works end-to-end
-
No breaking changes -
CLI output is clean and consistent -
Tests added and passing -
Documentation updated -
Ready for review 🚀
-