opencode-cmd-provider 1.4.0 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,27 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.5.0 - 2026-08-23
4
+
5
+ Feature: the `[CMD] ` display-name prefix for auto-registered models is now
6
+ configurable via `provider.commandcode.options.display_prefix`.
7
+
8
+ ### Features
9
+
10
+ - **Configurable display-name prefix** (issue #60): a string value replaces the
11
+ default `[CMD] ` prefix, and an empty string disables it entirely. The option
12
+ is read-only at resolution time — nothing is persisted into the user's config
13
+ (unlike `npm`/`name`/`env`/`options.baseURL`, which are filled when unset).
14
+ - Non-string values fall back to the default `[CMD] ` prefix.
15
+ - Declared model entries are never renamed — the prefix applies only to models
16
+ auto-registered from the bundled snapshot.
17
+
18
+ ### Chores
19
+
20
+ - New `tests/plugin-models.test.ts` cases: `resolveDisplayPrefix` fallback,
21
+ prefix override (`"CC/"`), empty string disabling the prefix (with non-name
22
+ metadata unaffected), and declared models keeping their names regardless of
23
+ the setting.
24
+
3
25
  ## 1.4.0 - 2026-08-23
4
26
 
5
27
  Feature: after a successful `/connect`, the credential is mirrored under
package/README.md CHANGED
@@ -133,6 +133,24 @@ can still declare your own `provider.commandcode` entry; your declarations
133
133
  always win and the snapshot fills in only what's missing (`whitelist`/
134
134
  `blacklist` on a declared entry filter the auto-registered models too).
135
135
 
136
+ The `[CMD] ` display-name prefix is configurable through the declared
137
+ provider entry's options:
138
+
139
+ ```jsonc
140
+ {
141
+ "provider": {
142
+ "commandcode": {
143
+ "options": {
144
+ "display_prefix": "", // default "[CMD] "; empty string disables
145
+ },
146
+ },
147
+ },
148
+ }
149
+ ```
150
+
151
+ Declared model entries are never renamed; the prefix applies to
152
+ auto-registered models only.
153
+
136
154
  - Snapshot — `src/catalog/snapshot.ts` (model ids, names, context lengths) plus
137
155
  `src/catalog/facts.ts` (reasoning efforts, per-1M-token rates, input
138
156
  modalities). Regenerated from the live catalog via `npm run refresh:snapshot`.
@@ -1,7 +1,7 @@
1
1
  export declare const FACTS_SOURCE_URL = "https://unpkg.com/command-code@1.32.1/dist/bundled/command-code-knowledge/reference/models.md";
2
2
  export declare const MODALITIES_SOURCE_URL = "https://unpkg.com/command-code@1.32.1/dist/cli.mjs";
3
3
  export declare const FACTS_PACKAGE_VERSION = "1.32.1";
4
- export declare const FACTS_LAST_REFRESHED = "2026-08-22";
4
+ export declare const FACTS_LAST_REFRESHED = "2026-08-23";
5
5
  export declare const MODEL_EFFORTS: Readonly<Record<string, readonly string[]>>;
