返回资讯中心
外部精选
软件工程
#开发者实时流

I miss the old ways, so I am trying to find a middleground

Compile typed specs into verified TypeScript with small local models.

Hacker News 最新themissenoone2026/10/31 · 17 天前5 分钟阅读

以下正文同步自 Hacker News 最新,版权归原站所有,已转换为易读排版。

Compile typed specs into verified TypeScript with small local models.

You write the contract: a function type, an intent and examples. OpenArc gives a local model only the context that one function needs, the way a unit test isolates code. It verifies the returned body with tsc, static rules (including an optional calls allowlist of the functions it may call) and your examples in a sandbox, where a block only counts as verified if an example actually runs it. Only then does it splice the body in. Hand edits are never overwritten, and the model can't touch anything outside its own region.

import * as arc from "open-arc";

type NormalizeTitle = (title: string) => string;

export const normalizeTitleSpec = arc.defineRegion<NormalizeTitle>({ id: "tasks.normalizeTitle", intent: "Trim, collapse internal whitespace to one space, capitalize the first letter.", examples: [ { args: [" buy milk "], expected: "Buy milk" }, { args: [" "], expected: "" }, ], });

Install from npm: open-arc (the command is openarc).

npm i -D open-arc && npx openarc init npx openarc scaffold && npx openarc compile npx openarc watch # or keep it running: recompiles regions as you save, one at a time

Documentation: Wiki (source in docs/wiki/) · Specification

Path What

SPEC-phase0.md normative specification (v0.3)

selfhost/ OpenArc written as an OpenArc project. It's the source of truth; regions are compiled by OpenArc itself

stage0/ the bootstrap compiler: selfhost/ with every region written by hand; builds the open-arc npm package

examples/demo/ the smallest real project

docs/wiki/ wiki pages

Develop

cd stage0 && npm i && npx tsc -p . && node tools/run-examples.ts --strict # 24/24 regions for f in tests/*.check.ts; do node $f; done # no model, no network node tools/build.ts && (cd build && npm pack) # openarc-x.y.z.tgz cd ../selfhost && npm i && npx openarc compile --keep-going # OpenArc compiling OpenArc

Requires Linux with bwrap and prlimit, Node ≥ 23.6, and a model: local via Ollama, or any API (OpenAI-compatible such as OpenAI, OpenRouter, Groq and vLLM, or Anthropic). Keys are read from environment variables named in openarc.config.json; see Configuration.

正文由 探How 从来源站点 RSS 同步,内容未经改写;遇到排版缺失或需要图片、视频时请以原文为准。

打开原文
去社区讨论 →