Skip to content

fix(cli): config legacy key migration + watcher branch switch detection - #19

Merged
dvcdsys merged 1 commit into
mainfrom
fix/cix-cli-config-watcher-bugs
Mar 27, 2026
Merged

fix(cli): config legacy key migration + watcher branch switch detection#19
dvcdsys merged 1 commit into
mainfrom
fix/cix-cli-config-watcher-bugs

Conversation

@dvcdsys

@dvcdsys dvcdsys commented Mar 27, 2026

Copy link
Copy Markdown
Owner

Summary

  • Config legacy migration: ~/.cix/config.yaml written by the old viper-based CLI used keys like debouncems, cachettl, autowatch, excludepatterns — the new yaml.v3 code expected debounce_ms, cache_ttl, etc. so values silently fell back to defaults. Fix: normalize old keys on load and auto-save in new format (one-time migration).
  • config show readability: output reformatted as flat key = value pairs using the same key names as cix config set — easy to copy-paste.
  • Watcher branch switch: after git checkout, cix status showed unindexed files. Root cause: .git/ was fully excluded so .git/HEAD events were dropped. On macOS, FSEvents can coalesce rapid file changes (large checkout) into directory-level events which handleEvent skips — so the debounce timer never fired. Fix: allow .git/HEAD through isExcluded, detect it in handleEvent, cancel pending debounce and run immediate incremental reindex (indexer.Run(false) does a full hash-diff scan so all added/modified/deleted files are handled correctly).

Test plan

  • go test ./cli/internal/config/... — includes TestLoad_LegacyKeys (old viper format → correct values)
  • go test ./cli/internal/watcher/... — includes TestIsExcluded_GitHEAD, TestHandleEvent_GitHEADChange_TriggersReindex, TestHandleEvent_GitHEADChange_ClearsPendingChanges
  • cix config show — verify flat key=value format
  • cix watch --foreground, then git checkout other-branch — verify log shows "git branch switched, triggering reindex..."

🤖 Generated with Claude Code

…etection

- config: normalize viper-style keys (debouncems → debounce_ms, etc.) when
  loading ~/.cix/config.yaml written by old viper-based versions; auto-save in
  new format on first load so migration is one-time
- config show: reformat output as flat key=value pairs matching cix config set
  key names so values are easy to copy-paste
- watcher: detect git branch switches by watching .git/HEAD (excluded before);
  on HEAD change, cancel pending debounce and run immediate incremental reindex
  (indexer already does full hash-diff so no files are missed)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@dvcdsys
dvcdsys merged commit cd8168b into main Mar 27, 2026
7 checks passed
@dvcdsys
dvcdsys deleted the fix/cix-cli-config-watcher-bugs branch March 27, 2026 12:01
dvcdsys added a commit that referenced this pull request May 14, 2026
After the workspace_repos → git_repos + workspace_projects split,
docs and stale comments still referenced concepts that no longer
exist.

- workspaces.md + doc/WORKSPACES.md: rewrite lifecycle, REST API
  reference, webhook URL examples, and clone-dir paths to use
  projects.path_hash, /git-repos, /workspaces/{id}/projects, and
  /projects/{hash}/reindex.
- Both skills/cix-workspace/SKILL.md and
  plugins/cix/skills/cix-workspace/SKILL.md: replace
  /workspaces/{id}/repos/{repo_id}/reindex with
  /projects/{hash}/reindex. New plugins/cix/scripts/sync-skills.sh
  keeps the duplicate copies byte-identical going forward.
- Code comments updated across config.go, callgraph.go,
  repocloner.go, githubapi.go, workspaces.go, and
  AddExistingProjectDialog.tsx to point at gitrepos /
  workspace_projects / projects.path_hash instead of the dead
  workspacerepos.* names.

Resolves Fix #8, #9, #10, #19.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
dvcdsys added a commit that referenced this pull request May 14, 2026
After the workspace_repos → git_repos + workspace_projects split,
docs and stale comments still referenced concepts that no longer
exist.

- workspaces.md + doc/WORKSPACES.md: rewrite lifecycle, REST API
  reference, webhook URL examples, and clone-dir paths to use
  projects.path_hash, /git-repos, /workspaces/{id}/projects, and
  /projects/{hash}/reindex.
- Both skills/cix-workspace/SKILL.md and
  plugins/cix/skills/cix-workspace/SKILL.md: replace
  /workspaces/{id}/repos/{repo_id}/reindex with
  /projects/{hash}/reindex. New plugins/cix/scripts/sync-skills.sh
  keeps the duplicate copies byte-identical going forward.
- Code comments updated across config.go, callgraph.go,
  repocloner.go, githubapi.go, workspaces.go, and
  AddExistingProjectDialog.tsx to point at gitrepos /
  workspace_projects / projects.path_hash instead of the dead
  workspacerepos.* names.

Resolves Fix #8, #9, #10, #19.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant