feat: Notes core service + Notes API + router auto-detect notes context
- Add internal/core/notes/ service (Service, Layout, Normalize, tests) - Register verstak/core/notes/v1 capability - Inject NotesService into App, expose 8 Notes API endpoints (CreateNote, RenameNote, ReadNote, SaveNote, EnsureOverview, ListNotes, SearchNotes, NormalizeNoteTitle) - Router: auto-detect Notes context via path (IsInsideNotes) - PluginCard: show workspaceItems contribution count - Regenerate Wails bindings (App.d.ts, App.js, models.ts with notes.NoteInfo) - Fix .gitignore pattern for e2e-results/
This commit is contained in:
@@ -9,6 +9,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/verstak/verstak-desktop/internal/core/contribution"
|
||||
"github.com/verstak/verstak-desktop/internal/core/notes"
|
||||
"github.com/verstak/verstak-desktop/internal/core/plugin"
|
||||
)
|
||||
|
||||
@@ -233,7 +234,9 @@ func (r *Router) preferenceFor(request OpenResourceRequest) string {
|
||||
func resourceContextName(request OpenResourceRequest) string {
|
||||
ext := strings.ToLower(request.Extension)
|
||||
if ext == ".md" || ext == ".markdown" {
|
||||
if request.Context.NotesMode || request.Context.IsInsideNotesFolder {
|
||||
// Auto-detect Notes context: either explicitly set in request context
|
||||
// or path-based detection using the canonical Notes/ folder layout.
|
||||
if request.Context.NotesMode || request.Context.IsInsideNotesFolder || notes.IsInsideNotes(request.Path) {
|
||||
return ContextNotesMarkdown
|
||||
}
|
||||
return ContextGenericMarkdown
|
||||
|
||||
@@ -403,7 +403,7 @@ func TestDetermineContextName(t *testing.T) {
|
||||
want: ContextGenericMarkdown,
|
||||
},
|
||||
{
|
||||
name: "notes markdown",
|
||||
name: "notes markdown with explicit context",
|
||||
request: OpenResourceRequest{
|
||||
Kind: "vault-file",
|
||||
Path: "Notes/Overview.md",
|
||||
@@ -414,6 +414,30 @@ func TestDetermineContextName(t *testing.T) {
|
||||
},
|
||||
want: ContextNotesMarkdown,
|
||||
},
|
||||
{
|
||||
name: "notes markdown auto-detected from path",
|
||||
request: OpenResourceRequest{
|
||||
Kind: "vault-file",
|
||||
Path: "Workspace/Notes/MyNote.md",
|
||||
},
|
||||
want: ContextNotesMarkdown,
|
||||
},
|
||||
{
|
||||
name: "notes overview auto-detected",
|
||||
request: OpenResourceRequest{
|
||||
Kind: "vault-file",
|
||||
Path: "Notes/Overview.md",
|
||||
},
|
||||
want: ContextNotesMarkdown,
|
||||
},
|
||||
{
|
||||
name: "non-notes markdown stays generic",
|
||||
request: OpenResourceRequest{
|
||||
Kind: "vault-file",
|
||||
Path: "Workspace/Files/readme.md",
|
||||
},
|
||||
want: ContextGenericMarkdown,
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user