artemiskit validate
artemiskit validate
Section titled “artemiskit validate”Validate scenario files for syntax errors, schema violations, and semantic issues without executing them against an LLM.
Synopsis
Section titled “Synopsis”artemiskit validate <path> [options]akit validate <path> [options]Arguments
Section titled “Arguments”| Argument | Description |
|---|---|
path | Path to scenario file, directory, or glob pattern |
The path argument supports:
- Single file:
scenarios/test.yaml - Directory:
scenarios/(validates all.yaml/.ymlfiles recursively) - Glob pattern:
scenarios/**/*.yaml(matches pattern)
Options
Section titled “Options”| Option | Short | Description | Default |
|---|---|---|---|
--json | Output results as JSON | false | |
--strict | Treat warnings as errors | false | |
--quiet | -q | Only output errors (no success messages) | false |
--export | Export format: junit | None | |
--export-output | Output directory for exports | ./artemis-exports |
Validation Levels
Section titled “Validation Levels”The validator checks scenarios at multiple levels:
1. YAML Syntax
Section titled “1. YAML Syntax”Validates that the file is valid YAML with proper formatting.
Example errors:
- Indentation errors
- Missing colons
- Invalid characters
2. Schema Validation
Section titled “2. Schema Validation”Validates that the scenario conforms to the ArtemisKit schema using Zod.
Example errors:
- Missing required fields (
name,cases) - Invalid field types
- Unknown/unrecognized fields
- Invalid expectation types
3. Semantic Validation
Section titled “3. Semantic Validation”Validates logical correctness of the scenario.
Example errors:
- Duplicate case IDs
- Undefined variable references (e.g.,
{{undefined_var}})
4. Warnings
Section titled “4. Warnings”Detects potential issues that don’t prevent execution but may indicate problems.
Example warnings:
- Deprecated fields (e.g.,
criteriainstead ofrubric) - Missing
descriptionfield - Large number of cases (suggests using
--parallel)
Examples
Section titled “Examples”Validate a Single File
Section titled “Validate a Single File”akit validate scenarios/qa-test.yamlOutput:
Validating scenarios...
✓ qa-test.yaml
✓ 1 passed1 scenario(s) validatedValidate a Directory
Section titled “Validate a Directory”akit validate scenarios/Output:
Validating scenarios...
✓ qa-test.yaml✓ security-test.yaml⚠ legacy-test.yaml Line 15: 'criteria' is deprecated, use 'rubric' instead (llm_grader) Suggestion: Replace 'criteria' with 'rubric'
✓ 2 passed, 1 with warnings3 scenario(s) validatedValidate with Strict Mode
Section titled “Validate with Strict Mode”Treat warnings as errors:
akit validate scenarios/ --strictJSON Output
Section titled “JSON Output”Get machine-readable JSON output:
akit validate scenarios/qa-test.yaml --jsonOutput:
{ "valid": true, "results": [ { "file": "/path/to/scenarios/qa-test.yaml", "valid": true, "errors": [], "warnings": [] } ], "summary": { "total": 1, "passed": 1, "failed": 0, "withWarnings": 0 }}Quiet Mode
Section titled “Quiet Mode”Only show errors (useful for CI):
akit validate scenarios/ --quietCI/CD Integration with JUnit Export
Section titled “CI/CD Integration with JUnit Export”Export validation results as JUnit XML for CI systems like Jenkins, GitHub Actions, or GitLab CI:
akit validate scenarios/ --export junit --export-output ./test-resultsThis creates a JUnit XML file that CI systems can parse:
<?xml version="1.0" encoding="UTF-8"?><testsuite name="ArtemisKit Validation" tests="3" failures="1" errors="0" skipped="0"> <testcase classname="ArtemisKit Validation" name="/path/to/valid-scenario.yaml" time="0"> </testcase> <testcase classname="ArtemisKit Validation" name="/path/to/invalid-scenario.yaml" time="0"> <failure message="Line 5: 'cases' must have at least 1 item(s)" type="validation">[schema-too_small] Line 5: 'cases' must have at least 1 item(s) </failure> </testcase></testsuite>GitHub Actions example:
- name: Validate scenarios run: akit validate scenarios/ --export junit --export-output ./test-results
- name: Upload test results uses: actions/upload-artifact@v4 if: always() with: name: validation-results path: test-results/*.xmlExit Codes
Section titled “Exit Codes”| Code | Meaning |
|---|---|
| 0 | All scenarios are valid (no errors) |
| 1 | One or more scenarios have validation errors |
| 2 | No scenario files found matching the path |
Use Cases
Section titled “Use Cases”Pre-commit Hook
Section titled “Pre-commit Hook”Add validation to your pre-commit hooks to catch errors early:
#!/bin/bashakit validate scenarios/ --quietif [ $? -ne 0 ]; then echo "Scenario validation failed. Please fix errors before committing." exit 1fiCI Pipeline Validation
Section titled “CI Pipeline Validation”Validate scenarios as part of your CI pipeline before running actual tests:
# GitHub Actionsjobs: validate: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Install ArtemisKit run: bun add -g @artemiskit/cli - name: Validate scenarios run: akit validate scenarios/ --strict --export junitIDE Integration
Section titled “IDE Integration”Use JSON output for IDE/editor integration:
akit validate scenarios/test.yaml --json 2>/dev/null | jq '.results[0].errors'See Also
Section titled “See Also”- Scenario Format
- Expectations
- Run Command
- Red Team Command — Validate scenarios before security testing