visual_brief_lint 1.0.0
visual_brief_lint: ^1.0.0 copied to clipboard
Validate structured AI image briefs before they enter a generation or editing workflow.
visual_brief_lint #
Validate structured AI image briefs before they reach a generation or editing workflow. The package is dependency-free and works in Dart command-line, server, web, and Flutter projects.
Features #
- Model a portable visual brief with subject, composition, style, constraints, reference assets, negative prompts, and output requirements.
- Read and write JSON-compatible maps.
- Catch missing creative direction, invalid dimensions, unsupported formats, and duplicate reference IDs.
- Separate blocking errors from non-blocking warnings.
- Configure maximum dimensions and allowed output formats.
Getting started #
Add the package:
dart pub add visual_brief_lint
Usage #
import 'package:visual_brief_lint/visual_brief_lint.dart';
void main() {
const brief = VisualBrief(
subject: 'A reusable glass bottle with a white paper label',
composition: 'Centered product shot at eye level with generous margin',
style: 'Clean studio photography with soft directional light',
constraints: ['Keep the label blank', 'No hands or people'],
output: VisualOutputSpec(width: 1200, height: 1200),
referenceAssetIds: ['bottle-front'],
);
const linter = VisualBriefLinter();
final issues = linter.lint(brief);
if (issues.isEmpty) {
print('Brief is ready for generation.');
} else {
issues.forEach(print);
}
}
The linter is intentionally model-agnostic. It can sit before an internal image API, a queue, or a third-party workflow. For example, a team drafting prompts and object-reference edits in Nano Banana 2 Lite can validate the brief structure before handing it to the generation stage.
JSON input #
final brief = VisualBrief.fromJson({
'subject': 'A compact desk lamp with a brushed metal base',
'composition': 'Side view on a clear desk with negative space',
'style': 'Minimal product photograph with natural shadows',
'constraints': ['Keep the power cable visible'],
'output': {'width': 1400, 'height': 1000, 'format': 'webp'},
});
final issues = const VisualBriefLinter().lint(brief);
Use isValid when only a pass/fail result is needed. Use lint when a UI or
pipeline should show actionable feedback.
Contributing #
Issues and focused pull requests are welcome in the GitHub repository. Please include tests for new rules and keep rules deterministic.