From 367bea0d67979f33086cb35936c83d964b990459 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alberto=20Andr=C3=A9?= <150893253+aabrius@users.noreply.github.com> Date: Thu, 28 May 2026 13:31:59 -0300 Subject: [PATCH 1/4] chore: ignore vitest browser snapshots, playwright artifacts and nyc output (#48) * chore: ignore vitest browser snapshots, playwright artifacts and nyc output Adds gitignore entries for test artifacts that are currently generated locally but not tracked: vitest browser __screenshots__, playwright blob results / video (.webm) / trace (.zip), and istanbul .nyc_output. Salvaged from the closed PR #15, which had a valid .gitignore change buried under an obsolete template sync. * chore: sync template after gitignore update - _gitignore: propagate the new test-artifact entries - implement-issue.md: fix lingering reference to create-bhono-app (renamed to create-bhono in #45) The "Verify Template is Synced" CI check fails on any diff under packages/bhono-app/templates/, so the implement-issue.md drift had to be included here. --- .gitignore | 5 +++++ .../base/.claude/commands/linear/implement-issue.md | 2 +- packages/bhono-app/templates/base/_gitignore | 5 +++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 33c42ff..4771656 100644 --- a/.gitignore +++ b/.gitignore @@ -15,6 +15,11 @@ tests/e2e/.auth/ coverage/ playwright-report/ test-results/ +tests/**/__screenshots__/ +tests/e2e/blob-results/ +*.webm +*.zip +.nyc_output/ # Local Linear configuration .claude/linear-config.json diff --git a/packages/bhono-app/templates/base/.claude/commands/linear/implement-issue.md b/packages/bhono-app/templates/base/.claude/commands/linear/implement-issue.md index a8cb18b..a7528cb 100644 --- a/packages/bhono-app/templates/base/.claude/commands/linear/implement-issue.md +++ b/packages/bhono-app/templates/base/.claude/commands/linear/implement-issue.md @@ -192,7 +192,7 @@ Fix any issues before proceeding. |---------------|-------------------|--------| | `packages/bhono-app/src/*` | **YES** | CLI code published to npm | | `packages/bhono-app/templates/*` | **YES** | Templates shipped to users | -| `packages/create-bhono-app/*` | **YES** | Published to npm | +| `packages/create-bhono/*` | **YES** | Published to npm | | `src/*` (app code) | **NO** | Not published, internal app | | `tests/*` | **NO** | Test-only changes | | `config/*`, `.github/*` | **NO** | Build/CI infrastructure | diff --git a/packages/bhono-app/templates/base/_gitignore b/packages/bhono-app/templates/base/_gitignore index 33c42ff..4771656 100644 --- a/packages/bhono-app/templates/base/_gitignore +++ b/packages/bhono-app/templates/base/_gitignore @@ -15,6 +15,11 @@ tests/e2e/.auth/ coverage/ playwright-report/ test-results/ +tests/**/__screenshots__/ +tests/e2e/blob-results/ +*.webm +*.zip +.nyc_output/ # Local Linear configuration .claude/linear-config.json From d2b12aa1fbce3cd67a47b3fc25d0fdfea6f222b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alberto=20Andr=C3=A9?= <150893253+aabrius@users.noreply.github.com> Date: Thu, 28 May 2026 13:33:19 -0300 Subject: [PATCH 2/4] chore: add project .npmrc for @etus scope authentication (#50) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Pins the @etus scope to the public npm registry and configures the auth token explicitly, so install no longer depends on each developer's global ~/.npmrc or the CI runner's default registry. @etus/* is published to registry.npmjs.org with restricted access — the common 404 seen on fresh clones is missing org membership / token, not a publish failure. Also propagates the file into the bhono-app template so scaffolded projects inherit the same explicit config. --- .npmrc | 2 ++ packages/bhono-app/templates/base/.npmrc | 2 ++ 2 files changed, 4 insertions(+) create mode 100644 .npmrc create mode 100644 packages/bhono-app/templates/base/.npmrc diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..9a5e138 --- /dev/null +++ b/.npmrc @@ -0,0 +1,2 @@ +@etus:registry=https://registry.npmjs.org/ +//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN} diff --git a/packages/bhono-app/templates/base/.npmrc b/packages/bhono-app/templates/base/.npmrc new file mode 100644 index 0000000..9a5e138 --- /dev/null +++ b/packages/bhono-app/templates/base/.npmrc @@ -0,0 +1,2 @@ +@etus:registry=https://registry.npmjs.org/ +//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN} From a2813d78a46ef34779031d356e7056ba6dfe1956 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alberto=20Andr=C3=A9?= <150893253+aabrius@users.noreply.github.com> Date: Thu, 28 May 2026 14:56:06 -0300 Subject: [PATCH 3/4] chore: move CI checks to local pre-push to reduce GitHub Actions usage (#51) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds lint, client unit tests, template sync check, CLI tests and CLI build to the local pre-push hook, and deletes the GitHub Actions workflows that ran those same checks. Local pre-push now covers everything the deleted workflows did: - test.yml (Code Quality CLI) → CLI test + build steps - template-sync-check.yml → sync:template:check step - changeset-check.yml → covered by changesets release flow Kept workflows: pr-target-check.yml (validates PR base, only knowable server-side) and release.yml (needs NPM_TOKEN). Required status check on master will be updated separately via gh api to point to "PR Target Check". --- .github/workflows/changeset-check.yml | 53 ------------------- .github/workflows/template-sync-check.yml | 38 -------------- .github/workflows/test.yml | 64 ----------------------- .husky/pre-push | 36 ++++++------- 4 files changed, 18 insertions(+), 173 deletions(-) delete mode 100644 .github/workflows/changeset-check.yml delete mode 100644 .github/workflows/template-sync-check.yml delete mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/changeset-check.yml b/.github/workflows/changeset-check.yml deleted file mode 100644 index cfc208b..0000000 --- a/.github/workflows/changeset-check.yml +++ /dev/null @@ -1,53 +0,0 @@ -name: Changeset Check - -on: - pull_request: - branches: - - master - - main - -jobs: - changeset-check: - name: Check for changesets - runs-on: ubuntu-latest - # Skip for changesets version PRs - if: ${{ github.head_ref != 'changeset-release/master' && github.head_ref != 'changeset-release/main' }} - steps: - - name: Checkout code - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Check if package changes require changeset - run: | - # Get list of changed files - CHANGED_FILES=$(git diff --name-only origin/${{ github.base_ref }}...HEAD) - - # Check if any package files were changed - PACKAGE_CHANGES=$(echo "$CHANGED_FILES" | grep -E "^packages/" || true) - - if [ -z "$PACKAGE_CHANGES" ]; then - echo "✅ No package changes detected, changeset not required" - exit 0 - fi - - echo "📦 Package changes detected:" - echo "$PACKAGE_CHANGES" - echo "" - - # Check if there are any changeset files (excluding README) - CHANGESETS=$(find .changeset -name "*.md" ! -name "README.md" 2>/dev/null | wc -l) - - if [ "$CHANGESETS" -eq 0 ]; then - echo "" - echo "::error::Package changes detected but no changeset found!" - echo "" - echo "Please run 'pnpm changeset' to create one, then commit the file." - echo "" - echo "If this change doesn't need a release, create an empty changeset:" - echo " pnpm changeset --empty" - exit 1 - fi - - echo "" - echo "✅ Found $CHANGESETS changeset(s) for package changes" diff --git a/.github/workflows/template-sync-check.yml b/.github/workflows/template-sync-check.yml deleted file mode 100644 index 0cbafef..0000000 --- a/.github/workflows/template-sync-check.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: Template Sync Check - -on: - pull_request: - branches: [master, main, develop] - push: - branches: [master, main, develop] - -jobs: - check-sync: - name: Verify Template is Synced - runs-on: ubuntu-24.04 - - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: '22' - - - name: Run sync script - run: ./scripts/sync-template.sh - - - name: Check for differences - run: | - if [ -n "$(git status --porcelain packages/bhono-app/templates/)" ]; then - echo "::error::Template is out of sync with boilerplate!" - echo "" - echo "The following files differ:" - git status --porcelain packages/bhono-app/templates/ - echo "" - echo "Run 'pnpm sync:template' locally and commit the changes." - exit 1 - else - echo "Template is in sync with boilerplate." - fi diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index 2594fc1..0000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,64 +0,0 @@ -name: CI - -# Quality gates for the @etus/bhono CLI — the only deliverable shipped from -# this monorepo. The boilerplate code under src/ is template material that -# gets scaffolded into new projects; its quality is enforced locally via the -# pre-push hook (typecheck + tests) where the developer's own ~/.npmrc has -# @etus scope access. CI installs only the CLI workspace via filter, but -# pnpm still resolves the full lockfile — so NPM_TOKEN with @etus read -# scope is needed on every cache-missing run (lockfile changes invalidate -# the pnpm store cache between runs). - -on: - push: - branches: [main, master, develop] - pull_request: - branches: [main, master, develop] - -permissions: - contents: read - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -env: - CI: true - NODE_VERSION: '20' - PNPM_VERSION: '10.15.1' - -jobs: - cli: - name: Code Quality (CLI) - runs-on: ubuntu-24.04 - timeout-minutes: 10 - - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Setup pnpm - uses: pnpm/action-setup@v4 - with: - version: ${{ env.PNPM_VERSION }} - - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: ${{ env.NODE_VERSION }} - cache: 'pnpm' - registry-url: 'https://registry.npmjs.org/' - - - name: Install CLI dependencies only - # --filter '@etus/bhono...' restricts what ends up in node_modules, - # but pnpm still resolves the full lockfile — so the @etus/* tarball - # auth check still runs and needs NPM_TOKEN with @etus read scope. - run: pnpm install --frozen-lockfile --filter '@etus/bhono...' - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - - - name: Test CLI - run: pnpm -C packages/bhono-app test:run - - - name: Build CLI - run: pnpm -C packages/bhono-app build diff --git a/.husky/pre-push b/.husky/pre-push index 5c69db8..d16f490 100644 --- a/.husky/pre-push +++ b/.husky/pre-push @@ -2,25 +2,25 @@ echo "🔍 Running pre-push checks..." -# Type checking -echo "📝 Type checking..." -pnpm typecheck || { - echo "❌ Type check failed. Push aborted." - exit 1 +run() { + name="$1" + shift + echo "" + echo "$name" + "$@" || { + echo "❌ $name failed. Push aborted." + exit 1 + } } -# Server unit tests only (faster, more reliable) -echo "🧪 Running server unit tests..." -pnpm test:unit:server || { - echo "❌ Server unit tests failed. Push aborted." - exit 1 -} - -# Build verification -echo "🏗️ Verifying build..." -pnpm build || { - echo "❌ Build failed. Push aborted." - exit 1 -} +run "📝 Type checking" pnpm typecheck +run "🧹 Linting" pnpm lint +run "🧪 Server unit tests" pnpm test:unit:server +run "🧪 Client unit tests" pnpm test:unit:client +run "🏗️ App build" pnpm build +run "🔁 Template sync check" pnpm sync:template:check +run "🧪 CLI tests" pnpm -C packages/bhono-app test:run +run "🏗️ CLI build" pnpm -C packages/bhono-app build +echo "" echo "✅ All pre-push checks passed!" From 0c6a09b9d3210ab796b27e757a1b18f662de8b35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alberto=20Andr=C3=A9?= <150893253+aabrius@users.noreply.github.com> Date: Thu, 28 May 2026 18:22:53 -0300 Subject: [PATCH 4/4] chore: make coverage gate visible in pre-push hook (#52) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds a header comment pointing to the vitest configs that own the coverage thresholds, and renames the server/client test labels so it is obvious those steps also enforce coverage — not just run tests. No behavior change; gate was already enforced by vitest via the --coverage flag in pnpm test:unit:server and test:unit:client. --- .husky/pre-push | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.husky/pre-push b/.husky/pre-push index d16f490..c919b06 100644 --- a/.husky/pre-push +++ b/.husky/pre-push @@ -1,5 +1,10 @@ #!/usr/bin/env sh +# Coverage gates are enforced by vitest via the test scripts below: +# server: vitest.config.ts (statements 85 / branches 80 / functions 85 / lines 85) +# client: vitest.config.frontend.ts (statements 65 / branches 70 / functions 58 / lines 67) +# If coverage drops below threshold, the test command exits non-zero and the push aborts. + echo "🔍 Running pre-push checks..." run() { @@ -15,8 +20,8 @@ run() { run "📝 Type checking" pnpm typecheck run "🧹 Linting" pnpm lint -run "🧪 Server unit tests" pnpm test:unit:server -run "🧪 Client unit tests" pnpm test:unit:client +run "🧪 Server tests + coverage gate" pnpm test:unit:server +run "🧪 Client tests + coverage gate" pnpm test:unit:client run "🏗️ App build" pnpm build run "🔁 Template sync check" pnpm sync:template:check run "🧪 CLI tests" pnpm -C packages/bhono-app test:run