mirror of
https://github.com/larksuite/cli.git
synced 2026-09-14 18:42:53 +08:00
ac0f243e5b
* docs(base): sync workflow guide to current branch * docs(base): sync workflow schema to current branch * feat(base): support AI classification workflow validation Co-authored-by: TRAE CLI <traecli@bytedance.com> * docs(base): document AI classification workflow schema Co-authored-by: TRAE CLI <traecli@bytedance.com> * feat(base): validate AI classification agent data Co-authored-by: TRAE CLI <traecli@bytedance.com> * fix(base): relax ai classification optional fields Co-authored-by: TRAE CLI <traecli@bytedance.com> * fix(base): validate workflow ai analysis json Co-authored-by: TRAE CLI <traecli@bytedance.com> * fix(base): validate workflow ai analysis json Co-authored-by: TRAE CLI <traecli@bytedance.com> * fix(base): default ai classification no match action Co-authored-by: TRAE CLI <traecli@bytedance.com> * fix(base): keep ai analysis validation scoped Co-authored-by: TRAE CLI <traecli@bytedance.com> * fix(base): normalize workflow empty steps Co-authored-by: TRAE CLI <traecli@bytedance.com> * fix(base): reject ai classification mode input Co-authored-by: TRAE CLI <traecli@bytedance.com> * fix: polish skill * fix: 还原 step 判断逻辑 * fix: 调整校验逻辑组织形式 * fix: polish skill * fix: CR Comment * feat: support development environment overrides * fix: CR Comment * Revert "feat: support development environment overrides" This reverts commitcef8f78dc6. * fix: polish skill * fix: compress skill * feat: support development environment overrides * Revert "feat: support development environment overrides" This reverts commitcef8f78dc6. * fix: polish skill * feat: support development environment overrides * fix(base): preserve omitted AI classification strategy * Revert "feat: support development environment overrides" This reverts commitcef8f78dc6. * fix: polish skill * fix: ut * feat: support development environment overrides * fix: 沿用全量更新逻辑 * Revert "feat: support development environment overrides" This reverts commitf805081e89. --------- Co-authored-by: TRAE CLI <traecli@bytedance.com>
51 lines
1.2 KiB
Go
51 lines
1.2 KiB
Go
// Copyright (c) 2026 Lark Technologies Pte. Ltd.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package base
|
|
|
|
import "github.com/larksuite/cli/shortcuts/common"
|
|
|
|
func parseWorkflowBodyJSON(runtime *common.RuntimeContext) (map[string]interface{}, error) {
|
|
pc := newParseCtx(runtime)
|
|
body, err := parseJSONObject(pc, runtime.Str("json"), "json")
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
if err := validateWorkflowBodyForCLI(body); err != nil {
|
|
return nil, err
|
|
}
|
|
return body, nil
|
|
}
|
|
|
|
func validateWorkflowBodyForCLI(body map[string]interface{}) error {
|
|
steps, ok := body["steps"].([]interface{})
|
|
if !ok {
|
|
return nil
|
|
}
|
|
|
|
var stepIDs map[string]int
|
|
for stepIndex, rawStep := range steps {
|
|
step, ok := rawStep.(map[string]interface{})
|
|
if !ok {
|
|
continue
|
|
}
|
|
|
|
stepType, _ := step["type"].(string)
|
|
switch stepType {
|
|
case aiAnalysisActionType:
|
|
if err := validateWorkflowAIAnalysisAction(stepIndex, step); err != nil {
|
|
return err
|
|
}
|
|
case workflowAIClassificationStepType:
|
|
if stepIDs == nil {
|
|
stepIDs = indexWorkflowStepIDs(steps)
|
|
}
|
|
if err := validateWorkflowAIClassificationStep(stepIndex, step, stepIDs); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|