diff --git a/.gitattributes b/.gitattributes index 454d3bd..2c8e745 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,6 +1,6 @@ # LF in the working tree on every platform. Git for Windows defaults to # core.autocrlf=true, which rewrites a checkout to CRLF — that breaks two things # at once: the completion scripts and man page ship in the npm package and are -# read by shells and man(1), and `npm run verify:generated` compares the +# read by shells and man(1), and `pnpm run verify:generated` compares the # generator's LF output byte-for-byte against what is on disk. * text=auto eol=lf diff --git a/.github/scripts/install-global.ps1 b/.github/scripts/install-global.ps1 new file mode 100644 index 0000000..6f29597 --- /dev/null +++ b/.github/scripts/install-global.ps1 @@ -0,0 +1,48 @@ +# Install the packed tarball globally, the way a user of that package manager +# would, and export ENTRY: the path that package manager's launcher hands node. +# The INSTALL-01 steps reach the copy by that path rather than through `git fi`, +# which is the only way a shadowed copy gets to say anything at all. +# +# The two lay a global install out differently. npm puts the package under its +# prefix. pnpm puts it in a node_modules of its own global directory: directly +# under `pnpm root -g` up to pnpm 10, and in a per-package subdirectory of it +# from pnpm 11. +param( + [Parameter(Mandatory)] + [ValidateSet('npm', 'pnpm')] + [string]$Installer +) + +$ErrorActionPreference = 'Continue' +$tgz = (Get-ChildItem gettyimages-git-fi-*.tgz).FullName +$package = 'node_modules\@gettyimages\git-fi\dist\index.js' + +if ($Installer -eq 'pnpm') { + # pnpm refuses a global install until it has a global bin directory on PATH, + # which `pnpm setup` arranges on a user's machine. Do the same here, for this + # step and the ones after it. + if (-not $env:PNPM_HOME) { + $env:PNPM_HOME = Join-Path $env:RUNNER_TEMP 'pnpm-home' + "PNPM_HOME=$env:PNPM_HOME" | Out-File -Append -Encoding utf8 $env:GITHUB_ENV + } + $bin = (pnpm bin -g).Trim() + New-Item -ItemType Directory -Force $bin | Out-Null + $env:PATH = "$bin;$env:PATH" + $bin | Out-File -Append -Encoding utf8 $env:GITHUB_PATH + + pnpm add -g $tgz + if ($LASTEXITCODE) { throw "pnpm add -g failed ($LASTEXITCODE)" } + $root = (pnpm root -g).Trim() + $candidates = @(Join-Path $root '@gettyimages\git-fi\dist\index.js') + $candidates += Get-ChildItem $root -Directory | ForEach-Object { Join-Path $_.FullName $package } +} else { + npm install -g $tgz + if ($LASTEXITCODE) { throw "npm install -g failed ($LASTEXITCODE)" } + $prefix = (npm config get prefix).Trim() + $candidates = @(Join-Path $prefix $package) +} + +$entry = $candidates | Where-Object { Test-Path $_ } | Select-Object -First 1 +if (-not $entry) { throw "no installed git-fi entry point found for $Installer among: $($candidates -join ', ')" } +"installed with $Installer at $entry" +"ENTRY=$entry" | Out-File -Append -Encoding utf8 $env:GITHUB_ENV diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3689a1c..dffda09 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,13 +24,17 @@ jobs: steps: - uses: actions/checkout@v4 + # pnpm's version comes from `packageManager` in package.json. + - uses: pnpm/action-setup@v6 + with: + cache: true + - uses: actions/setup-node@v4 with: node-version: ${{ matrix.node }} - cache: npm - - run: npm ci - - run: npm test + - run: pnpm install --frozen-lockfile + - run: pnpm test # The matrix above drives the compiled binary straight out of the checkout, so # nothing there installs globally or reaches git-fi by the name a shell @@ -38,8 +42,16 @@ jobs: # the Ruby gem had a launcher left in Ruby's bin directory, ahead of npm's # prefix on PATH, and `git fi` ran that one instead. Windows PowerShell rather # than pwsh because that is the shell the report came from. + # + # Once per package manager a user installs git-fi with: npm and pnpm lay a + # global install out differently, and write different launchers, so the + # same-install check has a different shape to get right for each. windows-install: runs-on: windows-latest + strategy: + fail-fast: false + matrix: + installer: [npm, pnpm] defaults: run: # INSTALL-01 writes its report to stderr, and this shell defaults @@ -49,19 +61,23 @@ jobs: steps: - uses: actions/checkout@v4 + - uses: pnpm/action-setup@v6 + with: + cache: true + - uses: actions/setup-node@v4 with: node-version: 22 - cache: npm - - run: npm ci - - run: npm pack + - run: pnpm install --frozen-lockfile + - run: pnpm pack + + - name: install the tarball globally with ${{ matrix.installer }} + run: ./.github/scripts/install-global.ps1 -Installer ${{ matrix.installer }} - name: git fi reaches the global install, and says nothing extra run: | $ErrorActionPreference = 'Continue' - $tgz = (Get-ChildItem gettyimages-git-fi-*.tgz).FullName - npm install -g $tgz $v = (git fi --version) -join '' if ($v -notmatch '^git-fi \d+\.\d+\.\d+$') { throw "git fi --version said: $v" } @@ -95,8 +111,7 @@ jobs: # Reached by path rather than by name, which is the only way the copy # being shadowed gets to say anything at all (`npx` for the user who # hit this). - $prefix = (npm config get prefix).Trim() - $entry = Join-Path $prefix 'node_modules\@gettyimages\git-fi\dist\index.js' + $entry = $env:ENTRY $stdout = & node $entry --version 2>$null if (($stdout -join '') -notmatch '^git-fi \d+\.\d+\.\d+$') { @@ -142,23 +157,30 @@ jobs: # after it is removed by hand. windows-leftover-gem: runs-on: windows-latest + strategy: + fail-fast: false + matrix: + installer: [npm, pnpm] defaults: run: shell: powershell steps: - uses: actions/checkout@v4 + - uses: pnpm/action-setup@v6 + with: + cache: true - uses: actions/setup-node@v4 with: node-version: 22 - cache: npm - - run: npm ci - - run: npm pack + - run: pnpm install --frozen-lockfile + - run: pnpm pack + + - name: install the tarball globally with ${{ matrix.installer }} + run: ./.github/scripts/install-global.ps1 -Installer ${{ matrix.installer }} - name: install a git-munge-shaped gem the way its README said to run: | $ErrorActionPreference = 'Continue' - $tgz = (Get-ChildItem gettyimages-git-fi-*.tgz).FullName - npm install -g $tgz "=== ruby on this runner ===" & ruby --version 2>&1 @@ -221,9 +243,7 @@ jobs: throw "the gem launcher should be what git fi reaches, got: $reached" } - $prefix = (npm config get prefix).Trim() - $entry = Join-Path $prefix 'node_modules\@gettyimages\git-fi\dist\index.js' - $all = (& node $entry --version 2>&1 | Out-String) + $all = (& node $env:ENTRY --version 2>&1 | Out-String) if ($all -notmatch 'ahead of this one') { throw "expected the shadow report, got: $all" } - name: and still shadows it once the gem files are deleted by hand @@ -245,9 +265,7 @@ jobs: throw "the leftover links are not in git's way, so there is nothing to report: $broken" } - $prefix = (npm config get prefix).Trim() - $entry = Join-Path $prefix 'node_modules\@gettyimages\git-fi\dist\index.js' - $all = (& node $entry --version 2>&1 | Out-String) + $all = (& node $env:ENTRY --version 2>&1 | Out-String) if ($all -notmatch 'ahead of this one') { throw "expected the shadow report, got: $all" } # Fail if the committed man page, completions, or docs tables are stale — i.e. @@ -255,24 +273,27 @@ jobs: # generated artifacts honest, since they ship in the npm package and the docs # site without being regenerated at publish time. # - # The check itself is the `verify:generated` npm script, so a contributor can - # reproduce this failure locally with the same command rather than reading it - # out of this file. (`npm test` regenerates as it runs, so it can't catch + # The check itself is the `verify:generated` package script, so a contributor + # can reproduce this failure locally with the same command rather than reading + # it out of this file. (`pnpm test` regenerates as it runs, so it can't catch # drift — this job is what guards a commit that skipped the test loop.) generated: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + - uses: pnpm/action-setup@v6 + with: + cache: true + - uses: actions/setup-node@v4 with: node-version: 22 - cache: npm - - run: npm ci + - run: pnpm install --frozen-lockfile - name: Verify generated files are up to date run: | - npm run verify:generated || { - echo "::error::Generated files are stale. Run 'npm run gen:docs' and commit the result." + pnpm run verify:generated || { + echo "::error::Generated files are stale. Run 'pnpm run gen:docs' and commit the result." exit 1 } diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 16771a4..2c9640e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -18,23 +18,24 @@ jobs: runs-on: ubuntu-latest permissions: contents: write # push the Release commit back to main - id-token: write # npm provenance + id-token: write # trusted publishing and provenance steps: - uses: actions/checkout@v4 with: ref: main fetch-depth: 0 + # pnpm's version comes from `packageManager` in package.json. It + # publishes through trusted publishing (OIDC) on its own, so setup-node + # gets no `registry-url`: the .npmrc that writes names an auth token from + # NODE_AUTH_TOKEN, which this workflow doesn't set. + - uses: pnpm/action-setup@v6 + with: + cache: true + - uses: actions/setup-node@v4 with: node-version: 24 - registry-url: https://registry.npmjs.org - cache: npm - - # Tokenless trusted publishing needs npm >= 11.5.1; the version bundled - # with Node ships older, so pull the latest npm explicitly. - - name: Upgrade npm for trusted publishing - run: npm install -g npm@latest - name: Resolve version from the release tag id: version @@ -48,11 +49,13 @@ jobs: fi echo "value=$version" >> "$GITHUB_OUTPUT" - - run: npm ci + - run: pnpm install --frozen-lockfile - name: Bump package.json to the release version if: github.event_name == 'release' - run: npm version "${{ steps.version.outputs.value }}" --no-git-tag-version --allow-same-version + # pnpm checks for a clean tree even without a tag; a re-run of this job + # can find the bump from the last attempt still uncommitted. + run: pnpm version "${{ steps.version.outputs.value }}" --no-git-tag-version --allow-same-version --no-git-checks # Prepend the release body to CHANGELOG.md, inserted after the marker line. # NOTES comes in through the environment so arbitrary markdown needs no @@ -80,14 +83,16 @@ jobs: # Idempotent: skip if the version is already published, so a release can be # re-run without failing on a version conflict. prepublishOnly runs tests. + # --no-git-checks because the version bump and changelog above are + # committed only after the publish succeeds, so the tree is dirty here. - name: Publish to npm if: github.event_name == 'release' run: | VERSION="${{ steps.version.outputs.value }}" - if npm view "@gettyimages/git-fi@${VERSION}" version >/dev/null 2>&1; then - echo "@gettyimages/git-fi@${VERSION} already published — skipping npm publish." + if [ -n "$(pnpm view "@gettyimages/git-fi@${VERSION}" version 2>/dev/null)" ]; then + echo "@gettyimages/git-fi@${VERSION} already published — skipping publish." else - npm publish --provenance --access public + pnpm publish --provenance --access public --no-git-checks fi - name: Commit version and changelog to main @@ -95,7 +100,7 @@ jobs: run: | git config user.name "github-actions[bot]" git config user.email "41898282+github-actions[bot]@users.noreply.github.com" - git add package.json package-lock.json CHANGELOG.md + git add package.json CHANGELOG.md if git diff --cached --quiet; then echo "No version or changelog changes to commit." else @@ -106,4 +111,4 @@ jobs: # workflow_dispatch: validate packaging without uploading. - name: Publish (dry run) if: github.event_name == 'workflow_dispatch' - run: npm publish --dry-run --access public + run: pnpm publish --dry-run --access public --no-git-checks diff --git a/AGENTS.md b/AGENTS.md index 0d94f3e..598bbbd 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -5,16 +5,16 @@ git-fi is a git subcommand (`git fi`), written in TypeScript for Node >= 22, tha ## Commands ```bash -npm install # dev dependencies (tsx, typescript) -npm start -- --help # run src/ directly via tsx -npm run build # tsc to dist/, then regenerate man/, completions/, docs tables -npm test # tsc, verify:generated, then the whole suite -npm run verify:generated # fail if a committed generated file is stale -npm run trial:on # link this checkout as `git fi` on PATH (trial:off reverts) -npm run docs # serve the Docsify site at http://127.0.0.1:3000/ +pnpm install # dev dependencies (tsx, typescript) +pnpm start --help # run src/ directly via tsx +pnpm run build # tsc to dist/, then regenerate man/, completions/, docs tables +pnpm test # tsc, verify:generated, then the whole suite +pnpm run verify:generated # fail if a committed generated file is stale +pnpm run trial:on # link this checkout as `git fi` on PATH (trial:off reverts) +pnpm run docs # serve the Docsify site at http://127.0.0.1:3000/ ``` -`just` lists the same tasks under shorter names; most recipes delegate to an npm script, so `package.json` is where a command is defined. +The tooling is pnpm, pinned by `packageManager` in `package.json`; don't reintroduce npm commands or a `package-lock.json`. `just` lists the same tasks under shorter names; most recipes delegate to a package script, so `package.json` is where a command is defined. Run one test file, or filter by name: @@ -23,7 +23,7 @@ node --import tsx --test test/parse.test.ts node --import tsx --test --test-name-pattern='' test/cli.test.ts ``` -Most suites drive the compiled binary (`dist/index.js`, see `test/helpers.ts`) against throwaway repos (a bare `origin` plus a working clone), so run `npx tsc` first when a change touches `src/`. There is no linter; `tsc` and `verify:generated` are the static checks. +Most suites drive the compiled binary (`dist/index.js`, see `test/helpers.ts`) against throwaway repos (a bare `origin` plus a working clone), so run `pnpm exec tsc` first when a change touches `src/`. There is no linter; `tsc` and `verify:generated` are the static checks. ## Spec-driven @@ -41,7 +41,7 @@ Most suites drive the compiled binary (`dist/index.js`, see `test/helpers.ts`) a ## Generated files -`src/help.ts` is the single source of truth for flags. `scripts/gen-docs.ts` generates `man/git-fi.1`, `completions/*`, and the marked `` tables in `docs/commands.md`. Completion logic lives in `scripts/completion/*.tmpl`. Edit those sources and run `npm run build`; never hand-edit the outputs. +`src/help.ts` is the single source of truth for flags. `scripts/gen-docs.ts` generates `man/git-fi.1`, `completions/*`, and the marked `` tables in `docs/commands.md`. Completion logic lives in `scripts/completion/*.tmpl`. Edit those sources and run `pnpm run build`; never hand-edit the outputs. ## Releases diff --git a/README.md b/README.md index cae9663..f1ce049 100644 --- a/README.md +++ b/README.md @@ -17,20 +17,22 @@ The git floor tracks the newest git feature the code calls rather than a support ```bash git clone https://github.com/gettyimages/git-fi.git cd git-fi -npm install # dev dependencies (tsx, typescript) +pnpm install # dev dependencies (tsx, typescript) ``` +The tooling runs on [pnpm](https://pnpm.io), at the version `packageManager` in `package.json` pins; pnpm and corepack both switch to it inside the checkout. + Day-to-day, git-fi runs straight from source — no global install needed: ```bash -npm start -- --help # run src/ directly via tsx -npm run build # compile TypeScript to dist/ -npm test # build, then run the integration suite +pnpm start --help # run src/ directly via tsx +pnpm run build # compile TypeScript to dist/ +pnpm test # build, then run the integration suite ``` -With [just](https://github.com/casey/just) installed, `just` lists the same tasks under shorter names — `just run --help`, `just build`, `just test`. The recipes delegate to the npm scripts rather than restating them, so `package.json` stays the one place a command is defined; CI and `prepublishOnly` call npm directly either way. +With [just](https://github.com/casey/just) installed, `just` lists the same tasks under shorter names — `just run --help`, `just build`, `just test`. The recipes delegate to the package scripts rather than restating them, so `package.json` stays the one place a command is defined; CI and `prepublishOnly` call pnpm directly either way. -`npm test` is the primary feedback loop: it drives the compiled binary against throwaway git repositories (a bare `origin` plus a working clone), exercising real `git fetch`/`merge`/`push` behavior end-to-end. `scripts/run-tests.mjs` hands node's runner explicit paths rather than a glob, so a pattern that stops matching fails loudly instead of reporting a green suite that ran nothing. +`pnpm test` is the primary feedback loop: it drives the compiled binary against throwaway git repositories (a bare `origin` plus a working clone), exercising real `git fetch`/`merge`/`push` behavior end-to-end. `scripts/run-tests.mjs` hands node's runner explicit paths rather than a glob, so a pattern that stops matching fails loudly instead of reporting a green suite that ran nothing. CI runs the suite on Linux and Windows across Node 22, 24, and 26 — both active LTS lines plus Current. Windows is in the matrix because git-fi behaves differently where the platform has no POSIX file modes: it stores the token without setting or checking `0600` (`AUTH-04`), and `--update` has to reach npm or pnpm through the shell there (`UPDATE-05`). @@ -43,11 +45,11 @@ The implementation follows [SPEC.md](SPEC.md), which defines every requirement w To run the checkout as `git fi` in other repositories for a while: ```bash -npm run trial:on # build, npm link, load this copy's completion -npm run trial:off # unlink, restore the version it replaced +pnpm run trial:on # build, link globally with pnpm, load this copy's completion +pnpm run trial:off # unlink, restore the version it replaced ``` -`trial:on` symlinks the checkout onto your `PATH`, so later `npm run build`s take effect without reinstalling. It also runs `install-completions --write .trial/completions` and appends a marked block to `~/.zshrc` that puts that directory on your `fpath` — the same command, writing the same two files, that a user installs with (`COMPLETE-06`), so a trial exercises the shipped install path rather than a shortcut around it. Only `~/.zshrc` is touched; under bash you get the linked binary and wire the completion yourself. `trial:off` deletes the block and `.trial/`, then reinstalls the exact version the trial displaced, which `trial:on` recorded before linking over it (`BUILD-03`). Where that reference has been copied outside the marked block, `trial:off` names the lines rather than editing them, since the directory they point at is the one it just removed (`BUILD-04`). Open a new terminal after either one. +`trial:on` links the checkout into pnpm's global directory (`pnpm add -g `), so later `pnpm run build`s take effect without reinstalling. It also runs `install-completions --write .trial/completions` and appends a marked block to `~/.zshrc` that puts that directory on your `fpath` — the same command, writing the same two files, that a user installs with (`COMPLETE-06`), so a trial exercises the shipped install path rather than a shortcut around it. Only `~/.zshrc` is touched; under bash you get the linked binary and wire the completion yourself. `trial:off` deletes the block and `.trial/`, then reinstalls the exact version the trial displaced, which `trial:on` recorded before linking over it (`BUILD-03`). Where that reference has been copied outside the marked block, `trial:off` names the lines rather than editing them, since the directory they point at is the one it just removed (`BUILD-04`). Open a new terminal after either one. `git fi --version` is what says which build is in force: a trial answers `-dev.g`, an installed copy answers the bare version (`BUILD-02`). @@ -60,7 +62,7 @@ The published package, installed as the [docs site](https://gettyimages.github.i ```text SPEC.md Behavioral specification STATUS.md Requirement coverage -justfile Task runner wrapping the npm scripts +justfile Task runner wrapping the package scripts src/ TypeScript implementation test/ Integration suite (Node test runner) docs/ Docsify documentation site @@ -69,7 +71,7 @@ man/ Generated man page (git-fi.1) completions/ Generated bash + zsh completions (_git-fi, _git_fi, git-fi.bash) ``` -The man page and shell completions are generated by `scripts/gen-docs.ts`, which draws the flag list from `src/help.ts` — the single source of truth for git-fi's flags. The completion logic itself lives in real shell files under `scripts/completion/` (`*.tmpl`); the generator injects the flag list and stamps a banner. `npm run build` regenerates the outputs (via `npm run gen:docs`); those under `man/` and `completions/` are committed, so edit `src/help.ts` (flags) or `scripts/completion/*.tmpl` (completion logic) and rebuild rather than editing the generated files by hand. `npm test` and CI both run `npm run verify:generated`, which fails naming any committed artifact that no longer matches what the generator would write, so stale generated files surface before review rather than during it. +The man page and shell completions are generated by `scripts/gen-docs.ts`, which draws the flag list from `src/help.ts` — the single source of truth for git-fi's flags. The completion logic itself lives in real shell files under `scripts/completion/` (`*.tmpl`); the generator injects the flag list and stamps a banner. `pnpm run build` regenerates the outputs (via `pnpm run gen:docs`); those under `man/` and `completions/` are committed, so edit `src/help.ts` (flags) or `scripts/completion/*.tmpl` (completion logic) and rebuild rather than editing the generated files by hand. `pnpm test` and CI both run `pnpm run verify:generated`, which fails naming any committed artifact that no longer matches what the generator would write, so stale generated files surface before review rather than during it. Three completion files ship because `git fi` is dispatched by two different providers: `_git-fi` drives zsh's built-in `_git`; `git-fi.bash` (defining `_git_fi`, git-completion style) drives git's own completion wrapper in bash; and `_git_fi` is the same `_git_fi` body on the zsh fpath, for git's wrapper under zsh. The git-native body (`git-fi.bash.tmpl`) is shared by the last two, so they can't drift. Each file has an `install-completions` target that prints it — `bash`, `zsh`, `zsh-git` respectively — and `--write ` installs the zsh pair onto an fpath directory (`COMPLETE-06`); adding a file here means adding its target in `src/install-completions.ts`. diff --git a/SPEC.md b/SPEC.md index da04b2c..bbdada2 100644 --- a/SPEC.md +++ b/SPEC.md @@ -806,9 +806,9 @@ Build Provenance A developer can put an unpublished checkout on PATH under the same `git fi` name the published install uses. These requirements keep the two tellable apart, so a bug report names the build it came from, and govern what ending that trial hands back. -- `BUILD-01` git-fi shall treat itself as a dev build when a `.git` entry exists at its own package root. A published tarball carries none — npm's `files` list ships `dist`, `man`, and `completions` — so the marker separates a linked checkout from an installed copy. It shall be read at the package root rather than the working directory, which is a git repository on every ordinary run. +- `BUILD-01` git-fi shall treat itself as a dev build when a `.git` entry exists at its own package root. A published tarball carries none — the package's `files` list ships `dist`, `man`, and `completions` — so the marker separates a linked checkout from an installed copy. It shall be read at the package root rather than the working directory, which is a git repository on every ordinary run. - `BUILD-02` On a dev build, `--version` (`OPTION-05`) shall report the released version followed by `-dev.g`, naming the commit the build came from, and shall append `.dirty` when the checkout's tree differs from that commit. The `g` prefix is what keeps the identifier valid semver: a sha of all digits would otherwise read as a numeric identifier, which may not carry leading zeros. When no commit can be read, git-fi shall report `-dev` alone rather than dropping the marker. -- `BUILD-03` Ending a trial shall restore the exact published version the trial displaced. `npm link` overwrites the global install, so the version is read before the link and kept under `.trial/`; `trial:off` then installs that version rather than whatever is newest, because a trial borrows an install and should hand back the one it borrowed. Where no published version was recorded — the package was absent, or already linked to a checkout — the trial shall say which of the two it found and install the latest, rather than leave the developer with no `git fi` at all. Where a version was recorded, the trial shall install that version or fail saying so; a recorded version that no longer resolves is not grounds for substituting another. A recorded value that is not a bare version shall be refused rather than passed to the installer, which reads the wider `name@spec` grammar. +- `BUILD-03` Ending a trial shall restore the exact published version the trial displaced. Linking the checkout globally (`pnpm add -g `) overwrites the global install, so the version is read before the link and kept under `.trial/`; `trial:off` then installs that version rather than whatever is newest, because a trial borrows an install and should hand back the one it borrowed. Where no published version was recorded — the package was absent, or already linked to a checkout — the trial shall say which of the two it found and install the latest, rather than leave the developer with no `git fi` at all. Where a version was recorded, the trial shall install that version or fail saying so; a recorded version that no longer resolves is not grounds for substituting another. A recorded value that is not a bare version shall be refused rather than passed to the installer, which reads the wider `name@spec` grammar. - `BUILD-04` Ending a trial shall remove only the rc-file block it wrote, delimited by its own markers, and shall report any remaining line naming the trial's completion directory by its literal path rather than editing it away. That directory is deleted as the trial ends, so a hand-copied `fpath` entry naming it would otherwise be left pointing at nothing, and a line the developer wrote is not the script's to remove. A reference spelled through `~` or a variable is not detected. ## `INSTALL` @@ -817,7 +817,7 @@ Install Integrity `git fi` runs whichever `git-fi` comes first on `PATH`, so an installation can be complete and still never run. The state is silent from both ends: npm reports success, and the copy that would notice is the one not being reached. -- `INSTALL-01` Where the `git-fi` that `PATH` resolves first is not the copy executing, `--version` shall report it on stderr: the launcher `git fi` reaches, the copy answering, and how to resolve the two (delete the launcher, or move the bin directory of the package manager that installed this copy — npm's or pnpm's — earlier on `PATH`). Reaching the running copy some other way — `npx`, an absolute path — is the state in which the report can be made at all, and asking which git-fi is installed is the moment it answers a question already being asked. It shall not print on any other command: a second installation is not itself a fault, and a line on every run would be noise to whoever has a reason for it. stdout shall carry only the version string, so anything parsing it is unaffected. `GIT_FI_NO_HINTS` shall suppress it; the update notice's other suppressions (`UPDATE-03`) shall not, since a pipeline reporting which binary it ran is the case this exists for. An unreadable `PATH` entry, an unresolvable entry point, or no `git-fi` on `PATH` at all shall leave the command silent rather than failing it. A launcher is this copy when it leads to the same resolved entry point: a symlink resolves there, and a generated launcher names it — npm's relative to the launcher's own directory, pnpm's as a recorded `cmd-shim-target` (older pnpm launchers name a path relative to their directory that leaves `node_modules`, into pnpm's global directory). +- `INSTALL-01` Where the `git-fi` that `PATH` resolves first is not the copy executing, `--version` shall report it on stderr: the launcher `git fi` reaches, the copy answering, and how to resolve the two (delete the launcher, or move the bin directory of the package manager that installed this copy — npm's or pnpm's — earlier on `PATH`). Where that launcher is one RubyGems generated, the report shall also say it was left by git-fi's old Ruby gem, which removing the gem's files by hand does not delete; for any other launcher it shall not mention the gem, which the reader may never have installed. Reaching the running copy some other way — `npx`, an absolute path — is the state in which the report can be made at all, and asking which git-fi is installed is the moment it answers a question already being asked. It shall not print on any other command: a second installation is not itself a fault, and a line on every run would be noise to whoever has a reason for it. stdout shall carry only the version string, so anything parsing it is unaffected. `GIT_FI_NO_HINTS` shall suppress it; the update notice's other suppressions (`UPDATE-03`) shall not, since a pipeline reporting which binary it ran is the case this exists for. An unreadable `PATH` entry, an unresolvable entry point, or no `git-fi` on `PATH` at all shall leave the command silent rather than failing it. A launcher is this copy when it leads to the same resolved entry point: a symlink resolves there, and a generated launcher names it — npm's relative to the launcher's own directory, pnpm's as a recorded `cmd-shim-target` (older pnpm launchers name a path relative to their directory that leaves `node_modules`, into pnpm's global directory). ## `UPDATE` diff --git a/STATUS.md b/STATUS.md index 7c0d7e2..da92075 100644 --- a/STATUS.md +++ b/STATUS.md @@ -289,7 +289,7 @@ Install Integrity | ID | Description | Status | Location | |--------|----------------------------------|---------|--------------------------------| -| INSTALL-01 | `--version` reports a launcher ahead of this copy | Covered | `src/which.ts` (`gitFiOnPath`, `shadowingLauncher`, `isSameInstall`, `launcherTarget`, `shadowNotice`, `warnIfShadowed`), `src/index.ts` (`parseArgs`) | +| INSTALL-01 | `--version` reports a launcher ahead of this copy | Covered | `src/which.ts` (`gitFiOnPath`, `shadowingLauncher`, `isSameInstall`, `launcherTarget`, `isRubyGemsLauncher`, `shadowNotice`, `warnIfShadowed`), `src/index.ts` (`parseArgs`) | ## `UPDATE` diff --git a/justfile b/justfile index bb41970..15e303c 100644 --- a/justfile +++ b/justfile @@ -1,8 +1,8 @@ # git-fi task runner. # -# Every recipe delegates to the matching npm script rather than restating its -# command line: package.json stays the single source of truth, so a change there -# can't leave a stale copy here. npm remains the supported path — CI and +# Every recipe delegates to the matching package script rather than restating +# its command line: package.json stays the single source of truth, so a change +# there can't leave a stale copy here. pnpm remains the supported path — CI and # `prepublishOnly` call it directly — and this is the shorthand for local work. # What this is, and every recipe there is @@ -15,57 +15,57 @@ default: @echo "" @just --list --unsorted --list-heading '' --list-prefix ' ' @echo "" - @echo " Most recipes call an npm script; package.json is where each command is defined." + @echo " Most recipes call a package script; package.json is where each command is defined." # Install dev dependencies (tsx, typescript) [group('start here')] install: - npm install + pnpm install # Run git-fi from src/ via tsx: `just run --help` [group('start here')] run *ARGS: - npm start -- {{ARGS}} + pnpm start {{ARGS}} # Run with every git command traced and timed: `just run-debug --add my-branch` [group('start here')] run-debug *ARGS: - npm start -- --debug {{ARGS}} + pnpm start --debug {{ARGS}} # Typecheck, check generated files are current, then run the integration suite [group('start here')] test: - npm test + pnpm test # Serve the docs site locally at http://127.0.0.1:3000/ [group('docs')] docs: - npm run docs + pnpm run docs # Compile TypeScript to dist/ and regenerate the man page, completions, and docs tables [group('build and generate')] build: - npm run build + pnpm run build # Regenerate man/, completions/, and the docs reference tables from src/help.ts [group('build and generate')] gen: - npm run gen:docs + pnpm run gen:docs # Fail if any committed generated file no longer matches what the generator writes [group('build and generate')] check-generated: - npm run verify:generated + pnpm run verify:generated # Build, link this checkout onto PATH as `git fi`, and load its completions [group('try it as git fi')] trial-on: - npm run trial:on + pnpm run trial:on # Unlink the checkout and restore the @gettyimages/git-fi version it replaced [group('try it as git fi')] trial-off: - npm run trial:off + pnpm run trial:off # Remove build output and the trial directory [group('tidy')] diff --git a/package-lock.json b/package-lock.json deleted file mode 100644 index 456c8d2..0000000 --- a/package-lock.json +++ /dev/null @@ -1,573 +0,0 @@ -{ - "name": "@gettyimages/git-fi", - "version": "1.4.0", - "lockfileVersion": 3, - "requires": true, - "packages": { - "": { - "name": "@gettyimages/git-fi", - "version": "1.4.0", - "license": "MIT", - "bin": { - "git-fi": "dist/index.js" - }, - "devDependencies": { - "@types/node": "^25.5.0", - "tsx": "^4.7.0", - "typescript": "^5.3.0" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/aix-ppc64": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.28.1.tgz", - "integrity": "sha512-Svl7tq8k/08+p6CXPpRjQ1fKX+1odH/BQbb48fV6fj3CWHhsoIOoY87w1oHXm0qEpkIK3ZfVgp0hed3XBXzXMQ==", - "cpu": [ - "ppc64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "aix" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/android-arm": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.28.1.tgz", - "integrity": "sha512-0k2F129Xdio1TdJfzJ8sy1Q47vUD2NnwdhiAf7drUN1EBTfPf4hsFCtmMgu/6m8JSzsBrlmVjudMBQqOfG8usQ==", - "cpu": [ - "arm" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/android-arm64": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.28.1.tgz", - "integrity": "sha512-34EGEbCIAgosYz6goLcopX6Mo7NyGv9tfwEM2/7Ce2VcVRk568iSvniGWcUXIy7wEDR1wzolcxcriFVrWYcwBg==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/android-x64": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.28.1.tgz", - "integrity": "sha512-dbwY7ltSMDWsRatcRpCnES4F+im88OCUgGZjy52shC7GqHRE/cYlxNbB4Z4UpJswpcc4Qxd2oE/ufM0p61IKng==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/darwin-arm64": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.28.1.tgz", - "integrity": "sha512-TZbWkQY7kvTAXbXUT7uVACR5cMHsDiSz9z7ZKAX/RTq/WJEk3QyRr0wZpNhBDX+/0CtdqUIJlOiodQcta6tY3Q==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/darwin-x64": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.28.1.tgz", - "integrity": "sha512-zfdzgK9ACBNZLI/CyHTOx81SyNbM6YXn7rxSgX97VjyiPl9W1i4Ka4fgKECEoFCKGpvBj5qArWIGgQjOwkgskQ==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/freebsd-arm64": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.28.1.tgz", - "integrity": "sha512-wG2EA8ENdEI0qhkSZMjfqrdY+ziCYCPMmtZjjIwOmXFjmyzEHn+UUxk5of+SYsjtfs3VpnlC7QLzSI5hY/rOAw==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/freebsd-x64": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.28.1.tgz", - "integrity": "sha512-i7dZ9vQgnvSCzi/rYCXNgtF/U+eKZNJBzu3eTQbRgHnM7tNSizLOkRFAl3qzVc/Op/u5YkHHa4pf/3DOYHthLQ==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-arm": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.28.1.tgz", - "integrity": "sha512-qVXBOHQS+d5Y722GwJzJUtOLlX7km3CraOaGormF1pDtPd2C/l1SHRPgjLunLGe51Sh5YYWKMFDyV4SxgMQYTQ==", - "cpu": [ - "arm" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-arm64": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.28.1.tgz", - "integrity": "sha512-yHs+0uc8+nvEAfAfxrWQKK5peSNzBc4PegcMO0EJ2hT71uA7vB8Ihg2e77R2P7SG5uYjPbHlLLmve4LLLRCf0g==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-ia32": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.28.1.tgz", - "integrity": "sha512-d1z4ZuP0ajrfz/FhGT4vv278rX8KnPPJx8i5+AtK7TYbx9Le9F1hyzurZpkEyjkGa9dUGhQow4C1NmeGvqxN2w==", - "cpu": [ - "ia32" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-loong64": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.28.1.tgz", - "integrity": "sha512-M5sRjUVZrkm1OAPR3dlOYzNmN+loZKGVi1VUQGrwuqLcbR6qeAz+famMhjASeH3YVKvZz+zT1jlh/keC3Rj/lg==", - "cpu": [ - "loong64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-mips64el": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.28.1.tgz", - "integrity": "sha512-mRObBZeHh2OxcBFPWE/FjylkRgZdYuiTR3vaTozquCGOH14iP9oN4x4Ge81CoIDYQrXmIxpFumJBu5MtZpnQJQ==", - "cpu": [ - "mips64el" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-ppc64": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.28.1.tgz", - "integrity": "sha512-slScBsMAb3GFDcdrCgLwZtPYRoH2H/youv10QiZyRjmsP48fznoveWytSgCI/R0ZcUgpc0ZhIUEx6LHts8yrfQ==", - "cpu": [ - "ppc64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-riscv64": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.28.1.tgz", - "integrity": "sha512-kw0owk1o0GFETUJyW0jc0G4Yzs0BHZn0JDZ8JRT088vjJYX777BAs1fDGxAC+q831qOs2DTC96mNsG2opdfyyQ==", - "cpu": [ - "riscv64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-s390x": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.28.1.tgz", - "integrity": "sha512-/lAIjX8aYFRByhh6L5rYtPEDRqa9de/4V/juOXcta5frjvzXO4/sqEtyytse0g3zZFuWu5cDN0MkLz2qRDD2Ag==", - "cpu": [ - "s390x" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-x64": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.28.1.tgz", - "integrity": "sha512-u/anNYF2mmVOEDwLtnQ1wOr3EZ9sTNGLWrsYGYwHWzGA3Si84IOkHXlbWTD1NB+9/1lcnweYKO54uhxZydNzfA==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/netbsd-arm64": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.28.1.tgz", - "integrity": "sha512-oks0DYbLwWMmaakTsCb+zL4E+aHRVLom9IJZOAthMQEPiQmydXHkziYEsGYRx0uNV/IjEKGAV941JzH02pflqw==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "netbsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/netbsd-x64": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.28.1.tgz", - "integrity": "sha512-aeL6lAnN89Hz43Mlh1G8ARasbuoYvSITDEx0tHh5b7jJnHcssqgjy9Yx430GDpmCa6OyrKoS0aNRjKundRizGg==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "netbsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/openbsd-arm64": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.28.1.tgz", - "integrity": "sha512-MEFJe5C3R8pwXdZ5Y21oo6m7ePiS0d9pWucn99O/wvyJZChoIQKrQDxKrGeW8F5+T0okTHesAmDeiHDTIq0V/Q==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "openbsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/openbsd-x64": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.28.1.tgz", - "integrity": "sha512-i/ZLIOafE0Z8cI/XANJAixoJL/uRAoS2xOA3rb0xN+KK0K177cMAsQYkzHtBrtMXAKuAc7HGgcWiZ/sRC1Nxgw==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "openbsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/openharmony-arm64": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.28.1.tgz", - "integrity": "sha512-ge+Z7EXFNt2BO1oAMsVpiQ8EwndV9i1xXerAeTIK7AtPs3bKFXQM7nlRxDSIUIMeueR1CNXxqztLzdNeReKBJg==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "openharmony" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/sunos-x64": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.28.1.tgz", - "integrity": "sha512-BEjgtECkL3vY+SaSQ6nzVfiALUeFxpawyp8Jmf5PtYhf1Ug40N1h/hxlhts+f1FvSvarEigdxS3BlSMI2PJLcQ==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "sunos" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/win32-arm64": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.28.1.tgz", - "integrity": "sha512-lCv9eK/H6ZJWbE7bh2nw54CZ9M2nupBxJcTsdk/QQnWkdSjKGuxmmH8/GWrlT1eMmZfn4dGcCjRte397WqfQXA==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/win32-ia32": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.28.1.tgz", - "integrity": "sha512-zvb/mB2bSCoJOpoCBgYKKpX6YM6mJBlBUVUtVj41DlZJVEB6/0CKlRYxP5wWl1C1ILiCoAU5wZZ4q1P3qeS6Eg==", - "cpu": [ - "ia32" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/win32-x64": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.28.1.tgz", - "integrity": "sha512-bm4Mowrv+GXMlpWX++EcXw/iLyd1o3+bJkC2DkWXYVvgZCqD/bSj9ctZeAMC3cIxgjRVR2Dufaiu4YPxr5gW1A==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@types/node": { - "version": "25.9.5", - "resolved": "https://registry.npmjs.org/@types/node/-/node-25.9.5.tgz", - "integrity": "sha512-OScDchr2fwuUmWdf4kZ9h7PcJiYDVInhJizG/biAq3cAvqwYktuy/TYGGdZNMtNTFUP7rnb0NU4TUdm82kt4Rg==", - "dev": true, - "license": "MIT", - "dependencies": { - "undici-types": ">=7.24.0 <7.24.7" - } - }, - "node_modules/esbuild": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.28.1.tgz", - "integrity": "sha512-HrJrvZv5ayxBzPfwphOoNzkzOIIlifzk0KJrGK2c8R4+LKpMtpYLQeUdjnwjWv/LZlkH2laZk+4w78pi99D4Vw==", - "dev": true, - "hasInstallScript": true, - "license": "MIT", - "bin": { - "esbuild": "bin/esbuild" - }, - "engines": { - "node": ">=18" - }, - "optionalDependencies": { - "@esbuild/aix-ppc64": "0.28.1", - "@esbuild/android-arm": "0.28.1", - "@esbuild/android-arm64": "0.28.1", - "@esbuild/android-x64": "0.28.1", - "@esbuild/darwin-arm64": "0.28.1", - "@esbuild/darwin-x64": "0.28.1", - "@esbuild/freebsd-arm64": "0.28.1", - "@esbuild/freebsd-x64": "0.28.1", - "@esbuild/linux-arm": "0.28.1", - "@esbuild/linux-arm64": "0.28.1", - "@esbuild/linux-ia32": "0.28.1", - "@esbuild/linux-loong64": "0.28.1", - "@esbuild/linux-mips64el": "0.28.1", - "@esbuild/linux-ppc64": "0.28.1", - "@esbuild/linux-riscv64": "0.28.1", - "@esbuild/linux-s390x": "0.28.1", - "@esbuild/linux-x64": "0.28.1", - "@esbuild/netbsd-arm64": "0.28.1", - "@esbuild/netbsd-x64": "0.28.1", - "@esbuild/openbsd-arm64": "0.28.1", - "@esbuild/openbsd-x64": "0.28.1", - "@esbuild/openharmony-arm64": "0.28.1", - "@esbuild/sunos-x64": "0.28.1", - "@esbuild/win32-arm64": "0.28.1", - "@esbuild/win32-ia32": "0.28.1", - "@esbuild/win32-x64": "0.28.1" - } - }, - "node_modules/fsevents": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", - "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", - "dev": true, - "hasInstallScript": true, - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": "^8.16.0 || ^10.6.0 || >=11.0.0" - } - }, - "node_modules/tsx": { - "version": "4.23.1", - "resolved": "https://registry.npmjs.org/tsx/-/tsx-4.23.1.tgz", - "integrity": "sha512-GQHnkIfxyx1wYCOS/wonik5MVRZU9hi1TEZmzGZSCJB1y9YgoZ8H6itNE/u4suE+yLmOzuE4E5S4TZ/ZX2wcWQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "esbuild": "~0.28.0" - }, - "bin": { - "tsx": "dist/cli.mjs" - }, - "engines": { - "node": ">=18.0.0" - }, - "optionalDependencies": { - "fsevents": "~2.3.3" - } - }, - "node_modules/typescript": { - "version": "5.9.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", - "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", - "dev": true, - "license": "Apache-2.0", - "bin": { - "tsc": "bin/tsc", - "tsserver": "bin/tsserver" - }, - "engines": { - "node": ">=14.17" - } - }, - "node_modules/undici-types": { - "version": "7.24.6", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.24.6.tgz", - "integrity": "sha512-WRNW+sJgj5OBN4/0JpHFqtqzhpbnV0GuB+OozA9gCL7a993SmU+1JBZCzLNxYsbMfIeDL+lTsphD5jN5N+n0zg==", - "dev": true, - "license": "MIT" - } - } -} diff --git a/package.json b/package.json index e28d303..6481fb5 100644 --- a/package.json +++ b/package.json @@ -3,6 +3,7 @@ "version": "1.4.0", "description": "Git plugin that maintains a temporary integration branch for early conflict detection", "type": "module", + "packageManager": "pnpm@12.16.1", "bin": { "git-fi": "./dist/index.js" }, @@ -10,11 +11,11 @@ "scripts": { "start": "tsx src/index.ts", "gen:docs": "node --import tsx scripts/gen-docs.ts", - "build": "tsc && npm run gen:docs", + "build": "tsc && pnpm run gen:docs", "prepare": "tsc", - "test": "tsc && npm run verify:generated && node scripts/run-tests.mjs", + "test": "tsc && pnpm run verify:generated && node scripts/run-tests.mjs", "verify:generated": "node --import tsx scripts/gen-docs.ts --check", - "prepublishOnly": "npm test", + "prepublishOnly": "pnpm test", "trial:on": "bash scripts/trial.sh on", "trial:off": "bash scripts/trial.sh off", "docs": "node scripts/serve-docs.mjs" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml new file mode 100644 index 0000000..a9a4e86 --- /dev/null +++ b/pnpm-lock.yaml @@ -0,0 +1,487 @@ +--- +lockfileVersion: '9.0' + +importers: + + .: + configDependencies: {} + packageManagerDependencies: + pnpm: + specifier: 12.16.1 + version: 12.16.1 + +packages: + + '@pnpm/exe.android-arm64@12.16.1': + resolution: {integrity: sha512-PKf78Ew+i0CBYf0Xc+eMcqQiqyBT+u8XCVg1F5roc98/6wWfdYlWhrUMmEBiKWaJ3JqHxrtt8l1NwZ7qfJt2/Q==} + cpu: [arm64] + os: [android] + + '@pnpm/exe.android-x64@12.16.1': + resolution: {integrity: sha512-xdu7gMbB98pdvhwMeA6612Of515FDlRUtfA/1f7nWPZfPLnEdSRBO2u+1N0XBtQ/ennhPH/lrxB1gC6gnR/cdg==} + cpu: [x64] + os: [android] + + '@pnpm/exe.darwin-arm64@12.16.1': + resolution: {integrity: sha512-pVbmIIbhixiLvADLu1WA3TaW8FZy/D72R1De27WbbFx8/2mxvnsTyFVm4fO9kjpjMY7RzJd48CiQ96p8fO3ebQ==} + cpu: [arm64] + os: [darwin] + + '@pnpm/exe.darwin-x64@12.16.1': + resolution: {integrity: sha512-xZvQBFqcZjO7vFKTK3XsJpqY6lnBL9EWSLCzVUPq3kZ94+D96gwJCa76xxGNK8Cj32f4eeM91Qg+yNRR4sRpDw==} + cpu: [x64] + os: [darwin] + + '@pnpm/exe.freebsd-x64@12.16.1': + resolution: {integrity: sha512-zTtunfi9mBhRXiXEJYfwiJj0tk7MgTSfqDSRh+Az9FZ9THazVIiQiVNS8jpcsftDOqu7LKNffQdjmgwHDThfUg==} + cpu: [x64] + os: [freebsd] + + '@pnpm/exe.linux-arm64-musl@12.16.1': + resolution: {integrity: sha512-BJ3mOmcmQgcUo92Ee/WfEOt1pRiv3y2MMAkhEiYHd85UiPpHTfFhv+SpCbALmfExzXk3UlaRtMYwHlkQymc4VA==} + cpu: [arm64] + os: [linux] + libc: [musl] + + '@pnpm/exe.linux-arm64@12.16.1': + resolution: {integrity: sha512-JaRd5gNxwdNGBBkrZFt8bknrK4YmHVJBW0JMhUQ0fJ0dEYp6C2GT9ExaCqOO8EwYEyqM+jpKgJIK+8WFaJy3ew==} + cpu: [arm64] + os: [linux] + libc: [glibc] + + '@pnpm/exe.linux-ppc64@12.16.1': + resolution: {integrity: sha512-FnSV0Jv40S1cMv7vFNWwvu0X567Lec4L4HCRead3CFcD6zQDNbGw81s8N5bcKPahtPD9ApVuhsbmFCx4rw6RMw==} + cpu: [ppc64] + os: [linux] + libc: [glibc] + + '@pnpm/exe.linux-riscv64@12.16.1': + resolution: {integrity: sha512-C1Sww4FN5IttD4atRRhAKmQtSGWVp04ZAKNxO8pfu2bkRPwOW+7v+2DH1Xs1W+kZYYpO86BYDvUcadefF+AgaQ==} + cpu: [riscv64] + os: [linux] + libc: [glibc] + + '@pnpm/exe.linux-s390x@12.16.1': + resolution: {integrity: sha512-kn2fautsTcxIMODoovQVqZyfpDRdNgGkoeVqNdrKqbeBBvrEl+fXLkmZiq5xDht1LMr4sYiCNcsMfNMT6JPFmg==} + cpu: [s390x] + os: [linux] + libc: [glibc] + + '@pnpm/exe.linux-x64-musl@12.16.1': + resolution: {integrity: sha512-PM6ccHCOe/O9SsTflTJTYWfwogJZa6EmUvpnwZgiPguJBddh20wDQKgxUPXf48rDsPm9vMsIij0uHswwwbXL8g==} + cpu: [x64] + os: [linux] + libc: [musl] + + '@pnpm/exe.linux-x64@12.16.1': + resolution: {integrity: sha512-RK//8ZLcXGW8A2k8bQOXZDBN1Qu92zN4dYnG1bzj1zoQ1fkZ6jNzZ1AvXtsfGVma795CJtvoaF5bLXf4l/FIUw==} + cpu: [x64] + os: [linux] + libc: [glibc] + + '@pnpm/exe.win32-arm64@12.16.1': + resolution: {integrity: sha512-Ox3kNNVxtGw6pK7SVejmeOUgHhUTZgAM7NQQ6cU7frPw3ix9+j7d2MGbRg3fyEFAaKWq8ZAZLTQGcDyLnAu+qA==} + cpu: [arm64] + os: [win32] + + '@pnpm/exe.win32-x64@12.16.1': + resolution: {integrity: sha512-k+FhRJ0ttphFoFIVB1Sk4v76YJAulafmA/Ly57cysesUhhIzVlApeOShUz0jXubKx317TThlEfpQrukldnqORA==} + cpu: [x64] + os: [win32] + + pnpm@12.16.1: + resolution: {integrity: sha512-CR0d7nknV1Zhsl2rPCrjHK/BxU1rce1qZgDPDByxBDSkR+rhQBXxsj4ua+3u1535SpMuIWTSgyKA3OP7MvZW0Q==} + engines: {node: '>=18'} + hasBin: true + +snapshots: + + '@pnpm/exe.android-arm64@12.16.1': + optional: true + + '@pnpm/exe.android-x64@12.16.1': + optional: true + + '@pnpm/exe.darwin-arm64@12.16.1': + optional: true + + '@pnpm/exe.darwin-x64@12.16.1': + optional: true + + '@pnpm/exe.freebsd-x64@12.16.1': + optional: true + + '@pnpm/exe.linux-arm64-musl@12.16.1': + optional: true + + '@pnpm/exe.linux-arm64@12.16.1': + optional: true + + '@pnpm/exe.linux-ppc64@12.16.1': + optional: true + + '@pnpm/exe.linux-riscv64@12.16.1': + optional: true + + '@pnpm/exe.linux-s390x@12.16.1': + optional: true + + '@pnpm/exe.linux-x64-musl@12.16.1': + optional: true + + '@pnpm/exe.linux-x64@12.16.1': + optional: true + + '@pnpm/exe.win32-arm64@12.16.1': + optional: true + + '@pnpm/exe.win32-x64@12.16.1': + optional: true + + pnpm@12.16.1: + optionalDependencies: + '@pnpm/exe.android-arm64': 12.16.1 + '@pnpm/exe.android-x64': 12.16.1 + '@pnpm/exe.darwin-arm64': 12.16.1 + '@pnpm/exe.darwin-x64': 12.16.1 + '@pnpm/exe.freebsd-x64': 12.16.1 + '@pnpm/exe.linux-arm64': 12.16.1 + '@pnpm/exe.linux-arm64-musl': 12.16.1 + '@pnpm/exe.linux-ppc64': 12.16.1 + '@pnpm/exe.linux-riscv64': 12.16.1 + '@pnpm/exe.linux-s390x': 12.16.1 + '@pnpm/exe.linux-x64': 12.16.1 + '@pnpm/exe.linux-x64-musl': 12.16.1 + '@pnpm/exe.win32-arm64': 12.16.1 + '@pnpm/exe.win32-x64': 12.16.1 + +--- +lockfileVersion: '9.0' + +settings: + autoInstallPeers: true + excludeLinksFromLockfile: false + +importers: + + .: + devDependencies: + '@types/node': + specifier: ^25.5.0 + version: 25.9.5 + tsx: + specifier: ^4.7.0 + version: 4.23.1 + typescript: + specifier: ^5.3.0 + version: 5.9.3 + +packages: + + '@esbuild/aix-ppc64@0.28.1': + resolution: {integrity: sha512-Svl7tq8k/08+p6CXPpRjQ1fKX+1odH/BQbb48fV6fj3CWHhsoIOoY87w1oHXm0qEpkIK3ZfVgp0hed3XBXzXMQ==} + engines: {node: '>=18'} + cpu: [ppc64] + os: [aix] + + '@esbuild/android-arm64@0.28.1': + resolution: {integrity: sha512-34EGEbCIAgosYz6goLcopX6Mo7NyGv9tfwEM2/7Ce2VcVRk568iSvniGWcUXIy7wEDR1wzolcxcriFVrWYcwBg==} + engines: {node: '>=18'} + cpu: [arm64] + os: [android] + + '@esbuild/android-arm@0.28.1': + resolution: {integrity: sha512-0k2F129Xdio1TdJfzJ8sy1Q47vUD2NnwdhiAf7drUN1EBTfPf4hsFCtmMgu/6m8JSzsBrlmVjudMBQqOfG8usQ==} + engines: {node: '>=18'} + cpu: [arm] + os: [android] + + '@esbuild/android-x64@0.28.1': + resolution: {integrity: sha512-dbwY7ltSMDWsRatcRpCnES4F+im88OCUgGZjy52shC7GqHRE/cYlxNbB4Z4UpJswpcc4Qxd2oE/ufM0p61IKng==} + engines: {node: '>=18'} + cpu: [x64] + os: [android] + + '@esbuild/darwin-arm64@0.28.1': + resolution: {integrity: sha512-TZbWkQY7kvTAXbXUT7uVACR5cMHsDiSz9z7ZKAX/RTq/WJEk3QyRr0wZpNhBDX+/0CtdqUIJlOiodQcta6tY3Q==} + engines: {node: '>=18'} + cpu: [arm64] + os: [darwin] + + '@esbuild/darwin-x64@0.28.1': + resolution: {integrity: sha512-zfdzgK9ACBNZLI/CyHTOx81SyNbM6YXn7rxSgX97VjyiPl9W1i4Ka4fgKECEoFCKGpvBj5qArWIGgQjOwkgskQ==} + engines: {node: '>=18'} + cpu: [x64] + os: [darwin] + + '@esbuild/freebsd-arm64@0.28.1': + resolution: {integrity: sha512-wG2EA8ENdEI0qhkSZMjfqrdY+ziCYCPMmtZjjIwOmXFjmyzEHn+UUxk5of+SYsjtfs3VpnlC7QLzSI5hY/rOAw==} + engines: {node: '>=18'} + cpu: [arm64] + os: [freebsd] + + '@esbuild/freebsd-x64@0.28.1': + resolution: {integrity: sha512-i7dZ9vQgnvSCzi/rYCXNgtF/U+eKZNJBzu3eTQbRgHnM7tNSizLOkRFAl3qzVc/Op/u5YkHHa4pf/3DOYHthLQ==} + engines: {node: '>=18'} + cpu: [x64] + os: [freebsd] + + '@esbuild/linux-arm64@0.28.1': + resolution: {integrity: sha512-yHs+0uc8+nvEAfAfxrWQKK5peSNzBc4PegcMO0EJ2hT71uA7vB8Ihg2e77R2P7SG5uYjPbHlLLmve4LLLRCf0g==} + engines: {node: '>=18'} + cpu: [arm64] + os: [linux] + + '@esbuild/linux-arm@0.28.1': + resolution: {integrity: sha512-qVXBOHQS+d5Y722GwJzJUtOLlX7km3CraOaGormF1pDtPd2C/l1SHRPgjLunLGe51Sh5YYWKMFDyV4SxgMQYTQ==} + engines: {node: '>=18'} + cpu: [arm] + os: [linux] + + '@esbuild/linux-ia32@0.28.1': + resolution: {integrity: sha512-d1z4ZuP0ajrfz/FhGT4vv278rX8KnPPJx8i5+AtK7TYbx9Le9F1hyzurZpkEyjkGa9dUGhQow4C1NmeGvqxN2w==} + engines: {node: '>=18'} + cpu: [ia32] + os: [linux] + + '@esbuild/linux-loong64@0.28.1': + resolution: {integrity: sha512-M5sRjUVZrkm1OAPR3dlOYzNmN+loZKGVi1VUQGrwuqLcbR6qeAz+famMhjASeH3YVKvZz+zT1jlh/keC3Rj/lg==} + engines: {node: '>=18'} + cpu: [loong64] + os: [linux] + + '@esbuild/linux-mips64el@0.28.1': + resolution: {integrity: sha512-mRObBZeHh2OxcBFPWE/FjylkRgZdYuiTR3vaTozquCGOH14iP9oN4x4Ge81CoIDYQrXmIxpFumJBu5MtZpnQJQ==} + engines: {node: '>=18'} + cpu: [mips64el] + os: [linux] + + '@esbuild/linux-ppc64@0.28.1': + resolution: {integrity: sha512-slScBsMAb3GFDcdrCgLwZtPYRoH2H/youv10QiZyRjmsP48fznoveWytSgCI/R0ZcUgpc0ZhIUEx6LHts8yrfQ==} + engines: {node: '>=18'} + cpu: [ppc64] + os: [linux] + + '@esbuild/linux-riscv64@0.28.1': + resolution: {integrity: sha512-kw0owk1o0GFETUJyW0jc0G4Yzs0BHZn0JDZ8JRT088vjJYX777BAs1fDGxAC+q831qOs2DTC96mNsG2opdfyyQ==} + engines: {node: '>=18'} + cpu: [riscv64] + os: [linux] + + '@esbuild/linux-s390x@0.28.1': + resolution: {integrity: sha512-/lAIjX8aYFRByhh6L5rYtPEDRqa9de/4V/juOXcta5frjvzXO4/sqEtyytse0g3zZFuWu5cDN0MkLz2qRDD2Ag==} + engines: {node: '>=18'} + cpu: [s390x] + os: [linux] + + '@esbuild/linux-x64@0.28.1': + resolution: {integrity: sha512-u/anNYF2mmVOEDwLtnQ1wOr3EZ9sTNGLWrsYGYwHWzGA3Si84IOkHXlbWTD1NB+9/1lcnweYKO54uhxZydNzfA==} + engines: {node: '>=18'} + cpu: [x64] + os: [linux] + + '@esbuild/netbsd-arm64@0.28.1': + resolution: {integrity: sha512-oks0DYbLwWMmaakTsCb+zL4E+aHRVLom9IJZOAthMQEPiQmydXHkziYEsGYRx0uNV/IjEKGAV941JzH02pflqw==} + engines: {node: '>=18'} + cpu: [arm64] + os: [netbsd] + + '@esbuild/netbsd-x64@0.28.1': + resolution: {integrity: sha512-aeL6lAnN89Hz43Mlh1G8ARasbuoYvSITDEx0tHh5b7jJnHcssqgjy9Yx430GDpmCa6OyrKoS0aNRjKundRizGg==} + engines: {node: '>=18'} + cpu: [x64] + os: [netbsd] + + '@esbuild/openbsd-arm64@0.28.1': + resolution: {integrity: sha512-MEFJe5C3R8pwXdZ5Y21oo6m7ePiS0d9pWucn99O/wvyJZChoIQKrQDxKrGeW8F5+T0okTHesAmDeiHDTIq0V/Q==} + engines: {node: '>=18'} + cpu: [arm64] + os: [openbsd] + + '@esbuild/openbsd-x64@0.28.1': + resolution: {integrity: sha512-i/ZLIOafE0Z8cI/XANJAixoJL/uRAoS2xOA3rb0xN+KK0K177cMAsQYkzHtBrtMXAKuAc7HGgcWiZ/sRC1Nxgw==} + engines: {node: '>=18'} + cpu: [x64] + os: [openbsd] + + '@esbuild/openharmony-arm64@0.28.1': + resolution: {integrity: sha512-ge+Z7EXFNt2BO1oAMsVpiQ8EwndV9i1xXerAeTIK7AtPs3bKFXQM7nlRxDSIUIMeueR1CNXxqztLzdNeReKBJg==} + engines: {node: '>=18'} + cpu: [arm64] + os: [openharmony] + + '@esbuild/sunos-x64@0.28.1': + resolution: {integrity: sha512-BEjgtECkL3vY+SaSQ6nzVfiALUeFxpawyp8Jmf5PtYhf1Ug40N1h/hxlhts+f1FvSvarEigdxS3BlSMI2PJLcQ==} + engines: {node: '>=18'} + cpu: [x64] + os: [sunos] + + '@esbuild/win32-arm64@0.28.1': + resolution: {integrity: sha512-lCv9eK/H6ZJWbE7bh2nw54CZ9M2nupBxJcTsdk/QQnWkdSjKGuxmmH8/GWrlT1eMmZfn4dGcCjRte397WqfQXA==} + engines: {node: '>=18'} + cpu: [arm64] + os: [win32] + + '@esbuild/win32-ia32@0.28.1': + resolution: {integrity: sha512-zvb/mB2bSCoJOpoCBgYKKpX6YM6mJBlBUVUtVj41DlZJVEB6/0CKlRYxP5wWl1C1ILiCoAU5wZZ4q1P3qeS6Eg==} + engines: {node: '>=18'} + cpu: [ia32] + os: [win32] + + '@esbuild/win32-x64@0.28.1': + resolution: {integrity: sha512-bm4Mowrv+GXMlpWX++EcXw/iLyd1o3+bJkC2DkWXYVvgZCqD/bSj9ctZeAMC3cIxgjRVR2Dufaiu4YPxr5gW1A==} + engines: {node: '>=18'} + cpu: [x64] + os: [win32] + + '@types/node@25.9.5': + resolution: {integrity: sha512-OScDchr2fwuUmWdf4kZ9h7PcJiYDVInhJizG/biAq3cAvqwYktuy/TYGGdZNMtNTFUP7rnb0NU4TUdm82kt4Rg==} + + esbuild@0.28.1: + resolution: {integrity: sha512-HrJrvZv5ayxBzPfwphOoNzkzOIIlifzk0KJrGK2c8R4+LKpMtpYLQeUdjnwjWv/LZlkH2laZk+4w78pi99D4Vw==} + engines: {node: '>=18'} + hasBin: true + + fsevents@2.3.3: + resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==} + engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} + os: [darwin] + + tsx@4.23.1: + resolution: {integrity: sha512-GQHnkIfxyx1wYCOS/wonik5MVRZU9hi1TEZmzGZSCJB1y9YgoZ8H6itNE/u4suE+yLmOzuE4E5S4TZ/ZX2wcWQ==} + engines: {node: '>=18.0.0'} + hasBin: true + + typescript@5.9.3: + resolution: {integrity: sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==} + engines: {node: '>=14.17'} + hasBin: true + + undici-types@7.24.6: + resolution: {integrity: sha512-WRNW+sJgj5OBN4/0JpHFqtqzhpbnV0GuB+OozA9gCL7a993SmU+1JBZCzLNxYsbMfIeDL+lTsphD5jN5N+n0zg==} + +snapshots: + + '@esbuild/aix-ppc64@0.28.1': + optional: true + + '@esbuild/android-arm64@0.28.1': + optional: true + + '@esbuild/android-arm@0.28.1': + optional: true + + '@esbuild/android-x64@0.28.1': + optional: true + + '@esbuild/darwin-arm64@0.28.1': + optional: true + + '@esbuild/darwin-x64@0.28.1': + optional: true + + '@esbuild/freebsd-arm64@0.28.1': + optional: true + + '@esbuild/freebsd-x64@0.28.1': + optional: true + + '@esbuild/linux-arm64@0.28.1': + optional: true + + '@esbuild/linux-arm@0.28.1': + optional: true + + '@esbuild/linux-ia32@0.28.1': + optional: true + + '@esbuild/linux-loong64@0.28.1': + optional: true + + '@esbuild/linux-mips64el@0.28.1': + optional: true + + '@esbuild/linux-ppc64@0.28.1': + optional: true + + '@esbuild/linux-riscv64@0.28.1': + optional: true + + '@esbuild/linux-s390x@0.28.1': + optional: true + + '@esbuild/linux-x64@0.28.1': + optional: true + + '@esbuild/netbsd-arm64@0.28.1': + optional: true + + '@esbuild/netbsd-x64@0.28.1': + optional: true + + '@esbuild/openbsd-arm64@0.28.1': + optional: true + + '@esbuild/openbsd-x64@0.28.1': + optional: true + + '@esbuild/openharmony-arm64@0.28.1': + optional: true + + '@esbuild/sunos-x64@0.28.1': + optional: true + + '@esbuild/win32-arm64@0.28.1': + optional: true + + '@esbuild/win32-ia32@0.28.1': + optional: true + + '@esbuild/win32-x64@0.28.1': + optional: true + + '@types/node@25.9.5': + dependencies: + undici-types: 7.24.6 + + esbuild@0.28.1: + optionalDependencies: + '@esbuild/aix-ppc64': 0.28.1 + '@esbuild/android-arm': 0.28.1 + '@esbuild/android-arm64': 0.28.1 + '@esbuild/android-x64': 0.28.1 + '@esbuild/darwin-arm64': 0.28.1 + '@esbuild/darwin-x64': 0.28.1 + '@esbuild/freebsd-arm64': 0.28.1 + '@esbuild/freebsd-x64': 0.28.1 + '@esbuild/linux-arm': 0.28.1 + '@esbuild/linux-arm64': 0.28.1 + '@esbuild/linux-ia32': 0.28.1 + '@esbuild/linux-loong64': 0.28.1 + '@esbuild/linux-mips64el': 0.28.1 + '@esbuild/linux-ppc64': 0.28.1 + '@esbuild/linux-riscv64': 0.28.1 + '@esbuild/linux-s390x': 0.28.1 + '@esbuild/linux-x64': 0.28.1 + '@esbuild/netbsd-arm64': 0.28.1 + '@esbuild/netbsd-x64': 0.28.1 + '@esbuild/openbsd-arm64': 0.28.1 + '@esbuild/openbsd-x64': 0.28.1 + '@esbuild/openharmony-arm64': 0.28.1 + '@esbuild/sunos-x64': 0.28.1 + '@esbuild/win32-arm64': 0.28.1 + '@esbuild/win32-ia32': 0.28.1 + '@esbuild/win32-x64': 0.28.1 + + fsevents@2.3.3: + optional: true + + tsx@4.23.1: + dependencies: + esbuild: 0.28.1 + optionalDependencies: + fsevents: 2.3.3 + + typescript@5.9.3: {} + + undici-types@7.24.6: {} diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml new file mode 100644 index 0000000..31cf55a --- /dev/null +++ b/pnpm-workspace.yaml @@ -0,0 +1,8 @@ +# pnpm settings for this checkout; the repo is a single package, not a +# workspace. +# +# pnpm runs no dependency's install script unless it is allowed here, and fails +# the install over one it skipped. esbuild (under tsx) uses its script to check +# its platform binary. +allowBuilds: + esbuild: true diff --git a/scripts/gen-docs.ts b/scripts/gen-docs.ts index 55e4383..599a3c0 100644 --- a/scripts/gen-docs.ts +++ b/scripts/gen-docs.ts @@ -1,10 +1,10 @@ // Generates the man page, shell completions, and the docs reference tables from // src/help.ts so the flag list has a single source of truth. Run via -// `npm run gen:docs` (wired into `npm run build`). The generated files under +// `pnpm run gen:docs` (wired into `pnpm run build`). The generated files under // man/ and completions/, and the marked table regions in docs/, are committed — // do not hand-edit them. // -// `--check` (via `npm run verify:generated`, which `npm test` and CI both run) +// `--check` (via `pnpm run verify:generated`, which `pnpm test` and CI both run) // reports whether the committed files match what this script would write, and // writes nothing. import { readFileSync, writeFileSync, mkdirSync, existsSync } from "node:fs"; @@ -217,7 +217,7 @@ if (process.argv.includes("--check")) { process.stderr.write( `Generated files are out of date with src/help.ts:\n` + stale.map((o) => ` ${o.relPath}\n`).join("") + - `\nRun 'npm run gen:docs' and commit the result.\n` + `\nRun 'pnpm run gen:docs' and commit the result.\n` ); process.exit(1); } diff --git a/scripts/run-tests.mjs b/scripts/run-tests.mjs index f2c3a22..12fbad3 100644 --- a/scripts/run-tests.mjs +++ b/scripts/run-tests.mjs @@ -4,7 +4,7 @@ // glob matches nothing: report `tests 0` and exit 0. A pattern that drifts — // a renamed directory, a changed suffix — then reads as a green suite that ran // nothing, which is the one test-harness failure no test can catch. -// Passing explicit paths also keeps the shell out of it, so `npm test` behaves +// Passing explicit paths also keeps the shell out of it, so `pnpm test` behaves // the same under sh and cmd. import { readdirSync } from "node:fs"; import { spawnSync } from "node:child_process"; diff --git a/scripts/serve-docs.mjs b/scripts/serve-docs.mjs index cd05083..af9fd26 100644 --- a/scripts/serve-docs.mjs +++ b/scripts/serve-docs.mjs @@ -1,5 +1,5 @@ // Serves docs/ the way GitHub Pages does, for previewing the Docsify site -// locally (npm run docs). Docsify renders in the browser, so any static server +// locally (pnpm run docs). Docsify renders in the browser, so any static server // works; this one keeps the preview free of extra dependencies. // // The spec page includes spec-body.md, which the Pages workflow copies from diff --git a/scripts/trial.sh b/scripts/trial.sh index b3814a6..2264364 100644 --- a/scripts/trial.sh +++ b/scripts/trial.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -# Local trial helper (npm run trial:on / trial:off). Points `git fi` at this +# Local trial helper (pnpm run trial:on / trial:off). Points `git fi` at this # working copy and loads the completion the way a user installs it, so the change # can be run for a few days before shipping, then reverts. Not published (see # package.json "files"). @@ -19,21 +19,34 @@ zshrc="${HOME}/.zshrc" marker="git-fi-trial" pkg="@gettyimages/git-fi" +# pnpm's global commands, run from outside the checkout. Inside it pnpm sees the +# `packageManager` pin and warns on every one that --global skips that check, +# which is about this project rather than the global directory being changed. +pnpm_g() { + pnpm --dir "$HOME" "$@" -g +} + # What the global install is right now: a version for a registry install, # `linked` where it already points at a checkout, or empty where the package is -# absent. `npm link` overwrites that install, so the answer has to be taken -# before it runs and kept for `off` to restore. `npm ls` exits non-zero on some -# tree problems while still printing usable JSON, so its status is discarded -# rather than aborting the run under `pipefail`. +# absent. Linking the checkout overwrites that install, so the answer has to be +# taken before it runs and kept for `off` to restore. `pnpm ls` can exit +# non-zero while still printing usable JSON, so its status is discarded rather +# than aborting the run under `pipefail`. installed_state() { - { npm ls -g --depth=0 --json "$pkg" 2>/dev/null || true; } | node -e ' - const raw = require("fs").readFileSync(0, "utf8"); + { pnpm_g ls --depth=0 --json 2>/dev/null || true; } | node -e ' + const fs = require("fs"); + const raw = fs.readFileSync(0, "utf8"); try { - const dep = (JSON.parse(raw).dependencies ?? {})[process.argv[1]]; + const dep = JSON.parse(raw) + .map((tree) => (tree.dependencies ?? {})[process.argv[1]]) + .find(Boolean); if (!dep) process.exit(0); - // A linked checkout reports `resolved` as a file: URL; only a - // registry install names a version to come back to. - if (String(dep.resolved ?? "").startsWith("file:")) process.stdout.write("linked"); + // pnpm reports a linked checkout with the version its package.json + // holds, so the version alone cannot tell the two apart. A registry + // install resolves into a node_modules (the global directory or the + // store); a linked one resolves to the checkout itself. + const real = fs.realpathSync(dep.path); + if (!/[\\/]node_modules[\\/]/.test(real)) process.stdout.write("linked"); else if (dep.version) process.stdout.write(dep.version); } catch (e) { process.stderr.write(`could not read the global ${process.argv[1]}: ${e.message}\n`); @@ -44,7 +57,26 @@ installed_state() { case "${1:-}" in on) cd "$root" - npm run build + + # installed_state sees only pnpm's global directory. A copy installed with + # npm would sit beside the link rather than be replaced by it, and trial:off + # would then add a second copy instead of handing the first one back. + if command -v npm >/dev/null && npm ls -g --depth=0 "$pkg" >/dev/null 2>&1; then + echo "! $pkg is installed with npm, so a pnpm trial would sit beside it rather than replace it." >&2 + echo " Remove it first (npm rm -g $pkg), then re-run." >&2 + exit 1 + fi + + # pnpm refuses a global add while its bin directory is off PATH, which is the + # state of any terminal opened before `pnpm setup` edited the rc file. Asked + # here, before the build and before anything lands under .trial/: + # `pnpm bin -g` makes the same check and prints pnpm's own error. + if ! pnpm_g bin >/dev/null; then + echo "! Run \`pnpm setup\` if you never have, then open a new terminal (or \`exec zsh\`) and re-run." >&2 + exit 1 + fi + + pnpm run build mkdir -p "$root/.trial" if [ ! -f "$restore" ]; then @@ -65,9 +97,13 @@ on) esac fi - npm link + # A directory added globally is saved as a `link:` dependency, so later + # builds take effect without reinstalling (pnpm 12 has no `link --global`). + pnpm_g add "$root" - node "$root/dist/index.js" install-completions --write "$compdir" + # install-completions tells a user how to get the directory onto their fpath; + # the block below is how the trial does that, so its advice is noise here. + node "$root/dist/index.js" install-completions --write "$compdir" >/dev/null if ! grep -qF "# BEGIN ${marker}" "$zshrc" 2>/dev/null; then # Autoload the two files directly rather than re-running compinit: this @@ -94,8 +130,8 @@ off) version="" [ -f "$restore" ] && version="$(cat "$restore")" - # `npm i -g @` takes far more than a version — a URL, a git ref, - # a `file:` path, an `npm:` alias — and this value comes off disk. Anything + # `pnpm add -g @` takes far more than a version — a URL, a git + # ref, a `file:` path, an `npm:` alias — and this value comes off disk. Anything # that isn't a bare version is refused rather than fetched. case "$version" in "") ;; @@ -127,24 +163,24 @@ off) if [ -n "$version" ]; then # The exact version the trial displaced, not whatever is newest: a trial # should hand back the install it borrowed. - npm rm -g "$pkg" || true - npm i -g "$pkg@$version" + pnpm_g rm "$pkg" || true + pnpm_g add "$pkg@$version" elif [ -n "$state" ] && [ "$state" != "linked" ]; then # Nothing is linked, so no trial is running and this install is someone's # own choice. Reinstalling here would replace it with whatever is newest, # which is the outcome the recorded version exists to prevent. echo "No trial to revert; $pkg@$state is installed from the registry. Leaving it alone." else - npm rm -g "$pkg" || true + pnpm_g rm "$pkg" || true echo "No recorded version to come back to; installing the latest $pkg." - npm i -g "$pkg" + pnpm_g add "$pkg" fi echo echo "Reverted. Open a new terminal, then \`git fi --version\` to confirm." ;; *) - echo "usage: npm run trial:on | npm run trial:off" >&2 + echo "usage: pnpm run trial:on | pnpm run trial:off" >&2 exit 1 ;; esac diff --git a/src/which.ts b/src/which.ts index 4cde639..2be9dcb 100644 --- a/src/which.ts +++ b/src/which.ts @@ -10,7 +10,16 @@ // install once the shadow is gone. So the check runs where someone is already // asking which git-fi they have (`--version`, INSTALL-01) and compares the // launcher PATH resolves against the copy answering. -import { accessSync, constants, lstatSync, readFileSync, realpathSync } from "node:fs"; +import { + accessSync, + closeSync, + constants, + lstatSync, + openSync, + readFileSync, + readSync, + realpathSync, +} from "node:fs"; import { dirname, join } from "node:path"; import { makeStyle, hintsOptedOut } from "./style.js"; import type { Options } from "./types.js"; @@ -168,20 +177,49 @@ export function shadowingLauncher(entry: string | undefined, path?: string): str return null; } -/** The INSTALL-01 notice body, kept pure so it can be asserted without a PATH. */ +/** + * Whether a launcher is one RubyGems generated, which is how the Ruby gem + * git-fi used to ship as installed its `git-fi`. RubyGems stamps every + * launcher it writes with this comment near the top, so the first few hundred + * bytes settle it. + */ +export function isRubyGemsLauncher(launcher: string): boolean { + let fd: number | undefined; + try { + fd = openSync(launcher, "r"); + const head = Buffer.alloc(512); + const n = readSync(fd, head, 0, head.length, 0); + return head.subarray(0, n).toString("utf8").includes("generated by RubyGems"); + } catch { + return false; + } finally { + if (fd !== undefined) closeSync(fd); + } +} + +/** + * The INSTALL-01 notice body, kept pure so it can be asserted without a PATH. + * `fromGem` adds the one fact a stale gem launcher needs: removing the gem's + * files by hand leaves it behind. On any other launcher that sentence names a + * tool the reader may never have installed. + */ export function shadowNotice( winner: string, entry: string, - s: ReturnType + s: ReturnType, + fromGem = false ): string { return ( `\n${s.yellow("A different git-fi is ahead of this one on your PATH")}\n` + ` git fi reaches ${winner}\n` + ` this copy is ${entry}\n` + + (fromGem + ? `That one was installed by git-fi's old Ruby gem. Removing the gem's\n` + + `files by hand leaves this launcher behind in Ruby's bin directory.\n` + : "") + `Delete the one above, or put npm's bin directory (${npmBinHint()})\n` + `or pnpm's (pnpm bin -g) earlier on your PATH, whichever installed\n` + - `this copy. A launcher left behind by the Ruby gem lands in\n` + - `Ruby's bin directory, which removing the gem's own files does not touch.\n` + `this copy.\n` ); } @@ -239,5 +277,7 @@ export function warnIfShadowed(opts: Options): void { } const winner = shadowingLauncher(entry); - if (winner) process.stderr.write(shadowNotice(winner, entry, makeStyle(opts))); + if (winner) { + process.stderr.write(shadowNotice(winner, entry, makeStyle(opts), isRubyGemsLauncher(winner))); + } } diff --git a/test/which.test.ts b/test/which.test.ts index e8f4dea..7341fd0 100644 --- a/test/which.test.ts +++ b/test/which.test.ts @@ -9,6 +9,7 @@ import { shadowingLauncher, shadowNotice, reachesNotice, + isRubyGemsLauncher, } from "../src/which.ts"; import { makeStyle } from "../src/style.ts"; @@ -317,6 +318,30 @@ describe("shadowNotice (INSTALL-01)", () => { assert.ok(notice.includes("npm config get prefix"), notice); assert.ok(notice.includes("pnpm bin -g"), notice); }); + + test("mentions the Ruby gem only for a launcher the gem left", () => { + assert.doesNotMatch(shadowNotice("/other/bin/git-fi", "/npm/git-fi", s), /Ruby|gem/); + assert.match(shadowNotice("/ruby/bin/git-fi", "/npm/git-fi", s, true), /old Ruby gem/); + }); +}); + +describe("isRubyGemsLauncher (INSTALL-01)", () => { + test("recognizes the launcher RubyGems generates", () => { + const dir = dirWith( + ["git-fi"], + "#!/usr/bin/ruby\n#\n# This file was generated by RubyGems.\n#\nrequire 'rubygems'\n" + ); + assert.equal(isRubyGemsLauncher(join(dir, "git-fi")), true); + }); + + test("a pnpm or npm launcher is not one", () => { + const dir = dirWith(["git-fi"], "#!/bin/sh\n# cmd-shim-target=/x/dist/index.js\n"); + assert.equal(isRubyGemsLauncher(join(dir, "git-fi")), false); + }); + + test("a launcher that cannot be read is not one", () => { + assert.equal(isRubyGemsLauncher(join(tmpdir(), "git-fi-no-such-launcher")), false); + }); }); describe("reachesNotice (INSTALL-01, under npx)", () => {