Repository: kcl-lang/kcl (language: rust)

Issue:
[WIP] Feat : Support Call Kclvm Cli by C API
<!-- Thank you for contributing to KusionStack!

Note: 

1. With pull requests:

    - Open your pull request against "main"
    - Your pull request should have no more than two commits, if not you should squash them.
    - It should pass all tests in the available continuous integration systems such as GitHub Actions.
    - You should add/modify tests to cover your proposed code changes.
    - If your pull request contains a new feature, please document it on the README.

2. Please create an issue first to describe the problem.

    We recommend that link the issue with the PR in the following question.
    For more info, check https://kusionstack.io/docs/governance/contribute/
-->

#### 1. Does this PR affect any open issues?(Y/N) and add issue references (e.g. "fix #123", "re #123".):

- [ ] N
- [x] Y 
re #125 

#### 2. What is the scope of this PR (e.g. component or file name):

<!-- You can add the scope of this change here. 
-->
        KCLVM/kclvm/spec
        KCLVM/kclvm/src/lib.rs

#### 3. Provide a description of the PR(e.g. more details, effects, motivations or doc link):

<!-- You can choose a brief description here -->
- [ ] Affects user behaviors
- [ ] Contains syntax changes
- [ ] Contains variable changes
- [x] Contains experimental features
- [ ] Performance regression: Consumes more CPU
- [ ] Performance regression: Consumes more Memory
- [ ] Other

<!-- You can add more details here.
-->
    Support user to call kclvm_cli by c_api


#### 4. Are there any breaking changes?(Y/N) and describe the breaking changes(e.g. more details, motivations or doc link):

- [x] N
- [ ] Y 

<!-- You can add more details here.

-->

#### 5. Are there test cases for these changes?(Y/N) select and add more details, references or doc links:

<!-- You can choose a brief description here -->
- [x] Unit test
- [ ] Integration test
- [ ] Benchmark (add benchmark stats below)
- [ ] Manual test (add detailed scripts or steps below)
- [ ] Other

<!-- You can add more details here.
None
-->
KCLVM/kclvm/src/api_test.rs

#### 6. Release note

<!-- compatibility change, improvement, bugfix, and new feature need a release note -->

