Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
126 changes: 126 additions & 0 deletions .agents/skills/s-fc3/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
# s-fc3

阿里云函数计算 FC3 + Serverless Devs (`s` CLI + `fc3` 组件) 的 Agent Skill。

用自然语言操作阿里云函数计算:查函数列表、调用函数、查日志、看实例、管理版本别名灰度、配置弹性伸缩、触发器、VPC/NAS、自定义域名等。

## 快速开始

```bash
npm i -g @serverless-devs/s
s config add # 配阿里云 AccessKey
```

## 使用示例

以下对话来自与 Agent 的真实交互(杭州区域,`access: default`):

### 查函数列表

```
❯ 帮我查看下阿里云杭州 test 为前缀的函数有哪些
```

Agent 自动执行 `s cli fc3 list --region cn-hangzhou -o json --silent`,筛选出所有 `test*` 函数,分类汇总服务名、函数数量、运行时和创建时间。

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀 Performance & Scalability | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

curl -fsSL \
  'https://raw.githubusercontent.com/devsapp/fc3/master/src/subCommands/list/index.ts' |
  rg -n 'prefix|listFunctions'

Repository: devsapp/fc3

Length of output: 410


🏁 Script executed:

#!/usr/bin/envbash
set -euo pipefail

printf 'README excerpt:\n'
sed -n '18,28p' .agents/skills/s-fc3/README.md 2>/dev/null || true

printf '\nfc3 list source excerpt:\n'
url='https://raw.githubusercontent.com/devsapp/fc3/master/src/subCommands/list/index.ts'
python3 - <<'PY'
import urllib.request, re
with urllib.request.urlopen('https://raw.githubusercontent.com/devsapp/fc3/master/src/subCommands/list/index.ts') as r:
    text = r.read().decode()
for i, line in enumerate(text.splitlines(), 1):
    if i <= 80:
        print(f'{i:4d}: {line}')
PY

printf '\nSearch for listFunctions implementation references/FC SDK typings:\n'
git ls-files | rg -i 'fc3|sdk|listFunctions' | head -100

Repository: devsapp/fc3

Length of output: 2648


🌐 Web query:

github devsapp fc3 src/subCommands/list/index.ts --prefix filter listFunctions

💡 Result:

The file src/subCommands/list/index.ts in the devsapp/fc3 repository is part of the Serverless Devs component for Alibaba Cloud Function Compute 3.0 [1][2]. This component uses a subcommand-based architecture where src/subCommands/list/index.ts handles the business logic for listing resources (such as functions, services, or triggers) within the CLI [1][3]. Regarding your query about --prefix and listFunctions: 1. CLI Command Structure: The fc3 component is designed to be used via the Serverless Devs (s) CLI [4]. While the source code defines the handling of these commands [3], user-level interaction is typically performed using standard CLI commands like s list or specific API calls via s cli fc-api [5][6]. 2. --prefix Argument: In the context of Alibaba Cloud FC APIs used by these components, a --prefix parameter is often supported in listing operations to filter results by name (e.g., listing functions that start with a specific string) [5]. 3. listFunctions: The term listFunctions typically refers to an underlying API operation (ListFunctions) or a specific CLI subcommand action [5]. If you are trying to list functions with a prefix filter, you would generally use the CLI command syntax rather than referencing the internal source file path directly. For example, if using the fc-api tool (which often mirrors these functions), the command structure would look like: s cli fc-api listFunctions --prefix The source file src/subCommands/list/index.ts acts as the entry point for the list command within the fc3 component [3], routing these CLI requests to the appropriate cloud provider API methods [1][3]. You do not need to call the source file directly; the CLI handles the routing automatically based on the arguments provided [3][2].

Citations:


🌐 Web query:

devsapp fc3 listFunctionsPage prefix implementation

💡 Result:

In the context of the devsapp/fc3 component, there is no direct command named listFunctionsPage. The fc3 component is designed for full lifecycle management of Alibaba Cloud Function Compute 3.0 resources [1][2]. Function listing operations in Function Compute are typically handled by the Alibaba Cloud API [3], which the Serverless Devs tooling facilitates. Specifically: 1. API Level: The underlying ListFunctions API, which the tool utilizes, supports a prefix parameter to filter functions by name [3]. 2. CLI Usage: While fc3 focuses on resource management (deploy, build, sync, etc.) [1][4], the general devsapp/fc-api tool (which provides low-level API access) includes commands like listTriggers that support --prefix [5]. For broader API operations, the fc component provides an api command, which accepts a --query parameter [6] that can be used to pass a JSON object containing the prefix [6]. If you are looking to list functions with a prefix using Serverless Devs, you should use the generic api call command provided by the underlying fc (or similar) infrastructure [6] or query the API directly if you are writing custom code within the fc3 component's framework [7]. The fc3 component itself exposes subcommands through index.ts [8] and focuses on higher-level lifecycle management rather than raw API pagination methods [1][2].

Citations:


