@redaksjon/protokoll 1.0.12 → 1.0.13

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.
Files changed (36) hide show
  1. package/dist/{index2.js → configDiscovery.js} +909 -3382
  2. package/dist/configDiscovery.js.map +1 -0
  3. package/dist/index.js +3 -31
  4. package/dist/index.js.map +1 -1
  5. package/dist/mcp/server-http.js +84 -45
  6. package/dist/mcp/server-http.js.map +1 -1
  7. package/dist/mcp/server.js +10 -16
  8. package/dist/mcp/server.js.map +1 -1
  9. package/docs/CHANGES_CURSOR_INTEGRATION.md +166 -0
  10. package/docs/CURSOR_INTEGRATION.md +234 -0
  11. package/docs/MCP_SERVER_MODES.md +146 -0
  12. package/docs/QUICK_REFERENCE_AI_ASSISTANTS.md +81 -0
  13. package/package.json +5 -3
  14. package/vite.config.ts +6 -5
  15. package/vitest.config.ts +7 -24
  16. package/BUG_FIX_CONTEXT_DIRECTORY.md +0 -147
  17. package/MIGRATION_2025_SUMMARY.md +0 -215
  18. package/TRANSCRIPT_DATE_CHANGE_IMPLEMENTATION.md +0 -192
  19. package/VALIDATION_TEST_COVERAGE.md +0 -165
  20. package/dist/feedback.js +0 -1999
  21. package/dist/feedback.js.map +0 -1
  22. package/dist/frontmatter.js +0 -517
  23. package/dist/frontmatter.js.map +0 -1
  24. package/dist/index2.js.map +0 -1
  25. package/dist/scripts/fix-duplicate-delimiters.js +0 -78
  26. package/dist/scripts/fix-duplicate-delimiters.js.map +0 -1
  27. package/dist/scripts/migrate-titles-to-frontmatter.js +0 -88
  28. package/dist/scripts/migrate-titles-to-frontmatter.js.map +0 -1
  29. package/dist/scripts/migrate-transcripts-2025.js +0 -276
  30. package/dist/scripts/migrate-transcripts-2025.js.map +0 -1
  31. package/dist/scripts/verify-migration-2025.js +0 -122
  32. package/dist/scripts/verify-migration-2025.js.map +0 -1
  33. package/scripts/fix-duplicate-delimiters.ts +0 -112
  34. package/scripts/migrate-titles-to-frontmatter.ts +0 -129
  35. package/scripts/migrate-transcripts-2025.ts +0 -415
  36. package/scripts/verify-migration-2025.ts +0 -158
