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
52 changes: 36 additions & 16 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ on:
pull_request:
branches: [main]

permissions:
contents: read

jobs:
version-guard:
# Catches the two failure modes behind the npm/GitHub version desync
Expand All @@ -18,13 +21,14 @@ jobs:
# would fail on ordinary work, not just an actual version mistake.
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
with:
fetch-depth: 0
persist-credentials: false

- uses: actions/setup-node@v4
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: '20'
node-version: '24'

- name: Install dependencies
run: npm ci
Expand Down Expand Up @@ -68,22 +72,36 @@ jobs:
}
"

test-and-audit:
runs-on: ubuntu-latest
test:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
# '20' resolves to the latest 20.x, which satisfies engines' ^20.19.0
# (the oldest Node with require(esm), needed for ESM-only uuid@14).
node: ['20', '22', '24']
runs-on: ${{ matrix.os }}
# Windows is expected to fail for now: npm is spawned with
# execFileSync('npm'), which can't find npm.cmd on Windows, and the
# unused-dependency fallback shells out to grep, which Windows lacks by
# default. Informational until both are fixed; then drop this line to
# make Windows a real gate.
continue-on-error: ${{ matrix.os == 'windows-latest' }}
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
with:
persist-credentials: false

- uses: actions/setup-node@v4
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: '20'
node-version: ${{ matrix.node }}

- name: Install dependencies
run: npm ci
- run: npm ci

- name: Run test suite with coverage
run: npm run test:coverage
- run: npm run test:coverage

- name: Audit for known vulnerabilities
if: matrix.os == 'ubuntu-latest' && matrix.node == '24'
run: npm audit --audit-level=high

integration-smoke:
Expand All @@ -99,11 +117,13 @@ jobs:
# informational rather than a merge gate for that reason.
continue-on-error: true
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
with:
persist-credentials: false

- uses: actions/setup-node@v4
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: '20'
node-version: '24'

- name: Install dependencies
run: npm ci
Expand All @@ -115,7 +135,7 @@ jobs:
# generated on demand rather than committed — a fresh CI checkout
# doesn't have them until this runs.
- name: Generate test fixture projects
run: bash create-test-projects.sh
run: bash test/create-test-projects.sh

- name: Install fixture project dependencies
run: |
Expand Down
13 changes: 9 additions & 4 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ on:
schedule:
- cron: '17 3 * * 1' # weekly, Monday 03:17 UTC

permissions:
contents: read

jobs:
analyze:
runs-on: ubuntu-latest
Expand All @@ -24,15 +27,17 @@ jobs:
matrix:
language: ['javascript-typescript']
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
with:
persist-credentials: false

- uses: github/codeql-action/init@v3
- uses: github/codeql-action/init@1190a975f95ce23525efb6a3fc21ea29567c1b52 # v3.38.2
with:
languages: ${{ matrix.language }}
queries: security-extended

- uses: github/codeql-action/autobuild@v3
- uses: github/codeql-action/autobuild@1190a975f95ce23525efb6a3fc21ea29567c1b52 # v3.38.2

- uses: github/codeql-action/analyze@v3
- uses: github/codeql-action/analyze@1190a975f95ce23525efb6a3fc21ea29567c1b52 # v3.38.2
with:
category: '/language:${{ matrix.language }}'
31 changes: 24 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,35 @@ name: Release
# tag that doesn't match package.json's version can never publish — this is
# the automation that closes the gap the manual "tag it, then remember to
# also run `npm publish`" workflow left open.
#
# Publishing uses npm trusted publishing (OIDC) — no NPM_TOKEN secret needed.
on:
push:
tags:
- 'v*.*.*'

permissions:
contents: read

jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
contents: write # create the GitHub Release
id-token: write # npm trusted publishing (OIDC)
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
with:
persist-credentials: false

- uses: actions/setup-node@v4
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: '20'
node-version: '24'
registry-url: 'https://registry.npmjs.org'

- name: Make sure npm supports trusted publishing (11.5.1+)
run: npm install -g npm@11

- name: Install dependencies
run: npm ci

Expand All @@ -31,14 +42,20 @@ jobs:
TAG_VERSION="${GITHUB_REF_NAME#v}"
PACKAGE_VERSION=$(node -p "require('./package.json').version")
if [ "$TAG_VERSION" != "$PACKAGE_VERSION" ]; then
echo "::error::Tag $GITHUB_REF_NAME (version $TAG_VERSION) does not match package.json version $PACKAGE_VERSION — refusing to publish."
echo "::error::Tag $GITHUB_REF_NAME does not match package.json version $PACKAGE_VERSION"
exit 1
fi

- name: Run tests
run: npm test

- name: Publish to npm
- name: Publish to npm (no token; OIDC + provenance)
run: npm publish

- name: Create GitHub Release from CHANGELOG
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
GH_TOKEN: ${{ github.token }}
run: |
VERSION="${GITHUB_REF_NAME#v}"
awk -v v="$VERSION" '$0 ~ "^## \\[" v "\\]" { found=1; next } found && /^## \[/ { exit } found { print }' CHANGELOG.md > release-notes.md
gh release create "$GITHUB_REF_NAME" --title "$GITHUB_REF_NAME" --notes-file release-notes.md
6 changes: 3 additions & 3 deletions .github/workflows/scorecard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@ jobs:
security-events: write
id-token: write
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
with:
persist-credentials: false

- uses: ossf/scorecard-action@v2.4.4
- uses: ossf/scorecard-action@2d1146689b8cda280b9bc96326124645441f03bc # v2.4.4
with:
results_file: results.sarif
results_format: sarif
publish_results: true

- uses: github/codeql-action/upload-sarif@v3
- uses: github/codeql-action/upload-sarif@1190a975f95ce23525efb6a3fc21ea29567c1b52 # v3.38.2
with:
sarif_file: results.sarif
9 changes: 2 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,14 @@ coverage/
*.tmp
.cache/.npmrc
.npmrc
.devcompass-cache.json
.devcompass-backups/
devcompass-fix-report.json
# Graph visualization outputs
dependency-graph.html
final-test.html
*.graph.html
*.graph.json
test1.html
test1.json
test1-shallow.html
devcompass-v310-test/

# DevCompass config (contains GitHub token)
# DevCompass config (tokens are stored in ~/.devcompass, not here)
.devcompass/
knip.json

Expand All @@ -37,6 +31,7 @@ knip.json
test/*
!test/unit/
!test/integration/
!test/create-test-projects.sh

# Internal growth/roadmap notes — not for the public repo
plan/
2 changes: 1 addition & 1 deletion create-test-projects.sh → test/create-test-projects.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ mkdir -p "$TEST_DIR"
# actually runs (test/integration/test-complete-suite.sh calls this script
# itself, then immediately tries to run scripts this find would otherwise
# have just deleted).
find "$TEST_DIR" -mindepth 1 -maxdepth 1 ! -name 'unit' ! -name 'integration' -exec rm -rf {} +
find "$TEST_DIR" -mindepth 1 -maxdepth 1 ! -name 'unit' ! -name 'integration' ! -name 'create-test-projects.sh' -exec rm -rf {} +

echo -e "${CYAN}📁 Created test directory: $TEST_DIR${NC}"
echo ""
Expand Down