Commit Graph

55 Commits

Author SHA1 Message Date
Alex Alecu 6fadd9de99 fix(cli): user denies override MCP ask rules
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.
2026-03-30 15:31:47 +03:00
Alex Alecu a68cf47dac fix(cli): remove find from Ask allowlist, add git write denials
find has -exec/-execdir/-delete flags that execute arbitrary commands
or delete files, bypassing the prefix-based permission check. Also add
missing git write subcommand denials: config, clone, pull, init,
worktree, submodule, revert, bisect, filter-branch, fetch, restore.
2026-03-30 15:21:55 +03:00
Alex Alecu e64aba0b23 test(cli): add Ask agent permission tests
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.
2026-03-30 15:06:36 +03:00
Alex Alecu a84edc3267 test(cli): add failing test for empty tool-calls loop (#7756)
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).
2026-03-27 11:59:55 +02:00
Evgeny Shurakov b63a9393dc Merge pull request #7689 from Kilo-Org/eshurakov/retry-limit
Cli - Add configurable session retry limit
2026-03-26 15:23:59 +01:00
Evgeny Shurakov b7fdbe63ea fix(cli): use load-time constant for KILO_SESSION_RETRY_LIMIT 2026-03-26 14:54:27 +01:00
Marius 79d2567e6c fix(cli): hide commit-message git windows on Windows (#7692)
Prevent cmd.exe flashes when commit message generation shells out to git on Windows and add a regression test for the subprocess flags.
2026-03-26 13:59:04 +01:00
Evgeny Shurakov 435d82ca08 fix(cli): add configurable session retry limit 2026-03-26 12:54:28 +01:00
Marian Alexandru Alecu f0892bfe37 Merge pull request #7151 from shssoichiro/issue-6906
fix(cli): use configured Code model when implementing a plan
2026-03-25 17:30:19 +02:00
Imanol Maiztegui 64442519b4 Improved subagent permissions handling (#7348)
* feat(vscode): handle subagent permissions

* fix(vscode): formatting

* fix(permission): preserve original ruleset in pending requests for drainCovered evaluation

* style(permission): shorten inline comments on kilocode_change markers

* refactor(permission): extract drainCovered into dedicated module
2026-03-20 18:08:11 +01:00
Josh Holmer b74d4b4481 fix(cli): improve agent handling 2026-03-19 10:47:05 -04:00
Josh Holmer 040284034a fix(cli): preserve selected variant as well 2026-03-19 10:44:56 -04:00
Josh Holmer 1fc0e644dd fix(cli): use configured Code model when implementing a plan 2026-03-19 10:44:56 -04:00
Alex Alecu 773212863c fix(cli): delay paste summary 2026-03-18 16:09:37 +02:00
Imanol Maiztegui 0484318191 Granular bash permission rules (#7091)
* 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
2026-03-16 17:43:16 +01:00
marius-kiloclaw 7473015ef9 fix(mcp-migrator): handle malformed JSON in legacy .kilocode/mcp.json (#7012)
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>
2026-03-13 13:26:37 +01:00
Marius 466644eb25 fix: use .kilo instead of .kilocode for config directories (#6881)
* 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
2026-03-12 12:50:28 +01:00
Imanol Maiztegui 60a7c7a9fd fix: run script/format.ts 2026-03-12 12:06:20 +01:00
Marius 2bca0ac9f1 feat(agent-manager): lazy-load worktree diff details (#6945)
* feat(agent-manager): lazy-load worktree diff details

* fix(agent-manager): remove unused diff helper

* fix(agent-manager): preserve summary diff accuracy

* fix(agent-manager): avoid stale diff summary targets

* perf(agent-manager): avoid rescanning diff details
2026-03-12 11:43:38 +01:00
Catriel Müller d5de298cb8 fix: permission config string to object update 2026-03-10 00:32:50 -03:00
Josh Holmer 73c0d924ed fix(cli): save and load per-agent model selection 2026-03-09 11:51:46 -04:00
Catriel Müller 3b535cf5aa feat: migrate .opencode project folder to .kilo 2026-03-09 11:19:57 -03:00
Imanol Maiztegui 2d5f8a256c fix: Moved kilocode specific code to kilocode folder 2026-03-06 21:15:18 +01:00
Imanol Maiztegui ac4cfd329b fix: Add unit test and review bot fixes 2026-03-05 13:21:00 +01:00
Mark IJbema ee8daf6907 Merge pull request #6599 from Kilo-Org/mark/remove-kilocode-change-markers
Remove kilocode_change markers from kilo-specific packages
2026-03-04 11:55:29 +01:00
Mark IJbema e97348d7aa Remove kilocode_change markers from kilo-specific packages
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.
2026-03-04 11:39:53 +01:00
kiloconnect[bot] cdac0d8dab feat(kilo-gateway): add KILOCODE_VERSION support to editor header
- 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
2026-03-03 15:18:42 +00:00
Mark IJbema 6f9a0f0c5a feat(vscode): Enhance Prompt — sparkle button to improve prompts before sending
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
2026-03-03 13:21:45 +01:00
Marian Alexandru Alecu d8ce43fcf8 Merge pull request #6240 from Kilo-Org/fix/fix-plan-mode-suggestions
fix(plan): Show implementation suggestions only when LLM has all the information
2026-02-25 12:18:04 +02:00
Marius 138f1bd95f feat(vscode): add diff viewer panel to Agent Manager (#6335)
* feat(vscode): add diff viewer panel to Agent Manager

* Update translations

* Fix comments
2026-02-25 10:16:14 +00:00
Alex Alecu 7143683e20 fix: Fix plan_exit call 2026-02-25 09:46:17 +02:00
Alex Alecu 0886ef8fa0 fix(plan): Show implementation suggestions only when LLM has all the information 2026-02-24 15:32:58 +02:00
Kevin van Dijk 7ac4e68dc8 Resolve merge conflicts 2026-02-23 13:54:54 +01:00
Alex Alecu e2c2de2447 feat(plan): display plan message as non-synthetic in new sessions 2026-02-20 14:19:18 +02:00
Alex Alecu d5bceac21e feat: Handover task list and compacted context to next session after planning 2026-02-20 12:28:21 +02:00
Alex Alecu 9a9d675ada test: add withInstance helper, use answer constants 2026-02-19 13:20:04 +02:00
Alex Alecu 294846f706 fix: Reject pending plan followup question on abort signal 2026-02-19 11:59:57 +02:00
Alex Alecu a5e6ceb76e feat: When starting a new session after planning, include a compact summary of what was explored and which files were read so the AI doesn't have to re-search the codebase. 2026-02-19 11:42:35 +02:00
Alex Alecu 2d46b17f6c feat: Add predefined suggestions after finishing the planning session to improve context management 2026-02-19 10:23:19 +02:00
Pedro Heyerdahl 0f139f3120 feat(usage): add feature attribution header to API requests
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
2026-02-18 15:49:22 -03:00
Marius 7163fbcee9 chore: update config schema URL from opencode.ai to app.kilo.ai (#267) 2026-02-13 16:01:33 +01:00
kiloconnect[bot] 3e3385fbb3 fix: support remote MCP server migration in mcp-migrator (#247)
* 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>
2026-02-12 08:19:44 +00:00
Catriel Müller 1eedad9213 Refactor publish workflow and environment variables (#261)
* 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
2026-02-12 09:00:51 +01:00
Marius 61df9982ee fix(mcp-migrator): use correct project-level filename mcp.json instead of mcp_settings.json (#230)
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.
2026-02-11 10:25:03 +00:00
John Fawcett 1762590ff4 feat(opencode): add project ID resolution and tracking
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.
2026-02-10 12:10:00 -06:00
Marius d173377a2b fix: use OAuth accountId for enterprise model list filtering (#193)
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.
2026-02-09 10:08:19 -05:00
Suresh Kumar Sivasankaran b7785ca296 Merge pull request #30 from Kilo-Org/kilocode-ignore-migration
feat(kilocode): add .kilocodeignore migration to permission rules
2026-01-27 15:02:45 +01:00
Marius Wichtner 67f6ae59fc feat(kilocode): add .kilocodeignore migration to permission rules 2026-01-27 13:54:16 +01:00
Suresh Sivasankaran 2c344678bc add skills discovery for the cli 2026-01-27 12:19:22 +01:00
Marius Wichtner 1835e45a57 Merge branch 'dev' into schaltwerk/kilocode-mcp-migration
Merged dev branch which includes:
- Workflows migration (Phase 3)
- Rules migration (Phase 2)

Combined with MCP migration (Phase 4) from this branch.

Resolved merge conflicts in:
- packages/opencode/src/config/config.ts - Combined all four migrators
- packages/opencode/src/kilocode/index.ts - Export all migrators
2026-01-26 18:44:39 +01:00