蓝色天空.知识 · 实践 · 创造
我的收藏
在线代码实验室

比较启用本地插件前后的真实工具输出

JAVASCRIPTWindows、Python 3.12、Git、OpenCode V1.19.5 和本机回环测试模型。inventory-evidence.js
inventory-evidence.js14 行
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

本地运行步骤快速上手
  1. 点击上方“保存源码”保存为 inventory-evidence.js,或下载右侧课程工程包。
  2. 确认本地已准备 Windows、Python 3.12、Git、OpenCode V1.19.5 和本机回环测试模型。。
  3. 按对应章节命令执行,结合正文核对实际输出。
附件与关联工程包下载

下载课程关联工程包:OpenCode

课程关联工程包(登记关联1章) · 含当前章节或实例 · mbskycom202612a241.zip

下载课程关联工程包:OpenCode

课程关联工程包(登记关联28章) · 含当前章节或实例 · mbskycom202612a236.zip
SITE SEARCH

搜索教程、工具与资讯

热门搜索

JavaScriptJSON格式化正则表达式AI 编程AI 翻译AI导航专题标签
Esc 关闭

欢迎登录蓝色天空网

使用会员账号,继续你的学习