refactor(skill-loader): eager loading with atomic file reads
- Extract body during initial parseFrontmatter call - Rename lazyContent → eagerLoader with rationale comment - Eliminates redundant file read and race condition
This commit is contained in:
parent
6bbe69a72a
commit
79bd75b3db
@ -84,7 +84,10 @@ ${body.trim()}
|
|||||||
$ARGUMENTS
|
$ARGUMENTS
|
||||||
</user-request>`
|
</user-request>`
|
||||||
|
|
||||||
const lazyContent: LazyContentLoader = {
|
// RATIONALE: We read the file eagerly to ensure atomic consistency between
|
||||||
|
// metadata and body. We maintain the LazyContentLoader interface for
|
||||||
|
// compatibility, but the state is effectively eager.
|
||||||
|
const eagerLoader: LazyContentLoader = {
|
||||||
loaded: true,
|
loaded: true,
|
||||||
content: templateContent,
|
content: templateContent,
|
||||||
load: async () => templateContent,
|
load: async () => templateContent,
|
||||||
@ -111,7 +114,7 @@ $ARGUMENTS
|
|||||||
metadata: data.metadata,
|
metadata: data.metadata,
|
||||||
allowedTools: parseAllowedTools(data["allowed-tools"]),
|
allowedTools: parseAllowedTools(data["allowed-tools"]),
|
||||||
mcpConfig,
|
mcpConfig,
|
||||||
lazyContent,
|
lazyContent: eagerLoader,
|
||||||
}
|
}
|
||||||
} catch {
|
} catch {
|
||||||
return null
|
return null
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user