-
Notifications
You must be signed in to change notification settings - Fork 314
98 lines (83 loc) · 3.46 KB
/
package-test-claude-code.yaml
File metadata and controls
98 lines (83 loc) · 3.46 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
name: Claude Code Plugin Test
on:
push:
branches:
- dev
paths:
- "src/packages/claude-code/**"
- ".github/workflows/package-test-claude-code.yaml"
pull_request:
branches:
- dev
paths:
- "src/packages/claude-code/**"
- ".github/workflows/package-test-claude-code.yaml"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: read
defaults:
run:
working-directory: src/packages/claude-code
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
- name: Set up Node.js
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f
with:
node-version: '22'
- name: Validate package.json
run: node -e "const pkg = require('./package.json'); if (!pkg.name || !pkg.version) { process.exit(1); } console.log(pkg.name + '@' + pkg.version)"
- name: Install dependencies
run: npm install
- name: Type check
run: npx tsc --noEmit
- name: Test
run: npm test
- name: Build
run: npm run build
- name: Verify build output
run: |
node -e "
const fs = require('fs');
const files = ['plugin/scripts/mcp-server.cjs', 'plugin/scripts/hook-handler.cjs'];
for (const f of files) {
if (!fs.existsSync(f)) { console.error('Missing: ' + f); process.exit(1); }
const stat = fs.statSync(f);
if (stat.size < 1000) { console.error('Suspiciously small: ' + f + ' (' + stat.size + ' bytes)'); process.exit(1); }
console.log('OK: ' + f + ' (' + (stat.size / 1024).toFixed(0) + ' KB)');
}
"
- name: Verify bundles match committed artifacts
run: |
if git diff --name-only -- plugin/scripts/ | grep -q .; then
echo "Error: Committed bundles differ from a clean rebuild:"
git diff --stat -- plugin/scripts/
echo ""
echo "Hint: run 'npm run release -- X.Y.Z' to rebuild and commit the updated bundles."
exit 1
fi
echo "Bundles match committed artifacts ✓"
- name: Verify plugin manifest
run: |
node -e "
const fs = require('fs');
const manifest = JSON.parse(fs.readFileSync('plugin/.claude-plugin/plugin.json', 'utf8'));
if (!manifest.name || !manifest.version) { console.error('Invalid plugin.json'); process.exit(1); }
console.log('Plugin: ' + manifest.name + '@' + manifest.version);
const mcp = JSON.parse(fs.readFileSync('plugin/.mcp.json', 'utf8'));
if (!mcp.mcpServers?.acontext) { console.error('Missing MCP server config'); process.exit(1); }
console.log('MCP server: acontext');
const hooks = JSON.parse(fs.readFileSync('plugin/hooks/hooks.json', 'utf8'));
const hookTypes = Object.keys(hooks.hooks || {});
if (!hookTypes.includes('SessionStart') || !hookTypes.includes('PostToolUse') || !hookTypes.includes('Stop')) {
console.error('Missing required hooks. Found: ' + hookTypes.join(', ')); process.exit(1);
}
console.log('Hooks: ' + hookTypes.join(', '));
"
- name: Verify hook-handler loads
run: node -e "require('./plugin/scripts/hook-handler.cjs')" 2>&1 || true