- 19 条黄金种子 IR,覆盖全部 5 领域 13 行业
intentc memory seedCLI 命令,可重复运行(自动去重)- 记忆库从零开始 → 首次使用即可享受行业匹配的 few-shot learning
- 前缀缓存优化: 系统提示重排——固定内容(规则/Schema/示例)前置 → DeepSeek 自动前缀缓存,后续调用 TTFT 降低 40-80%
- Schema Minify: 剥离所有 description 字段,4291→1708 chars(-60%, ~646 tokens)
- 响应缓存: LRU Map 缓存,5-min TTL,最多 50 条,相同 NL 输入 0ms 返回
- Token 预算动态调整: ≤4 sections→2048, ≤7→3072, 更大→4096
- web_page 7条:制造/SaaS/餐饮/摄影/电商/教育/医疗
- slide_deck 3条:融资PPT/新品发布/安全培训
- document 3条:产品说明书/技术报告/企业宣传册
- ecommerce_content 3条:产品详情/品牌发布/大促营销
- business_report 3条:经营分析/SaaS季度回顾/创业数据看板
基于 v0.1.0 方案:5 个垂直切片,Web 页面领域,MIT 协议。
- IR Schema v0.1.0:7 section types (hero/features/specs/faq/contact_form/trust_badges/footer/custom)
- NL → IR 编译器:prompt 模板 + AJV 校验 + 自动重试
- Anthropic/OpenAI 双 provider,支持 DeepSeek baseURL
- HTML 渲染器:8 种 section 渲染器,内联样式,零 JS 依赖
- CLI:管道输入/文件输入/JSON+HTML 输出
- DR.Warm 真实 B2B 制造网站示例
- README:LLVM 类比,IR 文档,快速开始
- TypeScript 零错误
- 端到端测试通过("牙刷工厂B2B官网" → IR JSON → 10KB HTML)
- Playwright 浏览器渲染确认(5 sections 正确展示)
- AJV 不支持 draft-2020-12,改 draft-07
- Shell 中文参数需 pipe 输入,直接 positional arg 会截断
- renderContactForm 访问
meta变量不在作用域 → 加lang参数
v0.2.0 — 多渲染器(React + Markdown)展示 IR 可复用价值
- 12 种 section type 渲染器(含新增的 pricing/gallery/cta/testimonials)
- 完整 .tsx 输出:imports + typed components + useState hooks + 默认导出
- 样式对象模式(CSS-in-JS),零外部依赖
- 模板字面量嵌套冲突修复({plan.xxx} → 预处理 cards 字符串)
- 12 种 section type → 格式化 Markdown
- 自动生成目录(Contents)
- 元数据头部
- 表格(specs)、引用块(testimonials)、图片(gallery)
- 新增 section types: pricing, gallery, cta, testimonials
- 从 8 种扩展到 12 种
- Compiler prompt 同步更新 section 映射规则
- 同一份 IR (gym-ir.json) → HTML (7284B) + React (8088B) + Markdown (531B) 三路输出
- 内容一致性确认(5 sections 完全对应)
intentc diff a.json b.json— 人类可读的变更摘要- 检测:意图变更、设计变更、section 增删
- 演示"IR 可版本化"——Agent 对话做不到的事
- 独立 HTML 页面 (
src/playground/index.html) - JSON 编辑器(左)+ 实时预览(右),12 section 类型
- 4 个内置模板:landing/saas/DR.Warm/portfolio
- 拖拽分隔条、复制粘贴、下载 HTML
intentc play一键启动
compile(input, { lockFields: ['design'], existingIR })— 锁定字段后只编译目标- Prompt 层 + 编译后强制恢复,双重保证
- 验证:lock design → 加 gallery → design 零变化
intentc translate ir.json zh-CN|en-US|ru-RU- 锁定 design + intent,翻译 layout 文本内容
- Section 结构验证,结构变化时自动恢复
- 实测:中文 "甜蜜时刻,从一口开始" → 英文 "Sweet Moments, Start with a Bite"
intentc template list— 4 个模板- 模板已内嵌到 playground
- 6 种 slide section types: title_slide/content_slide/bullets_slide/quote_slide/image_slide/ending_slide
renderSlideDeck(ir)→ 独立 HTML 演示文稿- 键盘导航(← → Space)、幻灯片计数器、点击翻页
--render slideCLI 支持
- 7 种 document section types: document_title/chapter/body/doc_table/doc_image/toc
renderDocument(ir)→ 打印友好的 HTML 文档- Serif 字体、自动目录、
@media print适配 PDF 导出 --render documentCLI 支持
intent.domain从'web_page'扩展为'web_page' | 'slide_deck' | 'document'- 总 section type 从 12 种扩展到 24 种
- Compiler prompt 支持三领域 section 映射
- 同一品牌描述(DR.WARM)→ 三领域编译
- Web (3 sections) + Slide (4 slides) + Document (4 chapters)
- 三份输出共享一致的品牌信息和设计系统
src/mcp-server.ts— STDIO MCP server exposing 5 toolscompile_intent— NL → IR (any domain)render_format— IR → HTML/React/MD/Slide/Documentdiff_ir— Compare two IR filestranslate_ir— zh-CN/en-US/ru-RU translationlist_templates— Built-in templates list- Verified: stdio handshake + tools/list response
.mcp.jsonauto-generated for Claude Code integration
- Any MCP agent (Claude Code, Cursor, Copilot) can call intent-compiler
- IR preprocessing before code generation → eliminates NL ambiguity
- STDIO transport → auto-started by agent, zero config
RendererRegistryclass — centralized Map-based registrationIntentRendererinterface:{ meta: RendererMeta, render: (ir) => string }- Contract validation at registration time
- Priority-based ordering
- Domain-aware filtering
discoverRenderers(dir)— auto-scan directory for renderer files- Example:
examples/renderers/pdf-brochure.ts— third-party PDF brochure renderer - Drop a
.tsor.jsfile → register → available in CLI and MCP
intentc renderer list— list all registered renderers (built-in + external)intentc renderer discover <dir>— scan and register from directoryintentc renderer add <dir>— alias for discover
list_renderersMCP tool addedrender_formatnow uses registry (not hardcoded imports)
.github/workflows/ci.yml— GitHub Actions: npm ci → tsc → test → build- Ubuntu latest, Node 22, cache enabled
- 15 unit tests, 2 suites: schema (7 tests) + registry (8 tests)
- Zero API key needed — all tests run offline
npm testviatsx --test
- Architecture overview, good first issues, development rules, PR guidelines
.npmignore— exclude tests, dev files, examplesprepublishOnlyhook — auto-build before publish
- Chinese quick-start section for domestic users
- MCP setup instructions
- CI badge + test badge
- SQLite-based (node:sqlite, zero external deps)
.intent-compiler/memory.db - FTS5 full-text search + industry matching + section pattern extraction
- Every compile() automatically recorded (unless locked fields mode)
- Before compilation: search memory for similar past IRs
- Inject top matches as few-shot examples into compiler prompt
- Verified: 3 factory compilations → consistent hero,features,specs,faq,contact_form pattern
intentc memory stats|search|patterns|clear
- CHANGELOG.md — standard changelog format for all versions v0.0.1–v0.0.8
- Interactive CLI — 4 questions → scaffold project
- Generates: ir.json, CLAUDE.md, .env.example
- Supports 3 domains, 5 color styles, 6 industries
compileStream()— async generator: start → token → complete/error- Uses Anthropic SDK streaming API
- For Playground progress UI and large compilations
.intent-compiler/added to .gitignore
- 同一 NL → Path A (直接 Agent) vs Path B (IR→Agent)
- 工厂站测试:Path B 完整度显著高于 Path A
- Section 遗漏: Path A 缺认证标志,Path B 6/6 完整
- 内容缩水: Path A 规格 2→6项(67%丢失), FAQ 2→5条(60%丢失)
- 配色漂移: Path A 随意, Path B 精确匹配 IR
- 遗漏(forgotten sections)
- 缩水(fewer items than requested)
- 漂移(wrong design choices)
实验报告: test-output/EXPERIMENT.md