Skip to content

Commit cc43e35

Browse files
Stephan Ferraroclaude
andcommitted
ci: gate publishing on typecheck, lint, tests and a compiled smoke test
The publish workflow ran only 'npm test --if-present' and then published. Since the package now ships dist/ rather than a checked-in source file, it also verifies that the compiled entry point starts and answers on STDIO before anything reaches npm. Also fixes the last stale docs references: README pointed at the old server.test.mjs for loadServerAs(), PUBLISHING.md still named server.mjs as the entry point. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent 6f182b4 commit cc43e35

3 files changed

Lines changed: 25 additions & 7 deletions

File tree

.github/workflows/publish.yml

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,28 @@ jobs:
2929
node-version: '22'
3030
registry-url: 'https://registry.npmjs.org'
3131

32+
# `prepare` compiles src/ -> dist/ as part of the install; `prepublishOnly`
33+
# rebuilds and re-runs the suite before the publish itself.
3234
- name: Install dependencies
3335
run: npm ci
34-
35-
- name: Run tests (if any)
36-
run: npm test --if-present
37-
36+
37+
- name: Typecheck
38+
run: npm run typecheck
39+
40+
- name: Lint
41+
run: npm run lint
42+
43+
- name: Run tests
44+
run: npm test
45+
46+
# dist/ is what actually ships — verify it starts before publishing it.
47+
- name: Smoke-test the compiled server
48+
run: |
49+
echo '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"ci","version":"1"}}}' \
50+
| MCP_SILENT=true node bin/mcp-ssh.js \
51+
| grep -q '"serverInfo"'
52+
53+
3854
- name: Bump version (if manual trigger)
3955
if: github.event_name == 'workflow_dispatch'
4056
run: npm version ${{ github.event.inputs.version }} --no-git-tag-version

PUBLISHING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,4 +71,4 @@ The package is configured with:
7171
- Scoped name: `@aiondadotcom/mcp-ssh`
7272
- Public access
7373
- Binary: `mcp-ssh` command
74-
- Entry point: `server.mjs`
74+
- Entry point: `dist/server.js`, compiled from `src/` (`prepublishOnly` runs the build and the test suite)

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,11 @@ npm install -g @aiondadotcom/mcp-ssh
5555
```bash
5656
git clone https://github.com/aiondadotcom/mcp-ssh.git
5757
cd mcp-ssh
58-
npm install
58+
npm install # also compiles src/ -> dist/
5959
npm start
6060
```
61+
The server is TypeScript under `src/`; `npm install` builds it. After editing sources run
62+
`npm run build` (or `npm test`, which reads `src/` directly).
6163

6264
## Example Usage
6365

@@ -683,7 +685,7 @@ Three things to know before opening a PR:
683685
reports an empty string, see issue #10) or for `timeout || DEFAULT`.
684686
- **CI runs on Linux and Windows** across Node 20, 22 and 24. Platform-specific code paths are
685687
tested from either OS by re-importing the module with `process.platform` faked — see
686-
`loadServerAs()` in `server.test.mjs` — rather than by skipping tests on one platform.
688+
`loadServerAs()` in `src/test-helpers.ts` — rather than by skipping tests on one platform.
687689

688690
## License
689691

0 commit comments

Comments
 (0)