Skip to content

Commit a570388

Browse files
authored
Merge pull request #2 from OGMatrix/dev
Sync to init
2 parents fe48165 + bad07df commit a570388

52 files changed

Lines changed: 25492 additions & 1 deletion

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.commitlintrc.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"extends": ["@commitlint/config-conventional"],
3+
"rules": {
4+
"type-enum": [
5+
2,
6+
"always",
7+
[
8+
"feat",
9+
"fix",
10+
"docs",
11+
"style",
12+
"refactor",
13+
"perf",
14+
"test",
15+
"build",
16+
"ci",
17+
"chore",
18+
"revert"
19+
]
20+
],
21+
"subject-case": [2, "never", ["upper-case"]],
22+
"header-max-length": [2, "always", 100]
23+
}
24+
}

.editorconfig

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# EditorConfig is awesome: https://EditorConfig.org
2+
3+
root = true
4+
5+
[*]
6+
charset = utf-8
7+
end_of_line = lf
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true
10+
11+
[*.{js,ts,json,yml,yaml}]
12+
indent_style = space
13+
indent_size = 2
14+
15+
[*.md]
16+
trim_trailing_whitespace = false
17+
max_line_length = off
18+
19+
[Makefile]
20+
indent_style = tab

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
* text=auto eol=lf
2+
*.bat text eol=crlf

.github/workflows/ci.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [dev, prod]
6+
pull_request:
7+
branches: [dev, prod]
8+
9+
jobs:
10+
test:
11+
name: Test
12+
runs-on: ${{ matrix.os }}
13+
strategy:
14+
matrix:
15+
os: [ubuntu-latest, windows-latest, macos-latest]
16+
node-version: [20.x, 22.x]
17+
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@v4
21+
22+
- name: Setup Node.js ${{ matrix.node-version }}
23+
uses: actions/setup-node@v4
24+
with:
25+
node-version: ${{ matrix.node-version }}
26+
cache: 'npm'
27+
28+
- name: Install dependencies
29+
run: npm ci
30+
31+
- name: Run type checking
32+
run: npm run typecheck
33+
34+
- name: Run linter
35+
run: npm run lint
36+
37+
- name: Run tests
38+
run: npm run test:coverage
39+
40+
- name: Upload coverage to Codecov
41+
if: matrix.os == 'ubuntu-latest' && matrix.node-version == '20.x'
42+
uses: codecov/codecov-action@v4
43+
with:
44+
files: ./coverage/lcov.info
45+
flags: unittests
46+
name: codecov-umbrella
47+
48+
build:
49+
name: Build
50+
runs-on: ubuntu-latest
51+
needs: test
52+
53+
steps:
54+
- name: Checkout code
55+
uses: actions/checkout@v4
56+
57+
- name: Setup Node.js
58+
uses: actions/setup-node@v4
59+
with:
60+
node-version: '20.x'
61+
cache: 'npm'
62+
63+
- name: Install dependencies
64+
run: npm ci
65+
66+
- name: Build project
67+
run: npm run build
68+
69+
- name: Upload build artifacts
70+
uses: actions/upload-artifact@v4
71+
with:
72+
name: dist
73+
path: dist/
74+
retention-days: 7

