Skip to content

Commit 182cfae

Browse files
committed
Merge branch 'main' of github.com:d4v1d03/kcl-lang.io into main
2 parents ba32af2 + 6fddc9c commit 182cfae

File tree

359 files changed

+52447
-23
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

359 files changed

+52447
-23
lines changed

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.8
1+
0.9

docs/user_docs/concepts/type-and-definition.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ KCL features a **gradual static type system**, initially designed to consider sc
99
The configuration of attributes and types in KCL usually follows a simple pattern:
1010

1111
$$
12-
k = (T) v
12+
k\ o \ (T) \ v
1313
$$
1414

1515
where $k$ is the attribute name, $v$ is the attributes value, and $T$ is the type annotation. Since KCL has the ability of the type inference, $T$ is usually omitted.

docs/user_docs/getting-started/intro.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,10 @@ While KCL is not a general-purpose language, it excels within its specific domai
6565
KCL's attribute configuration follows a simple pattern:
6666

6767
$$
68-
k op (T) v
68+
k\ o \ (T) \ v
6969
$$
7070

71-
where $k$ is the attribute name, $v$ is the attributes value, $op$ is the attribute operator and $T$ is the type annotation. Since KCL has the ability of the type inference, $T$ is usually omitted. `deploy = Deployment {}` is a simple example that satisfies the pattern.
71+
where $k$ is the attribute name, $v$ is the attributes value, $o$ is the attribute operator and $T$ is the type annotation. Since KCL has the ability of the type inference, $T$ is usually omitted. `deploy = Deployment {}` is a simple example that satisfies the pattern.
7272

7373
This is an example of generating Kubernetes manifests.
7474

docs/user_docs/support/faq-install.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,14 @@ Please ensure that the following dependencies are in your PATH:
2828
- `gcc` for Linux
2929
- `cl.exe` for Windows, which can be obtained by installing `MSVC` including `MSVCP140.dll` and `VCRUNTIME140.dll`.
3030

31+
## Error: invalid character 'c' looking for beginning of value
32+
33+
Please ensure that the following dependencies are in your PATH:
34+
35+
- `clang` for MacOS
36+
- `gcc` for Linux
37+
- `cl.exe` for Windows, which can be obtained by installing `MSVC` including `MSVCP140.dll` and `VCRUNTIME140.dll`.
38+
3139
## Encountering exit status 0xc0000135 error on Windows platform
3240

3341
Please ensure that `.NET Framework` and `MSVC` are installed on your Windows. If not installed, you can install them and try again.

i18n/zh-CN/docusaurus-plugin-content-docs/current/user_docs/concepts/type-and-definition.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ KCL features a **gradual static type system**, initially designed to consider sc
99
The configuration of attributes and types in KCL usually follows a simple pattern:
1010

1111
$$
12-
k = (T) v
12+
k\ o \ (T) \ v
1313
$$
1414

1515
where $k$ is the attribute name, $v$ is the attributes value, and $T$ is the type annotation. Since KCL has the ability of the type inference, $T$ is usually omitted.

i18n/zh-CN/docusaurus-plugin-content-docs/current/user_docs/getting-started/intro.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,10 @@ KCL 试图提供独立于运行时的可编程性,不在本地提供线程和
6666
KCL 配置通常遵循如下模式:
6767

6868
$$
69-
k op (T) v
69+
k\ o \ (T) \ v
7070
$$
7171

72-
其中,$k$ 是属性名称,$v$ 是属性值,$op$ 是属性运算符,$T$ 是类型注解。由于 KCL 具有类型推导的能力,因此 $T$ 通常可以省略。比如 `deploy = Deployment {}` 就是一个符合该模式的简单示例。
72+
其中,$k$ 是属性名称,$v$ 是属性值,$o$ 是属性运算符,$T$ 是类型注解。由于 KCL 具有类型推导的能力,因此 $T$ 通常可以省略。比如 `deploy = Deployment {}` 就是一个符合该模式的简单示例。
7373

7474
下面是一个用 KCL 生成 Kubernetes 资源的例子
7575

i18n/zh-CN/docusaurus-plugin-content-docs/current/user_docs/support/faq-install.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,14 @@ xattr -d com.apple.quarantine /path/to/kcl
2828
- Linux: `gcc`
2929
- Windows: `cl.exe` (可以通过安装 `MSVC` 获得,主要包括 `MSVCP140.dll``VCRUNTIME140.dll` 等程序集)
3030

