From cda7a0d3f6e54b1814916579aff8f3262f7b1c3e Mon Sep 17 00:00:00 2001 From: ryoppippi <1560508+ryoppippi@users.noreply.github.com> Date: Sat, 16 May 2026 19:51:16 +0100 Subject: [PATCH] refactor(ccusage): remove private file prefixes Rename ccusage src files that still used leading underscore prefixes for internal modules. The package no longer exports every src module, so the prefix no longer communicates a meaningful public-private boundary. Update all local imports, schema generation, and tsdown macro configuration to point at the new filenames while preserving the existing module structure. --- apps/ccusage/scripts/generate-json-schema.ts | 4 ++-- apps/ccusage/src/calculate-cost.ts | 8 ++++---- apps/ccusage/src/cli.ts | 2 +- apps/ccusage/src/commands/all.ts | 4 ++-- apps/ccusage/src/commands/blocks.ts | 16 +++++++-------- apps/ccusage/src/commands/daily.ts | 10 +++++----- apps/ccusage/src/commands/monthly.ts | 6 +++--- apps/ccusage/src/commands/session.ts | 8 ++++---- .../{_session_id.ts => session_id.ts} | 4 ++-- apps/ccusage/src/commands/statusline.ts | 12 +++++------ apps/ccusage/src/commands/weekly.ts | 8 ++++---- ...ader-tokens.ts => config-loader-tokens.ts} | 2 +- apps/ccusage/src/{_consts.ts => consts.ts} | 0 .../{_daily-grouping.ts => daily-grouping.ts} | 4 ++-- apps/ccusage/src/data-loader.ts | 20 +++++++++---------- .../src/{_date-utils.ts => date-utils.ts} | 8 ++++---- apps/ccusage/src/debug.ts | 4 ++-- apps/ccusage/src/{_env.ts => env.ts} | 0 ...n-output-types.ts => json-output-types.ts} | 2 +- apps/ccusage/src/{_macro.ts => macro.ts} | 0 ..._pricing-fetcher.ts => pricing-fetcher.ts} | 2 +- .../{_project-names.ts => project-names.ts} | 0 .../{_session-blocks.ts => session-blocks.ts} | 4 ++-- .../src/{_shared-args.ts => shared-args.ts} | 4 ++-- .../src/{_token-utils.ts => token-utils.ts} | 0 apps/ccusage/src/{_types.ts => types.ts} | 0 apps/ccusage/src/{_utils.ts => utils.ts} | 0 apps/ccusage/tsdown.config.ts | 2 +- 28 files changed, 67 insertions(+), 67 deletions(-) rename apps/ccusage/src/commands/{_session_id.ts => session_id.ts} (96%) rename apps/ccusage/src/{_config-loader-tokens.ts => config-loader-tokens.ts} (99%) rename apps/ccusage/src/{_consts.ts => consts.ts} (100%) rename apps/ccusage/src/{_daily-grouping.ts => daily-grouping.ts} (96%) rename apps/ccusage/src/{_date-utils.ts => date-utils.ts} (97%) rename apps/ccusage/src/{_env.ts => env.ts} (100%) rename apps/ccusage/src/{_json-output-types.ts => json-output-types.ts} (93%) rename apps/ccusage/src/{_macro.ts => macro.ts} (100%) rename apps/ccusage/src/{_pricing-fetcher.ts => pricing-fetcher.ts} (94%) rename apps/ccusage/src/{_project-names.ts => project-names.ts} (100%) rename apps/ccusage/src/{_session-blocks.ts => session-blocks.ts} (99%) rename apps/ccusage/src/{_shared-args.ts => shared-args.ts} (95%) rename apps/ccusage/src/{_token-utils.ts => token-utils.ts} (100%) rename apps/ccusage/src/{_types.ts => types.ts} (100%) rename apps/ccusage/src/{_utils.ts => utils.ts} (100%) diff --git a/apps/ccusage/scripts/generate-json-schema.ts b/apps/ccusage/scripts/generate-json-schema.ts index 404d549e9..b36f1956e 100755 --- a/apps/ccusage/scripts/generate-json-schema.ts +++ b/apps/ccusage/scripts/generate-json-schema.ts @@ -13,12 +13,12 @@ import process from 'node:process'; import { Result } from '@praha/byethrow'; import { $ } from 'bun'; -import { sharedArgs } from '../src/_shared-args.ts'; // Import command definitions to access their args import { subCommandUnion } from '../src/commands/index.ts'; - import { logger } from '../src/logger.ts'; +import { sharedArgs } from '../src/shared-args.ts'; + /** * The filename for the generated JSON Schema file. * Used for both root directory and docs/public directory output. diff --git a/apps/ccusage/src/calculate-cost.ts b/apps/ccusage/src/calculate-cost.ts index 57ea7a237..7b9b19c46 100644 --- a/apps/ccusage/src/calculate-cost.ts +++ b/apps/ccusage/src/calculate-cost.ts @@ -8,9 +8,9 @@ * @module calculate-cost */ -import type { AggregatedTokenCounts } from './_token-utils.ts'; import type { DailyUsage, MonthlyUsage, SessionUsage, WeeklyUsage } from './data-loader.ts'; -import { getTotalTokens } from './_token-utils.ts'; +import type { AggregatedTokenCounts } from './token-utils.ts'; +import { getTotalTokens } from './token-utils.ts'; import { createActivityDate, createDailyDate, @@ -18,11 +18,11 @@ import { createProjectPath, createSessionId, createVersion, -} from './_types.ts'; +} from './types.ts'; /** * Alias for AggregatedTokenCounts from shared utilities - * @deprecated Use AggregatedTokenCounts from _token-utils.ts instead + * @deprecated Use AggregatedTokenCounts from token-utils.ts instead */ type TokenData = AggregatedTokenCounts; diff --git a/apps/ccusage/src/cli.ts b/apps/ccusage/src/cli.ts index f69939a9f..0cadced0f 100755 --- a/apps/ccusage/src/cli.ts +++ b/apps/ccusage/src/cli.ts @@ -4,7 +4,7 @@ import { accessSync, constants, statSync } from 'node:fs'; import { delimiter, dirname, join } from 'node:path'; import process from 'node:process'; import { fileURLToPath } from 'node:url'; -import { CCUSAGE_BUN_AUTO_RUN_DISABLED_VALUE, CCUSAGE_BUN_AUTO_RUN_ENV } from './_env.ts'; +import { CCUSAGE_BUN_AUTO_RUN_DISABLED_VALUE, CCUSAGE_BUN_AUTO_RUN_ENV } from './env.ts'; function getExecutableNames( command: string, diff --git a/apps/ccusage/src/commands/all.ts b/apps/ccusage/src/commands/all.ts index 0d11fd902..77d3686ee 100644 --- a/apps/ccusage/src/commands/all.ts +++ b/apps/ccusage/src/commands/all.ts @@ -43,9 +43,9 @@ import { DEFAULT_CLAUDE_CODE_PATH, DEFAULT_CLAUDE_CONFIG_PATH, USER_HOME_DIR, -} from '../_consts.ts'; -import { formatDate, formatDateCompact, getDateStringWeek } from '../_date-utils.ts'; +} from '../consts.ts'; import { loadDailyUsageData, loadMonthlyUsageData, loadSessionData } from '../data-loader.ts'; +import { formatDate, formatDateCompact, getDateStringWeek } from '../date-utils.ts'; import { logger, writeStdoutLine } from '../logger.ts'; type AgentId = 'claude' | 'codex' | 'opencode' | 'amp' | 'pi'; diff --git a/apps/ccusage/src/commands/blocks.ts b/apps/ccusage/src/commands/blocks.ts index 559f2bb05..2583f43b2 100644 --- a/apps/ccusage/src/commands/blocks.ts +++ b/apps/ccusage/src/commands/blocks.ts @@ -1,4 +1,4 @@ -import type { SessionBlock } from '../_session-blocks.ts'; +import type { SessionBlock } from '../session-blocks.ts'; import process from 'node:process'; import * as pc from '@ccusage/internal/colors'; import { @@ -8,23 +8,23 @@ import { ResponsiveTable, } from '@ccusage/terminal/table'; import { define } from 'gunshi'; -import { loadConfig, mergeConfigWithArgs } from '../_config-loader-tokens.ts'; +import { loadConfig, mergeConfigWithArgs } from '../config-loader-tokens.ts'; import { BLOCKS_COMPACT_WIDTH_THRESHOLD, BLOCKS_DEFAULT_TERMINAL_WIDTH, BLOCKS_WARNING_THRESHOLD, DEFAULT_RECENT_DAYS, -} from '../_consts.ts'; +} from '../consts.ts'; +import { loadSessionBlockData } from '../data-loader.ts'; +import { log, logger, writeStdoutLine } from '../logger.ts'; import { calculateBurnRate, DEFAULT_SESSION_DURATION_HOURS, filterRecentBlocks, projectBlockUsage, -} from '../_session-blocks.ts'; -import { sharedCommandConfig } from '../_shared-args.ts'; -import { getTotalTokens } from '../_token-utils.ts'; -import { loadSessionBlockData } from '../data-loader.ts'; -import { log, logger, writeStdoutLine } from '../logger.ts'; +} from '../session-blocks.ts'; +import { sharedCommandConfig } from '../shared-args.ts'; +import { getTotalTokens } from '../token-utils.ts'; /** * Formats the time display for a session block diff --git a/apps/ccusage/src/commands/daily.ts b/apps/ccusage/src/commands/daily.ts index 461ce9a2b..1998a1078 100644 --- a/apps/ccusage/src/commands/daily.ts +++ b/apps/ccusage/src/commands/daily.ts @@ -9,15 +9,15 @@ import { pushBreakdownRows, } from '@ccusage/terminal/table'; import { define } from 'gunshi'; -import { loadConfig, mergeConfigWithArgs } from '../_config-loader-tokens.ts'; -import { groupByProject, groupDataByProject } from '../_daily-grouping.ts'; -import { formatDateCompact } from '../_date-utils.ts'; -import { formatProjectName } from '../_project-names.ts'; -import { sharedCommandConfig } from '../_shared-args.ts'; import { calculateTotals, createTotalsObject, getTotalTokens } from '../calculate-cost.ts'; +import { loadConfig, mergeConfigWithArgs } from '../config-loader-tokens.ts'; +import { groupByProject, groupDataByProject } from '../daily-grouping.ts'; import { loadDailyUsageData } from '../data-loader.ts'; +import { formatDateCompact } from '../date-utils.ts'; import { detectMismatches, printMismatchReport } from '../debug.ts'; import { logger, writeStdoutLine } from '../logger.ts'; +import { formatProjectName } from '../project-names.ts'; +import { sharedCommandConfig } from '../shared-args.ts'; export const dailyCommand = define({ name: 'daily', diff --git a/apps/ccusage/src/commands/monthly.ts b/apps/ccusage/src/commands/monthly.ts index 63ed543f9..4e850f8fa 100644 --- a/apps/ccusage/src/commands/monthly.ts +++ b/apps/ccusage/src/commands/monthly.ts @@ -8,13 +8,13 @@ import { pushBreakdownRows, } from '@ccusage/terminal/table'; import { define } from 'gunshi'; -import { loadConfig, mergeConfigWithArgs } from '../_config-loader-tokens.ts'; -import { formatDateCompact } from '../_date-utils.ts'; -import { sharedCommandConfig } from '../_shared-args.ts'; import { calculateTotals, createTotalsObject, getTotalTokens } from '../calculate-cost.ts'; +import { loadConfig, mergeConfigWithArgs } from '../config-loader-tokens.ts'; import { loadMonthlyUsageData } from '../data-loader.ts'; +import { formatDateCompact } from '../date-utils.ts'; import { detectMismatches, printMismatchReport } from '../debug.ts'; import { logger, writeStdoutLine } from '../logger.ts'; +import { sharedCommandConfig } from '../shared-args.ts'; export const monthlyCommand = define({ name: 'monthly', diff --git a/apps/ccusage/src/commands/session.ts b/apps/ccusage/src/commands/session.ts index becf0275e..3e1a6e6c9 100644 --- a/apps/ccusage/src/commands/session.ts +++ b/apps/ccusage/src/commands/session.ts @@ -8,14 +8,14 @@ import { pushBreakdownRows, } from '@ccusage/terminal/table'; import { define } from 'gunshi'; -import { loadConfig, mergeConfigWithArgs } from '../_config-loader-tokens.ts'; -import { formatDateCompact } from '../_date-utils.ts'; -import { sharedCommandConfig } from '../_shared-args.ts'; import { calculateTotals, createTotalsObject, getTotalTokens } from '../calculate-cost.ts'; +import { loadConfig, mergeConfigWithArgs } from '../config-loader-tokens.ts'; import { loadSessionData } from '../data-loader.ts'; +import { formatDateCompact } from '../date-utils.ts'; import { detectMismatches, printMismatchReport } from '../debug.ts'; import { logger, writeStdoutLine } from '../logger.ts'; -import { handleSessionIdLookup } from './_session_id.ts'; +import { sharedCommandConfig } from '../shared-args.ts'; +import { handleSessionIdLookup } from './session_id.ts'; // eslint-disable-next-line ts/no-unused-vars const { order: _, ...sharedArgs } = sharedCommandConfig.args; diff --git a/apps/ccusage/src/commands/_session_id.ts b/apps/ccusage/src/commands/session_id.ts similarity index 96% rename from apps/ccusage/src/commands/_session_id.ts rename to apps/ccusage/src/commands/session_id.ts index 951abff20..dedf4689a 100644 --- a/apps/ccusage/src/commands/_session_id.ts +++ b/apps/ccusage/src/commands/session_id.ts @@ -1,9 +1,9 @@ -import type { CostMode } from '../_types.ts'; import type { UsageData } from '../data-loader.ts'; +import type { CostMode } from '../types.ts'; import process from 'node:process'; import { formatCurrency, formatNumber, ResponsiveTable } from '@ccusage/terminal/table'; -import { formatDateCompact } from '../_date-utils.ts'; import { loadSessionUsageById } from '../data-loader.ts'; +import { formatDateCompact } from '../date-utils.ts'; import { log, logger, writeStdoutLine } from '../logger.ts'; export type SessionIdContext = { diff --git a/apps/ccusage/src/commands/statusline.ts b/apps/ccusage/src/commands/statusline.ts index da4b925af..982e5819d 100644 --- a/apps/ccusage/src/commands/statusline.ts +++ b/apps/ccusage/src/commands/statusline.ts @@ -9,13 +9,9 @@ import { Result } from '@praha/byethrow'; import getStdin from 'get-stdin'; import { define } from 'gunshi'; import * as v from 'valibot'; -import { loadConfig, mergeConfigWithArgs } from '../_config-loader-tokens.ts'; -import { DEFAULT_CONTEXT_USAGE_THRESHOLDS, DEFAULT_REFRESH_INTERVAL_SECONDS } from '../_consts.ts'; -import { calculateBurnRate } from '../_session-blocks.ts'; -import { sharedArgs } from '../_shared-args.ts'; -import { statuslineHookJsonSchema } from '../_types.ts'; -import { getFileModifiedTime, unreachable } from '../_utils.ts'; import { calculateTotals } from '../calculate-cost.ts'; +import { loadConfig, mergeConfigWithArgs } from '../config-loader-tokens.ts'; +import { DEFAULT_CONTEXT_USAGE_THRESHOLDS, DEFAULT_REFRESH_INTERVAL_SECONDS } from '../consts.ts'; import { calculateContextTokens, loadDailyUsageData, @@ -23,6 +19,10 @@ import { loadSessionUsageById, } from '../data-loader.ts'; import { log, logger } from '../logger.ts'; +import { calculateBurnRate } from '../session-blocks.ts'; +import { sharedArgs } from '../shared-args.ts'; +import { statuslineHookJsonSchema } from '../types.ts'; +import { getFileModifiedTime, unreachable } from '../utils.ts'; /** * Formats the remaining time for display diff --git a/apps/ccusage/src/commands/weekly.ts b/apps/ccusage/src/commands/weekly.ts index 28ef1d252..c659f6a32 100644 --- a/apps/ccusage/src/commands/weekly.ts +++ b/apps/ccusage/src/commands/weekly.ts @@ -8,14 +8,14 @@ import { pushBreakdownRows, } from '@ccusage/terminal/table'; import { define } from 'gunshi'; -import { loadConfig, mergeConfigWithArgs } from '../_config-loader-tokens.ts'; -import { WEEK_DAYS } from '../_consts.ts'; -import { formatDateCompact } from '../_date-utils.ts'; -import { sharedArgs } from '../_shared-args.ts'; import { calculateTotals, createTotalsObject, getTotalTokens } from '../calculate-cost.ts'; +import { loadConfig, mergeConfigWithArgs } from '../config-loader-tokens.ts'; +import { WEEK_DAYS } from '../consts.ts'; import { loadWeeklyUsageData } from '../data-loader.ts'; +import { formatDateCompact } from '../date-utils.ts'; import { detectMismatches, printMismatchReport } from '../debug.ts'; import { logger, writeStdoutLine } from '../logger.ts'; +import { sharedArgs } from '../shared-args.ts'; export const weeklyCommand = define({ name: 'weekly', diff --git a/apps/ccusage/src/_config-loader-tokens.ts b/apps/ccusage/src/config-loader-tokens.ts similarity index 99% rename from apps/ccusage/src/_config-loader-tokens.ts rename to apps/ccusage/src/config-loader-tokens.ts index 7b3a0ac38..ff5ca0ae8 100644 --- a/apps/ccusage/src/_config-loader-tokens.ts +++ b/apps/ccusage/src/config-loader-tokens.ts @@ -4,7 +4,7 @@ import process from 'node:process'; import { toArray } from '@antfu/utils'; import { Result } from '@praha/byethrow'; import { createFixture } from 'fs-fixture'; -import { CONFIG_FILE_NAME } from './_consts.ts'; +import { CONFIG_FILE_NAME } from './consts.ts'; import { getClaudePaths } from './data-loader.ts'; import { logger } from './logger.ts'; diff --git a/apps/ccusage/src/_consts.ts b/apps/ccusage/src/consts.ts similarity index 100% rename from apps/ccusage/src/_consts.ts rename to apps/ccusage/src/consts.ts diff --git a/apps/ccusage/src/_daily-grouping.ts b/apps/ccusage/src/daily-grouping.ts similarity index 96% rename from apps/ccusage/src/_daily-grouping.ts rename to apps/ccusage/src/daily-grouping.ts index 18ecbe9da..f2704f4ad 100644 --- a/apps/ccusage/src/_daily-grouping.ts +++ b/apps/ccusage/src/daily-grouping.ts @@ -1,7 +1,7 @@ -import type { DailyProjectOutput } from './_json-output-types.ts'; import type { loadDailyUsageData } from './data-loader.ts'; -import { createDailyDate, createModelName } from './_types.ts'; +import type { DailyProjectOutput } from './json-output-types.ts'; import { getTotalTokens } from './calculate-cost.ts'; +import { createDailyDate, createModelName } from './types.ts'; /** * Type for daily data returned from loadDailyUsageData diff --git a/apps/ccusage/src/data-loader.ts b/apps/ccusage/src/data-loader.ts index 2957b4384..5e58395a5 100644 --- a/apps/ccusage/src/data-loader.ts +++ b/apps/ccusage/src/data-loader.ts @@ -9,8 +9,8 @@ */ import type { LiteLLMModelPricing } from '@ccusage/internal/pricing'; -import type { WeekDay } from './_consts.ts'; -import type { LoadedUsageEntry, SessionBlock } from './_session-blocks.ts'; +import type { WeekDay } from './consts.ts'; +import type { LoadedUsageEntry, SessionBlock } from './session-blocks.ts'; import type { ActivityDate, Bucket, @@ -26,7 +26,7 @@ import type { SortOrder, Version, WeeklyDate, -} from './_types.ts'; +} from './types.ts'; import { Buffer } from 'node:buffer'; import { createReadStream, createWriteStream } from 'node:fs'; import { open, readdir, readFile, stat, utimes } from 'node:fs/promises'; @@ -48,7 +48,7 @@ import { DEFAULT_CLAUDE_CODE_PATH, DEFAULT_CLAUDE_CONFIG_PATH, USER_HOME_DIR, -} from './_consts.ts'; +} from './consts.ts'; import { createCachedDateFormatter, filterByDateRange, @@ -56,9 +56,10 @@ import { getDateStringWeek, getDayNumber, sortByDate, -} from './_date-utils.ts'; -import { CLAUDE_PROVIDER_PREFIXES, PricingFetcher } from './_pricing-fetcher.ts'; -import { identifySessionBlocks } from './_session-blocks.ts'; +} from './date-utils.ts'; +import { logger } from './logger.ts'; +import { CLAUDE_PROVIDER_PREFIXES, PricingFetcher } from './pricing-fetcher.ts'; +import { identifySessionBlocks } from './session-blocks.ts'; import { createBucket, createISOTimestamp, @@ -73,9 +74,8 @@ import { requestIdSchema, sessionIdSchema, versionSchema, -} from './_types.ts'; -import { unreachable } from './_utils.ts'; -import { logger } from './logger.ts'; +} from './types.ts'; +import { unreachable } from './utils.ts'; const USAGE_LINE_MARKER = '"usage":{'; const USAGE_LINE_MARKER_BUFFER = Buffer.from(USAGE_LINE_MARKER); diff --git a/apps/ccusage/src/_date-utils.ts b/apps/ccusage/src/date-utils.ts similarity index 97% rename from apps/ccusage/src/_date-utils.ts rename to apps/ccusage/src/date-utils.ts index 54dd51ccc..303a7bf15 100644 --- a/apps/ccusage/src/_date-utils.ts +++ b/apps/ccusage/src/date-utils.ts @@ -3,10 +3,10 @@ * @module date-utils */ -import type { DayOfWeek, WeekDay } from './_consts.ts'; -import type { WeeklyDate } from './_types.ts'; -import { DEFAULT_LOCALE } from './_consts.ts'; -import { createWeeklyDate } from './_types.ts'; +import type { DayOfWeek, WeekDay } from './consts.ts'; +import type { WeeklyDate } from './types.ts'; +import { DEFAULT_LOCALE } from './consts.ts'; +import { createWeeklyDate } from './types.ts'; export { sortByDate } from '@ccusage/internal/sort'; // Re-export formatDateCompact from shared package diff --git a/apps/ccusage/src/debug.ts b/apps/ccusage/src/debug.ts index 435272774..68ef14388 100644 --- a/apps/ccusage/src/debug.ts +++ b/apps/ccusage/src/debug.ts @@ -12,10 +12,10 @@ import path from 'node:path'; import { Result } from '@praha/byethrow'; import { createFixture } from 'fs-fixture'; import * as v from 'valibot'; -import { CLAUDE_PROJECTS_DIR_NAME, DEBUG_MATCH_THRESHOLD_PERCENT } from './_consts.ts'; -import { PricingFetcher } from './_pricing-fetcher.ts'; +import { CLAUDE_PROJECTS_DIR_NAME, DEBUG_MATCH_THRESHOLD_PERCENT } from './consts.ts'; import { collectJsonlFiles, getClaudePaths, usageDataSchema } from './data-loader.ts'; import { logger } from './logger.ts'; +import { PricingFetcher } from './pricing-fetcher.ts'; /** * Represents a pricing discrepancy between original and calculated costs diff --git a/apps/ccusage/src/_env.ts b/apps/ccusage/src/env.ts similarity index 100% rename from apps/ccusage/src/_env.ts rename to apps/ccusage/src/env.ts diff --git a/apps/ccusage/src/_json-output-types.ts b/apps/ccusage/src/json-output-types.ts similarity index 93% rename from apps/ccusage/src/_json-output-types.ts rename to apps/ccusage/src/json-output-types.ts index 7c62f2064..141707fc7 100644 --- a/apps/ccusage/src/_json-output-types.ts +++ b/apps/ccusage/src/json-output-types.ts @@ -8,8 +8,8 @@ * @module json-output-types */ -import type { DailyDate, ModelName } from './_types.ts'; import type { ModelBreakdown } from './data-loader.ts'; +import type { DailyDate, ModelName } from './types.ts'; /** * Interface for daily command JSON output structure (groupByProject) diff --git a/apps/ccusage/src/_macro.ts b/apps/ccusage/src/macro.ts similarity index 100% rename from apps/ccusage/src/_macro.ts rename to apps/ccusage/src/macro.ts diff --git a/apps/ccusage/src/_pricing-fetcher.ts b/apps/ccusage/src/pricing-fetcher.ts similarity index 94% rename from apps/ccusage/src/_pricing-fetcher.ts rename to apps/ccusage/src/pricing-fetcher.ts index 0741c9e0a..cd456518a 100644 --- a/apps/ccusage/src/_pricing-fetcher.ts +++ b/apps/ccusage/src/pricing-fetcher.ts @@ -1,7 +1,7 @@ import { LiteLLMPricingFetcher } from '@ccusage/internal/pricing'; import { Result } from '@praha/byethrow'; -import { prefetchClaudePricing } from './_macro.ts' with { type: 'macro' }; import { logger } from './logger.ts'; +import { prefetchClaudePricing } from './macro.ts' with { type: 'macro' }; export const CLAUDE_PROVIDER_PREFIXES = [ 'anthropic/', diff --git a/apps/ccusage/src/_project-names.ts b/apps/ccusage/src/project-names.ts similarity index 100% rename from apps/ccusage/src/_project-names.ts rename to apps/ccusage/src/project-names.ts diff --git a/apps/ccusage/src/_session-blocks.ts b/apps/ccusage/src/session-blocks.ts similarity index 99% rename from apps/ccusage/src/_session-blocks.ts rename to apps/ccusage/src/session-blocks.ts index 14ad58e02..b91b01387 100644 --- a/apps/ccusage/src/_session-blocks.ts +++ b/apps/ccusage/src/session-blocks.ts @@ -1,5 +1,5 @@ -import { DEFAULT_RECENT_DAYS } from './_consts.ts'; -import { getTotalTokens } from './_token-utils.ts'; +import { DEFAULT_RECENT_DAYS } from './consts.ts'; +import { getTotalTokens } from './token-utils.ts'; /** * Default session duration in hours (Claude's billing block duration) diff --git a/apps/ccusage/src/_shared-args.ts b/apps/ccusage/src/shared-args.ts similarity index 95% rename from apps/ccusage/src/_shared-args.ts rename to apps/ccusage/src/shared-args.ts index e7653d007..4bc1439c2 100644 --- a/apps/ccusage/src/_shared-args.ts +++ b/apps/ccusage/src/shared-args.ts @@ -1,7 +1,7 @@ import type { Args } from 'gunshi'; -import type { CostMode, SortOrder } from './_types.ts'; +import type { CostMode, SortOrder } from './types.ts'; import * as v from 'valibot'; -import { CostModes, filterDateSchema, SortOrders } from './_types.ts'; +import { CostModes, filterDateSchema, SortOrders } from './types.ts'; /** * Parses and validates a date argument in YYYYMMDD format diff --git a/apps/ccusage/src/_token-utils.ts b/apps/ccusage/src/token-utils.ts similarity index 100% rename from apps/ccusage/src/_token-utils.ts rename to apps/ccusage/src/token-utils.ts diff --git a/apps/ccusage/src/_types.ts b/apps/ccusage/src/types.ts similarity index 100% rename from apps/ccusage/src/_types.ts rename to apps/ccusage/src/types.ts diff --git a/apps/ccusage/src/_utils.ts b/apps/ccusage/src/utils.ts similarity index 100% rename from apps/ccusage/src/_utils.ts rename to apps/ccusage/src/utils.ts diff --git a/apps/ccusage/tsdown.config.ts b/apps/ccusage/tsdown.config.ts index 774d5bb62..634e1bf56 100644 --- a/apps/ccusage/tsdown.config.ts +++ b/apps/ccusage/tsdown.config.ts @@ -45,7 +45,7 @@ export default defineConfig({ Macros({ include: [ 'src/index.ts', - 'src/_pricing-fetcher.ts', + 'src/pricing-fetcher.ts', '../amp/src/pricing.ts', '../codex/src/pricing.ts', ],