Commit Graph

3 Commits

Author SHA1 Message Date
Catriel Müller 528ec937ab refactor: fix home test config mocks 2026-04-14 03:06:12 -03: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
Suresh Sivasankaran 2c344678bc add skills discovery for the cli 2026-01-27 12:19:22 +01:00