This project is a command line tool that evaluates a JSON file according to the rules defined in a JPEG Trust Profile. It utilizes json-formula rules to assess the validity and compliance of the JSON data.
-
Clone the repository:
git clone https://github.com/yourusername/jpeg-trust-evaluator.git
-
Navigate to the project directory:
cd jpeg-trust-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 JPEG Trust Indicator Sets data to evaluate
-p, --profile <path>
- Path to the JPEG Trust Profile file (JSON or YAML format)
-o, --output <directory>
- Output directory for reports (if not specified, results are printed to console)-y, --yaml
- Output report in YAML format (default is JSON)--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 JSON report in output directory:
node src/index.js -p testfiles/genai_profile.yml -o output testfiles/genai_indicators.json
-
Generate YAML report:
node src/index.js -p testfiles/no_manifests_profile.yml -o output --yaml 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
# 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 utility functions
- Integration Tests: Test the complete CLI workflow
- Error Handling Tests: Verify graceful error handling
- C2PA Tests: Verify processing of the Content Credentials & JPEG Trust Manifests
# 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.
- Initial release
- Comprehensive test suite
- ESLint integration
- Jest testing framework
- Pretty printing support
- Error handling and validation