Skip to content

Commit 1bfb810

Browse files
ycliu613meta-codesync[bot]
authored andcommitted
Integrate MSE installer into CLI prompt flow
Summary: Wire the MSE auto-installer into the CLI prompt flow and output messaging. Changes in prompts.ts: - Call `installMSE()` when user selects "Yes" for Meta Spatial Editor integration - Only show manual installation prerequisite if auto-install fails or is declined Changes in cli.ts: - Show contextual messaging based on installation result: - "Meta Spatial Editor is ready!" if successfully installed or already present - "After installing Meta Spatial Editor..." if manual installation needed - Display project paths for opening in Meta Spatial Editor This completes the MSE auto-install feature (part 4 of 4). Reviewed By: wangpingsx Differential Revision: D91470649 fbshipit-source-id: bf3d515a5b408187182a773dd05674827ddc3a01
1 parent 6c29008 commit 1bfb810

File tree

2 files changed

+34
-15
lines changed

2 files changed

+34
-15
lines changed

packages/create/src/cli.ts

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -175,13 +175,24 @@ IWSDK Create CLI v${VERSION}\nNode ${process.version}`;
175175
if (res.metaspatial) {
176176
const metaProjectPath = join(outDir, 'metaspatial');
177177
const metaMainPath = join(metaProjectPath, 'Main.metaspatial');
178-
prereqs.push({
179-
level: 'important',
180-
message:
181-
`Open the Meta Spatial Editor project.\n` +
182-
`Project Folder: ${metaProjectPath}\n` +
183-
`Open in Meta Spatial Editor: ${metaMainPath}`,
184-
});
178+
179+
if (res.mseInstallResult?.installed && !res.mseInstallResult.manual) {
180+
prereqs.push({
181+
level: 'info',
182+
message:
183+
`Meta Spatial Editor is ready!\n` +
184+
`Project Folder: ${metaProjectPath}\n` +
185+
`Open in Meta Spatial Editor: ${metaMainPath}`,
186+
});
187+
} else {
188+
prereqs.push({
189+
level: 'important',
190+
message:
191+
`After installing Meta Spatial Editor, open the project:\n` +
192+
`Project Folder: ${metaProjectPath}\n` +
193+
`Open in Meta Spatial Editor: ${metaMainPath}`,
194+
});
195+
}
185196
}
186197
// Print prerequisites first, then next steps
187198
printPrerequisites(prereqs);

packages/create/src/prompts.ts

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
*/
77

88
import prompts from 'prompts';
9-
import { PromptResult, TriState, VariantId } from './types.js';
9+
import { installMSE } from './mse-installer.js';
10+
import { MSEInstallResult, PromptResult, TriState, VariantId } from './types.js';
1011

1112
export async function promptFlow(nameArg?: string): Promise<PromptResult> {
1213
let cancelled = false;
@@ -242,24 +243,30 @@ export async function promptFlow(nameArg?: string): Promise<PromptResult> {
242243
name: 'metaspatialChoice',
243244
message: 'Enable Meta Spatial Editor integration?',
244245
choices: [
245-
{ title: 'No (Can change later)', value: false },
246246
{
247-
title: 'Yes (Additional software required)',
247+
title: 'Yes (Install Meta Spatial Editor if needed)',
248248
value: true,
249249
},
250+
{ title: 'No (Can change later)', value: false },
250251
],
251252
initial: 0,
252253
},
253254
{ onCancel },
254255
);
255256
const metaspatial = !!metaAnswer.metaspatialChoice;
256257

258+
let mseInstallResult: MSEInstallResult | undefined;
259+
257260
if (metaspatial) {
258-
prerequisites.push({
259-
level: 'important',
260-
message:
261-
'Required: Install Meta Spatial Editor (v9 or later). The build pipeline depends on its CLI tool; without it, build or dev WILL FAIL. Download: https://developers.meta.com/horizon/documentation/spatial-sdk/spatial-editor-overview',
262-
});
261+
mseInstallResult = await installMSE();
262+
263+
if (mseInstallResult.manual || mseInstallResult.outdated) {
264+
prerequisites.push({
265+
level: 'important',
266+
message:
267+
'Required: Install Meta Spatial Editor (v9 or later). The build pipeline depends on its CLI tool; without it, build or dev WILL FAIL. Download: https://developers.meta.com/horizon/documentation/spatial-sdk/spatial-editor-overview',
268+
});
269+
}
263270
}
264271

265272
const { gitInit, installNow } = await prompts(
@@ -307,5 +314,6 @@ export async function promptFlow(nameArg?: string): Promise<PromptResult> {
307314
xrFeatureStates,
308315
actionItems,
309316
prerequisites,
317+
mseInstallResult,
310318
};
311319
}

0 commit comments

Comments
 (0)