diffwiki-core 0.14.0 → 0.15.0
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/dist/bm25.cjs +6 -0
- package/dist/bm25.js +1 -1
- package/dist/chunk-6MW6KSS4.js +278 -0
- package/dist/{chunk-FTUF6IXS.js → chunk-TK2373AM.js} +6 -0
- package/dist/{chunk-7V2DIQNL.js → chunk-TXM4OGBA.js} +12 -3
- package/dist/{events-AVD3G5AX.js → events-K3MKWACA.js} +1 -1
- package/dist/frontmatter-ghMCpLNf.d.cts +585 -0
- package/dist/frontmatter-ghMCpLNf.d.ts +585 -0
- package/dist/index.cjs +303 -195
- package/dist/index.d.cts +69 -359
- package/dist/index.d.ts +69 -359
- package/dist/index.js +200 -189
- package/dist/plugin.cjs +134 -2
- package/dist/plugin.d.cts +54 -177
- package/dist/plugin.d.ts +54 -177
- package/dist/plugin.js +9 -3
- package/package.json +1 -1
- package/dist/chunk-EEETAETA.js +0 -145
package/dist/index.d.cts
CHANGED
|
@@ -1,347 +1,9 @@
|
|
|
1
|
+
import { C as Config, R as Registry, a as CollectionEntry, A as Audience, b as Article, P as PublishStatus, c as RepoConfig, d as ProjectConfig, S as SiteConfig, e as CollectionInfo, f as CollectionTree, g as PageData, h as ArticleNode, T as TreeNode, Q as QueryHit, i as QueryOptions, D as Diagnostic, j as ParsedArticle, k as ArticleContent, l as TocItem, L as LinkGraph, m as LocalGraph, n as SearchMode, o as SearchProvider, p as PluginRecord, q as PluginEvent, r as PluginKind, s as PluginRegistryFile } from './frontmatter-ghMCpLNf.cjs';
|
|
2
|
+
export { t as CollectionType, u as DiagnosticLevel, v as DocData, G as GraphEdge, w as GraphNode, H as HomeCard, x as ListingEntry, N as NATIVE_ENGINE, y as NodeMeta, z as PluginCapabilities, B as PluginHealth, E as PluginReadiness, F as ProjectCollection, I as ProjectContext, J as SearchExpansion, K as SerializableArticle, M as SiteCopyright, O as SiteHome, U as parseArticle, V as parseFrontmatter, W as serializeArticle, X as stripFrontmatter } from './frontmatter-ghMCpLNf.cjs';
|
|
1
3
|
import { SearchDoc } from './bm25.cjs';
|
|
2
4
|
export { RankableFields, rankDocs, tokenize } from './bm25.cjs';
|
|
3
5
|
import { LogLevel, Logger } from '@logtape/logtape';
|
|
4
6
|
|
|
5
|
-
/** Audience axis — who an article is for. Private is never published; system is diffwiki-internal (hidden unless `showSystem`). Missing/invalid → 'public'. */
|
|
6
|
-
type Audience = 'public' | 'private' | 'system';
|
|
7
|
-
/** Lifecycle axis — readiness. Draft is unpublished; deprecated is superseded. Missing/invalid → 'published'. */
|
|
8
|
-
type PublishStatus = 'draft' | 'published' | 'deprecated';
|
|
9
|
-
type CollectionType = 'global' | 'repo' | 'external';
|
|
10
|
-
interface CollectionEntry {
|
|
11
|
-
name: string;
|
|
12
|
-
type: CollectionType;
|
|
13
|
-
/** Absolute path to the collection's content directory. */
|
|
14
|
-
path: string;
|
|
15
|
-
createdAt: string;
|
|
16
|
-
/** Marks a diffwiki-internal collection (e.g. `transcripts`). 'system' hides it unless `showSystem`. */
|
|
17
|
-
audience?: Audience;
|
|
18
|
-
/** External only: stable git repo id (see `repoId`). Identity + dedupe key. */
|
|
19
|
-
id?: string;
|
|
20
|
-
/** External only: absolute repo root (branch/behind + open-at-root). */
|
|
21
|
-
repoRoot?: string;
|
|
22
|
-
/** External only: content dir relative to `repoRoot` (default "docs"). */
|
|
23
|
-
docsDir?: string;
|
|
24
|
-
}
|
|
25
|
-
interface Registry {
|
|
26
|
-
version: number;
|
|
27
|
-
collections: CollectionEntry[];
|
|
28
|
-
}
|
|
29
|
-
interface Config {
|
|
30
|
-
defaultCollection?: string;
|
|
31
|
-
defaultSearch?: string;
|
|
32
|
-
/** Editor command used by `diffwiki edit` (e.g. "code -w", "hx"). Falls back to $VISUAL/$EDITOR. */
|
|
33
|
-
editor?: string;
|
|
34
|
-
/** Reveal system-audience content in search, nav, and the UI (default: false). Stored as boolean or "true". */
|
|
35
|
-
showSystem?: boolean;
|
|
36
|
-
}
|
|
37
|
-
interface Article {
|
|
38
|
-
title: string;
|
|
39
|
-
tags: string[];
|
|
40
|
-
/** Absolute path to the article file. */
|
|
41
|
-
path: string;
|
|
42
|
-
collection: string;
|
|
43
|
-
}
|
|
44
|
-
interface RepoConfig {
|
|
45
|
-
collection: string;
|
|
46
|
-
/** Path to the wiki directory, relative to the repo root. */
|
|
47
|
-
path: string;
|
|
48
|
-
}
|
|
49
|
-
/** A home-page card (VitePress-style): icon + title + subtitle linking into the site. */
|
|
50
|
-
interface HomeCard {
|
|
51
|
-
/** Icon name from the curated home-card icon set; unknown/missing → no icon. */
|
|
52
|
-
icon?: string;
|
|
53
|
-
title: string;
|
|
54
|
-
subtitle?: string;
|
|
55
|
-
/** In-site path, e.g. "/getting-started". */
|
|
56
|
-
link: string;
|
|
57
|
-
}
|
|
58
|
-
/** Home-page customization from `diffwiki.yaml` → `site.home`. */
|
|
59
|
-
interface SiteHome {
|
|
60
|
-
/** Line shown under the wordmark on the home page. */
|
|
61
|
-
tagline?: string;
|
|
62
|
-
/** Cards rendered below the search bar. */
|
|
63
|
-
cards?: HomeCard[];
|
|
64
|
-
}
|
|
65
|
-
/** Footer copyright notice from `diffwiki.yaml` → `site.copyright`. Applies to the
|
|
66
|
-
* site/software; article CONTENT copyright stays with its respective authors. */
|
|
67
|
-
interface SiteCopyright {
|
|
68
|
-
/** The full notice text, e.g. "© 2026 Acme, Inc." */
|
|
69
|
-
text: string;
|
|
70
|
-
/** Optional URL — renders the notice as a link. */
|
|
71
|
-
url?: string;
|
|
72
|
-
}
|
|
73
|
-
/** Site-level config from `diffwiki.yaml` → `site`. The diffwiki logo + wordmark
|
|
74
|
-
* are fixed branding and deliberately not configurable. */
|
|
75
|
-
interface SiteConfig {
|
|
76
|
-
/** Project repository URL for the top-nav GitHub link. */
|
|
77
|
-
repo?: string;
|
|
78
|
-
/** Footer copyright notice; no default — the footer is empty when unset. */
|
|
79
|
-
copyright?: SiteCopyright;
|
|
80
|
-
home?: SiteHome;
|
|
81
|
-
}
|
|
82
|
-
/** One collection declared in `diffwiki.yaml` → `collections[]`. */
|
|
83
|
-
interface ProjectCollection {
|
|
84
|
-
name: string;
|
|
85
|
-
/** Content directory, relative to the project root. */
|
|
86
|
-
path: string;
|
|
87
|
-
/** Optional display order (ascending). Unset sorts after ordered ones, keeping list order. */
|
|
88
|
-
order?: number;
|
|
89
|
-
}
|
|
90
|
-
/** Optional recall/search context from `diffwiki.yaml` → `context`. */
|
|
91
|
-
interface ProjectContext {
|
|
92
|
-
/** Collection names recall/search should filter to by default. */
|
|
93
|
-
collections: string[];
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* Normalised repo-root `diffwiki.yaml`. The extended form carries `site` +
|
|
97
|
-
* `collections[]`; the legacy `{ collection, path }` form is folded into a
|
|
98
|
-
* one-element `collections` by the parser.
|
|
99
|
-
*/
|
|
100
|
-
interface ProjectConfig {
|
|
101
|
-
site?: SiteConfig;
|
|
102
|
-
collections: ProjectCollection[];
|
|
103
|
-
context?: ProjectContext;
|
|
104
|
-
}
|
|
105
|
-
/** A node in a collection's article tree. Branches have `children`; leaves have `slug`. */
|
|
106
|
-
interface ArticleNode {
|
|
107
|
-
/** Segment label — dir name for branches, filename-without-ext for leaves. */
|
|
108
|
-
name: string;
|
|
109
|
-
/** Display title — frontmatter `title` (leaf) or the folder's index title, else `name`. */
|
|
110
|
-
title?: string;
|
|
111
|
-
/**
|
|
112
|
-
* Path within the collection, without extension, e.g. "guide/setup". Set on
|
|
113
|
-
* leaves (the article) and on branches (the folder, navigable to its index).
|
|
114
|
-
*/
|
|
115
|
-
slug?: string;
|
|
116
|
-
/** Audience, set only when 'private' (omitted for 'public'). */
|
|
117
|
-
audience?: Audience;
|
|
118
|
-
/** Lifecycle status, set only when 'draft' (omitted for 'published'). */
|
|
119
|
-
status?: PublishStatus;
|
|
120
|
-
/** Frontmatter `order` — nav sort within a folder (ascending; unset sorts after). */
|
|
121
|
-
order?: number;
|
|
122
|
-
/** Branch only: nested nodes. */
|
|
123
|
-
children?: ArticleNode[];
|
|
124
|
-
}
|
|
125
|
-
/** A resolved article's content, returned by `readArticle`. */
|
|
126
|
-
interface ArticleContent {
|
|
127
|
-
coll: string;
|
|
128
|
-
slug: string;
|
|
129
|
-
title: string;
|
|
130
|
-
tags: string[];
|
|
131
|
-
/** Audience from frontmatter ('public' when absent). */
|
|
132
|
-
audience: Audience;
|
|
133
|
-
/** Lifecycle status from frontmatter ('published' when absent). */
|
|
134
|
-
status: PublishStatus;
|
|
135
|
-
/** Frontmatter-stripped body (md/mdx). */
|
|
136
|
-
body: string;
|
|
137
|
-
/** Absolute path to the file on disk. */
|
|
138
|
-
path: string;
|
|
139
|
-
/**
|
|
140
|
-
* True when the resolved file is a folder-index page (`<slug>/index.md` or
|
|
141
|
-
* `<slug>/README.md`) rather than a leaf `<slug>.md`. The route slug is the
|
|
142
|
-
* same for both, so this flag is needed to resolve folder-local relative
|
|
143
|
-
* links against the article's own folder.
|
|
144
|
-
*/
|
|
145
|
-
isIndex: boolean;
|
|
146
|
-
}
|
|
147
|
-
type PluginKind = 'search';
|
|
148
|
-
declare const NATIVE_ENGINE = "native";
|
|
149
|
-
interface QueryOptions {
|
|
150
|
-
engine?: string;
|
|
151
|
-
/** Limit to a single collection name, or a set of names. Empty/undefined = all. */
|
|
152
|
-
collection?: string | string[];
|
|
153
|
-
type?: string;
|
|
154
|
-
limit?: number;
|
|
155
|
-
/** Reveal system-audience content (default: config `showSystem`, else false). */
|
|
156
|
-
showSystem?: boolean;
|
|
157
|
-
}
|
|
158
|
-
interface QueryHit {
|
|
159
|
-
collection: string;
|
|
160
|
-
path: string;
|
|
161
|
-
title: string;
|
|
162
|
-
tags: string[];
|
|
163
|
-
snippet?: string;
|
|
164
|
-
score?: number;
|
|
165
|
-
docid?: string;
|
|
166
|
-
}
|
|
167
|
-
type DiagnosticLevel = 'ok' | 'warn' | 'error';
|
|
168
|
-
interface Diagnostic {
|
|
169
|
-
level: DiagnosticLevel;
|
|
170
|
-
message: string;
|
|
171
|
-
}
|
|
172
|
-
interface PluginRecord {
|
|
173
|
-
name: string;
|
|
174
|
-
kind: PluginKind;
|
|
175
|
-
command: string[];
|
|
176
|
-
version?: string;
|
|
177
|
-
/** Capabilities cached at install/register time via the `describe` op. */
|
|
178
|
-
capabilities?: PluginCapabilities;
|
|
179
|
-
enabled: boolean;
|
|
180
|
-
managed?: boolean;
|
|
181
|
-
}
|
|
182
|
-
interface PluginRegistryFile {
|
|
183
|
-
version: number;
|
|
184
|
-
plugins: PluginRecord[];
|
|
185
|
-
}
|
|
186
|
-
/** Capabilities a plugin advertises via the `describe` op, cached in the registry. */
|
|
187
|
-
interface PluginCapabilities {
|
|
188
|
-
/** Search types the plugin supports (e.g. `['keyword', 'semantic', 'hybrid']`). */
|
|
189
|
-
searchTypes: string[];
|
|
190
|
-
/** Whether the plugin supports filtering results by collection. */
|
|
191
|
-
collectionFilter: boolean;
|
|
192
|
-
/** Whether the plugin handles lifecycle events (article/collection mutations). */
|
|
193
|
-
events: boolean;
|
|
194
|
-
}
|
|
195
|
-
interface PluginReadiness {
|
|
196
|
-
toolInstalled: boolean;
|
|
197
|
-
modelsPresent: boolean;
|
|
198
|
-
indexBuilt: boolean;
|
|
199
|
-
docsIndexed: number;
|
|
200
|
-
embeddingsPending: number;
|
|
201
|
-
firstSearchCost: 'instant' | 'model-load' | 'model-download';
|
|
202
|
-
}
|
|
203
|
-
interface PluginHealth {
|
|
204
|
-
ready: boolean;
|
|
205
|
-
readiness?: PluginReadiness;
|
|
206
|
-
diagnostics: Diagnostic[];
|
|
207
|
-
}
|
|
208
|
-
interface SearchMode {
|
|
209
|
-
plugin: string;
|
|
210
|
-
type: string;
|
|
211
|
-
label: string;
|
|
212
|
-
}
|
|
213
|
-
type PluginEvent = 'collection-added' | 'collection-removed' | 'article-created' | 'article-updated' | 'article-removed';
|
|
214
|
-
/**
|
|
215
|
-
* Host-side facade for a search plugin. Each method is backed by a one-shot
|
|
216
|
-
* subprocess invocation -- there is no persistent process and no `close()`.
|
|
217
|
-
*/
|
|
218
|
-
interface SearchProvider {
|
|
219
|
-
/** Plugin name. */
|
|
220
|
-
name: string;
|
|
221
|
-
/** Plugin capabilities (cached from the `describe` op). */
|
|
222
|
-
capabilities: PluginCapabilities;
|
|
223
|
-
/** Run a search query and return hits with absolute paths. */
|
|
224
|
-
handleSearch(term: string, collections: CollectionEntry[], opts?: QueryOptions): Promise<QueryHit[]>;
|
|
225
|
-
/** Rebuild the search index. Returns the number of documents indexed. */
|
|
226
|
-
reindex(collections: CollectionEntry[], opts?: {
|
|
227
|
-
embed?: boolean;
|
|
228
|
-
}): Promise<number>;
|
|
229
|
-
/** Emit a lifecycle event to the plugin (best-effort). */
|
|
230
|
-
emitEvent(event: PluginEvent, collection: string, relPath: string | undefined, collections: CollectionEntry[]): Promise<void>;
|
|
231
|
-
/** Check plugin health and readiness. */
|
|
232
|
-
health(collections: CollectionEntry[]): Promise<PluginHealth>;
|
|
233
|
-
}
|
|
234
|
-
interface NodeMeta {
|
|
235
|
-
branch?: string;
|
|
236
|
-
behind?: number;
|
|
237
|
-
}
|
|
238
|
-
interface TreeNode {
|
|
239
|
-
name: string;
|
|
240
|
-
title?: string;
|
|
241
|
-
path?: string;
|
|
242
|
-
/** Audience; present only when 'private' (drives the sidebar lock). */
|
|
243
|
-
audience?: Audience;
|
|
244
|
-
/** Lifecycle status; present only when 'draft' (drives the sidebar DRAFT tag). */
|
|
245
|
-
status?: PublishStatus;
|
|
246
|
-
children?: TreeNode[];
|
|
247
|
-
/** Set only on top-level collection rows: git branch/behind badge data. */
|
|
248
|
-
meta?: NodeMeta;
|
|
249
|
-
}
|
|
250
|
-
interface CollectionInfo {
|
|
251
|
-
name: string;
|
|
252
|
-
type: CollectionType;
|
|
253
|
-
path: string;
|
|
254
|
-
/** Display title from the collection's root index page frontmatter; falls back to `name` in the UI. */
|
|
255
|
-
title?: string;
|
|
256
|
-
branch?: string;
|
|
257
|
-
behind?: number;
|
|
258
|
-
/** Audience from the collection's root index page; present only when 'private'. */
|
|
259
|
-
audience?: Audience;
|
|
260
|
-
/** Lifecycle status from the collection's root index page; present only when 'draft'. */
|
|
261
|
-
status?: PublishStatus;
|
|
262
|
-
}
|
|
263
|
-
interface CollectionTree {
|
|
264
|
-
collection: CollectionInfo;
|
|
265
|
-
nodes: TreeNode[];
|
|
266
|
-
}
|
|
267
|
-
interface TocItem {
|
|
268
|
-
slug: string;
|
|
269
|
-
text: string;
|
|
270
|
-
depth: number;
|
|
271
|
-
}
|
|
272
|
-
interface DocData {
|
|
273
|
-
coll: string;
|
|
274
|
-
slug: string;
|
|
275
|
-
title: string;
|
|
276
|
-
tags: string[];
|
|
277
|
-
/** Audience; present only when 'private'. */
|
|
278
|
-
audience?: Audience;
|
|
279
|
-
/** Lifecycle status; present only when 'draft'. */
|
|
280
|
-
status?: PublishStatus;
|
|
281
|
-
html: string;
|
|
282
|
-
toc: TocItem[];
|
|
283
|
-
path: string;
|
|
284
|
-
/** ISO-8601 creation date, sourced from git history / filesystem (not frontmatter). */
|
|
285
|
-
created?: string;
|
|
286
|
-
/** ISO-8601 last-update date, sourced from git history / filesystem (not frontmatter). */
|
|
287
|
-
updated?: string;
|
|
288
|
-
/** Local knowledge-graph neighbourhood for this page (this node + its direct links). */
|
|
289
|
-
graph: LocalGraph;
|
|
290
|
-
}
|
|
291
|
-
interface ListingEntry {
|
|
292
|
-
name: string;
|
|
293
|
-
title: string;
|
|
294
|
-
path: string;
|
|
295
|
-
isDir: boolean;
|
|
296
|
-
}
|
|
297
|
-
type PageData = ({
|
|
298
|
-
kind: 'doc';
|
|
299
|
-
} & DocData) | {
|
|
300
|
-
kind: 'listing';
|
|
301
|
-
coll: string;
|
|
302
|
-
slug: string;
|
|
303
|
-
title: string;
|
|
304
|
-
entries: ListingEntry[];
|
|
305
|
-
};
|
|
306
|
-
/**
|
|
307
|
-
* One node in the knowledge graph. Two kinds:
|
|
308
|
-
* - `article` — a wiki page. `id` is `"<coll>/<slug>"`, with `coll`/`slug` set.
|
|
309
|
-
* - `tag` — an Obsidian-style tag hub. `id` is `"tag:<name>"`; `coll`/`slug` are
|
|
310
|
-
* empty (a tag is not a page, so clicking it never navigates), `title` is `#name`.
|
|
311
|
-
*/
|
|
312
|
-
interface GraphNode {
|
|
313
|
-
id: string;
|
|
314
|
-
kind: 'article' | 'tag';
|
|
315
|
-
coll: string;
|
|
316
|
-
slug: string;
|
|
317
|
-
title: string;
|
|
318
|
-
}
|
|
319
|
-
/**
|
|
320
|
-
* A graph edge. `kind` distinguishes an explicit hyperlink between two articles
|
|
321
|
-
* (`link`) from an article↔tag-hub membership edge (`tag`). For `link` edges the
|
|
322
|
-
* direction (source→target) is the link direction; `tag` edges go article→tag.
|
|
323
|
-
*/
|
|
324
|
-
interface GraphEdge {
|
|
325
|
-
source: string;
|
|
326
|
-
target: string;
|
|
327
|
-
kind: 'link' | 'tag';
|
|
328
|
-
}
|
|
329
|
-
/** The whole-wiki knowledge graph. */
|
|
330
|
-
interface LinkGraph {
|
|
331
|
-
nodes: GraphNode[];
|
|
332
|
-
edges: GraphEdge[];
|
|
333
|
-
}
|
|
334
|
-
/**
|
|
335
|
-
* The local neighbourhood of one node: the node itself plus its directly linked
|
|
336
|
-
* (outgoing) and linking (incoming) neighbours, and the edges among them. `focus`
|
|
337
|
-
* is the id of the page this neighbourhood is centred on.
|
|
338
|
-
*/
|
|
339
|
-
interface LocalGraph {
|
|
340
|
-
focus: string;
|
|
341
|
-
nodes: GraphNode[];
|
|
342
|
-
edges: GraphEdge[];
|
|
343
|
-
}
|
|
344
|
-
|
|
345
7
|
/** Base class for all expected, user-facing diffwiki failures. */
|
|
346
8
|
declare class DiffwikiError extends Error {
|
|
347
9
|
constructor(message: string);
|
|
@@ -378,10 +40,58 @@ declare function resolveHome(): string;
|
|
|
378
40
|
declare function registryPath(): string;
|
|
379
41
|
declare function configPath(): string;
|
|
380
42
|
declare function collectionsDir(): string;
|
|
43
|
+
/** Where authoring templates live (user-overridable), seeded by `diffwiki templates init`. */
|
|
44
|
+
declare function templatesDir(): string;
|
|
381
45
|
declare function collectionDir(name: string): string;
|
|
382
46
|
declare function pluginsDir(): string;
|
|
383
47
|
declare function pluginsRegistryPath(): string;
|
|
384
48
|
|
|
49
|
+
/**
|
|
50
|
+
* Authoring-template seeding.
|
|
51
|
+
*
|
|
52
|
+
* The wiki authoring templates ship bundled with the CLI and are seeded into
|
|
53
|
+
* `~/.diffwiki/templates` (user-overridable) by `diffwiki templates init`.
|
|
54
|
+
* The dw-* skills/agents then resolve templates from there. This module owns
|
|
55
|
+
* the copy logic; the CLI supplies the bundled source directory.
|
|
56
|
+
*
|
|
57
|
+
* @module
|
|
58
|
+
*/
|
|
59
|
+
interface SeedResult {
|
|
60
|
+
/** Files copied into the templates dir this run. */
|
|
61
|
+
seeded: string[];
|
|
62
|
+
/** Files skipped because a (user-owned) copy already existed. */
|
|
63
|
+
skipped: string[];
|
|
64
|
+
/** Absolute templates directory that was seeded. */
|
|
65
|
+
dir: string;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Copy bundled template files (`*.md`) from `srcDir` into `~/.diffwiki/templates`,
|
|
69
|
+
* **never overwriting** an existing file — a user's own template always wins.
|
|
70
|
+
* Creates the destination directory if needed.
|
|
71
|
+
*/
|
|
72
|
+
declare function seedTemplates(srcDir: string): Promise<SeedResult>;
|
|
73
|
+
/** The template shape names bundled at `srcDir`, e.g. `['guide', 'recipe', …]`. */
|
|
74
|
+
declare function listTemplateShapes(srcDir: string): Promise<string[]>;
|
|
75
|
+
/** A template's self-describing metadata, read from its frontmatter. */
|
|
76
|
+
interface TemplateInfo {
|
|
77
|
+
/** The shape id (frontmatter `shape:`, else the filename stem). */
|
|
78
|
+
shape: string;
|
|
79
|
+
/** One-line description of when to use this template (frontmatter `purpose:`). */
|
|
80
|
+
purpose: string;
|
|
81
|
+
/** Token budget `[min, max]` from frontmatter `budget:`, when present. */
|
|
82
|
+
budget?: [number, number];
|
|
83
|
+
/** The template file name. */
|
|
84
|
+
file: string;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* List the templates bundled at `srcDir` with their self-describing metadata
|
|
88
|
+
* (`shape`, `purpose`, `budget`) read from each file's frontmatter. This is the
|
|
89
|
+
* discovery API: skills call it (via `diffwiki templates list`) instead of
|
|
90
|
+
* hard-coding shape names, so dropping in a template with frontmatter
|
|
91
|
+
* makes it discoverable. Falls back to the filename stem when `shape:` is absent.
|
|
92
|
+
*/
|
|
93
|
+
declare function listTemplates(srcDir: string): Promise<TemplateInfo[]>;
|
|
94
|
+
|
|
385
95
|
declare function readConfig(): Promise<Config>;
|
|
386
96
|
declare function writeConfig(config: Config): Promise<void>;
|
|
387
97
|
declare function setConfigValue(key: string, value: string): Promise<void>;
|
|
@@ -400,24 +110,6 @@ declare function slugify(input: string): string;
|
|
|
400
110
|
/** Slugify a `/`-separated path segment-by-segment, preserving the separators. */
|
|
401
111
|
declare function slugifyPath(input: string): string;
|
|
402
112
|
|
|
403
|
-
interface ParsedArticle {
|
|
404
|
-
title: string;
|
|
405
|
-
tags: string[];
|
|
406
|
-
created?: string;
|
|
407
|
-
audience: Audience;
|
|
408
|
-
status: PublishStatus;
|
|
409
|
-
body: string;
|
|
410
|
-
}
|
|
411
|
-
interface SerializableArticle {
|
|
412
|
-
title: string;
|
|
413
|
-
tags: string[];
|
|
414
|
-
audience?: Audience;
|
|
415
|
-
status?: PublishStatus;
|
|
416
|
-
body: string;
|
|
417
|
-
}
|
|
418
|
-
declare function parseArticle(raw: string): ParsedArticle;
|
|
419
|
-
declare function serializeArticle(article: SerializableArticle): string;
|
|
420
|
-
|
|
421
113
|
declare function listCollections(): Promise<CollectionEntry[]>;
|
|
422
114
|
declare function findCollection(name: string): Promise<CollectionEntry | undefined>;
|
|
423
115
|
declare function findCollectionById(id: string): Promise<CollectionEntry | undefined>;
|
|
@@ -511,6 +203,14 @@ declare const PROJECT_CONFIG_FILE = "diffwiki.yaml";
|
|
|
511
203
|
declare function readProjectConfig(dir: string): Promise<ProjectConfig | undefined>;
|
|
512
204
|
/** The `context.collections` list from `diffwiki.yaml`, or `[]` when absent. */
|
|
513
205
|
declare function readContextCollections(dir: string): Promise<string[]>;
|
|
206
|
+
/**
|
|
207
|
+
* Write the recall/search `context.collections` list into `dir/diffwiki.yaml`,
|
|
208
|
+
* **preserving every other key and comment** (edited via the YAML Document API).
|
|
209
|
+
* Creates the file if absent. This is the single supported way to manage recall
|
|
210
|
+
* context — callers (the CLI, `dw-init`) should use it rather than hand-editing
|
|
211
|
+
* the YAML. Returns the file path written.
|
|
212
|
+
*/
|
|
213
|
+
declare function setContextCollections(dir: string, collections: string[]): Promise<string>;
|
|
514
214
|
/**
|
|
515
215
|
* Resolve `diffwiki.yaml` collections into registry-shaped CollectionEntry[] with
|
|
516
216
|
* absolute paths (relative to the project root). Empty when no config / no
|
|
@@ -1002,6 +702,16 @@ declare function installPlugin(spec: string, opts?: {
|
|
|
1002
702
|
* `describe`, caches capabilities, then runs `setup` best-effort.
|
|
1003
703
|
*/
|
|
1004
704
|
declare function registerPlugin(name: string, command: string[]): Promise<PluginRecord>;
|
|
705
|
+
/**
|
|
706
|
+
* Best-effort repair: re-run each enabled search plugin's `setup` op, which
|
|
707
|
+
* (re)installs missing system tools (via the plugin's auto-installer) and
|
|
708
|
+
* re-provisions the plugin. Returns per-plugin setup outcomes. Powers
|
|
709
|
+
* `diffwiki doctor --fix`.
|
|
710
|
+
*/
|
|
711
|
+
declare function repairPlugins(): Promise<Array<{
|
|
712
|
+
name: string;
|
|
713
|
+
setup: SetupOutcome;
|
|
714
|
+
}>>;
|
|
1005
715
|
/** Uninstall a managed plugin's package and deregister it. */
|
|
1006
716
|
declare function removePlugin(name: string): Promise<void>;
|
|
1007
717
|
/** List every registered plugin, marking whether it currently responds to `describe`. */
|
|
@@ -1085,4 +795,4 @@ declare function findEnabledPlugin(kind: PluginKind, name?: string): Promise<Plu
|
|
|
1085
795
|
/** Find a plugin record by name (regardless of enabled state). */
|
|
1086
796
|
declare function findPluginRecord(name: string): Promise<PluginRecord | undefined>;
|
|
1087
797
|
|
|
1088
|
-
export { type AddExternalOptions,
|
|
798
|
+
export { type AddExternalOptions, Article, ArticleContent, ArticleNode, ArticleNotFoundError, Audience, CollectionAlreadyAddedError, CollectionEntry, CollectionExistsError, type CollectionGitStatus, CollectionInfo, CollectionNotFoundError, type CollectionSelection, type CollectionSelectionResult, CollectionTree, Config, Diagnostic, DiffwikiError, type DiffwikiLogLevel, type EditTarget, type FileTimestamps, type InitOptions, type InstallOutcome, InvalidExportSelectionError, InvalidTargetError, type KnownPlugin, LinkGraph, type LintFileResult, type LintFinding, type LintLevel, type LintResult, LocalGraph, NoDefaultCollectionError, PROJECT_CONFIG_FILE, PageData, ParsedArticle, PluginError, PluginEvent, PluginKind, PluginRecord, PluginRegistryFile, ProjectConfig, PublishStatus, QueryHit, QueryOptions, REPO_CONFIG_FILE, Registry, type RenderContext, type RenderedArticle, RepoConfig, SearchDoc, SearchMode, type SearchOutcome, SearchProvider, type SeedResult, type SetupOutcome, type SetupStep, SiteConfig, type TemplateInfo, TocItem, TreeNode, type UpstreamStatus, WorktreeNotAllowedError, addExternalCollection, addTags, buildArticleTree, buildCollections, buildLinkGraph, buildNavTree, buildSearchIndex, buildSiteConfig, collectionDir, collectionGitStatus, collectionMeta, collectionsDir, configPath, createArticle, createCollection, currentBranch, deregisterPlugin, doctor, emitPluginEvent, ensureGitRepo, ensurePluginRoot, fileTimestamps, findCollection, findCollectionById, findEnabledPlugin, findPluginRecord, getConfigValue, getLogger, gitToplevel, initRepoWiki, installPlugin, invalidateLinkGraph, isLinkedWorktree, lintArticle, lintCollections, listArticleTree, listAvailablePlugins, listCollections, listEnabledPlugins, listPlugins, listSearchModes, listTemplateShapes, listTemplates, loadSearchProvider, localGraph, nativeSearch, parseAddTarget, parsePathTarget, pluginsDir, pluginsRegistryPath, query, readArticle, readConfig, readContextCollections, readPluginRegistry, readProjectConfig, readRegistry, readRepoConfig, readSiteConfig, registerCollection, registerPlugin, registryPath, removeArticle, removeCollection, removePlugin, removeTags, renderArticle, repairPlugins, repoId, repoRemoteName, resolveCollectionSelection, resolveCwdCollection, resolveDefaultSearchMode, resolveEditTarget, resolveEditorCommand, resolveHome, resolveLogLevel, resolvePage, resolveProjectCollections, search, seedProjectHome, seedTemplates, setArticleMeta, setConfigValue, setContextCollections, setTags, showSystemEnabled, slugify, slugifyPath, templatesDir, toTreeNodes, unregisterCollection, updateArticleBody, upsertPlugin, upstreamStatus, writeConfig, writePluginRegistry, writeRegistry };
|