inital ai slop code

This commit is contained in:
2025-08-08 18:04:01 +02:00
parent a31d79bb09
commit 512521e9d0
15 changed files with 1855 additions and 0 deletions

31
src/validator.ts Normal file
View File

@@ -0,0 +1,31 @@
import { StoryConfig } from "./config";
export interface ValidationResult {
is_public_domain: boolean;
message: string;
}
export function validatePublicDomain(storyConfig: StoryConfig): ValidationResult {
const publicationYear = storyConfig.metadata.publication_year;
if (!publicationYear) {
return {
is_public_domain: false,
message: "Publication year not found in metadata.",
};
}
const currentYear = new Date().getFullYear();
const cutoffYear = currentYear - 95;
if (publicationYear > cutoffYear) {
return {
is_public_domain: false,
message: `Work published in ${publicationYear} is not yet in the US public domain (cutoff: \u2264 ${cutoffYear}).`,
};
}
return {
is_public_domain: true,
message: "Work is in the public domain in the US (95-year rule).",
};
}