feat: teai role
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// workflow_commands.go — gitea.py 工作流命令的 CLI 接線(#6):
|
||||
// whoami、orgs、members [--has-work]、mine、pulls [--mine|--reviewer] [--repo]、next。
|
||||
// whoami、role、orgs、members [--has-work]、mine、pulls [--mine|--reviewer] [--repo]、next。
|
||||
//
|
||||
// 輸出走 internal/gitea 的 Printer(--output json|table);錯誤經 cli.exitCodeFor
|
||||
// 映射結束碼(用法 2/API 3)。token 解析選序見 internal/gitea/auth.go。
|
||||
@@ -20,6 +20,7 @@ func init() {
|
||||
commands[c.name] = c
|
||||
}
|
||||
register(&command{name: "whoami", usage: "目前帳號", run: runWhoami})
|
||||
register(&command{name: "role", usage: "目前角色(Supervisor→supervisor,Agents→worker)", run: runRole})
|
||||
register(&command{name: "orgs", usage: "我所屬的組織", run: runOrgs})
|
||||
register(&command{name: "members", usage: "Agents 團隊成員;--has-work 只列有未完成工作者", run: runMembers})
|
||||
register(&command{name: "mine", usage: "分派給我、待跟進的 issues", run: runMine})
|
||||
@@ -77,6 +78,29 @@ func runWhoami(env *Env, args []string) error {
|
||||
)
|
||||
}
|
||||
|
||||
// runRole:teai role。不在 Supervisor/Agents 團隊時輸出 null(exit 0)。
|
||||
func runRole(env *Env, args []string) error {
|
||||
if len(args) != 0 {
|
||||
return &ErrUsage{Msg: "role 不接受參數"}
|
||||
}
|
||||
s, err := newScannerFunc(env)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
role, err := s.Role()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
p := printer(env)
|
||||
if role == "" {
|
||||
return p.PrintNull()
|
||||
}
|
||||
return p.PrintOne(
|
||||
[]gitea.Field{{Name: "role"}},
|
||||
gitea.Values{role},
|
||||
)
|
||||
}
|
||||
|
||||
// runOrgs:teai orgs。
|
||||
func runOrgs(env *Env, args []string) error {
|
||||
if len(args) != 0 {
|
||||
|
||||
Reference in New Issue
Block a user