moomodding 1.1.1 → 2.0.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/dist/cli.js CHANGED
@@ -9,12 +9,16 @@ import { pushCommand } from "./commands/push.js";
9
9
  import { pullCommand } from "./commands/pull.js";
10
10
  import { devCommand } from "./commands/dev.js";
11
11
  import { publishCommand } from "./commands/publish.js";
12
+ import { settingsCommand } from "./commands/settings.js";
13
+ import { toggleCommand, deleteCommand } from "./commands/manage.js";
14
+ import { depsCommand } from "./commands/deps.js";
15
+ import { communityCommand } from "./commands/community.js";
12
16
  import { clearAuth, loadConfig, saveConfig } from "./core/config.js";
13
17
  const program = new Command();
14
18
  program
15
19
  .name("moo")
16
20
  .description("MooModding Developer CLI — Build, test, and sync MooMoo.io mods with zero friction.")
17
- .version("1.1.1");
21
+ .version("2.0.1");
18
22
  // 1. Auth Commands
19
23
  program
20
24
  .command("login [token]")
@@ -35,7 +39,7 @@ program
35
39
  .action(async () => {
36
40
  await whoamiCommand();
37
41
  });
38
- // 2. Project Lifecycle Commands
42
+ // 2. Project Lifecycle & Studio Commands
39
43
  program
40
44
  .command("init [dir]")
41
45
  .description("Scaffold a new MooMoo mod project")
@@ -50,9 +54,12 @@ program
50
54
  program
51
55
  .command("list")
52
56
  .alias("ls")
53
- .description("List your cloud mods and storage usage")
54
- .action(async () => {
55
- await listCommand();
57
+ .alias("studio")
58
+ .description("List your Studio projects and storage usage")
59
+ .option("--studio", "Show only private Studio projects")
60
+ .option("--community", "Show only Community-linked projects")
61
+ .action(async (options) => {
62
+ await listCommand(options);
56
63
  });
57
64
  program
58
65
  .command("clone <target> [dir]")
@@ -62,13 +69,13 @@ program
62
69
  });
63
70
  program
64
71
  .command("push")
65
- .description("Scan directory and push mod files to cloud")
72
+ .description("Scan directory and push mod files & Studio metadata to cloud")
66
73
  .action(async () => {
67
74
  await pushCommand();
68
75
  });
69
76
  program
70
77
  .command("pull")
71
- .description("Pull latest mod files from cloud")
78
+ .description("Pull latest mod files & Studio metadata from cloud")
72
79
  .action(async () => {
73
80
  await pullCommand();
74
81
  });
@@ -91,7 +98,51 @@ program
91
98
  .action(async (version, options) => {
92
99
  await publishCommand(version, options);
93
100
  });
94
- // 3. Configuration command
101
+ program
102
+ .command("settings [slug]")
103
+ .description("Update Studio & Community settings for a project")
104
+ .option("-n, --name <name>", "Project display name")
105
+ .option("--new-slug <slug>", "Rename project slug")
106
+ .option("-t, --type <type>", "Mod type ('hook', 'bundle_replacement', 'html_replacement')")
107
+ .option("-d, --desc <desc>", "Project description")
108
+ .option("--status <status>", "Community status ('active', 'unlisted', 'archived')")
109
+ .option("--youtube <url>", "YouTube video URL")
110
+ .option("--active <bool>", "Set active state (true|false)")
111
+ .option("--community <bool>", "Set community visibility flag (true|false)")
112
+ .action(async (slug, options) => {
113
+ await settingsCommand(slug, options);
114
+ });
115
+ program
116
+ .command("toggle [slug]")
117
+ .description("Toggle active/inactive state of a Studio project")
118
+ .action(async (slug) => {
119
+ await toggleCommand(slug);
120
+ });
121
+ program
122
+ .command("delete [slug]")
123
+ .description("Permanently delete a Studio project from cloud")
124
+ .option("-y, --yes", "Skip confirmation prompt")
125
+ .action(async (slug, options) => {
126
+ await deleteCommand(slug, options);
127
+ });
128
+ program
129
+ .command("deps <action> [target]")
130
+ .description("Manage mod dependencies in mod.json (list, add, remove)")
131
+ .option("-o, --order <order>", "Execution order ('pre', 'base', 'post')", "pre")
132
+ .option("-v, --ver <version>", "Target version", "1.0.0")
133
+ .action((action, target, options) => {
134
+ depsCommand(action, target, options);
135
+ });
136
+ // 3. Community Gallery Commands
137
+ program
138
+ .command("community <action> [target]")
139
+ .alias("comm")
140
+ .description("Interact with Community Gallery (search, installed, install, uninstall, fork)")
141
+ .option("-t, --type <type>", "Filter search by mod type")
142
+ .action(async (action, target, options) => {
143
+ await communityCommand(action, target, options);
144
+ });
145
+ // 4. Configuration Command
95
146
  program
