Skip to content

Add Claude Console plugin#73

Open
andrewmumblebee wants to merge 3 commits into
mainfrom
work/ah/claude-console
Open

Add Claude Console plugin#73
andrewmumblebee wants to merge 3 commits into
mainfrom
work/ah/claude-console

Conversation

@andrewmumblebee

@andrewmumblebee andrewmumblebee commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

🔌 Plugin overview

  • Plugin name: Claude Console
  • Purpose / problem solved: Monitors a Claude Console (Anthropic) organization in SquaredUp — token usage and USD cost (by model, workspace, API key, member, service tier and context window, over time) plus the org's workspaces, API keys, and members as graph objects. Lets teams track and attribute Claude API spend/usage and audit keys & access alongside the rest of their estate.
  • Primary audience: Platform/engineering teams, FinOps/finance, and org admins managing Anthropic API spend and access.
  • Authentication method(s): API Key — an Anthropic Admin API key (sk-ant-admin…) sent via the x-api-key header (with a static anthropic-version header) against https://api.anthropic.com. Validated on setup via GET /v1/organizations/me.

🖼️ Plugin screenshots

Plugin configuration

image image image

Default dashboards

image image image image

🧪 Testing

Built and tested end-to-end against a live, authenticated tenant (not just file validation):

  • Auth: deployed the shell, authenticated a real Admin API key, and confirmed the configValidation probe (GET /v1/organizations/me) returns 200.
  • Import: first import succeeded cleanly — 6 workspaces, 20 API keys, 2 members received and written; all three object types confirmed in the graph via squaredup objects.
  • Data streams (each tested live via squaredup test):
    • usage — flattens the nested data[].results[] time-buckets into rows; auto-selects bucket_width (1m/1h/1d) from the timeframe and sizes limit to stay within the API's per-bucket caps; bracketed array params (group_by[], workspace_ids[], api_key_ids[], account_ids[]) verified in the resolved request URL.
    • cost — daily USD; amount unit verified empirically by computing implied $/token against Claude's published list prices — they match exactly only when amount is treated as cents (/100), catching a would-be 100× error.
    • workspaces / apiKeys / members — return one flat row per object; double-as import streams and visible dashboard tables; optional API-side scope filters (workspace_id, created_by_user_id) tested with a two-object proof.
  • Default content: 4 OOB dashboards build and squaredup validate passes clean (data streams, import definition, UI, icon, default content, config validation, custom types all present).

⚠️ Known limitations

  • Admin/organization access required. Individual accounts and Claude Enterprise (claude.ai) organizations are not supported (Enterprise uses a different Analytics API/key); the programmatic Usage & Cost API is also not available on Claude Platform on AWS.
  • Cost is daily-granularity only, so cost timeframes are limited to ≤ ~31 days (last 7/30 days, this/last month) — no quarter/year.
  • Usage timeframes are capped by the API's per-response bucket limits (31 daily / 168 hourly / 1440 minute), so usage is likewise limited to ≤ ~31-day ranges.
  • Default-workspace / Workbench usage is reported by the API with a null workspace/API-key, it also can't be used in some apis to filter by, so we have to do it via the postRequestScript
  • Priority Tier costs are billed separately and are not in the Cost API (track via token usage instead).
  • Large orgs (>1000 of any object type) would have the remainder omitted from import.
  • Read-only — the plugin never creates, modifies, or deletes any Anthropic resources.

🔮 Future work

This does not query individual workspace settings, i.e. to list what skills, files, models, and managed agents are on a workspace.

This can come in an updated version of the plugin, but requires us to get the user to provide individual api keys for each workspace they want to access so we can see their details.

Similar to the Sanity plugin with how it handles dataset queries (Although that is blocked by needing dependant imports)


📚 Checklist

  • Plugin, datastream and UI naming follow SquaredUp guidelines
  • Logo added
  • One or more dashboards added
  • README added including configuration guidance
  • No secrets or credentials included
  • I agree to the Code of Conduct

Summary by CodeRabbit

  • New Features

    • Added Claude Console monitoring with new dashboards for overview, workspaces, API keys, and members.
    • Introduced spend, token usage, workspace, and account-level views with filtering and trend charts.
    • Added support for selecting a Claude Admin API key during setup.
  • Documentation

    • Added setup guidance, validation feedback, prerequisites, and known limitations for the Claude Console integration.

