[READ-ONLY] Mirror of https://github.com/plttn/mkd.
0

Configure Feed

Select the types of activity you want to include in your feed.

add readme, etc

Jack Platten (May 24, 2026, 3:18 PM -0700) 8c75c019 18d39085

+143 -13
+25
README.md
··· 1 + # Mkd 2 + 3 + A CLI for managing your static site generator's blog posts. 4 + 5 + ## Quickstart 6 + 7 + ``` 8 + pnpm i -g mkd 9 + ``` 10 + 11 + Create a `mkd.json` file containing your front matter settings: 12 + 13 + ``` 14 + mkd init 15 + ``` 16 + 17 + Then create a new post: 18 + 19 + `mkd new` 20 + 21 + When you're ready to undraft it: 22 + 23 + `mkd publish` 24 + 25 + You're now ready to make whatever publishing process you use.
-11
mkd.json
··· 1 - { 2 - "blogDir": "./test/src/blog", 3 - "author": "Wendy", 4 - "publishedAtKey": "publishedAt", 5 - "modifiedAtKey": "updatedAt", 6 - "authorKey": "author", 7 - "draftKey": "draft", 8 - "descriptionKey": "description", 9 - "tagsKey": "tags", 10 - "titleKey": "title" 11 - }
+4
package.json
··· 46 46 "filenamify": "^7.0.1", 47 47 "gray-matter": "^4.0.3", 48 48 "pwd-fs": "^3.5.4" 49 + }, 50 + "repository": { 51 + "type": "git", 52 + "url": "https://github.com/plttn/mkd.git" 49 53 } 50 54 }
+111
src/commands/init.ts
··· 1 + import { command } from "cmd-ts"; 2 + import { text, isCancel, intro, outro } from "@clack/prompts"; 3 + import type { Deps } from "../lib/deps"; 4 + 5 + export function makeInitCommand({ config, pfs }: Deps) { 6 + return command({ 7 + name: "init", 8 + description: "Create or update mkd.json configuration", 9 + args: {}, 10 + handler: async () => { 11 + intro("Initialize mkd configuration"); 12 + 13 + const blogDir = await text({ 14 + message: "Directory where generated posts are written", 15 + defaultValue: String(config.blogDir ?? "./src/blog"), 16 + }); 17 + if (isCancel(blogDir)) { 18 + outro("Init cancelled"); 19 + return; 20 + } 21 + 22 + const author = await text({ 23 + message: "Default author", 24 + defaultValue: String(config.author ?? ""), 25 + }); 26 + if (isCancel(author)) { 27 + outro("Init cancelled"); 28 + return; 29 + } 30 + 31 + const titleKey = await text({ 32 + message: "Title frontmatter key", 33 + defaultValue: String(config.titleKey ?? "title"), 34 + }); 35 + if (isCancel(titleKey)) { 36 + outro("Init cancelled"); 37 + return; 38 + } 39 + 40 + const publishedAtKey = await text({ 41 + message: "Published date frontmatter key", 42 + defaultValue: String(config.publishedAtKey ?? "publishedAt"), 43 + }); 44 + if (isCancel(publishedAtKey)) { 45 + outro("Init cancelled"); 46 + return; 47 + } 48 + 49 + const modifiedAtKey = await text({ 50 + message: "Modified date frontmatter key", 51 + defaultValue: String(config.modifiedAtKey ?? "updatedAt"), 52 + }); 53 + if (isCancel(modifiedAtKey)) { 54 + outro("Init cancelled"); 55 + return; 56 + } 57 + 58 + const authorKey = await text({ 59 + message: "Author frontmatter key", 60 + defaultValue: String(config.authorKey ?? "author"), 61 + }); 62 + if (isCancel(authorKey)) { 63 + outro("Init cancelled"); 64 + return; 65 + } 66 + 67 + const draftKey = await text({ 68 + message: "Draft frontmatter key", 69 + defaultValue: String(config.draftKey ?? "draft"), 70 + }); 71 + if (isCancel(draftKey)) { 72 + outro("Init cancelled"); 73 + return; 74 + } 75 + 76 + const descriptionKey = await text({ 77 + message: "Description frontmatter key", 78 + defaultValue: String(config.descriptionKey ?? "description"), 79 + }); 80 + if (isCancel(descriptionKey)) { 81 + outro("Init cancelled"); 82 + return; 83 + } 84 + 85 + const tagsKey = await text({ 86 + message: "Tags frontmatter key", 87 + defaultValue: String(config.tagsKey ?? "tags"), 88 + }); 89 + if (isCancel(tagsKey)) { 90 + outro("Init cancelled"); 91 + return; 92 + } 93 + 94 + const newConfig = { 95 + blogDir: String(blogDir), 96 + author: String(author), 97 + publishedAtKey: String(publishedAtKey), 98 + modifiedAtKey: String(modifiedAtKey), 99 + authorKey: String(authorKey), 100 + draftKey: String(draftKey), 101 + descriptionKey: String(descriptionKey), 102 + tagsKey: String(tagsKey), 103 + titleKey: String(titleKey), 104 + }; 105 + 106 + await pfs.write("./mkd.json", JSON.stringify(newConfig, null, 2) + "\n"); 107 + 108 + outro("Configuration saved to mkd.json"); 109 + }, 110 + }); 111 + }
-1
src/commands/new.ts
··· 48 48 const data = { 49 49 [config.titleKey]: title, 50 50 [config.publishedAtKey]: now, 51 - // [config.modifiedAtKey]: now, 52 51 [config.authorKey]: config.author, 53 52 [config.draftKey]: true, 54 53 [config.descriptionKey]: description,
src/commands/retract.ts src/commands/unpublish.ts
+3 -1
src/index.ts
··· 5 5 import { makeNewCommand } from "./commands/new"; 6 6 import { makePublishCommand } from "./commands/publish"; 7 7 import { makeUpdateCommand } from "./commands/update"; 8 - import { makeUnPublishCommand } from "./commands/retract"; 8 + import { makeUnPublishCommand } from "./commands/unpublish"; 9 + import { makeInitCommand } from "./commands/init"; 9 10 10 11 async function main() { 11 12 const pfs = new PoweredFileSystem(); ··· 19 20 publish: makePublishCommand(deps), 20 21 update: makeUpdateCommand(deps), 21 22 unpublish: makeUnPublishCommand(deps), 23 + init: makeInitCommand(deps), 22 24 }, 23 25 }); 24 26