96
147
  .command("config <action> [key] [value]")
97
148
  .description("View or update CLI config (e.g. moo config set api https://moomodding.io)")
@@ -91,8 +91,10 @@ export async function cloneCommand(modSlug, targetDirName) {
91
91
  type: modInfo.type || "hook",
92
92
  version: modInfo.version || "1.0.0",
93
93
  entry: modInfo.entry_point || "src/index.ts",
94
+ description: modInfo.description || "",
94
95
  is_active: modInfo.is_active ?? true,
95
- community: modInfo.community ?? false,
96
+ community: modInfo.is_community ?? modInfo.community ?? false,
97
+ requirements: Array.isArray(modInfo.requirements) ? modInfo.requirements : [],
96
98
  forked_from: modInfo.forked_from || undefined
97
99
  };
98
100
  fs.writeFileSync(path.join(destDir, "mod.json"), JSON.stringify(modJson, null, 2), "utf-8");
@@ -0,0 +1,3 @@
1
+ export declare function communityCommand(action?: string, target?: string, options?: {
2
+ type?: string;
3
+ }): Promise<void>;
@@ -0,0 +1,82 @@
1
+ import pc from "picocolors";
2
+ import { api } from "../core/client.js";
3
+ function parseAuthorSlug(target) {
4
+ if (!target)
5
+ return null;
6
+ const clean = target.trim().replace(/^@/, "");
7
+ const parts = clean.split("/");
8
+ if (parts.length !== 2 || !parts[0] || !parts[1])
9
+ return null;
10
+ return { author: parts[0], slug: parts[1] };
11
+ }
12
+ export async function communityCommand(action = "search", target, options = {}) {
13
+ const act = action.toLowerCase();
14
+ try {
15
+ if (act === "search" || act === "list" || act === "ls") {
16
+ const params = new URLSearchParams({ mode: "search" });
17
+ if (target)
18
+ params.set("q", target);
19
+ if (options.type)
20
+ params.set("type", options.type);
21
+ const res = await api.get(`/api/developer/community/list?${params.toString()}`);
22
+ if (!res.success || !res.mods || res.mods.length === 0) {
23
+ console.log(pc.yellow("[info] No matching community mods found."));
24
+ return;
25
+ }
26
+ console.log(pc.bold(pc.cyan("\nCommunity Gallery Mods")));
27
+ console.log(pc.gray("─".repeat(76)));
28
+ for (const m of res.mods) {
29
+ console.log(` ${pc.bold(m.name)} ${pc.gray(`(@${m.author}/${m.slug})`)} | ${m.type} | v${m.latest_version} | ${m.downloads_count} dl`);
30
+ }
31
+ console.log(pc.gray("─".repeat(76)));
32
+ console.log(pc.gray("Install: moo community install @author/slug | Fork: moo community fork @author/slug\n"));
33
+ return;
34
+ }
35
+ if (act === "installed") {
36
+ const res = await api.get("/api/developer/community/list?mode=installed");
37
+ if (!res.success || !res.mods || res.mods.length === 0) {
38
+ console.log(pc.yellow("[info] You have no installed community mods."));
39
+ return;
40
+ }
41
+ console.log(pc.bold(pc.cyan("\nInstalled Community Mods")));
42
+ console.log(pc.gray("─".repeat(72)));
43
+ for (const m of res.mods) {
44
+ console.log(` ${pc.bold(m.name)} ${pc.cyan(`@${m.author}/${m.slug}`)} | target: ${m.version_target} (latest v${m.latest_version})`);
45
+ }
46
+ console.log("");
47
+ return;
48
+ }
49
+ const parsed = parseAuthorSlug(target);
50
+ if (!parsed) {
51
+ console.log(pc.red(`[error] Target must be in '@author/slug' format. Example: moo community ${act} @author/slug`));
52
+ return;
53
+ }
54
+ if (act === "install") {
55
+ const res = await api.post(`/api/developer/community/${encodeURIComponent(parsed.author)}/${encodeURIComponent(parsed.slug)}/install`, {});
56
+ console.log(res.success ? pc.green(`[success] ${res.message}`) : pc.red(`[error] ${res.message}`));
57
+ return;
58
+ }
59
+ if (act === "uninstall" || act === "remove") {
60
+ const res = await api.post(`/api/developer/community/${encodeURIComponent(parsed.author)}/${encodeURIComponent(parsed.slug)}/uninstall`, {});
61
+ console.log(res.success ? pc.green(`[success] ${res.message}`) : pc.red(`[error] ${res.message}`));
62
+ return;
63
+ }
64
+ if (act === "fork") {
65
+ const res = await api.post(`/api/developer/community/${encodeURIComponent(parsed.author)}/${encodeURIComponent(parsed.slug)}/fork`, {});
66
+ if (res.success) {
67
+ console.log(pc.green(`[success] ${res.message}`));
68
+ if (res.project?.slug) {
69
+ console.log(pc.cyan(`Clone locally: moo clone ${res.project.slug}`));
70
+ }
71
+ }
72
+ else {
73
+ console.log(pc.red(`[error] ${res.message}`));
74
+ }
75
+ return;
76
+ }
77
+ console.log(pc.red("[error] Unknown action. Use: search, installed, install, uninstall, fork"));
78
+ }
79
+ catch (err) {
80
+ console.log(pc.red(`[error] Community command failed: ${err.message}`));
81
+ }
82
+ }
@@ -0,0 +1,5 @@
1
+ export interface DepsOptions {
2
+ order?: "pre" | "base" | "post";
3
+ ver?: string;
4
+ }
5
+ export declare function depsCommand(action?: string, target?: string, options?: DepsOptions): void;
@@ -0,0 +1,90 @@
1
+ import fs from "fs";
2
+ import path from "path";
3
+ import pc from "picocolors";
4
+ export function depsCommand(action = "list", target, options = {}) {
5
+ const modConfigPath = path.join(process.cwd(), "mod.json");
6
+ if (!fs.existsSync(modConfigPath)) {
7
+ console.log(pc.red("[error] 'mod.json' not found in current directory."));
8
+ return;
9
+ }
10
+ let modConfig;
11
+ try {
12
+ modConfig = JSON.parse(fs.readFileSync(modConfigPath, "utf-8"));
13
+ }
14
+ catch {
15
+ console.log(pc.red("[error] 'mod.json' is not valid JSON."));
16
+ return;
17
+ }
18
+ if (!Array.isArray(modConfig.requirements)) {
19
+ modConfig.requirements = [];
20
+ }
21
+ const act = action.toLowerCase();
22
+ if (act === "list" || act === "ls") {
23
+ if (modConfig.requirements.length === 0) {
24
+ console.log(pc.yellow("[info] No dependencies configured in mod.json."));
25
+ return;
26
+ }
27
+ console.log(pc.bold(pc.cyan(`\nDependencies for '${modConfig.name}':`)));
28
+ for (const dep of modConfig.requirements) {
29
+ const label = dep.author ? `@${dep.author}/${dep.slug}` : dep.slug;
30
+ console.log(` - ${pc.cyan(label)} (v${dep.version || "1.0.0"}, order: ${dep.order || "pre"})`);
31
+ }
32
+ console.log("");
33
+ return;
34
+ }
35
+ if (act === "add") {
36
+ if (!target) {
37
+ console.log(pc.red("[error] Usage: moo deps add <@author/slug|slug> [--order pre|base|post] [--ver 1.0.0]"));
38
+ return;
39
+ }
40
+ let author;
41
+ let slug = target.trim();
42
+ let source = "studio";
43
+ if (slug.startsWith("@") && slug.includes("/")) {
44
+ const parts = slug.slice(1).split("/");
45
+ author = parts[0];
46
+ slug = parts[1];
47
+ source = "community";
48
+ }
49
+ else if (slug.includes("/")) {
50
+ const parts = slug.split("/");
51
+ author = parts[0];
52
+ slug = parts[1];
53
+ source = "community";
54
+ }
55
+ const existingIdx = modConfig.requirements.findIndex((r) => r.slug === slug && (!author || r.author === author));
56
+ const entry = {
57
+ slug,
58
+ ...(author ? { author } : {}),
59
+ version: options.ver || "1.0.0",
60
+ order: options.order || "pre",
61
+ source
62
+ };
63
+ if (existingIdx >= 0) {
64
+ modConfig.requirements[existingIdx] = entry;
65
+ }
66
+ else {
67
+ modConfig.requirements.push(entry);
68
+ }
69
+ fs.writeFileSync(modConfigPath, JSON.stringify(modConfig, null, 2), "utf-8");
70
+ console.log(pc.green(`[success] Added dependency '${author ? `@${author}/${slug}` : slug}' (order: ${entry.order}). Run 'moo push' to sync.`));
71
+ return;
72
+ }
73
+ if (act === "remove" || act === "rm" || act === "del") {
74
+ if (!target) {
75
+ console.log(pc.red("[error] Usage: moo deps remove <slug>"));
76
+ return;
77
+ }
78
+ const cleanTarget = target.includes("/") ? target.split("/").pop() : target;
79
+ const before = modConfig.requirements.length;
80
+ modConfig.requirements = modConfig.requirements.filter((r) => r.slug !== cleanTarget);
81
+ if (modConfig.requirements.length === before) {
82
+ console.log(pc.yellow(`[warn] Dependency '${cleanTarget}' not found.`));
83
+ return;
84
+ }
85
+ fs.writeFileSync(modConfigPath, JSON.stringify(modConfig, null, 2), "utf-8");
86
+ console.log(pc.green(`[success] Removed dependency '${cleanTarget}'. Run 'moo push' to sync.`));
87
+ return;
88
+ }
89
+ console.log(pc.red("[error] Invalid action. Usage: moo deps <list|add|remove>"));
90
+ }
@@ -1 +1,5 @@
1
- export declare function listCommand(): Promise<void>;
1
+ export interface ListOptions {
2
+ studio?: boolean;
3
+ community?: boolean;
4
+ }
5
+ export declare function listCommand(options?: ListOptions): Promise<void>;
@@ -1,26 +1,40 @@
1
1
  import pc from "picocolors";
