Skip to content

fix(stricli): stop advertising -H as the --help-all alias#1057

Merged
BYK merged 1 commit into
mainfrom
fix/stricli-help-all-alias-display
Jun 3, 2026
Merged

fix(stricli): stop advertising -H as the --help-all alias#1057
BYK merged 1 commit into
mainfrom
fix/stricli-help-all-alias-display

Conversation

@BYK

@BYK BYK commented Jun 3, 2026

Copy link
Copy Markdown
Member

Summary

Follow-up to the @stricli/core patch that frees the -H alias for our api command (gh-style -H "Key: Value" headers). While the patch already removed -H from Stricli's input parsing and reserved-alias guard, the help renderer still displayed -H as the alias for --help-all. In sentry api --help this collides visually with the command-level -H / --header alias.

This PR extends the patch to drop -H from both help-all display sites:

  • Flags table rowaliases: "-H"aliases: "" (the --help-all row now shows no alias)
  • Usage-line generator — always yield --help-all, never -H

Both dist/index.js (ESM) and dist/index.cjs (CJS) are patched for defense-in-depth (8 hunks total: 4 per file).

--help-all / --helpAll continue to work; only the cosmetic alias display is removed.

Before / After (sentry api --helpAll)

Before — -H appeared twice (header alias and help-all alias):

  -H [--header]...     Add a HTTP request header in key:value format
  -h  --help           Print help information and exit
  -H  --help-all       Print help information (including hidden commands/flags) and exit

After — -H only maps to --header; help-all shows no alias:

  -H [--header]...     Add a HTTP request header in key:value format
  -h  --help           Print help information and exit
      --help-all       Print help information (including hidden commands/flags) and exit

Patch filename retarget (1.2.5 → 1.2.7)

The patch was keyed to @stricli/core@1.2.5 while 1.2.7 is installed. The patch applies unchanged across the bump, but check:patches emitted a (non-fatal) version-mismatch warning. Renamed the patch file to @stricli%2Fcore@1.2.7.patch and updated package.json + lockfile so check:patches now reports a clean match.

Context

This is the cosmetic half of a -H investigation. The other half — a contributor hitting InternalError: Unable to use reserved alias -H — was a patch-not-applied problem on their machine (installed with a non-pnpm package manager / stale node_modules), not a code bug and not a Stricli 1.2.7 change. -H has been Stricli's help-all alias since at least 1.2.4 (verified against pristine npm tarballs for 1.2.4/1.2.5/1.2.7).

Testing

  • pnpm run check:patches → ✓ all patched dependency versions match
  • pnpm run typecheck → passes (also regenerates docs + SDK, which import every command incl. api.ts — no reserved-alias crash)
  • pnpm run lint → clean (766 files)
  • Manual: sentry api --helpAll renders as shown above
  • Verified patch applies to both dist/index.js (ESM) and dist/index.cjs (CJS) in installed node_modules/@stricli/core
  • E2E tests pass in CI (local worktree e2e failures are pre-existing/environmental)

@github-actions

github-actions Bot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Codecov Results 📊

✅ Patch coverage is 100.00%. Project has 4338 uncovered lines.
✅ Project coverage is 82.07%. Comparing base (base) to head (head).

Coverage diff
@@            Coverage Diff             @@
##          main       #PR       +/-##
==========================================
+ Coverage    81.97%    82.07%     +0.1%
==========================================
  Files          334       335        +1
  Lines        24157     24193       +36
  Branches     15807     15839       +32
==========================================
+ Hits         19802     19855       +53
- Misses        4355      4338       -17
- Partials      1659      1659         —

Generated by Codecov Action

Our @stricli/core patch already frees the `-H` alias (used by `api -H`
for headers, gh-style) by removing it from input parsing and the
reserved-alias guard. However the help renderer still displayed `-H`
as the alias for `--help-all`, which collides visually with the
command-level `-H`/`--header` alias in `sentry api --help`.

Extend the patch to drop `-H` from both help-all display sites:
- the flags table row (`aliases: "-H"` -> `aliases: ""`)
- the usage-line generator (always yield `--help-all`, never `-H`)

`--help-all` / `--helpAll` still work; only the cosmetic alias display
is removed.

Also retarget the patch filename from 1.2.5 to the installed 1.2.7 so
`check:patches` reports a clean match (the patch applies unchanged
across the bump; only the filename version differed).
@BYK BYK force-pushed the fix/stricli-help-all-alias-display branch from 529c007 to 0ef839b Compare June 3, 2026 14:17
@BYK BYK merged commit 2a0a66c into main Jun 3, 2026
28 checks passed
@BYK BYK deleted the fix/stricli-help-all-alias-display branch June 3, 2026 14:26
BYK added a commit that referenced this pull request Jun 3, 2026
…ck (#1062)

Follow-ups from the post-merge review of #1057. No production code
changes — tooling, docs hygiene, and a CI safety net.

## 1. Remove `MIGRATION-PLAN.md` + gitignore the scratch-doc class

`MIGRATION-PLAN.md` was a throwaway Bun→Node migration scratch doc that
had already drifted stale (e.g. still referenced the old
`@stricli/core@1.2.5` patch that #1057 retargeted to `1.2.7`). These
planning/migration notes shouldn't live in the repo. Deleted it and
added `.gitignore` patterns so the whole class stays local:

```
*-PLAN.md
*_PLAN.md
PLAN.md
*-MIGRATION.md
MIGRATION-*.md
MIGRATION_*.md
```

Verified these match `MIGRATION-PLAN.md` and do **not** catch legit
tracked docs (`DEVELOPMENT.md`, `CONTRIBUTING.md`, `README.md`,
`AGENTS.md`, `CHANGELOG.md`, `docs/.../contributing.md`).

## 2. Drop stale `.lore.md` entry

Removed the lore entry that documented the old **`bun patch`** SDK
patch-regeneration workflow (`rm -rf ~/.bun/install/cache/@sentry`, `bun
patch --commit`, "remove `.bun-tag-*` hunks"). The project uses `pnpm
patch` now, so the instructions were actively misleading.

## 3. Harden `check:patches` with content assertions

This is the meaningful one. The `@stricli/core` `-H` patch edits exact
line-context in **both** the ESM (`dist/index.js`) and CJS
(`dist/index.cjs`) bundles, and **will** break on any Stricli version
bump that shifts those lines. pnpm only **warns** (does not fail) when a
patch no longer applies — it installs the unpatched package. The
previous version-only check would still pass in that case, silently
re-introducing the `-H` crash.

Added `CONTENT_ASSERTIONS` to `script/check-patches.ts` that verify each
patch's *effect* is present in the installed files (asserts the stale
`checkForReservedAliases(aliases, ["h", "H"])` marker is **absent** from
both bundles). Fails hard (exit 1) if a patch silently dropped. The
script header now also documents this fragility as a permanent
maintenance cost (upstreaming a config option for `-H` is unlikely to be
accepted).

## Testing

- `pnpm run check:patches` → ✓ passes with patches applied
- Negative test: reintroduced the stale `["h", "H"]` marker into the
installed ESM bundle → script correctly **fails with exit 1** and the
actionable regenerate message; restored → passes again
- `biome check script/check-patches.ts` → clean
- `tsc --noEmit` → no errors in `check-patches.ts`
- `git check-ignore` confirms gitignore patterns hit `MIGRATION-PLAN.md`
and miss all real docs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant