-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJustfile
More file actions
131 lines (106 loc) · 4.8 KB
/
Justfile
File metadata and controls
131 lines (106 loc) · 4.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# Default recipe — show available commands
default:
@just --list
# ── Development ───────────────────────────────────────────────────────────────
# Start the MCP server in dev mode (stdio transport)
dev:
ARCANE_MCP_TRANSPORT=http npm run dev
# Run unit tests
test:
npx vitest run
# Run linter
lint:
npx biome check .
# Format code
fmt:
npx biome format --write .
# Type check
typecheck:
npx tsc --noEmit
# Build TypeScript
build:
npm run build
# ── Docker ────────────────────────────────────────────────────────────────────
# Build the Docker image
docker-build:
docker compose build
# Start the service
up:
docker compose up -d
# Stop the service
down:
docker compose down
# Restart the service
restart:
docker compose restart
# View logs
logs *args='':
docker compose logs -f {{ args }}
# ── Health & Testing ──────────────────────────────────────────────────────────
# Check service health
health:
@curl -sf http://localhost:${ARCANE_MCP_PORT:-44332}/health | jq . || echo "UNHEALTHY"
# Run live integration tests (requires running server)
test-live:
bash tests/test_live.sh
# ── Setup ─────────────────────────────────────────────────────────────────────
# Create .env from .env.example if missing
setup:
@[ -f .env ] || cp .env.example .env && chmod 600 .env && echo "Created .env from .env.example"
# Generate a bearer token
gen-token:
@openssl rand -hex 32
# Check contract drift between schema, help tool, and skill docs
check-contract:
# Generate a standalone CLI for this server (requires running server)
generate-cli:
#!/usr/bin/env bash
set -euo pipefail
echo "⚠ Server must be running on port 44332 (run 'just dev' first)"
echo "⚠ Generated CLI embeds your OAuth token — do not commit or share"
mkdir -p dist dist/.cache
current_hash=$(timeout 10 curl -sf \
-H "Authorization: Bearer $MCP_TOKEN" \
-H "Accept: application/json, text/event-stream" \
http://localhost:44332/mcp/tools/list 2>/dev/null | sha256sum | cut -d' ' -f1 || echo "nohash")
cache_file="dist/.cache/arcane-mcp-cli.schema_hash"
if [[ -f "$cache_file" ]] && [[ "$(cat "$cache_file")" == "$current_hash" ]] && [[ -f "dist/arcane-mcp-cli" ]]; then
echo "SKIP: arcane-mcp tool schema unchanged — use existing dist/arcane-mcp-cli"
exit 0
fi
timeout 30 mcporter generate-cli \
--command http://localhost:44332/mcp \
--header "Authorization: Bearer $MCP_TOKEN" \
--name arcane-mcp-cli \
--output dist/arcane-mcp-cli
printf '%s' "$current_hash" > "$cache_file"
echo "✓ Generated dist/arcane-mcp-cli (requires bun at runtime)"
# ── Cleanup ───────────────────────────────────────────────────────────────────
# Remove build artifacts and caches
clean:
rm -rf .cache/ dist/ coverage/
# Publish: bump version, tag, push (triggers npm + Docker publish)
publish bump="patch":
#!/usr/bin/env bash
set -euo pipefail
[ "$(git branch --show-current)" = "main" ] || { echo "Switch to main first"; exit 1; }
[ -z "$(git status --porcelain)" ] || { echo "Commit or stash changes first"; exit 1; }
git pull origin main
CURRENT=$(node -p "require(\"./package.json\").version")
IFS="." read -r major minor patch <<< "$CURRENT"
case "{{bump}}" in
major) major=$((major+1)); minor=0; patch=0 ;;
minor) minor=$((minor+1)); patch=0 ;;
patch) patch=$((patch+1)) ;;
*) echo "Usage: just publish [major|minor|patch]"; exit 1 ;;
esac
NEW="${major}.${minor}.${patch}"
echo "Version: ${CURRENT} → ${NEW}"
node -e "const p=require(\"./package.json\"); p.version=\"${NEW}\"; require(\"fs\").writeFileSync(\"package.json\", JSON.stringify(p,null,2)+\"
\")"
for f in .claude-plugin/plugin.json .codex-plugin/plugin.json gemini-extension.json; do
[ -f "$f" ] && node -e "const d=JSON.parse(require(\"fs\").readFileSync(\"$f\")); d.version=\"${NEW}\"; require(\"fs\").writeFileSync(\"$f\", JSON.stringify(d,null,2)+\"
\")"
done
git add -A && git commit -m "release: v${NEW}" && git tag "v${NEW}" && git push origin main --tags
echo "Tagged v${NEW} — publish workflow will run automatically"