Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
ee50492
doc: added github-copilot instructions file
Zaiidmo Feb 26, 2026
9315596
ref develop
Zaiidmo Feb 28, 2026
8410542
added copilot instructions
Zaiidmo Feb 28, 2026
8c4c8a6
chore: standardize package configuration (jest, eslint, tsconfig, env)
Zaiidmo Mar 1, 2026
eea8f5a
chore: add standardized CI/CD workflows (pr-validation, release-check…
Zaiidmo Mar 1, 2026
7ffac0d
fix: add ts-node dev dependency for jest.config.ts
Zaiidmo Mar 2, 2026
c6afa3c
chore: add .npmignore, dependabot, and npm audit to release workflow
Zaiidmo Mar 2, 2026
d090c49
Merge branch 'master' into develop
Zaiidmo Mar 2, 2026
1023053
docs: add standardized instruction files structure
Zaiidmo Mar 3, 2026
4afd85e
refactor: move instruction files to .github/instructions/
Zaiidmo Mar 3, 2026
043bc2f
fix: update publish workflow to handle squash merges from develop to …
Zaiidmo Mar 12, 2026
5d1abfb
ops: update dependabot PR limits
Zaiidmo Mar 12, 2026
cffc665
ops (ci): standardize publish validation and dependabot across all pa…
Zaiidmo Mar 30, 2026
97cd396
security: added CODEOWNER file for branches security
Zaiidmo Mar 30, 2026
97ef834
ops: updated relese check workflow
Zaiidmo Mar 31, 2026
c43dc64
chore(ops): updated dependabot team name
Zaiidmo Apr 1, 2026
707eb27
Feature/ak 009 retention redaction idempotency validation (#21)
y-aithnini Apr 2, 2026
7f1b1b3
Feature/ak 009 retention redaction idempotency validation (#23)
y-aithnini Apr 2, 2026
06bd9bd
Feature/ak 009 retention redaction idempotency validation (#25)
y-aithnini Apr 2, 2026
d288699
Develop (#12) (#27)
y-aithnini Apr 2, 2026
6522bf0
Develop (#12) (#28)
y-aithnini Apr 2, 2026
99e1125
ci: update release check workflow
Zaiidmo Apr 6, 2026
f0e8cdd
chore: merging to release
Zaiidmo Apr 6, 2026
26b9575
0.0.1
Zaiidmo Apr 6, 2026
319d84e
Merge remote-tracking branch 'origin/master' into develop
Zaiidmo Apr 6, 2026
030bf0c
fix: resolve deps, peer deps, and Zod v4 breaking changes
Zaiidmo Apr 6, 2026
71eac3a
chore(deps): fix peer dependencies conflicts
Zaiidmo Apr 6, 2026
8bcea38
chore(ops): updated release check trigger
Zaiidmo Apr 6, 2026
f2b63a8
fix(ci): add rollup Linux native binaries as optionalDependencies
Zaiidmo Apr 6, 2026
10a708d
ops: updated release check strategy
Zaiidmo Apr 6, 2026
b1609d9
test(dtos): covering new code for sonar Gate
Zaiidmo Apr 6, 2026
0f77ab4
ops: Updated release check workflow-s trigger
Zaiidmo Apr 6, 2026
2231826
chore(tests): added more coverage to the dtos spec
Zaiidmo Apr 6, 2026
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
5 changes: 0 additions & 5 deletions .changeset/thick-maps-raise.md

This file was deleted.

1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @CISCODE-MA/devops
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:
echo "TAG_VERSION=$TAG" >> $GITHUB_ENV

- name: Setup Node.js
uses: actions/setup-node@v6
uses: actions/setup-node@v4
with:
node-version: "22"
registry-url: "https://registry.npmjs.org"
Expand Down
188 changes: 150 additions & 38 deletions .github/workflows/release-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,50 +3,43 @@ name: CI - Release Check
on:
pull_request:
branches: [master]
workflow_dispatch:
inputs:
sonar:
description: "Run SonarCloud analysis"
required: true
default: "false"
type: choice
options:
- "false"
- "true"

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

env:
SONAR_HOST_URL: "https://sonarcloud.io"
SONAR_ORGANIZATION: "ciscode"
SONAR_PROJECT_KEY: "CISCODE-MA_AuditKit"
NODE_VERSION: "22"

# ─── Job 1: Static checks (fast feedback, runs in parallel with test) ──────────
jobs:
ci:
name: release checks
quality:
name: Quality Checks
runs-on: ubuntu-latest
timeout-minutes: 25
timeout-minutes: 10

# Config stays in the workflow file (token stays in repo secrets)
env:
SONAR_HOST_URL: "https://sonarcloud.io"
SONAR_ORGANIZATION: "ciscode"
SONAR_PROJECT_KEY: "CISCODE-MA_AuditKit"
permissions:
contents: read

steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v6
uses: actions/setup-node@v4
with:
node-version: "22"
node-version: ${{ env.NODE_VERSION }}
cache: "npm"

- name: Install
run: npm ci

- name: Audit
run: npm audit --production
- name: Security Audit
# Only fail on high/critical — moderate noise in dev deps is expected
run: npm audit --production --audit-level=high

- name: Format
run: npm run format
Expand All @@ -57,30 +50,149 @@ jobs:
- name: Lint
run: npm run lint

# ─── Job 2: Tests + Coverage (artifact passed to Sonar) ────────────────────────
test:
name: Test & Coverage
runs-on: ubuntu-latest
timeout-minutes: 15

permissions:
contents: read

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: "npm"

- name: Install
run: npm ci

- name: Test (with coverage)
run: npm run test:cov

- name: Upload coverage report
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: coverage/
retention-days: 1

# ─── Job 3: Build ──────────────────────────────────────────────────────────────
build:
name: Build
runs-on: ubuntu-latest
needs: [quality, test]
timeout-minutes: 10

permissions:
contents: read

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: "npm"

- name: Install
run: npm ci

- name: Build
run: npm run build

# ─── Job 4: SonarCloud (depends on test for coverage data) ─────────────────────
sonar:
name: SonarCloud Analysis
runs-on: ubuntu-latest
needs: [test]
timeout-minutes: 15

permissions:
contents: read

steps:
- name: Checkout
uses: actions/checkout@v4
with:
# Full history required for accurate blame & new code detection
fetch-depth: 0

- name: Download coverage report
uses: actions/download-artifact@v4
with:
name: coverage-report
path: coverage/

- name: Cache SonarCloud packages
uses: actions/cache@v4
with:
path: ~/.sonar/cache
key: sonar-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: sonar-${{ runner.os }}-

- name: SonarCloud Scan
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.sonar == 'true' }}
uses: SonarSource/sonarqube-scan-action@v7
uses: SonarSource/sonarqube-scan-action@v6
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ env.SONAR_HOST_URL }}
with:
Comment on lines +111 to 146
Copy link

Copilot AI Apr 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The sonar job always runs on pull_request events but relies on secrets.SONAR_TOKEN. For PRs from forks, secrets are not available, so this job will fail and block CI. Add a guard (e.g., only run when secrets.SONAR_TOKEN is present / when github.event.pull_request.head.repo.fork == false) or move Sonar to push/workflow_dispatch only.

Copilot uses AI. Check for mistakes.
args: >
-Dsonar.organization=${{ env.SONAR_ORGANIZATION }} \
-Dsonar.projectKey=${{ env.SONAR_PROJECT_KEY }} \
-Dsonar.sources=src \
-Dsonar.tests=test \
-Dsonar.organization=${{ env.SONAR_ORGANIZATION }}
-Dsonar.projectKey=${{ env.SONAR_PROJECT_KEY }}
-Dsonar.sources=src
-Dsonar.tests=test
-Dsonar.test.inclusions=**/*.spec.ts,**/*.test.ts
-Dsonar.exclusions=**/node_modules/**,**/dist/**,**/coverage/**,**/*.d.ts
-Dsonar.coverage.exclusions=**/*.spec.ts,**/*.test.ts,**/index.ts
-Dsonar.javascript.lcov.reportPaths=coverage/lcov.info
-Dsonar.typescript.tsconfigPath=tsconfig.json
-Dsonar.qualitygate.wait=true
-Dsonar.qualitygate.timeout=300
Comment on lines +111 to +158
Copy link

Copilot AI Apr 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The sonar job runs on every pull_request and requires secrets.SONAR_TOKEN. For PRs from forks, secrets are not provided and this job will fail, blocking CI. Add a guard (e.g., only run when github.event.pull_request.head.repo.full_name == github.repository) or otherwise make Sonar optional for forked PRs.

Copilot uses AI. Check for mistakes.

- name: SonarCloud Quality Gate
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.sonar == 'true' }}
uses: SonarSource/sonarqube-quality-gate-action@v1
timeout-minutes: 10
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ env.SONAR_HOST_URL }}
# ─── Job 5: Final status report (always runs) ──────────────────────────────────
report:
name: Report CI Status
runs-on: ubuntu-latest
needs: [quality, test, build, sonar]
# Run even if upstream jobs failed
if: always()
timeout-minutes: 5

