Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslnode 18–226 runs
build_error
glibcnode 18–226 runs
build_error
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
BardLegends
✓ import BardLegends from 'bard-legends-framework'
✗ import { BardLegends } from 'bard-legends-framework'
Default export for the main framework class.
ActionPlugin
✓ import { ActionPlugin } from 'bard-legends-framework/plugins'
✗ import ActionPlugin from 'bard-legends-framework'
Named export from the plugins submodule since v1.3.0.
NarrativeEngine
✓ import { NarrativeEngine } from 'bard-legends-framework'
✗ import NarrativeEngine from 'bard-legends-framework/narrative'
Named export from the main package (deprecated submodule path in v1.4.0).
Initializes a Bard Legends game instance, registers a custom action plugin that greets the player, and starts the narrative engine.
import BardLegends from 'bard-legends-framework';
import { ActionPlugin } from 'bard-legends-framework/plugins';
const game = new BardLegends({
apiKey: process.env.LEGENDS_API_KEY ?? ''
});
// Define a custom action plugin
class GreetPlugin extends ActionPlugin {
constructor() {
super('greet');
}
execute(context) {
console.log(`Hello, ${context.player.name}!`);
return context;
}
}
game.registerPlugin(new GreetPlugin());
game.start();
Errors
Common errors & fixes
Error: Cannot find module 'bard-legends-framework/narrative'
The NarrativeEngine module path was removed in v1.4.0.
fixChange import to: import { NarrativeEngine } from 'bard-legends-framework'; TypeError: game.plugins.add is not a function
The .plugins.add method was removed in v1.3.0 in favor of .registerPlugin().
fixUse game.registerPlugin(plugin) instead of game.plugins.add(plugin).
SyntaxError: Unexpected token 'export'
The package is ESM-only; using require() or an older Node version (< 16) causes this.
fixUse import syntax and ensure Node.js >= 16.
Audit
Dependencies
actions-librequiredCore dependency for defining and handling game actions and events.
helpers-librequiredProvides utility functions for state management, data processing, and common game mechanics.
script-engine-librequiredScript engine for executing custom narrative logic and branching conditions.