diffwiki-core 0.7.0 → 0.8.0-rc.202607252154.25b2cb6
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/index.cjs +329 -82
- package/dist/index.d.cts +123 -2
- package/dist/index.d.ts +123 -2
- package/dist/index.js +320 -80
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -2,6 +2,10 @@ import { SearchDoc } from './bm25.cjs';
|
|
|
2
2
|
export { RankableFields, rankDocs, tokenize } from './bm25.cjs';
|
|
3
3
|
import { LogLevel, Logger } from '@logtape/logtape';
|
|
4
4
|
|
|
5
|
+
/** Audience axis — who an article is for. Private is never published. Missing/invalid → 'public'. */
|
|
6
|
+
type Audience = 'public' | 'private';
|
|
7
|
+
/** Lifecycle axis — readiness. Draft is not yet published. Missing/invalid → 'published'. */
|
|
8
|
+
type PublishStatus = 'draft' | 'published';
|
|
5
9
|
type CollectionType = 'global' | 'repo' | 'external';
|
|
6
10
|
interface CollectionEntry {
|
|
7
11
|
name: string;
|
|
@@ -36,6 +40,48 @@ interface RepoConfig {
|
|
|
36
40
|
/** Path to the wiki directory, relative to the repo root. */
|
|
37
41
|
path: string;
|
|
38
42
|
}
|
|
43
|
+
/** A home-page card (VitePress-style): icon + title + subtitle linking into the site. */
|
|
44
|
+
interface HomeCard {
|
|
45
|
+
/** Icon name from the curated home-card icon set; unknown/missing → no icon. */
|
|
46
|
+
icon?: string;
|
|
47
|
+
title: string;
|
|
48
|
+
subtitle?: string;
|
|
49
|
+
/** In-site path, e.g. "/getting-started". */
|
|
50
|
+
link: string;
|
|
51
|
+
}
|
|
52
|
+
/** Home-page customization from `diffwiki.yaml` → `site.home`. */
|
|
53
|
+
interface SiteHome {
|
|
54
|
+
/** Line shown under the wordmark on the home page. */
|
|
55
|
+
tagline?: string;
|
|
56
|
+
/** Cards rendered below the search bar. */
|
|
57
|
+
cards?: HomeCard[];
|
|
58
|
+
}
|
|
59
|
+
/** Site-level config from `diffwiki.yaml` → `site`. */
|
|
60
|
+
interface SiteConfig {
|
|
61
|
+
title?: string;
|
|
62
|
+
/** Logo override: path/URL to an image. Falls back to the built-in diffwiki mark. */
|
|
63
|
+
logo?: string;
|
|
64
|
+
/** Project repository URL for the top-nav GitHub link (NOT the "powered by" footer). */
|
|
65
|
+
repo?: string;
|
|
66
|
+
home?: SiteHome;
|
|
67
|
+
}
|
|
68
|
+
/** One collection declared in `diffwiki.yaml` → `collections[]`. */
|
|
69
|
+
interface ProjectCollection {
|
|
70
|
+
name: string;
|
|
71
|
+
/** Content directory, relative to the project root. */
|
|
72
|
+
path: string;
|
|
73
|
+
/** Optional display order (ascending). Unset sorts after ordered ones, keeping list order. */
|
|
74
|
+
order?: number;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Normalised repo-root `diffwiki.yaml`. The extended form carries `site` +
|
|
78
|
+
* `collections[]`; the legacy `{ collection, path }` form is folded into a
|
|
79
|
+
* one-element `collections` by the parser.
|
|
80
|
+
*/
|
|
81
|
+
interface ProjectConfig {
|
|
82
|
+
site?: SiteConfig;
|
|
83
|
+
collections: ProjectCollection[];
|
|
84
|
+
}
|
|
39
85
|
/** A node in a collection's article tree. Branches have `children`; leaves have `slug`. */
|
|
40
86
|
interface ArticleNode {
|
|
41
87
|
/** Segment label — dir name for branches, filename-without-ext for leaves. */
|
|
@@ -47,6 +93,10 @@ interface ArticleNode {
|
|
|
47
93
|
* leaves (the article) and on branches (the folder, navigable to its index).
|
|
48
94
|
*/
|
|
49
95
|
slug?: string;
|
|
96
|
+
/** Audience, set only when 'private' (omitted for 'public'). */
|
|
97
|
+
audience?: Audience;
|
|
98
|
+
/** Lifecycle status, set only when 'draft' (omitted for 'published'). */
|
|
99
|
+
status?: PublishStatus;
|
|
50
100
|
/** Branch only: nested nodes. */
|
|
51
101
|
children?: ArticleNode[];
|
|
52
102
|
}
|
|
@@ -56,6 +106,10 @@ interface ArticleContent {
|
|
|
56
106
|
slug: string;
|
|
57
107
|
title: string;
|
|
58
108
|
tags: string[];
|
|
109
|
+
/** Audience from frontmatter ('public' when absent). */
|
|
110
|
+
audience: Audience;
|
|
111
|
+
/** Lifecycle status from frontmatter ('published' when absent). */
|
|
112
|
+
status: PublishStatus;
|
|
59
113
|
/** Frontmatter-stripped body (md/mdx). */
|
|
60
114
|
body: string;
|
|
61
115
|
/** Absolute path to the file on disk. */
|
|
@@ -160,6 +214,10 @@ interface TreeNode {
|
|
|
160
214
|
name: string;
|
|
161
215
|
title?: string;
|
|
162
216
|
path?: string;
|
|
217
|
+
/** Audience; present only when 'private' (drives the sidebar lock). */
|
|
218
|
+
audience?: Audience;
|
|
219
|
+
/** Lifecycle status; present only when 'draft' (drives the sidebar DRAFT tag). */
|
|
220
|
+
status?: PublishStatus;
|
|
163
221
|
children?: TreeNode[];
|
|
164
222
|
/** Set only on top-level collection rows: git branch/behind badge data. */
|
|
165
223
|
meta?: NodeMeta;
|
|
@@ -168,8 +226,14 @@ interface CollectionInfo {
|
|
|
168
226
|
name: string;
|
|
169
227
|
type: CollectionType;
|
|
170
228
|
path: string;
|
|
229
|
+
/** Display title from the collection's root index page frontmatter; falls back to `name` in the UI. */
|
|
230
|
+
title?: string;
|
|
171
231
|
branch?: string;
|
|
172
232
|
behind?: number;
|
|
233
|
+
/** Audience from the collection's root index page; present only when 'private'. */
|
|
234
|
+
audience?: Audience;
|
|
235
|
+
/** Lifecycle status from the collection's root index page; present only when 'draft'. */
|
|
236
|
+
status?: PublishStatus;
|
|
173
237
|
}
|
|
174
238
|
interface CollectionTree {
|
|
175
239
|
collection: CollectionInfo;
|
|
@@ -185,6 +249,10 @@ interface DocData {
|
|
|
185
249
|
slug: string;
|
|
186
250
|
title: string;
|
|
187
251
|
tags: string[];
|
|
252
|
+
/** Audience; present only when 'private'. */
|
|
253
|
+
audience?: Audience;
|
|
254
|
+
/** Lifecycle status; present only when 'draft'. */
|
|
255
|
+
status?: PublishStatus;
|
|
188
256
|
html: string;
|
|
189
257
|
toc: TocItem[];
|
|
190
258
|
path: string;
|
|
@@ -307,11 +375,15 @@ interface ParsedArticle {
|
|
|
307
375
|
title: string;
|
|
308
376
|
tags: string[];
|
|
309
377
|
created?: string;
|
|
378
|
+
audience: Audience;
|
|
379
|
+
status: PublishStatus;
|
|
310
380
|
body: string;
|
|
311
381
|
}
|
|
312
382
|
interface SerializableArticle {
|
|
313
383
|
title: string;
|
|
314
384
|
tags: string[];
|
|
385
|
+
audience?: Audience;
|
|
386
|
+
status?: PublishStatus;
|
|
315
387
|
body: string;
|
|
316
388
|
}
|
|
317
389
|
declare function parseArticle(raw: string): ParsedArticle;
|
|
@@ -387,6 +459,33 @@ interface CollectionGitStatus {
|
|
|
387
459
|
*/
|
|
388
460
|
declare function collectionGitStatus(entry: CollectionEntry): Promise<CollectionGitStatus | undefined>;
|
|
389
461
|
|
|
462
|
+
declare const PROJECT_CONFIG_FILE = "diffwiki.yaml";
|
|
463
|
+
/**
|
|
464
|
+
* Read and normalise the repo-root `diffwiki.yaml`. Supports the extended form
|
|
465
|
+
* ({ site, collections[] }) AND the legacy single-collection form
|
|
466
|
+
* ({ collection, path }), folded into a one-element `collections`. Returns
|
|
467
|
+
* undefined when the file is absent (ENOENT); parse/other read errors propagate.
|
|
468
|
+
*/
|
|
469
|
+
declare function readProjectConfig(dir: string): Promise<ProjectConfig | undefined>;
|
|
470
|
+
/**
|
|
471
|
+
* Resolve `diffwiki.yaml` collections into registry-shaped CollectionEntry[] with
|
|
472
|
+
* absolute paths (relative to the project root). Empty when no config / no
|
|
473
|
+
* collections. Used to seed an ephemeral registry for `preview` and the CI build.
|
|
474
|
+
*/
|
|
475
|
+
declare function resolveProjectCollections(dir: string): Promise<CollectionEntry[]>;
|
|
476
|
+
/** The site block from `diffwiki.yaml`, or `{}` when absent. */
|
|
477
|
+
declare function readSiteConfig(dir: string): Promise<SiteConfig>;
|
|
478
|
+
/**
|
|
479
|
+
* Create a throwaway DIFFWIKI_HOME seeded with a registry built from the project's
|
|
480
|
+
* diffwiki.yaml collections, and return its path. This is the single mechanism
|
|
481
|
+
* both `diffwiki preview` and `diffwiki export --project` use to render a repo's
|
|
482
|
+
* own wiki without touching the global registry: seed a tmp home, point
|
|
483
|
+
* DIFFWIKI_HOME at it on the fly, and every downstream reader (listCollections,
|
|
484
|
+
* buildNavTree, buildSite) works unchanged. Throws when the config is missing or
|
|
485
|
+
* declares no collections. Callers own cleanup (`fs.rm(home, …)`).
|
|
486
|
+
*/
|
|
487
|
+
declare function seedProjectHome(dir: string): Promise<string>;
|
|
488
|
+
|
|
390
489
|
/** Absolute working-tree root, or undefined when `cwd` is not inside a git repo. */
|
|
391
490
|
declare function gitToplevel(cwd: string): Promise<string | undefined>;
|
|
392
491
|
/**
|
|
@@ -436,7 +535,10 @@ interface FileTimestamps {
|
|
|
436
535
|
*/
|
|
437
536
|
declare function fileTimestamps(absPath: string): Promise<FileTimestamps>;
|
|
438
537
|
|
|
439
|
-
/** Map core article nodes to UI nav nodes, assigning each its route path.
|
|
538
|
+
/** Map core article nodes to UI nav nodes, assigning each its route path.
|
|
539
|
+
* In static builds, private (audience) or draft (status) articles are dropped
|
|
540
|
+
* entirely (no nav row, and — since routes + per-doc JSON derive from this tree
|
|
541
|
+
* — no route/JSON). */
|
|
440
542
|
declare function toTreeNodes(coll: string, nodes: ArticleNode[]): TreeNode[];
|
|
441
543
|
declare function buildCollections(): Promise<CollectionInfo[]>;
|
|
442
544
|
declare function buildNavTree(): Promise<CollectionTree[]>;
|
|
@@ -452,6 +554,14 @@ declare function buildNavTree(): Promise<CollectionTree[]>;
|
|
|
452
554
|
declare function resolvePage(coll: string, slug: string, opts?: {
|
|
453
555
|
include?: ReadonlySet<string>;
|
|
454
556
|
}): Promise<PageData | null>;
|
|
557
|
+
/**
|
|
558
|
+
* The site config for the current context, from `diffwiki.yaml` at
|
|
559
|
+
* `DIFFWIKI_PROJECT_DIR`. Returns `{}` when the env var is unset (the default
|
|
560
|
+
* runtime) or the file is missing/unreadable — the home page then falls back to
|
|
561
|
+
* collection pills. Consumed by the static exporter (site.json) and the live
|
|
562
|
+
* `getSite` server fn.
|
|
563
|
+
*/
|
|
564
|
+
declare function buildSite(): Promise<SiteConfig>;
|
|
455
565
|
|
|
456
566
|
/**
|
|
457
567
|
* Collection selection for `diffwiki export` — resolve which collection names to
|
|
@@ -640,6 +750,17 @@ declare function resolveLogLevel(env?: NodeJS.ProcessEnv): DiffwikiLogLevel;
|
|
|
640
750
|
* is the relative path without extension. Dirs-first, then alpha (case-insensitive).
|
|
641
751
|
*/
|
|
642
752
|
declare function buildArticleTree(relPaths: string[]): ArticleNode[];
|
|
753
|
+
/**
|
|
754
|
+
* Read a collection's (or any directory's) audience + status from its index page
|
|
755
|
+
* (index.md / README). Each axis is present only at its non-default value
|
|
756
|
+
* (audience:'private' / status:'draft'), else absent. Cheap partial read — used
|
|
757
|
+
* to mark/skip whole collections the same way leaf articles are.
|
|
758
|
+
*/
|
|
759
|
+
declare function collectionMeta(collDir: string): Promise<{
|
|
760
|
+
title?: string;
|
|
761
|
+
audience?: Audience;
|
|
762
|
+
status?: PublishStatus;
|
|
763
|
+
}>;
|
|
643
764
|
/**
|
|
644
765
|
* List the article tree of a collection. Walks the collection's registered
|
|
645
766
|
* `entry.path` — so collections living OUTSIDE `~/.diffwiki/collections`
|
|
@@ -890,4 +1011,4 @@ declare function findEnabledPlugin(kind: PluginKind, name?: string): Promise<Plu
|
|
|
890
1011
|
/** Find a plugin record by name (regardless of enabled state). */
|
|
891
1012
|
declare function findPluginRecord(name: string): Promise<PluginRecord | undefined>;
|
|
892
1013
|
|
|
893
|
-
export { type AddExternalOptions, type Article, type ArticleContent, type ArticleNode, ArticleNotFoundError, CollectionAlreadyAddedError, type CollectionEntry, CollectionExistsError, type CollectionGitStatus, type CollectionInfo, CollectionNotFoundError, type CollectionSelection, type CollectionSelectionResult, type CollectionTree, type CollectionType, type Config, type Diagnostic, type DiagnosticLevel, DiffwikiError, type DiffwikiLogLevel, type DocData, type FileTimestamps, type GraphEdge, type GraphNode, type InitOptions, type InstallOutcome, InvalidExportSelectionError, InvalidTargetError, type KnownPlugin, type LinkGraph, type ListingEntry, type LocalGraph, NATIVE_ENGINE, NoDefaultCollectionError, type NodeMeta, type PageData, type ParsedArticle, type PluginCapabilities, PluginError, type PluginEvent, type PluginHealth, type PluginKind, type PluginReadiness, type PluginRecord, type PluginRegistryFile, type QueryHit, type QueryOptions, REPO_CONFIG_FILE, type Registry, type RenderContext, type RenderedArticle, type RepoConfig, SearchDoc, type SearchMode, type SearchOutcome, type SearchProvider, type SerializableArticle, type SetupOutcome, type SetupStep, type TocItem, type TreeNode, type UpstreamStatus, WorktreeNotAllowedError, addExternalCollection, addTags, buildArticleTree, buildCollections, buildLinkGraph, buildNavTree, buildSearchIndex, collectionDir, collectionGitStatus, collectionsDir, configPath, createArticle, createCollection, currentBranch, deregisterPlugin, doctor, emitPluginEvent, ensureGitRepo, ensurePluginRoot, fileTimestamps, findCollection, findCollectionById, findEnabledPlugin, findPluginRecord, getConfigValue, getLogger, gitToplevel, initRepoWiki, installPlugin, invalidateLinkGraph, isLinkedWorktree, listArticleTree, listAvailablePlugins, listCollections, listEnabledPlugins, listPlugins, listSearchModes, loadSearchProvider, localGraph, nativeSearch, parseAddTarget, parseArticle, parsePathTarget, pluginsDir, pluginsRegistryPath, query, readArticle, readConfig, readPluginRegistry, readRegistry, readRepoConfig, registerCollection, registerPlugin, registryPath, removeArticle, removeCollection, removePlugin, removeTags, renderArticle, repoId, repoRemoteName, resolveCollectionSelection, resolveCwdCollection, resolveDefaultSearchMode, resolveHome, resolveLogLevel, resolvePage, search, serializeArticle, setConfigValue, setTags, slugify, toTreeNodes, unregisterCollection, updateArticleBody, upsertPlugin, upstreamStatus, writeConfig, writePluginRegistry, writeRegistry };
|
|
1014
|
+
export { type AddExternalOptions, type Article, type ArticleContent, type ArticleNode, ArticleNotFoundError, type Audience, CollectionAlreadyAddedError, type CollectionEntry, CollectionExistsError, type CollectionGitStatus, type CollectionInfo, CollectionNotFoundError, type CollectionSelection, type CollectionSelectionResult, type CollectionTree, type CollectionType, type Config, type Diagnostic, type DiagnosticLevel, DiffwikiError, type DiffwikiLogLevel, type DocData, type FileTimestamps, type GraphEdge, type GraphNode, type HomeCard, type InitOptions, type InstallOutcome, InvalidExportSelectionError, InvalidTargetError, type KnownPlugin, type LinkGraph, type ListingEntry, type LocalGraph, NATIVE_ENGINE, NoDefaultCollectionError, type NodeMeta, PROJECT_CONFIG_FILE, type PageData, type ParsedArticle, type PluginCapabilities, PluginError, type PluginEvent, type PluginHealth, type PluginKind, type PluginReadiness, type PluginRecord, type PluginRegistryFile, type ProjectCollection, type ProjectConfig, type PublishStatus, type QueryHit, type QueryOptions, REPO_CONFIG_FILE, type Registry, type RenderContext, type RenderedArticle, type RepoConfig, SearchDoc, type SearchMode, type SearchOutcome, type SearchProvider, type SerializableArticle, type SetupOutcome, type SetupStep, type SiteConfig, type SiteHome, type TocItem, type TreeNode, type UpstreamStatus, WorktreeNotAllowedError, addExternalCollection, addTags, buildArticleTree, buildCollections, buildLinkGraph, buildNavTree, buildSearchIndex, buildSite, 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, listArticleTree, listAvailablePlugins, listCollections, listEnabledPlugins, listPlugins, listSearchModes, loadSearchProvider, localGraph, nativeSearch, parseAddTarget, parseArticle, parsePathTarget, pluginsDir, pluginsRegistryPath, query, readArticle, readConfig, readPluginRegistry, readProjectConfig, readRegistry, readRepoConfig, readSiteConfig, registerCollection, registerPlugin, registryPath, removeArticle, removeCollection, removePlugin, removeTags, renderArticle, repoId, repoRemoteName, resolveCollectionSelection, resolveCwdCollection, resolveDefaultSearchMode, resolveHome, resolveLogLevel, resolvePage, resolveProjectCollections, search, seedProjectHome, serializeArticle, setConfigValue, setTags, slugify, toTreeNodes, unregisterCollection, updateArticleBody, upsertPlugin, upstreamStatus, writeConfig, writePluginRegistry, writeRegistry };
|
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,10 @@ import { SearchDoc } from './bm25.js';
|
|
|
2
2
|
export { RankableFields, rankDocs, tokenize } from './bm25.js';
|
|
3
3
|
import { LogLevel, Logger } from '@logtape/logtape';
|
|
4
4
|
|
|
5
|
+
/** Audience axis — who an article is for. Private is never published. Missing/invalid → 'public'. */
|
|
6
|
+
type Audience = 'public' | 'private';
|
|
7
|
+
/** Lifecycle axis — readiness. Draft is not yet published. Missing/invalid → 'published'. */
|
|
8
|
+
type PublishStatus = 'draft' | 'published';
|
|
5
9
|
type CollectionType = 'global' | 'repo' | 'external';
|
|
6
10
|
interface CollectionEntry {
|
|
7
11
|
name: string;
|
|
@@ -36,6 +40,48 @@ interface RepoConfig {
|
|
|
36
40
|
/** Path to the wiki directory, relative to the repo root. */
|
|
37
41
|
path: string;
|
|
38
42
|
}
|
|
43
|
+
/** A home-page card (VitePress-style): icon + title + subtitle linking into the site. */
|
|
44
|
+
interface HomeCard {
|
|
45
|
+
/** Icon name from the curated home-card icon set; unknown/missing → no icon. */
|
|
46
|
+
icon?: string;
|
|
47
|
+
title: string;
|
|
48
|
+
subtitle?: string;
|
|
49
|
+
/** In-site path, e.g. "/getting-started". */
|
|
50
|
+
link: string;
|
|
51
|
+
}
|
|
52
|
+
/** Home-page customization from `diffwiki.yaml` → `site.home`. */
|
|
53
|
+
interface SiteHome {
|
|
54
|
+
/** Line shown under the wordmark on the home page. */
|
|
55
|
+
tagline?: string;
|
|
56
|
+
/** Cards rendered below the search bar. */
|
|
57
|
+
cards?: HomeCard[];
|
|
58
|
+
}
|
|
59
|
+
/** Site-level config from `diffwiki.yaml` → `site`. */
|
|
60
|
+
interface SiteConfig {
|
|
61
|
+
title?: string;
|
|
62
|
+
/** Logo override: path/URL to an image. Falls back to the built-in diffwiki mark. */
|
|
63
|
+
logo?: string;
|
|
64
|
+
/** Project repository URL for the top-nav GitHub link (NOT the "powered by" footer). */
|
|
65
|
+
repo?: string;
|
|
66
|
+
home?: SiteHome;
|
|
67
|
+
}
|
|
68
|
+
/** One collection declared in `diffwiki.yaml` → `collections[]`. */
|
|
69
|
+
interface ProjectCollection {
|
|
70
|
+
name: string;
|
|
71
|
+
/** Content directory, relative to the project root. */
|
|
72
|
+
path: string;
|
|
73
|
+
/** Optional display order (ascending). Unset sorts after ordered ones, keeping list order. */
|
|
74
|
+
order?: number;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Normalised repo-root `diffwiki.yaml`. The extended form carries `site` +
|
|
78
|
+
* `collections[]`; the legacy `{ collection, path }` form is folded into a
|
|
79
|
+
* one-element `collections` by the parser.
|
|
80
|
+
*/
|
|
81
|
+
interface ProjectConfig {
|
|
82
|
+
site?: SiteConfig;
|
|
83
|
+
collections: ProjectCollection[];
|
|
84
|
+
}
|
|
39
85
|
/** A node in a collection's article tree. Branches have `children`; leaves have `slug`. */
|
|
40
86
|
interface ArticleNode {
|
|
41
87
|
/** Segment label — dir name for branches, filename-without-ext for leaves. */
|
|
@@ -47,6 +93,10 @@ interface ArticleNode {
|
|
|
47
93
|
* leaves (the article) and on branches (the folder, navigable to its index).
|
|
48
94
|
*/
|
|
49
95
|
slug?: string;
|
|
96
|
+
/** Audience, set only when 'private' (omitted for 'public'). */
|
|
97
|
+
audience?: Audience;
|
|
98
|
+
/** Lifecycle status, set only when 'draft' (omitted for 'published'). */
|
|
99
|
+
status?: PublishStatus;
|
|
50
100
|
/** Branch only: nested nodes. */
|
|
51
101
|
children?: ArticleNode[];
|
|
52
102
|
}
|
|
@@ -56,6 +106,10 @@ interface ArticleContent {
|
|
|
56
106
|
slug: string;
|
|
57
107
|
title: string;
|
|
58
108
|
tags: string[];
|
|
109
|
+
/** Audience from frontmatter ('public' when absent). */
|
|
110
|
+
audience: Audience;
|
|
111
|
+
/** Lifecycle status from frontmatter ('published' when absent). */
|
|
112
|
+
status: PublishStatus;
|
|
59
113
|
/** Frontmatter-stripped body (md/mdx). */
|
|
60
114
|
body: string;
|
|
61
115
|
/** Absolute path to the file on disk. */
|
|
@@ -160,6 +214,10 @@ interface TreeNode {
|
|
|
160
214
|
name: string;
|
|
161
215
|
title?: string;
|
|
162
216
|
path?: string;
|
|
217
|
+
/** Audience; present only when 'private' (drives the sidebar lock). */
|
|
218
|
+
audience?: Audience;
|
|
219
|
+
/** Lifecycle status; present only when 'draft' (drives the sidebar DRAFT tag). */
|
|
220
|
+
status?: PublishStatus;
|
|
163
221
|
children?: TreeNode[];
|
|
164
222
|
/** Set only on top-level collection rows: git branch/behind badge data. */
|
|
165
223
|
meta?: NodeMeta;
|
|
@@ -168,8 +226,14 @@ interface CollectionInfo {
|
|
|
168
226
|
name: string;
|
|
169
227
|
type: CollectionType;
|
|
170
228
|
path: string;
|
|
229
|
+
/** Display title from the collection's root index page frontmatter; falls back to `name` in the UI. */
|
|
230
|
+
title?: string;
|
|
171
231
|
branch?: string;
|
|
172
232
|
behind?: number;
|
|
233
|
+
/** Audience from the collection's root index page; present only when 'private'. */
|
|
234
|
+
audience?: Audience;
|
|
235
|
+
/** Lifecycle status from the collection's root index page; present only when 'draft'. */
|
|
236
|
+
status?: PublishStatus;
|
|
173
237
|
}
|
|
174
238
|
interface CollectionTree {
|
|
175
239
|
collection: CollectionInfo;
|
|
@@ -185,6 +249,10 @@ interface DocData {
|
|
|
185
249
|
slug: string;
|
|
186
250
|
title: string;
|
|
187
251
|
tags: string[];
|
|
252
|
+
/** Audience; present only when 'private'. */
|
|
253
|
+
audience?: Audience;
|
|
254
|
+
/** Lifecycle status; present only when 'draft'. */
|
|
255
|
+
status?: PublishStatus;
|
|
188
256
|
html: string;
|
|
189
257
|
toc: TocItem[];
|
|
190
258
|
path: string;
|
|
@@ -307,11 +375,15 @@ interface ParsedArticle {
|
|
|
307
375
|
title: string;
|
|
308
376
|
tags: string[];
|
|
309
377
|
created?: string;
|
|
378
|
+
audience: Audience;
|
|
379
|
+
status: PublishStatus;
|
|
310
380
|
body: string;
|
|
311
381
|
}
|
|
312
382
|
interface SerializableArticle {
|
|
313
383
|
title: string;
|
|
314
384
|
tags: string[];
|
|
385
|
+
audience?: Audience;
|
|
386
|
+
status?: PublishStatus;
|
|
315
387
|
body: string;
|
|
316
388
|
}
|
|
317
389
|
declare function parseArticle(raw: string): ParsedArticle;
|
|
@@ -387,6 +459,33 @@ interface CollectionGitStatus {
|
|
|
387
459
|
*/
|
|
388
460
|
declare function collectionGitStatus(entry: CollectionEntry): Promise<CollectionGitStatus | undefined>;
|
|
389
461
|
|
|
462
|
+
declare const PROJECT_CONFIG_FILE = "diffwiki.yaml";
|
|
463
|
+
/**
|
|
464
|
+
* Read and normalise the repo-root `diffwiki.yaml`. Supports the extended form
|
|
465
|
+
* ({ site, collections[] }) AND the legacy single-collection form
|
|
466
|
+
* ({ collection, path }), folded into a one-element `collections`. Returns
|
|
467
|
+
* undefined when the file is absent (ENOENT); parse/other read errors propagate.
|
|
468
|
+
*/
|
|
469
|
+
declare function readProjectConfig(dir: string): Promise<ProjectConfig | undefined>;
|
|
470
|
+
/**
|
|
471
|
+
* Resolve `diffwiki.yaml` collections into registry-shaped CollectionEntry[] with
|
|
472
|
+
* absolute paths (relative to the project root). Empty when no config / no
|
|
473
|
+
* collections. Used to seed an ephemeral registry for `preview` and the CI build.
|
|
474
|
+
*/
|
|
475
|
+
declare function resolveProjectCollections(dir: string): Promise<CollectionEntry[]>;
|
|
476
|
+
/** The site block from `diffwiki.yaml`, or `{}` when absent. */
|
|
477
|
+
declare function readSiteConfig(dir: string): Promise<SiteConfig>;
|
|
478
|
+
/**
|
|
479
|
+
* Create a throwaway DIFFWIKI_HOME seeded with a registry built from the project's
|
|
480
|
+
* diffwiki.yaml collections, and return its path. This is the single mechanism
|
|
481
|
+
* both `diffwiki preview` and `diffwiki export --project` use to render a repo's
|
|
482
|
+
* own wiki without touching the global registry: seed a tmp home, point
|
|
483
|
+
* DIFFWIKI_HOME at it on the fly, and every downstream reader (listCollections,
|
|
484
|
+
* buildNavTree, buildSite) works unchanged. Throws when the config is missing or
|
|
485
|
+
* declares no collections. Callers own cleanup (`fs.rm(home, …)`).
|
|
486
|
+
*/
|
|
487
|
+
declare function seedProjectHome(dir: string): Promise<string>;
|
|
488
|
+
|
|
390
489
|
/** Absolute working-tree root, or undefined when `cwd` is not inside a git repo. */
|
|
391
490
|
declare function gitToplevel(cwd: string): Promise<string | undefined>;
|
|
392
491
|
/**
|
|
@@ -436,7 +535,10 @@ interface FileTimestamps {
|
|
|
436
535
|
*/
|
|
437
536
|
declare function fileTimestamps(absPath: string): Promise<FileTimestamps>;
|
|
438
537
|
|
|
439
|
-
/** Map core article nodes to UI nav nodes, assigning each its route path.
|
|
538
|
+
/** Map core article nodes to UI nav nodes, assigning each its route path.
|
|
539
|
+
* In static builds, private (audience) or draft (status) articles are dropped
|
|
540
|
+
* entirely (no nav row, and — since routes + per-doc JSON derive from this tree
|
|
541
|
+
* — no route/JSON). */
|
|
440
542
|
declare function toTreeNodes(coll: string, nodes: ArticleNode[]): TreeNode[];
|
|
441
543
|
declare function buildCollections(): Promise<CollectionInfo[]>;
|
|
442
544
|
declare function buildNavTree(): Promise<CollectionTree[]>;
|
|
@@ -452,6 +554,14 @@ declare function buildNavTree(): Promise<CollectionTree[]>;
|
|
|
452
554
|
declare function resolvePage(coll: string, slug: string, opts?: {
|
|
453
555
|
include?: ReadonlySet<string>;
|
|
454
556
|
}): Promise<PageData | null>;
|
|
557
|
+
/**
|
|
558
|
+
* The site config for the current context, from `diffwiki.yaml` at
|
|
559
|
+
* `DIFFWIKI_PROJECT_DIR`. Returns `{}` when the env var is unset (the default
|
|
560
|
+
* runtime) or the file is missing/unreadable — the home page then falls back to
|
|
561
|
+
* collection pills. Consumed by the static exporter (site.json) and the live
|
|
562
|
+
* `getSite` server fn.
|
|
563
|
+
*/
|
|
564
|
+
declare function buildSite(): Promise<SiteConfig>;
|
|
455
565
|
|
|
456
566
|
/**
|
|
457
567
|
* Collection selection for `diffwiki export` — resolve which collection names to
|
|
@@ -640,6 +750,17 @@ declare function resolveLogLevel(env?: NodeJS.ProcessEnv): DiffwikiLogLevel;
|
|
|
640
750
|
* is the relative path without extension. Dirs-first, then alpha (case-insensitive).
|
|
641
751
|
*/
|
|
642
752
|
declare function buildArticleTree(relPaths: string[]): ArticleNode[];
|
|
753
|
+
/**
|
|
754
|
+
* Read a collection's (or any directory's) audience + status from its index page
|
|
755
|
+
* (index.md / README). Each axis is present only at its non-default value
|
|
756
|
+
* (audience:'private' / status:'draft'), else absent. Cheap partial read — used
|
|
757
|
+
* to mark/skip whole collections the same way leaf articles are.
|
|
758
|
+
*/
|
|
759
|
+
declare function collectionMeta(collDir: string): Promise<{
|
|
760
|
+
title?: string;
|
|
761
|
+
audience?: Audience;
|
|
762
|
+
status?: PublishStatus;
|
|
763
|
+
}>;
|
|
643
764
|
/**
|
|
644
765
|
* List the article tree of a collection. Walks the collection's registered
|
|
645
766
|
* `entry.path` — so collections living OUTSIDE `~/.diffwiki/collections`
|
|
@@ -890,4 +1011,4 @@ declare function findEnabledPlugin(kind: PluginKind, name?: string): Promise<Plu
|
|
|
890
1011
|
/** Find a plugin record by name (regardless of enabled state). */
|
|
891
1012
|
declare function findPluginRecord(name: string): Promise<PluginRecord | undefined>;
|
|
892
1013
|
|
|
893
|
-
export { type AddExternalOptions, type Article, type ArticleContent, type ArticleNode, ArticleNotFoundError, CollectionAlreadyAddedError, type CollectionEntry, CollectionExistsError, type CollectionGitStatus, type CollectionInfo, CollectionNotFoundError, type CollectionSelection, type CollectionSelectionResult, type CollectionTree, type CollectionType, type Config, type Diagnostic, type DiagnosticLevel, DiffwikiError, type DiffwikiLogLevel, type DocData, type FileTimestamps, type GraphEdge, type GraphNode, type InitOptions, type InstallOutcome, InvalidExportSelectionError, InvalidTargetError, type KnownPlugin, type LinkGraph, type ListingEntry, type LocalGraph, NATIVE_ENGINE, NoDefaultCollectionError, type NodeMeta, type PageData, type ParsedArticle, type PluginCapabilities, PluginError, type PluginEvent, type PluginHealth, type PluginKind, type PluginReadiness, type PluginRecord, type PluginRegistryFile, type QueryHit, type QueryOptions, REPO_CONFIG_FILE, type Registry, type RenderContext, type RenderedArticle, type RepoConfig, SearchDoc, type SearchMode, type SearchOutcome, type SearchProvider, type SerializableArticle, type SetupOutcome, type SetupStep, type TocItem, type TreeNode, type UpstreamStatus, WorktreeNotAllowedError, addExternalCollection, addTags, buildArticleTree, buildCollections, buildLinkGraph, buildNavTree, buildSearchIndex, collectionDir, collectionGitStatus, collectionsDir, configPath, createArticle, createCollection, currentBranch, deregisterPlugin, doctor, emitPluginEvent, ensureGitRepo, ensurePluginRoot, fileTimestamps, findCollection, findCollectionById, findEnabledPlugin, findPluginRecord, getConfigValue, getLogger, gitToplevel, initRepoWiki, installPlugin, invalidateLinkGraph, isLinkedWorktree, listArticleTree, listAvailablePlugins, listCollections, listEnabledPlugins, listPlugins, listSearchModes, loadSearchProvider, localGraph, nativeSearch, parseAddTarget, parseArticle, parsePathTarget, pluginsDir, pluginsRegistryPath, query, readArticle, readConfig, readPluginRegistry, readRegistry, readRepoConfig, registerCollection, registerPlugin, registryPath, removeArticle, removeCollection, removePlugin, removeTags, renderArticle, repoId, repoRemoteName, resolveCollectionSelection, resolveCwdCollection, resolveDefaultSearchMode, resolveHome, resolveLogLevel, resolvePage, search, serializeArticle, setConfigValue, setTags, slugify, toTreeNodes, unregisterCollection, updateArticleBody, upsertPlugin, upstreamStatus, writeConfig, writePluginRegistry, writeRegistry };
|
|
1014
|
+
export { type AddExternalOptions, type Article, type ArticleContent, type ArticleNode, ArticleNotFoundError, type Audience, CollectionAlreadyAddedError, type CollectionEntry, CollectionExistsError, type CollectionGitStatus, type CollectionInfo, CollectionNotFoundError, type CollectionSelection, type CollectionSelectionResult, type CollectionTree, type CollectionType, type Config, type Diagnostic, type DiagnosticLevel, DiffwikiError, type DiffwikiLogLevel, type DocData, type FileTimestamps, type GraphEdge, type GraphNode, type HomeCard, type InitOptions, type InstallOutcome, InvalidExportSelectionError, InvalidTargetError, type KnownPlugin, type LinkGraph, type ListingEntry, type LocalGraph, NATIVE_ENGINE, NoDefaultCollectionError, type NodeMeta, PROJECT_CONFIG_FILE, type PageData, type ParsedArticle, type PluginCapabilities, PluginError, type PluginEvent, type PluginHealth, type PluginKind, type PluginReadiness, type PluginRecord, type PluginRegistryFile, type ProjectCollection, type ProjectConfig, type PublishStatus, type QueryHit, type QueryOptions, REPO_CONFIG_FILE, type Registry, type RenderContext, type RenderedArticle, type RepoConfig, SearchDoc, type SearchMode, type SearchOutcome, type SearchProvider, type SerializableArticle, type SetupOutcome, type SetupStep, type SiteConfig, type SiteHome, type TocItem, type TreeNode, type UpstreamStatus, WorktreeNotAllowedError, addExternalCollection, addTags, buildArticleTree, buildCollections, buildLinkGraph, buildNavTree, buildSearchIndex, buildSite, 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, listArticleTree, listAvailablePlugins, listCollections, listEnabledPlugins, listPlugins, listSearchModes, loadSearchProvider, localGraph, nativeSearch, parseAddTarget, parseArticle, parsePathTarget, pluginsDir, pluginsRegistryPath, query, readArticle, readConfig, readPluginRegistry, readProjectConfig, readRegistry, readRepoConfig, readSiteConfig, registerCollection, registerPlugin, registryPath, removeArticle, removeCollection, removePlugin, removeTags, renderArticle, repoId, repoRemoteName, resolveCollectionSelection, resolveCwdCollection, resolveDefaultSearchMode, resolveHome, resolveLogLevel, resolvePage, resolveProjectCollections, search, seedProjectHome, serializeArticle, setConfigValue, setTags, slugify, toTreeNodes, unregisterCollection, updateArticleBody, upsertPlugin, upstreamStatus, writeConfig, writePluginRegistry, writeRegistry };
|