@topolo/cli 0.12.17 → 0.12.18

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 (2) hide show
  1. package/dist/index.js +20 -0
  2. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -692,6 +692,9 @@ var SUPPORTED_SCHEMA_KEYWORDS = /* @__PURE__ */ new Set([
692
692
  "allOf",
693
693
  "anyOf",
694
694
  "oneOf",
695
+ "if",
696
+ "then",
697
+ "else",
695
698
  "properties",
696
699
  "required",
697
700
  "additionalProperties",
@@ -731,6 +734,11 @@ function inspectSchema(schema, path, root, depth) {
731
734
  if (typeof schema.$ref === "string" && !resolveLocalReference(root, schema.$ref)) {
732
735
  return { path, code: "unsupported_schema_ref", message: `Cannot resolve schema reference ${schema.$ref}.` };
733
736
  }
737
+ for (const keyword of ["if", "then", "else"]) {
738
+ if (Object.prototype.hasOwnProperty.call(schema, keyword) && typeof schema[keyword] !== "boolean" && !isRecord2(schema[keyword])) {
739
+ return { path: `${path}.${keyword}`, code: "invalid_conditional_schema", message: "Conditional schemas must be objects or booleans." };
740
+ }
741
+ }
734
742
  const children = [];
735
743
  if (isRecord2(schema.properties)) children.push(...Object.entries(schema.properties));
736
744
  if (isRecord2(schema.$defs)) children.push(...Object.entries(schema.$defs));
@@ -739,6 +747,9 @@ function inspectSchema(schema, path, root, depth) {
739
747
  ["additionalProperties", schema.additionalProperties],
740
748
  ["propertyNames", schema.propertyNames],
741
749
  ["items", schema.items],
750
+ ["if", schema.if],
751
+ ["then", schema.then],
752
+ ["else", schema.else],
742
753
  ...arraySchemaEntries("allOf", schema.allOf),
743
754
  ...arraySchemaEntries("anyOf", schema.anyOf),
744
755
  ...arraySchemaEntries("oneOf", schema.oneOf)
@@ -771,6 +782,15 @@ function validateNode(schema, value, path, root, errors, depth) {
771
782
  if (isRecord2(candidate)) validateNode(candidate, value, path, root, errors, depth + 1);
772
783
  }
773
784
  }
785
+ if (Object.prototype.hasOwnProperty.call(schema, "if")) {
786
+ const matches = schema.if === true || isRecord2(schema.if) && candidateMatches(schema.if, value, root, depth);
787
+ const selected = matches ? schema.then : schema.else;
788
+ if (selected === false) {
789
+ errors.push({ path, code: "conditional_schema", message: "Value is rejected by the selected conditional schema." });
790
+ } else if (isRecord2(selected)) {
791
+ validateNode(selected, value, path, root, errors, depth + 1);
792
+ }
793
+ }
774
794
  if (Array.isArray(schema.anyOf) && !schema.anyOf.some((candidate) => candidateMatches(candidate, value, root, depth))) {
775
795
  errors.push({ path, code: "any_of", message: "Value does not match any allowed schema." });
776
796
  return;
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@topolo/cli",
3
3
  "packageManager": "pnpm@10.17.1",
4
- "version": "0.12.17",
5
- "topoloPublishedVersion": "0.12.17",
4
+ "version": "0.12.18",
5
+ "topoloPublishedVersion": "0.12.18",
6
6
  "description": "Public command-line interface for Topolo customer organizations, developers, and agents.",
7
7
  "license": "UNLICENSED",
8
8
  "author": "Topolo",
@@ -28,8 +28,8 @@
28
28
  },
29
29
  "dependencies": {
30
30
  "@modelcontextprotocol/sdk": "^1.0.0",
31
- "@topolo/mcp": "0.14.9",
32
- "@topolo/sdk": "0.23.4",
31
+ "@topolo/mcp": "0.14.10",
32
+ "@topolo/sdk": "0.23.5",
33
33
  "commander": "^12.1.0"
34
34
  },
35
35
  "devDependencies": {