Skip to content
Open
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
2 changes: 1 addition & 1 deletion .claude/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"source": {
"source": "github",
"repo": "LasVegasForTransit/repository-tooling",
"ref": "v0.7.9"
"ref": "v0.8.0"
}
}
},
Expand Down
6 changes: 3 additions & 3 deletions .lvbt/web-platform.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"formatVersion": 1,
"preset": "lvbt-web",
"release": "v0.7.9",
"commit": "5ebebb6dd19040acae98054e39ff794ae3fc8660",
"contentHash": "d2fa90baa7effc16137c1dada07bdd788ad53bfe489c1d44e0a865269466356d",
"release": "v0.8.0",
"commit": "5db2f70bc9926a5a854e1fced7b3830c5081e008",
"contentHash": "90f2cda55c623b381b464cdca76806e6b72b5a79209a47b9b692417e9f999356",
"executables": [
"examples/with-astro/.githooks/commit-msg",
"examples/with-astro/.githooks/pre-commit",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"source": {
"source": "github",
"repo": "LasVegasForTransit/repository-tooling",
"ref": "v0.7.9"
"ref": "v0.8.0"
}
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ name: CI
on:
pull_request:
branches: [main]
merge_group:
workflow_call:
workflow_dispatch:

Expand All @@ -13,7 +14,8 @@ permissions:

concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
# Cancelling a running merge-group check drops the queued pull request.
cancel-in-progress: ${{ github.event_name != 'merge_group' }}

jobs:
validate:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
"validate": "cf deploy --dry-run"
},
"devDependencies": {
"@lasvegasfortransit/eslint-config": "0.7.9",
"@lasvegasfortransit/eslint-config": "0.8.0",
"@lasvegasfortransit/site": "workspace:*",
"@lasvegasfortransit/typescript-config": "0.7.9",
"@lasvegasfortransit/typescript-config": "0.8.0",
"cf": "catalog:",
"eslint": "catalog:",
"typescript": "catalog:",
Expand Down
8 changes: 4 additions & 4 deletions .lvbt/web-platform/examples/with-astro/apps/site/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
},
"devDependencies": {
"@astrojs/check": "catalog:",
"@lasvegasfortransit/eslint-config": "0.7.9",
"@lasvegasfortransit/playwright-config": "0.7.9",
"@lasvegasfortransit/typescript-config": "0.7.9",
"@lasvegasfortransit/vitest-config": "0.7.9",
"@lasvegasfortransit/eslint-config": "0.8.0",
"@lasvegasfortransit/playwright-config": "0.8.0",
"@lasvegasfortransit/typescript-config": "0.8.0",
"@lasvegasfortransit/vitest-config": "0.8.0",
"@playwright/test": "catalog:",
"@types/node": "catalog:",
"eslint": "catalog:",
Expand Down
6 changes: 3 additions & 3 deletions .lvbt/web-platform/examples/with-astro/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
"*": "prettier --write --ignore-unknown"
},
"devDependencies": {
"@lasvegasfortransit/cli": "0.7.9",
"@lasvegasfortransit/prettier-config": "0.7.9",
"@lasvegasfortransit/cli": "0.8.0",
"@lasvegasfortransit/prettier-config": "0.8.0",
"lint-staged": "catalog:",
"markdownlint-cli2": "catalog:",
"markdownlint-rule-relative-links": "catalog:",
Expand All @@ -39,7 +39,7 @@
"typescript": "catalog:",
"wrangler": "catalog:",
"tsx": "catalog:",
"@lasvegasfortransit/web-platform": "0.7.9"
"@lasvegasfortransit/web-platform": "0.8.0"
},
"packageManager": "pnpm@11.25.0",
"engines": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"source": {
"source": "github",
"repo": "LasVegasForTransit/repository-tooling",
"ref": "v0.7.9"
"ref": "v0.8.0"
}
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ name: CI
on:
pull_request:
branches: [main]
merge_group:
workflow_call:
workflow_dispatch:

Expand All @@ -13,7 +14,8 @@ permissions:

concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
# Cancelling a running merge-group check drops the queued pull request.
cancel-in-progress: ${{ github.event_name != 'merge_group' }}

