Skip to content

docs(site): show release version and github stars#443

Merged
jdx merged 3 commits intomainfrom
codex/release-version-title
Apr 25, 2026
Merged

docs(site): show release version and github stars#443
jdx merged 3 commits intomainfrom
codex/release-version-title

Conversation

@jdx
Copy link
Copy Markdown
Owner

@jdx jdx commented Apr 25, 2026

Summary

  • read the latest site release label from Cargo.toml and show it as the releases nav item
  • add a GitHub star counter to the VitePress social nav, matching the existing aube/mise pattern

Validation

  • npm run docs:build in /home/jdx/src/fnox-release-version/docs

Note: build completed with an existing VitePress warning about the missing gitignore syntax highlighter. Local hooks were skipped for commit/push because this worktree's installed hk hook uses an unsupported --from-hook argument; the targeted docs build passed.

This PR was generated by Codex.


Note

Low Risk
Docs-only changes that add a small amount of build-time parsing and an optional GitHub API fetch; main risk is minor build/UI regressions if version parsing or DOM injection fails.

Overview
Docs site nav now shows the current release version. The VitePress config reads Cargo.toml at build time, extracts the package version, and replaces the static “Releases” nav label with v<version> linking to GitHub releases.

Adds an optional GitHub stars badge in the social nav. A new stars.data.ts loader can fetch stargazers_count (only when a token or UPDATE_GITHUB_STARS=1 is set), and the custom theme injects the formatted count next to the GitHub social link with accompanying CSS styling.

Reviewed by Cursor Bugbot for commit 7d806c9. Bugbot is set up for automated code reviews on this repo. Configure here.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request implements dynamic versioning in the documentation by extracting the version from Cargo.toml and adds a GitHub star count badge to the social links. The star count is retrieved during the build process with a fallback value. Key feedback includes improving the robustness of the version extraction regex, adding a timeout to the GitHub API fetch call to prevent build hangs, and optimizing the performance of the DOM observer used to inject the star count badge.

Comment thread docs/.vitepress/config.mjs Outdated
const commands = getCommands(spec.cmd);
const configDir = dirname(fileURLToPath(import.meta.url));
const cargoToml = readFileSync(resolve(configDir, "../../Cargo.toml"), "utf8");
const versionMatch = cargoToml.match(/\[package\][\s\S]*?\nversion\s*=\s*"([^"]+)"/);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The regular expression for extracting the version from Cargo.toml might fail if there is leading whitespace before the version key, which is valid in TOML. Adding \s* after the newline makes it more robust.

const versionMatch = cargoToml.match(/\[package\][\s\S]*?\n\s*version\s*=\s*"([^"]+)"/);

Comment on lines +22 to +24
const response = await fetch("https://api.github.com/repos/jdx/fnox", {
headers,
});
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The fetch call lacks a timeout. If the GitHub API is slow or unresponsive, it could hang the documentation build process indefinitely. Adding a signal with a timeout is recommended for better build reliability.

        const response = await fetch("https://api.github.com/repos/jdx/fnox", {
          headers,
          signal: AbortSignal.timeout(10000),
        });

Comment thread docs/.vitepress/theme/index.js Outdated
Comment on lines +35 to +38
addStarCount();
setTimeout(addStarCount, 100);
const observer = new MutationObserver(addStarCount);
observer.observe(document.body, { childList: true, subtree: true });
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Using a MutationObserver on document.body with subtree: true is quite heavy as it triggers on every DOM change across the entire page. Additionally, the setTimeout is a fragile workaround that is redundant if the observer is active. Consider observing a more specific element like #app and removing the manual delay.

Suggested change
addStarCount();
setTimeout(addStarCount, 100);
const observer = new MutationObserver(addStarCount);
observer.observe(document.body, { childList: true, subtree: true });
addStarCount();
const observer = new MutationObserver(addStarCount);
const target = document.getElementById("app") || document.body;
observer.observe(target, { childList: true, subtree: true });

