world-building-framework 0.0.0-stage → 0.2.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/LICENSE +9 -0
- package/README.md +104 -2
- package/dist/cli/check.d.ts +13 -0
- package/dist/cli/check.js +11 -0
- package/dist/cli/commands/create.d.ts +26 -0
- package/dist/cli/commands/create.js +35 -0
- package/dist/cli/commands/init.d.ts +26 -0
- package/dist/cli/commands/init.js +119 -0
- package/dist/cli/commands/list-variants.d.ts +1 -0
- package/dist/cli/commands/list-variants.js +7 -0
- package/dist/cli/commands/publish.d.ts +24 -0
- package/dist/cli/commands/publish.js +71 -0
- package/dist/cli/commands/refresh.d.ts +29 -0
- package/dist/cli/commands/refresh.js +70 -0
- package/dist/cli/commands/render.d.ts +14 -0
- package/dist/cli/commands/render.js +27 -0
- package/dist/cli/commands/schema.d.ts +2 -0
- package/dist/cli/commands/schema.js +9 -0
- package/dist/cli/commands/search.d.ts +9 -0
- package/dist/cli/commands/search.js +20 -0
- package/dist/cli/commands/update.d.ts +23 -0
- package/dist/cli/commands/update.js +69 -0
- package/dist/cli/commands/validate.d.ts +21 -0
- package/dist/cli/commands/validate.js +44 -0
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/index.js +157 -0
- package/dist/cli/io.d.ts +4 -0
- package/dist/cli/io.js +25 -0
- package/dist/cli/managed-files.d.ts +35 -0
- package/dist/cli/managed-files.js +80 -0
- package/dist/cli/quartz-runner.d.ts +22 -0
- package/dist/cli/quartz-runner.js +76 -0
- package/dist/cli/quartz-setup.d.ts +10 -0
- package/dist/cli/quartz-setup.js +59 -0
- package/dist/cli/vault-path.d.ts +7 -0
- package/dist/cli/vault-path.js +44 -0
- package/dist/core/config/build-variants.d.ts +5 -0
- package/dist/core/config/build-variants.js +13 -0
- package/dist/core/config/index.d.ts +4 -0
- package/dist/core/config/index.js +4 -0
- package/dist/core/config/load.d.ts +4 -0
- package/dist/core/config/load.js +25 -0
- package/dist/core/config/schema.d.ts +229 -0
- package/dist/core/config/schema.js +23 -0
- package/dist/core/config/validate-options.d.ts +4 -0
- package/dist/core/config/validate-options.js +4 -0
- package/dist/core/graph/build.d.ts +8 -0
- package/dist/core/graph/build.js +42 -0
- package/dist/core/graph/causal.d.ts +22 -0
- package/dist/core/graph/causal.js +106 -0
- package/dist/core/graph/dating.d.ts +18 -0
- package/dist/core/graph/dating.js +30 -0
- package/dist/core/graph/entities.d.ts +13 -0
- package/dist/core/graph/entities.js +22 -0
- package/dist/core/graph/index.d.ts +7 -0
- package/dist/core/graph/index.js +7 -0
- package/dist/core/graph/queries.d.ts +3 -0
- package/dist/core/graph/queries.js +8 -0
- package/dist/core/graph/types.d.ts +14 -0
- package/dist/core/graph/types.js +1 -0
- package/dist/core/graph/versioning.d.ts +15 -0
- package/dist/core/graph/versioning.js +50 -0
- package/dist/core/id.d.ts +3 -0
- package/dist/core/id.js +9 -0
- package/dist/core/lint/after-loops.d.ts +15 -0
- package/dist/core/lint/after-loops.js +34 -0
- package/dist/core/lint/dangling-links.d.ts +9 -0
- package/dist/core/lint/dangling-links.js +46 -0
- package/dist/core/lint/events-without-entities.d.ts +4 -0
- package/dist/core/lint/events-without-entities.js +9 -0
- package/dist/core/lint/forked-versions.d.ts +14 -0
- package/dist/core/lint/forked-versions.js +29 -0
- package/dist/core/lint/index.d.ts +6 -0
- package/dist/core/lint/index.js +6 -0
- package/dist/core/lint/lint.d.ts +24 -0
- package/dist/core/lint/lint.js +50 -0
- package/dist/core/lint/target-types.d.ts +9 -0
- package/dist/core/lint/target-types.js +47 -0
- package/dist/core/query/dates.d.ts +70 -0
- package/dist/core/query/dates.js +43 -0
- package/dist/core/query/index.d.ts +2 -0
- package/dist/core/query/index.js +2 -0
- package/dist/core/query/types.d.ts +75 -0
- package/dist/core/query/types.js +12 -0
- package/dist/core/schema/describe.d.ts +8 -0
- package/dist/core/schema/describe.js +51 -0
- package/dist/core/schema/fields.d.ts +249 -0
- package/dist/core/schema/fields.js +43 -0
- package/dist/core/schema/index.d.ts +4 -0
- package/dist/core/schema/index.js +4 -0
- package/dist/core/schema/validate.d.ts +22 -0
- package/dist/core/schema/validate.js +34 -0
- package/dist/core/schema/wikilink.d.ts +8 -0
- package/dist/core/schema/wikilink.js +23 -0
- package/dist/core/search/build.d.ts +11 -0
- package/dist/core/search/build.js +26 -0
- package/dist/core/search/columns.d.ts +9 -0
- package/dist/core/search/columns.js +14 -0
- package/dist/core/search/index.d.ts +3 -0
- package/dist/core/search/index.js +3 -0
- package/dist/core/search/search.d.ts +3 -0
- package/dist/core/search/search.js +35 -0
- package/dist/core/search/types.d.ts +18 -0
- package/dist/core/search/types.js +1 -0
- package/dist/core/vault/index.d.ts +6 -0
- package/dist/core/vault/index.js +6 -0
- package/dist/core/vault/parse.d.ts +8 -0
- package/dist/core/vault/parse.js +11 -0
- package/dist/core/vault/read.d.ts +13 -0
- package/dist/core/vault/read.js +62 -0
- package/dist/core/vault/relink.d.ts +10 -0
- package/dist/core/vault/relink.js +33 -0
- package/dist/core/vault/serialize.d.ts +4 -0
- package/dist/core/vault/serialize.js +4 -0
- package/dist/core/vault/types.d.ts +5 -0
- package/dist/core/vault/types.js +1 -0
- package/dist/core/vault/write.d.ts +18 -0
- package/dist/core/vault/write.js +37 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +11 -0
- package/dist/render-pipeline/build.d.ts +9 -0
- package/dist/render-pipeline/build.js +45 -0
- package/dist/render-pipeline/filter.d.ts +21 -0
- package/dist/render-pipeline/filter.js +80 -0
- package/dist/render-pipeline/index.d.ts +10 -0
- package/dist/render-pipeline/index.js +10 -0
- package/dist/render-pipeline/merge.d.ts +11 -0
- package/dist/render-pipeline/merge.js +21 -0
- package/dist/render-pipeline/quartz-compat.d.ts +1 -0
- package/dist/render-pipeline/quartz-compat.js +18 -0
- package/dist/render-pipeline/rewrite.d.ts +8 -0
- package/dist/render-pipeline/rewrite.js +23 -0
- package/dist/render-pipeline/slugs.d.ts +7 -0
- package/dist/render-pipeline/slugs.js +30 -0
- package/dist/render-pipeline/sync.d.ts +9 -0
- package/dist/render-pipeline/sync.js +18 -0
- package/dist/render-pipeline/types.d.ts +8 -0
- package/dist/render-pipeline/types.js +1 -0
- package/dist/render-pipeline/write.d.ts +3 -0
- package/dist/render-pipeline/write.js +12 -0
- package/package.json +46 -4
- package/skills/world-vault/SKILL.md +100 -0
- package/templates/AGENTS.md +11 -0
- package/templates/gitignore +5 -0
- package/templates/publish.yml +54 -0
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: world-vault
|
|
3
|
+
description: Search, create, correct, and validate entity/event files in a World Building Framework world via the `wbf` CLI. Use whenever the user wants to look up, add, or change world-building content (characters, locations, events, factions, ...) in this repo.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# World Vault authoring
|
|
7
|
+
|
|
8
|
+
This repo is a world built with the World Building Framework. Its content is a vault of entity/event Markdown files, named by UUID, next to a `world.config.json`. You read and write it through the `wbf` command-line tool, which prints JSON.
|
|
9
|
+
|
|
10
|
+
**Never hand-write or hand-edit a vault file.** Only `wbf create` and `wbf update` validate content before it touches disk, and only `create` generates the required UUID filename.
|
|
11
|
+
|
|
12
|
+
Run every command from the repo root as `npx wbf <command>`. That runs the framework version installed in this repo. If it reports "No vault specified", you're not in the folder that holds `world.config.json`: change into it, or pass `--vault <path>`.
|
|
13
|
+
|
|
14
|
+
Commands that take JSON input read it from stdin, or from a file with `--input <file>`. Use a file when piping is awkward in your shell.
|
|
15
|
+
|
|
16
|
+
## 1. Check the current schema before writing anything
|
|
17
|
+
|
|
18
|
+
```
|
|
19
|
+
npx wbf schema
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
This prints the framework's fixed fields, plus this world's own `entityType` list from `world.config.json`, if it declares one. Run it whenever you're unsure which fields are valid, especially before creating an entity with an `entityType` you haven't seen used here yet.
|
|
23
|
+
|
|
24
|
+
## 2. Search before creating
|
|
25
|
+
|
|
26
|
+
Search for what already exists before adding anything. That avoids duplicating an entity, and gives you the UUIDs you need to link to things:
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
npx wbf search <query terms...>
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Each result has an `id` (the UUID you link with), `title` and `score`, and for entities `entityType` and `tags`. Add `--tags a,b` to require specific tags, and `--limit N` to cap the results.
|
|
33
|
+
|
|
34
|
+
## 3. Writing links
|
|
35
|
+
|
|
36
|
+
Every relation, in frontmatter or in body text, uses this link form: the target's UUID before the pipe, and its current title after it.
|
|
37
|
+
|
|
38
|
+
```
|
|
39
|
+
[[3af2c9d1-8b4e-4c6a-91f0-2d5e7a9b1c33|Port Kavas]]
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Get the UUID from a search result's `id`, or from the `id` a `create` call just returned. Never write a bare `[[Display Name]]`. The vault only resolves links by UUID.
|
|
43
|
+
|
|
44
|
+
## 4. Propose before writing
|
|
45
|
+
|
|
46
|
+
No tool here enforces an approval step, so that's your job. Before calling `create` or `update`, show the user the frontmatter and body you're about to write, and wait for their go-ahead, the way you'd show a diff before editing code.
|
|
47
|
+
|
|
48
|
+
## 5. Validate before (or instead of) creating
|
|
49
|
+
|
|
50
|
+
To check a candidate without writing it:
|
|
51
|
+
|
|
52
|
+
```
|
|
53
|
+
echo '{"frontmatter": {"type": "entity", "title": "Alea Vantorr", "entityType": "character"}}' | npx wbf validate --input -
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Each issue has a `severity`:
|
|
57
|
+
- Fix every `"error"` (schema problems, dangling links, wrong link targets) before calling `create`.
|
|
58
|
+
- A `"warning"` (e.g. an event with no `entities` yet) doesn't block anything. Mention it to the user, but it's fine to proceed.
|
|
59
|
+
|
|
60
|
+
`create` runs these same checks, so `valid: true` here means `create` will succeed.
|
|
61
|
+
|
|
62
|
+
## 6. Creating a file
|
|
63
|
+
|
|
64
|
+
```
|
|
65
|
+
echo '{"frontmatter": {...}, "body": "..."}' | npx wbf create
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
- **Required fields:** `type` and `title`. Everything else depends on whether it's an entity or an event; see `npx wbf schema`.
|
|
69
|
+
- **On success** it prints `{"written": true, "id": "...", "path": "..."}`, plus an `issues` list if there were warnings. Tell the user the new `id`, since anything that links to this file needs that UUID.
|
|
70
|
+
- **If any link points at an id that doesn't exist**, nothing is written, and the error is reported instead.
|
|
71
|
+
|
|
72
|
+
## 7. Correcting an existing file
|
|
73
|
+
|
|
74
|
+
For a **correction** (a typo, a wrong tag, a missing link, badly written text), replace the file in place:
|
|
75
|
+
|
|
76
|
+
```
|
|
77
|
+
echo '{"frontmatter": {...}, "body": "..."}' | npx wbf update --id <uuid>
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
- **Send the complete content.** The input is the file's whole new content, not just the changed fields. Read the current file (`<uuid>.md`) first, change what needs changing, and send all of it. Any field you leave out is removed.
|
|
81
|
+
- **Same checks as `create`**, and `type` can't change.
|
|
82
|
+
- **Show the user what you're changing** before calling it, as with `create`.
|
|
83
|
+
|
|
84
|
+
Changing a `title` also changes **other files**:
|
|
85
|
+
- Every link elsewhere written as `[[<uuid>|<old title>]]` is rewritten to show the new title.
|
|
86
|
+
- Links with different display text, like `[[<uuid>|the old harbour]]`, are left alone.
|
|
87
|
+
- When proposing a rename, tell the user other files will be updated too. Search the vault for `[[<uuid>|<old title>]]` to say which ones.
|
|
88
|
+
- The result lists them under `relinked`. Any file under `relinkFailed` is already invalid on its own and kept the old name; report it to the user.
|
|
89
|
+
|
|
90
|
+
`update` is only for things that were wrong. If something changed **in the story**, use section 8 instead.
|
|
91
|
+
|
|
92
|
+
## 8. Recording a change to an existing entity: never edit it in place
|
|
93
|
+
|
|
94
|
+
When an event changes something about an entity (it looks different, its status changed, and so on), that's **not** an edit to the existing file. Create a **new** entity file with these two fields:
|
|
95
|
+
- `supersedes`: a link to the entity's current file. That's its **latest** version, not the anchor, unless the anchor is the only version so far. A "Fork in the version chain" warning almost always means you pointed at an older version. Tell the user and fix it with `update`, unless they deliberately want a story branch.
|
|
96
|
+
- `causedBy`: a link to the event that caused the change.
|
|
97
|
+
|
|
98
|
+
Both fields are required together. The vault keeps every version, and the published wiki shows the whole history. Never overwrite an entity file's body to reflect an in-world change; that erases history the vault is designed to keep.
|
|
99
|
+
|
|
100
|
+
Other files always link to an entity's **original, first-ever** file (its anchor), never to a later version. If you're not sure which id is the anchor, follow the file's `supersedes` chain back. Or reuse whatever id you already have for that entity: that's always the anchor once created.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Agent instructions
|
|
2
|
+
|
|
3
|
+
This repo is a world built with the World Building Framework (version __WBF_VERSION__). Its content is a vault of UUID-named Markdown files next to `world.config.json`.
|
|
4
|
+
|
|
5
|
+
- Read and write the vault only through the `wbf` command-line tool: run `npx wbf <command>` from this folder. It prints JSON.
|
|
6
|
+
- Run `npx wbf schema` before writing anything, `npx wbf search <terms>` before creating something, and `npx wbf --help` for every command.
|
|
7
|
+
- Never hand-write or hand-edit a vault `.md` file. Only `wbf create` and `wbf update` validate content, and only `create` generates the required UUID filename.
|
|
8
|
+
- Show the user what you're about to write, and wait for their go-ahead, before `create` or `update`.
|
|
9
|
+
- If skills were installed for your agent (`npx wbf init --agent <name>`), the `world-vault` skill has the full workflow.
|
|
10
|
+
|
|
11
|
+
Generated by `wbf init`. `npx wbf refresh` keeps it current while it's unedited.
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# Generated by world-building-framework __WBF_VERSION__ (`wbf init`).
|
|
2
|
+
# `npx wbf refresh` updates this file to the installed framework version, but
|
|
3
|
+
# only while you haven't edited it. Once you change it, it's yours to maintain.
|
|
4
|
+
name: Publish wiki
|
|
5
|
+
|
|
6
|
+
on:
|
|
7
|
+
push:
|
|
8
|
+
branches: [__BRANCH__]
|
|
9
|
+
workflow_dispatch: {}
|
|
10
|
+
|
|
11
|
+
permissions:
|
|
12
|
+
contents: read
|
|
13
|
+
pages: write
|
|
14
|
+
id-token: write
|
|
15
|
+
|
|
16
|
+
concurrency:
|
|
17
|
+
group: pages
|
|
18
|
+
cancel-in-progress: true
|
|
19
|
+
|
|
20
|
+
jobs:
|
|
21
|
+
build:
|
|
22
|
+
runs-on: ubuntu-latest
|
|
23
|
+
steps:
|
|
24
|
+
- uses: actions/checkout@v4
|
|
25
|
+
|
|
26
|
+
- uses: actions/setup-node@v4
|
|
27
|
+
with:
|
|
28
|
+
node-version: 22
|
|
29
|
+
cache: npm
|
|
30
|
+
|
|
31
|
+
- name: Install the framework (version pinned in package.json)
|
|
32
|
+
run: npm ci
|
|
33
|
+
|
|
34
|
+
# Runs before publish so its base_url output (the Pages site's real
|
|
35
|
+
# address) can be handed to Quartz.
|
|
36
|
+
- uses: actions/configure-pages@v5
|
|
37
|
+
id: pages
|
|
38
|
+
|
|
39
|
+
- name: Publish every build variant
|
|
40
|
+
run: npx wbf publish --output ./site --base-url "${{ steps.pages.outputs.base_url }}"
|
|
41
|
+
|
|
42
|
+
- uses: actions/upload-pages-artifact@v3
|
|
43
|
+
with:
|
|
44
|
+
path: ./site
|
|
45
|
+
|
|
46
|
+
deploy:
|
|
47
|
+
needs: build
|
|
48
|
+
runs-on: ubuntu-latest
|
|
49
|
+
environment:
|
|
50
|
+
name: github-pages
|
|
51
|
+
url: ${{ steps.deployment.outputs.page_url }}
|
|
52
|
+
steps:
|
|
53
|
+
- uses: actions/deploy-pages@v4
|
|
54
|
+
id: deployment
|