@sf-kmods/kdataforgejs-cli 2026.4.19 → 2026.4.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/README.md +29 -2
  2. package/dist/cli.js +35 -2
  3. package/dist/commands/add.js +148 -0
  4. package/dist/commands/dev.js +114 -0
  5. package/dist/commands/doctor.js +56 -0
  6. package/dist/commands/gameData.js +165 -6
  7. package/dist/commands/sync.js +12 -3
  8. package/dist/types/configTypes.js +74 -0
  9. package/dist/types/contentTypes.js +152 -0
  10. package/dist/types/organize.js +4 -2
  11. package/package.json +4 -2
  12. package/schemas/actor-selector.schema.yml +39 -0
  13. package/schemas/asset.schema.yml +27 -0
  14. package/schemas/building.schema.yml +16 -0
  15. package/schemas/category_reorder.schema.yml +41 -0
  16. package/schemas/cdo.schema.yml +92 -0
  17. package/schemas/class.schema.yml +27 -0
  18. package/schemas/common.schema.yml +543 -0
  19. package/schemas/config.schema.yml +208 -0
  20. package/schemas/curve.schema.yml +59 -0
  21. package/schemas/dataasset.schema.yml +33 -0
  22. package/schemas/eventrule.schema.yml +47 -0
  23. package/schemas/gametag.schema.yml +24 -0
  24. package/schemas/item.schema.yml +16 -0
  25. package/schemas/localization.schema.yml +27 -0
  26. package/schemas/mam.schema.yml +5 -0
  27. package/schemas/pack.schema.yml +60 -0
  28. package/schemas/recipe.schema.yml +26 -0
  29. package/schemas/research.schema.yml +76 -0
  30. package/schemas/resource.schema.yml +16 -0
  31. package/schemas/resourcenode.schema.yml +117 -0
  32. package/schemas/schematic.schema.yml +75 -0
  33. package/schemas/sinkpoints.schema.yml +29 -0
  34. package/schemas/sound.schema.yml +45 -0
  35. package/schemas/sublevel.schema.yml +16 -0
  36. package/schemas/unlock.schema.yml +21 -0
  37. package/templates/default/README.md +5 -0
  38. package/templates/default/package.json +2 -0
@@ -4,20 +4,28 @@ import { isMap, isSeq, parseDocument, YAMLMap, YAMLSeq } from "yaml";
4
4
  import { findPackRoots } from "../pack/discover.js";
5
5
  import { sha256Of } from "../pack/imports.js";
6
6
  import { discoverPackUsage } from "../pack/usage.js";
7
+ import { syncConfigTypes } from "../types/configTypes.js";
7
8
  /** Generates manifest imports, digests, and reflection class authority from source usage. */
8
9
  export function syncProject(projectRoot) {
9
10
  if (!existsSync(projectRoot))
10
11
  return { changedPacks: [] };
11
- const changedPacks = findPackRoots(projectRoot).filter(syncPack);
12
+ const changedPacks = findPackRoots(projectRoot).filter((packRoot) => syncPack(packRoot, true));
12
13
  return { changedPacks };
13
14
  }
14
- function syncPack(packRoot) {
15
+ /** Reports manifest drift using the same generation path without changing files. */
16
+ export function inspectSyncDrift(projectRoot) {
17
+ if (!existsSync(projectRoot))
18
+ return { changedPacks: [] };
19
+ return { changedPacks: findPackRoots(projectRoot).filter((packRoot) => syncPack(packRoot, false)) };
20
+ }
21
+ function syncPack(packRoot, write) {
15
22
  const manifestFile = join(packRoot, "pack.yml");
16
23
  const before = readFileSync(manifestFile, "utf8");
17
24
  const document = parseDocument(before);
18
25
  const scripts = document.get("scripts", true);
19
26
  if (!isSeq(scripts))
20
27
  return false;
28
+ syncConfigTypes(packRoot);
21
29
  for (const script of scripts.items) {
22
30
  if (!isMap(script))
23
31
  continue;
@@ -31,7 +39,8 @@ function syncPack(packRoot) {
31
39
  const after = document.toString();
32
40
  if (after === before)
33
41
  return false;
34
- writeFileSync(manifestFile, after);
42
+ if (write)
43
+ writeFileSync(manifestFile, after);
35
44
  return true;
36
45
  }
37
46
  function setSequence(map, key, values) {
@@ -0,0 +1,74 @@
1
+ import { existsSync, mkdirSync, readFileSync, readdirSync, writeFileSync } from "node:fs";
2
+ import { dirname, join } from "node:path";
3
+ import { parse } from "yaml";
4
+ import { formatGeneratedContent } from "./format.js";
5
+ const CONFIG_ID = /^[A-Za-z_][A-Za-z0-9_]*(?:\.[A-Za-z_][A-Za-z0-9_]*)*$/u;
6
+ const MAX_CONFIG_FILES = 256;
7
+ const MAX_FIELDS = 1024;
8
+ const MAX_DIRECTORY_DEPTH = 16;
9
+ /** Emits pack-local keys only; a generated map never grants config access to a script. */
10
+ export function syncConfigTypes(packRoot) {
11
+ const fields = new Map();
12
+ for (const path of configFiles(packRoot)) {
13
+ const document = parse(readFileSync(path, "utf8"));
14
+ const entries = asRecord(document)?.fields;
15
+ if (!Array.isArray(entries))
16
+ continue;
17
+ for (const entry of entries) {
18
+ const field = asRecord(entry);
19
+ if (field === undefined || typeof field.id !== "string" || !CONFIG_ID.test(field.id))
20
+ throw new Error(`Invalid config id in ${path}.`);
21
+ if (fields.has(field.id))
22
+ throw new Error(`Duplicate config id '${field.id}'.`);
23
+ if (fields.size >= MAX_FIELDS)
24
+ throw new Error("Config type generation exceeds field limit.");
25
+ fields.set(field.id, fieldType(field));
26
+ }
27
+ }
28
+ const path = join(packRoot, "typescript/kdataforgejs-config.d.ts");
29
+ const entries = [...fields].sort(([left], [right]) => left.localeCompare(right))
30
+ .map(([id, type]) => `readonly ${JSON.stringify(id)}: ${type};`).join("\n");
31
+ const content = formatGeneratedContent(`// Generated by kdf sync. Do not edit.\ndeclare module "@sf-kmods/kdataforgejs" { export interface ConfigValueMap {\n${entries}\n} }\n`, path);
32
+ if (!existsSync(path) || readFileSync(path, "utf8") !== content) {
33
+ mkdirSync(dirname(path), { recursive: true });
34
+ writeFileSync(path, content);
35
+ }
36
+ return path;
37
+ }
38
+ function configFiles(root) {
39
+ const result = [];
40
+ const visit = (directory, depth) => {
41
+ if (depth > MAX_DIRECTORY_DEPTH)
42
+ throw new Error("Config type generation exceeds directory depth limit.");
43
+ for (const entry of readdirSync(directory, { withFileTypes: true }).sort((left, right) => left.name.localeCompare(right.name))) {
44
+ if (entry.isSymbolicLink() || entry.name === "typescript" || entry.name.startsWith("."))
45
+ continue;
46
+ const path = join(directory, entry.name);
47
+ if (entry.isDirectory())
48
+ visit(path, depth + 1);
49
+ else if (entry.isFile() && /\.config\.ya?ml$/iu.test(entry.name)) {
50
+ if (result.length >= MAX_CONFIG_FILES)
51
+ throw new Error("Config type generation exceeds file limit.");
52
+ result.push(path);
53
+ }
54
+ }
55
+ };
56
+ visit(root, 0);
57
+ return result;
58
+ }
59
+ function fieldType(field) {
60
+ let scalar;
61
+ const valueType = String(field.valueType ?? "").trim().toLowerCase();
62
+ if (field.type === "boolean" || valueType === "bool")
63
+ scalar = "boolean";
64
+ else if (field.type === "number" || ["int8", "int16", "int32", "int64", "uint8", "float", "double"].includes(valueType))
65
+ scalar = valueType === "int64" ? "number | bigint" : "number";
66
+ else if (field.type === "text" || field.type === "select")
67
+ scalar = "string";
68
+ else
69
+ throw new Error(`Unsupported config field type '${String(field.type)}'.`);
70
+ return field.multiple === true ? `readonly (${scalar})[]` : scalar;
71
+ }
72
+ function asRecord(value) {
73
+ return typeof value === "object" && value !== null && !Array.isArray(value) ? value : undefined;
74
+ }
@@ -0,0 +1,152 @@
1
+ import { existsSync, readFileSync } from "node:fs";
2
+ import { basename, join } from "node:path";
3
+ import { fileURLToPath } from "node:url";
4
+ import ts from "typescript";
5
+ import { parse } from "yaml";
6
+ const DOCUMENTS = {
7
+ AssetDocument: "asset", CategoryReorderDocument: "category_reorder", CdoDocument: "cdo",
8
+ CurveDocument: "curve", DataAssetDocument: "dataasset", EventRuleDocument: "eventrule",
9
+ GameTagDocument: "gametag", ItemDocument: "item", ResourceDocument: "resource", BuildingDocument: "building",
10
+ UnlockDocument: "unlock", RecipeDocument: "recipe", SchematicDocument: "schematic", ResearchDocument: "research",
11
+ ResourceNodeDocument: "resourcenode", SinkPointsDocument: "sinkpoints", SoundDocument: "sound", SublevelDocument: "sublevel",
12
+ };
13
+ /** Uses the same bundled schemas as KDF validation; never resolves schema URLs over the network. */
14
+ export function strictContentDeclarations(source) {
15
+ const generator = new ContentTypes();
16
+ const file = ts.createSourceFile("runtime.d.ts", source, ts.ScriptTarget.Latest, true);
17
+ const replacements = [];
18
+ const visit = (node) => {
19
+ if (ts.isInterfaceDeclaration(node) || ts.isTypeAliasDeclaration(node)) {
20
+ const schema = DOCUMENTS[node.name.text];
21
+ if (schema !== undefined)
22
+ replacements.push({ start: node.getStart(file), end: node.end,
23
+ text: `export type ${node.name.text} = ${generator.reference(`${schema}.schema.yml`, "")};` });
24
+ }
25
+ ts.forEachChild(node, visit);
26
+ };
27
+ visit(file);
28
+ let result = source;
29
+ for (const replacement of replacements.sort((left, right) => right.start - left.start)) {
30
+ result = result.slice(0, replacement.start) + replacement.text + result.slice(replacement.end);
31
+ }
32
+ if (replacements.length === 0)
33
+ return source;
34
+ return `${result}\ndeclare module "@sf-kmods/kdataforgejs" {\n${generator.declarations()}\n}\n`;
35
+ }
36
+ class ContentTypes {
37
+ schemas = new Map();
38
+ aliases = new Map();
39
+ directory = schemaDirectory();
40
+ reference(file, pointer) {
41
+ if (!/^[a-z_\-]+\.schema\.yml$/u.test(file) || (pointer !== "" && !pointer.startsWith("/"))) {
42
+ throw new Error(`Unsupported local schema reference: ${file}#${pointer}`);
43
+ }
44
+ const key = `${file}#${pointer}`;
45
+ const name = aliasName(key);
46
+ if (!this.aliases.has(key)) {
47
+ let node = this.load(file);
48
+ for (const part of pointer.split("/").slice(1)) {
49
+ node = record(node)?.[part.replaceAll("~1", "/").replaceAll("~0", "~")];
50
+ }
51
+ const schema = record(node);
52
+ if (schema === undefined)
53
+ throw new Error(`Missing bundled schema definition: ${key}`);
54
+ this.aliases.set(key, { file, pointer, schema });
55
+ }
56
+ return name;
57
+ }
58
+ declarations() {
59
+ const declarations = [];
60
+ for (const [key, located] of this.aliases) {
61
+ declarations.push(`type ${aliasName(key)} = ${this.render(located.schema, located.file)};`);
62
+ }
63
+ return declarations.join("\n");
64
+ }
65
+ load(file) {
66
+ const cached = this.schemas.get(file);
67
+ if (cached !== undefined)
68
+ return cached;
69
+ const schema = record(parse(readFileSync(join(this.directory, file), "utf8")));
70
+ if (schema === undefined)
71
+ throw new Error(`Invalid bundled schema: ${file}`);
72
+ this.schemas.set(file, schema);
73
+ return schema;
74
+ }
75
+ render(schema, file) {
76
+ const parts = [];
77
+ if (typeof schema.$ref === "string") {
78
+ const [path = "", pointer = ""] = schema.$ref.split("#");
79
+ parts.push(this.reference(path === "" ? file : basename(path), pointer));
80
+ }
81
+ if ("const" in schema)
82
+ parts.push(literal(schema.const));
83
+ else if (Array.isArray(schema.enum))
84
+ parts.push(schema.enum.map(literal).join(" | "));
85
+ else {
86
+ const type = this.valueType(schema, file);
87
+ if (type !== undefined)
88
+ parts.push(type);
89
+ }
90
+ for (const key of ["allOf", "anyOf", "oneOf"]) {
91
+ const entries = schema[key];
92
+ if (!Array.isArray(entries))
93
+ continue;
94
+ const types = entries.map((entry) => this.render(record(entry) ?? {}, file));
95
+ if (types.length > 0)
96
+ parts.push(`(${types.join(key === "allOf" ? " & " : " | ")})`);
97
+ }
98
+ return parts.length === 0 ? "unknown" : parts.map((part) => `(${part})`).join(" & ");
99
+ }
100
+ valueType(schema, file) {
101
+ if (Array.isArray(schema.type)) {
102
+ return schema.type.map((type) => this.valueType({ ...schema, type }, file) ?? "unknown").join(" | ");
103
+ }
104
+ if (schema.type === "string")
105
+ return "string";
106
+ if (schema.type === "number" || schema.type === "integer")
107
+ return "number";
108
+ if (schema.type === "boolean")
109
+ return "boolean";
110
+ if (schema.type === "null")
111
+ return "null";
112
+ if (schema.type === "array")
113
+ return `ReadonlyArray<${this.render(record(schema.items) ?? {}, file)}>`;
114
+ if (schema.type === "object" || schema.properties !== undefined || schema.required !== undefined)
115
+ return this.objectType(schema, file);
116
+ return undefined;
117
+ }
118
+ objectType(schema, file) {
119
+ const properties = record(schema.properties) ?? {};
120
+ const required = new Set(Array.isArray(schema.required) ? schema.required.filter((value) => typeof value === "string") : []);
121
+ const names = [...new Set([...Object.keys(properties), ...required])].sort();
122
+ const fields = names.map((name) => `readonly ${JSON.stringify(name)}${required.has(name) ? "" : "?"}: ${this.render(record(properties[name]) ?? {}, file)};`);
123
+ const excluded = record(schema.not)?.required;
124
+ if (Array.isArray(excluded) && excluded.length === 1 && typeof excluded[0] === "string") {
125
+ fields.push(`readonly ${JSON.stringify(excluded[0])}?: never;`);
126
+ }
127
+ const additional = record(schema.additionalProperties);
128
+ if (additional !== undefined)
129
+ fields.push(`readonly [key: string]: ${this.render(additional, file)};`);
130
+ if (fields.length === 0 && schema.additionalProperties !== false)
131
+ return "Readonly<Record<string, unknown>>";
132
+ return `{ ${fields.join(" ")} }`;
133
+ }
134
+ }
135
+ function record(value) {
136
+ return typeof value === "object" && value !== null && !Array.isArray(value) ? value : undefined;
137
+ }
138
+ function literal(value) {
139
+ if (value === null || typeof value === "string" || typeof value === "number" || typeof value === "boolean")
140
+ return JSON.stringify(value);
141
+ throw new Error("Content schema contains a non-scalar enum or const.");
142
+ }
143
+ function aliasName(key) {
144
+ return `KDFSchema_${key.replace(/\.schema\.yml/gu, "").replace(/[^a-zA-Z0-9]/gu, "_")}`;
145
+ }
146
+ function schemaDirectory() {
147
+ const directories = [new URL("../../schemas/", import.meta.url), new URL("../../../schemas/", import.meta.url)];
148
+ const directory = directories.find((candidate) => existsSync(new URL("common.schema.yml", candidate)));
149
+ if (directory === undefined)
150
+ throw new Error("Bundled content schemas missing; rebuild the CLI package.");
151
+ return fileURLToPath(directory);
152
+ }
@@ -2,13 +2,15 @@ import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node
2
2
  import { dirname, join, sep } from "node:path";
3
3
  import ts from "typescript";
4
4
  import { formatGeneratedContent } from "./format.js";
5
+ import { strictContentDeclarations } from "./contentTypes.js";
5
6
  const RUNTIME_MODULE = "@sf-kmods/kdataforgejs";
6
7
  const SATISFACTORY_MODULE = "satisfactory";
7
8
  const GENERATED_FILE = "kdataforge.generated.d.ts";
8
9
  /** Splits exported ambient declarations into deterministic, navigable files and returns the entry declaration. */
9
- export function organizeGeneratedDeclarations(typesDirectory) {
10
+ export function organizeGeneratedDeclarations(typesDirectory, options = {}) {
10
11
  const generatedPath = join(typesDirectory, GENERATED_FILE);
11
- const source = ts.createSourceFile(generatedPath, readFileSync(generatedPath, "utf8"), ts.ScriptTarget.ES2020, true, ts.ScriptKind.TS);
12
+ const original = readFileSync(generatedPath, "utf8");
13
+ const source = ts.createSourceFile(generatedPath, options.contentTypes ? strictContentDeclarations(original) : original, ts.ScriptTarget.ES2020, true, ts.ScriptKind.TS);
12
14
  removePreviousOrganization(typesDirectory);
13
15
  const references = [];
14
16
  const runtimeDeclarations = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sf-kmods/kdataforgejs-cli",
3
- "version": "2026.4.19",
3
+ "version": "2026.4.23",
4
4
  "description": "kdf - create, type-check and validate KDataForge projects with KDataForgeJS (TypeScript) scripts.",
5
5
  "license": "MIT",
6
6
  "author": "Kyri123/Kyrium",
@@ -28,6 +28,7 @@
28
28
  "files": [
29
29
  "dist",
30
30
  "templates",
31
+ "schemas",
31
32
  "README.md"
32
33
  ],
33
34
  "engines": {
@@ -38,12 +39,13 @@
38
39
  "@biomejs/wasm-nodejs": "2.6.3",
39
40
  "typescript": ">=5.7.3 <6",
40
41
  "yaml": "^2.6.1",
41
- "@sf-kmods/kdataforgejs": "^2026.4.19"
42
+ "@sf-kmods/kdataforgejs": "^2026.4.23"
42
43
  },
43
44
  "devDependencies": {
44
45
  "@types/node": "^22.10.0"
45
46
  },
46
47
  "scripts": {
48
+ "sync:schemas": "node scripts/sync-content-schemas.mjs",
47
49
  "build": "tsc -p tsconfig.build.json",
48
50
  "test": "tsc -p tsconfig.test.json && node --test \"dist-test/test/*.test.js\""
49
51
  }
@@ -0,0 +1,39 @@
1
+ $schema: https://json-schema.org/draft/2020-12/schema
2
+ $id: https://raw.githubusercontent.com/Satisfactory-KMods/KDataForge-Linter/main/src/kdataforge_linter/schemas/actor-selector.schema.yml
3
+ title: KDataForge actor instance selector
4
+ type: object
5
+ additionalProperties: false
6
+ minProperties: 1
7
+ properties:
8
+ tags:
9
+ oneOf:
10
+ - { type: string, minLength: 1, pattern: '\S' }
11
+ - type: array
12
+ minItems: 1
13
+ items: { type: string, minLength: 1, pattern: '\S' }
14
+ sphere:
15
+ type: object
16
+ additionalProperties: false
17
+ required: [center, radius]
18
+ properties:
19
+ center: { $ref: '#/$defs/vector' }
20
+ radius: { type: number, exclusiveMinimum: 0 }
21
+ box:
22
+ type: object
23
+ additionalProperties: false
24
+ required: [min, max]
25
+ properties:
26
+ min: { $ref: '#/$defs/vector' }
27
+ max: { $ref: '#/$defs/vector' }
28
+ currentRecipe:
29
+ oneOf:
30
+ - { type: string, minLength: 1, pattern: '\S' }
31
+ - type: array
32
+ minItems: 1
33
+ items: { type: string, minLength: 1, pattern: '\S' }
34
+ $defs:
35
+ vector:
36
+ type: array
37
+ minItems: 3
38
+ maxItems: 3
39
+ items: { type: number }
@@ -0,0 +1,27 @@
1
+ $schema: https://json-schema.org/draft/2020-12/schema
2
+ $id: https://raw.githubusercontent.com/Satisfactory-KMods/KDataForge-Linter/main/src/kdataforge_linter/schemas/asset.schema.yml
3
+ x-kdf-type: asset
4
+ title: KDataForge image assets
5
+ allOf:
6
+ - $ref: https://raw.githubusercontent.com/Satisfactory-KMods/KDataForge-Linter/main/src/kdataforge_linter/schemas/common.schema.yml#/$defs/documentBase
7
+ - type: object
8
+ required: [assets]
9
+ properties:
10
+ type: { const: asset }
11
+ assets:
12
+ type: array
13
+ minItems: 1
14
+ items:
15
+ type: object
16
+ additionalProperties: false
17
+ required: [id, file]
18
+ properties:
19
+ id:
20
+ $ref: https://raw.githubusercontent.com/Satisfactory-KMods/KDataForge-Linter/main/src/kdataforge_linter/schemas/common.schema.yml#/$defs/token
21
+ file:
22
+ type: string
23
+ minLength: 1
24
+ pattern: '\.(?:[Pp][Nn][Gg]|[Jj][Pp][Ee]?[Gg]|[Tt][Gg][Aa]|[Bb][Mm][Pp])$'
25
+ properties:
26
+ $ref: https://raw.githubusercontent.com/Satisfactory-KMods/KDataForge-Linter/main/src/kdataforge_linter/schemas/common.schema.yml#/$defs/properties
27
+ unevaluatedProperties: false
@@ -0,0 +1,16 @@
1
+ $schema: https://json-schema.org/draft/2020-12/schema
2
+ $id: https://raw.githubusercontent.com/Satisfactory-KMods/KDataForge-Linter/main/src/kdataforge_linter/schemas/building.schema.yml
3
+ x-kdf-type: building
4
+ title: KDataForge buildings
5
+ allOf:
6
+ - $ref: https://raw.githubusercontent.com/Satisfactory-KMods/KDataForge-Linter/main/src/kdataforge_linter/schemas/common.schema.yml#/$defs/documentBase
7
+ - type: object
8
+ required: [buildings]
9
+ properties:
10
+ type: { const: building }
11
+ buildings:
12
+ type: array
13
+ minItems: 1
14
+ items:
15
+ $ref: https://raw.githubusercontent.com/Satisfactory-KMods/KDataForge-Linter/main/src/kdataforge_linter/schemas/common.schema.yml#/$defs/generatedEntry
16
+ unevaluatedProperties: false
@@ -0,0 +1,41 @@
1
+ $schema: https://json-schema.org/draft/2020-12/schema
2
+ $id: https://raw.githubusercontent.com/Satisfactory-KMods/KDataForge-Linter/main/src/kdataforge_linter/schemas/category_reorder.schema.yml
3
+ x-kdf-type: category_reorder
4
+ title: KDataForge category ordering
5
+ allOf:
6
+ - $ref: https://raw.githubusercontent.com/Satisfactory-KMods/KDataForge-Linter/main/src/kdataforge_linter/schemas/common.schema.yml#/$defs/documentBase
7
+ - type: object
8
+ required: [subType, category, order]
9
+ properties:
10
+ type: { const: category_reorder }
11
+ subType:
12
+ type: string
13
+ enum: [items, recipe, schematic, settings]
14
+ category:
15
+ $ref: https://raw.githubusercontent.com/Satisfactory-KMods/KDataForge-Linter/main/src/kdataforge_linter/schemas/common.schema.yml#/$defs/nonEmptyString
16
+ subCategory:
17
+ $ref: https://raw.githubusercontent.com/Satisfactory-KMods/KDataForge-Linter/main/src/kdataforge_linter/schemas/common.schema.yml#/$defs/nonEmptyString
18
+ categoryPriority: { type: number }
19
+ subCategoryPriority: { type: number }
20
+ order:
21
+ type: array
22
+ minItems: 1
23
+ uniqueItems: true
24
+ items:
25
+ $ref: https://raw.githubusercontent.com/Satisfactory-KMods/KDataForge-Linter/main/src/kdataforge_linter/schemas/common.schema.yml#/$defs/nonEmptyString
26
+ allOf:
27
+ - if:
28
+ required: [subCategoryPriority]
29
+ then:
30
+ required: [subCategory]
31
+ - if:
32
+ properties:
33
+ subType: { const: recipe }
34
+ required: [subType]
35
+ then:
36
+ not:
37
+ anyOf:
38
+ - required: [subCategory]
39
+ - required: [subCategoryPriority]
40
+ unevaluatedProperties: false
41
+ unevaluatedProperties: false
@@ -0,0 +1,92 @@
1
+ $schema: https://json-schema.org/draft/2020-12/schema
2
+ $id: https://raw.githubusercontent.com/Satisfactory-KMods/KDataForge-Linter/main/src/kdataforge_linter/schemas/cdo.schema.yml
3
+ x-kdf-type: cdo
4
+ title: KDataForge CDO patches
5
+ allOf:
6
+ - $ref: https://raw.githubusercontent.com/Satisfactory-KMods/KDataForge-Linter/main/src/kdataforge_linter/schemas/common.schema.yml#/$defs/documentBase
7
+ - type: object
8
+ required: [patches]
9
+ properties:
10
+ type: { const: cdo }
11
+ patches:
12
+ type: array
13
+ minItems: 1
14
+ items:
15
+ type: object
16
+ oneOf:
17
+ - required: [properties]
18
+ not:
19
+ anyOf:
20
+ - required: [actorAction]
21
+ - required: [inventoryRemap]
22
+ - required: [actorAction]
23
+ not:
24
+ anyOf:
25
+ - required: [properties]
26
+ - required: [inventoryRemap]
27
+ - required: [inventoryRemap]
28
+ not:
29
+ anyOf:
30
+ - required: [properties]
31
+ - required: [actorAction]
32
+ allOf:
33
+ - $ref: https://raw.githubusercontent.com/Satisfactory-KMods/KDataForge-Linter/main/src/kdataforge_linter/schemas/common.schema.yml#/$defs/scopeFilters
34
+ - $ref: https://raw.githubusercontent.com/Satisfactory-KMods/KDataForge-Linter/main/src/kdataforge_linter/schemas/common.schema.yml#/$defs/scopeNeedsOfClass
35
+ properties:
36
+ target:
37
+ $ref: https://raw.githubusercontent.com/Satisfactory-KMods/KDataForge-Linter/main/src/kdataforge_linter/schemas/common.schema.yml#/$defs/stringOrList
38
+ allAssetsOfClass:
39
+ $ref: https://raw.githubusercontent.com/Satisfactory-KMods/KDataForge-Linter/main/src/kdataforge_linter/schemas/common.schema.yml#/$defs/nonEmptyString
40
+ applyToSubclasses: { type: boolean, default: false }
41
+ applyToSpawnedActors: { type: boolean, default: false }
42
+ actorAction:
43
+ type: string
44
+ enum: [destroy, dismantle]
45
+ inventoryRemap:
46
+ type: array
47
+ minItems: 1
48
+ maxItems: 256
49
+ items:
50
+ type: object
51
+ required: [from, to]
52
+ properties:
53
+ from:
54
+ $ref: https://raw.githubusercontent.com/Satisfactory-KMods/KDataForge-Linter/main/src/kdataforge_linter/schemas/common.schema.yml#/$defs/nonEmptyString
55
+ to:
56
+ $ref: https://raw.githubusercontent.com/Satisfactory-KMods/KDataForge-Linter/main/src/kdataforge_linter/schemas/common.schema.yml#/$defs/nonEmptyString
57
+ multiplier: { type: integer, minimum: 1, maximum: 2147483647, default: 1 }
58
+ additionalProperties: false
59
+ actorSelector:
60
+ $ref: https://raw.githubusercontent.com/Satisfactory-KMods/KDataForge-Linter/main/src/kdataforge_linter/schemas/actor-selector.schema.yml
61
+ deferOneGameTick: { type: boolean, default: false }
62
+ properties:
63
+ $ref: https://raw.githubusercontent.com/Satisfactory-KMods/KDataForge-Linter/main/src/kdataforge_linter/schemas/common.schema.yml#/$defs/properties
64
+ if:
65
+ anyOf:
66
+ - required: [actorSelector]
67
+ - required: [actorAction]
68
+ - required: [inventoryRemap]
69
+ then:
70
+ required: [target, applyToSpawnedActors]
71
+ properties:
72
+ applyToSpawnedActors: { const: true }
73
+ not:
74
+ anyOf:
75
+ - required: [allAssetsOfClass]
76
+ - required: [ofClass]
77
+ - required: [matchTag]
78
+ - required: [matchName]
79
+ - required: [classType]
80
+ - required: [excludeClasses]
81
+ - required: [where]
82
+ - required: [producedIn]
83
+ - required: [ingredient]
84
+ - required: [product]
85
+ - required: [tagProperty]
86
+ - required: [matchAssets]
87
+ anyOf:
88
+ - required: [target]
89
+ - required: [allAssetsOfClass]
90
+ - $ref: https://raw.githubusercontent.com/Satisfactory-KMods/KDataForge-Linter/main/src/kdataforge_linter/schemas/common.schema.yml#/$defs/hasScopeFilter
91
+ unevaluatedProperties: false
92
+ unevaluatedProperties: false
@@ -0,0 +1,27 @@
1
+ $schema: https://json-schema.org/draft/2020-12/schema
2
+ $id: https://raw.githubusercontent.com/Satisfactory-KMods/KDataForge-Linter/main/src/kdataforge_linter/schemas/class.schema.yml
3
+ x-kdf-type: class
4
+ title: KDataForge generic classes
5
+ allOf:
6
+ - $ref: https://raw.githubusercontent.com/Satisfactory-KMods/KDataForge-Linter/main/src/kdataforge_linter/schemas/common.schema.yml#/$defs/documentBase
7
+ - type: object
8
+ required: [classes]
9
+ properties:
10
+ type: { const: class }
11
+ classes:
12
+ type: array
13
+ minItems: 1
14
+ items:
15
+ type: object
16
+ additionalProperties: false
17
+ required: [id, parent]
18
+ properties:
19
+ id:
20
+ $ref: https://raw.githubusercontent.com/Satisfactory-KMods/KDataForge-Linter/main/src/kdataforge_linter/schemas/common.schema.yml#/$defs/token
21
+ parent:
22
+ $ref: https://raw.githubusercontent.com/Satisfactory-KMods/KDataForge-Linter/main/src/kdataforge_linter/schemas/common.schema.yml#/$defs/nonEmptyString
23
+ registerAs:
24
+ enum: [recipe, schematic, research]
25
+ properties:
26
+ $ref: https://raw.githubusercontent.com/Satisfactory-KMods/KDataForge-Linter/main/src/kdataforge_linter/schemas/common.schema.yml#/$defs/properties
27
+ unevaluatedProperties: false