Template
Compare commits
4
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4d1fa1d488 | ||
|
|
8a22a28ab4 | ||
|
|
04fa3cf36e | ||
|
|
59b1a3a4ec |
@@ -0,0 +1,2 @@
|
|||||||
|
read: .aider.conventions.md
|
||||||
|
auto-commits: false
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
# __PROJECT_NAME__
|
||||||
|
|
||||||
|
## Identity
|
||||||
|
|
||||||
|
- **Name**: __PROJECT_NAME__
|
||||||
|
- **Owner**: Mathias
|
||||||
|
- **Client**: personal
|
||||||
|
- **Repo**: __MODULE_PATH__
|
||||||
|
- **Status**: active
|
||||||
|
|
||||||
|
## Stack
|
||||||
|
|
||||||
|
Go + Templ + HTMX + CDN Tailwind. See `~/dev/.context/AGENT.md` for cross-project conventions.
|
||||||
+1
-1
@@ -5,7 +5,7 @@
|
|||||||
- **Name**: __PROJECT_NAME__
|
- **Name**: __PROJECT_NAME__
|
||||||
- **Owner**: Mathias
|
- **Owner**: Mathias
|
||||||
- **Client**: personal
|
- **Client**: personal
|
||||||
- **Repo**: gitea.d-ma.be/mathias/__PROJECT_NAME__
|
- **Repo**: __MODULE_PATH__
|
||||||
- **Status**: active
|
- **Status**: active
|
||||||
|
|
||||||
## Stack
|
## Stack
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"mcpServers": {
|
||||||
|
"knowledge": {
|
||||||
|
"url": "http://localhost:3100/mcp",
|
||||||
|
"description": "Project knowledge base — vector + graph retrieval"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
You are a coding assistant working on a specific project.
|
||||||
|
Follow all conventions from both the root agent context and project context.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
# __PROJECT_NAME__
|
||||||
|
|
||||||
|
## Identity
|
||||||
|
|
||||||
|
- **Name**: __PROJECT_NAME__
|
||||||
|
- **Owner**: Mathias
|
||||||
|
- **Client**: personal
|
||||||
|
- **Repo**: __MODULE_PATH__
|
||||||
|
- **Status**: active
|
||||||
|
|
||||||
|
## Stack
|
||||||
|
|
||||||
|
Go + Templ + HTMX + CDN Tailwind. See `~/dev/.context/AGENT.md` for cross-project conventions.
|
||||||
|
|
||||||
|
---
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
# Cursor rules — auto-generated
|
||||||
|
# Do not edit. Run: task context:sync
|
||||||
|
|
||||||
|
# __PROJECT_NAME__
|
||||||
|
|
||||||
|
## Identity
|
||||||
|
|
||||||
|
- **Name**: __PROJECT_NAME__
|
||||||
|
- **Owner**: Mathias
|
||||||
|
- **Client**: personal
|
||||||
|
- **Repo**: __MODULE_PATH__
|
||||||
|
- **Status**: active
|
||||||
|
|
||||||
|
## Stack
|
||||||
|
|
||||||
|
Go + Templ + HTMX + CDN Tailwind. See `~/dev/.context/AGENT.md` for cross-project conventions.
|
||||||
+21
-4
@@ -11,8 +11,25 @@ env:
|
|||||||
IMAGE: __PROJECT_NAME__
|
IMAGE: __PROJECT_NAME__
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
guard:
|
||||||
|
name: Detect unsubstituted template
|
||||||
|
runs-on: self-hosted
|
||||||
|
outputs:
|
||||||
|
is_template: ${{ steps.detect.outputs.is_template }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- id: detect
|
||||||
|
run: |
|
||||||
|
if grep -q '__MODULE_PATH__' go.mod; then
|
||||||
|
echo "is_template=true" >> "$GITHUB_OUTPUT"
|
||||||
|
else
|
||||||
|
echo "is_template=false" >> "$GITHUB_OUTPUT"
|
||||||
|
fi
|
||||||
|
|
||||||
check:
|
check:
|
||||||
name: Lint / Test / Vet
|
name: Lint / Test / Vet
|
||||||
|
needs: guard
|
||||||
|
if: needs.guard.outputs.is_template != 'true'
|
||||||
runs-on: self-hosted
|
runs-on: self-hosted
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
@@ -34,9 +51,9 @@ jobs:
|
|||||||
|
|
||||||
build:
|
build:
|
||||||
name: Build & Import
|
name: Build & Import
|
||||||
needs: check
|
needs: [guard, check]
|
||||||
|
if: needs.guard.outputs.is_template != 'true' && github.event_name != 'pull_request'
|
||||||
runs-on: self-hosted
|
runs-on: self-hosted
|
||||||
if: github.event_name != 'pull_request'
|
|
||||||
outputs:
|
outputs:
|
||||||
image-tag: ${{ steps.meta.outputs.sha-tag }}
|
image-tag: ${{ steps.meta.outputs.sha-tag }}
|
||||||
steps:
|
steps:
|
||||||
@@ -63,9 +80,9 @@ jobs:
|
|||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
name: Deploy via GitOps
|
name: Deploy via GitOps
|
||||||
needs: build
|
needs: [guard, build]
|
||||||
|
if: needs.guard.outputs.is_template != 'true' && github.ref == 'refs/heads/main' && github.event_name == 'push'
|
||||||
runs-on: self-hosted
|
runs-on: self-hosted
|
||||||
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
|
|
||||||
steps:
|
steps:
|
||||||
- name: Update image tag in infra repo
|
- name: Update image tag in infra repo
|
||||||
env:
|
env:
|
||||||
|
|||||||
@@ -1,107 +0,0 @@
|
|||||||
name: Init
|
|
||||||
|
|
||||||
# One-shot bootstrap — runs on first push to main, skips if already initialised.
|
|
||||||
# Substitutes all __PROJECT_NAME__ / __MODULE_PATH__ placeholders (file contents
|
|
||||||
# and directory names), then runs context:sync to generate CLAUDE.md and friends.
|
|
||||||
# Deletes itself on completion so it never runs again.
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: [main]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
init:
|
|
||||||
name: Bootstrap project from template
|
|
||||||
runs-on: self-hosted
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
- name: Check if already initialised
|
|
||||||
id: guard
|
|
||||||
run: |
|
|
||||||
if [ -f CLAUDE.md ]; then
|
|
||||||
echo "skip=true" >> "$GITHUB_OUTPUT"
|
|
||||||
else
|
|
||||||
echo "skip=false" >> "$GITHUB_OUTPUT"
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Derive project variables
|
|
||||||
if: steps.guard.outputs.skip == 'false'
|
|
||||||
id: vars
|
|
||||||
run: |
|
|
||||||
PROJECT_NAME=$(basename "$(git rev-parse --show-toplevel)")
|
|
||||||
GITEA_HOST=$(git remote get-url origin | sed 's|http://||;s|https://||;s|/.*||')
|
|
||||||
OWNER=$(git remote get-url origin | sed 's|.*://[^/]*/\([^/]*\)/.*|\1|')
|
|
||||||
MODULE_PATH="${GITEA_HOST}/${OWNER}/${PROJECT_NAME}"
|
|
||||||
echo "project_name=${PROJECT_NAME}" >> "$GITHUB_OUTPUT"
|
|
||||||
echo "module_path=${MODULE_PATH}" >> "$GITHUB_OUTPUT"
|
|
||||||
echo "→ PROJECT_NAME=${PROJECT_NAME}"
|
|
||||||
echo "→ MODULE_PATH=${MODULE_PATH}"
|
|
||||||
|
|
||||||
- name: Configure git with token
|
|
||||||
if: steps.guard.outputs.skip == 'false'
|
|
||||||
env:
|
|
||||||
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
|
||||||
run: |
|
|
||||||
REMOTE=$(git remote get-url origin)
|
|
||||||
# Inject token into remote URL for push-back
|
|
||||||
AUTH_REMOTE=$(echo "$REMOTE" | sed "s|http://|http://gitea-actions:${GITEA_TOKEN}@|")
|
|
||||||
git remote set-url origin "$AUTH_REMOTE"
|
|
||||||
git config user.name "gitea-actions[bot]"
|
|
||||||
git config user.email "gitea-actions[bot]@noreply.local"
|
|
||||||
|
|
||||||
- name: Substitute placeholders in file contents
|
|
||||||
if: steps.guard.outputs.skip == 'false'
|
|
||||||
env:
|
|
||||||
PROJECT_NAME: ${{ steps.vars.outputs.project_name }}
|
|
||||||
MODULE_PATH: ${{ steps.vars.outputs.module_path }}
|
|
||||||
run: |
|
|
||||||
set -euo pipefail
|
|
||||||
while IFS= read -r f; do
|
|
||||||
if grep -qE '__PROJECT_NAME__|__MODULE_PATH__' "$f" 2>/dev/null; then
|
|
||||||
sed -i \
|
|
||||||
-e "s|__PROJECT_NAME__|${PROJECT_NAME}|g" \
|
|
||||||
-e "s|__MODULE_PATH__|${MODULE_PATH}|g" \
|
|
||||||
"$f"
|
|
||||||
echo " substituted: $f"
|
|
||||||
fi
|
|
||||||
done < <(git ls-files | grep -v '^\.gitea/workflows/init\.yml$')
|
|
||||||
|
|
||||||
- name: Rename templated directories
|
|
||||||
if: steps.guard.outputs.skip == 'false'
|
|
||||||
env:
|
|
||||||
PROJECT_NAME: ${{ steps.vars.outputs.project_name }}
|
|
||||||
run: |
|
|
||||||
set -euo pipefail
|
|
||||||
if [ -d "cmd/__PROJECT_NAME__" ]; then
|
|
||||||
git mv "cmd/__PROJECT_NAME__" "cmd/${PROJECT_NAME}"
|
|
||||||
echo " renamed: cmd/__PROJECT_NAME__ → cmd/${PROJECT_NAME}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Install task if missing
|
|
||||||
if: steps.guard.outputs.skip == 'false'
|
|
||||||
run: |
|
|
||||||
which task 2>/dev/null || go install github.com/go-task/task/v3/cmd/task@latest
|
|
||||||
|
|
||||||
- name: Run context:sync
|
|
||||||
if: steps.guard.outputs.skip == 'false'
|
|
||||||
run: task context:sync
|
|
||||||
|
|
||||||
- name: Remove this init workflow
|
|
||||||
if: steps.guard.outputs.skip == 'false'
|
|
||||||
run: |
|
|
||||||
git rm .gitea/workflows/init.yml
|
|
||||||
echo " removed: .gitea/workflows/init.yml"
|
|
||||||
|
|
||||||
- name: Commit and push
|
|
||||||
if: steps.guard.outputs.skip == 'false'
|
|
||||||
env:
|
|
||||||
PROJECT_NAME: ${{ steps.vars.outputs.project_name }}
|
|
||||||
run: |
|
|
||||||
git add -A
|
|
||||||
git commit -m "chore: bootstrap ${PROJECT_NAME} from template"
|
|
||||||
git push origin main
|
|
||||||
echo "✓ project initialised"
|
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
# __PROJECT_NAME__
|
||||||
|
|
||||||
|
## Identity
|
||||||
|
|
||||||
|
- **Name**: __PROJECT_NAME__
|
||||||
|
- **Owner**: Mathias
|
||||||
|
- **Client**: personal
|
||||||
|
- **Repo**: __MODULE_PATH__
|
||||||
|
- **Status**: active
|
||||||
|
|
||||||
|
## Stack
|
||||||
|
|
||||||
|
Go + Templ + HTMX + CDN Tailwind. See `~/dev/.context/AGENT.md` for cross-project conventions.
|
||||||
Reference in New Issue
Block a user