The APIs generally do not allow filtering by the default workspace, so we have to use scripts to enable this
@coderabbitai

coderabbitai Bot commented Jun 23, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Claude Console v1 adds plugin metadata, required Admin API key configuration and validation, object type and scope definitions, new data streams for objects and analytics, default dashboards, index mappings, and documentation.

Changes

Claude Console v1 plugin rollout

Layer / File(s) Summary
Plugin contract and scope definitions
plugins/ClaudeConsole/v1/metadata.json, plugins/ClaudeConsole/v1/ui.json, plugins/ClaudeConsole/v1/custom_types.json, plugins/ClaudeConsole/v1/defaultContent/scopes.json
Claude Console metadata, the required adminApiKey field, custom types, and scope variables are added.
Auth check and core object streams
plugins/ClaudeConsole/v1/configValidation.json, plugins/ClaudeConsole/v1/dataStreams/organization.json, plugins/ClaudeConsole/v1/dataStreams/workspaces.json, plugins/ClaudeConsole/v1/dataStreams/scripts/workspaces.js, plugins/ClaudeConsole/v1/dataStreams/members.json
Authenticate validation checks the organization stream, and the organization, workspace, and member streams are added; the workspace script appends a default workspace row.
API key stream and index mappings
plugins/ClaudeConsole/v1/dataStreams/apiKeys.json, plugins/ClaudeConsole/v1/dataStreams/scripts/apiKeys.js, plugins/ClaudeConsole/v1/indexDefinitions/default.json
The API key stream adds workspace-scoped filtering and row normalization, and the index definitions map workspaces, API keys, and members.
Cost report stream
plugins/ClaudeConsole/v1/dataStreams/cost.json, plugins/ClaudeConsole/v1/dataStreams/scripts/cost.js
The cost report stream requests bucketed spend data, flattens bucket results into rows, converts amounts from cents, and filters rows by selected workspace.
Usage report stream
plugins/ClaudeConsole/v1/dataStreams/usage.json, plugins/ClaudeConsole/v1/dataStreams/scripts/usage.js
The usage report stream requests bucketed token data, flattens nested results into rows, computes total_tokens, and filters rows by selected workspace.
Overview dashboard
plugins/ClaudeConsole/v1/defaultContent/overview.dash.json
The Overview dashboard adds summary tiles, cost analysis charts, token usage charts, and an API keys table.
Workspace, API key, and member dashboards
plugins/ClaudeConsole/v1/defaultContent/workspace.dash.json, plugins/ClaudeConsole/v1/defaultContent/apiKey.dash.json, plugins/ClaudeConsole/v1/defaultContent/member.dash.json, plugins/ClaudeConsole/v1/defaultContent/manifest.json
The workspace, API key, and member dashboards are added, and the manifest registers overview, workspace, apiKey, and member.
Plugin documentation
plugins/ClaudeConsole/v1/docs/README.md
The README documents prerequisites, validation behavior, indexed object types, monitored data, and limitations.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately summarizes the main change: adding the Claude Console plugin.
Description check ✅ Passed The description is thorough for a new plugin, covering overview, screenshots, testing, limitations, and checklist items.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Comment @coderabbitai help to get the list of available commands.

@andrewmumblebee andrewmumblebee added the new-plugin Used to PR newly added plugins label Jun 23, 2026
@github-actions

Copy link
Copy Markdown

🧩 Plugin PR Summary

📦 Modified Plugins

  • plugins/ClaudeConsole/v1

📋 Results

Step Status
Validation ✅ Passed
Deployment 🚀 Deployed

🔍 Validation Details

claude-console
{
  "valid": true,
  "pluginName": "claude-console",
  "pluginType": "hybrid",
  "summary": {
    "Data Streams": 6,
    "Import Definitions": 1,
    "UI Configuration": true,
    "Has Icon": true,
    "Has Default Content": true,
    "Config Validation": true,
    "Custom Types": true
  }
}

@andrewmumblebee andrewmumblebee marked this pull request as ready for review June 25, 2026 10:27
@andrewmumblebee andrewmumblebee requested a review from a team June 25, 2026 10:27
@andrewmumblebee

Copy link
Copy Markdown
Contributor Author

