From 3502d870fcd85014c99b3a6d3bbaaf89e60ecdd9 Mon Sep 17 00:00:00 2001 From: qer Date: Tue, 2 Jun 2026 21:54:42 +0800 Subject: [PATCH] chore: scrub internal identifiers from public text (#340) --- .agents/skills/gen-changesets/SKILL.md | 2 ++ .agents/skills/gen-docs/SKILL.md | 2 ++ .agents/skills/sync-changelog/SKILL.md | 3 +++ .agents/skills/translate-docs/SKILL.md | 2 ++ AGENTS.md | 1 + apps/kimi-code/CHANGELOG.md | 2 +- apps/kimi-code/test/cli/provider.test.ts | 8 ++++---- docs/en/configuration/env-vars.md | 4 ++-- docs/en/reference/kimi-command.md | 6 +++--- docs/en/release-notes/changelog.md | 2 +- docs/zh/configuration/env-vars.md | 4 ++-- docs/zh/reference/kimi-command.md | 6 +++--- docs/zh/release-notes/changelog.md | 2 +- packages/agent-core/CHANGELOG.md | 2 +- packages/agent-core/test/config/env-model.test.ts | 8 ++++---- packages/kosong/CHANGELOG.md | 2 +- 16 files changed, 33 insertions(+), 23 deletions(-) diff --git a/.agents/skills/gen-changesets/SKILL.md b/.agents/skills/gen-changesets/SKILL.md index 9b7b5796a..71df61bfb 100644 --- a/.agents/skills/gen-changesets/SKILL.md +++ b/.agents/skills/gen-changesets/SKILL.md @@ -60,6 +60,7 @@ If you believe a change qualifies as major, stop first, explain why, and ask the - User-facing CLI wording should only be used when CLI users can perceive the change. - Internal changes that do not affect CLI users can still share a changeset with the CLI, but the wording must describe the real change honestly and must not present it as a user-facing feature. - Do not mention file names, class names, function names, PR numbers, or commit hashes. +- Do not include real internal endpoints, key names, account names, or service names. If an example is needed, use neutral placeholders such as `example.com`, `example.test`, or `YOUR_API_KEY`. - Avoid vague words such as `refactor`, `optimize`, and `improve`. Describe the actual change, or use more specific wording. ## Common Examples @@ -104,3 +105,4 @@ Clarify session status typing for internal SDK callers. - The changelog entry is in Chinese. - The wording claims more than the diff actually did. - The CLI wording mentions internal package names, class names, or PR numbers. +- The entry includes real internal identifiers instead of neutral placeholders. diff --git a/.agents/skills/gen-docs/SKILL.md b/.agents/skills/gen-docs/SKILL.md index 62830a652..f205ad00d 100644 --- a/.agents/skills/gen-docs/SKILL.md +++ b/.agents/skills/gen-docs/SKILL.md @@ -75,6 +75,7 @@ This skill depends on the following being in place. If any are missing, stop and - **Locale sync**: Non-changelog pages stay mirrored between `docs/en/` and `docs/zh/`. Changelog flows English → Chinese. - **Terminology**: Use the term table in `docs/AGENTS.md` exactly. Do not invent new translations or use synonyms. - **Scope discipline**: Only update sections affected by the recent changes. Do not opportunistically rewrite unrelated docs. +- **Public examples**: Never write real internal endpoints, key names, account names, or service names into docs. Use neutral placeholders such as `https://api.example.com/v1`, `https://registry.example.com/v1/models/api.json`, `example.test`, and `YOUR_API_KEY`. - **Breaking changes**: If any change is breaking, also update `docs/en/release-notes/breaking-changes.md` (under `## Unreleased`) with `**Affected**` + `**Migration**` subsections, and mirror it in `docs/zh/release-notes/breaking-changes.md`. - **Do not edit auto-synced files**: `docs/en/release-notes/changelog.md` is regenerated by the sync script; any manual edit will be overwritten. @@ -85,3 +86,4 @@ This skill depends on the following being in place. If any are missing, stop and - Updating only one locale and leaving its mirror stale. - Editing only the mirror to fix wording that should be corrected in the locale you changed first. - Inventing new terminology that drifts from the `docs/AGENTS.md` term table. +- Using real internal values in examples instead of neutral `example` placeholders. diff --git a/.agents/skills/sync-changelog/SKILL.md b/.agents/skills/sync-changelog/SKILL.md index 20430bb4b..64a0bd051 100644 --- a/.agents/skills/sync-changelog/SKILL.md +++ b/.agents/skills/sync-changelog/SKILL.md @@ -90,6 +90,8 @@ After stripping, each entry should be only: Upstream language rule: `gen-changesets` requires changelog entries to be English. If the upstream CLI changelog contains a non-English entry, stop and report it to the user. Do not silently rewrite it while syncing docs. +Public-text rule: do not copy real internal endpoints, key names, account names, or service names into docs changelogs. Replace examples with neutral placeholders such as `example.com`, `example.test`, or `YOUR_API_KEY` while preserving the user-visible meaning. + ### 3. Classify Entries The docs changelog uses five section types: @@ -204,6 +206,7 @@ Check: - Each section has the same number of entries on both pages. - Within each section, the most valuable, obvious, and larger entries appear before smaller or narrower entries. - PR links and commit hashes were stripped. +- Real internal identifiers were replaced with neutral placeholders. - There are no empty sections. - Markdown indentation and blank lines are intact. diff --git a/.agents/skills/translate-docs/SKILL.md b/.agents/skills/translate-docs/SKILL.md index d34370225..e081f1a09 100644 --- a/.agents/skills/translate-docs/SKILL.md +++ b/.agents/skills/translate-docs/SKILL.md @@ -55,6 +55,7 @@ When non-changelog pages change in either locale, sync the mirror before release - **Do not one-sided fixes**: if the changed locale has an unclear or incorrect statement, fix it there first; do not patch only the mirror. - **Match style, not just words**: Chinese docs use a narrative tone (see `docs/AGENTS.md` writing-style examples); preserve that tone in Chinese; preserve sentence-case headings and concise English style in English. - **Code blocks and identifiers stay as-is**: do not translate code, command names, flag names, or file paths. +- **Public examples**: Do not introduce real internal endpoints, key names, account names, or service names while translating. Keep or replace them with neutral placeholders such as `example.com`, `example.test`, and `YOUR_API_KEY` in both locales. ## Common mistakes @@ -63,3 +64,4 @@ When non-changelog pages change in either locale, sync the mirror before release - Forgetting to add spaces between Chinese characters and inline code or English words. - Translating proper nouns listed in the term table (`Wire`, `MCP`, `ACP`, `JSON`, `OAuth`, `macOS`, `uv`, etc.). - Updating only one direction and leaving the other locale stale — always finish all pages flagged by the diff. +- Copying real internal values into the mirror instead of using neutral `example` placeholders. diff --git a/AGENTS.md b/AGENTS.md index 484722aca..dcadd9f19 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -65,6 +65,7 @@ This is a TypeScript monorepo built for agent-assisted development. Keep the roo - Prefer `rg` / `rg --files` when reading code. - When designing changes, follow existing boundaries and local patterns first. +- In public text and test data, replace real internal identifiers with neutral placeholders such as `example.com`, `example.test`, and `YOUR_API_KEY`. Before opening a PR, ask a read-only agent to audit the diff for context-specific internal identifiers. - When creating a PR, the PR title must follow Conventional Commit style, e.g. `chore: remove legacy format commands`. - When an AI agent opens or updates a PR, fill in `.github/pull_request_template.md` — link the related issue or explain the problem, then describe what changed. Do not leave placeholder text or submit a generic summary of the diff. - Do not submit vague AI-generated PR text. The human author must understand the change well enough to explain the code, edge cases, and why the approach fits this repository. diff --git a/apps/kimi-code/CHANGELOG.md b/apps/kimi-code/CHANGELOG.md index fc08df0b9..df1a5a5af 100644 --- a/apps/kimi-code/CHANGELOG.md +++ b/apps/kimi-code/CHANGELOG.md @@ -4,7 +4,7 @@ ### Minor Changes -- [#232](https://github.com/MoonshotAI/kimi-code/pull/232) [`a24bfb1`](https://github.com/MoonshotAI/kimi-code/commit/a24bfb1df38e58120827a1d8ed881724af2e7b23) - Add `KIMI_MODEL_ADAPTIVE_THINKING` (and a matching `adaptive_thinking` model-alias field) to force adaptive thinking (`thinking: { type: 'adaptive' }`) on or off, overriding the Anthropic model-name version inference. This lets custom-named staff endpoints that back an adaptive-capable model opt in even when the model name does not encode a parseable Claude version. +- [#232](https://github.com/MoonshotAI/kimi-code/pull/232) [`a24bfb1`](https://github.com/MoonshotAI/kimi-code/commit/a24bfb1df38e58120827a1d8ed881724af2e7b23) - Add `KIMI_MODEL_ADAPTIVE_THINKING` (and a matching `adaptive_thinking` model-alias field) to force adaptive thinking (`thinking: { type: 'adaptive' }`) on or off, overriding the Anthropic model-name version inference. This lets custom-named compatible endpoints that back an adaptive-capable model opt in even when the model name does not encode a parseable Claude version. - [#264](https://github.com/MoonshotAI/kimi-code/pull/264) [`42bb914`](https://github.com/MoonshotAI/kimi-code/commit/42bb9141d8ee7023639f943dd4c6a0f6c8fa8945) - Add `/provider` command for managing AI providers, support custom registry imports, and introduce a tabbed model selector. diff --git a/apps/kimi-code/test/cli/provider.test.ts b/apps/kimi-code/test/cli/provider.test.ts index aef8cbc5f..d1f6a05e6 100644 --- a/apps/kimi-code/test/cli/provider.test.ts +++ b/apps/kimi-code/test/cli/provider.test.ts @@ -136,12 +136,12 @@ async function tryRun(fn: () => Promise): Promise { } } -const REGISTRY_URL = 'https://free-tokens.example.test/v1/models/api.json'; +const REGISTRY_URL = 'https://registry.example.test/v1/models/api.json'; const REGISTRY_BODY = { kohub: { id: 'kohub', name: 'KoHub Anthropic', - api: 'https://free-tokens.example.test', + api: 'https://registry.example.test', type: 'anthropic', models: { 'claude-opus-4-7': { id: 'claude-opus-4-7', name: 'Claude Opus 4-7', tool_call: true }, @@ -150,7 +150,7 @@ const REGISTRY_BODY = { 'kohub-responses': { id: 'kohub-responses', name: 'KoHub Responses', - api: 'https://free-tokens.example.test/v1', + api: 'https://registry.example.test/v1', type: 'openai_responses', models: { 'gpt-5.5': { id: 'gpt-5.5', name: 'GPT 5.5', reasoning: true }, @@ -248,7 +248,7 @@ describe('kimi provider add', () => { expect(Object.keys(finalConfig.providers).toSorted()).toEqual(['kohub', 'kohub-responses']); const kohub = finalConfig.providers['kohub']!; expect(kohub.type).toBe('anthropic'); - expect(kohub.baseUrl).toBe('https://free-tokens.example.test'); + expect(kohub.baseUrl).toBe('https://registry.example.test'); expect(kohub.apiKey).toBe('sk-test-token'); expect(kohub.source).toEqual({ kind: 'apiJson', diff --git a/docs/en/configuration/env-vars.md b/docs/en/configuration/env-vars.md index 337d147a6..b82f6f0a9 100644 --- a/docs/en/configuration/env-vars.md +++ b/docs/en/configuration/env-vars.md @@ -93,8 +93,8 @@ Set `KIMI_MODEL_ADAPTIVE_THINKING=true` when a custom-named Anthropic-compatible ```sh export KIMI_MODEL_NAME="kimi-for-coding" -export KIMI_MODEL_BASE_URL="https://api-staff.msh.team/v1" -export KIMI_MODEL_API_KEY="$MOONSHOT_STAFF_KEY" +export KIMI_MODEL_BASE_URL="https://api.example.com/v1" +export KIMI_MODEL_API_KEY="YOUR_API_KEY" export KIMI_MODEL_MAX_CONTEXT_SIZE="262144" export KIMI_MODEL_CAPABILITIES="image_in,thinking" kimi diff --git a/docs/en/reference/kimi-command.md b/docs/en/reference/kimi-command.md index 136436114..d043775d6 100644 --- a/docs/en/reference/kimi-command.md +++ b/docs/en/reference/kimi-command.md @@ -188,15 +188,15 @@ Import every provider listed in a custom registry (an `api.json` document). The | Argument / Option | Description | | --- | --- | -| `` | Registry URL, e.g. `https://free-tokens.msh.team/v1/models/api.json`. | +| `` | Registry URL, e.g. `https://registry.example.com/v1/models/api.json`. | | `--api-key ` | Bearer token sent with the registry fetch. Falls back to the `KIMI_REGISTRY_API_KEY` environment variable when omitted. Required. | ```sh # One-line import — every provider and model in the registry lands in ~/.kimi-code/config.toml -kimi provider add https://free-tokens.msh.team/v1/models/api.json --api-key YOUR_KEY +kimi provider add https://registry.example.com/v1/models/api.json --api-key YOUR_KEY # Or via environment variable, for CI / .envrc-style workflows -KIMI_REGISTRY_API_KEY=YOUR_KEY kimi provider add https://free-tokens.msh.team/v1/models/api.json +KIMI_REGISTRY_API_KEY=YOUR_KEY kimi provider add https://registry.example.com/v1/models/api.json ``` If a provider id already exists, it is replaced (its stale model aliases are removed first, mirroring the TUI flow). No default model is selected — pick one later via `-m` or `/model` inside the TUI. diff --git a/docs/en/release-notes/changelog.md b/docs/en/release-notes/changelog.md index 5e9d1e786..f632216ba 100644 --- a/docs/en/release-notes/changelog.md +++ b/docs/en/release-notes/changelog.md @@ -8,7 +8,7 @@ This page documents the changes in each Kimi Code CLI release. - Add `/provider` command for managing AI providers, support custom registry imports, and introduce a tabbed model selector. It replaces the deprecated `/connect` command — use `/provider` instead. - Render scheduled reminders distinctly in the TUI, expose cron fired events to SDK clients, and report cron fire times with local timezone offsets. -- Add `KIMI_MODEL_ADAPTIVE_THINKING` (and a matching `adaptive_thinking` model-alias field) to force adaptive thinking (`thinking: { type: 'adaptive' }`) on or off, overriding the Anthropic model-name version inference. This lets custom-named staff endpoints that back an adaptive-capable model opt in even when the model name does not encode a parseable Claude version. +- Add `KIMI_MODEL_ADAPTIVE_THINKING` (and a matching `adaptive_thinking` model-alias field) to force adaptive thinking (`thinking: { type: 'adaptive' }`) on or off, overriding the Anthropic model-name version inference. This lets custom-named compatible endpoints that back an adaptive-capable model opt in even when the model name does not encode a parseable Claude version. ### Bug Fixes diff --git a/docs/zh/configuration/env-vars.md b/docs/zh/configuration/env-vars.md index 3ca15bcc5..f14b9feae 100644 --- a/docs/zh/configuration/env-vars.md +++ b/docs/zh/configuration/env-vars.md @@ -93,8 +93,8 @@ OAuth 流程默认连接 Kimi 官方的认证与托管端点,下列变量可 ```sh export KIMI_MODEL_NAME="kimi-for-coding" -export KIMI_MODEL_BASE_URL="https://api-staff.msh.team/v1" -export KIMI_MODEL_API_KEY="$MOONSHOT_STAFF_KEY" +export KIMI_MODEL_BASE_URL="https://api.example.com/v1" +export KIMI_MODEL_API_KEY="YOUR_API_KEY" export KIMI_MODEL_MAX_CONTEXT_SIZE="262144" export KIMI_MODEL_CAPABILITIES="image_in,thinking" kimi diff --git a/docs/zh/reference/kimi-command.md b/docs/zh/reference/kimi-command.md index 30e11da53..b04e359f9 100644 --- a/docs/zh/reference/kimi-command.md +++ b/docs/zh/reference/kimi-command.md @@ -188,15 +188,15 @@ kimi provider [options] | 参数 / 选项 | 说明 | | --- | --- | -| `` | Registry 地址,例如 `https://free-tokens.msh.team/v1/models/api.json`。 | +| `` | Registry 地址,例如 `https://registry.example.com/v1/models/api.json`。 | | `--api-key ` | 访问 registry 时携带的 Bearer token。未传时回退到环境变量 `KIMI_REGISTRY_API_KEY`。必填。 | ```sh # 一行导入:registry 中的所有 provider 与 model 全部写入 ~/.kimi-code/config.toml -kimi provider add https://free-tokens.msh.team/v1/models/api.json --api-key YOUR_KEY +kimi provider add https://registry.example.com/v1/models/api.json --api-key YOUR_KEY # 或通过环境变量,便于 CI / .envrc 等场景 -KIMI_REGISTRY_API_KEY=YOUR_KEY kimi provider add https://free-tokens.msh.team/v1/models/api.json +KIMI_REGISTRY_API_KEY=YOUR_KEY kimi provider add https://registry.example.com/v1/models/api.json ``` 如果某个 provider id 已存在,会先删除(包括其残留的模型 alias),再按 registry 重新写入,与 TUI 的行为一致。不会自动设置默认模型 —— 后续可以用 `-m` 或 TUI 内的 `/model` 选择。 diff --git a/docs/zh/release-notes/changelog.md b/docs/zh/release-notes/changelog.md index 689e37590..3f371e55f 100644 --- a/docs/zh/release-notes/changelog.md +++ b/docs/zh/release-notes/changelog.md @@ -8,7 +8,7 @@ - 新增用于管理 AI 供应商的 `/provider` 命令,支持自定义 registry 导入,并引入标签页式模型选择器。该命令替代了已废弃的 `/connect`,请改用 `/provider`。 - 在终端界面中以独立样式渲染定时提醒,向 SDK 客户端暴露 cron 触发事件,并在报告 cron 触发时间时附带本地时区偏移。 -- 新增 `KIMI_MODEL_ADAPTIVE_THINKING`(以及对应的 `adaptive_thinking` 模型别名字段),用于强制开启或关闭自适应 thinking(`thinking: { type: 'adaptive' }`),覆盖基于 Anthropic 模型名的版本推断。这样一来,背后由支持自适应能力的模型驱动、且使用自定义名称的 staff 端点,即使模型名没有编码出可解析的 Claude 版本,也能选择启用该能力。 +- 新增 `KIMI_MODEL_ADAPTIVE_THINKING`(以及对应的 `adaptive_thinking` 模型别名字段),用于强制开启或关闭自适应 thinking(`thinking: { type: 'adaptive' }`),覆盖基于 Anthropic 模型名的版本推断。这样一来,背后由支持自适应能力的模型驱动、且使用自定义名称的兼容端点,即使模型名没有编码出可解析的 Claude 版本,也能选择启用该能力。 ### 修复 diff --git a/packages/agent-core/CHANGELOG.md b/packages/agent-core/CHANGELOG.md index 4b915a009..af1a0ab75 100644 --- a/packages/agent-core/CHANGELOG.md +++ b/packages/agent-core/CHANGELOG.md @@ -4,7 +4,7 @@ ### Minor Changes -- [#232](https://github.com/MoonshotAI/kimi-code/pull/232) [`a24bfb1`](https://github.com/MoonshotAI/kimi-code/commit/a24bfb1df38e58120827a1d8ed881724af2e7b23) - Add `KIMI_MODEL_ADAPTIVE_THINKING` (and a matching `adaptive_thinking` model-alias field) to force adaptive thinking (`thinking: { type: 'adaptive' }`) on or off, overriding the Anthropic model-name version inference. This lets custom-named staff endpoints that back an adaptive-capable model opt in even when the model name does not encode a parseable Claude version. +- [#232](https://github.com/MoonshotAI/kimi-code/pull/232) [`a24bfb1`](https://github.com/MoonshotAI/kimi-code/commit/a24bfb1df38e58120827a1d8ed881724af2e7b23) - Add `KIMI_MODEL_ADAPTIVE_THINKING` (and a matching `adaptive_thinking` model-alias field) to force adaptive thinking (`thinking: { type: 'adaptive' }`) on or off, overriding the Anthropic model-name version inference. This lets custom-named compatible endpoints that back an adaptive-capable model opt in even when the model name does not encode a parseable Claude version. - [#204](https://github.com/MoonshotAI/kimi-code/pull/204) [`ee69d0a`](https://github.com/MoonshotAI/kimi-code/commit/ee69d0ac29f56bde4957c14767d7ca436697d9cf) - Render scheduled reminders distinctly in the TUI, expose cron fired events to SDK clients, and report cron fire times with local timezone offsets. diff --git a/packages/agent-core/test/config/env-model.test.ts b/packages/agent-core/test/config/env-model.test.ts index c66a5713e..3c17f0d4c 100644 --- a/packages/agent-core/test/config/env-model.test.ts +++ b/packages/agent-core/test/config/env-model.test.ts @@ -96,9 +96,9 @@ describe('applyEnvModelConfig', () => { it('lets an explicit base url override the default', () => { expect( - apply({ ...MIN, KIMI_MODEL_BASE_URL: 'https://api-staff.msh.team/v1' }) + apply({ ...MIN, KIMI_MODEL_BASE_URL: 'https://api.example.com/v1' }) .providers[ENV_MODEL_PROVIDER_KEY]?.baseUrl, - ).toBe('https://api-staff.msh.team/v1'); + ).toBe('https://api.example.com/v1'); }); it('parses comma-separated capabilities (trimmed, lowercased)', () => { @@ -113,9 +113,9 @@ describe('applyEnvModelConfig', () => { expect(withoutName).toBeDefined(); expect(withoutName?.displayName).toBeUndefined(); expect( - apply({ ...MIN, KIMI_MODEL_DISPLAY_NAME: 'Staff Model' }) + apply({ ...MIN, KIMI_MODEL_DISPLAY_NAME: 'Custom Model' }) .models?.[ENV_MODEL_ALIAS_KEY]?.displayName, - ).toBe('Staff Model'); + ).toBe('Custom Model'); }); it('writes type-specific fields and validates max_output_size', () => { diff --git a/packages/kosong/CHANGELOG.md b/packages/kosong/CHANGELOG.md index 79f3c5df5..5abf017dc 100644 --- a/packages/kosong/CHANGELOG.md +++ b/packages/kosong/CHANGELOG.md @@ -4,7 +4,7 @@ ### Minor Changes -- [#232](https://github.com/MoonshotAI/kimi-code/pull/232) [`a24bfb1`](https://github.com/MoonshotAI/kimi-code/commit/a24bfb1df38e58120827a1d8ed881724af2e7b23) - Add `KIMI_MODEL_ADAPTIVE_THINKING` (and a matching `adaptive_thinking` model-alias field) to force adaptive thinking (`thinking: { type: 'adaptive' }`) on or off, overriding the Anthropic model-name version inference. This lets custom-named staff endpoints that back an adaptive-capable model opt in even when the model name does not encode a parseable Claude version. +- [#232](https://github.com/MoonshotAI/kimi-code/pull/232) [`a24bfb1`](https://github.com/MoonshotAI/kimi-code/commit/a24bfb1df38e58120827a1d8ed881724af2e7b23) - Add `KIMI_MODEL_ADAPTIVE_THINKING` (and a matching `adaptive_thinking` model-alias field) to force adaptive thinking (`thinking: { type: 'adaptive' }`) on or off, overriding the Anthropic model-name version inference. This lets custom-named compatible endpoints that back an adaptive-capable model opt in even when the model name does not encode a parseable Claude version. ### Patch Changes