Compare commits

...

10 Commits

Author SHA1 Message Date
4682f3ba55 A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores) 2025-03-03 17:25:32 +00:00
77b05165b8 A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores) 2025-03-03 17:13:50 +00:00
0ae237ab1d Move rust-toolchain.toml to root 2025-03-03 12:02:40 -05:00
52b554db72 Try using rust-toolchain.toml by default 2025-03-03 11:59:55 -05:00
a4db302174 move kcl.py to this repo (#5587)
* ci for kcl-python-bindings

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* updates

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* updates

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* updates

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* bettter concurrency

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* cleanup files

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* updates

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* updaets

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* updaets

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* updaets

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* updaets

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* format

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* format

Signed-off-by: Jess Frazelle <github@jessfraz.com>

---------

Signed-off-by: Jess Frazelle <github@jessfraz.com>
2025-03-01 19:38:25 -05:00
66f3500ca9 Remove start sketch at (#5586)
* remove start sketch at

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* fixes

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* updates

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* updates

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* fixes

Signed-off-by: Jess Frazelle <github@jessfraz.com>

---------

Signed-off-by: Jess Frazelle <github@jessfraz.com>
2025-03-01 19:32:46 -05:00
c3bdc6f106 Move the wasm lib, and cleanup rust directory and all references (#5585)
* git mv src/wasm-lib rust

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* mv wasm-lib to workspace

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* mv kcl-lib

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* mv derive docs

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* resolve file paths

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* clippy

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* move more shit

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* fix more paths

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* make yarn build:wasm work

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* fix scripts

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* fixups

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* better references

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* fix cargo ci

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* fix reference

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* fix more ci

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* fix tests

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* cargo sort

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* fix script

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* fix

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* fmt

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* fix a dep

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* sort

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* remove unused deps

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* Revert "remove unused deps"

This reverts commit fbabdb062e275fd5cbc1476f8480a1afee15d972.

* updates

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* deps;

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* fixes

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* updates

Signed-off-by: Jess Frazelle <github@jessfraz.com>

---------

Signed-off-by: Jess Frazelle <github@jessfraz.com>
2025-03-01 21:59:01 +00:00
0a2bf4b55f Fix to round floating point numbers in test output (#5584)
* Fix to round floating point numbers in test output

* Update output after rounding
2025-02-28 23:32:00 -08:00
bbae9b6363 Fix to have deterministic order of commands (#5583) 2025-02-28 23:31:38 -08:00
180d52280d minor fixes to some scripts / From<impl for Project Config> (#5582)
minor fixes

Signed-off-by: Jess Frazelle <github@jessfraz.com>
2025-03-01 03:02:06 +00:00
1474 changed files with 7991 additions and 12699 deletions

View File

@ -1,4 +1,4 @@
src/wasm-lib/* rust/*
*.typegen.ts *.typegen.ts
packages/codemirror-lsp-client/dist/* packages/codemirror-lsp-client/dist/*
e2e/playwright/snapshots/prompt-to-edit/* e2e/playwright/snapshots/prompt-to-edit/*

View File

@ -25,7 +25,7 @@ updates:
- adamchalmers - adamchalmers
- jessfraz - jessfraz
- package-ecosystem: 'cargo' # See documentation for possible values - package-ecosystem: 'cargo' # See documentation for possible values
directory: '/src/wasm-lib/' # Location of package manifests directory: '/rust/' # Location of package manifests
schedule: schedule:
interval: weekly interval: weekly
day: monday day: monday
@ -39,3 +39,11 @@ updates:
wasm-bindgen-deps: wasm-bindgen-deps:
patterns: patterns:
- "wasm-bindgen*" - "wasm-bindgen*"
- package-ecosystem: "pip" # See documentation for possible values
directory: "/rust/kcl-python-bindings/" # Location of package manifests
schedule:
interval: weekly
day: monday
reviewers:
- adamchalmers
- jessfraz

View File

@ -21,7 +21,7 @@ jobs:
- name: Cache wasm - name: Cache wasm
uses: Swatinem/rust-cache@v2 uses: Swatinem/rust-cache@v2
with: with:
workspaces: './src/wasm-lib' workspaces: './rust'
- uses: taiki-e/install-action@2dbeb927f58939d3aa13bf06ba0c0a34b76b9bfb - uses: taiki-e/install-action@2dbeb927f58939d3aa13bf06ba0c0a34b76b9bfb
with: with:
tool: wasm-pack tool: wasm-pack
@ -33,4 +33,4 @@ jobs:
- uses: actions/upload-artifact@v4 - uses: actions/upload-artifact@v4
with: with:
name: wasm-bundle name: wasm-bundle
path: src/wasm-lib/pkg path: rust/kcl-wasm-lib/pkg

View File

@ -38,9 +38,9 @@ jobs:
- uses: Swatinem/rust-cache@v2 - uses: Swatinem/rust-cache@v2
with: with:
workspaces: './src/wasm-lib' workspaces: './rust'
# TODO: see if we can fetch from main instead if no diff at src/wasm-lib # TODO: see if we can fetch from main instead if no diff at rust
- uses: taiki-e/install-action@2dbeb927f58939d3aa13bf06ba0c0a34b76b9bfb - uses: taiki-e/install-action@2dbeb927f58939d3aa13bf06ba0c0a34b76b9bfb
with: with:
tool: wasm-pack tool: wasm-pack
@ -67,7 +67,7 @@ jobs:
path: | path: |
package.json package.json
electron-builder.yml electron-builder.yml
src/wasm-lib/pkg/wasm_lib* rust/kcl-wasm-lib/pkg/kcl_wasm_lib*
release-notes.md release-notes.md
assets/icon.ico assets/icon.ico
assets/icon.png assets/icon.png
@ -117,9 +117,9 @@ jobs:
ls -R prepared-files ls -R prepared-files
cp prepared-files/package.json package.json cp prepared-files/package.json package.json
cp prepared-files/electron-builder.yml electron-builder.yml cp prepared-files/electron-builder.yml electron-builder.yml
cp prepared-files/src/wasm-lib/pkg/wasm_lib_bg.wasm public cp prepared-files/rust/kcl-wasm-lib/pkg/kcl_wasm_lib_bg.wasm public
mkdir src/wasm-lib/pkg mkdir rust/kcl-wasm-lib/pkg
cp prepared-files/src/wasm-lib/pkg/wasm_lib* src/wasm-lib/pkg cp prepared-files/rust/kcl-wasm-lib/pkg/kcl_wasm_lib* rust/kcl-wasm-lib/pkg
cp prepared-files/release-notes.md release-notes.md cp prepared-files/release-notes.md release-notes.md
cp prepared-files/assets/icon.ico assets/icon.ico cp prepared-files/assets/icon.ico assets/icon.ico
cp prepared-files/assets/icon.png assets/icon.png cp prepared-files/assets/icon.png assets/icon.png

View File

@ -17,23 +17,17 @@ jobs:
cargocheck: cargocheck:
name: cargo check name: cargo check
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy:
matrix:
dir: ['src/wasm-lib']
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Install latest rust - name: Install latest rust
uses: actions-rs/toolchain@v1 uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Rust Cache - name: Rust Cache
uses: Swatinem/rust-cache@v2.6.1 uses: Swatinem/rust-cache@v2.6.1
- name: Run check - name: Run check
run: | run: |
cd "${{ matrix.dir }}" cd rust
# We specifically want to test the disable-println feature # We specifically want to test the disable-println feature
# Since it is not enabled by default, we need to specify it # Since it is not enabled by default, we need to specify it
# This is used in kcl-lsp # This is used in kcl-lsp

View File

@ -23,9 +23,6 @@ jobs:
cargoclippy: cargoclippy:
name: cargo clippy name: cargo clippy
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy:
matrix:
dir: ['src/wasm-lib']
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: taiki-e/install-action@just - uses: taiki-e/install-action@just
@ -41,7 +38,7 @@ jobs:
- name: Run clippy - name: Run clippy
run: | run: |
cd "${{ matrix.dir }}" cd rust
just lint just lint
# If this fails, run "cargo check" to update Cargo.lock, # If this fails, run "cargo check" to update Cargo.lock,
# then add Cargo.lock to the PR. # then add Cargo.lock to the PR.

View File

@ -26,9 +26,6 @@ jobs:
cargofmt: cargofmt:
name: cargo fmt name: cargo fmt
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy:
matrix:
dir: ['src/wasm-lib']
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Install latest rust - name: Install latest rust
@ -43,6 +40,6 @@ jobs:
- name: Run cargo fmt - name: Run cargo fmt
run: | run: |
cd "${{ matrix.dir }}" cd rust
cargo fmt -- --check cargo fmt -- --check
shell: bash shell: bash

View File

@ -9,14 +9,11 @@ permissions: read-all
concurrency: concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true cancel-in-progress: true
name: cargo test of wasm-lib name: cargo test
jobs: jobs:
cargotest: cargotest:
name: cargo test name: cargo test
runs-on: ubuntu-latest-8-cores runs-on: ubuntu-latest-8-cores
strategy:
matrix:
dir: ['src/wasm-lib']
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Install latest rust - name: Install latest rust
@ -45,7 +42,7 @@ jobs:
- name: cargo test - name: cargo test
shell: bash shell: bash
run: |- run: |-
cd "${{ matrix.dir }}" cd rust
cargo llvm-cov nextest --workspace --lcov --output-path lcov.info --retries=2 --no-fail-fast -P ci 2>&1 | tee /tmp/github-actions.log cargo llvm-cov nextest --workspace --lcov --output-path lcov.info --retries=2 --no-fail-fast -P ci 2>&1 | tee /tmp/github-actions.log
env: env:
KITTYCAD_API_TOKEN: ${{secrets.KITTYCAD_API_TOKEN}} KITTYCAD_API_TOKEN: ${{secrets.KITTYCAD_API_TOKEN}}
@ -55,7 +52,7 @@ jobs:
with: with:
token: ${{secrets.CODECOV_TOKEN}} token: ${{secrets.CODECOV_TOKEN}}
fail_ci_if_error: true fail_ci_if_error: true
flags: wasm-lib flags: rust
verbose: true verbose: true
files: lcov.info files: lcov.info

View File

@ -45,7 +45,7 @@ jobs:
with: with:
filters: | filters: |
rust: rust:
- 'src/wasm-lib/**' - 'rust/**'
- uses: actions/setup-node@v4 - uses: actions/setup-node@v4
with: with:
node-version-file: '.nvmrc' node-version-file: '.nvmrc'
@ -72,11 +72,11 @@ jobs:
name: wasm-bundle name: wasm-bundle
workflow: build-and-store-wasm.yml workflow: build-and-store-wasm.yml
branch: main branch: main
path: src/wasm-lib/pkg path: rust/kcl-wasm-lib/pkg
- name: copy wasm blob - name: copy wasm blob
if: github.event_name != 'schedule' && steps.filter.outputs.rust == 'false' if: github.event_name != 'schedule' && steps.filter.outputs.rust == 'false'
shell: bash shell: bash
run: cp src/wasm-lib/pkg/wasm_lib_bg.wasm public run: cp rust/kcl-wasm-lib/pkg/kcl_wasm_lib_bg.wasm public
continue-on-error: true continue-on-error: true
- name: Setup Rust - name: Setup Rust
uses: dtolnay/rust-toolchain@stable uses: dtolnay/rust-toolchain@stable
@ -87,12 +87,12 @@ jobs:
if: github.event_name == 'schedule' || steps.filter.outputs.rust == 'true' if: github.event_name == 'schedule' || steps.filter.outputs.rust == 'true'
uses: Swatinem/rust-cache@v2 uses: Swatinem/rust-cache@v2
with: with:
workspaces: './src/wasm-lib' workspaces: './rust'
- name: OR Cache Wasm (because wasm cache failed) - name: OR Cache Wasm (because wasm cache failed)
if: steps.download-wasm.outcome == 'failure' if: steps.download-wasm.outcome == 'failure'
uses: Swatinem/rust-cache@v2 uses: Swatinem/rust-cache@v2
with: with:
workspaces: './src/wasm-lib' workspaces: './rust'
- name: install good sed - name: install good sed
if: ${{ startsWith(matrix.os, 'macos') }} if: ${{ startsWith(matrix.os, 'macos') }}
shell: bash shell: bash

View File

@ -0,0 +1,179 @@
# This file is autogenerated by maturin v1.6.0 and then modified
# To update, run
#
# maturin generate-ci github
#
name: kcl-python-bindings
on:
push:
branches:
- main
paths:
- '**/Cargo.toml'
- '**/Cargo.lock'
- '**/rust-toolchain.toml'
- 'rust/kcl-python-bindings/**'
- '**.rs'
- .github/workflows/kcl-python-bindings.yml
tags:
- 'kcl-*'
pull_request:
paths:
- '**/Cargo.toml'
- '**/Cargo.lock'
- '**/rust-toolchain.toml'
- 'rust/kcl-python-bindings/**'
- '**.rs'
- .github/workflows/kcl-python-bindings.yml
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
linux-x86_64:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.x
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
working-directory: rust/kcl-python-bindings
target: x86_64
args: --release --out dist --find-interpreter
sccache: 'true'
manylinux: auto
before-script-linux: |
yum install openssl-devel -y
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-linux-x86_64
path: rust/kcl-python-bindings/dist
windows:
runs-on: windows-16-cores
strategy:
matrix:
target:
- x64
fail-fast: false
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.x
architecture: ${{ matrix.target }}
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
working-directory: rust/kcl-python-bindings
target: ${{ matrix.target }}
args: --release --out dist --find-interpreter
sccache: 'true'
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-windows-${{ matrix.target }}
path: rust/kcl-python-bindings/dist
macos:
runs-on: macos-latest
strategy:
matrix:
target:
- x86_64
- aarch64
fail-fast: false
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.x
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
working-directory: rust/kcl-python-bindings
target: ${{ matrix.target }}
args: --release --out dist --find-interpreter
sccache: 'true'
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-macos-${{ matrix.target }}
path: rust/kcl-python-bindings/dist
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v5
- uses: actions-rust-lang/setup-rust-toolchain@v1
- uses: taiki-e/install-action@just
- name: Run tests
run: |
cd rust/kcl-python-bindings
just setup-uv
just test
env:
KITTYCAD_API_TOKEN: ${{ secrets.KITTYCAD_API_TOKEN }}
sdist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install the latest version of uv
uses: astral-sh/setup-uv@v5
- name: Install codespell
run: |
uv venv .venv
echo "VIRTUAL_ENV=.venv" >> $GITHUB_ENV
echo "$PWD/.venv/bin" >> $GITHUB_PATH
uv pip install pip --upgrade
- name: Build sdist
uses: PyO3/maturin-action@v1
with:
working-directory: rust/kcl-python-bindings
command: sdist
args: --out dist
- name: Upload sdist
uses: actions/upload-artifact@v4
with:
name: wheels-sdist
path: rust/kcl-python-bindings/dist
release:
name: Release
runs-on: ubuntu-latest
permissions:
contents: write
if: startsWith(github.ref, 'refs/tags/')
needs: [linux-x86_64, windows, macos, sdist]
steps:
- uses: actions/download-artifact@v4
- name: Install the latest version of uv
uses: astral-sh/setup-uv@v5
- name: Install codespell
run: |
cd rust/kcl-python-bindings
uv venv .venv
echo "VIRTUAL_ENV=.venv" >> $GITHUB_ENV
echo "$PWD/.venv/bin" >> $GITHUB_PATH
uv pip install pip --upgrade
- name: Publish to PyPI
uses: PyO3/maturin-action@v1
env:
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
with:
working-directory: rust/kcl-python-bindings
command: upload
args: --non-interactive --skip-existing wheels-*/*

24
.github/workflows/ruff.yml vendored Normal file
View File

@ -0,0 +1,24 @@
name: ruff
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
on:
push:
branches: main
paths:
- '**.py'
- .github/workflows/ruff.yml
pull_request:
paths:
- '**.py'
- .github/workflows/ruff.yml
permissions:
contents: read
pull-requests: write
jobs:
ruff:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: astral-sh/ruff-action@v3

View File

@ -54,7 +54,7 @@ jobs:
- run: yarn install - run: yarn install
- uses: Swatinem/rust-cache@v2 - uses: Swatinem/rust-cache@v2
with: with:
workspaces: './src/wasm-lib' workspaces: './rust'
- uses: taiki-e/install-action@2dbeb927f58939d3aa13bf06ba0c0a34b76b9bfb - uses: taiki-e/install-action@2dbeb927f58939d3aa13bf06ba0c0a34b76b9bfb
with: with:

25
.gitignore vendored
View File

@ -26,16 +26,15 @@ yarn-error.log*
.idea .idea
.vscode .vscode
.helix .helix
src/wasm-lib/.idea
src/wasm-lib/.vscode
# rust # rust
src/wasm-lib/target rust/target
src/wasm-lib/bindings rust/kcl-lib/bindings
src/wasm-lib/kcl/bindings public/kcl_wasm_lib_bg.wasm
public/wasm_lib_bg.wasm rust/lcov.info
src/wasm-lib/lcov.info rust/kcl-wasm-lib/pkg
src/wasm-lib/grackle/test_json_output *.snap.new
rust/kcl-lib/fuzz/Cargo.lock
e2e/playwright/playwright-secrets.env e2e/playwright/playwright-secrets.env
e2e/playwright/temp1.png e2e/playwright/temp1.png
@ -59,16 +58,18 @@ e2e/playwright/export-snapshots/*
## generated files ## generated files
src/**/*.typegen.ts src/**/*.typegen.ts
src/wasm-lib/grackle/stdlib_cube_partial.json
Mac_App_Distribution.provisionprofile Mac_App_Distribution.provisionprofile
*.tsbuildinfo *.tsbuildinfo
src/wasm-lib/pkg
.eslintcache .eslintcache
venv
.vite/ .vite/
# electron # electron
out/ out/
*.snap.new
# python
__pycache__/
uv.lock
rust/kcl-python-bindings/dist
venv

View File

@ -7,8 +7,7 @@ coverage
*.rs *.rs
*.hbs *.hbs
target target
src/wasm-lib/pkg rust/
src/wasm-lib/kcl/bindings
e2e/playwright/export-snapshots e2e/playwright/export-snapshots
e2e/playwright/snapshots/prompt-to-edit e2e/playwright/snapshots/prompt-to-edit

View File

@ -1,6 +1,6 @@
.PHONY: dev .PHONY: dev
WASM_LIB_FILES := $(wildcard src/wasm-lib/**/*.rs) KCL_WASM_LIB_FILES := $(wildcard rust/**/*.rs)
TS_SRC := $(wildcard src/**/*.tsx) $(wildcard src/**/*.ts) TS_SRC := $(wildcard src/**/*.tsx) $(wildcard src/**/*.ts)
XSTATE_TYPEGENS := $(wildcard src/machines/*.typegen.ts) XSTATE_TYPEGENS := $(wildcard src/machines/*.typegen.ts)
@ -18,7 +18,7 @@ lee-electron-test:
$(XSTATE_TYPEGENS): $(TS_SRC) $(XSTATE_TYPEGENS): $(TS_SRC)
yarn xstate typegen 'src/**/*.ts?(x)' yarn xstate typegen 'src/**/*.ts?(x)'
public/wasm_lib_bg.wasm: $(WASM_LIB_FILES) public/kcl_wasm_lib_bg.wasm: $(KCL_WASM_LIB_FILES)
yarn build:wasm yarn build:wasm
node_modules: package.json yarn.lock node_modules: package.json yarn.lock

View File

@ -228,7 +228,7 @@ $ cargo install cargo-fuzz
``` ```
```bash ```bash
$ cd src/wasm-lib/kcl $ cd rust/kcl-lib
# list the fuzz targets # list the fuzz targets
$ cargo fuzz list $ cargo fuzz list
@ -385,7 +385,7 @@ Use the production zoo.dev token, set this environment variable before running t
#### Installing cargonextest #### Installing cargonextest
``` ```
cd src/wasm-lib cd rust
cargo search cargo-nextest cargo search cargo-nextest
cargo install cargo-nextest cargo install cargo-nextest
``` ```
@ -401,7 +401,7 @@ install [`just`](https://github.com/casey/just?tab=readme-ov-file#pre-built-bina
# Make sure KITTYCAD_API_TOKEN=<prod zoo.dev token> is set # Make sure KITTYCAD_API_TOKEN=<prod zoo.dev token> is set
# Make sure you installed cargo-nextest # Make sure you installed cargo-nextest
# Make sure you installed just # Make sure you installed just
cd src/wasm-lib cd rust
just test just test
``` ```
@ -409,7 +409,7 @@ just test
# Without just # Without just
# Make sure KITTYCAD_API_TOKEN=<prod zoo.dev token> is set # Make sure KITTYCAD_API_TOKEN=<prod zoo.dev token> is set
# Make sure you installed cargo-nextest # Make sure you installed cargo-nextest
cd src/wasm-lib cd rust
export RUST_BRACKTRACE="full" && cargo nextest run --workspace --test-threads=1 export RUST_BRACKTRACE="full" && cargo nextest run --workspace --test-threads=1
``` ```
@ -418,7 +418,7 @@ Where `XXX` is an API token from the production engine (NOT the dev environment)
We recommend using [nextest](https://nexte.st/) to run the Rust tests (its faster and is used in CI). Once installed, run the tests using We recommend using [nextest](https://nexte.st/) to run the Rust tests (its faster and is used in CI). Once installed, run the tests using
``` ```
cd src/wasm-lib cd rust
KITTYCAD_API_TOKEN=XXX cargo run nextest KITTYCAD_API_TOKEN=XXX cargo run nextest
``` ```
@ -499,7 +499,7 @@ PS: for the debug panel, the following JSON is useful for snapping the camera
## KCL ## KCL
For how to contribute to KCL, [see our KCL README](https://github.com/KittyCAD/modeling-app/tree/main/src/wasm-lib/kcl). For how to contribute to KCL, [see our KCL README](https://github.com/KittyCAD/modeling-app/tree/main/rust/kcl-lib).
### Logging ### Logging

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -107,7 +107,7 @@ test.describe('when using the file tree to', () => {
// File the main.kcl with contents // File the main.kcl with contents
const kclCube = await fsp.readFile( const kclCube = await fsp.readFile(
'src/wasm-lib/tests/executor/inputs/cube.kcl', 'rust/kcl-lib/e2e/executor/inputs/cube.kcl',
'utf-8' 'utf-8'
) )
await pasteCodeInEditor(kclCube) await pasteCodeInEditor(kclCube)
@ -245,7 +245,7 @@ test.describe('when using the file tree to', () => {
await createProject({ name: 'project-000', page }) await createProject({ name: 'project-000', page })
// File the main.kcl with contents // File the main.kcl with contents
const kclCube = await fsp.readFile( const kclCube = await fsp.readFile(
'src/wasm-lib/tests/executor/inputs/cube.kcl', 'rust/kcl-lib/e2e/executor/inputs/cube.kcl',
'utf-8' 'utf-8'
) )
await pasteCodeInEditor(kclCube) await pasteCodeInEditor(kclCube)
@ -283,7 +283,7 @@ test.describe('when using the file tree to', () => {
// Create a small file // Create a small file
const kclCube = await fsp.readFile( const kclCube = await fsp.readFile(
'src/wasm-lib/tests/executor/inputs/cube.kcl', 'rust/kcl-lib/e2e/executor/inputs/cube.kcl',
'utf-8' 'utf-8'
) )
// pasted into main.kcl // pasted into main.kcl
@ -297,7 +297,7 @@ test.describe('when using the file tree to', () => {
await expect(legoFile).toBeVisible({ timeout: 60_000 }) await expect(legoFile).toBeVisible({ timeout: 60_000 })
await legoFile.click() await legoFile.click()
const kclLego = await fsp.readFile( const kclLego = await fsp.readFile(
'src/wasm-lib/tests/executor/inputs/lego.kcl', 'rust/kcl-lib/e2e/executor/inputs/lego.kcl',
'utf-8' 'utf-8'
) )
await pasteCodeInEditor(kclLego) await pasteCodeInEditor(kclLego)

View File

@ -45,7 +45,7 @@ export class AuthenticatedApp {
} }
getInputFile = (fileName: string) => { getInputFile = (fileName: string) => {
return fsp.readFile( return fsp.readFile(
join('src', 'wasm-lib', 'tests', 'executor', 'inputs', fileName), join('rust', 'kcl-lib', 'e2e', 'executor', 'inputs', fileName),
'utf-8' 'utf-8'
) )
} }

View File

@ -22,7 +22,7 @@ test.describe('Point-and-click tests', () => {
path.resolve( path.resolve(
__dirname, __dirname,
'../../', '../../',
'./src/wasm-lib/tests/executor/inputs/test-circle-extrude.kcl' './rust/kcl-lib/e2e/executor/inputs/test-circle-extrude.kcl'
), ),
'utf-8' 'utf-8'
) )
@ -191,7 +191,7 @@ test.describe('Point-and-click tests', () => {
path.resolve( path.resolve(
__dirname, __dirname,
'../../', '../../',
'./src/wasm-lib/tests/executor/inputs/e2e-can-sketch-on-chamfer.kcl' './rust/kcl-lib/e2e/executor/inputs/e2e-can-sketch-on-chamfer.kcl'
), ),
'utf-8' 'utf-8'
) )
@ -379,7 +379,7 @@ profile001 = startProfileAt([205.96, 254.59], sketch002)
path.resolve( path.resolve(
__dirname, __dirname,
'../../', '../../',
'./src/wasm-lib/tests/executor/inputs/e2e-can-sketch-on-chamfer-no-pipeExpr.kcl' './rust/kcl-lib/e2e/executor/inputs/e2e-can-sketch-on-chamfer-no-pipeExpr.kcl'
), ),
'utf-8' 'utf-8'
) )

View File

@ -556,7 +556,7 @@ test(
await context.folderSetupFn(async (dir) => { await context.folderSetupFn(async (dir) => {
await fsp.mkdir(`${dir}/router-template-slate`, { recursive: true }) await fsp.mkdir(`${dir}/router-template-slate`, { recursive: true })
await fsp.copyFile( await fsp.copyFile(
'src/wasm-lib/tests/executor/inputs/router-template-slate.kcl', 'rust/kcl-lib/e2e/executor/inputs/router-template-slate.kcl',
`${dir}/router-template-slate/main.kcl` `${dir}/router-template-slate/main.kcl`
) )
const _1975 = new Date('1975-01-01T00:01:11') const _1975 = new Date('1975-01-01T00:01:11')
@ -564,7 +564,7 @@ test(
await fsp.mkdir(`${dir}/bracket`, { recursive: true }) await fsp.mkdir(`${dir}/bracket`, { recursive: true })
await fsp.copyFile( await fsp.copyFile(
'src/wasm-lib/tests/executor/inputs/focusrite_scarlett_mounting_braket.kcl', 'rust/kcl-lib/e2e/executor/inputs/focusrite_scarlett_mounting_braket.kcl',
`${dir}/bracket/main.kcl` `${dir}/bracket/main.kcl`
) )
const _1985 = new Date('1985-01-01T00:02:22') const _1985 = new Date('1985-01-01T00:02:22')
@ -573,7 +573,7 @@ test(
await new Promise((r) => setTimeout(r, 1_000)) await new Promise((r) => setTimeout(r, 1_000))
await fsp.mkdir(`${dir}/lego`, { recursive: true }) await fsp.mkdir(`${dir}/lego`, { recursive: true })
await fsp.copyFile( await fsp.copyFile(
'src/wasm-lib/tests/executor/inputs/lego.kcl', 'rust/kcl-lib/e2e/executor/inputs/lego.kcl',
`${dir}/lego/main.kcl` `${dir}/lego/main.kcl`
) )
const _1995 = new Date('1995-01-01T00:03:33') const _1995 = new Date('1995-01-01T00:03:33')
@ -755,7 +755,7 @@ test(
await context.folderSetupFn(async (dir) => { await context.folderSetupFn(async (dir) => {
await fsp.mkdir(`${dir}/router-template-slate`, { recursive: true }) await fsp.mkdir(`${dir}/router-template-slate`, { recursive: true })
await fsp.copyFile( await fsp.copyFile(
'src/wasm-lib/tests/executor/inputs/router-template-slate.kcl', 'rust/kcl-lib/e2e/executor/inputs/router-template-slate.kcl',
`${dir}/router-template-slate/main.kcl` `${dir}/router-template-slate/main.kcl`
) )
}) })
@ -785,7 +785,7 @@ test.describe(`Project management commands`, () => {
await context.folderSetupFn(async (dir) => { await context.folderSetupFn(async (dir) => {
await fsp.mkdir(`${dir}/${projectName}`, { recursive: true }) await fsp.mkdir(`${dir}/${projectName}`, { recursive: true })
await fsp.copyFile( await fsp.copyFile(
'src/wasm-lib/tests/executor/inputs/router-template-slate.kcl', 'rust/kcl-lib/e2e/executor/inputs/router-template-slate.kcl',
`${dir}/${projectName}/main.kcl` `${dir}/${projectName}/main.kcl`
) )
}) })
@ -846,7 +846,7 @@ test.describe(`Project management commands`, () => {
await context.folderSetupFn(async (dir) => { await context.folderSetupFn(async (dir) => {
await fsp.mkdir(`${dir}/${projectName}`, { recursive: true }) await fsp.mkdir(`${dir}/${projectName}`, { recursive: true })
await fsp.copyFile( await fsp.copyFile(
'src/wasm-lib/tests/executor/inputs/router-template-slate.kcl', 'rust/kcl-lib/e2e/executor/inputs/router-template-slate.kcl',
`${dir}/${projectName}/main.kcl` `${dir}/${projectName}/main.kcl`
) )
}) })
@ -897,7 +897,7 @@ test.describe(`Project management commands`, () => {
await context.folderSetupFn(async (dir) => { await context.folderSetupFn(async (dir) => {
await fsp.mkdir(`${dir}/${projectName}`, { recursive: true }) await fsp.mkdir(`${dir}/${projectName}`, { recursive: true })
await fsp.copyFile( await fsp.copyFile(
'src/wasm-lib/tests/executor/inputs/router-template-slate.kcl', 'rust/kcl-lib/e2e/executor/inputs/router-template-slate.kcl',
`${dir}/${projectName}/main.kcl` `${dir}/${projectName}/main.kcl`
) )
}) })
@ -952,7 +952,7 @@ test.describe(`Project management commands`, () => {
await context.folderSetupFn(async (dir) => { await context.folderSetupFn(async (dir) => {
await fsp.mkdir(`${dir}/${projectName}`, { recursive: true }) await fsp.mkdir(`${dir}/${projectName}`, { recursive: true })
await fsp.copyFile( await fsp.copyFile(
'src/wasm-lib/tests/executor/inputs/router-template-slate.kcl', 'rust/kcl-lib/e2e/executor/inputs/router-template-slate.kcl',
`${dir}/${projectName}/main.kcl` `${dir}/${projectName}/main.kcl`
) )
}) })
@ -1123,11 +1123,11 @@ test(
await context.folderSetupFn(async (dir) => { await context.folderSetupFn(async (dir) => {
await fsp.mkdir(`${dir}/${projectName}`, { recursive: true }) await fsp.mkdir(`${dir}/${projectName}`, { recursive: true })
await fsp.copyFile( await fsp.copyFile(
'src/wasm-lib/tests/executor/inputs/router-template-slate.kcl', 'rust/kcl-lib/e2e/executor/inputs/router-template-slate.kcl',
`${dir}/${projectName}/main.kcl` `${dir}/${projectName}/main.kcl`
) )
await fsp.copyFile( await fsp.copyFile(
'src/wasm-lib/tests/executor/inputs/focusrite_scarlett_mounting_braket.kcl', 'rust/kcl-lib/e2e/executor/inputs/focusrite_scarlett_mounting_braket.kcl',
`${dir}/${projectName}/otherThingToClickOn.kcl` `${dir}/${projectName}/otherThingToClickOn.kcl`
) )
}) })
@ -1540,9 +1540,9 @@ test(
}) })
await fsp.copyFile( await fsp.copyFile(
path.join( path.join(
'src', 'rust',
'wasm-lib', 'kcl-lib',
'tests', 'e2e',
'executor', 'executor',
'inputs', 'inputs',
'router-template-slate.kcl' 'router-template-slate.kcl'
@ -1552,9 +1552,9 @@ test(
await fsp.mkdir(path.join(dir, 'bracket'), { recursive: true }) await fsp.mkdir(path.join(dir, 'bracket'), { recursive: true })
await fsp.copyFile( await fsp.copyFile(
path.join( path.join(
'src', 'rust',
'wasm-lib', 'kcl-lib',
'tests', 'e2e',
'executor', 'executor',
'inputs', 'inputs',
'focusrite_scarlett_mounting_braket.kcl' 'focusrite_scarlett_mounting_braket.kcl'
@ -1673,11 +1673,11 @@ test(
]) ])
await Promise.all([ await Promise.all([
fsp.copyFile( fsp.copyFile(
'src/wasm-lib/tests/executor/inputs/router-template-slate.kcl', 'rust/kcl-lib/e2e/executor/inputs/router-template-slate.kcl',
`${dir}/router-template-slate/main.kcl` `${dir}/router-template-slate/main.kcl`
), ),
fsp.copyFile( fsp.copyFile(
'src/wasm-lib/tests/executor/inputs/focusrite_scarlett_mounting_braket.kcl', 'rust/kcl-lib/e2e/executor/inputs/focusrite_scarlett_mounting_braket.kcl',
`${dir}/bracket/main.kcl` `${dir}/bracket/main.kcl`
), ),
]) ])
@ -1928,7 +1928,7 @@ test(
{ tag: '@electron' }, { tag: '@electron' },
async ({ context, page }, testInfo) => { async ({ context, page }, testInfo) => {
await context.folderSetupFn(async (dir) => { await context.folderSetupFn(async (dir) => {
// src/wasm-lib/tests/executor/inputs/mike_stress_test.kcl // rust/kcl-lib/e2e/executor/inputs/mike_stress_test.kcl
const name = 'mike_stress_test' const name = 'mike_stress_test'
const testDir = path.join(dir, name) const testDir = path.join(dir, name)
await fsp.mkdir(testDir, { recursive: true }) await fsp.mkdir(testDir, { recursive: true })

View File

@ -20,7 +20,8 @@ test.describe('Regression tests', { tag: ['@skipWin'] }, () => {
localStorage.setItem( localStorage.setItem(
'persistCode', 'persistCode',
`sketch2 = startSketchOn("XY") `sketch2 = startSketchOn("XY")
sketch001 = startSketchAt([-0, -0]) sketch001 = startSketchOn("XY")
|> startProfileAt([-0, -0], %)
|> line(end = [0, 0]) |> line(end = [0, 0])
|> line(end = [-4.84, -5.29]) |> line(end = [-4.84, -5.29])
|> line(endAbsolute = [profileStartX(%), profileStartY(%)]) |> line(endAbsolute = [profileStartX(%), profileStartY(%)])

View File

@ -1243,7 +1243,7 @@ test.describe('Sketch mode should be toleratant to syntax errors', () => {
path.resolve( path.resolve(
__dirname, __dirname,
'../../', '../../',
'./src/wasm-lib/tests/executor/inputs/e2e-can-sketch-on-chamfer.kcl' './rust/kcl-lib/e2e/executor/inputs/e2e-can-sketch-on-chamfer.kcl'
), ),
'utf-8' 'utf-8'
) )

Binary file not shown.

Before

Width:  |  Height:  |  Size: 55 KiB

After

Width:  |  Height:  |  Size: 56 KiB

View File

@ -1113,7 +1113,7 @@ export async function createProject({
} }
export function executorInputPath(fileName: string): string { export function executorInputPath(fileName: string): string {
return path.join('src', 'wasm-lib', 'tests', 'executor', 'inputs', fileName) return path.join('rust', 'kcl-lib', 'e2e', 'executor', 'inputs', fileName)
} }
export async function doAndWaitForImageDiff( export async function doAndWaitForImageDiff(

View File

@ -82,7 +82,7 @@
"build:both": "vite build", "build:both": "vite build",
"build:both:local": "yarn build:wasm && vite build", "build:both:local": "yarn build:wasm && vite build",
"pretest": "yarn remove-importmeta", "pretest": "yarn remove-importmeta",
"test:rust": "(cd src/wasm-lib && cargo test --workspace && cargo clippy --workspace --all-targets)", "test:rust": "(cd rust && just test && just lint)",
"simpleserver": "yarn pretest && http-server ./public --cors -p 3000", "simpleserver": "yarn pretest && http-server ./public --cors -p 3000",
"simpleserver:ci": "yarn pretest && http-server ./public --cors -p 3000 &", "simpleserver:ci": "yarn pretest && http-server ./public --cors -p 3000 &",
"simpleserver:bg": "yarn pretest && http-server ./public --cors -p 3000 &", "simpleserver:bg": "yarn pretest && http-server ./public --cors -p 3000 &",
@ -92,12 +92,12 @@
"fetch:wasm": "./scripts/get-latest-wasm-bundle.sh", "fetch:wasm": "./scripts/get-latest-wasm-bundle.sh",
"fetch:wasm:windows": "./scripts/get-latest-wasm-bundle.ps1", "fetch:wasm:windows": "./scripts/get-latest-wasm-bundle.ps1",
"fetch:samples": "echo \"Fetching latest KCL samples...\" && curl -o public/kcl-samples-manifest-fallback.json https://raw.githubusercontent.com/KittyCAD/kcl-samples/next/manifest.json", "fetch:samples": "echo \"Fetching latest KCL samples...\" && curl -o public/kcl-samples-manifest-fallback.json https://raw.githubusercontent.com/KittyCAD/kcl-samples/next/manifest.json",
"build:wasm-dev": "yarn wasm-prep && (cd src/wasm-lib && wasm-pack build --dev --target web --out-dir pkg && cargo test -p kcl-lib export_bindings) && yarn isomorphic-copy-wasm && yarn fmt", "build:wasm-dev": "yarn wasm-prep && (cd rust && wasm-pack build kcl-wasm-lib --dev --target web --out-dir pkg && cargo test -p kcl-lib export_bindings) && yarn isomorphic-copy-wasm && yarn fmt",
"build:wasm:nocopy": "yarn wasm-prep && cd src/wasm-lib && wasm-pack build --release --target web --out-dir pkg && cargo test -p kcl-lib export_bindings", "build:wasm:nocopy": "yarn wasm-prep && cd rust && wasm-pack build kcl-wasm-lib --release --target web --out-dir pkg && cargo test -p kcl-lib export_bindings",
"build:wasm": "yarn build:wasm:nocopy && cp src/wasm-lib/pkg/wasm_lib_bg.wasm public && yarn fmt", "build:wasm": "yarn build:wasm:nocopy && cp rust/kcl-wasm-lib/pkg/kcl_wasm_lib_bg.wasm public && yarn fmt",
"build:wasm:windows": "yarn install:wasm-pack:cargo && yarn build:wasm:nocopy && ./scripts/copy-wasm.ps1 && yarn fmt", "build:wasm:windows": "yarn install:wasm-pack:cargo && yarn build:wasm:nocopy && ./scripts/copy-wasm.ps1 && yarn fmt",
"remove-importmeta": "sed -i 's/import.meta.url/window.location.origin/g' \"./src/wasm-lib/pkg/wasm_lib.js\"; sed -i '' 's/import.meta.url/window.location.origin/g' \"./src/wasm-lib/pkg/wasm_lib.js\" || echo \"sed for both mac and linux\"", "remove-importmeta": "sed -i 's/import.meta.url/window.location.origin/g' \"./rust/kcl-wasm-lib/pkg/kcl_wasm_lib.js\"; sed -i '' 's/import.meta.url/window.location.origin/g' \"./rust/kcl-wasm-lib/pkg/kcl_wasm_lib.js\" || echo \"sed for both mac and linux\"",
"wasm-prep": "rimraf src/wasm-lib/pkg && mkdirp src/wasm-lib/pkg && rimraf src/wasm-lib/kcl/bindings", "wasm-prep": "rimraf rust/kcl-wasm-lib/pkg && mkdirp rust/kcl-wasm-lib/pkg && rimraf rust/kcl-lib/bindings",
"lint-fix": "eslint --fix --ext .ts --ext .tsx src e2e packages/codemirror-lsp-client/src", "lint-fix": "eslint --fix --ext .ts --ext .tsx src e2e packages/codemirror-lsp-client/src",
"lint": "eslint --max-warnings 0 --ext .ts --ext .tsx src e2e packages/codemirror-lsp-client/src", "lint": "eslint --max-warnings 0 --ext .ts --ext .tsx src e2e packages/codemirror-lsp-client/src",
"files:set-version": "echo \"$(jq --arg v \"$VERSION\" '.version=$v' package.json --indent 2)\" > package.json", "files:set-version": "echo \"$(jq --arg v \"$VERSION\" '.version=$v' package.json --indent 2)\" > package.json",

View File

@ -191,12 +191,6 @@ dependencies = [
"syn 2.0.96", "syn 2.0.96",
] ]
[[package]]
name = "atomic-waker"
version = "1.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0"
[[package]] [[package]]
name = "auto_impl" name = "auto_impl"
version = "1.2.1" version = "1.2.1"
@ -696,7 +690,7 @@ dependencies = [
"hashbrown 0.14.5", "hashbrown 0.14.5",
"lock_api", "lock_api",
"once_cell", "once_cell",
"parking_lot_core 0.9.10", "parking_lot_core",
] ]
[[package]] [[package]]
@ -710,7 +704,7 @@ dependencies = [
"hashbrown 0.14.5", "hashbrown 0.14.5",
"lock_api", "lock_api",
"once_cell", "once_cell",
"parking_lot_core 0.9.10", "parking_lot_core",
] ]
[[package]] [[package]]
@ -728,25 +722,6 @@ dependencies = [
"powerfmt", "powerfmt",
] ]
[[package]]
name = "derive-docs"
version = "0.1.45"
dependencies = [
"Inflector",
"anyhow",
"convert_case",
"expectorate",
"once_cell",
"pretty_assertions",
"proc-macro2",
"quote",
"regex",
"rustfmt-wrapper",
"serde",
"serde_tokenstream",
"syn 2.0.96",
]
[[package]] [[package]]
name = "derive_arbitrary" name = "derive_arbitrary"
version = "1.4.1" version = "1.4.1"
@ -798,7 +773,7 @@ dependencies = [
"backtrace", "backtrace",
"lazy_static", "lazy_static",
"mintex", "mintex",
"parking_lot 0.12.3", "parking_lot",
"rustc-hash 1.1.0", "rustc-hash 1.1.0",
"serde", "serde",
"serde_json", "serde_json",
@ -1108,12 +1083,6 @@ version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "60884563ea313b5037683cd5d44f1e14e9cb07b08543756242a65887f9cff48e" checksum = "60884563ea313b5037683cd5d44f1e14e9cb07b08543756242a65887f9cff48e"
[[package]]
name = "glob"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a8d1add55171497b4705a648c6b583acafb01d58050a51727785f0b2c8e0a2b2"
[[package]] [[package]]
name = "gloo-utils" name = "gloo-utils"
version = "0.2.0" version = "0.2.0"
@ -1151,25 +1120,6 @@ dependencies = [
"serde_json", "serde_json",
] ]
[[package]]
name = "h2"
version = "0.4.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ccae279728d634d083c00f6099cb58f01cc99c145b84b8be2f6c74618d79922e"
dependencies = [
"atomic-waker",
"bytes",
"fnv",
"futures-core",
"futures-sink",
"http 1.2.0",
"indexmap 2.7.1",
"slab",
"tokio",
"tokio-util",
"tracing",
]
[[package]] [[package]]
name = "half" name = "half"
version = "2.4.1" version = "2.4.1"
@ -1347,7 +1297,6 @@ dependencies = [
"bytes", "bytes",
"futures-channel", "futures-channel",
"futures-util", "futures-util",
"h2",
"http 1.2.0", "http 1.2.0",
"http-body 1.0.1", "http-body 1.0.1",
"httparse", "httparse",
@ -1638,18 +1587,6 @@ dependencies = [
"similar", "similar",
] ]
[[package]]
name = "instant"
version = "0.1.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e0242819d153cba4b4b05a5a8f2a7e9bbf97b6055b2a002b395c96b5ff3c0222"
dependencies = [
"cfg-if",
"js-sys",
"wasm-bindgen",
"web-sys",
]
[[package]] [[package]]
name = "ipnet" name = "ipnet"
version = "2.11.0" version = "2.11.0"
@ -1722,6 +1659,25 @@ dependencies = [
"wasm-bindgen", "wasm-bindgen",
] ]
[[package]]
name = "kcl-derive-docs"
version = "0.1.45"
dependencies = [
"Inflector",
"anyhow",
"convert_case",
"expectorate",
"once_cell",
"pretty_assertions",
"proc-macro2",
"quote",
"regex",
"rustfmt-wrapper",
"serde",
"serde_tokenstream",
"syn 2.0.96",
]
[[package]] [[package]]
name = "kcl-lib" name = "kcl-lib"
version = "0.2.45" version = "0.2.45"
@ -1737,7 +1693,6 @@ dependencies = [
"convert_case", "convert_case",
"criterion", "criterion",
"dashmap 6.1.0", "dashmap 6.1.0",
"derive-docs",
"dhat", "dhat",
"expectorate", "expectorate",
"fnv", "fnv",
@ -1752,6 +1707,7 @@ dependencies = [
"insta", "insta",
"itertools 0.13.0", "itertools 0.13.0",
"js-sys", "js-sys",
"kcl-derive-docs",
"kittycad", "kittycad",
"kittycad-modeling-cmds", "kittycad-modeling-cmds",
"lazy_static", "lazy_static",
@ -1778,7 +1734,6 @@ dependencies = [
"ts-rs", "ts-rs",
"twenty-twenty", "twenty-twenty",
"url", "url",
"urlencoding",
"uuid", "uuid",
"validator", "validator",
"wasm-bindgen", "wasm-bindgen",
@ -1789,6 +1744,21 @@ dependencies = [
"zip", "zip",
] ]
[[package]]
name = "kcl-python-bindings"
version = "0.3.45"
dependencies = [
"anyhow",
"kcl-lib",
"kittycad-modeling-cmds",
"miette",
"pyo3",
"serde",
"serde_json",
"tokio",
"uuid",
]
[[package]] [[package]]
name = "kcl-test-server" name = "kcl-test-server"
version = "0.1.45" version = "0.1.45"
@ -1816,6 +1786,30 @@ dependencies = [
"uuid", "uuid",
] ]
[[package]]
name = "kcl-wasm-lib"
version = "0.1.0"
dependencies = [
"bson",
"console_error_panic_hook",
"data-encoding",
"futures",
"getrandom 0.2.15",
"gloo-utils",
"js-sys",
"kcl-lib",
"kittycad",
"serde_json",
"tokio",
"toml",
"tower-lsp",
"uuid",
"wasm-bindgen",
"wasm-bindgen-futures",
"wasm-streams",
"web-sys",
]
[[package]] [[package]]
name = "kittycad" name = "kittycad"
version = "0.3.28" version = "0.3.28"
@ -1840,10 +1834,6 @@ dependencies = [
"phonenumber", "phonenumber",
"rand 0.8.5", "rand 0.8.5",
"reqwest", "reqwest",
"reqwest-conditional-middleware",
"reqwest-middleware",
"reqwest-retry",
"reqwest-tracing",
"schemars", "schemars",
"serde", "serde",
"serde_bytes", "serde_bytes",
@ -1858,9 +1848,9 @@ dependencies = [
[[package]] [[package]]
name = "kittycad-modeling-cmds" name = "kittycad-modeling-cmds"
version = "0.2.99" version = "0.2.100"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "828a0c74476533e6258ea7dd70cfc7d63a5df4b37753d30ef198e0689eaac4eb" checksum = "fb5a824cb9bb4c602962ecbaca5ce71225938aa1abc24103bf46c222f468dd26"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"chrono", "chrono",
@ -1994,12 +1984,6 @@ dependencies = [
"url", "url",
] ]
[[package]]
name = "matchit"
version = "0.8.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2f926ade0c4e170215ae43342bf13b9310a437609c81f29f86c5df6657582ef9"
[[package]] [[package]]
name = "measurements" name = "measurements"
version = "0.11.0" version = "0.11.0"
@ -2220,38 +2204,6 @@ version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d05e27ee213611ffe7d6348b942e8f942b37114c00cc03cec254295a4a17852e" checksum = "d05e27ee213611ffe7d6348b942e8f942b37114c00cc03cec254295a4a17852e"
[[package]]
name = "opentelemetry"
version = "0.24.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4c365a63eec4f55b7efeceb724f1336f26a9cf3427b70e59e2cd2a5b947fba96"
dependencies = [
"futures-core",
"futures-sink",
"js-sys",
"once_cell",
"pin-project-lite",
"thiserror 1.0.69",
]
[[package]]
name = "opentelemetry_sdk"
version = "0.24.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "692eac490ec80f24a17828d49b40b60f5aeaccdfe6a503f939713afd22bc28df"
dependencies = [
"async-trait",
"futures-channel",
"futures-executor",
"futures-util",
"glob",
"once_cell",
"opentelemetry",
"percent-encoding",
"rand 0.8.5",
"thiserror 1.0.69",
]
[[package]] [[package]]
name = "owo-colors" name = "owo-colors"
version = "4.1.0" version = "4.1.0"
@ -2269,17 +2221,6 @@ dependencies = [
"unicode-width 0.1.14", "unicode-width 0.1.14",
] ]
[[package]]
name = "parking_lot"
version = "0.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99"
dependencies = [
"instant",
"lock_api",
"parking_lot_core 0.8.6",
]
[[package]] [[package]]
name = "parking_lot" name = "parking_lot"
version = "0.12.3" version = "0.12.3"
@ -2287,21 +2228,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27" checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27"
dependencies = [ dependencies = [
"lock_api", "lock_api",
"parking_lot_core 0.9.10", "parking_lot_core",
]
[[package]]
name = "parking_lot_core"
version = "0.8.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "60a2cfe6f0ad2bfc16aefa463b497d5c7a5ecd44a23efa72aa342d90177356dc"
dependencies = [
"cfg-if",
"instant",
"libc",
"redox_syscall 0.2.16",
"smallvec",
"winapi",
] ]
[[package]] [[package]]
@ -2312,7 +2239,7 @@ checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"libc", "libc",
"redox_syscall 0.5.8", "redox_syscall",
"smallvec", "smallvec",
"windows-targets", "windows-targets",
] ]
@ -2618,6 +2545,7 @@ dependencies = [
"pyo3-build-config", "pyo3-build-config",
"pyo3-ffi", "pyo3-ffi",
"pyo3-macros", "pyo3-macros",
"serde",
"unindent", "unindent",
] ]
@ -2829,15 +2757,6 @@ dependencies = [
"rand_core 0.3.1", "rand_core 0.3.1",
] ]
[[package]]
name = "redox_syscall"
version = "0.2.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a"
dependencies = [
"bitflags 1.3.2",
]
[[package]] [[package]]
name = "redox_syscall" name = "redox_syscall"
version = "0.5.8" version = "0.5.8"
@ -2904,7 +2823,6 @@ dependencies = [
"bytes", "bytes",
"futures-core", "futures-core",
"futures-util", "futures-util",
"h2",
"http 1.2.0", "http 1.2.0",
"http-body 1.0.1", "http-body 1.0.1",
"http-body-util", "http-body-util",
@ -2941,82 +2859,6 @@ dependencies = [
"windows-registry", "windows-registry",
] ]
[[package]]
name = "reqwest-conditional-middleware"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f67ad7fdf5c0a015763fcd164bee294b13fb7b6f89f1b55961d40f00c3e32d6b"
dependencies = [
"async-trait",
"http 1.2.0",
"reqwest",
"reqwest-middleware",
]
[[package]]
name = "reqwest-middleware"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d1ccd3b55e711f91a9885a2fa6fbbb2e39db1776420b062efc058c6410f7e5e3"
dependencies = [
"anyhow",
"async-trait",
"http 1.2.0",
"reqwest",
"serde",
"thiserror 1.0.69",
"tower-service",
]
[[package]]
name = "reqwest-retry"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "29c73e4195a6bfbcb174b790d9b3407ab90646976c55de58a6515da25d851178"
dependencies = [
"anyhow",
"async-trait",
"futures",
"getrandom 0.2.15",
"http 1.2.0",
"hyper 1.5.2",
"parking_lot 0.11.2",
"reqwest",
"reqwest-middleware",
"retry-policies",
"thiserror 1.0.69",
"tokio",
"tracing",
"wasm-timer",
]
[[package]]
name = "reqwest-tracing"
version = "0.5.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "73e6153390585f6961341b50e5a1931d6be6dee4292283635903c26ef9d980d2"
dependencies = [
"anyhow",
"async-trait",
"getrandom 0.2.15",
"http 1.2.0",
"matchit",
"opentelemetry",
"reqwest",
"reqwest-middleware",
"tracing",
"tracing-opentelemetry",
]
[[package]]
name = "retry-policies"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5875471e6cab2871bc150ecb8c727db5113c9338cc3354dc5ee3425b6aa40a1c"
dependencies = [
"rand 0.8.5",
]
[[package]] [[package]]
name = "rgba_simple" name = "rgba_simple"
version = "0.10.0" version = "0.10.0"
@ -3374,15 +3216,6 @@ dependencies = [
"digest", "digest",
] ]
[[package]]
name = "sharded-slab"
version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6"
dependencies = [
"lazy_static",
]
[[package]] [[package]]
name = "shlex" name = "shlex"
version = "1.3.0" version = "1.3.0"
@ -3698,16 +3531,6 @@ version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3bf63baf9f5039dadc247375c29eb13706706cfde997d0330d05aa63a77d8820" checksum = "3bf63baf9f5039dadc247375c29eb13706706cfde997d0330d05aa63a77d8820"
[[package]]
name = "thread_local"
version = "1.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8b9ef9bad013ada3808854ceac7b46812a6465ba368859a37e2100283d2d719c"
dependencies = [
"cfg-if",
"once_cell",
]
[[package]] [[package]]
name = "time" name = "time"
version = "0.3.37" version = "0.3.37"
@ -3784,7 +3607,7 @@ dependencies = [
"bytes", "bytes",
"libc", "libc",
"mio", "mio",
"parking_lot 0.12.3", "parking_lot",
"pin-project-lite", "pin-project-lite",
"signal-hook-registry", "signal-hook-registry",
"socket2", "socket2",
@ -3995,47 +3818,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e672c95779cf947c5311f83787af4fa8fffd12fb27e4993211a84bdfd9610f9c" checksum = "e672c95779cf947c5311f83787af4fa8fffd12fb27e4993211a84bdfd9610f9c"
dependencies = [ dependencies = [
"once_cell", "once_cell",
"valuable",
]
[[package]]
name = "tracing-log"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3"
dependencies = [
"log",
"once_cell",
"tracing-core",
]
[[package]]
name = "tracing-opentelemetry"
version = "0.25.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a9784ed4da7d921bc8df6963f8c80a0e4ce34ba6ba76668acadd3edbd985ff3b"
dependencies = [
"js-sys",
"once_cell",
"opentelemetry",
"opentelemetry_sdk",
"smallvec",
"tracing",
"tracing-core",
"tracing-log",
"tracing-subscriber",
"web-time",
]
[[package]]
name = "tracing-subscriber"
version = "0.3.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e8189decb5ac0fa7bc8b96b7cb9b2701d60d48805aca84a238004d665fcc4008"
dependencies = [
"sharded-slab",
"thread_local",
"tracing-core",
] ]
[[package]] [[package]]
@ -4176,12 +3958,6 @@ dependencies = [
"serde", "serde",
] ]
[[package]]
name = "urlencoding"
version = "2.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da"
[[package]] [[package]]
name = "utf-8" name = "utf-8"
version = "0.7.6" version = "0.7.6"
@ -4248,12 +4024,6 @@ dependencies = [
"syn 2.0.96", "syn 2.0.96",
] ]
[[package]]
name = "valuable"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65"
[[package]] [[package]]
name = "version_check" name = "version_check"
version = "0.9.5" version = "0.9.5"
@ -4366,37 +4136,6 @@ dependencies = [
"unicode-ident", "unicode-ident",
] ]
[[package]]
name = "wasm-lib"
version = "0.1.0"
dependencies = [
"anyhow",
"bson",
"console_error_panic_hook",
"data-encoding",
"futures",
"getrandom 0.2.15",
"gloo-utils",
"image",
"js-sys",
"kcl-lib",
"kittycad",
"kittycad-modeling-cmds",
"lazy_static",
"pretty_assertions",
"reqwest",
"serde_json",
"tokio",
"toml",
"tower-lsp",
"twenty-twenty",
"uuid",
"wasm-bindgen",
"wasm-bindgen-futures",
"wasm-streams",
"web-sys",
]
[[package]] [[package]]
name = "wasm-streams" name = "wasm-streams"
version = "0.4.2" version = "0.4.2"
@ -4410,21 +4149,6 @@ dependencies = [
"web-sys", "web-sys",
] ]
[[package]]
name = "wasm-timer"
version = "0.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "be0ecb0db480561e9a7642b5d3e4187c128914e58aa84330b9493e3eb68c5e7f"
dependencies = [
"futures",
"js-sys",
"parking_lot 0.11.2",
"pin-utils",
"wasm-bindgen",
"wasm-bindgen-futures",
"web-sys",
]
[[package]] [[package]]
name = "web-sys" name = "web-sys"
version = "0.3.77" version = "0.3.77"

50
rust/Cargo.toml Normal file
View File

@ -0,0 +1,50 @@
[workspace]
resolver = "2"
members = [
"kcl-derive-docs",
"kcl-lib",
"kcl-python-bindings",
"kcl-test-server",
"kcl-to-core",
"kcl-wasm-lib"
]
[profile.release]
panic = "abort"
debug = true
[profile.dev]
debug = 0
[profile.dev.package]
insta = { opt-level = 3 }
similar = { opt-level = 3 }
[profile.test]
debug = "line-tables-only"
[workspace.dependencies]
async-trait = "0.1.85"
anyhow = { version = "1" }
http = "1"
indexmap = "2.7.0"
kittycad = { version = "0.3.28", default-features = false, features = ["js", "requests"] }
kittycad-modeling-cmds = { version = "0.2.100", features = ["ts-rs", "websocket"] }
miette = "7.5.0"
pyo3 = { version = "0.22.6" }
serde = { version = "1", features = ["derive"] }
serde_json = { version = "1" }
tokio = { version = "1" }
tower-lsp = { version = "0.20.0", default-features = false }
uuid = { version = "1", features = ["v4", "serde"] }
[workspace.lints.clippy]
assertions_on_result_states = "warn"
dbg_macro = "warn"
iter_over_hash_type = "warn"
lossy_float_literal = "warn"
# Example: how to point modeling-app at a different repo (e.g. a branch or a local clone)
#[patch.crates-io]
#kittycad-modeling-cmds = { path = "../../../modeling-api/modeling-cmds" }
#kittycad-modeling-session = { path = "../../../modeling-api/modeling-session" }

View File

@ -17,17 +17,17 @@ redo-kcl-stdlib-docs:
# Copy a test KCL file from executor tests into a new simulation test. # Copy a test KCL file from executor tests into a new simulation test.
copy-exec-test-into-sim-test test_name: copy-exec-test-into-sim-test test_name:
mkdir -p kcl/tests/{{test_name}} mkdir -p kcl-lib/tests/{{test_name}}
cp tests/executor/inputs/{{test_name}}.kcl kcl/tests/{{test_name}}/input.kcl cp kcl-lib/e2e/executor/inputs/{{test_name}}.kcl kcl-lib/tests/{{test_name}}/input.kcl
zoo kcl fmt -w kcl/tests/{{test_name}}/input.kcl zoo kcl fmt -w kcl-lib/tests/{{test_name}}/input.kcl
just new-sim-test {{test_name}} just new-sim-test {{test_name}}
# Create a new, empty KCL deterministic simulation test case. # Create a new, empty KCL deterministic simulation test case.
new-sim-test test_name render_to_png="true": new-sim-test test_name render_to_png="true":
mkdir kcl/tests/{{test_name}} mkdir kcl-lib/tests/{{test_name}}
touch kcl/tests/{{test_name}}/input.kcl touch kcl-lib/tests/{{test_name}}/input.kcl
# Add the various tests for this new test case. # Add the various tests for this new test case.
cat kcl/tests/simtest.tmpl | sed "s/TEST_NAME_HERE/{{test_name}}/" | sed "s/RENDER_TO_PNG/{{render_to_png}}/" >> kcl/src/simulation_tests.rs cat kcl-lib/tests/simtest.tmpl | sed "s/TEST_NAME_HERE/{{test_name}}/" | sed "s/RENDER_TO_PNG/{{render_to_png}}/" >> kcl-lib/src/simulation_tests.rs
# Run a KCL deterministic simulation test case and accept output. # Run a KCL deterministic simulation test case and accept output.
run-sim-test test_name: run-sim-test test_name:
@ -45,8 +45,10 @@ test:
export RUST_BRACKTRACE="full" && cargo nextest run --workspace --no-fail-fast export RUST_BRACKTRACE="full" && cargo nextest run --workspace --no-fail-fast
publish-kcl version: publish-kcl version:
git tag {{version}} git tag kcl-{{version}}
git push --tags cargo publish -p kcl-derive-docs
cargo publish -p derive-docs
cargo publish -p kcl-lib cargo publish -p kcl-lib
cargo publish -p kcl-test-server cargo publish -p kcl-test-server
# We push the tag at the end of publish since pushing the tag
# will trigger CI to release the kcl python bindings.
git push origin kcl-{{version}}

View File

@ -1,5 +1,5 @@
[package] [package]
name = "derive-docs" name = "kcl-derive-docs"
description = "A tool for generating documentation from Rust derive macros" description = "A tool for generating documentation from Rust derive macros"
version = "0.1.45" version = "0.1.45"
edition = "2021" edition = "2021"
@ -18,12 +18,12 @@ once_cell = "1.20.2"
proc-macro2 = "1" proc-macro2 = "1"
quote = "1" quote = "1"
regex = "1.11" regex = "1.11"
serde = { version = "1.0.217", features = ["derive"] } serde = { workspace = true }
serde_tokenstream = "0.2" serde_tokenstream = "0.2"
syn = { version = "2.0.96", features = ["full"] } syn = { version = "2.0.96", features = ["full"] }
[dev-dependencies] [dev-dependencies]
anyhow = "1.0.95" anyhow = { workspace = true }
expectorate = "1.1.0" expectorate = "1.1.0"
pretty_assertions = "1.4.1" pretty_assertions = "1.4.1"
rustfmt-wrapper = "0.2.1" rustfmt-wrapper = "0.2.1"

View File

@ -11,9 +11,9 @@ keywords = ["kcl", "KittyCAD", "CAD"]
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies] [dependencies]
anyhow = { version = "1.0.95", features = ["backtrace"] } anyhow = { workspace = true, features = ["backtrace"] }
async-recursion = "1.1.1" async-recursion = "1.1.1"
async-trait = "0.1.85" async-trait = {workspace = true}
base64 = "0.22.1" base64 = "0.22.1"
chrono = "0.4.38" chrono = "0.4.38"
clap = { version = "4.5.27", default-features = false, optional = true, features = [ clap = { version = "4.5.27", default-features = false, optional = true, features = [
@ -22,7 +22,6 @@ clap = { version = "4.5.27", default-features = false, optional = true, features
] } ] }
convert_case = "0.6.0" convert_case = "0.6.0"
dashmap = "6.1.0" dashmap = "6.1.0"
derive-docs = { version = "0.1.44", path = "../derive-docs" }
dhat = { version = "0.3", optional = true } dhat = { version = "0.3", optional = true }
fnv = "1.0.7" fnv = "1.0.7"
form_urlencoded = "1.2.1" form_urlencoded = "1.2.1"
@ -31,16 +30,17 @@ git_rev = "0.1.0"
gltf-json = "1.4.1" gltf-json = "1.4.1"
http = { workspace = true } http = { workspace = true }
image = { version = "0.25.5", default-features = false, features = ["png"] } image = { version = "0.25.5", default-features = false, features = ["png"] }
indexmap = { version = "2.7.0", features = ["serde"] } indexmap = { workspace = true, features = ["serde"] }
itertools = "0.13.0" itertools = "0.13.0"
kcl-derive-docs = { version = "0.1.44", path = "../kcl-derive-docs" }
kittycad = { workspace = true } kittycad = { workspace = true }
kittycad-modeling-cmds = { workspace = true } kittycad-modeling-cmds = { workspace = true }
lazy_static = "1.5.0" lazy_static = "1.5.0"
measurements = "0.11.0" measurements = "0.11.0"
miette = "7.5.0" miette = { workspace = true }
mime_guess = "2.0.5" mime_guess = "2.0.5"
parse-display = "0.9.1" parse-display = "0.9.1"
pyo3 = { version = "0.22.6", optional = true } pyo3 = { workspace = true, optional = true }
regex = "1.11.1" regex = "1.11.1"
reqwest = { version = "0.12", default-features = false, features = [ reqwest = { version = "0.12", default-features = false, features = [
"stream", "stream",
@ -55,8 +55,8 @@ schemars = { version = "0.8.17", features = [
"uuid1", "uuid1",
"preserve_order", "preserve_order",
] } ] }
serde = { version = "1.0.217", features = ["derive"] } serde = { workspace = true }
serde_json = "1.0.138" serde_json = { workspace = true }
sha2 = "0.10.8" sha2 = "0.10.8"
tabled = { version = "0.15.0", optional = true } tabled = { version = "0.15.0", optional = true }
thiserror = "2.0.0" thiserror = "2.0.0"
@ -70,31 +70,27 @@ ts-rs = { version = "10.1.0", features = [
"serde-json-impl", "serde-json-impl",
] } ] }
url = { version = "2.5.4", features = ["serde"] } url = { version = "2.5.4", features = ["serde"] }
urlencoding = "2.1.3" uuid = { workspace = true, features = ["v4", "js", "serde"] }
uuid = { version = "1.11.0", features = ["v4", "js", "serde"] }
validator = { version = "0.20.0", features = ["derive"] } validator = { version = "0.20.0", features = ["derive"] }
web-time = "1.1" web-time = "1.1"
winnow = "0.6.22" winnow = "=0.6.24"
zip = { version = "2.2.2", default-features = false } zip = { version = "2.2.2", default-features = false }
[target.'cfg(target_arch = "wasm32")'.dependencies] [target.'cfg(target_arch = "wasm32")'.dependencies]
js-sys = { version = "0.3.72" } js-sys = { version = "0.3.72" }
tokio = { version = "1.41.1", features = ["sync", "time"] } tokio = { workspace = true, features = ["sync", "time"] }
tower-lsp = { version = "0.20.0", default-features = false, features = [ tower-lsp = { workspace = true, features = ["runtime-agnostic"] }
"runtime-agnostic",
] }
wasm-bindgen = "0.2.99" wasm-bindgen = "0.2.99"
wasm-bindgen-futures = "0.4.49" wasm-bindgen-futures = "0.4.49"
web-sys = { version = "0.3.76", features = ["console"] } web-sys = { version = "0.3.76", features = ["console"] }
[target.'cfg(not(target_arch = "wasm32"))'.dependencies] [target.'cfg(not(target_arch = "wasm32"))'.dependencies]
approx = "0.5"
bson = { version = "2.13.0", features = ["uuid-1", "chrono"] } bson = { version = "2.13.0", features = ["uuid-1", "chrono"] }
tokio = { version = "1.41.1", features = ["full"] } tokio = { workspace = true, features = ["full"] }
tokio-tungstenite = { version = "0.24.0", features = [ tokio-tungstenite = { version = "0.24.0", features = [
"rustls-tls-native-roots", "rustls-tls-native-roots",
] } ] }
tower-lsp = { version = "0.20.0", features = ["proposed"] } tower-lsp = { workspace = true, features = ["proposed", "default"] }
[features] [features]
default = ["engine"] default = ["engine"]
@ -110,6 +106,7 @@ lsp-test-util = []
tabled = ["dep:tabled"] tabled = ["dep:tabled"]
[dev-dependencies] [dev-dependencies]
approx = "0.5"
base64 = "0.22.1" base64 = "0.22.1"
criterion = { version = "0.5.1", features = ["async_tokio"] } criterion = { version = "0.5.1", features = ["async_tokio"] }
expectorate = "1.1.0" expectorate = "1.1.0"
@ -140,3 +137,11 @@ required-features = ["lsp-test-util"]
[[bench]] [[bench]]
name = "executor_benchmark_criterion" name = "executor_benchmark_criterion"
harness = false harness = false
[[test]]
name = "executor"
path = "e2e/executor/main.rs"
[[test]]
name = "modify"
path = "e2e/modify/main.rs"

View File

@ -1,4 +1,4 @@
# KCL # kcl-lib
Our language for defining geometry and working with our Geometry Engine efficiently. Short for KittyCAD Language, named after our Design API. Our language for defining geometry and working with our Geometry Engine efficiently. Short for KittyCAD Language, named after our Design API.
@ -6,14 +6,14 @@ Our language for defining geometry and working with our Geometry Engine efficien
We've built a lot of tooling to make contributing to KCL easier. If you are interested in contributing a new standard library function to KCL, here is the rough process: We've built a lot of tooling to make contributing to KCL easier. If you are interested in contributing a new standard library function to KCL, here is the rough process:
1. Open just the wasm-lib folder in your editor of choice. VS Code, for example, struggles to run rust-analyzer on the entire modeling-app directory because it's such a turducken of TS and Rust code. 1. Open just the folder in your editor of choice. VS Code, for example, struggles to run rust-analyzer on the entire modeling-app directory because it's such a turducken of TS and Rust code.
2. Find the definition for similar standard library functions in `./kcl/src/std` and place your new one near it or in the same category file. 2. Find the definition for similar standard library functions in `./kcl/src/std` and place your new one near it or in the same category file.
3. Add your new code. A new standard library function consists of: 3. Add your new code. A new standard library function consists of:
4. A `pub async` of the actual standard library function in Rust 4. A `pub async` of the actual standard library function in Rust
5. A doc comment block containing at least one example using your new standard library function (the Rust compiler will error if you don't provide an example our teammates are dope) 5. A doc comment block containing at least one example using your new standard library function (the Rust compiler will error if you don't provide an example our teammates are dope)
6. A `stdlib` macro providing the name that will need to be written by KCL users to use the function (this is usually a camelCase version of your Rust implementation, which is named with snake_case) 6. A `stdlib` macro providing the name that will need to be written by KCL users to use the function (this is usually a camelCase version of your Rust implementation, which is named with snake_case)
7. An inner function that is published only to the crate 7. An inner function that is published only to the crate
8. Add your new standard library function to [the long list of CORE_FNS in mod.rs](https://github.com/KittyCAD/modeling-app/blob/main/src/wasm-lib/kcl/src/std/mod.rs#L42) 8. Add your new standard library function to [the long list of CORE_FNS in mod.rs](https://github.com/KittyCAD/modeling-app/blob/main/rust/kcl-lib/src/std/mod.rs#L42)
9. Get a production Zoo dev token and run `export KITTYCAD_API_TOKEN=your-token-here` in a terminal 9. Get a production Zoo dev token and run `export KITTYCAD_API_TOKEN=your-token-here` in a terminal
10. Run `TWENTY_TWENTY=overwrite cargo nextest run --workspace --no-fail-fast` to take snapshot tests of your example code running in the engine 10. Run `TWENTY_TWENTY=overwrite cargo nextest run --workspace --no-fail-fast` to take snapshot tests of your example code running in the engine
11. Run `just redo-kcl-stdlib-docs` to generate new Markdown documentation for your function that will be used [to generate docs on our website](https://zoo.dev/docs/kcl). 11. Run `just redo-kcl-stdlib-docs` to generate new Markdown documentation for your function that will be used [to generate docs on our website](https://zoo.dev/docs/kcl).

View File

@ -20,9 +20,9 @@ pub fn bench_parse(c: &mut Criterion) {
criterion_group!(benches, bench_parse); criterion_group!(benches, bench_parse);
criterion_main!(benches); criterion_main!(benches);
const KITT_PROGRAM: &str = include_str!("../../tests/executor/inputs/kittycad_svg.kcl"); const KITT_PROGRAM: &str = include_str!("../e2e/executor/inputs/kittycad_svg.kcl");
const PIPES_PROGRAM: &str = include_str!("../../tests/executor/inputs/pipes_on_pipes.kcl"); const PIPES_PROGRAM: &str = include_str!("../e2e/executor/inputs/pipes_on_pipes.kcl");
const CUBE_PROGRAM: &str = include_str!("../../tests/executor/inputs/cube.kcl"); const CUBE_PROGRAM: &str = include_str!("../e2e/executor/inputs/cube.kcl");
const MATH_PROGRAM: &str = include_str!("../../tests/executor/inputs/math.kcl"); const MATH_PROGRAM: &str = include_str!("../e2e/executor/inputs/math.kcl");
const MIKE_STRESS_TEST_PROGRAM: &str = include_str!("../tests/mike_stress_test/input.kcl"); const MIKE_STRESS_TEST_PROGRAM: &str = include_str!("../tests/mike_stress_test/input.kcl");
const LSYSTEM_KOCH_SNOWFLAKE_PROGRAM: &str = include_str!("../../tests/executor/inputs/lsystem.kcl"); const LSYSTEM_KOCH_SNOWFLAKE_PROGRAM: &str = include_str!("../e2e/executor/inputs/lsystem.kcl");

View File

@ -24,9 +24,9 @@ pub fn bench_digest(c: &mut Criterion) {
criterion_group!(benches, bench_digest); criterion_group!(benches, bench_digest);
criterion_main!(benches); criterion_main!(benches);
const KITT_PROGRAM: &str = include_str!("../../tests/executor/inputs/kittycad_svg.kcl"); const KITT_PROGRAM: &str = include_str!("../e2e/executor/inputs/kittycad_svg.kcl");
const PIPES_PROGRAM: &str = include_str!("../../tests/executor/inputs/pipes_on_pipes.kcl"); const PIPES_PROGRAM: &str = include_str!("../e2e/executor/inputs/pipes_on_pipes.kcl");
const CUBE_PROGRAM: &str = include_str!("../../tests/executor/inputs/cube.kcl"); const CUBE_PROGRAM: &str = include_str!("../e2e/executor/inputs/cube.kcl");
const MATH_PROGRAM: &str = include_str!("../../tests/executor/inputs/math.kcl"); const MATH_PROGRAM: &str = include_str!("../e2e/executor/inputs/math.kcl");
const MIKE_STRESS_TEST_PROGRAM: &str = include_str!("../tests/mike_stress_test/input.kcl"); const MIKE_STRESS_TEST_PROGRAM: &str = include_str!("../tests/mike_stress_test/input.kcl");
const LSYSTEM_PROGRAM: &str = include_str!("../../tests/executor/inputs/lsystem.kcl"); const LSYSTEM_PROGRAM: &str = include_str!("../e2e/executor/inputs/lsystem.kcl");

View File

@ -48,9 +48,9 @@ pub fn bench_lego(c: &mut Criterion) {
criterion_group!(benches, bench_lego, bench_execute); criterion_group!(benches, bench_lego, bench_execute);
criterion_main!(benches); criterion_main!(benches);
const KITT_PROGRAM: &str = include_str!("../../tests/executor/inputs/kittycad_svg.kcl"); const KITT_PROGRAM: &str = include_str!("../e2e/executor/inputs/kittycad_svg.kcl");
const CUBE_PROGRAM: &str = include_str!("../../tests/executor/inputs/cube.kcl"); const CUBE_PROGRAM: &str = include_str!("../e2e/executor/inputs/cube.kcl");
const SERVER_RACK_HEAVY_PROGRAM: &str = include_str!("../../tests/executor/inputs/server-rack-heavy.kcl"); const SERVER_RACK_HEAVY_PROGRAM: &str = include_str!("../e2e/executor/inputs/server-rack-heavy.kcl");
const SERVER_RACK_LITE_PROGRAM: &str = include_str!("../../tests/executor/inputs/server-rack-lite.kcl"); const SERVER_RACK_LITE_PROGRAM: &str = include_str!("../e2e/executor/inputs/server-rack-lite.kcl");
const LEGO_PROGRAM: &str = include_str!("../../tests/executor/inputs/slow_lego.kcl.tmpl"); const LEGO_PROGRAM: &str = include_str!("../e2e/executor/inputs/slow_lego.kcl.tmpl");
const LSYSTEM_PROGRAM: &str = include_str!("../../tests/executor/inputs/lsystem.kcl"); const LSYSTEM_PROGRAM: &str = include_str!("../e2e/executor/inputs/lsystem.kcl");

View File

@ -58,10 +58,10 @@ fn bench_kcl_lsp_semantic_tokens(c: &mut Criterion) {
criterion_group!(benches, bench_kcl_lsp_semantic_tokens); criterion_group!(benches, bench_kcl_lsp_semantic_tokens);
criterion_main!(benches); criterion_main!(benches);
const KITT_PROGRAM: &str = include_str!("../../tests/executor/inputs/kittycad_svg.kcl"); const KITT_PROGRAM: &str = include_str!("../e2e/executor/inputs/kittycad_svg.kcl");
const PIPES_PROGRAM: &str = include_str!("../../tests/executor/inputs/pipes_on_pipes.kcl"); const PIPES_PROGRAM: &str = include_str!("../e2e/executor/inputs/pipes_on_pipes.kcl");
const CUBE_PROGRAM: &str = include_str!("../../tests/executor/inputs/cube.kcl"); const CUBE_PROGRAM: &str = include_str!("../e2e/executor/inputs/cube.kcl");
const MATH_PROGRAM: &str = include_str!("../../tests/executor/inputs/math.kcl"); const MATH_PROGRAM: &str = include_str!("../e2e/executor/inputs/math.kcl");
const MIKE_STRESS_TEST_PROGRAM: &str = include_str!("../tests/mike_stress_test/input.kcl"); const MIKE_STRESS_TEST_PROGRAM: &str = include_str!("../tests/mike_stress_test/input.kcl");
const GLOBAL_TAGS_FILE: &str = include_str!("../../tests/executor/inputs/global-tags.kcl"); const GLOBAL_TAGS_FILE: &str = include_str!("../e2e/executor/inputs/global-tags.kcl");
const LSYSTEM_PROGRAM: &str = include_str!("../../tests/executor/inputs/lsystem.kcl"); const LSYSTEM_PROGRAM: &str = include_str!("../e2e/executor/inputs/lsystem.kcl");

View File

@ -7,7 +7,8 @@ fn cube(length, center) {
p2 = [ l + x, l + y] p2 = [ l + x, l + y]
p3 = [ l + x, -l + y] p3 = [ l + x, -l + y]
return startSketchAt(p0) return startSketchOn(XY)
|> startProfileAt(p0, %)
|> line(endAbsolute = p1) |> line(endAbsolute = p1)
|> line(endAbsolute = p2) |> line(endAbsolute = p2)
|> line(endAbsolute = p3) |> line(endAbsolute = p3)

View File

@ -1,31 +1,32 @@
const rpizWidth = 30 rpizWidth = 30
const rpizLength = 65 rpizLength = 65
const caseThickness = 1 caseThickness = 1
const border = 4 border = 4
const screwHeight = 4 screwHeight = 4
const caseWidth = rpizWidth + border * 2 caseWidth = rpizWidth + border * 2
const caseLength = rpizLength + border * 2 caseLength = rpizLength + border * 2
const caseHeight = 8 caseHeight = 8
const widthBetweenScrews = 23 widthBetweenScrews = 23
const lengthBetweenScrews = 29 * 2 lengthBetweenScrews = 29 * 2
const miniHdmiDistance = 12.4 miniHdmiDistance = 12.4
const microUsb1Distance = 41.4 microUsb1Distance = 41.4
const microUsb2Distance = 54 microUsb2Distance = 54
const miniHdmiWidth = 11.2 miniHdmiWidth = 11.2
const microUsbWidth = 7.4 microUsbWidth = 7.4
const connectorPadding = 4 connectorPadding = 4
const miniHdmiHole = startSketchAt([ miniHdmiHole = startSketchOn(XY)
|> startProfileAt([
0, 0,
border + miniHdmiDistance - (miniHdmiWidth / 2) border + miniHdmiDistance - (miniHdmiWidth / 2)
]) ], %)
|> lineTo([ |> lineTo([
0, 0,
border + miniHdmiDistance + miniHdmiWidth / 2 border + miniHdmiDistance + miniHdmiWidth / 2
@ -40,7 +41,7 @@ const miniHdmiHole = startSketchAt([
], %) ], %)
|> close() |> close()
const case = startSketchOn('XY') case = startSketchOn('XY')
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> line(endAbsolute = [caseWidth, 0], $edge1) |> line(endAbsolute = [caseWidth, 0], $edge1)
|> line(endAbsolute = [caseWidth, caseLength], $edge2) |> line(endAbsolute = [caseWidth, caseLength], $edge2)
@ -59,7 +60,7 @@ const case = startSketchOn('XY')
fn m25Screw = (x, y, height) => { fn m25Screw = (x, y, height) => {
const screw = startSketchOn("XY") screw = startSketchOn(XY)
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> circle(center= [x, y], radius=2.5) |> circle(center= [x, y], radius=2.5)
|> hole(circle(center= [x, y], radius = 1.25), %) |> hole(circle(center= [x, y], radius = 1.25), %)

View File

@ -7,7 +7,8 @@ let corner_radius = 5.0
// At first I thought this was going to be symmetric, // At first I thought this was going to be symmetric,
// but I measured intentionally to not be symmetric, // but I measured intentionally to not be symmetric,
// because your wrist isn't a perfect cylindrical surface // because your wrist isn't a perfect cylindrical surface
let brace_base = startSketchAt([corner_radius, 0]) let brace_base = startSketchOn(XY)
|> startProfileAt([corner_radius, 0], %)
|> line(end = [width - corner_radius, 0.0]) |> line(end = [width - corner_radius, 0.0])
|> tangentialArcToRelative([corner_radius, corner_radius], %) |> tangentialArcToRelative([corner_radius, corner_radius], %)
|> yLine(25.0 - corner_radius, %) |> yLine(25.0 - corner_radius, %)
@ -34,7 +35,8 @@ let brace_base = startSketchAt([corner_radius, 0])
|> tangentialArcToRelative([corner_radius, -corner_radius], %) |> tangentialArcToRelative([corner_radius, -corner_radius], %)
|> close() |> close()
let inner = startSketchAt([0, 0]) let inner = startSketchOn(XY)
|> startProfileAt([0, 0], %)
|> xLine(1.0, %) |> xLine(1.0, %)
|> tangentialArcToRelative([corner_radius, corner_radius], %) |> tangentialArcToRelative([corner_radius, corner_radius], %)
|> yLine(25.0 - (corner_radius * 2), %) |> yLine(25.0 - (corner_radius * 2), %)

View File

@ -21,7 +21,7 @@ Gt = cond([false, false, true])
fn Lte = (a, b) => { return Not(Gt(a, b)) } fn Lte = (a, b) => { return Not(Gt(a, b)) }
fn Gte = (a, b) => { return Not(Lt(a, b)) } fn Gte = (a, b) => { return Not(Lt(a, b)) }
// L-system // L-system
// Note: it was most concise to encode productions directly in axioms. // Note: it was most concise to encode productions directly in axioms.
// Change them as you need. // Change them as you need.
@ -100,6 +100,8 @@ fn F = (state, F) => {
} }
fn LSystem = (args, axioms) => { fn LSystem = (args, axioms) => {
myThing = startSketchOn(XY)
|> startProfileAt([0, 0], %)
return axioms({ return axioms({
depthMax: args.iterations, depthMax: args.iterations,
depth: 0, depth: 0,
@ -107,7 +109,7 @@ fn LSystem = (args, axioms) => {
factor: args.factor, factor: args.factor,
currentAngle: 0, currentAngle: 0,
angle: args.angle, angle: args.angle,
q: startSketchAt([0, 0]), q = myThing,
}) })
} }
@ -116,6 +118,6 @@ LSystem({
factor: 1.36, factor: 1.36,
angle: 60, angle: 60,
}, (q) => { }, (q) => {
result = q |> F(%, F) |> Add(%) |> Add(%) |> F(%, F) |> Add(%) |> Add(%) |> F(%, F) result = q |> F(%, F) |> Add(%) |> Add(%) |> F(%, F) |> Add(%) |> Add(%) |> F(%, F)
return result.q return result.q
}) })

Some files were not shown because too many files have changed in this diff Show More