fix: read owner/cadence from properties in ai-context

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
lucaronin
2026-03-18 01:58:33 +01:00
parent 9aa16b8eb4
commit d9fd65c926
5 changed files with 59 additions and 17 deletions

View File

@@ -11,8 +11,6 @@ const makeEntry = (overrides: Partial<VaultEntry> = {}): VaultEntry => ({
belongsTo: [],
relatedTo: [],
status: null,
owner: null,
cadence: null,
archived: false,
trashed: false,
trashedAt: null,
@@ -157,7 +155,7 @@ describe('buildContextualPrompt', () => {
})
describe('buildContextSnapshot', () => {
const active = makeEntry({ path: '/vault/a.md', title: 'Alpha', isA: 'Project', status: 'active', owner: 'Alice' })
const active = makeEntry({ path: '/vault/a.md', title: 'Alpha', isA: 'Project', status: 'active', properties: { Owner: 'Alice' } })
const entries = [
active,
makeEntry({ path: '/vault/b.md', title: 'Beta', isA: 'Person' }),

View File

@@ -85,7 +85,11 @@ function entryFrontmatter(e: VaultEntry): Record<string, unknown> {
const fm: Record<string, unknown> = {}
if (e.isA) fm.type = e.isA
if (e.status) fm.status = e.status
if (e.owner) fm.owner = e.owner
// Owner and cadence are now stored in properties, not first-class fields
const owner = e.properties?.Owner ?? e.properties?.owner
const cadence = e.properties?.Cadence ?? e.properties?.cadence
if (owner) fm.owner = typeof owner === 'string' ? owner : String(owner)
if (cadence) fm.cadence = typeof cadence === 'string' ? cadence : String(cadence)
if (e.belongsTo.length > 0) fm.belongsTo = e.belongsTo
if (e.relatedTo.length > 0) fm.relatedTo = e.relatedTo
if (Object.keys(e.relationships).length > 0) fm.relationships = e.relationships