moomodding 1.0.3 → 1.1.1

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 CHANGED
@@ -1,81 +1,81 @@
1
- # MooModding Developer CLI (`moo`)
1
+ # MooModding CLI (`moo`)
2
2
 
3
- > The official Node.js command-line tool for building, testing, and hot-syncing MooMoo.io mods with the **MooModding.io** ecosystem.
3
+ Official developer command-line tool and game SDK for building, testing, syncing, and publishing MooMoo.io mods on **MooModding.io**.
4
4
 
5
5
  ---
6
6
 
7
- ## ⚡ Features
8
-
9
- - **Zero-Friction Setup:** Use with `npx moomodding` or install globally via `npm i -g moomodding`.
10
- - **Directory-First Auto-Walk:** No manual file lists in `mod.json`. Add, remove, and nest folders (`src/combat/`, `assets/`, `utils/`) freely.
11
- - **Instant Hot-Sync (`moo dev`):** Automatically pushes changes to the cloud on every `Ctrl + S`.
12
- - **Reconciliation:** Deleted local files are cleaned up from the cloud mirror automatically.
13
- - **Smart Ignore:** Built-in `.mooignore` ignores `node_modules`, `.git`, `.env`, and build artifacts.
14
-
15
- ---
16
-
17
- ## 🚀 Quick Start
18
-
19
- ### 1. Installation
7
+ ## Installation
20
8
 
21
9
  ```bash
22
- # Global install (recommended for quick 'moo' alias)
10
+ # Install globally
23
11
  npm install -g moomodding
24
12
 
25
- # Or run directly without installation
13
+ # Or run directly with npx
26
14
  npx moomodding --help
27
15
  ```
28
16
 
29
- ### 2. Login to Your MooModding Account
17
+ ---
18
+
19
+ ## Quick Start
30
20
 
31
21
  ```bash
22
+ # 1. Authenticate with your MooModding account
32
23
  moo login
33
- ```
34
- *Generates or prompts for your Personal Access Token from `https://moomodding.io/settings`.*
35
24
 
36
- ### 3. Create or Clone a Mod
25
+ # 2. Scaffold a new mod project
26
+ moo init my-mod --community
37
27
 
38
- ```bash
39
- # Start a fresh TypeScript mod project
40
- moo init my-combat-mod
41
- cd my-combat-mod
28
+ # 3. Start live sync watcher (pushes to sandbox on save)
29
+ cd my-mod
30
+ moo dev
42
31
 
43
- # Or clone an existing mod from your cloud storage
44
- moo clone elite-combat-suite
45
- cd elite-combat-suite
32
+ # 4. Publish release to the Community Gallery
33
+ moo publish patch -m "Initial release"
46
34
  ```
47
35
 
48
- ### 4. Develop & Test Live
36
+ ---
49
37
 
50
- ```bash
51
- # Run watch mode
52
- moo dev
53
- ```
54
- Open `https://sandbox.moomodding.io/` in your browser. Refresh the page whenever you save code to test your updates live in-game!
38
+ ## Commands
39
+
40
+ | Command | Description |
41
+ | :--- | :--- |
42
+ | `moo login [token]` | Log in to your MooModding account |
43
+ | `moo whoami` | View logged-in account and cloud storage quota |
44
+ | `moo init [dir] [flags]` | Scaffold a new mod project (`--community`, `-t`, `-d`) |
45
+ | `moo list` (or `ls`) | List your cloud mods and storage usage |
46
+ | `moo clone <target> [dir]` | Clone a personal cloud mod or community mod (`@author/slug`) |
47
+ | `moo push` | Scan directory and upload mod files to cloud |
48
+ | `moo pull` | Download latest mod files from cloud |
49
+ | `moo dev` | Watch local directory and auto-sync to cloud on every save |
50
+ | `moo publish [version]` | Publish release to Community Gallery (`patch`, `minor`, `major`, or `1.0.0`) |
51
+ | `moo config <action>` | View or update CLI configuration |
52
+ | `moo logout` | Clear local credentials and log out |
55
53
 
56
54
  ---
57
55
 
58
- ## 📋 Commands Reference
56
+ ## Options & Flags
59
57
 
