@avi2dg/subquo 0.0.0 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.bun-version +1 -0
- package/.github/actions/setup/action.yml +21 -0
- package/.github/actions/setup/bun-without-unzip.sh +20 -0
- package/.github/workflows/ci.yml +177 -0
- package/.github/workflows/main.yml +108 -0
- package/.github/workflows/mutation.yml +106 -0
- package/.github/workflows/pr-title.yml +43 -0
- package/.github/workflows/release.yml +34 -0
- package/.jscpd.json +5 -0
- package/.no-mistakes.yaml +3 -0
- package/AGENTS.md +15 -0
- package/CHANGELOG.md +21 -0
- package/CLAUDE.md +2 -0
- package/LICENSE +21 -0
- package/README.md +80 -0
- package/VISION.md +39 -0
- package/bun.lock +909 -0
- package/bunfig.toml +3 -0
- package/checks.config.ts +7 -0
- package/docs/accounts.md +55 -0
- package/docs/design.md +122 -0
- package/docs/shadow-run.md +49 -0
- package/docs/stage-1-findings.md +65 -0
- package/knip.config.ts +3 -0
- package/oxlint.config.ts +3 -0
- package/package.json +45 -3
- package/scripts/release-assets.ts +28 -0
- package/src/accounts.ts +62 -0
- package/src/cli.ts +122 -0
- package/src/codex-credentials.ts +1 -0
- package/src/collect.ts +45 -0
- package/src/collectors.ts +210 -0
- package/src/index.ts +146 -0
- package/src/keychain.ts +25 -0
- package/src/launch.ts +21 -0
- package/src/pi-codex.ts +17 -0
- package/src/renewal.ts +158 -0
- package/src/storage.ts +48 -0
- package/src/usage.ts +400 -0
- package/stryker.conf.mjs +3 -0
- package/templates/adr.md +32 -0
- package/templates/agents.md +9 -0
- package/templates/changelog.md +39 -0
- package/templates/claude.md +2 -0
- package/templates/explanation.md +15 -0
- package/templates/how-to.md +33 -0
- package/templates/readme.md +48 -0
- package/templates/reference.md +15 -0
- package/templates/tutorial.md +31 -0
- package/templates/vision.md +16 -0
- package/tests/e2e/cli.test.ts +193 -0
- package/tests/e2e/npm-package.test.ts +30 -0
- package/tests/e2e/release-assets.test.ts +53 -0
- package/tests/fixtures/snapshots/fresh.json +54 -0
- package/tests/fixtures/snapshots/incomplete.json +66 -0
- package/tests/unit/collect.test.ts +51 -0
- package/tests/unit/collectors.test.ts +401 -0
- package/tests/unit/no-mistakes.test.ts +8 -0
- package/tests/unit/renewal.test.ts +17 -0
- package/tests/unit/snapshot.test.ts +169 -0
- package/tsconfig.json +46 -0
package/.bun-version
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
1.4.3
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
name: setup
|
|
2
|
+
description: Installs the Bun that .bun-version pins and the locked dependencies, after the job checks out the repository.
|
|
3
|
+
runs:
|
|
4
|
+
using: composite
|
|
5
|
+
steps:
|
|
6
|
+
- name: fetch Bun through npm where the image holds no unzip
|
|
7
|
+
shell: bash
|
|
8
|
+
run: bash .github/actions/setup/bun-without-unzip.sh
|
|
9
|
+
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
|
|
10
|
+
with:
|
|
11
|
+
bun-version-file: .bun-version
|
|
12
|
+
# A self-hosted runner keeps its Bun cache between jobs, where a restore only adds time.
|
|
13
|
+
- if: runner.environment == 'github-hosted'
|
|
14
|
+
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
|
15
|
+
with:
|
|
16
|
+
path: ~/.bun/install/cache
|
|
17
|
+
key: bun-${{ runner.os }}-${{ hashFiles('bun.lock') }}
|
|
18
|
+
restore-keys: bun-${{ runner.os }}-
|
|
19
|
+
- name: install the locked dependencies
|
|
20
|
+
shell: bash
|
|
21
|
+
run: bun install --frozen-lockfile
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# setup-bun unpacks its download with unzip, and keeps a Bun of the pinned version that it finds at ~/.bun/bin/bun.
|
|
3
|
+
set -euo pipefail
|
|
4
|
+
|
|
5
|
+
if command -v unzip > /dev/null; then
|
|
6
|
+
exit 0
|
|
7
|
+
fi
|
|
8
|
+
if ! command -v npm > /dev/null; then
|
|
9
|
+
echo "::error::setup found no unzip for setup-bun, and no npm to fetch Bun without it"
|
|
10
|
+
exit 1
|
|
11
|
+
fi
|
|
12
|
+
|
|
13
|
+
version="$(< .bun-version)"
|
|
14
|
+
prefix="$RUNNER_TEMP/bun-from-npm"
|
|
15
|
+
package="$prefix/node_modules/bun"
|
|
16
|
+
# npm leaves a placeholder at bin/bun.exe, and an npm that holds install scripts back never swaps the binary in.
|
|
17
|
+
npm install --ignore-scripts --prefix "$prefix" "bun@${version#v}"
|
|
18
|
+
node "$package/install.js"
|
|
19
|
+
install -D "$package/bin/bun.exe" "$HOME/.bun/bin/bun"
|
|
20
|
+
"$HOME/.bun/bin/bun" --version
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
name: ci
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
types: [opened, synchronize, reopened, ready_for_review]
|
|
6
|
+
push:
|
|
7
|
+
branches: [main]
|
|
8
|
+
workflow_dispatch:
|
|
9
|
+
|
|
10
|
+
concurrency:
|
|
11
|
+
group: ci-${{ github.event.pull_request.number || github.run_id }}
|
|
12
|
+
cancel-in-progress: true
|
|
13
|
+
|
|
14
|
+
permissions:
|
|
15
|
+
contents: read
|
|
16
|
+
|
|
17
|
+
jobs:
|
|
18
|
+
changes:
|
|
19
|
+
runs-on: ubuntu-latest
|
|
20
|
+
timeout-minutes: 10
|
|
21
|
+
permissions:
|
|
22
|
+
contents: read
|
|
23
|
+
env:
|
|
24
|
+
RELEASE: ${{ ((github.event_name == 'workflow_dispatch' && startsWith(github.ref_name, 'release/')) || (github.event_name == 'pull_request' && github.head_ref == format('release/{0}', github.base_ref) && github.event.pull_request.head.repo.full_name == github.repository)) }}
|
|
25
|
+
outputs:
|
|
26
|
+
docs-only: ${{ steps.classify.outputs.docs-only || 'false' }}
|
|
27
|
+
tests-only: ${{ steps.classify.outputs.tests-only || 'false' }}
|
|
28
|
+
release: ${{ env.RELEASE }}
|
|
29
|
+
steps:
|
|
30
|
+
- if: env.RELEASE != 'true'
|
|
31
|
+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
32
|
+
with:
|
|
33
|
+
ref: ${{ github.event.pull_request.head.sha || github.sha }}
|
|
34
|
+
fetch-depth: 0
|
|
35
|
+
persist-credentials: false
|
|
36
|
+
- if: env.RELEASE != 'true'
|
|
37
|
+
uses: ./.github/actions/setup
|
|
38
|
+
- if: env.RELEASE != 'true'
|
|
39
|
+
id: classify
|
|
40
|
+
name: classify the change as docs-only, tests-only or full
|
|
41
|
+
env:
|
|
42
|
+
BASE_SHA: ${{ github.event.pull_request.base.sha }}
|
|
43
|
+
run: bunx checks-ci changes
|
|
44
|
+
|
|
45
|
+
static:
|
|
46
|
+
needs: changes
|
|
47
|
+
if: needs.changes.outputs.release != 'true'
|
|
48
|
+
runs-on: ubuntu-latest
|
|
49
|
+
timeout-minutes: 20
|
|
50
|
+
permissions:
|
|
51
|
+
contents: read
|
|
52
|
+
actions: write
|
|
53
|
+
steps:
|
|
54
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
55
|
+
with:
|
|
56
|
+
ref: ${{ github.event.pull_request.head.sha || github.sha }}
|
|
57
|
+
fetch-depth: 0
|
|
58
|
+
persist-credentials: false
|
|
59
|
+
- uses: ./.github/actions/setup
|
|
60
|
+
- name: cancel the run when a push to a draft pull request started it
|
|
61
|
+
env:
|
|
62
|
+
GH_TOKEN: ${{ github.token }}
|
|
63
|
+
DRAFT: ${{ github.event.pull_request.draft }}
|
|
64
|
+
run: bunx checks-ci draft-hold
|
|
65
|
+
- if: runner.environment == 'github-hosted'
|
|
66
|
+
name: cache the gitleaks the kit pins
|
|
67
|
+
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
|
68
|
+
with:
|
|
69
|
+
path: ~/.cache/avi2dg-checks/gitleaks
|
|
70
|
+
key: gitleaks-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('node_modules/@avi2dg/checks/src/delivery/gitleaks.ts') }}
|
|
71
|
+
- run: bunx checks-workflows
|
|
72
|
+
- run: bun run lint
|
|
73
|
+
- run: bun run build
|
|
74
|
+
- run: git diff --exit-code
|
|
75
|
+
- run: bun run typecheck
|
|
76
|
+
|
|
77
|
+
unit:
|
|
78
|
+
needs: changes
|
|
79
|
+
if: needs.changes.outputs.release != 'true' && needs.changes.outputs.docs-only != 'true'
|
|
80
|
+
runs-on: ubuntu-latest
|
|
81
|
+
timeout-minutes: 30
|
|
82
|
+
permissions:
|
|
83
|
+
contents: read
|
|
84
|
+
actions: write
|
|
85
|
+
steps:
|
|
86
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
87
|
+
with:
|
|
88
|
+
ref: ${{ github.event.pull_request.head.sha || github.sha }}
|
|
89
|
+
fetch-depth: 0
|
|
90
|
+
persist-credentials: false
|
|
91
|
+
- uses: ./.github/actions/setup
|
|
92
|
+
- name: cancel the run when a push to a draft pull request started it
|
|
93
|
+
env:
|
|
94
|
+
GH_TOKEN: ${{ github.token }}
|
|
95
|
+
DRAFT: ${{ github.event.pull_request.draft }}
|
|
96
|
+
run: bunx checks-ci draft-hold
|
|
97
|
+
- id: test
|
|
98
|
+
run: bunx checks-test --pr --tier=unit
|
|
99
|
+
- if: ${{ !cancelled() }}
|
|
100
|
+
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
|
101
|
+
with:
|
|
102
|
+
name: artifacts-${{ job.check_run_id }}
|
|
103
|
+
path: artifacts/
|
|
104
|
+
if-no-files-found: ignore
|
|
105
|
+
|
|
106
|
+
e2e:
|
|
107
|
+
needs: changes
|
|
108
|
+
if: needs.changes.outputs.release != 'true' && needs.changes.outputs.docs-only != 'true'
|
|
109
|
+
runs-on: ubuntu-latest
|
|
110
|
+
timeout-minutes: 30
|
|
111
|
+
permissions:
|
|
112
|
+
contents: read
|
|
113
|
+
actions: write
|
|
114
|
+
steps:
|
|
115
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
116
|
+
with:
|
|
117
|
+
ref: ${{ github.event.pull_request.head.sha || github.sha }}
|
|
118
|
+
fetch-depth: 0
|
|
119
|
+
persist-credentials: false
|
|
120
|
+
- uses: ./.github/actions/setup
|
|
121
|
+
- name: cancel the run when a push to a draft pull request started it
|
|
122
|
+
env:
|
|
123
|
+
GH_TOKEN: ${{ github.token }}
|
|
124
|
+
DRAFT: ${{ github.event.pull_request.draft }}
|
|
125
|
+
run: bunx checks-ci draft-hold
|
|
126
|
+
- id: test
|
|
127
|
+
run: bunx checks-test --pr --tier=e2e
|
|
128
|
+
- if: ${{ !cancelled() }}
|
|
129
|
+
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
|
130
|
+
with:
|
|
131
|
+
name: artifacts-${{ job.check_run_id }}
|
|
132
|
+
path: artifacts/
|
|
133
|
+
if-no-files-found: ignore
|
|
134
|
+
|
|
135
|
+
checks:
|
|
136
|
+
needs: [changes, static, unit, e2e]
|
|
137
|
+
if: always()
|
|
138
|
+
runs-on: ubuntu-latest
|
|
139
|
+
timeout-minutes: 5
|
|
140
|
+
permissions:
|
|
141
|
+
contents: read
|
|
142
|
+
statuses: write
|
|
143
|
+
pull-requests: read
|
|
144
|
+
steps:
|
|
145
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
146
|
+
with:
|
|
147
|
+
ref: ${{ github.event.pull_request.head.sha || github.sha }}
|
|
148
|
+
persist-credentials: false
|
|
149
|
+
- uses: ./.github/actions/setup
|
|
150
|
+
- name: require every result to be success
|
|
151
|
+
env:
|
|
152
|
+
RESULTS: ${{ toJSON(needs) }}
|
|
153
|
+
SKIPS: ${{ needs.changes.outputs.release == 'true' && 'static unit e2e' || needs.changes.outputs.docs-only == 'true' && 'unit e2e' || '' }}
|
|
154
|
+
run: bunx checks-ci require-success
|
|
155
|
+
# GitHub keeps a dispatched run's checks off the pull request, so the release pull request reads these statuses.
|
|
156
|
+
- if: always() && github.event_name == 'workflow_dispatch'
|
|
157
|
+
name: report the gate on the dispatched commit
|
|
158
|
+
env:
|
|
159
|
+
GH_TOKEN: ${{ github.token }}
|
|
160
|
+
JOB_STATUS: ${{ job.status }}
|
|
161
|
+
CONTEXT: checks
|
|
162
|
+
ATTEMPTS: "5"
|
|
163
|
+
run: bunx checks-ci commit-status
|
|
164
|
+
- if: always() && github.event_name == 'workflow_dispatch'
|
|
165
|
+
id: title
|
|
166
|
+
continue-on-error: true
|
|
167
|
+
env:
|
|
168
|
+
GH_TOKEN: ${{ github.token }}
|
|
169
|
+
run: bunx checks-commit-title
|
|
170
|
+
- if: always() && github.event_name == 'workflow_dispatch'
|
|
171
|
+
name: report the title as commitlint on the dispatched commit
|
|
172
|
+
env:
|
|
173
|
+
GH_TOKEN: ${{ github.token }}
|
|
174
|
+
JOB_STATUS: ${{ steps.title.outcome }}
|
|
175
|
+
CONTEXT: commitlint
|
|
176
|
+
ATTEMPTS: "5"
|
|
177
|
+
run: bunx checks-ci commit-status
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
name: main
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
|
|
7
|
+
permissions:
|
|
8
|
+
contents: read
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
suite:
|
|
12
|
+
if: "startsWith(github.event.head_commit.message, 'chore: release ')"
|
|
13
|
+
runs-on: ${{ vars.CI_RUNS_ON || 'ubuntu-latest' }}
|
|
14
|
+
timeout-minutes: 45
|
|
15
|
+
permissions:
|
|
16
|
+
contents: read
|
|
17
|
+
steps:
|
|
18
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
19
|
+
with:
|
|
20
|
+
fetch-depth: 0
|
|
21
|
+
persist-credentials: false
|
|
22
|
+
- uses: ./.github/actions/setup
|
|
23
|
+
- name: run the full test suite on the release commit
|
|
24
|
+
run: bun run test --full
|
|
25
|
+
|
|
26
|
+
binaries:
|
|
27
|
+
if: "startsWith(github.event.head_commit.message, 'chore: release ')"
|
|
28
|
+
runs-on: ${{ matrix.runner }}
|
|
29
|
+
timeout-minutes: 30
|
|
30
|
+
strategy:
|
|
31
|
+
matrix:
|
|
32
|
+
runner: [macos-latest, ubuntu-latest]
|
|
33
|
+
permissions:
|
|
34
|
+
contents: read
|
|
35
|
+
steps:
|
|
36
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
37
|
+
with:
|
|
38
|
+
persist-credentials: false
|
|
39
|
+
- uses: ./.github/actions/setup
|
|
40
|
+
- name: build the release binaries
|
|
41
|
+
run: bun run release:assets
|
|
42
|
+
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
|
43
|
+
with:
|
|
44
|
+
name: platform-binary-${{ matrix.runner }}
|
|
45
|
+
path: release-assets/subquo-*
|
|
46
|
+
if-no-files-found: error
|
|
47
|
+
|
|
48
|
+
release:
|
|
49
|
+
needs: [suite, binaries]
|
|
50
|
+
if: ${{ !cancelled() && (needs.suite.result == 'success' || needs.suite.result == 'skipped') && (needs.binaries.result == 'success' || needs.binaries.result == 'skipped') }}
|
|
51
|
+
runs-on: ${{ vars.CI_RUNS_ON || 'ubuntu-latest' }}
|
|
52
|
+
timeout-minutes: 15
|
|
53
|
+
concurrency:
|
|
54
|
+
group: main
|
|
55
|
+
cancel-in-progress: false
|
|
56
|
+
permissions:
|
|
57
|
+
contents: write
|
|
58
|
+
id-token: write
|
|
59
|
+
actions: read
|
|
60
|
+
pull-requests: read
|
|
61
|
+
outputs:
|
|
62
|
+
tag: ${{ steps.release.outputs.tag }}
|
|
63
|
+
steps:
|
|
64
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
65
|
+
with:
|
|
66
|
+
fetch-depth: 0
|
|
67
|
+
- uses: ./.github/actions/setup
|
|
68
|
+
# npm takes a trusted publish only from the Node it set up with its registry.
|
|
69
|
+
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
|
|
70
|
+
with:
|
|
71
|
+
node-version: "24"
|
|
72
|
+
registry-url: https://registry.npmjs.org
|
|
73
|
+
# The binaries job skips on a push that is no release commit, so there is nothing to download.
|
|
74
|
+
- if: needs.binaries.result == 'success'
|
|
75
|
+
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
|
|
76
|
+
with:
|
|
77
|
+
pattern: platform-binary-*
|
|
78
|
+
merge-multiple: true
|
|
79
|
+
path: ${{ runner.temp }}/platform-binaries
|
|
80
|
+
- id: release
|
|
81
|
+
env:
|
|
82
|
+
GH_TOKEN: ${{ github.token }}
|
|
83
|
+
CHECKS_PLATFORM_BINARIES: ${{ runner.temp }}/platform-binaries
|
|
84
|
+
run: bunx checks-release-tag
|
|
85
|
+
|
|
86
|
+
assets:
|
|
87
|
+
needs: release
|
|
88
|
+
if: ${{ !cancelled() && needs.release.result == 'success' && needs.release.outputs.tag != '' }}
|
|
89
|
+
runs-on: ${{ matrix.runner }}
|
|
90
|
+
timeout-minutes: 30
|
|
91
|
+
strategy:
|
|
92
|
+
matrix:
|
|
93
|
+
runner: [ubuntu-latest, macos-latest]
|
|
94
|
+
permissions:
|
|
95
|
+
contents: write
|
|
96
|
+
steps:
|
|
97
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
98
|
+
with:
|
|
99
|
+
ref: ${{ needs.release.outputs.tag }}
|
|
100
|
+
persist-credentials: false
|
|
101
|
+
- uses: ./.github/actions/setup
|
|
102
|
+
- name: build the release assets
|
|
103
|
+
run: bun run release:assets
|
|
104
|
+
- name: attach the release assets to the GitHub release
|
|
105
|
+
env:
|
|
106
|
+
GH_TOKEN: ${{ github.token }}
|
|
107
|
+
TAG: ${{ needs.release.outputs.tag }}
|
|
108
|
+
run: gh release upload "$TAG" release-assets/* --clobber
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
name: mutation
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_dispatch:
|
|
5
|
+
workflow_call:
|
|
6
|
+
|
|
7
|
+
concurrency:
|
|
8
|
+
group: mutation-refresh
|
|
9
|
+
cancel-in-progress: false
|
|
10
|
+
|
|
11
|
+
permissions:
|
|
12
|
+
contents: read
|
|
13
|
+
|
|
14
|
+
env:
|
|
15
|
+
RUNNER_ENVIRONMENT: github-hosted
|
|
16
|
+
|
|
17
|
+
jobs:
|
|
18
|
+
refresh-plan:
|
|
19
|
+
runs-on: ubuntu-latest
|
|
20
|
+
timeout-minutes: 15
|
|
21
|
+
permissions:
|
|
22
|
+
contents: read
|
|
23
|
+
actions: read
|
|
24
|
+
outputs:
|
|
25
|
+
shards: ${{ steps.shards.outputs.shards }}
|
|
26
|
+
steps:
|
|
27
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
28
|
+
with:
|
|
29
|
+
persist-credentials: false
|
|
30
|
+
- uses: ./.github/actions/setup
|
|
31
|
+
- name: restore the last full report
|
|
32
|
+
env:
|
|
33
|
+
GH_TOKEN: ${{ github.token }}
|
|
34
|
+
run: bunx checks-mutation-baseline --full "$RUNNER_TEMP/last-full/mutation.json"
|
|
35
|
+
- id: shards
|
|
36
|
+
name: split the tree into shards
|
|
37
|
+
env:
|
|
38
|
+
SHARDS: "4"
|
|
39
|
+
run: bunx checks-ci mutation shards
|
|
40
|
+
|
|
41
|
+
refresh-shard:
|
|
42
|
+
needs: refresh-plan
|
|
43
|
+
runs-on: ubuntu-latest
|
|
44
|
+
timeout-minutes: 60
|
|
45
|
+
strategy:
|
|
46
|
+
matrix:
|
|
47
|
+
shard: ${{ fromJSON(needs.refresh-plan.outputs.shards) }}
|
|
48
|
+
permissions:
|
|
49
|
+
contents: read
|
|
50
|
+
steps:
|
|
51
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
52
|
+
with:
|
|
53
|
+
persist-credentials: false
|
|
54
|
+
- uses: ./.github/actions/setup
|
|
55
|
+
- name: run one shard
|
|
56
|
+
env:
|
|
57
|
+
SHARD: ${{ matrix.shard }}
|
|
58
|
+
run: bunx stryker run --mutate "$SHARD"
|
|
59
|
+
# A lone shard's artifact downloads with no folder of its own, so only the file's name tells the reports apart.
|
|
60
|
+
- name: name the report after its shard
|
|
61
|
+
env:
|
|
62
|
+
INDEX: ${{ strategy.job-index }}
|
|
63
|
+
run: mv reports/mutation/mutation.json "reports/mutation/shard-$INDEX.json"
|
|
64
|
+
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
|
65
|
+
with:
|
|
66
|
+
name: mutation-shard-${{ strategy.job-index }}
|
|
67
|
+
path: reports/mutation/shard-${{ strategy.job-index }}.json
|
|
68
|
+
retention-days: 1
|
|
69
|
+
if-no-files-found: error
|
|
70
|
+
|
|
71
|
+
refresh-merge:
|
|
72
|
+
needs: [refresh-plan, refresh-shard]
|
|
73
|
+
runs-on: ubuntu-latest
|
|
74
|
+
timeout-minutes: 15
|
|
75
|
+
permissions:
|
|
76
|
+
contents: read
|
|
77
|
+
actions: write
|
|
78
|
+
steps:
|
|
79
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
80
|
+
with:
|
|
81
|
+
persist-credentials: false
|
|
82
|
+
- uses: ./.github/actions/setup
|
|
83
|
+
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
|
|
84
|
+
with:
|
|
85
|
+
pattern: mutation-shard-*
|
|
86
|
+
path: shards
|
|
87
|
+
merge-multiple: true
|
|
88
|
+
- name: merge the shard reports
|
|
89
|
+
run: bunx checks-mutation-merge reports/mutation/mutation.json shards/shard-*.json
|
|
90
|
+
- if: always()
|
|
91
|
+
name: score the refresh
|
|
92
|
+
run: bunx checks-ci mutation score
|
|
93
|
+
- name: slim the merged report
|
|
94
|
+
run: bunx checks-mutation-baseline --slim reports/mutation/mutation.json "$RUNNER_TEMP/full/mutation.json"
|
|
95
|
+
- name: save the merged report as the state a baseline starts from
|
|
96
|
+
run: cp "$RUNNER_TEMP/full/mutation.json" "$RUNNER_TEMP/full/stryker-incremental.json"
|
|
97
|
+
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
|
98
|
+
with:
|
|
99
|
+
name: mutation-baseline-full
|
|
100
|
+
path: ${{ runner.temp }}/full/
|
|
101
|
+
retention-days: 30
|
|
102
|
+
if-no-files-found: error
|
|
103
|
+
- name: prune superseded baselines
|
|
104
|
+
env:
|
|
105
|
+
GH_TOKEN: ${{ github.token }}
|
|
106
|
+
run: bunx checks-mutation-baseline --prune
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
name: pr-title
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
types: [opened, synchronize, reopened, edited]
|
|
6
|
+
|
|
7
|
+
concurrency:
|
|
8
|
+
group: pr-title-${{ github.event.pull_request.number }}-${{ (github.event.action != 'edited' || github.event.changes.title != null) && 'title' || github.run_id }}
|
|
9
|
+
cancel-in-progress: true
|
|
10
|
+
|
|
11
|
+
permissions:
|
|
12
|
+
contents: read
|
|
13
|
+
|
|
14
|
+
jobs:
|
|
15
|
+
title:
|
|
16
|
+
if: github.event.action != 'edited' || github.event.changes.title != null
|
|
17
|
+
runs-on: ubuntu-latest
|
|
18
|
+
timeout-minutes: 10
|
|
19
|
+
permissions:
|
|
20
|
+
contents: read
|
|
21
|
+
statuses: write
|
|
22
|
+
pull-requests: read
|
|
23
|
+
steps:
|
|
24
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
25
|
+
with:
|
|
26
|
+
ref: ${{ github.event.pull_request.head.sha }}
|
|
27
|
+
persist-credentials: false
|
|
28
|
+
- uses: ./.github/actions/setup
|
|
29
|
+
- id: title
|
|
30
|
+
env:
|
|
31
|
+
PR_TITLE: ${{ github.event.pull_request.title }}
|
|
32
|
+
GH_TOKEN: ${{ github.token }}
|
|
33
|
+
run: bunx checks-commit-title
|
|
34
|
+
# Branch protection reads the title as the commitlint status, which an edit to the title rewrites.
|
|
35
|
+
- if: always()
|
|
36
|
+
name: report the commitlint status
|
|
37
|
+
env:
|
|
38
|
+
GH_TOKEN: ${{ github.token }}
|
|
39
|
+
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
|
|
40
|
+
JOB_STATUS: ${{ steps.title.outcome }}
|
|
41
|
+
CONTEXT: commitlint
|
|
42
|
+
ATTEMPTS: "5"
|
|
43
|
+
run: bunx checks-ci commit-status
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
name: release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_dispatch:
|
|
5
|
+
|
|
6
|
+
permissions:
|
|
7
|
+
contents: read
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
pull-request:
|
|
11
|
+
runs-on: ${{ vars.CI_RUNS_ON || 'ubuntu-latest' }}
|
|
12
|
+
timeout-minutes: 10
|
|
13
|
+
concurrency:
|
|
14
|
+
group: release-pull-request
|
|
15
|
+
cancel-in-progress: false
|
|
16
|
+
permissions:
|
|
17
|
+
contents: write
|
|
18
|
+
pull-requests: write
|
|
19
|
+
actions: write
|
|
20
|
+
steps:
|
|
21
|
+
# A rerun plans the branch tip, not the commit the dispatch named.
|
|
22
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
23
|
+
with:
|
|
24
|
+
ref: ${{ github.ref }}
|
|
25
|
+
fetch-depth: 0
|
|
26
|
+
- uses: ./.github/actions/setup
|
|
27
|
+
- env:
|
|
28
|
+
GH_TOKEN: ${{ github.token }}
|
|
29
|
+
run: bunx checks-release-pr ci.yml
|
|
30
|
+
- name: delete the runs held for approval on the branch tip
|
|
31
|
+
env:
|
|
32
|
+
GH_TOKEN: ${{ github.token }}
|
|
33
|
+
BRANCH: release/${{ github.ref_name }}
|
|
34
|
+
run: bunx checks-ci held-runs
|
package/.jscpd.json
ADDED
package/AGENTS.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Project agent memory
|
|
2
|
+
|
|
3
|
+
subquo reads the quota left on paid AI coding accounts into one snapshot, and `README.md` holds what a person reads.
|
|
4
|
+
`VISION.md` holds what subquo is for and what it refuses, so read it before adding scope.
|
|
5
|
+
|
|
6
|
+
## Before you change a part
|
|
7
|
+
|
|
8
|
+
- The snapshot, a reader or a login read: read [The quota snapshot design](docs/design.md) first, and keep its open questions open until a source settles them.
|
|
9
|
+
- A doc page: start from its template in `templates/`, and read [checks-docs](https://github.com/avi2d/checks/blob/main/docs/gates/checks-docs.md) for the rules.
|
|
10
|
+
- A workflow: rewrite the callers with `bunx checks-workflows --write`, and never edit `.github/workflows/` by hand.
|
|
11
|
+
- A check: run `bun run lint` and `bun run typecheck` before a pull request.
|
|
12
|
+
|
|
13
|
+
## Public repository
|
|
14
|
+
|
|
15
|
+
- No token, login path, account name or machine name goes into a file, a fixture or a log, as [Secrets](docs/design.md#secrets) says.
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
Every release of `@avi2dg/subquo`, newest first, written by the release from its conventional commits.
|
|
4
|
+
|
|
5
|
+
## 0.1.0
|
|
6
|
+
|
|
7
|
+
Released 2026-11-26.
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
- publish subquo to npm [#15](https://github.com/avi2d/subquo/pull/15)
|
|
12
|
+
- ship subquo as a compiled release executable [#13](https://github.com/avi2d/subquo/pull/13)
|
|
13
|
+
- **cli:** remove subquo compare and the clauth_profile account field [#12](https://github.com/avi2d/subquo/pull/12)
|
|
14
|
+
- **accounts:** read Codex logins that Pi saved [#10](https://github.com/avi2d/subquo/pull/10)
|
|
15
|
+
- compare Claude quota with clauth [#8](https://github.com/avi2d/subquo/pull/8)
|
|
16
|
+
- collect and read quota beside existing tools [#7](https://github.com/avi2d/subquo/pull/7)
|
|
17
|
+
- define subquo.v1 quota snapshot [#6](https://github.com/avi2d/subquo/pull/6)
|
|
18
|
+
|
|
19
|
+
### Fixes
|
|
20
|
+
|
|
21
|
+
- cancel the unpublished 0.1.0 release [#17](https://github.com/avi2d/subquo/pull/17)
|
package/CLAUDE.md
ADDED
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 avi2d
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# subquo
|
|
2
|
+
|
|
3
|
+
subquo reads how much quota is left on each paid AI coding subscription a person names, such as Claude, OpenAI Codex and OpenCode Go accounts.
|
|
4
|
+
It writes each account's windows, percent left and reset times into one snapshot file.
|
|
5
|
+
A scheduler, a dashboard or a launch guard then reads the same data.
|
|
6
|
+
You can collect and read snapshots beside your existing quota tools without changing any reader.
|
|
7
|
+
|
|
8
|
+
## Before you begin
|
|
9
|
+
|
|
10
|
+
- Bun.
|
|
11
|
+
- Linux x64 or macOS arm64 for the compiled executable.
|
|
12
|
+
|
|
13
|
+
## Install
|
|
14
|
+
|
|
15
|
+
To install subquo:
|
|
16
|
+
|
|
17
|
+
1. Add the package:
|
|
18
|
+
|
|
19
|
+
```sh
|
|
20
|
+
bun add @avi2dg/subquo
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
1. Run the command:
|
|
24
|
+
|
|
25
|
+
```sh
|
|
26
|
+
bunx subquo read
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
The command runs from source when the compiled executable is unavailable.
|
|
30
|
+
|
|
31
|
+
## Run beside your quota tools
|
|
32
|
+
|
|
33
|
+
[Collect snapshots and renew idle logins](docs/shadow-run.md) on each machine where the vendors saved logins.
|
|
34
|
+
|
|
35
|
+
## Check a change
|
|
36
|
+
|
|
37
|
+
To run the checks a pull request runs, clone the repository and install dependencies with the Bun version in `.bun-version`.
|
|
38
|
+
Run `bun install` from the repository root, then follow these steps:
|
|
39
|
+
|
|
40
|
+
1. Run oxlint and every gate of the checks kit:
|
|
41
|
+
|
|
42
|
+
```sh
|
|
43
|
+
bun run lint
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
1. Run the type check and the Effect diagnostics:
|
|
47
|
+
|
|
48
|
+
```sh
|
|
49
|
+
bun run typecheck
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
1. Run the tests:
|
|
53
|
+
|
|
54
|
+
```sh
|
|
55
|
+
bun run test
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
A passing lint ends with `checks-lint: <count> gate(s) pass`.
|
|
59
|
+
|
|
60
|
+
## Where things are
|
|
61
|
+
|
|
62
|
+
| Path | What it holds |
|
|
63
|
+
| --- | --- |
|
|
64
|
+
| `VISION.md` | what subquo is for and what it refuses |
|
|
65
|
+
| `docs/design.md` | the reader and snapshot design, with its open questions |
|
|
66
|
+
| `docs/accounts.md` | the private account list format and a copyable example |
|
|
67
|
+
| `docs/stage-1-findings.md` | what the login checks show about expiry, setup tokens and renewal |
|
|
68
|
+
| `src/index.ts` | the snapshot schema and the helpers that read, write and check its age |
|
|
69
|
+
| `src/cli.ts` | the `refresh` and `read` commands |
|
|
70
|
+
| `tests/unit/` | tests |
|
|
71
|
+
| `tests/fixtures/snapshots/` | sample snapshots with made-up accounts |
|
|
72
|
+
| `templates/` | the page templates a new doc starts from |
|
|
73
|
+
| `.github/workflows/` | the CI callers the checks kit writes |
|
|
74
|
+
|
|
75
|
+
## Related topics
|
|
76
|
+
|
|
77
|
+
- [The quota snapshot design](docs/design.md)
|
|
78
|
+
- [The account list](docs/accounts.md)
|
|
79
|
+
- [Stage 1 findings](docs/stage-1-findings.md)
|
|
80
|
+
- [The checks kit](https://github.com/avi2d/checks)
|