norn-cli 4.0.0 → 4.0.1

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/cli.js CHANGED
@@ -158674,15 +158674,6 @@ var MCP_DIRECTIVES = {
158674
158674
  };
158675
158675
  var MCP_DIRECTIVE_NAMES = Object.keys(MCP_DIRECTIVES);
158676
158676
  var MCP_SESSION_SCOPES = ["run", "agent", "call"];
158677
- function splitCommandParts(value) {
158678
- const parts = [];
158679
- const pattern = /"([^"]*)"|'([^']*)'|(\S+)/g;
158680
- let match2;
158681
- while ((match2 = pattern.exec(value)) !== null) {
158682
- parts.push(match2[1] ?? match2[2] ?? match2[3]);
158683
- }
158684
- return parts;
158685
- }
158686
158677
  function splitNamedDirective(value) {
158687
158678
  const match2 = value.trim().match(/^(\S+)\s+(.+)$/);
158688
158679
  if (!match2) {
@@ -159007,7 +158998,7 @@ end mcp
159007
158998
  mcp.invalid = true;
159008
158999
  }
159009
159000
  }
159010
- if (resolvedTransport === "stdio" && mcp.commandTemplates.length === 0) {
159001
+ if (resolvedTransport === "stdio" && !mcp.commandTemplate) {
159011
159002
  errors.push(parseError(
159012
159003
  mcp.lineNumber,
159013
159004
  `MCP server '${mcp.alias}' uses transport stdio and requires a command directive.`,
@@ -159060,7 +159051,7 @@ end mcp
159060
159051
  mcpServers.set(mcp.alias.toLowerCase(), {
159061
159052
  alias: mcp.alias,
159062
159053
  transportTemplate: transport.value,
159063
- commandTemplates: mcp.commandTemplates,
159054
+ ...mcp.commandTemplate ? { commandTemplate: mcp.commandTemplate } : {},
159064
159055
  ...mcp.values.cwd ? { cwdTemplate: mcp.values.cwd.value } : {},
159065
159056
  ...mcp.envTemplates.length > 0 ? { envTemplates: mcp.envTemplates } : {},
159066
159057
  ...mcp.values.url ? { urlTemplate: mcp.values.url.value } : {},
@@ -159396,7 +159387,7 @@ end mcp
159396
159387
  lineNumber: index
159397
159388
  };
159398
159389
  if (directive === "command") {
159399
- pendingMcp.commandTemplates = splitCommandParts(rawValue);
159390
+ pendingMcp.commandTemplate = rawValue;
159400
159391
  }
159401
159392
  continue;
159402
159393
  }
@@ -159531,7 +159522,6 @@ end model`,
159531
159522
  alias,
159532
159523
  lineNumber: index,
159533
159524
  values: {},
159534
- commandTemplates: [],
159535
159525
  envTemplates: [],
159536
159526
  headerTemplates: [],
159537
159527
  sawDirective: false,
@@ -160471,7 +160461,7 @@ function extractImports(text) {
160471
160461
  }
160472
160462
  function sameMcpServerDeclaration(left, right) {
160473
160463
  const named = (entries) => (entries ?? []).map((entry) => `${entry.name}=${entry.valueTemplate}`).join("\0");
160474
- return left.transportTemplate === right.transportTemplate && left.commandTemplates.join("\0") === right.commandTemplates.join("\0") && left.cwdTemplate === right.cwdTemplate && left.urlTemplate === right.urlTemplate && left.timeoutMs === right.timeoutMs && left.session === right.session && named(left.envTemplates) === named(right.envTemplates) && named(left.headerTemplates) === named(right.headerTemplates);
160464
+ return left.transportTemplate === right.transportTemplate && left.commandTemplate === right.commandTemplate && left.cwdTemplate === right.cwdTemplate && left.urlTemplate === right.urlTemplate && left.timeoutMs === right.timeoutMs && left.session === right.session && named(left.envTemplates) === named(right.envTemplates) && named(left.headerTemplates) === named(right.headerTemplates);
160475
160465
  }
160476
160466
  async function resolveImports(text, baseDir, readFile4, alreadyImported = /* @__PURE__ */ new Set(), importStack = /* @__PURE__ */ new Set(), sourceFilePath = path4.resolve(baseDir, "__norn_root__.norn"), sqlImportedPathsBySource = /* @__PURE__ */ new Map(), sqlOperationsBySource = /* @__PURE__ */ new Map(), agentImportedPathsBySource = /* @__PURE__ */ new Map(), agentDefinitionsBySource = /* @__PURE__ */ new Map(), mcpServersBySource = /* @__PURE__ */ new Map()) {
160477
160467
  const imports = extractImports(text);
@@ -184779,6 +184769,15 @@ function resolveTemplateString(value, envVariables) {
184779
184769
  const scopedVariables = attachEnvironmentScope({}, envVariables);
184780
184770
  return substituteVariables(value, scopedVariables);
184781
184771
  }
184772
+ function splitCommandLine(value) {
184773
+ const parts = [];
184774
+ const pattern = /"([^"]*)"|'([^']*)'|(\S+)/g;
184775
+ let match2;
184776
+ while ((match2 = pattern.exec(value)) !== null) {
184777
+ parts.push(match2[1] ?? match2[2] ?? match2[3]);
184778
+ }
184779
+ return parts;
184780
+ }
184782
184781
  function resolveCommandParts2(originPath, command, envVariables) {
184783
184782
  const configDir = path10.dirname(originPath);
184784
184783
  return command.map((part, index) => {
@@ -184907,9 +184906,16 @@ function resolveNamedTemplates(entries, declaration, directive, envVariables) {
184907
184906
  function resolveMcpServerDeclaration(declaration, envVariables) {
184908
184907
  const transport = resolveTemplate(declaration.transportTemplate, declaration, "transport", envVariables).toLowerCase();
184909
184908
  if (transport === "stdio") {
184910
- const command = declaration.commandTemplates.map(
184911
- (part) => resolveTemplate(part, declaration, "command", envVariables)
184909
+ const resolvedCommand = resolveTemplate(
184910
+ declaration.commandTemplate ?? "",
184911
+ declaration,
184912
+ "command",
184913
+ envVariables
184912
184914
  );
184915
+ const command = splitCommandLine(resolvedCommand);
184916
+ if (command.length === 0) {
184917
+ throw new Error(`MCP server '${declaration.alias}' resolved to an empty command.`);
184918
+ }
184913
184919
  return {
184914
184920
  transport: "stdio",
184915
184921
  // Reuse the config path's own resolution so a bare name stays a PATH lookup and a
@@ -7612,15 +7612,6 @@ var MCP_DIRECTIVES = {
7612
7612
  };
7613
7613
  var MCP_DIRECTIVE_NAMES = Object.keys(MCP_DIRECTIVES);
7614
7614
  var MCP_SESSION_SCOPES = ["run", "agent", "call"];
7615
- function splitCommandParts(value) {
7616
- const parts = [];
7617
- const pattern = /"([^"]*)"|'([^']*)'|(\S+)/g;
7618
- let match;
7619
- while ((match = pattern.exec(value)) !== null) {
7620
- parts.push(match[1] ?? match[2] ?? match[3]);
7621
- }
7622
- return parts;
7623
- }
7624
7615
  function splitNamedDirective(value) {
7625
7616
  const match = value.trim().match(/^(\S+)\s+(.+)$/);
7626
7617
  if (!match) {
@@ -7945,7 +7936,7 @@ end mcp
7945
7936
  mcp.invalid = true;
7946
7937
  }
7947
7938
  }
7948
- if (resolvedTransport === "stdio" && mcp.commandTemplates.length === 0) {
7939
+ if (resolvedTransport === "stdio" && !mcp.commandTemplate) {
7949
7940
  errors.push(parseError(
7950
7941
  mcp.lineNumber,
7951
7942
  `MCP server '${mcp.alias}' uses transport stdio and requires a command directive.`,
@@ -7998,7 +7989,7 @@ end mcp
7998
7989
  mcpServers.set(mcp.alias.toLowerCase(), {
7999
7990
  alias: mcp.alias,
8000
7991
  transportTemplate: transport.value,
8001
- commandTemplates: mcp.commandTemplates,
7992
+ ...mcp.commandTemplate ? { commandTemplate: mcp.commandTemplate } : {},
8002
7993
  ...mcp.values.cwd ? { cwdTemplate: mcp.values.cwd.value } : {},
8003
7994
  ...mcp.envTemplates.length > 0 ? { envTemplates: mcp.envTemplates } : {},
8004
7995
  ...mcp.values.url ? { urlTemplate: mcp.values.url.value } : {},
@@ -8334,7 +8325,7 @@ end mcp
8334
8325
  lineNumber: index
8335
8326
  };
8336
8327
  if (directive === "command") {
8337
- pendingMcp.commandTemplates = splitCommandParts(rawValue);
8328
+ pendingMcp.commandTemplate = rawValue;
8338
8329
  }
8339
8330
  continue;
8340
8331
  }
@@ -8469,7 +8460,6 @@ end model`,
8469
8460
  alias,
8470
8461
  lineNumber: index,
8471
8462
  values: {},
8472
- commandTemplates: [],
8473
8463
  envTemplates: [],
8474
8464
  headerTemplates: [],
8475
8465
  sawDirective: false,
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "norn-cli",
3
3
  "displayName": "Norn",
4
4
  "description": "Version-controlled API and database tests. Author in VS Code, then run the same files from the CLI and CI.",
5
- "version": "4.0.0",
5
+ "version": "4.0.1",
6
6
  "publisher": "Norn-PeterKrustanov",
7
7
  "author": {
8
8
  "name": "Peter Krastanov"