narrarium-sdk
v0.1.21
Published
Remote GitHub and Azure DevOps SDK surface for Narrarium repositories.
Maintainers
Readme
narrarium-sdk
Dedicated TypeScript SDK package for loading, editing, and pushing Narrarium repositories over GitHub or Azure DevOps.
narrarium remains the lower-level base package. narrarium-sdk re-exports the remote SDK surface on top of it so npm consumers can install a focused package.
Install
npm install narrarium-sdkIncludes
BookManagerGitHubRemoteProviderAzureDevOpsRemoteProviderNarrariumApiClientfor calling the server endpoints exposed byNarrarium.Sdk.AspNetCore- profile stores for memory and localStorage
- in-memory book snapshots and workspaces
- high-level workspace helpers for chapters, paragraphs, and characters
- markdown snapshot builders and serializers for Narrarium documents
HTTP note helpers exposed by NarrariumApiClient include:
updateBookNotes(...)updateStoryDesign(...)updateChapterNotes(...)
Structured work-item helpers include:
saveBookItem(...)saveChapterItem(...)promoteBookItem(...)promoteChapterItem(...)
Quick example
import {
BookManager,
GitHubRemoteProvider,
LocalStorageBookProfileStore,
} from "narrarium-sdk";
const manager = new BookManager({
profileStore: new LocalStorageBookProfileStore(),
providers: [new GitHubRemoteProvider()],
});
const profile = await manager.createGitHubProfile({
name: "Primary Book",
owner: "your-org",
repository: "your-book",
branch: "main",
token: "github-token",
});
const snapshot = await manager.loadBook(profile);
const workspace = manager.beginWorkspace(snapshot);
workspace.upsertCharacter({
slug: "lyra-vale",
frontmatter: {
type: "character",
id: "character:lyra-vale",
name: "Lyra Vale",
canon: "draft",
tags: [],
refs: [],
sources: [],
historical: false,
secret_refs: [],
aliases: [],
former_names: [],
identity_shifts: [],
role_tier: "supporting",
story_role: "other",
traits: [],
mannerisms: [],
desires: [],
fears: [],
relationships: [],
factions: [],
timeline_ages: {},
},
body: "# Overview\n\nA careful broker.",
});
await manager.commitAndPush(profile, snapshot, workspace, {
message: "Add Lyra character profile",
});Relationship with narrarium
narrarium: base package with schemas, repo helpers, and shared SDK internalsnarrarium-sdk: focused remote SDK package for npm consumers