@@ -0,0 +1,146 @@
1
+ # MCP Server Modes: Local vs Remote
2
+
3
+ Protokoll's MCP server can operate in two distinct modes that affect how directory parameters are handled.
4
+
5
+ ## Server Modes
6
+
7
+ ### Remote Mode
8
+
9
+ **When:** HTTP server (`protokoll-mcp-http`) with pre-configured workspace
10
+
11
+ **Characteristics:**
12
+ - Server is initialized with a workspace root and `protokoll-config.yaml`
13
+ - All directory paths (`inputDirectory`, `outputDirectory`, `contextDirectories`) are pre-configured
14
+ - Tools **DO NOT** accept `contextDirectory` parameters
15
+ - Attempting to provide directory parameters will result in an error
16
+
17
+ **Use Case:** Production deployments where the server manages a specific workspace
18
+
19
+ **Example:**
20
+ ```bash
21
+ # Server starts with workspace at /path/to/workspace
22
+ PORT=4000 protokoll-mcp-http
23
+
24
+ # Tools use pre-configured directories automatically
25
+ # No contextDirectory parameter needed or accepted
26
+ ```
27
+
28
+ ### Local Mode
29
+
30
+ **When:** stdio server (`protokoll-mcp`) or dynamic discovery
31
+
32
+ **Characteristics:**
33
+ - Server performs dynamic configuration discovery
34
+ - Tools **MAY** accept optional `contextDirectory` parameters
35
+ - If no directory is provided, falls back to current working directory or discovery
36
+
37
+ **Use Case:** Development, CLI usage, or environments without fixed workspace
38
+
39
+ **Example:**
40
+ ```bash
41
+ # Server runs without pre-configured workspace
42
+ protokoll-mcp
43
+
44
+ # Tools can optionally specify contextDirectory
45
+ # Falls back to discovery if not provided
46
+ ```
47
+
48
+ ## Checking Server Mode
49
+
50
+ Use the `protokoll_info` tool to determine the server's mode:
51
+
52
+ ```json
53
+ {
54
+ "mode": "remote",
55
+ "modeDescription": "Server is running in remote mode with pre-configured workspace directories",
56
+ "acceptsDirectoryParameters": false,
57
+ "workspaceRoot": "/path/to/workspace",
58
+ "inputDirectory": "/path/to/workspace/recordings",
59
+ "outputDirectory": "/path/to/workspace/notes",
60
+ "contextDirectories": ["/path/to/workspace/context"]
61
+ }
62
+ ```
63
+
64
+ ## Tool Behavior
65
+
66
+ ### In Remote Mode
67
+
68
+ All tools that would normally accept `contextDirectory` will:
69
+ 1. Use the pre-configured workspace directories
70
+ 2. Reject any `contextDirectory` parameter with an error message
71
+ 3. Direct users to check `protokoll_info` for configuration
72
+
73
+ **Error Example:**
74
+ ```
75
+ Error: contextDirectory parameter is not accepted in remote mode.
76
+ This server is pre-configured with workspace directories from protokoll-config.yaml.
77
+ Use the protokoll_info tool to check server configuration.
78
+ ```
79
+
80
+ ### In Local Mode
81
+
82
+ Tools accept optional `contextDirectory` parameters:
83
+ - If provided: Use the specified directory
84
+ - If not provided: Fall back to discovery or current working directory
85
+
86
+ ## Implementation Details
87
+
88
+ ### Server Initialization
89
+
90
+ **HTTP Server (Remote Mode):**
91
+ ```typescript
92
+ await ServerConfig.initializeServerConfig(initialRoots, 'remote');
93
+ ```
94
+
95
+ **stdio Server (Local Mode):**
96
+ ```typescript
97
+ await ServerConfig.initializeServerConfig(initialRoots, 'local');
98
+ // or defaults to 'local' if not specified
99
+ ```
100
+
101
+ ### Tool Validation
102
+
103
+ Tools validate the mode before processing:
104
+
105
+ ```typescript
106
+ // In remote mode, this throws an error if contextDirectory is provided
107
+ await validateNotRemoteMode(args.contextDirectory);
108
+ ```
109
+
110
+ ### Context Instance Resolution
111
+
112
+ The `getContextInstance` helper prioritizes server context:
113
+
114
+ ```typescript
115
+ async function getContextInstance(contextDirectory?: string): Promise<ContextInstance> {
116
+ // Validate remote mode
117
+ if (contextDirectory && ServerConfig.isRemoteMode()) {
118
+ throw new Error('contextDirectory not accepted in remote mode');
119
+ }
120
+
121
+ // Use server context if available
122
+ const serverContext = ServerConfig.getContext();
123
+ if (serverContext) {
124
+ return serverContext;
125
+ }
126
+
127
+ // Fallback to new context (local mode)
128
+ return Context.create({
129
+ startingDir: contextDirectory || process.cwd(),
130
+ });
131
+ }
132
+ ```
133
+
134
+ ## Best Practices
135
+
136
+ 1. **Always check `protokoll_info` first** when connecting to a new server
137
+ 2. **In remote mode:** Don't provide directory parameters
138
+ 3. **In local mode:** Provide directory parameters only when needed
139
+ 4. **Error handling:** Catch and display mode-related errors to users clearly
140
+
141
+ ## Migration Notes
142
+
143
+ Existing tools continue to work:
144
+ - Remote mode servers ignore the `contextDirectory` parameter (with error)
145
+ - Local mode servers accept it as optional (backwards compatible)
146
+ - The `protokoll_info` tool provides clear guidance to clients
@@ -0,0 +1,81 @@
1
+ # Quick Reference for AI Assistants
2
+
3
+ ## 🚨 CRITICAL: Read This First
4
+
5
+ When working with Protokoll transcripts, you MUST use Protokoll MCP tools, NOT direct file editing tools.
6
+
7
+ ## ✅ DO Use These Tools
8
+
9
+ | Operation | Correct Tool | URI/Resource |
10
+ |-----------|-------------|--------------|
11
+ | Read transcript | `protokoll_read_transcript` | `protokoll://transcript/{path}` |
12
+ | List transcripts | `protokoll_list_transcripts` | `protokoll://transcripts/list` |
13
+ | Edit content | `protokoll_provide_feedback` | - |
14
+ | Change title | `protokoll_edit_transcript` (with `title` param) | - |
15
+ | Update metadata | `protokoll_edit_transcript` (title/project/tags/status) | - |
16
+ | Change date | `protokoll_change_transcript_date` | - |
17
+ | Create transcript | `protokoll_create_note` | - |
18
+ | Combine transcripts | `protokoll_combine_transcripts` | - |
19
+
20
+ ## ❌ DO NOT Use These Tools on Transcripts
21
+
22
+ - ❌ Read
23
+ - ❌ Write
24
+ - ❌ StrReplace
25
+ - ❌ Glob
26
+ - ❌ Grep
27
+
28
+ ## 📖 Get Detailed Instructions
29
+
30
+ Invoke the `how_to_use_protokoll` prompt for comprehensive guidance:
31
+
32
+ ```
33
+ Prompt: how_to_use_protokoll
34
+ Arguments: (none)
35
+ ```
36
+
37
+ ## 🔍 Common Scenarios
38
+
39
+ ### User asks to read a transcript
40
+ ```
41
+ ✅ Use: protokoll_read_transcript
42
+ ❌ Don't: Read tool on file path
43
+ ```
44
+
45
+ ### User asks to change title
46
+ ```
47
+ ✅ Use: protokoll_edit_transcript with title parameter
48
+ ❌ Don't: StrReplace on file
49
+ ```
50
+
51
+ ### User asks to fix names/terms
52
+ ```
53
+ ✅ Use: protokoll_provide_feedback with natural language corrections
54
+ ❌ Don't: StrReplace for each fix
55
+ ```
56
+
57
+ ### User asks to update metadata (project, tags, status)
58
+ ```
59
+ ✅ Use: protokoll_edit_transcript with appropriate parameters
60
+ ❌ Don't: Write to rewrite file
61
+ ```
62
+
63
+ ## 🎯 Why This Matters
64
+
65
+ Using Protokoll tools ensures:
66
+ - ✅ Proper validation and formatting
67
+ - ✅ Metadata consistency
68
+ - ✅ File naming conventions
69
+ - ✅ Resource change notifications
70
+ - ✅ Context integration
71
+
72
+ ## 🆘 If You're Unsure
73
+
74
+ 1. Invoke `how_to_use_protokoll` prompt
75
+ 2. Check tool descriptions with `tools/list`
76
+ 3. Ask the user for clarification
77
+ 4. When in doubt, use Protokoll tools!
78
+
79
+ ## 📚 More Information
80
+
81
+ See `docs/CURSOR_INTEGRATION.md` for complete documentation.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redaksjon/protokoll",
3
- "version": "1.0.12",
3
+ "version": "1.0.13",
4
4
  "description": "Focused audio transcription with intelligent context integration",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -56,7 +56,9 @@