31+
## 错误:invalid character 'c' looking for beginning of value
32+
33+
请确保如下依赖在您的 PATH 中
34+
35+
- MacOS: `clang`
36+
- Linux: `gcc`
37+
- Windows: `cl.exe` (可以通过安装 `MSVC` 获得,主要包括 `MSVCP140.dll``VCRUNTIME140.dll` 等程序集)
38+
3139
## 在 Windows 平台上遇到 exit status 0xc0000135 错误
3240

3341
请确保您的 Windows 上安装了 `.NET Framework``MSVC`,如没有安装,可以安装并重试。

i18n/zh-CN/docusaurus-plugin-content-docs/current/user_docs/support/faq-kcl.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2556,3 +2556,72 @@ final_list:
25562556
## 61. KCL 代码片段 `version: "v1" = "v1"` 是什么意思?
25572557

25582558
这里的第一个 `"v1"` 表示变量 `version` 的类型是字符串字面类型。第二个 `"v1"` 表示变量 `version` 的默认值是 "v1"。
2559+
2560+
## 62. 如何定义一个 KCL Schema 校验给定 JSON/YAML 文件的内容?
2561+
2562+
我们可以使用 kcl 的 vet 工具来校验给定 JSON 文件中的数据。例如,在下面的 data.json 文件中,我们使用以下的 KCL 文件(schema.k)来校验 age 参数。
2563+
2564+
data.json
2565+
2566+
```json
2567+
[
2568+
{
2569+
"name": "Alice",
2570+
"age": 18
2571+
},
2572+
{
2573+
"name": "Bob",
2574+
"age": 10
2575+
}
2576+
]
2577+
```
2578+
2579+
schema.k
2580+
2581+
```kcl
2582+
schema Person:
2583+
name: str
2584+
age: int
2585+
2586+
check:
2587+
age >= 10
2588+
```
2589+
2590+
校验 JSON 数据的命令
2591+
2592+
```shell
2593+
kcl vet data.json schema.k
2594+
```
2595+
2596+
## 63. 如何在给定 Schema 扩展数组属性的默认值?
2597+
2598+
我们使用 += 运算符来扩展 Schema 数组属性的默认值。
2599+
2600+
```python
2601+
schema MyApp:
2602+
args: [str] = ["default", "args"]
2603+
2604+
app = MyApp {
2605+
args += ["additional", "args"]
2606+
}
2607+
```
2608+
2609+
## 64. 可以配置 kcl 在特定路径上生成 `.kclvm` 文件夹或者其他与 kcl 编译缓存相关的目录吗?
2610+
2611+
可以通过变量 KCL_CACHE_PATH 来更改路径。
2612+
2613+
在 macOS 和 Linux 上:
2614+
2615+
可以通过向 ~/.bashrc、~/.zshrc 或类似的 shell rc 文件中添加 export 命令来设置 KCL_CACHE_PATH,或者如果您希望它只对当前会话生效,也可以直接在终端中运行它。
2616+
2617+
```shell
2618+
export KCL_CACHE_PATH=/tmp # 或者更改为您想要的路径
2619+
```
2620+
2621+
在 Windows 上
2622+
2623+
可以通过命令提示符或 PowerShell 将 KCL_CACHE_PATH 设置为环境变量,以便影响所有 KCL 会话。 对于命令提示符,请使用 setx 命令来永久设置该值:
2624+
2625+
```powershell
2626+
setx KCL_CACHE_PATH "C:\temp" /M
2627+
```

i18n/zh-CN/docusaurus-plugin-content-docs/version-0.5/user_docs/concepts/type-and-definition.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ KCL features a **gradual static type system**, initially designed to consider sc
99
The configuration of attributes and types in KCL usually follows a simple pattern:
1010

1111
$$
12-
k = (T) v
12+
k\ o \ (T) \ v
1313
$$
1414

1515
where $k$ is the attribute name, $v$ is the attributes value, and $T$ is the type annotation. Since KCL has the ability of the type inference, $T$ is usually omitted.

i18n/zh-CN/docusaurus-plugin-content-docs/version-0.5/user_docs/getting-started/intro.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ KCL 试图提供独立于运行时的可编程性,不在本地提供线程和I
6161
KCL 配置通常遵循如下模式:
6262

6363
$$
64-
k = (T) v
64+
k\ o \ (T) \ v
6565
$$
6666

6767
其中,$k$ 是属性名称,$v$ 是属性值,$T$ 是类型注解。由于 KCL 具有类型推导的能力,因此 $T$ 通常可以省略。

i18n/zh-CN/docusaurus-plugin-content-docs/version-0.6/user_docs/concepts/type-and-definition.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ KCL features a **gradual static type system**, initially designed to consider sc
99
The configuration of attributes and types in KCL usually follows a simple pattern:
1010

