ont-run 0.0.7 → 0.0.9

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.
package/dist/bin/ont.js CHANGED
@@ -799,6 +799,12 @@ function getZodTypeName(schema) {
799
799
  const s2 = schema;
800
800
  if (s2._zod && typeof s2._zod === "object") {
801
801
  const zod = s2._zod;
802
+ if (zod.traits && zod.traits instanceof Set) {
803
+ const traits = Array.from(zod.traits);
804
+ const zodType = traits.find((t2) => t2.startsWith("Zod") && !t2.startsWith("$") && !t2.startsWith("_"));
805
+ if (zodType)
806
+ return zodType;
807
+ }
802
808
  if (zod.def && typeof zod.def === "object") {
803
809
  const def = zod.def;
804
810
  if (typeof def.typeName === "string")
@@ -835,11 +841,17 @@ function getObjectShape(schema) {
835
841
  const zod = s2._zod;
836
842
  if (zod.def && typeof zod.def === "object") {
837
843
  const def = zod.def;
838
- if (def.shape && typeof def.shape === "object") {
839
- return def.shape;
844
+ if (def.shape) {
845
+ const shape = def.shape;
846
+ if (typeof shape === "object" && shape !== null) {
847
+ return shape;
848
+ }
840
849
  }
841
850
  }
842
851
  }
852
+ if ("shape" in s2 && s2.shape && typeof s2.shape === "object") {
853
+ return s2.shape;
854
+ }
843
855
  return;
844
856
  }
845
857
  function getInnerSchema(schema) {
@@ -3330,7 +3342,7 @@ await startOnt();
3330
3342
  packageJson.type = "module";
3331
3343
  packageJson.scripts = {
3332
3344
  ...packageJson.scripts || {},
3333
- dev: "bun run server.ts",
3345
+ dev: "NODE_ENV=development bun run server.ts",
3334
3346
  start: "NODE_ENV=production bun run server.ts",
3335
3347
  review: "bunx ont-run review"
3336
3348
  };
@@ -8725,7 +8737,7 @@ var reviewCommand = defineCommand({
8725
8737
  // package.json
8726
8738
  var package_default = {
8727
8739
  name: "ont-run",
8728
- version: "0.0.7",
8740
+ version: "0.0.9",
8729
8741
  description: "Ontology-enforced API framework for AI coding agents",
8730
8742
  type: "module",
8731
8743
  bin: {
package/dist/index.js CHANGED
@@ -13913,6 +13913,12 @@ function getZodTypeName(schema) {
13913
13913
  const s = schema;
13914
13914
  if (s._zod && typeof s._zod === "object") {
13915
13915
  const zod = s._zod;
13916
+ if (zod.traits && zod.traits instanceof Set) {
13917
+ const traits = Array.from(zod.traits);
13918
+ const zodType = traits.find((t) => t.startsWith("Zod") && !t.startsWith("$") && !t.startsWith("_"));
13919
+ if (zodType)
13920
+ return zodType;
13921
+ }
13916
13922
  if (zod.def && typeof zod.def === "object") {
13917
13923
  const def = zod.def;
13918
13924
  if (typeof def.typeName === "string")
@@ -13949,11 +13955,17 @@ function getObjectShape(schema) {
13949
13955
  const zod = s._zod;
13950
13956
  if (zod.def && typeof zod.def === "object") {
13951
13957
  const def = zod.def;
13952
- if (def.shape && typeof def.shape === "object") {
13953
- return def.shape;
13958
+ if (def.shape) {
13959
+ const shape = def.shape;
13960
+ if (typeof shape === "object" && shape !== null) {
13961
+ return shape;
13962
+ }
13954
13963
  }
13955
13964
  }
13956
13965
  }
13966
+ if ("shape" in s && s.shape && typeof s.shape === "object") {
13967
+ return s.shape;
13968
+ }
13957
13969
  return;
13958
13970
  }
13959
13971
  function getInnerSchema(schema) {
@@ -6,7 +6,7 @@ export interface StartOntOptions {
6
6
  mcpPort?: number;
7
7
  /** Environment to use (default: 'dev') */
8
8
  env?: string;
9
- /** Mode: 'development' warns on lockfile issues, 'production' fails. Auto-detected from NODE_ENV if not set. */
9
+ /** Mode: 'development' warns on lockfile issues, 'production' fails. Defaults to 'production' unless NODE_ENV is explicitly 'development'. */
10
10
  mode?: "development" | "production";
11
11
  /** Set to true to only start the API server */
12
12
  apiOnly?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ont-run",
3
- "version": "0.0.7",
3
+ "version": "0.0.9",
4
4
  "description": "Ontology-enforced API framework for AI coding agents",
5
5
  "type": "module",
6
6
  "bin": {
@@ -235,7 +235,7 @@ await startOnt();
235
235
  packageJson.type = "module";
236
236
  packageJson.scripts = {
237
237
  ...(packageJson.scripts as Record<string, string> || {}),
238
- dev: "bun run server.ts",
238
+ dev: "NODE_ENV=development bun run server.ts",
239
239
  start: "NODE_ENV=production bun run server.ts",
240
240
  review: "bunx ont-run review",
241
241
  };
@@ -29,9 +29,17 @@ export function isZodSchema(val: unknown): boolean {
29
29
  export function getZodTypeName(schema: unknown): string | undefined {
30
30
  if (!isZodSchema(schema)) return undefined;
31
31
  const s = schema as Record<string, unknown>;
32
- // Zod 4: check _zod.def.typeName
32
+ // Zod 4: check _zod.traits for type name
33
33
  if (s._zod && typeof s._zod === "object") {
34
34
  const zod = s._zod as Record<string, unknown>;
35
+ // Check traits Set for the Zod type name
36
+ if (zod.traits && zod.traits instanceof Set) {
37
+ const traits = Array.from(zod.traits as Set<string>);
38
+ // Find the main type name (e.g., "ZodObject", "ZodString", etc.)
39
+ const zodType = traits.find(t => t.startsWith('Zod') && !t.startsWith('$') && !t.startsWith('_'));
40
+ if (zodType) return zodType;
41
+ }
42
+ // Fallback: check _zod.def.typeName for older versions
35
43
  if (zod.def && typeof zod.def === "object") {
36
44
  const def = zod.def as Record<string, unknown>;
37
45
  if (typeof def.typeName === "string") return def.typeName;
@@ -86,16 +94,24 @@ export function isZodDefault(schema: unknown): boolean {
86
94
  export function getObjectShape(schema: unknown): Record<string, unknown> | undefined {
87
95
  if (!isZodObject(schema)) return undefined;
88
96
  const s = schema as Record<string, unknown>;
89
- // Zod 4: shape is in _zod.def.shape
97
+ // Zod 4: shape is in _zod.def.shape (may be a getter)
90
98
  if (s._zod && typeof s._zod === "object") {
91
99
  const zod = s._zod as Record<string, unknown>;
92
100
  if (zod.def && typeof zod.def === "object") {
93
101
  const def = zod.def as Record<string, unknown>;
94
- if (def.shape && typeof def.shape === "object") {
95
- return def.shape as Record<string, unknown>;
102
+ if (def.shape) {
103
+ // In Zod 4, shape might be a getter, so access it
104
+ const shape = def.shape;
105
+ if (typeof shape === "object" && shape !== null) {
106
+ return shape as Record<string, unknown>;
107
+ }
96
108
  }
97
109
  }
98
110
  }
111
+ // Fallback: try accessing .shape directly on the schema
112
+ if ('shape' in s && s.shape && typeof s.shape === "object") {
113
+ return s.shape as Record<string, unknown>;
114
+ }
99
115
  return undefined;
100
116
  }
101
117
 
@@ -19,7 +19,7 @@ export interface StartOntOptions {
19
19
  mcpPort?: number;
20
20
  /** Environment to use (default: 'dev') */
21
21
  env?: string;
22
- /** Mode: 'development' warns on lockfile issues, 'production' fails. Auto-detected from NODE_ENV if not set. */
22
+ /** Mode: 'development' warns on lockfile issues, 'production' fails. Defaults to 'production' unless NODE_ENV is explicitly 'development'. */
23
23
  mode?: "development" | "production";
24
24
  /** Set to true to only start the API server */
25
25
  apiOnly?: boolean;
@@ -33,11 +33,12 @@ export interface StartOntResult {
33
33
  }
34
34
 
35
35
  /**
36
- * Detect mode from NODE_ENV if not explicitly set
36
+ * Detect mode from NODE_ENV if not explicitly set.
37
+ * Defaults to 'production' (strict) unless NODE_ENV is explicitly 'development'.
37
38
  */
38
39
  function detectMode(explicit?: "development" | "production"): "development" | "production" {
39
40
  if (explicit) return explicit;
40
- return process.env.NODE_ENV === "production" ? "production" : "development";
41
+ return process.env.NODE_ENV === "development" ? "development" : "production";
41
42
  }
42
43
 
43
44
  /**