fix(api,watcher): name the queue, list parked non-markdown, reserved wings, top-level-only frontmatter key; document the inbox (review of #211)
- brain_promote/brain_reject take an optional queue (inbox | needs-review); a name present in both is refused instead of silently acting on the top-level note; brain_pending labels every entry with its queue - parked pdf/txt files are listed (they were invisible); only markdown can be promoted, the others are moved or rejected - promote refuses sources/concepts/entities/wiki as a wing - frontmatterWing reads only a top-level key inside a properly fenced block - docs/raw-inbox.md: the contract, the three env vars, the known limits Each behaviour has a test that fails without it (mutation-checked). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -392,14 +392,23 @@ func topDir(rel string) string {
|
||||
return ""
|
||||
}
|
||||
|
||||
// frontmatterWing reads `wing:` from a note's leading frontmatter, "" if none.
|
||||
// frontmatterWing reads a top-level `wing:` from a note's leading frontmatter,
|
||||
// "" if there is none. The block counts only if it has a real closing fence (a
|
||||
// line that is exactly "---"), and an indented `wing:` belongs to some other
|
||||
// mapping, not to the note.
|
||||
func frontmatterWing(content string) string {
|
||||
content = strings.ReplaceAll(content, "\r\n", "\n")
|
||||
if !strings.HasPrefix(content, "---\n") {
|
||||
return ""
|
||||
}
|
||||
block, _, _ := strings.Cut(content[4:], "\n---")
|
||||
block, _, found := cutFence(content[4:])
|
||||
if !found {
|
||||
return ""
|
||||
}
|
||||
for _, line := range strings.Split(block, "\n") {
|
||||
if line == "" || line[0] == ' ' || line[0] == '\t' {
|
||||
continue
|
||||
}
|
||||
if key, val, ok := strings.Cut(line, ":"); ok && strings.TrimSpace(key) == "wing" {
|
||||
return strings.Trim(strings.TrimSpace(val), `"'`)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user