Files
hakorune/docs/reference/config/nyash-toml.md

86 lines
2.8 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# nyash.toml — Configuration Reference (Phase 15.5)
Status: Proposed受け口から段階導入。未指定時は現行既定を維持
## 目的
- 依存関係・実行方針の**唯一の真実SSOT**。
- using の解決AST プレリュード)と、将来の Provider/Type 分離(受け口)を一元管理。
## セクション一覧
### [env]
任意の既定環境変数(`NYASH_*`。CI/ローカルで上書き可。
### [using]
検索ルート `paths = ["apps","lib","."]`、名前付きパッケージ `[using.<name>]`、エイリアス `[using.aliases]`
例:
```toml
[using]
paths = ["apps", "lib", "."]
[using.json_native]
path = "apps/lib/json_native/"
main = "parser/parser.hako"
[using.string_utils]
path = "apps/lib/json_native/utils/string.hako"
[using.aliases]
json = "json_native"
StringUtils = "string_utils"
```
### Provider/Type受け口・既定OFF
Stable Type NameSTNを Provider IDPVNにマッピング。未指定時は現行ランタイム既定。
```toml
[types.StringBox]
provider = "kernel:string@1.0"
interop = "forbid" # forbid|explicit|auto既定: forbid
[providers."kernel:string@1.0"]
crate = "nyash-plugin-base-string" # 静的リンクのブートストラップ提供者
[providers."acme:string@2.1"]
path = "./plugins/libacme_string.so"
override = true
[policy]
factory = "plugin-first" # plugin-first|compat_plugin_first|static_only
```
注意:
- 本仕様は「受け口」の段階。実行挙動は段階導入Verify→Lock→実行
- 互換性重視のため、未指定時は現行と同じ既定にフォールバックする。
### [plugins.bootstrap] / [plugins.dynamic](提案)
静的リンクのブートストラップ束/動的ロード(開発)を明示。
```toml
[plugins.bootstrap]
string = { crate = "nyash-plugin-base-string", version = "2.3.0" }
integer = { crate = "nyash-plugin-base-integer", version = "1.5.1" }
[plugins.dynamic]
# string = { path = "./plugins/libnyash_string_plugin.so", override = true }
```
## Profilesusing / AST
`NYASH_USING_PROFILE={dev|ci|prod}`
- dev/ci: AST プレリュード既定ONfile-usingはdevで許可、ciは警告/限定)
- prod: AST 既定OFFtoml 由来のみ、file-using はエラー)
実装ノート:
- AST 既定は `src/config/env.rs: using_ast_enabled()` でプロファイルに従い決定。
- 既存のレガシー前置きは prod で禁止、dev/ci でも段階的に削除予定。
## Verifyplugin-tester
CI/起動前に最低限の契約を検査(例: String の `birth/fini/toUtf8/fromUtf8/equals/length/concat`)。欠落時は即停止。
## 参考
- Kernel/Plugin 方針: docs/reference/runtime/kernel-and-plugins.md
- ADR: docs/development/adr/adr-001-no-corebox-everything-is-plugin.md