+ +The content of `schema.k` is + +```python +schema AppConfig: + replicas: int + +app: AppConfig { + replicas: 2 +} +``` + +Node.js Code + +```ts +import { execProgram, ExecProgramArgs } from "kcl-lib"; + +const result = execProgram(new ExecProgramArgs(["schema.k"])); +``` + +
++ +```ts +import { execProgram, ExecProgramArgs } from "kcl-lib"; + +try { + const result = execProgram(new ExecProgramArgs(["file_not_found.k"])); +} catch (error) { + console.log(error.message); +} +``` + +
++ +The content of `schema.k` is + +```python +schema AppConfig: + replicas: int + +app: AppConfig { + replicas: 2 +} +``` + +Node.js Code + +```ts +import { parseProgram, ParseProgramArgs } from "kcl-lib"; + +const result = parseProgram(new ParseProgramArgs(["schema.k"])); +``` + +
++ +The content of `schema.k` is + +```python +schema AppConfig: + replicas: int + +app: AppConfig { + replicas: 2 +} +``` + +Node.js Code + +```ts +import { parseFile, ParseFileArgs } from "kcl-lib"; + +const result = parseFile(new ParseFileArgs("schema.k")); +``` + +
++ +The content of `schema.k` is + +```python +schema AppConfig: + replicas: int + +app: AppConfig { + replicas: 2 +} +``` + +Node.js Code + +```ts +import { parseProgram, ParseProgramArgs } from "kcl-lib"; + +const result = parseProgram(new ParseProgramArgs(["schema.k"])); +``` + +
++ +The content of `schema.k` is + +```python +schema AppConfig: + replicas: int + +app: AppConfig { + replicas: 2 +} +``` + +Node.js Code + +```ts +import { loadPackage, LoadPackageArgs } from "kcl-lib"; + +const result = loadPackage(new LoadPackageArgs(["schema.k"], [], true)); +``` + +
++ +The content of `schema.k` is + +```python +schema AppConfig: + replicas: int + +app: AppConfig { + replicas: 2 +} +``` + +Node.js Code + +```ts +import { listVariables, ListVariablesArgs } from "kcl-lib"; + +const result = listVariables(new ListVariablesArgs(["schema.k"], [])); +``` + +
++ +The content of `options.k` is + +```python +a = option("key1") +b = option("key2", required=True) +c = { + metadata.key = option("metadata-key") +} +``` + +Node.js Code + +```ts +import { listOptions, ListOptionsArgs } from "kcl-lib"; + +const result = listOptions(new ListOptionsArgs(["options.k"])); +``` + +
++ +The content of `schema.k` is + +```python +schema AppConfig: + replicas: int + +app: AppConfig { + replicas: 2 +} +``` + +Node.js Code + +```ts +import { getSchemaTypeMapping, GetSchemaTypeMappingArgs } from "kcl-lib"; + +const result = getSchemaTypeMapping(new GetSchemaTypeMappingArgs(["schema.k"])); +``` + +
++ +The content of `main.k` is + +```python +schema AppConfig: + replicas: int + +app: AppConfig {replicas: 4} +``` + +Node.js Code + +```ts +import { overrideFile, OverrideFileArgs } from "kcl-lib"; + +const result = overrideFile( + new OverrideFileArgs("main.k", ["app.replicas=4"], []) +); +``` + +
++ +Node.js Code + +```ts +import { formatCode, FormatCodeArgs } from "kcl-lib"; + +const schemaCode = ` +schema Person: + name: str + age: int + + check: + 0 < age < 120 +`; +const result = formatCode(new FormatCodeArgs(schemaCode)); +console.log(result.formatted); +``` + +
++ +The content of `format_path.k` is + +```python +schema Person: + name: str + age: int + + check: + 0 < age < 120 +``` + +Node.js Code + +```ts +import { formatPath, FormatPathArgs } from "kcl-lib"; + +const result = formatPath(new FormatPathArgs("format_path.k")); +``` + +
++ +The content of `lint_path.k` is + +```python +import math + +a = 1 +``` + +Node.js Code + +```ts +import { lintPath, LintPathArgs } from "kcl-lib"; + +const result = lintPath(new LintPathArgs(["lint_path.k"])); +``` + +
++ +Node.js Code + +```ts +import { validateCode, ValidateCodeArgs } from "kcl-lib"; + +const code = ` +schema Person: + name: str + age: int + + check: + 0 < age < 120 +`; +const data = '{"name": "Alice", "age": 10}'; +const result = validateCode( + new ValidateCodeArgs(undefined, data, undefined, code) +); +``` + +
++ +The content of `main.k` is + +```python +a = 1 +b = a +``` + +Node.js Code + +```ts +import { rename, RenameArgs } from "kcl-lib"; + +const args = new RenameArgs(".", "a", ["main.k"], "a2"); +const result = rename(args); +``` + +
++ +Node.js Code + +```ts +import { renameCode, RenameCodeArgs } from "kcl-lib"; + +const args = RenameCodeArgs( + "/mock/path", + "a", + { "/mock/path/main.k": "a = 1\nb = a" }, + "a2" +); +const result = renameCode(args); +``` + +
++ +Node.js Code + +```ts +import { test as kclTest, TestArgs } from "kcl-lib"; + +const result = kclTest(new TestArgs(["/path/to/test/module/..."])); +``` + +
++ +The content of `kcl.yaml` is + +```yaml +kcl_cli_configs: + strict_range_check: true +kcl_options: + - key: key + value: value +``` + +Node.js Code + +```ts +import { loadSettingsFiles, LoadSettingsFilesArgs } from "kcl-lib"; + +const result = loadSettingsFiles(new LoadSettingsFilesArgs(".", ["kcl.yaml"])); +``` + +
++ +The content of `module/kcl.mod` is + +```yaml +[package] +name = "mod_update" +edition = "0.0.1" +version = "0.0.1" + +[dependencies] +helloworld = { oci = "oci://ghcr.io/kcl-lang/helloworld", tag = "0.1.0" } +flask = { git = "https://github.com/kcl-lang/flask-demo-kcl-manifests", commit = "ade147b" } +``` + +Node.js Code + +```ts +import { updateDependencies, UpdateDependenciesArgs } from "kcl-lib"; + +const result = updateDependencies(new UpdateDependenciesArgs("module", false)); +``` + +
++ +The content of `module/kcl.mod` is + +```yaml +[package] +name = "mod_update" +edition = "0.0.1" +version = "0.0.1" + +[dependencies] +helloworld = { oci = "oci://ghcr.io/kcl-lang/helloworld", tag = "0.1.0" } +flask = { git = "https://github.com/kcl-lang/flask-demo-kcl-manifests", commit = "ade147b" } +``` + +The content of `module/main.k` is + +```python +import helloworld +import flask + +a = helloworld.The_first_kcl_program +``` + +Node.js Code + +```ts +import { + execProgram, + ExecProgramArgs, + updateDependencies, + UpdateDependenciesArgs, +} from "../index.js"; + +const result = updateDependencies(new UpdateDependenciesArgs("module", false)); +const execResult = execProgram( + new ExecProgramArgs( + ["module/main.k"], + undefined, + undefined, + undefined, + undefined, + undefined, + undefined, + undefined, + undefined, + undefined, + result.externalPkgs + ) +); +``` + +
++ +Node.js Code + +```ts +import { getVersion } from "../index.js"; + +const result = getVersion(); +console.log(result.versionInfo); +``` + +
++ +The content of `schema.k` is + +```python +schema AppConfig: + replicas: int + +app: AppConfig { + replicas: 2 +} +``` + +Node.js Code + +```ts +import { execProgram, ExecProgramArgs } from "kcl-lib"; + +const result = execProgram(new ExecProgramArgs(["schema.k"])); +``` + +
++ +```ts +import { execProgram, ExecProgramArgs } from "kcl-lib"; + +try { + const result = execProgram(new ExecProgramArgs(["file_not_found.k"])); +} catch (error) { + console.log(error.message); +} +``` + +
++ +The content of `schema.k` is + +```python +schema AppConfig: + replicas: int + +app: AppConfig { + replicas: 2 +} +``` + +Node.js Code + +```ts +import { parseProgram, ParseProgramArgs } from "kcl-lib"; + +const result = parseProgram(new ParseProgramArgs(["schema.k"])); +``` + +
++ +The content of `schema.k` is + +```python +schema AppConfig: + replicas: int + +app: AppConfig { + replicas: 2 +} +``` + +Node.js Code + +```ts +import { parseFile, ParseFileArgs } from "kcl-lib"; + +const result = parseFile(new ParseFileArgs("schema.k")); +``` + +
++ +The content of `schema.k` is + +```python +schema AppConfig: + replicas: int + +app: AppConfig { + replicas: 2 +} +``` + +Node.js Code + +```ts +import { parseProgram, ParseProgramArgs } from "kcl-lib"; + +const result = parseProgram(new ParseProgramArgs(["schema.k"])); +``` + +
++ +The content of `schema.k` is + +```python +schema AppConfig: + replicas: int + +app: AppConfig { + replicas: 2 +} +``` + +Node.js Code + +```ts +import { loadPackage, LoadPackageArgs } from "kcl-lib"; + +const result = loadPackage(new LoadPackageArgs(["schema.k"], [], true)); +``` + +
++ +The content of `schema.k` is + +```python +schema AppConfig: + replicas: int + +app: AppConfig { + replicas: 2 +} +``` + +Node.js Code + +```ts +import { listVariables, ListVariablesArgs } from "kcl-lib"; + +const result = listVariables(new ListVariablesArgs(["schema.k"], [])); +``` + +
++ +The content of `options.k` is + +```python +a = option("key1") +b = option("key2", required=True) +c = { + metadata.key = option("metadata-key") +} +``` + +Node.js Code + +```ts +import { listOptions, ListOptionsArgs } from "kcl-lib"; + +const result = listOptions(new ListOptionsArgs(["options.k"])); +``` + +
++ +The content of `schema.k` is + +```python +schema AppConfig: + replicas: int + +app: AppConfig { + replicas: 2 +} +``` + +Node.js Code + +```ts +import { getSchemaTypeMapping, GetSchemaTypeMappingArgs } from "kcl-lib"; + +const result = getSchemaTypeMapping(new GetSchemaTypeMappingArgs(["schema.k"])); +``` + +
++ +The content of `main.k` is + +```python +schema AppConfig: + replicas: int + +app: AppConfig {replicas: 4} +``` + +Node.js Code + +```ts +import { overrideFile, OverrideFileArgs } from "kcl-lib"; + +const result = overrideFile( + new OverrideFileArgs("main.k", ["app.replicas=4"], []) +); +``` + +
++ +Node.js Code + +```ts +import { formatCode, FormatCodeArgs } from "kcl-lib"; + +const schemaCode = ` +schema Person: + name: str + age: int + + check: + 0 < age < 120 +`; +const result = formatCode(new FormatCodeArgs(schemaCode)); +console.log(result.formatted); +``` + +
++ +The content of `format_path.k` is + +```python +schema Person: + name: str + age: int + + check: + 0 < age < 120 +``` + +Node.js Code + +```ts +import { formatPath, FormatPathArgs } from "kcl-lib"; + +const result = formatPath(new FormatPathArgs("format_path.k")); +``` + +
++ +The content of `lint_path.k` is + +```python +import math + +a = 1 +``` + +Node.js Code + +```ts +import { lintPath, LintPathArgs } from "kcl-lib"; + +const result = lintPath(new LintPathArgs(["lint_path.k"])); +``` + +
++ +Node.js Code + +```ts +import { validateCode, ValidateCodeArgs } from "kcl-lib"; + +const code = ` +schema Person: + name: str + age: int + + check: + 0 < age < 120 +`; +const data = '{"name": "Alice", "age": 10}'; +const result = validateCode( + new ValidateCodeArgs(undefined, data, undefined, code) +); +``` + +
++ +The content of `main.k` is + +```python +a = 1 +b = a +``` + +Node.js Code + +```ts +import { rename, RenameArgs } from "kcl-lib"; + +const args = new RenameArgs(".", "a", ["main.k"], "a2"); +const result = rename(args); +``` + +
++ +Node.js Code + +```ts +import { renameCode, RenameCodeArgs } from "kcl-lib"; + +const args = RenameCodeArgs( + "/mock/path", + "a", + { "/mock/path/main.k": "a = 1\nb = a" }, + "a2" +); +const result = renameCode(args); +``` + +
++ +Node.js Code + +```ts +import { test as kclTest, TestArgs } from "kcl-lib"; + +const result = kclTest(new TestArgs(["/path/to/test/module/..."])); +``` + +
++ +The content of `kcl.yaml` is + +```yaml +kcl_cli_configs: + strict_range_check: true +kcl_options: + - key: key + value: value +``` + +Node.js Code + +```ts +import { loadSettingsFiles, LoadSettingsFilesArgs } from "kcl-lib"; + +const result = loadSettingsFiles(new LoadSettingsFilesArgs(".", ["kcl.yaml"])); +``` + +
++ +The content of `module/kcl.mod` is + +```yaml +[package] +name = "mod_update" +edition = "0.0.1" +version = "0.0.1" + +[dependencies] +helloworld = { oci = "oci://ghcr.io/kcl-lang/helloworld", tag = "0.1.0" } +flask = { git = "https://github.com/kcl-lang/flask-demo-kcl-manifests", commit = "ade147b" } +``` + +Node.js Code + +```ts +import { updateDependencies, UpdateDependenciesArgs } from "kcl-lib"; + +const result = updateDependencies(new UpdateDependenciesArgs("module", false)); +``` + +
++ +The content of `module/kcl.mod` is + +```yaml +[package] +name = "mod_update" +edition = "0.0.1" +version = "0.0.1" + +[dependencies] +helloworld = { oci = "oci://ghcr.io/kcl-lang/helloworld", tag = "0.1.0" } +flask = { git = "https://github.com/kcl-lang/flask-demo-kcl-manifests", commit = "ade147b" } +``` + +The content of `module/main.k` is + +```python +import helloworld +import flask + +a = helloworld.The_first_kcl_program +``` + +Node.js Code + +```ts +import { + execProgram, + ExecProgramArgs, + updateDependencies, + UpdateDependenciesArgs, +} from "../index.js"; + +const result = updateDependencies(new UpdateDependenciesArgs("module", false)); +const execResult = execProgram( + new ExecProgramArgs( + ["module/main.k"], + undefined, + undefined, + undefined, + undefined, + undefined, + undefined, + undefined, + undefined, + undefined, + result.externalPkgs + ) +); +``` + +
++ +Node.js Code + +```ts +import { getVersion } from "../index.js"; + +const result = getVersion(); +console.log(result.versionInfo); +``` + +
++ +The content of `schema.k` is + +```python +schema AppConfig: + replicas: int + +app: AppConfig { + replicas: 2 +} +``` + +Node.js Code + +```ts +import { execProgram, ExecProgramArgs } from "kcl-lib"; + +const result = execProgram(new ExecProgramArgs(["schema.k"])); +``` + +
++ +```ts +import { execProgram, ExecProgramArgs } from "kcl-lib"; + +try { + const result = execProgram(new ExecProgramArgs(["file_not_found.k"])); +} catch (error) { + console.log(error.message); +} +``` + +
++ +The content of `schema.k` is + +```python +schema AppConfig: + replicas: int + +app: AppConfig { + replicas: 2 +} +``` + +Node.js Code + +```ts +import { parseProgram, ParseProgramArgs } from "kcl-lib"; + +const result = parseProgram(new ParseProgramArgs(["schema.k"])); +``` + +
++ +The content of `schema.k` is + +```python +schema AppConfig: + replicas: int + +app: AppConfig { + replicas: 2 +} +``` + +Node.js Code + +```ts +import { parseFile, ParseFileArgs } from "kcl-lib"; + +const result = parseFile(new ParseFileArgs("schema.k")); +``` + +
++ +The content of `schema.k` is + +```python +schema AppConfig: + replicas: int + +app: AppConfig { + replicas: 2 +} +``` + +Node.js Code + +```ts +import { parseProgram, ParseProgramArgs } from "kcl-lib"; + +const result = parseProgram(new ParseProgramArgs(["schema.k"])); +``` + +
++ +The content of `schema.k` is + +```python +schema AppConfig: + replicas: int + +app: AppConfig { + replicas: 2 +} +``` + +Node.js Code + +```ts +import { loadPackage, LoadPackageArgs } from "kcl-lib"; + +const result = loadPackage(new LoadPackageArgs(["schema.k"], [], true)); +``` + +
++ +The content of `schema.k` is + +```python +schema AppConfig: + replicas: int + +app: AppConfig { + replicas: 2 +} +``` + +Node.js Code + +```ts +import { listVariables, ListVariablesArgs } from "kcl-lib"; + +const result = listVariables(new ListVariablesArgs(["schema.k"], [])); +``` + +
++ +The content of `options.k` is + +```python +a = option("key1") +b = option("key2", required=True) +c = { + metadata.key = option("metadata-key") +} +``` + +Node.js Code + +```ts +import { listOptions, ListOptionsArgs } from "kcl-lib"; + +const result = listOptions(new ListOptionsArgs(["options.k"])); +``` + +
++ +The content of `schema.k` is + +```python +schema AppConfig: + replicas: int + +app: AppConfig { + replicas: 2 +} +``` + +Node.js Code + +```ts +import { getSchemaTypeMapping, GetSchemaTypeMappingArgs } from "kcl-lib"; + +const result = getSchemaTypeMapping(new GetSchemaTypeMappingArgs(["schema.k"])); +``` + +
++ +The content of `main.k` is + +```python +schema AppConfig: + replicas: int + +app: AppConfig {replicas: 4} +``` + +Node.js Code + +```ts +import { overrideFile, OverrideFileArgs } from "kcl-lib"; + +const result = overrideFile( + new OverrideFileArgs("main.k", ["app.replicas=4"], []) +); +``` + +
++ +Node.js Code + +```ts +import { formatCode, FormatCodeArgs } from "kcl-lib"; + +const schemaCode = ` +schema Person: + name: str + age: int + + check: + 0 < age < 120 +`; +const result = formatCode(new FormatCodeArgs(schemaCode)); +console.log(result.formatted); +``` + +
++ +The content of `format_path.k` is + +```python +schema Person: + name: str + age: int + + check: + 0 < age < 120 +``` + +Node.js Code + +```ts +import { formatPath, FormatPathArgs } from "kcl-lib"; + +const result = formatPath(new FormatPathArgs("format_path.k")); +``` + +
++ +The content of `lint_path.k` is + +```python +import math + +a = 1 +``` + +Node.js Code + +```ts +import { lintPath, LintPathArgs } from "kcl-lib"; + +const result = lintPath(new LintPathArgs(["lint_path.k"])); +``` + +
++ +Node.js Code + +```ts +import { validateCode, ValidateCodeArgs } from "kcl-lib"; + +const code = ` +schema Person: + name: str + age: int + + check: + 0 < age < 120 +`; +const data = '{"name": "Alice", "age": 10}'; +const result = validateCode( + new ValidateCodeArgs(undefined, data, undefined, code) +); +``` + +
++ +The content of `main.k` is + +```python +a = 1 +b = a +``` + +Node.js Code + +```ts +import { rename, RenameArgs } from "kcl-lib"; + +const args = new RenameArgs(".", "a", ["main.k"], "a2"); +const result = rename(args); +``` + +
++ +Node.js Code + +```ts +import { renameCode, RenameCodeArgs } from "kcl-lib"; + +const args = RenameCodeArgs( + "/mock/path", + "a", + { "/mock/path/main.k": "a = 1\nb = a" }, + "a2" +); +const result = renameCode(args); +``` + +
++ +Node.js Code + +```ts +import { test as kclTest, TestArgs } from "kcl-lib"; + +const result = kclTest(new TestArgs(["/path/to/test/module/..."])); +``` + +
++ +The content of `kcl.yaml` is + +```yaml +kcl_cli_configs: + strict_range_check: true +kcl_options: + - key: key + value: value +``` + +Node.js Code + +```ts +import { loadSettingsFiles, LoadSettingsFilesArgs } from "kcl-lib"; + +const result = loadSettingsFiles(new LoadSettingsFilesArgs(".", ["kcl.yaml"])); +``` + +
++ +The content of `module/kcl.mod` is + +```yaml +[package] +name = "mod_update" +edition = "0.0.1" +version = "0.0.1" + +[dependencies] +helloworld = { oci = "oci://ghcr.io/kcl-lang/helloworld", tag = "0.1.0" } +flask = { git = "https://github.com/kcl-lang/flask-demo-kcl-manifests", commit = "ade147b" } +``` + +Node.js Code + +```ts +import { updateDependencies, UpdateDependenciesArgs } from "kcl-lib"; + +const result = updateDependencies(new UpdateDependenciesArgs("module", false)); +``` + +
++ +The content of `module/kcl.mod` is + +```yaml +[package] +name = "mod_update" +edition = "0.0.1" +version = "0.0.1" + +[dependencies] +helloworld = { oci = "oci://ghcr.io/kcl-lang/helloworld", tag = "0.1.0" } +flask = { git = "https://github.com/kcl-lang/flask-demo-kcl-manifests", commit = "ade147b" } +``` + +The content of `module/main.k` is + +```python +import helloworld +import flask + +a = helloworld.The_first_kcl_program +``` + +Node.js Code + +```ts +import { + execProgram, + ExecProgramArgs, + updateDependencies, + UpdateDependenciesArgs, +} from "../index.js"; + +const result = updateDependencies(new UpdateDependenciesArgs("module", false)); +const execResult = execProgram( + new ExecProgramArgs( + ["module/main.k"], + undefined, + undefined, + undefined, + undefined, + undefined, + undefined, + undefined, + undefined, + undefined, + result.externalPkgs + ) +); +``` + +
++ +Node.js Code + +```ts +import { getVersion } from "../index.js"; + +const result = getVersion(); +console.log(result.versionInfo); +``` + +
++ +The content of `schema.k` is + +```python +schema AppConfig: + replicas: int + +app: AppConfig { + replicas: 2 +} +``` + +Node.js Code + +```ts +import { execProgram, ExecProgramArgs } from "kcl-lib"; + +const result = execProgram(new ExecProgramArgs(["schema.k"])); +``` + +
++ +```ts +import { execProgram, ExecProgramArgs } from "kcl-lib"; + +try { + const result = execProgram(new ExecProgramArgs(["file_not_found.k"])); +} catch (error) { + console.log(error.message); +} +``` + +
++ +The content of `schema.k` is + +```python +schema AppConfig: + replicas: int + +app: AppConfig { + replicas: 2 +} +``` + +Node.js Code + +```ts +import { parseProgram, ParseProgramArgs } from "kcl-lib"; + +const result = parseProgram(new ParseProgramArgs(["schema.k"])); +``` + +
++ +The content of `schema.k` is + +```python +schema AppConfig: + replicas: int + +app: AppConfig { + replicas: 2 +} +``` + +Node.js Code + +```ts +import { parseFile, ParseFileArgs } from "kcl-lib"; + +const result = parseFile(new ParseFileArgs("schema.k")); +``` + +
++ +The content of `schema.k` is + +```python +schema AppConfig: + replicas: int + +app: AppConfig { + replicas: 2 +} +``` + +Node.js Code + +```ts +import { parseProgram, ParseProgramArgs } from "kcl-lib"; + +const result = parseProgram(new ParseProgramArgs(["schema.k"])); +``` + +
++ +The content of `schema.k` is + +```python +schema AppConfig: + replicas: int + +app: AppConfig { + replicas: 2 +} +``` + +Node.js Code + +```ts +import { loadPackage, LoadPackageArgs } from "kcl-lib"; + +const result = loadPackage(new LoadPackageArgs(["schema.k"], [], true)); +``` + +
++ +The content of `schema.k` is + +```python +schema AppConfig: + replicas: int + +app: AppConfig { + replicas: 2 +} +``` + +Node.js Code + +```ts +import { listVariables, ListVariablesArgs } from "kcl-lib"; + +const result = listVariables(new ListVariablesArgs(["schema.k"], [])); +``` + +
++ +The content of `options.k` is + +```python +a = option("key1") +b = option("key2", required=True) +c = { + metadata.key = option("metadata-key") +} +``` + +Node.js Code + +```ts +import { listOptions, ListOptionsArgs } from "kcl-lib"; + +const result = listOptions(new ListOptionsArgs(["options.k"])); +``` + +
++ +The content of `schema.k` is + +```python +schema AppConfig: + replicas: int + +app: AppConfig { + replicas: 2 +} +``` + +Node.js Code + +```ts +import { getSchemaTypeMapping, GetSchemaTypeMappingArgs } from "kcl-lib"; + +const result = getSchemaTypeMapping(new GetSchemaTypeMappingArgs(["schema.k"])); +``` + +
++ +The content of `main.k` is + +```python +schema AppConfig: + replicas: int + +app: AppConfig {replicas: 4} +``` + +Node.js Code + +```ts +import { overrideFile, OverrideFileArgs } from "kcl-lib"; + +const result = overrideFile( + new OverrideFileArgs("main.k", ["app.replicas=4"], []) +); +``` + +
++ +Node.js Code + +```ts +import { formatCode, FormatCodeArgs } from "kcl-lib"; + +const schemaCode = ` +schema Person: + name: str + age: int + + check: + 0 < age < 120 +`; +const result = formatCode(new FormatCodeArgs(schemaCode)); +console.log(result.formatted); +``` + +
++ +The content of `format_path.k` is + +```python +schema Person: + name: str + age: int + + check: + 0 < age < 120 +``` + +Node.js Code + +```ts +import { formatPath, FormatPathArgs } from "kcl-lib"; + +const result = formatPath(new FormatPathArgs("format_path.k")); +``` + +
++ +The content of `lint_path.k` is + +```python +import math + +a = 1 +``` + +Node.js Code + +```ts +import { lintPath, LintPathArgs } from "kcl-lib"; + +const result = lintPath(new LintPathArgs(["lint_path.k"])); +``` + +
++ +Node.js Code + +```ts +import { validateCode, ValidateCodeArgs } from "kcl-lib"; + +const code = ` +schema Person: + name: str + age: int + + check: + 0 < age < 120 +`; +const data = '{"name": "Alice", "age": 10}'; +const result = validateCode( + new ValidateCodeArgs(undefined, data, undefined, code) +); +``` + +
++ +The content of `main.k` is + +```python +a = 1 +b = a +``` + +Node.js Code + +```ts +import { rename, RenameArgs } from "kcl-lib"; + +const args = new RenameArgs(".", "a", ["main.k"], "a2"); +const result = rename(args); +``` + +
++ +Node.js Code + +```ts +import { renameCode, RenameCodeArgs } from "kcl-lib"; + +const args = RenameCodeArgs( + "/mock/path", + "a", + { "/mock/path/main.k": "a = 1\nb = a" }, + "a2" +); +const result = renameCode(args); +``` + +
++ +Node.js Code + +```ts +import { test as kclTest, TestArgs } from "kcl-lib"; + +const result = kclTest(new TestArgs(["/path/to/test/module/..."])); +``` + +
++ +The content of `kcl.yaml` is + +```yaml +kcl_cli_configs: + strict_range_check: true +kcl_options: + - key: key + value: value +``` + +Node.js Code + +```ts +import { loadSettingsFiles, LoadSettingsFilesArgs } from "kcl-lib"; + +const result = loadSettingsFiles(new LoadSettingsFilesArgs(".", ["kcl.yaml"])); +``` + +
++ +The content of `module/kcl.mod` is + +```yaml +[package] +name = "mod_update" +edition = "0.0.1" +version = "0.0.1" + +[dependencies] +helloworld = { oci = "oci://ghcr.io/kcl-lang/helloworld", tag = "0.1.0" } +flask = { git = "https://github.com/kcl-lang/flask-demo-kcl-manifests", commit = "ade147b" } +``` + +Node.js Code + +```ts +import { updateDependencies, UpdateDependenciesArgs } from "kcl-lib"; + +const result = updateDependencies(new UpdateDependenciesArgs("module", false)); +``` + +
++ +The content of `module/kcl.mod` is + +```yaml +[package] +name = "mod_update" +edition = "0.0.1" +version = "0.0.1" + +[dependencies] +helloworld = { oci = "oci://ghcr.io/kcl-lang/helloworld", tag = "0.1.0" } +flask = { git = "https://github.com/kcl-lang/flask-demo-kcl-manifests", commit = "ade147b" } +``` + +The content of `module/main.k` is + +```python +import helloworld +import flask + +a = helloworld.The_first_kcl_program +``` + +Node.js Code + +```ts +import { + execProgram, + ExecProgramArgs, + updateDependencies, + UpdateDependenciesArgs, +} from "../index.js"; + +const result = updateDependencies(new UpdateDependenciesArgs("module", false)); +const execResult = execProgram( + new ExecProgramArgs( + ["module/main.k"], + undefined, + undefined, + undefined, + undefined, + undefined, + undefined, + undefined, + undefined, + undefined, + result.externalPkgs + ) +); +``` + +
++ +Node.js Code + +```ts +import { getVersion } from "../index.js"; + +const result = getVersion(); +console.log(result.versionInfo); +``` + +
+