60
- | Command | Shortcut | Description |
61
- | :--- | :--- | :--- |
62
- | `moomodding login [token]` | `moo login` | Authenticate with your MooModding Personal Access Token |
63
- | `moomodding whoami` | `moo whoami` | Display active user, email, and storage quota |
64
- | `moomodding list` | `moo ls` | List all your cloud mods and their storage sizes |
65
- | `moomodding init [name]` | `moo init` | Scaffold a new mod with template files |
66
- | `moomodding clone <slug>` | `moo clone` | Clone a cloud mod into a local directory |
67
- | `moomodding push` | `moo push` | Auto-scan directory and push files to cloud |
68
- | `moomodding pull` | `moo pull` | Pull latest files from cloud into current folder |
69
- | `moomodding dev` | `moo dev` | Start file watcher (hot-sync on save) |
70
- | `moomodding logout` | `moo logout` | Clear local auth credentials |
58
+ ### `moo init [dir]`
59
+ * `-n, --name <name>`: Mod display name
60
+ * `-t, --type <type>`: Mod architecture (`hook`, `bundle_replacement`, or `html_replacement`)
61
+ * `-c, --community`: Scaffold as an open-source community mod
62
+ * `-d, --description <desc>`: Mod description for showcase
63
+ * `-v, --version <version>`: Initial version (default: `1.0.0`)
64
+
65
+ ### `moo publish [version]`
66
+ * `[version]`: `patch`, `minor`, `major`, or explicit semver (e.g. `1.1.0`)
67
+ * `-m, --message <changelog>`: Release changelog notes
68
+ * `--status <status>`: Visibility status (`active`, `unlisted`, `archived`)
69
+ * `-d, --description <desc>`: Update mod description
70
+ * `--youtube <url>`: Video showcase URL
71
+ * `-y, --yes`: Skip confirmation prompt
72
+
73
+ ### `moo clone <target>`
74
+ * Private mod: `moo clone my-private-mod`
75
+ * Community mod: `moo clone @author/slug`
71
76
 
72
77
  ---
73
78
 
74
- ## 🛠️ Local Development (Developing this CLI)
79
+ ## License
75
80
 
76
- ```bash
77
- cd moomodding-cli
78
- npm install
79
- npm run build
80
- npm link # links 'moo' globally on your machine for testing
81
- ```
81
+ MIT © [MooModding.io](https://moomodding.io)
package/dist/cli.js CHANGED
@@ -8,12 +8,13 @@ import { cloneCommand } from "./commands/clone.js";
8
8
  import { pushCommand } from "./commands/push.js";
9
9
  import { pullCommand } from "./commands/pull.js";
10
10
  import { devCommand } from "./commands/dev.js";
11
+ import { publishCommand } from "./commands/publish.js";
11
12
  import { clearAuth, loadConfig, saveConfig } from "./core/config.js";
12
13
  const program = new Command();
13
14
  program
14
15
  .name("moo")
15
16
  .description("MooModding Developer CLI — Build, test, and sync MooMoo.io mods with zero friction.")
16
- .version("1.0.2");
17
+ .version("1.1.1");
17
18
  // 1. Auth Commands
18
19
  program
19
20
  .command("login [token]")
@@ -39,7 +40,10 @@ program
39
40
  .command("init [dir]")
40
41
  .description("Scaffold a new MooMoo mod project")
41
42
  .option("-n, --name <name>", "Mod display name")
42
- .option("-t, --type <type>", "Mod type ('hook' or 'bundle_replacement')", "hook")
43
+ .option("-t, --type <type>", "Mod type ('hook', 'bundle_replacement', or 'html_replacement')", "hook")
44
+ .option("-c, --community", "Scaffold as open-source community mod")
45
+ .option("-d, --description <desc>", "Mod description for community showcase")
46
+ .option("-v, --version <version>", "Initial mod version", "1.0.0")
43
47
  .action(async (dir, options) => {
44
48
  await initCommand(dir, options);
45
49
  });
@@ -51,10 +55,10 @@ program
51
55
  await listCommand();
52
56
  });
53
57
  program