2
2
  import { api } from "../core/client.js";
3
- export async function listCommand() {
3
+ export async function listCommand(options = {}) {
4
4
  try {
5
- console.log(pc.bold(pc.cyan("\nMooModding Cloud Mods")));
6
- console.log(pc.gray("Fetching mod list...\n"));
5
+ console.log(pc.bold(pc.cyan("\nMooModding Studio Projects")));
6
+ console.log(pc.gray("Fetching project list...\n"));
7
7
  const res = await api.get("/api/developer/mods/list");
8
8
  if (!res.success || !res.mods || res.mods.length === 0) {
9
- console.log(pc.yellow("[info] You have no saved mods yet."));
9
+ console.log(pc.yellow("[info] You have no saved Studio projects yet."));
10
10
  console.log(pc.gray(`Scaffold a new mod: ${pc.cyan("moo init <mod-name>")}\n`));
11
11
  return;
12
12
  }
13
- console.log(pc.bold(` ${"NAME".padEnd(28)} ${"TYPE".padEnd(14)} ${"SIZE".padEnd(10)} ${"STATUS".padEnd(10)} ${"VERSION"}`));
14
- console.log(pc.gray("─".repeat(70)));
15
- for (const m of res.mods) {
13
+ let mods = res.mods;
14
+ if (options.studio) {
15
+ mods = mods.filter(m => !m.is_community);
16
+ }
17
+ else if (options.community) {
18
+ mods = mods.filter(m => Boolean(m.is_community));
19
+ }
20
+ if (mods.length === 0) {
21
+ console.log(pc.yellow("[info] No projects match the selected filter.\n"));
22
+ return;
23
+ }
24
+ console.log(pc.bold(` ${"NAME".padEnd(26)} ${"TYPE".padEnd(10)} ${"SCOPE".padEnd(11)} ${"SIZE".padEnd(9)} ${"STATUS".padEnd(10)} ${"VER"}`));
25
+ console.log(pc.gray("─".repeat(82)));
26
+ for (const m of mods) {
16
27
  const kb = (m.storage_size_bytes / 1024).toFixed(1) + " KB";
17
28
  const status = m.is_active ? pc.green("active") : pc.gray("inactive");
18
29
  const slug = pc.cyan(m.slug);
19
- const type = m.type === "bundle_replacement" ? "bundle" : "hook";
20
- console.log(` ${m.name.padEnd(28)} ${type.padEnd(14)} ${kb.padEnd(10)} ${status.padEnd(18)} v${m.version || "1.0.0"}`);
21
- console.log(pc.gray(` ↳ slug: ${slug} (${m.file_count || 1} files)`));
30
+ const type = m.type === "bundle_replacement" ? "bundle" : m.type === "html_replacement" ? "html" : "hook";
31
+ const scope = m.is_community ? pc.magenta("community") : pc.blue("studio");
32
+ const depsCount = Array.isArray(m.requirements) ? m.requirements.length : 0;
33
+ const commInfo = m.community_status ? ` | gallery:${m.community_status} (${m.downloads_count || 0} dl)` : "";
34
+ console.log(` ${m.name.slice(0, 25).padEnd(26)} ${type.padEnd(10)} ${scope.padEnd(20)} ${kb.padEnd(9)} ${status.padEnd(19)} v${m.version || "1.0.0"}`);
35
+ console.log(pc.gray(` -> slug: ${slug} | deps: ${depsCount}${commInfo}`));
22
36
  }
23
- console.log(pc.gray("─".repeat(70)));
37
+ console.log(pc.gray("─".repeat(82)));
24
38
  if (res.quota) {
25
39
  const usedMb = (res.quota.used_bytes / (1024 * 1024)).toFixed(2);
26
40
  const maxMb = (res.quota.max_bytes / (1024 * 1024)).toFixed(0);
@@ -29,6 +43,6 @@ export async function listCommand() {
29
43
  console.log(pc.gray(`Clone into local folder: ${pc.cyan("moo clone <slug>")}\n`));
30
44
  }
31
45
  catch (err) {
32
- console.log(pc.red(`[error] Failed to list mods: ${err.message}`));
46
+ console.log(pc.red(`[error] Failed to list projects: ${err.message}`));
33
47
  }
34
48
  }
@@ -3,56 +3,55 @@ import pc from "picocolors";
3
3
  import { setAuth, getApiUrl } from "../core/config.js";
4
4
  import { api } from "../core/client.js";
5
5
  function askQuestion(query, hideInput = false) {
6
- const rl = readline.createInterface({
7
- input: process.stdin,
8
- output: process.stdout
9
- });
10
- return new Promise((resolve) => {
11
- if (!hideInput) {
6
+ if (!hideInput) {
7
+ const rl = readline.createInterface({
8
+ input: process.stdin,
9
+ output: process.stdout
10
+ });
11
+ return new Promise((resolve) => {
12
12
  rl.question(query, (answer) => {
13
13
  rl.close();
14
14
  resolve(answer.trim());
15
15
  });
16
- }
17
- else {
18
- // Mask password typing
19
- process.stdout.write(query);
20
- const stdin = process.stdin;
21
- let input = "";
22
- const onData = (char) => {
23
- const c = char.toString("utf-8");
24
- switch (c) {
25
- case "\n":
26
- case "\r":
27
- case "\u0004":
28
- stdin.removeListener("data", onData);
29
- if (stdin.isTTY)
30
- stdin.setRawMode(false);
31
- rl.close();
32
- process.stdout.write("\n");
33
- resolve(input.trim());
34
- break;
35
- case "\u0003": // Ctrl+C
36
- process.exit(1);
37
- break;
38
- case "\u007f": // Backspace
39
- case "\b":
40
- if (input.length > 0) {
41
- input = input.slice(0, -1);
42
- process.stdout.write("\b \b");
43
- }
44
- break;
45
- default:
46
- input += c;
47
- process.stdout.write("*");
48
- break;
16
+ });
17
+ }
18
+ return new Promise((resolve) => {
19
+ process.stdout.write(query);
20
+ const stdin = process.stdin;
21
+ let input = "";
22
+ const onData = (buf) => {
23
+ const str = buf.toString("utf-8");
24
+ for (const c of str) {
25
+ if (c === "\n" || c === "\r" || c === "\u0004") {
26
+ stdin.removeListener("data", onData);
27
+ if (stdin.isTTY)
28
+ stdin.setRawMode(false);
29
+ stdin.pause();
30
+ process.stdout.write("\n");
31
+ resolve(input.trim());
32
+ return;
49
33
  }
50
- };
51
- if (stdin.isTTY)
52
- stdin.setRawMode(true);
53
- stdin.resume();
54
- stdin.on("data", onData);
55
- }
34
+ else if (c === "\u0003") {
35
+ if (stdin.isTTY)
36
+ stdin.setRawMode(false);
37
+ process.exit(1);
38
+ }
39
+ else if (c === "\u007f" || c === "\b") {
40
+ if (input.length > 0) {
41
+ input = input.slice(0, -1);
42
+ process.stdout.write("\b \b");
43
+ }
44
+ }
45
+ else if (c >= " ") {
46
+ input += c;
47
+ process.stdout.write("*");
48
+ }
49
+ }
50
+ };
51
+ if (stdin.isTTY)
52
+ stdin.setRawMode(true);
53
+ stdin.resume();
54
+ stdin.on("data", onData);
56
55
  });
57
56
  }
58
57
  export async function loginCommand(explicitToken) {
@@ -0,0 +1,4 @@
1
+ export declare function toggleCommand(slugArg?: string): Promise<void>;
2
+ export declare function deleteCommand(slugArg?: string, options?: {
3
+ yes?: boolean;
4
+ }): Promise<void>;
@@ -0,0 +1,73 @@
1
+ import fs from "fs";
2
+ import path from "path";
3
+ import readline from "readline";
4
+ import pc from "picocolors";
5
+ import { api } from "../core/client.js";
6
+ function resolveSlug(slugArg) {
7
+ if (slugArg)
8
+ return slugArg.trim();
9
+ const modConfigPath = path.join(process.cwd(), "mod.json");
10
+ if (fs.existsSync(modConfigPath)) {
11
+ try {
12
+ const cfg = JSON.parse(fs.readFileSync(modConfigPath, "utf-8"));
13
+ return cfg.slug || null;
14
+ }
15
+ catch {
16
+ return null;
17
+ }
18
+ }
19
+ return null;
20
+ }
21
+ function promptConfirm(question) {
22
+ const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
23
+ return new Promise(resolve => {
24
+ rl.question(question, answer => {
25
+ rl.close();
26
+ const n = answer.trim().toLowerCase();
27
+ resolve(n === "y" || n === "yes");
28
+ });
29
+ });
30
+ }
31
+ export async function toggleCommand(slugArg) {
32
+ const slug = resolveSlug(slugArg);
33
+ if (!slug) {
34
+ console.log(pc.red("[error] Project slug required (provide <slug> or run inside a mod directory)."));
35
+ return;
36
+ }
37
+ try {
38
+ const res = await api.post(`/api/developer/mods/${encodeURIComponent(slug)}/toggle`, {});
39
+ if (!res.success) {
40
+ console.log(pc.red(`[error] Toggle failed: ${res.message || "Unknown error"}`));
41
+ return;
42
+ }
43
+ console.log(pc.green(`[success] ${res.message}`));
44
+ }
45
+ catch (err) {
46
+ console.log(pc.red(`[error] Toggle error: ${err.message}`));
47
+ }
48
+ }
49
+ export async function deleteCommand(slugArg, options = {}) {
50
+ const slug = resolveSlug(slugArg);
51
+ if (!slug) {
52
+ console.log(pc.red("[error] Project slug required."));
53
+ return;
54
+ }
55
+ if (!options.yes) {
56
+ const ok = await promptConfirm(`Are you sure you want to permanently delete cloud project '${slug}'? [y/N]: `);
57
+ if (!ok) {
58
+ console.log(pc.gray("[cancelled] Delete aborted."));
59
+ return;
60
+ }
61
+ }
62
+ try {
63
+ const res = await api.delete(`/api/developer/mods/${encodeURIComponent(slug)}`);
64
+ if (!res.success) {
65
+ console.log(pc.red(`[error] Delete failed: ${res.message || "Unknown error"}`));
66
+ return;
67
+ }
68
+ console.log(pc.green(`[success] ${res.message}`));
69
+ }
70
+ catch (err) {
71
+ console.log(pc.red(`[error] Delete error: ${err.message}`));
72
+ }
73
+ }
@@ -114,6 +114,8 @@ export async function publishCommand(versionArg, options = {}) {
114
114
  entry_point: modConfig.entry || "src/index.ts",
115
115
  status: status,
116
116
  youtube_url: youtube,
117
+ requirements: Array.isArray(modConfig.requirements) ? modConfig.requirements : [],
118
+ readme: files["README.md"] || files["readme.md"] || undefined,
117
119
  files: files
118
120
  };
119
121
  const res = await api.post("/api/developer/mods/publish", payload);
@@ -28,6 +28,24 @@ export async function pullCommand(rootDir = process.cwd()) {
28
28
  console.log(pc.red(`[error] Pull failed: ${res.message || "Unknown error"}`));
29
29
  process.exit(1);
30
30
  }
31
+ if (res.mod) {
32
+ modConfig.name = res.mod.name;
33
+ modConfig.slug = res.mod.slug;
34
+ modConfig.type = res.mod.type;
35
+ modConfig.version = res.mod.version;
36
+ modConfig.entry = res.mod.entry_point;
37
+ modConfig.is_active = res.mod.is_active;
38
+ modConfig.community = res.mod.is_community ?? false;
39
+ if (res.mod.description !== undefined)
40
+ modConfig.description = res.mod.description;
41
+ if (res.mod.requirements)
42
+ modConfig.requirements = res.mod.requirements;
43
+ if (res.mod.status)
44
+ modConfig.status = res.mod.status;
45
+ if (res.mod.youtube_url)
46
+ modConfig.youtube_url = res.mod.youtube_url;
47
+ fs.writeFileSync(modConfigPath, JSON.stringify(modConfig, null, 2), "utf-8");
48
+ }
31
49
  let updatedCount = 0;
32
50
  for (const [relPath, content] of Object.entries(res.files)) {
33
51
  if (typeof content !== "string")
@@ -48,10 +48,13 @@ export async function pushCommand(options = {}) {
48
48
  const payload = {
49
49
  name: modConfig.name || path.basename(rootDir),
50
50
  slug: modConfig.slug,
51
+ description: modConfig.description || "",
51
52
  type: modConfig.type || "hook",
52
53
  version: modConfig.version || "1.0.0",
53
54
  entry_point: modConfig.entry || "src/index.ts",
54
55
  is_active: modConfig.is_active ?? true,
56
+ is_community: modConfig.is_community ?? modConfig.community ?? false,
57
+ requirements: Array.isArray(modConfig.requirements) ? modConfig.requirements : [],
55
58
  files: files
56
59
  };
57
60
  const res = await api.post("/api/developer/mods/sync", payload);
@@ -0,0 +1,11 @@
1
+ export interface SettingsOptions {
2
+ name?: string;
3
+ newSlug?: string;
4
+ type?: "hook" | "bundle_replacement" | "html_replacement";
5
+ desc?: string;
6
+ status?: "active" | "unlisted" | "archived";
7
+ youtube?: string;
8
+ active?: string;
9
+ community?: string;
10
+ }
11
+ export declare function settingsCommand(slugArg?: string, options?: SettingsOptions): Promise<void>;
@@ -0,0 +1,70 @@
1
+ import fs from "fs";
2
+ import path from "path";
3
+ import pc from "picocolors";
4
+ import { api } from "../core/client.js";
5
+ export async function settingsCommand(slugArg, options = {}) {
6
+ const modConfigPath = path.join(process.cwd(), "mod.json");
7
+ let modConfig = null;
8
+ if (fs.existsSync(modConfigPath)) {
9
+ try {
10
+ modConfig = JSON.parse(fs.readFileSync(modConfigPath, "utf-8"));
11
+ }
12
+ catch {
13
+ modConfig = null;
14
+ }
15
+ }
16
+ const slug = slugArg || modConfig?.slug;
17
+ if (!slug) {
18
+ console.log(pc.red("[error] Project slug required (provide <slug> or run inside a mod directory with mod.json)."));
19
+ return;
20
+ }
21
+ const payload = {};
22
+ if (options.name !== undefined)
23
+ payload.name = options.name;
24
+ if (options.newSlug !== undefined)
25
+ payload.new_slug = options.newSlug;
26
+ if (options.type !== undefined)
27
+ payload.type = options.type;
28
+ if (options.desc !== undefined)
29
+ payload.description = options.desc;
30
+ if (options.status !== undefined)
31
+ payload.status = options.status;
32
+ if (options.youtube !== undefined)
33
+ payload.youtube_url = options.youtube;
34
+ if (options.active !== undefined)
35
+ payload.is_active = options.active === "true" || options.active === "1";
36
+ if (options.community !== undefined)
37
+ payload.is_community = options.community === "true" || options.community === "1";
38
+ if (Object.keys(payload).length === 0) {
39
+ console.log(pc.yellow("[info] No settings flags provided."));
40
+ console.log(pc.gray("Example: moo settings my-mod --name \"New Name\" --status active --desc \"Updated\""));
41
+ return;
42
+ }
43
+ try {
44
+ const res = await api.post(`/api/developer/mods/${encodeURIComponent(slug)}/settings`, payload);
45
+ if (!res.success) {
46
+ console.log(pc.red(`[error] Failed to update settings: ${res.message || "Unknown error"}`));
47
+ return;
48
+ }
49
+ if (modConfig && res.mod && (!slugArg || slugArg === modConfig.slug)) {
50
+ modConfig.name = res.mod.name;
51
+ modConfig.slug = res.mod.slug;
52
+ modConfig.type = res.mod.type;
53
+ modConfig.description = res.mod.description;
54
+ modConfig.is_active = res.mod.is_active;
55
+ modConfig.community = res.mod.is_community;
56
+ if (res.mod.status)
57
+ modConfig.status = res.mod.status;
58
+ if (res.mod.youtube_url !== undefined)
59
+ modConfig.youtube_url = res.mod.youtube_url;
60
+ fs.writeFileSync(modConfigPath, JSON.stringify(modConfig, null, 2), "utf-8");
61
+ }
62
+ console.log(pc.green(`[success] ${res.message || "Project settings updated."}`));
63
+ if (res.mod) {
64
+ console.log(pc.gray(`Slug: ${res.mod.slug} | Active: ${res.mod.is_active} | Community: ${res.mod.is_community}`));
65
+ }
66
+ }
67
+ catch (err) {
68
+ console.log(pc.red(`[error] Settings error: ${err.message}`));
69
+ }
70
+ }
@@ -43,6 +43,26 @@ export interface Hat {
43
43
  readonly noEat?: boolean;
44
44
  readonly invisTimer?: number;
45
45
  }
46
+ export interface ModRequirement {
47
+ slug: string;
48
+ author?: string;
49
+ version?: string;
50
+ order?: "pre" | "base" | "post";
51
+ source?: "community" | "studio";
52
+ }
53
+ export interface ModConfig {
54
+ name: string;
55
+ slug: string;
56
+ type: "hook" | "bundle_replacement" | "html_replacement";
57
+ version: string;
58
+ entry: string;
59
+ description?: string;
60
+ is_active?: boolean;
61
+ community?: boolean;
62
+ status?: "active" | "unlisted" | "archived";
63
+ youtube_url?: string | null;
64
+ requirements?: ModRequirement[];
65
+ }
46
66
  export interface Accessory {
47
67
  readonly id: number;
48
68
  readonly name: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "moomodding",
3
- "version": "1.1.1",
3
+ "version": "2.0.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",