KScript 문서
KO

언어

영어에서 자동 번역되었습니다. 원문은 영어입니다.

변경 사항

KScript에는 이제 각 기능을 작성하는 방법이 하나뿐입니다. 이 페이지에는 이름이 바뀌었거나 제거된 모든 표기가 나열되어 있으며, 그 대신 무엇을 써야 하는지도 함께 안내합니다.

조용히 실패하는 경우는 없으며, 이전 표기가 계속 동작하지도 않습니다. .kscript 파일에서 이전 표기를 쓰면 새 표기를 알려 주는 오류가 발생합니다. 스크립트는 실행되지 않고, 편집기와 kscript check도 같은 내용을 알려 줍니다. 대부분은 수정 방법도 함께 안내됩니다.

명령어기능
kscript check --fix다시 쓸 수 있는 부분은 프로젝트의 모든 스크립트에서 다시 씁니다.
kscript check그다음 남은 부분을 확인하세요.

kscript check --fix는 아래에서 fix로 표시된 표기를 바꾸고, 이름만 바뀐 문과 인수를 새 이름으로 바꿉니다. 이런 표기 때문에 실행되지 않는 파일도 이 방식으로 고칠 수 있습니다. 나머지는 무엇을 써야 하는지 메시지로 알려 주는 오류이며, 편집기는 대부분에 대해 빠른 수정 기능을 제공합니다.

경고로 남는 항목은 표기 문제가 아니라 스타일 문제입니다. return 뒤에 오는 else(KS6001), 사용되지 않는 코드(KS6002~KS6005), 타입이 없는 매개변수(KS6007), 한 파일 안의 두 번째 타입(KS6008), snake_case나 PascalCase가 아닌 이름(KS6013), 단위가 없는 시간 길이(KS6018), 채울 내용이 없는 큰따옴표 텍스트(KS6020)가 여기에 해당합니다. XML 스크립트는 lt, 속성의 쉼표 목록, fields="x: int, y: int"처럼 XML 고유의 형식을 그대로 유지합니다.

텍스트, 이름, 값

이전 지금
Section(title: Results) Section(title: "Results"): 인수의 텍스트는 따옴표로 감싸고, 따옴표 없는 단어는 이름입니다 fix (KS6009)
Button(on_click: "count += 1") Button(on_click: $count += 1) 또는 on_click: { $count += 1 }: 큰따옴표는 항상 텍스트를 만듭니다
'Hello $name' "Hello { $name }": 큰따옴표 안의 중괄호는 식을 평가합니다. 작은따옴표는 텍스트를 그대로 유지합니다
$route = "/users/{id}", "\d{3}", "a { color: red }" '/users/{id}', '\d{3}', 'a { color: red }', 또는 중괄호 두 번("/users/{{id}}"): 큰따옴표 안의 { }는 무엇으로 시작하든 항상 식을 담으므로, "{ User->count() } users"와 "{ 1 + 2 }"가 값으로 채워집니다
total = 3, total += 1, const tax = 0.2 $total = 3, $total += 1, const $tax = 0.2: 변수는 설정되는 곳에도 $를 가집니다 fix (KS6010)
fn($n) => $n * 2 fn(n) => $n * 2 fix (KS6010)
numbered: no, new_page: yes numbered: false, new_page: true (또는 플래그만: new_page) fix (KS6011)
spawn(fn: job), tools: lookup spawn(fn: @job), tools: [@lookup]: 함수는 @name와 같이 이름 붙입니다 fix (KS6012)
files: "settings, .env" files: ['settings', '.env']: 리스트는 배열입니다 fix (KS6006)
timeout: 30, ttl: '10m' timeout: 30s, ttl: 10m: 시간 길이는 단위를 붙이고 따옴표는 쓰지 않습니다 fix (KS6018)

구문과 연산자

