← 返回 Skills 市场
gh-xj

agentcli-go

作者 xj · GitHub ↗ · v1.0.0
cross-platform ⚠ suspicious
580
总下载
0
收藏
1
当前安装
1
版本数
在 OpenClaw 中安装
/install agentcli-go
功能描述
agentcli-go framework reference for building Go CLI tools. Use when working on agentcli-go itself, scaffolding new CLI projects, adding commands, integrating...
使用说明 (SKILL.md)

agentcli-go

Shared Go CLI helpers and framework modules.

Module: github.com/gh-xj/agentcli-go Repo: github.com/gh-xj/agentcli-go | Versioning: v0.x.y (pre-1.0)


API Surface

File Exported Symbols
log.go InitLogger() — zerolog setup, respects -v/--verbose
args.go ParseArgs(args), RequireArg(args, name), GetArg(args, name), HasFlag(args, name)
exec.go RunCommand(name, args...), RunOsascript(script), Which(bin), CheckDependency(bin)
fs.go FileExists(path), EnsureDir(path), GetBaseName(path)
core_context.go AppContext{Meta, Values}, NewAppContext(ctx)
lifecycle.go Hook interface (Preflight, Postflight), RunLifecycle(app, hook, run)
errors.go CLIError, ResolveExitCode(err), ExitSuccess, ExitUsage
scaffold.go ScaffoldNew(baseDir, name, module), ScaffoldAddCommand(rootDir, name, desc, preset), Doctor(rootDir) DoctorReport
cobrax/cobrax.go Execute(RootSpec, args) int, NewRoot(RootSpec) *cobra.Command, CommandSpec, RootSpec
configx/configx.go Load(Options) map[string]any, Decode[T](raw), NormalizeEnv(prefix, environ)

Scaffold Workflows

New project

agentcli new --name my-tool --module github.com/me/my-tool
# or programmatically:
agentcli.ScaffoldNew(".", "my-tool", "github.com/me/my-tool")

Generates: main.go, cmd/root.go, internal/app/, internal/config/, internal/io/, internal/tools/smokecheck/, pkg/version/, test/, Taskfile.yml, README.md

Add command

agentcli add command --name sync --preset file-sync
agentcli add command --name deploy --desc "run deploy checks"

Presets: file-sync, http-client, deploy-helper

Doctor check

agentcli doctor [--dir ./my-tool]
# returns DoctorReport JSON with findings

Golden Project Layout

my-tool/
├── main.go                          # os.Exit(cmd.Execute(os.Args[1:]))
├── cmd/
│   ├── root.go                      # cobrax.Execute(RootSpec{...})
│   └── \x3Ccommand>.go                 # func \x3CName>Command() command
├── internal/
│   ├── app/{bootstrap,lifecycle,errors}.go
│   ├── config/{schema,load}.go
│   ├── io/output.go
│   └── tools/smokecheck/main.go
├── pkg/version/version.go
├── test/
│   ├── e2e/cli_test.go
│   └── smoke/version.schema.json
└── Taskfile.yml

cobrax Pattern

// cmd/root.go
return cobrax.Execute(cobrax.RootSpec{
    Use:   "my-tool",
    Short: "my-tool CLI",
    Meta:  agentcli.AppMeta{Name: "my-tool", Version: version.Version},
    Commands: []cobrax.CommandSpec{
        {Use: "sync", Short: "sync files", Run: SyncCommand().Run},
    },
}, args)

Persistent flags auto-wired: --verbose/-v, --config, --json, --no-color Values accessible via app.Values["json"], app.Values["config"], etc.


configx Pattern

raw, err := configx.Load(configx.Options{
    Defaults: map[string]any{"env": "default"},
    FilePath: configPath,   // optional JSON file
    Env:      configx.NormalizeEnv("MYTOOL_", os.Environ()),
    Flags:    map[string]string{"env": flagVal},
})
cfg, err := configx.Decode[config.Config](raw)
// Precedence: Defaults \x3C File \x3C Env \x3C Flags

