@cad0p/napkin 0.8.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 +21 -0
- package/README.md +342 -0
- package/dist/commands/aliases.d.ts +7 -0
- package/dist/commands/aliases.js +25 -0
- package/dist/commands/bases.d.ts +23 -0
- package/dist/commands/bases.js +139 -0
- package/dist/commands/bookmarks.d.ts +15 -0
- package/dist/commands/bookmarks.js +51 -0
- package/dist/commands/canvas.d.ts +49 -0
- package/dist/commands/canvas.js +186 -0
- package/dist/commands/config.d.ts +13 -0
- package/dist/commands/config.js +48 -0
- package/dist/commands/crud.d.ts +40 -0
- package/dist/commands/crud.js +195 -0
- package/dist/commands/daily.d.ts +20 -0
- package/dist/commands/daily.js +58 -0
- package/dist/commands/files.d.ts +23 -0
- package/dist/commands/files.js +132 -0
- package/dist/commands/graph.d.ts +4 -0
- package/dist/commands/graph.js +461 -0
- package/dist/commands/init.d.ts +7 -0
- package/dist/commands/init.js +52 -0
- package/dist/commands/links.d.ts +26 -0
- package/dist/commands/links.js +119 -0
- package/dist/commands/outline.d.ts +7 -0
- package/dist/commands/outline.js +48 -0
- package/dist/commands/overview.d.ts +6 -0
- package/dist/commands/overview.js +40 -0
- package/dist/commands/properties.d.ts +24 -0
- package/dist/commands/properties.js +115 -0
- package/dist/commands/search.d.ts +13 -0
- package/dist/commands/search.js +48 -0
- package/dist/commands/tags.d.ts +13 -0
- package/dist/commands/tags.js +51 -0
- package/dist/commands/tasks.d.ts +22 -0
- package/dist/commands/tasks.js +106 -0
- package/dist/commands/templates.d.ts +16 -0
- package/dist/commands/templates.js +70 -0
- package/dist/commands/vault.d.ts +4 -0
- package/dist/commands/vault.js +17 -0
- package/dist/commands/wordcount.d.ts +7 -0
- package/dist/commands/wordcount.js +43 -0
- package/dist/core/aliases.d.ts +5 -0
- package/dist/core/aliases.js +26 -0
- package/dist/core/bases.d.ts +29 -0
- package/dist/core/bases.js +67 -0
- package/dist/core/bookmarks.d.ts +14 -0
- package/dist/core/bookmarks.js +34 -0
- package/dist/core/canvas.d.ts +74 -0
- package/dist/core/canvas.js +125 -0
- package/dist/core/config.d.ts +7 -0
- package/dist/core/config.js +35 -0
- package/dist/core/crud.d.ts +32 -0
- package/dist/core/crud.js +119 -0
- package/dist/core/daily.d.ts +12 -0
- package/dist/core/daily.js +102 -0
- package/dist/core/files.d.ts +15 -0
- package/dist/core/files.js +30 -0
- package/dist/core/init.d.ts +31 -0
- package/dist/core/init.js +119 -0
- package/dist/core/links.d.ts +11 -0
- package/dist/core/links.js +66 -0
- package/dist/core/outline.d.ts +3 -0
- package/dist/core/outline.js +12 -0
- package/dist/core/overview.d.ts +15 -0
- package/dist/core/overview.js +384 -0
- package/dist/core/properties.d.ts +14 -0
- package/dist/core/properties.js +60 -0
- package/dist/core/search.d.ts +17 -0
- package/dist/core/search.js +153 -0
- package/dist/core/tags.d.ts +11 -0
- package/dist/core/tags.js +40 -0
- package/dist/core/tasks.d.ts +35 -0
- package/dist/core/tasks.js +97 -0
- package/dist/core/templates.d.ts +14 -0
- package/dist/core/templates.js +55 -0
- package/dist/core/vault.d.ts +10 -0
- package/dist/core/vault.js +37 -0
- package/dist/core/wordcount.d.ts +5 -0
- package/dist/core/wordcount.js +16 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.js +1 -0
- package/dist/main.d.ts +2 -0
- package/dist/main.js +715 -0
- package/dist/sdk.d.ts +179 -0
- package/dist/sdk.js +232 -0
- package/dist/templates/coding.d.ts +2 -0
- package/dist/templates/coding.js +104 -0
- package/dist/templates/company.d.ts +2 -0
- package/dist/templates/company.js +121 -0
- package/dist/templates/index.d.ts +4 -0
- package/dist/templates/index.js +15 -0
- package/dist/templates/personal.d.ts +2 -0
- package/dist/templates/personal.js +91 -0
- package/dist/templates/product.d.ts +2 -0
- package/dist/templates/product.js +123 -0
- package/dist/templates/research.d.ts +2 -0
- package/dist/templates/research.js +114 -0
- package/dist/templates/types.d.ts +7 -0
- package/dist/templates/types.js +1 -0
- package/dist/utils/bases.d.ts +61 -0
- package/dist/utils/bases.js +661 -0
- package/dist/utils/config.d.ts +42 -0
- package/dist/utils/config.js +112 -0
- package/dist/utils/exit-codes.d.ts +5 -0
- package/dist/utils/exit-codes.js +5 -0
- package/dist/utils/files.d.ts +135 -0
- package/dist/utils/files.js +299 -0
- package/dist/utils/formula.d.ts +28 -0
- package/dist/utils/formula.js +462 -0
- package/dist/utils/frontmatter.d.ts +17 -0
- package/dist/utils/frontmatter.js +34 -0
- package/dist/utils/markdown.d.ts +31 -0
- package/dist/utils/markdown.js +80 -0
- package/dist/utils/output.d.ts +28 -0
- package/dist/utils/output.js +48 -0
- package/dist/utils/search-cache.d.ts +29 -0
- package/dist/utils/search-cache.js +41 -0
- package/dist/utils/test-helpers.d.ts +13 -0
- package/dist/utils/test-helpers.js +40 -0
- package/dist/utils/vault.d.ts +21 -0
- package/dist/utils/vault.js +144 -0
- package/package.json +76 -0
package/dist/sdk.d.ts
ADDED
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { type AliasEntry } from "./core/aliases.js";
|
|
2
|
+
import { type BaseQueryResult, type BaseView } from "./core/bases.js";
|
|
3
|
+
import { type Bookmark } from "./core/bookmarks.js";
|
|
4
|
+
import { type Canvas } from "./core/canvas.js";
|
|
5
|
+
import { type CreateOptions, type CreateResult, type DeleteResult, type MoveResult, type ReadResult } from "./core/crud.js";
|
|
6
|
+
import { type FileInfo, type FolderInfo } from "./core/files.js";
|
|
7
|
+
import { type AddTemplateResult, type ScaffoldResult, type TemplateInfo } from "./core/init.js";
|
|
8
|
+
import { type VaultOverview } from "./core/overview.js";
|
|
9
|
+
import { type SearchOptions, type SearchResult } from "./core/search.js";
|
|
10
|
+
import { type TagInfo } from "./core/tags.js";
|
|
11
|
+
import { type TaskShowResult, type TaskWithFile } from "./core/tasks.js";
|
|
12
|
+
import { type VaultMetadata } from "./core/vault.js";
|
|
13
|
+
import { type WordCount } from "./core/wordcount.js";
|
|
14
|
+
import type { VaultTemplate } from "./templates/types.js";
|
|
15
|
+
import type { Heading } from "./utils/markdown.js";
|
|
16
|
+
import { type VaultInfo } from "./utils/vault.js";
|
|
17
|
+
export declare class Napkin {
|
|
18
|
+
readonly vault: VaultInfo;
|
|
19
|
+
constructor(path: string);
|
|
20
|
+
info(): VaultMetadata;
|
|
21
|
+
overview(opts?: {
|
|
22
|
+
depth?: number;
|
|
23
|
+
keywords?: number;
|
|
24
|
+
}): VaultOverview;
|
|
25
|
+
search(query: string, opts?: SearchOptions): SearchResult[];
|
|
26
|
+
read(file: string): ReadResult;
|
|
27
|
+
create(opts: CreateOptions): CreateResult;
|
|
28
|
+
append(file: string, content: string, inline?: boolean): string;
|
|
29
|
+
prepend(file: string, content: string, inline?: boolean): string;
|
|
30
|
+
move(file: string, destination: string): MoveResult;
|
|
31
|
+
rename(file: string, newName: string): MoveResult;
|
|
32
|
+
delete(file: string, permanent?: boolean): DeleteResult;
|
|
33
|
+
fileInfo(file: string): FileInfo;
|
|
34
|
+
fileList(opts?: {
|
|
35
|
+
folder?: string;
|
|
36
|
+
ext?: string;
|
|
37
|
+
}): string[];
|
|
38
|
+
folders(parentFolder?: string): string[];
|
|
39
|
+
folderInfo(folderPath: string): FolderInfo;
|
|
40
|
+
outline(file: string): Heading[];
|
|
41
|
+
wordcount(file: string): WordCount;
|
|
42
|
+
dailyPath(date?: Date): string;
|
|
43
|
+
dailyEnsure(): {
|
|
44
|
+
path: string;
|
|
45
|
+
created: boolean;
|
|
46
|
+
};
|
|
47
|
+
dailyRead(): {
|
|
48
|
+
path: string;
|
|
49
|
+
content: string;
|
|
50
|
+
};
|
|
51
|
+
dailyAppend(content: string, inline?: boolean): string;
|
|
52
|
+
dailyPrepend(content: string, inline?: boolean): string;
|
|
53
|
+
tags(fileFilter?: string): {
|
|
54
|
+
tagCounts: Map<string, number>;
|
|
55
|
+
tagFiles: Map<string, string[]>;
|
|
56
|
+
};
|
|
57
|
+
tagInfo(tagName: string): TagInfo;
|
|
58
|
+
aliases(fileFilter?: string): AliasEntry[];
|
|
59
|
+
properties(fileFilter?: string): Map<string, number>;
|
|
60
|
+
propertyGet(file: string, name: string): {
|
|
61
|
+
property: string;
|
|
62
|
+
value: unknown;
|
|
63
|
+
};
|
|
64
|
+
propertySet(file: string, name: string, value: string): {
|
|
65
|
+
path: string;
|
|
66
|
+
property: string;
|
|
67
|
+
value: unknown;
|
|
68
|
+
};
|
|
69
|
+
propertyRemove(file: string, name: string): {
|
|
70
|
+
path: string;
|
|
71
|
+
removed: string;
|
|
72
|
+
};
|
|
73
|
+
tasks(opts?: {
|
|
74
|
+
file?: string;
|
|
75
|
+
daily?: boolean;
|
|
76
|
+
done?: boolean;
|
|
77
|
+
todo?: boolean;
|
|
78
|
+
status?: string;
|
|
79
|
+
}): TaskWithFile[];
|
|
80
|
+
taskShow(file: string, line: number): {
|
|
81
|
+
currentStatus: string;
|
|
82
|
+
text: string;
|
|
83
|
+
};
|
|
84
|
+
taskUpdate(file: string, line: number, newStatus: string): TaskShowResult;
|
|
85
|
+
linksOut(file: string): string[];
|
|
86
|
+
linksBack(file: string): string[];
|
|
87
|
+
linksUnresolved(): [string, string[]][];
|
|
88
|
+
orphans(): string[];
|
|
89
|
+
deadends(): string[];
|
|
90
|
+
templates(): string[];
|
|
91
|
+
templateRead(name: string, opts?: {
|
|
92
|
+
resolve?: boolean;
|
|
93
|
+
title?: string;
|
|
94
|
+
}): {
|
|
95
|
+
template: string;
|
|
96
|
+
content: string;
|
|
97
|
+
};
|
|
98
|
+
templateInsert(templateName: string, file: string): {
|
|
99
|
+
file: string;
|
|
100
|
+
template: string;
|
|
101
|
+
inserted: boolean;
|
|
102
|
+
};
|
|
103
|
+
bookmarks(): Bookmark[];
|
|
104
|
+
bookmarkAdd(entry: Bookmark): {
|
|
105
|
+
added: Bookmark;
|
|
106
|
+
};
|
|
107
|
+
config(): Record<string, unknown>;
|
|
108
|
+
configGet(key: string): unknown;
|
|
109
|
+
configSet(key: string, value: string): {
|
|
110
|
+
config: Record<string, unknown>;
|
|
111
|
+
parsed: unknown;
|
|
112
|
+
};
|
|
113
|
+
bases(): string[];
|
|
114
|
+
baseViews(opts: {
|
|
115
|
+
file?: string;
|
|
116
|
+
path?: string;
|
|
117
|
+
}): BaseView[];
|
|
118
|
+
baseQuery(opts: {
|
|
119
|
+
file?: string;
|
|
120
|
+
path?: string;
|
|
121
|
+
}, viewName?: string): Promise<BaseQueryResult>;
|
|
122
|
+
baseCreate(opts: {
|
|
123
|
+
name: string;
|
|
124
|
+
path?: string;
|
|
125
|
+
content?: string;
|
|
126
|
+
}): {
|
|
127
|
+
path: string;
|
|
128
|
+
created: boolean;
|
|
129
|
+
};
|
|
130
|
+
canvases(): string[];
|
|
131
|
+
canvasRead(file: string): {
|
|
132
|
+
canvas: Canvas;
|
|
133
|
+
filePath: string;
|
|
134
|
+
};
|
|
135
|
+
canvasCreate(fileName: string, folder?: string): {
|
|
136
|
+
path: string;
|
|
137
|
+
created: boolean;
|
|
138
|
+
};
|
|
139
|
+
canvasAddNode(file: string, opts: {
|
|
140
|
+
type?: string;
|
|
141
|
+
text?: string;
|
|
142
|
+
noteFile?: string;
|
|
143
|
+
subpath?: string;
|
|
144
|
+
url?: string;
|
|
145
|
+
label?: string;
|
|
146
|
+
x?: string;
|
|
147
|
+
y?: string;
|
|
148
|
+
width?: string;
|
|
149
|
+
height?: string;
|
|
150
|
+
color?: string;
|
|
151
|
+
}): {
|
|
152
|
+
id: string;
|
|
153
|
+
type: string;
|
|
154
|
+
added: boolean;
|
|
155
|
+
};
|
|
156
|
+
canvasAddEdge(file: string, opts: {
|
|
157
|
+
from: string;
|
|
158
|
+
to: string;
|
|
159
|
+
fromSide?: string;
|
|
160
|
+
toSide?: string;
|
|
161
|
+
label?: string;
|
|
162
|
+
color?: string;
|
|
163
|
+
}): {
|
|
164
|
+
id: string;
|
|
165
|
+
from: string;
|
|
166
|
+
to: string;
|
|
167
|
+
added: boolean;
|
|
168
|
+
};
|
|
169
|
+
canvasRemoveNode(file: string, nodeId: string): {
|
|
170
|
+
id: string;
|
|
171
|
+
removed: boolean;
|
|
172
|
+
};
|
|
173
|
+
static scaffold(path: string, opts?: {
|
|
174
|
+
template?: string;
|
|
175
|
+
}): ScaffoldResult;
|
|
176
|
+
static vaultTemplates(): TemplateInfo[];
|
|
177
|
+
static registerTemplate(template: VaultTemplate): void;
|
|
178
|
+
static addTemplate(path: string, template: string): AddTemplateResult;
|
|
179
|
+
}
|
package/dist/sdk.js
ADDED
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
import { collectAliases } from "./core/aliases.js";
|
|
2
|
+
import { createBaseItem, getBaseViews, listBases, queryBaseFile, resolveBaseFile, } from "./core/bases.js";
|
|
3
|
+
import { addBookmark, flattenBookmarks, readBookmarks, } from "./core/bookmarks.js";
|
|
4
|
+
import { addCanvasEdge, addCanvasNode, createCanvas, listCanvases, removeCanvasNode, resolveCanvas, } from "./core/canvas.js";
|
|
5
|
+
import { getConfigValue, loadConfig, setConfigValue } from "./core/config.js";
|
|
6
|
+
import { appendFile, createFile, deleteFile, moveFile, prependFile, readFile, renameFile, } from "./core/crud.js";
|
|
7
|
+
import { appendDaily, ensureDaily, getDailyPath, prependDaily, readDaily, } from "./core/daily.js";
|
|
8
|
+
import { getFileInfoResolved, getFileList, getFolderInfo, getFolderList, } from "./core/files.js";
|
|
9
|
+
import { addTemplate, getInitTemplates, scaffoldVault, } from "./core/init.js";
|
|
10
|
+
import { getBacklinks, getDeadends, getOrphans, getOutgoingLinks, getUnresolvedLinks, } from "./core/links.js";
|
|
11
|
+
import { getOutline } from "./core/outline.js";
|
|
12
|
+
import { getOverview } from "./core/overview.js";
|
|
13
|
+
import { collectProperties, readProperty, removeProperty, setProperty, } from "./core/properties.js";
|
|
14
|
+
import { searchVault, } from "./core/search.js";
|
|
15
|
+
import { collectTags, getTagInfo } from "./core/tags.js";
|
|
16
|
+
import { collectTasks, filterTasks, showTask, updateTask, } from "./core/tasks.js";
|
|
17
|
+
import { insertTemplate, listTemplates, readTemplate, } from "./core/templates.js";
|
|
18
|
+
import { getVaultMetadata } from "./core/vault.js";
|
|
19
|
+
import { getWordCount } from "./core/wordcount.js";
|
|
20
|
+
import { registerTemplate } from "./templates/index.js";
|
|
21
|
+
import { findVault } from "./utils/vault.js";
|
|
22
|
+
export class Napkin {
|
|
23
|
+
vault;
|
|
24
|
+
constructor(path) {
|
|
25
|
+
this.vault = findVault(path);
|
|
26
|
+
}
|
|
27
|
+
// ── Vault ───────────────────────────────────────────────────────
|
|
28
|
+
info() {
|
|
29
|
+
return getVaultMetadata(this.vault);
|
|
30
|
+
}
|
|
31
|
+
overview(opts) {
|
|
32
|
+
return getOverview(this.vault.contentPath, this.vault.configPath, opts);
|
|
33
|
+
}
|
|
34
|
+
// ── Search ──────────────────────────────────────────────────────
|
|
35
|
+
search(query, opts) {
|
|
36
|
+
return searchVault(this.vault.contentPath, this.vault.configPath, query, opts);
|
|
37
|
+
}
|
|
38
|
+
// ── CRUD ────────────────────────────────────────────────────────
|
|
39
|
+
read(file) {
|
|
40
|
+
return readFile(this.vault.contentPath, file);
|
|
41
|
+
}
|
|
42
|
+
create(opts) {
|
|
43
|
+
return createFile(this.vault, opts);
|
|
44
|
+
}
|
|
45
|
+
append(file, content, inline) {
|
|
46
|
+
return appendFile(this.vault.contentPath, file, content, inline);
|
|
47
|
+
}
|
|
48
|
+
prepend(file, content, inline) {
|
|
49
|
+
return prependFile(this.vault.contentPath, file, content, inline);
|
|
50
|
+
}
|
|
51
|
+
move(file, destination) {
|
|
52
|
+
return moveFile(this.vault.contentPath, file, destination);
|
|
53
|
+
}
|
|
54
|
+
rename(file, newName) {
|
|
55
|
+
return renameFile(this.vault.contentPath, file, newName);
|
|
56
|
+
}
|
|
57
|
+
delete(file, permanent) {
|
|
58
|
+
return deleteFile(this.vault.contentPath, file, permanent);
|
|
59
|
+
}
|
|
60
|
+
// ── Files ───────────────────────────────────────────────────────
|
|
61
|
+
fileInfo(file) {
|
|
62
|
+
return getFileInfoResolved(this.vault.contentPath, file);
|
|
63
|
+
}
|
|
64
|
+
fileList(opts) {
|
|
65
|
+
return getFileList(this.vault.contentPath, opts);
|
|
66
|
+
}
|
|
67
|
+
folders(parentFolder) {
|
|
68
|
+
return getFolderList(this.vault.contentPath, parentFolder);
|
|
69
|
+
}
|
|
70
|
+
folderInfo(folderPath) {
|
|
71
|
+
return getFolderInfo(this.vault.contentPath, folderPath);
|
|
72
|
+
}
|
|
73
|
+
outline(file) {
|
|
74
|
+
return getOutline(this.vault.contentPath, file);
|
|
75
|
+
}
|
|
76
|
+
wordcount(file) {
|
|
77
|
+
return getWordCount(this.vault.contentPath, file);
|
|
78
|
+
}
|
|
79
|
+
// ── Daily ───────────────────────────────────────────────────────
|
|
80
|
+
dailyPath(date) {
|
|
81
|
+
return getDailyPath(this.vault.configPath, date);
|
|
82
|
+
}
|
|
83
|
+
dailyEnsure() {
|
|
84
|
+
return ensureDaily(this.vault);
|
|
85
|
+
}
|
|
86
|
+
dailyRead() {
|
|
87
|
+
return readDaily(this.vault);
|
|
88
|
+
}
|
|
89
|
+
dailyAppend(content, inline) {
|
|
90
|
+
return appendDaily(this.vault, content, inline);
|
|
91
|
+
}
|
|
92
|
+
dailyPrepend(content, inline) {
|
|
93
|
+
return prependDaily(this.vault, content, inline);
|
|
94
|
+
}
|
|
95
|
+
// ── Tags ────────────────────────────────────────────────────────
|
|
96
|
+
tags(fileFilter) {
|
|
97
|
+
return collectTags(this.vault.contentPath, fileFilter);
|
|
98
|
+
}
|
|
99
|
+
tagInfo(tagName) {
|
|
100
|
+
return getTagInfo(this.vault.contentPath, tagName);
|
|
101
|
+
}
|
|
102
|
+
// ── Aliases ─────────────────────────────────────────────────────
|
|
103
|
+
aliases(fileFilter) {
|
|
104
|
+
return collectAliases(this.vault.contentPath, fileFilter);
|
|
105
|
+
}
|
|
106
|
+
// ── Properties ──────────────────────────────────────────────────
|
|
107
|
+
properties(fileFilter) {
|
|
108
|
+
return collectProperties(this.vault.contentPath, fileFilter);
|
|
109
|
+
}
|
|
110
|
+
propertyGet(file, name) {
|
|
111
|
+
return readProperty(this.vault.contentPath, file, name);
|
|
112
|
+
}
|
|
113
|
+
propertySet(file, name, value) {
|
|
114
|
+
return setProperty(this.vault.contentPath, file, name, value);
|
|
115
|
+
}
|
|
116
|
+
propertyRemove(file, name) {
|
|
117
|
+
return removeProperty(this.vault.contentPath, file, name);
|
|
118
|
+
}
|
|
119
|
+
// ── Tasks ───────────────────────────────────────────────────────
|
|
120
|
+
tasks(opts) {
|
|
121
|
+
const all = collectTasks(this.vault, {
|
|
122
|
+
file: opts?.file,
|
|
123
|
+
daily: opts?.daily,
|
|
124
|
+
});
|
|
125
|
+
return filterTasks(all, {
|
|
126
|
+
done: opts?.done,
|
|
127
|
+
todo: opts?.todo,
|
|
128
|
+
status: opts?.status,
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
taskShow(file, line) {
|
|
132
|
+
return showTask(this.vault.contentPath, file, line);
|
|
133
|
+
}
|
|
134
|
+
taskUpdate(file, line, newStatus) {
|
|
135
|
+
return updateTask(this.vault.contentPath, file, line, newStatus);
|
|
136
|
+
}
|
|
137
|
+
// ── Links ───────────────────────────────────────────────────────
|
|
138
|
+
linksOut(file) {
|
|
139
|
+
return getOutgoingLinks(this.vault.contentPath, file);
|
|
140
|
+
}
|
|
141
|
+
linksBack(file) {
|
|
142
|
+
return getBacklinks(this.vault.contentPath, file);
|
|
143
|
+
}
|
|
144
|
+
linksUnresolved() {
|
|
145
|
+
return getUnresolvedLinks(this.vault.contentPath);
|
|
146
|
+
}
|
|
147
|
+
orphans() {
|
|
148
|
+
return getOrphans(this.vault.contentPath);
|
|
149
|
+
}
|
|
150
|
+
deadends() {
|
|
151
|
+
return getDeadends(this.vault.contentPath);
|
|
152
|
+
}
|
|
153
|
+
// ── Templates ───────────────────────────────────────────────────
|
|
154
|
+
templates() {
|
|
155
|
+
return listTemplates(this.vault);
|
|
156
|
+
}
|
|
157
|
+
templateRead(name, opts) {
|
|
158
|
+
return readTemplate(this.vault, name, opts);
|
|
159
|
+
}
|
|
160
|
+
templateInsert(templateName, file) {
|
|
161
|
+
return insertTemplate(this.vault, templateName, file);
|
|
162
|
+
}
|
|
163
|
+
// ── Bookmarks ───────────────────────────────────────────────────
|
|
164
|
+
bookmarks() {
|
|
165
|
+
const items = readBookmarks(this.vault.obsidianPath);
|
|
166
|
+
return flattenBookmarks(items);
|
|
167
|
+
}
|
|
168
|
+
bookmarkAdd(entry) {
|
|
169
|
+
return addBookmark(this.vault.obsidianPath, entry);
|
|
170
|
+
}
|
|
171
|
+
// ── Config ──────────────────────────────────────────────────────
|
|
172
|
+
config() {
|
|
173
|
+
return loadConfig(this.vault.configPath);
|
|
174
|
+
}
|
|
175
|
+
configGet(key) {
|
|
176
|
+
return getConfigValue(this.vault.configPath, key);
|
|
177
|
+
}
|
|
178
|
+
configSet(key, value) {
|
|
179
|
+
return setConfigValue(this.vault.configPath, key, value);
|
|
180
|
+
}
|
|
181
|
+
// ── Bases ───────────────────────────────────────────────────────
|
|
182
|
+
bases() {
|
|
183
|
+
return listBases(this.vault.contentPath);
|
|
184
|
+
}
|
|
185
|
+
baseViews(opts) {
|
|
186
|
+
const baseFile = resolveBaseFile(this.vault.contentPath, opts);
|
|
187
|
+
if (!baseFile)
|
|
188
|
+
throw new Error("Base file not found");
|
|
189
|
+
return getBaseViews(this.vault.contentPath, baseFile);
|
|
190
|
+
}
|
|
191
|
+
async baseQuery(opts, viewName) {
|
|
192
|
+
const baseFile = resolveBaseFile(this.vault.contentPath, opts);
|
|
193
|
+
if (!baseFile)
|
|
194
|
+
throw new Error("Base file not found");
|
|
195
|
+
return queryBaseFile(this.vault.contentPath, baseFile, viewName);
|
|
196
|
+
}
|
|
197
|
+
baseCreate(opts) {
|
|
198
|
+
return createBaseItem(this.vault.contentPath, opts);
|
|
199
|
+
}
|
|
200
|
+
// ── Canvas ──────────────────────────────────────────────────────
|
|
201
|
+
canvases() {
|
|
202
|
+
return listCanvases(this.vault.contentPath);
|
|
203
|
+
}
|
|
204
|
+
canvasRead(file) {
|
|
205
|
+
return resolveCanvas(this.vault.contentPath, file);
|
|
206
|
+
}
|
|
207
|
+
canvasCreate(fileName, folder) {
|
|
208
|
+
return createCanvas(this.vault.contentPath, fileName, folder);
|
|
209
|
+
}
|
|
210
|
+
canvasAddNode(file, opts) {
|
|
211
|
+
return addCanvasNode(this.vault.contentPath, file, opts);
|
|
212
|
+
}
|
|
213
|
+
canvasAddEdge(file, opts) {
|
|
214
|
+
return addCanvasEdge(this.vault.contentPath, file, opts);
|
|
215
|
+
}
|
|
216
|
+
canvasRemoveNode(file, nodeId) {
|
|
217
|
+
return removeCanvasNode(this.vault.contentPath, file, nodeId);
|
|
218
|
+
}
|
|
219
|
+
// ── Init (static) ──────────────────────────────────────────────
|
|
220
|
+
static scaffold(path, opts) {
|
|
221
|
+
return scaffoldVault(path, opts?.template);
|
|
222
|
+
}
|
|
223
|
+
static vaultTemplates() {
|
|
224
|
+
return getInitTemplates();
|
|
225
|
+
}
|
|
226
|
+
static registerTemplate(template) {
|
|
227
|
+
registerTemplate(template);
|
|
228
|
+
}
|
|
229
|
+
static addTemplate(path, template) {
|
|
230
|
+
return addTemplate(path, template);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
export const coding = {
|
|
2
|
+
name: "coding",
|
|
3
|
+
description: "Software project knowledge base",
|
|
4
|
+
dirs: ["decisions", "architecture", "guides", "changelog", "daily"],
|
|
5
|
+
files: {
|
|
6
|
+
"decisions/_about.md": `# Decisions
|
|
7
|
+
|
|
8
|
+
Architecture Decision Records (ADRs). One file per decision.
|
|
9
|
+
`,
|
|
10
|
+
"architecture/_about.md": `# Architecture
|
|
11
|
+
|
|
12
|
+
System design docs, diagrams, and technical specs.
|
|
13
|
+
`,
|
|
14
|
+
"guides/_about.md": `# Guides
|
|
15
|
+
|
|
16
|
+
How-tos, setup instructions, onboarding docs, and troubleshooting.
|
|
17
|
+
`,
|
|
18
|
+
"changelog/_about.md": `# Changelog
|
|
19
|
+
|
|
20
|
+
Release notes and version history.
|
|
21
|
+
`,
|
|
22
|
+
"Templates/Decision.md": `---
|
|
23
|
+
status: proposed
|
|
24
|
+
date: "{{date}}"
|
|
25
|
+
---
|
|
26
|
+
# {{title}}
|
|
27
|
+
|
|
28
|
+
## Context
|
|
29
|
+
What prompted this decision?
|
|
30
|
+
|
|
31
|
+
## Decision
|
|
32
|
+
What did we decide?
|
|
33
|
+
|
|
34
|
+
## Consequences
|
|
35
|
+
What are the trade-offs?
|
|
36
|
+
`,
|
|
37
|
+
"Templates/Architecture.md": `---
|
|
38
|
+
date: "{{date}}"
|
|
39
|
+
---
|
|
40
|
+
# {{title}}
|
|
41
|
+
|
|
42
|
+
## Overview
|
|
43
|
+
What is this component/system?
|
|
44
|
+
|
|
45
|
+
## Design
|
|
46
|
+
How does it work?
|
|
47
|
+
|
|
48
|
+
## Dependencies
|
|
49
|
+
What does it depend on? What depends on it?
|
|
50
|
+
|
|
51
|
+
## Open questions
|
|
52
|
+
-
|
|
53
|
+
`,
|
|
54
|
+
"Templates/Guide.md": `---
|
|
55
|
+
date: "{{date}}"
|
|
56
|
+
---
|
|
57
|
+
# {{title}}
|
|
58
|
+
|
|
59
|
+
## Prerequisites
|
|
60
|
+
-
|
|
61
|
+
|
|
62
|
+
## Steps
|
|
63
|
+
1.
|
|
64
|
+
|
|
65
|
+
## Troubleshooting
|
|
66
|
+
-
|
|
67
|
+
`,
|
|
68
|
+
"Templates/Changelog.md": `---
|
|
69
|
+
version: ""
|
|
70
|
+
date: "{{date}}"
|
|
71
|
+
---
|
|
72
|
+
# {{title}}
|
|
73
|
+
|
|
74
|
+
## Added
|
|
75
|
+
-
|
|
76
|
+
|
|
77
|
+
## Changed
|
|
78
|
+
-
|
|
79
|
+
|
|
80
|
+
## Fixed
|
|
81
|
+
-
|
|
82
|
+
`,
|
|
83
|
+
},
|
|
84
|
+
napkinMd: `# Project name
|
|
85
|
+
|
|
86
|
+
## What is this?
|
|
87
|
+
Brief description of the project.
|
|
88
|
+
|
|
89
|
+
## Tech stack
|
|
90
|
+
- Language:
|
|
91
|
+
- Framework:
|
|
92
|
+
- Database:
|
|
93
|
+
- Infrastructure:
|
|
94
|
+
|
|
95
|
+
## Key conventions
|
|
96
|
+
-
|
|
97
|
+
|
|
98
|
+
## Key decisions
|
|
99
|
+
-
|
|
100
|
+
|
|
101
|
+
## Active work
|
|
102
|
+
-
|
|
103
|
+
`,
|
|
104
|
+
};
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
export const company = {
|
|
2
|
+
name: "company",
|
|
3
|
+
description: "Team and organization knowledge base",
|
|
4
|
+
dirs: [
|
|
5
|
+
"people",
|
|
6
|
+
"projects",
|
|
7
|
+
"runbooks",
|
|
8
|
+
"infrastructure",
|
|
9
|
+
"onboarding",
|
|
10
|
+
"daily",
|
|
11
|
+
],
|
|
12
|
+
files: {
|
|
13
|
+
"people/_about.md": `# People
|
|
14
|
+
|
|
15
|
+
Team members, roles, and ownership. One note per person.
|
|
16
|
+
`,
|
|
17
|
+
"projects/_about.md": `# Projects
|
|
18
|
+
|
|
19
|
+
Active projects and initiatives. Archive completed ones.
|
|
20
|
+
`,
|
|
21
|
+
"runbooks/_about.md": `# Runbooks
|
|
22
|
+
|
|
23
|
+
Operational procedures. Step-by-step guides for recurring tasks.
|
|
24
|
+
`,
|
|
25
|
+
"infrastructure/_about.md": `# Infrastructure
|
|
26
|
+
|
|
27
|
+
Tools, services, repositories, and how they connect.
|
|
28
|
+
`,
|
|
29
|
+
"onboarding/_about.md": `# Onboarding
|
|
30
|
+
|
|
31
|
+
Getting new team members and agents up to speed.
|
|
32
|
+
`,
|
|
33
|
+
"Templates/Person.md": `---
|
|
34
|
+
role: ""
|
|
35
|
+
team: ""
|
|
36
|
+
owner: ""
|
|
37
|
+
---
|
|
38
|
+
# {{title}}
|
|
39
|
+
|
|
40
|
+
## Role
|
|
41
|
+
What does this person do?
|
|
42
|
+
|
|
43
|
+
## Responsibilities
|
|
44
|
+
-
|
|
45
|
+
|
|
46
|
+
## Contact
|
|
47
|
+
-
|
|
48
|
+
`,
|
|
49
|
+
"Templates/Runbook.md": `---
|
|
50
|
+
owner: ""
|
|
51
|
+
last_verified: "{{date}}"
|
|
52
|
+
---
|
|
53
|
+
# {{title}}
|
|
54
|
+
|
|
55
|
+
## Goal
|
|
56
|
+
What does this runbook accomplish?
|
|
57
|
+
|
|
58
|
+
## Steps
|
|
59
|
+
1.
|
|
60
|
+
|
|
61
|
+
## Verification
|
|
62
|
+
- [ ] How to confirm it worked
|
|
63
|
+
|
|
64
|
+
## Troubleshooting
|
|
65
|
+
-
|
|
66
|
+
`,
|
|
67
|
+
"Templates/Project.md": `---
|
|
68
|
+
status: active
|
|
69
|
+
owner: ""
|
|
70
|
+
started: "{{date}}"
|
|
71
|
+
---
|
|
72
|
+
# {{title}}
|
|
73
|
+
|
|
74
|
+
## Objective
|
|
75
|
+
What are we trying to achieve?
|
|
76
|
+
|
|
77
|
+
## Key results
|
|
78
|
+
- [ ]
|
|
79
|
+
|
|
80
|
+
## Team
|
|
81
|
+
-
|
|
82
|
+
|
|
83
|
+
## Notes
|
|
84
|
+
-
|
|
85
|
+
`,
|
|
86
|
+
"Templates/Onboarding.md": `---
|
|
87
|
+
role: ""
|
|
88
|
+
date: "{{date}}"
|
|
89
|
+
---
|
|
90
|
+
# Onboarding — {{title}}
|
|
91
|
+
|
|
92
|
+
## Checklist
|
|
93
|
+
- [ ] Access granted
|
|
94
|
+
- [ ] Tools set up
|
|
95
|
+
- [ ] Key docs reviewed
|
|
96
|
+
- [ ] First task assigned
|
|
97
|
+
|
|
98
|
+
## Notes
|
|
99
|
+
-
|
|
100
|
+
`,
|
|
101
|
+
},
|
|
102
|
+
napkinMd: `# Company name
|
|
103
|
+
|
|
104
|
+
## What do we do?
|
|
105
|
+
Brief description.
|
|
106
|
+
|
|
107
|
+
## Team
|
|
108
|
+
-
|
|
109
|
+
|
|
110
|
+
## Communication
|
|
111
|
+
- Primary channel:
|
|
112
|
+
- Task tracking:
|
|
113
|
+
- Documentation:
|
|
114
|
+
|
|
115
|
+
## Key tools & services
|
|
116
|
+
-
|
|
117
|
+
|
|
118
|
+
## Active projects
|
|
119
|
+
-
|
|
120
|
+
`,
|
|
121
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { coding } from "./coding.js";
|
|
2
|
+
import { company } from "./company.js";
|
|
3
|
+
import { personal } from "./personal.js";
|
|
4
|
+
import { product } from "./product.js";
|
|
5
|
+
import { research } from "./research.js";
|
|
6
|
+
export const TEMPLATES = {
|
|
7
|
+
coding,
|
|
8
|
+
personal,
|
|
9
|
+
research,
|
|
10
|
+
company,
|
|
11
|
+
product,
|
|
12
|
+
};
|
|
13
|
+
export function registerTemplate(template) {
|
|
14
|
+
TEMPLATES[template.name] = template;
|
|
15
|
+
}
|