@clarkd something to consider, is what this plugin should be called.

As mentioned, this only api key usage data, not users using Claude Teams/Pro or Enterprise.
They all have different methods of monitoring, this is specifically for monitoring applications that use Claude's models.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 10

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@plugins/ClaudeConsole/v1/dataStreams/scripts/workspaces.js`:
- Line 7: The workspace import logic is spreading data.data directly into
result, which can throw if the response body is missing the array or it is
empty. Update the workspaces handling in the scripts/workspaces.js flow to
safely guard the spread in the data.data path, using a fallback empty array or a
presence check before building result. Keep the fix localized around the result
assignment so the import degrades gracefully when the response shape is
unexpected.

In `@plugins/ClaudeConsole/v1/dataStreams/usage.json`:
- Around line 174-188: The usage report schema includes dimensions that will
always be empty with the current grouping, so fix the data definition in
usage.json by either adding service_tier, context_window, and account_id to the
report’s group_by configuration or removing those columns from the selected
fields. Use the existing usage report dimension definitions around service_tier,
context_window, and account_id to align the columns with the grouping behavior
so only non-null fields are exposed.

In `@plugins/ClaudeConsole/v1/dataStreams/workspaces.json`:
- Around line 48-52: The archived_at field is declared with the wrong shape in
the workspaces JSON schema, so it won’t be treated as a date in the UI. Update
the archived_at entry in workspaces.json to use shape: "date", matching the
created_at field and other ISO 8601 date-time values. Keep the change scoped to
the archived_at schema definition so sorting/parsing behavior is corrected
without affecting other fields.

In `@plugins/ClaudeConsole/v1/defaultContent/apiKey.dash.json`:
- Line 58: The dashboard tile title is not using title case; update the “Token
usage” label in the relevant tile definition to “Token Usage” to match the
dashboard naming guideline. Locate the tile config by its title field in the
dashboard JSON and change only the displayed title text.

In `@plugins/ClaudeConsole/v1/defaultContent/member.dash.json`:
- Line 67: The dashboard tile titles in member.dash.json are not following the
title-case guideline. Update the tile title strings for the affected entries,
including the ones currently labeled Account usage and API keys created by this
member, so they match the title case used by the other dashboard tile names.

In `@plugins/ClaudeConsole/v1/defaultContent/overview.dash.json`:
- Line 21: The dashboard tile titles in overview.dash.json are using sentence
case instead of title case. Update the affected tile name fields (including the
ones for Spend (this month), Cost by model, Top workspaces by cost, and Token
usage by model, plus the other referenced entries) to use title case
consistently, and use the surrounding dashboard tile definitions to locate the
relevant title properties.

In `@plugins/ClaudeConsole/v1/defaultContent/workspace.dash.json`:
- Line 67: Normalize the dashboard tile names in the workspace.dash.json content
to title case: update the tile entries for Cost over time, Usage by model, and
API keys in this workspace so their title strings use proper title
capitalization. Keep the change limited to the affected tile title fields so the
dashboard naming aligns with the title case guideline.

In `@plugins/ClaudeConsole/v1/docs/README.md`:
- Line 1: The README top-level heading in the Claude Console docs repeats the
plugin name, so update the first heading to a neutral title that matches the
docs guideline. Change the heading in the README file to something like “Before
you start” or “Prerequisites” so it no longer duplicates the plugin name and
better reflects the section’s purpose.

In `@plugins/ClaudeConsole/v1/indexDefinitions/default.json`:
- Around line 13-14: The index mapping source type names in default.json are
plugin-prefixed and should be renamed to match the upstream entity names
instead. Update the ClaudeConsole/v1 indexDefinitions entries referenced by the
source type values used for the workspace, API key, and member mappings so they
read as upstream names like workspace, api key, and member rather than Claude
Workspace or similar. Make the change consistently across all affected mapping
objects in the default definition so the source type labels follow the existing
naming guidelines.

In `@plugins/ClaudeConsole/v1/ui.json`:
- Around line 5-10: The UI copy for this field needs to follow the plugin text
rules: update the label in the ClaudeConsole v1 UI config to sentence-style
casing rather than title case, and rewrite the help text in the same config so
it does not start with “Your” and instead begins with a verb while staying
concise and neutral. Use the existing field entry in ui.json (the Admin API key
field) as the target for these copy-only changes.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 4ac7bbb8-6b7b-449b-8cf0-8f0b45eb2acd

📥 Commits

Reviewing files that changed from the base of the PR and between f166881 and 07de045.

⛔ Files ignored due to path filters (1)
  • plugins/ClaudeConsole/v1/icon.svg is excluded by !**/*.svg
📒 Files selected for processing (22)
  • plugins/ClaudeConsole/v1/configValidation.json
  • plugins/ClaudeConsole/v1/custom_types.json
  • plugins/ClaudeConsole/v1/dataStreams/apiKeys.json
  • plugins/ClaudeConsole/v1/dataStreams/cost.json
  • plugins/ClaudeConsole/v1/dataStreams/members.json
  • plugins/ClaudeConsole/v1/dataStreams/organization.json
  • plugins/ClaudeConsole/v1/dataStreams/scripts/apiKeys.js
  • plugins/ClaudeConsole/v1/dataStreams/scripts/cost.js
  • plugins/ClaudeConsole/v1/dataStreams/scripts/usage.js
  • plugins/ClaudeConsole/v1/dataStreams/scripts/workspaces.js
  • plugins/ClaudeConsole/v1/dataStreams/usage.json
  • plugins/ClaudeConsole/v1/dataStreams/workspaces.json
  • plugins/ClaudeConsole/v1/defaultContent/apiKey.dash.json
  • plugins/ClaudeConsole/v1/defaultContent/manifest.json
  • plugins/ClaudeConsole/v1/defaultContent/member.dash.json
  • plugins/ClaudeConsole/v1/defaultContent/overview.dash.json
  • plugins/ClaudeConsole/v1/defaultContent/scopes.json
  • plugins/ClaudeConsole/v1/defaultContent/workspace.dash.json
  • plugins/ClaudeConsole/v1/docs/README.md
  • plugins/ClaudeConsole/v1/indexDefinitions/default.json
  • plugins/ClaudeConsole/v1/metadata.json
  • plugins/ClaudeConsole/v1/ui.json

name: "Default",
};

result = [...data.data, defaultWorkspace];

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Guard against a missing/empty data.data before spreading.

If the response body lacks a data array (error envelope, empty org, schema change), [...data.data, ...] throws a TypeError and the workspaces import fails rather than degrading gracefully.

🛡️ Proposed fix
-result = [...data.data, defaultWorkspace];
+result = [...(Array.isArray(data?.data) ? data.data : []), defaultWorkspace];
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@plugins/ClaudeConsole/v1/dataStreams/scripts/workspaces.js` at line 7, The
workspace import logic is spreading data.data directly into result, which can
throw if the response body is missing the array or it is empty. Update the
workspaces handling in the scripts/workspaces.js flow to safely guard the spread
in the data.data path, using a fallback empty array or a presence check before
building result. Keep the fix localized around the result assignment so the
import degrades gracefully when the response shape is unexpected.

