Vercel News
Enforce consistent code for agents and humans with konsistent
6.7内容质量
TL;DR · AI 摘要
Enforce consistent code for agents and humans with konsistent - Vercel konsistent is now open source. konsistent is a CL...
核心要点
- 主题聚焦:Enforce consistent code for agents and humans wi
- 来源:Vercel News,建议结合原文判断细节。
- AI 分析暂不可用,本条为保底评分与摘要。
#AI#编程#前端#安全#开源
打开原文使用 konsistent 为代理和人类强制执行一致的代码 - Vercel
konsistent 现已开源。
konsistent 是一个 TypeScript 代码库的 CLI 代码检查工具,通过强制执行结构化规范,为代理和人类提供一致的上下文,帮助他们正确实现功能。它具有确定性、快速,并涵盖 TypeScript 和 ESLint 未建模的结构化模式。
在项目级别的 konsistent.json 文件中配置规范,用于处理以下问题:
- 所有符合模式 X 的文件是否都导出函数 Y 和 Z?
- 每个包含文件 X 的文件夹是否也包含文件 Y?
- 从符合模式 X 的文件中导出的每个类是否都实现了类型 Y?
konsistent 被用于 AI SDK 和 Chat SDK 中,以强制执行结构化代码规范。
code
▲ pnpm konsistent
packages/harness-demo-code/src/index.ts
- error 未从 "./demo-code-harness" 导出类型 "DemoCodeHarnessSettings" [harness-package-must-export-harness-creator-and-settings]
- error 缺少导出常量 "demoCode" [harness-package-must-export-harness-creator-and-settings]
packages/harness-demo-code/src/demo-code-harness.ts
- error 缺少必需文件:demo-code-auth.ts [harness-file-must-export-harness-creator-and-settings-type]
- error 缺少导出类型 "DemoCodeHarnessSettings" [harness-file-must-export-harness-creator-and-settings-type]
- error 缺少导入类型 "HarnessV1" [harness-file-must-export-harness-creator-and-settings-type]
- error 缺少本地类型声明 "DemoCodeBridgeCoords" [harness-file-with-bridge-must-declare-bridge-contracts]
- error 缺少本地常量声明 "demoCodeBridgeCoordsSchema" [harness-file-with-bridge-must-declare-bridge-contracts]
12 error 函数 "createDemoCode" 必须返回类型 "HarnessV1" 的值 [harness-file-must-export-harness-creator-and-settings-type]
packages/harness-demo-code/src/demo-code-bridge-protocol.ts
- error 缺少导出类型 "BridgeReady" [harness-bridge-protocol-file-must-export-relevant-symbols]
- error 缺少导出常量 "bridgeReadySchema" [harness-bridge-protocol-file-must-export-relevant-symbols]
packages/harness-demo-code/src/bridge/index.ts
- error 缺少本地函数声明 "runTurn" [harness-bridge-must-declare-and-use-relevant-symbols]
- error 缺少导入 "runBridge" [harness-bridge-must-declare-and-use-relevant-symbols]
- error 缺少导入类型 "StartMessage" [harness-bridge-must-declare-and-use-relevant-symbols]
- error 缺少导入类型 "BridgeEvent" [harness-bridge-must-declare-and-use-relevant-symbols]
- error 缺少导入类型 "BridgeTurn" [harness-bridge-must-declare-and-use-relevant-symbols]
已检查 340 个文件,耗时 212 毫秒。发现 15 个错误。konsistent CLI 对 AI SDK 中 "Demo Code" harness 适配器的示例输出
使用 konsistent 技能帮助您的代理为项目创建 konsistent.json 文件:
code
1
npx skills
add
vercel-labs/konsistent
--skill
konsistent-config添加此技能,让您的代理与您一起创建 konsistent.json 文件
开始使用 konsistent
安装包后,使用技能与代理配合声明规范。
开始使用 /think