6
6
  export declare const MODEL_COSTS: Readonly<Record<string, {
7
7
  input: number;
@@ -7,7 +7,7 @@
7
7
  export const FACTS_SOURCE_URL = "https://unpkg.com/command-code@1.32.1/dist/bundled/command-code-knowledge/reference/models.md";
8
8
  export const MODALITIES_SOURCE_URL = "https://unpkg.com/command-code@1.32.1/dist/cli.mjs";
9
9
  export const FACTS_PACKAGE_VERSION = "1.32.1";
10
- export const FACTS_LAST_REFRESHED = "2026-08-22";
10
+ export const FACTS_LAST_REFRESHED = "2026-08-23";
11
11
  export const MODEL_EFFORTS = {
12
12
  "deepseek/deepseek-v4-pro": ["high", "max"],
13
13
  "deepseek/deepseek-v4-flash": ["high", "max"],
@@ -51,5 +51,5 @@ export interface ModelDeals {
51
51
  export declare const MODEL_DEALS: Readonly<Record<string, ModelDeals>>;
52
52
  export declare const PLAN_CATALOG: Readonly<Record<PlanId, PlanInfo>>;
53
53
  export declare const DEAL_SOURCE_URL = "https://commandcode.ai/docs/resources/pricing-limits";
54
- export declare const DEAL_LAST_REFRESHED = "2026-08-22";
54
+ export declare const DEAL_LAST_REFRESHED = "2026-08-23";
55
55
  export declare const DEAL_PACKAGE_VERSION = "docs";
@@ -74,5 +74,5 @@ export const PLAN_CATALOG = {
74
74
  provider: { price: 15, credits: 0, window5h: 0, windowWeek: 0, display: "Provider" },
75
75
  };
76
76
  export const DEAL_SOURCE_URL = "https://commandcode.ai/docs/resources/pricing-limits";
77
- export const DEAL_LAST_REFRESHED = "2026-08-22";
77
+ export const DEAL_LAST_REFRESHED = "2026-08-23";
78
78
  export const DEAL_PACKAGE_VERSION = "docs";
@@ -1,5 +1,13 @@
1
- import type { Config } from "@opencode-ai/sdk/v2";
1
+ import type { Config, ProviderConfig } from "@opencode-ai/sdk/v2";
2
2
  import type { CatalogModel } from "../catalog/snapshot.js";
3
+ export declare const DEFAULT_DISPLAY_PREFIX = "[CMD] ";
4
+ /**
5
+ * Resolves the auto-registration display-name prefix from the user-declared
6
+ * `provider.commandcode.options.display_prefix` key. A string value is used
7
+ * verbatim (empty string disables the prefix); anything else falls back to
8
+ * `[CMD] `. Read-only: never persisted into the user's config.
9
+ */
10
+ export declare function resolveDisplayPrefix(entry: ProviderConfig | undefined): string;
3
11
  export interface AutoRegisterOptions {
4
12
  npm: string;
5
13
  name: string;
@@ -24,6 +32,9 @@ export interface AutoRegisterOptions {
24
32
  * config key or by the entry's `id`);
25
33
  * - declared models are never modified, and declared models that left the
26
34
  * catalog stay usable.
35
+ * - `options.display_prefix` (string) overrides the default `[CMD] `
36
+ * display-name prefix for auto-registered models; an empty string disables
37
+ * the prefix.
27
38
  */
28
39
  export declare function autoRegister(config: Config, snapshot: readonly CatalogModel[], options: AutoRegisterOptions): Config;
29
40
  /**
@@ -2,6 +2,17 @@ import { MODEL_COSTS, ZERO_MODEL_COST } from "../provider/pricing.js";
2
2
  import { reasoningVariantsForModel, isReasoningModel } from "../provider/reasoning.js";
3
3
  import { inputModalitiesForModel } from "../provider/modalities.js";
4
4
  const DEFAULT_MAX_OUTPUT_TOKENS = 65_536;
5
+ export const DEFAULT_DISPLAY_PREFIX = "[CMD] ";
6
+ /**
7
+ * Resolves the auto-registration display-name prefix from the user-declared
8
+ * `provider.commandcode.options.display_prefix` key. A string value is used
9
+ * verbatim (empty string disables the prefix); anything else falls back to
10
+ * `[CMD] `. Read-only: never persisted into the user's config.
11
+ */
12
+ export function resolveDisplayPrefix(entry) {
13
+ const value = entry?.options?.display_prefix;
14
+ return typeof value === "string" ? value : DEFAULT_DISPLAY_PREFIX;
15
+ }
5
16
  /**
6
17
  * Registers the `commandcode` provider entry into opencode's config so every
7
18
  * snapshot model is available without any user declaration.
@@ -21,6 +32,9 @@ const DEFAULT_MAX_OUTPUT_TOKENS = 65_536;
21
32
  * config key or by the entry's `id`);
22
33
  * - declared models are never modified, and declared models that left the
23
34
  * catalog stay usable.
35
+ * - `options.display_prefix` (string) overrides the default `[CMD] `
36
+ * display-name prefix for auto-registered models; an empty string disables
37
+ * the prefix.
24
38
  */
25
39
  export function autoRegister(config, snapshot, options) {
26
40
  if (snapshot.length === 0)
@@ -33,13 +47,14 @@ export function autoRegister(config, snapshot, options) {
33
47
  entry.options ??= {};
34
48
  entry.options.baseURL ??= options.baseURL;
35
49
  entry.models ??= {};
50
+ const prefix = resolveDisplayPrefix(entry);
36
51
  const declaredById = new Set(Object.values(entry.models)
37
52
  .map((model) => model?.id)
38
53
  .filter((id) => typeof id === "string"));
39
54
  for (const model of snapshot) {
40
55
  if (entry.models[model.id] !== undefined || declaredById.has(model.id))
41
56
  continue;
42
- entry.models[model.id] = configModelFor(model);
57
+ entry.models[model.id] = configModelFor(model, prefix);
43
58
  }
44
59
  return config;
45
60
  }
@@ -73,15 +88,15 @@ export function augmentConfigCommandCodeModels(config) {
73
88
  }
74
89
  /**
75
90
  * Config-schema model entry (not the SDK `Model` shape) for a snapshot model:
76
- * `[CMD]`-prefixed display name, context/output limits with output capped at
91
+ * prefixed display name, context/output limits with output capped at
77
92
  * 65_536, and metadata enriched from the reasoning, modality, and pricing
78
93
  * tables.
79
94
  */
80
- function configModelFor(model) {
95
+ function configModelFor(model, prefix = DEFAULT_DISPLAY_PREFIX) {
81
96
  const variants = reasoningVariantsForModel(model.id);
82
97
  const costs = MODEL_COSTS[model.id] ?? ZERO_MODEL_COST;
83
98
  return {
84
- name: `[CMD] ${model.name}`,
99
+ name: `${prefix}${model.name}`,
85
100
  limit: {
86
101
  context: model.contextLength,
87
102
  output: Math.min(model.contextLength, DEFAULT_MAX_OUTPUT_TOKENS),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-cmd-provider",
3
- "version": "1.4.0",
3
+ "version": "1.5.0",
4
4
  "description": "Command Code provider + plugin for opencode",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",