import {writeFile} from "node:fs/promises";
import {join} from "node:path";
export const InventoryEvidence = async ({worktree}) => {
await writeFile(join(worktree, "plugin-loaded.txt"), "inventory check fixture\n");
return {
"tool.execute.after": async (input, output) => {
if (input.tool === "read" && output.output.includes("sample-stock=17")) {
output.output += "\nlocal inventory evidence: matched";
}
},
};
};
本例需在 Windows、Python 3.12、Git、OpenCode V1.19.5 和本机回环测试模型。 中运行,请复制源码、保存文件或下载工程包后在本地执行验证。
运行说明与环境独立工程
运行环境:Windows、Python 3.12、Git、OpenCode V1.19.5 和本机回环测试模型。
入口文件:projects/opencode-ecosystem/inventory-evidence.js
本地运行步骤快速上手
- 点击上方“保存源码”保存为
inventory-evidence.js,或下载右侧课程工程包。 - 确认本地已准备 Windows、Python 3.12、Git、OpenCode V1.19.5 和本机回环测试模型。。
- 按对应章节命令执行,结合正文核对实际输出。
附件与关联工程包下载
课程关联工程包(登记关联1章) · 含当前章节或实例 · mbskycom202612a241.zip
课程关联工程包(登记关联28章) · 含当前章节或实例 · mbskycom202612a236.zip