Initial MVP implementation of Claudia Docs CLI

- Auth commands: login, logout, status
- Document commands: create, list, get, update, delete
- Project commands: list, get
- Folder commands: list, create
- Tag commands: list, create, add
- Search command
- Reasoning save command
- JSON output format with --output text option
- Viper-based configuration management
- Cobra CLI framework
This commit is contained in:
Claudia CLI Bot
2026-03-31 01:25:15 +00:00
commit aca95d90f3
17 changed files with 3270 additions and 0 deletions

149
pkg/types/types.go Normal file
View File

@@ -0,0 +1,149 @@
package types
import "time"
// Response is the standard API response wrapper
type Response struct {
Success bool `json:"success"`
Data interface{} `json:"data,omitempty"`
Error *ErrorInfo `json:"error,omitempty"`
Meta MetaInfo `json:"meta"`
}
// ErrorInfo contains error details
type ErrorInfo struct {
Code string `json:"code"`
Message string `json:"message"`
}
// MetaInfo contains metadata about the response
type MetaInfo struct {
Command string `json:"command"`
DurationMs int64 `json:"duration_ms"`
Server string `json:"server,omitempty"`
}
// AuthResponse is the response from auth endpoints
type AuthResponse struct {
Token string `json:"access_token,omitempty"`
ExpiresAt time.Time `json:"expires_at,omitempty"`
TokenType string `json:"token_type,omitempty"`
}
// Document represents a document
type Document struct {
ID string `json:"id"`
Title string `json:"title"`
Content string `json:"content,omitempty"`
ProjectID string `json:"project_id"`
FolderID string `json:"folder_id,omitempty"`
Metadata map[string]any `json:"metadata,omitempty"`
Tags []Tag `json:"tags,omitempty"`
Reasoning []ReasoningStep `json:"reasoning,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
// Project represents a project
type Project struct {
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
// Folder represents a folder
type Folder struct {
ID string `json:"id"`
Name string `json:"name"`
ProjectID string `json:"project_id"`
ParentID string `json:"parent_id,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
// Tag represents a tag
type Tag struct {
ID string `json:"id"`
Name string `json:"name"`
Color string `json:"color,omitempty"`
}
// ReasoningStep represents a reasoning step
type ReasoningStep struct {
StepID string `json:"step_id"`
Thought string `json:"thought"`
Conclusion string `json:"conclusion,omitempty"`
Action string `json:"action,omitempty"`
}
// Reasoning represents reasoning metadata for a document
type Reasoning struct {
DocID string `json:"doc_id"`
Type string `json:"type"`
Steps []ReasoningStep `json:"steps"`
Confidence float64 `json:"confidence,omitempty"`
Model string `json:"model,omitempty"`
CreatedAt time.Time `json:"created_at"`
}
// SearchResult represents a search result
type SearchResult struct {
Documents []Document `json:"documents"`
Total int `json:"total"`
Query string `json:"query"`
}
// CreateDocumentRequest is the request body for creating a document
type CreateDocumentRequest struct {
Title string `json:"title"`
Content string `json:"content"`
FolderID string `json:"folder_id,omitempty"`
Metadata map[string]any `json:"metadata,omitempty"`
}
// UpdateDocumentRequest is the request body for updating a document
type UpdateDocumentRequest struct {
Title string `json:"title,omitempty"`
Content string `json:"content,omitempty"`
FolderID string `json:"folder_id,omitempty"`
}
// CreateProjectRequest is the request body for creating a project
type CreateProjectRequest struct {
Name string `json:"name"`
Description string `json:"description,omitempty"`
}
// CreateFolderRequest is the request body for creating a folder
type CreateFolderRequest struct {
Name string `json:"name"`
ParentID string `json:"parent_id,omitempty"`
}
// CreateTagRequest is the request body for creating a tag
type CreateTagRequest struct {
Name string `json:"name"`
Color string `json:"color,omitempty"`
}
// SaveReasoningRequest is the request body for saving reasoning
type SaveReasoningRequest struct {
Type string `json:"type"`
Steps []ReasoningStep `json:"steps"`
Confidence float64 `json:"confidence,omitempty"`
Model string `json:"model,omitempty"`
}
// LoginRequest is the request body for login
type LoginRequest struct {
Username string `json:"username"`
Password string `json:"password"`
}
// RegisterRequest is the request body for registration
type RegisterRequest struct {
Username string `json:"username"`
Password string `json:"password"`
}