@calcit/procs 0.12.50 → 0.12.52
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 +1 -2
- package/editing-history/2026-04-07-1550-path-format-at-prefix-migration.md +6 -0
- package/editing-history/2026-07-26-1220-to-js-data-options.md +14 -0
- package/editing-history/2026-07-26-1244-release-0.12.52.md +12 -0
- package/editing-history/20260720-2305-cli-docs-refresh.md +9 -0
- package/editing-history/20260720-2306-compatible-dependency-upgrades.md +9 -0
- package/editing-history/20260721-0110-format-cirru-and-refresh-docs.md +15 -0
- package/editing-history/20260722-1428-fix-or-codegen-timeout.md +23 -0
- package/editing-history/202607221613-remove-bundle-calcit-cli.md +7 -0
- package/editing-history/202607221944-replace-cr-sync-with-script.md +7 -0
- package/lib/calcit-data.d.mts +1 -1
- package/lib/calcit-data.mjs +39 -8
- package/lib/package.json +1 -1
- package/package.json +1 -1
- package/ts-src/calcit-data.mts +40 -8
package/.yarn/install-state.gz
CHANGED
|
Binary file
|
package/README.md
CHANGED
|
@@ -40,12 +40,11 @@ Installed binaries:
|
|
|
40
40
|
- `calcit`, the runtime and js compiler
|
|
41
41
|
- `cr-wasm`, standalone WASM codegen tool
|
|
42
42
|
- `caps`, for downloading dependencies declared in `deps.cirru`
|
|
43
|
-
- `bundle_calcit`, bundle code for distribution
|
|
44
43
|
|
|
45
44
|
When installing from source, explicitly include both runners:
|
|
46
45
|
|
|
47
46
|
```bash
|
|
48
|
-
cargo install --path . --bin cr --bin cr-wasm --bin caps
|
|
47
|
+
cargo install --path . --bin cr --bin cr-wasm --bin caps
|
|
49
48
|
```
|
|
50
49
|
|
|
51
50
|
To use Calcit in GitHub Actions, try [setup-cr](https://github.com/calcit-lang/setup-cr).
|
|
@@ -5,17 +5,20 @@
|
|
|
5
5
|
All display-level Cirru tree paths now use `@` prefix notation when rendered to user.
|
|
6
6
|
|
|
7
7
|
### Display format change
|
|
8
|
+
|
|
8
9
|
- `1.2.3.4` → `@1.2.3.4` (bare path)
|
|
9
10
|
- `[1.2.3.4]` → `[@1.2.3.4]` (bracketed path)
|
|
10
11
|
- `NodeLocation::Display` now outputs `ns/def [@1.2.3]` instead of `ns/def [1.2.3]`
|
|
11
12
|
|
|
12
13
|
### Backward compatibility
|
|
14
|
+
|
|
13
15
|
- `parse_path()` strips leading `@` if present, so CLI input still accepts both `@1.2.3` and `1.2.3`
|
|
14
16
|
- Error messages and help text updated to show `@` format
|
|
15
17
|
|
|
16
18
|
### Files modified
|
|
17
19
|
|
|
18
20
|
**Core functions:**
|
|
21
|
+
|
|
19
22
|
- `src/bin/cli_handlers/common.rs`: `format_path()` returns `@1.2.3`; `parse_path()` strips `@` prefix; test assertions updated
|
|
20
23
|
- `src/calcit.rs`: `NodeLocation::Display` outputs `[@1.2.3]`; test assertion updated
|
|
21
24
|
- `src/bin/cli_handlers/cirru_validator.rs`: local `format_path()` updated
|
|
@@ -24,17 +27,20 @@ All display-level Cirru tree paths now use `@` prefix notation when rendered to
|
|
|
24
27
|
- `src/runner/preprocess/mod.rs`: `[&inspect-type]` debug output uses `@`
|
|
25
28
|
|
|
26
29
|
**Tree/edit handlers:**
|
|
30
|
+
|
|
27
31
|
- `src/bin/cli_handlers/tree.rs`: inline path formatting in swap handler
|
|
28
32
|
- `src/bin/cli_handlers/edit.rs`: error message example
|
|
29
33
|
- `src/cli_args.rs`: help text examples (3 locations)
|
|
30
34
|
|
|
31
35
|
**Documentation:**
|
|
36
|
+
|
|
32
37
|
- `docs/CalcitAgent.md`: 19 path examples updated
|
|
33
38
|
- `docs/run/agent-advanced.md`: 23 path examples updated
|
|
34
39
|
- `docs/run/edit-tree.md`: 6 path examples updated
|
|
35
40
|
- `docs/Respo-Agent.md` (respo project): 26 path examples updated
|
|
36
41
|
|
|
37
42
|
### Why
|
|
43
|
+
|
|
38
44
|
- `@` prefix helps LLMs distinguish path coordinates from other dotted numeric patterns (like version numbers or floats)
|
|
39
45
|
- `@` is safe in shell (no escaping needed)
|
|
40
46
|
- All display output now consistent with `@` prefix
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# 2026-07-26 12:20 to-js-data options validation
|
|
2
|
+
|
|
3
|
+
## 修改概要
|
|
4
|
+
|
|
5
|
+
- 将 `to-js-data` 的第二参数改为 options map,并保留旧 boolean `addColon` 参数的兼容警告。
|
|
6
|
+
- 支持 `{} (:js-array true)`、`:js-object`、`:js-string`、`:js-number` 作为转换结果验证标记。
|
|
7
|
+
- 为 JS 集成测试和 `cr query examples calcit.core/to-js-data` 增加 options 示例。
|
|
8
|
+
|
|
9
|
+
## 验证
|
|
10
|
+
|
|
11
|
+
- `yarn compile`
|
|
12
|
+
- `cargo test -q --bin cr`
|
|
13
|
+
- `yarn try-js`
|
|
14
|
+
- `cr calcit/test.cirru query examples calcit.core/to-js-data`
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
## Summary
|
|
2
|
+
|
|
3
|
+
Refresh CLI-facing docs to match the current command surface.
|
|
4
|
+
|
|
5
|
+
## Notes
|
|
6
|
+
|
|
7
|
+
- Align `cr edit` / `cr tree` examples with current subcommand names and long-option forms.
|
|
8
|
+
- Document stdin fallback for edit/tree code inputs while keeping the Cirru EDN `quote` requirement explicit.
|
|
9
|
+
- Update agent-oriented guides so examples no longer mix legacy structured command syntax with current shell CLI usage.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
## Summary
|
|
2
|
+
|
|
3
|
+
Upgrade compatible Rust dependencies, including `cirru_edn`, without changing the existing `strum` line.
|
|
4
|
+
|
|
5
|
+
## Notes
|
|
6
|
+
|
|
7
|
+
- Bump `cirru_edn` to `0.7.8` in normal and build dependencies.
|
|
8
|
+
- Upgrade other compatible crates such as `argh`, `colored`, `ctrlc`, `regex`, `rpds`, `semver`, `serde`, `serde_json`, and `ureq`.
|
|
9
|
+
- Refresh `Cargo.lock` after version changes so the workspace resolves to the new compatible releases.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# 2026-07-21 01:10 Cirru 格式化与文档命令更新
|
|
2
|
+
|
|
3
|
+
## 修改概要
|
|
4
|
+
|
|
5
|
+
- 使用 `cr <snapshot> edit format` 统一格式化 `calcit/` 下 56 个非空 Cirru 文件。
|
|
6
|
+
- 保留 `calcit/debug/.compact-inc.cirru` 这个 0 字节热更新占位文件原样。
|
|
7
|
+
- 修正文档中已移除的 `check-md -d`、`remote-libs readme -f`、`read-lines -s/-n` 旧参数。
|
|
8
|
+
- 在快速参考中加入文档知识图谱常用命令。
|
|
9
|
+
|
|
10
|
+
## 验证
|
|
11
|
+
|
|
12
|
+
- `cr docs agents --full`
|
|
13
|
+
- `cargo test -q`
|
|
14
|
+
- `yarn check-all`
|
|
15
|
+
- `git diff --check`
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Fix exponential `or` expansion and bound code generation
|
|
2
|
+
|
|
3
|
+
## Summary
|
|
4
|
+
|
|
5
|
+
- Fixed the `or` macro so its recursive tail is emitted once instead of being duplicated in both falsy branches.
|
|
6
|
+
- Preserved Calcit truthiness semantics for `nil`, `false`, and arbitrary truthy values.
|
|
7
|
+
- Added a long-operand regression case to the macro test suite.
|
|
8
|
+
- Added verbose preprocessing phase/definition diagnostics for JS and IR generation.
|
|
9
|
+
- Added a configurable code generation timeout, defaulting to 60 seconds, including watch-mode rebuilds.
|
|
10
|
+
- Increased the code generation worker stack for deeply nested macro and type preprocessing.
|
|
11
|
+
|
|
12
|
+
## Root cause
|
|
13
|
+
|
|
14
|
+
The previous `or` macro emitted the remaining operands in both the `nil` and `false` branches. Recursive macro expansion therefore grew exponentially for long `or` expressions. A real-world 40-plus-operand predicate appeared to hang and consumed CPU until externally terminated.
|
|
15
|
+
|
|
16
|
+
## Validation
|
|
17
|
+
|
|
18
|
+
- `cargo fmt --check`
|
|
19
|
+
- `cargo clippy --bin cr -- -D warnings`
|
|
20
|
+
- `cargo test --lib runner::preprocess -- --nocapture`
|
|
21
|
+
- `target/debug/cr calcit/test.cirru`
|
|
22
|
+
- `target/debug/cr calcit/test.cirru --timeout 60 js`
|
|
23
|
+
- The original `respo/markdown/calcit.cirru` reproduction now reaches its project-level warnings in under one second instead of timing out after 60 seconds.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# Replace the legacy bundle CLI with a Calcit script
|
|
2
|
+
|
|
3
|
+
- Removed the deprecated `bundle_calcit` Rust binary and its release artifact.
|
|
4
|
+
- Added the recursive `read-dir` Calcit runtime API so filesystem workflows can be implemented in Calcit.
|
|
5
|
+
- Added `calcit/bundle-calcit.cirru` as a directly executable snapshot that bundles indentation-based source files into a runnable snapshot.
|
|
6
|
+
- Updated installation and bundle-mode documentation to use the script-based workflow.
|
|
7
|
+
- Verified the script against `minimal-calcit`, including loading and running the generated snapshot.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# Replace the legacy cr-sync binary with a Calcit script
|
|
2
|
+
|
|
3
|
+
- Removed the `cr-sync` Rust binary and its installation documentation.
|
|
4
|
+
- Moved the bundle script to `calcit/scripts/` and added `sync-calcit.cirru` beside it.
|
|
5
|
+
- Added `unix-time-ms` for script-generated snapshot metadata.
|
|
6
|
+
- Reused `bisection-key` lexical-key APIs; `bisection-key` 0.0.18 fixes string-key append support.
|
|
7
|
+
- Verified synchronization against the editor repository's real `compact.cirru` and `calcit.cirru` fixtures, then checked the output with the legacy dry-run binary.
|
package/lib/calcit-data.d.mts
CHANGED
|
@@ -32,7 +32,7 @@ export declare let castTag: (x: CalcitValue) => CalcitTag;
|
|
|
32
32
|
export declare var refsRegistry: Map<string, CalcitRef>;
|
|
33
33
|
export declare let hashFunction: (x: CalcitValue) => Hash;
|
|
34
34
|
export declare let toString: (x: CalcitValue, escaped: boolean, disableJsDataWarning?: boolean) => string;
|
|
35
|
-
export declare let to_js_data: (x: CalcitValue,
|
|
35
|
+
export declare let to_js_data: (x: CalcitValue, options?: CalcitValue | boolean) => any;
|
|
36
36
|
export declare let _$n_map_$o_get: (xs: CalcitValue, k: CalcitValue) => CalcitValue;
|
|
37
37
|
export declare let _$n__$e_: (x: CalcitValue, y: CalcitValue) => boolean;
|
|
38
38
|
/** special trick for disabling ternary tree list check */
|
package/lib/calcit-data.mjs
CHANGED
|
@@ -441,7 +441,38 @@ export let toString = (x, escaped, disableJsDataWarning = false) => {
|
|
|
441
441
|
}
|
|
442
442
|
return `(#js ${JSON.stringify(x)})`;
|
|
443
443
|
};
|
|
444
|
-
export let to_js_data = (x,
|
|
444
|
+
export let to_js_data = (x, options) => {
|
|
445
|
+
let addColon = false;
|
|
446
|
+
if (typeof options === "boolean") {
|
|
447
|
+
console.warn("to-js-data: the addColon boolean argument is deprecated; pass an options map instead");
|
|
448
|
+
addColon = options;
|
|
449
|
+
}
|
|
450
|
+
else if (options !== undefined) {
|
|
451
|
+
let jsOptions = to_js_data_inner(options, false);
|
|
452
|
+
addColon = jsOptions[":add-colon"] === true || jsOptions["add-colon"] === true;
|
|
453
|
+
let value = to_js_data_inner(x, addColon);
|
|
454
|
+
let expectedType = jsOptions[":type"] ??
|
|
455
|
+
jsOptions.type ??
|
|
456
|
+
(jsOptions[":js-array"] || jsOptions["js-array"] ? "js-array" : undefined) ??
|
|
457
|
+
(jsOptions[":js-string"] || jsOptions["js-string"] ? "js-string" : undefined) ??
|
|
458
|
+
(jsOptions[":js-number"] || jsOptions["js-number"] ? "js-number" : undefined) ??
|
|
459
|
+
(jsOptions[":js-object"] || jsOptions["js-object"] ? "js-object" : undefined) ??
|
|
460
|
+
"js-object";
|
|
461
|
+
let valid = (expectedType === "js-array" && Array.isArray(value)) ||
|
|
462
|
+
(expectedType === "js-object" &&
|
|
463
|
+
value !== null &&
|
|
464
|
+
typeof value === "object" &&
|
|
465
|
+
!Array.isArray(value) &&
|
|
466
|
+
!(value instanceof Set)) ||
|
|
467
|
+
(expectedType === "js-string" && typeof value === "string") ||
|
|
468
|
+
(expectedType === "js-number" && typeof value === "number");
|
|
469
|
+
if (!valid)
|
|
470
|
+
throw new Error(`to-js-data expects ${expectedType}`);
|
|
471
|
+
return value;
|
|
472
|
+
}
|
|
473
|
+
return to_js_data_inner(x, addColon);
|
|
474
|
+
};
|
|
475
|
+
let to_js_data_inner = (x, addColon) => {
|
|
445
476
|
if (x == null) {
|
|
446
477
|
return null;
|
|
447
478
|
}
|
|
@@ -470,17 +501,17 @@ export let to_js_data = (x, addColon = false) => {
|
|
|
470
501
|
return Symbol(x.value);
|
|
471
502
|
}
|
|
472
503
|
if (x instanceof CalcitTuple) {
|
|
473
|
-
var result = [
|
|
504
|
+
var result = [to_js_data_inner(x.tag, false)];
|
|
474
505
|
for (let i = 0; i < x.extra.length; i++) {
|
|
475
506
|
let item = x.extra[i];
|
|
476
|
-
result.push(
|
|
507
|
+
result.push(to_js_data_inner(item, false));
|
|
477
508
|
}
|
|
478
509
|
return result;
|
|
479
510
|
}
|
|
480
511
|
if (x instanceof CalcitList || x instanceof CalcitSliceList) {
|
|
481
512
|
var result = [];
|
|
482
513
|
for (let item of x.items()) {
|
|
483
|
-
result.push(
|
|
514
|
+
result.push(to_js_data_inner(item, addColon));
|
|
484
515
|
}
|
|
485
516
|
return result;
|
|
486
517
|
}
|
|
@@ -490,22 +521,22 @@ export let to_js_data = (x, addColon = false) => {
|
|
|
490
521
|
for (let idx = 0; idx < pairs.length; idx++) {
|
|
491
522
|
let k = pairs[idx][0];
|
|
492
523
|
let v = pairs[idx][1];
|
|
493
|
-
var key =
|
|
494
|
-
result[key] =
|
|
524
|
+
var key = to_js_data_inner(k, addColon);
|
|
525
|
+
result[key] = to_js_data_inner(v, addColon);
|
|
495
526
|
}
|
|
496
527
|
return result;
|
|
497
528
|
}
|
|
498
529
|
if (x instanceof CalcitSet) {
|
|
499
530
|
let result = new Set();
|
|
500
531
|
x.values().forEach((v) => {
|
|
501
|
-
result.add(
|
|
532
|
+
result.add(to_js_data_inner(v, addColon));
|
|
502
533
|
});
|
|
503
534
|
return result;
|
|
504
535
|
}
|
|
505
536
|
if (x instanceof CalcitRecord) {
|
|
506
537
|
let result = {};
|
|
507
538
|
for (let idx = 0; idx < x.fields.length; idx++) {
|
|
508
|
-
result[x.fields[idx].value] =
|
|
539
|
+
result[x.fields[idx].value] = to_js_data_inner(x.values[idx], false);
|
|
509
540
|
}
|
|
510
541
|
return result;
|
|
511
542
|
}
|
package/lib/package.json
CHANGED
package/package.json
CHANGED
package/ts-src/calcit-data.mts
CHANGED
|
@@ -472,7 +472,39 @@ export let toString = (x: CalcitValue, escaped: boolean, disableJsDataWarning: b
|
|
|
472
472
|
return `(#js ${JSON.stringify(x)})`;
|
|
473
473
|
};
|
|
474
474
|
|
|
475
|
-
export let to_js_data = (x: CalcitValue,
|
|
475
|
+
export let to_js_data = (x: CalcitValue, options?: CalcitValue | boolean): any => {
|
|
476
|
+
let addColon = false;
|
|
477
|
+
if (typeof options === "boolean") {
|
|
478
|
+
console.warn("to-js-data: the addColon boolean argument is deprecated; pass an options map instead");
|
|
479
|
+
addColon = options;
|
|
480
|
+
} else if (options !== undefined) {
|
|
481
|
+
let jsOptions = to_js_data_inner(options, false) as Record<string, any>;
|
|
482
|
+
addColon = jsOptions[":add-colon"] === true || jsOptions["add-colon"] === true;
|
|
483
|
+
let value = to_js_data_inner(x, addColon);
|
|
484
|
+
let expectedType =
|
|
485
|
+
jsOptions[":type"] ??
|
|
486
|
+
jsOptions.type ??
|
|
487
|
+
(jsOptions[":js-array"] || jsOptions["js-array"] ? "js-array" : undefined) ??
|
|
488
|
+
(jsOptions[":js-string"] || jsOptions["js-string"] ? "js-string" : undefined) ??
|
|
489
|
+
(jsOptions[":js-number"] || jsOptions["js-number"] ? "js-number" : undefined) ??
|
|
490
|
+
(jsOptions[":js-object"] || jsOptions["js-object"] ? "js-object" : undefined) ??
|
|
491
|
+
"js-object";
|
|
492
|
+
let valid =
|
|
493
|
+
(expectedType === "js-array" && Array.isArray(value)) ||
|
|
494
|
+
(expectedType === "js-object" &&
|
|
495
|
+
value !== null &&
|
|
496
|
+
typeof value === "object" &&
|
|
497
|
+
!Array.isArray(value) &&
|
|
498
|
+
!(value instanceof Set)) ||
|
|
499
|
+
(expectedType === "js-string" && typeof value === "string") ||
|
|
500
|
+
(expectedType === "js-number" && typeof value === "number");
|
|
501
|
+
if (!valid) throw new Error(`to-js-data expects ${expectedType}`);
|
|
502
|
+
return value;
|
|
503
|
+
}
|
|
504
|
+
return to_js_data_inner(x, addColon);
|
|
505
|
+
};
|
|
506
|
+
|
|
507
|
+
let to_js_data_inner = (x: CalcitValue, addColon: boolean): any => {
|
|
476
508
|
if (x == null) {
|
|
477
509
|
return null;
|
|
478
510
|
}
|
|
@@ -501,17 +533,17 @@ export let to_js_data = (x: CalcitValue, addColon: boolean = false): any => {
|
|
|
501
533
|
return Symbol(x.value);
|
|
502
534
|
}
|
|
503
535
|
if (x instanceof CalcitTuple) {
|
|
504
|
-
var result: any[] = [
|
|
536
|
+
var result: any[] = [to_js_data_inner(x.tag, false)];
|
|
505
537
|
for (let i = 0; i < x.extra.length; i++) {
|
|
506
538
|
let item = x.extra[i];
|
|
507
|
-
result.push(
|
|
539
|
+
result.push(to_js_data_inner(item, false));
|
|
508
540
|
}
|
|
509
541
|
return result;
|
|
510
542
|
}
|
|
511
543
|
if (x instanceof CalcitList || x instanceof CalcitSliceList) {
|
|
512
544
|
var result: any[] = [];
|
|
513
545
|
for (let item of x.items()) {
|
|
514
|
-
result.push(
|
|
546
|
+
result.push(to_js_data_inner(item, addColon));
|
|
515
547
|
}
|
|
516
548
|
return result;
|
|
517
549
|
}
|
|
@@ -521,22 +553,22 @@ export let to_js_data = (x: CalcitValue, addColon: boolean = false): any => {
|
|
|
521
553
|
for (let idx = 0; idx < pairs.length; idx++) {
|
|
522
554
|
let k = pairs[idx][0];
|
|
523
555
|
let v = pairs[idx][1];
|
|
524
|
-
var key =
|
|
525
|
-
result[key] =
|
|
556
|
+
var key = to_js_data_inner(k, addColon);
|
|
557
|
+
result[key] = to_js_data_inner(v, addColon);
|
|
526
558
|
}
|
|
527
559
|
return result;
|
|
528
560
|
}
|
|
529
561
|
if (x instanceof CalcitSet) {
|
|
530
562
|
let result = new Set();
|
|
531
563
|
x.values().forEach((v) => {
|
|
532
|
-
result.add(
|
|
564
|
+
result.add(to_js_data_inner(v, addColon));
|
|
533
565
|
});
|
|
534
566
|
return result;
|
|
535
567
|
}
|
|
536
568
|
if (x instanceof CalcitRecord) {
|
|
537
569
|
let result: Record<string, CalcitValue> = {};
|
|
538
570
|
for (let idx = 0; idx < x.fields.length; idx++) {
|
|
539
|
-
result[x.fields[idx].value] =
|
|
571
|
+
result[x.fields[idx].value] = to_js_data_inner(x.values[idx], false);
|
|
540
572
|
}
|
|
541
573
|
return result;
|
|
542
574
|
}
|