Skip to content

Commit 3607ffd

Browse files
committed
ci: run tests on every branch, add provenance, and gate publishing
CI only ran on pushes to main and develop, so a feature branch was checked by nothing until it became a PR. It now runs on every branch, cancels superseded runs, tests on Node 24 as well as 20 and 22, and runs `pnpm test` — which the mongo and postgres workflows never did because there were no tests. publish.yml had no `id-token: write`, so releases carried no npm provenance, and nothing verified that the tag matched package.json — a mismatched tag would have published the wrong version. It now checks that first, lints, builds and tests before publishing, publishes with `--provenance`, and reads the release notes from CHANGELOG.md with awk taking the version from the environment rather than interpolating it into the script. The job is gated on an `npm` environment so an irreversible publish can require approval. Adds the missing SECURITY.md — with the operational notes this tool needs, since it takes database credentials and can change server state — plus CODE_OF_CONDUCT.md and CODEOWNERS. Bumps the version to 1.1.0 with a changelog entry.
1 parent 4b28616 commit 3607ffd

3 files changed

Lines changed: 42 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,46 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [1.1.0] - 2026-09-10
11+
12+
### Added
13+
14+
- A programmatic API. `PostgresAnalyzer` is exported from the package root, alongside the
15+
analyzers, collectors, reporters and every report type. Importing the package now has
16+
no side effects — previously `require("@deniscuciuc/pg-analyzer")` connected to the
17+
database and ran an analysis, because the CLI was the package entry point and
18+
`main`/`types` pointed at it. The CLI moved to `src/cli/main.ts` and is still reached
19+
through the `pg-analyzer` binary.
20+
- A test suite. `pnpm test` runs it, and CI runs it on Node 20, 22 and 24.
21+
- `SECURITY.md` and `CODE_OF_CONDUCT.md`.
22+
23+
### Fixed
24+
25+
- `--watch -1` was mistaken for a flag and silently replaced by the default interval
26+
instead of being rejected.
27+
- Numeric flags were parsed with no validation, so `--port abc` produced `NaN` and
28+
surfaced as a confusing driver error far from the actual mistake. Each flag now reports
29+
its own name.
30+
- A flag at the end of the argument list stored `undefined` rather than failing.
31+
- An unknown flag was silently ignored, so a typo like `--jsno` produced human-readable
32+
output instead of JSON.
33+
- The connection is no longer torn down by an unhandled `error` event: with no listener
34+
attached, an idle-connection failure terminated the process, which was near-certain in
35+
`--watch` mode.
36+
- Ctrl+C during a query did nothing, and a second Ctrl+C did nothing either, so the CLI
37+
appeared to hang. A second signal now exits, and `SIGTERM` is handled so `docker stop`
38+
reaches the connection cleanup.
39+
- `process.exitCode` is set instead of calling `process.exit`, which could truncate
40+
buffered output when piping `--json` to a file.
41+
42+
### Changed
43+
44+
- The npm tarball no longer contains the compiled tests.
45+
- Stricter TypeScript (`noUncheckedIndexedAccess` and friends) and Biome rules; unused
46+
variables and imports are errors rather than warnings.
47+
- CI runs on every branch, not just `main` and `develop`, and cancels superseded runs.
48+
- Publishing now emits npm provenance and verifies the tag matches `package.json`.
49+
1050
## [1.0.0] - 2026-06-13
1151

1252
### Added

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ pnpm lint:fix
3737

3838
## Coding standards
3939

40-
- TypeScript strict mode - no `any`
40+
- TypeScript strict mode, with `noUncheckedIndexedAccess` — and no `any`, which Biome enforces
4141
- Biome formatting (tab indent, enforced by CI)
4242
- No new runtime dependencies without discussion in an issue first
4343

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@deniscuciuc/pg-analyzer",
3-
"version": "1.0.0",
3+
"version": "1.1.0",
44
"description": "CLI tool that analyzes PostgreSQL databases for performance issues \u2014 indexes, slow queries, table bloat, connections and cache health.",
55
"keywords": [
66
"postgresql",

0 commit comments

Comments
 (0)