Skip to content

Commit 023bcc8

Browse files
committed
test: extend deep audit parity
1 parent 3543493 commit 023bcc8

14 files changed

Lines changed: 261 additions & 55 deletions

File tree

.github/workflows/ci.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ jobs:
5353
- name: Build
5454
run: npm run build
5555

56-
audit-prod:
57-
name: Production dependency audit
56+
audit-ci:
57+
name: Dependency audit
5858
runs-on: ubuntu-latest
5959
steps:
6060
- name: Checkout
@@ -71,5 +71,5 @@ jobs:
7171
- name: Install dependencies
7272
run: npm ci
7373

74-
- name: Audit production dependencies (high+)
75-
run: npm run audit:prod
74+
- name: Audit dependencies and dev allowlist
75+
run: npm run audit:ci

AGENTS.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ OpenCode plugin: intercepts OpenAI SDK calls, routes through ChatGPT Codex backe
4444
- Source: root `index.ts` + `lib/`; `dist/` is generated output.
4545
- ESLint flat config: `no-explicit-any` enforced, unused args prefixed `_`.
4646
- Tests relax lint rules (see `eslint.config.js`).
47-
- Build emits `dist/lib/oauth-success.html` from the TypeScript source via `scripts/copy-oauth-success.js`.
47+
- Build cleans `dist/`, then emits `dist/lib/oauth-success.html` from the TypeScript source via `scripts/copy-oauth-success.js`.
4848
- ESM only (`"type": "module"`), Node >= 18.
4949

5050
## ANTI-PATTERNS (THIS PROJECT)
@@ -55,7 +55,7 @@ OpenCode plugin: intercepts OpenAI SDK calls, routes through ChatGPT Codex backe
5555

5656
## COMMANDS
5757
```bash
58-
npm run build # tsc + copy oauth-success.html
58+
npm run build # clean dist + tsc + copy oauth-success.html
5959
npm run typecheck # type checking only
6060
npm test # vitest once
6161
npm run test:coverage # vitest coverage

docs/audits/_meta/verification-report.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
> Audit source: 3331324cb14d2b80dd8dfb424619870a88476706 | Generated: 2026-04-25T12:45:33+08:00
1+
> Audit source: 3331324cb14d2b80dd8dfb424619870a88476706 | Generated: 2026-04-25T14:08:35+08:00
22
33
# Verification Report
44

@@ -11,14 +11,18 @@ Local checks completed during the refresh:
1111
| `npm.cmd test -- test/doc-parity.test.ts test/index.test.ts` | Passed |
1212
| `npm.cmd test -- test/install-oc-codex-multi-auth.test.ts --reporter verbose` | Passed |
1313
| Deep current-doc structure sweep | Passed: 66 current documentation files checked; 21 registry entries match 21 tool modules; no stale structure anchors; no missing `npm run` script references |
14-
| `npm.cmd test -- test/doc-parity.test.ts` | Passed: 9 tests |
14+
| Deep multi-surface structure sweep | Passed: 320 repo files checked across workflows, package metadata, config models, docs, tool registry, tests, and static secret fixtures |
15+
| `npm.cmd test -- test/doc-parity.test.ts test/model-map.test.ts test/index.test.ts` | Passed: 3 files, 190 tests |
16+
| `npm.cmd test -- test/doc-parity.test.ts` | Passed: 12 tests |
17+
| `npm.cmd test -- test/clean-dist.test.ts test/doc-parity.test.ts` | Passed: 2 files, 15 tests |
1518
| `npm.cmd run lint` | Passed |
1619
| `npm.cmd run typecheck` | Passed |
17-
| `npm.cmd test` | Passed: 83 files, 2362 passed, 1 skipped |
18-
| `npm.cmd run test:coverage` | Passed: statements 80.38%, branches 71.6%, functions 89%, lines 81.92% |
19-
| `npm.cmd run build` | Passed |
20+
| `npm.cmd test` | Passed: 84 files, 2369 passed, 1 skipped |
21+
| `npm.cmd run test:coverage` | Passed: statements 80.39%, branches 71.62%, functions 89.01%, lines 81.94% |
22+
| `npm.cmd run build` | Passed; build now cleans `dist/` before compiling |
2023
| `npm.cmd run audit:ci` | Passed; production audit reported existing moderate advisories only under the configured high-severity gate |
21-
| `npm.cmd pack --pack-destination <temp>\pack` | Passed; produced `oc-codex-multi-auth-6.1.7.tgz` |
24+
| `npm.cmd pack --json --pack-destination <temp>\pack` | Passed; produced `oc-codex-multi-auth-6.1.7.tgz` |
25+
| `tar -tf <tarball> | findstr /i "_shared"` | Passed; rebuilt package no longer contains stale deleted `_shared` outputs |
2226
| `npm.cmd install <tarball> --ignore-scripts` | Passed in a fresh temp project |
2327
| `node --input-type=module -e 'await import("oc-codex-multi-auth"); await import("oc-codex-multi-auth/tui");'` | Passed; main default export resolved as a function and TUI export exposed `default` plus `shouldRefreshQuotaForEvent` |
2428
| `node node_modules\oc-codex-multi-auth\scripts\install-oc-codex-multi-auth.js --dry-run --no-cache-clear` | Passed against a temp HOME; only dry-run writes/removals were reported |

docs/development/TESTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ What they cover:
2121
- `typecheck`: `tsc --noEmit`
2222
- `test`: Vitest suite across auth, config, request transformation, storage, UI, recovery, and rotation
2323
- `test:coverage`: Vitest coverage threshold gate from `vitest.config.ts`; statements/functions/lines keep an 80% global floor, while branch and legacy `index.ts` floors are calibrated to the current baseline
24-
- `build`: compile TypeScript and materialize `dist/lib/oauth-success.html` from `lib/oauth-success.ts` via `scripts/copy-oauth-success.js`
24+
- `build`: clean `dist/`, compile TypeScript, and materialize `dist/lib/oauth-success.html` from `lib/oauth-success.ts` via `scripts/copy-oauth-success.js`
2525
- `audit:ci`: production dependency audit plus the dev-advisory allowlist
2626

2727
## Current High-Value Test Areas

lib/tools/AGENTS.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ tool into the OpenCode plugin surface.
1313
```
1414
lib/tools/
1515
AGENTS.md
16-
_shared.ts # re-exports closure-free helpers from lib/runtime.ts
1716
index.ts # ToolContext type + createToolRegistry(ctx) barrel
1817
codex-list.ts # one file per tool
1918
codex-switch.ts

