Files
deepseek-harness/apps/web/tests/fixtures/plugins/fixture-forge-extension/index.js
T
Yichen Jiang aae5b719a9 docs(forge): document the extension API and replay a fixture extension
Add the forge subsystem's extension API section, README and cookbook
coverage, the generated Cordis, config, slot, and event catalogs, and a
recorded forge-panel e2e case that loads a fixture plugin registering a
lens, annotations, and every new slot.
2026-11-10 14:53:09 +08:00

28 lines
981 B
JavaScript

/** Host half of the forge extension fixture: a filter lens that keeps the files whose new side has `export` lines, about those lines. */
export const name = '@fixture/forge-extension'
export const inject = ['forgePanel']
/** @param {import('@deepseek-ai/cordis').Context} ctx */
export function apply(ctx) {
ctx.forgePanel.registerLens({
id: 'fixture/exports',
version: '1',
async classify(input, signal) {
const files = {}
let done = 0
for (const file of input.files) {
const text = await input.text('new', file.path, signal)
done += 1
input.progress(done, input.files.length)
if (text === null) continue
const ranges = []
text.split('\n').forEach((line, index) => {
if (/^export\b/.test(line)) ranges.push({ start: index + 1, end: index + 1 })
})
if (ranges.length > 0) files[file.path] = { ranges: { old: [], new: ranges } }
}
return { files }
},
})
}