diffwiki-core 0.10.0 → 0.11.0-rc.202607301234.850d29d
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 +20 -1
- package/dist/index.d.cts +12 -1
- package/dist/index.d.ts +12 -1
- package/dist/index.js +19 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -652,6 +652,7 @@ __export(index_exports, {
|
|
|
652
652
|
search: () => search,
|
|
653
653
|
seedProjectHome: () => seedProjectHome,
|
|
654
654
|
serializeArticle: () => serializeArticle,
|
|
655
|
+
setArticleMeta: () => setArticleMeta,
|
|
655
656
|
setConfigValue: () => setConfigValue,
|
|
656
657
|
setTags: () => setTags,
|
|
657
658
|
slugify: () => slugify,
|
|
@@ -851,7 +852,11 @@ async function createArticle(opts) {
|
|
|
851
852
|
const body = opts.body ?? `# ${title}
|
|
852
853
|
`;
|
|
853
854
|
await import_promises5.default.mkdir(dir, { recursive: true });
|
|
854
|
-
await import_promises5.default.writeFile(
|
|
855
|
+
await import_promises5.default.writeFile(
|
|
856
|
+
filePath,
|
|
857
|
+
serializeArticle({ title, tags: opts.tags, body, audience: opts.audience, status: opts.status }),
|
|
858
|
+
"utf8"
|
|
859
|
+
);
|
|
855
860
|
void fireHook2("article-created", name, import_node_path3.default.relative(dir, filePath));
|
|
856
861
|
return { title, tags: opts.tags, path: filePath, collection: name };
|
|
857
862
|
}
|
|
@@ -911,6 +916,19 @@ function removeTags(target, tags) {
|
|
|
911
916
|
function setTags(target, tags) {
|
|
912
917
|
return mutateTags(target, () => Array.from(new Set(tags)));
|
|
913
918
|
}
|
|
919
|
+
async function setArticleMeta(target, meta) {
|
|
920
|
+
const { filePath, dir, raw, collection } = await loadArticle(target);
|
|
921
|
+
const parsed = parseArticle(raw);
|
|
922
|
+
const audience = meta.audience ?? parsed.audience;
|
|
923
|
+
const status = meta.status ?? parsed.status;
|
|
924
|
+
await import_promises5.default.writeFile(
|
|
925
|
+
filePath,
|
|
926
|
+
serializeArticle({ title: parsed.title, tags: parsed.tags, audience, status, body: parsed.body }),
|
|
927
|
+
"utf8"
|
|
928
|
+
);
|
|
929
|
+
void fireHook2("article-updated", collection, import_node_path3.default.relative(dir, filePath));
|
|
930
|
+
return { title: parsed.title, tags: parsed.tags, path: filePath, collection };
|
|
931
|
+
}
|
|
914
932
|
async function removeArticle(target) {
|
|
915
933
|
const { filePath, dir, collection } = await loadArticle(target);
|
|
916
934
|
await import_promises5.default.rm(filePath);
|
|
@@ -2611,6 +2629,7 @@ init_registry2();
|
|
|
2611
2629
|
search,
|
|
2612
2630
|
seedProjectHome,
|
|
2613
2631
|
serializeArticle,
|
|
2632
|
+
setArticleMeta,
|
|
2614
2633
|
setConfigValue,
|
|
2615
2634
|
setTags,
|
|
2616
2635
|
slugify,
|
package/dist/index.d.cts
CHANGED
|
@@ -426,11 +426,22 @@ declare function createArticle(opts: {
|
|
|
426
426
|
target: string;
|
|
427
427
|
tags: string[];
|
|
428
428
|
body?: string;
|
|
429
|
+
audience?: Audience;
|
|
430
|
+
status?: PublishStatus;
|
|
429
431
|
}): Promise<Article>;
|
|
430
432
|
declare function updateArticleBody(target: string, body: string): Promise<Article>;
|
|
431
433
|
declare function addTags(target: string, tags: string[]): Promise<Article>;
|
|
432
434
|
declare function removeTags(target: string, tags: string[]): Promise<Article>;
|
|
433
435
|
declare function setTags(target: string, tags: string[]): Promise<Article>;
|
|
436
|
+
/**
|
|
437
|
+
* Set an article's audience and/or status. Unspecified axes are left as-is; the
|
|
438
|
+
* serializer drops frontmatter for default values (public/published), so setting
|
|
439
|
+
* an axis back to its default cleans it out of the file.
|
|
440
|
+
*/
|
|
441
|
+
declare function setArticleMeta(target: string, meta: {
|
|
442
|
+
audience?: Audience;
|
|
443
|
+
status?: PublishStatus;
|
|
444
|
+
}): Promise<Article>;
|
|
434
445
|
declare function removeArticle(target: string): Promise<string>;
|
|
435
446
|
|
|
436
447
|
declare const REPO_CONFIG_FILE = "diffwiki.yaml";
|
|
@@ -1048,4 +1059,4 @@ declare function findEnabledPlugin(kind: PluginKind, name?: string): Promise<Plu
|
|
|
1048
1059
|
/** Find a plugin record by name (regardless of enabled state). */
|
|
1049
1060
|
declare function findPluginRecord(name: string): Promise<PluginRecord | undefined>;
|
|
1050
1061
|
|
|
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 };
|
|
1062
|
+
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, setArticleMeta, setConfigValue, setTags, slugify, toTreeNodes, unregisterCollection, updateArticleBody, upsertPlugin, upstreamStatus, writeConfig, writePluginRegistry, writeRegistry };
|
package/dist/index.d.ts
CHANGED
|
@@ -426,11 +426,22 @@ declare function createArticle(opts: {
|
|
|
426
426
|
target: string;
|
|
427
427
|
tags: string[];
|
|
428
428
|
body?: string;
|
|
429
|
+
audience?: Audience;
|
|
430
|
+
status?: PublishStatus;
|
|
429
431
|
}): Promise<Article>;
|
|
430
432
|
declare function updateArticleBody(target: string, body: string): Promise<Article>;
|
|
431
433
|
declare function addTags(target: string, tags: string[]): Promise<Article>;
|
|
432
434
|
declare function removeTags(target: string, tags: string[]): Promise<Article>;
|
|
433
435
|
declare function setTags(target: string, tags: string[]): Promise<Article>;
|
|
436
|
+
/**
|
|
437
|
+
* Set an article's audience and/or status. Unspecified axes are left as-is; the
|
|
438
|
+
* serializer drops frontmatter for default values (public/published), so setting
|
|
439
|
+
* an axis back to its default cleans it out of the file.
|
|
440
|
+
*/
|
|
441
|
+
declare function setArticleMeta(target: string, meta: {
|
|
442
|
+
audience?: Audience;
|
|
443
|
+
status?: PublishStatus;
|
|
444
|
+
}): Promise<Article>;
|
|
434
445
|
declare function removeArticle(target: string): Promise<string>;
|
|
435
446
|
|
|
436
447
|
declare const REPO_CONFIG_FILE = "diffwiki.yaml";
|
|
@@ -1048,4 +1059,4 @@ declare function findEnabledPlugin(kind: PluginKind, name?: string): Promise<Plu
|
|
|
1048
1059
|
/** Find a plugin record by name (regardless of enabled state). */
|
|
1049
1060
|
declare function findPluginRecord(name: string): Promise<PluginRecord | undefined>;
|
|
1050
1061
|
|
|
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 };
|
|
1062
|
+
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, setArticleMeta, setConfigValue, setTags, slugify, toTreeNodes, unregisterCollection, updateArticleBody, upsertPlugin, upstreamStatus, writeConfig, writePluginRegistry, writeRegistry };
|
package/dist/index.js
CHANGED
|
@@ -217,7 +217,11 @@ async function createArticle(opts) {
|
|
|
217
217
|
const body = opts.body ?? `# ${title}
|
|
218
218
|
`;
|
|
219
219
|
await fs2.mkdir(dir, { recursive: true });
|
|
220
|
-
await fs2.writeFile(
|
|
220
|
+
await fs2.writeFile(
|
|
221
|
+
filePath,
|
|
222
|
+
serializeArticle({ title, tags: opts.tags, body, audience: opts.audience, status: opts.status }),
|
|
223
|
+
"utf8"
|
|
224
|
+
);
|
|
221
225
|
void fireHook("article-created", name, path.relative(dir, filePath));
|
|
222
226
|
return { title, tags: opts.tags, path: filePath, collection: name };
|
|
223
227
|
}
|
|
@@ -277,6 +281,19 @@ function removeTags(target, tags) {
|
|
|
277
281
|
function setTags(target, tags) {
|
|
278
282
|
return mutateTags(target, () => Array.from(new Set(tags)));
|
|
279
283
|
}
|
|
284
|
+
async function setArticleMeta(target, meta) {
|
|
285
|
+
const { filePath, dir, raw, collection } = await loadArticle(target);
|
|
286
|
+
const parsed = parseArticle(raw);
|
|
287
|
+
const audience = meta.audience ?? parsed.audience;
|
|
288
|
+
const status = meta.status ?? parsed.status;
|
|
289
|
+
await fs2.writeFile(
|
|
290
|
+
filePath,
|
|
291
|
+
serializeArticle({ title: parsed.title, tags: parsed.tags, audience, status, body: parsed.body }),
|
|
292
|
+
"utf8"
|
|
293
|
+
);
|
|
294
|
+
void fireHook("article-updated", collection, path.relative(dir, filePath));
|
|
295
|
+
return { title: parsed.title, tags: parsed.tags, path: filePath, collection };
|
|
296
|
+
}
|
|
280
297
|
async function removeArticle(target) {
|
|
281
298
|
const { filePath, dir, collection } = await loadArticle(target);
|
|
282
299
|
await fs2.rm(filePath);
|
|
@@ -1857,6 +1874,7 @@ export {
|
|
|
1857
1874
|
search,
|
|
1858
1875
|
seedProjectHome,
|
|
1859
1876
|
serializeArticle,
|
|
1877
|
+
setArticleMeta,
|
|
1860
1878
|
setConfigValue,
|
|
1861
1879
|
setTags,
|
|
1862
1880
|
slugify,
|