@velvetmonkey/vault-core 0.1.0 → 0.2.1
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/LICENSE +201 -235
- package/README.md +93 -24
- package/dist/entities.d.ts +15 -2
- package/dist/entities.d.ts.map +1 -1
- package/dist/entities.js +156 -16
- package/dist/entities.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +23 -5
- package/dist/types.d.ts.map +1 -1
- package/dist/wikilinks.d.ts +4 -4
- package/dist/wikilinks.d.ts.map +1 -1
- package/dist/wikilinks.js +151 -23
- package/dist/wikilinks.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,6 +1,44 @@
|
|
|
1
|
+
> **Part of the Flywheel Suite:** Shared foundation for vault operations. See [Flywheel](https://github.com/velvetmonkey/flywheel) for graph intelligence and [Flywheel-Crank](https://github.com/velvetmonkey/flywheel-crank) for safe mutations.
|
|
2
|
+
|
|
1
3
|
# @velvetmonkey/vault-core
|
|
2
4
|
|
|
3
|
-
Shared vault utilities for the Flywheel ecosystem.
|
|
5
|
+
Shared vault utilities for the Flywheel ecosystem.
|
|
6
|
+
|
|
7
|
+
[](https://www.npmjs.com/package/@velvetmonkey/vault-core)
|
|
8
|
+
[](https://www.apache.org/licenses/LICENSE-2.0)
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## Why This Exists
|
|
13
|
+
|
|
14
|
+
Flywheel and Flywheel-Crank both need to:
|
|
15
|
+
- Scan vaults for entity names (people, projects, technologies)
|
|
16
|
+
- Detect protected zones (code blocks, frontmatter, existing links)
|
|
17
|
+
- Apply wikilinks safely without corrupting content
|
|
18
|
+
|
|
19
|
+
Rather than duplicate this logic, vault-core provides the shared foundation.
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
┌─────────────────────────────────────────┐
|
|
23
|
+
│ Flywheel (read) │
|
|
24
|
+
│ 44 graph intelligence tools │
|
|
25
|
+
└──────────────────┬──────────────────────┘
|
|
26
|
+
│
|
|
27
|
+
▼
|
|
28
|
+
┌─────────────────────────────────────────┐
|
|
29
|
+
│ vault-core │
|
|
30
|
+
│ Entity scanning · Protected zones · │
|
|
31
|
+
│ Wikilink application │
|
|
32
|
+
└──────────────────┬──────────────────────┘
|
|
33
|
+
│
|
|
34
|
+
▼
|
|
35
|
+
┌─────────────────────────────────────────┐
|
|
36
|
+
│ Flywheel-Crank (write) │
|
|
37
|
+
│ 11 mutation tools │
|
|
38
|
+
└─────────────────────────────────────────┘
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
---
|
|
4
42
|
|
|
5
43
|
## Installation
|
|
6
44
|
|
|
@@ -8,9 +46,12 @@ Shared vault utilities for the Flywheel ecosystem. Used by both [Flywheel](https
|
|
|
8
46
|
npm install @velvetmonkey/vault-core
|
|
9
47
|
```
|
|
10
48
|
|
|
11
|
-
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## Modules
|
|
12
52
|
|
|
13
53
|
### Entity Scanning
|
|
54
|
+
|
|
14
55
|
Scan an Obsidian vault to build an index of entities (notes) organized by category.
|
|
15
56
|
|
|
16
57
|
```typescript
|
|
@@ -21,8 +62,11 @@ const entities = getAllEntities(index);
|
|
|
21
62
|
const nonPeriodic = filterPeriodicNotes(entities);
|
|
22
63
|
```
|
|
23
64
|
|
|
65
|
+
**Detected categories:** People (`team/`, `people/`), Projects (`projects/`, `systems/`), Decisions (`decisions/`, `adr/`), and more.
|
|
66
|
+
|
|
24
67
|
### Protected Zones
|
|
25
|
-
|
|
68
|
+
|
|
69
|
+
Detect regions in markdown that shouldn't be modified during wikilink insertion.
|
|
26
70
|
|
|
27
71
|
```typescript
|
|
28
72
|
import { getProtectedZones, isInProtectedZone } from '@velvetmonkey/vault-core';
|
|
@@ -31,7 +75,15 @@ const zones = getProtectedZones(markdownContent);
|
|
|
31
75
|
const safe = !isInProtectedZone(zones, cursorPosition);
|
|
32
76
|
```
|
|
33
77
|
|
|
78
|
+
**Protected zone types:**
|
|
79
|
+
- YAML frontmatter (`---` blocks)
|
|
80
|
+
- Code blocks (fenced and indented)
|
|
81
|
+
- Inline code (backticks)
|
|
82
|
+
- Existing wikilinks (`[[...]]`)
|
|
83
|
+
- URLs and markdown links
|
|
84
|
+
|
|
34
85
|
### Wikilinks
|
|
86
|
+
|
|
35
87
|
Apply or suggest wikilinks to entity names in markdown content.
|
|
36
88
|
|
|
37
89
|
```typescript
|
|
@@ -41,28 +93,45 @@ const suggestions = suggestWikilinks(content, entityIndex);
|
|
|
41
93
|
const linked = applyWikilinks(content, entityIndex, options);
|
|
42
94
|
```
|
|
43
95
|
|
|
44
|
-
|
|
96
|
+
Wikilinks are only applied in safe zones—never inside code, frontmatter, or existing links.
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
## API Reference
|
|
45
101
|
|
|
46
102
|
### Types
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
103
|
+
|
|
104
|
+
| Type | Description |
|
|
105
|
+
|------|-------------|
|
|
106
|
+
| `EntityIndex` | Map of category to entity names |
|
|
107
|
+
| `EntityCategory` | Entity category identifier |
|
|
108
|
+
| `ProtectedZone` | Region that shouldn't be modified |
|
|
109
|
+
| `ScanOptions` | Options for vault scanning |
|
|
110
|
+
| `WikilinkOptions` | Options for wikilink application |
|
|
111
|
+
| `WikilinkResult` | Result of wikilink suggestion |
|
|
53
112
|
|
|
54
113
|
### Functions
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
114
|
+
|
|
115
|
+
| Function | Description |
|
|
116
|
+
|----------|-------------|
|
|
117
|
+
| `scanVaultEntities(path, options)` | Scan vault for entities |
|
|
118
|
+
| `getAllEntities(index)` | Get flat list of all entities |
|
|
119
|
+
| `filterPeriodicNotes(entities)` | Remove daily/weekly/etc notes |
|
|
120
|
+
| `loadEntityCache(path)` / `saveEntityCache(path, index)` | Cache management |
|
|
121
|
+
| `getProtectedZones(content)` | Find protected regions |
|
|
122
|
+
| `isInProtectedZone(zones, position)` | Check if position is protected |
|
|
123
|
+
| `rangeOverlapsProtectedZone(zones, start, end)` | Check range overlap |
|
|
124
|
+
| `findFrontmatterEnd(content)` | Find end of YAML frontmatter |
|
|
125
|
+
| `applyWikilinks(content, index, options)` | Apply wikilinks to content |
|
|
126
|
+
| `suggestWikilinks(content, index)` | Get wikilink suggestions |
|
|
127
|
+
|
|
128
|
+
---
|
|
129
|
+
|
|
130
|
+
## Related Projects
|
|
131
|
+
|
|
132
|
+
- [Flywheel](https://github.com/velvetmonkey/flywheel) — Read-only graph intelligence MCP server
|
|
133
|
+
- [Flywheel-Crank](https://github.com/velvetmonkey/flywheel-crank) — Safe mutation MCP server
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
Apache-2.0 License · [GitHub](https://github.com/velvetmonkey/vault-core) · [Issues](https://github.com/velvetmonkey/vault-core/issues)
|
package/dist/entities.d.ts
CHANGED
|
@@ -5,15 +5,28 @@
|
|
|
5
5
|
* that can be wikilinked. Filters out periodic notes and categorizes
|
|
6
6
|
* entities by type.
|
|
7
7
|
*/
|
|
8
|
-
import type { EntityIndex, ScanOptions } from './types.js';
|
|
8
|
+
import type { EntityIndex, ScanOptions, Entity } from './types.js';
|
|
9
|
+
/**
|
|
10
|
+
* Current cache version - bump when schema changes
|
|
11
|
+
*/
|
|
12
|
+
export declare const ENTITY_CACHE_VERSION = 2;
|
|
9
13
|
/**
|
|
10
14
|
* Scan vault for entities (markdown file stems) that can be wikilinked
|
|
11
15
|
*/
|
|
12
16
|
export declare function scanVaultEntities(vaultPath: string, options?: ScanOptions): Promise<EntityIndex>;
|
|
13
17
|
/**
|
|
14
18
|
* Get all entities as a flat array (for wikilink matching)
|
|
19
|
+
* Handles both legacy string format and new EntityWithAliases format
|
|
20
|
+
*/
|
|
21
|
+
export declare function getAllEntities(index: EntityIndex): Entity[];
|
|
22
|
+
/**
|
|
23
|
+
* Get entity name from an Entity (handles both string and object formats)
|
|
24
|
+
*/
|
|
25
|
+
export declare function getEntityName(entity: Entity): string;
|
|
26
|
+
/**
|
|
27
|
+
* Get entity aliases from an Entity (returns empty array for strings)
|
|
15
28
|
*/
|
|
16
|
-
export declare function
|
|
29
|
+
export declare function getEntityAliases(entity: Entity): string[];
|
|
17
30
|
/**
|
|
18
31
|
* Filter periodic notes from a list of entities
|
|
19
32
|
* Useful when loading from external sources
|
package/dist/entities.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entities.d.ts","sourceRoot":"","sources":["../src/entities.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,KAAK,EAAE,WAAW,EAAkB,WAAW,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"entities.d.ts","sourceRoot":"","sources":["../src/entities.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,KAAK,EAAE,WAAW,EAAkB,WAAW,EAAqB,MAAM,EAAE,MAAM,YAAY,CAAC;AAEtG;;GAEG;AACH,eAAO,MAAM,oBAAoB,IAAI,CAAC;AA2PtC;;GAEG;AACH,wBAAsB,iBAAiB,CACrC,SAAS,EAAE,MAAM,EACjB,OAAO,GAAE,WAAgB,GACxB,OAAO,CAAC,WAAW,CAAC,CAsEtB;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,WAAW,GAAG,MAAM,EAAE,CAQ3D;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEpD;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAEzD;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAEhE;AAED;;GAEG;AACH,wBAAsB,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC,CAOpF;AAED;;GAEG;AACH,wBAAsB,eAAe,CACnC,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,WAAW,GACjB,OAAO,CAAC,IAAI,CAAC,CAIf"}
|
package/dist/entities.js
CHANGED
|
@@ -7,6 +7,20 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import fs from 'fs/promises';
|
|
9
9
|
import path from 'path';
|
|
10
|
+
/**
|
|
11
|
+
* Current cache version - bump when schema changes
|
|
12
|
+
*/
|
|
13
|
+
export const ENTITY_CACHE_VERSION = 2;
|
|
14
|
+
/**
|
|
15
|
+
* Maximum entity name/alias length for suggestions
|
|
16
|
+
* Filters out article titles, clippings, and other long names
|
|
17
|
+
*/
|
|
18
|
+
const MAX_ENTITY_LENGTH = 25;
|
|
19
|
+
/**
|
|
20
|
+
* Maximum word count for entity names/aliases
|
|
21
|
+
* Concepts are typically 1-3 words; longer names are article titles
|
|
22
|
+
*/
|
|
23
|
+
const MAX_ENTITY_WORDS = 3;
|
|
10
24
|
/**
|
|
11
25
|
* Default patterns for filtering out periodic notes and system files
|
|
12
26
|
*/
|
|
@@ -35,6 +49,83 @@ const DEFAULT_TECH_KEYWORDS = [
|
|
|
35
49
|
'javascript', 'python', 'docker', 'kubernetes',
|
|
36
50
|
'adf', 'adb', 'net', 'aws', 'gcp', 'terraform',
|
|
37
51
|
];
|
|
52
|
+
/**
|
|
53
|
+
* Check if an alias passes the length and word count filters
|
|
54
|
+
* Uses same rules as entity names: ≤25 chars, ≤3 words
|
|
55
|
+
*/
|
|
56
|
+
function isValidAlias(alias) {
|
|
57
|
+
if (typeof alias !== 'string' || alias.length === 0) {
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
// Length filter
|
|
61
|
+
if (alias.length > MAX_ENTITY_LENGTH) {
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
// Word count filter
|
|
65
|
+
const words = alias.split(/\s+/).filter(w => w.length > 0);
|
|
66
|
+
if (words.length > MAX_ENTITY_WORDS) {
|
|
67
|
+
return false;
|
|
68
|
+
}
|
|
69
|
+
return true;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Parse frontmatter from markdown content and extract aliases
|
|
73
|
+
* Handles YAML array format: aliases: [Alias1, Alias2]
|
|
74
|
+
* And YAML list format:
|
|
75
|
+
* aliases:
|
|
76
|
+
* - Alias1
|
|
77
|
+
* - Alias2
|
|
78
|
+
*/
|
|
79
|
+
function extractAliasesFromContent(content) {
|
|
80
|
+
// Check for frontmatter delimiter
|
|
81
|
+
if (!content.startsWith('---')) {
|
|
82
|
+
return [];
|
|
83
|
+
}
|
|
84
|
+
// Find end of frontmatter
|
|
85
|
+
const endIndex = content.indexOf('\n---', 3);
|
|
86
|
+
if (endIndex === -1) {
|
|
87
|
+
return [];
|
|
88
|
+
}
|
|
89
|
+
const frontmatter = content.substring(4, endIndex);
|
|
90
|
+
// Try inline array format: aliases: [Alias1, Alias2]
|
|
91
|
+
const inlineMatch = frontmatter.match(/^aliases:\s*\[([^\]]*)\]/m);
|
|
92
|
+
if (inlineMatch) {
|
|
93
|
+
return inlineMatch[1]
|
|
94
|
+
.split(',')
|
|
95
|
+
.map(s => s.trim().replace(/^["']|["']$/g, '')) // Remove quotes
|
|
96
|
+
.filter(s => s.length > 0 && isValidAlias(s));
|
|
97
|
+
}
|
|
98
|
+
// Try multiline list format
|
|
99
|
+
const lines = frontmatter.split('\n');
|
|
100
|
+
const aliasIdx = lines.findIndex(line => /^aliases:\s*$/.test(line));
|
|
101
|
+
if (aliasIdx === -1) {
|
|
102
|
+
// Check for single value format: aliases: SingleAlias
|
|
103
|
+
const singleMatch = frontmatter.match(/^aliases:\s+(.+)$/m);
|
|
104
|
+
if (singleMatch && !singleMatch[1].startsWith('[')) {
|
|
105
|
+
const alias = singleMatch[1].trim().replace(/^["']|["']$/g, '');
|
|
106
|
+
return isValidAlias(alias) ? [alias] : [];
|
|
107
|
+
}
|
|
108
|
+
return [];
|
|
109
|
+
}
|
|
110
|
+
// Parse list items following "aliases:"
|
|
111
|
+
const aliases = [];
|
|
112
|
+
for (let i = aliasIdx + 1; i < lines.length; i++) {
|
|
113
|
+
const line = lines[i];
|
|
114
|
+
// Stop at next top-level key or empty line
|
|
115
|
+
if (/^[a-z_]+:/i.test(line) || line.trim() === '') {
|
|
116
|
+
break;
|
|
117
|
+
}
|
|
118
|
+
// Match list item: - Alias or - "Alias"
|
|
119
|
+
const listMatch = line.match(/^\s*-\s*["']?(.+?)["']?\s*$/);
|
|
120
|
+
if (listMatch) {
|
|
121
|
+
const alias = listMatch[1].trim();
|
|
122
|
+
if (isValidAlias(alias)) {
|
|
123
|
+
aliases.push(alias);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
return aliases;
|
|
128
|
+
}
|
|
38
129
|
/**
|
|
39
130
|
* Check if a file/folder name should be skipped (dot-prefixed)
|
|
40
131
|
*/
|
|
@@ -72,8 +163,11 @@ function categorizeEntity(name, techKeywords) {
|
|
|
72
163
|
}
|
|
73
164
|
/**
|
|
74
165
|
* Recursively scan a directory for markdown files
|
|
166
|
+
* @param dirPath - Absolute path to scan
|
|
167
|
+
* @param basePath - Vault root path (for relative path calculation)
|
|
168
|
+
* @param excludeFolders - Folders to skip
|
|
75
169
|
*/
|
|
76
|
-
async function scanDirectory(dirPath, excludeFolders) {
|
|
170
|
+
async function scanDirectory(dirPath, basePath, excludeFolders) {
|
|
77
171
|
const entities = [];
|
|
78
172
|
try {
|
|
79
173
|
const entries = await fs.readdir(dirPath, { withFileTypes: true });
|
|
@@ -89,13 +183,27 @@ async function scanDirectory(dirPath, excludeFolders) {
|
|
|
89
183
|
}
|
|
90
184
|
if (entry.isDirectory()) {
|
|
91
185
|
// Recurse into subdirectory
|
|
92
|
-
const subEntities = await scanDirectory(fullPath, excludeFolders);
|
|
186
|
+
const subEntities = await scanDirectory(fullPath, basePath, excludeFolders);
|
|
93
187
|
entities.push(...subEntities);
|
|
94
188
|
}
|
|
95
189
|
else if (entry.isFile() && entry.name.endsWith('.md')) {
|
|
96
190
|
// Extract file stem (without .md extension)
|
|
97
191
|
const stem = path.basename(entry.name, '.md');
|
|
98
|
-
|
|
192
|
+
const relativePath = path.relative(basePath, fullPath);
|
|
193
|
+
// Read file content to extract aliases
|
|
194
|
+
let aliases = [];
|
|
195
|
+
try {
|
|
196
|
+
const content = await fs.readFile(fullPath, 'utf-8');
|
|
197
|
+
aliases = extractAliasesFromContent(content);
|
|
198
|
+
}
|
|
199
|
+
catch {
|
|
200
|
+
// Skip if can't read file - just use empty aliases
|
|
201
|
+
}
|
|
202
|
+
entities.push({
|
|
203
|
+
name: stem,
|
|
204
|
+
relativePath,
|
|
205
|
+
aliases,
|
|
206
|
+
});
|
|
99
207
|
}
|
|
100
208
|
}
|
|
101
209
|
}
|
|
@@ -112,11 +220,18 @@ export async function scanVaultEntities(vaultPath, options = {}) {
|
|
|
112
220
|
const excludeFolders = options.excludeFolders ?? [];
|
|
113
221
|
const techKeywords = options.techKeywords ?? DEFAULT_TECH_KEYWORDS;
|
|
114
222
|
// Scan vault for all markdown files
|
|
115
|
-
const allEntities = await scanDirectory(vaultPath, excludeFolders);
|
|
223
|
+
const allEntities = await scanDirectory(vaultPath, vaultPath, excludeFolders);
|
|
116
224
|
// Filter out periodic notes and invalid entries
|
|
117
|
-
const validEntities = allEntities.filter(entity => entity.length >= 2 && !matchesExcludePattern(entity));
|
|
118
|
-
// Remove duplicates
|
|
119
|
-
const
|
|
225
|
+
const validEntities = allEntities.filter(entity => entity.name.length >= 2 && !matchesExcludePattern(entity.name));
|
|
226
|
+
// Remove duplicates by name (keep first occurrence)
|
|
227
|
+
const seenNames = new Set();
|
|
228
|
+
const uniqueEntities = validEntities.filter(entity => {
|
|
229
|
+
if (seenNames.has(entity.name.toLowerCase())) {
|
|
230
|
+
return false;
|
|
231
|
+
}
|
|
232
|
+
seenNames.add(entity.name.toLowerCase());
|
|
233
|
+
return true;
|
|
234
|
+
});
|
|
120
235
|
// Categorize entities
|
|
121
236
|
const index = {
|
|
122
237
|
technologies: [],
|
|
@@ -129,18 +244,30 @@ export async function scanVaultEntities(vaultPath, options = {}) {
|
|
|
129
244
|
generated_at: new Date().toISOString(),
|
|
130
245
|
vault_path: vaultPath,
|
|
131
246
|
source: 'vault-core scanVaultEntities',
|
|
247
|
+
version: ENTITY_CACHE_VERSION,
|
|
132
248
|
},
|
|
133
249
|
};
|
|
134
250
|
for (const entity of uniqueEntities) {
|
|
135
|
-
const category = categorizeEntity(entity, techKeywords);
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
251
|
+
const category = categorizeEntity(entity.name, techKeywords);
|
|
252
|
+
// Store as EntityWithAliases object
|
|
253
|
+
const entityObj = {
|
|
254
|
+
name: entity.name,
|
|
255
|
+
path: entity.relativePath,
|
|
256
|
+
aliases: entity.aliases,
|
|
257
|
+
};
|
|
258
|
+
index[category].push(entityObj);
|
|
259
|
+
}
|
|
260
|
+
// Sort each category by name
|
|
261
|
+
const sortByName = (a, b) => {
|
|
262
|
+
const nameA = typeof a === 'string' ? a : a.name;
|
|
263
|
+
const nameB = typeof b === 'string' ? b : b.name;
|
|
264
|
+
return nameA.localeCompare(nameB);
|
|
265
|
+
};
|
|
266
|
+
index.technologies.sort(sortByName);
|
|
267
|
+
index.acronyms.sort(sortByName);
|
|
268
|
+
index.people.sort(sortByName);
|
|
269
|
+
index.projects.sort(sortByName);
|
|
270
|
+
index.other.sort(sortByName);
|
|
144
271
|
// Update metadata
|
|
145
272
|
index._metadata.total_entities =
|
|
146
273
|
index.technologies.length +
|
|
@@ -152,6 +279,7 @@ export async function scanVaultEntities(vaultPath, options = {}) {
|
|
|
152
279
|
}
|
|
153
280
|
/**
|
|
154
281
|
* Get all entities as a flat array (for wikilink matching)
|
|
282
|
+
* Handles both legacy string format and new EntityWithAliases format
|
|
155
283
|
*/
|
|
156
284
|
export function getAllEntities(index) {
|
|
157
285
|
return [
|
|
@@ -162,6 +290,18 @@ export function getAllEntities(index) {
|
|
|
162
290
|
...index.other,
|
|
163
291
|
];
|
|
164
292
|
}
|
|
293
|
+
/**
|
|
294
|
+
* Get entity name from an Entity (handles both string and object formats)
|
|
295
|
+
*/
|
|
296
|
+
export function getEntityName(entity) {
|
|
297
|
+
return typeof entity === 'string' ? entity : entity.name;
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* Get entity aliases from an Entity (returns empty array for strings)
|
|
301
|
+
*/
|
|
302
|
+
export function getEntityAliases(entity) {
|
|
303
|
+
return typeof entity === 'string' ? [] : entity.aliases;
|
|
304
|
+
}
|
|
165
305
|
/**
|
|
166
306
|
* Filter periodic notes from a list of entities
|
|
167
307
|
* Useful when loading from external sources
|
package/dist/entities.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entities.js","sourceRoot":"","sources":["../src/entities.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,MAAM,aAAa,CAAC;AAC7B,OAAO,IAAI,MAAM,MAAM,CAAC;AAGxB;;GAEG;AACH,MAAM,wBAAwB,GAAG;IAC/B,qBAAqB,EAAY,wBAAwB;IACzD,2BAA2B,EAAM,sBAAsB;IACvD,gBAAgB,EAAkB,uBAAuB;IACzD,eAAe,EAAmB,wBAAwB;IAC1D,aAAa,EAAqB,yBAAyB;IAC3D,OAAO,EAA2B,eAAe;IACjD,IAAI,EAA8B,kBAAkB;IACpD,IAAI,EAA8B,gBAAgB;IAClD,OAAO,EAA2B,wB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EAAE,CAAC,CAAC;IACzC,MAAM,EAAE,CAAC,SAAS,CAAC,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;AACzE,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* Shared vault utilities for the Flywheel ecosystem.
|
|
5
5
|
* Used by both Flywheel (read) and Flywheel-Crank (write).
|
|
6
6
|
*/
|
|
7
|
-
export type { EntityIndex, EntityCategory, ProtectedZone, ProtectedZoneType, ScanOptions, WikilinkOptions, WikilinkResult, } from './types.js';
|
|
8
|
-
export { scanVaultEntities, getAllEntities, filterPeriodicNotes, loadEntityCache, saveEntityCache, } from './entities.js';
|
|
7
|
+
export type { EntityIndex, EntityCategory, EntityWithAliases, Entity, ProtectedZone, ProtectedZoneType, ScanOptions, WikilinkOptions, WikilinkResult, } from './types.js';
|
|
8
|
+
export { scanVaultEntities, getAllEntities, getEntityName, getEntityAliases, filterPeriodicNotes, loadEntityCache, saveEntityCache, ENTITY_CACHE_VERSION, } from './entities.js';
|
|
9
9
|
export { getProtectedZones, isInProtectedZone, rangeOverlapsProtectedZone, findFrontmatterEnd, } from './protectedZones.js';
|
|
10
10
|
export { applyWikilinks, suggestWikilinks, } from './wikilinks.js';
|
|
11
11
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,YAAY,EACV,WAAW,EACX,cAAc,EACd,aAAa,EACb,iBAAiB,EACjB,WAAW,EACX,eAAe,EACf,cAAc,GACf,MAAM,YAAY,CAAC;AAGpB,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,mBAAmB,EACnB,eAAe,EACf,eAAe,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,YAAY,EACV,WAAW,EACX,cAAc,EACd,iBAAiB,EACjB,MAAM,EACN,aAAa,EACb,iBAAiB,EACjB,WAAW,EACX,eAAe,EACf,cAAc,GACf,MAAM,YAAY,CAAC;AAGpB,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,mBAAmB,EACnB,eAAe,EACf,eAAe,EACf,oBAAoB,GACrB,MAAM,eAAe,CAAC;AAGvB,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,0BAA0B,EAC1B,kBAAkB,GACnB,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EACL,cAAc,EACd,gBAAgB,GACjB,MAAM,gBAAgB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Used by both Flywheel (read) and Flywheel-Crank (write).
|
|
6
6
|
*/
|
|
7
7
|
// Entity scanning
|
|
8
|
-
export { scanVaultEntities, getAllEntities, filterPeriodicNotes, loadEntityCache, saveEntityCache, } from './entities.js';
|
|
8
|
+
export { scanVaultEntities, getAllEntities, getEntityName, getEntityAliases, filterPeriodicNotes, loadEntityCache, saveEntityCache, ENTITY_CACHE_VERSION, } from './entities.js';
|
|
9
9
|
// Protected zones
|
|
10
10
|
export { getProtectedZones, isInProtectedZone, rangeOverlapsProtectedZone, findFrontmatterEnd, } from './protectedZones.js';
|
|
11
11
|
// Wikilinks
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAeH,kBAAkB;AAClB,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,mBAAmB,EACnB,eAAe,EACf,eAAe,EACf,oBAAoB,GACrB,MAAM,eAAe,CAAC;AAEvB,kBAAkB;AAClB,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,0BAA0B,EAC1B,kBAAkB,GACnB,MAAM,qBAAqB,CAAC;AAE7B,YAAY;AACZ,OAAO,EACL,cAAc,EACd,gBAAgB,GACjB,MAAM,gBAAgB,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -5,20 +5,38 @@
|
|
|
5
5
|
* Categories for entity classification
|
|
6
6
|
*/
|
|
7
7
|
export type EntityCategory = 'technologies' | 'acronyms' | 'people' | 'projects' | 'other';
|
|
8
|
+
/**
|
|
9
|
+
* Entity with optional aliases from frontmatter
|
|
10
|
+
*/
|
|
11
|
+
export interface EntityWithAliases {
|
|
12
|
+
/** Primary entity name (file stem) */
|
|
13
|
+
name: string;
|
|
14
|
+
/** Relative path to the file within vault */
|
|
15
|
+
path: string;
|
|
16
|
+
/** Aliases from frontmatter (filtered by length/word count) */
|
|
17
|
+
aliases: string[];
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Entity can be either a simple string (legacy) or full object with aliases
|
|
21
|
+
*/
|
|
22
|
+
export type Entity = string | EntityWithAliases;
|
|
8
23
|
/**
|
|
9
24
|
* Entity index structure matching wikilink-cache.py output
|
|
25
|
+
* Now supports both string[] (legacy) and EntityWithAliases[] (v2)
|
|
10
26
|
*/
|
|
11
27
|
export interface EntityIndex {
|
|
12
|
-
technologies:
|
|
13
|
-
acronyms:
|
|
14
|
-
people:
|
|
15
|
-
projects:
|
|
16
|
-
other:
|
|
28
|
+
technologies: Entity[];
|
|
29
|
+
acronyms: Entity[];
|
|
30
|
+
people: Entity[];
|
|
31
|
+
projects: Entity[];
|
|
32
|
+
other: Entity[];
|
|
17
33
|
_metadata: {
|
|
18
34
|
total_entities: number;
|
|
19
35
|
generated_at: string;
|
|
20
36
|
vault_path: string;
|
|
21
37
|
source: string;
|
|
38
|
+
/** Cache version for migration detection */
|
|
39
|
+
version?: number;
|
|
22
40
|
};
|
|
23
41
|
}
|
|
24
42
|
/**
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,MAAM,MAAM,cAAc,GACtB,cAAc,GACd,UAAU,GACV,QAAQ,GACR,UAAU,GACV,OAAO,CAAC;AAEZ;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,SAAS,EAAE;QACT,cAAc,EAAE,MAAM,CAAC;QACvB,YAAY,EAAE,MAAM,CAAC;QACrB,UAAU,EAAE,MAAM,CAAC;QACnB,MAAM,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,MAAM,MAAM,cAAc,GACtB,cAAc,GACd,UAAU,GACV,QAAQ,GACR,UAAU,GACV,OAAO,CAAC;AAEZ;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,sCAAsC;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,6CAA6C;IAC7C,IAAI,EAAE,MAAM,CAAC;IACb,+DAA+D;IAC/D,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,MAAM,MAAM,GAAG,MAAM,GAAG,iBAAiB,CAAC;AAEhD;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC1B,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,SAAS,EAAE;QACT,cAAc,EAAE,MAAM,CAAC;QACvB,YAAY,EAAE,MAAM,CAAC;QACrB,UAAU,EAAE,MAAM,CAAC;QACnB,MAAM,EAAE,MAAM,CAAC;QACf,4CAA4C;QAC5C,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,iBAAiB,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,MAAM,iBAAiB,GACzB,aAAa,GACb,YAAY,GACZ,aAAa,GACb,UAAU,GACV,eAAe,GACf,KAAK,GACL,SAAS,GACT,UAAU,GACV,kBAAkB,GAClB,MAAM,CAAC;AAEX;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAE1B;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B;;;OAGG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAE9B;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,EAAE,CAAC;CAC1B"}
|
package/dist/wikilinks.d.ts
CHANGED
|
@@ -4,21 +4,21 @@
|
|
|
4
4
|
* Applies [[wikilinks]] to known entities in content while
|
|
5
5
|
* respecting protected zones (code, frontmatter, existing links, etc.)
|
|
6
6
|
*/
|
|
7
|
-
import type { WikilinkOptions, WikilinkResult } from './types.js';
|
|
7
|
+
import type { WikilinkOptions, WikilinkResult, Entity } from './types.js';
|
|
8
8
|
/**
|
|
9
9
|
* Apply wikilinks to entities in content
|
|
10
10
|
*
|
|
11
11
|
* @param content - The markdown content to process
|
|
12
|
-
* @param entities - List of entity names to look for
|
|
12
|
+
* @param entities - List of entity names or Entity objects to look for
|
|
13
13
|
* @param options - Wikilink options
|
|
14
14
|
* @returns Result with updated content and statistics
|
|
15
15
|
*/
|
|
16
|
-
export declare function applyWikilinks(content: string, entities:
|
|
16
|
+
export declare function applyWikilinks(content: string, entities: Entity[], options?: WikilinkOptions): WikilinkResult;
|
|
17
17
|
/**
|
|
18
18
|
* Suggest wikilinks without applying them
|
|
19
19
|
* Returns a list of potential links with their positions
|
|
20
20
|
*/
|
|
21
|
-
export declare function suggestWikilinks(content: string, entities:
|
|
21
|
+
export declare function suggestWikilinks(content: string, entities: Entity[], options?: WikilinkOptions): Array<{
|
|
22
22
|
entity: string;
|
|
23
23
|
start: number;
|
|
24
24
|
end: number;
|
package/dist/wikilinks.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wikilinks.d.ts","sourceRoot":"","sources":["../src/wikilinks.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"wikilinks.d.ts","sourceRoot":"","sources":["../src/wikilinks.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAmF1E;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAC5B,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAAE,EAClB,OAAO,GAAE,eAAoB,GAC5B,cAAc,CAgNhB;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAAE,EAClB,OAAO,GAAE,eAAoB,GAC5B,KAAK,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,CA4DxE"}
|