@mastra/deployer 1.86.0-alpha.6 → 1.86.0-alpha.8

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 (27) hide show
  1. package/dist/{analyze-nF1WWQyX.js → analyze-BjEzp-Bs.js} +5 -2
  2. package/dist/{analyze-D2rLrvfs.cjs → analyze-NnCa8kOb.cjs} +5 -2
  3. package/dist/build/analyze.cjs +1 -1
  4. package/dist/build/analyze.js +1 -1
  5. package/dist/build/index.cjs +3 -3
  6. package/dist/build/index.js +3 -3
  7. package/dist/{build-Df3yvOA7.cjs → build-OLJdK6FY.cjs} +2 -2
  8. package/dist/{build-DOrefH60.js → build-cBprMNoP.js} +2 -2
  9. package/dist/bundler/index.cjs +1 -1
  10. package/dist/bundler/index.js +1 -1
  11. package/dist/{bundler-BLVFCaU7.js → bundler-Cr8qMPp1.js} +8 -4
  12. package/dist/{bundler-CpVrkklZ.cjs → bundler-_xHFGvEr.cjs} +8 -4
  13. package/dist/deploy/log.d.ts +7 -1
  14. package/dist/docs/SKILL.md +1 -1
  15. package/dist/docs/assets/SOURCE_MAP.json +18 -8
  16. package/dist/index.cjs +5 -3
  17. package/dist/index.js +4 -4
  18. package/dist/server/index.d.ts +1 -1
  19. package/dist/services/index.cjs +1 -1
  20. package/dist/services/index.js +1 -1
  21. package/dist/{services-BKh9M2E5.js → services-C4uFF7g6.js} +51 -16
  22. package/dist/{services-B8neClCI.cjs → services-DgfLvRCc.cjs} +62 -15
  23. package/package.json +4 -4
  24. /package/dist/_types/{@mastra_hono@1.7.28-alpha.6 → @mastra_hono@1.7.28-alpha.8}/dist/auth-middleware.d.ts +0 -0
  25. /package/dist/_types/{@mastra_hono@1.7.28-alpha.6 → @mastra_hono@1.7.28-alpha.8}/dist/browser-stream/index.d.ts +0 -0
  26. /package/dist/_types/{@mastra_hono@1.7.28-alpha.6 → @mastra_hono@1.7.28-alpha.8}/dist/index.d.ts +0 -0
  27. /package/dist/_types/{@mastra_hono@1.7.28-alpha.6 → @mastra_hono@1.7.28-alpha.8}/package.json +0 -0
@@ -1,7 +1,7 @@
1
1
  import { n as __toESM, t as __commonJSMin } from "./rolldown-runtime-CO0Nlsmt.js";
2
2
  import { i as MastraError, n as ErrorDomain, r as MastraBaseError, t as ErrorCategory } from "./error-BVvc5jcw.js";
3
3
  import { a as getPackageName, c as isBuiltinModule, f as rollupSafeName, i as getNodeResolveOptions, l as isDependencyPartOfPackage, m as slash, r as getCompiledDepCachePath, s as isBareModuleSpecifier, u as isExternalProtocolImport } from "./utils-C8gwr-ur.js";
4
- import { i as DepsService, o as withPlaceholderVersions } from "./services-BKh9M2E5.js";
4
+ import { i as DepsService, o as withPlaceholderVersions } from "./services-C4uFF7g6.js";
5
5
  import { _ as esbuild, a as mastraToolsAliasPlugin, c as removeDeployer, d as moduleAlias, f as getPackageInfo$1, g as esmShim, h as isOptionalPeerOfImporter, i as mastraInternalAliasPlugin, l as protocolExternalResolver, m as getPackageRootPath, o as tsConfigPaths, p as getPackageMetadata, s as subpathExternalsResolver } from "./bundler-BX2HMBEc.js";
6
6
  import { existsSync, readFileSync } from "fs";
7
7
  import { readFile, writeFile } from "fs/promises";