把前缀传给 fc3 list

当前命令会先获取 cn-hangzhou 下所有函数,再在 Agent 端筛选 test*fc3 list 接受 --prefix;改为 --prefix test 可以让 CLI/API 直接返回匹配范围的函数列表,减少不必要的遍历和无关数据处理。

建议修改
- Agent 自动执行 `s cli fc3 list --region cn-hangzhou -o json --silent`
+ Agent 自动执行 `s cli fc3 list --region cn-hangzhou --prefix test -o json --silent`
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
Agent 自动执行 `s cli fc3 list --region cn-hangzhou -o json --silent`,筛选出所有 `test*` 函数,分类汇总服务名、函数数量、运行时和创建时间。
Agent 自动执行 `s cli fc3 list --region cn-hangzhou --prefix test -o json --silent`,筛选出所有 `test*` 函数,分类汇总服务名、函数数量、运行时和创建时间。
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.agents/skills/s-fc3/README.md at line 24, 更新 README 中执行 fc3 list 的命令,在
cn-hangzhou 区域参数中加入 --prefix test,让 CLI 直接返回 test* 函数;保留
JSON、静默输出及后续按服务名、数量、运行时和创建时间汇总的逻辑不变。

Source: MCP tools


### 调用函数

```
❯ 调用下 test-f 函数
```

Agent 执行 `s cli fc3 invoke --region cn-hangzhou --function-name test-f --silent`,返回 `hello world`。

带自定义事件体:

```bash
s cli fc3 invoke --region cn-hangzhou --function-name test-f --silent \
-e '{"action":"create","user":"alice","data":{"score":88}}'
```

### 批量调用

```
❯ 给我随机产生自定义事件体,调用 test-f 5 次
```

Agent 生成 5 组各不相同的 JSON 事件体(create/update/delete/search/notify),依次调用并汇总结果表格。

### 查日志

```
❯ 帮我查看下 test-f 最近调用情况
```

Agent 自动构造时间范围(最近 1 小时),执行:

```bash
# macOS
s cli fc3 logs --region cn-hangzhou --function-name test-f \
-s "$(TZ=Asia/Shanghai date -v-1H +%Y-%m-%dT%H:%M:%S+08:00)" \
-e "$(TZ=Asia/Shanghai date +%Y-%m-%dT%H:%M:%S+08:00)"

# Linux
s cli fc3 logs --region cn-hangzhou --function-name test-f \
-s "$(TZ=Asia/Shanghai date -d '1 hour ago' +%Y-%m-%dT%H:%M:%S+08:00)" \
-e "$(TZ=Asia/Shanghai date +%Y-%m-%dT%H:%M:%S+08:00)"
```

### 按实例查日志

```
❯ 查看下实例 c-69f9eed8-15f8e4fe-55032c26cf38 所有请求情况
```

```bash
s cli fc3 logs --region cn-hangzhou --function-name test-f \
--instance-id c-69f9eed8-15f8e4fe-55032c26cf38
```

Agent 列出该实例上的全部请求(含冷启动标记和每次调用的 RequestId)。

### 按 RequestId 查日志

```
❯ 查看 1-69f9ef93-1510a7cb-5873a9384742 日志
```

```bash
s cli fc3 logs --region cn-hangzhou --function-name test-f \
--request-id 1-69f9ef93-1510a7cb-5873a9384742
```

精确返回该次调用的完整日志。

### 查函数详情

```
❯ 查看 test-f 函数详情
```

```bash
s cli fc3 info --region cn-hangzhou --function-name test-f -o json --silent
```

Agent 以表格呈现:运行时、CPU/内存/磁盘、超时、代码大小、网络配置、实例模式、创建/修改时间、日志配置等。

## 更多能力

| 功能 | 说明 |
|------|------|
| `s deploy` | 部署函数(代码/配置/触发器/异步配置可分别部署) |
| `s build` | Docker 环境构建依赖、打层、自定义容器 |
| `s local` | 本地调用/调试(含 VS Code / IntelliJ 断点) |
| `s logs` | SLS 日志查询(按时间/RequestId/实例/失败过滤/tail 跟踪) |
| `s info` / `s plan` | 查看线上配置 / 预览变更 |
| `s remove` | 删除资源(支持 -y 强制、按触发器删除) |
| `s instance` | 查看活跃实例、进入实例 Shell、执行命令 |
| `s version` / `s alias` | 版本发布 + 别名灰度(流量权重) |
| `s scaling` / `s concurrency` | 弹性伸缩 + 并发控制 |
| `s layer` | 层管理(发布/查看/下载/权限/删除) |
| `s session` | 会话管理(创建/列表/更新/删除) |
| `s sync` | 线上配置拉到本地 |
| `s2tos3` | FC2 格式转 FC3 |
| fc3-domain | 自定义域名(多函数路由、HTTPS、TLS、WAF) |

详细用法见 [SKILL.md](./SKILL.md)。
Loading
Loading