1111
$$
12-
k = (T) v
12+
k\ o \ (T) \ v
1313
$$
1414

1515
where $k$ is the attribute name, $v$ is the attributes value, and $T$ is the type annotation. Since KCL has the ability of the type inference, $T$ is usually omitted.

i18n/zh-CN/docusaurus-plugin-content-docs/version-0.6/user_docs/getting-started/intro.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ KCL 试图提供独立于运行时的可编程性,不在本地提供线程和I
6464
KCL 配置通常遵循如下模式:
6565

6666
$$
67-
k = (T) v
67+
k\ o \ (T) \ v
6868
$$
6969

7070
其中,$k$ 是属性名称,$v$ 是属性值,$T$ 是类型注解。由于 KCL 具有类型推导的能力,因此 $T$ 通常可以省略。

i18n/zh-CN/docusaurus-plugin-content-docs/version-0.7/user_docs/concepts/type-and-definition.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ KCL features a **gradual static type system**, initially designed to consider sc
99
The configuration of attributes and types in KCL usually follows a simple pattern:
1010

1111
$$
12-
k = (T) v
12+
k\ o \ (T) \ v
1313
$$
1414

1515
where $k$ is the attribute name, $v$ is the attributes value, and $T$ is the type annotation. Since KCL has the ability of the type inference, $T$ is usually omitted.

i18n/zh-CN/docusaurus-plugin-content-docs/version-0.7/user_docs/getting-started/intro.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ KCL 试图提供独立于运行时的可编程性,不在本地提供线程和I
6464
KCL 配置通常遵循如下模式:
6565

6666
$$
67-
k = (T) v
67+
k\ o \ (T) \ v
6868
$$
6969

7070
其中,$k$ 是属性名称,$v$ 是属性值,$T$ 是类型注解。由于 KCL 具有类型推导的能力,因此 $T$ 通常可以省略。

i18n/zh-CN/docusaurus-plugin-content-docs/version-0.8/user_docs/concepts/type-and-definition.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ KCL features a **gradual static type system**, initially designed to consider sc
99
The configuration of attributes and types in KCL usually follows a simple pattern:
1010

1111
$$
12-
k = (T) v
12+
k\ o \ (T) \ v
1313
$$
1414

1515
where $k$ is the attribute name, $v$ is the attributes value, and $T$ is the type annotation. Since KCL has the ability of the type inference, $T$ is usually omitted.

i18n/zh-CN/docusaurus-plugin-content-docs/version-0.8/user_docs/getting-started/intro.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ KCL 试图提供独立于运行时的可编程性,不在本地提供线程和
6666
KCL 配置通常遵循如下模式:
6767

6868
$$
69-
k = (T) v
69+
k\ o \ (T) \ v
7070
$$
7171

