Repository navigation
Commit de83d19
fix(config): let space-form command sections override generic report sections (ccusage#2006)
* fix(config): let space-form command sections override generic report sections
ConfigContext::option_maps pushed the `commands."<agent> <report>"` section
before the generic `commands.<report>` section, so a generic `commands.daily`
silently overrode `commands."codex daily"` for both `ccusage codex daily` and
the codex source of a unified `ccusage daily`. The colon form was already
ordered after the generic section.
Build the command-section keys in one ordered list (generic report, space
form, colon form) so both agent-specific forms sit above the generic section,
with the colon form winning when both are set. Document the order.
Fixes ccusage#2000
Co-authored-by: viniciusdsandrade <[email protected]>
* test(config): cover CLI command shapes for space-form precedence
The precedence unit test built ConfigCommand by hand, so it never exercised
detect_config_command. Add an end-to-end case over `codex daily`,
`codex:daily` and bare `codex`, which all resolve to the space-form key, and
rewrap the doc comments touched by the fix.
Co-authored-by: viniciusdsandrade <[email protected]>
* fix(config): accept space-form agent command keys in the config schema
The root `commands` schema came from RootCommandsConfig, which lists only the
generic report keys, and every object is closed with additionalProperties:
false. So the published schema rejected both `commands."codex daily"` and the
already documented `commands."codex:daily"`, even though the runtime reads
both.
After the schema is generated, add both key forms for each report an agent
supports, as JSON-pointer `$ref`s to `<agent>.commands.<report>`. They share
that agent's report options, unsupported agent/report pairs stay rejected,
and the inlined schema doesn't gain a copy per agent report and form.
Co-authored-by: viniciusdsandrade <[email protected]>
* fix(config): accept per-source weekly sections in the config schema
A unified `ccusage weekly` calls ConfigContext::for_source for every built-in
agent, so the runtime reads `<agent>.commands.weekly`, `commands."<agent>
weekly"` and `commands."<agent>:weekly"` for each source. The schema took its
agent report keys from the focused-command structs, which list `weekly` only
for claude and opencode, so it rejected those sections for the other sixteen
agents. The aliases added in the previous commit inherited the same gap.
Give every agent commands struct a `weekly` section typed like its `monthly`
one. Source-level `startOfWeek` is ignored at runtime, as opencode's existing
weekly section already reflects. The aliases now derive the full set of keys
the runtime reads, and the schema test checks every built-in agent and
unified report in both forms.
Co-authored-by: viniciusdsandrade <[email protected]>
---------
Co-authored-by: viniciusdsandrade <[email protected]>1 parent f0a8a9c commit de83d19
5 files changed
Lines changed: 4024 additions & 725 deletions
File tree
- apps/ccusage
- docs/guide
- rust/crates
- ccusage-config/src
- ccusage/src/cli
0 commit comments