CodeSampleX
同一段代码,不必解决两次。
编码助手每天都在重新解决同样的公开库问题:翻文档、猜 API、安装、编译失败、猜版本差异、修好、成功——然后会话结束就全忘了。CodeSampleX 会记住。它收集真实开发环境中「什么真的能跑、什么会坏」的匿名证据,并把已验证的答案连同与你环境的确切差异一起交给助手。
irm https://codesamplex.dev/install.ps1 | iexcurl -fsSL https://codesamplex.dev/install.sh | sh一行命令,一个问题,其余全部自动完成。
源代码 · 阅读安装脚本 · Apache-2.0
- 已经跑通的答案在干净沙箱中通过 contract 验证的最小样本,而不是「应该能用」的代码片段。
- 按你的环境评级每个结果都针对你的版本、运行时与执行上下文(Node、浏览器、WebView、Electron、Worker)评级。
- 对失败诚实在哪里坏、多频繁,原因以概率呈现,绝不编造确定性。
与你的编码智能体协同工作
- Claude Code
- Codex
- Gemini CLI
- OpenCode
csx init 会自动检测并注册 MCP 服务器,无需手动修改配置文件。
Any other MCP client works too — Cursor, Windsurf, Cline, Zed, VS Code. csx is a standard stdio MCP server. Run this and paste what it prints; it fills in the absolute path of your install, which a client started by your editor will not find on its own:
csx mcp-config与模型无关。同一份兼容性证据可供 Claude、GPT 与 Codex、Gemini、Llama 等任何能调用 MCP 工具的模型使用。
网络状态
文档这样写,契约实测是这样
每一条都由一个已发布样本实测得出,其契约在固定容器中离线运行。点击即可查看。
-
npm zod 4.4.3, Node 22
普遍认为 z.coerce.number() parses a numeric string, rejecting what is not a number.
实测 it is Number(input) followed by the number check, not a numeric parser, so "", " ", null, false and [] are all accepted and arrive as 0 — an empty form field or a null column silently becomes zero — while "1e999" is rejected, because Number() overflows it to Infinity.
-
npm bcryptjs 3.0.3, Node 22
普遍认为 a password hash covers the whole password.
实测 bcrypt truncates at 72 bytes and neither hashSync nor compareSync reports it: a second, different password sharing the first one's 72-byte prefix verifies against that hash, and so does the bare prefix, while 71 bytes does not; the limit is bytes, so 36 accented characters survive and 37 lose their tail, and bcryptjs's own truncates() is a separate call you have to make yourself.
-
npm jose 6.2.8, Node 22
普遍认为 RFC 7518 §3.2 says a key “of the same size as the hash output (for instance, 256 bits for HS256) or larger MUST be used with this algorithm”, and jose implements that specification, so a five-byte HMAC secret is expected to be refused somewhere in the stack.
实测 jose signs and verifies an HS256 token with a five-byte key and reports nothing, and WebCrypto underneath imports the same 40-bit HMAC key just as willingly, so nothing below the library catches a weak secret either.
更多用户 更多真实环境 更好的兼容性证据 更好的答案 · 2026-08-16T11:05:38Z
工作方式
在 axios 1.12 + Node 22 + pnpm + Windows 11 上,axios.post 到底能不能用?不能的话在哪一步坏掉? 官方文档回答不了。来自成千上万台真实机器的证据可以。
- 你通过 csx 构建或测试 —— 也可以由编码智能体代劳。
- 你的机器分析涉及了哪些公开包、版本与 API 符号,以及哪个阶段通过或失败。
- 错误在本地被提炼成指纹。路径、项目名、密钥和原始日志绝不外传。
- 匿名证据批次汇聚成你正在浏览的公开兼容性地图。
- 你的智能体先问 CodeSampleX,拿到最接近的已验证样本以及与你环境的确切差异。
编码智能体通过 MCP 直接使用:写公开库代码前先问 CodeSampleX,并回报该答案是否构建成功。
目前能观测到什么
- npm npm, pnpm, yarn PROBABLE 包与版本构建、类型检查与测试结果用了哪个 API带 contract 的已验证样本
- pypi pip, uv PROBABLE 包与版本构建、类型检查与测试结果用了哪个 API带 contract 的已验证样本
- golang go PROBABLE 包与版本构建、类型检查与测试结果用了哪个 API带 contract 的已验证样本
- cargo cargo PROBABLE 包与版本构建、类型检查与测试结果用了哪个 API带 contract 的已验证样本
- composer composer UNKNOWN 带 contract 的已验证样本包与版本构建、类型检查与测试结果用了哪个 API
- gem bundler UNKNOWN 带 contract 的已验证样本包与版本构建、类型检查与测试结果用了哪个 API
- pub pub UNKNOWN 带 contract 的已验证样本包与版本构建、类型检查与测试结果用了哪个 API
- hex mix UNKNOWN 带 contract 的已验证样本包与版本构建、类型检查与测试结果用了哪个 API
安装契约
你将获得
- 公共兼容性知识
- 经过验证的代码答案
- 本地智能体集成
- 公共示例缓存
你将贡献
- 公共包/版本使用情况
- 可检测的公共 API/符号使用情况
- 构建/类型检查/测试结果
- 脱敏后的失败指纹
绝不自动共享
- 源代码
- 仓库/项目名称
- 文件名或路径
- 源码片段
- 密钥或环境变量
- 私有包
- 原始编译器/运行时日志