@sharpee/devkit 1.0.2 → 1.0.3
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sharpee/devkit",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "The Sharpee CLI engine — build/test/verify/scaffold orchestration (ADR-180). Provides the `sharpee` command; orchestrates, tsf compiles.",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"types": "./index.d.ts",
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* {{STORY_TITLE}}
|
|
3
|
+
*
|
|
4
|
+
* A Sharpee Interactive Fiction story
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import {
|
|
8
|
+
Story,
|
|
9
|
+
StoryConfig,
|
|
10
|
+
WorldModel,
|
|
11
|
+
IFEntity,
|
|
12
|
+
Parser,
|
|
13
|
+
EnglishLanguageProvider,
|
|
14
|
+
} from '@sharpee/sharpee';
|
|
15
|
+
|
|
16
|
+
export const config: StoryConfig = {
|
|
17
|
+
id: '{{STORY_ID}}',
|
|
18
|
+
title: '{{STORY_TITLE}}',
|
|
19
|
+
author: '{{AUTHOR}}',
|
|
20
|
+
version: '1.0.0',
|
|
21
|
+
description: '{{DESCRIPTION}}',
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export const story: Story = {
|
|
25
|
+
config,
|
|
26
|
+
|
|
27
|
+
createPlayer(world: WorldModel): IFEntity {
|
|
28
|
+
const player = world.createEntity('player', 'actor');
|
|
29
|
+
player.attributes.name = 'you';
|
|
30
|
+
player.attributes.description = 'An adventurer.';
|
|
31
|
+
return player;
|
|
32
|
+
},
|
|
33
|
+
|
|
34
|
+
initializeWorld(world: WorldModel): void {
|
|
35
|
+
// Get the player entity
|
|
36
|
+
const player = world.getPlayer()!;
|
|
37
|
+
|
|
38
|
+
// === CREATE YOUR ROOMS ===
|
|
39
|
+
|
|
40
|
+
// Starting room
|
|
41
|
+
const startRoom = world.createEntity('start-room', 'room');
|
|
42
|
+
startRoom.attributes.name = 'Starting Room';
|
|
43
|
+
startRoom.attributes.description =
|
|
44
|
+
'You are in a small, dimly lit room. This is where your adventure begins.';
|
|
45
|
+
|
|
46
|
+
// === CREATE YOUR OBJECTS ===
|
|
47
|
+
|
|
48
|
+
// Example: a simple object
|
|
49
|
+
// const key = world.createEntity('key', 'object');
|
|
50
|
+
// key.attributes.name = 'brass key';
|
|
51
|
+
// key.attributes.description = 'A small brass key.';
|
|
52
|
+
// world.moveEntity(key.id, startRoom.id);
|
|
53
|
+
|
|
54
|
+
// === CONNECT YOUR ROOMS ===
|
|
55
|
+
|
|
56
|
+
// Example: connect rooms
|
|
57
|
+
// world.connectRooms(startRoom.id, 'north', anotherRoom.id);
|
|
58
|
+
|
|
59
|
+
// Place player in starting room
|
|
60
|
+
world.moveEntity(player.id, startRoom.id);
|
|
61
|
+
},
|
|
62
|
+
|
|
63
|
+
// Optional: extend the parser with story-specific vocabulary
|
|
64
|
+
extendParser(parser: Parser): void {
|
|
65
|
+
// const grammar = parser.getStoryGrammar();
|
|
66
|
+
// grammar.define('custom command').mapsTo('story.action.custom').build();
|
|
67
|
+
},
|
|
68
|
+
|
|
69
|
+
// Optional: extend the language with story-specific messages
|
|
70
|
+
extendLanguage(language: EnglishLanguageProvider): void {
|
|
71
|
+
// language.addMessages({
|
|
72
|
+
// 'story.message.custom': 'A custom message.',
|
|
73
|
+
// });
|
|
74
|
+
},
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
export default story;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "{{STORY_ID}}",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "{{DESCRIPTION}}",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"build": "tsc",
|
|
9
|
+
"build:browser": "sharpee build-browser",
|
|
10
|
+
"introspect": "sharpee introspect",
|
|
11
|
+
"dev": "tsc --watch"
|
|
12
|
+
},
|
|
13
|
+
"dependencies": {
|
|
14
|
+
"@sharpee/sharpee": "{{SHARPEE_VERSION}}"
|
|
15
|
+
},
|
|
16
|
+
"devDependencies": {
|
|
17
|
+
"@sharpee/devkit": "{{DEVKIT_VERSION}}",
|
|
18
|
+
"typescript": "^5.0.0"
|
|
19
|
+
},
|
|
20
|
+
"keywords": [
|
|
21
|
+
"interactive-fiction",
|
|
22
|
+
"sharpee",
|
|
23
|
+
"text-adventure"
|
|
24
|
+
],
|
|
25
|
+
"author": "{{AUTHOR}}",
|
|
26
|
+
"license": "MIT"
|
|
27
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"module": "NodeNext",
|
|
5
|
+
"moduleResolution": "NodeNext",
|
|
6
|
+
"outDir": "dist",
|
|
7
|
+
"rootDir": "src",
|
|
8
|
+
"strict": true,
|
|
9
|
+
"esModuleInterop": true,
|
|
10
|
+
"declaration": true,
|
|
11
|
+
"skipLibCheck": true
|
|
12
|
+
},
|
|
13
|
+
"include": ["src/**/*"]
|
|
14
|
+
}
|