Skip to content

New command, 'ExecKclProject'#1236

Draft
adamchalmers wants to merge 2 commits into
mainfrom
achalmers/kcl-in-engine
Draft

New command, 'ExecKclProject'#1236
adamchalmers wants to merge 2 commits into
mainfrom
achalmers/kcl-in-engine

Conversation

@adamchalmers

Copy link
Copy Markdown
Collaborator

Adds a new command for executing KCL. Basically it:

  • takes a list of files in the KCL project (one of them is the entrypoint, e.g. main.kcl)
  • responds with the same type the KCL wasm library does, i.e. a result of Ok or Err, with diagnostic information, artifact graph, etc.
    • To do this, I moved those types (returned by KCL to the frontend) out of kcl-lib and into a new crate. kcl-api
    • kcl-api is imported by both kcl-lib and this project, kcmc.

We should also consider moving this project under the modeling-app monorepo, inside the rust/ dir as a workspace member.


/// Filepath which is guaranteed to be relative and not contain parent directory jumps like '..'
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, Default)]
#[serde(transparent)]

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: Make sure serde calls the validation path when deserializing from the network. Currently it bypasses the fn validate() when deserializing.

This command takes in a KCL project (which is a list of files, like a virtual filesystem directory) and returns the same Ok/Err result type that the frontend usually gets for KCL execution.

Internally, it validates the filepaths (to make sure they're all relative to the KCL project root), and uses types from the frontend, which have been moved into a kcl-api crate.
@adamchalmers adamchalmers force-pushed the achalmers/kcl-in-engine branch from 0996da7 to 80874c6 Compare June 15, 2026 19:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant