From 22560e8972ec5ed665caf1b35c0786757cf8f58a Mon Sep 17 00:00:00 2001 From: Taku Kodma <79110363+risu729@users.noreply.github.com> Date: Wed, 6 May 2026 23:11:01 +1000 Subject: [PATCH 1/2] refactor(schema): extract tool options definition --- e2e/config/test_schema_tombi | 37 ++++++++---- schema/mise-task.json | 28 +++++---- schema/mise.json | 111 +++++++++++++++++++---------------- 3 files changed, 101 insertions(+), 75 deletions(-) diff --git a/e2e/config/test_schema_tombi b/e2e/config/test_schema_tombi index f43a164473..cc178b85bc 100644 --- a/e2e/config/test_schema_tombi +++ b/e2e/config/test_schema_tombi @@ -14,6 +14,7 @@ mise use -g tombi@$TOMBI_VERSION SCHEMA_PATH="$ROOT/schema/mise.json" TASK_SCHEMA_PATH="$ROOT/schema/mise-task.json" TOMBI="mise x tombi@$TOMBI_VERSION -- tombi" +TOMBI_LINT="$TOMBI lint --offline --no-cache --error-on-warnings --quiet" assert_contains "$TOMBI --version" "tombi $TOMBI_VERSION" # Set up tombi config pointing to local schema @@ -70,11 +71,11 @@ TOML cat >"$HOME/workdir/mise-os.toml" <<'TOML' [tools] -node = { version = "latest", os = ["linux", "macos/arm64", "darwin/aarch64", "win/amd64"] } +node = { version = "latest", os = ["linux", "macos/arm64", "darwin/aarch64", "win/amd64"], backend_options = { nested = true } } go = { version = "latest", os = "linux/x64" } [tasks.build.tools] -rust = { version = "latest", os = ["linux/x64", "macos/arm64"] } +rust = { version = "latest", os = ["linux/x64", "macos/arm64"], profile = "release" } TOML cat >"$HOME/workdir/mise-task-os.toml" <<'TOML' @@ -82,15 +83,15 @@ cat >"$HOME/workdir/mise-task-os.toml" <<'TOML' run = "echo ok" [build.tools] -node = { version = "latest", os = ["linux/x64", "macos/arm64"] } +node = { version = "latest", os = ["linux/x64", "macos/arm64"], profile = "release" } TOML # tombi lint should succeed with no errors (warnings about table order are ok) cd "$HOME/workdir" -assert_succeed "$TOMBI lint --offline --no-cache --quiet mise.toml" -assert_succeed "$TOMBI lint --offline --no-cache --quiet mise-age.toml" -assert_succeed "$TOMBI lint --offline --no-cache --quiet mise-os.toml" -assert_succeed "$TOMBI lint --offline --no-cache --quiet mise-task-os.toml" +assert_succeed "$TOMBI_LINT mise.toml" +assert_succeed "$TOMBI_LINT mise-age.toml" +assert_succeed "$TOMBI_LINT mise-os.toml" +assert_succeed "$TOMBI_LINT mise-task-os.toml" # Verify that invalid properties on tasks are rejected cat >"$HOME/workdir/mise-bad.toml" <<'TOML' @@ -113,10 +114,10 @@ include = ["mise-bad.toml", "mise-bad-age.toml", "mise-bad-tmpl.toml", "mise-bad [[schemas]] path = "file://$TASK_SCHEMA_PATH" -include = ["mise-bad-task-os.toml"] +include = ["mise-bad-task-os.toml", "mise-bad-task-tool-extra.toml"] EOF -assert_fail "$TOMBI lint --offline --no-cache --quiet mise-bad.toml" +assert_fail "$TOMBI_LINT mise-bad.toml" # Verify that options for complex age values must be nested inside age cat >"$HOME/workdir/mise-bad-age.toml" <<'TOML' @@ -124,7 +125,7 @@ cat >"$HOME/workdir/mise-bad-age.toml" <<'TOML' SECRET = { age = { value = "AGE-SECRET" }, tools = true } TOML -assert_fail "$TOMBI lint --offline --no-cache --quiet mise-bad-age.toml" +assert_fail "$TOMBI_LINT mise-bad-age.toml" # Verify that extends is rejected on task_templates (not supported at runtime) cat >"$HOME/workdir/mise-bad-tmpl.toml" <<'TOML' @@ -133,14 +134,14 @@ extends = "base" quiet = true TOML -assert_fail "$TOMBI lint --offline --no-cache --quiet mise-bad-tmpl.toml" +assert_fail "$TOMBI_LINT mise-bad-tmpl.toml" cat >"$HOME/workdir/mise-bad-os.toml" <<'TOML' [tools] node = { version = "latest", os = true } TOML -assert_fail "$TOMBI lint --offline --no-cache --quiet mise-bad-os.toml" +assert_fail "$TOMBI_LINT mise-bad-os.toml" cat >"$HOME/workdir/mise-bad-task-os.toml" <<'TOML' [build] @@ -150,4 +151,14 @@ run = "echo ok" node = { version = "latest", os = true } TOML -assert_fail "$TOMBI lint --offline --no-cache --quiet mise-bad-task-os.toml" +assert_fail "$TOMBI_LINT mise-bad-task-os.toml" + +cat >"$HOME/workdir/mise-bad-task-tool-extra.toml" <<'TOML' +[build] +run = "echo ok" + +[build.tools] +node = { version = "latest", os = "linux/x64", backend_options = { nested = true } } +TOML + +assert_fail "$TOMBI_LINT mise-bad-task-tool-extra.toml" diff --git a/schema/mise-task.json b/schema/mise-task.json index cc16664673..99a28ef0d9 100644 --- a/schema/mise-task.json +++ b/schema/mise-task.json @@ -154,18 +154,13 @@ "type": "string" }, { - "properties": { - "version": { - "description": "version of the tool to install", - "type": "string" - }, - "os": { - "$ref": "#/$defs/os_filter" + "allOf": [ + { + "$ref": "#/$defs/tool_options" } - }, - "required": ["version"], + ], "type": "object", - "additionalProperties": { + "unevaluatedProperties": { "oneOf": [ { "type": "string" @@ -838,6 +833,19 @@ } ] }, + "tool_options": { + "properties": { + "version": { + "description": "version of the tool to install", + "type": "string" + }, + "os": { + "$ref": "#/$defs/os_filter" + } + }, + "required": ["version"], + "type": "object" + }, "os_filter": { "description": "operating system filters to install on", "oneOf": [ diff --git a/schema/mise.json b/schema/mise.json index 2467e792f6..975fd9d4a8 100644 --- a/schema/mise.json +++ b/schema/mise.json @@ -1949,54 +1949,53 @@ "type": "string" }, { - "properties": { - "version": { - "description": "version of the tool to install", - "type": "string" - }, - "os": { - "$ref": "#/$defs/os_filter" + "allOf": [ + { + "$ref": "#/$defs/tool_options" }, - "install_env": { - "type": "object", - "additionalProperties": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "number" + { + "properties": { + "install_env": { + "type": "object", + "additionalProperties": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "number" + }, + { + "type": "boolean" + } + ] }, - { - "type": "boolean" - } - ] - }, - "description": "environment variables during tool installation" - }, - "depends": { - "oneOf": [ - { - "description": "tools that must be installed before this tool", - "type": "string" + "description": "environment variables during tool installation" }, - { - "description": "tools that must be installed before this tool", - "type": "array", - "items": { - "type": "string" - } + "depends": { + "oneOf": [ + { + "description": "tools that must be installed before this tool", + "type": "string" + }, + { + "description": "tools that must be installed before this tool", + "type": "array", + "items": { + "type": "string" + } + } + ] + }, + "postinstall": { + "description": "command to run after tool installation", + "type": "string" } - ] - }, - "postinstall": { - "description": "command to run after tool installation", - "type": "string" + } } - }, - "required": ["version"], + ], "type": "object", - "additionalProperties": { + "unevaluatedProperties": { "oneOf": [ { "type": "string" @@ -2019,6 +2018,19 @@ } ] }, + "tool_options": { + "properties": { + "version": { + "description": "version of the tool to install", + "type": "string" + }, + "os": { + "$ref": "#/$defs/os_filter" + } + }, + "required": ["version"], + "type": "object" + }, "hooks": { "description": "hooks to run", "type": "object", @@ -2310,18 +2322,13 @@ "type": "string" }, { - "properties": { - "version": { - "description": "version of the tool to install", - "type": "string" - }, - "os": { - "$ref": "#/$defs/os_filter" + "allOf": [ + { + "$ref": "#/$defs/tool_options" } - }, - "required": ["version"], + ], "type": "object", - "additionalProperties": { + "unevaluatedProperties": { "oneOf": [ { "type": "string" From 4897354a37fb6f4fc6c652b5a1072d8104e9ea4d Mon Sep 17 00:00:00 2001 From: "autofix-ci[bot]" <114827586+autofix-ci[bot]@users.noreply.github.com> Date: Wed, 6 May 2026 13:18:34 +0000 Subject: [PATCH 2/2] [autofix.ci] apply automated fixes --- schema/mise-task.json | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/schema/mise-task.json b/schema/mise-task.json index 99a28ef0d9..9524bbcebd 100644 --- a/schema/mise-task.json +++ b/schema/mise-task.json @@ -846,20 +846,6 @@ "required": ["version"], "type": "object" }, - "os_filter": { - "description": "operating system filters to install on", - "oneOf": [ - { - "$ref": "#/$defs/os_filter_item" - }, - { - "type": "array", - "items": { - "$ref": "#/$defs/os_filter_item" - } - } - ] - }, "env_directive": { "type": "object", "properties": { @@ -925,6 +911,20 @@ } ] }, + "os_filter": { + "description": "operating system filters to install on", + "oneOf": [ + { + "$ref": "#/$defs/os_filter_item" + }, + { + "type": "array", + "items": { + "$ref": "#/$defs/os_filter_item" + } + } + ] + }, "os_filter_item": { "description": "operating system or os/arch pair to install on", "type": "string",