@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented Apr 25, 2026

Greptile Summary

This PR enhances the docs site nav by reading the current version from Cargo.toml at build time and displaying it as the releases link label, and adds an optional GitHub star counter badge to the social nav via a VitePress data loader and a MutationObserver-based client injector. Previously flagged concerns (silent version fallback now emits console.warn, observer now disconnected both on success and on unmount) are correctly addressed in this version of the code.

Confidence Score: 5/5

Safe to merge — docs-only change with well-handled fallbacks and no runtime regressions.

All four files are docs-only. The version-parsing failure case now emits a visible warning. The MutationObserver is disconnected correctly on both success and unmount. The stars fetch is fully optional and gracefully degrades. No P1 or P0 findings identified.

No files require special attention.

Important Files Changed

Filename Overview
docs/.vitepress/config.mjs Reads Cargo.toml at build time to display the current version in the nav; includes a console.warn fallback when the version can't be parsed.
docs/.vitepress/stars.data.ts New VitePress data loader that optionally fetches GitHub star count at build time; gracefully falls back to empty string when the env token is absent or the request fails.
docs/.vitepress/theme/index.js Adds a theme-level setup() that injects a star-count badge via MutationObserver; observer is correctly disconnected both on success and on component unmount.
docs/.vitepress/theme/style.css Adds CSS for the GitHub star badge below the social icon; uses !important overrides to work around VitePress defaults and hides the badge on mobile.

Sequence Diagram

sequenceDiagram
    participant Build as VitePress Build
    participant Cargo as Cargo.toml
    participant GH as GitHub API
    participant Nav as Nav Bar (client)

    Build->>Cargo: readFileSync(../../Cargo.toml)
    Cargo-->>Build: version string
    Build->>Build: regex match → latestVersion
    Build->>Nav: nav label = v{latestVersion}

    alt GITHUB_TOKEN or UPDATE_GITHUB_STARS=1
        Build->>GH: GET /repos/jdx/fnox (10s timeout)
        GH-->>Build: { stargazers_count: N }
        Build->>Build: formatStars(N) → starsData.stars
    else no token / offline
        Build->>Build: starsData.stars = "" (fallback)
    end

    Build-->>Nav: hydrate starsData

    Nav->>Nav: onMounted → addStarCount()
    alt .VPSocialLinks already in DOM
        Nav->>Nav: append .star-count span → observer.disconnect()
    else nav not yet rendered
        Nav->>Nav: MutationObserver watches .VPNav
        Nav->>Nav: badge found → observer.disconnect()
    end
    Nav->>Nav: onUnmounted → observer?.disconnect() (safety)
Loading

Reviews (3): Last reviewed commit: "docs(site): address release nav feedback" | Re-trigger Greptile

Comment thread docs/.vitepress/theme/index.js Outdated
Comment thread docs/.vitepress/config.mjs Outdated
@jdx jdx marked this pull request as ready for review April 25, 2026 15:02
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 7d806c9. Configure here.

observer.observe(document.querySelector(".VPNav") || document.body, {
childList: true,
subtree: true,
});
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MutationObserver never disconnects when stars data empty

Low Severity

When starsData.stars is "" (the common default — no GitHub token set), addStarCount() always returns false due to the early !starsData.stars guard. This causes the MutationObserver to be created on .VPNav or document.body with subtree: true, and since addStarCount() never returns true, the observer never disconnects. It fires its callback on every DOM mutation for the entire page lifetime, doing no useful work. The empty-stars case needs to be checked before creating the observer.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 7d806c9. Configure here.

@jdx jdx merged commit b3baaba into main Apr 25, 2026
16 checks passed
@jdx jdx deleted the codex/release-version-title branch April 25, 2026 16:34
jdx pushed a commit that referenced this pull request Apr 26, 2026
### 🚀 Features

