Skip to content

Conversation

@davewaring
Copy link
Contributor

Summary

  • Adds new /api/v1/library/* endpoints to enable plugins to access BrainDrive-Library files
  • Three endpoints: list projects, read file, get project context
  • Includes security validation (path traversal prevention, auth required)

This endpoint is needed by the Research Assistant plugin (in development) to load project context from ~/BrainDrive-Library/.

Endpoints Added

  • GET /api/v1/library/projects - List projects from active/archived/ideas folders
  • POST /api/v1/library/read-file - Read a specific file from Library
  • GET /api/v1/library/project/{slug}/context - Get aggregated project context (AGENT.md, spec.md, etc.)

Security

  • All endpoints require authentication
  • Path validation prevents directory traversal attacks
  • Access restricted to ~/BrainDrive-Library/ directory only

Test plan

  • Test list projects endpoint returns expected projects
  • Test read-file endpoint with valid and invalid paths
  • Test path traversal prevention (e.g., ../ in paths)
  • Test unauthenticated requests are rejected

🤖 Generated with Claude Code

Adds new API endpoints for plugins to access BrainDrive-Library content:

- GET /api/v1/library/projects - List projects in Library
- POST /api/v1/library/read-file - Read a specific file from a project
- GET /api/v1/library/project/{slug}/context - Get all context files at once

Security:
- Path validation prevents directory traversal attacks
- Restricted to ~/BrainDrive-Library/ only
- Requires authenticated user
- Allowed file types: .md, .txt, .json, .yaml, .yml

This enables plugins like Research Assistant to load project context
for AI-powered analysis without needing direct filesystem access.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@davewaring
Copy link
Contributor Author

@DJJones66 my goal here is to give BrainDrive-Owners the ability to have a BrainDrive-Library file on their computer that their braindrive can access but without accessign any other files on the system. I want this for the plugin we talked about building so when I put an article in the AI can review our projects for relevant context from the article. But I think this functionality could be very useful beyond just this. It's basically another way to get at chat with documents when you have a structured file system like we are building.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants