Skip to content

Commit bffefff

Browse files
fix(build): compile the artifact routed CLI after MCP Apps
The MCP App Rsbuild pass asserts the target root holds nothing but its own HTML, so the routed CLI bin (like scripts, hooks, and MCP entries) must follow it; otherwise a project combining MCP Apps with a generated CLI failed with AB5000 (caught by the packed stdio projection release gate).
1 parent c8beb08 commit bffefff

1 file changed

Lines changed: 11 additions & 9 deletions

File tree

‎packages/agent-bundle/src/build/build.ts‎

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -385,15 +385,8 @@ export const build = async (options: BuildOptions): Promise<BuildResult> => {
385385
// manifest, `inspect`, and dev status report (issue #237).
386386
const meta = projectMeta(options.model.metadata);
387387
for (const target of stagedTargets) {
388-
if (target.cliBin) {
389-
compiledCliBins.push(...(await compileCliBins(options.model, {
390-
cwd: options.projectRoot,
391-
meta,
392-
outDir: target.root,
393-
target: target.name,
394-
...tools,
395-
})));
396-
}
388+
// MCP Apps compile first: their Rsbuild pass asserts the target root
389+
// holds nothing but its own HTML, so every other surface follows it.
397390
const targetMcpApps = await compileMcpApps(options.model.mcpApps ?? [], {
398391
cwd: options.projectRoot,
399392
meta,
@@ -403,6 +396,15 @@ export const build = async (options: BuildOptions): Promise<BuildResult> => {
403396
});
404397
compiledMcpApps.push(...targetMcpApps);
405398
await emitPlanEntries({ entries: target.entries, root: target.root });
399+
if (target.cliBin) {
400+
compiledCliBins.push(...(await compileCliBins(options.model, {
401+
cwd: options.projectRoot,
402+
meta,
403+
outDir: target.root,
404+
target: target.name,
405+
...tools,
406+
})));
407+
}
406408
compiledEntries.push(
407409
...(await compileEntries(
408410
options.model.scripts.filter((script) => script.targets.includes(target.name)),

0 commit comments

Comments
 (0)