feat(api): .kc item macros indexing + API (Phase 4) #144
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Implement macro registration from .kc files and read-only API endpoints as specified in KC_SERVER.md Sections 3.4 and 4.4.
Depends on: #141 (Phase 1 -- commit extraction pipeline)
Supports: SILO_VIEWPORT Phase 6 (Macro Editor widget), future Macro Store module
Commit-time Extraction
Extend the extraction pipeline to read
silo/macros/*.pyfiles from the .kc ZIP and upsert rows intoitem_macros. Each macro is stored with its filename, trigger type, and full source content. UNIQUE(item_id, filename) -- re-committing the same file name overwrites.API Endpoints (Section 4.4)
GET/api/items/{pn}/macrosGET/api/items/{pn}/macros/{filename}These are read-only server-side. Macros are authored in Create and committed inside the .kc. The server indexes them for discoverability.
Implementation scope
internal/kc/extract.goto iterate silo/macros/ ZIP entriesinternal/db/item_macros.go-- repository (upsert, list, get by filename)internal/api/macro_handlers.go-- HTTP handlersAcceptance criteria