@calcit/procs 0.12.55 → 0.12.57

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.
Files changed (161) hide show
  1. package/.yarn/install-state.gz +0 -0
  2. package/RFCs/07-31-unsafe-coerce-driven-static-type-boundary-plan.md +170 -0
  3. package/build.rs +36 -2
  4. package/editing-history/202607310224-strengthen-namespace-import-diagnostics.md +23 -0
  5. package/editing-history/202607311940-strengthen-unsafe-coerce-boundaries.md +20 -0
  6. package/editing-history/202608010103-warn-on-duplicate-imports.md +18 -0
  7. package/editing-history/202608010111-release-0.12.56.md +15 -0
  8. package/editing-history/202608011654-library-quality-gates.md +23 -0
  9. package/editing-history/202608011759-issue-routing-in-agent-guide.md +17 -0
  10. package/editing-history/202608011833-schema-type-symbols.md +20 -0
  11. package/editing-history/202608011852-wasm-dynamic-string-tag.md +7 -0
  12. package/editing-history/202608011908-consolidate-history.md +6 -0
  13. package/editing-history/202608012022-consolidate-cli-and-test-duplication.md +28 -0
  14. package/editing-history/202608012123-review-follow-up.md +18 -0
  15. package/editing-history/202608012320-release-0.12.57.md +5 -0
  16. package/editing-history/ARCHIVE.md +15 -0
  17. package/editing-history/README.md +21 -0
  18. package/lib/package.json +1 -1
  19. package/package.json +1 -1
  20. package/editing-history/2026-02-13-1841-trait-origin-structural-eq.md +0 -91
  21. package/editing-history/2026-02-14-2050-js-codegen-recursion-tag-migration.md +0 -39
  22. package/editing-history/2026-02-14-2358-emit-js-modularization-shift-left.md +0 -63
  23. package/editing-history/2026-02-15-0000-diagnostics-consolidated.md +0 -35
  24. package/editing-history/2026-02-15-1941-macro-diagnostics-refinement.md +0 -39
  25. package/editing-history/2026-02-16-2043-core-api-docs-cleanup.md +0 -40
  26. package/editing-history/2026-02-23-0834-migrate-to-defstruct.md +0 -91
  27. package/editing-history/2026-02-23-2321-ns-imports-code-fixes.md +0 -42
  28. package/editing-history/2026-02-25-0002-language-behavior-eval-mode.md +0 -93
  29. package/editing-history/2026-02-25-0111-guidebook-no-check-block-upgrades.md +0 -52
  30. package/editing-history/2026-02-25-0113-runtime-type-validation-and-macro-quoting.md +0 -41
  31. package/editing-history/2026-02-25-1131-check-md-eval-improvements.md +0 -13
  32. package/editing-history/2026-02-26-1324-check-md-inprocess-cache-and-path-labels.md +0 -7
  33. package/editing-history/2026-02-27-1640-unify-markdown-readers.md +0 -16
  34. package/editing-history/2026-02-27-1958-tree-rewrite-command-and-reference-model.md +0 -18
  35. package/editing-history/2026-02-27-2200-split-def-command.md +0 -29
  36. package/editing-history/2026-02-27-2212-tree-raise-wrap.md +0 -33
  37. package/editing-history/2026-02-27-2223-calcit-agent-docs-optimize.md +0 -41
  38. package/editing-history/2026-03-01-0212-query-search-entry-and-ffi-warning.md +0 -53
  39. package/editing-history/2026-03-03-1934-check-types-and-core-annotations.md +0 -17
  40. package/editing-history/2026-03-04-0000-generics-fn-typevar-identity.md +0 -30
  41. package/editing-history/2026-03-04-1331-tag-call-warning-and-dot-access-migration.md +0 -28
  42. package/editing-history/2026-03-04-1548-impl-new-dot-method-input-and-doc-hints.md +0 -33
  43. package/editing-history/2026-03-04-1645-calcit-eq-contract-refactor-and-macro-tests.md +0 -28
  44. package/editing-history/2026-03-04-2200-assert-type-assert-traits-composable-runtime-checks.md +0 -18
  45. package/editing-history/2026-03-05-0042-type-inference-argtypes-and-core-hints.md +0 -54
  46. package/editing-history/2026-03-05-0115-calcit-core-generic-refinements.md +0 -57
  47. package/editing-history/2026-03-05-1930-schema-migration-cr-edit.md +0 -30
  48. package/editing-history/2026-03-05-1939-query-schema-adaptation.md +0 -42
  49. package/editing-history/2026-03-06-0120-schema-hint-migration-batch.md +0 -38
  50. package/editing-history/2026-03-06-1416-core-macro-schema-migration.md +0 -20
  51. package/editing-history/2026-03-06-1552-core-schema-and-hintfn-migration.md +0 -63
  52. package/editing-history/2026-03-06-1936-schema-normalization-and-preprocess-preload.md +0 -12
  53. package/editing-history/2026-03-07-0000-migrate-hint-fn-to-schema.md +0 -29
  54. package/editing-history/2026-03-07-0000-remove-enum-prototype-field.md +0 -43
  55. package/editing-history/2026-03-07-0000-schema-args-type-enforcement.md +0 -66
  56. package/editing-history/2026-03-07-0142-unit-type-and-builtin-schemas.md +0 -82
  57. package/editing-history/2026-03-07-1652-decouple-snapshot-schema-to-calcit-type.md +0 -112
  58. package/editing-history/2026-03-07-1821-snapshot-schema-validation.md +0 -6
  59. package/editing-history/2026-03-07-1959-schema-def-kind-arity-validation.md +0 -96
  60. package/editing-history/2026-03-08-0031-schema-generics-quote-normalization.md +0 -35
  61. package/editing-history/2026-03-08-1905-schema-typeref-and-assert-migration.md +0 -34
  62. package/editing-history/2026-03-08-2033-schema-wrapper-migration.md +0 -45
  63. package/editing-history/2026-03-08-2315-late-schema-cleanup-and-warning-compat.md +0 -27
  64. package/editing-history/2026-03-09-1753-schema-type-fail-tests.md +0 -17
  65. package/editing-history/2026-03-10-1040-edit-schema-primitive-tag-support.md +0 -42
  66. package/editing-history/2026-03-10-1754-ns-entry-snapshot-migration.md +0 -66
  67. package/editing-history/2026-03-13-2216-validate-struct-type-arg-arity.md +0 -24
  68. package/editing-history/2026-03-16-2353-runtime-boundary-cleanup.md +0 -14
  69. package/editing-history/2026-03-17-0150-runtime-boundary-lookup-cleanup.md +0 -28
  70. package/editing-history/2026-03-20-0116-json-builtins-and-runtime-docs.md +0 -48
  71. package/editing-history/2026-03-26-2013-docs-frontmatter-and-module-search.md +0 -58
  72. package/editing-history/2026-04-07-1550-path-format-at-prefix-migration.md +0 -46
  73. package/editing-history/2026-04-12-1524-js-codegen-map-to-record.md +0 -26
  74. package/editing-history/2026-04-12-1549-map-to-record-field-validation.md +0 -29
  75. package/editing-history/2026-04-13-1600-tuple-to-enum-rewrite.md +0 -13
  76. package/editing-history/2026-04-13-2309-typeslot-enum-compile-safety.md +0 -45
  77. package/editing-history/2026-04-14-1500-loose-record-syntax.md +0 -32
  78. package/editing-history/2026-04-14-2259-bidir-type-check-refactor.md +0 -63
  79. package/editing-history/2026-04-15-0120-match-syntax-exhaustiveness.md +0 -20
  80. package/editing-history/2026-04-15-1211-record-nth-optimization.md +0 -44
  81. package/editing-history/2026-04-16-1936-predicate-narrowing-expansion.md +0 -31
  82. package/editing-history/2026-04-17-0132-monomorphize-map-filter.md +0 -50
  83. package/editing-history/2026-04-17-0135-monomorphize-includes-reverse.md +0 -31
  84. package/editing-history/2026-04-17-0140-fold-type-predicates.md +0 -44
  85. package/editing-history/2026-04-17-0154-generic-dispatch-records-tuples.md +0 -52
  86. package/editing-history/2026-04-17-0520-simplify-generic-defns-via-method-dispatch.md +0 -49
  87. package/editing-history/2026-05-21-0055-tree-show-cr-config-and-edit-cleanup.md +0 -81
  88. package/editing-history/2026-05-31-2052-macro-schema-roundtrip-and-weak-types.md +0 -6
  89. package/editing-history/2026-05-31-2105-map-generic-weak-types-followup.md +0 -15
  90. package/editing-history/2026-06-01-0003-update-callback-field-specialization.md +0 -19
  91. package/editing-history/2026-06-01-2317-data-definition-where-bounds.md +0 -6
  92. package/editing-history/2026-06-02-0114-data-definition-where-macro-followup.md +0 -21
  93. package/editing-history/2026-06-03-0000-check-md-edn-errors.md +0 -5
  94. package/editing-history/2026-06-03-1600-check-md-entry-modules.md +0 -6
  95. package/editing-history/2026-06-04-0000-check-md-app-main-init.md +0 -6
  96. package/editing-history/2026-06-04-2218-compiled-executable-runtime-backfill.md +0 -6
  97. package/editing-history/2026-06-09-0000-with-type-slot-scoped-binding.md +0 -83
  98. package/editing-history/2026-06-09-1241-remove-bind-type.md +0 -64
  99. package/editing-history/2026-06-09-1800-core-effect-tags.md +0 -57
  100. package/editing-history/2026-06-10-1200-get-def-doc-schema-builtin.md +0 -7
  101. package/editing-history/2026-06-15-1500-effects-graph-mvp.md +0 -30
  102. package/editing-history/2026-06-16-1700-effects-graph-ste-tree.md +0 -84
  103. package/editing-history/2026-06-27-0052-cli-improvements.md +0 -41
  104. package/editing-history/2026-06-27-0202-docs-indexing-improvements.md +0 -22
  105. package/editing-history/2026-06-27-0315-file-splits.md +0 -17
  106. package/editing-history/2026-06-27-0416-agent-advanced-split.md +0 -15
  107. package/editing-history/archived/2025-04-12-1453-map-to-record-rewrite.md +0 -33
  108. package/editing-history/archived/2025-04-16-0117-wasm-codegen-and-catalog-update.md +0 -40
  109. package/editing-history/archived/2025-07-16-0207-wasm-encoder-migration.md +0 -48
  110. package/editing-history/archived/2025-07-16-1633-wasm-data-structures.md +0 -61
  111. package/editing-history/archived/2026-02-13-1926-docs-tests-followup.md +0 -33
  112. package/editing-history/archived/2026-02-16-2128-docs-smoke-and-trait-errors.md +0 -20
  113. package/editing-history/archived/2026-02-25-1234-watch-mode-default-once.md +0 -5
  114. package/editing-history/archived/2026-03-07-1302-calcit-agent-docs-update.md +0 -32
  115. package/editing-history/archived/2026-03-09-1819-add-test-fail-script.md +0 -5
  116. package/editing-history/archived/2026-03-09-1944-split-type-fail-tests.md +0 -8
  117. package/editing-history/archived/2026-03-16-1449-profiling-tools-reorg.md +0 -13
  118. package/editing-history/archived/2026-03-17-2026-afternoon-runtime-boundary-optimization-summary.md +0 -87
  119. package/editing-history/archived/2026-03-18-1802-tips-level-and-overwrite-schema-preservation.md +0 -26
  120. package/editing-history/archived/2026-03-20-1229-query-window-3-with-parent-preview.md +0 -72
  121. package/editing-history/archived/2026-03-23-1137-command-echo-tool-output-cleanup.md +0 -71
  122. package/editing-history/archived/2026-04-10-0011-snapshot-empty-version-pipe-marker.md +0 -23
  123. package/editing-history/archived/2026-04-16-0131-wasm-math-and-test-integration.md +0 -28
  124. package/editing-history/archived/2026-04-16-1507-wasm-data-structures-and-rfc-rename.md +0 -27
  125. package/editing-history/archived/2026-04-16-1520-wasm-bitwise-and-match.md +0 -21
  126. package/editing-history/archived/2026-04-16-1542-wasm-cross-ns-host-imports.md +0 -38
  127. package/editing-history/archived/2026-04-17-0026-wasm-rest-args.md +0 -62
  128. package/editing-history/archived/2026-04-17-0048-wasm-type-of.md +0 -70
  129. package/editing-history/archived/2026-04-17-0051-wasm-derived-predicates.md +0 -34
  130. package/editing-history/archived/2026-04-17-2316-wasm-do-println-fixes.md +0 -41
  131. package/editing-history/archived/2026-04-18-1208-split-emit-wasm-and-bump-version.md +0 -15
  132. package/editing-history/archived/2026-04-18-1430-wasm-list-match-and-method-dispatch.md +0 -5
  133. package/editing-history/archived/2026-04-18-2041-cr-wasm-split-and-runtime-stability.md +0 -18
  134. package/editing-history/archived/2026-04-18-2045-v0.12.23-ci-wasm-fix.md +0 -13
  135. package/editing-history/archived/2026-04-21-1818-wasm-string-ops-v2.md +0 -57
  136. package/editing-history/archived/2026-04-21-2332-split-emit-wasm.md +0 -45
  137. package/editing-history/archived/2026-04-22-0114-wasm-hof-intercepts-and-set-intersection.md +0 -82
  138. package/editing-history/archived/2026-04-22-0136-wasm-enum-tuple-bool-str-fixes.md +0 -68
  139. package/editing-history/archived/2026-04-22-1340-wasm-map-diff-new-and-let-intercept.md +0 -53
  140. package/editing-history/archived/2026-04-23-1419-v0.12.26-wasm-bisection-fixes.md +0 -7
  141. package/editing-history/archived/2026-04-23-1645-release-conventions.md +0 -14
  142. package/editing-history/archived/2026-04-25-1940-wasm-suite-multi-module-entry.md +0 -53
  143. package/editing-history/archived/2026-04-25-2003-wasm-method-includes-string-and-set-refactor.md +0 -71
  144. package/editing-history/archived/2026-04-25-2010-wasm-suite-add-fn-lens-edn.md +0 -43
  145. package/editing-history/archived/2026-04-25-2051-display-by.md +0 -39
  146. package/editing-history/archived/2026-04-28-1728-fix-gensym-stable.md +0 -31
  147. package/editing-history/archived/2026-04-29-1400-fix-bind-type-precompile.md +0 -38
  148. package/editing-history/archived/2026-05-26-0957-match-docs-check-md.md +0 -24
  149. package/editing-history/archived/2026-05-31-2059-ci-docs-test-and-fn-helper-tightening.md +0 -3
  150. package/editing-history/archived/2026-06-01-0005-release-0.12.36.md +0 -16
  151. package/editing-history/archived/2026-06-01-2230-enum-struct-payload-docs.md +0 -4
  152. package/editing-history/archived/2026-06-03-1620-release-0.12.38.md +0 -6
  153. package/editing-history/archived/2026-06-04-0000-release-0.12.39.md +0 -4
  154. package/editing-history/archived/2026-06-04-2230-release-0.12.40.md +0 -5
  155. package/editing-history/archived/2026-06-12-1525-weak-types-dots-format.md +0 -15
  156. package/editing-history/archived/2026-06-13-1200-primitive_schema_tags.md +0 -9
  157. package/editing-history/archived/2026-06-20-1142-ts-declaration-d-mts.md +0 -5
  158. package/editing-history/archived/2026-06-29-0117-upgrade-doc-snapshot-migration.md +0 -2
  159. package/editing-history/archived/2026-06-29-calcit-cli.md +0 -80
  160. package/editing-history/archived/2026-06-29-typed-calcit-cli-schemas.md +0 -23
  161. package/editing-history/archived/20260630-duplication-analysis.md +0 -116
