Skip to content

Commit 8b372b9

Browse files
tadasantclaude
andauthored
fix: restore missing prepare-publish.js for claude-code-agent (v0.0.4) (#167)
## Summary Fixes the missing `prepare-publish.js` file for the claude-code-agent MCP server that was accidentally deleted during the directory architecture refactoring in commit 1a5f484. - Restored `prepare-publish.js` file following the same pattern as other MCP servers - Bumped version to 0.0.4 to trigger CI build and verify the fix works - Tested the script locally to ensure it builds correctly ## Test plan - [x] Script runs successfully without errors - [x] Shared directory builds properly - [x] Local package builds correctly - [x] Files are copied as expected for publishing - [ ] CI passes (will verify after PR creation) 🤖 Generated with [Claude Code](https://claude.ai/code) --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 1a5f484 commit 8b372b9

File tree

6 files changed

+81
-5
lines changed

6 files changed

+81
-5
lines changed

experimental/claude-code-agent/CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,18 @@ All notable changes to the Claude Code Agent MCP Server will be documented in th
44

55
## [Unreleased]
66

7+
## [0.0.4] - 2025-10-10
8+
9+
**CRITICAL FIX:**
10+
11+
- Restored missing `prepare-publish.js` file that was accidentally deleted during the directory architecture refactoring
12+
- The prepare-publish.js script is essential for building and bundling the package correctly for npm publication
13+
- Without this file, the `prepublishOnly` script fails and prevents proper package releases
14+
15+
**Technical Details:**
16+
17+
This restores the prepare-publish.js file that was accidentally removed in the directory architecture refactoring commit (1a5f484). The script handles TypeScript compilation, shared directory setup, and file copying for npm publishing. This fix ensures the claude-code-agent server can be properly built and published.
18+
719
## [0.0.3] - 2025-10-10
820

921
**BREAKING CHANGES:**

experimental/claude-code-agent/MANUAL_TESTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Manual tests for the Claude Code Agent MCP Server verify the integration with th
66

77
## Latest Test Results
88

9-
**Commit:** a35b31b
9+
**Commit:** 3303b24
1010
**Date:** 2025-10-10
1111
**Overall:** 100% passing (3/3 test suites)
1212
**Note:** Verified new working_directory parameter and directory separation functionality
@@ -111,7 +111,7 @@ Tests fail if:
111111
## Manual Test Results
112112

113113
**Last tested**: 2025-10-10
114-
**Commit**: a35b31b
114+
**Commit**: 3303b24
115115
**Result**: SUCCESS (100% pass rate)
116116
**Note**: Verified new required working_directory parameter and directory separation functionality
117117

experimental/claude-code-agent/local/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "claude-code-agent-mcp-server",
3-
"version": "0.0.3",
3+
"version": "0.0.4",
44
"description": "Local implementation of claude-code-agent MCP server",
55
"mcpName": "claude-code-agent",
66
"main": "build/index.js",
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
#!/usr/bin/env node
2+
import { cp, rm } from 'fs/promises';
3+
import { join, dirname } from 'path';
4+
import { fileURLToPath } from 'url';
5+
import { execSync } from 'child_process';
6+
7+
const __dirname = dirname(fileURLToPath(import.meta.url));
8+
9+
async function prepare() {
10+
console.log('Preparing for publish...');
11+
12+
// First, ensure TypeScript is available
13+
console.log('Installing TypeScript for build...');
14+
try {
15+
execSync('npm install --no-save typescript @types/node', { stdio: 'inherit' });
16+
} catch (e) {
17+
console.error('Failed to install TypeScript:', e.message);
18+
process.exit(1);
19+
}
20+
21+
// Build shared directory first
22+
const sharedDir = join(__dirname, '../shared');
23+
console.log('Building shared directory...');
24+
try {
25+
execSync('npm install && npm run build', { cwd: sharedDir, stdio: 'inherit' });
26+
} catch (e) {
27+
console.error('Failed to build shared directory:', e.message);
28+
process.exit(1);
29+
}
30+
31+
// Set up the shared directory for the build
32+
console.log('Setting up shared directory for build...');
33+
try {
34+
// Create a symlink for the build process (like setup-dev.js does)
35+
await rm(join(__dirname, 'shared'), { recursive: true, force: true });
36+
execSync(`node setup-dev.js`, { cwd: __dirname, stdio: 'inherit' });
37+
} catch (e) {
38+
console.error('Failed to set up shared directory:', e.message);
39+
process.exit(1);
40+
}
41+
42+
// Now build the local package
43+
console.log('Building local package...');
44+
try {
45+
execSync('npx tsc && npx tsc -p tsconfig.integration.json', { stdio: 'inherit' });
46+
} catch (e) {
47+
console.error('Failed to build local package:', e.message);
48+
process.exit(1);
49+
}
50+
51+
// Clean up the symlink and copy the actual files for publishing
52+
try {
53+
await rm(join(__dirname, 'shared'), { recursive: true, force: true });
54+
} catch (e) {
55+
// Ignore if doesn't exist
56+
}
57+
58+
// Copy the built shared files
59+
await cp(join(__dirname, '../shared/build'), join(__dirname, 'shared'), { recursive: true });
60+
61+
console.log('Copied shared files to local package');
62+
}
63+
64+
prepare().catch(console.error);

experimental/claude-code-agent/package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)