Skip to content

Feat/delete - #18

Merged
armedev merged 3 commits into
mainfrom
feat/delete
Aug 25, 2026
Merged

armedev merged 3 commits into
mainfrom
feat/delete

Conversation

@armedev

@armedev armedev commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

No description provided.

Closes the published-API gap: openapi.yaml documented DELETE /v1/note
but no handler existed, and vault.Writer.DeleteNote had zero callers.

- queue.RemoveNote: one transaction purges FTS + chunks + entities for
  a path; retry semantics match DeleteFromIndex; idempotent
- DELETE /v1/note?path=...: sentinel-error classification (path-safety
  violations are 400 via vault.ErrVaultPath* sentinels, missing files
  404 via os.ErrNotExist chain - never substring matching on paths);
  index purge + stats recompute follow the trash move; delete stands
  even if purge fails (reindex reconciles)
- DeleteNote now returns the timestamped trash-relative destination
- kl delete <path-or-id>: resolves 36-char UUIDs to note paths via
  GET /v1/queue/{id}, y/N confirm (--yes skips), themed output
- PWA: two-step inline confirm in NoteView header (trash icon ->
  'move to trash?' -> delete/cancel); deleted notes vanish from the
  open results list immediately via deletedPaths prop; destructive
  toast on failure keeps the sheet open

Tests: TestRemoveNote (purge+search+idempotent), 4 handler cases,
4 PWA component tests. Full suites green.
khayal vault parent command with four subcommands, dry-run by default:

- health: notes / indexed % / orphaned media / broken wikilinks with
  needs-attention verdict and remediation hints; backed by a new
  queue.GetReferencedMedia (distinct jobs.source_file)
- fix-links: scans [[wikilinks]] against inbox note names; --fix
  strips the broken links from the files in place
- clean-media: unreferenced media files listed with sizes; --fix moves
  them to .khayal-trash/ with collision-safe timestamps
- show-duplicates: word-overlap similarity pairs (--threshold,
  --min-shared flags), highest similarity first

Helpers shared via vault.go (listInboxNotes excludes trash + non-md,
extractWikilinks, wordSimilarity, formatSize) with table tests.
Live-verified all four against the test vault; delete flow verified
end-to-end (capture -> search -> DELETE -> gone from search, file in
.khayal-trash/, correct trash_path). Docs synced (VAULT.md delete
contract, REPO_STRUCTURE new files).
kl delete added to the kl command list; DELETE /v1/note documented in
API REFERENCE with example + error codes; PWA two-step delete
affordance specified in UI_SPEC.
@armedev
armedev merged commit 1ab799a into main Aug 25, 2026
2 checks passed
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.

1 participant