feat(node): add TypeScript sibling project for npm-based install
Introduces @kuns/claude-mailbox under node/, a wire-compatible TypeScript port of the .NET daemon that distributes via the public Gitea npm registry. The .NET project stays in src/ClaudeMailbox/ untouched; users pick whichever flavor they prefer. - node/ project: fastify + @modelcontextprotocol/sdk StreamableHTTPServerTransport + better-sqlite3, schema and wire surface match the C# version (port 47822, X-Mailbox header, MCP tool names, snake_case SQLite columns) - Cross-platform autostart: Scheduled Task (Win, no admin) / Windows Service (Win, --service) / launchd (mac) / systemd --user (linux) - 9/9 vitest tests pass; end-to-end /health + send/check round-trip verified - CI split: existing ci.yml/release.yml renamed to *-dotnet.yml with path filters, new ci-node.yml and release-node.yml publish to Gitea npm registry - install.ps1 / install.sh bootstrap one-liners at repo root; homebrew/ contains a tap formula template - README install section reordered: npm path primary, dotnet publish secondary Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,12 +1,24 @@
|
||||
name: CI
|
||||
name: CI (.NET)
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- "src/**"
|
||||
- "tests/**"
|
||||
- "ClaudeMailbox.slnx"
|
||||
- "global.json"
|
||||
- ".gitea/workflows/ci-dotnet.yml"
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- "src/**"
|
||||
- "tests/**"
|
||||
- "ClaudeMailbox.slnx"
|
||||
- "global.json"
|
||||
- ".gitea/workflows/ci-dotnet.yml"
|
||||
|
||||
jobs:
|
||||
build:
|
||||
34
.gitea/workflows/ci-node.yml
Normal file
34
.gitea/workflows/ci-node.yml
Normal file
@@ -0,0 +1,34 @@
|
||||
name: CI (Node)
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
paths:
|
||||
- "node/**"
|
||||
- ".gitea/workflows/ci-node.yml"
|
||||
pull_request:
|
||||
paths:
|
||||
- "node/**"
|
||||
- ".gitea/workflows/ci-node.yml"
|
||||
|
||||
jobs:
|
||||
build-test:
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
run:
|
||||
working-directory: node
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: https://github.com/actions/checkout@v4
|
||||
|
||||
- name: Node version
|
||||
run: node --version && npm --version
|
||||
|
||||
- name: Install
|
||||
run: npm ci
|
||||
|
||||
- name: Test
|
||||
run: npm test
|
||||
|
||||
- name: Build
|
||||
run: npm run build
|
||||
116
.gitea/workflows/release-node.yml
Normal file
116
.gitea/workflows/release-node.yml
Normal file
@@ -0,0 +1,116 @@
|
||||
name: Release (Node)
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*'
|
||||
|
||||
jobs:
|
||||
release:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
GITEA_API: https://git.kuns.dev/api/v1
|
||||
REPO: releases/ClaudeMailbox
|
||||
NPM_REGISTRY_HOST: git.kuns.dev/api/packages/releases/npm/
|
||||
defaults:
|
||||
run:
|
||||
working-directory: node
|
||||
steps:
|
||||
- name: Checkout tag
|
||||
uses: https://github.com/actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Node version
|
||||
run: node --version && npm --version
|
||||
|
||||
- name: Resolve version
|
||||
id: ver
|
||||
run: |
|
||||
set -euo pipefail
|
||||
TAG="${{ github.ref_name }}"
|
||||
VERSION="${TAG#v}"
|
||||
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
|
||||
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Set package version
|
||||
env:
|
||||
VERSION: ${{ steps.ver.outputs.version }}
|
||||
run: npm version --no-git-tag-version "$VERSION"
|
||||
|
||||
- name: Install
|
||||
run: npm ci
|
||||
|
||||
- name: Test
|
||||
run: npm test
|
||||
|
||||
- name: Build
|
||||
run: npm run build
|
||||
|
||||
- name: Pack
|
||||
env:
|
||||
VERSION: ${{ steps.ver.outputs.version }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
npm pack
|
||||
mv "kuns-claude-mailbox-${VERSION}.tgz" "claude-mailbox-${VERSION}.tgz"
|
||||
( sha256sum "claude-mailbox-${VERSION}.tgz" > checksums.txt )
|
||||
|
||||
- name: Configure npm auth for Gitea
|
||||
env:
|
||||
NPM_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
echo "@kuns:registry=https://${NPM_REGISTRY_HOST}" > .npmrc
|
||||
echo "//${NPM_REGISTRY_HOST}:_authToken=${NPM_TOKEN}" >> .npmrc
|
||||
|
||||
- name: Publish to Gitea npm registry
|
||||
run: npm publish --access public
|
||||
|
||||
- name: Find or create Gitea release
|
||||
id: release
|
||||
env:
|
||||
TAG: ${{ steps.ver.outputs.tag }}
|
||||
TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
# Try to find an existing release for this tag (the .NET workflow may have created it).
|
||||
EXISTING=$(curl -sS \
|
||||
-H "Authorization: token ${TOKEN}" \
|
||||
"${GITEA_API}/repos/${REPO}/releases/tags/${TAG}" || echo "")
|
||||
RELEASE_ID=$(echo "$EXISTING" | jq -r '.id // empty')
|
||||
if [ -z "$RELEASE_ID" ] || [ "$RELEASE_ID" = "null" ]; then
|
||||
BODY=$(jq -n \
|
||||
--arg tag "$TAG" \
|
||||
--arg name "$TAG" \
|
||||
'{tag_name:$tag, name:$name, body:"", draft:false, prerelease:false, target_commitish:"main"}')
|
||||
RESP=$(curl -sS -X POST \
|
||||
-H "Authorization: token ${TOKEN}" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "$BODY" \
|
||||
"${GITEA_API}/repos/${REPO}/releases")
|
||||
RELEASE_ID=$(echo "$RESP" | jq -r '.id // empty')
|
||||
fi
|
||||
if [ -z "$RELEASE_ID" ] || [ "$RELEASE_ID" = "null" ]; then
|
||||
echo "::error::Could not resolve release id" >&2
|
||||
exit 1
|
||||
fi
|
||||
echo "release_id=$RELEASE_ID" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Upload tarball + checksums
|
||||
env:
|
||||
VERSION: ${{ steps.ver.outputs.version }}
|
||||
RELEASE_ID: ${{ steps.release.outputs.release_id }}
|
||||
TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
for f in \
|
||||
"claude-mailbox-${VERSION}.tgz" \
|
||||
"checksums.txt"
|
||||
do
|
||||
curl -sS --fail-with-body -X POST \
|
||||
-H "Authorization: token ${TOKEN}" \
|
||||
-F "attachment=@${f}" \
|
||||
"${GITEA_API}/repos/${REPO}/releases/${RELEASE_ID}/assets?name=${f}" \
|
||||
> /dev/null
|
||||
done
|
||||
Reference in New Issue
Block a user