create-mastra 1.22.1-alpha.0 → 1.23.0-alpha.2
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/CHANGELOG.md +8 -0
- package/dist/index.js +152 -125
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# create-mastra
|
|
2
2
|
|
|
3
|
+
## 1.23.0-alpha.2
|
|
4
|
+
|
|
5
|
+
## 1.23.0-alpha.1
|
|
6
|
+
|
|
7
|
+
### Patch Changes
|
|
8
|
+
|
|
9
|
+
- Fixed prerelease project creation to keep using the running create-mastra release channel when npm dist-tags have not finished updating. ([#20723](https://github.com/mastra-ai/mastra/pull/20723))
|
|
10
|
+
|
|
3
11
|
## 1.22.1-alpha.0
|
|
4
12
|
|
|
5
13
|
## 1.22.0
|
package/dist/index.js
CHANGED
|
@@ -20341,6 +20341,7 @@ let EntityType = /* @__PURE__ */ (function(EntityType2) {
|
|
|
20341
20341
|
EntityType2["INPUT_STEP_PROCESSOR"] = "input_step_processor";
|
|
20342
20342
|
EntityType2["OUTPUT_PROCESSOR"] = "output_processor";
|
|
20343
20343
|
EntityType2["OUTPUT_STEP_PROCESSOR"] = "output_step_processor";
|
|
20344
|
+
EntityType2["TOOL_RESULT_PROCESSOR"] = "tool_result_processor";
|
|
20344
20345
|
EntityType2["WORKFLOW_STEP"] = "workflow_step";
|
|
20345
20346
|
EntityType2["TOOL"] = "tool";
|
|
20346
20347
|
EntityType2["WORKFLOW_RUN"] = "workflow_run";
|
|
@@ -21619,69 +21620,52 @@ async function writeEmptyScaffold({ projectPath, projectName, versionTag, packag
|
|
|
21619
21620
|
const MANAGED_PROVIDER_CONFIGS = {
|
|
21620
21621
|
openai: {
|
|
21621
21622
|
displayName: "OpenAI",
|
|
21622
|
-
|
|
21623
|
-
providerIdentifier: "openai",
|
|
21624
|
-
apiKeyEnv: "OPENAI_API_KEY",
|
|
21625
|
-
apiKeyPrerequisite: "An OpenAI API key",
|
|
21626
|
-
featureDescription: "OpenAI web search and direct web page fetching"
|
|
21623
|
+
apiKeyEnv: "OPENAI_API_KEY"
|
|
21627
21624
|
},
|
|
21628
21625
|
anthropic: {
|
|
21629
21626
|
displayName: "Anthropic",
|
|
21630
|
-
sdkPackage: "@ai-sdk/anthropic",
|
|
21631
|
-
sdkVersion: "^3.0.96",
|
|
21632
|
-
providerIdentifier: "anthropic",
|
|
21633
21627
|
primaryModel: "anthropic/claude-sonnet-5",
|
|
21634
21628
|
observationalModel: "anthropic/claude-haiku-4-5",
|
|
21635
|
-
apiKeyEnv: "ANTHROPIC_API_KEY"
|
|
21636
|
-
apiKeyPrerequisite: "An Anthropic API key",
|
|
21637
|
-
featureDescription: "Anthropic web search and direct web page fetching",
|
|
21638
|
-
webSearchEntry: "anthropic.tools.webSearch_20250305()"
|
|
21629
|
+
apiKeyEnv: "ANTHROPIC_API_KEY"
|
|
21639
21630
|
},
|
|
21640
21631
|
google: {
|
|
21641
21632
|
displayName: "Google Gemini",
|
|
21642
|
-
sdkPackage: "@ai-sdk/google",
|
|
21643
|
-
sdkVersion: "^3.0.91",
|
|
21644
|
-
providerIdentifier: "google",
|
|
21645
21633
|
primaryModel: "google/gemini-3.5-flash",
|
|
21646
21634
|
observationalModel: "google/gemini-3.5-flash",
|
|
21647
|
-
apiKeyEnv: "GOOGLE_GENERATIVE_AI_API_KEY"
|
|
21648
|
-
apiKeyPrerequisite: "A Google Gemini API key",
|
|
21649
|
-
featureDescription: "Google Gemini web search and direct web page fetching",
|
|
21650
|
-
webSearchEntry: "google.tools.googleSearch({})"
|
|
21635
|
+
apiKeyEnv: "GOOGLE_GENERATIVE_AI_API_KEY"
|
|
21651
21636
|
},
|
|
21652
21637
|
xai: {
|
|
21653
21638
|
displayName: "xAI",
|
|
21654
|
-
sdkPackage: "@ai-sdk/xai",
|
|
21655
|
-
sdkVersion: "^3.0.106",
|
|
21656
|
-
providerIdentifier: "xai",
|
|
21657
21639
|
primaryModel: "xai/grok-4.3",
|
|
21658
21640
|
observationalModel: "xai/grok-4.3",
|
|
21659
|
-
apiKeyEnv: "XAI_API_KEY"
|
|
21660
|
-
apiKeyPrerequisite: "An xAI API key",
|
|
21661
|
-
featureDescription: "xAI web search and direct web page fetching",
|
|
21662
|
-
webSearchEntry: "xai.tools.webSearch()"
|
|
21641
|
+
apiKeyEnv: "XAI_API_KEY"
|
|
21663
21642
|
}
|
|
21664
21643
|
};
|
|
21665
|
-
const PROVIDER_SDK_PACKAGES = Object.values(MANAGED_PROVIDER_CONFIGS).map((config) => config.sdkPackage);
|
|
21666
|
-
const OPENAI_SDK_PACKAGE = "@ai-sdk/openai";
|
|
21667
21644
|
const OPENAI_API_KEY = "OPENAI_API_KEY";
|
|
21668
|
-
const
|
|
21669
|
-
const
|
|
21670
|
-
const WEB_SEARCH_PROPERTY = /^([ \t]*)web_search\s*:\s*([^\n]+?)(?:,)?\s*$/m;
|
|
21645
|
+
const PRIMARY_OPENAI_MODEL = /(\bmodel\s*:\s*['"])openai\/[^'"]+(['"])(?=\s*,?\s*\n\s*defaultOptions\s*:)/g;
|
|
21646
|
+
const OBSERVATIONAL_OPENAI_MODEL = /(observationalMemory\s*:\s*\{[^{}]*?\bmodel\s*:\s*['"])openai\/[^'"]+(['"])/g;
|
|
21671
21647
|
function findMatches(content, pattern) {
|
|
21672
21648
|
const flags = pattern.flags.includes("g") ? pattern.flags : `${pattern.flags}g`;
|
|
21673
21649
|
return [...content.matchAll(new RegExp(pattern.source, flags))];
|
|
21674
21650
|
}
|
|
21675
|
-
function replaceSingleMatch(content, pattern, replacement
|
|
21676
|
-
|
|
21677
|
-
|
|
21678
|
-
|
|
21679
|
-
|
|
21651
|
+
function replaceSingleMatch(content, pattern, replacement) {
|
|
21652
|
+
if (findMatches(content, pattern).length !== 1) return {
|
|
21653
|
+
applied: false,
|
|
21654
|
+
content
|
|
21655
|
+
};
|
|
21656
|
+
if (typeof replacement === "string") return {
|
|
21657
|
+
applied: true,
|
|
21658
|
+
content: content.replace(pattern, replacement)
|
|
21659
|
+
};
|
|
21660
|
+
return {
|
|
21661
|
+
applied: true,
|
|
21662
|
+
content: content.replace(pattern, replacement)
|
|
21663
|
+
};
|
|
21680
21664
|
}
|
|
21681
21665
|
function getDependencyMap(manifest, section) {
|
|
21682
21666
|
const value = manifest[section];
|
|
21683
21667
|
if (value === void 0 && section === "devDependencies") return void 0;
|
|
21684
|
-
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
21668
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return void 0;
|
|
21685
21669
|
return value;
|
|
21686
21670
|
}
|
|
21687
21671
|
function collectMastraPackages(manifestSource) {
|
|
@@ -21700,120 +21684,157 @@ function collectMastraPackages(manifestSource) {
|
|
|
21700
21684
|
}
|
|
21701
21685
|
return [...names];
|
|
21702
21686
|
}
|
|
21703
|
-
function normalizeManagedManifest(content,
|
|
21687
|
+
function normalizeManagedManifest(content, mastraVersions, fallbackTag) {
|
|
21704
21688
|
let manifest;
|
|
21705
21689
|
try {
|
|
21706
21690
|
manifest = JSON.parse(content);
|
|
21707
21691
|
} catch {
|
|
21708
|
-
|
|
21692
|
+
return {
|
|
21693
|
+
applied: false,
|
|
21694
|
+
content
|
|
21695
|
+
};
|
|
21709
21696
|
}
|
|
21710
|
-
const
|
|
21711
|
-
const
|
|
21712
|
-
if (
|
|
21713
|
-
|
|
21714
|
-
|
|
21715
|
-
|
|
21716
|
-
|
|
21717
|
-
const sdkVersion = provider.sdkPackage === OPENAI_SDK_PACKAGE ? templateOpenAiVersion : provider.sdkVersion;
|
|
21718
|
-
if (!sdkVersion) throw new Error(`Default template compatibility error: no SDK version is configured for ${provider.displayName}.`);
|
|
21719
|
-
sourceSection[provider.sdkPackage] = sdkVersion;
|
|
21697
|
+
const dependencies = getDependencyMap(manifest, "dependencies");
|
|
21698
|
+
const devDependencies = getDependencyMap(manifest, "devDependencies");
|
|
21699
|
+
if (!dependencies || manifest.devDependencies !== void 0 && !devDependencies) return {
|
|
21700
|
+
applied: false,
|
|
21701
|
+
content
|
|
21702
|
+
};
|
|
21703
|
+
const dependencySections = [dependencies, devDependencies].filter((section) => section !== void 0);
|
|
21720
21704
|
for (const section of dependencySections) for (const packageName of Object.keys(section)) if (packageName === "mastra" || packageName.startsWith("@mastra/")) section[packageName] = mastraVersions?.[packageName] ?? fallbackTag;
|
|
21721
21705
|
return {
|
|
21706
|
+
applied: true,
|
|
21722
21707
|
content: `${JSON.stringify(manifest, null, 2)}
|
|
21723
|
-
|
|
21724
|
-
sdkVersion
|
|
21708
|
+
`
|
|
21725
21709
|
};
|
|
21726
21710
|
}
|
|
21727
21711
|
function adaptAgentSource(source, provider, config) {
|
|
21728
|
-
if (provider === "openai") return
|
|
21729
|
-
|
|
21730
|
-
|
|
21731
|
-
|
|
21732
|
-
if (
|
|
21733
|
-
|
|
21734
|
-
|
|
21735
|
-
|
|
21736
|
-
|
|
21737
|
-
|
|
21738
|
-
|
|
21739
|
-
|
|
21740
|
-
if (
|
|
21741
|
-
|
|
21742
|
-
|
|
21743
|
-
|
|
21744
|
-
|
|
21745
|
-
|
|
21746
|
-
|
|
21712
|
+
if (provider === "openai") return {
|
|
21713
|
+
applied: true,
|
|
21714
|
+
content: source
|
|
21715
|
+
};
|
|
21716
|
+
if (!config.primaryModel || !config.observationalModel) return {
|
|
21717
|
+
applied: false,
|
|
21718
|
+
content: source
|
|
21719
|
+
};
|
|
21720
|
+
if (findMatches(source, PRIMARY_OPENAI_MODEL).length !== 1) return {
|
|
21721
|
+
applied: false,
|
|
21722
|
+
content: source
|
|
21723
|
+
};
|
|
21724
|
+
if (findMatches(source, OBSERVATIONAL_OPENAI_MODEL).length !== 1) return {
|
|
21725
|
+
applied: false,
|
|
21726
|
+
content: source
|
|
21727
|
+
};
|
|
21728
|
+
return {
|
|
21729
|
+
applied: true,
|
|
21730
|
+
content: source.replace(PRIMARY_OPENAI_MODEL, `$1${config.primaryModel}$2`).replace(OBSERVATIONAL_OPENAI_MODEL, `$1${config.observationalModel}$2`)
|
|
21731
|
+
};
|
|
21747
21732
|
}
|
|
21748
21733
|
function replaceEnvKey(source, nextKey) {
|
|
21749
|
-
return replaceSingleMatch(source, new RegExp(`^([ \\t]*)${OPENAI_API_KEY}[ \\t]*=.*$`, "m"), (_line, indentation) => `${indentation}${nextKey}
|
|
21734
|
+
return replaceSingleMatch(source, new RegExp(`^([ \\t]*)${OPENAI_API_KEY}[ \\t]*=.*$`, "m"), (_line, indentation) => `${indentation}${nextKey}=`);
|
|
21750
21735
|
}
|
|
21751
21736
|
function setEnvValue(source, key, value) {
|
|
21752
|
-
return replaceSingleMatch(source, new RegExp(`^([ \\t]*)${key}[ \\t]*=.*$`, "m"), (_line, indentation) => `${indentation}${key}=${value}
|
|
21737
|
+
return replaceSingleMatch(source, new RegExp(`^([ \\t]*)${key}[ \\t]*=.*$`, "m"), (_line, indentation) => `${indentation}${key}=${value}`);
|
|
21753
21738
|
}
|
|
21754
21739
|
function adaptReadme(source, provider, config, projectName, packageManager) {
|
|
21755
|
-
|
|
21756
|
-
|
|
21757
|
-
|
|
21758
|
-
|
|
21759
|
-
|
|
21760
|
-
|
|
21761
|
-
|
|
21762
|
-
|
|
21763
|
-
|
|
21764
|
-
|
|
21765
|
-
|
|
21766
|
-
|
|
21767
|
-
|
|
21740
|
+
if (!(source.includes(OPENAI_API_KEY) || /^([ \t]*)npx create-mastra@\S+.*$/m.test(source))) return {
|
|
21741
|
+
applied: false,
|
|
21742
|
+
content: source
|
|
21743
|
+
};
|
|
21744
|
+
return {
|
|
21745
|
+
applied: true,
|
|
21746
|
+
content: source.replace(/^# .+$/m, `# ${projectName}`).replaceAll("npm run dev", `${packageManager} run dev`).replace(/^([ \t]*)npx create-mastra@\S+.*$/m, `$1npx create-mastra@latest <project-name> --llm ${provider}`).replaceAll(OPENAI_API_KEY, config.apiKeyEnv)
|
|
21747
|
+
};
|
|
21748
|
+
}
|
|
21749
|
+
async function writeSecureEnv(envPath, content) {
|
|
21750
|
+
const tempPath = path.join(path.dirname(envPath), `.env.mastra-create-${process.pid}-${randomUUID()}.tmp`);
|
|
21751
|
+
try {
|
|
21752
|
+
await fsPromises__default.writeFile(tempPath, content, {
|
|
21753
|
+
encoding: "utf8",
|
|
21754
|
+
flag: "wx",
|
|
21755
|
+
mode: 384
|
|
21756
|
+
});
|
|
21757
|
+
if (process.platform !== "win32") await fsPromises__default.chmod(tempPath, 384);
|
|
21758
|
+
await fsPromises__default.rename(tempPath, envPath);
|
|
21759
|
+
return true;
|
|
21760
|
+
} catch {
|
|
21761
|
+
try {
|
|
21762
|
+
await fsPromises__default.rm(tempPath, { force: true });
|
|
21763
|
+
} catch {
|
|
21764
|
+
}
|
|
21765
|
+
return false;
|
|
21768
21766
|
}
|
|
21769
21767
|
}
|
|
21770
21768
|
async function adaptDefaultTemplate({ projectPath, projectName, packageManager, provider, apiKey, versionTag }) {
|
|
21771
21769
|
const config = MANAGED_PROVIDER_CONFIGS[provider];
|
|
21770
|
+
let adaptationFailed = false;
|
|
21771
|
+
const write = async (filePath, content) => {
|
|
21772
|
+
try {
|
|
21773
|
+
await fsPromises__default.writeFile(filePath, content, "utf8");
|
|
21774
|
+
return true;
|
|
21775
|
+
} catch {
|
|
21776
|
+
adaptationFailed = true;
|
|
21777
|
+
return false;
|
|
21778
|
+
}
|
|
21779
|
+
};
|
|
21772
21780
|
const agentPath = path.join(projectPath, "src/mastra/agents/agent.ts");
|
|
21781
|
+
if (provider !== "openai") try {
|
|
21782
|
+
const result = adaptAgentSource(await fsPromises__default.readFile(agentPath, "utf8"), provider, config);
|
|
21783
|
+
if (!result.applied) adaptationFailed = true;
|
|
21784
|
+
else await write(agentPath, result.content);
|
|
21785
|
+
} catch {
|
|
21786
|
+
adaptationFailed = true;
|
|
21787
|
+
}
|
|
21773
21788
|
const packageJsonPath = path.join(projectPath, "package.json");
|
|
21789
|
+
try {
|
|
21790
|
+
const source = await fsPromises__default.readFile(packageJsonPath, "utf8");
|
|
21791
|
+
const mastraPackages = collectMastraPackages(source);
|
|
21792
|
+
const resolvedVersions = await resolveMastraPackageVersions(mastraPackages, versionTag);
|
|
21793
|
+
if (resolvedVersions === void 0 && mastraPackages.length > 0) console.warn(`We could not resolve exact Mastra package versions for the "${versionTag}" channel, using the channel tag instead`);
|
|
21794
|
+
const result = normalizeManagedManifest(source, resolvedVersions, versionTag);
|
|
21795
|
+
if (!result.applied) adaptationFailed = true;
|
|
21796
|
+
else await write(packageJsonPath, result.content);
|
|
21797
|
+
} catch {
|
|
21798
|
+
adaptationFailed = true;
|
|
21799
|
+
}
|
|
21774
21800
|
const envExamplePath = path.join(projectPath, ".env.example");
|
|
21775
21801
|
const envPath = path.join(projectPath, ".env");
|
|
21802
|
+
let adaptedEnvExample;
|
|
21803
|
+
try {
|
|
21804
|
+
const result = replaceEnvKey(await fsPromises__default.readFile(envExamplePath, "utf8"), config.apiKeyEnv);
|
|
21805
|
+
if (!result.applied) adaptationFailed = true;
|
|
21806
|
+
else if (await write(envExamplePath, result.content)) adaptedEnvExample = result.content;
|
|
21807
|
+
} catch {
|
|
21808
|
+
adaptationFailed = true;
|
|
21809
|
+
}
|
|
21810
|
+
let apiKeyWritten = false;
|
|
21811
|
+
if (adaptedEnvExample === void 0) {
|
|
21812
|
+
if (apiKey) adaptationFailed = true;
|
|
21813
|
+
} else if (apiKey) {
|
|
21814
|
+
const result = setEnvValue(adaptedEnvExample, config.apiKeyEnv, apiKey);
|
|
21815
|
+
if (!result.applied) adaptationFailed = true;
|
|
21816
|
+
else {
|
|
21817
|
+
apiKeyWritten = await writeSecureEnv(envPath, result.content);
|
|
21818
|
+
if (!apiKeyWritten) adaptationFailed = true;
|
|
21819
|
+
}
|
|
21820
|
+
} else try {
|
|
21821
|
+
await fsPromises__default.rm(envPath, { force: true });
|
|
21822
|
+
} catch {
|
|
21823
|
+
adaptationFailed = true;
|
|
21824
|
+
}
|
|
21776
21825
|
const readmePath = path.join(projectPath, "README.md");
|
|
21777
|
-
let agentSource;
|
|
21778
|
-
let packageJsonSource;
|
|
21779
|
-
let envExampleSource;
|
|
21780
21826
|
try {
|
|
21781
|
-
|
|
21782
|
-
|
|
21783
|
-
|
|
21784
|
-
|
|
21785
|
-
|
|
21786
|
-
} catch (error) {
|
|
21787
|
-
throw new Error(`Default template compatibility error: required template file is missing or unreadable: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
21827
|
+
const result = adaptReadme(await fsPromises__default.readFile(readmePath, "utf8"), provider, config, projectName, packageManager);
|
|
21828
|
+
if (!result.applied) adaptationFailed = true;
|
|
21829
|
+
else await write(readmePath, result.content);
|
|
21830
|
+
} catch {
|
|
21831
|
+
adaptationFailed = true;
|
|
21788
21832
|
}
|
|
21789
|
-
|
|
21790
|
-
const nextAgent = adaptAgentSource(agentSource, provider, config);
|
|
21791
|
-
const mastraPackages = collectMastraPackages(packageJsonSource);
|
|
21792
|
-
const resolvedVersions = await resolveMastraPackageVersions(mastraPackages, versionTag);
|
|
21793
|
-
if (resolvedVersions === void 0 && mastraPackages.length > 0) console.warn(`We could not resolve exact Mastra package versions for the "${versionTag}" channel, using the channel tag instead`);
|
|
21794
|
-
const normalizedManifest = normalizeManagedManifest(packageJsonSource, config, resolvedVersions, versionTag);
|
|
21795
|
-
const nextEnvExample = replaceEnvKey(envExampleSource, config.apiKeyEnv);
|
|
21796
|
-
const nextEnv = apiKey ? setEnvValue(nextEnvExample, config.apiKeyEnv, apiKey) : void 0;
|
|
21797
|
-
const nextReadme = readmeSource === void 0 ? void 0 : adaptReadme(readmeSource, provider, config, projectName, packageManager);
|
|
21798
|
-
assertNoProviderResidue(provider, {
|
|
21799
|
-
agent: nextAgent,
|
|
21800
|
-
manifest: normalizedManifest.content,
|
|
21801
|
-
envExample: nextEnvExample,
|
|
21802
|
-
env: nextEnv
|
|
21803
|
-
});
|
|
21804
|
-
const writes = [
|
|
21805
|
-
fsPromises__default.writeFile(agentPath, nextAgent, "utf8"),
|
|
21806
|
-
fsPromises__default.writeFile(packageJsonPath, normalizedManifest.content, "utf8"),
|
|
21807
|
-
fsPromises__default.writeFile(envExamplePath, nextEnvExample, "utf8"),
|
|
21808
|
-
nextEnv === void 0 ? fsPromises__default.rm(envPath, { force: true }) : fsPromises__default.writeFile(envPath, nextEnv, "utf8")
|
|
21809
|
-
];
|
|
21810
|
-
if (nextReadme !== void 0) writes.push(fsPromises__default.writeFile(readmePath, nextReadme, "utf8"));
|
|
21811
|
-
if (packageManager === "pnpm") writes.push(fsPromises__default.writeFile(path.join(projectPath, "pnpm-workspace.yaml"), PNPM_WORKSPACE, "utf8"));
|
|
21812
|
-
await Promise.all(writes);
|
|
21813
|
-
if (nextEnv !== void 0 && process.platform !== "win32") await fsPromises__default.chmod(envPath, 384);
|
|
21833
|
+
if (packageManager === "pnpm") await write(path.join(projectPath, "pnpm-workspace.yaml"), PNPM_WORKSPACE);
|
|
21814
21834
|
return {
|
|
21815
21835
|
...config,
|
|
21816
|
-
|
|
21836
|
+
apiKeyWritten,
|
|
21837
|
+
adaptationFailed
|
|
21817
21838
|
};
|
|
21818
21839
|
}
|
|
21819
21840
|
const DEFAULT_TEMPLATE = {
|
|
@@ -21822,7 +21843,7 @@ const DEFAULT_TEMPLATE = {
|
|
|
21822
21843
|
slug: "template-agent-harness",
|
|
21823
21844
|
agents: ["agent"],
|
|
21824
21845
|
mcp: [],
|
|
21825
|
-
tools: [
|
|
21846
|
+
tools: [],
|
|
21826
21847
|
networks: [],
|
|
21827
21848
|
workflows: []
|
|
21828
21849
|
};
|
|
@@ -22042,6 +22063,7 @@ const create = async (args) => {
|
|
|
22042
22063
|
process.on("SIGINT", handleSigint);
|
|
22043
22064
|
process.on("SIGTERM", handleSigterm);
|
|
22044
22065
|
let selectedApiKeyEnv;
|
|
22066
|
+
let selectedApiKeyWritten = false;
|
|
22045
22067
|
let materializationError;
|
|
22046
22068
|
try {
|
|
22047
22069
|
if (mode === "empty") {
|
|
@@ -22064,14 +22086,17 @@ const create = async (args) => {
|
|
|
22064
22086
|
...observabilityEnabled ? { silent: true } : {}
|
|
22065
22087
|
});
|
|
22066
22088
|
if (isManaged) {
|
|
22067
|
-
|
|
22089
|
+
const providerConfig = await adaptDefaultTemplate({
|
|
22068
22090
|
projectPath: staging.projectPath,
|
|
22069
22091
|
projectName,
|
|
22070
22092
|
packageManager,
|
|
22071
22093
|
provider: llmProvider,
|
|
22072
22094
|
apiKey: llmApiKey,
|
|
22073
22095
|
versionTag: versionTag ?? "latest"
|
|
22074
|
-
})
|
|
22096
|
+
});
|
|
22097
|
+
selectedApiKeyEnv = providerConfig.apiKeyEnv;
|
|
22098
|
+
selectedApiKeyWritten = providerConfig.apiKeyWritten;
|
|
22099
|
+
if (providerConfig.adaptationFailed) log.warn("Some provider setup could not be applied. Review the generated project before running it.");
|
|
22075
22100
|
materializationController.signal.throwIfAborted();
|
|
22076
22101
|
}
|
|
22077
22102
|
}
|
|
@@ -22175,7 +22200,7 @@ ${placeholderSummary}1. Visit ${color.cyan("https://projects.mastra.ai")} to cre
|
|
|
22175
22200
|
2. Paste the token into ${color.cyan("MASTRA_PLATFORM_ACCESS_TOKEN")} and the project id into ${color.cyan("MASTRA_PROJECT_ID")}.`;
|
|
22176
22201
|
}
|
|
22177
22202
|
if (mode === "managed") {
|
|
22178
|
-
const apiKeySummary = llmApiKey ? `Your ${selectedApiKeyEnv} value was written to ${color.cyan(".env")}.` : platformEnvWritten ? `Set ${selectedApiKeyEnv} in ${color.cyan(".env")} before starting.` : `Copy ${color.cyan(".env.example")} to ${color.cyan(".env")} and set ${selectedApiKeyEnv} before starting.`;
|
|
22203
|
+
const apiKeySummary = llmApiKey ? selectedApiKeyWritten ? `Your ${selectedApiKeyEnv} value was written to ${color.cyan(".env")}.` : `Set ${selectedApiKeyEnv} in ${color.cyan(".env")} before starting.` : platformEnvWritten ? `Set ${selectedApiKeyEnv} in ${color.cyan(".env")} before starting.` : `Copy ${color.cyan(".env.example")} to ${color.cyan(".env")} and set ${selectedApiKeyEnv} before starting.`;
|
|
22179
22204
|
note(`${color.green("Success!")}
|
|
22180
22205
|
|
|
22181
22206
|
${apiKeySummary}${observabilitySummary ? `
|
|
@@ -22395,6 +22420,8 @@ async function getCreateVersionTag(version) {
|
|
|
22395
22420
|
if (tag) return tag;
|
|
22396
22421
|
} catch {
|
|
22397
22422
|
}
|
|
22423
|
+
const prereleaseChannel = getPrereleaseChannel(version);
|
|
22424
|
+
if (prereleaseChannel) return prereleaseChannel;
|
|
22398
22425
|
console.error('We could not resolve the create-mastra version tag, falling back to "latest"');
|
|
22399
22426
|
return "latest";
|
|
22400
22427
|
}
|