create-moka 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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 The Moka contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,8 @@
1
+ # create-moka
2
+
3
+ Scaffold a shareable [Moka](https://github.com/mokahq/mokalabs) demo: a `moka.json` with models, MCP servers and workspaces, plus example Agent Skills.
4
+
5
+ ```bash
6
+ npm create moka@latest my-demo
7
+ cd my-demo && npm install && npm start
8
+ ```
package/index.js ADDED
@@ -0,0 +1,102 @@
1
+ #!/usr/bin/env node
2
+ // create-moka — scaffold a shareable Moka demo. Zero dependencies on purpose.
3
+ import { cpSync, existsSync, readdirSync, readFileSync, renameSync, writeFileSync } from "node:fs";
4
+ import path from "node:path";
5
+ import { createInterface } from "node:readline/promises";
6
+ import { fileURLToPath } from "node:url";
7
+
8
+ const here = path.dirname(fileURLToPath(import.meta.url));
9
+ const tty = process.stdout.isTTY;
10
+ const c = (code) => (s) => (tty ? `\x1b[${code}m${s}\x1b[0m` : s);
11
+ const bold = c(1);
12
+ const dim = c(2);
13
+ const accent = c(33);
14
+ const red = c(31);
15
+
16
+ const HELP = `
17
+ ${accent("☕ create-moka")} — scaffold a Moka demo project
18
+
19
+ Usage
20
+ npm create moka@latest [dir]
21
+ pnpm create moka [dir]
22
+ npx create-moka [dir] [--yes]
23
+
24
+ Options
25
+ -y, --yes accept defaults, no prompts
26
+ -h, --help show this help
27
+ `;
28
+
29
+ export function toPackageName(input) {
30
+ return (
31
+ path
32
+ .basename(path.resolve(input))
33
+ .toLowerCase()
34
+ .replace(/[^a-z0-9-~._]+/g, "-")
35
+ .replace(/^[-._]+|[-._]+$/g, "") || "moka-demo"
36
+ );
37
+ }
38
+
39
+ export function detectPackageManager(userAgent = process.env.npm_config_user_agent ?? "") {
40
+ if (userAgent.startsWith("pnpm")) return "pnpm";
41
+ if (userAgent.startsWith("yarn")) return "yarn";
42
+ if (userAgent.startsWith("bun")) return "bun";
43
+ return "npm";
44
+ }
45
+
46
+ export function scaffold(targetDir, { name } = {}) {
47
+ const target = path.resolve(targetDir);
48
+ if (existsSync(target) && readdirSync(target).filter((f) => f !== ".git").length > 0) {
49
+ throw new Error(`${targetDir} is not empty`);
50
+ }
51
+ cpSync(path.join(here, "templates", "default"), target, { recursive: true });
52
+ // npm strips dotfiles from published packages, so templates ship them with a leading underscore.
53
+ for (const file of ["_gitignore", "_env.example"]) {
54
+ const from = path.join(target, file);
55
+ if (existsSync(from)) renameSync(from, path.join(target, file.replace(/^_/, ".")));
56
+ }
57
+ const pkgPath = path.join(target, "package.json");
58
+ const pkg = JSON.parse(readFileSync(pkgPath, "utf8"));
59
+ pkg.name = name ?? toPackageName(targetDir);
60
+ writeFileSync(pkgPath, `${JSON.stringify(pkg, null, 2)}\n`);
61
+ return target;
62
+ }
63
+
64
+ async function main() {
65
+ const args = process.argv.slice(2);
66
+ if (args.includes("-h") || args.includes("--help")) {
67
+ console.log(HELP);
68
+ return;
69
+ }
70
+ const yes = args.includes("-y") || args.includes("--yes");
71
+ let dir = args.find((a) => !a.startsWith("-"));
72
+
73
+ console.log(`\n ${accent("☕ create-moka")}\n`);
74
+ if (!dir) {
75
+ if (yes || !process.stdin.isTTY) dir = "moka-demo";
76
+ else {
77
+ const rl = createInterface({ input: process.stdin, output: process.stdout });
78
+ dir = (await rl.question(` ${bold("Project folder")} ${dim("(moka-demo)")} › `)).trim() || "moka-demo";
79
+ rl.close();
80
+ }
81
+ }
82
+
83
+ const target = scaffold(dir);
84
+ const pm = detectPackageManager();
85
+ const run = pm === "npm" ? "npm run" : pm;
86
+ const rel = path.relative(process.cwd(), target) || ".";
87
+ console.log(` ${c(32)("✓")} Created ${bold(rel)}\n`);
88
+ console.log(` Next steps:\n`);
89
+ if (rel !== ".") console.log(` cd ${rel}`);
90
+ console.log(` ${pm} install`);
91
+ console.log(` export OPENAI_API_KEY=… ${dim("# or ANTHROPIC_API_KEY, GEMINI_API_KEY, or run Ollama")}`);
92
+ console.log(` ${run} start\n`);
93
+ console.log(` ${dim("Edit moka.json (or use the Settings UI) to add models, MCP servers and skills.")}\n`);
94
+ }
95
+
96
+ const invokedDirectly = process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.meta.url);
97
+ if (invokedDirectly || process.argv[1]?.endsWith("create-moka")) {
98
+ main().catch((error) => {
99
+ console.error(` ${red("✗")} ${error.message}`);
100
+ process.exit(1);
101
+ });
102
+ }
package/package.json ADDED
@@ -0,0 +1,34 @@
1
+ {
2
+ "name": "create-moka",
3
+ "version": "0.1.0",
4
+ "description": "Scaffold a Moka demo project: npm create moka@latest",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "bin": {
8
+ "create-moka": "./index.js"
9
+ },
10
+ "files": [
11
+ "index.js",
12
+ "templates"
13
+ ],
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "git+https://github.com/mokahq/mokalabs.git",
17
+ "directory": "packages/create-moka"
18
+ },
19
+ "keywords": [
20
+ "moka",
21
+ "mcp",
22
+ "llm",
23
+ "create",
24
+ "scaffold",
25
+ "agent",
26
+ "skills"
27
+ ],
28
+ "engines": {
29
+ "node": ">=20"
30
+ },
31
+ "scripts": {
32
+ "test": "node --test test/*.test.js"
33
+ }
34
+ }
@@ -0,0 +1,13 @@
1
+ # Moka demo
2
+
3
+ A ready-to-run [Moka](https://github.com/mokahq/mokalabs) sandbox: any LLM, MCP servers and skills, with a live inspector.
4
+
5
+ ```bash
6
+ npm install
7
+ export OPENAI_API_KEY=sk-... # or ANTHROPIC_API_KEY / GEMINI_API_KEY, or run Ollama
8
+ npm start
9
+ ```
10
+
11
+ - `moka.json` holds models, MCP servers, skills and workspaces. Commit it; keys stay in env vars (`env:NAME`).
12
+ - `skills/` holds Agent Skills (`SKILL.md` + reference files).
13
+ - Change anything from **Settings** in the UI; it writes back to `moka.json`.
@@ -0,0 +1,3 @@
1
+ OPENAI_API_KEY=
2
+ ANTHROPIC_API_KEY=
3
+ GEMINI_API_KEY=
@@ -0,0 +1,2 @@
1
+ node_modules
2
+ .env
@@ -0,0 +1,45 @@
1
+ {
2
+ "$schema": "https://unpkg.com/@mokalabs/sandbox/dist/moka.schema.json",
3
+ "version": 1,
4
+ "activeWorkspaceId": "support-bot",
5
+ "llms": [
6
+ { "id": "openai", "name": "OpenAI", "provider": "openai", "model": "gpt-5-mini", "apiKey": "env:OPENAI_API_KEY" },
7
+ { "id": "anthropic", "name": "Anthropic", "provider": "anthropic", "model": "claude-sonnet-5", "apiKey": "env:ANTHROPIC_API_KEY" },
8
+ { "id": "ollama", "name": "Ollama", "provider": "ollama", "model": "llama3.2" }
9
+ ],
10
+ "mcpServers": [
11
+ { "id": "moka-demo", "name": "Moka demo tools", "transport": "stdio", "command": "moka:demo", "args": [] },
12
+ { "id": "deepwiki", "name": "DeepWiki", "transport": "http", "url": "https://mcp.deepwiki.com/mcp" }
13
+ ],
14
+ "skills": [
15
+ { "id": "brand-voice", "path": "skills/brand-voice" },
16
+ { "id": "incident-report", "path": "skills/incident-report" }
17
+ ],
18
+ "workspaces": [
19
+ {
20
+ "id": "support-bot",
21
+ "name": "Support bot",
22
+ "llmId": "openai",
23
+ "mcpServerIds": ["moka-demo"],
24
+ "skillIds": ["brand-voice"],
25
+ "systemPrompt": "You are Moka Support, a friendly assistant for a coffee subscription company. Use tools when they help and keep answers short.",
26
+ "starterPrompts": [
27
+ "What time is it in Bengaluru and New York right now?",
28
+ "A customer paid $18.50 for 3 bags — what's the price per bag?",
29
+ "Write a reply to a customer whose order arrived late"
30
+ ]
31
+ },
32
+ {
33
+ "id": "sre",
34
+ "name": "On-call SRE",
35
+ "llmId": "anthropic",
36
+ "mcpServerIds": ["moka-demo", "deepwiki"],
37
+ "skillIds": ["incident-report"],
38
+ "systemPrompt": "You are a calm, precise SRE assistant.",
39
+ "starterPrompts": [
40
+ "Draft an incident report: checkout API returned 500s for 12 minutes after a deploy",
41
+ "Using DeepWiki, how does the modelcontextprotocol/typescript-sdk handle reconnection?"
42
+ ]
43
+ }
44
+ ]
45
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "name": "moka-demo",
3
+ "private": true,
4
+ "type": "module",
5
+ "scripts": {
6
+ "start": "moka",
7
+ "dev": "moka --no-open"
8
+ },
9
+ "devDependencies": {
10
+ "@mokalabs/sandbox": "^0.1.0"
11
+ }
12
+ }
@@ -0,0 +1,14 @@
1
+ ---
2
+ name: brand-voice
3
+ description: House style for customer-facing replies (tone, structure, sign-off). Use whenever writing a message to a customer.
4
+ ---
5
+
6
+ # Brand voice
7
+
8
+ - Warm, plain English. No jargon, no exclamation marks in apologies.
9
+ - Structure: acknowledge → explain in one sentence → concrete next step.
10
+ - Offer something specific when we are at fault (free bag, refund of shipping).
11
+ - Keep it under 120 words.
12
+ - Sign off with: "— The Moka team ☕"
13
+
14
+ See `examples.md` for good and bad replies.
@@ -0,0 +1,7 @@
1
+ ## Good
2
+
3
+ > Sorry your beans arrived late — that's on us. The courier missed a hand-off in Pune, and we've flagged it with them. We've refunded your shipping and your next bag ships first. — The Moka team ☕
4
+
5
+ ## Bad
6
+
7
+ > We apologize for any inconvenience caused!!! Due to unforeseen logistical circumstances…
@@ -0,0 +1,17 @@
1
+ ---
2
+ name: incident-report
3
+ description: Template and rules for writing blameless incident reports / postmortems. Use when asked to write up an outage or incident.
4
+ ---
5
+
6
+ # Incident report
7
+
8
+ Write blameless reports with these sections, in order:
9
+
10
+ 1. **Summary**: two sentences, impact first.
11
+ 2. **Impact**: who was affected, for how long, and what they saw.
12
+ 3. **Timeline** in UTC, as a table (time | event).
13
+ 4. **Root cause**: what happened technically. No names.
14
+ 5. **What went well / what didn't**
15
+ 6. **Action items**: a table (action | owner role | priority).
16
+
17
+ Use the `get_time` tool to timestamp the report.