@@ -197,7 +197,10 @@ async function findWorkspaces(dirname$1, options = {}) {
197
197
  function toManifestGlobs(globs) {
198
198
  return globs.map((pattern) => {
199
199
  const negated = pattern.startsWith("!");
200
- const base = (negated ? pattern.slice(1) : pattern).replace(/[\\/]+$/, "");
200
+ const body = negated ? pattern.slice(1) : pattern;
201
+ let end = body.length;
202
+ while (end > 0 && (body[end - 1] === "/" || body[end - 1] === "\\")) end--;
203
+ const base = body.slice(0, end);
201
204
  return `${negated ? "!" : ""}${base}/package.json`;
202
205
  });
203
206
  }
@@ -1,7 +1,7 @@
1
1
  const require_rolldown_runtime = require("./rolldown-runtime-Bc0pwXKd.cjs");
2
2
  const require_error = require("./error-CR4whExy.cjs");
3
3
  const require_utils = require("./utils-CDNA_ewa.cjs");
4
- const require_services = require("./services-B8neClCI.cjs");
4
+ const require_services = require("./services-DgfLvRCc.cjs");
5
5
  const require_bundler = require("./bundler-N6zbYjHG.cjs");
6
6
  let fs = require("fs");
7
7
  let fs_promises = require("fs/promises");
@@ -205,7 +205,10 @@ async function findWorkspaces(dirname$1, options = {}) {
205
205
  function toManifestGlobs(globs) {
206
206
  return globs.map((pattern) => {
207
207
  const negated = pattern.startsWith("!");
208
- const base = (negated ? pattern.slice(1) : pattern).replace(/[\\/]+$/, "");
208
+ const body = negated ? pattern.slice(1) : pattern;
209
+ let end = body.length;
210
+ while (end > 0 && (body[end - 1] === "/" || body[end - 1] === "\\")) end--;
211
+ const base = body.slice(0, end);
209
212
  return `${negated ? "!" : ""}${base}/package.json`;
210
213
  });
211
214
  }
@@ -1,3 +1,3 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_analyze = require("../analyze-D2rLrvfs.cjs");
2
+ const require_analyze = require("../analyze-NnCa8kOb.cjs");
3
3
  exports.analyzeBundle = require_analyze.analyzeBundle;
@@ -1 +1 @@
1
- export { t as analyzeBundle } from "../analyze-nF1WWQyX.js";
1
+ export { t as analyzeBundle } from "../analyze-BjEzp-Bs.js";
@@ -1,10 +1,10 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_services = require("../services-B8neClCI.cjs");
3
- const require_analyze = require("../analyze-D2rLrvfs.cjs");
2
+ const require_services = require("../services-DgfLvRCc.cjs");
3
+ const require_analyze = require("../analyze-NnCa8kOb.cjs");
4
4
  const require_utils = require("../utils-CDNA_ewa.cjs");
5
5
  const require_bundler = require("../bundler-N6zbYjHG.cjs");
6
6
  const require_bundlerOptions = require("../bundlerOptions-CNcBNp_E.cjs");
7
- const require_build = require("../build-Df3yvOA7.cjs");
7
+ const require_build = require("../build-OLJdK6FY.cjs");
8
8
  exports.Deps = require_services.Deps;
9
9
  exports.FileService = require_services.FileService;
10
10
  exports.analyzeBundle = require_analyze.analyzeBundle;
@@ -1,7 +1,7 @@
1
- import { r as Deps, t as FileService } from "../services-BKh9M2E5.js";
2
- import { t as analyzeBundle } from "../analyze-nF1WWQyX.js";
1
+ import { r as Deps, t as FileService } from "../services-C4uFF7g6.js";
2
+ import { t as analyzeBundle } from "../analyze-BjEzp-Bs.js";
3
3
  import { d as normalizeStudioBase, n as escapeStudioHtmlValue, o as injectStudioHtmlConfig, t as detectRuntime } from "../utils-C8gwr-ur.js";
4
4
  import { n as getInputOptions, t as createBundler } from "../bundler-BX2HMBEc.js";
5
5
  import { n as extractMastraOption, t as getBundlerOptions } from "../bundlerOptions-c8B4wLqe.js";
6
- import { a as generateFsWorkflowsCodegen, c as discoverFsWorkflows, d as createWatcher, f as getInputOptions$1, i as generateFsAgentsModule, l as getServerOptions, n as prepareFsAgentsEntry, o as discoverFsAgents, r as writeFsAgentsEntry, s as discoverFsSingleton, t as mirrorFsAgentWorkspaces, u as analyzeEntryProjectType } from "../build-DOrefH60.js";
6
+ import { a as generateFsWorkflowsCodegen, c as discoverFsWorkflows, d as createWatcher, f as getInputOptions$1, i as generateFsAgentsModule, l as getServerOptions, n as prepareFsAgentsEntry, o as discoverFsAgents, r as writeFsAgentsEntry, s as discoverFsSingleton, t as mirrorFsAgentWorkspaces, u as analyzeEntryProjectType } from "../build-cBprMNoP.js";
7
7
  export { Deps, FileService, analyzeBundle, analyzeEntryProjectType, createBundler, createWatcher, detectRuntime, discoverFsAgents, discoverFsSingleton, discoverFsWorkflows, escapeStudioHtmlValue, extractMastraOption, generateFsAgentsModule, generateFsWorkflowsCodegen, getInputOptions as getBundlerInputOptions, getBundlerOptions, getServerOptions, getInputOptions$1 as getWatcherInputOptions, injectStudioHtmlConfig, mirrorFsAgentWorkspaces, normalizeStudioBase, prepareFsAgentsEntry, writeFsAgentsEntry };
@@ -1,7 +1,7 @@
1
1
  const require_rolldown_runtime = require("./rolldown-runtime-Bc0pwXKd.cjs");
2
2
  const require_bundler = require("./bundler-N6zbYjHG.cjs");
3
- const require_services = require("./services-B8neClCI.cjs");
4
- const require_analyze = require("./analyze-D2rLrvfs.cjs");
3
+ const require_services = require("./services-DgfLvRCc.cjs");
4
+ const require_analyze = require("./analyze-NnCa8kOb.cjs");
5
5
  const require_utils = require("./utils-CDNA_ewa.cjs");
6
6
  const require_bundlerOptions = require("./bundlerOptions-CNcBNp_E.cjs");
7
7
  let fs = require("fs");
@@ -1,6 +1,6 @@
1
1
  import { n as getInputOptions$1, o as tsConfigPaths, u as nodeModulesExtensionResolver } from "./bundler-BX2HMBEc.js";
2
- import { u as noopLogger } from "./services-BKh9M2E5.js";
3
- import { a as normalizeExternals, i as aliasHono, n as checkConfigExport, r as bundleExternals, s as getWorkspaceInformation, t as analyzeBundle } from "./analyze-nF1WWQyX.js";
2
+ import { f as noopLogger } from "./services-C4uFF7g6.js";
3
+ import { a as normalizeExternals, i as aliasHono, n as checkConfigExport, r as bundleExternals, s as getWorkspaceInformation, t as analyzeBundle } from "./analyze-BjEzp-Bs.js";
4
4
  import { a as getPackageName, m as slash } from "./utils-C8gwr-ur.js";
5
5
  import { n as extractMastraOption } from "./bundlerOptions-c8B4wLqe.js";
6
6
  import { existsSync } from "fs";
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_bundler = require("../bundler-CpVrkklZ.cjs");
2
+ const require_bundler = require("../bundler-_xHFGvEr.cjs");
3
3
  exports.Bundler = require_bundler.Bundler;
4
4
  exports.IS_DEFAULT = require_bundler.IS_DEFAULT;
5
5
  exports.applySourceDependencyRange = require_bundler.applySourceDependencyRange;
@@ -1 +1 @@
1
- export { t as Bundler, n as IS_DEFAULT, r as applySourceDependencyRange, i as getSourceDependencyConstraints, a as isRegistryVersionSpec } from "../bundler-BLVFCaU7.js";
1
+ export { t as Bundler, n as IS_DEFAULT, r as applySourceDependencyRange, i as getSourceDependencyConstraints, a as isRegistryVersionSpec } from "../bundler-Cr8qMPp1.js";
@@ -1,6 +1,6 @@
1
- import { i as DepsService, l as MastraBase, t as FileService } from "./services-BKh9M2E5.js";
1
+ import { d as MastraBase, i as DepsService, t as FileService } from "./services-C4uFF7g6.js";
2
2
  import { i as MastraError, n as ErrorDomain, t as ErrorCategory } from "./error-BVvc5jcw.js";
3
- import { c as packWorkspaceDependencies, o as collectTransitiveWorkspaceDependencies, s as getWorkspaceInformation, t as analyzeBundle } from "./analyze-nF1WWQyX.js";
3
+ import { c as packWorkspaceDependencies, o as collectTransitiveWorkspaceDependencies, s as getWorkspaceInformation, t as analyzeBundle } from "./analyze-BjEzp-Bs.js";
4
4
  import { n as getInputOptions, r as getUnresolvedWorkspaceImport, t as createBundler } from "./bundler-BX2HMBEc.js";
5
5
  import { t as getBundlerOptions } from "./bundlerOptions-c8B4wLqe.js";
6
6
  import { a as getPackageName, m as slash, p as shouldSkipInstall, s as isBareModuleSpecifier } from "./utils-C8gwr-ur.js";
@@ -36,8 +36,12 @@ const PACKAGE_NAME_PATTERN = /^(?:@[A-Za-z0-9._-]+\/)?[A-Za-z0-9._-]+$/;
36
36
  const TARBALL_SUFFIX_PATTERN = /\.(?:tgz|tar\.gz|tar)$/i;
37
37
  /** npm reads a value starting like this as a path, whatever follows. A bare `~` is a semver range. */
38
38
  const FILE_SPEC_PREFIX_PATTERN = /^(?:\.|~[/\\]|[/\\]|[A-Za-z]:[/\\])/;
39
- /** A range admitting any published version: `*`, `x`, `>=0`, and any union containing one. */
40
- const UNBOUNDED_RANGE_PATTERN = /(?:^|\|\||\s)\s*(?:[*xX]|>=?\s*0(?:\.0)*(?:\.0)*)\s*(?:$|\|\|)/;
39
+ /**
40
+ * A range admitting any published version: `*`, `x`, `>=0`, and any union containing one.
41
+ * The leading `\s` alternative already absorbs padding; an extra `\s*` there kept the
42
+ * pattern quadratic on long whitespace runs.
43
+ */
44
+ const UNBOUNDED_RANGE_PATTERN = /(?:^|\|\||\s)(?:[*xX]|>=?\s*0(?:\.0)*)\s*(?:$|\|\|)/;
41
45
  const toStringRecord = (value) => {
42
46
  if (!value || typeof value !== "object" || Array.isArray(value)) return {};
43
47
  return Object.fromEntries(Object.entries(value).filter((entry) => typeof entry[1] === "string"));
@@ -1,7 +1,7 @@
1
1
  const require_rolldown_runtime = require("./rolldown-runtime-Bc0pwXKd.cjs");
2
- const require_services = require("./services-B8neClCI.cjs");
2
+ const require_services = require("./services-DgfLvRCc.cjs");
3
3
  const require_error = require("./error-CR4whExy.cjs");
4
- const require_analyze = require("./analyze-D2rLrvfs.cjs");
4
+ const require_analyze = require("./analyze-NnCa8kOb.cjs");
5
5
  const require_bundler = require("./bundler-N6zbYjHG.cjs");
6
6
  const require_bundlerOptions = require("./bundlerOptions-CNcBNp_E.cjs");
7
7
  const require_utils = require("./utils-CDNA_ewa.cjs");
@@ -40,8 +40,12 @@ const PACKAGE_NAME_PATTERN = /^(?:@[A-Za-z0-9._-]+\/)?[A-Za-z0-9._-]+$/;
40
40
  const TARBALL_SUFFIX_PATTERN = /\.(?:tgz|tar\.gz|tar)$/i;
41
41
  /** npm reads a value starting like this as a path, whatever follows. A bare `~` is a semver range. */
42
42
  const FILE_SPEC_PREFIX_PATTERN = /^(?:\.|~[/\\]|[/\\]|[A-Za-z]:[/\\])/;
43
- /** A range admitting any published version: `*`, `x`, `>=0`, and any union containing one. */
44
- const UNBOUNDED_RANGE_PATTERN = /(?:^|\|\||\s)\s*(?:[*xX]|>=?\s*0(?:\.0)*(?:\.0)*)\s*(?:$|\|\|)/;
43
+ /**
44
+ * A range admitting any published version: `*`, `x`, `>=0`, and any union containing one.
45
+ * The leading `\s` alternative already absorbs padding; an extra `\s*` there kept the
46
+ * pattern quadratic on long whitespace runs.
47
+ */
48
+ const UNBOUNDED_RANGE_PATTERN = /(?:^|\|\||\s)(?:[*xX]|>=?\s*0(?:\.0)*)\s*(?:$|\|\|)/;
45
49
  const toStringRecord = (value) => {
46
50
  if (!value || typeof value !== "object" || Array.isArray(value)) return {};
47
51
  return Object.fromEntries(Object.entries(value).filter((entry) => typeof entry[1] === "string"));
@@ -1,9 +1,15 @@
1
1
  import { Writable } from 'node:stream';
2
2
  import type { IMastraLogger } from '../_types/@internal_core@0.1.4/dist/logger/index.js';
3
3
  export declare const createPinoStream: (logger: IMastraLogger) => Writable;
4
- export declare function createChildProcessLogger({ logger, root }: {
4
+ export declare function toWindowsShellArg(arg: string): string;
5
+ export declare function toWindowsShellArgs(bin: string, args: string[]): string[];
6
+ export declare function createChildProcessLogger({ logger, root, platform, windowsShell, }: {
5
7
  logger: IMastraLogger;
6
8
  root: string;
9
+ /** Override for tests that replay the Windows `.cmd` path on another OS. */
10
+ platform?: NodeJS.Platform;
11
+ /** cmd.exe stand-in. Production uses `ComSpec` or `cmd.exe`. */
12
+ windowsShell?: string;
7
13
  }): ({ cmd, args, env }: {
8
14
  cmd: string;
9
15
  args: string[];
@@ -3,7 +3,7 @@ name: mastra-deployer
3
3
  description: Documentation for @mastra/deployer. Use when working with @mastra/deployer APIs, configuration, or implementation.
4
4
  metadata:
5
5
  package: "@mastra/deployer"
6
- version: "1.86.0-alpha.6"
6
+ version: "1.86.0-alpha.8"
7
7
  ---
8
8
 
9
9
  ## When to use
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.86.0-alpha.6",
2
+ "version": "1.86.0-alpha.8",
3
3
  "package": "@mastra/deployer",
4
4
  "exports": {
5
5
  "Deployer": {
@@ -9,28 +9,38 @@
9
9
  },
10
10
  "Deps": {
11
11
  "types": "dist/services/deps.d.ts",
12
- "implementation": "dist/services-BKh9M2E5.js",
13
- "line": 824
12
+ "implementation": "dist/services-C4uFF7g6.js",
13
+ "line": 859
14
14
  },
15
15
  "FileService": {
16
16
  "types": "dist/services/fs.d.ts",
17
- "implementation": "dist/services-BKh9M2E5.js",
18
- "line": 1255
17
+ "implementation": "dist/services-C4uFF7g6.js",
18
+ "line": 1290
19
19
  },
20
20
  "createChildProcessLogger": {
21
21
  "types": "dist/deploy/log.d.ts",
22
- "implementation": "dist/services-BKh9M2E5.js",
23
- "line": 320
22
+ "implementation": "dist/services-C4uFF7g6.js",
23
+ "line": 339
24
24
  },
25
25
  "createPinoStream": {
26
26
  "types": "dist/deploy/log.d.ts",
27
- "implementation": "dist/services-BKh9M2E5.js",
27
+ "implementation": "dist/services-C4uFF7g6.js",
28
28
  "line": 303
29
29
  },
30
30
  "getDeployer": {
31
31
  "types": "dist/build/deployer.d.ts",
32
32
  "implementation": "dist/index.js",
33
33
  "line": 21
34
+ },
35
+ "toWindowsShellArg": {
36
+ "types": "dist/deploy/log.d.ts",
37
+ "implementation": "dist/services-C4uFF7g6.js",
38
+ "line": 326
39
+ },
40
+ "toWindowsShellArgs": {
41
+ "types": "dist/deploy/log.d.ts",
42
+ "implementation": "dist/services-C4uFF7g6.js",
43
+ "line": 333
34
44
  }
35
45
  },
36
46
  "modules": {}
package/dist/index.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_bundler = require("./bundler-CpVrkklZ.cjs");
3
- const require_services = require("./services-B8neClCI.cjs");
4
- require("./build-Df3yvOA7.cjs");
2
+ const require_bundler = require("./bundler-_xHFGvEr.cjs");
3
+ const require_services = require("./services-DgfLvRCc.cjs");
4
+ require("./build-OLJdK6FY.cjs");
5
5
  const require_bundlerOptions = require("./bundlerOptions-CNcBNp_E.cjs");
6
6
  // src/deploy/base.ts
7
7
  var Deployer = class extends require_bundler.Bundler {
@@ -30,3 +30,5 @@ exports.FileService = require_services.FileService;
30
30
  exports.createChildProcessLogger = require_services.createChildProcessLogger;
31
31
  exports.createPinoStream = require_services.createPinoStream;
32
32
  exports.getDeployer = getDeployer;
33
+ exports.toWindowsShellArg = require_services.toWindowsShellArg;
34
+ exports.toWindowsShellArgs = require_services.toWindowsShellArgs;
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
- import { t as Bundler } from "./bundler-BLVFCaU7.js";
2
- import { c as createPinoStream, i as DepsService, r as Deps, s as createChildProcessLogger, t as FileService } from "./services-BKh9M2E5.js";
3
- import "./build-DOrefH60.js";
1
+ import { t as Bundler } from "./bundler-Cr8qMPp1.js";
2
+ import { c as createPinoStream, i as DepsService, l as toWindowsShellArg, r as Deps, s as createChildProcessLogger, t as FileService, u as toWindowsShellArgs } from "./services-C4uFF7g6.js";
3
+ import "./build-cBprMNoP.js";
4
4
  import { n as extractMastraOption } from "./bundlerOptions-c8B4wLqe.js";
5
5
  // src/deploy/base.ts
6
6
  var Deployer = class extends Bundler {
@@ -23,4 +23,4 @@ async function getDeployer(entryFile, outputDir, logger) {
23
23
  if (!result) return null;
24
24
  return result.getConfig();
25
25
  }
26
- export { Deployer, Deps, FileService, createChildProcessLogger, createPinoStream, getDeployer };
26
+ export { Deployer, Deps, FileService, createChildProcessLogger, createPinoStream, getDeployer, toWindowsShellArg, toWindowsShellArgs };
@@ -1,5 +1,5 @@
1
1
  import type { Mastra } from '@mastra/core/mastra';
2
- import type { HonoBindings, HonoVariables } from '../_types/@mastra_hono@1.7.28-alpha.6/dist/index.js';
2
+ import type { HonoBindings, HonoVariables } from '../_types/@mastra_hono@1.7.28-alpha.8/dist/index.js';
3
3
  import { Hono } from 'hono';
4
4
  import type { ServerBundleOptions } from './types.js';
5
5
  type Bindings = HonoBindings;
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_services = require("../services-B8neClCI.cjs");
2
+ const require_services = require("../services-DgfLvRCc.cjs");
3
3
  exports.DepsService = require_services.DepsService;
4
4
  exports.EnvService = require_services.EnvService;
5
5
  exports.FileService = require_services.FileService;
@@ -1 +1 @@
1
- export { i as DepsService, n as EnvService, t as FileService } from "../services-BKh9M2E5.js";
1
+ export { i as DepsService, n as EnvService, t as FileService } from "../services-C4uFF7g6.js";
@@ -311,20 +311,55 @@ const createPinoStream = (logger) => {
311
311
  } });
312
312
  };
313
313
  /**
314
- * Args are joined into a shell command (`shell: true` is required for package
315
- * manager shims on Windows), so only allow characters that appear in package
316
- * specifiers and CLI flags — never shell metacharacters (CodeQL
317
- * js/shell-command-constructed-from-input).
314
+ * Windows needs a shell to run package manager `.cmd` shims, and cmd.exe joins
315
+ * every token into one command line. Plain tokens pass through as-is; anything
316
+ * else (spaces, apostrophes, emoji, `&`, `^`…) is wrapped in double quotes, where
317
+ * cmd.exe treats it literally. Characters cmd.exe still interprets inside quotes
318
+ * (`"`, `!`, line breaks) are refused; `"` can never appear in a Windows path.
319
+ * A quoted argument that ends in a backslash would make the C runtime treat that
320
+ * backslash as escaping the closing quote, so trailing backslashes are doubled.
321
+ * `%` only expands as a `%name%` pair, so one `%` per command line is allowed
322
+ * (Yarn Berry's `--out …%v.tgz` needs it) and a second one is refused.
318
323
  */
319
- const SAFE_SHELL_ARG = /^[\w@%+=:,./^~-]*$/;
320
- function createChildProcessLogger({ logger, root }) {
324
+ const PLAIN_WINDOWS_ARG = /^[\p{L}\p{M}\p{N}_@+=:,./\\~-]+$/u;
325
+ const UNQUOTABLE_WINDOWS_ARG = /["!\r\n\0]/;
326
+ function toWindowsShellArg(arg) {
327
+ if (UNQUOTABLE_WINDOWS_ARG.test(arg)) throw new Error(`Refusing to pass unsafe argument to shell command: ${JSON.stringify(arg)}`);
328
+ if (PLAIN_WINDOWS_ARG.test(arg)) return arg;
329
+ let end = arg.length;
330
+ while (end > 0 && arg[end - 1] === "\\") end--;
331
+ return `"${arg}${arg.slice(end)}"`;
332
+ }
333
+ function toWindowsShellArgs(bin, args) {
334
+ if (!PLAIN_WINDOWS_ARG.test(bin)) throw new Error(`Refusing to spawn unsafe command: ${JSON.stringify(bin)}`);
335
+ const quoted = args.map(toWindowsShellArg);
336
+ if ([bin, ...quoted].join(" ").split("%").length > 2) throw new Error("Refusing to pass more than one \"%\" to a shell command");
337
+ return quoted;
338
+ }
339
+ function createChildProcessLogger({ logger, root, platform = process.platform, windowsShell }) {
321
340
  const pinoStream = createPinoStream(logger);
322
341
  return async ({ cmd, args, env }) => {
323
342
  try {
324
- for (const arg of args) if (!SAFE_SHELL_ARG.test(arg)) throw new Error(`Refusing to pass unsafe argument to shell command: ${JSON.stringify(arg)}`);
325
- const subprocess = spawn(cmd, args, {
343
+ const [bin, ...cmdArgs] = cmd.split(" ").filter(Boolean);
344
+ if (!bin) throw new Error("Refusing to spawn an empty command");
345
+ const allArgs = [...cmdArgs, ...args.filter(Boolean)];
346
+ const subprocess = platform === "win32" ? spawn(windowsShell ?? process.env.ComSpec ?? "cmd.exe", [
347
+ "/d",
348
+ "/s",
349
+ "/c",
350
+ `"${[bin, ...toWindowsShellArgs(bin, allArgs)].join(" ")}"`
351
+ ], {
352
+ cwd: root,
353
+ env,
354
+ windowsVerbatimArguments: true,
355
+ stdio: [
356
+ "ignore",
357
+ "pipe",
358
+ "pipe"
359
+ ]
360
+ }) : spawn(bin, allArgs, {
326
361
  cwd: root,
327
- shell: true,
362
+ shell: false,
328
363
  env,
329
364
  stdio: [
330
365
  "ignore",
@@ -872,7 +907,7 @@ var Deps = class extends MastraBase {
872
907
  root: dir
873
908
  });
874
909
  let packCmd = "pack";
875
- let destinationFlag = `--pack-destination ${destination}`;
910
+ let destinationArgs = ["--pack-destination", destination];
876
911
  if (this.packageManager === "yarn") {
877
912
  if (this.lockFile && await isYarnClassicLockfile(this.lockFile.path)) {
878
913
  if (!SAFE_PACKAGE_VERSION.test(version)) throw new MastraError({
@@ -885,16 +920,16 @@ var Deps = class extends MastraBase {
885
920
  },
886
921
  text: `Invalid version ${JSON.stringify(version)} in workspace package at ${dir}`
887
922
  });
888
- destinationFlag = `--filename ${destination}/${sanitizedName}-${version}.tgz`;
889
- } else destinationFlag = `--out ${destination}/${sanitizedName}-%v.tgz`;
923
+ destinationArgs = ["--filename", `${destination}/${sanitizedName}-${version}.tgz`];
924
+ } else destinationArgs = ["--out", `${destination}/${sanitizedName}-%v.tgz`];
890
925
  }
891
926
  if (this.packageManager === "bun") {
892
927
  packCmd = "pm pack";
893
- destinationFlag = `--destination ${destination}`;
928
+ destinationArgs = ["--destination", destination];
894
929
  }
895
930
  return cpLogger({
896
- cmd: `${this.packageManager} ${packCmd} ${destinationFlag}`,
897
- args: [],
931
+ cmd: `${this.packageManager} ${packCmd}`,
932
+ args: destinationArgs,
898
933
  env: { PATH: process.env.PATH }
899
934
  });
900
935
  }
@@ -1305,4 +1340,4 @@ var FileService = class {
1305
1340
  fs.writeFileSync(filePath, fileContent);
1306
1341
  }
1307
1342
  };
1308
- export { WORKSPACE_PLACEHOLDER_VERSION as a, createPinoStream as c, DepsService as i, MastraBase as l, EnvService as n, withPlaceholderVersions as o, Deps as r, createChildProcessLogger as s, FileService as t, noopLogger as u };
1343
+ export { WORKSPACE_PLACEHOLDER_VERSION as a, createPinoStream as c, MastraBase as d, noopLogger as f, DepsService as i, toWindowsShellArg as l, EnvService as n, withPlaceholderVersions as o, Deps as r, createChildProcessLogger as s, FileService as t, toWindowsShellArgs as u };
@@ -317,20 +317,55 @@ const createPinoStream = (logger) => {
317
317
  } });
318
318
  };
319
319
  /**
320
- * Args are joined into a shell command (`shell: true` is required for package
321
- * manager shims on Windows), so only allow characters that appear in package
322
- * specifiers and CLI flags — never shell metacharacters (CodeQL
323
- * js/shell-command-constructed-from-input).
320
+ * Windows needs a shell to run package manager `.cmd` shims, and cmd.exe joins
321
+ * every token into one command line. Plain tokens pass through as-is; anything
322
+ * else (spaces, apostrophes, emoji, `&`, `^`…) is wrapped in double quotes, where
323
+ * cmd.exe treats it literally. Characters cmd.exe still interprets inside quotes
324
+ * (`"`, `!`, line breaks) are refused; `"` can never appear in a Windows path.
325
+ * A quoted argument that ends in a backslash would make the C runtime treat that
326
+ * backslash as escaping the closing quote, so trailing backslashes are doubled.
327
+ * `%` only expands as a `%name%` pair, so one `%` per command line is allowed
328
+ * (Yarn Berry's `--out …%v.tgz` needs it) and a second one is refused.
324
329
  */
325
- const SAFE_SHELL_ARG = /^[\w@%+=:,./^~-]*$/;
326
- function createChildProcessLogger({ logger, root }) {
330
+ const PLAIN_WINDOWS_ARG = /^[\p{L}\p{M}\p{N}_@+=:,./\\~-]+$/u;
331
+ const UNQUOTABLE_WINDOWS_ARG = /["!\r\n\0]/;
332
+ function toWindowsShellArg(arg) {
333
+ if (UNQUOTABLE_WINDOWS_ARG.test(arg)) throw new Error(`Refusing to pass unsafe argument to shell command: ${JSON.stringify(arg)}`);
334
+ if (PLAIN_WINDOWS_ARG.test(arg)) return arg;
335
+ let end = arg.length;
336
+ while (end > 0 && arg[end - 1] === "\\") end--;
337
+ return `"${arg}${arg.slice(end)}"`;
338
+ }
339
+ function toWindowsShellArgs(bin, args) {
340
+ if (!PLAIN_WINDOWS_ARG.test(bin)) throw new Error(`Refusing to spawn unsafe command: ${JSON.stringify(bin)}`);
341
+ const quoted = args.map(toWindowsShellArg);
342
+ if ([bin, ...quoted].join(" ").split("%").length > 2) throw new Error("Refusing to pass more than one \"%\" to a shell command");
343
+ return quoted;
344
+ }
345
+ function createChildProcessLogger({ logger, root, platform = process.platform, windowsShell }) {
327
346
  const pinoStream = createPinoStream(logger);
328
347
  return async ({ cmd, args, env }) => {
329
348
  try {
330
- for (const arg of args) if (!SAFE_SHELL_ARG.test(arg)) throw new Error(`Refusing to pass unsafe argument to shell command: ${JSON.stringify(arg)}`);
331
- const subprocess = (0, child_process.spawn)(cmd, args, {
349
+ const [bin, ...cmdArgs] = cmd.split(" ").filter(Boolean);
350
+ if (!bin) throw new Error("Refusing to spawn an empty command");
351
+ const allArgs = [...cmdArgs, ...args.filter(Boolean)];
352
+ const subprocess = platform === "win32" ? (0, child_process.spawn)(windowsShell ?? process.env.ComSpec ?? "cmd.exe", [
353
+ "/d",
354
+ "/s",
355
+ "/c",
356
+ `"${[bin, ...toWindowsShellArgs(bin, allArgs)].join(" ")}"`
357
+ ], {
358
+ cwd: root,
359
+ env,
360
+ windowsVerbatimArguments: true,
361
+ stdio: [
362
+ "ignore",
363
+ "pipe",
364
+ "pipe"
365
+ ]
366
+ }) : (0, child_process.spawn)(bin, allArgs, {
332
367
  cwd: root,
333
- shell: true,
368
+ shell: false,
334
369
  env,
335
370
  stdio: [
336
371
  "ignore",
@@ -878,7 +913,7 @@ var Deps = class extends MastraBase {
878
913
  root: dir
879
914
  });
880
915
  let packCmd = "pack";
881
- let destinationFlag = `--pack-destination ${destination}`;
916
+ let destinationArgs = ["--pack-destination", destination];
882
917
  if (this.packageManager === "yarn") {
883
918
  if (this.lockFile && await isYarnClassicLockfile(this.lockFile.path)) {
884
919
  if (!SAFE_PACKAGE_VERSION.test(version)) throw new require_error.MastraError({
@@ -891,16 +926,16 @@ var Deps = class extends MastraBase {
891
926
  },
892
927
  text: `Invalid version ${JSON.stringify(version)} in workspace package at ${dir}`
893
928
  });
894
- destinationFlag = `--filename ${destination}/${sanitizedName}-${version}.tgz`;
895
- } else destinationFlag = `--out ${destination}/${sanitizedName}-%v.tgz`;
929
+ destinationArgs = ["--filename", `${destination}/${sanitizedName}-${version}.tgz`];
930
+ } else destinationArgs = ["--out", `${destination}/${sanitizedName}-%v.tgz`];
896
931
  }
897
932
  if (this.packageManager === "bun") {
898
933
  packCmd = "pm pack";
899
- destinationFlag = `--destination ${destination}`;
934
+ destinationArgs = ["--destination", destination];
900
935
  }
901
936
  return cpLogger({
902
- cmd: `${this.packageManager} ${packCmd} ${destinationFlag}`,
903
- args: [],
937
+ cmd: `${this.packageManager} ${packCmd}`,
938
+ args: destinationArgs,
904
939
  env: { PATH: process.env.PATH }
905
940
  });
906
941
  }
@@ -1365,6 +1400,18 @@ Object.defineProperty(exports, "noopLogger", {
1365
1400
  return noopLogger;
1366
1401
  }
1367
1402
  });
1403
+ Object.defineProperty(exports, "toWindowsShellArg", {
1404
+ enumerable: true,
1405
+ get: function() {
1406
+ return toWindowsShellArg;
1407
+ }
1408
+ });
1409
+ Object.defineProperty(exports, "toWindowsShellArgs", {
1410
+ enumerable: true,
1411
+ get: function() {
1412
+ return toWindowsShellArgs;
1413
+ }
1414
+ });
1368
1415
  Object.defineProperty(exports, "withPlaceholderVersions", {
1369
1416
  enumerable: true,
1370
1417
  get: function() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/deployer",
3
- "version": "1.86.0-alpha.6",
3
+ "version": "1.86.0-alpha.8",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "files": [
@@ -114,7 +114,7 @@
114
114
  "tinyglobby": "^0.2.17",
115
115
  "ws": "^8.23.0",
116
116
  "yaml": "^2.9.1",
117
- "@mastra/server": "1.86.0-alpha.6"
117
+ "@mastra/server": "1.86.0-alpha.8"
118
118
  },
119
119
  "devDependencies": {
120
120
  "@hono/node-server": "^2.1.3",
@@ -140,8 +140,8 @@
140
140
  "@internal/lint": "0.0.151",
141
141
  "@internal/types-builder": "0.0.126",
142
142
  "@mastra/agent-browser": "0.7.0-alpha.1",
143
- "@mastra/core": "1.86.0-alpha.6",
144
- "@mastra/hono": "1.7.28-alpha.6",
143
+ "@mastra/core": "1.86.0-alpha.8",
144
+ "@mastra/hono": "1.7.28-alpha.8",
145
145
  "@mastra/mcp": "^2.11.0-alpha.1"
146
146
  },
147
147
  "peerDependencies": {