Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 92 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
name: CI

on:
workflow_call:
pull_request:
branches: [main]
push:
branches: [main]
tags-ignore:
- "v*"
paths-ignore:
- README.md
- LICENSE
- "docs/**"
- "*.md"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
lint:
name: lint
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: "22"
cache: "npm"
- name: Install dependencies
run: npm ci
- name: Run ESLint
run: npm run lint
- name: Check formatting
run: npx prettier --check "src/**/*.ts"

test:
name: test
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: "22"
cache: "npm"
- name: Install OPA
uses: open-policy-agent/setup-opa@950f159a49aa91f9323f36f1de81c7f6b5de9576 # v2.3.0
with:
version: 1.4.2
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
- name: Run tests
run: npm test
- name: Upload coverage
if: always()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: coverage-report
path: coverage/
retention-days: 7

build:
name: build
runs-on: ubuntu-latest
permissions:
contents: read
needs: [lint, test]
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: "22"
cache: "npm"
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
- name: Verify CLI runs
run: node dist/server.js --help
- name: Upload build artifacts
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: dist
path: dist/
retention-days: 7
60 changes: 60 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Release

on:
push:
branches: [main]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false

permissions: {}

jobs:
ci:
name: ci
uses: ./.github/workflows/ci.yml
permissions:
contents: read

release:
name: release
runs-on: ubuntu-latest
needs: [ci]
permissions:
contents: write
id-token: write
packages: write
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
persist-credentials: false
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: "22"
cache: "npm"
registry-url: "https://registry.npmjs.org"
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
- name: Run semantic-release
id: semantic-release
uses: cycjimmy/semantic-release-action@b1b432f13acb7768e0c8efdec416d363a57546f2 # v4.1.1
with:
extra_plugins: |
@semantic-release/commit-analyzer
@semantic-release/release-notes-generator
@semantic-release/changelog
@semantic-release/npm
@semantic-release/github
@semantic-release/git
conventional-changelog-conventionalcommits
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Release info
if: steps.semantic-release.outputs.new_release_published == 'true'
run: |
echo "New release published: v${{ steps.semantic-release.outputs.new_release_version }}"
23 changes: 23 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Source files
src/
!dist/
__tests__/
.bmad/
.windsurf/
.github/
docs/
frameworks/
*.ts
tsconfig.json
jest.config.js
eslint.config.js
.prettierrc

# Logs and local config
logs/
.env

# Editor files
.vscode/
.idea/
*.swp
27 changes: 27 additions & 0 deletions .releaserc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
branches:
- main
plugins:
- - "@semantic-release/commit-analyzer"
- preset: conventionalcommits
- - "@semantic-release/release-notes-generator"
- preset: conventionalcommits
- - "@semantic-release/changelog"
- changelogFile: CHANGELOG.md
- - "@semantic-release/npm"
- npmPublish: true
- - "@semantic-release/git"
- assets:
- CHANGELOG.md
- package.json
message: |-
chore(release): ${nextRelease.version} [skip ci]

${nextRelease.notes}
- - "@semantic-release/github"
- successComment: false
failTitle: false
failCommentCondition: false
labels:
- automated
- release
67 changes: 67 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Contributing to PolyAgent

Thank you for your interest in contributing to PolyAgent! We welcome contributions from the community.

## Development Setup

1. **Clone the repository:**
```bash
git clone https://github.com/your-org/polyagent.git
cd polyagent
```

2. **Install dependencies:**
```bash
npm install
```

3. **Build the project:**
```bash
npm run build
```

4. **Run tests:**
```bash
npm test
```

## Architecture

PolyAgent is built as a Model Context Protocol (MCP) server using TypeScript and Node.js.

- `src/server.ts`: CLI entry point
- `src/commands/`: CLI command implementations
- `src/tools/`: MCP tool implementations
- `src/services/`: Core services (Config, Logger, Health, FrameworkStore)
- `src/lib/`: Shared libraries
- `frameworks/`: Embedded security framework data (YAML)

## Adding a New Framework

1. Create a new YAML file in `frameworks/` (e.g., `frameworks/my-new-framework.yaml`).
2. Ensure it follows the schema defined in `src/services/framework-store.ts`.
3. The `FrameworkStore` will automatically load it on startup.

## Adding a New MCP Tool

1. Create a new tool definition in `src/tools/`.
2. Define the Input Schema using Zod.
3. Register the tool in `src/server.ts` (or `src/commands/start.ts`).
4. Implement the tool logic in the `CallToolRequestSchema` handler.

## Coding Standards

- We use **ESLint** and **Prettier**. Run `npm run lint` and `npm run format` before committing.
- **Unit Tests:** All new features must have unit tests. Run `npm test` to verify.
- **Strict TypeScript:** Do not use `any` unless absolutely necessary.

## Pull Request Process

1. Fork the repo and create your branch from `main`.
2. Implement your changes and add tests.
3. Ensure `npm test` passes.
4. Submit a Pull Request with a clear description of your changes.

## License

By contributing, you agree that your contributions will be licensed under its Apache-2.0 License.
Loading
Loading