54
- .command("clone <slug> [dir]")
55
- .description("Clone a cloud mod into a local directory")
56
- .action(async (slug, dir) => {
57
- await cloneCommand(slug, dir);
58
+ .command("clone <target> [dir]")
59
+ .description("Clone a cloud mod or inspect community mod (@author/slug)")
60
+ .action(async (target, dir) => {
61
+ await cloneCommand(target, dir);
58
62
  });
59
63
  program
60
64
  .command("push")
@@ -74,6 +78,19 @@ program
74
78
  .action(() => {
75
79
  devCommand();
76
80
  });
81
+ program
82
+ .command("publish [version]")
83
+ .description("Publish a release version to the Community Gallery (e.g. moo publish patch, moo publish 1.2.0)")
84
+ .option("-m, --message <changelog>", "Release changelog notes")
85
+ .option("--changelog <changelog>", "Release changelog notes")
86
+ .option("--status <status>", "Visibility status ('active', 'unlisted', 'archived')", "active")
87
+ .option("-d, --description <desc>", "Update mod description")
88
+ .option("--desc <desc>", "Update mod description")
89
+ .option("--youtube <url>", "YouTube showcase or tutorial video URL")
90
+ .option("-y, --yes", "Skip confirmation prompt")
91
+ .action(async (version, options) => {
92
+ await publishCommand(version, options);
93
+ });
77
94
  // 3. Configuration command
78
95
  program
79
96
  .command("config <action> [key] [value]")
@@ -4,36 +4,101 @@ import pc from "picocolors";
4
4
  import { api } from "../core/client.js";
5
5
  export async function cloneCommand(modSlug, targetDirName) {
6
6
  if (!modSlug) {
7
- console.log(pc.red("[error] Mod slug is required."));
8
- console.log(pc.gray(`Example: ${pc.cyan("moo clone elite-combat-suite")}`));
7
+ console.log(pc.red("[error] Mod identifier is required."));
8
+ console.log(pc.gray(`Examples:`));
9
+ console.log(pc.gray(` moo clone my-private-mod`));
10
+ console.log(pc.gray(` moo clone @author/community-slug`));
9
11
  process.exit(1);
10
12
  }
11
- const cleanSlug = modSlug.trim().toLowerCase();
12
- const destDir = path.resolve(process.cwd(), targetDirName || cleanSlug);
13
- console.log(pc.cyan(`[clone] Downloading '${cleanSlug}'...`));
13
+ const rawInput = modSlug.trim();
14
+ let isCommunity = false;
15
+ let author = "";
16
+ let slug = "";
17
+ if (rawInput.startsWith("community:")) {
18
+ const parts = rawInput.replace(/^community:/, "").split("/");
19
+ author = parts[0];
20
+ slug = parts[1] || "";
21
+ isCommunity = true;
22
+ }
23
+ else if (rawInput.startsWith("@")) {
24
+ const parts = rawInput.replace(/^@/, "").split("/");
25
+ author = parts[0];
26
+ slug = parts[1] || "";
27
+ isCommunity = true;
28
+ }
29
+ else if (rawInput.includes("/")) {
30
+ const parts = rawInput.split("/");
31
+ author = parts[0];
32
+ slug = parts[1] || "";
33
+ isCommunity = true;
34
+ }
35
+ else {
36
+ slug = rawInput.toLowerCase();
37
+ }
38
+ if (isCommunity && (!author || !slug)) {
39
+ console.log(pc.red("[error] Invalid community mod format. Use: @author/slug or community:author/slug"));
40
+ process.exit(1);
41
+ }
42
+ const destDir = path.resolve(process.cwd(), targetDirName || slug);
43
+ if (isCommunity) {
44
+ console.log(pc.cyan(`[clone] Inspecting community mod '@${author}/${slug}'...`));
45
+ }
46
+ else {
47
+ console.log(pc.cyan(`[clone] Downloading personal cloud mod '${slug}'...`));
48
+ }
14
49
  console.log(pc.gray(`Destination: ${destDir}`));
15
50
  try {
16
- const res = await api.get(`/api/developer/mods/${cleanSlug}/pull`);
17
- if (!res.success || !res.files) {
18
- console.log(pc.red(`[error] Failed to clone mod: ${res.message || "Unknown error"}`));
19
- process.exit(1);
51
+ let files = {};
52
+ let modInfo = {};
53
+ if (isCommunity) {
54
+ // Fetch open-source code from public community endpoint
55
+ const res = await api.get(`/api/community-mods/${encodeURIComponent(author)}/${encodeURIComponent(slug)}/inspect-code`, {
56
+ requiresAuth: false
57
+ });
58
+ if (!res.success || !res.files) {
59
+ console.log(pc.red(`[error] Failed to fetch community mod: ${res.message || "Mod not found"}`));
60
+ process.exit(1);
61
+ }
62
+ files = res.files;
63
+ modInfo = {
64
+ name: slug.replace(/-/g, " ").replace(/\b\w/g, c => c.toUpperCase()),
65
+ slug: slug,
66
+ type: "hook",
67
+ version: "1.0.0",
68
+ entry_point: Object.keys(files).includes("src/index.ts") ? "src/index.ts" : Object.keys(files)[0] || "src/index.ts",
69
+ is_active: true,
70
+ community: true,
71
+ forked_from: `@${author}/${slug}`
72
+ };
73
+ }
74
+ else {
75
+ // Fetch personal cloud mod from developer API
76
+ const res = await api.get(`/api/developer/mods/${slug}/pull`);
77
+ if (!res.success || !res.files) {
78
+ console.log(pc.red(`[error] Failed to clone cloud mod: ${res.message || "Unknown error"}`));
79
+ process.exit(1);
80
+ }
81
+ files = res.files;
82
+ modInfo = res.mod;
20
83
  }
21
84
  if (!fs.existsSync(destDir)) {
22
85
  fs.mkdirSync(destDir, { recursive: true });
23
86
  }
24
87
  // 1. Write mod.json
25
88
  const modJson = {
26
- name: res.mod.name,
27
- slug: res.mod.slug,
28
- type: res.mod.type || "hook",
29
- version: res.mod.version || "1.0.0",
30
- entry: res.mod.entry_point || "src/index.ts",
31
- is_active: res.mod.is_active ?? true
89
+ name: modInfo.name,
90
+ slug: modInfo.slug,
91
+ type: modInfo.type || "hook",
92
+ version: modInfo.version || "1.0.0",
93
+ entry: modInfo.entry_point || "src/index.ts",
94
+ is_active: modInfo.is_active ?? true,
95
+ community: modInfo.community ?? false,
96
+ forked_from: modInfo.forked_from || undefined
32
97
  };
33
98
  fs.writeFileSync(path.join(destDir, "mod.json"), JSON.stringify(modJson, null, 2), "utf-8");
34
99
  // 2. Write all files and recreate directories (with Path Traversal protection)
35
100
  let writtenCount = 0;
36
- for (const [relPath, content] of Object.entries(res.files)) {
101
+ for (const [relPath, content] of Object.entries(files)) {
37
102
  if (typeof content !== "string")
38
103
  continue;
39
104
  const resolvedPath = path.resolve(destDir, relPath);
@@ -53,7 +118,10 @@ export async function cloneCommand(modSlug, targetDirName) {
53
118
  if (!fs.existsSync(mooIgnorePath)) {
54
119
  fs.writeFileSync(mooIgnorePath, `node_modules/\n.git/\n.vscode/\n.idea/\ndist/\nbuild/\n*.log\n.env\n.DS_Store\n`, "utf-8");
55
120
  }
56
- console.log(pc.green(`[success] Cloned '${res.mod.name}' successfully.`));
121
+ console.log(pc.green(`[success] Cloned '${modInfo.name}' successfully.`));
122
+ if (modInfo.forked_from) {
123
+ console.log(pc.magenta(`Forked from: ${modInfo.forked_from}`));
124
+ }
57
125
  console.log(pc.gray(`Files written: ${writtenCount}`));
58
126
  console.log(pc.gray(`Next steps:\n cd ${path.basename(destDir)}\n moo dev\n`));
59
127
  }
@@ -1,6 +1,9 @@
1
1
  export interface InitOptions {
2
2
  name?: string;
3
- type?: "hook" | "bundle_replacement";
3
+ type?: "hook" | "bundle_replacement" | "html_replacement";
4
+ version?: string;
5
+ community?: boolean;
6
+ description?: string;
4
7
  template?: string;
5
8
  }
6
9
  export declare function initCommand(targetDirName?: string, options?: InitOptions): Promise<void>;
@@ -7,7 +7,11 @@ export async function initCommand(targetDirName, options = {}) {
7
7
  const cleanSlug = path.basename(dir).toLowerCase().replace(/[^a-z0-9_-]/g, "-");
8
8
  const modName = options.name || cleanSlug.replace(/-/g, " ").replace(/\b\w/g, c => c.toUpperCase());
9
9
  const modType = options.type || "hook";
10
- console.log(pc.cyan(`[init] Initializing mod project: ${modName}`));
10
+ const isCommunity = Boolean(options.community);
11
+ console.log(pc.cyan(`[init] Initializing mod project: ${modName} (${modType})`));
12
+ if (isCommunity) {
13
+ console.log(pc.magenta(`[community] Open-Source Community project mode enabled.`));
14
+ }
11
15
  if (!fs.existsSync(dir)) {
12
16
  fs.mkdirSync(dir, { recursive: true });
13
17
  }
@@ -16,21 +20,47 @@ export async function initCommand(targetDirName, options = {}) {
16
20
  console.log(pc.yellow(`[warn] Directory already contains 'mod.json'.`));
17
21
  return;
18
22
  }
19
- // 1. Write minimal mod.json (Notice: NO file list here, auto-scanned!)
23
+ const entryPoint = modType === "html_replacement" ? "src/index.html" : "src/index.ts";
24
+ // 1. Write mod.json
20
25
  const modConfig = {
21
26
  name: modName,
22
27
  slug: cleanSlug,
23
28
  type: modType,
24
- version: "1.0.0",
25
- entry: "src/index.ts"
29
+ version: options.version || "1.0.0",
30
+ entry: entryPoint,
31
+ community: isCommunity,
32
+ description: options.description || `${modName} - Built with MooModding Developer CLI`,
33
+ status: "active"
26
34
  };
27
35
  fs.writeFileSync(modJsonPath, JSON.stringify(modConfig, null, 2), "utf-8");
28
- // 2. Create src folder and src/index.ts
36
+ // 2. Create src folder and entry files
29
37
  const srcDir = path.join(dir, "src");
30
38
  if (!fs.existsSync(srcDir)) {
31
39
  fs.mkdirSync(srcDir, { recursive: true });
32
40
  }
33
- const indexTsContent = `/**
41
+ if (modType === "html_replacement") {
42
+ const indexHtmlContent = `<!DOCTYPE html>
43
+ <html>
44
+ <head>
45
+ <meta charset="utf-8">
46
+ <title>${modName}</title>
47
+ <style>
48
+ body { margin: 0; background: #0b0e14; color: #fff; font-family: sans-serif; display: flex; align-items: center; justify-content: center; height: 100vh; }
49
+ .card { padding: 24px; border: 1px solid #7ee559; border-radius: 8px; text-align: center; }
50
+ </style>
51
+ </head>
52
+ <body>
53
+ <div class="card">
54
+ <h1>${modName}</h1>
55
+ <p>Custom HTML Client Replacement active.</p>
56
+ </div>
57
+ </body>
58
+ </html>
59
+ `;
60
+ fs.writeFileSync(path.join(srcDir, "index.html"), indexHtmlContent, "utf-8");
61
+ }
62
+ else {
63
+ const indexTsContent = `/**
34
64
  * ${modName}
35
65
  * Created with MooModding Developer CLI
36
66
  * Entry point: src/index.ts
@@ -47,7 +77,8 @@ if (typeof window !== "undefined") {
47
77
  console.log("[${modName}] Ready.");
48
78
  }
49
79
  `;
50
- fs.writeFileSync(path.join(srcDir, "index.ts"), indexTsContent, "utf-8");
80
+ fs.writeFileSync(path.join(srcDir, "index.ts"), indexTsContent, "utf-8");
81
+ }
51
82
  // 3. Create .mooignore
52
83
  const mooIgnoreContent = `# MooModding CLI Ignore List
53
84
  node_modules/
@@ -68,14 +99,15 @@ MooMoo.io mod - Built with MooModding.io developer tools.
68
99
 
69
100
  ## Commands
70
101
 
71
- - \`moo push\`: Push files to MooModding cloud storage.
72
102
  - \`moo dev\`: Start watcher mode (auto-sync on save).
103
+ - \`moo push\`: Push files to MooModding cloud workspace.
73
104
  - \`moo pull\`: Pull latest files from cloud.
105
+ ${isCommunity ? "- `moo publish [patch|minor|major]`: Publish release to Community Gallery.\n" : ""}
74
106
  `;
75
107
  fs.writeFileSync(path.join(dir, "README.md"), readmeContent, "utf-8");
76
108
  console.log(pc.green(`[success] Mod project scaffolded successfully.`));
77
109
  console.log(pc.gray(`Directory: ${dir}`));
78
110
  console.log(pc.gray(`Config: mod.json`));
79
- console.log(pc.gray(`Entry point: src/index.ts`));
111
+ console.log(pc.gray(`Entry point: ${entryPoint}`));
80
112
  console.log(pc.gray(`Next steps:\n ${targetDirName ? `cd ${targetDirName}\n ` : ""}moo dev\n`));
81
113
  }
@@ -0,0 +1,11 @@
1
+ export interface PublishOptions {
2
+ changelog?: string;
3
+ message?: string;
4
+ status?: "active" | "unlisted" | "archived";
5
+ description?: string;
6
+ desc?: string;
7
+ youtube?: string;
8
+ yes?: boolean;
9
+ rootDir?: string;
10
+ }
11
+ export declare function publishCommand(versionArg?: string, options?: PublishOptions): Promise<boolean>;
@@ -0,0 +1,144 @@
1
+ import fs from "fs";
2
+ import path from "path";
3
+ import readline from "readline";
4
+ import pc from "picocolors";
5
+ import { scanModDirectory } from "../core/scanner.js";
6
+ import { api } from "../core/client.js";
7
+ /**
8
+ * Calculates incremented semver given a base version and bump type.
9
+ */
10
+ function bumpSemver(version, type) {
11
+ const cleanVer = version.replace(/^v/, "");
12
+ const parts = cleanVer.split(".").map(p => parseInt(p, 10) || 0);
13
+ while (parts.length < 3)
14
+ parts.push(0);
15
+ let [major, minor, patch] = parts;
16
+ if (type === "major") {
17
+ major++;
18
+ minor = 0;
19
+ patch = 0;
20
+ }
21
+ else if (type === "minor") {
22
+ minor++;
23
+ patch = 0;
24
+ }
25
+ else {
26
+ patch++;
27
+ }
28
+ return `${major}.${minor}.${patch}`;
29
+ }
30
+ function promptConfirm(question) {
31
+ const rl = readline.createInterface({
32
+ input: process.stdin,
33
+ output: process.stdout
34
+ });
35
+ return new Promise(resolve => {
36
+ rl.question(question, answer => {
37
+ rl.close();
38
+ const normalized = answer.trim().toLowerCase();
39
+ resolve(normalized === "y" || normalized === "yes" || normalized === "");
40
+ });
41
+ });
42
+ }
43
+ export async function publishCommand(versionArg, options = {}) {
44
+ const rootDir = options.rootDir || process.cwd();
45
+ const modConfigPath = path.join(rootDir, "mod.json");
46
+ if (!fs.existsSync(modConfigPath)) {
47
+ console.log(pc.red("[error] 'mod.json' not found."));
48
+ console.log(pc.gray(`Run 'moo init' to scaffold a project or navigate to your mod directory.`));
49
+ return false;
50
+ }
51
+ let modConfig;
52
+ try {
53
+ modConfig = JSON.parse(fs.readFileSync(modConfigPath, "utf-8"));
54
+ }
55
+ catch {
56
+ console.log(pc.red("[error] 'mod.json' is not valid JSON."));
57
+ return false;
58
+ }
59
+ const currentVersion = (modConfig.version || "1.0.0").trim();
60
+ let targetVersion = currentVersion;
61
+ if (versionArg) {
62
+ const lowerArg = versionArg.toLowerCase();
63
+ if (lowerArg === "patch" || lowerArg === "minor" || lowerArg === "major") {
64
+ targetVersion = bumpSemver(currentVersion, lowerArg);
65
+ }
66
+ else {
67
+ targetVersion = versionArg.replace(/^v/, "");
68
+ }
69
+ }
70
+ // Validate semver format
71
+ if (!/^[0-9]+\.[0-9]+(\.[0-9]+)?(-[a-zA-Z0-9.]+)?$/.test(targetVersion)) {
72
+ console.log(pc.red(`[error] Invalid semver version: '${targetVersion}'. Use format like 1.0.0 or bump keyword (patch, minor, major).`));
73
+ return false;
74
+ }
75
+ const modName = modConfig.name || path.basename(rootDir);
76
+ const modSlug = modConfig.slug || path.basename(rootDir).toLowerCase().replace(/[^a-z0-9_-]/g, "-");
77
+ const changelog = (options.message || options.changelog || `Release v${targetVersion} via CLI`).trim();
78
+ const status = options.status || modConfig.status || "active";
79
+ const description = options.desc || options.description || modConfig.description || "";
80
+ const youtube = options.youtube || modConfig.youtube_url || null;
81
+ console.log(pc.cyan(`[publish] Preparing release for '${modName}'...`));
82
+ console.log(pc.gray(`Current version: v${currentVersion}`));
83
+ console.log(pc.yellow(`Release version: v${targetVersion}`));
84
+ console.log(pc.gray(`Status: ${status}`));
85
+ console.log(pc.gray(`Changelog: ${changelog}`));
86
+ // Scan files
87
+ const { files, fileCount, totalBytes } = scanModDirectory(rootDir);
88
+ if (fileCount === 0) {
89
+ console.log(pc.red("[error] No source files found to publish."));
90
+ return false;
91
+ }
92
+ const totalMb = totalBytes / (1024 * 1024);
93
+ if (totalMb > 15) {
94
+ console.log(pc.red(`[error] Release payload (${totalMb.toFixed(1)} MB) exceeds 15 MB limit.`));
95
+ return false;
96
+ }
97
+ console.log(pc.gray(`Scanning complete: ${fileCount} files (${(totalBytes / 1024).toFixed(1)} KB)`));
98
+ if (!options.yes) {
99
+ const confirmed = await promptConfirm(`Publish "${modName}" v${targetVersion} to Community Gallery? [Y/n]: `);
100
+ if (!confirmed) {
101
+ console.log(pc.gray("[cancelled] Publish aborted by user."));
102
+ return false;
103
+ }
104
+ }
105
+ console.log(pc.cyan(`[publish] Uploading release package to MooModding repository...`));
106
+ try {
107
+ const payload = {
108
+ name: modName,
109
+ slug: modSlug,
110
+ version: targetVersion,
111
+ changelog: changelog,
112
+ description: description,
113
+ type: modConfig.type || "hook",
114
+ entry_point: modConfig.entry || "src/index.ts",
115
+ status: status,
116
+ youtube_url: youtube,
117
+ files: files
118
+ };
119
+ const res = await api.post("/api/developer/mods/publish", payload);
120
+ if (res.success && res.release) {
121
+ // Update mod.json with the published version and status
122
+ modConfig.version = targetVersion;
123
+ modConfig.community = true;
124
+ if (description)
125
+ modConfig.description = description;
126
+ if (status)
127
+ modConfig.status = status;
128
+ fs.writeFileSync(modConfigPath, JSON.stringify(modConfig, null, 2), "utf-8");
129
+ console.log(pc.green(`\n[success] v${targetVersion} published successfully to Community Gallery!`));
130
+ console.log(pc.gray(`Author: @${res.release.author}`));
131
+ console.log(pc.gray(`Status: ${res.release.status}`));
132
+ console.log(pc.cyan(`Web URL: ${res.release.web_url}\n`));
133
+ return true;
134
+ }
135
+ else {
136
+ console.log(pc.red(`[error] Publish failed: ${res.message || "Unknown error"}`));
137
+ return false;
138
+ }
139
+ }
140
+ catch (err) {
141
+ console.log(pc.red(`[error] Publish request failed: ${err.message}`));
142
+ return false;
143
+ }
144
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "moomodding",
3
- "version": "1.0.3",
3
+ "version": "1.1.1",
4
4
  "description": "Official MooModding.io Developer CLI & Game SDK - Build, test, and sync MooMoo.io mods seamlessly.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",