Re-apply user deny rules after the ask-specific config so explicit
user denies for MCP servers are not overridden by the generated
mcpRules 'ask' defaults.
Verify readOnlyBash allowlist, git write denials, gh ask rules,
disabled() behavior for edit/task/bash tools, and dynamic MCP
permission generation with server name sanitization.
Reproduces the infinite loop when the model returns finish_reason: "tool-calls"
but emits zero actual tool call parts. Test 1 asserts the processor converts
finish to "stop" (currently fails). Test 2 verifies valid tool-calls flows
are preserved (passes).
* fix: renamed pattern arrays used for permission rules
* fix: rename savePatternRules to saveAlwaysRules
* feat: generate hierarchical always patterns in bash tool
* feat: validate saveAlwaysRules against always array only
* feat: pass always field through extension bridge to webview
* feat: show hierarchical always patterns in PermissionDock dropdown
* fix: rename pattern to rule in PermissionDock translations, styles, and data-slots
* fix(vscode): correct auto-run comment in PermissionDock
* feat(kilo-vscode): strip trailing wildcard from permission rule labels
* fix: deduplicate permission rules and strip wildcards from display labels
* refactor: move hierarchy to metadata.rules, restore always to arity prefix
* feat: pass always field to permission dock for non-bash tool rules
* fix: correct bash test assertion to check metadata.rules and fix indentation
* fix: hide permission rules dropdown for non-bash tools
* fix: align always-rules route descriptions, whitespace, and restore multi-command tests
readMcpSettings() called JSON.parse() without try/catch. In migrate(),
if .kilocode/mcp.json existed but contained malformed JSON, the uncaught
exception propagated out of the dual-read loop, preventing .kilo/mcp.json
from ever being read. The outer loadMcpConfig() catch returned {} instead
of the valid config — silently losing MCP server configuration.
Wrap the file read + parse in try/catch, log a warning, and return null
so the loop continues to the next config directory.
Regression tests added for both readMcpSettings (unit) and migrate
(integration) to prove the bug and verify the fix.
Refs: #6881
Co-authored-by: marius-kiloclaw <marius-kiloclaw@users.noreply.github.com>
* fix: use .kilo instead of .kilocode for config directories
* fix: keep global ~/.kilocode untouched for legacy CLI compat
Only rename project-level .kilocode/ to .kilo/. The global ~/.kilocode
directory must stay because legacy CLI instances and legacy-migration.ts
in kilo-gateway still read from it.
* test: update VS Code extension tests to use .kilo directory paths
* fix: correct paths.ts comment and use specific git exclude entries
- Fix comment referencing ~/.kilo when globalDir() returns ~/.kilocode
- Revert to specific .kilo/ git exclude entries instead of blanket .kilo/
to avoid hiding user-authored rules/workflows/config from git status
* fix: handle legacy per-worktree metadata and stale paths in state
- readMetadata() falls back to .kilocode/ inside worktrees since the
per-worktree metadata dirs aren't renamed by the top-level migration
- Rewrite stale .kilocode/ paths in agent-manager.json on load
* fix: run .kilocode migration at extension activation, not just Agent Manager
Move migration call to the top of activate() so it runs for all users
on every extension startup, before kilo serve is spawned or any code
reads from the .kilo directory.
* fix: update git worktree refs after .kilocode → .kilo rename
After renaming the directory, git's internal .git/worktrees/*/gitdir
files still reference the old .kilocode path. This causes git to lose
track of worktrees, leading to crashes. Both the CLI and extension
migration now rewrite these gitdir files after a successful rename.
* fix: read from both .kilo and .kilocode, write to .kilo
Replace the one-time directory rename migration with a dual-read strategy:
- CLI config (rules, workflows, skills, MCP, project-id): read from both
.kilo/ and .kilocode/ directories, with .kilo taking precedence
- Agent Manager data (worktrees, state, setup scripts): migrate from
.kilocode/ to .kilo/ at startup since the extension exclusively owns these
- Config discovery (paths.ts, config.ts): include .kilocode in directory
and agent/command pattern matching
Key decisions:
- .kilo/ is the new canonical write location for all new data
- .kilocode/ is read as a legacy fallback (no data loss for existing users)
- No directory rename: both dirs can coexist safely
- Agent Manager migration is item-level (moves individual files), not a
full directory rename, so it handles both-dirs-exist gracefully
- Windows path rewrite in WorktreeStateManager handles both / and \ separators
- Workflow/MCP load order: .kilocode first, .kilo second (last wins)
- Rules dedup via seen-set with .kilo checked first (first wins)
- Delete migrate-kilo-dir.ts (no longer needed)
* fix: resolve .git file when fixing worktree refs during migration
When the project root is itself a worktree, .git is a file pointing
at the shared git dir, not a directory. Follow the gitdir pointer to
find the actual .git/worktrees/ location.
* fix: recover partial .kilo migrations and global dirs
Always repair stale git worktree refs when .kilo worktrees already exist so partially migrated repos recover on startup. Also dual-read global skills, rules, and workflows from both legacy and new home directories.
* fix: keep .kilo ahead of legacy config dirs
* fix: narrow legacy agent manager excludes
* chore: link migration cleanup follow-up
These markers are only needed in shared upstream opencode files to prevent
merge conflicts. In kilo-specific packages (kilocode/, kilo-gateway/,
kilo-ui/, kilo-i18n/, kilo-vscode/, etc.) they serve no purpose.
- introduce ENV_VERSION constant in kilo-gateway and export it
- modify getEditorNameHeader to append version when provided
- export ENV_VERSION from gateway index for external use
- initialize ENV_VERSION from Installation.VERSION in opencode startup
- update tests to verify editor header with and without version
Add the Enhance Prompt feature to the VS Code extension, matching the
legacy extension's behaviour. A ✨ sparkle button in the chat input
toolbar rewrites the user's draft prompt using an LLM.
CLI:
- POST /enhance-prompt endpoint using LLM.stream with small model
- System prompt as agent.prompt for caching; user text as user message
- clean() strips code fences and surrounding quotes from LLM output
Extension:
- KiloProvider handler using SDK client.enhancePrompt.enhance()
- Shows VS Code error notification on failure
- WandSparkles icon from lucide-solid via @kilocode/kilo-ui
- Spin animation while enhancement is in flight
- Empty-input click shows feature description (all 16 i18n locales)
- Ctrl+Z / ⌘Z undo restores original draft
- Guard checks isBusy/isDisabled/enhancing matching canEnhance()
Tests:
- 11 unit tests for clean() in enhance-prompt.test.ts
Migration plan:
- Removed feature row (parity achieved)
- Deleted prompt-improvement.md spec doc
Introduce X-KILOCODE-FEATURE header for tracking request origin
across different entry points (CLI, VSCode extension, autocomplete).
- Add HEADER_FEATURE, DEFAULT_FEATURE, and ENV_FEATURE constants
- Add getFeatureHeader() helper reading from KILOCODE_FEATURE env var
- Include feature header in buildKiloHeaders() when env var is set
- Set feature to "autocomplete" for FIM/completion requests
- Set KILOCODE_FEATURE="vscode-extension" when spawning CLI from VSCode
- Default to "cli" feature in opencode entry point
- Add unit tests for feature header logic
* fix: support remote MCP server migration in mcp-migrator
The MCP migrator only handled stdio/local MCP servers. When a user
configured a remote streamable-http or sse MCP server in
.kilocode/mcp_settings.json, it failed with:
The "file" argument must be of type string. Received undefined
This happened because convertServer() always assumed local servers,
building a command array from server.command (which is undefined for
remote servers).
Changes:
- Add remote transport type detection (streamable-http, sse)
- Convert remote servers to Config.McpRemote (type: "remote")
- Pass through url and headers fields
- Make command optional in KilocodeMcpServer interface
- Add comprehensive tests for remote server migration
* fix: validate url/command before use in mcp-migrator
Add guard clauses for missing url on remote servers and missing command
on local servers instead of using non-null assertions that could crash
on malformed config files.
---------
Co-authored-by: Kilo Agent <agent@kilo.ai>
Co-authored-by: marius-kilocode <marius@kilocode.ai>
* feat: changelog generation
* refactor: rename all ENV variables to KILO prefix
* refactor: publish rework
* refactor: publish rework
* refactor: unify git commiter action
* refactor: add all kilobots to the team
The Kilocode extension stores project-level MCP settings in
.kilocode/mcp.json, but the migrator was looking for
.kilocode/mcp_settings.json (which is only used for global settings).
This meant local MCP servers were never picked up by the CLI.
refactor(opencode): improve project ID resolution and normalization
Implement logic to resolve a unique project identifier with priority given
to `.kilocode/config.json` and falling back to the git origin remote URL.
The resolved ID is normalized, cached per-instance, and sent as a header
to the Kilo Gateway provider to enable project-specific tracking.
Enterprise users logging in via OAuth had their organization ID stored
in auth.accountId but the model fetch code never read it, causing the
model list to be fetched from the personal endpoint instead of the
org-specific endpoint that applies the allow list.