From dcc7e72ec1085a3026af11089568450e7274ad16 Mon Sep 17 00:00:00 2001 From: anxb Date: Wed, 19 Aug 2026 15:05:21 +0800 Subject: [PATCH 1/2] =?UTF-8?q?feat:=20agoal=E6=96=B0=E5=A2=9Edws?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/cli/schema_command_exclusions.go | 1 + internal/helpers/agoal.go | 33 ++++++++++++++++++- internal/helpers/wukong_sync_commands_test.go | 1 + skills/mono/references/products/agoal.md | 6 ++++ .../multi/dingtalk-misc/references/agoal.md | 7 ++++ test/fixtures/cli-interface-baseline.txt | 7 +++- 6 files changed, 53 insertions(+), 2 deletions(-) diff --git a/internal/cli/schema_command_exclusions.go b/internal/cli/schema_command_exclusions.go index 328c1f42..3b06c6d8 100644 --- a/internal/cli/schema_command_exclusions.go +++ b/internal/cli/schema_command_exclusions.go @@ -76,6 +76,7 @@ var reviewedRuntimeSchemaExclusionGroups = []runtimeSchemaExclusionGroup{ "agoal scorecard detail", "agoal scorecard entity-detail", "agoal scorecard update", + "agoal scorecard search-entities", "agoal strategy detail", "agoal strategy list", "agoal strategy update", diff --git a/internal/helpers/agoal.go b/internal/helpers/agoal.go index ec894341..6337d4aa 100644 --- a/internal/helpers/agoal.go +++ b/internal/helpers/agoal.go @@ -31,6 +31,7 @@ func newAgoalCommand() *cobra.Command { dws agoal scorecard detail 获取计分卡详情 dws agoal scorecard entity-detail 获取计分卡实体详情 dws agoal scorecard update 更新计分卡 + dws agoal scorecard search-entities 搜索计分卡指标与关键事项 dws agoal user rules 获取用户规则 dws agoal user objectives 查询用户目标列表 dws agoal report list-statistics 获取周月报数据跟催列表 @@ -359,7 +360,37 @@ scopeType 支持: scorecardUpdateCmd.Flags().String("content", "", "内容 JSON 数组 (必填)") scorecardUpdateCmd.Flags().String("request-id", "", "requestId (可选)") - scorecardCmd.AddCommand(scorecardDetailCmd, scorecardEntityDetailCmd, scorecardUpdateCmd) + scorecardSearchContentCmd := &cobra.Command{ + Use: "search-entities", + Short: "搜索计分卡指标与关键事项", + Long: `根据关键词模糊搜索计分卡中的指标和关键事项标题,返回匹配的计分卡实体信息(计分卡ID、实体ID、实体类型、标题、所属团队等)。`, + Example: ` dws agoal scorecard search-entities --keyword "业绩" + dws agoal scorecard search-entities --keyword "业绩" --page 1 --page-size 20`, + RunE: func(cmd *cobra.Command, args []string) error { + if err := validateRequiredFlags(cmd, "keyword"); err != nil { + return err + } + toolArgs := map[string]any{ + "keyword": mustGetFlag(cmd, "keyword"), + } + if v, _ := cmd.Flags().GetString("request-id"); v != "" { + toolArgs["requestId"] = v + } + if v, _ := cmd.Flags().GetInt("page"); v != 0 { + toolArgs["page"] = v + } + if v, _ := cmd.Flags().GetInt("page-size"); v != 0 { + toolArgs["pageSize"] = v + } + return callMCPTool("search_score_card_entities", toolArgs) + }, + } + scorecardSearchContentCmd.Flags().String("keyword", "", "搜索关键词,标题模糊匹配 (必填)") + scorecardSearchContentCmd.Flags().String("request-id", "", "requestId (可选)") + scorecardSearchContentCmd.Flags().Int("page", 0, "页码,默认 1 (可选)") + scorecardSearchContentCmd.Flags().Int("page-size", 0, "每页数量,最大 100 (可选)") + + scorecardCmd.AddCommand(scorecardDetailCmd, scorecardEntityDetailCmd, scorecardUpdateCmd, scorecardSearchContentCmd) // ── user: 用户目标管理 ────────────────────────────────────── diff --git a/internal/helpers/wukong_sync_commands_test.go b/internal/helpers/wukong_sync_commands_test.go index 74fd5beb..6fd1c379 100644 --- a/internal/helpers/wukong_sync_commands_test.go +++ b/internal/helpers/wukong_sync_commands_test.go @@ -179,6 +179,7 @@ func TestWukongSyncAgoalCommands(t *testing.T) { {[]string{"scorecard", "detail"}, []string{"selected-time", "dept-id", "request-id"}}, {[]string{"scorecard", "entity-detail"}, []string{"sc-id", "entity-id", "request-id"}}, {[]string{"scorecard", "update"}, []string{"dept-id", "selected-time", "id", "tracking-period-type", "content", "request-id"}}, + {[]string{"scorecard", "search-entities"}, []string{"keyword", "page", "page-size", "request-id"}}, {[]string{"user", "rules"}, []string{"user-id", "request-id"}}, {[]string{"user", "objectives"}, []string{"user-id", "rule-id", "period-ids", "request-id"}}, {[]string{"report", "list-statistics"}, []string{"keyword", "request-id"}}, diff --git a/skills/mono/references/products/agoal.md b/skills/mono/references/products/agoal.md index 527351ea..541cce9f 100644 --- a/skills/mono/references/products/agoal.md +++ b/skills/mono/references/products/agoal.md @@ -36,6 +36,7 @@ Agoal 是钉钉目标管理工具,支持战略解码、经营合约、计分 | `scorecard detail` | 获取计分卡详情 | `--selected-time` `--dept-id` | selectedTime 为 ISO-8601 字符串,如 `"2026-01-01T00:00:00+08:00"` | | `scorecard entity-detail` | 获取计分卡实体详情 | `--sc-id` `--entity-id` | 根据计分卡 id 和实体 id 查询 | | `scorecard update` | 更新计分卡 | `--dept-id` `--selected-time` `--id` `--tracking-period-type` `--content` | trackingPeriodType: MONTHLY/QUARTERLY | +| `scorecard search-entities` | 搜索计分卡指标与关键事项 | `--keyword` | 可选 `--page`、`--page-size`;keyword 为标题模糊匹配关键词 | ### user (用户目标管理) @@ -75,6 +76,7 @@ Agoal 是钉钉目标管理工具,支持战略解码、经营合约、计分 - 查看详情 → `scorecard detail` - 实体详情 → `scorecard entity-detail` - 修改/更新 → `scorecard update` +- 搜索计分卡指标与关键事项 → `scorecard search-entities --keyword "关键词"` 用户说"目标/OKR/我的目标/个人目标": - 规则周期 → `user rules` @@ -121,6 +123,10 @@ dws agoal scorecard update --dept-id DEPT_ID --selected-time "2026-01-01T00:00:0 --content '[{"id":"dim1","title":"业绩","items":[{"id":"item1","title":"收入","target":"100"}]}]' \ --format json +# 搜索计分卡指标与关键事项 +dws agoal scorecard search-entities --keyword "业绩" --format json +dws agoal scorecard search-entities --keyword "业绩" --page 1 --page-size 20 --format json + # 查询用户目标 dws agoal user rules --user-id USER_ID --format json dws agoal user objectives --user-id USER_ID --rule-id RULE_ID --period-ids "period1,period2" --format json diff --git a/skills/multi/dingtalk-misc/references/agoal.md b/skills/multi/dingtalk-misc/references/agoal.md index f76d6bee..00cede10 100644 --- a/skills/multi/dingtalk-misc/references/agoal.md +++ b/skills/multi/dingtalk-misc/references/agoal.md @@ -70,6 +70,7 @@ Agoal 是钉钉目标管理工具,支持战略解码、经营合约、计分 | `scorecard detail` | 获取计分卡详情 | `--selected-time` `--dept-id` | selectedTime 为 ISO-8601 字符串,如 `"2026-01-01T00:00:00+08:00"` | | `scorecard entity-detail` | 获取计分卡实体详情 | `--sc-id` `--entity-id` | 根据计分卡 id 和实体 id 查询 | | `scorecard update` | 更新计分卡 | `--dept-id` `--selected-time` `--id` `--tracking-period-type` `--content` | trackingPeriodType: MONTHLY/QUARTERLY | +| `scorecard search-entities` | 搜索计分卡指标与关键事项 | `--keyword` | 可选 `--page`、`--page-size`;keyword 为标题模糊匹配关键词 | #### selectedTime 时间说明 @@ -163,6 +164,7 @@ items 每项包含: - 查看详情 → `scorecard detail` - 实体详情 → `scorecard entity-detail` - 修改/更新 → `scorecard update` +- 搜索计分卡指标与关键事项 → `scorecard search-entities --keyword "关键词"` 用户说"目标/OKR/我的目标/个人目标": - 规则周期 → `user rules` @@ -218,6 +220,10 @@ dws agoal scorecard entity-detail --sc-id SC_ID --entity-id ENTITY_ID # 10. 更新计分卡 dws agoal scorecard update --dept-id DEPT_ID --selected-time "2025-01-01T00:00:00+08:00" --id SC_ID --tracking-period-type MONTHLY --content '[{"id":"dim1","title":"业绩","items":[{"id":"item1","title":"收入","target":"100"}]}]' +# 10.1 搜索计分卡指标与关键事项 +dws agoal scorecard search-entities --keyword "业绩" +dws agoal scorecard search-entities --keyword "业绩" --page 1 --page-size 20 + # 11. 查看用户规则 → 提取 ruleId 和 periodId dws agoal user rules --user-id USER_ID @@ -286,6 +292,7 @@ dws agoal obj-template create-or-update --template-id TPL_ID --title "业绩模 | "查经营合约" | `dws agoal contract list` / `contract detail` | | "更新经营合约" | 先 `contract detail` 获取完整内容,再 `contract update` 覆盖更新 | | "查计分卡" | `dws agoal scorecard detail` / `scorecard entity-detail` | +| "搜索计分卡指标与关键事项" | `dws agoal scorecard search-entities --keyword ` | | "更新计分卡" | 先查详情,再按 [agoal.md](./agoal.md) 覆盖更新 | | "查周月报统计/提交情况/跟催" | `dws agoal report list-statistics` / `report submit-detail` | diff --git a/test/fixtures/cli-interface-baseline.txt b/test/fixtures/cli-interface-baseline.txt index db802415..35aeb564 100644 --- a/test/fixtures/cli-interface-baseline.txt +++ b/test/fixtures/cli-interface-baseline.txt @@ -71,7 +71,7 @@ [agoal.scorecard] runnable: true hidden: false - commands: detail, entity-detail, update + commands: detail, entity-detail, search-entities, update flags: --client-id:string|required=false|hidden=false|no-opt=""|scope=inherited, --client-secret:string|required=false|hidden=false|no-opt=""|scope=inherited, --debug:bool|required=false|hidden=false|no-opt="true"|scope=inherited, --dry-run:bool|required=false|hidden=false|no-opt="true"|scope=inherited, --fields:string|required=false|hidden=false|no-opt=""|scope=inherited, -f/--format:string|required=false|hidden=false|no-opt=""|scope=inherited, -h/--help:bool|required=false|hidden=false|no-opt="true"|scope=local, --jq:string|required=false|hidden=false|no-opt=""|scope=inherited, --mock:bool|required=false|hidden=false|no-opt="true"|scope=inherited, -o/--output:string|required=false|hidden=true|no-opt=""|scope=inherited, --profile:string|required=false|hidden=false|no-opt=""|scope=inherited, --timeout:int|required=false|hidden=false|no-opt=""|scope=inherited, --token:string|required=false|hidden=true|no-opt=""|scope=inherited, -v/--verbose:bool|required=false|hidden=false|no-opt="true"|scope=inherited, -y/--yes:bool|required=false|hidden=false|no-opt="true"|scope=inherited [agoal.scorecard.detail] @@ -89,6 +89,11 @@ hidden: false flags: --client-id:string|required=false|hidden=false|no-opt=""|scope=inherited, --client-secret:string|required=false|hidden=false|no-opt=""|scope=inherited, --content:string|required=false|hidden=false|no-opt=""|scope=local, --debug:bool|required=false|hidden=false|no-opt="true"|scope=inherited, --dept-id:string|required=false|hidden=false|no-opt=""|scope=local, --dry-run:bool|required=false|hidden=false|no-opt="true"|scope=inherited, --fields:string|required=false|hidden=false|no-opt=""|scope=inherited, -f/--format:string|required=false|hidden=false|no-opt=""|scope=inherited, -h/--help:bool|required=false|hidden=false|no-opt="true"|scope=local, --id:string|required=false|hidden=false|no-opt=""|scope=local, --jq:string|required=false|hidden=false|no-opt=""|scope=inherited, --mock:bool|required=false|hidden=false|no-opt="true"|scope=inherited, -o/--output:string|required=false|hidden=true|no-opt=""|scope=inherited, --profile:string|required=false|hidden=false|no-opt=""|scope=inherited, --request-id:string|required=false|hidden=false|no-opt=""|scope=local, --selected-time:string|required=false|hidden=false|no-opt=""|scope=local, --timeout:int|required=false|hidden=false|no-opt=""|scope=inherited, --token:string|required=false|hidden=true|no-opt=""|scope=inherited, --tracking-period-type:string|required=false|hidden=false|no-opt=""|scope=local, -v/--verbose:bool|required=false|hidden=false|no-opt="true"|scope=inherited, -y/--yes:bool|required=false|hidden=false|no-opt="true"|scope=inherited +[agoal.scorecard.search-entities] + runnable: true + hidden: false + flags: --client-id:string|required=false|hidden=false|no-opt=""|scope=inherited, --client-secret:string|required=false|hidden=false|no-opt=""|scope=inherited, --debug:bool|required=false|hidden=false|no-opt="true"|scope=inherited, --dry-run:bool|required=false|hidden=false|no-opt="true"|scope=inherited, --fields:string|required=false|hidden=false|no-opt=""|scope=inherited, -f/--format:string|required=false|hidden=false|no-opt=""|scope=inherited, -h/--help:bool|required=false|hidden=false|no-opt="true"|scope=local, --jq:string|required=false|hidden=false|no-opt=""|scope=inherited, --keyword:string|required=false|hidden=false|no-opt=""|scope=local, --mock:bool|required=false|hidden=false|no-opt="true"|scope=inherited, -o/--output:string|required=false|hidden=true|no-opt=""|scope=inherited, --page:int|required=false|hidden=false|no-opt=""|scope=local, --page-size:int|required=false|hidden=false|no-opt=""|scope=local, --profile:string|required=false|hidden=false|no-opt=""|scope=inherited, --request-id:string|required=false|hidden=false|no-opt=""|scope=local, --timeout:int|required=false|hidden=false|no-opt=""|scope=inherited, --token:string|required=false|hidden=true|no-opt=""|scope=inherited, -v/--verbose:bool|required=false|hidden=false|no-opt="true"|scope=inherited, -y/--yes:bool|required=false|hidden=false|no-opt="true"|scope=inherited + [agoal.strategy] runnable: true hidden: false From 999e7a7b9dd2d6174b98f0e43d5cfb375ddcc1f2 Mon Sep 17 00:00:00 2001 From: anxb Date: Wed, 19 Aug 2026 15:58:28 +0800 Subject: [PATCH 2/2] =?UTF-8?q?feat:=20agoal=E6=96=B0=E5=A2=9Edws2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .changes/agoal-scorecard-search-entities.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changes/agoal-scorecard-search-entities.md diff --git a/.changes/agoal-scorecard-search-entities.md b/.changes/agoal-scorecard-search-entities.md new file mode 100644 index 00000000..1906a4bb --- /dev/null +++ b/.changes/agoal-scorecard-search-entities.md @@ -0,0 +1,5 @@ +--- +category: Added +--- + +- **Agoal scorecard search-entities** — `dws agoal scorecard search-entities` searches scorecard metrics and key items by keyword, returning matching entity info (scorecard ID, entity ID, entity type, title, owning team) with optional `--page`/`--page-size` pagination.