@forbocai/test-game 0.6.3 → 0.6.4
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 +20 -1
- package/dist/cli.mjs +20 -1
- package/dist/index.js +20 -1
- package/dist/index.mjs +20 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1847,9 +1847,27 @@ var uiActions = uiSlice.actions;
|
|
|
1847
1847
|
var import_node_child_process = require("child_process");
|
|
1848
1848
|
var import_node_util = require("util");
|
|
1849
1849
|
var execAsync = (0, import_node_util.promisify)(import_node_child_process.exec);
|
|
1850
|
+
var normalizeAutoplayCommand = (raw) => {
|
|
1851
|
+
const command = raw.trim();
|
|
1852
|
+
if (/^forbocai\s+memory\s+clear\s+\S+$/i.test(command)) {
|
|
1853
|
+
return `printf "y\\n" | ${command}`;
|
|
1854
|
+
}
|
|
1855
|
+
const npcChat = command.match(/^forbocai\s+npc\s+chat\s+(\S+)\s+--text\s+(.+)$/i);
|
|
1856
|
+
if (npcChat) {
|
|
1857
|
+
const [, npcId, text] = npcChat;
|
|
1858
|
+
return `forbocai npc process ${npcId} ${text}`;
|
|
1859
|
+
}
|
|
1860
|
+
const soulChat = command.match(/^forbocai\s+soul\s+chat\s+(\S+)\s+--text\s+(.+)$/i);
|
|
1861
|
+
if (soulChat) {
|
|
1862
|
+
const [, npcId, text] = soulChat;
|
|
1863
|
+
return `forbocai npc process ${npcId} ${text}`;
|
|
1864
|
+
}
|
|
1865
|
+
return command;
|
|
1866
|
+
};
|
|
1850
1867
|
var runCommand = async (command) => {
|
|
1868
|
+
const executableCommand = normalizeAutoplayCommand(command.command);
|
|
1851
1869
|
try {
|
|
1852
|
-
const { stdout, stderr } = await execAsync(
|
|
1870
|
+
const { stdout, stderr } = await execAsync(executableCommand, { timeout: 1e4 });
|
|
1853
1871
|
const output2 = [stdout, stderr].filter(Boolean).join("\n").trim();
|
|
1854
1872
|
return { status: "ok", output: output2 || "Command completed." };
|
|
1855
1873
|
} catch (error) {
|
|
@@ -1953,6 +1971,7 @@ var hex = {
|
|
|
1953
1971
|
gold: import_chalk.default.hex(THEME.GOLD),
|
|
1954
1972
|
scarlet: import_chalk.default.hex(THEME.SCARLET),
|
|
1955
1973
|
pulse: import_chalk.default.hex(THEME.PULSE),
|
|
1974
|
+
success: import_chalk.default.hex("#00ff00").bold,
|
|
1956
1975
|
player: import_chalk.default.hex(THEME.PLAYER).bold,
|
|
1957
1976
|
npc: import_chalk.default.hex(THEME.NPC),
|
|
1958
1977
|
doomguard: import_chalk.default.hex(THEME.DOOMGUARD).bold,
|
package/dist/cli.mjs
CHANGED
|
@@ -1839,9 +1839,27 @@ var uiActions = uiSlice.actions;
|
|
|
1839
1839
|
import { exec } from "child_process";
|
|
1840
1840
|
import { promisify } from "util";
|
|
1841
1841
|
var execAsync = promisify(exec);
|
|
1842
|
+
var normalizeAutoplayCommand = (raw) => {
|
|
1843
|
+
const command = raw.trim();
|
|
1844
|
+
if (/^forbocai\s+memory\s+clear\s+\S+$/i.test(command)) {
|
|
1845
|
+
return `printf "y\\n" | ${command}`;
|
|
1846
|
+
}
|
|
1847
|
+
const npcChat = command.match(/^forbocai\s+npc\s+chat\s+(\S+)\s+--text\s+(.+)$/i);
|
|
1848
|
+
if (npcChat) {
|
|
1849
|
+
const [, npcId, text] = npcChat;
|
|
1850
|
+
return `forbocai npc process ${npcId} ${text}`;
|
|
1851
|
+
}
|
|
1852
|
+
const soulChat = command.match(/^forbocai\s+soul\s+chat\s+(\S+)\s+--text\s+(.+)$/i);
|
|
1853
|
+
if (soulChat) {
|
|
1854
|
+
const [, npcId, text] = soulChat;
|
|
1855
|
+
return `forbocai npc process ${npcId} ${text}`;
|
|
1856
|
+
}
|
|
1857
|
+
return command;
|
|
1858
|
+
};
|
|
1842
1859
|
var runCommand = async (command) => {
|
|
1860
|
+
const executableCommand = normalizeAutoplayCommand(command.command);
|
|
1843
1861
|
try {
|
|
1844
|
-
const { stdout, stderr } = await execAsync(
|
|
1862
|
+
const { stdout, stderr } = await execAsync(executableCommand, { timeout: 1e4 });
|
|
1845
1863
|
const output2 = [stdout, stderr].filter(Boolean).join("\n").trim();
|
|
1846
1864
|
return { status: "ok", output: output2 || "Command completed." };
|
|
1847
1865
|
} catch (error) {
|
|
@@ -1945,6 +1963,7 @@ var hex = {
|
|
|
1945
1963
|
gold: import_chalk.default.hex(THEME.GOLD),
|
|
1946
1964
|
scarlet: import_chalk.default.hex(THEME.SCARLET),
|
|
1947
1965
|
pulse: import_chalk.default.hex(THEME.PULSE),
|
|
1966
|
+
success: import_chalk.default.hex("#00ff00").bold,
|
|
1948
1967
|
player: import_chalk.default.hex(THEME.PLAYER).bold,
|
|
1949
1968
|
npc: import_chalk.default.hex(THEME.NPC),
|
|
1950
1969
|
doomguard: import_chalk.default.hex(THEME.DOOMGUARD).bold,
|
package/dist/index.js
CHANGED
|
@@ -1846,9 +1846,27 @@ var uiActions = uiSlice.actions;
|
|
|
1846
1846
|
var import_node_child_process = require("child_process");
|
|
1847
1847
|
var import_node_util = require("util");
|
|
1848
1848
|
var execAsync = (0, import_node_util.promisify)(import_node_child_process.exec);
|
|
1849
|
+
var normalizeAutoplayCommand = (raw) => {
|
|
1850
|
+
const command = raw.trim();
|
|
1851
|
+
if (/^forbocai\s+memory\s+clear\s+\S+$/i.test(command)) {
|
|
1852
|
+
return `printf "y\\n" | ${command}`;
|
|
1853
|
+
}
|
|
1854
|
+
const npcChat = command.match(/^forbocai\s+npc\s+chat\s+(\S+)\s+--text\s+(.+)$/i);
|
|
1855
|
+
if (npcChat) {
|
|
1856
|
+
const [, npcId, text] = npcChat;
|
|
1857
|
+
return `forbocai npc process ${npcId} ${text}`;
|
|
1858
|
+
}
|
|
1859
|
+
const soulChat = command.match(/^forbocai\s+soul\s+chat\s+(\S+)\s+--text\s+(.+)$/i);
|
|
1860
|
+
if (soulChat) {
|
|
1861
|
+
const [, npcId, text] = soulChat;
|
|
1862
|
+
return `forbocai npc process ${npcId} ${text}`;
|
|
1863
|
+
}
|
|
1864
|
+
return command;
|
|
1865
|
+
};
|
|
1849
1866
|
var runCommand = async (command) => {
|
|
1867
|
+
const executableCommand = normalizeAutoplayCommand(command.command);
|
|
1850
1868
|
try {
|
|
1851
|
-
const { stdout, stderr } = await execAsync(
|
|
1869
|
+
const { stdout, stderr } = await execAsync(executableCommand, { timeout: 1e4 });
|
|
1852
1870
|
const output2 = [stdout, stderr].filter(Boolean).join("\n").trim();
|
|
1853
1871
|
return { status: "ok", output: output2 || "Command completed." };
|
|
1854
1872
|
} catch (error) {
|
|
@@ -1952,6 +1970,7 @@ var hex = {
|
|
|
1952
1970
|
gold: import_chalk.default.hex(THEME.GOLD),
|
|
1953
1971
|
scarlet: import_chalk.default.hex(THEME.SCARLET),
|
|
1954
1972
|
pulse: import_chalk.default.hex(THEME.PULSE),
|
|
1973
|
+
success: import_chalk.default.hex("#00ff00").bold,
|
|
1955
1974
|
player: import_chalk.default.hex(THEME.PLAYER).bold,
|
|
1956
1975
|
npc: import_chalk.default.hex(THEME.NPC),
|
|
1957
1976
|
doomguard: import_chalk.default.hex(THEME.DOOMGUARD).bold,
|
package/dist/index.mjs
CHANGED
|
@@ -1838,9 +1838,27 @@ var uiActions = uiSlice.actions;
|
|
|
1838
1838
|
import { exec } from "child_process";
|
|
1839
1839
|
import { promisify } from "util";
|
|
1840
1840
|
var execAsync = promisify(exec);
|
|
1841
|
+
var normalizeAutoplayCommand = (raw) => {
|
|
1842
|
+
const command = raw.trim();
|
|
1843
|
+
if (/^forbocai\s+memory\s+clear\s+\S+$/i.test(command)) {
|
|
1844
|
+
return `printf "y\\n" | ${command}`;
|
|
1845
|
+
}
|
|
1846
|
+
const npcChat = command.match(/^forbocai\s+npc\s+chat\s+(\S+)\s+--text\s+(.+)$/i);
|
|
1847
|
+
if (npcChat) {
|
|
1848
|
+
const [, npcId, text] = npcChat;
|
|
1849
|
+
return `forbocai npc process ${npcId} ${text}`;
|
|
1850
|
+
}
|
|
1851
|
+
const soulChat = command.match(/^forbocai\s+soul\s+chat\s+(\S+)\s+--text\s+(.+)$/i);
|
|
1852
|
+
if (soulChat) {
|
|
1853
|
+
const [, npcId, text] = soulChat;
|
|
1854
|
+
return `forbocai npc process ${npcId} ${text}`;
|
|
1855
|
+
}
|
|
1856
|
+
return command;
|
|
1857
|
+
};
|
|
1841
1858
|
var runCommand = async (command) => {
|
|
1859
|
+
const executableCommand = normalizeAutoplayCommand(command.command);
|
|
1842
1860
|
try {
|
|
1843
|
-
const { stdout, stderr } = await execAsync(
|
|
1861
|
+
const { stdout, stderr } = await execAsync(executableCommand, { timeout: 1e4 });
|
|
1844
1862
|
const output2 = [stdout, stderr].filter(Boolean).join("\n").trim();
|
|
1845
1863
|
return { status: "ok", output: output2 || "Command completed." };
|
|
1846
1864
|
} catch (error) {
|
|
@@ -1944,6 +1962,7 @@ var hex = {
|
|
|
1944
1962
|
gold: import_chalk.default.hex(THEME.GOLD),
|
|
1945
1963
|
scarlet: import_chalk.default.hex(THEME.SCARLET),
|
|
1946
1964
|
pulse: import_chalk.default.hex(THEME.PULSE),
|
|
1965
|
+
success: import_chalk.default.hex("#00ff00").bold,
|
|
1947
1966
|
player: import_chalk.default.hex(THEME.PLAYER).bold,
|
|
1948
1967
|
npc: import_chalk.default.hex(THEME.NPC),
|
|
1949
1968
|
doomguard: import_chalk.default.hex(THEME.DOOMGUARD).bold,
|