lib/tools/_shared.ts

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

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
"url": "https://github.com/ndycode/oc-codex-multi-auth/issues"
4545
},
4646
"scripts": {
47-
"build": "tsc && node scripts/copy-oauth-success.js",
47+
"build": "node scripts/clean-dist.js && tsc && node scripts/copy-oauth-success.js",
4848
"typecheck": "tsc --noEmit",
4949
"lint": "npm run lint:ts && npm run lint:scripts",
5050
"lint:ts": "eslint . --ext .ts",

scripts/clean-dist.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import { promises as fs } from "node:fs";
2+
import { dirname, relative, resolve } from "node:path";
3+
import { fileURLToPath } from "node:url";
4+
5+
const __filename = fileURLToPath(import.meta.url);
6+
const __dirname = dirname(__filename);
7+
8+
function normalizeRelativePath(path) {
9+
return path.replaceAll("\\", "/");
10+
}
11+
12+
export async function cleanDist(options = {}) {
13+
const repoRoot = resolve(options.repoRoot ?? resolve(__dirname, ".."));
14+
const distDir = resolve(options.distDir ?? resolve(repoRoot, "dist"));
15+
const relativeDist = normalizeRelativePath(relative(repoRoot, distDir));
16+
17+
if (relativeDist !== "dist") {
18+
throw new Error(`Refusing to clean non-dist path: ${distDir}`);
19+
}
20+
21+
await fs.rm(distDir, { recursive: true, force: true });
22+
return { distDir };
23+
}
24+
25+
if (process.argv[1] && resolve(process.argv[1]) === __filename) {
26+
await cleanDist();
27+
}

test/AGENTS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ test/
2121
├── codex.test.ts # Codex instructions/caching
2222
├── config.test.ts # configuration parsing/merging
2323
├── context-overflow.test.ts # context length handling
24+
├── clean-dist.test.ts # build cleanup script tests
2425
├── copy-oauth-success.test.ts # build script tests
2526
├── doc-parity.test.ts # docs/config/current-structure parity
2627
├── errors.test.ts # custom error types

test/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ test/
2121
├── codex.test.ts # Codex prompt/instructions behavior
2222
├── config.test.ts # Configuration parsing/merging tests
2323
├── context-overflow.test.ts # Context length handling tests
24+
├── clean-dist.test.ts # Build cleanup script tests
2425
├── copy-oauth-success.test.ts # Build script tests
2526
├── doc-parity.test.ts # Documentation/config/current-structure parity
2627
├── errors.test.ts # Custom error type tests

0 commit comments

Comments
 (0)