Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion scripts/validate-template.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ is_allowed_placeholder_path() {
docs/copilot.md | \
docs/npm-publishing.md | \
docs/repo-customisation.md | \
docs/template-variables.md)
docs/template-variables.md | \
src/index.ts)
return 0
;;
*)
Expand Down Expand Up @@ -102,6 +103,8 @@ templates/npm-package/src
templates/npm-package/test
templates/readme
templates/release
templates/repo-docs
templates/repo-validate
templates/security
"

Expand Down Expand Up @@ -145,6 +148,8 @@ templates/release/release-checklist.template.md
templates/release/release-process.template.md
templates/security/SECURITY.github-private-reporting.template.md
templates/security/SECURITY.template.md
templates/repo-docs/README.md
templates/repo-validate/validate.sh
"

printf 'Checking required root files...\n'
Expand Down
11 changes: 10 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ const templateScaffolds: Record<TemplateKey, TemplateScaffold> = {
{ source: 'templates/contributors/CONTRIBUTING.template.md', destination: 'CONTRIBUTING.md' },
{ source: 'templates/security/SECURITY.template.md', destination: 'SECURITY.md' },
{ source: 'templates/github/pull_request_template.md', destination: '.github/pull_request_template.md' },
{ source: 'templates/agents/AGENTS.template.md', destination: 'AGENTS.md' },
{ source: 'templates/repo-docs/README.md', destination: 'docs/README.md' },
{ source: 'templates/repo-validate/validate.sh', destination: 'scripts/validate.sh' },
{ destination: 'package.json', content: nextPackageJsonTemplate() },
{ destination: 'src/app/page.tsx', content: "export default function Home() {\n return <main>{{PROJECT_NAME}}</main>;\n}\n" },
{ destination: 'src/app/layout.tsx', content: "export default function RootLayout({ children }: { children: React.ReactNode }) {\n return (\n <html lang=\"en\">\n <body>{children}</body>\n </html>\n );\n}\n" }
Expand All @@ -58,7 +61,10 @@ const templateScaffolds: Record<TemplateKey, TemplateScaffold> = {
{ source: 'templates/release/CHANGELOG.template.md', destination: 'CHANGELOG.md' },
{ source: 'templates/release/ROADMAP.template.md', destination: 'ROADMAP.md' },
{ source: 'templates/github/pull_request_template.md', destination: '.github/pull_request_template.md' },
{ source: 'templates/github/dependabot.yml', destination: '.github/dependabot.yml' }
{ source: 'templates/github/dependabot.yml', destination: '.github/dependabot.yml' },
{ source: 'templates/agents/AGENTS.template.md', destination: 'AGENTS.md' },
{ source: 'templates/repo-docs/README.md', destination: 'docs/README.md' },
{ source: 'templates/repo-validate/validate.sh', destination: 'scripts/validate.sh' }
]
},
'python-api': {
Expand All @@ -68,6 +74,9 @@ const templateScaffolds: Record<TemplateKey, TemplateScaffold> = {
{ source: 'templates/contributors/CONTRIBUTING.template.md', destination: 'CONTRIBUTING.md' },
{ source: 'templates/security/SECURITY.template.md', destination: 'SECURITY.md' },
{ source: 'templates/github/pull_request_template.md', destination: '.github/pull_request_template.md' },
{ source: 'templates/agents/AGENTS.template.md', destination: 'AGENTS.md' },
{ source: 'templates/repo-docs/README.md', destination: 'docs/README.md' },
{ source: 'templates/repo-validate/validate.sh', destination: 'scripts/validate.sh' },
{ destination: 'pyproject.toml', content: pythonProjectTemplate() },
{ destination: 'src/{{PACKAGE_MODULE}}/__init__.py', content: "__all__ = ['__version__']\n__version__ = '0.1.0'\n" },
{ destination: 'src/{{PACKAGE_MODULE}}/main.py', content: "from fastapi import FastAPI\n\napp = FastAPI(title=\"{{PROJECT_NAME}}\")\n\n\n@app.get('/health')\ndef health() -> dict[str, str]:\n return {'status': 'ok'}\n" }
Expand Down
13 changes: 13 additions & 0 deletions templates/repo-docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# {{PROJECT_NAME}} Documentation

This directory holds project documentation.

## Contents

- [Contributing guide](../CONTRIBUTING.md)
- [Security policy](../SECURITY.md)
- [Agent instructions](../AGENTS.md)

## Additional docs

For a hosted documentation site, see the `docs-site/` directory if present.
52 changes: 52 additions & 0 deletions templates/repo-validate/validate.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#!/usr/bin/env bash
set -euo pipefail

repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$repo_root"

failed=0

pass() {
printf 'PASS: %s\n' "$1"
}

fail() {
printf 'FAIL: %s\n' "$1" >&2
failed=1
}

check_file() {
if [ -f "$1" ]; then
pass "required file exists: $1"
else
fail "missing required file: $1"
fi
}

check_dir() {
if [ -d "$1" ]; then
pass "required directory exists: $1"
else
fail "missing required directory: $1"
fi
}

printf 'Checking {{PROJECT_NAME}} required files...\n'

check_file "README.md"
check_file "AGENTS.md"
check_file "CONTRIBUTING.md"
check_file "SECURITY.md"
check_file ".github/pull_request_template.md"

printf '\nChecking {{PROJECT_NAME}} required directories...\n'

check_dir ".github"
check_dir "docs"

if [ "$failed" -ne 0 ]; then
printf '\nValidation failed.\n' >&2
exit 1
fi

printf '\nValidation passed.\n'