Repository navigation
交付可运行的首个组件示例 / Ship a runnable first-component example #24
Description
Activity
- addeddocumentationImprovements or additions to documentationImprovements or additions to documentationenhancementNew feature or requestNew feature or requestarea: authoring组件作者 API / Component authoring API组件作者 API / Component authoring APIexperience: onboarding首次运行与学习路径 / First-run and learning path首次运行与学习路径 / First-run and learning pathpriority: next下一批次 / Next batch下一批次 / Next batchpriority: now当前开发批次 / Current development batch当前开发批次 / Current development batchstatus: in progress当前正在推进 / Active implementation当前正在推进 / Active implementationand removedpriority: next下一批次 / Next batch下一批次 / Next batch
on Aug 31, 2026 中文
当前实施计划
本轮把 #24 作为当前 onboarding 工作。目标不是再写一份教程代码,而是建立一条“公共组件模块 → 极小执行 host → 稳定命令 → 文档链接”的单一事实来源。
- 新增
examples/first-component/component.kk:只import explore/react,包含一个 FAQ/disclosure 的 typed store、serializable action 和带 keyed boundary 的 view;它不依赖 runtime、inspection 或 renderer。 - 新增
examples/first-component/main.kk:作为明确的 advanced host,负责在内存中运行初始 render、发送一次Toggletyped action、再次 render,并输出初始 HTML、action 与更新后的 HTML/state。 - 新增
yarn example:first-component:使用独立.koka-examplebuild directory 执行该 entry;再由yarn check调用,保证 clean checkout 的命令路径持续可用。 - 将 quick start 从重复的 FAQ 代码块改为概念说明、运行命令、预期输出和指向已编译源码的链接;README/component authoring guide 只链接该路径,不复制第二份实现。
- 添加一个轻量 Koka assertion 或命令级 check,验证公共 import 边界、初始 render、action observation 和 transition 后的 render;随后运行
yarn example:first-component、yarn test:koka、yarn check与浏览器回归。
设计边界
- component module 只展示作者日常写法;renderer/state runtime 的调用只在 host 中出现,并明确标为 advanced integration。
- 例子使用 snapshot store 和一个有限 action,避免把 replay、domain workflow、浏览器 bridge 或 HMR 细节塞进第一条成功路径。
- 发布组件编译错误 cookbook / Publish a component compile-error cookbook #25 会复用这个可运行例子的真实 public API,补充六类“失败代码 → 最小修复”条目;不在 交付可运行的首个组件示例 / Ship a runnable first-component example #24 中提前引入错误 fixture 或诊断框架。
完成信号
命令输出应能在一屏内读出:初始 closed UI、
Toggle_disclosureintent、以及 updated open UI。完成后将创建双语 PR,并把 #24 更新为status: shipped;#25 再成为priority: now。English
Current implementation plan
This round makes #24 the active onboarding work. The goal is not another copy of tutorial code; it is one source of truth through a “public component module → tiny executable host → stable command → documentation links” path.
- Add
examples/first-component/component.kk: it uses onlyimport explore/reactand contains a FAQ/disclosure typed store, serializable action, and keyed-boundary view. It imports no runtime, inspection, or renderer module. - Add
examples/first-component/main.kk: this explicit advanced host runs an in-memory initial render, sends one typedToggleaction, renders again, and prints initial HTML, the action, and updated HTML/state. - Add
yarn example:first-component: it executes the entry with a separate.koka-examplebuild directory;yarn checkwill invoke it so the clean-checkout command path remains continuously valid. - Change the quick start from duplicate FAQ code blocks to concept guidance, the run command, expected output, and links to the compiled source. README/component-authoring guidance will link this path instead of copying a second implementation.
- Add a lightweight Koka assertion or command-level check for the public-import boundary, initial render, action observation, and post-transition render; then run
yarn example:first-component,yarn test:koka,yarn check, and browser regression.
Design boundaries
- The component module shows only everyday authoring; renderer/state-runtime calls stay in the host and are explicitly marked as advanced integration.
- The example uses a snapshot store and one finite action. Replay, domain workflows, the browser bridge, and HMR details do not belong in the first-success path.
- 发布组件编译错误 cookbook / Publish a component compile-error cookbook #25 will reuse this runnable example’s real public API for six “failing code → minimal fix” entries. 交付可运行的首个组件示例 / Ship a runnable first-component example #24 will not preemptively add error fixtures or a diagnostic framework.
Completion signal
The command output should fit on one screen and show an initial closed UI, the
Toggle_disclosureintent, and an updated open UI. Completion creates a bilingual PR and moves #24 tostatus: shipped; #25 then becomespriority: now.- 新增
中文
首个实现批次已提交为 PR #28:
examples/first_component/component.kk只使用公共import explore/react,演示 typed store、serializable action、use_store、feature_root与on_store_click;examples/first_component/main.kk明确作为 advanced host,在内存中完成 initial render、registered click、action observation 和 updated render;yarn example:first-component会编译、执行并校验closed → Toggle_disclosure → open输出,yarn check也会持续运行它;- quick start 改为链接真实源码,README、authoring guide、开发指南与路线图已同步;
- 已通过 Koka tests、完整 check 和浏览器 Todo/route 回归。
等待 PR review;合并后将关闭 #24、标记 shipped,并把 #25 提升为当前 onboarding/debugging 批次。
English
The first implementation batch is available in PR #28:
examples/first_component/component.kkuses only the publicimport explore/reactand demonstrates a typed store, serializable action,use_store,feature_root, andon_store_click;examples/first_component/main.kkis explicitly the advanced host, completing an in-memory initial render, registered click, action observation, and updated render;yarn example:first-componentcompiles, executes, and validates theclosed → Toggle_disclosure → openoutput, andyarn checknow runs it continuously;- the quick start links to real source, while the README, authoring guide, developer guide, and roadmap are synchronized;
- Koka tests, the full check, and browser Todo/routing regression all pass.
The work awaits PR review. After merge, #24 will close and be marked shipped; #25 becomes the active onboarding/debugging batch.
- addedstatus: shipped已经合并 / Already merged已经合并 / Already mergedand removedpriority: now当前开发批次 / Current development batch当前开发批次 / Current development batchstatus: in progress当前正在推进 / Active implementation当前正在推进 / Active implementation
on Aug 31, 2026
中文
用户问题
当前 quick start 的代码块容易阅读,但用户不能直接运行它,也无法确认复制后的模块是否真的只依赖公共 author API。第一次成功体验仍然需要理解 demo、runtime frame 和浏览器 bridge,反馈周期太长。
目标
提供一个仓库内可直接执行、持续编译验证的 first-component 示例,让新用户在几分钟内看到一个带 typed store/action 的组件完成 render 与状态 transition,再按链接进入完整浏览器 demo。
范围
examples/first-componentcomponent module,只使用公共 component-author import。yarn example:first-component命令。验收标准
yarn example:first-component即可成功。yarn test:koka与yarn check通过。非目标
English
User problem
The current quick-start snippets are readable but cannot be executed directly, and users cannot tell whether a copied module truly depends only on the public author API. The first successful experience still requires understanding the demo, runtime frame, and browser bridge, which makes the feedback loop too long.
Goal
Provide an immediately runnable and continuously compiled first-component example in the repository. A new user should see a component with a typed store/action render and complete one state transition within minutes, then follow a link to the full browser demo.
Scope
examples/first-componentcomponent module using only the public component-author import.yarn example:first-componentcommand.Acceptance criteria
yarn example:first-componentsucceeds from a clean checkout.yarn test:kokaandyarn checkpass.Non-goals