Skip to content
Open
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
36 changes: 36 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
module.exports = {
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 2020,
sourceType: 'module',
project: './tsconfig.json',
},
plugins: ['@typescript-eslint', 'prettier'],
extends: [
'eslint:recommended',
'@typescript-eslint/recommended',
'prettier',
'plugin:prettier/recommended',
],
rules: {
// Prettier rules
'prettier/prettier': 'error',

// TypeScript specific rules
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-non-null-assertion': 'warn',

// General rules
'no-console': 'off', // CLI tool needs console output
'no-process-exit': 'off', // CLI tool needs process.exit
},
env: {
node: true,
es6: true,
jest: true,
},
ignorePatterns: ['dist/', 'node_modules/', '*.js'],
};
117 changes: 117 additions & 0 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
name: CI/CD Pipeline

on:
push:
branches: [main, dev]
pull_request:
branches: [main, dev]

jobs:
build-and-test:
name: Build, Lint, and Test
runs-on: ubuntu-latest

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

- name: Use Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Run linting and formatting checks
run: |
echo "🔍 Running ESLint..."
npm run lint
echo "🎨 Checking Prettier formatting..."
npm run format:check

- name: Run TypeScript type checking
run: |
echo "🔧 Running TypeScript type check..."
npm run type-check

- name: Build CLI
run: npm run build

- name: Check integration test credentials
env:
AGILITY_GUID: ${{ secrets.AGILITY_GUID }}
AGILITY_TOKEN: ${{ secrets.AGILITY_TOKEN }}
run: |
if [ -z "$AGILITY_GUID" ] || [ -z "$AGILITY_TOKEN" ]; then
echo "❌ Integration tests require AGILITY_GUID and AGILITY_TOKEN secrets"
echo "📝 Please configure these secrets in your GitHub repository settings"
echo "💡 These tests use PAT authentication only - no Auth0 flow in CI/CD"
echo "⚠️ Skipping integration tests due to missing credentials"
exit 0
fi
echo "✅ Integration test credentials are configured"

- name: Run integration tests
env:
CI: true
AGILITY_GUID: ${{ secrets.AGILITY_GUID }}
AGILITY_TOKEN: ${{ secrets.AGILITY_TOKEN }}
AGILITY_WEBSITE: ${{ secrets.AGILITY_WEBSITE || 'website' }}
AGILITY_LOCALES: ${{ secrets.AGILITY_LOCALES || 'en-us' }}
TEST_VERBOSE: true
run: |
if [ -n "$AGILITY_GUID" ] && [ -n "$AGILITY_TOKEN" ]; then
echo "🚀 Running essential integration tests with PAT authentication..."
# Run basic tests for CI/CD (fast and lightweight)
npm test
else
echo "⏭️ Skipping integration tests: credentials not configured"
fi

- name: Upload test results
uses: actions/upload-artifact@v4
if: always()
with:
name: test-results
path: |
coverage/
test-results.xml
retention-days: 7

security-audit:
name: Security Audit
runs-on: ubuntu-latest

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

- name: Use Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Run security audit (moderate)
run: |
echo "🔍 Running security audit for moderate+ vulnerabilities..."
npm audit --audit-level=moderate
continue-on-error: true

- name: Check for high-severity vulnerabilities
run: |
echo "🛡️ Checking for high-severity vulnerabilities..."
# Run npm audit and capture the exit code
if npm audit --audit-level=high >/dev/null 2>&1; then
echo "✅ No high-severity vulnerabilities found"
else
echo "❌ High-severity vulnerabilities detected"
echo "📋 Full audit report:"
npm audit --audit-level=high
exit 1
fi
14 changes: 14 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

echo "🚀 Running pre-commit checks..."

# Run lint-staged to check and fix staged files
echo "🎨 Formatting and linting staged files..."
npx lint-staged

# Run type checking to catch TypeScript errors
echo "🔍 Running TypeScript type check..."
npm run type-check

echo "✅ Pre-commit checks passed!"
22 changes: 22 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Build outputs
dist/
node_modules/
coverage/

# Generated files
*.d.ts
*.js.map

# Test artifacts
agility-files/
test-agility-files/

# Logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Package files
package-lock.json
yarn.lock
11 changes: 9 additions & 2 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
{
"printWidth": 120
}
"semi": true,
"trailingComma": "es5",
"singleQuote": true,
"printWidth": 100,
"tabWidth": 2,
"useTabs": false,
"bracketSpacing": true,
"arrowParens": "always"
}
7 changes: 7 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"recommendations": [
"esbenp.prettier-vscode",
"dbaeumer.vscode-eslint",
"ms-vscode.vscode-typescript-next"
]
}
21 changes: 21 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
},
"[typescript]": {
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[javascript]": {
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[json]": {
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"eslint.workingDirectories": ["./"],
"typescript.preferences.importModuleSpecifier": "relative"
}
Loading
Loading