diffwiki-core 0.8.0 → 0.9.0-rc.202607291540.2b773e4
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 +232 -60
- package/dist/index.d.cts +118 -1
- package/dist/index.d.ts +118 -1
- package/dist/index.js +219 -58
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -27,6 +27,8 @@ interface Registry {
|
|
|
27
27
|
interface Config {
|
|
28
28
|
defaultCollection?: string;
|
|
29
29
|
defaultSearch?: string;
|
|
30
|
+
/** Editor command used by `diffwiki edit` (e.g. "code -w", "hx"). Falls back to $VISUAL/$EDITOR. */
|
|
31
|
+
editor?: string;
|
|
30
32
|
}
|
|
31
33
|
interface Article {
|
|
32
34
|
title: string;
|
|
@@ -40,6 +42,56 @@ interface RepoConfig {
|
|
|
40
42
|
/** Path to the wiki directory, relative to the repo root. */
|
|
41
43
|
path: string;
|
|
42
44
|
}
|
|
45
|
+
/** A home-page card (VitePress-style): icon + title + subtitle linking into the site. */
|
|
46
|
+
interface HomeCard {
|
|
47
|
+
/** Icon name from the curated home-card icon set; unknown/missing → no icon. */
|
|
48
|
+
icon?: string;
|
|
49
|
+
title: string;
|
|
50
|
+
subtitle?: string;
|
|
51
|
+
/** In-site path, e.g. "/getting-started". */
|
|
52
|
+
link: string;
|
|
53
|
+
}
|
|
54
|
+
/** Home-page customization from `diffwiki.yaml` → `site.home`. */
|
|
55
|
+
interface SiteHome {
|
|
56
|
+
/** Line shown under the wordmark on the home page. */
|
|
57
|
+
tagline?: string;
|
|
58
|
+
/** Cards rendered below the search bar. */
|
|
59
|
+
cards?: HomeCard[];
|
|
60
|
+
}
|
|
61
|
+
/** Footer copyright notice from `diffwiki.yaml` → `site.copyright`. Applies to the
|
|
62
|
+
* site/software; article CONTENT copyright stays with its respective authors. */
|
|
63
|
+
interface SiteCopyright {
|
|
64
|
+
/** The full notice text, e.g. "© 2026 Acme, Inc." */
|
|
65
|
+
text: string;
|
|
66
|
+
/** Optional URL — renders the notice as a link. */
|
|
67
|
+
url?: string;
|
|
68
|
+
}
|
|
69
|
+
/** Site-level config from `diffwiki.yaml` → `site`. The diffwiki logo + wordmark
|
|
70
|
+
* are fixed branding and deliberately not configurable. */
|
|
71
|
+
interface SiteConfig {
|
|
72
|
+
/** Project repository URL for the top-nav GitHub link. */
|
|
73
|
+
repo?: string;
|
|
74
|
+
/** Footer copyright notice; no default — the footer is empty when unset. */
|
|
75
|
+
copyright?: SiteCopyright;
|
|
76
|
+
home?: SiteHome;
|
|
77
|
+
}
|
|
78
|
+
/** One collection declared in `diffwiki.yaml` → `collections[]`. */
|
|
79
|
+
interface ProjectCollection {
|
|
80
|
+
name: string;
|
|
81
|
+
/** Content directory, relative to the project root. */
|
|
82
|
+
path: string;
|
|
83
|
+
/** Optional display order (ascending). Unset sorts after ordered ones, keeping list order. */
|
|
84
|
+
order?: number;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Normalised repo-root `diffwiki.yaml`. The extended form carries `site` +
|
|
88
|
+
* `collections[]`; the legacy `{ collection, path }` form is folded into a
|
|
89
|
+
* one-element `collections` by the parser.
|
|
90
|
+
*/
|
|
91
|
+
interface ProjectConfig {
|
|
92
|
+
site?: SiteConfig;
|
|
93
|
+
collections: ProjectCollection[];
|
|
94
|
+
}
|
|
43
95
|
/** A node in a collection's article tree. Branches have `children`; leaves have `slug`. */
|
|
44
96
|
interface ArticleNode {
|
|
45
97
|
/** Segment label — dir name for branches, filename-without-ext for leaves. */
|
|
@@ -55,6 +107,8 @@ interface ArticleNode {
|
|
|
55
107
|
audience?: Audience;
|
|
56
108
|
/** Lifecycle status, set only when 'draft' (omitted for 'published'). */
|
|
57
109
|
status?: PublishStatus;
|
|
110
|
+
/** Frontmatter `order` — nav sort within a folder (ascending; unset sorts after). */
|
|
111
|
+
order?: number;
|
|
58
112
|
/** Branch only: nested nodes. */
|
|
59
113
|
children?: ArticleNode[];
|
|
60
114
|
}
|
|
@@ -184,6 +238,8 @@ interface CollectionInfo {
|
|
|
184
238
|
name: string;
|
|
185
239
|
type: CollectionType;
|
|
186
240
|
path: string;
|
|
241
|
+
/** Display title from the collection's root index page frontmatter; falls back to `name` in the UI. */
|
|
242
|
+
title?: string;
|
|
187
243
|
branch?: string;
|
|
188
244
|
behind?: number;
|
|
189
245
|
/** Audience from the collection's root index page; present only when 'private'. */
|
|
@@ -415,6 +471,36 @@ interface CollectionGitStatus {
|
|
|
415
471
|
*/
|
|
416
472
|
declare function collectionGitStatus(entry: CollectionEntry): Promise<CollectionGitStatus | undefined>;
|
|
417
473
|
|
|
474
|
+
declare const PROJECT_CONFIG_FILE = "diffwiki.yaml";
|
|
475
|
+
/**
|
|
476
|
+
* Read and normalise the repo-root `diffwiki.yaml`. Supports the extended form
|
|
477
|
+
* ({ site, collections[] }) AND the legacy single-collection form
|
|
478
|
+
* ({ collection, path }), folded into a one-element `collections`. Returns
|
|
479
|
+
* undefined when the file is absent (ENOENT); parse/other read errors propagate.
|
|
480
|
+
*/
|
|
481
|
+
declare function readProjectConfig(dir: string): Promise<ProjectConfig | undefined>;
|
|
482
|
+
/**
|
|
483
|
+
* Resolve `diffwiki.yaml` collections into registry-shaped CollectionEntry[] with
|
|
484
|
+
* absolute paths (relative to the project root). Empty when no config / no
|
|
485
|
+
* collections. Used to seed an ephemeral registry for `preview` and the CI build.
|
|
486
|
+
*/
|
|
487
|
+
declare function resolveProjectCollections(dir: string): Promise<CollectionEntry[]>;
|
|
488
|
+
/** The site block from `diffwiki.yaml`, or `{}` when absent. */
|
|
489
|
+
declare function readSiteConfig(dir: string): Promise<SiteConfig>;
|
|
490
|
+
/**
|
|
491
|
+
* Create a throwaway DIFFWIKI_HOME seeded with a registry built from the project's
|
|
492
|
+
* diffwiki.yaml collections, and return its path + the resolved entries. This is the single mechanism
|
|
493
|
+
* both `diffwiki preview` and `diffwiki export --project` use to render a repo's
|
|
494
|
+
* own wiki without touching the global registry: seed a tmp home, point
|
|
495
|
+
* DIFFWIKI_HOME at it on the fly, and every downstream reader (listCollections,
|
|
496
|
+
* buildNavTree, buildSiteConfig) works unchanged. Throws when the config is missing or
|
|
497
|
+
* declares no collections. Callers own cleanup (`fs.rm(home, …)`).
|
|
498
|
+
*/
|
|
499
|
+
declare function seedProjectHome(dir: string): Promise<{
|
|
500
|
+
home: string;
|
|
501
|
+
entries: CollectionEntry[];
|
|
502
|
+
}>;
|
|
503
|
+
|
|
418
504
|
/** Absolute working-tree root, or undefined when `cwd` is not inside a git repo. */
|
|
419
505
|
declare function gitToplevel(cwd: string): Promise<string | undefined>;
|
|
420
506
|
/**
|
|
@@ -483,6 +569,14 @@ declare function buildNavTree(): Promise<CollectionTree[]>;
|
|
|
483
569
|
declare function resolvePage(coll: string, slug: string, opts?: {
|
|
484
570
|
include?: ReadonlySet<string>;
|
|
485
571
|
}): Promise<PageData | null>;
|
|
572
|
+
/**
|
|
573
|
+
* The site config for the current context, from `diffwiki.yaml` at
|
|
574
|
+
* `DIFFWIKI_PROJECT_DIR`. Returns `{}` when the env var is unset (the default
|
|
575
|
+
* runtime) or the file is missing/unreadable — the home page then falls back to
|
|
576
|
+
* collection pills. Consumed by the static exporter (site.json) and the live
|
|
577
|
+
* `getSite` server fn.
|
|
578
|
+
*/
|
|
579
|
+
declare function buildSiteConfig(): Promise<SiteConfig>;
|
|
486
580
|
|
|
487
581
|
/**
|
|
488
582
|
* Collection selection for `diffwiki export` — resolve which collection names to
|
|
@@ -678,6 +772,7 @@ declare function buildArticleTree(relPaths: string[]): ArticleNode[];
|
|
|
678
772
|
* to mark/skip whole collections the same way leaf articles are.
|
|
679
773
|
*/
|
|
680
774
|
declare function collectionMeta(collDir: string): Promise<{
|
|
775
|
+
title?: string;
|
|
681
776
|
audience?: Audience;
|
|
682
777
|
status?: PublishStatus;
|
|
683
778
|
}>;
|
|
@@ -762,6 +857,28 @@ declare function buildLinkGraph(): Promise<LinkGraph>;
|
|
|
762
857
|
*/
|
|
763
858
|
declare function localGraph(graph: LinkGraph, focusId: string, include?: ReadonlySet<string>, siblingCap?: number): LocalGraph;
|
|
764
859
|
|
|
860
|
+
/** What `diffwiki edit` resolved to open: a single article file, a collection dir, or the collections root. */
|
|
861
|
+
interface EditTarget {
|
|
862
|
+
/** Absolute filesystem path to hand to the editor. */
|
|
863
|
+
path: string;
|
|
864
|
+
kind: 'article' | 'collection' | 'root';
|
|
865
|
+
}
|
|
866
|
+
/**
|
|
867
|
+
* Resolve the filesystem path `diffwiki edit [target]` should open.
|
|
868
|
+
*
|
|
869
|
+
* - `collection:slug` → that article's file (throws if the article/collection is missing).
|
|
870
|
+
* - `collection` → that collection's content directory.
|
|
871
|
+
* - (no target) → the current repo's collection dir, else the `~/.diffwiki/collections` root.
|
|
872
|
+
*/
|
|
873
|
+
declare function resolveEditTarget(target: string | undefined, cwd: string): Promise<EditTarget>;
|
|
874
|
+
/**
|
|
875
|
+
* Resolve the editor command argv used by `diffwiki edit`, in precedence order:
|
|
876
|
+
* `--editor` flag → config `editor` → `$VISUAL` → `$EDITOR`. Returns undefined when
|
|
877
|
+
* none is set (the caller prints guidance). The command is split on whitespace, so
|
|
878
|
+
* simple flagged commands like `code -w` work; quoted arguments are not supported.
|
|
879
|
+
*/
|
|
880
|
+
declare function resolveEditorCommand(flag?: string): Promise<string[] | undefined>;
|
|
881
|
+
|
|
765
882
|
/**
|
|
766
883
|
* Host-side plugin invocation and search-provider loading.
|
|
767
884
|
*
|
|
@@ -931,4 +1048,4 @@ declare function findEnabledPlugin(kind: PluginKind, name?: string): Promise<Plu
|
|
|
931
1048
|
/** Find a plugin record by name (regardless of enabled state). */
|
|
932
1049
|
declare function findPluginRecord(name: string): Promise<PluginRecord | undefined>;
|
|
933
1050
|
|
|
934
|
-
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 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 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 TocItem, type TreeNode, type UpstreamStatus, WorktreeNotAllowedError, addExternalCollection, addTags, buildArticleTree, buildCollections, buildLinkGraph, buildNavTree, buildSearchIndex, 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, 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 };
|
|
1051
|
+
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 EditTarget, 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 SiteCopyright, type SiteHome, type TocItem, type 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, 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, resolveEditTarget, resolveEditorCommand, resolveHome, resolveLogLevel, resolvePage, resolveProjectCollections, search, seedProjectHome, serializeArticle, setConfigValue, setTags, slugify, toTreeNodes, unregisterCollection, updateArticleBody, upsertPlugin, upstreamStatus, writeConfig, writePluginRegistry, writeRegistry };
|
package/dist/index.d.ts
CHANGED
|
@@ -27,6 +27,8 @@ interface Registry {
|
|
|
27
27
|
interface Config {
|
|
28
28
|
defaultCollection?: string;
|
|
29
29
|
defaultSearch?: string;
|
|
30
|
+
/** Editor command used by `diffwiki edit` (e.g. "code -w", "hx"). Falls back to $VISUAL/$EDITOR. */
|
|
31
|
+
editor?: string;
|
|
30
32
|
}
|
|
31
33
|
interface Article {
|
|
32
34
|
title: string;
|
|
@@ -40,6 +42,56 @@ interface RepoConfig {
|
|
|
40
42
|
/** Path to the wiki directory, relative to the repo root. */
|
|
41
43
|
path: string;
|
|
42
44
|
}
|
|
45
|
+
/** A home-page card (VitePress-style): icon + title + subtitle linking into the site. */
|
|
46
|
+
interface HomeCard {
|
|
47
|
+
/** Icon name from the curated home-card icon set; unknown/missing → no icon. */
|
|
48
|
+
icon?: string;
|
|
49
|
+
title: string;
|
|
50
|
+
subtitle?: string;
|
|
51
|
+
/** In-site path, e.g. "/getting-started". */
|
|
52
|
+
link: string;
|
|
53
|
+
}
|
|
54
|
+
/** Home-page customization from `diffwiki.yaml` → `site.home`. */
|
|
55
|
+
interface SiteHome {
|
|
56
|
+
/** Line shown under the wordmark on the home page. */
|
|
57
|
+
tagline?: string;
|
|
58
|
+
/** Cards rendered below the search bar. */
|
|
59
|
+
cards?: HomeCard[];
|
|
60
|
+
}
|
|
61
|
+
/** Footer copyright notice from `diffwiki.yaml` → `site.copyright`. Applies to the
|
|
62
|
+
* site/software; article CONTENT copyright stays with its respective authors. */
|
|
63
|
+
interface SiteCopyright {
|
|
64
|
+
/** The full notice text, e.g. "© 2026 Acme, Inc." */
|
|
65
|
+
text: string;
|
|
66
|
+
/** Optional URL — renders the notice as a link. */
|
|
67
|
+
url?: string;
|
|
68
|
+
}
|
|
69
|
+
/** Site-level config from `diffwiki.yaml` → `site`. The diffwiki logo + wordmark
|
|
70
|
+
* are fixed branding and deliberately not configurable. */
|
|
71
|
+
interface SiteConfig {
|
|
72
|
+
/** Project repository URL for the top-nav GitHub link. */
|
|
73
|
+
repo?: string;
|
|
74
|
+
/** Footer copyright notice; no default — the footer is empty when unset. */
|
|
75
|
+
copyright?: SiteCopyright;
|
|
76
|
+
home?: SiteHome;
|
|
77
|
+
}
|
|
78
|
+
/** One collection declared in `diffwiki.yaml` → `collections[]`. */
|
|
79
|
+
interface ProjectCollection {
|
|
80
|
+
name: string;
|
|
81
|
+
/** Content directory, relative to the project root. */
|
|
82
|
+
path: string;
|
|
83
|
+
/** Optional display order (ascending). Unset sorts after ordered ones, keeping list order. */
|
|
84
|
+
order?: number;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Normalised repo-root `diffwiki.yaml`. The extended form carries `site` +
|
|
88
|
+
* `collections[]`; the legacy `{ collection, path }` form is folded into a
|
|
89
|
+
* one-element `collections` by the parser.
|
|
90
|
+
*/
|
|
91
|
+
interface ProjectConfig {
|
|
92
|
+
site?: SiteConfig;
|
|
93
|
+
collections: ProjectCollection[];
|
|
94
|
+
}
|
|
43
95
|
/** A node in a collection's article tree. Branches have `children`; leaves have `slug`. */
|
|
44
96
|
interface ArticleNode {
|
|
45
97
|
/** Segment label — dir name for branches, filename-without-ext for leaves. */
|
|
@@ -55,6 +107,8 @@ interface ArticleNode {
|
|
|
55
107
|
audience?: Audience;
|
|
56
108
|
/** Lifecycle status, set only when 'draft' (omitted for 'published'). */
|
|
57
109
|
status?: PublishStatus;
|
|
110
|
+
/** Frontmatter `order` — nav sort within a folder (ascending; unset sorts after). */
|
|
111
|
+
order?: number;
|
|
58
112
|
/** Branch only: nested nodes. */
|
|
59
113
|
children?: ArticleNode[];
|
|
60
114
|
}
|
|
@@ -184,6 +238,8 @@ interface CollectionInfo {
|
|
|
184
238
|
name: string;
|
|
185
239
|
type: CollectionType;
|
|
186
240
|
path: string;
|
|
241
|
+
/** Display title from the collection's root index page frontmatter; falls back to `name` in the UI. */
|
|
242
|
+
title?: string;
|
|
187
243
|
branch?: string;
|
|
188
244
|
behind?: number;
|
|
189
245
|
/** Audience from the collection's root index page; present only when 'private'. */
|
|
@@ -415,6 +471,36 @@ interface CollectionGitStatus {
|
|
|
415
471
|
*/
|
|
416
472
|
declare function collectionGitStatus(entry: CollectionEntry): Promise<CollectionGitStatus | undefined>;
|
|
417
473
|
|
|
474
|
+
declare const PROJECT_CONFIG_FILE = "diffwiki.yaml";
|
|
475
|
+
/**
|
|
476
|
+
* Read and normalise the repo-root `diffwiki.yaml`. Supports the extended form
|
|
477
|
+
* ({ site, collections[] }) AND the legacy single-collection form
|
|
478
|
+
* ({ collection, path }), folded into a one-element `collections`. Returns
|
|
479
|
+
* undefined when the file is absent (ENOENT); parse/other read errors propagate.
|
|
480
|
+
*/
|
|
481
|
+
declare function readProjectConfig(dir: string): Promise<ProjectConfig | undefined>;
|
|
482
|
+
/**
|
|
483
|
+
* Resolve `diffwiki.yaml` collections into registry-shaped CollectionEntry[] with
|
|
484
|
+
* absolute paths (relative to the project root). Empty when no config / no
|
|
485
|
+
* collections. Used to seed an ephemeral registry for `preview` and the CI build.
|
|
486
|
+
*/
|
|
487
|
+
declare function resolveProjectCollections(dir: string): Promise<CollectionEntry[]>;
|
|
488
|
+
/** The site block from `diffwiki.yaml`, or `{}` when absent. */
|
|
489
|
+
declare function readSiteConfig(dir: string): Promise<SiteConfig>;
|
|
490
|
+
/**
|
|
491
|
+
* Create a throwaway DIFFWIKI_HOME seeded with a registry built from the project's
|
|
492
|
+
* diffwiki.yaml collections, and return its path + the resolved entries. This is the single mechanism
|
|
493
|
+
* both `diffwiki preview` and `diffwiki export --project` use to render a repo's
|
|
494
|
+
* own wiki without touching the global registry: seed a tmp home, point
|
|
495
|
+
* DIFFWIKI_HOME at it on the fly, and every downstream reader (listCollections,
|
|
496
|
+
* buildNavTree, buildSiteConfig) works unchanged. Throws when the config is missing or
|
|
497
|
+
* declares no collections. Callers own cleanup (`fs.rm(home, …)`).
|
|
498
|
+
*/
|
|
499
|
+
declare function seedProjectHome(dir: string): Promise<{
|
|
500
|
+
home: string;
|
|
501
|
+
entries: CollectionEntry[];
|
|
502
|
+
}>;
|
|
503
|
+
|
|
418
504
|
/** Absolute working-tree root, or undefined when `cwd` is not inside a git repo. */
|
|
419
505
|
declare function gitToplevel(cwd: string): Promise<string | undefined>;
|
|
420
506
|
/**
|
|
@@ -483,6 +569,14 @@ declare function buildNavTree(): Promise<CollectionTree[]>;
|
|
|
483
569
|
declare function resolvePage(coll: string, slug: string, opts?: {
|
|
484
570
|
include?: ReadonlySet<string>;
|
|
485
571
|
}): Promise<PageData | null>;
|
|
572
|
+
/**
|
|
573
|
+
* The site config for the current context, from `diffwiki.yaml` at
|
|
574
|
+
* `DIFFWIKI_PROJECT_DIR`. Returns `{}` when the env var is unset (the default
|
|
575
|
+
* runtime) or the file is missing/unreadable — the home page then falls back to
|
|
576
|
+
* collection pills. Consumed by the static exporter (site.json) and the live
|
|
577
|
+
* `getSite` server fn.
|
|
578
|
+
*/
|
|
579
|
+
declare function buildSiteConfig(): Promise<SiteConfig>;
|
|
486
580
|
|
|
487
581
|
/**
|
|
488
582
|
* Collection selection for `diffwiki export` — resolve which collection names to
|
|
@@ -678,6 +772,7 @@ declare function buildArticleTree(relPaths: string[]): ArticleNode[];
|
|
|
678
772
|
* to mark/skip whole collections the same way leaf articles are.
|
|
679
773
|
*/
|
|
680
774
|
declare function collectionMeta(collDir: string): Promise<{
|
|
775
|
+
title?: string;
|
|
681
776
|
audience?: Audience;
|
|
682
777
|
status?: PublishStatus;
|
|
683
778
|
}>;
|
|
@@ -762,6 +857,28 @@ declare function buildLinkGraph(): Promise<LinkGraph>;
|
|
|
762
857
|
*/
|
|
763
858
|
declare function localGraph(graph: LinkGraph, focusId: string, include?: ReadonlySet<string>, siblingCap?: number): LocalGraph;
|
|
764
859
|
|
|
860
|
+
/** What `diffwiki edit` resolved to open: a single article file, a collection dir, or the collections root. */
|
|
861
|
+
interface EditTarget {
|
|
862
|
+
/** Absolute filesystem path to hand to the editor. */
|
|
863
|
+
path: string;
|
|
864
|
+
kind: 'article' | 'collection' | 'root';
|
|
865
|
+
}
|
|
866
|
+
/**
|
|
867
|
+
* Resolve the filesystem path `diffwiki edit [target]` should open.
|
|
868
|
+
*
|
|
869
|
+
* - `collection:slug` → that article's file (throws if the article/collection is missing).
|
|
870
|
+
* - `collection` → that collection's content directory.
|
|
871
|
+
* - (no target) → the current repo's collection dir, else the `~/.diffwiki/collections` root.
|
|
872
|
+
*/
|
|
873
|
+
declare function resolveEditTarget(target: string | undefined, cwd: string): Promise<EditTarget>;
|
|
874
|
+
/**
|
|
875
|
+
* Resolve the editor command argv used by `diffwiki edit`, in precedence order:
|
|
876
|
+
* `--editor` flag → config `editor` → `$VISUAL` → `$EDITOR`. Returns undefined when
|
|
877
|
+
* none is set (the caller prints guidance). The command is split on whitespace, so
|
|
878
|
+
* simple flagged commands like `code -w` work; quoted arguments are not supported.
|
|
879
|
+
*/
|
|
880
|
+
declare function resolveEditorCommand(flag?: string): Promise<string[] | undefined>;
|
|
881
|
+
|
|
765
882
|
/**
|
|
766
883
|
* Host-side plugin invocation and search-provider loading.
|
|
767
884
|
*
|
|
@@ -931,4 +1048,4 @@ declare function findEnabledPlugin(kind: PluginKind, name?: string): Promise<Plu
|
|
|
931
1048
|
/** Find a plugin record by name (regardless of enabled state). */
|
|
932
1049
|
declare function findPluginRecord(name: string): Promise<PluginRecord | undefined>;
|
|
933
1050
|
|
|
934
|
-
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 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 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 TocItem, type TreeNode, type UpstreamStatus, WorktreeNotAllowedError, addExternalCollection, addTags, buildArticleTree, buildCollections, buildLinkGraph, buildNavTree, buildSearchIndex, 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, 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 };
|
|
1051
|
+
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 EditTarget, 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 SiteCopyright, type SiteHome, type TocItem, type 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, 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, resolveEditTarget, resolveEditorCommand, resolveHome, resolveLogLevel, resolvePage, resolveProjectCollections, search, seedProjectHome, serializeArticle, setConfigValue, setTags, slugify, toTreeNodes, unregisterCollection, updateArticleBody, upsertPlugin, upstreamStatus, writeConfig, writePluginRegistry, writeRegistry };
|