These instructions apply to the entire repository. This project is a deliberately small, dependency-free-at-runtime VS Code extension; prefer focused changes over new layers, frameworks, or abstractions.
- The extension opens a fresh side terminal and sends the user-configured Kimi command.
- The default command is
kimi; official updates usekimi upgrade. - The active editor's workspace is preferred, followed by the first open workspace.
- The launch command must come from user-level configuration only. Never consume workspace or workspace-folder values for executable commands.
- Terminal execution must remain blocked while
vscode.workspace.isTrustedis false, even when the command is invoked programmatically. - The runtime must remain transparent: no hidden child processes, installers, downloads, telemetry, terminal-output inspection, or credential handling.
- Do not change the existing design, icons, or media assets unless the task explicitly requests it. Never run
npm run generate:iconduring unrelated work.
src/extension.ts: VS Code integration, commands, trust check, and terminal creation.src/command-utils.ts: pure helpers; keep this module independent of the VS Code runtime where practical.test/command-utils.test.js: helper behavior and security-boundary tests.test/metadata.test.js: manifest, documentation, workflow, and package-contract tests.test/integration/: Extension Host smoke test.media/: Marketplace and toolbar artwork; preserve format, dimensions, transparency, and appearance.scripts/generate-icon.ps1: deterministic source ofmedia/icon.png; it reproduces the published 512x512 artwork byte for byte, so never edit one without the other.docs/SECURITY_REVIEW.md: dated security review with file-and-line citations; re-verify the citations when the referenced files move.out/,.vscode-test/,node_modules/, and*.vsix: generated or downloaded artifacts; do not commit them.
- Read the relevant source, tests, manifest, and documentation before editing.
- Check
git statusand preserve unrelated user changes in dirty worktrees. - Keep security and behavior invariants covered by targeted tests.
- Run the smallest relevant checks while iterating.
- Before handoff, run
npm run check,npm run check:security, andgit diff --check. - Inspect
npm run package:listwhen package contents change. Build a VSIX only when requested or when validating release behavior.
Use npm ci --ignore-scripts for a clean, reproducible install. Do not replace package-lock.json with another package-manager lockfile.
- Use strict TypeScript and the existing ESM-style source imports compiled with
NodeNext. - Keep runtime behavior in
extension.tsand reusable decision logic in pure, directly testable helpers. - Prefer VS Code APIs over Node filesystem, process, or shell APIs.
- Do not add production dependencies unless the functionality cannot reasonably be implemented with the VS Code or JavaScript standard APIs.
- Preserve LF endings, two-space indentation, single quotes, trailing commas, and semicolons. Biome is authoritative for source and test formatting.
- Avoid duplicated constants and command IDs; keep manifest contributions, implementation, tests, and documentation synchronized.
- Handle errors at the user boundary with actionable messages, without logging secrets or full sensitive paths.
- Treat any terminal command as code execution. Keep the Workspace Trust guard and the user-level-only configuration resolution together with regression tests.
- Never read executable commands from
.vscode/settings.json, workspace files, environment files, or repository content. - Do not add API keys, tokens, publisher credentials,
.envfiles, or real user paths. Use redacted examples only. - The launcher does not own Kimi authentication. Direct users to official Kimi login and configuration documentation.
- Keep GitHub workflow permissions minimal and pin actions to full commit SHAs with the release tag in a same-line comment.
pull_request_targetworkflows must never check out or execute pull-request code with write permissions.
- Add unit tests for helper edge cases and metadata tests for public contract changes.
- Keep
@types/vscodepinned to the minimum version declared byengines.vscode. - The integration runner accepts
VSCODE_TEST_VERSIONandVSCODE_TEST_USER_DATA_DIR. CI uses a short temporary profile path to stay within macOS Unix-socket limits and covers stable VS Code on Windows, Linux, and macOS plus the minimum supported VS Code on Linux. - Integration tests must restore exact global settings from
configuration.inspect(...).globalValue; never write a resolved workspace or default value back to global configuration. - Never weaken tests merely to make a change pass. Update brittle exact assertions only when the public contract intentionally changes.
- Update
README.mdfor requirements, settings, commands, environment behavior, build, or release changes. - Add user-visible changes to the
Unreleasedsection ofCHANGELOG.md. - For a release, keep versions synchronized in
package.json,package-lock.json,CITATION.cff, the README installation section, andtest/metadata.test.js; keep the real release date synchronized betweenCITATION.cffandCHANGELOG.md.npm version <x.y.z> --no-git-tag-versionis the supported way to update the manifest and the lockfile together. - A
v<version>tag triggers the GitHub release workflow. Do not create tags, push, publish, or upload Marketplace packages unless explicitly authorized. - The extension is published as
mikesoft.vscode-kimi-code-cli-launcheron the VS Code Marketplace and on Open VSX. Both registries are updated manually by the maintainer withvsce publishandovsx publish; the required tokens are deliberately absent from this repository, from the shell environment, and from GitHub Actions secrets, so no workflow or agent can publish. Never add them. mainis protected and requires one approving review. Land changes through a branch and a pull request; never self-approve or bypass the protection.- Maintain the unofficial-project and trademark disclaimer. Do not imply endorsement by Moonshot AI or Kimi.
- Confirm a dependency is used before adding it; prefer development-only tooling when runtime code does not need the package.
- Review direct and transitive changes in
package-lock.json, run the high-severity audit, and avoid forced major upgrades. - The absence of
.github/dependabot.ymlis intentional: periodic version-update PRs were disabled. Do not reintroduce them without maintainer approval; Dependabot security alerts are managed in repository settings.