@@ -1,44 +0,0 @@
1
- # Fold type predicates when static type is known
2
-
3
- ## 背景
4
-
5
- `list?` / `map?` / `set?` / `string?` / `number?` / `bool?` / `tag?` / `fn?` /
6
- `tuple?` / `record?` 这些 type predicate defn 都是 `(&= (type-of x) :xxx)`
7
- 的形式。如果 preprocess 能拿到 `x` 的静态类型,整个调用就可以折叠成一个字面的
8
- `true` 常量(或者保留运行时 check,但不把 `false` 折叠以保持安全)。
9
-
10
- 在 WASM / JS codegen 场景下这尤其有收益:谓词出现在 `if` / `cond` 里,
11
- 折叠成常量后整个分支会被后续 dead-code 消除。
12
-
13
- ## 改动
14
-
15
- `src/runner/preprocess/mod.rs::try_specialize_polymorphic_call` 新增一段在
16
- proc 特化表之前的折叠逻辑:
17
-
18
- ```rust
19
- let predicate_true = matches!(
20
- (fn_def, receiver_type.as_ref()),
21
- ("list?", T::List(_))
22
- | ("map?", T::Map(_, _))
23
- | ("set?", T::Set(_))
24
- | ("string?", T::String)
25
- | ("number?", T::Number)
26
- | ("bool?", T::Bool)
27
- | ("tag?", T::Tag)
28
- | ("fn?", T::Fn(_) | T::DynFn)
29
- | ("tuple?", T::Tuple(_) | T::DynTuple)
30
- | ("record?", T::Record(_) | T::Struct(_, _))
31
- );
32
- if predicate_true { return Some(Calcit::Bool(true)); }
33
- ```
34
-
35
- **设计选择**:只折叠“肯定为 true”的情形,不折叠“肯定为 false”的情形。
36
- 原因:`CalcitTypeAnnotation` 枚举有 30+ variant(包括 `Optional`、`Ref`、
37
- `TypeVar`、`TypeRef`、`Trait` 等等),要列全“除此之外的全部”枚举会很脆弱、
38
- 以后新增 variant 容易漏。保留 runtime check 是安全的 fallback。
39
-
40
- ## 验证
41
-
42
- - `cargo fmt && cargo clippy --release -- -D warnings` ✓
43
- - `cargo test --release` ✓(179 + 67 测试全通过)
44
- - `yarn check-all` ✓
@@ -1,52 +0,0 @@
1
- # Extend generic assoc/nth/get/count/contains?/empty?/first to records & tuples
2
-
3
- ## 背景
4
-
5
- Recollect 升级到 `defstruct` + `%{}` 构造记录后,在 JS 运行时调用 `assoc` /
6
- `nth` / `get` 等会 fallback 到 `.method`,再经过 `invoke_method` 在
7
- `structRef.impls` 中查找;但默认构造的 struct 并没有自动挂上 core 的
8
- `:assoc` / `:nth` / `:get` impls,导致 `Error: No implementation for ... to
9
- lookup .assoc` 等。
10
-
11
- Rust 解释器路径能自动解析到 `&record:*` 内置 proc,所以 `cr --entry test`
12
- 能跑过,但 JS 输出(`cr js` + Node)跑不过。
13
-
14
- ## 改动
15
-
16
- 在 `src/cirru/calcit-core.cirru` 的若干 generic 分发函数里显式增加
17
- `record?` / `tuple?` 分支,直接路由到内置 proc,不再依赖 method lookup:
18
-
19
- | 函数 | 新增分支 |
20
- | ----------- | -------------------------------------------------------- |
21
- | `assoc` | `record? -> &record:assoc`, `tuple? -> &tuple:assoc` |
22
- | `nth` | `tuple? -> &tuple:nth`, `record? -> &record:nth` |
23
- | `get` | `tuple? -> &tuple:nth`, `record? -> &record:get` |
24
- | `count` | `tuple? -> &tuple:count`, `record? -> &record:count` |
25
- | `contains?` | `record? -> &record:contains?` |
26
- | `empty?` | `record? -> (&= 0 (&record:count x))`, tuple 同理 |
27
- | `first` | `tuple? -> (&tuple:nth x 0)` |
28
-
29
- 这几处与“运行时按 `type-of` 分支”的方向是一致的——在当前 Calcit 语义下
30
- records / tuples 是独立 kind,本来就应该在 generic 分发里显式处理,而不是
31
- 掉到“最后一条 method lookup” 的兜底里。
32
-
33
- 与此前添加的 **编译期单态化**(`try_specialize_polymorphic_call`)是互补的:
34
- 当静态类型已知时在预处理阶段直接改写成 proc 调用;静态类型未知时,运行时
35
- 分支也能正确分发到 `&record:*` / `&tuple:*`,而不再需要结构实现端配合
36
- impls。
37
-
38
- ## 验证
39
-
40
- - `cargo fmt && cargo clippy --release -- -D warnings` ✓
41
- - `cargo test --release` ✓(179 + 67 全过)
42
- - `yarn check-all` ✓
43
- - recollect 全套:
44
- - `cr --entry test` ✓
45
- - `cr --entry test js && env=ci node test.mjs` ✓(此前 `.assoc` 报错修复)
46
- - `cr js && yarn vite build --base=./` ✓
47
-
48
- ## 后续
49
-
50
- 随着 Calcit 继续演进,这些 chain-of-if 分发仍然是临时形态。更彻底的做法是
51
- 在预处理阶段通过类型推断消除所有 generic 分发 defn,让核心库只暴露
52
- `&list:*` / `&map:*` / `&record:*` 等单态 proc —— 见下一步语言简化计划。
@@ -1,49 +0,0 @@
1
- # Simplify generic core defns via `.method` dispatch
2
-
3
- ## 概要
4
-
5
- 将 `calcit-core.cirru` 中的泛型 defn(`assoc` / `contains?` / `count` / `empty` / `empty?` / `filter` / `first` / `get` / `includes?` / `nth` / `rest` / `map`)从多分支 `if (list? x) ... if (map? x) ... if (record? x) ...` 链简化为 `list?` 快速路径 + `.method` 动态分发。
6
-
7
- ## 动机
8
-
9
- - 用户要求:优先使用 `.method` 这套已有概念承担多态分发,避免每新增类型(record / tuple / set 等)都要在每个 defn 中追加分支。
10
- - 所有 built-in 类型已在 `&core-*-methods` 中注册了对应的 `.assoc` `.count` `.empty?` `.get` `.nth` 等方法条目,编译期 `try_inline_method_call` 已能在静态类型已知时把方法调用内联为直接 proc 调用,runtime 则由 `invoke_method` 处理。这使得 defn 自身不再需要枚举类型。
11
-
12
- ## 实现
13
-
14
- 以 `empty?` 为例:
15
-
16
- ```cirru
17
- defn empty? (x)
18
- if (nil? x) true $ if (list? x) (&list:empty? x) (.empty? x)
19
- ```
20
-
21
- 保留 `nil?` 与 `list?` 两个前置分支,其余类型全部交给 `.empty?`。
22
-
23
- **为什么保留 `list?` 快速路径**:
24
- `ensure_ns_def_compiled(CORE_NS, &init-builtin-impls!)` 在预处理期会展开 `do` 等 macro,其中 `(empty? body)` 会在 impls 还未注册到 runtime 时被调用;若此时 `empty?` 体里就走 `.empty?` → `invoke_method` → `evaluate_symbol_from_program("&core-list-impls", ...)` 会命中 quick-path 失败(循环依赖),导致 panic:
25
-
26
- ```
27
- preprocess builtin impls: CalcitErr { kind: Var, msg: "expected symbol `&core-list-impls` from path `calcit.core`, this is a quick path, should succeed", ... }
28
- ```
29
-
30
- `list?` 本身只用 `(&= (type-of x) :list)` 等 proc,不依赖 impl 注册,能在 bootstrap 期安全使用,打破循环;其余类型的 methods 此时已构建完毕,可顺利走方法派发。
31
-
32
- ## 波及范围
33
-
34
- - `src/cirru/calcit-core.cirru`:12 个 defn 的 body 瘦身。
35
- - 预处理期的 `try_specialize_polymorphic_call`(已有)照常将 `(assoc x k v)` 等静态可推断调用折叠为 `&list:assoc`/`&map:assoc` 等 proc。
36
- - runtime 侧未变:仍由 `invoke_method` + `&core-*-impls` 完成最终派发。
37
-
38
- ## 验证
39
-
40
- - `cargo fmt`
41
- - `cargo clippy --release -- -D warnings`
42
- - `cargo test --release`:179 + 67 通过
43
- - `yarn check-all`:全部 WASM/JS/解释执行测试通过
44
- - recollect (`cr --entry test` + `cr --entry test js` + `node test.mjs`) ✓
45
- - respo (`cr --check-only` + `cr js` + `yarn vite build`) ✓
46
-
47
- ## 备注
48
-
49
- - 下一步可以考虑:把那些只剩 `list?` 单分支的 defn 再收拢到一个运行时 primitive,或在 preprocess 阶段对 macro 展开期调用的 `empty?` 等函数强制内联 proc,从而彻底去掉这条 fast path。
@@ -1,81 +0,0 @@
1
- # 202605210055 — tree show 可选路径 + cr config 顶级命令 + cr edit 清理
2
-
3
- ## 修改概要
4
-
5
- ### 1. `cr tree show` — `-p` 参数改为可选,缺失时警告而非报错
6
-
7
- **动机**: Agent 调用 `cr tree show ns/def` 时若忘记 `-p`,原来直接报错导致 token 浪费。
8
-
9
- **变更文件**:
10
-
11
- - `src/cli_args.rs`: `TreeShowCommand.path` 类型从 `String` → `Option<String>`,doc 注释更新
12
- - `src/bin/cli_handlers/tree.rs`: `handle_show` 中对 `None` 输出黄色 `[Warn]`,默认使用空路径(root)
13
- - `src/bin/cli_handlers/command_echo.rs`: `push_tree` Show 分支改用 `opt "path"` 宏处理 Option 类型
14
-
15
- **效果**:
16
-
17
- ```
18
- $ cr calcit.cirru tree show "ns/def"
19
- [Warn] No path (-p) specified; showing from root. Use -p '0' to start from a child node.
20
- Type: list (4 items)
21
- ...
22
- ```
23
-
24
- ---
25
-
26
- ### 2. `cr config` — 顶级配置管理命令
27
-
28
- **动机**: `cr query config`、`cr query modules`、`cr edit config`、`cr edit add-module`、`cr edit rm-module` 分散在不同子命令下,操作配置需要记忆多个入口。新增统一入口 `cr config`。
29
-
30
- **新命令**:
31
- | 命令 | 等价旧命令 |
32
- |---|---|
33
- | `cr config show` | `cr query config` |
34
- | `cr config modules` | `cr query modules` |
35
- | `cr config version [value]` | `cr edit config version ...` |
36
- | `cr config set <key> <value>` | `cr edit config <key> <value>` |
37
- | `cr config add-module <path>` | `cr edit add-module <path>` |
38
- | `cr config rm-module <path>` | `cr edit rm-module <path>` |
39
-
40
- `cr config version` 可独立使用(无参数显示当前版本,传 `patch/minor/major` 递增,传 semver 直接设置)。
41
-
42
- **变更文件**:
43
-
44
- - `src/cli_args.rs`: 添加 `CalcitCommand::Config`、`ConfigCommand`、`ConfigSubcommand`(含 `ConfigVersionCommand`)及各子命令 struct
45
- - `src/bin/cli_handlers/config.rs`: 新建,实现 `handle_config_command` 及各子命令处理函数(含 `handle_version`)
46
- - `src/bin/cli_handlers/edit.rs`: `parse_semver_value`、`bump_semver_value` 改为 `pub(crate)`
47
- - `src/bin/cli_handlers/mod.rs`: 注册 `mod config` 并 re-export `handle_config_command`
48
- - `src/bin/cli_handlers/command_echo.rs`: 添加 `config_name`、`push_config`,并在 `should_echo_command` / `render_command_echo` 中处理 `Config` 变体
49
- - `src/bin/cr.rs`: 添加 `CalcitCommand::Config` 分支
50
-
51
- ---
52
-
53
- ### 3. `cr edit` 清理 — 移除已迁移至 `cr config` 的子命令
54
-
55
- **动机**: `cr edit add-module`、`cr edit rm-module`、`cr edit config` 与新增的 `cr config` 重复,保持单一职责。
56
-
57
- **删除内容**:
58
-
59
- - `EditSubcommand::AddModule / RmModule / Config` 及对应 struct(`cli_args.rs`)
60
- - `handle_add_module / handle_rm_module / handle_config` 函数体(`edit.rs`)
61
- - `command_echo.rs` 中 `edit_name` 和 `push_edit` 两处 match 的三个变体
62
-
63
- **保留**(被 `config.rs` 和单元测试引用):
64
-
65
- - `pub(crate) fn parse_semver_value` — semver 字符串解析
66
- - `pub(crate) fn bump_semver_value` — patch/minor/major 递增
67
-
68
- **文档更新**:
69
-
70
- - `docs/run/agent-advanced.md` "模块和配置" 章节、快速参考示例 → 全部改为 `cr config` 命令
71
- - `docs/CalcitAgent.md` 第 9 节"cr 能力地图" → 新增"配置管理"条目
72
-
73
- ---
74
-
75
- ## 知识点
76
-
77
- - `argh` 中将 `#[argh(option)]` 字段类型改为 `Option<T>` 可使该选项变为可选
78
- - `pub(crate)` 可在同一 crate 内跨模块共享;被其他模块引用时,不能因删除调用方而一并删除
79
- - 新增顶级命令时需同步更新 `command_echo.rs` 的三处:`should_echo_command`、`render_command_echo`(名称映射和 token push)
80
- - 移除 enum 变体时,需同时检查 `command_echo.rs` 的两处 match(`edit_name` 和 `push_edit`)
81
- - 单元测试也会引用函数,删除前要 grep `tests` 模块确认
@@ -1,6 +0,0 @@
1
- - refined weak-types reporting in `cr analyze weak-types` to classify schema/code hits with detail paths
2
- - tightened builtin proc signatures for list/map/set/buf-list helpers toward generic compound types
3
- - kept `field-match` / `record-match` macro schema inputs precise in `calcit-core` while preserving round-trip behavior
4
- - fixed macro schema serialization to keep non-dynamic returns like `:record` instead of dropping them during snapshot save/load
5
- - aligned bare marker tag parsing for `:record` and related special tags with schema normalization behavior
6
- - updated docs and parser tests to current wrapped schema / guidebook-loading behavior
@@ -1,15 +0,0 @@
1
- - tightened multiple calcit.core snapshot schemas that safely remove weak composite internals without narrowing runtime behavior: typed path lists for `assoc-in`/`get-in`/`dissoc-in`/`update-in`/`contains-in?`, typed collection helpers like `apply`, `join-str`, `foldr-shortcut`, and explicit output map generics for `map-kv` and `pairs-map`
2
- - corrected one weak-types false lead by changing `keys` from returning `:list` to `:set`, matching runtime/tests and moving that hit out of the list family
3
- - extended `cr analyze weak-types` to classify nested schema-dynamic shapes/families, include per-definition summaries, split family/shape counts by `arg`/`return` position, and show per-definition `shape@position` contributors for the remaining hotspots
4
- - confirmed the current lower-bound weak hits under the existing type system: `&record:to-map` for heterogeneous record values; `&tuple:params`, `&cirru-quote:to-list`, `parse-cirru-list`, `&format-ternary-tree`, `&list:flatten`, `format-cirru`, and `format-cirru-one-liner` for mixed list payloads that cannot be soundly collapsed to `list<'T>`
5
- - verified the final baseline at schema-dynamic=290 with `cargo test --bin cr analyze_weak_types -- --nocapture`, repeated `cargo run --bin cr -- calcit/test.cirru analyze weak-types --ns calcit.core --only schema-dynamic`, and runtime suite checks via `cargo run --bin cr -- calcit/test.cirru`
6
- - aligned `parse-float` runtime behavior with the existing optional-number schema across Rust and JS: invalid input now yields `nil`/`null` instead of throwing or leaking `NaN`, and added inference coverage in `calcit/test-types-inference.cirru`
7
- - aligned JS record missing-field behavior with Rust/eval by making `CalcitRecord.get` return `undefined` on absent fields, which keeps top-level `get` and `get-in` optional semantics consistent across runtimes
8
- - refined preprocess return inference for `calcit.core/get` and `calcit.core/get-in`, so list/string/map/record accesses produce precise `optional<...>` results for literal paths instead of collapsing to broad `dynamic` in the common safe cases
9
- - tightened the generic matching path so `Struct` annotations and bare `TypeRef` names bind declared type variables consistently when only one side carries applied type arguments, reducing a gap that previously skipped bindings needed by later generic specialization and `:where` checks
10
- - validated the follow-up with `cargo run --bin cr -- calcit/test-types-inference.cirru`, `cargo test binds_generic_args_from`, `cargo fmt && cargo test binds_generic_args_from`, and `yarn try-rs`
11
- - added RFC `RFCs/06-01-generic-binding-unification-rfc.md` to document the next step for Rust-like generic binding unification across `Struct` / `Enum` / `TypeRef`, including concrete examples, rollout stages, and the tradeoff that enum support needs deeper metadata changes than the struct-side fix
12
- - extended the enum-generic foundation end to end: runtime enum metadata now preserves declared generics, `&enum::new` accepts generic parameter lists, and applied named enum annotations like `(:: 'ResultX :number :string)` validate against payload creation instead of being rejected as "enum cannot be generic"
13
- - fixed the remaining struct declaration gap in the core macros/runtime boundary: `defstruct Box ([] 'T) (:value 'T)` now lowers to a real generics list for `&struct::new`, and generic field annotations are preserved as type forms instead of being evaluated away before runtime parsing
14
- - documented the current runnable generic data-structure entry points in `docs/features/records.md` and `docs/features/enums.md`, including a high-level generic `defstruct` example and the current stable generic-enum constructor form via `&enum::new`
15
- - validated the new docs/examples with direct eval smoke checks for the struct and enum snippets, `cargo run --bin cr -- demos/calcit.cirru docs check-md docs/features/records.md`, `cargo run --bin cr -- demos/calcit.cirru docs check-md docs/features/enums.md`, and `cargo run --bin cr -- calcit/test-generics.cirru`
@@ -1,19 +0,0 @@
1
- # 2026-06-01 00:03 update callback field specialization
2
-
3
- ## Summary
4
-
5
- - specialized `calcit.core/update` call checking so the 3rd callback arg can inherit a known record/struct field type instead of always staying at generic `fn('T) -> 'T`
6
- - fixed record field inference to resolve `TypeRef`-based struct annotations, not only direct `Record`/`Struct` annotations
7
- - aligned native `not` proc signature with calcit-core semantics by accepting dynamic input and returning `:bool`
8
-
9
- ## Why
10
-
11
- - `respo` used precise type refs like `'respo.app.schema/Task`, but `infer_record_field_type` only looked through direct `Record`/`Struct` annotations, so `update task :done? not` could not see the field type
12
- - even after specializing `update`, Rust-side proc metadata still described `not` as `fn(:bool?) -> :bool`, which was stricter and inconsistent with the core schema/docs path
13
-
14
- ## Validation
15
-
16
- - `cargo test specialize_update_uses_record_field_type_for_callback`
17
- - `cargo run --manifest-path /Users/chenyong/repo/calcit-lang/calcit/Cargo.toml --bin cr -- js` from `respo`
18
- - `yarn try-rs`
19
- - `cargo test`
@@ -1,6 +0,0 @@
1
- - added where-bound metadata to struct and enum definitions, preserving it through parsing, hashing, compare, serialization, and enum prototype reconstruction
2
- - enforced data-definition generic trait bounds at runtime for `%{}`, `%{}?`, and `%::` by inferring concrete type bindings from record fields and enum payloads
3
- - kept builtin `Show` satisfaction narrow to builtin value families so function-level missing-impl warnings still fire correctly during preprocess
4
- - covered the new runtime path with focused Rust tests for accepting and rejecting struct/enum payloads under generic where-bounds
5
- - validated the calcit side with `cargo test where_bounds --lib`, `yarn check-all`, release `cr` build, and downstream respo compilation via `../../calcit-lang/calcit/target/release/cr js`
6
- - downstream follow-up in respo needed one explicit `assert-type text :string` for the `Op::update` payload under the stricter enum payload check
@@ -1,21 +0,0 @@
1
- ## Summary
2
-
3
- - restored high-level `defstruct` / `defenum` where-map syntax end to end after the Rust/runtime work landed
4
- - aligned JS runtime parsing in `ts-src/calcit.procs.mts` so `defstruct` / `defenum` skip optional generics and where-map entries before parsing fields or variants
5
- - kept the smoke test in `calcit/test-enum.cirru` on the high-level syntax and reran broad validation
6
-
7
- ## Knowledge Points
8
-
9
- - the JS-emitted high-level data-definition forms do not preserve where-map heads as a stable plain symbol; the first item may be a runtime function alias or even an unresolved value shape, so detecting where-map entries by exact head identity is brittle
10
- - a safer JS-side strategy is structural detection: after an optional generics list, treat a list as a where-map form when its head is not a tag/symbol/string and the remaining items are all 2-item pairs
11
- - for current JS codegen, generic parameter lists arrive as a simple list of `CalcitSymbol`s, so the runtime parser can ignore that leading entry without needing full type-variable reconstruction
12
-
13
- ## Validation
14
-
15
- - `cargo fmt`
16
- - `cargo test where_bounds --lib`
17
- - `cargo run --bin cr -- calcit/test-enum.cirru`
18
- - `yarn compile && yarn try-js`
19
- - `yarn try-rs`
20
- - `yarn try-ir`
21
- - `yarn try-wasm`
@@ -1,5 +0,0 @@
1
- # check-md 与 EDN 报错(2026-06-03)
2
-
3
- - `collect_check_md_module_paths`:用 `extract_modules_from_edn` 只读 `configs.modules`,避免对旧格式大快照(如 `demos/calcit.cirru` 的 `%Expr` 代码字段)做全量 `load_snapshot_data`。
4
- - `check-md`:`prepare_program_for_snippet` 以 entry 快照为底、最后写入 `app.main`;no-run 优先编译片段里的 `app.main` defs;片段若全是顶层 `def/defn/defcomp/...` 则拆成多个 `CodeEntry`(`create_file_from_snippet`)。
5
- - `data/edn.rs`:反序列化失败时在 `got:` 里把旧 `%Expr`/`%Leaf` 还原为格式化 Cirru(约 520 字上限),`snapshot`/`call_stack` 错误预览走同一套。
@@ -1,6 +0,0 @@
1
- # 2026-06-03 check-md entry modules 与文档校验改进
2
-
3
- - `cr docs check-md` 现在默认读取 `entry`(如 `demos/calcit.cirru`)里的 `configs.modules`,并与 CLI 的 `--dep` 合并去重,避免每次手动重复传依赖。
4
- - `check-md` 的 `no-run` 模式在找不到默认入口定义时,增加了对 `app.*` 命名空间定义的回退编译检查,提升示例片段可检性。
5
- - 更新 `check-md` 帮助文案,明确 `--dep` 是额外依赖,默认依赖来自 `entry configs.modules`。
6
- - 新增单元测试覆盖 `entry modules + --dep` 合并去重逻辑,并通过 `docs check-md` 实测验证 `respo` 文档在不显式传 `--dep` 时可通过。
@@ -1,6 +0,0 @@
1
- # 2026-06-04 check-md 入口加载与 app.main 注入
2
-
3
- - `prepare_program_for_snippet` 加载 entry snapshot 失败时不再回退空 snapshot,改为直接报错。
4
- - `extract_modules_from_edn` 对畸形 `configs.modules` 返回明确 EDN 预览,不再静默忽略。
5
- - check-md 注入片段固定使用 `app.main/main!`,避免误跑 entry 项目的 `:init-fn`(如 memof 测试套件)。
6
- - `docs/run/cli-options.md` 注明 Run 模式使用 `app.main/main!`。
@@ -1,6 +0,0 @@
1
- # 2026-06-04 compiled executable runtime backfill
2
-
3
- - `resolve_runtime_or_compiled_def` materialized compiled executable defs without seeding runtime, so repeated symbol lookup rebuilt fresh `Fn` values.
4
- - Fresh `Fn` ids broke caches keyed by functions, reproducing in `memof` where `memof1-call` and `memof1-call-by` missed cache hits under `cr calcit.cirru`.
5
- - `materialize_compiled_executable_payload` now writes the resolved executable back into runtime-ready storage, preserving stable function identity across lookups.
6
- - Program tests now assert runtime backfill for compiled executable resolution and `memof` plain `cr` execution passes again with the patched binary.
@@ -1,83 +0,0 @@
1
- # with-type: 局部作用域类型绑定
2
-
3
- 日期:2026-06-09
4
-
5
- ## 功能概要
6
-
7
- 实现 `with-type-slot` 表达式,允许在局部代码块范围内绑定 type-slot,替代全局 `bind-type` 的全局副作用。
8
-
9
- ## 语法
10
-
11
- ```cirru
12
- with-type-slot (:slot-name TypeExpr)
13
- body-expr1
14
- body-expr2
15
- ...
16
- ```
17
-
18
- - 第一个参数必须是二元列表 `(:slot-name TypeExpr)`
19
- - 后续参数是 body 表达式
20
- - 返回最后一个 body 表达式的值
21
-
22
- ## 与 bind-type 的对比
23
-
24
- | 特性 | bind-type | with-type-slot |
25
- |------|-----------|-----------|
26
- | 作用域 | 全局(整个预处理 pass) | 局部(仅 body 范围内) |
27
- | 是否可重叠 | 单次绑定,不可重复 | 可嵌套,栈式覆盖 |
28
- | 使用位置 | 通常在 main! 最顶部 | 任意代码块 |
29
-
30
- ## 实现细节
31
-
32
- ### 修改文件
33
-
34
- 1. **`src/calcit/type_annotation.rs`**
35
- - 新增 `TYPE_SLOT_OVERRIDES` thread-local(HashMap of Vec)
36
- - 新增 `push_type_slot_override(name, ty)`:压栈一个作用域覆盖
37
- - 新增 `pop_type_slot_override(name)`:弹栈,自动清理空栈
38
- - 修改 `resolve_type_slot`:优先检查 override 栈,再回退到基础 `TYPE_SLOTS`
39
- - 修改 `clear_type_slots`:同时清理 override 栈
40
-
41
- 2. **`src/calcit/proc_name.rs`**
42
- - 添加 `WithType` 枚举变体(strum serialize = "with-type")
43
- - `get_type_signature` 返回 `None`(type-checking 在预处理阶段处理)
44
-
45
- 3. **`src/builtins.rs`**
46
- - 添加 `WithType => meta::with_type_runtime(args)` dispatch
47
-
48
- 4. **`src/builtins/meta.rs`**
49
- - 添加 `with_type_runtime()` 运行时 no-op(返回最后一个 body 值)
50
-
51
- 5. **`src/runner/preprocess/mod.rs`**
52
- - 新增 `preprocess_with_type_block()` 函数:
53
- - 解析 binding pair → 解析类型注解
54
- - push override → 预处理 body → pop override(错误时也 pop)
55
- - 在 `preprocess_list_call` 中:在 generic `Calcit::Proc` 分支之前插入 `WithType` 特殊分支
56
-
57
- 6. **`src/calcit.rs`**
58
- - re-export `push_type_slot_override`, `pop_type_slot_override`
59
-
60
- ### 运行时行为
61
-
62
- `with-type-slot` 在运行时是 no-op:类型绑定仅影响预处理阶段的类型检查,不影响运行时值。运行时返回最后一个 body 表达式的值。
63
-
64
- ### 预处理时机
65
-
66
- `with-type-slot` 的 body 在 override 激活期间被预处理。由于 `ensure_ns_def_compiled` 是懒加载的,所有从 body 中引用的 def(包括传递依赖)都会在 override 有效时被编译,从而获得正确的类型检查。
67
-
68
- ## 验证
69
-
70
- 使用 calcium-workflow 项目验证:将 `app.client/main!` 从 `bind-type` 改写为 `with-type-slot`:
71
-
72
- ```cirru
73
- ;; 改写前
74
- defn main! () (bind-type :dispatch-op Op)
75
- ...
76
-
77
- ;; 改写后
78
- defn main! ()
79
- with-type-slot (:dispatch-op Op)
80
- ...
81
- ```
82
-
83
- 运行 `cr calcit.cirru --check-only` 验证通过:`✓ Check passed (59ms)`
@@ -1,64 +0,0 @@
1
- # 2026-0609-1241 移除 bind-type(Breaking Change)
2
-
3
- ## 概要
4
-
5
- 彻底移除 `bind-type` 内置过程,所有类型槽绑定统一使用 `with-type-slot`。
6
-
7
- ## 动机
8
-
9
- `bind-type` 是全局绑定,每个槽只能绑定一次,多入口项目(client/server)会产生冲突或需要分程序加载。`with-type-slot` 提供了基于词法作用域的替代方案,在入口函数体内局部绑定,天然支持多入口并行编译。
10
-
11
- ## 删除范围
12
-
13
- ### Rust 核心
14
-
15
- | 文件 | 改动 |
16
- |------|------|
17
- | `src/calcit/proc_name.rs` | 删除 `BindType` 枚举变体及其 `ProcTypeSignature` |
18
- | `src/calcit/type_annotation.rs` | 删除 `bind_type_slot()` 函数(`TYPE_SLOTS` 仍保留用于 `deftype-slot` 声明) |
19
- | `src/calcit.rs` | 删除 `bind_type_slot` 的 re-export |
20
- | `src/builtins.rs` | 删除 `BindType => meta::bind_type(args)` dispatch arm |
21
- | `src/builtins/meta.rs` | 删除 `bind_type()` 函数及其 `bind_type_slot` 导入 |
22
- | `src/runner/preprocess/mod.rs` | 删除 `BindType` 预处理块(~90 行)及 `precompile_bind_type_defs()` 函数 |
23
- | `src/lib.rs` | 删除 `precompile_bind_type_defs` 调用 |
24
- | `src/program.rs` | 删除 `calcit_contains_bind_type()` 及 snapshot 任务排序中的优先级逻辑 |
25
- | `src/codegen/emit_js.rs` | 从 JS codegen no-op 分支中移除 `BindType` |
26
-
27
- ### 测试与固件
28
-
29
- | 文件 | 改动 |
30
- |------|------|
31
- | `calcit/type-fail/type-slot-bind-duplicate.cirru` | **删除**(测试已无法成立) |
32
- | `calcit/type-fail/type-slot-bind-unknown.cirru` | **删除**(`with-type-slot` 不需要预先声明) |
33
- | `calcit/type-fail/type-slot-enum-invalid-variant.cirru` | `bind-type` → `with-type-slot (:dispatch-op Action)` |
34
- | `calcit/type-fail/type-slot-record-call-arg-type-mismatch.cirru` | `bind-type` → `with-type-slot (:payload ...)` |
35
- | `calcit/type-fail/type-slot-entry-scope.cirru` | `bind-type` → `with-type-slot` |
36
- | `src/bin/cr_tests/type_fail.rs` | 删除 `type_fail_type_slot_fixtures_report_errors` 测试;更新注释 |
37
-
38
- ### 文档
39
-
40
- | 文件 | 改动 |
41
- |------|------|
42
- | `docs/features/static-analysis.md` | "Binding a Type Slot" 章节改用 `with-type-slot` 说明 |
43
-
44
- ### 外部项目
45
-
46
- | 文件 | 改动 |
47
- |------|------|
48
- | `calcium-workflow/calcit.cirru` (`app.server/main!`) | `(bind-type :dispatch-op Op)` → `with-type-slot (:dispatch-op Op)` |
49
-
50
- ## 验证
51
-
52
- - `cargo build --bin cr` — 零警告、零错误
53
- - `cargo clippy -- -D warnings` — 通过
54
- - `cargo test` — 85 个测试全部通过
55
- - `calcium-workflow --check-only`(client + server 入口)— 均通过
56
-
57
- ## 迁移指南
58
-
59
- 将所有 `bind-type :slot-name TypeExpr` 替换为:
60
-
61
- ```cirru
62
- with-type-slot (:slot-name TypeExpr)
63
- ;; 原来在 bind-type 之后的代码全部作为 body
64
- ```
@@ -1,57 +0,0 @@
1
- # calcit-core / RegisteredProcDescriptor effect tags
2
-
3
- ## 概要
4
-
5
- 为 `cr analyze effects-graph` 静态分析补充 effect 标记,数据源分两处、tag 名称统一:
6
-
7
- 1. **`calcit-core.cirru`** — builtin CodeEntry 的 `:tags`
8
- 2. **宿主注入 proc** — `RegisteredProcDescriptor.tags`(`HashSet<EdnTag>`)
9
-
10
- RFC `06-15-effects-graph-rfc.md` §4.2 已同步完整 tag 约定表。
11
-
12
- ## calcit.core Tag 分类
13
-
14
- | Tag | 目标 |
15
- |-----|------|
16
- | `:state` | `defatom`, `atom`, `reset!`, `swap!`, `deref`, `ref?`, `add-watch`, `remove-watch`, `&atom:deref`, `&buf-list:*`, `&buffer`, `deftype-slot`, `with-type-slot` |
17
- | `:io` | `read-file`, `write-file`, `get-env`, `cpu-time`, `&get-os`, `&get-calcit-*`, `generate-id!` |
18
- | `:file` | `read-file`, `write-file`(与 `:io` 叠加) |
19
- | `:env` | `get-env`(与 `:io` 叠加) |
20
- | `:control` | `raise`, `quit!`, `try`;`assert`/`assert=`/`assert-detect`(失败时 `raise` + `eprintln`) |
21
- | `:log` | `&display-stack`, `with-cpu-time`(宿主 `println`/`eprintln`/`echo` 见下节) |
22
- | `:meta` | `&get-def-doc`, `&get-def-schema`, `macroexpand*`, `assert-type`, `deftype-slot`, `with-type-slot`, `&data-to-code`, `&extract-code-into-edn` |
23
- | `:async` | `hint-fn` |
24
- | `:watch` | `add-watch`, `remove-watch`(与 `:state` 叠加) |
25
- | `:effect` | `&doseq` |
26
- | `:interop` | `eval`, `js-object` |
27
-
28
- ## RegisteredProcDescriptor
29
-
30
- `println` / `eprintln` / `echo` **不能**在 core 中用 `&runtime-implementation` 建 stub(会与 `has_def_code` 冲突);改由 descriptor 标记。
31
-
32
- ### API
33
-
34
- - `builtins::proc_tags(["log", "io"])` — 构建 tag 集合
35
- - `registered_proc_descriptor(name)` / `list_registered_procs()` / `registered_proc_has_tag(name, tag)`
36
- - `cr query host-procs [--tag :log]`
37
-
38
- ### 已标记注入 proc
39
-
40
- | Proc | Tags |
41
- |------|------|
42
- | `println` / `eprintln` / `echo` | `:log` `:io` |
43
- | `&call-dylib-edn*` | `:interop` `:io` |
44
- | `async-sleep` | `:io` |
45
- | `on-control-c` | `:control` `:io` |
46
-
47
- ### 其它实现细节
48
-
49
- - `inject_platform_apis()` 幂等;在 `main` 开头调用,保证 `cr query` 可见已注入 proc。
50
-
51
- ## 查询示例
52
-
53
- ```bash
54
- cr src/cirru/calcit-core.cirru query defs calcit.core --tag :state
55
- cr src/cirru/calcit-core.cirru query defs calcit.core --tag :meta
56
- cr calcit/test.cirru query host-procs --tag :log
57
- ```
@@ -1,7 +0,0 @@
1
- # &get-def-doc / &get-def-schema
2
-
3
- - 新增 `&get-def-doc`、`&get-def-schema` 内置函数,参数为 `ns/def` 字符串或 symbol。
4
- - Rust/eval 运行时通过 `program::lookup_def_doc` / `lookup_def_schema` 读取已加载定义的 `:doc` 与 `:schema`。
5
- - `snapshot::schema_annotation_to_edn` 统一 schema 转 EDN。
6
- - calcit-js 标记为 unavailable,不生成 def-meta 注册表,避免 js-out 膨胀。
7
- - 测试:`calcit/test-def-meta.cirru`,仅在 `inside-eval:` 下运行。
@@ -1,30 +0,0 @@
1
- # `cr analyze effects-graph` Phase A MVP
2
-
3
- ## 概要
4
-
5
- 实验性只读分析命令,从入口定义递归分解 State / Transform / Effect 三维信息。
6
-
7
- ## 实现
8
-
9
- - 新模块 `src/effects_graph.rs`:`EffectsGraphAnalyzer` 遍历 `PROGRAM_CODE_DATA`,复用 call-tree 可达性模式。
10
- - Tag 来源:`load_core_snapshot()` 的 `calcit.core` `:tags` + `RegisteredProcDescriptor.tags`。
11
- - CLI:`cr analyze effects-graph [--root ns/def] [--format tree|json] [--detail summary|full|minimal] ...`
12
- - 测试夹具:`calcit/test-effects-graph.cirru`
13
-
14
- ## 路径修正
15
-
16
- RFC 文件名统一为 `RFCs/06-15-effects-graph-rfc.md`(原 `06-10-...` 已手动纠正)。
17
-
18
- ## 已知限制(Phase B)
19
-
20
- - `mermaid` 输出未实现
21
- - `--infer-missing` 未实现
22
- - `detail full|minimal` 暂未差异化输出
23
- - Respo 专用规则(`render!`、`d!`)仅靠 `!` 启发式
24
-
25
- ## 输出格式(2026-06-15 更新)
26
-
27
- - **默认 `--format sketch`**:聚合 birdview 文本(State / Lifecycle / Effects 通道 / Data flow)
28
- - 自动 `--ns-prefix` 推断为 `app.`(从入口 ns 首段)
29
- - 默认 `--max-depth 2`;库代码不展开
30
- - `--format mermaid` / `tree` 仍可用