From d111cb59fc91483066b2c5c7b1aa76d89b227f71 Mon Sep 17 00:00:00 2001 From: tiye Date: Sat, 22 Aug 2026 18:40:02 +0800 Subject: [PATCH] chore: upgrade Calcit to 0.13.29 --- .github/workflows/upload.yaml | 8 ++--- Agents.md | 38 ++++------------------ calcit.cirru | 15 +++++---- deps.cirru | 2 +- history/2026082222-upgrade-calcit-01329.md | 4 +++ package.json | 4 +-- yarn.lock | 10 +++--- 7 files changed, 30 insertions(+), 51 deletions(-) create mode 100644 history/2026082222-upgrade-calcit-01329.md diff --git a/.github/workflows/upload.yaml b/.github/workflows/upload.yaml index 6149498..32efb97 100644 --- a/.github/workflows/upload.yaml +++ b/.github/workflows/upload.yaml @@ -22,7 +22,7 @@ jobs: corepack prepare yarn@4.12.0 --activate yarn --version - - uses: calcit-lang/setup-cr@0.0.9 + - uses: calcit-lang/setup-calcit@v1 - name: Resolve Calcit dependencies run: caps --ci @@ -31,13 +31,13 @@ jobs: run: yarn install --immutable - name: Check Calcit types - run: cr --check-only + run: calcit calcit.cirru --check-only - name: Check Calcit quality baseline - run: cr analyze quality --baseline config/calcit-quality.json + run: calcit calcit.cirru analyze quality --baseline config/calcit-quality.json - name: Compile Calcit JavaScript - run: cr js + run: calcit calcit.cirru js - name: Build site run: yarn vite build --base=./ diff --git a/Agents.md b/Agents.md index 2339244..e72a9ff 100644 --- a/Agents.md +++ b/Agents.md @@ -1,38 +1,12 @@ -Developer runs `cr js` to build JavaScript, and `yarn vite` to start a local server. LLMs edits program by running `cr` commands, and then triggers re-compiling. +# Calcit project guide -**必须**查看 Calcit 命令行工具的用法: +Use the current Calcit CLI documentation before editing source: ```bash -cr docs agents --full +calcit docs read upgrade --full +calcit docs agents --full ``` -按需查看 Respo 模块的具体用法: +The source file is `calcit.cirru`; `compact.cirru` is retired. Use `calcit edit` and `calcit tree` for structural changes, then run `calcit calcit.cirru edit format` and the project checks. -```bash -cr libs readme respo.calcit -f docs/Respo-Agent.md -``` - -## LLM 执行效率优化(不重复 llms/Calcit.md) - -- **先定位再修改**:先读结构/需求,再做最小变更,避免“改一处→报错→补救”式迭代。 -- **缓存上下文**:记录你已经确认的定义位置与修改点,避免重复搜索相同目标。 -- **优先局部替换**:只替换目标节点或小段结构,避免整段重写导致结构漂移。 -- **拆分复杂改动**:把 UI 改动与逻辑改动拆开,减少单次变更影响面。 -- **尽量复用已有组件/样式**:优先扩展已有样式/组件,而不是新增并重复实现。 -- **检查生成代码风险点**:处理 `let`、map 结构、属性 map 的键值对等高风险结构时,先确认结构是否符合预期,再替换。 -- **利用 diff 控制范围**:在多次修改后随时对比 diff,避免无关变更积累。 -- **编译前自检**:对于复杂变更,先手动检查节点结构(比如嵌套列表、属性 map、函数参数形态)再编译。 -- **输出稳定性优先**:避免频繁调整格式或样式细节,优先保证逻辑稳定与可读性。 - -## 常见错误与正确做法(结合本项目实践) - -- **`let` 只保留最后一个表达式**:多个表达式需要包一层 `div`/`do`,否则前面的节点会被丢掉。 -- **属性 map 必须是成对键值**:避免把 `:style` 与 `:inner-text` 写在同一个 pair 内;每个属性单独成对。 -- **避免生成“可调用字符串”**:形如 `(<> ((str ...)))` 会变成调用结果,正确写法为 `<> $ str ...`。 -- **列表 vs set**:`keys` 返回 set,拼接前先 `.to-list`,再 `concat`。 -- **pairs 列表转 map**:不要用 `.to-map` 处理 list,改用 `pairs-map`。 -- **函数调用与变量区分**:`week-start` 这类变量必须 is-leaf,避免成为单元素 list 导致被当做“函数调用”。 -- **数值与单位风险**:CSS 属性如 `flex`, `font-weight`, `line-height`, `z-index` 若使用单纯数字,Respo 会自动拼接 `px` 单位。必须改为字符串形式,例如 `:flex "\"1"` 或 `:font-weight "\"300"`。 -- **结构化编辑优先**:严禁直接编辑 `compact.cirru`,必须使用 `cr tree replace` 或 `cr edit def` 等命令。建议先通过 `cr query search 'keyword' -f 'ns/def'` 精确获得 node 路径。 -- **性能优化准则**:对于动态生成的列表(如任务项),应将静态样式从内联 `:style` 提取到 `defstyle` 中,通过 `:class-name` 引用以提升虚拟 DOM 性能。 -- **排序逻辑翻转**:翻转列表排序应直接修改 `sort` 函数所用比较器的返回分支(如将 `if ret 1 -1` 翻转为 `if ret -1 1`)。 +For library-specific guidance, use `calcit libs readme respo.calcit`. diff --git a/calcit.cirru b/calcit.cirru index 6c25d93..3fa05a7 100644 --- a/calcit.cirru +++ b/calcit.cirru @@ -1,7 +1,8 @@ -{} (:about "|Machine-generated snapshot. Do not edit directly — changes will be overwritten. Use `cr query` to inspect and `cr edit`/`cr tree` to modify. Run `cr docs agents --full` first. Manual edits must follow format and schema conventions, then run `cr edit format`.") (:package |app) (:version |0.0.1) +{} (:about "|Machine-generated snapshot. Do not edit directly — changes will be overwritten. Use `calcit query` to inspect and `calcit edit`/`calcit tree` to modify. Run `calcit docs agents --full` first. Manual edits must follow format and schema conventions, then run `calcit edit format`.") (:package |app) :entries $ {} :default $ {} (:description |) (:init-fn 'app.main/main!) (:mode :js) (:reload-fn 'app.main/reload!) + :feature-policy $ {} :modules $ [] |respo.calcit/ |respo-ui.calcit/ |reel.calcit/ |respo-markdown.calcit/ |alerts.calcit/ |respo-feather.calcit/ :type-slots $ {} :files $ {} @@ -1827,7 +1828,7 @@ :code $ quote defstruct Site (:storage-key 'String) (:archive-key 'String) :examples $ [] - :schema $ :: 'Dynamic + :schema $ :: 'StructDef |chrome-extension? $ %{} 'CodeEntry (:doc |) :code $ quote def chrome-extension? $ let @@ -2047,7 +2048,7 @@ :code $ quote defstruct ChatMessage (:role 'Tag) (:content 'String) (:thinking 'String) :examples $ [] - :schema $ :: 'Dynamic + :schema $ :: 'StructDef |ChatSession $ %{} 'CodeEntry (:doc |) :code $ quote defstruct ChatSession (:id 'String) (:created-at 'Number) @@ -2056,7 +2057,7 @@ :preview 'String :is-history? 'Bool :examples $ [] - :schema $ :: 'Dynamic + :schema $ :: 'StructDef |ChatState $ %{} 'CodeEntry (:doc |) :code $ quote defstruct ChatState (:answer 'Dynamic) (:loading? 'Bool) (:done? 'Bool) @@ -2064,12 +2065,12 @@ :model 'Dynamic :thinking 'Dynamic :examples $ [] - :schema $ :: 'Dynamic + :schema $ :: 'StructDef |MessageBoxState $ %{} 'CodeEntry (:doc |) :code $ quote defstruct MessageBoxState (:content 'String) (:search? 'Bool) (:think? 'Bool) (:focus-mode? 'Bool) :examples $ [] - :schema $ :: 'Dynamic + :schema $ :: 'StructDef |Store $ %{} 'CodeEntry (:doc |) :code $ quote defstruct Store (:states 'Map) @@ -2078,7 +2079,7 @@ :model 'Dynamic :archived-count 'Number :examples $ [] - :schema $ :: 'Dynamic + :schema $ :: 'StructDef |store $ %{} 'CodeEntry (:doc |) :code $ quote def store $ {} diff --git a/deps.cirru b/deps.cirru index dccbd62..13622bc 100644 --- a/deps.cirru +++ b/deps.cirru @@ -1,5 +1,5 @@ -{} (:calcit-version |0.13.19) +{} (:calcit-version |0.13.29) :version |0.0.1 :dependencies $ {} (|Respo/alerts.calcit |0.10.19) |Respo/reel.calcit |0.6.6 diff --git a/history/2026082222-upgrade-calcit-01329.md b/history/2026082222-upgrade-calcit-01329.md new file mode 100644 index 0000000..05a31e6 --- /dev/null +++ b/history/2026082222-upgrade-calcit-01329.md @@ -0,0 +1,4 @@ +# 2026082222 Upgrade Calcit + +- Updated Calcit and @calcit/procs to 0.13.29. +- Replaced setup-cr and cr commands with setup-calcit and calcit. diff --git a/package.json b/package.json index a33f6bb..a39cdcd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "dependencies": { - "@calcit/procs": "^0.13.27", + "@calcit/procs": "^0.13.29", "@google/genai": "^2.13.0", "@tiye/main-fonts": "0.0.1", "axios": "^1.15.0", @@ -15,7 +15,7 @@ "vite": "^8.0.14" }, "scripts": { - "build": "rm -rfv dist && cr js && yarn vite build --base ./ && rm -rfv extension/dist && cp -vr dist extension/" + "build": "rm -rfv dist && calcit calcit.cirru js && yarn vite build --base ./ && rm -rfv extension/dist && cp -vr dist extension/" }, "version": "0.0.1", "packageManager": "yarn@4.12.0" diff --git a/yarn.lock b/yarn.lock index 28cb5ed..4ce37ef 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5,14 +5,14 @@ __metadata: version: 8 cacheKey: 10c0 -"@calcit/procs@npm:^0.13.27": - version: 0.13.27 - resolution: "@calcit/procs@npm:0.13.27" +"@calcit/procs@npm:^0.13.29": + version: 0.13.29 + resolution: "@calcit/procs@npm:0.13.29" dependencies: "@calcit/ternary-tree": "npm:0.0.26" "@cirru/parser.ts": "npm:^0.0.9" "@cirru/writer.ts": "npm:^0.1.9" - checksum: 10c0/f3f2d1a3dd94797f99bec39cbf722b7d98d0308d0643f861997b1accc44fe68f5922149b268881aae1df4a3524968e3f10c58870358952bd959ff4dddcfd326a + checksum: 10c0/d8db7c62054dda827557f1bd8c8d7a777c17b40bd43f51fb3b39c57386d1c1a41dad449b641201daa05ad14c38a423601c803b5d9eb3557ae0173ae1a03f570a languageName: node linkType: hard @@ -1573,7 +1573,7 @@ __metadata: version: 0.0.0-use.local resolution: "root-workspace-0b6124@workspace:." dependencies: - "@calcit/procs": "npm:^0.13.27" + "@calcit/procs": "npm:^0.13.29" "@google/genai": "npm:^2.13.0" "@tiye/main-fonts": "npm:0.0.1" axios: "npm:^1.15.0"