Documentation
¶
Index ¶
- Variables
- func CreateNoteContent(noteType models.NoteType, ...) string
- func GenerateFilename(suffix string) string
- func GenerateNoteID(suffix string) string
- func GetFileStatus(repoPath string) (map[string]string, error)
- func GetNoteMetadata(path string) (workspaceIdentifier, branch, noteType string)
- func ParseArtifact(path string) (*models.Note, error)
- func ParseGenericFile(path string) (*models.Note, error)
- func ParseNote(path string) (*models.Note, error)
- func SanitizeFilename(s string) string
- type ConceptInfo
- type ConceptSearchMatch
- type ConceptSearchResult
- type Config
- type CreateOption
- type GitStatusResult
- type NoteContentGenerator
- type SearchOption
- type Service
- func (s *Service) ArchiveNotes(ctx *WorkspaceContext, paths []string) error
- func (s *Service) BuildNotePath(workspaceName, branch, noteType, filename string) (string, error)
- func (s *Service) Close() error
- func (s *Service) CopyNotes(sourcePaths []string, destWorkspace *coreworkspace.WorkspaceNode, ...) ([]string, error)
- func (s *Service) CreateConcept(ctx *WorkspaceContext, title string, options ...CreateOption) (*models.Note, error)
- func (s *Service) CreateNote(ctx *WorkspaceContext, noteType models.NoteType, title string, ...) (*models.Note, error)
- func (s *Service) CreateNoteWithContent(ctx *WorkspaceContext, noteType models.NoteType, title string, ...) (*models.Note, error)
- func (s *Service) DeleteNotes(paths []string) error
- func (s *Service) GetBranches(ws *coreworkspace.WorkspaceNode) ([]string, error)
- func (s *Service) GetConceptPath(ctx *WorkspaceContext, conceptID string) (string, error)
- func (s *Service) GetConceptsDir(ctx *WorkspaceContext) (string, error)
- func (s *Service) GetNotebookLocator() *coreworkspace.NotebookLocator
- func (s *Service) GetWorkspaceContext(startPath string) (*WorkspaceContext, error)
- func (s *Service) GetWorkspaceProvider() *coreworkspace.Provider
- func (s *Service) LinkConceptToConcept(ctx *WorkspaceContext, sourceID, targetID string) error
- func (s *Service) LinkNoteToConcept(ctx *WorkspaceContext, conceptID, noteAlias string) error
- func (s *Service) LinkPlanToConcept(ctx *WorkspaceContext, conceptID, planAlias string) error
- func (s *Service) LinkSkillToConcept(ctx *WorkspaceContext, conceptID, skillName string) error
- func (s *Service) ListAllConcepts() ([]ConceptInfo, error)
- func (s *Service) ListAllGlobalItems(includeArchived bool, includeArtifacts bool) ([]*tree.Item, error)
- func (s *Service) ListAllGlobalNotes(includeArchived bool, includeArtifacts bool) ([]*models.Note, error)
- func (s *Service) ListAllItems(ctx *WorkspaceContext, includeArchived bool, includeArtifacts bool) ([]*tree.Item, error)
- func (s *Service) ListAllNotes(ctx *WorkspaceContext, includeArchived bool, includeArtifacts bool) ([]*models.Note, error)
- func (s *Service) ListAllNotesInWorkspace(ws *coreworkspace.WorkspaceNode) ([]*models.Note, error)
- func (s *Service) ListConcepts(ctx *WorkspaceContext) ([]ConceptInfo, error)
- func (s *Service) ListEcosystemConcepts(ctx *WorkspaceContext) ([]ConceptInfo, error)
- func (s *Service) ListGlobalNotes(noteType models.NoteType) ([]*models.Note, error)
- func (s *Service) ListItemsFromAllWorkspaces(includeArchived bool, includeArtifacts bool) ([]*tree.Item, error)
- func (s *Service) ListNoteTypes(notebookContext *coreworkspace.WorkspaceNode) ([]models.NoteType, error)
- func (s *Service) ListNotes(ctx *WorkspaceContext, noteType models.NoteType) ([]*models.Note, error)
- func (s *Service) ListNotesFromAllWorkspaces(includeArchived bool, includeArtifacts bool) ([]*models.Note, error)
- func (s *Service) MoveNotes(sourcePaths []string, destWorkspace *coreworkspace.WorkspaceNode, ...) ([]string, error)
- func (s *Service) RenameNote(oldPath, newTitle string) (string, error)
- func (s *Service) SearchConcepts(query string) ([]ConceptSearchResult, error)
- func (s *Service) SearchEcosystemConcepts(ctx *WorkspaceContext, query string) ([]ConceptSearchResult, error)
- func (s *Service) SearchNotes(ctx *WorkspaceContext, query string, options ...SearchOption) ([]*models.Note, error)
- func (s *Service) UpdateNoteContent(path string, content string) error
- func (s *Service) UpdateNoteWithContent(notePath string, fm *frontmatter.Frontmatter, body string) error
- type WorkspaceContext
Constants ¶
This section is empty.
Variables ¶
var DefaultNoteTypes = map[string]*coreconfig.NoteTypeConfig{ "inbox": { Icon: theme.IconNoteInbox, IconColor: "orange", DefaultExpand: false, SortOrder: 10, Description: "Default location for new notes.", }, "issues": { Icon: theme.IconNoteIssues, IconColor: "red", DefaultExpand: false, SortOrder: 11, Description: "Notes related to bugs or issues.", }, "plans": { Icon: theme.IconPlan, IconColor: "blue", DefaultExpand: true, SortOrder: 13, Description: "Directory for structured project plans.", }, "skills": { Icon: theme.IconBuild, IconColor: "orange", SortOrder: 15, Description: "Agent skills for automation and integration.", }, "in_progress": { Icon: theme.IconNoteInProgress, IconColor: "blue", DefaultExpand: true, SortOrder: 20, Description: "Notes for tasks currently being worked on.", }, "review": { Icon: theme.IconNoteReview, IconColor: "pink", DefaultExpand: false, SortOrder: 30, Description: "Notes or PRs ready for review.", }, "completed": { Icon: theme.IconNoteCompleted, IconColor: "green", DefaultExpand: false, SortOrder: 999, Description: "Completed work and historical notes.", }, "docs": { Icon: theme.IconDocs, IconColor: "orange", SortOrder: 40, Description: "Documentation and reference materials.", }, "learn": { Icon: theme.IconSchool, IconColor: "orange", SortOrder: 50, Description: "Learning materials and educational content.", }, "daily": { Icon: theme.IconCalendar, SortOrder: 5, Description: "Daily notes and journal entries.", }, "github-issues": { Icon: theme.IconIssueOpened, IconColor: "red", SortOrder: 12, Description: "GitHub issues.", }, "github-prs": { Icon: theme.IconPullRequest, IconColor: "pink", SortOrder: 31, Description: "GitHub pull requests.", }, ".archive": { Icon: theme.IconArchive, Description: "Archived items.", }, ".closed": { Icon: theme.IconArchive, Description: "Closed items.", }, ".artifacts": { Icon: theme.IconDocs, Description: "Generated artifacts and outputs.", }, "quick": { Icon: theme.IconClockFast, Description: "Quick notes and scratch space.", }, "prompts": { Icon: theme.IconLightbulb, Description: "AI prompts and templates.", }, "blog": { Icon: theme.IconRss, Description: "Blog posts and articles.", }, "architecture": { Icon: theme.IconArchitecture, Description: "Architecture documentation and design.", }, "todos": { Icon: theme.IconChecklist, Description: "Task lists and todos.", }, "concepts": { Icon: theme.IconLightbulb, IconColor: "cyan", SortOrder: 60, DefaultExpand: true, Description: "Project concepts and architectural memory.", }, }
DefaultNoteTypes provides the built-in configuration for "special" note types. User configurations in grove.yml can override these settings.
Functions ¶
func CreateNoteContent ¶
func CreateNoteContent(noteType models.NoteType, title, workspace, branch, worktree, currentWorkspaceName string, template string, noteTypeConfig *coreconfig.NoteTypeConfig) string
CreateNoteContent generates initial note content based on type and template If noteTypeConfig is provided with a TemplatePath, it reads from that file. Otherwise, it falls back to generating default content.
func GenerateFilename ¶
GenerateFilename creates a timestamped filename
func GenerateNoteID ¶
GenerateNoteID creates an ID from filename (without .md extension)
func GetFileStatus ¶
GetFileStatus runs `git status --porcelain=v1` and returns a map of absolute, normalized file paths to their status codes.
func GetNoteMetadata ¶
GetNoteMetadata extracts metadata from note path
func ParseArtifact ¶
ParseArtifact reads and parses an artifact file (e.g., briefing.xml)
func ParseGenericFile ¶
ParseGenericFile creates a Note model for a non-Markdown file.
func SanitizeFilename ¶
SanitizeFilename removes invalid characters from filename
Types ¶
type ConceptInfo ¶
type ConceptInfo struct {
ID string `json:"id"`
Title string `json:"title"`
Path string `json:"path"`
Workspace string `json:"workspace"`
}
ConceptInfo represents metadata about a concept
type ConceptSearchMatch ¶
ConceptSearchMatch represents a single line match within a file
type ConceptSearchResult ¶
type ConceptSearchResult struct {
ConceptID string `json:"concept_id"`
Workspace string `json:"workspace"`
FilePath string `json:"file_path"`
Matches []ConceptSearchMatch `json:"matches"`
}
ConceptSearchResult represents search matches grouped by file
type Config ¶
type Config struct {
DataDir string
Editor string
Templates map[string]string
DefaultType models.NoteType
}
Config holds service configuration
type CreateOption ¶
type CreateOption func(*createOptions)
func InGlobalWorkspace ¶
func InGlobalWorkspace() CreateOption
func WithoutEditor ¶
func WithoutEditor() CreateOption
type GitStatusResult ¶
type GitStatusResult struct {
FileStatus map[string]string // path -> status code
DeletedFiles []string // paths of deleted files (don't exist on disk)
}
GitStatusResult contains the parsed git status information
func GetFileStatusExtended ¶
func GetFileStatusExtended(repoPath string) (*GitStatusResult, error)
GetFileStatusExtended runs `git status --porcelain=v1` and returns extended info including deleted files that don't exist on disk.
type NoteContentGenerator ¶
type NoteContentGenerator func(title, workspace, branch string, tags []string, now time.Time, timestampStr string) string
NoteContentGenerator defines the function signature for note content generators
type SearchOption ¶
type SearchOption func(*searchOptions)
func AllWorkspaces ¶
func AllWorkspaces() SearchOption
func OfType ¶
func OfType(t models.NoteType) SearchOption
func WithLimit ¶
func WithLimit(limit int) SearchOption
type Service ¶
type Service struct {
Config *Config
CoreConfig *coreconfig.Config
Logger *logrus.Entry
NoteTypes map[string]*coreconfig.NoteTypeConfig
// contains filtered or unexported fields
}
Service is the core note service
func New ¶
func New(config *Config, provider *coreworkspace.Provider, coreCfg *coreconfig.Config, logger *logrus.Entry) (*Service, error)
New creates a new note service
func (*Service) ArchiveNotes ¶
func (s *Service) ArchiveNotes(ctx *WorkspaceContext, paths []string) error
ArchiveNotes moves notes to a .archive subdirectory within their current directory.
func (*Service) BuildNotePath ¶
BuildNotePath constructs a path for a note in the specified workspace/branch/type Note: branch parameter is accepted for API compatibility but always uses "main"
func (*Service) CopyNotes ¶
func (s *Service) CopyNotes(sourcePaths []string, destWorkspace *coreworkspace.WorkspaceNode, destGroup string) ([]string, error)
CopyNotes copies notes to a new workspace and group.
func (*Service) CreateConcept ¶
func (s *Service) CreateConcept(ctx *WorkspaceContext, title string, options ...CreateOption) (*models.Note, error)
CreateConcept creates the directory structure for a new concept.
func (*Service) CreateNote ¶
func (s *Service) CreateNote(ctx *WorkspaceContext, noteType models.NoteType, title string, options ...CreateOption) (*models.Note, error)
CreateNote creates a new note in the specified workspace context
func (*Service) CreateNoteWithContent ¶
func (s *Service) CreateNoteWithContent( ctx *WorkspaceContext, noteType models.NoteType, title string, fm *frontmatter.Frontmatter, body string, ) (*models.Note, error)
CreateNoteWithContent creates a new note programmatically without opening an editor. This is used by the sync system to create notes for synced items.
func (*Service) DeleteNotes ¶
DeleteNotes removes note files from the filesystem.
func (*Service) GetBranches ¶
func (s *Service) GetBranches(ws *coreworkspace.WorkspaceNode) ([]string, error)
GetBranches returns all branches for a git workspace
func (*Service) GetConceptPath ¶
func (s *Service) GetConceptPath(ctx *WorkspaceContext, conceptID string) (string, error)
GetConceptPath returns the absolute path to a concept's directory
func (*Service) GetConceptsDir ¶
func (s *Service) GetConceptsDir(ctx *WorkspaceContext) (string, error)
GetConceptsDir returns the absolute path to the concepts directory for the current workspace
func (*Service) GetNotebookLocator ¶
func (s *Service) GetNotebookLocator() *coreworkspace.NotebookLocator
GetNotebookLocator returns the notebook locator
func (*Service) GetWorkspaceContext ¶
func (s *Service) GetWorkspaceContext(startPath string) (*WorkspaceContext, error)
GetWorkspaceContext returns current workspace context. If startPath is provided, it's used as the basis for context detection. If startPath is "global", it forces the global context.
func (*Service) GetWorkspaceProvider ¶
func (s *Service) GetWorkspaceProvider() *coreworkspace.Provider
GetWorkspaceProvider returns the workspace provider
func (*Service) LinkConceptToConcept ¶
func (s *Service) LinkConceptToConcept(ctx *WorkspaceContext, sourceID, targetID string) error
LinkConceptToConcept adds a concept-to-concept reference
func (*Service) LinkNoteToConcept ¶
func (s *Service) LinkNoteToConcept(ctx *WorkspaceContext, conceptID, noteAlias string) error
LinkNoteToConcept adds a note reference to a concept's manifest
func (*Service) LinkPlanToConcept ¶
func (s *Service) LinkPlanToConcept(ctx *WorkspaceContext, conceptID, planAlias string) error
LinkPlanToConcept adds a plan reference to a concept's manifest
func (*Service) LinkSkillToConcept ¶
func (s *Service) LinkSkillToConcept(ctx *WorkspaceContext, conceptID, skillName string) error
LinkSkillToConcept adds a skill reference to a concept's manifest
func (*Service) ListAllConcepts ¶
func (s *Service) ListAllConcepts() ([]ConceptInfo, error)
ListAllConcepts lists concepts across all workspaces in the ecosystem
func (*Service) ListAllGlobalItems ¶
func (s *Service) ListAllGlobalItems(includeArchived bool, includeArtifacts bool) ([]*tree.Item, error)
ListAllGlobalItems lists all items in the global workspace (all directories)
func (*Service) ListAllGlobalNotes ¶
func (s *Service) ListAllGlobalNotes(includeArchived bool, includeArtifacts bool) ([]*models.Note, error)
ListAllGlobalNotes lists all notes in the global workspace (all directories)
func (*Service) ListAllItems ¶
func (s *Service) ListAllItems(ctx *WorkspaceContext, includeArchived bool, includeArtifacts bool) ([]*tree.Item, error)
ListAllItems lists all files as generic Items in the specified workspace context.
func (*Service) ListAllNotes ¶
func (s *Service) ListAllNotes(ctx *WorkspaceContext, includeArchived bool, includeArtifacts bool) ([]*models.Note, error)
ListAllNotes lists all notes in the specified workspace context (all directories)
func (*Service) ListAllNotesInWorkspace ¶
func (s *Service) ListAllNotesInWorkspace(ws *coreworkspace.WorkspaceNode) ([]*models.Note, error)
ListAllNotesInWorkspace lists all notes in a given workspace, across all branches.
func (*Service) ListConcepts ¶
func (s *Service) ListConcepts(ctx *WorkspaceContext) ([]ConceptInfo, error)
ListConcepts lists all concepts in the workspace
func (*Service) ListEcosystemConcepts ¶
func (s *Service) ListEcosystemConcepts(ctx *WorkspaceContext) ([]ConceptInfo, error)
ListEcosystemConcepts lists concepts from all workspaces within the current ecosystem
func (*Service) ListGlobalNotes ¶
ListGlobalNotes lists notes in the global workspace
func (*Service) ListItemsFromAllWorkspaces ¶
func (s *Service) ListItemsFromAllWorkspaces(includeArchived bool, includeArtifacts bool) ([]*tree.Item, error)
ListItemsFromAllWorkspaces returns generic items from all registered workspaces
func (*Service) ListNoteTypes ¶
func (s *Service) ListNoteTypes(notebookContext *coreworkspace.WorkspaceNode) ([]models.NoteType, error)
ListNoteTypes discovers note types by scanning directories within the notes path. It ensures 'inbox' is always included as the default.
func (*Service) ListNotes ¶
func (s *Service) ListNotes(ctx *WorkspaceContext, noteType models.NoteType) ([]*models.Note, error)
ListNotes lists notes in the current workspace
func (*Service) ListNotesFromAllWorkspaces ¶
func (s *Service) ListNotesFromAllWorkspaces(includeArchived bool, includeArtifacts bool) ([]*models.Note, error)
ListNotesFromAllWorkspaces returns notes from all registered workspaces
func (*Service) MoveNotes ¶
func (s *Service) MoveNotes(sourcePaths []string, destWorkspace *coreworkspace.WorkspaceNode, destGroup string) ([]string, error)
MoveNotes moves notes to a new workspace and group.
func (*Service) RenameNote ¶
RenameNote renames a note by updating its filename, ID, title, and first heading
func (*Service) SearchConcepts ¶
func (s *Service) SearchConcepts(query string) ([]ConceptSearchResult, error)
SearchConcepts searches for a query string across all concept files in the ecosystem
func (*Service) SearchEcosystemConcepts ¶
func (s *Service) SearchEcosystemConcepts(ctx *WorkspaceContext, query string) ([]ConceptSearchResult, error)
SearchEcosystemConcepts searches for a query within concepts in the current ecosystem only
func (*Service) SearchNotes ¶
func (s *Service) SearchNotes(ctx *WorkspaceContext, query string, options ...SearchOption) ([]*models.Note, error)
SearchNotes searches for notes matching the query using filesystem tools.
func (*Service) UpdateNoteContent ¶
UpdateNoteContent updates the content of an existing note
func (*Service) UpdateNoteWithContent ¶
func (s *Service) UpdateNoteWithContent( notePath string, fm *frontmatter.Frontmatter, body string, ) error
UpdateNoteWithContent updates an existing note's content programmatically. This is used by the sync system to update notes when remote items change.
type WorkspaceContext ¶
type WorkspaceContext struct {
CurrentWorkspace *coreworkspace.WorkspaceNode
NotebookContextWorkspace *coreworkspace.WorkspaceNode
Branch string
Paths map[string]string
}
WorkspaceContext holds current workspace information