seshat-scribe 0.0.3 → 0.1.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/README.md +20 -2
- package/dist/commands/generate.d.ts.map +1 -1
- package/dist/commands/generate.js +15 -4
- package/dist/commands/generate.js.map +1 -1
- package/dist/commands/init.d.ts +5 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +236 -9
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/setup-workflow.d.ts +2 -0
- package/dist/commands/setup-workflow.d.ts.map +1 -0
- package/dist/commands/setup-workflow.js +37 -0
- package/dist/commands/setup-workflow.js.map +1 -0
- package/dist/config.d.ts +138 -3
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +106 -2
- package/dist/config.js.map +1 -1
- package/dist/core/analyzer.d.ts.map +1 -1
- package/dist/core/analyzer.js +29 -15
- package/dist/core/analyzer.js.map +1 -1
- package/dist/core/planner.d.ts +2 -2
- package/dist/core/writer.d.ts +1 -1
- package/dist/core/writer.d.ts.map +1 -1
- package/dist/core/writer.js +32 -43
- package/dist/core/writer.js.map +1 -1
- package/dist/index.js +13 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/frontmatter.d.ts +28 -0
- package/dist/lib/frontmatter.d.ts.map +1 -0
- package/dist/lib/frontmatter.js +116 -0
- package/dist/lib/frontmatter.js.map +1 -0
- package/package.json +2 -1
- package/templates/workflow.yml +10 -7
package/README.md
CHANGED
|
@@ -35,7 +35,11 @@ cd your-blog-project
|
|
|
35
35
|
seshat init
|
|
36
36
|
```
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
**New!** Seshat now features an **interactive setup wizard** that guides you through configuration:
|
|
39
|
+
- **Quick Setup**: Get started in seconds with recommended defaults
|
|
40
|
+
- **Custom Setup**: Full control over every option
|
|
41
|
+
|
|
42
|
+
See [SETUP_WIZARD.md](./SETUP_WIZARD.md) for details.
|
|
39
43
|
|
|
40
44
|
### 2. Configure Your Blog
|
|
41
45
|
|
|
@@ -80,6 +84,10 @@ seshat write --dry-run
|
|
|
80
84
|
|
|
81
85
|
## 🔧 Configuration Options
|
|
82
86
|
|
|
87
|
+
Seshat is highly configurable to match your blog's structure and needs.
|
|
88
|
+
|
|
89
|
+
### Quick Configuration
|
|
90
|
+
|
|
83
91
|
| Option | Type | Description |
|
|
84
92
|
|--------|------|-------------|
|
|
85
93
|
| `contentDir` | string | Directory containing your blog MDX files |
|
|
@@ -87,7 +95,17 @@ seshat write --dry-run
|
|
|
87
95
|
| `publicAssetPath` | string | Public URL path for images in frontmatter |
|
|
88
96
|
| `topic` | string | Global topic constraint for content generation |
|
|
89
97
|
| `tone` | string | Writing tone (e.g., "Professional yet witty") |
|
|
90
|
-
| `framework` | "remix" \| "next" \| "astro" | Blog framework
|
|
98
|
+
| `framework` | "remix" \| "next" \| "astro" | Blog framework preset (optional) |
|
|
99
|
+
|
|
100
|
+
### Advanced Configuration
|
|
101
|
+
|
|
102
|
+
Seshat supports extensive customization:
|
|
103
|
+
|
|
104
|
+
- **File Structure**: Custom file extensions, naming templates, nested directories
|
|
105
|
+
- **Frontmatter**: Custom field names, date formats, additional metadata
|
|
106
|
+
- **Content Generation**: Word count targets, code examples, SEO optimization, custom instructions
|
|
107
|
+
|
|
108
|
+
**📖 See [CONFIG.md](./CONFIG.md) for complete documentation and examples**
|
|
91
109
|
|
|
92
110
|
## 🤖 GitHub Actions Automation
|
|
93
111
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../src/commands/generate.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../src/commands/generate.ts"],"names":[],"mappings":"AAaA,MAAM,WAAW,eAAe;IAC9B,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED;;GAEG;AACH,wBAAsB,QAAQ,CAAC,OAAO,GAAE,eAAoB,GAAG,OAAO,CAAC,IAAI,CAAC,CAmJ3E"}
|
|
@@ -7,6 +7,7 @@ import { writeBlogPost } from '../core/writer.js';
|
|
|
7
7
|
import { generateImage } from '../core/artist.js';
|
|
8
8
|
import { gold, cyan, error, info, scrollWritten } from '../lib/output.js';
|
|
9
9
|
import { resetUsage, formatUsageSummary } from '../lib/usage.js';
|
|
10
|
+
import { buildFileName, buildNestedPath } from '../lib/frontmatter.js';
|
|
10
11
|
/**
|
|
11
12
|
* Main command: Generate a new blog post with image
|
|
12
13
|
*/
|
|
@@ -64,9 +65,10 @@ export async function generate(options = {}) {
|
|
|
64
65
|
text: cyan('Seshat is writing...'),
|
|
65
66
|
color: 'cyan',
|
|
66
67
|
}).start();
|
|
68
|
+
const postDate = new Date();
|
|
67
69
|
let mdxContent;
|
|
68
70
|
try {
|
|
69
|
-
mdxContent = await writeBlogPost(config, plan);
|
|
71
|
+
mdxContent = await writeBlogPost(config, plan, postDate);
|
|
70
72
|
writeSpinner.succeed('Content written');
|
|
71
73
|
}
|
|
72
74
|
catch (err) {
|
|
@@ -96,8 +98,13 @@ export async function generate(options = {}) {
|
|
|
96
98
|
color: 'cyan',
|
|
97
99
|
}).start();
|
|
98
100
|
try {
|
|
101
|
+
// Build file name from template
|
|
102
|
+
const fileExtension = config.fileExtension || 'mdx';
|
|
103
|
+
const imageExtension = config.imageFormat === 'jpg' ? 'jpg' : (config.imageFormat === 'svg' ? 'svg' : 'png');
|
|
104
|
+
const fileNameTemplate = config.fileNameTemplate || '{{slug}}';
|
|
105
|
+
const fileName = buildFileName(fileNameTemplate, plan.slug, postDate, fileExtension);
|
|
99
106
|
// Replace the placeholder image path with the actual path
|
|
100
|
-
const publicImagePath = `${config.publicAssetPath}/${plan.slug}
|
|
107
|
+
const publicImagePath = `${config.publicAssetPath}/${plan.slug}.${imageExtension}`;
|
|
101
108
|
mdxContent = mdxContent.replace(/PLACEHOLDER_IMAGE/g, publicImagePath);
|
|
102
109
|
if (options.dryRun) {
|
|
103
110
|
saveSpinner.info('Dry run: skipping file write');
|
|
@@ -107,11 +114,15 @@ export async function generate(options = {}) {
|
|
|
107
114
|
console.log('');
|
|
108
115
|
}
|
|
109
116
|
else {
|
|
117
|
+
// Determine content directory (with optional nested structure)
|
|
118
|
+
let contentPath = path.resolve(process.cwd(), config.contentDir);
|
|
119
|
+
if (config.nestedDirectories) {
|
|
120
|
+
contentPath = buildNestedPath(postDate, contentPath);
|
|
121
|
+
}
|
|
110
122
|
// Ensure content directory exists
|
|
111
|
-
const contentPath = path.resolve(process.cwd(), config.contentDir);
|
|
112
123
|
await fs.mkdir(contentPath, { recursive: true });
|
|
113
124
|
// Write the MDX file
|
|
114
|
-
const mdxFilePath = path.join(contentPath,
|
|
125
|
+
const mdxFilePath = path.join(contentPath, fileName);
|
|
115
126
|
await fs.writeFile(mdxFilePath, mdxContent, 'utf-8');
|
|
116
127
|
const relativeMdxPath = path.relative(process.cwd(), mdxFilePath);
|
|
117
128
|
saveSpinner.succeed(`Saved: ${relativeMdxPath}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate.js","sourceRoot":"","sources":["../../src/commands/generate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,aAAa,CAAC;AAC7B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,GAAG,MAAM,KAAK,CAAC;AAGtB,OAAO,EAAE,cAAc,EAA0B,MAAM,qBAAqB,CAAC;AAC7E,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAC1E,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"generate.js","sourceRoot":"","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AAC,CAAC;QAC5D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,gBAAgB;IAChB,MAAM,UAAU,GAAG,kBAAkB,EAAE,CAAC;IACxC,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC1B,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAChB,KAAK,MAAM,IAAI,IAAI,UAAU,EAAE,CAAC;YAC9B,IAAI,CAAC,IAAI,CAAC,CAAC;QACb,CAAC;IACH,CAAC;IAED,WAAW;IACX,aAAa,EAAE,CAAC;AAClB,CAAC"}
|
package/dist/commands/init.d.ts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
|
+
interface InitOptions {
|
|
2
|
+
interactive?: boolean;
|
|
3
|
+
}
|
|
1
4
|
/**
|
|
2
5
|
* Initialize Seshat configuration in the current directory
|
|
3
6
|
*/
|
|
4
|
-
export declare function init(): Promise<void>;
|
|
7
|
+
export declare function init(options?: InitOptions): Promise<void>;
|
|
8
|
+
export {};
|
|
5
9
|
//# sourceMappingURL=init.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAMA,UAAU,WAAW;IACnB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED;;GAEG;AACH,wBAAsB,IAAI,CAAC,OAAO,GAAE,WAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAyRnE"}
|
package/dist/commands/init.js
CHANGED
|
@@ -1,28 +1,255 @@
|
|
|
1
1
|
import fs from 'fs/promises';
|
|
2
2
|
import path from 'path';
|
|
3
|
+
import { input, select, confirm } from '@inquirer/prompts';
|
|
3
4
|
import { DEFAULT_CONFIG } from '../config.js';
|
|
4
|
-
import { success, info } from '../lib/output.js';
|
|
5
|
+
import { success, info, gold, cyan } from '../lib/output.js';
|
|
5
6
|
/**
|
|
6
7
|
* Initialize Seshat configuration in the current directory
|
|
7
8
|
*/
|
|
8
|
-
export async function init() {
|
|
9
|
+
export async function init(options = {}) {
|
|
9
10
|
const configPath = path.join(process.cwd(), 'seshat.config.json');
|
|
10
11
|
try {
|
|
11
12
|
await fs.access(configPath);
|
|
12
13
|
info('Configuration file already exists at seshat.config.json');
|
|
13
|
-
|
|
14
|
+
const overwrite = await confirm({
|
|
15
|
+
message: 'Do you want to overwrite it?',
|
|
16
|
+
default: false,
|
|
17
|
+
});
|
|
18
|
+
if (!overwrite) {
|
|
19
|
+
info('Keeping existing configuration.');
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
14
22
|
}
|
|
15
23
|
catch {
|
|
16
|
-
// File doesn't exist,
|
|
24
|
+
// File doesn't exist, continue with setup
|
|
17
25
|
}
|
|
18
|
-
|
|
26
|
+
console.log('');
|
|
27
|
+
console.log(gold.bold('✦ Seshat Configuration Wizard'));
|
|
28
|
+
console.log(cyan('Let\'s set up your blog configuration...'));
|
|
29
|
+
console.log('');
|
|
30
|
+
// Offer quick setup option
|
|
31
|
+
const setupMode = await select({
|
|
32
|
+
message: 'How would you like to set up Seshat?',
|
|
33
|
+
choices: [
|
|
34
|
+
{
|
|
35
|
+
name: 'Quick Setup (recommended defaults)',
|
|
36
|
+
value: 'quick',
|
|
37
|
+
description: 'Basic setup with sensible defaults',
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
name: 'Custom Setup (guided configuration)',
|
|
41
|
+
value: 'custom',
|
|
42
|
+
description: 'Step-by-step configuration with all options',
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
default: 'quick',
|
|
46
|
+
});
|
|
47
|
+
const config = {};
|
|
48
|
+
if (setupMode === 'quick') {
|
|
49
|
+
// Quick setup - just ask essential questions
|
|
50
|
+
console.log('');
|
|
51
|
+
console.log(cyan('📦 Quick Setup'));
|
|
52
|
+
console.log('');
|
|
53
|
+
const framework = await select({
|
|
54
|
+
message: 'Which framework are you using?',
|
|
55
|
+
choices: [
|
|
56
|
+
{ name: 'Remix', value: 'remix' },
|
|
57
|
+
{ name: 'Next.js', value: 'next' },
|
|
58
|
+
{ name: 'Astro', value: 'astro' },
|
|
59
|
+
],
|
|
60
|
+
default: 'remix',
|
|
61
|
+
});
|
|
62
|
+
config.framework = framework;
|
|
63
|
+
config.contentDir = await input({
|
|
64
|
+
message: 'Blog posts directory:',
|
|
65
|
+
default: DEFAULT_CONFIG.contentDir,
|
|
66
|
+
});
|
|
67
|
+
config.topic = await input({
|
|
68
|
+
message: 'Blog topic:',
|
|
69
|
+
default: DEFAULT_CONFIG.topic,
|
|
70
|
+
});
|
|
71
|
+
// Use defaults for everything else
|
|
72
|
+
config.assetsDir = DEFAULT_CONFIG.assetsDir;
|
|
73
|
+
config.publicAssetPath = DEFAULT_CONFIG.publicAssetPath;
|
|
74
|
+
config.tone = DEFAULT_CONFIG.tone;
|
|
75
|
+
console.log('');
|
|
76
|
+
info('✓ Using recommended defaults for remaining settings');
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
// Custom setup - full wizard
|
|
80
|
+
// Start with framework selection
|
|
81
|
+
const useFrameworkPreset = await confirm({
|
|
82
|
+
message: 'Do you want to use a framework preset?',
|
|
83
|
+
default: true,
|
|
84
|
+
});
|
|
85
|
+
if (useFrameworkPreset) {
|
|
86
|
+
const framework = await select({
|
|
87
|
+
message: 'Which framework are you using?',
|
|
88
|
+
choices: [
|
|
89
|
+
{
|
|
90
|
+
name: 'Remix (date, image, tag)',
|
|
91
|
+
value: 'remix',
|
|
92
|
+
description: 'For Remix applications',
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
name: 'Next.js (date, coverImage, tag)',
|
|
96
|
+
value: 'next',
|
|
97
|
+
description: 'For Next.js applications',
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
name: 'Astro (pubDate, heroImage, tag)',
|
|
101
|
+
value: 'astro',
|
|
102
|
+
description: 'For Astro sites',
|
|
103
|
+
},
|
|
104
|
+
],
|
|
105
|
+
default: 'remix',
|
|
106
|
+
});
|
|
107
|
+
config.framework = framework;
|
|
108
|
+
}
|
|
109
|
+
// Project directories
|
|
110
|
+
console.log('');
|
|
111
|
+
console.log(cyan('📁 Project Structure'));
|
|
112
|
+
config.contentDir = await input({
|
|
113
|
+
message: 'Where do you store your blog posts?',
|
|
114
|
+
default: DEFAULT_CONFIG.contentDir,
|
|
115
|
+
});
|
|
116
|
+
config.assetsDir = await input({
|
|
117
|
+
message: 'Where should generated images be saved?',
|
|
118
|
+
default: DEFAULT_CONFIG.assetsDir,
|
|
119
|
+
});
|
|
120
|
+
config.publicAssetPath = await input({
|
|
121
|
+
message: 'What is the public URL path for images?',
|
|
122
|
+
default: DEFAULT_CONFIG.publicAssetPath,
|
|
123
|
+
});
|
|
124
|
+
// Content settings
|
|
125
|
+
console.log('');
|
|
126
|
+
console.log(cyan('✍️ Content Settings'));
|
|
127
|
+
config.topic = await input({
|
|
128
|
+
message: 'What is your blog\'s main topic?',
|
|
129
|
+
default: DEFAULT_CONFIG.topic,
|
|
130
|
+
});
|
|
131
|
+
config.tone = await input({
|
|
132
|
+
message: 'What writing tone should Seshat use?',
|
|
133
|
+
default: DEFAULT_CONFIG.tone,
|
|
134
|
+
});
|
|
135
|
+
// Advanced options
|
|
136
|
+
console.log('');
|
|
137
|
+
const configureAdvanced = await confirm({
|
|
138
|
+
message: 'Configure advanced options? (file naming, generation settings)',
|
|
139
|
+
default: false,
|
|
140
|
+
});
|
|
141
|
+
if (configureAdvanced) {
|
|
142
|
+
console.log('');
|
|
143
|
+
console.log(cyan('⚙️ Advanced Options'));
|
|
144
|
+
// File extension
|
|
145
|
+
const fileExtension = await select({
|
|
146
|
+
message: 'File extension for blog posts:',
|
|
147
|
+
choices: [
|
|
148
|
+
{ name: '.mdx (MDX - Markdown with JSX)', value: 'mdx' },
|
|
149
|
+
{ name: '.md (Standard Markdown)', value: 'md' },
|
|
150
|
+
],
|
|
151
|
+
default: 'mdx',
|
|
152
|
+
});
|
|
153
|
+
config.fileExtension = fileExtension;
|
|
154
|
+
// File naming
|
|
155
|
+
const fileNamePattern = await select({
|
|
156
|
+
message: 'File naming pattern:',
|
|
157
|
+
choices: [
|
|
158
|
+
{ name: 'my-post-title.mdx', value: '{{slug}}' },
|
|
159
|
+
{ name: '2024-01-15-my-post-title.mdx', value: '{{date}}-{{slug}}' },
|
|
160
|
+
{ name: '2024-01-my-post-title.mdx', value: '{{year}}-{{month}}-{{slug}}' },
|
|
161
|
+
],
|
|
162
|
+
default: '{{slug}}',
|
|
163
|
+
});
|
|
164
|
+
config.fileNameTemplate = fileNamePattern;
|
|
165
|
+
// Nested directories
|
|
166
|
+
config.nestedDirectories = await confirm({
|
|
167
|
+
message: 'Organize posts in date-based folders? (e.g., 2024/01/)',
|
|
168
|
+
default: false,
|
|
169
|
+
});
|
|
170
|
+
// Generation options
|
|
171
|
+
const configureGeneration = await confirm({
|
|
172
|
+
message: 'Configure content generation options?',
|
|
173
|
+
default: false,
|
|
174
|
+
});
|
|
175
|
+
if (configureGeneration) {
|
|
176
|
+
config.generation = {};
|
|
177
|
+
const setWordCount = await confirm({
|
|
178
|
+
message: 'Set a target word count?',
|
|
179
|
+
default: false,
|
|
180
|
+
});
|
|
181
|
+
if (setWordCount) {
|
|
182
|
+
const wordCount = await input({
|
|
183
|
+
message: 'Target word count:',
|
|
184
|
+
default: '1500',
|
|
185
|
+
validate: (value) => {
|
|
186
|
+
const num = parseInt(value, 10);
|
|
187
|
+
if (isNaN(num) || num < 100) {
|
|
188
|
+
return 'Please enter a valid number (at least 100)';
|
|
189
|
+
}
|
|
190
|
+
return true;
|
|
191
|
+
},
|
|
192
|
+
});
|
|
193
|
+
config.generation.targetWordCount = parseInt(wordCount, 10);
|
|
194
|
+
}
|
|
195
|
+
config.generation.includeCodeExamples = await confirm({
|
|
196
|
+
message: 'Emphasize code examples in posts?',
|
|
197
|
+
default: false,
|
|
198
|
+
});
|
|
199
|
+
config.generation.seoOptimized = await confirm({
|
|
200
|
+
message: 'Generate SEO-optimized content?',
|
|
201
|
+
default: false,
|
|
202
|
+
});
|
|
203
|
+
const addCustomInstructions = await confirm({
|
|
204
|
+
message: 'Add custom writing instructions?',
|
|
205
|
+
default: false,
|
|
206
|
+
});
|
|
207
|
+
if (addCustomInstructions) {
|
|
208
|
+
config.generation.customInstructions = await input({
|
|
209
|
+
message: 'Custom instructions:',
|
|
210
|
+
default: '',
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
// Build final config with defaults
|
|
217
|
+
const finalConfig = {
|
|
218
|
+
contentDir: config.contentDir,
|
|
219
|
+
assetsDir: config.assetsDir,
|
|
220
|
+
publicAssetPath: config.publicAssetPath,
|
|
221
|
+
topic: config.topic,
|
|
222
|
+
tone: config.tone,
|
|
223
|
+
...(config.framework && { framework: config.framework }),
|
|
224
|
+
...(config.fileExtension && { fileExtension: config.fileExtension }),
|
|
225
|
+
...(config.imageFormat && { imageFormat: config.imageFormat }),
|
|
226
|
+
...(config.fileNameTemplate && { fileNameTemplate: config.fileNameTemplate }),
|
|
227
|
+
...(config.nestedDirectories !== undefined && { nestedDirectories: config.nestedDirectories }),
|
|
228
|
+
...(config.generation && Object.keys(config.generation).length > 0 && { generation: config.generation }),
|
|
229
|
+
};
|
|
230
|
+
// Save configuration
|
|
231
|
+
const configContent = JSON.stringify(finalConfig, null, 2);
|
|
19
232
|
await fs.writeFile(configPath, configContent, 'utf-8');
|
|
20
|
-
success('Created seshat.config.json');
|
|
21
|
-
info('Edit this file to configure Seshat for your blog');
|
|
22
233
|
console.log('');
|
|
23
|
-
|
|
234
|
+
success('✓ Created seshat.config.json');
|
|
235
|
+
console.log('');
|
|
236
|
+
// Show summary
|
|
237
|
+
console.log(gold('📋 Configuration Summary:'));
|
|
238
|
+
console.log(` Content directory: ${finalConfig.contentDir}`);
|
|
239
|
+
console.log(` Assets directory: ${finalConfig.assetsDir}`);
|
|
240
|
+
console.log(` Topic: ${finalConfig.topic}`);
|
|
241
|
+
console.log(` Tone: ${finalConfig.tone}`);
|
|
242
|
+
if (finalConfig.framework) {
|
|
243
|
+
console.log(` Framework: ${finalConfig.framework}`);
|
|
244
|
+
}
|
|
245
|
+
console.log('');
|
|
246
|
+
console.log(gold('🚀 Next steps:'));
|
|
24
247
|
console.log(' 1. Set your GEMINI_API_KEY environment variable');
|
|
25
|
-
console.log('
|
|
248
|
+
console.log(' export GEMINI_API_KEY="your_key_here"');
|
|
249
|
+
console.log(' 2. Generate your first post: seshat write');
|
|
250
|
+
console.log(' 3. (Optional) Set up GitHub Actions: seshat setup-workflow');
|
|
251
|
+
console.log('');
|
|
252
|
+
console.log(cyan('💡 Tip: Run "seshat init" again anytime to reconfigure'));
|
|
26
253
|
console.log('');
|
|
27
254
|
}
|
|
28
255
|
//# sourceMappingURL=init.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,aAAa,CAAC;AAC7B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,aAAa,CAAC;AAC7B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAqB,MAAM,cAAc,CAAC;AACjE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAS,MAAM,kBAAkB,CAAC;AAMpE;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,IAAI,CAAC,UAAuB,EAAE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 @@
|
|
|
1
|
+
{"version":3,"file":"setup-workflow.d.ts","sourceRoot":"","sources":["../../src/commands/setup-workflow.ts"],"names":[],"mappings":"AAQA,wBAAsB,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC,CA8BnD"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import fs from 'fs/promises';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import { fileURLToPath } from 'url';
|
|
4
|
+
import { loadConfig } from '../config.js';
|
|
5
|
+
import { success, error, info } from '../lib/output.js';
|
|
6
|
+
const CRON_DEFAULT = '0 9 * * *';
|
|
7
|
+
export async function setupWorkflow() {
|
|
8
|
+
const configPath = path.join(process.cwd(), 'seshat.config.json');
|
|
9
|
+
let config;
|
|
10
|
+
try {
|
|
11
|
+
config = await loadConfig(configPath);
|
|
12
|
+
}
|
|
13
|
+
catch (err) {
|
|
14
|
+
error('Could not load seshat.config.json');
|
|
15
|
+
info('Run: seshat init');
|
|
16
|
+
process.exit(1);
|
|
17
|
+
}
|
|
18
|
+
const cron = config.schedule ?? CRON_DEFAULT;
|
|
19
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
20
|
+
const templatePath = path.resolve(__dirname, '../../templates/workflow.yml');
|
|
21
|
+
let template;
|
|
22
|
+
try {
|
|
23
|
+
template = await fs.readFile(templatePath, 'utf-8');
|
|
24
|
+
}
|
|
25
|
+
catch (err) {
|
|
26
|
+
error('Could not read workflow template from package');
|
|
27
|
+
process.exit(1);
|
|
28
|
+
}
|
|
29
|
+
const yaml = template.replace(/\{\{CRON\}\}/g, cron);
|
|
30
|
+
const outDir = path.join(process.cwd(), '.github', 'workflows');
|
|
31
|
+
await fs.mkdir(outDir, { recursive: true });
|
|
32
|
+
const outPath = path.join(outDir, 'seshat.yml');
|
|
33
|
+
await fs.writeFile(outPath, yaml, 'utf-8');
|
|
34
|
+
success(`Created ${path.relative(process.cwd(), outPath)} (schedule: ${cron})`);
|
|
35
|
+
info('Add GEMINI_API_KEY to your repository secrets to enable automated runs');
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=setup-workflow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup-workflow.js","sourceRoot":"","sources":["../../src/commands/setup-workflow.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,aAAa,CAAC;AAC7B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAExD,MAAM,YAAY,GAAG,WAAW,CAAC;AAEjC,MAAM,CAAC,KAAK,UAAU,aAAa;IACjC,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,oBAAoB,CAAC,CAAC;IAClE,IAAI,MAAM,CAAC;IACX,IAAI,CAAC;QACH,MAAM,GAAG,MAAM,UAAU,CAAC,UAAU,CAAC,CAAC;IACxC,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,KAAK,CAAC,mCAAmC,CAAC,CAAC;QAC3C,IAAI,CAAC,kBAAkB,CAAC,CAAC;QACzB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,MAAM,IAAI,GAAG,MAAM,CAAC,QAAQ,IAAI,YAAY,CAAC;IAC7C,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IAC/D,MAAM,YAAY,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,8BAA8B,CAAC,CAAC;IAC7E,IAAI,QAAgB,CAAC;IACrB,IAAI,CAAC;QACH,QAAQ,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;IACtD,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,KAAK,CAAC,+CAA+C,CAAC,CAAC;QACvD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,MAAM,IAAI,GAAG,QAAQ,CAAC,OAAO,CAAC,eAAe,EAAE,IAAI,CAAC,CAAC;IACrD,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC;IAChE,MAAM,EAAE,CAAC,KAAK,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC5C,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IAChD,MAAM,EAAE,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;IAE3C,OAAO,CAAC,WAAW,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,OAAO,CAAC,eAAe,IAAI,GAAG,CAAC,CAAC;IAChF,IAAI,CAAC,wEAAwE,CAAC,CAAC;AACjF,CAAC"}
|
package/dist/config.d.ts
CHANGED
|
@@ -1,4 +1,50 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Frontmatter configuration schema
|
|
4
|
+
*/
|
|
5
|
+
export declare const FrontmatterConfigSchema: z.ZodObject<{
|
|
6
|
+
dateField: z.ZodOptional<z.ZodString>;
|
|
7
|
+
dateFormat: z.ZodOptional<z.ZodString>;
|
|
8
|
+
imageField: z.ZodOptional<z.ZodString>;
|
|
9
|
+
includePublished: z.ZodOptional<z.ZodBoolean>;
|
|
10
|
+
taxonomyField: z.ZodOptional<z.ZodString>;
|
|
11
|
+
additionalFields: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
12
|
+
}, "strip", z.ZodTypeAny, {
|
|
13
|
+
dateField?: string | undefined;
|
|
14
|
+
dateFormat?: string | undefined;
|
|
15
|
+
imageField?: string | undefined;
|
|
16
|
+
includePublished?: boolean | undefined;
|
|
17
|
+
taxonomyField?: string | undefined;
|
|
18
|
+
additionalFields?: Record<string, any> | undefined;
|
|
19
|
+
}, {
|
|
20
|
+
dateField?: string | undefined;
|
|
21
|
+
dateFormat?: string | undefined;
|
|
22
|
+
imageField?: string | undefined;
|
|
23
|
+
includePublished?: boolean | undefined;
|
|
24
|
+
taxonomyField?: string | undefined;
|
|
25
|
+
additionalFields?: Record<string, any> | undefined;
|
|
26
|
+
}>;
|
|
27
|
+
export type FrontmatterConfig = z.infer<typeof FrontmatterConfigSchema>;
|
|
28
|
+
/**
|
|
29
|
+
* Content generation options schema
|
|
30
|
+
*/
|
|
31
|
+
export declare const GenerationConfigSchema: z.ZodObject<{
|
|
32
|
+
targetWordCount: z.ZodOptional<z.ZodNumber>;
|
|
33
|
+
includeCodeExamples: z.ZodOptional<z.ZodBoolean>;
|
|
34
|
+
seoOptimized: z.ZodOptional<z.ZodBoolean>;
|
|
35
|
+
customInstructions: z.ZodOptional<z.ZodString>;
|
|
36
|
+
}, "strip", z.ZodTypeAny, {
|
|
37
|
+
targetWordCount?: number | undefined;
|
|
38
|
+
includeCodeExamples?: boolean | undefined;
|
|
39
|
+
seoOptimized?: boolean | undefined;
|
|
40
|
+
customInstructions?: string | undefined;
|
|
41
|
+
}, {
|
|
42
|
+
targetWordCount?: number | undefined;
|
|
43
|
+
includeCodeExamples?: boolean | undefined;
|
|
44
|
+
seoOptimized?: boolean | undefined;
|
|
45
|
+
customInstructions?: string | undefined;
|
|
46
|
+
}>;
|
|
47
|
+
export type GenerationConfig = z.infer<typeof GenerationConfigSchema>;
|
|
2
48
|
/**
|
|
3
49
|
* Zod schema for Seshat configuration
|
|
4
50
|
*/
|
|
@@ -8,27 +54,116 @@ export declare const SeshatConfigSchema: z.ZodObject<{
|
|
|
8
54
|
publicAssetPath: z.ZodString;
|
|
9
55
|
topic: z.ZodString;
|
|
10
56
|
tone: z.ZodString;
|
|
11
|
-
framework: z.ZodEnum<["remix", "next", "astro"]
|
|
57
|
+
framework: z.ZodOptional<z.ZodEnum<["remix", "next", "astro"]>>;
|
|
58
|
+
schedule: z.ZodOptional<z.ZodString>;
|
|
59
|
+
fileExtension: z.ZodOptional<z.ZodEnum<["mdx", "md"]>>;
|
|
60
|
+
imageFormat: z.ZodOptional<z.ZodEnum<["png", "jpg", "svg"]>>;
|
|
61
|
+
fileNameTemplate: z.ZodOptional<z.ZodString>;
|
|
62
|
+
nestedDirectories: z.ZodOptional<z.ZodBoolean>;
|
|
63
|
+
frontmatter: z.ZodOptional<z.ZodObject<{
|
|
64
|
+
dateField: z.ZodOptional<z.ZodString>;
|
|
65
|
+
dateFormat: z.ZodOptional<z.ZodString>;
|
|
66
|
+
imageField: z.ZodOptional<z.ZodString>;
|
|
67
|
+
includePublished: z.ZodOptional<z.ZodBoolean>;
|
|
68
|
+
taxonomyField: z.ZodOptional<z.ZodString>;
|
|
69
|
+
additionalFields: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
70
|
+
}, "strip", z.ZodTypeAny, {
|
|
71
|
+
dateField?: string | undefined;
|
|
72
|
+
dateFormat?: string | undefined;
|
|
73
|
+
imageField?: string | undefined;
|
|
74
|
+
includePublished?: boolean | undefined;
|
|
75
|
+
taxonomyField?: string | undefined;
|
|
76
|
+
additionalFields?: Record<string, any> | undefined;
|
|
77
|
+
}, {
|
|
78
|
+
dateField?: string | undefined;
|
|
79
|
+
dateFormat?: string | undefined;
|
|
80
|
+
imageField?: string | undefined;
|
|
81
|
+
includePublished?: boolean | undefined;
|
|
82
|
+
taxonomyField?: string | undefined;
|
|
83
|
+
additionalFields?: Record<string, any> | undefined;
|
|
84
|
+
}>>;
|
|
85
|
+
generation: z.ZodOptional<z.ZodObject<{
|
|
86
|
+
targetWordCount: z.ZodOptional<z.ZodNumber>;
|
|
87
|
+
includeCodeExamples: z.ZodOptional<z.ZodBoolean>;
|
|
88
|
+
seoOptimized: z.ZodOptional<z.ZodBoolean>;
|
|
89
|
+
customInstructions: z.ZodOptional<z.ZodString>;
|
|
90
|
+
}, "strip", z.ZodTypeAny, {
|
|
91
|
+
targetWordCount?: number | undefined;
|
|
92
|
+
includeCodeExamples?: boolean | undefined;
|
|
93
|
+
seoOptimized?: boolean | undefined;
|
|
94
|
+
customInstructions?: string | undefined;
|
|
95
|
+
}, {
|
|
96
|
+
targetWordCount?: number | undefined;
|
|
97
|
+
includeCodeExamples?: boolean | undefined;
|
|
98
|
+
seoOptimized?: boolean | undefined;
|
|
99
|
+
customInstructions?: string | undefined;
|
|
100
|
+
}>>;
|
|
12
101
|
}, "strip", z.ZodTypeAny, {
|
|
13
102
|
contentDir: string;
|
|
14
103
|
assetsDir: string;
|
|
15
104
|
publicAssetPath: string;
|
|
16
105
|
topic: string;
|
|
17
106
|
tone: string;
|
|
18
|
-
framework
|
|
107
|
+
framework?: "remix" | "next" | "astro" | undefined;
|
|
108
|
+
schedule?: string | undefined;
|
|
109
|
+
fileExtension?: "mdx" | "md" | undefined;
|
|
110
|
+
imageFormat?: "png" | "jpg" | "svg" | undefined;
|
|
111
|
+
fileNameTemplate?: string | undefined;
|
|
112
|
+
nestedDirectories?: boolean | undefined;
|
|
113
|
+
frontmatter?: {
|
|
114
|
+
dateField?: string | undefined;
|
|
115
|
+
dateFormat?: string | undefined;
|
|
116
|
+
imageField?: string | undefined;
|
|
117
|
+
includePublished?: boolean | undefined;
|
|
118
|
+
taxonomyField?: string | undefined;
|
|
119
|
+
additionalFields?: Record<string, any> | undefined;
|
|
120
|
+
} | undefined;
|
|
121
|
+
generation?: {
|
|
122
|
+
targetWordCount?: number | undefined;
|
|
123
|
+
includeCodeExamples?: boolean | undefined;
|
|
124
|
+
seoOptimized?: boolean | undefined;
|
|
125
|
+
customInstructions?: string | undefined;
|
|
126
|
+
} | undefined;
|
|
19
127
|
}, {
|
|
20
128
|
contentDir: string;
|
|
21
129
|
assetsDir: string;
|
|
22
130
|
publicAssetPath: string;
|
|
23
131
|
topic: string;
|
|
24
132
|
tone: string;
|
|
25
|
-
framework
|
|
133
|
+
framework?: "remix" | "next" | "astro" | undefined;
|
|
134
|
+
schedule?: string | undefined;
|
|
135
|
+
fileExtension?: "mdx" | "md" | undefined;
|
|
136
|
+
imageFormat?: "png" | "jpg" | "svg" | undefined;
|
|
137
|
+
fileNameTemplate?: string | undefined;
|
|
138
|
+
nestedDirectories?: boolean | undefined;
|
|
139
|
+
frontmatter?: {
|
|
140
|
+
dateField?: string | undefined;
|
|
141
|
+
dateFormat?: string | undefined;
|
|
142
|
+
imageField?: string | undefined;
|
|
143
|
+
includePublished?: boolean | undefined;
|
|
144
|
+
taxonomyField?: string | undefined;
|
|
145
|
+
additionalFields?: Record<string, any> | undefined;
|
|
146
|
+
} | undefined;
|
|
147
|
+
generation?: {
|
|
148
|
+
targetWordCount?: number | undefined;
|
|
149
|
+
includeCodeExamples?: boolean | undefined;
|
|
150
|
+
seoOptimized?: boolean | undefined;
|
|
151
|
+
customInstructions?: string | undefined;
|
|
152
|
+
} | undefined;
|
|
26
153
|
}>;
|
|
27
154
|
export type SeshatConfig = z.infer<typeof SeshatConfigSchema>;
|
|
155
|
+
/**
|
|
156
|
+
* Framework preset configurations
|
|
157
|
+
*/
|
|
158
|
+
export declare const FRAMEWORK_PRESETS: Record<'remix' | 'next' | 'astro', Partial<SeshatConfig>>;
|
|
28
159
|
/**
|
|
29
160
|
* Default configuration values
|
|
30
161
|
*/
|
|
31
162
|
export declare const DEFAULT_CONFIG: SeshatConfig;
|
|
163
|
+
/**
|
|
164
|
+
* Resolve configuration with framework presets and defaults
|
|
165
|
+
*/
|
|
166
|
+
export declare function resolveConfig(config: SeshatConfig): SeshatConfig;
|
|
32
167
|
/**
|
|
33
168
|
* Load and validate configuration from file
|
|
34
169
|
*/
|