mirror of
https://github.com/larksuite/cli.git
synced 2026-09-14 18:42:53 +08:00
fix(base): repair skill references and clarify view creation (#2725)
* fix(base): repair skill references and clarify view creation * docs(base): remove self-routing guidance and extra embed test * docs(base): keep view creation examples in command help
This commit is contained in:
@@ -38,7 +38,7 @@ var BaseFormSubmit = common.Shortcut{
|
||||
Tips: []string{
|
||||
`Example (no attachments): --share-token shrXXXX --json '{"fields":{"Service Rating":5,"Review":"Good service"}}'`,
|
||||
`Example (with attachments): --share-token shrXXXX --base-token basXXX --json '{"fields":{"Service Rating":5},"attachments":{"Attachment":["./report.pdf"]}}'`,
|
||||
`Cell values in "fields" follow lark-base-cell-value.md conventions; "attachments" maps field names to local file path arrays — the CLI uploads them in parallel and merges them into the submission.`,
|
||||
`"fields" maps field names to cell values; "attachments" maps field names to local file path arrays — the CLI uploads them in parallel and merges them into the submission.`,
|
||||
baseHighRiskYesTip,
|
||||
},
|
||||
Validate: func(ctx context.Context, runtime *common.RuntimeContext) error {
|
||||
|
||||
@@ -1216,8 +1216,6 @@ func TestBaseRecordWriteHelpGuidesAgents(t *testing.T) {
|
||||
"when multiple=false, the array can contain only one item",
|
||||
`location uses {"lng":116.397428,"lat":39.90923}`,
|
||||
"Do not guess user/chat/linked-record IDs or location coordinates",
|
||||
"lark-base-cell-value.md",
|
||||
"do not invent values for fields not covered by the happy path",
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -1232,8 +1230,6 @@ func TestBaseRecordWriteHelpGuidesAgents(t *testing.T) {
|
||||
"do not immediately +record-list the same table",
|
||||
"CellValue happy path: text/phone/url",
|
||||
`ID-based CellValue: user/group/link fields use arrays like [{"id":"ou_xxx"}]`,
|
||||
"lark-base-cell-value.md",
|
||||
"do not invent values for fields not covered by the happy path",
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -1249,8 +1245,6 @@ func TestBaseRecordWriteHelpGuidesAgents(t *testing.T) {
|
||||
"Batch update supports max 200 records per call",
|
||||
"CellValue happy path: text/phone/url",
|
||||
`ID-based CellValue: user/group/link fields use arrays like [{"id":"ou_xxx"}]`,
|
||||
"lark-base-cell-value.md",
|
||||
"do not invent values for fields not covered by the happy path",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -27,7 +27,6 @@ var BaseRecordBatchCreate = common.Shortcut{
|
||||
"Before writing, use +field-list to confirm real writable fields; do not write system fields, formula, lookup, or attachment fields as normal CellValue.",
|
||||
"Batch create supports max 200 records per call.",
|
||||
"After batch-creating known helper rows, use the returned record IDs and your submitted rows; do not immediately +record-list the same table unless you need server-normalized formula/lookup values or failure diagnosis.",
|
||||
"Use the record-batch-create guide for command limits and edge cases.",
|
||||
}, recordCellValueHappyPathTips...),
|
||||
Validate: func(ctx context.Context, runtime *common.RuntimeContext) error {
|
||||
return validateRecordJSON(runtime)
|
||||
|
||||
@@ -26,7 +26,7 @@ var BaseRecordBatchUpdate = common.Shortcut{
|
||||
`Example: {"update_records":{"recA":{"Status":["Done"]},"recB":{"Score":20}}}.`,
|
||||
"The response contains only optional ignored_fields and does not check whether record IDs exist; read records back when confirmation is required.",
|
||||
"Before writing, use +field-list to confirm real writable fields; do not write system fields, formula, lookup, or attachment fields as normal CellValue.",
|
||||
"Batch update supports max 200 records per call; use the record-batch-update guide for command limits and edge cases.",
|
||||
"Batch update supports max 200 records per call.",
|
||||
}, recordCellValueHappyPathTips...),
|
||||
Validate: func(ctx context.Context, runtime *common.RuntimeContext) error {
|
||||
return validateRecordJSON(runtime)
|
||||
|
||||
@@ -23,7 +23,6 @@ var recordCellValueHappyPathTips = []string{
|
||||
`ID-based CellValue: user/group/link fields use arrays like [{"id":"ou_xxx"}], [{"id":"oc_xxx"}], [{"id":"rec_xxx"}]; location uses {"lng":116.397428,"lat":39.90923}; null clears a cell when allowed.`,
|
||||
"User and group fields always use arrays; when multiple=false, the array can contain only one item.",
|
||||
"Do not guess user/chat/linked-record IDs or location coordinates; resolve them first with the relevant contact/im/record lookup flow.",
|
||||
"Use lark-base-cell-value.md for complex CellValue shapes and special field types; do not invent values for fields not covered by the happy path.",
|
||||
}
|
||||
|
||||
type recordSelection struct {
|
||||
|
||||
@@ -22,7 +22,8 @@ var BaseViewCreate = common.Shortcut{
|
||||
{Name: "json", Desc: "view JSON object/array; type defaults to grid; type range: grid, kanban, gallery, calendar, gantt", Required: true},
|
||||
},
|
||||
Tips: []string{
|
||||
`Example: lark-cli base +view-create --base-token <base_token> --table-id <table_id> --json '{"name":"Main","type":"grid"}'`,
|
||||
`Example: lark-cli base +view-create --base-token <base_token> --table-id <table_id> --json '{"name":"Main","type":"grid"}' --as user`,
|
||||
"Set the view name and type in --json; --name, --view-name, and --view-type are not supported.",
|
||||
`Minimal: --json '{"name":"Main"}' creates a grid view.`,
|
||||
"Do not pass form as a view type; form views are managed through form commands.",
|
||||
`Use +view-set-visible-fields after creation when the user needs a specific field order or visibility.`,
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
- `lark-cli base table.records create` ✅
|
||||
- `lark-cli base records create` ❌
|
||||
2. **优先使用 Shortcut** — 有 Shortcut 的操作不要手拼原生 API
|
||||
3. **写记录前** — 先调用 `table.fields list` 获取字段 `type/ui_type`,再读 [lark-base-cell-value.md](../../skills/lark-base/references/lark-base-cell-value.md);该文档是 CellValue 的 source of truth
|
||||
3. **写记录前** — 先调用 `table.fields list` 获取字段 `type/ui_type`,按字段类型构造 CellValue,不把字段 schema 当作单元格值
|
||||
4. **写字段前** — 先读 [lark-base-field-schema.md](../../skills/lark-base/references/lark-base-field-schema.md) 确认字段类型 JSON 结构
|
||||
5. **筛选查询前** — 先读 [lark-base-view-set-filter.md](../../skills/lark-base/references/lark-base-view-set-filter.md),当前 `base/v3` 通过 `view.filter update + table.records list` 组合完成筛选读取
|
||||
6. **批量上限 200 条/次** — 同一表建议串行写入,并在批次间延迟 0.5–1 秒
|
||||
@@ -116,6 +116,5 @@ lark-cli wiki +node-get --node-token 'https://xxx.feishu.cn/wiki/Pgrrwvr********
|
||||
## 参考文档
|
||||
|
||||
- [lark-base-field-schema.md](../../skills/lark-base/references/lark-base-field-schema.md) — 字段类型 JSON 配置
|
||||
- [lark-base-cell-value.md](../../skills/lark-base/references/lark-base-cell-value.md) — CellValue source of truth
|
||||
- [lark-base-view-set-filter.md](../../skills/lark-base/references/lark-base-view-set-filter.md) — 查询筛选指南(filter / operator / sort / 分页)
|
||||
- 具体命令示例由命令 --help 内置 tips 承接;复杂 JSON 只读上方保留 reference
|
||||
|
||||
Reference in New Issue
Block a user