-
Notifications
You must be signed in to change notification settings - Fork 576
feat(base): add view visible fields get/set shortcuts #326
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
04df6a1
feat: add base view visible fields shortcuts and docs
kongenpei b239fb9
docs: add view-create guidance for visible fields read
kongenpei f98611c
docs(base): refine visible fields reference wording
kongenpei 81b8527
refactor(base): remove noop validate hook from view-set-visible-fields
kongenpei f83c4e8
docs: unify view-set-visible-fields example placeholders
kongenpei 5b15992
docs: update visible fields example field placeholder
kongenpei 5a3ffac
Merge remote-tracking branch 'origin/main' into feat-visible-fields
kongenpei 37c3923
fix(base): pass parse context in view-set-visible-fields
kongenpei b9fb714
feat: add tips for view-set-visible-fields json usage
kongenpei File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| // Copyright (c) 2026 Lark Technologies Pte. Ltd. | ||
| // SPDX-License-Identifier: MIT | ||
|
|
||
| package base | ||
|
|
||
| import ( | ||
| "context" | ||
|
|
||
| "github.com/larksuite/cli/shortcuts/common" | ||
| ) | ||
|
|
||
| var BaseViewGetVisibleFields = common.Shortcut{ | ||
| Service: "base", | ||
| Command: "+view-get-visible-fields", | ||
| Description: "Get view visible fields configuration", | ||
| Risk: "read", | ||
| Scopes: []string{"base:view:read"}, | ||
| AuthTypes: authTypes(), | ||
| Flags: []common.Flag{baseTokenFlag(true), tableRefFlag(true), viewRefFlag(true)}, | ||
| DryRun: dryRunViewGetVisibleFields, | ||
| Execute: func(ctx context.Context, runtime *common.RuntimeContext) error { | ||
| return executeViewGetProperty(runtime, "visible_fields", "visible_fields") | ||
| }, | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| // Copyright (c) 2026 Lark Technologies Pte. Ltd. | ||
| // SPDX-License-Identifier: MIT | ||
|
|
||
| package base | ||
|
|
||
| import ( | ||
| "context" | ||
|
|
||
| "github.com/larksuite/cli/shortcuts/common" | ||
| ) | ||
|
|
||
| var BaseViewSetVisibleFields = common.Shortcut{ | ||
| Service: "base", | ||
| Command: "+view-set-visible-fields", | ||
| Description: "Set view visible fields", | ||
| Risk: "write", | ||
| Scopes: []string{"base:view:write_only"}, | ||
| AuthTypes: authTypes(), | ||
| Flags: []common.Flag{ | ||
| baseTokenFlag(true), | ||
| tableRefFlag(true), | ||
| viewRefFlag(true), | ||
| {Name: "json", Desc: `visible fields JSON object with "visible_fields"`, Required: true}, | ||
| }, | ||
| Tips: []string{ | ||
| `Example: --json '{"visible_fields":["fldXXX"]}'`, | ||
| "Agent hint: use the lark-base skill's view-set-visible-fields guide for usage and limits.", | ||
| }, | ||
| DryRun: dryRunViewSetVisibleFields, | ||
| Execute: func(ctx context.Context, runtime *common.RuntimeContext) error { | ||
| return executeViewSetVisibleFields(runtime) | ||
| }, | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
skills/lark-base/references/lark-base-view-get-visible-fields.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| # base +view-get-visible-fields | ||
|
|
||
| > **前置条件:** 先阅读 [`../lark-shared/SKILL.md`](../../lark-shared/SKILL.md) 了解认证、全局参数和安全规则。 | ||
|
|
||
| 获取可见字段配置。 | ||
|
|
||
| ## 推荐命令 | ||
|
|
||
| ```bash | ||
| lark-cli base +view-get-visible-fields \ | ||
| --base-token XXXXXX \ | ||
| --table-id tblXXX \ | ||
| --view-id vewXXX | ||
| ``` | ||
|
|
||
| ## 参数 | ||
|
|
||
| | 参数 | 必填 | 说明 | | ||
| |------|------|------| | ||
| | `--base-token <token>` | 是 | Base Token | | ||
| | `--table-id <id_or_name>` | 是 | 表 ID 或表名 | | ||
| | `--view-id <id_or_name>` | 是 | 视图 ID 或视图名 | | ||
|
|
||
| ## API 入参详情 | ||
|
|
||
| **HTTP 方法和路径:** | ||
|
|
||
| ``` | ||
| GET /open-apis/base/v3/bases/:base_token/tables/:table_id/views/:view_id/visible_fields | ||
| ``` | ||
|
kongenpei marked this conversation as resolved.
|
||
|
|
||
| ## 返回重点 | ||
|
|
||
| - 返回当前视图可见字段列表。 | ||
|
|
||
| ## 参考 | ||
|
|
||
| - [lark-base-view.md](lark-base-view.md) — view 索引页 | ||
73 changes: 73 additions & 0 deletions
73
skills/lark-base/references/lark-base-view-set-visible-fields.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| # base +view-set-visible-fields | ||
|
|
||
| > **前置条件:** 先阅读 [`../lark-shared/SKILL.md`](../../lark-shared/SKILL.md) 了解认证、全局参数和安全规则。 | ||
|
|
||
| 更新视图可见字段列表(同时控制视图中的字段顺序)。 | ||
|
|
||
| ## 推荐命令 | ||
|
|
||
| ```bash | ||
| lark-cli base +view-set-visible-fields \ | ||
| --base-token XXXXXX \ | ||
| --table-id tblXXX \ | ||
| --view-id vewXXX \ | ||
| --json '{"visible_fields":["标题","fldXXX"]}' | ||
| ``` | ||
|
|
||
| ## JSON 结构 | ||
|
|
||
| ```json | ||
| { | ||
| "visible_fields": ["标题", "fldXXX"] | ||
| } | ||
| ``` | ||
|
|
||
| ## 参数 | ||
|
|
||
| | 参数 | 必填 | 说明 | | ||
| |------|------|------| | ||
| | `--base-token <token>` | 是 | Base Token | | ||
| | `--table-id <id_or_name>` | 是 | 表 ID 或表名 | | ||
| | `--view-id <id_or_name>` | 是 | 视图 ID 或视图名 | | ||
| | `--json <body>` | 是 | JSON 对象,且必须包含 `visible_fields` | | ||
|
|
||
| ## API 入参详情 | ||
|
|
||
| **HTTP 方法和路径:** | ||
|
|
||
| ``` | ||
| PUT /open-apis/base/v3/bases/:base_token/tables/:table_id/views/:view_id/visible_fields | ||
| ``` | ||
|
kongenpei marked this conversation as resolved.
|
||
|
|
||
| **接口 body 格式:** | ||
|
|
||
| ```json | ||
| { | ||
| "visible_fields": ["标题", "fldXXX"] | ||
| } | ||
| ``` | ||
|
|
||
| ## 返回重点 | ||
|
|
||
| - 返回可见字段列表与顺序(`primaryField` 会被强制置顶)。 | ||
|
|
||
| ## 结构规则 | ||
|
|
||
| - `visible_fields`:字符串数组,每项可传字段 id 或字段名 | ||
| - 数组顺序用于控制视图字段顺序;主字段 `primaryField` 必须存在且位于第一位,否则 API 会强制将其提升到第一位 | ||
| - `--json` 必须传对象:`{ "visible_fields": [...] }` | ||
|
|
||
| ## 工作流 | ||
|
|
||
| 1. 用户要求“改字段顺序”或“设置可见字段”时,直接使用本命令。 | ||
| 2. 建议优先使用字段 id,避免字段重名或后续改名带来的歧义。 | ||
|
|
||
| ## 坑点 | ||
|
|
||
| - ⚠️ 这是写入操作,执行前必须确认。 | ||
| - ⚠️ 接口最终结果会受后端 `primaryField` 强制显示规则影响,返回顺序可能与传入数组不同。 | ||
| - ⚠️ 如果传字段名,必须与当前表真实字段名精确匹配。 | ||
|
|
||
| ## 参考 | ||
|
|
||
| - [lark-base-view.md](lark-base-view.md) — view 索引页 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.