Skip to content

Commit 3e9e364

Browse files
committed
Add AgentGuard v1.2.2 - AI cost protection library
0 parents  commit 3e9e364

40 files changed

Lines changed: 11769 additions & 0 deletions

.github/workflows/ci.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
13+
strategy:
14+
matrix:
15+
node-version: [16.x, 18.x, 20.x]
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- name: Use Node.js ${{ matrix.node-version }}
21+
uses: actions/setup-node@v3
22+
with:
23+
node-version: ${{ matrix.node-version }}
24+
cache: 'npm'
25+
26+
- name: Install dependencies
27+
run: npm ci
28+
29+
- name: Run tests
30+
run: npm run test:ci
31+
32+
- name: Upload coverage to Codecov
33+
if: matrix.node-version == '18.x'
34+
uses: codecov/codecov-action@v3
35+
with:
36+
file: ./coverage/lcov.info
37+
flags: unittests
38+
name: codecov-umbrella

.github/workflows/publish.yml

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
name: Publish to NPM
2+
3+
on:
4+
release:
5+
types: [published]
6+
workflow_dispatch:
7+
inputs:
8+
version:
9+
description: 'Version to publish (e.g., 1.2.0)'
10+
required: true
11+
type: string
12+
13+
jobs:
14+
publish:
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- name: Setup Node.js
21+
uses: actions/setup-node@v3
22+
with:
23+
node-version: '18.x'
24+
registry-url: 'https://registry.npmjs.org'
25+
cache: 'npm'
26+
27+
- name: Install dependencies
28+
run: npm ci
29+
30+
- name: Run tests
31+
run: npm run test:ci
32+
33+
- name: Build distribution files
34+
run: npm run build
35+
36+
- name: Update version (manual trigger)
37+
if: github.event_name == 'workflow_dispatch'
38+
run: |
39+
npm version ${{ github.event.inputs.version }} --no-git-tag-version
40+
echo "VERSION=${{ github.event.inputs.version }}" >> $GITHUB_ENV
41+
42+
- name: Extract version (release trigger)
43+
if: github.event_name == 'release'
44+
run: |
45+
VERSION=${GITHUB_REF#refs/tags/v}
46+
echo "VERSION=$VERSION" >> $GITHUB_ENV
47+
npm version $VERSION --no-git-tag-version
48+
49+
- name: Verify package
50+
run: |
51+
npm pack --dry-run
52+
echo "📦 Package contents:"
53+
npm pack --dry-run 2>&1 | grep -E "^npm notice"
54+
55+
- name: Publish to NPM
56+
run: npm publish
57+
env:
58+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
59+
60+
- name: Create GitHub Release Assets
61+
if: github.event_name == 'release'
62+
run: |
63+
# Create tarball
64+
npm pack
65+
66+
# Upload to release
67+
gh release upload ${{ github.event.release.tag_name }} \
68+
agent-guard-${VERSION}.tgz \
69+
dist/agent-guard.min.js \
70+
dist/agent-guard-${VERSION}.min.js \
71+
--clobber
72+
env:
73+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
74+
75+
- name: Update CDN Documentation
76+
run: |
77+
echo "✅ Published version ${VERSION} to NPM"
78+
echo ""
79+
echo "📦 Installation:"
80+
echo " npm install agent-guard@${VERSION}"
81+
echo ""
82+
echo "🌐 CDN URLs:"
83+
echo " https://unpkg.com/agent-guard@${VERSION}/dist/agent-guard.min.js"
84+
echo " https://cdn.jsdelivr.net/npm/agent-guard@${VERSION}/dist/agent-guard.min.js"

.gitignore

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Dependencies
2+
node_modules/
3+
npm-debug.log*
4+
yarn-debug.log*
5+
yarn-error.log*
6+
7+
# Runtime & Logs
8+
*.log
9+
.env*
10+
11+
# IDE & Editor
12+
.vscode/
13+
.idea/
14+
.cursor/
15+
*.swp
16+
*.swo
17+
*.sublime-*
18+
19+
# OS Generated
20+
.DS_Store
21+
.DS_Store?
22+
._*
23+
.Spotlight-V100
24+
.Trashes
25+
ehthumbs.db
26+
Thumbs.db
27+
28+
# Development & Internal
29+
PRODUCTION_REALITY.md
30+
DEMO_RESULTS.md
31+
production-test.js
32+
*-test.js
33+
test-*.js
34+
test-npm-package.js
35+
36+
# Build artifacts
37+
build/
38+
*.tgz
39+
*.tar.gz
40+
41+
# Testing & Coverage
42+
coverage/
43+
.nyc_output/
44+
45+
# Cache files
46+
.agentguard-cache.json
47+
*.cache
48+
49+
# IDE & Editor (additional)
50+
.cursor/

0 commit comments

Comments
 (0)