이전 지금
if $n lt 10, ge, eq, ne는 .kscript 파일에서 if $n < 10, >=, ==, != (XML은 단어를 유지하며, and, or, not는 두 경우 모두 단어로 남습니다) fix (KS6012)
} else if $b { } elif $b { fix (KS6012)
input(into = name) input(into: name) fix (KS6012)
catch NotFound, Conflict as e catch NotFound | Conflict as e fix (KS6012)
catch err when $err.type == 'NotFound' catch NotFound as err(when는 여전히 테스트를 추가합니다)
match $n { case 1 { } default { } } match $n { 1 => { } _ => { } }, match 식과 같은 분기
test(name: "x", each: n, in: [1, 2], index: i) { } for n at i in [1, 2] { test(name: "x {$n}") { } }
KScript.Window(title: "Hi") { }, KScript.input(...) import KScript.UI, 그다음 Window(title: "Hi") { }: 패키지는 import에서만 이름이 주어지며, 아무것도 조용히 가져오지 않습니다

타입, 모델, 오류

스크립트가 ->type()를 'list'와 비교한다면, 그 검사를 ->is_a(list)로 바꾸세요. 이제 타입 이름에는 'number[]' 또는 'any[]'처럼 요소 타입이 포함됩니다.

이전 지금
$Repo, as: $Repo, $User->create(...) Repo, as: Repo, User->create(...): 타입은 괄호 없이 이름만 씁니다 fix (KS6014)
Repo->from($data), $Repo->new(name: 'x'), $OutOfStock->new(item: 'tea') Repo($data), Repo(name: 'x'), OutOfStock(item: 'tea'): 이름을 호출하면 값이 만들어집니다
타입이나 모델의 age: int? age?: int (널일 수 있는 매개변수에는 T?가 그대로 남습니다) fix (KS6014)
model User { unique: [email] … } model User(unique: [email]) { … }: 옵션은 대괄호 안에 넣습니다 fix (KS6014)
model Post(timestamps, soft_deletes) { … } model Post extends [Timestamps, SoftDeletes] { … }: KScript.Data의 내장 믹스인 fix (KS6014)
catch QueryError, catch ConnectionError catch Query, catch Connection: 어떤 타입의 이름도 Error로 끝나지 않습니다

0으로 나누면 Math이, 리스트의 범위를 벗어난 위치에 접근하면 Index가 발생합니다. 두 가지 모두 이제 내장 타입이므로 catch Math와 catch Index가 동작하며 편집기에서도 인식됩니다.

소유 가능한 행과 파일 사용자

0.35의 두 가지 변경은 데이터를 옮기므로, 0.33 또는 0.34에서 업그레이드하는 앱에는 각각 마이그레이션이 필요합니다.

Ownable은 사용자와 게스트를 함께 보관합니다

Ownable를 확장하는 모델은 이전에 소유자를 owner에 'user:12'이나 'guest:7db08f23-…'같은 텍스트로 저장했습니다. 이제는 user와 guest 관계를 가지며, 각각 user_id와 guest_id에 저장됩니다. kscript db diff를 실행하세요. owner이 사라지고 두 필드가 생기는 것을 확인하고, 각 행의 소유자를 Run 블록에서 옮긴 뒤 owner를 삭제하는 마이그레이션을 작성합니다. 되돌리기 위한 Down 블록도 함께 만들어집니다:

<Migration>
  <AddField table="notes" name="user_id" type="int" optional="yes" references="users" on_delete="cascade" />
  <AddField table="notes" name="guest_id" type="uuid" optional="yes" references="guests" on_delete="cascade" />
  <Run>
    <for each="row" in="@db('notes')->get()">
      <let name="owner" value="$row.owner ?? ''" />
      <if $owner->starts_with('user:')>
        <do>@db('notes')->where(id: $row.id)->update(user_id: $owner->replace('user:', '')->to_int())</do>
        <continue />
      </if>
      <if $owner->starts_with('guest:')>
        <let name="guest" value="$owner->replace('guest:', '')" />
        <if @db('guests')->where(id: $guest)->count() == 0>
          <do>@db('guests')->insert({ id: $guest, created_at: @now(), updated_at: @now() })</do>
        </if>
        <do>@db('notes')->where(id: $row.id)->update(guest_id: $guest)</do>
      </if>
    </for>
  </Run>
  <DropField table="notes" name="owner" />
</Migration>
Migration {
  AddField(table: 'notes', name: 'user_id', type: int, optional, references: 'users', on_delete: cascade)
  AddField(table: 'notes', name: 'guest_id', type: uuid, optional, references: 'guests', on_delete: cascade)
  Run {
    for row in @db('notes')->get() {
      $owner = $row.owner ?? ''
      if $owner->starts_with('user:') {
        @db('notes')->where(id: $row.id)->update(user_id: $owner->replace('user:', '')->to_int())
        continue
      }
      if $owner->starts_with('guest:') {
        $guest = $owner->replace('guest:', '')
        if @db('guests')->where(id: $guest)->count() == 0 {
          @db('guests')->insert({ id: $guest, created_at: @now(), updated_at: @now() })
        }
        @db('notes')->where(id: $row.id)->update(guest_id: $guest)
      }
    }
  }
  DropField(table: 'notes', name: 'owner')
}

owner에 이름이 있는 각 게스트는 guests에 행을 하나씩 얻으므로 그들의 행은 그대로 그들의 것으로 남습니다. 사용자 id는 반드시 users의 행이어야 하므로, 아래처럼 파일 사용자를 먼저 옮기세요.

사용자를 User 모델로 옮기기

Ownable은 http.auth에서 "users": "User"이 필요합니다. 이는 사용자를 users 테이블에 보관합니다. 그 전에 가입한 사용자는 앱의 데이터 폴더에 있는 JSON 파일로 저장되어 있으며, @file_users()가 각 파일을 읽어 id, password_hash, 날짜 정보를 가져옵니다.

파일 사용자는 uuid id를 가지고, 기본 제공 User는 숫자 키를 가집니다. kscript publish User로 공개하고 uuid 키를 주면, 세션, API 토큰, 소유자가 같은 사람을 계속 찾습니다:

<import package="KScript.Data" />

<model name="User" auto_create="yes" unique="[email]" hidden="[password]" with="Timestamps">
  <field name="id" type="uuid" default="@uuid()" />
  <field name="name" type="string" />
  <field name="email" type="email" />
  <field name="password" type="password" />
</model>
import KScript.Data

model User(auto_create, unique: [email], hidden: [password]) extends Timestamps {
  id: uuid = @uuid()
  name: string
  email: email
  password: password
}

그다음 kscript db diff이 users 테이블을 만들고, kscript make migration import_file_users가 이들을 복사하는 마이그레이션을 만들어 줍니다. 비밀번호 해시는 그대로 복사되므로 모든 사용자가 가지고 있던 비밀번호로 로그인합니다:

<KScript.Migration>
  <import package="KScript.Auth" />

  <Run>
    <for each="account" in="@file_users()">
      <do>@db('users')->insert({
          id: $account.id,
          name: $account.name,
          email: $account.email,
          password: $account.password_hash,
          created_at: $account.created_at,
          updated_at: $account.updated_at,
        })</do>
    </for>
  </Run>
  <Down>
    <Run>
      <do>@db('users')->delete()</do>
    </Run>
  </Down>
</KScript.Migration>
import KScript.Data
import KScript.Auth

Migration {
  Run {
    for account in @file_users() {
      @db('users')->insert({
        id: $account.id,
        name: $account.name,
        email: $account.email,
        password: $account.password_hash,
        created_at: $account.created_at,
        updated_at: $account.updated_at,
      })
    }
  }
  Down {
    Run {
      @db('users')->delete()
    }
  }
}

Ownable 마이그레이션보다 앞에 정렬되는 이름을 주거나 먼저 작성하세요. 그래야 소유자가 가리키는 사용자가 존재합니다. 사용자에 추가한 필드도 insert에 넣고, 파일은 삭제하기 전까지 그대로 둡니다.

이름이 바뀐 문장

이전 지금
before-each, after-each before_each, after_each
expect-error expect_error
log-provider log_provider
css-text css_text
marray collection

명령이 된 구문

동작은 명령이므로 그 결과를 식에서 사용할 수 있습니다.

이전 지금
write 구문 @write_text(path, text), @append_text(path, text) 또는 @write_json(path, value) (KScript.IO)
move 및 copy 구문 @move(from, to), @copy(from, to) (KScript.IO)
delete 구문 @delete(path) (KScript.IO)
mkdir 구문 @create_folder(path) (KScript.IO)
assert 구문 @assert(condition, message?) (KScript.Test)
stylesheet 구문 @stylesheet(path, vars?), CSS를 반환합니다: @write_text('site.css', @stylesheet('theme.ks.css')) (KScript.Style)
dispatch 구문 작업 고유 메서드: SendWelcome(user_id: 7)->dispatch(), delay:, at:, queue: 또는 connection: 포함 (KScript.Queue)
download 구문 @download(url, to), 저장한 파일의 경로를 반환합니다 (KScript.Net)
redirect 구문 컨트롤러의 return @redirect(/thanks) (KScript.Http); 페이지의 <respond redirect="/thanks" />

인자

인자 이름은 snake_case입니다. 하이픈이 들어간 이름은 오류이며, 새 이름을 알려 줍니다: max-tokens는 max_tokens, must-exist는 must_exist, new-page는 new_page, on-click는 on_click입니다. (페이지의 HTML 태그에서는 on-click이 HTML의 하이픈을 그대로 유지합니다.)

문 이전 지금
input, picker, menu, confirm, llm, capture, config, call to: name into: name: 결과가 들어가는 변수입니다. to는 항상 대상으로만 쓰입니다
for, menu index: i at: i (for item at i in $list)
import, include, layout, Markdown, Figure, Bibliography src path
type sample path
Table (KScript.Document) data, headers, align: "lrr" rows, columns: { Name: 'name' }, align: ['left', 'right'], 터미널의 table처럼
wait ms, seconds duration: 500ms, 또는 값만 단독으로: wait(500ms)
test each, in, index (위의) 테스트를 도는 for 반복문
@color, log_provider colour color

명령

이전 지금
@to_upper($t), @to_lower($t) $t->upper(), $t->lower()
@string($v), @number($t), @date($t), @type($v) $v->to_string(), $t->to_number(), $t->to_date(), $v->type()
@json($t), @to_json($v), @yaml($t), @to_yaml($v) $t->convert(from: json), $v->convert(to: json), $t->convert(from: yaml), $v->convert(to: yaml)
@escape($t), @base64($t), @url_encode($t), @url_decode($t) $t->escape(), $t->to_base64(), $t->url_encode(), $t->url_decode()
@pow($a, $b) $a ** $b
@guid() @uuid()
@contrast(...) @contrast_color(color, dark?, light?)
@signed_in() @is_signed_in()
@log(8, 2) @logarithm(8, 2) (log는 로그 항목을 기록하는 문입니다)
@config('database.port', 5432) $config.database.port, 또는 $config->get('database.port', 5432)
@exit(1), @error('Too short') exit 1, throw Validation "Too short"
@transaction(...) transaction 문, 또는 $db->transaction(fn)

메서드와 필드

단순한 사실은 필드이며, 점(.)으로 대괄호 없이 읽습니다: $file.name, $file.size, $response.status, $date.year. 필드를 호출하면($file->name()) 그렇다고 알려 주는 오류가 발생합니다. 개수 세기는 모든 값에서 ->count()입니다.

켜짐 이전 지금
목록, 맵, 텍스트 ->length() ->count()
텍스트 공백만 있거나 비어 있는 텍스트를 허용하려면 $text->is_empty() 그 검사에는 $text->is_blank()을 사용하세요. $text->is_empty()는 이제 글자 수가 0인지 검사합니다.
목록 ->where(fn), ->append(item) ->filter(fn), ->push(item)
목록 정확히 일치하는 항목을 세려면 $items->count_of($value) 정확한 일치에는 $items->count_of(fn(x) => $x === $value)을 사용하세요. 값을 전달하면 이제 ==로 비교합니다.
숫자 ->pow(2) $n ** 2
숫자 $n->between(1, 10) 1 <= $n <= 10, 비교식의 연결
응답 ->ok() .is_ok
IP 주소 ->private(), ->loopback() .is_private, .is_loopback
JWT ->expired() .is_expired
데이터베이스 ->in_transaction() .is_in_transaction
비밀번호 ->strong() ->is_strong()
로거 ->enabled(level) ->is_enabled(level)
시간대 ->dst() ->is_dst()
캐시 ->put(key, value), ->forget(key), ->flush() ->set(key, value), ->remove(key), ->clear()
세션 ->put(key, value), ->forget(key) ->set(key, value), ->remove(key)
저장 폴더 ->path(name) ->path_of(name); .path는 폴더 자체입니다
색상 ->contrast(other) ->contrast_ratio(other)
쿼리, 모델 ->avg(column) ->average(column)
URL ->with_query(values) ->with(query: values); ->without(query, fragment)는 부분 전체를 제거합니다
날짜 ->add_years(n), ->add_months(n), ->add_days(n) ->add(years: n, months: n, days: n), weeks:도 포함; ->subtract(...)는 되돌립니다
날짜 ->add_hours(n), ->add_minutes(n) 기간: $date + 3h, $date - 45m
날짜 ->duration_since(other) $date - $other, 기간입니다
날짜 ->months_since(other), ->years_since(other) ->since(other, in: months), ->since(other, in: years)(그리고 days, weeks도)
날짜 $date + 1, $date - 1(일), $a - $b(일 수) $date + 1d 또는 ->add(days: 1); $a - $b는 이제 기간입니다
기간 ->plus(other), ->minus(other) ->add(other), ->subtract(other)
텍스트 ->trim_start(chars?), ->trim_end(chars?) ->trim(start), ->trim(chars, end)
텍스트 ->pad_left(width, char?), ->pad_right(width, char?) ->pad(width, char?, start), ->pad(width, char?)
텍스트 ->strip_prefix(text), ->strip_suffix(text) ->strip(prefix: text), ->strip(suffix: text), 또는 둘 다 한 번에
텍스트 ->before_last(text), ->after_last(text), ->last_index_of(text) ->before(text, last), ->after(text, last), ->index_of(text, last)
텍스트 ->replace_pattern(pattern, replacement) ->replace(/pattern/, replacement), 그룹에는 $1 또는 ${name}
텍스트 ->snake_case(), ->kebab_case(), ->camel_case(), ->pascal_case() ->case(snake), ->case(kebab), ->case(camel), ->case(pascal)
목록 ->find_last(fn), ->find_index(fn) ->find(fn, last), ->index_of(fn)(그리고 last도)
목록, 맵 ->sort_by(fn, desc) ->sort(by: fn, order: desc)
목록 ->max_by(fn), ->min_by(fn), ->unique_by(fn) ->max(by: fn), ->min(by: fn), ->unique(by: fn)
목록 초기값 없이 ->reduce(fn), 시작은 null 첫 번째 항목이 첫 번째 합계가 되며, ->scan()와 같습니다: [3, 5, 2]->reduce(fn(total, n) => $total + $n)는 10입니다
맵 초기값 없이 ->reduce(fn), 시작은 null 첫 번째 값이 첫 번째 합계가 되며, 목록과 같습니다: { apples: 3, pears: 5 }->reduce(fn(total, n) => $total + $n)는 8입니다
목록 ->most_common(count?) ->common(count?), 또는 가장 드문 것부터 하려면 ->common(count?, least)
숫자 -5->abs()은 -(5->abs())로 읽히며, 이는 -5입니다 숫자에 바로 붙은 마이너스는 숫자의 일부이므로 -5->abs()는 5입니다; -$x->abs()는 여전히 ->abs()의 결과를 부정합니다
JSON ->parse() ->convert(from: json)
텍스트, 응답 ->json(as?), ->yaml(), ->csv(header?, as?), ->markdown() ->convert(from: json, as?), ->convert(from: yaml), ->convert(from: csv, not header, as?), ->convert(from: markdown, to: html); ->from(type: json)는 짧은 형식입니다
모든 값 ->to_json(indented?), ->to_yaml(), 목록의 ->to_csv(headers?) ->convert(to: json, indented), ->convert(to: yaml), ->convert(to: csv, headers: [...]); ->to(type: json)는 짧은 형식입니다
문서, 마크다운, LaTeX ->html(), ->latex(), ->markdown() ->convert(to: html), ->convert(to: latex), ->convert(to: markdown)
CSV ->rows(header?, as?), ->column(at, header?, as?) ->cells(header?, as?), ->cells(column: at, header?, as?); ->cells(row: 0)는 한 행을, ->cells(columns)는 모든 열을, ->cells(row: 0, column: 'price')는 한 셀을 읽습니다. 숫자로 적힌 셀은 숫자이며, 헤더는 첫 줄에서 결정됩니다
->shapes(like:)용 마스크 layout: string = ...과 symbols: map = ...를 가진 모든 타입 type Tree extends Mask { layout: ..., symbols: { ... } }: Mask를 확장한 타입만 마스크이며, 그 멤버에는 타입이 필요 없습니다
마스크 $grid->shapes(like: Tree, rotated) $input->shapes(Tree, rotated): 마스크가 먼저 와야 하며, 텍스트, 목록, 3D 목록도 그리드처럼 동작하므로 ->grid()는 먼저 필요하지 않습니다. like:는 호출을 다시 작성하는 수정 방법이 있는 오류입니다
마스크 symbols: { '#': '#', '.': null }, 모든 문자 나열 symbols: { '.': any }: symbols에서 달리 지정하지 않으면 문자는 자기 자신과 일치하므로 바꿀 것이 없는 마스크에는 symbols가 필요 없습니다. null는 any를 작성하는 수정 방법이 있는 오류이며, '#': '#'는 제거하는 수정 방법이 있는 경고(KS6025)입니다
마스크 layout = ..., symbols = ... layout: ..., symbols: ...: 마스크의 멤버는 콜론으로 작성하며, 편집기의 수정은 =를 다시 작성합니다. 마스크에는 layout, symbols, 그리고 메서드만 들어갈 수 있습니다
목록의 목록 ->transpose() ->cells(columns)는 ->grid()나 csv처럼 읽는 모든 목록의 목록을 읽습니다: ->cells(rows), ->cells(row: 0), ->cells(column: 2), ->cells(row: 0, column: 2). 행의 길이가 달라도 됩니다. 열은 그 열에 닿지 못하는 짧은 행을 건너뜁니다

명령줄

명령어 이전 지금
kscript check, kscript queue --format text|json --output text|json
kscript check --warnaserror --warnings-as-errors
kscript openapi --yaml, --json --output yaml, --output json
kscript make, kscript docs, kscript mcp --format kscript|xml --syntax kscript|xml
kscript convert --to kscript|xml --syntax kscript|xml
kscript make kscript make:component Hero kscript make component Hero
kscript update --version v0.34.0, --tag v0.34.0 (설치된 kscript를 그 릴리스로 교체합니다) kscript version use 0.34.0: 두 형식을 나란히 유지하므로 다시 전환할 수 있습니다(버전 전환 참고)
kscript version 버전 번호를 출력했습니다 kscript --version은 번호를 출력하고, kscript version는 여기서 어떤 버전이 실행되는지와 그것을 선택한 원인을 보여줍니다
모든 명령 --debug (오류 뒤의 .NET 스택 트레이스를 표시합니다) --stack-trace
모든 명령 KSCRIPT_DEBUG=1 KSCRIPT_STACK_TRACE=1

--output는 항상 결과를 출력하는 방식이고, --syntax는 항상 스크립트를 두 형식 중 무엇으로 작성하는지를 나타냅니다.

--debug는 이제 스크립트를 터미널 디버거에서 실행합니다. 다른 명령과 함께 쓰면 --stack-trace를 알려 주는 오류가 발생합니다.

kscript check --output json이 기록하는 키는 snake_case입니다: end_line, end_column, new_text (이전에는 endLine, endColumn, newText였으며), KScript 자체 JSON의 다른 모든 키와 같습니다. 종료 코드는 모든 명령에서 같습니다: 검사나 테스트가 실패하면 1, 명령줄이나 설정에 실수가 있으면 2, 스크립트가 오류로 중단되면 3입니다.

kscript.json

키는 snake_case입니다. 예전 키는 오류이며, 새 키를 알려 줍니다.

이전 지금
lint.warningsAsErrors lint.warnings_as_errors
format.tabWidth, format.printWidth format.tab_width, format.print_width
format.maxBlankLines, format.endOfLine format.max_blank_lines, format.end_of_line
format.rules.statementPerLine, tidyTags, wrapAttributes format.rules.statement_per_line, tidy_tags, wrap_attributes
format.rules.trimTrailingWhitespace, collapseBlankLines, finalNewline format.rules.trim_trailing_whitespace, collapse_blank_lines, final_newline
format.rules.braceStyle, wrapStrings, wrapChains, wrapBodies, wrapComments format.rules.brace_style, wrap_strings, wrap_chains, wrap_bodies, wrap_comments
make.format make.syntax

config 섹션에는 이제 앱 자체의 설정이 들어가며, 어떤 파일을 불러올지는 그 안에 적히지 않습니다. config.files는 각 파일이 어디에 놓여야 하는지 알려 주는 오류입니다:

이전 지금
"config": { "files": ["config/config.kscript"] } kscript.json 옆의 config.kscript는 단독으로 읽힙니다. 그 configure(environment)는 예전과 같이 호출됩니다
".env", config.files의 ".env?" 없음: .env와 .env.<env>는 @env()을 위해 단독으로 읽힙니다
config/config.yaml kscript.json의 "config" 섹션 값, 그리고 한 환경을 위한 kscript.<env>.json
config.root, config.prefix, config.required, config.user, paths.config 사라졌습니다. app.user_config는 사용자 고유 폴더에 설정을 보관합니다

$config->sources()는 읽힌 파일 목록을 보여 주므로, 설정이 제대로 불러와졌는지 확인할 수 있습니다.

이름

고유 이름도 기본 제공 이름과 같은 규칙을 따릅니다. 규칙을 어기는 이름은 경고입니다(KS6013). 함수, 변수, 필드, 인자는 snake_case이고, 타입, 모델, 열거형, 오류 타입은 PascalCase입니다. fn sendEmail()의 이름을 fn send_email()로, type repo의 이름을 type Repo로 바꾸세요.

기본 제공 이름이 이 규칙에서 벗어날 수는 없습니다. 엔진은 패키지가 등록하는 각 구문, 인자, 명령, 메서드, 필드를 검사하고 규칙을 어기면 거부하므로, 새 패키지가 하이픈이 붙은 인자나 ->count()의 두 번째 이름을 다시 들여올 수 없습니다. KScript 작업에 규칙이 나와 있습니다.

파일

이전 지금
hello.ks, 또는 hello.xml로 시작하는 일반 <kscript> XML 형식은 hello.ks.xml, 기본 형식은 hello.kscript
name.test.xml name.test.ks.xml 또는 name.test.kscript
snake_case에 명시된 kscript make가 작성한 파일들 kebab-case 파일 이름: middleware/request-id.kscript, lib/notes-client.kscript

kscript convert는 스크립트를 한 형식에서 다른 형식으로 바꾸고, 그 스크립트를 가리키는 import도 함께 이름을 바꿉니다. .kscript 형식을 참고하세요.