Skip to content

Commit 9ebb316

Browse files
committed
Add CI pipelines, pre-commit secret guard, untrack docs/
- .github/workflows/test.yml: typecheck + vitest on Node 20 & 22, push/PR/manual - .github/workflows/build.yml: chained workflow_run trigger, only runs on Test success, compiles dist/ and uploads as a workflow artifact - scripts/check-secrets.mjs: pre-commit guard against historical real Wave tokens + auth-context literals without placeholder prefixes - scripts/install-git-hooks.mjs: auto-wires the hook on `npm install` via `prepare` - Untrack docs/: api-map + captured-queries kept locally only; reverse-engineering notes are sensitive enough not to publish even in a private repo - Switch author email to GitHub no-reply (publish-safe)
1 parent 1a59896 commit 9ebb316

9 files changed

Lines changed: 304 additions & 391 deletions

File tree

.github/workflows/build.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: Build
2+
3+
# Pipeline 2 of 2 — compile TypeScript → dist/ and upload it as a workflow artifact
4+
# you can download for distribution. Triggers only when the Test pipeline succeeds
5+
# on `main` (so PR builds don't produce artifacts and broken main never publishes).
6+
# Can also be invoked manually via the Actions tab.
7+
8+
on:
9+
workflow_run:
10+
workflows: [Test]
11+
types: [completed]
12+
branches: [main]
13+
workflow_dispatch:
14+
15+
permissions:
16+
contents: read
17+
18+
concurrency:
19+
group: build-${{ github.ref }}
20+
cancel-in-progress: true
21+
22+
jobs:
23+
build:
24+
name: Compile + upload dist
25+
runs-on: ubuntu-latest
26+
27+
# When invoked via `workflow_run`, we only run if the upstream Test workflow passed.
28+
# `workflow_dispatch` bypasses this guard so you can always run a manual build.
29+
if: >-
30+
${{
31+
github.event_name == 'workflow_dispatch' ||
32+
github.event.workflow_run.conclusion == 'success'
33+
}}
34+
35+
steps:
36+
- name: Checkout
37+
# For workflow_run triggers, default checkout pulls the workflow file commit,
38+
# not the head of the triggering run. Pin to the SHA that the Test workflow ran on.
39+
uses: actions/checkout@v4
40+
with:
41+
ref: ${{ github.event.workflow_run.head_sha || github.sha }}
42+
43+
- name: Set up Node 22
44+
uses: actions/setup-node@v4
45+
with:
46+
node-version: '22'
47+
cache: npm
48+
49+
- name: Install dependencies
50+
run: npm ci --ignore-scripts
51+
52+
- name: Build
53+
run: npm run build
54+
55+
- name: Verify entry point exists
56+
run: |
57+
test -f dist/server.js \
58+
&& echo "dist/server.js OK ($(stat -c%s dist/server.js 2>/dev/null || stat -f%z dist/server.js) bytes)" \
59+
|| (echo "MISSING dist/server.js after build" && exit 1)
60+
61+
- name: Upload dist artifact
62+
uses: actions/upload-artifact@v4
63+
with:
64+
name: dist-${{ github.event.workflow_run.head_sha || github.sha }}
65+
path: dist/
66+
if-no-files-found: error
67+
retention-days: 30

.github/workflows/test.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Test
2+
3+
# Pipeline 1 of 2 — typecheck + vitest suite. Runs on every push/PR.
4+
# All vitest tests are written against mocked fetch / stubbed puppeteer drivers, so
5+
# no production Wave credentials are touched here. The Build workflow (pipeline 2)
6+
# is chained off this one and only runs if Test passes on `main`.
7+
8+
on:
9+
push:
10+
branches: [main]
11+
pull_request:
12+
workflow_dispatch:
13+
14+
permissions:
15+
contents: read
16+
17+
concurrency:
18+
group: test-${{ github.ref }}
19+
cancel-in-progress: true
20+
21+
jobs:
22+
test:
23+
name: Node ${{ matrix.node }}
24+
runs-on: ubuntu-latest
25+
strategy:
26+
fail-fast: false
27+
matrix:
28+
node: ['20', '22']
29+
30+
steps:
31+
- name: Checkout
32+
uses: actions/checkout@v4
33+
34+
- name: Set up Node ${{ matrix.node }}
35+
uses: actions/setup-node@v4
36+
with:
37+
node-version: ${{ matrix.node }}
38+
cache: npm
39+
40+
# We deliberately use `npm ci --ignore-scripts` to skip the `prepare` hook —
41+
# CI runners don't need a pre-commit hook installed and the install script's
42+
# /.git check would fail anyway on a fresh checkout-with-no-hooks-dir.
43+
- name: Install dependencies
44+
run: npm ci --ignore-scripts
45+
46+
- name: Type-check
47+
run: npm run typecheck
48+
49+
- name: Run tests
50+
run: npm test

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,10 @@ Thumbs.db
4545
# ─── Misc local-only ─────────────────────────────────────────────────────────
4646
NOTES.md
4747
*.local
48+
49+
# ─── Reverse-engineering notes — kept locally, not for the public repo ───────
50+
# `docs/` documents Wave's internal endpoints + verbatim GraphQL queries we
51+
# captured during development. Useful reference for you, sensitive if leaked
52+
# (could be used to abuse Wave's internal API). Kept out of git deliberately.
53+
docs/
54+

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ You can use, modify, and redistribute this freely. There's no warranty; if it br
188188

189189
Brief pointers if you want to hack on this:
190190

191-
- Source layout, API map, and captured GraphQL operations: see [docs/api-map.md](./docs/api-map.md) and [docs/captured-queries.md](./docs/captured-queries.md)
191+
- Source layout, API map, and captured GraphQL operations live in `docs/` locally — gitignored on purpose so the reverse-engineering reference doesn't get committed to a public mirror.
192192
- Run the test suite: `npm test` (or `npm run test:coverage` for an HTML coverage report in `coverage/`)
193193
- Smoke-test against a live Wave account: `WAVE_AUTH_TOKEN=... npm run smoke`
194194
- An experimental browser-driven login flow is available via `npx waveapps-mcp login` — it uses puppeteer-core + the stealth plugin to try to get past Google's OAuth check. Often blocked; the manual `paste` flow above is more reliable.

docs/api-map.md

Lines changed: 0 additions & 190 deletions
This file was deleted.

0 commit comments

Comments
 (0)