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:
2026-06-21 23:22:36 +08:00
parent 0b6b0d0926
commit 03175aa46d
13 changed files with 1367 additions and 4 deletions
+4 -1
View File
@@ -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
+25 -1
View File
@@ -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) {