diff --git a/.github/dependabot.yml b/.github/dependabot.yml index e7565ea..1787387 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -15,6 +15,8 @@ updates: # moves as one set. pi: patterns: ["@earendil-works/*"] + vitest: + patterns: ["vitest", "@vitest/*"] minor-and-patch: update-types: ["minor", "patch"] security: diff --git a/.github/workflows/codeql.yaml b/.github/workflows/codeql.yaml index 7680b77..365cc6e 100644 --- a/.github/workflows/codeql.yaml +++ b/.github/workflows/codeql.yaml @@ -17,6 +17,7 @@ jobs: analyze: name: Analyze runs-on: ubuntu-latest + timeout-minutes: 15 permissions: contents: read security-events: write diff --git a/.github/workflows/pi-canary.yaml b/.github/workflows/pi-canary.yaml index 0095de9..65b6bfc 100644 --- a/.github/workflows/pi-canary.yaml +++ b/.github/workflows/pi-canary.yaml @@ -15,6 +15,7 @@ jobs: canary: name: Check against latest pi runs-on: ubuntu-latest + timeout-minutes: 15 steps: - name: Checkout uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 @@ -31,6 +32,9 @@ jobs: run: npm ci --ignore-scripts - name: Upgrade pi packages to latest + # Installing the newest unlocked release is the point of this job; it holds + # only contents: read and runs no install scripts. + # zizmor: ignore[adhoc-packages] run: npm install --no-save --ignore-scripts @earendil-works/pi-agent-core@latest @earendil-works/pi-ai@latest @earendil-works/pi-coding-agent@latest @earendil-works/pi-tui@latest - name: Report the versions under test diff --git a/.github/workflows/pr-check.yaml b/.github/workflows/pr-check.yaml index 89128b7..fc819cf 100644 --- a/.github/workflows/pr-check.yaml +++ b/.github/workflows/pr-check.yaml @@ -15,7 +15,7 @@ permissions: # A superseded push to a pull request is dead weight; cancel it. Every main commit needs # its own result and its own Sonar main-branch analysis, so a push gets a group of its own: # a shared group holds one pending run, and a third push replaced the second's. -# Releases are unaffected (publish.yaml has no concurrency group). +# Releases are unaffected (publish.yaml has a group of its own). concurrency: group: pr-check-${{ github.event_name == 'pull_request' && github.ref || github.sha }} cancel-in-progress: ${{ github.event_name == 'pull_request' }} @@ -24,6 +24,7 @@ jobs: check: name: Biome, Types & Tests runs-on: ${{ matrix.os }} + timeout-minutes: 15 permissions: contents: read strategy: @@ -55,6 +56,9 @@ jobs: # execute in every PR. run: npm ci --ignore-scripts + - name: Verify provenance signatures + run: npm audit signatures + - name: Check run: npm run check @@ -81,6 +85,7 @@ jobs: smoke: name: Headless e2e smoke runs-on: ${{ matrix.os }} + timeout-minutes: 15 strategy: fail-fast: false matrix: @@ -107,3 +112,45 @@ jobs: # asserts the exact provider payload; no real model or network needed. shell: bash run: bash scripts/e2e-smoke.sh + + zizmor: + name: Workflow audit (zizmor) + runs-on: ubuntu-latest + timeout-minutes: 15 + permissions: + contents: read + steps: + - name: Checkout + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + + - name: Install uv + uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3 + with: + enable-cache: false + + - name: Audit workflows + run: uvx zizmor@1.32.0 --config .github/zizmor.yml --format=plain .github/workflows + + ci: + # The single status a ruleset can require: it stays red unless every job above + # succeeded. None of them is conditional, so a skipped job counts as a failure. + name: CI + needs: [check, smoke, zizmor] + if: always() + runs-on: ubuntu-latest + timeout-minutes: 5 + permissions: {} + steps: + - name: Require every job to succeed + env: + RESULTS: ${{ toJSON(needs.*.result) }} + run: | + set -euo pipefail + echo "Job results: $RESULTS" + if jq -e 'all(.[]; . == "success")' <<< "$RESULTS" > /dev/null; then + exit 0 + fi + echo "At least one required job did not succeed." >&2 + exit 1 diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 1d011af..bc4e291 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -17,6 +17,12 @@ on: permissions: contents: read +# One publish at a time, and never cancel one midway: a cancelled run can leave a +# release with its attestation uploaded but the package unpublished. +concurrency: + group: publish + cancel-in-progress: false + jobs: # The check runs the dev toolchain (vitest, biome, knip, tsc) and every devDependency it # loads, so it holds no token: a compromised one cannot mint the OIDC token the build @@ -24,6 +30,7 @@ jobs: check: name: Check runs-on: ubuntu-latest + timeout-minutes: 15 permissions: contents: read steps: @@ -39,7 +46,9 @@ jobs: uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 with: node-version: 24.x - cache: npm + # No cache anywhere in a release run: a poisoned cache entry would feed + # the commit that gets tagged, packed and published. + package-manager-cache: false - name: Install dependencies run: npm ci --ignore-scripts @@ -51,6 +60,7 @@ jobs: name: Build, attest, and pack needs: [check] runs-on: ubuntu-latest + timeout-minutes: 15 permissions: contents: write # upload the attestation bundle to the triggering release id-token: write # OIDC token for Sigstore keyless signing @@ -74,6 +84,7 @@ jobs: with: node-version: 24.x registry-url: https://registry.npmjs.org + package-manager-cache: false - name: Verify the tag matches package.json env: @@ -132,6 +143,7 @@ jobs: name: Publish to npm needs: [build] runs-on: ubuntu-latest + timeout-minutes: 15 permissions: contents: read id-token: write # npm provenance attestation via OIDC trusted publisher @@ -141,6 +153,7 @@ jobs: with: node-version: 24.x registry-url: https://registry.npmjs.org + package-manager-cache: false - name: Download tarball artifact uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 diff --git a/.github/zizmor.yml b/.github/zizmor.yml new file mode 100644 index 0000000..b8e0c72 --- /dev/null +++ b/.github/zizmor.yml @@ -0,0 +1,6 @@ +rules: + unpinned-uses: + config: + policies: + # Every action, first-party included, is pinned to a full commit SHA. + "*": hash-pin diff --git a/biome.json b/biome.json index f50923c..826c3aa 100644 --- a/biome.json +++ b/biome.json @@ -1,5 +1,5 @@ { - "$schema": "https://biomejs.dev/schemas/2.6.6/schema.json", + "$schema": "https://biomejs.dev/schemas/2.6.8/schema.json", "vcs": { "enabled": false, "clientKind": "git",