Taskfile Tasks

Task Purpose
task ci Canonical CI: preflight + lint + test + build + smoke + schema checks
task verify Local aggregate (wraps ci)
task lint go vet + golangci-lint
task smoke Deterministic smoke tests (subset of unit tests)
task schema:check Validate JSON contracts against schemas
task docs:check Ensure skill docs match CLI help signatures
task fmt Format all Go files

Rules

  • Flat package — everything in package agentcli, no sub-packages (except cobrax, configx)
  • Exported only — all functions PascalCase; this is a library
  • No business logic — generic utilities only; must be reused across 2+ projects to qualify
  • log.Fatal allowed in RequireArg, CheckDependency (CLI-oriented helpers)
  • Minimal deps — zerolog, lo, cobra only; justify new additions

Out of Scope

  • Project-specific logic (put that in consuming projects)
  • Adding functions used by only one project
安全使用建议
This skill is just a reference document for a Go CLI framework and does not itself install code or request secrets, so the direct risk is low. Before using any generated scaffolding or adding the referenced library to a project: 1) verify the upstream repository (github.com/gh-xj/agentcli-go) and its integrity/license; 2) inspect the actual library code (especially functions like RunCommand/RunOsascript) to ensure they don't execute untrusted input or run networked installs; and 3) when running scaffolding commands, review any generated scripts or Taskfile tasks before executing them on your machine.
功能分析
Type: OpenClaw Skill Name: agentcli-go Version: 1.0.0 The skill bundle is classified as suspicious due to the exposure of high-risk capabilities without explicit malicious intent. Specifically, the `exec.go` module, as described in `SKILL.md`, provides `RunCommand` and `RunOsascript` functions, enabling the AI agent to execute arbitrary shell commands and AppleScript. This presents a significant remote code execution (RCE) vulnerability if the agent is prompted maliciously. Additionally, `scaffold.go` allows file system modifications, and `configx.go` can read environment variables, posing further risks for data exfiltration or unauthorized changes. While these functionalities might be plausible for a CLI framework, their direct exposure to an AI agent without clear safeguards makes the skill highly susceptible to abuse.
能力评估
Purpose & Capability
The name and description match the SKILL.md content: it documents a Go CLI framework, scaffold workflows, API surface, and recommended project layout. Nothing in the file requests unrelated credentials, binaries, or external services.
Instruction Scope
SKILL.md is a documentation/reference artifact describing APIs and example commands (e.g., agentcli new). It does not instruct the agent to read arbitrary host files, send data externally, or access secrets. Note: the documented API surface includes helpers like RunCommand and RunOsascript which imply the library can execute shell/macOS scripts when used in code — this is expected for a CLI framework but worth auditing in any concrete implementation before running generated scaffolding against untrusted input.
Install Mechanism
No install spec is present (instruction-only). Nothing will be written to disk or downloaded by the skill itself.
Credentials
The skill declares no required environment variables or credentials. The doc references patterns for loading environment variables in consumer projects, which is appropriate and proportional.
Persistence & Privilege
always is false and the skill is user-invocable. It does not request persistent/system-wide privileges or modify other skills' configuration.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install agentcli-go
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /agentcli-go 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
Initial publish — API surface, scaffold workflows, cobrax/configx patterns, golden project layout
元数据
Slug agentcli-go
版本 1.0.0
许可证
累计安装 1
当前安装数 1
历史版本数 1
常见问题

agentcli-go 是什么?

agentcli-go framework reference for building Go CLI tools. Use when working on agentcli-go itself, scaffolding new CLI projects, adding commands, integrating... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 580 次。

如何安装 agentcli-go?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install agentcli-go」即可一键安装,无需额外配置。

agentcli-go 是免费的吗?

是的,agentcli-go 完全免费(开源免费),可自由下载、安装和使用。

agentcli-go 支持哪些平台?

agentcli-go 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 agentcli-go?

由 xj(@gh-xj)开发并维护,当前版本 v1.0.0。

💬 留言讨论