rpg-engine 0.7.0 → 0.8.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/dist/adventures/index.d.ts +1 -1
- package/dist/adventures/index.js +1 -1
- package/dist/adventures/source.js +13 -13
- package/dist/campaign/create-campaign.js +10 -1
- package/dist/campaign/host-files.d.ts +2 -1
- package/dist/campaign/host-files.js +11 -11
- package/dist/campaign/index.d.ts +1 -1
- package/dist/campaign/index.js +1 -1
- package/dist/campaign/settings.d.ts +55 -64
- package/dist/campaign/settings.js +171 -174
- package/dist/{cli.js → cli/cli.js} +3 -3
- package/dist/{command-line.d.ts → cli/command-line.d.ts} +1 -1
- package/dist/{command-line.js → cli/command-line.js} +21 -20
- package/dist/commands/advance.d.ts +1 -1
- package/dist/commands/advance.js +7 -7
- package/dist/commands/ask.d.ts +1 -8
- package/dist/commands/ask.js +16 -29
- package/dist/commands/{change.d.ts → change/change.d.ts} +2 -2
- package/dist/commands/{change.js → change/change.js} +46 -52
- package/dist/commands/{game-damage.d.ts → change/damage.d.ts} +2 -2
- package/dist/commands/{game-damage.js → change/damage.js} +3 -3
- package/dist/commands/{game-recipe-pace.d.ts → change/recipe-pace.d.ts} +2 -2
- package/dist/commands/{game-recipe-pace.js → change/recipe-pace.js} +4 -4
- package/dist/commands/config.d.ts +4 -4
- package/dist/commands/config.js +142 -138
- package/dist/commands/effect.d.ts +1 -1
- package/dist/commands/effect.js +11 -12
- package/dist/commands/find.d.ts +4 -4
- package/dist/commands/find.js +2 -2
- package/dist/commands/image.js +6 -6
- package/dist/commands/{import.d.ts → import/import.d.ts} +2 -2
- package/dist/commands/{import.js → import/import.js} +101 -101
- package/dist/commands/{game-import.d.ts → import/run.d.ts} +3 -3
- package/dist/commands/{game-import.js → import/run.js} +13 -12
- package/dist/commands/index.js +7 -7
- package/dist/commands/init.js +3 -3
- package/dist/commands/install.js +1 -1
- package/dist/commands/instructions.js +6 -6
- package/dist/commands/mode.d.ts +2 -2
- package/dist/commands/mode.js +8 -8
- package/dist/commands/mood.js +4 -4
- package/dist/commands/move.js +13 -20
- package/dist/commands/package.d.ts +2 -2
- package/dist/commands/package.js +138 -93
- package/dist/commands/rename.js +3 -3
- package/dist/commands/reveal.js +29 -18
- package/dist/commands/{roll.d.ts → roll/roll.d.ts} +4 -4
- package/dist/commands/{roll.js → roll/roll.js} +69 -69
- package/dist/commands/{game-tables.d.ts → roll/tables.d.ts} +2 -2
- package/dist/commands/{game-tables.js → roll/tables.js} +4 -4
- package/dist/commands/rules.d.ts +2 -2
- package/dist/commands/rules.js +3 -3
- package/dist/commands/save.d.ts +1 -1
- package/dist/commands/save.js +18 -18
- package/dist/commands/scene.d.ts +4 -4
- package/dist/commands/scene.js +31 -28
- package/dist/commands/{game-advance.d.ts → shared/advance.d.ts} +4 -4
- package/dist/commands/{game-advance.js → shared/advance.js} +27 -27
- package/dist/commands/{game-adventures.d.ts → shared/adventures.d.ts} +3 -3
- package/dist/commands/{game-adventures.js → shared/adventures.js} +20 -27
- package/dist/commands/{game-bonds.d.ts → shared/bonds.d.ts} +3 -3
- package/dist/commands/{game-bonds.js → shared/bonds.js} +2 -2
- package/dist/commands/{game-checks.d.ts → shared/checks.d.ts} +3 -3
- package/dist/commands/{game-checks.js → shared/checks.js} +7 -7
- package/dist/commands/{game-dice-pool.d.ts → shared/dice-pool.d.ts} +3 -3
- package/dist/commands/{game-dice-pool.js → shared/dice-pool.js} +19 -12
- package/dist/commands/{effect-layer.d.ts → shared/effect-layer.d.ts} +2 -2
- package/dist/commands/{effect-layer.js → shared/effect-layer.js} +12 -12
- package/dist/commands/{game-effects.d.ts → shared/effects.d.ts} +7 -7
- package/dist/commands/{game-effects.js → shared/effects.js} +19 -19
- package/dist/commands/{game-environment.d.ts → shared/environment.d.ts} +1 -1
- package/dist/commands/{game-environment.js → shared/environment.js} +3 -3
- package/dist/commands/{game-events.d.ts → shared/events.d.ts} +5 -5
- package/dist/commands/{game-events.js → shared/events.js} +20 -22
- package/dist/commands/{game-examples.d.ts → shared/examples.d.ts} +4 -8
- package/dist/commands/{game-examples.js → shared/examples.js} +23 -23
- package/dist/commands/{game-experience.d.ts → shared/experience.d.ts} +2 -2
- package/dist/commands/{game-experience.js → shared/experience.js} +8 -11
- package/dist/commands/{game-grid-moves.d.ts → shared/grid-moves.d.ts} +6 -6
- package/dist/commands/{game-grid-moves.js → shared/grid-moves.js} +5 -5
- package/dist/commands/{game-grids.d.ts → shared/grids.d.ts} +4 -9
- package/dist/commands/{game-grids.js → shared/grids.js} +20 -19
- package/dist/commands/{game-images.d.ts → shared/images.d.ts} +3 -3
- package/dist/commands/{game-images.js → shared/images.js} +7 -6
- package/dist/commands/shared/inputs.d.ts +9 -0
- package/dist/commands/shared/inputs.js +12 -0
- package/dist/commands/{game-journey.d.ts → shared/journey.d.ts} +4 -6
- package/dist/commands/{game-journey.js → shared/journey.js} +13 -15
- package/dist/commands/{game-knowledge.d.ts → shared/knowledge.d.ts} +15 -8
- package/dist/commands/{game-knowledge.js → shared/knowledge.js} +42 -42
- package/dist/{library-reader.js → commands/shared/library-reader.js} +4 -4
- package/dist/commands/{game-library.d.ts → shared/library.d.ts} +7 -4
- package/dist/commands/{game-library.js → shared/library.js} +70 -50
- package/dist/commands/{game-limits.d.ts → shared/limits.d.ts} +3 -3
- package/dist/commands/{game-limits.js → shared/limits.js} +3 -3
- package/dist/commands/{game-loot.d.ts → shared/loot.d.ts} +2 -2
- package/dist/commands/{game-loot.js → shared/loot.js} +3 -3
- package/dist/commands/{game-master-rolls.d.ts → shared/master-rolls.d.ts} +2 -2
- package/dist/commands/{game-master-rolls.js → shared/master-rolls.js} +6 -6
- package/dist/commands/{game-mode.d.ts → shared/mode.d.ts} +4 -6
- package/dist/commands/{game-mode.js → shared/mode.js} +10 -10
- package/dist/commands/{game-money.d.ts → shared/money.d.ts} +3 -3
- package/dist/commands/{game-money.js → shared/money.js} +4 -4
- package/dist/commands/{game-moods.d.ts → shared/moods.d.ts} +3 -3
- package/dist/commands/{game-moods.js → shared/moods.js} +3 -3
- package/dist/commands/{game-moves.d.ts → shared/moves.d.ts} +2 -2
- package/dist/commands/{game-moves.js → shared/moves.js} +5 -5
- package/dist/commands/{game-offers.d.ts → shared/offers.d.ts} +3 -3
- package/dist/commands/{game-offers.js → shared/offers.js} +9 -12
- package/dist/commands/{game-outside.d.ts → shared/outside.d.ts} +3 -3
- package/dist/commands/{game-outside.js → shared/outside.js} +9 -9
- package/dist/commands/{game-catalog.d.ts → shared/packages/catalog.d.ts} +1 -3
- package/dist/commands/{game-catalog.js → shared/packages/catalog.js} +17 -22
- package/dist/commands/{game-package-code.d.ts → shared/packages/code.d.ts} +10 -14
- package/dist/commands/{game-package-code.js → shared/packages/code.js} +156 -59
- package/dist/commands/{game-extension-list.d.ts → shared/packages/extensions.d.ts} +6 -6
- package/dist/commands/{game-extension-list.js → shared/packages/extensions.js} +43 -22
- package/dist/commands/{game-package-hooks.d.ts → shared/packages/hooks.d.ts} +3 -3
- package/dist/commands/{game-package-hooks.js → shared/packages/hooks.js} +3 -3
- package/dist/commands/{game-widgets.d.ts → shared/packages/widgets.d.ts} +6 -10
- package/dist/commands/{game-widgets.js → shared/packages/widgets.js} +57 -57
- package/dist/commands/{page-counters.d.ts → shared/page-counters.d.ts} +3 -3
- package/dist/commands/{page-counters.js → shared/page-counters.js} +5 -5
- package/dist/{page-words.d.ts → commands/shared/page-words.d.ts} +2 -2
- package/dist/{page-words.js → commands/shared/page-words.js} +5 -4
- package/dist/commands/{parts.d.ts → shared/parts.d.ts} +3 -3
- package/dist/commands/{parts.js → shared/parts.js} +4 -4
- package/dist/commands/{game-positions.d.ts → shared/positions.d.ts} +3 -5
- package/dist/commands/{game-positions.js → shared/positions.js} +6 -7
- package/dist/commands/{problems.d.ts → shared/problems.d.ts} +3 -3
- package/dist/commands/{problems.js → shared/problems.js} +21 -22
- package/dist/commands/{progression.d.ts → shared/progression.d.ts} +2 -2
- package/dist/commands/{progression.js → shared/progression.js} +4 -4
- package/dist/commands/{game-quests.d.ts → shared/quests.d.ts} +4 -4
- package/dist/commands/{game-quests.js → shared/quests.js} +6 -6
- package/dist/commands/{game-recipes.d.ts → shared/recipes.d.ts} +3 -3
- package/dist/commands/{game-recipes.js → shared/recipes.js} +3 -3
- package/dist/commands/{game-reminders.d.ts → shared/reminders.d.ts} +4 -4
- package/dist/commands/{game-reminders.js → shared/reminders.js} +4 -4
- package/dist/commands/{game-roads.d.ts → shared/roads.d.ts} +5 -5
- package/dist/commands/{game-roads.js → shared/roads.js} +43 -44
- package/dist/commands/{game-rules.d.ts → shared/rules.d.ts} +2 -2
- package/dist/commands/{game-rules.js → shared/rules.js} +4 -4
- package/dist/commands/{game-saves.d.ts → shared/saves.d.ts} +4 -4
- package/dist/commands/{game-saves.js → shared/saves.js} +51 -51
- package/dist/commands/{game-scene.d.ts → shared/scene.d.ts} +13 -3
- package/dist/commands/{game-scene.js → shared/scene.js} +41 -13
- package/dist/commands/{sheet.d.ts → shared/sheet.d.ts} +5 -5
- package/dist/commands/{sheet.js → shared/sheet.js} +76 -76
- package/dist/commands/{game-stacks.d.ts → shared/stacks.d.ts} +2 -9
- package/dist/commands/{game-stacks.js → shared/stacks.js} +22 -22
- package/dist/commands/{game-theme.d.ts → shared/theme.d.ts} +3 -3
- package/dist/commands/{game-theme.js → shared/theme.js} +2 -2
- package/dist/commands/{game-thoughts.d.ts → shared/thoughts.d.ts} +2 -4
- package/dist/commands/{game-thoughts.js → shared/thoughts.js} +6 -8
- package/dist/commands/{game-thresholds.d.ts → shared/thresholds.d.ts} +1 -1
- package/dist/commands/{game-thresholds.js → shared/thresholds.js} +4 -4
- package/dist/commands/{game-time.d.ts → shared/time.d.ts} +4 -4
- package/dist/commands/{game-time.js → shared/time.js} +6 -6
- package/dist/commands/{game-turn-uses.d.ts → shared/turn-uses.d.ts} +3 -3
- package/dist/commands/{game-turn-uses.js → shared/turn-uses.js} +12 -15
- package/dist/commands/{game-upkeep.d.ts → shared/upkeep.d.ts} +3 -3
- package/dist/commands/{game-upkeep.js → shared/upkeep.js} +69 -57
- package/dist/commands/{game-voices.d.ts → shared/voices.d.ts} +1 -1
- package/dist/commands/{game-voices.js → shared/voices.js} +2 -2
- package/dist/commands/{worked-out.d.ts → shared/worked-out.d.ts} +3 -8
- package/dist/commands/{worked-out.js → shared/worked-out.js} +238 -238
- package/dist/commands/{game-world.d.ts → shared/world.d.ts} +5 -14
- package/dist/commands/{game-world.js → shared/world.js} +72 -76
- package/dist/commands/show.d.ts +1 -1
- package/dist/commands/show.js +32 -17
- package/dist/commands/status.d.ts +1 -1
- package/dist/commands/status.js +28 -28
- package/dist/commands/thoughts.js +3 -3
- package/dist/commands/trade.js +9 -10
- package/dist/commands/translate.d.ts +1 -1
- package/dist/commands/translate.js +3 -3
- package/dist/commands/{game-open.d.ts → travel/open.d.ts} +3 -3
- package/dist/commands/{game-open.js → travel/open.js} +4 -5
- package/dist/commands/{route.d.ts → travel/route.d.ts} +1 -1
- package/dist/commands/{route.js → travel/route.js} +9 -10
- package/dist/commands/{travel.d.ts → travel/travel.d.ts} +2 -2
- package/dist/commands/{travel.js → travel/travel.js} +19 -21
- package/dist/commands/validate.js +5 -5
- package/dist/commands/{game-view-journal.d.ts → view/journal.d.ts} +5 -5
- package/dist/commands/{game-view-journal.js → view/journal.js} +5 -5
- package/dist/commands/{game-view-map.d.ts → view/map.d.ts} +3 -3
- package/dist/commands/{game-view-map.js → view/map.js} +15 -16
- package/dist/commands/{game-view-place.d.ts → view/place.d.ts} +6 -6
- package/dist/commands/{game-view-place.js → view/place.js} +108 -108
- package/dist/commands/{view.d.ts → view/view.d.ts} +16 -16
- package/dist/commands/{view.js → view/view.js} +35 -35
- package/dist/commands/{game-view-world.d.ts → view/world.d.ts} +4 -4
- package/dist/commands/{game-view-world.js → view/world.js} +7 -7
- package/dist/commands/{game-here.d.ts → write/here.d.ts} +5 -3
- package/dist/commands/{game-here.js → write/here.js} +18 -12
- package/dist/commands/{write.d.ts → write/write.d.ts} +6 -6
- package/dist/commands/{write.js → write/write.js} +44 -41
- package/dist/confirm/confirm.d.ts +2 -0
- package/dist/confirm/confirm.js +15 -5
- package/dist/core/consents.d.ts +3 -2
- package/dist/core/consents.js +43 -4
- package/dist/core/context.d.ts +8 -6
- package/dist/core/context.js +4 -2
- package/dist/core/download.js +16 -5
- package/dist/core/files.d.ts +6 -1
- package/dist/core/files.js +47 -21
- package/dist/core/formula.d.ts +7 -2
- package/dist/core/formula.js +63 -66
- package/dist/core/instruction-parts.js +1 -1
- package/dist/core/mood.d.ts +0 -1
- package/dist/core/mood.js +3 -3
- package/dist/core/package-api.d.ts +11 -0
- package/dist/core/package-api.js +2 -1
- package/dist/core/package-declarations.d.ts +9 -9
- package/dist/core/package-declarations.js +3 -3
- package/dist/core/process-mark.d.ts +8 -0
- package/dist/core/process-mark.js +72 -0
- package/dist/core/registry.d.ts +5 -0
- package/dist/core/registry.js +10 -0
- package/dist/core/session-store.d.ts +0 -1
- package/dist/core/session-store.js +11 -14
- package/dist/core/store.d.ts +4 -0
- package/dist/core/store.js +29 -8
- package/dist/core/text.d.ts +4 -0
- package/dist/core/text.js +11 -2
- package/dist/core/yaml-file.js +2 -2
- package/dist/dashboard/{acts.js → acts/acts.js} +2 -2
- package/dist/dashboard/{act-names.js → acts/names.js} +1 -1
- package/dist/dashboard/{act-sheet.js → acts/sheet.js} +3 -3
- package/dist/dashboard/{act-strip.js → acts/strip.js} +2 -2
- package/dist/dashboard/app.js +13 -13
- package/dist/dashboard/asked.js +1 -1
- package/dist/dashboard/dice/burn.js +1 -1
- package/dist/dashboard/dice/stage.js +1 -1
- package/dist/dashboard/{guide-blocks.js → help/blocks.js} +1 -1
- package/dist/dashboard/{help.js → help/help.js} +6 -6
- package/dist/dashboard/journal.js +1 -1
- package/dist/dashboard/kit.js +6 -5
- package/dist/dashboard/labels.js +7 -3
- package/dist/dashboard/markdown.js +1 -1
- package/dist/dashboard/{ask-card.js → packages/ask-card.js} +6 -6
- package/dist/dashboard/{package-page.js → packages/package-page.js} +3 -3
- package/dist/dashboard/{packages.js → packages/packages.js} +12 -12
- package/dist/dashboard/{page-code.js → packages/page-code.js} +4 -4
- package/dist/dashboard/{extension-widgets.js → packages/widgets.js} +5 -5
- package/dist/dashboard/party.js +1 -1
- package/dist/dashboard/person-panel.js +2 -13
- package/dist/dashboard/{map-sheet.js → place/map-sheet.js} +4 -4
- package/dist/dashboard/{place-map-view.js → place/map-view.js} +11 -11
- package/dist/dashboard/scene.js +4 -4
- package/dist/dashboard/settings.js +1 -1
- package/dist/dashboard/sheet.js +3 -3
- package/dist/dashboard/top.js +2 -2
- package/dist/dashboard/turns.js +2 -2
- package/dist/dashboard/widgets.js +1 -1
- package/dist/dashboard/{world-calendar.js → world/calendar.js} +7 -7
- package/dist/dashboard/{lore.js → world/known.js} +1 -1
- package/dist/dashboard/{world-lore.js → world/lore.js} +9 -9
- package/dist/dashboard/{world-map.js → world/map.js} +1 -1
- package/dist/dashboard/{world.js → world/world.js} +14 -14
- package/dist/dice/evaluate.js +1 -1
- package/dist/dice/index.d.ts +2 -2
- package/dist/dice/index.js +2 -2
- package/dist/dice/notation.d.ts +2 -0
- package/dist/dice/notation.js +22 -4
- package/dist/documents/markup.js +2 -2
- package/dist/documents/read.js +29 -13
- package/dist/effects/effect.js +2 -5
- package/dist/extensions/extension.js +6 -8
- package/dist/extensions/index.d.ts +1 -4
- package/dist/extensions/index.js +1 -4
- package/dist/extensions/words.js +2 -1
- package/dist/{pictures → helpers}/briefs.js +17 -14
- package/dist/{pictures → helpers}/claude.js +8 -18
- package/dist/{pictures → helpers}/codex.js +3 -15
- package/dist/helpers/index.d.ts +7 -0
- package/dist/helpers/index.js +9 -0
- package/dist/{pictures/helpers.d.ts → helpers/programs.d.ts} +6 -1
- package/dist/{pictures/helpers.js → helpers/programs.js} +16 -2
- package/dist/images/images.js +7 -5
- package/dist/images/index.d.ts +1 -1
- package/dist/images/index.js +1 -1
- package/dist/importer/index.d.ts +1 -1
- package/dist/importer/index.js +1 -1
- package/dist/importer/work.d.ts +0 -2
- package/dist/importer/work.js +9 -30
- package/dist/instructions/index.d.ts +2 -0
- package/dist/instructions/index.js +10 -0
- package/dist/languages/index.d.ts +1 -1
- package/dist/languages/index.js +1 -1
- package/dist/languages/language-pack.js +15 -3
- package/dist/library/books.js +29 -83
- package/dist/{extensions → packages}/engine.d.ts +1 -1
- package/dist/{extensions → packages}/engine.js +1 -1
- package/dist/packages/index.d.ts +3 -0
- package/dist/packages/index.js +4 -0
- package/dist/{extensions/packages.d.ts → packages/npm.d.ts} +2 -0
- package/dist/{extensions/packages.js → packages/npm.js} +74 -45
- package/dist/page.d.ts +9 -11
- package/dist/page.js +1 -2
- package/dist/pages/check.js +31 -40
- package/dist/pages/containers.js +20 -20
- package/dist/pages/environment.js +15 -15
- package/dist/pages/index.d.ts +9 -9
- package/dist/pages/index.js +9 -9
- package/dist/pages/inheritance.d.ts +2 -1
- package/dist/pages/inheritance.js +24 -24
- package/dist/pages/load.js +7 -7
- package/dist/pages/maps.d.ts +20 -0
- package/dist/pages/maps.js +51 -1
- package/dist/pages/markdown.d.ts +2 -0
- package/dist/pages/markdown.js +110 -79
- package/dist/pages/page-file.d.ts +2 -1
- package/dist/pages/page-file.js +31 -29
- package/dist/pages/rename-page.d.ts +4 -1
- package/dist/pages/rename-page.js +7 -3
- package/dist/pages/{stack-entry.d.ts → stacks/entry.d.ts} +0 -2
- package/dist/pages/{stack-entry.js → stacks/entry.js} +2 -6
- package/dist/pages/{stacks.d.ts → stacks/kinds.d.ts} +8 -1
- package/dist/pages/{stacks.js → stacks/kinds.js} +36 -41
- package/dist/pages/{stack-writes.d.ts → stacks/writes.d.ts} +2 -2
- package/dist/pages/{stack-writes.js → stacks/writes.js} +32 -32
- package/dist/pages/system-pages.js +15 -15
- package/dist/pages/world.js +25 -19
- package/dist/pages/write-page.js +35 -34
- package/dist/player-notes/index.d.ts +1 -1
- package/dist/player-notes/index.js +1 -1
- package/dist/rules/page-search.js +3 -4
- package/dist/rules/rule-book.js +1 -1
- package/dist/rules/search.js +21 -21
- package/dist/rules/shown.js +1 -3
- package/dist/saves/saves.d.ts +2 -2
- package/dist/saves/saves.js +15 -3
- package/dist/{bell-listener.js → server/bell-listener.js} +3 -3
- package/dist/server/dashboard/files.d.ts +59 -0
- package/dist/server/dashboard/files.js +326 -0
- package/dist/server/dashboard/index.d.ts +114 -0
- package/dist/server/dashboard/index.js +419 -0
- package/dist/server/dashboard/news.d.ts +39 -0
- package/dist/server/dashboard/news.js +390 -0
- package/dist/server/dashboard/player.d.ts +48 -0
- package/dist/server/dashboard/player.js +242 -0
- package/dist/server/dashboard/ports.d.ts +10 -0
- package/dist/server/dashboard/ports.js +15 -0
- package/dist/server/dashboard/writes.d.ts +58 -0
- package/dist/server/dashboard/writes.js +492 -0
- package/dist/{mcp-server.d.ts → server/mcp.d.ts} +2 -2
- package/dist/{mcp-server.js → server/mcp.js} +57 -42
- package/dist/systems/game-system.d.ts +5 -3
- package/dist/systems/game-system.js +178 -149
- package/dist/systems/index.d.ts +1 -1
- package/dist/systems/index.js +1 -1
- package/dist/{testing.d.ts → testing/index.d.ts} +6 -6
- package/dist/{testing.js → testing/index.js} +32 -18
- package/dist/{system-checks.js → testing/system-checks.js} +18 -12
- package/dist/themes/theme.d.ts +3 -3
- package/dist/themes/theme.js +14 -14
- package/dist/time/calendar.js +5 -2
- package/dist/triggers/trigger.js +5 -8
- package/instructions/dashboard-guide.md +2 -1
- package/instructions/play.md +1 -1
- package/package.json +5 -5
- package/dist/commands/game-maps.d.ts +0 -20
- package/dist/commands/game-maps.js +0 -51
- package/dist/dashboard-server.d.ts +0 -47
- package/dist/dashboard-server.js +0 -1830
- package/dist/pictures/index.d.ts +0 -7
- package/dist/pictures/index.js +0 -9
- /package/dist/{cli.d.ts → cli/cli.d.ts} +0 -0
- /package/dist/{library-reader.d.ts → commands/shared/library-reader.d.ts} +0 -0
- /package/dist/commands/{notes.d.ts → shared/notes.d.ts} +0 -0
- /package/dist/commands/{notes.js → shared/notes.js} +0 -0
- /package/dist/dashboard/{guide-markdown.js → help/markdown.js} +0 -0
- /package/dist/dashboard/{pack-card.js → packages/card.js} +0 -0
- /package/dist/dashboard/{people.js → packages/people.js} +0 -0
- /package/dist/dashboard/{place-map.js → place/map.js} +0 -0
- /package/dist/dashboard/{calendar.js → world/days.js} +0 -0
- /package/dist/{pictures → helpers}/briefs.d.ts +0 -0
- /package/dist/{pictures → helpers}/chosen.d.ts +0 -0
- /package/dist/{pictures → helpers}/chosen.js +0 -0
- /package/dist/{pictures → helpers}/claude.d.ts +0 -0
- /package/dist/{pictures → helpers}/codex.d.ts +0 -0
- /package/dist/{pictures → helpers}/stop.d.ts +0 -0
- /package/dist/{pictures → helpers}/stop.js +0 -0
- /package/dist/{pictures → helpers}/svg.d.ts +0 -0
- /package/dist/{pictures → helpers}/svg.js +0 -0
- /package/dist/{extensions → packages}/tarball.d.ts +0 -0
- /package/dist/{extensions → packages}/tarball.js +0 -0
- /package/dist/{bell-listener.d.ts → server/bell-listener.d.ts} +0 -0
- /package/dist/{player-acts.d.ts → server/player-acts.d.ts} +0 -0
- /package/dist/{player-acts.js → server/player-acts.js} +0 -0
- /package/dist/{system-checks.d.ts → testing/system-checks.d.ts} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { EngineUpdater } from "../core/context.ts";
|
|
2
|
-
import { type NpmRun } from "./
|
|
2
|
+
import { type NpmRun } from "./npm.ts";
|
|
3
3
|
/** rpg-engine on npm, for the engine in this folder, from src/ and dist/ alike its package's own; `run` runs npm, a fake in tests. */
|
|
4
4
|
export declare function npmEngine(folder?: string, run?: (args: string) => Promise<NpmRun>): EngineUpdater;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { lstatSync, readFileSync, realpathSync } from "node:fs";
|
|
4
4
|
import { join } from "node:path";
|
|
5
5
|
import { fileURLToPath } from "node:url";
|
|
6
|
-
import { npmError, npmErrorCode, runNpm } from "./
|
|
6
|
+
import { npmError, npmErrorCode, runNpm } from "./npm.js";
|
|
7
7
|
const registry = "https://registry.npmjs.org";
|
|
8
8
|
/** rpg-engine on npm, for the engine in this folder, from src/ and dist/ alike its package's own; `run` runs npm, a fake in tests. */
|
|
9
9
|
export function npmEngine(folder = fileURLToPath(new URL("../../", import.meta.url)), run = runNpm) {
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
// npm for every package, game systems and rpg-engine itself included (D-436, D-452, D-515): installed, updated, a .tgz read. Depends on nothing else in rpg-engine.
|
|
2
|
+
export { npmEngine } from "./engine.js";
|
|
3
|
+
export { isLocalSpec, isPackageName, issuesPage, isVerified, npmPackages, verifiedScope } from "./npm.js";
|
|
4
|
+
export { isTarball } from "./tarball.js";
|
|
@@ -14,6 +14,8 @@ export interface NpmRun {
|
|
|
14
14
|
* from a folder by its link). Its registry is read directly; `run` runs npm, a fake in tests.
|
|
15
15
|
*/
|
|
16
16
|
export declare function npmPackages(folder: string, run?: (args: string) => Promise<NpmRun>): PackageManager;
|
|
17
|
+
/** Whether a text is an npm package's name alone, such as notes or @me/notes: never a path, nor a version. */
|
|
18
|
+
export declare function isPackageName(name: string): boolean;
|
|
17
19
|
/** Whether a package is given by its folder or its .tgz on this computer rather than by its name on npm (D-452): a .tgz by its file name alone too. */
|
|
18
20
|
export declare function isLocalSpec(spec: string): boolean;
|
|
19
21
|
/** Whether an installed package is ours, verified: in our scope and installed from npm, never from a folder, which anyone can name so (D-428, D-441). */
|
|
@@ -39,22 +39,24 @@ export function npmPackages(folder, run = runNpm) {
|
|
|
39
39
|
install: async (spec) => {
|
|
40
40
|
// A file or a folder is copied, so that the yes holds for the code it held then, whatever the folder holds later (D-452, D-478).
|
|
41
41
|
if (isLocalSpec(spec)) {
|
|
42
|
-
return await installCopy(folder, spec, described.get(resolve(spec)), run);
|
|
42
|
+
return await installCopy(folder, spec, described.get(resolve(spec)), inTurn(run));
|
|
43
43
|
}
|
|
44
|
+
// What npm is given is checked before anything moves.
|
|
45
|
+
const [prefix, checked] = [quotedFolder(folder), checkedSpec(spec)];
|
|
44
46
|
// What npm installed of the same version goes aside first, as it would keep it whatever it holds now: the files are npm's (D-510).
|
|
45
47
|
const named = spec.replace(/(?<=.)@[^@/]*$/, "");
|
|
46
48
|
const aside = join(folder, "aside", ...named.split("/"));
|
|
47
49
|
mkdirSync(join(aside, ".."), { recursive: true });
|
|
48
50
|
// Without the registry, from what npm keeps of it on this computer (D-452).
|
|
49
51
|
const install = async () => {
|
|
50
|
-
const ran = await run(`install --prefix ${
|
|
51
|
-
return ran.code !== 0 && isUnreachable(ran) ? await run(`install --prefix ${
|
|
52
|
+
const ran = await inTurn(run)(`install --prefix ${prefix} ${checked} ${installOptions}`);
|
|
53
|
+
return ran.code !== 0 && isUnreachable(ran) ? await inTurn(run)(`install --prefix ${prefix} ${checked} ${installOptions} --offline`) : ran;
|
|
52
54
|
};
|
|
53
55
|
const ran = await installedAside(join(folder, "node_modules", ...named.split("/")), aside, install);
|
|
54
56
|
return ran.code === 0 ? undefined : npmErrorCode(ran) === "ENOTCACHED" ? offlineAdvice(named) : `npm said: ${npmError(ran)}`;
|
|
55
57
|
},
|
|
56
58
|
uninstall: async (name) => {
|
|
57
|
-
const ran = await run(`uninstall --prefix ${quotedFolder(folder)} ${checkedSpec(name)} --ignore-scripts --no-audit --no-fund --json --loglevel=error`);
|
|
59
|
+
const ran = await inTurn(run)(`uninstall --prefix ${quotedFolder(folder)} ${checkedSpec(name)} --ignore-scripts --no-audit --no-fund --json --loglevel=error`);
|
|
58
60
|
if (ran.code !== 0) {
|
|
59
61
|
return `npm said: ${npmError(ran)}`;
|
|
60
62
|
}
|
|
@@ -84,6 +86,10 @@ export function npmPackages(folder, run = runNpm) {
|
|
|
84
86
|
},
|
|
85
87
|
};
|
|
86
88
|
}
|
|
89
|
+
/** Whether a text is an npm package's name alone, such as notes or @me/notes: never a path, nor a version. */
|
|
90
|
+
export function isPackageName(name) {
|
|
91
|
+
return packageName.test(name);
|
|
92
|
+
}
|
|
87
93
|
/** Whether a package is given by its folder or its .tgz on this computer rather than by its name on npm (D-452): a .tgz by its file name alone too. */
|
|
88
94
|
export function isLocalSpec(spec) {
|
|
89
95
|
return spec.startsWith(".") || isAbsolute(spec) || isTarball(spec);
|
|
@@ -107,6 +113,44 @@ export function issuesPage(manifest) {
|
|
|
107
113
|
}
|
|
108
114
|
// A repository on GitHub as package.json may write it: a git, https or ssh address, github:owner/name, or owner/name alone, which npm reads as GitHub's.
|
|
109
115
|
const githubRepository = /^(?:(?:git\+)?(?:https?|git|ssh):\/\/(?:[^@/]+@)?github\.com[/:]|git@github\.com:|github:)?([\w.-]+)\/([\w.-]+?)(?:\.git)?\/?(?:#.*)?$/i;
|
|
116
|
+
/** The code npm's JSON error gives, as ENOTCACHED; undefined when it wrote none. */
|
|
117
|
+
export function npmErrorCode(ran) {
|
|
118
|
+
try {
|
|
119
|
+
return JSON.parse(ran.out).error?.code;
|
|
120
|
+
}
|
|
121
|
+
catch {
|
|
122
|
+
return undefined;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
/** What npm said went wrong: its JSON error, with --json, else the last line it wrote that is not the pointer to its log. */
|
|
126
|
+
export function npmError(ran) {
|
|
127
|
+
try {
|
|
128
|
+
const read = JSON.parse(ran.out);
|
|
129
|
+
if (read.error?.summary !== undefined) {
|
|
130
|
+
return `${read.error.code === undefined ? "" : `${read.error.code}, `}${read.error.summary}`;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
catch {
|
|
134
|
+
// Not JSON: the lines it wrote say it.
|
|
135
|
+
}
|
|
136
|
+
const lines = ran.errors.split("\n").map((line) => line.trim()).filter((line) => line !== "" && !/complete log of this run/i.test(line));
|
|
137
|
+
return lines.at(-1) ?? "nothing";
|
|
138
|
+
}
|
|
139
|
+
/** Runs npm with these arguments, in a folder of no campaign, stopped with all it started after a while. */
|
|
140
|
+
export function runNpm(args) {
|
|
141
|
+
return new Promise((done) => {
|
|
142
|
+
const child = spawn(`npm ${args}`, { shell: true, windowsHide: true, cwd: tmpdir(), env: { ...process.env, NoDefaultCurrentDirectoryInExePath: "1" }, stdio: ["ignore", "pipe", "pipe"] });
|
|
143
|
+
let [out, errors] = ["", ""];
|
|
144
|
+
const timer = setTimeout(() => stopTree(child.pid), installWait);
|
|
145
|
+
child.stdout.setEncoding("utf8").on("data", (chunk) => (out += chunk));
|
|
146
|
+
child.stderr.setEncoding("utf8").on("data", (chunk) => (errors += chunk));
|
|
147
|
+
child.on("error", (error) => (errors += error.message));
|
|
148
|
+
child.on("close", (code) => {
|
|
149
|
+
clearTimeout(timer);
|
|
150
|
+
done({ code, out, errors });
|
|
151
|
+
});
|
|
152
|
+
});
|
|
153
|
+
}
|
|
110
154
|
/** A field of an object read from JSON, when it is a string. */
|
|
111
155
|
function fieldOf(value, field) {
|
|
112
156
|
const read = typeof value === "object" && value !== null ? value[field] : undefined;
|
|
@@ -155,15 +199,6 @@ const unreachableCodes = new Set(["ECONNREFUSED", "ENOTFOUND", "EAI_AGAIN", "ETI
|
|
|
155
199
|
function isUnreachable(ran) {
|
|
156
200
|
return unreachableCodes.has(npmErrorCode(ran) ?? "") || /FetchError|network|ECONNREFUSED|ENOTFOUND|EAI_AGAIN|ETIMEDOUT/i.test(npmError(ran));
|
|
157
201
|
}
|
|
158
|
-
/** The code npm's JSON error gives, as ENOTCACHED; undefined when it wrote none. */
|
|
159
|
-
export function npmErrorCode(ran) {
|
|
160
|
-
try {
|
|
161
|
-
return JSON.parse(ran.out).error?.code;
|
|
162
|
-
}
|
|
163
|
-
catch {
|
|
164
|
-
return undefined;
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
202
|
/** What npm's registry says of a package, at a version or its latest, with what its package.json says for rpg-engine; unreachable when it does not answer. */
|
|
168
203
|
async function registryPackage(spec) {
|
|
169
204
|
const checked = checkedSpec(spec);
|
|
@@ -295,10 +330,23 @@ async function installedAside(installed, aside, install) {
|
|
|
295
330
|
if (moved) {
|
|
296
331
|
renameSync(installed, aside);
|
|
297
332
|
}
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
333
|
+
// What npm installed comes back when the new one fails, or when npm could not even be run.
|
|
334
|
+
const putBack = () => {
|
|
335
|
+
if (moved) {
|
|
336
|
+
rmSync(installed, { recursive: true, force: true });
|
|
337
|
+
renameSync(aside, installed);
|
|
338
|
+
}
|
|
339
|
+
};
|
|
340
|
+
let ran;
|
|
341
|
+
try {
|
|
342
|
+
ran = await install();
|
|
343
|
+
}
|
|
344
|
+
catch (error) {
|
|
345
|
+
putBack();
|
|
346
|
+
throw error;
|
|
347
|
+
}
|
|
348
|
+
if (ran.code !== 0) {
|
|
349
|
+
putBack();
|
|
302
350
|
}
|
|
303
351
|
rmSync(aside, { recursive: true, force: true });
|
|
304
352
|
return ran;
|
|
@@ -346,34 +394,15 @@ function quotedFolder(folder) {
|
|
|
346
394
|
}
|
|
347
395
|
return `"${path}"`;
|
|
348
396
|
}
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
// Not JSON: the lines it wrote say it.
|
|
359
|
-
}
|
|
360
|
-
const lines = ran.errors.split("\n").map((line) => line.trim()).filter((line) => line !== "" && !/complete log of this run/i.test(line));
|
|
361
|
-
return lines.at(-1) ?? "nothing";
|
|
362
|
-
}
|
|
363
|
-
/** Runs npm with these arguments, in a folder of no campaign, stopped with all it started after a while. */
|
|
364
|
-
export function runNpm(args) {
|
|
365
|
-
return new Promise((done) => {
|
|
366
|
-
const child = spawn(`npm ${args}`, { shell: true, windowsHide: true, cwd: tmpdir(), env: { ...process.env, NoDefaultCurrentDirectoryInExePath: "1" }, stdio: ["ignore", "pipe", "pipe"] });
|
|
367
|
-
let [out, errors] = ["", ""];
|
|
368
|
-
const timer = setTimeout(() => stopTree(child.pid), installWait);
|
|
369
|
-
child.stdout.setEncoding("utf8").on("data", (chunk) => (out += chunk));
|
|
370
|
-
child.stderr.setEncoding("utf8").on("data", (chunk) => (errors += chunk));
|
|
371
|
-
child.on("error", (error) => (errors += error.message));
|
|
372
|
-
child.on("close", (code) => {
|
|
373
|
-
clearTimeout(timer);
|
|
374
|
-
done({ code, out, errors });
|
|
375
|
-
});
|
|
376
|
-
});
|
|
397
|
+
// The installs and uninstalls of this process, one at a time: two npm runs at once in one folder keep only one of them in its package.json.
|
|
398
|
+
let npmTurn = Promise.resolve();
|
|
399
|
+
/** An npm run that waits for the one before it to end. */
|
|
400
|
+
function inTurn(run) {
|
|
401
|
+
return (args) => {
|
|
402
|
+
const next = npmTurn.then(() => run(args));
|
|
403
|
+
npmTurn = next.catch(() => undefined);
|
|
404
|
+
return next;
|
|
405
|
+
};
|
|
377
406
|
}
|
|
378
407
|
/** Stops a process with the ones it started: on Windows the shell's child, npm, outlives a kill of the shell alone. */
|
|
379
408
|
function stopTree(pid) {
|
package/dist/page.d.ts
CHANGED
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
import type { ComponentChildren, ComponentType, JSX } from "preact";
|
|
2
|
-
import type { DieTone, Track, WidgetText, WidgetValue } from "./core/package-api.ts";
|
|
3
|
-
export type
|
|
4
|
-
/** The room a figure takes on a wide screen, as its extension.yaml or system.yaml declares it; on a phone it shrinks to the width there is, keeping its shape. */
|
|
5
|
-
export interface FigureSize {
|
|
6
|
-
width: number;
|
|
7
|
-
height: number;
|
|
8
|
-
mirror?: boolean;
|
|
9
|
-
}
|
|
2
|
+
import type { CardPage, DieTone, FigureSize, Track, WidgetText, WidgetValue } from "./core/package-api.ts";
|
|
3
|
+
export { type CardPage, cardPages, type DieTone, type FigureSize, type Track, type WidgetText, type WidgetValue } from "./core/package-api.ts";
|
|
10
4
|
/** Where a figure is drawn: a chip in the top, a card beside the rolls, a card in a page, a roll's card, or the panel on someone of the party (D-516). */
|
|
11
5
|
export type FigurePlace = "top" | "side" | "page" | "ask" | "person";
|
|
12
6
|
/** The part a figure draws in place of the dashboard's own, its words translated: what the dashboard says of it to a screen reader. */
|
|
@@ -46,9 +40,6 @@ export interface FigureProps extends PageProps {
|
|
|
46
40
|
place: FigurePlace;
|
|
47
41
|
size: FigureSize;
|
|
48
42
|
}
|
|
49
|
-
/** The pages of the dashboard a package's card or widget stands in, after their own cards (D-502, D-511): the Scene, the sheet, the World and the Journal. */
|
|
50
|
-
export declare const cardPages: readonly ["scene", "sheet", "world", "journal"];
|
|
51
|
-
export type CardPage = (typeof cardPages)[number];
|
|
52
43
|
/** A card a package puts in a page of the dashboard (D-511): its title and icon (a path on a grid of 24) in the dashboard's frame, its order, its inside. */
|
|
53
44
|
export interface PageCard {
|
|
54
45
|
page: CardPage;
|
|
@@ -215,6 +206,13 @@ export declare function Text(props: {
|
|
|
215
206
|
export declare function Value(props: {
|
|
216
207
|
value: WidgetValue;
|
|
217
208
|
}): JSX.Element;
|
|
209
|
+
/** The pictures of the dashboard's states, paths on a grid of 24: the skull of the dead, one fallen, one kept from acting, a condition with no picture of its own. */
|
|
210
|
+
export declare const statusIcons: {
|
|
211
|
+
dead: string;
|
|
212
|
+
fallen: string;
|
|
213
|
+
inactive: string;
|
|
214
|
+
condition: string;
|
|
215
|
+
};
|
|
218
216
|
/** The buttons of a question in a card of a roll: a roll in gold with its dice, a choice that loses something with a red edge; the one pressed marked. */
|
|
219
217
|
export declare function Choices(props: {
|
|
220
218
|
buttons: CardButton[];
|
package/dist/page.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export const cardPages = ["scene", "sheet", "world", "journal"];
|
|
1
|
+
export { cardPages } from "./core/package-api.js";
|
package/dist/pages/check.js
CHANGED
|
@@ -4,12 +4,12 @@ import { readEnvironment } from "./environment.js";
|
|
|
4
4
|
import { baseChain, baseFieldOf, baseProblem, derivedPages, shownPart } from "./inheritance.js";
|
|
5
5
|
import { links, readSection, repeatedNames, unreadSecretLines } from "./markdown.js";
|
|
6
6
|
import { readStops } from "./roads.js";
|
|
7
|
-
import { countedText, entryOfKind, readEntry } from "./
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
7
|
+
import { countedText, entryOfKind, readEntry } from "./stacks/entry.js";
|
|
8
|
+
import { carriesKind, entryPage, goodsNamed, isKind, notKindReason, pageNamedQuietly, stacksOf } from "./stacks/kinds.js";
|
|
9
|
+
import { missingKindMessage } from "./stacks/writes.js";
|
|
10
10
|
import { canHold, containerFieldOf, containerFields, heldTypesText, isEmptyField, isStandardField, misspelledStandardField, standardFieldProblem } from "./standard-fields.js";
|
|
11
11
|
import { alwaysInList, alwaysInMessage, declaredKind, systemKnowsReason, systemLabel } from "./system-pages.js";
|
|
12
|
-
import { isCountedItem, linksIn, locate,
|
|
12
|
+
import { isCountedItem, linksIn, locate, systemFirstFix, systemPageNamed, textsIn, validHoldersOf } from "./world.js";
|
|
13
13
|
/**
|
|
14
14
|
* The exact checks on the world's pages (D-58, first level): files that cannot be read, repeated names, standard fields, links, containers, environments.
|
|
15
15
|
* A world never changes: its problems are found once, and a session of the MCP server keeps the world while its files do not change (D-194).
|
|
@@ -23,6 +23,32 @@ export function checkWorld(world) {
|
|
|
23
23
|
return problems;
|
|
24
24
|
}
|
|
25
25
|
const checked = new WeakMap();
|
|
26
|
+
/**
|
|
27
|
+
* A number without a maximum named as goods in the plural, as torches: 7 or crossbow-bolts: 20: what a stack counts, written as a field nothing spends (STK-13); `names` are
|
|
28
|
+
* the fields to look at, all of them when left out. A name in the singular, as lock: 15, is some other number.
|
|
29
|
+
*/
|
|
30
|
+
export function goodsFieldProblems(world, page, names) {
|
|
31
|
+
const field = containerFieldOf(page.type);
|
|
32
|
+
if (field === undefined) {
|
|
33
|
+
return [];
|
|
34
|
+
}
|
|
35
|
+
return Object.entries(page.fields).filter(([name]) => names === undefined || names.some((wanted) => comparableText(wanted) === comparableText(name))).flatMap(([name, value]) => {
|
|
36
|
+
const count = typeof value === "number" ? value : typeof value === "string" && /^\s*\d+\s*$/.test(value) ? Number(value) : undefined;
|
|
37
|
+
if (count === undefined || !Number.isSafeInteger(count) || !/s$/i.test(name) || isStandardField(page.type, name) || declaredKind(world, name) !== undefined) {
|
|
38
|
+
return [];
|
|
39
|
+
}
|
|
40
|
+
const kind = goodsNamed(world, name);
|
|
41
|
+
return kind === undefined ? [] : [{
|
|
42
|
+
path: page.path,
|
|
43
|
+
message: `${page.name} counts ${name}: ${count} as a number, which no command spends: goods are a stack of ${kind.name} in ${field}.`,
|
|
44
|
+
fix: `write ${page.name}, unset ${name}, add ${field}="[[${kind.name}]] ${count}"`,
|
|
45
|
+
}];
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
/** What a character has equipped and does not hold (CON-12), as write says it after a change of its inventory or of what it has equipped. */
|
|
49
|
+
export function equippedNotes(world, character) {
|
|
50
|
+
return equippedProblems(world, groupBy(world.pages, (page) => [page.name]), character).map((problem) => `${problem.message} Fix: ${problem.fix}.`);
|
|
51
|
+
}
|
|
26
52
|
function worldProblems(world) {
|
|
27
53
|
// Built once, so that the checks cost as much as reading the pages, however many there are.
|
|
28
54
|
const pagesByName = groupBy(world.pages, (page) => [page.name]);
|
|
@@ -164,7 +190,6 @@ function publicKnowsProblems(world, pagesByName, page) {
|
|
|
164
190
|
function written(link) {
|
|
165
191
|
return link.section === undefined ? `[[${link.page}]]` : `[[${link.page}#${link.section}]]`;
|
|
166
192
|
}
|
|
167
|
-
/** How to fix a broken link: remove the list entry as it is written, set the field again, or correct the text. */
|
|
168
193
|
/**
|
|
169
194
|
* How to fix a link in a field to a page that does not exist: what the world lacks gets its page, as a spell the system does not have (D-216); a wrong link goes. A
|
|
170
195
|
* campaign played in another language than its system's is told the system's.
|
|
@@ -179,6 +204,7 @@ function missingFix(world, page, target, field, entry, inList) {
|
|
|
179
204
|
: "";
|
|
180
205
|
return `create ${target} with write if it belongs to this world, or ${linkFix(page, field, entry, inList)}${inList ? " if the link is wrong" : ""}${language}`;
|
|
181
206
|
}
|
|
207
|
+
/** How to fix a broken link: remove the list entry as it is written, set the field again, or correct the text. */
|
|
182
208
|
function linkFix(page, field, entry, inList) {
|
|
183
209
|
if (field === undefined) {
|
|
184
210
|
return `correct the link in the text of ${page.name}, or create what it points to`;
|
|
@@ -313,41 +339,6 @@ function stackProblems(world, holder) {
|
|
|
313
339
|
...goodsFieldProblems(world, holder),
|
|
314
340
|
];
|
|
315
341
|
}
|
|
316
|
-
/**
|
|
317
|
-
* A number without a maximum named as goods in the plural, as torches: 7 or crossbow-bolts: 20: what a stack counts, written as a field nothing spends (STK-13); `names` are
|
|
318
|
-
* the fields to look at, all of them when left out. A name in the singular, as lock: 15, is some other number.
|
|
319
|
-
*/
|
|
320
|
-
export function goodsFieldProblems(world, page, names) {
|
|
321
|
-
const field = containerFieldOf(page.type);
|
|
322
|
-
if (field === undefined) {
|
|
323
|
-
return [];
|
|
324
|
-
}
|
|
325
|
-
return Object.entries(page.fields).filter(([name]) => names === undefined || names.some((wanted) => comparableText(wanted) === comparableText(name))).flatMap(([name, value]) => {
|
|
326
|
-
const count = typeof value === "number" ? value : typeof value === "string" && /^\s*\d+\s*$/.test(value) ? Number(value) : undefined;
|
|
327
|
-
if (count === undefined || !Number.isSafeInteger(count) || !/s$/i.test(name) || isStandardField(page.type, name) || declaredKind(world, name) !== undefined) {
|
|
328
|
-
return [];
|
|
329
|
-
}
|
|
330
|
-
const kind = goodsNamed(world, name);
|
|
331
|
-
return kind === undefined ? [] : [{
|
|
332
|
-
path: page.path,
|
|
333
|
-
message: `${page.name} counts ${name}: ${count} as a number, which no command spends: goods are a stack of ${kind.name} in ${field}.`,
|
|
334
|
-
fix: `write ${page.name}, unset ${name}, add ${field}="[[${kind.name}]] ${count}"`,
|
|
335
|
-
}];
|
|
336
|
-
});
|
|
337
|
-
}
|
|
338
|
-
/** The page with a name or alias, or none, without stopping at a name two pages share. */
|
|
339
|
-
function pageNamedQuietly(world, name) {
|
|
340
|
-
try {
|
|
341
|
-
return pageNamed(world, name);
|
|
342
|
-
}
|
|
343
|
-
catch {
|
|
344
|
-
return undefined;
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
/** What a character has equipped and does not hold (CON-12), as write says it after a change of its inventory or of what it has equipped. */
|
|
348
|
-
export function equippedNotes(world, character) {
|
|
349
|
-
return equippedProblems(world, groupBy(world.pages, (page) => [page.name]), character).map((problem) => `${problem.message} Fix: ${problem.fix}.`);
|
|
350
|
-
}
|
|
351
342
|
/** A road's stop that is a page but not a place of the campaign (ROA-4, ROA-7): its stretches lead nowhere. A stop that does not exist is a broken link, said above. */
|
|
352
343
|
function stopProblems(world, pagesByName, road) {
|
|
353
344
|
const read = road.type === "place" ? readStops(road.fields.stops) : undefined;
|
package/dist/pages/containers.js
CHANGED
|
@@ -4,8 +4,8 @@ import { files } from "../core/store.js";
|
|
|
4
4
|
import { comparableText, withArticle } from "../core/text.js";
|
|
5
5
|
import { links } from "./markdown.js";
|
|
6
6
|
import { changeFields, joinPageFile, readFields, splitPageFile } from "./page-file.js";
|
|
7
|
-
import { countOf, doubledKinds, entryOfKind, stackEntry, withStackCount } from "./
|
|
8
|
-
import { notKindReason } from "./stacks.js";
|
|
7
|
+
import { countOf, doubledKinds, entryOfKind, stackEntry, withStackCount } from "./stacks/entry.js";
|
|
8
|
+
import { notKindReason } from "./stacks/kinds.js";
|
|
9
9
|
import { canHold, containerFieldOf, isEmptyField } from "./standard-fields.js";
|
|
10
10
|
import { heldSystemPageMessage, systemLabel } from "./system-pages.js";
|
|
11
11
|
import { linksIn, locate, readPage, withPage } from "./world.js";
|
|
@@ -120,6 +120,24 @@ export class MoveStopped extends Error {
|
|
|
120
120
|
this.written = written;
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
|
+
/** Why a container cannot hold a page (CON-1), with the way out: where the page goes instead. */
|
|
124
|
+
export function holdRefusal(holder, held) {
|
|
125
|
+
if (held.type === "creature") {
|
|
126
|
+
return `${held.name} is a creature, a kind: its copies enter a scene with scene, creatures; one in particular is a character with creature [[${held.name}]].`;
|
|
127
|
+
}
|
|
128
|
+
if (held.type !== "place" && held.type !== "character" && held.type !== "item") {
|
|
129
|
+
return `${held.name} is ${withArticle(held.type ?? "free page")}, which is nowhere: only places, characters and items are inside something.`;
|
|
130
|
+
}
|
|
131
|
+
if (containerFieldOf(holder.type) === undefined) {
|
|
132
|
+
const where = held.type === "item" ? "a place, a character or an item" : held.type === "character" ? "a place or an item" : "a place";
|
|
133
|
+
return `${holder.name} is ${withArticle(holder.type ?? "free page")}, which holds nothing: ${held.name} goes into ${where}.`;
|
|
134
|
+
}
|
|
135
|
+
if (held.type === "place") {
|
|
136
|
+
const inside = holder.type === "item" ? ` For a world inside a thing, such as a lamp's, write a place with a link to ${holder.name}.` : "";
|
|
137
|
+
return `${holder.name} is ${withArticle(holder.type ?? "free page")}: a place goes only into a place.${inside}`;
|
|
138
|
+
}
|
|
139
|
+
return `${holder.name} is a character, who carries only items: to be with them, ${held.name} goes where ${holder.name} is.`;
|
|
140
|
+
}
|
|
123
141
|
/** A frontmatter with stacks set in a container's list, each written once in the place of its first entry (STK-3). */
|
|
124
142
|
function withStacks(frontmatter, field, stacks, path) {
|
|
125
143
|
const value = readFields(frontmatter, path)[field];
|
|
@@ -144,24 +162,6 @@ function finishingCalls(edits) {
|
|
|
144
162
|
...Object.entries(edit.set ?? {}).map(([field, value]) => `change ${edit.holder.name}, ${field}, to "${value}"`),
|
|
145
163
|
]);
|
|
146
164
|
}
|
|
147
|
-
/** Why a container cannot hold a page (CON-1), with the way out: where the page goes instead. */
|
|
148
|
-
export function holdRefusal(holder, held) {
|
|
149
|
-
if (held.type === "creature") {
|
|
150
|
-
return `${held.name} is a creature, a kind: its copies enter a scene with scene, creatures; one in particular is a character with creature [[${held.name}]].`;
|
|
151
|
-
}
|
|
152
|
-
if (held.type !== "place" && held.type !== "character" && held.type !== "item") {
|
|
153
|
-
return `${held.name} is ${withArticle(held.type ?? "free page")}, which is nowhere: only places, characters and items are inside something.`;
|
|
154
|
-
}
|
|
155
|
-
if (containerFieldOf(holder.type) === undefined) {
|
|
156
|
-
const where = held.type === "item" ? "a place, a character or an item" : held.type === "character" ? "a place or an item" : "a place";
|
|
157
|
-
return `${holder.name} is ${withArticle(holder.type ?? "free page")}, which holds nothing: ${held.name} goes into ${where}.`;
|
|
158
|
-
}
|
|
159
|
-
if (held.type === "place") {
|
|
160
|
-
const inside = holder.type === "item" ? ` For a world inside a thing, such as a lamp's, write a place with a link to ${holder.name}.` : "";
|
|
161
|
-
return `${holder.name} is ${withArticle(holder.type ?? "free page")}: a place goes only into a place.${inside}`;
|
|
162
|
-
}
|
|
163
|
-
return `${holder.name} is a character, who carries only items: to be with them, ${held.name} goes where ${holder.name} is.`;
|
|
164
|
-
}
|
|
165
165
|
/** A page goes only into a container that can hold it (CON-1), never into itself or into what it holds (CON-3); the pages of the game system go nowhere (SYS-6). */
|
|
166
166
|
function checkMove(world, page, destination) {
|
|
167
167
|
if (page.system !== undefined) {
|
|
@@ -14,21 +14,6 @@ export function environmentAt(world, page) {
|
|
|
14
14
|
}
|
|
15
15
|
return found;
|
|
16
16
|
}
|
|
17
|
-
/**
|
|
18
|
-
* The entries a place's environment holds, read line by line, so that nothing else falls with a line that does not read (ENV-1): such a line is left out,
|
|
19
|
-
* one without a value counts as missing (INH-6), and of a name written twice the last line with a value holds (INH-5). validate reports them.
|
|
20
|
-
*/
|
|
21
|
-
function readableEntries(value) {
|
|
22
|
-
const items = Array.isArray(value) ? value : isEmptyField(value) ? [] : [value];
|
|
23
|
-
let entries = [];
|
|
24
|
-
for (const item of items) {
|
|
25
|
-
const read = readItem(item);
|
|
26
|
-
if ("entry" in read) {
|
|
27
|
-
entries = [...entries.filter((entry) => !sameName(entry.name, read.entry.name)), read.entry];
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
return entries;
|
|
31
|
-
}
|
|
32
17
|
/** The places whose environment holds at a page, nearest first: the page itself when it is a place, then the places of its chain (ENV-2). */
|
|
33
18
|
export function placesAround(world, page) {
|
|
34
19
|
return [page, ...locate(world, page).chain].filter((holder) => holder.type === "place");
|
|
@@ -86,6 +71,21 @@ export function changedEnvironment(current, add, remove, place) {
|
|
|
86
71
|
}
|
|
87
72
|
return entries.map(formatEnvironmentEntry);
|
|
88
73
|
}
|
|
74
|
+
/**
|
|
75
|
+
* The entries a place's environment holds, read line by line, so that nothing else falls with a line that does not read (ENV-1): such a line is left out,
|
|
76
|
+
* one without a value counts as missing (INH-6), and of a name written twice the last line with a value holds (INH-5). validate reports them.
|
|
77
|
+
*/
|
|
78
|
+
function readableEntries(value) {
|
|
79
|
+
const items = Array.isArray(value) ? value : isEmptyField(value) ? [] : [value];
|
|
80
|
+
let entries = [];
|
|
81
|
+
for (const item of items) {
|
|
82
|
+
const read = readItem(item);
|
|
83
|
+
if ("entry" in read) {
|
|
84
|
+
entries = [...entries.filter((entry) => !sameName(entry.name, read.entry.name)), read.entry];
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return entries;
|
|
88
|
+
}
|
|
89
89
|
/** The entry an item of the field writes: a line, or the map of one key that YAML makes of a line without quotes. */
|
|
90
90
|
function readItem(item) {
|
|
91
91
|
const line = asLine(item);
|
package/dist/pages/index.d.ts
CHANGED
|
@@ -3,16 +3,16 @@ export { applyMove, type MovePlan, MoveStopped, planLeave, planMove, type StackC
|
|
|
3
3
|
export { changedEnvironment, environmentAt, type EnvironmentEntry, formatEnvironmentEntry, placesAround, readEnvironment } from "./environment.ts";
|
|
4
4
|
export { baseChain, baseFieldOf, baseValue, derivedPages, followersOf, holdsField, type Inherited, inheritedByBase, inheritedFields, introductionFollowersOf, isNeverInherited, keepersOf, newBaseProblem, ownField, ownFieldChange, removedFieldName, sameAsBase, sectionFollowersOf, shownPart, uniquePage, writtenFieldName, } from "./inheritance.ts";
|
|
5
5
|
export { carriedWeight, type LoadRule, weightUnit } from "./load.ts";
|
|
6
|
-
export { type MapField,
|
|
7
|
-
export { everyGoalTicked, firstTable, goalsIn, introductionText, type Link, links, partContent, readSection, secretNames, sectionTitles, type TextMode, textParts,
|
|
6
|
+
export { type MapField, mapKey, mapOf, mapProblems, type PlaceMap, readMapField, sameFrame } from "./maps.ts";
|
|
7
|
+
export { everyGoalTicked, firstTable, goalsIn, introductionText, type Link, links, partContent, readSection, secretNames, sectionTitles, type TextMode, textParts, withLinksAsWords, withoutComments, withoutFencedBlocks, } from "./markdown.ts";
|
|
8
8
|
export { changedFields, type FieldChange, formatFields, linkListItems, readFields, readFieldValue, splitPageFile } from "./page-file.ts";
|
|
9
9
|
export { type PageType, pageTypeNames, worldFolderName } from "./page-types.ts";
|
|
10
|
-
export { formatPosition, type Position,
|
|
10
|
+
export { formatPosition, type Position, readPosition } from "./positions.ts";
|
|
11
11
|
export { applyRename, planRename, type Renamed, renamedLinks, type RenamePlan } from "./rename-page.ts";
|
|
12
|
-
export { readStops, type Stops
|
|
13
|
-
export { countedText, entryOfKind, type EntryReading,
|
|
14
|
-
export {
|
|
15
|
-
export { canHold, containerFieldOf,
|
|
16
|
-
export { alwaysInList,
|
|
17
|
-
export { type Backlink, backlinks, bonusPages, concernsPlayer, createWorld, findPage,
|
|
12
|
+
export { readStops, type Stops } from "./roads.ts";
|
|
13
|
+
export { countedText, entryOfKind, type EntryReading, readEntry, withStackCount } from "./stacks/entry.ts";
|
|
14
|
+
export { carriesKind, carriesNamed, entryKind, entryPage, goodsNamed, type HeldStack, heldStacks, heldStacksOfKind, isKind, kindNamed, ownStack, pageNamedQuietly, type Stack, stackName, stacksOf } from "./stacks/kinds.ts";
|
|
15
|
+
export { canHold, containerFieldOf, isCoreField, isCounterField, isEmptyField, isStandardField, listFieldNames, misspelledFieldProblem, misspelledStandardField, newPageFields, standardValues } from "./standard-fields.ts";
|
|
16
|
+
export { alwaysInList, declaredKind, hidingMessage, isDeclaredUncounted, kindMessage, readOnlyMessage, systemKnowsReason, systemLabel } from "./system-pages.ts";
|
|
17
|
+
export { type Backlink, backlinks, bonusPages, concernsPlayer, createWorld, findPage, isCountedItem, isInParty, isPartyMember, isPlayerCharacter, linksIn, loadWorld, locate, namesakes, type Page, pageFileNamed, type PageMatch, pageNamed, pagesWithName, pagesWithNameOrAlias, pageWithPath, parsePageReference, playerCharacters, searchPages, searchSystemPages, systemFirstFix, type SystemInfo, systemPageNamed, type SystemPages, textsIn, validHoldersOf, withPage, type World, } from "./world.ts";
|
|
18
18
|
export { checkFieldChange, type PageChange, writePage } from "./write-page.ts";
|
package/dist/pages/index.js
CHANGED
|
@@ -4,16 +4,16 @@ export { applyMove, MoveStopped, planLeave, planMove } from "./containers.js";
|
|
|
4
4
|
export { changedEnvironment, environmentAt, formatEnvironmentEntry, placesAround, readEnvironment } from "./environment.js";
|
|
5
5
|
export { baseChain, baseFieldOf, baseValue, derivedPages, followersOf, holdsField, inheritedByBase, inheritedFields, introductionFollowersOf, isNeverInherited, keepersOf, newBaseProblem, ownField, ownFieldChange, removedFieldName, sameAsBase, sectionFollowersOf, shownPart, uniquePage, writtenFieldName, } from "./inheritance.js";
|
|
6
6
|
export { carriedWeight, weightUnit } from "./load.js";
|
|
7
|
-
export {
|
|
8
|
-
export { everyGoalTicked, firstTable, goalsIn, introductionText, links, partContent, readSection, secretNames, sectionTitles, textParts,
|
|
7
|
+
export { mapKey, mapOf, mapProblems, readMapField, sameFrame } from "./maps.js";
|
|
8
|
+
export { everyGoalTicked, firstTable, goalsIn, introductionText, links, partContent, readSection, secretNames, sectionTitles, textParts, withLinksAsWords, withoutComments, withoutFencedBlocks, } from "./markdown.js";
|
|
9
9
|
export { changedFields, formatFields, linkListItems, readFields, readFieldValue, splitPageFile } from "./page-file.js";
|
|
10
10
|
export { pageTypeNames, worldFolderName } from "./page-types.js";
|
|
11
|
-
export { formatPosition,
|
|
11
|
+
export { formatPosition, readPosition } from "./positions.js";
|
|
12
12
|
export { applyRename, planRename, renamedLinks } from "./rename-page.js";
|
|
13
|
-
export { readStops
|
|
14
|
-
export { countedText, entryOfKind,
|
|
15
|
-
export {
|
|
16
|
-
export { canHold, containerFieldOf,
|
|
17
|
-
export { alwaysInList,
|
|
18
|
-
export { backlinks, bonusPages, concernsPlayer, createWorld, findPage,
|
|
13
|
+
export { readStops } from "./roads.js";
|
|
14
|
+
export { countedText, entryOfKind, readEntry, withStackCount } from "./stacks/entry.js";
|
|
15
|
+
export { carriesKind, carriesNamed, entryKind, entryPage, goodsNamed, heldStacks, heldStacksOfKind, isKind, kindNamed, ownStack, pageNamedQuietly, stackName, stacksOf } from "./stacks/kinds.js";
|
|
16
|
+
export { canHold, containerFieldOf, isCoreField, isCounterField, isEmptyField, isStandardField, listFieldNames, misspelledFieldProblem, misspelledStandardField, newPageFields, standardValues } from "./standard-fields.js";
|
|
17
|
+
export { alwaysInList, declaredKind, hidingMessage, isDeclaredUncounted, kindMessage, readOnlyMessage, systemKnowsReason, systemLabel } from "./system-pages.js";
|
|
18
|
+
export { backlinks, bonusPages, concernsPlayer, createWorld, findPage, isCountedItem, isInParty, isPartyMember, isPlayerCharacter, linksIn, loadWorld, locate, namesakes, pageFileNamed, pageNamed, pagesWithName, pagesWithNameOrAlias, pageWithPath, parsePageReference, playerCharacters, searchPages, searchSystemPages, systemFirstFix, systemPageNamed, textsIn, validHoldersOf, withPage, } from "./world.js";
|
|
19
19
|
export { checkFieldChange, writePage } from "./write-page.js";
|
|
@@ -2,7 +2,7 @@ import type { FieldChange } from "./page-file.ts";
|
|
|
2
2
|
import type { PageType } from "./page-types.ts";
|
|
3
3
|
import { type Page, type World } from "./world.ts";
|
|
4
4
|
/** A field and its value as a page writes it. */
|
|
5
|
-
|
|
5
|
+
interface FieldValue {
|
|
6
6
|
name: string;
|
|
7
7
|
value: unknown;
|
|
8
8
|
}
|
|
@@ -78,3 +78,4 @@ export declare function newBaseProblem(world: World, page: {
|
|
|
78
78
|
name: string;
|
|
79
79
|
type?: PageType;
|
|
80
80
|
}, link: string): string | undefined;
|
|
81
|
+
export {};
|
|
@@ -48,30 +48,6 @@ export function inheritedByBase(world, page) {
|
|
|
48
48
|
return Object.keys(own).length > 0 || parts.length > 0 || introduction !== "" ? [{ base, fields: own, introduction, parts }] : [];
|
|
49
49
|
});
|
|
50
50
|
}
|
|
51
|
-
/**
|
|
52
|
-
* Whether the part at `index` is a heading with no text of its own whose subsections are none of them `kept`, as when the page writes them all itself: it has nothing
|
|
53
|
-
* left to show (INH-13, D-169), such as the Actions of a creature whose one action the page rewrote.
|
|
54
|
-
*/
|
|
55
|
-
function emptyHeading(parts, index, kept) {
|
|
56
|
-
const level = headingLevel(parts[index].text);
|
|
57
|
-
if (level === undefined || parts[index].text.split("\n").slice(1).some((line) => line.trim() !== "")) {
|
|
58
|
-
return false;
|
|
59
|
-
}
|
|
60
|
-
for (const next of parts.slice(index + 1)) {
|
|
61
|
-
// A secret has no level: it belongs to the section it is in.
|
|
62
|
-
if ((headingLevel(next.text) ?? Number.POSITIVE_INFINITY) <= level) {
|
|
63
|
-
break;
|
|
64
|
-
}
|
|
65
|
-
if (kept.has(next)) {
|
|
66
|
-
return false;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
return true;
|
|
70
|
-
}
|
|
71
|
-
/** The level of the heading a part starts with, 2 for "## Actions"; undefined for a secret. */
|
|
72
|
-
function headingLevel(text) {
|
|
73
|
-
return /^(#{1,6})[ \t]/.exec(text)?.[1].length;
|
|
74
|
-
}
|
|
75
51
|
/** Whether a page writes a field with the very value it would read from its bases, and in no other case: that is no difference, and the page does not keep it (INH-9, D-125). */
|
|
76
52
|
export function sameAsBase(world, page, field) {
|
|
77
53
|
const base = baseValue(world, page, field);
|
|
@@ -235,6 +211,30 @@ export function newBaseProblem(world, page, link) {
|
|
|
235
211
|
const back = names.findIndex((linked) => comparableText(linked) === comparableText(page.name));
|
|
236
212
|
return back === -1 ? undefined : `${page.name} cannot derive from ${target.name}: the chain would come back to it (${[page.name, ...names.slice(0, back), page.name].join(" › ")}).`;
|
|
237
213
|
}
|
|
214
|
+
/**
|
|
215
|
+
* Whether the part at `index` is a heading with no text of its own whose subsections are none of them `kept`, as when the page writes them all itself: it has nothing
|
|
216
|
+
* left to show (INH-13, D-169), such as the Actions of a creature whose one action the page rewrote.
|
|
217
|
+
*/
|
|
218
|
+
function emptyHeading(parts, index, kept) {
|
|
219
|
+
const level = headingLevel(parts[index].text);
|
|
220
|
+
if (level === undefined || parts[index].text.split("\n").slice(1).some((line) => line.trim() !== "")) {
|
|
221
|
+
return false;
|
|
222
|
+
}
|
|
223
|
+
for (const next of parts.slice(index + 1)) {
|
|
224
|
+
// A secret has no level: it belongs to the section it is in.
|
|
225
|
+
if ((headingLevel(next.text) ?? Number.POSITIVE_INFINITY) <= level) {
|
|
226
|
+
break;
|
|
227
|
+
}
|
|
228
|
+
if (kept.has(next)) {
|
|
229
|
+
return false;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
return true;
|
|
233
|
+
}
|
|
234
|
+
/** The level of the heading a part starts with, 2 for "## Actions"; undefined for a secret. */
|
|
235
|
+
function headingLevel(text) {
|
|
236
|
+
return /^(#{1,6})[ \t]/.exec(text)?.[1].length;
|
|
237
|
+
}
|
|
238
238
|
/** The pages deriving from a page for which nothing nearer holds what `holds` looks for: neither they nor a base between them and the page. */
|
|
239
239
|
function followers(world, page, holds) {
|
|
240
240
|
return derivedPages(world, page).filter((derived) => {
|