mirror of
https://github.com/johndoe6345789/metabuilder.git
synced 2026-04-24 22:04:56 +00:00
feat: add .actrc and .secrets.example files, enhance documentation, and implement pre-push git hook for workflow validation
This commit is contained in:
@@ -254,6 +254,7 @@ TODO: Links below use ../docs/... from docs/CONTRIBUTING.md and resolve to docs/
|
||||
|
||||
- **Architecture Questions**: See [docs/architecture/](../docs/architecture/)
|
||||
- **API Questions**: See [API Development Guide](../docs/guides/api-development.md)
|
||||
TODO: E2E tests guide lives under frontends/nextjs/e2e; update this link.
|
||||
- **Testing Questions**: See [E2E Tests Guide](../../e2e/README.md)
|
||||
- **Security Questions**: See [Security Guidelines](../docs/SECURITY.md)
|
||||
|
||||
|
||||
@@ -140,6 +140,7 @@ Build and compilation:
|
||||
|
||||
### 📁 Source Code Documentation
|
||||
Source code structure:
|
||||
TODO: docs/src/ is missing; add the folder or update/remove the src links below.
|
||||
- [src/README.md](./src/README.md) - Source overview
|
||||
- [src/components/](./src/components/) - Component docs
|
||||
- [src/lib/](./src/lib/) - Library docs
|
||||
|
||||
@@ -227,6 +227,8 @@ metabuilder/
|
||||
|
||||
### Directory Guide
|
||||
|
||||
TODO: src/README.md does not exist under docs/; confirm correct location or add missing docs/src.
|
||||
|
||||
- **src/** - See [src/README.md](./src/README.md)
|
||||
- **packages/** - See [packages/README.md](./packages/README.md)
|
||||
- **docs/** - See [docs/README.md](./docs/README.md)
|
||||
@@ -256,6 +258,7 @@ docker-compose -f deployment/docker-compose.production.yml up
|
||||
|
||||
### Manual Deployment
|
||||
|
||||
TODO: Manual deployment docs are not under docs/deployment; update this link to the correct location.
|
||||
See [deployment/README.md](./deployment/README.md) for detailed instructions.
|
||||
|
||||
## 🤝 Contributing
|
||||
|
||||
@@ -493,7 +493,9 @@ npm run db:reset && npm run seed
|
||||
|
||||
## Related Documentation
|
||||
|
||||
TODO: Development guide link should point to docs/guides/getting-started.md (current file does not exist).
|
||||
- [Development Guide](./getting-started.md)
|
||||
TODO: Component guidelines link points to a non-existent docs/components/README.md; update to correct location.
|
||||
- [Component Guidelines](../components/README.md)
|
||||
- [Database Architecture](./database.md)
|
||||
- [5-Level System](./5-level-system.md)
|
||||
|
||||
@@ -240,6 +240,7 @@ See `.github/workflows/` for configuration.
|
||||
|
||||
## 🔗 Related
|
||||
|
||||
TODO: E2E tests live under frontends/nextjs/e2e; update this link.
|
||||
- [E2E Tests Directory](../../e2e/README.md)
|
||||
- [Development Guide](../guides/api-development.md)
|
||||
- [Getting Started](../guides/getting-started.md)
|
||||
|
||||
@@ -324,6 +324,7 @@ webServer: {
|
||||
- [ESLint Documentation](https://eslint.org/)
|
||||
- [Playwright Documentation](https://playwright.dev/)
|
||||
- [GitHub Actions Documentation](https://docs.github.com/en/actions)
|
||||
TODO: Links below are repo-relative but this file is in docs/deployments; update paths for workflow README and E2E guide.
|
||||
- [Workflow README](.github/workflows/README.md)
|
||||
- [E2E Testing Guide](e2e/README.md)
|
||||
|
||||
|
||||
@@ -282,6 +282,7 @@ npm run dev
|
||||
DBAL_ADAPTER=memory # or 'http' for production
|
||||
DBAL_ENDPOINT=http://dbal-daemon:8080 # if using HTTP adapter
|
||||
|
||||
# TODO: deployment docs live under docs/deployments/; update this reference.
|
||||
# For C++ daemon (see deployment/README.md)
|
||||
DBAL_BIND_ADDRESS=0.0.0.0
|
||||
DBAL_PORT=8080
|
||||
@@ -387,6 +388,7 @@ The in-memory adapter stores data in browser memory:
|
||||
|
||||
## Related Documentation
|
||||
|
||||
TODO: Fix related doc links (deployments path and local implementation docs).
|
||||
- [C++ DBAL Documentation](../dbal/cpp/README.md)
|
||||
- [TypeScript DBAL Documentation](../dbal/ts/README.md)
|
||||
- [Docker Deployment](../deployment/README.md)
|
||||
@@ -403,4 +405,5 @@ For issues or questions:
|
||||
|
||||
## License
|
||||
|
||||
TODO: No LICENSE file exists at repo root; update to correct location (e.g., docs/LICENSE) or add one.
|
||||
See LICENSE file in project root.
|
||||
|
||||
@@ -80,6 +80,7 @@ mv PLATFORM_GUIDE.md docs/reference/platform-guide.md
|
||||
|
||||
## Files to Keep in Root
|
||||
|
||||
TODO: This repo does not have root README/PRD/SECURITY/LIMITED files as listed; update for current structure (docs/* locations).
|
||||
These files should remain in the project root:
|
||||
- `README.md` - Main project readme
|
||||
- `PRD.md` - Product Requirements Document
|
||||
@@ -88,6 +89,8 @@ These files should remain in the project root:
|
||||
|
||||
## Directory Structure After Move
|
||||
|
||||
TODO: Example path uses /workspaces/spark-template and root file list no longer matches this repo.
|
||||
|
||||
```
|
||||
/workspaces/spark-template/
|
||||
├── README.md (keep)
|
||||
|
||||
@@ -76,6 +76,7 @@ docs/
|
||||
|
||||
## Files That Remain in Root
|
||||
|
||||
TODO: This repo does not have root README/PRD/SECURITY as listed; update to current docs locations.
|
||||
The following files stay in the project root as they are primary project files:
|
||||
- `README.md` - Main project overview
|
||||
- `PRD.md` - Product Requirements Document
|
||||
|
||||
@@ -221,19 +221,14 @@ npm run act # Run all CI jobs
|
||||
|
||||
## Recommendations for Improvement
|
||||
|
||||
### 1. ⭐ **Create `.actrc` Configuration File**
|
||||
### 1. ✅ **`.actrc` Configuration File**
|
||||
|
||||
Add a `.actrc` file to the repository root for consistent configuration:
|
||||
`.actrc` is included in the repository root for consistent configuration:
|
||||
|
||||
```env
|
||||
# Use smaller Docker image for faster downloads
|
||||
-P ubuntu-latest=catthehacker/ubuntu:act-latest
|
||||
|
||||
# Set default event type
|
||||
--event-path=/dev/null
|
||||
|
||||
# Set container runtime memory limit
|
||||
--container-cap-add=SYS_PTRACE
|
||||
--env ACT=true
|
||||
-v
|
||||
```
|
||||
|
||||
**Benefit:** Users get consistent behavior without manual `-P` flags.
|
||||
@@ -254,19 +249,15 @@ To run GitHub Actions workflows locally before pushing:
|
||||
See [comprehensive guide](docs/guides/ACT_TESTING.md) for details.
|
||||
```
|
||||
|
||||
### 3. ⭐ **Add `.secrets` Template**
|
||||
### 3. ✅ **`.secrets` Template**
|
||||
|
||||
Create `.secrets.example` for secrets management:
|
||||
`.secrets.example` is included for local secrets management:
|
||||
|
||||
```env
|
||||
# GitHub token for workflow authentication
|
||||
GITHUB_TOKEN=ghp_your_token_here
|
||||
|
||||
# Add other secrets as needed
|
||||
DATABASE_URL=file:./dev.db
|
||||
```
|
||||
|
||||
Add `.secrets` to `.gitignore` for security.
|
||||
Copy to `.secrets` and keep it gitignored.
|
||||
|
||||
### 4. **GHA → NPM Script Mapping**
|
||||
|
||||
@@ -283,23 +274,27 @@ Consider adding:
|
||||
- `npm run act:prisma` → Database setup
|
||||
- `npm run act:all` → All checks (lint + build + tests)
|
||||
|
||||
### 5. **Pre-commit Hook** (Optional)
|
||||
### 5. ✅ **Pre-commit Hook** (Optional)
|
||||
|
||||
Add a git hook to run diagnostics before commits:
|
||||
Install the provided hook:
|
||||
|
||||
```bash
|
||||
#!/bin/bash
|
||||
# .git/hooks/pre-commit
|
||||
|
||||
echo "Running workflow diagnostics..."
|
||||
./scripts/diagnose-workflows.sh
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "⚠️ Workflow issues detected. Review above before committing."
|
||||
fi
|
||||
cp scripts/pre-commit.hook .git/hooks/pre-commit
|
||||
chmod +x .git/hooks/pre-commit
|
||||
```
|
||||
|
||||
### 6. **CI Documentation Update**
|
||||
### 6. ✅ **Pre-push Hook** (Optional)
|
||||
|
||||
Install the provided hook:
|
||||
|
||||
```bash
|
||||
cp scripts/pre-push.hook .git/hooks/pre-push
|
||||
chmod +x .git/hooks/pre-push
|
||||
```
|
||||
|
||||
Skip with `git push --no-verify` or `SKIP_ACT_PRE_PUSH=1` when needed.
|
||||
|
||||
### 7. **CI Documentation Update**
|
||||
|
||||
In `.github/workflows/README.md`, add section:
|
||||
|
||||
@@ -410,11 +405,9 @@ git push origin feature-branch
|
||||
| **Diagnostics** | ✅ Ready | 95% | Pre-flight validation working |
|
||||
| **Testing Tools** | ✅ Ready | 90% | Interactive menu available |
|
||||
| **Workflow Support** | ✅ Ready | 95% | 16 workflows configured |
|
||||
| **Secrets Management** | ⚠️ Partial | 70% | Manual `.secrets` file setup needed |
|
||||
| **`.actrc` Config** | ⚠️ Missing | 0% | Recommend creating |
|
||||
| **Git Hooks** | ⚠️ Missing | 0% | Optional enhancement |
|
||||
|
||||
TODO(SDLC): Provide a default `.actrc`, streamline local secrets setup, and document optional git hooks for pre-push checks.
|
||||
| **Secrets Management** | ✅ Ready | 90% | Template provided; `.secrets` stays local |
|
||||
| **`.actrc` Config** | ✅ Ready | 100% | Default config committed |
|
||||
| **Git Hooks** | ✅ Ready | 100% | Pre-commit + pre-push hooks available |
|
||||
|
||||
---
|
||||
|
||||
@@ -431,10 +424,8 @@ TODO(SDLC): Provide a default `.actrc`, streamline local secrets setup, and docu
|
||||
- Clear troubleshooting documentation
|
||||
|
||||
⚠️ **Areas for Enhancement:**
|
||||
- Add `.actrc` file for consistent Docker image selection
|
||||
- Create `.secrets.example` template
|
||||
- Add more npm script mappings (typecheck, prisma, build)
|
||||
- Optional: pre-commit git hooks for automated validation
|
||||
- Optional: install pre-commit/pre-push hooks for automated validation
|
||||
|
||||
💡 **Next Steps:**
|
||||
1. Install act: `brew install act` (or equivalent)
|
||||
|
||||
@@ -112,11 +112,11 @@ npm run act:all # Run full CI (alias for `npm run act`)
|
||||
- 💬 **Troubleshooting** (solutions for common issues)
|
||||
- 🎯 **Best practices** (workflow recommendations)
|
||||
|
||||
### 5. Optional Git Hook
|
||||
- ⛔ **Pre-commit validation** (catch issues early)
|
||||
- 💡 **Runs diagnostics** (no Docker needed)
|
||||
- ⏭️ **Skippable** (when needed)
|
||||
- 📋 **Setup:** `cp scripts/pre-commit.hook .git/hooks/pre-commit`
|
||||
### 5. Optional Git Hooks
|
||||
- ⛔ **Pre-commit validation** (diagnostics before commit)
|
||||
- 🚀 **Pre-push checks** (act lint before push)
|
||||
- ⏭️ **Skippable** (`git commit --no-verify`, `git push --no-verify`)
|
||||
- 📋 **Setup:** `cp scripts/pre-commit.hook .git/hooks/pre-commit` and `cp scripts/pre-push.hook .git/hooks/pre-push`
|
||||
|
||||
### 6. Secrets Management
|
||||
- 🔐 **Template provided** (`.secrets.example`)
|
||||
|
||||
@@ -374,6 +374,7 @@ grep -v "mock" stub-patterns.json
|
||||
|
||||
## References
|
||||
|
||||
TODO: Update reference links to correct repo-relative paths from docs/reference (stub-detection docs, workflows, scripts).
|
||||
- [Full Documentation](docs/stub-detection/README.md)
|
||||
- [Quick Reference](docs/stub-detection/QUICK_REFERENCE.md)
|
||||
- [Workflow Definition](.github/workflows/detect-stubs.yml)
|
||||
|
||||
@@ -146,6 +146,8 @@ gh workflow run detect-stubs.yml
|
||||
|
||||
## 📚 Documentation
|
||||
|
||||
TODO: doc links below should be relative to docs/reference (use ../stub-detection/...).
|
||||
|
||||
### Full Details
|
||||
- **[Complete Guide](docs/stub-detection/README.md)** - Everything explained
|
||||
- **[Quick Reference](docs/stub-detection/QUICK_REFERENCE.md)** - Patterns & fixes
|
||||
|
||||
@@ -227,6 +227,8 @@ Works with:
|
||||
|
||||
## 🎯 Next Steps
|
||||
|
||||
TODO: Stub-detection doc references below should be relative to docs/reference (use ../stub-detection/...).
|
||||
|
||||
1. **Try it now**: `npx tsx scripts/detect-stub-implementations.ts`
|
||||
2. **Review findings**: Check the JSON output
|
||||
3. **Read docs**: See `docs/stub-detection/README.md`
|
||||
|
||||
@@ -74,6 +74,7 @@ npx tsx scripts/detect-stub-implementations.ts | jq '.details[] | select(.file |
|
||||
## 📚 Documentation
|
||||
|
||||
### Full Guides
|
||||
TODO: Links below should be relative to docs/stub-detection (drop docs/ prefix).
|
||||
- [Complete Guide](docs/stub-detection/README.md) - 300+ lines covering everything
|
||||
- [Quick Reference](docs/stub-detection/QUICK_REFERENCE.md) - Key patterns and fixes
|
||||
|
||||
|
||||
@@ -11,6 +11,30 @@ export function generateScrambledPassword(length: number = 16): string {
|
||||
return password
|
||||
}
|
||||
|
||||
export function generateDeterministicScrambledPassword(seed: string, length: number = 16): string {
|
||||
const charset = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*'
|
||||
let hash = 0x811c9dc5
|
||||
|
||||
for (let i = 0; i < seed.length; i++) {
|
||||
hash ^= seed.charCodeAt(i)
|
||||
hash = Math.imul(hash, 0x01000193) >>> 0
|
||||
}
|
||||
|
||||
let state = hash || 1
|
||||
let password = ''
|
||||
|
||||
for (let i = 0; i < length; i++) {
|
||||
state = (state + 0x6d2b79f5) >>> 0
|
||||
let t = state
|
||||
t = Math.imul(t ^ (t >>> 15), t | 1)
|
||||
t ^= t + Math.imul(t ^ (t >>> 7), t | 61)
|
||||
const rand = ((t ^ (t >>> 14)) >>> 0) / 4294967296
|
||||
password += charset[Math.floor(rand * charset.length)]
|
||||
}
|
||||
|
||||
return password
|
||||
}
|
||||
|
||||
export async function simulateEmailSend(
|
||||
to: string,
|
||||
subject: string,
|
||||
|
||||
62
scripts/pre-push.hook
Normal file
62
scripts/pre-push.hook
Normal file
@@ -0,0 +1,62 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Pre-push git hook for MetaBuilder
|
||||
# Runs act checks before pushing
|
||||
# Install: cp scripts/pre-push.hook .git/hooks/pre-push && chmod +x .git/hooks/pre-push
|
||||
|
||||
set -e
|
||||
|
||||
# Colors for output
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
BLUE='\033[0;34m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
echo -e "${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
|
||||
echo -e "${GREEN}Pre-Push Workflow Validation${NC}"
|
||||
echo -e "${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
|
||||
echo ""
|
||||
|
||||
if [ -n "$SKIP_ACT_PRE_PUSH" ]; then
|
||||
echo "SKIP_ACT_PRE_PUSH set, skipping checks"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if ! command -v npm &> /dev/null; then
|
||||
echo "npm not found, skipping pre-push checks"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if ! command -v act &> /dev/null; then
|
||||
echo "act not installed, skipping pre-push checks"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if ! docker info &> /dev/null; then
|
||||
echo "Docker is not running, skipping pre-push checks"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ -f "scripts/diagnose-workflows.sh" ]; then
|
||||
chmod +x scripts/diagnose-workflows.sh
|
||||
if ! ./scripts/diagnose-workflows.sh; then
|
||||
echo ""
|
||||
echo -e "${YELLOW}⚠️ Workflow issues detected. Review above before pushing.${NC}"
|
||||
echo "To skip this check: git push --no-verify"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
echo -e "${YELLOW}Running act lint...${NC}"
|
||||
if ! npm run act:lint; then
|
||||
echo ""
|
||||
echo -e "${YELLOW}⚠️ act:lint failed. Fix issues before pushing.${NC}"
|
||||
echo "To skip this check: git push --no-verify"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo -e "${GREEN}✓ Pre-push checks passed!${NC}"
|
||||
echo ""
|
||||
|
||||
exit 0
|
||||
Reference in New Issue
Block a user