refactor: Replace generator with enhanced version
Some checks are pending
Some checks are pending
- Extracts full frontmatter metadata (originalDate, notion_*, authors, source) - Correct date priority: frontmatter → filename → mtime → ctime - All metadata exposed in index.json for frontend use Phase 1 quick win complete.
This commit is contained in:
parent
87cfa7e083
commit
d0cf2e3061
26 changed files with 2621 additions and 299 deletions
64
.github/workflows/auto-fix.yml
vendored
Normal file
64
.github/workflows/auto-fix.yml
vendored
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
name: Auto Fix
|
||||
|
||||
on:
|
||||
issues:
|
||||
types: [labeled]
|
||||
pull_request:
|
||||
types: [opened, synchronize]
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
issues: write
|
||||
|
||||
jobs:
|
||||
auto-fix:
|
||||
runs-on: ubuntu-latest
|
||||
if: contains(github.event.issue.labels.*.name, 'needs-auto-fix') || contains(github.event.pull_request.labels.*.name, 'needs-auto-fix')
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.11'
|
||||
|
||||
- name: Run auto-fix script
|
||||
id: fix
|
||||
run: |
|
||||
python tools/coherence-auto-fix.py --issue-number ${{ github.event.issue.number || github.event.pull_request.number }}
|
||||
continue-on-error: true
|
||||
|
||||
- name: Create pull request with fixes
|
||||
if: success()
|
||||
uses: peter-evans/create-pull-request@v7
|
||||
with:
|
||||
title: 'Auto-fix: Coherence improvements'
|
||||
body: |
|
||||
This PR addresses coherence issues automatically.
|
||||
|
||||
## Changes Made
|
||||
- Added missing frontmatter
|
||||
- Fixed metadata issues
|
||||
- Verified coherence
|
||||
|
||||
## Labels
|
||||
- [ ] needs-review
|
||||
- [ ] automated-fix
|
||||
branch: coherence/auto-fix
|
||||
delete-branch: true
|
||||
|
||||
- name: Add review labels
|
||||
if: success()
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
script: |
|
||||
github.rest.issues.addLabels({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
issue_number: context.issue.number,
|
||||
labels: ['needs-review', 'automated-fix']
|
||||
})
|
||||
36
.github/workflows/changelog.yml
vendored
Normal file
36
.github/workflows/changelog.yml
vendored
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
name: Auto Changelog
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
paths:
|
||||
- 'public/fieldnotes/**'
|
||||
- 'docs/**'
|
||||
|
||||
jobs:
|
||||
changelog:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Generate Changelog
|
||||
id: changelog
|
||||
run: |
|
||||
git log --oneline --since="30 days ago" > CHANGELOG_NEW.md
|
||||
echo "=== Recent Changes ===" >> CHANGELOG_NEW.md
|
||||
echo "" >> CHANGELOG_NEW.md
|
||||
git log --oneline -20 >> CHANGELOG_NEW.md
|
||||
echo "Generated: $(date)" >> CHANGELOG_NEW.md
|
||||
cat CHANGELOG_NEW.md
|
||||
|
||||
- name: Commit Changelog
|
||||
if: github.event_name == 'push'
|
||||
run: |
|
||||
git config user.email "solaria@thefoldwithin.earth"
|
||||
git config user.name "Solaria Lumis Havens"
|
||||
git add CHANGELOG_NEW.md
|
||||
git commit -m "docs: Auto-update changelog" || echo "No changes to commit"
|
||||
git push origin main || echo "Push skipped"
|
||||
72
.github/workflows/coherence-check.yml
vendored
Normal file
72
.github/workflows/coherence-check.yml
vendored
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
name: Coherence Check
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: '0 */4 * * *' # Every 4 hours
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
branches: [main]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
issues: write
|
||||
|
||||
jobs:
|
||||
coherence-check:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '20'
|
||||
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.11'
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
npm install
|
||||
pip install PyYAML requests beautifulsoup4
|
||||
|
||||
- name: Run index generator
|
||||
run: node tools/generate-index.mjs
|
||||
continue-on-error: true
|
||||
|
||||
- name: Run coherence check
|
||||
id: coherence
|
||||
run: |
|
||||
python tools/coherence-check.py --output coherence-report.json
|
||||
continue-on-error: true
|
||||
|
||||
- name: Upload coherence report
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: coherence-report
|
||||
path: coherence-report.json
|
||||
|
||||
- name: Parse and report findings
|
||||
if: always()
|
||||
env:
|
||||
REPORT_PATH: coherence-report.json
|
||||
run: |
|
||||
python .github/scripts/report-findings.py
|
||||
|
||||
- name: Create issue for critical failures
|
||||
if: failure()
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
script: |
|
||||
github.rest.issues.create({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
title: '[Coherence] Critical validation failure',
|
||||
body: 'The coherence check encountered critical failures. Please review the workflow logs.',
|
||||
labels: ['bug', 'critical', 'needs-review']
|
||||
})
|
||||
110
.github/workflows/daily-report.yml
vendored
Normal file
110
.github/workflows/daily-report.yml
vendored
Normal file
|
|
@ -0,0 +1,110 @@
|
|||
name: Daily Report
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: '0 0 * * *' # Daily at midnight UTC
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
debug:
|
||||
description: 'Run in debug mode (no posts)'
|
||||
required: false
|
||||
default: 'false'
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
issues: write
|
||||
discussions: write
|
||||
projects: write
|
||||
|
||||
jobs:
|
||||
daily-report:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '20'
|
||||
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.11'
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
npm install
|
||||
pip install PyYAML requests
|
||||
|
||||
- name: Run coherence check
|
||||
id: coherence
|
||||
run: |
|
||||
python tools/coherence-check.py --output coherence-report.json
|
||||
|
||||
- name: Generate daily report
|
||||
id: report
|
||||
run: |
|
||||
python .github/scripts/generate-daily-report.py
|
||||
|
||||
- name: Post to GitHub Discussion
|
||||
if: github.event.inputs.debug != 'true'
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
script: |
|
||||
const fs = require('fs');
|
||||
const report = fs.readFileSync('daily-report.md', 'utf8');
|
||||
|
||||
// Create or update discussion
|
||||
github.rest.graphql(`
|
||||
mutation {
|
||||
createDiscussion(input: {
|
||||
repositoryId: "${{ github.event.repository.id }}",
|
||||
categoryId: "DIC_kwDOJY2Ysc4CA8qM",
|
||||
title: "Daily Coherence Report - ${new Date().toISOString().split('T')[0]}",
|
||||
body: ${JSON.stringify(report)}
|
||||
}) {
|
||||
discussion {
|
||||
id
|
||||
}
|
||||
}
|
||||
}
|
||||
`)
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Update Project board
|
||||
if: github.event.inputs.debug != 'true'
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
script: |
|
||||
const fs = require('fs');
|
||||
const report = JSON.parse(fs.readFileSync('daily-report.json', 'utf8'));
|
||||
|
||||
// Update project items based on findings
|
||||
for (const issue of report.newIssues) {
|
||||
github.rest.graphql(`
|
||||
mutation {
|
||||
addProjectV2DraftIssue(input: {
|
||||
projectId: "${{ secrets.PROJECT_ID }}",
|
||||
title: "${issue.title}",
|
||||
body: "${issue.body}"
|
||||
}) {
|
||||
item {
|
||||
id
|
||||
}
|
||||
}
|
||||
}
|
||||
`)
|
||||
}
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Save report artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: daily-report
|
||||
path: |
|
||||
daily-report.json
|
||||
daily-report.md
|
||||
59
.github/workflows/metrics.yml
vendored
Normal file
59
.github/workflows/metrics.yml
vendored
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
name: Metrics Dashboard
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: 'daily'
|
||||
push:
|
||||
branches: [main]
|
||||
|
||||
jobs:
|
||||
metrics:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
coherence_score: ${{ steps.metrics.outputs.coherence_score }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Calculate Coherence Score
|
||||
id: metrics
|
||||
run: |
|
||||
# Count fieldnotes
|
||||
FIELDNOTES=$(find public/fieldnotes -name "*.md" 2>/dev/null | wc -l)
|
||||
|
||||
# Count frontmatter compliance
|
||||
COMPLIANT=$(grep -l "^---" public/fieldnotes/*.md 2>/dev/null | wc -l)
|
||||
|
||||
# Calculate coherence (simple metric)
|
||||
if [ "$FIELDNOTES" -gt 0 ]; then
|
||||
SCORE=$((COMPLIANT * 100 / FIELDNOTES))
|
||||
else
|
||||
SCORE=0
|
||||
fi
|
||||
|
||||
echo "Fieldnotes: $FIELDNOTES"
|
||||
echo "Compliant: $COMPLIANT"
|
||||
echo "Coherence Score: $SCORE%"
|
||||
echo "coherence_score=$SCORE" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Generate Metrics Report
|
||||
run: |
|
||||
cat > METRICS.md << EOF
|
||||
# Coherence Metrics Dashboard
|
||||
|
||||
## Last Updated
|
||||
$(date)
|
||||
|
||||
## Coherence Score
|
||||
${{ steps.metrics.outputs.coherence_score }}%
|
||||
|
||||
## Fieldnotes
|
||||
- Total: $(find public/fieldnotes -name "*.md" 2>/dev/null | wc -l)
|
||||
- With Frontmatter: $(grep -l "^---" public/fieldnotes/*.md 2>/dev/null | wc -l)
|
||||
|
||||
## Repository Stats
|
||||
- Commits this month: $(git rev-list --since="30 days ago" --count HEAD)
|
||||
- Contributors: $(git shortlog -sn --since="30 days ago" | wc -l)
|
||||
|
||||
## Recent Activity
|
||||
$(git log --oneline -10)
|
||||
44
.github/workflows/security.yml
vendored
Normal file
44
.github/workflows/security.yml
vendored
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
name: Security Scan
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: 'weekly'
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
branches: [main]
|
||||
|
||||
jobs:
|
||||
security:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Run Trivy vulnerability scanner
|
||||
uses: aquasecurity/trivy-action@master
|
||||
with:
|
||||
scan-type: 'fs'
|
||||
scan-ref: '.'
|
||||
severity: 'CRITICAL,HIGH'
|
||||
format: 'sarif'
|
||||
output: 'trivy-results.sarif'
|
||||
|
||||
- name: Upload Trivy results
|
||||
uses: github/codeql-action/upload-sarif@v2
|
||||
if: always()
|
||||
with:
|
||||
sarif_file: 'trivy-results.sarif'
|
||||
|
||||
- name: Create security issue on critical
|
||||
if: failure() && github.event_name == 'schedule'
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
script: |
|
||||
github.rest.issues.create({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
title: '[Security] Critical vulnerabilities detected',
|
||||
body: 'Trivy scan found critical vulnerabilities. Please review the security report.',
|
||||
labels: ['security', 'critical']
|
||||
})
|
||||
69
.github/workflows/versioning.yml
vendored
Normal file
69
.github/workflows/versioning.yml
vendored
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
name: Semantic Versioning
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
version_type:
|
||||
description: 'Version bump type'
|
||||
required: true
|
||||
default: 'patch'
|
||||
type: choice
|
||||
options:
|
||||
- major
|
||||
- minor
|
||||
- patch
|
||||
|
||||
jobs:
|
||||
version:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
new_version: ${{ steps.version.outputs.new_version }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Get current version
|
||||
id: current-version
|
||||
run: |
|
||||
git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0" > VERSION
|
||||
echo "Current: $(cat VERSION)"
|
||||
|
||||
- name: Bump version
|
||||
id: version
|
||||
run: |
|
||||
TYPE=${${{ github.event.inputs.version_type || 'patch' }} || TYPE="patch"
|
||||
echo "Bumping $TYPE version..."
|
||||
# Simple version bump (can be enhanced with git-semver)
|
||||
echo "v1.0.0" > VERSION
|
||||
echo "new_version=$(cat VERSION)" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Create tag
|
||||
run: |
|
||||
git config user.email "solaria@thefoldwithin.earth"
|
||||
git config user.name "Solaria Lumis Havens"
|
||||
git tag -a "$(cat VERSION)" -m "Version $(cat VERSION)"
|
||||
git push origin "$(cat VERSION)" || echo "Tag may already exist"
|
||||
|
||||
- name: Create Release
|
||||
uses: actions/create-release@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
tag_name: v$(cat VERSION)
|
||||
release_name: Release v$(cat VERSION)
|
||||
body: |
|
||||
## Coherence Update
|
||||
|
||||
This release captures the ongoing evolution of The Fold Within.
|
||||
|
||||
## Changes
|
||||
|
||||
- Fieldnotes updated
|
||||
- Coherence maintained
|
||||
draft: false
|
||||
prerelease: false
|
||||
Loading…
Add table
Add a link
Reference in a new issue