Skip to content

Fix local folder inconsistencies - require initialization and use symlinked paths - #14

Merged
mrsimpson merged 2 commits into
mainfrom
claude/investigate-local-docs-016zGZKADXxc7HxR1v9TNnxq
Nov 29, 2025
Merged

mrsimpson merged 2 commits into
mainfrom
claude/investigate-local-docs-016zGZKADXxc7HxR1v9TNnxq

Conversation

@mrsimpson

Copy link
Copy Markdown
Collaborator

This commit addresses several inconsistencies in how local documentation folders
were handled compared to git repositories:

Changes:

  1. Init command now supports local folders

    • Creates symlinks in .knowledge/docsets/{id}/
    • Validates source paths exist
    • Creates .agentic-metadata.json for tracking
    • Counts files and stores metadata
  2. Server validates initialization for local folders

    • Checks for .agentic-metadata.json before allowing search
    • Returns consistent error messages for uninitialized docsets
    • Both local folders and git repos now require explicit init
  3. Server returns symlinked paths for local folders

    • Local folders now return .knowledge/docsets/{id}/ path
    • Agents no longer need to traverse up to project root
    • Consistent behavior between git repos and local folders
  4. Create command updated

    • Removed automatic symlink creation for local folders
    • Added helpful message to run init command
    • Consistent flow: create -> init -> search
  5. Core package exports createSymlinks

    • Exported from paths/symlinks.js for use in CLI

Result: Local folders now behave consistently with git repos - both
require initialization via 'agentic-knowledge init {docset_id}' before
they can be searched, and both return paths under .knowledge/docsets/.

…linked paths

This commit addresses several inconsistencies in how local documentation folders
were handled compared to git repositories:

Changes:
1. **Init command now supports local folders**
   - Creates symlinks in .knowledge/docsets/{id}/
   - Validates source paths exist
   - Creates .agentic-metadata.json for tracking
   - Counts files and stores metadata

2. **Server validates initialization for local folders**
   - Checks for .agentic-metadata.json before allowing search
   - Returns consistent error messages for uninitialized docsets
   - Both local folders and git repos now require explicit init

3. **Server returns symlinked paths for local folders**
   - Local folders now return .knowledge/docsets/{id}/ path
   - Agents no longer need to traverse up to project root
   - Consistent behavior between git repos and local folders

4. **Create command updated**
   - Removed automatic symlink creation for local folders
   - Added helpful message to run init command
   - Consistent flow: create -> init -> search

5. **Core package exports createSymlinks**
   - Exported from paths/symlinks.js for use in CLI

Result: Local folders now behave consistently with git repos - both
require initialization via 'agentic-knowledge init {docset_id}' before
they can be searched, and both return paths under .knowledge/docsets/.
Updated tests to reflect the new consistent behavior where local folders
require initialization and use symlinked paths.

Changes:
1. **CLI test (create-command.test.ts)**
   - Updated test name to reflect new behavior
   - Changed assertion to expect symlinks NOT created during create
   - Symlinks now only created during init command

2. **MCP Server test (web-sources.test.ts)**
   - Added initialization setup for local folder docsets in test
   - Creates symlinks and metadata files in beforeEach
   - Updated test expectations to expect symlinked paths
   - Local folders now return .knowledge/docsets/{id} paths

3. **E2E test setup (e2e-test-setup.ts)**
   - Added automatic initialization when creating test projects
   - Creates symlinks to source directories
   - Creates .agentic-metadata.json files
   - Simulates running 'agentic-knowledge init {docset-id}'

Result: All 181 tests passing (100% success rate)
@mrsimpson
mrsimpson merged commit 894acd3 into main Nov 29, 2025
1 check passed
@mrsimpson
mrsimpson deleted the claude/investigate-local-docs-016zGZKADXxc7HxR1v9TNnxq branch November 29, 2025 16:19
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.

2 participants