Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 13 additions & 14 deletions docs/.vitepress/config.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import { defineConfig } from 'vitepress';
import * as path from 'node:path';
import type { DefaultTheme } from 'vitepress';
import * as fs from 'node:fs';
import * as path from 'node:path';
import { cloudflareRedirect } from '@ryoppippi/vite-plugin-cloudflare-redirect';
import { defineConfig } from 'vitepress';
import { groupIconMdPlugin, groupIconVitePlugin } from 'vitepress-plugin-group-icons';
import llmstxt from 'vitepress-plugin-llms';
import type { DefaultTheme } from 'vitepress';
import { cloudflareRedirect } from '@ryoppippi/vite-plugin-cloudflare-redirect';


const typedocSidebarJson = fs.readFileSync(path.join(import.meta.dirname, '../api/typedoc-sidebar.json'))
const typedocSidebarJson = fs.readFileSync(path.join(import.meta.dirname, '../api/typedoc-sidebar.json'));
const typedocSidebar = JSON.parse(typedocSidebarJson.toString()) as DefaultTheme.SidebarItem[];

export default defineConfig({
Expand Down Expand Up @@ -150,14 +149,14 @@ export default defineConfig({
vite: {
plugins: [
cloudflareRedirect({
mode: "generate",
entries: [
{ from: '/raycast', to: 'https://www.raycast.com/nyatinte/ccusage', status: 302 },
{ from: '/gh', to: 'https://github.com/ryoppippi/ccusage', status: 302 },
{ from: '/npm', to: 'https://www.npmjs.com/package/ccusage', status: 302 },
{ from: '/deepwiki', to: 'https://deepwiki.com/ryoppippi/ccusage', status: 302 },
]
}) as any,
mode: 'generate',
entries: [
{ from: '/raycast', to: 'https://www.raycast.com/nyatinte/ccusage', status: 302 },
{ from: '/gh', to: 'https://github.com/ryoppippi/ccusage', status: 302 },
{ from: '/npm', to: 'https://www.npmjs.com/package/ccusage', status: 302 },
{ from: '/deepwiki', to: 'https://deepwiki.com/ryoppippi/ccusage', status: 302 },
],
}) as any,
groupIconVitePlugin(),
...llmstxt(),
],
Expand Down
13 changes: 12 additions & 1 deletion docs/CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,31 +11,38 @@ This directory contains the VitePress-based documentation website for ccusage.
## Development Commands

**Documentation Development:**

- `pnpm run dev` - Start development server with API docs generation and schema copy
- `pnpm run build` - Build documentation site for production
- `pnpm run preview` - Preview built documentation locally
- `pnpm run docs:api` - Generate API documentation from TypeScript source
- `pnpm run lint` - Lint documentation files using ESLint
- `pnpm run format` - Format and auto-fix documentation files with ESLint
- `pnpm typecheck` - Type check TypeScript files

**Deployment:**

- `pnpm run deploy` - Deploy to Cloudflare using Wrangler

## Architecture

**Documentation Structure:**

- `guide/` - User guides and tutorials with screenshots
- `api/` - Auto-generated API documentation from TypeScript source
- `public/` - Static assets including screenshots and config schema
- `.vitepress/` - VitePress configuration and theme customization

**Key Files:**

- `update-api-index.ts` - Script to generate API documentation index
- `typedoc.config.mjs` - TypeDoc configuration for API docs generation
- `public/config-schema.json` - JSON schema copied from ccusage package during build

## Documentation Guidelines

**Screenshot Usage:**

- **Placement**: Always place screenshots immediately after main headings (H1)
- **Purpose**: Provide immediate visual context before textual explanations
- **Guides with Screenshots**:
Expand All @@ -47,6 +54,7 @@ This directory contains the VitePress-based documentation website for ccusage.
- **Alt Text**: Always include descriptive alt text for accessibility

**Content Organization:**

- User-facing guides in `guide/` directory
- Auto-generated API reference in `api/` directory
- Static assets and schemas in `public/` directory
Expand All @@ -61,6 +69,7 @@ This directory contains the VitePress-based documentation website for ccusage.
## Dependencies

**Key Dev Dependencies:**

- `vitepress` - Static site generator
- `typedoc` - API documentation generation
- `typedoc-plugin-markdown` - Markdown output for TypeDoc
Expand All @@ -69,6 +78,7 @@ This directory contains the VitePress-based documentation website for ccusage.
- `ccusage` - Main package (workspace dependency for API docs)

**VitePress Plugins:**

- `vitepress-plugin-group-icons` - Group icons in navigation
- `vitepress-plugin-llms` - LLM-specific enhancements
- `@ryoppippi/vite-plugin-cloudflare-redirect` - Cloudflare redirect handling
Expand All @@ -88,6 +98,7 @@ This directory contains the VitePress-based documentation website for ccusage.
- **Visual First**: Lead with screenshots, then explain with text
- **Consistency**: Follow established patterns for new documentation pages
- **Cross-References**: Link between related guides and API documentation
- **ESLint in Markdown**: For code blocks that should skip ESLint parsing (e.g., containing `...` syntax), add `<!-- eslint-skip -->` before the code block

## File Organization

Expand All @@ -99,4 +110,4 @@ docs/
├── .vitepress/ # VitePress configuration
├── package.json # Dependencies and scripts
└── CLAUDE.md # This file
```
```
14 changes: 14 additions & 0 deletions docs/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { ryoppippi } from '@ryoppippi/eslint-config';

export default ryoppippi({
type: 'lib',
svelte: false,
markdown: true,
ignores: [
'.vitepress/dist',
'.vitepress/cache',
'api/**',
'public/**',
'update-api-index.ts', // Script file with specific patterns
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

Ignoring the entire update-api-index.ts file might be too broad, as it prevents any future linting for style or potential bugs. The changes in this pull request actually apply a lint fix to this file (if( -> if ( ... )), which suggests it can be at least partially linted.

If there are specific lines causing issues (e.g., with Bun.$), consider using inline // eslint-disable-next-line <rule-name> comments for those specific lines instead of ignoring the whole file. This would ensure the rest of the file continues to benefit from linting.

Alternatively, if the shared ESLint config supports it, you could configure a separate override for script files like this one.

],
});
25 changes: 14 additions & 11 deletions docs/guide/cli-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ ccusage monthly -z Europe/London
#### Timezone Effect

The timezone affects how usage is grouped by date. For example, usage at 11 PM UTC on January 1st would appear on:

- **January 1st** when `--timezone UTC`
- **January 1st** when `--timezone America/New_York` (6 PM EST)
- **January 2nd** when `--timezone Asia/Tokyo` (8 AM JST next day)
Expand Down Expand Up @@ -121,12 +122,14 @@ ccusage daily -l fr-FR
The locale affects display formatting:

**Date Format:**

- `en-US`: 08/04/2025
- `en-CA`: 2025-08-04 (ISO format, default)
- `ja-JP`: 2025/08/04
- `de-DE`: 04.08.2025

**Time Format:**

- `en-US`: 3:30:00 PM (12-hour)
- Others: 15:30:00 (24-hour)

Expand Down Expand Up @@ -322,17 +325,17 @@ LOG_LEVEL=0 ccusage daily --json

Many options have short aliases for convenience:

| Long Option | Short | Description |
|------------|-------|-------------|
| `--json` | `-j` | JSON output |
| `--breakdown` | `-b` | Per-model breakdown |
| `--offline` | `-O` | Offline mode |
| `--timezone` | `-z` | Set timezone |
| `--locale` | `-l` | Set locale |
| `--instances` | `-i` | Group by project |
| `--project` | `-p` | Filter project |
| `--active` | `-a` | Active block only |
| `--recent` | `-r` | Recent blocks |
| Long Option | Short | Description |
| ------------- | ----- | ------------------- |
| `--json` | `-j` | JSON output |
| `--breakdown` | `-b` | Per-model breakdown |
| `--offline` | `-O` | Offline mode |
| `--timezone` | `-z` | Set timezone |
| `--locale` | `-l` | Set locale |
| `--instances` | `-i` | Group by project |
| `--project` | `-p` | Filter project |
| `--active` | `-a` | Active block only |
| `--recent` | `-r` | Recent blocks |

## Related Documentation

Expand Down
16 changes: 8 additions & 8 deletions docs/guide/codex/daily.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ npx @ccusage/codex@latest daily

## Options

| Flag | Description |
| --- | --- |
| `--since` / `--until` | Filter to a specific date range (YYYYMMDD or YYYY-MM-DD) |
| `--timezone` | Override timezone used for grouping (defaults to system) |
| `--locale` | Adjust date formatting locale |
| `--json` | Emit structured JSON instead of a table |
| `--offline` / `--no-offline` | Force cached LiteLLM pricing or enable live fetching |
| `--compact` | Force compact table layout (same columns as a narrow terminal) |
| Flag | Description |
| ---------------------------- | -------------------------------------------------------------- |
| `--since` / `--until` | Filter to a specific date range (YYYYMMDD or YYYY-MM-DD) |
| `--timezone` | Override timezone used for grouping (defaults to system) |
| `--locale` | Adjust date formatting locale |
| `--json` | Emit structured JSON instead of a table |
| `--offline` / `--no-offline` | Force cached LiteLLM pricing or enable live fetching |
| `--compact` | Force compact table layout (same columns as a narrow terminal) |

The output uses the same responsive table component as ccusage, including compact mode support and per-model token summaries.

Expand Down
6 changes: 3 additions & 3 deletions docs/guide/codex/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ The CLI reads Codex session JSONL files located under `CODEX_HOME` (defaults to

## Environment Variables

| Variable | Description |
| --- | --- |
| Variable | Description |
| ------------ | ------------------------------------------------------------ |
| `CODEX_HOME` | Override the root directory containing Codex session folders |
| `LOG_LEVEL` | Adjust consola verbosity (0 silent … 5 trace) |
| `LOG_LEVEL` | Adjust consola verbosity (0 silent … 5 trace) |

When Codex emits a model alias (for example `gpt-5-codex`), the CLI automatically resolves it to the canonical LiteLLM pricing entry. No manual override is needed.

Expand Down
16 changes: 8 additions & 8 deletions docs/guide/codex/monthly.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ npx @ccusage/codex@latest monthly

## Options

| Flag | Description |
| --- | --- |
| `--since` / `--until` | Filter to a specific date range (YYYYMMDD or YYYY-MM-DD) before aggregating |
| `--timezone` | Override the timezone used to bucket usage into months |
| `--locale` | Adjust month label formatting |
| `--json` | Emit structured JSON instead of a table |
| `--offline` / `--no-offline` | Force cached LiteLLM pricing or enable live fetching |
| `--compact` | Force compact table layout (same columns as a narrow terminal) |
| Flag | Description |
| ---------------------------- | --------------------------------------------------------------------------- |
| `--since` / `--until` | Filter to a specific date range (YYYYMMDD or YYYY-MM-DD) before aggregating |
| `--timezone` | Override the timezone used to bucket usage into months |
| `--locale` | Adjust month label formatting |
| `--json` | Emit structured JSON instead of a table |
| `--offline` / `--no-offline` | Force cached LiteLLM pricing or enable live fetching |
| `--compact` | Force compact table layout (same columns as a narrow terminal) |

The output uses the same responsive table component as ccusage, including compact mode support, per-model token summaries, and a combined totals row.
16 changes: 8 additions & 8 deletions docs/guide/codex/session.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ npx @ccusage/codex@latest session

## Options

| Flag | Description |
| --- | --- |
| `--since` / `--until` | Filter sessions by their activity date (YYYYMMDD or YYYY-MM-DD) |
| `--timezone` | Override the timezone used for date grouping and last-activity display |
| `--locale` | Adjust locale for table and timestamp formatting |
| `--json` | Emit structured JSON (`{ sessions: [], totals: {} }`) instead of a table |
| `--offline` / `--no-offline` | Force cached LiteLLM pricing or enable live fetching |
| `--compact` | Force compact table layout (same columns as a narrow terminal) |
| Flag | Description |
| ---------------------------- | ------------------------------------------------------------------------ |
| `--since` / `--until` | Filter sessions by their activity date (YYYYMMDD or YYYY-MM-DD) |
| `--timezone` | Override the timezone used for date grouping and last-activity display |
| `--locale` | Adjust locale for table and timestamp formatting |
| `--json` | Emit structured JSON (`{ sessions: [], totals: {} }`) instead of a table |
| `--offline` / `--no-offline` | Force cached LiteLLM pricing or enable live fetching |
| `--compact` | Force compact table layout (same columns as a narrow terminal) |

JSON output includes a `sessions` array with per-model breakdowns, cached token counts, `lastActivity`, and `isFallback` flags for any events that required the legacy `gpt-5` pricing fallback.

Expand Down
Loading
Loading