commit 1e1a3213df739a5fab991912e9018938a99355e3 Author: Jürg Jenzer Date: Mon Jan 26 15:20:35 2026 +0100 first commit diff --git a/mstr-commands-schema.json b/mstr-commands-schema.json new file mode 100644 index 0000000..93ef367 --- /dev/null +++ b/mstr-commands-schema.json @@ -0,0 +1,51 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "additionalProperties": false, + "properties": { + "commands": { + "type": "array", + "items": { + "$ref": "#/$defs/command" + } + } + }, + "required": [ + "commands" + ], + "$defs": { + "command": { + "type": "object", + "additionalProperties": false, + "properties": { + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "script": { + "type": "string" + }, + "tags": { + "type": "array", + "items": { + "type": "string" + } + }, + "configs": { + "type": "array", + "items": { + "type": "string" + }, + "additionalProperties": false + } + }, + "required": [ + "name", + "description", + "script" + ] + } + } +} \ No newline at end of file diff --git a/mstr-config-schema.json b/mstr-config-schema.json new file mode 100644 index 0000000..63598ea --- /dev/null +++ b/mstr-config-schema.json @@ -0,0 +1,22 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "additionalProperties": false, + "properties": { + "repositories": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "commands": { + "type": "array", + "items": { + "type": "string" + } + }, + "variables": { + "type": "object" + } + } +} \ No newline at end of file diff --git a/mstr-tasks-schema.json b/mstr-tasks-schema.json new file mode 100644 index 0000000..fc43b48 --- /dev/null +++ b/mstr-tasks-schema.json @@ -0,0 +1,919 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "additionalProperties": false, + "properties": { + "arguments": { + "type": "array", + "items": { + "$ref": "#/$defs/argument" + } + }, + "options": { + "type": "array", + "items": { + "$ref": "#/$defs/option" + } + }, + "tasks": { + "type": "array", + "items": { + "$ref": "#/$defs/task" + } + } + }, + "required": [ + "tasks" + ], + "$defs": { + "task": { + "type": "object", + "additionalProperties": false, + "properties": { + "print": { + "$ref": "#/$defs/print" + }, + "write": { + "$ref": "#/$defs/write" + }, + "call": { + "$ref": "#/$defs/call" + }, + "template": { + "$ref": "#/$defs/template" + }, + "set": { + "$ref": "#/$defs/set" + }, + "loadVariables": { + "$ref": "#/$defs/loadVariables" + }, + "execute": { + "$ref": "#/$defs/execute" + }, + "throw": { + "$ref": "#/$defs/throw" + }, + "loadVersion": { + "$ref": "#/$defs/loadVersion" + }, + "saveVersion": { + "$ref": "#/$defs/saveVersion" + }, + "tar": { + "$ref": "#/$defs/tar" + }, + "zip": { + "$ref": "#/$defs/zip" + }, + "sha256": { + "$ref": "#/$defs/sha256" + }, + "dump": { + "$ref": "#/$defs/dump" + }, + "return": { + "$ref": "#/$defs/return" + } + } + }, + "print": { + "type": "object", + "additionalProperties": false, + "properties": { + "description": { + "type": "string" + }, + "format": { + "type": "string" + }, + "args": { + "type": "array", + "items": { + "type": "string" + } + }, + "when": { + "$ref": "#/$defs/when" + }, + "loop": { + "$ref": "#/$defs/loop" + }, + "onError": { + "$ref": "#/$defs/continueAction" + }, + "onSuccess": { + "$ref": "#/$defs/continueAction" + } + }, + "required": [ + "format" + ] + }, + "write": { + "type": "object", + "additionalProperties": false, + "properties": { + "description": { + "type": "string" + }, + "file": { + "type": "string" + }, + "append": { + "type": "boolean" + }, + "format": { + "type": "string" + }, + "args": { + "type": "array", + "items": { + "type": "string" + } + }, + "when": { + "$ref": "#/$defs/when" + }, + "loop": { + "$ref": "#/$defs/loop" + }, + "onError": { + "$ref": "#/$defs/continueAction" + }, + "onSuccess": { + "$ref": "#/$defs/continueAction" + } + }, + "required": [ + "file", + "format" + ] + }, + "call": { + "type": "object", + "additionalProperties": false, + "properties": { + "description": { + "type": "string" + }, + "script": { + "type": "string" + }, + "args": { + "type": "object", + "additionalProperties": { + "type": [ + "string", + "number", + "boolean" + ] + } + }, + "returns": { + "type": "array", + "items": { + "$ref": "#/$defs/variable" + } + }, + "when": { + "$ref": "#/$defs/when" + }, + "loop": { + "$ref": "#/$defs/loop" + }, + "onError": { + "$ref": "#/$defs/continueAction" + }, + "onSuccess": { + "$ref": "#/$defs/continueAction" + } + }, + "required": [ + "script" + ] + }, + "template": { + "type": "object", + "additionalProperties": false, + "properties": { + "description": { + "type": "string" + }, + "templates": { + "type": "array", + "items": { + "type": "string" + } + }, + "target": { + "type": "string" + }, + "args": { + "type": "object", + "additionalProperties": { + "type": [ + "string", + "number", + "boolean" + ] + } + }, + "when": { + "$ref": "#/$defs/when" + }, + "loop": { + "$ref": "#/$defs/loop" + }, + "onError": { + "$ref": "#/$defs/continueAction" + }, + "onSuccess": { + "$ref": "#/$defs/continueAction" + } + }, + "required": [ + "templates", + "target" + ] + }, + "set": { + "type": "object", + "additionalProperties": false, + "properties": { + "description": { + "type": "string" + }, + "variables": { + "type": "array", + "items": { + "type": "object", + "additionalProperties": false, + "properties": { + "varName": { + "$ref": "#/$defs/variable" + }, + "value": {} + }, + "required": [ + "varName", + "value" + ] + } + }, + "when": { + "$ref": "#/$defs/when" + }, + "loop": { + "$ref": "#/$defs/loop" + }, + "onError": { + "$ref": "#/$defs/continueAction" + }, + "onSuccess": { + "$ref": "#/$defs/continueAction" + } + }, + "required": [ + "variables" + ] + }, + "loadVariables": { + "type": "object", + "additionalProperties": false, + "properties": { + "description": { + "type": "string" + }, + "url": { + "type": "string" + }, + "unmarshaller": { + "enum": ["yaml","json","xml"], + "default": "yaml" + }, + "path": { + "type": "string" + }, + "when": { + "$ref": "#/$defs/when" + }, + "loop": { + "$ref": "#/$defs/loop" + }, + "onError": { + "$ref": "#/$defs/continueAction" + }, + "onSuccess": { + "$ref": "#/$defs/continueAction" + } + }, + "required": [ + "url" + ] + }, + "execute": { + "type": "object", + "additionalProperties": false, + "properties": { + "description": { + "type": "string" + }, + "timeout": { + "type": "string", + "pattern": "^\\-?\\d+(ns|us|µs|ms|s|m|h)(\\-?\\d+(ns|us|µs|ms|s|m|h))*$" + }, + "stdin": { + "type": "string" + }, + "dir": { + "type": "string" + }, + "env": { + "type": "object" + }, + "exec": { + "type": "string" + }, + "args": { + "items": { + "type": "string" + }, + "type": "array" + }, + "hideStdout": { + "type": [ + "boolean", + "string" + ] + }, + "hideStderr": { + "type": [ + "boolean", + "string" + ] + }, + "filters": { + "items": { + "$ref": "#/$defs/filter" + }, + "type": "array" + }, + "replacers": { + "items": { + "$ref": "#/$defs/replacer" + }, + "type": "array" + }, + "matchers": { + "items": { + "$ref": "#/$defs/matcher" + }, + "type": "array" + }, + "parsers": { + "items": { + "$ref": "#/$defs/parser" + }, + "type": "array" + }, + "response": { + "$ref": "#/$defs/response" + }, + "when": { + "$ref": "#/$defs/when" + }, + "loop": { + "$ref": "#/$defs/loop" + }, + "onError": { + "$ref": "#/$defs/continueAction" + }, + "onSuccess": { + "$ref": "#/$defs/continueAction" + } + }, + "required": [ + "exec" + ] + }, + "throw": { + "type": "object", + "additionalProperties": false, + "properties": { + "description": { + "type": "string" + }, + "message": { + "type": "string" + }, + "when": { + "$ref": "#/$defs/when" + }, + "loop": { + "$ref": "#/$defs/loop" + }, + "onError": { + "$ref": "#/$defs/continueAction" + }, + "onSuccess": { + "$ref": "#/$defs/continueAction" + } + } + }, + "dump": { + "type": "object", + "additionalProperties": false, + "properties": { + "description": { + "type": "string" + }, + "when": { + "$ref": "#/$defs/when" + }, + "loop": { + "$ref": "#/$defs/loop" + }, + "onError": { + "$ref": "#/$defs/continueAction" + }, + "onSuccess": { + "$ref": "#/$defs/continueAction" + } + } + }, + "return": { + "type": "object", + "additionalProperties": false, + "properties": { + "description": { + "type": "string" + }, + "when": { + "$ref": "#/$defs/when" + }, + "loop": { + "$ref": "#/$defs/loop" + }, + "onError": { + "$ref": "#/$defs/continueAction" + }, + "onSuccess": { + "$ref": "#/$defs/continueAction" + } + } + }, + "loadVersion": { + "type": "object", + "additionalProperties": false, + "properties": { + "description": { + "type": "string" + }, + "varName": { + "type": "string" + }, + "file": { + "type": "string" + }, + "increment": { + "type": "string" + }, + "when": { + "$ref": "#/$defs/when" + }, + "loop": { + "$ref": "#/$defs/loop" + }, + "onError": { + "$ref": "#/$defs/continueAction" + }, + "onSuccess": { + "$ref": "#/$defs/continueAction" + } + }, + "required": [ + "varName", + "file" + ] + }, + "saveVersion": { + "type": "object", + "additionalProperties": false, + "properties": { + "description": { + "type": "string" + }, + "varName": { + "type": "string" + }, + "file": { + "type": "string" + }, + "when": { + "$ref": "#/$defs/when" + }, + "loop": { + "$ref": "#/$defs/loop" + }, + "onError": { + "$ref": "#/$defs/continueAction" + }, + "onSuccess": { + "$ref": "#/$defs/continueAction" + } + }, + "required": [ + "varName", + "file" + ] + }, + "tar": { + "type": "object", + "additionalProperties": false, + "properties": { + "description": { + "type": "string" + }, + "source": { + "type": "string" + }, + "archiveFile": { + "type": "string" + }, + "gzip": { + "type": "boolean" + }, + "when": { + "$ref": "#/$defs/when" + }, + "loop": { + "$ref": "#/$defs/loop" + }, + "onError": { + "$ref": "#/$defs/continueAction" + }, + "onSuccess": { + "$ref": "#/$defs/continueAction" + } + }, + "required": [ + "source", + "archiveFile" + ] + }, + "zip": { + "type": "object", + "additionalProperties": false, + "properties": { + "description": { + "type": "string" + }, + "source": { + "type": "string" + }, + "zipFile": { + "type": "string" + }, + "when": { + "$ref": "#/$defs/when" + }, + "loop": { + "$ref": "#/$defs/loop" + }, + "onError": { + "$ref": "#/$defs/continueAction" + }, + "onSuccess": { + "$ref": "#/$defs/continueAction" + } + }, + "required": [ + "source", + "zipFile" + ] + }, + "sha256": { + "type": "object", + "additionalProperties": false, + "properties": { + "description": { + "type": "string" + }, + "file": { + "type": "string" + }, + "varName": { + "type": "string" + }, + "when": { + "$ref": "#/$defs/when" + }, + "loop": { + "$ref": "#/$defs/loop" + }, + "onError": { + "$ref": "#/$defs/continueAction" + }, + "onSuccess": { + "$ref": "#/$defs/continueAction" + } + }, + "required": [ + "file", + "varName" + ] + }, + "option": { + "type": "object", + "additionalProperties": false, + "properties": { + "name": { + "$ref": "#/$defs/variable" + }, + "description": { + "type": "string" + }, + "type": { + "type": "string", + "enum": [ + "string", + "int", + "float64", + "bool" + ] + }, + "default": {} + }, + "required": [ + "name", + "description", + "type", + "default" + ], + "allOf": [ + { + "$ref": "#/$defs/allowedTypes" + } + ] + }, + "argument": { + "type": "object", + "additionalProperties": false, + "properties": { + "name": { + "$ref": "#/$defs/variable" + }, + "description": { + "type": "string" + } + }, + "required": [ + "name", + "description" + ] + }, + "allowedTypes": { + "allOf": [ + { + "if": { + "properties": { + "type": { + "const": "string" + } + } + }, + "then": { + "properties": { + "default": { + "type": "string" + } + }, + "required": [ + "default" + ] + } + }, + { + "if": { + "properties": { + "type": { + "const": "int" + } + } + }, + "then": { + "properties": { + "default": { + "type": "integer" + } + }, + "required": [ + "default" + ] + } + }, + { + "if": { + "properties": { + "type": { + "const": "float64" + } + } + }, + "then": { + "properties": { + "default": { + "type": "number" + } + }, + "required": [ + "default" + ] + } + }, + { + "if": { + "properties": { + "type": { + "const": "bool" + } + } + }, + "then": { + "properties": { + "default": { + "type": "boolean" + } + }, + "required": [ + "default" + ] + } + } + ] + }, + "when": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ] + }, + "loop": { + "type": "object", + "additionalProperties": false, + "properties": { + "values": { + "oneOf": [ + { + "$ref": "#/$defs/expression" + }, + { + "type": "array", + "items": {} + } + ] + }, + "as": { + "type": "string", + "default": "item" + }, + "index": { + "type": "string", + "default": "index" + } + }, + "required": [ + "values" + ] + }, + "continueAction": { + "type": "string" + }, + "variable": { + "type": "string", + "pattern": "^[_A-Za-z][_A-Za-z0-9]*$" + }, + "expression": { + "type": "string", + "pattern": "^\\$\\(.*\\)$" + }, + "filter": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "negate": { + "type": [ + "boolean", + "string" + ] + }, + "expression": { + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "name", + "expression" + ] + }, + "matcher": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "negate": { + "type": [ + "boolean", + "string" + ] + }, + "expression": { + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "name", + "expression" + ] + }, + "parser": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "parser": { + "enum": [ + "regexp", + "jq", + "xmlpath" + ] + }, + "expression": { + "type": "string" + }, + "variables": { + "items": { + "type": "string" + }, + "type": "array" + } + }, + "additionalProperties": false, + "required": [ + "name", + "parser", + "expression", + "variables" + ] + }, + "replacer": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "expression": { + "type": "string" + }, + "replace": { + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "name", + "expression", + "replace" + ] + }, + "response": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "prefix": { + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "name" + ] + } + } +} \ No newline at end of file