Comment on lines +174 to +188
{
"name": "service_tier",
"displayName": "Service Tier",
"shape": "string"
},
{
"name": "context_window",
"displayName": "Context Window",
"shape": "string"
},
{
"name": "account_id",
"displayName": "Account ID",
"shape": "string"
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor

🧩 Analysis chain

🌐 Web query:

Anthropic usage_report messages API: are service_tier and context_window valid group_by[] values, and are these fields null when not grouped?

💡 Result:

Yes, service_tier and context_window are both valid values for the group_by[] parameter in the Anthropic messages usage report API [1][2][3]. Regarding the behavior of these fields when not included in the group_by[] parameter: These fields will be null in the API response when you do not specifically include them in your group_by[] request [1][2][3]. For example, if you do not group by context_window, the context_window field in the returned usage objects will be null [1][2]. Similarly, if you do not group by service_tier, the service_tier field will be null [1][2][3]. When they are included in the group_by[] array, the API will aggregate and break down the usage data by those specific dimensions [1][4][3].

Citations:


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '--- target file outline ---'
ast-grep outline plugins/ClaudeConsole/v1/dataStreams/usage.json || true

echo '--- relevant lines ---'
cat -n plugins/ClaudeConsole/v1/dataStreams/usage.json | sed -n '1,260p'

echo '--- repo search ---'
rg -n '"account_id"|"service_tier"|"context_window"|group_by\[\]' plugins/ClaudeConsole -S

Repository: squaredup/plugins

Length of output: 7804


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '--- target file outline ---'
ast-grep outline plugins/ClaudeConsole/v1/dataStreams/usage.json || true

echo '--- relevant lines ---'
cat -n plugins/ClaudeConsole/v1/dataStreams/usage.json | sed -n '1,260p'

echo '--- repo search ---'
rg -n '"account_id"|"service_tier"|"context_window"|group_by\[\]' plugins/ClaudeConsole -S

Repository: squaredup/plugins

Length of output: 7804


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '--- target file outline ---'
ast-grep outline plugins/ClaudeConsole/v1/dataStreams/usage.json || true

echo '--- relevant lines ---'
cat -n plugins/ClaudeConsole/v1/dataStreams/usage.json | sed -n '1,260p'

echo '--- repo search ---'
rg -n '"account_id"|"service_tier"|"context_window"|group_by\[\]' plugins/ClaudeConsole -S

Repository: squaredup/plugins

Length of output: 7804


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '--- target file outline ---'
ast-grep outline plugins/ClaudeConsole/v1/dataStreams/usage.json || true

echo '--- relevant lines ---'
cat -n plugins/ClaudeConsole/v1/dataStreams/usage.json | sed -n '1,260p'

echo '--- repo search ---'
rg -n '"account_id"|"service_tier"|"context_window"|group_by\[\]' plugins/ClaudeConsole -S

Repository: squaredup/plugins

Length of output: 7804


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '--- target file outline ---'
ast-grep outline plugins/ClaudeConsole/v1/dataStreams/usage.json || true

echo '--- relevant lines ---'
cat -n plugins/ClaudeConsole/v1/dataStreams/usage.json | sed -n '1,260p'

echo '--- repo search ---'
rg -n '"account_id"|"service_tier"|"context_window"|group_by\[\]' plugins/ClaudeConsole -S

Repository: squaredup/plugins

Length of output: 7804


🌐 Web query:

Anthropic usage_report retrieve_messages account_id group_by account_id messages report field

💡 Result:

The endpoint used to retrieve message-level usage data from Anthropic is GET /v1/organizations/usage_report/messages [1][2]. This is part of the Usage & Cost Admin API [3]. Regarding your query about parameters and fields: 1. account_id: In the response object, account_id is a field that identifies the user account that performed the request [1][2]. It will return null if you are not grouping by account or if the request was made via a non-OAuth process [2]. 2. group_by: You can use the group_by[] parameter to aggregate usage metrics by specific dimensions [3][4]. Valid dimensions for grouping include model, workspace_id, api_key_id, context_window, inference_geo, service_tier, and product [1][2][5]. 3. messages report field: The endpoint returns a MessagesUsageReport object containing a data array [1][2]. Each entry in the data array includes a results array containing usage metrics such as uncached_input_tokens, output_tokens, cache_read_input_tokens, and cache_creation (which breaks down into ephemeral_1h_input_tokens and ephemeral_5m_input_tokens) [1][2][6]. To use this, you must authenticate with an Admin API key (prefixed with sk-ant-admin-...) [7]. Example request structure: curl "https://api.anthropic.com/v1/organizations/usage_report/messages?\ starting_at=2026-06-01T00:00:00Z&\ group_by[]=account_id&\ group_by[]=model" \ --header "anthropic-version: 2023-06-01" \ --header "x-api-key: $ANTHROPIC_ADMIN_KEY" [3][7]

Citations:


Either group by these dimensions or remove the columns
service_tier and context_window are null unless added to group_by[], and account_id is also null unless the report is grouped by account_id. The current request only groups by workspace_id, api_key_id, and model, so these columns will render empty as-is.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@plugins/ClaudeConsole/v1/dataStreams/usage.json` around lines 174 - 188, The
usage report schema includes dimensions that will always be empty with the
current grouping, so fix the data definition in usage.json by either adding
service_tier, context_window, and account_id to the report’s group_by
configuration or removing those columns from the selected fields. Use the
existing usage report dimension definitions around service_tier, context_window,
and account_id to align the columns with the grouping behavior so only non-null
fields are exposed.

Comment on lines +48 to +52
{
"name": "archived_at",
"displayName": "Archived",
"shape": "string"
},

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

archived_at should use shape: "date".

archived_at is an ISO 8601 date-time (same as created_at above) but is declared as string, so it won't be parsed/sorted as a date in the UI.

🛠️ Proposed fix
         {
             "name": "archived_at",
             "displayName": "Archived",
-            "shape": "string"
+            "shape": "date"
         },

Based on learnings: ISO 8601 date-time fields should use shape: "date".

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
{
"name": "archived_at",
"displayName": "Archived",
"shape": "string"
},
{
"name": "archived_at",
"displayName": "Archived",
"shape": "date"
},
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@plugins/ClaudeConsole/v1/dataStreams/workspaces.json` around lines 48 - 52,
The archived_at field is declared with the wrong shape in the workspaces JSON
schema, so it won’t be treated as a date in the UI. Update the archived_at entry
in workspaces.json to use shape: "date", matching the created_at field and other
ISO 8601 date-time values. Keep the change scoped to the archived_at schema
definition so sorting/parsing behavior is corrected without affecting other
fields.

Source: Learnings

"z": 0,
"config": {
"_type": "tile/data-stream",
"title": "Token usage",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Update tile title to title case.

Token usage should be Token Usage.

As per coding guidelines: "Tile names in dashboards should use title case".

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@plugins/ClaudeConsole/v1/defaultContent/apiKey.dash.json` at line 58, The
dashboard tile title is not using title case; update the “Token usage” label in
the relevant tile definition to “Token Usage” to match the dashboard naming
guideline. Locate the tile config by its title field in the dashboard JSON and
change only the displayed title text.

Source: Coding guidelines

"z": 0,
"config": {
"_type": "tile/data-stream",
"title": "Account usage",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Use title case for these tile titles.

Account usage and API keys created by this member should be title-cased.

As per coding guidelines: "Tile names in dashboards should use title case".

Also applies to: 122-122

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@plugins/ClaudeConsole/v1/defaultContent/member.dash.json` at line 67, The
dashboard tile titles in member.dash.json are not following the title-case
guideline. Update the tile title strings for the affected entries, including the
ones currently labeled Account usage and API keys created by this member, so
they match the title case used by the other dashboard tile names.

Source: Coding guidelines

"z": 0,
"config": {
"_type": "tile/data-stream",
"title": "Spend (this month)",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Use title case for tile titles.

These tile names are not in title case (e.g., Spend (this month), Cost by model, Top workspaces by cost, Token usage by model). Please update them to title case for dashboard consistency.

As per coding guidelines: "Tile names in dashboards should use title case".

Also applies to: 167-167, 218-218, 269-269

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@plugins/ClaudeConsole/v1/defaultContent/overview.dash.json` at line 21, The
dashboard tile titles in overview.dash.json are using sentence case instead of
title case. Update the affected tile name fields (including the ones for Spend
(this month), Cost by model, Top workspaces by cost, and Token usage by model,
plus the other referenced entries) to use title case consistently, and use the
surrounding dashboard tile definitions to locate the relevant title properties.

Source: Coding guidelines

"z": 0,
"config": {
"_type": "tile/data-stream",
"title": "Cost over time",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Normalize tile titles to title case.

Cost over time, Usage by model, and API keys in this workspace should be title-cased.

As per coding guidelines: "Tile names in dashboards should use title case".

Also applies to: 118-118, 173-173

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@plugins/ClaudeConsole/v1/defaultContent/workspace.dash.json` at line 67,
Normalize the dashboard tile names in the workspace.dash.json content to title
case: update the tile entries for Cost over time, Usage by model, and API keys
in this workspace so their title strings use proper title capitalization. Keep
the change limited to the affected tile title fields so the dashboard naming
aligns with the title case guideline.

Source: Coding guidelines

@@ -0,0 +1,53 @@
# Claude Console

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Use a neutral top-level heading.

This repeats the plugin name, which the docs guideline says to avoid. # Before you start or # Prerequisites would fit better here.

Proposed fix
-# Claude Console
+# Before you start
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
# Claude Console
# Before you start
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@plugins/ClaudeConsole/v1/docs/README.md` at line 1, The README top-level
heading in the Claude Console docs repeats the plugin name, so update the first
heading to a neutral title that matches the docs guideline. Change the heading
in the README file to something like “Before you start” or “Prerequisites” so it
no longer duplicates the plugin name and better reflects the section’s purpose.

Source: Coding guidelines

Comment on lines +13 to +14
"value": "Claude Workspace"
},

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift

Remove plugin-prefixed source type names in index mappings.

Lines 13/33/57 use Claude ... type values, but index source types should be named as upstream entities (for example workspace, api key, member) and not plugin-prefixed.

As per coding guidelines, “Name source types after how they are referred to in the upstream product or API … Do not prefix them with the plugin name.”

Also applies to: 33-34, 57-58

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@plugins/ClaudeConsole/v1/indexDefinitions/default.json` around lines 13 - 14,
The index mapping source type names in default.json are plugin-prefixed and
should be renamed to match the upstream entity names instead. Update the
ClaudeConsole/v1 indexDefinitions entries referenced by the source type values
used for the workspace, API key, and member mappings so they read as upstream
names like workspace, api key, and member rather than Claude Workspace or
similar. Make the change consistently across all affected mapping objects in the
default definition so the source type labels follow the existing naming
guidelines.

Source: Coding guidelines

Comment on lines +5 to +10
"label": "Admin API Key",
"validation": {
"required": true
},
"placeholder": "sk-ant-admin...",
"help": "Your organization's Admin API key from the [Claude Console (Settings → Admin keys)](https://platform.claude.com/settings/admin-keys). Starts with `sk-ant-admin`. This plugin only reads data; it does not create, modify, or delete any Claude resources"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Adjust UI field label/help text to match plugin UI copy rules.

Line 5 uses title-style casing (Admin API Key), and Line 10 starts with “Your…”. The UI guidelines require neutral concise text, first-word sentence-style casing, and help text that starts with a verb.

As per coding guidelines, “UI field displayName should use first word uppercase then lowercase … Do not use ‘you’ or ‘Your’ … UI field help text … Start with a verb where possible.”

Suggested edit
-        "label": "Admin API Key",
+        "label": "Admin API key",
...
-        "help": "Your organization's Admin API key from the [Claude Console (Settings → Admin keys)](https://platform.claude.com/settings/admin-keys). Starts with `sk-ant-admin`. This plugin only reads data; it does not create, modify, or delete any Claude resources"
+        "help": "Provide the organization Admin API key from [Claude Console (Settings → Admin keys)](https://platform.claude.com/settings/admin-keys) (starts with `sk-ant-admin`)"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"label": "Admin API Key",
"validation": {
"required": true
},
"placeholder": "sk-ant-admin...",
"help": "Your organization's Admin API key from the [Claude Console (Settings → Admin keys)](https://platform.claude.com/settings/admin-keys). Starts with `sk-ant-admin`. This plugin only reads data; it does not create, modify, or delete any Claude resources"
"label": "Admin API key",
"validation": {
"required": true
},
"placeholder": "sk-ant-admin...",
"help": "Provide the organization Admin API key from [Claude Console (Settings → Admin keys)](https://platform.claude.com/settings/admin-keys) (starts with `sk-ant-admin`)"
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@plugins/ClaudeConsole/v1/ui.json` around lines 5 - 10, The UI copy for this
field needs to follow the plugin text rules: update the label in the
ClaudeConsole v1 UI config to sentence-style casing rather than title case, and
rewrite the help text in the same config so it does not start with “Your” and
instead begins with a verb while staying concise and neutral. Use the existing
field entry in ui.json (the Admin API key field) as the target for these
copy-only changes.

Source: Coding guidelines

@clarkd clarkd left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

A few CodeRabbit comments to address here.

// cost.js — flatten nested time-bucket/results structure, coerce amount string→number,
// and optionally scope to selected workspace(s) via the `workspace` objects param.

const unwrap = (v) => (Array.isArray(v) ? v[0] : v);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Shouldn't be needed with schema 2.1

},
{
"name": "amount",
"displayName": "Cost ($)",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is it always USD for every customer?

{
"type": "password",
"name": "adminApiKey",
"label": "Admin API Key",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
"label": "Admin API Key",
"label": "Admin API key",

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new-plugin Used to PR newly added plugins

Development

Successfully merging this pull request may close these issues.

2 participants