.github/workflows/codeql.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: 'CodeQL'
2+
3+
on:
4+
push:
5+
branches: [dev, prod]
6+
pull_request:
7+
branches: [dev, prod]
8+
schedule:
9+
- cron: '0 0 * * 1'
10+
11+
jobs:
12+
analyze:
13+
name: Analyze
14+
runs-on: ubuntu-latest
15+
permissions:
16+
actions: read
17+
contents: read
18+
security-events: write
19+
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
language: ['javascript']
24+
25+
steps:
26+
- name: Checkout repository
27+
uses: actions/checkout@v4
28+
29+
- name: Initialize CodeQL
30+
uses: github/codeql-action/init@v3
31+
with:
32+
languages: ${{ matrix.language }}
33+
34+
- name: Autobuild
35+
uses: github/codeql-action/autobuild@v3
36+
37+
- name: Perform CodeQL Analysis
38+
uses: github/codeql-action/analyze@v3
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Dependency Review
2+
3+
on:
4+
pull_request:
5+
branches: [dev, prod]
6+
7+
permissions:
8+
contents: read
9+
10+
jobs:
11+
dependency-review:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v4
16+
17+
- name: Dependency Review
18+
uses: actions/dependency-review-action@v4
19+
with:
20+
fail-on-severity: moderate
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Release Please
2+
3+
on:
4+
push:
5+
branches:
6+
- dev
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: write
11+
pull-requests: write
12+
id-token: write
13+
14+
jobs:
15+
release-please:
16+
name: Create/Update Release PR
17+
runs-on: ubuntu-latest
18+
19+
outputs:
20+
release_created: ${{ steps.release.outputs.release_created }}
21+
tag_name: ${{ steps.release.outputs.tag_name }}
22+
version: ${{ steps.release.outputs.version }}
23+
major: ${{ steps.release.outputs.major }}
24+
minor: ${{ steps.release.outputs.minor }}
25+
patch: ${{ steps.release.outputs.patch }}
26+
pr: ${{ steps.release.outputs.pr }}
27+
28+
steps:
29+
- name: Checkout
30+
uses: actions/checkout@v4
31+
with:
32+
fetch-depth: 0
33+
34+
- name: Run release-please
35+
id: release
36+
uses: googleapis/release-please-action@v4
37+
with:
38+
token: ${{ secrets.GITHUB_TOKEN }}
39+
config-file: release-please-config.json
40+
manifest-file: .release-please-manifest.json
41+
target-branch: prod
42+
43+
- name: Log release-please output
44+
run: |
45+
echo "## Release Please Output" >> $GITHUB_STEP_SUMMARY
46+
echo "" >> $GITHUB_STEP_SUMMARY
47+
if [[ "${{ steps.release.outputs.pr }}" != "" ]]; then
48+
echo "📋 **PR Created/Updated:** #${{ steps.release.outputs.pr }}" >> $GITHUB_STEP_SUMMARY
49+
fi
50+
if [[ "${{ steps.release.outputs.release_created }}" == "true" ]]; then
51+
echo "🎉 **Release Created:** v${{ steps.release.outputs.version }}" >> $GITHUB_STEP_SUMMARY
52+
echo "🏷️ **Tag:** ${{ steps.release.outputs.tag_name }}" >> $GITHUB_STEP_SUMMARY
53+
else
54+
echo "ℹ️ No release created (PR pending merge to prod)" >> $GITHUB_STEP_SUMMARY
55+
fi