56
56
  "@google/generative-ai": "^0.24.1",
57
57
  "@kjerneverk/riotprompt": "^1.0.6",
58
58
  "@modelcontextprotocol/sdk": "^1.25.2",
59
- "@redaksjon/context": "^0.0.6",
59
+ "@redaksjon/context": "^0.0.7",
60
+ "@redaksjon/protokoll-engine": "^0.1.3",
61
+ "@redaksjon/protokoll-format": "^0.1.1",
60
62
  "@types/fluent-ffmpeg": "^2.1.28",
61
63
  "@utilarium/cardigantime": "^0.0.24",
62
64
  "@utilarium/dreadcabinet": "^0.0.16",
@@ -70,7 +72,7 @@
70
72
  "js-yaml": "^4.1.1",
71
73
  "luxon": "^3.7.2",
72
74
  "moment-timezone": "^0.6.0",
73
- "openai": "^6.9.0",
75
+ "openai": "^6.22.0",
74
76
  "winston": "^3.18.3",
75
77
  "zod": "^4.3.6"
76
78
  },
package/vite.config.ts CHANGED
@@ -62,14 +62,19 @@ export default defineConfig({
62
62
  '@modelcontextprotocol/sdk/server/stdio.js',
63
63
  '@modelcontextprotocol/sdk/types.js',
64
64
  '@kjerneverk/riotprompt',
65
+ '@redaksjon/context',
66
+ '@redaksjon/protokoll-format',
65
67
  '@utilarium/cardigantime',
66
68
  '@utilarium/dreadcabinet',
69
+ '@utilarium/overcontext',
67
70
  '@types/fluent-ffmpeg',
71
+ // Native modules - must not be bundled
72
+ 'better-sqlite3',
68
73
  'dayjs',
69
74
  'dotenv',
70
75
  'fluent-ffmpeg',
71
76
  'glob',
72
- 'gray-matter',
77
+ 'html-to-text',
73
78
  'js-yaml',
74
79
  'luxon',
75
80
  'moment-timezone',
@@ -83,10 +88,6 @@ export default defineConfig({
83
88
  index: 'src/index.ts',
84
89
  'mcp/server': 'src/mcp/server.ts',
85
90
  'mcp/server-http': 'src/mcp/server-http.ts',
86
- 'scripts/fix-duplicate-delimiters': 'scripts/fix-duplicate-delimiters.ts',
87
- 'scripts/migrate-titles-to-frontmatter': 'scripts/migrate-titles-to-frontmatter.ts',
88
- 'scripts/migrate-transcripts-2025': 'scripts/migrate-transcripts-2025.ts',
89
- 'scripts/verify-migration-2025': 'scripts/verify-migration-2025.ts',
90
91
  },
91
92
  output: {
92
93
  format: 'esm',
package/vitest.config.ts CHANGED
@@ -32,32 +32,15 @@ export default defineConfig({
32
32
  'node_modules/**/*',
33
33
  'tests/**/*',
34
34
  'src/**/*.md',
35
- 'src/**/.DS_Store',
36
- // API-dependent modules excluded from coverage
37
- 'src/transcription/service.ts',
38
- 'src/transcription/index.ts',
39
- 'src/reasoning/client.ts',
40
- 'src/reasoning/index.ts',
41
- 'src/reasoning/strategy.ts',
42
- 'src/agentic/executor.ts',
43
- 'src/agentic/index.ts',
44
- // Integration modules - tested via integration tests
45
- 'src/output/manager.ts',
46
- 'src/output/index.ts',
47
- 'src/reflection/collector.ts',
48
- 'src/reflection/reporter.ts',
49
- 'src/reflection/index.ts',
50
- 'src/pipeline/orchestrator.ts',
51
- 'src/pipeline/index.ts',
52
- // Interactive CLI modules - require TTY interaction
53
- 'src/cli/context.ts',
54
- 'src/cli/index.ts',
35
+ 'src/**/.DS_Store',
36
+ // Most logic moved to @redaksjon/protokoll-engine
37
+ // Only MCP server shell remains
55
38
  ],
56
39
  thresholds: {
57
- lines: 60,
58
- statements: 60,
59
- branches: 50,
60
- functions: 60,
40
+ lines: 35,
41
+ statements: 35,
42
+ branches: 30,
43
+ functions: 40,
61
44
  },
62
45
  },
63
46
  },
@@ -1,147 +0,0 @@
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
@@ -1,215 +0,0 @@
1
- # 2025 Transcript Migration Summary
2
-
3
- ## Overview
4
-
5
- Successfully migrated all 233 transcript files in `/Users/tobrien/gitw/tobrien/activity/notes/2025` from the old format (with `## Metadata` and `## Entity References` sections in the body) to the new YAML frontmatter format.
6
-
7
- ## Migration Date
8
-
9
- February 7, 2026
10
-
11
- ## Results
12
-
13
- - **Total files found**: 233
14
- - **Successfully migrated**: 226
15
- - **Already in new format**: 7
16
- - **Errors**: 0
17
- - **Verification**: ✅ All 233 files verified as properly migrated
18
-
19
- ## What Changed
20
-
21
- ### Old Format
22
-
23
- ```markdown
24
- # Title of Transcript
25
-
26
- ## Metadata
27
-
28
- **Date**: December 22, 2025
29
- **Time**: 01:55 PM
30
-
31
- **Project**: ProjectName
32
- **Project ID**: `project-id`
33
-
34
- **Tags**: `tag1`, `tag2`
35
-
36
- ### Routing
37
-
38
- **Destination**: ./activity/notes
39
- **Confidence**: 85.0%
40
-
41
- ---
42
-
43
- Transcript content here...
44
-
45
- ---
46
-
47
- ## Entity References
48
-
49
- ### Projects
50
-
51
- - `project-id`: Project Name
52
-
53
- ### People
54
-
55
- - `person-id`: Person Name
56
- ```
57
-
58
- ### New Format
59
-
60
- ```markdown
61
- ---
62
- title: Title of Transcript
63
- date: '2025-12-22T00:00:00.000Z'
64
- recordingTime: '01:55 PM'
65
- project: ProjectName
66
- projectId: project-id
67
- tags:
68
- - tag1
69
- - tag2
70
- routing:
71
- destination: ./activity/notes
72
- confidence: 0.85
73
- signals: []
74
- reasoning: ''
75
- status: reviewed
76
- entities:
77
- people:
78
- - id: person-id
79
- name: Person Name
80
- type: person
81
- projects:
82
- - id: project-id
83
- name: Project Name
84
- type: project
85
- terms: []
86
- companies: []
87
- ---
88
- Transcript content here...
89
- ```
90
-
91
- ## Key Improvements
92
-
93
- 1. **All metadata in frontmatter**: Machine-readable YAML frontmatter instead of markdown sections
94
- 2. **No duplicate titles**: Title only appears in frontmatter, not as H1 in body
95
- 3. **Clean body content**: No more `## Metadata` or `## Entity References` sections
96
- 4. **Consistent format**: All files now use the same structure
97
- 5. **Lifecycle support**: Default `status: reviewed` and empty `history` and `tasks` arrays
98
-
99
- ## Migration Process
100
-
101
- ### 1. Enhanced Frontmatter Parser
102
-
103
- Updated `/Users/tobrien/gitw/redaksjon/protokoll/src/util/frontmatter.ts` to:
104
- - Parse old `## Metadata` sections and extract all fields
105
- - Parse old `## Entity References` sections
106
- - Strip legacy sections from body
107
- - Merge old and new metadata correctly
108
-
109
- ### 2. Created Migration Script
110
-
111
- `/Users/tobrien/gitw/redaksjon/protokoll/scripts/migrate-transcripts-2025.ts`:
112
- - Scans all markdown files recursively
113
- - Detects files in old format
114
- - Converts to new format
115
- - Verifies conversion success
116
- - Provides detailed progress and summary
117
-
118
- ### 3. Created Verification Script
119
-
120
- `/Users/tobrien/gitw/redaksjon/protokoll/scripts/verify-migration-2025.ts`:
121
- - Verifies all files are in new format
122
- - Checks for legacy sections
123
- - Ensures frontmatter is present
124
- - Validates no duplicate titles
125
-
126
- ### 4. Added Tests
127
-
128
- `/Users/tobrien/gitw/redaksjon/protokoll/tests/scripts/migrate-transcripts-2025.test.ts`:
129
- - 19 comprehensive tests
130
- - Tests old format detection
131
- - Tests metadata extraction
132
- - Tests content cleaning
133
- - Tests round-trip conversion
134
- - Tests edge cases
135
-
136
- ## NPM Scripts
137
-
138
- Added the following scripts to `package.json`:
139
-
140
- ```json
141
- {
142
- "migrate:2025": "npm run build && node dist/scripts/migrate-transcripts-2025.js",
143
- "migrate:2025:dry-run": "npm run build && node dist/scripts/migrate-transcripts-2025.js --dry-run",
144
- "migrate:2025:test": "npm run build && node dist/scripts/migrate-transcripts-2025.js --dry-run --limit 10 --verbose",
145
- "migrate:2025:verify": "npm run build && node dist/scripts/verify-migration-2025.js"
146
- }
147
- ```
148
-
149
- ## Usage
150
-
151
- ### Run Migration
152
-
153
- ```bash
154
- npm run migrate:2025
155
- ```
156
-
157
- ### Dry Run (Preview Changes)
158
-
159
- ```bash
160
- npm run migrate:2025:dry-run
161
- ```
162
-
163
- ### Test on First 10 Files
164
-
165
- ```bash
166
- npm run migrate:2025:test
167
- ```
168
-
169
- ### Verify Migration
170
-
171
- ```bash
172
- npm run migrate:2025:verify
173
- ```
174
-
175
- ## Verification Results
176
-
177
- All 233 files passed verification:
178
- - ✅ All files have YAML frontmatter
179
- - ✅ No files have `## Metadata` sections
180
- - ✅ No files have `## Entity References` sections
181
- - ✅ No duplicate titles in body
182
- - ✅ All metadata preserved correctly
183
-
184
- ## Files Modified
185
-
186
- ### Core Code
187
-
188
- - `src/util/frontmatter.ts` - Enhanced to parse old format
189
- - `src/util/metadata.ts` - Removed debug logging
190
-
191
- ### Scripts
192
-
193
- - `scripts/migrate-transcripts-2025.ts` - Migration script
194
- - `scripts/verify-migration-2025.ts` - Verification script
195
-
196
- ### Tests
197
-
198
- - `tests/scripts/migrate-transcripts-2025.test.ts` - Comprehensive test suite
199
-
200
- ### Configuration
201
-
202
- - `package.json` - Added migration scripts
203
- - `vite.config.ts` - Added script builds
204
-
205
- ## Notes
206
-
207
- - The migration is **idempotent** - running it multiple times is safe
208
- - Files already in the new format are skipped
209
- - The migration preserves all metadata and content
210
- - Body content is cleaned of legacy sections
211
- - Lifecycle defaults are applied (`status: reviewed`, empty `history` and `tasks`)
212
-
213
- ## Next Steps
214
-
215
- The migration is complete and verified. All 233 transcript files are now in the new YAML frontmatter format and ready to use with the updated Protokoll tools.