Files
Space-Banane 97b2089857
CI / CD / Test and Build (push) Failing after 1m3s
CI / CD / Publish (push) Has been skipped
feat: enhance function execution options and logging capabilities
- 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.
2026-07-10 22:24:47 +02:00

2.4 KiB

Agent Notes for SHSF CLI

This repository is the TypeScript CLI for SHSF. The sibling repository ../shsf is the authoritative source for backend routes, request bodies, MCP tools, and platform behavior.

Before Changing Commands

  1. Inspect ../shsf/Backend/src/routes for the live REST route.
  2. Inspect ../shsf/Backend/src/lib/mcp for agent-facing MCP tool behavior.
  3. Prefer updating typed command wrappers for common workflows and rely on shsf api request for rare or admin-only routes.
  4. Run pnpm test and pnpm build before considering the change complete.

Command Architecture

Commands are auto-loaded from src/commands. Directory names become command groups. Each command file exports a definition object:

export const commandDefinition = {
  name: "example <arg>",
  description: "Do something",
  options: [{ name: "--flag <value>", description: "Example option" }],
  action: async (arg: string, options: any) => {}
};

Use getApiClient() from src/api.ts for REST calls. It handles SHSF_INSTANCE, SHSF_TOKEN, auth headers, content type, user agent, and timeout.

Current Backend Alignment

The live backend expects function settings under settings for fields such as:

  • allow_http
  • secure_header
  • max_ram
  • timeout
  • tags
  • retry_on_failure
  • retry_count
  • cache_enabled
  • cache_ttl

Top-level function fields include runtime/container controls such as image, startup_file, namespaceId, executionAlias, docker_mount, network_restricted, ffmpeg_install, opencv_install, imported, ai_kicked_off, and cors_origins.

Agent-Ready Interfaces

Keep these commands working because they let agents recover when the typed CLI surface is behind the backend:

  • shsf api openapi
  • shsf api request <method> <path>
  • shsf mcp info
  • shsf mcp init
  • shsf mcp tools
  • shsf mcp docs
  • shsf mcp call <tool>

Agents writing SHSF function source should call shsf mcp docs first. The SHSF MCP server also instructs clients to call get_docs before writing function code.

CI/CD

Use Gitea Actions only. Workflow files live in .gitea/workflows. Do not add GitHub Actions or Copilot instructions back unless the project owner explicitly requests that migration.

The workflow should keep pnpm-store caching, test/build gates, npm publish guarded by NPM_TOKEN, and Gitea release creation guarded by GITEA_TOKEN.