@redaksjon/protokoll 1.0.2 → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/BUG_FIX_CONTEXT_DIRECTORY.md +147 -0
- package/README.md +4 -0
- package/dist/main.js +3 -3
- package/dist/main.js.map +1 -1
- package/dist/mcp/server.js +621 -186
- package/dist/mcp/server.js.map +1 -1
- package/dist/term-assist.js +1 -1
- package/dist/term-context.js +1 -1
- package/dist/transcript.js +137 -44
- package/dist/transcript.js.map +1 -1
- package/docs/MCP_OVERVIEW.md +475 -0
- package/docs/MCP_RESOURCES.md +301 -0
- package/docs/MCP_RESOURCES_IMPLEMENTATION.md +278 -0
- package/docs/MCP_RESOURCES_QUICK_START.md +280 -0
- package/docs/MCP_RESOURCES_REFACTOR.md +200 -0
- package/docs/MCP_SMART_TRANSCRIPT_LOOKUP.md +562 -0
- package/docs/MCP_WORKSPACE_CONFIG.md +355 -0
- package/guide/architecture.md +2 -2
- package/guide/development.md +2 -2
- package/package.json +6 -6
- package/vite.config.ts +2 -2
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
# Bug Fix: Context Directory Discovery Issue
|
|
2
|
+
|
|
3
|
+
## Problem
|
|
4
|
+
|
|
5
|
+
The Protokoll MCP tools were not finding context entities (projects, people, terms) even though they existed in the repository.
|
|
6
|
+
|
|
7
|
+
### Symptoms
|
|
8
|
+
|
|
9
|
+
- Context files exist in: `/path/to/repo/context/projects/*.yaml`
|
|
10
|
+
- `.protokoll/config.yaml` exists but has no `contextDirectory` setting
|
|
11
|
+
- MCP tools look for context in: `/path/to/repo/.protokoll/` (the config directory)
|
|
12
|
+
- Result: `protokoll_list_projects` returns 0 projects even though 11 project YAML files exist
|
|
13
|
+
|
|
14
|
+
### Expected Behavior
|
|
15
|
+
|
|
16
|
+
The context discovery should default to looking in `./context/` relative to the repository root, NOT in `.protokoll/context/`.
|
|
17
|
+
|
|
18
|
+
## Root Cause
|
|
19
|
+
|
|
20
|
+
The context discovery logic in both `src/context/discovery.ts` and `src/overcontext/discovery.ts` was hardcoded to look for context in `.protokoll/context/`, but the actual context structure is:
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
repo/
|
|
24
|
+
.protokoll/
|
|
25
|
+
config.yaml # Configuration file
|
|
26
|
+
context/ # Context entities (should be default)
|
|
27
|
+
projects/
|
|
28
|
+
people/
|
|
29
|
+
terms/
|
|
30
|
+
companies/
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Solution
|
|
34
|
+
|
|
35
|
+
Changed the default context discovery logic to:
|
|
36
|
+
|
|
37
|
+
1. **Priority 1**: Use explicit `contextDirectory` from `config.yaml` if specified
|
|
38
|
+
2. **Priority 2**: Look for `./context/` at repository root (sibling to `.protokoll/`)
|
|
39
|
+
3. **Priority 3**: Fall back to `.protokoll/context/` for backward compatibility
|
|
40
|
+
|
|
41
|
+
### Configuration Option
|
|
42
|
+
|
|
43
|
+
Added support for `contextDirectory` in `.protokoll/config.yaml`:
|
|
44
|
+
|
|
45
|
+
```yaml
|
|
46
|
+
# Use a custom context directory
|
|
47
|
+
contextDirectory: ./my-custom-context
|
|
48
|
+
|
|
49
|
+
# Or use an absolute path
|
|
50
|
+
contextDirectory: /absolute/path/to/context
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
If not specified, defaults to `./context/` at the repository root.
|
|
54
|
+
|
|
55
|
+
## Changes Made
|
|
56
|
+
|
|
57
|
+
### Files Modified
|
|
58
|
+
|
|
59
|
+
1. **src/context/discovery.ts**
|
|
60
|
+
- Added `resolveContextDirectory()` function to implement the new priority logic
|
|
61
|
+
- Updated `loadHierarchicalConfig()` to use the new resolution logic
|
|
62
|
+
|
|
63
|
+
2. **src/overcontext/discovery.ts**
|
|
64
|
+
- Added `resolveContextDirectory()` function (same implementation)
|
|
65
|
+
- Updated `loadHierarchicalConfig()` to use the new resolution logic
|
|
66
|
+
|
|
67
|
+
3. **src/overcontext/adapter.ts**
|
|
68
|
+
- Updated `load()` method to work with the new context directory resolution
|
|
69
|
+
- Fixed import to include `redaksjonPluralNames`
|
|
70
|
+
|
|
71
|
+
### Tests Added
|
|
72
|
+
|
|
73
|
+
1. **tests/context/discovery.test.ts**
|
|
74
|
+
- Added test: "should prefer ./context/ at repository root over .protokoll/context/"
|
|
75
|
+
- Added test: "should use explicit contextDirectory from config.yaml"
|
|
76
|
+
- Added test: "should handle absolute contextDirectory path in config.yaml"
|
|
77
|
+
- Added test: "should fall back to default when explicit contextDirectory does not exist"
|
|
78
|
+
- Added test: "should handle no context directory found"
|
|
79
|
+
|
|
80
|
+
2. **tests/context/bug-context-directory.test.ts** (new file)
|
|
81
|
+
- Comprehensive end-to-end tests for the bug fix
|
|
82
|
+
- Tests all three priority levels
|
|
83
|
+
- Tests backward compatibility
|
|
84
|
+
|
|
85
|
+
## Test Results
|
|
86
|
+
|
|
87
|
+
All tests passing:
|
|
88
|
+
- 19/19 tests in `tests/context/discovery.test.ts`
|
|
89
|
+
- 4/4 tests in `tests/context/bug-context-directory.test.ts`
|
|
90
|
+
- All existing tests continue to pass (no regressions)
|
|
91
|
+
|
|
92
|
+
## Backward Compatibility
|
|
93
|
+
|
|
94
|
+
The fix maintains full backward compatibility:
|
|
95
|
+
- Existing repositories with context in `.protokoll/context/` will continue to work
|
|
96
|
+
- No configuration changes required for existing setups
|
|
97
|
+
- New repositories can use the simpler `./context/` structure
|
|
98
|
+
|
|
99
|
+
## Migration Guide
|
|
100
|
+
|
|
101
|
+
### For New Repositories
|
|
102
|
+
|
|
103
|
+
Create context at the repository root:
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
mkdir -p context/{projects,people,terms,companies}
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### For Existing Repositories
|
|
110
|
+
|
|
111
|
+
Option 1: Move context to repository root (recommended):
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
mv .protokoll/context ./context
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Option 2: Keep existing structure (no changes needed):
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
# Context remains in .protokoll/context/
|
|
121
|
+
# Everything continues to work as before
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
Option 3: Use custom location:
|
|
125
|
+
|
|
126
|
+
```yaml
|
|
127
|
+
# .protokoll/config.yaml
|
|
128
|
+
contextDirectory: ./my-custom-location
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
## Verification
|
|
132
|
+
|
|
133
|
+
To verify the fix works:
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
# List projects (should now find entities in ./context/)
|
|
137
|
+
protokoll list-projects
|
|
138
|
+
|
|
139
|
+
# Or via MCP
|
|
140
|
+
protokoll_list_projects()
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
## Related Issues
|
|
144
|
+
|
|
145
|
+
- Fixes context discovery for MCP tools
|
|
146
|
+
- Improves developer experience by supporting standard repository structure
|
|
147
|
+
- Maintains backward compatibility with existing setups
|
package/README.md
CHANGED
package/dist/main.js
CHANGED
|
@@ -8,8 +8,8 @@ import utc from 'dayjs/plugin/utc.js';
|
|
|
8
8
|
import 'moment-timezone';
|
|
9
9
|
import * as path$1 from 'node:path';
|
|
10
10
|
import path__default from 'node:path';
|
|
11
|
-
import * as Dreadcabinet from '@
|
|
12
|
-
import * as Cardigantime from '@
|
|
11
|
+
import * as Dreadcabinet from '@utilarium/dreadcabinet';
|
|
12
|
+
import * as Cardigantime from '@utilarium/cardigantime';
|
|
13
13
|
import { z } from 'zod';
|
|
14
14
|
import { glob } from 'glob';
|
|
15
15
|
import * as readline from 'readline';
|
|
@@ -26,7 +26,7 @@ import 'node:fs';
|
|
|
26
26
|
import 'node:crypto';
|
|
27
27
|
import 'node:fs/promises';
|
|
28
28
|
import 'html-to-text';
|
|
29
|
-
import '@
|
|
29
|
+
import '@utilarium/overcontext';
|
|
30
30
|
import '@redaksjon/context';
|
|
31
31
|
import 'winston';
|
|
32
32
|
|