Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
d3e7d45
migrate snapshot ns entries to NsEntry; tag 0.12.2
tiye Mar 10, 2026
449e779
improve edit format status output
tiye Mar 10, 2026
8ba3533
upgrade parser; tag 0.12.3
tiye Mar 10, 2026
98bc84c
fix: vals returns :set (not :list); query def/peek/schema use tuple f…
tiye Mar 11, 2026
a106c4e
fix: handle Calcit::Map and Calcit::Set in gen_ir dump_code (panic in…
tiye Mar 12, 2026
ca008b7
fix: sanitize Edn::AnyRef before cirru_edn::format to prevent panic i…
tiye Mar 12, 2026
90b7c38
fix: sanitize nested AnyRef values before formatting EDN; tag 0.12.7
tiye Mar 12, 2026
2fa74b8
feat: add --trace-ffi flag and detailed native call tracing; tag 0.12.8
tiye Mar 12, 2026
fea36dc
check FFI cirru edn version; tag 0.12.9
tiye Mar 13, 2026
eb2bac6
fix: validate applied struct type arg arity
tiye Mar 13, 2026
0d826ea
updates on feedback
tiye Mar 15, 2026
82ed47b
maintain markdown docs inside repo
tiye Mar 15, 2026
52e7cd6
chore: reorganize profiling tools and docs
tiye Mar 16, 2026
7f446e1
refactor: clean runtime boundary compatibility
tiye Mar 16, 2026
b963ef5
Refine runtime boundary lookup paths
tiye Mar 16, 2026
e20fdaa
Tighten runtime boundary closure work
tiye Mar 17, 2026
68e0bb9
refactor: streamline runtime boundary and type hot paths
tiye Mar 17, 2026
9750393
refactor: reduce schema-key hot path branches
tiye Mar 17, 2026
557e8b1
Add chunked display for query and tree show
tiye Mar 17, 2026
70dad3c
docs: close agent workflow feedback gaps
tiye Mar 18, 2026
3aecbc6
feat(cli): add tips-level policy and preserve overwrite metadata
tiye Mar 18, 2026
631e89e
feat(caps): add outdated --yes and update upgrade docs
tiye Mar 18, 2026
5b195e4
fix outdated docs on search command; tag 0.12.10
tiye Mar 18, 2026
74b88aa
fix unexpected cyclic link; add cardo excludes
tiye Mar 19, 2026
bef67c9
docs(agent): clarify doc roles and improve query navigation
tiye Mar 19, 2026
9b69c01
clarify query find command usages again
tiye Mar 19, 2026
15ff092
unify string examples; suggest structural modifying
tiye Mar 19, 2026
a88debc
Add builtin JSON procs and runtime docs; tag 0.12.11
tiye Mar 19, 2026
95f62d0
Refine query search output and exact-match behavior
tiye Mar 20, 2026
e9272b7
Add analyze js-escape helpers and document usage
tiye Mar 20, 2026
d79b7e5
fix path format test
tiye Mar 21, 2026
8ca1a36
Refine tree show chunks
tiye Mar 22, 2026
fc2b3cb
Improve command echo output
tiye Mar 23, 2026
28b2b58
Trim redundant command tips
tiye Mar 23, 2026
6583921
Refine tool output around command echo
tiye Mar 23, 2026
ffa000d
Fix IR impl dump
tiye Mar 23, 2026
431d1ae
Use canonical type EDN in IR export
tiye Mar 23, 2026
5393298
Add command echo for libs subcommands
tiye Mar 23, 2026
eb7e88f
Move Cirru parse guidance and tighten agents cache refresh
tiye Mar 24, 2026
ac9dbca
Improve docs upgrade guidance
tiye Mar 24, 2026
97e3fc2
Remove once flag and clarify agent docs
tiye Mar 24, 2026
3c038fa
trivial fix on docs
tiye Mar 24, 2026
150e060
trivial clean on old string syntax and editor files
tiye Mar 25, 2026
82c846f
Improve docs indexing and module lookup
tiye Mar 26, 2026
9b70f54
Avoid recursive evaluation in preprocess type inference; tag 0.12.12
tiye Mar 26, 2026
5323714
--once option removed; fix outdated case
tiye Mar 26, 2026
b6a1515
bump 0.12.13
tiye Mar 26, 2026
75b7d6f
improve upgrademd
tiye Mar 26, 2026
75c9b26
improve focus of error stack displaying
tiye Mar 29, 2026
48a89a5
fix string syntax in edit format
tiye Mar 29, 2026
97f0d00
bump 0.12.14
tiye Mar 29, 2026
85bd2ce
docs: replace hardcoded versions with dynamic shell variables in ffi-…
tiye Mar 29, 2026
5ad912e
forgot to include history
tiye Mar 27, 2026
27cb808
caps: also modify calcit version
tiye Mar 30, 2026
a534562
invalid argument usage of syntax nodes
tiye Mar 30, 2026
81b8dce
improve hint-fn warning
tiye Apr 3, 2026
b48eaeb
validation during configuring version
tiye Apr 3, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,22 +34,21 @@ jobs:
- uses: Swatinem/rust-cache@v2

- run: cargo test
- run: cargo run --bin cr calcit/editor/compact.cirru --once
- run: cargo run --bin cr calcit/test.cirru --once
- run: cargo run --bin cr calcit/test.cirru

- name: "try js"
run: >
yarn
&& yarn tsc
&& cargo run --bin cr calcit/test.cirru --once js
&& cargo run --bin cr calcit/test.cirru js
&& ln -s ../../ node_modules/@calcit/procs
&& cp -v scripts/main.mjs js-out/
&& node js-out/main.mjs

- run: cargo build --release

- name: Release
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@v2
with:
files: |
target/release/cr
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ jobs:
- uses: Swatinem/rust-cache@v2

- run: cargo test
- run: cargo run --bin cr calcit/editor/compact.cirru --once
- run: cargo run --bin cr calcit/test.cirru --once
- run: cargo run --bin cr calcit/test.cirru

- uses: giraffate/clippy-action@v1
with:
Expand All @@ -48,7 +47,7 @@ jobs:
run: >
yarn
&& yarn tsc
&& cargo run --bin cr calcit/test.cirru --once js
&& cargo run --bin cr calcit/test.cirru js
&& ln -s ../../ node_modules/@calcit/procs
&& cp -v scripts/main.mjs js-out/
&& node js-out/main.mjs
Expand Down
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ calcit/.compact-inc.cirru
js-out/

node_modules/
.yarn/*.gz

lib
builds/
Expand All @@ -27,3 +28,7 @@ demos/
.yarn

.calcit-snippets/

.tmp-profiles/

profiling/*.gz
7 changes: 5 additions & 2 deletions Agents.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,20 @@
- **一致性**:复用现有模式,保持日志和错误信息风格统一。
- **测试覆盖**:新功能必须补齐正常路径与异常分支的测试用例。

直接使用命令修改 calcit 程序时不需要调用 cargo, 直接按照文档给出的命令行示例执行即可:
直接使用命令修改 calcit 程序时不需要调用 cargo, 直接按照文档给出的命令行示例执行即可。

在开始任何 `cr edit` / `cr tree` 修改前,先把下面这条命令当作**硬前置步骤**执行一遍,而不是可选建议:

```bash
cr docs agents --full
```

未先阅读最新 Agent 指南时,不要直接开始改 `compact.cirru`,避免沿用过时心智模型误判命令边界。

### 运行模式更新(cr / js / ir)

- `cr <entry>`、`cr <entry> js`、`cr <entry> ir` 现在默认都是**单次执行**(once)。
- 需要监听时,显式传 `-w` 或 `--watch`(如 `cr -w <entry>`、`cr <entry> js -w`、`cr <entry> ir -w`)。
- `-1/--once` 仍保留兼容,但在默认 once 行为下通常可省略。

### cr eval 基础与常见踩坑

Expand Down
65 changes: 19 additions & 46 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 6 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

[package]
name = "calcit"
version = "0.12.1"
version = "0.12.14"
authors = ["jiyinyiyong <jiyinyiyong@gmail.com>"]
edition = "2024"
license = "MIT"
Expand All @@ -10,7 +10,7 @@ homepage = "http://calcit-lang.org"
documentation = "https://docs.rs/crate/calcit/"
repository = "https://github.com/calcit-lang/calcit.rs"
readme = "README.md"
exclude = ["lib/*", "calcit/*", "js-out/*", "scripts/*"]
exclude = ["lib/*", "calcit/*", "ts-src/*", "js-out/*", "scripts/*", "docs/*", "editing-history/*", "drafts/*"]


# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand All @@ -32,20 +32,21 @@ strum = "0.25"
strum_macros = "0.25"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
cirru_edn = "0.7.2"
cirru_edn = "0.7.4"
cirru_parser = "0.2.3"
bisection_key = "0.0.1"
ureq = "3.2.0"
rmp-serde = "1.3.0"
semver = "1.0"

[build-dependencies]
cirru_edn = "0.7.2"
cirru_edn = "0.7.4"
rmp-serde = "1.3.0"
serde = { version = "1.0", features = ["derive"] }
cirru_parser = "0.2.3"

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
libloading = "0.8.9"
libloading = "0.9.0"
ctrlc = "3.4.5"

[lib]
Expand Down
37 changes: 34 additions & 3 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,15 @@ pub struct CodeEntry {
pub schema: Option<Edn>,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct NsEntry {
pub doc: String,
pub code: Cirru,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct FileInSnapShot {
pub ns: CodeEntry,
pub ns: NsEntry,
pub defs: HashMap<String, CodeEntry>,
}

Expand Down Expand Up @@ -204,6 +210,31 @@ fn parse_code_entry(edn: Edn, owner: &str) -> Result<CodeEntry, String> {
})
}

fn parse_ns_entry(edn: Edn, owner: &str) -> Result<NsEntry, String> {
let record: EdnRecordView = match edn {
Edn::Record(r) => r,
other => {
return Err(format!(
"{owner}: expected NsEntry/CodeEntry record, got {}",
format_edn_preview(&other)
));
}
};
let mut doc = String::new();
let mut code: Option<Cirru> = None;
for (key, value) in &record.pairs {
match key.arc_str().as_ref() {
"doc" => doc = from_edn(value.clone()).map_err(|e| format!("{owner}: invalid `:doc`: {e}"))?,
"code" => code = Some(from_edn(value.clone()).map_err(|e| format!("{owner}: invalid `:code`: {e}"))?),
_ => {}
}
}
Ok(NsEntry {
doc,
code: code.ok_or_else(|| format!("{owner}: missing `:code` field in NsEntry"))?,
})
}

fn parse_file_in_snapshot(edn: Edn, file_name: &str) -> Result<FileInSnapShot, String> {
let record: EdnRecordView = match edn {
Edn::Record(r) => r,
Expand All @@ -214,11 +245,11 @@ fn parse_file_in_snapshot(edn: Edn, file_name: &str) -> Result<FileInSnapShot, S
));
}
};
let mut ns: Option<CodeEntry> = None;
let mut ns: Option<NsEntry> = None;
let mut defs: HashMap<String, CodeEntry> = HashMap::new();
for (key, value) in &record.pairs {
match key.arc_str().as_ref() {
"ns" => ns = Some(parse_code_entry(value.clone(), &format!("{file_name}/:ns"))?),
"ns" => ns = Some(parse_ns_entry(value.clone(), &format!("{file_name}/:ns"))?),
"defs" => {
let map = match value {
Edn::Map(m) => m,
Expand Down
3 changes: 1 addition & 2 deletions calcit/add.cirru
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
:code $ quote
defn main! () $ + 1 2
:examples $ []
:ns $ %{} :CodeEntry (:doc |) (:schema nil)
:ns $ %{} :NsEntry (:doc |)
:code $ quote
ns app.main $ :require
:examples $ []
3 changes: 1 addition & 2 deletions calcit/debug/check-args.cirru
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@
:code $ quote
defn main! () (; "bad case examples for args checking") (f1 1 4) (f2 1) (f2 1 2) (f2 1 2 4) (f2) (f3 1) (f3 1 2) (f3 1 2 3) (f3)
:examples $ []
:ns $ %{} :CodeEntry (:doc |) (:schema nil)
:ns $ %{} :NsEntry (:doc |)
:code $ quote
ns check-args.main $ :require
[] util.core :refer $ [] log-title inside-eval:
:examples $ []
3 changes: 1 addition & 2 deletions calcit/debug/debug-overflow.cirru
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@
, ~x0 $ &+ ~x0
rec $ ~@ xs
:examples $ []
:ns $ %{} :CodeEntry (:doc |) (:schema nil)
:ns $ %{} :NsEntry (:doc |)
:code $ quote
ns debug-overflow.main $ :require
[] util.core :refer $ [] log-title inside-eval:
:examples $ []
Loading
Loading