feat: enhance function execution options and logging capabilities
CI / CD / Test and Build (push) Failing after 1m3s
CI / CD / Publish (push) Has been skipped

- Added `--route` and `--method` options to `function execute` command for better HTTP handling.
- Improved `get function` command to display additional function metadata including HTTP settings, cache status, network restrictions, RAM limits, timeouts, and tags.
- Removed deprecated `helloworld` command.
- Expanded `update function` command with new options for Docker mounts, network restrictions, and various installation flags, including better error handling for boolean and number options.
- Introduced environment variable management commands: `add`, `list`, and `remove` for account-wide environment variables.
- Added `export` command to export authenticated account data.
- Implemented `api openapi` and `api request` commands for direct API interaction.
- Created logging and rate limit management commands for functions.
- Added MCP tool commands for calling tools, fetching documentation, and initializing sessions.
- Introduced utility functions for JSON handling and environment variable normalization.
- Set up CI/CD pipeline with Gitea Actions for automated testing, building, and publishing.
- Updated configuration loading to support environment variables for instance and token.
This commit is contained in:
Space-Banane
2026-07-10 22:24:47 +02:00
parent 0434376b83
commit 97b2089857
33 changed files with 1037 additions and 675 deletions
+28
View File
@@ -0,0 +1,28 @@
import chalk from "chalk";
import { callMcp } from "../../utils/mcp.js";
import { printJson, readJsonInput } from "../../utils/json.js";
export const mcpCallDefinition = {
name: "call <tool>",
description: "Call an SHSF MCP tool with JSON arguments.",
options: [
{ name: "--args <json>", description: "Tool arguments as JSON" },
{ name: "--args-file <path>", description: "Read tool arguments from a JSON file" },
],
action: async (tool: string, options: any) => {
try {
const args = readJsonInput({
data: options.args,
dataFile: options.argsFile,
defaultValue: {},
});
const result = await callMcp("tools/call", {
name: tool,
arguments: args,
});
printJson(result);
} catch (error: any) {
console.error(`${chalk.red("✗")} ${error.message}`);
}
},
};
+24
View File
@@ -0,0 +1,24 @@
import chalk from "chalk";
import { callMcp } from "../../utils/mcp.js";
import { printJson } from "../../utils/json.js";
export const mcpDocsDefinition = {
name: "docs",
description: "Print the SHSF function authoring reference from the MCP get_docs tool.",
action: async () => {
try {
const result: any = await callMcp("tools/call", {
name: "get_docs",
arguments: {},
});
const text = result?.content?.find?.((item: any) => item.type === "text")?.text;
if (text) {
process.stdout.write(`${text}\n`);
} else {
printJson(result);
}
} catch (error: any) {
console.error(`${chalk.red("✗")} ${error.message}`);
}
},
};
+18
View File
@@ -0,0 +1,18 @@
import chalk from "chalk";
import { getApiClient } from "../../api.js";
import { printJson } from "../../utils/json.js";
export const mcpInfoDefinition = {
name: "info",
description: "Print SHSF MCP server metadata.",
action: async () => {
const client = await getApiClient();
try {
const response = await client.get("/mcp");
printJson(response.data);
} catch (error: any) {
console.error(`${chalk.red("✗")} ${error.response?.data?.message || error.message}`);
}
},
};
+20
View File
@@ -0,0 +1,20 @@
import chalk from "chalk";
import { callMcp } from "../../utils/mcp.js";
import { printJson } from "../../utils/json.js";
export const mcpInitDefinition = {
name: "init",
description: "Initialize an MCP session and print server instructions.",
action: async () => {
try {
const result = await callMcp("initialize", {
protocolVersion: "2024-11-05",
capabilities: {},
clientInfo: { name: "shsf-cli", version: "1.0.0" },
});
printJson(result);
} catch (error: any) {
console.error(`${chalk.red("✗")} ${error.message}`);
}
},
};
+16
View File
@@ -0,0 +1,16 @@
import chalk from "chalk";
import { callMcp } from "../../utils/mcp.js";
import { printJson } from "../../utils/json.js";
export const mcpToolsDefinition = {
name: "tools",
description: "List MCP tools exposed by the SHSF instance.",
action: async () => {
try {
const result = await callMcp("tools/list");
printJson(result);
} catch (error: any) {
console.error(`${chalk.red("✗")} ${error.message}`);
}
},
};