create-factory 0.1.16-alpha.8 → 0.1.16

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/README.md CHANGED
@@ -8,6 +8,10 @@ npm create factory
8
8
 
9
9
  It clones the public [`softwarefactory-template`](https://github.com/mastra-ai/softwarefactory-template), installs dependencies, and initializes Git. Run `npm create factory -- --help` for options.
10
10
 
11
+ Optional Mastra platform setup writes provisioned credentials and resource identifiers to `.env`, enabling cloud sandboxes even when Factory runs locally.
12
+
13
+ Pass `--no-platform` to skip platform provisioning. This leaves the template `.env` unchanged.
14
+
11
15
  ## Development
12
16
 
13
17
  This package owns prompts, template cloning, package-manager detection, optional Mastra platform setup, dependency installation, and Git initialization.
package/dist/index.js CHANGED
@@ -82,6 +82,28 @@ async function createServerProject({ token, orgId, name, region }) {
82
82
  if (!res.ok) throw new PlatformApiError(res.status, `Failed to create project — ${await extractError(res)}`);
83
83
  return (await res.json()).project;
84
84
  }
85
+ async function ensureProductionEnvironment({ token, orgId, projectId, region }) {
86
+ const url = `${MASTRA_PLATFORM_API_URL}/v1/projects/${encodeURIComponent(projectId)}/environments`;
87
+ const headers = authHeaders(token, orgId);
88
+ const res = await platformFetch(url, { headers });
89
+ if (!res.ok) throw new PlatformApiError(res.status, `Failed to list environments — ${await extractError(res)}`);
90
+ const production = (await res.json()).environments.find((environment) => environment.type === "production");
91
+ if (production) return production.id;
92
+ const created = await platformFetch(url, {
93
+ method: "POST",
94
+ headers: {
95
+ ...headers,
96
+ "Content-Type": "application/json"
97
+ },
98
+ body: JSON.stringify({
99
+ name: "production",
100
+ type: "production",
101
+ region
102
+ })
103
+ });
104
+ if (!created.ok) throw new PlatformApiError(created.status, `Failed to create production environment — ${await extractError(created)}`);
105
+ return (await created.json()).environment.id;
106
+ }
85
107
  /**
86
108
  * POST /v1/auth/tokens — mint an `sk_` WorkOS org API key.
87
109
  * Returns the plaintext secret; the platform never returns it again.
@@ -494,6 +516,20 @@ async function runPlatformProvisioning({ projectName, projectPath, region, org }
494
516
  throw err;
495
517
  }
496
518
  envAccumulator.MASTRA_PLATFORM_SECRET_KEY = secretKey;
519
+ const environmentSpinner = p.spinner();
520
+ environmentSpinner.start("Configuring production environment…");
521
+ try {
522
+ envAccumulator.MASTRA_ENVIRONMENT_ID = await ensureProductionEnvironment({
523
+ token,
524
+ orgId,
525
+ projectId: project.id,
526
+ region: projectRegion
527
+ });
528
+ environmentSpinner.stop("Production environment ready.");
529
+ } catch (err) {
530
+ environmentSpinner.stop("Environment setup failed.");
531
+ throw err;
532
+ }
497
533
  const neonSpinner = p.spinner();
498
534
  neonSpinner.start("Provisioning Neon Postgres database…");
499
535
  let databaseUrl;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-factory",
3
- "version": "0.1.16-alpha.8",
3
+ "version": "0.1.16",
4
4
  "description": "Create a Mastra Factory project: an agent-powered software delivery environment built on Mastra. Run `npm create factory` to scaffold and get started.",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -36,7 +36,7 @@
36
36
  "commander": "^14.0.3",
37
37
  "picocolors": "^1.1.1",
38
38
  "tinyexec": "^1.2.4",
39
- "mastra": "1.28.0-alpha.8"
39
+ "mastra": "1.28.0"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@types/node": "22.20.1",
@@ -44,7 +44,7 @@
44
44
  "tsdown": "0.22.9",
45
45
  "typescript": "^7.0.2",
46
46
  "vitest": "4.1.10",
47
- "@internal/lint": "0.0.130"
47
+ "@internal/lint": "0.0.131"
48
48
  },
49
49
  "scripts": {
50
50
  "build": "tsdown --silent --config tsdown.config.ts",