.github/workflows/release.yml

Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
name: Release
2+
3+
on:
4+
# Triggers when release-please creates a release
5+
release:
6+
types: [published]
7+
8+
# Allow manual trigger for emergency releases
9+
workflow_dispatch:
10+
inputs:
11+
skip_npm:
12+
description: 'Skip npm publish'
13+
required: false
14+
default: false
15+
type: boolean
16+
17+
permissions:
18+
contents: write
19+
issues: write
20+
pull-requests: write
21+
id-token: write
22+
23+
jobs:
24+
publish:
25+
name: Build & Publish
26+
runs-on: ubuntu-latest
27+
if: github.event_name == 'release' || github.event_name == 'workflow_dispatch'
28+
29+
steps:
30+
- name: Checkout code
31+
uses: actions/checkout@v4
32+
with:
33+
fetch-depth: 0
34+
ref: prod
35+
36+
- name: Setup Node.js
37+
uses: actions/setup-node@v4
38+
with:
39+
node-version: '20.x'
40+
registry-url: 'https://registry.npmjs.org'
41+
cache: 'npm'
42+
43+
- name: Configure Git
44+
run: |
45+
git config user.name "github-actions[bot]"
46+
git config user.email "github-actions[bot]@users.noreply.github.com"
47+
48+
- name: Install dependencies
49+
run: npm ci
50+
51+
- name: Run validation
52+
run: npm run validate
53+
54+
- name: Build production with fresh docs
55+
run: npm run build:prod
56+
env:
57+
NODE_OPTIONS: --max-old-space-size=6144
58+
59+
- name: Generate database manifest
60+
run: |
61+
VERSION=$(node -p "require('./package.json').version")
62+
echo "📋 Generating manifest for version $VERSION"
63+
npm run db:manifest -- --version "$VERSION" --type full --changelog "Full documentation index update for v$VERSION"
64+
65+
- name: Publish to npm
66+
if: ${{ github.event.inputs.skip_npm != 'true' }}
67+
run: npm publish --provenance --access public
68+
69+
- name: Prepare database release artifacts
70+
run: |
71+
VERSION=$(node -p "require('./package.json').version")
72+
mkdir -p release-artifacts
73+
cp data/mcmodding-docs.db release-artifacts/
74+
cp data/manifest.json release-artifacts/db-manifest.json
75+
echo "📦 Release artifacts:"
76+
ls -lh release-artifacts/
77+
78+
- name: Upload database to release
79+
uses: softprops/action-gh-release@v1
80+
with:
81+
tag_name: ${{ github.event.release.tag_name || format('v{0}', env.VERSION) }}
82+
files: |
83+
release-artifacts/mcmodding-docs.db
84+
release-artifacts/db-manifest.json
85+
append_body: true
86+
body: |
87+
88+
---
89+
90+
## 🗄️ Database Release
91+
92+
| File | Description |
93+
|------|-------------|
94+
| `mcmodding-docs.db` | Complete documentation index with semantic embeddings |
95+
| `db-manifest.json` | Version manifest with SHA256 hash verification |
96+
97+
**Auto-Update:** The MCP will automatically detect and download this version on next startup.
98+
99+
env:
100+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
101+
VERSION: ${{ github.event.release.tag_name }}
102+
103+
- name: Log release summary
104+
run: |
105+
VERSION=$(node -p "require('./package.json').version")
106+
echo "## 🎉 Release Published Successfully!" >> $GITHUB_STEP_SUMMARY
107+
echo "" >> $GITHUB_STEP_SUMMARY
108+
echo "| Component | Status |" >> $GITHUB_STEP_SUMMARY
109+
echo "|-----------|--------|" >> $GITHUB_STEP_SUMMARY
110+
echo "| Version | \`v$VERSION\` |" >> $GITHUB_STEP_SUMMARY
111+
echo "| npm | ✅ Published |" >> $GITHUB_STEP_SUMMARY
112+
echo "| GitHub Release | ✅ Created |" >> $GITHUB_STEP_SUMMARY
113+
echo "| Database | ✅ Uploaded |" >> $GITHUB_STEP_SUMMARY
114+
echo "" >> $GITHUB_STEP_SUMMARY
115+
echo "### 📦 Artifacts" >> $GITHUB_STEP_SUMMARY
116+
echo "- \`mcmodding-docs.db\` - Documentation index" >> $GITHUB_STEP_SUMMARY
117+
echo "- \`db-manifest.json\` - Version manifest" >> $GITHUB_STEP_SUMMARY
118+
119+
# Sync prod back to dev after release
120+
sync-to-dev:
121+
name: Sync to Dev
122+
runs-on: ubuntu-latest
123+
needs: publish
124+
if: success()
125+
126+
steps:
127+
- name: Checkout
128+
uses: actions/checkout@v4
129+
with:
130+
fetch-depth: 0
131+
ref: prod
132+
133+
- name: Configure Git
134+
run: |
135+
git config user.name "github-actions[bot]"
136+
git config user.email "github-actions[bot]@users.noreply.github.com"
137+
138+
- name: Create sync PR to dev
139+
uses: peter-evans/create-pull-request@v5
140+
with:
141+
token: ${{ secrets.GITHUB_TOKEN }}
142+
commit-message: 'chore: sync prod to dev after release'
143+
title: 'chore: sync release changes back to dev'
144+
body: |
145+
## 🔄 Post-Release Sync
146+
147+
This PR syncs the release changes from `prod` back to `dev`:
148+
- Updated `package.json` version
149+
- Updated `CHANGELOG.md`
150+
- Updated `.release-please-manifest.json`
151+
152+
**Auto-merge recommended** to keep branches in sync.
153+
branch: sync/prod-to-dev
154+
base: dev
155+
delete-branch: true
156+
labels: 'sync,automated'

0 commit comments

Comments
 (0)