7272
其中,$k$ 是属性名称,$v$ 是属性值,$T$ 是类型注解。由于 KCL 具有类型推导的能力,因此 $T$ 通常可以省略。
Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
{
2+
"sidebar.user_docs.category.Get Started": {
3+
"message": "快速开始"
4+
},
5+
"sidebar.user_docs.category.Introduction": {
6+
"message": "简介"
7+
},
8+
"sidebar.user_docs.category.User Guide": {
9+
"message": "用户手册"
10+
},
11+
"sidebar.user_docs.guides.category.Automation": {
12+
"message": "自动化"
13+
},
14+
"sidebar.user_docs.category.Configuration": {
15+
"message": "配置"
16+
},
17+
"sidebar.user_docs.category.Data Integration": {
18+
"message": "数据集成"
19+
},
20+
"sidebar.user_docs.category.Package Management": {
21+
"message": "包管理工具"
22+
},
23+
"sidebar.user_docs.category.Package Management Tools": {
24+
"message": "包管理工具"
25+
},
26+
"sidebar.user_docs.category.How to": {
27+
"message": "如何使用"
28+
},
29+
"sidebar.user_docs.category.Schema Definition": {
30+
"message": "模型定义"
31+
},
32+
"sidebar.user_docs.category.Validation": {
33+
"message": "验证"
34+
},
35+
"sidebar.user_docs.category.Concepts": {
36+
"message": "核心概念"
37+
},
38+
"sidebar.user_docs.category.FAQ": {
39+
"message": "常见问答"
40+
},
41+
"sidebar.reference.category.Tutorial": {
42+
"message": "教程"
43+
},
44+
"sidebar.reference.category.Code Lab": {
45+
"message": "代码实验室"
46+
},
47+
"sidebar.reference.category.Spec": {
48+
"message": "语言规范"
49+
},
50+
"sidebar.reference.category.Errors and Warnings": {
51+
"message": "错误与警告"
52+
},
53+
"sidebar.reference.category.Types": {
54+
"message": "类型系统"
55+
},
56+
"sidebar.reference.category.System Package": {
57+
"message": "系统模块"
58+
},
59+
"sidebar.reference.category.Plugin System": {
60+
"message": "插件系统"
61+
},
62+
"sidebar.reference.category.Multi-Language": {
63+
"message": "多语言集成"
64+
},
65+
"sidebar.reference.category.Cheat Sheet": {
66+
"message": "备忘表"
67+
},
68+
"sidebar.reference.category.Package Management": {
69+
"message": "包管理工具"
70+
},
71+
"sidebar.reference.category.Command Reference": {
72+
"message": "命令参考"
73+
},
74+
"sidebar.reference.category.Advanced-Concepts": {
75+
"message": "进阶概念"
76+
},
77+
"sidebar.reference.category.Best-Practices": {
78+
"message": "最佳实践"
79+
},
80+
"sidebar.tools.category.Command Line Tools": {
81+
"message": "命令行工具"
82+
},
83+
"sidebar.tools.category.KCL Tools": {
84+
"message": "语言工具"
85+
},
86+
"sidebar.tools.category.Package Management Tools": {
87+
"message": "包管理工具"
88+
},
89+
"sidebar.tools.category.OpenAPI Tools": {
90+
"message": "OpenAPI 工具"
91+
},
92+
"sidebar.community.category.Community": {
93+
"message": "简介"
94+
},
95+
"sidebar.community.category.Types": {
96+
"message": "类型系统"
97+
},
98+
"sidebar.community.category.Contribution Guide": {
99+
"message": "贡献指南"
100+
},
101+
"sidebar.community.category.Release Policy": {
102+
"message": "发布策略"
103+
},
104+
"sidebar.docs.category.GitOps": {
105+
"message": "GitOps",
106+
"description": "The label for category GitOps in sidebar docs"
107+
},
108+
"sidebar.docs.category.CI Integration": {
109+
"message": "CI 集成",
110+
"description": "The label for category CI Integration in sidebar docs"
111+
},
112+
"sidebar.user_docs.category.GitOps": {
113+
"message": "GitOps",
114+
"description": "The label for category GitOps in sidebar user_docs"
115+
},
116+
"sidebar.user_docs.category.CI Integration": {
117+
"message": "CI 集成",
118+
"description": "The label for category CI Integration in sidebar user_docs"
119+
},
120+
"sidebar.docs.category.Mutate or Validate Kubernetes Manifests": {
121+
"message": "编辑或验证 Kubernetes 资源",
122+
"description": "The label for category Mutate or Validate Kubernetes Manifests in sidebar docs"
123+
},
124+
"sidebar.user_docs.category.Mutate or Validate Kubernetes Manifests": {
125+
"message": "编辑或验证 Kubernetes 资源",
126+
"description": "The label for category Mutate or Validate Kubernetes Manifests in sidebar user_docs"
127+
},
128+
"sidebar.docs.category.Secret Management": {
129+
"message": "敏感信息管理",
130+
"description": "The label for category Secret Management in sidebar docs"
131+
},
132+
"sidebar.user_docs.category.Secret Management": {
133+
"message": "敏感信息管理",
134+
"description": "The label for category Secret Management in sidebar user_docs"
135+
}
136+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"label": "社区",
3+
"position": 5
4+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"label": "贡献指南",
3+
"position": 4
4+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
sidebar_position: 2
3+
---
4+
5+
# 如何贡献代码?
6+
7+
欢迎参与 KCL 共建贡献完善代码、完善代码文档和测试,同时也欢迎通过 Issue 提供反馈。本文主要针对修改和完善已有的代码,如果是希望增加 KCL 语言特性请通过 KEP 流程提交。
8+
9+
## 1. 代码和注释中的错别字
10+
11+
如果只是修改代码和注释中的错别字,不涉及代码逻辑的调整,那么可以直接在 Github 克隆仓库后直接修改并提交 PR。需要注意的是尽量保持代码风格一致。
12+
13+
## 2. 如何贡献 KCL 代码
14+
15+
- 先确保本地测试环境正常
16+
- 修改代码并补充测试
17+
- 本地测试通过后提交 PR
18+
19+
## 3. 如何贡献 VS Code 插件代码
20+
21+
请参考 VS Code 插件仓库的相关文档
22+
23+
## 4. 开发流程相关代码
24+
25+
欢迎通过 Issue 和讨论组讨论。

0 commit comments

Comments
 (0)