feat: add configuration files and scripts for project setup

🚀 Breaking Changes:
- Introduced new environment variables for GitLab API integration
- Added validation script for PR checks
- Updated package.json with new scripts for testing and formatting

📝 Details:
- Added .prettierrc and .eslintrc.json for code formatting and linting
- Created .env.example for environment variable setup
- Updated CHANGELOG.md with recent changes
- Added documentation for GitHub secrets setup
This commit is contained in:
simple
2025-05-29 23:24:46 +09:00
parent 181f1e943c
commit 5b35bc163c
19 changed files with 2740 additions and 762 deletions

View File

@ -1,22 +1,22 @@
import fs from 'fs';
import path from 'path';
import { fileURLToPath } from 'url';
import fs from "fs";
import path from "path";
import { fileURLToPath } from "url";
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
async function main() {
const repoRoot = path.resolve(__dirname, '..');
const indexPath = path.join(repoRoot, 'index.ts');
const readmePath = path.join(repoRoot, 'README.md');
const repoRoot = path.resolve(__dirname, "..");
const indexPath = path.join(repoRoot, "index.ts");
const readmePath = path.join(repoRoot, "README.md");
// 1. Read index.ts
const code = fs.readFileSync(indexPath, 'utf-8');
const code = fs.readFileSync(indexPath, "utf-8");
// 2. Extract allTools array block
const match = code.match(/const allTools = \[([\s\S]*?)\];/);
if (!match) {
console.error('Unable to locate allTools array in index.ts');
console.error("Unable to locate allTools array in index.ts");
process.exit(1);
}
const toolsBlock = match[1];
@ -33,21 +33,21 @@ async function main() {
const lines = tools.map((tool, index) => {
return `${index + 1}. \`${tool.name}\` - ${tool.description}`;
});
const markdown = lines.join('\n');
const markdown = lines.join("\n");
// 5. Read README.md and replace between markers
const readme = fs.readFileSync(readmePath, 'utf-8');
const readme = fs.readFileSync(readmePath, "utf-8");
const updated = readme.replace(
/<!-- TOOLS-START -->([\s\S]*?)<!-- TOOLS-END -->/,
`<!-- TOOLS-START -->\n${markdown}\n<!-- TOOLS-END -->`
);
// 6. Write back
fs.writeFileSync(readmePath, updated, 'utf-8');
console.log('README.md tools section updated.');
fs.writeFileSync(readmePath, updated, "utf-8");
console.log("README.md tools section updated.");
}
main().catch(err => {
console.error(err);
process.exit(1);
});
});

56
scripts/validate-pr.sh Executable file
View File

@ -0,0 +1,56 @@
#!/bin/bash
# PR Validation Script
# This script runs all necessary checks before merging a PR
set -e
echo "🔍 Starting PR validation..."
# Check if Node.js is installed
if ! command -v node &> /dev/null; then
echo "❌ Node.js is not installed"
exit 1
fi
echo "📦 Installing dependencies..."
npm ci
echo "🔨 Building project..."
npm run build
echo "🧪 Running unit tests..."
npm run test:unit
echo "✨ Checking code formatting..."
npm run format:check || {
echo "⚠️ Code formatting issues found. Run 'npm run format' to fix."
exit 1
}
echo "🔍 Running linter..."
npm run lint || {
echo "⚠️ Linting issues found. Run 'npm run lint:fix' to fix."
exit 1
}
echo "📊 Running tests with coverage..."
npm run test:coverage
# Check if integration tests should run
if [ -n "$GITLAB_TOKEN" ] && [ -n "$TEST_PROJECT_ID" ]; then
echo "🌐 Running integration tests..."
npm run test:integration
else
echo "⚠️ Skipping integration tests (no credentials provided)"
fi
echo "🐳 Testing Docker build..."
if command -v docker &> /dev/null; then
docker build -t mcp-gitlab-test .
echo "✅ Docker build successful"
else
echo "⚠️ Docker not available, skipping Docker build test"
fi
echo "✅ All PR validation checks passed!"