jobs:
validate:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
"react-dom": "catalog:"
},
"devDependencies": {
"@lasvegasfortransit/eslint-config": "0.7.9",
"@lasvegasfortransit/playwright-config": "0.7.9",
"@lasvegasfortransit/typescript-config": "0.7.9",
"@lasvegasfortransit/vitest-config": "0.7.9",
"@lasvegasfortransit/eslint-config": "0.8.0",
"@lasvegasfortransit/playwright-config": "0.8.0",
"@lasvegasfortransit/typescript-config": "0.8.0",
"@lasvegasfortransit/vitest-config": "0.8.0",
"@playwright/test": "catalog:",
"@tailwindcss/vite": "catalog:",
"@types/node": "catalog:",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
"validate": "cf deploy --dry-run"
},
"devDependencies": {
"@lasvegasfortransit/eslint-config": "0.7.9",
"@lasvegasfortransit/eslint-config": "0.8.0",
"@lasvegasfortransit/app": "workspace:*",
"@lasvegasfortransit/typescript-config": "0.7.9",
"@lasvegasfortransit/typescript-config": "0.8.0",
"cf": "catalog:",
"eslint": "catalog:",
"typescript": "catalog:",
Expand Down
6 changes: 3 additions & 3 deletions .lvbt/web-platform/examples/with-vite-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
"*": "prettier --write --ignore-unknown"
},
"devDependencies": {
"@lasvegasfortransit/cli": "0.7.9",
"@lasvegasfortransit/prettier-config": "0.7.9",
"@lasvegasfortransit/cli": "0.8.0",
"@lasvegasfortransit/prettier-config": "0.8.0",
"lint-staged": "catalog:",
"markdownlint-cli2": "catalog:",
"markdownlint-rule-relative-links": "catalog:",
Expand All @@ -38,7 +38,7 @@
"typescript": "catalog:",
"wrangler": "catalog:",
"tsx": "catalog:",
"@lasvegasfortransit/web-platform": "0.7.9"
"@lasvegasfortransit/web-platform": "0.8.0"
},
"packageManager": "pnpm@11.25.0",
"engines": {
Expand Down
2 changes: 1 addition & 1 deletion .lvbt/web-platform/packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@lasvegasfortransit/cli",
"version": "0.7.9",
"version": "0.8.0",
"description": "The lvbt command every LVBT repository runs for bootstrap, preflight, and deploy, plus the production platform setup, the shared git hooks, and the lvbt-contributions agent plugin.",
"license": "MIT",
"type": "module",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "lvbt-contributions",
"version": "0.7.9",
"version": "0.8.0",
"description": "Create readable LVBT contributions and reconcile trusted audit and recurring issues through the organization workflow.",
"author": {
"name": "Las Vegans for Better Transit",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "lvbt-contributions",
"version": "0.7.9",
"version": "0.8.0",
"description": "Create readable LVBT contributions and reconcile trusted audit and recurring issues through the organization workflow.",
"author": {
"name": "Las Vegans for Better Transit",
Expand Down
2 changes: 1 addition & 1 deletion .lvbt/web-platform/packages/eslint-config/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@lasvegasfortransit/eslint-config",
"version": "0.7.9",
"version": "0.8.0",
"description": "The ESLint configurations every LVBT repository uses.",
"license": "MIT",
"type": "module",
Expand Down
2 changes: 1 addition & 1 deletion .lvbt/web-platform/packages/playwright-config/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@lasvegasfortransit/playwright-config",
"version": "0.7.9",
"version": "0.8.0",
"description": "The Playwright configuration every LVBT repository spreads into its own: end-to-end tests under tests/e2e, desktop and mobile projects, traces on failure.",
"license": "MIT",
"type": "module",
Expand Down
2 changes: 1 addition & 1 deletion .lvbt/web-platform/packages/prettier-config/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@lasvegasfortransit/prettier-config",
"version": "0.7.9",
"version": "0.8.0",
"description": "The Prettier configuration every LVBT repository uses.",
"license": "MIT",
"type": "module",
Expand Down
2 changes: 1 addition & 1 deletion .lvbt/web-platform/packages/typescript-config/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@lasvegasfortransit/typescript-config",
"version": "0.7.9",
"version": "0.8.0",
"description": "TypeScript configurations every LVBT repository extends.",
"license": "MIT",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion .lvbt/web-platform/packages/vitest-config/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@lasvegasfortransit/vitest-config",
"version": "0.7.9",
"version": "0.8.0",
"description": "The Vitest configuration every LVBT repository spreads into its own.",
"license": "MIT",
"type": "module",
Expand Down
2 changes: 1 addition & 1 deletion .lvbt/web-platform/packages/web-platform/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@lasvegasfortransit/web-platform",
"version": "0.7.9",
"version": "0.8.0",
"description": "Provider-neutral deployment, provisioning, and validation primitives for LVBT web repositories.",
"license": "MIT",
"type": "module",
Expand Down
58 changes: 36 additions & 22 deletions .lvbt/web-platform/packages/web-platform/src/doctor-github.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { z } from 'zod';
import { doctorCheck, type DoctorCheck } from './doctor-check.js';
import { matchesPinnedRules } from './ruleset.js';
import { matchesPinnedRules, rulesetForOwner } from './ruleset.js';

interface GitHubTarget {
repository: string;
Expand Down Expand Up @@ -80,39 +80,53 @@ async function productionPolicy(
return branches.length === 1 && branches[0]?.name === branch && branches[0].type === 'branch';
}

async function repositoryCheck(target: GitHubTarget, base: string, read: Read, check: Check) {
let organizationOwned = true;
const result = await check(
'repository',
'Public, unarchived repository with the expected default branch.',
async () => {
const repo = z
.object({
full_name: z.string(),
private: z.boolean(),
archived: z.boolean(),
default_branch: z.string(),
owner: z.object({ type: z.string() }).optional(),
})
.parse(await read(base));
organizationOwned = repo.owner?.type !== 'User';
return (
repo.full_name === target.repository &&
!repo.private &&
!repo.archived &&
repo.default_branch === target.branch
);
},
);
return { result, organizationOwned };
}

export async function githubDoctor(target: GitHubTarget, read: Read) {
const base = `repos/${target.repository}`;
const environment = `${base}/environments/${encodeURIComponent(target.environment)}`;
const check = (id: string, requirement: string, inspect: () => Promise<boolean>) =>
doctorCheck(`github.${id}`, requirement, inspect);
const { result: repository, organizationOwned } = await repositoryCheck(
target,
base,
read,
check,
);
const checks = [
await check(
'repository',
'Public, unarchived repository with the expected default branch.',
async () => {
const repo = z
.object({
full_name: z.string(),
private: z.boolean(),
archived: z.boolean(),
default_branch: z.string(),
})
.parse(await read(base));
return (
repo.full_name === target.repository &&
!repo.private &&
!repo.archived &&
repo.default_branch === target.branch
);
},
),
repository,
await check(
'rules',
'Effective production-branch rules match the pinned organization ruleset.',
async () =>
matchesPinnedRules(
await read(`${base}/rules/branches/${encodeURIComponent(target.branch)}`),
target.ruleset,
rulesetForOwner(target.ruleset, organizationOwned),
),
),
await check('production', 'The production environment accepts only the main branch.', () =>
Expand Down
14 changes: 11 additions & 3 deletions .lvbt/web-platform/packages/web-platform/src/github-governance.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { z } from 'zod';
import { doctorCheck } from './doctor-check.js';
import { matchesPinnedRules, matchesPinnedRuleset } from './ruleset.js';
import { matchesPinnedRules, matchesPinnedRuleset, rulesetForOwner } from './ruleset.js';

const repositorySettings = z.object({
allow_merge_commit: z.literal(false),
Expand Down Expand Up @@ -56,9 +56,17 @@ export async function githubGovernanceDoctor(
),
check(
'ruleset',
'Settings → Rules: apply the reviewed organization ruleset; preserve additional merge-queue protections.',
'Settings → Rules: apply the reviewed organization ruleset, including the rebase merge queue on organization repositories.',
async () => {
return await rulesMatch(target.ruleset, read, base);
const repo = z
.object({ owner: z.object({ type: z.string() }).optional() })
.loose()
.parse(await read(base));
return await rulesMatch(
rulesetForOwner(target.ruleset, repo.owner?.type !== 'User'),
read,
base,
);
},
),
check(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { z } from 'zod';
import type { ProvisionResource } from './provision-reconcile.js';
import { matchesPinnedRuleset } from './ruleset.js';
import { matchesPinnedRuleset, rulesetForOwner } from './ruleset.js';

const targetSchema = z.object({
repository: z.string().regex(/^[A-Za-z0-9-]+\/[A-Za-z0-9._-]+$/),
organizationOwned: z.boolean().default(true),
ruleset: z.object({
name: z.string().min(1),
target: z.literal('branch'),
Expand Down Expand Up @@ -31,6 +32,7 @@ export function provisionRepositoryRuleset(
write: Write,
): ProvisionResource {
const target = targetSchema.parse(input);
const desiredRuleset = rulesetForOwner(target.ruleset, target.organizationOwned);
const endpoint = `repos/${target.repository}/rulesets`;
const selected = async () => {
const input = await read(endpoint);
Expand All @@ -53,7 +55,7 @@ export function provisionRepositoryRuleset(
const summary = await selected();
return (
summary !== null &&
matchesPinnedRuleset(await read(`${endpoint}/${summary.id}`), target.ruleset)
matchesPinnedRuleset(await read(`${endpoint}/${summary.id}`), desiredRuleset)
);
},
desired: () => true,
Expand All @@ -62,7 +64,7 @@ export function provisionRepositoryRuleset(
await write(
summary === null ? 'POST' : 'PUT',
summary === null ? endpoint : `${endpoint}/${summary.id}`,
target.ruleset,
desiredRuleset,
);
},
};
Expand Down
Loading
Loading