@aid-framework/generator-ts-vercel

中文文档
0.1.98发布于 2026/11/03Apache-2.0TypeScriptES Module构建来源已验证近 30 天下载 1.1万

AID generator for a Next.js App Router (Vercel) TypeScript target.

原始使用文档
文档目录10 节
  1. Install
  2. Use it
  3. What it emits
  4. A note on app/
  5. Capabilities
  6. The business/ seam
  7. Determinism
  8. Programmatic use
  9. Related packages
  10. License

@aid-framework/generator-ts-vercel

The TypeScript / Vercel target for AID Framework. It compiles an IR into a Next.js app whose behaviour lives in @aid-framework/runtime, with a business/ tier the compiler creates once and never touches again.

app.spec.yaml ──aid gen --target ts-vercel──▶ app/generated/  (compiler)
                                              app/business/   (you)

Install

npm install --save-dev @aid-framework/generator-ts-vercel

Requires Node.js 24 or newer. In practice you pull it in through @aid-framework/cli.

Use it

A spec generates one target at a time, so a project that ships both stacks declares both:

project:
  name: support-copilot
  targets:
    - py-fastapi
    - ts-vercel
npx aid gen --target ts-vercel
ts-vercel: 20 created, 0 updated, 0 unchanged, 0 kept

--target selects among the targets the spec declares. Naming an undeclared one fails with target-unsupported and lists what is declared, because generating a stack the spec never asked for would make the spec a lie.

What it emits

PathContents
app/generated/index.tsThe package's public surface
app/generated/deps.tsWiring: gateway, registry, executor, pipelines
app/generated/control.tsThe composite-step helpers the pipelines use
app/generated/schemas.tszod schemas derived from the IR's types
app/generated/gateway/models.tsModelSpec values and pinned aliases from the IR
app/generated/observability.tsTracer setup
app/generated/guardrails.tsThe guardrail policies the IR declares
app/generated/contracts/The interface each business module must satisfy
app/generated/pipelines/One module per pipeline, as ordinary async code
app/generated/prompts/The registry the IR's prompts resolve into
app/generated/tools/Tool definitions and dispatch
app/generated/evals/The eval dataset and gate thresholds
app/generated/retrieval/Retriever bindings, plus ingest/ for corpus indexing
app/generated/routes/Request handlers for pipelines with an http trigger
app/business/, app/business/prompts/, app/business/tools/Your seam — created once, then never touched

The exact file set follows the spec: a spec that declares no retrievers emits no retrieval/ modules.

A note on app/

The output root is app/, which is also Next.js's own directory convention. That collision is deliberate and accepted for parity with the other target's layout: the generated tree sits at the project's app/, alongside whatever Next puts there. If you already have a Next project at that root, generate into a fresh directory rather than merging the two.

Capabilities

http-trigger, json-schema, tool-calling, otel,
embeddings, rerank, guardrails, agents, cursor-memory

It emits against zod for structured output and otel-genai for tracing.

Note the absence of streaming: this target does not declare it, so the IR's deploy/streaming gate rejects a spec that asks for a streaming deployment here rather than emitting an endpoint that cannot stream.

The business/ seam

Everything in generated/ is replaced on the next aid gen. business/ is created only if missing and is never written again — that is where prompts, tool handlers and domain logic belong.

app/generated/contracts/ carries the interfaces the business modules implement, so a missing or misnamed export is a type error at build time instead of a runtime surprise.

Determinism

Given the same IR, this generator produces byte-identical output — no timestamps, no absolute paths, no host names, and import order derived from stable ids rather than from filesystem walk order. That makes generated/ diffable and keeps a regeneration from producing a diff it did not mean.

Programmatic use

import { manifest, plan } from '@aid-framework/generator-ts-vercel';
import type { Generator } from '@aid-framework/generator-sdk';

The generator satisfies the Generator contract from @aid-framework/generator-sdk: plan(ir) is pure and emit(plan) returns the file set. Ownership, drift detection and manifest writing are the SDK's, so this package contains no regeneration logic of its own.

License

Apache-2.0. Code generated by AID Framework is not subject to this license.

版本与发布记录

@aid-framework/generator-ts-vercel 共发布 52 个版本,首次发布于 2026/10/31;过去 12 个月发布了 52 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.1.98latest2026/11/032 天前
0.1.972026/11/032 天前
0.1.962026/11/033 天前
0.1.952026/11/033 天前
0.1.942026/11/033 天前
0.1.932026/11/033 天前

关于 @aid-framework/generator-ts-vercel 的常见问题

@aid-framework/generator-ts-vercel 是什么?

AID generator for a Next.js App Router (Vercel) TypeScript target.

如何安装 @aid-framework/generator-ts-vercel?

在项目目录运行 npm install @aid-framework/generator-ts-vercel,或使用 pnpm add / yarn add / bun add。

@aid-framework/generator-ts-vercel 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@aid-framework/generator-ts-vercel 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@aid-framework/generator-ts-vercel 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=24。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@aid-framework/generator-ts-vercel 可以商用吗?

@aid-framework/generator-ts-vercel 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@aid-framework/generator-ts-vercel 的下载量有多少?

根据 npm 官方下载统计,@aid-framework/generator-ts-vercel 在 2026/10/06 – 2026/11/04 这 30 天内被下载 10,854 次,日均约 362 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@aid-framework/generator-ts-vercel 还在维护吗?

最新版本 0.1.98 发布于 2026/11/03(2 天前);至今共发布 52 个版本,其中过去 12 个月发布了 52 个;首次发布于 2026/10/31。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。