feat(api): macro indexing from .kc files and read-only API #152
Reference in New Issue
Block a user
Delete Branch "feat/kc-macros"
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?
Summary
Extract
silo/macros/*.pyfiles from .kc ZIP archives on commit and index them into theitem_macrostable (migration 018). Two read-only API endpoints let clients list macros and retrieve source content.New files
internal/db/item_macros.go— Repository withReplaceForItem,ListByItem,GetByFilenameinternal/api/macro_handlers.go—HandleGetMacros,HandleGetMacroModified files
internal/kc/kc.go—MacroFiletype,Macrosfield inExtractResult, ZIP scan forsilo/macros/*internal/api/handlers.go— Addmacrosfield to Server structinternal/api/metadata_handlers.go— Index macros inextractKCMetadata+ SSE broadcastinternal/api/routes.go— RegisterGET /macrosandGET /macros/{filename}Endpoints
/api/items/{partNumber}/macros/api/items/{partNumber}/macros/{filename}Design decisions
silo/macros/*and are preserved on pass-throughCloses #144
Depends on: PR #149 (Phase 1)
- Add MacroFile type to internal/kc and extract silo/macros/* files from .kc ZIP archives on commit - Create ItemMacroRepository with ReplaceForItem, ListByItem, and GetByFilename methods - Add GET /{partNumber}/macros (list) and GET /{partNumber}/macros/{filename} (source content) endpoints - Index macros in extractKCMetadata with SSE broadcast - List endpoint omits content for lightweight responses Closes #144