Please refer to [Release Notes Language Style Guide](https://kusionstack.io/docs/governance/release-policy/) to write a quality release note.

```release-note
None
```



Discussion / hints:
****CLA Assistant Lite bot**** All contributors have signed the CLA  ✍️ ✅
I have read the CLA Document and I hereby sign the CLA
## Pull Request Test Coverage Report for [Build 2744948016](https://coveralls.io/builds/51191024)

* **2** of **5523**   **(0.04%)**  changed or added relevant lines in **6** files are covered.
* No unchanged relevant lines lost coverage.
* Overall coverage decreased (**-7.6%**) to **51.731%**

---

|  Changes Missing Coverage | Covered Lines | Changed/Added Lines | % |
| :-----|--------------|--------|---: |
| [kclvm/spec/src/main.rs](https://coveralls.io/builds/51191024/source?filename=kclvm%2Fspec%2Fsrc%2Fmain.rs#L2) | 1 | 3 | 33.33%
| [kclvm/spec/src/service/util.rs](https://coveralls.io/builds/51191024/source?filename=kclvm%2Fspec%2Fsrc%2Fservice%2Futil.rs#L2) | 0 | 25 | 0.0%
| [kclvm/spec/src/service/service.rs](https://coveralls.io/builds/51191024/source?filename=kclvm%2Fspec%2Fsrc%2Fservice%2Fservice.rs#L10) | 0 | 109 | 0.0%
| [kclvm/spec/src/service/api.rs](https://coveralls.io/builds/51191024/source?filename=kclvm%2Fspec%2Fsrc%2Fservice%2Fapi.rs#L10) | 0 | 153 | 0.0%
| [kclvm/spec/src/model/gpyrpc.rs](https://coveralls.io/builds/51191024/source?filename=kclvm%2Fspec%2Fsrc%2Fmodel%2Fgpyrpc.rs#L28) | 0 | 5232 | 0.0%
<!-- | **Total:** | **2** | **5523** | **0.04%** | -->


|  Totals | [![Coverage Status](https://coveralls.io/builds/51191024/badge)](https://coveralls.io/builds/51191024) |
| :-- | --: |
| Change from base [Build 2743999583](https://coveralls.io/builds/51186839): |  -7.6% |
| Covered Lines: | 22244 |
| Relevant Lines: | 42999 |

---
##### 💛  - [Coveralls](https://coveralls.io)


Fix patch:
diff --git a/kclvm/Cargo.lock b/kclvm/Cargo.lock
index 91b611b1f..f2c9a0670 100644
--- a/kclvm/Cargo.lock
+++ b/kclvm/Cargo.lock
@@ -1444,6 +1444,124 @@ dependencies = [
  "cc",
 ]
 
+[[package]]
+name = "icu_collections"
+version = "1.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "db2fa452206ebee18c4b5c2274dbf1de17008e874b4dc4f0aea9d01ca79e4526"
+dependencies = [
+ "displaydoc",
+ "yoke",
+ "zerofrom",
+ "zerovec",
+]
+
+[[package]]
+name = "icu_locid"
+version = "1.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "13acbb8371917fc971be86fc8057c41a64b521c184808a698c02acc242dbf637"
+dependencies = [
+ "displaydoc",
+ "litemap",
+ "tinystr",
+ "writeable",
+ "zerovec",
+]
+
+[[package]]
+name = "icu_locid_transform"
+version = "1.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "01d11ac35de8e40fdeda00d9e1e9d92525f3f9d887cdd7aa81d727596788b54e"
+dependencies = [
+ "displaydoc",
+ "icu_locid",
+ "icu_locid_transform_data",
+ "icu_provider",
+ "tinystr",
+ "zerovec",
+]
+
+[[package]]
+name = "icu_locid_transform_data"
+version = "1.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "fdc8ff3388f852bede6b579ad4e978ab004f139284d7b28715f773507b946f6e"
+
+[[package]]
+name = "icu_normalizer"
+version = "1.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "19ce3e0da2ec68599d193c93d088142efd7f9c5d6fc9b803774855747dc6a84f"
+dependencies = [
+ "displaydoc",
+ "icu_collections",
+ "icu_normalizer_data",
+ "icu_properties",
+ "icu_provider",
+ "smallvec",
+ "utf16_iter",
+ "utf8_iter",
+ "write16",
+ "zerovec",
+]
+
+[[package]]
+name = "icu_normalizer_data"
+version = "1.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f8cafbf7aa791e9b22bec55a167906f9e1215fd475cd22adfcf660e03e989516"
+
+[[package]]
+name = "icu_properties"
+version = "1.5.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "93d6020766cfc6302c15dbbc9c8778c37e62c14427cb7f6e601d849e092aeef5"
+dependencies = [
+ "displaydoc",
+ "icu_collections",
+ "icu_locid_transform",
+ "icu_properties_data",
+ "icu_provider",
+ "tinystr",
+ "zerovec",
+]
+
+[[package]]
+name = "icu_properties_data"
+version = "1.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "67a8effbc3dd3e4ba1afa8ad918d5684b8868b3b26500753effea8d2eed19569"
+
+[[package]]
+name = "icu_provider"
+version = "1.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6ed421c8a8ef78d3e2dbc98a973be2f3770cb42b606e3ab18d6237c4dfde68d9"
+dependencies = [
+ "displaydoc",
+ "icu_locid",
+ "icu_provider_macros",
+ "stable_deref_trait",
+ "tinystr",
+ "writeable",
+ "yoke",
+ "zerofrom",
+ "zerovec",
+]
+
+[[package]]
+name = "icu_provider_macros"
+version = "1.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.72",
+]
+
 [[package]]
 name = "ident_case"
 version = "1.0.1"
@@ -1452,12 +1570,23 @@ checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39"
 
 [[package]]
 name = "idna"
-version = "0.5.0"
+version = "1.0.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6"
+checksum = "686f825264d630750a544639377bae737628043f20d38bbc029e8f29ea968a7e"
 dependencies = [
- "unicode-bidi",
- "unicode-normalization",
+ "idna_adapter",
+ "smallvec",
+ "utf8_iter",
+]
+
+[[package]]
+name = "idna_adapter"
+version = "1.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "daca1df1c957320b2cf139ac61e7bd64fed304c5040df000a745aa1de3b4ef71"
+dependencies = [
+ "icu_normalizer",
+ "icu_properties",
 ]
 
 [[package]]
@@ -1912,6 +2041,7 @@ dependencies = [
  "serde_json",
  "serde_yaml",
  "toml",
+ "url",
 ]
 
 [[package]]
@@ -2008,7 +2138,7 @@ dependencies = [
  "proc-macro2",
  "quote",
  "syn 1.0.109",
- "synstructure",
+ "synstructure 0.12.6",
 ]
 
 [[package]]
@@ -2311,6 +2441,12 @@ version = "0.4.14"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89"
 
+[[package]]
+name = "litemap"
+version = "0.7.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4ee93343901ab17bd981295f2cf0026d4ad018c7c31ba84549a4ddbb47a45104"
+
 [[package]]
 name = "llvm-sys"
 version = "120.3.2"
@@ -4042,6 +4178,17 @@ dependencies = [
  "unicode-xid",
 ]
 
+[[package]]
+name = "synstructure"
+version = "0.13.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.72",
+]
+
 [[package]]
 name = "tar"
 version = "0.4.41"
@@ -4201,6 +4348,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "9117f5d4db391c1cf6927e7bea3db74b9a1c1add8f7eda9ffd5364f40f57b82f"
 dependencies = [
  "displaydoc",
+ "zerovec",
 ]
 
 [[package]]
@@ -4560,12 +4708,6 @@ dependencies = [
  "version_check",
 ]
 
-[[package]]
-name = "unicode-bidi"
-version = "0.3.15"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75"
-
 [[package]]
 name = "unicode-casing"
 version = "0.1.0"
@@ -4625,9 +4767,9 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1"
 
 [[package]]
 name = "url"
-version = "2.5.2"
+version = "2.5.4"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "22784dbdf76fdde8af1aeda5622b546b422b6fc585325248a2bf9f5e41e94d6c"
+checksum = "32f8b686cadd1473f4bd0117a5d28d36b1ade384ea9b5069a1c40aefed7fda60"
 dependencies = [
  "form_urlencoded",
  "idna",
@@ -4635,6 +4777,18 @@ dependencies = [
  "serde",
 ]
 
+[[package]]
+name = "utf16_iter"
+version = "1.0.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c8232dd3cdaed5356e0f716d285e4b40b932ac434100fe9b7e0e8e935b9e6246"
+
+[[package]]
+name = "utf8_iter"
+version = "1.0.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be"
+
 [[package]]
 name = "utf8parse"
 version = "0.2.2"
@@ -5111,6 +5265,18 @@ dependencies = [
  "windows-sys 0.48.0",
 ]
 
+[[package]]
+name = "write16"
+version = "1.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d1890f4022759daae28ed4fe62859b1236caebfc61ede2f63ed4e695f3f6d936"
+
+[[package]]
+name = "writeable"
+version = "0.5.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1e9df38ee2d2c3c5948ea468a8406ff0db0b29ae1ffde1bcf20ef305bcc95c51"
+
 [[package]]
 name = "xattr"
 version = "1.3.1"
@@ -5146,8 +5312,75 @@ dependencies = [
  "winapi",
 ]
 
+[[package]]
+name = "yoke"
+version = "0.7.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "120e6aef9aa629e3d4f52dc8cc43a015c7724194c97dfaf45180d2daf2b77f40"
+dependencies = [
+ "serde",
+ "stable_deref_trait",
+ "yoke-derive",
+ "zerofrom",
+]
+
+[[package]]
+name = "yoke-derive"
+version = "0.7.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2380878cad4ac9aac1e2435f3eb4020e8374b5f13c296cb75b4620ff8e229154"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.72",
+ "synstructure 0.13.1",
+]
+
+[[package]]
+name = "zerofrom"
+version = "0.1.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cff3ee08c995dee1859d998dea82f7374f2826091dd9cd47def953cae446cd2e"
+dependencies = [
+ "zerofrom-derive",
+]
+
+[[package]]
+name = "zerofrom-derive"
+version = "0.1.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "595eed982f7d355beb85837f651fa22e90b3c044842dc7f2c2842c086f295808"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.72",
+ "synstructure 0.13.1",
+]
+
 [[package]]
 name = "zeroize"
 version = "1.8.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde"
+
+[[package]]
+name = "zerovec"
+version = "0.10.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "aa2b893d79df23bfb12d5461018d408ea19dfafe76c2c7ef6d4eba614f8ff079"
+dependencies = [
+ "yoke",
+ "zerofrom",
+ "zerovec-derive",
+]
+
+[[package]]
+name = "zerovec-derive"
+version = "0.10.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.72",
+]
diff --git a/kclvm/config/Cargo.toml b/kclvm/config/Cargo.toml
index c8344dda7..6e854242d 100644
--- a/kclvm/config/Cargo.toml
+++ b/kclvm/config/Cargo.toml
@@ -24,3 +24,4 @@ kclvm-ast = {path = "../ast"}
 dirs = "5.0.0"
 md-5 = "0.8.0"
 regex = "1.10.4"
+url = "2.5.4"
diff --git a/kclvm/config/src/modfile.rs b/kclvm/config/src/modfile.rs
index fa54ebafc..3c5410d2b 100644
--- a/kclvm/config/src/modfile.rs
+++ b/kclvm/config/src/modfile.rs
@@ -10,6 +10,7 @@ use std::{
     path::{Path, PathBuf},
 };
 use toml;
+use url::Url;
 
 use crate::path::ModRelativePath;
 
@@ -114,6 +115,35 @@ pub struct LockDependency {
     pub path: Option<String>,
 }
 
+impl LockDependency {
+    pub fn gen_filename(&self) -> String {
+        if let Some(git_url) = &self.url {
+            if let Ok(parsed_url) = Url::parse(git_url) {
+                if let Some(last_segment) = parsed_url
+                    .path_segments()
+                    .and_then(|segments| segments.last())
+                {
+                    let trimmed_segment = last_segment.trim_end_matches(".git");
+                    return trimmed_segment.to_string();
+                }
+            }
+        }
+
+        if let Some(oci_repo) = &self.repo {
+            if let Ok(parsed_url) = Url::parse(oci_repo) {
+                if let Some(last_segment) = parsed_url
+                    .path_segments()
+                    .and_then(|segments| segments.last())
+                {
+                    return last_segment.to_string();
+                }
+            }
+        }
+
+        return self.name.replace('-', "_");
+    }
+}
+
 #[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq, Eq)]
 pub struct GitSource {
     /// The URL of the Git repository.
diff --git a/kclvm/driver/src/client/mod.rs b/kclvm/driver/src/client/mod.rs
index 7e1dc17b6..037c1e504 100644
--- a/kclvm/driver/src/client/mod.rs
+++ b/kclvm/driver/src/client/mod.rs
@@ -265,7 +265,7 @@ impl ModClient {
             lock_dep.full_name.clone()
         } else if let Some(git_url) = &lock_dep.url {
             Some(self.get_local_path_from_dep(
-                &lock_dep.name,
+                &lock_dep.gen_filename(),
                 &Dependency::Git(GitSource {
                     git: git_url.to_string(),
                     branch: lock_dep.branch.clone(),
diff --git a/kclvm/driver/src/toolchain.rs b/kclvm/driver/src/toolchain.rs
index 95677f6bc..13774c6ed 100644
--- a/kclvm/driver/src/toolchain.rs
+++ b/kclvm/driver/src/toolchain.rs
@@ -59,6 +59,7 @@ impl<S: AsRef<OsStr> + Send + Sync> Toolchain for CommandToolchain<S> {
         match Command::new(&self.path)
             .arg("mod")
             .arg("metadata")
+            .arg("--update")
             .current_dir(manifest_path)
             .output()
         {
diff --git a/kclvm/tools/src/LSP/src/state.rs b/kclvm/tools/src/LSP/src/state.rs
index f94417079..d377b153b 100644
--- a/kclvm/tools/src/LSP/src/state.rs
+++ b/kclvm/tools/src/LSP/src/state.rs
@@ -193,13 +193,18 @@ impl LanguageServerState {
         for event in self.fs_event_watcher._receiver.try_iter() {
             if let Ok(e) = event {
                 match e.kind {
-                    notify::EventKind::Modify(_) => {
-                        let paths = e.paths;
-                        let kcl_config_file: Vec<PathBuf> = filter_kcl_config_file(&paths);
-                        if !kcl_config_file.is_empty() {
-                            return Some(Event::FileWatcher(FileWatcherEvent::ChangedConfigFile(
-                                kcl_config_file,
-                            )));
+                    notify::EventKind::Modify(kind) => {
+                        if let notify::event::ModifyKind::Data(data_change) = kind {
+                            if let notify::event::DataChange::Content = data_change {
+                                let paths = e.paths;
+                                let kcl_config_file: Vec<PathBuf> = filter_kcl_config_file(&paths);
+                                if !kcl_config_file.is_empty() {
+                                    // TODO: wait for fix `kcl mod metadata` to read only. Otherwise it will lead to an infinite loop
+                                    // return Some(Event::FileWatcher(
+                                    //     FileWatcherEvent::ChangedConfigFile(kcl_config_file),
+                                    // ));
+                                }
+                            }
                         }
                     }
                     notify::EventKind::Remove(remove_kind) => {


Test patch:
diff --git a/.github/workflows/macos_test.yaml b/.github/workflows/macos_test.yaml
index 3be0f9236..96502779c 100644
--- a/.github/workflows/macos_test.yaml
+++ b/.github/workflows/macos_test.yaml
@@ -33,7 +33,7 @@ jobs:
 
       - name: Install KCL CLI
         run: |
-          go install kcl-lang.io/cli/cmd/kcl@c5ecdd12a97ca836a34744cd2f4d561eaae381ff
+          go install kcl-lang.io/cli/cmd/kcl@main
           echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
           echo "${{ github.workspace }}/go/bin" >> $GITHUB_PATH
 
diff --git a/.github/workflows/ubuntu_test.yaml b/.github/workflows/ubuntu_test.yaml
index 90baece76..de8fbc61d 100644
--- a/.github/workflows/ubuntu_test.yaml
+++ b/.github/workflows/ubuntu_test.yaml
@@ -57,7 +57,7 @@ jobs:
         shell: bash
       - name: Install KCL CLI
         run: |
-          go install kcl-lang.io/cli/cmd/kcl@c5ecdd12a97ca836a34744cd2f4d561eaae381ff
+          go install kcl-lang.io/cli/cmd/kcl@main
           echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
           echo "${{ github.workspace }}/go/bin" >> $GITHUB_PATH
       - name: Unit test
diff --git a/.github/workflows/windows_test.yaml b/.github/workflows/windows_test.yaml
index 2f8addeb5..b55178641 100644
--- a/.github/workflows/windows_test.yaml
+++ b/.github/workflows/windows_test.yaml
@@ -34,7 +34,7 @@ jobs:
       - name: Install KCL
         shell: powershell
         run: |
-          go install kcl-lang.io/cli/cmd/kcl@c5ecdd12a97ca836a34744cd2f4d561eaae381ff
+          go install kcl-lang.io/cli/cmd/kcl@main
           $GoPath = go env GOPATH
           $GoInstallBin = Join-Path $GoPath "bin"
           $Env:PATH += ";$GoInstallBin"
diff --git a/kclvm/driver/src/test_data/kpm_metadata/kcl.mod b/kclvm/driver/src/test_data/kpm_metadata/kcl.mod
index c8325a3b6..58b2a49f8 100644
--- a/kclvm/driver/src/test_data/kpm_metadata/kcl.mod
+++ b/kclvm/driver/src/test_data/kpm_metadata/kcl.mod
@@ -4,4 +4,4 @@ edition = "0.0.1"
 version = "0.0.4"
 
 [dependencies]
-kcl4 = { git = "test_url", tag = "v0.0.1" }
+flask_manifests = { git = "https://github.com/kcl-lang/flask-demo-kcl-manifests.git", commit = "ade147b", version = "0.0.1" }
diff --git a/kclvm/driver/src/test_data/kpm_metadata/kcl.mod.lock b/kclvm/driver/src/test_data/kpm_metadata/kcl.mod.lock
index 409a419c6..4dc847701 100644
--- a/kclvm/driver/src/test_data/kpm_metadata/kcl.mod.lock
+++ b/kclvm/driver/src/test_data/kpm_metadata/kcl.mod.lock
@@ -1,7 +1,7 @@
 [dependencies]
-  [dependencies.kcl4]
-    name = "kcl4"
-    full_name = "kcl4_0.0.1"
+  [dependencies.flask_manifests]
+    name = "flask_manifests"
+    full_name = "flask_manifests_0.0.1"
     version = "0.0.1"
-    url = "test_url"
-    git_tag = "v0.0.1"
+    url = "https://github.com/kcl-lang/flask-demo-kcl-manifests.git"
+    commit = "ade147b"
diff --git a/kclvm/driver/src/test_data/kpm_metadata_with_line/main_pkg/kcl.mod.lock b/kclvm/driver/src/test_data/kpm_metadata_with_line/main_pkg/kcl.mod.lock
index 176cb7dec..8165e52f9 100644
--- a/kclvm/driver/src/test_data/kpm_metadata_with_line/main_pkg/kcl.mod.lock
+++ b/kclvm/driver/src/test_data/kpm_metadata_with_line/main_pkg/kcl.mod.lock
@@ -3,4 +3,3 @@
     name = "dep-with-line"
     full_name = "dep-with-line_0.0.1"
     version = "0.0.1"
-    sum = "O2Z1djaB1lC38kNfhwUUYAlqGKE7seUqqys3DPcJfEw="
diff --git a/kclvm/driver/src/tests.rs b/kclvm/driver/src/tests.rs
index fb68bf670..e98fddcf1 100644
--- a/kclvm/driver/src/tests.rs
+++ b/kclvm/driver/src/tests.rs
@@ -188,15 +188,15 @@ fn test_fill_pkg_maps_for_k_file() {
 
     let pkg_maps = opts.package_maps.clone();
     assert_eq!(pkg_maps.len(), 1);
-    assert!(pkg_maps.get("kcl4").is_some());
+    assert!(pkg_maps.get("flask_manifests").is_some());
     assert_eq!(
-        PathBuf::from(pkg_maps.get("kcl4").unwrap().clone())
+        PathBuf::from(pkg_maps.get("flask_manifests").unwrap().clone())
             .canonicalize()
             .unwrap()
             .display()
             .to_string(),
         PathBuf::from(vendor_home)
-            .join("kcl4_v0.0.1")
+            .join("flask-demo-kcl-manifests_ade147b")
             .canonicalize()
             .unwrap()
             .display()
@@ -273,19 +273,22 @@ fn test_tool_fetch_metadata(tool: impl Toolchain) {
     let metadata = tool.fetch_metadata(path.clone());
     let pkgs = metadata.unwrap().packages.clone();
     assert_eq!(pkgs.len(), 1);
-    assert!(pkgs.get("kcl4").is_some());
-    assert_eq!(pkgs.get("kcl4").unwrap().name, "kcl4");
+    assert!(pkgs.get("flask_manifests").is_some());
+    assert_eq!(pkgs.get("flask_manifests").unwrap().name, "flask_manifests");
+
+    let manifest_path = pkgs.get("flask_manifests").unwrap().manifest_path.clone();
+    println!("Manifest path: {:?}", manifest_path);
+
+    let canonicalized_manifest_path = manifest_path.canonicalize();
+    println!(
+        "Canonicalized manifest path: {:?}",
+        canonicalized_manifest_path
+    );
+
     assert_eq!(
-        pkgs.get("kcl4")
-            .unwrap()
-            .manifest_path
-            .clone()
-            .canonicalize()
-            .unwrap()
-            .display()
-            .to_string(),
+        canonicalized_manifest_path.unwrap().display().to_string(),
         PathBuf::from(vendor_home)
-            .join("kcl4_v0.0.1")
+            .join("flask-demo-kcl-manifests_ade147b")
             .canonicalize()
             .unwrap()
             .display()
diff --git a/kclvm/tools/src/LSP/src/test_data/completion_test/import/external/external_1/kcl.mod b/kclvm/tools/src/LSP/src/test_data/completion_test/import/external/external_1/kcl.mod
index 8ea06569b..4ae72f07f 100644
--- a/kclvm/tools/src/LSP/src/test_data/completion_test/import/external/external_1/kcl.mod
+++ b/kclvm/tools/src/LSP/src/test_data/completion_test/import/external/external_1/kcl.mod
@@ -2,4 +2,3 @@
 
 [dependencies]
 k8s = { oci = "oci://ghcr.io/kcl-lang/k8s", tag = "1.28" }
-
diff --git a/kclvm/tools/src/LSP/src/tests.rs b/kclvm/tools/src/LSP/src/tests.rs
index d035748ef..6143fb414 100644
--- a/kclvm/tools/src/LSP/src/tests.rs
+++ b/kclvm/tools/src/LSP/src/tests.rs
@@ -1486,7 +1486,7 @@ fn complete_import_external_file_e2e_test() {
             },
         },
     );
-    wait_async!(2000);
+    wait_async!(5000);
 
     let id = server.next_request_id.get();
     server.next_request_id.set(id.wrapping_add(1));
@@ -1527,7 +1527,9 @@ fn complete_import_external_file_e2e_test() {
     }
 }
 
-#[test]
+// TODO: wait for fix `kcl mod metadata` to read only. Otherwise it will lead to an infinite loop
+#[allow(dead_code)]
+// #[test]
 fn mod_file_watcher_test() {
     let path = PathBuf::from(".")
         .join("src")