permissions:
contents: read
statuses: write

steps:
- name: Resolve overall result
id: result
run: |
results="${{ needs.quality.result }} ${{ needs.test.result }} ${{ needs.build.result }} ${{ needs.sonar.result }}"
if echo "$results" | grep -qE "failure|cancelled"; then
echo "state=failure" >> $GITHUB_OUTPUT
echo "desc=One or more CI checks failed" >> $GITHUB_OUTPUT
else
echo "state=success" >> $GITHUB_OUTPUT
echo "desc=All CI checks passed" >> $GITHUB_OUTPUT
fi

- name: Post commit status
uses: actions/github-script@v7
with:
script: |
await github.rest.repos.createCommitStatus({
owner: context.repo.owner,
repo: context.repo.repo,
sha: context.sha,
state: '${{ steps.result.outputs.state }}',
context: 'CI / Release Check',
description: '${{ steps.result.outputs.desc }}',
target_url: `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`
})
Comment on lines +160 to +198
Copy link

Copilot AI Apr 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The report job requests statuses: write and calls repos.createCommitStatus. On pull_request events (especially from forks), the workflow token may not have permission to write commit statuses, causing additional CI failures. Consider dropping this job (GitHub already reports job status) or gating it to trusted events (e.g., push to protected branches / non-fork PRs).

