@calcit/procs 0.13.27 → 0.13.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.yarn/install-state.gz +0 -0
- package/README.md +34 -34
- package/RFCs/02-04-runtime-traits-plan.md +1 -1
- package/RFCs/02-17-register-platform-api-rfc.md +1 -1
- package/RFCs/02-18-language-theory-evolution-plan.md +3 -3
- package/RFCs/03-05-function-schema-dual-track-rfc.md +3 -3
- package/RFCs/03-18-query-def-tree-show-chunked-display-plan.md +11 -11
- package/RFCs/04-13-type-slot-mechanism-rfc.md +10 -10
- package/RFCs/05-12-program-diff-rfc.md +7 -7
- package/RFCs/06-15-effects-graph-rfc.md +16 -16
- package/RFCs/07-06-semantic-tree-navigation-rfc.md +33 -33
- package/RFCs/07-19-doc-knowledge-index-rfc.md +15 -15
- package/RFCs/07-19-type-introspection-consistency-rfc.md +3 -3
- package/RFCs/07-26-agent-docs-and-evaluation-rfc.md +1 -1
- package/RFCs/07-26-agent-machine-protocol-rfc.md +5 -5
- package/RFCs/07-26-safe-structured-editing-rfc.md +4 -4
- package/RFCs/07-26-static-semantic-analysis-rfc.md +9 -9
- package/RFCs/07-28-git-module-store-rfc.md +4 -4
- package/RFCs/07-28-persistent-tree-cursor-rfc.md +54 -54
- package/RFCs/08-08-cross-backend-host-ffi-contracts-rfc.md +4 -4
- package/RFCs/08-14-architecture-scaffold-rfc.md +7 -7
- package/RFCs/08-14-todo-placeholder-rfc.md +2 -2
- package/RFCs/08-18-calcit-typed-js-ffi-boundary-rfc.md +2 -2
- package/RFCs/08-21-js-ffi-runtime-contract-validation-rfc.md +295 -0
- package/RFCs/08-21-setup-calcit-version-and-toolchain-contract-rfc.md +241 -0
- package/RFCs/08-21-static-type-system-evolution-roadmap.md +315 -0
- package/RFCs/08-21-type-quality-ci-adoption-rfc.md +272 -0
- package/RFCs/README.md +7 -4
- package/editing-history/20260820-1704-repository-maintenance-review.md +20 -0
- package/editing-history/20260821-1512-type-system-ecosystem-rfcs.md +25 -0
- package/editing-history/20260821-1648-type-quality-and-ffi-doc-hints.md +12 -0
- package/editing-history/202608211958-calcit-command-alias.md +6 -0
- package/editing-history/202608212018-cli-review-followups.md +4 -0
- package/editing-history/ARCHIVE.md +45 -4
- package/editing-history/README.md +3 -1
- package/history/202608212020-release-01328.md +5 -0
- package/lib/package.json +11 -11
- package/package.json +11 -11
- package/profiling/README.md +3 -3
- package/profiling/profile-once.sh +1 -1
- package/profiling/samply-once.sh +4 -4
- package/profiling/samply-summary.py +1 -1
- package/editing-history/2026-07-28-1346-edit-transaction.md +0 -27
- package/editing-history/2026-07-28-1454-persistent-tree-cursor.md +0 -30
- package/editing-history/2026-07-28-1651-cursor-focus-stack-clipboard.md +0 -30
- package/editing-history/2026-07-28-1719-cursor-navigation-search-selection.md +0 -21
- package/editing-history/2026-07-28-1958-agent-rfc-split.md +0 -14
- package/editing-history/2026-07-28-2004-cursor-editing-docs.md +0 -14
- package/editing-history/2026-07-28-2132-cursor-recoverable-clipboard.md +0 -18
- package/editing-history/2026-07-28-2151-cursor-native-structural-editing.md +0 -20
- package/editing-history/2026-07-28-2158-document-cursor-native-workflows.md +0 -13
- package/editing-history/2026-07-29-0022-add-cursor-cli-options.md +0 -7
- package/editing-history/2026-07-29-0022-audit-cursor-development-scenarios.md +0 -6
- package/editing-history/2026-07-29-0022-complete-cursor-structural-edits.md +0 -8
- package/editing-history/2026-07-29-0022-document-cursor-edit-recipes.md +0 -8
- package/editing-history/2026-07-29-0022-edit-target-cursor-alias.md +0 -6
- package/editing-history/2026-07-29-0022-guide-agents-through-cursor-workflows.md +0 -7
- package/editing-history/2026-07-29-0022-query-from-active-cursor.md +0 -8
- package/editing-history/2026-07-29-0022-tree-target-cursor-alias.md +0 -5
- package/editing-history/202608021730-release-0.12.58.md +0 -5
- package/editing-history/202608021928-release-0.12.59.md +0 -5
- package/editing-history/202608082312-release-0.13.5.md +0 -10
- package/editing-history/202608090107-release-0.13.6.md +0 -10
- package/editing-history/202608091812-release-0.13.7.md +0 -8
- package/editing-history/202608101042-release-0.13.8.md +0 -6
- package/editing-history/202608101101-release-pr-workflow.md +0 -8
- package/editing-history/202608101102-release-doc-tracked-path.md +0 -5
- package/editing-history/202608110140-release-0.13.9.md +0 -4
- package/editing-history/202608111349-release-0.13.10.md +0 -13
- package/editing-history/202608111650-release-0.13.11.md +0 -5
- package/editing-history/202608121900-release-0.13.12.md +0 -5
- package/editing-history/202608130003-release-0.13.13.md +0 -9
- package/editing-history/202608131650-release-0.13.15.md +0 -10
- package/editing-history/20260816-0254-release-0.13.17.md +0 -5
- package/editing-history/20260817-0006-release-0-13-18.md +0 -6
- package/editing-history/202608171118-project-module-runtime-resolution.md +0 -6
- package/editing-history/202608171133-visible-module-versions-and-cleanup.md +0 -6
- package/editing-history/202608171140-module-caches-root.md +0 -5
- package/editing-history/202608171200-module-cache-review-follow-up.md +0 -5
- package/editing-history/202608171205-release-0-13-19.md +0 -4
- package/editing-history/202608171215-module-path-resolution-docs.md +0 -4
- package/editing-history/202608171409-module-cache-review-followup.md +0 -5
- package/editing-history/202608171427-module-cache-review-followup-locking.md +0 -5
- package/editing-history/202608171438-module-docs-home-lock.md +0 -4
- package/editing-history/202608171611-dependency-audit-review.md +0 -4
- package/editing-history/202608181000-release-0-13-20.md +0 -5
- package/editing-history/202608181930-release-0-13-21.md +0 -5
package/.yarn/install-state.gz
CHANGED
|
Binary file
|
package/README.md
CHANGED
|
@@ -20,7 +20,7 @@ Core design:
|
|
|
20
20
|
Current direction:
|
|
21
21
|
|
|
22
22
|
- `calcit.cirru` is the primary source snapshot; legacy `compact.cirru` is still compatible
|
|
23
|
-
- CLI-first development with `
|
|
23
|
+
- CLI-first development with `calcit` and `caps`, designed to work well with AI agents in terminal workflows
|
|
24
24
|
- Better CLI editing and validation for CI, docs lookup, module management, and incremental updates
|
|
25
25
|
|
|
26
26
|
### Install 
|
|
@@ -32,53 +32,57 @@ Build and install with Rust:
|
|
|
32
32
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
|
|
33
33
|
|
|
34
34
|
# get Calcit user-facing tools
|
|
35
|
-
cargo install calcit --bin
|
|
35
|
+
cargo install calcit --bin calcit --bin caps
|
|
36
36
|
```
|
|
37
37
|
|
|
38
38
|
Installed binaries:
|
|
39
39
|
|
|
40
|
-
- `
|
|
40
|
+
- `calcit`, the runtime and JS compiler
|
|
41
41
|
- `caps`, for downloading dependencies declared in `deps.cirru`
|
|
42
42
|
|
|
43
43
|
When installing from source, install the same public tools:
|
|
44
44
|
|
|
45
45
|
```bash
|
|
46
|
-
cargo install --path . --bin
|
|
46
|
+
cargo install --path . --bin calcit --bin caps
|
|
47
47
|
```
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
For new GitHub Actions workflows, use [setup-calcit@v1](https://github.com/calcit-lang/setup-calcit). It
|
|
50
|
+
installs `calcit` and creates a lightweight `cr -> calcit` compatibility link for existing workflow commands;
|
|
51
|
+
for pre-rename releases it falls back to `cr` and exposes the equivalent `calcit` command.
|
|
52
|
+
Local installations ship only `calcit`; migrate local scripts directly instead of relying on a wrapper. Existing
|
|
53
|
+
[setup-cr](https://github.com/calcit-lang/setup-cr) workflow tags remain supported.
|
|
50
54
|
|
|
51
55
|
### Quick Start
|
|
52
56
|
|
|
53
57
|
Evaluate snippets:
|
|
54
58
|
|
|
55
59
|
```bash
|
|
56
|
-
|
|
60
|
+
calcit eval 'range 100'
|
|
57
61
|
|
|
58
|
-
|
|
62
|
+
calcit eval 'thread-first 100 range (map $ \ * % %)'
|
|
59
63
|
```
|
|
60
64
|
|
|
61
65
|
Run with a runtime snapshot such as `calcit.cirru` (legacy filename: `compact.cirru`):
|
|
62
66
|
|
|
63
67
|
```bash
|
|
64
|
-
|
|
65
|
-
|
|
68
|
+
calcit calcit.cirru # run once (default)
|
|
69
|
+
calcit compact.cirru # legacy filename still works
|
|
66
70
|
|
|
67
|
-
|
|
71
|
+
calcit # by default, it picks `calcit.cirru`, then falls back to `compact.cirru`
|
|
68
72
|
|
|
69
|
-
|
|
73
|
+
calcit -w # watch mode (explicit flag required)
|
|
70
74
|
```
|
|
71
75
|
|
|
72
76
|
By default Calcit reads `:init-fn` and `:reload-fn` from `calcit.cirru` configs (falling back to `compact.cirru`). You may also specify functions:
|
|
73
77
|
|
|
74
78
|
```bash
|
|
75
|
-
|
|
79
|
+
calcit --init-fn='app.main/main!' --reload-fn='app.main/reload!'
|
|
76
80
|
```
|
|
77
81
|
|
|
78
82
|
You may also configure `:entries` in `calcit.cirru`:
|
|
79
83
|
|
|
80
84
|
```bash
|
|
81
|
-
|
|
85
|
+
calcit --entry server
|
|
82
86
|
```
|
|
83
87
|
|
|
84
88
|
### JavaScript codegen
|
|
@@ -86,8 +90,8 @@ cr --entry server
|
|
|
86
90
|
Calcit compiles to JavaScript with consistent semantics. In browser or Node projects, JavaScript interop is still expected.
|
|
87
91
|
|
|
88
92
|
```bash
|
|
89
|
-
|
|
90
|
-
|
|
93
|
+
calcit js # compile to js, also picks `calcit.cirru` by default
|
|
94
|
+
calcit js --emit-path=out/ # compile to js and save in `out/`
|
|
91
95
|
```
|
|
92
96
|
|
|
93
97
|
By default, js code is generated to `js-out/`. You will need Vite or Node to run it, from an entry file:
|
|
@@ -104,11 +108,11 @@ The recommended workflow is plain text editing plus CLI validation, often driven
|
|
|
104
108
|
Common commands:
|
|
105
109
|
|
|
106
110
|
```bash
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
111
|
+
calcit docs agents --full # read the current agent workflow guide
|
|
112
|
+
calcit query search 'foo' # locate code by symbol or string
|
|
113
|
+
calcit edit ... # structured edits for defs, imports, config, modules
|
|
114
|
+
calcit js # compile once
|
|
115
|
+
calcit js -w # watch mode
|
|
112
116
|
caps # install/update dependencies from deps.cirru
|
|
113
117
|
```
|
|
114
118
|
|
|
@@ -118,20 +122,16 @@ Related examples and workflows:
|
|
|
118
122
|
|
|
119
123
|
- [Minimal Calcit](https://github.com/calcit-lang/minimal-calcit/blob/main/README.md)
|
|
120
124
|
- [Respo Calcit Workflow](https://github.com/calcit-lang/respo-calcit-workflow)
|
|
121
|
-
- [setup-
|
|
125
|
+
- [setup-calcit](https://github.com/calcit-lang/setup-calcit) for new GitHub Actions workflows
|
|
122
126
|
|
|
123
127
|
### Modules
|
|
124
128
|
|
|
125
129
|
`deps.cirru` declares dependencies that need to download, which correspond to repositories on GitHub. Specify a branch or a tag:
|
|
126
130
|
|
|
127
131
|
```cirru
|
|
128
|
-
{}
|
|
129
|
-
:calcit-
|
|
130
|
-
:dependencies $ {}
|
|
131
|
-
|calcit-lang/memof |0.0.11
|
|
132
|
-
|calcit-lang/lilac |main
|
|
133
|
-
:dev-dependencies $ {}
|
|
134
|
-
|calcit-lang/calcit-test |0.1.0
|
|
132
|
+
{} (:calcit-version |0.9.11)
|
|
133
|
+
:dependencies $ {} (|calcit-lang/memof |0.0.11) (|calcit-lang/lilac |main)
|
|
134
|
+
:dev-dependencies $ {} (|calcit-lang/calcit-test |0.1.0)
|
|
135
135
|
```
|
|
136
136
|
|
|
137
137
|
Run `caps` to resolve the recursive dependency graph and install it. Immutable revisions are stored under
|
|
@@ -148,11 +148,11 @@ Root projects install both `:dependencies` and `:dev-dependencies`. Recursive re
|
|
|
148
148
|
`:dependencies`, so test and maintenance modules declared by a dependency do not leak into consumers.
|
|
149
149
|
Use `caps add --dev <org/repo>@<ref>` and `caps remove --dev <org/repo>` to manage the development group.
|
|
150
150
|
|
|
151
|
-
`:calcit-version` helps with version checks and provides hints in [CI](https://github.com/calcit-lang/setup-
|
|
151
|
+
`:calcit-version` helps with version checks and provides hints in [CI](https://github.com/calcit-lang/setup-calcit).
|
|
152
152
|
|
|
153
153
|
To load modules, use `:modules` configuration and the runtime snapshot file `calcit.cirru` (legacy: `compact.cirru`):
|
|
154
154
|
|
|
155
|
-
```cirru
|
|
155
|
+
```cirru.no-check
|
|
156
156
|
:entries $ {}
|
|
157
157
|
:default $ {}
|
|
158
158
|
:modules $ [] |memof/calcit.cirru |lilac/
|
|
@@ -178,16 +178,16 @@ Local validation commands:
|
|
|
178
178
|
|
|
179
179
|
```bash
|
|
180
180
|
# run tests in Rust
|
|
181
|
-
cargo run --bin
|
|
181
|
+
cargo run --bin calcit -- calcit/test.cirru
|
|
182
182
|
|
|
183
183
|
# run tests in Node.js
|
|
184
|
-
cargo run --bin
|
|
184
|
+
cargo run --bin calcit -- calcit/test.cirru js && yarn try-js
|
|
185
185
|
|
|
186
186
|
# run snippet
|
|
187
|
-
cargo run --bin
|
|
187
|
+
cargo run --bin calcit -- eval 'range 100'
|
|
188
188
|
|
|
189
189
|
# internal compiler/WASM validation when working on this repository
|
|
190
|
-
cargo run --bin
|
|
190
|
+
cargo run --bin calcit -- calcit/test.cirru ir
|
|
191
191
|
yarn try-wasm
|
|
192
192
|
```
|
|
193
193
|
|
|
@@ -31,7 +31,7 @@ Snapshot schema 暂时只保存 symbol 形式的 trait reference。预处理在
|
|
|
31
31
|
|
|
32
32
|
### Inherent method bag
|
|
33
33
|
|
|
34
|
-
历史写法允许把 tag 传给 `defimpl`。它继续产生 originless method bag,并参与 `.method` 查找,以保证旧项目可运行;但它不是 trait impl,不能满足能力约束。`
|
|
34
|
+
历史写法允许把 tag 传给 `defimpl`。它继续产生 originless method bag,并参与 `.method` 查找,以保证旧项目可运行;但它不是 trait impl,不能满足能力约束。`calcit edit format` 对此给出非阻断迁移告警。
|
|
35
35
|
|
|
36
36
|
这个边界取代旧的“class/prototype”概念:底层仍复用有序 impl record 作为方法表,但语言层不再把方法存在性当作 trait 身份。
|
|
37
37
|
|
|
@@ -95,7 +95,7 @@ descriptor 已用于统一校验:
|
|
|
95
95
|
|
|
96
96
|
## 6. 验收标准(当前版本)
|
|
97
97
|
|
|
98
|
-
1. `dylib-workflow` 在旧命名下可直接 `
|
|
98
|
+
1. `dylib-workflow` 在旧命名下可直接 `calcit -1` 通过。
|
|
99
99
|
2. `call_registered_proc` 校验(arity/platform/callback)持续生效。
|
|
100
100
|
3. ABI 版本保持 `0.0.9` 且调用链稳定。
|
|
101
101
|
4. 相关测试保持通过(Rust tests + workflow 冒烟)。
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
可接受改动层级(按优先顺序):
|
|
82
82
|
|
|
83
83
|
- 第一层:文档规范、元数据结构、CI 检查。
|
|
84
|
-
- 第二层:preprocess 诊断、`
|
|
84
|
+
- 第二层:preprocess 诊断、`calcit` 子命令扩展。
|
|
85
85
|
- 第三层:runtime 文案增强(不改求值语义)。
|
|
86
86
|
|
|
87
87
|
不建议在早期做的事:
|
|
@@ -200,7 +200,7 @@
|
|
|
200
200
|
|
|
201
201
|
给开发流程增加一条轻量入口:
|
|
202
202
|
|
|
203
|
-
- `
|
|
203
|
+
- `calcit doctor`(草案)或现有命令扩展,汇总当前文件“下一步可修复项”。
|
|
204
204
|
|
|
205
205
|
### Phase C DoD
|
|
206
206
|
|
|
@@ -311,7 +311,7 @@
|
|
|
311
311
|
|
|
312
312
|
建议改动:
|
|
313
313
|
|
|
314
|
-
- 增加一个命令入口(可在 `
|
|
314
|
+
- 增加一个命令入口(可在 `calcit` 子命令或测试脚本中实现)用于执行 law-check。
|
|
315
315
|
- 先对 1 个 trait 做样板(建议 `Monoid` 或 `Semigroup`)。
|
|
316
316
|
- 输出为 warning,不阻断主流程。
|
|
317
317
|
|
|
@@ -99,18 +99,18 @@
|
|
|
99
99
|
|
|
100
100
|
## parse 校验示例
|
|
101
101
|
|
|
102
|
-
文档里保留的 schema 示例应至少能被 `
|
|
102
|
+
文档里保留的 schema 示例应至少能被 `calcit` 解析。
|
|
103
103
|
|
|
104
104
|
主示例:
|
|
105
105
|
|
|
106
106
|
```bash
|
|
107
|
-
|
|
107
|
+
calcit demos/calcit.cirru cirru parse-edn "(:: :fn ({} (:generics ([] 'T 'U)) (:where ({} ('T Eq))) (:args ([] 'T :number)) (:rest :number) (:return (:: :tuple :ok 'U))))"
|
|
108
108
|
```
|
|
109
109
|
|
|
110
110
|
运行时数据验证:
|
|
111
111
|
|
|
112
112
|
```bash
|
|
113
|
-
|
|
113
|
+
calcit demos/calcit.cirru eval "let ((schema (:: :fn ({} (:generics ([] 'T 'U)) (:where ({} ('T Eq))) (:args ([] 'T :number)) (:rest :number) (:return (:: :tuple :ok 'U)))))) (println schema) (println (type-of schema)) , schema"
|
|
114
114
|
```
|
|
115
115
|
|
|
116
116
|
## 顶层定义与局部定义的分工
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# `
|
|
1
|
+
# `calcit query def` / `calcit tree show` 分片展示方案
|
|
2
2
|
|
|
3
3
|
## 目标
|
|
4
4
|
|
|
@@ -26,9 +26,9 @@
|
|
|
26
26
|
|
|
27
27
|
### 基线:直接整块输出
|
|
28
28
|
|
|
29
|
-
当前的 `
|
|
29
|
+
当前的 `calcit query def` 会一次性打印完整定义。
|
|
30
30
|
|
|
31
|
-
当前的 `
|
|
31
|
+
当前的 `calcit tree show` 会打印目标子树,然后列出直接子节点路径。
|
|
32
32
|
|
|
33
33
|
这个方案在小表达式上没有问题,但面对大表达式时会出现这些缺点:
|
|
34
34
|
|
|
@@ -134,7 +134,7 @@ let
|
|
|
134
134
|
|
|
135
135
|
## 预期交互
|
|
136
136
|
|
|
137
|
-
### `
|
|
137
|
+
### `calcit query def`
|
|
138
138
|
|
|
139
139
|
对于较小定义:
|
|
140
140
|
|
|
@@ -147,7 +147,7 @@ let
|
|
|
147
147
|
- 先打印根片段,再按坐标顺序打印拆出的片段;
|
|
148
148
|
- 每个片段展示:坐标、节点数、最大深度、Cirru 内容。
|
|
149
149
|
|
|
150
|
-
### `
|
|
150
|
+
### `calcit tree show`
|
|
151
151
|
|
|
152
152
|
对于较小子树:
|
|
153
153
|
|
|
@@ -163,7 +163,7 @@ let
|
|
|
163
163
|
|
|
164
164
|
## CLI 参数设计
|
|
165
165
|
|
|
166
|
-
这些参数应同时提供给 `
|
|
166
|
+
这些参数应同时提供给 `calcit query def` 和 `calcit tree show`:
|
|
167
167
|
|
|
168
168
|
- `--chunk-target-nodes <n>`:每个片段理想节点数;
|
|
169
169
|
- `--chunk-max-nodes <n>`:停止继续细分前允许的软上限;
|
|
@@ -251,7 +251,7 @@ let
|
|
|
251
251
|
把文档示例统一调整为优先使用点号路径,例如:
|
|
252
252
|
|
|
253
253
|
```bash
|
|
254
|
-
|
|
254
|
+
calcit tree show ns/def --path '3.2.1'
|
|
255
255
|
```
|
|
256
256
|
|
|
257
257
|
逗号兼容只在合适位置说明一次,不重复铺满全文。
|
|
@@ -284,16 +284,16 @@ cr tree show ns/def --path '3.2.1'
|
|
|
284
284
|
|
|
285
285
|
1. 先写这份方案文档。
|
|
286
286
|
2. 在 Rust 中加入可复用的分片与路径辅助逻辑。
|
|
287
|
-
3. 把分片渲染接入 `
|
|
288
|
-
4. 把分片渲染接入 `
|
|
287
|
+
3. 把分片渲染接入 `calcit query def`。
|
|
288
|
+
4. 把分片渲染接入 `calcit tree show`。
|
|
289
289
|
5. 加入点号路径兼容。
|
|
290
290
|
6. 更新文档,主推点号路径。
|
|
291
291
|
7. 用 `find-children-diffs` 做真实案例验证,并微调默认值。
|
|
292
292
|
|
|
293
293
|
## 验收标准
|
|
294
294
|
|
|
295
|
-
- `
|
|
296
|
-
- `
|
|
295
|
+
- `calcit query def` 在大定义上默认输出分片结果;
|
|
296
|
+
- `calcit tree show` 在大子树上默认输出分片结果;
|
|
297
297
|
- 两个命令都支持 `--chunk-target-nodes`;
|
|
298
298
|
- 两个命令都接受点号路径;
|
|
299
299
|
- 逗号路径保持兼容;
|
|
@@ -38,7 +38,7 @@ Type slot 是 Calcit 为避免在 UI 框架、dispatch 回调等调用链中大
|
|
|
38
38
|
| B3. slot 使用声明命名空间作为身份 | 暂缓 | Schema/序列化可能 Breaking | 跨库同名冲突 |
|
|
39
39
|
| B4. 未绑定 slot 不再静默退化 | 暂缓 | 行为 Breaking | 防止类型检查悄悄失效 |
|
|
40
40
|
|
|
41
|
-
现有 `with-type-slot` 源码仍可继续使用,但新项目应通过 `
|
|
41
|
+
现有 `with-type-slot` 源码仍可继续使用,但新项目应通过 `calcit config set-type-slot` 维护 entry 配置。实现 entry 配置 **不代表批准** 显式环境对象、缓存指纹或 namespaced identity 的重构预算;这些内容仍需满足第 8.7 节的证据门槛。
|
|
42
42
|
|
|
43
43
|
## 3. 背景与原始动机
|
|
44
44
|
|
|
@@ -306,10 +306,10 @@ evaluate(with-type-slot body) -> 在遇到 dependency 时临时影响编译
|
|
|
306
306
|
命名 entry 不继承 `:entries.default.type-slots`。这里使用完整 definition path,而不是在配置解析阶段求值任意 Calcit expression,因此配置可序列化、可查询,也不依赖入口函数的执行顺序。对应命令为:
|
|
307
307
|
|
|
308
308
|
```bash
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
309
|
+
calcit config set-type-slot :dispatch-op app.schema/Op
|
|
310
|
+
calcit config set-type-slot --entry server :dispatch-op app.schema/ServerOp
|
|
311
|
+
calcit config type-slots --entry server
|
|
312
|
+
calcit config rm-type-slot --entry server :dispatch-op
|
|
313
313
|
```
|
|
314
314
|
|
|
315
315
|
程序加载模块后验证 type path 存在,再在任何 definition 预处理前安装所选 entry 的绑定。局部 `with-type-slot` 兼容形式仍可覆盖 entry 默认值,但新入口不需要 wrapper。
|
|
@@ -435,7 +435,7 @@ Type slot 不只影响 warning;它还可能参与 enum tuple 识别和类型
|
|
|
435
435
|
|
|
436
436
|
- 已增加 `:type-slots` 配置;
|
|
437
437
|
- `with-type-slot` 继续可用并始终在预处理阶段擦除;
|
|
438
|
-
- `
|
|
438
|
+
- `calcit config type-slots [--entry name]` 展示 bindings;
|
|
439
439
|
- `set-type-slot` / `rm-type-slot` 提供安全的 snapshot 修改入口;
|
|
440
440
|
- 未绑定 slot 暂时保持 `:dynamic` 兼容行为;
|
|
441
441
|
- `TypeSlotEnvId` 和自动提取 wrapper 的迁移命令尚未实现。
|
|
@@ -451,7 +451,7 @@ defn main! () $ with-type-slot (:dispatch-op Op)
|
|
|
451
451
|
迁移后:
|
|
452
452
|
|
|
453
453
|
```cirru
|
|
454
|
-
;;
|
|
454
|
+
;; calcit config set-type-slot :dispatch-op app.schema/Op
|
|
455
455
|
defn main! ()
|
|
456
456
|
setup!
|
|
457
457
|
render-app!
|
|
@@ -507,7 +507,7 @@ yarn check-agent-interface
|
|
|
507
507
|
yarn check-all
|
|
508
508
|
```
|
|
509
509
|
|
|
510
|
-
涉及 CLI 查询、编辑或类型分析时,再使用新构建的 `
|
|
510
|
+
涉及 CLI 查询、编辑或类型分析时,再使用新构建的 `calcit` 在 Respo 等真实项目回归。应验证 Respo 的 entry 配置能让大量 `d! $ :: ...` 调用共享同一 `Op` 检查,并验证旧的多 body 兼容 form 生成 JS 不再依赖 `do`。
|
|
511
511
|
|
|
512
512
|
## 12. 备选方案
|
|
513
513
|
|
|
@@ -552,8 +552,8 @@ yarn check-all
|
|
|
552
552
|
为避免 type slot 再次成为只能从生成代码猜测的隐藏状态,当前已经提供面向人的只读查询:
|
|
553
553
|
|
|
554
554
|
```bash
|
|
555
|
-
|
|
556
|
-
|
|
555
|
+
calcit config type-slots
|
|
556
|
+
calcit config type-slots --entry server
|
|
557
557
|
```
|
|
558
558
|
|
|
559
559
|
后续若 Agent 接口确有需要,再增加单 JSON 的机器输出,例如:
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# RFC: `
|
|
1
|
+
# RFC: `calcit analyze program-diff <GIT REF>`
|
|
2
2
|
|
|
3
3
|
状态:Draft
|
|
4
4
|
日期:2026-05-12
|
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
|
|
10
10
|
新增命令:
|
|
11
11
|
|
|
12
|
-
- `
|
|
12
|
+
- `calcit analyze program-diff <GIT REF>`
|
|
13
13
|
|
|
14
|
-
该命令从 Git 中读取指定版本的完整运行时快照文件(默认沿用当前 `
|
|
14
|
+
该命令从 Git 中读取指定版本的完整运行时快照文件(默认沿用当前 `calcit` 的输入文件路径,优先 `calcit.cirru`,兼容旧文件名 `compact.cirru`),确保**历史版本**与**当前工作区版本**都能被正确解析为 Calcit snapshot,然后做**结构化 diff**。
|
|
15
15
|
|
|
16
16
|
输出目标不是纯文本行 diff,而是面向程序结构的树形 diff:
|
|
17
17
|
|
|
@@ -37,13 +37,13 @@
|
|
|
37
37
|
## 3. 命令定义
|
|
38
38
|
|
|
39
39
|
```/dev/null/rfc.txt#L1-2
|
|
40
|
-
|
|
40
|
+
calcit analyze program-diff <GIT REF>
|
|
41
41
|
```
|
|
42
42
|
|
|
43
43
|
语义:
|
|
44
44
|
|
|
45
45
|
- `<GIT REF>` 可以是 `HEAD~1`、tag、branch、commit SHA 等;
|
|
46
|
-
- 当前侧使用 `
|
|
46
|
+
- 当前侧使用 `calcit` 输入路径(默认优先 `calcit.cirru`,兼容旧文件名 `compact.cirru`);
|
|
47
47
|
- 历史侧使用 `git show <ref>:<repo-relative-input-path>` 读取文件内容;
|
|
48
48
|
- 两边都必须先经过:
|
|
49
49
|
1. `cirru_edn::parse`
|
|
@@ -71,7 +71,7 @@ Summary 示例:
|
|
|
71
71
|
|
|
72
72
|
### 4.2 树形 diff 约定
|
|
73
73
|
|
|
74
|
-
参考 `
|
|
74
|
+
参考 `calcit analyze call-graph` 的树形展示风格,继续使用:
|
|
75
75
|
|
|
76
76
|
- `├──`
|
|
77
77
|
- `└──`
|
|
@@ -190,7 +190,7 @@ list 内部子节点对比采用“带替换代价的序列对齐”策略:
|
|
|
190
190
|
- patch 应用;
|
|
191
191
|
- HTML/TUI 交互界面;
|
|
192
192
|
- 抽取到 `cirru_parser` crate;
|
|
193
|
-
- 和 `
|
|
193
|
+
- 和 `calcit tree show` / `calcit query def` 的统一 chunk/diff UI。
|
|
194
194
|
|
|
195
195
|
## 9. 后续可能扩展
|
|
196
196
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# RFC: `
|
|
1
|
+
# RFC: `calcit analyze effects-graph` — State / Transform / Effect 分解图
|
|
2
2
|
|
|
3
3
|
状态:Draft
|
|
4
4
|
日期:2026-06-15
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
新增分析命令:
|
|
12
12
|
|
|
13
13
|
```bash
|
|
14
|
-
|
|
14
|
+
calcit analyze effects-graph [--root ns/def] [options...]
|
|
15
15
|
```
|
|
16
16
|
|
|
17
17
|
从**入口定义**(默认 `:init-fn`)出发,把程序(及其可达子函数)分解为三类信息,并输出一张可递归展开的分析图:
|
|
@@ -227,7 +227,7 @@ defn render-once (ui) $
|
|
|
227
227
|
- `&doseq` (`:effect`) → body 内 effect 边展开
|
|
228
228
|
- `println` (`:log` `:io`) → `[:console]`
|
|
229
229
|
|
|
230
|
-
宿主注入 proc 通过 `RegisteredProcDescriptor.tags`(`HashSet<EdnTag>`,与 core `:tags` 同名)声明;可用 `
|
|
230
|
+
宿主注入 proc 通过 `RegisteredProcDescriptor.tags`(`HashSet<EdnTag>`,与 core `:tags` 同名)声明;可用 `calcit query host-procs [--tag :log]` 查看。
|
|
231
231
|
|
|
232
232
|
---
|
|
233
233
|
|
|
@@ -236,7 +236,7 @@ defn render-once (ui) $
|
|
|
236
236
|
### 5.1 语法
|
|
237
237
|
|
|
238
238
|
```bash
|
|
239
|
-
|
|
239
|
+
calcit analyze effects-graph [options]
|
|
240
240
|
```
|
|
241
241
|
|
|
242
242
|
与 `call-graph` 对齐的选项:
|
|
@@ -316,9 +316,9 @@ flowchart LR
|
|
|
316
316
|
|
|
317
317
|
推荐工作流:
|
|
318
318
|
|
|
319
|
-
1. `
|
|
320
|
-
2. `
|
|
321
|
-
3. `
|
|
319
|
+
1. `calcit analyze call-graph` — 看清**可达定义集合**
|
|
320
|
+
2. `calcit analyze effects-graph` — 在同一入口上读**语义分解**
|
|
321
|
+
3. `calcit analyze check-types --infer-missing` + `effects-graph --infer-missing` — 补齐 schema
|
|
322
322
|
|
|
323
323
|
---
|
|
324
324
|
|
|
@@ -326,7 +326,7 @@ flowchart LR
|
|
|
326
326
|
|
|
327
327
|
### 6.1 模块划分
|
|
328
328
|
|
|
329
|
-
新增 `src/effects_graph.rs`(库模块),CLI 入口挂到 `
|
|
329
|
+
新增 `src/effects_graph.rs`(库模块),CLI 入口挂到 `calcit analyze`(`cli_args.rs` / `calcit.rs`),与 `call_tree` 并列。
|
|
330
330
|
|
|
331
331
|
```
|
|
332
332
|
effects_graph/
|
|
@@ -358,7 +358,7 @@ effects_graph/
|
|
|
358
358
|
3. 替换:字面量 → `_`;长字符串 → `"..."` ;大块 `quote` → `⟨quoted⟩`
|
|
359
359
|
4. 生成 `summary`:优先 `doc` 首句,否则模板 `"let×N, if×M, calls K"`
|
|
360
360
|
|
|
361
|
-
`full` 模式:输出类似 `
|
|
361
|
+
`full` 模式:输出类似 `calcit tree show --chunked` 的分片骨架(见 `03-18-query-def-tree-show-chunked-display-plan.md`),但不输出完整叶子。
|
|
362
362
|
|
|
363
363
|
### 6.4 类型补全(`--infer-missing`)
|
|
364
364
|
|
|
@@ -379,7 +379,7 @@ effects_graph/
|
|
|
379
379
|
:effects $ [] :render :console
|
|
380
380
|
```
|
|
381
381
|
|
|
382
|
-
与 `
|
|
382
|
+
与 `calcit edit` 集成留作 Phase C。
|
|
383
383
|
|
|
384
384
|
---
|
|
385
385
|
|
|
@@ -389,7 +389,7 @@ effects_graph/
|
|
|
389
389
|
|
|
390
390
|
**交付**:
|
|
391
391
|
|
|
392
|
-
- [x] `
|
|
392
|
+
- [x] `calcit analyze effects-graph` tree + json 输出
|
|
393
393
|
- [x] 入口可达分析(复用 `CallTreeAnalyzer` 可达集)
|
|
394
394
|
- [x] State:`param` / `return` / `local` / `atom` 基础识别
|
|
395
395
|
- [x] Effect:builtin proc 表(core 全覆盖)
|
|
@@ -412,9 +412,9 @@ effects_graph/
|
|
|
412
412
|
|
|
413
413
|
- [x] `RegisteredProcDescriptor.tags`(与 core `:tags` 对齐)
|
|
414
414
|
- [ ] `defeffect` 语法落地(可选)
|
|
415
|
-
- [ ] `
|
|
416
|
-
- [ ] Agent 指南:`
|
|
417
|
-
- [ ] 与 `query def` 联动:`
|
|
415
|
+
- [ ] `calcit analyze effects-graph-diff <git-ref>`(对齐 `program-diff`)
|
|
416
|
+
- [ ] Agent 指南:`calcit docs agents` 增加 effects-graph 工作流
|
|
417
|
+
- [ ] 与 `query def` 联动:`calcit query def ns/def --view effects`
|
|
418
418
|
|
|
419
419
|
---
|
|
420
420
|
|
|
@@ -451,7 +451,7 @@ app.comp.container/comp-container
|
|
|
451
451
|
| 层级 | 内容 |
|
|
452
452
|
|------|------|
|
|
453
453
|
| 单元测试 | `classify_effect`, `extract_state_ports`, `compress_transform` |
|
|
454
|
-
| 集成测试 | 对 `calcit/test-effects-graph.cirru` 跑 `
|
|
454
|
+
| 集成测试 | 对 `calcit/test-effects-graph.cirru` 跑 `calcit analyze effects-graph --format json`,快照比对 |
|
|
455
455
|
| 回归 | 不改变现有 `call-graph` / `check-types` 行为 |
|
|
456
456
|
| 可选 | msg-buffer / respo 手工验收(不纳入 CI 硬依赖) |
|
|
457
457
|
|
|
@@ -492,7 +492,7 @@ app.comp.container/comp-container
|
|
|
492
492
|
|
|
493
493
|
## 13. 验收标准(Phase A)
|
|
494
494
|
|
|
495
|
-
- [ ] `cargo run --bin
|
|
495
|
+
- [ ] `cargo run --bin calcit -- calcit/test.cirru analyze effects-graph` 成功退出
|
|
496
496
|
- [ ] 输出包含 entry 的 state / transform / effect 三节
|
|
497
497
|
- [ ] `read-file` 调用归类为 `io/read`,不落在 transform 摘要正文中
|
|
498
498
|
- [ ] `--format json` 可被 `jq` 解析,节点含 `fqn`、`kind`
|