<commit_before>package com.vanillaci.scriptbundles;

import com.vanillaci.util.*;
import org.jetbrains.annotations.*;

import java.io.*;
import java.util.*;

/**
 * @author <NAME>
 */
public class Script implements Serializable {
	@NotNull
	private final File bundleDirectory;

	@NotNull
	private final Manifest manifest;

	public static Script forDirectory(File bundleDirectory) throws IOException {
		File manifestFile = new File(bundleDirectory, "manifest.json");
		Manifest manifest = JsonUtil.parseJson(manifestFile, Manifest.TYPE_REFERENCE);
		return new Script(bundleDirectory, manifest);
	}

	private Script(@NotNull File bundleDirectory, @NotNull Manifest manifest) {
		this.bundleDirectory = bundleDirectory;
		this.manifest = manifest;<commit_msg>making sure the bundle checks that all the files are what it expects them to be.<commit_after>package com.vanillaci.scriptbundles;

import com.vanillaci.util.*;
import org.jetbrains.annotations.*;

import java.io.*;
import java.util.*;

/**
 * @author <NAME>
 */
public class Script implements Serializable {
	@NotNull
	private final File bundleDirectory;

	@NotNull
	private final Manifest manifest;

	public static Script forDirectory(File bundleDirectory) throws IOException {
		if(!bundleDirectory.exists()) {
			throw new FileNotFoundException("Bundle directory doesn't exist: " + bundleDirectory.getAbsolutePath());
		}
		if(!bundleDirectory.isDirectory()) {
			throw new FileNotFoundException("Bundle directory must be a directory: " + bundleDirectory.getAbsolutePath());
		}

		File manifestFile = new File(bundleDirectory, "manifest.json");
		if(!manifestFile.exists() || !manifestFile.isFile()) {
			throw new FileNotFoundException("Bundle directory must contain a manifest.json file at the given path: " + manifestFile.getAbsolutePath() + ". See documentation for more information.");
		}

		Manifest manifest = JsonUtil.parseJson(manifestFile, Manifest.TYPE_REFERENCE);
		return new Script(bundleDirectory, manifest);
	}

	private Script(@NotNull File bundleDirectory, @NotNull Manifest manifest) {
		this.bundleDirectory = bundleDirectory;
		this.manifest = manifest;
{'fraction_non_alphanumeric': 0.10009354536950421, 'fraction_numerical': 0.0, 'mean_word_length': 5.521341463414634, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6198085', 'n_tokens_mistral': 591, 'n_tokens_neox': 550, 'n_words': 169}