Copilot uses AI. Check for mistakes.
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# @ciscode/audit-kit

## 0.1.0
Copy link

Copilot AI Apr 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changelog version header (0.1.0) doesn’t match the package version (0.0.1 in package.json). Please update the changelog to reflect the version that will actually be published, otherwise release notes will be misleading.

Suggested change
## 0.1.0
## 0.0.1

Copilot uses AI. Check for mistakes.

### Minor Changes

- Initial feature release of @ciscode/audit-kit.
- Cursor-based (keyset) pagination via `queryWithCursor()`
Comment on lines +3 to +8
Copy link

Copilot AI Apr 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changelog version header (0.1.0) doesn’t match package.json (0.0.1). This will confuse consumers and can break the publish workflow/tag expectations. Align the changelog entry version with the package version (or bump the package version accordingly).

Copilot uses AI. Check for mistakes.
- OpenTelemetry-compatible observer hooks (`IAuditObserver`)
- Audit event streaming adapter (`IAuditEventPublisher`, `EventEmitterAuditEventPublisher`)
- PII redaction, idempotency, and retention policies
- Custom repository config (`type: "custom"`) — bring your own repository from a database package
- In-memory repository for testing
- Stryker mutation testing configuration
- Vitest performance benchmarks
- CI compatibility matrix (Ubuntu + Windows × Node 20 + 22)
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ It provides:
- Observability hooks (OpenTelemetry-friendly observer port)
- Event streaming hooks (publisher port + default EventEmitter adapter)

[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=CISCODE-MA_AuditKit&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=CISCODE-MA_AuditKit)
[![npm version](https://img.shields.io/npm/v/@ciscode/auditkit.svg)](https://www.npmjs.com/package/@ciscode/auditkit)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![TypeScript](https://img.shields.io/badge/TypeScript-5.7-blue)](https://www.typescriptlang.org/)

## Install

```bash
Expand Down
2 changes: 1 addition & 1 deletion eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// @ts-check
import eslint from "@eslint/js";
import globals from "globals";
import importPlugin from "eslint-plugin-import";
import importPlugin from "eslint-plugin-import-x";
import tseslint from "@typescript-eslint/eslint-plugin";
import tsparser from "@typescript-eslint/parser";

Expand Down
Loading
Loading