feat(vet): accept -E/--external to pass external KCL packages - #365
Merged
Conversation
Peefy
force-pushed
the
fix/issue-1877-vet-external-flag
branch
from
August 12, 2026 01:45
c2d536b to
32c63ff
Compare
The `kcl vet` command did not expose any way to declare external KCL package mappings, so schemas that imported other packages failed validation even though `kcl run` handled the same scenario via the `-E/--external` flag and the underlying Rust service already supported `external_pkgs`. Add the same `-E/--external` flag to `kcl vet`, parse each value as `pkg_name=pkg_path` (matching `kcl run`) and forward the parsed entries directly to `gpyrpc.ValidateCodeArgs.ExternalPkgs`. Using the stable gRPC schema keeps this CLI buildable against any released version of kcl-go without waiting for a coordinated release. Empty entries are skipped and malformed entries (missing separator, name or path) surface as a clear error rather than being silently dropped. Fixes kcl-lang/kcl#1877. Signed-off-by: Claude <claude@anthropic.com>
Peefy
force-pushed
the
fix/issue-1877-vet-external-flag
branch
from
August 12, 2026 01:48
32c63ff to
c91fd78
Compare
Coverage Report for CI Build 31554848354Coverage remained the same at 27.691%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes kcl-lang/kcl#1877.
kcl vetdid not expose any way to declare external KCL packagemappings, so schemas that imported other packages failed validation
even though
kcl runhandled the same scenario via-E/--externaland the underlying Rust service already supported
external_pkgs.Changes
-E/--externalflag used bykcl runtokcl vet.Each value is parsed as
pkg_name=pkg_pathand forwarded to theembedded
validate.ValidateOptions.ExternalPackages(newly addedin kcl-lang/kcl-go alongside this change).
pkg_nameorpkg_pathmissing) as aclear error rather than silently dropping them, matching the
long-standing behaviour of
kcl run --externalconsumers.vet_test.gocovering the flag registration, the parser,and the gRPC conversion helper.
Test plan
go test ./cmd/kcl/commands/... -run Vet— passes locally,including all eight table-driven parser cases, the flag
registration check, and the empty-field short-circuit.
Without
-Ethe historical "Cannot find the module" error ispreserved, so this change is strictly additive for existing
invocations.
Depends on kcl-lang/kcl-go#566, which adds the new
ValidateOptions.ExternalPackagesfield this CLI change forwardsinto.