Fix MCP server packaging in clean builds

This commit is contained in:
Jeremy 2026-04-09 18:00:24 -05:00
parent b573af4828
commit c6ff8b026d
4 changed files with 11 additions and 2 deletions

View file

@ -47,7 +47,8 @@
"build:pi-coding-agent": "npm run build -w @gsd/pi-coding-agent",
"build:native-pkg": "npm run build -w @gsd/native",
"build:pi": "npm run build:native-pkg && npm run build:pi-tui && npm run build:pi-ai && npm run build:pi-agent-core && npm run build:pi-coding-agent",
"build": "npm run build:pi && tsc && npm run copy-resources && npm run copy-themes && npm run copy-export-html && node scripts/build-web-if-stale.cjs",
"build:mcp-server": "npm run build -w @gsd-build/mcp-server",
"build": "npm run build:pi && npm run build:mcp-server && tsc && npm run copy-resources && npm run copy-themes && npm run copy-export-html && node scripts/build-web-if-stale.cjs",
"stage:web-host": "node scripts/stage-web-standalone.cjs",
"build:web-host": "npm --prefix web run build && npm run stage:web-host",
"copy-resources": "node scripts/copy-resources.cjs",

View file

@ -20,5 +20,5 @@
"rootDir": "./src"
},
"include": ["src/**/*.ts"],
"exclude": ["node_modules", "dist", "**/*.d.ts", "src/**/*.d.ts"]
"exclude": ["node_modules", "dist", "**/*.d.ts", "src/**/*.d.ts", "src/**/*.test.ts"]
}

View file

@ -97,6 +97,7 @@ if (require.main === module) {
'pi-ai',
'pi-agent-core',
'pi-coding-agent',
'mcp-server',
]
const stale = detectStalePackages(root, WORKSPACE_PACKAGES)

View file

@ -65,6 +65,7 @@ try {
const requiredFiles = [
'dist/loader.js',
'packages/pi-coding-agent/dist/index.js',
'packages/mcp-server/dist/cli.js',
'scripts/link-workspace-packages.cjs',
'dist/web/standalone/server.js',
];
@ -133,6 +134,12 @@ try {
// --- Run the binary to confirm end-to-end resolution ---
console.log('==> Running installed binary (gsd -v)...');
const loaderPath = join(installedRoot, 'dist', 'loader.js');
const bundledWorkflowMcpCliPath = join(installedRoot, 'packages', 'mcp-server', 'dist', 'cli.js');
if (!existsSync(bundledWorkflowMcpCliPath)) {
console.log('ERROR: Bundled workflow MCP CLI missing after install.');
console.log(` Expected: ${bundledWorkflowMcpCliPath}`);
process.exit(1);
}
try {
const versionOutput = execSync(`node "${loaderPath}" -v`, {
cwd: installDir,