summaryrefslogtreecommitdiff
path: root/tests/opencode/test-plugin-loading.sh
diff options
context:
space:
mode:
authorvoidborne-d <voidborne-d@users.noreply.github.com>2026-04-20 13:54:14 +0000
committerDrew Ritter <drew@ritter.dev>2026-04-27 11:56:00 -0700
commitc13a884c06af1d213f1a2debd13f13970ab74e45 (patch)
tree15126f3754f649276f7d27c8bcfd1d6e5e1aa55c /tests/opencode/test-plugin-loading.sh
parent1ca87f861f43a59c41fc6b3ce583f870c1467204 (diff)
fix(opencode): cache bootstrap content at module level to eliminate per-step file I/O
getBootstrapContent() called fs.existsSync + fs.readFileSync + regex frontmatter parsing on every agent step with zero caching. The experimental.chat.messages.transform hook fires every step in opencode's agent loop (messages are reloaded from DB each step via filterCompactedEffect). A 10-step turn triggered 10 redundant file reads + 10 regex parses for content that never changes during a session. Changes: - Add module-level _bootstrapCache (undefined = not loaded, null = file missing) so the first call reads and parses SKILL.md, all subsequent calls return the cached string with zero filesystem access - Cache the null sentinel when SKILL.md is missing, preventing repeated fs.existsSync probes - Add _testing export (resetCache/getCache) for test infrastructure - Clarify the injection guard comment explaining how it interacts with opencode's per-step message reloading - Add 15 regression tests covering cache behavior, fs call counts, injection guard, missing file sentinel, cache reset, and source audit Fixes #1202
Diffstat (limited to 'tests/opencode/test-plugin-loading.sh')
0 files changed, 0 insertions, 0 deletions