chore(agent): configure AI agents and tools

Add configuration for BMad, Claude, OpenCode, and other AI agent tools and workflows.
This commit is contained in:
2026-02-11 11:51:23 +08:00
parent 9c2181f743
commit ad8e2e313e
977 changed files with 157625 additions and 0 deletions

View File

@@ -0,0 +1,40 @@
// Hybrid rendering configuration - Recommended for most projects
// Static pages by default, SSR where needed with `export const prerender = false`
import { defineConfig } from 'astro/config';
import cloudflare from '@astrojs/cloudflare';
export default defineConfig({
output: 'hybrid',
adapter: cloudflare({
// Mode: 'directory' (default) = separate function per route
// 'standalone' = single worker for all routes
mode: 'directory',
// Image service: 'passthrough' (default) or 'compile'
imageService: 'passthrough',
// Platform proxy for local development with Cloudflare bindings
platformProxy: {
enabled: true,
configPath: './wrangler.jsonc',
},
}),
// Optional: Add integrations
// integrations: [
// tailwind(),
// react(),
// sitemap(),
// ],
vite: {
build: {
chunkSizeWarningLimit: 1000,
},
},
});
// Usage: Add to pages that need SSR:
// export const prerender = false;

View File

@@ -0,0 +1,35 @@
// Full SSR configuration - All routes server-rendered
// Use this for web apps with authentication, dynamic content on all pages
import { defineConfig } from 'astro/config';
import cloudflare from '@astrojs/cloudflare';
export default defineConfig({
output: 'server',
adapter: cloudflare({
mode: 'directory',
imageService: 'passthrough',
platformProxy: {
enabled: true,
configPath: './wrangler.jsonc',
},
}),
// Optional: Add integrations
// integrations: [
// tailwind(),
// react(),
// viewTransitions(),
// ],
vite: {
build: {
chunkSizeWarningLimit: 1000,
},
},
});
// All pages are server-rendered by default.
// Access Cloudflare bindings with:
// const env = Astro.locals.runtime.env;

View File

@@ -0,0 +1,22 @@
// Static site configuration - No adapter needed
// Use this for purely static sites (blogs, marketing sites, documentation)
import { defineConfig } from 'astro/config';
export default defineConfig({
output: 'static',
// Optional: Add integrations
// integrations: [
// tailwind(),
// sitemap(),
// ],
// Vite configuration
vite: {
build: {
// Adjust chunk size warning limit
chunkSizeWarningLimit: 1000,
},
},
});

View File

@@ -0,0 +1,26 @@
# .dev.vars - Local development secrets
# Copy this file to .dev.vars and fill in your values
# IMPORTANT: Add .dev.vars to .gitignore!
# Cloudflare Account
CLOUDFLARE_ACCOUNT_ID=your-account-id-here
# API Keys
API_KEY=your-local-api-key
API_SECRET=your-local-api-secret
# Database URLs
DATABASE_URL=postgresql://localhost:5432/mydb
REDIS_URL=redis://localhost:6379
# Third-party Services
STRIPE_SECRET_KEY=sk_test_your_key
SENDGRID_API_KEY=your_sendgrid_key
# OAuth (if using authentication)
GITHUB_CLIENT_ID=your_github_client_id
GITHUB_CLIENT_SECRET=your_github_client_secret
# Feature Flags
ENABLE_ANALYTICS=false
ENABLE_BETA_FEATURES=true

View File

@@ -0,0 +1,40 @@
/// <reference path="../.astro/types.d.ts" />
// TypeScript type definitions for Cloudflare bindings
// Update this file with your actual binding names
interface Env {
// Environment Variables (from wrangler.jsonc vars section)
ENVIRONMENT: string;
PUBLIC_SITE_URL: string;
API_URL?: string;
// Cloudflare Bindings (configure in wrangler.jsonc)
CACHE?: KVNamespace;
DB?: D1Database;
STORAGE?: R2Bucket;
// Add your custom bindings here
// MY_KV_NAMESPACE: KVNamespace;
// MY_D1_DATABASE: D1Database;
// MY_R2_BUCKET: R2Bucket;
// Sensitive secrets (use wrangler secret put)
API_KEY?: string;
DATABASE_URL?: string;
}
// Runtime type for Astro
type Runtime = import('@astrojs/cloudflare').Runtime<Env>;
// Extend Astro's interfaces
declare namespace App {
interface Locals extends Runtime {}
}
declare namespace Astro {
interface Locals extends Runtime {}
}
// For API endpoints
export type { Env, Runtime };

View File

