@fmode/studio 0.0.8 → 0.0.10
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/bin/fmode.js +85 -107
- package/cli.js +84 -106
- package/package.json +4 -2
package/bin/fmode.js
CHANGED
|
@@ -553,7 +553,7 @@ async function getLocalServerVersion2(executablePath) {
|
|
|
553
553
|
});
|
|
554
554
|
}
|
|
555
555
|
async function run8(args) {
|
|
556
|
-
|
|
556
|
+
var rootDir6 = _pkgRoot;
|
|
557
557
|
const cliVersion = await getLocalVersion(rootDir6);
|
|
558
558
|
console.log("Fmode CLI Version Information:");
|
|
559
559
|
console.log("==============================");
|
|
@@ -643,6 +643,7 @@ var init_server = __esm(() => {
|
|
|
643
643
|
});
|
|
644
644
|
|
|
645
645
|
// cli/index.ts
|
|
646
|
+
import { Command } from "commander";
|
|
646
647
|
import { fileURLToPath as fileURLToPath7 } from "url";
|
|
647
648
|
import { dirname as dirname7 } from "path";
|
|
648
649
|
|
|
@@ -955,124 +956,101 @@ init_repos();
|
|
|
955
956
|
var __filename8 = fileURLToPath7(import.meta.url);
|
|
956
957
|
var __dirname8 = dirname7(__filename8);
|
|
957
958
|
var rootDir6 = _pkgRoot;
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
start Start the Fmode Studio server (default)
|
|
969
|
-
stop Stop the running Fmode Studio server
|
|
970
|
-
log View server logs
|
|
971
|
-
clear Clear cached binary files
|
|
972
|
-
upgrade / update Upgrade to the latest version
|
|
973
|
-
|
|
974
|
-
server Manage fmode-server
|
|
975
|
-
server start Start fmode-server with config.json
|
|
976
|
-
server update Update fmode-server binary
|
|
977
|
-
server version Show CLI and fmode-server version information
|
|
978
|
-
|
|
979
|
-
OPTIONS:
|
|
980
|
-
-p, --port <PORT> Set the server port (default: 16666)
|
|
981
|
-
-h, --host <HOST> Set the server host (default: 0.0.0.0)
|
|
982
|
-
--help Show this help message
|
|
983
|
-
--version, -v Show version information
|
|
984
|
-
|
|
985
|
-
LOG OPTIONS:
|
|
986
|
-
-f, --follow Follow log output (like tail -f)
|
|
987
|
-
-n, --lines <NUM> Number of lines to show (default: 50)
|
|
988
|
-
|
|
989
|
-
EXAMPLES:
|
|
990
|
-
fmode # Start with default settings
|
|
991
|
-
fmode start # Explicitly start the server
|
|
992
|
-
fmode start --port 8080 # Start on port 8080
|
|
993
|
-
fmode --port 8080 # Start on port 8080 (same as above)
|
|
994
|
-
fmode stop # Stop the server
|
|
995
|
-
fmode stop --port 8080 # Stop server on port 8080
|
|
996
|
-
fmode log # Show recent logs
|
|
997
|
-
fmode log -f # Follow logs in real-time
|
|
998
|
-
fmode log -n 100 # Show last 100 log lines
|
|
999
|
-
fmode clear # Clear cached binaries
|
|
1000
|
-
fmode upgrade # Upgrade to latest version
|
|
1001
|
-
fmode server start # Start fmode-server
|
|
1002
|
-
fmode server update # Update fmode-server
|
|
1003
|
-
fmode server version # Show version information
|
|
1004
|
-
|
|
1005
|
-
UPGRADE MECHANISM:
|
|
1006
|
-
The CLI automatically downloads the latest binary from repos.fmode.cn.
|
|
1007
|
-
Use 'fmode upgrade' to manually upgrade.
|
|
1008
|
-
`);
|
|
1009
|
-
}
|
|
1010
|
-
async function showVersion() {
|
|
959
|
+
var program = new Command;
|
|
960
|
+
program.name("fmode").description("Fmode Code UI Server - AI PaaS IDE for Vibe Coding").version(await getVersionString(), "-v, --version", "Show version information").helpOption("-h, --help", "Display help for command").addHelpText("afterAll", `
|
|
961
|
+
Upgrade Mechanism:
|
|
962
|
+
` + ` The CLI automatically downloads the latest binary from repos.fmode.cn.
|
|
963
|
+
` + ` Use "fmode upgrade" to manually upgrade.
|
|
964
|
+
`).configureOutput({
|
|
965
|
+
writeErr: (str) => process.stderr.write(str),
|
|
966
|
+
writeOut: (str) => process.stdout.write(str)
|
|
967
|
+
});
|
|
968
|
+
async function getVersionString() {
|
|
1011
969
|
const localVersion = await getLocalVersion(rootDir6);
|
|
1012
|
-
|
|
1013
|
-
console.log(`@fmode/studio v${localVersion}`);
|
|
1014
|
-
} else {
|
|
1015
|
-
console.log("@fmode/studio (version unknown)");
|
|
1016
|
-
}
|
|
970
|
+
return localVersion ? `@fmode/studio v${localVersion}` : "@fmode/studio (version unknown)";
|
|
1017
971
|
}
|
|
1018
|
-
async
|
|
972
|
+
program.action(async (options, command) => {
|
|
1019
973
|
const args = process.argv.slice(2);
|
|
974
|
+
await run(args);
|
|
975
|
+
});
|
|
976
|
+
program.command("start").description("Start the Fmode Studio server (default command)").option("-p, --port <port>", "Set the server port", "16666").option("-h, --host <host>", "Set the server host", "0.0.0.0").action(async (options) => {
|
|
977
|
+
const args = [];
|
|
978
|
+
if (options.port)
|
|
979
|
+
args.push("--port", options.port);
|
|
980
|
+
if (options.host)
|
|
981
|
+
args.push("--host", options.host);
|
|
982
|
+
await run(args);
|
|
983
|
+
});
|
|
984
|
+
program.command("stop").description("Stop the running Fmode Studio server").option("-p, --port <port>", "Port of the server to stop").action(async (options) => {
|
|
985
|
+
const args = [];
|
|
986
|
+
if (options.port)
|
|
987
|
+
args.push("--port", options.port);
|
|
988
|
+
await run2(args);
|
|
989
|
+
});
|
|
990
|
+
program.command("log").description("View server logs").option("-f, --follow", "Follow log output (like tail -f)", false).option("-n, --lines <number>", "Number of lines to show", "50").action(async (options) => {
|
|
991
|
+
const args = [];
|
|
992
|
+
if (options.follow)
|
|
993
|
+
args.push("-f");
|
|
994
|
+
if (options.lines)
|
|
995
|
+
args.push("-n", options.lines);
|
|
996
|
+
await run3(args);
|
|
997
|
+
});
|
|
998
|
+
program.command("clear").description("Clear cached binary files").action(async () => {
|
|
999
|
+
await run4([]);
|
|
1000
|
+
});
|
|
1001
|
+
program.command("upgrade").alias("update").description("Upgrade to the latest version").action(async () => {
|
|
1002
|
+
await run5([]);
|
|
1003
|
+
});
|
|
1004
|
+
var serverCmd = program.command("server").description("Manage fmode-server");
|
|
1005
|
+
serverCmd.command("start").description("Start fmode-server with config.json").option("--config <path>", "Path to config.json (default: ./config.json)").action(async (options) => {
|
|
1006
|
+
const args = [];
|
|
1007
|
+
if (options.config)
|
|
1008
|
+
args.push("--config", options.config);
|
|
1009
|
+
await run9(["start", ...args]);
|
|
1010
|
+
});
|
|
1011
|
+
serverCmd.command("update").description("Update fmode-server binary").action(async () => {
|
|
1012
|
+
await run9(["update"]);
|
|
1013
|
+
});
|
|
1014
|
+
serverCmd.command("version").alias("-v").alias("-vvv").description("Show CLI and fmode-server version information").action(async () => {
|
|
1015
|
+
await run9(["version"]);
|
|
1016
|
+
});
|
|
1017
|
+
async function main() {
|
|
1018
|
+
const args = process.argv.slice();
|
|
1020
1019
|
const yesIndex = args.indexOf("-y");
|
|
1021
1020
|
if (yesIndex !== -1) {
|
|
1022
1021
|
args.splice(yesIndex, 1);
|
|
1023
1022
|
}
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1023
|
+
await program.parseAsync(args);
|
|
1024
|
+
}
|
|
1025
|
+
async function runCli() {
|
|
1026
|
+
await main();
|
|
1027
|
+
}
|
|
1028
|
+
function isMainModule() {
|
|
1029
|
+
const execPath = process.argv[1];
|
|
1030
|
+
if (!execPath)
|
|
1031
|
+
return false;
|
|
1032
|
+
const modulePath = fileURLToPath7(import.meta.url);
|
|
1033
|
+
const normalizePath = (p) => {
|
|
1034
|
+
if (p.startsWith("file://")) {
|
|
1035
|
+
p = decodeURIComponent(p.slice(7));
|
|
1030
1036
|
}
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
await showHelp2();
|
|
1035
|
-
return;
|
|
1037
|
+
p = p.replace(/\\/g, "/");
|
|
1038
|
+
if (!p.startsWith("/")) {
|
|
1039
|
+
p = "/" + p;
|
|
1036
1040
|
}
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
case "stop":
|
|
1043
|
-
await run2(commandArgs);
|
|
1044
|
-
process.exit(0);
|
|
1045
|
-
break;
|
|
1046
|
-
case "log":
|
|
1047
|
-
await run3(commandArgs);
|
|
1048
|
-
process.exit(0);
|
|
1049
|
-
break;
|
|
1050
|
-
case "clear":
|
|
1051
|
-
await run4(commandArgs);
|
|
1052
|
-
process.exit(0);
|
|
1053
|
-
break;
|
|
1054
|
-
case "upgrade":
|
|
1055
|
-
case "update":
|
|
1056
|
-
await run5(commandArgs);
|
|
1057
|
-
process.exit(0);
|
|
1058
|
-
break;
|
|
1059
|
-
case "server":
|
|
1060
|
-
await run9(commandArgs);
|
|
1061
|
-
break;
|
|
1062
|
-
default:
|
|
1063
|
-
await run(args);
|
|
1064
|
-
break;
|
|
1065
|
-
}
|
|
1041
|
+
return p;
|
|
1042
|
+
};
|
|
1043
|
+
const normalizedExec = normalizePath(execPath);
|
|
1044
|
+
const normalizedModule = normalizePath(modulePath);
|
|
1045
|
+
return normalizedExec === normalizedModule;
|
|
1066
1046
|
}
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
console.error("Fatal error:", error);
|
|
1047
|
+
if (isMainModule()) {
|
|
1048
|
+
main().catch((err) => {
|
|
1049
|
+
console.error("Fatal error:", err);
|
|
1071
1050
|
process.exit(1);
|
|
1072
1051
|
});
|
|
1073
1052
|
}
|
|
1074
1053
|
export {
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
runCli
|
|
1054
|
+
runCli,
|
|
1055
|
+
program
|
|
1078
1056
|
};
|
package/cli.js
CHANGED
|
@@ -631,6 +631,7 @@ var init_server = __esm(() => {
|
|
|
631
631
|
});
|
|
632
632
|
|
|
633
633
|
// cli/index.ts
|
|
634
|
+
import { Command } from "commander";
|
|
634
635
|
import { fileURLToPath as fileURLToPath7 } from "url";
|
|
635
636
|
import { dirname as dirname7 } from "path";
|
|
636
637
|
|
|
@@ -943,124 +944,101 @@ init_repos();
|
|
|
943
944
|
var __filename8 = fileURLToPath7(import.meta.url);
|
|
944
945
|
var __dirname8 = dirname7(__filename8);
|
|
945
946
|
var rootDir6 = dirname7(__dirname8);
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
start Start the Fmode Studio server (default)
|
|
957
|
-
stop Stop the running Fmode Studio server
|
|
958
|
-
log View server logs
|
|
959
|
-
clear Clear cached binary files
|
|
960
|
-
upgrade / update Upgrade to the latest version
|
|
961
|
-
|
|
962
|
-
server Manage fmode-server
|
|
963
|
-
server start Start fmode-server with config.json
|
|
964
|
-
server update Update fmode-server binary
|
|
965
|
-
server version Show CLI and fmode-server version information
|
|
966
|
-
|
|
967
|
-
OPTIONS:
|
|
968
|
-
-p, --port <PORT> Set the server port (default: 16666)
|
|
969
|
-
-h, --host <HOST> Set the server host (default: 0.0.0.0)
|
|
970
|
-
--help Show this help message
|
|
971
|
-
--version, -v Show version information
|
|
972
|
-
|
|
973
|
-
LOG OPTIONS:
|
|
974
|
-
-f, --follow Follow log output (like tail -f)
|
|
975
|
-
-n, --lines <NUM> Number of lines to show (default: 50)
|
|
976
|
-
|
|
977
|
-
EXAMPLES:
|
|
978
|
-
fmode # Start with default settings
|
|
979
|
-
fmode start # Explicitly start the server
|
|
980
|
-
fmode start --port 8080 # Start on port 8080
|
|
981
|
-
fmode --port 8080 # Start on port 8080 (same as above)
|
|
982
|
-
fmode stop # Stop the server
|
|
983
|
-
fmode stop --port 8080 # Stop server on port 8080
|
|
984
|
-
fmode log # Show recent logs
|
|
985
|
-
fmode log -f # Follow logs in real-time
|
|
986
|
-
fmode log -n 100 # Show last 100 log lines
|
|
987
|
-
fmode clear # Clear cached binaries
|
|
988
|
-
fmode upgrade # Upgrade to latest version
|
|
989
|
-
fmode server start # Start fmode-server
|
|
990
|
-
fmode server update # Update fmode-server
|
|
991
|
-
fmode server version # Show version information
|
|
992
|
-
|
|
993
|
-
UPGRADE MECHANISM:
|
|
994
|
-
The CLI automatically downloads the latest binary from repos.fmode.cn.
|
|
995
|
-
Use 'fmode upgrade' to manually upgrade.
|
|
996
|
-
`);
|
|
997
|
-
}
|
|
998
|
-
async function showVersion() {
|
|
947
|
+
var program = new Command;
|
|
948
|
+
program.name("fmode").description("Fmode Code UI Server - AI PaaS IDE for Vibe Coding").version(await getVersionString(), "-v, --version", "Show version information").helpOption("-h, --help", "Display help for command").addHelpText("afterAll", `
|
|
949
|
+
Upgrade Mechanism:
|
|
950
|
+
` + ` The CLI automatically downloads the latest binary from repos.fmode.cn.
|
|
951
|
+
` + ` Use "fmode upgrade" to manually upgrade.
|
|
952
|
+
`).configureOutput({
|
|
953
|
+
writeErr: (str) => process.stderr.write(str),
|
|
954
|
+
writeOut: (str) => process.stdout.write(str)
|
|
955
|
+
});
|
|
956
|
+
async function getVersionString() {
|
|
999
957
|
const localVersion = await getLocalVersion(rootDir6);
|
|
1000
|
-
|
|
1001
|
-
console.log(`@fmode/studio v${localVersion}`);
|
|
1002
|
-
} else {
|
|
1003
|
-
console.log("@fmode/studio (version unknown)");
|
|
1004
|
-
}
|
|
958
|
+
return localVersion ? `@fmode/studio v${localVersion}` : "@fmode/studio (version unknown)";
|
|
1005
959
|
}
|
|
1006
|
-
async
|
|
960
|
+
program.action(async (options, command) => {
|
|
1007
961
|
const args = process.argv.slice(2);
|
|
962
|
+
await run(args);
|
|
963
|
+
});
|
|
964
|
+
program.command("start").description("Start the Fmode Studio server (default command)").option("-p, --port <port>", "Set the server port", "16666").option("-h, --host <host>", "Set the server host", "0.0.0.0").action(async (options) => {
|
|
965
|
+
const args = [];
|
|
966
|
+
if (options.port)
|
|
967
|
+
args.push("--port", options.port);
|
|
968
|
+
if (options.host)
|
|
969
|
+
args.push("--host", options.host);
|
|
970
|
+
await run(args);
|
|
971
|
+
});
|
|
972
|
+
program.command("stop").description("Stop the running Fmode Studio server").option("-p, --port <port>", "Port of the server to stop").action(async (options) => {
|
|
973
|
+
const args = [];
|
|
974
|
+
if (options.port)
|
|
975
|
+
args.push("--port", options.port);
|
|
976
|
+
await run2(args);
|
|
977
|
+
});
|
|
978
|
+
program.command("log").description("View server logs").option("-f, --follow", "Follow log output (like tail -f)", false).option("-n, --lines <number>", "Number of lines to show", "50").action(async (options) => {
|
|
979
|
+
const args = [];
|
|
980
|
+
if (options.follow)
|
|
981
|
+
args.push("-f");
|
|
982
|
+
if (options.lines)
|
|
983
|
+
args.push("-n", options.lines);
|
|
984
|
+
await run3(args);
|
|
985
|
+
});
|
|
986
|
+
program.command("clear").description("Clear cached binary files").action(async () => {
|
|
987
|
+
await run4([]);
|
|
988
|
+
});
|
|
989
|
+
program.command("upgrade").alias("update").description("Upgrade to the latest version").action(async () => {
|
|
990
|
+
await run5([]);
|
|
991
|
+
});
|
|
992
|
+
var serverCmd = program.command("server").description("Manage fmode-server");
|
|
993
|
+
serverCmd.command("start").description("Start fmode-server with config.json").option("--config <path>", "Path to config.json (default: ./config.json)").action(async (options) => {
|
|
994
|
+
const args = [];
|
|
995
|
+
if (options.config)
|
|
996
|
+
args.push("--config", options.config);
|
|
997
|
+
await run9(["start", ...args]);
|
|
998
|
+
});
|
|
999
|
+
serverCmd.command("update").description("Update fmode-server binary").action(async () => {
|
|
1000
|
+
await run9(["update"]);
|
|
1001
|
+
});
|
|
1002
|
+
serverCmd.command("version").alias("-v").alias("-vvv").description("Show CLI and fmode-server version information").action(async () => {
|
|
1003
|
+
await run9(["version"]);
|
|
1004
|
+
});
|
|
1005
|
+
async function main() {
|
|
1006
|
+
const args = process.argv.slice();
|
|
1008
1007
|
const yesIndex = args.indexOf("-y");
|
|
1009
1008
|
if (yesIndex !== -1) {
|
|
1010
1009
|
args.splice(yesIndex, 1);
|
|
1011
1010
|
}
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1011
|
+
await program.parseAsync(args);
|
|
1012
|
+
}
|
|
1013
|
+
async function runCli() {
|
|
1014
|
+
await main();
|
|
1015
|
+
}
|
|
1016
|
+
function isMainModule() {
|
|
1017
|
+
const execPath = process.argv[1];
|
|
1018
|
+
if (!execPath)
|
|
1019
|
+
return false;
|
|
1020
|
+
const modulePath = fileURLToPath7(import.meta.url);
|
|
1021
|
+
const normalizePath = (p) => {
|
|
1022
|
+
if (p.startsWith("file://")) {
|
|
1023
|
+
p = decodeURIComponent(p.slice(7));
|
|
1018
1024
|
}
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
await showHelp2();
|
|
1023
|
-
return;
|
|
1025
|
+
p = p.replace(/\\/g, "/");
|
|
1026
|
+
if (!p.startsWith("/")) {
|
|
1027
|
+
p = "/" + p;
|
|
1024
1028
|
}
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
case "stop":
|
|
1031
|
-
await run2(commandArgs);
|
|
1032
|
-
process.exit(0);
|
|
1033
|
-
break;
|
|
1034
|
-
case "log":
|
|
1035
|
-
await run3(commandArgs);
|
|
1036
|
-
process.exit(0);
|
|
1037
|
-
break;
|
|
1038
|
-
case "clear":
|
|
1039
|
-
await run4(commandArgs);
|
|
1040
|
-
process.exit(0);
|
|
1041
|
-
break;
|
|
1042
|
-
case "upgrade":
|
|
1043
|
-
case "update":
|
|
1044
|
-
await run5(commandArgs);
|
|
1045
|
-
process.exit(0);
|
|
1046
|
-
break;
|
|
1047
|
-
case "server":
|
|
1048
|
-
await run9(commandArgs);
|
|
1049
|
-
break;
|
|
1050
|
-
default:
|
|
1051
|
-
await run(args);
|
|
1052
|
-
break;
|
|
1053
|
-
}
|
|
1029
|
+
return p;
|
|
1030
|
+
};
|
|
1031
|
+
const normalizedExec = normalizePath(execPath);
|
|
1032
|
+
const normalizedModule = normalizePath(modulePath);
|
|
1033
|
+
return normalizedExec === normalizedModule;
|
|
1054
1034
|
}
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
console.error("Fatal error:", error);
|
|
1035
|
+
if (isMainModule()) {
|
|
1036
|
+
main().catch((err) => {
|
|
1037
|
+
console.error("Fatal error:", err);
|
|
1059
1038
|
process.exit(1);
|
|
1060
1039
|
});
|
|
1061
1040
|
}
|
|
1062
1041
|
export {
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
runCli
|
|
1042
|
+
runCli,
|
|
1043
|
+
program
|
|
1066
1044
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fmode/studio",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.10",
|
|
4
4
|
"description": "AI PaaS IDE for Vibe Coding - Cross-platform CLI tool",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"author": "Fmode Studio Team",
|
|
@@ -26,5 +26,7 @@
|
|
|
26
26
|
"x64",
|
|
27
27
|
"arm64"
|
|
28
28
|
],
|
|
29
|
-
"dependencies": {
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"commander": "^14.0.0"
|
|
31
|
+
}
|
|
30
32
|
}
|