@narrative-os/cli 0.1.2 ā 0.1.4
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/commands/init.js +49 -11
- package/package.json +2 -2
package/dist/commands/init.js
CHANGED
|
@@ -3,22 +3,60 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.initCommand = initCommand;
|
|
4
4
|
const engine_1 = require("@narrative-os/engine");
|
|
5
5
|
const store_js_1 = require("../config/store.js");
|
|
6
|
+
const prompts_1 = require("@inquirer/prompts");
|
|
6
7
|
async function initCommand(options) {
|
|
7
|
-
console.log('Creating new story...\n');
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const
|
|
14
|
-
|
|
8
|
+
console.log('š Creating new story...\n');
|
|
9
|
+
// Prompt for required fields if not provided via CLI
|
|
10
|
+
const title = options.title || await (0, prompts_1.input)({
|
|
11
|
+
message: 'Story title:',
|
|
12
|
+
validate: (value) => value.trim().length > 0 || 'Title is required'
|
|
13
|
+
});
|
|
14
|
+
const genre = options.genre || await (0, prompts_1.select)({
|
|
15
|
+
message: 'Genre:',
|
|
16
|
+
choices: [
|
|
17
|
+
{ name: 'Science Fiction', value: 'Science Fiction' },
|
|
18
|
+
{ name: 'Fantasy', value: 'Fantasy' },
|
|
19
|
+
{ name: 'Mystery', value: 'Mystery' },
|
|
20
|
+
{ name: 'Thriller', value: 'Thriller' },
|
|
21
|
+
{ name: 'Romance', value: 'Romance' },
|
|
22
|
+
{ name: 'Historical Fiction', value: 'Historical Fiction' },
|
|
23
|
+
{ name: 'Horror', value: 'Horror' },
|
|
24
|
+
{ name: 'Literary Fiction', value: 'Literary Fiction' },
|
|
25
|
+
{ name: 'Other', value: 'Other' }
|
|
26
|
+
]
|
|
27
|
+
});
|
|
28
|
+
const theme = options.theme || await (0, prompts_1.input)({
|
|
29
|
+
message: 'Theme (e.g., Redemption, Love, Betrayal):',
|
|
30
|
+
default: 'Redemption'
|
|
31
|
+
});
|
|
32
|
+
const setting = options.setting || await (0, prompts_1.input)({
|
|
33
|
+
message: 'Setting (time/place):',
|
|
34
|
+
default: 'Modern day'
|
|
35
|
+
});
|
|
36
|
+
const tone = options.tone || await (0, prompts_1.input)({
|
|
37
|
+
message: 'Tone (e.g., Dark, Lighthearted, Suspenseful):',
|
|
38
|
+
default: 'Dramatic'
|
|
39
|
+
});
|
|
40
|
+
const premise = options.premise || await (0, prompts_1.input)({
|
|
41
|
+
message: 'Brief premise/synopsis:',
|
|
42
|
+
validate: (value) => value.trim().length > 10 || 'Please provide a more detailed premise (at least 10 characters)'
|
|
43
|
+
});
|
|
44
|
+
const targetChapters = options.chapters
|
|
45
|
+
? parseInt(options.chapters)
|
|
46
|
+
: await (0, prompts_1.number)({
|
|
47
|
+
message: 'Target number of chapters:',
|
|
48
|
+
default: 5,
|
|
49
|
+
min: 1,
|
|
50
|
+
max: 50
|
|
51
|
+
}) || 5;
|
|
15
52
|
let bible = (0, engine_1.createStoryBible)(title, theme, genre, setting, tone, premise, targetChapters);
|
|
16
|
-
|
|
17
|
-
bible = (0, engine_1.addCharacter)(bible, '
|
|
53
|
+
// Add a placeholder protagonist (user can add more characters later)
|
|
54
|
+
bible = (0, engine_1.addCharacter)(bible, 'Protagonist', 'protagonist', ['brave', 'determined'], ['achieve their goal']);
|
|
18
55
|
const state = (0, engine_1.createStoryState)(bible.id, targetChapters);
|
|
19
56
|
(0, store_js_1.saveStory)(bible, state, []);
|
|
20
|
-
console.log(`\nā
Story created: ${title}`);
|
|
57
|
+
console.log(`\nā
Story created: "${title}"`);
|
|
21
58
|
console.log(` ID: ${bible.id}`);
|
|
59
|
+
console.log(` Genre: ${genre}`);
|
|
22
60
|
console.log(` Target chapters: ${targetChapters}`);
|
|
23
61
|
console.log(`\nš” Next steps:`);
|
|
24
62
|
console.log(` ⢠Generate Chapter 1: nos generate ${bible.id}`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@narrative-os/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "AI-native narrative engine for long-form story generation",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@inquirer/prompts": "^8.3.0",
|
|
42
|
-
"@narrative-os/engine": "0.1.
|
|
42
|
+
"@narrative-os/engine": "0.1.2",
|
|
43
43
|
"commander": "^12.0.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|