Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/Aquaticat/Monochromatic. TypeScript and Rust monorepo: Claude Code and Pi coding-agent plugins, a m
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233name: cli-git trust host evidence
on: pull_request: branches: ['main'] paths: - 'package/git-policy/**' - 'package/module/fs-id/**' - 'package/module/fs-path/**' - 'pnpm-lock.yaml' - '.github/workflows/cli-git-trust.yml' merge_group: branches: ['main'] push: branches: ['main'] paths: - 'package/git-policy/**' - 'package/module/fs-id/**' - 'package/module/fs-path/**' - 'pnpm-lock.yaml' - '.github/workflows/cli-git-trust.yml' schedule: - cron: '17 6 * * *' workflow_dispatch:
concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true
permissions: contents: read
jobs: runtime-policy: name: Runtime policy runs-on: ubuntu-latest outputs: minimum_node_version: ${{ steps.contract.outputs.minimum_node_version }} supported_node_versions: ${{ steps.contract.outputs.supported_node_versions }} steps: - name: Checkout uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd with: fetch-depth: 1
- name: Resolve maintained Node LTS floor id: contract shell: node {0} run: | const { appendFileSync, readFileSync } = require('node:fs')
const manifestPath = 'package/git-policy/cli/package.json' const rangeSeparator = ' || ' const rangePrefix = '^' const semanticVersionComponentCount = 3 const manifest = JSON.parse(readFileSync(manifestPath, 'utf8')) const range = manifest.engines?.node const outputPath = process.env.GITHUB_OUTPUT
if (typeof range !== 'string') throw new TypeError(`${manifestPath} engines.node must be a string`) const versions = range.split(rangeSeparator).map((part) => { if (!part.startsWith(rangePrefix)) throw new Error(`${manifestPath} engines.node must contain caret ranges, received ${range}`) const version = part.slice(rangePrefix.length) const components = version.split('.') const isCanonical = components.length === semanticVersionComponentCount && components.every((component) => { const numericComponent = Number(component) return component !== '' && Number.isSafeInteger(numericComponent) && numericComponent >= 0 && String(numericComponent) === component }) if (!isCanonical) throw new Error(`${manifestPath} engines.node must contain canonical versions, received ${range}`) return version }) if (versions.some((version, index) => versions.indexOf(version) !== index)) throw new Error(`${manifestPath} engines.node must contain unique runtime ranges, received ${range}`) if (outputPath === undefined) throw new Error('GitHub did not provide GITHUB_OUTPUT')
const minimumVersion = versions.reduce((minimum, version) => { const minimumComponents = minimum.split('.').map(Number) const versionComponents = version.split('.').map(Number) const minimumIsEarlier = versionComponents[0] < minimumComponents[0] || (versionComponents[0] === minimumComponents[0] && (versionComponents[1] < minimumComponents[1] || (versionComponents[1] === minimumComponents[1] && versionComponents[2] < minimumComponents[2]))) return minimumIsEarlier ? version : minimum }) console.log(`cli-git supported Node ranges: ${range}`) appendFileSync(outputPath, `minimum_node_version=${minimumVersion}\n`) appendFileSync(outputPath, `supported_node_versions=${JSON.stringify(versions)}\n`)
latest-lts-policy: name: Latest LTS policy needs: runtime-policy runs-on: ubuntu-latest steps: - name: Compare declared floor with published latest LTS line env: DECLARED_MINIMUM_NODE_VERSION: ${{ needs.runtime-policy.outputs.minimum_node_version }} shell: node {0} run: | const response = await fetch('https://nodejs.org/dist/index.json') if (!response.ok) throw new Error(`Node release index returned HTTP ${response.status}`)
const releases = await response.json() if (!Array.isArray(releases)) throw new TypeError('Node release index is not an array') const ltsReleases = releases.filter((release) => ( typeof release === 'object' && release !== null && typeof release.version === 'string' && release.lts !== false )) const latestLtsRelease = ltsReleases[0] if (latestLtsRelease === undefined) throw new Error('Node release index contains no LTS release')
const latestLtsMajor = latestLtsRelease.version.slice(1).split('.')[0] const firstLtsRelease = ltsReleases.toReversed().find((release) => ( release.version.slice(1).split('.')[0] === latestLtsMajor )) if (firstLtsRelease === undefined) throw new Error(`Node release index contains no floor for LTS ${latestLtsMajor}`)
const expectedMinimum = firstLtsRelease.version.slice(1) const declaredMinimum = process.env.DECLARED_MINIMUM_NODE_VERSION if (declaredMinimum !== expectedMinimum) { throw new Error( `cli-git must replace its maintained minimum range with ^${expectedMinimum}; received ^${declaredMinimum}`, ) } console.log( `cli-git tracks Node ${latestLtsMajor} LTS from ${firstLtsRelease.version} through ${latestLtsRelease.version}`, )
supported-runtime: name: Supported runtime (${{ matrix.node_version }}) if: github.event_name != 'schedule' needs: runtime-policy strategy: fail-fast: false matrix: node_version: ${{ fromJSON(needs.runtime-policy.outputs.supported_node_versions) }} runs-on: ubuntu-latest env: MISE_AUTO_INSTALL: 'false' MISE_NODE_VERSION: ${{ matrix.node_version }} steps: - name: Checkout uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd with: fetch-depth: 1
- name: Set up mise without repository-wide tool installation uses: jdx/mise-action@c2a87611a18de5b3828c5652fe268e992400cb5c with: # Resolve "latest" through the GitHub releases API, published releases only, # one day old like pnpm's minimumReleaseAge. Without it the action installs # whatever mise.jdx.dev/VERSION names, which runs ahead of the GitHub release # (2025.8.19, 2026.9.3): doc/troubleshooting/mise-action-version-ahead-of-release.md minimum_release_age: 1d install: false
- name: Install supported runtime tools run: mise install node pnpm
- name: Install cli-git dependency closure run: mise exec node pnpm -- pnpm install --frozen-lockfile --filter @monochromatic-dev/git-policy-cli...
- name: Build at supported runtime run: mise run //package/git-policy/cli:build
- name: Run representative source tests at supported runtime run: >- mise run //package/git-policy/cli:test:unit -- package/git-policy/cli/src/api.unit.test.ts package/git-policy/cli/src/bin.unit.test.ts
- name: Exercise built package at supported runtime run: mise run //package/git-policy/cli:verify:supported-runtime
trust: name: Trust (${{ matrix.os }}) if: github.event_name != 'schedule' strategy: fail-fast: false matrix: os: - ubuntu-latest - macos-latest - windows-latest runs-on: ${{ matrix.os }} steps: - name: Checkout uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd with: fetch-depth: 1
- name: Set up Node uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 with: node-version: 26.5.0 package-manager-cache: false
- name: Set up pnpm run: npm install --global pnpm@11.10.0
- name: Install git-policy-cli dependency closure run: pnpm install --frozen-lockfile --filter @monochromatic-dev/git-policy-cli...
- name: Exercise real filesystem identity commands run: node package/module/fs-id/src/host-evidence.ts
- name: Verify strict and relaxed MJS snapshots run: node package/git-policy/cli/src/trust/trust-service.unit.test.ts
- name: Verify strict and relaxed TypeScript cache run: node package/git-policy/cli/src/trust/typescript-trust.unit.test.ts
- name: Verify reversible trust paths run: node package/git-policy/cli/src/trust/registry-path.unit.test.ts
- name: Verify Windows protected ACL rejection if: runner.os == 'Windows' run: node package/git-policy/cli/src/trust/windows-acl.host-evidence.ts