Skip to content

Commit 28330b2

Browse files
FarewellFarewell
authored andcommitted
Add happy-cli CI workflow and fix MCP OAuth discovery
- Add build-cli.yml workflow to build and publish happy-cli to GitHub Packages - Fix MCP server: return 404 for .well-known paths (Claude Code OAuth discovery) - Fix TS type error in runAcp.ts (null vs undefined)
1 parent a29bc27 commit 28330b2

File tree

3 files changed

+57
-1
lines changed

3 files changed

+57
-1
lines changed

.github/workflows/build-cli.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Build & Publish Happy CLI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths:
7+
- 'packages/happy-cli/**'
8+
- 'packages/happy-wire/**'
9+
- '.github/workflows/build-cli.yml'
10+
workflow_dispatch:
11+
12+
jobs:
13+
publish:
14+
runs-on: ubuntu-latest
15+
permissions:
16+
contents: read
17+
packages: write
18+
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v4
22+
23+
- name: Setup Node.js
24+
uses: actions/setup-node@v4
25+
with:
26+
node-version: 20
27+
registry-url: https://npm.pkg.github.com
28+
scope: '@farewellsagittarius'
29+
30+
- name: Install dependencies
31+
run: yarn install --frozen-lockfile --ignore-engines --network-timeout 600000
32+
33+
- name: Build happy-wire
34+
run: yarn workspace @slopus/happy-wire build
35+
36+
- name: Build happy-cli
37+
run: yarn workspace happy-coder build
38+
39+
- name: Publish to GitHub Packages
40+
working-directory: packages/happy-cli
41+
run: |
42+
# Scope the package to the repo owner for GitHub Packages
43+
node -e "
44+
const pkg = require('./package.json');
45+
pkg.name = '@farewellsagittarius/happy-coder';
46+
pkg.publishConfig = { registry: 'https://npm.pkg.github.com' };
47+
require('fs').writeFileSync('./package.json', JSON.stringify(pkg, null, 2));
48+
"
49+
npm publish || echo "Version already published, skipping"
50+
env:
51+
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

packages/happy-cli/src/agent/acp/runAcp.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -745,7 +745,7 @@ export async function runAcp(opts: {
745745
if (verbose) {
746746
logAcp('muted', `Outgoing modes from ${opts.agentName} (${modes.availableModes.length}), current=${modes.currentModeId}:`);
747747
for (const mode of modes.availableModes) {
748-
logAcp('muted', ` mode=${mode.id} name=${mode.name}${formatOptionalDetail(mode.description, 160)}`);
748+
logAcp('muted', ` mode=${mode.id} name=${mode.name}${formatOptionalDetail(mode.description ?? undefined, 160)}`);
749749
}
750750
}
751751
session.updateMetadata((currentMetadata) =>

packages/happy-cli/src/claude/utils/startHappyServer.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,11 @@ export async function startHappyServer(client: ApiSessionClient) {
8787

8888
const server = createServer(async (req, res) => {
8989
try {
90+
const url = req.url || '';
91+
if (url.startsWith('/.well-known/')) {
92+
res.writeHead(404).end();
93+
return;
94+
}
9095
await transport.handleRequest(req, res);
9196
} catch (error) {
9297
logger.debug("Error handling request:", error);

0 commit comments

Comments
 (0)