Skip to content

fix(core): correct local folder docset initialization path - #25

Merged
mrsimpson merged 1 commit into
mainfrom
fix-local-path
Mar 4, 2026
Merged

mrsimpson merged 1 commit into
mainfrom
fix-local-path

Conversation

@mrsimpson

Copy link
Copy Markdown
Collaborator

Intent

Fix critical bug where local folder docsets could not be initialized correctly. The calculateLocalPath() function was returning the source path (e.g., ./docs) for local_folder type docsets instead of the standard docset directory (.knowledge/docsets/{id}). This caused the init command to use the source directory as the target, potentially deleting source files with --force and creating circular symlinks.

Key changes

  • calculateLocalPath() now consistently returns .knowledge/docsets/{id} for all source types including local_folder, matching behavior of git_repo and archive types
  • Local folder initialization now correctly creates symlinks in the docset directory pointing to source folders, preserving source files
  • Updated tests to expect the corrected behavior
  • Fixed invalid source type zip to archive in example config
  • Added local-docs docset as working example of local folder configuration

Dependencies and side effects

  • Existing local folder docsets will need to be re-initialized after this fix
  • The symlink structure changes from source-path-based to standard docset directory, ensuring consistency across all source types
  • MCP server path resolution for local folders remains compatible as it already uses the standard docset directory path

## Intent

Fix critical bug where local folder docsets could not be initialized correctly.
The `calculateLocalPath()` function was returning the source path (e.g., `./docs`)
for `local_folder` type docsets instead of the standard docset directory
(`.knowledge/docsets/{id}`). This caused the init command to use the source
directory as the target, potentially deleting source files with `--force` and
creating circular symlinks.

## Key changes

- `calculateLocalPath()` now consistently returns `.knowledge/docsets/{id}` for
  all source types including `local_folder`, matching behavior of `git_repo`
  and `archive` types
- Local folder initialization now correctly creates symlinks in the docset
  directory pointing to source folders, preserving source files
- Updated tests to expect the corrected behavior
- Fixed invalid source type `zip` to `archive` in example config
- Added `local-docs` docset as working example of local folder configuration

## Dependencies and side effects

- Existing local folder docsets will need to be re-initialized after this fix
- The symlink structure changes from source-path-based to standard docset
  directory, ensuring consistency across all source types
- MCP server path resolution for local folders remains compatible as it already
  uses the standard docset directory path
@mrsimpson
mrsimpson merged commit b98b0b7 into main Mar 4, 2026
1 check passed
@mrsimpson
mrsimpson deleted the fix-local-path branch March 4, 2026 12:43
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