@toolproof-core/schema 1.0.0 → 1.0.2

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 (83) hide show
  1. package/dist/generated/types/standalone/Resource_Genesis.d.ts +3 -0
  2. package/dist/generated/types/standalone/Resource_Job.d.ts +3 -0
  3. package/dist/generated/types/standalone/Resource_RawStrategy.d.ts +3 -0
  4. package/dist/generated/types/standalone/Resource_ResourceType.d.ts +3 -0
  5. package/dist/generated/types/standalone/Resource_RunnableStrategy.d.ts +3 -0
  6. package/dist/generated/types/types.d.ts +487 -548
  7. package/dist/scripts/_lib/config.d.ts +12 -6
  8. package/dist/scripts/_lib/config.js +33 -15
  9. package/dist/scripts/{extractSchemas.js → extractSchemasFromResourceTypeShells.js} +14 -27
  10. package/dist/scripts/generateDependencies.js +2 -2
  11. package/dist/scripts/generateSchemaShims.js +22 -4
  12. package/dist/scripts/{extractSubSchemaWithDefs.js → generateStandaloneSchema.js} +12 -34
  13. package/dist/scripts/{generateResourceTypeType.js → generateStandaloneType.js} +23 -14
  14. package/dist/scripts/generateTypes.js +1 -1
  15. package/dist/scripts/{rewriteAnchors.js → normalizeAnchorsToPointers.js} +2 -2
  16. package/dist/scripts/{generateResourceShells.js → wrapResourceTypesWithResourceShells.js} +12 -34
  17. package/package.json +15 -14
  18. package/src/Genesis.json +1999 -2042
  19. package/src/generated/{dependencies.json → dependencyMap.json} +207 -214
  20. package/src/generated/{resourceTypes → normalized}/Genesis.json +44 -87
  21. package/src/generated/resources/Genesis.json +415 -478
  22. package/src/generated/schemas/Genesis.json +1026 -1057
  23. package/src/generated/schemas/{Goal.json → standalone/Goal.json} +34 -34
  24. package/src/generated/schemas/{Job.json → standalone/Job.json} +85 -85
  25. package/src/generated/schemas/{RawStrategy.json → standalone/RawStrategy.json} +238 -263
  26. package/src/generated/schemas/{ResourceType.json → standalone/ResourceType.json} +60 -60
  27. package/src/generated/schemas/{RunnableStrategy.json → standalone/RunnableStrategy.json} +296 -321
  28. package/src/generated/schemas/{StrategyRun.json → standalone/StrategyRun.json} +390 -421
  29. package/src/generated/types/standalone/Resource_Genesis.d.ts +3 -0
  30. package/src/generated/types/standalone/Resource_Genesis.js +1 -0
  31. package/src/generated/types/standalone/Resource_Job.d.ts +3 -0
  32. package/src/generated/types/standalone/Resource_Job.js +1 -0
  33. package/src/generated/types/standalone/Resource_RawStrategy.d.ts +3 -0
  34. package/src/generated/types/standalone/Resource_RawStrategy.js +1 -0
  35. package/src/generated/types/standalone/Resource_ResourceType.d.ts +3 -0
  36. package/src/generated/types/standalone/Resource_ResourceType.js +1 -0
  37. package/src/generated/types/standalone/Resource_RunnableStrategy.d.ts +3 -0
  38. package/src/generated/types/standalone/Resource_RunnableStrategy.js +1 -0
  39. package/src/generated/types/types.d.ts +487 -548
  40. package/src/generated/types/types.js +1 -1
  41. package/src/scripts/_lib/config.ts +205 -181
  42. package/src/scripts/extractSchemasFromResourceTypeShells.ts +218 -0
  43. package/src/scripts/generateDependencies.ts +120 -120
  44. package/src/scripts/generateSchemaShims.ts +135 -115
  45. package/src/scripts/{extractSubSchemaWithDefs.ts → generateStandaloneSchema.ts} +175 -196
  46. package/src/scripts/{generateResourceTypeType.ts → generateStandaloneType.ts} +119 -110
  47. package/src/scripts/generateTypes.ts +614 -614
  48. package/src/scripts/{rewriteAnchors.ts → normalizeAnchorsToPointers.ts} +123 -123
  49. package/src/scripts/{generateResourceShells.ts → wrapResourceTypesWithResourceShells.ts} +84 -105
  50. package/dist/generated/types/Resource_Genesis.d.ts +0 -3
  51. package/dist/generated/types/Resource_Job.d.ts +0 -3
  52. package/dist/generated/types/Resource_RawStrategy.d.ts +0 -3
  53. package/dist/generated/types/Resource_ResourceType.d.ts +0 -3
  54. package/dist/generated/types/Resource_RunnableStrategy.d.ts +0 -3
  55. package/src/Roadmap.json +0 -102
  56. package/src/generated/types/Resource_Genesis.d.ts +0 -3
  57. package/src/generated/types/Resource_Genesis.js +0 -1
  58. package/src/generated/types/Resource_Job.d.ts +0 -3
  59. package/src/generated/types/Resource_Job.js +0 -1
  60. package/src/generated/types/Resource_RawStrategy.d.ts +0 -3
  61. package/src/generated/types/Resource_RawStrategy.js +0 -1
  62. package/src/generated/types/Resource_ResourceType.d.ts +0 -3
  63. package/src/generated/types/Resource_ResourceType.js +0 -1
  64. package/src/generated/types/Resource_RunnableStrategy.d.ts +0 -3
  65. package/src/generated/types/Resource_RunnableStrategy.js +0 -1
  66. package/src/scripts/extractSchemas.ts +0 -229
  67. /package/dist/generated/types/{Resource_Genesis.js → standalone/Resource_Genesis.js} +0 -0
  68. /package/dist/generated/types/{Resource_Job.js → standalone/Resource_Job.js} +0 -0
  69. /package/dist/generated/types/{Resource_RawStrategy.js → standalone/Resource_RawStrategy.js} +0 -0
  70. /package/dist/generated/types/{Resource_ResourceType.js → standalone/Resource_ResourceType.js} +0 -0
  71. /package/dist/generated/types/{Resource_RunnableStrategy.js → standalone/Resource_RunnableStrategy.js} +0 -0
  72. /package/dist/scripts/{extractSchemas.d.ts → extractSchemasFromResourceTypeShells.d.ts} +0 -0
  73. /package/dist/scripts/{extractSubSchemaWithDefs.d.ts → generateStandaloneSchema.d.ts} +0 -0
  74. /package/dist/scripts/{generateResourceShells.d.ts → generateStandaloneType.d.ts} +0 -0
  75. /package/dist/scripts/{generateResourceTypeType.d.ts → normalizeAnchorsToPointers.d.ts} +0 -0
  76. /package/dist/scripts/{rewriteAnchors.d.ts → wrapResourceTypesWithResourceShells.d.ts} +0 -0
  77. /package/src/generated/{resourceTypes → normalized}/Genesis.ts +0 -0
  78. /package/src/generated/schemas/{Goal.ts → standalone/Goal.ts} +0 -0
  79. /package/src/generated/schemas/{Job.ts → standalone/Job.ts} +0 -0
  80. /package/src/generated/schemas/{RawStrategy.ts → standalone/RawStrategy.ts} +0 -0
  81. /package/src/generated/schemas/{ResourceType.ts → standalone/ResourceType.ts} +0 -0
  82. /package/src/generated/schemas/{RunnableStrategy.ts → standalone/RunnableStrategy.ts} +0 -0
  83. /package/src/generated/schemas/{StrategyRun.ts → standalone/StrategyRun.ts} +0 -0