- **(library)** top-level Fnox::discover() / get / list convenience API
by [@bglusman](https://github.com/bglusman) in
[#442](#442)

### 🐛 Bug Fixes

- **(docs)** stack banner and pin close button on mobile by
[@jdx](https://github.com/jdx) in
[#437](#437)
- **(set)** fall back to current provider when updating secrets by
[@rpendleton](https://github.com/rpendleton) in
[#439](#439)

### 📚 Documentation

- **(site)** show release version and github stars by
[@jdx](https://github.com/jdx) in
[#443](#443)
- add cross-site announcement banner by [@jdx](https://github.com/jdx)
in [#434](#434)
- respect banner expires field by [@jdx](https://github.com/jdx) in
[#436](#436)

### 🛡️ Security

- **(build)** deterministic provider ordering in generated schema by
[@jdx](https://github.com/jdx) in
[#432](#432)

### 🔍 Other Changes

- **(release)** append en.dev sponsor blurb to release notes by
[@jdx](https://github.com/jdx) in
[#431](#431)

### 📦️ Dependency Updates

- bump communique to 1.0.3 by [@jdx](https://github.com/jdx) in
[#435](#435)
- bump communique 1.0.3 → 1.0.4 by [@jdx](https://github.com/jdx) in
[#438](#438)

### New Contributors

- @bglusman made their first contribution in
[#442](#442)
jdx pushed a commit that referenced this pull request Apr 26, 2026
### 🚀 Features

- **(library)** top-level Fnox::discover() / get / list convenience API
by [@bglusman](https://github.com/bglusman) in
[#442](#442)

### 🐛 Bug Fixes

- **(docs)** stack banner and pin close button on mobile by
[@jdx](https://github.com/jdx) in
[#437](#437)
- **(set)** fall back to current provider when updating secrets by
[@rpendleton](https://github.com/rpendleton) in
[#439](#439)

### 📚 Documentation

- **(site)** show release version and github stars by
[@jdx](https://github.com/jdx) in
[#443](#443)
- add cross-site announcement banner by [@jdx](https://github.com/jdx)
in [#434](#434)
- respect banner expires field by [@jdx](https://github.com/jdx) in
[#436](#436)

### 🛡️ Security

- **(build)** deterministic provider ordering in generated schema by
[@jdx](https://github.com/jdx) in
[#432](#432)

### 🔍 Other Changes

- **(release)** append en.dev sponsor blurb to release notes by
[@jdx](https://github.com/jdx) in
[#431](#431)

### 📦️ Dependency Updates

- bump communique to 1.0.3 by [@jdx](https://github.com/jdx) in
[#435](#435)
- bump communique 1.0.3 → 1.0.4 by [@jdx](https://github.com/jdx) in
[#438](#438)
- bump communique to 1.1.2 by [@jdx](https://github.com/jdx) in
[#444](#444)

### New Contributors

- @bglusman made their first contribution in
[#442](#442)
fullerzz pushed a commit to fullerzz/fnox-py that referenced this pull request Apr 26, 2026
## Upstream release

Bumps bundled fnox binary from 1.20.0 to 1.22.0.

**Release**: https://github.com/jdx/fnox/releases/tag/v1.22.0

## Release notes

v1.22.0 introduces a top-level library API for embedding fnox in Rust
applications, and fixes a sharp edge in `fnox set` that could turn an
encrypted secret into plaintext.

## Added

**Top-level `Fnox` library API**
([#442](jdx/fnox#442)) -- @bglusman

Downstream Rust consumers can now use fnox as a library in three lines
instead of replicating the internals of `GetCommand::run`:

```rust
use fnox::Fnox;

let fnox = Fnox::discover()?;          // walks up + merges parent + local + global config
let value = fnox.get("MY_KEY").await?;
let names = fnox.list()?;
```

The new `Fnox` type lives in `src/library.rs` and is re-exported from
the crate root. Highlights:

- `Fnox::discover()` mirrors the binary's full config-discovery and
merge chain via `Config::load_smart`, including the `FNOX_PROFILE` env
var.
- `Fnox::open(path)` loads an explicit config without the
upward-search/merge behavior.
- `Fnox::with_profile("staging")` builder for non-default profiles.
- `get()` returns `FnoxError::SecretNotFound` with a populated "Did you
mean…" suggestion, matching the CLI's UX so callers don't need to
recompute it.
- `Fnox` is cheap to clone (`Config` is held behind an `Arc`) and safe
to hold across `.await`.

`set()` is intentionally not part of this first cut; it'll get its own
design pass.

## Fixed

**`fnox set` no longer silently downgrades encrypted secrets to
plaintext** ([#439](jdx/fnox#439)) --
@rpendleton

When multiple providers were configured without a `default_provider`,
running `fnox set` on an existing secret without `--provider` would
write the new value as plaintext while leaving the original `provider =
"..."` key in place. The next `fnox get` then failed trying to "decrypt"
a value that was no longer encrypted.

`fnox set` now reuses the secret's existing provider before falling back
to `default_provider` or plaintext, so updates stay encrypted and
readable without having to pass `--provider` on every call:

```bash
fnox set --provider age MY_SECRET "original-value"   # encrypted with age
fnox set MY_SECRET "new-value"                       # still encrypted with age
```

**Deterministic provider ordering in the generated schema**
([#432](jdx/fnox#432)) -- @jdx

Within-category provider ordering in `build/generate_providers.rs` was
inheriting `fs::read_dir` order, which is OS- and filesystem-dependent.
That non-determinism flowed into `docs/public/schema.json` and caused
autofix.ci to keep reshuffling 100+ lines between runs. A secondary sort
by provider name fixes the churn; running `fnox schema` twice now
produces byte-identical output.

**Mobile docs banner layout**
([#437](jdx/fnox#437)) -- @jdx

At `<=640px` the announcement banner now switches to a column layout
with the close button pinned to the top-right corner, instead of
cramming the message and "Read more" link onto one squeezed line.

## Changed

- Docs site nav now shows the current release version (read from
`Cargo.toml` at build time) and a GitHub star count, matching the
mise/aube docs ([#443](jdx/fnox#443)) -- @jdx
- Added a dismissible cross-site announcement banner that fetches its
config from `jdx.dev/banner.json` and respects the `expires` field
([#434](jdx/fnox#434),
[#436](jdx/fnox#436)) -- @jdx

## New Contributors

* @bglusman made their first contribution in
[#442](jdx/fnox#442)

**Full Changelog**:
jdx/fnox@v1.21.0...v1.22.0

## 💚 Sponsor fnox

fnox is maintained by [@jdx](https://github.com/jdx) under
[**en.dev**](https://en.dev) — a small independent studio building
developer tooling like [mise](https://mise.jdx.dev/),
[aube](https://aube.en.dev/), hk, and more. Keeping fnox secure,
maintained, and free is funded by sponsors.

If fnox is handling secrets or config for you or your team, please
consider [sponsoring at en.dev](https://en.dev). Sponsorships are what
let fnox stay independent and the project keep moving.

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
NorthIsUp pushed a commit to NorthIsUp/fnox that referenced this pull request Apr 28, 2026
## Summary

- read the latest site release label from `Cargo.toml` and show it as
the releases nav item
- add a GitHub star counter to the VitePress social nav, matching the
existing aube/mise pattern

## Validation

- `npm run docs:build` in `/home/jdx/src/fnox-release-version/docs`

_Note: build completed with an existing VitePress warning about the
missing `gitignore` syntax highlighter. Local hooks were skipped for
commit/push because this worktree's installed hk hook uses an
unsupported `--from-hook` argument; the targeted docs build passed._

_This PR was generated by Codex._

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Docs-only changes that add a small amount of build-time parsing and an
optional GitHub API fetch; main risk is minor build/UI regressions if
version parsing or DOM injection fails.
> 
> **Overview**
> **Docs site nav now shows the current release version.** The VitePress
config reads `Cargo.toml` at build time, extracts the package `version`,
and replaces the static “Releases” nav label with `v<version>` linking
to GitHub releases.
> 
> **Adds an optional GitHub stars badge in the social nav.** A new
`stars.data.ts` loader can fetch `stargazers_count` (only when a token
or `UPDATE_GITHUB_STARS=1` is set), and the custom theme injects the
formatted count next to the GitHub social link with accompanying CSS
styling.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
7d806c9. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
NorthIsUp pushed a commit to NorthIsUp/fnox that referenced this pull request Apr 28, 2026
### 🚀 Features

- **(library)** top-level Fnox::discover() / get / list convenience API
by [@bglusman](https://github.com/bglusman) in
[jdx#442](jdx#442)

### 🐛 Bug Fixes

- **(docs)** stack banner and pin close button on mobile by
[@jdx](https://github.com/jdx) in
[jdx#437](jdx#437)
- **(set)** fall back to current provider when updating secrets by
[@rpendleton](https://github.com/rpendleton) in
[jdx#439](jdx#439)

### 📚 Documentation

- **(site)** show release version and github stars by
[@jdx](https://github.com/jdx) in
[jdx#443](jdx#443)
- add cross-site announcement banner by [@jdx](https://github.com/jdx)
in [jdx#434](jdx#434)
- respect banner expires field by [@jdx](https://github.com/jdx) in
[jdx#436](jdx#436)

### 🛡️ Security

- **(build)** deterministic provider ordering in generated schema by
[@jdx](https://github.com/jdx) in
[jdx#432](jdx#432)

### 🔍 Other Changes

- **(release)** append en.dev sponsor blurb to release notes by
[@jdx](https://github.com/jdx) in
[jdx#431](jdx#431)

### 📦️ Dependency Updates

- bump communique to 1.0.3 by [@jdx](https://github.com/jdx) in
[jdx#435](jdx#435)
- bump communique 1.0.3 → 1.0.4 by [@jdx](https://github.com/jdx) in
[jdx#438](jdx#438)

### New Contributors

- @bglusman made their first contribution in
[jdx#442](jdx#442)
NorthIsUp pushed a commit to NorthIsUp/fnox that referenced this pull request Apr 28, 2026
### 🚀 Features

- **(library)** top-level Fnox::discover() / get / list convenience API
by [@bglusman](https://github.com/bglusman) in
[jdx#442](jdx#442)

### 🐛 Bug Fixes

- **(docs)** stack banner and pin close button on mobile by
[@jdx](https://github.com/jdx) in
[jdx#437](jdx#437)
- **(set)** fall back to current provider when updating secrets by
[@rpendleton](https://github.com/rpendleton) in
[jdx#439](jdx#439)

### 📚 Documentation

- **(site)** show release version and github stars by
[@jdx](https://github.com/jdx) in
[jdx#443](jdx#443)
- add cross-site announcement banner by [@jdx](https://github.com/jdx)
in [jdx#434](jdx#434)
- respect banner expires field by [@jdx](https://github.com/jdx) in
[jdx#436](jdx#436)

### 🛡️ Security

- **(build)** deterministic provider ordering in generated schema by
[@jdx](https://github.com/jdx) in
[jdx#432](jdx#432)

### 🔍 Other Changes

- **(release)** append en.dev sponsor blurb to release notes by
[@jdx](https://github.com/jdx) in
[jdx#431](jdx#431)

### 📦️ Dependency Updates

- bump communique to 1.0.3 by [@jdx](https://github.com/jdx) in
[jdx#435](jdx#435)
- bump communique 1.0.3 → 1.0.4 by [@jdx](https://github.com/jdx) in
[jdx#438](jdx#438)
- bump communique to 1.1.2 by [@jdx](https://github.com/jdx) in
[jdx#444](jdx#444)

### New Contributors

- @bglusman made their first contribution in
[jdx#442](jdx#442)
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