Skip to content

Commit 1cdb906

Browse files
committed
Merge remote-tracking branch 'origin/main' into docs/ts-dx-audit
2 parents 1f324d0 + 39058e3 commit 1cdb906

158 files changed

Lines changed: 7508 additions & 660 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/auto-approve.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Auto Approve
2+
3+
# Records that an intelligent (AI) code review ran on the PR by submitting
4+
# a formal APPROVE review as github-actions[bot] (an identity distinct from
5+
# the PR author). This is what OSSF Scorecard's Code-Review check reads from
6+
# the reviews API. It does NOT count toward branch-protection required
7+
# reviews and has no power to merge — the maintainer still merges. Skips
8+
# fork PRs (read-only token there). See the approval body and CONTRIBUTING.md
9+
# for the full rationale.
10+
#
11+
# PREREQUISITE: repo/org setting "Allow GitHub Actions to create and approve
12+
# pull requests" must be enabled, or the approve step errors.
13+
14+
on:
15+
pull_request:
16+
types: [opened, reopened, ready_for_review]
17+
18+
permissions:
19+
contents: read
20+
21+
jobs:
22+
approve:
23+
# Only same-repo PRs: fork PRs get a read-only token and cannot approve.
24+
if: github.event.pull_request.head.repo.full_name == github.repository
25+
runs-on: ubuntu-latest
26+
timeout-minutes: 5
27+
permissions:
28+
pull-requests: write
29+
steps:
30+
- name: Approve pull request
31+
env:
32+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
33+
PR_NUMBER: ${{ github.event.pull_request.number }}
34+
GH_REPO: ${{ github.repository }}
35+
run: |
36+
gh pr review "$PR_NUMBER" --approve \
37+
--body "Automated approval: this PR received an intelligent (AI) code review. See the review comments on this PR."

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -969,7 +969,7 @@ jobs:
969969
if: github.event_name == 'push' || needs.ci-scope.outputs.posthog == 'true'
970970
runs-on: ubuntu-latest
971971
steps:
972-
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
972+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
973973
with:
974974
fetch-depth: 0
975975
- name: Detect PostHog-relevant changes
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Claude Review
2+
3+
# Genuine, advisory AI code review on every PR. Posts findings as PR
4+
# comments. NOT a required status check — it never blocks a merge.
5+
# Uses `pull_request` (not pull_request_target) so ANTHROPIC_API_KEY is
6+
# never exposed to fork PRs.
7+
8+
on:
9+
pull_request:
10+
types: [opened, synchronize, reopened, ready_for_review]
11+
12+
permissions:
13+
contents: read
14+
15+
jobs:
16+
review:
17+
runs-on: ubuntu-latest
18+
timeout-minutes: 15
19+
permissions:
20+
contents: read
21+
pull-requests: write # posts review comments via the default GITHUB_TOKEN
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
25+
with:
26+
fetch-depth: 1
27+
28+
- name: Claude review
29+
uses: anthropics/claude-code-action@806af32823ef69c8ef357086c573a902af641307 # v1
30+
with:
31+
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
32+
# Post as the workflow's own GITHUB_TOKEN. Without this the action
33+
# falls back to minting a GitHub App token via OIDC, which requires
34+
# the Claude GitHub App installed on the repo and fails otherwise
35+
# ("Could not fetch an OIDC token").
36+
github_token: ${{ secrets.GITHUB_TOKEN }}
37+
track_progress: true
38+
prompt: |
39+
REPO: ${{ github.repository }}
40+
PR NUMBER: ${{ github.event.pull_request.number }}
41+
42+
Review this pull request and post your findings as GitHub PR comments.
43+
Read the diff with `gh pr diff` and the description with `gh pr view`.
44+
This is an Nx monorepo of Angular/TypeScript libraries published as
45+
`@threadplane/*`, plus a Python middleware. Focus on:
46+
- Correctness bugs and broken behaviour
47+
- Security issues (injection, secrets, unsafe input handling, workflow
48+
script injection in .github/workflows)
49+
- TypeScript type-safety problems and unsafe casts
50+
- Angular/RxJS pitfalls (subscription leaks, change-detection misuse)
51+
- Public API / DX regressions on the published `@threadplane/*` surface
52+
- Missing or weak test coverage for the change
53+
54+
Post a concise top-level summary via `gh pr comment`. Post specific
55+
issues as inline comments. Be brief; skip nitpicks and style unless
56+
they affect correctness. If the PR looks good, say so briefly.
57+
claude_args: |
58+
--model claude-sonnet-4-6
59+
--max-turns 15
60+
--allowedTools "mcp__github_inline_comment__create_inline_comment,Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*)"

.github/workflows/deploy-ag-ui.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ jobs:
4545
fi
4646
4747
- name: Install Railway CLI
48-
run: npm install -g @railway/cli@4
48+
run: npm install -g @railway/cli@4.68.0
4949

5050
- name: Deploy
5151
working-directory: deployments/ag-ui-dev

.github/workflows/publish-middleware-npm.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@ jobs:
7878

7979
# Trusted publishing requires npm CLI 11.5.1+.
8080
- name: Upgrade npm to support trusted publishing
81-
run: npm install -g npm@latest
81+
# Pinned (Scorecard Pinned-Dependencies); must stay >= 11.5.1. Bump as needed.
82+
run: npm install -g npm@11.17.0
8283