@@ -0,0 +1,94 @@
name: Deploy to Cloudflare Workers
on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
name: Build and Deploy
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Install Wrangler
run: npm install -g wrangler@latest
- name: Build Astro
run: npm run build
env:
# Build-time environment variables
NODE_ENV: production
- name: Deploy to Cloudflare Workers
run: wrangler deploy
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
deploy-staging:
runs-on: ubuntu-latest
name: Deploy to Staging
if: github.ref == 'refs/heads/staging'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Install Wrangler
run: npm install -g wrangler@latest
- name: Build Astro
run: npm run build
- name: Deploy to Staging
run: wrangler deploy --env staging
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
# Optional: Run tests before deployment
test:
runs-on: ubuntu-latest
name: Run Tests
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Run tests
run: npm test

View File

@@ -0,0 +1,52 @@
{
"$schema": "./node_modules/wrangler/config-schema.json",
"// Comment": "Hybrid rendering configuration for Astro on Cloudflare Workers",
"name": "your-app-name",
"compatibility_date": "2025-01-19",
"compatibility_flags": ["nodejs_compat"],
"assets": {
"directory": "./dist",
"binding": "ASSETS"
},
"vars": {
"ENVIRONMENT": "production",
"PUBLIC_SITE_URL": "https://your-app-name.workers.dev"
},
"// Comment env": "Environment-specific configurations",
"env": {
"staging": {
"name": "your-app-name-staging",
"vars": {
"ENVIRONMENT": "staging",
"PUBLIC_SITE_URL": "https://staging-your-app-name.workers.dev"
}
},
"production": {
"name": "your-app-name-production",
"vars": {
"ENVIRONMENT": "production",
"PUBLIC_SITE_URL": "https://your-app-name.workers.dev"
}
}
},
"// Comment bindings_examples": "Uncomment and configure as needed",
"// kv_namespaces": [
// {
// "binding": "MY_KV",
// "id": "your-kv-namespace-id"
// }
// ],
"// d1_databases": [
// {
// "binding": "DB",
// "database_name": "my-database",
// "database_id": "your-d1-database-id"
// }
// ],
"// r2_buckets": [
// {
// "binding": "BUCKET",
// "bucket_name": "my-bucket"
// }
// ]
}

View File

@@ -0,0 +1,54 @@
{
"$schema": "./node_modules/wrangler/config-schema.json",
"// Comment": "Full SSR configuration for Astro on Cloudflare Workers",
"name": "your-app-name",
"compatibility_date": "2025-01-19",
"compatibility_flags": ["nodejs_compat", "disable_nodejs_process_v2"],
"assets": {
"directory": "./dist",
"binding": "ASSETS"
},
"vars": {
"ENVIRONMENT": "production",
"PUBLIC_SITE_URL": "https://your-app-name.workers.dev",
"API_URL": "https://api.example.com"
},
"env": {
"staging": {
"name": "your-app-name-staging",
"vars": {
"ENVIRONMENT": "staging",
"PUBLIC_SITE_URL": "https://staging-your-app-name.workers.dev",
"API_URL": "https://staging-api.example.com"
}
},
"production": {
"name": "your-app-name-production",
"vars": {
"ENVIRONMENT": "production",
"PUBLIC_SITE_URL": "https://your-app-name.workers.dev",
"API_URL": "https://api.example.com"
}
}
},
"// Comment bindings": "Configure Cloudflare bindings for your SSR app",
"kv_namespaces": [
{
"binding": "CACHE",
"id": "your-kv-namespace-id"
}
],
"d1_databases": [
{
"binding": "DB",
"database_name": "my-database",
"database_id": "your-d1-database-id"
}
],
"r2_buckets": [
{
"binding": "STORAGE",
"bucket_name": "my-storage-bucket"
}
]
}

View File

@@ -0,0 +1,20 @@
{
"$schema": "./node_modules/wrangler/config-schema.json",
"// Comment": "Static site deployment configuration for Astro on Cloudflare Workers",
"name": "your-app-name",
"compatibility_date": "2025-01-19",
"// Comment assets": "Static assets configuration",
"assets": {
"directory": "./dist",
"binding": "ASSETS",
"// Comment html_handling": "Options: none, force-trailing-slash, strip-trailing-slash",
"html_handling": "none",
"// Comment not_found_handling": "Options: none, 404-page, spa-fallback",
"not_found_handling": "none"
},
"// Comment vars": "Non-sensitive environment variables",
"vars": {
"ENVIRONMENT": "production",
"PUBLIC_SITE_URL": "https://your-app-name.workers.dev"
}
}