Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // Version is the current release version of zentao-cli. // 由 goreleaser 通过 -X 注入;go install 构建时回退到 build info 中的模块版本。 Version = "dev" // SDKVersion is the compatible ZenTao PMS SDK release version. SDKVersion = "zentaopms_21.7_20250516" // ZenTaoCompat is the target ZenTao PMS major/minor version compatibility. ZenTaoCompat = "21.7" // GitCommit is set at compile time. GitCommit = "HEAD" // BuildDate is set at compile time. BuildDate = "unknown" )
View Source
var RootCmd = &cobra.Command{ Use: "zentao", Short: "禅道 (ZenTao PMS) 命令行工具(深度适配 AI Agent 与自动化脚本)", Long: `zentao-cli 是基于禅道官方 PHP SDK (v21.7+) 与原生 JSON 接口开发的现代化命令行工具。 提供个人工作台/待办看板(my/todo)、任务、缺陷、项目、产品等全方位能力,支持持久化会话凭据管理与确定性结构化输出。`, SilenceUsage: true, SilenceErrors: true, PersistentPreRunE: func(cmd *cobra.Command, args []string) error { opts, err := config.Load(flagOpts) if err != nil { return err } runtimeOpts = opts printer = output.New(opts.Output) printer.Out = cmd.OutOrStdout() printer.Err = cmd.ErrOrStderr() zcfg := opts.ToZentaoConfig() client = zentao.New(zcfg) client.OnSessionRefreshed = func(cookie, rand string) { config.UpdateActiveProfileCookie(cookie, rand) } if profile, err := config.GetActiveProfile(""); err == nil && profile != nil { if client.BaseURL == "" { client.BaseURL = strings.TrimRight(profile.URL, "/") } if client.Account == "" { client.Account = profile.Account } if client.Password == "" && profile.Password != "" { client.Password = profile.Password } if client.GetRand() == "" { client.SetRand(profile.Rand) } if profile.Cookie != "" { client.Cookie = profile.Cookie } } return nil }, }
RootCmd represents the base command when called without any subcommands.
Functions ¶
Types ¶
type CommandSchema ¶
type CommandSchema struct {
Name string `json:"name"`
Path string `json:"path"`
Description string `json:"description"`
Effect string `json:"effect"` // read | write | destructive
Risk string `json:"risk"` // low | medium | high
UseWhen string `json:"use_when,omitempty"`
AvoidWhen string `json:"avoid_when,omitempty"`
Parameters []ParamSchema `json:"parameters,omitempty"`
Subcommands []CommandSchema `json:"subcommands,omitempty"`
Examples []string `json:"examples,omitempty"`
}
CommandSchema represents a tool specification for LLM Agent discovery.
type ParamSchema ¶
type ParamSchema struct {
Name string `json:"name"`
Shorthand string `json:"shorthand,omitempty"`
Type string `json:"type"`
Required bool `json:"required"`
Default string `json:"default,omitempty"`
Description string `json:"description"`
}
ParamSchema describes a CLI parameter flag.
Click to show internal directories.
Click to hide internal directories.