@@ -1,123 +1,123 @@
1
- import fs from 'fs';
2
- import path from 'path';
3
- import { getConfig } from './_lib/config.js';
4
-
5
- /**
6
- * Rewrite anchor-style references to JSON Pointer references in Genesis.json
7
- *
8
- * Converts #AnchorName to #/$defs/AnchorName for compatibility with strict
9
- * JSON Schema validators and downstream tooling. This normalization step runs
10
- * before both schema extraction and resource envelope generation.
11
- *
12
- * The rewritten file is saved under src/genesis/generated/resourceTypes/Genesis.json
13
- * for use by other scripts.
14
- *
15
- * Usage: node ./dist/scripts/rewriteAnchors.js
16
- */
17
-
18
- type JSONValue = null | boolean | number | string | JSONValue[] | { [k: string]: JSONValue };
19
-
20
- /**
21
- * Pure function to rewrite anchor-style references to JSON Pointer references.
22
- * Converts #AnchorName to #/$defs/AnchorName for compatibility with strict JSON Schema validators.
23
- *
24
- * This function works on a schema object that has $defs at its top level.
25
- * @param input The schema object to process
26
- * @returns A new schema object with rewritten references
27
- */
28
- function rewriteAnchorsToPointers(input: any): any {
29
- if (!input || typeof input !== "object") return input;
30
-
31
- // Deep clone the input to ensure the function is pure (no side effects on input)
32
- const root = JSON.parse(JSON.stringify(input));
33
-
34
- // Build a map of anchors to their definition names
35
- const defs: Record<string, any> = root.$defs && typeof root.$defs === "object" ? root.$defs : {};
36
- const anchorToDef: Record<string, string> = {};
37
-
38
- // For Genesis structure: each def is a Type envelope with nucleusSchema.$anchor
39
- for (const [defName, defValue] of Object.entries(defs)) {
40
- if (!defValue || typeof defValue !== "object") continue;
41
-
42
- // Check if this is a Type envelope (has nucleusSchema property)
43
- const nucleusSchema = (defValue as any).nucleusSchema;
44
- if (nucleusSchema && typeof nucleusSchema === "object") {
45
- // Look for $anchor inside the nucleusSchema
46
- const anchor = nucleusSchema.$anchor;
47
- if (typeof anchor === "string" && !anchorToDef[anchor]) {
48
- anchorToDef[anchor] = defName;
49
- }
50
- } else {
51
- // Fallback: check for $anchor at the def level (non-envelope case)
52
- const anchor = (defValue as any).$anchor;
53
- if (typeof anchor === "string" && !anchorToDef[anchor]) {
54
- anchorToDef[anchor] = defName;
55
- }
56
- }
57
- }
58
-
59
- // Walk the entire tree and rewrite anchor refs to pointer refs
60
- function walk(node: any): void {
61
- if (Array.isArray(node)) {
62
- for (const item of node) walk(item);
63
- return;
64
- }
65
- if (!node || typeof node !== "object") return;
66
-
67
- // Rewrite $ref if it's an anchor-style reference
68
- if (typeof node.$ref === "string") {
69
- const ref: string = node.$ref;
70
- // Match anchor refs: starts with # but not #/ (JSON Pointer syntax)
71
- if (ref.startsWith("#") && !ref.startsWith("#/")) {
72
- const anchor = ref.slice(1);
73
- const defName = anchorToDef[anchor];
74
- if (defName) {
75
- node.$ref = `#/$defs/${defName}`;
76
- }
77
- }
78
- }
79
-
80
- // Recursively walk all properties
81
- for (const val of Object.values(node)) {
82
- walk(val);
83
- }
84
- }
85
-
86
- walk(root);
87
- return root;
88
- }
89
-
90
- async function main() {
91
- const config = getConfig();
92
- const genesisSourcePath = config.getSourcePath();
93
-
94
- // Create a generated/normalized version (anchor refs rewritten to pointers)
95
- const normalizedPath = config.getNormalizedSourcePath();
96
-
97
- if (!fs.existsSync(genesisSourcePath)) {
98
- console.error(`Genesis source file not found at ${genesisSourcePath}`);
99
- process.exit(1);
100
- }
101
-
102
- const raw = fs.readFileSync(genesisSourcePath, 'utf-8');
103
- const genesis = JSON.parse(raw);
104
-
105
- // Validate structure
106
- if (!genesis.nucleusSchema || !genesis.nucleusSchema.$defs) {
107
- console.error('Genesis.json must have nucleusSchema.$defs');
108
- process.exit(1);
109
- }
110
-
111
- // Rewrite anchors in the nucleusSchema (pure function call)
112
- genesis.nucleusSchema = rewriteAnchorsToPointers(genesis.nucleusSchema);
113
-
114
- // Write normalized version
115
- fs.mkdirSync(path.dirname(normalizedPath), { recursive: true });
116
- fs.writeFileSync(normalizedPath, JSON.stringify(genesis, null, 4), 'utf-8');
117
- console.log(`Wrote normalized Genesis with pointer refs to ${normalizedPath}`);
118
- }
119
-
120
- main().catch((e) => {
121
- console.error(e);
122
- process.exit(1);
123
- });
1
+ import fs from 'fs';
2
+ import path from 'path';
3
+ import { getConfig } from './_lib/config.js';
4
+
5
+ /**
6
+ * Rewrite anchor-style references to JSON Pointer references in Genesis.json
7
+ *
8
+ * Converts #AnchorName to #/$defs/AnchorName for compatibility with strict
9
+ * JSON Schema validators and downstream tooling. This normalization step runs
10
+ * before both schema extraction and resource envelope generation.
11
+ *
12
+ * The rewritten file is saved under src/genesis/generated/resourceTypes/Genesis.json
13
+ * for use by other scripts.
14
+ *
15
+ * Usage: node ./dist/scripts/normalizeAnchorsToPointers.js
16
+ */
17
+
18
+ type JSONValue = null | boolean | number | string | JSONValue[] | { [k: string]: JSONValue };
19
+
20
+ /**
21
+ * Pure function to rewrite anchor-style references to JSON Pointer references.
22
+ * Converts #AnchorName to #/$defs/AnchorName for compatibility with strict JSON Schema validators.
23
+ *
24
+ * This function works on a schema object that has $defs at its top level.
25
+ * @param input The schema object to process
26
+ * @returns A new schema object with rewritten references
27
+ */
28
+ function normalizeAnchorsToPointersToPointers(input: any): any {
29
+ if (!input || typeof input !== "object") return input;
30
+
31
+ // Deep clone the input to ensure the function is pure (no side effects on input)
32
+ const root = JSON.parse(JSON.stringify(input));
33
+
34
+ // Build a map of anchors to their definition names
35
+ const defs: Record<string, any> = root.$defs && typeof root.$defs === "object" ? root.$defs : {};
36
+ const anchorToDef: Record<string, string> = {};
37
+
38
+ // For Genesis structure: each def is a Type envelope with nucleusSchema.$anchor
39
+ for (const [defName, defValue] of Object.entries(defs)) {
40
+ if (!defValue || typeof defValue !== "object") continue;
41
+
42
+ // Check if this is a Type envelope (has nucleusSchema property)
43
+ const nucleusSchema = (defValue as any).nucleusSchema;
44
+ if (nucleusSchema && typeof nucleusSchema === "object") {
45
+ // Look for $anchor inside the nucleusSchema
46
+ const anchor = nucleusSchema.$anchor;
47
+ if (typeof anchor === "string" && !anchorToDef[anchor]) {
48
+ anchorToDef[anchor] = defName;
49
+ }
50
+ } else {
51
+ // Fallback: check for $anchor at the def level (non-envelope case)
52
+ const anchor = (defValue as any).$anchor;
53
+ if (typeof anchor === "string" && !anchorToDef[anchor]) {
54
+ anchorToDef[anchor] = defName;
55
+ }
56
+ }
57
+ }
58
+
59
+ // Walk the entire tree and rewrite anchor refs to pointer refs
60
+ function walk(node: any): void {
61
+ if (Array.isArray(node)) {
62
+ for (const item of node) walk(item);
63
+ return;
64
+ }
65
+ if (!node || typeof node !== "object") return;
66
+
67
+ // Rewrite $ref if it's an anchor-style reference
68
+ if (typeof node.$ref === "string") {
69
+ const ref: string = node.$ref;
70
+ // Match anchor refs: starts with # but not #/ (JSON Pointer syntax)
71
+ if (ref.startsWith("#") && !ref.startsWith("#/")) {
72
+ const anchor = ref.slice(1);
73
+ const defName = anchorToDef[anchor];
74
+ if (defName) {
75
+ node.$ref = `#/$defs/${defName}`;
76
+ }
77
+ }
78
+ }
79
+
80
+ // Recursively walk all properties
81
+ for (const val of Object.values(node)) {
82
+ walk(val);
83
+ }
84
+ }
85
+
86
+ walk(root);
87
+ return root;
88
+ }
89
+
90
+ async function main() {
91
+ const config = getConfig();
92
+ const genesisSourcePath = config.getSourcePath();
93
+
94
+ // Create a generated/normalized version (anchor refs rewritten to pointers)
95
+ const normalizedPath = config.getNormalizedSourcePath();
96
+
97
+ if (!fs.existsSync(genesisSourcePath)) {
98
+ console.error(`Genesis source file not found at ${genesisSourcePath}`);
99
+ process.exit(1);
100
+ }
101
+
102
+ const raw = fs.readFileSync(genesisSourcePath, 'utf-8');
103
+ const genesis = JSON.parse(raw);
104
+
105
+ // Validate structure
106
+ if (!genesis.nucleusSchema || !genesis.nucleusSchema.$defs) {
107
+ console.error('Genesis.json must have nucleusSchema.$defs');
108
+ process.exit(1);
109
+ }
110
+
111
+ // Rewrite anchors in the nucleusSchema (pure function call)
112
+ genesis.nucleusSchema = normalizeAnchorsToPointersToPointers(genesis.nucleusSchema);
113
+
114
+ // Write normalized version
115
+ fs.mkdirSync(path.dirname(normalizedPath), { recursive: true });
116
+ fs.writeFileSync(normalizedPath, JSON.stringify(genesis, null, 4), 'utf-8');
117
+ console.log(`Wrote normalized Genesis with pointer refs to ${normalizedPath}`);
118
+ }
119
+
120
+ main().catch((e) => {
121
+ console.error(e);
122
+ process.exit(1);
123
+ });
@@ -1,105 +1,84 @@
1
- import fs from 'fs';
2
- import path from 'path';
3
- import { getConfig } from './_lib/config.js';
4
-
5
- /**
6
- * Generate Resource envelopes for all ResourceTypes defined in Genesis.json
7
- *
8
- * This script wraps each ResourceType definition (from $defs) with a Resource envelope
9
- * that conforms to the Resource.nucleusSchema pattern defined in Genesis.json.
10
- *
11
- * For the top-level Genesis ResourceType, extractedData is set to {} to avoid
12
- * duplicating the entire $defs object.
13
- *
14
- * Resource identities follow the pattern RESOURCE-{Name} where Name is the key
15
- * from the $defs object. Genesis itself uses RESOURCE-Genesis.
16
- *
17
- * Usage: node ./dist/scripts/generateResourceEnvelopes.js
18
- */
19
- /**
20
- * Pure function to generate resource envelopes from a Genesis schema.
21
- *
22
- * @param genesis The Genesis schema object
23
- * @returns A record mapping resource names to their envelopes
24
- */
25
- function generateResourceEnvelopesLogic(genesis: any): Record<string, any> {
26
- if (!genesis.nucleusSchema || !genesis.nucleusSchema.$defs) {
27
- throw new Error('Genesis.json must have nucleusSchema.$defs');
28
- }
29
-
30
- const defs = genesis.nucleusSchema.$defs;
31
- const defKeys = Object.keys(defs);
32
-
33
- // Generate Resource envelopes
34
- const resources: Record<string, any> = {};
35
-
36
- // Genesis timestamp: 2025-11-30T00:00:00.000Z marks the genesis of ToolProof
37
- const genesisTimestamp = '2025-11-30T00:00:00.000Z';
38
-
39
- // First entry is Genesis itself with empty extractedData
40
- resources['Genesis'] = {
41
- identity: 'RESOURCE-Genesis',
42
- resourceTypeRef: 'TYPE-ResourceType',
43
- creationContext: {
44
- resourceRoleRef: 'ROLE-Genesis',
45
- executionRef: 'EXECUTION-Genesis'
46
- },
47
- kind: 'materialized',
48
- timestamp: genesisTimestamp,
49
- extractedData: {}
50
- };
51
-
52
- // Generate resources for all other $defs
53
- defKeys.forEach((defName) => {
54
- const defValue = defs[defName];
55
-
56
- resources[defName] = {
57
- identity: `RESOURCE-${defName}`,
58
- resourceTypeRef: 'TYPE-ResourceType',
59
- creationContext: {
60
- resourceRoleRef: 'ROLE-Genesis',
61
- executionRef: `EXECUTION-${defName}`
62
- },
63
- kind: 'materialized',
64
- timestamp: genesisTimestamp,
65
- extractedData: defValue
66
- };
67
- });
68
-
69
- return resources;
70
- }
71
-
72
- async function main() {
73
- const config = getConfig();
74
- // Use normalized version with anchor refs rewritten to pointers
75
- const genesisSourcePath = config.getNormalizedSourcePath();
76
- const outputPath = path.join(config.getGeneratedResourcesDir(), 'Genesis.json');
77
-
78
- if (!fs.existsSync(genesisSourcePath)) {
79
- console.error(`Genesis source file not found at ${genesisSourcePath}`);
80
- process.exit(1);
81
- }
82
-
83
- const raw = fs.readFileSync(genesisSourcePath, 'utf-8');
84
- const genesis = JSON.parse(raw);
85
-
86
- try {
87
- const resources = generateResourceEnvelopesLogic(genesis);
88
-
89
- // Ensure output directory exists
90
- const outputDir = path.dirname(outputPath);
91
- fs.mkdirSync(outputDir, { recursive: true });
92
-
93
- // Write the generated resources file
94
- fs.writeFileSync(outputPath, JSON.stringify(resources, null, 4) + '\n', 'utf-8');
95
- console.log(`Generated ${Object.keys(resources).length} Resource envelopes -> ${outputPath}`);
96
- } catch (error: any) {
97
- console.error(error.message);
98
- process.exit(1);
99
- }
100
- }
101
-
102
- main().catch((e) => {
103
- console.error(e);
104
- process.exit(1);
105
- });
1
+ import fs from 'fs';
2
+ import path from 'path';
3
+ import { getConfig } from './_lib/config.js';
4
+
5
+ /**
6
+ * Wrap each ResourceType definition (from Genesis.nucleusSchema.$defs) with a Resource shell
7
+ * that conforms to the Resource.nucleusSchema pattern defined in Genesis.json.
8
+ */
9
+
10
+ function generateResourceShellLogic(genesis: any): Record<string, any> {
11
+ if (!genesis.nucleusSchema || !genesis.nucleusSchema.$defs) {
12
+ throw new Error('Genesis.json must have nucleusSchema.$defs');
13
+ }
14
+
15
+ const defs = genesis.nucleusSchema.$defs;
16
+ const defKeys = Object.keys(defs);
17
+
18
+ const resources: Record<string, any> = {};
19
+
20
+ // Genesis timestamp: 2025-11-30T00:00:00.000Z marks the genesis of ToolProof
21
+ const genesisTimestamp = '2025-11-30T00:00:00.000Z';
22
+
23
+ resources['Genesis'] = {
24
+ identity: 'RESOURCE-Genesis',
25
+ resourceTypeHandle: 'TYPE-ResourceType',
26
+ creationContext: {
27
+ resourceRoleHandle: 'ROLE-Genesis',
28
+ jobStepHandle: 'JOB_STEP-Genesis'
29
+ },
30
+ kind: 'materialized',
31
+ timestamp: genesisTimestamp,
32
+ nucleus: {}
33
+ };
34
+
35
+ defKeys.forEach((defName) => {
36
+ const defValue = defs[defName];
37
+
38
+ resources[defName] = {
39
+ identity: `RESOURCE-${defName}`,
40
+ resourceTypeHandle: 'TYPE-ResourceType',
41
+ creationContext: {
42
+ resourceRoleHandle: 'ROLE-Genesis',
43
+ jobStepHandle: `JOB_STEP-${defName}`
44
+ },
45
+ kind: 'materialized',
46
+ timestamp: genesisTimestamp,
47
+ nucleus: defValue
48
+ };
49
+ });
50
+
51
+ return resources;
52
+ }
53
+
54
+ async function main() {
55
+ const config = getConfig();
56
+ const genesisSourcePath = config.getNormalizedSourcePath();
57
+ const outputPath = path.join(config.getResourcesDir(), 'Genesis.json');
58
+
59
+ if (!fs.existsSync(genesisSourcePath)) {
60
+ console.error(`Genesis source file not found at ${genesisSourcePath}`);
61
+ process.exit(1);
62
+ }
63
+
64
+ const raw = fs.readFileSync(genesisSourcePath, 'utf-8');
65
+ const genesis = JSON.parse(raw);
66
+
67
+ try {
68
+ const resources = generateResourceShellLogic(genesis);
69
+
70
+ const outputDir = path.dirname(outputPath);
71
+ fs.mkdirSync(outputDir, { recursive: true });
72
+
73
+ fs.writeFileSync(outputPath, JSON.stringify(resources, null, 4) + '\n', 'utf-8');
74
+ console.log(`Generated ${Object.keys(resources).length} Resource envelopes -> ${outputPath}`);
75
+ } catch (error: any) {
76
+ console.error(error.message);
77
+ process.exit(1);
78
+ }
79
+ }
80
+
81
+ main().catch((e) => {
82
+ console.error(e);
83
+ process.exit(1);
84
+ });
@@ -1,3 +0,0 @@
1
- // Auto-generated strict composite type. Do not edit.
2
- import type { ResourceMetaBase, Genesis as ExtractedData } from './types.js';
3
- export type Resource_Genesis = ResourceMetaBase & { extractedData: ExtractedData };
@@ -1,3 +0,0 @@
1
- // Auto-generated strict composite type. Do not edit.
2
- import type { ResourceMetaBase, Job as ExtractedData } from './types.js';
3
- export type Resource_Job = ResourceMetaBase & { extractedData: ExtractedData };
@@ -1,3 +0,0 @@
1
- // Auto-generated strict composite type. Do not edit.
2
- import type { ResourceMetaBase, RawStrategy as ExtractedData } from './types.js';
3
- export type Resource_RawStrategy = ResourceMetaBase & { extractedData: ExtractedData };
@@ -1,3 +0,0 @@
1
- // Auto-generated strict composite type. Do not edit.
2
- import type { ResourceMetaBase, ResourceType as ExtractedData } from './types.js';
3
- export type Resource_ResourceType = ResourceMetaBase & { extractedData: ExtractedData };
@@ -1,3 +0,0 @@
1
- // Auto-generated strict composite type. Do not edit.
2
- import type { ResourceMetaBase, RunnableStrategy as ExtractedData } from './types.js';
3
- export type Resource_RunnableStrategy = ResourceMetaBase & { extractedData: ExtractedData };
package/src/Roadmap.json DELETED
@@ -1,102 +0,0 @@
1
- {
2
- "Tasks": [
3
- {
4
- "name": "Familiarization",
5
- "comment": "Familiarize yourself with the new schema structure and the changes made. Consult the 'Notes' section for specific changes in naming and structure. This will help you understand how to adapt the existing codebase to work with the new schema. Prepare a list of any questions or clarifications needed regarding the new schema structure and we'll discuss them."
6
- },
7
- {
8
- "name": "Scripts",
9
- "comment": "Implement the scripts specified in the 'Scripts' section so that they work with the new schema structure. Try to do it with business logic contained in reusable pure functions as much as possible, and with clear separation between this and file I/O. In the future, we might let Ajv take over some of this work since it already has a lot of this functionality built-in (dereferencing, $defs bundling, etc.)."
10
- },
11
- {
12
- "name": "NPM Publishing",
13
- "comment": "Publish the schema package to the new npm organization 'toolproof-core' (I have sent you an invite). Take a pull of the latest master and merge it into your branch. For schema/package.json, keep my 'name' change. The package is now called '@toolproof-core/schema' instead of '@toolproof-npm/schema'. The reason for this change is that we can now name all core packages with the '@toolproof-core' prefix, regardless of whether they are published to npm or not. I've also done one change in Genesis.json. ShellMaterializedBase now has a required 'version' property with const value 1. This should not cause any merge conflicts since you've only done changes inside scripts/ and generated/ (in addition to package.json). The only thing that needs to be changed in scripts/ is the generateResourceShells script to add the version property (with value 1)when wrapping ResourceTypes in a ShellMaterialized. Note that while we call the new ToolProof version 'v2' during development, it will officially be called 'v1'. The old version (current 'v1') will be degraded to 'v0' and deprecated. This aligns with our npm package naming, where we've till now given the packages a '0.x.x' version. In the new npm organization 'toolproof-core', we will start with version '1.0.0' for all packages. Note that I've also updated other packages (console, engine, validation, visualization), but that should not cause any merge conflicts."
14
- },
15
- {
16
- "name": "GitHub Actions",
17
- "comment": "Create a GitHub Actions workflow for the schema package (like we have in the old ToolProof repository). We'll create actions for other packages later."
18
- }
19
- ],
20
- "Notes": [
21
- {
22
- "oldName": "-Wrapper",
23
- "newName": "-Facet",
24
- "comment": "The 'Wrapper' suffix is changed to 'Facet' everywhere."
25
- },
26
- {
27
- "oldName": "Name&DescriptionWrapper",
28
- "newName": "DocumentationFacet"
29
- },
30
- {
31
- "oldName": "extractionSchema",
32
- "newName": "nucleusSchema",
33
- "comment": "This is now a maximum-permissive 'true' schema. We'll validate user-written schemas in a much better way separately."
34
- },
35
- {
36
- "oldName": "extractedData",
37
- "newName": "nucleus"
38
- },
39
- {
40
- "oldName": "Execution",
41
- "newName": "JobRun"
42
- },
43
- {
44
- "oldName": "WorkStep",
45
- "newName": "JobStep"
46
- },
47
- {
48
- "oldName": "ResourceMeta",
49
- "newName": "ShellMaterialized"
50
- },
51
- {
52
- "oldName": "StatelessStrategy",
53
- "newName": "StepsFacet",
54
- "comment": "This is a different concept. We no longer have the concept of Stateless vs Stateful strategies. We'll rather allow RunnableStrategies to be reused with new bindings."
55
- },
56
- {
57
- "oldName": "StatefulStrategy",
58
- "newName": "RawStrategy"
59
- },
60
- {
61
- "oldName": "RunRecording",
62
- "newName": "StrategyRun"
63
- }
64
- ],
65
- "Scripts": {
66
- "rewriteAnchors": {
67
- "newName": "rewriteAnchors",
68
- "comment": "Rewrites anchor-style refs (e.g. #SomeAnchor) inside Genesis.json’s nucleusSchema to JSON Pointer refs (e.g. #/$defs/SomeAnchor) for stricter tooling compatibility. Outputs normalized Genesis.json written to the configured location.",
69
- "status": "Done, In PR"
70
- },
71
- "extractSchemas": {
72
- "newName": "extractSchemas",
73
- "comment": "Takes the (normalized) Genesis.json document (expects a top-level nucleusSchema), unwraps nested ResourceTypes into raw JSON Schemas. Outputs a flattened Genesis.json at the configured location.",
74
- "status": "Done, In PR"
75
- },
76
- "extractSubSchemaWithDefs": {
77
- "newName": "extractSubSchemaWithDefs",
78
- "comment": "Extracts a single $defs.<Name> from the flattened Genesis.json and bundles it into a standalone schema including all direct + transitive local $defs dependencies referenced via #/$defs/...",
79
- "status": "Done, In PR"
80
- },
81
- "generateSchemaShims": {
82
- "newName": "generateSchemaShims",
83
- "comment": "Generates .ts shim files next to generated .json files so TypeScript/NodeNext can import JSON schemas/resources via import assertions consistently."
84
- },
85
- "generateResourceEnvelopes": {
86
- "newName": "generateResourceShells",
87
- "comment": "Wraps every Genesis.nucleusSchema.$defs[DefName] schema in a Resource shell (ToolProof resource object). Special-cases Genesis with nucleus: {} to avoid duplicating all $defs."
88
- },
89
- "generateTypes": {
90
- "newName": "generateTypes",
91
- "comment": "Runs json-schema-to-typescript across the extracted schemas directory, with a custom resolver so absolute $id URLs map to local files (no network). Applies a few normalizations (e.g., allOf sibling keyword handling), prunes noisy generated names, and overlays template-literal types for ...Identity/...Ref patterns when possible. Ensures runtime .js shims exist alongside .d.ts. Note that some of this additional processing might be unnecessary or might not fit the new schema structure."
92
- },
93
- "generateResourceTypeType": {
94
- "newName": "generateResourceTypeType",
95
- "comment": "Generates a typed Resource variant Resource_<Name> where nucleus is typed to the extracted nucleusSchema <Name>.json."
96
- },
97
- "generateDependencies": {
98
- "newName": "generateDependencies",
99
- "comment": "Generates a list of dependencies for each schema."
100
- }
101
- }
102
- }
@@ -1,3 +0,0 @@
1
- // Auto-generated strict composite type. Do not edit.
2
- import type { ResourceMetaBase, Genesis as ExtractedData } from './types.js';
3
- export type Resource_Genesis = ResourceMetaBase & { extractedData: ExtractedData };
@@ -1 +0,0 @@
1
- export {}
@@ -1,3 +0,0 @@
1
- // Auto-generated strict composite type. Do not edit.
2
- import type { ResourceMetaBase, Job as ExtractedData } from './types.js';
3
- export type Resource_Job = ResourceMetaBase & { extractedData: ExtractedData };
@@ -1 +0,0 @@
1
- export {}
@@ -1,3 +0,0 @@
1
- // Auto-generated strict composite type. Do not edit.
2
- import type { ResourceMetaBase, RawStrategy as ExtractedData } from './types.js';
3
- export type Resource_RawStrategy = ResourceMetaBase & { extractedData: ExtractedData };
@@ -1 +0,0 @@
1
- export {}
@@ -1,3 +0,0 @@
1
- // Auto-generated strict composite type. Do not edit.
2
- import type { ResourceMetaBase, ResourceType as ExtractedData } from './types.js';
3
- export type Resource_ResourceType = ResourceMetaBase & { extractedData: ExtractedData };
@@ -1 +0,0 @@
1
- export {}
@@ -1,3 +0,0 @@
1
- // Auto-generated strict composite type. Do not edit.
2
- import type { ResourceMetaBase, RunnableStrategy as ExtractedData } from './types.js';
3
- export type Resource_RunnableStrategy = ResourceMetaBase & { extractedData: ExtractedData };
@@ -1 +0,0 @@
1
- export {}