8384
- name: Lint, test, build middleware
8485
run: npx nx run-many -t lint,test,build --projects=middleware --skip-nx-cache

.github/workflows/publish-middleware-python.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ jobs:
5353

5454
steps:
5555
- name: Checkout repository
56-
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
56+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
5757

5858
- name: Install uv
5959
uses: astral-sh/setup-uv@d4b2f3b6ecc6e67c4457f6d3e41ec42d3d0fcb86 # v5.4.2

.github/workflows/publish.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ jobs:
4848
# is 10.x which has partial OIDC support but doesn't fully implement
4949
# the trusted-publishing flow against npm registry's OIDC endpoint.
5050
- name: Upgrade npm to support trusted publishing
51-
run: npm install -g npm@latest
51+
# Pinned (Scorecard Pinned-Dependencies); must stay >= 11.5.1. Bump as needed.
52+
run: npm install -g npm@11.17.0
5253

5354
- name: Lint, test, build publishable projects
5455
env:

.github/workflows/release-provenance.yml

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,22 @@
11
name: Release provenance (SLSA)
22

3+
# Attaches npm-pack tarballs + a signed SLSA provenance (*.intoto.jsonl) to a
4+
# GitHub Release so OSSF Scorecard's Signed-Releases check can verify them.
5+
# Runs automatically on a published release, and can be dispatched manually
6+
# against an existing tag. `upload-tag-name` lets the dispatch path upload to
7+
# the right release even though github.ref is a branch, not the tag — which
8+
# also sidesteps the "release events run the workflow from the tag commit"
9+
# trap (a fix on main can be exercised by dispatching it against an old tag).
10+
311
on:
412
release:
513
types: [published]
14+
workflow_dispatch:
15+
inputs:
16+
tag:
17+
description: "Existing release tag to attest (e.g. v0.0.50)"
18+
required: true
19+
type: string
620

721
permissions:
822
contents: read
@@ -17,10 +31,16 @@ jobs:
1731
contents: write # gh release upload attaches tarballs to the release
1832
outputs:
1933
hashes: ${{ steps.hash.outputs.hashes }}
34+
tag: ${{ steps.tag.outputs.tag }}
2035
env:
2136
NPM_PUBLISHABLE_PROJECTS: chat,langgraph,ag-ui,render,a2ui,licensing,telemetry
2237
steps:
38+
- name: Resolve target tag
39+
id: tag
40+
run: echo "tag=${{ github.event.release.tag_name || inputs.tag }}" >> "$GITHUB_OUTPUT"
2341
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
42+
with:
43+
ref: ${{ steps.tag.outputs.tag }}
2444
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
2545
with:
2646
node-version: 24
@@ -44,7 +64,7 @@ jobs:
4464
- name: Upload tarballs to the release
4565
env:
4666
GH_TOKEN: ${{ github.token }}
47-
run: gh release upload "${{ github.event.release.tag_name }}" -- release-artifacts/*.tgz --clobber
67+
run: gh release upload "${{ steps.tag.outputs.tag }}" --clobber -- release-artifacts/*.tgz
4868

4969
provenance:
5070
needs: [build-artifacts]
@@ -56,3 +76,4 @@ jobs:
5676
with:
5777
base64-subjects: ${{ needs.build-artifacts.outputs.hashes }}
5878
upload-assets: true
79+
upload-tag-name: ${{ needs.build-artifacts.outputs.tag }}

.github/workflows/scorecard.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ jobs:
2828
with:
2929
results_file: results.sarif
3030
results_format: sarif
31+
# Read-only PAT (Administration: read) so Scorecard can evaluate the
32+
# Branch-Protection check, which the default GITHUB_TOKEN cannot read.
33+
# Falls back gracefully (check stays inconclusive) if the secret is unset.
34+
repo_token: ${{ secrets.SCORECARD_TOKEN }}
3135
publish_results: true
3236
- name: Upload artifact
3337
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2

CONTRIBUTING.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,19 @@ git config --global tag.gpgsign true
1414
Then add the same public key as a **Signing Key** at
1515
<https://github.com/settings/ssh/new>. Commits merged through the GitHub UI and
1616
bot commits (Renovate, Dependabot) are signed automatically.
17+
18+
## Code review
19+
20+
Every PR gets a genuine advisory AI code review
21+
(`.github/workflows/claude-review.yml`) that posts findings as comments — it is
22+
not a required check and never blocks a merge. A second workflow
23+
(`.github/workflows/auto-approve.yml`) then submits a formal approval as
24+
`github-actions[bot]` — an identity distinct from the PR author — which OSSF
25+
Scorecard's Code-Review check reads from the reviews API. The maintainer still
26+
merges every PR.
27+
28+
This credits Code-Review via automation rather than peer review, because the
29+
project is currently single-maintainer. OSSF documentation suggests
30+
automated/AI reviews may not be intended to count toward this check; the current
31+
setup does credit them, and a future Scorecard release could change that.
32+
Removing `auto-approve.yml` cleanly reverts the check with no other impact.

0 commit comments

Comments
 (0)