opencli-generate
Original:🇺🇸 English
Translated
Use when a user asks to automatically generate a CLI command for a website. Takes a URL and optional goal, runs the full verified generation pipeline (explore, synthesize, cascade, verify), and returns a structured outcome. This is the primary entry point for "帮我生成 xxx.com 的 cli".
10installs
Sourcejackwener/opencli
Added on
NPX Install
npx skill4agent add jackwener/opencli opencli-generateTags
Translated version includes tags in frontmatterSKILL.md Content
View Translation Comparison →CLI-GENERATE — Verified CLI Generation Skill
One-shot automated CLI generation: give a URL, get a verified command or a structured explanation of why not.
When to Use This Skill
- User says "帮我生成 xxx.com 的 cli" or similar
- User wants to add a website to opencli automatically
- User provides a URL and expects a working CLI command
Not for: manual API exploration (use ), single-page quick generation (use ), or browser-based debugging (use ).
opencli-exploreropencli-oneshotopencli-operateInput
| Field | Required | Type | Description |
|---|---|---|---|
| Yes | string | Target website URL |
| No | string | Natural language intent hint (e.g. "热榜", "搜索", "最新帖子") |
goalHow to Invoke
bash
opencli generate <url> [--goal <goal>] [--format json]The skill calls internally. The agent does not need to know about explore, synthesize, cascade, or verify stages.
generateVerifiedFromUrlOutput: SkillOutput
typescript
interface SkillOutput {
// Machine-readable decision fields (agent uses these for routing)
conclusion: 'success' | 'blocked' | 'needs-human-check';
reason?: StopReason | EscalationReason;
suggested_action?: SuggestedAction;
reusability?: Reusability;
// Structured data
command?: string; // e.g. "demo/hot"
strategy?: string; // "public" | "cookie"
path?: string; // YAML artifact path
// Human-readable summary (agent can relay to user directly)
message: string;
}Decision Language (shared with code layer)
StopReason (blocked):
- — site has no discoverable JSON APIs
no-viable-api-surface - — all endpoints require auth beyond PUBLIC/COOKIE
auth-too-complex - — APIs found but no valid CLI candidate synthesized
no-viable-candidate - — browser not connected
execution-environment-unavailable
EscalationReason (needs-human-check):
- — pipeline ran but returned nothing
empty-result - — result has too few populated fields
sparse-fields - — result is not an array
non-array-result - — candidate needs args we can't auto-fill
unsupported-required-args - — execution timed out
timeout - — DOM/JSON path didn't match
selector-mismatch - — catch-all for ambiguous verify failures
verify-inconclusive
SuggestedAction (what to do next):
- — nothing more to try
stop - — use opencli-operate skill to debug
inspect-with-operate - — user needs to log in first
ask-for-login - — user needs to provide a real argument value
ask-for-sample-arg - — general human review needed
manual-review
Reusability (is the artifact worth keeping?):
- — fully verified, can be used directly
verified-artifact - — candidate exists but not verified
unverified-candidate - — nothing worth keeping
not-reusable
Decision Tree
Input: url + goal?
|
v
Call generateVerifiedFromUrl(url, goal)
|
v
Receive GenerateOutcome
|
+-- status = 'success'
| conclusion: 'success'
| reusability: 'verified-artifact'
| command: outcome.adapter.command
| strategy: outcome.adapter.strategy
| path: outcome.adapter.path
| message: "已生成 {command},可直接使用 (策略: {strategy})"
| → END
|
+-- status = 'blocked'
| conclusion: 'blocked'
| reason: outcome.reason
| message: (see message templates below)
| → END
|
+-- status = 'needs-human-check'
conclusion: 'needs-human-check'
reason: outcome.escalation.reason
suggested_action: outcome.escalation.suggested_action
reusability: outcome.reusability
path: outcome.escalation?.candidate?.path (optional, only when reusable candidate exists)
message: (see message templates below)
→ END (upper-level agent decides next step)Message Templates
| conclusion | reason | message |
|---|---|---|
| — | "已生成 {command},可直接使用。策略: {strategy}" |
| | "该站点没有发现可用的 JSON API 接口,无法自动生成 CLI" |
| | "所有接口都需要超出自动化能力的认证方式(如 signature/bearer),无法自动生成" |
| | "发现了 API 接口,但未能合成有效的 CLI 候选" |
| | "浏览器未连接,请先运行 opencli doctor 检查环境" |
| | "候选需要参数 {args},请提供示例值后重试" |
| | "候选验证返回空结果,建议用 opencli-operate 检查" |
| | "候选验证结果字段不足,建议人工检查" |
| | "返回结果不是数组格式,建议用 opencli-operate 检查接口返回结构" |
| | "验证超时,建议用 opencli-operate 手动检查接口响应" |
| | "数据路径不匹配,建议用 opencli-operate 检查实际返回结构" |
| | "验证结果不确定,候选已保存在 {path},需要人工审查" |
Guardrails
-
Skill does not orchestrate internal pipeline stages. It does not decide whether to explore, synthesize, cascade, or verify. That is the code layer's job.
-
Skill does not auto-escalate to operate. When, skill reports the recommendation but does not automatically invoke
needs-human-check. The upper-level agent decides.opencli-operate -
No new taxonomy. All,
reason,suggested_actionvalues are shared with the code layer (reusability). Skill does not invent new status words.GenerateOutcome -
Machine-readable fields are the contract;is just a summary. Callers must not parse
messagefor decision-making.message -
is a natural language intent hint. Not a command name, not a capability schema, not an execution parameter.
goal
Relationship to Other Primitives
P1: Terminal Contract (GenerateOutcome
)
GenerateOutcome- Skill's single source of truth for final decisions
- Skill maps →
GenerateOutcome(thin translation, no re-orchestration)SkillOutput
P2: Early-Hint Contract (EarlyHint
)
EarlyHint- Lives inside the orchestrator, transparent to skill
- Drives early exit (cost optimization) before verify stage
- Skill does not consume directly in v1
EarlyHint - May be exposed as optional progress channel in future versions
v1 Scope
- JSON API + PUBLIC/COOKIE auth + structured array result + read-only list-like capabilities
- Single browser session lifecycle (probe + verify share one session)
- Bounded repair: only itemPath relocation, one attempt