Skip to content

Commit b71f13c

Browse files
authored
docs(readme): verifiable npm downloads section + daily refresh (#385)
* docs(readme): add verifiable npm downloads section with daily refresh action * test(contract): cover the verifiable npm downloads README section Required by the OSS Harness authority-docs contract for README.md changes.
1 parent 9a40aa6 commit b71f13c

3 files changed

Lines changed: 54 additions & 0 deletions

File tree

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Update npm downloads counter
2+
3+
on:
4+
schedule:
5+
- cron: "17 1 * * *"
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
update:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
- name: Fetch cumulative downloads and patch README
17+
run: |
18+
END=$(date -u -d yesterday +%F)
19+
N=$(curl -sf "https://api.npmjs.org/downloads/point/2026-01-14:${END}/frontagent" | jq -r '.downloads')
20+
if [ -z "$N" ] || [ "$N" = "null" ]; then
21+
echo "npm API unavailable, skip"; exit 0
22+
fi
23+
perl -0pi -e "s/<!-- npm-downloads:start -->.*?<!-- npm-downloads:end -->/<!-- npm-downloads:start -->\n**Cumulative npm downloads since 2026-01-14: ${N}** (updated ${END}, via GitHub Action)\n<!-- npm-downloads:end -->/s" README.md
24+
- name: Commit if changed
25+
run: |
26+
git config user.name "github-actions[bot]"
27+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
28+
git add README.md
29+
git diff --cached --quiet || (git commit -m "chore(readme): refresh npm downloads counter" && git push)

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
</div>
66

77
[![npm version](https://badge.fury.io/js/frontagent.svg)](https://www.npmjs.com/package/frontagent)
8+
[![npm total downloads](https://img.shields.io/npm/dt/frontagent)](https://www.npmjs.com/package/frontagent)
89
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
910
[![Node.js Version](https://img.shields.io/badge/node-%3E%3D20.0.0-brightgreen)](https://nodejs.org)
1011

@@ -1297,6 +1298,19 @@ pnpm clean
12971298
- [RedBox](https://github.com/Jamailar/RedBox) - Local AI creation workspace for Xiaohongshu creators.
12981299
- [1flowbase](https://github.com/taichuy/1flowbase) - Virtual model gateway for publishing multi-model workflows as OpenAI/Claude-compatible endpoints, with trace, token, latency, and cost visibility.
12991300

1301+
## Download Stats (verifiable)
1302+
1303+
<!-- npm-downloads:start -->
1304+
**Cumulative npm downloads since 2026-01-14: 2447** (updated 2026-07-10, via GitHub Action)
1305+
<!-- npm-downloads:end -->
1306+
1307+
Verify it yourself against the public npm registry API:
1308+
1309+
```bash
1310+
# macOS: date -u -v-1d +%F | Linux: date -u -d yesterday +%F
1311+
curl -s "https://api.npmjs.org/downloads/point/2026-01-14:$(date -u -v-1d +%F 2>/dev/null || date -u -d yesterday +%F)/frontagent" | jq
1312+
```
1313+
13001314
## Contributing
13011315

13021316
Welcome to contribute! Submit issues, bugs, or suggestions:

scripts/tests/workflow-rules.test.mjs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -548,3 +548,14 @@ test('agent prompts describe the OSS Harness review loop', () => {
548548
assert.match(prompt, /maintainers decide merge readiness/u);
549549
}
550550
});
551+
552+
test('README exposes the verifiable npm downloads counter with its marker block', () => {
553+
const readme = readFileSync('README.md', 'utf8');
554+
555+
assert.match(readme, /## Download Stats \(verifiable\)/u);
556+
// Marker comments are the GitHub Action's substitution anchors — do not rename.
557+
assert.match(readme, /<!-- npm-downloads:start -->/u);
558+
assert.match(readme, /<!-- npm-downloads:end -->/u);
559+
// The reader can verify the number against the public registry API.
560+
assert.match(readme, /api\.npmjs\.org\/downloads\/point/u);
561+
});

0 commit comments

Comments
 (0)