This project is a command line tool that evaluates a JSON file containing a Trust Indicator Set according to the (YAML-based) Trust Profile, based on the details from the JPEG Trust (ISO 21617-1:2025) standard.
This tool also serves to validate forthcoming work in the 2nd Edition of JPEG Trust Part 1 as well as JPEG Trust Part 2 (ISO 21617-2).
-
Clone the repository:
git clone https://github.com/adobe/profile-evaluator.git
-
Navigate to the project directory:
cd profile-evaluator
-
Install the dependencies:
npm install
To run the tool, use the following command:
node src/index.js [options] <jsonFile>
<jsonFile>
- Path to the JSON file containing Trust Indicator Set to evaluate
-p, --profile <path>
- Path to the Trust Profile file (YAML format)
OR
-e, --eval <expression>
- JSON formula expression to evaluate against the data (cannot be used with --profile)
-o, --output <directory>
- Output directory for reports (if not specified, results are printed to console)-y, --yaml
- Output report in YAML format (default)-j, --json
- Output report in YAML format--html <path>
- Path to HTML template file for generating HTML reports-h, --help
- Display help information-V, --version
- Display version number
-
Basic evaluation (output to console):
node src/index.js -p testfiles/camera_profile.yml testfiles/camera_indicators.json
-
Generate YAML report in output directory:
node src/index.js -p testfiles/genai_profile.yml -o output testfiles/genai_indicators.json
-
Generate JSON report:
node src/index.js -p testfiles/no_manifests_profile.yml -o output --json testfiles/no_manifests_indicators.json
-
Generate HTML report using a template:
node src/index.js -p testfiles/camera_profile.yml -o output --html testfiles/report_template.html testfiles/camera_indicators.json
-
Evaluate a simple expression against Trust Indicator Set data:
node src/index.js --eval "declaration.'claim.v2'.alg" testfiles/camera_indicators.json
-
Check if a property exists:
node src/index.js --eval "has(declaration.assertions)" testfiles/camera_indicators.json
The --eval
option allows you to run JSON formula expressions directly against Trust Indicator Set data without requiring a Trust Profile. This is useful for:
- Quick data exploration: Extract specific values from Trust Indicator Sets
- Property validation: Check if certain fields exist in the data
- Data transformation: Apply expressions to compute derived values
- Debugging: Test expressions before including them in Trust Profiles
The tool supports JSON formula expressions with the following features:
- Property access: Use dot notation (e.g.,
data.field
) - Nested properties: Use quotes for special characters (e.g.,
"claim.v2"
) - Array access: Use bracket notation (e.g.,
array[0]
) - Functions: Built-in functions like
has()
,length()
, etc. - Operators: Standard comparison and logical operators
# Extract a simple property
node src/index.js --eval "declaration" testfiles/camera_indicators.json
# Access nested properties with special characters
node src/index.js --eval "declaration.'claim.v2'.alg" testfiles/camera_indicators.json
# Check if a property exists
node src/index.js --eval "has(declaration.assertions)" testfiles/camera_indicators.json
# Get array length
node src/index.js --eval "length(declaration.assertions)" testfiles/camera_indicators.json
Note: The --eval
and --profile
options are mutually exclusive - you cannot use both in the same command.
# Run the CLI
npm start
# Run tests
npm test
# Run tests with coverage
npm run test:coverage
# Run tests in watch mode
npm run test:watch
# Lint code
npm run lint
# Fix linting issues
npm run lint:fix
The project includes comprehensive tests using Jest:
- Unit Tests: Test individual features and functions
- Integration Tests: Test the complete CLI workflow
- Error Handling Tests: Verify graceful error handling
# Run all tests
npm test
# Run tests with coverage report
npm run test:coverage
# Run tests in watch mode for development
npm run test:watch
The project uses ESLint for code quality and consistency:
# Check for linting issues
npm run lint
# Automatically fix linting issues
npm run lint:fix
The project uses modern ESLint configuration with the following features:
- Modern JavaScript: ES2020 support with async/await
- Node.js Environment: Configured for Node.js development
- Strict Rules: Enforces consistent code style and best practices
- Jest Support: Configured for Jest testing environment
Contributions are welcome! Please open an issue or submit a pull request for any enhancements or bug fixes.
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature
) - Make your changes
- Run tests (
npm test
) - Run linting (
npm run lint
) - Commit your changes (
git commit -m 'Add amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
This project is licensed under the Apache 2.0 License. See the LICENSE file for more details.
- Changed default output format to YAML
- Added
--eval
option for evaluating JSON formula expressions directly (and associated tests!) - Improved error handling for missing profile or JSON file
- Started work on 21617-2 support
- Initial release
- Comprehensive test suite
- ESLint integration
- Jest testing framework
- Pretty printing support
- Error handling and validation