Skip to content

Commit b3c61da

Browse files
committed
chore(ci): add GitHub Actions workflow, README badges and build script
1 parent 3171158 commit b3c61da

File tree

4 files changed

+77
-1
lines changed

4 files changed

+77
-1
lines changed

.github/workflows/ci.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main, master ]
6+
pull_request:
7+
branches: [ main, master ]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
node-version: [18.x, 20.x, 22.x]
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Use Node.js ${{ matrix.node-version }}
20+
uses: actions/setup-node@v4
21+
with:
22+
node-version: ${{ matrix.node-version }}
23+
cache: 'npm'
24+
25+
- run: npm ci
26+
- run: npm run build
27+
- run: npm test
28+
- run: npm run smoke
29+
30+
publish:
31+
needs: test
32+
runs-on: ubuntu-latest
33+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
34+
35+
steps:
36+
- uses: actions/checkout@v4
37+
- uses: actions/setup-node@v4
38+
with:
39+
node-version: '20.x'
40+
registry-url: 'https://registry.npmjs.org'
41+
42+
- run: npm ci
43+
- run: npm run build
44+
45+
- name: Publish to npm
46+
run: npm publish --access public
47+
env:
48+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
49+
continue-on-error: true

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# AgentGuard
22

3+
[![CI](https://github.com/krishkumar/agentguard/workflows/CI/badge.svg)](https://github.com/krishkumar/agentguard/actions)
4+
[![npm version](https://badge.fury.io/js/ai-agentguard.svg)](https://www.npmjs.com/package/ai-agentguard)
5+
[![npm downloads](https://img.shields.io/npm/dm/ai-agentguard.svg)](https://www.npmjs.com/package/ai-agentguard)
6+
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
7+
[![Node.js Version](https://img.shields.io/node/v/ai-agentguard.svg)](https://nodejs.org/)
8+
39
**Work safely with agents like Claude Code.**
410

511
AI coding agents are powerful, but with great power comes `rm -rf /`.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"agentguard-shell": "./dist/bin/agentguard-shell.js"
1313
},
1414
"scripts": {
15-
"build": "tsc && chmod +x dist/bin/*.js && mkdir -p dist/bin/wrappers && cp src/bin/wrappers/* dist/bin/wrappers/ && chmod +x dist/bin/wrappers/*",
15+
"build": "./scripts/build.sh",
1616
"dev": "tsc --watch",
1717
"test": "vitest --run",
1818
"test:watch": "vitest",

scripts/build.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/bash
2+
set -e
3+
4+
echo "🔨 Building AgentGuard..."
5+
6+
# Compile TypeScript
7+
npx tsc
8+
9+
# Make executables executable if they exist
10+
if [ -d "dist/bin" ]; then
11+
find dist/bin -name "*.js" -exec chmod +x {} \; 2>/dev/null || true
12+
fi
13+
14+
# Copy wrapper scripts if they exist
15+
mkdir -p dist/bin/wrappers
16+
if [ -d "src/bin/wrappers" ] && [ "$(ls -A src/bin/wrappers 2>/dev/null)" ]; then
17+
cp src/bin/wrappers/* dist/bin/wrappers/ 2>/dev/null || true
18+
chmod +x dist/bin/wrappers/* 2>/dev/null || true
19+
fi
20+
21+
echo "✅ Build complete"

0 commit comments

Comments
 (0)