Skip to content

Commit f2b5c54

Browse files
committed
chore(npm): keep package name 'cxusage'; update README and AGENTS accordingly
1 parent c6e0608 commit f2b5c54

3 files changed

Lines changed: 21 additions & 5 deletions

File tree

.github/workflows/release-npm.yml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,26 @@ jobs:
1414
with:
1515
node-version: '20'
1616
registry-url: 'https://registry.npmjs.org'
17+
always-auth: true
1718
- name: Install
1819
run: npm ci || npm i
1920
- name: Build
2021
run: npm run build
22+
- name: Align package.json version with tag
23+
id: version
24+
run: |
25+
TAG_REF="${GITHUB_REF#refs/tags/}"
26+
TAG_NAME="${TAG_REF#v}"
27+
echo "Tag: ${TAG_REF} -> version: ${TAG_NAME}"
28+
npm version "${TAG_NAME}" --no-git-tag-version
29+
echo "version=${TAG_NAME}" >> $GITHUB_OUTPUT
30+
- name: Choose dist-tag
31+
id: dist
32+
run: |
33+
VER="${{ steps.version.outputs.version }}"
34+
if [[ "$VER" == *-* ]]; then echo "tag=next" >> $GITHUB_OUTPUT; else echo "tag=latest" >> $GITHUB_OUTPUT; fi
35+
echo "dist-tag=$(cat $GITHUB_OUTPUT)"
2136
- name: Publish
22-
run: npm publish --access public
37+
run: npm publish --access public --tag ${{ steps.dist.outputs.tag }}
2338
env:
2439
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
25-

AGENTS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ Validation checklist for changes that touch runtime behavior:
3434

3535
- `package.json` contains `bin` mapping to `dist/cli.js` and `prepublishOnly` builds the package.
3636
- Do not rely on `prepare` to build; we commit `dist/` and build in release workflow to support `npx github:...` usage.
37+
- NPM package name: `cxusage`. The CLI installs the `cxusage` bin.
3738
- NPM publish is automated on tags matching `v*.*.*` via GitHub Actions; requires `NPM_TOKEN` secret.
3839

3940
## Code style
@@ -54,4 +55,3 @@ Validation checklist for changes that touch runtime behavior:
5455
- Outline a brief plan: goals, approach, and expected changes.
5556
- Keep commits scoped and messages clear.
5657
- If adding dependencies, justify the choice and impact.
57-

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ Analyze Claude Code daily usage from Codex session logs. Similar to `ccusage`, t
1212
- After publish to npm: `npx cxusage --help`
1313
- From GitHub (before publish): `npx github:Effet/cxusage -- --help`
1414
- Typical commands:
15-
- `cxusage daily --from 2025-01-01 --to 2025-01-31 --md`
16-
- `cxusage daily --by model --json`
15+
- `npx cxusage daily --from 2025-01-01 --to 2025-01-31 --md`
16+
- `npx cxusage daily --by model --json`
1717

1818
## Usage
1919

@@ -63,4 +63,6 @@ This package exposes only a CLI. If you need a library API, please open an issue
6363

6464
- CI runs on pushes/PRs to verify install and build.
6565
- Stable release: create a Git tag like `v0.1.0` to publish to npm as `latest`.
66+
- The workflow automatically sets `package.json` version from the Git tag (stripping the leading `v`).
67+
- Pre-release tags (containing a hyphen, e.g. `v0.2.0-rc.1`) publish with the `next` dist-tag.
6668
- The release workflow requires a repository secret `NPM_TOKEN` with publish permissions.

0 commit comments

Comments
 (0)